From 2c28e6556b8cc5d57efe95aa4fc2d7cfb533dbb3 Mon Sep 17 00:00:00 2001 From: Alexander Anisimov <70746131+1anisim@users.noreply.github.com> Date: Mon, 23 Nov 2020 11:14:52 +0300 Subject: [PATCH 001/698] Add JetBrains to the first part of text --- ReadMe.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ReadMe.md b/ReadMe.md index d61a05fbf26..8376addd093 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -5,7 +5,10 @@ # Kotlin Programming Language -Welcome to [Kotlin](https://kotlinlang.org/)! Some handy links: +Welcome to [Kotlin](https://kotlinlang.org/)! +It is an open-source, statically typed programming language supported and developed by [JetBrains](https://www.jetbrains.com/). + +Some handy links: * [Kotlin Site](https://kotlinlang.org/) * [Getting Started Guide](https://kotlinlang.org/docs/tutorials/getting-started.html) From ccc272c49f419fc59ccba80231b72c80a4f79ba7 Mon Sep 17 00:00:00 2001 From: Ivan Gavrilovic Date: Fri, 20 Nov 2020 19:06:50 +0000 Subject: [PATCH 002/698] KT-43489: KGP - Avoid storing build history mapping in a property If tasks are created eagerly, it is possible for this mapping to be initalized too early. This causes incremental compilation to fail, as it will contain mappings only for projects that have been evaluated thus far. Fixes KT-43489 --- .../IncrementalCompilationMultiProjectIT.kt | 38 +++++++++++++++++++ .../jetbrains/kotlin/gradle/tasks/Tasks.kt | 6 +-- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/IncrementalCompilationMultiProjectIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/IncrementalCompilationMultiProjectIT.kt index bd4b2728148..2425c7fa4a9 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/IncrementalCompilationMultiProjectIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/IncrementalCompilationMultiProjectIT.kt @@ -99,6 +99,44 @@ class IncrementalCompilationJvmMultiProjectIT : BaseIncrementalCompilationMultiP assertCompiledKotlinSources(relativePaths) } } + + /** Regression test for KT-43489. Make sure build history mapping is not initialized too early. */ + @Test + fun testBuildHistoryMappingLazilyComputedWithWorkers() { + val project = defaultProject() + project.setupWorkingDir() + project.projectDir.resolve("app/build.gradle").appendText( + """ + // added to force eager configuration + tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' + } + """.trimIndent() + ) + val options = defaultBuildOptions().copy(parallelTasksInProject = true) + project.build(options = options, params = arrayOf("build")) { + assertSuccessful() + } + + val aKt = project.projectDir.getFileByName("A.kt") + aKt.writeText( + """ +package bar + +open class A { + fun a() {} + fun newA() {} +} +""" + ) + + project.build(options = options, params = arrayOf("build")) { + assertSuccessful() + val affectedSources = project.projectDir.getFilesByNames("A.kt", "B.kt", "AA.kt", "AAA.kt", "BB.kt") + val relativePaths = project.relativize(affectedSources) + assertCompiledKotlinSources(relativePaths) + } + } } abstract class BaseIncrementalCompilationMultiProjectIT : BaseGradleIT() { diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/Tasks.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/Tasks.kt index 6357f14a8a3..86233d75273 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/Tasks.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/Tasks.kt @@ -323,6 +323,7 @@ abstract class AbstractKotlinCompile() : AbstractKo private val kotlinLogger by lazy { GradleKotlinLogger(logger) } + /** Keep lazy to avoid computing before all projects are evaluated. */ @get:Internal internal val compilerRunner by lazy { compilerRunner() } @@ -593,10 +594,7 @@ internal open class KotlinCompileWithWorkers @Inject constructor( private val workerExecutor: WorkerExecutor ) : KotlinCompile() { - @get:Internal - val compilerRunnerValue = GradleCompilerRunnerWithWorkers(GradleCompileTaskProvider(this), workerExecutor) - - override fun compilerRunner() = compilerRunnerValue + override fun compilerRunner() = GradleCompilerRunnerWithWorkers(GradleCompileTaskProvider(this), workerExecutor) } @CacheableTask From 18612c1ef0873ef1968c2e0035853475c21e3366 Mon Sep 17 00:00:00 2001 From: Kristoffer Andersen Date: Thu, 22 Oct 2020 17:38:48 +0200 Subject: [PATCH 003/698] [JVM+IR] Rebase LVT test of destructuing in lambda params The debug experiece of destructuring patterns in lambdas is different across the two backends due to the IR backend moving local variables to fields. However, since the destructuring variable is never actually visible in the debugger (no linenumbers in the live range of the variable), and the variable is never used for anything other than hiding it from the debugger, we propose that it is not actually necessary to include it in the LVT (and in fact, could be left out of the LVT on the old backend). --- .../underscoreNames.kt | 31 -------------- .../localVariables/suspend/underscoreNames.kt | 42 ++++++++++++------- ...CheckLocalVariablesTableTestGenerated.java | 5 --- ...CheckLocalVariablesTableTestGenerated.java | 5 --- 4 files changed, 28 insertions(+), 55 deletions(-) delete mode 100644 compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/underscoreNames.kt diff --git a/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/underscoreNames.kt b/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/underscoreNames.kt deleted file mode 100644 index 25244e4d07a..00000000000 --- a/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/underscoreNames.kt +++ /dev/null @@ -1,31 +0,0 @@ -// WITH_RUNTIME -class A { - operator fun component1() = "O" - operator fun component2(): String = throw RuntimeException("fail 0") - operator fun component3() = "K" -} - -suspend fun foo(a: A, block: suspend (A) -> String): String = block(a) - -suspend fun test() = foo(A()) { (x_param, _, y_param) -> - x_param + y_param -} - -// Parameters (including anonymous destructuring parameters) are moved to fields in the Continuation class for the suspend lambda class. -// However, in non-IR, the fields are first stored in local variables, and they are not read directly (even for destructuring components). -// In IR, the fields are directly read from. - -// METHOD : UnderscoreNamesKt$test$2.invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; - -// JVM_TEMPLATES -// VARIABLE : NAME=$dstr$x_param$_u24__u24$y_param TYPE=LA; INDEX=2 -// VARIABLE : NAME=x_param TYPE=Ljava/lang/String; INDEX=3 -// VARIABLE : NAME=y_param TYPE=Ljava/lang/String; INDEX=4 -// VARIABLE : NAME=this TYPE=LUnderscoreNamesKt$test$2; INDEX=0 -// VARIABLE : NAME=$result TYPE=Ljava/lang/Object; INDEX=1 - -// JVM_IR_TEMPLATES -// VARIABLE : NAME=x_param TYPE=Ljava/lang/String; INDEX=2 -// VARIABLE : NAME=y_param TYPE=Ljava/lang/String; INDEX=3 -// VARIABLE : NAME=this TYPE=LUnderscoreNamesKt$test$2; INDEX=0 -// VARIABLE : NAME=$result TYPE=Ljava/lang/Object; INDEX=1 diff --git a/compiler/testData/debug/localVariables/suspend/underscoreNames.kt b/compiler/testData/debug/localVariables/suspend/underscoreNames.kt index d654a083455..728452ff7c3 100644 --- a/compiler/testData/debug/localVariables/suspend/underscoreNames.kt +++ b/compiler/testData/debug/localVariables/suspend/underscoreNames.kt @@ -17,36 +17,50 @@ suspend fun box() = foo(A()) { (x_param, _, y_param) -> // However, in non-IR, the fields are first stored in local variables, and they are not read directly (even for destructuring components). // In IR, the fields are directly read from. -// METHOD : UnderscoreNamesKt$test$2.invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; +// The local variable for destructuring suspend lambda arguments, in this case +// `$dstr$x_param$_u24__u24$y_param`, is moved to a field in the IR backend, +// so does not figure in the LVT. -// JVM_TEMPLATES -// VARIABLE : NAME=x_param TYPE=Ljava/lang/String; INDEX=3 -// VARIABLE : NAME=y_param TYPE=Ljava/lang/String; INDEX=4 -// VARIABLE : NAME=this TYPE=LUnderscoreNamesKt$test$2; INDEX=0 -// VARIABLE : NAME=$result TYPE=Ljava/lang/Object; INDEX=1 - -// JVM_IR_TEMPLATES -// VARIABLE : NAME=x_param TYPE=Ljava/lang/String; INDEX=2 -// VARIABLE : NAME=y_param TYPE=Ljava/lang/String; INDEX=3 -// VARIABLE : NAME=this TYPE=LUnderscoreNamesKt$test$2; INDEX=0 -// VARIABLE : NAME=$result TYPE=Ljava/lang/Object; INDEX=1 - -// IGNORE_BACKEND: JVM_IR // LOCAL VARIABLES // test.kt:12 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation // test.kt:4 : // test.kt:12 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation // test.kt:10 foo: a:A=A, block:kotlin.jvm.functions.Function2=TestKt$box$2, $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation // CoroutineUtil.kt:28 getContext: + +// LOCAL VARIABLES JVM // test.kt:-1 : // test.kt:-1 create: value:java.lang.Object=A, completion:kotlin.coroutines.Continuation=helpers.ResultContinuation // test.kt:-1 invoke: + +// LOCAL VARIABLES JVM_IR +// test.kt:-1 : $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation +// test.kt:-1 create: value:java.lang.Object=A, $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation +// test.kt:-1 invoke: p1:A=A, p2:kotlin.coroutines.Continuation=helpers.ResultContinuation + +// LOCAL VARIABLES // test.kt:12 invokeSuspend: // test.kt:5 component1: + +// LOCAL VARIABLES JVM // test.kt:12 invokeSuspend: $result:java.lang.Object=kotlin.Unit, $dstr$x_param$_u24__u24$y_param:A=A // test.kt:7 component3: // test.kt:12 invokeSuspend: $result:java.lang.Object=kotlin.Unit, $dstr$x_param$_u24__u24$y_param:A=A + +// LOCAL VARIABLES JVM_IR +// test.kt:12 invokeSuspend: $result:java.lang.Object=kotlin.Unit +// test.kt:7 component3: +// test.kt:12 invokeSuspend: $result:java.lang.Object=kotlin.Unit, x_param:java.lang.String="O":java.lang.String + +// LOCAL VARIABLES // test.kt:13 invokeSuspend: $result:java.lang.Object=kotlin.Unit, x_param:java.lang.String="O":java.lang.String, y_param:java.lang.String="K":java.lang.String + +// LOCAL VARIABLES JVM // test.kt:-1 invoke: + +// LOCAL VARIABLES JVM_IR +// test.kt:-1 invoke: p1:A=A, p2:kotlin.coroutines.Continuation=helpers.ResultContinuation + +// LOCAL VARIABLES // test.kt:10 foo: a:A=A, block:kotlin.jvm.functions.Function2=TestKt$box$2, $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation // test.kt:14 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/CheckLocalVariablesTableTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/CheckLocalVariablesTableTestGenerated.java index eb4e6c9fd13..45d7ff1000d 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/CheckLocalVariablesTableTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/CheckLocalVariablesTableTestGenerated.java @@ -188,10 +188,5 @@ public class CheckLocalVariablesTableTestGenerated extends AbstractCheckLocalVar public void testParameters() throws Exception { runTest("compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/parameters.kt"); } - - @TestMetadata("underscoreNames.kt") - public void testUnderscoreNames() throws Exception { - runTest("compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/underscoreNames.kt"); - } } } diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCheckLocalVariablesTableTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCheckLocalVariablesTableTestGenerated.java index 18a8246b391..fe853f1f52b 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCheckLocalVariablesTableTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCheckLocalVariablesTableTestGenerated.java @@ -188,10 +188,5 @@ public class IrCheckLocalVariablesTableTestGenerated extends AbstractIrCheckLoca public void testParameters() throws Exception { runTest("compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/parameters.kt"); } - - @TestMetadata("underscoreNames.kt") - public void testUnderscoreNames() throws Exception { - runTest("compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/underscoreNames.kt"); - } } } From 37197a95cdfa8b715c422307565189d65d94fedf Mon Sep 17 00:00:00 2001 From: Alexander Anisimov <70746131+1anisim@users.noreply.github.com> Date: Mon, 23 Nov 2020 13:14:26 +0300 Subject: [PATCH 004/698] Update ReadMe.md --- ReadMe.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReadMe.md b/ReadMe.md index 8376addd093..219e30c02de 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -6,7 +6,7 @@ # Kotlin Programming Language Welcome to [Kotlin](https://kotlinlang.org/)! -It is an open-source, statically typed programming language supported and developed by [JetBrains](https://www.jetbrains.com/). +It is an open-source, statically typed programming language supported and developed by [JetBrains](https://www.jetbrains.com/) and open-source contributors. Some handy links: From a9c9406a55429c3ef89469678f9e889ccc8680de Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Fri, 20 Nov 2020 22:25:56 +0700 Subject: [PATCH 005/698] [Gradle, K/N] Set LIBCLANG_DISABLE_CRASH_RECOVERY=1 for cinterop Issue #KT-42485 Fixed --- .../kotlin/gradle/native/GeneralNativeIT.kt | 51 +++++++++++++++---- .../kotlin/compilerRunner/KotlinToolRunner.kt | 4 +- .../compilerRunner/nativeToolRunners.kt | 12 +++-- 3 files changed, 50 insertions(+), 17 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/GeneralNativeIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/GeneralNativeIT.kt index 8edf25f5761..bbf0dea1eba 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/GeneralNativeIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/GeneralNativeIT.kt @@ -677,10 +677,14 @@ class GeneralNativeIT : BaseGradleIT() { "$projectName/build/classes/kotlin/host/test/${projectName}_test.klib", ) - build(":projectLibrary:build") { + // Enable info log to see cinterop environment variables. + build(":projectLibrary:build", "--info") { assertSuccessful() assertTasksExecuted(":projectLibrary:cinteropAnotherNumberHost") libraryFiles("projectLibrary", "anotherNumber").forEach { assertFileExists(it) } + checkNativeCustomEnvironment(":projectLibrary:cinteropAnotherNumberHost", toolName = "cinterop") { env -> + assertEquals("1", env["LIBCLANG_DISABLE_CRASH_RECOVERY"]) + } } build(":publishedLibrary:build", ":publishedLibrary:publish") { @@ -839,8 +843,18 @@ class GeneralNativeIT : BaseGradleIT() { return Collections.indexOfSubList(this, elements.toList()) != -1 } - fun CompiledProject.extractNativeCommandLineArguments(taskPath: String? = null, toolName: String): List { - val arguments = output.lineSequence() + private enum class NativeToolSettingsKind(val title: String) { + COMMAND_LINE_ARGUMENTS("Arguments"), + CUSTOM_ENV_VARIABLES("Custom ENV variables") + } + + private fun CompiledProject.extractNativeToolSettings( + toolName: String, + taskPath: String?, + settingsKind: NativeToolSettingsKind + ): Sequence { + val settingsPrefix = "${settingsKind.title} = [" + val settings = output.lineSequence() .run { if (taskPath != null) dropWhile { "Executing actions for task '$taskPath'" !in it }.drop(1) else this } @@ -851,22 +865,39 @@ class GeneralNativeIT : BaseGradleIT() { .drop(1) .dropWhile { check(taskPath == null || "Executing actions for task" !in it) { "Unexpected log line with new Gradle task: $it" } - "Arguments = [" !in it + settingsPrefix !in it } - val argumentsHeader = arguments.firstOrNull() - check(argumentsHeader != null && "Arguments = [" in argumentsHeader) { "No arguments in $argumentsHeader" } - - return if (argumentsHeader.trimEnd().endsWith(']')) - emptyList() // no arguments + val settingsHeader = settings.firstOrNull() + check(settingsHeader != null && settingsPrefix in settingsHeader) { + "Cannot find setting '${settingsKind.title}' for task ${taskPath}" + } + + return if (settingsHeader.trimEnd().endsWith(']')) + emptySequence() // No parameters. else - arguments.drop(1).map { it.trim() }.takeWhile { it != "]" }.toList() + settings.drop(1).map { it.trim() }.takeWhile { it != "]" } } + fun CompiledProject.extractNativeCommandLineArguments(taskPath: String? = null, toolName: String): List = + extractNativeToolSettings(toolName, taskPath, NativeToolSettingsKind.COMMAND_LINE_ARGUMENTS).toList() + + fun CompiledProject.extractNativeCustomEnvironment(taskPath: String? = null, toolName: String): Map = + extractNativeToolSettings(toolName, taskPath, NativeToolSettingsKind.CUSTOM_ENV_VARIABLES).map { + val (key, value) = it.split("=") + key.trim() to value.trim() + }.toMap() + fun CompiledProject.checkNativeCommandLineArguments( vararg taskPaths: String, toolName: String = "konanc", check: (List) -> Unit ) = taskPaths.forEach { taskPath -> check(extractNativeCommandLineArguments(taskPath, toolName)) } + + fun CompiledProject.checkNativeCustomEnvironment( + vararg taskPaths: String, + toolName: String = "konanc", + check: (Map) -> Unit + ) = taskPaths.forEach { taskPath -> check(extractNativeCustomEnvironment(taskPath, toolName)) } } } \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/KotlinToolRunner.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/KotlinToolRunner.kt index 39e406c9b86..d6724bb575b 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/KotlinToolRunner.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/KotlinToolRunner.kt @@ -136,12 +136,12 @@ internal abstract class KotlinToolRunner( private val isolatedClassLoadersMap = ConcurrentHashMap() private fun Map.toPrettyString(): String = buildString { - append('{') + append('[') if (this@toPrettyString.isNotEmpty()) append('\n') this@toPrettyString.entries.forEach { (key, value) -> append('\t').append(key).append(" = ").append(value.toPrettyString()).append('\n') } - append('}') + append(']') } private fun Collection.toPrettyString(): String = buildString { diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/nativeToolRunners.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/nativeToolRunners.kt index bef1e6cf315..25ba6ba7a19 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/nativeToolRunners.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/nativeToolRunners.kt @@ -92,11 +92,13 @@ internal abstract class AbstractKotlinNativeCInteropRunner(toolName: String, pro override val mustRunViaExec get() = true override val execEnvironment by lazy { - val llvmExecutablesPath = llvmExecutablesPath - if (llvmExecutablesPath != null) - super.execEnvironment + ("PATH" to "$llvmExecutablesPath;${System.getenv("PATH")}") - else - super.execEnvironment + val result = mutableMapOf() + result.putAll(super.execEnvironment) + result["LIBCLANG_DISABLE_CRASH_RECOVERY"] = "1" + llvmExecutablesPath?.let { + result["PATH"] = "$it;${System.getenv("PATH")}" + } + result } private val llvmExecutablesPath: String? by lazy { From bf7fdcda6e6cc7561983e23a6ca8f821cd1ec969 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Mon, 23 Nov 2020 10:46:42 +0300 Subject: [PATCH 006/698] KT-42909 fix missing loop variable in 'withIndex' ranges --- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 +++++ .../common/lower/loops/HeaderProcessor.kt | 9 +++------ .../ranges/forInProgressionWithIndex/kt42909.kt | 16 ++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 5 +++++ .../codegen/LightAnalysisModeTestGenerated.java | 5 +++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 5 +++++ .../IrJsCodegenBoxES6TestGenerated.java | 5 +++++ .../semantics/IrJsCodegenBoxTestGenerated.java | 5 +++++ .../semantics/JsCodegenBoxTestGenerated.java | 5 +++++ .../semantics/IrCodegenBoxWasmTestGenerated.java | 5 +++++ 10 files changed, 59 insertions(+), 6 deletions(-) create mode 100644 compiler/testData/codegen/box/ranges/forInProgressionWithIndex/kt42909.kt diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 61ddd00b119..fc3fc9a4d51 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -22755,6 +22755,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT public void testForInWithIndexWithIndex() throws Exception { runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexWithIndex.kt"); } + + @TestMetadata("kt42909.kt") + public void testKt42909() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/kt42909.kt"); + } } @TestMetadata("compiler/testData/codegen/box/ranges/forInReversed") diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/HeaderProcessor.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/HeaderProcessor.kt index 0300e61cc9e..321b3429224 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/HeaderProcessor.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/HeaderProcessor.kt @@ -297,7 +297,7 @@ internal class ProgressionLoopHeader( // loopVariable = inductionVariable // inductionVariable = inductionVariable + step - listOfNotNull(loopVariable, incrementInductionVariable(this)) + listOfNotNull(this@ProgressionLoopHeader.loopVariable, incrementInductionVariable(this)) } override fun buildLoop(builder: DeclarationIrBuilder, oldLoop: IrLoop, newBody: IrExpression?) = @@ -552,11 +552,8 @@ internal class WithIndexLoopHeader( // // We "wire" the 1st destructured component to index, and the 2nd to the loop variable value from the underlying iterable. loopVariableComponents[1]?.initializer = irGet(indexVariable) - listOfNotNull(loopVariableComponents[1], incrementIndexStatement) + nestedLoopHeader.initializeIteration( - loopVariableComponents[2], - linkedMapOf(), - builder - ) + listOfNotNull(loopVariableComponents[1], incrementIndexStatement) + + nestedLoopHeader.initializeIteration(loopVariableComponents[2], linkedMapOf(), builder) } // Use the nested loop header to build the loop. More info in comments in initializeIteration(). diff --git a/compiler/testData/codegen/box/ranges/forInProgressionWithIndex/kt42909.kt b/compiler/testData/codegen/box/ranges/forInProgressionWithIndex/kt42909.kt new file mode 100644 index 00000000000..3994b61ed58 --- /dev/null +++ b/compiler/testData/codegen/box/ranges/forInProgressionWithIndex/kt42909.kt @@ -0,0 +1,16 @@ +// WITH_RUNTIME +// KJS_WITH_FULL_RUNTIME + +fun box(): String { + var r = test() + if (r != "01") throw AssertionError(r.toString()) + return "OK" +} + +private fun test(): String { + var r = "" + for ((i, _) in (1..'c' - 'a').withIndex()) { + r += i.toString() + } + return r +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index fa369720281..2507d84c0ab 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -24526,6 +24526,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { public void testForInWithIndexWithIndex() throws Exception { runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexWithIndex.kt"); } + + @TestMetadata("kt42909.kt") + public void testKt42909() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/kt42909.kt"); + } } @TestMetadata("compiler/testData/codegen/box/ranges/forInReversed") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 6cbd283fad3..1b0a7860b6a 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -24526,6 +24526,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes public void testForInWithIndexWithIndex() throws Exception { runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexWithIndex.kt"); } + + @TestMetadata("kt42909.kt") + public void testKt42909() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/kt42909.kt"); + } } @TestMetadata("compiler/testData/codegen/box/ranges/forInReversed") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 11dd8f2ffc8..9e5864a4ad4 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -22755,6 +22755,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes public void testForInWithIndexWithIndex() throws Exception { runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexWithIndex.kt"); } + + @TestMetadata("kt42909.kt") + public void testKt42909() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/kt42909.kt"); + } } @TestMetadata("compiler/testData/codegen/box/ranges/forInReversed") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index 0ef28c60d79..ded22676945 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -18946,6 +18946,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes public void testForInWithIndexWithIndex() throws Exception { runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexWithIndex.kt"); } + + @TestMetadata("kt42909.kt") + public void testKt42909() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/kt42909.kt"); + } } @TestMetadata("compiler/testData/codegen/box/ranges/forInReversed") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 8ac0f210150..f4943aebaf4 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -18946,6 +18946,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { public void testForInWithIndexWithIndex() throws Exception { runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexWithIndex.kt"); } + + @TestMetadata("kt42909.kt") + public void testKt42909() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/kt42909.kt"); + } } @TestMetadata("compiler/testData/codegen/box/ranges/forInReversed") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index c5f9692f93b..18ef3e5b394 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -19051,6 +19051,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { public void testForInWithIndexWithIndex() throws Exception { runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexWithIndex.kt"); } + + @TestMetadata("kt42909.kt") + public void testKt42909() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/kt42909.kt"); + } } @TestMetadata("compiler/testData/codegen/box/ranges/forInReversed") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index 2e47c7a0607..5d69afc5888 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -11807,6 +11807,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest public void testAllFilesPresentInForInProgressionWithIndex() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ranges/forInProgressionWithIndex"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); } + + @TestMetadata("kt42909.kt") + public void testKt42909() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/kt42909.kt"); + } } @TestMetadata("compiler/testData/codegen/box/ranges/forInReversed") From 551d0c1b64eb2bbc779733876dae70bd4b523996 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Mon, 23 Nov 2020 11:27:38 +0300 Subject: [PATCH 007/698] JVM_IR KT-43440 private-to-this default interface funs are private --- .../backend/jvm/JvmCachedDeclarations.kt | 69 +++++++++++-------- .../codegen/bytecodeListing/kt43440.kt | 11 +++ .../codegen/bytecodeListing/kt43440.txt | 25 +++++++ .../codegen/BytecodeListingTestGenerated.java | 5 ++ .../ir/IrBytecodeListingTestGenerated.java | 5 ++ 5 files changed, 87 insertions(+), 28 deletions(-) create mode 100644 compiler/testData/codegen/bytecodeListing/kt43440.kt create mode 100644 compiler/testData/codegen/bytecodeListing/kt43440.txt diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmCachedDeclarations.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmCachedDeclarations.kt index 8c9a7ec941b..c396388e0ee 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmCachedDeclarations.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmCachedDeclarations.kt @@ -150,39 +150,52 @@ class JvmCachedDeclarations( return defaultImplsMethods.getOrPut(interfaceFun) { val defaultImpls = getDefaultImplsClass(interfaceFun.parentAsClass) + // If `interfaceFun` is not a real implementation, then we're generating stubs in a descendant + // interface's DefaultImpls. For example, + // + // interface I1 { fun f() { ... } } + // interface I2 : I1 + // + // is supposed to allow using `I2.DefaultImpls.f` as if it was inherited from `I1.DefaultImpls`. + // The classes are not actually related and `I2.DefaultImpls.f` is not a fake override but a bridge. + val defaultImplsOrigin = when { + !forCompatibilityMode && !interfaceFun.isFakeOverride -> + when { + interfaceFun.origin == IrDeclarationOrigin.FUNCTION_FOR_DEFAULT_PARAMETER -> + interfaceFun.origin + interfaceFun.origin.isSynthetic -> + JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_WITH_MOVED_RECEIVERS_SYNTHETIC + else -> + JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_WITH_MOVED_RECEIVERS + } + interfaceFun.resolveFakeOverride()!!.origin.isSynthetic -> + if (forCompatibilityMode) + JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_FOR_COMPATIBILITY_SYNTHETIC + else + JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_TO_SYNTHETIC + else -> + if (forCompatibilityMode) + JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_FOR_COMPATIBILITY + else + JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE + } + + // Interface functions are public or private, with one exception: clone in Cloneable, which is protected. + // However, Cloneable has no DefaultImpls, so this merely replicates the incorrect behavior of the old backend. + // We should rather not generate a bridge to clone when interface inherits from Cloneable at all. + val defaultImplsVisibility = + if (DescriptorVisibilities.isPrivate(interfaceFun.visibility)) + DescriptorVisibilities.PRIVATE + else + DescriptorVisibilities.PUBLIC + context.irFactory.createStaticFunctionWithReceivers( defaultImpls, interfaceFun.name, interfaceFun, dispatchReceiverType = parent.defaultType, - // If `interfaceFun` is not a real implementation, then we're generating stubs in a descendant - // interface's DefaultImpls. For example, - // - // interface I1 { fun f() { ... } } - // interface I2 : I1 - // - // is supposed to allow using `I2.DefaultImpls.f` as if it was inherited from `I1.DefaultImpls`. - // The classes are not actually related and `I2.DefaultImpls.f` is not a fake override but a bridge. - origin = when { - !forCompatibilityMode && !interfaceFun.isFakeOverride -> - when { - interfaceFun.origin == IrDeclarationOrigin.FUNCTION_FOR_DEFAULT_PARAMETER -> interfaceFun.origin - interfaceFun.origin.isSynthetic -> JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_WITH_MOVED_RECEIVERS_SYNTHETIC - else -> JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_WITH_MOVED_RECEIVERS - } - interfaceFun.resolveFakeOverride()!!.origin.isSynthetic -> - if (forCompatibilityMode) JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_FOR_COMPATIBILITY_SYNTHETIC - else JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_TO_SYNTHETIC - else -> - if (forCompatibilityMode) JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_FOR_COMPATIBILITY - else JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE - }, + origin = defaultImplsOrigin, // Old backend doesn't generate ACC_FINAL on DefaultImpls methods. modality = Modality.OPEN, - - // Interface functions are public or private, with one exception: clone in Cloneable, which is protected. - // However, Cloneable has no DefaultImpls, so this merely replicates the incorrect behavior of the old backend. - // We should rather not generate a bridge to clone when interface inherits from Cloneable at all. - visibility = if (interfaceFun.visibility == DescriptorVisibilities.PRIVATE) DescriptorVisibilities.PRIVATE else DescriptorVisibilities.PUBLIC, - + visibility = defaultImplsVisibility, isFakeOverride = false, typeParametersFromContext = parent.typeParameters ).also { diff --git a/compiler/testData/codegen/bytecodeListing/kt43440.kt b/compiler/testData/codegen/bytecodeListing/kt43440.kt new file mode 100644 index 00000000000..0b2f1840c92 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/kt43440.kt @@ -0,0 +1,11 @@ +interface A { + private fun f(): T { + TODO() + } +} + +interface B { + private fun f(): T { + TODO() + } +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/kt43440.txt b/compiler/testData/codegen/bytecodeListing/kt43440.txt new file mode 100644 index 00000000000..6061e08282b --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/kt43440.txt @@ -0,0 +1,25 @@ +@kotlin.Metadata +public final class A$DefaultImpls { + // source: 'kt43440.kt' + private static method f(p0: A): java.lang.Object + public final inner class A$DefaultImpls +} + +@kotlin.Metadata +public interface A { + // source: 'kt43440.kt' + public final inner class A$DefaultImpls +} + +@kotlin.Metadata +public final class B$DefaultImpls { + // source: 'kt43440.kt' + private static method f(p0: B): java.lang.Object + public final inner class B$DefaultImpls +} + +@kotlin.Metadata +public interface B { + // source: 'kt43440.kt' + public final inner class B$DefaultImpls +} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index 9509566f674..9c43a8ab05b 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -119,6 +119,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/kt43217.kt"); } + @TestMetadata("kt43440.kt") + public void testKt43440() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/kt43440.kt"); + } + @TestMetadata("localFunctionInInitBlock.kt") public void testLocalFunctionInInitBlock() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/localFunctionInInitBlock.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index b7edbcea4a3..059f4ee3e8e 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -119,6 +119,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/kt43217.kt"); } + @TestMetadata("kt43440.kt") + public void testKt43440() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/kt43440.kt"); + } + @TestMetadata("localFunctionInInitBlock.kt") public void testLocalFunctionInInitBlock() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/localFunctionInInitBlock.kt"); From 2662679579693572f3063477ef7deaac5355459d Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Mon, 23 Nov 2020 11:59:08 +0300 Subject: [PATCH 008/698] KT-43399 properly erase extension receiver type in property$annotations --- .../jetbrains/kotlin/backend/jvm/JvmLower.kt | 5 ++- .../jvm/lower/JvmPropertiesLowering.kt | 43 ++++++++++++++++--- .../kotlin/ir/types/IrTypeSystemContext.kt | 9 +++- .../bytecodeListing/annotations/kt43399.kt | 21 +++++++++ .../bytecodeListing/annotations/kt43399.txt | 29 +++++++++++++ .../codegen/BytecodeListingTestGenerated.java | 5 +++ .../ir/IrBytecodeListingTestGenerated.java | 5 +++ 7 files changed, 107 insertions(+), 10 deletions(-) create mode 100644 compiler/testData/codegen/bytecodeListing/annotations/kt43399.kt create mode 100644 compiler/testData/codegen/bytecodeListing/annotations/kt43399.txt diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLower.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLower.kt index 7f0b08e9b79..abf036f5e9b 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLower.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLower.kt @@ -97,8 +97,9 @@ private val lateinitUsageLoweringPhase = makeIrFilePhase( internal val propertiesPhase = makeIrFilePhase( ::JvmPropertiesLowering, name = "Properties", - description = "Move fields and accessors for properties to their classes, replace calls to default property accessors " + - "with field accesses, remove unused accessors and create synthetic methods for property annotations", + description = "Move fields and accessors for properties to their classes, " + + "replace calls to default property accessors with field accesses, " + + "remove unused accessors and create synthetic methods for property annotations", stickyPostconditions = setOf((PropertiesLowering)::checkNoProperties) ) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmPropertiesLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmPropertiesLowering.kt index 9a92eaba3f0..9152e42547a 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmPropertiesLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmPropertiesLowering.kt @@ -26,9 +26,8 @@ import org.jetbrains.kotlin.ir.expressions.IrCall import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrFieldAccessExpression import org.jetbrains.kotlin.ir.expressions.impl.IrBlockBodyImpl -import org.jetbrains.kotlin.ir.types.classifierOrFail -import org.jetbrains.kotlin.ir.types.makeNotNull -import org.jetbrains.kotlin.ir.types.typeWith +import org.jetbrains.kotlin.ir.types.* +import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection import org.jetbrains.kotlin.ir.util.coerceToUnit import org.jetbrains.kotlin.ir.util.render import org.jetbrains.kotlin.ir.util.resolveFakeOverride @@ -69,7 +68,13 @@ class JvmPropertiesLowering(private val backendContext: JvmBackendContext) : IrE } private fun IrBuilderWithScope.substituteSetter(irProperty: IrProperty, expression: IrCall): IrExpression = - patchReceiver(irSetField(expression.dispatchReceiver, irProperty.resolveFakeOverride()!!.backingField!!, expression.getValueArgument(0)!!)) + patchReceiver( + irSetField( + expression.dispatchReceiver, + irProperty.resolveFakeOverride()!!.backingField!!, + expression.getValueArgument(0)!! + ) + ) private fun IrBuilderWithScope.substituteGetter(irProperty: IrProperty, expression: IrCall): IrExpression { val backingField = irProperty.resolveFakeOverride()!!.backingField!! @@ -131,8 +136,10 @@ class JvmPropertiesLowering(private val backendContext: JvmBackendContext) : IrE returnType = backendContext.irBuiltIns.unitType }.apply { declaration.getter?.extensionReceiverParameter?.let { extensionReceiver -> - // Use raw type of extension receiver to avoid generic signature, which would be useless for this method. - extensionReceiverParameter = extensionReceiver.copyTo(this, type = extensionReceiver.type.classifierOrFail.typeWith()) + extensionReceiverParameter = extensionReceiver.copyTo( + this, + type = extensionReceiver.type.erasePropertyAnnotationsExtensionReceiverType() + ) } body = IrBlockBodyImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET) @@ -142,6 +149,30 @@ class JvmPropertiesLowering(private val backendContext: JvmBackendContext) : IrE metadata = declaration.metadata } + private fun IrType.erasePropertyAnnotationsExtensionReceiverType(): IrType { + // Use raw type of extension receiver to avoid generic signature, + // which should not be generated for '...$annotations' method. + val classifier = classifierOrFail + return if (this is IrSimpleType && isArray()) { + when (val arg0 = arguments[0]) { + is IrStarProjection -> { + // 'Array<*>' becomes 'Array<*>' + this + } + is IrTypeProjection -> { + // 'Array' becomes 'Array' + classifier.typeWithArguments( + listOf(makeTypeProjection(arg0.type.erasePropertyAnnotationsExtensionReceiverType(), arg0.variance)) + ) + } + else -> + throw AssertionError("Unexpected type argument: $arg0") + } + } else { + classifier.typeWith() + } + } + private fun computeSyntheticMethodName(property: IrProperty): String { val baseName = if (backendContext.state.languageVersionSettings.supportsFeature(LanguageFeature.UseGetterNameForPropertyAnnotationsMethodOnJvm)) { diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/IrTypeSystemContext.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/IrTypeSystemContext.kt index 21d5d108720..195dc7b234f 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/IrTypeSystemContext.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/IrTypeSystemContext.kt @@ -87,8 +87,13 @@ interface IrTypeSystemContext : TypeSystemContext, TypeSystemCommonSuperTypesCon override fun KotlinTypeMarker.getArgument(index: Int): TypeArgumentMarker = when (this) { - is IrSimpleType -> arguments[index] - else -> error("Type $this has no arguments") + is IrSimpleType -> + if (index >= arguments.size) + error("No argument $index in type '${this.render()}'") + else + arguments[index] + else -> + error("Type $this has no arguments") } override fun KotlinTypeMarker.asTypeArgument() = this as IrTypeArgument diff --git a/compiler/testData/codegen/bytecodeListing/annotations/kt43399.kt b/compiler/testData/codegen/bytecodeListing/annotations/kt43399.kt new file mode 100644 index 00000000000..833a3d5db42 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/annotations/kt43399.kt @@ -0,0 +1,21 @@ +interface B { + @A + val Array.a: Int + + @A + val Array>.b: Int + + @A + val Array.c: Int + + @A + val Array<*>.d: Int + + @A + val Array.e: Int + + @A + val Array.f: Int +} + +annotation class A \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/annotations/kt43399.txt b/compiler/testData/codegen/bytecodeListing/annotations/kt43399.txt new file mode 100644 index 00000000000..a8524a085a2 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/annotations/kt43399.txt @@ -0,0 +1,29 @@ +@java.lang.annotation.Retention +@kotlin.Metadata +public annotation class A { + // source: 'kt43399.kt' +} + +@kotlin.Metadata +public final class B$DefaultImpls { + // source: 'kt43399.kt' + public synthetic deprecated static @A method getA$annotations(p0: java.lang.Integer[]): void + public synthetic deprecated static @A method getB$annotations(p0: java.lang.Integer[][]): void + public synthetic deprecated static @A method getC$annotations(p0: int[][]): void + public synthetic deprecated static @A method getD$annotations(p0: java.lang.Object[]): void + public synthetic deprecated static @A method getE$annotations(p0: java.lang.String[]): void + public synthetic deprecated static @A method getF$annotations(p0: java.lang.Object[]): void + public final inner class B$DefaultImpls +} + +@kotlin.Metadata +public interface B { + // source: 'kt43399.kt' + public abstract method getA(@org.jetbrains.annotations.NotNull p0: java.lang.Integer[]): int + public abstract method getB(@org.jetbrains.annotations.NotNull p0: java.lang.Integer[][]): int + public abstract method getC(@org.jetbrains.annotations.NotNull p0: int[][]): int + public abstract method getD(@org.jetbrains.annotations.NotNull p0: java.lang.Object[]): int + public abstract method getE(@org.jetbrains.annotations.NotNull p0: java.lang.String[]): int + public abstract method getF(@org.jetbrains.annotations.NotNull p0: java.lang.Object[]): int + public final inner class B$DefaultImpls +} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index 9c43a8ab05b..d5de0775cb2 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -241,6 +241,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/annotations/kt27895.kt"); } + @TestMetadata("kt43399.kt") + public void testKt43399() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/annotations/kt43399.kt"); + } + @TestMetadata("kt9320.kt") public void testKt9320() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/annotations/kt9320.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index 059f4ee3e8e..2a5f6d59abb 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -241,6 +241,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/annotations/kt27895.kt"); } + @TestMetadata("kt43399.kt") + public void testKt43399() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/annotations/kt43399.kt"); + } + @TestMetadata("kt9320.kt") public void testKt9320() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/annotations/kt9320.kt"); From cf8f5b0912e141c13de5e732fc9e09a75933078e Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Mon, 2 Nov 2020 10:33:30 -0800 Subject: [PATCH 009/698] FIR checker: make calls effect analyzer path-sensitive --- .../analysis/cfa/FirCallsEffectAnalyzer.kt | 148 +++++++++++++++--- 1 file changed, 127 insertions(+), 21 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt index 38c78551034..36fbc34e629 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt @@ -38,6 +38,7 @@ import org.jetbrains.kotlin.fir.types.ConeKotlinType import org.jetbrains.kotlin.fir.types.FirTypeRef import org.jetbrains.kotlin.fir.types.coneTypeSafe import org.jetbrains.kotlin.utils.addIfNotNull +import java.lang.IllegalStateException import kotlin.contracts.ExperimentalContracts import kotlin.contracts.contract @@ -80,26 +81,43 @@ object FirCallsEffectAnalyzer : FirControlFlowChecker() { } } - val invocationData = graph.collectDataForNode( + val invocationData = graph.collectPathAwareDataForNode( TraverseDirection.Forward, - LambdaInvocationInfo.EMPTY, + PathAwareLambdaInvocationInfo.EMPTY, InvocationDataCollector(functionalTypeEffects.keys.filterTo(mutableSetOf()) { it !in leakedSymbols }) ) for ((symbol, effectDeclaration) in functionalTypeEffects) { graph.exitNode.previousCfgNodes.forEach { node -> val requiredRange = effectDeclaration.kind - val foundRange = invocationData.getValue(node)[symbol] ?: EventOccurrencesRange.ZERO - - if (foundRange !in requiredRange) { - function.contractDescription.source?.let { - reporter.report(FirErrors.WRONG_INVOCATION_KIND.on(it, symbol, requiredRange, foundRange)) + val info = invocationData.getValue(node) + for (label in info.keys) { + if (investigate(info.getValue(label), symbol, requiredRange, function, reporter)) { + // To avoid duplicate reports, stop investigating remaining paths once reported. + break } } } } } + private fun investigate( + info: LambdaInvocationInfo, + symbol: AbstractFirBasedSymbol<*>, + requiredRange: EventOccurrencesRange, + function: FirContractDescriptionOwner, + reporter: DiagnosticReporter + ): Boolean { + val foundRange = info[symbol] ?: EventOccurrencesRange.ZERO + if (foundRange !in requiredRange) { + function.contractDescription.source?.let { + reporter.report(FirErrors.WRONG_INVOCATION_KIND.on(it, symbol, requiredRange, foundRange)) + return true + } + } + return false + } + private class IllegalScopeContext( private val functionalTypeSymbols: Set>, private val leakedSymbols: MutableMap, MutableList>, @@ -185,7 +203,7 @@ object FirCallsEffectAnalyzer : FirControlFlowChecker() { } } - private class LambdaInvocationInfo( + class LambdaInvocationInfo( map: PersistentMap, EventOccurrencesRange> = persistentMapOf(), ) : ControlFlowInfo, EventOccurrencesRange>(map) { @@ -207,19 +225,99 @@ object FirCallsEffectAnalyzer : FirControlFlowChecker() { } } + class PathAwareLambdaInvocationInfo( + map: PersistentMap = persistentMapOf() + ) : ControlFlowInfo(map) { + companion object { + val EMPTY = PathAwareLambdaInvocationInfo(persistentMapOf(NormalPath to LambdaInvocationInfo.EMPTY)) + } + + override val constructor: (PersistentMap) -> PathAwareLambdaInvocationInfo = + ::PathAwareLambdaInvocationInfo + + val infoAtNormalPath: LambdaInvocationInfo + get() = map[NormalPath] ?: LambdaInvocationInfo.EMPTY + + val hasNormalPath: Boolean + get() = map.containsKey(NormalPath) + + fun applyLabel(node: CFGNode<*>, label: EdgeLabel): PathAwareLambdaInvocationInfo { + if (label.isNormal) { + // Special case: when we exit the try expression, null label means a normal path. + // Filter out any info bound to non-null label + // One day, if we allow multiple edges between nodes with different labels, e.g., labeling all paths in try/catch/finally, + // instead of this kind of special handling, proxy enter/exit nodes per label are preferred. + if (node is TryExpressionExitNode) { + return if (hasNormalPath) { + constructor(persistentMapOf(NormalPath to infoAtNormalPath)) + } else { + /* This means no info for normal path. */ + EMPTY + } + } + // In general, null label means no additional path info, hence return `this` as-is. + return this + } + + val hasAbnormalLabels = map.keys.any { !it.isNormal } + return if (hasAbnormalLabels) { + // { |-> ... l1 |-> I1, l2 |-> I2, ... } + // | l1 // path exit: if the given info has non-null labels, this acts like a filtering + // { |-> I1 } // NB: remove the path info + if (map.keys.contains(label)) { + constructor(persistentMapOf(NormalPath to map[label]!!)) + } else { + /* This means no info for the specific label. */ + EMPTY + } + } else { + // { |-> ... } // empty path info + // | l1 // path entry + // { l1 -> ... } // now, every info bound to the label + constructor(persistentMapOf(label to infoAtNormalPath)) + } + } + + fun merge(other: PathAwareLambdaInvocationInfo): PathAwareLambdaInvocationInfo { + var resultMap = persistentMapOf() + for (label in keys.union(other.keys)) { + // disjoint merging to preserve paths. i.e., merge the property initialization info if and only if both have the key. + // merge({ |-> I1 }, { |-> I2, l1 |-> I3 } + // == { |-> merge(I1, I2), l1 |-> I3 } + val i1 = this[label] + val i2 = other[label] + resultMap = when { + i1 != null && i2 != null -> + resultMap.put(label, i1.merge(i2)) + i1 != null -> + resultMap.put(label, i1) + i2 != null -> + resultMap.put(label, i2) + else -> + throw IllegalStateException() + } + } + return constructor(resultMap) + } + } + private class InvocationDataCollector( val functionalTypeSymbols: Set> - ) : ControlFlowGraphVisitor>() { + ) : ControlFlowGraphVisitor>>() { - override fun visitNode(node: CFGNode<*>, data: Collection): LambdaInvocationInfo { - if (data.isEmpty()) return LambdaInvocationInfo.EMPTY - return data.reduce(LambdaInvocationInfo::merge) + override fun visitNode( + node: CFGNode<*>, + data: Collection> + ): PathAwareLambdaInvocationInfo { + if (data.isEmpty()) return PathAwareLambdaInvocationInfo.EMPTY + return data.map { (label, info) -> info.applyLabel(node, label) } + .reduce(PathAwareLambdaInvocationInfo::merge) } override fun visitFunctionCallNode( node: FunctionCallNode, - data: Collection - ): LambdaInvocationInfo { + data: Collection> + ): PathAwareLambdaInvocationInfo { var dataForNode = visitNode(node, data) val functionSymbol = node.fir.toResolvedCallableSymbol() as? FirFunctionSymbol<*>? @@ -249,22 +347,30 @@ object FirCallsEffectAnalyzer : FirControlFlowChecker() { return reference != null && referenceToSymbol(reference) in functionalTypeSymbols } - private inline fun LambdaInvocationInfo.checkReference( + private inline fun PathAwareLambdaInvocationInfo.checkReference( reference: FirReference?, rangeGetter: () -> EventOccurrencesRange - ): LambdaInvocationInfo { + ): PathAwareLambdaInvocationInfo { return if (collectDataForReference(reference)) addInvocationInfo(reference, rangeGetter()) else this } - private fun LambdaInvocationInfo.addInvocationInfo( + private fun PathAwareLambdaInvocationInfo.addInvocationInfo( reference: FirReference, range: EventOccurrencesRange - ): LambdaInvocationInfo { + ): PathAwareLambdaInvocationInfo { val symbol = referenceToSymbol(reference) return if (symbol != null) { - val existingKind = this[symbol] ?: EventOccurrencesRange.ZERO - val kind = existingKind + range - this.put(symbol, kind) + var resultMap = persistentMapOf() + // before: { |-> { p1 |-> PI1 }, l1 |-> { p2 |-> PI2 } + for (label in this.keys) { + val dataPerLabel = this[label]!! + val existingKind = dataPerLabel[symbol] ?: EventOccurrencesRange.ZERO + val kind = existingKind + range + resultMap = resultMap.put(label, dataPerLabel.put(symbol, kind)) + } + // after (if symbol is p1): + // { |-> { p1 |-> PI1 + r }, l1 |-> { p1 |-> r, p2 |-> PI2 } + PathAwareLambdaInvocationInfo(resultMap) } else this } } From b6a4c279a4a34a19fa80109bd5a76b9987b1c4a2 Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Thu, 5 Nov 2020 10:19:31 -0800 Subject: [PATCH 010/698] FIR checker: refactor ControlFlowInfos whose value is EventOccurrencesRange --- .../kotlin/fir/analysis/cfa/CfaUtils.kt | 31 ++++++++++++------- .../fir/analysis/cfa/ControlFlowInfo.kt | 4 ++- .../analysis/cfa/FirCallsEffectAnalyzer.kt | 14 ++------- .../checkers/extended/UnusedChecker.kt | 2 +- 4 files changed, 25 insertions(+), 26 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/CfaUtils.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/CfaUtils.kt index ed8f129be1b..ff3c5f8968d 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/CfaUtils.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/CfaUtils.kt @@ -13,18 +13,13 @@ import org.jetbrains.kotlin.fir.resolve.dfa.cfg.* import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol import java.lang.IllegalStateException -class PropertyInitializationInfo( - map: PersistentMap = persistentMapOf() -) : ControlFlowInfo(map) { - companion object { - val EMPTY = PropertyInitializationInfo() - } +abstract class EventOccurrencesRangeInfo, K : Any>( + map: PersistentMap = persistentMapOf() +) : ControlFlowInfo(map) { - override val constructor: (PersistentMap) -> PropertyInitializationInfo = - ::PropertyInitializationInfo - - fun merge(other: PropertyInitializationInfo): PropertyInitializationInfo { - var result = this + override fun merge(other: E): E { + @Suppress("UNCHECKED_CAST") + var result = this as E for (symbol in keys.union(other.keys)) { val kind1 = this[symbol] ?: EventOccurrencesRange.ZERO val kind2 = other[symbol] ?: EventOccurrencesRange.ZERO @@ -34,6 +29,18 @@ class PropertyInitializationInfo( } } +class PropertyInitializationInfo( + map: PersistentMap = persistentMapOf() +) : EventOccurrencesRangeInfo(map) { + companion object { + val EMPTY = PropertyInitializationInfo() + } + + override val constructor: (PersistentMap) -> PropertyInitializationInfo = + ::PropertyInitializationInfo + +} + class LocalPropertyCollector private constructor() : ControlFlowGraphVisitorVoid() { companion object { fun collect(graph: ControlFlowGraph): MutableSet { @@ -105,7 +112,7 @@ class PathAwarePropertyInitializationInfo( } } - fun merge(other: PathAwarePropertyInitializationInfo): PathAwarePropertyInitializationInfo { + override fun merge(other: PathAwarePropertyInitializationInfo): PathAwarePropertyInitializationInfo { var resultMap = persistentMapOf() for (label in keys.union(other.keys)) { // disjoint merging to preserve paths. i.e., merge the property initialization info if and only if both have the key. diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/ControlFlowInfo.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/ControlFlowInfo.kt index f045b5bc0d1..bc79dfbbbcc 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/ControlFlowInfo.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/ControlFlowInfo.kt @@ -28,4 +28,6 @@ abstract class ControlFlowInfo, K : Any, V : Any> p override fun put(key: K, value: V): S { return constructor(map.put(key, value)) } -} \ No newline at end of file + + abstract fun merge(other: S): S +} diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt index 36fbc34e629..c79971066b7 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt @@ -205,8 +205,7 @@ object FirCallsEffectAnalyzer : FirControlFlowChecker() { class LambdaInvocationInfo( map: PersistentMap, EventOccurrencesRange> = persistentMapOf(), - ) : ControlFlowInfo, EventOccurrencesRange>(map) { - + ) : EventOccurrencesRangeInfo>(map) { companion object { val EMPTY = LambdaInvocationInfo() } @@ -214,15 +213,6 @@ object FirCallsEffectAnalyzer : FirControlFlowChecker() { override val constructor: (PersistentMap, EventOccurrencesRange>) -> LambdaInvocationInfo = ::LambdaInvocationInfo - fun merge(other: LambdaInvocationInfo): LambdaInvocationInfo { - var result = this - for (symbol in keys.union(other.keys)) { - val kind1 = this[symbol] ?: EventOccurrencesRange.ZERO - val kind2 = other[symbol] ?: EventOccurrencesRange.ZERO - result = result.put(symbol, kind1 or kind2) - } - return result - } } class PathAwareLambdaInvocationInfo( @@ -278,7 +268,7 @@ object FirCallsEffectAnalyzer : FirControlFlowChecker() { } } - fun merge(other: PathAwareLambdaInvocationInfo): PathAwareLambdaInvocationInfo { + override fun merge(other: PathAwareLambdaInvocationInfo): PathAwareLambdaInvocationInfo { var resultMap = persistentMapOf() for (label in keys.union(other.keys)) { // disjoint merging to preserve paths. i.e., merge the property initialization info if and only if both have the key. diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt index 0a75a5fe852..d8c7a7773f2 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt @@ -106,7 +106,7 @@ object UnusedChecker : FirControlFlowChecker() { override val constructor: (PersistentMap) -> VariableStatusInfo = ::VariableStatusInfo - fun merge(other: VariableStatusInfo): VariableStatusInfo { + override fun merge(other: VariableStatusInfo): VariableStatusInfo { var result = this for (symbol in keys.union(other.keys)) { val kind1 = this[symbol] ?: VariableStatus.UNUSED From b9d3578a866567b3a42b3d0d49b49f02d0b45785 Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Thu, 5 Nov 2020 10:43:00 -0800 Subject: [PATCH 011/698] FIR checker: refactor ControlFlowInfos whose key is EdgeLabel --- .../kotlin/fir/analysis/cfa/CfaUtils.kt | 71 ++-------------- .../fir/analysis/cfa/ControlFlowInfo.kt | 2 + .../analysis/cfa/FirCallsEffectAnalyzer.kt | 71 ++-------------- .../analysis/cfa/PathAwareControlFlowInfo.kt | 84 +++++++++++++++++++ .../checkers/extended/UnusedChecker.kt | 3 + 5 files changed, 99 insertions(+), 132 deletions(-) create mode 100644 compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/PathAwareControlFlowInfo.kt diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/CfaUtils.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/CfaUtils.kt index ff3c5f8968d..cd3c514ca57 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/CfaUtils.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/CfaUtils.kt @@ -11,7 +11,6 @@ import org.jetbrains.kotlin.contracts.description.EventOccurrencesRange import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference import org.jetbrains.kotlin.fir.resolve.dfa.cfg.* import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol -import java.lang.IllegalStateException abstract class EventOccurrencesRangeInfo, K : Any>( map: PersistentMap = persistentMapOf() @@ -39,6 +38,8 @@ class PropertyInitializationInfo( override val constructor: (PersistentMap) -> PropertyInitializationInfo = ::PropertyInitializationInfo + override val empty: () -> PropertyInitializationInfo = + ::EMPTY } class LocalPropertyCollector private constructor() : ControlFlowGraphVisitorVoid() { @@ -61,7 +62,7 @@ class LocalPropertyCollector private constructor() : ControlFlowGraphVisitorVoid class PathAwarePropertyInitializationInfo( map: PersistentMap = persistentMapOf() -) : ControlFlowInfo(map) { +) : PathAwareControlFlowInfo(map) { companion object { val EMPTY = PathAwarePropertyInitializationInfo(persistentMapOf(NormalPath to PropertyInitializationInfo.EMPTY)) } @@ -69,70 +70,8 @@ class PathAwarePropertyInitializationInfo( override val constructor: (PersistentMap) -> PathAwarePropertyInitializationInfo = ::PathAwarePropertyInitializationInfo - val infoAtNormalPath: PropertyInitializationInfo - get() = map[NormalPath] ?: PropertyInitializationInfo.EMPTY - - val hasNormalPath: Boolean - get() = map.containsKey(NormalPath) - - fun applyLabel(node: CFGNode<*>, label: EdgeLabel): PathAwarePropertyInitializationInfo { - if (label.isNormal) { - // Special case: when we exit the try expression, null label means a normal path. - // Filter out any info bound to non-null label - // One day, if we allow multiple edges between nodes with different labels, e.g., labeling all paths in try/catch/finally, - // instead of this kind of special handling, proxy enter/exit nodes per label are preferred. - if (node is TryExpressionExitNode) { - return if (hasNormalPath) { - constructor(persistentMapOf(NormalPath to infoAtNormalPath)) - } else { - /* This means no info for normal path. */ - EMPTY - } - } - // In general, null label means no additional path info, hence return `this` as-is. - return this - } - - val hasAbnormalLabels = map.keys.any { !it.isNormal } - return if (hasAbnormalLabels) { - // { |-> ... l1 |-> I1, l2 |-> I2, ... } - // | l1 // path exit: if the given info has non-null labels, this acts like a filtering - // { |-> I1 } // NB: remove the path info - if (map.keys.contains(label)) { - constructor(persistentMapOf(NormalPath to map[label]!!)) - } else { - /* This means no info for the specific label. */ - EMPTY - } - } else { - // { |-> ... } // empty path info - // | l1 // path entry - // { l1 -> ... } // now, every info bound to the label - constructor(persistentMapOf(label to infoAtNormalPath)) - } - } - - override fun merge(other: PathAwarePropertyInitializationInfo): PathAwarePropertyInitializationInfo { - var resultMap = persistentMapOf() - for (label in keys.union(other.keys)) { - // disjoint merging to preserve paths. i.e., merge the property initialization info if and only if both have the key. - // merge({ |-> I1 }, { |-> I2, l1 |-> I3 } - // == { |-> merge(I1, I2), l1 |-> I3 } - val i1 = this[label] - val i2 = other[label] - resultMap = when { - i1 != null && i2 != null -> - resultMap.put(label, i1.merge(i2)) - i1 != null -> - resultMap.put(label, i1) - i2 != null -> - resultMap.put(label, i2) - else -> - throw IllegalStateException() - } - } - return constructor(resultMap) - } + override val empty: () -> PathAwarePropertyInitializationInfo = + ::EMPTY } class PropertyInitializationInfoCollector(private val localProperties: Set) : diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/ControlFlowInfo.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/ControlFlowInfo.kt index bc79dfbbbcc..771c98080cf 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/ControlFlowInfo.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/ControlFlowInfo.kt @@ -13,6 +13,8 @@ abstract class ControlFlowInfo, K : Any, V : Any> p protected abstract val constructor: (PersistentMap) -> S + protected abstract val empty: () -> S + override fun equals(other: Any?): Boolean { return map == (other as? ControlFlowInfo<*, *, *>)?.map } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt index c79971066b7..ef548a1d308 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt @@ -38,7 +38,6 @@ import org.jetbrains.kotlin.fir.types.ConeKotlinType import org.jetbrains.kotlin.fir.types.FirTypeRef import org.jetbrains.kotlin.fir.types.coneTypeSafe import org.jetbrains.kotlin.utils.addIfNotNull -import java.lang.IllegalStateException import kotlin.contracts.ExperimentalContracts import kotlin.contracts.contract @@ -213,11 +212,13 @@ object FirCallsEffectAnalyzer : FirControlFlowChecker() { override val constructor: (PersistentMap, EventOccurrencesRange>) -> LambdaInvocationInfo = ::LambdaInvocationInfo + override val empty: () -> LambdaInvocationInfo = + ::EMPTY } class PathAwareLambdaInvocationInfo( map: PersistentMap = persistentMapOf() - ) : ControlFlowInfo(map) { + ) : PathAwareControlFlowInfo(map) { companion object { val EMPTY = PathAwareLambdaInvocationInfo(persistentMapOf(NormalPath to LambdaInvocationInfo.EMPTY)) } @@ -225,70 +226,8 @@ object FirCallsEffectAnalyzer : FirControlFlowChecker() { override val constructor: (PersistentMap) -> PathAwareLambdaInvocationInfo = ::PathAwareLambdaInvocationInfo - val infoAtNormalPath: LambdaInvocationInfo - get() = map[NormalPath] ?: LambdaInvocationInfo.EMPTY - - val hasNormalPath: Boolean - get() = map.containsKey(NormalPath) - - fun applyLabel(node: CFGNode<*>, label: EdgeLabel): PathAwareLambdaInvocationInfo { - if (label.isNormal) { - // Special case: when we exit the try expression, null label means a normal path. - // Filter out any info bound to non-null label - // One day, if we allow multiple edges between nodes with different labels, e.g., labeling all paths in try/catch/finally, - // instead of this kind of special handling, proxy enter/exit nodes per label are preferred. - if (node is TryExpressionExitNode) { - return if (hasNormalPath) { - constructor(persistentMapOf(NormalPath to infoAtNormalPath)) - } else { - /* This means no info for normal path. */ - EMPTY - } - } - // In general, null label means no additional path info, hence return `this` as-is. - return this - } - - val hasAbnormalLabels = map.keys.any { !it.isNormal } - return if (hasAbnormalLabels) { - // { |-> ... l1 |-> I1, l2 |-> I2, ... } - // | l1 // path exit: if the given info has non-null labels, this acts like a filtering - // { |-> I1 } // NB: remove the path info - if (map.keys.contains(label)) { - constructor(persistentMapOf(NormalPath to map[label]!!)) - } else { - /* This means no info for the specific label. */ - EMPTY - } - } else { - // { |-> ... } // empty path info - // | l1 // path entry - // { l1 -> ... } // now, every info bound to the label - constructor(persistentMapOf(label to infoAtNormalPath)) - } - } - - override fun merge(other: PathAwareLambdaInvocationInfo): PathAwareLambdaInvocationInfo { - var resultMap = persistentMapOf() - for (label in keys.union(other.keys)) { - // disjoint merging to preserve paths. i.e., merge the property initialization info if and only if both have the key. - // merge({ |-> I1 }, { |-> I2, l1 |-> I3 } - // == { |-> merge(I1, I2), l1 |-> I3 } - val i1 = this[label] - val i2 = other[label] - resultMap = when { - i1 != null && i2 != null -> - resultMap.put(label, i1.merge(i2)) - i1 != null -> - resultMap.put(label, i1) - i2 != null -> - resultMap.put(label, i2) - else -> - throw IllegalStateException() - } - } - return constructor(resultMap) - } + override val empty: () -> PathAwareLambdaInvocationInfo = + ::EMPTY } private class InvocationDataCollector( diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/PathAwareControlFlowInfo.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/PathAwareControlFlowInfo.kt new file mode 100644 index 00000000000..269fc45dd7f --- /dev/null +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/PathAwareControlFlowInfo.kt @@ -0,0 +1,84 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.fir.analysis.cfa + +import kotlinx.collections.immutable.PersistentMap +import kotlinx.collections.immutable.persistentMapOf +import org.jetbrains.kotlin.fir.resolve.dfa.cfg.CFGNode +import org.jetbrains.kotlin.fir.resolve.dfa.cfg.EdgeLabel +import org.jetbrains.kotlin.fir.resolve.dfa.cfg.NormalPath +import org.jetbrains.kotlin.fir.resolve.dfa.cfg.TryExpressionExitNode + +abstract class PathAwareControlFlowInfo

, S : ControlFlowInfo>( + map: PersistentMap, +) : ControlFlowInfo(map) { + + internal val infoAtNormalPath: S + get() = map.getValue(NormalPath) + + private val hasNormalPath: Boolean + get() = map.containsKey(NormalPath) + + fun applyLabel(node: CFGNode<*>, label: EdgeLabel): P { + if (label.isNormal) { + // Special case: when we exit the try expression, null label means a normal path. + // Filter out any info bound to non-null label + // One day, if we allow multiple edges between nodes with different labels, e.g., labeling all paths in try/catch/finally, + // instead of this kind of special handling, proxy enter/exit nodes per label are preferred. + if (node is TryExpressionExitNode) { + return if (hasNormalPath) { + constructor(persistentMapOf(NormalPath to infoAtNormalPath)) + } else { + /* This means no info for normal path. */ + empty() + } + } + // In general, null label means no additional path info, hence return `this` as-is. + @Suppress("UNCHECKED_CAST") + return this as P + } + + val hasAbnormalLabels = map.keys.any { !it.isNormal } + return if (hasAbnormalLabels) { + // { |-> ... l1 |-> I1, l2 |-> I2, ... } + // | l1 // path exit: if the given info has non-null labels, this acts like a filtering + // { |-> I1 } // NB: remove the path info + if (map.keys.contains(label)) { + constructor(persistentMapOf(NormalPath to map[label]!!)) + } else { + /* This means no info for the specific label. */ + empty() + } + } else { + // { |-> ... } // empty path info + // | l1 // path entry + // { l1 -> ... } // now, every info bound to the label + constructor(persistentMapOf(label to infoAtNormalPath)) + } + } + + override fun merge(other: P): P { + var resultMap = persistentMapOf() + for (label in keys.union(other.keys)) { + // disjoint merging to preserve paths. i.e., merge the property initialization info if and only if both have the key. + // merge({ |-> I1 }, { |-> I2, l1 |-> I3 }) + // == { |-> merge(I1, I2), l1 |-> I3 } + val i1 = this[label] + val i2 = other[label] + resultMap = when { + i1 != null && i2 != null -> + resultMap.put(label, i1.merge(i2)) + i1 != null -> + resultMap.put(label, i1) + i2 != null -> + resultMap.put(label, i2) + else -> + throw IllegalStateException() + } + } + return constructor(resultMap) + } +} diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt index d8c7a7773f2..5c1acff49d1 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt @@ -106,6 +106,9 @@ object UnusedChecker : FirControlFlowChecker() { override val constructor: (PersistentMap) -> VariableStatusInfo = ::VariableStatusInfo + override val empty: () -> VariableStatusInfo = + ::EMPTY + override fun merge(other: VariableStatusInfo): VariableStatusInfo { var result = this for (symbol in keys.union(other.keys)) { From 8eb2ae18dcb5ea78ac94c5a47dc77c2a7dde6fb4 Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Thu, 5 Nov 2020 10:53:00 -0800 Subject: [PATCH 012/698] FIR checker: refactor EventOccurrencesRange accumulation --- .../kotlin/fir/analysis/cfa/CfaUtils.kt | 33 ++++++++++++------- .../analysis/cfa/FirCallsEffectAnalyzer.kt | 12 +------ 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/CfaUtils.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/CfaUtils.kt index cd3c514ca57..c11c3c21fc8 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/CfaUtils.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/CfaUtils.kt @@ -123,16 +123,25 @@ class PropertyInitializationInfoCollector(private val localProperties: Set() - // before: { |-> { p1 |-> PI1 }, l1 |-> { p2 |-> PI2 } - for (label in dataForNode.keys) { - val dataPerLabel = dataForNode[label]!! - val existingKind = dataPerLabel[symbol] ?: EventOccurrencesRange.ZERO - val kind = existingKind + EventOccurrencesRange.EXACTLY_ONCE - resultMap = resultMap.put(label, dataPerLabel.put(symbol, kind)) - } - // after (if symbol is p1): - // { |-> { p1 |-> PI1 + 1 }, l1 |-> { p1 |-> [1, 1], p2 |-> PI2 } - return PathAwarePropertyInitializationInfo(resultMap) + return addRange(dataForNode, symbol, EventOccurrencesRange.EXACTLY_ONCE, ::PathAwarePropertyInitializationInfo) } -} \ No newline at end of file +} + +internal fun

, S : ControlFlowInfo, K : Any> addRange( + info: P, + key: K, + range: EventOccurrencesRange, + constructor: (PersistentMap) -> P +): P { + var resultMap = persistentMapOf() + // before: { |-> { p1 |-> PI1 }, l1 |-> { p2 |-> PI2 } } + for (label in info.keys) { + val dataPerLabel = info[label]!! + val existingKind = dataPerLabel[key] ?: EventOccurrencesRange.ZERO + val kind = existingKind + range + resultMap = resultMap.put(label, dataPerLabel.put(key, kind)) + } + // after (if key is p1): + // { |-> { p1 |-> PI1 + r }, l1 |-> { p1 |-> r, p2 |-> PI2 } } + return constructor(resultMap) +} diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt index ef548a1d308..656fed1d504 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt @@ -289,17 +289,7 @@ object FirCallsEffectAnalyzer : FirControlFlowChecker() { ): PathAwareLambdaInvocationInfo { val symbol = referenceToSymbol(reference) return if (symbol != null) { - var resultMap = persistentMapOf() - // before: { |-> { p1 |-> PI1 }, l1 |-> { p2 |-> PI2 } - for (label in this.keys) { - val dataPerLabel = this[label]!! - val existingKind = dataPerLabel[symbol] ?: EventOccurrencesRange.ZERO - val kind = existingKind + range - resultMap = resultMap.put(label, dataPerLabel.put(symbol, kind)) - } - // after (if symbol is p1): - // { |-> { p1 |-> PI1 + r }, l1 |-> { p1 |-> r, p2 |-> PI2 } - PathAwareLambdaInvocationInfo(resultMap) + addRange(this, symbol, range, ::PathAwareLambdaInvocationInfo) } else this } } From 5c731c6c04c987f122b21ee4c2d9471bbce40b75 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Wed, 18 Nov 2020 19:26:19 +0300 Subject: [PATCH 013/698] [JS IR] Add test in external js fun with default args ^KT-40090 fixed --- .../codegen/box/external/jsWithDefaultArg.kt | 25 +++++++++++++++++++ .../IrJsCodegenBoxES6TestGenerated.java | 5 ++++ .../IrJsCodegenBoxTestGenerated.java | 5 ++++ 3 files changed, 35 insertions(+) create mode 100644 compiler/testData/codegen/box/external/jsWithDefaultArg.kt diff --git a/compiler/testData/codegen/box/external/jsWithDefaultArg.kt b/compiler/testData/codegen/box/external/jsWithDefaultArg.kt new file mode 100644 index 00000000000..e36cd0297ef --- /dev/null +++ b/compiler/testData/codegen/box/external/jsWithDefaultArg.kt @@ -0,0 +1,25 @@ +// TARGET_BACKEND: JS_IR +// CALL_MAIN + +external fun create( + p0: String = definedExternally, + p1: String = definedExternally, + p2: String = definedExternally, + p3: String = definedExternally, + p4: String = definedExternally, +) : Array + +fun main() { + js("global.create = function() {return arguments}") +} + +fun box(): String { + val zeroArgs = create() + if (zeroArgs.size != 0) return "fail: $zeroArgs arguments instead 0" + + val p2 = "p2" + val threeArgs = create(p2 = p2) + if (threeArgs.size != 3 || threeArgs[2] != p2) return "fail: $threeArgs arguments instead 3" + + return "OK" +} diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index ded22676945..db5ded7a451 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -10077,6 +10077,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes public void testAllFilesPresentInExternal() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/external"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } + + @TestMetadata("jsWithDefaultArg.kt") + public void testJsWithDefaultArg() throws Exception { + runTest("compiler/testData/codegen/box/external/jsWithDefaultArg.kt"); + } } @TestMetadata("compiler/testData/codegen/box/fakeOverride") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index f4943aebaf4..65272c1f44b 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -10077,6 +10077,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { public void testAllFilesPresentInExternal() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/external"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } + + @TestMetadata("jsWithDefaultArg.kt") + public void testJsWithDefaultArg() throws Exception { + runTest("compiler/testData/codegen/box/external/jsWithDefaultArg.kt"); + } } @TestMetadata("compiler/testData/codegen/box/fakeOverride") From fe3030c43293e516a2098da5fe20379077fd6ea3 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Thu, 19 Nov 2020 13:10:08 +0300 Subject: [PATCH 014/698] [JS IR] Drop last null arguments in calls of external functions ^KT-40090 fixed --- .../js/transformers/irToJs/jsAstUtils.kt | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/jsAstUtils.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/jsAstUtils.kt index 9c483f48805..3499845db49 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/jsAstUtils.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/jsAstUtils.kt @@ -198,26 +198,35 @@ fun translateCall( } } -fun translateCallArguments(expression: IrMemberAccessExpression<*>, context: JsGenerationContext, transformer: IrElementToJsExpressionTransformer): List { +fun translateCallArguments( + expression: IrMemberAccessExpression<*>, + context: JsGenerationContext, + transformer: IrElementToJsExpressionTransformer, +): List { val size = expression.valueArgumentsCount - val arguments = (0 until size).mapTo(ArrayList(size)) { index -> - val argument = expression.getValueArgument(index) - val result = argument?.accept(transformer, context) - if (result == null) { - if (context.staticContext.backendContext.es6mode) return@mapTo JsPrefixOperation(JsUnaryOperator.VOID, JsIntLiteral(2)) - - assert(expression is IrFunctionAccessExpression && expression.symbol.owner.isExternalOrInheritedFromExternal()) - JsPrefixOperation(JsUnaryOperator.VOID, JsIntLiteral(1)) - } else - result - } + val validWithNullArgs = expression.validWithNullArgs() + val arguments = (0 until size) + .mapTo(ArrayList(size)) { index -> + val argument = expression.getValueArgument(index) + argument?.accept(transformer, context) + } + .onEach { result -> + if (result == null) { + assert(validWithNullArgs) + } + } + .dropLastWhile { it == null } + .map { it ?: JsPrefixOperation(JsUnaryOperator.VOID, JsIntLiteral(1)) } return if (expression.symbol.isSuspend) { arguments + context.continuation } else arguments } +private fun IrMemberAccessExpression<*>.validWithNullArgs() = + this is IrFunctionAccessExpression && symbol.owner.isExternalOrInheritedFromExternal() + fun JsStatement.asBlock() = this as? JsBlock ?: JsBlock(this) fun defineProperty(receiver: JsExpression, name: String, value: () -> JsExpression): JsInvocation { From 64895fe7da1e3f30861f5e12f7631e9474cb52e6 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Fri, 20 Nov 2020 15:31:31 +0300 Subject: [PATCH 015/698] [JS IR] Test with js specific moved to `js.translator` - Move js function from `main` to separate js file ^KT-40090 fixed --- .../codegen/box/external/jsWithDefaultArg.kt | 25 ----------------- .../semantics/IrBoxJsES6TestGenerated.java | 10 +++++++ .../IrJsCodegenBoxES6TestGenerated.java | 5 ---- .../ir/semantics/IrBoxJsTestGenerated.java | 10 +++++++ .../IrJsCodegenBoxTestGenerated.java | 5 ---- .../js/test/semantics/BoxJsTestGenerated.java | 10 +++++++ .../defaultArguments/externalTailArgsClass.kt | 28 +++++++++++++++++++ .../defaultArguments/externalTailArgsFun.kt | 24 ++++++++++++++++ 8 files changed, 82 insertions(+), 35 deletions(-) delete mode 100644 compiler/testData/codegen/box/external/jsWithDefaultArg.kt create mode 100644 js/js.translator/testData/box/defaultArguments/externalTailArgsClass.kt create mode 100644 js/js.translator/testData/box/defaultArguments/externalTailArgsFun.kt diff --git a/compiler/testData/codegen/box/external/jsWithDefaultArg.kt b/compiler/testData/codegen/box/external/jsWithDefaultArg.kt deleted file mode 100644 index e36cd0297ef..00000000000 --- a/compiler/testData/codegen/box/external/jsWithDefaultArg.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TARGET_BACKEND: JS_IR -// CALL_MAIN - -external fun create( - p0: String = definedExternally, - p1: String = definedExternally, - p2: String = definedExternally, - p3: String = definedExternally, - p4: String = definedExternally, -) : Array - -fun main() { - js("global.create = function() {return arguments}") -} - -fun box(): String { - val zeroArgs = create() - if (zeroArgs.size != 0) return "fail: $zeroArgs arguments instead 0" - - val p2 = "p2" - val threeArgs = create(p2 = p2) - if (threeArgs.size != 3 || threeArgs[2] != p2) return "fail: $threeArgs arguments instead 3" - - return "OK" -} diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java index ef593b685e6..9febd26bcd2 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java @@ -1025,6 +1025,16 @@ public class IrBoxJsES6TestGenerated extends AbstractIrBoxJsES6Test { runTest("js/js.translator/testData/box/defaultArguments/extensionFunWithDefArgs.kt"); } + @TestMetadata("externalTailArgsClass.kt") + public void testExternalTailArgsClass() throws Exception { + runTest("js/js.translator/testData/box/defaultArguments/externalTailArgsClass.kt"); + } + + @TestMetadata("externalTailArgsFun.kt") + public void testExternalTailArgsFun() throws Exception { + runTest("js/js.translator/testData/box/defaultArguments/externalTailArgsFun.kt"); + } + @TestMetadata("funInAbstractClassWithDefArg.kt") public void testFunInAbstractClassWithDefArg() throws Exception { runTest("js/js.translator/testData/box/defaultArguments/funInAbstractClassWithDefArg.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index db5ded7a451..ded22676945 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -10077,11 +10077,6 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes public void testAllFilesPresentInExternal() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/external"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } - - @TestMetadata("jsWithDefaultArg.kt") - public void testJsWithDefaultArg() throws Exception { - runTest("compiler/testData/codegen/box/external/jsWithDefaultArg.kt"); - } } @TestMetadata("compiler/testData/codegen/box/fakeOverride") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java index eb89de9f159..f3f38e10b55 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java @@ -1025,6 +1025,16 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest { runTest("js/js.translator/testData/box/defaultArguments/extensionFunWithDefArgs.kt"); } + @TestMetadata("externalTailArgsClass.kt") + public void testExternalTailArgsClass() throws Exception { + runTest("js/js.translator/testData/box/defaultArguments/externalTailArgsClass.kt"); + } + + @TestMetadata("externalTailArgsFun.kt") + public void testExternalTailArgsFun() throws Exception { + runTest("js/js.translator/testData/box/defaultArguments/externalTailArgsFun.kt"); + } + @TestMetadata("funInAbstractClassWithDefArg.kt") public void testFunInAbstractClassWithDefArg() throws Exception { runTest("js/js.translator/testData/box/defaultArguments/funInAbstractClassWithDefArg.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 65272c1f44b..f4943aebaf4 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -10077,11 +10077,6 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { public void testAllFilesPresentInExternal() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/external"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } - - @TestMetadata("jsWithDefaultArg.kt") - public void testJsWithDefaultArg() throws Exception { - runTest("compiler/testData/codegen/box/external/jsWithDefaultArg.kt"); - } } @TestMetadata("compiler/testData/codegen/box/fakeOverride") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java index 4e8759e734f..e7cc60e9713 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java @@ -1025,6 +1025,16 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest { runTest("js/js.translator/testData/box/defaultArguments/extensionFunWithDefArgs.kt"); } + @TestMetadata("externalTailArgsClass.kt") + public void testExternalTailArgsClass() throws Exception { + runTest("js/js.translator/testData/box/defaultArguments/externalTailArgsClass.kt"); + } + + @TestMetadata("externalTailArgsFun.kt") + public void testExternalTailArgsFun() throws Exception { + runTest("js/js.translator/testData/box/defaultArguments/externalTailArgsFun.kt"); + } + @TestMetadata("funInAbstractClassWithDefArg.kt") public void testFunInAbstractClassWithDefArg() throws Exception { runTest("js/js.translator/testData/box/defaultArguments/funInAbstractClassWithDefArg.kt"); diff --git a/js/js.translator/testData/box/defaultArguments/externalTailArgsClass.kt b/js/js.translator/testData/box/defaultArguments/externalTailArgsClass.kt new file mode 100644 index 00000000000..ffed5e03bc9 --- /dev/null +++ b/js/js.translator/testData/box/defaultArguments/externalTailArgsClass.kt @@ -0,0 +1,28 @@ +// FILE: main.kt +external class TailArgs( + p0: String = definedExternally, + p1: String = definedExternally, + p2: String = definedExternally, + p3: String = definedExternally, + p4: String = definedExternally, +) + +external val ctorArgs: Array + +fun box(): String { + val p2 = "p2" + + TailArgs() + if (ctorArgs.size != 0) return "fail2: $ctorArgs arguments instead 0" + + TailArgs(p2 = p2) + if (ctorArgs.size != 3 || ctorArgs[2] != p2) return "fail3: $ctorArgs arguments instead 3" + + return "OK" +} + +// FILE: main.js +var ctorArgs; +function TailArgs() { + ctorArgs = arguments +} diff --git a/js/js.translator/testData/box/defaultArguments/externalTailArgsFun.kt b/js/js.translator/testData/box/defaultArguments/externalTailArgsFun.kt new file mode 100644 index 00000000000..c0b6b7a52f2 --- /dev/null +++ b/js/js.translator/testData/box/defaultArguments/externalTailArgsFun.kt @@ -0,0 +1,24 @@ +// FILE: main.kt +external fun create( + p0: String = definedExternally, + p1: String = definedExternally, + p2: String = definedExternally, + p3: String = definedExternally, + p4: String = definedExternally, +) : Array + +fun box(): String { + val zeroArgsFun = create() + if (zeroArgsFun.size != 0) return "fail: $zeroArgsFun arguments instead 0" + + val p2 = "p2" + val threeArgsFun = create(p2 = p2) + if (threeArgsFun.size != 3 || threeArgsFun[2] != p2) return "fail1: $threeArgsFun arguments instead 3" + + return "OK" +} + +// FILE: main.js +function create() { + return arguments +} From 559b07d78aa387db900cca75fa7880b791a71b5e Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Tue, 27 Oct 2020 17:58:53 +0300 Subject: [PATCH 016/698] FIR IDE: fix memory leak in scope provider --- .../frontend/api/fir/components/KtFirScopeProvider.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt index 9dc76b862b9..6ec5b233303 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt @@ -40,12 +40,13 @@ import java.util.* internal class KtFirScopeProvider( analysisSession: KtAnalysisSession, - private val builder: KtSymbolByFirBuilder, + builder: KtSymbolByFirBuilder, private val project: Project, firResolveState: FirModuleResolveState, override val token: ValidityToken, ) : KtScopeProvider(), ValidityTokenOwner { override val analysisSession: KtAnalysisSession by weakRef(analysisSession) + private val builder by weakRef(builder) private val firResolveState by weakRef(firResolveState) private val firScopeStorage = FirScopeRegistry() @@ -133,13 +134,13 @@ internal class KtFirScopeProvider( } private fun buildCompletionContextForEnclosingDeclaration( - originalFile: KtFile, + ktFile: KtFile, positionInFakeFile: KtElement ): LowLevelFirApiFacadeForCompletion.FirCompletionContext { - val originalFirFile = LowLevelFirApiFacade.getFirFile(originalFile, firResolveState) - val declarationContext = EnclosingDeclarationContext.detect(originalFile, positionInFakeFile) + val firFile = LowLevelFirApiFacade.getFirFile(ktFile, firResolveState) + val declarationContext = EnclosingDeclarationContext.detect(positionInFakeFile) - return declarationContext.buildCompletionContext(originalFirFile, firResolveState) + return declarationContext.buildCompletionContext(firFile, firResolveState) } private fun convertToKtScope(firScope: FirScope): KtScope { From 315629c99bea96099f45eb945c76e8759f497aff Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Fri, 30 Oct 2020 17:42:47 +0300 Subject: [PATCH 017/698] FIR IDE: refactor lock provider --- .../level/api/api/FirModuleResolveState.kt | 1 - .../level/api/file/builder/FirFileBuilder.kt | 6 +-- .../level/api/file/builder/LockProvider.kt | 37 +++++++++++-------- .../level/api/file/builder/ModuleFileCache.kt | 4 +- .../level/api/file/structure/FileStructure.kt | 2 - .../idea/fir/low/level/api/util/utils.kt | 2 +- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/FirModuleResolveState.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/FirModuleResolveState.kt index 4850b8649db..1b0f083335a 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/FirModuleResolveState.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/FirModuleResolveState.kt @@ -20,7 +20,6 @@ import org.jetbrains.kotlin.idea.fir.low.level.api.FirTransformerProvider import org.jetbrains.kotlin.idea.fir.low.level.api.element.builder.FirTowerDataContextCollector import org.jetbrains.kotlin.idea.fir.low.level.api.file.builder.FirFileBuilder import org.jetbrains.kotlin.idea.fir.low.level.api.file.builder.ModuleFileCache -import org.jetbrains.kotlin.idea.fir.low.level.api.file.builder.withReadLock import org.jetbrains.kotlin.idea.fir.low.level.api.sessions.FirIdeSourcesSession import org.jetbrains.kotlin.idea.fir.low.level.api.util.ktDeclaration import org.jetbrains.kotlin.idea.util.getElementTextInContext diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/builder/FirFileBuilder.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/builder/FirFileBuilder.kt index 718d0ba6a18..a8c1a454db2 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/builder/FirFileBuilder.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/builder/FirFileBuilder.kt @@ -68,10 +68,8 @@ internal class FirFileBuilder( inline fun runCustomResolveUnderLock(firFile: FirFile, cache: ModuleFileCache, resolve: () -> R): R = cache.firFileLockProvider.withWriteLock(firFile) { resolve() } - inline fun runCustomResolveWithPCECheck(firFile: FirFile, cache: ModuleFileCache, resolve: () -> R): R { - val lock = cache.firFileLockProvider.getLockFor(firFile) - return lock.writeLock().lockWithPCECheck(LOCKING_INTERVAL_MS) { resolve() } - } + inline fun runCustomResolveWithPCECheck(firFile: FirFile, cache: ModuleFileCache, resolve: () -> R): R = + cache.firFileLockProvider.withWriteLockPCECheck(firFile, LOCKING_INTERVAL_MS, resolve) fun runResolveWithoutLock( firFile: FirFile, diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/builder/LockProvider.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/builder/LockProvider.kt index fbb6e70f7e3..7011942030e 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/builder/LockProvider.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/builder/LockProvider.kt @@ -6,28 +6,33 @@ package org.jetbrains.kotlin.idea.fir.low.level.api.file.builder import com.google.common.collect.MapMaker +import com.intellij.openapi.diagnostic.logger +import org.jetbrains.kotlin.fir.declarations.FirFile +import org.jetbrains.kotlin.idea.fir.low.level.api.util.lockWithPCECheck import java.util.concurrent.ConcurrentMap import java.util.concurrent.locks.ReadWriteLock -import java.util.concurrent.locks.ReentrantLock +import java.util.concurrent.locks.ReentrantReadWriteLock import kotlin.concurrent.withLock -internal class LockProvider(private val createLock: () -> LOCK) { - private val locks: ConcurrentMap = MapMaker().weakKeys().makeMap() - fun getLockFor(key: KEY) = locks.getOrPut(key) { createLock() } -} +internal class LockProvider { + private val locks: ConcurrentMap = MapMaker().weakKeys().makeMap() -internal inline fun LockProvider.withReadLock(key: KEY, action: () -> R): R { - val readLock = getLockFor(key).readLock() - return readLock.withLock { action() } -} + @Suppress("NOTHING_TO_INLINE") + private inline fun getLockFor(key: KEY) = locks.getOrPut(key) { ReentrantReadWriteLock() } -internal inline fun LockProvider.withWriteLock(key: KEY, action: () -> R): R { - val writeLock = getLockFor(key).writeLock() - return writeLock.withLock { action() } -} + inline fun withReadLock(key: KEY, action: () -> R): R { + val readLock = getLockFor(key).readLock() + return readLock.withLock { action() } + } -internal inline fun LockProvider.withLock(key: KEY, action: () -> R): R { - val lock = getLockFor(key) - return lock.withLock { action() } + inline fun withWriteLock(key: KEY, action: () -> R): R { + val writeLock = getLockFor(key).writeLock() + return writeLock.withLock { action() } + } + + inline fun withWriteLockPCECheck(key: KEY, lockingIntervalMs: Long, action: () -> R): R { + val writeLock = getLockFor(key).writeLock() + return writeLock.lockWithPCECheck(lockingIntervalMs, action) + } } \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/builder/ModuleFileCache.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/builder/ModuleFileCache.kt index 6f7e273f381..47933d45c81 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/builder/ModuleFileCache.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/builder/ModuleFileCache.kt @@ -51,7 +51,7 @@ internal abstract class ModuleFileCache { abstract fun getCachedFirFile(ktFile: KtFile): FirFile? - abstract val firFileLockProvider: LockProvider + abstract val firFileLockProvider: LockProvider inline fun withReadLockOn(declaration: D, action: (D) -> R): R { val file = getContainerFirFile(declaration) @@ -76,5 +76,5 @@ internal class ModuleFileCacheImpl(override val session: FirSession) : ModuleFil return getCachedFirFile(ktFile) } - override val firFileLockProvider: LockProvider = LockProvider { ReentrantReadWriteLock() } + override val firFileLockProvider: LockProvider = LockProvider() } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructure.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructure.kt index cdfbf7313b4..8b8b0382b7b 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructure.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructure.kt @@ -12,8 +12,6 @@ import org.jetbrains.kotlin.fir.resolve.toSymbol import org.jetbrains.kotlin.idea.fir.low.level.api.element.builder.getNonLocalContainingOrThisDeclaration import org.jetbrains.kotlin.idea.fir.low.level.api.file.builder.FirFileBuilder import org.jetbrains.kotlin.idea.fir.low.level.api.file.builder.ModuleFileCache -import org.jetbrains.kotlin.idea.fir.low.level.api.file.builder.withReadLock -import org.jetbrains.kotlin.idea.fir.low.level.api.file.builder.withWriteLock import org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver import org.jetbrains.kotlin.idea.fir.low.level.api.providers.firIdeProvider import org.jetbrains.kotlin.idea.fir.low.level.api.util.findSourceNonLocalFirDeclaration diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/util/utils.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/util/utils.kt index 066e0e23cda..439aef3ff27 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/util/utils.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/util/utils.kt @@ -32,7 +32,7 @@ internal inline fun executeWithoutPCE(crossinline action: () -> T): T return result!! } -internal inline fun Lock.lockWithPCECheck(lockingIntervalMs: Long, action: () -> T): T { +internal inline fun Lock.lockWithPCECheck(lockingIntervalMs: Long, action: () -> T): T { var needToRun = true var result: T? = null while (needToRun) { From 7c912cd3e462ff1525f15471c8f109d9ebb63305 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Sun, 1 Nov 2020 12:43:29 +0300 Subject: [PATCH 018/698] FIR IDE: introduce FileElementFactory --- ...IdeStructureElementDiagnosticsCollector.kt | 23 ++++ .../api/file/structure/FileElementFactory.kt | 50 +++++++ .../level/api/file/structure/FileStructure.kt | 72 +--------- .../file/structure/FileStructureElement.kt | 124 ++++++++++++------ .../idea/fir/low/level/api/util/psiUtils.kt | 11 -- 5 files changed, 163 insertions(+), 117 deletions(-) create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileElementFactory.kt delete mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/util/psiUtils.kt diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostics/FirIdeStructureElementDiagnosticsCollector.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostics/FirIdeStructureElementDiagnosticsCollector.kt index b8b31868e34..57e5c9dd0bb 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostics/FirIdeStructureElementDiagnosticsCollector.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostics/FirIdeStructureElementDiagnosticsCollector.kt @@ -51,5 +51,28 @@ internal class FirIdeStructureElementDiagnosticsCollector private constructor( collector.collectDiagnostics(firFile) FileStructureElementDiagnostics(collector.result) } + + fun collectForSingleDeclaration(firFile: FirFile, declaration: FirDeclaration): FileStructureElementDiagnostics { + var inCurrentDeclaration = false + + return collectForStructureElement( + firFile, + onDeclarationEnter = { firDeclaration -> + when { + firDeclaration == declaration -> { + inCurrentDeclaration = true + DiagnosticCollectorDeclarationAction.CHECK_CURRENT_DECLARATION_AND_CHECK_NESTED + } + inCurrentDeclaration -> DiagnosticCollectorDeclarationAction.CHECK_CURRENT_DECLARATION_AND_CHECK_NESTED + else -> DiagnosticCollectorDeclarationAction.SKIP_CURRENT_DECLARATION_AND_CHECK_NESTED + } + }, + onDeclarationExit = { firDeclaration -> + if (declaration == firDeclaration) { + inCurrentDeclaration = false + } + } + ) + } } } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileElementFactory.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileElementFactory.kt new file mode 100644 index 00000000000..70ca1ec7398 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileElementFactory.kt @@ -0,0 +1,50 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.fir.low.level.api.file.structure + +import org.jetbrains.kotlin.fir.declarations.FirDeclaration +import org.jetbrains.kotlin.fir.declarations.FirFile +import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction +import org.jetbrains.kotlin.psi.KtDeclaration +import org.jetbrains.kotlin.psi.KtNamedFunction + +internal object FileElementFactory { + /** + * should be consistent with [isReanalyzableContainer] + */ + fun createFileStructureElement( + firDeclaration: FirDeclaration, + ktDeclaration: KtDeclaration, + firFile: FirFile, + ): FileStructureElement = when { + ktDeclaration is KtNamedFunction && ktDeclaration.name != null && ktDeclaration.hasExplicitTypeOrUnit -> + IncrementallyReanalyzableFunction( + firFile, + ktDeclaration, + (firDeclaration as FirSimpleFunction).symbol, + ktDeclaration.modificationStamp + ) + + else -> NonLocalDeclarationFileStructureElement( + firFile, + firDeclaration, + ktDeclaration, + ) + } + + /** + * should be consistent with [createFileStructureElement] + */ + fun isReanalyzableContainer( + ktDeclaration: KtDeclaration, + ): Boolean = when { + ktDeclaration is KtNamedFunction && ktDeclaration.name != null && ktDeclaration.hasExplicitTypeOrUnit -> true + else -> false + } + + val KtNamedFunction.hasExplicitTypeOrUnit + get() = hasBlockBody() || typeReference != null +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructure.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructure.kt index 8b8b0382b7b..f194d1a79f4 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructure.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructure.kt @@ -6,17 +6,13 @@ package org.jetbrains.kotlin.idea.fir.low.level.api.file.structure import org.jetbrains.kotlin.diagnostics.Diagnostic -import org.jetbrains.kotlin.fir.containingClass import org.jetbrains.kotlin.fir.declarations.* -import org.jetbrains.kotlin.fir.resolve.toSymbol import org.jetbrains.kotlin.idea.fir.low.level.api.element.builder.getNonLocalContainingOrThisDeclaration import org.jetbrains.kotlin.idea.fir.low.level.api.file.builder.FirFileBuilder import org.jetbrains.kotlin.idea.fir.low.level.api.file.builder.ModuleFileCache import org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver import org.jetbrains.kotlin.idea.fir.low.level.api.providers.firIdeProvider import org.jetbrains.kotlin.idea.fir.low.level.api.util.findSourceNonLocalFirDeclaration -import org.jetbrains.kotlin.idea.fir.low.level.api.util.hasExplicitTypeOrUnit -import org.jetbrains.kotlin.idea.fir.low.level.api.util.replaceFirst import org.jetbrains.kotlin.idea.util.getElementTextInContext import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject @@ -44,8 +40,8 @@ internal class FileStructure( val structureElement = structureElements.compute(declaration) { _, structureElement -> when { structureElement == null -> createStructureElement(declaration) - structureElement is WithInBlockModificationFileStructureElement && !structureElement.isUpToDate() -> { - createMappingsCopy(structureElement, declaration as KtNamedFunction) + structureElement is ReanalyzableStructureElement<*> && !structureElement.isUpToDate() -> { + structureElement.reanalyze(declaration as KtNamedFunction, moduleFileCache, firLazyDeclarationResolver, firIdeProvider) } else -> structureElement } @@ -72,52 +68,6 @@ internal class FileStructure( } } - private fun replaceFunction(from: FirSimpleFunction, to: FirSimpleFunction) { - val declarations = if (from.symbol.callableId.className == null) { - firFile.declarations as MutableList - } else { - val classLikeLookupTag = from.containingClass() - ?: error("Class name should not be null for non-top-level & non-local declarations") - val containingClass = classLikeLookupTag.toSymbol(firFile.session)?.fir as FirRegularClass - containingClass.declarations as MutableList - } - declarations.replaceFirst(from, to) - } - - private fun createMappingsCopy( - original: WithInBlockModificationFileStructureElement, - containerKtFunction: KtNamedFunction - ): WithInBlockModificationFileStructureElement { - val newFunction = firIdeProvider.buildFunctionWithBody(containerKtFunction) as FirSimpleFunction - val originalFunction = original.firSymbol.fir as FirSimpleFunction - - moduleFileCache.firFileLockProvider.withWriteLock(firFile) { - replaceFunction(originalFunction, newFunction) - } - - try { - firLazyDeclarationResolver.lazyResolveDeclaration( - newFunction, - moduleFileCache, - FirResolvePhase.BODY_RESOLVE, - checkPCE = true, - reresolveFile = true, - ) - return moduleFileCache.firFileLockProvider.withReadLock(firFile) { - WithInBlockModificationFileStructureElement( - firFile, - containerKtFunction, - newFunction.symbol, - containerKtFunction.modificationStamp, - ) - } - } catch (e: Throwable) { - moduleFileCache.firFileLockProvider.withWriteLock(firFile) { - replaceFunction(newFunction, originalFunction) - } - throw e - } - } private fun createDeclarationStructure(declaration: KtDeclaration): FileStructureElement { val firDeclaration = declaration.findSourceNonLocalFirDeclaration( @@ -133,23 +83,7 @@ internal class FileStructure( checkPCE = true ) return moduleFileCache.firFileLockProvider.withReadLock(firFile) { - when { - declaration is KtNamedFunction && declaration.hasExplicitTypeOrUnit -> { - WithInBlockModificationFileStructureElement( - firFile, - declaration, - (firDeclaration as FirSimpleFunction).symbol, - declaration.modificationStamp, - ) - } - else -> { - NonLocalDeclarationFileStructureElement( - firFile, - firDeclaration, - declaration, - ) - } - } + FileElementFactory.createFileStructureElement(firDeclaration, declaration, firFile) } } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureElement.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureElement.kt index d12a281d3ae..ce9e23a2cbc 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureElement.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureElement.kt @@ -8,16 +8,19 @@ package org.jetbrains.kotlin.idea.fir.low.level.api.file.structure import org.jetbrains.kotlin.diagnostics.Diagnostic import org.jetbrains.kotlin.fir.FirElement import org.jetbrains.kotlin.fir.analysis.collectors.DiagnosticCollectorDeclarationAction -import org.jetbrains.kotlin.fir.declarations.FirDeclaration -import org.jetbrains.kotlin.fir.declarations.FirFile -import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction +import org.jetbrains.kotlin.fir.containingClass +import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.psi +import org.jetbrains.kotlin.fir.resolve.toSymbol +import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol import org.jetbrains.kotlin.idea.fir.low.level.api.diagnostics.FirIdeStructureElementDiagnosticsCollector -import org.jetbrains.kotlin.idea.fir.low.level.api.util.hasExplicitTypeOrUnit +import org.jetbrains.kotlin.idea.fir.low.level.api.file.builder.ModuleFileCache +import org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver +import org.jetbrains.kotlin.idea.fir.low.level.api.providers.FirIdeProvider +import org.jetbrains.kotlin.idea.fir.low.level.api.util.ktDeclaration +import org.jetbrains.kotlin.idea.fir.low.level.api.util.replaceFirst import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.collectDescendantsOfTypeTo -import org.jetbrains.kotlin.utils.addToStdlib.safeAs internal class FileStructureElementDiagnostics( private val map: Map> @@ -34,43 +37,90 @@ internal sealed class FileStructureElement { abstract val diagnostics: FileStructureElementDiagnostics } -internal class WithInBlockModificationFileStructureElement( - override val firFile: FirFile, - override val psi: KtFunction, - val firSymbol: FirFunctionSymbol<*>, - val timestamp: Long -) : FileStructureElement() { +internal sealed class ReanalyzableStructureElement : FileStructureElement() { + abstract override val psi: KT + abstract val firSymbol: AbstractFirBasedSymbol<*> + abstract val timestamp: Long - override val mappings: Map = - FirElementsRecorder.recordElementsFrom(firSymbol.fir, recorder) + /** + * Creates new declaration by [newKtDeclaration] which will serve as replacement of [firSymbol] + * Also, modify [firFile] & replace old version of declaration to a new one + */ + abstract fun reanalyze( + newKtDeclaration: KtNamedFunction, + cache: ModuleFileCache, + firLazyDeclarationResolver: FirLazyDeclarationResolver, + firIdeProvider: FirIdeProvider, + ): ReanalyzableStructureElement fun isUpToDate(): Boolean = psi.getModificationStamp() == timestamp override val diagnostics: FileStructureElementDiagnostics by lazy { - var inCurrentDeclaration = false - - FirIdeStructureElementDiagnosticsCollector.collectForStructureElement( - firFile, - onDeclarationEnter = { firDeclaration -> - when { - firDeclaration == firSymbol.fir -> { - inCurrentDeclaration = true - DiagnosticCollectorDeclarationAction.CHECK_CURRENT_DECLARATION_AND_CHECK_NESTED - } - inCurrentDeclaration -> DiagnosticCollectorDeclarationAction.CHECK_CURRENT_DECLARATION_AND_CHECK_NESTED - else -> DiagnosticCollectorDeclarationAction.SKIP_CURRENT_DECLARATION_AND_CHECK_NESTED - } - }, - onDeclarationExit = { declaration -> - if (declaration == firSymbol.fir) { - inCurrentDeclaration = false - } - } - ) + FirIdeStructureElementDiagnosticsCollector.collectForSingleDeclaration(firFile, firSymbol.fir as FirDeclaration) } companion object { - private val recorder = FirElementsRecorder() + val recorder = FirElementsRecorder() + } +} + +internal class IncrementallyReanalyzableFunction( + override val firFile: FirFile, + override val psi: KtNamedFunction, + override val firSymbol: FirFunctionSymbol<*>, + override val timestamp: Long +) : ReanalyzableStructureElement() { + override val mappings: Map = + FirElementsRecorder.recordElementsFrom(firSymbol.fir, recorder) + + private fun replaceFunction(from: FirSimpleFunction, to: FirSimpleFunction) { + val declarations = if (from.symbol.callableId.className == null) { + firFile.declarations as MutableList + } else { + val classLikeLookupTag = from.containingClass() + ?: error("Class name should not be null for non-top-level & non-local declarations") + val containingClass = classLikeLookupTag.toSymbol(firFile.session)?.fir as FirRegularClass + containingClass.declarations as MutableList + } + declarations.replaceFirst(from, to) + } + + override fun reanalyze( + newKtDeclaration: KtNamedFunction, + cache: ModuleFileCache, + firLazyDeclarationResolver: FirLazyDeclarationResolver, + firIdeProvider: FirIdeProvider, + ): IncrementallyReanalyzableFunction { + val newFunction = firIdeProvider.buildFunctionWithBody(newKtDeclaration) as FirSimpleFunction + val originalFunction = firSymbol.fir as FirSimpleFunction + + cache.firFileLockProvider.withWriteLock(firFile) { + replaceFunction(originalFunction, newFunction) + } + + //todo remap symbol under firFile write lock + try { + firLazyDeclarationResolver.lazyResolveDeclaration( + newFunction, + cache, + FirResolvePhase.BODY_RESOLVE, + checkPCE = true, + reresolveFile = true, + ) + return cache.firFileLockProvider.withReadLock(firFile) { + IncrementallyReanalyzableFunction( + firFile, + newKtDeclaration, + newFunction.symbol, + newKtDeclaration.modificationStamp, + ) + } + } catch (e: Throwable) { + cache.firFileLockProvider.withWriteLock(firFile) { + replaceFunction(newFunction, originalFunction) + } + throw e + } } } @@ -92,7 +142,7 @@ internal class NonLocalDeclarationFileStructureElement( inCurrentDeclaration = true DiagnosticCollectorDeclarationAction.CHECK_CURRENT_DECLARATION_AND_CHECK_NESTED } - (firDeclaration.psi as? KtNamedFunction)?.hasExplicitTypeOrUnit == true -> { + FileElementFactory.isReanalyzableContainer(firDeclaration.ktDeclaration) -> { DiagnosticCollectorDeclarationAction.SKIP } inCurrentDeclaration -> { @@ -113,7 +163,7 @@ internal class NonLocalDeclarationFileStructureElement( private val recorder = object : FirElementsRecorder() { override fun visitSimpleFunction(simpleFunction: FirSimpleFunction, data: MutableMap) { val psi = simpleFunction.psi as? KtNamedFunction ?: return super.visitSimpleFunction(simpleFunction, data) - if (!psi.hasExplicitTypeOrUnit || KtPsiUtil.isLocal(psi)) { + if (!FileElementFactory.isReanalyzableContainer(psi) || KtPsiUtil.isLocal(psi)) { super.visitSimpleFunction(simpleFunction, data) } } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/util/psiUtils.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/util/psiUtils.kt deleted file mode 100644 index 732b5248f49..00000000000 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/util/psiUtils.kt +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.fir.low.level.api.util - -import org.jetbrains.kotlin.psi.KtNamedFunction - -internal val KtNamedFunction.hasExplicitTypeOrUnit - get() = hasBlockBody() || typeReference != null From 6c1faec171655f0f84d47f43d6c167f319115989 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Sun, 1 Nov 2020 16:37:49 +0300 Subject: [PATCH 019/698] FIR IDE: introduce file structure tests --- .../kotlin/generators/tests/GenerateTests.kt | 4 + .../testdata/fileStructure/class.kt | 6 ++ .../testdata/fileStructure/localClass.kt | 9 ++ .../testdata/fileStructure/localFun.kt | 13 +++ .../testdata/fileStructure/nestedClasses.kt | 16 ++++ .../topLevelExpressionBodyFunWithType.kt | 1 + .../topLevelExpressionBodyFunWithoutType.kt | 1 + .../fileStructure/topLevelFunWithType.kt | 4 + .../testdata/fileStructure/topLevelUnitFun.kt | 4 + .../structure/AbstractFileStructureTest.kt | 87 +++++++++++++++++++ .../structure/FileStructureTestGenerated.java | 70 +++++++++++++++ 11 files changed, 215 insertions(+) create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/class.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localClass.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localFun.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/nestedClasses.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelExpressionBodyFunWithType.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelExpressionBodyFunWithoutType.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelFunWithType.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelUnitFun.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureTest.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureTestGenerated.java diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index 6b04d526dc7..1b339c0f600 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -83,6 +83,7 @@ import org.jetbrains.kotlin.idea.fir.low.level.api.AbstractFirMultiModuleResolve import org.jetbrains.kotlin.idea.fir.AbstractKtDeclarationAndFirDeclarationEqualityChecker import org.jetbrains.kotlin.idea.fir.low.level.api.AbstractFirLazyDeclarationResolveTest import org.jetbrains.kotlin.idea.fir.low.level.api.AbstractFirMultiModuleLazyResolveTest +import org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.AbstractFileStructureTest import org.jetbrains.kotlin.idea.folding.AbstractKotlinFoldingTest import org.jetbrains.kotlin.idea.frontend.api.fir.AbstractResolveCallTest import org.jetbrains.kotlin.idea.frontend.api.scopes.AbstractMemberScopeByFqNameTest @@ -1036,6 +1037,9 @@ fun main(args: Array) { testClass { model("lazyResolve") } + testClass { + model("fileStructure") + } } testGroup("idea/idea-fir/tests", "idea") { diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/class.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/class.kt new file mode 100644 index 00000000000..ffa1a2204b4 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/class.kt @@ -0,0 +1,6 @@ +class A {/* NonLocalDeclarationFileStructureElement */ + fun x() {/* IncrementallyReanalyzableFunction */ + + } + fun y(): Int = 10/* IncrementallyReanalyzableFunction */ +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localClass.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localClass.kt new file mode 100644 index 00000000000..2a943ad2047 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localClass.kt @@ -0,0 +1,9 @@ +fun a() {/* IncrementallyReanalyzableFunction */ + class X +} + +class Y {/* NonLocalDeclarationFileStructureElement */ + fun b() {/* IncrementallyReanalyzableFunction */ + class Z + } +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localFun.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localFun.kt new file mode 100644 index 00000000000..4331ea276c4 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localFun.kt @@ -0,0 +1,13 @@ +fun x() {/* IncrementallyReanalyzableFunction */ + fun y() { + + } +} + +class A {/* NonLocalDeclarationFileStructureElement */ + fun z() {/* IncrementallyReanalyzableFunction */ + fun q() { + + } + } +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/nestedClasses.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/nestedClasses.kt new file mode 100644 index 00000000000..f4d1fc3f430 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/nestedClasses.kt @@ -0,0 +1,16 @@ +class A {/* NonLocalDeclarationFileStructureElement */ + class B {/* NonLocalDeclarationFileStructureElement */ + fun x() {/* IncrementallyReanalyzableFunction */ + } + + class C {/* NonLocalDeclarationFileStructureElement */ + + } + } + + class E {/* NonLocalDeclarationFileStructureElement */ + + } + + fun y(): Int = 10/* IncrementallyReanalyzableFunction */ +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelExpressionBodyFunWithType.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelExpressionBodyFunWithType.kt new file mode 100644 index 00000000000..672f5070290 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelExpressionBodyFunWithType.kt @@ -0,0 +1 @@ +fun foo(): Int = 42/* IncrementallyReanalyzableFunction */ \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelExpressionBodyFunWithoutType.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelExpressionBodyFunWithoutType.kt new file mode 100644 index 00000000000..f9f7b502c6b --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelExpressionBodyFunWithoutType.kt @@ -0,0 +1 @@ +fun foo() = 42/* NonLocalDeclarationFileStructureElement */ \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelFunWithType.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelFunWithType.kt new file mode 100644 index 00000000000..d1eab252b95 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelFunWithType.kt @@ -0,0 +1,4 @@ +fun foo(): Int {/* IncrementallyReanalyzableFunction */ + println("") + return 10 +} diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelUnitFun.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelUnitFun.kt new file mode 100644 index 00000000000..774c4cd6abd --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelUnitFun.kt @@ -0,0 +1,4 @@ +fun foo() {/* IncrementallyReanalyzableFunction */ + println("") +} + diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureTest.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureTest.kt new file mode 100644 index 00000000000..254ab3ad4af --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureTest.kt @@ -0,0 +1,87 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.fir.low.level.api.file.structure + +import com.intellij.openapi.application.runUndoTransparentWriteAction +import com.intellij.openapi.util.io.FileUtil +import com.intellij.psi.PsiComment +import com.intellij.psi.PsiDocumentManager +import com.intellij.psi.util.collectDescendantsOfType +import com.intellij.psi.util.forEachDescendantOfType +import com.intellij.psi.util.parentOfType +import junit.framework.Assert +import org.jetbrains.kotlin.fir.render +import org.jetbrains.kotlin.idea.fir.low.level.api.FirModuleResolveStateImpl +import org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacade +import org.jetbrains.kotlin.idea.search.getKotlinFqName +import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase +import org.jetbrains.kotlin.idea.util.getElementTextInContext +import org.jetbrains.kotlin.psi.* +import org.jetbrains.kotlin.resolve.calls.callUtil.isFakeElement +import org.jetbrains.kotlin.test.InTextDirectivesUtils +import org.jetbrains.kotlin.test.KotlinTestUtils +import java.io.File + +abstract class AbstractFileStructureTest : KotlinLightCodeInsightFixtureTestCase() { + override fun isFirPlugin(): Boolean = true + + fun doTest(path: String) { + val testDataFile = File(path) + val initialFileText = FileUtil.loadFile(testDataFile) + val ktFile = myFixture.configureByText(testDataFile.name, initialFileText) as KtFile + val fileStructure = ktFile.getFileStructure() + val allStructureElements = fileStructure.getAllStructureElements(ktFile) + val declarationToStructureElement = allStructureElements.associateBy { it.psi } + runUndoTransparentWriteAction { + ktFile.collectDescendantsOfType().forEach { it.delete() } + ktFile.forEachDescendantOfType { ktDeclaration -> + val structureElement = declarationToStructureElement[ktDeclaration] ?: return@forEachDescendantOfType + val comment = structureElement.createComment() + when (ktDeclaration) { + is KtClassOrObject -> { + val lBrace = ktDeclaration.body?.lBrace + if (lBrace != null) { + ktDeclaration.body!!.addAfter(comment, lBrace) + } else { + ktDeclaration.parent.addAfter(comment, ktDeclaration) + } + } + is KtFunction -> { + val lBrace = ktDeclaration.bodyBlockExpression?.lBrace + if (lBrace != null) { + ktDeclaration.bodyBlockExpression!!.addAfter(comment, lBrace) + } else { + ktDeclaration.parent.addAfter(comment, ktDeclaration) + } + } + else -> error("Unsupported declaration $ktDeclaration") + } + } + } + KotlinTestUtils.assertEqualsToFile(testDataFile, ktFile.text) + } + + private fun FileStructureElement.createComment(): PsiComment { + val text = """/* ${this::class.simpleName!!} */""" + return KtPsiFactory(psi.project).createComment(text) + } + + private fun KtFile.getFileStructure(): FileStructure { + val moduleResolveState = LowLevelFirApiFacade.getResolveStateFor(this) as FirModuleResolveStateImpl + return moduleResolveState.fileStructureCache.getFileStructure( + ktFile = this, + moduleFileCache = moduleResolveState.rootModuleSession.cache + ) + } + + @OptIn(ExperimentalStdlibApi::class) + private fun FileStructure.getAllStructureElements(ktFile: KtFile): Collection = buildSet { + ktFile.forEachDescendantOfType { ktElement -> + add(getStructureElementFor(ktElement)) + } + } + +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureTestGenerated.java b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureTestGenerated.java new file mode 100644 index 00000000000..597f3bde44c --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureTestGenerated.java @@ -0,0 +1,70 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.fir.low.level.api.file.structure; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class FileStructureTestGenerated extends AbstractFileStructureTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInFileStructure() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("class.kt") + public void testClass() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/class.kt"); + } + + @TestMetadata("localClass.kt") + public void testLocalClass() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localClass.kt"); + } + + @TestMetadata("localFun.kt") + public void testLocalFun() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localFun.kt"); + } + + @TestMetadata("nestedClasses.kt") + public void testNestedClasses() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/nestedClasses.kt"); + } + + @TestMetadata("topLevelExpressionBodyFunWithType.kt") + public void testTopLevelExpressionBodyFunWithType() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelExpressionBodyFunWithType.kt"); + } + + @TestMetadata("topLevelExpressionBodyFunWithoutType.kt") + public void testTopLevelExpressionBodyFunWithoutType() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelExpressionBodyFunWithoutType.kt"); + } + + @TestMetadata("topLevelFunWithType.kt") + public void testTopLevelFunWithType() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelFunWithType.kt"); + } + + @TestMetadata("topLevelUnitFun.kt") + public void testTopLevelUnitFun() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelUnitFun.kt"); + } +} From 880e76b203e25c19cf7b2ecd21bb900356ff8741 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Tue, 3 Nov 2020 21:34:31 +0300 Subject: [PATCH 020/698] FIR IDE: introduce FIR IDE specific out of block modification tracker --- .../kotlin/generators/tests/GenerateTests.kt | 4 + .../level/api/FirIdeResolveStateService.kt | 15 +-- .../api/element/builder/FirElementBuilder.kt | 14 ++- .../sessions/FirIdeSessionProviderStorage.kt | 7 +- .../KotlinFirOutOfBlockModificationTracker.kt | 91 ++++++++++++++++++ ...FirOutOfBlockModificationTrackerFactory.kt | 34 +++++++ .../outOfBlockProjectWide/localFun.kt | 5 + .../topLevelExpressionBodyFunWithType.kt | 3 + .../topLevelExpressionBodyFunWithoutType.kt | 3 + .../topLevelFunWithType.kt | 6 ++ .../outOfBlockProjectWide/topLevelUnitFun.kt | 5 + .../typeInFunctionAnnotation.kt | 6 ++ .../typeInFunctionAnnotationParameter.kt | 6 ++ .../typeInFunctionModifiers.kt | 5 + .../typeInFunctionName.kt | 5 + .../typeInFunctionParams.kt | 5 + .../typeInFunctionParamsType.kt | 5 + .../typeInFunctionReturnType.kt | 5 + .../typeInFunctionTypeParams.kt | 5 + ...lyzableFileStructureElementCreationTest.kt | 85 +++++++++++++++++ ...StructureElementCreationTestGenerated.java | 50 ++++++++++ ...OutOfBlockKotlinModificationTrackerTest.kt | 37 ++++++++ ...otlinModificationTrackerTestGenerated.java | 95 +++++++++++++++++++ idea/resources-fir/META-INF/plugin.xml | 3 +- 24 files changed, 484 insertions(+), 15 deletions(-) create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTracker.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTrackerFactory.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/localFun.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelExpressionBodyFunWithType.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelExpressionBodyFunWithoutType.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelFunWithType.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelUnitFun.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionAnnotation.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionAnnotationParameter.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionModifiers.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionName.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionParams.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionParamsType.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionReturnType.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionTypeParams.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractReanalyzableFileStructureElementCreationTest.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/ReanalyzableFileStructureElementCreationTestGenerated.java create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/AbstractProjectWideOutOfBlockKotlinModificationTrackerTest.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/ProjectWideOutOfBlockKotlinModificationTrackerTestGenerated.java diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index 1b339c0f600..ea49712ab5a 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -86,6 +86,7 @@ import org.jetbrains.kotlin.idea.fir.low.level.api.AbstractFirMultiModuleLazyRes import org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.AbstractFileStructureTest import org.jetbrains.kotlin.idea.folding.AbstractKotlinFoldingTest import org.jetbrains.kotlin.idea.frontend.api.fir.AbstractResolveCallTest +import org.jetbrains.kotlin.idea.fir.low.level.api.trackers.AbstractProjectWideOutOfBlockKotlinModificationTrackerTest import org.jetbrains.kotlin.idea.frontend.api.scopes.AbstractMemberScopeByFqNameTest import org.jetbrains.kotlin.idea.frontend.api.symbols.AbstractSymbolFromLibraryPointerRestoreTest import org.jetbrains.kotlin.idea.frontend.api.symbols.AbstractSymbolsByFqNameBuildingTest @@ -1037,6 +1038,9 @@ fun main(args: Array) { testClass { model("lazyResolve") } + testClass { + model("outOfBlockProjectWide") + } testClass { model("fileStructure") } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/FirIdeResolveStateService.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/FirIdeResolveStateService.kt index 66d3303041d..111ed2d5f0b 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/FirIdeResolveStateService.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/FirIdeResolveStateService.kt @@ -7,21 +7,13 @@ package org.jetbrains.kotlin.idea.fir.low.level.api import com.intellij.openapi.components.service import com.intellij.openapi.project.Project -import com.intellij.openapi.util.ModificationTracker -import com.intellij.psi.util.CachedValue -import com.intellij.psi.util.CachedValueProvider -import com.intellij.psi.util.CachedValuesManager import org.jetbrains.annotations.TestOnly -import org.jetbrains.kotlin.fir.dependenciesWithoutSelf import org.jetbrains.kotlin.idea.caches.project.IdeaModuleInfo import org.jetbrains.kotlin.idea.caches.project.ModuleSourceInfo -import org.jetbrains.kotlin.idea.caches.trackers.KotlinCodeBlockModificationListener import org.jetbrains.kotlin.idea.fir.low.level.api.api.FirModuleResolveState import org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver -import org.jetbrains.kotlin.idea.fir.low.level.api.sessions.FirIdeSessionFactory -import org.jetbrains.kotlin.idea.fir.low.level.api.sessions.FirIdeSessionProvider import org.jetbrains.kotlin.idea.fir.low.level.api.sessions.FirIdeSessionProviderStorage -import org.jetbrains.kotlin.idea.fir.low.level.api.sessions.FirIdeSourcesSession +import org.jetbrains.kotlin.idea.fir.low.level.api.trackers.KotlinFirOutOfBlockModificationTrackerFactory import org.jetbrains.kotlin.idea.util.cachedValue import org.jetbrains.kotlin.idea.util.getValue import java.util.concurrent.ConcurrentHashMap @@ -29,7 +21,10 @@ import java.util.concurrent.ConcurrentHashMap internal class FirIdeResolveStateService(project: Project) { private val sessionProviderStorage = FirIdeSessionProviderStorage(project) - private val stateCache by cachedValue(project, KotlinCodeBlockModificationListener.getInstance(project).kotlinOutOfCodeBlockTracker) { + private val stateCache by cachedValue( + project, + project.service().createProjectWideOutOfBlockModificationTracker(), + ) { ConcurrentHashMap() } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/element/builder/FirElementBuilder.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/element/builder/FirElementBuilder.kt index e61bc0475ab..7821d2cbe36 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/element/builder/FirElementBuilder.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/element/builder/FirElementBuilder.kt @@ -68,7 +68,8 @@ private fun KtElement.getFirOfClosestParent(cache: Map): return null } -fun KtElement.getNonLocalContainingOrThisDeclaration(): KtNamedDeclaration? { + +internal inline fun PsiElement.getNonLocalContainingOrThisDeclaration(predicate: (KtDeclaration) -> Boolean = { true }): KtNamedDeclaration? { var container: PsiElement? = this while (container != null && container !is KtFile) { if (container is KtNamedDeclaration @@ -77,10 +78,19 @@ fun KtElement.getNonLocalContainingOrThisDeclaration(): KtNamedDeclaration? { && !KtPsiUtil.isLocal(container) && container !is KtEnumEntry && container.containingClassOrObject !is KtEnumEntry + && predicate(container) ) { return container } container = container.parent } return null -} \ No newline at end of file +} + +internal fun PsiElement.getNonLocalContainingInBodyDeclarationWith(): KtNamedDeclaration? = + getNonLocalContainingOrThisDeclaration { declaration -> + when (declaration) { + is KtNamedFunction -> declaration.bodyExpression?.isAncestor(this) == true + else -> false + } + } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/FirIdeSessionProviderStorage.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/FirIdeSessionProviderStorage.kt index 0a676323168..6c84e5ceb3d 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/FirIdeSessionProviderStorage.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/FirIdeSessionProviderStorage.kt @@ -5,12 +5,13 @@ package org.jetbrains.kotlin.idea.fir.low.level.api.sessions +import com.intellij.openapi.components.service import com.intellij.openapi.project.Project import org.jetbrains.kotlin.fir.BuiltinTypes import org.jetbrains.kotlin.idea.caches.project.ModuleSourceInfo -import org.jetbrains.kotlin.idea.caches.trackers.KotlinModuleOutOfCodeBlockModificationTracker import org.jetbrains.kotlin.idea.fir.low.level.api.FirPhaseRunner import org.jetbrains.kotlin.idea.fir.low.level.api.FirTransformerProvider +import org.jetbrains.kotlin.idea.fir.low.level.api.trackers.KotlinFirOutOfBlockModificationTrackerFactory import org.jetbrains.kotlin.idea.fir.low.level.api.util.executeWithoutPCE import java.util.concurrent.ConcurrentHashMap @@ -102,7 +103,9 @@ private class FromModuleViewSessionCache( private class FirSessionWithModificationTracker( val firSession: FirIdeSourcesSession, ) { - private val modificationTracker = KotlinModuleOutOfCodeBlockModificationTracker(firSession.moduleInfo.module) + private val modificationTracker = firSession.project.service() + .createModuleOutOfBlockModificationTracker(firSession.moduleInfo.module) + private val timeStamp = modificationTracker.modificationCount @Volatile diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTracker.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTracker.kt new file mode 100644 index 00000000000..696fdfe14c4 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTracker.kt @@ -0,0 +1,91 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.fir.low.level.api.trackers + +import com.intellij.ProjectTopics +import com.intellij.lang.ASTNode +import com.intellij.openapi.Disposable +import com.intellij.openapi.module.Module +import com.intellij.openapi.project.Project +import com.intellij.openapi.roots.ModuleRootEvent +import com.intellij.openapi.roots.ModuleRootListener +import com.intellij.pom.PomManager +import com.intellij.pom.PomModelAspect +import com.intellij.pom.event.PomModelEvent +import com.intellij.pom.event.PomModelListener +import com.intellij.pom.tree.TreeAspect +import com.intellij.pom.tree.events.TreeChangeEvent +import org.jetbrains.kotlin.idea.KotlinLanguage +import org.jetbrains.kotlin.idea.fir.low.level.api.element.builder.getNonLocalContainingInBodyDeclarationWith +import org.jetbrains.kotlin.idea.fir.low.level.api.element.builder.getNonLocalContainingOrThisDeclaration +import org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileElementFactory +import org.jetbrains.kotlin.idea.util.module +import org.jetbrains.kotlin.psi.KtNamedFunction +import org.jetbrains.kotlin.psi.psiUtil.isAncestor +import java.util.* + +internal class KotlinFirModificationTrackerService(project: Project) : Disposable { + init { + val model = PomManager.getModel(project) + model.addModelListener(Listener()) + + val connection = project.messageBus.connect(this) + connection.subscribe(ProjectTopics.PROJECT_ROOTS, object : ModuleRootListener { + override fun rootsChanged(event: ModuleRootEvent) { + projectGlobalOutOfBlockInKotlinFilesModificationCount++ + + // todo increase modificationCountForModule + } + }) + } + + internal var projectGlobalOutOfBlockInKotlinFilesModificationCount = 0L + private set + + internal fun getOutOfBlockModificationCountForModules(module: Module): Long = + modificationCountForModule[module] ?: 0L + + private val modificationCountForModule = WeakHashMap() + private val treeAspect = TreeAspect.getInstance(project) + + override fun dispose() {} + + private inner class Listener : PomModelListener { + override fun modelChanged(event: PomModelEvent) { + val changeSet = event.getChangeSet(treeAspect) as TreeChangeEvent? ?: return + if (changeSet.rootElement.psi.language != KotlinLanguage.INSTANCE) return + val changedElements = changeSet.changedElements + + var isOutOfBlockChangeInAnyModule = false + + changedElements.forEach { element -> + val isOutOfBlock = element.isOutOfBlockChange(changeSet) + isOutOfBlockChangeInAnyModule = isOutOfBlockChangeInAnyModule || isOutOfBlock + if (isOutOfBlock) { + element.psi.module?.let { module -> + modificationCountForModule.compute(module) { _, value -> (value ?: 0) + 1 } + } + } + } + + if (isOutOfBlockChangeInAnyModule) { + projectGlobalOutOfBlockInKotlinFilesModificationCount++ + } + } + + private fun ASTNode.isOutOfBlockChange(changeSet: TreeChangeEvent): Boolean { + val nodes = changeSet.getChangesByElement(this).affectedChildren + return nodes.any { node -> + val psi = node.psi ?: return@any true + val container = psi.getNonLocalContainingInBodyDeclarationWith() ?: return@any true + !FileElementFactory.isReanalyzableContainer(container) + } + } + + override fun isAspectChangeInteresting(aspect: PomModelAspect): Boolean = + treeAspect == aspect + } +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTrackerFactory.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTrackerFactory.kt new file mode 100644 index 00000000000..c3e676801d8 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTrackerFactory.kt @@ -0,0 +1,34 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.fir.low.level.api.trackers + +import com.intellij.openapi.components.service +import com.intellij.openapi.module.Module +import com.intellij.openapi.project.Project +import com.intellij.openapi.util.ModificationTracker + +class KotlinFirOutOfBlockModificationTrackerFactory(private val project: Project) { + fun createProjectWideOutOfBlockModificationTracker(): ModificationTracker = + KotlinFirOutOfBlockModificationTracker(project) + + fun createModuleOutOfBlockModificationTracker(module: Module): ModificationTracker = + KotlinFirOutOfBlockModuleModificationTracker(module) + +} + +private class KotlinFirOutOfBlockModificationTracker(project: Project) : ModificationTracker { + private val trackerService = project.service() + + override fun getModificationCount(): Long = + trackerService.projectGlobalOutOfBlockInKotlinFilesModificationCount +} + +private class KotlinFirOutOfBlockModuleModificationTracker(private val module: Module) : ModificationTracker { + private val trackerService = module.project.service() + + override fun getModificationCount(): Long = + trackerService.getOutOfBlockModificationCountForModules(module) +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/localFun.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/localFun.kt new file mode 100644 index 00000000000..af38fb8e029 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/localFun.kt @@ -0,0 +1,5 @@ +fun x() { + fun a() = +} + +// OUT_OF_BLOCK: false diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelExpressionBodyFunWithType.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelExpressionBodyFunWithType.kt new file mode 100644 index 00000000000..b62e4fefa36 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelExpressionBodyFunWithType.kt @@ -0,0 +1,3 @@ +fun foo(): Int = 42 + +// OUT_OF_BLOCK: false diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelExpressionBodyFunWithoutType.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelExpressionBodyFunWithoutType.kt new file mode 100644 index 00000000000..00bc44b5979 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelExpressionBodyFunWithoutType.kt @@ -0,0 +1,3 @@ +fun foo() = 42 + +// OUT_OF_BLOCK: true \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelFunWithType.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelFunWithType.kt new file mode 100644 index 00000000000..93458daa087 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelFunWithType.kt @@ -0,0 +1,6 @@ +fun foo(): Int { + println("") + return 10 +} + +// OUT_OF_BLOCK: false \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelUnitFun.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelUnitFun.kt new file mode 100644 index 00000000000..2e345179be7 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelUnitFun.kt @@ -0,0 +1,5 @@ +fun foo() { + println("") +} + +// OUT_OF_BLOCK: false diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionAnnotation.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionAnnotation.kt new file mode 100644 index 00000000000..c139bb121a2 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionAnnotation.kt @@ -0,0 +1,6 @@ +@Ann +fun foo() { + println("") +} + +// OUT_OF_BLOCK: true diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionAnnotationParameter.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionAnnotationParameter.kt new file mode 100644 index 00000000000..b207535eb5f --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionAnnotationParameter.kt @@ -0,0 +1,6 @@ +@Ann() +fun foo() { + println("") +} + +// OUT_OF_BLOCK: true diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionModifiers.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionModifiers.kt new file mode 100644 index 00000000000..91a064a5b98 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionModifiers.kt @@ -0,0 +1,5 @@ + fun foo() { + println("") +} + +// OUT_OF_BLOCK: true diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionName.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionName.kt new file mode 100644 index 00000000000..b1176d98c1c --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionName.kt @@ -0,0 +1,5 @@ +fun foo() { + println("") +} + +// OUT_OF_BLOCK: true diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionParams.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionParams.kt new file mode 100644 index 00000000000..1498070df38 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionParams.kt @@ -0,0 +1,5 @@ +fun foo() { + println("") +} + +// OUT_OF_BLOCK: true diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionParamsType.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionParamsType.kt new file mode 100644 index 00000000000..bf7f33f6530 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionParamsType.kt @@ -0,0 +1,5 @@ +fun foo(x: In) { + println("") +} + +// OUT_OF_BLOCK: true diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionReturnType.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionReturnType.kt new file mode 100644 index 00000000000..68bf647b51d --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionReturnType.kt @@ -0,0 +1,5 @@ +fun foo(): In { + println("") +} + +// OUT_OF_BLOCK: true diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionTypeParams.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionTypeParams.kt new file mode 100644 index 00000000000..7ea9b3f3cd9 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionTypeParams.kt @@ -0,0 +1,5 @@ +fun >foo() { + println("") +} + +// OUT_OF_BLOCK: true diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractReanalyzableFileStructureElementCreationTest.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractReanalyzableFileStructureElementCreationTest.kt new file mode 100644 index 00000000000..69d35919185 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractReanalyzableFileStructureElementCreationTest.kt @@ -0,0 +1,85 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.fir.low.level.api.file.structure + +import com.intellij.openapi.util.io.FileUtil +import com.intellij.psi.PsiDocumentManager +import com.intellij.psi.util.parentOfType +import junit.framework.Assert +import org.jetbrains.kotlin.idea.fir.low.level.api.FirModuleResolveStateImpl +import org.jetbrains.kotlin.idea.fir.low.level.api.api.FirModuleResolveState +import org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacade +import org.jetbrains.kotlin.idea.search.getKotlinFqName +import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase +import org.jetbrains.kotlin.idea.util.getElementTextInContext +import org.jetbrains.kotlin.psi.KtDeclaration +import org.jetbrains.kotlin.psi.KtElement +import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.test.InTextDirectivesUtils +import java.io.File + +abstract class AbstractReanalyzableFileStructureElementCreationTest : KotlinLightCodeInsightFixtureTestCase() { + override fun isFirPlugin(): Boolean = true + + fun doTest(path: String) { + val testDataFile = File(path) + val initialFileText = FileUtil.loadFile(testDataFile) + val ktFile = myFixture.configureByText(testDataFile.name, initialFileText) as KtFile + val expectedFqName = + InTextDirectivesUtils.findStringWithPrefixes(initialFileText, STRUCTURE_ELEMENT_FQ_NAME_DIRECTIVE) + ?: error("Please specify // STRUCTURE_ELEMENT directive") + val shouldStructureElementBeRecreated = + InTextDirectivesUtils.getPrefixedBoolean(initialFileText, SHOULD_ELEMENT_BE_RECREATED) + ?: error("Please specify // SHOULD_ELEMENT_BE_RECREATED directive") + + val elementAtCaret = ktFile.findElementAtCaret() + val (initialStructureElement, initialFileStructure, initialModuleResolveState) = getStructureElementForKtElement(elementAtCaret) + Assert.assertEquals(expectedFqName, initialStructureElement.psi.getKotlinFqName()?.asString()) + + myFixture.type("hello") + PsiDocumentManager.getInstance(project).commitAllDocuments() + + val newElementAtCaret = ktFile.findElementAtCaret() + val (newStructureElement, newFileStructure, newModuleResolveState) = getStructureElementForKtElement(newElementAtCaret) + Assert.assertEquals( + "Structure elements should be build by the same KtDeclaration's", + expectedFqName, + newStructureElement.psi.getKotlinFqName()?.asString() + ) + Assert.assertTrue("Structure elements should be different after typing", newStructureElement !== initialStructureElement) + Assert.assertEquals( + "FirModuleResolveState should change only of out of block modification", + shouldStructureElementBeRecreated, + newModuleResolveState !== initialModuleResolveState + ) + Assert.assertEquals( + "FileStructure state should change only of out of block modification", + shouldStructureElementBeRecreated, + initialFileStructure !== newFileStructure + ) + } + + private fun KtFile.findElementAtCaret(): KtElement { + val elementAtCaret = findElementAt(myFixture.caretOffset)!!.parentOfType()!! + if (elementAtCaret is KtDeclaration) { + error("Expected element inside declaration but was\n${elementAtCaret.getElementTextInContext()}") + } + return elementAtCaret + } + + private fun getStructureElementForKtElement(element: KtElement): Triple { + val moduleResolveState = LowLevelFirApiFacade.getResolveStateFor(element) as FirModuleResolveStateImpl + val fileStructure = + moduleResolveState.fileStructureCache.getFileStructure(element.containingKtFile, moduleResolveState.rootModuleSession.cache) + val fileStructureElement = fileStructure.getStructureElementFor(element) + return Triple(fileStructureElement, fileStructure, moduleResolveState) + } + + companion object { + private const val STRUCTURE_ELEMENT_FQ_NAME_DIRECTIVE = "// STRUCTURE_ELEMENT:" + private const val SHOULD_ELEMENT_BE_RECREATED = "// SHOULD_ELEMENT_BE_RECREATED:" + } +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/ReanalyzableFileStructureElementCreationTestGenerated.java b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/ReanalyzableFileStructureElementCreationTestGenerated.java new file mode 100644 index 00000000000..9c0d25e4ebe --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/ReanalyzableFileStructureElementCreationTestGenerated.java @@ -0,0 +1,50 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.fir.low.level.api.file.structure; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/elementBuilder") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class ReanalyzableFileStructureElementCreationTestGenerated extends AbstractReanalyzableFileStructureElementCreationTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInElementBuilder() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/elementBuilder"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("topLevelExpressionBodyFunWithType.kt") + public void testTopLevelExpressionBodyFunWithType() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/elementBuilder/topLevelExpressionBodyFunWithType.kt"); + } + + @TestMetadata("topLevelExpressionBodyFunWithoutType.kt") + public void testTopLevelExpressionBodyFunWithoutType() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/elementBuilder/topLevelExpressionBodyFunWithoutType.kt"); + } + + @TestMetadata("topLevelFunWithType.kt") + public void testTopLevelFunWithType() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/elementBuilder/topLevelFunWithType.kt"); + } + + @TestMetadata("topLevelUnitFun.kt") + public void testTopLevelUnitFun() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/elementBuilder/topLevelUnitFun.kt"); + } +} diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/AbstractProjectWideOutOfBlockKotlinModificationTrackerTest.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/AbstractProjectWideOutOfBlockKotlinModificationTrackerTest.kt new file mode 100644 index 00000000000..8c35c487bdf --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/AbstractProjectWideOutOfBlockKotlinModificationTrackerTest.kt @@ -0,0 +1,37 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.fir.low.level.api.trackers + +import com.intellij.openapi.components.service +import com.intellij.openapi.util.io.FileUtil +import com.intellij.psi.PsiDocumentManager +import junit.framework.Assert +import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase +import org.jetbrains.kotlin.test.InTextDirectivesUtils +import java.io.File + +abstract class AbstractProjectWideOutOfBlockKotlinModificationTrackerTest : KotlinLightCodeInsightFixtureTestCase() { + override fun isFirPlugin(): Boolean = true + + fun doTest(path: String) { + val testDataFile = File(path) + val fileText = FileUtil.loadFile(testDataFile) + myFixture.configureByText(testDataFile.name, fileText) + val textToType = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// TYPE:") ?: DEFAULT_TEXT_TO_TYPE + val outOfBlock = InTextDirectivesUtils.getPrefixedBoolean(fileText, "// OUT_OF_BLOCK:") + ?: error("Please, specify should out of block change happen or not by `// OUT_OF_BLOCK:` directive") + val tracker = project.service().createProjectWideOutOfBlockModificationTracker() + val initialModificationCount = tracker.modificationCount + myFixture.type(textToType) + PsiDocumentManager.getInstance(project).commitAllDocuments() + val afterTypingModificationCount = tracker.modificationCount + Assert.assertEquals(outOfBlock, initialModificationCount != afterTypingModificationCount) + } + + companion object { + private const val DEFAULT_TEXT_TO_TYPE = "hello" + } +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/ProjectWideOutOfBlockKotlinModificationTrackerTestGenerated.java b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/ProjectWideOutOfBlockKotlinModificationTrackerTestGenerated.java new file mode 100644 index 00000000000..ae77d2477b6 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/ProjectWideOutOfBlockKotlinModificationTrackerTestGenerated.java @@ -0,0 +1,95 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.fir.low.level.api.trackers; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class ProjectWideOutOfBlockKotlinModificationTrackerTestGenerated extends AbstractProjectWideOutOfBlockKotlinModificationTrackerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInOutOfBlockProjectWide() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("localFun.kt") + public void testLocalFun() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/localFun.kt"); + } + + @TestMetadata("topLevelExpressionBodyFunWithType.kt") + public void testTopLevelExpressionBodyFunWithType() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelExpressionBodyFunWithType.kt"); + } + + @TestMetadata("topLevelExpressionBodyFunWithoutType.kt") + public void testTopLevelExpressionBodyFunWithoutType() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelExpressionBodyFunWithoutType.kt"); + } + + @TestMetadata("topLevelFunWithType.kt") + public void testTopLevelFunWithType() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelFunWithType.kt"); + } + + @TestMetadata("topLevelUnitFun.kt") + public void testTopLevelUnitFun() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelUnitFun.kt"); + } + + @TestMetadata("typeInFunctionAnnotation.kt") + public void testTypeInFunctionAnnotation() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionAnnotation.kt"); + } + + @TestMetadata("typeInFunctionAnnotationParameter.kt") + public void testTypeInFunctionAnnotationParameter() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionAnnotationParameter.kt"); + } + + @TestMetadata("typeInFunctionModifiers.kt") + public void testTypeInFunctionModifiers() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionModifiers.kt"); + } + + @TestMetadata("typeInFunctionName.kt") + public void testTypeInFunctionName() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionName.kt"); + } + + @TestMetadata("typeInFunctionParams.kt") + public void testTypeInFunctionParams() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionParams.kt"); + } + + @TestMetadata("typeInFunctionParamsType.kt") + public void testTypeInFunctionParamsType() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionParamsType.kt"); + } + + @TestMetadata("typeInFunctionReturnType.kt") + public void testTypeInFunctionReturnType() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionReturnType.kt"); + } + + @TestMetadata("typeInFunctionTypeParams.kt") + public void testTypeInFunctionTypeParams() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionTypeParams.kt"); + } +} diff --git a/idea/resources-fir/META-INF/plugin.xml b/idea/resources-fir/META-INF/plugin.xml index fefad5ae0a1..418756c6f64 100644 --- a/idea/resources-fir/META-INF/plugin.xml +++ b/idea/resources-fir/META-INF/plugin.xml @@ -111,7 +111,8 @@ The Kotlin FIR plugin provides language support in IntelliJ IDEA and Android Stu implementationClass="org.jetbrains.kotlin.idea.codeInsight.KotlinHighLevelExpressionTypeProvider"/> - + + From da7b12f7e1013a128ae9a73db68c0786a618d760 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Tue, 3 Nov 2020 23:06:45 +0300 Subject: [PATCH 021/698] FIR IDE: introduce ProjectWideOutOfBlockKotlinModificationTrackerTest --- .../kotlin/generators/tests/GenerateTests.kt | 4 + .../api/element/builder/FirElementBuilder.kt | 13 +++ ...lockModificationTrackerConsistencyTest.kt} | 51 ++++------ ...cationTrackerConsistencyTestGenerated.java | 95 +++++++++++++++++++ ...StructureElementCreationTestGenerated.java | 50 ---------- ...OutOfBlockKotlinModificationTrackerTest.kt | 2 +- 6 files changed, 129 insertions(+), 86 deletions(-) rename idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/{AbstractReanalyzableFileStructureElementCreationTest.kt => AbstractFileStructureAndOutOfBlockModificationTrackerConsistencyTest.kt} (56%) create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureAndOutOfBlockModificationTrackerConsistencyTestGenerated.java delete mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/ReanalyzableFileStructureElementCreationTestGenerated.java diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index ea49712ab5a..7163b3ef307 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -84,6 +84,7 @@ import org.jetbrains.kotlin.idea.fir.AbstractKtDeclarationAndFirDeclarationEqual import org.jetbrains.kotlin.idea.fir.low.level.api.AbstractFirLazyDeclarationResolveTest import org.jetbrains.kotlin.idea.fir.low.level.api.AbstractFirMultiModuleLazyResolveTest import org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.AbstractFileStructureTest +import org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.AbstractFileStructureAndOutOfBlockModificationTrackerConsistencyTest import org.jetbrains.kotlin.idea.folding.AbstractKotlinFoldingTest import org.jetbrains.kotlin.idea.frontend.api.fir.AbstractResolveCallTest import org.jetbrains.kotlin.idea.fir.low.level.api.trackers.AbstractProjectWideOutOfBlockKotlinModificationTrackerTest @@ -1041,6 +1042,9 @@ fun main(args: Array) { testClass { model("outOfBlockProjectWide") } + testClass { + model("outOfBlockProjectWide") + } testClass { model("fileStructure") } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/element/builder/FirElementBuilder.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/element/builder/FirElementBuilder.kt index 7821d2cbe36..9e0d633e5b7 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/element/builder/FirElementBuilder.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/element/builder/FirElementBuilder.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.idea.fir.low.level.api.element.builder import com.intellij.psi.PsiElement +import org.jetbrains.annotations.TestOnly import org.jetbrains.kotlin.fir.FirElement import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver @@ -13,9 +14,11 @@ import org.jetbrains.kotlin.idea.fir.low.level.api.annotations.ThreadSafe import org.jetbrains.kotlin.idea.fir.low.level.api.file.builder.FirFileBuilder import org.jetbrains.kotlin.idea.fir.low.level.api.file.builder.ModuleFileCache import org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructureCache +import org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructureElement import org.jetbrains.kotlin.idea.util.getElementTextInContext import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject +import org.jetbrains.kotlin.psi.psiUtil.isAncestor import org.jetbrains.kotlin.psi2ir.deparenthesize /** @@ -53,6 +56,16 @@ internal class FirElementBuilder { return psi.getFirOfClosestParent(mappings)?.second ?: error("FirElement is not found for:\n${element.getElementTextInContext()}") } + + @TestOnly + fun getStructureElementFor( + element: KtElement, + moduleFileCache: ModuleFileCache, + fileStructureCache: FileStructureCache, + ): FileStructureElement { + val fileStructure = fileStructureCache.getFileStructure(element.containingKtFile, moduleFileCache) + return fileStructure.getStructureElementFor(element) + } } private fun KtElement.getFirOfClosestParent(cache: Map): Pair? { diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractReanalyzableFileStructureElementCreationTest.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureAndOutOfBlockModificationTrackerConsistencyTest.kt similarity index 56% rename from idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractReanalyzableFileStructureElementCreationTest.kt rename to idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureAndOutOfBlockModificationTrackerConsistencyTest.kt index 69d35919185..9e76b38dbc2 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractReanalyzableFileStructureElementCreationTest.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureAndOutOfBlockModificationTrackerConsistencyTest.kt @@ -12,63 +12,49 @@ import junit.framework.Assert import org.jetbrains.kotlin.idea.fir.low.level.api.FirModuleResolveStateImpl import org.jetbrains.kotlin.idea.fir.low.level.api.api.FirModuleResolveState import org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacade -import org.jetbrains.kotlin.idea.search.getKotlinFqName +import org.jetbrains.kotlin.idea.fir.low.level.api.trackers.AbstractProjectWideOutOfBlockKotlinModificationTrackerTest import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase -import org.jetbrains.kotlin.idea.util.getElementTextInContext -import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.test.InTextDirectivesUtils import java.io.File -abstract class AbstractReanalyzableFileStructureElementCreationTest : KotlinLightCodeInsightFixtureTestCase() { +abstract class AbstractFileStructureAndOutOfBlockModificationTrackerConsistencyTest : KotlinLightCodeInsightFixtureTestCase() { override fun isFirPlugin(): Boolean = true fun doTest(path: String) { val testDataFile = File(path) - val initialFileText = FileUtil.loadFile(testDataFile) - val ktFile = myFixture.configureByText(testDataFile.name, initialFileText) as KtFile - val expectedFqName = - InTextDirectivesUtils.findStringWithPrefixes(initialFileText, STRUCTURE_ELEMENT_FQ_NAME_DIRECTIVE) - ?: error("Please specify // STRUCTURE_ELEMENT directive") - val shouldStructureElementBeRecreated = - InTextDirectivesUtils.getPrefixedBoolean(initialFileText, SHOULD_ELEMENT_BE_RECREATED) - ?: error("Please specify // SHOULD_ELEMENT_BE_RECREATED directive") + val fileText = FileUtil.loadFile(testDataFile) + val ktFile = myFixture.configureByText(testDataFile.name, fileText) as KtFile + val textToType = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// TYPE:") + ?: AbstractProjectWideOutOfBlockKotlinModificationTrackerTest.DEFAULT_TEXT_TO_TYPE + val outOfBlock = InTextDirectivesUtils.getPrefixedBoolean(fileText, "// OUT_OF_BLOCK:") + ?: error("Please, specify should out of block change happen or not by `// OUT_OF_BLOCK:` directive") val elementAtCaret = ktFile.findElementAtCaret() val (initialStructureElement, initialFileStructure, initialModuleResolveState) = getStructureElementForKtElement(elementAtCaret) - Assert.assertEquals(expectedFqName, initialStructureElement.psi.getKotlinFqName()?.asString()) - myFixture.type("hello") + myFixture.type(textToType) PsiDocumentManager.getInstance(project).commitAllDocuments() val newElementAtCaret = ktFile.findElementAtCaret() val (newStructureElement, newFileStructure, newModuleResolveState) = getStructureElementForKtElement(newElementAtCaret) - Assert.assertEquals( - "Structure elements should be build by the same KtDeclaration's", - expectedFqName, - newStructureElement.psi.getKotlinFqName()?.asString() - ) Assert.assertTrue("Structure elements should be different after typing", newStructureElement !== initialStructureElement) + Assert.assertEquals( - "FirModuleResolveState should change only of out of block modification", - shouldStructureElementBeRecreated, + "FirModuleResolveState should change only on out of block modification", + outOfBlock, newModuleResolveState !== initialModuleResolveState ) Assert.assertEquals( - "FileStructure state should change only of out of block modification", - shouldStructureElementBeRecreated, + "FileStructure state should change only on out of block modification", + outOfBlock, initialFileStructure !== newFileStructure ) } - private fun KtFile.findElementAtCaret(): KtElement { - val elementAtCaret = findElementAt(myFixture.caretOffset)!!.parentOfType()!! - if (elementAtCaret is KtDeclaration) { - error("Expected element inside declaration but was\n${elementAtCaret.getElementTextInContext()}") - } - return elementAtCaret - } + private fun KtFile.findElementAtCaret(): KtElement = + findElementAt(myFixture.caretOffset)!!.parentOfType()!! private fun getStructureElementForKtElement(element: KtElement): Triple { val moduleResolveState = LowLevelFirApiFacade.getResolveStateFor(element) as FirModuleResolveStateImpl @@ -77,9 +63,4 @@ abstract class AbstractReanalyzableFileStructureElementCreationTest : KotlinLigh val fileStructureElement = fileStructure.getStructureElementFor(element) return Triple(fileStructureElement, fileStructure, moduleResolveState) } - - companion object { - private const val STRUCTURE_ELEMENT_FQ_NAME_DIRECTIVE = "// STRUCTURE_ELEMENT:" - private const val SHOULD_ELEMENT_BE_RECREATED = "// SHOULD_ELEMENT_BE_RECREATED:" - } } \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureAndOutOfBlockModificationTrackerConsistencyTestGenerated.java b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureAndOutOfBlockModificationTrackerConsistencyTestGenerated.java new file mode 100644 index 00000000000..82efa737118 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureAndOutOfBlockModificationTrackerConsistencyTestGenerated.java @@ -0,0 +1,95 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.fir.low.level.api.file.structure; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class FileStructureAndOutOfBlockModificationTrackerConsistencyTestGenerated extends AbstractFileStructureAndOutOfBlockModificationTrackerConsistencyTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInOutOfBlockProjectWide() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("localFun.kt") + public void testLocalFun() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/localFun.kt"); + } + + @TestMetadata("topLevelExpressionBodyFunWithType.kt") + public void testTopLevelExpressionBodyFunWithType() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelExpressionBodyFunWithType.kt"); + } + + @TestMetadata("topLevelExpressionBodyFunWithoutType.kt") + public void testTopLevelExpressionBodyFunWithoutType() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelExpressionBodyFunWithoutType.kt"); + } + + @TestMetadata("topLevelFunWithType.kt") + public void testTopLevelFunWithType() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelFunWithType.kt"); + } + + @TestMetadata("topLevelUnitFun.kt") + public void testTopLevelUnitFun() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelUnitFun.kt"); + } + + @TestMetadata("typeInFunctionAnnotation.kt") + public void testTypeInFunctionAnnotation() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionAnnotation.kt"); + } + + @TestMetadata("typeInFunctionAnnotationParameter.kt") + public void testTypeInFunctionAnnotationParameter() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionAnnotationParameter.kt"); + } + + @TestMetadata("typeInFunctionModifiers.kt") + public void testTypeInFunctionModifiers() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionModifiers.kt"); + } + + @TestMetadata("typeInFunctionName.kt") + public void testTypeInFunctionName() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionName.kt"); + } + + @TestMetadata("typeInFunctionParams.kt") + public void testTypeInFunctionParams() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionParams.kt"); + } + + @TestMetadata("typeInFunctionParamsType.kt") + public void testTypeInFunctionParamsType() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionParamsType.kt"); + } + + @TestMetadata("typeInFunctionReturnType.kt") + public void testTypeInFunctionReturnType() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionReturnType.kt"); + } + + @TestMetadata("typeInFunctionTypeParams.kt") + public void testTypeInFunctionTypeParams() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionTypeParams.kt"); + } +} diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/ReanalyzableFileStructureElementCreationTestGenerated.java b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/ReanalyzableFileStructureElementCreationTestGenerated.java deleted file mode 100644 index 9c0d25e4ebe..00000000000 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/ReanalyzableFileStructureElementCreationTestGenerated.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.fir.low.level.api.file.structure; - -import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; -import org.jetbrains.kotlin.test.KotlinTestUtils; -import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; - -import java.io.File; -import java.util.regex.Pattern; - -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ -@SuppressWarnings("all") -@TestMetadata("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/elementBuilder") -@TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) -public class ReanalyzableFileStructureElementCreationTestGenerated extends AbstractReanalyzableFileStructureElementCreationTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInElementBuilder() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/elementBuilder"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @TestMetadata("topLevelExpressionBodyFunWithType.kt") - public void testTopLevelExpressionBodyFunWithType() throws Exception { - runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/elementBuilder/topLevelExpressionBodyFunWithType.kt"); - } - - @TestMetadata("topLevelExpressionBodyFunWithoutType.kt") - public void testTopLevelExpressionBodyFunWithoutType() throws Exception { - runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/elementBuilder/topLevelExpressionBodyFunWithoutType.kt"); - } - - @TestMetadata("topLevelFunWithType.kt") - public void testTopLevelFunWithType() throws Exception { - runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/elementBuilder/topLevelFunWithType.kt"); - } - - @TestMetadata("topLevelUnitFun.kt") - public void testTopLevelUnitFun() throws Exception { - runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/elementBuilder/topLevelUnitFun.kt"); - } -} diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/AbstractProjectWideOutOfBlockKotlinModificationTrackerTest.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/AbstractProjectWideOutOfBlockKotlinModificationTrackerTest.kt index 8c35c487bdf..c1ec05132c6 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/AbstractProjectWideOutOfBlockKotlinModificationTrackerTest.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/AbstractProjectWideOutOfBlockKotlinModificationTrackerTest.kt @@ -32,6 +32,6 @@ abstract class AbstractProjectWideOutOfBlockKotlinModificationTrackerTest : Kotl } companion object { - private const val DEFAULT_TEXT_TO_TYPE = "hello" + const val DEFAULT_TEXT_TO_TYPE = "hello" } } \ No newline at end of file From 911662bc2f6879425cab16ca2e97c6c1915aea18 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Wed, 4 Nov 2020 11:35:52 +0300 Subject: [PATCH 022/698] FIR IDE: introduce out of block modification tracker tests --- .../level/api/file/structure/FileStructure.kt | 13 +- .../api/file/structure/FileStructureUtil.kt | 18 +++ .../sessions/FirIdeSessionProviderStorage.kt | 2 +- .../KotlinFirOutOfBlockModificationTracker.kt | 69 ++++++--- ...FirOutOfBlockModificationTrackerFactory.kt | 9 +- .../KotlinModuleOutOfBlockTrackerTest.kt | 131 ++++++++++++++++++ 6 files changed, 208 insertions(+), 34 deletions(-) create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureUtil.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinModuleOutOfBlockTrackerTest.kt diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructure.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructure.kt index f194d1a79f4..c74ed471c86 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructure.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructure.kt @@ -13,7 +13,9 @@ import org.jetbrains.kotlin.idea.fir.low.level.api.file.builder.ModuleFileCache import org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver import org.jetbrains.kotlin.idea.fir.low.level.api.providers.firIdeProvider import org.jetbrains.kotlin.idea.fir.low.level.api.util.findSourceNonLocalFirDeclaration +import org.jetbrains.kotlin.idea.search.getKotlinFqName import org.jetbrains.kotlin.idea.util.getElementTextInContext +import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject import org.jetbrains.kotlin.psi.psiUtil.forEachDescendantOfType @@ -57,7 +59,7 @@ internal class FileStructure( ktFile.forEachDescendantOfType( canGoInside = { psi -> psi !is KtFunction && psi !is KtValVarKeywordOwner } ) { declaration -> - if (declaration.isStructureElementContainer()) { + if (FileStructureUtil.isStructureElementContainer(declaration)) { add(declaration) } } @@ -104,12 +106,3 @@ internal class FileStructure( else -> error("Invalid container $container") } } - -private fun KtDeclaration.isStructureElementContainer(): Boolean { - if (this !is KtClassOrObject && this !is KtDeclarationWithBody && this !is KtProperty && this !is KtTypeAlias) return false - if (this is KtEnumEntry) return false - if (containingClassOrObject is KtEnumEntry) return false - return !KtPsiUtil.isLocal(this) -} - - diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureUtil.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureUtil.kt new file mode 100644 index 00000000000..d3f7b1bd765 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureUtil.kt @@ -0,0 +1,18 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.fir.low.level.api.file.structure + +import org.jetbrains.kotlin.psi.* +import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject + +internal object FileStructureUtil { + fun isStructureElementContainer(ktDeclaration: KtDeclaration): Boolean = when { + ktDeclaration !is KtClassOrObject && ktDeclaration !is KtDeclarationWithBody && ktDeclaration !is KtProperty && ktDeclaration !is KtTypeAlias -> false + ktDeclaration is KtEnumEntry -> false + ktDeclaration.containingClassOrObject is KtEnumEntry -> false + else -> !KtPsiUtil.isLocal(ktDeclaration) + } +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/FirIdeSessionProviderStorage.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/FirIdeSessionProviderStorage.kt index 6c84e5ceb3d..1c11d3e546c 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/FirIdeSessionProviderStorage.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/FirIdeSessionProviderStorage.kt @@ -104,7 +104,7 @@ private class FirSessionWithModificationTracker( val firSession: FirIdeSourcesSession, ) { private val modificationTracker = firSession.project.service() - .createModuleOutOfBlockModificationTracker(firSession.moduleInfo.module) + .createModuleWithoutDependenciesOutOfBlockModificationTracker(firSession.moduleInfo.module) private val timeStamp = modificationTracker.modificationCount diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTracker.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTracker.kt index 696fdfe14c4..3a39f7f7250 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTracker.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTracker.kt @@ -20,40 +20,42 @@ import com.intellij.pom.tree.TreeAspect import com.intellij.pom.tree.events.TreeChangeEvent import org.jetbrains.kotlin.idea.KotlinLanguage import org.jetbrains.kotlin.idea.fir.low.level.api.element.builder.getNonLocalContainingInBodyDeclarationWith -import org.jetbrains.kotlin.idea.fir.low.level.api.element.builder.getNonLocalContainingOrThisDeclaration import org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileElementFactory import org.jetbrains.kotlin.idea.util.module -import org.jetbrains.kotlin.psi.KtNamedFunction -import org.jetbrains.kotlin.psi.psiUtil.isAncestor -import java.util.* internal class KotlinFirModificationTrackerService(project: Project) : Disposable { init { - val model = PomManager.getModel(project) - model.addModelListener(Listener()) + PomManager.getModel(project).addModelListener(Listener()) - val connection = project.messageBus.connect(this) - connection.subscribe(ProjectTopics.PROJECT_ROOTS, object : ModuleRootListener { - override fun rootsChanged(event: ModuleRootEvent) { - projectGlobalOutOfBlockInKotlinFilesModificationCount++ - - // todo increase modificationCountForModule + project.messageBus.connect(this).subscribe( + ProjectTopics.PROJECT_ROOTS, + object : ModuleRootListener { + override fun rootsChanged(event: ModuleRootEvent) = increaseModificationCountForAllModules() } - }) + ) } - internal var projectGlobalOutOfBlockInKotlinFilesModificationCount = 0L + var projectGlobalOutOfBlockInKotlinFilesModificationCount = 0L private set - internal fun getOutOfBlockModificationCountForModules(module: Module): Long = - modificationCountForModule[module] ?: 0L + private val moduleModificationsState = ModuleModificationsState() + + fun getOutOfBlockModificationCountForModules(module: Module): Long = + moduleModificationsState.getModificationsCountForModule(module) - private val modificationCountForModule = WeakHashMap() private val treeAspect = TreeAspect.getInstance(project) override fun dispose() {} + private fun increaseModificationCountForAllModules() { + projectGlobalOutOfBlockInKotlinFilesModificationCount++ + moduleModificationsState.increaseModificationCountForAllModules() + } + private inner class Listener : PomModelListener { + override fun isAspectChangeInteresting(aspect: PomModelAspect): Boolean = + treeAspect == aspect + override fun modelChanged(event: PomModelEvent) { val changeSet = event.getChangeSet(treeAspect) as TreeChangeEvent? ?: return if (changeSet.rootElement.psi.language != KotlinLanguage.INSTANCE) return @@ -66,7 +68,7 @@ internal class KotlinFirModificationTrackerService(project: Project) : Disposabl isOutOfBlockChangeInAnyModule = isOutOfBlockChangeInAnyModule || isOutOfBlock if (isOutOfBlock) { element.psi.module?.let { module -> - modificationCountForModule.compute(module) { _, value -> (value ?: 0) + 1 } + moduleModificationsState.increaseModificationCountForModule(module) } } } @@ -84,8 +86,33 @@ internal class KotlinFirModificationTrackerService(project: Project) : Disposabl !FileElementFactory.isReanalyzableContainer(container) } } - - override fun isAspectChangeInteresting(aspect: PomModelAspect): Boolean = - treeAspect == aspect } +} + +private class ModuleModificationsState { + private val modificationCountForModule = hashMapOf() + private var state: Long = 0L + + fun getModificationsCountForModule(module: Module) = modificationCountForModule.compute(module) { _, modifications -> + when { + modifications == null -> ModuleModifications(0, state) + modifications.state == state -> modifications + else -> ModuleModifications(modificationsCount = modifications.modificationsCount + 1, state = state) + } + }!!.modificationsCount + + fun increaseModificationCountForAllModules() { + state++ + } + + fun increaseModificationCountForModule(module: Module) { + modificationCountForModule.compute(module) { _, modifications -> + when (modifications) { + null -> ModuleModifications(0, state) + else -> ModuleModifications(ModuleModifications(0, state).modificationsCount + 1, state) + } + } + } + + private data class ModuleModifications(val modificationsCount: Long, val state: Long) } \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTrackerFactory.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTrackerFactory.kt index c3e676801d8..0444cf44ff9 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTrackerFactory.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTrackerFactory.kt @@ -14,11 +14,16 @@ class KotlinFirOutOfBlockModificationTrackerFactory(private val project: Project fun createProjectWideOutOfBlockModificationTracker(): ModificationTracker = KotlinFirOutOfBlockModificationTracker(project) - fun createModuleOutOfBlockModificationTracker(module: Module): ModificationTracker = + fun createModuleWithoutDependenciesOutOfBlockModificationTracker(module: Module): ModificationTracker = KotlinFirOutOfBlockModuleModificationTracker(module) - } +fun Project.createProjectWideOutOfBlockModificationTracker() = + service().createProjectWideOutOfBlockModificationTracker() + +fun Module.createModuleWithoutDependenciesOutOfBlockModificationTracker() = + project.service().createModuleWithoutDependenciesOutOfBlockModificationTracker(this) + private class KotlinFirOutOfBlockModificationTracker(project: Project) : ModificationTracker { private val trackerService = project.service() diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinModuleOutOfBlockTrackerTest.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinModuleOutOfBlockTrackerTest.kt new file mode 100644 index 00000000000..af6a808c70c --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinModuleOutOfBlockTrackerTest.kt @@ -0,0 +1,131 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.fir.low.level.api.trackers + +import com.intellij.openapi.command.WriteCommandAction +import com.intellij.openapi.module.Module +import com.intellij.openapi.vfs.LocalFileSystem +import com.intellij.openapi.vfs.VirtualFileManager +import com.intellij.psi.PsiDocumentManager +import com.intellij.psi.PsiManager +import com.intellij.testFramework.PsiTestUtil +import junit.framework.Assert +import org.jetbrains.kotlin.idea.stubs.AbstractMultiModuleTest +import org.jetbrains.kotlin.idea.util.application.runWriteAction +import org.jetbrains.kotlin.idea.util.rootManager +import org.jetbrains.kotlin.idea.util.sourceRoots +import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.psi.KtNamedFunction +import java.nio.file.Files +import kotlin.io.path.ExperimentalPathApi +import kotlin.io.path.writeText + +class KotlinModuleOutOfBlockTrackerTest : AbstractMultiModuleTest() { + override fun getTestDataPath(): String = error("Should not be called") + + fun testThatModuleOutOfBlockChangeInfluenceOnlySingleModule() { + val moduleA = createModuleWithModificationTracker("a") { + listOf( + FileWithText("main.kt", "fun main() = 10") + ) + } + val moduleB = createModuleWithModificationTracker("b") + val moduleC = createModuleWithModificationTracker("c") + + + val moduleAWithTracker = ModuleWithModificationTracker(moduleA) + val moduleBWithTracker = ModuleWithModificationTracker(moduleB) + val moduleCWithTracker = ModuleWithModificationTracker(moduleC) + + moduleA.typeInFunctionBody("main.kt", textAfterTyping = "fun main() = hello10") + + Assert.assertTrue( + "Out of block modification count for module A with out of block should change after typing, modification count is ${moduleAWithTracker.modificationCount}", + moduleAWithTracker.changed() + ) + Assert.assertFalse( + "Out of block modification count for module B without out of block should not change after typing, modification count is ${moduleBWithTracker.modificationCount}", + moduleBWithTracker.changed() + ) + Assert.assertFalse( + "Out of block modification count for module C without out of block should not change after typing, modification count is ${moduleCWithTracker.modificationCount}", + moduleCWithTracker.changed() + ) + } + + fun testThatInEveryModuleOutOfBlockWillHappenAfterContentRootChange() { + val moduleA = createModuleWithModificationTracker("a") + val moduleB = createModuleWithModificationTracker("b") + val moduleC = createModuleWithModificationTracker("c") + + val moduleAWithTracker = ModuleWithModificationTracker(moduleA) + val moduleBWithTracker = ModuleWithModificationTracker(moduleB) + val moduleCWithTracker = ModuleWithModificationTracker(moduleC) + + runWriteAction { + moduleA.sourceRoots.first().createChildData(/* requestor = */ null, "file.kt") + } + + Assert.assertTrue( + "Out of block modification count for module A should change after content root change, modification count is ${moduleAWithTracker.modificationCount}", + moduleAWithTracker.changed() + ) + Assert.assertTrue( + "Out of block modification count for module B should change after content root change, modification count is ${moduleBWithTracker.modificationCount}", + moduleBWithTracker.changed() + ) + Assert.assertTrue( + "Out of block modification count for module C should change after content root change modification count is ${moduleCWithTracker.modificationCount}", + moduleCWithTracker.changed() + ) + } + + private fun Module.typeInFunctionBody(fileName: String, textAfterTyping: String) { + val file = "${sourceRoots.first().url}/$fileName" + val virtualFile = VirtualFileManager.getInstance().findFileByUrl(file)!! + val ktFile = PsiManager.getInstance(project).findFile(virtualFile) as KtFile + configureByExistingFile(virtualFile) + + val singleFunction = ktFile.declarations.single() as KtNamedFunction + + editor.caretModel.moveToOffset(singleFunction.bodyExpression!!.textOffset) + type("hello") + PsiDocumentManager.getInstance(project).commitAllDocuments() + Assert.assertEquals(textAfterTyping, ktFile.text) + } + + @OptIn(ExperimentalPathApi::class) + private fun createModuleWithModificationTracker( + name: String, + createFiles: () -> List = { emptyList() }, + ): Module { + val tmpDir = createTempDirectory().toPath() + createFiles().forEach { file -> + Files.createFile(tmpDir.resolve(file.name)).writeText(file.text) + } + val module: Module = createModule("$tmpDir/$name", moduleType) + val root = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(tmpDir.toFile())!! + WriteCommandAction.writeCommandAction(module.project).run { + root.refresh(false, true) + } + + PsiTestUtil.addSourceContentToRoots(module, root) + return module + } + + private data class FileWithText(val name: String, val text: String) + + private class ModuleWithModificationTracker(module: Module) { + private val modificationTracker = module.createModuleWithoutDependenciesOutOfBlockModificationTracker() + private val initialModificationCount = modificationTracker.modificationCount + + val modificationCount: Long + get() = modificationTracker.modificationCount + + fun changed(): Boolean = + modificationTracker.modificationCount != initialModificationCount + } +} \ No newline at end of file From b01ee163d11a1463e2daedafd7acb8bc10d70f73 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Wed, 4 Nov 2020 16:57:16 +0300 Subject: [PATCH 023/698] FIR IDE: wrap KotlinDeserializedJvmSymbolsProvider into thread safe cache This is needed by the two reasons: - KotlinDeserializedJvmSymbolsProvider does not cache all symbols by itself and as KtSymbol's holds fir elements under via weak refs, this weak refs may be garbage collected - KotlinDeserializedJvmSymbolsProvider is not thread safe --- .../low/level/api/annotations/annotations.kt | 2 +- .../FirThreadSafeSymbolProviderWrapper.kt | 69 +++++++++++++++++++ .../api/sessions/FirIdeSessionFactory.kt | 19 ++--- 3 files changed, 81 insertions(+), 9 deletions(-) create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/providers/FirThreadSafeSymbolProviderWrapper.kt diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/annotations/annotations.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/annotations/annotations.kt index 5c9cae1a483..1ed083947d0 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/annotations/annotations.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/annotations/annotations.kt @@ -5,6 +5,6 @@ package org.jetbrains.kotlin.idea.fir.low.level.api.annotations -@Target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR) +@Target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.CLASS) @RequiresOptIn annotation class PrivateForInline \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/providers/FirThreadSafeSymbolProviderWrapper.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/providers/FirThreadSafeSymbolProviderWrapper.kt new file mode 100644 index 00000000000..8a1302623e9 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/providers/FirThreadSafeSymbolProviderWrapper.kt @@ -0,0 +1,69 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.fir.low.level.api.providers + +import org.jetbrains.kotlin.fir.resolve.providers.FirSymbolProvider +import org.jetbrains.kotlin.fir.resolve.providers.FirSymbolProviderInternals +import org.jetbrains.kotlin.fir.symbols.CallableId +import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol +import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol +import org.jetbrains.kotlin.idea.fir.low.level.api.annotations.PrivateForInline +import org.jetbrains.kotlin.name.ClassId +import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.Name +import java.util.concurrent.locks.ReadWriteLock +import java.util.concurrent.locks.ReentrantReadWriteLock +import kotlin.concurrent.withLock + +internal class FirThreadSafeSymbolProviderWrapper(private val provider: FirSymbolProvider) : FirSymbolProvider(provider.session) { + private val lock = ReentrantReadWriteLock() + private val classesCache = ThreadSafeCache>(lock) + private val topLevelCache = ThreadSafeCache>>(lock) + private val packages = ThreadSafeCache(lock) + + override fun getClassLikeSymbolByFqName(classId: ClassId): FirClassLikeSymbol<*>? = + classesCache.getOrCompute(classId) { + provider.getClassLikeSymbolByFqName(classId) + } + + override fun getTopLevelCallableSymbols(packageFqName: FqName, name: Name): List> = + topLevelCache.getOrCompute(CallableId(packageFqName, name)) { + provider.getTopLevelCallableSymbols(packageFqName, name) + } ?: emptyList() + + @FirSymbolProviderInternals + override fun getTopLevelCallableSymbolsTo(destination: MutableList>, packageFqName: FqName, name: Name) { + error("Should not be called for wrapper") + } + + override fun getPackage(fqName: FqName): FqName? = + packages.getOrCompute(fqName) { provider.getPackage(fqName) } +} + +private class ThreadSafeCache(private val lock: ReadWriteLock) { + private val map = HashMap() + + @OptIn(PrivateForInline::class) + inline fun getOrCompute(key: KEY, compute: () -> VALUE?): VALUE? { + var value = lock.readLock().withLock { map[key] } + if (value == null) { + lock.writeLock().withLock { + value = compute() ?: NULLABLE_VALUE + map[key] = value!! + } + } + @Suppress("UNCHECKED_CAST") + return when (value) { + NULLABLE_VALUE -> null + null -> error("We should not read null from map here") + else -> value as VALUE + } + } +} + +@Suppress("ClassName") +@PrivateForInline +internal object NULLABLE_VALUE \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/FirIdeSessionFactory.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/FirIdeSessionFactory.kt index 99394ee786c..84379f87c22 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/FirIdeSessionFactory.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/FirIdeSessionFactory.kt @@ -38,6 +38,7 @@ import org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarati import org.jetbrains.kotlin.idea.fir.low.level.api.providers.FirModuleWithDependenciesSymbolProvider import org.jetbrains.kotlin.idea.fir.low.level.api.providers.FirIdeProvider import org.jetbrains.kotlin.idea.fir.low.level.api.sessions.FirIdeSessionFactory.registerIdeComponents +import org.jetbrains.kotlin.idea.fir.low.level.api.providers.FirThreadSafeSymbolProviderWrapper import org.jetbrains.kotlin.idea.fir.low.level.api.util.ModuleLibrariesSearchScope import org.jetbrains.kotlin.idea.fir.low.level.api.util.checkCanceled import org.jetbrains.kotlin.load.java.JavaClassFinderImpl @@ -160,14 +161,16 @@ internal object FirIdeSessionFactory { this, buildList { add( - KotlinDeserializedJvmSymbolsProvider( - this@apply, - project, - packagePartProvider, - javaSymbolProvider, - kotlinClassFinder, - javaClassFinder, - kotlinScopeProvider + FirThreadSafeSymbolProviderWrapper( + KotlinDeserializedJvmSymbolsProvider( + this@apply, + project, + packagePartProvider, + javaSymbolProvider, + kotlinClassFinder, + javaClassFinder, + kotlinScopeProvider + ) ) ) add(javaSymbolProvider) From e54d16e7e44cad48b641c3fe1dd1d86195e370aa Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Wed, 4 Nov 2020 18:22:26 +0300 Subject: [PATCH 024/698] FIR IDE: fix fir declaration leak in symbols --- .../frontend/api/fir/symbols/KtFirAnonymousFunctionSymbol.kt | 4 ++-- .../idea/frontend/api/fir/symbols/KtFirClassOrObjectSymbol.kt | 4 ++-- .../idea/frontend/api/fir/symbols/KtFirConstructorSymbol.kt | 2 +- .../api/fir/symbols/KtFirConstructorValueParameterSymbol.kt | 2 +- .../idea/frontend/api/fir/symbols/KtFirEnumEntrySymbol.kt | 2 +- .../idea/frontend/api/fir/symbols/KtFirFunctionSymbol.kt | 2 +- .../api/fir/symbols/KtFirFunctionValueParameterSymbol.kt | 2 +- .../idea/frontend/api/fir/symbols/KtFirJavaFieldSymbol.kt | 2 +- .../idea/frontend/api/fir/symbols/KtFirLocalVariableSymbol.kt | 2 +- .../frontend/api/fir/symbols/KtFirPropertyGetterSymbol.kt | 2 +- .../frontend/api/fir/symbols/KtFirPropertySetterSymbol.kt | 2 +- .../idea/frontend/api/fir/symbols/KtFirPropertySymbol.kt | 2 +- .../frontend/api/fir/symbols/KtFirSetterParameterSymbol.kt | 2 +- .../idea/frontend/api/fir/symbols/KtFirTypeAliasSymbol.kt | 2 +- 14 files changed, 16 insertions(+), 16 deletions(-) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirAnonymousFunctionSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirAnonymousFunctionSymbol.kt index 630ff263d9e..12cf18b7d51 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirAnonymousFunctionSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirAnonymousFunctionSymbol.kt @@ -26,10 +26,10 @@ internal class KtFirAnonymousFunctionSymbol( private val builder: KtSymbolByFirBuilder ) : KtAnonymousFunctionSymbol(), KtFirSymbol { override val firRef = firRef(fir, resolveState) - override val psi: PsiElement? by firRef.withFirAndCache { it.findPsi(fir.session) } + override val psi: PsiElement? by firRef.withFirAndCache { fir -> fir.findPsi(fir.session) } override val type: KtType by firRef.withFirAndCache(FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE) { builder.buildKtType(it.returnTypeRef) } - override val valueParameters: List by firRef.withFirAndCache { + override val valueParameters: List by firRef.withFirAndCache { fir -> fir.valueParameters.map { valueParameter -> check(valueParameter is FirValueParameterImpl) builder.buildParameterSymbol(valueParameter) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirClassOrObjectSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirClassOrObjectSymbol.kt index 260aaf1ee64..f3dc94d8ac8 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirClassOrObjectSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirClassOrObjectSymbol.kt @@ -34,7 +34,7 @@ internal class KtFirClassOrObjectSymbol( private val builder: KtSymbolByFirBuilder ) : KtClassOrObjectSymbol(), KtFirSymbol { override val firRef = firRef(fir, resolveState) - override val psi: PsiElement? by firRef.withFirAndCache { it.findPsi(fir.session) } + override val psi: PsiElement? by firRef.withFirAndCache { fir -> fir.findPsi(fir.session) } override val name: Name get() = firRef.withFir { it.symbol.classId.shortClassName } override val classIdIfNonLocal: ClassId? get() = firRef.withFir { fir -> @@ -64,7 +64,7 @@ internal class KtFirClassOrObjectSymbol( fir.getPrimaryConstructorIfAny()?.let { builder.buildConstructorSymbol(it) } } - override val typeParameters by firRef.withFirAndCache { + override val typeParameters by firRef.withFirAndCache { fir -> fir.typeParameters.map { typeParameter -> builder.buildTypeParameterSymbol(typeParameter.symbol.fir) } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirConstructorSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirConstructorSymbol.kt index 85d45402697..70b96dee051 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirConstructorSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirConstructorSymbol.kt @@ -37,7 +37,7 @@ internal class KtFirConstructorSymbol( private val builder: KtSymbolByFirBuilder ) : KtConstructorSymbol(), KtFirSymbol { override val firRef = firRef(fir, resolveState) - override val psi: PsiElement? by firRef.withFirAndCache { it.findPsi(fir.session) } + override val psi: PsiElement? by firRef.withFirAndCache { fir -> fir.findPsi(fir.session) } override val type: KtType by firRef.withFirAndCache(FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE) { builder.buildKtType(it.returnTypeRef) } override val valueParameters: List by firRef.withFirAndCache { fir -> diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirConstructorValueParameterSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirConstructorValueParameterSymbol.kt index adb1a91d205..181879eabfe 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirConstructorValueParameterSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirConstructorValueParameterSymbol.kt @@ -29,7 +29,7 @@ internal class KtFirConstructorValueParameterSymbol( private val builder: KtSymbolByFirBuilder ) : KtConstructorParameterSymbol(), KtFirSymbol { override val firRef = firRef(fir, resolveState) - override val psi: PsiElement? by firRef.withFirAndCache { it.findPsi(fir.session) } + override val psi: PsiElement? by firRef.withFirAndCache { fir -> fir.findPsi(fir.session) } override val name: Name get() = firRef.withFir { it.name } override val type: KtType by firRef.withFirAndCache(FirResolvePhase.TYPES) { builder.buildKtType(it.returnTypeRef) } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirEnumEntrySymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirEnumEntrySymbol.kt index 981efd4e959..c0ad5ffef65 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirEnumEntrySymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirEnumEntrySymbol.kt @@ -30,7 +30,7 @@ internal class KtFirEnumEntrySymbol( private val builder: KtSymbolByFirBuilder ) : KtEnumEntrySymbol(), KtFirSymbol { override val firRef = firRef(fir, resolveState) - override val psi: PsiElement? by firRef.withFirAndCache { it.findPsi(fir.session) } + override val psi: PsiElement? by firRef.withFirAndCache { fir -> fir.findPsi(fir.session) } override val name: Name get() = firRef.withFir { it.name } override val type: KtType by firRef.withFirAndCache(FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE) { fir -> builder.buildKtType(fir.returnTypeRef) } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirFunctionSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirFunctionSymbol.kt index eb8a8af7429..3988cb6c273 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirFunctionSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirFunctionSymbol.kt @@ -36,7 +36,7 @@ internal class KtFirFunctionSymbol( private val builder: KtSymbolByFirBuilder ) : KtFunctionSymbol(), KtFirSymbol { override val firRef = firRef(fir, resolveState) - override val psi: PsiElement? by firRef.withFirAndCache { it.findPsi(fir.session) } + override val psi: PsiElement? by firRef.withFirAndCache { fir -> fir.findPsi(fir.session) } override val name: Name get() = firRef.withFir { it.name } override val type: KtType by firRef.withFirAndCache(FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE) { fir -> builder.buildKtType(fir.returnTypeRef) } override val valueParameters: List by firRef.withFirAndCache { fir -> diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirFunctionValueParameterSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirFunctionValueParameterSymbol.kt index b85dbee8886..a2516c1f75c 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirFunctionValueParameterSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirFunctionValueParameterSymbol.kt @@ -28,7 +28,7 @@ internal class KtFirFunctionValueParameterSymbol( private val builder: KtSymbolByFirBuilder ) : KtFunctionParameterSymbol(), KtFirSymbol { override val firRef = firRef(fir, resolveState) - override val psi: PsiElement? by firRef.withFirAndCache { it.findPsi(fir.session) } + override val psi: PsiElement? by firRef.withFirAndCache { fir -> fir.findPsi(fir.session) } override val name: Name get() = firRef.withFir { it.name } override val isVararg: Boolean get() = firRef.withFir { it.isVararg } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirJavaFieldSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirJavaFieldSymbol.kt index bcf8db8941e..09eeb8e1d13 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirJavaFieldSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirJavaFieldSymbol.kt @@ -28,7 +28,7 @@ internal class KtFirJavaFieldSymbol( private val builder: KtSymbolByFirBuilder ) : KtJavaFieldSymbol(), KtFirSymbol { override val firRef = firRef(fir, resolveState) - override val psi: PsiElement? by firRef.withFirAndCache { it.findPsi(fir.session) } + override val psi: PsiElement? by firRef.withFirAndCache { fir -> fir.findPsi(fir.session) } override val type: KtType by firRef.withFirAndCache(FirResolvePhase.TYPES) { fir -> builder.buildKtType(fir.returnTypeRef) } override val isVal: Boolean get() = firRef.withFir { it.isVal } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirLocalVariableSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirLocalVariableSymbol.kt index 28d81333081..2ce16c8211c 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirLocalVariableSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirLocalVariableSymbol.kt @@ -34,7 +34,7 @@ internal class KtFirLocalVariableSymbol( } override val firRef = firRef(fir, resolveState) - override val psi: PsiElement? by cached { fir.findPsi(fir.session) } + override val psi: PsiElement? by firRef.withFirAndCache { fir -> fir.findPsi(fir.session) } override val isVal: Boolean get() = firRef.withFir { it.isVal } override val name: Name get() = firRef.withFir { it.name } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertyGetterSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertyGetterSymbol.kt index bde81cb4585..f414881c400 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertyGetterSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertyGetterSymbol.kt @@ -34,7 +34,7 @@ internal class KtFirPropertyGetterSymbol( } override val firRef = firRef(fir, resolveState) - override val psi: PsiElement? by firRef.withFirAndCache { it.findPsi(fir.session) } + override val psi: PsiElement? by firRef.withFirAndCache { fir -> fir.findPsi(fir.session) } override val isDefault: Boolean get() = firRef.withFir { it is FirDefaultPropertyAccessor } override val isInline: Boolean get() = firRef.withFir { it.isInline } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySetterSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySetterSymbol.kt index 2391d3582c6..b7bcc2894ad 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySetterSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySetterSymbol.kt @@ -34,7 +34,7 @@ internal class KtFirPropertySetterSymbol( } override val firRef = firRef(fir, resolveState) - override val psi: PsiElement? by firRef.withFirAndCache { it.findPsi(fir.session) } + override val psi: PsiElement? by firRef.withFirAndCache { fir -> fir.findPsi(fir.session) } override val isDefault: Boolean get() = firRef.withFir { it is FirDefaultPropertyAccessor } override val isInline: Boolean get() = firRef.withFir { it.isInline } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySymbol.kt index c9f93e7623a..639b2cee62e 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySymbol.kt @@ -41,7 +41,7 @@ internal class KtFirPropertySymbol( } override val firRef = firRef(fir, resolveState) - override val psi: PsiElement? by firRef.withFirAndCache { it.findPsi(fir.session) } + override val psi: PsiElement? by firRef.withFirAndCache { fir -> fir.findPsi(fir.session) } override val isVal: Boolean get() = firRef.withFir { it.isVal } override val name: Name get() = firRef.withFir { it.name } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirSetterParameterSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirSetterParameterSymbol.kt index 9f87a37ef16..798b0d5b957 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirSetterParameterSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirSetterParameterSymbol.kt @@ -28,7 +28,7 @@ internal class KtFirSetterParameterSymbol( private val builder: KtSymbolByFirBuilder ) : KtSetterParameterSymbol(), KtFirSymbol { override val firRef = firRef(fir, resolveState) - override val psi: PsiElement? by firRef.withFirAndCache { it.findPsi(fir.session) } + override val psi: PsiElement? by firRef.withFirAndCache { fir -> fir.findPsi(fir.session) } override val name: Name get() = firRef.withFir { it.name } override val type: KtType by firRef.withFirAndCache(FirResolvePhase.TYPES) { fir -> builder.buildKtType(fir.returnTypeRef) } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirTypeAliasSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirTypeAliasSymbol.kt index 65010b720e4..d4a93efcb01 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirTypeAliasSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirTypeAliasSymbol.kt @@ -23,7 +23,7 @@ internal class KtFirTypeAliasSymbol( override val token: ValidityToken ) : KtTypeAliasSymbol(), KtFirSymbol { override val firRef = firRef(fir, resolveState) - override val psi: PsiElement? by firRef.withFirAndCache { it.findPsi(fir.session) } + override val psi: PsiElement? by firRef.withFirAndCache { fir -> fir.findPsi(fir.session) } override val name: Name get() = firRef.withFir { it.name } override val classIdIfNonLocal: ClassId get() = firRef.withFir { it.symbol.classId } From e78e26234bd31434b798a185890e2d6251c869c4 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 5 Nov 2020 08:33:59 +0300 Subject: [PATCH 025/698] FIR IDE: do not store cone session in every KtFirType --- .../KotlinFirCompletionContributor.kt | 18 ++++---- .../KotlinFirLookupElementFactory.kt | 16 +++---- .../idea/frontend/api/KtAnalysisSession.kt | 7 ++- .../frontend/api/components/KtTypeProvider.kt | 6 +++ .../kotlin/idea/frontend/api/types/KtType.kt | 5 --- .../frontend/api/fir/KtSymbolByFirBuilder.kt | 19 +++----- .../api/fir/components/KtFirTypeProvider.kt | 44 ++++++++++++++++--- .../idea/frontend/api/fir/types/FirKtType.kt | 36 --------------- 8 files changed, 74 insertions(+), 77 deletions(-) diff --git a/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/KotlinFirCompletionContributor.kt b/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/KotlinFirCompletionContributor.kt index 58c610c2b4f..da11845cfd8 100644 --- a/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/KotlinFirCompletionContributor.kt +++ b/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/KotlinFirCompletionContributor.kt @@ -67,9 +67,9 @@ private class KotlinAvailableScopesCompletionProvider(prefixMatcher: PrefixMatch private val scopeNameFilter: KtScopeNameFilter = { name -> !name.isSpecial && prefixMatcher.prefixMatches(name.identifier) } - private fun CompletionResultSet.addSymbolToCompletion(symbol: KtSymbol) { + private fun KtAnalysisSession.addSymbolToCompletion(completionResultSet: CompletionResultSet, symbol: KtSymbol) { if (symbol !is KtNamedSymbol) return - lookupElementFactory.createLookupElement(symbol)?.let(::addElement) + with(lookupElementFactory) { createLookupElement(symbol)?.let(completionResultSet::addElement) } } private fun recordOriginalFile(completionParameters: CompletionParameters) { @@ -103,9 +103,9 @@ private class KotlinAvailableScopesCompletionProvider(prefixMatcher: PrefixMatch } } - private fun collectTypesCompletion(result: CompletionResultSet, implicitScopes: KtScope) { + private fun KtAnalysisSession.collectTypesCompletion(result: CompletionResultSet, implicitScopes: KtScope) { val availableClasses = implicitScopes.getClassifierSymbols(scopeNameFilter) - availableClasses.forEach { result.addSymbolToCompletion(it) } + availableClasses.forEach { addSymbolToCompletion(result, it) } } private fun KtAnalysisSession.collectDotCompletion( @@ -125,11 +125,11 @@ private class KotlinAvailableScopesCompletionProvider(prefixMatcher: PrefixMatch .getCallableSymbols(scopeNameFilter) .filter { it.isExtension && it.hasSuitableExtensionReceiver() } - nonExtensionMembers.forEach { result.addSymbolToCompletion(it) } - extensionNonMembers.forEach { result.addSymbolToCompletion(it) } + nonExtensionMembers.forEach { addSymbolToCompletion(result, it) } + extensionNonMembers.forEach { addSymbolToCompletion(result, it) } } - private fun collectDefaultCompletion( + private fun KtAnalysisSession.collectDefaultCompletion( result: CompletionResultSet, implicitScopes: KtCompositeScope, hasSuitableExtensionReceiver: KtCallableSymbol.() -> Boolean, @@ -142,8 +142,8 @@ private class KotlinAvailableScopesCompletionProvider(prefixMatcher: PrefixMatch .getCallableSymbols(scopeNameFilter) .filter { it.isExtension && it.hasSuitableExtensionReceiver() } - availableNonExtensions.forEach { result.addSymbolToCompletion(it) } - extensionsWhichCanBeCalled.forEach { result.addSymbolToCompletion(it) } + availableNonExtensions.forEach { addSymbolToCompletion(result, it) } + extensionsWhichCanBeCalled.forEach { addSymbolToCompletion(result, it) } collectTypesCompletion(result, implicitScopes) } diff --git a/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/KotlinFirLookupElementFactory.kt b/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/KotlinFirLookupElementFactory.kt index 2f44fe463a2..8c676f0760e 100644 --- a/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/KotlinFirLookupElementFactory.kt +++ b/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/KotlinFirLookupElementFactory.kt @@ -14,9 +14,9 @@ import com.intellij.codeInsight.lookup.LookupElementBuilder import com.intellij.openapi.diagnostic.ControlFlowException import com.intellij.openapi.diagnostic.logger import com.intellij.openapi.editor.Document -import com.intellij.openapi.progress.ProcessCanceledException import com.intellij.openapi.util.TextRange import com.intellij.psi.PsiElement +import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession import org.jetbrains.kotlin.idea.frontend.api.symbols.* import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtNamedSymbol import org.jetbrains.kotlin.idea.frontend.api.types.KtType @@ -33,9 +33,9 @@ internal class KotlinFirLookupElementFactory { private val functionLookupElementFactory = FunctionLookupElementFactory() private val typeParameterLookupElementFactory = TypeParameterLookupElementFactory() - fun createLookupElement(symbol: KtNamedSymbol): LookupElement? { + fun KtAnalysisSession.createLookupElement(symbol: KtNamedSymbol): LookupElement? { val elementBuilder = when (symbol) { - is KtFunctionSymbol -> functionLookupElementFactory.createLookup(symbol) + is KtFunctionSymbol -> with(functionLookupElementFactory) { createLookup(symbol) } is KtVariableLikeSymbol -> variableLookupElementFactory.createLookup(symbol) is KtClassLikeSymbol -> classLookupElementFactory.createLookup(symbol) is KtTypeParameterSymbol -> typeParameterLookupElementFactory.createLookup(symbol) @@ -78,7 +78,7 @@ private class VariableLookupElementFactory { } private class FunctionLookupElementFactory { - fun createLookup(symbol: KtFunctionSymbol): LookupElementBuilder? { + fun KtAnalysisSession.createLookup(symbol: KtFunctionSymbol): LookupElementBuilder? { return try { LookupElementBuilder.create(UniqueLookupObject(), symbol.name.asString()) .withTailText(getTailText(symbol), true) @@ -91,16 +91,16 @@ private class FunctionLookupElementFactory { } } - private fun getTailText(symbol: KtFunctionSymbol): String { + private fun KtAnalysisSession.getTailText(symbol: KtFunctionSymbol): String { return if (insertLambdaBraces(symbol)) " {...}" else ShortNamesRenderer.renderFunctionParameters(symbol) } - private fun insertLambdaBraces(symbol: KtFunctionSymbol): Boolean { + private fun KtAnalysisSession.insertLambdaBraces(symbol: KtFunctionSymbol): Boolean { val singleParam = symbol.valueParameters.singleOrNull() - return singleParam != null && !singleParam.hasDefaultValue && singleParam.type.isBuiltInFunctionalType + return singleParam != null && !singleParam.hasDefaultValue && singleParam.type.isBuiltInFunctionalType() } - private fun createInsertHandler(symbol: KtFunctionSymbol): InsertHandler { + private fun KtAnalysisSession.createInsertHandler(symbol: KtFunctionSymbol): InsertHandler { return FunctionInsertionHandler( symbol.name, inputValueArguments = symbol.valueParameters.isNotEmpty(), diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt index f9126a548fd..fc3f520b03c 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt @@ -5,7 +5,6 @@ package org.jetbrains.kotlin.idea.frontend.api -import com.intellij.psi.PsiElement import org.jetbrains.kotlin.diagnostics.Diagnostic import org.jetbrains.kotlin.idea.frontend.api.components.* import org.jetbrains.kotlin.idea.frontend.api.scopes.* @@ -58,6 +57,12 @@ abstract class KtAnalysisSession(override val token: ValidityToken) : ValidityTo fun KtDeclaration.getReturnKtType(): KtType = typeProvider.getReturnTypeForKtDeclaration(this) + fun KtType.isEqualTo(other: KtType): Boolean = typeProvider.isEqualTo(this, other) + + fun KtType.isSubTypeOf(superType: KtType): Boolean = typeProvider.isSubTypeOf(this, superType) + + fun KtType.isBuiltInFunctionalType(): Boolean = typeProvider.isBuiltinFunctionalType(this) + fun KtElement.getDiagnostics(): Collection = diagnosticProvider.getDiagnosticsForElement(this) fun KtFile.collectDiagnosticsForFile(): Collection = diagnosticProvider.collectDiagnosticsForFile(this) diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtTypeProvider.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtTypeProvider.kt index eb3f0d1ae46..36656610719 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtTypeProvider.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtTypeProvider.kt @@ -12,4 +12,10 @@ import org.jetbrains.kotlin.psi.KtExpression abstract class KtTypeProvider : KtAnalysisSessionComponent() { abstract fun getReturnTypeForKtDeclaration(declaration: KtDeclaration): KtType abstract fun getKtExpressionType(expression: KtExpression): KtType + + abstract fun isEqualTo(first: KtType, second: KtType): Boolean + abstract fun isSubTypeOf(subType: KtType, superType: KtType): Boolean + + //TODO get rid of + abstract fun isBuiltinFunctionalType(type: KtType): Boolean } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/types/KtType.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/types/KtType.kt index fdcb0f6c7f6..56bffaa6994 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/types/KtType.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/types/KtType.kt @@ -14,11 +14,6 @@ import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.Name interface KtType : ValidityTokenOwner { - fun isEqualTo(other: KtType): Boolean - fun isSubTypeOf(superType: KtType): Boolean - - val isBuiltInFunctionalType: Boolean - fun asStringForDebugging(): String } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtSymbolByFirBuilder.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtSymbolByFirBuilder.kt index 28d2d106bfb..d60723bac4c 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtSymbolByFirBuilder.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtSymbolByFirBuilder.kt @@ -43,13 +43,7 @@ internal class KtSymbolByFirBuilder private constructor( private val symbolsCache: BuilderCache, private val typesCache: BuilderCache ) : ValidityTokenOwner { - private val typeCheckerContext by threadLocal { - ConeTypeCheckerContext( - isErrorTypeEqualsToAnything = true, - isStubTypeEqualsToAnything = true, - resolveState.rootModuleSession - ) - } + private val resolveState by weakRef(resolveState) private val firProvider get() = resolveState.rootModuleSession.firSymbolProvider @@ -66,7 +60,6 @@ internal class KtSymbolByFirBuilder private constructor( typesCache = BuilderCache() ) - private val resolveState by weakRef(resolveState) fun createReadOnlyCopy(newResolveState: FirModuleResolveState): KtSymbolByFirBuilder { check(!withReadOnlyCaching) { "Cannot create readOnly KtSymbolByFirBuilder from a readonly one" } @@ -197,11 +190,11 @@ internal class KtSymbolByFirBuilder private constructor( fun buildKtType(coneType: ConeKotlinType): KtType = typesCache.cache(coneType) { when (coneType) { - is ConeClassLikeTypeImpl -> KtFirClassType(coneType, typeCheckerContext, token, this) - is ConeTypeParameterType -> KtFirTypeParameterType(coneType, typeCheckerContext, token, this) - is ConeClassErrorType -> KtFirErrorType(coneType, typeCheckerContext, token) - is ConeFlexibleType -> KtFirFlexibleType(coneType, typeCheckerContext, token, this) - is ConeIntersectionType -> KtFirIntersectionType(coneType, typeCheckerContext, token, this) + is ConeClassLikeTypeImpl -> KtFirClassType(coneType, token, this) + is ConeTypeParameterType -> KtFirTypeParameterType(coneType, token, this) + is ConeClassErrorType -> KtFirErrorType(coneType, token) + is ConeFlexibleType -> KtFirFlexibleType(coneType, token, this) + is ConeIntersectionType -> KtFirIntersectionType(coneType, token, this) is ConeDefinitelyNotNullType -> buildKtType(coneType.original) else -> TODO(coneType::class.toString()) } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirTypeProvider.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirTypeProvider.kt index 84599adae44..6c13627ed92 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirTypeProvider.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirTypeProvider.kt @@ -7,20 +7,21 @@ package org.jetbrains.kotlin.idea.frontend.api.fir.components import org.jetbrains.kotlin.fir.declarations.FirCallableDeclaration import org.jetbrains.kotlin.fir.expressions.FirExpression -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcast -import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression +import org.jetbrains.kotlin.fir.resolve.inference.isBuiltinFunctionalType +import org.jetbrains.kotlin.fir.types.ConeTypeCheckerContext import org.jetbrains.kotlin.fir.types.coneType import org.jetbrains.kotlin.idea.fir.low.level.api.api.getOrBuildFirOfType -import org.jetbrains.kotlin.idea.frontend.api.ImplicitReceiverSmartCast -import org.jetbrains.kotlin.idea.frontend.api.ImplicitReceiverSmartcastKind import org.jetbrains.kotlin.idea.frontend.api.ValidityToken -import org.jetbrains.kotlin.idea.frontend.api.components.KtSmartCastProvider +import org.jetbrains.kotlin.idea.frontend.api.assertIsValid import org.jetbrains.kotlin.idea.frontend.api.components.KtTypeProvider import org.jetbrains.kotlin.idea.frontend.api.fir.KtFirAnalysisSession +import org.jetbrains.kotlin.idea.frontend.api.fir.types.KtFirType import org.jetbrains.kotlin.idea.frontend.api.types.KtType import org.jetbrains.kotlin.idea.frontend.api.withValidityAssertion import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.psi.KtExpression +import org.jetbrains.kotlin.types.AbstractTypeChecker +import org.jetbrains.kotlin.types.AbstractTypeCheckerContext internal class KtFirTypeProvider( override val analysisSession: KtFirAnalysisSession, @@ -34,4 +35,37 @@ internal class KtFirTypeProvider( override fun getKtExpressionType(expression: KtExpression): KtType = withValidityAssertion { expression.getOrBuildFirOfType(firResolveState).typeRef.coneType.asKtType() } + + override fun isEqualTo(first: KtType, second: KtType): Boolean = withValidityAssertion { + second.assertIsValid() + check(first is KtFirType) + check(second is KtFirType) + return AbstractTypeChecker.equalTypes( + this.createTypeCheckerContext() as AbstractTypeCheckerContext, + first.coneType, + second.coneType + ) + } + + override fun isSubTypeOf(subType: KtType, superType: KtType): Boolean = withValidityAssertion { + superType.assertIsValid() + check(subType is KtFirType) + check(superType is KtFirType) + return AbstractTypeChecker.isSubtypeOf( + this.createTypeCheckerContext() as AbstractTypeCheckerContext, + subType.coneType, + superType.coneType + ) + } + + override fun isBuiltinFunctionalType(type: KtType): Boolean = withValidityAssertion { + check(type is KtFirType) + type.coneType.isBuiltinFunctionalType(analysisSession.firResolveState.rootModuleSession) //TODO use correct session here + } + + private fun createTypeCheckerContext() = ConeTypeCheckerContext( + isErrorTypeEqualsToAnything = true, + isStubTypeEqualsToAnything = true, + analysisSession.firResolveState.rootModuleSession //TODO use correct session here + ) } \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/types/FirKtType.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/types/FirKtType.kt index 5bcb267cfae..b163dac78ce 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/types/FirKtType.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/types/FirKtType.kt @@ -18,47 +18,19 @@ import org.jetbrains.kotlin.idea.frontend.api.symbols.KtTypeParameterSymbol import org.jetbrains.kotlin.idea.frontend.api.types.* import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.types.AbstractTypeChecker -import org.jetbrains.kotlin.types.AbstractTypeCheckerContext internal interface KtFirType : KtType, ValidityTokenOwner { val coneType: ConeKotlinType - val typeCheckerContext: ConeTypeCheckerContext override fun asStringForDebugging(): String = withValidityAssertion { coneType.render() } - - override fun isEqualTo(other: KtType): Boolean = withValidityAssertion { - other.assertIsValid() - check(other is KtFirType) - return AbstractTypeChecker.equalTypes( - typeCheckerContext as AbstractTypeCheckerContext, - coneType, - other.coneType - ) - } - - override fun isSubTypeOf(superType: KtType): Boolean = withValidityAssertion { - superType.assertIsValid() - check(superType is KtFirType) - return AbstractTypeChecker.isSubtypeOf( - typeCheckerContext as AbstractTypeCheckerContext, - coneType, - superType.coneType - ) - } - - override val isBuiltInFunctionalType: Boolean - get() = coneType.isBuiltinFunctionalType(typeCheckerContext.session) } internal class KtFirClassType( coneType: ConeClassLikeTypeImpl, - typeCheckerContext: ConeTypeCheckerContext, override val token: ValidityToken, private val firBuilder: KtSymbolByFirBuilder, ) : KtClassType(), KtFirType { override val coneType by weakRef(coneType) - override val typeCheckerContext by weakRef(typeCheckerContext) override val classId: ClassId get() = withValidityAssertion { coneType.lookupTag.classId } override val classSymbol: KtClassLikeSymbol by cached { @@ -79,23 +51,19 @@ internal class KtFirClassType( internal class KtFirErrorType( coneType: ConeClassErrorType, - typeCheckerContext: ConeTypeCheckerContext, override val token: ValidityToken, ) : KtErrorType(), KtFirType { override val coneType by weakRef(coneType) - override val typeCheckerContext by weakRef(typeCheckerContext) override val error: String get() = withValidityAssertion { coneType.diagnostic.reason } } internal class KtFirTypeParameterType( coneType: ConeTypeParameterType, - typeCheckerContext: ConeTypeCheckerContext, override val token: ValidityToken, private val firBuilder: KtSymbolByFirBuilder, ) : KtTypeParameterType(), KtFirType { override val coneType by weakRef(coneType) - override val typeCheckerContext by weakRef(typeCheckerContext) override val name: Name get() = withValidityAssertion { coneType.lookupTag.name } override val symbol: KtTypeParameterSymbol by cached { @@ -112,12 +80,10 @@ internal class KtFirTypeParameterType( internal class KtFirFlexibleType( coneType: ConeFlexibleType, - typeCheckerContext: ConeTypeCheckerContext, override val token: ValidityToken, private val firBuilder: KtSymbolByFirBuilder, ) : KtFlexibleType(), KtFirType { override val coneType by weakRef(coneType) - override val typeCheckerContext by weakRef(typeCheckerContext) override val lowerBound: KtType by cached { firBuilder.buildKtType(coneType.lowerBound) } override val upperBound: KtType by cached { firBuilder.buildKtType(coneType.upperBound) } @@ -125,12 +91,10 @@ internal class KtFirFlexibleType( internal class KtFirIntersectionType( coneType: ConeIntersectionType, - typeCheckerContext: ConeTypeCheckerContext, override val token: ValidityToken, private val firBuilder: KtSymbolByFirBuilder, ) : KtIntersectionType(), KtFirType { override val coneType by weakRef(coneType) - override val typeCheckerContext by weakRef(typeCheckerContext) override val conjuncts: List by cached { coneType.intersectedTypes.map { conjunct -> firBuilder.buildKtType(conjunct) } From 11e94c1de1c7805823d58bde8a81c4bafd7d82a0 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 5 Nov 2020 08:52:21 +0300 Subject: [PATCH 026/698] FIR IDE: fix building of local declaration symbols --- .../level/api/FirModuleResolveStateImpl.kt | 4 ++ .../symbolsByPsi/localDeclarations.kt | 69 +++++++++++++++++++ .../SymbolsByPsiBuildingTestGenerated.java | 5 ++ 3 files changed, 78 insertions(+) create mode 100644 idea/idea-frontend-fir/testData/symbolsByPsi/localDeclarations.kt diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/FirModuleResolveStateImpl.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/FirModuleResolveStateImpl.kt index 3ffdd11f705..9ff93bb26a1 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/FirModuleResolveStateImpl.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/FirModuleResolveStateImpl.kt @@ -97,6 +97,10 @@ internal class FirModuleResolveStateImpl( rootModuleSession.firIdeProvider.symbolProvider, sessionProvider.getModuleCache(ktDeclaration.getModuleInfo() as ModuleSourceInfo) ) + if (container.resolvePhase < FirResolvePhase.BODY_RESOLVE) { + val cache = (container.session as FirIdeSourcesSession).cache + firLazyDeclarationResolver.lazyResolveDeclaration(container, cache, FirResolvePhase.BODY_RESOLVE, checkPCE = false /*TODO*/) + } val firDeclaration = FirElementFinder.findElementIn(container) { firDeclaration -> firDeclaration.psi == ktDeclaration } diff --git a/idea/idea-frontend-fir/testData/symbolsByPsi/localDeclarations.kt b/idea/idea-frontend-fir/testData/symbolsByPsi/localDeclarations.kt new file mode 100644 index 00000000000..1eb884277e7 --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbolsByPsi/localDeclarations.kt @@ -0,0 +1,69 @@ +fun yyy() { + val q = 10 + fun aaa() {} + + class F {} +} + +// SYMBOLS: +/* +KtFirLocalVariableSymbol: + isVal: true + name: q + origin: SOURCE + symbolKind: LOCAL + type: kotlin/Int + +KtFirFunctionSymbol: + annotations: [] + callableIdIfNonLocal: null + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: aaa + origin: SOURCE + receiverType: null + symbolKind: LOCAL + type: kotlin/Unit + typeParameters: [] + valueParameters: [] + visibility: LOCAL + +KtFirClassOrObjectSymbol: + annotations: [] + classIdIfNonLocal: null + classKind: CLASS + companionObject: null + isInner: false + modality: FINAL + name: F + origin: SOURCE + primaryConstructor: KtFirConstructorSymbol() + superTypes: [kotlin/Any] + symbolKind: LOCAL + typeParameters: [] + visibility: LOCAL + +KtFirFunctionSymbol: + annotations: [] + callableIdIfNonLocal: yyy + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: yyy + origin: SOURCE + receiverType: null + symbolKind: TOP_LEVEL + type: kotlin/Unit + typeParameters: [] + valueParameters: [] + visibility: PUBLIC +*/ diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/SymbolsByPsiBuildingTestGenerated.java b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/SymbolsByPsiBuildingTestGenerated.java index c9c56fa67b1..fa7930de2e2 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/SymbolsByPsiBuildingTestGenerated.java +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/SymbolsByPsiBuildingTestGenerated.java @@ -67,4 +67,9 @@ public class SymbolsByPsiBuildingTestGenerated extends AbstractSymbolsByPsiBuild public void testImplicitReturn() throws Exception { runTest("idea/idea-frontend-fir/testData/symbolsByPsi/implicitReturn.kt"); } + + @TestMetadata("localDeclarations.kt") + public void testLocalDeclarations() throws Exception { + runTest("idea/idea-frontend-fir/testData/symbolsByPsi/localDeclarations.kt"); + } } From 15277c097492255d93a23247f12bae4e10d6cdc1 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 5 Nov 2020 08:53:18 +0300 Subject: [PATCH 027/698] FIR IDE: introduce memory leak checking in symbols test --- .../kotlin/generators/tests/GenerateTests.kt | 9 ++- .../KotlinFirOutOfBlockModificationTracker.kt | 7 ++ ...FirOutOfBlockModificationTrackerFactory.kt | 6 ++ .../api/fir/KtFirAnalysisSessionProvider.kt | 5 ++ .../EntityWasGarbageCollectedException.kt | 10 +++ .../api/fir/utils/FirRefWithValidityCheck.kt | 12 +-- .../testData/symbolMemoryLeak/symbols.kt | 28 +++++++ .../AbstractMemoryLeakInSymbolsTest.kt | 73 +++++++++++++++++++ .../MemoryLeakInSymbolsTestGenerated.java | 35 +++++++++ 9 files changed, 175 insertions(+), 10 deletions(-) create mode 100644 idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/EntityWasGarbageCollectedException.kt create mode 100644 idea/idea-frontend-fir/testData/symbolMemoryLeak/symbols.kt create mode 100644 idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/AbstractMemoryLeakInSymbolsTest.kt create mode 100644 idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/MemoryLeakInSymbolsTestGenerated.java diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index 7163b3ef307..f2c688a2d36 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -89,10 +89,7 @@ import org.jetbrains.kotlin.idea.folding.AbstractKotlinFoldingTest import org.jetbrains.kotlin.idea.frontend.api.fir.AbstractResolveCallTest import org.jetbrains.kotlin.idea.fir.low.level.api.trackers.AbstractProjectWideOutOfBlockKotlinModificationTrackerTest import org.jetbrains.kotlin.idea.frontend.api.scopes.AbstractMemberScopeByFqNameTest -import org.jetbrains.kotlin.idea.frontend.api.symbols.AbstractSymbolFromLibraryPointerRestoreTest -import org.jetbrains.kotlin.idea.frontend.api.symbols.AbstractSymbolsByFqNameBuildingTest -import org.jetbrains.kotlin.idea.frontend.api.symbols.AbstractSymbolFromSourcePointerRestoreTest -import org.jetbrains.kotlin.idea.frontend.api.symbols.AbstractSymbolsByPsiBuildingTest +import org.jetbrains.kotlin.idea.frontend.api.symbols.* import org.jetbrains.kotlin.idea.hierarchy.AbstractHierarchyTest import org.jetbrains.kotlin.idea.hierarchy.AbstractHierarchyWithLibTest import org.jetbrains.kotlin.idea.highlighter.* @@ -1020,6 +1017,10 @@ fun main(args: Array) { testClass { model("resoreSymbolFromLibrary", extension = "txt") } + + testClass { + model("symbolMemoryLeak") + } } testGroup("idea/idea-frontend-fir/idea-fir-low-level-api/tests", "idea/testData") { diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTracker.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTracker.kt index 3a39f7f7250..0b253e5ec27 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTracker.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTracker.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.idea.fir.low.level.api.trackers import com.intellij.ProjectTopics import com.intellij.lang.ASTNode import com.intellij.openapi.Disposable +import com.intellij.openapi.components.service import com.intellij.openapi.module.Module import com.intellij.openapi.project.Project import com.intellij.openapi.roots.ModuleRootEvent @@ -18,6 +19,7 @@ import com.intellij.pom.event.PomModelEvent import com.intellij.pom.event.PomModelListener import com.intellij.pom.tree.TreeAspect import com.intellij.pom.tree.events.TreeChangeEvent +import org.jetbrains.annotations.TestOnly import org.jetbrains.kotlin.idea.KotlinLanguage import org.jetbrains.kotlin.idea.fir.low.level.api.element.builder.getNonLocalContainingInBodyDeclarationWith import org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileElementFactory @@ -52,6 +54,11 @@ internal class KotlinFirModificationTrackerService(project: Project) : Disposabl moduleModificationsState.increaseModificationCountForAllModules() } + @TestOnly + fun incrementModificationsCount() { + increaseModificationCountForAllModules() + } + private inner class Listener : PomModelListener { override fun isAspectChangeInteresting(aspect: PomModelAspect): Boolean = treeAspect == aspect diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTrackerFactory.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTrackerFactory.kt index 0444cf44ff9..28d090422e4 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTrackerFactory.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTrackerFactory.kt @@ -9,6 +9,7 @@ import com.intellij.openapi.components.service import com.intellij.openapi.module.Module import com.intellij.openapi.project.Project import com.intellij.openapi.util.ModificationTracker +import org.jetbrains.annotations.TestOnly class KotlinFirOutOfBlockModificationTrackerFactory(private val project: Project) { fun createProjectWideOutOfBlockModificationTracker(): ModificationTracker = @@ -16,6 +17,11 @@ class KotlinFirOutOfBlockModificationTrackerFactory(private val project: Project fun createModuleWithoutDependenciesOutOfBlockModificationTracker(module: Module): ModificationTracker = KotlinFirOutOfBlockModuleModificationTracker(module) + + @TestOnly + fun incrementModificationsCount() { + project.service().incrementModificationsCount() + } } fun Project.createProjectWideOutOfBlockModificationTracker() = diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSessionProvider.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSessionProvider.kt index 7474896a19b..01c28dc1a79 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSessionProvider.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSessionProvider.kt @@ -42,4 +42,9 @@ internal class KtFirAnalysisSessionProvider(project: Project) : KtAnalysisSessio analysisSessionByModuleInfoCache.value.getOrPut(firModuleResolveState.moduleInfo) { KtFirAnalysisSession.createAnalysisSessionByResolveState(firModuleResolveState) } + + @TestOnly + fun clearCaches() { + analysisSessionByModuleInfoCache.value.clear() + } } \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/EntityWasGarbageCollectedException.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/EntityWasGarbageCollectedException.kt new file mode 100644 index 00000000000..0f70622df82 --- /dev/null +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/EntityWasGarbageCollectedException.kt @@ -0,0 +1,10 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.frontend.api.fir.utils + +internal class EntityWasGarbageCollectedException(entity: String) : IllegalStateException() { + override val message: String = "$entity was garbage collected while KtAnalysisSession session is still valid" +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/FirRefWithValidityCheck.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/FirRefWithValidityCheck.kt index a32a49740b2..da29a8264ea 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/FirRefWithValidityCheck.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/FirRefWithValidityCheck.kt @@ -21,9 +21,9 @@ internal class FirRefWithValidityCheck(fir: D, resolveState: inline fun withFir(phase: FirResolvePhase = FirResolvePhase.RAW_FIR, crossinline action: (fir: D) -> R): R { token.assertIsValid() val fir = firWeakRef.get() - ?: error("FirElement was garbage collected while analysis session is still valid") - val resolveState = - resolveStateWeakRef.get() ?: error("FirModuleResolveState was garbage collected while analysis session is still valid") + ?: throw EntityWasGarbageCollectedException("FirElement") + val resolveState = resolveStateWeakRef.get() + ?: throw EntityWasGarbageCollectedException("FirModuleResolveState") LowLevelFirApiFacade.resolvedFirToPhase(fir, phase, resolveState) return resolveState.withFirDeclaration(fir) { action(it) } } @@ -31,9 +31,9 @@ internal class FirRefWithValidityCheck(fir: D, resolveState: inline fun withFirResolvedToBodyResolve(action: (fir: D) -> R): R { token.assertIsValid() val fir = firWeakRef.get() - ?: error("FirElement was garbage collected while analysis session is still valid") - val resolveState = - resolveStateWeakRef.get() ?: error("FirModuleResolveState was garbage collected while analysis session is still valid") + ?: throw EntityWasGarbageCollectedException("FirElement") + val resolveState = resolveStateWeakRef.get() + ?: throw EntityWasGarbageCollectedException("FirModuleResolveState") LowLevelFirApiFacade.resolvedFirToPhase(fir, FirResolvePhase.BODY_RESOLVE, resolveState) return action(resolveState.withFirDeclaration(fir) { it }) } diff --git a/idea/idea-frontend-fir/testData/symbolMemoryLeak/symbols.kt b/idea/idea-frontend-fir/testData/symbolMemoryLeak/symbols.kt new file mode 100644 index 00000000000..442c10530d5 --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbolMemoryLeak/symbols.kt @@ -0,0 +1,28 @@ +fun x(p: R): Int { + +} + +class Y { + fun a() = 1 +} + +var z: Int + get = 10 + set(value) {} + +object Q + +val z: String = "" + +fun yyy() { +// val q = 10 +// fun aaa() {} +// +// class F {} +} + +typealias Str = String + +interface I { + fun str(): String +} diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/AbstractMemoryLeakInSymbolsTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/AbstractMemoryLeakInSymbolsTest.kt new file mode 100644 index 00000000000..ead4321986f --- /dev/null +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/AbstractMemoryLeakInSymbolsTest.kt @@ -0,0 +1,73 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.frontend.api.symbols + +import com.intellij.openapi.components.service +import com.intellij.openapi.util.io.FileUtil +import junit.framework.Assert +import org.jetbrains.kotlin.idea.executeOnPooledThreadInReadAction +import org.jetbrains.kotlin.idea.fir.low.level.api.trackers.KotlinFirOutOfBlockModificationTrackerFactory +import org.jetbrains.kotlin.idea.frontend.api.InvalidWayOfUsingAnalysisSession +import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSessionProvider +import org.jetbrains.kotlin.idea.frontend.api.analyze +import org.jetbrains.kotlin.idea.frontend.api.fir.KtFirAnalysisSessionProvider +import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirSymbol +import org.jetbrains.kotlin.idea.frontend.api.fir.utils.EntityWasGarbageCollectedException +import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase +import org.jetbrains.kotlin.psi.KtDeclaration +import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.psi.psiUtil.collectDescendantsOfType +import java.io.File + +abstract class AbstractMemoryLeakInSymbolsTest : KotlinLightCodeInsightFixtureTestCase() { + override fun isFirPlugin() = true + + protected fun doTest(path: String) { + val testDataFile = File(path) + val ktFile = myFixture.configureByText(testDataFile.name, FileUtil.loadFile(testDataFile)) as KtFile + val symbols = executeOnPooledThreadInReadAction { + analyze(ktFile) { + ktFile.collectDescendantsOfType().map { it.getSymbol() } + } + } + + invalidateAllCaches(ktFile) + System.gc() + + val leakedSymbols = executeOnPooledThreadInReadAction { + symbols.map { it.hasNoFirElementLeak() }.filterIsInstance() + } + if (leakedSymbols.isNotEmpty()) { + Assert.fail( + """The following symbols leaked (${leakedSymbols.size}/${symbols.size}) + ${leakedSymbols.joinToString(separator = "\n") { it.symbol }} + """.trimIndent() + ) + } + } + + @OptIn(InvalidWayOfUsingAnalysisSession::class) + private fun invalidateAllCaches(ktFile: KtFile) { + project.service().incrementModificationsCount() + (project.service() as KtFirAnalysisSessionProvider).clearCaches() + executeOnPooledThreadInReadAction { analyze(ktFile) {} } + } + + private fun KtSymbol.hasNoFirElementLeak(): LeakCheckResult { + require(this is KtFirSymbol<*>) + return try { + firRef.withFir { LeakCheckResult.Leak(this::class.simpleName!!) } + } catch (_: EntityWasGarbageCollectedException) { + LeakCheckResult.NoLeak + } + } + + private sealed class LeakCheckResult { + object NoLeak : LeakCheckResult() + data class Leak(val symbol: String) : LeakCheckResult() + } +} + diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/MemoryLeakInSymbolsTestGenerated.java b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/MemoryLeakInSymbolsTestGenerated.java new file mode 100644 index 00000000000..ed8ef8de4a2 --- /dev/null +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/MemoryLeakInSymbolsTestGenerated.java @@ -0,0 +1,35 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.frontend.api.symbols; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("idea/idea-frontend-fir/testData/symbolMemoryLeak") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class MemoryLeakInSymbolsTestGenerated extends AbstractMemoryLeakInSymbolsTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInSymbolMemoryLeak() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/testData/symbolMemoryLeak"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("symbols.kt") + public void testSymbols() throws Exception { + runTest("idea/idea-frontend-fir/testData/symbolMemoryLeak/symbols.kt"); + } +} From ff7857a8123648fc6b262e13c4464ec7452ec65c Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 5 Nov 2020 08:54:37 +0300 Subject: [PATCH 028/698] FIR IDE: refactor, simplify structure element class names --- .../low/level/api/file/structure/FileElementFactory.kt | 6 +++--- .../fir/low/level/api/file/structure/FileStructure.kt | 5 +---- .../level/api/file/structure/FileStructureElement.kt | 10 +++++----- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileElementFactory.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileElementFactory.kt index 70ca1ec7398..d06478a7833 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileElementFactory.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileElementFactory.kt @@ -21,14 +21,14 @@ internal object FileElementFactory { firFile: FirFile, ): FileStructureElement = when { ktDeclaration is KtNamedFunction && ktDeclaration.name != null && ktDeclaration.hasExplicitTypeOrUnit -> - IncrementallyReanalyzableFunction( + ReanalyzableFunctionStructureElement( firFile, ktDeclaration, (firDeclaration as FirSimpleFunction).symbol, ktDeclaration.modificationStamp ) - else -> NonLocalDeclarationFileStructureElement( + else -> NonReanalyzableDeclarationStructureElement( firFile, firDeclaration, ktDeclaration, @@ -45,6 +45,6 @@ internal object FileElementFactory { else -> false } - val KtNamedFunction.hasExplicitTypeOrUnit + private val KtNamedFunction.hasExplicitTypeOrUnit get() = hasBlockBody() || typeReference != null } \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructure.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructure.kt index c74ed471c86..586b1e8fe9e 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructure.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructure.kt @@ -13,11 +13,8 @@ import org.jetbrains.kotlin.idea.fir.low.level.api.file.builder.ModuleFileCache import org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver import org.jetbrains.kotlin.idea.fir.low.level.api.providers.firIdeProvider import org.jetbrains.kotlin.idea.fir.low.level.api.util.findSourceNonLocalFirDeclaration -import org.jetbrains.kotlin.idea.search.getKotlinFqName import org.jetbrains.kotlin.idea.util.getElementTextInContext -import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject import org.jetbrains.kotlin.psi.psiUtil.forEachDescendantOfType import java.util.concurrent.ConcurrentHashMap @@ -97,7 +94,7 @@ internal class FileStructure( FirResolvePhase.IMPORTS, checkPCE = true ) - FileWithoutDeclarationsFileStructureElement( + RootStructureElement( firFile, container, ) diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureElement.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureElement.kt index ce9e23a2cbc..ebbc8a6f04e 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureElement.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureElement.kt @@ -64,7 +64,7 @@ internal sealed class ReanalyzableStructureElement : FileStr } } -internal class IncrementallyReanalyzableFunction( +internal class ReanalyzableFunctionStructureElement( override val firFile: FirFile, override val psi: KtNamedFunction, override val firSymbol: FirFunctionSymbol<*>, @@ -90,7 +90,7 @@ internal class IncrementallyReanalyzableFunction( cache: ModuleFileCache, firLazyDeclarationResolver: FirLazyDeclarationResolver, firIdeProvider: FirIdeProvider, - ): IncrementallyReanalyzableFunction { + ): ReanalyzableFunctionStructureElement { val newFunction = firIdeProvider.buildFunctionWithBody(newKtDeclaration) as FirSimpleFunction val originalFunction = firSymbol.fir as FirSimpleFunction @@ -108,7 +108,7 @@ internal class IncrementallyReanalyzableFunction( reresolveFile = true, ) return cache.firFileLockProvider.withReadLock(firFile) { - IncrementallyReanalyzableFunction( + ReanalyzableFunctionStructureElement( firFile, newKtDeclaration, newFunction.symbol, @@ -124,7 +124,7 @@ internal class IncrementallyReanalyzableFunction( } } -internal class NonLocalDeclarationFileStructureElement( +internal class NonReanalyzableDeclarationStructureElement( override val firFile: FirFile, fir: FirDeclaration, override val psi: KtDeclaration, @@ -172,7 +172,7 @@ internal class NonLocalDeclarationFileStructureElement( } -internal data class FileWithoutDeclarationsFileStructureElement( +internal data class RootStructureElement( override val firFile: FirFile, override val psi: KtFile, ) : FileStructureElement() { From 3174eb4b0972066cac47af34d3035f18ddf9cb79 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 5 Nov 2020 09:03:54 +0300 Subject: [PATCH 029/698] FIR IDE: do not get ktDeclaration for FirFile --- .../fir/low/level/api/file/structure/FileStructureElement.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureElement.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureElement.kt index ebbc8a6f04e..999d4e0cad8 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureElement.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureElement.kt @@ -138,6 +138,7 @@ internal class NonReanalyzableDeclarationStructureElement( firFile, onDeclarationEnter = { firDeclaration -> when { + firDeclaration is FirFile -> DiagnosticCollectorDeclarationAction.CHECK_CURRENT_DECLARATION_AND_CHECK_NESTED firDeclaration == fir -> { inCurrentDeclaration = true DiagnosticCollectorDeclarationAction.CHECK_CURRENT_DECLARATION_AND_CHECK_NESTED From c3caa3a137fd97f930ece389f6a699a9f27efbbf Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 5 Nov 2020 09:06:36 +0300 Subject: [PATCH 030/698] FIR IDE: clean AbstractFirReferenceResolveTest --- .../idea/resolve/AbstractFirReferenceResolveTest.kt | 8 -------- 1 file changed, 8 deletions(-) diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/resolve/AbstractFirReferenceResolveTest.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/resolve/AbstractFirReferenceResolveTest.kt index 1fecb742fa2..9b4644f3e97 100644 --- a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/resolve/AbstractFirReferenceResolveTest.kt +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/resolve/AbstractFirReferenceResolveTest.kt @@ -17,10 +17,6 @@ abstract class AbstractFirReferenceResolveTest : AbstractReferenceResolveTest() override fun getProjectDescriptor(): KotlinLightProjectDescriptor = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE_FULL_JDK - override fun setUp() { - super.setUp() - } - override fun doTest(path: String) { assert(path.endsWith(".kt")) { path } myFixture.configureWithExtraFile(path, ".Data") @@ -35,8 +31,4 @@ abstract class AbstractFirReferenceResolveTest : AbstractReferenceResolveTest() } performChecks() } - - override fun tearDown() { - super.tearDown() - } } \ No newline at end of file From 65b5e4b62beaaaac58f96ad97411a5cf372741f2 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 5 Nov 2020 10:58:36 +0300 Subject: [PATCH 031/698] FIR IDE: make some session components to be non-thread local To avoid memory leaks --- .../kotlin/idea/frontend/api/fir/KtFirAnalysisSession.kt | 6 +++--- .../api/fir/components/KtFirCompletionCandidateChecker.kt | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSession.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSession.kt index c75c3121c76..944ebc0a145 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSession.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSession.kt @@ -41,9 +41,9 @@ private constructor( override val scopeProvider by threadLocal { KtFirScopeProvider(this, firSymbolBuilder, project, firResolveState, token) } override val symbolProvider: KtSymbolProvider = KtFirSymbolProvider(this, firResolveState.rootModuleSession.firSymbolProvider, firResolveState, firSymbolBuilder, token) - override val completionCandidateChecker: KtCompletionCandidateChecker by threadLocal { KtFirCompletionCandidateChecker(this, token) } - override val symbolDeclarationOverridesProvider: KtSymbolDeclarationOverridesProvider - by threadLocal { KtFirSymbolDeclarationOverridesProvider(this, token) } + override val completionCandidateChecker: KtCompletionCandidateChecker = KtFirCompletionCandidateChecker(this, token) + override val symbolDeclarationOverridesProvider: KtSymbolDeclarationOverridesProvider = + KtFirSymbolDeclarationOverridesProvider(this, token) override fun createContextDependentCopy(): KtAnalysisSession { check(!isContextSession) { "Cannot create context-dependent copy of KtAnalysis session from a context dependent one" } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCompletionCandidateChecker.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCompletionCandidateChecker.kt index 2f690c1e654..96800e3d662 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCompletionCandidateChecker.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCompletionCandidateChecker.kt @@ -32,6 +32,7 @@ import org.jetbrains.kotlin.psi.KtExpression import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.KtSimpleNameExpression import org.jetbrains.kotlin.utils.addToStdlib.safeAs +import java.util.concurrent.ConcurrentHashMap internal class KtFirCompletionCandidateChecker( analysisSession: KtFirAnalysisSession, @@ -40,7 +41,7 @@ internal class KtFirCompletionCandidateChecker( override val analysisSession: KtFirAnalysisSession by weakRef(analysisSession) private val completionContextCache = - HashMap, LowLevelFirApiFacadeForCompletion.FirCompletionContext>() + ConcurrentHashMap, LowLevelFirApiFacadeForCompletion.FirCompletionContext>() override fun checkExtensionFitsCandidate( firSymbolForCandidate: KtCallableSymbol, @@ -94,7 +95,7 @@ internal class KtFirCompletionCandidateChecker( ): Sequence?> { val enclosingContext = EnclosingDeclarationContext.detect(originalFile, fakeNameExpression) - val completionContext = completionContextCache.getOrCreate(firFile to enclosingContext.fakeEnclosingDeclaration) { + val completionContext = completionContextCache.computeIfAbsent(firFile to enclosingContext.fakeEnclosingDeclaration) { enclosingContext.buildCompletionContext(firFile, firResolveState) } From 112f6771eb23d92fd4000e195398cc100a1c4ac4 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Tue, 10 Nov 2020 15:46:33 +0300 Subject: [PATCH 032/698] FIR IDE: fix compilation --- .../idea/frontend/api/fir/components/KtFirScopeProvider.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt index 6ec5b233303..b7ad2c5af22 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt @@ -138,7 +138,7 @@ internal class KtFirScopeProvider( positionInFakeFile: KtElement ): LowLevelFirApiFacadeForCompletion.FirCompletionContext { val firFile = LowLevelFirApiFacade.getFirFile(ktFile, firResolveState) - val declarationContext = EnclosingDeclarationContext.detect(positionInFakeFile) + val declarationContext = EnclosingDeclarationContext.detect(ktFile, positionInFakeFile) return declarationContext.buildCompletionContext(firFile, firResolveState) } From 5fdcc4bb83d3055b5698b1e14ffe2e8b1605aa44 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Wed, 11 Nov 2020 18:29:30 +0300 Subject: [PATCH 033/698] FIR IDE: refactor KotlinFirModificationTrackerService --- .../level/api/FirIdeResolveStateService.kt | 2 + .../KotlinFirOutOfBlockModificationTracker.kt | 56 ++++++++++++------- .../api/fir/KtFirAnalysisSessionProvider.kt | 1 + 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/FirIdeResolveStateService.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/FirIdeResolveStateService.kt index 111ed2d5f0b..69f5e4609b5 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/FirIdeResolveStateService.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/FirIdeResolveStateService.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.idea.fir.low.level.api import com.intellij.openapi.components.service import com.intellij.openapi.project.Project +import com.intellij.openapi.roots.ProjectRootModificationTracker import org.jetbrains.annotations.TestOnly import org.jetbrains.kotlin.idea.caches.project.IdeaModuleInfo import org.jetbrains.kotlin.idea.caches.project.ModuleSourceInfo @@ -24,6 +25,7 @@ internal class FirIdeResolveStateService(project: Project) { private val stateCache by cachedValue( project, project.service().createProjectWideOutOfBlockModificationTracker(), + ProjectRootModificationTracker.getInstance(project), ) { ConcurrentHashMap() } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTracker.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTracker.kt index 0b253e5ec27..51d2b77502d 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTracker.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTracker.kt @@ -8,7 +8,6 @@ package org.jetbrains.kotlin.idea.fir.low.level.api.trackers import com.intellij.ProjectTopics import com.intellij.lang.ASTNode import com.intellij.openapi.Disposable -import com.intellij.openapi.components.service import com.intellij.openapi.module.Module import com.intellij.openapi.project.Project import com.intellij.openapi.roots.ModuleRootEvent @@ -28,23 +27,21 @@ import org.jetbrains.kotlin.idea.util.module internal class KotlinFirModificationTrackerService(project: Project) : Disposable { init { PomManager.getModel(project).addModelListener(Listener()) - - project.messageBus.connect(this).subscribe( - ProjectTopics.PROJECT_ROOTS, - object : ModuleRootListener { - override fun rootsChanged(event: ModuleRootEvent) = increaseModificationCountForAllModules() - } - ) + subscribeForRootChanges(project) } var projectGlobalOutOfBlockInKotlinFilesModificationCount = 0L private set - private val moduleModificationsState = ModuleModificationsState() - fun getOutOfBlockModificationCountForModules(module: Module): Long = moduleModificationsState.getModificationsCountForModule(module) + @TestOnly + fun incrementModificationsCount() { + increaseModificationCountForAllModules() + } + + private val moduleModificationsState = ModuleModificationsState() private val treeAspect = TreeAspect.getInstance(project) override fun dispose() {} @@ -54,9 +51,13 @@ internal class KotlinFirModificationTrackerService(project: Project) : Disposabl moduleModificationsState.increaseModificationCountForAllModules() } - @TestOnly - fun incrementModificationsCount() { - increaseModificationCountForAllModules() + private fun subscribeForRootChanges(project: Project) { + project.messageBus.connect(this).subscribe( + ProjectTopics.PROJECT_ROOTS, + object : ModuleRootListener { + override fun rootsChanged(event: ModuleRootEvent) = increaseModificationCountForAllModules() + } + ) } private inner class Listener : PomModelListener { @@ -68,15 +69,20 @@ internal class KotlinFirModificationTrackerService(project: Project) : Disposabl if (changeSet.rootElement.psi.language != KotlinLanguage.INSTANCE) return val changedElements = changeSet.changedElements + handleChangedElementsInAllModules(changedElements, changeSet) + } + + private fun handleChangedElementsInAllModules( + changedElements: Array, + changeSet: TreeChangeEvent + ) { var isOutOfBlockChangeInAnyModule = false changedElements.forEach { element -> val isOutOfBlock = element.isOutOfBlockChange(changeSet) isOutOfBlockChangeInAnyModule = isOutOfBlockChangeInAnyModule || isOutOfBlock if (isOutOfBlock) { - element.psi.module?.let { module -> - moduleModificationsState.increaseModificationCountForModule(module) - } + incrementModificationTrackerForContainingModule(element) } } @@ -85,13 +91,21 @@ internal class KotlinFirModificationTrackerService(project: Project) : Disposabl } } + private fun incrementModificationTrackerForContainingModule(element: ASTNode) { + element.psi.module?.let { module -> + moduleModificationsState.increaseModificationCountForModule(module) + } + } + private fun ASTNode.isOutOfBlockChange(changeSet: TreeChangeEvent): Boolean { val nodes = changeSet.getChangesByElement(this).affectedChildren - return nodes.any { node -> - val psi = node.psi ?: return@any true - val container = psi.getNonLocalContainingInBodyDeclarationWith() ?: return@any true - !FileElementFactory.isReanalyzableContainer(container) - } + return nodes.any(::isOutOfBlockChange) + } + + private fun isOutOfBlockChange(node: ASTNode): Boolean { + val psi = node.psi ?: return true + val container = psi.getNonLocalContainingInBodyDeclarationWith() ?: return true + return !FileElementFactory.isReanalyzableContainer(container) } } } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSessionProvider.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSessionProvider.kt index 01c28dc1a79..75e6fcdad89 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSessionProvider.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSessionProvider.kt @@ -9,6 +9,7 @@ import com.intellij.openapi.project.Project import com.intellij.psi.util.CachedValueProvider import com.intellij.psi.util.CachedValuesManager import com.intellij.psi.util.PsiModificationTracker +import org.jetbrains.annotations.TestOnly import org.jetbrains.kotlin.analyzer.ModuleInfo import org.jetbrains.kotlin.idea.caches.project.getModuleInfo import org.jetbrains.kotlin.idea.fir.low.level.api.api.FirModuleResolveState From 7320620285769a78e3248e41a0edd0eac4588ea4 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 12 Nov 2020 11:15:08 +0300 Subject: [PATCH 034/698] FIR IDE: add local visibility to symbols --- .../idea/frontend/api/symbols/markers/KtSymbolWithVisibility.kt | 1 + .../kotlin/idea/frontend/api/fir/symbols/firSymbolUtils.kt | 1 + 2 files changed, 2 insertions(+) diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithVisibility.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithVisibility.kt index 30490f62875..659422ebc36 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithVisibility.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithVisibility.kt @@ -15,4 +15,5 @@ sealed class KtSymbolVisibility { object PROTECTED : KtSymbolVisibility() object INTERNAL : KtSymbolVisibility() object UNKNOWN : KtSymbolVisibility() + object LOCAL : KtSymbolVisibility() } \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/firSymbolUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/firSymbolUtils.kt index 0ae5bf6d811..8d59e319cbd 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/firSymbolUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/firSymbolUtils.kt @@ -34,6 +34,7 @@ internal fun Visibility?.getSymbolVisibility(): KtSymbolVisibility = when (this) Visibilities.Protected -> KtSymbolVisibility.PROTECTED Visibilities.Private -> KtSymbolVisibility.PRIVATE Visibilities.Internal -> KtSymbolVisibility.INTERNAL + Visibilities.Local -> KtSymbolVisibility.LOCAL Visibilities.Unknown -> KtSymbolVisibility.UNKNOWN JavaVisibilities.PackageVisibility -> KtSymbolVisibility.UNKNOWN //TODO: Add Java visibilities null -> error("Symbol visibility should not be null, looks like the fir symbol was not properly resolved") From 75990f7619c04a7689868a8dbc49c64a42487a3c Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 12 Nov 2020 12:16:33 +0300 Subject: [PATCH 035/698] FIR IDE: fix tesdata --- .../testData/symbolPointer/memberProperties.kt | 2 +- .../testData/symbolPointer/topLevelProperties.kt | 2 +- .../testData/symbolsByFqName/fileWalkDirectionEnum.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/idea/idea-frontend-fir/testData/symbolPointer/memberProperties.kt b/idea/idea-frontend-fir/testData/symbolPointer/memberProperties.kt index 6418c1576db..bc9f218df98 100644 --- a/idea/idea-frontend-fir/testData/symbolPointer/memberProperties.kt +++ b/idea/idea-frontend-fir/testData/symbolPointer/memberProperties.kt @@ -29,7 +29,7 @@ KtFirPropertyGetterSymbol: modality: FINAL origin: SOURCE symbolKind: TOP_LEVEL - type: Could not render due to java.lang.ClassCastException: org.jetbrains.kotlin.fir.types.impl.FirImplicitTypeRefImpl cannot be cast to org.jetbrains.kotlin.fir.types.FirResolvedTypeRef + type: kotlin/Int visibility: PUBLIC KtFirPropertySymbol: diff --git a/idea/idea-frontend-fir/testData/symbolPointer/topLevelProperties.kt b/idea/idea-frontend-fir/testData/symbolPointer/topLevelProperties.kt index ba6449c3871..20890553a12 100644 --- a/idea/idea-frontend-fir/testData/symbolPointer/topLevelProperties.kt +++ b/idea/idea-frontend-fir/testData/symbolPointer/topLevelProperties.kt @@ -27,7 +27,7 @@ KtFirPropertyGetterSymbol: modality: FINAL origin: SOURCE symbolKind: TOP_LEVEL - type: Could not render due to java.lang.ClassCastException: org.jetbrains.kotlin.fir.types.impl.FirImplicitTypeRefImpl cannot be cast to org.jetbrains.kotlin.fir.types.FirResolvedTypeRef + type: kotlin/Int visibility: PUBLIC KtFirPropertySymbol: diff --git a/idea/idea-frontend-fir/testData/symbolsByFqName/fileWalkDirectionEnum.txt b/idea/idea-frontend-fir/testData/symbolsByFqName/fileWalkDirectionEnum.txt index cd05ea24379..cbd871d78c6 100644 --- a/idea/idea-frontend-fir/testData/symbolsByFqName/fileWalkDirectionEnum.txt +++ b/idea/idea-frontend-fir/testData/symbolsByFqName/fileWalkDirectionEnum.txt @@ -21,7 +21,7 @@ KtFirFunctionSymbol: visibility: PUBLIC KtFirFunctionSymbol: - annotations: [kotlin/internal/InlineOnly()] + annotations: [] callableIdIfNonLocal: kotlin.collections.listOf isExtension: false isExternal: false From 60cc30286cabbeae6a5317f830f22cb61e005444 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 12 Nov 2020 12:19:20 +0300 Subject: [PATCH 036/698] FIR IDE: update file structure testdata after structure elements classes rename --- .../testdata/fileStructure/class.kt | 6 +++--- .../testdata/fileStructure/localClass.kt | 6 +++--- .../testdata/fileStructure/localFun.kt | 6 +++--- .../testdata/fileStructure/nestedClasses.kt | 12 ++++++------ .../topLevelExpressionBodyFunWithType.kt | 2 +- .../topLevelExpressionBodyFunWithoutType.kt | 2 +- .../testdata/fileStructure/topLevelFunWithType.kt | 2 +- .../testdata/fileStructure/topLevelUnitFun.kt | 2 +- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/class.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/class.kt index ffa1a2204b4..f60ca4f611a 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/class.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/class.kt @@ -1,6 +1,6 @@ -class A {/* NonLocalDeclarationFileStructureElement */ - fun x() {/* IncrementallyReanalyzableFunction */ +class A {/* NonReanalyzableDeclarationStructureElement */ + fun x() {/* ReanalyzableFunctionStructureElement */ } - fun y(): Int = 10/* IncrementallyReanalyzableFunction */ + fun y(): Int = 10/* ReanalyzableFunctionStructureElement */ } \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localClass.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localClass.kt index 2a943ad2047..ce41e29aa54 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localClass.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localClass.kt @@ -1,9 +1,9 @@ -fun a() {/* IncrementallyReanalyzableFunction */ +fun a() {/* ReanalyzableFunctionStructureElement */ class X } -class Y {/* NonLocalDeclarationFileStructureElement */ - fun b() {/* IncrementallyReanalyzableFunction */ +class Y {/* NonReanalyzableDeclarationStructureElement */ + fun b() {/* ReanalyzableFunctionStructureElement */ class Z } } \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localFun.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localFun.kt index 4331ea276c4..e10eeca4ee1 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localFun.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localFun.kt @@ -1,11 +1,11 @@ -fun x() {/* IncrementallyReanalyzableFunction */ +fun x() {/* ReanalyzableFunctionStructureElement */ fun y() { } } -class A {/* NonLocalDeclarationFileStructureElement */ - fun z() {/* IncrementallyReanalyzableFunction */ +class A {/* NonReanalyzableDeclarationStructureElement */ + fun z() {/* ReanalyzableFunctionStructureElement */ fun q() { } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/nestedClasses.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/nestedClasses.kt index f4d1fc3f430..d21bcc065d8 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/nestedClasses.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/nestedClasses.kt @@ -1,16 +1,16 @@ -class A {/* NonLocalDeclarationFileStructureElement */ - class B {/* NonLocalDeclarationFileStructureElement */ - fun x() {/* IncrementallyReanalyzableFunction */ +class A {/* NonReanalyzableDeclarationStructureElement */ + class B {/* NonReanalyzableDeclarationStructureElement */ + fun x() {/* ReanalyzableFunctionStructureElement */ } - class C {/* NonLocalDeclarationFileStructureElement */ + class C {/* NonReanalyzableDeclarationStructureElement */ } } - class E {/* NonLocalDeclarationFileStructureElement */ + class E {/* NonReanalyzableDeclarationStructureElement */ } - fun y(): Int = 10/* IncrementallyReanalyzableFunction */ + fun y(): Int = 10/* ReanalyzableFunctionStructureElement */ } \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelExpressionBodyFunWithType.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelExpressionBodyFunWithType.kt index 672f5070290..4733b336619 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelExpressionBodyFunWithType.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelExpressionBodyFunWithType.kt @@ -1 +1 @@ -fun foo(): Int = 42/* IncrementallyReanalyzableFunction */ \ No newline at end of file +fun foo(): Int = 42/* ReanalyzableFunctionStructureElement */ \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelExpressionBodyFunWithoutType.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelExpressionBodyFunWithoutType.kt index f9f7b502c6b..089bd79a4e9 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelExpressionBodyFunWithoutType.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelExpressionBodyFunWithoutType.kt @@ -1 +1 @@ -fun foo() = 42/* NonLocalDeclarationFileStructureElement */ \ No newline at end of file +fun foo() = 42/* NonReanalyzableDeclarationStructureElement */ \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelFunWithType.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelFunWithType.kt index d1eab252b95..850cad4630f 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelFunWithType.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelFunWithType.kt @@ -1,4 +1,4 @@ -fun foo(): Int {/* IncrementallyReanalyzableFunction */ +fun foo(): Int {/* ReanalyzableFunctionStructureElement */ println("") return 10 } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelUnitFun.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelUnitFun.kt index 774c4cd6abd..39edd9f8db0 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelUnitFun.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelUnitFun.kt @@ -1,4 +1,4 @@ -fun foo() {/* IncrementallyReanalyzableFunction */ +fun foo() {/* ReanalyzableFunctionStructureElement */ println("") } From 164f4d14d713436ef30643321757d2c3ef0abfa9 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 12 Nov 2020 12:59:17 +0300 Subject: [PATCH 037/698] FIR IDE: do not collect diagnostics for generated declarations --- .../api/file/structure/FileStructureElement.kt | 3 +++ .../fir/low/level/api/util/declarationUtils.kt | 2 ++ .../kotlin/idea/fir/low/level/api/util/utils.kt | 14 ++++++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureElement.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureElement.kt index 999d4e0cad8..be61b9deecd 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureElement.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureElement.kt @@ -11,6 +11,7 @@ import org.jetbrains.kotlin.fir.analysis.collectors.DiagnosticCollectorDeclarati import org.jetbrains.kotlin.fir.containingClass import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.psi +import org.jetbrains.kotlin.fir.realPsi import org.jetbrains.kotlin.fir.resolve.toSymbol import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol @@ -18,6 +19,7 @@ import org.jetbrains.kotlin.idea.fir.low.level.api.diagnostics.FirIdeStructureEl import org.jetbrains.kotlin.idea.fir.low.level.api.file.builder.ModuleFileCache import org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver import org.jetbrains.kotlin.idea.fir.low.level.api.providers.FirIdeProvider +import org.jetbrains.kotlin.idea.fir.low.level.api.util.isGeneratedDeclaration import org.jetbrains.kotlin.idea.fir.low.level.api.util.ktDeclaration import org.jetbrains.kotlin.idea.fir.low.level.api.util.replaceFirst import org.jetbrains.kotlin.psi.* @@ -138,6 +140,7 @@ internal class NonReanalyzableDeclarationStructureElement( firFile, onDeclarationEnter = { firDeclaration -> when { + firDeclaration.isGeneratedDeclaration -> DiagnosticCollectorDeclarationAction.SKIP firDeclaration is FirFile -> DiagnosticCollectorDeclarationAction.CHECK_CURRENT_DECLARATION_AND_CHECK_NESTED firDeclaration == fir -> { inCurrentDeclaration = true diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/util/declarationUtils.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/util/declarationUtils.kt index ca1b4284318..6d33a71c210 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/util/declarationUtils.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/util/declarationUtils.kt @@ -128,3 +128,5 @@ private fun KtTypeAlias.findFir(firSymbolProvider: FirSymbolProvider): FirTypeAl } } +val FirDeclaration.isGeneratedDeclaration + get() = realPsi == null \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/util/utils.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/util/utils.kt index 439aef3ff27..21ca3151730 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/util/utils.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/util/utils.kt @@ -13,8 +13,10 @@ import org.jetbrains.kotlin.fir.diagnostics.FirDiagnosticHolder import org.jetbrains.kotlin.fir.psi import org.jetbrains.kotlin.fir.render import org.jetbrains.kotlin.idea.caches.project.IdeaModuleInfo -import org.jetbrains.kotlin.psi.KtDeclaration +import org.jetbrains.kotlin.idea.util.getElementTextInContext import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.psi.KtDeclaration +import org.jetbrains.kotlin.psi.KtElement import java.util.concurrent.TimeUnit import java.util.concurrent.locks.Lock @@ -61,7 +63,15 @@ internal val FirDeclaration.ktDeclaration: KtDeclaration get() { val psi = psi ?: error("PSI element was not found for${render()}") - return psi as KtDeclaration + return psi as? KtDeclaration + ?: error( + """ + FirDeclaration.psi (${this::class.simpleName}) should be KtDeclaration but was ${psi::class.simpleName} + ${(psi as? KtElement)?.getElementTextInContext() ?: psi.text} + + ${render()} + """.trimIndent() + ) } internal val FirDeclaration.containingKtFileIfAny: KtFile? From e4d2e38ea204b0ee5afce32503a3fc3a4d3735d7 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 5 Nov 2020 13:32:44 +0300 Subject: [PATCH 038/698] FIR IDE: fix reference resolving of qualified expression with nested classes --- .../references/FirReferenceResolveHelper.kt | 52 ++++++++++++------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/FirReferenceResolveHelper.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/FirReferenceResolveHelper.kt index cb8a18eae2d..c59c8027f6e 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/FirReferenceResolveHelper.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/FirReferenceResolveHelper.kt @@ -139,20 +139,6 @@ internal object FirReferenceResolveHelper { val fir = expression.getOrBuildFir(analysisSession.firResolveState) val session = analysisSession.firResolveState.rootModuleSession when (fir) { - is FirResolvable -> { - val calleeReference = - if (fir is FirFunctionCall - && fir.isImplicitFunctionCall() - && expression is KtNameReferenceExpression - ) { - // we are resolving implicit invoke call, like - // fun foo(a: () -> Unit) { - // a() - // } - (fir.dispatchReceiver as FirQualifiedAccessExpression).calleeReference - } else fir.calleeReference - return listOfNotNull(calleeReference.toTargetSymbol(session, symbolBuilder)) - } is FirResolvedTypeRef -> { if (expression.isPartOfUserTypeRefQualifier()) { return listOfNotNull(getPackageSymbolFor(expression, symbolBuilder, forQualifiedType = true)) @@ -160,21 +146,37 @@ internal object FirReferenceResolveHelper { return listOfNotNull(fir.toTargetSymbol(session, symbolBuilder)) } is FirResolvedQualifier -> { + // TODO refactor that block val classId = fir.classId ?: return emptyList() + + var parent = expression.parent as? KtDotQualifiedExpression // Distinguish A.foo() from A(.Companion).foo() // Make expression.parent as? KtDotQualifiedExpression local function - var parent = expression.parent as? KtDotQualifiedExpression while (parent != null) { val selectorExpression = parent.selectorExpression ?: break if (selectorExpression === expression) { parent = parent.parent as? KtDotQualifiedExpression continue } + val receiverClassId = if (parent.receiverExpression == expression) { + /* + * A.Named.i -> class A + */ + val name = fir.relativeClassFqName?.pathSegments()?.firstOrNull() + name?.let { ClassId(fir.packageFqName, it) } + } else null val parentFir = selectorExpression.getOrBuildFir(analysisSession.firResolveState) - if (parentFir is FirQualifiedAccess) { - return listOfNotNull(classId.toTargetPsi(session, symbolBuilder, parentFir.calleeReference)) + when { + parentFir is FirQualifiedAccess -> { + return listOfNotNull( + (receiverClassId ?: classId).toTargetPsi(session, symbolBuilder, parentFir.calleeReference) + ) + } + receiverClassId != null -> { + return listOfNotNull(receiverClassId.toTargetPsi(session, symbolBuilder)) + } + else -> parent = parent.parent as? KtDotQualifiedExpression } - parent = parent.parent as? KtDotQualifiedExpression } return listOfNotNull(classId.toTargetPsi(session, symbolBuilder)) } @@ -230,6 +232,20 @@ internal object FirReferenceResolveHelper { } return candidates.mapNotNull { it.fir.buildSymbol(symbolBuilder) } } + is FirResolvable -> { + val calleeReference = + if (fir is FirFunctionCall + && fir.isImplicitFunctionCall() + && expression is KtNameReferenceExpression + ) { + // we are resolving implicit invoke call, like + // fun foo(a: () -> Unit) { + // a() + // } + (fir.dispatchReceiver as FirQualifiedAccessExpression).calleeReference + } else fir.calleeReference + return listOfNotNull(calleeReference.toTargetSymbol(session, symbolBuilder)) + } else -> { // Handle situation when we're in the middle/beginning of qualifier // A.B.C.foo() or A.B.C.foo() From 7061608567e6799d9a2d40e41621bab08866cab3 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 12 Nov 2020 17:24:47 +0300 Subject: [PATCH 039/698] FIR IDE: introduce common function to mute tests --- ...hLevelPerformanceCompletionHandlerTests.kt | 4 +- idea/idea-fir/build.gradle.kts | 1 + .../classes/AbstractFirClassLoadingTest.kt | 5 +- .../classes/AbstractFirLightClassTest.kt | 2 +- .../AbstractFirLightFacadeClassTest.kt | 2 +- .../checkers/AbstractFirPsiCheckerTest.kt | 6 +- .../findUsages/AbstractFindUsagesFirTest.kt | 16 +++ ...UsagesWithDisableComponentSearchFirTest.kt | 17 +++ ...AbstractKotlinFindUsagesWithLibraryTest.kt | 18 +++ .../AbstractKotlinFindUsagesWithStdlibTest.kt | 17 +++ .../FindUsagesMultiModuleFirTest.kt | 4 +- .../kotlin/findUsages/findUsagesTestUtils.kt | 21 +++ ...AbstractHighLevelJvmBasicCompletionTest.kt | 6 +- .../highLevelCompletionTestUtils.kt | 44 ------ ...ractHighLevelBasicCompletionHandlerTest.kt | 7 +- .../AbstractFirHighlightingTest.kt | 11 +- .../AbstractFirReferenceResolveTest.kt | 13 +- .../build.gradle.kts | 2 + .../kotlin/test/uitls/IgnoreTests.kt | 126 ++++++++++++++++++ .../KotlinLightCodeInsightFixtureTestCase.kt | 3 + .../org/jetbrains/kotlin/FirTestUtils.kt | 22 --- .../findUsages/AbstractFindUsagesTest.kt | 16 --- ...AbstractKotlinFindUsagesWithLibraryTest.kt | 12 +- .../AbstractKotlinFindUsagesWithStdlibTest.kt | 12 +- 24 files changed, 246 insertions(+), 141 deletions(-) create mode 100644 idea/idea-fir/tests/org/jetbrains/kotlin/findUsages/AbstractFindUsagesFirTest.kt create mode 100644 idea/idea-fir/tests/org/jetbrains/kotlin/findUsages/AbstractFindUsagesWithDisableComponentSearchFirTest.kt create mode 100644 idea/idea-fir/tests/org/jetbrains/kotlin/findUsages/AbstractKotlinFindUsagesWithLibraryTest.kt create mode 100644 idea/idea-fir/tests/org/jetbrains/kotlin/findUsages/AbstractKotlinFindUsagesWithStdlibTest.kt create mode 100644 idea/idea-fir/tests/org/jetbrains/kotlin/findUsages/findUsagesTestUtils.kt delete mode 100644 idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/highLevelCompletionTestUtils.kt create mode 100644 idea/idea-frontend-independent/tests/org/jetbrains/kotlin/test/uitls/IgnoreTests.kt diff --git a/idea/idea-fir-performance-tests/tests/org/jetbrains/kotlin/idea/perf/AbstractHighLevelPerformanceCompletionHandlerTests.kt b/idea/idea-fir-performance-tests/tests/org/jetbrains/kotlin/idea/perf/AbstractHighLevelPerformanceCompletionHandlerTests.kt index 036130ee40a..da8d952199e 100644 --- a/idea/idea-fir-performance-tests/tests/org/jetbrains/kotlin/idea/perf/AbstractHighLevelPerformanceCompletionHandlerTests.kt +++ b/idea/idea-fir-performance-tests/tests/org/jetbrains/kotlin/idea/perf/AbstractHighLevelPerformanceCompletionHandlerTests.kt @@ -6,7 +6,7 @@ package org.jetbrains.kotlin.idea.perf import com.intellij.codeInsight.completion.CompletionType -import org.jetbrains.kotlin.idea.completion.FIR_COMPARISON +import org.jetbrains.kotlin.test.uitls.IgnoreTests.DIRECTIVES import org.jetbrains.kotlin.test.InTextDirectivesUtils abstract class AbstractHighLevelPerformanceCompletionHandlerTests( @@ -17,7 +17,7 @@ abstract class AbstractHighLevelPerformanceCompletionHandlerTests( override val statsPrefix: String = "fir-completion" override fun doPerfTest(unused: String) { - if (!InTextDirectivesUtils.isDirectiveDefined(testDataFile().readText(), FIR_COMPARISON)) return + if (!InTextDirectivesUtils.isDirectiveDefined(testDataFile().readText(), DIRECTIVES.FIR_COMPARISON)) return super.doPerfTest(unused) } diff --git a/idea/idea-fir/build.gradle.kts b/idea/idea-fir/build.gradle.kts index 40925a12564..e90d560910b 100644 --- a/idea/idea-fir/build.gradle.kts +++ b/idea/idea-fir/build.gradle.kts @@ -21,6 +21,7 @@ dependencies { testCompile(projectTests(":idea:idea-frontend-fir")) testCompile(project(":kotlin-test:kotlin-test-junit")) testCompile(commonDep("junit:junit")) + testCompile(projectTests(":idea:idea-frontend-independent")) testCompileOnly(intellijDep()) testRuntime(intellijDep()) diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/asJava/classes/AbstractFirClassLoadingTest.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/asJava/classes/AbstractFirClassLoadingTest.kt index 7cc888354e2..207a50fe5b8 100644 --- a/idea/idea-fir/tests/org/jetbrains/kotlin/asJava/classes/AbstractFirClassLoadingTest.kt +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/asJava/classes/AbstractFirClassLoadingTest.kt @@ -5,13 +5,10 @@ package org.jetbrains.kotlin.asJava.classes -import com.intellij.openapi.application.ApplicationManager import org.jetbrains.kotlin.asJava.KotlinAsJavaSupport -import org.jetbrains.kotlin.doTestWithFIRFlagsByPath import org.jetbrains.kotlin.executeOnPooledThreadInReadAction -import org.jetbrains.kotlin.idea.debugger.readAction +import org.jetbrains.kotlin.findUsages.doTestWithFIRFlagsByPath import org.jetbrains.kotlin.idea.perf.UltraLightChecker -import org.jetbrains.kotlin.idea.perf.UltraLightChecker.checkByJavaFile import org.jetbrains.kotlin.idea.perf.UltraLightChecker.getJavaFileForTest import org.jetbrains.kotlin.idea.perf.UltraLightChecker.renderLightClasses import org.jetbrains.kotlin.psi.KtFile diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/asJava/classes/AbstractFirLightClassTest.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/asJava/classes/AbstractFirLightClassTest.kt index 3555abe7814..574316ee496 100644 --- a/idea/idea-fir/tests/org/jetbrains/kotlin/asJava/classes/AbstractFirLightClassTest.kt +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/asJava/classes/AbstractFirLightClassTest.kt @@ -6,8 +6,8 @@ package org.jetbrains.kotlin.asJava.classes import org.jetbrains.kotlin.asJava.LightClassTestCommon -import org.jetbrains.kotlin.doTestWithFIRFlagsByPath import org.jetbrains.kotlin.executeOnPooledThreadInReadAction +import org.jetbrains.kotlin.findUsages.doTestWithFIRFlagsByPath import org.jetbrains.kotlin.idea.caches.resolve.PsiElementChecker import org.jetbrains.kotlin.idea.caches.resolve.findClass import org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/asJava/classes/AbstractFirLightFacadeClassTest.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/asJava/classes/AbstractFirLightFacadeClassTest.kt index 7844c1322d5..12920cc8a04 100644 --- a/idea/idea-fir/tests/org/jetbrains/kotlin/asJava/classes/AbstractFirLightFacadeClassTest.kt +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/asJava/classes/AbstractFirLightFacadeClassTest.kt @@ -7,8 +7,8 @@ package org.jetbrains.kotlin.asJava.classes import com.intellij.psi.search.GlobalSearchScope import org.jetbrains.kotlin.asJava.KotlinAsJavaSupport -import org.jetbrains.kotlin.doTestWithFIRFlagsByPath import org.jetbrains.kotlin.executeOnPooledThreadInReadAction +import org.jetbrains.kotlin.findUsages.doTestWithFIRFlagsByPath import org.jetbrains.kotlin.idea.perf.UltraLightChecker import org.jetbrains.kotlin.idea.perf.UltraLightChecker.checkByJavaFile import org.jetbrains.kotlin.name.FqName diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/checkers/AbstractFirPsiCheckerTest.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/checkers/AbstractFirPsiCheckerTest.kt index dccabc251a7..ca86505e14f 100644 --- a/idea/idea-fir/tests/org/jetbrains/kotlin/checkers/AbstractFirPsiCheckerTest.kt +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/checkers/AbstractFirPsiCheckerTest.kt @@ -6,11 +6,9 @@ package org.jetbrains.kotlin.checkers import com.intellij.rt.execution.junit.FileComparisonFailure -import org.jetbrains.kotlin.idea.completion.FIR_COMPARISON -import org.jetbrains.kotlin.idea.completion.runTestWithCustomEnableDirective import org.jetbrains.kotlin.idea.test.withCustomCompilerOptions import org.jetbrains.kotlin.idea.withPossiblyDisabledDuplicatedFirSourceElementsException -import org.jetbrains.kotlin.test.InTextDirectivesUtils +import org.jetbrains.kotlin.test.uitls.IgnoreTests import java.io.File abstract class AbstractFirPsiCheckerTest : AbstractPsiCheckerTest() { @@ -19,7 +17,7 @@ abstract class AbstractFirPsiCheckerTest : AbstractPsiCheckerTest() { override fun isFirPlugin(): Boolean = true override fun doTest(filePath: String) { - runTestWithCustomEnableDirective(FIR_COMPARISON, testDataFile()) { + IgnoreTests.runTestIfEnabledByFileDirective(testDataFilePath(), IgnoreTests.DIRECTIVES.FIR_COMPARISON) { myFixture.configureByFile(fileName()) checkHighlighting(checkWarnings = false, checkInfos = false, checkWeakWarnings = false) } diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/findUsages/AbstractFindUsagesFirTest.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/findUsages/AbstractFindUsagesFirTest.kt new file mode 100644 index 00000000000..4c2a7f5b44b --- /dev/null +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/findUsages/AbstractFindUsagesFirTest.kt @@ -0,0 +1,16 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.findUsages + +import com.intellij.psi.PsiElement + +abstract class AbstractFindUsagesFirTest : AbstractFindUsagesTest() { + override fun isFirPlugin(): Boolean = true + + override fun doTest(path: String) = doTestWithFIRFlagsByPath(path) { + super.doTest(path) + } +} \ No newline at end of file diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/findUsages/AbstractFindUsagesWithDisableComponentSearchFirTest.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/findUsages/AbstractFindUsagesWithDisableComponentSearchFirTest.kt new file mode 100644 index 00000000000..6f653576a19 --- /dev/null +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/findUsages/AbstractFindUsagesWithDisableComponentSearchFirTest.kt @@ -0,0 +1,17 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.findUsages + +import com.intellij.psi.PsiElement + +abstract class AbstractFindUsagesWithDisableComponentSearchFirTest : AbstractFindUsagesWithDisableComponentSearchTest() { + override fun isFirPlugin(): Boolean = true + + override fun doTest(path: String) = doTestWithFIRFlagsByPath(path) { + super.doTest(path) + } +} + diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/findUsages/AbstractKotlinFindUsagesWithLibraryTest.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/findUsages/AbstractKotlinFindUsagesWithLibraryTest.kt new file mode 100644 index 00000000000..ae5fc2ee12b --- /dev/null +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/findUsages/AbstractKotlinFindUsagesWithLibraryTest.kt @@ -0,0 +1,18 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.findUsages + +import com.intellij.psi.PsiElement +import org.jetbrains.kotlin.idea.test.PluginTestCaseBase +import org.jetbrains.kotlin.idea.test.SdkAndMockLibraryProjectDescriptor + +abstract class AbstractKotlinFindUsagesWithLibraryFirTest : AbstractKotlinFindUsagesWithLibraryTest() { + override fun isFirPlugin(): Boolean = true + + override fun doTest(path: String) = doTestWithFIRFlagsByPath(path) { + super.doTest(path) + } +} \ No newline at end of file diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/findUsages/AbstractKotlinFindUsagesWithStdlibTest.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/findUsages/AbstractKotlinFindUsagesWithStdlibTest.kt new file mode 100644 index 00000000000..1a00a9b04dc --- /dev/null +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/findUsages/AbstractKotlinFindUsagesWithStdlibTest.kt @@ -0,0 +1,17 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.findUsages + +import com.intellij.psi.PsiElement +import org.jetbrains.kotlin.idea.test.KotlinJdkAndMultiplatformStdlibDescriptor + +abstract class AbstractKotlinFindUsagesWithStdlibFirTest : AbstractKotlinFindUsagesWithStdlibTest() { + override fun isFirPlugin(): Boolean = true + + override fun doTest(path: String) = doTestWithFIRFlagsByPath(path) { + super.doTest(path) + } +} diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/findUsages/FindUsagesMultiModuleFirTest.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/findUsages/FindUsagesMultiModuleFirTest.kt index 470b4351ac3..13dca27b257 100644 --- a/idea/idea-fir/tests/org/jetbrains/kotlin/findUsages/FindUsagesMultiModuleFirTest.kt +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/findUsages/FindUsagesMultiModuleFirTest.kt @@ -5,12 +5,12 @@ package org.jetbrains.kotlin.findUsages -import org.jetbrains.kotlin.doTestWithFIRFlags +import java.nio.file.Paths class FindUsagesMultiModuleFirTest : FindUsagesMultiModuleTest() { override val isFirPlugin: Boolean = true - override fun doFindUsagesTest() = doTestWithFIRFlags(mainFile.text) { + override fun doFindUsagesTest() = doTestWithFIRFlags(Paths.get(mainFile.virtualFilePath)) { super.doFindUsagesTest() } } \ No newline at end of file diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/findUsages/findUsagesTestUtils.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/findUsages/findUsagesTestUtils.kt new file mode 100644 index 00000000000..2fec0588665 --- /dev/null +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/findUsages/findUsagesTestUtils.kt @@ -0,0 +1,21 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ +package org.jetbrains.kotlin.findUsages + +import org.jetbrains.kotlin.test.InTextDirectivesUtils +import org.jetbrains.kotlin.test.uitls.IgnoreTests +import java.nio.file.Path +import java.nio.file.Paths + + +fun doTestWithFIRFlagsByPath(path: String, body: () -> Unit) = + doTestWithFIRFlags(Paths.get(path), body) + +fun doTestWithFIRFlags(testFile: Path, body: () -> Unit) { + if (InTextDirectivesUtils.isDirectiveDefined(testFile.toFile().readText(), "FIR_IGNORE")) return + IgnoreTests.runTestIfEnabledByFileDirective(testFile, IgnoreTests.DIRECTIVES.FIR_COMPARISON) { + body() + } +} \ No newline at end of file diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/AbstractHighLevelJvmBasicCompletionTest.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/AbstractHighLevelJvmBasicCompletionTest.kt index 3e732678647..afe751eaff8 100644 --- a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/AbstractHighLevelJvmBasicCompletionTest.kt +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/AbstractHighLevelJvmBasicCompletionTest.kt @@ -6,12 +6,14 @@ package org.jetbrains.kotlin.idea.completion import org.jetbrains.kotlin.idea.completion.test.AbstractJvmBasicCompletionTest -import org.jetbrains.kotlin.test.InTextDirectivesUtils +import org.jetbrains.kotlin.test.uitls.IgnoreTests abstract class AbstractHighLevelJvmBasicCompletionTest : AbstractJvmBasicCompletionTest() { override val captureExceptions: Boolean = false override fun executeTest(test: () -> Unit) { - runTestWithCustomEnableDirective(FIR_COMPARISON, testDataFile()) { super.executeTest(test) } + IgnoreTests.runTestIfEnabledByFileDirective(testDataFile().toPath(), IgnoreTests.DIRECTIVES.FIR_COMPARISON, ".after") { + super.executeTest(test) + } } } \ No newline at end of file diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/highLevelCompletionTestUtils.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/highLevelCompletionTestUtils.kt deleted file mode 100644 index 26edc6a77ef..00000000000 --- a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/highLevelCompletionTestUtils.kt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.completion - -import org.jetbrains.kotlin.test.InTextDirectivesUtils -import java.io.File - -const val FIR_COMPARISON = "// FIR_COMPARISON" - -/** - * Set this flag to `true` to insert directive automatically to all files - * that pass tests but do not already have the directive. - */ -private const val insertDirectiveAutomatically = false - -fun runTestWithCustomEnableDirective(directive: String, testFile: File, test: () -> Unit) { - val testFileAfter = testFile.resolveSibling(testFile.name + ".after").takeIf { it.exists() } - - val testEnabled = InTextDirectivesUtils.isDirectiveDefined(testFile.readText(), directive) - - try { - test() - } catch (e: Throwable) { - if (testEnabled) throw e - return - } - - if (!testEnabled) { - if (insertDirectiveAutomatically) { - testFile.insertDirective(directive) - testFileAfter?.insertDirective(directive) - } - - throw AssertionError("Looks like test is passing, please add ${directive.removePrefix("// ")} at the beginning of the file") - } -} - -private fun File.insertDirective(directive: String) { - val originalText = readText() - writeText("$directive\n$originalText") -} diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/test/handlers/AbstractHighLevelBasicCompletionHandlerTest.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/test/handlers/AbstractHighLevelBasicCompletionHandlerTest.kt index f42cf2e47fc..2f952051e3b 100644 --- a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/test/handlers/AbstractHighLevelBasicCompletionHandlerTest.kt +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/test/handlers/AbstractHighLevelBasicCompletionHandlerTest.kt @@ -5,13 +5,14 @@ package org.jetbrains.kotlin.idea.completion.test.handlers -import org.jetbrains.kotlin.idea.completion.FIR_COMPARISON -import org.jetbrains.kotlin.idea.completion.runTestWithCustomEnableDirective +import org.jetbrains.kotlin.test.uitls.IgnoreTests abstract class AbstractHighLevelBasicCompletionHandlerTest : AbstractBasicCompletionHandlerTest() { override val captureExceptions: Boolean = false override fun doTest(testPath: String) { - runTestWithCustomEnableDirective(FIR_COMPARISON, testDataFile()) { super.doTest(testPath) } + IgnoreTests.runTestIfEnabledByFileDirective(testDataFilePath(), IgnoreTests.DIRECTIVES.FIR_COMPARISON, ".after") { + super.doTest(testPath) + } } } \ No newline at end of file diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/highlighter/AbstractFirHighlightingTest.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/highlighter/AbstractFirHighlightingTest.kt index 57918f63403..555cc646ace 100644 --- a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/highlighter/AbstractFirHighlightingTest.kt +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/highlighter/AbstractFirHighlightingTest.kt @@ -6,10 +6,10 @@ package org.jetbrains.kotlin.idea.highlighter import org.jetbrains.kotlin.idea.addExternalTestFiles -import org.jetbrains.kotlin.idea.shouldBeRethrown import org.jetbrains.kotlin.idea.test.ProjectDescriptorWithStdlibSources import org.jetbrains.kotlin.idea.withPossiblyDisabledDuplicatedFirSourceElementsException import org.jetbrains.kotlin.test.InTextDirectivesUtils +import org.jetbrains.kotlin.test.uitls.IgnoreTests abstract class AbstractFirHighlightingTest : AbstractHighlightingTest() { override val captureExceptions: Boolean = false @@ -24,20 +24,13 @@ abstract class AbstractFirHighlightingTest : AbstractHighlightingTest() { } override fun checkHighlighting(fileText: String) { - val doComparison = !InTextDirectivesUtils.isDirectiveDefined(myFixture.file.text, "IGNORE_FIR") val checkInfos = !InTextDirectivesUtils.isDirectiveDefined(fileText, NO_CHECK_INFOS_PREFIX); - try { + IgnoreTests.runTestIfNotDisabledByFileDirective(testDataFile().toPath(), IgnoreTests.DIRECTIVES.IGNORE_FIR) { // warnings are not supported yet withPossiblyDisabledDuplicatedFirSourceElementsException(fileText) { myFixture.checkHighlighting(/* checkWarnings= */ false, checkInfos, /* checkWeakWarnings= */ false) } - } catch (e: Throwable) { - if (doComparison || e.shouldBeRethrown()) throw e - return - } - if (!doComparison) { - throw AssertionError("Looks like test is passing, please remove IGNORE_FIR") } } } \ No newline at end of file diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/resolve/AbstractFirReferenceResolveTest.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/resolve/AbstractFirReferenceResolveTest.kt index 9b4644f3e97..ac6db4c5f5f 100644 --- a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/resolve/AbstractFirReferenceResolveTest.kt +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/resolve/AbstractFirReferenceResolveTest.kt @@ -10,6 +10,7 @@ import org.jetbrains.kotlin.idea.shouldBeRethrown import org.jetbrains.kotlin.idea.test.KotlinLightProjectDescriptor import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor import org.jetbrains.kotlin.test.InTextDirectivesUtils +import org.jetbrains.kotlin.test.uitls.IgnoreTests abstract class AbstractFirReferenceResolveTest : AbstractReferenceResolveTest() { override fun isFirPlugin(): Boolean = true @@ -20,15 +21,9 @@ abstract class AbstractFirReferenceResolveTest : AbstractReferenceResolveTest() override fun doTest(path: String) { assert(path.endsWith(".kt")) { path } myFixture.configureWithExtraFile(path, ".Data") - if (InTextDirectivesUtils.isDirectiveDefined(myFixture.file.text, "IGNORE_FIR")) { - try { - performChecks() - } catch (t: Throwable) { - if (t.shouldBeRethrown()) throw t - return - } - throw AssertionError("Looks like test is passing, please remove IGNORE_FIR") + + IgnoreTests.runTestIfNotDisabledByFileDirective(testDataFile().toPath(), IgnoreTests.DIRECTIVES.IGNORE_FIR) { + performChecks() } - performChecks() } } \ No newline at end of file diff --git a/idea/idea-frontend-independent/build.gradle.kts b/idea/idea-frontend-independent/build.gradle.kts index 4628368ba5b..17ccdde53bf 100644 --- a/idea/idea-frontend-independent/build.gradle.kts +++ b/idea/idea-frontend-independent/build.gradle.kts @@ -20,6 +20,8 @@ dependencies { compileOnly(intellijDep()) compileOnly(project(":compiler:light-classes")) compileOnly(intellijPluginDep("java")) { includeJars("java-api", "java-impl") } + + testCompile(projectTests(":compiler:tests-common")) } sourceSets { diff --git a/idea/idea-frontend-independent/tests/org/jetbrains/kotlin/test/uitls/IgnoreTests.kt b/idea/idea-frontend-independent/tests/org/jetbrains/kotlin/test/uitls/IgnoreTests.kt new file mode 100644 index 00000000000..8e37b2b02a0 --- /dev/null +++ b/idea/idea-frontend-independent/tests/org/jetbrains/kotlin/test/uitls/IgnoreTests.kt @@ -0,0 +1,126 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.test.uitls + +import org.jetbrains.kotlin.test.InTextDirectivesUtils +import java.nio.file.Files +import java.nio.file.Path + +object IgnoreTests { + private const val INSERT_DIRECTIVE_AUTOMATICALLY = false // TODO use environment variable instead + + fun runTestIfEnabledByFileDirective( + testFile: Path, + enableTestDirective: String, + vararg additionalFilesExtensions: String, + test: () -> Unit, + ) { + runTestIfEnabledByDirective( + testFile, + EnableOrDisableTestDirective.Enable(enableTestDirective), + additionalFilesExtensions.toList(), + test + ) + } + + fun runTestIfNotDisabledByFileDirective( + testFile: Path, + disableTestDirective: String, + vararg additionalFilesExtensions: String, + test: () -> Unit + ) { + runTestIfEnabledByDirective( + testFile, + EnableOrDisableTestDirective.Disable(disableTestDirective), + additionalFilesExtensions.toList(), + test + ) + } + + private fun runTestIfEnabledByDirective( + testFile: Path, + directive: EnableOrDisableTestDirective, + additionalFilesExtensions: List, + test: () -> Unit + ) { + val testIsEnabled = directive.isEnabledInFile(testFile) + + try { + test() + } catch (e: Throwable) { + if (testIsEnabled) throw e + return + } + + if (!testIsEnabled) { + handlePassingButNotEnabledTest(testFile, directive, additionalFilesExtensions) + } + } + + private fun handlePassingButNotEnabledTest( + testFile: Path, + directive: EnableOrDisableTestDirective, + additionalFilesExtensions: List, + ) { + if (INSERT_DIRECTIVE_AUTOMATICALLY) { + testFile.insertDirectivesToFileAndAdditionalFile(directive, additionalFilesExtensions) + } + + throw AssertionError( + "Looks like the test passes, please ${directive.fixDirectiveMessage} the beginning of the testdata file" + ) + } + + private fun Path.insertDirectivesToFileAndAdditionalFile( + directive: EnableOrDisableTestDirective, + additionalFilesExtensions: List, + ) { + insertDirective(directive) + additionalFilesExtensions.forEach { extension -> + getSiblingFile(extension)?.insertDirective(directive) + } + } + + private fun Path.getSiblingFile(extension: String): Path? { + val siblingName = fileName.toString() + "." + extension.removePrefix(".") + return resolveSibling(siblingName).takeIf(Files::exists) + } + + private sealed class EnableOrDisableTestDirective { + abstract val directiveText: String + abstract val fixDirectiveMessage: String + + abstract fun isEnabledIfDirectivePresent(isDirectivePresent: Boolean): Boolean + + data class Enable(override val directiveText: String) : EnableOrDisableTestDirective() { + override val fixDirectiveMessage: String get() = "add $directiveText to" + + override fun isEnabledIfDirectivePresent(isDirectivePresent: Boolean): Boolean = isDirectivePresent + } + + data class Disable(override val directiveText: String) : EnableOrDisableTestDirective() { + override val fixDirectiveMessage: String get() = "remove $directiveText from" + override fun isEnabledIfDirectivePresent(isDirectivePresent: Boolean): Boolean = !isDirectivePresent + } + } + + private fun EnableOrDisableTestDirective.isEnabledInFile(file: Path): Boolean { + val isDirectivePresent = InTextDirectivesUtils.isDirectiveDefined(file.toFile().readText(), directiveText) + return isEnabledIfDirectivePresent(isDirectivePresent) + } + + private fun Path.insertDirective(directive: EnableOrDisableTestDirective) { + toFile().apply { + val originalText = readText() + writeText("${directive.directiveText}\n$originalText") + } + } + + object DIRECTIVES { + const val FIR_COMPARISON = "// FIR_COMPARISON" + const val IGNORE_FIR = "// IGNORE_FIR" + } +} \ No newline at end of file diff --git a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCase.kt b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCase.kt index 5a2c759e453..5a4322310cf 100644 --- a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCase.kt +++ b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCase.kt @@ -57,6 +57,7 @@ import java.io.File import java.io.IOException import java.util.* import kotlin.reflect.full.findAnnotation +import java.nio.file.Path abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFixtureTestCaseBase() { @@ -68,6 +69,8 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix protected fun testDataFile(): File = testDataFile(fileName()) + protected fun testDataFilePath(): Path = testDataFile().toPath() + protected fun testPath(fileName: String = fileName()): String = testDataFile(fileName).toString() protected fun testPath(): String = testPath(fileName()) diff --git a/idea/tests/org/jetbrains/kotlin/FirTestUtils.kt b/idea/tests/org/jetbrains/kotlin/FirTestUtils.kt index be11365a623..b83af9d8114 100644 --- a/idea/tests/org/jetbrains/kotlin/FirTestUtils.kt +++ b/idea/tests/org/jetbrains/kotlin/FirTestUtils.kt @@ -7,9 +7,6 @@ package org.jetbrains.kotlin import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.application.runReadAction -import com.intellij.openapi.util.io.FileUtil -import org.jetbrains.kotlin.test.InTextDirectivesUtils -import java.io.File fun executeOnPooledThreadInReadAction(action: () -> R): R? { var exception: Exception? = null @@ -26,23 +23,4 @@ fun executeOnPooledThreadInReadAction(action: () -> R): R? { throw this } return result -} - -inline fun doTestWithFIRFlagsByPath(path: String, body: () -> Unit) = - doTestWithFIRFlags(FileUtil.loadFile(File(path)), body) - -inline fun doTestWithFIRFlags(mainFileText: String, body: () -> Unit) { - - if (InTextDirectivesUtils.isDirectiveDefined(mainFileText, "FIR_IGNORE")) return - val isFirComparison = InTextDirectivesUtils.isDirectiveDefined(mainFileText, "FIR_COMPARISON") - - try { - body() - } catch (e: Throwable) { - if (isFirComparison) throw e - return - } - if (!isFirComparison) { - throw AssertionError("Looks like test is passing, please add // FIR_COMPARISON at the beginning of the file") - } } \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/findUsages/AbstractFindUsagesTest.kt b/idea/tests/org/jetbrains/kotlin/findUsages/AbstractFindUsagesTest.kt index 24bdaf08624..4aef720429a 100644 --- a/idea/tests/org/jetbrains/kotlin/findUsages/AbstractFindUsagesTest.kt +++ b/idea/tests/org/jetbrains/kotlin/findUsages/AbstractFindUsagesTest.kt @@ -38,7 +38,6 @@ import com.intellij.usages.impl.rules.UsageTypeProvider import com.intellij.usages.rules.UsageFilteringRule import com.intellij.usages.rules.UsageGroupingRule import com.intellij.util.CommonProcessors -import org.jetbrains.kotlin.doTestWithFIRFlagsByPath import org.jetbrains.kotlin.executeOnPooledThreadInReadAction import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithAllCompilerChecks import org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager @@ -59,21 +58,6 @@ import java.io.File import java.util.* import kotlin.collections.LinkedHashSet -abstract class AbstractFindUsagesWithDisableComponentSearchFirTest : AbstractFindUsagesWithDisableComponentSearchTest() { - override fun isFirPlugin(): Boolean = true - - override fun doTest(path: String) = doTestWithFIRFlagsByPath(path) { - super.doTest(path) - } -} - -abstract class AbstractFindUsagesFirTest : AbstractFindUsagesTest() { - override fun isFirPlugin(): Boolean = true - - override fun doTest(path: String) = doTestWithFIRFlagsByPath(path) { - super.doTest(path) - } -} abstract class AbstractFindUsagesWithDisableComponentSearchTest : AbstractFindUsagesTest() { diff --git a/idea/tests/org/jetbrains/kotlin/findUsages/AbstractKotlinFindUsagesWithLibraryTest.kt b/idea/tests/org/jetbrains/kotlin/findUsages/AbstractKotlinFindUsagesWithLibraryTest.kt index e6a79323fbb..0268bd69fcc 100644 --- a/idea/tests/org/jetbrains/kotlin/findUsages/AbstractKotlinFindUsagesWithLibraryTest.kt +++ b/idea/tests/org/jetbrains/kotlin/findUsages/AbstractKotlinFindUsagesWithLibraryTest.kt @@ -1,23 +1,13 @@ /* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.findUsages -import com.intellij.psi.PsiElement -import org.jetbrains.kotlin.doTestWithFIRFlagsByPath import org.jetbrains.kotlin.idea.test.PluginTestCaseBase import org.jetbrains.kotlin.idea.test.SdkAndMockLibraryProjectDescriptor -abstract class AbstractKotlinFindUsagesWithLibraryFirTest : AbstractKotlinFindUsagesWithLibraryTest() { - override fun isFirPlugin(): Boolean = true - - override fun doTest(path: String) = doTestWithFIRFlagsByPath(path) { - super.doTest(path) - } -} - abstract class AbstractKotlinFindUsagesWithLibraryTest : AbstractFindUsagesTest() { override fun getProjectDescriptor() = SdkAndMockLibraryProjectDescriptor( diff --git a/idea/tests/org/jetbrains/kotlin/findUsages/AbstractKotlinFindUsagesWithStdlibTest.kt b/idea/tests/org/jetbrains/kotlin/findUsages/AbstractKotlinFindUsagesWithStdlibTest.kt index d8ce3617fe6..f3e6923e74a 100644 --- a/idea/tests/org/jetbrains/kotlin/findUsages/AbstractKotlinFindUsagesWithStdlibTest.kt +++ b/idea/tests/org/jetbrains/kotlin/findUsages/AbstractKotlinFindUsagesWithStdlibTest.kt @@ -1,22 +1,12 @@ /* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.findUsages -import com.intellij.psi.PsiElement -import org.jetbrains.kotlin.doTestWithFIRFlagsByPath import org.jetbrains.kotlin.idea.test.KotlinJdkAndMultiplatformStdlibDescriptor -abstract class AbstractKotlinFindUsagesWithStdlibFirTest : AbstractKotlinFindUsagesWithStdlibTest() { - override fun isFirPlugin(): Boolean = true - - override fun doTest(path: String) = doTestWithFIRFlagsByPath(path) { - super.doTest(path) - } -} - abstract class AbstractKotlinFindUsagesWithStdlibTest : AbstractFindUsagesTest() { override fun getProjectDescriptor() = KotlinJdkAndMultiplatformStdlibDescriptor.JDK_AND_MULTIPLATFORM_STDLIB_WITH_SOURCES From 7a86ca632d84a32024eeae36d980dadc6207800e Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Fri, 13 Nov 2020 10:45:55 +0300 Subject: [PATCH 040/698] FIR IDE: fix collecting diagnostics for anonymous object declaration --- .../kotlin/idea/fir/low/level/api/util/utils.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/util/utils.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/util/utils.kt index 21ca3151730..b364ea19056 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/util/utils.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/util/utils.kt @@ -14,9 +14,10 @@ import org.jetbrains.kotlin.fir.psi import org.jetbrains.kotlin.fir.render import org.jetbrains.kotlin.idea.caches.project.IdeaModuleInfo import org.jetbrains.kotlin.idea.util.getElementTextInContext -import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.psi.KtElement +import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.psi.KtObjectLiteralExpression import java.util.concurrent.TimeUnit import java.util.concurrent.locks.Lock @@ -63,8 +64,10 @@ internal val FirDeclaration.ktDeclaration: KtDeclaration get() { val psi = psi ?: error("PSI element was not found for${render()}") - return psi as? KtDeclaration - ?: error( + return when (psi) { + is KtDeclaration -> psi + is KtObjectLiteralExpression -> psi.objectDeclaration + else -> error( """ FirDeclaration.psi (${this::class.simpleName}) should be KtDeclaration but was ${psi::class.simpleName} ${(psi as? KtElement)?.getElementTextInContext() ?: psi.text} @@ -72,6 +75,7 @@ internal val FirDeclaration.ktDeclaration: KtDeclaration ${render()} """.trimIndent() ) + } } internal val FirDeclaration.containingKtFileIfAny: KtFile? From be95d067f368015603cc62f9bb83d12e43d60a2f Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Fri, 13 Nov 2020 19:52:41 +0300 Subject: [PATCH 041/698] FIR IDE: add KotlinOutOfBlockPsiTreeChangePreprocessor --- .../KotlinFirOutOfBlockModificationTracker.kt | 10 +---- ...FirOutOfBlockModificationTrackerFactory.kt | 2 +- ...tlinOutOfBlockPsiTreeChangePreprocessor.kt | 37 +++++++++++++++++++ idea/resources-fir/META-INF/plugin.xml | 1 + 4 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinOutOfBlockPsiTreeChangePreprocessor.kt diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTracker.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTracker.kt index 51d2b77502d..0c47acf9818 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTracker.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTracker.kt @@ -18,7 +18,6 @@ import com.intellij.pom.event.PomModelEvent import com.intellij.pom.event.PomModelListener import com.intellij.pom.tree.TreeAspect import com.intellij.pom.tree.events.TreeChangeEvent -import org.jetbrains.annotations.TestOnly import org.jetbrains.kotlin.idea.KotlinLanguage import org.jetbrains.kotlin.idea.fir.low.level.api.element.builder.getNonLocalContainingInBodyDeclarationWith import org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileElementFactory @@ -36,17 +35,12 @@ internal class KotlinFirModificationTrackerService(project: Project) : Disposabl fun getOutOfBlockModificationCountForModules(module: Module): Long = moduleModificationsState.getModificationsCountForModule(module) - @TestOnly - fun incrementModificationsCount() { - increaseModificationCountForAllModules() - } - private val moduleModificationsState = ModuleModificationsState() private val treeAspect = TreeAspect.getInstance(project) override fun dispose() {} - private fun increaseModificationCountForAllModules() { + fun increaseModificationCountForAllModules() { projectGlobalOutOfBlockInKotlinFilesModificationCount++ moduleModificationsState.increaseModificationCountForAllModules() } @@ -130,7 +124,7 @@ private class ModuleModificationsState { modificationCountForModule.compute(module) { _, modifications -> when (modifications) { null -> ModuleModifications(0, state) - else -> ModuleModifications(ModuleModifications(0, state).modificationsCount + 1, state) + else -> ModuleModifications(modifications.modificationsCount + 1, state) } } } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTrackerFactory.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTrackerFactory.kt index 28d090422e4..a5ab7fdee93 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTrackerFactory.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTrackerFactory.kt @@ -20,7 +20,7 @@ class KotlinFirOutOfBlockModificationTrackerFactory(private val project: Project @TestOnly fun incrementModificationsCount() { - project.service().incrementModificationsCount() + project.service().increaseModificationCountForAllModules() } } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinOutOfBlockPsiTreeChangePreprocessor.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinOutOfBlockPsiTreeChangePreprocessor.kt new file mode 100644 index 00000000000..453aa360291 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinOutOfBlockPsiTreeChangePreprocessor.kt @@ -0,0 +1,37 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.fir.low.level.api.trackers + +import com.intellij.openapi.components.service +import com.intellij.openapi.project.Project +import com.intellij.psi.PsiDirectory +import com.intellij.psi.PsiTreeChangeEvent +import com.intellij.psi.impl.PsiModificationTrackerImpl +import com.intellij.psi.impl.PsiTreeChangeEventImpl +import com.intellij.psi.impl.PsiTreeChangePreprocessor + +class KotlinOutOfBlockPsiTreeChangePreprocessor(private val project: Project) : PsiTreeChangePreprocessor { + override fun treeChanged(event: PsiTreeChangeEventImpl) { + if (!PsiModificationTrackerImpl.canAffectPsi(event)) return + if (event.isOutOfBlockChange()) { + incrementModificationsCount() + } + } + + private fun incrementModificationsCount() { + project.service().increaseModificationCountForAllModules() + } + + // Copy logic from PsiModificationTrackerImpl.treeChanged(). Some out-of-code-block events are written to language modification + // tracker in PsiModificationTrackerImpl but don't have correspondent PomModelEvent. Increase kotlinOutOfCodeBlockTracker + // manually if needed. + private fun PsiTreeChangeEventImpl.isOutOfBlockChange() = when (code) { + PsiTreeChangeEventImpl.PsiEventType.PROPERTY_CHANGED -> + propertyName === PsiTreeChangeEvent.PROP_UNLOADED_PSI || propertyName === PsiTreeChangeEvent.PROP_ROOTS + PsiTreeChangeEventImpl.PsiEventType.CHILD_MOVED -> oldParent is PsiDirectory || newParent is PsiDirectory + else -> parent is PsiDirectory + } +} \ No newline at end of file diff --git a/idea/resources-fir/META-INF/plugin.xml b/idea/resources-fir/META-INF/plugin.xml index 418756c6f64..80f50a1d5d6 100644 --- a/idea/resources-fir/META-INF/plugin.xml +++ b/idea/resources-fir/META-INF/plugin.xml @@ -113,6 +113,7 @@ The Kotlin FIR plugin provides language support in IntelliJ IDEA and Android Stu + From b31def0bae3ae01322fb2fe731048fb3cd47cf82 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Fri, 13 Nov 2020 19:58:05 +0300 Subject: [PATCH 042/698] FIR IDE: invalidate analysis session on project roots change --- .../idea/frontend/api/fir/KtFirAnalysisSessionProvider.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSessionProvider.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSessionProvider.kt index 75e6fcdad89..3497ef52c73 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSessionProvider.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSessionProvider.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.idea.frontend.api.fir import com.intellij.openapi.project.Project +import com.intellij.openapi.roots.ProjectRootModificationTracker import com.intellij.psi.util.CachedValueProvider import com.intellij.psi.util.CachedValuesManager import com.intellij.psi.util.PsiModificationTracker @@ -21,12 +22,13 @@ import org.jetbrains.kotlin.psi.KtElement import java.util.concurrent.ConcurrentHashMap @OptIn(InvalidWayOfUsingAnalysisSession::class) -internal class KtFirAnalysisSessionProvider(project: Project) : KtAnalysisSessionProvider() { +class KtFirAnalysisSessionProvider(project: Project) : KtAnalysisSessionProvider() { private val analysisSessionByModuleInfoCache = CachedValuesManager.getManager(project).createCachedValue { CachedValueProvider.Result( ConcurrentHashMap(), - PsiModificationTracker.MODIFICATION_COUNT + PsiModificationTracker.MODIFICATION_COUNT, + ProjectRootModificationTracker.getInstance(project) ) } From bac5ebcb1200b2f45d097f0b5b2f03a69dcf1606 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Fri, 13 Nov 2020 20:11:19 +0300 Subject: [PATCH 043/698] FIR IDE: use custom thread local value for storing KtFirScopeProvider java.lang.ThreadLocal stores value maps in corresponding threads which causes memory leaks --- .../frontend/api/fir/utils/ThreadLocalDelegate.kt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/ThreadLocalDelegate.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/ThreadLocalDelegate.kt index 07916982163..8b14f66551f 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/ThreadLocalDelegate.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/ThreadLocalDelegate.kt @@ -5,13 +5,19 @@ package org.jetbrains.kotlin.idea.frontend.api.fir.utils +import java.util.concurrent.ConcurrentHashMap import kotlin.reflect.KProperty -internal class ThreadLocalValue(private val threadLocal: ThreadLocal) { +internal class ThreadLocalValue(private val init: () -> V) { + private val map = ConcurrentHashMap() + @Suppress("NOTHING_TO_INLINE") - inline operator fun getValue(thisRef: Any?, property: KProperty<*>): V = threadLocal.get() + inline operator fun getValue(thisRef: Any?, property: KProperty<*>): V = + map.computeIfAbsent(Thread.currentThread().id) { + init() + } } -internal inline fun threadLocal(crossinline init: () -> T): ThreadLocalValue = - ThreadLocalValue(ThreadLocal.withInitial { init() }) +internal fun threadLocal(init: () -> V): ThreadLocalValue = + ThreadLocalValue(init) From 7b1eef136ee218bdf5e835a9c6d19cc21e08adb9 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Fri, 6 Nov 2020 11:14:31 +0300 Subject: [PATCH 044/698] FIR IDE: introduce KtFirCollectionLiteralReference --- ...arationAndFirDeclarationEqualityChecker.kt | 18 +++++- .../KotlinFirReferenceContributor.kt | 1 + .../KtFirCollectionLiteralReference.kt | 59 +++++++++++++++++++ .../references/CollectionLiteralLeft.kt | 2 - .../references/CollectionLiteralRight.kt | 2 - 5 files changed, 77 insertions(+), 5 deletions(-) create mode 100644 idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/KtFirCollectionLiteralReference.kt diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/fir/KtDeclarationAndFirDeclarationEqualityChecker.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/fir/KtDeclarationAndFirDeclarationEqualityChecker.kt index 482a1e10eb8..1c4e704133f 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/fir/KtDeclarationAndFirDeclarationEqualityChecker.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/fir/KtDeclarationAndFirDeclarationEqualityChecker.kt @@ -16,6 +16,7 @@ import org.jetbrains.kotlin.fir.resolve.ScopeSession import org.jetbrains.kotlin.fir.scopes.FirScope import org.jetbrains.kotlin.fir.scopes.FirScopeProvider import org.jetbrains.kotlin.fir.scopes.FirTypeScope +import org.jetbrains.kotlin.fir.symbols.StandardClassIds import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.psi.KtFunction import org.jetbrains.kotlin.psi.KtTypeReference @@ -89,12 +90,27 @@ object KtDeclarationAndFirDeclarationEqualityChecker { else -> error("Invalid type reference $this") } return if (isVararg) { - "kotlin.Array" + rendered.asArrayType() } else { rendered } } + private fun String.asArrayType(): String { + classIdToName[this]?.let { return it } + return "kotlin.Array" + } + + @OptIn(ExperimentalStdlibApi::class) + private val classIdToName: Map = buildList { + StandardClassIds.primitiveArrayTypeByElementType.mapTo(this) { (classId, arrayClassId) -> + classId.asString().replace('/', '.') to arrayClassId.asString().replace('/', '.') + } + StandardClassIds.unsignedArrayTypeByElementType.mapTo(this) { (classId, arrayClassId) -> + classId.asString().replace('/', '.') to arrayClassId.asString().replace('/', '.') + } + }.toMap() + private fun FirTypeProjection.renderTypeAsKotlinType() = when (this) { is FirStarProjection -> "*" is FirTypeProjectionWithVariance -> buildString { diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/KotlinFirReferenceContributor.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/KotlinFirReferenceContributor.kt index 331371fe76e..10645d520c3 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/KotlinFirReferenceContributor.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/KotlinFirReferenceContributor.kt @@ -15,6 +15,7 @@ class KotlinFirReferenceContributor : KotlinReferenceProviderContributor { registerProvider(factory = ::KtFirDestructuringDeclarationReference) registerProvider(factory = ::KtFirArrayAccessReference) registerProvider(factory = ::KtFirConstructorDelegationReference) + registerProvider(factory = ::KtFirCollectionLiteralReference) } } } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/KtFirCollectionLiteralReference.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/KtFirCollectionLiteralReference.kt new file mode 100644 index 00000000000..1fdabf77e94 --- /dev/null +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/KtFirCollectionLiteralReference.kt @@ -0,0 +1,59 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.references + +import org.jetbrains.kotlin.fir.declarations.FirFunction +import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction +import org.jetbrains.kotlin.fir.expressions.FirArrayOfCall +import org.jetbrains.kotlin.fir.resolve.firSymbolProvider +import org.jetbrains.kotlin.fir.symbols.CallableId +import org.jetbrains.kotlin.fir.symbols.StandardClassIds +import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol +import org.jetbrains.kotlin.fir.types.ConeClassLikeType +import org.jetbrains.kotlin.fir.types.coneType +import org.jetbrains.kotlin.fir.types.coneTypeSafe +import org.jetbrains.kotlin.idea.fir.low.level.api.api.getOrBuildFirSafe +import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession +import org.jetbrains.kotlin.idea.frontend.api.fir.KtFirAnalysisSession +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSymbol +import org.jetbrains.kotlin.name.ClassId +import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.psi.KtCollectionLiteralExpression + +class KtFirCollectionLiteralReference( + expression: KtCollectionLiteralExpression +) : KtCollectionLiteralReference(expression), KtFirReference { + override fun KtAnalysisSession.resolveToSymbols(): Collection { + check(this is KtFirAnalysisSession) + val fir = element.getOrBuildFirSafe(firResolveState) ?: return emptyList() + val type = fir.typeRef.coneTypeSafe() ?: return listOfNotNull(arrayOfSymbol(arrayOf)) + val call = arrayTypeToArrayOfCall[type.lookupTag.classId] ?: arrayOf + return listOfNotNull(arrayOfSymbol(call)) + } + + private fun KtFirAnalysisSession.arrayOfSymbol(identifier: Name): KtSymbol? { + val fir = firResolveState.rootModuleSession.firSymbolProvider.getTopLevelCallableSymbols(kotlinPackage, identifier).firstOrNull { + /* choose (for byte array) + * public fun byteArrayOf(vararg elements: kotlin.Byte): kotlin.ByteArray + */ + (it as? FirFunctionSymbol<*>)?.fir?.valueParameters?.singleOrNull()?.isVararg == true + }?.fir as? FirSimpleFunction ?: return null + return firSymbolBuilder.buildFunctionSymbol(fir) + } + + companion object { + private val kotlinPackage = FqName("kotlin") + private val arrayOf = Name.identifier("arrayOf") + private val arrayTypeToArrayOfCall = run { + StandardClassIds.primitiveArrayTypeByElementType.values + StandardClassIds.unsignedArrayTypeByElementType.values + }.associateWith { it.correspondingArrayOfCallFqName() } + + private fun ClassId.correspondingArrayOfCallFqName(): Name = + Name.identifier("${shortClassName.identifier.decapitalize()}Of") + + } +} \ No newline at end of file diff --git a/idea/testData/resolve/references/CollectionLiteralLeft.kt b/idea/testData/resolve/references/CollectionLiteralLeft.kt index 8ce91bd0a38..6f14f4872a3 100644 --- a/idea/testData/resolve/references/CollectionLiteralLeft.kt +++ b/idea/testData/resolve/references/CollectionLiteralLeft.kt @@ -1,5 +1,3 @@ -// IGNORE_FIR - val abc = [1, 2, 3] // REF: (kotlin).arrayOf(vararg T) \ No newline at end of file diff --git a/idea/testData/resolve/references/CollectionLiteralRight.kt b/idea/testData/resolve/references/CollectionLiteralRight.kt index d78af345064..ca056e4de81 100644 --- a/idea/testData/resolve/references/CollectionLiteralRight.kt +++ b/idea/testData/resolve/references/CollectionLiteralRight.kt @@ -1,5 +1,3 @@ -// IGNORE_FIR - val abc: IntArray = [1, 2, 3] // REF: (kotlin).intArrayOf(vararg kotlin.Int) \ No newline at end of file From c4a8d1c3a190d906c31c6a5d76f94aa423878032 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Fri, 13 Nov 2020 22:03:54 +0300 Subject: [PATCH 045/698] FIR: use java functional interface as a source of sam function call --- .../src/org/jetbrains/kotlin/fir/resolve/SamResolution.kt | 1 + idea/testData/resolve/references/SamConstructor.kt | 2 -- idea/testData/resolve/references/SamConstructorTypeArguments.kt | 2 -- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SamResolution.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SamResolution.kt index 71cf35fa1d5..699027ec044 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SamResolution.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SamResolution.kt @@ -166,6 +166,7 @@ class FirSamResolverImpl( return buildSimpleFunction { session = firSession + source = firRegularClass.source name = classId.shortClassName origin = FirDeclarationOrigin.SamConstructor status = FirDeclarationStatusImpl(firRegularClass.visibility, Modality.FINAL).apply { diff --git a/idea/testData/resolve/references/SamConstructor.kt b/idea/testData/resolve/references/SamConstructor.kt index bef54bd1a78..a2416fa0833 100644 --- a/idea/testData/resolve/references/SamConstructor.kt +++ b/idea/testData/resolve/references/SamConstructor.kt @@ -1,5 +1,3 @@ -// IGNORE_FIR - val c = java.util.Comparator {(x: Int, y: Int) -> 1} // REF: (java.util).Comparator \ No newline at end of file diff --git a/idea/testData/resolve/references/SamConstructorTypeArguments.kt b/idea/testData/resolve/references/SamConstructorTypeArguments.kt index 9bfd20d38c1..18d850088b2 100644 --- a/idea/testData/resolve/references/SamConstructorTypeArguments.kt +++ b/idea/testData/resolve/references/SamConstructorTypeArguments.kt @@ -1,5 +1,3 @@ -// IGNORE_FIR - val c = java.util.Comparator { x, y -> 1 } // REF: (java.util).Comparator \ No newline at end of file From 2d4e9af28939cbfe7b6d6694fa62b01c828a571f Mon Sep 17 00:00:00 2001 From: Shagen Ogandzhanian Date: Mon, 23 Nov 2020 15:28:05 +0100 Subject: [PATCH 046/698] [JS IR] Throw exception if test class or test method has explicit parameter resolves https://youtrack.jetbrains.com/issue/KT-41032 --- .../ir/backend/js/lower/TestGenerator.kt | 80 +++++-- .../semantics/IrBoxJsES6TestGenerated.java | 5 + .../ir/semantics/IrBoxJsTestGenerated.java | 5 + .../js/test/semantics/BoxJsTestGenerated.java | 5 + .../box/kotlin.test/illegalParameters.kt | 196 ++++++++++++++++++ .../testData/box/kotlin.test/nested.kt | 4 +- 6 files changed, 273 insertions(+), 22 deletions(-) create mode 100644 js/js.translator/testData/box/kotlin.test/illegalParameters.kt diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/TestGenerator.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/TestGenerator.kt index ee3d9915f9c..21fb5e8eb31 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/TestGenerator.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/TestGenerator.kt @@ -6,21 +6,23 @@ package org.jetbrains.kotlin.ir.backend.js.lower import org.jetbrains.kotlin.backend.common.FileLoweringPass +import org.jetbrains.kotlin.backend.common.lower.createIrBuilder import org.jetbrains.kotlin.descriptors.ClassKind +import org.jetbrains.kotlin.descriptors.DescriptorVisibilities import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext import org.jetbrains.kotlin.ir.backend.js.ir.JsIrBuilder import org.jetbrains.kotlin.ir.builders.declarations.buildFun +import org.jetbrains.kotlin.ir.builders.irCall +import org.jetbrains.kotlin.ir.builders.irString import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.IrBlockBody import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.impl.IrConstructorCallImpl import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl -import org.jetbrains.kotlin.ir.util.defaultType -import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable -import org.jetbrains.kotlin.ir.util.isEffectivelyExternal +import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name @@ -37,26 +39,24 @@ class TestGenerator(val context: JsIrBackendContext, val testContainerFactory: ( override fun lower(irFile: IrFile) { irFile.declarations.forEach { if (it is IrClass) { - generateTestCalls(it) { suiteForPackage(irFile.fqName).function } + generateTestCalls(it) { suiteForPackage(irFile.fqName) } } // TODO top-level functions } } - private val packageSuites = mutableMapOf() + private val packageSuites = mutableMapOf() private fun suiteForPackage(fqName: FqName) = packageSuites.getOrPut(fqName) { context.suiteFun!!.createInvocation(fqName.asString(), testContainerFactory()) } - private data class FunctionWithBody(val function: IrSimpleFunction, val body: IrBlockBody) - private fun IrSimpleFunctionSymbol.createInvocation( name: String, parentFunction: IrSimpleFunction, ignored: Boolean = false - ): FunctionWithBody { + ): IrSimpleFunction { val body = context.irFactory.createBlockBody(UNDEFINED_OFFSET, UNDEFINED_OFFSET, emptyList()) val function = context.irFactory.buildFun { @@ -67,8 +67,7 @@ class TestGenerator(val context: JsIrBackendContext, val testContainerFactory: ( function.parent = parentFunction function.body = body - val parentBody = parentFunction.body as IrBlockBody - parentBody.statements += JsIrBuilder.buildCall(this).apply { + (parentFunction.body as IrBlockBody).statements += JsIrBuilder.buildCall(this).apply { putValueArgument(0, JsIrBuilder.buildString(context.irBuiltIns.stringType, name)) putValueArgument(1, JsIrBuilder.buildBoolean(context.irBuiltIns.booleanType, ignored)) @@ -76,13 +75,15 @@ class TestGenerator(val context: JsIrBackendContext, val testContainerFactory: ( putValueArgument(2, JsIrBuilder.buildFunctionExpression(refType, function)) } - return FunctionWithBody(function, body) + return function } private fun generateTestCalls(irClass: IrClass, parentFunction: () -> IrSimpleFunction) { if (irClass.modality == Modality.ABSTRACT || irClass.isEffectivelyExternal() || irClass.isExpect) return - val suiteFunBody by lazy { context.suiteFun!!.createInvocation(irClass.name.asString(), parentFunction(), irClass.isIgnored) } + val suiteFunBody by lazy { + context.suiteFun!!.createInvocation(irClass.name.asString(), parentFunction(), irClass.isIgnored) + } val beforeFunctions = irClass.declarations.filterIsInstance().filter { it.isBefore } val afterFunctions = irClass.declarations.filterIsInstance().filter { it.isAfter } @@ -90,10 +91,30 @@ class TestGenerator(val context: JsIrBackendContext, val testContainerFactory: ( irClass.declarations.forEach { when { it is IrClass -> - generateTestCalls(it) { suiteFunBody.function } + generateTestCalls(it) { suiteFunBody } it is IrSimpleFunction && it.isTest -> - generateCodeForTestMethod(it, beforeFunctions, afterFunctions, irClass, suiteFunBody.function) + generateCodeForTestMethod(it, beforeFunctions, afterFunctions, irClass, suiteFunBody) + } + } + } + + private fun IrDeclarationWithVisibility.isVisibleFromTests() = + (visibility == DescriptorVisibilities.PUBLIC) || (visibility == DescriptorVisibilities.INTERNAL) + + private fun IrDeclarationWithVisibility.isEffectivelyVisibleFromTests(): Boolean { + return generateSequence(this) { it.parent as? IrDeclarationWithVisibility }.all { + it.isVisibleFromTests() + } + } + + private fun IrClass.canBeInstantiated(): Boolean { + val isClassReachable = isEffectivelyVisibleFromTests() + return if (isObject) { + isClassReachable + } else { + isClassReachable && constructors.any { + it.isVisibleFromTests() && it.explicitParametersCount == if (isInner) 1 else 0 } } } @@ -105,7 +126,25 @@ class TestGenerator(val context: JsIrBackendContext, val testContainerFactory: ( irClass: IrClass, parentFunction: IrSimpleFunction ) { - val (fn, body) = context.testFun!!.createInvocation(testFun.name.asString(), parentFunction, testFun.isIgnored) + val fn = context.testFun!!.createInvocation(testFun.name.asString(), parentFunction, testFun.isIgnored) + val body = fn.body as IrBlockBody + + val exceptionMessage = when { + testFun.valueParameters.isNotEmpty() || !testFun.isEffectivelyVisibleFromTests() -> + "Test method ${irClass.fqNameWhenAvailable ?: irClass.name}::${testFun.name} should have public or internal visibility, can not have parameters" + !irClass.canBeInstantiated() -> + "Test class ${irClass.fqNameWhenAvailable ?: irClass.name} must declare a public or internal constructor with no explicit parameters" + else -> null + } + + if (exceptionMessage != null) { + val irBuilder = context.createIrBuilder(fn.symbol) + body.statements += irBuilder.irCall(context.irBuiltIns.illegalArgumentExceptionSymbol).apply { + putValueArgument(0, irBuilder.irString(exceptionMessage)) + } + + return + } val classVal = JsIrBuilder.buildVar(irClass.defaultType, fn, initializer = irClass.instance()) @@ -145,13 +184,14 @@ class TestGenerator(val context: JsIrBackendContext, val testContainerFactory: ( return if (kind == ClassKind.OBJECT) { JsIrBuilder.buildGetObjectValue(defaultType, symbol) } else { - declarations.asSequence().filterIsInstance().single { it.isPrimary }.let { constructor -> - IrConstructorCallImpl.fromSymbolOwner(defaultType, constructor.symbol).also { - if (isInner) { - it.dispatchReceiver = (parent as IrClass).instance() + declarations.asSequence().filterIsInstance().first { it.explicitParametersCount == if (isInner) 1 else 0 } + .let { constructor -> + IrConstructorCallImpl.fromSymbolOwner(defaultType, constructor.symbol).also { + if (isInner) { + it.dispatchReceiver = (parent as IrClass).instance() + } } } - } } } diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java index 9febd26bcd2..947af4adfc7 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java @@ -5401,6 +5401,11 @@ public class IrBoxJsES6TestGenerated extends AbstractIrBoxJsES6Test { runTest("js/js.translator/testData/box/kotlin.test/ignore.kt"); } + @TestMetadata("illegalParameters.kt") + public void testIllegalParameters() throws Exception { + runTest("js/js.translator/testData/box/kotlin.test/illegalParameters.kt"); + } + @TestMetadata("incremental.kt") public void testIncremental() throws Exception { runTest("js/js.translator/testData/box/kotlin.test/incremental.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java index f3f38e10b55..d5393fe7a60 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java @@ -5401,6 +5401,11 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest { runTest("js/js.translator/testData/box/kotlin.test/ignore.kt"); } + @TestMetadata("illegalParameters.kt") + public void testIllegalParameters() throws Exception { + runTest("js/js.translator/testData/box/kotlin.test/illegalParameters.kt"); + } + @TestMetadata("incremental.kt") public void testIncremental() throws Exception { runTest("js/js.translator/testData/box/kotlin.test/incremental.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java index e7cc60e9713..b8f16ffd577 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java @@ -5416,6 +5416,11 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest { runTest("js/js.translator/testData/box/kotlin.test/ignore.kt"); } + @TestMetadata("illegalParameters.kt") + public void testIllegalParameters() throws Exception { + runTest("js/js.translator/testData/box/kotlin.test/illegalParameters.kt"); + } + @TestMetadata("incremental.kt") public void testIncremental() throws Exception { runTest("js/js.translator/testData/box/kotlin.test/incremental.kt"); diff --git a/js/js.translator/testData/box/kotlin.test/illegalParameters.kt b/js/js.translator/testData/box/kotlin.test/illegalParameters.kt new file mode 100644 index 00000000000..ff92b5799dc --- /dev/null +++ b/js/js.translator/testData/box/kotlin.test/illegalParameters.kt @@ -0,0 +1,196 @@ +// IGNORE_BACKEND: JS +// KJS_WITH_FULL_RUNTIME +// SKIP_DCE_DRIVEN + +import common.* +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertTrue + +class BadClass(id: Int) { + @Test + fun foo() {} +} + +private class BadPrivateClass { + @Test + fun foo() {} +} + +class BadProtectedMethodClass { + @Test + protected fun foo() {} +} + +class BadPrimaryGoodSecondary(private val id: Int) { + constructor(): this(3) + @Test + fun foo() { + assertEquals(id, 3) + } +} + +class GoodSecondaryOnly { + constructor() { + triggered = 3 + } + constructor(id: Int) { + triggered = id + } + companion object { + private var triggered = 0 + } + @Test + fun foo() { + assertEquals(triggered, 3) + } +} + +class BadSecondaryOnly { + private constructor() {} + constructor(id: Int) {} + @Test + fun foo() {} +} + +class BadConstructorClass private constructor() { + @Test + fun foo() {} +} + +class BadProtectedConstructorClass protected constructor() { + constructor(flag: Boolean): this() + @Test + fun foo() {} +} + +class GoodClass() { + constructor(id: Int): this() + @Test + fun foo() {} +} + +class GoodNestedClass { + class NestedTestClass { + @Test + fun foo() {} + + fun helperMethod(param: String) {} + } +} + +class BadNestedClass { + class NestedTestClass(id: Int) { + @Test + fun foo() {} + } +} + +class BadMethodClass() { + @Test + fun foo(id: Int) {} + + @Test + private fun ping() {} +} + +// non-reachable scenarios are tested in nested.kt +class OuterWithPrivateCompanion { + private companion object { + object InnerCompanion { + @Test + fun innerCompanionTest() { + } + } + } +} + +class OuterWithPrivateMethod { + companion object { + object InnerCompanion { + @Test + private fun innerCompanionTest() { + } + } + } +} + +fun box() = checkLog { + suite("BadClass") { + test("foo") { + caught("Test class BadClass must declare a public or internal constructor with no explicit parameters") + } + } + suite("BadPrivateClass") { + test("foo") { + caught("Test method BadPrivateClass::foo should have public or internal visibility, can not have parameters") + } + } + suite("BadProtectedMethodClass") { + test("foo") { + caught("Test method BadProtectedMethodClass::foo should have public or internal visibility, can not have parameters") + } + } + suite("BadPrimaryGoodSecondary") { + test("foo") + } + suite("GoodSecondaryOnly") { + test("foo") + } + suite("BadSecondaryOnly") { + test("foo") { + caught("Test class BadSecondaryOnly must declare a public or internal constructor with no explicit parameters") + } + } + suite("BadConstructorClass") { + test("foo") { + caught("Test class BadConstructorClass must declare a public or internal constructor with no explicit parameters") + } + } + suite("BadProtectedConstructorClass") { + test("foo") { + caught("Test class BadProtectedConstructorClass must declare a public or internal constructor with no explicit parameters") + } + } + suite("GoodClass") { + test("foo") + } + suite("GoodNestedClass") { + suite("NestedTestClass") { + test("foo") + } + } + suite("BadNestedClass") { + suite("NestedTestClass") { + test("foo") { + caught("Test class BadNestedClass.NestedTestClass must declare a public or internal constructor with no explicit parameters") + } + } + } + suite("BadMethodClass") { + test("foo") { + caught("Test method BadMethodClass::foo should have public or internal visibility, can not have parameters") + } + test("ping") { + caught("Test method BadMethodClass::ping should have public or internal visibility, can not have parameters") + } + } + suite("OuterWithPrivateCompanion") { + suite("Companion") { + suite("InnerCompanion") { + test("innerCompanionTest") { + caught("Test method OuterWithPrivateCompanion.Companion.InnerCompanion::innerCompanionTest should have public or internal visibility, can not have parameters") + } + } + } + } + suite("OuterWithPrivateMethod") { + suite("Companion") { + suite("InnerCompanion") { + test("innerCompanionTest") { + caught("Test method OuterWithPrivateMethod.Companion.InnerCompanion::innerCompanionTest should have public or internal visibility, can not have parameters") + } + } + } + } +} \ No newline at end of file diff --git a/js/js.translator/testData/box/kotlin.test/nested.kt b/js/js.translator/testData/box/kotlin.test/nested.kt index 2c02cee72a0..d76ceb6bed2 100644 --- a/js/js.translator/testData/box/kotlin.test/nested.kt +++ b/js/js.translator/testData/box/kotlin.test/nested.kt @@ -20,7 +20,7 @@ class Outer { } inner class Inneer { - @Test fun inneerTest() { + @Test fun innermostTest() { call(prop + "Inneer") } } @@ -68,7 +68,7 @@ fun box() = checkLog { call("propInner") } suite("Inneer") { - test("inneerTest") { + test("innermostTest") { call("propInneer") } } From 20c7c4881d3e5b7782f20e6f2fbc8e5bbeee811e Mon Sep 17 00:00:00 2001 From: pyos Date: Mon, 23 Nov 2020 11:54:14 +0100 Subject: [PATCH 047/698] FIR: fix @JvmPackageName A single `JvmGeneratorExtensions` instance should be passed around. --- .../kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt | 6 ++++-- .../org/jetbrains/kotlin/fir/analysis/FirAnalyzerFacade.kt | 6 +++--- .../org/jetbrains/kotlin/fir/AbstractFir2IrTextTest.kt | 3 ++- .../org/jetbrains/kotlin/backend/jvm/JvmIrCodegenFactory.kt | 4 ++-- .../testData/compileKotlinAgainstKotlin/jvmPackageName.kt | 1 - .../jvmPackageNameInRootPackage.kt | 1 - .../jvmPackageNameMultifileClass.kt | 1 - .../compileKotlinAgainstKotlin/jvmPackageNameWithJvmName.kt | 1 - .../tests/org/jetbrains/kotlin/codegen/GenerationUtils.kt | 6 ++++-- 9 files changed, 15 insertions(+), 14 deletions(-) diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt index 4d7659ad974..a5a872f861a 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt @@ -30,6 +30,7 @@ import org.jetbrains.kotlin.asJava.finder.JavaElementFinder import org.jetbrains.kotlin.backend.common.output.OutputFileCollection import org.jetbrains.kotlin.backend.common.output.SimpleOutputFileCollection import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig +import org.jetbrains.kotlin.backend.jvm.JvmGeneratorExtensions import org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory import org.jetbrains.kotlin.backend.jvm.jvmPhases import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys @@ -356,7 +357,8 @@ object KotlinToJVMBytecodeCompiler { performanceManager?.notifyGenerationStarted() performanceManager?.notifyIRTranslationStarted() - val (moduleFragment, symbolTable, sourceManager, components) = firAnalyzerFacade.convertToIr() + val extensions = JvmGeneratorExtensions() + val (moduleFragment, symbolTable, sourceManager, components) = firAnalyzerFacade.convertToIr(extensions) performanceManager?.notifyIRTranslationFinished() @@ -392,7 +394,7 @@ object KotlinToJVMBytecodeCompiler { performanceManager?.notifyIRGenerationStarted() generationState.beforeCompile() codegenFactory.generateModuleInFrontendIRMode( - generationState, moduleFragment, symbolTable, sourceManager + generationState, moduleFragment, symbolTable, sourceManager, extensions ) { context, irClass, _, serializationBindings, parent -> FirMetadataSerializer(session, context, irClass, serializationBindings, parent) } diff --git a/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/analysis/FirAnalyzerFacade.kt b/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/analysis/FirAnalyzerFacade.kt index 0375bf49fae..0eb4608bb47 100644 --- a/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/analysis/FirAnalyzerFacade.kt +++ b/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/analysis/FirAnalyzerFacade.kt @@ -6,7 +6,6 @@ package org.jetbrains.kotlin.fir.analysis import org.jetbrains.kotlin.backend.common.serialization.signature.IdSignatureDescriptor -import org.jetbrains.kotlin.backend.jvm.JvmGeneratorExtensions import org.jetbrains.kotlin.config.LanguageVersionSettings import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.analysis.collectors.FirDiagnosticsCollector @@ -25,6 +24,7 @@ import org.jetbrains.kotlin.fir.resolve.transformers.FirTotalResolveProcessor import org.jetbrains.kotlin.ir.backend.jvm.serialization.JvmManglerDesc import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.psi2ir.generators.GeneratorExtensions class FirAnalyzerFacade(val session: FirSession, val languageVersionSettings: LanguageVersionSettings, val ktFiles: List) { private var firFiles: List? = null @@ -64,14 +64,14 @@ class FirAnalyzerFacade(val session: FirSession, val languageVersionSettings: La return collectedDiagnostics!! } - fun convertToIr(generateFacades: Boolean = true): Fir2IrResult { + fun convertToIr(extensions: GeneratorExtensions): Fir2IrResult { if (scopeSession == null) runResolution() val signaturer = IdSignatureDescriptor(JvmManglerDesc()) return Fir2IrConverter.createModuleFragment( session, scopeSession!!, firFiles!!, languageVersionSettings, signaturer, - JvmGeneratorExtensions(generateFacades), FirJvmKotlinMangler(session), IrFactoryImpl, + extensions, FirJvmKotlinMangler(session), IrFactoryImpl, FirJvmVisibilityConverter, Fir2IrJvmSpecialAnnotationSymbolProvider() ) diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/AbstractFir2IrTextTest.kt b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/AbstractFir2IrTextTest.kt index af22c6db478..15714781e03 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/AbstractFir2IrTextTest.kt +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/AbstractFir2IrTextTest.kt @@ -9,6 +9,7 @@ import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementFinder import com.intellij.psi.search.GlobalSearchScope import org.jetbrains.kotlin.asJava.finder.JavaElementFinder +import org.jetbrains.kotlin.backend.jvm.JvmGeneratorExtensions import org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM import org.jetbrains.kotlin.config.languageVersionSettings import org.jetbrains.kotlin.fir.analysis.FirAnalyzerFacade @@ -55,6 +56,6 @@ abstract class AbstractFir2IrTextTest : AbstractIrTextTestCase() { .uniteWith(TopDownAnalyzerFacadeForJVM.AllJavaSourcesInProjectScope(project)) val session = createSession(myEnvironment, scope) val firAnalyzerFacade = FirAnalyzerFacade(session, myEnvironment.configuration.languageVersionSettings, psiFiles) - return firAnalyzerFacade.convertToIr(generateFacades = false).irModuleFragment + return firAnalyzerFacade.convertToIr(JvmGeneratorExtensions(generateFacades = false)).irModuleFragment } } diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmIrCodegenFactory.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmIrCodegenFactory.kt index ce9cea31c30..096f6a87a7d 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmIrCodegenFactory.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmIrCodegenFactory.kt @@ -177,10 +177,10 @@ class JvmIrCodegenFactory(private val phaseConfig: PhaseConfig) : CodegenFactory irModuleFragment: IrModuleFragment, symbolTable: SymbolTable, sourceManager: PsiSourceManager, - serializerFactory: MetadataSerializerFactory, + extensions: JvmGeneratorExtensions, + serializerFactory: MetadataSerializerFactory ) { irModuleFragment.irBuiltins.functionFactory = IrFunctionFactory(irModuleFragment.irBuiltins, symbolTable) - val extensions = JvmGeneratorExtensions() val irProviders = generateTypicalIrProviderList( irModuleFragment.descriptor, irModuleFragment.irBuiltins, symbolTable, extensions = extensions ) diff --git a/compiler/testData/compileKotlinAgainstKotlin/jvmPackageName.kt b/compiler/testData/compileKotlinAgainstKotlin/jvmPackageName.kt index 5348559e419..8cc09416ed6 100644 --- a/compiler/testData/compileKotlinAgainstKotlin/jvmPackageName.kt +++ b/compiler/testData/compileKotlinAgainstKotlin/jvmPackageName.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // FILE: A.kt diff --git a/compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameInRootPackage.kt b/compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameInRootPackage.kt index dce9cf9122c..7cf60d73870 100644 --- a/compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameInRootPackage.kt +++ b/compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameInRootPackage.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // FILE: A.kt diff --git a/compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameMultifileClass.kt b/compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameMultifileClass.kt index b084855bffc..fc80cf8849d 100644 --- a/compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameMultifileClass.kt +++ b/compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameMultifileClass.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_RUNTIME diff --git a/compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameWithJvmName.kt b/compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameWithJvmName.kt index ab2aed19372..29bcde0e05b 100644 --- a/compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameWithJvmName.kt +++ b/compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameWithJvmName.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // FILE: A.kt diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/GenerationUtils.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/GenerationUtils.kt index 28b226c4e67..64e4599617e 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/GenerationUtils.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/GenerationUtils.kt @@ -24,6 +24,7 @@ import org.jetbrains.kotlin.TestsCompiletimeError import org.jetbrains.kotlin.analyzer.AnalysisResult import org.jetbrains.kotlin.asJava.finder.JavaElementFinder import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig +import org.jetbrains.kotlin.backend.jvm.JvmGeneratorExtensions import org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory import org.jetbrains.kotlin.backend.jvm.jvmPhases import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys @@ -118,7 +119,8 @@ object GenerationUtils { // TODO: add running checkers and check that it's safe to compile val firAnalyzerFacade = FirAnalyzerFacade(session, configuration.languageVersionSettings, files) - val (moduleFragment, symbolTable, sourceManager, components) = firAnalyzerFacade.convertToIr() + val extensions = JvmGeneratorExtensions() + val (moduleFragment, symbolTable, sourceManager, components) = firAnalyzerFacade.convertToIr(extensions) val dummyBindingContext = NoScopeRecordCliBindingTrace().bindingContext val codegenFactory = JvmIrCodegenFactory(configuration.get(CLIConfigurationKeys.PHASE_CONFIG) ?: PhaseConfig(jvmPhases)) @@ -140,7 +142,7 @@ object GenerationUtils { generationState.beforeCompile() codegenFactory.generateModuleInFrontendIRMode( - generationState, moduleFragment, symbolTable, sourceManager + generationState, moduleFragment, symbolTable, sourceManager, extensions ) { context, irClass, _, serializationBindings, parent -> FirMetadataSerializer(session, context, irClass, serializationBindings, parent) } From d98007462421b66aa648995c692301b573b4cfd3 Mon Sep 17 00:00:00 2001 From: pyos Date: Mon, 23 Nov 2020 10:11:11 +0100 Subject: [PATCH 048/698] FIR: deserialize the `fun interface` flag --- .../jetbrains/kotlin/fir/deserialization/ClassDeserialization.kt | 1 + .../compileKotlinAgainstKotlin/useDeserializedFunInterface.kt | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/ClassDeserialization.kt b/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/ClassDeserialization.kt index da46bd7f3a5..38bbaa68b48 100644 --- a/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/ClassDeserialization.kt +++ b/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/ClassDeserialization.kt @@ -69,6 +69,7 @@ fun deserializeClassToSymbol( isData = Flags.IS_DATA.get(classProto.flags) isInline = Flags.IS_INLINE_CLASS.get(classProto.flags) isExternal = Flags.IS_EXTERNAL_CLASS.get(classProto.flags) + isFun = Flags.IS_FUN_INTERFACE.get(classProto.flags) } val isSealed = modality == Modality.SEALED val annotationDeserializer = defaultAnnotationDeserializer ?: FirBuiltinAnnotationDeserializer(session) diff --git a/compiler/testData/compileKotlinAgainstKotlin/useDeserializedFunInterface.kt b/compiler/testData/compileKotlinAgainstKotlin/useDeserializedFunInterface.kt index 70f94c83c2c..06c13da3428 100644 --- a/compiler/testData/compileKotlinAgainstKotlin/useDeserializedFunInterface.kt +++ b/compiler/testData/compileKotlinAgainstKotlin/useDeserializedFunInterface.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions // FILE: A.kt From eff4cec3e080f0854d5894ee35c1b8e497523534 Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Tue, 17 Nov 2020 14:32:25 -0800 Subject: [PATCH 049/698] FIR2IR: convert annotations on delegated members --- .../kotlin/fir/backend/Fir2IrConverter.kt | 1 - .../fir/backend/Fir2IrDeclarationStorage.kt | 2 +- .../generators/DelegatedMemberGenerator.kt | 15 +++++++++++---- .../codegen/box/throws/delegationAndThrows_1_3.kt | 1 - .../delegationAndAnnotations.kt | 1 - ...delegatedImplementationOfJavaInterface.fir.txt | 4 ++++ .../annotationsOnDelegatedMembers.fir.txt | 8 ++++++++ .../annotations/inheritingDeprecation.fir.txt | 4 ++++ 8 files changed, 28 insertions(+), 8 deletions(-) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrConverter.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrConverter.kt index 96143f9d7fd..0af484968fe 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrConverter.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrConverter.kt @@ -301,7 +301,6 @@ class Fir2IrConverter( components.fakeOverrideGenerator = fakeOverrideGenerator val callGenerator = CallAndReferenceGenerator(components, fir2irVisitor, conversionScope) components.callGenerator = callGenerator - declarationStorage.annotationGenerator = AnnotationGenerator(components) for (firFile in firFiles) { converter.processClassHeaders(firFile) } diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt index 8ff7a8d15c2..d7597de16ac 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt @@ -59,7 +59,7 @@ class Fir2IrDeclarationStorage( private val moduleDescriptor: FirModuleDescriptor ) : Fir2IrComponents by components { - internal var annotationGenerator: AnnotationGenerator? = null + private val annotationGenerator = AnnotationGenerator(this) private val firSymbolProvider = session.firSymbolProvider diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DelegatedMemberGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DelegatedMemberGenerator.kt index b6731e79305..9fa86e6c578 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DelegatedMemberGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DelegatedMemberGenerator.kt @@ -36,6 +36,8 @@ internal class DelegatedMemberGenerator( private val components: Fir2IrComponents ) : Fir2IrComponents by components { + private val annotationGenerator = AnnotationGenerator(this) + // Generate delegated members for [subClass]. The synthetic field [irField] has the super interface type. fun generate(irField: IrField, firField: FirField, firSubClass: FirClass<*>, subClass: IrClass) { val subClassLookupTag = firSubClass.symbol.toLookupTag() @@ -76,11 +78,12 @@ internal class DelegatedMemberGenerator( val member = declarationStorage.getIrPropertySymbol(unwrapped.symbol).owner as? IrProperty ?: return@processAllProperties - val irSubFunction = - generateDelegatedProperty(subClass, firSubClass, irField, member, propertySymbol.fir) + val irSubProperty = generateDelegatedProperty( + subClass, firSubClass, irField, member, propertySymbol.fir + ) - declarationStorage.cacheDelegatedProperty(propertySymbol.fir, irSubFunction) - subClass.addMember(irSubFunction) + declarationStorage.cacheDelegatedProperty(propertySymbol.fir, irSubProperty) + subClass.addMember(irSubProperty) } } @@ -135,6 +138,7 @@ internal class DelegatedMemberGenerator( delegateFunction.overriddenSymbols = delegateOverride.generateOverriddenFunctionSymbols(firSubClass, session, scopeSession, declarationStorage) .filter { it.owner != delegateFunction } + annotationGenerator.generate(delegateFunction, delegateOverride) val body = createDelegateBody(irField, delegateFunction, superFunction) delegateFunction.body = body @@ -197,16 +201,19 @@ internal class DelegatedMemberGenerator( firDelegateProperty, subClass, origin = IrDeclarationOrigin.DELEGATED_MEMBER, containingClass = firSubClass.symbol.toLookupTag() ) + annotationGenerator.generate(delegateProperty, firDelegateProperty) delegateProperty.getter!!.body = createDelegateBody(irField, delegateProperty.getter!!, superProperty.getter!!) delegateProperty.getter!!.overriddenSymbols = firDelegateProperty.generateOverriddenAccessorSymbols(firSubClass, isGetter = true, session, scopeSession, declarationStorage) + annotationGenerator.generate(delegateProperty.getter!!, firDelegateProperty) if (delegateProperty.isVar) { delegateProperty.setter!!.body = createDelegateBody(irField, delegateProperty.setter!!, superProperty.setter!!) delegateProperty.setter!!.overriddenSymbols = firDelegateProperty.generateOverriddenAccessorSymbols( firSubClass, isGetter = false, session, scopeSession, declarationStorage ) + annotationGenerator.generate(delegateProperty.setter!!, firDelegateProperty) } return delegateProperty diff --git a/compiler/testData/codegen/box/throws/delegationAndThrows_1_3.kt b/compiler/testData/codegen/box/throws/delegationAndThrows_1_3.kt index aca94e5bbc1..d14249a7759 100644 --- a/compiler/testData/codegen/box/throws/delegationAndThrows_1_3.kt +++ b/compiler/testData/codegen/box/throws/delegationAndThrows_1_3.kt @@ -1,6 +1,5 @@ // !LANGUAGE: -DoNotGenerateThrowsForDelegatedKotlinMembers // TARGET_BACKEND: JVM -// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME // FILE: A.kt diff --git a/compiler/testData/compileKotlinAgainstKotlin/delegationAndAnnotations.kt b/compiler/testData/compileKotlinAgainstKotlin/delegationAndAnnotations.kt index b891ac615c5..0fe888bdeb5 100644 --- a/compiler/testData/compileKotlinAgainstKotlin/delegationAndAnnotations.kt +++ b/compiler/testData/compileKotlinAgainstKotlin/delegationAndAnnotations.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_RUNTIME // FILE: A.kt diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.fir.txt b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.fir.txt index d415e70da09..49e7a896708 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.fir.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.fir.txt @@ -51,6 +51,8 @@ FILE fqName: fileName:/delegatedImplementationOfJavaInterface.kt receiver: GET_VAR ': .Test declared in .Test.takeFlexible' type=.Test origin=null x: GET_VAR 'x: kotlin.String? declared in .Test.takeFlexible' type=kotlin.String? origin=null FUN DELEGATED_MEMBER name:returnNotNull visibility:public modality:OPEN <> ($this:.Test) returnType:@[EnhancedNullability] kotlin.String + annotations: + NotNull(value = ) overridden: public abstract fun returnNotNull (): @[EnhancedNullability] kotlin.String declared in .J $this: VALUE_PARAMETER name: type:.Test @@ -60,6 +62,8 @@ FILE fqName: fileName:/delegatedImplementationOfJavaInterface.kt $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.J visibility:local [final]' type=.J origin=null receiver: GET_VAR ': .Test declared in .Test.returnNotNull' type=.Test origin=null FUN DELEGATED_MEMBER name:returnNullable visibility:public modality:OPEN <> ($this:.Test) returnType:@[FlexibleNullability] kotlin.String? + annotations: + Nullable(value = ) overridden: public abstract fun returnNullable (): @[FlexibleNullability] kotlin.String? declared in .J $this: VALUE_PARAMETER name: type:.Test diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.txt index 230b63660fb..6eae326f169 100644 --- a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.txt +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.txt @@ -63,6 +63,8 @@ FILE fqName: fileName:/annotationsOnDelegatedMembers.kt receiver: GET_VAR ': .DFoo declared in .DFoo' type=.DFoo origin=null value: GET_VAR 'd: .IFoo declared in .DFoo.' type=.IFoo origin=null FUN DELEGATED_MEMBER name:testFun visibility:public modality:OPEN <> ($this:.DFoo) returnType:kotlin.Unit + annotations: + Ann overridden: public abstract fun testFun (): kotlin.Unit declared in .IFoo $this: VALUE_PARAMETER name: type:.DFoo @@ -71,6 +73,8 @@ FILE fqName: fileName:/annotationsOnDelegatedMembers.kt $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final]' type=.IFoo origin=null receiver: GET_VAR ': .DFoo declared in .DFoo.testFun' type=.DFoo origin=null FUN DELEGATED_MEMBER name:testExtFun visibility:public modality:OPEN <> ($this:.DFoo, $receiver:kotlin.String) returnType:kotlin.Unit + annotations: + Ann overridden: public abstract fun testExtFun (): kotlin.Unit declared in .IFoo $this: VALUE_PARAMETER name: type:.DFoo @@ -81,6 +85,8 @@ FILE fqName: fileName:/annotationsOnDelegatedMembers.kt receiver: GET_VAR ': .DFoo declared in .DFoo.testExtFun' type=.DFoo origin=null $receiver: GET_VAR ': kotlin.String declared in .DFoo.testExtFun' type=kotlin.String origin=null PROPERTY DELEGATED_MEMBER name:testVal visibility:public modality:OPEN [val] + annotations: + Ann FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.DFoo) returnType:kotlin.String correspondingProperty: PROPERTY DELEGATED_MEMBER name:testVal visibility:public modality:OPEN [val] overridden: @@ -92,6 +98,8 @@ FILE fqName: fileName:/annotationsOnDelegatedMembers.kt $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final]' type=.IFoo origin=null receiver: GET_VAR ': .DFoo declared in .DFoo.' type=.DFoo origin=null PROPERTY DELEGATED_MEMBER name:testExtVal visibility:public modality:OPEN [val] + annotations: + Ann FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.DFoo, $receiver:kotlin.String) returnType:kotlin.String correspondingProperty: PROPERTY DELEGATED_MEMBER name:testExtVal visibility:public modality:OPEN [val] overridden: diff --git a/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.fir.txt b/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.fir.txt index df51d7b9442..64901ed4215 100644 --- a/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.fir.txt +++ b/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.fir.txt @@ -44,6 +44,8 @@ FILE fqName: fileName:/inheritingDeprecation.kt receiver: GET_VAR ': .Delegated declared in .Delegated' type=.Delegated origin=null value: GET_VAR 'foo: .IFoo declared in .Delegated.' type=.IFoo origin=null PROPERTY DELEGATED_MEMBER name:prop visibility:public modality:OPEN [val] + annotations: + Deprecated(message = '', replaceWith = , level = ) FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.Delegated) returnType:kotlin.String correspondingProperty: PROPERTY DELEGATED_MEMBER name:prop visibility:public modality:OPEN [val] overridden: @@ -55,6 +57,8 @@ FILE fqName: fileName:/inheritingDeprecation.kt $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final]' type=.IFoo origin=null receiver: GET_VAR ': .Delegated declared in .Delegated.' type=.Delegated origin=null PROPERTY DELEGATED_MEMBER name:extProp visibility:public modality:OPEN [val] + annotations: + Deprecated(message = '', replaceWith = , level = ) FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.Delegated, $receiver:kotlin.String) returnType:kotlin.String correspondingProperty: PROPERTY DELEGATED_MEMBER name:extProp visibility:public modality:OPEN [val] overridden: From f9a032dbface4c8ac56dc1f0a0783034ff63023b Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Wed, 18 Nov 2020 12:54:31 -0800 Subject: [PATCH 050/698] FIR2IR: add AnnotationGenerator to Fir2IrComponents --- .../jetbrains/kotlin/fir/backend/Fir2IrComponents.kt | 8 +++++++- .../kotlin/fir/backend/Fir2IrComponentsStorage.kt | 12 ++++++++---- .../jetbrains/kotlin/fir/backend/Fir2IrConverter.kt | 2 ++ .../kotlin/fir/backend/Fir2IrDeclarationStorage.kt | 3 --- .../kotlin/fir/backend/Fir2IrTypeConverter.kt | 2 -- .../jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt | 3 --- .../fir/backend/generators/AnnotationGenerator.kt | 2 +- .../fir/backend/generators/ClassMemberGenerator.kt | 2 -- .../backend/generators/DelegatedMemberGenerator.kt | 2 -- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrComponents.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrComponents.kt index 62766f002b3..2a23ed2bad3 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrComponents.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrComponents.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.fir.backend import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.backend.generators.AnnotationGenerator import org.jetbrains.kotlin.fir.backend.generators.CallAndReferenceGenerator import org.jetbrains.kotlin.fir.backend.generators.FakeOverrideGenerator import org.jetbrains.kotlin.fir.resolve.ScopeSession @@ -16,15 +17,20 @@ import org.jetbrains.kotlin.ir.util.SymbolTable interface Fir2IrComponents { val session: FirSession val scopeSession: ScopeSession + val symbolTable: SymbolTable val irBuiltIns: IrBuiltIns val builtIns: Fir2IrBuiltIns val irFactory: IrFactory + val classifierStorage: Fir2IrClassifierStorage val declarationStorage: Fir2IrDeclarationStorage + val typeConverter: Fir2IrTypeConverter val signatureComposer: Fir2IrSignatureComposer + val visibilityConverter: Fir2IrVisibilityConverter + + val annotationGenerator: AnnotationGenerator val callGenerator: CallAndReferenceGenerator val fakeOverrideGenerator: FakeOverrideGenerator - val visibilityConverter: Fir2IrVisibilityConverter } diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrComponentsStorage.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrComponentsStorage.kt index 873ded8266b..3d59526ecef 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrComponentsStorage.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrComponentsStorage.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.fir.backend import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.backend.generators.AnnotationGenerator import org.jetbrains.kotlin.fir.backend.generators.CallAndReferenceGenerator import org.jetbrains.kotlin.fir.backend.generators.FakeOverrideGenerator import org.jetbrains.kotlin.fir.resolve.ScopeSession @@ -25,11 +26,14 @@ class Fir2IrComponentsStorage( ) : Fir2IrComponents { override lateinit var classifierStorage: Fir2IrClassifierStorage override lateinit var declarationStorage: Fir2IrDeclarationStorage - override lateinit var typeConverter: Fir2IrTypeConverter - override lateinit var callGenerator: CallAndReferenceGenerator - override lateinit var fakeOverrideGenerator: FakeOverrideGenerator - override lateinit var visibilityConverter: Fir2IrVisibilityConverter + override lateinit var builtIns: Fir2IrBuiltIns + override lateinit var typeConverter: Fir2IrTypeConverter override val signatureComposer = FirBasedSignatureComposer(mangler) + override lateinit var visibilityConverter: Fir2IrVisibilityConverter + + override lateinit var annotationGenerator: AnnotationGenerator + override lateinit var callGenerator: CallAndReferenceGenerator + override lateinit var fakeOverrideGenerator: FakeOverrideGenerator } diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrConverter.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrConverter.kt index 0af484968fe..00f385371b7 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrConverter.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrConverter.kt @@ -276,11 +276,13 @@ class Fir2IrConverter( val declarationStorage = Fir2IrDeclarationStorage(components, fir2irVisitor, moduleDescriptor) val typeConverter = Fir2IrTypeConverter(components) val builtIns = Fir2IrBuiltIns(components, specialSymbolProvider) + val annotationGenerator = AnnotationGenerator(components) components.declarationStorage = declarationStorage components.classifierStorage = classifierStorage components.typeConverter = typeConverter components.visibilityConverter = visibilityConverter components.builtIns = builtIns + components.annotationGenerator = annotationGenerator val irFiles = mutableListOf() for (firFile in firFiles) { diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt index d7597de16ac..e63d4641745 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt @@ -9,7 +9,6 @@ import org.jetbrains.kotlin.KtNodeTypes import org.jetbrains.kotlin.builtins.StandardNames.BUILT_INS_PACKAGE_FQ_NAMES import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.fir.* -import org.jetbrains.kotlin.fir.backend.generators.AnnotationGenerator import org.jetbrains.kotlin.fir.backend.generators.DelegatedMemberGenerator import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.builder.buildProperty @@ -59,8 +58,6 @@ class Fir2IrDeclarationStorage( private val moduleDescriptor: FirModuleDescriptor ) : Fir2IrComponents by components { - private val annotationGenerator = AnnotationGenerator(this) - private val firSymbolProvider = session.firSymbolProvider private val firProvider = session.firProvider diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrTypeConverter.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrTypeConverter.kt index 9b1b4064bb8..aaadc1ca71e 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrTypeConverter.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrTypeConverter.kt @@ -5,7 +5,6 @@ package org.jetbrains.kotlin.fir.backend -import org.jetbrains.kotlin.fir.backend.generators.AnnotationGenerator import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall import org.jetbrains.kotlin.fir.resolve.fullyExpandedType import org.jetbrains.kotlin.fir.resolve.toSymbol @@ -25,7 +24,6 @@ import org.jetbrains.kotlin.types.Variance class Fir2IrTypeConverter( private val components: Fir2IrComponents ) : Fir2IrComponents by components { - private val annotationGenerator = AnnotationGenerator(this) internal val classIdToSymbolMap = mapOf( StandardClassIds.Nothing to irBuiltIns.nothingClass, diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt index 7168c9f3653..27fb76fee5e 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt @@ -10,7 +10,6 @@ import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.fir.* -import org.jetbrains.kotlin.fir.backend.generators.AnnotationGenerator import org.jetbrains.kotlin.fir.backend.generators.ClassMemberGenerator import org.jetbrains.kotlin.fir.backend.generators.OperatorExpressionGenerator import org.jetbrains.kotlin.fir.declarations.* @@ -51,8 +50,6 @@ class Fir2IrVisitor( private val conversionScope: Fir2IrConversionScope ) : Fir2IrComponents by components, FirDefaultVisitor(), IrGeneratorContextInterface { - private val annotationGenerator = AnnotationGenerator(this) - internal val implicitCastInserter = Fir2IrImplicitCastInserter(components, this) private val memberGenerator = ClassMemberGenerator(components, this, conversionScope) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/AnnotationGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/AnnotationGenerator.kt index 372c9fd4b39..206b0c3680a 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/AnnotationGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/AnnotationGenerator.kt @@ -25,7 +25,7 @@ import org.jetbrains.kotlin.ir.util.isSetter * whose targets may vary. After all the necessary pieces of IR elements, e.g., backing field, are ready, this generator splits those * annotations to the specified targets. */ -internal class AnnotationGenerator(private val components: Fir2IrComponents) : Fir2IrComponents by components { +class AnnotationGenerator(private val components: Fir2IrComponents) : Fir2IrComponents by components { fun List.toIrAnnotations(): List = mapNotNull { diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/ClassMemberGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/ClassMemberGenerator.kt index d589327bcbc..2284aa8c562 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/ClassMemberGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/ClassMemberGenerator.kt @@ -35,8 +35,6 @@ internal class ClassMemberGenerator( private val conversionScope: Fir2IrConversionScope ) : Fir2IrComponents by components { - private val annotationGenerator = AnnotationGenerator(visitor) - private fun FirTypeRef.toIrType(): IrType = with(typeConverter) { toIrType() } private fun ConeKotlinType.toIrType(): IrType = with(typeConverter) { toIrType() } diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DelegatedMemberGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DelegatedMemberGenerator.kt index 9fa86e6c578..32f8027bb27 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DelegatedMemberGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DelegatedMemberGenerator.kt @@ -36,8 +36,6 @@ internal class DelegatedMemberGenerator( private val components: Fir2IrComponents ) : Fir2IrComponents by components { - private val annotationGenerator = AnnotationGenerator(this) - // Generate delegated members for [subClass]. The synthetic field [irField] has the super interface type. fun generate(irField: IrField, firField: FirField, firSubClass: FirClass<*>, subClass: IrClass) { val subClassLookupTag = firSubClass.symbol.toLookupTag() From 3282e092d8ce45ffda7fb9d572e6b2ef7c8906cb Mon Sep 17 00:00:00 2001 From: Shagen Ogandzhanian Date: Mon, 23 Nov 2020 17:59:03 +0100 Subject: [PATCH 051/698] [JS] Don't fail on recursive upper bounds while resolving JsExports Fixes https://youtrack.jetbrains.com/issue/KT-42112 --- .../diagnostics/JsExportDeclarationChecker.kt | 78 +++++++++++-------- .../semantics/IrBoxJsES6TestGenerated.java | 18 +++++ .../ir/semantics/IrBoxJsTestGenerated.java | 18 +++++ .../js/test/semantics/BoxJsTestGenerated.java | 18 +++++ .../testData/box/jsExport/recursiveExport.js | 14 ++++ .../testData/box/jsExport/recursiveExport.kt | 28 +++++++ 6 files changed, 141 insertions(+), 33 deletions(-) create mode 100644 js/js.translator/testData/box/jsExport/recursiveExport.js create mode 100644 js/js.translator/testData/box/jsExport/recursiveExport.kt diff --git a/js/js.frontend/src/org/jetbrains/kotlin/js/resolve/diagnostics/JsExportDeclarationChecker.kt b/js/js.frontend/src/org/jetbrains/kotlin/js/resolve/diagnostics/JsExportDeclarationChecker.kt index 2a9fafe6b5a..c9649eedc20 100644 --- a/js/js.frontend/src/org/jetbrains/kotlin/js/resolve/diagnostics/JsExportDeclarationChecker.kt +++ b/js/js.frontend/src/org/jetbrains/kotlin/js/resolve/diagnostics/JsExportDeclarationChecker.kt @@ -19,7 +19,6 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.isEffectivelyExternal import org.jetbrains.kotlin.resolve.descriptorUtil.isExtensionProperty import org.jetbrains.kotlin.resolve.inline.isInlineWithReified import org.jetbrains.kotlin.types.KotlinType -import org.jetbrains.kotlin.types.TypeProjection import org.jetbrains.kotlin.types.isDynamic import org.jetbrains.kotlin.types.typeUtil.* @@ -30,7 +29,7 @@ object JsExportDeclarationChecker : DeclarationChecker { fun checkTypeParameter(descriptor: TypeParameterDescriptor) { for (upperBound in descriptor.upperBounds) { - if (!isTypeExportable(upperBound, bindingContext)) { + if (!upperBound.isExportable(bindingContext)) { val typeParameterDeclaration = DescriptorToSourceUtils.descriptorToDeclaration(descriptor)!! trace.report(ErrorsJs.NON_EXPORTABLE_TYPE.on(typeParameterDeclaration, "upper bound", upperBound)) } @@ -38,7 +37,7 @@ object JsExportDeclarationChecker : DeclarationChecker { } fun checkValueParameter(descriptor: ValueParameterDescriptor) { - if (!isTypeExportable(descriptor.type, bindingContext)) { + if (!descriptor.type.isExportable(bindingContext)) { val valueParameterDeclaration = DescriptorToSourceUtils.descriptorToDeclaration(descriptor)!! trace.report(ErrorsJs.NON_EXPORTABLE_TYPE.on(valueParameterDeclaration, "parameter", descriptor.type)) } @@ -86,7 +85,7 @@ object JsExportDeclarationChecker : DeclarationChecker { } descriptor.returnType?.let { returnType -> - if (!isTypeExportable(returnType, bindingContext, true)) { + if (!returnType.isExportableReturn(bindingContext)) { trace.report(ErrorsJs.NON_EXPORTABLE_TYPE.on(declaration, "return", returnType)) } } @@ -98,7 +97,7 @@ object JsExportDeclarationChecker : DeclarationChecker { reportWrongExportedDeclaration("extension property") return } - if (!isTypeExportable(descriptor.type, bindingContext)) { + if (!descriptor.type.isExportable(bindingContext)) { trace.report(ErrorsJs.NON_EXPORTABLE_TYPE.on(declaration, "property", descriptor.type)) } } @@ -122,7 +121,7 @@ object JsExportDeclarationChecker : DeclarationChecker { } for (superType in descriptor.defaultType.supertypes()) { - if (!isTypeExportable(superType, bindingContext)) { + if (!superType.isExportable(bindingContext)) { trace.report(ErrorsJs.NON_EXPORTABLE_TYPE.on(declaration, "super", superType)) } } @@ -130,45 +129,58 @@ object JsExportDeclarationChecker : DeclarationChecker { } } + private fun KotlinType.isExportableReturn(bindingContext: BindingContext, currentlyProcessed: MutableSet = mutableSetOf()) = + isUnit() || isExportable(bindingContext, currentlyProcessed) - private fun isTypeExportable(type: KotlinType, bindingContext: BindingContext, isReturnType: Boolean = false): Boolean { - if (isReturnType && type.isUnit()) + private fun KotlinType.isExportable( + bindingContext: BindingContext, + currentlyProcessed: MutableSet = mutableSetOf() + ): Boolean { + if (!currentlyProcessed.add(this)) { return true + } - if (type.isFunctionType) { - val arguments = type.arguments - val argumentsSize = type.arguments.size - 1 - for (i in 0 until argumentsSize) { - if (!isTypeExportable(arguments[i].type, bindingContext)) + currentlyProcessed.add(this) + + if (isFunctionType) { + for (i in 0 until arguments.lastIndex) { + if (!arguments[i].type.isExportable(bindingContext, currentlyProcessed)) { + currentlyProcessed.remove(this) return false + } } - if (!isTypeExportable(arguments.last().type, bindingContext, isReturnType = true)) - return false - return true + currentlyProcessed.remove(this) + return arguments.last().type.isExportableReturn(bindingContext, currentlyProcessed) } - for (argument: TypeProjection in type.arguments) { - if (!isTypeExportable(argument.type, bindingContext)) + for (argument in arguments) { + if (!argument.type.isExportable(bindingContext, currentlyProcessed)) { + currentlyProcessed.remove(this) return false + } } - val nonNullable = type.makeNotNullable() + currentlyProcessed.remove(this) - // Is primitive exportable type - if (nonNullable.isAnyOrNullableAny() || - nonNullable.isDynamic() || - nonNullable.isBoolean() || - KotlinBuiltIns.isThrowableOrNullableThrowable(nonNullable) || - KotlinBuiltIns.isString(nonNullable) || - (nonNullable.isPrimitiveNumberOrNullableType() && !nonNullable.isLong()) || - nonNullable.isNothingOrNullableNothing() || - (KotlinBuiltIns.isArray(type)) || - KotlinBuiltIns.isPrimitiveArray(type) - ) return true + val nonNullable = makeNotNullable() - val descriptor = type.constructor.declarationDescriptor ?: return false - return descriptor is MemberDescriptor && descriptor.isEffectivelyExternal() || - AnnotationsUtils.isExportedObject(descriptor, bindingContext) + val isPrimitiveExportableType = nonNullable.isAnyOrNullableAny() || + nonNullable.isDynamic() || + nonNullable.isBoolean() || + KotlinBuiltIns.isThrowableOrNullableThrowable(nonNullable) || + KotlinBuiltIns.isString(nonNullable) || + (nonNullable.isPrimitiveNumberOrNullableType() && !nonNullable.isLong()) || + nonNullable.isNothingOrNullableNothing() || + KotlinBuiltIns.isArray(this) || + KotlinBuiltIns.isPrimitiveArray(this) + + if (isPrimitiveExportableType) return true + + val descriptor = constructor.declarationDescriptor + + if (descriptor !is MemberDescriptor) return false + + return descriptor.isEffectivelyExternal() || AnnotationsUtils.isExportedObject(descriptor, bindingContext) } } diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java index 947af4adfc7..808d305870a 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java @@ -5155,6 +5155,24 @@ public class IrBoxJsES6TestGenerated extends AbstractIrBoxJsES6Test { } } + @TestMetadata("js/js.translator/testData/box/jsExport") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class JsExport extends AbstractIrBoxJsES6Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); + } + + public void testAllFilesPresentInJsExport() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/jsExport"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + + @TestMetadata("recursiveExport.kt") + public void testRecursiveExport() throws Exception { + runTest("js/js.translator/testData/box/jsExport/recursiveExport.kt"); + } + } + @TestMetadata("js/js.translator/testData/box/jsModule") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java index d5393fe7a60..14377b8240e 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java @@ -5155,6 +5155,24 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest { } } + @TestMetadata("js/js.translator/testData/box/jsExport") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class JsExport extends AbstractIrBoxJsTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInJsExport() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/jsExport"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true); + } + + @TestMetadata("recursiveExport.kt") + public void testRecursiveExport() throws Exception { + runTest("js/js.translator/testData/box/jsExport/recursiveExport.kt"); + } + } + @TestMetadata("js/js.translator/testData/box/jsModule") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java index b8f16ffd577..7ba15667bbe 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java @@ -5170,6 +5170,24 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest { } } + @TestMetadata("js/js.translator/testData/box/jsExport") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class JsExport extends AbstractBoxJsTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); + } + + public void testAllFilesPresentInJsExport() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/jsExport"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS, true); + } + + @TestMetadata("recursiveExport.kt") + public void testRecursiveExport() throws Exception { + runTest("js/js.translator/testData/box/jsExport/recursiveExport.kt"); + } + } + @TestMetadata("js/js.translator/testData/box/jsModule") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.translator/testData/box/jsExport/recursiveExport.js b/js/js.translator/testData/box/jsExport/recursiveExport.js new file mode 100644 index 00000000000..41ec29165c2 --- /dev/null +++ b/js/js.translator/testData/box/jsExport/recursiveExport.js @@ -0,0 +1,14 @@ +$kotlin_test_internal$.beginModule(); + +module.exports = function() { + var ping = require("JS_TESTS").api.ping; + var Something = require("JS_TESTS").api.Something; + + return { + "pingCall": function() { + return ping(new Something()) + }, + }; +}; + +$kotlin_test_internal$.endModule("lib"); diff --git a/js/js.translator/testData/box/jsExport/recursiveExport.kt b/js/js.translator/testData/box/jsExport/recursiveExport.kt new file mode 100644 index 00000000000..581390221ee --- /dev/null +++ b/js/js.translator/testData/box/jsExport/recursiveExport.kt @@ -0,0 +1,28 @@ +// MODULE_KIND: COMMON_JS +// SKIP_MINIFICATION + +// FILE: api.kt +package api +@JsExport +class Something> { + fun ping(): String { + return "OK" + } +} + +@JsExport +fun ping(s: Something<*>): String { + return s.ping() +} + +// FILE: main.kt +external interface JsResult { + val pingCall: () -> String +} + +@JsModule("lib") +external fun jsBox(): JsResult + +fun box(): String { + return jsBox().pingCall() +} From 003ea4bcdf6d5246604cd9c187c3b314974c3cc7 Mon Sep 17 00:00:00 2001 From: Alexander Likhachev Date: Tue, 17 Nov 2020 14:23:47 +0300 Subject: [PATCH 052/698] [Gradle, MPP] Make metadata jar task cc-compatible with warnings #KT-43329 Fixed --- .../targets/metadata/KotlinMetadataTargetConfigurator.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/metadata/KotlinMetadataTargetConfigurator.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/metadata/KotlinMetadataTargetConfigurator.kt index d73523ab350..2d69d8d6f75 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/metadata/KotlinMetadataTargetConfigurator.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/metadata/KotlinMetadataTargetConfigurator.kt @@ -65,6 +65,7 @@ class KotlinMetadataTargetConfigurator(kotlinPluginVersion: String) : KotlinBuildStatsService.getInstance()?.report(BooleanMetrics.ENABLED_HMPP, true) target.compilations.withType(KotlinCommonCompilation::class.java).getByName(KotlinCompilation.MAIN_COMPILATION_NAME).run { + // Capture it here to use in onlyIf spec. Direct usage causes serialization of target attempt when configuration cache is enabled val isCompatibilityMetadataVariantEnabled = target.project.isCompatibilityMetadataVariantEnabled if (isCompatibilityMetadataVariantEnabled) { // Force the default 'main' compilation to produce *.kotlin_metadata regardless of the klib feature flag. @@ -152,11 +153,13 @@ class KotlinMetadataTargetConfigurator(kotlinPluginVersion: String) : val legacyJar = target.project.registerTask(target.legacyArtifactsTaskName) legacyJar.configure { - it.description = "Assembles an archive containing the Kotin metadata of the commonMain source set." - if (!target.project.isCompatibilityMetadataVariantEnabled) { + // Capture it here to use in onlyIf spec. Direct usage causes serialization of target attempt when configuration cache is enabled + val isCompatibilityMetadataVariantEnabled = target.project.isCompatibilityMetadataVariantEnabled + it.description = "Assembles an archive containing the Kotlin metadata of the commonMain source set." + if (!isCompatibilityMetadataVariantEnabled) { it.archiveClassifier.set("commonMain") } - it.onlyIf { target.project.isCompatibilityMetadataVariantEnabled } + it.onlyIf { isCompatibilityMetadataVariantEnabled } it.from(target.compilations.getByName(KotlinCompilation.MAIN_COMPILATION_NAME).output.allOutputs) } From d752b7439e4d7772f5bca296ecdd181cda3b674c Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Tue, 27 Oct 2020 13:47:50 +0300 Subject: [PATCH 053/698] [JS IR] Add init function for properties ^KT-43222 fixed --- .../kotlin/ir/backend/js/JsLoweringPhases.kt | 24 +++++ .../js/lower/PropertyLazyInitLowering.kt | 102 ++++++++++++++++++ 2 files changed, 126 insertions(+) create mode 100644 compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt index c76db464522..58858d593d0 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt @@ -109,6 +109,16 @@ class ModuleLowering( override val modulePhase: NamedCompilerPhase> ) : Lowering(name) +class FileLowering( + name: String, + description: String, + prerequisite: Set> = emptySet(), + private val factory: (JsIrBackendContext) -> FileLoweringPass +) : Lowering(name) { + override val modulePhase: NamedCompilerPhase> = + makeJsModulePhase(factory, name, description, prerequisite) +} + private fun makeDeclarationTransformerPhase( lowering: (JsIrBackendContext) -> DeclarationTransformer, name: String, @@ -123,6 +133,13 @@ private fun makeBodyLoweringPhase( prerequisite: Set = emptySet() ) = BodyLowering(name, description, prerequisite.map { it.modulePhase }.toSet(), lowering) +private fun makeFileLoweringPhase( + lowering: (JsIrBackendContext) -> FileLoweringPass, + name: String, + description: String, + prerequisite: Set = emptySet() +) = FileLowering(name, description, prerequisite.map { it.modulePhase }.toSet(), lowering) + fun NamedCompilerPhase>.toModuleLowering() = ModuleLowering(this.name, this) private val validateIrBeforeLowering = makeCustomJsModulePhase( @@ -352,6 +369,12 @@ private val forLoopsLoweringPhase = makeBodyLoweringPhase( description = "[Optimization] For loops lowering" ) +private val propertyLazyInitLoweringPhase = makeFileLoweringPhase( + ::PropertyLazyInitLowering, + name = "PropertyLazyInitLowering", + description = "Make property init as lazy" +) + private val propertyAccessorInlinerLoweringPhase = makeBodyLoweringPhase( ::PropertyAccessorInlineLowering, name = "PropertyAccessorInlineLowering", @@ -727,6 +750,7 @@ val loweringList = listOf( rangeContainsLoweringPhase, forLoopsLoweringPhase, primitiveCompanionLoweringPhase, + propertyLazyInitLoweringPhase, propertyAccessorInlinerLoweringPhase, foldConstantLoweringPhase, privateMembersLoweringPhase, diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt new file mode 100644 index 00000000000..19a341cce8d --- /dev/null +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt @@ -0,0 +1,102 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.ir.backend.js.lower + +import org.jetbrains.kotlin.backend.common.FileLoweringPass +import org.jetbrains.kotlin.ir.IrStatement +import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET +import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext +import org.jetbrains.kotlin.ir.backend.js.ir.JsIrBuilder +import org.jetbrains.kotlin.ir.builders.declarations.addFunction +import org.jetbrains.kotlin.ir.declarations.IrField +import org.jetbrains.kotlin.ir.declarations.IrFile +import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction +import org.jetbrains.kotlin.ir.expressions.IrBody +import org.jetbrains.kotlin.ir.expressions.IrExpression +import org.jetbrains.kotlin.ir.expressions.IrFieldAccessExpression +import org.jetbrains.kotlin.ir.expressions.IrSetField +import org.jetbrains.kotlin.ir.expressions.impl.IrSetFieldImpl +import org.jetbrains.kotlin.ir.util.kotlinFqName +import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid +import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid +import org.jetbrains.kotlin.name.Name + +class PropertyLazyInitLowering(private val context: JsIrBackendContext) : FileLoweringPass { + private val irBuiltIns + get() = context.irBuiltIns + + override fun lower(irFile: IrFile) { + val initializers = PropertyInitializerMover(context).process(irFile) + val irFactory = context.irFactory + if (initializers.isNotEmpty()) { + irFactory.addFunction(irFile) { + name = Name.identifier("init properties ${irFile.kotlinFqName}") + returnType = irBuiltIns.unitType + origin = JsIrBuilder.SYNTHESIZED_DECLARATION + }.apply { + body = irFactory.createBlockBody( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + initializers + .map { (field, expression) -> + createIrSetField(field, expression) + } + ) + } + } + } + + private fun createIrSetField(field: IrField, expression: IrExpression): IrSetField { + return IrSetFieldImpl( + field.startOffset, + field.endOffset, + field.symbol, + null, + expression, + expression.type + ) + } +} + +private class PropertyInitializerMover( + private val context: JsIrBackendContext +) : IrElementTransformerVoid() { + + private val fieldToInitializers = mutableListOf>() + + fun process(irFile: IrFile): List> { + irFile.transformChildrenVoid(this) + return fieldToInitializers + } + + override fun visitSimpleFunction(declaration: IrSimpleFunction): IrStatement { + declaration.correspondingPropertySymbol + ?.owner + ?.takeIf { !it.isConst } + ?.takeIf { !it.isDelegated } + ?.backingField + ?.takeIf { it.initializer != null } + ?.let { field -> + fieldToInitializers.add(field to field.initializer!!.expression) + } + + fieldToInitializers.forEach { it.first.initializer = null } + + return super.visitSimpleFunction(declaration) + } + + override fun visitFieldAccess(expression: IrFieldAccessExpression): IrExpression { + return super.visitFieldAccess(expression) + } + + override fun visitField(declaration: IrField): IrStatement { + return super.visitField(declaration) + } + + override fun visitBody(body: IrBody): IrBody { + return super.visitBody(body) + } +} \ No newline at end of file From 42e1a3280bd060e6e9910e47b7190806243acac7 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Tue, 27 Oct 2020 16:36:01 +0300 Subject: [PATCH 054/698] [JS IR] Add guard into init properties function ^KT-43222 fixed --- .../js/lower/PropertyLazyInitLowering.kt | 138 ++++++++++++------ 1 file changed, 93 insertions(+), 45 deletions(-) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt index 19a341cce8d..ec04f3bb0b2 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt @@ -9,54 +9,113 @@ import org.jetbrains.kotlin.backend.common.FileLoweringPass import org.jetbrains.kotlin.ir.IrStatement import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext +import org.jetbrains.kotlin.ir.backend.js.ir.JsIrArithBuilder import org.jetbrains.kotlin.ir.backend.js.ir.JsIrBuilder import org.jetbrains.kotlin.ir.builders.declarations.addFunction -import org.jetbrains.kotlin.ir.declarations.IrField -import org.jetbrains.kotlin.ir.declarations.IrFile -import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction -import org.jetbrains.kotlin.ir.expressions.IrBody +import org.jetbrains.kotlin.ir.builders.declarations.buildField +import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.IrExpression -import org.jetbrains.kotlin.ir.expressions.IrFieldAccessExpression +import org.jetbrains.kotlin.ir.expressions.IrGetField import org.jetbrains.kotlin.ir.expressions.IrSetField -import org.jetbrains.kotlin.ir.expressions.impl.IrSetFieldImpl -import org.jetbrains.kotlin.ir.util.kotlinFqName +import org.jetbrains.kotlin.ir.expressions.IrWhen import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid import org.jetbrains.kotlin.name.Name +import kotlin.collections.component1 +import kotlin.collections.component2 +import kotlin.collections.set class PropertyLazyInitLowering(private val context: JsIrBackendContext) : FileLoweringPass { private val irBuiltIns get() = context.irBuiltIns + private val calculator = JsIrArithBuilder(context) + + private val irFactory + get() = context.irFactory + override fun lower(irFile: IrFile) { val initializers = PropertyInitializerMover(context).process(irFile) - val irFactory = context.irFactory - if (initializers.isNotEmpty()) { - irFactory.addFunction(irFile) { - name = Name.identifier("init properties ${irFile.kotlinFqName}") - returnType = irBuiltIns.unitType - origin = JsIrBuilder.SYNTHESIZED_DECLARATION - }.apply { - body = irFactory.createBlockBody( - UNDEFINED_OFFSET, - UNDEFINED_OFFSET, - initializers - .map { (field, expression) -> - createIrSetField(field, expression) - } - ) + + if (initializers.isEmpty()) return + + val fileName = irFile.name + val initialisedField = irFactory.createInitialisationField(fileName) + .apply { + irFile.declarations.add(this) + parent = irFile } + + irFactory.addFunction(irFile) { + name = Name.identifier("init properties $fileName") + returnType = irBuiltIns.unitType + origin = JsIrBuilder.SYNTHESIZED_DECLARATION + }.apply { + buildPropertiesInitializationBody( + initializers, + initialisedField + ) } } + private fun IrFactory.createInitialisationField(fileName: String): IrField = + buildField { + name = Name.identifier("properties initialised $fileName") + type = irBuiltIns.booleanType + isStatic = true + isFinal = true + origin = JsIrBuilder.SYNTHESIZED_DECLARATION + } + + private fun IrSimpleFunction.buildPropertiesInitializationBody( + initializers: Map, + initialisedField: IrField + ) { + + body = irFactory.createBlockBody( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + buildBodyWithIfGuard(initializers, initialisedField) + ) + } + + private fun buildBodyWithIfGuard( + initializers: Map, + initialisedField: IrField + ): List { + val statements = initializers + .map { (field, expression) -> + createIrSetField(field, expression) + } + + val upGuard = createIrSetField( + initialisedField, + JsIrBuilder.buildBoolean(context.irBuiltIns.booleanType, true) + ) + + return JsIrBuilder.buildIfElse( + type = irBuiltIns.unitType, + cond = calculator.not(createIrGetField(initialisedField)), + thenBranch = JsIrBuilder.buildComposite( + type = irBuiltIns.unitType, + statements = mutableListOf(upGuard).apply { addAll(statements) } + ) + ).let { listOf(it) } + } + + private fun createIrGetField(field: IrField): IrGetField { + return JsIrBuilder.buildGetField( + symbol = field.symbol, + receiver = null + ) + } + private fun createIrSetField(field: IrField, expression: IrExpression): IrSetField { - return IrSetFieldImpl( - field.startOffset, - field.endOffset, - field.symbol, - null, - expression, - expression.type + return JsIrBuilder.buildSetField( + symbol = field.symbol, + receiver = null, + value = expression, + type = expression.type ) } } @@ -65,9 +124,9 @@ private class PropertyInitializerMover( private val context: JsIrBackendContext ) : IrElementTransformerVoid() { - private val fieldToInitializers = mutableListOf>() + private val fieldToInitializers = mutableMapOf() - fun process(irFile: IrFile): List> { + fun process(irFile: IrFile): Map { irFile.transformChildrenVoid(this) return fieldToInitializers } @@ -78,25 +137,14 @@ private class PropertyInitializerMover( ?.takeIf { !it.isConst } ?.takeIf { !it.isDelegated } ?.backingField + ?.takeIf { it !in fieldToInitializers } ?.takeIf { it.initializer != null } ?.let { field -> - fieldToInitializers.add(field to field.initializer!!.expression) + fieldToInitializers[field] = field.initializer!!.expression } - fieldToInitializers.forEach { it.first.initializer = null } + fieldToInitializers.forEach { it.key.initializer = null } return super.visitSimpleFunction(declaration) } - - override fun visitFieldAccess(expression: IrFieldAccessExpression): IrExpression { - return super.visitFieldAccess(expression) - } - - override fun visitField(declaration: IrField): IrStatement { - return super.visitField(declaration) - } - - override fun visitBody(body: IrBody): IrBody { - return super.visitBody(body) - } } \ No newline at end of file From 71bfed3253212b4d0ae8487729aff5d0b155c912 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Tue, 27 Oct 2020 17:40:48 +0300 Subject: [PATCH 055/698] [JS IR] From searcher get only properties, mutate in lowering ^KT-43222 fixed --- .../js/lower/PropertyLazyInitLowering.kt | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt index ec04f3bb0b2..c9112701ef2 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt @@ -23,7 +23,6 @@ import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid import org.jetbrains.kotlin.name.Name import kotlin.collections.component1 import kotlin.collections.component2 -import kotlin.collections.set class PropertyLazyInitLowering(private val context: JsIrBackendContext) : FileLoweringPass { private val irBuiltIns @@ -35,9 +34,21 @@ class PropertyLazyInitLowering(private val context: JsIrBackendContext) : FileLo get() = context.irFactory override fun lower(irFile: IrFile) { - val initializers = PropertyInitializerMover(context).process(irFile) + val properties = PropertySearcher() + .search(irFile) - if (initializers.isEmpty()) return + val fieldToInitializer = properties + .asSequence() + .filterNot { it.isDelegated } + .mapNotNull { it.backingField } + .filter { it.initializer != null } + .map { + it to it.initializer!!.expression + } + .toMap() + .onEach { it.key.initializer = null } + + if (fieldToInitializer.isEmpty()) return val fileName = irFile.name val initialisedField = irFactory.createInitialisationField(fileName) @@ -52,7 +63,7 @@ class PropertyLazyInitLowering(private val context: JsIrBackendContext) : FileLo origin = JsIrBuilder.SYNTHESIZED_DECLARATION }.apply { buildPropertiesInitializationBody( - initializers, + fieldToInitializer, initialisedField ) } @@ -120,31 +131,25 @@ class PropertyLazyInitLowering(private val context: JsIrBackendContext) : FileLo } } -private class PropertyInitializerMover( - private val context: JsIrBackendContext -) : IrElementTransformerVoid() { +private class PropertySearcher : IrElementTransformerVoid() { - private val fieldToInitializers = mutableMapOf() + private val propertyToFunction = mutableSetOf() - fun process(irFile: IrFile): Map { + fun search(irFile: IrFile): Set { irFile.transformChildrenVoid(this) - return fieldToInitializers + return propertyToFunction } override fun visitSimpleFunction(declaration: IrSimpleFunction): IrStatement { + declaration.correspondingPropertySymbol ?.owner ?.takeIf { !it.isConst } - ?.takeIf { !it.isDelegated } - ?.backingField - ?.takeIf { it !in fieldToInitializers } - ?.takeIf { it.initializer != null } - ?.let { field -> - fieldToInitializers[field] = field.initializer!!.expression + ?.takeIf { it !in propertyToFunction } + ?.let { + propertyToFunction.add(it) } - fieldToInitializers.forEach { it.key.initializer = null } - return super.visitSimpleFunction(declaration) } } \ No newline at end of file From 0dc4f51d744f8ce68b91255a09d1258c3852e667 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Tue, 27 Oct 2020 18:27:28 +0300 Subject: [PATCH 056/698] [JS IR] Add init function call into first step of property accessor ^KT-43222 fixed --- .../js/lower/PropertyLazyInitLowering.kt | 65 +++++++++++++------ 1 file changed, 44 insertions(+), 21 deletions(-) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt index c9112701ef2..720a5016ac5 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt @@ -14,10 +14,8 @@ import org.jetbrains.kotlin.ir.backend.js.ir.JsIrBuilder import org.jetbrains.kotlin.ir.builders.declarations.addFunction import org.jetbrains.kotlin.ir.builders.declarations.buildField import org.jetbrains.kotlin.ir.declarations.* -import org.jetbrains.kotlin.ir.expressions.IrExpression -import org.jetbrains.kotlin.ir.expressions.IrGetField -import org.jetbrains.kotlin.ir.expressions.IrSetField -import org.jetbrains.kotlin.ir.expressions.IrWhen +import org.jetbrains.kotlin.ir.expressions.* +import org.jetbrains.kotlin.ir.util.statements import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid import org.jetbrains.kotlin.name.Name @@ -57,7 +55,7 @@ class PropertyLazyInitLowering(private val context: JsIrBackendContext) : FileLo parent = irFile } - irFactory.addFunction(irFile) { + val initialiseFun = irFactory.addFunction(irFile) { name = Name.identifier("init properties $fileName") returnType = irBuiltIns.unitType origin = JsIrBuilder.SYNTHESIZED_DECLARATION @@ -67,6 +65,17 @@ class PropertyLazyInitLowering(private val context: JsIrBackendContext) : FileLo initialisedField ) } + + properties + .asSequence() + .flatMap { sequenceOf(it.getter, it.setter) } + .filterNotNull() + .forEach { function -> + val newBody = function.body?.let { body -> + irFactory.bodyWithFunctionCall(body, initialiseFun) + } + function.body = newBody + } } private fun IrFactory.createInitialisationField(fileName: String): IrField = @@ -113,24 +122,38 @@ class PropertyLazyInitLowering(private val context: JsIrBackendContext) : FileLo ) ).let { listOf(it) } } - - private fun createIrGetField(field: IrField): IrGetField { - return JsIrBuilder.buildGetField( - symbol = field.symbol, - receiver = null - ) - } - - private fun createIrSetField(field: IrField, expression: IrExpression): IrSetField { - return JsIrBuilder.buildSetField( - symbol = field.symbol, - receiver = null, - value = expression, - type = expression.type - ) - } } +private fun createIrGetField(field: IrField): IrGetField { + return JsIrBuilder.buildGetField( + symbol = field.symbol, + receiver = null + ) +} + +private fun createIrSetField(field: IrField, expression: IrExpression): IrSetField { + return JsIrBuilder.buildSetField( + symbol = field.symbol, + receiver = null, + value = expression, + type = expression.type + ) +} + +private fun IrFactory.bodyWithFunctionCall( + body: IrBody, + functionToCall: IrSimpleFunction +): IrBody = createBlockBody( + body.startOffset, + body.endOffset, + mutableListOf( + JsIrBuilder.buildCall( + target = functionToCall.symbol, + type = functionToCall.returnType + ) + ).apply { addAll(body.statements) } +) + private class PropertySearcher : IrElementTransformerVoid() { private val propertyToFunction = mutableSetOf() From 5746a7c4fc8f2fa31601c8ec0a2d14b43eccef24 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Tue, 27 Oct 2020 18:48:52 +0300 Subject: [PATCH 057/698] [JS IR] Only consider top level properties ^KT-43222 fixed --- .../kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt index 720a5016ac5..3a131e5153c 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.ir.backend.js.lower import org.jetbrains.kotlin.backend.common.FileLoweringPass +import org.jetbrains.kotlin.backend.common.ir.isTopLevel import org.jetbrains.kotlin.ir.IrStatement import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext @@ -167,6 +168,7 @@ private class PropertySearcher : IrElementTransformerVoid() { declaration.correspondingPropertySymbol ?.owner + ?.takeIf { it.isTopLevel } ?.takeIf { !it.isConst } ?.takeIf { it !in propertyToFunction } ?.let { From 841118a64d47ac0da0f0efc5a9e25b3e4fe9efd7 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Wed, 28 Oct 2020 13:15:04 +0300 Subject: [PATCH 058/698] [JS IR] Add init properties call to top level functions ^KT-43222 fixed --- .../js/lower/PropertyLazyInitLowering.kt | 55 ++++++++++--------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt index 3a131e5153c..f10ea002c18 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt @@ -33,19 +33,12 @@ class PropertyLazyInitLowering(private val context: JsIrBackendContext) : FileLo get() = context.irFactory override fun lower(irFile: IrFile) { - val properties = PropertySearcher() + val functions = TopLevelFunsSearcher() .search(irFile) - val fieldToInitializer = properties - .asSequence() - .filterNot { it.isDelegated } - .mapNotNull { it.backingField } - .filter { it.initializer != null } - .map { - it to it.initializer!!.expression - } - .toMap() - .onEach { it.key.initializer = null } + val fieldToInitializer = calculateFieldToExpression( + functions + ).onEach { it.key.initializer = null } if (fieldToInitializer.isEmpty()) return @@ -56,7 +49,7 @@ class PropertyLazyInitLowering(private val context: JsIrBackendContext) : FileLo parent = irFile } - val initialiseFun = irFactory.addFunction(irFile) { + val initialisationFun = irFactory.addFunction(irFile) { name = Name.identifier("init properties $fileName") returnType = irBuiltIns.unitType origin = JsIrBuilder.SYNTHESIZED_DECLARATION @@ -67,13 +60,12 @@ class PropertyLazyInitLowering(private val context: JsIrBackendContext) : FileLo ) } - properties + functions .asSequence() - .flatMap { sequenceOf(it.getter, it.setter) } .filterNotNull() .forEach { function -> val newBody = function.body?.let { body -> - irFactory.bodyWithFunctionCall(body, initialiseFun) + irFactory.bodyWithFunctionCall(body, initialisationFun) } function.body = newBody } @@ -125,6 +117,20 @@ class PropertyLazyInitLowering(private val context: JsIrBackendContext) : FileLo } } +private fun calculateFieldToExpression(functions: Collection): Map = + functions + .asSequence() + .mapNotNull { it.correspondingPropertySymbol } + .map { it.owner } + .filter { it.isTopLevel } + .filterNot { it.isConst } + .distinct() + .filterNot { it.isDelegated } + .mapNotNull { it.backingField } + .filter { it.initializer != null } + .map { it to it.initializer!!.expression } + .toMap() + private fun createIrGetField(field: IrField): IrGetField { return JsIrBuilder.buildGetField( symbol = field.symbol, @@ -155,25 +161,20 @@ private fun IrFactory.bodyWithFunctionCall( ).apply { addAll(body.statements) } ) -private class PropertySearcher : IrElementTransformerVoid() { +private class TopLevelFunsSearcher : IrElementTransformerVoid() { - private val propertyToFunction = mutableSetOf() + private val topLevelFuns = mutableSetOf() - fun search(irFile: IrFile): Set { + fun search(irFile: IrFile): Set { irFile.transformChildrenVoid(this) - return propertyToFunction + return topLevelFuns } override fun visitSimpleFunction(declaration: IrSimpleFunction): IrStatement { - declaration.correspondingPropertySymbol - ?.owner - ?.takeIf { it.isTopLevel } - ?.takeIf { !it.isConst } - ?.takeIf { it !in propertyToFunction } - ?.let { - propertyToFunction.add(it) - } + if (declaration.isTopLevel) { + topLevelFuns.add(declaration) + } return super.visitSimpleFunction(declaration) } From 07b6ef65a3fa4b0c9435df8d5d3d0e5e249b27ee Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Wed, 28 Oct 2020 19:28:31 +0300 Subject: [PATCH 059/698] [JS IR] Init delegated properties as usual ^KT-43222 fixed --- .../kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt index f10ea002c18..1f3ea750419 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt @@ -125,7 +125,6 @@ private fun calculateFieldToExpression(functions: Collection): .filter { it.isTopLevel } .filterNot { it.isConst } .distinct() - .filterNot { it.isDelegated } .mapNotNull { it.backingField } .filter { it.initializer != null } .map { it to it.initializer!!.expression } From 34ee146148b9d264409cc7adab2ad9cd9722a116 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Thu, 29 Oct 2020 13:29:17 +0300 Subject: [PATCH 060/698] [JS IR] Internal visibility for init fun ^KT-43222 fixed --- .../kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt index 1f3ea750419..d35ee5020aa 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt @@ -7,11 +7,13 @@ package org.jetbrains.kotlin.ir.backend.js.lower import org.jetbrains.kotlin.backend.common.FileLoweringPass import org.jetbrains.kotlin.backend.common.ir.isTopLevel +import org.jetbrains.kotlin.descriptors.DescriptorVisibilities.INTERNAL import org.jetbrains.kotlin.ir.IrStatement import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext import org.jetbrains.kotlin.ir.backend.js.ir.JsIrArithBuilder import org.jetbrains.kotlin.ir.backend.js.ir.JsIrBuilder +import org.jetbrains.kotlin.ir.backend.js.utils.isPure import org.jetbrains.kotlin.ir.builders.declarations.addFunction import org.jetbrains.kotlin.ir.builders.declarations.buildField import org.jetbrains.kotlin.ir.declarations.* @@ -52,6 +54,7 @@ class PropertyLazyInitLowering(private val context: JsIrBackendContext) : FileLo val initialisationFun = irFactory.addFunction(irFile) { name = Name.identifier("init properties $fileName") returnType = irBuiltIns.unitType + visibility = INTERNAL origin = JsIrBuilder.SYNTHESIZED_DECLARATION }.apply { buildPropertiesInitializationBody( From f4c1e52338800668aa0ab470aa3f6fa0a5c56d79 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Thu, 29 Oct 2020 17:52:35 +0300 Subject: [PATCH 061/698] [JS IR] Continuation parameter in main through accessor ^KT-43222 fixed --- .../js/transformers/irToJs/IrModuleToJsTransformer.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrModuleToJsTransformer.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrModuleToJsTransformer.kt index 386ead86929..828f6b33f93 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrModuleToJsTransformer.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrModuleToJsTransformer.kt @@ -303,8 +303,10 @@ class IrModuleToJsTransformer( if (mainFunction.valueParameters.isNotEmpty()) JsArrayLiteral(mainArguments.map { JsStringLiteral(it) }) else null val continuation = if (mainFunction.isSuspend) { - val emptyContinuationField = backendContext.coroutineEmptyContinuation.owner.backingField!! - rootContext.getNameForField(emptyContinuationField).makeRef() + backendContext.coroutineEmptyContinuation.owner + .let { it.getter!! } + .let { rootContext.getNameForStaticFunction(it) } + .let { JsInvocation(it.makeRef()) } } else null return listOfNotNull(mainArgumentsArray, continuation) From 3da9761f37949198208b77cff671899aa780a98d Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Mon, 9 Nov 2020 14:22:55 +0300 Subject: [PATCH 062/698] [JS IR] Add test on lazy initialisation ^KT-43222 fixed --- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 +++++ .../codegen/box/properties/lazyInitialization.kt | 16 ++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 5 +++++ .../codegen/LightAnalysisModeTestGenerated.java | 5 +++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 5 +++++ .../IrJsCodegenBoxES6TestGenerated.java | 5 +++++ .../semantics/IrJsCodegenBoxTestGenerated.java | 5 +++++ .../semantics/JsCodegenBoxTestGenerated.java | 5 +++++ 8 files changed, 51 insertions(+) create mode 100644 compiler/testData/codegen/box/properties/lazyInitialization.kt diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index fc3fc9a4d51..0c5a6a23438 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -21373,6 +21373,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/properties/kt9603.kt"); } + @TestMetadata("lazyInitialization.kt") + public void testLazyInitialization() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitialization.kt"); + } + @TestMetadata("primitiveOverrideDefaultAccessor.kt") public void testPrimitiveOverrideDefaultAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/primitiveOverrideDefaultAccessor.kt"); diff --git a/compiler/testData/codegen/box/properties/lazyInitialization.kt b/compiler/testData/codegen/box/properties/lazyInitialization.kt new file mode 100644 index 00000000000..dc41ee287ca --- /dev/null +++ b/compiler/testData/codegen/box/properties/lazyInitialization.kt @@ -0,0 +1,16 @@ +// IGNORE_BACKEND: JS, NATIVE + +// FILE: A.kt + +val o = "O" + +// FILE: B.kt +val ok = o + k + +// FILE: C.kt + +val k = "K" + +// FILE: main.kt + +fun box(): String = ok \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 2507d84c0ab..33565b25640 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -23144,6 +23144,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/properties/kt9603.kt"); } + @TestMetadata("lazyInitialization.kt") + public void testLazyInitialization() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitialization.kt"); + } + @TestMetadata("primitiveOverrideDefaultAccessor.kt") public void testPrimitiveOverrideDefaultAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/primitiveOverrideDefaultAccessor.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 1b0a7860b6a..38eb8b8533f 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -23149,6 +23149,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/properties/kt9603.kt"); } + @TestMetadata("lazyInitialization.kt") + public void testLazyInitialization() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitialization.kt"); + } + @TestMetadata("primitiveOverrideDefaultAccessor.kt") public void testPrimitiveOverrideDefaultAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/primitiveOverrideDefaultAccessor.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 9e5864a4ad4..e0e6057ba3f 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -21373,6 +21373,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/properties/kt9603.kt"); } + @TestMetadata("lazyInitialization.kt") + public void testLazyInitialization() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitialization.kt"); + } + @TestMetadata("primitiveOverrideDefaultAccessor.kt") public void testPrimitiveOverrideDefaultAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/primitiveOverrideDefaultAccessor.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index ded22676945..af5fc5832c2 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -17629,6 +17629,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/properties/kt9603.kt"); } + @TestMetadata("lazyInitialization.kt") + public void testLazyInitialization() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitialization.kt"); + } + @TestMetadata("primitiveOverrideDefaultAccessor.kt") public void testPrimitiveOverrideDefaultAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/primitiveOverrideDefaultAccessor.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index f4943aebaf4..79efbd55ec9 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -17629,6 +17629,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/properties/kt9603.kt"); } + @TestMetadata("lazyInitialization.kt") + public void testLazyInitialization() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitialization.kt"); + } + @TestMetadata("primitiveOverrideDefaultAccessor.kt") public void testPrimitiveOverrideDefaultAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/primitiveOverrideDefaultAccessor.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 18ef3e5b394..c92775e4abb 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -17734,6 +17734,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/properties/kt9603.kt"); } + @TestMetadata("lazyInitialization.kt") + public void testLazyInitialization() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitialization.kt"); + } + @TestMetadata("primitiveOverrideDefaultAccessor.kt") public void testPrimitiveOverrideDefaultAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/primitiveOverrideDefaultAccessor.kt"); From d6bc309c9405e32f9efaf91cd0283c0b55744739 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Mon, 9 Nov 2020 15:30:37 +0300 Subject: [PATCH 063/698] [JS IR] Eager initialisation for all pure properties ^KT-43222 fixed --- .../js/lower/PropertyLazyInitLowering.kt | 9 ++++++++- .../box/properties/lazyInitializationPure.kt | 18 ++++++++++++++++++ .../IrJsCodegenBoxES6TestGenerated.java | 5 +++++ .../semantics/IrJsCodegenBoxTestGenerated.java | 5 +++++ 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 compiler/testData/codegen/box/properties/lazyInitializationPure.kt diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt index d35ee5020aa..92b60ceeb3f 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt @@ -40,7 +40,14 @@ class PropertyLazyInitLowering(private val context: JsIrBackendContext) : FileLo val fieldToInitializer = calculateFieldToExpression( functions - ).onEach { it.key.initializer = null } + ) + + val allPropertyInitializersPure = fieldToInitializer + .all { it.value.isPure(anyVariable = true) } + + if (allPropertyInitializersPure) return + + fieldToInitializer.onEach { it.key.initializer = null } if (fieldToInitializer.isEmpty()) return diff --git a/compiler/testData/codegen/box/properties/lazyInitializationPure.kt b/compiler/testData/codegen/box/properties/lazyInitializationPure.kt new file mode 100644 index 00000000000..b08db6acaca --- /dev/null +++ b/compiler/testData/codegen/box/properties/lazyInitializationPure.kt @@ -0,0 +1,18 @@ +// TARGET_BACKEND: JS_IR + +// FILE: A.kt + +val a = "A" + +// FILE: B.kt +val b = "B".apply {} + +val c = "C" + +// FILE: main.kt + +fun box(): String { + return if (js("a") == "A" && js("typeof b") == "undefined" && js("typeof c") == "undefined") + "OK" + else "fail" +} \ No newline at end of file diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index af5fc5832c2..c18bbfc6bb2 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -17634,6 +17634,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/properties/lazyInitialization.kt"); } + @TestMetadata("lazyInitializationPure.kt") + public void testLazyInitializationPure() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationPure.kt"); + } + @TestMetadata("primitiveOverrideDefaultAccessor.kt") public void testPrimitiveOverrideDefaultAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/primitiveOverrideDefaultAccessor.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 79efbd55ec9..c1200b0aa20 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -17634,6 +17634,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/properties/lazyInitialization.kt"); } + @TestMetadata("lazyInitializationPure.kt") + public void testLazyInitializationPure() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationPure.kt"); + } + @TestMetadata("primitiveOverrideDefaultAccessor.kt") public void testPrimitiveOverrideDefaultAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/primitiveOverrideDefaultAccessor.kt"); From 99d0740234412301adc4fed70bd3c03007eaf128 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Mon, 9 Nov 2020 16:18:50 +0300 Subject: [PATCH 064/698] [JS IR] Ignore JS_IR backend in top level side effect properties ^KT-43222 fixed --- .../properties/sideEffectInTopLevelInitializerMultiModule.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/testData/codegen/box/properties/sideEffectInTopLevelInitializerMultiModule.kt b/compiler/testData/codegen/box/properties/sideEffectInTopLevelInitializerMultiModule.kt index 318d2dfc66d..933630e9d26 100644 --- a/compiler/testData/codegen/box/properties/sideEffectInTopLevelInitializerMultiModule.kt +++ b/compiler/testData/codegen/box/properties/sideEffectInTopLevelInitializerMultiModule.kt @@ -1,5 +1,5 @@ // IGNORE_BACKEND_FIR: JVM_IR -// IGNORE_BACKEND: JVM, JVM_IR +// IGNORE_BACKEND: JVM, JVM_IR, JS_IR // IGNORE_LIGHT_ANALYSIS // MODULE: lib1 // FILE: lib1.kt From 06b276f9c30cc535d7bafda3bab3b7b21aa011d3 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Tue, 10 Nov 2020 15:53:58 +0300 Subject: [PATCH 065/698] [JS IR] Migrate on body lowering pass and declaration transformer ^KT-43222 fixed --- .../ir/backend/js/DeclarationOrigins.kt | 2 +- .../ir/backend/js/JsIrBackendContext.kt | 2 + .../kotlin/ir/backend/js/JsLoweringPhases.kt | 9 +- .../kotlin/ir/backend/js/JsMapping.kt | 4 + .../js/lower/PropertyLazyInitLowering.kt | 206 ++++++++++++------ .../box/properties/lazyInitializationPure.kt | 19 +- 6 files changed, 170 insertions(+), 72 deletions(-) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/DeclarationOrigins.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/DeclarationOrigins.kt index 2bb42453938..3f0197413e7 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/DeclarationOrigins.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/DeclarationOrigins.kt @@ -14,5 +14,5 @@ object JsLoweredDeclarationOrigin : IrDeclarationOrigin { object JS_CLOSURE_BOX_CLASS : IrStatementOriginImpl("JS_CLOSURE_BOX_CLASS") object JS_CLOSURE_BOX_CLASS_DECLARATION : IrDeclarationOriginImpl("JS_CLOSURE_BOX_CLASS_DECLARATION") object BRIDGE_TO_EXTERNAL_FUNCTION : IrDeclarationOriginImpl("BRIDGE_TO_EXTERNAL_FUNCTION") - object OBJECT_GET_INSTANCE_FUNCTION : IrDeclarationOriginImpl("BRIDGE_TO_EXTERNAL_FUNCTION") + object OBJECT_GET_INSTANCE_FUNCTION : IrDeclarationOriginImpl("OBJECT_GET_INSTANCE_FUNCTION") } diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsIrBackendContext.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsIrBackendContext.kt index 33e68f4ab6e..840628e12c3 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsIrBackendContext.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsIrBackendContext.kt @@ -45,6 +45,8 @@ class JsIrBackendContext( override val scriptMode: Boolean = false, override val es6mode: Boolean = false ) : JsCommonBackendContext { + val fileToInitialisationFuns: MutableMap = mutableMapOf() + override val extractedLocalClasses: MutableSet = hashSetOf() override val builtIns = module.builtIns diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt index 58858d593d0..fea0b56df02 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt @@ -369,12 +369,18 @@ private val forLoopsLoweringPhase = makeBodyLoweringPhase( description = "[Optimization] For loops lowering" ) -private val propertyLazyInitLoweringPhase = makeFileLoweringPhase( +private val propertyLazyInitLoweringPhase = makeBodyLoweringPhase( ::PropertyLazyInitLowering, name = "PropertyLazyInitLowering", description = "Make property init as lazy" ) +private val removeInitializersForLazyProperties = makeDeclarationTransformerPhase( + ::RemoveInitializersForLazyProperties, + name = "RemoveInitializersForLazyProperties", + description = "Make property init as lazy" +) + private val propertyAccessorInlinerLoweringPhase = makeBodyLoweringPhase( ::PropertyAccessorInlineLowering, name = "PropertyAccessorInlineLowering", @@ -751,6 +757,7 @@ val loweringList = listOf( forLoopsLoweringPhase, primitiveCompanionLoweringPhase, propertyLazyInitLoweringPhase, + removeInitializersForLazyProperties, propertyAccessorInlinerLoweringPhase, foldConstantLoweringPhase, privateMembersLoweringPhase, diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsMapping.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsMapping.kt index 344820b5b88..d5fff19e7b5 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsMapping.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsMapping.kt @@ -8,6 +8,8 @@ package org.jetbrains.kotlin.ir.backend.js import org.jetbrains.kotlin.backend.common.DefaultMapping import org.jetbrains.kotlin.backend.common.Mapping import org.jetbrains.kotlin.ir.declarations.* +import org.jetbrains.kotlin.ir.expressions.IrExpression +import org.jetbrains.kotlin.ir.expressions.IrExpressionBody class JsMapping : DefaultMapping() { val outerThisFieldSymbols = newMapping() @@ -30,6 +32,8 @@ class JsMapping : DefaultMapping() { val enumEntryToCorrespondingField = newMapping() val enumClassToInitEntryInstancesFun = newMapping() + val lazyInitialisedFields = newMapping() + // Triggers `StageController.lazyLower` on access override fun newMapping(): Mapping.Delegate = object : Mapping.Delegate() { private val map: MutableMap = mutableMapOf() diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt index 92b60ceeb3f..8a28093d16a 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt @@ -5,27 +5,31 @@ package org.jetbrains.kotlin.ir.backend.js.lower -import org.jetbrains.kotlin.backend.common.FileLoweringPass +import org.jetbrains.kotlin.backend.common.BodyLoweringPass +import org.jetbrains.kotlin.backend.common.DeclarationTransformer import org.jetbrains.kotlin.backend.common.ir.isTopLevel import org.jetbrains.kotlin.descriptors.DescriptorVisibilities.INTERNAL import org.jetbrains.kotlin.ir.IrStatement import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext +import org.jetbrains.kotlin.ir.backend.js.JsLoweredDeclarationOrigin import org.jetbrains.kotlin.ir.backend.js.ir.JsIrArithBuilder import org.jetbrains.kotlin.ir.backend.js.ir.JsIrBuilder import org.jetbrains.kotlin.ir.backend.js.utils.isPure import org.jetbrains.kotlin.ir.builders.declarations.addFunction import org.jetbrains.kotlin.ir.builders.declarations.buildField import org.jetbrains.kotlin.ir.declarations.* +import org.jetbrains.kotlin.ir.declarations.persistent.PersistentIrElementBase +import org.jetbrains.kotlin.ir.declarations.persistent.carriers.DeclarationCarrier import org.jetbrains.kotlin.ir.expressions.* -import org.jetbrains.kotlin.ir.util.statements -import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid -import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid import org.jetbrains.kotlin.name.Name import kotlin.collections.component1 import kotlin.collections.component2 -class PropertyLazyInitLowering(private val context: JsIrBackendContext) : FileLoweringPass { +class PropertyLazyInitLowering( + private val context: JsIrBackendContext +) : BodyLoweringPass { + private val irBuiltIns get() = context.irBuiltIns @@ -34,31 +38,65 @@ class PropertyLazyInitLowering(private val context: JsIrBackendContext) : FileLo private val irFactory get() = context.irFactory - override fun lower(irFile: IrFile) { - val functions = TopLevelFunsSearcher() - .search(irFile) + val fileToInitialisationFuns + get() = context.fileToInitialisationFuns - val fieldToInitializer = calculateFieldToExpression( - functions + override fun lower(irBody: IrBody, container: IrDeclaration) { + val property = container.correspondingProperty ?: return + + val topLevelProperty = property + .takeIf { it.isForLazyInit() } + ?.takeIf { it.backingField?.initializer != null } + ?: return + + val file = topLevelProperty.parent as? IrFile + ?: return + + val initFun = fileToInitialisationFuns[file] + ?: createInitialisationFunction(file)?.also { fileToInitialisationFuns[file] = it } + ?: return + + val initialisationCall = JsIrBuilder.buildCall( + target = initFun.symbol, + type = initFun.returnType ) - val allPropertyInitializersPure = fieldToInitializer - .all { it.value.isPure(anyVariable = true) } + when (container) { + is IrSimpleFunction -> + irBody.addInitialisation(initialisationCall, container) + is IrField -> { + property + .let { listOf(it.getter, it.setter) } + .filterNotNull() + .forEach { + irBody.addInitialisation(initialisationCall, it) + } + } + } + } - if (allPropertyInitializersPure) return + private fun createInitialisationFunction( + file: IrFile + ): IrSimpleFunction? { + val fileName = file.name - fieldToInitializer.onEach { it.key.initializer = null } + val declarations = ArrayList(file.declarations) - if (fieldToInitializer.isEmpty()) return + val fieldToInitializer = calculateFieldToExpression( + declarations + ) + +// if (allFieldsInFilePure(fieldToInitializer.values)) { +// return null +// } - val fileName = irFile.name val initialisedField = irFactory.createInitialisationField(fileName) .apply { - irFile.declarations.add(this) - parent = irFile + file.declarations.add(this) + parent = file } - val initialisationFun = irFactory.addFunction(irFile) { + return irFactory.addFunction(file) { name = Name.identifier("init properties $fileName") returnType = irBuiltIns.unitType visibility = INTERNAL @@ -69,16 +107,6 @@ class PropertyLazyInitLowering(private val context: JsIrBackendContext) : FileLo initialisedField ) } - - functions - .asSequence() - .filterNotNull() - .forEach { function -> - val newBody = function.body?.let { body -> - irFactory.bodyWithFunctionCall(body, initialisationFun) - } - function.body = newBody - } } private fun IrFactory.createInitialisationField(fileName: String): IrField = @@ -94,7 +122,6 @@ class PropertyLazyInitLowering(private val context: JsIrBackendContext) : FileLo initializers: Map, initialisedField: IrField ) { - body = irFactory.createBlockBody( UNDEFINED_OFFSET, UNDEFINED_OFFSET, @@ -105,7 +132,7 @@ class PropertyLazyInitLowering(private val context: JsIrBackendContext) : FileLo private fun buildBodyWithIfGuard( initializers: Map, initialisedField: IrField - ): List { + ): List { val statements = initializers .map { (field, expression) -> createIrSetField(field, expression) @@ -127,18 +154,28 @@ class PropertyLazyInitLowering(private val context: JsIrBackendContext) : FileLo } } -private fun calculateFieldToExpression(functions: Collection): Map = - functions - .asSequence() - .mapNotNull { it.correspondingPropertySymbol } - .map { it.owner } - .filter { it.isTopLevel } - .filterNot { it.isConst } - .distinct() - .mapNotNull { it.backingField } - .filter { it.initializer != null } - .map { it to it.initializer!!.expression } - .toMap() +private fun IrBody.addInitialisation( + initCall: IrCall, + container: IrSimpleFunction +) { + when (this) { + is IrExpressionBody -> { + expression = JsIrBuilder.buildComposite( + type = container.returnType, + statements = listOf( + initCall, + expression + ) + ) + } + is IrBlockBody -> { + statements.add( + 0, + initCall + ) + } + } +} private fun createIrGetField(field: IrField): IrGetField { return JsIrBuilder.buildGetField( @@ -156,35 +193,70 @@ private fun createIrSetField(field: IrField, expression: IrExpression): IrSetFie ) } -private fun IrFactory.bodyWithFunctionCall( - body: IrBody, - functionToCall: IrSimpleFunction -): IrBody = createBlockBody( - body.startOffset, - body.endOffset, - mutableListOf( - JsIrBuilder.buildCall( - target = functionToCall.symbol, - type = functionToCall.returnType - ) - ).apply { addAll(body.statements) } -) +private fun allFieldsInFilePure(fieldToInitializer: Collection) = + fieldToInitializer.all { it.isPure(anyVariable = true) } -private class TopLevelFunsSearcher : IrElementTransformerVoid() { +class RemoveInitializersForLazyProperties( + private val context: JsIrBackendContext +) : DeclarationTransformer { - private val topLevelFuns = mutableSetOf() + val fileToInitialisationFuns + get() = context.fileToInitialisationFuns - fun search(irFile: IrFile): Set { - irFile.transformChildrenVoid(this) - return topLevelFuns + override fun transformFlat(declaration: IrDeclaration): List? { +// val file = declaration.parent as? IrFile ?: return null +// val declarations = ArrayList(file.declarations) +// +// val fields = calculateFieldToExpression(declarations).values +// +// if (allFieldsInFilePure(fields)) { +// return null +// } + + declaration.correspondingProperty + ?.takeIf { it.isForLazyInit() } + ?.backingField + ?.let { it.initializer = null } + + return null } +} - override fun visitSimpleFunction(declaration: IrSimpleFunction): IrStatement { +private fun calculateFieldToExpression(declarations: Collection): Map = + declarations + .asSequence() + .map { it.correspondingProperty } + .filterNotNull() + .filter { it.isForLazyInit() } + .distinct() + .mapNotNull { it.backingField } + .filter { it.initializer != null } + .map { it to it.initializer!!.expression } + .toMap() - if (declaration.isTopLevel) { - topLevelFuns.add(declaration) +private fun IrProperty.isForLazyInit() = isTopLevel && !isConst + +private val IrDeclaration.correspondingProperty: IrProperty? + get() { + if (this !is IrSimpleFunction && this !is IrField && this !is IrProperty) + return null + + // Objects are in fact fields and we need to ignore them + val originField = (this as? DeclarationCarrier)?.originField + if (originField == JsLoweredDeclarationOrigin.OBJECT_GET_INSTANCE_FUNCTION || originField == IrDeclarationOrigin.FIELD_FOR_OBJECT_INSTANCE) + return null + + return when (this) { + is IrProperty -> this + is IrSimpleFunction -> propertyWithPersistentSafe { + correspondingPropertySymbol?.owner + } + is IrField -> propertyWithPersistentSafe { + correspondingPropertySymbol?.owner + } + else -> error("Can be only IrProperty, IrSimpleFunction or IrField") } - - return super.visitSimpleFunction(declaration) } -} \ No newline at end of file + +private fun IrDeclaration.propertyWithPersistentSafe(transform: IrDeclaration.() -> IrProperty?): IrProperty? = + transform() \ No newline at end of file diff --git a/compiler/testData/codegen/box/properties/lazyInitializationPure.kt b/compiler/testData/codegen/box/properties/lazyInitializationPure.kt index b08db6acaca..d2b8f6ce631 100644 --- a/compiler/testData/codegen/box/properties/lazyInitializationPure.kt +++ b/compiler/testData/codegen/box/properties/lazyInitializationPure.kt @@ -7,12 +7,25 @@ val a = "A" // FILE: B.kt val b = "B".apply {} -val c = "C" +val c = b + +// FILE: C.kt +val d = "D".apply {} + +val e = d // FILE: main.kt fun box(): String { - return if (js("a") == "A" && js("typeof b") == "undefined" && js("typeof c") == "undefined") + d + e + return if ( + js("a") === "A" && + js("typeof b") == "undefined" && + js("typeof c") == "undefined" && + js("d") === "D" && + js("e") === "D" + ) "OK" - else "fail" + else "a = ${js("a")}; typeof b = ${js("typeof b")}; typeof c = ${js("typeof c")}; d = ${js("d")}; e = ${js("e")}" } \ No newline at end of file From 8b4d42e70a1fa6d440a4ea6ab9589575c016db2b Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Thu, 12 Nov 2020 20:57:53 +0300 Subject: [PATCH 066/698] [JS IR] Add initialisation call for functions in method ^KT-43222 fixed --- .../js/lower/PropertyLazyInitLowering.kt | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt index 8a28093d16a..8ee9c1194cd 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt @@ -19,7 +19,6 @@ import org.jetbrains.kotlin.ir.backend.js.utils.isPure import org.jetbrains.kotlin.ir.builders.declarations.addFunction import org.jetbrains.kotlin.ir.builders.declarations.buildField import org.jetbrains.kotlin.ir.declarations.* -import org.jetbrains.kotlin.ir.declarations.persistent.PersistentIrElementBase import org.jetbrains.kotlin.ir.declarations.persistent.carriers.DeclarationCarrier import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.name.Name @@ -42,14 +41,12 @@ class PropertyLazyInitLowering( get() = context.fileToInitialisationFuns override fun lower(irBody: IrBody, container: IrDeclaration) { - val property = container.correspondingProperty ?: return + if (container !is IrSimpleFunction && container !is IrField && container !is IrProperty) + return - val topLevelProperty = property - .takeIf { it.isForLazyInit() } - ?.takeIf { it.backingField?.initializer != null } - ?: return + if (!container.isTopLevel) return - val file = topLevelProperty.parent as? IrFile + val file = container.parent as? IrFile ?: return val initFun = fileToInitialisationFuns[file] @@ -65,10 +62,13 @@ class PropertyLazyInitLowering( is IrSimpleFunction -> irBody.addInitialisation(initialisationCall, container) is IrField -> { - property - .let { listOf(it.getter, it.setter) } - .filterNotNull() - .forEach { + container + .correspondingProperty + ?.takeIf { it.isForLazyInit() } + ?.takeIf { it.backingField?.initializer != null } + ?.let { listOf(it.getter, it.setter) } + ?.filterNotNull() + ?.forEach { irBody.addInitialisation(initialisationCall, it) } } @@ -86,6 +86,8 @@ class PropertyLazyInitLowering( declarations ) + if (fieldToInitializer.isEmpty()) return null + // if (allFieldsInFilePure(fieldToInitializer.values)) { // return null // } From c224394dfce7099f9192c85784269049879f1d3c Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Fri, 13 Nov 2020 11:25:01 +0300 Subject: [PATCH 067/698] [JS IR] Return with createdOn hack ^KT-43222 fixed [JS IR] Not create initialisation function for file if there were attempt to create it earlier ^KT-43222 fixed [JS IR] Pureness for PIR and memoize file fields pureness ^KT-43222 fixed --- .../ir/backend/js/JsIrBackendContext.kt | 3 +- .../js/lower/PropertyLazyInitLowering.kt | 68 ++++++++++++------- 2 files changed, 45 insertions(+), 26 deletions(-) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsIrBackendContext.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsIrBackendContext.kt index 840628e12c3..d4ba2a1b836 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsIrBackendContext.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsIrBackendContext.kt @@ -45,7 +45,8 @@ class JsIrBackendContext( override val scriptMode: Boolean = false, override val es6mode: Boolean = false ) : JsCommonBackendContext { - val fileToInitialisationFuns: MutableMap = mutableMapOf() + val fileToInitialisationFuns: MutableMap = mutableMapOf() + val fileToPurenessInitializers: MutableMap = mutableMapOf() override val extractedLocalClasses: MutableSet = hashSetOf() diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt index 8ee9c1194cd..61e682e40cc 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt @@ -12,14 +12,13 @@ import org.jetbrains.kotlin.descriptors.DescriptorVisibilities.INTERNAL import org.jetbrains.kotlin.ir.IrStatement import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext -import org.jetbrains.kotlin.ir.backend.js.JsLoweredDeclarationOrigin import org.jetbrains.kotlin.ir.backend.js.ir.JsIrArithBuilder import org.jetbrains.kotlin.ir.backend.js.ir.JsIrBuilder import org.jetbrains.kotlin.ir.backend.js.utils.isPure import org.jetbrains.kotlin.ir.builders.declarations.addFunction import org.jetbrains.kotlin.ir.builders.declarations.buildField import org.jetbrains.kotlin.ir.declarations.* -import org.jetbrains.kotlin.ir.declarations.persistent.carriers.DeclarationCarrier +import org.jetbrains.kotlin.ir.declarations.persistent.PersistentIrElementBase import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.name.Name import kotlin.collections.component1 @@ -40,6 +39,9 @@ class PropertyLazyInitLowering( val fileToInitialisationFuns get() = context.fileToInitialisationFuns + val fileToPurenessInitializers + get() = context.fileToPurenessInitializers + override fun lower(irBody: IrBody, container: IrDeclaration) { if (container !is IrSimpleFunction && container !is IrField && container !is IrProperty) return @@ -49,9 +51,13 @@ class PropertyLazyInitLowering( val file = container.parent as? IrFile ?: return - val initFun = fileToInitialisationFuns[file] - ?: createInitialisationFunction(file)?.also { fileToInitialisationFuns[file] = it } - ?: return + val initFun = (if (file in fileToInitialisationFuns) { + fileToInitialisationFuns[file] + } else { + createInitialisationFunction(file).also { + fileToInitialisationFuns[file] = it + } + }) ?: return val initialisationCall = JsIrBuilder.buildCall( target = initFun.symbol, @@ -80,7 +86,7 @@ class PropertyLazyInitLowering( ): IrSimpleFunction? { val fileName = file.name - val declarations = ArrayList(file.declarations) + val declarations = file.declarations.toList() val fieldToInitializer = calculateFieldToExpression( declarations @@ -88,9 +94,10 @@ class PropertyLazyInitLowering( if (fieldToInitializer.isEmpty()) return null -// if (allFieldsInFilePure(fieldToInitializer.values)) { -// return null -// } + val allFieldsInFilePure = allFieldsInFilePure(fieldToInitializer.values) + if (allFieldsInFilePure) { + return null + } val initialisedField = irFactory.createInitialisationField(fileName) .apply { @@ -202,18 +209,22 @@ class RemoveInitializersForLazyProperties( private val context: JsIrBackendContext ) : DeclarationTransformer { - val fileToInitialisationFuns - get() = context.fileToInitialisationFuns + val fileToPurenessInitializers + get() = context.fileToPurenessInitializers override fun transformFlat(declaration: IrDeclaration): List? { -// val file = declaration.parent as? IrFile ?: return null -// val declarations = ArrayList(file.declarations) -// -// val fields = calculateFieldToExpression(declarations).values -// -// if (allFieldsInFilePure(fields)) { -// return null -// } + if (declaration !is IrField) return null + + val file = declaration.parent as? IrFile ?: return null + + if (fileToPurenessInitializers[file] == true) return null + + val allFieldsInFilePure = fileToPurenessInitializers[file] + ?: calculateFileFieldsPureness(file) + + if (allFieldsInFilePure) { + return null + } declaration.correspondingProperty ?.takeIf { it.isForLazyInit() } @@ -222,6 +233,16 @@ class RemoveInitializersForLazyProperties( return null } + + private fun calculateFileFieldsPureness(file: IrFile): Boolean { + val declarations = file.declarations.toList() + val expressions = calculateFieldToExpression(declarations) + .values + + val allFieldsInFilePure = allFieldsInFilePure(expressions) + fileToPurenessInitializers[file] = allFieldsInFilePure + return allFieldsInFilePure + } } private fun calculateFieldToExpression(declarations: Collection): Map = @@ -243,11 +264,6 @@ private val IrDeclaration.correspondingProperty: IrProperty? if (this !is IrSimpleFunction && this !is IrField && this !is IrProperty) return null - // Objects are in fact fields and we need to ignore them - val originField = (this as? DeclarationCarrier)?.originField - if (originField == JsLoweredDeclarationOrigin.OBJECT_GET_INSTANCE_FUNCTION || originField == IrDeclarationOrigin.FIELD_FOR_OBJECT_INSTANCE) - return null - return when (this) { is IrProperty -> this is IrSimpleFunction -> propertyWithPersistentSafe { @@ -261,4 +277,6 @@ private val IrDeclaration.correspondingProperty: IrProperty? } private fun IrDeclaration.propertyWithPersistentSafe(transform: IrDeclaration.() -> IrProperty?): IrProperty? = - transform() \ No newline at end of file + if (((this as? PersistentIrElementBase<*>)?.createdOn ?: 0) <= stageController.currentStage) { + transform() + } else null \ No newline at end of file From aa0f9dc1e20b4ddf5768b9bc5ac6be07aeb2c475 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Mon, 16 Nov 2020 13:06:09 +0300 Subject: [PATCH 068/698] [JS IR] Don't target exact wasm backend ^KT-43222 fixed --- compiler/testData/codegen/box/properties/lazyInitialization.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/testData/codegen/box/properties/lazyInitialization.kt b/compiler/testData/codegen/box/properties/lazyInitialization.kt index dc41ee287ca..580c55d101c 100644 --- a/compiler/testData/codegen/box/properties/lazyInitialization.kt +++ b/compiler/testData/codegen/box/properties/lazyInitialization.kt @@ -1,4 +1,5 @@ // IGNORE_BACKEND: JS, NATIVE +// DONT_TARGET_EXACT_BACKEND: WASM // FILE: A.kt From fcb3ee5e45b39012fee6be8f5fc935660b8737b8 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Mon, 16 Nov 2020 13:49:09 +0300 Subject: [PATCH 069/698] [JS IR]Add check on pureness to not calculate fields to expression twice ^KT-43222 fixed --- .../org/jetbrains/kotlin/ir/backend/js/JsMapping.kt | 4 ---- .../ir/backend/js/lower/PropertyLazyInitLowering.kt | 13 ++++++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsMapping.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsMapping.kt index d5fff19e7b5..344820b5b88 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsMapping.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsMapping.kt @@ -8,8 +8,6 @@ package org.jetbrains.kotlin.ir.backend.js import org.jetbrains.kotlin.backend.common.DefaultMapping import org.jetbrains.kotlin.backend.common.Mapping import org.jetbrains.kotlin.ir.declarations.* -import org.jetbrains.kotlin.ir.expressions.IrExpression -import org.jetbrains.kotlin.ir.expressions.IrExpressionBody class JsMapping : DefaultMapping() { val outerThisFieldSymbols = newMapping() @@ -32,8 +30,6 @@ class JsMapping : DefaultMapping() { val enumEntryToCorrespondingField = newMapping() val enumClassToInitEntryInstancesFun = newMapping() - val lazyInitialisedFields = newMapping() - // Triggers `StageController.lazyLower` on access override fun newMapping(): Mapping.Delegate = object : Mapping.Delegate() { private val map: MutableMap = mutableMapOf() diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt index 61e682e40cc..087c16e8bbe 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt @@ -51,11 +51,13 @@ class PropertyLazyInitLowering( val file = container.parent as? IrFile ?: return - val initFun = (if (file in fileToInitialisationFuns) { - fileToInitialisationFuns[file] - } else { - createInitialisationFunction(file).also { - fileToInitialisationFuns[file] = it + val initFun = (when { + file in fileToInitialisationFuns -> fileToInitialisationFuns[file] + fileToPurenessInitializers[file] == true -> null + else -> { + createInitialisationFunction(file).also { + fileToInitialisationFuns[file] = it + } } }) ?: return @@ -95,6 +97,7 @@ class PropertyLazyInitLowering( if (fieldToInitializer.isEmpty()) return null val allFieldsInFilePure = allFieldsInFilePure(fieldToInitializer.values) + fileToPurenessInitializers[file] = allFieldsInFilePure if (allFieldsInFilePure) { return null } From a2d41b86bf538f4c73980c4b766bdf4e5afb57ae Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Mon, 16 Nov 2020 18:26:52 +0300 Subject: [PATCH 070/698] [JS IR] Add compiler argument about lazy initialisation ^KT-43222 fixed --- .../cli/common/arguments/K2JSCompilerArguments.kt | 3 +++ .../src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt | 10 +++++++++- .../jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt | 2 +- .../ir/backend/js/lower/PropertyLazyInitLowering.kt | 9 +++++++++ .../kotlin/js/config/JSConfigurationKeys.java | 3 +++ 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt index 064b1edb16d..53ab6fca0ff 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt @@ -125,6 +125,9 @@ class K2JSCompilerArguments : CommonCompilerArguments() { @Argument(value = "-Xir-dce-print-reachability-info", description = "Print declarations' reachability info to stdout during performing DCE") var irDcePrintReachabilityInfo: Boolean by FreezableVar(false) + @Argument(value = "-Xir-property-lazy-initialisation", description = "Perform lazy initialisation for properties") + var irPropertyLazyInitialisation: Boolean by FreezableVar(false) + @Argument(value = "-Xir-only", description = "Disables pre-IR backend") var irOnly: Boolean by FreezableVar(false) diff --git a/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt b/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt index 75fdfead4a5..650a37f2a88 100644 --- a/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt +++ b/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt @@ -27,7 +27,10 @@ import org.jetbrains.kotlin.cli.common.messages.MessageUtil import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment import org.jetbrains.kotlin.cli.jvm.plugins.PluginCliParser -import org.jetbrains.kotlin.config.* +import org.jetbrains.kotlin.config.CommonConfigurationKeys +import org.jetbrains.kotlin.config.CompilerConfiguration +import org.jetbrains.kotlin.config.IncrementalCompilation +import org.jetbrains.kotlin.config.Services import org.jetbrains.kotlin.incremental.components.ExpectActualTracker import org.jetbrains.kotlin.incremental.components.LookupTracker import org.jetbrains.kotlin.incremental.js.IncrementalDataProvider @@ -156,6 +159,11 @@ class K2JsIrCompiler : CLICompiler() { arguments.irModuleName ?: FileUtil.getNameWithoutExtension(outputFile) ) + configurationJs.put( + JSConfigurationKeys.PROPERTY_LAZY_INITIALISATION, + arguments.irPropertyLazyInitialisation + ) + // TODO: in this method at least 3 different compiler configurations are used (original, env.configuration, jsConfig.configuration) // Such situation seems a bit buggy... val config = JsConfig(projectJs, configurationJs) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt index fea0b56df02..fb01bf3ce33 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt @@ -378,7 +378,7 @@ private val propertyLazyInitLoweringPhase = makeBodyLoweringPhase( private val removeInitializersForLazyProperties = makeDeclarationTransformerPhase( ::RemoveInitializersForLazyProperties, name = "RemoveInitializersForLazyProperties", - description = "Make property init as lazy" + description = "Remove property initializers if they was initialised lazily" ) private val propertyAccessorInlinerLoweringPhase = makeBodyLoweringPhase( diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt index 087c16e8bbe..cd331eb612e 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt @@ -20,6 +20,7 @@ import org.jetbrains.kotlin.ir.builders.declarations.buildField import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.declarations.persistent.PersistentIrElementBase import org.jetbrains.kotlin.ir.expressions.* +import org.jetbrains.kotlin.js.config.JSConfigurationKeys.PROPERTY_LAZY_INITIALISATION import org.jetbrains.kotlin.name.Name import kotlin.collections.component1 import kotlin.collections.component2 @@ -43,6 +44,10 @@ class PropertyLazyInitLowering( get() = context.fileToPurenessInitializers override fun lower(irBody: IrBody, container: IrDeclaration) { + if (context.configuration[PROPERTY_LAZY_INITIALISATION] != true) { + return + } + if (container !is IrSimpleFunction && container !is IrField && container !is IrProperty) return @@ -216,6 +221,10 @@ class RemoveInitializersForLazyProperties( get() = context.fileToPurenessInitializers override fun transformFlat(declaration: IrDeclaration): List? { + if (context.configuration[PROPERTY_LAZY_INITIALISATION] != true) { + return null + } + if (declaration !is IrField) return null val file = declaration.parent as? IrFile ?: return null diff --git a/js/js.frontend/src/org/jetbrains/kotlin/js/config/JSConfigurationKeys.java b/js/js.frontend/src/org/jetbrains/kotlin/js/config/JSConfigurationKeys.java index 71a1ce9b29f..160238dcb45 100644 --- a/js/js.frontend/src/org/jetbrains/kotlin/js/config/JSConfigurationKeys.java +++ b/js/js.frontend/src/org/jetbrains/kotlin/js/config/JSConfigurationKeys.java @@ -89,4 +89,7 @@ public class JSConfigurationKeys { public static final CompilerConfigurationKey ERROR_TOLERANCE_POLICY = CompilerConfigurationKey.create("set up policy to ignore compilation errors"); + + public static final CompilerConfigurationKey PROPERTY_LAZY_INITIALISATION = + CompilerConfigurationKey.create("enable property lazy initialisation"); } From 1b5ebd83de92b045e8d91b03b59bb78d50b0a9c0 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Tue, 17 Nov 2020 13:43:04 +0300 Subject: [PATCH 071/698] [JS IR] Lazy initialisation is optional for tests ^KT-43222 fixed --- compiler/testData/cli/js/jsExtraHelp.out | 2 + .../box/properties/lazyInitialization.kt | 1 + .../box/properties/lazyInitializationPure.kt | 1 + ...eEffectInTopLevelInitializerMultiModule.kt | 2 +- .../jetbrains/kotlin/js/test/BasicBoxTest.kt | 74 +++++++++++++++++-- 5 files changed, 71 insertions(+), 9 deletions(-) diff --git a/compiler/testData/cli/js/jsExtraHelp.out b/compiler/testData/cli/js/jsExtraHelp.out index 03bc63d0b88..3e7e3f6cd6b 100644 --- a/compiler/testData/cli/js/jsExtraHelp.out +++ b/compiler/testData/cli/js/jsExtraHelp.out @@ -18,6 +18,8 @@ where advanced options include: -Xir-produce-klib-dir Generate unpacked KLIB into parent directory of output JS file. In combination with -meta-info generates both IR and pre-IR versions of library. -Xir-produce-klib-file Generate packed klib into file specified by -output. Disables pre-IR backend + -Xir-property-lazy-initialisation + Perform lazy initialisation for properties -Xmetadata-only Generate *.meta.js and *.kjsm files only -Xtyped-arrays Translate primitive arrays to JS typed arrays -Xwasm Use experimental WebAssembly compiler backend diff --git a/compiler/testData/codegen/box/properties/lazyInitialization.kt b/compiler/testData/codegen/box/properties/lazyInitialization.kt index 580c55d101c..945b48e5932 100644 --- a/compiler/testData/codegen/box/properties/lazyInitialization.kt +++ b/compiler/testData/codegen/box/properties/lazyInitialization.kt @@ -1,5 +1,6 @@ // IGNORE_BACKEND: JS, NATIVE // DONT_TARGET_EXACT_BACKEND: WASM +// PROPERTY_LAZY_INITIALISATION // FILE: A.kt diff --git a/compiler/testData/codegen/box/properties/lazyInitializationPure.kt b/compiler/testData/codegen/box/properties/lazyInitializationPure.kt index d2b8f6ce631..7103b238896 100644 --- a/compiler/testData/codegen/box/properties/lazyInitializationPure.kt +++ b/compiler/testData/codegen/box/properties/lazyInitializationPure.kt @@ -1,4 +1,5 @@ // TARGET_BACKEND: JS_IR +// PROPERTY_LAZY_INITIALISATION // FILE: A.kt diff --git a/compiler/testData/codegen/box/properties/sideEffectInTopLevelInitializerMultiModule.kt b/compiler/testData/codegen/box/properties/sideEffectInTopLevelInitializerMultiModule.kt index 933630e9d26..318d2dfc66d 100644 --- a/compiler/testData/codegen/box/properties/sideEffectInTopLevelInitializerMultiModule.kt +++ b/compiler/testData/codegen/box/properties/sideEffectInTopLevelInitializerMultiModule.kt @@ -1,5 +1,5 @@ // IGNORE_BACKEND_FIR: JVM_IR -// IGNORE_BACKEND: JVM, JVM_IR, JS_IR +// IGNORE_BACKEND: JVM, JVM_IR // IGNORE_LIGHT_ANALYSIS // MODULE: lib1 // FILE: lib1.kt diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt index 96e3cf1ea64..c63fcd409eb 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt @@ -131,6 +131,8 @@ abstract class BasicBoxTest( val skipDceDriven = SKIP_DCE_DRIVEN.matcher(fileContent).find() val splitPerModule = SPLIT_PER_MODULE.matcher(fileContent).find() + val propertyLazyInitialization = PROPERTY_LAZY_INITIALISATION.matcher(fileContent).find() + TestFileFactoryImpl(coroutinesPackage).use { testFactory -> val inputFiles = TestFiles.createTestFiles( file.name, @@ -172,9 +174,28 @@ abstract class BasicBoxTest( val isMainModule = mainModuleName == module.name generateJavaScriptFile( testFactory.tmpDir, - file.parent, module, outputFileName, dceOutputFileName, pirOutputFileName, dependencies, allDependencies, friends, modules.size > 1, - !SKIP_SOURCEMAP_REMAPPING.matcher(fileContent).find(), outputPrefixFile, outputPostfixFile, - actualMainCallParameters, testPackage, testFunction, needsFullIrRuntime, isMainModule, expectActualLinker, skipDceDriven, splitPerModule, errorPolicy + file.parent, + module, + outputFileName, + dceOutputFileName, + pirOutputFileName, + dependencies, + allDependencies, + friends, + modules.size > 1, + !SKIP_SOURCEMAP_REMAPPING.matcher(fileContent).find(), + outputPrefixFile, + outputPostfixFile, + actualMainCallParameters, + testPackage, + testFunction, + needsFullIrRuntime, + isMainModule, + expectActualLinker, + skipDceDriven, + splitPerModule, + errorPolicy, + propertyLazyInitialization ) when { @@ -398,7 +419,8 @@ abstract class BasicBoxTest( expectActualLinker: Boolean, skipDceDriven: Boolean, splitPerModule: Boolean, - errorIgnorancePolicy: ErrorTolerancePolicy + errorIgnorancePolicy: ErrorTolerancePolicy, + propertyLazyInitialisation: Boolean, ) { val kotlinFiles = module.files.filter { it.fileName.endsWith(".kt") } val testFiles = kotlinFiles.map { it.fileName } @@ -414,7 +436,19 @@ abstract class BasicBoxTest( val psiFiles = createPsiFiles(allSourceFiles.sortedBy { it.canonicalPath }.map { it.canonicalPath }) val sourceDirs = (testFiles + additionalFiles).map { File(it).parent }.distinct() - val config = createConfig(sourceDirs, module, dependencies, allDependencies, friends, multiModule, tmpDir, incrementalData = null, expectActualLinker = expectActualLinker, errorIgnorancePolicy) + val config = createConfig( + sourceDirs, + module, + dependencies, + allDependencies, + friends, + multiModule, + tmpDir, + incrementalData = null, + expectActualLinker = expectActualLinker, + errorIgnorancePolicy, + propertyLazyInitialisation + ) val outputFile = File(outputFileName) val dceOutputFile = File(dceOutputFileName) val pirOutputFile = File(pirOutputFileName) @@ -469,7 +503,19 @@ abstract class BasicBoxTest( .sortedBy { it.canonicalPath } .map { sourceToTranslationUnit[it]!! } - val recompiledConfig = createConfig(sourceDirs, module, dependencies, allDependencies, friends, multiModule, tmpDir, incrementalData, expectActualLinker, ErrorTolerancePolicy.DEFAULT) + val recompiledConfig = createConfig( + sourceDirs, + module, + dependencies, + allDependencies, + friends, + multiModule, + tmpDir, + incrementalData, + expectActualLinker, + ErrorTolerancePolicy.DEFAULT, + propertyLazyInitialisation = false + ) val recompiledOutputFile = File(outputFile.parentFile, outputFile.nameWithoutExtension + "-recompiled.js") translateFiles( @@ -684,8 +730,17 @@ abstract class BasicBoxTest( private fun createPsiFiles(fileNames: List): List = fileNames.map(this::createPsiFile) private fun createConfig( - sourceDirs: List, module: TestModule, dependencies: List, allDependencies: List, friends: List, - multiModule: Boolean, tmpDir: File, incrementalData: IncrementalData?, expectActualLinker: Boolean, errorIgnorancePolicy: ErrorTolerancePolicy + sourceDirs: List, + module: TestModule, + dependencies: List, + allDependencies: List, + friends: List, + multiModule: Boolean, + tmpDir: File, + incrementalData: IncrementalData?, + expectActualLinker: Boolean, + errorIgnorancePolicy: ErrorTolerancePolicy, + propertyLazyInitialisation: Boolean, ): JsConfig { val configuration = environment.configuration.copy() @@ -709,6 +764,7 @@ abstract class BasicBoxTest( configuration.put(JSConfigurationKeys.MODULE_KIND, module.moduleKind) configuration.put(JSConfigurationKeys.TARGET, EcmaVersion.v5) configuration.put(JSConfigurationKeys.ERROR_TOLERANCE_POLICY, errorIgnorancePolicy) + configuration.put(JSConfigurationKeys.PROPERTY_LAZY_INITIALISATION, propertyLazyInitialisation) if (errorIgnorancePolicy.allowErrors) { configuration.put(JSConfigurationKeys.DEVELOPER_MODE, true) @@ -942,6 +998,8 @@ abstract class BasicBoxTest( private val ERROR_POLICY_PATTERN = Pattern.compile("^// *ERROR_POLICY: *(.+)$", Pattern.MULTILINE) + private val PROPERTY_LAZY_INITIALISATION = Pattern.compile("^// *PROPERTY_LAZY_INITIALISATION *$", Pattern.MULTILINE) + @JvmStatic protected val runTestInNashorn = getBoolean("kotlin.js.useNashorn") From efee3ea648530667b8174bba9ca0a313395c9908 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Thu, 19 Nov 2020 13:22:22 +0300 Subject: [PATCH 072/698] [JS IR] - Remove file lowering declarations from lowering phases - rename fileToPurenessInitializers onto fileToInitializerPureness - remove redundant check on top-level property [JS IR] Rename initialis* to initializ* for consistency [JS IR] Move propertyLazyInitialization property to context from configuration [JS IR] Add test on lazy initialization properties order [JS IR] Add multi module for lazy initialization of properties [JS IR] Move tests onto js.translator [JS IR] Rename fileToInitializerPureness according to context name ^KT-43222 fixed --- .../common/arguments/K2JSCompilerArguments.kt | 4 +- .../jetbrains/kotlin/cli/js/K2JsIrCompiler.kt | 8 +-- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 -- .../ir/backend/js/JsIrBackendContext.kt | 7 ++- .../kotlin/ir/backend/js/JsLoweringPhases.kt | 19 +----- .../kotlin/ir/backend/js/compiler.kt | 14 ++++- .../js/lower/PropertyLazyInitLowering.kt | 63 +++++++++---------- compiler/testData/cli/js/jsExtraHelp.out | 4 +- .../codegen/BlackBoxCodegenTestGenerated.java | 5 -- .../LightAnalysisModeTestGenerated.java | 5 -- .../ir/IrBlackBoxCodegenTestGenerated.java | 5 -- .../kotlin/js/config/JSConfigurationKeys.java | 3 - .../jetbrains/kotlin/js/test/BasicBoxTest.kt | 51 +++++++++++---- .../kotlin/js/test/BasicIrBoxTest.kt | 9 ++- .../semantics/IrBoxJsES6TestGenerated.java | 20 ++++++ .../IrJsCodegenBoxES6TestGenerated.java | 10 --- .../ir/semantics/IrBoxJsTestGenerated.java | 20 ++++++ .../IrJsCodegenBoxTestGenerated.java | 10 --- .../js/test/semantics/BoxJsTestGenerated.java | 20 ++++++ .../semantics/JsCodegenBoxTestGenerated.java | 5 -- .../box/propertyAccess}/lazyInitialization.kt | 4 +- .../propertyAccess/lazyInitializationOrder.kt | 36 +++++++++++ .../propertyAccess}/lazyInitializationPure.kt | 6 +- .../lazyInitializationSplitPerModule.kt | 22 +++++++ 24 files changed, 221 insertions(+), 134 deletions(-) rename {compiler/testData/codegen/box/properties => js/js.translator/testData/box/propertyAccess}/lazyInitialization.kt (72%) create mode 100644 js/js.translator/testData/box/propertyAccess/lazyInitializationOrder.kt rename {compiler/testData/codegen/box/properties => js/js.translator/testData/box/propertyAccess}/lazyInitializationPure.kt (81%) create mode 100644 js/js.translator/testData/box/propertyAccess/lazyInitializationSplitPerModule.kt diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt index 53ab6fca0ff..1ac840bd657 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt @@ -125,8 +125,8 @@ class K2JSCompilerArguments : CommonCompilerArguments() { @Argument(value = "-Xir-dce-print-reachability-info", description = "Print declarations' reachability info to stdout during performing DCE") var irDcePrintReachabilityInfo: Boolean by FreezableVar(false) - @Argument(value = "-Xir-property-lazy-initialisation", description = "Perform lazy initialisation for properties") - var irPropertyLazyInitialisation: Boolean by FreezableVar(false) + @Argument(value = "-Xir-property-lazy-initialization", description = "Perform lazy initialization for properties") + var irPropertyLazyInitialization: Boolean by FreezableVar(false) @Argument(value = "-Xir-only", description = "Disables pre-IR backend") var irOnly: Boolean by FreezableVar(false) diff --git a/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt b/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt index 650a37f2a88..efa64a745a8 100644 --- a/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt +++ b/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt @@ -159,11 +159,6 @@ class K2JsIrCompiler : CLICompiler() { arguments.irModuleName ?: FileUtil.getNameWithoutExtension(outputFile) ) - configurationJs.put( - JSConfigurationKeys.PROPERTY_LAZY_INITIALISATION, - arguments.irPropertyLazyInitialisation - ) - // TODO: in this method at least 3 different compiler configurations are used (original, env.configuration, jsConfig.configuration) // Such situation seems a bit buggy... val config = JsConfig(projectJs, configurationJs) @@ -269,7 +264,8 @@ class K2JsIrCompiler : CLICompiler() { generateDceJs = arguments.irDce, dceDriven = arguments.irDceDriven, multiModule = arguments.irPerModule, - relativeRequirePath = true + relativeRequirePath = true, + propertyLazyInitialization = arguments.irPropertyLazyInitialization, ) } catch (e: JsIrCompilationError) { return COMPILATION_ERROR diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 0c5a6a23438..fc3fc9a4d51 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -21373,11 +21373,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/properties/kt9603.kt"); } - @TestMetadata("lazyInitialization.kt") - public void testLazyInitialization() throws Exception { - runTest("compiler/testData/codegen/box/properties/lazyInitialization.kt"); - } - @TestMetadata("primitiveOverrideDefaultAccessor.kt") public void testPrimitiveOverrideDefaultAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/primitiveOverrideDefaultAccessor.kt"); diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsIrBackendContext.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsIrBackendContext.kt index d4ba2a1b836..602ecb58b5b 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsIrBackendContext.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsIrBackendContext.kt @@ -43,10 +43,11 @@ class JsIrBackendContext( val additionalExportedDeclarationNames: Set, override val configuration: CompilerConfiguration, // TODO: remove configuration from backend context override val scriptMode: Boolean = false, - override val es6mode: Boolean = false + override val es6mode: Boolean = false, + val propertyLazyInitialization: Boolean = false, ) : JsCommonBackendContext { - val fileToInitialisationFuns: MutableMap = mutableMapOf() - val fileToPurenessInitializers: MutableMap = mutableMapOf() + val fileToInitializationFuns: MutableMap = mutableMapOf() + val fileToInitializerPureness: MutableMap = mutableMapOf() override val extractedLocalClasses: MutableSet = hashSetOf() diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt index fb01bf3ce33..7b66b386d04 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt @@ -109,16 +109,6 @@ class ModuleLowering( override val modulePhase: NamedCompilerPhase> ) : Lowering(name) -class FileLowering( - name: String, - description: String, - prerequisite: Set> = emptySet(), - private val factory: (JsIrBackendContext) -> FileLoweringPass -) : Lowering(name) { - override val modulePhase: NamedCompilerPhase> = - makeJsModulePhase(factory, name, description, prerequisite) -} - private fun makeDeclarationTransformerPhase( lowering: (JsIrBackendContext) -> DeclarationTransformer, name: String, @@ -133,13 +123,6 @@ private fun makeBodyLoweringPhase( prerequisite: Set = emptySet() ) = BodyLowering(name, description, prerequisite.map { it.modulePhase }.toSet(), lowering) -private fun makeFileLoweringPhase( - lowering: (JsIrBackendContext) -> FileLoweringPass, - name: String, - description: String, - prerequisite: Set = emptySet() -) = FileLowering(name, description, prerequisite.map { it.modulePhase }.toSet(), lowering) - fun NamedCompilerPhase>.toModuleLowering() = ModuleLowering(this.name, this) private val validateIrBeforeLowering = makeCustomJsModulePhase( @@ -378,7 +361,7 @@ private val propertyLazyInitLoweringPhase = makeBodyLoweringPhase( private val removeInitializersForLazyProperties = makeDeclarationTransformerPhase( ::RemoveInitializersForLazyProperties, name = "RemoveInitializersForLazyProperties", - description = "Remove property initializers if they was initialised lazily" + description = "Remove property initializers if they was initialized lazily" ) private val propertyAccessorInlinerLoweringPhase = makeBodyLoweringPhase( diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/compiler.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/compiler.kt index bf466560798..22df3e9ab30 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/compiler.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/compiler.kt @@ -48,7 +48,8 @@ fun compile( dceDriven: Boolean = false, es6mode: Boolean = false, multiModule: Boolean = false, - relativeRequirePath: Boolean = false + relativeRequirePath: Boolean = false, + propertyLazyInitialization: Boolean, ): CompilerResult { stageController = StageController() @@ -62,7 +63,16 @@ fun compile( is MainModule.Klib -> dependencyModules } - val context = JsIrBackendContext(moduleDescriptor, irBuiltIns, symbolTable, allModules.first(), exportedDeclarations, configuration, es6mode = es6mode) + val context = JsIrBackendContext( + moduleDescriptor, + irBuiltIns, + symbolTable, + allModules.first(), + exportedDeclarations, + configuration, + es6mode = es6mode, + propertyLazyInitialization = propertyLazyInitialization, + ) // Load declarations referenced during `context` initialization val irProviders = listOf(deserializer) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt index cd331eb612e..55a9253af4e 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt @@ -20,7 +20,6 @@ import org.jetbrains.kotlin.ir.builders.declarations.buildField import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.declarations.persistent.PersistentIrElementBase import org.jetbrains.kotlin.ir.expressions.* -import org.jetbrains.kotlin.js.config.JSConfigurationKeys.PROPERTY_LAZY_INITIALISATION import org.jetbrains.kotlin.name.Name import kotlin.collections.component1 import kotlin.collections.component2 @@ -37,43 +36,41 @@ class PropertyLazyInitLowering( private val irFactory get() = context.irFactory - val fileToInitialisationFuns - get() = context.fileToInitialisationFuns + private val fileToInitializationFuns + get() = context.fileToInitializationFuns - val fileToPurenessInitializers - get() = context.fileToPurenessInitializers + private val fileToInitializerPureness + get() = context.fileToInitializerPureness override fun lower(irBody: IrBody, container: IrDeclaration) { - if (context.configuration[PROPERTY_LAZY_INITIALISATION] != true) { + if (!context.propertyLazyInitialization) { return } if (container !is IrSimpleFunction && container !is IrField && container !is IrProperty) return - if (!container.isTopLevel) return - val file = container.parent as? IrFile ?: return val initFun = (when { - file in fileToInitialisationFuns -> fileToInitialisationFuns[file] - fileToPurenessInitializers[file] == true -> null + file in fileToInitializationFuns -> fileToInitializationFuns[file] + fileToInitializerPureness[file] == true -> null else -> { - createInitialisationFunction(file).also { - fileToInitialisationFuns[file] = it + createInitializationFunction(file).also { + fileToInitializationFuns[file] = it } } }) ?: return - val initialisationCall = JsIrBuilder.buildCall( + val initializationCall = JsIrBuilder.buildCall( target = initFun.symbol, type = initFun.returnType ) when (container) { is IrSimpleFunction -> - irBody.addInitialisation(initialisationCall, container) + irBody.addInitialization(initializationCall, container) is IrField -> { container .correspondingProperty @@ -82,13 +79,13 @@ class PropertyLazyInitLowering( ?.let { listOf(it.getter, it.setter) } ?.filterNotNull() ?.forEach { - irBody.addInitialisation(initialisationCall, it) + irBody.addInitialization(initializationCall, it) } } } } - private fun createInitialisationFunction( + private fun createInitializationFunction( file: IrFile ): IrSimpleFunction? { val fileName = file.name @@ -102,12 +99,12 @@ class PropertyLazyInitLowering( if (fieldToInitializer.isEmpty()) return null val allFieldsInFilePure = allFieldsInFilePure(fieldToInitializer.values) - fileToPurenessInitializers[file] = allFieldsInFilePure + fileToInitializerPureness[file] = allFieldsInFilePure if (allFieldsInFilePure) { return null } - val initialisedField = irFactory.createInitialisationField(fileName) + val initializedField = irFactory.createInitializationField(fileName) .apply { file.declarations.add(this) parent = file @@ -121,14 +118,14 @@ class PropertyLazyInitLowering( }.apply { buildPropertiesInitializationBody( fieldToInitializer, - initialisedField + initializedField ) } } - private fun IrFactory.createInitialisationField(fileName: String): IrField = + private fun IrFactory.createInitializationField(fileName: String): IrField = buildField { - name = Name.identifier("properties initialised $fileName") + name = Name.identifier("properties initialized $fileName") type = irBuiltIns.booleanType isStatic = true isFinal = true @@ -137,18 +134,18 @@ class PropertyLazyInitLowering( private fun IrSimpleFunction.buildPropertiesInitializationBody( initializers: Map, - initialisedField: IrField + initializedField: IrField ) { body = irFactory.createBlockBody( UNDEFINED_OFFSET, UNDEFINED_OFFSET, - buildBodyWithIfGuard(initializers, initialisedField) + buildBodyWithIfGuard(initializers, initializedField) ) } private fun buildBodyWithIfGuard( initializers: Map, - initialisedField: IrField + initializedField: IrField ): List { val statements = initializers .map { (field, expression) -> @@ -156,13 +153,13 @@ class PropertyLazyInitLowering( } val upGuard = createIrSetField( - initialisedField, + initializedField, JsIrBuilder.buildBoolean(context.irBuiltIns.booleanType, true) ) return JsIrBuilder.buildIfElse( type = irBuiltIns.unitType, - cond = calculator.not(createIrGetField(initialisedField)), + cond = calculator.not(createIrGetField(initializedField)), thenBranch = JsIrBuilder.buildComposite( type = irBuiltIns.unitType, statements = mutableListOf(upGuard).apply { addAll(statements) } @@ -171,7 +168,7 @@ class PropertyLazyInitLowering( } } -private fun IrBody.addInitialisation( +private fun IrBody.addInitialization( initCall: IrCall, container: IrSimpleFunction ) { @@ -217,11 +214,11 @@ class RemoveInitializersForLazyProperties( private val context: JsIrBackendContext ) : DeclarationTransformer { - val fileToPurenessInitializers - get() = context.fileToPurenessInitializers + private val fileToInitializerPureness + get() = context.fileToInitializerPureness override fun transformFlat(declaration: IrDeclaration): List? { - if (context.configuration[PROPERTY_LAZY_INITIALISATION] != true) { + if (!context.propertyLazyInitialization) { return null } @@ -229,9 +226,9 @@ class RemoveInitializersForLazyProperties( val file = declaration.parent as? IrFile ?: return null - if (fileToPurenessInitializers[file] == true) return null + if (fileToInitializerPureness[file] == true) return null - val allFieldsInFilePure = fileToPurenessInitializers[file] + val allFieldsInFilePure = fileToInitializerPureness[file] ?: calculateFileFieldsPureness(file) if (allFieldsInFilePure) { @@ -252,7 +249,7 @@ class RemoveInitializersForLazyProperties( .values val allFieldsInFilePure = allFieldsInFilePure(expressions) - fileToPurenessInitializers[file] = allFieldsInFilePure + fileToInitializerPureness[file] = allFieldsInFilePure return allFieldsInFilePure } } diff --git a/compiler/testData/cli/js/jsExtraHelp.out b/compiler/testData/cli/js/jsExtraHelp.out index 3e7e3f6cd6b..5dec79a8564 100644 --- a/compiler/testData/cli/js/jsExtraHelp.out +++ b/compiler/testData/cli/js/jsExtraHelp.out @@ -18,8 +18,8 @@ where advanced options include: -Xir-produce-klib-dir Generate unpacked KLIB into parent directory of output JS file. In combination with -meta-info generates both IR and pre-IR versions of library. -Xir-produce-klib-file Generate packed klib into file specified by -output. Disables pre-IR backend - -Xir-property-lazy-initialisation - Perform lazy initialisation for properties + -Xir-property-lazy-initialization + Perform lazy initialization for properties -Xmetadata-only Generate *.meta.js and *.kjsm files only -Xtyped-arrays Translate primitive arrays to JS typed arrays -Xwasm Use experimental WebAssembly compiler backend diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 33565b25640..2507d84c0ab 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -23144,11 +23144,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/properties/kt9603.kt"); } - @TestMetadata("lazyInitialization.kt") - public void testLazyInitialization() throws Exception { - runTest("compiler/testData/codegen/box/properties/lazyInitialization.kt"); - } - @TestMetadata("primitiveOverrideDefaultAccessor.kt") public void testPrimitiveOverrideDefaultAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/primitiveOverrideDefaultAccessor.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 38eb8b8533f..1b0a7860b6a 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -23149,11 +23149,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/properties/kt9603.kt"); } - @TestMetadata("lazyInitialization.kt") - public void testLazyInitialization() throws Exception { - runTest("compiler/testData/codegen/box/properties/lazyInitialization.kt"); - } - @TestMetadata("primitiveOverrideDefaultAccessor.kt") public void testPrimitiveOverrideDefaultAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/primitiveOverrideDefaultAccessor.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index e0e6057ba3f..9e5864a4ad4 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -21373,11 +21373,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/properties/kt9603.kt"); } - @TestMetadata("lazyInitialization.kt") - public void testLazyInitialization() throws Exception { - runTest("compiler/testData/codegen/box/properties/lazyInitialization.kt"); - } - @TestMetadata("primitiveOverrideDefaultAccessor.kt") public void testPrimitiveOverrideDefaultAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/primitiveOverrideDefaultAccessor.kt"); diff --git a/js/js.frontend/src/org/jetbrains/kotlin/js/config/JSConfigurationKeys.java b/js/js.frontend/src/org/jetbrains/kotlin/js/config/JSConfigurationKeys.java index 160238dcb45..71a1ce9b29f 100644 --- a/js/js.frontend/src/org/jetbrains/kotlin/js/config/JSConfigurationKeys.java +++ b/js/js.frontend/src/org/jetbrains/kotlin/js/config/JSConfigurationKeys.java @@ -89,7 +89,4 @@ public class JSConfigurationKeys { public static final CompilerConfigurationKey ERROR_TOLERANCE_POLICY = CompilerConfigurationKey.create("set up policy to ignore compilation errors"); - - public static final CompilerConfigurationKey PROPERTY_LAZY_INITIALISATION = - CompilerConfigurationKey.create("enable property lazy initialisation"); } diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt index c63fcd409eb..9c4c05785a2 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt @@ -131,7 +131,7 @@ abstract class BasicBoxTest( val skipDceDriven = SKIP_DCE_DRIVEN.matcher(fileContent).find() val splitPerModule = SPLIT_PER_MODULE.matcher(fileContent).find() - val propertyLazyInitialization = PROPERTY_LAZY_INITIALISATION.matcher(fileContent).find() + val propertyLazyInitialization = PROPERTY_LAZY_INITIALIZATION.matcher(fileContent).find() TestFileFactoryImpl(coroutinesPackage).use { testFactory -> val inputFiles = TestFiles.createTestFiles( @@ -420,7 +420,7 @@ abstract class BasicBoxTest( skipDceDriven: Boolean, splitPerModule: Boolean, errorIgnorancePolicy: ErrorTolerancePolicy, - propertyLazyInitialisation: Boolean, + propertyLazyInitialization: Boolean, ) { val kotlinFiles = module.files.filter { it.fileName.endsWith(".kt") } val testFiles = kotlinFiles.map { it.fileName } @@ -447,7 +447,6 @@ abstract class BasicBoxTest( incrementalData = null, expectActualLinker = expectActualLinker, errorIgnorancePolicy, - propertyLazyInitialisation ) val outputFile = File(outputFileName) val dceOutputFile = File(dceOutputFileName) @@ -455,8 +454,23 @@ abstract class BasicBoxTest( val incrementalData = IncrementalData() translateFiles( - psiFiles.map(TranslationUnit::SourceFile), outputFile, dceOutputFile, pirOutputFile, config, outputPrefixFile, outputPostfixFile, - mainCallParameters, incrementalData, remap, testPackage, testFunction, needsFullIrRuntime, isMainModule, skipDceDriven, splitPerModule + psiFiles.map(TranslationUnit::SourceFile), + outputFile, + dceOutputFile, + pirOutputFile, + config, + outputPrefixFile, + outputPostfixFile, + mainCallParameters, + incrementalData, + remap, + testPackage, + testFunction, + needsFullIrRuntime, + isMainModule, + skipDceDriven, + splitPerModule, + propertyLazyInitialization, ) if (incrementalCompilationChecksEnabled && module.hasFilesToRecompile) { @@ -514,13 +528,27 @@ abstract class BasicBoxTest( incrementalData, expectActualLinker, ErrorTolerancePolicy.DEFAULT, - propertyLazyInitialisation = false ) val recompiledOutputFile = File(outputFile.parentFile, outputFile.nameWithoutExtension + "-recompiled.js") translateFiles( - translationUnits, recompiledOutputFile, recompiledOutputFile, recompiledOutputFile, recompiledConfig, outputPrefixFile, outputPostfixFile, - mainCallParameters, incrementalData, remap, testPackage, testFunction, needsFullIrRuntime, false, true, false + translationUnits, + recompiledOutputFile, + recompiledOutputFile, + recompiledOutputFile, + recompiledConfig, + outputPrefixFile, + outputPostfixFile, + mainCallParameters, + incrementalData, + remap, + testPackage, + testFunction, + needsFullIrRuntime, + isMainModule = false, + skipDceDriven = true, + splitPerModule = false, + propertyLazyInitialization = false, ) val originalOutput = FileUtil.loadFile(outputFile) @@ -594,7 +622,8 @@ abstract class BasicBoxTest( needsFullIrRuntime: Boolean, isMainModule: Boolean, skipDceDriven: Boolean, - splitPerModule: Boolean + splitPerModule: Boolean, + propertyLazyInitialization: Boolean, ) { val translator = K2JSTranslator(config, false) val translationResult = translator.translateUnits(ExceptionThrowingReporter, units, mainCallParameters) @@ -740,7 +769,6 @@ abstract class BasicBoxTest( incrementalData: IncrementalData?, expectActualLinker: Boolean, errorIgnorancePolicy: ErrorTolerancePolicy, - propertyLazyInitialisation: Boolean, ): JsConfig { val configuration = environment.configuration.copy() @@ -764,7 +792,6 @@ abstract class BasicBoxTest( configuration.put(JSConfigurationKeys.MODULE_KIND, module.moduleKind) configuration.put(JSConfigurationKeys.TARGET, EcmaVersion.v5) configuration.put(JSConfigurationKeys.ERROR_TOLERANCE_POLICY, errorIgnorancePolicy) - configuration.put(JSConfigurationKeys.PROPERTY_LAZY_INITIALISATION, propertyLazyInitialisation) if (errorIgnorancePolicy.allowErrors) { configuration.put(JSConfigurationKeys.DEVELOPER_MODE, true) @@ -998,7 +1025,7 @@ abstract class BasicBoxTest( private val ERROR_POLICY_PATTERN = Pattern.compile("^// *ERROR_POLICY: *(.+)$", Pattern.MULTILINE) - private val PROPERTY_LAZY_INITIALISATION = Pattern.compile("^// *PROPERTY_LAZY_INITIALISATION *$", Pattern.MULTILINE) + private val PROPERTY_LAZY_INITIALIZATION = Pattern.compile("^// *PROPERTY_LAZY_INITIALIZATION *$", Pattern.MULTILINE) @JvmStatic protected val runTestInNashorn = getBoolean("kotlin.js.useNashorn") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt index d08ee6094ed..9002741d78e 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt @@ -93,7 +93,8 @@ abstract class BasicIrBoxTest( needsFullIrRuntime: Boolean, isMainModule: Boolean, skipDceDriven: Boolean, - splitPerModule: Boolean + splitPerModule: Boolean, + propertyLazyInitialization: Boolean, ) { val filesToCompile = units.map { (it as TranslationUnit.SourceFile).file } @@ -143,7 +144,8 @@ abstract class BasicIrBoxTest( generateFullJs = true, generateDceJs = runIrDce, es6mode = runEs6Mode, - multiModule = splitPerModule || perModule + multiModule = splitPerModule || perModule, + propertyLazyInitialization = propertyLazyInitialization, ) compiledModule.jsCode!!.writeTo(outputFile, config) @@ -169,7 +171,8 @@ abstract class BasicIrBoxTest( exportedDeclarations = setOf(FqName.fromSegments(listOfNotNull(testPackage, testFunction))), dceDriven = true, es6mode = runEs6Mode, - multiModule = splitPerModule || perModule + multiModule = splitPerModule || perModule, + propertyLazyInitialization = propertyLazyInitialization ).jsCode!!.writeTo(pirOutputFile, config) } } else { diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java index 808d305870a..72847fb334f 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java @@ -6786,6 +6786,26 @@ public class IrBoxJsES6TestGenerated extends AbstractIrBoxJsES6Test { runTest("js/js.translator/testData/box/propertyAccess/initValInConstructor.kt"); } + @TestMetadata("lazyInitialization.kt") + public void testLazyInitialization() throws Exception { + runTest("js/js.translator/testData/box/propertyAccess/lazyInitialization.kt"); + } + + @TestMetadata("lazyInitializationOrder.kt") + public void testLazyInitializationOrder() throws Exception { + runTest("js/js.translator/testData/box/propertyAccess/lazyInitializationOrder.kt"); + } + + @TestMetadata("lazyInitializationPure.kt") + public void testLazyInitializationPure() throws Exception { + runTest("js/js.translator/testData/box/propertyAccess/lazyInitializationPure.kt"); + } + + @TestMetadata("lazyInitializationSplitPerModule.kt") + public void testLazyInitializationSplitPerModule() throws Exception { + runTest("js/js.translator/testData/box/propertyAccess/lazyInitializationSplitPerModule.kt"); + } + @TestMetadata("overloadedOverriddenFunctionPropertyName.kt") public void testOverloadedOverriddenFunctionPropertyName() throws Exception { runTest("js/js.translator/testData/box/propertyAccess/overloadedOverriddenFunctionPropertyName.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index c18bbfc6bb2..ded22676945 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -17629,16 +17629,6 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/properties/kt9603.kt"); } - @TestMetadata("lazyInitialization.kt") - public void testLazyInitialization() throws Exception { - runTest("compiler/testData/codegen/box/properties/lazyInitialization.kt"); - } - - @TestMetadata("lazyInitializationPure.kt") - public void testLazyInitializationPure() throws Exception { - runTest("compiler/testData/codegen/box/properties/lazyInitializationPure.kt"); - } - @TestMetadata("primitiveOverrideDefaultAccessor.kt") public void testPrimitiveOverrideDefaultAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/primitiveOverrideDefaultAccessor.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java index 14377b8240e..61cbddedf67 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java @@ -6786,6 +6786,26 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest { runTest("js/js.translator/testData/box/propertyAccess/initValInConstructor.kt"); } + @TestMetadata("lazyInitialization.kt") + public void testLazyInitialization() throws Exception { + runTest("js/js.translator/testData/box/propertyAccess/lazyInitialization.kt"); + } + + @TestMetadata("lazyInitializationOrder.kt") + public void testLazyInitializationOrder() throws Exception { + runTest("js/js.translator/testData/box/propertyAccess/lazyInitializationOrder.kt"); + } + + @TestMetadata("lazyInitializationPure.kt") + public void testLazyInitializationPure() throws Exception { + runTest("js/js.translator/testData/box/propertyAccess/lazyInitializationPure.kt"); + } + + @TestMetadata("lazyInitializationSplitPerModule.kt") + public void testLazyInitializationSplitPerModule() throws Exception { + runTest("js/js.translator/testData/box/propertyAccess/lazyInitializationSplitPerModule.kt"); + } + @TestMetadata("overloadedOverriddenFunctionPropertyName.kt") public void testOverloadedOverriddenFunctionPropertyName() throws Exception { runTest("js/js.translator/testData/box/propertyAccess/overloadedOverriddenFunctionPropertyName.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index c1200b0aa20..f4943aebaf4 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -17629,16 +17629,6 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/properties/kt9603.kt"); } - @TestMetadata("lazyInitialization.kt") - public void testLazyInitialization() throws Exception { - runTest("compiler/testData/codegen/box/properties/lazyInitialization.kt"); - } - - @TestMetadata("lazyInitializationPure.kt") - public void testLazyInitializationPure() throws Exception { - runTest("compiler/testData/codegen/box/properties/lazyInitializationPure.kt"); - } - @TestMetadata("primitiveOverrideDefaultAccessor.kt") public void testPrimitiveOverrideDefaultAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/primitiveOverrideDefaultAccessor.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java index 7ba15667bbe..6a78d1ee0e5 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java @@ -6816,6 +6816,26 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest { runTest("js/js.translator/testData/box/propertyAccess/initValInConstructor.kt"); } + @TestMetadata("lazyInitialization.kt") + public void testLazyInitialization() throws Exception { + runTest("js/js.translator/testData/box/propertyAccess/lazyInitialization.kt"); + } + + @TestMetadata("lazyInitializationOrder.kt") + public void testLazyInitializationOrder() throws Exception { + runTest("js/js.translator/testData/box/propertyAccess/lazyInitializationOrder.kt"); + } + + @TestMetadata("lazyInitializationPure.kt") + public void testLazyInitializationPure() throws Exception { + runTest("js/js.translator/testData/box/propertyAccess/lazyInitializationPure.kt"); + } + + @TestMetadata("lazyInitializationSplitPerModule.kt") + public void testLazyInitializationSplitPerModule() throws Exception { + runTest("js/js.translator/testData/box/propertyAccess/lazyInitializationSplitPerModule.kt"); + } + @TestMetadata("overloadedOverriddenFunctionPropertyName.kt") public void testOverloadedOverriddenFunctionPropertyName() throws Exception { runTest("js/js.translator/testData/box/propertyAccess/overloadedOverriddenFunctionPropertyName.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index c92775e4abb..18ef3e5b394 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -17734,11 +17734,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/properties/kt9603.kt"); } - @TestMetadata("lazyInitialization.kt") - public void testLazyInitialization() throws Exception { - runTest("compiler/testData/codegen/box/properties/lazyInitialization.kt"); - } - @TestMetadata("primitiveOverrideDefaultAccessor.kt") public void testPrimitiveOverrideDefaultAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/primitiveOverrideDefaultAccessor.kt"); diff --git a/compiler/testData/codegen/box/properties/lazyInitialization.kt b/js/js.translator/testData/box/propertyAccess/lazyInitialization.kt similarity index 72% rename from compiler/testData/codegen/box/properties/lazyInitialization.kt rename to js/js.translator/testData/box/propertyAccess/lazyInitialization.kt index 945b48e5932..50f5cf093b5 100644 --- a/compiler/testData/codegen/box/properties/lazyInitialization.kt +++ b/js/js.translator/testData/box/propertyAccess/lazyInitialization.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS // DONT_TARGET_EXACT_BACKEND: WASM -// PROPERTY_LAZY_INITIALISATION +// PROPERTY_LAZY_INITIALIZATION // FILE: A.kt diff --git a/js/js.translator/testData/box/propertyAccess/lazyInitializationOrder.kt b/js/js.translator/testData/box/propertyAccess/lazyInitializationOrder.kt new file mode 100644 index 00000000000..d46ce65701f --- /dev/null +++ b/js/js.translator/testData/box/propertyAccess/lazyInitializationOrder.kt @@ -0,0 +1,36 @@ +// EXPECTED_REACHABLE_NODES: 1239 +// DONT_TARGET_EXACT_BACKEND: WASM +// PROPERTY_LAZY_INITIALIZATION + +// FILE: A.kt + +val a = "A".let { + flag = !flag + if (flag) { + it + } else { + "!A" + } +} + +val b = "B".let { + flag = !flag + if (!flag) { + it + } else { + "!B" + } +} + +// FILE: B.kt +var flag: Boolean = false + +// FILE: main.kt + +fun box(): String { + return if ( + a == "A" && b == "B" + ) + "OK" + else "a = $a; b = ${b}" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/properties/lazyInitializationPure.kt b/js/js.translator/testData/box/propertyAccess/lazyInitializationPure.kt similarity index 81% rename from compiler/testData/codegen/box/properties/lazyInitializationPure.kt rename to js/js.translator/testData/box/propertyAccess/lazyInitializationPure.kt index 7103b238896..c0f377a5c91 100644 --- a/compiler/testData/codegen/box/properties/lazyInitializationPure.kt +++ b/js/js.translator/testData/box/propertyAccess/lazyInitializationPure.kt @@ -1,5 +1,5 @@ -// TARGET_BACKEND: JS_IR -// PROPERTY_LAZY_INITIALISATION +// IGNORE_BACKEND: JS +// PROPERTY_LAZY_INITIALIZATION // FILE: A.kt @@ -18,7 +18,7 @@ val e = d // FILE: main.kt fun box(): String { - d + // Get only e to initialize all properties in file e return if ( js("a") === "A" && diff --git a/js/js.translator/testData/box/propertyAccess/lazyInitializationSplitPerModule.kt b/js/js.translator/testData/box/propertyAccess/lazyInitializationSplitPerModule.kt new file mode 100644 index 00000000000..fa99790a96a --- /dev/null +++ b/js/js.translator/testData/box/propertyAccess/lazyInitializationSplitPerModule.kt @@ -0,0 +1,22 @@ +// IGNORE_BACKEND: JS +// DONT_TARGET_EXACT_BACKEND: WASM +// SPLIT_PER_MODULE +// PROPERTY_LAZY_INITIALIZATION + +// MODULE: lib1 +// FILE: A.kt +val o = "O" + +// FILE: B.kt +val okCandidate = o + k + +// FILE: C.kt +val k = "K" + +// MODULE: lib2(lib1) +// FILE: lib2.kt +val ok = okCandidate + +// MODULE: main(lib1, lib2) +// FILE: main.kt +fun box(): String = ok \ No newline at end of file From ed481add084b854878f0efb105f813e450f61c1f Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Fri, 20 Nov 2020 19:33:52 +0100 Subject: [PATCH 073/698] Fix performance regression in KotlinSuppressCache.isSuppressedByAnnotated After a seemingly innocent refactoring in 61548a0a36, we've lost the optimization that was enabled by the suppressorAbove logic in isSuppressedByAnnotated. --- .../resolve/diagnostics/KotlinSuppressCache.kt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/KotlinSuppressCache.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/KotlinSuppressCache.kt index 6b355d1dbc1..d870fc079c3 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/KotlinSuppressCache.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/KotlinSuppressCache.kt @@ -115,7 +115,7 @@ abstract class KotlinSuppressCache { val suppressor = getOrCreateSuppressor(annotated) if (suppressor.isSuppressed(suppressionKey, severity)) return true - val annotatedAbove = KtStubbedPsiUtil.getPsiOrStubParent(annotated, KtAnnotated::class.java, true) ?: return false + val annotatedAbove = KtStubbedPsiUtil.getPsiOrStubParent(suppressor.annotatedElement, KtAnnotated::class.java, true) ?: return false val suppressed = isSuppressedByAnnotated(suppressionKey, severity, annotatedAbove, debugDepth + 1) val suppressorAbove = suppressors[annotatedAbove] @@ -130,9 +130,9 @@ abstract class KotlinSuppressCache { suppressors.getOrPut(annotated) { val strings = getSuppressingStrings(annotated) when (strings.size) { - 0 -> EmptySuppressor - 1 -> SingularSuppressor(strings.first()) - else -> MultiSuppressor(strings) + 0 -> EmptySuppressor(annotated) + 1 -> SingularSuppressor(annotated, strings.first()) + else -> MultiSuppressor(annotated, strings) } } @@ -170,7 +170,7 @@ abstract class KotlinSuppressCache { severity == Severity.WARNING && "warnings" in strings || key in strings } - private abstract class Suppressor { + private abstract class Suppressor(val annotatedElement: KtAnnotated) { open fun isSuppressed(diagnostic: Diagnostic): Boolean = isSuppressed(getDiagnosticSuppressKey(diagnostic), diagnostic.severity) @@ -180,13 +180,13 @@ abstract class KotlinSuppressCache { abstract fun dominates(other: Suppressor): Boolean } - private object EmptySuppressor : Suppressor() { + private class EmptySuppressor(annotated: KtAnnotated) : Suppressor(annotated) { override fun isSuppressed(diagnostic: Diagnostic): Boolean = false override fun isSuppressed(suppressionKey: String, severity: Severity): Boolean = false - override fun dominates(other: Suppressor): Boolean = this === other + override fun dominates(other: Suppressor): Boolean = other is EmptySuppressor } - private class SingularSuppressor(private val string: String) : Suppressor() { + private class SingularSuppressor(annotated: KtAnnotated, private val string: String) : Suppressor(annotated) { override fun isSuppressed(suppressionKey: String, severity: Severity): Boolean { return isSuppressedByStrings(suppressionKey, ImmutableSet.of(string), severity) } @@ -196,7 +196,7 @@ abstract class KotlinSuppressCache { } } - private class MultiSuppressor(private val strings: Set) : Suppressor() { + private class MultiSuppressor(annotated: KtAnnotated, private val strings: Set) : Suppressor(annotated) { override fun isSuppressed(suppressionKey: String, severity: Severity): Boolean { return isSuppressedByStrings(suppressionKey, strings, severity) } From ca78261d7f48989c1097b97687626f18123a3262 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Tue, 17 Nov 2020 21:18:42 +0100 Subject: [PATCH 074/698] Minor, fix "unknown -Xstring-concat mode" error message --- compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt index 102a62e533e..8d8fdcc0549 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt @@ -61,8 +61,8 @@ fun CompilerConfiguration.setupJvmSpecificArguments(arguments: K2JVMCompilerArgu } } else { messageCollector.report( - ERROR, "Unknown `string-concat` mode: ${arguments.jvmTarget}\n" + - "Supported versions: ${JvmStringConcat.values().joinToString { it.name.toLowerCase() }}" + ERROR, "Unknown -Xstring-concat mode: ${arguments.jvmTarget}\n" + + "Supported versions: ${JvmStringConcat.values().joinToString { it.description }}" ) } } From 3a166f359269142def2dd82cc3b216a20af468d8 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Tue, 24 Nov 2020 14:22:47 +0300 Subject: [PATCH 075/698] KT-43525 forbid @JvmOverloads on mangled funs and hidden constructors --- ...endDiagnosticsTestWithStdlibGenerated.java | 5 ++ .../ir/FirBlackBoxCodegenTestGenerated.java | 5 ++ .../jvm/checkers/declarationCheckers.kt | 68 ++++++++++++------- .../diagnostics/DefaultErrorMessagesJvm.java | 3 + .../resolve/jvm/diagnostics/ErrorsJvm.java | 3 +- ...pLevelFunctionReturningInlineClassValue.kt | 10 +++ ...pLevelFunctionReturningInlineClassValue.kt | 6 ++ ...LevelFunctionReturningInlineClassValue.txt | 25 +++++++ .../jvmOverloadsOnMangledFunctions.fir.kt | 30 ++++++++ .../jvmOverloadsOnMangledFunctions.kt | 30 ++++++++ .../jvmOverloadsOnMangledFunctions.txt | 24 +++++++ .../DiagnosticsTestWithStdLibGenerated.java | 5 ++ ...ticsTestWithStdLibUsingJavacGenerated.java | 5 ++ .../codegen/BlackBoxCodegenTestGenerated.java | 5 ++ .../codegen/BytecodeListingTestGenerated.java | 5 ++ .../LightAnalysisModeTestGenerated.java | 5 ++ .../ir/IrBlackBoxCodegenTestGenerated.java | 5 ++ .../ir/IrBytecodeListingTestGenerated.java | 5 ++ 18 files changed, 218 insertions(+), 26 deletions(-) create mode 100644 compiler/testData/codegen/box/inlineClasses/jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt create mode 100644 compiler/testData/codegen/bytecodeListing/inlineClasses/jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt create mode 100644 compiler/testData/codegen/bytecodeListing/inlineClasses/jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.txt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/annotations/jvmOverloads/jvmOverloadsOnMangledFunctions.fir.kt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/annotations/jvmOverloads/jvmOverloadsOnMangledFunctions.kt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/annotations/jvmOverloads/jvmOverloadsOnMangledFunctions.txt diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java index 9198d789c27..4fa7f64cada 100644 --- a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java +++ b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java @@ -690,6 +690,11 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmOverloads/jvmOverloadsOnAnnotationClassConstructor_1_4.kt"); } + @TestMetadata("jvmOverloadsOnMangledFunctions.kt") + public void testJvmOverloadsOnMangledFunctions() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmOverloads/jvmOverloadsOnMangledFunctions.kt"); + } + @TestMetadata("jvmOverloadsOnPrivate.kt") public void testJvmOverloadsOnPrivate() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmOverloads/jvmOverloadsOnPrivate.kt"); diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index fc3fc9a4d51..80baaeb9c96 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -13862,6 +13862,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/inlineClasses/jvmFieldInInlineClassCompanion.kt"); } + @TestMetadata("jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt") + public void testJvmOverloadsOnTopLevelFunctionReturningInlineClassValue() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt"); + } + @TestMetadata("jvmStaticFunInInlineClassCompanion.kt") public void testJvmStaticFunInInlineClassCompanion() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/jvmStaticFunInInlineClassCompanion.kt"); diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/declarationCheckers.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/declarationCheckers.kt index 05270d14842..2060f6f40a8 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/declarationCheckers.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/declarationCheckers.kt @@ -44,13 +44,15 @@ import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm import org.jetbrains.kotlin.resolve.jvm.isInlineClassThatRequiresMangling import org.jetbrains.kotlin.resolve.jvm.requiresFunctionNameManglingForParameterTypes import org.jetbrains.kotlin.resolve.jvm.requiresFunctionNameManglingForReturnType +import org.jetbrains.kotlin.resolve.jvm.shouldHideConstructorDueToInlineClassTypeValueParameters class LocalFunInlineChecker : DeclarationChecker { override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) { if (InlineUtil.isInline(descriptor) && declaration is KtNamedFunction && descriptor is FunctionDescriptor && - descriptor.visibility == DescriptorVisibilities.LOCAL) { + descriptor.visibility == DescriptorVisibilities.LOCAL + ) { context.trace.report(Errors.NOT_YET_SUPPORTED_IN_INLINE.on(declaration, "Local inline functions")) } } @@ -66,7 +68,8 @@ class JvmStaticChecker(jvmTarget: JvmTarget, languageVersionSettings: LanguageVe if (declaration is KtNamedFunction || declaration is KtProperty || declaration is KtPropertyAccessor || - declaration is KtParameter) { + declaration is KtParameter + ) { checkDeclaration(declaration, descriptor, context.trace) } } @@ -85,7 +88,8 @@ class JvmStaticChecker(jvmTarget: JvmTarget, languageVersionSettings: LanguageVe if (!insideObject || insideCompanionObjectInInterface) { if (insideCompanionObjectInInterface && supportJvmStaticInInterface && - descriptor is DeclarationDescriptorWithVisibility) { + descriptor is DeclarationDescriptorWithVisibility + ) { checkVisibility(descriptor, diagnosticHolder, declaration) if (isLessJVM18) { diagnosticHolder.report(ErrorsJvm.JVM_STATIC_IN_INTERFACE_1_6.on(declaration)) @@ -201,7 +205,7 @@ class SynchronizedAnnotationChecker : DeclarationChecker { (descriptor.hasJvmStaticAnnotation() || descriptor.propertyIfAccessor.hasJvmStaticAnnotation())) } -class OverloadsAnnotationChecker: DeclarationChecker { +class OverloadsAnnotationChecker : DeclarationChecker { override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) { descriptor.findJvmOverloadsAnnotation()?.let { annotation -> val annotationEntry = DescriptorToSourceUtils.getSourceFromAnnotation(annotation) @@ -218,26 +222,40 @@ class OverloadsAnnotationChecker: DeclarationChecker { ) { val diagnosticHolder = context.trace - if (descriptor !is CallableDescriptor) { - return - } else if ((descriptor.containingDeclaration as? ClassDescriptor)?.kind == ClassKind.INTERFACE) { - diagnosticHolder.report(ErrorsJvm.OVERLOADS_INTERFACE.on(annotationEntry)) - } else if (descriptor is FunctionDescriptor && descriptor.modality == Modality.ABSTRACT) { - diagnosticHolder.report(ErrorsJvm.OVERLOADS_ABSTRACT.on(annotationEntry)) - } else if (DescriptorUtils.isLocal(descriptor)) { - diagnosticHolder.report(ErrorsJvm.OVERLOADS_LOCAL.on(annotationEntry)) - } else if (descriptor.isAnnotationConstructor()) { - val diagnostic = - if (context.languageVersionSettings.supportsFeature(LanguageFeature.ProhibitJvmOverloadsOnConstructorsOfAnnotationClasses)) - ErrorsJvm.OVERLOADS_ANNOTATION_CLASS_CONSTRUCTOR - else - ErrorsJvm.OVERLOADS_ANNOTATION_CLASS_CONSTRUCTOR_WARNING + if (descriptor !is CallableDescriptor) return - diagnosticHolder.report(diagnostic.on(annotationEntry)) - } else if (!descriptor.visibility.isPublicAPI && descriptor.visibility != DescriptorVisibilities.INTERNAL) { - diagnosticHolder.report(ErrorsJvm.OVERLOADS_PRIVATE.on(annotationEntry)) - } else if (descriptor.valueParameters.none { it.declaresDefaultValue() || it.isActualParameterWithCorrespondingExpectedDefault }) { - diagnosticHolder.report(ErrorsJvm.OVERLOADS_WITHOUT_DEFAULT_ARGUMENTS.on(annotationEntry)) + when { + (descriptor.containingDeclaration as? ClassDescriptor)?.kind == ClassKind.INTERFACE -> + diagnosticHolder.report(ErrorsJvm.OVERLOADS_INTERFACE.on(annotationEntry)) + + descriptor is FunctionDescriptor && descriptor.modality == Modality.ABSTRACT -> + diagnosticHolder.report(ErrorsJvm.OVERLOADS_ABSTRACT.on(annotationEntry)) + + DescriptorUtils.isLocal(descriptor) -> + diagnosticHolder.report(ErrorsJvm.OVERLOADS_LOCAL.on(annotationEntry)) + + descriptor.isAnnotationConstructor() -> { + val diagnostic = + if (context.languageVersionSettings.supportsFeature(LanguageFeature.ProhibitJvmOverloadsOnConstructorsOfAnnotationClasses)) + ErrorsJvm.OVERLOADS_ANNOTATION_CLASS_CONSTRUCTOR + else + ErrorsJvm.OVERLOADS_ANNOTATION_CLASS_CONSTRUCTOR_WARNING + + diagnosticHolder.report(diagnostic.on(annotationEntry)) + } + + !descriptor.visibility.isPublicAPI && descriptor.visibility != DescriptorVisibilities.INTERNAL -> + diagnosticHolder.report(ErrorsJvm.OVERLOADS_PRIVATE.on(annotationEntry)) + + descriptor.valueParameters.none { it.declaresDefaultValue() || it.isActualParameterWithCorrespondingExpectedDefault } -> + diagnosticHolder.report(ErrorsJvm.OVERLOADS_WITHOUT_DEFAULT_ARGUMENTS.on(annotationEntry)) + + descriptor is SimpleFunctionDescriptor && + (requiresFunctionNameManglingForParameterTypes(descriptor) || requiresFunctionNameManglingForReturnType(descriptor)) -> + diagnosticHolder.report(ErrorsJvm.OVERLOADS_ANNOTATION_MANGLED_FUNCTION.on(annotationEntry)) + + descriptor is ClassConstructorDescriptor && shouldHideConstructorDueToInlineClassTypeValueParameters(descriptor) -> + diagnosticHolder.report(ErrorsJvm.OVERLOADS_ANNOTATION_HIDDEN_CONSTRUCTOR.on(annotationEntry)) } } } @@ -245,8 +263,8 @@ class OverloadsAnnotationChecker: DeclarationChecker { class TypeParameterBoundIsNotArrayChecker : DeclarationChecker { override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) { val typeParameters = (descriptor as? CallableDescriptor)?.typeParameters - ?: (descriptor as? ClassDescriptor)?.declaredTypeParameters - ?: return + ?: (descriptor as? ClassDescriptor)?.declaredTypeParameters + ?: return for (typeParameter in typeParameters) { if (typeParameter.upperBounds.any { KotlinBuiltIns.isArray(it) || KotlinBuiltIns.isPrimitiveArray(it) }) { diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java index 0b82f714d2c..e4532c94ac3 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java @@ -52,8 +52,11 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension { MAP.put(OVERLOADS_LOCAL, "'@JvmOverloads' annotation cannot be used on local declarations"); MAP.put(OVERLOADS_ANNOTATION_CLASS_CONSTRUCTOR_WARNING, "'@JvmOverloads' annotation on constructors of annotation classes is deprecated"); MAP.put(OVERLOADS_ANNOTATION_CLASS_CONSTRUCTOR, "'@JvmOverloads' annotation cannot be used on constructors of annotation classes"); + MAP.put(OVERLOADS_ANNOTATION_HIDDEN_CONSTRUCTOR, "'@JvmOverloads' annotation cannot be used on constructors hidden by inline class rules"); + MAP.put(OVERLOADS_ANNOTATION_MANGLED_FUNCTION, "'@JvmOverloads' annotation cannot be used on functions mangled by inline class rules"); MAP.put(INAPPLICABLE_JVM_NAME, "'@JvmName' annotation is not applicable to this declaration"); MAP.put(ILLEGAL_JVM_NAME, "Illegal JVM name"); + MAP.put(VOLATILE_ON_VALUE, "'@Volatile' annotation cannot be used on immutable properties"); MAP.put(VOLATILE_ON_DELEGATE, "'@Volatile' annotation cannot be used on delegated properties"); MAP.put(SYNCHRONIZED_ON_ABSTRACT, "'@Synchronized' annotation cannot be used on abstract functions"); diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java index b20e3d57556..09134f13e33 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java @@ -55,7 +55,8 @@ public interface ErrorsJvm { DiagnosticFactory0 OVERLOADS_LOCAL = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 OVERLOADS_ANNOTATION_CLASS_CONSTRUCTOR_WARNING = DiagnosticFactory0.create(WARNING); DiagnosticFactory0 OVERLOADS_ANNOTATION_CLASS_CONSTRUCTOR = DiagnosticFactory0.create(ERROR); - + DiagnosticFactory0 OVERLOADS_ANNOTATION_MANGLED_FUNCTION = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 OVERLOADS_ANNOTATION_HIDDEN_CONSTRUCTOR = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 EXTERNAL_DECLARATION_CANNOT_BE_ABSTRACT = DiagnosticFactory0.create(ERROR, ABSTRACT_MODIFIER); DiagnosticFactory0 EXTERNAL_DECLARATION_CANNOT_HAVE_BODY = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); diff --git a/compiler/testData/codegen/box/inlineClasses/jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt b/compiler/testData/codegen/box/inlineClasses/jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt new file mode 100644 index 00000000000..051d5314c57 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt @@ -0,0 +1,10 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME + +inline class Str(val s: String) + +@JvmOverloads +fun test(so: String = "O", sk: String = "K") = Str(so + sk) + +fun box(): String = + test().s \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt b/compiler/testData/codegen/bytecodeListing/inlineClasses/jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt new file mode 100644 index 00000000000..52d3fd8fe00 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt @@ -0,0 +1,6 @@ +// WITH_RUNTIME + +inline class Z(val x: Int) + +@JvmOverloads +fun testTopLevelFunction(x: Int = 0): Z = Z(x) \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.txt new file mode 100644 index 00000000000..9807d43a4c1 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.txt @@ -0,0 +1,25 @@ +@kotlin.Metadata +public final class JvmOverloadsOnTopLevelFunctionReturningInlineClassValueKt { + // source: 'jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt' + public synthetic static method testTopLevelFunction$default(p0: int, p1: int, p2: java.lang.Object): int + public final static @kotlin.jvm.JvmOverloads method testTopLevelFunction(): int + public final static @kotlin.jvm.JvmOverloads method testTopLevelFunction(p0: int): int +} + +@kotlin.Metadata +public final class Z { + // source: 'jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt' + private final field x: int + private synthetic method (p0: int): void + public synthetic final static method box-impl(p0: int): Z + public static method constructor-impl(p0: int): int + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: int, p1: java.lang.Object): boolean + public final static method equals-impl0(p0: int, p1: int): boolean + public final method getX(): int + public method hashCode(): int + public static method hashCode-impl(p0: int): int + public method toString(): java.lang.String + public static method toString-impl(p0: int): java.lang.String + public synthetic final method unbox-impl(): int +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmOverloads/jvmOverloadsOnMangledFunctions.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmOverloads/jvmOverloadsOnMangledFunctions.fir.kt new file mode 100644 index 00000000000..b6b09818cab --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmOverloads/jvmOverloadsOnMangledFunctions.fir.kt @@ -0,0 +1,30 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER +// !LANGUAGE: +InlineClasses + +inline class Z(val x: Int) + +@JvmOverloads +fun testTopLevelFunction1(z: Z, x: Int = 0) {} + +@JvmOverloads +fun testTopLevelFunction2(x: Int, z: Z = Z(0)) {} + +@JvmOverloads +fun testTopLevelFunction3(x: Int = 0): Z = Z(x) + +class C { + @JvmOverloads + constructor(i: Int, z: Z = Z(0)) + + @JvmOverloads + constructor(s: String, z: Z, i: Int = 0) + + @JvmOverloads + fun testMemberFunction1(z: Z, x: Int = 0) {} + + @JvmOverloads + fun testMemberFunction2(x: Int, z: Z = Z(0)) {} + + @JvmOverloads + fun testMemberFunction3(x: Int = 0): Z = Z(x) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmOverloads/jvmOverloadsOnMangledFunctions.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmOverloads/jvmOverloadsOnMangledFunctions.kt new file mode 100644 index 00000000000..0bc34e14216 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmOverloads/jvmOverloadsOnMangledFunctions.kt @@ -0,0 +1,30 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER +// !LANGUAGE: +InlineClasses + +inline class Z(val x: Int) + +@JvmOverloads +fun testTopLevelFunction1(z: Z, x: Int = 0) {} + +@JvmOverloads +fun testTopLevelFunction2(x: Int, z: Z = Z(0)) {} + +@JvmOverloads +fun testTopLevelFunction3(x: Int = 0): Z = Z(x) + +class C { + @JvmOverloads + constructor(i: Int, z: Z = Z(0)) + + @JvmOverloads + constructor(s: String, z: Z, i: Int = 0) + + @JvmOverloads + fun testMemberFunction1(z: Z, x: Int = 0) {} + + @JvmOverloads + fun testMemberFunction2(x: Int, z: Z = Z(0)) {} + + @JvmOverloads + fun testMemberFunction3(x: Int = 0): Z = Z(x) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmOverloads/jvmOverloadsOnMangledFunctions.txt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmOverloads/jvmOverloadsOnMangledFunctions.txt new file mode 100644 index 00000000000..0dd58b31d94 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmOverloads/jvmOverloadsOnMangledFunctions.txt @@ -0,0 +1,24 @@ +package + +@kotlin.jvm.JvmOverloads public fun testTopLevelFunction1(/*0*/ z: Z, /*1*/ x: kotlin.Int = ...): kotlin.Unit +@kotlin.jvm.JvmOverloads public fun testTopLevelFunction2(/*0*/ x: kotlin.Int, /*1*/ z: Z = ...): kotlin.Unit +@kotlin.jvm.JvmOverloads public fun testTopLevelFunction3(/*0*/ x: kotlin.Int = ...): Z + +public final class C { + @kotlin.jvm.JvmOverloads public constructor C(/*0*/ i: kotlin.Int, /*1*/ z: Z = ...) + @kotlin.jvm.JvmOverloads public constructor C(/*0*/ s: kotlin.String, /*1*/ z: Z, /*2*/ i: kotlin.Int = ...) + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + @kotlin.jvm.JvmOverloads public final fun testMemberFunction1(/*0*/ z: Z, /*1*/ x: kotlin.Int = ...): kotlin.Unit + @kotlin.jvm.JvmOverloads public final fun testMemberFunction2(/*0*/ x: kotlin.Int, /*1*/ z: Z = ...): kotlin.Unit + @kotlin.jvm.JvmOverloads public final fun testMemberFunction3(/*0*/ x: kotlin.Int = ...): Z + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final inline class Z { + public constructor Z(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String +} diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java index 002db0b9399..3a3b01d4bd6 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java @@ -690,6 +690,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmOverloads/jvmOverloadsOnAnnotationClassConstructor_1_4.kt"); } + @TestMetadata("jvmOverloadsOnMangledFunctions.kt") + public void testJvmOverloadsOnMangledFunctions() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmOverloads/jvmOverloadsOnMangledFunctions.kt"); + } + @TestMetadata("jvmOverloadsOnPrivate.kt") public void testJvmOverloadsOnPrivate() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmOverloads/jvmOverloadsOnPrivate.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java index 989dc657726..da03bc7b198 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java @@ -690,6 +690,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmOverloads/jvmOverloadsOnAnnotationClassConstructor_1_4.kt"); } + @TestMetadata("jvmOverloadsOnMangledFunctions.kt") + public void testJvmOverloadsOnMangledFunctions() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmOverloads/jvmOverloadsOnMangledFunctions.kt"); + } + @TestMetadata("jvmOverloadsOnPrivate.kt") public void testJvmOverloadsOnPrivate() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmOverloads/jvmOverloadsOnPrivate.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 2507d84c0ab..d1b41493916 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -15262,6 +15262,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/inlineClasses/jvmFieldInInlineClassCompanion.kt"); } + @TestMetadata("jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt") + public void testJvmOverloadsOnTopLevelFunctionReturningInlineClassValue() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt"); + } + @TestMetadata("jvmStaticFunInInlineClassCompanion.kt") public void testJvmStaticFunInInlineClassCompanion() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/jvmStaticFunInInlineClassCompanion.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index d5de0775cb2..5b6cc7ce033 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -982,6 +982,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassWithManyKindsOfMembers.kt"); } + @TestMetadata("jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt") + public void testJvmOverloadsOnTopLevelFunctionReturningInlineClassValue() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt"); + } + @TestMetadata("memberExtensionProperty.kt") public void testMemberExtensionProperty() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/memberExtensionProperty.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 1b0a7860b6a..1b2791231c1 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -15272,6 +15272,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/inlineClasses/jvmFieldInInlineClassCompanion.kt"); } + @TestMetadata("jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt") + public void testJvmOverloadsOnTopLevelFunctionReturningInlineClassValue() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt"); + } + @TestMetadata("jvmStaticFunInInlineClassCompanion.kt") public void testJvmStaticFunInInlineClassCompanion() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/jvmStaticFunInInlineClassCompanion.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 9e5864a4ad4..3f5e335323b 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -13862,6 +13862,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/inlineClasses/jvmFieldInInlineClassCompanion.kt"); } + @TestMetadata("jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt") + public void testJvmOverloadsOnTopLevelFunctionReturningInlineClassValue() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt"); + } + @TestMetadata("jvmStaticFunInInlineClassCompanion.kt") public void testJvmStaticFunInInlineClassCompanion() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/jvmStaticFunInInlineClassCompanion.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index 2a5f6d59abb..5cdf9872f30 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -952,6 +952,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassWithManyKindsOfMembers.kt"); } + @TestMetadata("jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt") + public void testJvmOverloadsOnTopLevelFunctionReturningInlineClassValue() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt"); + } + @TestMetadata("memberExtensionProperty.kt") public void testMemberExtensionProperty() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/memberExtensionProperty.kt"); From 2c325c45e29f8326a89ffdbf2ad6f22e48ace2cf Mon Sep 17 00:00:00 2001 From: sellmair Date: Mon, 25 Nov 2019 11:12:10 +0100 Subject: [PATCH 076/698] Register Kotlin MPP source sets in AGP ^KT-43391 fixed --- .../AbstractKotlinAndroidGradleTests.kt | 56 ++++++- .../build.gradle.kts | 22 +++ .../gradle.properties | 1 + .../lib/build.gradle.kts | 38 +++++ .../androidAndroidTest/java/DontCompile.kt | 1 + .../kotlin/AndroidAndroidTest.kt | 13 ++ .../lib/src/androidMain/java/DontCompile.kt | 1 + .../kotlin/AndroidMainApiKotlin.kt | 3 + .../src/androidTest/java/AndroidTestJava.kt | 10 ++ .../androidTest/kotlin/AndroidTestKotlin.kt | 10 ++ .../lib/src/commonMain/kotlin/CommonApi.kt | 3 + .../lib/src/commonTest/kotlin/CommonTest.kt | 9 ++ .../lib/src/main/AndroidManifest.xml | 1 + .../lib/src/main/java/MainApiJava.kt | 3 + .../lib/src/main/kotlin/MainApiKotlin.kt | 3 + .../lib/src/test/java/TestJava.kt | 13 ++ .../lib/src/test/kotlin/TestKotlin.kt | 13 ++ .../settings.gradle.kts | 2 + .../SyncKotlinAndAndroidSourceSetsTest.kt | 152 ++++++++++++++++++ .../kotlin/gradle/plugin/KotlinPlugin.kt | 35 +--- .../mpp/syncKotlinAndAndroidSourceSets.kt | 123 ++++++++++++++ 21 files changed, 479 insertions(+), 33 deletions(-) create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/build.gradle.kts create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/gradle.properties create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/build.gradle.kts create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/androidAndroidTest/java/DontCompile.kt create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/androidAndroidTest/kotlin/AndroidAndroidTest.kt create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/androidMain/java/DontCompile.kt create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/androidMain/kotlin/AndroidMainApiKotlin.kt create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/androidTest/java/AndroidTestJava.kt create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/androidTest/kotlin/AndroidTestKotlin.kt create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/commonMain/kotlin/CommonApi.kt create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/commonTest/kotlin/CommonTest.kt create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/main/AndroidManifest.xml create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/main/java/MainApiJava.kt create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/main/kotlin/MainApiKotlin.kt create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/test/java/TestJava.kt create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/test/kotlin/TestKotlin.kt create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/settings.gradle.kts create mode 100644 libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/SyncKotlinAndAndroidSourceSetsTest.kt create mode 100644 libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/AbstractKotlinAndroidGradleTests.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/AbstractKotlinAndroidGradleTests.kt index afd41ffa90c..1e9a92466ee 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/AbstractKotlinAndroidGradleTests.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/AbstractKotlinAndroidGradleTests.kt @@ -21,6 +21,55 @@ open class KotlinAndroid36GradleIT : KotlinAndroid33GradleIT() { override val defaultGradleVersion: GradleVersionRequired get() = GradleVersionRequired.AtLeast("6.0") + @Test + fun testAndroidMppSourceSets(): Unit = with(Project("new-mpp-android-source-sets", GradleVersionRequired.FOR_MPP_SUPPORT)) { + build("sourceSets") { + assertSuccessful() + assertContains("Java sources: [lib/src/androidTest/java, lib/src/androidAndroidTest/kotlin]") + assertContains("Java sources: [lib/src/androidTestDebug/java, lib/src/androidAndroidTestDebug/kotlin]") + assertContains("Java sources: [lib/src/debug/java, lib/src/androidDebug/kotlin, lib/src/debug/kotlin]") + assertContains("Java sources: [lib/src/main/java, lib/src/androidMain/kotlin, lib/src/main/kotlin]") + assertContains("Java sources: [lib/src/release/java, lib/src/androidRelease/kotlin, lib/src/release/kotlin]") + assertContains("Java sources: [lib/src/test/java, lib/src/androidTest/kotlin, lib/src/test/kotlin]") + assertContains("Java sources: [lib/src/testDebug/java, lib/src/androidTestDebug/kotlin, lib/src/testDebug/kotlin]") + assertContains("Java sources: [lib/src/testRelease/java, lib/src/androidTestRelease/kotlin, lib/src/testRelease/kotlin]") + + assertContains("Android resources: [lib/src/main/res, lib/src/androidMain/res]") + assertContains("Assets: [lib/src/main/assets, lib/src/androidMain/assets]") + assertContains("AIDL sources: [lib/src/main/aidl, lib/src/androidMain/aidl]") + assertContains("RenderScript sources: [lib/src/main/rs, lib/src/androidMain/rs]") + assertContains("JNI sources: [lib/src/main/jni, lib/src/androidMain/jni]") + assertContains("JNI libraries: [lib/src/main/jniLibs, lib/src/androidMain/jniLibs]") + assertContains("Java-style resources: [lib/src/main/resources, lib/src/androidMain/resources]") + + assertContains("Android resources: [lib/src/androidTestDebug/res, lib/src/androidAndroidTestDebug/res]") + assertContains("Assets: [lib/src/androidTestDebug/assets, lib/src/androidAndroidTestDebug/assets]") + assertContains("AIDL sources: [lib/src/androidTestDebug/aidl, lib/src/androidAndroidTestDebug/aidl]") + assertContains("RenderScript sources: [lib/src/androidTestDebug/rs, lib/src/androidAndroidTestDebug/rs]") + assertContains("JNI sources: [lib/src/androidTestDebug/jni, lib/src/androidAndroidTestDebug/jni]") + assertContains("JNI libraries: [lib/src/androidTestDebug/jniLibs, lib/src/androidAndroidTestDebug/jniLibs]") + assertContains("Java-style resources: [lib/src/androidTestDebug/resources, lib/src/androidAndroidTestDebug/resources]") + } + + build("testDebug") { + assertFailed() + assertContains("CommonTest > fail FAILED") + assertContains("TestKotlin > fail FAILED") + assertContains("AndroidTestKotlin > fail FAILED") + assertContains("TestJava > fail FAILED") + } + + build("assemble") { + assertSuccessful() + } + + // Test for KT-35016: MPP should recognize android instrumented tests correctly + build("connectedAndroidTest") { + assertFailed() + assertContains("No connected devices!") + } + } + @Test fun testAndroidWithNewMppApp() = with(Project("new-mpp-android", GradleVersionRequired.FOR_MPP_SUPPORT)) { build("assemble", "compileDebugUnitTestJavaWithJavac", "printCompilerPluginOptions") { @@ -600,7 +649,12 @@ fun getSomething() = 10 } val libAndroidClassesOnlyUtilKt = project.projectDir.getFileByName("LibAndroidClassesOnlyUtil.kt") - libAndroidClassesOnlyUtilKt.modify { it.replace("fun libAndroidClassesOnlyUtil(): String", "fun libAndroidClassesOnlyUtil(): CharSequence") } + libAndroidClassesOnlyUtilKt.modify { + it.replace( + "fun libAndroidClassesOnlyUtil(): String", + "fun libAndroidClassesOnlyUtil(): CharSequence" + ) + } project.build("assembleDebug", options = options) { assertSuccessful() val affectedSources = project.projectDir.getFilesByNames("LibAndroidClassesOnlyUtil.kt", "useLibAndroidClassesOnlyUtil.kt") diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/build.gradle.kts b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/build.gradle.kts new file mode 100644 index 00000000000..b342fc26bd3 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/build.gradle.kts @@ -0,0 +1,22 @@ +buildscript { + repositories { + mavenCentral() + google() + mavenLocal() + jcenter() + } + + dependencies { + classpath(kotlin("gradle-plugin:${property("kotlin_version")}")) + classpath("com.android.tools.build:gradle:${property("android_tools_version")}") + } +} + +allprojects { + repositories { + mavenCentral() + google() + mavenLocal() + jcenter() + } +} diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/gradle.properties b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/gradle.properties new file mode 100644 index 00000000000..29e08e8ca88 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/gradle.properties @@ -0,0 +1 @@ +kotlin.code.style=official \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/build.gradle.kts b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/build.gradle.kts new file mode 100644 index 00000000000..1da4a7944ab --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/build.gradle.kts @@ -0,0 +1,38 @@ +plugins { + id("com.android.library") + kotlin("multiplatform") +} + +android { + compileSdkVersion(28) + defaultConfig { + minSdkVersion(21) + targetSdkVersion(28) + testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner" + } +} + +kotlin { + android() + macosX64("macos") + + sourceSets { + getByName("commonMain").dependencies { + implementation(kotlin("stdlib-common")) + } + + getByName("commonMain").dependencies { + implementation(kotlin("test")) + implementation(kotlin("test-annotations-common")) + } + + getByName("androidMain").dependencies { + implementation(kotlin("stdlib-jdk8")) + } + + getByName("androidAndroidTest").dependencies { + implementation(kotlin("test-junit")) + implementation("com.android.support.test:runner:1.0.2") + } + } +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/androidAndroidTest/java/DontCompile.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/androidAndroidTest/java/DontCompile.kt new file mode 100644 index 00000000000..c1dd1455371 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/androidAndroidTest/java/DontCompile.kt @@ -0,0 +1 @@ +CANT COMPILE THIS FILE! \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/androidAndroidTest/kotlin/AndroidAndroidTest.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/androidAndroidTest/kotlin/AndroidAndroidTest.kt new file mode 100644 index 00000000000..9b4292b805c --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/androidAndroidTest/kotlin/AndroidAndroidTest.kt @@ -0,0 +1,13 @@ +import kotlin.test.Test + +/** + * Expected to fail! + */ +class AndroidAndroidTest { + @Test + fun fail() { + MainApiKotlin.sayHi() + MainApiJava.sayHi() + CommonApi.throwException() + } +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/androidMain/java/DontCompile.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/androidMain/java/DontCompile.kt new file mode 100644 index 00000000000..c1dd1455371 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/androidMain/java/DontCompile.kt @@ -0,0 +1 @@ +CANT COMPILE THIS FILE! \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/androidMain/kotlin/AndroidMainApiKotlin.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/androidMain/kotlin/AndroidMainApiKotlin.kt new file mode 100644 index 00000000000..bd15d8c7f08 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/androidMain/kotlin/AndroidMainApiKotlin.kt @@ -0,0 +1,3 @@ +object AndroidMainApiKotlin { + fun sayHi() = println("HI") +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/androidTest/java/AndroidTestJava.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/androidTest/java/AndroidTestJava.kt new file mode 100644 index 00000000000..741c8b54851 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/androidTest/java/AndroidTestJava.kt @@ -0,0 +1,10 @@ +import org.junit.Test + +class AndroidTestJava { + @Test + fun fail() { + MainApiJava.sayHi() + MainApiKotlin.sayHi() + CommonApi.throwException() + } +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/androidTest/kotlin/AndroidTestKotlin.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/androidTest/kotlin/AndroidTestKotlin.kt new file mode 100644 index 00000000000..22555afa1ee --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/androidTest/kotlin/AndroidTestKotlin.kt @@ -0,0 +1,10 @@ +import org.junit.Test + +class AndroidTestKotlin { + @Test + fun fail() { + MainApiJava.sayHi() + MainApiKotlin.sayHi() + CommonApi.throwException() + } +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/commonMain/kotlin/CommonApi.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/commonMain/kotlin/CommonApi.kt new file mode 100644 index 00000000000..1e27d79d392 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/commonMain/kotlin/CommonApi.kt @@ -0,0 +1,3 @@ +object CommonApi { + fun throwException(): Unit = error("This is supposed to fail!") +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/commonTest/kotlin/CommonTest.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/commonTest/kotlin/CommonTest.kt new file mode 100644 index 00000000000..59d80b0fc49 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/commonTest/kotlin/CommonTest.kt @@ -0,0 +1,9 @@ +import kotlin.test.Test + +/* Expected to fail ! */ +class CommonTest { + @Test + fun fail() { + CommonApi.throwException() + } +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/main/AndroidManifest.xml b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/main/AndroidManifest.xml new file mode 100644 index 00000000000..47760dbcf68 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/main/AndroidManifest.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/main/java/MainApiJava.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/main/java/MainApiJava.kt new file mode 100644 index 00000000000..9eb4dd76e65 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/main/java/MainApiJava.kt @@ -0,0 +1,3 @@ +object MainApiJava { + fun sayHi() = println("HI") +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/main/kotlin/MainApiKotlin.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/main/kotlin/MainApiKotlin.kt new file mode 100644 index 00000000000..7c6c88cb49f --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/main/kotlin/MainApiKotlin.kt @@ -0,0 +1,3 @@ +object MainApiKotlin { + fun sayHi() = println("HI") +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/test/java/TestJava.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/test/java/TestJava.kt new file mode 100644 index 00000000000..c67e4607057 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/test/java/TestJava.kt @@ -0,0 +1,13 @@ +import org.junit.Test + +class TestJava { + + @Test + fun fail() { + MainApiKotlin.sayHi() + MainApiJava.sayHi() + AndroidMainApiKotlin.sayHi() + CommonApi.throwException() + } + +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/test/kotlin/TestKotlin.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/test/kotlin/TestKotlin.kt new file mode 100644 index 00000000000..e9d69714433 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/src/test/kotlin/TestKotlin.kt @@ -0,0 +1,13 @@ +import kotlin.test.Test + +/** + * Expected to fail! + */ +class TestKotlin { + @Test + fun fail() { + MainApiKotlin.sayHi() + MainApiJava.sayHi() + CommonApi.throwException() + } +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/settings.gradle.kts b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/settings.gradle.kts new file mode 100644 index 00000000000..da712f78ee0 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/settings.gradle.kts @@ -0,0 +1,2 @@ +rootProject.name = "mpp-playgound" +include(":lib") diff --git a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/SyncKotlinAndAndroidSourceSetsTest.kt b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/SyncKotlinAndAndroidSourceSetsTest.kt new file mode 100644 index 00000000000..98c07c3aba4 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/SyncKotlinAndAndroidSourceSetsTest.kt @@ -0,0 +1,152 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ +@file:Suppress("invisible_reference", "invisible_member", "FunctionName") + +package org.jetbrains.kotlin.gradle + +import com.android.build.gradle.LibraryExtension +import org.gradle.api.internal.project.ProjectInternal +import org.gradle.testfixtures.ProjectBuilder +import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension +import org.jetbrains.kotlin.gradle.dsl.multiplatformExtension +import kotlin.test.* + +class SyncKotlinAndAndroidSourceSetsTest { + + private lateinit var project: ProjectInternal + private lateinit var kotlin: KotlinMultiplatformExtension + private lateinit var android: LibraryExtension + + @BeforeTest + fun setup() { + project = ProjectBuilder.builder().build() as ProjectInternal + project.plugins.apply("kotlin-multiplatform") + project.plugins.apply("android-library") + + /* Arbitrary minimal Android setup */ + android = project.extensions.getByName("android") as LibraryExtension + android.compileSdkVersion(30) + + /* Kotlin Setup */ + kotlin = project.multiplatformExtension + + } + + + @Test + fun `main source set with default settings`() { + kotlin.android() + + val kotlinAndroidMainSourceSet = kotlin.sourceSets.getByName("androidMain") + val androidMainSourceSet = android.sourceSets.getByName("main") + + assertEquals( + androidMainSourceSet.java.srcDirs.toSet(), + kotlinAndroidMainSourceSet.kotlin.srcDirs.toSet(), + "Expected all source directories being present in all models" + ) + } + + @Test + fun `test source set with default settings`() { + kotlin.android() + + val kotlinAndroidTestSourceSet = kotlin.sourceSets.getByName("androidTest") + val testSourceSet = android.sourceSets.getByName("test") + + assertEquals( + testSourceSet.java.srcDirs.toSet(), + kotlinAndroidTestSourceSet.kotlin.srcDirs.toSet(), + "Expected all source directories being present in all models" + ) + } + + @Test + fun `androidTest source set with default settings`() { + kotlin.android() + + val kotlinAndroidAndroidTestSourceSet = kotlin.sourceSets.getByName("androidAndroidTest") + val androidTestSourceSet = android.sourceSets.getByName("androidTest") + + assertTrue( + androidTestSourceSet.java.srcDirs.toSet().containsAll(kotlinAndroidAndroidTestSourceSet.kotlin.srcDirs), + "Expected all kotlin source directories being registered on AGP" + ) + + assertTrue( + project.file("src/androidTest/kotlin") !in kotlinAndroidAndroidTestSourceSet.kotlin.srcDirs, + "Expected no source directory of 'androidTest' kotlin source set (Unit Test) " + + "being present in 'androidAndroidTest' kotlin source set (Instrumented Test)" + ) + + assertTrue( + project.file("src/androidTest/kotlin") !in androidTestSourceSet.java.srcDirs, + "Expected no source directory of 'androidTest' kotlin source set (Unit Test) " + + "being present in 'androidTest' Android source set (Instrumented Test)" + ) + } + + @Test + fun `all source directories are disjoint in source sets`() { + kotlin.android() + project.evaluate() + + kotlin.sourceSets.toSet().allPairs() + .forEach { (sourceSetA, sourceSetB) -> + val sourceDirsInBothSourceSets = sourceSetA.kotlin.srcDirs.intersect(sourceSetB.kotlin.srcDirs) + assertTrue( + sourceDirsInBothSourceSets.isEmpty(), + "Expected disjoint source directories in source sets. " + + "Found $sourceDirsInBothSourceSets present in ${sourceSetA.name}(Kotlin) and ${sourceSetB.name}(Kotlin)" + ) + } + + android.sourceSets.toSet().allPairs() + .forEach { (sourceSetA, sourceSetB) -> + val sourceDirsInBothSourceSets = sourceSetA.java.srcDirs.intersect(sourceSetB.java.srcDirs) + assertTrue( + sourceDirsInBothSourceSets.isEmpty(), + "Expected disjoint source directories in source sets. " + + "Found $sourceDirsInBothSourceSets present in ${sourceSetA.name}(Android) and ${sourceSetB.name}(Android)" + ) + } + } + + @Test + fun `sync includes user configuration`() { + kotlin.android() + + val kotlinAndroidMain = kotlin.sourceSets.getByName("androidMain") + val androidMain = android.sourceSets.getByName("main") + + kotlinAndroidMain.kotlin.srcDir(project.file("fromKotlin")) + androidMain.java.srcDir(project.file("fromAndroid")) + + project.evaluate() + + assertTrue( + kotlinAndroidMain.kotlin.srcDirs.containsAll(setOf(project.file("fromKotlin"), project.file("fromAndroid"))), + "Expected custom configured source directories being present on kotlin source set after evaluation" + ) + + assertTrue( + androidMain.java.srcDirs.containsAll(setOf(project.file("fromKotlin"), project.file("fromAndroid"))), + "Expected custom configured source directories being present on android source set after evaluation" + ) + } +} + +private fun Set.allPairs(): Sequence> { + val values = this.toList() + return sequence { + for (index in values.indices) { + val first = values[index] + for (remainingIndex in (index + 1)..values.lastIndex) { + val second = values[remainingIndex] + yield(first to second) + } + } + } +} diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinPlugin.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinPlugin.kt index 69564b3059a..288ea2be08f 100755 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinPlugin.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinPlugin.kt @@ -777,25 +777,11 @@ abstract class AbstractAndroidProjectHandler(private val kotlinConfigurationTool ) fun configureTarget(kotlinAndroidTarget: KotlinAndroidTarget) { + syncKotlinAndAndroidSourceSets(kotlinAndroidTarget) + val project = kotlinAndroidTarget.project val ext = project.extensions.getByName("android") as BaseExtension - ext.sourceSets.all { sourceSet -> - logger.kotlinDebug("Creating KotlinBaseSourceSet for source set $sourceSet") - val kotlinSourceSet = project.kotlinExtension.sourceSets.maybeCreate( - kotlinSourceSetNameForAndroidSourceSet(kotlinAndroidTarget, sourceSet.name) - ).apply { - createDefaultDependsOnEdges(kotlinAndroidTarget, sourceSet, this) - kotlin.srcDir(project.file(project.file("src/${sourceSet.name}/kotlin"))) - kotlin.srcDirs(sourceSet.java.srcDirs) - } - sourceSet.addConvention(KOTLIN_DSL_NAME, kotlinSourceSet) - - ifKaptEnabled(project) { - Kapt3GradleSubplugin.createAptConfigurationIfNeeded(project, sourceSet.name) - } - } - val kotlinOptions = KotlinJvmOptionsImpl() project.whenEvaluated { // TODO don't require the flag once there is an Android Gradle plugin build that supports desugaring of Long.hashCode and @@ -852,21 +838,6 @@ abstract class AbstractAndroidProjectHandler(private val kotlinConfigurationTool } } - private fun createDefaultDependsOnEdges( - kotlinAndroidTarget: KotlinAndroidTarget, - androidSourceSet: AndroidSourceSet, - kotlinSourceSet: KotlinSourceSet - ) { - val commonSourceSetName = when (androidSourceSet.name) { - "main" -> "commonMain" - "test" -> "commonTest" - "androidTest" -> "commonTest" - else -> return - } - val commonSourceSet = kotlinAndroidTarget.project.kotlinExtension.sourceSets.findByName(commonSourceSetName) ?: return - kotlinSourceSet.dependsOn(commonSourceSet) - } - /** * The Android variants have their configurations extendsFrom relation set up in a way that only some of the configurations of the * variants propagate the dependencies from production variants to test ones. To make this dependency propagation work for the Kotlin @@ -1049,7 +1020,7 @@ internal fun configureJavaTask( } } -private fun ifKaptEnabled(project: Project, block: () -> Unit) { +internal fun ifKaptEnabled(project: Project, block: () -> Unit) { var triggered = false fun trigger() { diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt new file mode 100644 index 00000000000..a04d0c40aa7 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt @@ -0,0 +1,123 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.gradle.plugin.mpp + +import com.android.build.gradle.BaseExtension +import com.android.build.gradle.api.AndroidSourceSet +import org.gradle.api.Project +import org.jetbrains.kotlin.gradle.dsl.kotlinExtension +import org.jetbrains.kotlin.gradle.internal.Kapt3GradleSubplugin +import org.jetbrains.kotlin.gradle.plugin.* +import org.jetbrains.kotlin.gradle.plugin.AbstractAndroidProjectHandler.Companion.kotlinSourceSetNameForAndroidSourceSet +import org.jetbrains.kotlin.gradle.plugin.addConvention +import java.io.File + +internal fun syncKotlinAndAndroidSourceSets(target: KotlinAndroidTarget) { + val project = target.project + val android = project.extensions.getByName("android") as BaseExtension + + android.sourceSets.all { androidSourceSet -> + val kotlinSourceSetName = kotlinSourceSetNameForAndroidSourceSet(target, androidSourceSet.name) + val kotlinSourceSet = project.kotlinExtension.sourceSets.maybeCreate(kotlinSourceSetName) + createDefaultDependsOnEdges(target, kotlinSourceSet, androidSourceSet) + syncKotlinAndAndroidSourceDirs(target, kotlinSourceSet, androidSourceSet) + syncKotlinAndAndroidResources(target, kotlinSourceSet, androidSourceSet) + androidSourceSet.addConvention(KOTLIN_DSL_NAME, kotlinSourceSet) + + ifKaptEnabled(project) { + Kapt3GradleSubplugin.createAptConfigurationIfNeeded(project, androidSourceSet.name) + } + } +} + +private fun createDefaultDependsOnEdges( + target: KotlinAndroidTarget, + kotlinSourceSet: KotlinSourceSet, + androidSourceSet: AndroidSourceSet +) { + val commonSourceSetName = when (androidSourceSet.name) { + "main" -> "commonMain" + "test" -> "commonTest" + "androidTest" -> "commonTest" + else -> return + } + val commonSourceSet = target.project.kotlinExtension.sourceSets.findByName(commonSourceSetName) ?: return + kotlinSourceSet.dependsOn(commonSourceSet) +} + +private fun syncKotlinAndAndroidSourceDirs( + target: KotlinAndroidTarget, kotlinSourceSet: KotlinSourceSet, androidSourceSet: AndroidSourceSet +) { + val disambiguationClassifier = target.disambiguationClassifier + + /* + Mitigate ambiguity! + Example: disambiguationClassifier="android" + Source Directory "src/androidTest/kotlin" + -- could be claimed by kotlin {android}Test (unit test) + -- could be claimed by Android androidTest (instrumented test) + + The Kotlin source set would win in this scenario. + */ + if (disambiguationClassifier == null || !androidSourceSet.name.startsWith(disambiguationClassifier)) { + kotlinSourceSet.kotlin.srcDir("src/${androidSourceSet.name}/kotlin") + } + + kotlinSourceSet.kotlin.srcDirs(*androidSourceSet.java.srcDirs.toTypedArray()) + androidSourceSet.java.srcDirs(*kotlinSourceSet.kotlin.srcDirs.toTypedArray()) + + /* + Make sure to include user configuration as well. + Unfortunately, there does not exist any "ad-hoc" API like `all`. + Therefore we sync the directories once again after evaluation + */ + target.project.whenEvaluated { + kotlinSourceSet.kotlin.srcDirs(*androidSourceSet.java.srcDirs.toTypedArray()) + androidSourceSet.java.srcDirs(*kotlinSourceSet.kotlin.srcDirs.toTypedArray()) + } +} + +private fun syncKotlinAndAndroidResources( + target: KotlinAndroidTarget, + kotlinSourceSet: KotlinSourceSet, + androidSourceSet: AndroidSourceSet +) { + val project = target.project + + androidSourceSet.resources.srcDirs(*kotlinSourceSet.resources.toList().toTypedArray()) + if (androidSourceSet.resources.srcDirs.isNotEmpty()) { + androidSourceSet.resources.srcDir(kotlinSourceSet.sourceFolderFor(project, "resources")) + kotlinSourceSet.resources.srcDirs(androidSourceSet.resources.srcDirs - kotlinSourceSet.resources.srcDirs) + } + + if (androidSourceSet.assets.srcDirs.isNotEmpty()) { + androidSourceSet.assets.srcDir(kotlinSourceSet.sourceFolderFor(project, "assets")) + } + + if (androidSourceSet.res.srcDirs.isNotEmpty()) { + androidSourceSet.res.srcDir(kotlinSourceSet.sourceFolderFor(project, "res")) + } + + if (androidSourceSet.aidl.srcDirs.isNotEmpty()) { + androidSourceSet.aidl.srcDir(kotlinSourceSet.sourceFolderFor(project, "aidl")) + } + + if (androidSourceSet.renderscript.srcDirs.isNotEmpty()) { + androidSourceSet.renderscript.srcDir(kotlinSourceSet.sourceFolderFor(project, "rs")) + } + + if (androidSourceSet.jni.srcDirs.isNotEmpty()) { + androidSourceSet.jni.srcDir(kotlinSourceSet.sourceFolderFor(project, "jni")) + } + + if (androidSourceSet.jniLibs.srcDirs.isNotEmpty()) { + androidSourceSet.jniLibs.srcDir(kotlinSourceSet.sourceFolderFor(project, "jniLibs")) + } +} + +private fun KotlinSourceSet.sourceFolderFor(project: Project, type: String): File { + return project.file("src/${this.name}/$type") +} From cdfbbca5807aec56a301b57c8c15382ea70f9e36 Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Fri, 20 Nov 2020 10:01:21 +0100 Subject: [PATCH 077/698] Also register `shaders` for kotlin source sets --- .../SyncKotlinAndAndroidSourceSetsTest.kt | 15 +++++++++++++ .../mpp/syncKotlinAndAndroidSourceSets.kt | 21 ++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/SyncKotlinAndAndroidSourceSetsTest.kt b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/SyncKotlinAndAndroidSourceSetsTest.kt index 98c07c3aba4..94b4c1f52fb 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/SyncKotlinAndAndroidSourceSetsTest.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/SyncKotlinAndAndroidSourceSetsTest.kt @@ -11,6 +11,7 @@ import org.gradle.api.internal.project.ProjectInternal import org.gradle.testfixtures.ProjectBuilder import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.dsl.multiplatformExtension +import org.jetbrains.kotlin.gradle.plugin.mpp.kotlinSourceSet import kotlin.test.* class SyncKotlinAndAndroidSourceSetsTest { @@ -136,6 +137,20 @@ class SyncKotlinAndAndroidSourceSetsTest { "Expected custom configured source directories being present on android source set after evaluation" ) } + + @Test + fun `AndroidSourceSet#kotlinSourceSet extension`() { + kotlin.android() + + val main = android.sourceSets.getByName("main") + assertSame(kotlin.sourceSets.getByName("androidMain"), main.kotlinSourceSet) + + val test = android.sourceSets.getByName("test") + assertSame(kotlin.sourceSets.getByName("androidTest"), test.kotlinSourceSet) + + val androidTest = android.sourceSets.getByName("androidTest") + assertSame(kotlin.sourceSets.getByName("androidAndroidTest"), androidTest.kotlinSourceSet) + } } private fun Set.allPairs(): Sequence> { diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt index a04d0c40aa7..83f228797f5 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt @@ -22,10 +22,11 @@ internal fun syncKotlinAndAndroidSourceSets(target: KotlinAndroidTarget) { android.sourceSets.all { androidSourceSet -> val kotlinSourceSetName = kotlinSourceSetNameForAndroidSourceSet(target, androidSourceSet.name) val kotlinSourceSet = project.kotlinExtension.sourceSets.maybeCreate(kotlinSourceSetName) + androidSourceSet.kotlinSourceSet = kotlinSourceSet + createDefaultDependsOnEdges(target, kotlinSourceSet, androidSourceSet) syncKotlinAndAndroidSourceDirs(target, kotlinSourceSet, androidSourceSet) syncKotlinAndAndroidResources(target, kotlinSourceSet, androidSourceSet) - androidSourceSet.addConvention(KOTLIN_DSL_NAME, kotlinSourceSet) ifKaptEnabled(project) { Kapt3GradleSubplugin.createAptConfigurationIfNeeded(project, androidSourceSet.name) @@ -33,6 +34,12 @@ internal fun syncKotlinAndAndroidSourceSets(target: KotlinAndroidTarget) { } } +internal var AndroidSourceSet.kotlinSourceSet: KotlinSourceSet + get() = getConvention(KOTLIN_DSL_NAME) as KotlinSourceSet + private set(value) { + addConvention(KOTLIN_DSL_NAME, value) + } + private fun createDefaultDependsOnEdges( target: KotlinAndroidTarget, kotlinSourceSet: KotlinSourceSet, @@ -85,6 +92,14 @@ private fun syncKotlinAndAndroidResources( kotlinSourceSet: KotlinSourceSet, androidSourceSet: AndroidSourceSet ) { + /* + Non-MPP projects will not have a different name for kotlin source sets vs Android source sets + Registering resource folders is unnecessary therefore. + */ + if (kotlinSourceSet.name == androidSourceSet.name) { + return + } + val project = target.project androidSourceSet.resources.srcDirs(*kotlinSourceSet.resources.toList().toTypedArray()) @@ -116,6 +131,10 @@ private fun syncKotlinAndAndroidResources( if (androidSourceSet.jniLibs.srcDirs.isNotEmpty()) { androidSourceSet.jniLibs.srcDir(kotlinSourceSet.sourceFolderFor(project, "jniLibs")) } + + if (androidSourceSet.shaders.srcDirs.isNotEmpty()) { + androidSourceSet.shaders.srcDir(kotlinSourceSet.sourceFolderFor(project, "shaders")) + } } private fun KotlinSourceSet.sourceFolderFor(project: Project, type: String): File { From 3e5cbf324de8b6f8243e79c28210184b750b855d Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Fri, 20 Nov 2020 11:21:42 +0100 Subject: [PATCH 078/698] syncKotlinAndAndroidSourceSets.kt: Cover flavors with tests --- .../AbstractKotlinAndroidGradleTests.kt | 13 +++++- .../lib/build.gradle.kts | 45 ++++++++++++++++++- .../SyncKotlinAndAndroidSourceSetsTest.kt | 41 ++++++++++++++++- .../mpp/syncKotlinAndAndroidSourceSets.kt | 2 +- 4 files changed, 95 insertions(+), 6 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/AbstractKotlinAndroidGradleTests.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/AbstractKotlinAndroidGradleTests.kt index 1e9a92466ee..2973827e45d 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/AbstractKotlinAndroidGradleTests.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/AbstractKotlinAndroidGradleTests.kt @@ -49,9 +49,18 @@ open class KotlinAndroid36GradleIT : KotlinAndroid33GradleIT() { assertContains("JNI sources: [lib/src/androidTestDebug/jni, lib/src/androidAndroidTestDebug/jni]") assertContains("JNI libraries: [lib/src/androidTestDebug/jniLibs, lib/src/androidAndroidTestDebug/jniLibs]") assertContains("Java-style resources: [lib/src/androidTestDebug/resources, lib/src/androidAndroidTestDebug/resources]") + + assertContains("Java sources: [lib/betaSrc/paidBeta/java, lib/src/androidPaidBeta/kotlin, lib/src/paidBeta/kotlin]") + assertContains("Java sources: [lib/betaSrc/paidBetaDebug/java, lib/src/androidPaidBetaDebug/kotlin, lib/src/paidBetaDebug/kotlin]") + assertContains("Java sources: [lib/betaSrc/paidBetaRelease/java, lib/src/androidPaidBetaRelease/kotlin, lib/src/paidBetaRelease/kotlin]") + + assertContains("Java sources: [lib/betaSrc/freeBeta/java, lib/src/androidFreeBeta/kotlin, lib/src/freeBeta/kotlin]") + assertContains("Java sources: [lib/betaSrc/freeBetaDebug/java, lib/src/androidFreeBetaDebug/kotlin, lib/src/freeBetaDebug/kotlin]") + assertContains("Java sources: [lib/betaSrc/freeBetaRelease/java, lib/src/androidFreeBetaRelease/kotlin, lib/src/freeBetaRelease/kotlin]") + } - build("testDebug") { + build("testFreeBetaDebug") { assertFailed() assertContains("CommonTest > fail FAILED") assertContains("TestKotlin > fail FAILED") @@ -886,4 +895,4 @@ fun getSomething() = 10 assertContainsRegex(kotlinJvmTarget18Regex) } } -} \ No newline at end of file +} diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/build.gradle.kts b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/build.gradle.kts index 1da4a7944ab..fddf5ddbfab 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/build.gradle.kts +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/build.gradle.kts @@ -10,6 +10,47 @@ android { targetSdkVersion(28) testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner" } + + flavorDimensions("pricing", "releaseType") + + productFlavors { + create("beta") { + setDimension("releaseType") + } + create("production") { + setDimension("releaseType") + } + create("free") { + setDimension("pricing") + } + create("paid") { + setDimension("pricing") + } + } + + sourceSets { + maybeCreate("beta").apply { + setRoot("betaSrc/beta") + } + maybeCreate("freeBeta").apply { + setRoot("betaSrc/freeBeta") + } + maybeCreate("freeBetaDebug").apply { + setRoot("betaSrc/freeBetaDebug") + } + maybeCreate("freeBetaRelease").apply { + setRoot("betaSrc/freeBetaRelease") + } + maybeCreate("paidBeta").apply { + setRoot("betaSrc/paidBeta") + } + maybeCreate("paidBetaDebug").apply { + setRoot("betaSrc/paidBetaDebug") + } + maybeCreate("paidBetaRelease").apply { + setRoot("betaSrc/paidBetaRelease") + } + } } kotlin { @@ -21,7 +62,7 @@ kotlin { implementation(kotlin("stdlib-common")) } - getByName("commonMain").dependencies { + getByName("commonTest").dependencies { implementation(kotlin("test")) implementation(kotlin("test-annotations-common")) } @@ -35,4 +76,4 @@ kotlin { implementation("com.android.support.test:runner:1.0.2") } } -} \ No newline at end of file +} diff --git a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/SyncKotlinAndAndroidSourceSetsTest.kt b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/SyncKotlinAndAndroidSourceSetsTest.kt index 94b4c1f52fb..3304bfbf5f6 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/SyncKotlinAndAndroidSourceSetsTest.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/SyncKotlinAndAndroidSourceSetsTest.kt @@ -2,7 +2,7 @@ * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ -@file:Suppress("invisible_reference", "invisible_member", "FunctionName") +@file:Suppress("invisible_reference", "invisible_member", "FunctionName", "DuplicatedCode") package org.jetbrains.kotlin.gradle @@ -89,8 +89,47 @@ class SyncKotlinAndAndroidSourceSetsTest { ) } + @Test + fun `two product flavor dimensions`() { + android.flavorDimensions("pricing", "releaseType") + android.productFlavors { + it.create("beta").dimension = "releaseType" + it.create("production").dimension = "releaseType" + it.create("free").dimension = "pricing" + it.create("paid").dimension = "pricing" + } + kotlin.android() + project.evaluate() + + fun assertSourceSetsExist(androidName: String, kotlinName: String) { + val androidSourceSet = assertNotNull(android.sourceSets.findByName(androidName), "Expected Android source set '$androidName'") + val kotlinSourceSet = assertNotNull(kotlin.sourceSets.findByName(kotlinName), "Expected Kotlin source set '$kotlinName'") + assertSame(kotlinSourceSet, androidSourceSet.kotlinSourceSet) + } + + assertSourceSetsExist("freeBetaDebug", "androidFreeBetaDebug") + assertSourceSetsExist("freeBetaRelease", "androidFreeBetaRelease") + + assertSourceSetsExist("freeProductionDebug", "androidFreeProductionDebug") + assertSourceSetsExist("freeProductionRelease", "androidFreeProductionRelease") + + + assertSourceSetsExist("paidBetaDebug", "androidPaidBetaDebug") + assertSourceSetsExist("paidBetaRelease", "androidPaidBetaRelease") + + assertSourceSetsExist("paidProductionDebug", "androidPaidProductionDebug") + assertSourceSetsExist("paidProductionRelease", "androidPaidProductionRelease") + } + @Test fun `all source directories are disjoint in source sets`() { + android.flavorDimensions("pricing", "releaseType") + android.productFlavors { + it.create("beta").dimension = "releaseType" + it.create("production").dimension = "releaseType" + it.create("free").dimension = "pricing" + it.create("paid").dimension = "pricing" + } kotlin.android() project.evaluate() diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt index 83f228797f5..c1c7ae33777 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt @@ -105,7 +105,7 @@ private fun syncKotlinAndAndroidResources( androidSourceSet.resources.srcDirs(*kotlinSourceSet.resources.toList().toTypedArray()) if (androidSourceSet.resources.srcDirs.isNotEmpty()) { androidSourceSet.resources.srcDir(kotlinSourceSet.sourceFolderFor(project, "resources")) - kotlinSourceSet.resources.srcDirs(androidSourceSet.resources.srcDirs - kotlinSourceSet.resources.srcDirs) + kotlinSourceSet.resources.srcDirs(androidSourceSet.resources.srcDirs) } if (androidSourceSet.assets.srcDirs.isNotEmpty()) { From 3f98e2974cef895caee8286a7a8d64003c490db0 Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Fri, 20 Nov 2020 12:46:09 +0100 Subject: [PATCH 079/698] Expand AndroidSourceSet#kotlinSourceSet to AndroidSourceSet#kotlinSourceSetOrNull --- .../gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt index c1c7ae33777..1956643eefa 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt @@ -35,11 +35,14 @@ internal fun syncKotlinAndAndroidSourceSets(target: KotlinAndroidTarget) { } internal var AndroidSourceSet.kotlinSourceSet: KotlinSourceSet - get() = getConvention(KOTLIN_DSL_NAME) as KotlinSourceSet + get() = checkNotNull(kotlinSourceSetOrNull) { "Missing kotlinSourceSet for Android source set $name" } private set(value) { addConvention(KOTLIN_DSL_NAME, value) } +internal val AndroidSourceSet.kotlinSourceSetOrNull: KotlinSourceSet? + get() = getConvention(KOTLIN_DSL_NAME) as? KotlinSourceSet + private fun createDefaultDependsOnEdges( target: KotlinAndroidTarget, kotlinSourceSet: KotlinSourceSet, From 7c7eada452dee3d865d43e9e90867c4e3e4fc7fe Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Tue, 24 Nov 2020 09:12:13 +0100 Subject: [PATCH 080/698] Add comment about unsupported associate compilations to functionalTest source files --- .../kotlin/gradle/JvmAndAndroidIntermediateSourceSetTest.kt | 1 + .../jetbrains/kotlin/gradle/KotlinAndroidDependsOnEdgesTest.kt | 3 ++- .../kotlin/gradle/SyncKotlinAndAndroidSourceSetsTest.kt | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/JvmAndAndroidIntermediateSourceSetTest.kt b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/JvmAndAndroidIntermediateSourceSetTest.kt index c3107a45f87..8d2f5ec2039 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/JvmAndAndroidIntermediateSourceSetTest.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/JvmAndAndroidIntermediateSourceSetTest.kt @@ -3,6 +3,7 @@ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ +/* Associate compilations are not yet supported by the IDE. KT-34102 */ @file:Suppress("invisible_reference", "invisible_member", "FunctionName", "DuplicatedCode") package org.jetbrains.kotlin.gradle diff --git a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/KotlinAndroidDependsOnEdgesTest.kt b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/KotlinAndroidDependsOnEdgesTest.kt index 0cc60d7f636..ed3c60e7f6a 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/KotlinAndroidDependsOnEdgesTest.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/KotlinAndroidDependsOnEdgesTest.kt @@ -2,7 +2,8 @@ * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ -// TODO KT-34102 + +/* Associate compilations are not yet supported by the IDE. KT-34102 */ @file:Suppress("invisible_reference", "invisible_member", "FunctionName") package org.jetbrains.kotlin.gradle diff --git a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/SyncKotlinAndAndroidSourceSetsTest.kt b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/SyncKotlinAndAndroidSourceSetsTest.kt index 3304bfbf5f6..fcbbaf40fbe 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/SyncKotlinAndAndroidSourceSetsTest.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/SyncKotlinAndAndroidSourceSetsTest.kt @@ -2,6 +2,8 @@ * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ + +/* Associate compilations are not yet supported by the IDE. KT-34102 */ @file:Suppress("invisible_reference", "invisible_member", "FunctionName", "DuplicatedCode") package org.jetbrains.kotlin.gradle From 2286498d8d91d8281c03c78da06fa20374f616a4 Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Tue, 24 Nov 2020 09:45:34 +0100 Subject: [PATCH 081/698] Share defaultSourceFolder logic between syncKotlinAndAndroidSourceSets.kt and KotlinSourceSetFactory.kt --- .../gradle/plugin/KotlinPluginWrapper.kt | 24 ++++++----------- .../mpp/syncKotlinAndAndroidSourceSets.kt | 21 +++++++-------- .../plugin/sources/KotlinSourceSetFactory.kt | 26 ++++++++++++------- 3 files changed, 34 insertions(+), 37 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinPluginWrapper.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinPluginWrapper.kt index f6d7f077177..0a5f0cf2420 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinPluginWrapper.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinPluginWrapper.kt @@ -47,9 +47,7 @@ import org.jetbrains.kotlin.statistics.metrics.StringMetrics import javax.inject.Inject import kotlin.reflect.KClass -abstract class KotlinBasePluginWrapper( - protected val fileResolver: FileResolver -) : Plugin { +abstract class KotlinBasePluginWrapper : Plugin { private val log = Logging.getLogger(this.javaClass) val kotlinPluginVersion = loadKotlinVersionFromResource(log) @@ -57,7 +55,7 @@ abstract class KotlinBasePluginWrapper( open val projectExtensionClass: KClass get() = KotlinProjectExtension::class internal open fun kotlinSourceSetFactory(project: Project): NamedDomainObjectFactory = - DefaultKotlinSourceSetFactory(project, fileResolver) + DefaultKotlinSourceSetFactory(project) override fun apply(project: Project) { val listenerRegistryHolder = BuildEventsListenerRegistryHolder.getInstance(project) @@ -127,9 +125,8 @@ abstract class KotlinBasePluginWrapper( } open class KotlinPluginWrapper @Inject constructor( - fileResolver: FileResolver, protected val registry: ToolingModelBuilderRegistry -) : KotlinBasePluginWrapper(fileResolver) { +) : KotlinBasePluginWrapper() { override fun getPlugin(project: Project, kotlinGradleBuildServices: KotlinGradleBuildServices): Plugin = KotlinPlugin(kotlinPluginVersion, registry) @@ -138,9 +135,8 @@ open class KotlinPluginWrapper @Inject constructor( } open class KotlinCommonPluginWrapper @Inject constructor( - fileResolver: FileResolver, protected val registry: ToolingModelBuilderRegistry -) : KotlinBasePluginWrapper(fileResolver) { +) : KotlinBasePluginWrapper() { override fun getPlugin(project: Project, kotlinGradleBuildServices: KotlinGradleBuildServices): Plugin = KotlinCommonPlugin(kotlinPluginVersion, registry) @@ -149,9 +145,8 @@ open class KotlinCommonPluginWrapper @Inject constructor( } open class KotlinAndroidPluginWrapper @Inject constructor( - fileResolver: FileResolver, protected val registry: ToolingModelBuilderRegistry -) : KotlinBasePluginWrapper(fileResolver) { +) : KotlinBasePluginWrapper() { override fun getPlugin(project: Project, kotlinGradleBuildServices: KotlinGradleBuildServices): Plugin = KotlinAndroidPlugin(kotlinPluginVersion, registry) @@ -160,9 +155,8 @@ open class KotlinAndroidPluginWrapper @Inject constructor( } open class Kotlin2JsPluginWrapper @Inject constructor( - fileResolver: FileResolver, protected val registry: ToolingModelBuilderRegistry -) : KotlinBasePluginWrapper(fileResolver) { +) : KotlinBasePluginWrapper() { override fun getPlugin(project: Project, kotlinGradleBuildServices: KotlinGradleBuildServices): Plugin = Kotlin2JsPlugin(kotlinPluginVersion, registry) @@ -171,8 +165,7 @@ open class Kotlin2JsPluginWrapper @Inject constructor( } open class KotlinJsPluginWrapper @Inject constructor( - fileResolver: FileResolver -) : KotlinBasePluginWrapper(fileResolver) { +) : KotlinBasePluginWrapper() { override fun getPlugin(project: Project, kotlinGradleBuildServices: KotlinGradleBuildServices): Plugin = KotlinJsPlugin(kotlinPluginVersion) @@ -204,9 +197,8 @@ open class KotlinJsPluginWrapper @Inject constructor( } open class KotlinMultiplatformPluginWrapper @Inject constructor( - fileResolver: FileResolver, private val featurePreviews: FeaturePreviews -) : KotlinBasePluginWrapper(fileResolver) { +) : KotlinBasePluginWrapper() { override fun getPlugin(project: Project, kotlinGradleBuildServices: KotlinGradleBuildServices): Plugin = KotlinMultiplatformPlugin( kotlinPluginVersion, diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt index 1956643eefa..59f4696bee6 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt @@ -13,6 +13,8 @@ import org.jetbrains.kotlin.gradle.internal.Kapt3GradleSubplugin import org.jetbrains.kotlin.gradle.plugin.* import org.jetbrains.kotlin.gradle.plugin.AbstractAndroidProjectHandler.Companion.kotlinSourceSetNameForAndroidSourceSet import org.jetbrains.kotlin.gradle.plugin.addConvention +import org.jetbrains.kotlin.gradle.plugin.sources.KotlinSourceSetFactory +import org.jetbrains.kotlin.gradle.plugin.sources.KotlinSourceSetFactory.Companion.defaultSourceFolder import java.io.File internal fun syncKotlinAndAndroidSourceSets(target: KotlinAndroidTarget) { @@ -107,39 +109,36 @@ private fun syncKotlinAndAndroidResources( androidSourceSet.resources.srcDirs(*kotlinSourceSet.resources.toList().toTypedArray()) if (androidSourceSet.resources.srcDirs.isNotEmpty()) { - androidSourceSet.resources.srcDir(kotlinSourceSet.sourceFolderFor(project, "resources")) + androidSourceSet.resources.srcDir(defaultSourceFolder(project, kotlinSourceSet.name, "resources")) kotlinSourceSet.resources.srcDirs(androidSourceSet.resources.srcDirs) } if (androidSourceSet.assets.srcDirs.isNotEmpty()) { - androidSourceSet.assets.srcDir(kotlinSourceSet.sourceFolderFor(project, "assets")) + androidSourceSet.assets.srcDir(defaultSourceFolder(project, kotlinSourceSet.name, "assets")) } if (androidSourceSet.res.srcDirs.isNotEmpty()) { - androidSourceSet.res.srcDir(kotlinSourceSet.sourceFolderFor(project, "res")) + androidSourceSet.res.srcDir(defaultSourceFolder(project, kotlinSourceSet.name, "res")) } if (androidSourceSet.aidl.srcDirs.isNotEmpty()) { - androidSourceSet.aidl.srcDir(kotlinSourceSet.sourceFolderFor(project, "aidl")) + androidSourceSet.aidl.srcDir(defaultSourceFolder(project, kotlinSourceSet.name, "aidl")) } if (androidSourceSet.renderscript.srcDirs.isNotEmpty()) { - androidSourceSet.renderscript.srcDir(kotlinSourceSet.sourceFolderFor(project, "rs")) + androidSourceSet.renderscript.srcDir(defaultSourceFolder(project, kotlinSourceSet.name, "rs")) } if (androidSourceSet.jni.srcDirs.isNotEmpty()) { - androidSourceSet.jni.srcDir(kotlinSourceSet.sourceFolderFor(project, "jni")) + androidSourceSet.jni.srcDir(defaultSourceFolder(project, kotlinSourceSet.name, "jni")) } if (androidSourceSet.jniLibs.srcDirs.isNotEmpty()) { - androidSourceSet.jniLibs.srcDir(kotlinSourceSet.sourceFolderFor(project, "jniLibs")) + androidSourceSet.jniLibs.srcDir(defaultSourceFolder(project, kotlinSourceSet.name, "jniLibs")) } if (androidSourceSet.shaders.srcDirs.isNotEmpty()) { - androidSourceSet.shaders.srcDir(kotlinSourceSet.sourceFolderFor(project, "shaders")) + androidSourceSet.shaders.srcDir(defaultSourceFolder(project, kotlinSourceSet.name, "shaders")) } } -private fun KotlinSourceSet.sourceFolderFor(project: Project, type: String): File { - return project.file("src/${this.name}/$type") -} diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/sources/KotlinSourceSetFactory.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/sources/KotlinSourceSetFactory.kt index e4205c0f87f..51279abef8b 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/sources/KotlinSourceSetFactory.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/sources/KotlinSourceSetFactory.kt @@ -17,7 +17,6 @@ import org.jetbrains.kotlin.gradle.targets.metadata.isKotlinGranularMetadataEnab import java.io.File internal abstract class KotlinSourceSetFactory internal constructor( - protected val fileResolver: FileResolver, protected val project: Project ) : NamedDomainObjectFactory { @@ -29,11 +28,8 @@ internal abstract class KotlinSourceSetFactory internal con return result } - protected open fun defaultSourceLocation(sourceSetName: String): File = - project.file("src/$sourceSetName") - protected open fun setUpSourceSetDefaults(sourceSet: T) { - sourceSet.kotlin.srcDir(File(defaultSourceLocation(sourceSet.name), "kotlin")) + sourceSet.kotlin.srcDir(defaultSourceFolder(project, sourceSet.name, "kotlin")) defineSourceSetConfigurations(project, sourceSet) } @@ -49,19 +45,29 @@ internal abstract class KotlinSourceSetFactory internal con } protected abstract fun doCreateSourceSet(name: String): T + + companion object { + /** + * @return default location of source folders for a kotlin source set + * e.g. src/jvmMain/kotlin (sourceSetName="jvmMain", type="kotlin") + */ + fun defaultSourceFolder(project: Project, sourceSetName: String, type: String): File { + return project.file("src/$sourceSetName/$type") + } + } } + internal class DefaultKotlinSourceSetFactory( - project: Project, - fileResolver: FileResolver -) : KotlinSourceSetFactory(fileResolver, project) { + project: Project +) : KotlinSourceSetFactory(project) { override val itemClass: Class get() = DefaultKotlinSourceSet::class.java override fun setUpSourceSetDefaults(sourceSet: DefaultKotlinSourceSet) { super.setUpSourceSetDefaults(sourceSet) - sourceSet.resources.srcDir(File(defaultSourceLocation(sourceSet.name), "resources")) + sourceSet.resources.srcDir(defaultSourceFolder(project, sourceSet.name, "resources")) val dependencyConfigurationWithMetadata = with(sourceSet) { listOf( @@ -90,4 +96,4 @@ internal class DefaultKotlinSourceSetFactory( override fun doCreateSourceSet(name: String): DefaultKotlinSourceSet { return DefaultKotlinSourceSet(project, name) } -} \ No newline at end of file +} From 6c7247cbd35ac80010b2d64c95403477457b0d8b Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Tue, 24 Nov 2020 10:36:46 +0100 Subject: [PATCH 082/698] syncKotlinAndAndroidSourceSets: Don't register Kotlin source dirs in Android java source dirs --- .../AbstractKotlinAndroidGradleTests.kt | 24 ++++++---------- .../SyncKotlinAndAndroidSourceSetsTest.kt | 28 +++++++------------ .../mpp/syncKotlinAndAndroidSourceSets.kt | 2 -- 3 files changed, 19 insertions(+), 35 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/AbstractKotlinAndroidGradleTests.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/AbstractKotlinAndroidGradleTests.kt index 2973827e45d..5f32b0f5f83 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/AbstractKotlinAndroidGradleTests.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/AbstractKotlinAndroidGradleTests.kt @@ -25,14 +25,6 @@ open class KotlinAndroid36GradleIT : KotlinAndroid33GradleIT() { fun testAndroidMppSourceSets(): Unit = with(Project("new-mpp-android-source-sets", GradleVersionRequired.FOR_MPP_SUPPORT)) { build("sourceSets") { assertSuccessful() - assertContains("Java sources: [lib/src/androidTest/java, lib/src/androidAndroidTest/kotlin]") - assertContains("Java sources: [lib/src/androidTestDebug/java, lib/src/androidAndroidTestDebug/kotlin]") - assertContains("Java sources: [lib/src/debug/java, lib/src/androidDebug/kotlin, lib/src/debug/kotlin]") - assertContains("Java sources: [lib/src/main/java, lib/src/androidMain/kotlin, lib/src/main/kotlin]") - assertContains("Java sources: [lib/src/release/java, lib/src/androidRelease/kotlin, lib/src/release/kotlin]") - assertContains("Java sources: [lib/src/test/java, lib/src/androidTest/kotlin, lib/src/test/kotlin]") - assertContains("Java sources: [lib/src/testDebug/java, lib/src/androidTestDebug/kotlin, lib/src/testDebug/kotlin]") - assertContains("Java sources: [lib/src/testRelease/java, lib/src/androidTestRelease/kotlin, lib/src/testRelease/kotlin]") assertContains("Android resources: [lib/src/main/res, lib/src/androidMain/res]") assertContains("Assets: [lib/src/main/assets, lib/src/androidMain/assets]") @@ -50,14 +42,13 @@ open class KotlinAndroid36GradleIT : KotlinAndroid33GradleIT() { assertContains("JNI libraries: [lib/src/androidTestDebug/jniLibs, lib/src/androidAndroidTestDebug/jniLibs]") assertContains("Java-style resources: [lib/src/androidTestDebug/resources, lib/src/androidAndroidTestDebug/resources]") - assertContains("Java sources: [lib/betaSrc/paidBeta/java, lib/src/androidPaidBeta/kotlin, lib/src/paidBeta/kotlin]") - assertContains("Java sources: [lib/betaSrc/paidBetaDebug/java, lib/src/androidPaidBetaDebug/kotlin, lib/src/paidBetaDebug/kotlin]") - assertContains("Java sources: [lib/betaSrc/paidBetaRelease/java, lib/src/androidPaidBetaRelease/kotlin, lib/src/paidBetaRelease/kotlin]") - - assertContains("Java sources: [lib/betaSrc/freeBeta/java, lib/src/androidFreeBeta/kotlin, lib/src/freeBeta/kotlin]") - assertContains("Java sources: [lib/betaSrc/freeBetaDebug/java, lib/src/androidFreeBetaDebug/kotlin, lib/src/freeBetaDebug/kotlin]") - assertContains("Java sources: [lib/betaSrc/freeBetaRelease/java, lib/src/androidFreeBetaRelease/kotlin, lib/src/freeBetaRelease/kotlin]") + assertContains("Java-style resources: [lib/betaSrc/paidBeta/resources, lib/src/androidPaidBeta/resources]") + assertContains("Java-style resources: [lib/betaSrc/paidBetaDebug/resources, lib/src/androidPaidBetaDebug/resources]") + assertContains("Java-style resources: [lib/betaSrc/paidBetaRelease/resources, lib/src/androidPaidBetaRelease/resources]") + assertContains("Java-style resources: [lib/betaSrc/freeBeta/resources, lib/src/androidFreeBeta/resources]") + assertContains("Java-style resources: [lib/betaSrc/freeBetaDebug/resources, lib/src/androidFreeBetaDebug/resources]") + assertContains("Java-style resources: [lib/betaSrc/freeBetaRelease/resources, lib/src/androidFreeBetaRelease/resources]") } build("testFreeBetaDebug") { @@ -73,10 +64,13 @@ open class KotlinAndroid36GradleIT : KotlinAndroid33GradleIT() { } // Test for KT-35016: MPP should recognize android instrumented tests correctly + // TODO: https://issuetracker.google.com/issues/173770818 enable after fix in AGP + /* build("connectedAndroidTest") { assertFailed() assertContains("No connected devices!") } + */ } @Test diff --git a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/SyncKotlinAndAndroidSourceSetsTest.kt b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/SyncKotlinAndAndroidSourceSetsTest.kt index fcbbaf40fbe..dd0bc6c5eec 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/SyncKotlinAndAndroidSourceSetsTest.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/SyncKotlinAndAndroidSourceSetsTest.kt @@ -45,10 +45,11 @@ class SyncKotlinAndAndroidSourceSetsTest { val kotlinAndroidMainSourceSet = kotlin.sourceSets.getByName("androidMain") val androidMainSourceSet = android.sourceSets.getByName("main") - assertEquals( - androidMainSourceSet.java.srcDirs.toSet(), - kotlinAndroidMainSourceSet.kotlin.srcDirs.toSet(), - "Expected all source directories being present in all models" + assertTrue( + kotlinAndroidMainSourceSet.kotlin.srcDirs.containsAll(androidMainSourceSet.java.srcDirs), + "Expected all Android java srcDirs in Kotlin source set.\n" + + "Kotlin=${kotlinAndroidMainSourceSet.kotlin.srcDirs}\n" + + "Android=${androidMainSourceSet.java.srcDirs}" ) } @@ -59,10 +60,11 @@ class SyncKotlinAndAndroidSourceSetsTest { val kotlinAndroidTestSourceSet = kotlin.sourceSets.getByName("androidTest") val testSourceSet = android.sourceSets.getByName("test") - assertEquals( - testSourceSet.java.srcDirs.toSet(), - kotlinAndroidTestSourceSet.kotlin.srcDirs.toSet(), - "Expected all source directories being present in all models" + assertTrue( + kotlinAndroidTestSourceSet.kotlin.srcDirs.containsAll(testSourceSet.java.srcDirs), + "Expected all Android java srcDirs in Kotlin source set.\n" + + "Kotlin=${kotlinAndroidTestSourceSet.kotlin.srcDirs}\n" + + "Android=${testSourceSet.java.srcDirs}" ) } @@ -73,11 +75,6 @@ class SyncKotlinAndAndroidSourceSetsTest { val kotlinAndroidAndroidTestSourceSet = kotlin.sourceSets.getByName("androidAndroidTest") val androidTestSourceSet = android.sourceSets.getByName("androidTest") - assertTrue( - androidTestSourceSet.java.srcDirs.toSet().containsAll(kotlinAndroidAndroidTestSourceSet.kotlin.srcDirs), - "Expected all kotlin source directories being registered on AGP" - ) - assertTrue( project.file("src/androidTest/kotlin") !in kotlinAndroidAndroidTestSourceSet.kotlin.srcDirs, "Expected no source directory of 'androidTest' kotlin source set (Unit Test) " + @@ -172,11 +169,6 @@ class SyncKotlinAndAndroidSourceSetsTest { kotlinAndroidMain.kotlin.srcDirs.containsAll(setOf(project.file("fromKotlin"), project.file("fromAndroid"))), "Expected custom configured source directories being present on kotlin source set after evaluation" ) - - assertTrue( - androidMain.java.srcDirs.containsAll(setOf(project.file("fromKotlin"), project.file("fromAndroid"))), - "Expected custom configured source directories being present on android source set after evaluation" - ) } @Test diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt index 59f4696bee6..53a6f32c2f4 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt @@ -79,7 +79,6 @@ private fun syncKotlinAndAndroidSourceDirs( } kotlinSourceSet.kotlin.srcDirs(*androidSourceSet.java.srcDirs.toTypedArray()) - androidSourceSet.java.srcDirs(*kotlinSourceSet.kotlin.srcDirs.toTypedArray()) /* Make sure to include user configuration as well. @@ -88,7 +87,6 @@ private fun syncKotlinAndAndroidSourceDirs( */ target.project.whenEvaluated { kotlinSourceSet.kotlin.srcDirs(*androidSourceSet.java.srcDirs.toTypedArray()) - androidSourceSet.java.srcDirs(*kotlinSourceSet.kotlin.srcDirs.toTypedArray()) } } From 176071b7db87f3fe19462e37575f88b6d77b6442 Mon Sep 17 00:00:00 2001 From: Sergey Shanshin Date: Tue, 24 Nov 2020 16:34:02 +0300 Subject: [PATCH 083/698] Add support of nullable serializers to UseSerializers annotation (#3906) Fixes Kotlin/kotlinx.serialization#984 --- .../kotlinx/serialization/compiler/backend/common/TypeUtil.kt | 3 --- 1 file changed, 3 deletions(-) diff --git a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/common/TypeUtil.kt b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/common/TypeUtil.kt index 1fcb94c05d0..48948665f6c 100644 --- a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/common/TypeUtil.kt +++ b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/common/TypeUtil.kt @@ -125,9 +125,6 @@ fun AbstractSerialGenerator.findTypeSerializerOrContextUnchecked( if (kType.isTypeParameter()) return null annotations.serializableWith(module)?.let { return it.toClassDescriptor } additionalSerializersInScopeOfCurrentFile[kType]?.let { return it } - if (!kType.isMarkedNullable) { - additionalSerializersInScopeOfCurrentFile[kType.makeNullable()]?.let { return it } - } if (kType in contextualKClassListInCurrentFile) return module.getClassFromSerializationPackage(SpecialBuiltins.contextSerializer) return analyzeSpecialSerializers(module, annotations) ?: findTypeSerializer(module, kType) From f382a55b17bcebdab4daa1d357ca368d2dc8b802 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Tue, 24 Nov 2020 16:34:10 +0300 Subject: [PATCH 084/698] [JS IR] Add EXPECTED_REACHABLE_NODES for JS tests of external tail args --- .../testData/box/defaultArguments/externalTailArgsClass.kt | 1 + .../testData/box/defaultArguments/externalTailArgsFun.kt | 1 + 2 files changed, 2 insertions(+) diff --git a/js/js.translator/testData/box/defaultArguments/externalTailArgsClass.kt b/js/js.translator/testData/box/defaultArguments/externalTailArgsClass.kt index ffed5e03bc9..506607b9d2e 100644 --- a/js/js.translator/testData/box/defaultArguments/externalTailArgsClass.kt +++ b/js/js.translator/testData/box/defaultArguments/externalTailArgsClass.kt @@ -1,3 +1,4 @@ +// EXPECTED_REACHABLE_NODES: 1239 // FILE: main.kt external class TailArgs( p0: String = definedExternally, diff --git a/js/js.translator/testData/box/defaultArguments/externalTailArgsFun.kt b/js/js.translator/testData/box/defaultArguments/externalTailArgsFun.kt index c0b6b7a52f2..94fb432dff2 100644 --- a/js/js.translator/testData/box/defaultArguments/externalTailArgsFun.kt +++ b/js/js.translator/testData/box/defaultArguments/externalTailArgsFun.kt @@ -1,3 +1,4 @@ +// EXPECTED_REACHABLE_NODES: 1237 // FILE: main.kt external fun create( p0: String = definedExternally, From 6748560184f011de8452a811705e7d4595031dbe Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Thu, 12 Nov 2020 13:43:46 +0100 Subject: [PATCH 085/698] Proper support of aggregated processors --- .../IncrementalAggregatingProcessor.java | 57 ++++++ .../IncrementalBinaryIsolatingProcessor.java | 72 ++++++++ .../incapt/IncrementalIsolatingProcessor.java | 56 ++++++ .../KaptIncrementalWithAggregatingApt.kt | 167 +++++++++++++++++- .../gradle/KaptIncrementalWithIsolatingApt.kt | 38 ++-- .../build.gradle | 26 +++ .../src/main/java/bar/noAnnotations.kt | 7 + .../src/main/java/bar/withAnnotation.kt | 4 + .../org/jetbrains/kotlin/kapt3/base/Kapt.kt | 6 +- .../kotlin/kapt3/base/KaptContext.kt | 2 +- .../kotlin/kapt3/base/KaptOptions.kt | 9 + .../kotlin/kapt3/base/annotationProcessing.kt | 13 +- .../base/incremental/IncrementalAptCache.kt | 11 +- .../kotlin/kapt3/base/incremental/cache.kt | 20 ++- .../base/incremental/classStructureCache.kt | 2 +- .../base/incremental/incrementalProcessors.kt | 63 ++++++- 16 files changed, 525 insertions(+), 28 deletions(-) create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/java/org/jetbrains/kotlin/gradle/incapt/IncrementalAggregatingProcessor.java create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/java/org/jetbrains/kotlin/gradle/incapt/IncrementalBinaryIsolatingProcessor.java create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/java/org/jetbrains/kotlin/gradle/incapt/IncrementalIsolatingProcessor.java create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalAggregatingProcessorProject/build.gradle create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalAggregatingProcessorProject/src/main/java/bar/noAnnotations.kt create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalAggregatingProcessorProject/src/main/java/bar/withAnnotation.kt diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/java/org/jetbrains/kotlin/gradle/incapt/IncrementalAggregatingProcessor.java b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/java/org/jetbrains/kotlin/gradle/incapt/IncrementalAggregatingProcessor.java new file mode 100644 index 00000000000..a59019a2ffd --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/java/org/jetbrains/kotlin/gradle/incapt/IncrementalAggregatingProcessor.java @@ -0,0 +1,57 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.gradle.incapt; + +import javax.annotation.processing.AbstractProcessor; +import javax.annotation.processing.RoundEnvironment; +import javax.lang.model.element.Element; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.TypeElement; +import javax.lang.model.element.VariableElement; +import javax.tools.*; +import java.io.IOException; +import java.io.Writer; +import java.util.Collections; +import java.util.Set; +import java.util.TreeSet; + +/** + * Simple processor that generates resource file that contains names of annotated elements. + */ +public class IncrementalAggregatingProcessor extends AbstractProcessor { + + private Set values = new TreeSet(); + + @Override + public Set getSupportedAnnotationTypes() { + return Collections.singleton("example.KotlinFilerGenerated"); + } + + @Override + public boolean process(Set annotations, RoundEnvironment roundEnv) { + for (TypeElement annotation : annotations) { + for (Element element : roundEnv.getElementsAnnotatedWith(annotation)) { + if (element instanceof TypeElement || element instanceof ExecutableElement || element instanceof VariableElement) { + values.add(element.getSimpleName().toString()); + } + } + } + + if (roundEnv.processingOver() && !values.isEmpty()) { + try (Writer writer = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", "generated.txt").openWriter()) { + for (String value : values) { + writer.append(value).append("\n"); + } + } + catch (IOException e) { + throw new RuntimeException(e); + } + values.clear(); + } + + return true; + } +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/java/org/jetbrains/kotlin/gradle/incapt/IncrementalBinaryIsolatingProcessor.java b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/java/org/jetbrains/kotlin/gradle/incapt/IncrementalBinaryIsolatingProcessor.java new file mode 100644 index 00000000000..3d80ceb23ef --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/java/org/jetbrains/kotlin/gradle/incapt/IncrementalBinaryIsolatingProcessor.java @@ -0,0 +1,72 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.gradle.incapt; + +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.Type; + +import javax.annotation.processing.AbstractProcessor; +import javax.annotation.processing.RoundEnvironment; +import javax.lang.model.element.Element; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.TypeElement; +import javax.lang.model.element.VariableElement; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Collections; +import java.util.Set; + +import static org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static org.objectweb.asm.Opcodes.ACC_SUPER; + +/** Simple processor that generates a class for every annotated element (class, field, method). */ +public class IncrementalBinaryIsolatingProcessor extends AbstractProcessor { + + @Override + public Set getSupportedAnnotationTypes() { + return Collections.singleton("example.ExampleAnnotation"); + } + + @Override + public boolean process(Set annotations, RoundEnvironment roundEnv) { + if (annotations.isEmpty()) return true; + + for (Element element : roundEnv.getElementsAnnotatedWith(annotations.iterator().next())) { + if (element instanceof TypeElement || element instanceof ExecutableElement || element instanceof VariableElement) { + String name = element.getSimpleName().toString(); + name = name.substring(0, 1).toUpperCase() + name.substring(1) + "Generated"; + System.out.println("kapt: IncrementalBinaryIsolatingProcessor " + name); + String packageName; + if (element instanceof TypeElement) { + packageName = element.getEnclosingElement().getSimpleName().toString(); + } + else { + packageName = element.getEnclosingElement().getEnclosingElement().getSimpleName().toString(); + } + + String generatedClassName = packageName + "." + name; + try (OutputStream stream = processingEnv.getFiler().createClassFile(generatedClassName, element).openOutputStream()) { + ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); + writer.visit(Opcodes.V1_8, + ACC_PUBLIC | ACC_SUPER, + generatedClassName.replaceAll("\\.", "/"), + null, + "java/lang/Object", + null); + + writer.visitAnnotation(Type.getObjectType("example/KotlinFilerGenerated").getDescriptor(), true); + writer.visitEnd(); + stream.write(writer.toByteArray()); + } + catch (IOException ignored) { + } + } + } + + return false; + } +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/java/org/jetbrains/kotlin/gradle/incapt/IncrementalIsolatingProcessor.java b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/java/org/jetbrains/kotlin/gradle/incapt/IncrementalIsolatingProcessor.java new file mode 100644 index 00000000000..bee92859a50 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/java/org/jetbrains/kotlin/gradle/incapt/IncrementalIsolatingProcessor.java @@ -0,0 +1,56 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.gradle.incapt; + +import javax.annotation.processing.AbstractProcessor; +import javax.annotation.processing.RoundEnvironment; +import javax.lang.model.element.Element; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.TypeElement; +import javax.lang.model.element.VariableElement; +import java.io.IOException; +import java.io.Writer; +import java.util.Collections; +import java.util.Set; + +/** Simple processor that generates a class for every annotated element (class, field, method). */ +public class IncrementalIsolatingProcessor extends AbstractProcessor { + + @Override + public Set getSupportedAnnotationTypes() { + return Collections.singleton("example.ExampleAnnotation"); + } + + @Override + public boolean process(Set annotations, RoundEnvironment roundEnv) { + if (annotations.isEmpty()) return true; + + for (Element element : roundEnv.getElementsAnnotatedWith(annotations.iterator().next())) { + if (element instanceof TypeElement || element instanceof ExecutableElement || element instanceof VariableElement) { + String name = element.getSimpleName().toString(); + name = name.substring(0, 1).toUpperCase() + name.substring(1) + "Generated"; + + String packageName; + if (element instanceof TypeElement) { + packageName = element.getEnclosingElement().getSimpleName().toString(); + } + else { + packageName = element.getEnclosingElement().getEnclosingElement().getSimpleName().toString(); + } + + try (Writer writer = processingEnv.getFiler().createSourceFile(packageName + "." + name, element).openWriter()) { + writer.append("package ").append(packageName).append(";"); + writer.append("\n@example.KotlinFilerGenerated").append("\n"); + writer.append("\npublic class ").append(name).append(" {}"); + } + catch (IOException ignored) { + } + } + } + + return false; + } +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithAggregatingApt.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithAggregatingApt.kt index ca60e4001ca..e7e629f65e9 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithAggregatingApt.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithAggregatingApt.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.gradle +import org.jetbrains.kotlin.gradle.incapt.* import org.jetbrains.kotlin.gradle.util.modify import org.junit.Assert.assertEquals import org.junit.Assert.assertTrue @@ -34,6 +35,11 @@ class KaptIncrementalWithAggregatingApt : KaptIncrementalIT() { ) ) + private fun jdk9Options(javaHome: File): BuildOptions { + Assume.assumeTrue("JDK 9 isn't available", javaHome.isDirectory) + return defaultBuildOptions().copy(javaHome = javaHome) + } + @Test fun testIncrementalChanges() { val project = getProject() @@ -80,8 +86,7 @@ class KaptIncrementalWithAggregatingApt : KaptIncrementalIT() { @Test fun testIncrementalChangesWithJdk9() { val javaHome = File(System.getProperty("jdk9Home")!!) - Assume.assumeTrue("JDK 9 isn't available", javaHome.isDirectory) - val options = defaultBuildOptions().copy(javaHome = javaHome) + val options = jdk9Options(javaHome) val project = getProject() project.build("clean", "build", options = options) { @@ -111,7 +116,7 @@ class KaptIncrementalWithAggregatingApt : KaptIncrementalIT() { GradleVersionRequired.None ).apply { setupWorkingDir() - val processorPath = generateProcessor("AGGREGATING") + val processorPath = generateProcessor("AGGREGATING" to IncrementalProcessor::class.java) projectDir.resolve("app/build.gradle").appendText( """ @@ -202,4 +207,160 @@ class KaptIncrementalWithAggregatingApt : KaptIncrementalIT() { ) } } + + @Test + fun testIncrementalAggregatingChanges() { + doIncrementalAggregatingChanges() + } + + @Test + fun testIncrementalAggregatingChangesWithJdk9() { + val javaHome = File(System.getProperty("jdk9Home")!!) + doIncrementalAggregatingChanges(buildOptions = jdk9Options(javaHome)) + } + + @Test + fun testIncrementalBinaryAggregatingChanges() { + doIncrementalAggregatingChanges(true) + } + + @Test + fun testIncrementalBinaryAggregatingChangesWithJdk9() { + val javaHome = File(System.getProperty("jdk9Home")!!) + val options = jdk9Options(javaHome) + doIncrementalAggregatingChanges(true, options) + } + + private fun CompiledProject.checkAggregatingResource(check: (List) -> Unit) { + val aggregatingResource = "build/tmp/kapt3/classes/main/generated.txt" + assertFileExists(aggregatingResource) + val lines = fileInWorkingDir(aggregatingResource).readLines() + check(lines) + } + + fun doIncrementalAggregatingChanges(isBinary: Boolean = false, buildOptions: BuildOptions = defaultBuildOptions()) { + val project = Project( + "kaptIncrementalAggregatingProcessorProject", + GradleVersionRequired.None + ).apply { + setupIncrementalAptProject( + "ISOLATING" to if (isBinary) IncrementalBinaryIsolatingProcessor::class.java else IncrementalIsolatingProcessor::class.java, + "AGGREGATING" to IncrementalAggregatingProcessor::class.java + ) + } + + project.build("clean", "build", options = buildOptions) { + assertSuccessful() + + assertEquals( + setOf( + fileInWorkingDir("build/tmp/kapt3/stubs/main/bar/WithAnnotation.java").canonicalPath, + fileInWorkingDir("build/tmp/kapt3/stubs/main/bar/noAnnotations.java").canonicalPath, + fileInWorkingDir("build/tmp/kapt3/stubs/main/error/NonExistentClass.java").canonicalPath + ), getProcessedSources(output) + ) + + checkAggregatingResource { lines -> + assertEquals(1, lines.size) + assertTrue(lines.contains("WithAnnotationGenerated")) + } + } + + //change file without annotations + project.projectFile("noAnnotations.kt").modify { current -> "$current\nfun otherFunction() {}" } + + project.build("build", options = buildOptions) { + assertSuccessful() + + assertEquals( + setOf( + fileInWorkingDir("build/tmp/kapt3/stubs/main/bar/NoAnnotationsKt.java").canonicalPath, + fileInWorkingDir("build/tmp/kapt3/stubs/main/error/NonExistentClass.java").canonicalPath + ), getProcessedSources(output) + ) + + checkAggregatingResource { lines -> + assertEquals(1, lines.size) + assertTrue(lines.contains("WithAnnotationGenerated")) + } + } + + //add new file with annotations + val newFile = File(project.projectDir, "src/main/java/baz/BazClass.kt") + newFile.parentFile.mkdirs() + newFile.createNewFile() + project.projectFile("BazClass.kt").modify { + """ + package baz + + @example.ExampleAnnotation + class BazClass() {} + """.trimIndent() + } + project.build("build", options = buildOptions) { + assertSuccessful() + assertEquals( + setOf( + fileInWorkingDir("build/tmp/kapt3/stubs/main/baz/BazClass.java").canonicalPath, + fileInWorkingDir("build/tmp/kapt3/stubs/main/error/NonExistentClass.java").canonicalPath + ), + getProcessedSources(output) + ) + + checkAggregatingResource { lines -> + assertEquals(2, lines.size) + assertTrue(lines.contains("WithAnnotationGenerated")) + assertTrue(lines.contains("BazClassGenerated")) + } + } + + //move annotation to nested class + project.projectFile("BazClass.kt").modify { + """ + package baz + + class BazClass() { + @example.ExampleAnnotation + class BazNested {} + } + """.trimIndent() + } + project.build("build", options = buildOptions) { + assertSuccessful() + assertEquals( + setOf( + fileInWorkingDir("build/tmp/kapt3/stubs/main/baz/BazClass.java").canonicalPath, + fileInWorkingDir("build/tmp/kapt3/stubs/main/error/NonExistentClass.java").canonicalPath + ), + getProcessedSources(output) + ) + + checkAggregatingResource { lines -> + assertEquals(2, lines.size) + assertTrue(lines.contains("WithAnnotationGenerated")) + assertTrue(lines.contains("BazNestedGenerated")) + } + } + + //change file without annotations to check that nested class is aggregated + project.projectFile("noAnnotations.kt").modify { current -> "$current\nfun otherFunction2() {}" } + + project.build("build", options = buildOptions) { + assertSuccessful() + + assertEquals( + setOf( + fileInWorkingDir("build/tmp/kapt3/stubs/main/bar/NoAnnotationsKt.java").canonicalPath, + fileInWorkingDir("build/tmp/kapt3/stubs/main/error/NonExistentClass.java").canonicalPath + ), getProcessedSources(output) + ) + + checkAggregatingResource { lines -> + assertEquals(2, lines.size) + assertTrue(lines.contains("WithAnnotationGenerated")) + assertTrue(lines.contains("BazNestedGenerated")) + } + } + } + } \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt index 386c15a1fde..71e9ec7c981 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt @@ -201,10 +201,21 @@ fun getProcessedSources(output: String): Set { return logging.drop(indexOf).split(",").map { it.trim() }.filter { !it.isEmpty() }.toSet() } -fun BaseGradleIT.Project.setupIncrementalAptProject(procType: String, buildFile: File = projectDir.resolve("build.gradle")) { +fun BaseGradleIT.Project.setupIncrementalAptProject( + procType: String, + buildFile: File = projectDir.resolve("build.gradle"), + procClass: Class<*> = IncrementalProcessor::class.java +) { + setupIncrementalAptProject(procType to procClass, buildFile = buildFile) +} + +fun BaseGradleIT.Project.setupIncrementalAptProject( + vararg processors: Pair>, + buildFile: File = projectDir.resolve("build.gradle") +) { setupWorkingDir() val content = buildFile.readText() - val processorPath = generateProcessor(procType) + val processorPath = generateProcessor(*processors) val updatedContent = content.replace( Regex("^\\s*kapt\\s\"org\\.jetbrain.*$", RegexOption.MULTILINE), @@ -213,20 +224,27 @@ fun BaseGradleIT.Project.setupIncrementalAptProject(procType: String, buildFile: buildFile.writeText(updatedContent) } -fun BaseGradleIT.Project.generateProcessor(procType: String): File { +fun BaseGradleIT.Project.generateProcessor(vararg processors: Pair>): File { val processorPath = projectDir.resolve("incrementalProcessor.jar") ZipOutputStream(processorPath.outputStream()).use { - val path = IncrementalProcessor::class.java.name.replace(".", "/") + ".class" - val inputStream = IncrementalProcessor::class.java.classLoader.getResourceAsStream(path) - it.putNextEntry(ZipEntry(path)) - it.write(inputStream.readBytes()) - it.closeEntry() + for ((_, procClass) in processors) { + val path = procClass.name.replace(".", "/") + ".class" + procClass.classLoader.getResourceAsStream(path).use { inputStream -> + it.putNextEntry(ZipEntry(path)) + it.write(inputStream.readBytes()) + it.closeEntry() + } + } it.putNextEntry(ZipEntry("META-INF/gradle/incremental.annotation.processors")) - it.write("${IncrementalProcessor::class.java.name},$procType".toByteArray()) + it.write(processors.joinToString("\n") { (procType, procClass) -> + "${procClass.name},$procType" + }.toByteArray()) it.closeEntry() it.putNextEntry(ZipEntry("META-INF/services/javax.annotation.processing.Processor")) - it.write(IncrementalProcessor::class.java.name.toByteArray()) + it.write(processors.joinToString("\n") { (_, procClass) -> + procClass.name + }.toByteArray()) it.closeEntry() } return processorPath diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalAggregatingProcessorProject/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalAggregatingProcessorProject/build.gradle new file mode 100644 index 00000000000..dd8fa25bfdc --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalAggregatingProcessorProject/build.gradle @@ -0,0 +1,26 @@ +buildscript { + repositories { + mavenLocal() + jcenter() + } + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +apply plugin: "java" +apply plugin: "kotlin" +apply plugin: "kotlin-kapt" + +repositories { + jcenter() + mavenLocal() +} + +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version" + kapt "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version" + kapt "org.ow2.asm:asm:9.0" + testImplementation 'junit:junit:4.12' +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalAggregatingProcessorProject/src/main/java/bar/noAnnotations.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalAggregatingProcessorProject/src/main/java/bar/noAnnotations.kt new file mode 100644 index 00000000000..b3801111e6d --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalAggregatingProcessorProject/src/main/java/bar/noAnnotations.kt @@ -0,0 +1,7 @@ +package bar + +class noAnnotations { + val valB = "text" + + fun funB() {} +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalAggregatingProcessorProject/src/main/java/bar/withAnnotation.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalAggregatingProcessorProject/src/main/java/bar/withAnnotation.kt new file mode 100644 index 00000000000..b42ba0f4244 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalAggregatingProcessorProject/src/main/java/bar/withAnnotation.kt @@ -0,0 +1,4 @@ +package bar + +@example.ExampleAnnotation +class WithAnnotation() {} \ No newline at end of file diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/Kapt.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/Kapt.kt index 5e407f2ae3f..35732bf20a2 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/Kapt.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/Kapt.kt @@ -42,7 +42,11 @@ object Kapt { val processors = processorLoader.loadProcessors(findClassLoaderWithJavac()) val annotationProcessingTime = measureTimeMillis { - kaptContext.doAnnotationProcessing(javaSourceFiles, processors.processors) + kaptContext.doAnnotationProcessing( + javaSourceFiles, + processors.processors, + aggregatedTypes = collectAggregatedTypes(kaptContext.sourcesToReprocess) + ) } logger.info { "Annotation processing took $annotationProcessingTime ms" } diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/KaptContext.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/KaptContext.kt index 4a40c2a4741..5f06b01a622 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/KaptContext.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/KaptContext.kt @@ -111,7 +111,7 @@ open class KaptContext(val options: KaptOptions, val withJdk: Boolean, val logge val compileClasspath = if (sourcesToReprocess is SourcesToReprocess.FullRebuild) { options.compileClasspath } else { - options.compileClasspath + options.compiledSources + options.compileClasspath + options.compiledSources + options.classesOutputDir } putJavacOption("CLASSPATH", "CLASS_PATH", diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/KaptOptions.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/KaptOptions.kt index 5f3d8914e02..c8cf29e70c5 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/KaptOptions.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/KaptOptions.kt @@ -168,6 +168,15 @@ fun KaptOptions.collectJavaSourceFiles(sourcesToReprocess: SourcesToReprocess = } } +fun collectAggregatedTypes(sourcesToReprocess: SourcesToReprocess = SourcesToReprocess.FullRebuild): List { + return when (sourcesToReprocess) { + is SourcesToReprocess.FullRebuild -> emptyList() + is SourcesToReprocess.Incremental -> { + sourcesToReprocess.unchangedAggregatedTypes + } + } +} + fun KaptOptions.logString(additionalInfo: String = "") = buildString { val additionalInfoRendered = if (additionalInfo.isEmpty()) "" else " ($additionalInfo)" appendLine("Kapt3 is enabled$additionalInfoRendered.") diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/annotationProcessing.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/annotationProcessing.kt index 9f8b4c35dd3..1919bb94ca1 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/annotationProcessing.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/annotationProcessing.kt @@ -31,7 +31,8 @@ import com.sun.tools.javac.util.List as JavacList fun KaptContext.doAnnotationProcessing( javaSourceFiles: List, processors: List, - additionalSources: JavacList = JavacList.nil() + additionalSources: JavacList = JavacList.nil(), + aggregatedTypes: List = emptyList() ) { val processingEnvironment = JavacProcessingEnvironment.instance(context) @@ -70,12 +71,14 @@ fun KaptContext.doAnnotationProcessing( GeneratedTypesTaskListener(cacheManager!!.javaCache) }?.also { compiler.getTaskListeners().add(it) } + val additionalClassNames = JavacList.from(aggregatedTypes) if (isJava9OrLater()) { - val processAnnotationsMethod = compiler.javaClass.getMethod("processAnnotations", JavacList::class.java) - processAnnotationsMethod.invoke(compiler, analyzedFiles) + val processAnnotationsMethod = + compiler.javaClass.getMethod("processAnnotations", JavacList::class.java, java.util.Collection::class.java) + processAnnotationsMethod.invoke(compiler, analyzedFiles, additionalClassNames) compiler } else { - compiler.processAnnotations(analyzedFiles).also { + compiler.processAnnotations(analyzedFiles, additionalClassNames).also { generatedSourcesListener?.let { compiler.getTaskListeners().remove(it) } } } @@ -156,7 +159,7 @@ private class ProcessorWrapper(private val delegate: IncrementalProcessor) : Pro private var initTime: Long = 0 private val roundTime = mutableListOf() - override fun process(annotations: MutableSet?, roundEnv: RoundEnvironment?): Boolean { + override fun process(annotations: MutableSet, roundEnv: RoundEnvironment): Boolean { val (time, result) = measureTimeMillisWithResult { delegate.process(annotations, roundEnv) } diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/IncrementalAptCache.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/IncrementalAptCache.kt index ae2cf1dab15..30d20bb0242 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/IncrementalAptCache.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/IncrementalAptCache.kt @@ -11,6 +11,7 @@ import java.io.Serializable class IncrementalAptCache : Serializable { private val aggregatingGenerated: MutableSet = mutableSetOf() + private val aggregatedTypes: MutableSet = linkedSetOf() private val isolatingMapping: MutableMap = mutableMapOf() // Annotations claimed by aggregating annotation processors private val aggregatingClaimedAnnotations: MutableSet = mutableSetOf() @@ -41,6 +42,9 @@ class IncrementalAptCache : Serializable { aggregatingClaimedAnnotations.clear() aggregatingClaimedAnnotations.addAll(aggregating.flatMap { it.supportedAnnotationTypes }) + aggregatedTypes.clear() + aggregatedTypes.addAll(aggregating.flatMap { it.getAggregatedTypes() }) + for (isolatingProcessor in isolating) { isolatingProcessor.getGeneratedToSources().forEach { isolatingMapping[it.key] = it.value!! @@ -52,12 +56,15 @@ class IncrementalAptCache : Serializable { fun getAggregatingClaimedAnnotations(): Set = aggregatingClaimedAnnotations /** Returns generated Java sources originating from aggregating APs. */ - fun invalidateAggregating(): List { + fun invalidateAggregating(): Pair, List> { val dirtyAggregating = aggregatingGenerated.filter { it.extension == "java" } aggregatingGenerated.forEach { it.delete() } aggregatingGenerated.clear() - return dirtyAggregating + val dirtyAggregated = ArrayList(aggregatedTypes) + aggregatedTypes.clear() + + return dirtyAggregating to dirtyAggregated } /** Returns generated Java sources originating from the specified sources, and generated by isloating APs. */ diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/cache.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/cache.kt index ce2d1e999b8..29ede6d3ede 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/cache.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/cache.kt @@ -48,10 +48,11 @@ class JavaClassCacheManager(val file: File) : Closeable { val isolatingGenerated = aptCache.invalidateIsolatingGenerated(toReprocess) val generatedDirtyTypes = javaCache.invalidateGeneratedTypes(isolatingGenerated).toMutableSet() - + val aggregatedTypes = mutableListOf() if (!toReprocess.isEmpty()) { // only if there are some files to reprocess we should invalidate the aggregating ones - val aggregatingGenerated = aptCache.invalidateAggregating() + val (aggregatingGenerated, aggregatedTypes1) = aptCache.invalidateAggregating() + aggregatedTypes.addAll(aggregatedTypes1) generatedDirtyTypes.addAll(javaCache.invalidateGeneratedTypes(aggregatingGenerated)) toReprocess.addAll( @@ -59,7 +60,13 @@ class JavaClassCacheManager(val file: File) : Closeable { ) } - SourcesToReprocess.Incremental(toReprocess.toList(), generatedDirtyTypes) + SourcesToReprocess.Incremental( + toReprocess.toList(), + generatedDirtyTypes, + aggregatedTypes.also { + it.removeAll(filesToReprocess.dirtyTypes) + it.removeAll(generatedDirtyTypes) + }) } } } @@ -118,6 +125,11 @@ class JavaClassCacheManager(val file: File) : Closeable { } sealed class SourcesToReprocess { - class Incremental(val toReprocess: List, val dirtyTypes: Set) : SourcesToReprocess() + class Incremental( + val toReprocess: List, + val dirtyTypes: Set, + val unchangedAggregatedTypes: List + ) : SourcesToReprocess() + object FullRebuild : SourcesToReprocess() } \ No newline at end of file diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/classStructureCache.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/classStructureCache.kt index 374db2302af..997fc5398bf 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/classStructureCache.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/classStructureCache.kt @@ -139,7 +139,7 @@ class JavaClassCache() : Serializable { currentDirtyFiles = nextRound.filter { !allDirtyFiles.contains(it) }.toMutableSet() } - return SourcesToReprocess.Incremental(allDirtyFiles.map { File(it) }, allDirtyTypes) + return SourcesToReprocess.Incremental(allDirtyFiles.map { File(it) }, allDirtyTypes, emptyList()) } /** diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/incrementalProcessors.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/incrementalProcessors.kt index d65ca61aa7d..9cba352db3a 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/incrementalProcessors.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/incrementalProcessors.kt @@ -12,8 +12,10 @@ import java.net.URI import javax.annotation.processing.Filer import javax.annotation.processing.ProcessingEnvironment import javax.annotation.processing.Processor +import javax.annotation.processing.RoundEnvironment import javax.lang.model.element.Element import javax.lang.model.element.PackageElement +import javax.lang.model.element.TypeElement import javax.tools.FileObject import javax.tools.JavaFileManager import javax.tools.JavaFileObject @@ -69,7 +71,16 @@ class IncrementalProcessor(private val processor: Processor, private val kind: D fun isUnableToRunIncrementally() = !kind.canRunIncrementally fun getGeneratedToSources() = dependencyCollector.value.getGeneratedToSources() + fun getAggregatedTypes() = dependencyCollector.value.getAggregatedTypes() fun getRuntimeType(): RuntimeProcType = dependencyCollector.value.getRuntimeType() + + + override fun process(annotations: Set, roundEnv: RoundEnvironment): Boolean { + if (getRuntimeType() == RuntimeProcType.AGGREGATING) { + dependencyCollector.value.recordProcessingInputs(processor.supportedAnnotationTypes, annotations, roundEnv) + } + return processor.process(annotations, roundEnv) + } } internal class IncrementalProcessingEnvironment(private val processingEnv: ProcessingEnvironment, private val incFiler: IncrementalFiler) : @@ -111,9 +122,29 @@ internal class AnnotationProcessorDependencyCollector( private val warningCollector: (String) -> Unit ) { private val generatedToSource = mutableMapOf() + private val aggregatedTypes = mutableSetOf() + private var isFullRebuild = !runtimeProcType.isIncremental - internal fun add(createdFile: URI, originatingElements: Array) { + internal fun recordProcessingInputs(supportedAnnotationTypes: Set, annotations: Set, roundEnv: RoundEnvironment) { + if (isFullRebuild) return + + if (supportedAnnotationTypes.contains("*")) { + aggregatedTypes.addAll(getTopLevelClassNames(roundEnv.rootElements?.filterNotNull() ?: emptyList())) + } else { + for (annotation in annotations) { + aggregatedTypes.addAll( + getTopLevelClassNames( + roundEnv.getElementsAnnotatedWith( + annotation + )?.filterNotNull() ?: emptyList() + ) + ) + } + } + } + + internal fun add(createdFile: URI, originatingElements: Array, classId: String?) { if (isFullRebuild) return val generatedFile = File(createdFile) @@ -134,6 +165,9 @@ internal class AnnotationProcessorDependencyCollector( } internal fun getGeneratedToSources(): Map = if (isFullRebuild) emptyMap() else generatedToSource + + internal fun getAggregatedTypes(): Set = if (isFullRebuild) emptySet() else aggregatedTypes + internal fun getRuntimeType(): RuntimeProcType { return if (isFullRebuild) { RuntimeProcType.NON_INCREMENTAL @@ -154,6 +188,33 @@ private fun getSrcFiles(elements: Array): Set { }.toSet() } +private const val PACKAGE_TYPE_NAME = "package-info" + +fun getElementName(current: Element?): String? { + if (current is PackageElement) { + val packageName = current.qualifiedName.toString() + return if (packageName.isEmpty()) { + PACKAGE_TYPE_NAME + } else { + "$packageName.$PACKAGE_TYPE_NAME" + } + } + if (current is TypeElement) { + return current.qualifiedName.toString() + } + return null +} + +private fun getTopLevelClassNames(elements: Collection): Collection { + return elements.mapNotNull { elem -> + var origin = elem + while (origin.enclosingElement != null && origin.enclosingElement !is PackageElement) { + origin = origin.enclosingElement + } + getElementName(origin) + } +} + enum class DeclaredProcType(val canRunIncrementally: Boolean) { AGGREGATING(true) { override fun toRuntimeType() = RuntimeProcType.AGGREGATING From 42a9d64578aabf1a6c5453a645c5f88dc43035aa Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Tue, 17 Nov 2020 08:23:34 +0100 Subject: [PATCH 086/698] Track binary output class names --- .../build.gradle.kts | 1 + .../base/incremental/IncrementalAptCache.kt | 32 ++++++++++++------- .../kotlin/kapt3/base/incremental/cache.kt | 6 ++-- .../base/incremental/incrementalProcessors.kt | 24 ++++++++------ ...otationProcessorDependencyCollectorTest.kt | 8 ++--- 5 files changed, 45 insertions(+), 26 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle.kts b/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle.kts index 40087aa8d88..545746fd04b 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle.kts +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle.kts @@ -45,6 +45,7 @@ dependencies { // Workaround for missing transitive import of the common(project `kotlin-test-common` // for `kotlin-test-jvm` into the IDE: testCompileOnly(project(":kotlin-test:kotlin-test-common")) { isTransitive = false } + testCompileOnly("org.ow2.asm:asm:9.0") } // Aapt2 from Android Gradle Plugin 3.2 and below does not handle long paths on Windows. diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/IncrementalAptCache.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/IncrementalAptCache.kt index 30d20bb0242..be6f5fc7249 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/IncrementalAptCache.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/IncrementalAptCache.kt @@ -10,9 +10,9 @@ import java.io.Serializable class IncrementalAptCache : Serializable { - private val aggregatingGenerated: MutableSet = mutableSetOf() + private val aggregatingGenerated: MutableMap = mutableMapOf() private val aggregatedTypes: MutableSet = linkedSetOf() - private val isolatingMapping: MutableMap = mutableMapOf() + private val isolatingMapping: MutableMap> = mutableMapOf() // Annotations claimed by aggregating annotation processors private val aggregatingClaimedAnnotations: MutableSet = mutableSetOf() @@ -37,7 +37,11 @@ class IncrementalAptCache : Serializable { } aggregatingGenerated.clear() - aggregatingGenerated.addAll(aggregating.flatMap { it.getGeneratedToSources().keys }) + aggregating.forEach { + it.getGeneratedToSourcesAll().mapValuesTo(aggregatingGenerated) { (_, value) -> + value?.first + } + } aggregatingClaimedAnnotations.clear() aggregatingClaimedAnnotations.addAll(aggregating.flatMap { it.supportedAnnotationTypes }) @@ -46,8 +50,8 @@ class IncrementalAptCache : Serializable { aggregatedTypes.addAll(aggregating.flatMap { it.getAggregatedTypes() }) for (isolatingProcessor in isolating) { - isolatingProcessor.getGeneratedToSources().forEach { - isolatingMapping[it.key] = it.value!! + isolatingProcessor.getGeneratedToSourcesAll().forEach { + isolatingMapping[it.key] = it.value!!.first to it.value!!.second!! } } return true @@ -57,8 +61,8 @@ class IncrementalAptCache : Serializable { /** Returns generated Java sources originating from aggregating APs. */ fun invalidateAggregating(): Pair, List> { - val dirtyAggregating = aggregatingGenerated.filter { it.extension == "java" } - aggregatingGenerated.forEach { it.delete() } + val dirtyAggregating = aggregatingGenerated.keys.filter { it.isJavaFileOrClass() } + aggregatingGenerated.forEach { it.key.delete() } aggregatingGenerated.clear() val dirtyAggregated = ArrayList(aggregatedTypes) @@ -68,24 +72,30 @@ class IncrementalAptCache : Serializable { } /** Returns generated Java sources originating from the specified sources, and generated by isloating APs. */ - fun invalidateIsolatingGenerated(fromSources: Set): List { + fun invalidateIsolatingGenerated(fromSources: Set): Pair, Set> { val allInvalidated = mutableListOf() + val invalidatedClassIds = mutableSetOf() var changedSources = fromSources.toSet() // We need to do it in a loop because mapping could be: [AGenerated.java -> A.java, AGeneratedGenerated.java -> AGenerated.java] while (changedSources.isNotEmpty()) { - val generated = isolatingMapping.filter { changedSources.contains(it.value) }.keys + val generated = isolatingMapping.filter { changedSources.contains(it.value.second) }.keys generated.forEach { - if (it.extension == "java") allInvalidated.add(it) + if (it.isJavaFileOrClass()) { + allInvalidated.add(it) + isolatingMapping[it]?.first?.let { invalidatedClassIds.add(it) } + } it.delete() isolatingMapping.remove(it) } changedSources = generated } - return allInvalidated + return allInvalidated to invalidatedClassIds } + private fun File.isJavaFileOrClass() = extension == "java" || extension == "class" + private fun invalidateCache() { isIncremental = false aggregatingGenerated.clear() diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/cache.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/cache.kt index 29ede6d3ede..25f615725ba 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/cache.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/cache.kt @@ -46,8 +46,9 @@ class JavaClassCacheManager(val file: File) : Closeable { is SourcesToReprocess.Incremental -> { val toReprocess = filesToReprocess.toReprocess.toMutableSet() - val isolatingGenerated = aptCache.invalidateIsolatingGenerated(toReprocess) - val generatedDirtyTypes = javaCache.invalidateGeneratedTypes(isolatingGenerated).toMutableSet() + val (invalidatedIsolatingGenerated, invalidatedIsolatingId) = aptCache.invalidateIsolatingGenerated(toReprocess) + val generatedDirtyTypes = javaCache.invalidateGeneratedTypes(invalidatedIsolatingGenerated).toMutableSet() /*+*/ + val aggregatedTypes = mutableListOf() if (!toReprocess.isEmpty()) { // only if there are some files to reprocess we should invalidate the aggregating ones @@ -66,6 +67,7 @@ class JavaClassCacheManager(val file: File) : Closeable { aggregatedTypes.also { it.removeAll(filesToReprocess.dirtyTypes) it.removeAll(generatedDirtyTypes) + it.removeAll(invalidatedIsolatingId) }) } } diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/incrementalProcessors.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/incrementalProcessors.kt index 9cba352db3a..ae2c4361272 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/incrementalProcessors.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/incrementalProcessors.kt @@ -71,6 +71,7 @@ class IncrementalProcessor(private val processor: Processor, private val kind: D fun isUnableToRunIncrementally() = !kind.canRunIncrementally fun getGeneratedToSources() = dependencyCollector.value.getGeneratedToSources() + fun getGeneratedToSourcesAll() = dependencyCollector.value.getGeneratedToSourcesAll() fun getAggregatedTypes() = dependencyCollector.value.getAggregatedTypes() fun getRuntimeType(): RuntimeProcType = dependencyCollector.value.getRuntimeType() @@ -92,15 +93,15 @@ internal class IncrementalFiler(private val filer: Filer) : Filer by filer { internal var dependencyCollector: AnnotationProcessorDependencyCollector? = null - override fun createSourceFile(name: CharSequence?, vararg originatingElements: Element?): JavaFileObject { + override fun createSourceFile(name: CharSequence, vararg originatingElements: Element?): JavaFileObject { val createdSourceFile = filer.createSourceFile(name, *originatingElements) - dependencyCollector!!.add(createdSourceFile.toUri(), originatingElements) + dependencyCollector!!.add(createdSourceFile.toUri(), originatingElements, name.toString()) return createdSourceFile } - override fun createClassFile(name: CharSequence?, vararg originatingElements: Element?): JavaFileObject { + override fun createClassFile(name: CharSequence, vararg originatingElements: Element?): JavaFileObject { val createdClassFile = filer.createClassFile(name, *originatingElements) - dependencyCollector!!.add(createdClassFile.toUri(), originatingElements) + dependencyCollector!!.add(createdClassFile.toUri(), originatingElements, name.toString()) return createdClassFile } @@ -111,7 +112,7 @@ internal class IncrementalFiler(private val filer: Filer) : Filer by filer { vararg originatingElements: Element? ): FileObject { val createdResource = filer.createResource(location, pkg, relativeName, *originatingElements) - dependencyCollector!!.add(createdResource.toUri(), originatingElements) + dependencyCollector!!.add(createdResource.toUri(), originatingElements, null) return createdResource } @@ -121,7 +122,7 @@ internal class AnnotationProcessorDependencyCollector( private val runtimeProcType: RuntimeProcType, private val warningCollector: (String) -> Unit ) { - private val generatedToSource = mutableMapOf() + private val generatedToSource = mutableMapOf?>() private val aggregatedTypes = mutableSetOf() private var isFullRebuild = !runtimeProcType.isIncremental @@ -149,7 +150,7 @@ internal class AnnotationProcessorDependencyCollector( val generatedFile = File(createdFile) if (runtimeProcType == RuntimeProcType.AGGREGATING) { - generatedToSource[generatedFile] = null + generatedToSource[generatedFile] = classId to null } else { val srcFiles = getSrcFiles(originatingElements) if (srcFiles.size != 1) { @@ -159,12 +160,17 @@ internal class AnnotationProcessorDependencyCollector( "but detected ${srcFiles.size}: [${srcFiles.joinToString()}]." ) } else { - generatedToSource[generatedFile] = srcFiles.single() + generatedToSource[generatedFile] = classId to srcFiles.single() } } } - internal fun getGeneratedToSources(): Map = if (isFullRebuild) emptyMap() else generatedToSource + internal fun getGeneratedToSources(): Map = if (isFullRebuild) emptyMap() else generatedToSource.mapValues { (_, value) -> + value?.second + } + + internal fun getGeneratedToSourcesAll(): Map?> = + if (isFullRebuild) emptyMap() else generatedToSource internal fun getAggregatedTypes(): Set = if (isFullRebuild) emptySet() else aggregatedTypes diff --git a/plugins/kapt3/kapt3-base/test/org/jetbrains/kotlin/kapt3/base/incremental/AnnotationProcessorDependencyCollectorTest.kt b/plugins/kapt3/kapt3-base/test/org/jetbrains/kotlin/kapt3/base/incremental/AnnotationProcessorDependencyCollectorTest.kt index 9838eb95cb8..c714444746e 100644 --- a/plugins/kapt3/kapt3-base/test/org/jetbrains/kotlin/kapt3/base/incremental/AnnotationProcessorDependencyCollectorTest.kt +++ b/plugins/kapt3/kapt3-base/test/org/jetbrains/kotlin/kapt3/base/incremental/AnnotationProcessorDependencyCollectorTest.kt @@ -17,7 +17,7 @@ class AnnotationProcessorDependencyCollectorTest { fun testAggregating() { val aggregating = AnnotationProcessorDependencyCollector(RuntimeProcType.AGGREGATING) {} val generated = listOf("GeneratedA.java", "GeneratedB.java", "GeneratedC.java").map { File(it).toURI() } - generated.forEach { aggregating.add(it, emptyArray()) } + generated.forEach { aggregating.add(it, emptyArray(), null) } assertEquals(aggregating.getGeneratedToSources(), generated.map { File(it) to null }.toMap()) assertEquals(aggregating.getRuntimeType(), RuntimeProcType.AGGREGATING) @@ -27,7 +27,7 @@ class AnnotationProcessorDependencyCollectorTest { fun testIsolatingWithoutOrigin() { val warnings = mutableListOf() val isolating = AnnotationProcessorDependencyCollector(RuntimeProcType.ISOLATING) { s -> warnings.add(s) } - isolating.add(File("GeneratedA.java").toURI(), emptyArray()) + isolating.add(File("GeneratedA.java").toURI(), emptyArray(), null) assertEquals(isolating.getRuntimeType(), RuntimeProcType.NON_INCREMENTAL) assertEquals(isolating.getGeneratedToSources(), emptyMap()) @@ -37,8 +37,8 @@ class AnnotationProcessorDependencyCollectorTest { @Test fun testNonIncremental() { val nonIncremental = AnnotationProcessorDependencyCollector(RuntimeProcType.NON_INCREMENTAL) {} - nonIncremental.add(File("GeneratedA.java").toURI(), emptyArray()) - nonIncremental.add(File("GeneratedB.java").toURI(), emptyArray()) + nonIncremental.add(File("GeneratedA.java").toURI(), emptyArray(), null) + nonIncremental.add(File("GeneratedB.java").toURI(), emptyArray(), null) assertEquals(nonIncremental.getRuntimeType(), RuntimeProcType.NON_INCREMENTAL) assertEquals(nonIncremental.getGeneratedToSources(), emptyMap()) From 5efefabb93b8d992ec816b800a36637206483a66 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Mon, 23 Nov 2020 19:01:06 +0300 Subject: [PATCH 087/698] [JS IR] webpackConfigAppliers as internal to not break Gradle lambda serialization in some cases [JS IR] Add synthetic config and webpack config is nested object ^KT-43535 fixed --- .../gradle/targets/js/ir/KotlinBrowserJsIr.kt | 4 +- .../targets/js/subtargets/KotlinBrowserJs.kt | 4 +- .../targets/js/webpack/KotlinWebpack.kt | 11 +++- .../targets/js/webpack/KotlinWebpackConfig.kt | 51 +++++++++++++++++++ 4 files changed, 64 insertions(+), 6 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/KotlinBrowserJsIr.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/KotlinBrowserJsIr.kt index 14ab7410bc5..aec12430919 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/KotlinBrowserJsIr.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/KotlinBrowserJsIr.kt @@ -45,10 +45,10 @@ open class KotlinBrowserJsIr @Inject constructor(target: KotlinJsIrTarget) : override fun commonWebpackConfig(body: KotlinWebpackConfig.() -> Unit) { webpackTaskConfigurations.add { - webpackConfigAppliers.add(body) + webpackConfigApplier(body) } runTaskConfigurations.add { - webpackConfigAppliers.add(body) + webpackConfigApplier(body) } testTask { onTestFrameworkSet { diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/subtargets/KotlinBrowserJs.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/subtargets/KotlinBrowserJs.kt index a7ee7bdd72b..34dff65c12b 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/subtargets/KotlinBrowserJs.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/subtargets/KotlinBrowserJs.kt @@ -51,10 +51,10 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) : override fun commonWebpackConfig(body: KotlinWebpackConfig.() -> Unit) { webpackTaskConfigurations.add { - webpackConfigAppliers.add(body) + webpackConfigApplier(body) } runTaskConfigurations.add { - webpackConfigAppliers.add(body) + webpackConfigApplier(body) } testTask { onTestFrameworkSet { diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/webpack/KotlinWebpack.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/webpack/KotlinWebpack.kt index c1873812c58..1184549834d 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/webpack/KotlinWebpack.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/webpack/KotlinWebpack.kt @@ -185,8 +185,15 @@ constructor( @Internal var generateConfigOnly: Boolean = false - @Input - val webpackConfigAppliers: MutableList<(KotlinWebpackConfig) -> Unit> = + @Nested + val synthConfig = KotlinWebpackConfig() + + fun webpackConfigApplier(body: KotlinWebpackConfig.() -> Unit) { + synthConfig.body() + webpackConfigAppliers.add(body) + } + + private val webpackConfigAppliers: MutableList<(KotlinWebpackConfig) -> Unit> = mutableListOf() private fun createRunner(): KotlinWebpackRunner { diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/webpack/KotlinWebpackConfig.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/webpack/KotlinWebpackConfig.kt index ed4a71f12af..48c41520c7e 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/webpack/KotlinWebpackConfig.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/webpack/KotlinWebpackConfig.kt @@ -8,6 +8,10 @@ package org.jetbrains.kotlin.gradle.targets.js.webpack import com.google.gson.GsonBuilder +import org.gradle.api.tasks.Input +import org.gradle.api.tasks.Internal +import org.gradle.api.tasks.Nested +import org.gradle.api.tasks.Optional import org.jetbrains.kotlin.gradle.targets.js.NpmVersions import org.jetbrains.kotlin.gradle.targets.js.RequiredKotlinJsDependency import org.jetbrains.kotlin.gradle.targets.js.appendConfigsFromDir @@ -21,24 +25,71 @@ import java.io.StringWriter @Suppress("MemberVisibilityCanBePrivate") data class KotlinWebpackConfig( + @Input var mode: Mode = Mode.DEVELOPMENT, + @Internal var entry: File? = null, + @Nested + @Optional var output: KotlinWebpackOutput? = null, + @Internal var outputPath: File? = null, + @Input + @Optional var outputFileName: String? = entry?.name, + @Internal var configDirectory: File? = null, + @Internal var bundleAnalyzerReportDir: File? = null, + @Internal var reportEvaluatedConfigFile: File? = null, + @Input + @Optional var devServer: DevServer? = null, + @Nested var cssSupport: KotlinWebpackCssSupport = KotlinWebpackCssSupport(), + @Input + @Optional var devtool: String? = WebpackDevtool.EVAL_SOURCE_MAP, + @Input var showProgress: Boolean = false, + @Input var sourceMaps: Boolean = false, + @Input var export: Boolean = true, + @Input var progressReporter: Boolean = false, + @Input + @Optional var progressReporterPathFilter: String? = null, + @Input var resolveFromModulesFirst: Boolean = false ) { + @get:Input + @get:Optional + val entryInput: String? + get() = entry?.absoluteFile?.normalize()?.absolutePath + + @get:Input + @get:Optional + val outputPathInput: String? + get() = outputPath?.absoluteFile?.normalize()?.absolutePath + + @get:Input + @get:Optional + val configDirectoryInput: String? + get() = configDirectory?.absoluteFile?.normalize()?.absolutePath + + @get:Input + @get:Optional + val bundleAnalyzerReportDirInput: String? + get() = bundleAnalyzerReportDir?.absoluteFile?.normalize()?.absolutePath + + @get:Input + @get:Optional + val reportEvaluatedConfigFileInput: String? + get() = reportEvaluatedConfigFile?.absoluteFile?.normalize()?.absolutePath + fun getRequiredDependencies(versions: NpmVersions) = mutableSetOf().also { it.add(versions.kotlinJsTestRunner) From b1c355e7eb9731037a8d76718eaca56d1212ecdd Mon Sep 17 00:00:00 2001 From: Leonid Startsev Date: Mon, 16 Nov 2020 23:08:14 +0300 Subject: [PATCH 088/698] Directly search in IrClass for declarations to fill bodies with plugin because some other compiler plugins (Compose) copy/rewrite IR declarations completely, and in the end, functions that are present in the final IR tree do not have bodies. Correctly create IrProperty and IrField when they were absent from the descriptors (in case for private serializer properties) Do not use symbol table because 'declare' API is not available in plugins. Fixes https://github.com/JetBrains/compose-jb/issues/46 --- .../jetbrains/kotlin/ir/util/SymbolTable.kt | 15 +--- .../backend/common/SerializerCodegen.kt | 6 +- .../compiler/backend/ir/GeneratorHelpers.kt | 89 +++++++++---------- .../ir/SerialInfoImplJvmIrGenerator.kt | 2 +- .../backend/ir/SerializerIrGenerator.kt | 14 +-- 5 files changed, 56 insertions(+), 70 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt index 510a5b7d7bb..3210fcee44e 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt @@ -1,17 +1,6 @@ /* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.ir.util diff --git a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/common/SerializerCodegen.kt b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/common/SerializerCodegen.kt index 53ba437fb65..573d30f213c 100644 --- a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/common/SerializerCodegen.kt +++ b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/common/SerializerCodegen.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlinx.serialization.compiler.backend.common import org.jetbrains.kotlin.backend.common.CodegenUtil.getMemberToGenerate import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.incremental.components.NoLookupLocation +import org.jetbrains.kotlin.ir.declarations.IrProperty import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlinx.serialization.compiler.extensions.SerializationDescriptorSerializerPlugin @@ -69,12 +70,13 @@ abstract class SerializerCodegen( serializerDescriptor::checkSerializableClassPropertyResult ) { true } - val localSerializersFieldsDescriptors: List = findLocalSerializersFieldDescriptors() + lateinit var localSerializersFieldsDescriptors: List> + protected set // Can be false if user specified inheritance from KSerializer explicitly protected val isGeneratedSerializer = serializerDescriptor.typeConstructor.supertypes.any(::isGeneratedKSerializer) - private fun findLocalSerializersFieldDescriptors(): List { + protected fun findLocalSerializersFieldDescriptors(): List { val count = serializableDescriptor.declaredTypeParameters.size if (count == 0) return emptyList() val propNames = (0 until count).map { "${SerialEntityNames.typeArgPrefix}$it" } diff --git a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/GeneratorHelpers.kt b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/GeneratorHelpers.kt index d4c9f558c5d..da69145f543 100644 --- a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/GeneratorHelpers.kt +++ b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/GeneratorHelpers.kt @@ -15,8 +15,7 @@ import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.* import org.jetbrains.kotlin.ir.symbols.* -import org.jetbrains.kotlin.ir.symbols.impl.IrTypeParameterSymbolImpl -import org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl +import org.jetbrains.kotlin.ir.symbols.impl.* import org.jetbrains.kotlin.ir.types.* import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection @@ -42,10 +41,12 @@ import org.jetbrains.kotlinx.serialization.compiler.resolve.* interface IrBuilderExtension { val compilerContext: SerializationPluginContext + private inline fun IrClass.searchForDeclaration(descriptor: DeclarationDescriptor): T? { + return declarations.singleOrNull { it.descriptor == descriptor } as? T + } + fun IrClass.contributeFunction(descriptor: FunctionDescriptor, bodyGen: IrBlockBodyBuilder.(IrFunction) -> Unit) { - val functionSymbol = compilerContext.symbolTable.referenceSimpleFunction(descriptor) - assert(functionSymbol.isBound) - val f: IrSimpleFunction = functionSymbol.owner + val f: IrSimpleFunction = searchForDeclaration(descriptor) ?: compilerContext.symbolTable.referenceSimpleFunction(descriptor).owner // TODO: default parameters f.body = DeclarationIrBuilder(compilerContext, f.symbol, this.startOffset, this.endOffset).irBlockBody( this.startOffset, @@ -59,11 +60,7 @@ interface IrBuilderExtension { overwriteValueParameters: Boolean = false, bodyGen: IrBlockBodyBuilder.(IrConstructor) -> Unit ) { - val ctorSymbol = compilerContext.symbolTable.referenceConstructor(descriptor) - assert(ctorSymbol.isBound) - - val c = ctorSymbol.owner - + val c: IrConstructor = searchForDeclaration(descriptor) ?: compilerContext.symbolTable.referenceConstructor(descriptor).owner c.body = DeclarationIrBuilder(compilerContext, c.symbol, this.startOffset, this.endOffset).irBlockBody( this.startOffset, this.endOffset @@ -94,7 +91,7 @@ interface IrBuilderExtension { irInvoke( dispatchReceiver, callee, - *valueArguments.toTypedArray(), + args = valueArguments.toTypedArray(), typeHint = returnTypeHint ).also { call -> typeArguments.forEachIndexed(call::putTypeArgument) } @@ -226,16 +223,12 @@ interface IrBuilderExtension { fun generateSimplePropertyWithBackingField( propertyDescriptor: PropertyDescriptor, propertyParent: IrClass, - declare: Boolean, fieldName: Name = propertyDescriptor.name, ): IrProperty { - val irPropertySymbol = compilerContext.symbolTable.referenceProperty(propertyDescriptor) - assert(irPropertySymbol.isBound || declare) - - if (!irPropertySymbol.isBound) { + val irProperty = propertyParent.searchForDeclaration(propertyDescriptor) ?: run { with(propertyDescriptor) { propertyParent.factory.createProperty( - propertyParent.startOffset, propertyParent.endOffset, SERIALIZABLE_PLUGIN_ORIGIN, irPropertySymbol, + propertyParent.startOffset, propertyParent.endOffset, SERIALIZABLE_PLUGIN_ORIGIN, IrPropertySymbolImpl(propertyDescriptor), name, visibility, modality, isVar, isConst, isLateInit, isDelegated, isExternal ).also { it.parent = propertyParent @@ -243,50 +236,54 @@ interface IrBuilderExtension { } } } - val irProperty = irPropertySymbol.owner - irProperty.backingField = generatePropertyBackingField(propertyDescriptor, irProperty, fieldName).apply { - parent = propertyParent - correspondingPropertySymbol = irPropertySymbol - } + propertyParent.generatePropertyBackingFieldIfNeeded(propertyDescriptor, irProperty, fieldName) val fieldSymbol = irProperty.backingField!!.symbol - irProperty.getter = propertyDescriptor.getter?.let { generatePropertyAccessor(irProperty, it, fieldSymbol, declare) } - ?.apply { parent = propertyParent } - irProperty.setter = propertyDescriptor.setter?.let { generatePropertyAccessor(irProperty, it, fieldSymbol, declare) } - ?.apply { parent = propertyParent } + irProperty.getter = propertyDescriptor.getter?.let { + propertyParent.generatePropertyAccessor(propertyDescriptor, irProperty, it, fieldSymbol, isGetter = true) + }?.apply { parent = propertyParent } + irProperty.setter = propertyDescriptor.setter?.let { + propertyParent.generatePropertyAccessor(propertyDescriptor, irProperty, it, fieldSymbol, isGetter = false) + }?.apply { parent = propertyParent } return irProperty } - private fun generatePropertyBackingField( - descriptor: PropertyDescriptor, + private fun IrClass.generatePropertyBackingFieldIfNeeded( + propertyDescriptor: PropertyDescriptor, originProperty: IrProperty, name: Name, - ): IrField { - val fieldSymbol = compilerContext.symbolTable.referenceField(descriptor) - if (fieldSymbol.isBound) return fieldSymbol.owner + ) { + if (originProperty.backingField != null) return - return with(descriptor) { + val field = with(propertyDescriptor) { // TODO: type parameters originProperty.factory.createField( - originProperty.startOffset, originProperty.endOffset, SERIALIZABLE_PLUGIN_ORIGIN, fieldSymbol, name, type.toIrType(), + originProperty.startOffset, originProperty.endOffset, SERIALIZABLE_PLUGIN_ORIGIN, IrFieldSymbolImpl(propertyDescriptor), name, type.toIrType(), visibility, !isVar, isEffectivelyExternal(), dispatchReceiverParameter == null ) } + field.apply { + parent = this@generatePropertyBackingFieldIfNeeded + correspondingPropertySymbol = originProperty.symbol + } + + originProperty.backingField = field } - private fun generatePropertyAccessor( + private fun IrClass.generatePropertyAccessor( + propertyDescriptor: PropertyDescriptor, property: IrProperty, descriptor: PropertyAccessorDescriptor, fieldSymbol: IrFieldSymbol, - declare: Boolean + isGetter: Boolean, ): IrSimpleFunction { - val symbol = compilerContext.symbolTable.referenceSimpleFunction(descriptor) - assert(symbol.isBound || declare) - - if (!symbol.isBound) { + val irAccessor: IrSimpleFunction = when (isGetter) { + true -> searchForDeclaration(propertyDescriptor)?.getter + false -> searchForDeclaration(propertyDescriptor)?.setter + } ?: run { with(descriptor) { property.factory.createFunction( - fieldSymbol.owner.startOffset, fieldSymbol.owner.endOffset, SERIALIZABLE_PLUGIN_ORIGIN, symbol, + fieldSymbol.owner.startOffset, fieldSymbol.owner.endOffset, SERIALIZABLE_PLUGIN_ORIGIN, IrSimpleFunctionSymbolImpl(descriptor), name, visibility, modality, returnType!!.toIrType(), isInline, isExternal, isTailrec, isSuspend, isOperator, isInfix, isExpect ) @@ -298,11 +295,9 @@ interface IrBuilderExtension { } } - val irAccessor = symbol.owner - irAccessor.body = when (descriptor) { - is PropertyGetterDescriptor -> generateDefaultGetterBody(descriptor, irAccessor) - is PropertySetterDescriptor -> generateDefaultSetterBody(descriptor, irAccessor) - else -> throw AssertionError("Should be getter or setter: $descriptor") + irAccessor.body = when (isGetter) { + true -> generateDefaultGetterBody(descriptor as PropertyGetterDescriptor, irAccessor) + false -> generateDefaultSetterBody(descriptor as PropertySetterDescriptor, irAccessor) } return irAccessor @@ -557,8 +552,8 @@ interface IrBuilderExtension { kType, genericIndex ) { it, _ -> - val prop = enclosingGenerator.localSerializersFieldsDescriptors[it] - irGetField(irGet(dispatchReceiverParameter), compilerContext.symbolTable.referenceField(prop).owner) + val (prop, ir) = enclosingGenerator.localSerializersFieldsDescriptors[it] + irGetField(irGet(dispatchReceiverParameter), ir.backingField!!) } fun IrBuilderWithScope.serializerInstance( diff --git a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/SerialInfoImplJvmIrGenerator.kt b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/SerialInfoImplJvmIrGenerator.kt index a6261998af8..980291dd50d 100644 --- a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/SerialInfoImplJvmIrGenerator.kt +++ b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/SerialInfoImplJvmIrGenerator.kt @@ -65,7 +65,7 @@ class SerialInfoImplJvmIrGenerator( ctor.body = ctorBody for (property in properties) { - generateSimplePropertyWithBackingField(property.descriptor, irClass, true, Name.identifier("_" + property.name.asString())) + generateSimplePropertyWithBackingField(property.descriptor, irClass, Name.identifier("_" + property.name.asString())) val getter = property.getter!! getter.origin = SERIALIZABLE_SYNTHETIC_ORIGIN diff --git a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/SerializerIrGenerator.kt b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/SerializerIrGenerator.kt index dcbf0f23398..66041a9022e 100644 --- a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/SerializerIrGenerator.kt +++ b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/SerializerIrGenerator.kt @@ -65,11 +65,11 @@ open class SerializerIrGenerator( // how to (auto)create backing field and getter/setter? compilerContext.symbolTable.withReferenceScope(irClass.descriptor) { - prop = generateSimplePropertyWithBackingField(desc, irClass, false) + prop = generateSimplePropertyWithBackingField(desc, irClass) // TODO: Do not use descriptors here - localSerializersFieldsDescriptors.forEach { - generateSimplePropertyWithBackingField(it, irClass, true) + localSerializersFieldsDescriptors = findLocalSerializersFieldDescriptors().map { it -> + it to generateSimplePropertyWithBackingField(it, irClass) } } @@ -195,11 +195,11 @@ open class SerializerIrGenerator( // store type arguments serializers in fields val thisAsReceiverParameter = irClass.thisReceiver!! ctor.valueParameters.forEachIndexed { index, param -> - val localSerial = compilerContext.symbolTable.referenceField(localSerializersFieldsDescriptors[index]) + val localSerial = localSerializersFieldsDescriptors[index].second.backingField!! +irSetField(generateReceiverExpressionForFieldAccess( thisAsReceiverParameter.symbol, - localSerializersFieldsDescriptors[index] - ), localSerial.owner, irGet(param)) + localSerializersFieldsDescriptors[index].first + ), localSerial, irGet(param)) } @@ -221,7 +221,7 @@ open class SerializerIrGenerator( val typeParams = serializableDescriptor.declaredTypeParameters.mapIndexed { idx, _ -> irGetField( irGet(irFun.dispatchReceiverParameter!!), - compilerContext.symbolTable.referenceField(localSerializersFieldsDescriptors[idx]).owner + localSerializersFieldsDescriptors[idx].second.backingField!! ) } val kSerType = ((irFun.returnType as IrSimpleType).arguments.first() as IrTypeProjection).type From 71d3d8bffc1477ea4d58f029c842b32e2197fb6d Mon Sep 17 00:00:00 2001 From: Margarita Bobova Date: Tue, 24 Nov 2020 17:46:52 +0300 Subject: [PATCH 089/698] Add ChangeLog for 1.4.20 --- ChangeLog.md | 266 ++++++++++++++++++++++++++------------------------- 1 file changed, 138 insertions(+), 128 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 869b574d35e..c6c169baaa2 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,6 +1,6 @@ # CHANGELOG -## 1.4.20-M2 +## 1.4.20 ### Android @@ -8,124 +8,6 @@ - [`KT-42267`](https://youtrack.jetbrains.com/issue/KT-42267) `Platform declaration clash` error in IDE when using `kotlinx.android.parcel.Parcelize` - [`KT-42406`](https://youtrack.jetbrains.com/issue/KT-42406) Long or infinite code analysis on simple files modification -### Compiler - -- [`KT-11713`](https://youtrack.jetbrains.com/issue/KT-11713) Refine visibility check for synthetic property with protected setter -- [`KT-21147`](https://youtrack.jetbrains.com/issue/KT-21147) JEP 280: Indify String Concatenation (StringConcatFactory) -- [`KT-34178`](https://youtrack.jetbrains.com/issue/KT-34178) Scripts should be able to access imports objects -- [`KT-41484`](https://youtrack.jetbrains.com/issue/KT-41484) JVM IR: support -Xemit-jvm-type-annotations -- [`KT-42005`](https://youtrack.jetbrains.com/issue/KT-42005) JVM / IR: "NullPointerException: Parameter specified as non-null is null" when toString is called on inline class with not primitive property -- [`KT-42450`](https://youtrack.jetbrains.com/issue/KT-42450) NI: "IllegalStateException: Error type encountered: NonFixed:" with coroutines -- [`KT-42523`](https://youtrack.jetbrains.com/issue/KT-42523) Missed DefaultImpls for interface in `-jvm-default=all` mode on inheriting it from interface compiled in old scheme -- [`KT-42524`](https://youtrack.jetbrains.com/issue/KT-42524) Wrong specialization diagnostic is reported on inheriting from java interface with default with -Xjvm-default=all-compatibility -- [`KT-42546`](https://youtrack.jetbrains.com/issue/KT-42546) HMPP: bogus overload resolution ambiguity on using and expect-function declaration with nullable expect in a signature - -### Docs & Examples - -- [`KT-42318`](https://youtrack.jetbrains.com/issue/KT-42318) No documentation for `kotlin.js.js` - -### IDE - -- [`KT-38959`](https://youtrack.jetbrains.com/issue/KT-38959) IDE: False negative EXPLICIT_DELEGATION_CALL_REQUIRED, "IllegalArgumentException: Range must be inside element being annotated" - -### IDE. Debugger - -- [`KT-38659`](https://youtrack.jetbrains.com/issue/KT-38659) Evaluate Expression: `toString()` on variable returns error when breakpoint is in `commonTest` sourceset - -### IDE. Decompiler, Indexing, Stubs - -- [`KT-28732`](https://youtrack.jetbrains.com/issue/KT-28732) Stub file element types should be registered early enough -- [`KT-41346`](https://youtrack.jetbrains.com/issue/KT-41346) IDE: "AssertionError: Stub type mismatch: USER_TYPE!=REFERENCE_EXPRESSION" with `CollapsedDumpParser` class from IDEA SDK -- [`KT-41859`](https://youtrack.jetbrains.com/issue/KT-41859) File analysis never ending with kotlinx.cli (AssertionError: Stub type mismatch: TYPEALIAS!=CLASS) - -### IDE. Gradle. Script - -- [`KT-41141`](https://youtrack.jetbrains.com/issue/KT-41141) Gradle Kotlin DSL: "cannot access 'java.lang.Comparable'. Check your module classpath" with empty JDK in Project structure - -### IDE. Inspections and Intentions - -- [`KT-38915`](https://youtrack.jetbrains.com/issue/KT-38915) "Remove explicit type specification" intention should be disabled in explicit API mode -- [`KT-38981`](https://youtrack.jetbrains.com/issue/KT-38981) "Specify return type explicitly" inspection is not reported for declaration annotated with @PublishedApi in Explicit Api mode -- [`KT-39026`](https://youtrack.jetbrains.com/issue/KT-39026) 'Specify return type explicitly' intention duplicates compiler warning in Explicit api mode - -### IDE. Script - -- [`KT-41622`](https://youtrack.jetbrains.com/issue/KT-41622) IDE: Kotlin scripting support can't find context class from same project -- [`KT-41905`](https://youtrack.jetbrains.com/issue/KT-41905) IDE / Script: FilePathPattern parameter in @KotlinScript annotation is not reflected correctly in Pattern / Extension -- [`KT-42206`](https://youtrack.jetbrains.com/issue/KT-42206) Cannot load script definitions using org.jetbrains.kotlin.jsr223.ScriptDefinitionForExtensionAndIdeConsoleRootsSource - -### IDE. Tests Support - -- [`KT-37799`](https://youtrack.jetbrains.com/issue/KT-37799) Don't show a target choice in context menu for a test launched on specific platform - -### IDE. Wizards - -- [`KT-42372`](https://youtrack.jetbrains.com/issue/KT-42372) Rrename test classes in wizard template to avoid name clashing - -### JavaScript - -- [`KT-38136`](https://youtrack.jetbrains.com/issue/KT-38136) JS IR BE: add an ability to generate separate js files for each module and maybe each library -- [`KT-38868`](https://youtrack.jetbrains.com/issue/KT-38868) [MPP / JS / IR] IllegalStateException: "Serializable class must have single primary constructor" for expect class without primary constructor with @Serializable annotation -- [`KT-41275`](https://youtrack.jetbrains.com/issue/KT-41275) KJS / IR: "IllegalStateException: Can't find name for declaration FUN" caused by default value in constructor parameter -- [`KT-41627`](https://youtrack.jetbrains.com/issue/KT-41627) KJS / IR / Serialization: IllegalStateException: Serializable class must have single primary constructor - -### KMM Plugin - -- [`KT-41522`](https://youtrack.jetbrains.com/issue/KT-41522) KMM: exceptions for Mobile Multiplatform plugin are suggested to report to Google, not JetBrains -- [`KT-42065`](https://youtrack.jetbrains.com/issue/KT-42065) [KMM plugin] iOS apps fail to launch on iOS simulator with Xcode 12 - -### Libraries - -- [`KT-41799`](https://youtrack.jetbrains.com/issue/KT-41799) String.replace performance improvements - -### Native. C and ObjC Import - -- [`KT-41250`](https://youtrack.jetbrains.com/issue/KT-41250) [C-interop] Stubs for C functions without parameter names should have non-stable names - -### Native. Platform libraries - -- [`KT-42191`](https://youtrack.jetbrains.com/issue/KT-42191) Support for Xcode 12 - -### Native. Runtime. Memory - -- [`KT-42275`](https://youtrack.jetbrains.com/issue/KT-42275) "Memory.cpp:1605: runtime assert: Recursive GC is disallowed" sometimes when using Kotlin from Swift deinit - -### Native. Stdlib - -- [`KT-39145`](https://youtrack.jetbrains.com/issue/KT-39145) MutableData append method - -### Tools. Compiler Plugins - -- [`KT-36329`](https://youtrack.jetbrains.com/issue/KT-36329) Provide diagnostic in kotlinx.serialization when custom serializer mismatches property type -- [`KT-40030`](https://youtrack.jetbrains.com/issue/KT-40030) Move the Parcelize functionality out of the Android Extensions plugin - -### Tools. Gradle. JS - -- [`KT-39838`](https://youtrack.jetbrains.com/issue/KT-39838) Kotlin/JS Gradle tooling: NPM dependencies of different kinds with different versions of the same package fail with "Cannot find package@version in yarn.lock" -- [`KT-40202`](https://youtrack.jetbrains.com/issue/KT-40202) Kotlin/JS: Gradle: NPM version range operators are written into package.json as escape sequences -- [`KT-40986`](https://youtrack.jetbrains.com/issue/KT-40986) KJS / Gradle: BuildOperationQueueFailure when two different versions of js library are used as dependencies -- [`KT-42222`](https://youtrack.jetbrains.com/issue/KT-42222) KJS / Gradle: "Cannot find package@version in yarn.lock" when npm dependencies of one package but with different version are used in project -- [`KT-42339`](https://youtrack.jetbrains.com/issue/KT-42339) Support dukat binaries generation - -### Tools. Gradle. Native - -- [`KT-40999`](https://youtrack.jetbrains.com/issue/KT-40999) CocoaPods Gradle plugin: Support custom cinterop options when declaring a pod dependency. -- [`KT-41844`](https://youtrack.jetbrains.com/issue/KT-41844) Kotlin 1.4.10 gradle configuration error with cocoapods using multiple multiplatform modules - -### Tools. Scripts - -- [`KT-37987`](https://youtrack.jetbrains.com/issue/KT-37987) Kotlin script: hyphen arguments not forwarded to script -- [`KT-39502`](https://youtrack.jetbrains.com/issue/KT-39502) Scripting: reverse order of Severity enum so that ERROR > INFO -- [`KT-42335`](https://youtrack.jetbrains.com/issue/KT-42335) No "caused by" info about an exception that thrown in Kotlin Script - -### Tools. kapt - -- [`KT-25960`](https://youtrack.jetbrains.com/issue/KT-25960) Interfaces annotated with JvmDefault has wrong modifiers during annotation processing -- [`KT-37732`](https://youtrack.jetbrains.com/issue/KT-37732) Kapt task is broken after update to 1.3.70/1.3.71 - - -## 1.4.20-M1 - ### Backend. Native - [`KT-27534`](https://youtrack.jetbrains.com/issue/KT-27534) Bridges to Nothing-returning methods have incorrect signature @@ -142,7 +24,10 @@ #### New Features +- [`KT-21147`](https://youtrack.jetbrains.com/issue/KT-21147) JEP 280: Indify String Concatenation (StringConcatFactory) +- [`KT-34178`](https://youtrack.jetbrains.com/issue/KT-34178) Scripts should be able to access imports objects - [`KT-35549`](https://youtrack.jetbrains.com/issue/KT-35549) Support kotlin-android-extensions in JVM IR backend (for use with Jetpack Compose projects) +- [`KT-31567`](https://youtrack.jetbrains.com/issue/KT-31567) Support special semantics for underscore-named catch block parameters #### Performance Improvements @@ -151,14 +36,19 @@ - [`KT-33394`](https://youtrack.jetbrains.com/issue/KT-33394) UI freezes triggered by QualifiedExpressionResolver.resolveToPackageOrClassPrefix - [`KT-36814`](https://youtrack.jetbrains.com/issue/KT-36814) Support optimized delegated properties in JVM_IR - [`KT-36829`](https://youtrack.jetbrains.com/issue/KT-36829) Optimize 'in' expressions (operator fun contains) in JVM_IR +- [`KT-41741`](https://youtrack.jetbrains.com/issue/KT-41741) NI: "AssertionError: Empty intersection for types" with generic Java collection +- [`KT-42195`](https://youtrack.jetbrains.com/issue/KT-42195) NI: prohibitively long compilation time for values of nested data structures with type inference +- [`KT-42221`](https://youtrack.jetbrains.com/issue/KT-42221) Native compiler never finishes frontend phase after migrating to Kotlin 1.4.10 #### Fixes +- [`KT-11713`](https://youtrack.jetbrains.com/issue/KT-11713) Refine visibility check for synthetic property with protected setter - [`KT-16222`](https://youtrack.jetbrains.com/issue/KT-16222) Coroutine should be clearing any internal state as soon as possible to avoid memory leaks - [`KT-25519`](https://youtrack.jetbrains.com/issue/KT-25519) Extra inline marks inside suspending function callable reference bytecode - [`KT-33226`](https://youtrack.jetbrains.com/issue/KT-33226) Object INSTANCE field not annotated with NotNull in generated bytecode - [`KT-35495`](https://youtrack.jetbrains.com/issue/KT-35495) FIR: forbid non-Java synthetic properties - [`KT-35651`](https://youtrack.jetbrains.com/issue/KT-35651) Kotlin stdlib has greater resolution priority than jars added via @file:DependsOn annotation +- [`KT-35716`](https://youtrack.jetbrains.com/issue/KT-35716) Using @JvmOverloads in @JvmStatic functions in interface companion objects causes a ClassFormatError - [`KT-35730`](https://youtrack.jetbrains.com/issue/KT-35730) FIR: consider creating fake overrides for objects - [`KT-36951`](https://youtrack.jetbrains.com/issue/KT-36951) IllegalStateException: Expected some types: Throwing exception when there is a type parameter upper bound for itself - [`KT-37321`](https://youtrack.jetbrains.com/issue/KT-37321) [FIR] Support java array in type argument @@ -202,10 +92,12 @@ - [`KT-41014`](https://youtrack.jetbrains.com/issue/KT-41014) FIR2IR: when/where/how to determine the presence of a backing field for a property - [`KT-41018`](https://youtrack.jetbrains.com/issue/KT-41018) FIR2IR: sort members during de/serialization - [`KT-41144`](https://youtrack.jetbrains.com/issue/KT-41144) False positive "Redundant spread operator" in when statement and generic vararg argument +- [`KT-41218`](https://youtrack.jetbrains.com/issue/KT-41218) HMPP: arrayList declarations are visible both from stdlib-common and stdlib-jvm and lead to false-positive resolution ambiguity in IDE - [`KT-41374`](https://youtrack.jetbrains.com/issue/KT-41374) JVM / IR: NoSuchMethodError in Android project compiler caused by combination of inline classes and coroutines - [`KT-41388`](https://youtrack.jetbrains.com/issue/KT-41388) NI: Backend Internal error: Exception during IR lowering - [`KT-41429`](https://youtrack.jetbrains.com/issue/KT-41429) Inline class returned from suspend function should be boxed on resume path - [`KT-41465`](https://youtrack.jetbrains.com/issue/KT-41465) JVM / IR: "AssertionError: inconsistent parent function for CLASS LAMBDA_IMPL CLASS name" caused by inline method call into multiple constructors +- [`KT-41484`](https://youtrack.jetbrains.com/issue/KT-41484) JVM IR: support -Xemit-jvm-type-annotations - [`KT-41668`](https://youtrack.jetbrains.com/issue/KT-41668) JVM IR: incorrect enclosing constructor for lambdas in initializers of inner classes - [`KT-41669`](https://youtrack.jetbrains.com/issue/KT-41669) JVM IR: incorrect hashCode intrinsic is used in JVM target 1.8 for generic type substituted with primitive - [`KT-41693`](https://youtrack.jetbrains.com/issue/KT-41693) NI: Type inference in nested expression incorrectly assumes non-nullable return type of Java function, causing NullPointerException @@ -214,6 +106,26 @@ - [`KT-41789`](https://youtrack.jetbrains.com/issue/KT-41789) Missing DebugMetadata in inlined suspend lambda - [`KT-41913`](https://youtrack.jetbrains.com/issue/KT-41913) NI: Kotlin 1.4 type inference breaks valid code - [`KT-41934`](https://youtrack.jetbrains.com/issue/KT-41934) NI: a type variable for lambda parameter has been inferred to nullable type instead of not null one +- [`KT-42005`](https://youtrack.jetbrains.com/issue/KT-42005) JVM / IR: "NullPointerException: Parameter specified as non-null is null" when toString is called on inline class with not primitive property +- [`KT-42450`](https://youtrack.jetbrains.com/issue/KT-42450) NI: "IllegalStateException: Error type encountered: NonFixed:" with coroutines +- [`KT-42523`](https://youtrack.jetbrains.com/issue/KT-42523) Missed DefaultImpls for interface in `-jvm-default=all` mode on inheriting it from interface compiled in old scheme +- [`KT-42524`](https://youtrack.jetbrains.com/issue/KT-42524) Wrong specialization diagnostic is reported on inheriting from java interface with default with -Xjvm-default=all-compatibility +- [`KT-42546`](https://youtrack.jetbrains.com/issue/KT-42546) HMPP: incorrect subtyping of nullable types & overload resolution ambiguity on using and expect-function declaration with nullable expect in a signature +- [`KT-17691`](https://youtrack.jetbrains.com/issue/KT-17691) Wrong argument order in resolved call with varargs +- [`KT-25114`](https://youtrack.jetbrains.com/issue/KT-25114) Prohibit @JvmStatic on functions in private companions +- [`KT-33917`](https://youtrack.jetbrains.com/issue/KT-33917) Prohibit to expose anonymous types from private inline functions +- [`KT-35870`](https://youtrack.jetbrains.com/issue/KT-35870) Forbid secondary enum class constructors which do not delegate to the primary constructor +- [`KT-39098`](https://youtrack.jetbrains.com/issue/KT-39098) NI: parameter of anonymous function can be inferred to Any? if another parameter's type is specified +- [`KT-41176`](https://youtrack.jetbrains.com/issue/KT-41176) NI with Gson: "ClassCastException: java.util.ArrayList cannot be cast to java.lang.Void" +- [`KT-41194`](https://youtrack.jetbrains.com/issue/KT-41194) ClassCastException on returning Result.failure from lambda within suspend function +- [`KT-42438`](https://youtrack.jetbrains.com/issue/KT-42438) NI: ClassCastException: cannot be cast to java.lang.Void caused by when statement in `run` function +- [`KT-42699`](https://youtrack.jetbrains.com/issue/KT-42699) False positive NON_JVM_DEFAULT_OVERRIDES_JAVA_DEFAULT diagnostic in new jvm-default modes +- [`KT-42706`](https://youtrack.jetbrains.com/issue/KT-42706) Kotlin 1.4 infers generic is Nothing instead of actual Foo class (Android project) + + +### Docs & Examples + +- [`KT-42318`](https://youtrack.jetbrains.com/issue/KT-42318) No documentation for `kotlin.js.js` ### IDE @@ -240,7 +152,6 @@ - [`KT-29364`](https://youtrack.jetbrains.com/issue/KT-29364) "Extend selection" can't select lambda body with parameters - [`KT-32403`](https://youtrack.jetbrains.com/issue/KT-32403) Clickable links in annotation parameters (like in TODOs) - [`KT-32409`](https://youtrack.jetbrains.com/issue/KT-32409) Organizing imports should not remove imports while there are unresolved symbols -- [`KT-33131`](https://youtrack.jetbrains.com/issue/KT-33131) No indent before get/set method while editing extension var declaration - [`KT-34566`](https://youtrack.jetbrains.com/issue/KT-34566) Too small indent after line break for multi line strings - [`KT-34587`](https://youtrack.jetbrains.com/issue/KT-34587) "Move statement down" doesn't work for statement in constructor with end-of-line comment - [`KT-34705`](https://youtrack.jetbrains.com/issue/KT-34705) "Move statement down" for penultimate statement with end-of-line comment in constructor leads to moving comma to the end of comment @@ -250,12 +161,21 @@ - [`KT-35859`](https://youtrack.jetbrains.com/issue/KT-35859) Language injection doesn't work with named arguments in different position - [`KT-37210`](https://youtrack.jetbrains.com/issue/KT-37210) UAST: KtLightClassForSourceDeclaration.isInheritor sometimes returns the wrong result - [`KT-37219`](https://youtrack.jetbrains.com/issue/KT-37219) File level OptIn annotation is not recognized by the IDE +- [`KT-38959`](https://youtrack.jetbrains.com/issue/KT-38959) IDE: False negative EXPLICIT_DELEGATION_CALL_REQUIRED, "IllegalArgumentException: Range must be inside element being annotated" - [`KT-39398`](https://youtrack.jetbrains.com/issue/KT-39398) Wrong import of unrelated object member is suggested for receiver - [`KT-39457`](https://youtrack.jetbrains.com/issue/KT-39457) Separate decompiled declarations Light implementation from LightClasses infrastructure - [`KT-39899`](https://youtrack.jetbrains.com/issue/KT-39899) KotlinOptimizeImportsRefactoringHelper: ISE: Attempt to modify PSI for non-committed Document - [`KT-40578`](https://youtrack.jetbrains.com/issue/KT-40578) UAST: write accesses to Kotlin properties should resolve to setter - [`KT-41290`](https://youtrack.jetbrains.com/issue/KT-41290) KotlinClassViaConstructorUSimpleReferenceExpression resolves to PsiMethod instead of PsiClass - [`KT-42029`](https://youtrack.jetbrains.com/issue/KT-42029) HMPP, IDE: NPE from `FacetSerializationKt.getFacetPlatformByConfigurationElement` on project opening +- [`KT-43202`](https://youtrack.jetbrains.com/issue/KT-43202) On 1.4.20-RC version AS ask for xml compatibility update for EAP version of plugin +- [`KT-42883`](https://youtrack.jetbrains.com/issue/KT-42883) No highlighting for elements marked as @Deprecated in stdlib + +### IDE. Android + +- [`KT-42406`](https://youtrack.jetbrains.com/issue/KT-42406) Long or infinite code analysis on simple files modification +- [`KT-42061`](https://youtrack.jetbrains.com/issue/KT-42061) Highlighting is broken in Android activity +- [`KT-41930`](https://youtrack.jetbrains.com/issue/KT-41930) Android Studio 4.2 cannot start after updating to 1.4.20 plugin with error: Missing essential plugin: org.jetbrains.android ### IDE. Completion @@ -263,32 +183,48 @@ ### IDE. Debugger +- [`KT-37486`](https://youtrack.jetbrains.com/issue/KT-37486) Kotlin plugin keeps reference to stream debugger support classes after stream debugger plugin is disabled +- [`KT-38659`](https://youtrack.jetbrains.com/issue/KT-38659) Evaluate Expression: `toString()` on variable returns error when breakpoint is in `commonTest` sourceset - [`KT-39309`](https://youtrack.jetbrains.com/issue/KT-39309) Debugger: Prolonged "Collecting data" for variables when breakpoint is inside `respondHtml` - [`KT-39435`](https://youtrack.jetbrains.com/issue/KT-39435) "Collecting data..." in debugger variables view never finishes - [`KT-39717`](https://youtrack.jetbrains.com/issue/KT-39717) Debugger shows "Collecting data..." forever for instances of some class - [`KT-40386`](https://youtrack.jetbrains.com/issue/KT-40386) Memory leak detected: 'org.jetbrains.kotlin.idea.debugger.coroutine.view.XCoroutineView' +- [`KT-40635`](https://youtrack.jetbrains.com/issue/KT-40635) Coroutines Debugger: make IDE plugin accept coroutines 1.3.8-rc* versions as well - [`KT-41505`](https://youtrack.jetbrains.com/issue/KT-41505) Coroutines Debugger: “Access is allowed from event dispatch thread with IW lock only.” +### IDE. Decompiler, Indexing, Stubs + +- [`KT-28732`](https://youtrack.jetbrains.com/issue/KT-28732) Stub file element types should be registered early enough +- [`KT-41346`](https://youtrack.jetbrains.com/issue/KT-41346) IDE: "AssertionError: Stub type mismatch: USER_TYPE!=REFERENCE_EXPRESSION" with `CollapsedDumpParser` class from IDEA SDK +- [`KT-41859`](https://youtrack.jetbrains.com/issue/KT-41859) File analysis never ending with kotlinx.cli (AssertionError: Stub type mismatch: TYPEALIAS!=CLASS) +- [`KT-41640`](https://youtrack.jetbrains.com/issue/KT-41640) "Project roots have changed" happened during indexing because of org.jetbrains.kotlin.idea.core.script.ucache.ScriptClassRootsUpdater$notifyRootsChanged increases overall indexing time. +- [`KT-41646`](https://youtrack.jetbrains.com/issue/KT-41646) "AssertionError: ContentElementType: FILE"; Code analysis never finishes on some files from my project + ### IDE. Gradle Integration - [`KT-34271`](https://youtrack.jetbrains.com/issue/KT-34271) Support `pureKotlinSourceFolders` for MPP projects - [`KT-37106`](https://youtrack.jetbrains.com/issue/KT-37106) Gradle + IDE integration: on creating source roots from Project tree IDEA creates incorrect settings +- [`KT-38830`](https://youtrack.jetbrains.com/issue/KT-38830) addTransitiveDependenciesOnImplementedModules performance is slowing down Android Studio Gradle Sync +- [`KT-41703`](https://youtrack.jetbrains.com/issue/KT-41703) Kotlin plugin not functional: PluginException: While loading class org.jetbrains.kotlin.idea.core.script.KotlinScriptDependenciesClassFinder ### IDE. Gradle. Script - [`KT-35092`](https://youtrack.jetbrains.com/issue/KT-35092) “Unable to get Gradle home directory” popup and no build.gradle.kts highlighting right after creating a new project - [`KT-37590`](https://youtrack.jetbrains.com/issue/KT-37590) Wrong notification for precompiled build script - [`KT-39523`](https://youtrack.jetbrains.com/issue/KT-39523) Go to Declaration navigates to decompiled classfile instead of sources in case of jumping to Gradle plugin sources in buildSrc +- [`KT-39542`](https://youtrack.jetbrains.com/issue/KT-39542) EA-218043: java.util.NoSuchElementException: No element of given type found (GradleBuildRootsManager) - [`KT-39790`](https://youtrack.jetbrains.com/issue/KT-39790) List of standalone script should be saved between IDE restarts - [`KT-39910`](https://youtrack.jetbrains.com/issue/KT-39910) build.gradle.kts isn't highlighted after import - [`KT-39916`](https://youtrack.jetbrains.com/issue/KT-39916) init.gradle.kts isn't highlighted - [`KT-40243`](https://youtrack.jetbrains.com/issue/KT-40243) gradle.kts: standalone script under build root isn't highlighted as standalone +- [`KT-41141`](https://youtrack.jetbrains.com/issue/KT-41141) Gradle Kotlin DSL: "cannot access 'java.lang.Comparable'. Check your module classpath" with empty JDK in Project structure - [`KT-41281`](https://youtrack.jetbrains.com/issue/KT-41281) Multiple Script Definitions warning shown in git project having multiple Gradle projects ### IDE. Hints - [`KT-32368`](https://youtrack.jetbrains.com/issue/KT-32368) Rework Inline hints settings so that they look appropriate with the new UI in 2019.3 - [`KT-38027`](https://youtrack.jetbrains.com/issue/KT-38027) Support Code Vision feature in Kotlin +- [`KT-42014`](https://youtrack.jetbrains.com/issue/KT-42014) ClassNotFoundException in Android Studio 4.2 after installing 1.4.20 plugin ### IDE. Hints. Parameter Info @@ -339,6 +275,9 @@ - [`KT-38139`](https://youtrack.jetbrains.com/issue/KT-38139) False negative "Add suspend modifier" quickfix when suspend function is called in inline lambda - [`KT-38267`](https://youtrack.jetbrains.com/issue/KT-38267) False positive "Call on collection type may be reduced" with Java platform types: suggested to reduce 'mapNotNull' call to 'map' - [`KT-38282`](https://youtrack.jetbrains.com/issue/KT-38282) False positive "Remove redundant spread operator" inspection with array as class property or fun argument +- [`KT-38915`](https://youtrack.jetbrains.com/issue/KT-38915) "Remove explicit type specification" intention should be disabled in explicit API mode +- [`KT-38981`](https://youtrack.jetbrains.com/issue/KT-38981) "Specify return type explicitly" inspection is not reported for declaration annotated with @PublishedApi in Explicit Api mode +- [`KT-39026`](https://youtrack.jetbrains.com/issue/KT-39026) 'Specify return type explicitly' intention duplicates compiler warning in Explicit api mode - [`KT-39200`](https://youtrack.jetbrains.com/issue/KT-39200) False positive "Redundant qualifier name" with same-named member object and companion property - [`KT-39263`](https://youtrack.jetbrains.com/issue/KT-39263) False positive "Variable should be inlined" for override value in initialized object - [`KT-39311`](https://youtrack.jetbrains.com/issue/KT-39311) Batch quick fix name for "Change file's package" is truncated @@ -354,6 +293,16 @@ - [`KT-40558`](https://youtrack.jetbrains.com/issue/KT-40558) False positive "Move to class body" intention on data class constructor property - [`KT-41338`](https://youtrack.jetbrains.com/issue/KT-41338) False positive "Redundant 'asSequence' call" when Map.Entry properties are used. - [`KT-41615`](https://youtrack.jetbrains.com/issue/KT-41615) "Unused equals expression" inspection: highlight whole expression with yellow background +- [`KT-43037`](https://youtrack.jetbrains.com/issue/KT-43037) Disable "Incomplete destructuring declaration" in 1.4.20 + +### IDE. J2K + +- [`KT-20421`](https://youtrack.jetbrains.com/issue/KT-20421) J2K: SUPERTYPE_NOT_INITIALIZED for object extending base class +- [`KT-37298`](https://youtrack.jetbrains.com/issue/KT-37298) J2K: implicit widening conversion for whole argument expression is transformed to cast on subexpression +- [`KT-38879`](https://youtrack.jetbrains.com/issue/KT-38879) J2K loses class annotations when converting class to object +- [`KT-39149`](https://youtrack.jetbrains.com/issue/KT-39149) J2K fails with augmented assignment operators when multiplying int by a non-int +- [`KT-40359`](https://youtrack.jetbrains.com/issue/KT-40359) J2K: Conversion of invalid octal numbers throws NumberFormatException +- [`KT-40363`](https://youtrack.jetbrains.com/issue/KT-40363) J2K: Converting HEX integer literal in for-loop throws NumberFormatException ### IDE. JS @@ -403,11 +352,15 @@ - [`KT-35825`](https://youtrack.jetbrains.com/issue/KT-35825) Custom kotlin scripts have no project import suggestions in sub modules. - [`KT-39796`](https://youtrack.jetbrains.com/issue/KT-39796) Performance of KotlinScriptDependenciesClassFinder +- [`KT-41622`](https://youtrack.jetbrains.com/issue/KT-41622) IDE: Kotlin scripting support can't find context class from same project +- [`KT-41905`](https://youtrack.jetbrains.com/issue/KT-41905) IDE / Script: FilePathPattern parameter in @KotlinScript annotation is not reflected correctly in Pattern / Extension +- [`KT-42206`](https://youtrack.jetbrains.com/issue/KT-42206) Cannot load script definitions using org.jetbrains.kotlin.jsr223.ScriptDefinitionForExtensionAndIdeConsoleRootsSource ### IDE. Tests Support - [`KT-28854`](https://youtrack.jetbrains.com/issue/KT-28854) Run/Debug configurations: "Redirect input from" option is not available for Kotlin apps - [`KT-36909`](https://youtrack.jetbrains.com/issue/KT-36909) IDE attempts to run non-JVM tests launched from context menu as JVM ones +- [`KT-37799`](https://youtrack.jetbrains.com/issue/KT-37799) Don't show a target choice in context menu for a test launched on specific platform ### IDE. Wizards @@ -417,12 +370,31 @@ - [`KT-41417`](https://youtrack.jetbrains.com/issue/KT-41417) Add react template to new project wizard - [`KT-41418`](https://youtrack.jetbrains.com/issue/KT-41418) Wizard: Support KJS compiler choice - [`KT-41958`](https://youtrack.jetbrains.com/issue/KT-41958) New project wizard: Backend/Console applications template with Groovy DSL missing compileTestKotlin block +- [`KT-42372`](https://youtrack.jetbrains.com/issue/KT-42372) Rrename test classes in wizard template to avoid name clashing ### JavaScript +- [`KT-38136`](https://youtrack.jetbrains.com/issue/KT-38136) JS IR BE: add an ability to generate separate js files for each module and maybe each library +- [`KT-38868`](https://youtrack.jetbrains.com/issue/KT-38868) [MPP / JS / IR] IllegalStateException: "Serializable class must have single primary constructor" for expect class without primary constructor with @Serializable annotation - [`KT-39088`](https://youtrack.jetbrains.com/issue/KT-39088) [ KJS / IR ] IllegalStateException: Concrete fake override IrBasedFunctionHandle - [`KT-39367`](https://youtrack.jetbrains.com/issue/KT-39367) KJS: .d.ts generation not working for objects - [`KT-39378`](https://youtrack.jetbrains.com/issue/KT-39378) KJS / IR: "IllegalStateException: Operation is unsupported" with binaries.executable() and external function inside `for` loop with Iterator as return type +- [`KT-41275`](https://youtrack.jetbrains.com/issue/KT-41275) KJS / IR: "IllegalStateException: Can't find name for declaration FUN" caused by default value in constructor parameter +- [`KT-41627`](https://youtrack.jetbrains.com/issue/KT-41627) KJS / IR / Serialization: IllegalStateException: Serializable class must have single primary constructor +- [`KT-37829`](https://youtrack.jetbrains.com/issue/KT-37829) Kotlin JS IR: "Properties without fields are not supported" for companion objects +- [`KT-39740`](https://youtrack.jetbrains.com/issue/KT-39740) KJS / IR: Can't use Serializable and JsExport annotations at the same time + +### KMM Plugin + +- [`KT-41522`](https://youtrack.jetbrains.com/issue/KT-41522) KMM: exceptions for Mobile Multiplatform plugin are suggested to report to Google, not JetBrains +- [`KT-42065`](https://youtrack.jetbrains.com/issue/KT-42065) [KMM plugin] iOS apps fail to launch on iOS simulator with Xcode 12 + +### Libraries + +- [`KT-41799`](https://youtrack.jetbrains.com/issue/KT-41799) String.replace performance improvements +- [`KT-43306`](https://youtrack.jetbrains.com/issue/KT-43306) Deprecate createTempFile and createTempDir functions in kotlin.io +- [`KT-19192`](https://youtrack.jetbrains.com/issue/KT-19192) Provide file system extensions/APIs based on java.nio.file.Path +- [`KT-41837`](https://youtrack.jetbrains.com/issue/KT-41837) Remove @ExperimentalStdlibApi from CancellationException ### Middle-end. IR @@ -431,26 +403,47 @@ ### Native. C and ObjC Import +- [`KT-41250`](https://youtrack.jetbrains.com/issue/KT-41250) [C-interop] Stubs for C functions without parameter names should have non-stable names - [`KT-41639`](https://youtrack.jetbrains.com/issue/KT-41639) Use LazyIR for enums and structs from cached libraries - [`KT-41655`](https://youtrack.jetbrains.com/issue/KT-41655) Native: "type cnames.structs.S of return value is not supported here: doesn't correspond to any C type" when accessing forward-declared-struct-typed C global variable ### Native. ObjC Export - [`KT-38641`](https://youtrack.jetbrains.com/issue/KT-38641) Kotlin-Multiplatform: Objective-C `description` method name collision in Swift +- [`KT-39206`](https://youtrack.jetbrains.com/issue/KT-39206) New line characters in @Deprecated annotation cause syntax error in Kotlin/native exported header + +### Native. Platform libraries + +- [`KT-42191`](https://youtrack.jetbrains.com/issue/KT-42191) Support for Xcode 12 + +### Native. Runtime. Memory + +- [`KT-42275`](https://youtrack.jetbrains.com/issue/KT-42275) "Memory.cpp:1605: runtime assert: Recursive GC is disallowed" sometimes when using Kotlin from Swift deinit + +### Native. Stdlib + +- [`KT-39145`](https://youtrack.jetbrains.com/issue/KT-39145) MutableData append method ### Tools. Android Extensions -- [`KT-39981`](https://youtrack.jetbrains.com/issue/KT-39981) Android parcel 'java.lang.VerifyError: Bad return type' +- [`KT-42342`](https://youtrack.jetbrains.com/issue/KT-42342) Build fails with `java.lang.RuntimeException: Duplicate class found in modules` on `checkDebug(Release)DuplicateClasses` task when both `kotlin-parcelize` and `kotlin-android-extensions` plugins are applied ### Tools. CLI - [`KT-35111`](https://youtrack.jetbrains.com/issue/KT-35111) Extend CLI compilers help with link to online docs +- [`KT-41916`](https://youtrack.jetbrains.com/issue/KT-41916) Add JVM target bytecode version 15 ### Tools. Commonizer - [`KT-41220`](https://youtrack.jetbrains.com/issue/KT-41220) [Commonizer] Short-circuit type aliases - [`KT-41247`](https://youtrack.jetbrains.com/issue/KT-41247) [Commonizer] Missed supertypes in commonized class - [`KT-41643`](https://youtrack.jetbrains.com/issue/KT-41643) Commonizer exception for targets [ios_x64], [macos_x64] +- [`KT-42574`](https://youtrack.jetbrains.com/issue/KT-42574) HMPP: unresolved platform.* imports in nativeMain source set + +### Tools. Compiler Plugins + +- [`KT-36329`](https://youtrack.jetbrains.com/issue/KT-36329) Provide diagnostic in kotlinx.serialization when custom serializer mismatches property type +- [`KT-40030`](https://youtrack.jetbrains.com/issue/KT-40030) Move the Parcelize functionality out of the Android Extensions plugin ### Tools. Gradle @@ -466,47 +459,64 @@ - [`KT-41054`](https://youtrack.jetbrains.com/issue/KT-41054) Support Yarn resolutions - [`KT-41340`](https://youtrack.jetbrains.com/issue/KT-41340) Add flag to suppress kotlin2js deprecation message - [`KT-41566`](https://youtrack.jetbrains.com/issue/KT-41566) Kotlin/JS: Support JavaScript Library distribution +- [`KT-42222`](https://youtrack.jetbrains.com/issue/KT-42222) KJS / Gradle: "Cannot find package@version in yarn.lock" when npm dependencies of one package but with different version are used in project +- [`KT-42339`](https://youtrack.jetbrains.com/issue/KT-42339) Support dukat binaries generation #### Fixes - [`KT-39515`](https://youtrack.jetbrains.com/issue/KT-39515) package.json is regenerated without a visible reason +- [`KT-39838`](https://youtrack.jetbrains.com/issue/KT-39838) Kotlin/JS Gradle tooling: NPM dependencies of different kinds with different versions of the same package fail with "Cannot find package@version in yarn.lock" - [`KT-39995`](https://youtrack.jetbrains.com/issue/KT-39995) Collect statistic about generateExternals feature - [`KT-40087`](https://youtrack.jetbrains.com/issue/KT-40087) Kotlin/JS, IR backend: browserRun: update in continuous mode fails: "ENOENT: no such file or directory" referring output .js - [`KT-40159`](https://youtrack.jetbrains.com/issue/KT-40159) Implement workaround / fix for webpack's "window is not defined" - [`KT-40178`](https://youtrack.jetbrains.com/issue/KT-40178) Browser run task prints output in TeamCity format - [`KT-40201`](https://youtrack.jetbrains.com/issue/KT-40201) Kotlin/JS: Gradle: public package.json has empty `devDependencies {}` +- [`KT-40202`](https://youtrack.jetbrains.com/issue/KT-40202) Kotlin/JS: Gradle: NPM version range operators are written into package.json as escape sequences - [`KT-40342`](https://youtrack.jetbrains.com/issue/KT-40342) [Gradle, JS, Maven] "Cannot find module" generating fake NPM module from Maven dependendency - [`KT-40462`](https://youtrack.jetbrains.com/issue/KT-40462) Collect statistic about usages of kotlin.js.generate.executable.default option - [`KT-40753`](https://youtrack.jetbrains.com/issue/KT-40753) Type script definition file is not referenced as types in the package.json - [`KT-40812`](https://youtrack.jetbrains.com/issue/KT-40812) Node.JS run working directory - [`KT-40865`](https://youtrack.jetbrains.com/issue/KT-40865) KJS / Gradle: Registering a task with a type that directly extends AbstractTask has been deprecated +- [`KT-40986`](https://youtrack.jetbrains.com/issue/KT-40986) KJS / Gradle: BuildOperationQueueFailure when two different versions of js library are used as dependencies - [`KT-41125`](https://youtrack.jetbrains.com/issue/KT-41125) Bump NPM versions in 1.4.20 - [`KT-41286`](https://youtrack.jetbrains.com/issue/KT-41286) KJS / Gradle: args order in runTask is changed in 1.4.0 - [`KT-41475`](https://youtrack.jetbrains.com/issue/KT-41475) KJS / Gradle: debug mode doesn't support custom launchers in karma config - [`KT-41662`](https://youtrack.jetbrains.com/issue/KT-41662) Kotlin/JS: with CSS support mode == "extract" browser test fails even without CSS usage: "Error in config file!" +- [`KT-42494`](https://youtrack.jetbrains.com/issue/KT-42494) KJS / Gradle: "Configuration cache state could not be cached" caused by Gradle configuration cache ### Tools. Gradle. Native - [`KT-39764`](https://youtrack.jetbrains.com/issue/KT-39764) Assertions are disabled when running K/N compiler in Gradle process - [`KT-39999`](https://youtrack.jetbrains.com/issue/KT-39999) Cocoapods plugin's dummy header cannot be compiled +- [`KT-40999`](https://youtrack.jetbrains.com/issue/KT-40999) CocoaPods Gradle plugin: Support custom cinterop options when declaring a pod dependency. - [`KT-41367`](https://youtrack.jetbrains.com/issue/KT-41367) CocoaPods Gradle plugin: support git repository dependency +- [`KT-41844`](https://youtrack.jetbrains.com/issue/KT-41844) Kotlin 1.4.10 gradle configuration error with cocoapods using multiple multiplatform modules +- [`KT-42531`](https://youtrack.jetbrains.com/issue/KT-42531) Gradle task "podGenIos" fails if a Pod with a static library is added. ### Tools. Incremental Compile - [`KT-37446`](https://youtrack.jetbrains.com/issue/KT-37446) Incremental analysis for Java sources fails when run on JDK 11 -### Tools. J2K +### Tools. Parcelize -- [`KT-20421`](https://youtrack.jetbrains.com/issue/KT-20421) J2K: SUPERTYPE_NOT_INITIALIZED for object extending base class -- [`KT-37298`](https://youtrack.jetbrains.com/issue/KT-37298) J2K: implicit widening conversion for whole argument expression is transformed to cast on subexpression -- [`KT-38879`](https://youtrack.jetbrains.com/issue/KT-38879) J2K loses class annotations when converting class to object -- [`KT-39149`](https://youtrack.jetbrains.com/issue/KT-39149) J2K fails with augmented assignment operators when multiplying int by a non-int -- [`KT-40359`](https://youtrack.jetbrains.com/issue/KT-40359) J2K: Conversion of invalid octal numbers throws NumberFormatException -- [`KT-40363`](https://youtrack.jetbrains.com/issue/KT-40363) J2K: Converting HEX integer literal in for-loop throws NumberFormatException +- [`KT-39981`](https://youtrack.jetbrains.com/issue/KT-39981) Android parcel 'java.lang.VerifyError: Bad return type' +- [`KT-42267`](https://youtrack.jetbrains.com/issue/KT-42267) `Platform declaration clash` error in IDE when using `kotlinx.android.parcel.Parcelize` +- [`KT-42958`](https://youtrack.jetbrains.com/issue/KT-42958) False positive IDE error on classes with kotlinx.parcelize.Parcelize on project initial import +- [`KT-43290`](https://youtrack.jetbrains.com/issue/KT-43290) Typo in error message for `ErrorsParcelize.DEPRECATED_ANNOTATION` - kotlin.parcelize instead of kotlinx.parcelize +- [`KT-43291`](https://youtrack.jetbrains.com/issue/KT-43291) Diagnostic deprecation messages should not be shown in case `kotlin-android-extensions` plugin is applied ### Tools. Scripts +- [`KT-37987`](https://youtrack.jetbrains.com/issue/KT-37987) Kotlin script: hyphen arguments not forwarded to script - [`KT-38404`](https://youtrack.jetbrains.com/issue/KT-38404) Scripting API: Provide Location of Annotation Usage +- [`KT-39502`](https://youtrack.jetbrains.com/issue/KT-39502) Scripting: reverse order of Severity enum so that ERROR > INFO +- [`KT-42335`](https://youtrack.jetbrains.com/issue/KT-42335) No "caused by" info about an exception that thrown in Kotlin Script + +### Tools. kapt + +- [`KT-25960`](https://youtrack.jetbrains.com/issue/KT-25960) Interfaces annotated with JvmDefault has wrong modifiers during annotation processing +- [`KT-37732`](https://youtrack.jetbrains.com/issue/KT-37732) Kapt task is broken after update to 1.3.70/1.3.71 +- [`KT-42915`](https://youtrack.jetbrains.com/issue/KT-42915) Kapt generates invalid stubs for static methods in interfaces in Kotlin 1.4.20-M2 ## 1.4.10 From ebb545a9fbf8902301f598e022624a5e69be2448 Mon Sep 17 00:00:00 2001 From: Margarita Bobova Date: Tue, 24 Nov 2020 17:59:17 +0300 Subject: [PATCH 090/698] Split ChangeLog file to files by major releases --- ChangeLog-1.0.X.md | 1304 ++++++ ChangeLog-1.1.X.md | 2697 ++++++++++++ ChangeLog-1.2.X.md | 2042 +++++++++ ChangeLog-1.3.X.md | 3879 +++++++++++++++++ ChangeLog.md | 9922 +------------------------------------------- 5 files changed, 9927 insertions(+), 9917 deletions(-) create mode 100644 ChangeLog-1.0.X.md create mode 100644 ChangeLog-1.1.X.md create mode 100644 ChangeLog-1.2.X.md create mode 100644 ChangeLog-1.3.X.md diff --git a/ChangeLog-1.0.X.md b/ChangeLog-1.0.X.md new file mode 100644 index 00000000000..d496a30676f --- /dev/null +++ b/ChangeLog-1.0.X.md @@ -0,0 +1,1304 @@ +# Changelog 1.0.X + +## 1.0.7 + +### IDE + +- Project View: Fix presentation of Kotlin files and their members when @JvmName having the same name as the file itself +- [`KT-15611`](https://youtrack.jetbrains.com/issue/KT-15611) Extract Interface/Superclass: Disable const-properties +- Pull Up: Fix pull-up from object to superclass +- [`KT-15602`](https://youtrack.jetbrains.com/issue/KT-15602) Extract Interface/Superclass: Disable "Make abstract" for inline/external/lateinit members +- Extract Interface: Disable inline/external/lateinit members +- [`KT-12704`](https://youtrack.jetbrains.com/issue/KT-12704), [`KT-15583`](https://youtrack.jetbrains.com/issue/KT-15583) Override/Implement Members: Support all nullability annotations respected by the Kotlin compiler +- [`KT-15563`](https://youtrack.jetbrains.com/issue/KT-15563) Override Members: Allow overriding virtual synthetic members (e.g. equals(), hashCode(), toString(), etc.) in data classes +- [`KT-15355`](https://youtrack.jetbrains.com/issue/KT-15355) Extract Interface: Disable "Make abstract" and assume it to be true for abstract members of an interface +- [`KT-15353`](https://youtrack.jetbrains.com/issue/KT-15353) Extract Superclass/Interface: Allow extracting class with special name (and quotes) +- [`KT-15643`](https://youtrack.jetbrains.com/issue/KT-15643) Extract Interface/Pull Up: Disable "Make abstract" and assume it to be true for primary constructor parameter when moving to an interface +- [`KT-15607`](https://youtrack.jetbrains.com/issue/KT-15607) Extract Interface/Pull Up: Disable internal/protected members when moving to an interface +- [`KT-15640`](https://youtrack.jetbrains.com/issue/KT-15640) Extract Interface/Pull Up: Drop 'final' modifier when moving to an interface +- [`KT-15639`](https://youtrack.jetbrains.com/issue/KT-15639) Extract Superclass/Interface/Pull Up: Add spaces between 'abstract' modifier and annotations +- [`KT-15606`](https://youtrack.jetbrains.com/issue/KT-15606) Extract Interface/Pull Up: Warn about private members with usages in the original class +- [`KT-15635`](https://youtrack.jetbrains.com/issue/KT-15635) Extract Superclass/Interface: Fix bogus visibility warning inside a member when it's being moved as abstract +- [`KT-15598`](https://youtrack.jetbrains.com/issue/KT-15598) Extract Interface: Red-highlight members inherited from a super-interface when that interface reference itself is not extracted +- [`KT-15674`](https://youtrack.jetbrains.com/issue/KT-15674) Extract Superclass: Drop inapplicable modifiers when converting property-parameter to ordinary parameter +- [`KT-15444`](https://youtrack.jetbrains.com/issue/KT-15444) Spring Support: Consider declaration open if it's supplemented with a preconfigured annotation in corresponding compiler plugin + +#### Intention actions, inspections and quickfixes + +##### New features + +- [`KT-15068`](https://youtrack.jetbrains.com/issue/KT-15068) Implement intention which rename file according to the top-level class name +- Implement quickfix which enables/disables coroutine support in module or project +- [`KT-15056`](https://youtrack.jetbrains.com/issue/KT-15056) Implement intention which converts object literal to class +- [`KT-8855`](https://youtrack.jetbrains.com/issue/KT-8855) Implement "Create label" quick fix +- [`KT-15627`](https://youtrack.jetbrains.com/issue/KT-15627) Support "Change parameter type" for parameters with type-mismatched default value + +## 1.0.6 + +### IDE + +- [`KT-13811`](https://youtrack.jetbrains.com/issue/KT-13811) Expose JVM target setting in IntelliJ IDEA plugin compiler configuration UI +- [`KT-12410`](https://youtrack.jetbrains.com/issue/KT-12410) Expose language version setting in IntelliJ IDEA plugin compiler configuration UI + +#### Intention actions, inspections and quickfixes + +- [`KT-14569`](https://youtrack.jetbrains.com/issue/KT-14569) Convert Property to Function Intention: Search occurrences using progress dialog +- [`KT-14501`](https://youtrack.jetbrains.com/issue/KT-14501) Create from Usage: Support array access expressions/binary expressions with type mismatch errors +- [`KT-14500`](https://youtrack.jetbrains.com/issue/KT-14500) Create from Usage: Suggest functional type based on the call with lambda argument and unresolved invoke() +- [`KT-14459`](https://youtrack.jetbrains.com/issue/KT-14459) Initialize with Constructor Parameter: Fix IDE freeze on properties in generic class +- [`KT-14044`](https://youtrack.jetbrains.com/issue/KT-14044) Fix exception on deleting unused declaration in IDEA 2016.3 +- [`KT-14019`](https://youtrack.jetbrains.com/issue/KT-14019) Create from Usage: Support generation of abstract members for superclasses +- [`KT-14246`](https://youtrack.jetbrains.com/issue/KT-14246) Intentions: Convert function type parameter to receiver +- [`KT-14246`](https://youtrack.jetbrains.com/issue/KT-14246) Intentions: Convert function type receiver to parameter + +##### New features + +- [`KT-14729`](https://youtrack.jetbrains.com/issue/KT-14729) Implement "Add names to call arguments" intention +- [`KT-11760`](https://youtrack.jetbrains.com/issue/KT-11760) Create from Usage: Support adding type parameters to the referenced type + +#### Refactorings + +- [`KT-14583`](https://youtrack.jetbrains.com/issue/KT-14583) Change Signature: Use new signature when looking for redeclaration conflicts +- [`KT-14854`](https://youtrack.jetbrains.com/issue/KT-14854) Extract Interface: Fix NPE on dialog opening +- [`KT-14814`](https://youtrack.jetbrains.com/issue/KT-14814) Rename: Fix renaming of .kts file to .kt and vice versa +- [`KT-14361`](https://youtrack.jetbrains.com/issue/KT-14361) Rename: Do not report redeclaration conflict for private top-level declarations located in different files +- [`KT-14596`](https://youtrack.jetbrains.com/issue/KT-14596) Safe Delete: Fix exception on deleting Java class used in Kotlin import directive(s) +- [`KT-14325`](https://youtrack.jetbrains.com/issue/KT-14325) Rename: Fix exceptions on moving file with facade class to another package +- [`KT-14197`](https://youtrack.jetbrains.com/issue/KT-14197) Move: Fix callable reference processing when moving to another package +- [`KT-13781`](https://youtrack.jetbrains.com/issue/KT-13781) Extract Function: Do not wrap companion member references inside of the `with` call + +##### New features +- [`KT-14792`](https://youtrack.jetbrains.com/issue/KT-14792) Rename: Suggest respective parameter name for the local variable passed to function + +## 1.0.5 + +### IDE + +- [`KT-9125`](https://youtrack.jetbrains.com/issue/KT-9125) Support Type Hierarchy on references inside of super type call entries +- [`KT-13542`](https://youtrack.jetbrains.com/issue/KT-13542) Rename: Do not search parameter text occurrences outside of its containing declaration +- [`KT-8672`](https://youtrack.jetbrains.com/issue/KT-8672) Rename: Optimize search of parameter references in calls with named arguments +- [`KT-9285`](https://youtrack.jetbrains.com/issue/KT-9285) Rename: Optimize search of private class members +- [`KT-13589`](https://youtrack.jetbrains.com/issue/KT-13589) Use TODO() consistently in implementation stubs +- [`KT-13630`](https://youtrack.jetbrains.com/issue/KT-13630) Do not show Change Signature dialog when applying "Remove parameter" quick-fix +- Re-highlight only single function after local modifications +- [`KT-13474`](https://youtrack.jetbrains.com/issue/KT-13474) Fix performance of typing super call lambda +- Show "Variables and values captured in a closure" highlighting only for usages +- [`KT-13838`](https://youtrack.jetbrains.com/issue/KT-13838) Add file name to the presentation of private top-level declaration (Go to symbol, etc.) +- [`KT-14096`](https://youtrack.jetbrains.com/issue/KT-14096) Rename: When renaming Kotlin file outside of source root do not rename its namesake in a source root +- [`KT-13928`](https://youtrack.jetbrains.com/issue/KT-13928) Move Inner Class to Upper Level: Fix replacement of outer class instances used in inner class constructor calls +- [`KT-12556`](https://youtrack.jetbrains.com/issue/KT-12556) Allow using whitespaces and other symbols in "Generate -> Test Function" dialog +- [`KT-14122`](https://youtrack.jetbrains.com/issue/KT-14122) Generate 'toString()': Permit for data classes +- [`KT-12398`](https://youtrack.jetbrains.com/issue/KT-12398) Call Hierarchy: Show Kotlin usages of Java methods +- [`KT-13976`](https://youtrack.jetbrains.com/issue/KT-13976) Search Everywhere: Render function parameter types +- [`KT-13977`](https://youtrack.jetbrains.com/issue/KT-13977) Search Everywhere: Render extension type in prefix position +- Implement Kotlin facet + +#### Intention actions, inspections and quickfixes + +- [`KT-9490`](https://youtrack.jetbrains.com/issue/KT-9490) Convert receiver to parameter: use template instead of the dialog +- [`KT-11483`](https://youtrack.jetbrains.com/issue/KT-11483) Move to Companion: Do not use qualified names as labels +- [`KT-13874`](https://youtrack.jetbrains.com/issue/KT-13874) Move to Companion: Fix AssertionError on running refactoring from Conflicts View +- [`KT-13883`](https://youtrack.jetbrains.com/issue/KT-13883) Move to Companion Object: Fix exception when applied to class +- [`KT-13876`](https://youtrack.jetbrains.com/issue/KT-13876) Move to Companion Object: Forbid for functions/properties referencing type parameters of the containing class +- [`KT-13877`](https://youtrack.jetbrains.com/issue/KT-13877) Move to Companion Object: Warn if companion object already contains function with the same signature +- [`KT-13933`](https://youtrack.jetbrains.com/issue/KT-13933) Convert Parameter to Receiver: Do not qualify companion members with labeled 'this' +- [`KT-13942`](https://youtrack.jetbrains.com/issue/KT-13942) Redundant 'toString()' in String Template: Disable for qualified expressions with 'super' receiver +- [`KT-13878`](https://youtrack.jetbrains.com/issue/KT-13878) Remove Redundant Receiver Parameter: Fix exception receiver removal +- [`KT-14143`](https://youtrack.jetbrains.com/issue/KT-14143) Create from Usages: Do not suggest on type-mismatched expressions which are not call arguments +- [`KT-13882`](https://youtrack.jetbrains.com/issue/KT-13882) Convert Receiver to Parameter: Fix AssertionError +- [`KT-14199`](https://youtrack.jetbrains.com/issue/KT-14199) Add Library: Fix exception due to resolution being run in the "dumb mode" +- Convert Receiver to Parameter: Fix this replacement + +##### New features + +- [`KT-11525`](https://youtrack.jetbrains.com/issue/KT-11525) Implement "Create type parameter" quickfix +- [`KT-9931`](https://youtrack.jetbrains.com/issue/KT-9931) Implement "Remove unused assignment" quickfix +- [`KT-14245`](https://youtrack.jetbrains.com/issue/KT-14245) Implement "Convert enum to sealed class" intention +- [`KT-14245`](https://youtrack.jetbrains.com/issue/KT-14245) Implement "Convert sealed class to enum" intention + +#### Refactorings + +- [`KT-13535`](https://youtrack.jetbrains.com/issue/KT-13535) Pull Up: Remove visibility modifiers on adding 'override' +- [`KT-13216`](https://youtrack.jetbrains.com/issue/KT-13216) Move: Report separate conflicts for each property accessor +- [`KT-13216`](https://youtrack.jetbrains.com/issue/KT-13216) Move: Forbid moving of enum entries +- [`KT-13553`](https://youtrack.jetbrains.com/issue/KT-13553) Move: Do not show directory selection dialog if target directory is already specified by drag-and-drop +- [`KT-8867`](https://youtrack.jetbrains.com/issue/KT-8867) Rename: Rename all overridden members if user chooses to refactor base declaration(s) +- Pull Up: Drop 'override' modifier if moved member doesn't override anything +- [`KT-13660`](https://youtrack.jetbrains.com/issue/KT-13660) Move: Do not drop object receivers when calling variable of extension functional type +- [`KT-13903`](https://youtrack.jetbrains.com/issue/KT-13903) Move: Remove companion object which becomes empty after the move +- [`KT-13916`](https://youtrack.jetbrains.com/issue/KT-13916) Move: Report visibility conflicts in import directives +- [`KT-13906`](https://youtrack.jetbrains.com/issue/KT-13906) Move Nested Class to Upper Level: Do not show directory selection dialog twice +- [`KT-13901`](https://youtrack.jetbrains.com/issue/KT-13901) Move: Do not ignore target directory selected in the dialog (DnD mode) +- [`KT-13904`](https://youtrack.jetbrains.com/issue/KT-13904) Move Nested Class to Upper Level: Preserve state of "Search in comments"/"Search for text occurrences" checkboxes +- [`KT-13909`](https://youtrack.jetbrains.com/issue/KT-13909) Move Files/Directories: Fix behavior of "Open moved files in editor" checkbox +- [`KT-14004`](https://youtrack.jetbrains.com/issue/KT-14004) Introduce Variable: Fix exception on trying to extract variable of functional type +- [`KT-13726`](https://youtrack.jetbrains.com/issue/KT-13726) Move: Fix bogus conflicts due to references resolving to wrong library version +- [`KT-14114`](https://youtrack.jetbrains.com/issue/KT-14114) Move: Fix exception on moving Kotlin file without declarations +- [`KT-14157`](https://youtrack.jetbrains.com/issue/KT-14157) Rename: Rename do-while loop variables in the loop condition +- [`KT-14128`](https://youtrack.jetbrains.com/issue/KT-14128), [`KT-13862`](https://youtrack.jetbrains.com/issue/KT-13862) Rename: Use qualified class name when looking for occurrences in non-code files +- [`KT-6199`](https://youtrack.jetbrains.com/issue/KT-6199) Rename: Replace non-code class occurrences with new qualified name +- [`KT-14182`](https://youtrack.jetbrains.com/issue/KT-14182) Move: Show error message on applying to enum entries +- Extract Function: Support implicit abnormal exits via Nothing-typed expressions +- [`KT-14285`](https://youtrack.jetbrains.com/issue/KT-14285) Rename: Forbid on backing field reference +- [`KT-14240`](https://youtrack.jetbrains.com/issue/KT-14240) Introduce Variable: Do not replace assignment left-hand sides +- [`KT-14234`](https://youtrack.jetbrains.com/issue/KT-14234) Rename: Do not suggest type-based names for functions with primitive return types + +##### New features + +- [`KT-13155`](https://youtrack.jetbrains.com/issue/KT-13155) Implement "Introduce Type Parameter" refactoring +- [`KT-11017`](https://youtrack.jetbrains.com/issue/KT-11017) Implement "Extract Superclass" refactoring +- [`KT-11017`](https://youtrack.jetbrains.com/issue/KT-11017) Implement "Extract Interface" refactoring +Pull Up: Support properties declared in the primary constructor +Pull Up: Support members declared in the companion object of the original class +Pull Up: Show member dependencies in the refactoring dialog +- [`KT-9485`](https://youtrack.jetbrains.com/issue/KT-9485) Push Down: Support moving members from Java to Kotlin class +- [`KT-13963`](https://youtrack.jetbrains.com/issue/KT-13963) Rename: Implement popup chooser for overriding members + +#### Android Lint + +###### Issues fixed + +- [`KT-12022`](https://youtrack.jetbrains.com/issue/KT-12022) Report lint warnings even when file contains errors + +## 1.0.4 + +### Compiler + +#### Analysis & diagnostics + +- [`KT-10968`](https://youtrack.jetbrains.com/issue/KT-10968), [`KT-11075`](https://youtrack.jetbrains.com/issue/KT-11075), [`KT-12286`](https://youtrack.jetbrains.com/issue/KT-12286) Type inference of callable references +- [`KT-11892`](https://youtrack.jetbrains.com/issue/KT-11892) Report error on qualified super call to a supertype extended by a different supertype +- [`KT-12875`](https://youtrack.jetbrains.com/issue/KT-12875) Report error on incorrect call of member extension invoke +- [`KT-12847`](https://youtrack.jetbrains.com/issue/KT-12847) Report error on accessing protected property setter from super class' companion +- [`KT-12322`](https://youtrack.jetbrains.com/issue/KT-12322) Overload resolution ambiguity with constructor reference when class has a companion object +- [`KT-11440`](https://youtrack.jetbrains.com/issue/KT-11440) Overload resolution ambiguity on specialized Map.put implementation from Java +- [`KT-11389`](https://youtrack.jetbrains.com/issue/KT-11389) Runtime exception when calling Java primitive overloadings +- [`KT-8200`](https://youtrack.jetbrains.com/issue/KT-8200) Exception when using non-generic interface with generic arguments +- [`KT-10237`](https://youtrack.jetbrains.com/issue/KT-10237) Exception on an unresolved symbol in a type parameter bound in the 'where' clause +- [`KT-11821`](https://youtrack.jetbrains.com/issue/KT-11821) Exception on incorrect number of generic arguments in a type parameter bound in the 'where' clause +- [`KT-12482`](https://youtrack.jetbrains.com/issue/KT-12482) Exception: Implementation doesn't have the most specific type, but none of the other overridden methods does either +- [`KT-12687`](https://youtrack.jetbrains.com/issue/KT-12687) Exception when 'data' modifier is applied to object +- [`KT-9620`](https://youtrack.jetbrains.com/issue/KT-9620) AssertionError in DescriptorResolver#checkBounds +- [`KT-3689`](https://youtrack.jetbrains.com/issue/KT-3689) IllegalAccess on a property with private setter of the subclass +- [`KT-6391`](https://youtrack.jetbrains.com/issue/KT-6391) Wrong warning for array casting (Array to Array) +- [`KT-8596`](https://youtrack.jetbrains.com/issue/KT-8596) Exception when analyzing nested class constructor reference in an argument position +- [`KT-12982`](https://youtrack.jetbrains.com/issue/KT-12982) Incorrect type inference when accessing mutable protected property via reflection +- [`KT-13206`](https://youtrack.jetbrains.com/issue/KT-13206) Report "Cast never succeeds" if and only if ClassCastException can be predicted +- [`KT-12467`](https://youtrack.jetbrains.com/issue/KT-12467) IllegalStateException: Concrete fake override should have exactly one concrete super-declaration: [] +- [`KT-13340`](https://youtrack.jetbrains.com/issue/KT-13340) Report "return is not allowed here" only on the return keyword, not the whole expression +- [`KT-2349`](https://youtrack.jetbrains.com/issue/KT-2349), [`KT-6054`](https://youtrack.jetbrains.com/issue/KT-6054) Report "uninitialized enum entry" if enum entry is referenced before its declaration +- [`KT-12809`](https://youtrack.jetbrains.com/issue/KT-12809) Report "uninitialized variable" if property is referenced before its declaration +- [`KT-260`](https://youtrack.jetbrains.com/issue/KT-260) Do not report "cast never succeeds" when casting nullable to nullable +- [`KT-11769`](https://youtrack.jetbrains.com/issue/KT-11769) Prohibit access from enum instance initialization code to members of enum's companion object +- [`KT-13371`](https://youtrack.jetbrains.com/issue/KT-13371) Fix CompilationException: Rewrite at slice LEAKING_THIS key: REFERENCE_EXPRESSION +- [`KT-13401`](https://youtrack.jetbrains.com/issue/KT-13401) Fix StackOverflowError when checking variance +- [`KT-13330`](https://youtrack.jetbrains.com/issue/KT-13330), [`KT-13349`](https://youtrack.jetbrains.com/issue/KT-13349) Fix AssertionError: Illegal resolved call to variable with invoke +- [`KT-13421`](https://youtrack.jetbrains.com/issue/KT-13421) Fix AssertionError: Only integer constants should be checked for overflow +- [`KT-13555`](https://youtrack.jetbrains.com/issue/KT-13555) Fix internal error "resolveToInstruction" +- [`KT-8989`](https://youtrack.jetbrains.com/issue/KT-8989) Change error messages: Replace "invisible_fake" with "invisible (private in a supertype)" +- [`KT-13612`](https://youtrack.jetbrains.com/issue/KT-13612) Val reassignment in try / catch +- [`KT-5469`](https://youtrack.jetbrains.com/issue/KT-5469) Incorrect "is never used" warning for value used in catch block +- [`KT-13510`](https://youtrack.jetbrains.com/issue/KT-13510) Missing "Nested class not allowed" error for anonymous object inside val initializer +- [`KT-13685`](https://youtrack.jetbrains.com/issue/KT-13685) Fix NPE when resolving callable references on incomplete code +- Change error messages: Fix quotes around keywords in diagnostic messages +- Change error messages: Remove quotes around visibilities + +#### Parser + +- [`KT-7118`](https://youtrack.jetbrains.com/issue/KT-7118) Improve error message after trailing dot in floating point literal +- [`KT-4948`](https://youtrack.jetbrains.com/issue/KT-4948) Recover by following keyword +- [`KT-7915`](https://youtrack.jetbrains.com/issue/KT-7915) Recover after val with no subsequent name +- [`KT-12987`](https://youtrack.jetbrains.com/issue/KT-12987) Recover after val with no name before declaration starting with soft keyword + +#### JVM code generation + +- [`KT-12909`](https://youtrack.jetbrains.com/issue/KT-12909) Do not generate redundant bridge for special built-in override +- [`KT-11915`](https://youtrack.jetbrains.com/issue/KT-11915) Exception in entrySet when Map implementation in Kotlin extends another one +- [`KT-12755`](https://youtrack.jetbrains.com/issue/KT-12755) Exception on property generation in multi-file classes +- [`KT-12983`](https://youtrack.jetbrains.com/issue/KT-12983) VerifyError: Bad type on operand stack in arraylength +- [`KT-12908`](https://youtrack.jetbrains.com/issue/KT-12908) Variable initialization in loop causes VerifyError: Bad local variable type +- [`KT-13040`](https://youtrack.jetbrains.com/issue/KT-13040) Invalid bytecode generated for extension lambda invocation with safe call +- [`KT-13023`](https://youtrack.jetbrains.com/issue/KT-13023) Char operations throw ClassCastException for boxed Chars +- [`KT-11634`](https://youtrack.jetbrains.com/issue/KT-11634) Exception for super call in delegation +- [`KT-12359`](https://youtrack.jetbrains.com/issue/KT-12359) Redundant stubs are generated on inheriting from java.util.Collection +- [`KT-11833`](https://youtrack.jetbrains.com/issue/KT-11833) Error generating constructors of class on anonymous object inheriting from nested class of super class +- [`KT-13133`](https://youtrack.jetbrains.com/issue/KT-13133) Incorrect InnerClasses attribute value for anonymous object copied from an inline function +- [`KT-13241`](https://youtrack.jetbrains.com/issue/KT-13241) Indices optimization leads to VerifyError with smart cast receiver +- [`KT-13374`](https://youtrack.jetbrains.com/issue/KT-13374) Fix compiler exception when inline function contains anonymous object implementing an interface by delegation + +##### Generated code performance + +- [`KT-11964`](https://youtrack.jetbrains.com/issue/KT-11964) No TABLESWITCH in when on enum bytecode if enum constant is imported +- [`KT-6916`](https://youtrack.jetbrains.com/issue/KT-6916) Optimize 'for' over 'downTo' +- [`KT-12733`](https://youtrack.jetbrains.com/issue/KT-12733) Optimize 'for' over 'rangeTo' as a non-qualified call + +### Standard Library + +- [`KT-13115`](https://youtrack.jetbrains.com/issue/KT-13115), [`KT-13297`](https://youtrack.jetbrains.com/issue/KT-13297) Improve documentation formatting, clarify documentation for `FileTreeWalk`, `Sequence` and `generateSequence`. +- [`KT-12894`](https://youtrack.jetbrains.com/issue/KT-12894) Do not fail in `Closeable.use` if the resource is `null`. + +### Reflection + +- [`KT-12915`](https://youtrack.jetbrains.com/issue/KT-12915) Runtime exception on callBy of JvmStatic function with default arguments +- [`KT-12967`](https://youtrack.jetbrains.com/issue/KT-12967) Runtime exception on reference to generic property +- [`KT-13370`](https://youtrack.jetbrains.com/issue/KT-13370) NullPointerException on companionObjectInstance of a built-in class +- [`KT-13462`](https://youtrack.jetbrains.com/issue/KT-13462) Make KClass for primitive type equal to the corresponding KClass for wrapper type + +### IDE + +- [`KT-12655`](https://youtrack.jetbrains.com/issue/KT-12655) New Kotlin file: extra error message for already existing file +- [`KT-12760`](https://youtrack.jetbrains.com/issue/KT-12760) Prohibit running non-Unit returning main function +- [`KT-12893`](https://youtrack.jetbrains.com/issue/KT-12893) Impossible to open Kotlin compiler settings +- [`KT-10433`](https://youtrack.jetbrains.com/issue/KT-10433) Copy-pasting reference to companion object member causes import dialog +- [`KT-12803`](https://youtrack.jetbrains.com/issue/KT-12803) Class is marked as unused when it is only used is in method reference +- [`KT-13084`](https://youtrack.jetbrains.com/issue/KT-13084) Run test method action executes all tests from same kotlin file +- [`KT-12718`](https://youtrack.jetbrains.com/issue/KT-12718) Deadlock due to index reentering +- [`KT-13114`](https://youtrack.jetbrains.com/issue/KT-13114) 'Unused declaration' option 'JUnit static methods' is always enabled +- [`KT-12997`](https://youtrack.jetbrains.com/issue/KT-12997) Override/Implement Members: Support "Copy JavaDoc" options for library classes +- [`KT-12887`](https://youtrack.jetbrains.com/issue/KT-12887) "Extend selection" should select call's invoked expression +- [`KT-13383`](https://youtrack.jetbrains.com/issue/KT-13383), [`KT-13379`](https://youtrack.jetbrains.com/issue/KT-13379) Override/Implement Members: Do not make return type non-nullable if base return type is explicitly nullable +- [`KT-13218`](https://youtrack.jetbrains.com/issue/KT-13218) Extract Function: Fix AssertionError on callable references +- [`KT-6520`](https://youtrack.jetbrains.com/issue/KT-6520) Introduce 'maino' and 'psvmo' templates for generating main in object +- [`KT-13455`](https://youtrack.jetbrains.com/issue/KT-13455) Override/Implement: Make return type non-nullable (platform collection case) when overriding Java method +- [`KT-10209`](https://youtrack.jetbrains.com/issue/KT-10209) Find Usages: Do not duplicate containing declaration in super member warning dialog +- [`KT-12977`](https://youtrack.jetbrains.com/issue/KT-12977) Hybrid dependency causes "outdated binary" warning to appear in non-js project +- [`KT-13057`](https://youtrack.jetbrains.com/issue/KT-13057) Go to inheritors on Enum should navigate to all enum classes +- Fix exception when choose Gradle configurer after project is synced +- Allow configuring Kotlin in Gradle module without Kotlin sources +- Show all Kotlin annotations when browsing hierarchy of "java.lang.Annotation" + +#### Completion + +- [`KT-12793`](https://youtrack.jetbrains.com/issue/KT-12793) Suggest abstract protected extension methods + +#### Performance + +- [`KT-12645`](https://youtrack.jetbrains.com/issue/KT-12645) Lazily calculate FQ name for local classes +- [`KT-13071`](https://youtrack.jetbrains.com/issue/KT-13071) Fix severe freezes because of long lint checks on large files + +#### Highlighting + +- [`KT-12937`](https://youtrack.jetbrains.com/issue/KT-12937) Java synthetic accessors highlighting does not differ from local variables + +#### KDoc + +- [`KT-12998`](https://youtrack.jetbrains.com/issue/KT-12998) Backslash is not rendered +- [`KT-12999`](https://youtrack.jetbrains.com/issue/KT-12999) Backtick inside inline code block is not rendered +- [`KT-13000`](https://youtrack.jetbrains.com/issue/KT-13000) Exclamation mark is not rendered +- [`KT-10398`](https://youtrack.jetbrains.com/issue/KT-10398) Fully qualified link is not resolved in editor +- [`KT-12932`](https://youtrack.jetbrains.com/issue/KT-12932) Link to library element is not clickable +- [`KT-10654`](https://youtrack.jetbrains.com/issue/KT-10654) Quick Doc can't follow KDoc link in referenced function description +- [`KT-9271`](https://youtrack.jetbrains.com/issue/KT-9271) Show Quick Doc for implicit lambda parameter 'it' + +#### Formatter + +- [`KT-12830`](https://youtrack.jetbrains.com/issue/KT-12830) Remove spaces before *?* in nullable types +- [`KT-13314`](https://youtrack.jetbrains.com/issue/KT-13314) Format spaces around !is and !in + +#### Intention actions, inspections and quickfixes + +##### New features + +- [`KT-12152`](https://youtrack.jetbrains.com/issue/KT-12152) "Leaking this" inspection reports dangerous operations inside constructors including: + + * Accessing non-final property in constructor + * Calling non-final function in constructor + * Using 'this' as function argument in constructor of non-final class + +- [`KT-13187`](https://youtrack.jetbrains.com/issue/KT-13187) "Make constructor parameter a val" should make the val private or public depending on its option +- [`KT-5771`](https://youtrack.jetbrains.com/issue/KT-5771) Mark setter parameter type as redundant and provide quickfix to remove it +- [`KT-9228`](https://youtrack.jetbrains.com/issue/KT-9228) Add quickfix to remove '@' from annotation used as argument of another annotation +- [`KT-12251`](https://youtrack.jetbrains.com/issue/KT-12251) Add quickfix to fix type mismatch for primitive literals +- [`KT-12838`](https://youtrack.jetbrains.com/issue/KT-12838) Add quickfix for "Illegal usage of inline parameter" that adds `noinline` +- [`KT-13134`](https://youtrack.jetbrains.com/issue/KT-13134) Add quickfix for wrong Long suffix (Use `L` instead of `l`) +- [`KT-10903`](https://youtrack.jetbrains.com/issue/KT-10903) Add intention to convert lambda to function reference +- [`KT-7492`](https://youtrack.jetbrains.com/issue/KT-7492) Support "Create abstract function/property" inside an abstract class +- [`KT-10668`](https://youtrack.jetbrains.com/issue/KT-10668) Support "Create member/extension" corresponding to the extension receiver of enclosing function +- [`KT-12553`](https://youtrack.jetbrains.com/issue/KT-12553) Show versions in inspection about different version of Kotlin plugin in Maven and IDE plugin +- [`KT-12489`](https://youtrack.jetbrains.com/issue/KT-12489) Implement intention to replace camel-case test function name with a space-separated one +- [`KT-12730`](https://youtrack.jetbrains.com/issue/KT-12730) Warn about using different versions of Kotlin Gradle plugin and bundled compiler +- [`KT-13173`](https://youtrack.jetbrains.com/issue/KT-13173) Handle more cases in "Add Const Modifier" Intention +- [`KT-12628`](https://youtrack.jetbrains.com/issue/KT-12628) Quickfix for `invoke` operator unsafe calls +- [`KT-11425`](https://youtrack.jetbrains.com/issue/KT-11425) Inspection and quickfix to replace usages of `equals()` and `compareTo()` with operators +- [`KT-13113`](https://youtrack.jetbrains.com/issue/KT-13113) Inspection to detect redundant string templates +- [`KT-13011`](https://youtrack.jetbrains.com/issue/KT-13011) Inspection and quickfix for unnecessary lateinit +- [`KT-10731`](https://youtrack.jetbrains.com/issue/KT-10731) Inspection and quickfix for unnecessary use of toString() inside string interpolation +- [`KT-12043`](https://youtrack.jetbrains.com/issue/KT-12043) Intention to add / remove braces for when entry/entries +- [`KT-13483`](https://youtrack.jetbrains.com/issue/KT-13483) Intention to replace `a..b-1` with `a until b` and vice versa +- [`KT-6975`](https://youtrack.jetbrains.com/issue/KT-6975) Quickfix for adding 'inline' to a function with reified generic + +##### Bugfixes + +- Show receiver type in the text of "Create extension" quick fix +- Show target class name in the text of "Create member" quick fix +- [`KT-12869`](https://youtrack.jetbrains.com/issue/KT-12869) Usages of overridden Java method through synthetic accessors are not found +- [`KT-12813`](https://youtrack.jetbrains.com/issue/KT-12813) "Find Usages" for property returns function calls +- [`KT-7722`](https://youtrack.jetbrains.com/issue/KT-7722) Approximate unresolvable types in "Create from Usage" quickfixes +- [`KT-11115`](https://youtrack.jetbrains.com/issue/KT-11115) Implement Members: Fix base member detection when abstract and non-abstract members with matching signatures are inherited from an interface +- [`KT-12876`](https://youtrack.jetbrains.com/issue/KT-12876) Bogus suggestion to move property to constructor +- [`KT-13055`](https://youtrack.jetbrains.com/issue/KT-13055) Exception in "Specify Type Explicitly" intention +- [`KT-12942`](https://youtrack.jetbrains.com/issue/KT-12942) "Replace 'when' with 'if'" intention changes semantics when 'if' statements are used +- [`KT-12646`](https://youtrack.jetbrains.com/issue/KT-12646) 'Convert to block body' should use partial body resolve +- [`KT-12919`](https://youtrack.jetbrains.com/issue/KT-12919) Use simple class name in "Change function return type" quickfix +- [`KT-13151`](https://youtrack.jetbrains.com/issue/KT-13151) Incorrect warning "Make variable immutable" +- [`KT-13170`](https://youtrack.jetbrains.com/issue/KT-13170) "Declaration has platform type" inspection: by default should not be reported for platform type arguments +- [`KT-13262`](https://youtrack.jetbrains.com/issue/KT-13262) "Wrap with safe let call" quickfix produces wrong result for qualified function +- [`KT-13364`](https://youtrack.jetbrains.com/issue/KT-13364) Do not suggest creating annotations/enum classes for unresolved type parameter bounds +- [`KT-12627`](https://youtrack.jetbrains.com/issue/KT-12627) Allow warnings suppression for secondary constructor +- [`KT-13365`](https://youtrack.jetbrains.com/issue/KT-13365) Disable "Create property" (non-abstract) in interfaces. Make "Create function" (non-abstract) generate function body in interfaces +- [`KT-8903`](https://youtrack.jetbrains.com/issue/KT-8903) Remove Unused Receiver: update function/property usages +- [`KT-11799`](https://youtrack.jetbrains.com/issue/KT-11799) Create from Usage: Make extension functions/properties 'private' by default +- [`KT-11795`](https://youtrack.jetbrains.com/issue/KT-11795) Create from Usage: Place extension properties after the usage and generate stub getter +- [`KT-12951`](https://youtrack.jetbrains.com/issue/KT-12951) Prohibit "Convert to expression body" when function body is 'if' without 'else' or 'when' is non-exhaustive +- [`KT-13430`](https://youtrack.jetbrains.com/issue/KT-13430) "Add non-null asserted (!!) call" quickfix can't process unary operators +- [`KT-13336`](https://youtrack.jetbrains.com/issue/KT-13336) "Convert concatenation to template" intention appends literal to variable omitting braces +- [`KT-13328`](https://youtrack.jetbrains.com/issue/KT-13328) Do not suggest "Replace infix with safe call" inside conditions or binary / unary expressions +- [`KT-13452`](https://youtrack.jetbrains.com/issue/KT-13452) "Replace if expression with assignment" doesn't work for cascade if-else if-else +- [`KT-13184`](https://youtrack.jetbrains.com/issue/KT-13184) "Different Kotlin Version" inspection: false positive caused by verbose plugin version name +- [`KT-13480`](https://youtrack.jetbrains.com/issue/KT-13480) "Can be replaced with comparison" inspection: false positive if extension method called 'equals' is used +- [`KT-13288`](https://youtrack.jetbrains.com/issue/KT-13288) "Unused property" inspection: false positive when extending abstract class and implementing interface +- [`KT-13432`](https://youtrack.jetbrains.com/issue/KT-13432) "Replace with safe call" quickfix does not work with `compareTo()` usage +- [`KT-13444`](https://youtrack.jetbrains.com/issue/KT-13444) "Invert if" intention changes semantics for nested if with return +- [`KT-13536`](https://youtrack.jetbrains.com/issue/KT-13536) Fix StackOverflowError from "Unused Symbol" inspection after importing enum's values() +- [`KT-12820`](https://youtrack.jetbrains.com/issue/KT-12820) Platform Type Inspection: !! quickfix shouldn't be available when any generic parameter has platform type +- [`KT-9825`](https://youtrack.jetbrains.com/issue/KT-9825) Incorrect "unused variable" warning when used in finally block +- [`KT-13715`](https://youtrack.jetbrains.com/issue/KT-13715) Prohibit applying "Change to star projection" to functional types + +#### Refactorings + +##### New features + +- [`KT-12017`](https://youtrack.jetbrains.com/issue/KT-12017) Inline Property: Support "Do not show this dialog" and "Inline this occurrence" options + +##### Bugfixes + +- [`KT-11176`](https://youtrack.jetbrains.com/issue/KT-11176) Add a space before '{' in functions generated "Generate hashCode/equals/toString" +- [`KT-12294`](https://youtrack.jetbrains.com/issue/KT-12294) Introduce Property: Fix extraction of expressions referring to primary constructor parameters +- [`KT-12413`](https://youtrack.jetbrains.com/issue/KT-12413) Change Signature: Fix bogus warning about unresolved type parameters/invalid functional type replacement +- [`KT-12084`](https://youtrack.jetbrains.com/issue/KT-12084) Introduce Property: Do not skip outer classes if extractable expression is contained in object literal +- [`KT-13082`](https://youtrack.jetbrains.com/issue/KT-13082) Rename: Fix exception on property rename preview +- [`KT-13207`](https://youtrack.jetbrains.com/issue/KT-13207) Safe delete: Fix exception when removing any function in 2016.2 +- [`KT-12945`](https://youtrack.jetbrains.com/issue/KT-12945) Rename: Fix function description in super method warning dialog +- [`KT-12922`](https://youtrack.jetbrains.com/issue/KT-12922) Introduce Variable: Do not suggest expressions without type +- [`KT-12943`](https://youtrack.jetbrains.com/issue/KT-12943) Rename: Show function signatures in "Rename Overloads" dialog +- [`KT-13157`](https://youtrack.jetbrains.com/issue/KT-13157) Extract Function: Automatically quote function name if necessary +- [`KT-13010`](https://youtrack.jetbrains.com/issue/KT-13010) Extract Function: Fix generation of destructuring declarations +- [`KT-13128`](https://youtrack.jetbrains.com/issue/KT-13128) Introduce Variable: Retain entered name after changing "Specify type explicitly" option +- [`KT-13054`](https://youtrack.jetbrains.com/issue/KT-13054) Introduce Variable: Skip leading/trailing comments inside selection +- [`KT-13385`](https://youtrack.jetbrains.com/issue/KT-13385) Move: Quote package name (if necessary) when moving declarations to new file +- [`KT-13395`](https://youtrack.jetbrains.com/issue/KT-13395) Introduce Property: Fix duplicate count in popup window +- [`KT-13277`](https://youtrack.jetbrains.com/issue/KT-13277) Change Signature: Fix usage processing to prevent interfering with Python support plugin +- [`KT-13254`](https://youtrack.jetbrains.com/issue/KT-13254) Rename: Conflict detection for type parameters +- [`KT-13282`](https://youtrack.jetbrains.com/issue/KT-13282), [`KT-13283`](https://youtrack.jetbrains.com/issue/KT-13283) Rename: Fix name quoting for automatic renamers +- [`KT-13239`](https://youtrack.jetbrains.com/issue/KT-13239) Rename: Warn about function name conflicts +- [`KT-13174`](https://youtrack.jetbrains.com/issue/KT-13174) Move: Warn about accessibility conflicts due to moving to unrelated module +- [`KT-13175`](https://youtrack.jetbrains.com/issue/KT-13175) Move: Warn about accessibility conflicts when moving entire file +- [`KT-13240`](https://youtrack.jetbrains.com/issue/KT-13240) Rename: Do not report shadowing conflict if redeclaration is detected +- [`KT-13253`](https://youtrack.jetbrains.com/issue/KT-13253) Rename: Report conflicts for constructor parameters +- [`KT-12971`](https://youtrack.jetbrains.com/issue/KT-12971) Push Down: Do not specifiy visibility on generated overriding members +- [`KT-13124`](https://youtrack.jetbrains.com/issue/KT-13124) Pull Up: Skip super members without explicit declarations +- [`KT-13032`](https://youtrack.jetbrains.com/issue/KT-13032) Rename: Support accessors with non-conventional names +- [`KT-13463`](https://youtrack.jetbrains.com/issue/KT-13463) Rename: Quote parameter name when necessary +- [`KT-13476`](https://youtrack.jetbrains.com/issue/KT-13476) Rename: Fix parameter rename when new name matches call selector +- [`KT-9381`](https://youtrack.jetbrains.com/issue/KT-9381) Rename: Do not search for component convention usages +- [`KT-13488`](https://youtrack.jetbrains.com/issue/KT-13488) Rename: Support rename of packages with non-standard quoted names + +#### Debugger + +##### New features + +- [`KT-7549`](https://youtrack.jetbrains.com/issue/KT-7549) Provide an option to use the Kotlin syntax when evaluating watches and expressions in Java files + +##### Bugfixes + +- [`KT-13059`](https://youtrack.jetbrains.com/issue/KT-13059) Fix error stepping on *Step Over* action in the end of while block +- [`KT-13037`](https://youtrack.jetbrains.com/issue/KT-13037) Fix possible deadlock in debugger in 2016.1 and exception in 2016.2 +- [`KT-12651`](https://youtrack.jetbrains.com/issue/KT-12651) Fix exception in evaluate expression when bad identifier is used for marking object +- [`KT-12896`](https://youtrack.jetbrains.com/issue/KT-12896) Fix "Step In" to inline functions for Android +- [`KT-13269`](https://youtrack.jetbrains.com/issue/KT-13269) Make quick evaluate work on receiver in qualified expressions +- [`KT-12641`](https://youtrack.jetbrains.com/issue/KT-12641) Unknown error on evaluate expression containing inline functions with complicated environment +- [`KT-13163`](https://youtrack.jetbrains.com/issue/KT-13163) Fix exception when evaluating expression: Access is allowed from event dispatch thread only. + +### JS + +#### New features + +- [`KT-3008`](https://youtrack.jetbrains.com/issue/KT-3008) Option to generate require.js and AMD compatible modules +- [`KT-5987`](https://youtrack.jetbrains.com/issue/KT-5987) Add ability to refer to class +- [`KT-4115`](https://youtrack.jetbrains.com/issue/KT-4115) Provide method to get Kotlin type name + +#### Bugfixes + +- [`KT-8003`](https://youtrack.jetbrains.com/issue/KT-8003) Compiler exception on 'throw throw' +- [`KT-8318`](https://youtrack.jetbrains.com/issue/KT-8318) Wrong result for 'when' containing only 'else' block +- [`KT-12157`](https://youtrack.jetbrains.com/issue/KT-12157) Compiler exception on `when` condition containing `return`, `break` or `continue` +- [`KT-12275`](https://youtrack.jetbrains.com/issue/KT-12275) Fix code generation with inline function call in condition of `while`/`do..while` +- [`KT-13160`](https://youtrack.jetbrains.com/issue/KT-13160) Fix compiler exception when left-hand side of assignment is array access and right-hand side is inline function +- [`KT-12864`](https://youtrack.jetbrains.com/issue/KT-12864) Make enums comparable +- [`KT-12865`](https://youtrack.jetbrains.com/issue/KT-12865) Implementing Comparable breaks inheritance +- [`KT-12928`](https://youtrack.jetbrains.com/issue/KT-12928) Nested inline causes undefined reference access +- [`KT-12929`](https://youtrack.jetbrains.com/issue/KT-12929) Code with callable reference crashed at runtime (in some JS VMs) +- [`KT-13043`](https://youtrack.jetbrains.com/issue/KT-13043) Invalid invocation generated for secondary constructor that calls constructor from base class with default parameters +- [`KT-13025`](https://youtrack.jetbrains.com/issue/KT-13025) 'function?.invoke' does not work properly with extension functions +- [`KT-12807`](https://youtrack.jetbrains.com/issue/KT-12807) Lambda was lost in generated code +- [`KT-12808`](https://youtrack.jetbrains.com/issue/KT-12808) Compiler duplicates arguments and the body of lambda when lambda is in RHS of assignment operator +- [`KT-12873`](https://youtrack.jetbrains.com/issue/KT-12873) Fix ReferenceError when class delegates to complex expression +- [`KT-13658`](https://youtrack.jetbrains.com/issue/KT-13658) Wrong code when capturing object + + +### Tools + +#### Gradle + +- Gradle versions < 2.0 are not supported +- [`KT-13234`](https://youtrack.jetbrains.com/issue/KT-13234) Setting kotlinOptions.destination and kotlinOptions.classpath is deprecated +- [`KT-9392`](https://youtrack.jetbrains.com/issue/KT-9392) Kotlin classes are missing after converting Java class to Kotlin +- [`KT-12736`](https://youtrack.jetbrains.com/issue/KT-12736) Kotlin classes are deleted when generated Java source is changed +- [`KT-12658`](https://youtrack.jetbrains.com/issue/KT-12658) Build fails after android resources are edited +- [`KT-12750`](https://youtrack.jetbrains.com/issue/KT-12750) Non clean compilation fails with gradle 2.14 +- [`KT-12912`](https://youtrack.jetbrains.com/issue/KT-12912) New class from subproject is unresolved with subsequent build with Gradle Daemon +- [`KT-12962`](https://youtrack.jetbrains.com/issue/KT-12962) Incremental compilation: Track changes in generated files +- [`KT-12923`](https://youtrack.jetbrains.com/issue/KT-12923) Incremental compilation: Compile error when code using internal class is modified +- [`KT-13528`](https://youtrack.jetbrains.com/issue/KT-13528) Incremental compilation: support multi-project incremental compilation +- [`KT-13732`](https://youtrack.jetbrains.com/issue/KT-13732) Android Build folder littered with `copyFlavourTypeXXX` + +#### KAPT + +##### New features + +- [`KT-13499`](https://youtrack.jetbrains.com/issue/KT-13499) Implement Annotation Processing API (JSR 269) natively in Kotlin + +##### Bugfixes + +- [`KT-12776`](https://youtrack.jetbrains.com/issue/KT-12776) Android build fails with KAPT and generateStubs depending on library module names +- [`KT-13179`](https://youtrack.jetbrains.com/issue/KT-13179) Java is recompiled every time with Gradle 2.14 and KAPT +- [`KT-12303`](https://youtrack.jetbrains.com/issue/KT-12303), [`KT-12113`](https://youtrack.jetbrains.com/issue/KT-12113) Do not pass non-relevant annotations to processors + +#### REPL + +- [`KT-12389`](https://youtrack.jetbrains.com/issue/KT-12389) REPL just quits when toString() of user class throws an exception + +#### CLI & Ant + +- [`KT-13237`](https://youtrack.jetbrains.com/issue/KT-13237) Include kotlin-reflect.jar to classpath by default, add '-no-reflect' key to suppress this behavior + +#### CLI + +- [`KT-13491`](https://youtrack.jetbrains.com/issue/KT-13491) Support '-no-reflect' in 'kotlin' command + +#### Maven + +- [`KT-13211`](https://youtrack.jetbrains.com/issue/KT-13211) Provide better compilation failure info for TeamCity builds + +#### Compiler daemon + +- Fix exception "java.lang.NoClassDefFoundError: Could not initialize class kotlin.Unit" + +## 1.0.3 + +### Compiler + +#### Analysis & diagnostics + +- Combination of `open` and `override` is no longer a warning +- [`KT-4829`](https://youtrack.jetbrains.com/issue/KT-4829) Equal conditions in `when` is now a warning +- [`KT-6611`](https://youtrack.jetbrains.com/issue/KT-6611) "This cast can never succeed" warning is no longer reported for `Foo as Foo` +- [`KT-7174`](https://youtrack.jetbrains.com/issue/KT-7174) Declaring members with the same signature as non-overridable methods from Java classes (like Object.wait/notify) is now an error (when targeting JVM) +- [`KT-12302`](https://youtrack.jetbrains.com/issue/KT-12302) `abstract` modifier for a member of interface is no longer a warning +- [`KT-12452`](https://youtrack.jetbrains.com/issue/KT-12452) `open` modifier for a member of interface without implementation is now a warning +- [`KT-11111`](https://youtrack.jetbrains.com/issue/KT-11111) Overriding by inline function is now a warning, overriding by a function with reified type parameter is an error +- [`KT-12337`](https://youtrack.jetbrains.com/issue/KT-12337) Reference to a property with invisible setter now has KProperty type (as opposed to KMutableProperty) + +###### Issues fixed + +- [`KT-4285`](https://youtrack.jetbrains.com/issue/KT-4285) No warning for a non-tail call when the method inherits default arguments from superclass +- [`KT-4764`](https://youtrack.jetbrains.com/issue/KT-4764) Spurious "Variable must be initialized" in try/catch/finally +- [`KT-6665`](https://youtrack.jetbrains.com/issue/KT-6665) Unresolved reference leads to marking subsequent code unreachable +- [`KT-11750`](https://youtrack.jetbrains.com/issue/KT-11750) Exceptions when creating various entries with the name "name" in enums +- [`KT-11998`](https://youtrack.jetbrains.com/issue/KT-11998) Smart cast to not-null is not performed on a boolean property in `if` condition +- [`KT-10648`](https://youtrack.jetbrains.com/issue/KT-10648) Exhaustiveness check does not work when sealed class hierarchy contains intermediate sealed classes +- [`KT-10717`](https://youtrack.jetbrains.com/issue/KT-10717) Type inference for lambda with local return +- [`KT-11266`](https://youtrack.jetbrains.com/issue/KT-11266) Fixed "Empty intersection of types" internal compiler error for some cases +- [`KT-11857`](https://youtrack.jetbrains.com/issue/KT-11857) Fix visibility check for dynamic members within protected method (when targeting JS) +- [`KT-12589`](https://youtrack.jetbrains.com/issue/KT-12589) Improved "`infix` modifier is inapplicable" diagnostic message +- [`KT-11679`](https://youtrack.jetbrains.com/issue/KT-11679) Erroneous call with argument causes Throwable at ResolvedCallImpl.getArgumentMapping() +- [`KT-12623`](https://youtrack.jetbrains.com/issue/KT-12623) Fix ISE on malformed code + +#### JVM code generation + +- [`KT-5075`](https://youtrack.jetbrains.com/issue/KT-5075) Optimize array/collection indices usage in `for` loop +- [`KT-11116`](https://youtrack.jetbrains.com/issue/KT-11116) Optimize coercion to Unit, POP operations are backward-propagated + +###### Issues fixed +- [`KT-11499`](https://youtrack.jetbrains.com/issue/KT-11499) Compiler crashes with "Incompatible stack heights" +- [`KT-11943`](https://youtrack.jetbrains.com/issue/KT-11943) CompilationException with extension property of KClass +- [`KT-12125`](https://youtrack.jetbrains.com/issue/KT-12125) Wrong increment/decrement on Byte/Char/Short.MAX_VALUE/MIN_VALUE +- [`KT-12192`](https://youtrack.jetbrains.com/issue/KT-12192) Exhaustiveness check isn't generated for when expression returning Unit +- [`KT-12200`](https://youtrack.jetbrains.com/issue/KT-12200) Erroneously optimized away assignment to a property initialized to zero +- [`KT-12582`](https://youtrack.jetbrains.com/issue/KT-12582) "VerifyError: Bad local variable type" caused by explicit loop variable type +- [`KT-12708`](https://youtrack.jetbrains.com/issue/KT-12708) Bridge method not generated when data class implements interface with copy() method +- [`KT-12106`](https://youtrack.jetbrains.com/issue/KT-12106) import static of reified companion object method throws IllegalAccessError + +#### Performance + +- Reduced number of IO operation when loading kotlin compiled classes + +#### Сompiler options + +- Allow to specify version of Kotlin language for source compatibility with older releases. + - CLI: `-language-version` command line option + - Maven: `languageVersion` configuration parameter, linked with `kotlin.compiler.languageVersion` property + - Gradle: `kotlinOptions.languageVersion` property in task configuration +- Allow to specify which java runtime target version to generate bytecode for. + - CLI: `-jvm-target` command line option + - Maven: `jvmTarget` configuration parameter, linked with `kotlin.compiler.jvmTarget` property + - Gradle: `kotlinOptions.jvmTarget` property in task configuration +- Allow to specify path to JDK to resolve classes from. + - CLI: `-jdk-home` command line option + - Maven: `jdkHome` configuration parameter, linked with `kotlin.compiler.jdkHome` property + - Gradle: `kotlinOptions.jdkHome` property in task configuration + +### Standard Library + +- Improve documentation (including [`KT-11632`](https://youtrack.jetbrains.com/issue/KT-11632)) +- List iteration used in collection operations is performed with an indexed loop when the list supports `RandomAccess` and the operation isn't inlined + +### IDE + +#### Completion + +###### New features + +- Smart completion after `by` and `in` +- Improved completion in bodies of overridden members (when no type is specified) +- Improved presentation of completion items for property accessors +- Fixed keyword completion after `try` in assignment expression +- [`KT-8527`](https://youtrack.jetbrains.com/issue/KT-8527) Include non-imported declarations on the first completion +- [`KT-12068`](https://youtrack.jetbrains.com/issue/KT-12068) Special completion item for "[]" get-operator access +- [`KT-12080`](https://youtrack.jetbrains.com/issue/KT-12080) Parameter names are now higher up in completion list + +###### Issues fixed +- Fixed enum members being present in completion as static members +- Fixed QuickDoc not working for properties generated for java classes +- [`KT-9166`](https://youtrack.jetbrains.com/issue/KT-9166) Code completion does not work for synthetic java properties on typing "g" +- [`KT-11609`](https://youtrack.jetbrains.com/issue/KT-11609) No named arguments completion should be after dot +- [`KT-11633`](https://youtrack.jetbrains.com/issue/KT-11633) Wrong indentation after completing a statement in data class +- [`KT-11680`](https://youtrack.jetbrains.com/issue/KT-11680) Code completion of label for existing return with value inserts redundant whitespace +- [`KT-11784`](https://youtrack.jetbrains.com/issue/KT-11784) Completion for `if` statement should add parentheses automatically +- [`KT-11890`](https://youtrack.jetbrains.com/issue/KT-11890) Completion for callable references does not propose static Java members +- [`KT-11912`](https://youtrack.jetbrains.com/issue/KT-11912) String interpolation is not converted to ${} form when accessing this.property +- [`KT-11957`](https://youtrack.jetbrains.com/issue/KT-11957) No `catch` and `finally` keywords in completion +- [`KT-12103`](https://youtrack.jetbrains.com/issue/KT-12103) Smart completion for nested SAM-adapter produces short unresolved name +- [`KT-12138`](https://youtrack.jetbrains.com/issue/KT-12138) Do not show "::error" in smart completion when any function type accepting one argument is expected +- [`KT-12150`](https://youtrack.jetbrains.com/issue/KT-12150) Smart completion suggests to compare non-nullable with null +- [`KT-12124`](https://youtrack.jetbrains.com/issue/KT-12124) No code completion for a java property in a specific position +- [`KT-12299`](https://youtrack.jetbrains.com/issue/KT-12299) Completion: incorrect priority of property foo over method getFoo in Kotlin-only code +- [`KT-12328`](https://youtrack.jetbrains.com/issue/KT-12328) Qualified function name inserted when typing before `if` +- [`KT-12427`](https://youtrack.jetbrains.com/issue/KT-12427) Completion doesn't work for "@receiver:" annotation target +- [`KT-12447`](https://youtrack.jetbrains.com/issue/KT-12447) Don't use CompletionProgressIndicator in Kotlin plugin +- [`KT-12669`](https://youtrack.jetbrains.com/issue/KT-12669) Completion should show variant with `()` when there is default lambda +- [`KT-12369`](https://youtrack.jetbrains.com/issue/KT-12369) Pressing dot after class name should not cause insertion of constructor call + +#### Spring support + +###### New features + +- [`KT-11692`](https://youtrack.jetbrains.com/issue/KT-11692) Support Spring model diagrams for Kotlin classes +- [`KT-12079`](https://youtrack.jetbrains.com/issue/KT-12079) Support "Autowired members defined in invalid Spring bean" inspection on Kotlin declarations +- [`KT-12092`](https://youtrack.jetbrains.com/issue/KT-12092) Implement bean references in @Qualifier annotations +- [`KT-12135`](https://youtrack.jetbrains.com/issue/KT-12135) Automatically configure components based on `basePackageClasses` attribute of @ComponentScan +- [`KT-12136`](https://youtrack.jetbrains.com/issue/KT-12136) Implement package references inside of string literals +- [`KT-12139`](https://youtrack.jetbrains.com/issue/KT-12139) Support Spring configurations linked via @Import annotation +- [`KT-12278`](https://youtrack.jetbrains.com/issue/KT-12278) Implement Spring @Autowired inspection +- [`KT-12465`](https://youtrack.jetbrains.com/issue/KT-12465) Implement Spring @ComponentScan inspection + +###### Issues fixed + +- [`KT-12091`](https://youtrack.jetbrains.com/issue/KT-12091) Fixed unstable behavior of Spring line markers +- [`KT-12096`](https://youtrack.jetbrains.com/issue/KT-12096) Fixed rename of custom-named beans specified with Kotlin annotation +- [`KT-12117`](https://youtrack.jetbrains.com/issue/KT-12117) Group Kotlin classes from the same file in the Choose Bean dialog +- [`KT-12120`](https://youtrack.jetbrains.com/issue/KT-12120) Show autowiring candidates line markers for @Autowired-annotated constructors and constructor parameters +- [`KT-12122`](https://youtrack.jetbrains.com/issue/KT-12122) Fixed line marker popup on functions with @Qualifier-annotated parameters +- [`KT-12143`](https://youtrack.jetbrains.com/issue/KT-12143) Fixed "Spring Facet Code Configuration (Kotlin)" inspection description +- [`KT-12147`](https://youtrack.jetbrains.com/issue/KT-12147) Fixed exception on analyzing object declaration with @Component annotation +- [`KT-12148`](https://youtrack.jetbrains.com/issue/KT-12148) Warn about object declarations annotated with Spring `@Configuration`/`@Component`/etc. +- [`KT-12363`](https://youtrack.jetbrains.com/issue/KT-12363) Fixed "Autowired members defined in invalid Spring bean (Kotlin)" inspection description +- [`KT-12366`](https://youtrack.jetbrains.com/issue/KT-12366) Fixed exception on analyzing class declaration upon annotation typing +- [`KT-12384`](https://youtrack.jetbrains.com/issue/KT-12384) Fixed bean references in factory method calls + +#### Intention actions, inspections and quickfixes + +###### New features + +- New icon for "New -> Kotlin Activity" action +- "Change visibility on exposure" and "Make visible" fixes now support all possible visibilities +- [`KT-8477`](https://youtrack.jetbrains.com/issue/KT-8477) New inspection "Can be primary constructor property" with quick-fix +- [`KT-5010`](https://youtrack.jetbrains.com/issue/KT-5010) "Redundant semicolon" inspection with quickfix +- [`KT-9757`](https://youtrack.jetbrains.com/issue/KT-9757) Quickfix for "Unused lambda expression" warning +- [`KT-10844`](https://youtrack.jetbrains.com/issue/KT-10844) Quick fix to add crossinline modifier +- [`KT-11090`](https://youtrack.jetbrains.com/issue/KT-11090) "Add variance modifiers to type parameters" inspection +- [`KT-11255`](https://youtrack.jetbrains.com/issue/KT-11255) Move Element Left/Right actions +- [`KT-11450`](https://youtrack.jetbrains.com/issue/KT-11450) "Modality is redundant" inspection +- [`KT-11523`](https://youtrack.jetbrains.com/issue/KT-11523) "Add @JvmOverloads annotation" intention +- [`KT-11768`](https://youtrack.jetbrains.com/issue/KT-11768) "Introduce local variable" intention +- [`KT-11806`](https://youtrack.jetbrains.com/issue/KT-11806) Quick-fix to increase visibility for invisible member +- [`KT-11807`](https://youtrack.jetbrains.com/issue/KT-11807) Use function body template when generating overriding functions with default body +- [`KT-11864`](https://youtrack.jetbrains.com/issue/KT-11864) Suggest "Create function/secondary constructor" quick fix on argument type mismatch +- [`KT-11876`](https://youtrack.jetbrains.com/issue/KT-11876) Quickfix for "Extension function type is not allowed as supertype" error +- [`KT-11920`](https://youtrack.jetbrains.com/issue/KT-11920) "Increase visibility" and "Decrease visibility" quickfixes for exposed visibility errors +- [`KT-12089`](https://youtrack.jetbrains.com/issue/KT-12089) Quickfix "Make primary constructor parameter a property" +- [`KT-12121`](https://youtrack.jetbrains.com/issue/KT-12121) "Add `toString()` call" quickfix +- [`KT-11104`](https://youtrack.jetbrains.com/issue/KT-11104) New quickfixes for nullability problems: "Surround with null check" and "Wrap with safe let call" +- [`KT-12310`](https://youtrack.jetbrains.com/issue/KT-12310) New inspection "Member has platform type" with quickfix + +###### Issues fixed + +- Fixed "Convert property initializer getter" intention being available inside lambda initializer +- Improved message for "Can be declared as `val`" inspection +- [`KT-3797`](https://youtrack.jetbrains.com/issue/KT-3797) Quickfix to make a function abstract should not be offered for object members +- [`KT-11866`](https://youtrack.jetbrains.com/issue/KT-11866) Suggest "Create secondary constructor" when constructors exist but are not applicable +- [`KT-11482`](https://youtrack.jetbrains.com/issue/KT-11482) Fixed exception in "Move to companion object" intention +- [`KT-11483`](https://youtrack.jetbrains.com/issue/KT-11483) Pass implicit receiver as argument when moving member function to companion object +- [`KT-11512`](https://youtrack.jetbrains.com/issue/KT-11512) Allow choosing any source root in "Move file to directory" intention +- [`KT-10950`](https://youtrack.jetbrains.com/issue/KT-10950) Keep original file package name when moving top-level declarations to separate file (provided it's not ambiguous) +- [`KT-10174`](https://youtrack.jetbrains.com/issue/KT-10174) Optimize imports after applying "Move declaration to separate file" intention +- [`KT-11764`](https://youtrack.jetbrains.com/issue/KT-11764) Intention "Replace with a `forEach` function call should replace `continue` with `return@forEach` +- [`KT-11724`](https://youtrack.jetbrains.com/issue/KT-11724) False suggestion to replace with compound assignment +- [`KT-11805`](https://youtrack.jetbrains.com/issue/KT-11805) Invert if-condition intention breaks code in case of end of line comment +- [`KT-11811`](https://youtrack.jetbrains.com/issue/KT-11811) "Make protected" intention for a val declared in parameters of constructor +- [`KT-11710`](https://youtrack.jetbrains.com/issue/KT-11710) "Replace `if` with elvis operator": incorrect code generated for `if` expression +- [`KT-11849`](https://youtrack.jetbrains.com/issue/KT-11849) Replace explicit parameter with `it` changes the meaning of code because of the shadowing +- [`KT-11870`](https://youtrack.jetbrains.com/issue/KT-11870) "Replace with Elvis" refactoring doesn't change the variable type from T? to T +- [`KT-12069`](https://youtrack.jetbrains.com/issue/KT-12069) Specify language for all Kotlin code inspections +- [`KT-11366`](https://youtrack.jetbrains.com/issue/KT-11366) "object `Companion` is never used" warning in intellij +- [`KT-11275`](https://youtrack.jetbrains.com/issue/KT-11275) Inconsistent behaviour of "move lambda argument out of parentheses" intention action when using lambda calls with function arguments without parentheses +- [`KT-11594`](https://youtrack.jetbrains.com/issue/KT-11594) "Add non-null asserted (!!) call" applied to unsafe cast to nullable type causes AE at KtPsiFactory.createExpression() +- [`KT-11982`](https://youtrack.jetbrains.com/issue/KT-11982) False "Redundant final modifier" reported +- [`KT-12040`](https://youtrack.jetbrains.com/issue/KT-12040) "Replace when with if" produce invalid code for first entry which has comment +- [`KT-12204`](https://youtrack.jetbrains.com/issue/KT-12204) "Use classpath of module" option in existing Kotlin run configuration may be changed when a new run configuration is created +- [`KT-10635`](https://youtrack.jetbrains.com/issue/KT-10635) Don't mark private writeObject and readObject methods of Serializable classes as unused +- [`KT-11466`](https://youtrack.jetbrains.com/issue/KT-11466) "Make abstract" quick fix applies to outer class of object with accidentally abstract function +- [`KT-11120`](https://youtrack.jetbrains.com/issue/KT-11120) Constructor parameter/field reported as unused symbol even if it have `used` annotation +- [`KT-11974`](https://youtrack.jetbrains.com/issue/KT-11974) Invert if-condition intention loses comments +- [`KT-10812`](https://youtrack.jetbrains.com/issue/KT-10812) Globally unused constructors are not marked as such +- [`KT-11320`](https://youtrack.jetbrains.com/issue/KT-11320) Don't mark @BeforeClass (JUnit4) annotated functions as unused +- [`KT-12267`](https://youtrack.jetbrains.com/issue/KT-12267) "Change type" quick fix converts to Int for Long literal +- [`KT-11949`](https://youtrack.jetbrains.com/issue/KT-11949) Various problems fixed with "Constructor parameter is never used as a property" inspection +- [`KT-11716`](https://youtrack.jetbrains.com/issue/KT-11716) "Simply `for` using destructuring declaration" intention: incorrect behavior for data classes +- [`KT-12145`](https://youtrack.jetbrains.com/issue/KT-12145) "Simplify `for` using destructuring declaration" should work even when no variables declared inside loop +- [`KT-11933`](https://youtrack.jetbrains.com/issue/KT-11933) Entities used only by alias are marked as unused +- [`KT-12193`](https://youtrack.jetbrains.com/issue/KT-12193) Convert to block body isn't equivalent for when expressions returning Unit +- [`KT-10779`](https://youtrack.jetbrains.com/issue/KT-10779) Simplify `for` using destructing declaration: intention / inspection quick fix is available only when all variables are used +- [`KT-11281`](https://youtrack.jetbrains.com/issue/KT-11281) Fix exception on applying "Convert to class" intention to Java interface with Kotlin inheritor(s) +- [`KT-12285`](https://youtrack.jetbrains.com/issue/KT-12285) Fix exception on test class generation +- [`KT-12502`](https://youtrack.jetbrains.com/issue/KT-12502) Convert to expression body should be forbidden for non-exhaustive when returning Unit +- [`KT-12260`](https://youtrack.jetbrains.com/issue/KT-12260) ISE while replacing an operator with safe call +- [`KT-12649`](https://youtrack.jetbrains.com/issue/KT-12649) "Convert if to when" intention incorrectly deletes code +- [`KT-12671`](https://youtrack.jetbrains.com/issue/KT-12671) "Shot type" action: "Type is unknown" error on an invoked expression +- [`KT-12284`](https://youtrack.jetbrains.com/issue/KT-12284) Too wide applicability range for "Add braces to else" intention +- [`KT-11975`](https://youtrack.jetbrains.com/issue/KT-11975) "Invert if-condition" intention does not simplify `is` expression +- [`KT-12437`](https://youtrack.jetbrains.com/issue/KT-12437) "Replace explicit parameter" intention is suggested for parameter of inner lambda in presence of `it` from outer lambda +- [`KT-12290`](https://youtrack.jetbrains.com/issue/KT-12290) Navigate to the generated declaration when using "Implement abstract member" intention +- [`KT-12376`](https://youtrack.jetbrains.com/issue/KT-12376) Don't show "Package directive doesn't match file location" in injected code +- [`KT-12777`](https://youtrack.jetbrains.com/issue/KT-12777) Fix exception in "Create class" quickfix applied to unresolved references in type arguments + +#### Language injection + +- Apply injection for the literals in property initializer through property usages +- Enable injection from Java or Kotlin function declaration by annotating parameter with @Language annotation +- [`KT-2428`](https://youtrack.jetbrains.com/issue/KT-2428) Support basic use-cases of language injection for expressions marked with @Language annotation +- [`KT-11574`](https://youtrack.jetbrains.com/issue/KT-11574) Support predefined Java positions for language injection +- [`KT-11472`](https://youtrack.jetbrains.com/issue/KT-11472) Add comment or @Language annotation after "Inject language or reference" intention automatically + +#### Refactorings + +###### New features +- [`KT-6372`](https://youtrack.jetbrains.com/issue/KT-6372) Add name suggestions to Rename dialog +- [`KT-7851`](https://youtrack.jetbrains.com/issue/KT-7851) Respect naming conventions in automatic variable rename +- [`KT-8044`](https://youtrack.jetbrains.com/issue/KT-8044), [`KT-9432`](https://youtrack.jetbrains.com/issue/KT-9432) Support @JvmName annotation in rename refactoring +- [`KT-8512`](https://youtrack.jetbrains.com/issue/KT-8512) Support "Rename tests" options in Rename dialog +- [`KT-9168`](https://youtrack.jetbrains.com/issue/KT-9168) Support rename of synthetic properties +- [`KT-10578`](https://youtrack.jetbrains.com/issue/KT-10578) Support automatic test renaming for facade files +- [`KT-12657`](https://youtrack.jetbrains.com/issue/KT-12657) Rename implicit usages of annotation method `value` +- [`KT-12759`](https://youtrack.jetbrains.com/issue/KT-12759) Suggest renaming both property accessors with matching @JvmName when renaming one of them from Java + +###### Issues fixed +- [`KT-4791`](https://youtrack.jetbrains.com/issue/KT-4791) Rename overridden property and all its accessors on attempt to rename overriding accessor in Java code +- [`KT-6363`](https://youtrack.jetbrains.com/issue/KT-6363) Do not rename ambiguous references in import directives +- [`KT-6663`](https://youtrack.jetbrains.com/issue/KT-6663) Fixed rename of ambiguous import reference to class/function when some referenced declarations are not changed +- [`KT-8510`](https://youtrack.jetbrains.com/issue/KT-8510) Preserve "Search in comments and strings" and "Search for text occurrences" settings in Rename dialog +- [`KT-8541`](https://youtrack.jetbrains.com/issue/KT-8541), [`KT-8786`](https://youtrack.jetbrains.com/issue/KT-8786) Do now show 'Rename overloads' options if target function has no overloads +- [`KT-8544`](https://youtrack.jetbrains.com/issue/KT-8544) Show more detailed description in Rename dialog +- [`KT-8562`](https://youtrack.jetbrains.com/issue/KT-8562) Show conflicts dialog on attempt of redeclaration +- [`KT-8611`](https://youtrack.jetbrains.com/issue/KT-8732) Qualify class references to resolve rename conflicts when possible +- [`KT-8732`](https://youtrack.jetbrains.com/issue/KT-8732) Implement Rename conflict analysis and fixes for properties/parameters +- [`KT-8860`](https://youtrack.jetbrains.com/issue/KT-8860) Allow renaming class by constructor delegation call referencing primary constructor +- [`KT-8892`](https://youtrack.jetbrains.com/issue/KT-8892) Suggest renaming base declarations on overriding members in object literals +- [`KT-9156`](https://youtrack.jetbrains.com/issue/KT-9156) Quote non-identifier names in Kotlin references +- [`KT-9157`](https://youtrack.jetbrains.com/issue/KT-9157) Fixed in-place rename of Kotlin expression referring Java declaration +- [`KT-9241`](https://youtrack.jetbrains.com/issue/KT-9241) Do not replace Java references to synthetic component functions when renaming constructor parameter +- [`KT-9435`](https://youtrack.jetbrains.com/issue/KT-9435) Process property accessor usages (Java) in comments and string literals +- [`KT-9444`](https://youtrack.jetbrains.com/issue/KT-9444) Rename dialog: Allow typing any identifier without backquotes +- [`KT-9446`](https://youtrack.jetbrains.com/issue/KT-9446) Copy default parameter values to overriding function which is renamed while its base function is not +- [`KT-9649`](https://youtrack.jetbrains.com/issue/KT-9649) Constraint search scope of parameter declared in a private member +- [`KT-10033`](https://youtrack.jetbrains.com/issue/KT-10033) Qualify references to members of enum companions in case of conflict with enum entries +- [`KT-10713`](https://youtrack.jetbrains.com/issue/KT-10713) Skip read-only declarations when renaming parameters +- [`KT-10687`](https://youtrack.jetbrains.com/issue/KT-10687) Qualify property references to avoid shadowing by parameters +- [`KT-11903`](https://youtrack.jetbrains.com/issue/KT-11903) Update references to facade class when renaming file via matching top-level class +- [`KT-12411`](https://youtrack.jetbrains.com/issue/KT-12411) Fix package name quotation in Move refactoring +- [`KT-12543`](https://youtrack.jetbrains.com/issue/KT-12543) Qualify property references with `this` to avoid renaming conflicts +- [`KT-12732`](https://youtrack.jetbrains.com/issue/KT-12732) Copy default parameter values to overriding function which is renamed by Java reference while its base function is unchanged +- [`KT-12747`](https://youtrack.jetbrains.com/issue/KT-12747) Fix exception on file copy + +#### Java to Kotlin converter + +###### New features + +- [`KT-4727`](https://youtrack.jetbrains.com/issue/KT-4727) Convert Java code copied from browser or other sources + +###### Issues fixed + +- [`KT-11952`](https://youtrack.jetbrains.com/issue/KT-11952) Assertion failed in PropertyDetectionCache.get on conversion of access to Java constant of anonymous type +- [`KT-12046`](https://youtrack.jetbrains.com/issue/KT-12046) Recursive property setter +- [`KT-12039`](https://youtrack.jetbrains.com/issue/KT-12039) Static imports converted missing ".Companion" +- [`KT-12054`](https://youtrack.jetbrains.com/issue/KT-12054) Wrong conversion of `instanceof` checks with raw types +- [`KT-12045`](https://youtrack.jetbrains.com/issue/KT-12045) Convert `Object()` to `Any()` + +#### Android Lint + +###### Issues fixed + +- [`KT-12015`](https://youtrack.jetbrains.com/issue/KT-12015) False positive for Bundle.getInt() +- [`KT-12023`](https://youtrack.jetbrains.com/issue/KT-12023) "minSdk" lint check doesn't work for `as`/`is` +- [`KT-12674`](https://youtrack.jetbrains.com/issue/KT-12674) "Calling new methods on older versions" errors for inlined constants +- [`KT-12681`](https://youtrack.jetbrains.com/issue/KT-12681) Running lint from main menu: diagnostics reported for java source files only +- [`KT-12173`](https://youtrack.jetbrains.com/issue/KT-12173) False positive for "Toast created but not shown" inside SAM adapter +- [`KT-12895`](https://youtrack.jetbrains.com/issue/KT-12895) NoSuchMethodError thrown when saving a Kotlin file + +#### KDoc + +###### New features +- Support for @receiver tag + +###### Issues fixed +- Rendering of `_` and `*` standalone characters +- Rendering of code blocks +- [`KT-9933`](https://youtrack.jetbrains.com/issue/KT-9933) Indentation in code fragments is not preserved +- [`KT-10998`](https://youtrack.jetbrains.com/issue/KT-10998) Spaces around links are missing in return block +- [`KT-11791`](https://youtrack.jetbrains.com/issue/KT-11791) Markdown links rendering +- [`KT-12001`](https://youtrack.jetbrains.com/issue/KT-12001) Allow use of `@param` to document type parameter + +#### Maven support + +###### New features +- Inspections that check that kotlin IDEA plugin, kotlin Maven plugin and kotlin stdlib are of the same version +- [`KT-11643`](https://youtrack.jetbrains.com/issue/KT-11643) Inspections and intentions to fix erroneously configured Maven pom file +- [`KT-11701`](https://youtrack.jetbrains.com/issue/KT-11701) "Add Maven Dependency quick fix" in Kotlin source files +- [`KT-11743`](https://youtrack.jetbrains.com/issue/KT-11743) Intention to replace kotlin-test with kotlin-test-junit + +###### Issues fixed +- [`KT-9492`](https://youtrack.jetbrains.com/issue/KT-9492) Configuring multiple Maven Modules +- [`KT-11642`](https://youtrack.jetbrains.com/issue/KT-11642) Kotlin Maven configurator tags order +- [`KT-11436`](https://youtrack.jetbrains.com/issue/KT-11436) "Choose Configurator" control opens dialogs with inconsistent modality (linux) +- [`KT-11731`](https://youtrack.jetbrains.com/issue/KT-11731) Default maven integration doesn't include documentation +- [`KT-12568`](https://youtrack.jetbrains.com/issue/KT-12568) Execution configuration: file path completion works only in some sub-elements of +- [`KT-12558`](https://youtrack.jetbrains.com/issue/KT-12558) Configure Kotlin in Project: "Undo" should revert changes in all poms +- [`KT-12512`](https://youtrack.jetbrains.com/issue/KT-12512) "Different IDE and Maven plugin version" inspection is being invoked for non-tracked pom.xml files + +#### Debugger + +###### New features +- [`KT-11438`](https://youtrack.jetbrains.com/issue/KT-11438) Support navigation from stacktrace to inline function call site + +###### Issues fixed +- Do not step into inline lambda argument during step over inside inline function body +- Fix step over for inline argument with non-local return +- [`KT-12067`](https://youtrack.jetbrains.com/issue/KT-12067) Deadlock in Kotlin debugger is fixed +- [`KT-12232`](https://youtrack.jetbrains.com/issue/KT-12232) No code completion in Evaluate Expression and Throwable at CodeCompletionHandlerBase.invokeCompletion() +- [`KT-12137`](https://youtrack.jetbrains.com/issue/KT-12137) Evaluate expression: code completion/intention actions allows to use symbols from modules that are not referenced +- [`KT-12206`](https://youtrack.jetbrains.com/issue/KT-12206) NoSuchFieldError in Evaluate Expression on a property of a derived class +- [`KT-12678`](https://youtrack.jetbrains.com/issue/KT-12678) NoSuchFieldError in Evaluate Expression on accessing delegated property defined in other module +- [`KT-12773`](https://youtrack.jetbrains.com/issue/KT-12773) Fix debugging for Kotlin JS projects + +#### Formatter + +###### Issues fixed + +- [`KT-12035`](https://youtrack.jetbrains.com/issue/KT-12035) Spaces around `as` +- [`KT-12018`](https://youtrack.jetbrains.com/issue/KT-12018) Spaces between function name and arguments in infix calls +- [`KT-11961`](https://youtrack.jetbrains.com/issue/KT-11961) Spaces before angle bracket in method definition +- [`KT-12175`](https://youtrack.jetbrains.com/issue/KT-12175) Don't enforce empty line between secondary constructors without body +- [`KT-12548`](https://youtrack.jetbrains.com/issue/KT-12548) Spaces around `is` keyword +- [`KT-12446`](https://youtrack.jetbrains.com/issue/KT-12446) Spaces before class type parameters +- [`KT-12634`](https://youtrack.jetbrains.com/issue/KT-12634) Spaces between method name and parenthesis in method call +- [`KT-10680`](https://youtrack.jetbrains.com/issue/KT-10680) Spaces around `in` keyword +- [`KT-12791`](https://youtrack.jetbrains.com/issue/KT-12791) Spaces between curly brace and expression inside string template +- [`KT-12781`](https://youtrack.jetbrains.com/issue/KT-12781) Spaces between annotation and expression +- [`KT-12689`](https://youtrack.jetbrains.com/issue/KT-12689) Spaces around semicolons +- [`KT-12714`](https://youtrack.jetbrains.com/issue/KT-12714) Spaces around parentheses in enum elements + +#### Other + +###### New features + +- Added "Decompile" button to Kotlin bytecode toolwindow +- Added Kotlin "Tips of the day" +- Added "Kotlin 1.1 EAP" to "Configure Kotlin Plugin updates" +- [`KT-2919`](https://youtrack.jetbrains.com/issue/KT-2919) Constructor calls are no longer highlighted as classes +- [`KT-6540`](https://youtrack.jetbrains.com/issue/KT-6540) Infix function calls are now highlighted as regular function calls +- [`KT-9410`](https://youtrack.jetbrains.com/issue/KT-9410) Annotations in Kotlin are now highlighted with the same color as in Java by default +- [`KT-11465`](https://youtrack.jetbrains.com/issue/KT-11465) Type parameters in Kotlin are now highlighted with the same color as in Java by default +- [`KT-11657`](https://youtrack.jetbrains.com/issue/KT-11657) Allow viewing decompiled Java source code for Kotlin-compiled classes +- [`KT-11704`](https://youtrack.jetbrains.com/issue/KT-11704) Support file path references inside of Kotlin string literals +- [`KT-12076`](https://youtrack.jetbrains.com/issue/KT-12076) Kotlin Plugin update check: always display installed version number +- [`KT-11814`](https://youtrack.jetbrains.com/issue/KT-11814) New icon for kotlin annotation classes +- [`KT-12735`](https://youtrack.jetbrains.com/issue/KT-12735) Convert JavaDoc to KDoc when overriding Java class member in Kotlin + +###### Issues fixed + +- [`KT-5960`](https://youtrack.jetbrains.com/issue/KT-5960) Can't find usages for Java methods used from Kotlin by call convention +- [`KT-8362`](https://youtrack.jetbrains.com/issue/KT-8362) "New Kotlin file": Keywords should be escaped in package name +- [`KT-8682`](https://youtrack.jetbrains.com/issue/KT-8682) Respect "Copy JavaDoc" option in the "Override/Implement Members..." dialog +- [`KT-8817`](https://youtrack.jetbrains.com/issue/KT-8817) Fixed rename of Java getters/setters through synthetic property references in Kotlin +- [`KT-9399`](https://youtrack.jetbrains.com/issue/KT-9399) Find Usages omits Kotlin annotation parameter usage in Java source +- [`KT-9797`](https://youtrack.jetbrains.com/issue/KT-9797) "Kotlin Bytecode" toolwindow breaks after closing +- [`KT-11145`](https://youtrack.jetbrains.com/issue/KT-11145) Use progress indicator when searching usages in Introduce Parameter +- [`KT-11155`](https://youtrack.jetbrains.com/issue/KT-11155) Allow running multiple Kotlin classes as well as running mixtures of Kotlin and Java classes +- [`KT-11495`](https://youtrack.jetbrains.com/issue/KT-11495) Show recursion line markers for extension function calls with different receiver +- [`KT-11659`](https://youtrack.jetbrains.com/issue/KT-11659) Generate abstract overrides for Any members inside of Kotlin interfaces +- [`KT-12070`](https://youtrack.jetbrains.com/issue/KT-12070) Add empty line in error message of Maven and Gradle configuration +- [`KT-11908`](https://youtrack.jetbrains.com/issue/KT-11908) Allow properties with custom setters to be used in generated equals/hashCode/toString +- [`KT-11617`](https://youtrack.jetbrains.com/issue/KT-11617) Fixed title of Introduce Parameter declaration chooser +- [`KT-11817`](https://youtrack.jetbrains.com/issue/KT-11817) Fixed rename of Kotlin enum constants through Java references +- [`KT-11816`](https://youtrack.jetbrains.com/issue/KT-11816) Fixed usages search for Safe Delete on simple enum entries +- [`KT-11282`](https://youtrack.jetbrains.com/issue/KT-11282) Delete interface reference from super-type list when applying Safe Delete to Java interface +- [`KT-11967`](https://youtrack.jetbrains.com/issue/KT-11967) Fix Find Usages/Rename for parameter references in XML files +- [`KT-10770`](https://youtrack.jetbrains.com/issue/KT-10770) "Optimize imports" will not keep import if a type is only referenced by kdoc +- [`KT-11955`](https://youtrack.jetbrains.com/issue/KT-11955) Copy/Paste inserts fully qualified name when copying function with overloads +- [`KT-12436`](https://youtrack.jetbrains.com/issue/KT-12436) "Replace explicit parameter with it": java.lang.Exception at BaseRefactoringProcessor.run() +- [`KT-12440`](https://youtrack.jetbrains.com/issue/KT-12440) Removing unused parameter results in Exception "Refactorings should not be started inside write action" +- [`KT-12006`](https://youtrack.jetbrains.com/issue/KT-12006) getLanguageLevel is slow for Kotlin light classes +- [`KT-12026`](https://youtrack.jetbrains.com/issue/KT-12026) "Constant expression required" in Java for const Kotlin values +- [`KT-12259`](https://youtrack.jetbrains.com/issue/KT-12259) ClassCastException in light classes while trying to create generic property +- [`KT-12289`](https://youtrack.jetbrains.com/issue/KT-12289) Remove unnecessary `?` from `serr` live template +- [`KT-12110`](https://youtrack.jetbrains.com/issue/KT-12110) Map help button of the Compiler - Kotlin page +- [`KT-12075`](https://youtrack.jetbrains.com/issue/KT-12075) Kotlin Plugin update check: make dumbaware +- [`KT-10255`](https://youtrack.jetbrains.com/issue/KT-10255) call BuildManager.clearState(project) in apply() method of Kotlin Compiler Settings configurable +- [`KT-11841`](https://youtrack.jetbrains.com/issue/KT-11841) New Project / Module wizard, Gradle: pure Kotlin module is created without `repositories` call in build.gradle +- [`KT-11095`](https://youtrack.jetbrains.com/issue/KT-11095) Java cannot infer generic return type of Kotlin function (with java 8 language level) +- [`KT-12090`](https://youtrack.jetbrains.com/issue/KT-12090) Intellij/Kotlin plugin does not handle generic return type of static method defined in Kotlin, called from Java +- [`KT-12206`](https://youtrack.jetbrains.com/issue/KT-12206) Fix NoSuchFieldError on accessing base property without backing field in evaluate expression +- [`KT-12516`](https://youtrack.jetbrains.com/issue/KT-12516) File Structure: Kotlin annotation classes have Java annotation icons +- [`KT-11328`](https://youtrack.jetbrains.com/issue/KT-11328) "New Kotlin class": generates packages when fully qualified name is specified +- [`KT-11778`](https://youtrack.jetbrains.com/issue/KT-11778) Exception in Lombok plugin: Rewrite at slice FUNCTION +- [`KT-11708`](https://youtrack.jetbrains.com/issue/KT-11708) "Go to declaration" doesn't work on a call to function with SAM conversion on a derived type +- [`KT-12381`](https://youtrack.jetbrains.com/issue/KT-12381) Prefer not-nullable return type when overriding Java method without nullability annotation +- [`KT-12647`](https://youtrack.jetbrains.com/issue/KT-12647) Performance improvement for test-related line markers +- [`KT-12526`](https://youtrack.jetbrains.com/issue/KT-12526) Kotlin intentions increase PSI modification counts from isAvailable, even in daemon threads + +### Reflection + +###### Issues fixed +- [`KT-11531`](https://youtrack.jetbrains.com/issue/KT-11531) Optimize "KCallable.name" +- [`KT-10771`](https://youtrack.jetbrains.com/issue/KT-10771) Reflection on Function objects does not support lambdas with generic return type +- [`KT-11824`](https://youtrack.jetbrains.com/issue/KT-11824) Reflection inconsistency between member property and accessor + +### JS + +- Improve performance of maps and sets + +###### Issues fixed +- [`KT-6942`](https://youtrack.jetbrains.com/issue/KT-6942) Generate structural equality check (i.e. `Any.equals`) instead of referential check (===) value equality patterns in `when` +- [`KT-7228`](https://youtrack.jetbrains.com/issue/KT-7228) Wrong AbstractList signature +- [`KT-8299`](https://youtrack.jetbrains.com/issue/KT-8299) Wrong access to private member in autogenerated code in data class +- [`KT-11346`](https://youtrack.jetbrains.com/issue/KT-11346) Reified functions like `filterIsInstance` are now available in JS Standard Library +- [`KT-12305`](https://youtrack.jetbrains.com/issue/KT-12305) Incorrect translation of `vararg` in `@native` functions +- [`KT-12254`](https://youtrack.jetbrains.com/issue/KT-12254) JsEmptyExpression in initializer when compiling code like `val x = throw Exception()` +- [`KT-11960`](https://youtrack.jetbrains.com/issue/KT-11960) Wrong code generated when a method of a local class calls constructor of the class +- [`KT-10931`](https://youtrack.jetbrains.com/issue/KT-10931) Incorrect inlining of library method with optional parameters +- [`KT-12417`](https://youtrack.jetbrains.com/issue/KT-12417) Wrong check cast generated for KMutableProperty + +### Tools + +###### New features + +- [`KT-11839`](https://youtrack.jetbrains.com/issue/KT-11839) Maven goal to execute kotlin script + +###### Issues fixed + +- KAPT: fix error when using enum constructors with parameters +- Various problems with gradle 2.2 fixed: [`KT-12478`](https://youtrack.jetbrains.com/issue/KT-12478), [`KT-12406`](https://youtrack.jetbrains.com/issue/KT-12406), [`KT-12478`](https://youtrack.jetbrains.com/issue/KT-12478) +- [`KT-12595`](https://youtrack.jetbrains.com/issue/KT-12595) JPS: Fixed com.intellij.util.io.MappingFailedException: Cannot map buffer +- [`KT-11166`](https://youtrack.jetbrains.com/issue/KT-11166) Gradle: Unable to access internal classes from test code within the same module +- [`KT-12352`](https://youtrack.jetbrains.com/issue/KT-12352) KAPT: Fix "Classpath entry points to a non-existent location" warnings +- [`KT-12074`](https://youtrack.jetbrains.com/issue/KT-12074) Building Kotlin maven projects using a parent pom will silently fail +- [`KT-11770`](https://youtrack.jetbrains.com/issue/KT-11770) Warning "RuntimeException: Could not find installation home path" when using Gradle Incremental Compilation +- [`KT-10969`](https://youtrack.jetbrains.com/issue/KT-10969) Android extensions: NullPointerException when finding view in Fragment +- [`KT-11885`](https://youtrack.jetbrains.com/issue/KT-11885) Gradle/Android: Unresolved reference "kotlinx" when classpath dependency is defined in root build.gradle +- [`KT-12786`](https://youtrack.jetbrains.com/issue/KT-12786) Deprecation warning with Gradle 2.14 + +## 1.0.2-1 + +- [KT-12159](https://youtrack.jetbrains.com/issue/KT-12159), [KT-12406](https://youtrack.jetbrains.com/issue/KT-12406), [KT-12431](https://youtrack.jetbrains.com/issue/KT-12431), [KT-12478](https://youtrack.jetbrains.com/issue/KT-12478) Support Android Studio 2.2 +- [KT-11770](https://youtrack.jetbrains.com/issue/KT-11770) Fix warning "RuntimeException: Could not find installation home path" when using incremental compilation in Gradle +- [KT-12436](https://youtrack.jetbrains.com/issue/KT-12436), [KT-12440](https://youtrack.jetbrains.com/issue/KT-12440) Fix multiple exceptions during refactorings in IDEA 2016.2 EAP +- [KT-12015](https://youtrack.jetbrains.com/issue/KT-12015), [KT-12047](https://youtrack.jetbrains.com/issue/KT-12047), [KT-12387](https://youtrack.jetbrains.com/issue/KT-12387) Fix multiple issues in Kotlin Lint checks + +## 1.0.2 + +### Compiler + +#### Analysis & diagnostics + +- [KT-7437](https://youtrack.jetbrains.com/issue/KT-7437), [KT-7971](https://youtrack.jetbrains.com/issue/KT-7971), [KT-7051](https://youtrack.jetbrains.com/issue/KT-7051), [KT-6125](https://youtrack.jetbrains.com/issue/KT-6125), [KT-6186](https://youtrack.jetbrains.com/issue/KT-6186), [KT-11649](https://youtrack.jetbrains.com/issue/KT-11649) Implement missing checks for protected visibility +- [KT-11666](https://youtrack.jetbrains.com/issue/KT-11666) Report "Implicit nothing return type" on non-override member functions +- [KT-4328](https://youtrack.jetbrains.com/issue/KT-4328), [KT-11497](https://youtrack.jetbrains.com/issue/KT-11497), [KT-10493](https://youtrack.jetbrains.com/issue/KT-10493), [KT-10820](https://youtrack.jetbrains.com/issue/KT-10820), [KT-11368](https://youtrack.jetbrains.com/issue/KT-11368) Report error if some classes were not found due to missing or conflicting dependencies +- [KT-11280](https://youtrack.jetbrains.com/issue/KT-11280) Do not perform smart casts for values with custom `equals` compared with `==` +- [KT-3856](https://youtrack.jetbrains.com/issue/KT-3856) Fix wrong "inner class inaccessible" diagnostic for extension to outer class +- [KT-3896](https://youtrack.jetbrains.com/issue/KT-3896), [KT-3883](https://youtrack.jetbrains.com/issue/KT-3883), [KT-4986](https://youtrack.jetbrains.com/issue/KT-4986) `do...while (true)` is now considered an infinite loop +- [KT-10445](https://youtrack.jetbrains.com/issue/KT-10445) Prohibit initialization of captured `val` in lambda or in local function +- [KT-10042](https://youtrack.jetbrains.com/issue/KT-10042) Correctly handle local classes and anonymous objects in control flow analysis +- [KT-11043](https://youtrack.jetbrains.com/issue/KT-11043) Prohibit complex expressions with class literals in annotation arguments +- [KT-10992](https://youtrack.jetbrains.com/issue/KT-10992), [KT-11007](https://youtrack.jetbrains.com/issue/KT-11007) Fix multiple problems related to smart casts +- [KT-11490](https://youtrack.jetbrains.com/issue/KT-11490) Prohibit nested intersection types in return position +- [KT-11411](https://youtrack.jetbrains.com/issue/KT-11411) Report "illegal noinline/crossinline" on parameter of subtype of function type +- [KT-3083](https://youtrack.jetbrains.com/issue/KT-3083) Report "conflicting overloads" for functions with parameter of type parameter type +- [KT-7265](https://youtrack.jetbrains.com/issue/KT-7265) Parse anonymous functions in blocks as expressions +- [KT-8246](https://youtrack.jetbrains.com/issue/KT-8246) Handle break/continue for outer loop correctly in case of try/finally in between +- [KT-11300](https://youtrack.jetbrains.com/issue/KT-11300) Report error on increment or augmented assignment when `get` is an operator but `set` is not +- Report warning about unused anonymous functions +- Improve callable reference type in some ambiguous cases +- Improve multiple diagnostic messages: [KT-10761](https://youtrack.jetbrains.com/issue/KT-10761), [KT-9760](https://youtrack.jetbrains.com/issue/KT-9760), [KT-10949](https://youtrack.jetbrains.com/issue/KT-10949), [KT-9887](https://youtrack.jetbrains.com/issue/KT-9887), [KT-9550](https://youtrack.jetbrains.com/issue/KT-9550), [KT-11239](https://youtrack.jetbrains.com/issue/KT-11239), [KT-11819](https://youtrack.jetbrains.com/issue/KT-11819) +- Fix several compiler bugs leading to exceptions: [KT-9820](https://youtrack.jetbrains.com/issue/KT-9820), [KT-11597](https://youtrack.jetbrains.com/issue/KT-11597), [KT-10983](https://youtrack.jetbrains.com/issue/KT-10983), [KT-10972](https://youtrack.jetbrains.com/issue/KT-10972), [KT-11287](https://youtrack.jetbrains.com/issue/KT-11287), [KT-11492](https://youtrack.jetbrains.com/issue/KT-11492), [KT-11765](https://youtrack.jetbrains.com/issue/KT-11765), [KT-11869](https://youtrack.jetbrains.com/issue/KT-11869) + +#### JVM code generation + +- [KT-8269](https://youtrack.jetbrains.com/issue/KT-8269), [KT-9246](https://youtrack.jetbrains.com/issue/KT-9246), [KT-10143](https://youtrack.jetbrains.com/issue/KT-10143) Fix visibility of protected classes in bytecode +- [KT-11363](https://youtrack.jetbrains.com/issue/KT-11363) Fix potential binary compatibility breakage on using `when` over enums in inline functions +- [KT-11762](https://youtrack.jetbrains.com/issue/KT-11762) Fix VerifyError caused by explicit loop variable type +- [KT-11645](https://youtrack.jetbrains.com/issue/KT-11645) Fix NoSuchFieldError on private const property in multi-file class +- [KT-9670](https://youtrack.jetbrains.com/issue/KT-9670) Optimize Class <-> KClass wrapping/unwrapping when getting values from annotation +- [KT-6842](https://youtrack.jetbrains.com/issue/KT-6842) Optimize unnecessary boxing and interface calls on iterating over ranges +- [KT-11025](https://youtrack.jetbrains.com/issue/KT-11025) Don't inline const val properties in non-annotation contexts +- [KT-5429](https://youtrack.jetbrains.com/issue/KT-5429) Write nullability annotations on extension receiver parameters +- [KT-11347](https://youtrack.jetbrains.com/issue/KT-11347) Preserve source file and line number of call site when inlining certain standard library functions +- [KT-11677](https://youtrack.jetbrains.com/issue/KT-11677) Write correct generic signatures for local classes in inlined lambdas +- [KT-12127](https://youtrack.jetbrains.com/issue/KT-12127) Do not write unnecessary generic signature for property delegate backing field +- Fix multiple issues leading to exceptions or bad bytecode being generated: [KT-11034](https://youtrack.jetbrains.com/issue/KT-11034), [KT-11519](https://youtrack.jetbrains.com/issue/KT-11519), [KT-11117](https://youtrack.jetbrains.com/issue/KT-11117), [KT-11479](https://youtrack.jetbrains.com/issue/KT-11479) + +#### Java interoperability + +- [KT-3068](https://youtrack.jetbrains.com/issue/KT-3068) Load contravariantly projected collections in Java (`List`) as mutable collections in Kotlin (`MutableList`) +- [KT-11322](https://youtrack.jetbrains.com/issue/KT-11322) Do not lose type nullability information in SAM constructors +- [KT-11721](https://youtrack.jetbrains.com/issue/KT-11721) Fix wrong "Typechecker has run into recursive problem" error on calling Kotlin get function as synthetic Java property +- [KT-10691](https://youtrack.jetbrains.com/issue/KT-10691) Fix wrong "Inherited platform declarations clash" error on inheritance from generic Java class with overloaded methods + +#### Command line compiler + +- [KT-9546](https://youtrack.jetbrains.com/issue/KT-9546) Flush stdout and stderr before shutdown when executing scripts +- [KT-10605](https://youtrack.jetbrains.com/issue/KT-10605) Disable colored output on certain platforms to prevent crashes +- Report warning instead of error on unknown "-X" flags +- Remove the compiler option "Xmultifile-facades-open" + +#### Compiler daemon + +- Reduce read disk activity +- Fix compiler daemon JAR cache clearing on IDEA Ultimate + +### Standard library + +- [KT-11410](https://youtrack.jetbrains.com/issue/KT-11410) Reduce method count of the standard library by ~2k +- [KT-9990](https://youtrack.jetbrains.com/issue/KT-9990) Optimize snapshot operations to return special collection implementations when result is empty or has single element +- [KT-10794](https://youtrack.jetbrains.com/issue/KT-10794) EmptyList now implements RandomAccess +- [KT-10821](https://youtrack.jetbrains.com/issue/KT-10821) Create at most one wrapper sequence for adjacent drop/take operations on sequences +- [KT-11301](https://youtrack.jetbrains.com/issue/KT-11301) Make Map.plus accept Map out-projected by key type as either operand (receiver or parameter) +- [KT-11485](https://youtrack.jetbrains.com/issue/KT-11485) Remove implementations of some internal intrinsic functions +- [KT-11648](https://youtrack.jetbrains.com/issue/KT-11648) Add deprecated extension MutableList.remove to redirect to valid function removeAt +- [KT-11348](https://youtrack.jetbrains.com/issue/KT-11348) kotlin.test: Make inline methods `todo` and `currentStackTrace` `@InlineOnly` not to lose stack trace +- [KT-11745](https://youtrack.jetbrains.com/issue/KT-11745) Rename parameters of `String.subSequence` to match those of `CharSequence.subSequence` +- [KT-10953](https://youtrack.jetbrains.com/issue/KT-10953) Clarify parameter order of lambda function parameter of `*Indexed` functions +- [KT-10198](https://youtrack.jetbrains.com/issue/KT-10198) Improve docs for `binarySearch` functions +- [KT-9786](https://youtrack.jetbrains.com/issue/KT-9786) Improve docs for `trimIndent`/`trimMargin` + +### Reflection + +- [KT-9952](https://youtrack.jetbrains.com/issue/KT-9952) Improve `toString()` for lambdas and function expressions when kotlin-reflect.jar is available +- [KT-11433](https://youtrack.jetbrains.com/issue/KT-11433) Fix multiple resource leaks by closing InputStream instances +- [KT-8131](https://youtrack.jetbrains.com/issue/KT-8131) Fix exception from calling `KProperty.javaField` on a subclass +- [KT-10690](https://youtrack.jetbrains.com/issue/KT-10690) Support `javaMethod` and `kotlinFunction` for top level functions in a different file +- [KT-11447](https://youtrack.jetbrains.com/issue/KT-11447) Support reflection calls to multifile class members +- [KT-10892](https://youtrack.jetbrains.com/issue/KT-10892) Load annotations of const properties from multifile classes +- [KT-11258](https://youtrack.jetbrains.com/issue/KT-11258) Don't crash on requesting members of Java collection classes +- [KT-11502](https://youtrack.jetbrains.com/issue/KT-11502) Clarify KClass equality + +### JS + +- [KT-4124](https://youtrack.jetbrains.com/issue/KT-4124) Support nested classes +- [KT-11030](https://youtrack.jetbrains.com/issue/KT-11030) Support local classes +- [KT-7819](https://youtrack.jetbrains.com/issue/KT-7819) Support non-local returns in local lambdas +- [KT-6912](https://youtrack.jetbrains.com/issue/KT-6912) Safe calls (`x?.let { it }`) are now inlined +- [KT-2670](https://youtrack.jetbrains.com/issue/KT-2670) Support unsafe casts (`as`) +- [KT-7016](https://youtrack.jetbrains.com/issue/KT-7016), [KT-8012](https://youtrack.jetbrains.com/issue/KT-8012) Fix `is`-checks for reified type parameters +- [KT-7038](https://youtrack.jetbrains.com/issue/KT-7038) Avoid unwanted side effects on `is`-checks for nullable types +- [KT-10614](https://youtrack.jetbrains.com/issue/KT-10614) Copy array on vararg call with spread operator +- [KT-10785](https://youtrack.jetbrains.com/issue/KT-10785) Correctly translate property names and receiver instances in assignment operations +- [KT-11611](https://youtrack.jetbrains.com/issue/KT-11611) Fix translation of default value of secondary constructor's functional parameter +- [KT-11100](https://youtrack.jetbrains.com/issue/KT-11100) Fix generation of `invoke` on objects and companion objects +- [KT-11823](https://youtrack.jetbrains.com/issue/KT-11823) Fix capturing of outer class' `this` in inner's lambdas +- [KT-11996](https://youtrack.jetbrains.com/issue/KT-11996) Fix translation of a call to a private member of an outer class from an inner class which is a subtype of the outer class +- [KT-10667](https://youtrack.jetbrains.com/issue/KT-10667) Support inheritance from nested built-in types such as Map.Entry +- [KT-7480](https://youtrack.jetbrains.com/issue/KT-7480) Remove declarations of LinkedList, SortedSet, TreeSet, Enumeration +- [KT-3064](https://youtrack.jetbrains.com/issue/KT-3064) Implement `CharSequence.repeat` + +### IDE + +New features: + +- Spring Support + - [KT-11098](https://youtrack.jetbrains.com/issue/KT-11098) Inspection on final classes/functions annotated with Spring `@Configuration`/`@Component`/`@Bean` + - [KT-11405](https://youtrack.jetbrains.com/issue/KT-11405) Navigation and Find Usages for Spring beans referenced in annotation arguments and BeanFactory method calls + - [KT-3741](https://youtrack.jetbrains.com/issue/KT-3741) Show Spring-specific line markers on Kotlin classes + - [KT-11406](https://youtrack.jetbrains.com/issue/KT-11406) Support Spring EL injections inside of Kotlin string literals + - [KT-11604](https://youtrack.jetbrains.com/issue/KT-11604) Support "Configure Spring facet" inspection on Kotlin classes + - [KT-11407](https://youtrack.jetbrains.com/issue/KT-11407) Implement "Generate Spring Dependency..." actions + - [KT-11408](https://youtrack.jetbrains.com/issue/KT-11408) Implement "Generate `@Autowired` Dependency..." action + - [KT-11652](https://youtrack.jetbrains.com/issue/KT-11652) Rename bean attributes mentioned in Spring XML config together with corresponding Kotlin declarations +- Enable precise incremental compilation by default in non-Maven/Gradle projects +- [KT-11612](https://youtrack.jetbrains.com/issue/KT-11612) Highlight named arguments +- [KT-7715](https://youtrack.jetbrains.com/issue/KT-7715) Highlight `var`s that can be replaced by `val`s +- [KT-5208](https://youtrack.jetbrains.com/issue/KT-5208) Intention action to convert string to raw string and back +- [KT-11078](https://youtrack.jetbrains.com/issue/KT-11078) Quick fix to remove `.java` when KClass is expected +- [KT-1494](https://youtrack.jetbrains.com/issue/KT-1494) Inspection to highlight public members with no documentation +- [KT-8473](https://youtrack.jetbrains.com/issue/KT-8473) Intention action to implement interface or abstract class +- [KT-10299](https://youtrack.jetbrains.com/issue/KT-10299) Inspection to warn on array properties in data classes +- [KT-6674](https://youtrack.jetbrains.com/issue/KT-6674) Inspection to warn on protected symbols in effectively final classes +- [KT-11576](https://youtrack.jetbrains.com/issue/KT-11576) Quick fix to suppress "Unused symbol" warning based on annotations on the declaration +- [KT-10063](https://youtrack.jetbrains.com/issue/KT-10063) Quick fix for adding `arrayOf` wrapper for annotation parameters +- [KT-10476](https://youtrack.jetbrains.com/issue/KT-10476) Quick fix for converting primitive types +- [KT-10859](https://youtrack.jetbrains.com/issue/KT-10859) Quick fix to make `var` with private setter final +- [KT-9498](https://youtrack.jetbrains.com/issue/KT-9498) Quick fix to specify property type +- [KT-10509](https://youtrack.jetbrains.com/issue/KT-10509) Quick fix to simplify condition with senseless comparison +- [KT-11404](https://youtrack.jetbrains.com/issue/KT-11404) Quick fix to let type implement missing interface +- [KT-6785](https://youtrack.jetbrains.com/issue/KT-6785), [KT-10013](https://youtrack.jetbrains.com/issue/KT-10013), [KT-9996](https://youtrack.jetbrains.com/issue/KT-9996), [KT-11675](https://youtrack.jetbrains.com/issue/KT-11675) Support Smart Enter for trailing lambda argument, try/catch/finally, property setter, init block +- Add `kotlinClassName()` and `kotlinFunctionName()` macros for use in live templates +- Auto-configure EAP-repository during Kotlin Maven and Gradle project set up + +Issues fixed: + +- [KT-11678](https://youtrack.jetbrains.com/issue/KT-11678), [KT-4768](https://youtrack.jetbrains.com/issue/KT-4768) Support navigation to Kotlin libraries from Java sources +- [KT-9401](https://youtrack.jetbrains.com/issue/KT-9401) Support Change Signature quick fix for Java -> Kotlin case +- [KT-8592](https://youtrack.jetbrains.com/issue/KT-8592) Fix "Choose sources" for Kotlin files +- [KT-11256](https://youtrack.jetbrains.com/issue/KT-11256) Fix Navigate to declaration for Java constructor with `@NotNull` parameter +- [KT-11018](https://youtrack.jetbrains.com/issue/KT-11018) Fix `var`s shown in Ctrl + Mouse Hover as `val`s +- [KT-5105](https://youtrack.jetbrains.com/issue/KT-5105), [KT-11024](https://youtrack.jetbrains.com/issue/KT-11024) Improve incompatible ABI versions editor strap, show the hint on how to resolve the problem +- [KT-11638](https://youtrack.jetbrains.com/issue/KT-11638) Fixed `hashCode()` implementation in "Generate equals/hashCode" action +- [KT-10971](https://youtrack.jetbrains.com/issue/KT-10971) Pull Members Up: Always insert spaces between keywords +- [KT-11476](https://youtrack.jetbrains.com/issue/KT-11476), [KT-4175](https://youtrack.jetbrains.com/issue/KT-4175), [KT-10965](https://youtrack.jetbrains.com/issue/KT-10965), [KT-11076](https://youtrack.jetbrains.com/issue/KT-11076) Formatter: fix multiple issues regarding space handling +- [KT-9025](https://youtrack.jetbrains.com/issue/KT-9025) Improve "Create Kotlin Java runtime library" dialog usability +- [KT-11481](https://youtrack.jetbrains.com/issue/KT-11481) Fix "Add import" intention not being available for `is` branches in when +- [KT-10619](https://youtrack.jetbrains.com/issue/KT-10619) Fix completion after package name in annotation +- [KT-10621](https://youtrack.jetbrains.com/issue/KT-10621) Do not show non-top level packages after `@` in completion +- [KT-11295](https://youtrack.jetbrains.com/issue/KT-11295) "Convert string to template" intention: fix exception on certain code +- [KT-10750](https://youtrack.jetbrains.com/issue/KT-10750), [KT-11424](https://youtrack.jetbrains.com/issue/KT-11424) "Convert if to when" intention now detects effectively else branches in subsequent code and performs more accurate comment handling +- Configure Kotlin: show only changed files in the notification "Kotlin not configured", restore all changed files in undo action +- [KT-11556](https://youtrack.jetbrains.com/issue/KT-11556) Do not show "Kotlin not configured" for Kotlin JS projects +- [KT-11593](https://youtrack.jetbrains.com/issue/KT-11593) Fix "Configure Kotlin" action for Gradle projects in IDEA 2016 +- [KT-11077](https://youtrack.jetbrains.com/issue/KT-11077) Use new built-in definition file format (`.kotlin_builtins` files) +- [KT-5728](https://youtrack.jetbrains.com/issue/KT-5728) Remove closing curly brace in a string template when opening one is deleted +- [KT-10883](https://youtrack.jetbrains.com/issue/KT-10883) "Explicit get or set call" quick fix: do not move caret too far away +- [KT-5717](https://youtrack.jetbrains.com/issue/KT-5717) "Replace `when` with `if`": do not lose comments +- [KT-10797](https://youtrack.jetbrains.com/issue/KT-10797) "Replace with operator" intention is not available anymore for non-`operator` functions +- [KT-11529](https://youtrack.jetbrains.com/issue/KT-11529) Highlighting range for unresolved annotation name does not include `@` now +- [KT-11178](https://youtrack.jetbrains.com/issue/KT-11178) Don't show "Change type arguments" fix when there's nothing to change +- [KT-11789](https://youtrack.jetbrains.com/issue/KT-11789) Don't interpret annotations inside Markdown code blocks as KDoc tags +- [KT-11702](https://youtrack.jetbrains.com/issue/KT-11702) Fixed resolution of Kotlin beans with custom name +- [KT-11689](https://youtrack.jetbrains.com/issue/KT-11689) Fixed exception on attempt to navigate to Kotlin file from Spring notification balloon +- [KT-11725](https://youtrack.jetbrains.com/issue/KT-11725) Fixed renaming of injected SpEL references +- [KT-11720](https://youtrack.jetbrains.com/issue/KT-11720) Fixed renaming of Kotlin beans through SpEL references +- [KT-11719](https://youtrack.jetbrains.com/issue/KT-11719) Fixed renaming of Kotlin parameters references in XML files +- [KT-11736](https://youtrack.jetbrains.com/issue/KT-11736) Fixed searching of Java usages for @JvmStatic properties and @JvmStatic @JvmOverloads functions +- [KT-11862](https://youtrack.jetbrains.com/issue/KT-11862) Fixed bogus warnings about unresolved types in the Change Signature dialog +- Fix several issues leading to exceptions: [KT-11579](https://youtrack.jetbrains.com/issue/KT-11579), [KT-11580](https://youtrack.jetbrains.com/issue/KT-11580), [KT-11777](https://youtrack.jetbrains.com/issue/KT-11777), [KT-11868](https://youtrack.jetbrains.com/issue/KT-11868), [KT-11845](https://youtrack.jetbrains.com/issue/KT-11845), [KT-11486](https://youtrack.jetbrains.com/issue/KT-11486) +- Fixed NoSuchFieldException in Kotlin module settings on IDEA Ultimate + +#### Debugger + +- [KT-11705](https://youtrack.jetbrains.com/issue/KT-11705) "Smart step into" no longer skips methods from subclasses +- Debugger can now distinguish nested inline arguments +- [KT-11326](https://youtrack.jetbrains.com/issue/KT-11326) Support private classes in Evaluate Expression +- [KT-11455](https://youtrack.jetbrains.com/issue/KT-11455) Fix Evaluate Expression behavior for files with errors in sources +- [KT-10670](https://youtrack.jetbrains.com/issue/KT-10670) Fix Evaluate Expression behavior for inline functions with default parameters +- [KT-11380](https://youtrack.jetbrains.com/issue/KT-11380) Evaluate Expression now handles smart casts correctly +- [KT-10148](https://youtrack.jetbrains.com/issue/KT-10148) Do not suggest methods from outer context in "Smart step into" +- Fix Evaluate Expression for expression created for array element +- Complete private members from libraries in Evaluate Expression +- [KT-11578](https://youtrack.jetbrains.com/issue/KT-11578) Evaluate Expression: do not highlight completion variants from nullable receiver with grey +- [KT-6805](https://youtrack.jetbrains.com/issue/KT-6805) Convert Java expression to Kotlin when opening Evaluate Expression from Variables view +- [KT-11927](https://youtrack.jetbrains.com/issue/KT-11927) Fix "ambiguous import" error when invoking Evaluate Expression from Variables view for some field +- [KT-11831](https://youtrack.jetbrains.com/issue/KT-11831) Fix Evaluate Expression for values of raw types +- Show error message when debug info for some local variable is corrupted +- Avoid 1s delay in completion in debugger fields if session is not stopped on a breakpoint +- Avoid cast to runtime type unavailable in current scope +- Fix text with line breaks in popup with line breakpoint variants +- Fix breakpoints inside inline functions in libraries sources +- Allow breakpoints at catch clause declaration +- [KT-11848](https://youtrack.jetbrains.com/issue/KT-11848) Fix breakpoints inside generic crossinline lambda argument body +- [KT-11932](https://youtrack.jetbrains.com/issue/KT-11932) Fix Step Over for `while` loop condition + +### Java to Kotlin converter + +- Protected members used outside of inheritors are converted as public +- Support conversion for annotation constructor calls +- Place comments from the middle of the call to the end +- Drop line breaks between operator arguments (except `+`, `-`, `&&` and `||`) +- Add non-null assertions on call site for non-null parameters +- Specify type for variables with anonymous type if they have write accesses +- [KT-11587](https://youtrack.jetbrains.com/issue/KT-11587) Fix conversion of static field accesses from other Java class +- [KT-6800](https://youtrack.jetbrains.com/issue/KT-6800) Quote `$` symbols in converted strings +- [KT-11126](https://youtrack.jetbrains.com/issue/KT-11126) Convert annotations in annotations parameters correctly +- [KT-11600](https://youtrack.jetbrains.com/issue/KT-11600) Do not produce unresolved `toArray` calls for Java `Collection#toArray(T[])` +- [KT-11544](https://youtrack.jetbrains.com/issue/KT-11544) Fix conversion of uninitialized non-final field +- [KT-10604](https://youtrack.jetbrains.com/issue/KT-10604) Fix conversion of scratch files +- [KT-11543](https://youtrack.jetbrains.com/issue/KT-11543) Do not produce unnecessary casts of non-nullable expression to nullable type +- [KT-11160](https://youtrack.jetbrains.com/issue/KT-11160) Fix IDE freeze + +### Android + +- [KT-7729](https://youtrack.jetbrains.com/issue/KT-7729) Add Android Lint checks for Kotlin (from Android Studio 1.5) +- [KT-11487](https://youtrack.jetbrains.com/issue/KT-11487) Fixed sequential build with kapt and stubs enabled when Kotlin source file was modified and no Java source files were modified +- [KT-11264](https://youtrack.jetbrains.com/issue/KT-11264) Action to create new activity in Kotlin +- [KT-11201](https://youtrack.jetbrains.com/issue/KT-11201) Do not ignore items with similar names in kapt +- [KT-11944](https://youtrack.jetbrains.com/issue/KT-11944) Rename Android Extensions imports when the layout file is renamed/deleted/added +- [KT-10321](https://youtrack.jetbrains.com/issue/KT-10321) Do not upcast ViewStub to View +- [KT-10841](https://youtrack.jetbrains.com/issue/KT-10841) Support `@android:id/*` IDs in Android Extensions + +### Maven + +- [KT-2917](https://youtrack.jetbrains.com/issue/KT-2917), [KT-11261](https://youtrack.jetbrains.com/issue/KT-11261) Maven archetype for new Kotlin projects + +### Gradle + +- [KT-8487](https://youtrack.jetbrains.com/issue/KT-8487) Experimental support for incremental compilation with project property `kotlin.incremental` +- [KT-11350](https://youtrack.jetbrains.com/issue/KT-11350) Fixed a bug causing Java rebuild when both Java and Kotlin are up-to-date +- [KT-10507](https://youtrack.jetbrains.com/issue/KT-10507) Fix IllegalArgumentException "Missing extension point" on parallel builds +- [KT-10932](https://youtrack.jetbrains.com/issue/KT-10932) Prevent compile tasks from running when nothing changes +- [KT-11993](https://youtrack.jetbrains.com/issue/KT-11993) Fix NoSuchMethodError on access to internal members in production from tests (IDEA 2016+) + +## 1.0.1-2 + +### Compiler + +- [KT-11584](https://youtrack.jetbrains.com/issue/KT-11584), [KT-11514](https://youtrack.jetbrains.com/issue/KT-11514) Correct comparison of Long! / Double! with integer constant +- [KT-11590](https://youtrack.jetbrains.com/issue/KT-11590) SAM adapter for inline function corrected + +## 1.0.1-1 + +### Compiler + +- [KT-11468](https://youtrack.jetbrains.com/issue/KT-11468) More correct use-site / declaration-site variance combination handling +- [KT-11478](https://youtrack.jetbrains.com/issue/KT-11478) "Couldn't inline method call" internal compiler error fixed + +## 1.0.1 + +### Compiler + +Analysis & diagnostics issues fixed: + +- [KT-2277](https://youtrack.jetbrains.com/issue/KT-2277) Local function declarations are now checked for overload conflicts +- [KT-3602](https://youtrack.jetbrains.com/issue/KT-3602) Special diagnostic is reported now on nullable ‘for’ range +- [KT-10775](https://youtrack.jetbrains.com/issue/KT-10775) No compilation exception for empty when +- [KT-10952](https://youtrack.jetbrains.com/issue/KT-10952) False deprecation warnings removed +- [KT-10934](https://youtrack.jetbrains.com/issue/KT-10934) Type inference improved for whens +- [KT-10902](https://youtrack.jetbrains.com/issue/KT-10902) Redeclaration is reported for top-level property vs classifier conflict +- [KT-9985](https://youtrack.jetbrains.com/issue/KT-9985) Correct handling of safe call arguments in generic functions +- [KT-10856](https://youtrack.jetbrains.com/issue/KT-10856) Diagnostic about projected out member is reported correctly on calls with smart cast receiver +- [KT-5190](https://youtrack.jetbrains.com/issue/KT-5190) Calls of Java 8 Stream.collect +- [KT-11109](https://youtrack.jetbrains.com/issue/KT-11109) Warning is reported on Strictfp annotation on a class because it's not supported yet +- [KT-10686](https://youtrack.jetbrains.com/issue/KT-10686) Support generic constructors defined in Java +- [KT-6958](https://youtrack.jetbrains.com/issue/KT-6958) Fixed resolution for overloaded functions with extension lambdas +- [KT-10765](https://youtrack.jetbrains.com/issue/KT-10765) Correct handling of overload conflict between constructor and function in JPS +- [KT-10752](https://youtrack.jetbrains.com/issue/KT-10752) If inferred type for an expression refers to a non-accessible Java class, it's a compiler error to prevent IAE in runtime +- [KT-7415](https://youtrack.jetbrains.com/issue/KT-7415) Approximation of captured types in signatures +- [KT-10913](https://youtrack.jetbrains.com/issue/KT-10913), [KT-10186](https://youtrack.jetbrains.com/issue/KT-10186), [KT-5198](https://youtrack.jetbrains.com/issue/KT-5198) False “unreachable code” fixed for various situations +- Minor: [KT-3680](https://youtrack.jetbrains.com/issue/KT-3680), [KT-9702](https://youtrack.jetbrains.com/issue/KT-9702), [KT-8776](https://youtrack.jetbrains.com/issue/KT-8776), [KT-6745](https://youtrack.jetbrains.com/issue/KT-6745), [KT-10919](https://youtrack.jetbrains.com/issue/KT-10919), [KT-9548](https://youtrack.jetbrains.com/issue/KT-9548) + +JVM code generation issues fixed: + +- [KT-11153](https://youtrack.jetbrains.com/issue/KT-11153) NoClassDefFoundError is fixed on primitive iterators during boxing optimization +- [KT-7319](https://youtrack.jetbrains.com/issue/KT-7319) Correct parameter names for @JvmOverloads-generated methods +- [KT-10425](https://youtrack.jetbrains.com/issue/KT-10425) Non-const values of member properties are not inlined now +- [KT-11163](https://youtrack.jetbrains.com/issue/KT-11163) Correct calls of custom compareTo on primitives +- [KT-11081](https://youtrack.jetbrains.com/issue/KT-11081) Reified type parameters are correctly stored in anonymous objects +- [KT-11121](https://youtrack.jetbrains.com/issue/KT-11121) Generic properties generation is fixed for interfaces +- [KT-11285](https://youtrack.jetbrains.com/issue/KT-11285), [KT-10958](https://youtrack.jetbrains.com/issue/KT-10958) Special bridge generation refined +- [KT-10313](https://youtrack.jetbrains.com/issue/KT-10313), [KT-11190](https://youtrack.jetbrains.com/issue/KT-11190), [KT-11192](https://youtrack.jetbrains.com/issue/KT-11192), [KT-11130](https://youtrack.jetbrains.com/issue/KT-11130) Diagnostics and bytecode fixed for various operations with Long +- [KT-11203](https://youtrack.jetbrains.com/issue/KT-11203), [KT-11191](https://youtrack.jetbrains.com/issue/KT-11191), [KT-11206](https://youtrack.jetbrains.com/issue/KT-11206), [KT-8505](https://youtrack.jetbrains.com/issue/KT-8505), [KT-11203](https://youtrack.jetbrains.com/issue/KT-11203) Handling of increment / decrement for collection elements with user-defined get / set fixed +- [KT-9739](https://youtrack.jetbrains.com/issue/KT-9739) Backticked names with spaces are generated correctly + +JS translator issues fixed: + +- [KT-7683](https://youtrack.jetbrains.com/issue/KT-7683), [KT-11027](https://youtrack.jetbrains.com/issue/KT-11027) correct handling of in / !in inside when expressions + +### Standard library + +- [KT-10579](https://youtrack.jetbrains.com/issue/KT-10579) Improved performance of sum() and average() for arrays +- [KT-10821](https://youtrack.jetbrains.com/issue/KT-10821) Improved performance of drop() / take() for sequences + +### Reflection + +- [KT-10840](https://youtrack.jetbrains.com/issue/KT-10840) Fix annotations on Java elements in reflection + +### IDE + +New features: + +- Compatibility with IDEA 2016 +- Kotlin Education Plugin (for IDEA 2016) +- [KT-9752](https://youtrack.jetbrains.com/issue/KT-9752) More usable file chooser for "Move declaration to another file" +- [KT-9697](https://youtrack.jetbrains.com/issue/KT-9697) Move method to companion object and back +- [KT-7443](https://youtrack.jetbrains.com/issue/KT-7443) Inspection + intention to replace assert (x != null) with "!!" or elvis + +General issues fixed: + +- [KT-11277](https://youtrack.jetbrains.com/issue/KT-11277) Correct moving of Java classes from project view +- [KT-11256](https://youtrack.jetbrains.com/issue/KT-11256) Navigate Declaration fixed for Java classes with @NotNull parameter in constructor +- [KT-10553](https://youtrack.jetbrains.com/issue/KT-10553) A warning provided when Refactor / Move result is not compilable due to visibility problems +- [KT-11039](https://youtrack.jetbrains.com/issue/KT-11039) Parameter names are now not missing in parameter info and completion for compiled java code used from kotlin +- [KT-10204](https://youtrack.jetbrains.com/issue/KT-10204) Highlight usages in file is working now for function parameter +- [KT-10954](https://youtrack.jetbrains.com/issue/KT-10954) Introduce Parameter (Ctrl+Alt+P) fixed when default value is a simple name reference +- [KT-10776](https://youtrack.jetbrains.com/issue/KT-10776) Intentions: "Convert to lambda expression" works now for empty function body +- [KT-10815](https://youtrack.jetbrains.com/issue/KT-10815) Generate equals() and hashCode() is no more suggested for interfaces +- [KT-10818](https://youtrack.jetbrains.com/issue/KT-10818) "Initialize with constructor parameter" fixed +- [KT-8876](https://youtrack.jetbrains.com/issue/KT-8876) "Convert member to extension" now removes modality modifiers (open / final) +- [KT-10800](https://youtrack.jetbrains.com/issue/KT-10800) Create enum entry now adds comma after a new entry +- [KT-10552](https://youtrack.jetbrains.com/issue/KT-10552) Pull Members Up now takes visibility conflicts into account +- [KT-10978](https://youtrack.jetbrains.com/issue/KT-10978) Partially fixed, completion for JOOQ became ~ 10 times faster +- [KT-10940](https://youtrack.jetbrains.com/issue/KT-10940) Reference search optimized for convention functions +- [KT-9026](https://youtrack.jetbrains.com/issue/KT-9026) Editor no more locks up during scala file viewing +- [KT-11142](https://youtrack.jetbrains.com/issue/KT-11142), [KT-11276](https://youtrack.jetbrains.com/issue/KT-11276) Darkula scheme appearance corrected for Kotlin +- Minor: [KT-10778](https://youtrack.jetbrains.com/issue/KT-10778), [KT-10763](https://youtrack.jetbrains.com/issue/KT-10763), [KT-10908](https://youtrack.jetbrains.com/issue/KT-10908), [KT-10345](https://youtrack.jetbrains.com/issue/KT-10345), [KT-10696](https://youtrack.jetbrains.com/issue/KT-10696), [KT-11041](https://youtrack.jetbrains.com/issue/KT-11041), [KT-9434](https://youtrack.jetbrains.com/issue/KT-9434), [KT-8744](https://youtrack.jetbrains.com/issue/KT-8744), [KT-9738](https://youtrack.jetbrains.com/issue/KT-9738), [KT-10912](https://youtrack.jetbrains.com/issue/KT-10912) + +Configuration issues fixed: + +- [KT-11213](https://youtrack.jetbrains.com/issue/KT-11213) Kotlin plugin version corrected in build.gradle +- [KT-10918](https://youtrack.jetbrains.com/issue/KT-10918) "Update Kotlin runtime" action does not try to update the runtime coming in from Gradle +- [KT-11072](https://youtrack.jetbrains.com/issue/KT-11072) Libraries in maven, gradle and ide systems are never more detected as runtime libraries +- [KT-10489](https://youtrack.jetbrains.com/issue/KT-10489) Configuration messages are aggregated into one notification +- [KT-10831](https://youtrack.jetbrains.com/issue/KT-10831) Configure Kotlin in Project: "All modules containing Kotlin files" does not list modules not containing Kotlin files +- [KT-10366](https://youtrack.jetbrains.com/issue/KT-10366) Gradle import: no fake "Configure Kotlin" notification on project creating + +Debugger issues fixed: + +- [KT-10827](https://youtrack.jetbrains.com/issue/KT-10827) Fixed debugger stepping for inline calls +- [KT-10780](https://youtrack.jetbrains.com/issue/KT-10780) Breakpoints in a lazy property work correctly +- [KT-10634](https://youtrack.jetbrains.com/issue/KT-10634) Watches can now use private overloaded functions +- [KT-10611](https://youtrack.jetbrains.com/issue/KT-10611) Line breakpoints now can be created inside lambda in init block +- [KT-10673](https://youtrack.jetbrains.com/issue/KT-10673) Breakpoints inside lambda are no more ignored in presence of crossinline function parameter +- [KT-11318](https://youtrack.jetbrains.com/issue/KT-11318) Stepping inside for each is optimized +- [KT-3873](https://youtrack.jetbrains.com/issue/KT-3873) Editing code while standing on breakpoint is optimized +- [KT-7261](https://youtrack.jetbrains.com/issue/KT-7261), [KT-7266](https://youtrack.jetbrains.com/issue/KT-7266), [KT-10672](https://youtrack.jetbrains.com/issue/KT-10672) Evaluate expression applicability corrected + +### Tools + +- [KT-7943](https://youtrack.jetbrains.com/issue/KT-7943), [KT-10127](https://youtrack.jetbrains.com/issue/KT-10127) Overhead removed in Kotlin Gradle Plugin +- [KT-11351](https://youtrack.jetbrains.com/issue/KT-11351) Fixed NoSuchMethodError with Gradle 2.12 diff --git a/ChangeLog-1.1.X.md b/ChangeLog-1.1.X.md new file mode 100644 index 00000000000..0f234e71c61 --- /dev/null +++ b/ChangeLog-1.1.X.md @@ -0,0 +1,2697 @@ +# Changelog 1.1.X + +## 1.1.60 + +### Android + +#### New Features + +- [`KT-20051`](https://youtrack.jetbrains.com/issue/KT-20051) Quickfixes to support @Parcelize +#### Fixes + +- [`KT-19747`](https://youtrack.jetbrains.com/issue/KT-19747) Android extensions + Parcelable: VerifyError in case of RawValue annotation on a type when it's unknown how to parcel it +- [`KT-19899`](https://youtrack.jetbrains.com/issue/KT-19899) Parcelize: Building with ProGuard enabled +- [`KT-19988`](https://youtrack.jetbrains.com/issue/KT-19988) [Android Extensions] inner class LayoutContainer causes NoSuchMethodError +- [`KT-20002`](https://youtrack.jetbrains.com/issue/KT-20002) Parcelize explodes on LongArray +- [`KT-20019`](https://youtrack.jetbrains.com/issue/KT-20019) Parcelize does not propogate flags argument when writing nested Parcelable +- [`KT-20020`](https://youtrack.jetbrains.com/issue/KT-20020) Parcelize does not use primitive array read/write methods on Parcel +- [`KT-20021`](https://youtrack.jetbrains.com/issue/KT-20021) Parcelize does not serialize Parcelable enum as Parcelable +- [`KT-20022`](https://youtrack.jetbrains.com/issue/KT-20022) Parcelize should dispatch directly to java.lang.Enum when writing an enum. +- [`KT-20034`](https://youtrack.jetbrains.com/issue/KT-20034) Application installation failed (INSTALL_FAILED_DEXOPT) in Android 4.3 devices if I use Parcelize +- [`KT-20057`](https://youtrack.jetbrains.com/issue/KT-20057) Parcelize should use specialized write/create methods where available. +- [`KT-20062`](https://youtrack.jetbrains.com/issue/KT-20062) Parceler should allow otherwise un-parcelable property types in enclosing class. + +### Compiler + +#### Performance Improvements + +- [`KT-20462`](https://youtrack.jetbrains.com/issue/KT-20462) Don't create an array copy for '*(...)' +#### Fixes + +- [`KT-14697`](https://youtrack.jetbrains.com/issue/KT-14697) Use-site targeted annotation is not correctly loaded from class file +- [`KT-17680`](https://youtrack.jetbrains.com/issue/KT-17680) Android Studio and multiple tests in single file +- [`KT-19251`](https://youtrack.jetbrains.com/issue/KT-19251) Stack spilling in constructor arguments breaks Quasar +- [`KT-19592`](https://youtrack.jetbrains.com/issue/KT-19592) Apply JSR 305 default nullability qualifiers with to generic type arguments if they're applicable for TYPE_USE +- [`KT-20016`](https://youtrack.jetbrains.com/issue/KT-20016) JSR 305: default nullability qualifiers are ignored in TYPE_USE and PARAMETER positions +- [`KT-20131`](https://youtrack.jetbrains.com/issue/KT-20131) Support @NonNull(when = NEVER) nullability annotation +- [`KT-20158`](https://youtrack.jetbrains.com/issue/KT-20158) Preserve flexibility for Java types annotated with @NonNull(when = UNKNOWN) +- [`KT-20337`](https://youtrack.jetbrains.com/issue/KT-20337) No multifile class facade is generated for files with type aliases only +- [`KT-20387`](https://youtrack.jetbrains.com/issue/KT-20387) Wrong argument generated for accessor call of a protected generic 'operator fun get/set' from base class with primitive type as type parameter +- [`KT-20418`](https://youtrack.jetbrains.com/issue/KT-20418) Wrong code generated for literal long range with mixed integer literal ends +- [`KT-20491`](https://youtrack.jetbrains.com/issue/KT-20491) Incorrect synthetic accessor generated for a generic base class function specialized with primitive type +- [`KT-20651`](https://youtrack.jetbrains.com/issue/KT-20651) "Don't know how to generate outer expression" for enum-values with non-trivial self-closures +- [`KT-20707`](https://youtrack.jetbrains.com/issue/KT-20707) Support when by enum in kotlin scripts +- [`KT-20879`](https://youtrack.jetbrains.com/issue/KT-20879) Compiler problem in when-expressions + +### IDE + +#### New Features + +- [`KT-14175`](https://youtrack.jetbrains.com/issue/KT-14175) Surround with try ... catch (... finally) doesn't work for expressions +- [`KT-15769`](https://youtrack.jetbrains.com/issue/KT-15769) Join lines could "convert to expression body" +- [`KT-19134`](https://youtrack.jetbrains.com/issue/KT-19134) IntelliJ Color Scheme editor - allow changing color of colons and double colons +- [`KT-20308`](https://youtrack.jetbrains.com/issue/KT-20308) New Gradle with Kotlin DSL project wizard +#### Fixes + +- [`KT-15932`](https://youtrack.jetbrains.com/issue/KT-15932) Attempt to rename private property finds unrelated usages +- [`KT-18996`](https://youtrack.jetbrains.com/issue/KT-18996) After Kotlin compiler settings change: 'Apply' button doesn't work +- [`KT-19458`](https://youtrack.jetbrains.com/issue/KT-19458) Resolver for 'completion/highlighting in ScriptModuleInfo for build.gradle.kts / JVM' does not know how to resolve LibraryInfo +- [`KT-19474`](https://youtrack.jetbrains.com/issue/KT-19474) Kotlin Gradle Script: highlighting fails on unresolved references +- [`KT-19823`](https://youtrack.jetbrains.com/issue/KT-19823) Kotlin Gradle project import into IntelliJ: import kapt generated classes into classpath +- [`KT-19958`](https://youtrack.jetbrains.com/issue/KT-19958) Android: kotlinOptions from build.gradle are not imported into facet +- [`KT-19972`](https://youtrack.jetbrains.com/issue/KT-19972) AssertionError “Resolver for 'completion/highlighting in ModuleProductionSourceInfo(module=Module: 'kotlin-pure_main') for files dummy.kt for platform JVM' does not know how to resolve SdkInfo“ on copying Kotlin file with kotlin.* imports from other project +- [`KT-20112`](https://youtrack.jetbrains.com/issue/KT-20112) maven dependency type test-jar with scope compile not +- [`KT-20185`](https://youtrack.jetbrains.com/issue/KT-20185) Stub and PSI element type mismatch for "var nullableSuspend: (suspend (P) -> Unit)? = null" +- [`KT-20199`](https://youtrack.jetbrains.com/issue/KT-20199) Cut action is not available during indexing +- [`KT-20331`](https://youtrack.jetbrains.com/issue/KT-20331) Wrong EAP repository +- [`KT-20346`](https://youtrack.jetbrains.com/issue/KT-20346) Can't build tests in common code due to missing org.jetbrains.kotlin:kotlin-test-js testCompile dependency in JS +- [`KT-20419`](https://youtrack.jetbrains.com/issue/KT-20419) Android Studio plugin 1.1.50 show multiple gutter icon for the same item +- [`KT-20519`](https://youtrack.jetbrains.com/issue/KT-20519) Error “Parameter specified as non-null is null: method ModuleGrouperKt.isQualifiedModuleNamesEnabled” on creating Gradle (Kotlin DSL) project from scratch +- [`KT-20550`](https://youtrack.jetbrains.com/issue/KT-20550) Spring: "Navigate to autowired candidates" gutter action is missed (IDEA 2017.3) +- [`KT-20566`](https://youtrack.jetbrains.com/issue/KT-20566) Spring: "Navigate to the spring beans declaration" gutter action for `@ComponentScan` is missed (IDEA 2017.3) +- [`KT-20621`](https://youtrack.jetbrains.com/issue/KT-20621) Provide automatic migration from JetRunConfigurationType to KotlinRunConfigurationType +- [`KT-20648`](https://youtrack.jetbrains.com/issue/KT-20648) Do we need a separate ProjectImportProvider for gradle kotlin dsl projects? +- [`KT-20782`](https://youtrack.jetbrains.com/issue/KT-20782) Non-atomic trees update +- [`KT-20789`](https://youtrack.jetbrains.com/issue/KT-20789) Can't navigate to inline call/inline use site when runner is delegated to Gradle +- [`KT-20843`](https://youtrack.jetbrains.com/issue/KT-20843) Kotlin TypeDeclarationProvider may stop other declarations providers execution +- [`KT-20929`](https://youtrack.jetbrains.com/issue/KT-20929) Import Project from Gradle wizard: the same page is shown twice + +### IDE. Completion + +- [`KT-16383`](https://youtrack.jetbrains.com/issue/KT-16383) IllegalStateException: Failed to create expression from text: '' on choosing ByteArray from completion list +- [`KT-18458`](https://youtrack.jetbrains.com/issue/KT-18458) Spring: code completion does not suggest bean names inside `@Qualifier` before function parameter +- [`KT-20256`](https://youtrack.jetbrains.com/issue/KT-20256) java.lang.Throwable “Invalid range specified” on editing template inside string literal + +### IDE. Inspections and Intentions + +#### New Features + +- [`KT-14695`](https://youtrack.jetbrains.com/issue/KT-14695) Simplify comparison intention produces meaningless statement for assert() +- [`KT-17204`](https://youtrack.jetbrains.com/issue/KT-17204) Add `Assign to property quickfix` +- [`KT-18220`](https://youtrack.jetbrains.com/issue/KT-18220) Add data modifier to a class quickfix +- [`KT-18742`](https://youtrack.jetbrains.com/issue/KT-18742) Add quick-fix for CANNOT_CHECK_FOR_ERASED +- [`KT-19735`](https://youtrack.jetbrains.com/issue/KT-19735) Add quickfix for type mismatch that converts Sequence/Array/List +- [`KT-20259`](https://youtrack.jetbrains.com/issue/KT-20259) Show warning if arrays are compared by '!=' +#### Fixes + +- [`KT-10546`](https://youtrack.jetbrains.com/issue/KT-10546) Wrong "Unused property" warning on using inline object syntax +- [`KT-16394`](https://youtrack.jetbrains.com/issue/KT-16394) "Convert reference to lambda" generates wrong code +- [`KT-16808`](https://youtrack.jetbrains.com/issue/KT-16808) Intention "Remove unnecessary parantheses" is erroneously proposed for elvis operator on LHS of `in` operator if RHS of elvis is return with value +- [`KT-17437`](https://youtrack.jetbrains.com/issue/KT-17437) Class highlighted as unused even if Companion methods/fields really used +- [`KT-19377`](https://youtrack.jetbrains.com/issue/KT-19377) Inspections are run for Kotlin Gradle DSL sources +- [`KT-19420`](https://youtrack.jetbrains.com/issue/KT-19420) Kotlin Gradle script editor: suggestion to import required class from stdlib fails with AE: ResolverForProjectImpl.descriptorForModule() +- [`KT-19626`](https://youtrack.jetbrains.com/issue/KT-19626) (Specify type explicitly) Descriptor was not found for VALUE_PARAMETER +- [`KT-19674`](https://youtrack.jetbrains.com/issue/KT-19674) 'Convert property initializer to getter' intention fails on incompilable initializer with AssertionError at SpecifyTypeExplicitlyIntention$Companion.addTypeAnnotationWithTemplate() +- [`KT-19782`](https://youtrack.jetbrains.com/issue/KT-19782) Surround with if else doesn't work for expressions +- [`KT-20010`](https://youtrack.jetbrains.com/issue/KT-20010) 'Replace safe access expression with 'if' expression' IDEA Kotlin plugin intention may failed +- [`KT-20104`](https://youtrack.jetbrains.com/issue/KT-20104) "Recursive property accessor" reports false positive when property reference is used in the assignment +- [`KT-20218`](https://youtrack.jetbrains.com/issue/KT-20218) AE on calling intention “Convert to secondary constructor” for already referred argument +- [`KT-20231`](https://youtrack.jetbrains.com/issue/KT-20231) False positive 'Redundant override' when delegated member hides super type override +- [`KT-20261`](https://youtrack.jetbrains.com/issue/KT-20261) Incorrect "Redundant Unit return type" inspection for Nothing-typed expression +- [`KT-20315`](https://youtrack.jetbrains.com/issue/KT-20315) "call chain on collection type may be simplified" generates code that does not compile +- [`KT-20333`](https://youtrack.jetbrains.com/issue/KT-20333) Assignment can be lifted out of try is applied too broadly +- [`KT-20366`](https://youtrack.jetbrains.com/issue/KT-20366) Code cleanup: some inspections are broken +- [`KT-20369`](https://youtrack.jetbrains.com/issue/KT-20369) Inspection messages with INFORMATION highlight type are shown in Code Inspect +- [`KT-20409`](https://youtrack.jetbrains.com/issue/KT-20409) useless warning "Remove curly braces" for Chinese character +- [`KT-20417`](https://youtrack.jetbrains.com/issue/KT-20417) Converting property getter to block body doesn't insert explicit return type + +### IDE. Refactorings + +#### Performance Improvements + +- [`KT-18823`](https://youtrack.jetbrains.com/issue/KT-18823) Move class to a separate file is very slow in 'kotlin' project +- [`KT-20205`](https://youtrack.jetbrains.com/issue/KT-20205) Invoke MoveKotlinDeclarationsProcessor.findUsages() under progress +#### Fixes + +- [`KT-15840`](https://youtrack.jetbrains.com/issue/KT-15840) Introduce type alias: don't change not-nullable type with nullable typealias +- [`KT-17949`](https://youtrack.jetbrains.com/issue/KT-17949) Rename private fun should not search it out of scope +- [`KT-18196`](https://youtrack.jetbrains.com/issue/KT-18196) Refactor / Copy: the copy is formatted +- [`KT-18594`](https://youtrack.jetbrains.com/issue/KT-18594) Refactor / Extract (Functional) Parameter are available for annotation arguments, but fail with AE: "Body element is not found" +- [`KT-19439`](https://youtrack.jetbrains.com/issue/KT-19439) Kotlin introduce parameter causes exception +- [`KT-19909`](https://youtrack.jetbrains.com/issue/KT-19909) copy a kotlin class removes imports and other modifications +- [`KT-19949`](https://youtrack.jetbrains.com/issue/KT-19949) AssertionError „Resolver for 'project source roots and libraries for platform JVM' does not know how to resolve ModuleProductionSourceInfo“ through MoveConflictChecker.getModuleDescriptor() on copying Kotlin file from other project +- [`KT-20092`](https://youtrack.jetbrains.com/issue/KT-20092) Refactor / Copy: copy of .kt file removes all the blank lines and 'hanging' comments +- [`KT-20335`](https://youtrack.jetbrains.com/issue/KT-20335) Refactor → Extract Type Parameter: “AWT events are not allowed inside write action” after processing duplicates +- [`KT-20402`](https://youtrack.jetbrains.com/issue/KT-20402) Throwable “PsiElement(IDENTIFIER) by KotlinInplaceParameterIntroducer” on calling Refactor → Extract Parameter for default values +- [`KT-20403`](https://youtrack.jetbrains.com/issue/KT-20403) AE “Body element is not found” on calling Refactor → Extract Parameter for default values in constructor of class without body + +### JavaScript + +#### Fixes + +- [`KT-8285`](https://youtrack.jetbrains.com/issue/KT-8285) JS: don't generate tmp when only need one component +- [`KT-14549`](https://youtrack.jetbrains.com/issue/KT-14549) JS: Non-local returns from secondary constructors don't work +- [`KT-15294`](https://youtrack.jetbrains.com/issue/KT-15294) JS: parse error in `js()` function +- [`KT-17450`](https://youtrack.jetbrains.com/issue/KT-17450) PlatformDependent members of collections are compiled in JS +- [`KT-18010`](https://youtrack.jetbrains.com/issue/KT-18010) JS: JsName annotation in interfaces can cause runtime exception +- [`KT-18063`](https://youtrack.jetbrains.com/issue/KT-18063) Inlining does not work properly in JS for suspend functions from another module +- [`KT-18548`](https://youtrack.jetbrains.com/issue/KT-18548) JS: wrong string interpolation with generic or Any parameters +- [`KT-19794`](https://youtrack.jetbrains.com/issue/KT-19794) runtime crash with empty object (Javascript) +- [`KT-19818`](https://youtrack.jetbrains.com/issue/KT-19818) JS: generate paths relative to .map file by default (unless "-source-map-prefix" is used) +- [`KT-19906`](https://youtrack.jetbrains.com/issue/KT-19906) JS: rename compiler option "-source-map-source-roots" to avoid misleading since sourcemaps have field called "sourceRoot" +- [`KT-20287`](https://youtrack.jetbrains.com/issue/KT-20287) Functions don't actually return Unit in Kotlin-JS -> unexpected null problems vs JDK version +- [`KT-20451`](https://youtrack.jetbrains.com/issue/KT-20451) KotlinJs - interface function with default parameter, overridden by implementor, can't be found at runtime +- [`KT-20650`](https://youtrack.jetbrains.com/issue/KT-20650) JS: compiler crashes in Java 9 with NoClassDefFoundError +- [`KT-20653`](https://youtrack.jetbrains.com/issue/KT-20653) JS: compiler crashes in Java 9 with TranslationRuntimeException +- [`KT-20820`](https://youtrack.jetbrains.com/issue/KT-20820) JS: IDEA project doesn't generate paths relative to .map + +### Libraries + +- [`KT-20596`](https://youtrack.jetbrains.com/issue/KT-20596) 'synchronized' does not allow non-local return in Kotlin JS +- [`KT-20600`](https://youtrack.jetbrains.com/issue/KT-20600) Typo in POMs for kotlin-runtime + +### Tools + +- [`KT-19692`](https://youtrack.jetbrains.com/issue/KT-19692) kotlin-jpa plugin doesn't support @MappedSuperclass annotation +- [`KT-20030`](https://youtrack.jetbrains.com/issue/KT-20030) Parcelize can directly reference writeToParcel and CREATOR for final, non-Parcelize Parcelable types in same compilation unit. +- [`KT-19742`](https://youtrack.jetbrains.com/issue/KT-19742) [Android extensions] Calling clearFindViewByIdCache causes NPE +- [`KT-19749`](https://youtrack.jetbrains.com/issue/KT-19749) Android extensions + Parcelable: NoSuchMethodError on attempt to pack into parcel a serializable object +- [`KT-20026`](https://youtrack.jetbrains.com/issue/KT-20026) Parcelize overrides describeContents despite being already implemented. +- [`KT-20027`](https://youtrack.jetbrains.com/issue/KT-20027) Parcelize uses wrong classloader when reading parcelable type. +- [`KT-20029`](https://youtrack.jetbrains.com/issue/KT-20029) Parcelize should not directly reference parcel methods on types outside compilation unit +- [`KT-20032`](https://youtrack.jetbrains.com/issue/KT-20032) Parcelize does not respect type nullability in case of Parcelize parcelables + +### Tools. Gradle + +- [`KT-3463`](https://youtrack.jetbrains.com/issue/KT-3463) Gradle plugin ignores kotlin compile options changes +- [`KT-16299`](https://youtrack.jetbrains.com/issue/KT-16299) Gradle build does not recompile annotated classes on changing compiler's plugins configuration +- [`KT-16764`](https://youtrack.jetbrains.com/issue/KT-16764) Kotlin Gradle plugin should replicate task dependencies of Java source directories +- [`KT-17564`](https://youtrack.jetbrains.com/issue/KT-17564) Applying Kotlin's Gradle plugin results in src/main/java being listed twice in sourceSets.main.allSource +- [`KT-17674`](https://youtrack.jetbrains.com/issue/KT-17674) Test code is not compiled incrementally when main is changed +- [`KT-18765`](https://youtrack.jetbrains.com/issue/KT-18765) Move incremental compilation message from Gradle's warning to info logging level +- [`KT-20036`](https://youtrack.jetbrains.com/issue/KT-20036) Gradle tasks up-to-date-ness + +### Tools. J2K + +- [`KT-19565`](https://youtrack.jetbrains.com/issue/KT-19565) Java code using Iterator#remove converted to red code +- [`KT-19651`](https://youtrack.jetbrains.com/issue/KT-19651) Java class with static-only methods can contain 'protected' members + +### Tools. JPS + +- [`KT-20082`](https://youtrack.jetbrains.com/issue/KT-20082) Java 9: incremental build reports bogus error for reference to Kotlin source +- [`KT-20671`](https://youtrack.jetbrains.com/issue/KT-20671) Kotlin plugin compiler exception when compiling under JDK9 + +### Tools. Maven + +- [`KT-20064`](https://youtrack.jetbrains.com/issue/KT-20064) Maven + Java 9: compile task warns about module-info in the output path +- [`KT-20400`](https://youtrack.jetbrains.com/issue/KT-20400) Do not output module name, version and related information by default in Maven builds + +### Tools. REPL + +- [`KT-20167`](https://youtrack.jetbrains.com/issue/KT-20167) JDK 9 `unresolved supertypes: Object` when working with Kotlin Scripting API + +### Tools. kapt + +- [`KT-17923`](https://youtrack.jetbrains.com/issue/KT-17923) Reference to Dagger generated class is highlighted red +- [`KT-18923`](https://youtrack.jetbrains.com/issue/KT-18923) Kapt: Do not use the Kotlin error message collector to issue errors from kapt +- [`KT-19097`](https://youtrack.jetbrains.com/issue/KT-19097) Request: Decent support of `kapt.kotlin.generated` on Intellij/Android Studio +- [`KT-20877`](https://youtrack.jetbrains.com/issue/KT-20877) Butterknife: UninitializedPropertyAccessException: "lateinit property has not been initialized" for field annotated with `@BindView`. + +## 1.1.50 + +### Android + +- [`KT-14800`](https://youtrack.jetbrains.com/issue/KT-14800) Kotlin Lint: `@SuppressLint` annotation on local variable is ignored +- [`KT-16600`](https://youtrack.jetbrains.com/issue/KT-16600) False positive "For methods, permission annotation should specify one of `value`, `anyOf` or `allOf`" +- [`KT-16834`](https://youtrack.jetbrains.com/issue/KT-16834) Android Lint: Bogus warning on @setparam:StringRes +- [`KT-17785`](https://youtrack.jetbrains.com/issue/KT-17785) Kotlin Lint: "Incorrect support annotation usage" does not pick the value of const val +- [`KT-18837`](https://youtrack.jetbrains.com/issue/KT-18837) Android Lint: Collection.removeIf is not flagged when used on RealmList +- [`KT-18893`](https://youtrack.jetbrains.com/issue/KT-18893) Android support annotations (ColorInt, etc) cannot be used on properties: "does not apply for type void" +- [`KT-18997`](https://youtrack.jetbrains.com/issue/KT-18997) KLint: False positive "Could not find property setter method setLevel on java.lang.Object" if using elvis with return on RHS +- [`KT-19671`](https://youtrack.jetbrains.com/issue/KT-19671) UAST: Parameter annotations not provided for val parameters + +### Compiler + +#### Performance Improvements + +- [`KT-17963`](https://youtrack.jetbrains.com/issue/KT-17963) Unnecessary boxing in case of primitive comparison to object +- [`KT-18589`](https://youtrack.jetbrains.com/issue/KT-18589) 'Equality check can be used instead of elvis' produces code that causes boxing +- [`KT-18693`](https://youtrack.jetbrains.com/issue/KT-18693) Optimize in-expression with optimizable range in RHS +- [`KT-18721`](https://youtrack.jetbrains.com/issue/KT-18721) Improve code generation for if-in-primitive-literal expression ('if (expr in low .. high)') +- [`KT-18818`](https://youtrack.jetbrains.com/issue/KT-18818) Optimize null cases in `when` statement to avoid Intrinsics usage +- [`KT-18834`](https://youtrack.jetbrains.com/issue/KT-18834) Do not create ranges for 'x in low..high' where type of x doesn't match range element type +- [`KT-19029`](https://youtrack.jetbrains.com/issue/KT-19029) Use specialized equality implementations for 'when' +- [`KT-19149`](https://youtrack.jetbrains.com/issue/KT-19149) Use 'for-in-until' loop in intrinsic array constructors +- [`KT-19252`](https://youtrack.jetbrains.com/issue/KT-19252) Use 'for-in-until' loop for 'for-in-rangeTo' loops with constant upper bounds when possible +- [`KT-19256`](https://youtrack.jetbrains.com/issue/KT-19256) Destructuring assignment generates redundant code for temporary variable nullification +- [`KT-19457`](https://youtrack.jetbrains.com/issue/KT-19457) Extremely slow analysis for file with deeply nested lambdas +#### Fixes + +- [`KT-10754`](https://youtrack.jetbrains.com/issue/KT-10754) Bogus unresolved extension function +- [`KT-11739`](https://youtrack.jetbrains.com/issue/KT-11739) Incorrect error message on getValue operator with KProperty parameter +- [`KT-11834`](https://youtrack.jetbrains.com/issue/KT-11834) INAPPLICABLE_LATEINIT_MODIFIER is confusing for a generic type parameter with nullable (default) upper bound +- [`KT-11963`](https://youtrack.jetbrains.com/issue/KT-11963) Exception: recursive call in a lazy value under LockBasedStorageManager +- [`KT-12737`](https://youtrack.jetbrains.com/issue/KT-12737) Confusing error message when calling extension function with an implicit receiver, passing value parameter of wrong type +- [`KT-12767`](https://youtrack.jetbrains.com/issue/KT-12767) Too much unnecessary information in "N type arguments expected" error message +- [`KT-12796`](https://youtrack.jetbrains.com/issue/KT-12796) IllegalArgumentException on referencing inner class constructor on an outer class instance +- [`KT-12899`](https://youtrack.jetbrains.com/issue/KT-12899) Platform null escapes if passed as an extension receiver to an inline function +- [`KT-13665`](https://youtrack.jetbrains.com/issue/KT-13665) Generic componentN() functions should provide better diagnostics when type cannot be inferred +- [`KT-16223`](https://youtrack.jetbrains.com/issue/KT-16223) Confusing diagnostic for local inline functions +- [`KT-16246`](https://youtrack.jetbrains.com/issue/KT-16246) CompilationException caused by intersection type overload and wrong type parameter +- [`KT-16746`](https://youtrack.jetbrains.com/issue/KT-16746) DslMarker doesn't work with typealiases +- [`KT-17444`](https://youtrack.jetbrains.com/issue/KT-17444) Accessors generated for private file functions should respect @JvmName +- [`KT-17464`](https://youtrack.jetbrains.com/issue/KT-17464) Calling super constructor with generic function call in arguments fails at runtime +- [`KT-17725`](https://youtrack.jetbrains.com/issue/KT-17725) java.lang.VerifyError when both dispatch receiver and extension receiver have smart casts +- [`KT-17745`](https://youtrack.jetbrains.com/issue/KT-17745) Unfriendly error message on creating an instance of interface via typealias +- [`KT-17748`](https://youtrack.jetbrains.com/issue/KT-17748) Equality for class literals of primitive types is not preserved by reification +- [`KT-17879`](https://youtrack.jetbrains.com/issue/KT-17879) Comparing T::class from a reified generic with a Class<*> and KClass<*> variable in when statement is broken +- [`KT-18356`](https://youtrack.jetbrains.com/issue/KT-18356) Argument reordering in super class constructor call for anonymous object fails with VerifyError +- [`KT-18819`](https://youtrack.jetbrains.com/issue/KT-18819) JVM BE treats 'if (a in low .. high)' as 'if (a >= low && a <= high)', so 'high' can be non-evaluated +- [`KT-18855`](https://youtrack.jetbrains.com/issue/KT-18855) Convert "Remove at from annotation argument" inspection into compiler error & quick-fix +- [`KT-18858`](https://youtrack.jetbrains.com/issue/KT-18858) Exception within typealias expansion with dynamic used as one of type arguments +- [`KT-18902`](https://youtrack.jetbrains.com/issue/KT-18902) NullPointerException when using provideDelegate with properties of the base class at runtime +- [`KT-18940`](https://youtrack.jetbrains.com/issue/KT-18940) REPEATED_ANNOTATION is reported on wrong location for typealias arguments +- [`KT-18944`](https://youtrack.jetbrains.com/issue/KT-18944) Type annotations are lost for dynamic type +- [`KT-18966`](https://youtrack.jetbrains.com/issue/KT-18966) Report full package FQ name in compilation errors related to visibility +- [`KT-18971`](https://youtrack.jetbrains.com/issue/KT-18971) Missing non-null assertion for platform type passed as a receiver to the member extension function +- [`KT-18982`](https://youtrack.jetbrains.com/issue/KT-18982) NoSuchFieldError on access to imported object property from the declaring object itself +- [`KT-18985`](https://youtrack.jetbrains.com/issue/KT-18985) Too large highlighting range for UNCHECKED_CAST +- [`KT-19058`](https://youtrack.jetbrains.com/issue/KT-19058) VerifyError: no CHECKAST on dispatch receiver of the synthetic property defined in Java interface +- [`KT-19100`](https://youtrack.jetbrains.com/issue/KT-19100) VerifyError: missing CHECKCAST on extension receiver of the extension property +- [`KT-19115`](https://youtrack.jetbrains.com/issue/KT-19115) Report warnings on usages of JSR 305-annotated declarations which rely on incorrect or missing nullability information +- [`KT-19128`](https://youtrack.jetbrains.com/issue/KT-19128) java.lang.VerifyError with smart cast to String from Any +- [`KT-19180`](https://youtrack.jetbrains.com/issue/KT-19180) Bad SAM conversion of Java interface causing ClassCastException: [...] cannot be cast to kotlin.jvm.functions.Function1 +- [`KT-19205`](https://youtrack.jetbrains.com/issue/KT-19205) Poor diagnostic message for deprecated class referenced through typealias +- [`KT-19367`](https://youtrack.jetbrains.com/issue/KT-19367) NSFE if property with name matching companion object property name is referenced within lambda +- [`KT-19434`](https://youtrack.jetbrains.com/issue/KT-19434) Object inheriting generic class with a reified type parameter looses method annotations +- [`KT-19475`](https://youtrack.jetbrains.com/issue/KT-19475) AnalyserException in case of combination of `while (true)` + stack-spilling (coroutines/try-catch expressions) +- [`KT-19528`](https://youtrack.jetbrains.com/issue/KT-19528) Compiler exception on inline suspend function inside a generic class +- [`KT-19575`](https://youtrack.jetbrains.com/issue/KT-19575) Deprecated typealias is not marked as such in access to companion object +- [`KT-19601`](https://youtrack.jetbrains.com/issue/KT-19601) UPPER_BOUND_VIOLATED reported on type alias expansion in a recursive upper bound on a type parameter +- [`KT-19814`](https://youtrack.jetbrains.com/issue/KT-19814) Runtime annotations for open suspend function are not generated correctly +- [`KT-19892`](https://youtrack.jetbrains.com/issue/KT-19892) Overriding remove method on inheritance from TreeSet +- [`KT-19910`](https://youtrack.jetbrains.com/issue/KT-19910) Nullability assertions removed when inlining an anonymous object in crossinline lambda +- [`KT-19985`](https://youtrack.jetbrains.com/issue/KT-19985) JSR 305: nullability qualifier of Java function return type detected incorrectly in case of using annotation nickname + +### IDE + +#### New Features + +- [`KT-6676`](https://youtrack.jetbrains.com/issue/KT-6676) Show enum constant ordinal in quick doc like in Java +- [`KT-12246`](https://youtrack.jetbrains.com/issue/KT-12246) Kotlin source files are not highlighted in Gradle build output in IntelliJ +#### Performance Improvements + +- [`KT-19670`](https://youtrack.jetbrains.com/issue/KT-19670) When computing argument hints, don't resolve call if none of the arguments are unclear expressions +#### Fixes + +- [`KT-9288`](https://youtrack.jetbrains.com/issue/KT-9288) Call hierarchy ends on function call inside local val initializer expression +- [`KT-9669`](https://youtrack.jetbrains.com/issue/KT-9669) Join Lines should add semicolon when joining statements into the same line +- [`KT-14346`](https://youtrack.jetbrains.com/issue/KT-14346) IllegalArgumentException on attempt to call Show Hierarchy view on lambda +- [`KT-14428`](https://youtrack.jetbrains.com/issue/KT-14428) AssertionError in KotlinCallerMethodsTreeStructure. on attempt to call Hierarchy view +- [`KT-19466`](https://youtrack.jetbrains.com/issue/KT-19466) Kotlin based Gradle build not recognized when added as a module +- [`KT-18083`](https://youtrack.jetbrains.com/issue/KT-18083) IDEA: Support extension main function +- [`KT-18863`](https://youtrack.jetbrains.com/issue/KT-18863) Formatter should add space after opening brace in a single-line enum declaration +- [`KT-19024`](https://youtrack.jetbrains.com/issue/KT-19024) build.gradle.kts is not supported as project +- [`KT-19124`](https://youtrack.jetbrains.com/issue/KT-19124) Creating source file with directory/package throws AE: "Write access is allowed inside write-action only" at NewKotlinFileAction$Companion.findOrCreateTarget() +- [`KT-19154`](https://youtrack.jetbrains.com/issue/KT-19154) Completion and auto-import does not suggest companion object members when inside an extension function +- [`KT-19202`](https://youtrack.jetbrains.com/issue/KT-19202) Applying 'ReplaceWith' fix in type alias can change program behaviour +- [`KT-19209`](https://youtrack.jetbrains.com/issue/KT-19209) "Stub and PSI element type mismatch" in when receiver type is annotated with @receiver +- [`KT-19277`](https://youtrack.jetbrains.com/issue/KT-19277) Optimize imports on the fly should not work in test data files +- [`KT-19278`](https://youtrack.jetbrains.com/issue/KT-19278) Optimize imports on the fly should not remove incomplete import while it's being typed +- [`KT-19322`](https://youtrack.jetbrains.com/issue/KT-19322) Script editor: Move Statement Down/Up can't move one out of top level lambda +- [`KT-19451`](https://youtrack.jetbrains.com/issue/KT-19451) "Unresolved reference" with Kotlin Android Extensions when layout defines the Android namespace as something other than "android" +- [`KT-19492`](https://youtrack.jetbrains.com/issue/KT-19492) Java 9: references from unnamed module to not exported classes of named module are compiled, but red in the editor +- [`KT-19493`](https://youtrack.jetbrains.com/issue/KT-19493) Java 9: references from named module to classes of unnamed module are not compiled, but green in the editor +- [`KT-19843`](https://youtrack.jetbrains.com/issue/KT-19843) Performance warning: LineMarker is supposed to be registered for leaf elements only +- [`KT-19889`](https://youtrack.jetbrains.com/issue/KT-19889) KotlinGradleModel : Unsupported major.minor version 52.0 +- [`KT-19885`](https://youtrack.jetbrains.com/issue/KT-19885) 200% CPU for some time on Kotlin sources (PackagePartClassUtils.hasTopLevelCallables()) +- [`KT-19901`](https://youtrack.jetbrains.com/issue/KT-19901) KotlinLanguageInjector#getLanguagesToInject can cancel any progress in which it was invoked +- [`KT-19903`](https://youtrack.jetbrains.com/issue/KT-19903) Copy Reference works incorrectly for const val +- [`KT-20153`](https://youtrack.jetbrains.com/issue/KT-20153) Kotlin facet: Java 9 `-Xadd-modules` setting produces more and more identical sub-elements of `` in .iml file + +### IDE. Completion + +- [`KT-8848`](https://youtrack.jetbrains.com/issue/KT-8848) Code completion does not support import aliases +- [`KT-18040`](https://youtrack.jetbrains.com/issue/KT-18040) There is no auto-popup competion after typing "$x." anymore +- [`KT-19015`](https://youtrack.jetbrains.com/issue/KT-19015) Smart completion: parameter list completion is not available when some of parameters are already written + +### IDE. Debugger + +- [`KT-19429`](https://youtrack.jetbrains.com/issue/KT-19429) Breakpoint appears in random place during debug + +### IDE. Inspections and Intentions + +#### New Features + +- [`KT-4748`](https://youtrack.jetbrains.com/issue/KT-4748) Remove double negation for boolean expressions intention + inspection +- [`KT-5878`](https://youtrack.jetbrains.com/issue/KT-5878) Quickfix for "variable initializer is redundant" (VARIABLE_WITH_REDUNDANT_INITIALIZER) +- [`KT-11991`](https://youtrack.jetbrains.com/issue/KT-11991) Kotlin should have an inspection to suggest the simplified format for a no argument lambda +- [`KT-12195`](https://youtrack.jetbrains.com/issue/KT-12195) Quickfix @JvmStatic on main() method in an object +- [`KT-12233`](https://youtrack.jetbrains.com/issue/KT-12233) "Package naming convention" inspection could show warning in .kt sources +- [`KT-12504`](https://youtrack.jetbrains.com/issue/KT-12504) Intention to make open class with only private constructors sealed +- [`KT-12523`](https://youtrack.jetbrains.com/issue/KT-12523) Quick-fix to remove `when` with only `else` +- [`KT-12613`](https://youtrack.jetbrains.com/issue/KT-12613) "Make abstract" on member of open or final class should make abstract both member and class +- [`KT-16033`](https://youtrack.jetbrains.com/issue/KT-16033) Automatically static import the enum value name when "Add remaining branches" on an enum from another class/file +- [`KT-16404`](https://youtrack.jetbrains.com/issue/KT-16404) Create from usage should allow generating nested classes +- [`KT-17322`](https://youtrack.jetbrains.com/issue/KT-17322) Intentions to generate a getter and a setter for a property +- [`KT-17888`](https://youtrack.jetbrains.com/issue/KT-17888) Inspection to warn about suspicious combination of == and === +- [`KT-18826`](https://youtrack.jetbrains.com/issue/KT-18826) INAPPLICABLE_LATEINIT_MODIFIER should have a quickfix to remove initializer +- [`KT-18965`](https://youtrack.jetbrains.com/issue/KT-18965) Add quick-fix for USELESS_IS_CHECK +- [`KT-19126`](https://youtrack.jetbrains.com/issue/KT-19126) Add quickfix for 'Property initializes are not allowed in interfaces' +- [`KT-19282`](https://youtrack.jetbrains.com/issue/KT-19282) Support "flip equals" intention for String.equals extension from stdlib +- [`KT-19428`](https://youtrack.jetbrains.com/issue/KT-19428) Add inspection for redundant overrides that only call the super method +- [`KT-19514`](https://youtrack.jetbrains.com/issue/KT-19514) Redundant getter / setter inspection +#### Fixes + +- [`KT-13985`](https://youtrack.jetbrains.com/issue/KT-13985) "Add remaining branches" action does not use back-ticks correctly +- [`KT-15422`](https://youtrack.jetbrains.com/issue/KT-15422) Reduce irrelevant reporting of Destructure inspection +- [`KT-17480`](https://youtrack.jetbrains.com/issue/KT-17480) Create from usage in expression body of override function should take base type into account +- [`KT-18482`](https://youtrack.jetbrains.com/issue/KT-18482) "Move lambda argument to parenthesis" action generate uncompilable code +- [`KT-18665`](https://youtrack.jetbrains.com/issue/KT-18665) "Use destructuring declaration" must not be suggested for invisible properties +- [`KT-18666`](https://youtrack.jetbrains.com/issue/KT-18666) "Use destructuring declaration" should not be reported on a variable used in destructuring declaration only +- [`KT-18978`](https://youtrack.jetbrains.com/issue/KT-18978) Intention Move to class body generates incorrect code for vararg val/var +- [`KT-19006`](https://youtrack.jetbrains.com/issue/KT-19006) Inspection message "Equality check can be used instead of elvis" is slightly confusing +- [`KT-19011`](https://youtrack.jetbrains.com/issue/KT-19011) Unnecessary import for companion object property with extension function type is automatically inserted +- [`KT-19299`](https://youtrack.jetbrains.com/issue/KT-19299) Quickfix to correct overriding function signature keeps java NotNull annotations +- [`KT-19614`](https://youtrack.jetbrains.com/issue/KT-19614) Quickfix for INVISIBLE_MEMBER doesn't offer to make member protected if referenced from subclass +- [`KT-19666`](https://youtrack.jetbrains.com/issue/KT-19666) ClassCastException in IfThenToElvisIntention +- [`KT-19704`](https://youtrack.jetbrains.com/issue/KT-19704) Don't remove braces in redundant cascade if +- [`KT-19811`](https://youtrack.jetbrains.com/issue/KT-19811) Internal member incorrectly highlighted as unused +- [`KT-19926`](https://youtrack.jetbrains.com/issue/KT-19926) Naming convention inspections: pattern is validated while edited, PSE at Pattern.error() +- [`KT-19927`](https://youtrack.jetbrains.com/issue/KT-19927) "Package naming convention" inspection checks FQN, but default pattern looks like for simple name + +### IDE. Refactorings + +- [`KT-17266`](https://youtrack.jetbrains.com/issue/KT-17266) Refactor / Inline Function: reference to member of class containing extension function is inlined wrong +- [`KT-17776`](https://youtrack.jetbrains.com/issue/KT-17776) Inline method of inner class adds 'this' for methods from enclosing class +- [`KT-19161`](https://youtrack.jetbrains.com/issue/KT-19161) Safe delete conflicts are shown incorrectly for local declarations + +### JavaScript + +#### Performance Improvements + +- [`KT-18329`](https://youtrack.jetbrains.com/issue/KT-18329) JS: for loop implementation depends on parentheses +#### Fixes + +- [`KT-12970`](https://youtrack.jetbrains.com/issue/KT-12970) Empty block expression result is 'undefined' (expected: 'kotlin.Unit') +- [`KT-13930`](https://youtrack.jetbrains.com/issue/KT-13930) Safe call for a function returning 'Unit' result is 'undefined' or 'null' (instead of 'kotlin.Unit' or 'null') +- [`KT-13932`](https://youtrack.jetbrains.com/issue/KT-13932) 'kotlin.Unit' is not materialized in some functions returning supertype of 'Unit' ('undefined' returned instead) +- [`KT-16408`](https://youtrack.jetbrains.com/issue/KT-16408) JS: Inliner loses imported values when extending a class from another module +- [`KT-17014`](https://youtrack.jetbrains.com/issue/KT-17014) Different results in JVM and JavaScript on Unit-returning functions +- [`KT-17915`](https://youtrack.jetbrains.com/issue/KT-17915) JS: 'kotlin.Unit' is not materialized as result of try-catch block expression with empty catch +- [`KT-18166`](https://youtrack.jetbrains.com/issue/KT-18166) JS: Delegated property named with non-identifier symbols can crash in runtime. +- [`KT-18176`](https://youtrack.jetbrains.com/issue/KT-18176) JS: dynamic type should not allow methods and properties with incorrect identifier symbols +- [`KT-18216`](https://youtrack.jetbrains.com/issue/KT-18216) JS: Unit-returning expression used in loop can cause wrong behavior +- [`KT-18793`](https://youtrack.jetbrains.com/issue/KT-18793) Kotlin Javascript compiler null handling generates if-else block where else is always taken +- [`KT-19108`](https://youtrack.jetbrains.com/issue/KT-19108) JS: Inconsistent behaviour from JVM code when modifying variable whilst calling run on it +- [`KT-19495`](https://youtrack.jetbrains.com/issue/KT-19495) JS: Wrong compilation of nested conditions with if- and when-clauses +- [`KT-19540`](https://youtrack.jetbrains.com/issue/KT-19540) JS: prohibit to use illegal symbols on call site +- [`KT-19542`](https://youtrack.jetbrains.com/issue/KT-19542) JS: delegate field should have unique name otherwise it can be accidentally overwritten +- [`KT-19712`](https://youtrack.jetbrains.com/issue/KT-19712) KotlinJS - providing default value of lambda-argument produces invalid js-code +- [`KT-19793`](https://youtrack.jetbrains.com/issue/KT-19793) build-crash with external varargs (Javascript) +- [`KT-19821`](https://youtrack.jetbrains.com/issue/KT-19821) JS remap sourcemaps in DCE +- [`KT-19891`](https://youtrack.jetbrains.com/issue/KT-19891) Runtime crash with inline function with reified type parameter and object expression: "T_0 is not defined" (JavaScript) +- [`KT-20005`](https://youtrack.jetbrains.com/issue/KT-20005) Invalid source map with option sourceMapEmbedSources = "always" + +### Libraries + +- [`KT-19133`](https://youtrack.jetbrains.com/issue/KT-19133) Specialize `any` and `none` for Collection +- [`KT-18267`](https://youtrack.jetbrains.com/issue/KT-18267) Deprecate CharSequence.size extension function on the JS side +- [`KT-18992`](https://youtrack.jetbrains.com/issue/KT-18992) JS: Missing MutableMap.iterator() +- [`KT-19881`](https://youtrack.jetbrains.com/issue/KT-19881) Expand doc comment of @PublishedApi + +### Tools. CLI + +- [`KT-18859`](https://youtrack.jetbrains.com/issue/KT-18859) Strange error message when kotlin-embeddable-compiler is run without explicit -kotlin-home +- [`KT-19287`](https://youtrack.jetbrains.com/issue/KT-19287) Common module compilation: K2MetadataCompiler ignores coroutines state + +### Tools. Gradle + +- [`KT-17150`](https://youtrack.jetbrains.com/issue/KT-17150) Support 'packagePrefix' option in Gradle plugin +- [`KT-19956`](https://youtrack.jetbrains.com/issue/KT-19956) Support incremental compilation to JS in Gradle +- [`KT-13918`](https://youtrack.jetbrains.com/issue/KT-13918) Cannot access internal classes/methods in androidTest source set in an Android library module +- [`KT-17355`](https://youtrack.jetbrains.com/issue/KT-17355) Use `archivesBaseName` instead of `project.name` for module names, get rid of `_main` for `main` source set +- [`KT-18183`](https://youtrack.jetbrains.com/issue/KT-18183) Kotlin gradle plugin uses compile task output as "friends directory" +- [`KT-19248`](https://youtrack.jetbrains.com/issue/KT-19248) Documentation suggested way to enable coroutines (gradle) doesn't work +- [`KT-19397`](https://youtrack.jetbrains.com/issue/KT-19397) local.properties file not closed by KotlinProperties.kt + +### Tools. Incremental Compile + +- [`KT-19580`](https://youtrack.jetbrains.com/issue/KT-19580) IC does not detect non-nested sealed class addition + +### Tools. J2K + +- [`KT-10375`](https://youtrack.jetbrains.com/issue/KT-10375) 0xFFFFFFFFFFFFFFFFL conversion issue +- [`KT-13552`](https://youtrack.jetbrains.com/issue/KT-13552) switch-to-when conversion creates broken code +- [`KT-17379`](https://youtrack.jetbrains.com/issue/KT-17379) Converting multiline expressions creates dangling operations +- [`KT-18232`](https://youtrack.jetbrains.com/issue/KT-18232) Kotlin code converter misses annotations +- [`KT-18786`](https://youtrack.jetbrains.com/issue/KT-18786) Convert Kotlin to Java generates error: Variable cannot be initialized before declaration +- [`KT-19523`](https://youtrack.jetbrains.com/issue/KT-19523) J2K produce invalid code when convert some numbers + +### Tools. JPS + +- [`KT-17397`](https://youtrack.jetbrains.com/issue/KT-17397) Kotlin JPS Builder can mark dirty files already compiled in round +- [`KT-19176`](https://youtrack.jetbrains.com/issue/KT-19176) Java 9: JPS build fails for Kotlin source referring exported Kotlin class from another module: "unresolved supertypes: kotlin.Any" +- [`KT-19833`](https://youtrack.jetbrains.com/issue/KT-19833) Cannot access class/superclass from SDK on compilation of JDK 9 module together with non-9 module + +### Tools. REPL + +- [`KT-11369`](https://youtrack.jetbrains.com/issue/KT-11369) REPL: Ctrl-C should interrupt the input, Ctrl-D should quit + +### Tools. kapt + +- [`KT-19996`](https://youtrack.jetbrains.com/issue/KT-19996) Error with 'kotlin-kapt' plugin and dagger2, clean project required + +## 1.1.4-3 + +- [`KT-18062`](https://youtrack.jetbrains.com/issue/KT-18062) SamWithReceiver compiler plugin not used by IntelliJ for .kt files +- [`KT-18497`](https://youtrack.jetbrains.com/issue/KT-18497) Gradle Kotlin Plugin does not work with the gradle java-library plugin +- [`KT-19276`](https://youtrack.jetbrains.com/issue/KT-19276) Console spam when opening idea-community project in debug IDEA +- [`KT-19433`](https://youtrack.jetbrains.com/issue/KT-19433) [Coroutines + Kapt3] Assertion failed in ClassClsStubBuilder.createNestedClassStub +- [`KT-19680`](https://youtrack.jetbrains.com/issue/KT-19680) kapt3 & Parcelize: Compilation error +- [`KT-19687`](https://youtrack.jetbrains.com/issue/KT-19687) Kotlin 1.1.4 noarg plugin breaks with sealed classes +- [`KT-19700`](https://youtrack.jetbrains.com/issue/KT-19700) Kapt error after updating to 1.1.4 - stub adds type parameters where there are none +- [`KT-19713`](https://youtrack.jetbrains.com/issue/KT-19713) Mocking of final named suspend methods with mockito fails +- [`KT-19729`](https://youtrack.jetbrains.com/issue/KT-19729) kapt3: not always including argument to @javax.inject.Named in generated stubs +- [`KT-19759`](https://youtrack.jetbrains.com/issue/KT-19759) "Convert to expression body" is not shown in 162 / AS23 branches for multi-liners +- [`KT-19767`](https://youtrack.jetbrains.com/issue/KT-19767) NPE caused by Map?.get +- [`KT-19769`](https://youtrack.jetbrains.com/issue/KT-19769) PerModulePackageCacheService calls getOrderEntriesForFile() for every file, even those that can't affect Kotlin resolve +- [`KT-19774`](https://youtrack.jetbrains.com/issue/KT-19774) Provide an opt-out flag for separate classes directories (Gradle 4.0+) +- [`KT-19847`](https://youtrack.jetbrains.com/issue/KT-19847) if an imported library already exists it should be redetected during gradle import + +## 1.1.4-2 + +- [`KT-19679`](https://youtrack.jetbrains.com/issue/KT-19679) CompilationException: Couldn't inline method call 'methodName' into... +- [`KT-19690`](https://youtrack.jetbrains.com/issue/KT-19690) Lazy field in interface default method leads to ClassFormatError +- [`KT-19716`](https://youtrack.jetbrains.com/issue/KT-19716) Quickdoc `Ctrl+Q` broken while browsing code completion list `Ctrl-Space` +- [`KT-19717`](https://youtrack.jetbrains.com/issue/KT-19717) Library kind incorrectly detected for vertx-web in Kotlin project +- [`KT-19723`](https://youtrack.jetbrains.com/issue/KT-19723) "Insufficient maximum stack size" during compilation + +## 1.1.4 + +### Android + +#### New Features + +- [`KT-11048`](https://youtrack.jetbrains.com/issue/KT-11048) Android Extensions: cannot evaluate expression containing generated properties +#### Performance Improvements + +- [`KT-10542`](https://youtrack.jetbrains.com/issue/KT-10542) Android Extensions: No cache for Views +- [`KT-18250`](https://youtrack.jetbrains.com/issue/KT-18250) Android Extensions: Allow to use SparseArray as a View cache +#### Fixes + +- [`KT-11051`](https://youtrack.jetbrains.com/issue/KT-11051) Android Extensions: completion of generated properties is unclear for ambiguous ids +- [`KT-14086`](https://youtrack.jetbrains.com/issue/KT-14086) Android-extensions not generated using flavors dimension +- [`KT-14912`](https://youtrack.jetbrains.com/issue/KT-14912) Lint: "Code contains STOPSHIP marker" ignores suppress annotation +- [`KT-15164`](https://youtrack.jetbrains.com/issue/KT-15164) Kotlin Lint: problems in delegate expression are not reported +- [`KT-16934`](https://youtrack.jetbrains.com/issue/KT-16934) Android Extensions fails to compile when importing synthetic properties for layouts in other modules +- [`KT-17641`](https://youtrack.jetbrains.com/issue/KT-17641) Problem with Kotlin Android Extensions and Gradle syntax +- [`KT-17783`](https://youtrack.jetbrains.com/issue/KT-17783) Kotlin Lint: quick fixes to add inapplicable @RequiresApi and @SuppressLint make code incompilable +- [`KT-17786`](https://youtrack.jetbrains.com/issue/KT-17786) Kotlin Lint: "Surround with if()" quick fix is not suggested for single expression `get()` +- [`KT-17787`](https://youtrack.jetbrains.com/issue/KT-17787) Kotlin Lint: "Add @TargetApi" quick fix is not suggested for top level property accessor +- [`KT-17788`](https://youtrack.jetbrains.com/issue/KT-17788) Kotlin Lint: "Surround with if()" quick fix corrupts code in case of destructuring declaration +- [`KT-17890`](https://youtrack.jetbrains.com/issue/KT-17890) [kotlin-android-extensions] Renaming layout file does not rename import +- [`KT-18012`](https://youtrack.jetbrains.com/issue/KT-18012) Kotlin Android Extensions generates `@NotNull` properties for views present in a configuration and potentially missing in another +- [`KT-18545`](https://youtrack.jetbrains.com/issue/KT-18545) Accessing to synthetic properties on smart casted Android components crashed compiler + +### Compiler + +#### New Features + +- [`KT-10942`](https://youtrack.jetbrains.com/issue/KT-10942) Support meta-annotations from JSR 305 for nullability qualifiers +- [`KT-14187`](https://youtrack.jetbrains.com/issue/KT-14187) Redundant "is" check is not detected +- [`KT-16603`](https://youtrack.jetbrains.com/issue/KT-16603) Support `inline suspend` function +- [`KT-17585`](https://youtrack.jetbrains.com/issue/KT-17585) Generate state machine for named functions in their bodies +#### Performance Improvements + +- [`KT-3098`](https://youtrack.jetbrains.com/issue/KT-3098) Generate efficient comparisons +- [`KT-6247`](https://youtrack.jetbrains.com/issue/KT-6247) Optimization for 'in' and '..' +- [`KT-7571`](https://youtrack.jetbrains.com/issue/KT-7571) Don't box Double instance to call hashCode on Java 8 +- [`KT-9900`](https://youtrack.jetbrains.com/issue/KT-9900) Optimize range operations for 'until' extension from stdlib +- [`KT-11959`](https://youtrack.jetbrains.com/issue/KT-11959) Unnceessary boxing/unboxing due to Comparable.compareTo +- [`KT-12158`](https://youtrack.jetbrains.com/issue/KT-12158) Optimize away boxing when comparing nullable primitive type value to primitive value +- [`KT-13682`](https://youtrack.jetbrains.com/issue/KT-13682) Reuse StringBuilder for concatenation and string interpolation +- [`KT-14323`](https://youtrack.jetbrains.com/issue/KT-14323) IntelliJ lockup when using Apache Spark UDF +- [`KT-14375`](https://youtrack.jetbrains.com/issue/KT-14375) Kotlin compiler failure with spark when creating a flexible type for scala.Function22 +- [`KT-15235`](https://youtrack.jetbrains.com/issue/KT-15235) Escaped characters in template strings are generating inefficient implementations +- [`KT-17280`](https://youtrack.jetbrains.com/issue/KT-17280) Inline constant expressions in string templates +- [`KT-17903`](https://youtrack.jetbrains.com/issue/KT-17903) Generate 'for-in-indices' as a precondition loop +- [`KT-18157`](https://youtrack.jetbrains.com/issue/KT-18157) Optimize out trivial INSTANCEOF checks +- [`KT-18162`](https://youtrack.jetbrains.com/issue/KT-18162) Do not check nullability assertions twice for effectively same value +- [`KT-18164`](https://youtrack.jetbrains.com/issue/KT-18164) Do not check nullability for values that have been already checked with !! +- [`KT-18478`](https://youtrack.jetbrains.com/issue/KT-18478) Unnecessary nullification of bound variables +- [`KT-18558`](https://youtrack.jetbrains.com/issue/KT-18558) Flatten nested string concatenation +- [`KT-18777`](https://youtrack.jetbrains.com/issue/KT-18777) Unnecessary boolean negation generated for 'if (expr !in range)' +#### Fixes + +- [`KT-1809`](https://youtrack.jetbrains.com/issue/KT-1809) Confusing diagnostics when wrong number of type arguments are specified and there are several callee candiates +- [`KT-2007`](https://youtrack.jetbrains.com/issue/KT-2007) Improve diagnostics when + in not resolved on a pair of nullable ints +- [`KT-5066`](https://youtrack.jetbrains.com/issue/KT-5066) Bad diagnostic message for ABSTRACT_MEMBER_NOT_IMPLEMENTED for (companion) object +- [`KT-5511`](https://youtrack.jetbrains.com/issue/KT-5511) Inconsistent handling of inner enum +- [`KT-7773`](https://youtrack.jetbrains.com/issue/KT-7773) Disallow to explicitly extend Enum class +- [`KT-7975`](https://youtrack.jetbrains.com/issue/KT-7975) Unclear error message when redundant type arguments supplied +- [`KT-8340`](https://youtrack.jetbrains.com/issue/KT-8340) vararg in a property setter must be an error +- [`KT-8612`](https://youtrack.jetbrains.com/issue/KT-8612) Incorrect error message for var extension property without getter or setter +- [`KT-8829`](https://youtrack.jetbrains.com/issue/KT-8829) Type parameter of a class is not resolved in the constructor parameter's default value +- [`KT-8845`](https://youtrack.jetbrains.com/issue/KT-8845) Bogus diagnostic on infix operation "in" +- [`KT-9282`](https://youtrack.jetbrains.com/issue/KT-9282) Improve diagnostic on overload resolution ambiguity when a nullable argument is passed to non-null parameter +- [`KT-10045`](https://youtrack.jetbrains.com/issue/KT-10045) Not specific enough compiler error message in case of trying to call overloaded private methods +- [`KT-10164`](https://youtrack.jetbrains.com/issue/KT-10164) Incorrect error message for external inline method +- [`KT-10248`](https://youtrack.jetbrains.com/issue/KT-10248) Smart casts: Misleading error on overloaded function call +- [`KT-10657`](https://youtrack.jetbrains.com/issue/KT-10657) Confusing diagnostic when trying to invoke value as a function +- [`KT-10839`](https://youtrack.jetbrains.com/issue/KT-10839) Weird diagnostics on callable reference of unresolved class +- [`KT-11119`](https://youtrack.jetbrains.com/issue/KT-11119) Confusing error message when overloaded method is called on nullable receiver +- [`KT-12408`](https://youtrack.jetbrains.com/issue/KT-12408) Generic information lost for override values +- [`KT-12551`](https://youtrack.jetbrains.com/issue/KT-12551) Report "unused expression" on unused bound double colon expressions +- [`KT-13749`](https://youtrack.jetbrains.com/issue/KT-13749) Error highlighting range for no 'override' modifier is bigger than needed +- [`KT-14598`](https://youtrack.jetbrains.com/issue/KT-14598) Do not report "member is final and cannot be overridden" when overriding something from final class +- [`KT-14633`](https://youtrack.jetbrains.com/issue/KT-14633) "If must have both main and else branches" diagnostic range is too high +- [`KT-14647`](https://youtrack.jetbrains.com/issue/KT-14647) Confusing error message "'@receiver:' annotations could be applied only to extension function or extension property declarations" +- [`KT-14927`](https://youtrack.jetbrains.com/issue/KT-14927) TCE in QualifiedExpressionResolver +- [`KT-15243`](https://youtrack.jetbrains.com/issue/KT-15243) Report deprecation on usages of type alias expanded to a deprecated class +- [`KT-15804`](https://youtrack.jetbrains.com/issue/KT-15804) Prohibit having duplicate parameter names in functional types +- [`KT-15810`](https://youtrack.jetbrains.com/issue/KT-15810) destructuring declarations don't work in scripts on the top level +- [`KT-15931`](https://youtrack.jetbrains.com/issue/KT-15931) IllegalStateException: ClassDescriptor of superType should not be null: T by a +- [`KT-16016`](https://youtrack.jetbrains.com/issue/KT-16016) Compiler failure with NO_EXPECTED_TYPE +- [`KT-16448`](https://youtrack.jetbrains.com/issue/KT-16448) Inline suspend functions with inlined suspend invocations are miscompiled (VerifyError, ClassNotFound) +- [`KT-16576`](https://youtrack.jetbrains.com/issue/KT-16576) Wrong code generated with skynet benchmark +- [`KT-17007`](https://youtrack.jetbrains.com/issue/KT-17007) Kotlin is not optimizing away unreachable code based on const vals +- [`KT-17188`](https://youtrack.jetbrains.com/issue/KT-17188) Do not propose to specify constructor invocation for classes without an accessible constructor +- [`KT-17611`](https://youtrack.jetbrains.com/issue/KT-17611) Unnecessary "Name shadowed" warning on parameter of local function or local class member +- [`KT-17692`](https://youtrack.jetbrains.com/issue/KT-17692) NPE in compiler when calling KClass.java on function result of type Unit +- [`KT-17820`](https://youtrack.jetbrains.com/issue/KT-17820) False "useless cast" when target type is flexible +- [`KT-17972`](https://youtrack.jetbrains.com/issue/KT-17972) Anonymous class generated from lambda captures its outer and tries to set nonexistent this$0 field. +- [`KT-18029`](https://youtrack.jetbrains.com/issue/KT-18029) typealias not working in .kts files +- [`KT-18085`](https://youtrack.jetbrains.com/issue/KT-18085) Compilation Error:Kotlin: [Internal Error] kotlin.TypeCastException: null cannot be cast to non-null type com.intellij.psi.PsiElement +- [`KT-18115`](https://youtrack.jetbrains.com/issue/KT-18115) Generic inherited classes in different packages with coroutine causes java.lang.VerifyError: Bad local variable type +- [`KT-18189`](https://youtrack.jetbrains.com/issue/KT-18189) Incorrect generic signature generated for implementation methods overriding special built-ins +- [`KT-18234`](https://youtrack.jetbrains.com/issue/KT-18234) Top-level variables in script aren't local variables +- [`KT-18413`](https://youtrack.jetbrains.com/issue/KT-18413) Strange compiler error - probably incremental compiler +- [`KT-18486`](https://youtrack.jetbrains.com/issue/KT-18486) Superfluos generation of suspend function state-machine because of inner suspension of different coroutine +- [`KT-18598`](https://youtrack.jetbrains.com/issue/KT-18598) Report error on access to declarations from non-exported packages and from inaccessible modules on Java 9 +- [`KT-18698`](https://youtrack.jetbrains.com/issue/KT-18698) java.lang.IllegalStateException: resolveToInstruction: incorrect index -1 for label L12 in subroutine +- [`KT-18702`](https://youtrack.jetbrains.com/issue/KT-18702) Proguard warning with Kotlin 1.2-M1 +- [`KT-18728`](https://youtrack.jetbrains.com/issue/KT-18728) Integer method reference application fails with CompilationException: Back-end (JVM) Internal error +- [`KT-18845`](https://youtrack.jetbrains.com/issue/KT-18845) Exception on building gradle project with collection literals +- [`KT-18867`](https://youtrack.jetbrains.com/issue/KT-18867) Getting constant "VerifyError: Operand stack underflow" from Kotlin plugin +- [`KT-18916`](https://youtrack.jetbrains.com/issue/KT-18916) Strange bytecode generated for 'null' passed as SAM adapter for Java interface +- [`KT-18983`](https://youtrack.jetbrains.com/issue/KT-18983) Coroutines: miscompiled suspend for loop (local variables are not spilled around suspension points) +- [`KT-19175`](https://youtrack.jetbrains.com/issue/KT-19175) Compiler generates different bytecode when classes are compiled separately or together +- [`KT-19246`](https://youtrack.jetbrains.com/issue/KT-19246) Using generic inline function inside inline extension function throws java.lang.VerifyError: Bad return type +- [`KT-19419`](https://youtrack.jetbrains.com/issue/KT-19419) Support JSR 305 meta-annotations in libraries even when JSR 305 JAR is not on the classpath + +### IDE + +#### New Features + +- [`KT-2638`](https://youtrack.jetbrains.com/issue/KT-2638) Inline property (with accessors) refactoring +- [`KT-7107`](https://youtrack.jetbrains.com/issue/KT-7107) Rename refactoring for labels +- [`KT-9818`](https://youtrack.jetbrains.com/issue/KT-9818) Code style for method expression bodies +- [`KT-11994`](https://youtrack.jetbrains.com/issue/KT-11994) Data flow analysis support for Kotlin in IntelliJ +- [`KT-14126`](https://youtrack.jetbrains.com/issue/KT-14126) Code style wrapping options for enum constants +- [`KT-14929`](https://youtrack.jetbrains.com/issue/KT-14929) Deprecated ReplaceWith for type aliases +- [`KT-14950`](https://youtrack.jetbrains.com/issue/KT-14950) Code Style: Wrapping and Braces / "Local variable annotations" setting could be supported +- [`KT-14965`](https://youtrack.jetbrains.com/issue/KT-14965) "Configure Kotlin in project" should support build.gradle.kts +- [`KT-15504`](https://youtrack.jetbrains.com/issue/KT-15504) Add code style options to limit number of blank lines +- [`KT-16558`](https://youtrack.jetbrains.com/issue/KT-16558) Code Style: Add Options for "Spaces Before Parentheses" +- [`KT-18113`](https://youtrack.jetbrains.com/issue/KT-18113) Add new line options to code style for method parameters +- [`KT-18605`](https://youtrack.jetbrains.com/issue/KT-18605) Option to not use continuation indent in chained calls +- [`KT-18607`](https://youtrack.jetbrains.com/issue/KT-18607) Options to put blank lines between 'when' branches +#### Performance Improvements + +- [`KT-14606`](https://youtrack.jetbrains.com/issue/KT-14606) Code completion calculates decompiled text when building lookup elements for PSI from compiled classes +- [`KT-17751`](https://youtrack.jetbrains.com/issue/KT-17751) Kotlin slows down java inspections big time +- [`KT-17835`](https://youtrack.jetbrains.com/issue/KT-17835) 10s hang on IDEA project open +- [`KT-18842`](https://youtrack.jetbrains.com/issue/KT-18842) Very slow typing in certain files of Kotlin project +- [`KT-18921`](https://youtrack.jetbrains.com/issue/KT-18921) Configure library kind explicitly +#### Fixes + +- [`KT-6610`](https://youtrack.jetbrains.com/issue/KT-6610) Language injection doesn't work with String Interpolation +- [`KT-8893`](https://youtrack.jetbrains.com/issue/KT-8893) Quick documentation shows type for top-level object-type elements, but "no name provided" for local ones +- [`KT-9359`](https://youtrack.jetbrains.com/issue/KT-9359) "Accidental override" error message does not mention class (type) names +- [`KT-10736`](https://youtrack.jetbrains.com/issue/KT-10736) Highlighting usages doesn't work for synthetic properties created by the Android Extensions +- [`KT-11980`](https://youtrack.jetbrains.com/issue/KT-11980) Spring: Generate Constructor, Setter Dependency in XML for Kotlin class: IOE at LightElement.add() +- [`KT-12123`](https://youtrack.jetbrains.com/issue/KT-12123) Formatter: always indent after newline in variable initialization +- [`KT-12910`](https://youtrack.jetbrains.com/issue/KT-12910) spring: create init-method/destroy-method from usage results in IOE +- [`KT-13072`](https://youtrack.jetbrains.com/issue/KT-13072) Kotlin struggles to index JDK 9 classes +- [`KT-13099`](https://youtrack.jetbrains.com/issue/KT-13099) formatting in angle brackets ignored and not fixed +- [`KT-14083`](https://youtrack.jetbrains.com/issue/KT-14083) Formatting of where clasuses +- [`KT-14271`](https://youtrack.jetbrains.com/issue/KT-14271) Value captured in closure doesn't always get highlighted +- [`KT-14561`](https://youtrack.jetbrains.com/issue/KT-14561) Use regular indent for the primary constructor parameters +- [`KT-14974`](https://youtrack.jetbrains.com/issue/KT-14974) "Find Usages" hangs in ExpressionsOfTypeProcessor +- [`KT-15093`](https://youtrack.jetbrains.com/issue/KT-15093) Navigation to library may not work if there's another module in same project that references same jar via a different library +- [`KT-15270`](https://youtrack.jetbrains.com/issue/KT-15270) Quickfix to migrate from @native*** +- [`KT-16352`](https://youtrack.jetbrains.com/issue/KT-16352) Create from usage inserts extra space in first step +- [`KT-16725`](https://youtrack.jetbrains.com/issue/KT-16725) Formatter does not fix spaces before square brackets +- [`KT-16999`](https://youtrack.jetbrains.com/issue/KT-16999) "Parameter info" shows duplicates on toString +- [`KT-17357`](https://youtrack.jetbrains.com/issue/KT-17357) BuiltIns for module build with project LV settings, not with facet module settings +- [`KT-17394`](https://youtrack.jetbrains.com/issue/KT-17394) Core formatting is wrong for expression body properties +- [`KT-17759`](https://youtrack.jetbrains.com/issue/KT-17759) Breakpoints not working in JS +- [`KT-17771`](https://youtrack.jetbrains.com/issue/KT-17771) Kotlin IntelliJ plugin should resolve Gradle script classpath asynchronously +- [`KT-17818`](https://youtrack.jetbrains.com/issue/KT-17818) Formatting of long constructors is inconsistent with Kotlin code conventions +- [`KT-17849`](https://youtrack.jetbrains.com/issue/KT-17849) Automatically insert trimMargin() or trimIndent() on enter in multi-line strings +- [`KT-17855`](https://youtrack.jetbrains.com/issue/KT-17855) Main function is shown as unused +- [`KT-17894`](https://youtrack.jetbrains.com/issue/KT-17894) String `trimIndent` support inserts wrong indent in some cases +- [`KT-17942`](https://youtrack.jetbrains.com/issue/KT-17942) Enter in multiline string with injection doesn't add a proper indent +- [`KT-17956`](https://youtrack.jetbrains.com/issue/KT-17956) Type hints for properties that only consist of constructor calls don't add much value +- [`KT-18006`](https://youtrack.jetbrains.com/issue/KT-18006) Copying part of string literal with escape sequences converts this sequences to special characters +- [`KT-18030`](https://youtrack.jetbrains.com/issue/KT-18030) Parameters hints: `kotlin.arrayOf(elements)` should be on the blacklist by default +- [`KT-18059`](https://youtrack.jetbrains.com/issue/KT-18059) Kotlin Lint: False positive error "requires api level 24" for interface method with body +- [`KT-18149`](https://youtrack.jetbrains.com/issue/KT-18149) PIEAE "Element class CompositeElement of type REFERENCE_EXPRESSION (class KtNameReferenceExpressionElementType)" at PsiInvalidElementAccessException.createByNode() +- [`KT-18151`](https://youtrack.jetbrains.com/issue/KT-18151) Do not import jdkHome from Gradle/Maven model +- [`KT-18158`](https://youtrack.jetbrains.com/issue/KT-18158) Expand selection should select the comment after expression getter on the same line +- [`KT-18186`](https://youtrack.jetbrains.com/issue/KT-18186) Create function from usage should infer expected return type +- [`KT-18221`](https://youtrack.jetbrains.com/issue/KT-18221) AE at org.jetbrains.kotlin.analyzer.ResolverForProjectImpl.descriptorForModule +- [`KT-18269`](https://youtrack.jetbrains.com/issue/KT-18269) Find Usages fails to find operator-style usages of `invoke()` defined as extension +- [`KT-18298`](https://youtrack.jetbrains.com/issue/KT-18298) spring: strange menu at "Navige to the spring bean" gutter +- [`KT-18309`](https://youtrack.jetbrains.com/issue/KT-18309) Join lines breaks code +- [`KT-18373`](https://youtrack.jetbrains.com/issue/KT-18373) Facet: can't change target platform between JVM versions +- [`KT-18376`](https://youtrack.jetbrains.com/issue/KT-18376) Maven import fails with NPE at ArgumentUtils.convertArgumentsToStringList() if `jvmTarget` setting is absent +- [`KT-18418`](https://youtrack.jetbrains.com/issue/KT-18418) Generate equals and hashCode should be available for classes without properties +- [`KT-18429`](https://youtrack.jetbrains.com/issue/KT-18429) Android strings resources folding false positives +- [`KT-18444`](https://youtrack.jetbrains.com/issue/KT-18444) Type hints don't work for destructuring declarations +- [`KT-18475`](https://youtrack.jetbrains.com/issue/KT-18475) Gradle/IntelliJ sync can result in IntelliJ modules getting gradle artifacts added to the classpath, breaking compilation +- [`KT-18479`](https://youtrack.jetbrains.com/issue/KT-18479) Can't find usages of invoke operator with vararg parameter +- [`KT-18501`](https://youtrack.jetbrains.com/issue/KT-18501) Quick Documentation doesn't show when @Supress("unused") is above the javadoc +- [`KT-18566`](https://youtrack.jetbrains.com/issue/KT-18566) Long find usages for operators when there are several operators for the same type +- [`KT-18596`](https://youtrack.jetbrains.com/issue/KT-18596) "Generate hashCode" produces poorly formatted code +- [`KT-18725`](https://youtrack.jetbrains.com/issue/KT-18725) Android: `kotlin-language` facet disappears on reopening the project +- [`KT-18974`](https://youtrack.jetbrains.com/issue/KT-18974) Type hints shouldn't appear for negative literals +- [`KT-19054`](https://youtrack.jetbrains.com/issue/KT-19054) Lags in typing in string literal +- [`KT-19062`](https://youtrack.jetbrains.com/issue/KT-19062) Member navigation doesn't work in expression bodies of getters with inferred property type +- [`KT-19210`](https://youtrack.jetbrains.com/issue/KT-19210) Command line flags like -Xload-jsr305-annotations have no effect in IDE +- [`KT-19303`](https://youtrack.jetbrains.com/issue/KT-19303) Project language version settings are used to analyze libraries, disabling module-specific analysis flags like -Xjsr305-annotations + +### IDE. Completion + +- [`KT-8208`](https://youtrack.jetbrains.com/issue/KT-8208) Support static member completion with not-imported-yet classes +- [`KT-12104`](https://youtrack.jetbrains.com/issue/KT-12104) Smart completion does not work with "invoke" when receiver is expression +- [`KT-17074`](https://youtrack.jetbrains.com/issue/KT-17074) Incorrect autocomplete suggestions for contexts affected by @DslMarker +- [`KT-18443`](https://youtrack.jetbrains.com/issue/KT-18443) IntelliJ not handling default constructor argument from companion object well +- [`KT-19191`](https://youtrack.jetbrains.com/issue/KT-19191) Disable completion binding context caching by default + +### IDE. Debugger + +- [`KT-14845`](https://youtrack.jetbrains.com/issue/KT-14845) Evaluate expression freezes debugger while evaluating filter, for time proportional to number of elements in collection. +- [`KT-17120`](https://youtrack.jetbrains.com/issue/KT-17120) Evaluate expression: cannot find local variable +- [`KT-18453`](https://youtrack.jetbrains.com/issue/KT-18453) Support 'Step over' and 'Force step over' action for suspended calls +- [`KT-18577`](https://youtrack.jetbrains.com/issue/KT-18577) Debug: Smart Step Into does not enter functions passed as variable or parameter: "Method invoke() has not been called" +- [`KT-18632`](https://youtrack.jetbrains.com/issue/KT-18632) Debug: Smart Step Into does not enter functions passed as variable or parameter when signature of lambda and parameter doesn't match +- [`KT-18949`](https://youtrack.jetbrains.com/issue/KT-18949) Can't stop on breakpoint after call to inline in Android Studio +- [`KT-19403`](https://youtrack.jetbrains.com/issue/KT-19403) 30s complete hangs of application on breakpoints stop attempt + +### IDE. Inspections and Intentions + +#### New Features + +- [`KT-12119`](https://youtrack.jetbrains.com/issue/KT-12119) Intention to replace .addAll() on a mutable collection with += +- [`KT-13436`](https://youtrack.jetbrains.com/issue/KT-13436) Replace 'when' with return: handle case when all branches jump out (return Nothing) +- [`KT-13458`](https://youtrack.jetbrains.com/issue/KT-13458) Cascade "replace with return" for if/when expressions +- [`KT-13676`](https://youtrack.jetbrains.com/issue/KT-13676) Add better quickfix for 'let' and 'error 'only not null or asserted calls are allowed' +- [`KT-14648`](https://youtrack.jetbrains.com/issue/KT-14648) Add quickfix for @receiver annotation being applied to extension member instead of extension type +- [`KT-14799`](https://youtrack.jetbrains.com/issue/KT-14799) Add inspection to simplify successive null checks into safe-call and null check +- [`KT-14900`](https://youtrack.jetbrains.com/issue/KT-14900) "Lift return out of when/if" should work with control flow expressions +- [`KT-15257`](https://youtrack.jetbrains.com/issue/KT-15257) JS: quickfix to migrate from @native to external +- [`KT-15368`](https://youtrack.jetbrains.com/issue/KT-15368) Add intention to convert Boolean? == true to ?: false and vice versa +- [`KT-15893`](https://youtrack.jetbrains.com/issue/KT-15893) "Array property in data class" inspection could have a quick fix to generate `equals()` and `hashcode()` +- [`KT-15958`](https://youtrack.jetbrains.com/issue/KT-15958) Inspection to inline "unnecessary" variables +- [`KT-16063`](https://youtrack.jetbrains.com/issue/KT-16063) Inspection to suggest converting block body to expression body +- [`KT-17198`](https://youtrack.jetbrains.com/issue/KT-17198) Inspection to replace filter calls followed by functions with a predicate variant +- [`KT-17580`](https://youtrack.jetbrains.com/issue/KT-17580) Add remaning branches intention should be available for sealed classes +- [`KT-17583`](https://youtrack.jetbrains.com/issue/KT-17583) Support "Declaration access can be weaker" inspection for kotlin properties +- [`KT-17815`](https://youtrack.jetbrains.com/issue/KT-17815) Quick-fix "Replace with safe call & elvis" +- [`KT-17842`](https://youtrack.jetbrains.com/issue/KT-17842) Add quick-fix for NO_CONSTRUCTOR error +- [`KT-17895`](https://youtrack.jetbrains.com/issue/KT-17895) Inspection to replace 'a .. b-1' with 'a until b' +- [`KT-17919`](https://youtrack.jetbrains.com/issue/KT-17919) Add "Simplify if" intention/inspection +- [`KT-17920`](https://youtrack.jetbrains.com/issue/KT-17920) Add intention/inspection removing redundant spread operator for arrayOf call +- [`KT-17970`](https://youtrack.jetbrains.com/issue/KT-17970) Intention actions to format parameter/argument list placing each on separate line +- [`KT-18236`](https://youtrack.jetbrains.com/issue/KT-18236) Add inspection for potentially wrongly placed unary operators +- [`KT-18274`](https://youtrack.jetbrains.com/issue/KT-18274) Add inspection to replace map+joinTo with joinTo(transform) +- [`KT-18386`](https://youtrack.jetbrains.com/issue/KT-18386) Inspection to detect safe calls of orEmpty() +- [`KT-18438`](https://youtrack.jetbrains.com/issue/KT-18438) Add inspection for empty ranges with start > endInclusive +- [`KT-18460`](https://youtrack.jetbrains.com/issue/KT-18460) Add intentions to apply De Morgan's laws to conditions +- [`KT-18516`](https://youtrack.jetbrains.com/issue/KT-18516) Add inspection to detect & remove redundant Unit +- [`KT-18517`](https://youtrack.jetbrains.com/issue/KT-18517) Provide "Remove explicit type" inspection for some obvious cases +- [`KT-18534`](https://youtrack.jetbrains.com/issue/KT-18534) Quick-fix to add empty brackets after primary constructor +- [`KT-18540`](https://youtrack.jetbrains.com/issue/KT-18540) Add quickfix to create data class property from usage in destructuring declaration +- [`KT-18615`](https://youtrack.jetbrains.com/issue/KT-18615) Inspection to replace if with three or more options with when +- [`KT-18749`](https://youtrack.jetbrains.com/issue/KT-18749) Inspection for useless operations on collection with not-null elements +- [`KT-18830`](https://youtrack.jetbrains.com/issue/KT-18830) "Lift return out of try" +#### Fixes + +- [`KT-11906`](https://youtrack.jetbrains.com/issue/KT-11906) Spring: "Create getter / setter" quick fixes cause IOE at LightElement.add() +- [`KT-12524`](https://youtrack.jetbrains.com/issue/KT-12524) Wrong "redundant semicolon" for semicolon inside an enum class before the companion object declaration +- [`KT-13870`](https://youtrack.jetbrains.com/issue/KT-13870) Wrong caption "Change to property access" for Quick Fix to convert class instantiation to object reference +- [`KT-13886`](https://youtrack.jetbrains.com/issue/KT-13886) Unused variable intention should remove constant initializer +- [`KT-14092`](https://youtrack.jetbrains.com/issue/KT-14092) "Make " intention inserts modifier between annotation and class keywords +- [`KT-14093`](https://youtrack.jetbrains.com/issue/KT-14093) "Make " intention available only on modifier when declaration already have a visibility modifier +- [`KT-14643`](https://youtrack.jetbrains.com/issue/KT-14643) "Add non-null asserted call" quickfix should not be offered on literal null constants +- [`KT-15242`](https://youtrack.jetbrains.com/issue/KT-15242) Create type from usage should include constraints into base types +- [`KT-16046`](https://youtrack.jetbrains.com/issue/KT-16046) Globally unused typealias is not marked as such +- [`KT-16069`](https://youtrack.jetbrains.com/issue/KT-16069) "Simplify if statement" doesn't work in specific case +- [`KT-17026`](https://youtrack.jetbrains.com/issue/KT-17026) "Replace explicit parameter" should not be shown on destructuring declaration +- [`KT-17092`](https://youtrack.jetbrains.com/issue/KT-17092) Create function from usage works incorrectly with ::class expression +- [`KT-17353`](https://youtrack.jetbrains.com/issue/KT-17353) "Create type parameter from usage" should not be offered for unresolved annotations +- [`KT-17537`](https://youtrack.jetbrains.com/issue/KT-17537) Create from Usage should suggest Boolean return type if function is used in if condition +- [`KT-17623`](https://youtrack.jetbrains.com/issue/KT-17623) "Remove explicit type arguments" is too conservative sometimes +- [`KT-17651`](https://youtrack.jetbrains.com/issue/KT-17651) Create property from usage should make lateinit var +- [`KT-17726`](https://youtrack.jetbrains.com/issue/KT-17726) Nullability quick-fixes operate incorrectly with implicit nullable receiver +- [`KT-17740`](https://youtrack.jetbrains.com/issue/KT-17740) CME at MakeOverriddenMemberOpenFix.getText() +- [`KT-18506`](https://youtrack.jetbrains.com/issue/KT-18506) Inspection on final Kotlin spring components is false positive +- [`KT-17823`](https://youtrack.jetbrains.com/issue/KT-17823) Intention "Make private" and friends should respect modifier order +- [`KT-17917`](https://youtrack.jetbrains.com/issue/KT-17917) Superfluos suggestion to add replaceWith for DeprecationLevel.HIDDEN +- [`KT-17954`](https://youtrack.jetbrains.com/issue/KT-17954) Setting error severity on "Kotlin | Function or property has platform type" does not show up as error in IDE +- [`KT-17996`](https://youtrack.jetbrains.com/issue/KT-17996) Android Studio Default Constructor Command Removes Custom Setter +- [`KT-18033`](https://youtrack.jetbrains.com/issue/KT-18033) Do not suggest to cast expression to non-nullable type when it's the same as !! +- [`KT-18035`](https://youtrack.jetbrains.com/issue/KT-18035) Quickfix for "CanBePrimaryConstructorProperty" does not work correctly with vararg constructor properties +- [`KT-18044`](https://youtrack.jetbrains.com/issue/KT-18044) "Move to class body" intention: better placement in the body +- [`KT-18074`](https://youtrack.jetbrains.com/issue/KT-18074) Suggestion in Intention 'Specify return type explicitly' doesn't support generic type parameter +- [`KT-18120`](https://youtrack.jetbrains.com/issue/KT-18120) Recursive property accessor gives false positives +- [`KT-18148`](https://youtrack.jetbrains.com/issue/KT-18148) Incorrect, not working quickfix - final and can't be overridden +- [`KT-18160`](https://youtrack.jetbrains.com/issue/KT-18160) Circular autofix actions between redundant modality and non-final variable with allopen plugin +- [`KT-18194`](https://youtrack.jetbrains.com/issue/KT-18194) "Protected in final" inspection works incorrectly with all-open +- [`KT-18195`](https://youtrack.jetbrains.com/issue/KT-18195) "Redundant modality" is not reported with all-open +- [`KT-18197`](https://youtrack.jetbrains.com/issue/KT-18197) Redundant "make open" for abstract class member with all-open +- [`KT-18253`](https://youtrack.jetbrains.com/issue/KT-18253) Wrong location of "Redundant 'toString()' call in string template" quickfix +- [`KT-18347`](https://youtrack.jetbrains.com/issue/KT-18347) Nullability quickfixes are not helpful when using invoke operator +- [`KT-18368`](https://youtrack.jetbrains.com/issue/KT-18368) "Cast expression x to Type" fails for expression inside argument list +- [`KT-18375`](https://youtrack.jetbrains.com/issue/KT-18375) Backticked function name is suggested to be renamed to the same name +- [`KT-18385`](https://youtrack.jetbrains.com/issue/KT-18385) Spring: Generate Dependency causes Throwable "AWT events are not allowed inside write action" +- [`KT-18407`](https://youtrack.jetbrains.com/issue/KT-18407) "Move property to constructor" action should not appear on properties declared in interfaces +- [`KT-18425`](https://youtrack.jetbrains.com/issue/KT-18425) Make intention inserts modifier at wrong position for sealed class +- [`KT-18529`](https://youtrack.jetbrains.com/issue/KT-18529) Add '!!' quick fix applies to wrong expression on operation 'in' +- [`KT-18642`](https://youtrack.jetbrains.com/issue/KT-18642) Remove unused parameter intention transfers default value to another parameter +- [`KT-18683`](https://youtrack.jetbrains.com/issue/KT-18683) Wrong 'equals' is generated for Kotlin JS project +- [`KT-18709`](https://youtrack.jetbrains.com/issue/KT-18709) "Lift assignment out of if" changes semantics +- [`KT-18711`](https://youtrack.jetbrains.com/issue/KT-18711) "Lift return out of when" changes semantics for functional type +- [`KT-18717`](https://youtrack.jetbrains.com/issue/KT-18717) Report MemberVisibilityCanBePrivate on visibility modifier if present +- [`KT-18722`](https://youtrack.jetbrains.com/issue/KT-18722) Correct "before" sample in description for intention Convert to enum class +- [`KT-18723`](https://youtrack.jetbrains.com/issue/KT-18723) Correct "after" sample for intention Convert to apply +- [`KT-18852`](https://youtrack.jetbrains.com/issue/KT-18852) "Lift return out of when" does not work for exhaustive when without else +- [`KT-18928`](https://youtrack.jetbrains.com/issue/KT-18928) In IDE, "Replace 'if' expression with safe access expression incorrectly replace expression when using property +- [`KT-18954`](https://youtrack.jetbrains.com/issue/KT-18954) Kotlin plugin updater activates in headless mode +- [`KT-18970`](https://youtrack.jetbrains.com/issue/KT-18970) Do not report "property can be private" on JvmField properties +- [`KT-19232`](https://youtrack.jetbrains.com/issue/KT-19232) Replace Math.min with coerceAtMost intention is broken +- [`KT-19272`](https://youtrack.jetbrains.com/issue/KT-19272) Do not report "function can be private" on JUnit 3 test methods + +### IDE. Refactorings + +#### New Features + +- [`KT-4379`](https://youtrack.jetbrains.com/issue/KT-4379) Support renaming import alias +- [`KT-8180`](https://youtrack.jetbrains.com/issue/KT-8180) Copy Class +- [`KT-17547`](https://youtrack.jetbrains.com/issue/KT-17547) Refactor / Move: Problems Detected / Conflicts in View: only referencing file is mentioned +#### Fixes + +- [`KT-9054`](https://youtrack.jetbrains.com/issue/KT-9054) Copy / pasting a Kotlin file should bring up the Copy Class dialog +- [`KT-13437`](https://youtrack.jetbrains.com/issue/KT-13437) Change signature replaces return type with Unit when it's not requested +- [`KT-15859`](https://youtrack.jetbrains.com/issue/KT-15859) Renaming variables or functions with backticks removes the backticks +- [`KT-16180`](https://youtrack.jetbrains.com/issue/KT-16180) Opened decompiled editor blocks refactoring of involved element +- [`KT-17062`](https://youtrack.jetbrains.com/issue/KT-17062) Field/property inline refactoring works incorrectly with Kotlin & Java usages +- [`KT-17128`](https://youtrack.jetbrains.com/issue/KT-17128) Refactor / Rename in the last position of label name throws Throwable "PsiElement(IDENTIFIER) by com.intellij.refactoring.rename.inplace.MemberInplaceRenamer" at InplaceRefactoring.buildTemplateAndStart() +- [`KT-17489`](https://youtrack.jetbrains.com/issue/KT-17489) Refactor / Inline Property: cannot inline val with the following plusAssign +- [`KT-17571`](https://youtrack.jetbrains.com/issue/KT-17571) Refactor / Move warns about using private/internal class from Java, but this is not related to the move +- [`KT-17622`](https://youtrack.jetbrains.com/issue/KT-17622) Refactor / Inline Function loses type arguments +- [`KT-18034`](https://youtrack.jetbrains.com/issue/KT-18034) Copy Class refactoring replaces all usages of the class with the new one! +- [`KT-18076`](https://youtrack.jetbrains.com/issue/KT-18076) Refactor / Rename on alias of Java class suggests to select between refactoring handlers +- [`KT-18096`](https://youtrack.jetbrains.com/issue/KT-18096) Refactor / Rename on import alias usage of a class member element tries to rename the element itself +- [`KT-18098`](https://youtrack.jetbrains.com/issue/KT-18098) Refactor / Copy can't generate proper import if original code uses import alias of java member +- [`KT-18135`](https://youtrack.jetbrains.com/issue/KT-18135) Refactor: no Problems Detected for Copy/Move source using platform type to another platform's module +- [`KT-18200`](https://youtrack.jetbrains.com/issue/KT-18200) Refactor / Copy is enabled for Java source selected with Kotlin file, but not for Java source selected with Kotlin class +- [`KT-18241`](https://youtrack.jetbrains.com/issue/KT-18241) Refactor / Copy (and Move) fails for chain of lambdas and invoke()'s with IllegalStateException: "No selector for PARENTHESIZED" at KtSimpleNameReference.changeQualifiedName() +- [`KT-18325`](https://youtrack.jetbrains.com/issue/KT-18325) Renaming a parameter name in one implementation silently rename it in all implementations +- [`KT-18390`](https://youtrack.jetbrains.com/issue/KT-18390) Refactor / Copy called for Java class opens only Copy File dialog +- [`KT-18699`](https://youtrack.jetbrains.com/issue/KT-18699) Refactor / Copy, Move loses necessary parentheses +- [`KT-18738`](https://youtrack.jetbrains.com/issue/KT-18738) Misleading quick fix message for an 'open' modifier on an interface member +- [`KT-19130`](https://youtrack.jetbrains.com/issue/KT-19130) Refactor / Inline val: "Show inline dialog for local variables" setting is ignored + +### JavaScript + +#### Performance Improvements + +- [`KT-18331`](https://youtrack.jetbrains.com/issue/KT-18331) JS: compilation performance degrades fast when inlined nested labels are used +#### Fixes + +- [`KT-4078`](https://youtrack.jetbrains.com/issue/KT-4078) JS sourcemaps should contain relative path. The relative base & prefix should be set from project/module preferences +- [`KT-8020`](https://youtrack.jetbrains.com/issue/KT-8020) JS: String? plus operator crashes on runtime +- [`KT-13919`](https://youtrack.jetbrains.com/issue/KT-13919) JS: Source map weirdness +- [`KT-15456`](https://youtrack.jetbrains.com/issue/KT-15456) JS: inlining doesn't work for array constructor with size and lambda +- [`KT-16984`](https://youtrack.jetbrains.com/issue/KT-16984) KotlinJS - 1 > 2 > false causes unhandled javascript exception +- [`KT-17285`](https://youtrack.jetbrains.com/issue/KT-17285) JS: wrong result when call function with default parameter overridden by delegation by function from another interface +- [`KT-17445`](https://youtrack.jetbrains.com/issue/KT-17445) JS: minifier for Kotlin JS apps +- [`KT-17476`](https://youtrack.jetbrains.com/issue/KT-17476) JS: Some symbols in identifiers compile, but are not legal +- [`KT-17871`](https://youtrack.jetbrains.com/issue/KT-17871) JS: spread vararg call doesn't work on functions imported with @JsModule +- [`KT-18027`](https://youtrack.jetbrains.com/issue/KT-18027) JS: Illegal symbols are possible in backticked labels, but cause crash in runtime and malformed js code +- [`KT-18032`](https://youtrack.jetbrains.com/issue/KT-18032) JS: Illegal symbols are possible in backticked package names, but cause crash in runtime and malformed js code +- [`KT-18169`](https://youtrack.jetbrains.com/issue/KT-18169) JS: reified generic backticked type name containing non-identifier symbols causes malformed JS and runtime crash +- [`KT-18187`](https://youtrack.jetbrains.com/issue/KT-18187) JS backend does not copy non-abstract method of interface to implementing class in some cases +- [`KT-18201`](https://youtrack.jetbrains.com/issue/KT-18201) JS backend generates wrong code for inline function which calls non-inline function from another module +- [`KT-18652`](https://youtrack.jetbrains.com/issue/KT-18652) JS: Objects from same package but from different libraries are incorrectly accessed + +### Libraries + +- [`KT-18526`](https://youtrack.jetbrains.com/issue/KT-18526) Small typo in documentation for kotlin-stdlib / kotlin.collections / retainAll +- [`KT-18624`](https://youtrack.jetbrains.com/issue/KT-18624) JS: Bad return type for Promise.all +- [`KT-18670`](https://youtrack.jetbrains.com/issue/KT-18670) Incorrect documentation of MutableMap.values +- [`KT-18671`](https://youtrack.jetbrains.com/issue/KT-18671) Provide implementation for CoroutineContext.Element functions. + +### Reflection + +- [`KT-15222`](https://youtrack.jetbrains.com/issue/KT-15222) Support reflection for local delegated properties +- [`KT-14094`](https://youtrack.jetbrains.com/issue/KT-14094) IllegalAccessException when try to get members annotated by private annotation with parameter +- [`KT-16399`](https://youtrack.jetbrains.com/issue/KT-16399) Embedded Tomcat fails to load Class-Path: kotlin-runtime.jar from kotlin-reflect-1.0.6.jar +- [`KT-16810`](https://youtrack.jetbrains.com/issue/KT-16810) Do not include incorrect ExternalOverridabilityCondition service file into kotlin-reflect.jar +- [`KT-18404`](https://youtrack.jetbrains.com/issue/KT-18404) “KotlinReflectionInternalError: This callable does not support a default call” when function or constructor has more than 32 parameters +- [`KT-18476`](https://youtrack.jetbrains.com/issue/KT-18476) KClass<*>.superclasses does not contain Any::class +- [`KT-18480`](https://youtrack.jetbrains.com/issue/KT-18480) Kotlin Reflection unable to call getter of protected read-only val with custom getter from parent class + +### Tools + +- [`KT-18245`](https://youtrack.jetbrains.com/issue/KT-18245) NoArg: IllegalAccessError on instantiating sealed class child via Java reflection +- [`KT-18874`](https://youtrack.jetbrains.com/issue/KT-18874) Crash during compilation after switching to 1.1.3-release-IJ2017.2-2 +- [`KT-19047`](https://youtrack.jetbrains.com/issue/KT-19047) Private methods are final event if used with the all-open-plugin. + +### Tools. CLI + +- [`KT-17297`](https://youtrack.jetbrains.com/issue/KT-17297) Report error when CLI compiler is not being run under Java 8+ +- [`KT-18599`](https://youtrack.jetbrains.com/issue/KT-18599) Support -Xmodule-path and -Xadd-modules arguments for modular compilation on Java 9 +- [`KT-18794`](https://youtrack.jetbrains.com/issue/KT-18794) kotlinc-jvm prints an irrelevant error message when a JVM Home directory does not exist +- [`KT-3045`](https://youtrack.jetbrains.com/issue/KT-3045) Report error instead of failing with exception on "kotlinc -script foo.kt" +- [`KT-18754`](https://youtrack.jetbrains.com/issue/KT-18754) Rename CLI argument "-module" to "-Xbuild-file" +- [`KT-18927`](https://youtrack.jetbrains.com/issue/KT-18927) run kotlin app crashes eclipse + +### Tools. Gradle + +- [`KT-10537`](https://youtrack.jetbrains.com/issue/KT-10537) Gradle plugin doesn't pick up changed project.buildDir +- [`KT-17031`](https://youtrack.jetbrains.com/issue/KT-17031) JVM crash on in-process compilation in Gradle with debug +- [`KT-17035`](https://youtrack.jetbrains.com/issue/KT-17035) Gradle Kotlin Plugin can not compile tests calling source internal fields/variables if compileJava dumps classes to a different directory and then copied classes are moved to sourceSets.main.output.classesDir by a different task +- [`KT-17197`](https://youtrack.jetbrains.com/issue/KT-17197) Gradle Kotlin plugin does not wire task dependencies correctly, causing compilation failures +- [`KT-17618`](https://youtrack.jetbrains.com/issue/KT-17618) Pass freeCompilerArgs to compiler unchanged +- [`KT-18262`](https://youtrack.jetbrains.com/issue/KT-18262) kotlin-spring should also open @SpringBootTest classes +- [`KT-18647`](https://youtrack.jetbrains.com/issue/KT-18647) Kotlin incremental compile cannot be disabled. +- [`KT-18832`](https://youtrack.jetbrains.com/issue/KT-18832) Java version parsing error with Gradle Kotlin plugin + JDK 9 + +### Tools. J2K + +- [`KT-10762`](https://youtrack.jetbrains.com/issue/KT-10762) J2K removes empty lines from Doc-comments +- [`KT-13146`](https://youtrack.jetbrains.com/issue/KT-13146) J2K goes into infinite loop with anonymous inner class that references itself +- [`KT-15761`](https://youtrack.jetbrains.com/issue/KT-15761) Converting Java to Kotlin corrupts string which includes escaped backslash +- [`KT-16133`](https://youtrack.jetbrains.com/issue/KT-16133) Converting switch statement inserts dead code (possibly as a false positive for fall-through) +- [`KT-16142`](https://youtrack.jetbrains.com/issue/KT-16142) Kotlin Konverter produces empty line in Kdoc +- [`KT-18038`](https://youtrack.jetbrains.com/issue/KT-18038) Java to Kotlin converter messes up empty lines while converting from JavaDoc to KDoc +- [`KT-18051`](https://youtrack.jetbrains.com/issue/KT-18051) Doesn't work the auto-convert Java to Kotlin in Android Studio 3.0 +- [`KT-18141`](https://youtrack.jetbrains.com/issue/KT-18141) J2K changes semantic when while does not have a body +- [`KT-18142`](https://youtrack.jetbrains.com/issue/KT-18142) J2K changes semantics when `if` does not have a body +- [`KT-18512`](https://youtrack.jetbrains.com/issue/KT-18512) J2K Incorrect null parameter conversion + +### Tools. JPS + +- [`KT-14848`](https://youtrack.jetbrains.com/issue/KT-14848) JPS: invalid compiler argument causes exception (see also EA-92062) +- [`KT-16057`](https://youtrack.jetbrains.com/issue/KT-16057) Provide better error message when the same compiler argument is set twice +- [`KT-19155`](https://youtrack.jetbrains.com/issue/KT-19155) IllegalArgumentException: Unsupported kind: PACKAGE_LOCAL_VARIABLE_LIST in incremental compilation + +### Tools. Maven + +- [`KT-18022`](https://youtrack.jetbrains.com/issue/KT-18022) kotlin maven plugin - adding dependencies overwrites arguments.pluginClassPath preventing kapt goal from running +- [`KT-18224`](https://youtrack.jetbrains.com/issue/KT-18224) Maven compilation with JDK 9 fails with InaccessibleObjectException + +### Tools. REPL + +- [`KT-5620`](https://youtrack.jetbrains.com/issue/KT-5620) REPL: Support destructuring declarations +- [`KT-12564`](https://youtrack.jetbrains.com/issue/KT-12564) Kotlin REPL Doesn't Perform Many Checks +- [`KT-15172`](https://youtrack.jetbrains.com/issue/KT-15172) REPL: function declarations that contain empty lines throw error +- [`KT-18181`](https://youtrack.jetbrains.com/issue/KT-18181) REPL: support non-headless execution for Swing code +- [`KT-18349`](https://youtrack.jetbrains.com/issue/KT-18349) REPL: do not show warnings when there are errors + +### Tools. kapt + +- [`KT-18682`](https://youtrack.jetbrains.com/issue/KT-18682) Kapt: Anonymous class types are not rendered properly in stubs +- [`KT-18758`](https://youtrack.jetbrains.com/issue/KT-18758) Kotlin 1.1.3 / Kapt fails with gradle +- [`KT-18799`](https://youtrack.jetbrains.com/issue/KT-18799) Kapt3, IC: Kapt does not generate annotation value for constant values in documented types +- [`KT-19178`](https://youtrack.jetbrains.com/issue/KT-19178) Kapt: Build dependencies from 'kapt' configuration should go into the 'kaptCompile' task dependencies +- [`KT-19179`](https://youtrack.jetbrains.com/issue/KT-19179) Kapt: Gradle silently skips 'kotlinKapt' task sometimes +- [`KT-19211`](https://youtrack.jetbrains.com/issue/KT-19211) Kapt3: Generated classes output is not synchronized with Java classes output in pure Java projects (Gradle 4+) + +## 1.1.3-2 + +#### Fixes + +- Noarg compiler plugin reverted to 1.1.2 behavior: by default, it will not run any initialization code + from the generated default constructor. If you want to run initializers, you need to enable + the corresponding option as described in the documentation. + Note that if a @noarg class has initializers that depend on constructor parameters, you will get incorrect + compiler behavior, so you shouldn't enable this option if you have such classes in your project. + This resolves [`KT-18667`](https://youtrack.jetbrains.com/issue/KT-18667) and [`KT-18668`](https://youtrack.jetbrains.com/issue/KT-18668). +- [`KT-18689`](https://youtrack.jetbrains.com/issue/KT-18689) Incorrect bytecode generated when passing a bound member reference to an inline function with default argument values +- [`KT-18377`](https://youtrack.jetbrains.com/issue/KT-18377) Syntax error while generating kapt stubs +- [`KT-18411`](https://youtrack.jetbrains.com/issue/KT-18411) Slow debugger step-in into inlined function +- [`KT-18687`](https://youtrack.jetbrains.com/issue/KT-18687) Deadlock in resolve with Kotlin 1.1.3 +- [`KT-18726`](https://youtrack.jetbrains.com/issue/KT-18726) Frequent UI hangs in 2017.2 EAPs + +## 1.1.3 + +### Android + +#### New Features + +- [`KT-12049`](https://youtrack.jetbrains.com/issue/KT-12049) Kotlin Lint: "Missing Parcelable CREATOR field" could suggest "Add implementation" quick fix +- [`KT-16712`](https://youtrack.jetbrains.com/issue/KT-16712) Show warning in IDEA when using Java 1.8 api in Android +- [`KT-16843`](https://youtrack.jetbrains.com/issue/KT-16843) Android: provide gutter icons for resources like colors and drawables +- [`KT-17389`](https://youtrack.jetbrains.com/issue/KT-17389) Implement Intention "Add Activity / BroadcastReceiver / Service to manifest" +- [`KT-17465`](https://youtrack.jetbrains.com/issue/KT-17465) Add intentions Add/Remove/Redo parcelable implementation +#### Fixes + +- [`KT-14970`](https://youtrack.jetbrains.com/issue/KT-14970) ClassCastException: butterknife.lint.LintRegistry cannot be cast to com.android.tools.klint.client.api.IssueRegistry +- [`KT-17287`](https://youtrack.jetbrains.com/issue/KT-17287) Configure kotlin in Android Studio: don't show menu Choose Configurator with single choice +- [`KT-17288`](https://youtrack.jetbrains.com/issue/KT-17288) Android Studio: please remove menu item Configure Kotlin (JavaScript) in Project +- [`KT-17289`](https://youtrack.jetbrains.com/issue/KT-17289) Android Studio: Hide "Configure Kotlin" balloon if Kotlin is configured from a kt file banner +- [`KT-17291`](https://youtrack.jetbrains.com/issue/KT-17291) Android Studio 2.4: Cannot get property 'metaClass' on null object error after Kotlin configuring +- [`KT-17610`](https://youtrack.jetbrains.com/issue/KT-17610) "Unknown reference: kotlinx" + +### Compiler + +#### New Features + +- [`KT-11167`](https://youtrack.jetbrains.com/issue/KT-11167) Support compilation against JRE 9 +- [`KT-17497`](https://youtrack.jetbrains.com/issue/KT-17497) Warn about redundant else branch in exhaustive when +#### Performance Improvements + +- [`KT-7931`](https://youtrack.jetbrains.com/issue/KT-7931) Optimize iteration over strings/charsequences on JVM +- [`KT-10848`](https://youtrack.jetbrains.com/issue/KT-10848) Optimize substitution of inline function with default parameters +- [`KT-12497`](https://youtrack.jetbrains.com/issue/KT-12497) Optimize inlined bytecode for functions with default parameters +- [`KT-17342`](https://youtrack.jetbrains.com/issue/KT-17342) Optimize control-flow for case of many variables +- [`KT-17562`](https://youtrack.jetbrains.com/issue/KT-17562) Optimize KtFile::isScript +#### Fixes + +- [`KT-4960`](https://youtrack.jetbrains.com/issue/KT-4960) Redeclaration is not reported for type parameters of interfaces +- [`KT-5160`](https://youtrack.jetbrains.com/issue/KT-5160) No warning when a lambda parameter hides a variable +- [`KT-5246`](https://youtrack.jetbrains.com/issue/KT-5246) is check fails on cyclic type parameter bounds +- [`KT-5354`](https://youtrack.jetbrains.com/issue/KT-5354) Wrong label resolution when label name clash with fun name +- [`KT-7645`](https://youtrack.jetbrains.com/issue/KT-7645) Prohibit default value for `catch`-block parameter +- [`KT-7724`](https://youtrack.jetbrains.com/issue/KT-7724) Can never import private member +- [`KT-7796`](https://youtrack.jetbrains.com/issue/KT-7796) Wrong scope for default parameter value resolution +- [`KT-7984`](https://youtrack.jetbrains.com/issue/KT-7984) Unexpected "Unresolved reference" in a default value expression in a local function +- [`KT-7985`](https://youtrack.jetbrains.com/issue/KT-7985) Unexpected "Unresolved reference to a type parameter" in a default value expression in a local function +- [`KT-8320`](https://youtrack.jetbrains.com/issue/KT-8320) It should not be possible to catch a type parameter type +- [`KT-8877`](https://youtrack.jetbrains.com/issue/KT-8877) Automatic labeling doesn't work for infix calls +- [`KT-9251`](https://youtrack.jetbrains.com/issue/KT-9251) Qualified this does not work with labeled function literals +- [`KT-9551`](https://youtrack.jetbrains.com/issue/KT-9551) False warning "No cast needed" +- [`KT-9645`](https://youtrack.jetbrains.com/issue/KT-9645) Incorrect inspection: No cast Needed +- [`KT-9986`](https://youtrack.jetbrains.com/issue/KT-9986) 'null as T' should be unchecked cast +- [`KT-10397`](https://youtrack.jetbrains.com/issue/KT-10397) java.lang.reflect.GenericSignatureFormatError when generic inner class is mentioned in function signature +- [`KT-11474`](https://youtrack.jetbrains.com/issue/KT-11474) ISE: Requested A, got foo.A in JavaClassFinderImpl on Java file with package not matching directory +- [`KT-11622`](https://youtrack.jetbrains.com/issue/KT-11622) False "No cast needed" when ambiguous call because of smart cast +- [`KT-12245`](https://youtrack.jetbrains.com/issue/KT-12245) Code with annotation that has an unresolved identifier as a parameter compiles successfully +- [`KT-12269`](https://youtrack.jetbrains.com/issue/KT-12269) False "Non-null type is checked for instance of nullable type" +- [`KT-12683`](https://youtrack.jetbrains.com/issue/KT-12683) A problem with `is` operator and non-reified type-parameters +- [`KT-12690`](https://youtrack.jetbrains.com/issue/KT-12690) USELESS_CAST compiler warning may break code when fix is applied +- [`KT-13348`](https://youtrack.jetbrains.com/issue/KT-13348) Report useless cast on safe cast from nullable type to the same not null type +- [`KT-13597`](https://youtrack.jetbrains.com/issue/KT-13597) No check for accessing final field in local object in constructor +- [`KT-13997`](https://youtrack.jetbrains.com/issue/KT-13997) Incorrect "Property must be initialized or be abstract" error for property with external accessors +- [`KT-14381`](https://youtrack.jetbrains.com/issue/KT-14381) Possible val reassignment not detected inside init block +- [`KT-14564`](https://youtrack.jetbrains.com/issue/KT-14564) java.lang.VerifyError: Bad local variable type +- [`KT-14801`](https://youtrack.jetbrains.com/issue/KT-14801) Invoke error message if nested class has the same name as a function from base class +- [`KT-14977`](https://youtrack.jetbrains.com/issue/KT-14977) IDE doesn't warn about checking null value of variable that cannot be null +- [`KT-15085`](https://youtrack.jetbrains.com/issue/KT-15085) Label and function naming conflict is resolved in unintuitive way +- [`KT-15161`](https://youtrack.jetbrains.com/issue/KT-15161) False warning "no cast needed" for array creation +- [`KT-15480`](https://youtrack.jetbrains.com/issue/KT-15480) Cannot destruct a list when "if" has an "else" branch +- [`KT-15495`](https://youtrack.jetbrains.com/issue/KT-15495) Internal typealiases in the same module are inaccessible on incremental compilation +- [`KT-15566`](https://youtrack.jetbrains.com/issue/KT-15566) Object member imported in file scope used in delegation expression in object declaration should be a compiler error +- [`KT-16016`](https://youtrack.jetbrains.com/issue/KT-16016) Compiler failure with NO_EXPECTED_TYPE +- [`KT-16426`](https://youtrack.jetbrains.com/issue/KT-16426) Return statement resolved to function instead of property getter +- [`KT-16813`](https://youtrack.jetbrains.com/issue/KT-16813) Anonymous objects returned from private-in-file members should behave as for private class members +- [`KT-16864`](https://youtrack.jetbrains.com/issue/KT-16864) Local delegate + ad-hoc object leads to CCE +- [`KT-17144`](https://youtrack.jetbrains.com/issue/KT-17144) Breakpoint inside `when` +- [`KT-17149`](https://youtrack.jetbrains.com/issue/KT-17149) Incorrect warning "Kotlin: This operation has led to an overflow" +- [`KT-17156`](https://youtrack.jetbrains.com/issue/KT-17156) No re-parse after lambda was converted to block +- [`KT-17318`](https://youtrack.jetbrains.com/issue/KT-17318) Typo in DSL Marker message `cant` +- [`KT-17384`](https://youtrack.jetbrains.com/issue/KT-17384) break/continue expression in inlined function parameter argument causes compilation exception +- [`KT-17457`](https://youtrack.jetbrains.com/issue/KT-17457) Suspend + LongRange couldn't transform method node issue in Kotlin 1.1.1 +- [`KT-17479`](https://youtrack.jetbrains.com/issue/KT-17479) val reassign is allowed via explicit this receiver +- [`KT-17560`](https://youtrack.jetbrains.com/issue/KT-17560) Overload resolution ambiguity on semi-valid class-files generated by Scala +- [`KT-17572`](https://youtrack.jetbrains.com/issue/KT-17572) try-catch expression in inlined function parameter argument causes compilation exception +- [`KT-17573`](https://youtrack.jetbrains.com/issue/KT-17573) try-finally expression in inlined function parameter argument fails with VerifyError +- [`KT-17588`](https://youtrack.jetbrains.com/issue/KT-17588) Compiler error while optimizer tries to get rid of captured variable +- [`KT-17590`](https://youtrack.jetbrains.com/issue/KT-17590) conditional return in inline function parameter argument causes compilation exception +- [`KT-17591`](https://youtrack.jetbrains.com/issue/KT-17591) non-conditional return in inline function parameter argument causes compilation exception +- [`KT-17613`](https://youtrack.jetbrains.com/issue/KT-17613) 'this' expression referring to deprecated class instance is highlighted as deprecated in IDE +- [`KT-18358`](https://youtrack.jetbrains.com/issue/KT-18358) Keep smart pointers instead of PSI elements in JavaElementImpl and its descendants + +### IDE + +#### New Features + +- [`KT-7810`](https://youtrack.jetbrains.com/issue/KT-7810) Separate icon for abstract class +- [`KT-8617`](https://youtrack.jetbrains.com/issue/KT-8617) Recognize TODO method usages and highlight them same as TODO-comment +- [`KT-12629`](https://youtrack.jetbrains.com/issue/KT-12629) Add rainbow/semantic-highlighting for local variables +- [`KT-14109`](https://youtrack.jetbrains.com/issue/KT-14109) support parameter hints in idea plugin +- [`KT-16645`](https://youtrack.jetbrains.com/issue/KT-16645) Support inlay type hints for implicitly typed vals, properties, and functions +- [`KT-17807`](https://youtrack.jetbrains.com/issue/KT-17807) Add Smart Enter processor for object expessions +#### Performance Improvements + +- [`KT-16995`](https://youtrack.jetbrains.com/issue/KT-16995) Typing during in-place refactorings is impossibly laggy +- [`KT-17331`](https://youtrack.jetbrains.com/issue/KT-17331) Frequent long editor freezes +- [`KT-17383`](https://youtrack.jetbrains.com/issue/KT-17383) Slow editing in Kotlin files If breadcrumbs are enabled in module with many dependencies +- [`KT-17495`](https://youtrack.jetbrains.com/issue/KT-17495) Much time spent in LibraryDependenciesCache.getLibrariesAndSdksUsedWith +#### Fixes + +- [`KT-7848`](https://youtrack.jetbrains.com/issue/KT-7848) When you paste text into a string literal special symbols should be escaped +- [`KT-7954`](https://youtrack.jetbrains.com/issue/KT-7954) 'Go to symbol' doesn't show containing declaration for local symbols +- [`KT-9091`](https://youtrack.jetbrains.com/issue/KT-9091) Sometimes backticks of the method name with spaces are highlighted with rose background +- [`KT-10577`](https://youtrack.jetbrains.com/issue/KT-10577) Refactor / Move Kotlin + Java files adds wrong import in very specific case +- [`KT-12856`](https://youtrack.jetbrains.com/issue/KT-12856) Import fold region is not updated to include imports added while editing file +- [`KT-14161`](https://youtrack.jetbrains.com/issue/KT-14161) Navigate to symbol doesn't see local named functions +- [`KT-14601`](https://youtrack.jetbrains.com/issue/KT-14601) Formatter inserts unnecessary indent before 'else' +- [`KT-14639`](https://youtrack.jetbrains.com/issue/KT-14639) Incorrect name of code style setting: Align in columns 'case' branches +- [`KT-15029`](https://youtrack.jetbrains.com/issue/KT-15029) "Go to symbol" action doesn't find properties declared in primary constructors +- [`KT-15255`](https://youtrack.jetbrains.com/issue/KT-15255) Move cursor to a better place when creating a new Kotlin file +- [`KT-15273`](https://youtrack.jetbrains.com/issue/KT-15273) Kotlin IDE plugin adds `import java.lang.String` with "Optimize Imports", making project broken +- [`KT-16159`](https://youtrack.jetbrains.com/issue/KT-16159) Wrong "Constructor call" highlighting if operator is called on newly created object +- [`KT-16392`](https://youtrack.jetbrains.com/issue/KT-16392) Gradle/Maven java module: Add framework support/ Kotlin (Java or JavaScript) adds nothing +- [`KT-16423`](https://youtrack.jetbrains.com/issue/KT-16423) Show expression type doesn't work when selecting from the middle of expression with "Expand Selection" +- [`KT-16635`](https://youtrack.jetbrains.com/issue/KT-16635) Do not show kotlin-specific live templates macros for all context types +- [`KT-16755`](https://youtrack.jetbrains.com/issue/KT-16755) No "Is sublassed by" icon for sealed class +- [`KT-16775`](https://youtrack.jetbrains.com/issue/KT-16775) Rewrite at slice CLASS key: OBJECT_DECLARATION while writing code in IDE +- [`KT-16803`](https://youtrack.jetbrains.com/issue/KT-16803) Suspending iteration is not marked in the gutter by IDEA as suspending invocation +- [`KT-17037`](https://youtrack.jetbrains.com/issue/KT-17037) Editor suggests to import `EmptyCoroutineContext.plus` for any unresolved `+` +- [`KT-17046`](https://youtrack.jetbrains.com/issue/KT-17046) Kotlin facet, Compiler plugins: last line is shown empty when not selected +- [`KT-17088`](https://youtrack.jetbrains.com/issue/KT-17088) Settings: Kotlin Compiler: "Destination directory" should be enabled if "Copy library runtime files" is on on the dialog opening +- [`KT-17094`](https://youtrack.jetbrains.com/issue/KT-17094) Kotlin facet, additional command line parameters dialog: please provide a title +- [`KT-17138`](https://youtrack.jetbrains.com/issue/KT-17138) Configure Kotlin in Project: Choose Configurator popup: names could be unified +- [`KT-17145`](https://youtrack.jetbrains.com/issue/KT-17145) Kotlin facet: IllegalArgumentException on attempt to show settings common for several javascript kotlin facets with different moduleKind +- [`KT-17223`](https://youtrack.jetbrains.com/issue/KT-17223) Absolute path to Kotlin compiler plugin in IML +- [`KT-17293`](https://youtrack.jetbrains.com/issue/KT-17293) Project Structure dialog is opened too slow for a project with a lot of empty gradle modules +- [`KT-17304`](https://youtrack.jetbrains.com/issue/KT-17304) IDEA shows wrong type for expressions +- [`KT-17439`](https://youtrack.jetbrains.com/issue/KT-17439) Kotlin: 'autoscroll from source' doesn't work in Structure view +- [`KT-17448`](https://youtrack.jetbrains.com/issue/KT-17448) Regression: Sample Resolve +- [`KT-17482`](https://youtrack.jetbrains.com/issue/KT-17482) Set jvmTarget to 1.8 by default when configuring a project with JDK 1.8 +- [`KT-17492`](https://youtrack.jetbrains.com/issue/KT-17492) -jvm-target is ignored by IntelliJ +- [`KT-17505`](https://youtrack.jetbrains.com/issue/KT-17505) LazyLightClassMemberMatchingError from collection implementation +- [`KT-17517`](https://youtrack.jetbrains.com/issue/KT-17517) Compiler options specified as properties are not handled by Maven importer +- [`KT-17521`](https://youtrack.jetbrains.com/issue/KT-17521) Quickfix to enable coroutines should work for Maven projects +- [`KT-17525`](https://youtrack.jetbrains.com/issue/KT-17525) IDE: KNPE at KotlinAddImportActionKt.createSingleImportActionForConstructor() on invalid reference to inner class constructor +- [`KT-17578`](https://youtrack.jetbrains.com/issue/KT-17578) Throwable: "Reported element PsiIdentifier:AnnotationConfiguration is not from the file 'PsiFile:InSource.kt' the inspection 'ImplicitSubclassInspection'" +- [`KT-17638`](https://youtrack.jetbrains.com/issue/KT-17638) ISE in KotlinElementDescriptionProvider.renderShort +- [`KT-17698`](https://youtrack.jetbrains.com/issue/KT-17698) Unknown library format - prevents IDEA from configuring Kotlin JS +- [`KT-17714`](https://youtrack.jetbrains.com/issue/KT-17714) UAST inspection on non-physical element +- [`KT-17722`](https://youtrack.jetbrains.com/issue/KT-17722) IntelliJ plugin uses wrong JVM target when Kotlin Facet is not configured +- [`KT-17770`](https://youtrack.jetbrains.com/issue/KT-17770) Kotlin IntelliJ plugin fails to re-index Gradle script classpath after change to the `plugins` block +- [`KT-17777`](https://youtrack.jetbrains.com/issue/KT-17777) Logger$EmptyThrowable: "Facet Kotlin (app) [kotlin-language] not found" at FacetModelImpl.removeFacet() +- [`KT-17810`](https://youtrack.jetbrains.com/issue/KT-17810) Exception from unused import inspection leads to code analysis hangs +- [`KT-17821`](https://youtrack.jetbrains.com/issue/KT-17821) In Kotlin's plugin KotlinJsMetadataVersionIndex loads file with VfsUtilCore.loadText +- [`KT-17840`](https://youtrack.jetbrains.com/issue/KT-17840) Show expression type on `this` shows bogus disambiguation +- [`KT-17845`](https://youtrack.jetbrains.com/issue/KT-17845) Searching for usages of override property in primary constructor doesn't suggest base property search +- [`KT-17847`](https://youtrack.jetbrains.com/issue/KT-17847) Kotlin facet: strange warning if API version = 1.2 +- [`KT-17857`](https://youtrack.jetbrains.com/issue/KT-17857) Java should see classes affected by "allopen" plugin as open +- [`KT-17861`](https://youtrack.jetbrains.com/issue/KT-17861) Setting 'kotlin.experimental.coroutines "enable"' doesn't work for Android projects +- [`KT-17875`](https://youtrack.jetbrains.com/issue/KT-17875) New Project/Module with Kotlin: on attempt to use libraries from plugin IDE suggests to rewrite them +- [`KT-17876`](https://youtrack.jetbrains.com/issue/KT-17876) New Project/Module with Kotlin: with "Copy to" option only part of jars are copied +- [`KT-17899`](https://youtrack.jetbrains.com/issue/KT-17899) Navigate to symbol: vararg signatures are indistinguishable from non-vararg ones +- [`KT-18070`](https://youtrack.jetbrains.com/issue/KT-18070) KtLightModifierList.hasExplicitModifier("default") is true for interface method with body + +### IDE. Completion + +#### New Features + +- [`KT-11250`](https://youtrack.jetbrains.com/issue/KT-11250) Auto-completion for convention function names in 'operator fun' definitions +- [`KT-12293`](https://youtrack.jetbrains.com/issue/KT-12293) Autocompletion should propose `lateinit var` in addition to `lateinit` +- [`KT-13673`](https://youtrack.jetbrains.com/issue/KT-13673) Add 'companion { ... }' code completion opsion +#### Performance Improvements + +- [`KT-10978`](https://youtrack.jetbrains.com/issue/KT-10978) Kotlin + JOOQ + Intellij performance is unusable +- [`KT-16715`](https://youtrack.jetbrains.com/issue/KT-16715) Typing is very slow since 1.1 +- [`KT-16850`](https://youtrack.jetbrains.com/issue/KT-16850) UI freeze for several seconds during inserting selected completion variant +#### Fixes + +- [`KT-13524`](https://youtrack.jetbrains.com/issue/KT-13524) Completing the keyword 'constructor' before a primary constructor wrongly inserts parentheses +- [`KT-14665`](https://youtrack.jetbrains.com/issue/KT-14665) No completion for "else" keyword +- [`KT-15603`](https://youtrack.jetbrains.com/issue/KT-15603) Annoying completion when making a primary constructor private +- [`KT-16161`](https://youtrack.jetbrains.com/issue/KT-16161) Completion of 'onEach' inserts unneeded angular brackets +- [`KT-16856`](https://youtrack.jetbrains.com/issue/KT-16856) Code completion optimization + +### IDE. Debugger + +- [`KT-15823`](https://youtrack.jetbrains.com/issue/KT-15823) Breakpoints not work inside crossinline from init of object passed into collection +- [`KT-15854`](https://youtrack.jetbrains.com/issue/KT-15854) Debugger not able to evaluate internal member functions +- [`KT-16025`](https://youtrack.jetbrains.com/issue/KT-16025) Step into suspend functions stops at the function end +- [`KT-17295`](https://youtrack.jetbrains.com/issue/KT-17295) Can't stop in kotlin.concurrent.timer lambda parameter + +### IDE. Inspections and Intentions + +#### New Features + +- [`KT-10981`](https://youtrack.jetbrains.com/issue/KT-10981) Quickfix for INAPPLICABLE_JVM_FIELD to replace with 'const' when possible +- [`KT-14046`](https://youtrack.jetbrains.com/issue/KT-14046) Add intention to add inline keyword if a function has parameter with noinline and/or crossinline modifier +- [`KT-14137`](https://youtrack.jetbrains.com/issue/KT-14137) Add intention to convert top level val with object expression to object +- [`KT-15903`](https://youtrack.jetbrains.com/issue/KT-15903) QuickFix to add/remove suspend in hierarchies +- [`KT-16786`](https://youtrack.jetbrains.com/issue/KT-16786) Intention to add "open" modifier to a non-private method or property in an open class +- [`KT-16851`](https://youtrack.jetbrains.com/issue/KT-16851) Quickfix adding qualifier `@call` to unallowed 'return' in closures +- [`KT-17053`](https://youtrack.jetbrains.com/issue/KT-17053) Inspection to detect use of callable reference as a lambda body +- [`KT-17054`](https://youtrack.jetbrains.com/issue/KT-17054) Intention/ inspection to convert 'if' with 'is' check to 'as?' with safe call +- [`KT-17191`](https://youtrack.jetbrains.com/issue/KT-17191) Intention to name anonymous (_) parameter +- [`KT-17221`](https://youtrack.jetbrains.com/issue/KT-17221) Inspection for recursive calls in property accessors +- [`KT-17520`](https://youtrack.jetbrains.com/issue/KT-17520) Quickfix to update language/API version should work for Maven projects +- [`KT-17650`](https://youtrack.jetbrains.com/issue/KT-17650) Add quickfix inserting 'lateinit' modifier for not-initialized property +- [`KT-17660`](https://youtrack.jetbrains.com/issue/KT-17660) Inspection: data class copy without named argument(s) +#### Fixes + +- [`KT-10211`](https://youtrack.jetbrains.com/issue/KT-10211) "Replace infix call with ordinary call" appears both as a quickfix and as an intention in the pop-up +- [`KT-11003`](https://youtrack.jetbrains.com/issue/KT-11003) Invalid quickfix in companion object for open properties +- [`KT-12805`](https://youtrack.jetbrains.com/issue/KT-12805) False positive redundant semicolon after while without block expression +- [`KT-14335`](https://youtrack.jetbrains.com/issue/KT-14335) Unexpected range of "convert lambda to reference" intention +- [`KT-14435`](https://youtrack.jetbrains.com/issue/KT-14435) "Use destructuring declaration" should be available as intention even without usages +- [`KT-14443`](https://youtrack.jetbrains.com/issue/KT-14443) IDEA intention suggest to make a method in an interface final +- [`KT-14820`](https://youtrack.jetbrains.com/issue/KT-14820) Convert function to property shouldn't insert explicit type if it was inferred previously +- [`KT-15076`](https://youtrack.jetbrains.com/issue/KT-15076) Replace if with elvis inspection should not be reported in some complex cases +- [`KT-15543`](https://youtrack.jetbrains.com/issue/KT-15543) "Convert receiver to parameter" refactoring breaks code +- [`KT-15942`](https://youtrack.jetbrains.com/issue/KT-15942) "Convert to secondary constructor" intention is available for data class +- [`KT-16136`](https://youtrack.jetbrains.com/issue/KT-16136) Wrong type parameter variance suggested if type parameter is used in nested anonymous object +- [`KT-16339`](https://youtrack.jetbrains.com/issue/KT-16339) Incorrect warning: 'protected' visibility is effectively 'private' in a final class +- [`KT-16577`](https://youtrack.jetbrains.com/issue/KT-16577) "Redundant semicolon" is not reported for semicolon after package statement in file with no imports +- [`KT-17079`](https://youtrack.jetbrains.com/issue/KT-17079) Kotlin: Bad conversion of double comparison to range check if bounds have mixed types +- [`KT-17372`](https://youtrack.jetbrains.com/issue/KT-17372) Specify explicit lambda signature handles anonymous parameters incorrectly +- [`KT-17404`](https://youtrack.jetbrains.com/issue/KT-17404) Editor: attempt to pass type parameter as reified argument causes AE "Classifier descriptor of a type should be of type ClassDescriptor" at DescriptorUtils.getClassDescriptorForTypeConstructor() +- [`KT-17408`](https://youtrack.jetbrains.com/issue/KT-17408) "Convert to secondary constructor" intention is available for annotation parameters +- [`KT-17503`](https://youtrack.jetbrains.com/issue/KT-17503) Intention "To raw string literal" should handle string concatenations +- [`KT-17599`](https://youtrack.jetbrains.com/issue/KT-17599) "Make primary constructor internal" intention is available for annotation class +- [`KT-17600`](https://youtrack.jetbrains.com/issue/KT-17600) "Make primary constructor private" intention is available for annotation class +- [`KT-17707`](https://youtrack.jetbrains.com/issue/KT-17707) "Final declaration can't be overridden at runtime" inspection reports Kotlin classes non final due to compiler plugin +- [`KT-17708`](https://youtrack.jetbrains.com/issue/KT-17708) "Move to class body" intention is available for annotation parameters +- [`KT-17762`](https://youtrack.jetbrains.com/issue/KT-17762) 'Convert to range' intention generates inequivalent code for doubles + +### IDE. Refactorings + +#### Performance Improvements + +- [`KT-17234`](https://youtrack.jetbrains.com/issue/KT-17234) Refactor / Inline on library property is rejected after GUI freeze for a while +- [`KT-17333`](https://youtrack.jetbrains.com/issue/KT-17333) KotlinChangeInfo retains 132MB of the heap +#### Fixes + +- [`KT-8370`](https://youtrack.jetbrains.com/issue/KT-8370) "Can't move to original file" should not be an error +- [`KT-8930`](https://youtrack.jetbrains.com/issue/KT-8930) Refactor / Move preivew: moved element is shown as reference, and its file as subject +- [`KT-9158`](https://youtrack.jetbrains.com/issue/KT-9158) Refactor / Move preview mentions the package statement of moved class as a usage +- [`KT-13192`](https://youtrack.jetbrains.com/issue/KT-13192) Refactor / Move: to another class: "To" field code completion suggests facade and Java classes +- [`KT-13466`](https://youtrack.jetbrains.com/issue/KT-13466) Refactor / Move: class to upper level: the package statement is not updated +- [`KT-15519`](https://youtrack.jetbrains.com/issue/KT-15519) KDoc comments for data class values get removed by Change Signature +- [`KT-17211`](https://youtrack.jetbrains.com/issue/KT-17211) Refactor / Move several files: superfluous FQN is inserted into reference to same file's element +- [`KT-17213`](https://youtrack.jetbrains.com/issue/KT-17213) Refactor / Inline Function: parameters of lambda as call argument turn incompilable +- [`KT-17272`](https://youtrack.jetbrains.com/issue/KT-17272) Refactor / Inline Function: unused String literal in parameters is kept (while unsed Int is not) +- [`KT-17273`](https://youtrack.jetbrains.com/issue/KT-17273) Refactor / Inline Function: PIEAE: "Element: class org.jetbrains.kotlin.psi.KtCallExpression because: different providers" at PsiUtilCore.ensureValid() +- [`KT-17296`](https://youtrack.jetbrains.com/issue/KT-17296) Refactor / Inline Function: UOE at ExpressionReplacementPerformer.findOrCreateBlockToInsertStatement() for call of multi-statement function in declaration +- [`KT-17330`](https://youtrack.jetbrains.com/issue/KT-17330) Inline kotlin function causes an infinite loop +- [`KT-17395`](https://youtrack.jetbrains.com/issue/KT-17395) Refactor / Inline Function: arguments passed to lambda turns code to incompilable +- [`KT-17496`](https://youtrack.jetbrains.com/issue/KT-17496) Refactor / Move: calls to moved extension function type properties are updated (incorrectly) +- [`KT-17515`](https://youtrack.jetbrains.com/issue/KT-17515) Refactor / Move inner class to another class, Move companion object: disabled in editor, but available in Move dialog +- [`KT-17526`](https://youtrack.jetbrains.com/issue/KT-17526) Refactor / Move: reference to companion member gets superfluous companion name in certain cases +- [`KT-17538`](https://youtrack.jetbrains.com/issue/KT-17538) Refactor / Move: moving file with import alias removes alias usage from code +- [`KT-17545`](https://youtrack.jetbrains.com/issue/KT-17545) Refactor / Move: false Problems Detected on moving class using parent's protected class, object +- [`KT-18018`](https://youtrack.jetbrains.com/issue/KT-18018) F5 (for Copy) does not work for Kotlin files anymore +- [`KT-18205`](https://youtrack.jetbrains.com/issue/KT-18205) Moving multiple classes causes imports to be converted to fully qualified class names + +### Infrastructure + +- [`KT-14988`](https://youtrack.jetbrains.com/issue/KT-14988) Support running the Kotlin compiler on Java 9 +- [`KT-17112`](https://youtrack.jetbrains.com/issue/KT-17112) IncompatibleClassChangeError on invoking Kotlin compiler daemon on JDK 9 + +### JavaScript + +#### Fixes + +- [`KT-12926`](https://youtrack.jetbrains.com/issue/KT-12926) JS: use # instead of @ when linking to sourcemap from generated code +- [`KT-13577`](https://youtrack.jetbrains.com/issue/KT-13577) Double.hashCode is zero for big numbers +- [`KT-15135`](https://youtrack.jetbrains.com/issue/KT-15135) JS: support friend modules +- [`KT-15484`](https://youtrack.jetbrains.com/issue/KT-15484) JS: (node): println with object /number argument leads to "TypeError: Invalid data, chunk must be a string or buffer, not object/number" +- [`KT-16658`](https://youtrack.jetbrains.com/issue/KT-16658) JS: Suspend function with default param value in interface +- [`KT-16717`](https://youtrack.jetbrains.com/issue/KT-16717) KotlinJs - copy() on data class doesn't work with when there is a secondary constructor +- [`KT-16745`](https://youtrack.jetbrains.com/issue/KT-16745) JS: initialize enum fields before calling companion objects's initializer +- [`KT-16951`](https://youtrack.jetbrains.com/issue/KT-16951) JS: coroutine suspension point is not inserted when inlining suspend function with tail call to another suspend function +- [`KT-16979`](https://youtrack.jetbrains.com/issue/KT-16979) Kotlin.js : Intellij test and productions sources produce a AMD module with the same name +- [`KT-17067`](https://youtrack.jetbrains.com/issue/KT-17067) JS: suspendCoroutine not working as expected +- [`KT-17219`](https://youtrack.jetbrains.com/issue/KT-17219) Hexadecimal literals in js(...) argument are replaced by wrong decimal constants +- [`KT-17281`](https://youtrack.jetbrains.com/issue/KT-17281) JS: wrong code generated for a recursive call in suspend function +- [`KT-17446`](https://youtrack.jetbrains.com/issue/KT-17446) JS: incorrect code generated for call to `suspendCoroutineOrReturn` when the same function calls another suspend function +- [`KT-17540`](https://youtrack.jetbrains.com/issue/KT-17540) Incorrect inlining optimization of `also`/`apply` function +- [`KT-17700`](https://youtrack.jetbrains.com/issue/KT-17700) Wrong code generated for 'str += (nullableChar ?: break)' +- [`KT-17966`](https://youtrack.jetbrains.com/issue/KT-17966) JS: Char literal inside of string template + +### Libraries + +- [`KT-17453`](https://youtrack.jetbrains.com/issue/KT-17453) Array iterators throw IndexOutOfBoundsException instead of NoSuchElementException +- [`KT-17635`](https://youtrack.jetbrains.com/issue/KT-17635) Document String#toIntOfNull may throw an exception +- [`KT-17686`](https://youtrack.jetbrains.com/issue/KT-17686) takeLast(n) incorrectly performs drop(n) for Lists without random access +- [`KT-17704`](https://youtrack.jetbrains.com/issue/KT-17704) Update JavaDoc for ReentrantReadWriteLock.write to put more stress on the fact that to upgrade to write lock, read lock is first released. +- [`KT-17853`](https://youtrack.jetbrains.com/issue/KT-17853) JS: Confusing parameter names in 'Math.atan2` +- [`KT-18092`](https://youtrack.jetbrains.com/issue/KT-18092) Issue using kotlin-reflect with proguard: missing annotations Mutable and ReadOnly +- [`KT-18210`](https://youtrack.jetbrains.com/issue/KT-18210) JS String::match(regex) should have nullable return type + +### Reflection + +- [`KT-17055`](https://youtrack.jetbrains.com/issue/KT-17055) NPE in hashCode and equals of kotlin.jvm.internal.FunctionReference (on local functions) +- [`KT-17594`](https://youtrack.jetbrains.com/issue/KT-17594) Cache the result of val Class.kotlin: KClass +- [`KT-18494`](https://youtrack.jetbrains.com/issue/KT-18494) KNPE from Kotlin reflection (sometimes) in UtilKt.toJavaClass + +### Tools + +- [`KT-16692`](https://youtrack.jetbrains.com/issue/KT-16692) No-Arg-Constructor plugin should generate code to initialize delegates + +### Tools. CLI + +- [`KT-17696`](https://youtrack.jetbrains.com/issue/KT-17696) Allow kotlinc to take friend modules as .jar files +- [`KT-17697`](https://youtrack.jetbrains.com/issue/KT-17697) Allow kotlinc to take .java files as arguments +- [`KT-9370`](https://youtrack.jetbrains.com/issue/KT-9370) not possible to pass an argument that starts with "-" to a script using kotlinc +- [`KT-17100`](https://youtrack.jetbrains.com/issue/KT-17100) "kotlin" launcher script: do not add current working directory to classpath if explicit "-classpath" is specified +- [`KT-17140`](https://youtrack.jetbrains.com/issue/KT-17140) Warning "classpath entry points to a file that is not a jar file" could just be disabled +- [`KT-17264`](https://youtrack.jetbrains.com/issue/KT-17264) Change the format of advanced CLI arguments ("-X...") to require value after "=", not a whitespace +- [`KT-18180`](https://youtrack.jetbrains.com/issue/KT-18180) Modules not exported by java.se are not readable when compiling against JRE 9 + +### Tools. Gradle + +- [`KT-15151`](https://youtrack.jetbrains.com/issue/KT-15151) Kapt3: Support incremental compilation of Java stubs +- [`KT-16298`](https://youtrack.jetbrains.com/issue/KT-16298) Gradle: IOException "Parent file doesn't exist:/.../artifact-difference.tab.len" on non-incremental clean after incremental build +- [`KT-17681`](https://youtrack.jetbrains.com/issue/KT-17681) Support the new API of Android Gradle plugin (2.4.0+) +- [`KT-17936`](https://youtrack.jetbrains.com/issue/KT-17936) Circular dependency between gradle tasks dataBindingExportBuildInfoDebug and compileDebugKotlin +- [`KT-17960`](https://youtrack.jetbrains.com/issue/KT-17960) Improve test of memory leak with Gradle daemon +- [`KT-18047`](https://youtrack.jetbrains.com/issue/KT-18047) Gradle kotlin options should use unset value as default for languageVersion and apiVersion + +### Tools. J2K + +- [`KT-16754`](https://youtrack.jetbrains.com/issue/KT-16754) J2K: Apply quick-fixes from EDT thread only +- [`KT-16816`](https://youtrack.jetbrains.com/issue/KT-16816) Java To Kotlin bug: if + chained assignment doesn't include brackets +- [`KT-17230`](https://youtrack.jetbrains.com/issue/KT-17230) J2K Deadlock +- [`KT-17712`](https://youtrack.jetbrains.com/issue/KT-17712) Exception in J2K during InlineCodegen convertion: com.intellij.psi.impl.source.JavaDummyHolder cannot be cast to com.intellij.psi.PsiJavaFile + +### Tools. JPS + +- [`KT-16568`](https://youtrack.jetbrains.com/issue/KT-16568) modulesWhoseInternalsAreVisible in ModuleDependencies are not filled in for JS projects +- [`KT-17387`](https://youtrack.jetbrains.com/issue/KT-17387) When compiling in the IDE, progress tracker says "configuring the compilation environment" when it clearly isn't +- [`KT-17665`](https://youtrack.jetbrains.com/issue/KT-17665) JPS: Kotlin: The '-d' option with a directory destination is ignored because '-module' is specified +- [`KT-17801`](https://youtrack.jetbrains.com/issue/KT-17801) Unresolved supertypes from JRE on JDK 9 in JPS + +### Tools. Maven + +- [`KT-17093`](https://youtrack.jetbrains.com/issue/KT-17093) Import from maven: please provide a special tag for coroutine option +- [`KT-10028`](https://youtrack.jetbrains.com/issue/KT-10028) Support parallel builds in maven +- [`KT-15050`](https://youtrack.jetbrains.com/issue/KT-15050) Random build failures using maven 3 (multi-thread) + bamboo +- [`KT-15318`](https://youtrack.jetbrains.com/issue/KT-15318) Intermitent Kotlin compilation errors +- [`KT-16283`](https://youtrack.jetbrains.com/issue/KT-16283) Maven compiler plugin warns, "Source root doesn't exist" +- [`KT-16743`](https://youtrack.jetbrains.com/issue/KT-16743) Update configuration options in Kotlin Maven plugin +- [`KT-16762`](https://youtrack.jetbrains.com/issue/KT-16762) Maven: JS compiler option main is missing + +### Tools. REPL + +- [`KT-5822`](https://youtrack.jetbrains.com/issue/KT-5822) Exception on package directive in REPL +- [`KT-10060`](https://youtrack.jetbrains.com/issue/KT-10060) REPL: Cannot execute more than 255 lines +- [`KT-17365`](https://youtrack.jetbrains.com/issue/KT-17365) REPL crash when referencing a variable whose definition threw an exception + +### Tools. kapt + +- [`KT-17245`](https://youtrack.jetbrains.com/issue/KT-17245) Kapt: Javac compiler arguments can't be specified in Gradle +- [`KT-17418`](https://youtrack.jetbrains.com/issue/KT-17418) "The following options were not recognized by any processor: '[kapt.kotlin.generated]'" warning from Javac shouldn't be shown even if no processor supports the generated annotation +- [`KT-17456`](https://youtrack.jetbrains.com/issue/KT-17456) kapt3: NoClassDefFound com/sun/tools/javac/util/Context +- [`KT-17567`](https://youtrack.jetbrains.com/issue/KT-17567) Kapt (1.1.2-eap-77) generates invalid Java stub for internal class +- [`KT-17620`](https://youtrack.jetbrains.com/issue/KT-17620) Kapt3 IC: avoid running AP when API is not changed +- [`KT-17959`](https://youtrack.jetbrains.com/issue/KT-17959) Kapt3 doesn't preserve method parameter names for abstract methods +- [`KT-17999`](https://youtrack.jetbrains.com/issue/KT-17999) Cannot use KAPT3 1.1.2-4 in Android Studio java libs (null TypeCastException to WrappedVariantData<*> on Gradle Sync) + +## 1.1.2 + +### Compiler + +#### Front-end + +- [`KT-16113`](https://youtrack.jetbrains.com/issue/KT-16113) Support destructuring parameters of suspend lambda with suspend componentX +- [`KT-3805`](https://youtrack.jetbrains.com/issue/KT-3805) Report error on double constants out of range +- [`KT-6014`](https://youtrack.jetbrains.com/issue/KT-6014) Wrong ABSTRACT_MEMBER_NOT_IMPLEMENTED for toString implemented by delegation +- [`KT-8959`](https://youtrack.jetbrains.com/issue/KT-8959) Missing diagnostic when trying to call inner class constructor qualificated with outer class name +- [`KT-12477`](https://youtrack.jetbrains.com/issue/KT-12477) Do not report 'const' inapplicability on property of error type +- [`KT-11010`](https://youtrack.jetbrains.com/issue/KT-11010) NDFDE for local object with type parameters +- [`KT-12881`](https://youtrack.jetbrains.com/issue/KT-12881) Descriptor wasn't found for declaration TYPE_PARAMETER +- [`KT-13342`](https://youtrack.jetbrains.com/issue/KT-13342) Unqualified super call should not resolve to a method of supertype overriden in another supertype +- [`KT-14236`](https://youtrack.jetbrains.com/issue/KT-14236) Allow to use emptyArray in annotation +- [`KT-14536`](https://youtrack.jetbrains.com/issue/KT-14536) IllegalStateException: Type parameter T not found for lazy class Companion at LazyDeclarationResolver visitTypeParameter +- [`KT-14865`](https://youtrack.jetbrains.com/issue/KT-14865) Throwable exception at KotlinParser parseLambdaExpression on typing { inside a string inside a lambda +- [`KT-15516`](https://youtrack.jetbrains.com/issue/KT-15516) Compiler error when passing suspending extension-functions as parameter and casting stuff to Any +- [`KT-15802`](https://youtrack.jetbrains.com/issue/KT-15802) Java constant referenced using subclass is not considered a constant expression +- [`KT-15872`](https://youtrack.jetbrains.com/issue/KT-15872) Constant folding is mistakenly triggered for user function +- [`KT-15901`](https://youtrack.jetbrains.com/issue/KT-15901) Unstable smart cast target after type check +- [`KT-15951`](https://youtrack.jetbrains.com/issue/KT-15951) Callable reference to class constructor from object is not resolved +- [`KT-16232`](https://youtrack.jetbrains.com/issue/KT-16232) Prohibit objects inside inner classes +- [`KT-16233`](https://youtrack.jetbrains.com/issue/KT-16233) Prohibit inner sealed classes +- [`KT-16250`](https://youtrack.jetbrains.com/issue/KT-16250) Import methods from typealias to object throws compiler exception "Should be class or package: typealias" +- [`KT-16272`](https://youtrack.jetbrains.com/issue/KT-16272) Missing deprecation and SinceKotlin-related diagnostic for variable as function call +- [`KT-16278`](https://youtrack.jetbrains.com/issue/KT-16278) Public member method can't be used for callable reference because of private static with the same name +- [`KT-16372`](https://youtrack.jetbrains.com/issue/KT-16372) 'mod is deprecated' warning should not be shown when language version is 1.0 +- [`KT-16484`](https://youtrack.jetbrains.com/issue/KT-16484) SimpleTypeImpl should not be created for error type: ErrorScope +- [`KT-16528`](https://youtrack.jetbrains.com/issue/KT-16528) Error: Loop in supertypes when using Java classes with type parameters having raw interdependent supertypes +- [`KT-16538`](https://youtrack.jetbrains.com/issue/KT-16538) No smart cast when equals is present +- [`KT-16782`](https://youtrack.jetbrains.com/issue/KT-16782) Enum entry is incorrectly forbidden on LHS of '::' with language version 1.0 +- [`KT-16815`](https://youtrack.jetbrains.com/issue/KT-16815) Assertion error from compiler: unexpected classifier: class DeserializedTypeAliasDescriptor +- [`KT-16931`](https://youtrack.jetbrains.com/issue/KT-16931) Compiler cannot see inner class when for outer class exist folder with same name +- [`KT-16956`](https://youtrack.jetbrains.com/issue/KT-16956) Prohibit using function calls inside default parameter values of annotations +- [`KT-8187`](https://youtrack.jetbrains.com/issue/KT-8187) IAE on anonymous object in the delegation specifier list +- [`KT-8813`](https://youtrack.jetbrains.com/issue/KT-8813) Do not report unused parameters for anonymous functions +- [`KT-12112`](https://youtrack.jetbrains.com/issue/KT-12112) Do not consider nullability of error functions and properties for smart casts +- [`KT-12276`](https://youtrack.jetbrains.com/issue/KT-12276) No warning for unnecessary non-null assertion after method call with generic return type +- [`KT-13648`](https://youtrack.jetbrains.com/issue/KT-13648) Spurious warning: "Elvis operator (?:) always returns the left operand of non-nullable type (???..???)" +- [`KT-16264`](https://youtrack.jetbrains.com/issue/KT-16264) Forbid usage of _ without backticks +- [`KT-16875`](https://youtrack.jetbrains.com/issue/KT-16875) Decrease severity of unused parameter in lambda to weak warning +- [`KT-17136`](https://youtrack.jetbrains.com/issue/KT-17136) ModuleDescriptorImpl.allImplementingModules should be evaluated lazily +- [`KT-17214`](https://youtrack.jetbrains.com/issue/KT-17214) Do not show warning about useless elvis for error function types +- [`KT-13740`](https://youtrack.jetbrains.com/issue/KT-13740) Plugin crashes at accidentally wrong annotation argument type +- [`KT-17597`](https://youtrack.jetbrains.com/issue/KT-17597) Pattern::compile resolves to private instance method in 1.1.2 + +#### Back-end + +- [`KT-8689`](https://youtrack.jetbrains.com/issue/KT-8689) NoSuchMethodError on local functions inside inlined lambda with variables captured from outer context +- [`KT-11314`](https://youtrack.jetbrains.com/issue/KT-11314) Abstract generic class with Array> parameter compiles fine but fails at runtime with "Bad type on operand stack" VerifyError +- [`KT-12839`](https://youtrack.jetbrains.com/issue/KT-12839) Two null checks are generated when manually null checking platform type +- [`KT-14565`](https://youtrack.jetbrains.com/issue/KT-14565) Cannot pop operand off empty stack when compiling enum class +- [`KT-14566`](https://youtrack.jetbrains.com/issue/KT-14566) Make kotlin.jvm.internal.Ref$...Ref classes serializable +- [`KT-14567`](https://youtrack.jetbrains.com/issue/KT-14567) VerifyError: Bad type on operand stack (generics with operator methods) +- [`KT-14607`](https://youtrack.jetbrains.com/issue/KT-14607) Incorrect class name "ava/lang/Void from AsyncTask extension function +- [`KT-14811`](https://youtrack.jetbrains.com/issue/KT-14811) Unecessary checkcast generated in parameterized functions. +- [`KT-14963`](https://youtrack.jetbrains.com/issue/KT-14963) unnecessary checkcast java/lang/Object +- [`KT-15105`](https://youtrack.jetbrains.com/issue/KT-15105) Comparing Chars in a Pair results in ClassCastException +- [`KT-15109`](https://youtrack.jetbrains.com/issue/KT-15109) Subclass from a type alias with named parameter in constructor will produce compiler exception +- [`KT-15192`](https://youtrack.jetbrains.com/issue/KT-15192) Compiler crashes on certain companion objects: "Error generating constructors of class Companion with kind IMPLEMENTATION" +- [`KT-15424`](https://youtrack.jetbrains.com/issue/KT-15424) javac crash when calling Kotlin function having generic varargs with default and @JvmOverloads +- [`KT-15574`](https://youtrack.jetbrains.com/issue/KT-15574) Can't instantiate Array through Type Alias +- [`KT-15594`](https://youtrack.jetbrains.com/issue/KT-15594) java.lang.VerifyError when referencing normal getter in @JvmStatic getters inside an object +- [`KT-15759`](https://youtrack.jetbrains.com/issue/KT-15759) tailrec suspend function fails to compile +- [`KT-15862`](https://youtrack.jetbrains.com/issue/KT-15862) Inline generic functions can unexpectedly box primitives +- [`KT-15871`](https://youtrack.jetbrains.com/issue/KT-15871) Unnecessary boxing for equality operator on inlined primitive values +- [`KT-15993`](https://youtrack.jetbrains.com/issue/KT-15993) Property annotations are stored in private fields and killed by obfuscators +- [`KT-15997`](https://youtrack.jetbrains.com/issue/KT-15997) Reified generics don't work properly with crossinline functions +- [`KT-16077`](https://youtrack.jetbrains.com/issue/KT-16077) Redundant private getter for private var in a class within a JvmMultifileClass annotated file +- [`KT-16194`](https://youtrack.jetbrains.com/issue/KT-16194) Code with unnecessary safe call contains redundant boxing/unboxing for primitive values +- [`KT-16245`](https://youtrack.jetbrains.com/issue/KT-16245) Redundant null-check generated for a cast of already non-nullable value +- [`KT-16532`](https://youtrack.jetbrains.com/issue/KT-16532) Kotlin 1.1 RC - Android cross-inline synchronized won't run +- [`KT-16555`](https://youtrack.jetbrains.com/issue/KT-16555) VerifyError: Bad type on operand stack +- [`KT-16713`](https://youtrack.jetbrains.com/issue/KT-16713) Insufficient maximum stack size +- [`KT-16720`](https://youtrack.jetbrains.com/issue/KT-16720) ClassCastException during compilation +- [`KT-16732`](https://youtrack.jetbrains.com/issue/KT-16732) Type 'java/lang/Number' (current frame, stack[0]) is not assignable to 'java/lang/Character +- [`KT-16929`](https://youtrack.jetbrains.com/issue/KT-16929) `VerifyError` when using bound method reference on generic property +- [`KT-16412`](https://youtrack.jetbrains.com/issue/KT-16412) Exception from compiler when try call SAM constructor where argument is callable reference to nested class inside object +- [`KT-17210`](https://youtrack.jetbrains.com/issue/KT-17210) Smartcast failure results in "Bad type operand on stack" runtime error + +### Tools + +- [`KT-15420`](https://youtrack.jetbrains.com/issue/KT-15420) Maven, all-open plugin: in console the settings of all-open are always reported as empty +- [`KT-11916`](https://youtrack.jetbrains.com/issue/KT-11916) Provide incremental compilation for Maven +- [`KT-15946`](https://youtrack.jetbrains.com/issue/KT-15946) Kotlin-JPA plugin support for @Embeddable +- [`KT-16627`](https://youtrack.jetbrains.com/issue/KT-16627) Do not make private members open in all-open plugin +- [`KT-16699`](https://youtrack.jetbrains.com/issue/KT-16699) Script resolving doesn't work with custom templates located in an external jar +- [`KT-16812`](https://youtrack.jetbrains.com/issue/KT-16812) import in .kts file does not works +- [`KT-16927`](https://youtrack.jetbrains.com/issue/KT-16927) Using `KotlinJsr223JvmLocalScriptEngineFactory` causes multiple warnings +- [`KT-15562`](https://youtrack.jetbrains.com/issue/KT-15562) Service is dying +- [`KT-17125`](https://youtrack.jetbrains.com/issue/KT-17125) > Failed to apply plugin [id 'kotlin'] > For input string: “” + +#### Kapt + +- [`KT-12432`](https://youtrack.jetbrains.com/issue/KT-12432) Dagger 2 does not generate Component which was referenced from Kotlin file. +- [`KT-8558`](https://youtrack.jetbrains.com/issue/KT-8558) KAPT only works with service-declared annotation processors +- [`KT-16753`](https://youtrack.jetbrains.com/issue/KT-16753) kapt3 generates invalid stubs when IC is enabled +- [`KT-16458`](https://youtrack.jetbrains.com/issue/KT-16458) kotlin-kapt / kapt3: "cannot find symbol" error for companion object with same name as enclosing class +- [`KT-14478`](https://youtrack.jetbrains.com/issue/KT-14478) Add APT / Kapt support to the maven plugin +- [`KT-14070`](https://youtrack.jetbrains.com/issue/KT-14070) Kapt3: kapt doesn't compile generated Kotlin files and doesn't use the "kapt.kotlin.generated" folder anymore +- [`KT-16990`](https://youtrack.jetbrains.com/issue/KT-16990) Kapt3: java.io.File cannot be cast to java.lang.String +- [`KT-16965`](https://youtrack.jetbrains.com/issue/KT-16965) Error:Kotlin: Multiple values are not allowed for plugin option org.jetbrains.kotlin.kapt:output +- [`KT-16184`](https://youtrack.jetbrains.com/issue/KT-16184) AbstractMethodError in Kapt3ComponentRegistrar while compiling from IntelliJ 2016.3.4 using Kotlin 1.1.0-beta-38 + +#### Gradle + +- [`KT-15084`](https://youtrack.jetbrains.com/issue/KT-15084) Navigation into sources of gradle-script-kotlin doesn't work +- [`KT-16003`](https://youtrack.jetbrains.com/issue/KT-16003) Gradle Plugin Fails When Run From Jenkins On Multiple Nodes +- [`KT-16585`](https://youtrack.jetbrains.com/issue/KT-16585) Kotlin Gradle Plugin makes using Gradle Java incremental compiler not work +- [`KT-16902`](https://youtrack.jetbrains.com/issue/KT-16902) Gradle plugin compilation on daemon fails on Linux ARM +- [`KT-14619`](https://youtrack.jetbrains.com/issue/KT-14619) Gradle: The '-d' option with a directory destination is ignored because '-module' is specified +- [`KT-12792`](https://youtrack.jetbrains.com/issue/KT-12792) Automatically configure standard library dependency and set its version equal to compiler version if not specified +- [`KT-15994`](https://youtrack.jetbrains.com/issue/KT-15994) Compiler arguments are not copied from the main compile task to kapt task +- [`KT-16820`](https://youtrack.jetbrains.com/issue/KT-16820) Changing compileKotlin.destinationDir leads to failure in :copyMainKotlinClasses task due to an NPE +- [`KT-16917`](https://youtrack.jetbrains.com/issue/KT-16917) First connection to daemon after start timeouts when DNS is slow +- [`KT-16580`](https://youtrack.jetbrains.com/issue/KT-16580) Kotlin gradle plugin cannot resolve the kotlin compiler + +### Android support + +- [`KT-16624`](https://youtrack.jetbrains.com/issue/KT-16624) Implement quickfix "Add TargetApi/RequiresApi annotation" for Android api issues +- [`KT-16625`](https://youtrack.jetbrains.com/issue/KT-16625) Implement quickfix "Surround with if (VERSION.SDK_INT >= VERSION_CODES.SOME_VERSION) { ... }" for Android api issues +- [`KT-16840`](https://youtrack.jetbrains.com/issue/KT-16840) Kotlin Gradle plugin fails with Android Gradle plugin 2.4.0-alpha1 +- [`KT-16897`](https://youtrack.jetbrains.com/issue/KT-16897) Gradle plugin 1.1.1 duplicates all main classes into Android instrumentation test APK +- [`KT-16957`](https://youtrack.jetbrains.com/issue/KT-16957) Android Extensions: Support Dialog class +- [`KT-15023`](https://youtrack.jetbrains.com/issue/KT-15023) Android `gradle installDebugAndroidTest` fails unless you first call `gradle assembleDebugAndroidTest` +- [`KT-12769`](https://youtrack.jetbrains.com/issue/KT-12769) "Name for method must be provided" error occurs on trying to use spaces in method name in integration tests in Android +- [`KT-12819`](https://youtrack.jetbrains.com/issue/KT-12819) Kotlin Lint: False positive for "Unconditional layout inflation" when using elvis operator +- [`KT-15116`](https://youtrack.jetbrains.com/issue/KT-15116) Kotlin Lint: problems in property accessors are not reported +- [`KT-15156`](https://youtrack.jetbrains.com/issue/KT-15156) Kotlin Lint: problems in annotation parameters are not reported +- [`KT-15179`](https://youtrack.jetbrains.com/issue/KT-15179) Kotlin Lint: problems inside local function are not reported +- [`KT-14870`](https://youtrack.jetbrains.com/issue/KT-14870) Kotlin Lint: problems inside local class are not reported +- [`KT-14920`](https://youtrack.jetbrains.com/issue/KT-14920) Kotlin Lint: "Android Lint for Kotlin | Incorrect support annotation usage" inspection does not report problems +- [`KT-14947`](https://youtrack.jetbrains.com/issue/KT-14947) Kotlin Lint: "Calling new methods on older versions" could suggest specific quick fixes +- [`KT-12741`](https://youtrack.jetbrains.com/issue/KT-12741) Android Extensions: Enable IDE plugin only if it is enabled in the build.gradle file +- [`KT-13122`](https://youtrack.jetbrains.com/issue/KT-13122) Implement '@RequiresApi' intention for android and don't report warning on annotated classes +- [`KT-16680`](https://youtrack.jetbrains.com/issue/KT-16680) Stack overflow in UAST containsLocalTypes() +- [`KT-15451`](https://youtrack.jetbrains.com/issue/KT-15451) Support "Android String Reference" folding in Kotlin files +- [`KT-16132`](https://youtrack.jetbrains.com/issue/KT-16132) Renaming property provided by kotlinx leads to renaming another members +- [`KT-17200`](https://youtrack.jetbrains.com/issue/KT-17200) Unable to build an android project +- [`KT-13104`](https://youtrack.jetbrains.com/issue/KT-13104) Incorrect resource name in Activity after renaming ID attribute value in layout file +- [`KT-17436`](https://youtrack.jetbrains.com/issue/KT-17436) Refactor | Rename android:id corrupts R.id references in kotlin code +- [`KT-17255`](https://youtrack.jetbrains.com/issue/KT-17255) Kotlin 1.1.2 EAP is broken with 2.4.0-alpha3 +- [`KT-17610`](https://youtrack.jetbrains.com/issue/KT-17610) "Unknown reference: kotlinx" + +### IDE + +- [`KT-6159`](https://youtrack.jetbrains.com/issue/KT-6159) Inline Method refactoring +- [`KT-4578`](https://youtrack.jetbrains.com/issue/KT-4578) Intention to move property between class body and constructor parameter +- [`KT-8568`](https://youtrack.jetbrains.com/issue/KT-8568) Provide a QuickFix to replace type `Array` in annotation with `IntArray` +- [`KT-10393`](https://youtrack.jetbrains.com/issue/KT-10393) Detect calls to functions returning a lambda from expression body which ignore the return value +- [`KT-11393`](https://youtrack.jetbrains.com/issue/KT-11393) Inspection to highlight and warn on usage of internal members in other module from Java +- [`KT-12004`](https://youtrack.jetbrains.com/issue/KT-12004) IDE inspection that destructuring variable name matches the other name in data class +- [`KT-12183`](https://youtrack.jetbrains.com/issue/KT-12183) Intention converting several calls with same receiver to 'with'/`apply`/`run` +- [`KT-13111`](https://youtrack.jetbrains.com/issue/KT-13111) Support bound references in lambda-to-reference intention / inspection +- [`KT-15966`](https://youtrack.jetbrains.com/issue/KT-15966) Create quickfix for DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE +- [`KT-16074`](https://youtrack.jetbrains.com/issue/KT-16074) Introduce a quick-fix adding noinline modifier for a value parameter of suspend function type +- [`KT-16131`](https://youtrack.jetbrains.com/issue/KT-16131) Add quickfix for: Cannot access member: it is invisible (private in supertype) +- [`KT-16188`](https://youtrack.jetbrains.com/issue/KT-16188) Add create class quickfix +- [`KT-16258`](https://youtrack.jetbrains.com/issue/KT-16258) Add intention to add missing components to destructuring assignment +- [`KT-16292`](https://youtrack.jetbrains.com/issue/KT-16292) Support "Reference to lambda" for bound references +- [`KT-11234`](https://youtrack.jetbrains.com/issue/KT-11234) Debugger won't hit breakpoint in nested lamba +- [`KT-12002`](https://youtrack.jetbrains.com/issue/KT-12002) Improve completion for closure parameters to work in more places +- [`KT-15768`](https://youtrack.jetbrains.com/issue/KT-15768) It would be nice to show in Kotlin facet what compiler plugins are on and their options +- [`KT-16022`](https://youtrack.jetbrains.com/issue/KT-16022) Kotlin facet: provide UI to navigate to project settings +- [`KT-16214`](https://youtrack.jetbrains.com/issue/KT-16214) Do not hide package kotlin.reflect.jvm.internal from auto-import and completion, inside package "kotlin.reflect" +- [`KT-16647`](https://youtrack.jetbrains.com/issue/KT-16647) Don't create kotlinc.xml if the settings don't differ from the defaults +- [`KT-16649`](https://youtrack.jetbrains.com/issue/KT-16649) All Gradle related classes should be moved to optional dependency section of plugin.xml +- [`KT-16800`](https://youtrack.jetbrains.com/issue/KT-16800) Autocomplete for closure with single arguments + +#### Bug fixes + +- [`KT-16316`](https://youtrack.jetbrains.com/issue/KT-16316) IDE: don't show Kotlin Scripting section when target platform is JavaScript +- [`KT-16317`](https://youtrack.jetbrains.com/issue/KT-16317) IDE: some fields stay enabled in an facet when use project settings was chosen +- [`KT-16596`](https://youtrack.jetbrains.com/issue/KT-16596) Hang in IntelliJ while scanning zips +- [`KT-16646`](https://youtrack.jetbrains.com/issue/KT-16646) The flag to enable coroutines does not sync from gradle file in Android Studio +- [`KT-16788`](https://youtrack.jetbrains.com/issue/KT-16788) Importing Kotlin Maven projects results in invalid .iml +- [`KT-16827`](https://youtrack.jetbrains.com/issue/KT-16827) kotlin javascript module not recognized by gradle sync when an android module is present +- [`KT-16848`](https://youtrack.jetbrains.com/issue/KT-16848) Regression: completion after dot in string interpolation expression doesn't work if there are no curly braces +- [`KT-16888`](https://youtrack.jetbrains.com/issue/KT-16888) "Multiple values are not allowed for plugin option org.jetbrains.kotlin.android:package" when rebuilding project +- [`KT-16980`](https://youtrack.jetbrains.com/issue/KT-16980) Accessing language version settings for a module performs runtime version detection on every access with no caching +- [`KT-16991`](https://youtrack.jetbrains.com/issue/KT-16991) Navigate to receiver from this in extension function +- [`KT-16992`](https://youtrack.jetbrains.com/issue/KT-16992) Navigate to lambda start from auto-generated 'it' parameter +- [`KT-12264`](https://youtrack.jetbrains.com/issue/KT-12264) AssertionError: Resolver for 'completion/highlighting in LibrarySourceInfo for platform JVM' does not know how to resolve ModuleProductionSourceInfo +- [`KT-13734`](https://youtrack.jetbrains.com/issue/KT-13734) Annotated element search is slow +- [`KT-14710`](https://youtrack.jetbrains.com/issue/KT-14710) Sample references aren't resolved in IDE +- [`KT-16415`](https://youtrack.jetbrains.com/issue/KT-16415) Dependency leakage with Kotlin IntelliJ plugin, using gradle-script-kotlin, and the gradle-intellij-plugin +- [`KT-16837`](https://youtrack.jetbrains.com/issue/KT-16837) Slow typing in Kotlin file because of ImportFixBase +- [`KT-16926`](https://youtrack.jetbrains.com/issue/KT-16926) 'implement' dependency is not transitive when importing gradle project to IDEA +- [`KT-17141`](https://youtrack.jetbrains.com/issue/KT-17141) Running test from gutter icon fails in AS 2.4 Preview 3 +- [`KT-17162`](https://youtrack.jetbrains.com/issue/KT-17162) Plain-text Java copy-paste to Kotlin file results in exception +- [`KT-16714`](https://youtrack.jetbrains.com/issue/KT-16714) J2K: Write access is allowed from event dispatch thread only +- [`KT-14058`](https://youtrack.jetbrains.com/issue/KT-14058) Unexpected error MISSING_DEPENDENCY_CLASS +- [`KT-9275`](https://youtrack.jetbrains.com/issue/KT-9275) Unhelpful IDE warning "Configure Kotlin" +- [`KT-15279`](https://youtrack.jetbrains.com/issue/KT-15279) 'Kotlin not configured message' should not be displayed while gradle sync is in progress +- [`KT-11828`](https://youtrack.jetbrains.com/issue/KT-11828) Configure Kotlin in Project: failure for Gradle modules without build.gradle (IDEA creates them) +- [`KT-16571`](https://youtrack.jetbrains.com/issue/KT-16571) Configure Kotlin in Project does not suggest just published version +- [`KT-16590`](https://youtrack.jetbrains.com/issue/KT-16590) Configure kotlin warning popup after each sync gradle +- [`KT-16353`](https://youtrack.jetbrains.com/issue/KT-16353) Configure Kotlin in Project: configurators are not suggested for Gradle module in non-Gradle project with separate sub-modules for source sets +- [`KT-16381`](https://youtrack.jetbrains.com/issue/KT-16381) Configure Kotlin dialog suggests modules already configured with other platforms +- [`KT-16401`](https://youtrack.jetbrains.com/issue/KT-16401) Configure Kotlin in the project adds incorrect dependency kotlin-stdlib-jre8 to 1.0.x language +- [`KT-12261`](https://youtrack.jetbrains.com/issue/KT-12261) Partial body resolve doesn't resolve anything in object literal used as an expression body of a method +- [`KT-13013`](https://youtrack.jetbrains.com/issue/KT-13013) "Go to Type Declaration" doesn't work for extension receiver and implict lambda parameter +- [`KT-13135`](https://youtrack.jetbrains.com/issue/KT-13135) IDE goes in an infinite indexing loop if a .kotlin_module file is corrupted +- [`KT-14129`](https://youtrack.jetbrains.com/issue/KT-14129) for/iter postfix templates should be applied for string, ranges and mutable collections +- [`KT-14134`](https://youtrack.jetbrains.com/issue/KT-14134) Allow to apply for/iter postfix template to map +- [`KT-14871`](https://youtrack.jetbrains.com/issue/KT-14871) Idea and Maven is not in sync with ModuleKind for Kotlin projects +- [`KT-14986`](https://youtrack.jetbrains.com/issue/KT-14986) Disable postfix completion when typing package statements +- [`KT-15200`](https://youtrack.jetbrains.com/issue/KT-15200) Show implementation should show inherited classes if a typealias to base class/interface is used +- [`KT-15398`](https://youtrack.jetbrains.com/issue/KT-15398) Annotations find usages in annotation instance site +- [`KT-15536`](https://youtrack.jetbrains.com/issue/KT-15536) Highlight usages: Class with primary constructor isn't highlighted when caret is on constructor invocation +- [`KT-15628`](https://youtrack.jetbrains.com/issue/KT-15628) Change error message if both KotlinJavaRuntime and KotlinJavaScript libraries are present in the module dependencies +- [`KT-15947`](https://youtrack.jetbrains.com/issue/KT-15947) Kotlin facet: Target platform on importing from a maven project should be filled the same way for different artifacts +- [`KT-16023`](https://youtrack.jetbrains.com/issue/KT-16023) Kotlin facet: When "Use project settings" is enabled, respective fields should show values from the project settings +- [`KT-16698`](https://youtrack.jetbrains.com/issue/KT-16698) Kotlin facet: modules created from different gradle sourcesets have the same module options +- [`KT-16700`](https://youtrack.jetbrains.com/issue/KT-16700) Kotlin facet: jdkHome path containing spaces splits into several additional args after import +- [`KT-16776`](https://youtrack.jetbrains.com/issue/KT-16776) Kotlin facet, import from maven: free arguments from submodule doesn't override arguments from parent module +- [`KT-16550`](https://youtrack.jetbrains.com/issue/KT-16550) Kotlin facet from Maven: provide error messages if additional command line parameters are set several times +- [`KT-16313`](https://youtrack.jetbrains.com/issue/KT-16313) Kotlin facet: unify filling up information about included AllOpen/NoArg plugins on importing from Maven and Gradle +- [`KT-16342`](https://youtrack.jetbrains.com/issue/KT-16342) Kotlin facet: JavaScript platform is not detected if there are 2 versions of stdlib in dependencies +- [`KT-16032`](https://youtrack.jetbrains.com/issue/KT-16032) Kotlin code formatter merges comment line with non-comment line +- [`KT-16038`](https://youtrack.jetbrains.com/issue/KT-16038) UI blocked on pasting java code into a kotlin file +- [`KT-16062`](https://youtrack.jetbrains.com/issue/KT-16062) Kotlin breakpoint doesn't work in some lambda in Rider project. +- [`KT-15855`](https://youtrack.jetbrains.com/issue/KT-15855) Can't evaluate expression in @JvmStatic method +- [`KT-16667`](https://youtrack.jetbrains.com/issue/KT-16667) Kotlin debugger "smart step into" fail on method defined in the middle of class hierarchy +- [`KT-16078`](https://youtrack.jetbrains.com/issue/KT-16078) Formatter puts empty body braces on different lines when KDoc is present +- [`KT-16265`](https://youtrack.jetbrains.com/issue/KT-16265) Parameter info doesn't work with type alias constructor +- [`KT-14727`](https://youtrack.jetbrains.com/issue/KT-14727) Wrong samples for some postfix templates + +##### Inspections / Quickfixes + +- [`KT-17002`](https://youtrack.jetbrains.com/issue/KT-17002) Make "Lambda to Reference" inspection off by default +- [`KT-14402`](https://youtrack.jetbrains.com/issue/KT-14402) Inspection "Use destructuring declaration" for lambdas doesn't work when parameter is of type Pair +- [`KT-16857`](https://youtrack.jetbrains.com/issue/KT-16857) False "Remove redundant 'let'" suggestion +- [`KT-16928`](https://youtrack.jetbrains.com/issue/KT-16928) Surround with null check quickfix works badly in case of qualifier +- [`KT-15870`](https://youtrack.jetbrains.com/issue/KT-15870) Move quick fix of "Package name does not match containing directory" inspection: Throwable "AWT events are not allowed inside write action" +- [`KT-16128`](https://youtrack.jetbrains.com/issue/KT-16128) 'Add label to loop' QF proposed when there's already a label +- [`KT-16828`](https://youtrack.jetbrains.com/issue/KT-16828) Don't suggest destructing declarations if not all components are used +- [`KT-17022`](https://youtrack.jetbrains.com/issue/KT-17022) Replace deprecated in the whole project may miss some usages in expression body + +##### Refactorings, Intentions + +- [`KT-7516`](https://youtrack.jetbrains.com/issue/KT-7516) Rename refactoring doesn't rename related labels +- [`KT-7520`](https://youtrack.jetbrains.com/issue/KT-7520) Exception when try rename label from usage +- [`KT-8955`](https://youtrack.jetbrains.com/issue/KT-8955) Refactor / Move package: KNPE at KotlinMoveDirectoryWithClassesHelper.postProcessUsages() with not matching package statement +- [`KT-11863`](https://youtrack.jetbrains.com/issue/KT-11863) Refactor / Move: moving referred file level elements to another package keeps reference to old FQN +- [`KT-13190`](https://youtrack.jetbrains.com/issue/KT-13190) Refactor / Move: no warning on moving class containing internal member to different module +- [`KT-13341`](https://youtrack.jetbrains.com/issue/KT-13341) Convert lambda to function reference intention is not available for object member calls +- [`KT-13755`](https://youtrack.jetbrains.com/issue/KT-13755) When (java?) class is moved redundant imports are not removed +- [`KT-13911`](https://youtrack.jetbrains.com/issue/KT-13911) Refactor / Move: "Problems Detected" dialog is not shown on moving whole .kt file +- [`KT-14401`](https://youtrack.jetbrains.com/issue/KT-14401) Can't rename implicit lambda parameter 'it' when caret is placed right after the last character +- [`KT-14483`](https://youtrack.jetbrains.com/issue/KT-14483) "Argument of NotNull parameter must be not null" in KotlinTryCatchSurrounder when using "try" postfix template +- [`KT-15075`](https://youtrack.jetbrains.com/issue/KT-15075) KNPE in "Specify explicit lambda signature" +- [`KT-15190`](https://youtrack.jetbrains.com/issue/KT-15190) Refactor / Move: false Problems Detected on moving class using parent's protected member +- [`KT-15250`](https://youtrack.jetbrains.com/issue/KT-15250) Convert anonymous object to lambda is shown when conversion not possible due implicit calls on this +- [`KT-15339`](https://youtrack.jetbrains.com/issue/KT-15339) Extract Superclass is enabled for any element: CommonRefactoringUtil$RefactoringErrorHintException: "Superclass cannot be extracted from interface" at ExtractSuperRefactoring.performRefactoring() +- [`KT-15559`](https://youtrack.jetbrains.com/issue/KT-15559) Kotlin: Moving classes to different packages breaks references to companion object's properties +- [`KT-15556`](https://youtrack.jetbrains.com/issue/KT-15556) Convert lambda to reference isn't proposed for parameterless constructor +- [`KT-15586`](https://youtrack.jetbrains.com/issue/KT-15586) ISE during "Move to a separate file" +- [`KT-15822`](https://youtrack.jetbrains.com/issue/KT-15822) Move class refactoring leaves unused imports +- [`KT-16108`](https://youtrack.jetbrains.com/issue/KT-16108) Cannot rename class on the companion object reference +- [`KT-16198`](https://youtrack.jetbrains.com/issue/KT-16198) Extract method refactoring should order parameters by first usage +- [`KT-17006`](https://youtrack.jetbrains.com/issue/KT-17006) Refactor / Move: usage of library function is reported as problem on move between modules with different library versions +- [`KT-17032`](https://youtrack.jetbrains.com/issue/KT-17032) Refactor / Move updates references to not moved class from the same file +- [`KT-11907`](https://youtrack.jetbrains.com/issue/KT-11907) Move to package renames file to temp.kt +- [`KT-16468`](https://youtrack.jetbrains.com/issue/KT-16468) Destructure declaration intention should be applicable for Pair +- [`KT-16162`](https://youtrack.jetbrains.com/issue/KT-16162) IAE for destructuring declaration entry from KotlinFinalClassOrFunSpringInspection +- [`KT-16556`](https://youtrack.jetbrains.com/issue/KT-16556) Move refactoring shows Refactoring cannot be performed warning. +- [`KT-16605`](https://youtrack.jetbrains.com/issue/KT-16605) NPE caused by Rename Refactoring of backing field when caret is after the last character +- [`KT-16809`](https://youtrack.jetbrains.com/issue/KT-16809) Move refactoring fails badly +- [`KT-16903`](https://youtrack.jetbrains.com/issue/KT-16903) "Convert to primary constructor" doesn't update supertype constructor call in supertypes list in case of implicit superclass constructor call + +### JS + +- [`KT-6627`](https://youtrack.jetbrains.com/issue/KT-6627) JS: test sources doesn't compile from IDE +- [`KT-13610`](https://youtrack.jetbrains.com/issue/KT-13610) JS: boxed Double.NaN is not equal to itself +- [`KT-16012`](https://youtrack.jetbrains.com/issue/KT-16012) JS: prohibit nested declarations, except interfaces inside external interface +- [`KT-16043`](https://youtrack.jetbrains.com/issue/KT-16043) IDL: mark inline helper function as InlineOnly +- [`KT-16058`](https://youtrack.jetbrains.com/issue/KT-16058) JS: getValue/setValue don't work if they are declared as suspend +- [`KT-16164`](https://youtrack.jetbrains.com/issue/KT-16164) JS: Bad getCallableRef in suspend function +- [`KT-16350`](https://youtrack.jetbrains.com/issue/KT-16350) KotlinJS - wrong code generated when temporary variables generated for RHS of `&&` operation +- [`KT-16377`](https://youtrack.jetbrains.com/issue/KT-16377) JS: losing declarations of temporary variables in secondary constructors +- [`KT-16545`](https://youtrack.jetbrains.com/issue/KT-16545) JS: ::class crashes at runtime for primitive types (e.g. Int::class, or Double::class) +- [`KT-16144`](https://youtrack.jetbrains.com/issue/KT-16144) JS: inliner can't find function called through inheritor ("fake" override) from another module + +### Reflection + +- [`KT-9453`](https://youtrack.jetbrains.com/issue/KT-9453) ClassCastException: java.lang.Class cannot be cast to kotlin.reflect.KClass +- [`KT-11254`](https://youtrack.jetbrains.com/issue/KT-11254) Make callable references Serializable on JVM +- [`KT-11316`](https://youtrack.jetbrains.com/issue/KT-11316) NPE in hashCode of KProperty object created for delegated property +- [`KT-12630`](https://youtrack.jetbrains.com/issue/KT-12630) KotlinReflectionInternalError on referencing some functions from stdlib +- [`KT-14731`](https://youtrack.jetbrains.com/issue/KT-14731) When starting application from test source root, kotlin function reflection fails in objects defined in sources + +### Libraries + +- [`KT-16922`](https://youtrack.jetbrains.com/issue/KT-16922) buildSequence/Iterator: Infinite sequence terminates prematurely +- [`KT-16923`](https://youtrack.jetbrains.com/issue/KT-16923) Progression iterator doesn't throw after completion +- [`KT-16994`](https://youtrack.jetbrains.com/issue/KT-16994) Classify sequence operations as stateful/stateless and intermediate/terminal +- [`KT-9786`](https://youtrack.jetbrains.com/issue/KT-9786) String.trimIndent doc is misleading +- [`KT-16572`](https://youtrack.jetbrains.com/issue/KT-16572) Add links to Mozilla Developer Network to kdocs of classes that we generate from IDL +- [`KT-16252`](https://youtrack.jetbrains.com/issue/KT-16252) IDL2K: Add ItemArrayLike interface implementation to collection-like classes + +## 1.1.1 + +### IDE +- [`KT-16714`](https://youtrack.jetbrains.com/issue/KT-16714) J2K: Write access is allowed from event dispatch thread only + +### Compiler +- [`KT-16801`](https://youtrack.jetbrains.com/issue/KT-16801) Accessors of `@PublishedApi` property gets mangled +- [`KT-16673`](https://youtrack.jetbrains.com/issue/KT-16673) Potentially problematic code causes exception when work with SAM adapters + +### Libraries +- [`KT-16557`](https://youtrack.jetbrains.com/issue/KT-16557) Correct `SinceKotlin(1.1)` for all declarations in `kotlin.reflect.full` + +## 1.1.1-RC + +### IDE +- [`KT-16481`](https://youtrack.jetbrains.com/issue/KT-16481) Kotlin debugger & bytecode fail on select statement blocks (IllegalStateException: More than one package fragment) + +### Gradle support +- [`KT-15783`](https://youtrack.jetbrains.com/issue/KT-15783) Gradle builds don't use incremental compilation due to an error: "Could not connect to kotlin daemon" +- [`KT-16434`](https://youtrack.jetbrains.com/issue/KT-16434) Gradle plugin does not compile androidTest sources when Jack is enabled +- [`KT-16546`](https://youtrack.jetbrains.com/issue/KT-16546) Enable incremental compilation in gradle by default + +### Compiler +- [`KT-16184`](https://youtrack.jetbrains.com/issue/KT-16184) AbstractMethodError in Kapt3ComponentRegistrar while compiling from IntelliJ using Kotlin 1.1.0 +- [`KT-16578`](https://youtrack.jetbrains.com/issue/KT-16578) Fix substitutor for synthetic SAM adapters +- [`KT-16581`](https://youtrack.jetbrains.com/issue/KT-16581) VerifyError when calling default value parameter with jvm-target 1.8 +- [`KT-16583`](https://youtrack.jetbrains.com/issue/KT-16583) Cannot access private file-level variables inside a class init within the same file if a secondary constructor is present +- [`KT-16587`](https://youtrack.jetbrains.com/issue/KT-16587) AbstractMethodError: Delegates not generated correctly for private interfaces +- [`KT-16598`](https://youtrack.jetbrains.com/issue/KT-16598) Incorrect error: The feature "bound callable references" is only available since language version 1.1 +- [`KT-16621`](https://youtrack.jetbrains.com/issue/KT-16621) Kotlin compiler doesn't report an error if a class implements Annotation interface but doesn't implement annotationType method +- [`KT-16441`](https://youtrack.jetbrains.com/issue/KT-16441) `NoSuchFieldError: $$delegatedProperties` when delegating through `provideDelegate` in companion object + +### JavaScript support +- Prohibit function types with receiver as parameter types of external declarations +- Remove extension receiver for function parameters in `jQuery` declarations + +## 1.1 + +### Compiler exceptions +- [`KT-16411`](https://youtrack.jetbrains.com/issue/KT-16411) Exception from compiler when try to inline callable reference to class constructor inside object +- [`KT-16412`](https://youtrack.jetbrains.com/issue/KT-16412) Exception from compiler when try call SAM constructor where argument is callable reference to nested class inside object +- [`KT-16413`](https://youtrack.jetbrains.com/issue/KT-16413) When we create sam adapter for java.util.function.Function we add incorrect null-check for argument + +### Standard library +- [`KT-6561`](https://youtrack.jetbrains.com/issue/KT-6561) Drop java.util.Collections package from js stdlib +- `javaClass` extension property is no more deprecated due to migration problems + +### IDE +- [`KT-16329`](https://youtrack.jetbrains.com/issue/KT-16329) Inspection "Calls to staic methods in Java interfaces..." always reports warning undependent of jvm-target + + +## 1.1-RC + +### Reflection +- [`KT-16358`](https://youtrack.jetbrains.com/issue/KT-16358) Incompatibility between kotlin-reflect 1.0 and kotlin-stdlib 1.1 fixed + +### Compiler + +#### Coroutine support +- [`KT-15938`](https://youtrack.jetbrains.com/issue/KT-15938) Changed error message for calling suspend function outside of suspendable context +- [`KT-16092`](https://youtrack.jetbrains.com/issue/KT-16092) Backend crash fixed: "Don't know how to generate outer expression" for destructuring suspend lambda +- [`KT-16093`](https://youtrack.jetbrains.com/issue/KT-16093) Annotations are retained during reading the binary representation of suspend functions +- [`KT-16122`](https://youtrack.jetbrains.com/issue/KT-16122) java.lang.VerifyError fixed in couroutines: (String, null, suspend () -> String) +- [`KT-16124`](https://youtrack.jetbrains.com/issue/KT-16124) Marked as UNSUPPORTED: suspension points in default parameters +- [`KT-16219`](https://youtrack.jetbrains.com/issue/KT-16219) Marked as UNSUPPORTED: suspend get/set, in/!in operators for +- [`KT-16145`](https://youtrack.jetbrains.com/issue/KT-16145) Beta-2 coroutine regression fixed (wrong code generation) + +#### Kapt3 +- [`KT-15524`](https://youtrack.jetbrains.com/issue/KT-15524) Fix javac error reporting in Kotlin daemon +- [`KT-15721`](https://youtrack.jetbrains.com/issue/KT-15721) JetBrains nullability annotations are now returned from Element.getAnnotationMirrors() +- [`KT-16146`](https://youtrack.jetbrains.com/issue/KT-16146) Fixed work in verbose mode +- [`KT-16153`](https://youtrack.jetbrains.com/issue/KT-16153) Ignore declarations with illegal Java identifiers +- [`KT-16167`](https://youtrack.jetbrains.com/issue/KT-16167) Fixed compilation error with kapt arguments in build.gradle +- [`KT-16170`](https://youtrack.jetbrains.com/issue/KT-16170) Stub generator now adds imports for corrected error types to stubs +- [`KT-16176`](https://youtrack.jetbrains.com/issue/KT-16176) javac's finalCompiler log is now used to determine annotation processing errors + +#### Backward compatibility +- [`KT-16017`](https://youtrack.jetbrains.com/issue/KT-16017) More graceful error message for disabled features +- [`KT-16073`](https://youtrack.jetbrains.com/issue/KT-16073) Improved backward compatibility mode with version 1.0 on JDK dependent built-ins +- [`KT-16094`](https://youtrack.jetbrains.com/issue/KT-16094) Compiler considers API availability when compiling language features requiring runtime support +- [`KT-16171`](https://youtrack.jetbrains.com/issue/KT-16171) Fixed regression "Unexpected container error on Kotlin 1.0 project" +- [`KT-16199`](https://youtrack.jetbrains.com/issue/KT-16199) Do not import "kotlin.comparisons.*" by default in language version 1.0 mode + +#### Various issues +- [`KT-16225`](https://youtrack.jetbrains.com/issue/KT-16225) enumValues non-reified stub implementation references nonexistent method no more +- [`KT-16291`](https://youtrack.jetbrains.com/issue/KT-16291) Smart cast works now when getting class of instance +- [`KT-16380`](https://youtrack.jetbrains.com/issue/KT-16380) Show warning when running the compiler under Java 6 or 7 + +### JavaScript backend +- [`KT-16144`](https://youtrack.jetbrains.com/issue/KT-16144) Fixed inlining of functions called through inheritor ("fake" override) from another module +- [`KT-16158`](https://youtrack.jetbrains.com/issue/KT-16158) Error is not reported now when library path contains JAR file without JS metadata, report warning instead +- [`KT-16160`](https://youtrack.jetbrains.com/issue/KT-16160) Companion object dispatch receiver translation fixed + +### Standard library +- [`KT-7858`](https://youtrack.jetbrains.com/issue/KT-7858) Add extension function `takeUnless` +- `javaClass` extension property is deprecated, use `instance::class.java` instead +- Massive deprecations are coming in JS standard library in `kotlin.dom` and `kotlin.dom.build` packages + +### IDE + +#### Configuration issues +- [`KT-15899`](https://youtrack.jetbrains.com/issue/KT-15899) Kotlin facet: language and api version for submodule setup for 1.0 are filled now as 1.0 too +- [`KT-15914`](https://youtrack.jetbrains.com/issue/KT-15914) Kotlin facet works now with multi-selected modules in Project Settings too +- [`KT-15954`](https://youtrack.jetbrains.com/issue/KT-15954) Does not suggest to configure kotlin for the module after each new kt-file creation +- [`KT-16157`](https://youtrack.jetbrains.com/issue/KT-16157) freeCompilerArgs are now imported from Gradle into IDEA +- [`KT-16206`](https://youtrack.jetbrains.com/issue/KT-16206) Idea no more refuses to compile a kotlin project defined as a maven project +- [`KT-16312`](https://youtrack.jetbrains.com/issue/KT-16312) Kotlin facet: import from gradle: don't import options which are set implicitly already +- [`KT-16325`](https://youtrack.jetbrains.com/issue/KT-16325) Kotlin facet: correct configuration after upgrading the IDE plugin +- [`KT-16345`](https://youtrack.jetbrains.com/issue/KT-16345) Kotlin facet: detect JavaScript if the module has language 1.0 `kotlin-js-library` dependency + +#### Coroutine support +- [`KT-16109`](https://youtrack.jetbrains.com/issue/KT-16109) Error fixed: The -Xcoroutines can only have one value +- [`KT-16251`](https://youtrack.jetbrains.com/issue/KT-16251) Fix detection of suspend calls containing extracted parameters + +#### Intention actions, inspections and quick-fixes + +##### 2017.1 compatibility +- [`KT-15870`](https://youtrack.jetbrains.com/issue/KT-15870) "Package name does not match containing directory" inspection: fixed throwable "AWT events are not allowed inside write action" +- [`KT-15924`](https://youtrack.jetbrains.com/issue/KT-15924) Create Test action: fixed throwable "AWT events are not allowed inside write action" + +##### Bug fixes +- [`KT-14831`](https://youtrack.jetbrains.com/issue/KT-14831) Import statement and FQN are not added on converting lambda to reference for typealias +- [`KT-15545`](https://youtrack.jetbrains.com/issue/KT-15545) Inspection "join with assignment" does not change now execution order for properties +- [`KT-15744`](https://youtrack.jetbrains.com/issue/KT-15744) Fix: intention to import `sleep` wrongly suggests `Thread.sleep` +- [`KT-16000`](https://youtrack.jetbrains.com/issue/KT-16000) Inspection "join with assignment" handles initialization with 'this' correctly +- [`KT-16009`](https://youtrack.jetbrains.com/issue/KT-16009) Auto-import for JDK classes in .kts files +- [`KT-16104`](https://youtrack.jetbrains.com/issue/KT-16104) Don't insert modifiers (e.g. suspend) before visibility + +#### Completion +- [`KT-16076`](https://youtrack.jetbrains.com/issue/KT-16076) Completion does not insert more FQN kotlin.text.String +- [`KT-16088`](https://youtrack.jetbrains.com/issue/KT-16088) Completion does not insert more FQN for `kotlin` package +- [`KT-16110`](https://youtrack.jetbrains.com/issue/KT-16110) Keyword 'suspend' completion inside generic arguments +- [`KT-16243`](https://youtrack.jetbrains.com/issue/KT-16243) Performance enhanced after variable of type `ArrayList` + +#### Various issues +- [`KT-15291`](https://youtrack.jetbrains.com/issue/KT-15291) 'Find usages' now does not report property access as usage of getter method in Java class with parameter +- [`KT-15647`](https://youtrack.jetbrains.com/issue/KT-15647) Exception fixed: KDoc link to member of class from different package and module +- [`KT-16071`](https://youtrack.jetbrains.com/issue/KT-16071) IDEA deadlock fixed: when typing "parse()" in .kt file +- [`KT-16149`](https://youtrack.jetbrains.com/issue/KT-16149) Intellij Idea 2017.1/Android Studio 2.3 beta3 and Kotlin plugin 1.1-beta2 deadlock fixed + +### Coroutine libraries +- [`KT-15716`](https://youtrack.jetbrains.com/issue/KT-15716) Introduced startCoroutineUninterceptedOrReturn coroutine intrinsic +- [`KT-15718`](https://youtrack.jetbrains.com/issue/KT-15718) createCoroutine now returns safe continuation +- [`KT-16155`](https://youtrack.jetbrains.com/issue/KT-16155) Introduced createCoroutineUnchecked intrinsic + + +### Gradle support +- [`KT-15829`](https://youtrack.jetbrains.com/issue/KT-15829) Gradle Kotlin JS plugin: removed false "Duplicate source root:" warning for kotlin files +- [`KT-15902`](https://youtrack.jetbrains.com/issue/KT-15902) JS: gradle task output is now considered as source set output +- [`KT-16174`](https://youtrack.jetbrains.com/issue/KT-16174) Error fixed during IDEA-Gradle synchronization for Kotlin JS +- [`KT-16267`](https://youtrack.jetbrains.com/issue/KT-16267) JS: fixed regression in 1.1-beta2 for multi-module gradle project +- [`KT-16274`](https://youtrack.jetbrains.com/issue/KT-16274) Kotlin JS Gradle unexpected compiler error / absolute path to output file +- [`KT-16322`](https://youtrack.jetbrains.com/issue/KT-16322) Circlet project Gradle import issue fixed + +### REPL +- [`KT-15861`](https://youtrack.jetbrains.com/issue/KT-15861) Use windows line separator in kotlin's JSR implementation +- [`KT-16126`](https://youtrack.jetbrains.com/issue/KT-16126) Proper `jvmTarget` for REPL compilation + + +## 1.1-Beta2 + +### Language related changes +- [`KT-7897`](https://youtrack.jetbrains.com/issue/KT-7897) Do not require to call enum constructor for each entry if all parameters have default values +- [`KT-8985`](https://youtrack.jetbrains.com/issue/KT-8985) Support T::class.java for T with no non-null upper bound +- [`KT-10711`](https://youtrack.jetbrains.com/issue/KT-10711) Type inference works now on generics for callable references +- [`KT-13130`](https://youtrack.jetbrains.com/issue/KT-13130) Support exhaustive when for sealed trees +- [`KT-15898`](https://youtrack.jetbrains.com/issue/KT-15898) Cannot use type alias to qualify enum entry +- [`KT-16061`](https://youtrack.jetbrains.com/issue/KT-16061) Smart type inference on callable references in 1.1 mode only + +### Reflection +- [`KT-8384`](https://youtrack.jetbrains.com/issue/KT-8384) Access to the delegate object for a KProperty + +### Compiler + +#### Coroutine support +- [`KT-15016`](https://youtrack.jetbrains.com/issue/KT-15016) VerifyError with coroutine: fix processing of uninitialized instances +- [`KT-15527`](https://youtrack.jetbrains.com/issue/KT-15527) Coroutine compile error: wrong code generated for safe qualified suspension points +- [`KT-15552`](https://youtrack.jetbrains.com/issue/KT-15552) Accessor implementation of suspended function produces AbstractMethodError +- [`KT-15715`](https://youtrack.jetbrains.com/issue/KT-15715) Coroutine generate invalid invoke +- [`KT-15820`](https://youtrack.jetbrains.com/issue/KT-15820) Coroutine Internal Error regression with dispatcher + this@ +- [`KT-15821`](https://youtrack.jetbrains.com/issue/KT-15821) Coroutine internal error regression: Could not inline method call apply +- [`KT-15824`](https://youtrack.jetbrains.com/issue/KT-15824) Coroutine iterator regression: Object cannot be cast to java.lang.Boolean +- [`KT-15827`](https://youtrack.jetbrains.com/issue/KT-15827) Show Kotlin Bytecode shows wrong bytecode for suspending functions +- [`KT-15907`](https://youtrack.jetbrains.com/issue/KT-15907) Bogus error about platform declaration clash with private suspend functions +- [`KT-15933`](https://youtrack.jetbrains.com/issue/KT-15933) Suspend getValue/setValue/provideDelegate do not work properly +- [`KT-15935`](https://youtrack.jetbrains.com/issue/KT-15935) Private suspend function in file causes UnsupportedOperationException: Context does not have a "this" +- [`KT-15963`](https://youtrack.jetbrains.com/issue/KT-15963) Coroutine: runtime error if returned object "equals" does not like comparison to SUSPENDED_MARKER +- [`KT-16068`](https://youtrack.jetbrains.com/issue/KT-16068) Prohibit inline lambda parameters of suspend function type + +#### Diagnostics +- [`KT-1560`](https://youtrack.jetbrains.com/issue/KT-1560) Report diagnostic for a declaration of extension function which will be always shadowed by member function +- [`KT-12846`](https://youtrack.jetbrains.com/issue/KT-12846) Forbid vararg of Nothing +- [`KT-13227`](https://youtrack.jetbrains.com/issue/KT-13227) NO_ELSE_IN_WHEN in when by sealed class instance if is-check for base sealed class is used +- [`KT-13355`](https://youtrack.jetbrains.com/issue/KT-13355) Type mismatch on inheritance is not reported on abstract class +- [`KT-15010`](https://youtrack.jetbrains.com/issue/KT-15010) Missing error on an usage of non-constant property in annotation default argument +- [`KT-15201`](https://youtrack.jetbrains.com/issue/KT-15201) Compiler is complaining about when statement without null condition even if null is checked before. +- [`KT-15736`](https://youtrack.jetbrains.com/issue/KT-15736) Report an error on type alias expanded to a nullable type on LHS of a class literal +- [`KT-15740`](https://youtrack.jetbrains.com/issue/KT-15740) Report error on expression of a nullable type on LHS of a class literal +- [`KT-15844`](https://youtrack.jetbrains.com/issue/KT-15844) Do not allow to access primary constructor parameters from property with custom getter +- [`KT-15878`](https://youtrack.jetbrains.com/issue/KT-15878) Extension shadowed by member should not be reported for infix/operator extensions when member is non-infix/operator +- [`KT-16010`](https://youtrack.jetbrains.com/issue/KT-16010) Do not highlight lambda parameters as unused in 1.0 compatibility mode + +#### Kapt +- [`KT-15675`](https://youtrack.jetbrains.com/issue/KT-15675) Kapt3 does not generate classes annotated with AutoValue +- [`KT-15697`](https://youtrack.jetbrains.com/issue/KT-15697) If an annotation with AnnotationTarget.PROPERTY is tagged on a Kotlin property, it breaks annotation processing +- [`KT-15803`](https://youtrack.jetbrains.com/issue/KT-15803) Kotlin 1.0.6 broke Dagger +- [`KT-15814`](https://youtrack.jetbrains.com/issue/KT-15814) Regression: Kapt is not working in 1.0.6 / 1.1-M04 / 1.1-Beta +- [`KT-15838`](https://youtrack.jetbrains.com/issue/KT-15838) kapt3 1.1-beta: KaptError: Java file parsing error +- [`KT-15841`](https://youtrack.jetbrains.com/issue/KT-15841) 1.1-Beta + kapt3 fails to build the project with StackOverflowError +- [`KT-15915`](https://youtrack.jetbrains.com/issue/KT-15915) Kapt: Kotlin class target directory is cleared before compilation (and after kapt task) +- [`KT-16006`](https://youtrack.jetbrains.com/issue/KT-16006) Cannot determine if type is an error type during annotation processing + +#### Exceptions / Errors +- [`KT-8264`](https://youtrack.jetbrains.com/issue/KT-8264) Internal compiler error: java.lang.ArithmeticException: BigInteger: modulus not positive +- [`KT-14547`](https://youtrack.jetbrains.com/issue/KT-14547) NoSuchElementException when compiling callable reference without stdlib in the classpath +- [`KT-14966`](https://youtrack.jetbrains.com/issue/KT-14966) Regression: VerifyError on access super implementation from delegate +- [`KT-15017`](https://youtrack.jetbrains.com/issue/KT-15017) Throwing exception in the end of inline suspend-functions lead to internal compiler error +- [`KT-15439`](https://youtrack.jetbrains.com/issue/KT-15439) Resolved call is not completed for generic callable reference in if-expression +- [`KT-15500`](https://youtrack.jetbrains.com/issue/KT-15500) Exception passing freeCompilerArgs to gradle plugin +- [`KT-15646`](https://youtrack.jetbrains.com/issue/KT-15646) InconsistentDebugInfoException when stepping over `throw` +- [`KT-15726`](https://youtrack.jetbrains.com/issue/KT-15726) Kotlin compiles invalid bytecode for nested try-catch with return +- [`KT-15743`](https://youtrack.jetbrains.com/issue/KT-15743) Overloaded Kotlin extensions annotates wrong parameters in java +- [`KT-15868`](https://youtrack.jetbrains.com/issue/KT-15868) NPE when comparing nullable doubles for equality +- [`KT-15995`](https://youtrack.jetbrains.com/issue/KT-15995) Can't build project with DataBinding using Kotlin 1.1: incompatible language version +- [`KT-16047`](https://youtrack.jetbrains.com/issue/KT-16047) Internal Error: org.jetbrains.kotlin.util.KotlinFrontEndException while analyzing expression + +#### Type inference issues +- [`KT-10268`](https://youtrack.jetbrains.com/issue/KT-10268) Wrong type inference related to captured types +- [`KT-11259`](https://youtrack.jetbrains.com/issue/KT-11259) Wrong type inference for Java 8 Stream.collect. +- [`KT-12802`](https://youtrack.jetbrains.com/issue/KT-12802) Type inference failed when irrelevant method reference is used +- [`KT-12964`](https://youtrack.jetbrains.com/issue/KT-12964) Support type inference for callable references from parameter types of an expected function type + +#### Smart cast issues +- [`KT-13468`](https://youtrack.jetbrains.com/issue/KT-13468) Smart cast is broken after assignment of 'if' expression +- [`KT-14350`](https://youtrack.jetbrains.com/issue/KT-14350) Make smart-cast work as it does in 1.0 when -language-version 1.0 is used +- [`KT-14597`](https://youtrack.jetbrains.com/issue/KT-14597) When over smartcast enum is broken and breaks all other "when" +- [`KT-15792`](https://youtrack.jetbrains.com/issue/KT-15792) Wrong smart cast after y = x, x = null, y != null sequence + +#### Various issues +- [`KT-15236`](https://youtrack.jetbrains.com/issue/KT-15236) False positive: Null can not be a value of a non-null type +- [`KT-15677`](https://youtrack.jetbrains.com/issue/KT-15677) Modifiers and annotations are lost on a (nullable) parenthesized type +- [`KT-15707`](https://youtrack.jetbrains.com/issue/KT-15707) IDEA unable to parallel compile different projects +- [`KT-15734`](https://youtrack.jetbrains.com/issue/KT-15734) Nullability is lost during expansion of a type alias +- [`KT-15748`](https://youtrack.jetbrains.com/issue/KT-15748) Type alias constructor return type should have a corresponding abbreviation +- [`KT-15775`](https://youtrack.jetbrains.com/issue/KT-15775) Annotations are lost on value parameter types of a function type +- [`KT-15780`](https://youtrack.jetbrains.com/issue/KT-15780) Treat Map.getOrDefault overrides in Java the same way as in 1.0.x compiler with language version 1.0 +- [`KT-15794`](https://youtrack.jetbrains.com/issue/KT-15794) Refine backward compatibility mode for additional built-ins members from JDK +- [`KT-15848`](https://youtrack.jetbrains.com/issue/KT-15848) Implement additional annotation processing in the `KotlinScriptDefinitionFromAnnotatedTemplate` for SamWithReceiver plugin +- [`KT-15875`](https://youtrack.jetbrains.com/issue/KT-15875) Operation has lead to overflow for 'mod' with negative first operand +- [`KT-15945`](https://youtrack.jetbrains.com/issue/KT-15945) Feature Request: Andrey Breslav to grow a beard. + +### JavaScript backend + +#### Coroutine support +- [`KT-15834`](https://youtrack.jetbrains.com/issue/KT-15834) JS: Local delegate in suspend function +- [`KT-15892`](https://youtrack.jetbrains.com/issue/KT-15892) JS: safe call of suspend functions causes compiler to crash + +#### Diagnostics +- [`KT-14668`](https://youtrack.jetbrains.com/issue/KT-14668) Do not allow declarations in 'kotlin' package or subpackages in JS +- [`KT-15184`](https://youtrack.jetbrains.com/issue/KT-15184) JS: prohibit `..` operation with `dynamic` on left-hand side +- [`KT-15253`](https://youtrack.jetbrains.com/issue/KT-15253) JS: no error when use class external class with JsModule in type context when compiling with plain module kind +- [`KT-15283`](https://youtrack.jetbrains.com/issue/KT-15283) JS: additional restrictions on dynamic +- [`KT-15961`](https://youtrack.jetbrains.com/issue/KT-15961) Could not implement external open class with function with optional parameter + +#### Language feature support +- [`KT-14035`](https://youtrack.jetbrains.com/issue/KT-14035) JS: support implementing CharSequence +- [`KT-14036`](https://youtrack.jetbrains.com/issue/KT-14036) JS: use Int16 for Char when it possible and box to our Char otherwise +- [`KT-14097`](https://youtrack.jetbrains.com/issue/KT-14097) Wrong code generated for enum entry initialization using non-primary no-argument constructor +- [`KT-15312`](https://youtrack.jetbrains.com/issue/KT-15312) JS: map kotlin.Throwable to JS Error +- [`KT-15765`](https://youtrack.jetbrains.com/issue/KT-15765) JS: support callable references on built-in and intrinsic functions and properties +- [`KT-15900`](https://youtrack.jetbrains.com/issue/KT-15900) JS: Support enum entry with empty initializer with vararg constructor + +#### Standard library support +- [`KT-4141`](https://youtrack.jetbrains.com/issue/KT-4141) JS: wrong return type for Date::getTime +- [`KT-4497`](https://youtrack.jetbrains.com/issue/KT-4497) JS: add String.toInt, String.toDouble etc extension functions, `parseInt` and `parseFloat` are deprecated in favor of these new ones +- [`KT-15940`](https://youtrack.jetbrains.com/issue/KT-15940) JS: rename all js standard library artifacts (both in maven and in compiler distribution) to `kotlin-stdlib-js.jar` +- Add `Promise` external declaration to the standard library +- Types like `Date`, `Math`, `Console`, `Promise`, `RegExp`, `Json` require explicit import from `kotlin.js` package + +#### External declarations +- [`KT-15144`](https://youtrack.jetbrains.com/issue/KT-15144) JS: rename `noImpl` to `definedExternally` +- [`KT-15306`](https://youtrack.jetbrains.com/issue/KT-15306) JS: allow to use `definedExternally` only inside a body of external declarations +- [`KT-15336`](https://youtrack.jetbrains.com/issue/KT-15336) JS: allow to inherit external classes from kotlin.Throwable +- [`KT-15905`](https://youtrack.jetbrains.com/issue/KT-15905) JS: add a way to control qualifier for external declarations inside file +- Deprecate `@native` annotation, to be removed in 1.1 release. + +#### Exceptions / Errors +- [`KT-10894`](https://youtrack.jetbrains.com/issue/KT-10894) Infinite indexing at projects with JS modules +- [`KT-14124`](https://youtrack.jetbrains.com/issue/KT-14124) AssertionError: strings file not found on K2JS serialized data + +#### Various issues +- [`KT-8211`](https://youtrack.jetbrains.com/issue/KT-8211) JS: generate dummy init for properties w/o initializer to avoid to have different hidden classes for different instances +- [`KT-12712`](https://youtrack.jetbrains.com/issue/KT-12712) JS: Json should not be a class +- [`KT-13312`](https://youtrack.jetbrains.com/issue/KT-13312) JS: can't use extension lambda where expected lambda and vice versa +- [`KT-13632`](https://youtrack.jetbrains.com/issue/KT-13632) Add template kotlin js project under gradle in "New Project" window +- [`KT-15278`](https://youtrack.jetbrains.com/issue/KT-15278) JS: don't treat property access through dynamic as side effect free +- [`KT-15285`](https://youtrack.jetbrains.com/issue/KT-15285) JS: take into account as many characteristics from the signature as possible when mangling +- [`KT-15678`](https://youtrack.jetbrains.com/issue/KT-15678) JS: Generated local variable named 'element' clashes with actual local variable named 'element' +- [`KT-15755`](https://youtrack.jetbrains.com/issue/KT-15755) JS compiler produces a lot of empty kotlin_file_table files for irrelevant packages +- [`KT-15770`](https://youtrack.jetbrains.com/issue/KT-15770) Name clash between recursive local functions with same name +- [`KT-15797`](https://youtrack.jetbrains.com/issue/KT-15797) JS: wrong code for accessing nested class inside js module +- [`KT-15863`](https://youtrack.jetbrains.com/issue/KT-15863) JS: Extension function reference shifts parameters loosing the receiver +- [`KT-16049`](https://youtrack.jetbrains.com/issue/KT-16049) JS: drop "-kjsm" command line option, merge the logic into "-meta-info" +- [`KT-16083`](https://youtrack.jetbrains.com/issue/KT-16083) JS: rename "-library-files" argument to "-libraries" and change separator from comma to system file separator + +### Standard Library +- [`KT-13353`](https://youtrack.jetbrains.com/issue/KT-13353) Add Map.minus(key) and Map.minus(keys) +- [`KT-13826`](https://youtrack.jetbrains.com/issue/KT-13826) Add parameter names in function types used in the standard library +- [`KT-14279`](https://youtrack.jetbrains.com/issue/KT-14279) Make String.matches(Regex) and Regex.matches(String) infix +- [`KT-15399`](https://youtrack.jetbrains.com/issue/KT-15399) Iterable.average() now returns NaN for an empty collection +- [`KT-15975`](https://youtrack.jetbrains.com/issue/KT-15975) Move coroutine-related runtime parts to `kotlin.coroutines.experimental` package +- [`KT-16030`](https://youtrack.jetbrains.com/issue/KT-16030) Move bitwise operations on Byte and Short to `kotlin.experimental` package +- [`KT-16026`](https://youtrack.jetbrains.com/issue/KT-16026) Classes compiled in 1.1 in 1.0-compatibility mode may contain references to CloseableKt class from 1.1 + +### IDE + +#### Configuration issues +- [`KT-15621`](https://youtrack.jetbrains.com/issue/KT-15621) Copy compiler options values from project settings on creating a kotlin facet for Kotlin (JVM) project +- [`KT-15623`](https://youtrack.jetbrains.com/issue/KT-15623) Copy compiler options values from project settings on creating a kotlin facet for Kotlin (JavaScript) project +- [`KT-15624`](https://youtrack.jetbrains.com/issue/KT-15624) Set option "Use project settings" in newly created Kotlin facet +- [`KT-15712`](https://youtrack.jetbrains.com/issue/KT-15712) Configuring a project with Maven or Gradle should automatically use stdlib-jre7 or stdlib-jre8 instead of standard stdlib +- [`KT-15772`](https://youtrack.jetbrains.com/issue/KT-15772) Facet does not pick up api version from maven +- [`KT-15819`](https://youtrack.jetbrains.com/issue/KT-15819) It would be nice if compileKotlin options are imported into Kotlin facet from gradle/maven +- [`KT-16015`](https://youtrack.jetbrains.com/issue/KT-16015) Prohibit api-version > language-version in Facet and Project Settings + +#### Coroutine support +- [`KT-14704`](https://youtrack.jetbrains.com/issue/KT-14704) Extract Method should work in coroutines +- [`KT-15955`](https://youtrack.jetbrains.com/issue/KT-15955) Quick-fix to enable coroutines through Gradle project configuration +- [`KT-16018`](https://youtrack.jetbrains.com/issue/KT-16018) Hide coroutines intrinsics from import and completion +- [`KT-16075`](https://youtrack.jetbrains.com/issue/KT-16075) Error:Kotlin: The -Xcoroutines can only have one value + +#### Backward compatibility issues +- [`KT-15134`](https://youtrack.jetbrains.com/issue/KT-15134) Do not suggest using destructuring lambda if this will result in "available since 1.1" error +- [`KT-15918`](https://youtrack.jetbrains.com/issue/KT-15918) Quick fix "Set module language level to 1.1" should also set API version to 1.1 +- [`KT-15969`](https://youtrack.jetbrains.com/issue/KT-15969) Replace operator with function should use either rem or mod for % depending on language version +- [`KT-15978`](https://youtrack.jetbrains.com/issue/KT-15978) Type alias from Kotlin 1.1 are suggested in completion even if language level is set to 1.0 in settings +- [`KT-15979`](https://youtrack.jetbrains.com/issue/KT-15979) Usages of type aliases are not shown as errors in editor if language version is set to 1.0 +- [`KT-16019`](https://youtrack.jetbrains.com/issue/KT-16019) Do not suggest renaming to underscore in 1.0 compatibility mode +- [`KT-16036`](https://youtrack.jetbrains.com/issue/KT-16036) "Create type alias from usage" quick-fix should not be suggested at language level 1.0 + +#### Intention actions, inspections and quick-fixes + +##### New features +- [`KT-9912`](https://youtrack.jetbrains.com/issue/KT-9912) Merge ifs intention +- [`KT-13427`](https://youtrack.jetbrains.com/issue/KT-13427) "Specify type explicitly" should support type aliases +- [`KT-15066`](https://youtrack.jetbrains.com/issue/KT-15066) "Make private/.." intention on type aliases +- [`KT-15709`](https://youtrack.jetbrains.com/issue/KT-15709) Add inspection for private primary constructors in data classes as they are accessible via the copy method +- [`KT-15738`](https://youtrack.jetbrains.com/issue/KT-15738) Intention to add `suspend` modifier to functional type +- [`KT-15800`](https://youtrack.jetbrains.com/issue/KT-15800) Quick-fix to convert a function to suspending on error when calling suspension inside + +##### Bug fixes +- [`KT-13710`](https://youtrack.jetbrains.com/issue/KT-13710) Import intention action should not appear in import list +- [`KT-14680`](https://youtrack.jetbrains.com/issue/KT-14680) import statement to type alias reported as unused when using only TA constructor +- [`KT-14856`](https://youtrack.jetbrains.com/issue/KT-14856) TextView internationalisation intention does not report the problem +- [`KT-14993`](https://youtrack.jetbrains.com/issue/KT-14993) Keep destructuring declaration parameter on inspection "Remove explicit lambda parameter types" +- [`KT-14994`](https://youtrack.jetbrains.com/issue/KT-14994) PsiInvalidElementAccessException and incorrect generation on inspection "Specify type explicitly" on destructuring parameter +- [`KT-15162`](https://youtrack.jetbrains.com/issue/KT-15162) "Remove explicit lambda parameter types" intentions fails with destructuring declaration with KNPE at KtPsiFactory.createLambdaParameterList() +- [`KT-15311`](https://youtrack.jetbrains.com/issue/KT-15311) "Add Import" intention generates incorrect code +- [`KT-15406`](https://youtrack.jetbrains.com/issue/KT-15406) Convert to secondary constructor for enum class should put new members after enum values +- [`KT-15553`](https://youtrack.jetbrains.com/issue/KT-15553) Copy concatenation text to clipboard with Kotlin and string interpolation does not work +- [`KT-15670`](https://youtrack.jetbrains.com/issue/KT-15670) 'Convert to lambda' quick fix in IDEA leaves single-line comment and } gets commented out +- [`KT-15873`](https://youtrack.jetbrains.com/issue/KT-15873) Alt+Enter menu isn't shown for deprecated mod function +- [`KT-15874`](https://youtrack.jetbrains.com/issue/KT-15874) Replace operator with function call replaces % with deprecated mod +- [`KT-15884`](https://youtrack.jetbrains.com/issue/KT-15884) False positive "Redundant .let call" +- [`KT-16072`](https://youtrack.jetbrains.com/issue/KT-16072) Intentions to convert suspend lambdas to callable references should not be shown + +#### Android support +- [`KT-13275`](https://youtrack.jetbrains.com/issue/KT-13275) Kotlin Gradle plugin for Android does not work when jackOptions enabled +- [`KT-15150`](https://youtrack.jetbrains.com/issue/KT-15150) Android: Add quick-fix to generate View constructor convention +- [`KT-15282`](https://youtrack.jetbrains.com/issue/KT-15282) Issues debugging crossinline Android code + +#### KDoc +- [`KT-14710`](https://youtrack.jetbrains.com/issue/KT-14710) Sample references are not resolved in IDE +- [`KT-15796`](https://youtrack.jetbrains.com/issue/KT-15796) Import of class referenced only in KDoc not preserved after copy-paste + +#### Various issues +- [`KT-9011`](https://youtrack.jetbrains.com/issue/KT-9011) Shift+Enter should insert curly braces when invoked after class declaration +- [`KT-11308`](https://youtrack.jetbrains.com/issue/KT-11308) Hide kotlin.jvm.internal package contents from completion and auto-import +- [`KT-14252`](https://youtrack.jetbrains.com/issue/KT-14252) Completion could suggest constructors available via type aliases +- [`KT-14722`](https://youtrack.jetbrains.com/issue/KT-14722) Completion list isn't filled up for type alias to object +- [`KT-14767`](https://youtrack.jetbrains.com/issue/KT-14767) Type alias to annotation class should appear in the completion list +- [`KT-14859`](https://youtrack.jetbrains.com/issue/KT-14859) "Parameter Info" sometimes does not work properly inside lambda +- [`KT-15032`](https://youtrack.jetbrains.com/issue/KT-15032) Injected fragment: descriptor was not found for declaration: FUN +- [`KT-15153`](https://youtrack.jetbrains.com/issue/KT-15153) Support typeAlias extensions in completion and add import +- [`KT-15786`](https://youtrack.jetbrains.com/issue/KT-15786) NoSuchMethodError: com.intellij.util.containers.UtilKt.isNullOrEmpty +- [`KT-15883`](https://youtrack.jetbrains.com/issue/KT-15883) Generating equals() and hashCode(): hashCode does not correctly honor variable names with back ticks +- [`KT-15911`](https://youtrack.jetbrains.com/issue/KT-15911) Kotlin REPL will not launch: "Neither main class nor JAR path is specified" + +### J2K +- [`KT-15789`](https://youtrack.jetbrains.com/issue/KT-15789) Kotlin plugin incorrectly converts for-loops from Java to Kotlin + +### Gradle support +- [`KT-14830`](https://youtrack.jetbrains.com/issue/KT-14830) Kotlin Gradle plugin configuration should not add 'kotlin' source directory by default +- [`KT-15279`](https://youtrack.jetbrains.com/issue/KT-15279) 'Kotlin not configured message' should not be displayed while gradle sync is in progress +- [`KT-15812`](https://youtrack.jetbrains.com/issue/KT-15812) Create Kotlin facet on importing gradle project with unchecked option Create separate module per source set +- [`KT-15837`](https://youtrack.jetbrains.com/issue/KT-15837) Gradle compiler attempts to connect to daemon on address derived from DNS lookup +- [`KT-15909`](https://youtrack.jetbrains.com/issue/KT-15909) Copy Gradle compiler options to facets in Intellij/AS +- [`KT-15929`](https://youtrack.jetbrains.com/issue/KT-15929) Gradle project imported with wrong 'target platform' + +### Other issues +- [`KT-15450`](https://youtrack.jetbrains.com/issue/KT-15450) JSR 223 - support eval with bindings + + +## 1.1.0-Beta + +### Reflection +- [`KT-15540`](https://youtrack.jetbrains.com/issue/KT-15540) findAnnotation returns T?, but it throws NoSuchElementException when there is no matching annotation +- Reflection API in `kotlin-reflect` library is moved to `kotlin.reflect.full` package, declarations in the package `kotlin.reflect` are left deprecated. Please migrate according to the hints provided. + +### Compiler + +#### Coroutine support +- [`KT-15379`](https://youtrack.jetbrains.com/issue/KT-15379) Allow invoke on instances of suspend function type inside suspend function +- [`KT-15380`](https://youtrack.jetbrains.com/issue/KT-15380) Support suspend function type with value parameters +- [`KT-15391`](https://youtrack.jetbrains.com/issue/KT-15391) Prohibit suspend function type in supertype list +- [`KT-15392`](https://youtrack.jetbrains.com/issue/KT-15392) Prohibit local suspending function +- [`KT-15413`](https://youtrack.jetbrains.com/issue/KT-15413) Override regular functions with suspending ones and vice versa +- [`KT-15657`](https://youtrack.jetbrains.com/issue/KT-15657) Refine dispatchResume convention +- [`KT-15662`](https://youtrack.jetbrains.com/issue/KT-15662) Prohibit callable references to suspend functions + +#### Diagnostics +- [`KT-9630`](https://youtrack.jetbrains.com/issue/KT-9630) Cannot create extension function on intersection of types +- [`KT-11398`](https://youtrack.jetbrains.com/issue/KT-11398) Possible false positive for INACCESSIBLE_TYPE +- [`KT-13593`](https://youtrack.jetbrains.com/issue/KT-13593) Do not report USELESS_ELVIS_RIGHT_IS_NULL for left argument with platform type +- [`KT-13859`](https://youtrack.jetbrains.com/issue/KT-13859) Wrong error about using unrepeatable annotation when mix implicit and explicit targets +- [`KT-14179`](https://youtrack.jetbrains.com/issue/KT-14179) Prohibit to use enum entry as type parameter +- [`KT-15097`](https://youtrack.jetbrains.com/issue/KT-15097) Inherited platform declarations clash: regression under 1.1 when indirectly inheriting from java.util.Map +- [`KT-15287`](https://youtrack.jetbrains.com/issue/KT-15287) Kotlin runtime 1.1 and runtime 1.0.x: Overload resolution ambiguity +- [`KT-15334`](https://youtrack.jetbrains.com/issue/KT-15334) Incorrect "val cannot be reassigned" inside do-while +- [`KT-15410`](https://youtrack.jetbrains.com/issue/KT-15410) "Protected function call from public-API inline function" for protected constructor call + +#### Kapt3 +- [`KT-15145`](https://youtrack.jetbrains.com/issue/KT-15145) Kapt3: Doesn't compile with multiple errors +- [`KT-15232`](https://youtrack.jetbrains.com/issue/KT-15232) Kapt3 crash due to java codepage +- [`KT-15359`](https://youtrack.jetbrains.com/issue/KT-15359) Kapt3 exception while annotation processing (DataBindings AS2.3-beta1) +- [`KT-15375`](https://youtrack.jetbrains.com/issue/KT-15375) Kapt3 can't find ${env.JDK_18}/lib/tools.jar +- [`KT-15381`](https://youtrack.jetbrains.com/issue/KT-15381) Unresolved references: R with Kapt3 +- [`KT-15397`](https://youtrack.jetbrains.com/issue/KT-15397) Kapt3 doesn't work with databinding +- [`KT-15409`](https://youtrack.jetbrains.com/issue/KT-15409) Kapt3 Cannot find the getter for attribute 'android:text' with value type java.lang.String on android.widget.EditText. +- [`KT-15421`](https://youtrack.jetbrains.com/issue/KT-15421) Kapt3: Substitute types from Psi instead of writing NonExistentClass for generated type names +- [`KT-15459`](https://youtrack.jetbrains.com/issue/KT-15459) Kapt3 doesn't generate code in test module +- [`KT-15524`](https://youtrack.jetbrains.com/issue/KT-15524) Kapt3 - Error messages should display associated element information (if available) +- [`KT-15713`](https://youtrack.jetbrains.com/issue/KT-15713) Kapt3: circular dependencies between Gradke tasks + +#### Exceptions / Errors +- [`KT-11401`](https://youtrack.jetbrains.com/issue/KT-11401) Error type encountered for implicit invoke with function literal argument +- [`KT-12044`](https://youtrack.jetbrains.com/issue/KT-12044) Assertion "Rewrite at slice LEXICAL_SCOPE" for 'if' with property references +- [`KT-14011`](https://youtrack.jetbrains.com/issue/KT-14011) Compiler crash when inlining: lateinit property allRecapturedParameters has not been initialized +- [`KT-14868`](https://youtrack.jetbrains.com/issue/KT-14868) CCE in runtime while converting Number to Char +- [`KT-15364`](https://youtrack.jetbrains.com/issue/KT-15364) VerifyError: Bad type on operand stack on ObserverIterator.hasNext +- [`KT-15373`](https://youtrack.jetbrains.com/issue/KT-15373) Internal error when running TestNG test +- [`KT-15437`](https://youtrack.jetbrains.com/issue/KT-15437) VerifyError: Bad local variable type on simplest provideDelegate +- [`KT-15446`](https://youtrack.jetbrains.com/issue/KT-15446) Property reference on an instance of subclass causes java.lang.VerifyError +- [`KT-15447`](https://youtrack.jetbrains.com/issue/KT-15447) Compiler backend error: "Don't know how to generate outer expression for class" +- [`KT-15449`](https://youtrack.jetbrains.com/issue/KT-15449) Back-end (JVM) Internal error: Couldn't inline method call +- [`KT-15464`](https://youtrack.jetbrains.com/issue/KT-15464) Regression: "Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:" +- [`KT-15575`](https://youtrack.jetbrains.com/issue/KT-15575) VerifyError: Bad type on operand stack + +#### Various issues +- [`KT-11962`](https://youtrack.jetbrains.com/issue/KT-11962) Super call with default parameters check is generated for top-level function +- [`KT-11969`](https://youtrack.jetbrains.com/issue/KT-11969) ProGuard issue with private interface methods +- [`KT-12795`](https://youtrack.jetbrains.com/issue/KT-12795) Write information about sealed class inheritors to metadata +- [`KT-13718`](https://youtrack.jetbrains.com/issue/KT-13718) ClassFormatError on aspectj instrumentation +- [`KT-14162`](https://youtrack.jetbrains.com/issue/KT-14162) Support @InlineOnly on inline properties +- [`KT-14705`](https://youtrack.jetbrains.com/issue/KT-14705) Inconsistent smart casts on when enum subject +- [`KT-14917`](https://youtrack.jetbrains.com/issue/KT-14917) No way to pass additional java command line options to kontlinc on Windows +- [`KT-15112`](https://youtrack.jetbrains.com/issue/KT-15112) Compiler hangs on nested lock compilation +- [`KT-15225`](https://youtrack.jetbrains.com/issue/KT-15225) Scripts: generate classes with names that are valid Java identifiers +- [`KT-15411`](https://youtrack.jetbrains.com/issue/KT-15411) Unnecessary CHECKCAST bytecode when dealing with null +- [`KT-15473`](https://youtrack.jetbrains.com/issue/KT-15473) Invalid KFunction byte code signature for callable references +- [`KT-15582`](https://youtrack.jetbrains.com/issue/KT-15582) Generated bytecode is sometimes incompatible with Java 9 +- [`KT-15584`](https://youtrack.jetbrains.com/issue/KT-15584) Do not mark class files compiled with a release language version as pre-release +- [`KT-15589`](https://youtrack.jetbrains.com/issue/KT-15589) Upper bound for T in KClass can be implicitly violated using generic function +- [`KT-15631`](https://youtrack.jetbrains.com/issue/KT-15631) Compiler hang in MethodAnalyzer.analyze() fixed + +### JavaScript backend + +#### Coroutine support +- [`KT-15362`](https://youtrack.jetbrains.com/issue/KT-15362) JS: Regex doesn't work (properly) in coroutine +- [`KT-15366`](https://youtrack.jetbrains.com/issue/KT-15366) JS: error when calling inline function with optional parameters from another module inside coroutine lambda +- [`KT-15367`](https://youtrack.jetbrains.com/issue/KT-15367) JS: `for` against iterator with suspend `next` and `hasNext` functions does not work +- [`KT-15400`](https://youtrack.jetbrains.com/issue/KT-15400) suspendCoroutine is missing in JS BE +- [`KT-15597`](https://youtrack.jetbrains.com/issue/KT-15597) Support non-tail suspend calls inside named suspend functions +- [`KT-15625`](https://youtrack.jetbrains.com/issue/KT-15625) JS: return statement without value surrounded by `try..finally` in suspend lambda causes compiler error +- [`KT-15698`](https://youtrack.jetbrains.com/issue/KT-15698) Move coroutine intrinsics to kotlin.coroutine.intrinsics package + +#### Diagnostics +- [`KT-14577`](https://youtrack.jetbrains.com/issue/KT-14577) JS: do not report declaration clash when common redeclaration diagnostic applies +- [`KT-15136`](https://youtrack.jetbrains.com/issue/KT-15136) JS: prohibit inheritance from kotlin Function{N} interfaces + +#### Language features support +- [`KT-12194`](https://youtrack.jetbrains.com/issue/KT-12194) Exhaustiveness check isn't generated for when expressions in JS at all +- [`KT-15590`](https://youtrack.jetbrains.com/issue/KT-15590) Support increment on inlined properties + +#### Native / external +- [`KT-8081`](https://youtrack.jetbrains.com/issue/KT-8081) JS: native inherited class shouldn't require super or primary constructor call +- [`KT-13892`](https://youtrack.jetbrains.com/issue/KT-13892) JS: restrictions for native (external) functions and properties +- [`KT-15307`](https://youtrack.jetbrains.com/issue/KT-15307) JS: prohibit inline members inside external declarations +- [`KT-15308`](https://youtrack.jetbrains.com/issue/KT-15308) JS: prohibit non-abstract members inside external interfaces except nullable properties (with accessors) + +#### Exceptions / Errors +- [`KT-7302`](https://youtrack.jetbrains.com/issue/KT-7302) KotlinJS - Trait with optional parameter causes compilation error +- [`KT-15325`](https://youtrack.jetbrains.com/issue/KT-15325) JS: ReferenceError: $receiver is not defined +- [`KT-15357`](https://youtrack.jetbrains.com/issue/KT-15357) JS: `when` expression in primary-from-secondary constructor call +- [`KT-15435`](https://youtrack.jetbrains.com/issue/KT-15435) Call to 'synchronize' crashes JS backend +- [`KT-15513`](https://youtrack.jetbrains.com/issue/KT-15513) JS: empty do..while loop crashes compiler + +#### Various issues +- [`KT-4160`](https://youtrack.jetbrains.com/issue/KT-4160) JS: compiler produces wrong code for escaped variable names with characters which Illegal in JS (e.g. spaces) +- [`KT-7004`](https://youtrack.jetbrains.com/issue/KT-7004) JS: functions named `call` not inlined +- [`KT-7588`](https://youtrack.jetbrains.com/issue/KT-7588) JS: operators are not inlined +- [`KT-7733`](https://youtrack.jetbrains.com/issue/KT-7733) JS: Provide overflow behavior for integer arithmetic operations +- [`KT-8413`](https://youtrack.jetbrains.com/issue/KT-8413) JS: generated wrong code for some float constants +- [`KT-12598`](https://youtrack.jetbrains.com/issue/KT-12598) JS: comparisons for Enums always translates using strong operator +- [`KT-13523`](https://youtrack.jetbrains.com/issue/KT-13523) Augmented assignment with array access in LHS is translated incorrectly +- [`KT-13888`](https://youtrack.jetbrains.com/issue/KT-13888) JS: change how functions optional parameters get translated +- [`KT-15260`](https://youtrack.jetbrains.com/issue/KT-15260) JS: don't import module more than once +- [`KT-15475`](https://youtrack.jetbrains.com/issue/KT-15475) JS compiler deletes internal function name in js("") text block +- [`KT-15506`](https://youtrack.jetbrains.com/issue/KT-15506) JS: invalid evaluation order when passing arguments to function by name +- [`KT-15512`](https://youtrack.jetbrains.com/issue/KT-15512) JS: wrong result when use break/throw/return in || and && operators +- [`KT-15569`](https://youtrack.jetbrains.com/issue/KT-15569) js: Wrong code generated when calling an overloaded operator function on an inherited property + +### Standard Library +- [`KEEP-23`](https://github.com/Kotlin/KEEP/blob/master/proposals/stdlib/group-and-fold.md) Operation to group by key and fold each group simultaneously +- [`KT-15774`](https://youtrack.jetbrains.com/issue/KT-15774) `buildSequence` and `buildIterator` functions with `yield` and `yieldAll` based on coroutines +- [`KT-6903`](https://youtrack.jetbrains.com/issue/KT-6903) Add `also` extension, which is like `apply`, but with `it` instead of `this` inside lambda. +- [`KT-7858`](https://youtrack.jetbrains.com/issue/KT-7858) Add extension function `takeIf` to match a value against predicate and return null when it does not match +- [`KT-11851`](https://youtrack.jetbrains.com/issue/KT-11851) Provide extension `Map.getValue(key: K): V` which throws or returns default when key is not found +- [`KT-7417`](https://youtrack.jetbrains.com/issue/KT-7417) Add min, max on two numbers to standard library +- [`KT-13898`](https://youtrack.jetbrains.com/issue/KT-13898) Allow to implement `toArray` in collections as protected and provide protected toArray in AbstractCollection. +- [`KT-14935`](https://youtrack.jetbrains.com/issue/KT-14935) Array-like list instantiation functions: `List(count) { init }` and `MutableList(count) { init }` +- [`KT-15630`](https://youtrack.jetbrains.com/issue/KT-15630) Overloads of mutableListOf, mutableSetOf, mutableMapOf without parameters +- [`KT-15557`](https://youtrack.jetbrains.com/issue/KT-15557) Iterable.joinTo loses information about each element by calling toString on them by default +- [`KT-15477`](https://youtrack.jetbrains.com/issue/KT-15477) Introduce Throwable.addSuppressed extension +- [`KT-15310`](https://youtrack.jetbrains.com/issue/KT-15310) Add dynamic.unsafeCast +- [`KT-15436`](https://youtrack.jetbrains.com/issue/KT-15436) JS stdlib: org.w3c.fetch.RequestInit has 12 parameters, all required +- [`KT-15458`](https://youtrack.jetbrains.com/issue/KT-15458) Add print and println to common stdlib + +### IDE +- Project View: Fix presentation of Kotlin files and their members when @JvmName having the same name as the file itself + +#### no-arg / all-open +- [`KT-15419`](https://youtrack.jetbrains.com/issue/KT-15419) IDE build doesn't pick settings of all-open plugin +- [`KT-15686`](https://youtrack.jetbrains.com/issue/KT-15686) IDE build doesn't pick settings of no-arg plugin +- [`KT-15735`](https://youtrack.jetbrains.com/issue/KT-15735) Facet loses compiler plugin settings on reopening project, when "Use project settings" = Yes + +#### Formatter +- [`KT-15542`](https://youtrack.jetbrains.com/issue/KT-15542) Formatter doesn't handle spaces around 'by' keyword +- [`KT-15544`](https://youtrack.jetbrains.com/issue/KT-15544) Formatter doesn't remove spaces around function reference operator + +#### Intention actions, inspections and quick-fixes + +##### New features +- Implement quickfix which enables/disables coroutine support in module or project +- [`KT-5045`](https://youtrack.jetbrains.com/issue/KT-5045) Intention to convert between two comparisons and range check and vice versa +- [`KT-5629`](https://youtrack.jetbrains.com/issue/KT-5629) Quick-fix to import extension method when arguments of non-extension method do not match +- [`KT-6217`](https://youtrack.jetbrains.com/issue/KT-6217) Add warning for unused equals expression +- [`KT-6824`](https://youtrack.jetbrains.com/issue/KT-6824) Quick-fix for applying spread operator where vararg is expected +- [`KT-8855`](https://youtrack.jetbrains.com/issue/KT-8855) Implement "Create label" quick-fix +- [`KT-15056`](https://youtrack.jetbrains.com/issue/KT-15056) Implement intention which converts object literal to class +- [`KT-15068`](https://youtrack.jetbrains.com/issue/KT-15068) Implement intention which rename file according to the top-level class name +- [`KT-15564`](https://youtrack.jetbrains.com/issue/KT-15564) Add quick-fix for changing primitive cast to primitive conversion method + +##### Bug fixes +- [`KT-14630`](https://youtrack.jetbrains.com/issue/KT-14630) Clearer diagnostic message for platform type inspection +- [`KT-14745`](https://youtrack.jetbrains.com/issue/KT-14745) KNPE in convert primary constructor to secondary +- [`KT-14889`](https://youtrack.jetbrains.com/issue/KT-14889) Replace 'if' with elvis operator produces red code if result is referenced in 'if' +- [`KT-14907`](https://youtrack.jetbrains.com/issue/KT-14907) Quick-fix for missing operator adds infix modifier to created function +- [`KT-15092`](https://youtrack.jetbrains.com/issue/KT-15092) Suppress inspection "use property access syntax" for some getters and fix completion for them +- [`KT-15227`](https://youtrack.jetbrains.com/issue/KT-15227) "Replace if with elvis" silently changes semantics +- [`KT-15412`](https://youtrack.jetbrains.com/issue/KT-15412) "Join declaration and assignment" can break code with smart casts +- [`KT-15501`](https://youtrack.jetbrains.com/issue/KT-15501) Intention "Add names to call arguments" shouldn't appear when the only argument is a trailing lambda + +#### Refactorings (Extract / Pull) +- [`KT-15611`](https://youtrack.jetbrains.com/issue/KT-15611) Extract Interface/Superclass: Disable const-properties +- Pull Up: Fix pull-up from object to superclass +- [`KT-15602`](https://youtrack.jetbrains.com/issue/KT-15602) Extract Interface/Superclass: Disable "Make abstract" for inline/external/lateinit members +- Extract Interface: Disable inline/external/lateinit members +- [`KT-12704`](https://youtrack.jetbrains.com/issue/KT-12704), [`KT-15583`](https://youtrack.jetbrains.com/issue/KT-15583) Override/Implement Members: Support all nullability annotations respected by the Kotlin compiler +- [`KT-15563`](https://youtrack.jetbrains.com/issue/KT-15563) Override Members: Allow overriding virtual synthetic members (e.g. equals(), hashCode(), toString(), etc.) in data classes +- [`KT-15355`](https://youtrack.jetbrains.com/issue/KT-15355) Extract Interface: Disable "Make abstract" and assume it to be true for abstract members of an interface +- [`KT-15353`](https://youtrack.jetbrains.com/issue/KT-15353) Extract Superclass/Interface: Allow extracting class with special name (and quotes) +- [`KT-15643`](https://youtrack.jetbrains.com/issue/KT-15643) Extract Interface/Pull Up: Disable "Make abstract" and assume it to be true for primary constructor parameter when moving to an interface +- [`KT-15607`](https://youtrack.jetbrains.com/issue/KT-15607) Extract Interface/Pull Up: Disable internal/protected members when moving to an interface +- [`KT-15640`](https://youtrack.jetbrains.com/issue/KT-15640) Extract Interface/Pull Up: Drop 'final' modifier when moving to an interface +- [`KT-15639`](https://youtrack.jetbrains.com/issue/KT-15639) Extract Superclass/Interface/Pull Up: Add spaces between 'abstract' modifier and annotations +- [`KT-15606`](https://youtrack.jetbrains.com/issue/KT-15606) Extract Interface/Pull Up: Warn about private members with usages in the original class +- [`KT-15635`](https://youtrack.jetbrains.com/issue/KT-15635) Extract Superclass/Interface: Fix bogus visibility warning inside a member when it's being moved as abstract +- [`KT-15598`](https://youtrack.jetbrains.com/issue/KT-15598) Extract Interface: Red-highlight members inherited from a super-interface when that interface reference itself is not extracted +- [`KT-15674`](https://youtrack.jetbrains.com/issue/KT-15674) Extract Superclass: Drop inapplicable modifiers when converting property-parameter to ordinary parameter + +#### Multi-platform project support +- [`KT-14908`](https://youtrack.jetbrains.com/issue/KT-14908) Actions (quick-fixes) to create implementations of header elements +- [`KT-15305`](https://youtrack.jetbrains.com/issue/KT-15305) Do not report UNUSED for header declarations with implementations and vice versa +- [`KT-15601`](https://youtrack.jetbrains.com/issue/KT-15601) Cannot suppress HEADER_WITHOUT_IMPLEMENTATION +- [`KT-15641`](https://youtrack.jetbrains.com/issue/KT-15641) Quick-fix "Create header interface implementation" does nothing + +#### Android support + +- [`KT-12884`](https://youtrack.jetbrains.com/issue/KT-12884) Android Extensions: Refactor / Rename of activity name does not change import extension statement +- [`KT-14308`](https://youtrack.jetbrains.com/issue/KT-14308) Android Studio randomly hangs due to Java static member import quick-fix lags +- [`KT-14358`](https://youtrack.jetbrains.com/issue/KT-14358) Kotlin extensions: rename layout file: Throwable: "PSI and index do not match" through KotlinFullClassNameIndex.get() +- [`KT-15483`](https://youtrack.jetbrains.com/issue/KT-15483) Kotlin lint throws unexpected exceptions in IDE + +#### Various issues +- [`KT-12872`](https://youtrack.jetbrains.com/issue/KT-12872) Don't show "defined in " in quick doc for local variables +- [`KT-13001`](https://youtrack.jetbrains.com/issue/KT-13001) "Go to Type Declaration" is broken for stdlib types +- [`KT-13067`](https://youtrack.jetbrains.com/issue/KT-13067) Syntax colouring doesn't work for KDoc tags +- [`KT-14815`](https://youtrack.jetbrains.com/issue/KT-14815) alt + enter -> "import" over a constructor reference is not working +- [`KT-14819`](https://youtrack.jetbrains.com/issue/KT-14819) Quick documentation for special Enum functions doesn't work +- [`KT-15141`](https://youtrack.jetbrains.com/issue/KT-15141) Bogus import popup for when function call cannot be resolved fully +- [`KT-15154`](https://youtrack.jetbrains.com/issue/KT-15154) IllegalStateException on attempt to convert import statement to * if last added import is to typealias +- [`KT-15329`](https://youtrack.jetbrains.com/issue/KT-15329) Regex not inspected properly for javaJavaIdentifierStart and javaJavaIdentifierPart +- [`KT-15383`](https://youtrack.jetbrains.com/issue/KT-15383) Kotlin Scripts can only resolve stdlib functions/classes if they are in a source directory +- [`KT-15440`](https://youtrack.jetbrains.com/issue/KT-15440) Improve extensions detection in IDEA +- [`KT-15548`](https://youtrack.jetbrains.com/issue/KT-15548) Kotlin plugin: @Language injections specified in another module are ignored +- Invoke `StorageComponentContainerContributor` extension for module dependencies container as well (needed for "sam-with-receiver" plugin to work with scripts) + +### J2K +- [`KT-6790`](https://youtrack.jetbrains.com/issue/KT-6790) J2K: Static import of Map.Entry is lost during conversion +- [`KT-14736`](https://youtrack.jetbrains.com/issue/KT-14736) J2K: Incorrect conversion of back ticks in javadoc {@code} tag +- [`KT-15027`](https://youtrack.jetbrains.com/issue/KT-15027) J2K: Annotations are set on functions, but not on property accessors + +### Gradle support + +- [`KT-15376`](https://youtrack.jetbrains.com/issue/KT-15376) Kotlin incremental=true: fixed compatibility with AS 2.3 +- [`KT-15433`](https://youtrack.jetbrains.com/issue/KT-15433) Kotlin daemon swallows exceptions: fixed stack trace reporting +- [`KT-15682`](https://youtrack.jetbrains.com/issue/KT-15682) Uncheck "Use project settings" option on import Kotlin project from gradle + + +## 1.1-M04 (EAP-4) + +### Language related changes + +- [`KT-4481`](https://youtrack.jetbrains.com/issue/KT-4481) compareTo on primitive floats/doubles should behave naturally +- [`KT-11016`](https://youtrack.jetbrains.com/issue/KT-11016) Allow to annotate internal API to be used inside public inline functions +- [`KT-11128`](https://youtrack.jetbrains.com/issue/KT-11128) Member vs SAM conversion with more specific signature +- [`KT-12215`](https://youtrack.jetbrains.com/issue/KT-12215) Allowing to access protected members in public inline members creates potential binary compatibility problem +- [`KT-12531`](https://youtrack.jetbrains.com/issue/KT-12531) Report error when delegated member hides a supertype member +- [`KT-14650`](https://youtrack.jetbrains.com/issue/KT-14650) mod function on integral types is inconsistent with BigInteger.mod +- [`KT-14651`](https://youtrack.jetbrains.com/issue/KT-14651) Floating point comparisons shall operate according to IEEE754 +- [`KT-14852`](https://youtrack.jetbrains.com/issue/KT-14852) It should not be possible to use typealias that abbreviates a generic projection as a constructor +- [`KT-15226`](https://youtrack.jetbrains.com/issue/KT-15226) Restrict delegation to java 8 default methods + +### Reflection + +- [`KT-12250`](https://youtrack.jetbrains.com/issue/KT-12250) Provide API for getting a single annotation by its class +- [`KT-14939`](https://youtrack.jetbrains.com/issue/KT-14939) VerifyError in accessors for bound property reference with receiver 'null' + +### Compiler + +#### Coroutines + +- Major coroutines redesign - see [`KEEP`](https://github.com/Kotlin/kotlin-coroutines/blob/master/kotlin-coroutines-informal.md) for details + +#### Optimizations + +- [`KT-11734`](https://youtrack.jetbrains.com/issue/KT-11734) Optimize const vals by inlining them at call site +- [`KT-13570`](https://youtrack.jetbrains.com/issue/KT-13570) Generate TABLE/LOOKUPSWITCH if all when branches are const integer values +- [`KT-14746`](https://youtrack.jetbrains.com/issue/KT-14746) Captured Refs should not be volatile + +#### Various issues + +- [`KT-10982`](https://youtrack.jetbrains.com/issue/KT-10982) java.util.Map::compute* poor usability +- [`KT-12144`](https://youtrack.jetbrains.com/issue/KT-12144) Type inference incorporation error on SAM adapter call +- [`KT-14196`](https://youtrack.jetbrains.com/issue/KT-14196) Do not allow class literal with expression in annotation arguments +- [`KT-14453`](https://youtrack.jetbrains.com/issue/KT-14453) Regression: Type inference failed: inferred type is T but T was expected +- [`KT-14774`](https://youtrack.jetbrains.com/issue/KT-14774) Incorrect inner class modifier generated for sealed inner classes +- [`KT-14839`](https://youtrack.jetbrains.com/issue/KT-14839) CompilationException when calling inline fun with first arg of 2 (w/defaults) within catch block of Java exception type +- [`KT-14855`](https://youtrack.jetbrains.com/issue/KT-14855) Projection in type aliases should be allowed in supertypes and constructor invocations if they expand to non-toplevel projections +- [`KT-14887`](https://youtrack.jetbrains.com/issue/KT-14887) Unhelpful error "public-API inline function cannot access non-public-API" for unresolved call inside inline function +- [`KT-14930`](https://youtrack.jetbrains.com/issue/KT-14930) Android: creating Kotlin activity: UOE at EmptyList.removeAll() +- [`KT-15146`](https://youtrack.jetbrains.com/issue/KT-15146) Kapt3 no source files on unittest +- [`KT-15272`](https://youtrack.jetbrains.com/issue/KT-15272) Exception when building 2 projects at the same time + +### JavaScript backend + +#### dynamic type + +- [`KT-8207`](https://youtrack.jetbrains.com/issue/KT-8207) Extension function on dynamic resolves on any type +- [`KT-6579`](https://youtrack.jetbrains.com/issue/KT-6579) JS: prohibit to use `in` and `!in` on dynamic +- [`KT-6580`](https://youtrack.jetbrains.com/issue/KT-6580) JS: prohibit to use more than one argument in indexed access on dynamic +- [`KT-13615`](https://youtrack.jetbrains.com/issue/KT-13615) JS: don't generate guard for catch with dynamic type + +#### @native/external + +- [`KT-13893`](https://youtrack.jetbrains.com/issue/KT-13893) JS: Replace @native annotation with external modifier +- [`KT-12877`](https://youtrack.jetbrains.com/issue/KT-12877) Allow to specify module for native JS declarations +- [`KT-14806`](https://youtrack.jetbrains.com/issue/KT-14806) JS: name of a local variable clashes with native declaration from global scope + +#### Diagnostics + +- [`KT-13889`](https://youtrack.jetbrains.com/issue/KT-13889) JS: prohibit overriding native functions with default values assigned to parameters +- [`KT-13894`](https://youtrack.jetbrains.com/issue/KT-13894) JS: prohibit native declaration inside non-native +- [`KT-13895`](https://youtrack.jetbrains.com/issue/KT-13895) JS: RUNTIME annotations +- [`KT-13896`](https://youtrack.jetbrains.com/issue/KT-13896) JS: prohibit external(native) extension functions and properties +- [`KT-13897`](https://youtrack.jetbrains.com/issue/KT-13897) JS: prohibit native(external) files and typealiases +- [`KT-13910`](https://youtrack.jetbrains.com/issue/KT-13910) JS: prohibit override members of native declaration with overloads +- [`KT-14027`](https://youtrack.jetbrains.com/issue/KT-14027) JS: prohibit native inner classes +- [`KT-14029`](https://youtrack.jetbrains.com/issue/KT-14029) JS: prohibit private members inside native declarations +- [`KT-14037`](https://youtrack.jetbrains.com/issue/KT-14037) JS: prohibit using native interfaces in RHS of IS +- [`KT-14038`](https://youtrack.jetbrains.com/issue/KT-14038) JS: warn when using native interface in RHS of AS +- [`KT-15130`](https://youtrack.jetbrains.com/issue/KT-15130) JS: prohibit inheritance native from non-native +- [`KT-12600`](https://youtrack.jetbrains.com/issue/KT-12600) JS: type check with a native interface compiles but crash at runtime +- [`KT-13307`](https://youtrack.jetbrains.com/issue/KT-13307) KotlinJS cannot cast to a marker interface. + +#### Language features support + +- [`KT-13573`](https://youtrack.jetbrains.com/issue/KT-13573) JS: support bound callable reference +- [`KT-14634`](https://youtrack.jetbrains.com/issue/KT-14634) JS: support enumValues / enumValueOf +- [`KT-15058`](https://youtrack.jetbrains.com/issue/KT-15058) JS: replace suspend function convention + +#### Issues related to kotlin.Any + +- [`KT-7664`](https://youtrack.jetbrains.com/issue/KT-7664) JS: "x is Any" is always false +- [`KT-7665`](https://youtrack.jetbrains.com/issue/KT-7665) JS: creating Any instance crashes on runtime +- [`KT-15131`](https://youtrack.jetbrains.com/issue/KT-15131) JS: don't mangle Any.equals + +#### Various issues + +- [`KT-14033`](https://youtrack.jetbrains.com/issue/KT-14033) JS: don't optimize (based on type information) by default expressions with any of "as, is, !is, as?, ?., !!" +- [`KT-13616`](https://youtrack.jetbrains.com/issue/KT-13616) JS: don't omit guard for catch with Throwable type +- [`KT-12976`](https://youtrack.jetbrains.com/issue/KT-12976) JS: human-friendly error message on wrong modules order +- [`KT-15212`](https://youtrack.jetbrains.com/issue/KT-15212) JS: link unqualified names in `js(...)` function to local functions in outer Kotlin function by name +- [`KT-14750`](https://youtrack.jetbrains.com/issue/KT-14750) JS: remove unnecessary functions from kotlin.js + +#### Bugfixes + +- [`KT-12566`](https://youtrack.jetbrains.com/issue/KT-12566) JS: inner local class should refer to captured variables via its outer class +- [`KT-12527`](https://youtrack.jetbrains.com/issue/KT-12527) Reified is-check works wrongly for chained calls +- [`KT-12586`](https://youtrack.jetbrains.com/issue/KT-12586) JS: compiler crashes when call inline function inside string templeate +- [`KT-13164`](https://youtrack.jetbrains.com/issue/KT-13164) Ecma TypeError on extending local class from inner one +- [`KT-14888`](https://youtrack.jetbrains.com/issue/KT-14888) JS: Compiler error: Cannot get FQ name of local class: lazy class +- [`KT-14748`](https://youtrack.jetbrains.com/issue/KT-14748) JS: eliminate unused functions +- [`KT-14999`](https://youtrack.jetbrains.com/issue/KT-14999) JS: Operator set + labeled lambdas +- [`KT-15007`](https://youtrack.jetbrains.com/issue/KT-15007) JS: Dies when checking if exception implements interface. TypeError: Cannot read property 'baseClasses' of undefined +- [`KT-15073`](https://youtrack.jetbrains.com/issue/KT-15073) KT to JS losing extension function's receiver +- [`KT-15169`](https://youtrack.jetbrains.com/issue/KT-15169) JS: compiler fails on annotated expression with TRE at Translation.doTranslateExpression() +- [`KT-13522`](https://youtrack.jetbrains.com/issue/KT-13522) JS: can't use captured reified type paramter in jsClass +- [`KT-13784`](https://youtrack.jetbrains.com/issue/KT-13784) JS: lambda was not inlined for function with reified parameter declared in another module +- [`KT-13792`](https://youtrack.jetbrains.com/issue/KT-13792) JS: inner class of local class does not capture enclosing class properly +- [`KT-15327`](https://youtrack.jetbrains.com/issue/KT-15327) JS: Enum `valueOf` should throw IllegalArgumentException + +### Standard library + +- [`KT-7930`](https://youtrack.jetbrains.com/issue/KT-7930) Make String.toInt(), toLong(), etc. nullable instead of throwing exception +- [`KT-8220`](https://youtrack.jetbrains.com/issue/KT-8220) Add #peek method to Sequence similar to Stream.peek +- [`KT-8286`](https://youtrack.jetbrains.com/issue/KT-8286) Int.toString and String.toInt with base as parameter +- [`KT-14034`](https://youtrack.jetbrains.com/issue/KT-14034) JS: unsafeCast function +- [`KT-15181`](https://youtrack.jetbrains.com/issue/KT-15181) Some source files are missing from published sources on Bintray + +### IDE + +- [`KT-15205`](https://youtrack.jetbrains.com/issue/KT-15205) Implement quick-fix for increasing module language level to enable unsupported language features + +###### Issues fixed +- [`KT-14693`](https://youtrack.jetbrains.com/issue/KT-14693) Introduce Type Alias: Do not suggest type qualifiers +- [`KT-14696`](https://youtrack.jetbrains.com/issue/KT-14696) Introduce Type Alias: Fix NPE during dialog repaint +- [`KT-14685`](https://youtrack.jetbrains.com/issue/KT-14685) Introduce Type Alias: Replace type usages in constructor calls +- [`KT-14861`](https://youtrack.jetbrains.com/issue/KT-14861) Introduce Type Alias: Support callable references/class literals +- [`KT-15204`](https://youtrack.jetbrains.com/issue/KT-15204) Implement navigation from header to its implementation and vice versa +- [`KT-15269`](https://youtrack.jetbrains.com/issue/KT-15269) Quickfix for external (native) extension declarations +- [`KT-15293`](https://youtrack.jetbrains.com/issue/KT-15293) Add 1.1 EAP repository when creating a new Gradle project with 1.1 EAP + +### Scripting + +- [`KT-14538`](https://youtrack.jetbrains.com/issue/KT-14538) Kotlin gradle script files appear totally unresolved +- [`KT-14706`](https://youtrack.jetbrains.com/issue/KT-14706) Support package declaration in scripting +- [`KT-14707`](https://youtrack.jetbrains.com/issue/KT-14707) Support javax.script.Invocable on the JSR 223 ScriptEngine +- [`KT-14708`](https://youtrack.jetbrains.com/issue/KT-14708) kotlin-script-runtime is not published +- [`KT-14713`](https://youtrack.jetbrains.com/issue/KT-14713) Make it possible to use JSR 223 support without specifying compiler JAR absolute path +- [`KT-15064`](https://youtrack.jetbrains.com/issue/KT-15064) Gradle build with script .kts file: NPE at ScriptCodegen.genConstructor() + +### Gradle support + +- [`KT-15080`](https://youtrack.jetbrains.com/issue/KT-15080) Gradle build fails with Gradle 3.2 (master) +- [`KT-15120`](https://youtrack.jetbrains.com/issue/KT-15120) Gradle JS test compile task doesn't pick up production code +- [`KT-15127`](https://youtrack.jetbrains.com/issue/KT-15127) JS "compiler jar not found" with Gradle 3.2 +- [`KT-15133`](https://youtrack.jetbrains.com/issue/KT-15133) Recent gradle-script-kotlin 3.3 distributions are unusable +- [`KT-15218`](https://youtrack.jetbrains.com/issue/KT-15218) Isolate Gradle Kotlin compiler process + + +## 1.1-M03 (EAP-3) + +### New language features + +- [`KT-2964`](https://youtrack.jetbrains.com/issue/KT-2964) Underscores in integer literals + (see [KEEP](https://github.com/Kotlin/KEEP/blob/master/proposals/underscores-in-numeric-literals.md)) +- [`KT-3824`](https://youtrack.jetbrains.com/issue/KT-3824) Underscore in lambda for unused parameters + (see [KEEP](https://github.com/Kotlin/KEEP/blob/master/proposals/underscore-for-unused-parameters.md)) +- [`KT-2783`](https://youtrack.jetbrains.com/issue/KT-2783) Allow to skip some components in a multi-declaration + (see the same [KEEP](https://github.com/Kotlin/KEEP/blob/master/proposals/underscore-for-unused-parameters.md)) +- [`KT-11551`](https://youtrack.jetbrains.com/issue/KT-11551) limited scope for dsl writers + (see [KEEP](https://github.com/Kotlin/KEEP/blob/master/proposals/scope-control-for-implicit-receivers.md)) + +### Compiler + +#### Coroutines related issues +- Make fields for storing lambda parameters non-final (as they get assigned within `invoke` call) +- [`KT-14719`](https://youtrack.jetbrains.com/issue/KT-14719) Make initial continuation able to be resumed with exception +- [`KT-14636`](https://youtrack.jetbrains.com/issue/KT-14636) Coroutine fields should not be volatile +- [`KT-14718`](https://youtrack.jetbrains.com/issue/KT-14718) Validate label value of coroutine in case of no suspension points + +#### Typealises related issues +- [`KT-13514`](https://youtrack.jetbrains.com/issue/KT-13514) Type inference doesn't work with generic typealiases +- [`KT-13837`](https://youtrack.jetbrains.com/issue/KT-13837) Error "Type alias expands to T, which is not a class, an interface, or an object" + should also appear for local type aliases +- [`KT-14307`](https://youtrack.jetbrains.com/issue/KT-14307) Local recursive type alias should be an error +- [`KT-14400`](https://youtrack.jetbrains.com/issue/KT-14400) Compiler Error IllegalStateException: kotlin.NotImplementedError when anonymous + object inherits from typealias +- [`KT-14377`](https://youtrack.jetbrains.com/issue/KT-14377) Expected error: Modifier 'companion' is not applicable to 'typealias' +- [`KT-14498`](https://youtrack.jetbrains.com/issue/KT-14498) typealias allows to circumvent variance annotations +- [`KT-14641`](https://youtrack.jetbrains.com/issue/KT-14641) An exception while processing a nested type alias access after a dot + +#### Various issues +- [`KT-550`](https://youtrack.jetbrains.com/issue/KT-550) Properties without initializer but with get must infer type from getter +- [`KT-8816`](https://youtrack.jetbrains.com/issue/KT-8816) Generate Kotlin parameter names in the same form as expected for Java 8 reflection +- [`KT-10569`](https://youtrack.jetbrains.com/issue/KT-10569) Cannot iterate over values of an enum class when it is used as a generic parameter + (see [KEEP](https://github.com/Kotlin/KEEP/blob/master/proposals/generic-values-and-valueof-for-enums.md)) +- [`KT-13557`](https://youtrack.jetbrains.com/issue/KT-13557) VerifyError with delegated local variable used in object expression +- [`KT-13890`](https://youtrack.jetbrains.com/issue/KT-13890) IllegalAccessError when invoking protected method with default arguments +- [`KT-14012`](https://youtrack.jetbrains.com/issue/KT-14012) Back-end (JVM) Internal error every first compilation after the source code change +- [`KT-14201`](https://youtrack.jetbrains.com/issue/KT-14201) UnsupportedOperationException: Don't know how to generate outer expression for anonymous + object with invoke and non-trivial closure +- [`KT-14318`](https://youtrack.jetbrains.com/issue/KT-14318) Repeated annotations resulting from type alias expansion should be reported +- [`KT-14347`](https://youtrack.jetbrains.com/issue/KT-14347) Report UNUSED_PARAMETER/VARIABLE on named unused lambda parameters/destructuring entries +- [`KT-14352`](https://youtrack.jetbrains.com/issue/KT-14352) @SinceKotlin is not taken into account for companion object member referenced via + type alias +- [`KT-14357`](https://youtrack.jetbrains.com/issue/KT-14357) Try-catch used in false condition generates CompilationException +- [`KT-14502`](https://youtrack.jetbrains.com/issue/KT-14502) Prohibit irrelevant modifiers and annotations on destructured parameters in lambda +- [`KT-14692`](https://youtrack.jetbrains.com/issue/KT-14692) Change resolution scope for componentX in lambda parameters +- [`KT-14824`](https://youtrack.jetbrains.com/issue/KT-14824) Back-end (JVM) Internal error: Couldn't inline method call 'get' into local final fun + StorageComponentContainer.(): kotlin.Unit +- [`KT-14798`](https://youtrack.jetbrains.com/issue/KT-14798) Gradle 3.2 AssertionError: Built-in class kotlin.ParameterName is not found + +### JS + +#### Feature support +- [`KT-6985`](https://youtrack.jetbrains.com/issue/KT-6985) Support Exceptions in JS +- [`KT-13574`](https://youtrack.jetbrains.com/issue/KT-13574) JS: support coroutines +- [`KT-14422`](https://youtrack.jetbrains.com/issue/KT-14422) JS: Support destructuring in lambda parameters +- [`KT-14507`](https://youtrack.jetbrains.com/issue/KT-14507) JS: allow to skip some components in a multi-declaration + +#### Library updates +- [`KT-14637`](https://youtrack.jetbrains.com/issue/KT-14637) JS: Missing ArrayList.ensureCapacity + +#### Other issues +- [`KT-2328`](https://youtrack.jetbrains.com/issue/KT-2328) js: kotlin exceptions must inherit Error +- [`KT-5537`](https://youtrack.jetbrains.com/issue/KT-5537) Drop Cloneable in JS +- [`KT-7014`](https://youtrack.jetbrains.com/issue/KT-7014) JS: generate code which more friendly to js tools (minifier, optimizer, linter etc) +- [`KT-8019`](https://youtrack.jetbrains.com/issue/KT-8019) JS: no stackTrace in exception subclasses +- [`KT-10911`](https://youtrack.jetbrains.com/issue/KT-10911) JS: Throwable properties aren't supported well +- [`KT-13912`](https://youtrack.jetbrains.com/issue/KT-13912) JS: Compiler NPE at JsSourceGenerationVisitor. Lambda with empty [if] block passed + to inline function +- [`KT-14535`](https://youtrack.jetbrains.com/issue/KT-14535) JS: Broken modification of captured variables defined by a destructuring declaration + +### Standard Library +- [`KT-2084`](https://youtrack.jetbrains.com/issue/KT-2084) Common API should be available without referring to java.* packages + + Now those common types, which are supported on all platforms, are available in `kotlin.*` packages, and are imported by default. These include: + - `ArrayList`, `HashSet`, `LinkedHashSet`, `HashMap`, `LinkedHashMap` in `kotlin.collections` + - `Appendable` and `StringBuilder` in `kotlin.text` + - `Comparator` in `kotlin.comparisons` + On JVM these are just typealiases of the good old types from `java.util` and `java.lang` +- [`KT-13554`](https://youtrack.jetbrains.com/issue/KT-13554) Introduce bitwise operations `and`/`or`/`xor`/`inv` for Byte and Short +- [`KT-13582`](https://youtrack.jetbrains.com/issue/KT-13582) New platform-agnostic extensions for arrays: `contentEquals` to compare arrays' + content for equality, `contentHashCode` to get hashcode of array's content, and `contentToString` to get the string representation of array elements. +- [`KT-14510`](https://youtrack.jetbrains.com/issue/KT-14510) Generic constraints of `Array.flatten` signature were relaxed a bit to make it just usable. +- [`KT-14789`](https://youtrack.jetbrains.com/issue/KT-14789) Provide `KotlinVersion` class, which allows to get the current version of the standard + library and compare it with some other `KotlinVersion` value. + +### IDE +- [`KT-14409`](https://youtrack.jetbrains.com/issue/KT-14409) Incorrect "Variable can be declared immutable" inspection for local delegated variable +- [`KT-14431`](https://youtrack.jetbrains.com/issue/KT-14431) Create quick-fix on UNUSED_PARAMETER/VARIABLE when it can be replaced with one underscore +- [`KT-14794`](https://youtrack.jetbrains.com/issue/KT-14794) Add /Specify type/Remove explicit type intentions for property with getters if type + can be inferred +- [`KT-14752`](https://youtrack.jetbrains.com/issue/KT-14752) Exception while typing @JsName annotation in editor + +## 1.1-M02 (EAP-2) + +### Language features + ++ **Destructuring for lambdas** ([proposal](https://github.com/Kotlin/KEEP/issues/32)) + + Current limitations: + + - Nested destructuring is not supported + - Destructuring in named functions/constructors is not supported + - Is not supported for JS target + +### Compiler + +#### Smart cast enhancements +- [`KT-2127`](https://youtrack.jetbrains.com/issue/KT-2127) Smart cast receiver to not null after a not null safe call +- [`KT-6840`](https://youtrack.jetbrains.com/issue/KT-6840) Make data flow information the same for assigned and assignee +- [`KT-13426`](https://youtrack.jetbrains.com/issue/KT-13426) Fix exception when smartcast on both dispatch & extension receiver + +#### Bound references related issues +- [`KT-12995`](https://youtrack.jetbrains.com/issue/KT-12995) Do not skip generation of the left-hand side for intrinsic bound references and class literals +- [`KT-13075`](https://youtrack.jetbrains.com/issue/KT-13075) Fix codegen for bound class reference +- [`KT-13110`](https://youtrack.jetbrains.com/issue/KT-13110) Fix type mismatch error on class literal with integer receiver expression +- [`KT-13172`](https://youtrack.jetbrains.com/issue/KT-13172) Report error on "this::class" in super constructor call +- [`KT-13271`](https://youtrack.jetbrains.com/issue/KT-13271) Fix incorrect unsupported error on synthetic extension call on LHS of :: +- [`KT-13367`](https://youtrack.jetbrains.com/issue/KT-13367) Inline bound callable reference if it's used only as a lambda + +#### Coroutines related issues +- [`KT-13156`](https://youtrack.jetbrains.com/issue/KT-13156) Do not execute last Unit-typed coroutine statement twice +- [`KT-13246`](https://youtrack.jetbrains.com/issue/KT-13246) Fix VerifyError with coroutines on Dalvik +- [`KT-13289`](https://youtrack.jetbrains.com/issue/KT-13289) Fix VerifyError with coroutines: Bad type on operand stack +- [`KT-13409`](https://youtrack.jetbrains.com/issue/KT-13409) Fix generic variable spilling with coroutines +- [`KT-13531`](https://youtrack.jetbrains.com/issue/KT-13531) Fix ClassCastException when coercion to Unit interacts with generic await() and coroutines +- Prohibit `Continuation<*>` as a last parameter of suspend functions +- [`KT-13560`](https://youtrack.jetbrains.com/issue/KT-13560) Prohibit non-Unit suspend functions + +#### Typealises related issues +- [`KT-13200`](https://youtrack.jetbrains.com/issue/KT-13200) Fix incorrect number of required type arguments reported on typealias +- [`KT-13181`](https://youtrack.jetbrains.com/issue/KT-13181) Fix unresolved reference for a type alias from a different module +- [`KT-13161`](https://youtrack.jetbrains.com/issue/KT-13161) Support java static methods calls with typealiases +- [`KT-13835`](https://youtrack.jetbrains.com/issue/KT-13835) Do not lose nullability information while expanding type alias in projection position +- [`KT-13422`](https://youtrack.jetbrains.com/issue/KT-13422) Prohibit usage of type alias to exception class as an object in 'throw' expression +- [`KT-13735`](https://youtrack.jetbrains.com/issue/KT-13735) Fix NoSuchMethodError for generic typealias access +- [`KT-13513`](https://youtrack.jetbrains.com/issue/KT-13513) Support SAM constructors for aliased java functional types +- [`KT-13822`](https://youtrack.jetbrains.com/issue/KT-13822) Fix exception for start-projection of a type alias +- [`KT-14071`](https://youtrack.jetbrains.com/issue/KT-14071) Prohibit using type alias as a qualifier for super +- [`KT-14282`](https://youtrack.jetbrains.com/issue/KT-14282) Report error on unused type alias with -language-version 1.0 +- [`KT-14274`](https://youtrack.jetbrains.com/issue/KT-14274) Fix type alias resolution when it's used for supertype constructor call + +#### JDK dependent built-in classes related issues +- [`KT-13209`](https://youtrack.jetbrains.com/issue/KT-13209) Change first parameter's type of Map.getOrDefault to K instead of Any +- [`KT-13069`](https://youtrack.jetbrains.com/issue/KT-13069) Do not emit invalid DefaultImpls delegation when interface extends MutableMap with JDK8 + +#### `data` classes and inheritance +- [`KT-11306`](https://youtrack.jetbrains.com/issue/KT-11306) Allow data classes to implement equals/hashCode/toString from base classes + +#### Various JVM code generation issues +- [`KT-13182`](https://youtrack.jetbrains.com/issue/KT-13182) Fix compiler internal error at inline +- [`KT-13757`](https://youtrack.jetbrains.com/issue/KT-13757) Prohibit referencing nested classes by name with $ +- [`KT-12985`](https://youtrack.jetbrains.com/issue/KT-12985) Do not create range instances for 'for' loop in CharSequence.indices +- [`KT-13931`](https://youtrack.jetbrains.com/issue/KT-13931) Optimize generated code for IntRange#contains + +#### Various analysis & diagnostic issues +- [`KT-435`](https://youtrack.jetbrains.com/issue/KT-435) Use parameter names in error messages when calling a function-valued expression +- [`KT-10001`](https://youtrack.jetbrains.com/issue/KT-10001) Fix false unnecessary non-null assertion on a pair element +- [`KT-12811`](https://youtrack.jetbrains.com/issue/KT-12811) Treat function declaration as final if it is a member of a final class +- [`KT-13961`](https://youtrack.jetbrains.com/issue/KT-13961) Report REDECLARATION on private-in-file 'foo' vs public 'foo' in different file + +### JS + +#### Feature support +- [`KT-13544`](https://youtrack.jetbrains.com/issue/KT-13544) Support type aliases in JS +- [`KT-13345`](https://youtrack.jetbrains.com/issue/KT-13345) Support class literals in JS + +#### Library updates +- [`KT-18`](https://youtrack.jetbrains.com/issue/KT-18) Move exceptions from `java.lang` to `kotlin` package +- [`KT-12386`](https://youtrack.jetbrains.com/issue/KT-12386) Rewrite JS collections in Kotlin, move them to `kotlin.collections` package +- [`KT-7809`](https://youtrack.jetbrains.com/issue/KT-7809) Make Collection implementations conform to their declared interfaces +- [`KT-7473`](https://youtrack.jetbrains.com/issue/KT-7473) Make AbstractCollection.equals check object type +- [`KT-13429`](https://youtrack.jetbrains.com/issue/KT-13429) Make 'remove' on fresh iterator throw exception instead of removing last element +- [`KT-13459`](https://youtrack.jetbrains.com/issue/KT-13459) Make JS implementation of ArrayList::add(index, element) check the index is in valid range +- [`KT-8724`](https://youtrack.jetbrains.com/issue/KT-8724) Fix MutableIterator.remove() for HashMap +- [`KT-10786`](https://youtrack.jetbrains.com/issue/KT-10786) Make Map.keys return view of map keys instead of snapshot +- [`KT-14194`](https://youtrack.jetbrains.com/issue/KT-14194) Make HashMap.putAll implementation not to call getKey/getValue + +### Standard Library + +#### Backward compatibility +- [`KT-14297`](https://youtrack.jetbrains.com/issue/KT-14297) Add @SinceKotlin annotation to support compatibility with compilation against older standard library +- [`KT-14213`](https://youtrack.jetbrains.com/issue/KT-14213) Ensure printStackTrace can be called with -language-version 1.0 + +#### Enhancements +- [`KEEP-53`](https://github.com/Kotlin/KEEP/blob/master/proposals/stdlib/abstract-collections.md) Provide two distinct hierarchies of abstract collections: one for implementing read-only/immutable collections, and other for implementing mutable collections +- [`KEEP-13`](https://github.com/Kotlin/KEEP/blob/master/proposals/stdlib/map-copying.md) Provide extension functions to copy maps +- [`KT-18`](https://youtrack.jetbrains.com/issue/KT-18) Introduce type aliases for common exceptions from `java.lang` in `kotlin` package +- [`KT-12762`](https://youtrack.jetbrains.com/issue/KT-12762) Make `kotlin.ranges.until` return an empty range for "illegal" 'to' parameter +- [`KT-12894`](https://youtrack.jetbrains.com/issue/KT-12894) Allow nullable receiver for `use` extension + +### Reflection + +#### New features +- [`KT-8998`](https://youtrack.jetbrains.com/issue/KT-8998) Introduce comprehensive API to work with KType instances +- [`KT-10447`](https://youtrack.jetbrains.com/issue/KT-10447) Provide a way to check if a KClass is a data class +- [`KT-11284`](https://youtrack.jetbrains.com/issue/KT-11284) Add KClass.cast extension +- [`KT-13106`](https://youtrack.jetbrains.com/issue/KT-13106) Support annotation constructors in reflection + +#### Optimizations +- [`KT-10651`](https://youtrack.jetbrains.com/issue/KT-10651) Optimize KClass.simpleName + +### IDE + +###### New features +- [`KT-12903`](https://youtrack.jetbrains.com/issue/KT-12903) Implement "Inline type alias" refactoring +- [`KT-12902`](https://youtrack.jetbrains.com/issue/KT-12902) Implement "Introduce type alias" refactoring +- [`KT-12904`](https://youtrack.jetbrains.com/issue/KT-12904) Implement "Create type alias from usage" quick fix +- [`KT-9016`](https://youtrack.jetbrains.com/issue/KT-9016) Make use of named higher order function parameters +- [`KT-12205`](https://youtrack.jetbrains.com/issue/KT-12205) Suggest import of Kotlin static members in editor with Java source +- [`KT-13941`](https://youtrack.jetbrains.com/issue/KT-13941) Implement intention for introducing destructured lambda parameters when it's possible +- [`KT-13943`](https://youtrack.jetbrains.com/issue/KT-13943) Implement inspection and quickfix for to detect a manual destructuring of for / lambda parameter + +###### Issues fixed +- [`KT-13004`](https://youtrack.jetbrains.com/issue/KT-13004) Support bound method references in completion +- [`KT-13242`](https://youtrack.jetbrains.com/issue/KT-13242) Suggest 'typealias' keyword in completion +- [`KT-13244`](https://youtrack.jetbrains.com/issue/KT-13244) Override/Implement Members: Do not expand type aliases in the generated members +- [`KT-13611`](https://youtrack.jetbrains.com/issue/KT-13611) Go to Class: Fix presentation of type aliases +- [`KT-13759`](https://youtrack.jetbrains.com/issue/KT-13759) Rename: Process object-wrapping alias references +- [`KT-13955`](https://youtrack.jetbrains.com/issue/KT-13955) Find Usages: Add special type for usages inside of type aliases +- [`KT-13479`](https://youtrack.jetbrains.com/issue/KT-13479) Support navigation to type aliases from binaries +- [`KT-13766`](https://youtrack.jetbrains.com/issue/KT-13766) Fix optimize imports not to add wrong and unnecessary import because of type alias +- [`KT-12949`](https://youtrack.jetbrains.com/issue/KT-12949) Consider type aliases as candidates for import +- [`KT-13266`](https://youtrack.jetbrains.com/issue/KT-13266) Suggest non-imported type aliases in completion +- [`KT-13689`](https://youtrack.jetbrains.com/issue/KT-13689) Do not treat type alias constructor usage as original type usage for optimize imports + +### Scripting + +- A new library `kotlin-script-util` containing utilities for implementing kotlin script support +- [`KT-7880`](https://youtrack.jetbrains.com/issue/KT-7880) Experimental support for JSR 223 Scripting API +- [`KT-13975`](https://youtrack.jetbrains.com/issue/KT-13975), [`KT-14264`](https://youtrack.jetbrains.com/issue/KT-14264) Convert error on retrieving gradle plugin settings to warning +- Implement support for custom template-based scripts in command-line compiler, maven and gradle plugins + +## 1.1-M01 (EAP-1) + +### Language features + ++ **Coroutines (async/await, generators)** ([proposal](https://github.com/Kotlin/kotlin-coroutines)) + + Current limitations: + + - for some cases type inference is not supported yet + - limited IDE support + - allowed only one `handleResult` function: [design](https://github.com/Kotlin/kotlin-coroutines/blob/master/kotlin-coroutines-informal.md#result-handlers) + - handling `finally` blocks is not supported: [issue](https://github.com/Kotlin/kotlin-coroutines/issues/1) + ++ **Bound callable references** ([proposal](https://github.com/Kotlin/KEEP/issues/5)) + ++ **Type aliases** ([proposal](https://github.com/Kotlin/KEEP/issues/4)) + + Current limitations: + - type alias constructors for inner classes are not supported yet + - annotations on type alias are not supported yet + - limited IDE support + ++ **Local delegated properties** ([proposal](https://github.com/Kotlin/KEEP/issues/25)) + ++ **JDK dependent built-in classes** ([proposal](https://github.com/Kotlin/KEEP/issues/30)) + ++ **Sealed class inheritors in the same file** ([proposal](https://github.com/Kotlin/KEEP/issues/29)) ++ **Allow base classes for data classes** ([proposal](https://github.com/Kotlin/KEEP/issues/31)) + + +### Scripting + +- Implement support for [Script Definition Template](https://github.com/Kotlin/KEEP/blob/da9f3ec5f78429e7560bfc284cb7f52e02282b1f/proposals/script-definition-template.md) +and related functionality, except the following parts: + - automatic script templates discovery is not implemented + - `@file:ScriptTemplate` annotation is not supported + - the parameters `javaHome` and `scripts` from `KotlinScriptExternalDependencies` are not used yet +- Implement support for custom template-based scripts in IDEA: resolving, completion and navigation to symbols from script classpath and sources +- Implement GradleScriptTemplatesProvider extension that supplies a script template if gradle with +[kotlin script support](https://github.com/gradle/gradle-script-kotlin) is used in the project + + +### Compiler + +###### Issues fixed +- [`KT-4779`](https://youtrack.jetbrains.com/issue/KT-4779) Generate default methods for implementations in interfaces +- [`KT-11780`](https://youtrack.jetbrains.com/issue/KT-11780) Fixed incorrect "No cast needed" warning +- [`KT-12156`](https://youtrack.jetbrains.com/issue/KT-12156) Fixed incorrect error on `inline` modifier inside final class +- [`KT-12358`](https://youtrack.jetbrains.com/issue/KT-12358) Report missing error "Abstract member not implemented" when a fake method of 'Any' is inherited from an interface +- [`KT-6206`](https://youtrack.jetbrains.com/issue/KT-6206) Generate equals/hashCode/toString in data class always unless it'll cause a JVM signature clash error +- [`KT-8990`](https://youtrack.jetbrains.com/issue/KT-8990) Fixed incorrect error "virtual member hidden" for a private method of an inner class +- [`KT-12429`](https://youtrack.jetbrains.com/issue/KT-12429) Fixed visibility checks for annotation usage on top-level declarations +- [`KT-5068`](https://youtrack.jetbrains.com/issue/KT-5068) Introduced a special diagnostic message for "type mismatch" errors such as `fun f(): Int = { 1 }`. + +### Standard Library + +- [`KT-8254`](https://youtrack.jetbrains.com/issue/KT-8254) Provide standard library supplement artifacts for using with JDK 7 and 8. +These artifacts include extensions for the types available in the latter JDKs, such as `AutoCloseable.use` ([`KT-5899`](https://youtrack.jetbrains.com/issue/KT-5899)) or `Stream.toList`. +- [`KT-12753`](https://youtrack.jetbrains.com/issue/KT-12753) Provide an access to named group matches of `Regex` match result (for JDK 8 only). +- Add `assertFails` overload with message to kotlin-test. + + +### IDE + +###### New features + ++ [`KT-12019`](https://youtrack.jetbrains.com/issue/KT-12019) Introduce "redundant `if`" inspection + +###### Issues fixed + ++ [`KT-12389`](https://youtrack.jetbrains.com/issue/KT-12389) Do not exit from REPL when toString() of user class throws an exception ++ [`KT-12129`](https://youtrack.jetbrains.com/issue/KT-12129) Fixed link on api reference page in KDoc diff --git a/ChangeLog-1.2.X.md b/ChangeLog-1.2.X.md new file mode 100644 index 00000000000..ab8471e075a --- /dev/null +++ b/ChangeLog-1.2.X.md @@ -0,0 +1,2042 @@ +# Changelog 1.2.X + +## 1.2.71 + +### Compiler + +- [`KT-26806`](https://youtrack.jetbrains.com/issue/KT-26806) Defining constants using kotlin.math is broken in 1.2.70 + +### IDE + +- [`KT-26399`](https://youtrack.jetbrains.com/issue/KT-26399) Kotlin Migration: NPE at KotlinMigrationProjectComponent$onImportFinished$1.run() +- [`KT-26794`](https://youtrack.jetbrains.com/issue/KT-26794) Bad version detection during migration in Android Studio 3.2 +- [`KT-26823`](https://youtrack.jetbrains.com/issue/KT-26823) Fix deadlock in databinding with AndroidX which led to Android Studio hanging +- [`KT-26889`](https://youtrack.jetbrains.com/issue/KT-26889) Don't show migration dialog if no actual migrations are available +- [`KT-25177`](https://youtrack.jetbrains.com/issue/KT-25177) Report asDynamic on dynamic type as a warning +- [`KT-25454`](https://youtrack.jetbrains.com/issue/KT-25454) Extract function: make default visibility private + +### JavaScript + +- [`KT-26466`](https://youtrack.jetbrains.com/issue/KT-26466) Uncaught ReferenceError: println is not defined + +### Tools. Gradle + +- [`KT-26208`](https://youtrack.jetbrains.com/issue/KT-26208) inspectClassesForKotlinIC slows down continuous mode in Gradle + +### Libraries + +- [`KT-26929`](https://youtrack.jetbrains.com/issue/KT-26929) Kotlin Reflect and Proguard: can’t find referenced class kotlin.annotations.jvm.ReadOnly/Mutable + +## 1.2.70 + +### Compiler + +- [`KT-13860`](https://youtrack.jetbrains.com/issue/KT-13860) Avoid creating KtImportDirective PSI elements for default imports in LazyImportScope +- [`KT-22201`](https://youtrack.jetbrains.com/issue/KT-22201) Generate nullability annotations for data class toString and equals methods. +- [`KT-23870`](https://youtrack.jetbrains.com/issue/KT-23870) SAM adapter method returns null-values for "genericParameterTypes" +- [`KT-24597`](https://youtrack.jetbrains.com/issue/KT-24597) IDE doesn't report missing constructor on inheritance of an expected class in common module +- [`KT-25120`](https://youtrack.jetbrains.com/issue/KT-25120) RequireKotlin on nested class and its members is not loaded correctly +- [`KT-25193`](https://youtrack.jetbrains.com/issue/KT-25193) Names of parameters from Java interface methods implemented by delegation are lost +- [`KT-25405`](https://youtrack.jetbrains.com/issue/KT-25405) Mismatching descriptor type parameters on inner types +- [`KT-25604`](https://youtrack.jetbrains.com/issue/KT-25604) Disable callable references to exprerimental suspend functions +- [`KT-25665`](https://youtrack.jetbrains.com/issue/KT-25665) Add a warning for annotations which target non-existent accessors +- [`KT-25894`](https://youtrack.jetbrains.com/issue/KT-25894) Do not generate body for functions from Any in light class builder mode +- [`KT-20772`](https://youtrack.jetbrains.com/issue/KT-20772) Incorrect smart cast on enum members +- [`KT-24657`](https://youtrack.jetbrains.com/issue/KT-24657) Compiler performance issues with big files +- [`KT-25745`](https://youtrack.jetbrains.com/issue/KT-25745) Do not report warning about annotations on non-existing accessors for JvmStatic properties +- [`KT-25746`](https://youtrack.jetbrains.com/issue/KT-25746) Improve message for warning about annotations that have target to non-existing accessors +- [`KT-25810`](https://youtrack.jetbrains.com/issue/KT-25810) New Inference: Overload resolution ambiguity on method 'provideDelegate(Nothing?, KProperty<*>)' when there's more than one `provideDelegate` operator in scope +- [`KT-25973`](https://youtrack.jetbrains.com/issue/KT-25973) Report metadata version mismatch upon discovering a .kotlin_module file in the dependencies with an incompatible metadata version +- [`KT-22281`](https://youtrack.jetbrains.com/issue/KT-22281) JVM: Incorrect comparison of Double and Float when types are derived from smart-casts +- [`KT-22649`](https://youtrack.jetbrains.com/issue/KT-22649) Compiler: wrong code generated / Couldn't transform method node - using inline extension property inside lambda + +### IDE + +- [`KT-18301`](https://youtrack.jetbrains.com/issue/KT-18301) kotlin needs crazy amount of memory +- [`KT-23668`](https://youtrack.jetbrains.com/issue/KT-23668) Methods with internal visibility have different mangling names in IDE and in compiler +- [`KT-24892`](https://youtrack.jetbrains.com/issue/KT-24892) please remove usages of com.intellij.util.containers.ConcurrentFactoryMap#ConcurrentFactoryMap deprecated long ago +- [`KT-25144`](https://youtrack.jetbrains.com/issue/KT-25144) Quick fix “Change signature” changes class of argument when applied for descendant classes with enabled -Xnew-inference option +- [`KT-25356`](https://youtrack.jetbrains.com/issue/KT-25356) Update Gradle Kotlin-DSL icon according to new IDEA 2018.2 icons style +- [`KT-20056`](https://youtrack.jetbrains.com/issue/KT-20056) TCE on creating object of an anonymous class in Kotlin script +- [`KT-25092`](https://youtrack.jetbrains.com/issue/KT-25092) SourcePsi should be physical leaf element but got OPERATION_REFERENCE +- [`KT-25249`](https://youtrack.jetbrains.com/issue/KT-25249) Uast operates "Unit" type instead of "void" +- [`KT-25255`](https://youtrack.jetbrains.com/issue/KT-25255) Preferences | Languages & Frameworks | Kotlin Updates: show currently installed version +- [`KT-25297`](https://youtrack.jetbrains.com/issue/KT-25297) Inconsistency in `KotlinULambdaExpression` and `KotlinLocalFunctionULambdaExpression` +- [`KT-25515`](https://youtrack.jetbrains.com/issue/KT-25515) Add/remove analysis-related compiler setting does not update IDE project model immediately +- [`KT-25524`](https://youtrack.jetbrains.com/issue/KT-25524) UAST: proper resolve for function variable call +- [`KT-25640`](https://youtrack.jetbrains.com/issue/KT-25640) "Configure Kotlin" action changes values of language and API version in project settings + +### IDE. Debugger + +- [`KT-25147`](https://youtrack.jetbrains.com/issue/KT-25147) Conditional breakpoints doesn't work in `common` code of MPP +- [`KT-25152`](https://youtrack.jetbrains.com/issue/KT-25152) MPP debug doesn't navigate to `common` code if there are same named files in `common` and `platform` parts + +### IDE. Gradle + +- [`KT-22732`](https://youtrack.jetbrains.com/issue/KT-22732) TestNG runner is always used for TestNG tests even when Use Gradle runner is selected +- [`KT-25913`](https://youtrack.jetbrains.com/issue/KT-25913) Honor 'store generated project files externally option' for Kotlin facets imported from Gradle +- [`KT-25955`](https://youtrack.jetbrains.com/issue/KT-25955) Support expect/actual in new MPP imported into IDEA + +### IDE. Inspections and Intentions + +#### New Features + +- [`KT-6633`](https://youtrack.jetbrains.com/issue/KT-6633) Inspection to detect unnecessary "with" calls +- [`KT-25146`](https://youtrack.jetbrains.com/issue/KT-25146) Add quick-fix for default parameter value removal +- [`KT-7675`](https://youtrack.jetbrains.com/issue/KT-7675) Create inspection to replace if with let +- [`KT-13515`](https://youtrack.jetbrains.com/issue/KT-13515) Add intention to replace '?.let' with null check +- [`KT-13854`](https://youtrack.jetbrains.com/issue/KT-13854) Need intention actions: to convert property with getter to initializer +- [`KT-15476`](https://youtrack.jetbrains.com/issue/KT-15476) Inspection to convert non-lazy chains of collection functions into sequences +- [`KT-22068`](https://youtrack.jetbrains.com/issue/KT-22068) Force usage of “it” in .forEach{} calls +- [`KT-23445`](https://youtrack.jetbrains.com/issue/KT-23445) Inspection and quickfix to replace `assertTrue(a == b)` with `assertEquals(a, b)` +- [`KT-25270`](https://youtrack.jetbrains.com/issue/KT-25270) "return@foo" outside of lambda should have quickfix to remove "@foo" label + +#### Fixes + +- [`KT-11154`](https://youtrack.jetbrains.com/issue/KT-11154) Spell checking inspection is not suppressable +- [`KT-18681`](https://youtrack.jetbrains.com/issue/KT-18681) "Replace 'if' with 'when'" generates unnecessary else block +- [`KT-24001`](https://youtrack.jetbrains.com/issue/KT-24001) "Suspicious combination of == and ===" false positive +- [`KT-24385`](https://youtrack.jetbrains.com/issue/KT-24385) Convert lambda to reference refactor produces red code with companion object +- [`KT-24694`](https://youtrack.jetbrains.com/issue/KT-24694) Move lambda out of parentheses should not be applied for multiple functional parameters +- [`KT-25089`](https://youtrack.jetbrains.com/issue/KT-25089) False-positive "Call chain on collection type can be simplified" for `map` and `joinToString` on a `HashMap` +- [`KT-25169`](https://youtrack.jetbrains.com/issue/KT-25169) Impossible to suppress UAST/JVM inspections +- [`KT-25321`](https://youtrack.jetbrains.com/issue/KT-25321) Safe delete of a class property implementing constructor parameter at the platform side doesn't remove all the related declarations +- [`KT-25539`](https://youtrack.jetbrains.com/issue/KT-25539) `Make class open` quick fix doesn't update all the related implementations of a multiplatform class +- [`KT-25608`](https://youtrack.jetbrains.com/issue/KT-25608) Confusing "Redundant override" inspection message +- [`KT-16422`](https://youtrack.jetbrains.com/issue/KT-16422) Replace lambda with method reference inspections fails +- [`KT-21999`](https://youtrack.jetbrains.com/issue/KT-21999) Convert lambda to reference adds this with incorrect label +- [`KT-23467`](https://youtrack.jetbrains.com/issue/KT-23467) False positive `suspicious callable reference` on scoping function called on another lambda +- [`KT-25044`](https://youtrack.jetbrains.com/issue/KT-25044) "Implement member" quick-fix should not generate 'actual' modifier with expect declaration in interface only +- [`KT-25579`](https://youtrack.jetbrains.com/issue/KT-25579) Redundant semicolon erroneously reported during local var modifier ambiguity +- [`KT-25633`](https://youtrack.jetbrains.com/issue/KT-25633) “Add kotlin-XXX.jar to the classpath” quick fix adds dependency with invalid version in Gradle-based projects +- [`KT-25739`](https://youtrack.jetbrains.com/issue/KT-25739) "Convert to run" / "Convert to with" intentions incorrectly process references to Java static members +- [`KT-25928`](https://youtrack.jetbrains.com/issue/KT-25928) "Let extend" quick fix is suggested in case of nullable/non-null TYPE_MISMATCH collision +- [`KT-26042`](https://youtrack.jetbrains.com/issue/KT-26042) False positive "Remove redundant '.let' call" for lambda with destructured arguments + +### IDE. KDoc + +- [`KT-22815`](https://youtrack.jetbrains.com/issue/KT-22815) Update quick documentation +- [`KT-22648`](https://youtrack.jetbrains.com/issue/KT-22648) Quick Doc popup: break (long?) declarations into several lines + +### IDE. Libraries + +- [`KT-25129`](https://youtrack.jetbrains.com/issue/KT-25129) Idea freezes when Kotlin plugin tries to determine if jar is js lib in jvm module + +### IDE. Navigation + +- [`KT-25317`](https://youtrack.jetbrains.com/issue/KT-25317) `Go to actual declaration` keyboard shortcut doesn't work for `expect object`, showing "No implementations found" message +- [`KT-25492`](https://youtrack.jetbrains.com/issue/KT-25492) Find usages: keep `Expected functions` option state while searching for usages of a regular function +- [`KT-25498`](https://youtrack.jetbrains.com/issue/KT-25498) `Find Usages` doesn't show `Supertype` usages of `actual` declarations with constructor + +### IDE. Project View + +- [`KT-22823`](https://youtrack.jetbrains.com/issue/KT-22823) Text pasted into package is parsed as Kotlin before Java + +### IDE. Refactorings + +- [`KT-22072`](https://youtrack.jetbrains.com/issue/KT-22072) "Convert MutableMap.put to assignment" should not be applicable when put is used as expression +- [`KT-23590`](https://youtrack.jetbrains.com/issue/KT-23590) Incorrect conflict warning "Internal function will not be accessible" when moving class from jvm to common module +- [`KT-23594`](https://youtrack.jetbrains.com/issue/KT-23594) Incorrect conflict warning about IllegalStateException when moving class from jvm to common module +- [`KT-23772`](https://youtrack.jetbrains.com/issue/KT-23772) MPP: Refactor / Rename class does not update name of file containing related expect/actual class +- [`KT-23914`](https://youtrack.jetbrains.com/issue/KT-23914) Safe search false positives during moves between common and actual modules +- [`KT-25326`](https://youtrack.jetbrains.com/issue/KT-25326) Refactor/Safe Delete doesn't report `actual object` usages +- [`KT-25438`](https://youtrack.jetbrains.com/issue/KT-25438) Refactor/Safe delete of a multiplatform companion object: usage is not reported +- [`KT-25857`](https://youtrack.jetbrains.com/issue/KT-25857) Refactoring → Move moves whole file in case of moving class from Kotlin script +- [`KT-25858`](https://youtrack.jetbrains.com/issue/KT-25858) Refactoring → Move can be called only for class declarations in Kotlin script + +### IDE. Script + +- [`KT-25814`](https://youtrack.jetbrains.com/issue/KT-25814) IDE scripting console -> kotlin (JSR-223) - compilation errors - unresolved IDEA classes +- [`KT-25822`](https://youtrack.jetbrains.com/issue/KT-25822) jvmTarget from the script compiler options is ignored in the IDE + +### IDE. Multiplatform + +- [`KT-23368`](https://youtrack.jetbrains.com/issue/KT-23368) IDE: Build: JPS errors are reported for valid non-multiplatform module depending on multiplatform one + +### IDE. Ultimate + +- [`KT-25595`](https://youtrack.jetbrains.com/issue/KT-25595) Rename Kotlin-specific "Protractor" run configuration to distinguish it from the one provided by NodeJS plugin +- [`KT-19309`](https://youtrack.jetbrains.com/issue/KT-19309) Spring JPA Repository IntelliJ tooling with Kotlin + +### IDE. Tests Support + +- [`KT-26228`](https://youtrack.jetbrains.com/issue/KT-26228) NoClassDefFoundError: org/jetbrains/kotlin/idea/run/KotlinTestNgConfigurationProducer on running a JUnit test with TestNG plugin disabled + +### Reflection + +- [`KT-25541`](https://youtrack.jetbrains.com/issue/KT-25541) Incorrect parameter names in reflection for inner class constructor from Java class compiled with "-parameters" + +### Tools. CLI + +- [`KT-21910`](https://youtrack.jetbrains.com/issue/KT-21910) Add `-Xfriend-paths` compiler argument to support internal visibility checks in production/test sources from external build systems +- [`KT-25554`](https://youtrack.jetbrains.com/issue/KT-25554) Do not report warnings when `-XXLanguage` was used to turn on deprecation +- [`KT-25196`](https://youtrack.jetbrains.com/issue/KT-25196) Optional expected annotation is visible in platforms where it doesn't have actual + +### Tools. JPS + +- [`KT-25540`](https://youtrack.jetbrains.com/issue/KT-25540) JPS JS IC does not recompile usages from other modules when package is different + +### Tools. kapt + +- [`KT-25396`](https://youtrack.jetbrains.com/issue/KT-25396) KAPT Error: Unknown option: infoAsWarnings +- [`KT-26211`](https://youtrack.jetbrains.com/issue/KT-26211) Kotlin plugin 1.2.60+ breaks IDEA source/resource/test roots in a Maven project with Kapt + +### Tools. Gradle + +- [`KT-25025`](https://youtrack.jetbrains.com/issue/KT-25025) Inter-project IC for JS in Gradle +- [`KT-25455`](https://youtrack.jetbrains.com/issue/KT-25455) Gradle IC: when class signature is changed its indirect subclasses in different module are not recompiled + +### Tools. JPS + +- [`KT-25998`](https://youtrack.jetbrains.com/issue/KT-25998) Build process starts compiling w/o any changes (on release version) +- [`KT-25977`](https://youtrack.jetbrains.com/issue/KT-25977) Can not run a Kotlin test +- [`KT-26072`](https://youtrack.jetbrains.com/issue/KT-26072) MPP compilation issue +- [`KT-26113`](https://youtrack.jetbrains.com/issue/KT-26113) Build takes around 20 seconds in already fully built IDEA project + +### Tools. Scripts + +- [`KT-26142`](https://youtrack.jetbrains.com/issue/KT-26142) update maven-central remote repository url + +### Tools. Incremental Compile + +- [`KT-26528`](https://youtrack.jetbrains.com/issue/KT-26528) ISE “To save disabled cache status [delete] should be called (this behavior is kept for compatibility)” on compiling project with enabled IC in Maven + +### JavaScript + +- [`KT-22053`](https://youtrack.jetbrains.com/issue/KT-22053) JS: Secondary constructor of Throwable inheritor doesn't call to primary one +- [`KT-26064`](https://youtrack.jetbrains.com/issue/KT-26064) JS inliner calls wrong constructor in incremental build +- [`KT-26117`](https://youtrack.jetbrains.com/issue/KT-26117) JS runtime error: ArrayList_init instead of ArrayList_init_0 + +### Libraries + +- [`KT-18067`](https://youtrack.jetbrains.com/issue/KT-18067) KotlinJS - String.compareTo(other: String, ignoreCase: Boolean = false): Int +- [`KT-19507`](https://youtrack.jetbrains.com/issue/KT-19507) Using @JvmName from stdlib-common fails to compile in JS module. +- [`KT-19508`](https://youtrack.jetbrains.com/issue/KT-19508) Add @JsName to stdlib-common for controlling JS implementation +- [`KT-24478`](https://youtrack.jetbrains.com/issue/KT-24478) Annotate relevant standard library annotations with @OptionalExpectation +- [`KT-25980`](https://youtrack.jetbrains.com/issue/KT-25980) JvmSynthetic annotation has no description in the docs + +## 1.2.60 + +### Compiler + +- [`KT-13762`](https://youtrack.jetbrains.com/issue/KT-13762) Prohibit annotations with target 'EXPRESSION' and retention 'BINARY' or 'RUNTIME' +- [`KT-18882`](https://youtrack.jetbrains.com/issue/KT-18882) Allow code to have platform specific annotations when compiled for different platforms +- [`KT-20356`](https://youtrack.jetbrains.com/issue/KT-20356) Internal compiler error - This method shouldn't be invoked for INVISIBLE_FAKE visibility +- [`KT-22517`](https://youtrack.jetbrains.com/issue/KT-22517) Deprecate smartcasts for local delegated properties +- [`KT-23153`](https://youtrack.jetbrains.com/issue/KT-23153) Compiler allows to set non constant value as annotation parameter +- [`KT-23413`](https://youtrack.jetbrains.com/issue/KT-23413) IndexOutOfBoundsException on local delegated properties from `provideDelegate` if there's at least one non-local delegated property +- [`KT-23742`](https://youtrack.jetbrains.com/issue/KT-23742) Optimise inline class redundant boxing on return from inlined lambda +- [`KT-24513`](https://youtrack.jetbrains.com/issue/KT-24513) High memory usage in Kotlin and 2018.1 +- [`KT-24617`](https://youtrack.jetbrains.com/issue/KT-24617) Optional expected annotation is unresolved in a dependent platform module +- [`KT-24679`](https://youtrack.jetbrains.com/issue/KT-24679) KotlinUCallExpression doesn't resolve callee if it is an inline method +- [`KT-24808`](https://youtrack.jetbrains.com/issue/KT-24808) NI: nested `withContext` call is reported with `Suspension functions can be called only within coroutine body` error +- [`KT-24825`](https://youtrack.jetbrains.com/issue/KT-24825) NoClassDefFoundError on SAM adapter in a nested call in inlined lambda since 1.2.40 +- [`KT-24859`](https://youtrack.jetbrains.com/issue/KT-24859) Disallow calls of functions annotated with receiver annotated with @RestrictsSuspension in foreign suspension context +- [`KT-24911`](https://youtrack.jetbrains.com/issue/KT-24911) Kotlin 1.2.50: UI for @RecentlyNonNull looks strange in the editor +- [`KT-25333`](https://youtrack.jetbrains.com/issue/KT-25333) Restrict visibility of Java static members from supertypes of companion object + +### IDE + +#### Performance Improvements + +- [`KT-20924`](https://youtrack.jetbrains.com/issue/KT-20924) Slow KtLightAbstractAnnotation.getClsDelegate() lightAnnotations.kt +- [`KT-23844`](https://youtrack.jetbrains.com/issue/KT-23844) Kotlin property accessor searcher consumes CPU when invoked on a scope consisting only of Java files + +#### Fixes + +- [`KT-4311`](https://youtrack.jetbrains.com/issue/KT-4311) "Override members" works wrong when function is extension +- [`KT-13948`](https://youtrack.jetbrains.com/issue/KT-13948) IDE plugins: improve description +- [`KT-15300`](https://youtrack.jetbrains.com/issue/KT-15300) "INFO - project.TargetPlatformDetector - Using default platform" flood in log +- [`KT-17350`](https://youtrack.jetbrains.com/issue/KT-17350) Implement members from interface fails when one of the generic types is unresolved +- [`KT-17668`](https://youtrack.jetbrains.com/issue/KT-17668) Edit Configuration dialog doesn't have a button for choosing the "Main class" field +- [`KT-19102`](https://youtrack.jetbrains.com/issue/KT-19102) Wrong equals() and hashCode() code generated for arrays of arrays +- [`KT-20056`](https://youtrack.jetbrains.com/issue/KT-20056) TCE on creating object of an anonymous class in Kotlin script +- [`KT-21863`](https://youtrack.jetbrains.com/issue/KT-21863) Imported typealias to object declared as "Unused import directive" when only referring to methods +- [`KT-23272`](https://youtrack.jetbrains.com/issue/KT-23272) Git commit not working +- [`KT-23407`](https://youtrack.jetbrains.com/issue/KT-23407) Pasting callable reference from different package suggests imports, but inserts incompilable FQN +- [`KT-23456`](https://youtrack.jetbrains.com/issue/KT-23456) UAST: Enum constant constructor call arguments missing from Kotlin enums +- [`KT-23942`](https://youtrack.jetbrains.com/issue/KT-23942) Fix building light-classes for MPP project containing multi-file facades +- [`KT-24072`](https://youtrack.jetbrains.com/issue/KT-24072) Kotlin SDK appears as many times as there are modules in the project +- [`KT-24412`](https://youtrack.jetbrains.com/issue/KT-24412) Kotlin create project wizard: Kotlin/JS no SDK +- [`KT-24933`](https://youtrack.jetbrains.com/issue/KT-24933) please remove usages of com.intellij.psi.search.searches.DirectClassInheritorsSearch#search(com.intellij.psi.PsiClass, com.intellij.psi.search.SearchScope, boolean, boolean) deprecated long ago +- [`KT-24943`](https://youtrack.jetbrains.com/issue/KT-24943) Project leak via LibraryEffectiveKindProviderImpl +- [`KT-24979`](https://youtrack.jetbrains.com/issue/KT-24979) IndexNotReadyException in KtLightClassForSourceDeclaration#isInheritor +- [`KT-24958`](https://youtrack.jetbrains.com/issue/KT-24958) Escaping goes insane when editing interpolated string in injected fragment editor +- [`KT-25024`](https://youtrack.jetbrains.com/issue/KT-25024) Wrong resolve scope while resolving java.lang.String PsiClassReferenceType +- [`KT-25092`](https://youtrack.jetbrains.com/issue/KT-25092) SourcePsi should be physical leaf element but got OPERATION_REFERENCE +- [`KT-25242`](https://youtrack.jetbrains.com/issue/KT-25242) 'Resolved to error element' highlighting is confusingly similar to an active live template +- [`KT-25249`](https://youtrack.jetbrains.com/issue/KT-25249) Uast operates "Unit" type instead of "void" +- [`KT-25255`](https://youtrack.jetbrains.com/issue/KT-25255) Preferences | Languages & Frameworks | Kotlin Updates: show currently installed version +- [`KT-25297`](https://youtrack.jetbrains.com/issue/KT-25297) Inconsistency in `KotlinULambdaExpression` and `KotlinLocalFunctionULambdaExpression` +- [`KT-25414`](https://youtrack.jetbrains.com/issue/KT-25414) Support checking eap-1.3 channel for updates +- [`KT-25524`](https://youtrack.jetbrains.com/issue/KT-25524) UAST: proper resolve for function variable call +- [`KT-25546`](https://youtrack.jetbrains.com/issue/KT-25546) Create popup in 1.2.x plugin if user upgrade version in gradle or maven to kotlin 1.3 + +### IDE. Android + +- [`KT-17946`](https://youtrack.jetbrains.com/issue/KT-17946) Android Studio: remove Gradle configurator on configuring Kotlin +- [`KT-23040`](https://youtrack.jetbrains.com/issue/KT-23040) Wrong run configuration classpath in a mixed Java/Android project +- [`KT-24321`](https://youtrack.jetbrains.com/issue/KT-24321) Actual implementations from Android platform module are wrongly reported with `no corresponding expected declaration` in IDE +- [`KT-25018`](https://youtrack.jetbrains.com/issue/KT-25018) Exception `Dependencies for org.jetbrains.kotlin.resolve.calls.* cannot be satisfied` on a simple project in AS 3.2 Canary + +### IDE. Code Style, Formatting + +- [`KT-14066`](https://youtrack.jetbrains.com/issue/KT-14066) Comments on when branches are misplaced +- [`KT-25008`](https://youtrack.jetbrains.com/issue/KT-25008) Formatter: Use single indent for multiline elvis operator + +### IDE. Completion + +- [`KT-23627`](https://youtrack.jetbrains.com/issue/KT-23627) Autocompletion inserts FQN of stdlib functions inside of scoping lambda called on explicit `this` +- [`KT-25239`](https://youtrack.jetbrains.com/issue/KT-25239) Add postfix template for listOf/setOf/etc + +### IDE. Debugger + +- [`KT-23162`](https://youtrack.jetbrains.com/issue/KT-23162) Evaluate expression in multiplatform common test fails with JvmName missing when run in JVM +- [`KT-24903`](https://youtrack.jetbrains.com/issue/KT-24903) Descriptors leak from `KotlinMethodSmartStepTarget` + +### IDE. Decompiler + +- [`KT-23981`](https://youtrack.jetbrains.com/issue/KT-23981) Kotlin bytecode decompiler works in AWT thread + +### IDE. Gradle + +- [`KT-24614`](https://youtrack.jetbrains.com/issue/KT-24614) Gradle can't get published versions until commenting repositories in settings.gradle + +### IDE. Gradle. Script + +- [`KT-24588`](https://youtrack.jetbrains.com/issue/KT-24588) Multiple Gradle Kotlin DSL script files dependencies lifecycle is flawed + +### IDE. Hints + +- [`KT-22432`](https://youtrack.jetbrains.com/issue/KT-22432) Type hints: Don't include ".Companion" in the names of types defined inside companion object +- [`KT-22653`](https://youtrack.jetbrains.com/issue/KT-22653) Lambda return hint is duplicated for increment/decrement expressions +- [`KT-24828`](https://youtrack.jetbrains.com/issue/KT-24828) Double return hints on labeled expressions + +### IDE. Inspections and Intentions + +#### New Features + +- [`KT-7710`](https://youtrack.jetbrains.com/issue/KT-7710) Intention to convert lambda to anonymous function +- [`KT-11850`](https://youtrack.jetbrains.com/issue/KT-11850) Add `nested lambdas with implicit parameters` warning +- [`KT-13688`](https://youtrack.jetbrains.com/issue/KT-13688) Add 'Change to val' quickfix for delegates without setValue +- [`KT-13782`](https://youtrack.jetbrains.com/issue/KT-13782) Intention (and may be inspection) to convert toString() call to string template +- [`KT-14779`](https://youtrack.jetbrains.com/issue/KT-14779) Inspection to replace String.format with string templates +- [`KT-15666`](https://youtrack.jetbrains.com/issue/KT-15666) Unused symbol: delete header & its implementations together +- [`KT-18810`](https://youtrack.jetbrains.com/issue/KT-18810) Quick-fix for 'is' absence in when +- [`KT-22871`](https://youtrack.jetbrains.com/issue/KT-22871) Add quickfix to move const val into companion object +- [`KT-23082`](https://youtrack.jetbrains.com/issue/KT-23082) Add quick-fix for type variance conflict +- [`KT-23306`](https://youtrack.jetbrains.com/issue/KT-23306) Add intention of putting remaining when-values even in end, and even if there is "else" +- [`KT-23897`](https://youtrack.jetbrains.com/issue/KT-23897) Inspections: report extension functions declared in same class +- [`KT-24295`](https://youtrack.jetbrains.com/issue/KT-24295) Add "Remove 'lateinit'" quickfix +- [`KT-24509`](https://youtrack.jetbrains.com/issue/KT-24509) Inspection "JUnit tests should return Unit" +- [`KT-24815`](https://youtrack.jetbrains.com/issue/KT-24815) Add Quick fix to remove illegal "const" modifier +- [`KT-25238`](https://youtrack.jetbrains.com/issue/KT-25238) Add quickfix wrapping expression into listOf/setOf/etc in case of type mismatch + +#### Fixes + +- [`KT-12298`](https://youtrack.jetbrains.com/issue/KT-12298) Fix override signature doesn't remove bogus reciever +- [`KT-20523`](https://youtrack.jetbrains.com/issue/KT-20523) Don't mark as unused functions with `@kotlin.test.*` annotations and classes with such members +- [`KT-20583`](https://youtrack.jetbrains.com/issue/KT-20583) Report "redundant let" even for `it` in argument position +- [`KT-21556`](https://youtrack.jetbrains.com/issue/KT-21556) "Call chain on collection type may be simplified" generates uncompiled code on IntArray +- [`KT-22030`](https://youtrack.jetbrains.com/issue/KT-22030) Invalid Function can be private inspection +- [`KT-22041`](https://youtrack.jetbrains.com/issue/KT-22041) "Convert lambda to reference" suggested incorrectly +- [`KT-22089`](https://youtrack.jetbrains.com/issue/KT-22089) Explict This inspection false negative with synthetic Java property +- [`KT-22094`](https://youtrack.jetbrains.com/issue/KT-22094) Can be private false positive with function called from lambda inside inline function +- [`KT-22162`](https://youtrack.jetbrains.com/issue/KT-22162) Add indices to loop fails on destructing declarator +- [`KT-22180`](https://youtrack.jetbrains.com/issue/KT-22180) "Can be private" false positive when function is called by inline function inside property initializer +- [`KT-22371`](https://youtrack.jetbrains.com/issue/KT-22371) "Create secondary constructor" quick fix is not suggested for supertype constructor reference +- [`KT-22758`](https://youtrack.jetbrains.com/issue/KT-22758) "Create ..." and "Import" quick fixes are not available on unresolved class name in primary constructor +- [`KT-23105`](https://youtrack.jetbrains.com/issue/KT-23105) Create actual implementation shouldn't generate default parameter values +- [`KT-23106`](https://youtrack.jetbrains.com/issue/KT-23106) Implement methods should respect actual modifier as well +- [`KT-23326`](https://youtrack.jetbrains.com/issue/KT-23326) "Add missing actual members" quick fix fails with AE at KtPsiFactory.createDeclaration() with _wrong_ expect code +- [`KT-23452`](https://youtrack.jetbrains.com/issue/KT-23452) "Remove unnecessary parentheses" reports parens of returned function +- [`KT-23686`](https://youtrack.jetbrains.com/issue/KT-23686) "Add missing actual members" should not add primary actual constructor if it's present as secondary one +- [`KT-23697`](https://youtrack.jetbrains.com/issue/KT-23697) Android project with 'org.jetbrains.kotlin.platform.android' plugin: all multiplatform IDE features are absent +- [`KT-23752`](https://youtrack.jetbrains.com/issue/KT-23752) False positive "Remove variable" quick fix on property has lambda or anonymous function initializer +- [`KT-23762`](https://youtrack.jetbrains.com/issue/KT-23762) Add missing actual members quick fix adds actual declaration for val/var again if it was in the primary constructor +- [`KT-23788`](https://youtrack.jetbrains.com/issue/KT-23788) Can't convert long char literal to string if it starts with backslash +- [`KT-23860`](https://youtrack.jetbrains.com/issue/KT-23860) Import quick fix is not available in class constructor containing transitive dependency parameters +- [`KT-24349`](https://youtrack.jetbrains.com/issue/KT-24349) False positive "Call on collection type may be reduced" +- [`KT-24374`](https://youtrack.jetbrains.com/issue/KT-24374) "Class member can have private visibility" inspection reports `expect` members +- [`KT-24422`](https://youtrack.jetbrains.com/issue/KT-24422) Android Studio erroneously reporting that `@Inject lateinit var` can be made private +- [`KT-24423`](https://youtrack.jetbrains.com/issue/KT-24423) False inspection warning "redundant type checks for object" +- [`KT-24425`](https://youtrack.jetbrains.com/issue/KT-24425) wrong hint remove redundant Companion +- [`KT-24537`](https://youtrack.jetbrains.com/issue/KT-24537) False positive `property can be private` on actual properties in a multiplatform project +- [`KT-24557`](https://youtrack.jetbrains.com/issue/KT-24557) False warning "Remove redundant call" for nullable.toString +- [`KT-24562`](https://youtrack.jetbrains.com/issue/KT-24562) actual extension function implementation warns Receiver type unused +- [`KT-24632`](https://youtrack.jetbrains.com/issue/KT-24632) Quick fix to add getter and setter shouldn't use `field` when it is not allowed +- [`KT-24816`](https://youtrack.jetbrains.com/issue/KT-24816) Inspection: Sealed subclass can be object shouldn't be reported on classes with state + +### IDE. JS + +- [`KT-5948`](https://youtrack.jetbrains.com/issue/KT-5948) JS: project shouldn't have "Java file" in new item menu + +### IDE. Multiplatform + +- [`KT-23722`](https://youtrack.jetbrains.com/issue/KT-23722) MPP: Run tests from common modules should recompile correspond JVM implementation module +- [`KT-24159`](https://youtrack.jetbrains.com/issue/KT-24159) MPP: Show Kotlin Bytecode does not work for common code +- [`KT-24839`](https://youtrack.jetbrains.com/issue/KT-24839) freeCompilerArgs are not imported into Kotlin facet of Android module in IDEA + +### IDE. Navigation + +- [`KT-11477`](https://youtrack.jetbrains.com/issue/KT-11477) Kotlin searchers consume CPU in a project without any Kotlin files +- [`KT-17512`](https://youtrack.jetbrains.com/issue/KT-17512) Finding usages of actual declarations in common modules +- [`KT-20825`](https://youtrack.jetbrains.com/issue/KT-20825) Header icon on actual class is lost on new line adding +- [`KT-21011`](https://youtrack.jetbrains.com/issue/KT-21011) Difference in information shown for "Is subclassed by" gutter on mouse hovering and clicking +- [`KT-21113`](https://youtrack.jetbrains.com/issue/KT-21113) Expected gutter icon on companion object is unstable +- [`KT-21710`](https://youtrack.jetbrains.com/issue/KT-21710) Override gutter markers are missing for types in sources jar +- [`KT-22177`](https://youtrack.jetbrains.com/issue/KT-22177) Double "A" icon for an expect class with constructor +- [`KT-23685`](https://youtrack.jetbrains.com/issue/KT-23685) Navigation from expect part to actual with ctrl+alt+B shortcut should provide a choice to what actual part to go +- [`KT-24812`](https://youtrack.jetbrains.com/issue/KT-24812) Search suggestion text overlaps for long names + +### IDE. Refactorings + +- [`KT-15159`](https://youtrack.jetbrains.com/issue/KT-15159) Introduce typealias: Incorrect applying of a typealias in constructor calls in val/var and AssertionError +- [`KT-15351`](https://youtrack.jetbrains.com/issue/KT-15351) Extract Superclass/Interface: existent target file name is rejected; TCE: "null cannot be cast to non-null type org.jetbrains.kotlin.psi.KtFile" at ExtractSuperRefactoring.createClass() +- [`KT-16281`](https://youtrack.jetbrains.com/issue/KT-16281) Extract Interface: private member with Make Abstract = Yes produces incompilable code +- [`KT-16284`](https://youtrack.jetbrains.com/issue/KT-16284) Extract Interface/Superclass: reference to private member turns incompilable, when referring element is made abstract +- [`KT-17235`](https://youtrack.jetbrains.com/issue/KT-17235) Introduce Parameter leaks listener if refactoring is cancelled while in progress +- [`KT-17742`](https://youtrack.jetbrains.com/issue/KT-17742) Refactor / Rename Java getter to `get()` does not update Kotlin references +- [`KT-18555`](https://youtrack.jetbrains.com/issue/KT-18555) Refactor / Extract Interface, Superclass: Throwable: "Refactorings should be invoked inside transaction" at RefactoringDialog.show() +- [`KT-18736`](https://youtrack.jetbrains.com/issue/KT-18736) Extract interface: import for property type is omitted +- [`KT-20260`](https://youtrack.jetbrains.com/issue/KT-20260) AE “Unexpected container” on calling Refactor → Move for class in Kotlin script +- [`KT-20465`](https://youtrack.jetbrains.com/issue/KT-20465) "Introduce variable" in build.gradle.kts creates a variable with no template to change its name +- [`KT-20467`](https://youtrack.jetbrains.com/issue/KT-20467) Refactor → Extract Function: CCE “KtNamedFunction cannot be cast to KtClassOrObject” on calling refactoring for constructor +- [`KT-20469`](https://youtrack.jetbrains.com/issue/KT-20469) NDFDE “Descriptor wasn't found for declaration VALUE_PARAMETER” on calling Refactor → Extract Function on constructor argument +- [`KT-22931`](https://youtrack.jetbrains.com/issue/KT-22931) Converting a scoping function with receiver into one with parameter may change the semantics +- [`KT-23983`](https://youtrack.jetbrains.com/issue/KT-23983) Extract function: Reified type parameters are not extracted properly +- [`KT-24460`](https://youtrack.jetbrains.com/issue/KT-24460) Rename refactoring does not update super call +- [`KT-24574`](https://youtrack.jetbrains.com/issue/KT-24574) Changing Java constructor signature from Kotlin usage is totally broken +- [`KT-24712`](https://youtrack.jetbrains.com/issue/KT-24712) Extract Function Parameter misses 'suspend' for lambda type +- [`KT-24763`](https://youtrack.jetbrains.com/issue/KT-24763) "Change signature" refactoring breaks Kotlin code +- [`KT-24968`](https://youtrack.jetbrains.com/issue/KT-24968) Type hints disappear after "Copy" refactoring +- [`KT-24992`](https://youtrack.jetbrains.com/issue/KT-24992) The IDE got stuck showing a modal dialog (kotlin refactoring) and doesn’t react to any actions + +### IDE. Script + +- [`KT-25373`](https://youtrack.jetbrains.com/issue/KT-25373) Deadlock in idea plugin + +### IDE. Tests Support + +- [`KT-18319`](https://youtrack.jetbrains.com/issue/KT-18319) Gradle: Run tests action does not work when test name contains spaces +- [`KT-22306`](https://youtrack.jetbrains.com/issue/KT-22306) Empty gutter menu for main() and test methods in Kotlin/JS project +- [`KT-23672`](https://youtrack.jetbrains.com/issue/KT-23672) JUnit test runner is unaware of @kotlin.test.Test tests when used in common multiplatform module, even if looked from JVM multiplatform module +- [`KT-25253`](https://youtrack.jetbrains.com/issue/KT-25253) No “run” gutter icons for tests in Kotlin/JS project + +### JavaScript + +- [`KT-22376`](https://youtrack.jetbrains.com/issue/KT-22376) JS: TranslationRuntimeException on 'for (x in ("a"))' +- [`KT-23458`](https://youtrack.jetbrains.com/issue/KT-23458) ClassCastException when compiling when statements to JS + +### Libraries + +- [`KT-24204`](https://youtrack.jetbrains.com/issue/KT-24204) Empty progression last value overflows resulting in progression being non-empty +- [`KT-25351`](https://youtrack.jetbrains.com/issue/KT-25351) `TestNGAsserter` needs to swap expected/actual + +### Reflection + +- [`KT-16616`](https://youtrack.jetbrains.com/issue/KT-16616) KotlinReflectionInternalError: Reflection on built-in Kotlin types is not yet fully supported in getMembersOfStandardJavaClasses.kt +- [`KT-17542`](https://youtrack.jetbrains.com/issue/KT-17542) KotlinReflectionInternalError on ::values of enum class +- [`KT-20442`](https://youtrack.jetbrains.com/issue/KT-20442) ReflectJvmMapping.getJavaConstructor() fails with Call is not yet supported for anonymous class +- [`KT-21973`](https://youtrack.jetbrains.com/issue/KT-21973) Method.kotlinFunction for top level extension function returns null when app is started from test sources +- [`KT-22048`](https://youtrack.jetbrains.com/issue/KT-22048) Reflection explodes when attempting to get constructors of an enum with overridden method + +### Tools. Android Extensions + +- [`KT-22576`](https://youtrack.jetbrains.com/issue/KT-22576) Parcelable: Allow Parcelize to work with object and enum types +- [`KT-24459`](https://youtrack.jetbrains.com/issue/KT-24459) @IgnoredOnParcel annotation doesn't work for @Parcelize +- [`KT-24720`](https://youtrack.jetbrains.com/issue/KT-24720) Parcelable: java.lang.LinkageError + +### Tools. Compiler Plugins + +- [`KT-23808`](https://youtrack.jetbrains.com/issue/KT-23808) Array in @Parcelize class generates an java.lang.VerifyError + +### Tools. Gradle + +- [`KT-18621`](https://youtrack.jetbrains.com/issue/KT-18621) org.jetbrains.kotlin.incremental.fileUtils.kt conflicts when compiler and gradle plugin in classpath +- [`KT-24497`](https://youtrack.jetbrains.com/issue/KT-24497) Externalized all-open plugin is not applied to a project +- [`KT-24559`](https://youtrack.jetbrains.com/issue/KT-24559) Multiple Kotlin daemon instances are started when building MPP with Gradle +- [`KT-24560`](https://youtrack.jetbrains.com/issue/KT-24560) Multiple Kotlin daemon instances are started when Gradle parallel build is used +- [`KT-24653`](https://youtrack.jetbrains.com/issue/KT-24653) Kotlin plugins don't work when classpath dependency is not declared in current or root project +- [`KT-24675`](https://youtrack.jetbrains.com/issue/KT-24675) Use Gradle dependency resolution to get compiler classpath +- [`KT-24676`](https://youtrack.jetbrains.com/issue/KT-24676) Use Gradle dependency resolution to form compiler plugin classpath +- [`KT-24946`](https://youtrack.jetbrains.com/issue/KT-24946) ISE: "The provided plugin org.jetbrains.kotlin.scripting.compiler.plugin.ScriptingCompilerConfigurationComponentRegistrar is not compatible with this version of compiler" when build simple Gradle with Zulu JDK + +### Tools. Incremental Compile + +- [`KT-25051`](https://youtrack.jetbrains.com/issue/KT-25051) Change in "kotlin-android" project w/o package parts causes non-incremental compilation of dependent modules + +### Tools. J2K + +- [`KT-9945`](https://youtrack.jetbrains.com/issue/KT-9945) converting java to kotlin confuses git + +### Tools. JPS + +- [`KT-19957`](https://youtrack.jetbrains.com/issue/KT-19957) Support incremental compilation to JS in JPS +- [`KT-22611`](https://youtrack.jetbrains.com/issue/KT-22611) Support compiling scripts in JPS +- [`KT-23558`](https://youtrack.jetbrains.com/issue/KT-23558) JPS: Support multiplatform projects +- [`KT-23757`](https://youtrack.jetbrains.com/issue/KT-23757) JPS: Incremental multiplatform projects compilation +- [`KT-24936`](https://youtrack.jetbrains.com/issue/KT-24936) Don't use internal terms in compiler progress messages +- [`KT-25218`](https://youtrack.jetbrains.com/issue/KT-25218) Build fails as Javac doesn't see Kotlin classes + +### Tools. Scripts + +- [`KT-24926`](https://youtrack.jetbrains.com/issue/KT-24926) NoSuchElementException in TemplateAnnotationVisitor when upgrading the Gradle Kotlin DSL to Kotlin 1.2.50 + +### Tools. kapt + +- [`KT-24313`](https://youtrack.jetbrains.com/issue/KT-24313) Unable to use KAPT when dependency to it is added to buildSrc +- [`KT-24449`](https://youtrack.jetbrains.com/issue/KT-24449) 'kapt.kotlin.generated' is not marked as source root in Android Studio 3.1 and 3.2 +- [`KT-24538`](https://youtrack.jetbrains.com/issue/KT-24538) Kapt performs Kotlin compilation when annotation processors are not configured +- [`KT-24919`](https://youtrack.jetbrains.com/issue/KT-24919) Caused by: org.gradle.api.InvalidUserDataException: 'projectDir' is not a file +- [`KT-24963`](https://youtrack.jetbrains.com/issue/KT-24963) gradle kapt plugin's assumption on build dir causing duplicate class error +- [`KT-24985`](https://youtrack.jetbrains.com/issue/KT-24985) Kapt: Allow to disable info->warning mapping in logger +- [`KT-25071`](https://youtrack.jetbrains.com/issue/KT-25071) kapt sometimes emits java stubs with imports that should be static imports +- [`KT-25131`](https://youtrack.jetbrains.com/issue/KT-25131) Kapt should not load annotation processors when generating stubs + +## 1.2.51 + +### Backend. JVM + +- [`KT-23943`](https://youtrack.jetbrains.com/issue/KT-23943) Wrong autoboxing for non-null inline class inside elvis with `null` constant +- [`KT-24952`](https://youtrack.jetbrains.com/issue/KT-24952) EnumConstantNotPresentExceptionProxy from Java reflection on annotation class with target TYPE on JVM < 8 +- [`KT-24986`](https://youtrack.jetbrains.com/issue/KT-24986) Android project release build with ProGuard enabled crashes with IllegalAccessError: Final field cannot be written to by method + +### Binary Metadata + +- [`KT-24944`](https://youtrack.jetbrains.com/issue/KT-24944) Exception from stubs: "Unknown type parameter with id = 1" (EA-120997) + +### Reflection + +- [`KT-23962`](https://youtrack.jetbrains.com/issue/KT-23962) MalformedParameterizedTypeException when reflecting GeneratedMessageLite.ExtendableMessage + +### Tools. Gradle + +- [`KT-24956`](https://youtrack.jetbrains.com/issue/KT-24956) Kotlin Gradle plugin's inspectClassesForKotlinIC task for the new 1.2.50 release takes incredibly long +- [`KT-23866`](https://youtrack.jetbrains.com/issue/KT-23866) Kapt plugin should pass arguments from compiler argument providers to annotation processors +- [`KT-24716`](https://youtrack.jetbrains.com/issue/KT-24716) 1.2.50 emits warning "Classpath entry points to a non-existent location:" +- [`KT-24832`](https://youtrack.jetbrains.com/issue/KT-24832) Inter-project IC does not work when "kotlin-android" project depends on "kotlin" project +- [`KT-24938`](https://youtrack.jetbrains.com/issue/KT-24938) Gradle parallel execution fails on multi-module Gradle Project +- [`KT-25027`](https://youtrack.jetbrains.com/issue/KT-25027) Kapt plugin: Kapt and KaptGenerateStubs tasks have some incorrect inputs + +### Tools. Scripts + +- [`KT-24926`](https://youtrack.jetbrains.com/issue/KT-24926) NoSuchElementException in TemplateAnnotationVisitor when upgrading the Gradle Kotlin DSL to Kotlin 1.2.50 + +## 1.2.50 + +### Compiler + +- [`KT-23360`](https://youtrack.jetbrains.com/issue/KT-23360) Do not serialize annotations with retention SOURCE to metadata +- [`KT-24278`](https://youtrack.jetbrains.com/issue/KT-24278) Hard-code to kotlin compiler annotation for android library migration +- [`KT-24472`](https://youtrack.jetbrains.com/issue/KT-24472) Support argfiles in kotlinc with -Xargfile +- [`KT-24593`](https://youtrack.jetbrains.com/issue/KT-24593) Support -XXLanguage:{+|-}LanguageFeature compiler arguments to enable/disable specific features +- [`KT-24637`](https://youtrack.jetbrains.com/issue/KT-24637) Introduce "progressive" mode of compiler + +#### Backend. JS + +- [`KT-23094`](https://youtrack.jetbrains.com/issue/KT-23094) JS compiler: Delegation fails to pass the continuation parameter to child suspend function +- [`KT-23582`](https://youtrack.jetbrains.com/issue/KT-23582) JS: Fails to inline, produces bad code +- [`KT-24335`](https://youtrack.jetbrains.com/issue/KT-24335) JS: Invalid implement of external interface + +#### Backend. JVM + +- [`KT-12330`](https://youtrack.jetbrains.com/issue/KT-12330) Slightly improve generated bytecode for data class equals/hashCode methods +- [`KT-18576`](https://youtrack.jetbrains.com/issue/KT-18576) Debugger fails to show decomposed suspend lambda parameters +- [`KT-22063`](https://youtrack.jetbrains.com/issue/KT-22063) Add intrinsics for javaObjectType and javaPrimitiveType +- [`KT-23402`](https://youtrack.jetbrains.com/issue/KT-23402) Internal error: Couldn't inline method call because the compiler couldn't obtain compiled body for inline function with reified type parameter +- [`KT-23704`](https://youtrack.jetbrains.com/issue/KT-23704) Unstable `checkExpressionValueIsNotNull()` generation in bytecode +- [`KT-23707`](https://youtrack.jetbrains.com/issue/KT-23707) Unstable bridge generation order +- [`KT-23857`](https://youtrack.jetbrains.com/issue/KT-23857) Annotation with target TYPE is not applicable to TYPE_USE in Java sources +- [`KT-23910`](https://youtrack.jetbrains.com/issue/KT-23910) @JvmOverloads doesn't work with default arguments in common code +- [`KT-24427`](https://youtrack.jetbrains.com/issue/KT-24427) Protected function having toArray-like signature from collection becomes public in bytecode +- [`KT-24661`](https://youtrack.jetbrains.com/issue/KT-24661) Support binary compatibility mode for @JvmDefault + +#### Frontend + +- [`KT-21129`](https://youtrack.jetbrains.com/issue/KT-21129) Unused parameter in property setter is not reported +- [`KT-21157`](https://youtrack.jetbrains.com/issue/KT-21157) Kotlin script: engine can take forever to eval certain code after several times +- [`KT-22740`](https://youtrack.jetbrains.com/issue/KT-22740) REPL slows down during extensions compiling +- [`KT-23124`](https://youtrack.jetbrains.com/issue/KT-23124) Kotlin multiplatform project causes IntelliJ build errors +- [`KT-23209`](https://youtrack.jetbrains.com/issue/KT-23209) Compiler throwing frontend exception +- [`KT-23589`](https://youtrack.jetbrains.com/issue/KT-23589) Report a warning on local annotation classes +- [`KT-23760`](https://youtrack.jetbrains.com/issue/KT-23760) Unable to implement common interface with fun member function with typealiased parameter + +### Android + +- [`KT-23244`](https://youtrack.jetbrains.com/issue/KT-23244) Option to Disable View Binding generation in Kotlin Android Extensions Plugin + +### IDE + +- [`KT-8407`](https://youtrack.jetbrains.com/issue/KT-8407) TestNG: running tests from context creates new run configuration every time +- [`KT-9218`](https://youtrack.jetbrains.com/issue/KT-9218) Searching for compilable files takes too long +- [`KT-15019`](https://youtrack.jetbrains.com/issue/KT-15019) Editor: `args` reference in .kts file is red +- [`KT-18769`](https://youtrack.jetbrains.com/issue/KT-18769) Expand Selection on opening curly brace should select the entire block right away +- [`KT-19055`](https://youtrack.jetbrains.com/issue/KT-19055) Idea hangs on copy-paste big Kotlin files +- [`KT-20605`](https://youtrack.jetbrains.com/issue/KT-20605) Unresolved reference on instance from common module function +- [`KT-20824`](https://youtrack.jetbrains.com/issue/KT-20824) Type mismatch for common function taking a non-mapped Kotlin's expected class from stdlib-common, with actual typealias on JVM +- [`KT-20897`](https://youtrack.jetbrains.com/issue/KT-20897) Can't navigate to declaration after PsiInvalidElementAccessException exception +- [`KT-22527`](https://youtrack.jetbrains.com/issue/KT-22527) Kotlin UAST does not evaluate values inside delegation expressions +- [`KT-22868`](https://youtrack.jetbrains.com/issue/KT-22868) Implementing an `expected class` declaration using `actual typealias` produces "good code that is red" +- [`KT-22922`](https://youtrack.jetbrains.com/issue/KT-22922) Override Members should add experimental annotation when required +- [`KT-23384`](https://youtrack.jetbrains.com/issue/KT-23384) Hotspot in org.jetbrains.kotlin.idea.caches.resolve.IDELightClassGenerationSupport.getKotlinInternalClasses(FqName, GlobalSearchScope) IDELightClassGenerationSupport.kt ? +- [`KT-23408`](https://youtrack.jetbrains.com/issue/KT-23408) Don't render @NonNull and @Nullable annotations in parameter info for Java methods +- [`KT-23557`](https://youtrack.jetbrains.com/issue/KT-23557) Expression Bodies should have implicit `return` in Uast +- [`KT-23745`](https://youtrack.jetbrains.com/issue/KT-23745) Unable to implement common interface +- [`KT-23746`](https://youtrack.jetbrains.com/issue/KT-23746) Logger$EmptyThrowable "[kts] cannot find a valid script definition annotation on the class class ScriptTemplateWithArgs" with LivePlugin enabled +- [`KT-23975`](https://youtrack.jetbrains.com/issue/KT-23975) Move Kotlin internal actions under Idea Internal actions menu +- [`KT-24268`](https://youtrack.jetbrains.com/issue/KT-24268) Other main menu item +- [`KT-24438`](https://youtrack.jetbrains.com/issue/KT-24438) ISE “The provided plugin org.jetbrains.kotlin.scripting.compiler.plugin.ScriptingCompilerConfigurationComponentRegistrar is not compatible with this version of compiler” after rebuilding simple Gradle-based project via JPS. + +#### IDE. Configuration + +- [`KT-10935`](https://youtrack.jetbrains.com/issue/KT-10935) Add menu entry to create new kotlin .kts scripts +- [`KT-20511`](https://youtrack.jetbrains.com/issue/KT-20511) Library added from maven (using IDEA UI) is not detected as Kotlin/JS library (since type="repository") +- [`KT-20665`](https://youtrack.jetbrains.com/issue/KT-20665) Kotlin Gradle script created by New Project/Module wizard fails with Gradle 4.1+ +- [`KT-21844`](https://youtrack.jetbrains.com/issue/KT-21844) Create Kotlin class dialog: make class abstract automatically +- [`KT-22305`](https://youtrack.jetbrains.com/issue/KT-22305) Language and API versions of Kotlin compiler are “Latest” by default in some ways of creating new project +- [`KT-23261`](https://youtrack.jetbrains.com/issue/KT-23261) New MPP design: please show popup with error message if module name is not set +- [`KT-23638`](https://youtrack.jetbrains.com/issue/KT-23638) Kotlin plugin breaks project opening for PhpStorm/WebStorm +- [`KT-23658`](https://youtrack.jetbrains.com/issue/KT-23658) Unclear options “Gradle” and “Gradle (Javascript)” on configuring Kotlin in Gradle- and Maven-based projects +- [`KT-23845`](https://youtrack.jetbrains.com/issue/KT-23845) IntelliJ Maven Plugin does not pass javaParameters option to Kotlin facet +- [`KT-23980`](https://youtrack.jetbrains.com/issue/KT-23980) Move "Update Channel" from "Configure Kotlin Plugin Updates" to settings +- [`KT-24504`](https://youtrack.jetbrains.com/issue/KT-24504) Existent JPS-based Kotlin/JS module is converted to new format, while New Project wizard and facet manipulations still create old format + +#### IDE. Debugger + +- [`KT-23886`](https://youtrack.jetbrains.com/issue/KT-23886) Both java and kotlin breakpoints in kotlin files +- [`KT-24136`](https://youtrack.jetbrains.com/issue/KT-24136) Debugger: update drop-down menu for the line with lambdas + +#### IDE. Editing + +- [`KT-2582`](https://youtrack.jetbrains.com/issue/KT-2582) When user inputs triple quote, add matching triple quote automatically +- [`KT-5206`](https://youtrack.jetbrains.com/issue/KT-5206) Long lists of arguments are not foldable +- [`KT-23457`](https://youtrack.jetbrains.com/issue/KT-23457) Auto-import and Import quick fix do not suggest classes from common module [Common test can't find class with word `Abstract` in name.] +- [`KT-23235`](https://youtrack.jetbrains.com/issue/KT-23235) Super slow editing with auto imports enabled + +#### IDE. Gradle + +- [`KT-23234`](https://youtrack.jetbrains.com/issue/KT-23234) Test names for tests containing inner classes are sporadically reported to teamcity runs. +- [`KT-23383`](https://youtrack.jetbrains.com/issue/KT-23383) Optional plugin dependency for kotlin gradle plugin 'java' subsystem dependent features +- [`KT-22588`](https://youtrack.jetbrains.com/issue/KT-22588) Resolver for 'project source roots and libraries for platform JVM' does not know how to resolve on Gradle Kotlin DSL project without Java and Kotlin +- [`KT-23616`](https://youtrack.jetbrains.com/issue/KT-23616) Synchronize script dependencies not at Gradle Sync +- [`KT-24444`](https://youtrack.jetbrains.com/issue/KT-24444) Do not store proxy objects from Gradle importer in the project model +- [`KT-24586`](https://youtrack.jetbrains.com/issue/KT-24586) MVNFE “Cannot resolve external dependency org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.41 because no repositories are defined.” on creating Gradle project with Kotlin only (probably due to lack of repositories block) +- [`KT-24671`](https://youtrack.jetbrains.com/issue/KT-24671) dependencies missed in buildscript block after creating new Gradle-based project in 173 IDEA + +#### IDE. Inspections and Intentions + +##### New Features + +- [`KT-7822`](https://youtrack.jetbrains.com/issue/KT-7822) Convert foreach to for loop should place caret on the variable declaration +- [`KT-9943`](https://youtrack.jetbrains.com/issue/KT-9943) Quick fix/Intention to indent a raw string +- [`KT-15063`](https://youtrack.jetbrains.com/issue/KT-15063) Inspection for coroutine: unused Deferred result +- [`KT-16085`](https://youtrack.jetbrains.com/issue/KT-16085) Inspection "main should return Unit" +- [`KT-20305`](https://youtrack.jetbrains.com/issue/KT-20305) Inspection: Refactor sealed sub-class to object +- [`KT-21413`](https://youtrack.jetbrains.com/issue/KT-21413) Missing inspection: parentheses can be deleted when the only constructor parameter is a function not existing +- [`KT-23137`](https://youtrack.jetbrains.com/issue/KT-23137) Intention for converting to block comment and vise versa +- [`KT-23266`](https://youtrack.jetbrains.com/issue/KT-23266) Add intention(s) to put arguments / parameters on one line +- [`KT-23419`](https://youtrack.jetbrains.com/issue/KT-23419) Intention to replace vararg with array and vice versa +- [`KT-23617`](https://youtrack.jetbrains.com/issue/KT-23617) Add inspection: redundant internal in local anonymous object / class +- [`KT-23775`](https://youtrack.jetbrains.com/issue/KT-23775) IntelliJ plugin: improve "accessor call that can be replaced with property" +- [`KT-24235`](https://youtrack.jetbrains.com/issue/KT-24235) Inspection to replace async.await with withContext +- [`KT-24263`](https://youtrack.jetbrains.com/issue/KT-24263) Add `Make variable immutable` quickfix for const +- [`KT-24433`](https://youtrack.jetbrains.com/issue/KT-24433) Inspection for coroutines: unused async result + +##### Performance Improvements + +- [`KT-23566`](https://youtrack.jetbrains.com/issue/KT-23566) "Can be private" works on ResolutionResultsCache.kt (from Kotlin project) enormously slow + +##### Fixes + +- [`KT-6364`](https://youtrack.jetbrains.com/issue/KT-6364) Incorrect quick-fixes are suggested for nullable extension function call +- [`KT-11156`](https://youtrack.jetbrains.com/issue/KT-11156) Incorrect highlighting for nested class in "Redundant SAM-constructor" inspection +- [`KT-11427`](https://youtrack.jetbrains.com/issue/KT-11427) "Replace if with when" does not take break / continue into account +- [`KT-11740`](https://youtrack.jetbrains.com/issue/KT-11740) Invert if condition intention should not remove line breaks +- [`KT-12042`](https://youtrack.jetbrains.com/issue/KT-12042) "Merge with next when" is not applicable when the statements delimited by semicolon or comment +- [`KT-12168`](https://youtrack.jetbrains.com/issue/KT-12168) "Remove explicit type specification" intention produce incompilable code in case of function type +- [`KT-14391`](https://youtrack.jetbrains.com/issue/KT-14391) RemoveUnnecessaryParenthesesIntention lost comment on closing parenthesis +- [`KT-14556`](https://youtrack.jetbrains.com/issue/KT-14556) Quickfix to suggest use of spread operator does not work with mapOf +- [`KT-15195`](https://youtrack.jetbrains.com/issue/KT-15195) Redundant parentheses shouldn't be reported if lambda is not on the same line +- [`KT-16770`](https://youtrack.jetbrains.com/issue/KT-16770) Change type of function quickfix does not propose most idiomatic solutions +- [`KT-19629`](https://youtrack.jetbrains.com/issue/KT-19629) "Convert to primary constructor" quick fix should not move `init{...}` section down +- [`KT-20123`](https://youtrack.jetbrains.com/issue/KT-20123) Kotlin Gradle script: “Refactoring cannot be performed. Cannot modify build.gradle.kts” for some refactorings and intentions +- [`KT-20332`](https://youtrack.jetbrains.com/issue/KT-20332) Unused property declaration suppression by annotation doesn't work if annotation is targeted to getter +- [`KT-21878`](https://youtrack.jetbrains.com/issue/KT-21878) "arrayOf() call can be replaced by array litteral [...]" quick fix inserts extra parentheses +- [`KT-22092`](https://youtrack.jetbrains.com/issue/KT-22092) Intention "Specify return type explicitly": Propose types from overriden declarations +- [`KT-22615`](https://youtrack.jetbrains.com/issue/KT-22615) "Replace with" intention does not work for equal names +- [`KT-22632`](https://youtrack.jetbrains.com/issue/KT-22632) Gutter icon "go to actual declaration" is absent for enum values on actual side +- [`KT-22741`](https://youtrack.jetbrains.com/issue/KT-22741) Wrong suggestion for `Replace 'if' expression with elvis expression` +- [`KT-22831`](https://youtrack.jetbrains.com/issue/KT-22831) Inspection for converting to elvis operator does not work for local vars +- [`KT-22860`](https://youtrack.jetbrains.com/issue/KT-22860) "Add annotation target" quick fix does not take into account existent annotations in Java source +- [`KT-22918`](https://youtrack.jetbrains.com/issue/KT-22918) Create interface quickfix is missing 'current class' container +- [`KT-23133`](https://youtrack.jetbrains.com/issue/KT-23133) "Remove redundant calls of the conversion method" wrongly shown for Boolan to Int conversion +- [`KT-23167`](https://youtrack.jetbrains.com/issue/KT-23167) Report "use expression body" also on left brace +- [`KT-23194`](https://youtrack.jetbrains.com/issue/KT-23194) Inspection "map.put() should be converted to assignment" leads to red code in case of labled return +- [`KT-23303`](https://youtrack.jetbrains.com/issue/KT-23303) "Might be const" inspection does not check explicit type specification +- [`KT-23320`](https://youtrack.jetbrains.com/issue/KT-23320) Quick fix to add constructor invocation doesn't work for sealed classes +- [`KT-23321`](https://youtrack.jetbrains.com/issue/KT-23321) Intention to move type to separate file shouldn't be available for sealed classes +- [`KT-23346`](https://youtrack.jetbrains.com/issue/KT-23346) Lift Assignment quick fix incorrectly processes block assignments +- [`KT-23377`](https://youtrack.jetbrains.com/issue/KT-23377) Simplify boolean expression produces incorrect results when mixing nullable and non-nullable variables +- [`KT-23465`](https://youtrack.jetbrains.com/issue/KT-23465) False positive `suspicious callable reference` on lambda invoke with parameters +- [`KT-23511`](https://youtrack.jetbrains.com/issue/KT-23511) "Remove parameter" quick fix makes generic function call incompilable when type could be inferred from removed parameter only +- [`KT-23513`](https://youtrack.jetbrains.com/issue/KT-23513) "Remove parameter" quick fix makes caret jump to the top of the editor +- [`KT-23559`](https://youtrack.jetbrains.com/issue/KT-23559) Wrong hint text for "assignment can be replaced with operator assignment" +- [`KT-23608`](https://youtrack.jetbrains.com/issue/KT-23608) AE “Failed to create expression from text” after applying quick fix “Convert too long character literal to string” +- [`KT-23620`](https://youtrack.jetbrains.com/issue/KT-23620) False positive `Redundant Companion reference` on calling object from companion +- [`KT-23634`](https://youtrack.jetbrains.com/issue/KT-23634) 'Add use-site target' intention drops annotation arguments +- [`KT-23753`](https://youtrack.jetbrains.com/issue/KT-23753) "Remove variable" quick fix should not remove comment +- [`KT-23756`](https://youtrack.jetbrains.com/issue/KT-23756) Bogus "Might be const" warning in object expression +- [`KT-23778`](https://youtrack.jetbrains.com/issue/KT-23778) "Convert function to property" intention shows broken warning +- [`KT-23796`](https://youtrack.jetbrains.com/issue/KT-23796) "Create extension function/property" quick fix suggests one for nullable type while creates for not-null +- [`KT-23801`](https://youtrack.jetbrains.com/issue/KT-23801) "Convert to constructor" (IntelliJ) quick fix uses wrong use-site target for annotating properties +- [`KT-23977`](https://youtrack.jetbrains.com/issue/KT-23977) wrong hint Unit redundant +- [`KT-24066`](https://youtrack.jetbrains.com/issue/KT-24066) 'Remove redundant Unit' false positive when Unit is returned as Any +- [`KT-24165`](https://youtrack.jetbrains.com/issue/KT-24165) @Deprecated ReplaceWith Constant gets replaced with nothing +- [`KT-24207`](https://youtrack.jetbrains.com/issue/KT-24207) Add parameter intent/red bulb should use auto casted type. +- [`KT-24215`](https://youtrack.jetbrains.com/issue/KT-24215) ReplaceWith produces broken code for lambda following default parameter + +#### IDE. Multiplatform + +- [`KT-20406`](https://youtrack.jetbrains.com/issue/KT-20406) Overload resolution ambiguity in IDE on expect class / actual typealias from kotlin-stdlib-common / kotlin-stdlib +- [`KT-24316`](https://youtrack.jetbrains.com/issue/KT-24316) Missing dependencies in Kotlin MPP when using gradle composite builds + +#### IDE. Navigation + +- [`KT-7622`](https://youtrack.jetbrains.com/issue/KT-7622) Searching usages of a field/constructor parameter in a private class seems to scan through the whole project +- [`KT-23182`](https://youtrack.jetbrains.com/issue/KT-23182) Find Usages checks whether there are unused variables in functions which contain search result candidates +- [`KT-23223`](https://youtrack.jetbrains.com/issue/KT-23223) Navigate to actual declaration from actual usage + +#### IDE. Refactorings + +- [`KT-12078`](https://youtrack.jetbrains.com/issue/KT-12078) Introduce Variable adds explicit type when invoked on anonymous object +- [`KT-15517`](https://youtrack.jetbrains.com/issue/KT-15517) Change signature refactoring shows confusing warning dialog +- [`KT-22387`](https://youtrack.jetbrains.com/issue/KT-22387) Change signature reports "Type cannot be resolved" for class from different package +- [`KT-22669`](https://youtrack.jetbrains.com/issue/KT-22669) Refactor / Copy Kotlin source to plain text causes CCE: "PsiPlainTextFileImpl cannot be cast to KtFile" at CopyKotlinDeclarationsHandler$doCopy$2$1$1.invoke() +- [`KT-22888`](https://youtrack.jetbrains.com/issue/KT-22888) Rename completion cuts off all characters except letters from existent name +- [`KT-23298`](https://youtrack.jetbrains.com/issue/KT-23298) AE: "2 declarations in null..." on rename of a field to `object` or `class` +- [`KT-23563`](https://youtrack.jetbrains.com/issue/KT-23563) null by org.jetbrains.kotlin.idea.refactoring.rename.KotlinMemberInplaceRenameHandler$RenamerImpl exception on trying in-place Rename of non-scratch functions +- [`KT-23613`](https://youtrack.jetbrains.com/issue/KT-23613) Kotlin safe delete processor handles java code when it should not +- [`KT-23644`](https://youtrack.jetbrains.com/issue/KT-23644) Named parameters in generated Kotlin Annotations +- [`KT-23714`](https://youtrack.jetbrains.com/issue/KT-23714) Add Parameter quickfix not working when the called method is in java. +- [`KT-23838`](https://youtrack.jetbrains.com/issue/KT-23838) Do not search for usages in other files when renaming local variable +- [`KT-24069`](https://youtrack.jetbrains.com/issue/KT-24069) 'Create from usage' doesn't use type info with smart casts + +#### IDE. Scratch + +- [`KT-6928`](https://youtrack.jetbrains.com/issue/KT-6928) Support Kotlin scratch files +- [`KT-23441`](https://youtrack.jetbrains.com/issue/KT-23441) Scratch options reset on IDE restart +- [`KT-23480`](https://youtrack.jetbrains.com/issue/KT-23480) java.util.NoSuchElementException: "Collection contains no element matching the predicate" on run of a scratch file with unresolved function parameter +- [`KT-23587`](https://youtrack.jetbrains.com/issue/KT-23587) Scratch: references from scratch file aren't taken into account +- [`KT-24016`](https://youtrack.jetbrains.com/issue/KT-24016) Make long scratch output lines readable +- [`KT-24315`](https://youtrack.jetbrains.com/issue/KT-24315) Checkbox labels aren't aligned in scratch panel +- [`KT-24636`](https://youtrack.jetbrains.com/issue/KT-24636) Run Scratch when there are compilation errors in module + +#### Tools. J2K + +- [`KT-22989`](https://youtrack.jetbrains.com/issue/KT-22989) Exception "Assertion failed: Refactorings should be invoked inside transaction" on creating UI Component/Notification + +### Libraries + +- [`KT-10456`](https://youtrack.jetbrains.com/issue/KT-10456) Common Int.toString(radix: Int) method +- [`KT-22298`](https://youtrack.jetbrains.com/issue/KT-22298) Improve docs for Array.copyOf(newSize: Int) +- [`KT-22400`](https://youtrack.jetbrains.com/issue/KT-22400) coroutineContext shall be in kotlin.coroutines.experimental package +- [`KT-23356`](https://youtrack.jetbrains.com/issue/KT-23356) Cross-platform function to convert CharArray slice to String +- [`KT-23920`](https://youtrack.jetbrains.com/issue/KT-23920) CharSequence.trimEnd calls substring instead of subSequence +- [`KT-24353`](https://youtrack.jetbrains.com/issue/KT-24353) Add support for junit 5 in kotlin.test +- [`KT-24371`](https://youtrack.jetbrains.com/issue/KT-24371) Invalid @returns tag does not display in Android Studio popup properly + +### Gradle plugin + +- [`KT-20214`](https://youtrack.jetbrains.com/issue/KT-20214) NoClassDefFound from Gradle (should report missing tools.jar) +- [`KT-20608`](https://youtrack.jetbrains.com/issue/KT-20608) Cannot reference operator overloads across submodules (.kotlin_module not loaded when a module name has a slash) +- [`KT-22431`](https://youtrack.jetbrains.com/issue/KT-22431) Inter-project incremental compilation does not work with Android plugin 2.3+ +- [`KT-22510`](https://youtrack.jetbrains.com/issue/KT-22510) Common sources aren't added when compiling custom source set with Gradle multiplatform plugin +- [`KT-22623`](https://youtrack.jetbrains.com/issue/KT-22623) Kotlin JVM tasks in independent projects are not executed in parallel with Gradle 4.2+ and Kotlin 1.2.20+ +- [`KT-23092`](https://youtrack.jetbrains.com/issue/KT-23092) Gradle plugin for MPP common modules should not remove the 'compileJava' task from `project.tasks` +- [`KT-23574`](https://youtrack.jetbrains.com/issue/KT-23574) 'archivesBaseName' does not affect module name in common modules +- [`KT-23719`](https://youtrack.jetbrains.com/issue/KT-23719) Incorrect Gradle Warning for expectedBy in kotlin-platform-android module +- [`KT-23878`](https://youtrack.jetbrains.com/issue/KT-23878) Kapt: Annotation processors are run when formatting is changed +- [`KT-24420`](https://youtrack.jetbrains.com/issue/KT-24420) Kapt plugin: Kapt task has overlapping outputs (and inputs) with Gradle's JavaCompile task +- [`KT-24440`](https://youtrack.jetbrains.com/issue/KT-24440) Gradle daemon OOM due to function descriptors stuck forever + +### Tools. kapt + +- [`KT-23286`](https://youtrack.jetbrains.com/issue/KT-23286) kapt + nonascii = weird pathes +- [`KT-23427`](https://youtrack.jetbrains.com/issue/KT-23427) kapt: for element with multiple annotations, annotation values erroneously use default when first annotation uses default +- [`KT-23721`](https://youtrack.jetbrains.com/issue/KT-23721) Warning informing user that 'tools.jar' is absent in the plugin classpath is not show when there is also an error +- [`KT-23898`](https://youtrack.jetbrains.com/issue/KT-23898) Kapt: Do now show a warning for APs from 'annotationProcessor' configuration also declared in 'kapt' configuration +- [`KT-23964`](https://youtrack.jetbrains.com/issue/KT-23964) Kotlin Gradle plugin does not define inputs and outputs of annotation processors + +## 1.2.41 + +### Compiler – Fixes +- [`KT-23901`](https://youtrack.jetbrains.com/issue/KT-23901) Incremental compilation fails on Java 9 +- [`KT-23931`](https://youtrack.jetbrains.com/issue/KT-23931) Exception on optimizing eternal loops +- [`KT-23900`](https://youtrack.jetbrains.com/issue/KT-23900) Exception on some cases with nested arrays +- [`KT-23809`](https://youtrack.jetbrains.com/issue/KT-23809) Exception on processing complex hierarchies with `suspend` functions when `-Xdump-declarations-to` is active + +### Other +- [`KT-23973`](https://youtrack.jetbrains.com/issue/KT-23973) New compiler behavior lead to ambiguous mappings in Spring Boot temporarily reverted + +## 1.2.40 + +### Compiler + +#### New Features + +- [`KT-22703`](https://youtrack.jetbrains.com/issue/KT-22703) Allow expect/actual annotation constructors to have default values +- [`KT-19159`](https://youtrack.jetbrains.com/issue/KT-19159) Support `crossinline` lambda parameters of `suspend` function type +- [`KT-21913`](https://youtrack.jetbrains.com/issue/KT-21913) Support default arguments for expected declarations +- [`KT-19120`](https://youtrack.jetbrains.com/issue/KT-19120) Provide extra compiler arguments in `ScriptTemplateDefinition` +- [`KT-19415`](https://youtrack.jetbrains.com/issue/KT-19415) Introduce `@JvmDefault` annotation +- [`KT-21515`](https://youtrack.jetbrains.com/issue/KT-21515) Restrict visibility of classifiers inside `companion object`s + +#### Performance Improvements + +- [`KT-10057`](https://youtrack.jetbrains.com/issue/KT-10057) Use `lcmp` instruction instead of `kotlin/jvm/internal/Intrinsics.compare` +- [`KT-14258`](https://youtrack.jetbrains.com/issue/KT-14258) Suboptimal codegen for private fieldaccess to private field in companion object +- [`KT-18731`](https://youtrack.jetbrains.com/issue/KT-18731) `==` between enums should use reference equality, not `Intrinsics.areEqual()`. +- [`KT-22714`](https://youtrack.jetbrains.com/issue/KT-22714) Unnecessary checkcast to array of object from an array of specific type +- [`KT-5177`](https://youtrack.jetbrains.com/issue/KT-5177) Optimize code generation for `for` loop with `withIndex()` +- [`KT-19477`](https://youtrack.jetbrains.com/issue/KT-19477) Allow to implement several common modules with a single platform module +- [`KT-21347`](https://youtrack.jetbrains.com/issue/KT-21347) Add compiler warning about using kotlin-stdlib-jre7 or kotlin-stdlib-jre8 artifacts + +#### Fixes + +- [`KT-16424`](https://youtrack.jetbrains.com/issue/KT-16424) Broken bytecode for nullable generic methods +- [`KT-17171`](https://youtrack.jetbrains.com/issue/KT-17171) `ClassCastException` in case of SAM conversion with `out` variance +- [`KT-19399`](https://youtrack.jetbrains.com/issue/KT-19399) Incorrect bytecode generated for inline functions in some complex cases +- [`KT-21696`](https://youtrack.jetbrains.com/issue/KT-21696) Incorrect warning for use-site target on extension function +- [`KT-22031`](https://youtrack.jetbrains.com/issue/KT-22031) Non-`abstract` expect classes should not have `abstract` members +- [`KT-22260`](https://youtrack.jetbrains.com/issue/KT-22260) Never flag `inline suspend fun` with `NOTHING_TO_INLINE` +- [`KT-22352`](https://youtrack.jetbrains.com/issue/KT-22352) Expect/actual checker can't handle properties and functions with the same name +- [`KT-22652`](https://youtrack.jetbrains.com/issue/KT-22652) Interface with default overrides is not perceived as a SAM +- [`KT-22904`](https://youtrack.jetbrains.com/issue/KT-22904) Incorrect bytecode generated for withIndex iteration on `Array` +- [`KT-22906`](https://youtrack.jetbrains.com/issue/KT-22906) Invalid class name generated for lambda created from method reference in anonymous object +- [`KT-23044`](https://youtrack.jetbrains.com/issue/KT-23044) Overriden public property with internal setter cannot be found in runtime +- [`KT-23104`](https://youtrack.jetbrains.com/issue/KT-23104) Incorrect code generated for LHS of an intrinsified `in` operator in case of generic type substituted with `Character` +- [`KT-23309`](https://youtrack.jetbrains.com/issue/KT-23309) Minor spelling errors in JVM internal error messages +- [`KT-22001`](https://youtrack.jetbrains.com/issue/KT-22001) JS: compiler crashes on += with "complex" receiver +- [`KT-23239`](https://youtrack.jetbrains.com/issue/KT-23239) JS: Default arguments for non-final member function support is missing for MPP +- [`KT-17091`](https://youtrack.jetbrains.com/issue/KT-17091) Converting to SAM Java type appends non-deterministic hash to class name +- [`KT-21521`](https://youtrack.jetbrains.com/issue/KT-21521) Compilation exception when trying to compile a `suspend` function with `tailrec` keyword +- [`KT-21605`](https://youtrack.jetbrains.com/issue/KT-21605) Cross-inlined coroutine with captured outer receiver creates unverifiable code +- [`KT-21864`](https://youtrack.jetbrains.com/issue/KT-21864) Expect-actual matcher doesn't consider generic upper bounds +- [`KT-21906`](https://youtrack.jetbrains.com/issue/KT-21906) `ACTUAL_MISSING` is reported for actual constructor of non-actual class +- [`KT-21939`](https://youtrack.jetbrains.com/issue/KT-21939) Improve `ACTUAL_MISSING` diagnostics message +- [`KT-22513`](https://youtrack.jetbrains.com/issue/KT-22513) Flaky "JarURLConnection.getUseCaches" NPE during compilation when using compiler plugins + +### Libraries + +- [`KT-11208`](https://youtrack.jetbrains.com/issue/KT-11208) `readLine()` shouldn't use buffered reader + +### IDE + +#### New Features + +- [`KT-10368`](https://youtrack.jetbrains.com/issue/KT-10368) Run Action for Kotlin Scratch Files +- [`KT-16892`](https://youtrack.jetbrains.com/issue/KT-16892) Shortcut to navigate between header and impl +- [`KT-23005`](https://youtrack.jetbrains.com/issue/KT-23005) Support `prefix`/`suffix` attributes for language injection in Kotlin with annotations and comments + +#### Performance Improvements + +- [`KT-19484`](https://youtrack.jetbrains.com/issue/KT-19484) KotlinBinaryClassCache retains a lot of memory +- [`KT-23183`](https://youtrack.jetbrains.com/issue/KT-23183) `ConfigureKotlinNotification.getNotificationString()` scans modules with Kotlin files twice +- [`KT-23380`](https://youtrack.jetbrains.com/issue/KT-23380) Improve IDE performance when working with Spring projects + +#### Fixes + +- [`KT-15482`](https://youtrack.jetbrains.com/issue/KT-15482) `KotlinNullPointerException` in IDE from expected class with nested class +- [`KT-15739`](https://youtrack.jetbrains.com/issue/KT-15739) Internal visibility across common and platform-dependent modules +- [`KT-19025`](https://youtrack.jetbrains.com/issue/KT-19025) Not imported `build.gradle.kts` is all red +- [`KT-19165`](https://youtrack.jetbrains.com/issue/KT-19165) IntelliJ should suggest to reload Gradle projects when `build.gradle.kts` changes +- [`KT-20282`](https://youtrack.jetbrains.com/issue/KT-20282) 'Move statement up' works incorrectly for statement after `finally` block if `try` block contains closure +- [`KT-20521`](https://youtrack.jetbrains.com/issue/KT-20521) Kotlin Gradle script: valid `build.gradle.kts` is red and becomes normal only after reopening the project +- [`KT-20592`](https://youtrack.jetbrains.com/issue/KT-20592) `KotlinNullPointerException`: nested class inside expect / actual interface +- [`KT-21013`](https://youtrack.jetbrains.com/issue/KT-21013) "Move statement up/down" fails for multiline declarations +- [`KT-21420`](https://youtrack.jetbrains.com/issue/KT-21420) `.gradle.kts` editor should do no semantic highlighting until the first successful dependency resolver response +- [`KT-21683`](https://youtrack.jetbrains.com/issue/KT-21683) Language injection: JPAQL. Injection should be present for "query" parameter of `@NamedNativeQueries` +- [`KT-21745`](https://youtrack.jetbrains.com/issue/KT-21745) Warning and quickfix about kotlin-stdlib-jre7/8 -> kotlin-stdlib-jdk7/8 in Maven +- [`KT-21746`](https://youtrack.jetbrains.com/issue/KT-21746) Warning and quickfix about kotlin-stdlib-jre7/8 -> kotlin-stdlib-jdk7/8 in Gradle +- [`KT-21753`](https://youtrack.jetbrains.com/issue/KT-21753) Language injection: SpEL. Not injected for key in `@Caching` +- [`KT-21771`](https://youtrack.jetbrains.com/issue/KT-21771) All annotations in `Annotations.kt` from kotlin-test-js module wrongly have ACTUAL_MISSING +- [`KT-21831`](https://youtrack.jetbrains.com/issue/KT-21831) Opening class from `kotlin-stdlib-jdk8.jar` fails with EE: "Stub list in ... length differs from PSI" +- [`KT-22229`](https://youtrack.jetbrains.com/issue/KT-22229) Kotlin local delegated property Import auto-removed with "Java: Optimize imports on the fly" +- [`KT-22724`](https://youtrack.jetbrains.com/issue/KT-22724) ISE: "psiFile must not be null" at `KotlinNodeJsRunConfigurationProducer.setupConfigurationFromContext()` +- [`KT-22817`](https://youtrack.jetbrains.com/issue/KT-22817) Hitting 'Propagate Parameters' in Change Signature throws `UnsupportedOperationException` +- [`KT-22851`](https://youtrack.jetbrains.com/issue/KT-22851) Apply button is always active on Kotlin compiler settings tab +- [`KT-22858`](https://youtrack.jetbrains.com/issue/KT-22858) Multiplatform: String constructor parameter is reported in Java file of jvm module on creation of a new instance of a class from common module +- [`KT-22865`](https://youtrack.jetbrains.com/issue/KT-22865) Support multiple expectedBy dependencies when importing project from Gradle or Maven +- [`KT-22873`](https://youtrack.jetbrains.com/issue/KT-22873) Common module-based light classes do not see JDK +- [`KT-22874`](https://youtrack.jetbrains.com/issue/KT-22874) Exception on surround with "if else" when resulting if should be wrapped with `()` +- [`KT-22925`](https://youtrack.jetbrains.com/issue/KT-22925) Unable to view Type Hierarchy from constructor call in expression +- [`KT-22926`](https://youtrack.jetbrains.com/issue/KT-22926) Confusing behavior of Type Hierarchy depending on the caret position at superclass constructor +- [`KT-23097`](https://youtrack.jetbrains.com/issue/KT-23097) Enhance multiplatform project wizard +- [`KT-23271`](https://youtrack.jetbrains.com/issue/KT-23271) Warn about using kotlin-stdlib-jre* libs in `dependencyManagement` section in Maven with `eap` and `dev` Kotlin versions +- [`KT-20672`](https://youtrack.jetbrains.com/issue/KT-20672) IDE can't resolve references to elements from files with `@JvmPackageName` +- [`KT-23546`](https://youtrack.jetbrains.com/issue/KT-23546) Variable name auto-completion popup gets in the way +- [`KT-23546`](https://youtrack.jetbrains.com/issue/KT-23546) Do not show duplicated names in variables completion list +- [`KT-19120`](https://youtrack.jetbrains.com/issue/KT-19120) Use script compiler options on script dependencies in the IDE as well + +### IDE. Gradle. Script + +- [`KT-23228`](https://youtrack.jetbrains.com/issue/KT-23228) Do not highlight `.gradle.kts` files in non-Gradle projects + +### IDE. Inspections and Intentions + +#### New Features + +- [`KT-16382`](https://youtrack.jetbrains.com/issue/KT-16382) Intention to convert `expr.unsafeCast()` to `expr as Type` and vice versa +- [`KT-20439`](https://youtrack.jetbrains.com/issue/KT-20439) Intentions to add/remove labeled return to last expression in a lambda +- [`KT-22011`](https://youtrack.jetbrains.com/issue/KT-22011) Inspection to report the usage of Java Collections methods on immutable Kotlin Collections +- [`KT-22933`](https://youtrack.jetbrains.com/issue/KT-22933) Intention/inspection to convert Pair constructor to `to` function +- [`KT-19871`](https://youtrack.jetbrains.com/issue/KT-19871) Intentions for specifying use-site targets for an annotation +- [`KT-22971`](https://youtrack.jetbrains.com/issue/KT-22971) Inspection to highlight and remove unnecessary explicit companion object references + +#### Fixes + +- [`KT-12226`](https://youtrack.jetbrains.com/issue/KT-12226) "Convert concatenation to template" does not process `$` sign as a Char +- [`KT-15858`](https://youtrack.jetbrains.com/issue/KT-15858) "Replace with a `foreach` function call" intention breaks code +- [`KT-16332`](https://youtrack.jetbrains.com/issue/KT-16332) Add braces to 'if' statement intention does not put end-of-line comment properly into braces +- [`KT-17058`](https://youtrack.jetbrains.com/issue/KT-17058) "Create implementations from headers": each implementation gets own file +- [`KT-17306`](https://youtrack.jetbrains.com/issue/KT-17306) Don't report package name mismatch if there's no Java code in the module +- [`KT-19730`](https://youtrack.jetbrains.com/issue/KT-19730) Quickfix for delegated properties boilerplate generation doesn't work on locals +- [`KT-21005`](https://youtrack.jetbrains.com/issue/KT-21005) "Missing KDoc inspection" is broken +- [`KT-21082`](https://youtrack.jetbrains.com/issue/KT-21082) "Create actual declaration" of top-level subclass of expected `sealed class` in the same file as actual declaration of sealed class present +- [`KT-22110`](https://youtrack.jetbrains.com/issue/KT-22110) "Can be joined with assignment" inspection underlining extends into comment +- [`KT-22329`](https://youtrack.jetbrains.com/issue/KT-22329) "Create class" quickfix is not suggested in `when` branch +- [`KT-22428`](https://youtrack.jetbrains.com/issue/KT-22428) Create member function from usage shouldn't present type parameters as options +- [`KT-22492`](https://youtrack.jetbrains.com/issue/KT-22492) "Specify explicit lambda signature" intention is available only on lambda braces +- [`KT-22719`](https://youtrack.jetbrains.com/issue/KT-22719) Incorrect warning 'Redundant semicolon' when having method call before lambda expression +- [`KT-22861`](https://youtrack.jetbrains.com/issue/KT-22861) "Add annotation target" quickfix is not available on annotation with use site target +- [`KT-22862`](https://youtrack.jetbrains.com/issue/KT-22862) "Add annotation target" quickfix does not process existent annotations with use site target +- [`KT-22917`](https://youtrack.jetbrains.com/issue/KT-22917) Update order of containers for `create class` quickfix +- [`KT-22949`](https://youtrack.jetbrains.com/issue/KT-22949) NPE on conversion of `run`/`apply` with explicit lambda signature to `let`/`also` +- [`KT-22950`](https://youtrack.jetbrains.com/issue/KT-22950) Convert stdlib extension function to scoping function works incorrectly in case of explicit lambda signature +- [`KT-22954`](https://youtrack.jetbrains.com/issue/KT-22954) "Sort modifiers" quickfix works incorrectly when method is annotated +- [`KT-22970`](https://youtrack.jetbrains.com/issue/KT-22970) Add explicit this intention/inspection missing for lambda invocation +- [`KT-23109`](https://youtrack.jetbrains.com/issue/KT-23109) "Remove redundant 'if' statement" inspection breaks code with labeled return +- [`KT-23215`](https://youtrack.jetbrains.com/issue/KT-23215) "Add function to supertype" quickfix works incorrectly +- [`KT-14270`](https://youtrack.jetbrains.com/issue/KT-14270) Intentions "Add/Remove braces" should be applied to the statement where caret is if there several nested statements one into another +- [`KT-21743`](https://youtrack.jetbrains.com/issue/KT-21743) Method reference not correctly moved into parentheses +- [`KT-23045`](https://youtrack.jetbrains.com/issue/KT-23045) AE “Failed to create expression from text” on concatenating string with broken quote mark char literal +- [`KT-23046`](https://youtrack.jetbrains.com/issue/KT-23046) CCE ”KtBinaryExpression cannot be cast to KtStringTemplateExpression” on concatenating broken quote mark char literal with string +- [`KT-23227`](https://youtrack.jetbrains.com/issue/KT-23227) "Add annotation target" quickfix is not suggested for `field:` use-site target + +### IDE. Refactorings + +#### Fixes + +- [`KT-13255`](https://youtrack.jetbrains.com/issue/KT-13255) Refactor / Rename: renaming local variable or class to existing name gives no warning +- [`KT-13284`](https://youtrack.jetbrains.com/issue/KT-13284) Refactor / Rename: superfluous imports and FQNs in Java using `@JvmOverloads` functions +- [`KT-13907`](https://youtrack.jetbrains.com/issue/KT-13907) Rename refactoring warns about name conflict if there is function with different signature but the same name +- [`KT-13986`](https://youtrack.jetbrains.com/issue/KT-13986) Full qualified names of classes in comments should be changed after class Move, if comment contains backquotes +- [`KT-14671`](https://youtrack.jetbrains.com/issue/KT-14671) `typealias`: refactor/rename should propose to rename occurrences in comments +- [`KT-15039`](https://youtrack.jetbrains.com/issue/KT-15039) Extra usage is found for a parameter in data class in destructuring construction +- [`KT-15228`](https://youtrack.jetbrains.com/issue/KT-15228) Extract function from inline function should create public function +- [`KT-15302`](https://youtrack.jetbrains.com/issue/KT-15302) Reference to typealias in SAM conversion is not found +- [`KT-16510`](https://youtrack.jetbrains.com/issue/KT-16510) Can't rename quoted identifier `is` +- [`KT-17827`](https://youtrack.jetbrains.com/issue/KT-17827) Refactor / Move corrupts bound references when containing class of member element is changed +- [`KT-19561`](https://youtrack.jetbrains.com/issue/KT-19561) Name conflict warning when renaming method to a name matching an extension method with the same name exists +- [`KT-20178`](https://youtrack.jetbrains.com/issue/KT-20178) Refactor → Rename can't make companion object name empty +- [`KT-22282`](https://youtrack.jetbrains.com/issue/KT-22282) Moving a Kotlin file to another package does not change imports in itself +- [`KT-22482`](https://youtrack.jetbrains.com/issue/KT-22482) Rename refactoring insert qualifier for non related property call +- [`KT-22661`](https://youtrack.jetbrains.com/issue/KT-22661) Refactor/Move: top level field reference is not imported automatically after move to the source root +- [`KT-22678`](https://youtrack.jetbrains.com/issue/KT-22678) Refactor / Copy: "Class uses constructor which will be inaccessible after move" when derived class has a protected constructor +- [`KT-22692`](https://youtrack.jetbrains.com/issue/KT-22692) Refactor/Move: unnecessary curly braces added on moving to a separate file a top level function with a top level field usage +- [`KT-22745`](https://youtrack.jetbrains.com/issue/KT-22745) Refactor/Move inserts FQ function name at the call site if there is a field same named as the function +- [`KT-22747`](https://youtrack.jetbrains.com/issue/KT-22747) Moving top-level function to a different (existing) file doesn't update references from Java +- [`KT-22751`](https://youtrack.jetbrains.com/issue/KT-22751) Refactor/Rename: type alias name clash is not reported +- [`KT-22769`](https://youtrack.jetbrains.com/issue/KT-22769) Refactor/Move: there is no warning on moving sealed class or its inheritors to another file +- [`KT-22771`](https://youtrack.jetbrains.com/issue/KT-22771) Refactor/Move: there is no warning on moving nested class to another class with stricter visibility +- [`KT-22812`](https://youtrack.jetbrains.com/issue/KT-22812) Refactor/Rename extension functions incorrectly conflicts with other extension functions +- [`KT-23065`](https://youtrack.jetbrains.com/issue/KT-23065) Refactor/Move: Specify the warning message on moving sealed class inheritors without moving the sealed class itself + +### IDE. Script + +- [`KT-22647`](https://youtrack.jetbrains.com/issue/KT-22647) Run script Action in IDE should use Kotlin compiler from the IDE plugin +- [`KT-18930`](https://youtrack.jetbrains.com/issue/KT-18930) IDEA is unstable With Gradle Kotlin DSL +- [`KT-21042`](https://youtrack.jetbrains.com/issue/KT-21042) Gradle Script Kotlin project is full-red +- [`KT-11618`](https://youtrack.jetbrains.com/issue/KT-11618) Running .kts file from IntelliJ IDEA doesn't allow to import classes in other files which are also part of the project + + +### IDE. Debugger + +- [`KT-22205`](https://youtrack.jetbrains.com/issue/KT-22205) Breakpoints won't work for Kotlin testing with JUnit + +### JavaScript + +- [`KT-22019`](https://youtrack.jetbrains.com/issue/KT-22019) Fix wrong list sorting order + +### Tools. CLI + +- [`KT-22777`](https://youtrack.jetbrains.com/issue/KT-22777) Unstable language version setting has no effect when attached runtime has lower version + +### Tools. Gradle + +- [`KT-22824`](https://youtrack.jetbrains.com/issue/KT-22824) `expectedBy` dependency should be expressed as `compile` dependency in POM +- [`KT-15371`](https://youtrack.jetbrains.com/issue/KT-15371) Multiplatform: setting free compiler args can break build +- [`KT-22864`](https://youtrack.jetbrains.com/issue/KT-22864) Allow multiple expectedBy configuration dependencies in Gradle +- [`KT-22895`](https://youtrack.jetbrains.com/issue/KT-22895) 'kotlin-runtime' library is missing in the compiler classpath sometimes +- [`KT-23085`](https://youtrack.jetbrains.com/issue/KT-23085) Use proper names for the Gradle task inputs/outputs added at runtime +- [`KT-23694`](https://youtrack.jetbrains.com/issue/KT-23694) Fix parallel build in Kotlin IC – invalid KotlinCoreEnvironment disposal + +### Tools. Android +- Android Extensions: Support fragments from kotlinx package; + +### Tools. Incremental Compile + +- [`KT-20516`](https://youtrack.jetbrains.com/issue/KT-20516) "Unresolved reference" when project declares same class as its dependency +- [`KT-22542`](https://youtrack.jetbrains.com/issue/KT-22542) "Source file or directory not found" for incremental compilation with Kobalt +- [`KT-23165`](https://youtrack.jetbrains.com/issue/KT-23165) Incremental compilation is sometimes broken after moving one class + +### Tools. JPS + +- [`KT-16091`](https://youtrack.jetbrains.com/issue/KT-16091) Incremental compilation ignores changes in Java static field +- [`KT-22995`](https://youtrack.jetbrains.com/issue/KT-22995) EA-91869 - NA: `LookupStorage.` + +### Tools. kapt + +- [`KT-21735`](https://youtrack.jetbrains.com/issue/KT-21735) Kapt cache was not cleared sometimes + +### Tools. REPL + +- [`KT-21611`](https://youtrack.jetbrains.com/issue/KT-21611) REPL: Empty lines should be ignored + +## 1.2.30 + +### Android + +- [`KT-19300`](https://youtrack.jetbrains.com/issue/KT-19300) [AS3.0] Android extensions, Parcelable: editor shows warning about incomplete implementation on a class with Parcelize annotation +- [`KT-22168`](https://youtrack.jetbrains.com/issue/KT-22168) "Kotlin Android | Illegal Android Identifier" inspection reports non-instrumentation unit tests +- [`KT-22700`](https://youtrack.jetbrains.com/issue/KT-22700) Android Extensions bind views with dot in ID + +### Compiler + +#### New Features + +- [`KT-17336`](https://youtrack.jetbrains.com/issue/KT-17336) Introduce suspendCoroutineUninterceptedOrReturn coroutine intrinsic function +- [`KT-22766`](https://youtrack.jetbrains.com/issue/KT-22766) Imitate "suspend" modifier in 1.2.x by stdlib function + +#### Performance Improvements + +- [`KT-16880`](https://youtrack.jetbrains.com/issue/KT-16880) Smarter detection of tail-suspending unit invocations +#### Fixes + +- [`KT-10494`](https://youtrack.jetbrains.com/issue/KT-10494) IAE in CheckMethodAdapter.checkInternalName when declaring classes inside method with non-standard name +- [`KT-16079`](https://youtrack.jetbrains.com/issue/KT-16079) Internal error when using suspend operator plus +- [`KT-18522`](https://youtrack.jetbrains.com/issue/KT-18522) Internal compiler error with IndexOutOfBoundsException, "Exception while analyzing expression" +- [`KT-18578`](https://youtrack.jetbrains.com/issue/KT-18578) Compilation failure with @JsonInclude and default interface method +- [`KT-19786`](https://youtrack.jetbrains.com/issue/KT-19786) Kotlin — unable to override a Java function with @Nullable vararg argument +- [`KT-20466`](https://youtrack.jetbrains.com/issue/KT-20466) JSR305 false positive for elvis operator +- [`KT-20705`](https://youtrack.jetbrains.com/issue/KT-20705) Tail suspend call optimization doesn't work in when block +- [`KT-20708`](https://youtrack.jetbrains.com/issue/KT-20708) Tail suspend call optiomization doesn't work in some branches +- [`KT-20855`](https://youtrack.jetbrains.com/issue/KT-20855) Unnecessary safe-call reported on nullable type +- [`KT-21165`](https://youtrack.jetbrains.com/issue/KT-21165) Exception from suspending function is not caught +- [`KT-21238`](https://youtrack.jetbrains.com/issue/KT-21238) Nonsensical warning "Expected type does not accept nulls in Java, but the value may be null in Kotlin" +- [`KT-21258`](https://youtrack.jetbrains.com/issue/KT-21258) Raw backing field value exposed via accessors? +- [`KT-21303`](https://youtrack.jetbrains.com/issue/KT-21303) Running on JDK-10-ea-31 leads to ArrayIndexOutOfBoundsException +- [`KT-21642`](https://youtrack.jetbrains.com/issue/KT-21642) Back-end (JVM) Internal error: Couldn't transform method node on using `open` keyword with `suspend` for a top-level function +- [`KT-21759`](https://youtrack.jetbrains.com/issue/KT-21759) Compiler crashes on two subsequent return statements in suspend function +- [`KT-22029`](https://youtrack.jetbrains.com/issue/KT-22029) Fold list to pair with destructuring assignment and inner when results in Exception +- [`KT-22345`](https://youtrack.jetbrains.com/issue/KT-22345) OOM in ReturnUnitMethodReplacer +- [`KT-22410`](https://youtrack.jetbrains.com/issue/KT-22410) invalid compiler optimization for nullable cast to reified type +- [`KT-22577`](https://youtrack.jetbrains.com/issue/KT-22577) Compiler crashes when coroutineContext is used inside of inlined lambda + +### IDE + +#### New Features + +- [`KT-8352`](https://youtrack.jetbrains.com/issue/KT-8352) Pasting Kotlin code into package could create .kt file +- [`KT-16710`](https://youtrack.jetbrains.com/issue/KT-16710) Run configuration to run main() as a Node CLI app +- [`KT-16833`](https://youtrack.jetbrains.com/issue/KT-16833) Allow mixing Java and Kotlin code in "Analyze Data Flow..." +- [`KT-21531`](https://youtrack.jetbrains.com/issue/KT-21531) JS: add support for running specific test from the gutter icon with Jest testing framework +#### Performance Improvements + +- [`KT-21450`](https://youtrack.jetbrains.com/issue/KT-21450) Add caching for Module.languageVersionSettings +- [`KT-21517`](https://youtrack.jetbrains.com/issue/KT-21517) OOME during find usages +#### Fixes + +- [`KT-7316`](https://youtrack.jetbrains.com/issue/KT-7316) Go to declaration in Kotlin JavaScript project navigates to JDK source in some cases +- [`KT-8563`](https://youtrack.jetbrains.com/issue/KT-8563) Refactor / Rename inserts line breaks without reason +- [`KT-11467`](https://youtrack.jetbrains.com/issue/KT-11467) Editor: `var` property in primary constructor is shown not underscored, same as `val` +- [`KT-13509`](https://youtrack.jetbrains.com/issue/KT-13509) Don't show run line markers for top-level functions annotated with @Test +- [`KT-13971`](https://youtrack.jetbrains.com/issue/KT-13971) Kotlin Bytecode tool window: Decompile is available for incompilable code, CE at MemberCodegen.genFunctionOrProperty() +- [`KT-15000`](https://youtrack.jetbrains.com/issue/KT-15000) Do not spell check overridden declaration names +- [`KT-15331`](https://youtrack.jetbrains.com/issue/KT-15331) "Kotlin not configured" notification always shown for common module in multiplatform project +- [`KT-16333`](https://youtrack.jetbrains.com/issue/KT-16333) Cannot navigate to super declaration via shortcut +- [`KT-16976`](https://youtrack.jetbrains.com/issue/KT-16976) Introduce special SDK for Kotlin JS projects to avoid using JDK +- [`KT-18445`](https://youtrack.jetbrains.com/issue/KT-18445) multiplatform project: provide more comfortable way to process cases when there are missed method implemenation in the implementation class +- [`KT-19194`](https://youtrack.jetbrains.com/issue/KT-19194) Some Live Templates should probably be enabled also for "expressions" not only "statements" +- [`KT-20281`](https://youtrack.jetbrains.com/issue/KT-20281) multiplatform:Unresolved service JavaDescriptorResolver on a file with several header declarations and gutters not shown +- [`KT-20470`](https://youtrack.jetbrains.com/issue/KT-20470) IntelliJ indent guide/invisible brace matching hint tooltip doesn't show context +- [`KT-20522`](https://youtrack.jetbrains.com/issue/KT-20522) Add "Build" action in "Before launch" block when create new JS run configuration (for test) +- [`KT-20915`](https://youtrack.jetbrains.com/issue/KT-20915) Add quickfix for ‘Implicit (unsafe) cast from dynamic type’ +- [`KT-20971`](https://youtrack.jetbrains.com/issue/KT-20971) Cannot navigate to sources of compiled common dependency +- [`KT-21115`](https://youtrack.jetbrains.com/issue/KT-21115) Incomplete actual class should still have navigation icon to expect class +- [`KT-21688`](https://youtrack.jetbrains.com/issue/KT-21688) UIdentifier violates JvmDeclarationElement contract +- [`KT-21874`](https://youtrack.jetbrains.com/issue/KT-21874) Unexpected IDE error "Unknown type [typealias ...]" +- [`KT-21958`](https://youtrack.jetbrains.com/issue/KT-21958) Support "Alternative source available" for Kotlin files +- [`KT-21994`](https://youtrack.jetbrains.com/issue/KT-21994) Collapsed comments containing `*` get removed in the summary line. +- [`KT-22179`](https://youtrack.jetbrains.com/issue/KT-22179) For properties overridden in object literals, navigation to inherited properties is missing indication of a type they are overridden +- [`KT-22214`](https://youtrack.jetbrains.com/issue/KT-22214) Front-end Internal error: Failed to analyze declaration +- [`KT-22230`](https://youtrack.jetbrains.com/issue/KT-22230) Reformatting code to Kotlin style indents top-level typealiases with comments +- [`KT-22242`](https://youtrack.jetbrains.com/issue/KT-22242) Semantic highlighting uses different colors for the same 'it' variable and same color for different 'it's +- [`KT-22301`](https://youtrack.jetbrains.com/issue/KT-22301) Don't require space after label for lambda +- [`KT-22346`](https://youtrack.jetbrains.com/issue/KT-22346) Incorrect indentation for chained context extension functions (lambdas) when using Kotlin style guide +- [`KT-22356`](https://youtrack.jetbrains.com/issue/KT-22356) Update status of inspection "Kotlin JVM compiler configured but no stdlib dependency" after pom file update, not on re-import +- [`KT-22360`](https://youtrack.jetbrains.com/issue/KT-22360) MPP: with "Create separate module per source set" = No `expectedBy` dependency is imported not transitively +- [`KT-22374`](https://youtrack.jetbrains.com/issue/KT-22374) "Join lines" works incorrectly in case of line containing more than one string literal +- [`KT-22473`](https://youtrack.jetbrains.com/issue/KT-22473) Regression in IntelliJ Kotlin Plugin 1.2.20, settings.gradle.kts script template is wrong +- [`KT-22508`](https://youtrack.jetbrains.com/issue/KT-22508) Auto-formatting should insert an indentation for default parameter values +- [`KT-22514`](https://youtrack.jetbrains.com/issue/KT-22514) IDE Freeze related to IdeAllOpenDeclarationAttributeAltererExtension.getAnnotationFqNames() +- [`KT-22557`](https://youtrack.jetbrains.com/issue/KT-22557) Dead 'Apply' button, when setting code style +- [`KT-22565`](https://youtrack.jetbrains.com/issue/KT-22565) Cant do `PsiAnchor.create` on annotation in annotation +- [`KT-22570`](https://youtrack.jetbrains.com/issue/KT-22570) Can't add import in "Packages to Use Import with '*'" section on "Import" tab in Code Style -> Kotlin +- [`KT-22593`](https://youtrack.jetbrains.com/issue/KT-22593) AE when invoking find usages on constructor in decompiled java file +- [`KT-22641`](https://youtrack.jetbrains.com/issue/KT-22641) Auto-formatting adds extra indent to a closing square bracket on a separate line +- [`KT-22734`](https://youtrack.jetbrains.com/issue/KT-22734) LinkageError: "loader constraint violation: when resolving method PsiTreeUtilKt.parentOfType()" at KotlinConverter.convertPsiElement$uast_kotlin() + +### IDE. Debugger + +- [`KT-20351`](https://youtrack.jetbrains.com/issue/KT-20351) Stepping over a line with two inline stdlib functions steps into the second function +- [`KT-21312`](https://youtrack.jetbrains.com/issue/KT-21312) Confusing Kotlin (JavaScript) run configuration +- [`KT-21945`](https://youtrack.jetbrains.com/issue/KT-21945) Double stop on same line during step over if inline call is present +- [`KT-22967`](https://youtrack.jetbrains.com/issue/KT-22967) Debugger: Evaluator fails on evaluating huge lambdas on Android + +### IDE. Inspections and Intentions + +#### New Features + +- [`KT-18124`](https://youtrack.jetbrains.com/issue/KT-18124) Inspection to get rid of unnecessary ticks in references +- [`KT-22038`](https://youtrack.jetbrains.com/issue/KT-22038) Inspection to replace the usage of Java Collections methods on subtypes of MutableList with the methods from Kotlin stdlib +- [`KT-22152`](https://youtrack.jetbrains.com/issue/KT-22152) "Create Class" quickfix should support creating the class in a new file and selecting the package for that file +- [`KT-22171`](https://youtrack.jetbrains.com/issue/KT-22171) Add Intention for single character substring +- [`KT-22303`](https://youtrack.jetbrains.com/issue/KT-22303) Inspection to detect `Type!.inlineWithNotNullReceiver()` calls +- [`KT-22409`](https://youtrack.jetbrains.com/issue/KT-22409) Intention for changing property setter accessibility +#### Performance Improvements + +- [`KT-21137`](https://youtrack.jetbrains.com/issue/KT-21137) Kotlin instantiates something expensive via reflection when highlighting Java file +#### Fixes + +- [`KT-15176`](https://youtrack.jetbrains.com/issue/KT-15176) Remove "Create type alias" intention when called on java class +- [`KT-18007`](https://youtrack.jetbrains.com/issue/KT-18007) Inspection doesn't suggest Maven Plugin for kotlin-stdlib-jre8 +- [`KT-18308`](https://youtrack.jetbrains.com/issue/KT-18308) 'Remove braces from else statement' intention breaks code +- [`KT-18912`](https://youtrack.jetbrains.com/issue/KT-18912) multiplatform project: Convert to enum class: header sealed class cannot convert nested objects to enum values +- [`KT-21114`](https://youtrack.jetbrains.com/issue/KT-21114) IOE: create actual members for expected with companion +- [`KT-21600`](https://youtrack.jetbrains.com/issue/KT-21600) `suspend` modifier should go after `override` in overridden suspend functions +- [`KT-21881`](https://youtrack.jetbrains.com/issue/KT-21881) Replace "If" with safe access intention false positive +- [`KT-22054`](https://youtrack.jetbrains.com/issue/KT-22054) Replace '!=' with 'contentEquals' should be replace '==' with 'contentEquals' +- [`KT-22097`](https://youtrack.jetbrains.com/issue/KT-22097) Redundant Unit inspection false positive for single expression function +- [`KT-22159`](https://youtrack.jetbrains.com/issue/KT-22159) "Replace return with 'if' expression" should not place return before expressions of type Nothing +- [`KT-22167`](https://youtrack.jetbrains.com/issue/KT-22167) "Add annotation target" quick fix does nothing and disappears from menu +- [`KT-22221`](https://youtrack.jetbrains.com/issue/KT-22221) QuickFix to remove unused constructor parameters shouldn't delete parenthesis +- [`KT-22335`](https://youtrack.jetbrains.com/issue/KT-22335) IOE from KotlinUnusedImportInspection.scheduleOptimizeImportsOnTheFly +- [`KT-22339`](https://youtrack.jetbrains.com/issue/KT-22339) Remove setter parameter type: error while creating problem descriptor +- [`KT-22364`](https://youtrack.jetbrains.com/issue/KT-22364) Redundant setter is not reported for overridden fields +- [`KT-22484`](https://youtrack.jetbrains.com/issue/KT-22484) The warning highlight for redundant `!is`check for object types isn't extended to the full operator +- [`KT-22538`](https://youtrack.jetbrains.com/issue/KT-22538) "Redundant type checks for object" inspection application breaks smart cast for an object's field or function + +### IDE. Refactorings + +#### New Features + +- [`KT-17047`](https://youtrack.jetbrains.com/issue/KT-17047) Refactorings for related standard "scoping functions" conversion: 'let' <-> 'run', 'apply' <-> 'also' +#### Fixes + +- [`KT-12365`](https://youtrack.jetbrains.com/issue/KT-12365) Renaming `invoke` function should remove `operator` modifier and insert function call for implicit usages +- [`KT-17977`](https://youtrack.jetbrains.com/issue/KT-17977) Move class to upper level creates file with wrong file name +- [`KT-21719`](https://youtrack.jetbrains.com/issue/KT-21719) Actual typealias not renamed on expected declaration rename +- [`KT-22200`](https://youtrack.jetbrains.com/issue/KT-22200) Overriden function generated from completion is missing suspend modifier +- [`KT-22359`](https://youtrack.jetbrains.com/issue/KT-22359) Refactor / Rename file: Throwable at RenameProcessor.performRefactoring() +- [`KT-22461`](https://youtrack.jetbrains.com/issue/KT-22461) Rename doesn't work on private top-level members of multi-file parts +- [`KT-22476`](https://youtrack.jetbrains.com/issue/KT-22476) Rename `it` parameter fails after replacing for-each with mapNotNull +- [`KT-22564`](https://youtrack.jetbrains.com/issue/KT-22564) Rename doesn't warn for conflicts +- [`KT-22705`](https://youtrack.jetbrains.com/issue/KT-22705) Refactor/Rename: rename of `invoke` function with lambda parameter to `get` breaks an implicit call +- [`KT-22708`](https://youtrack.jetbrains.com/issue/KT-22708) Refactor/Rename function using some stdlib name leads to incompilable code + +### JavaScript + +- [`KT-20735`](https://youtrack.jetbrains.com/issue/KT-20735) JS: kotlin.test-js integration tests terminate build on failure +- [`KT-22638`](https://youtrack.jetbrains.com/issue/KT-22638) Function reference not working in js from extension +- [`KT-22963`](https://youtrack.jetbrains.com/issue/KT-22963) KotlinJS - When statement can cause illegal break + +### Libraries + +- [`KT-22620`](https://youtrack.jetbrains.com/issue/KT-22620) Add support for TestNG in kotlin.test +- [`KT-16661`](https://youtrack.jetbrains.com/issue/KT-16661) Performance overhead in string splitting in Kotlin versus Java? +- [`KT-22042`](https://youtrack.jetbrains.com/issue/KT-22042) Suboptimal `Strings#findAnyOf` +- [`KT-21154`](https://youtrack.jetbrains.com/issue/KT-21154) kotlin-test-junit doesn't provide JUnitAsserter when test body is run in another thread + +### Tools + +- [`KT-22196`](https://youtrack.jetbrains.com/issue/KT-22196) kotlin-compiler-embeddable bundles outdated kotlinx.coroutines since 1.1.60 +- [`KT-22549`](https://youtrack.jetbrains.com/issue/KT-22549) Service is dying during compilation + +### Tools. CLI + +- [`KT-19051`](https://youtrack.jetbrains.com/issue/KT-19051) Suppress Java 9 illegal access warnings + +### Tools. Gradle + +- [`KT-18462`](https://youtrack.jetbrains.com/issue/KT-18462) Add 'org.jetbrains.kotlin.platform.android' plugin. +- [`KT-18821`](https://youtrack.jetbrains.com/issue/KT-18821) Gradle plugin should not resolve dependencies at configuration time + +### Tools. Maven + +- [`KT-21581`](https://youtrack.jetbrains.com/issue/KT-21581) kotlin.compiler.incremental not copying resources + +### Tools. Incremental Compile + +- [`KT-22192`](https://youtrack.jetbrains.com/issue/KT-22192) Make precise java classes tracking in Gradle enabled by default + +### Tools. J2K + +- [`KT-21635`](https://youtrack.jetbrains.com/issue/KT-21635) J2K: create "inspection based post-processing" + +### Tools. REPL + +- [`KT-12037`](https://youtrack.jetbrains.com/issue/KT-12037) REPL crashes when trying to :load with incorrect filename + +### Tools. kapt + +- [`KT-22350`](https://youtrack.jetbrains.com/issue/KT-22350) kdoc comment preceding enum method causes compilation failure +- [`KT-22386`](https://youtrack.jetbrains.com/issue/KT-22386) kapt3 fails when project has class named System +- [`KT-22468`](https://youtrack.jetbrains.com/issue/KT-22468) Kapt fails to convert array type to anonymous array element type +- [`KT-22469`](https://youtrack.jetbrains.com/issue/KT-22469) Kapt 1.2.20+ may fail to process classes with KDoc +- [`KT-22493`](https://youtrack.jetbrains.com/issue/KT-22493) Kapt: NoSuchElementException in KotlinCliJavaFileManagerImpl if class first character is dollar sign +- [`KT-22582`](https://youtrack.jetbrains.com/issue/KT-22582) Kapt: Enums inside enum values should be forbidden +- [`KT-22711`](https://youtrack.jetbrains.com/issue/KT-22711) Deprecate original kapt (aka kapt1) + +## 1.2.21 + +### Fixes + +- [`KT-22349`](https://youtrack.jetbrains.com/issue/KT-22349) Android: creating new Basic activity fails with Throwable: "Inconsistent FILE tree in SingleRootFileViewProvider" at SingleRootFileViewProvider.checkLengthConsistency() +- [`KT-22459`](https://youtrack.jetbrains.com/issue/KT-22459) Remove .proto files from kotlin-reflect.jar + +## 1.2.20 + +### Android + +- [`KT-20085`](https://youtrack.jetbrains.com/issue/KT-20085) Android Extensions: ClassCastException after changing type of view in layout XML +- [`KT-20235`](https://youtrack.jetbrains.com/issue/KT-20235) Error, can't use plugin kotlin-android-extensions +- [`KT-20269`](https://youtrack.jetbrains.com/issue/KT-20269) Mark 'kapt.kotlin.generated' as a source root automatically in Android projects +- [`KT-20545`](https://youtrack.jetbrains.com/issue/KT-20545) Parcelable: Migrate to canonical NEW-DUP-INVOKESPECIAL form +- [`KT-20742`](https://youtrack.jetbrains.com/issue/KT-20742) @Serializable and @Parcelize do not work together +- [`KT-20928`](https://youtrack.jetbrains.com/issue/KT-20928) @Parcelize. Verify Error for Android Api 19 + +### Binary Metadata + +- [`KT-11586`](https://youtrack.jetbrains.com/issue/KT-11586) Support class literal annotation arguments in AnnotationSerializer + +### Compiler + +#### New Features + +- [`KT-17944`](https://youtrack.jetbrains.com/issue/KT-17944) Allow 'expect' final member be implemented by 'actual' open member +- [`KT-21982`](https://youtrack.jetbrains.com/issue/KT-21982) Recognize Checker Framework *declaration* annotations +- [`KT-17609`](https://youtrack.jetbrains.com/issue/KT-17609) Intrinsic suspend val coroutineContext +#### Performance Improvements + +- [`KT-21322`](https://youtrack.jetbrains.com/issue/KT-21322) for-in-char-sequence loop improvements +- [`KT-21323`](https://youtrack.jetbrains.com/issue/KT-21323) Decreasing range loop improvements +#### Fixes + +- [`KT-4174`](https://youtrack.jetbrains.com/issue/KT-4174) Verify error on lambda with closure in local class super call +- [`KT-10473`](https://youtrack.jetbrains.com/issue/KT-10473) Inapplicable diagnostics for mixed JS / JVM projects +- [`KT-12541`](https://youtrack.jetbrains.com/issue/KT-12541) VerifyError: Bad type on operand stack for local variable captured in local class +- [`KT-13454`](https://youtrack.jetbrains.com/issue/KT-13454) VerifyError on capture of outer class properties in closure inside inner class constructor +- [`KT-14148`](https://youtrack.jetbrains.com/issue/KT-14148) `VerifyError: Bad type on operand stack` for anonymous type inheriting inner class +- [`KT-18254`](https://youtrack.jetbrains.com/issue/KT-18254) enumValueOf and enumValues throw UnsupportedOperationException when used within a non-inline function block +- [`KT-18514`](https://youtrack.jetbrains.com/issue/KT-18514) IllegalStateException on compile object that inherits its inner interface or class +- [`KT-18639`](https://youtrack.jetbrains.com/issue/KT-18639) VerifyError: Bad type on operand stack +- [`KT-19188`](https://youtrack.jetbrains.com/issue/KT-19188) Nondeterministic method order in class files using DefaultImpls +- [`KT-19827`](https://youtrack.jetbrains.com/issue/KT-19827) Strange VerifyError in simple Example +- [`KT-19928`](https://youtrack.jetbrains.com/issue/KT-19928) Analyze / Inspect Code: ISE "Concrete fake override public final fun ()" at BridgesKt.findConcreteSuperDeclaration() +- [`KT-20433`](https://youtrack.jetbrains.com/issue/KT-20433) NPE during JVM code generation +- [`KT-20639`](https://youtrack.jetbrains.com/issue/KT-20639) Obsolete term "native" used in error message +- [`KT-20802`](https://youtrack.jetbrains.com/issue/KT-20802) USELESS_CAST diagnostic in functions with expression body +- [`KT-20873`](https://youtrack.jetbrains.com/issue/KT-20873) False CAST_NEVER_SUCCEEDS when upcasting Nothing +- [`KT-20903`](https://youtrack.jetbrains.com/issue/KT-20903) Method reference to expect function results in bogus resolution ambiguity +- [`KT-21105`](https://youtrack.jetbrains.com/issue/KT-21105) Compiler incorrectly optimize the operator `in` with a floating point type range with NaN bound. +- [`KT-21146`](https://youtrack.jetbrains.com/issue/KT-21146) ArrayIndexOutOfBoundsException at org.jetbrains.kotlin.codegen.MemberCodegen.generateMethodCallTo(MemberCodegen.java:841) +- [`KT-21267`](https://youtrack.jetbrains.com/issue/KT-21267) Report pre-release errors if pre-release compiler is run with a release language version +- [`KT-21321`](https://youtrack.jetbrains.com/issue/KT-21321) for-in-array loop improvements +- [`KT-21343`](https://youtrack.jetbrains.com/issue/KT-21343) Compound assignment operator compiles incorrectly when LHS is a property imported from object +- [`KT-21354`](https://youtrack.jetbrains.com/issue/KT-21354) Inconsistent behavior of 'for-in-range' loop if range is an array variable modified in loop body +- [`KT-21532`](https://youtrack.jetbrains.com/issue/KT-21532) Enum constructor not found +- [`KT-21535`](https://youtrack.jetbrains.com/issue/KT-21535) SAM wrapper is not created for a value of functional type in delegating or super constructor call in secondary constructor +- [`KT-21671`](https://youtrack.jetbrains.com/issue/KT-21671) Inline sam wrapper during inline in another module +- [`KT-21919`](https://youtrack.jetbrains.com/issue/KT-21919) Invalid MethodParameters attribute generated for "$DefaultImpls" synthetic class with javaParameters=true +- [`KT-20429`](https://youtrack.jetbrains.com/issue/KT-20429) False-positive 'Unused return value of a function with lambda expression body' in enum constant constructor +- [`KT-21827`](https://youtrack.jetbrains.com/issue/KT-21827) SMAP problem during default lambda parameter inline + +### IDE + +#### New Features + +- [`KT-4001`](https://youtrack.jetbrains.com/issue/KT-4001) Allow to set arguments indent to 1 tab (currently two and not customized) +- [`KT-13378`](https://youtrack.jetbrains.com/issue/KT-13378) Provide ability to configure highlighting for !! in expressions and ? in types +- [`KT-17928`](https://youtrack.jetbrains.com/issue/KT-17928) Support code folding for primary constructors +- [`KT-20591`](https://youtrack.jetbrains.com/issue/KT-20591) Show @StringRes/@IntegerRes annotations in parameter info +- [`KT-20952`](https://youtrack.jetbrains.com/issue/KT-20952) "Navigate | Related symbol" should support expect/actual navigation +- [`KT-21229`](https://youtrack.jetbrains.com/issue/KT-21229) Make it possible to explicitly select "latest" language/API version +- [`KT-21469`](https://youtrack.jetbrains.com/issue/KT-21469) Wrap property initializers after equals sign +- [`KT-14670`](https://youtrack.jetbrains.com/issue/KT-14670) Support kotlinPackageName() macro in live templates +- [`KT-14951`](https://youtrack.jetbrains.com/issue/KT-14951) Editor: navigate actions could be available in intention menu (as done in Java) +- [`KT-15320`](https://youtrack.jetbrains.com/issue/KT-15320) Live templates: Add function which returns the "outer" class name +- [`KT-20067`](https://youtrack.jetbrains.com/issue/KT-20067) Return label hints +- [`KT-20533`](https://youtrack.jetbrains.com/issue/KT-20533) Show "this" and "it" type hints in lambdas. +- [`KT-20614`](https://youtrack.jetbrains.com/issue/KT-20614) Change location of initial parameter type hint when parameters are on multiple lines +- [`KT-21949`](https://youtrack.jetbrains.com/issue/KT-21949) Please add a separate Color Scheme settings for properties synthesized from Java accessors +- [`KT-21974`](https://youtrack.jetbrains.com/issue/KT-21974) Editor color scheme option for Kotlin typealias names +#### Performance Improvements + +- [`KT-17367`](https://youtrack.jetbrains.com/issue/KT-17367) Rebuild requested for index KotlinJavaScriptMetaFileIndex +- [`KT-21632`](https://youtrack.jetbrains.com/issue/KT-21632) Freezing on typing +- [`KT-21701`](https://youtrack.jetbrains.com/issue/KT-21701) IDEA 2017.3 high CPU usage +#### Fixes + +- [`KT-9562`](https://youtrack.jetbrains.com/issue/KT-9562) Wrong indent after Enter after an annotation +- [`KT-12176`](https://youtrack.jetbrains.com/issue/KT-12176) Formatter could reformat long primary constructors +- [`KT-12862`](https://youtrack.jetbrains.com/issue/KT-12862) Formatting: Weird wrapping setting for long ?: operator +- [`KT-15099`](https://youtrack.jetbrains.com/issue/KT-15099) Odd code formatting when chaining lambdas and splitting lines on operators +- [`KT-15254`](https://youtrack.jetbrains.com/issue/KT-15254) Use Platform icons for "Run" icon in gutter +- [`KT-17254`](https://youtrack.jetbrains.com/issue/KT-17254) Remove obsolete unfold-icons in structure view +- [`KT-17838`](https://youtrack.jetbrains.com/issue/KT-17838) Can't report exceptions from the Kotlin plugin 1.1.4-dev-119 in IDEA #IU-171.4424.37 +- [`KT-17843`](https://youtrack.jetbrains.com/issue/KT-17843) Don't show parameter name hints when calling Java methods with unknown parameter names +- [`KT-17964`](https://youtrack.jetbrains.com/issue/KT-17964) Local variable type hints in editor for anonymous object +- [`KT-17965`](https://youtrack.jetbrains.com/issue/KT-17965) Do not shown argument name hints for assert +- [`KT-18829`](https://youtrack.jetbrains.com/issue/KT-18829) Do not show parameter name hints for mapOf +- [`KT-18839`](https://youtrack.jetbrains.com/issue/KT-18839) Semantic highlighting not work for local variables in init +- [`KT-19012`](https://youtrack.jetbrains.com/issue/KT-19012) Data Flow from here: doesn't find template usages +- [`KT-19017`](https://youtrack.jetbrains.com/issue/KT-19017) Data Flow from here doesn't find usage in range position of for cycle +- [`KT-19018`](https://youtrack.jetbrains.com/issue/KT-19018) Data Flow from here doesn't find any usages of for-variable +- [`KT-19036`](https://youtrack.jetbrains.com/issue/KT-19036) Data Flow from here: please find calls of extension too +- [`KT-19039`](https://youtrack.jetbrains.com/issue/KT-19039) Data Flow from here: please find cases when an investigated variable is transferred as a parameter into a library function +- [`KT-19087`](https://youtrack.jetbrains.com/issue/KT-19087) Data flow to here: usages with explicit receiver are not found +- [`KT-19089`](https://youtrack.jetbrains.com/issue/KT-19089) Data Flow to here: assigned values are not found if an investigated property is a delegated one +- [`KT-19104`](https://youtrack.jetbrains.com/issue/KT-19104) Data Flow from here: usage of parameter or variable not found when used as lambda receiver/parameter +- [`KT-19106`](https://youtrack.jetbrains.com/issue/KT-19106) Data Flow from here: show point of call of a function used as a parameter investigated parameter/variable +- [`KT-19112`](https://youtrack.jetbrains.com/issue/KT-19112) Data Flow to here for a function (or its return value) doesn't find shorten forms of assignments +- [`KT-19519`](https://youtrack.jetbrains.com/issue/KT-19519) Structure view is not updated properly for function classes +- [`KT-19727`](https://youtrack.jetbrains.com/issue/KT-19727) Code style: New line after '(' with anonymous object or multi-line lambda unexpected behavior +- [`KT-19820`](https://youtrack.jetbrains.com/issue/KT-19820) Strange highlightning for enum constructor +- [`KT-19823`](https://youtrack.jetbrains.com/issue/KT-19823) Kotlin Gradle project import into IntelliJ: import kapt generated classes into classpath +- [`KT-19824`](https://youtrack.jetbrains.com/issue/KT-19824) Please provide a separate icon for a common library +- [`KT-19915`](https://youtrack.jetbrains.com/issue/KT-19915) TODO calls not blue highlighted in lambdas/DSLs +- [`KT-20096`](https://youtrack.jetbrains.com/issue/KT-20096) Kotlin Gradle script: SOE after beginning of Pair definition before some script section +- [`KT-20314`](https://youtrack.jetbrains.com/issue/KT-20314) Kotlin formatter does not respect annotations code style settings +- [`KT-20329`](https://youtrack.jetbrains.com/issue/KT-20329) Multiplatform: gutter "Is subclassed by" should show expect subclass from the common module +- [`KT-20380`](https://youtrack.jetbrains.com/issue/KT-20380) Configure Kotlin plugin updates dialog does not open without opened project +- [`KT-20521`](https://youtrack.jetbrains.com/issue/KT-20521) Kotlin Gradle script: valid build.gradle.kts is red and becomes normal only after reopening the project +- [`KT-20603`](https://youtrack.jetbrains.com/issue/KT-20603) Facet import: when API version > language version, set API version = language version, not to 1.0 +- [`KT-20782`](https://youtrack.jetbrains.com/issue/KT-20782) Non-atomic trees update +- [`KT-20813`](https://youtrack.jetbrains.com/issue/KT-20813) SAM with receiver: call with SAM usage is compiled with Gradle, but not with JPS +- [`KT-20880`](https://youtrack.jetbrains.com/issue/KT-20880) Add documentation quick fix should create multiline comment and place caret in right place +- [`KT-20883`](https://youtrack.jetbrains.com/issue/KT-20883) Provide more information in "Missing documentation" inspection message +- [`KT-20884`](https://youtrack.jetbrains.com/issue/KT-20884) Functions with receivers should allow [this] in KDoc +- [`KT-20937`](https://youtrack.jetbrains.com/issue/KT-20937) Exception thrown on RMB click on folder in Kotlin project +- [`KT-20938`](https://youtrack.jetbrains.com/issue/KT-20938) IDE: kotlinc.xml with KotlinCommonCompilerArguments/freeArgs: XSE: "Cannot deserialize class CommonCompilerArguments$DummyImpl" at BaseKotlinCompilerSettings.loadState() +- [`KT-20953`](https://youtrack.jetbrains.com/issue/KT-20953) "Choose actual" popup shows redundant information +- [`KT-20985`](https://youtrack.jetbrains.com/issue/KT-20985) Additional reimport is required in 2017.3/2018.1 idea after creating or importing mp project +- [`KT-20987`](https://youtrack.jetbrains.com/issue/KT-20987) (PerModulePackageCache miss) ISE: diagnoseMissingPackageFragment +- [`KT-21002`](https://youtrack.jetbrains.com/issue/KT-21002) "Highlight usages of identifier under caret" should work for "it" +- [`KT-21076`](https://youtrack.jetbrains.com/issue/KT-21076) Recursive Companion.ivoke() call should be marked with according icon +- [`KT-21132`](https://youtrack.jetbrains.com/issue/KT-21132) containsKey() in SoftValueMap considered pointless +- [`KT-21150`](https://youtrack.jetbrains.com/issue/KT-21150) Do not infer compiler version from build.txt +- [`KT-21200`](https://youtrack.jetbrains.com/issue/KT-21200) Improve Structure-view for Kotlin files +- [`KT-21214`](https://youtrack.jetbrains.com/issue/KT-21214) Fix funcion selection in kotlin +- [`KT-21275`](https://youtrack.jetbrains.com/issue/KT-21275) Don't show argument name hints in calls of methods on 'dynamic' type +- [`KT-21318`](https://youtrack.jetbrains.com/issue/KT-21318) Highlighting of function exit points does not work if the function is a getter for property +- [`KT-21363`](https://youtrack.jetbrains.com/issue/KT-21363) IDE: kotlinc.xml with KotlinCommonCompilerArguments: build fails with UOE: "Operation is not supported for read-only collection" at EmptyList.clear() +- [`KT-21409`](https://youtrack.jetbrains.com/issue/KT-21409) UAST: Super-call arguments are not modeled/visited +- [`KT-21418`](https://youtrack.jetbrains.com/issue/KT-21418) Gradle based project in IDEA 181: Kotlin facets are not created +- [`KT-21441`](https://youtrack.jetbrains.com/issue/KT-21441) Folding multiline strings adds a space at the start if there is not one. +- [`KT-21546`](https://youtrack.jetbrains.com/issue/KT-21546) java.lang.IllegalArgumentException: Unexpected container fatal IDE error +- [`KT-21575`](https://youtrack.jetbrains.com/issue/KT-21575) Secondary constructor call body is missing +- [`KT-21645`](https://youtrack.jetbrains.com/issue/KT-21645) Weird parameter hint position +- [`KT-21733`](https://youtrack.jetbrains.com/issue/KT-21733) Structure view is not updated +- [`KT-21756`](https://youtrack.jetbrains.com/issue/KT-21756) Find Usages for "type" in ts2kt provokes exception +- [`KT-21770`](https://youtrack.jetbrains.com/issue/KT-21770) Pasting $this into an interpolated string shouldn't escape $ +- [`KT-21833`](https://youtrack.jetbrains.com/issue/KT-21833) Type hints shown when destructing triple with type parameters +- [`KT-21852`](https://youtrack.jetbrains.com/issue/KT-21852) Custom API version is lost when settings are reopen after restarting IDE +- [`KT-11503`](https://youtrack.jetbrains.com/issue/KT-11503) cmd+shift+enter action in .kt files does not work on empty lines +- [`KT-17217`](https://youtrack.jetbrains.com/issue/KT-17217) Navigate to symbol: hard to choose between a lot of extension overloads +- [`KT-18674`](https://youtrack.jetbrains.com/issue/KT-18674) Join Lines should join strings +- [`KT-19524`](https://youtrack.jetbrains.com/issue/KT-19524) "Local variable type hints" should respect static imports +- [`KT-21010`](https://youtrack.jetbrains.com/issue/KT-21010) Gutter "Is subclassed by" should show actual subclass from the all platform modules in IDEA 2017.3/2018.1 +- [`KT-21036`](https://youtrack.jetbrains.com/issue/KT-21036) Throwable “Access is allowed from event dispatch thread only.” after creating nine similar classes with functions. +- [`KT-21213`](https://youtrack.jetbrains.com/issue/KT-21213) Multiline kdoc - intellij joins lines together without space +- [`KT-21592`](https://youtrack.jetbrains.com/issue/KT-21592) -Xjsr305=strict not taken into account during the kotlin files compilation in Idea (maven) +- [`KT-22050`](https://youtrack.jetbrains.com/issue/KT-22050) Redundant parameter type hint on SAM +- [`KT-22071`](https://youtrack.jetbrains.com/issue/KT-22071) Formatter insists on increasing indentation in forEach lambda +- [`KT-22093`](https://youtrack.jetbrains.com/issue/KT-22093) Unnecessary line wrap with new Kotlin code style +- [`KT-22111`](https://youtrack.jetbrains.com/issue/KT-22111) Error while indexing PsiPlainTextFileImpl cannot be cast to KtFile +- [`KT-22121`](https://youtrack.jetbrains.com/issue/KT-22121) Enter in empty argument list should apply normal indent if "Continuation indent for argument list" is off +- [`KT-21702`](https://youtrack.jetbrains.com/issue/KT-21702) `KtLightAnnotation` can't be converted to UAST +- [`KT-19900`](https://youtrack.jetbrains.com/issue/KT-19900) IntelliJ does not recognise no-arg "invokeInitializers" set in pom.xml +### IDE. Completion + +- [`KT-13220`](https://youtrack.jetbrains.com/issue/KT-13220) Completion for non-primary-constructor properties should suggest names with types instead of types +- [`KT-12797`](https://youtrack.jetbrains.com/issue/KT-12797) Code completion does not work for inner in base class +- [`KT-16402`](https://youtrack.jetbrains.com/issue/KT-16402) AssertionError on completing expression after template in string literal +- [`KT-20166`](https://youtrack.jetbrains.com/issue/KT-20166) Completion: property declaration completion should be greedy if `tab` pressed +- [`KT-20506`](https://youtrack.jetbrains.com/issue/KT-20506) Second smart completion suggests the same value recursively + +### IDE. Debugger + +- [`KT-17514`](https://youtrack.jetbrains.com/issue/KT-17514) Debugger, evaluate value: cannot find local variable error on attempt to evaluate outer variable +- [`KT-20962`](https://youtrack.jetbrains.com/issue/KT-20962) NullPointerException because of nullable location in debugger +- [`KT-21538`](https://youtrack.jetbrains.com/issue/KT-21538) "Step into" method doesn't work after adding lambda parameter to the call +- [`KT-21820`](https://youtrack.jetbrains.com/issue/KT-21820) Debugger: Evaluation fails for instance properties (older Android SDKs) + +### IDE. Inspections and Intentions + +#### New Features + +- [`KT-4580`](https://youtrack.jetbrains.com/issue/KT-4580) Intention + inspection to convert between explicit and implicit 'this' +- [`KT-11023`](https://youtrack.jetbrains.com/issue/KT-11023) Inspection to highlight usages of Collections.sort() and replace them with .sort() method from Kotlin stdlib +- [`KT-13702`](https://youtrack.jetbrains.com/issue/KT-13702) Issue a warning when equals is called recursively within itself +- [`KT-18449`](https://youtrack.jetbrains.com/issue/KT-18449) Multiplatform project: provide a quick fix "Implement methods" for a impl class +- [`KT-18828`](https://youtrack.jetbrains.com/issue/KT-18828) Provide an intention action to move a companion object member to top level +- [`KT-19103`](https://youtrack.jetbrains.com/issue/KT-19103) Inspection to remove unnecessary suspend modifier +- [`KT-20484`](https://youtrack.jetbrains.com/issue/KT-20484) Add quick fix to add required target to annotation used on a type +- [`KT-20492`](https://youtrack.jetbrains.com/issue/KT-20492) Offer "Simplify" intention for 'when' expression where only one branch is known to be true +- [`KT-20615`](https://youtrack.jetbrains.com/issue/KT-20615) Inspection to detect usages of values incorrectly marked by Kotlin as const from Java code +- [`KT-20631`](https://youtrack.jetbrains.com/issue/KT-20631) Inspection to detect use of Unit as a standalone expression +- [`KT-20644`](https://youtrack.jetbrains.com/issue/KT-20644) Warning for missing const paired with val modifier for primitives and strings +- [`KT-20714`](https://youtrack.jetbrains.com/issue/KT-20714) Inspection for self-assigment of properties +- [`KT-21023`](https://youtrack.jetbrains.com/issue/KT-21023) Inspection to highlight variables / functions with implicit `Nothing?` type +- [`KT-21510`](https://youtrack.jetbrains.com/issue/KT-21510) Add inspection to add/remove this to/from bound callable +- [`KT-21560`](https://youtrack.jetbrains.com/issue/KT-21560) Inspection to sort modifiers +- [`KT-21573`](https://youtrack.jetbrains.com/issue/KT-21573) Code Style Inspection: `to -> Pair` function used not in infix form +- [`KT-16260`](https://youtrack.jetbrains.com/issue/KT-16260) Add intention to specify all types explicitly in destructuring assignment +- [`KT-21547`](https://youtrack.jetbrains.com/issue/KT-21547) Allow separate regex for test class and function names in IDE inspection +- [`KT-21741`](https://youtrack.jetbrains.com/issue/KT-21741) Inspection to detect is checks for object types +- [`KT-21950`](https://youtrack.jetbrains.com/issue/KT-21950) Enable quick-fixes for annotator-reported problems in "Inspect Code" +- [`KT-22103`](https://youtrack.jetbrains.com/issue/KT-22103) SortModifiersInspection should report annotations after modifiers +#### Fixes + +- [`KT-15941`](https://youtrack.jetbrains.com/issue/KT-15941) "Convert to secondary constructor" produces invalid code for generic property with default value +- [`KT-16340`](https://youtrack.jetbrains.com/issue/KT-16340) "Unused receiver parameter" for invoke operator on companion object +- [`KT-17161`](https://youtrack.jetbrains.com/issue/KT-17161) IDE suggest to replace a for loop with `forEach` to aggresively +- [`KT-17332`](https://youtrack.jetbrains.com/issue/KT-17332) Intention to replace forEach with a 'for' loop should convert return@forEach to continue +- [`KT-17730`](https://youtrack.jetbrains.com/issue/KT-17730) Incorrect suggestion to replace loop with negation to `any{}` +- [`KT-18816`](https://youtrack.jetbrains.com/issue/KT-18816) IDEA suggests replacing for-in-range with stdlib operations +- [`KT-18881`](https://youtrack.jetbrains.com/issue/KT-18881) Invalid "Loop can be replaced with stdlib operations" warning when class has `add()` function +- [`KT-19560`](https://youtrack.jetbrains.com/issue/KT-19560) Do not warn about receiver parameter not used for companion object +- [`KT-19977`](https://youtrack.jetbrains.com/issue/KT-19977) Convert Lambda to reference produces red code when wrong implicit receiver is in scope +- [`KT-20091`](https://youtrack.jetbrains.com/issue/KT-20091) "Convert object literal to class" should create inner class if necessary +- [`KT-20300`](https://youtrack.jetbrains.com/issue/KT-20300) "Variable can be inlined" should not be suggested if there's a variable with the same name in nested scope +- [`KT-20349`](https://youtrack.jetbrains.com/issue/KT-20349) Convert lambda to reference for trailing lambda inserts parameter names for all arguments if at least one named argument was passed +- [`KT-20435`](https://youtrack.jetbrains.com/issue/KT-20435) False "function is never used" warning +- [`KT-20622`](https://youtrack.jetbrains.com/issue/KT-20622) Don't propose “Remove explicit type specification” when it can change semantic? +- [`KT-20763`](https://youtrack.jetbrains.com/issue/KT-20763) Wrong resulting code for "add star projection" quick-fix for inner class with generic outer one +- [`KT-20887`](https://youtrack.jetbrains.com/issue/KT-20887) Missing documentation warning shouldn't be triggered for a member of a private class +- [`KT-20888`](https://youtrack.jetbrains.com/issue/KT-20888) Documentation should be inherited from Map.Entry type +- [`KT-20889`](https://youtrack.jetbrains.com/issue/KT-20889) Members of anonymous objects should be treated as private and not trigger "Missing documentation" warning +- [`KT-20894`](https://youtrack.jetbrains.com/issue/KT-20894) "Add type" quick fix does not take into account `vararg` modifier +- [`KT-20901`](https://youtrack.jetbrains.com/issue/KT-20901) IntelliJ autocorrect to add parameter to data class constructor should make the parameter a val +- [`KT-20981`](https://youtrack.jetbrains.com/issue/KT-20981) False positive for "redundant super" in data class +- [`KT-21025`](https://youtrack.jetbrains.com/issue/KT-21025) Kotlin UAST violates `JvmDeclarationUElement` contract by employing `JavaUAnnotation` +- [`KT-21061`](https://youtrack.jetbrains.com/issue/KT-21061) Cant work with UElement.kt in IDEA with 1.2.0-rc-39: "Stub index points to a file without PSI" +- [`KT-21104`](https://youtrack.jetbrains.com/issue/KT-21104) Do not propose to make local lateinit var immutable +- [`KT-21122`](https://youtrack.jetbrains.com/issue/KT-21122) QuickFix to create member for expect class shouldn't add body +- [`KT-21159`](https://youtrack.jetbrains.com/issue/KT-21159) Fix signature invoked from Java breaks Kotlin code +- [`KT-21179`](https://youtrack.jetbrains.com/issue/KT-21179) Remove empty class body on companion object breaks code +- [`KT-21192`](https://youtrack.jetbrains.com/issue/KT-21192) Confusing "unused expression" +- [`KT-21237`](https://youtrack.jetbrains.com/issue/KT-21237) ReplaceWith incorrectly removes property assignment +- [`KT-21332`](https://youtrack.jetbrains.com/issue/KT-21332) Create from usage: do not propose to create abstract function in non-abstract class +- [`KT-21373`](https://youtrack.jetbrains.com/issue/KT-21373) 'Remove redundant let' quickfix does not work with `in` +- [`KT-21497`](https://youtrack.jetbrains.com/issue/KT-21497) Inspection considers if block to be a lambda +- [`KT-21544`](https://youtrack.jetbrains.com/issue/KT-21544) "Add type" quick fix incorrectly processes `vararg` modifier with primitive type array initializer +- [`KT-21603`](https://youtrack.jetbrains.com/issue/KT-21603) "Join declaration and assignment" should remove 'lateinit' for 'var' +- [`KT-21612`](https://youtrack.jetbrains.com/issue/KT-21612) The "Remove redundant getter" inspection removes the type specifier +- [`KT-21698`](https://youtrack.jetbrains.com/issue/KT-21698) `Create interface` shouldn't suggest to declare it inside a class which implements it +- [`KT-21726`](https://youtrack.jetbrains.com/issue/KT-21726) "arrayOf can be replaced with literal" inspection quick fix produces incompilable result in presence of spread operator +- [`KT-21727`](https://youtrack.jetbrains.com/issue/KT-21727) "Redundant spread operator" inspection does not report array literal +- [`KT-12814`](https://youtrack.jetbrains.com/issue/KT-12814) Specify type explicitly produces erroneous code when platform type overrides not-null type +- [`KT-15180`](https://youtrack.jetbrains.com/issue/KT-15180) Incorrect quickfix 'Specify type explicitly' +- [`KT-17816`](https://youtrack.jetbrains.com/issue/KT-17816) "Replace elvis with if" produce nasty code when safe casts are involved +- [`KT-18396`](https://youtrack.jetbrains.com/issue/KT-18396) Bad quickfix for wrong nested classes in inner class +- [`KT-19073`](https://youtrack.jetbrains.com/issue/KT-19073) No-op quick fix for "Convert lambda to reference" IDE suggestion +- [`KT-19283`](https://youtrack.jetbrains.com/issue/KT-19283) Kotlin KProperty reference cannot be converted to lambda +- [`KT-19736`](https://youtrack.jetbrains.com/issue/KT-19736) Rephrase text in the unconventional property name inspection +- [`KT-19771`](https://youtrack.jetbrains.com/issue/KT-19771) Preserve old "Convert to expression body" range +- [`KT-20437`](https://youtrack.jetbrains.com/issue/KT-20437) Naming convetions inspection: Add separate inspection for top-level and object properties +- [`KT-20620`](https://youtrack.jetbrains.com/issue/KT-20620) Replace operator with function call breaks code +- [`KT-21414`](https://youtrack.jetbrains.com/issue/KT-21414) OverridersSearch attempts to create nameless fake light method +- [`KT-21780`](https://youtrack.jetbrains.com/issue/KT-21780) Wrong redundant setter inspection +- [`KT-21837`](https://youtrack.jetbrains.com/issue/KT-21837) Don't require documentation on tests and test classes +- [`KT-21929`](https://youtrack.jetbrains.com/issue/KT-21929) Inappropriate quick fix for a sealed class instantiation +- [`KT-21983`](https://youtrack.jetbrains.com/issue/KT-21983) Do not suggest to remove explicit Unit type for expression body +- [`KT-16619`](https://youtrack.jetbrains.com/issue/KT-16619) Incorrect 'accessing non-final property in constructor' warning + +### IDE. Refactorings + +#### New Features + +- [`KT-20095`](https://youtrack.jetbrains.com/issue/KT-20095) Allow conversion of selected companion methods to methods with @JvmStatic +#### Fixes + +- [`KT-15840`](https://youtrack.jetbrains.com/issue/KT-15840) Introduce type alias: don't change not-nullable type with nullable typealias +- [`KT-17212`](https://youtrack.jetbrains.com/issue/KT-17212) Refactor / Inline Function: with 1 occurrence both "Inline all" and "Inline this only" are suggested +- [`KT-18594`](https://youtrack.jetbrains.com/issue/KT-18594) Refactor / Extract (Functional) Parameter are available for annotation arguments, but fail with AE: "Body element is not found" +- [`KT-20146`](https://youtrack.jetbrains.com/issue/KT-20146) IAE “parameter 'name' of NameUtil.splitNameIntoWords must not be null” at renaming class +- [`KT-20335`](https://youtrack.jetbrains.com/issue/KT-20335) Refactor → Extract Type Parameter: “AWT events are not allowed inside write action” after processing duplicates +- [`KT-20402`](https://youtrack.jetbrains.com/issue/KT-20402) Throwable “PsiElement(IDENTIFIER) by KotlinInplaceParameterIntroducer” on calling Refactor → Extract Parameter for default values +- [`KT-20403`](https://youtrack.jetbrains.com/issue/KT-20403) AE “Body element is not found” on calling Refactor → Extract Parameter for default values in constructor of class without body +- [`KT-20790`](https://youtrack.jetbrains.com/issue/KT-20790) Refactoring extension function/property overagressive +- [`KT-20766`](https://youtrack.jetbrains.com/issue/KT-20766) Typealias end-of-line is removed when moving function and typealias to new file +- [`KT-21071`](https://youtrack.jetbrains.com/issue/KT-21071) Cannot invoke move refactoring on a typealias +- [`KT-21162`](https://youtrack.jetbrains.com/issue/KT-21162) Adding parameters to kotlin data class leads to compilation error +- [`KT-21288`](https://youtrack.jetbrains.com/issue/KT-21288) Change Signature refactoring fails to change signature of overriders +- [`KT-21334`](https://youtrack.jetbrains.com/issue/KT-21334) Extract variable doesn't take into account the receiver of a bound callable reference +- [`KT-21371`](https://youtrack.jetbrains.com/issue/KT-21371) Rename refactoring sometimes erases identifier being renamed when popping up name proposals +- [`KT-21530`](https://youtrack.jetbrains.com/issue/KT-21530) KNPE in introduce variable +- [`KT-21508`](https://youtrack.jetbrains.com/issue/KT-21508) `java.lang.AssertionError: PsiLiteralExpression` on property safe delete in Idea 173 +- [`KT-21536`](https://youtrack.jetbrains.com/issue/KT-21536) Rename refactoring sometimes doesn't quite work +- [`KT-21604`](https://youtrack.jetbrains.com/issue/KT-21604) Rename package missing title +- [`KT-21963`](https://youtrack.jetbrains.com/issue/KT-21963) Refactor / Inline Property: "null" in place of number of occurrences of local variable references +- [`KT-21964`](https://youtrack.jetbrains.com/issue/KT-21964) Refactor / Inline: on declaration of element with one usage "Inline and keep" choice is not suggested +- [`KT-21965`](https://youtrack.jetbrains.com/issue/KT-21965) Refactor / Inline: wording in dialog could be unified +### JavaScript + +#### New Features + +- [`KT-20210`](https://youtrack.jetbrains.com/issue/KT-20210) [JS] Ultra-fast builds for development +#### Performance Improvements + +- [`KT-2218`](https://youtrack.jetbrains.com/issue/KT-2218) JS: Optimise in checks for number ranges +- [`KT-20932`](https://youtrack.jetbrains.com/issue/KT-20932) JS: Make withIndex() on arrays intrinsic +- [`KT-21160`](https://youtrack.jetbrains.com/issue/KT-21160) JS: generate switch statement for when statement when possible +#### Fixes + +- [`KT-7653`](https://youtrack.jetbrains.com/issue/KT-7653) JS: TypeError when try to access to "simple" property (w/o backing field at runtime) +- [`KT-18963`](https://youtrack.jetbrains.com/issue/KT-18963) javascript project: No output directory found for Module 'xxx_test' production on JPS compiling +- [`KT-19290`](https://youtrack.jetbrains.com/issue/KT-19290) JS integer overflow for unaryMinus +- [`KT-19826`](https://youtrack.jetbrains.com/issue/KT-19826) JS: don't remove debugger statement from suspend functions +- [`KT-20580`](https://youtrack.jetbrains.com/issue/KT-20580) JS: JSON.stringify could improve 'replacer' argument handling +- [`KT-20694`](https://youtrack.jetbrains.com/issue/KT-20694) JS: add missed parts to JS Date +- [`KT-20737`](https://youtrack.jetbrains.com/issue/KT-20737) JS: cache KProperty instances that used to access to delegated property +- [`KT-20738`](https://youtrack.jetbrains.com/issue/KT-20738) JS: remove useless calls to constructor of KProperty* (PropertyMetadata) when it generated for access to delegated property +- [`KT-20854`](https://youtrack.jetbrains.com/issue/KT-20854) `val` parameters of type `kotlin.Char` aren't boxed +- [`KT-20898`](https://youtrack.jetbrains.com/issue/KT-20898) JS: inline js with `for` without initializer causes compiiler to crash +- [`KT-20905`](https://youtrack.jetbrains.com/issue/KT-20905) JS: compiler crashes on invalid inline JavaScript code instead of reporting error +- [`KT-20908`](https://youtrack.jetbrains.com/issue/KT-20908) JS frontend crashes on uncompleted call to function with reified parameters +- [`KT-20978`](https://youtrack.jetbrains.com/issue/KT-20978) JS: inline doesn't work for Array's constructor when it called through typealias +- [`KT-20994`](https://youtrack.jetbrains.com/issue/KT-20994) JS extension property in interface problem +- [`KT-21004`](https://youtrack.jetbrains.com/issue/KT-21004) JS: don't use short-circuit operators when translating Boolean.and/or(Boolean) +- [`KT-21026`](https://youtrack.jetbrains.com/issue/KT-21026) JS: wrong code generated for suspend fun that calls inline suspend fun as a tail call. +- [`KT-21041`](https://youtrack.jetbrains.com/issue/KT-21041) 'TypeError: ... is not a function' for lambda with closure passed as an argument to super type constructor +- [`KT-21043`](https://youtrack.jetbrains.com/issue/KT-21043) JS: inlining coroutine from other module sometimes causes incorrect code generated +- [`KT-21093`](https://youtrack.jetbrains.com/issue/KT-21093) Kotlin.JS doesnt escape ‘in’ identifier and conflicts with in keyword +- [`KT-21245`](https://youtrack.jetbrains.com/issue/KT-21245) JS: interface function with default parameter, overridden by other interface indirectly cannot be found at runtime +- [`KT-21307`](https://youtrack.jetbrains.com/issue/KT-21307) JS DCE does not remap paths to sources +- [`KT-21309`](https://youtrack.jetbrains.com/issue/KT-21309) JS: incorrect source map generated for inline lambda when it's last expression is a statement-like expression (e.g. when or try/catch) +- [`KT-21317`](https://youtrack.jetbrains.com/issue/KT-21317) JS: safe call to suspend function returning Unit causes incorrect +- [`KT-21421`](https://youtrack.jetbrains.com/issue/KT-21421) JS: accesors of overridden char properties with backing fields aren't boxed +- [`KT-21468`](https://youtrack.jetbrains.com/issue/KT-21468) JS: don't use enum entry's name for when over external enums +- [`KT-21850`](https://youtrack.jetbrains.com/issue/KT-21850) JS: support nested tests +### Language design + +- [`KT-10532`](https://youtrack.jetbrains.com/issue/KT-10532) ISE by ThrowingLexicalScope at compile time with specific override chain + +### Libraries + +- [`KT-20864`](https://youtrack.jetbrains.com/issue/KT-20864) Provide `ReadOnly` and `Mutable` annotations to control java collection mutability in kotlin +- [`KT-18789`](https://youtrack.jetbrains.com/issue/KT-18789) Delegating val to out-projected `MutableMap` resulted in NPE due to cast to `Nothing` +- [`KT-21828`](https://youtrack.jetbrains.com/issue/KT-21828) JS: The List produced by the `IntArray.asList` function caused weird results +- [`KT-21868`](https://youtrack.jetbrains.com/issue/KT-21868) Eliminate potential data race in `SafePublicationLazyImpl` +- [`KT-21918`](https://youtrack.jetbrains.com/issue/KT-21918) Make `toTypedArray()` implementation more efficient and thread-safe +- [`KT-22003`](https://youtrack.jetbrains.com/issue/KT-22003) JS: Replace `Regex` constructor-like functions with secondary constructors +- JS: `Volatile` and `Synchornized` annotations are moved to `kotlin.jvm` package with the migration type aliases provided +- [`KT-16348`](https://youtrack.jetbrains.com/issue/KT-16348) Provide `String.toBoolean()` conversion in JS and common platforms +- Add missing declarations to kotlin-stdlib-common, those that are already supported in both platforms + - [`KT-21191`](https://youtrack.jetbrains.com/issue/KT-21191) Add missing exception constructors to common and JS declarations + - [`KT-21861`](https://youtrack.jetbrains.com/issue/KT-21861) Provide `NumberFormatException` in common projects and make it inherit `IllegalArgumentException` in all platforms + - Add missing `pattern` and `options` properties to common `Regex` +- [`KT-20968`](https://youtrack.jetbrains.com/issue/KT-20968) Improve docs for String.format and String.Companion.format + +### Reflection + +- [`KT-20875`](https://youtrack.jetbrains.com/issue/KT-20875) Support Void.TYPE as underlying Class object for KClass +- [`KT-21453`](https://youtrack.jetbrains.com/issue/KT-21453) NPE in TypeSignatureMappingKt#computeInternalName + +### Tools + +- [`KT-20298`](https://youtrack.jetbrains.com/issue/KT-20298) Lint warning when using @Parcelize with delegated properties +- [`KT-20299`](https://youtrack.jetbrains.com/issue/KT-20299) Android non-ASCII TextView Id Unresolved Reference Bug +- [`KT-20717`](https://youtrack.jetbrains.com/issue/KT-20717) @Parcelize Creator.newArray method is generated incorrectly +- [`KT-20751`](https://youtrack.jetbrains.com/issue/KT-20751) kotlin-spring compiler plugin does not open @Validated classes +- [`KT-21171`](https://youtrack.jetbrains.com/issue/KT-21171) _$_findViewCache and _$_findCachedViewById are created in Activity subclass without Kotlin Android Extensions. +- [`KT-21628`](https://youtrack.jetbrains.com/issue/KT-21628) Can't find referenced class kotlin.internal.annotations.AvoidUninitializedObjectCopyingCheck +- [`KT-21777`](https://youtrack.jetbrains.com/issue/KT-21777) RMI "Connection refused" errors with daemon +- [`KT-21992`](https://youtrack.jetbrains.com/issue/KT-21992) @Transient warning for lazy property + +### Tools. Gradle + +- [`KT-20892`](https://youtrack.jetbrains.com/issue/KT-20892) Support module name option in K2MetadataCompilerArguments +- [`KT-17621`](https://youtrack.jetbrains.com/issue/KT-17621) Incremental compilation is very slow when Java file is modified +- [`KT-14125`](https://youtrack.jetbrains.com/issue/KT-14125) Android-extensions don't track xml changes well +- [`KT-20233`](https://youtrack.jetbrains.com/issue/KT-20233) Kapt: using compiler in-process w/ gradle leads to classloader conflict +- [`KT-21009`](https://youtrack.jetbrains.com/issue/KT-21009) Running Gradle build with `clean` prevents `KotlinCompile` tasks from loading from cache +- [`KT-21596`](https://youtrack.jetbrains.com/issue/KT-21596) Improve Kapt Gradle Plugin to be more friendly for Kotlin-DSL +- [`KT-15753`](https://youtrack.jetbrains.com/issue/KT-15753) Support cacheable tasks +- [`KT-17656`](https://youtrack.jetbrains.com/issue/KT-17656) Kotlin and Kotlin Android plugin not using available build caches +- [`KT-20017`](https://youtrack.jetbrains.com/issue/KT-20017) Support local (non-relocatable) Gradle build cache +- [`KT-20598`](https://youtrack.jetbrains.com/issue/KT-20598) Missing input annotations on AbstractKotlinCompileTool +- [`KT-20604`](https://youtrack.jetbrains.com/issue/KT-20604) Kotlin plugin breaks relocatability and compile avoidance for Java compile tasks +- [`KT-21203`](https://youtrack.jetbrains.com/issue/KT-21203) Kotlin gradle plugin does not create proper Ivy metadata for dependencies +- [`KT-21261`](https://youtrack.jetbrains.com/issue/KT-21261) Gradle plugin 1.1.60 creates "build-history.bin" outside project.buildDir +- [`KT-21805`](https://youtrack.jetbrains.com/issue/KT-21805) Gradle plugin does not work with JDK 1.7 (KaptGradleModel) +- [`KT-21806`](https://youtrack.jetbrains.com/issue/KT-21806) Gradle Plugin: Using automatic dependency versions with 'maven-publish' plugin does not include dependency version in generated publication POMs +### Tools. Incremental Compile + +- [`KT-20840`](https://youtrack.jetbrains.com/issue/KT-20840) Multiplatform IC fails if expected or actual file is modified separately +- [`KT-21622`](https://youtrack.jetbrains.com/issue/KT-21622) Make IC work more accurately with changes of Android layouts xml files +- [`KT-21699`](https://youtrack.jetbrains.com/issue/KT-21699) JS IC produces different source maps when enum usage is compiled separately +- [`KT-20633`](https://youtrack.jetbrains.com/issue/KT-20633) Class is not recompiled + +### Tools. J2K + +- [`KT-21502`](https://youtrack.jetbrains.com/issue/KT-21502) Inspection to convert map.put(k, v) into map[k] = v +- [`KT-19390`](https://youtrack.jetbrains.com/issue/KT-19390) Character and string concatenation in Java is converted to code with multiple type errors in Kotlin +- [`KT-19943`](https://youtrack.jetbrains.com/issue/KT-19943) Redundant 'toInt' after converting explicit Integer#intValue call + +### Tools. JPS + +- [`KT-21574`](https://youtrack.jetbrains.com/issue/KT-21574) JPS build: API version in project settings is ignored +- [`KT-21841`](https://youtrack.jetbrains.com/issue/KT-21841) JPS throws exception creating temporary file for module +- [`KT-21962`](https://youtrack.jetbrains.com/issue/KT-21962) Source file dependencies (lookups) are not tracked in JPS when Kotlin daemon is used + +### Tools. Maven + +- [`KT-20816`](https://youtrack.jetbrains.com/issue/KT-20816) Repeated Maven Compiles With Kapt Fail + +### Tools. REPL + +- [`KT-17561`](https://youtrack.jetbrains.com/issue/KT-17561) Embedding kotlin-script-utils may cause version conflicts e.g. with guava +- [`KT-17921`](https://youtrack.jetbrains.com/issue/KT-17921) The JSR 223 scripting engine fails to eval anything after encountering an unresolved reference +- [`KT-21075`](https://youtrack.jetbrains.com/issue/KT-21075) KotlinJsr223JvmLocalScriptEngineFactory does not well with kotlin-compiler-embeddable +- [`KT-21141`](https://youtrack.jetbrains.com/issue/KT-21141) Kotlin script: KotlinJsr223JvmLocalScriptEngine.state.history.reset() seems not clearing the compiler cache + +### Tools. kapt + +#### Fixes + +- [`KT-18791`](https://youtrack.jetbrains.com/issue/KT-18791) Kapt: Constants from R class should not be inlined +- [`KT-19203`](https://youtrack.jetbrains.com/issue/KT-19203) Kapt3 generator doesn't seem to print log level lower to Mandatory Warning +- [`KT-19402`](https://youtrack.jetbrains.com/issue/KT-19402) `kapt.correctErrorTypes` makes typealias not work. +- [`KT-19505`](https://youtrack.jetbrains.com/issue/KT-19505) Kapt doesn't always stub classes about to be generated. +- [`KT-19518`](https://youtrack.jetbrains.com/issue/KT-19518) Kapt: Support 'correctErrorTypes' option in annotations +- [`KT-20257`](https://youtrack.jetbrains.com/issue/KT-20257) Kapt is incompatible with compiler plugins +- [`KT-20749`](https://youtrack.jetbrains.com/issue/KT-20749) Kapt: Support Java 9 +- [`KT-21144`](https://youtrack.jetbrains.com/issue/KT-21144) Kapt: Compilation error with maven plugin (Java 9 compatibility) +- [`KT-21205`](https://youtrack.jetbrains.com/issue/KT-21205) KDoc unavailable via javax.lang.model.util.Elements#getDocComment(Element e) +- [`KT-21262`](https://youtrack.jetbrains.com/issue/KT-21262) Kapt: Remove artificial KaptError exception on errors from annotation processor +- [`KT-21264`](https://youtrack.jetbrains.com/issue/KT-21264) Kapt: -Xmaxerrs javac option is not propagated properly +- [`KT-21358`](https://youtrack.jetbrains.com/issue/KT-21358) Kapt: Support import directive with aliases (correctErrorTypes) +- [`KT-21359`](https://youtrack.jetbrains.com/issue/KT-21359) Kapt: Filter out non-package imports whenever possible (correctErrorTypes) +- [`KT-21425`](https://youtrack.jetbrains.com/issue/KT-21425) kapt warning when assembling unit tests +- [`KT-21433`](https://youtrack.jetbrains.com/issue/KT-21433) Annotations on enum constants are not kept on the generated stub +- [`KT-21483`](https://youtrack.jetbrains.com/issue/KT-21483) Kapt: Loading resources doesn't work without restarting the gradle daemon +- [`KT-21542`](https://youtrack.jetbrains.com/issue/KT-21542) Kapt: Report additional info about time spent in each annotation processor +- [`KT-21565`](https://youtrack.jetbrains.com/issue/KT-21565) Kapt, Maven: Support passing arguments for annotation processors +- [`KT-21566`](https://youtrack.jetbrains.com/issue/KT-21566) Kapt, Maven: Support passing Javac options +- [`KT-21729`](https://youtrack.jetbrains.com/issue/KT-21729) Error message says "androidProcessor" should be "annotationProcessor" +- [`KT-21936`](https://youtrack.jetbrains.com/issue/KT-21936) Kapt 1.2.20-eap: cannot find symbol @KaptSignature +- [`KT-21735`](https://youtrack.jetbrains.com/issue/KT-21735) Kapt cache not cleared +- [`KT-22056`](https://youtrack.jetbrains.com/issue/KT-22056) Applying Kapt plugin causes RuntimeException on Gradle import: "Kapt importer for generated source roots failed, source root name: debug" at KaptProjectResolverExtension.populateAndroidModuleModelIfNeeded() +- [`KT-22189`](https://youtrack.jetbrains.com/issue/KT-22189) ISE from com.sun.tools.javac.util.Context.checkState when switching from 1.2.10 to 1.2.20-eap-33 + +## 1.2.10 + +### Compiler + +- [`KT-20821`](https://youtrack.jetbrains.com/issue/KT-20821) Error while inlining function reference implicitly applied to this +- [`KT-21299`](https://youtrack.jetbrains.com/issue/KT-21299) Restore adding JDK roots to the beginning of the classpath list + +### IDE + +- [`KT-21180`](https://youtrack.jetbrains.com/issue/KT-21180) Project level api/language version settings are erroneously used as default during Gradle import +- [`KT-21335`](https://youtrack.jetbrains.com/issue/KT-21335) Fix exception on Project Structure view open +- [`KT-21610`](https://youtrack.jetbrains.com/issue/KT-21610) Fix "Could not determine the class-path for interface KotlinGradleModel" on Gradle sync +- Optimize dependency handling during import of Gradle project + +### JavaScript + +- [`KT-21493`](https://youtrack.jetbrains.com/issue/KT-21493) Losing lambda defined in inline function after incremental recompilation + +### Tools. CLI + +- [`KT-21495`](https://youtrack.jetbrains.com/issue/KT-21537) Bash scripts in Kotlin v1.2 compiler have Windows line terminators +- [`KT-21537`](https://youtrack.jetbrains.com/issue/KT-21537) javac 7 do nothing when kotlin-compiler(-embeddable) is in classpath + +### Libraries + +- Unify docs wording of 'trim*' functions +- Improve cover documentation page of kotlin.test library +- Provide summary for kotlin.math package +- Fix unresolved references in the api docs + +## 1.2 + +### Android + +- [`KT-20974`](https://youtrack.jetbrains.com/issue/KT-20974) NSME "AndroidModuleModel.getMainArtifact" on Gradle refresh +- [`KT-20975`](https://youtrack.jetbrains.com/issue/KT-20975) IAE "Missing extension point" on Gradle refresh + +### Compiler + +- [`KT-6359`](https://youtrack.jetbrains.com/issue/KT-6359) Provide the way to share code with different targets(JVM, JS) + +### IDE + +- [`KT-21300`](https://youtrack.jetbrains.com/issue/KT-21300) IDEA slow down in Kotlin + Spring project +- [`KT-20450`](https://youtrack.jetbrains.com/issue/KT-20450) Exception in UAST during function inlining +- [`KT-20789`](https://youtrack.jetbrains.com/issue/KT-20789) Can't navigate to inline call/inline use site when runner is delegated to Gradle +- [`KT-21236`](https://youtrack.jetbrains.com/issue/KT-21236) New project button doesn't work with Kotlin plugin enabled and Gradle plugin disabled +- [`KT-21263`](https://youtrack.jetbrains.com/issue/KT-21263) "Configure Kotlin Plugin Updates" suggests incompatible plugin for AS 3.0 + +### Tools. JPS + +- [`KT-20757`](https://youtrack.jetbrains.com/issue/KT-20757) Rebuild when language/api version is changed + +## 1.2-RC2 + +### Compiler + +- [`KT-20844`](https://youtrack.jetbrains.com/issue/KT-20844) VerifyError on Android after upgrading to 1.2.0-beta-88 +- [`KT-20895`](https://youtrack.jetbrains.com/issue/KT-20895) NPE in Kotlin 1.2-beta88 PseudocodeVariablesData.kt:337 +- [`KT-21377`](https://youtrack.jetbrains.com/issue/KT-21377) Create fallback flag for "Illegal smart cast is allowed after assignment in try block" + +### IDE + +- [`KT-18719`](https://youtrack.jetbrains.com/issue/KT-18719) Configure Kotlin in Gradle project to 1.2-Mx: add repository mavenCentral() to buildscript +- [`KT-20782`](https://youtrack.jetbrains.com/issue/KT-20782) Exception when working with routing in ktor (non-atomic trees update) +- [`KT-20966`](https://youtrack.jetbrains.com/issue/KT-20966) ISE: Facade class not found from Kotlin test files +- [`KT-20967`](https://youtrack.jetbrains.com/issue/KT-20967) Kotlin plugin upgrade breaks Gradle refresh +- [`KT-20990`](https://youtrack.jetbrains.com/issue/KT-20990) String literal in string template causes ISE +- [`KT-21028`](https://youtrack.jetbrains.com/issue/KT-21028) Add kotlin-stdlib-jre7/8 instead of kotlin-stdlib-jdk7/8 for Kotlin versions below 1.2 +- [`KT-21383`](https://youtrack.jetbrains.com/issue/KT-21383) `Unsupported method: Library.getProject()` when importing Anko project +- Downgrade "use expression body" inspection to INFORMATION default level + +### IDE. Debugger + +- [`KT-20962`](https://youtrack.jetbrains.com/issue/KT-20962) NullPointerException because of nullable location in debugger + +### IDE. Inspections and Intentions + +- [`KT-20803`](https://youtrack.jetbrains.com/issue/KT-20803) Create actual declaration in the same source root as expect declaration + +### IDE. Refactorings + +- [`KT-20979`](https://youtrack.jetbrains.com/issue/KT-20979) Move class refactoring doesn't work anymore + +### Libraries + +- Remove deprecated `pairwise` function + +### Tools. Gradle + +- [`KT-21395`](https://youtrack.jetbrains.com/issue/KT-21395) “Unable to load class 'kotlin.collections.CollectionsKt'” on creating gradle project in IDEA 2016.3.7 + +### Tools. kapt + +- Add `kotlin-annotation-processing-embeddable` artifact (compatible with `kotlin-compiler-embeddable`) +- Return `kotlin-annotation-processing` artifact back (compatible with CLI Kotlin compiler) + +## 1.2-RC + +### Compiler + +#### Fixes + +- [`KT-20774`](https://youtrack.jetbrains.com/issue/KT-20774) "::foo.isInitialized" for lateinit member properties produces incorrect bytecode +- [`KT-20826`](https://youtrack.jetbrains.com/issue/KT-20826) Can't compile Ultimate Idea with Kotlin 1.2 +- [`KT-20879`](https://youtrack.jetbrains.com/issue/KT-20879) Compiler problem in when-expressions +- [`KT-20959`](https://youtrack.jetbrains.com/issue/KT-20959) Regression: Unexpected diagnostic NINITIALIZED_ENUM_COMPANION reported in 1.1.60 & 1.2.0-rc +- [`KT-20651`](https://youtrack.jetbrains.com/issue/KT-20651) Don't know how to generate outer expression" for enum-values with non-trivial self-closures + +### IDE + +#### New Features + +- [`KT-20286`](https://youtrack.jetbrains.com/issue/KT-20286) "Configure Kotlin in project" should add kotlin-stdlib-jdk7/8 instead of kotlin-stdlib-jre7/8 starting from Kotlin 1.2 + +#### Fixes + +- [`KT-19599`](https://youtrack.jetbrains.com/issue/KT-19599) No indentation for multiline collection literal +- [`KT-20346`](https://youtrack.jetbrains.com/issue/KT-20346) Can't build tests in common code due to missing org.jetbrains.kotlin:kotlin-test-js testCompile dependency in JS +- [`KT-20550`](https://youtrack.jetbrains.com/issue/KT-20550) Spring: "Navigate to autowired candidates" gutter action is missed (IDEA 2017.3) +- [`KT-20566`](https://youtrack.jetbrains.com/issue/KT-20566) Spring: "Navigate to the spring beans declaration" gutter action for `@ComponentScan` is missed (IDEA 2017.3) +- [`KT-20843`](https://youtrack.jetbrains.com/issue/KT-20843) Kotlin TypeDeclarationProvider may stop other declarations providers execution +- [`KT-20906`](https://youtrack.jetbrains.com/issue/KT-20906) Find symbol by name doesn't work +- [`KT-20920`](https://youtrack.jetbrains.com/issue/KT-20920) UAST: SOE Thrown in JavaColorProvider +- [`KT-20922`](https://youtrack.jetbrains.com/issue/KT-20922) Couldn't match ClsMethodImpl from Kotlin test files +- [`KT-20929`](https://youtrack.jetbrains.com/issue/KT-20929) Import Project from Gradle wizard: the same page is shown twice +- [`KT-20833`](https://youtrack.jetbrains.com/issue/KT-20833) MP project: add dependency to kotlin-test-annotation-common to common module + +### IDE. Completion + +- [`KT-18458`](https://youtrack.jetbrains.com/issue/KT-18458) Spring: code completion does not suggest bean names inside `@Qualifier` before function parameter + +### IDE. Inspections and Intentions + +- [`KT-20899`](https://youtrack.jetbrains.com/issue/KT-20899) Code Cleanup fails to convert Circlet codebase to 1.2 +- [`KT-20949`](https://youtrack.jetbrains.com/issue/KT-20949) CCE from UAST (File breadcrumbs don't update when file tree does) + +### IDE. Refactorings + +- [`KT-20251`](https://youtrack.jetbrains.com/issue/KT-20251) Kotlin Gradle script: Refactor → Inline works incorrect when you need to inline all function occurrences + +### JavaScript + +- [`KT-2976`](https://youtrack.jetbrains.com/issue/KT-2976) Suggestion for cleaner style to implement !! operator +- [`KT-5259`](https://youtrack.jetbrains.com/issue/KT-5259) JS: RTTI may be break by overwriting constructor field +- [`KT-17475`](https://youtrack.jetbrains.com/issue/KT-17475) JS: object and companion object named "prototype" cause exceptions +- [`KT-18095`](https://youtrack.jetbrains.com/issue/KT-18095) JS: Wrong behavior of fun named "constructor" +- [`KT-18105`](https://youtrack.jetbrains.com/issue/KT-18105) JS: inner class "length" cause runtime exception +- [`KT-20625`](https://youtrack.jetbrains.com/issue/KT-20625) JS: Interface function with default parameter, overridden by other interface cannot be found at runtime +- [`KT-20820`](https://youtrack.jetbrains.com/issue/KT-20820) JS: IDEA project doesn't generate paths relative to .map + +### Libraries + +- [`KT-4900`](https://youtrack.jetbrains.com/issue/KT-4900) Finalize math operation parameter names + +### Tools. JPS + +- [`KT-20852`](https://youtrack.jetbrains.com/issue/KT-20852) IllegalArgumentException: URI has an authority component on attempt to jps compile the gradle project with javascript module + +### Tools. kapt + +- [`KT-20877`](https://youtrack.jetbrains.com/issue/KT-20877) Butterknife: UninitializedPropertyAccessException: "lateinit property has not been initialized" for field annotated with `@BindView`. + +## 1.2-Beta2 + +### Multiplatform projects + +#### New Features + +- [`KT-20616`](https://youtrack.jetbrains.com/issue/KT-20616) Compiler options for `KotlinCompileCommon` task +- [`KT-15522`](https://youtrack.jetbrains.com/issue/KT-15522) Treat expect classes without explicit constructors as not having constructors at all +- [`KT-16099`](https://youtrack.jetbrains.com/issue/KT-16099) Do not require obvious override of super-interface methods in non-abstract expect class +- [`KT-20618`](https://youtrack.jetbrains.com/issue/KT-20618) Rename `implement` to `expectedBy` in gradle module dependency + +#### Fixes + +- [`KT-16926`](https://youtrack.jetbrains.com/issue/KT-16926) 'implement' dependency is not transitive when importing gradle project to IDEA +- [`KT-20634`](https://youtrack.jetbrains.com/issue/KT-20634) False error about platform project implementing non-common project +- [`KT-19170`](https://youtrack.jetbrains.com/issue/KT-19170) Forbid private expected declarations +- [`KT-20431`](https://youtrack.jetbrains.com/issue/KT-20431) Prohibit inheritance by delegation in 'expect' classes +- [`KT-20540`](https://youtrack.jetbrains.com/issue/KT-20540) Report errors about incompatible constructors of actual class +- [`KT-20398`](https://youtrack.jetbrains.com/issue/KT-20398) Do not highlight declarations with not implemented implementations with red during typing +- [`KT-19937`](https://youtrack.jetbrains.com/issue/KT-19937) Support "implement expect class" quickfix for nested classes +- [`KT-20657`](https://youtrack.jetbrains.com/issue/KT-20657) Actual annotation with all parameters that have default values doesn't match expected annotation with no-arg constructor +- [`KT-20680`](https://youtrack.jetbrains.com/issue/KT-20680) No actual class member: inconsistent modality check +- [`KT-18756`](https://youtrack.jetbrains.com/issue/KT-18756) multiplatform project: compilation error on implementation of extension property in javascript client module +- [`KT-17374`](https://youtrack.jetbrains.com/issue/KT-17374) Too many "expect declaration has no implementation" inspection in IDE in a multi-platform project +- [`KT-18455`](https://youtrack.jetbrains.com/issue/KT-18455) Multiplatform project: show gutter Navigate to implementation on expect side of method in the expect class +- [`KT-19222`](https://youtrack.jetbrains.com/issue/KT-19222) Useless tooltip on a gutter icon for expect declaration +- [`KT-20043`](https://youtrack.jetbrains.com/issue/KT-20043) multiplatform: No H gutter if a class has nested/inner classes inherited from it +- [`KT-20164`](https://youtrack.jetbrains.com/issue/KT-20164) expect/actual navigation does not work when actual is a typealias +- [`KT-20254`](https://youtrack.jetbrains.com/issue/KT-20254) multiplatform: there is no link between expect and actual classes, if implementation has a constructor when expect doesn't +- [`KT-20309`](https://youtrack.jetbrains.com/issue/KT-20309) multiplatform: ClassCastException on mouse hovering on the H gutter of the actual secondary constructor +- [`KT-20638`](https://youtrack.jetbrains.com/issue/KT-20638) Context menu in common module: NSEE: "Collection contains no element matching the predicate." at KotlinRunConfigurationProducerKt.findJvmImplementationModule() +- [`KT-18919`](https://youtrack.jetbrains.com/issue/KT-18919) multiplatform project: expect keyword is lost on converting to object +- [`KT-20008`](https://youtrack.jetbrains.com/issue/KT-20008) multiplatform: Create expect class implementation should add actual keyword at secondary constructors +- [`KT-20044`](https://youtrack.jetbrains.com/issue/KT-20044) multiplatform: Create expect class implementation should add actual constructor at primary constructor +- [`KT-20135`](https://youtrack.jetbrains.com/issue/KT-20135) "Create expect class implementation" should open created class in editor +- [`KT-20163`](https://youtrack.jetbrains.com/issue/KT-20163) multiplatform: it should be possible to create an implementation for overloaded method if for one method implementation is present already +- [`KT-20243`](https://youtrack.jetbrains.com/issue/KT-20243) multiplatform: quick fix Create expect interface implementation should add actual keyword at interface members +- [`KT-20325`](https://youtrack.jetbrains.com/issue/KT-20325) multiplatform: Quick fix Create actual ... should specify correct classifier name for object, enum class and annotation class + +### Compiler + +#### New Features + +- [`KT-16028`](https://youtrack.jetbrains.com/issue/KT-16028) Allow to have different bodies of inline functions inlined depending on apiVersion + +#### Performance Improvements + +- [`KT-20462`](https://youtrack.jetbrains.com/issue/KT-20462) Don't create an array copy for '*(...)' + +#### Fixes + +- [`KT-13644`](https://youtrack.jetbrains.com/issue/KT-13644) Information from explicit cast should be used for type inference +- [`KT-14697`](https://youtrack.jetbrains.com/issue/KT-14697) Use-site targeted annotation is not correctly loaded from class file +- [`KT-17981`](https://youtrack.jetbrains.com/issue/KT-17981) Type parameter for catch parameter possible when exception is nested in generic, but fails in runtime +- [`KT-19251`](https://youtrack.jetbrains.com/issue/KT-19251) Stack spilling in constructor arguments breaks Quasar +- [`KT-20387`](https://youtrack.jetbrains.com/issue/KT-20387) Wrong argument generated for accessor call of a protected generic 'operator fun get/set' from base class with primitive type as type parameter +- [`KT-20491`](https://youtrack.jetbrains.com/issue/KT-20491) Incorrect synthetic accessor generated for a generic base class function specialized with primitive type +- [`KT-20651`](https://youtrack.jetbrains.com/issue/KT-20651) "Don't know how to generate outer expression" for enum-values with non-trivial self-closures +- [`KT-20752`](https://youtrack.jetbrains.com/issue/KT-20752) Do not register new kinds of smart casts for unstable values + +### IDE + +#### New Features + +- [`KT-19146`](https://youtrack.jetbrains.com/issue/KT-19146) Parameter hints could be shown for annotation + +#### Fixes + +- [`KT-19207`](https://youtrack.jetbrains.com/issue/KT-19207) "Configure Kotlin in project" should add "requires kotlin.stdlib" to module-info for Java 9 modules +- [`KT-19213`](https://youtrack.jetbrains.com/issue/KT-19213) Formatter/Code Style: space between type parameters and `where` is not inserted +- [`KT-19216`](https://youtrack.jetbrains.com/issue/KT-19216) Parameter name hints should not be shown for functional type invocation +- [`KT-20448`](https://youtrack.jetbrains.com/issue/KT-20448) Exception in UAST during reference search in J2K +- [`KT-20543`](https://youtrack.jetbrains.com/issue/KT-20543) java.lang.ClassCastException on usage of array literals in Spring annotation +- [`KT-20709`](https://youtrack.jetbrains.com/issue/KT-20709) Loop in parent structure when converting a LITERAL_STRING_TEMPLATE_ENTRY + +### IDE. Completion + +- [`KT-17165`](https://youtrack.jetbrains.com/issue/KT-17165) Support array literals in annotations in completion + +### IDE. Debugger + +- [`KT-18775`](https://youtrack.jetbrains.com/issue/KT-18775) Evaluate expression doesn't allow access to properties of private nested objects, including companion + +### IDE. Inspections and Intentions + +#### New Features + +- [`KT-20108`](https://youtrack.jetbrains.com/issue/KT-20108) Support "add requires directive to module-info.java" quick fix on usages of non-required modules in Kotlin sources +- [`KT-20410`](https://youtrack.jetbrains.com/issue/KT-20410) Add inspection for listOf().filterNotNull() to replace it with listOfNotNull() + +#### Fixes + +- [`KT-16636`](https://youtrack.jetbrains.com/issue/KT-16636) Remove parentheses after deleting the last unused constructor parameter +- [`KT-18549`](https://youtrack.jetbrains.com/issue/KT-18549) "Add type" quick fix adds non-primitive Array type for annotation parameters +- [`KT-18631`](https://youtrack.jetbrains.com/issue/KT-18631) Inspection to convert emptyArray() to empty literal does not work +- [`KT-18773`](https://youtrack.jetbrains.com/issue/KT-18773) Disable "Replace camel-case name with spaces" intention for JS and common projects +- [`KT-20183`](https://youtrack.jetbrains.com/issue/KT-20183) AE “Classifier descriptor of a type should be of type ClassDescriptor” on adding element to generic collection in function +- [`KT-20315`](https://youtrack.jetbrains.com/issue/KT-20315) "call chain on collection type may be simplified" generates code that does not compile + +### JavaScript + +#### Fixes + +- [`KT-8285`](https://youtrack.jetbrains.com/issue/KT-8285) JS: don't generate tmp when only need one component +- [`KT-8374`](https://youtrack.jetbrains.com/issue/KT-8374) JS: some Double values converts to Int differently on JS and JVM +- [`KT-14549`](https://youtrack.jetbrains.com/issue/KT-14549) JS: Non-local returns from secondary constructors don't work +- [`KT-15294`](https://youtrack.jetbrains.com/issue/KT-15294) JS: parse error in `js()` function +- [`KT-17629`](https://youtrack.jetbrains.com/issue/KT-17629) JS: Equals function (==) returns true for all primitive numeric types +- [`KT-17760`](https://youtrack.jetbrains.com/issue/KT-17760) JS: Nothing::class throws error +- [`KT-17933`](https://youtrack.jetbrains.com/issue/KT-17933) JS: toString, hashCode method and simplename property of KClass return senseless results for some classes +- [`KT-18010`](https://youtrack.jetbrains.com/issue/KT-18010) JS: JsName annotation in interfaces can cause runtime exception +- [`KT-18063`](https://youtrack.jetbrains.com/issue/KT-18063) Inlining does not work properly in JS for suspend functions from another module +- [`KT-18548`](https://youtrack.jetbrains.com/issue/KT-18548) JS: wrong string interpolation with generic or Any parameters +- [`KT-19772`](https://youtrack.jetbrains.com/issue/KT-19772) JS: wrong boxing behavior for open val and final fun inside open class +- [`KT-19794`](https://youtrack.jetbrains.com/issue/KT-19794) runtime crash with empty object (Javascript) +- [`KT-19818`](https://youtrack.jetbrains.com/issue/KT-19818) JS: generate paths relative to .map file by default (unless "-source-map-prefix" is used) +- [`KT-19906`](https://youtrack.jetbrains.com/issue/KT-19906) JS: rename compiler option "-source-map-source-roots" to avoid misleading since sourcemaps have field called "sourceRoot" +- [`KT-20287`](https://youtrack.jetbrains.com/issue/KT-20287) Functions don't actually return Unit in Kotlin-JS -> unexpected null problems vs JDK version +- [`KT-20451`](https://youtrack.jetbrains.com/issue/KT-20451) KotlinJs - interface function with default parameter, overridden by implementor, can't be found at runtime +- [`KT-20527`](https://youtrack.jetbrains.com/issue/KT-20527) JS: use prototype chain to check that object implements kotlin interface +- [`KT-20650`](https://youtrack.jetbrains.com/issue/KT-20650) JS: compiler crashes in Java 9 with NoClassDefFoundError +- [`KT-20653`](https://youtrack.jetbrains.com/issue/KT-20653) JS: compiler crashes in Java 9 with TranslationRuntimeException + +### Language design + +- [`KT-20171`](https://youtrack.jetbrains.com/issue/KT-20171) Deprecate assigning single elements to varargs in named form + +### Libraries + +- [`KT-19696`](https://youtrack.jetbrains.com/issue/KT-19696) Provide a way to write multiplatform tests +- [`KT-18961`](https://youtrack.jetbrains.com/issue/KT-18961) Closeable.use should call addSuppressed +- [`KT-2460`](https://youtrack.jetbrains.com/issue/KT-2460) [`PR-1300`](https://github.com/JetBrains/kotlin/pull/1300) `shuffle` and `fill` extensions for MutableList now also available in JS +- [`PR-1230`](https://github.com/JetBrains/kotlin/pull/1230) Add assertSame and assertNotSame methods to kotlin-test + +### Tools. Gradle + +- [`KT-20553`](https://youtrack.jetbrains.com/issue/KT-20553) Rename `warningsAsErrors` compiler option to `allWarningsAsErrors` +- [`KT-20217`](https://youtrack.jetbrains.com/issue/KT-20217) `src/main/java` and `src/test/java` source directories are no longer included by default in Kotlin/JS and Kotlin/Common projects + +### Tools. Incremental Compile + +- [`KT-20654`](https://youtrack.jetbrains.com/issue/KT-20654) AndroidStudio: NSME “PsiJavaModule.getName()Ljava/lang/String” on calling simple Kotlin functions like println(), listOf() + +### Binary Metadata + +- [`KT-20547`](https://youtrack.jetbrains.com/issue/KT-20547) Write pre-release flag into class files if language version > LATEST_STABLE + +## 1.2-Beta + +### Android + +#### New Features + +- [`KT-20051`](https://youtrack.jetbrains.com/issue/KT-20051) Quickfixes to support @Parcelize +#### Fixes + +- [`KT-19747`](https://youtrack.jetbrains.com/issue/KT-19747) Android extensions + Parcelable: VerifyError in case of RawValue annotation on a type when it's unknown how to parcel it +- [`KT-19899`](https://youtrack.jetbrains.com/issue/KT-19899) Parcelize: Building with ProGuard enabled +- [`KT-19988`](https://youtrack.jetbrains.com/issue/KT-19988) [Android Extensions] inner class LayoutContainer causes NoSuchMethodError +- [`KT-20002`](https://youtrack.jetbrains.com/issue/KT-20002) Parcelize explodes on LongArray +- [`KT-20019`](https://youtrack.jetbrains.com/issue/KT-20019) Parcelize does not propogate flags argument when writing nested Parcelable +- [`KT-20020`](https://youtrack.jetbrains.com/issue/KT-20020) Parcelize does not use primitive array read/write methods on Parcel +- [`KT-20021`](https://youtrack.jetbrains.com/issue/KT-20021) Parcelize does not serialize Parcelable enum as Parcelable +- [`KT-20022`](https://youtrack.jetbrains.com/issue/KT-20022) Parcelize should dispatch directly to java.lang.Enum when writing an enum. +- [`KT-20034`](https://youtrack.jetbrains.com/issue/KT-20034) Application installation failed (INSTALL_FAILED_DEXOPT) in Android 4.3 devices if I use Parcelize +- [`KT-20057`](https://youtrack.jetbrains.com/issue/KT-20057) Parcelize should use specialized write/create methods where available. +- [`KT-20062`](https://youtrack.jetbrains.com/issue/KT-20062) Parceler should allow otherwise un-parcelable property types in enclosing class. +- [`KT-20170`](https://youtrack.jetbrains.com/issue/KT-20170) UAST: Getting the location of a UIdentifier is tricky + +### Compiler + +- [`KT-4565`](https://youtrack.jetbrains.com/issue/KT-4565) Support smart casting of safe cast's subject (and also safe call's receiver) +- [`KT-8492`](https://youtrack.jetbrains.com/issue/KT-8492) Null check should work after save call with elvis in condition +- [`KT-9327`](https://youtrack.jetbrains.com/issue/KT-9327) Need a way to check whether a lateinit property was assigned +- [`KT-14138`](https://youtrack.jetbrains.com/issue/KT-14138) Allow lateinit local variables +- [`KT-15461`](https://youtrack.jetbrains.com/issue/KT-15461) Allow lateinit top level properties +- [`KT-7257`](https://youtrack.jetbrains.com/issue/KT-7257) NPE when accessing properties of enum from inner lambda on initialization +- [`KT-9580`](https://youtrack.jetbrains.com/issue/KT-9580) Report an error if 'setparam' target does not make sense for a parameter declaration +- [`KT-16310`](https://youtrack.jetbrains.com/issue/KT-16310) Nested classes inside enum entries capturing outer members +- [`KT-20155`](https://youtrack.jetbrains.com/issue/KT-20155) Confusing diagnostics on a nested interface in inner class + +### IDE + +- [`KT-14175`](https://youtrack.jetbrains.com/issue/KT-14175) Surround with try ... catch (... finally) doesn't work for expressions +- [`KT-20308`](https://youtrack.jetbrains.com/issue/KT-20308) New Gradle with Kotlin DSL project wizard +- [`KT-18353`](https://youtrack.jetbrains.com/issue/KT-18353) Support UAST for .kts files +- [`KT-19823`](https://youtrack.jetbrains.com/issue/KT-19823) Kotlin Gradle project import into IntelliJ: import kapt generated classes into classpath +- [`KT-20185`](https://youtrack.jetbrains.com/issue/KT-20185) Stub and PSI element type mismatch for "var nullableSuspend: (suspend (P) -> Unit)? = null" + +### Language design + +- [`KT-14486`](https://youtrack.jetbrains.com/issue/KT-14486) Allow smart cast in closure if a local variable is modified only before it (and not after or inside) +- [`KT-15667`](https://youtrack.jetbrains.com/issue/KT-15667) Support "::foo" as a short-hand syntax for bound callable reference to "this::foo" +- [`KT-16681`](https://youtrack.jetbrains.com/issue/KT-16681) kotlin allows mutating the field of read-only property + +### Libraries + +- [`KT-19258`](https://youtrack.jetbrains.com/issue/KT-19258) Java 9: module-info.java with `requires kotlin.stdlib` causes compiler to fail: "module reads package from both kotlin.reflect and kotlin.stdlib" + +### Tools + +- [`KT-19692`](https://youtrack.jetbrains.com/issue/KT-19692) kotlin-jpa plugin doesn't support @MappedSuperclass annotation +- [`KT-20030`](https://youtrack.jetbrains.com/issue/KT-20030) Parcelize can directly reference writeToParcel and CREATOR for final, non-Parcelize Parcelable types in same compilation unit. +- [`KT-19742`](https://youtrack.jetbrains.com/issue/KT-19742) [Android extensions] Calling clearFindViewByIdCache causes NPE +- [`KT-19749`](https://youtrack.jetbrains.com/issue/KT-19749) Android extensions + Parcelable: NoSuchMethodError on attempt to pack into parcel a serializable object +- [`KT-20026`](https://youtrack.jetbrains.com/issue/KT-20026) Parcelize overrides describeContents despite being already implemented. +- [`KT-20027`](https://youtrack.jetbrains.com/issue/KT-20027) Parcelize uses wrong classloader when reading parcelable type. +- [`KT-20029`](https://youtrack.jetbrains.com/issue/KT-20029) Parcelize should not directly reference parcel methods on types outside compilation unit +- [`KT-20032`](https://youtrack.jetbrains.com/issue/KT-20032) Parcelize does not respect type nullability in case of Parcelize parcelables + +### Tools. CLI + +- [`KT-10563`](https://youtrack.jetbrains.com/issue/KT-10563) Support a command line argument -Werror to treat warnings as errors + +### Tools. Gradle + +- [`KT-20212`](https://youtrack.jetbrains.com/issue/KT-20212) Cannot access internal components from test code + +### Tools. kapt + +- [`KT-17923`](https://youtrack.jetbrains.com/issue/KT-17923) Reference to Dagger generated class is highlighted red +- [`KT-18923`](https://youtrack.jetbrains.com/issue/KT-18923) Kapt: Do not use the Kotlin error message collector to issue errors from kapt +- [`KT-19097`](https://youtrack.jetbrains.com/issue/KT-19097) Request: Decent support of `kapt.kotlin.generated` on Intellij/Android Studio +- [`KT-20001`](https://youtrack.jetbrains.com/issue/KT-20001) kapt generate stubs Gradle task does not depend on the compilation of sub-project kapt dependencies diff --git a/ChangeLog-1.3.X.md b/ChangeLog-1.3.X.md new file mode 100644 index 00000000000..06e195d9edf --- /dev/null +++ b/ChangeLog-1.3.X.md @@ -0,0 +1,3879 @@ +# Changelog 1.3.X + +## 1.3.72 - IDE plugins update + +### Backend. JVM + +- [`KT-39013`](https://youtrack.jetbrains.com/issue/KT-39013) 202, ASM 8: "AnalyzerException: Execution can fall off the end of the code" + +### IDE. Decompiler, Indexing, Stubs + +- [`KT-37896`](https://youtrack.jetbrains.com/issue/KT-37896) IAE: "Argument for @NotNull parameter 'file' of IndexTodoCacheManagerImpl.getTodoCount must not be null" through KotlinTodoSearcher.processQuery() + +### IDE. Gradle Integration + +- [`KT-38037`](https://youtrack.jetbrains.com/issue/KT-38037) UnsupportedOperationException on sync gradle Kotlin project with at least two multiplatform modules + +### IDE. Highlighting + +- [`KT-39590`](https://youtrack.jetbrains.com/issue/KT-39590) Turn new inference in IDE for 1.3.70 version off + +### IDE. Refactorings + +- [`KT-38527`](https://youtrack.jetbrains.com/issue/KT-38527) Move nested class to upper level fails silently: MissingResourceException + +### Tools.JPS + +- [`KT-27458`](https://youtrack.jetbrains.com/issue/KT-27458) The Kotlin standard library is not found in the module graph ... in a non-Kotlin project. + + +## 1.3.72 + +### Compiler + +- [`KT-37107`](https://youtrack.jetbrains.com/issue/KT-37107) kotlinc allows calling default constructor of class with no constructors +- [`KT-37406`](https://youtrack.jetbrains.com/issue/KT-37406) NI: "UnsupportedOperationException: no descriptor for type constructor of TypeVariable(T)" when compiling `*.gradle.kts` file + +### IDE + +- [`KT-37483`](https://youtrack.jetbrains.com/issue/KT-37483) Kotlin localisation +- [`KT-37629`](https://youtrack.jetbrains.com/issue/KT-37629) False positive "Unsupported [literal prefixes and suffixes]" for infix function +- [`KT-37808`](https://youtrack.jetbrains.com/issue/KT-37808) "Resolve pasted references" dialog freezes UI for 20 seconds when pasting kotlin code + +### IDE. Completion + +- [`KT-37144`](https://youtrack.jetbrains.com/issue/KT-37144) Completion goes into an infinite loop with Arrow 0.10.4 dependency + +### IDE. Debugger + +- [`KT-37767`](https://youtrack.jetbrains.com/issue/KT-37767) Debugger, NPE happens while stepping. + +### IDE. Editing + +- [`KT-35135`](https://youtrack.jetbrains.com/issue/KT-35135) UI freeze: not enough checkCancelled on resolve path + +### IDE. Inspections and Intentions + +- [`KT-37217`](https://youtrack.jetbrains.com/issue/KT-37217) Replace UseExperimental with OptIn intention removes target prefixes for annotations + +### IDE. Native + +- [`KT-38079`](https://youtrack.jetbrains.com/issue/KT-38079) IDEA navigates to wrong line of source code from Native stack trace + +### IDE. Navigation + +- [`KT-37487`](https://youtrack.jetbrains.com/issue/KT-37487) Destructuring declarations are called "destruction declarations" in UI + +### Tools. Gradle. Native + +- [`KT-37696`](https://youtrack.jetbrains.com/issue/KT-37696) MPP Gradle plugin: False positive parallel execution detection if build started with --continue + +## 1.3.71 + +### Compiler + +- [`KT-36095`](https://youtrack.jetbrains.com/issue/KT-36095) 201: False positive OVERLOAD_RESOLUTION_AMBIGUITY with Java `Enum.valueOf` and `Enum.values()` reference +- [`KT-37040`](https://youtrack.jetbrains.com/issue/KT-37040) 'No explicit visibility in API mode' should not be reported on enum members +- [`KT-37204`](https://youtrack.jetbrains.com/issue/KT-37204) AssertionError: "No delegated property metadata owner for" with lazy inside inline function + +### Docs & Examples + +- [`KT-37029`](https://youtrack.jetbrains.com/issue/KT-37029) Kotlin full stack app demo: update all involving versions to work with 1.3.70 release + +### IDE + +- [`KT-34759`](https://youtrack.jetbrains.com/issue/KT-34759) "PSI and index do not match" and high CPU usage when the library has `enum` with elements in quotes and `internal lazy val` in another part of code +- [`KT-37200`](https://youtrack.jetbrains.com/issue/KT-37200) StackOverflowError in LightMethodBuilder.equals when analysing Kotlin files +- [`KT-37229`](https://youtrack.jetbrains.com/issue/KT-37229) java.lang.NoSuchMethodError: 'com.intellij.psi.impl.light.LightJavaModule, com.intellij.psi.impl.light.LightJavaModule.findModule after updating kotlin plugin to 1.3.70 +- [`KT-37273`](https://youtrack.jetbrains.com/issue/KT-37273) No error in editor when typing unresolved reference in super constructor lambda +- [`KT-37414`](https://youtrack.jetbrains.com/issue/KT-37414) Not all imports are added on paste if code is formatted after paste +- [`KT-37553`](https://youtrack.jetbrains.com/issue/KT-37553) Run inspections after general highlight pass + +### IDE. Code Style, Formatting + +- [`KT-37545`](https://youtrack.jetbrains.com/issue/KT-37545) Continuation indent for method's parameter changes in call chain + +### IDE. Hints + +- [`KT-37537`](https://youtrack.jetbrains.com/issue/KT-37537) IDE is missing or swallowing keystrokes when hint popups are displayed + +### IDE. Inspections and Intentions + +- [`KT-36478`](https://youtrack.jetbrains.com/issue/KT-36478) IDE suggests to use 'OptIn' annotation when it is not available in the used version of kotlin-stdlib +- [`KT-37294`](https://youtrack.jetbrains.com/issue/KT-37294) False positive "Unused unary operator" on negative long annotation value + +### IDE. Navigation + +- [`KT-36657`](https://youtrack.jetbrains.com/issue/KT-36657) KotlinFindUsagesHandler#processElementUsages always return false if options.isSearchForTextOccurrences is false + +### IDE. Refactorings + +- [`KT-37451`](https://youtrack.jetbrains.com/issue/KT-37451) Change of signature error: Type of parameter cannot be resolved +- [`KT-37597`](https://youtrack.jetbrains.com/issue/KT-37597) Support Suggest rename and change signature refactorings in Kotlin for IDEA 2020.1 + +### IDE. Run Configurations + +- [`KT-36781`](https://youtrack.jetbrains.com/issue/KT-36781) Override ConfigurationFactory::getId method in Kotlin plugin to avoid problems with localizations + +### JavaScript + +- [`KT-37386`](https://youtrack.jetbrains.com/issue/KT-37386) Incorrect JS generated by the compiler: function is erased by the function parameter + +### Tools. Gradle. JS + +- [`KT-36196`](https://youtrack.jetbrains.com/issue/KT-36196) Investigate performance problems while resolving in projects with npm dependencies + +### Tools. Gradle. Multiplatform + +- [`KT-37264`](https://youtrack.jetbrains.com/issue/KT-37264) In intermediate common source sets, internals are not visible from their dependsOn source sets during Gradle build + +### Tools. Gradle. Native + +- [`KT-37565`](https://youtrack.jetbrains.com/issue/KT-37565) MPP plugin: Forbid parallel in-process execution of the Kotlin/Native compiler + +### Tools. kapt + +- [`KT-37241`](https://youtrack.jetbrains.com/issue/KT-37241) Kapt: Classpath entry points to a non-existent location: ...build/intermediates/javac/debug/classes... + + +## 1.3.70 + +### Compiler + +#### New Features + +- [`KT-34648`](https://youtrack.jetbrains.com/issue/KT-34648) Support custom messages for @RequiresOptIn-marked annotations + +#### Performance Improvements + +- [`KT-14513`](https://youtrack.jetbrains.com/issue/KT-14513) Suboptimal compilation of lazy delegated properties with inline getValue + +#### Fixes + +- [`KT-19234`](https://youtrack.jetbrains.com/issue/KT-19234) Improve "Supertypes of the following classes cannot be resolved" diagnostic +- [`KT-21178`](https://youtrack.jetbrains.com/issue/KT-21178) Prohibit access of protected members inside public inline members +- [`KT-24461`](https://youtrack.jetbrains.com/issue/KT-24461) Expect interface with suspend function with default arguments causes runtime error +- [`KT-25514`](https://youtrack.jetbrains.com/issue/KT-25514) Support usage of function reference with vararg where function of array is expected in new inference +- [`KT-26435`](https://youtrack.jetbrains.com/issue/KT-26435) Bad frame merge after inline +- [`KT-27825`](https://youtrack.jetbrains.com/issue/KT-27825) Gradually prohibit non-abstract classes containing abstract members invisible from that classes (internal/package-private) +- [`KT-27999`](https://youtrack.jetbrains.com/issue/KT-27999) Generic type is fixed too early for lambda arguments +- [`KT-28940`](https://youtrack.jetbrains.com/issue/KT-28940) Concurrency issue for lazy values with the post-computation phase +- [`KT-29242`](https://youtrack.jetbrains.com/issue/KT-29242) Conditional with generic type Nothing inside inline function throws `java.lang.VerifyError: Bad return type` +- [`KT-30244`](https://youtrack.jetbrains.com/issue/KT-30244) Unable to infer common return type for two postponed arguments +- [`KT-30245`](https://youtrack.jetbrains.com/issue/KT-30245) Wrong type is inferred for lambda if it has expected type with an extension receiver +- [`KT-30277`](https://youtrack.jetbrains.com/issue/KT-30277) Relax the "no reflection found in class path" warning for KType and related API +- [`KT-30744`](https://youtrack.jetbrains.com/issue/KT-30744) Invoking Interface Static Method from Extension method generates incorrect jvm bytecode +- [`KT-30953`](https://youtrack.jetbrains.com/issue/KT-30953) Missing unresolved if callable reference is used in the place in which common super type is computing +- [`KT-31227`](https://youtrack.jetbrains.com/issue/KT-31227) Prohibit using array based on non-reified type parameters as reified type arguments on JVM +- [`KT-31242`](https://youtrack.jetbrains.com/issue/KT-31242) "Can't find enclosing method" proguard compilation exception with inline and crossinline +- [`KT-31411`](https://youtrack.jetbrains.com/issue/KT-31411) Support mode of compiler where it analyses source-set as platform one, but produces only metadata for that specific source-set +- [`KT-31653`](https://youtrack.jetbrains.com/issue/KT-31653) Incorrect transformation of the try-catch cover when inlining +- [`KT-31923`](https://youtrack.jetbrains.com/issue/KT-31923) Outer finally block inserted before return instruction is not excluded from catch interval of inner try (without finally) block +- [`KT-31975`](https://youtrack.jetbrains.com/issue/KT-31975) No diagnostic on error type +- [`KT-32106`](https://youtrack.jetbrains.com/issue/KT-32106) New type inference: IDE shows error but the code compiles succesfully +- [`KT-32138`](https://youtrack.jetbrains.com/issue/KT-32138) New type inference: Invoking type-aliased extension function red in IDE, but compiles +- [`KT-32168`](https://youtrack.jetbrains.com/issue/KT-32168) Problem in IDE with new type inference and delegate provider +- [`KT-32243`](https://youtrack.jetbrains.com/issue/KT-32243) New type inference: Type mistmatch in collection type usage +- [`KT-32345`](https://youtrack.jetbrains.com/issue/KT-32345) New type inference: Error when using helper method to create delegate provider +- [`KT-32372`](https://youtrack.jetbrains.com/issue/KT-32372) Type inference errors in IDE +- [`KT-32415`](https://youtrack.jetbrains.com/issue/KT-32415) Type mismatch on argument of super constructor of inner class call +- [`KT-32423`](https://youtrack.jetbrains.com/issue/KT-32423) New type inference: IllegalStateException: Error type encountered: org.jetbrains.kotlin.types.ErrorUtils$UninferredParameterTypeConstructor@211a538e (ErrorType) +- [`KT-32435`](https://youtrack.jetbrains.com/issue/KT-32435) New inference preserves platform types while old inference can substitute them with the nullable result type +- [`KT-32456`](https://youtrack.jetbrains.com/issue/KT-32456) New type inference: "IllegalStateException: Error type encountered" when adding emptyList to mutableList +- [`KT-32499`](https://youtrack.jetbrains.com/issue/KT-32499) Kotlin/JS 1.3.40 - new type inference with toTypedArray() failure +- [`KT-32742`](https://youtrack.jetbrains.com/issue/KT-32742) Gradle/JS "Unresolved Reference" when accessing setting field of Dynamic object w/ React +- [`KT-32818`](https://youtrack.jetbrains.com/issue/KT-32818) Type inference failed with elvis operator +- [`KT-32862`](https://youtrack.jetbrains.com/issue/KT-32862) New type inference: Compilation error "IllegalArgumentException: ClassicTypeSystemContextForCS couldn't handle" with overloaded generic extension function reference passed as parameter +- [`KT-33033`](https://youtrack.jetbrains.com/issue/KT-33033) New type inference: Nothing incorrectly inferred as return type when null passed to generic function with expression if statement body +- [`KT-33197`](https://youtrack.jetbrains.com/issue/KT-33197) Expression with branch resolving to List<…> ultimately resolves to MutableList<…> +- [`KT-33263`](https://youtrack.jetbrains.com/issue/KT-33263) "IllegalStateException: Type variable TypeVariable(T) should not be fixed!" with generic extension function and in variance +- [`KT-33542`](https://youtrack.jetbrains.com/issue/KT-33542) Compilation failed with "AssertionError: Suspend functions may be called either as suspension points or from another suspend function" +- [`KT-33544`](https://youtrack.jetbrains.com/issue/KT-33544) "UnsupportedOperationException: no descriptor for type constructor of TypeVariable(R)?" with BuilderInference and elvis operator +- [`KT-33592`](https://youtrack.jetbrains.com/issue/KT-33592) New type inference: Missed error in IDE — Unsupported [Collection literals outside of annotations] +- [`KT-33932`](https://youtrack.jetbrains.com/issue/KT-33932) Compiler fails when it encounters inaccessible classes in javac integration mode +- [`KT-34029`](https://youtrack.jetbrains.com/issue/KT-34029) StackOverflowError for access to nested object inheriting from containing generic class at `org.jetbrains.kotlin.descriptors.impl.LazySubstitutingClassDescriptor.getTypeConstructor` +- [`KT-34060`](https://youtrack.jetbrains.com/issue/KT-34060) UNUSED_PARAMETER is not reported on unused parameters of non-operator getValue/setValue/prodiveDelegate functions +- [`KT-34282`](https://youtrack.jetbrains.com/issue/KT-34282) Missing diagnostic of unresolved for callable references with overload resolution ambiguity +- [`KT-34391`](https://youtrack.jetbrains.com/issue/KT-34391) New type inference: False negative EXPERIMENTAL_API_USAGE_ERROR with callable reference +- [`KT-34395`](https://youtrack.jetbrains.com/issue/KT-34395) KtWhenConditionInRange.isNegated() doesn't work +- [`KT-34500`](https://youtrack.jetbrains.com/issue/KT-34500) CompilationException when loop range is DoubleArray and loop parameter is casted to super-type (e.g. Any, Number, etc.) +- [`KT-34647`](https://youtrack.jetbrains.com/issue/KT-34647) Gradually rename experimentality annotations +- [`KT-34649`](https://youtrack.jetbrains.com/issue/KT-34649) Deprecate `-Xexperimental` flag +- [`KT-34779`](https://youtrack.jetbrains.com/issue/KT-34779) JVM: "get()" is not invoked in optimized "for" loop over CharSequence.withIndex() with unused variable ("_") for the element in destructuring declaration +- [`KT-34786`](https://youtrack.jetbrains.com/issue/KT-34786) Flaky type inference for lambda expressions +- [`KT-34820`](https://youtrack.jetbrains.com/issue/KT-34820) New type inference: Red code when expanding type-aliased extension function in LHS position of elvis +- [`KT-34888`](https://youtrack.jetbrains.com/issue/KT-34888) Kotlin REPL ignores compilation errors in class declaration +- [`KT-35035`](https://youtrack.jetbrains.com/issue/KT-35035) Incorrect state-machine generated for suspend lambda inside inline lambda +- [`KT-35101`](https://youtrack.jetbrains.com/issue/KT-35101) "AssertionError: Mapping ranges should be presented in inline lambda" with a callable reference argument to inline lambda +- [`KT-35168`](https://youtrack.jetbrains.com/issue/KT-35168) New type inference: "UninitializedPropertyAccessException: lateinit property subResolvedAtoms has not been initialized" +- [`KT-35172`](https://youtrack.jetbrains.com/issue/KT-35172) New type inference: False positive type mismatch if nullable type after elvis and safe call inside lambda is returning (expected type is specified explicitly) +- [`KT-35224`](https://youtrack.jetbrains.com/issue/KT-35224) New type inference: Java call candidate with varargs as Array isn't present if SAM type was used in this call +- [`KT-35262`](https://youtrack.jetbrains.com/issue/KT-35262) Suspend function with Unit return type returns non-unit value if it is derived from function with non-unit return type +- [`KT-35426`](https://youtrack.jetbrains.com/issue/KT-35426) `IncompatibleClassChangeError: Method 'int java.lang.Object.hashCode()' must be Methodref constant` when invoking on super with explicit generic type +- [`KT-35843`](https://youtrack.jetbrains.com/issue/KT-35843) Emit type annotations in JVM bytecode with target 1.8+ on basic constructions +- [`KT-36297`](https://youtrack.jetbrains.com/issue/KT-36297) New type inference: ClassNotFoundException: compiler emits reference to nonexisting class for code with nested inline lambdas +- [`KT-36719`](https://youtrack.jetbrains.com/issue/KT-36719) Enable new inference in IDE since 1.3.70 + +### Docs & Examples + +- [`KT-31118`](https://youtrack.jetbrains.com/issue/KT-31118) Provide missing documentation for StringBuilder members + +### IDE + +#### New Features + +- [`KT-27496`](https://youtrack.jetbrains.com/issue/KT-27496) Color Scheme: allow changing style for suspend function calls +- [`KT-30806`](https://youtrack.jetbrains.com/issue/KT-30806) Add IntelliJ Color Scheme rules for property declarations +- [`KT-34303`](https://youtrack.jetbrains.com/issue/KT-34303) IDE should suggest to import an extension iterator function when using for loop with a range +- [`KT-34567`](https://youtrack.jetbrains.com/issue/KT-34567) Feature: Auto add val keyword on typing data/inline class ctor parameters +- [`KT-34667`](https://youtrack.jetbrains.com/issue/KT-34667) Add auto-import quickfix for overloaded generic function + +#### Performance Improvements + +- [`KT-30726`](https://youtrack.jetbrains.com/issue/KT-30726) Editor is laggy if the code below a current line has unresolved reference +- [`KT-30863`](https://youtrack.jetbrains.com/issue/KT-30863) IDE freeze on editing with "Add unambiguous imports on the fly" turned on +- [`KT-32868`](https://youtrack.jetbrains.com/issue/KT-32868) Provide incremental analysis of file when it is applicable +- [`KT-33250`](https://youtrack.jetbrains.com/issue/KT-33250) KtLightClassForSourceDeclaration.isFinal() can be very slow (with implications for class inheritor search) +- [`KT-33905`](https://youtrack.jetbrains.com/issue/KT-33905) Optimize imports under reasonable progress +- [`KT-33939`](https://youtrack.jetbrains.com/issue/KT-33939) Copy action leads to freezes +- [`KT-34956`](https://youtrack.jetbrains.com/issue/KT-34956) UI Freeze: PlainTextPasteImportResolver +- [`KT-35121`](https://youtrack.jetbrains.com/issue/KT-35121) Add support for KtSecondaryConstructors into incremental analysis +- [`KT-35189`](https://youtrack.jetbrains.com/issue/KT-35189) Support incremental analysis of comment and kdoc +- [`KT-35590`](https://youtrack.jetbrains.com/issue/KT-35590) UI freeze in kotlin.idea.core.script.ScriptConfigurationMemoryCache when editing file + +#### Fixes + +- [`KT-10478`](https://youtrack.jetbrains.com/issue/KT-10478) Move-statement doesn't work for methods with single-expression body and lambda as returning type +- [`KT-13344`](https://youtrack.jetbrains.com/issue/KT-13344) Reduce visual distraction of val keyword +- [`KT-14758`](https://youtrack.jetbrains.com/issue/KT-14758) Move statement up shouldn't move top level declarations above package and import directives +- [`KT-23305`](https://youtrack.jetbrains.com/issue/KT-23305) We should be able to see platform-specific errors in common module +- [`KT-24399`](https://youtrack.jetbrains.com/issue/KT-24399) No scrollbar in Kotlin compiler settings +- [`KT-27806`](https://youtrack.jetbrains.com/issue/KT-27806) UAST: @Deprecated(level=DeprecationLevel.HIDDEN) makes method disappear +- [`KT-28708`](https://youtrack.jetbrains.com/issue/KT-28708) Java IDE fails to understand @JvmDefault on properties from binaries +- [`KT-30489`](https://youtrack.jetbrains.com/issue/KT-30489) Kotlin functions are represented in UAST as UAnnotationMethods +- [`KT-31037`](https://youtrack.jetbrains.com/issue/KT-31037) Lambda expression default parameter 'it' sometimes is not highlighted in a call chain +- [`KT-31365`](https://youtrack.jetbrains.com/issue/KT-31365) IDE does not resolve references to stdlib symbols in certain packages (kotlin.jvm) when using OSGi bundle +- [`KT-32031`](https://youtrack.jetbrains.com/issue/KT-32031) UAST: Method body missing for suspend functions +- [`KT-32540`](https://youtrack.jetbrains.com/issue/KT-32540) Ultra light class support for compiler plugins +- [`KT-33820`](https://youtrack.jetbrains.com/issue/KT-33820) Stop using `com.intellij.codeInsight.AnnotationUtil#isJetbrainsAnnotation` +- [`KT-33846`](https://youtrack.jetbrains.com/issue/KT-33846) Stop using `com.intellij.openapi.vfs.newvfs.BulkFileListener.Adapter` +- [`KT-33888`](https://youtrack.jetbrains.com/issue/KT-33888) Bad indentation when copy-paste to trimIndent() +- [`KT-34081`](https://youtrack.jetbrains.com/issue/KT-34081) Kotlin constants used in Java annotation attributes trigger "Attribute value must be constant" error +- [`KT-34316`](https://youtrack.jetbrains.com/issue/KT-34316) UAST: reified methods no longer visible in UAST +- [`KT-34337`](https://youtrack.jetbrains.com/issue/KT-34337) Descriptors Leak in UltraLightClasses +- [`KT-34379`](https://youtrack.jetbrains.com/issue/KT-34379) "Implement members" with unspecified type argument: "AssertionError: 2 declarations in override fun" +- [`KT-34785`](https://youtrack.jetbrains.com/issue/KT-34785) Enter handler: do not add 'trimIndent()' in const +- [`KT-34914`](https://youtrack.jetbrains.com/issue/KT-34914) Analysis sometimes isn't rerun until an out of code block change +- [`KT-35222`](https://youtrack.jetbrains.com/issue/KT-35222) SQL language is not injected to String array attribute of Java annotation +- [`KT-35266`](https://youtrack.jetbrains.com/issue/KT-35266) Kotlin-specific setting "Optimize imports on the fly" is useless +- [`KT-35454`](https://youtrack.jetbrains.com/issue/KT-35454) Weird implementation of KtUltraLightFieldImpl.isEquivalentTo +- [`KT-35673`](https://youtrack.jetbrains.com/issue/KT-35673) ClassCastException on destructuring declaration with annotation +- [`KT-36008`](https://youtrack.jetbrains.com/issue/KT-36008) IDEA 201: NSME: "com.intellij.openapi.progress.util.ProgressIndicatorUtils.awaitWithCheckCanceled(Future)" at org.jetbrains.kotlin.idea.util.ProgressIndicatorUtils.awaitWithCheckCanceled() + +### IDE. Code Style, Formatting + +#### New Features + +- [`KT-35088`](https://youtrack.jetbrains.com/issue/KT-35088) Insert empty line between a declaration and declaration with comment +- [`KT-35106`](https://youtrack.jetbrains.com/issue/KT-35106) Insert empty line between a declaration and declaration with annotation + +#### Fixes + +- [`KT-4194`](https://youtrack.jetbrains.com/issue/KT-4194) Code formatter should not move end of line comment after `if` condition to the next line +- [`KT-12490`](https://youtrack.jetbrains.com/issue/KT-12490) Formatter inserts empty line between single-line declarations in presence of comment +- [`KT-22273`](https://youtrack.jetbrains.com/issue/KT-22273) Labeled statements are formatted incorrectly +- [`KT-22362`](https://youtrack.jetbrains.com/issue/KT-22362) Formatter breaks up infix function used in elvis operator +- [`KT-23811`](https://youtrack.jetbrains.com/issue/KT-23811) Formatter: Constructor parameters are joined with previous line if prefixed with an annotation +- [`KT-23929`](https://youtrack.jetbrains.com/issue/KT-23929) Formatter: chained method calls: "Chop down if long" setting is ignored +- [`KT-23957`](https://youtrack.jetbrains.com/issue/KT-23957) Formatter tears comments away from file annotations +- [`KT-30393`](https://youtrack.jetbrains.com/issue/KT-30393) Remove unnecessary whitespaces between property accessor and its parameter list in formatter +- [`KT-31881`](https://youtrack.jetbrains.com/issue/KT-31881) Redundant indent for single-line comments inside lamdba +- [`KT-32277`](https://youtrack.jetbrains.com/issue/KT-32277) Space before by delegate keyword on property is not formatted +- [`KT-32324`](https://youtrack.jetbrains.com/issue/KT-32324) Formatter doesn't insert space after safe cast operator `as?` +- [`KT-33553`](https://youtrack.jetbrains.com/issue/KT-33553) Formater does not wrap function chained expression body despite "chained function calls" settings +- [`KT-34049`](https://youtrack.jetbrains.com/issue/KT-34049) Formatter breaks string inside template expression with elvis operator +- [`KT-35093`](https://youtrack.jetbrains.com/issue/KT-35093) Formatter inserts empty line between single-line declarations in presence of annotation +- [`KT-35199`](https://youtrack.jetbrains.com/issue/KT-35199) Wrong formatting for lambdas in chain calls + +### IDE. Completion + +#### Fixes + +- [`KT-15286`](https://youtrack.jetbrains.com/issue/KT-15286) Support import auto-completion for extension functions declared in objects +- [`KT-23026`](https://youtrack.jetbrains.com/issue/KT-23026) Code completion: Incorrect `const` in class declaration line +- [`KT-23834`](https://youtrack.jetbrains.com/issue/KT-23834) Code completion and auto import do not suggest extension that differs from member only in type parameter +- [`KT-25732`](https://youtrack.jetbrains.com/issue/KT-25732) `null` keyword should have priority in completion sort +- [`KT-29840`](https://youtrack.jetbrains.com/issue/KT-29840) `const` is suggested inside the class body, despite it's illegal +- [`KT-29926`](https://youtrack.jetbrains.com/issue/KT-29926) Suggest lambda parameter names in IDE to improve DSL adoption +- [`KT-31762`](https://youtrack.jetbrains.com/issue/KT-31762) Completion: Parameter name is suggested instead of enum entry in entry constructor +- [`KT-32615`](https://youtrack.jetbrains.com/issue/KT-32615) PIEAE for smart completion of anonymous function with importing name inside of function +- [`KT-33979`](https://youtrack.jetbrains.com/issue/KT-33979) No completion for functions from nested objects +- [`KT-34150`](https://youtrack.jetbrains.com/issue/KT-34150) No completion for object methods that override something +- [`KT-34386`](https://youtrack.jetbrains.com/issue/KT-34386) Typo in Kotlin arg postfix completion +- [`KT-34414`](https://youtrack.jetbrains.com/issue/KT-34414) Completion works differently for suspend and regular lambda functions +- [`KT-34644`](https://youtrack.jetbrains.com/issue/KT-34644) Code completion list sorting: do not put method before "return" keyword +- [`KT-35042`](https://youtrack.jetbrains.com/issue/KT-35042) Selecting completion variant works differently for suspend and regular lambda parameter +- [`KT-36306`](https://youtrack.jetbrains.com/issue/KT-36306) Code completion inlines content of FQN class if completion called in string + +### IDE. Debugger + +#### Fixes + +- [`KT-12242`](https://youtrack.jetbrains.com/issue/KT-12242) Breakpoint in a class is not hit if the class was first accessed in Evaluate Expression +- [`KT-16277`](https://youtrack.jetbrains.com/issue/KT-16277) Can't set breakpoint for object construction +- [`KT-20342`](https://youtrack.jetbrains.com/issue/KT-20342) Step Over jumps to wrong position (KotlinUFile) +- [`KT-30909`](https://youtrack.jetbrains.com/issue/KT-30909) "Kotlin variables" button looks inconsistent with panel style +- [`KT-32704`](https://youtrack.jetbrains.com/issue/KT-32704) ISE "Descriptor can be left only if it is last" on calling function with expression body inside Evaluate Expression window +- [`KT-32736`](https://youtrack.jetbrains.com/issue/KT-32736) Evaluate Expression on statement makes error or shows nothing +- [`KT-32741`](https://youtrack.jetbrains.com/issue/KT-32741) "Anonymous functions with names are prohibited" on evaluating functions in Expression mode +- [`KT-33303`](https://youtrack.jetbrains.com/issue/KT-33303) "Smart step into" doesn't work for library declarations +- [`KT-33304`](https://youtrack.jetbrains.com/issue/KT-33304) Can't put a breakpoint to the first line in file +- [`KT-33728`](https://youtrack.jetbrains.com/issue/KT-33728) Smart Step Into doesn't work for @InlineOnly functions +- [`KT-35316`](https://youtrack.jetbrains.com/issue/KT-35316) IndexNotReadyException on function breakpoint + +### IDE. Folding + +- [`KT-6316`](https://youtrack.jetbrains.com/issue/KT-6316) Folding of multiline functions which don't have curly braces (expression-body functions) + +### IDE. Gradle Integration + +- [`KT-35442`](https://youtrack.jetbrains.com/issue/KT-35442) KotlinMPPGradleModelBuilder shows warnings on import because it can't find a not existing directory + +### IDE. Gradle. Script + +- [`KT-31976`](https://youtrack.jetbrains.com/issue/KT-31976) Adding a space in build.gradle.kts leads to 'Gradle projects need to be imported' notification +- [`KT-34441`](https://youtrack.jetbrains.com/issue/KT-34441) *.gradle.kts: load all scripts configuration at project import +- [`KT-34442`](https://youtrack.jetbrains.com/issue/KT-34442) *.gradle.kts: avoid just-in-case script configuration request to Gradle +- [`KT-34530`](https://youtrack.jetbrains.com/issue/KT-34530) Equal duplicate script definitions are listed three times in Preferences +- [`KT-34740`](https://youtrack.jetbrains.com/issue/KT-34740) Implement completion for implicit receivers in scripts with new scripting API +- [`KT-34795`](https://youtrack.jetbrains.com/issue/KT-34795) Gradle Kotlin DSL new project template: don't use `setUrl` syntax in `settings.gradle.kts` `pluginManagement` block +- [`KT-35096`](https://youtrack.jetbrains.com/issue/KT-35096) Duplicated “Kotlin Script” definition for Gradle/Kotlin projects +- [`KT-35149`](https://youtrack.jetbrains.com/issue/KT-35149) build.graldle.kts settings importing: configuration for buildSrc/prepare-deps/build.gradle.kts not loaded +- [`KT-35205`](https://youtrack.jetbrains.com/issue/KT-35205) *.gradle.kts: avoid just-in-case script configuration request to Gradle while loading from FS +- [`KT-35563`](https://youtrack.jetbrains.com/issue/KT-35563) Track script modifications between IDE restarts + +### IDE. Hints. Parameter Info + +- [`KT-34992`](https://youtrack.jetbrains.com/issue/KT-34992) UI Freeze: Show parameter info leads to freezes + +### IDE. Inspections and Intentions + +#### New Features + +- [`KT-8478`](https://youtrack.jetbrains.com/issue/KT-8478) Make 'Add parameter to function' quick fix work to parameters other than last +- [`KT-12073`](https://youtrack.jetbrains.com/issue/KT-12073) Report IDE inspection warning on pointless unary operators on numbers +- [`KT-18536`](https://youtrack.jetbrains.com/issue/KT-18536) Provide proper quick fix for accidental override error +- [`KT-34218`](https://youtrack.jetbrains.com/issue/KT-34218) Merge 'else if' intention +- [`KT-36018`](https://youtrack.jetbrains.com/issue/KT-36018) 'Missing visibility' and 'missing explicit return type' compiler and IDE diagnostics for explicit API mode + +#### Fixes + +- [`KT-17659`](https://youtrack.jetbrains.com/issue/KT-17659) Cannot access internal Kotlin declaration from Java test code within the same module +- [`KT-25271`](https://youtrack.jetbrains.com/issue/KT-25271) "Remove redundant '.let' call" may introduce expression side effects several times +- [`KT-29737`](https://youtrack.jetbrains.com/issue/KT-29737) "Make internal/private/protected" intention works for either `expect` or `actual` side +- [`KT-31967`](https://youtrack.jetbrains.com/issue/KT-31967) Typo in inspection name: "'+=' create new list under the hood" +- [`KT-32582`](https://youtrack.jetbrains.com/issue/KT-32582) Ambiguous message for [AMBIGUOUS_ACTUALS] error (master) +- [`KT-33109`](https://youtrack.jetbrains.com/issue/KT-33109) "Add constructor parameters" quick fix should add default parameters from super class +- [`KT-33123`](https://youtrack.jetbrains.com/issue/KT-33123) False positive "Redundant qualifier name" with inner class as constructor parameter for outer +- [`KT-33297`](https://youtrack.jetbrains.com/issue/KT-33297) Improve parameter name in `Add parameter to constructor` quick fix +- [`KT-33526`](https://youtrack.jetbrains.com/issue/KT-33526) False positive "Redundant qualifier name" with enum constant initialized with companion object field +- [`KT-33580`](https://youtrack.jetbrains.com/issue/KT-33580) False positive "Redundant visibility modifier" overriding property with protected set visibility +- [`KT-33771`](https://youtrack.jetbrains.com/issue/KT-33771) False positive "Redundant Companion reference" with Java synthetic property and same-named object property +- [`KT-33796`](https://youtrack.jetbrains.com/issue/KT-33796) INVISIBLE_SETTER: quick fix "Make '' public" does not remove redundant setter +- [`KT-33902`](https://youtrack.jetbrains.com/issue/KT-33902) False positive for "Remove explicit type specification" with type alias as return type +- [`KT-33933`](https://youtrack.jetbrains.com/issue/KT-33933) "Create expect" quick fix generates the declaration in a default source set even if an alternative is chosen +- [`KT-34078`](https://youtrack.jetbrains.com/issue/KT-34078) ReplaceWith does not work if replacement is fun in companion object +- [`KT-34203`](https://youtrack.jetbrains.com/issue/KT-34203) 'Add constructor parameter' fix does not add generics +- [`KT-34297`](https://youtrack.jetbrains.com/issue/KT-34297) "Add 'replaceWith' argument" inserts positional instead of named argument +- [`KT-34325`](https://youtrack.jetbrains.com/issue/KT-34325) "Control flow with empty body" inspection should not report ifs with comments +- [`KT-34411`](https://youtrack.jetbrains.com/issue/KT-34411) Create expect/actual quick fix: focus is lost in the editor (193 IDEA) +- [`KT-34432`](https://youtrack.jetbrains.com/issue/KT-34432) Replace with safe call intention inserts redundant elvis operator +- [`KT-34603`](https://youtrack.jetbrains.com/issue/KT-34603) "Remove redundant '.let' call" false negative for reference expression +- [`KT-34694`](https://youtrack.jetbrains.com/issue/KT-34694) "Terminate preceding call with semicolon" breaks lambda formatting +- [`KT-34784`](https://youtrack.jetbrains.com/issue/KT-34784) "Indent raw string" intention: do not suggest in const +- [`KT-34894`](https://youtrack.jetbrains.com/issue/KT-34894) Action "Add not-null asserted (!!) call" doesn't fix error for properties with omitted `this` +- [`KT-35022`](https://youtrack.jetbrains.com/issue/KT-35022) Quickfix "change to var" doesn't remove `const` modifier +- [`KT-35208`](https://youtrack.jetbrains.com/issue/KT-35208) NPE from PerModulePackageCacheService +- [`KT-35242`](https://youtrack.jetbrains.com/issue/KT-35242) Text-range based inspection range shifts wrongly due to incremental analysis of whitespace and comments +- [`KT-35288`](https://youtrack.jetbrains.com/issue/KT-35288) False positive "Remove braces from 'when' entry" in 'when' expression which returns lambda +- [`KT-35837`](https://youtrack.jetbrains.com/issue/KT-35837) Editing Introduce import alias does not affect KDoc +- [`KT-36020`](https://youtrack.jetbrains.com/issue/KT-36020) Intention 'Add public modifier' is not available for highlighted declaration in explicit api mode +- [`KT-36021`](https://youtrack.jetbrains.com/issue/KT-36021) KDoc shouldn't be highlighted on 'visibility must be specified' warning in explicit api mode +- [`KT-36307`](https://youtrack.jetbrains.com/issue/KT-36307) False positive "Remove redundant '.let' call" for nested lambda change scope reference + +### IDE. Multiplatform + +- [`KT-33321`](https://youtrack.jetbrains.com/issue/KT-33321) In IDE, actuals of intermediate test source set are incorrectly matched against parent main source-set (not test one) + +### IDE. Navigation + +- [`KT-30736`](https://youtrack.jetbrains.com/issue/KT-30736) References for import alias from kotlin library not found using ReferencesSearch.search +- [`KT-35310`](https://youtrack.jetbrains.com/issue/KT-35310) PIEAE: "During querying provider Icon preview" at ClsJavaCodeReferenceElementImpl.multiResolve() on navigation to Kotlin declaration + +### IDE. Refactorings + +#### Performance Improvements + +- [`KT-24122`](https://youtrack.jetbrains.com/issue/KT-24122) Long pauses with "removing redundant imports" dialog on rename refactoring for IDEA Kotlin Plugin + +#### Fixes + +- [`KT-18191`](https://youtrack.jetbrains.com/issue/KT-18191) Refactor / Copy multiple files/classes: package statements are not updated +- [`KT-18539`](https://youtrack.jetbrains.com/issue/KT-18539) Default implement fun/property text shouldn't contain scary comment +- [`KT-28607`](https://youtrack.jetbrains.com/issue/KT-28607) Extract/Introduce variable fails if caret is just after expression +- [`KT-32514`](https://youtrack.jetbrains.com/issue/KT-32514) Moving file in with 'search for references' inlines contents in referred source code +- [`KT-32601`](https://youtrack.jetbrains.com/issue/KT-32601) Introduce variable in unformatted lambda causes PIEAE +- [`KT-32999`](https://youtrack.jetbrains.com/issue/KT-32999) Renaming parameter does not rename usage in named argument in a different file +- [`KT-33372`](https://youtrack.jetbrains.com/issue/KT-33372) Rename resource cause its content to be replaced +- [`KT-34415`](https://youtrack.jetbrains.com/issue/KT-34415) Refactor > Change signature of an overridden actual function from a platform class: "org.jetbrains.kotlin.descriptors.InvalidModuleException: Accessing invalid module descriptor" +- [`KT-34419`](https://youtrack.jetbrains.com/issue/KT-34419) Refactor > Change signature > add a function parameter: "org.jetbrains.kotlin.descriptors.InvalidModuleException: Accessing invalid module descriptor" +- [`KT-34459`](https://youtrack.jetbrains.com/issue/KT-34459) Change method signature with unresolved lambda type leads to error +- [`KT-34971`](https://youtrack.jetbrains.com/issue/KT-34971) Refactor / Copy for declarations from different sources throws IAE: "unexpected element" at CopyFilesOrDirectoriesHandler.getCommonParentDirectory() +- [`KT-35689`](https://youtrack.jetbrains.com/issue/KT-35689) Change Signature: "InvalidModuleException: Accessing invalid module descriptor" on attempt to change receiver type of a member abstract function +- [`KT-35903`](https://youtrack.jetbrains.com/issue/KT-35903) Change Signature refactoring crashes by InvalidModuleException on simplest examples + +### IDE. Run Configurations + +- [`KT-34632`](https://youtrack.jetbrains.com/issue/KT-34632) Kotlin/JS: Can not run single test method +- [`KT-35038`](https://youtrack.jetbrains.com/issue/KT-35038) Running a test in a multi-module MPP project via IntelliJ Idea gutter action produces incorrect Gradle Run configuration + +### IDE. Script + +- [`KT-34688`](https://youtrack.jetbrains.com/issue/KT-34688) Many "scanning dependencies for script definitions progresses at the same time +- [`KT-35886`](https://youtrack.jetbrains.com/issue/KT-35886) UI Freeze: ScriptClassRootsCache.hasNotCachedRoots 25 seconds + +### IDE. Tests Support + +- [`KT-33787`](https://youtrack.jetbrains.com/issue/KT-33787) IDE tests: Not able to run single test using JUnit + +### IDE. Wizards + +#### New Features + +- [`KT-36043`](https://youtrack.jetbrains.com/issue/KT-36043) Gradle, JS: Add continuous-mode run configuration in New Project Wizard templates + +#### Fixes + +- [`KT-35584`](https://youtrack.jetbrains.com/issue/KT-35584) New Project wizard: module names restrictions are too strong with no reason +- [`KT-35690`](https://youtrack.jetbrains.com/issue/KT-35690) New Project wizard: artifact and group fields are mixed up +- [`KT-35694`](https://youtrack.jetbrains.com/issue/KT-35694) New Project wizard creates settings.gradle.kts even for Groovy DSL +- [`KT-35695`](https://youtrack.jetbrains.com/issue/KT-35695) New Project wizard uses `kotlin ()` call for dependencies in non-MPP Groovy-DSL JVM project +- [`KT-35710`](https://youtrack.jetbrains.com/issue/KT-35710) New Project wizard creates non-Java source/resource roots for Kotlin/JVM JPS +- [`KT-35711`](https://youtrack.jetbrains.com/issue/KT-35711) New Project wizard: Maven: "Kotlin Test framework" template adds wrong dependency +- [`KT-35712`](https://youtrack.jetbrains.com/issue/KT-35712) New Project wizard: source root templates: switching focus from root reverts custom settings to default +- [`KT-35713`](https://youtrack.jetbrains.com/issue/KT-35713) New Project wizard: custom settings for project name, artifact and group ID are reverted to default on Previous/Next +- [`KT-35715`](https://youtrack.jetbrains.com/issue/KT-35715) New Project wizard: Maven: custom repository required for template (ktor) is not added to pom.xml +- [`KT-35718`](https://youtrack.jetbrains.com/issue/KT-35718) New Project wizard: Gradle: ktor: not existing repository is added +- [`KT-35719`](https://youtrack.jetbrains.com/issue/KT-35719) New Project wizard: Multiplatform library: entryPoint specifies not existing class name +- [`KT-35720`](https://youtrack.jetbrains.com/issue/KT-35720) New Project wizard: Multiplatform library: Groovy DSL: improve the script for nativeTarget calculation + +### JS. Tools + +- [`KT-35198`](https://youtrack.jetbrains.com/issue/KT-35198) Kotlin/JS: with references to NPM/.kjsm library DCE produces invalid resulting JavaScript +- [`KT-36349`](https://youtrack.jetbrains.com/issue/KT-36349) KJS: JS DCE use file's timestamps to compare files. It conflicts with gradle configuration 'preserveFileTimestamps = false'. + +### JavaScript + +- [`KT-30517`](https://youtrack.jetbrains.com/issue/KT-30517) KJS generates wrong call for secondary constructor w/ default argument when class inherited by object expression +- [`KT-33149`](https://youtrack.jetbrains.com/issue/KT-33149) Lambda is not a subtype of `Function<*>` +- [`KT-33327`](https://youtrack.jetbrains.com/issue/KT-33327) JS IR backend works incorrectly when function and property have the same name +- [`KT-33334`](https://youtrack.jetbrains.com/issue/KT-33334) JS IR backend can't access private var from internal inline function + +### Libraries + +#### New Features + +- [`KT-7657`](https://youtrack.jetbrains.com/issue/KT-7657) `scan()` functions for Sequences and Iterable +- [`KT-15363`](https://youtrack.jetbrains.com/issue/KT-15363) Builder functions for basic containers +- [`KT-21327`](https://youtrack.jetbrains.com/issue/KT-21327) Add Deque & ArrayDeque to Kotlin standard library +- [`KT-33069`](https://youtrack.jetbrains.com/issue/KT-33069) StringBuilder common functions +- [`KT-33761`](https://youtrack.jetbrains.com/issue/KT-33761) reduceOrNull: reduce that doesn't throw on empty input +- [`KT-35347`](https://youtrack.jetbrains.com/issue/KT-35347) Create method Collection.randomOrNull() +- [`KT-36118`](https://youtrack.jetbrains.com/issue/KT-36118) Provide API for subtyping relationship between CoroutineContextKey and elements associated with this key + +#### Fixes + +- [`KT-17544`](https://youtrack.jetbrains.com/issue/KT-17544) JS: document array destructuring behavior +- [`KT-33141`](https://youtrack.jetbrains.com/issue/KT-33141) UnderMigration annotation is defined in Kotlin, but supposed to be used from Java +- [`KT-33447`](https://youtrack.jetbrains.com/issue/KT-33447) runCatching docs suggests it catches exceptions but it catches throwables +- [`KT-35175`](https://youtrack.jetbrains.com/issue/KT-35175) Clarify documentation for XorWowRandom +- [`KT-35299`](https://youtrack.jetbrains.com/issue/KT-35299) Float.rangeTo(Float): ClosedFloatingPointRange doesn't exist in the common stdlib. + +### Reflection + +- [`KT-14720`](https://youtrack.jetbrains.com/issue/KT-14720) Move KClass.cast / KClass.isInstance into kotlin-stdlib +- [`KT-33646`](https://youtrack.jetbrains.com/issue/KT-33646) Make KClass.simpleName available on JVM without kotlin-reflect.jar +- [`KT-34586`](https://youtrack.jetbrains.com/issue/KT-34586) Make KClass.qualifiedName available on JVM without kotlin-reflect.jar + +### Tools. CLI + +- [`KT-29933`](https://youtrack.jetbrains.com/issue/KT-29933) Support relative paths in -Xfriend-paths +- [`KT-34119`](https://youtrack.jetbrains.com/issue/KT-34119) Add JVM target bytecode version 13 +- [`KT-34240`](https://youtrack.jetbrains.com/issue/KT-34240) CLI kotlinc help -include-runtime has redundant space + +### Tools. Gradle + +- [`KT-25206`](https://youtrack.jetbrains.com/issue/KT-25206) Delegate build/run to gradle results regularly in cannot delete proto.tab.value.s +- [`KT-35181`](https://youtrack.jetbrains.com/issue/KT-35181) Make kapt Gradle tasks compatible with instant execution + +### Tools. Gradle. JS + +#### New Features + +- [`KT-30659`](https://youtrack.jetbrains.com/issue/KT-30659) Run NodeJS debugger when running debug gradle task from IDEA +- [`KT-32129`](https://youtrack.jetbrains.com/issue/KT-32129) Karma: support debugging +- [`KT-32179`](https://youtrack.jetbrains.com/issue/KT-32179) DSL: allow npm in root dependencies section of single platform projects +- [`KT-32283`](https://youtrack.jetbrains.com/issue/KT-32283) Webpack: Allow to configure Webpack mode +- [`KT-32323`](https://youtrack.jetbrains.com/issue/KT-32323) Webpack: support optimized webpack bundle +- [`KT-32785`](https://youtrack.jetbrains.com/issue/KT-32785) Webpack: Asset bundling in distributions folder + +#### Fixes + +- [`KT-30917`](https://youtrack.jetbrains.com/issue/KT-30917) Tests: Inner classes mapped incorrectly in short test fail message +- [`KT-31894`](https://youtrack.jetbrains.com/issue/KT-31894) ithout Kotlin sources `browserRun` makes the build fail +- [`KT-34946`](https://youtrack.jetbrains.com/issue/KT-34946) DCE require some/all transitive dependencies. Invalid compilation result otherwise +- [`KT-35318`](https://youtrack.jetbrains.com/issue/KT-35318) IllegalStateException on clean build with `left-pad` package and generateKotlinExternals=true +- [`KT-35428`](https://youtrack.jetbrains.com/issue/KT-35428) Gradle dependency with invalid package.json +- [`KT-35598`](https://youtrack.jetbrains.com/issue/KT-35598) Actualize NPM dependencies in 1.3.70 +- [`KT-35599`](https://youtrack.jetbrains.com/issue/KT-35599) Actualize Node and Yarn versions in 1.3.70 +- [`KT-36714`](https://youtrack.jetbrains.com/issue/KT-36714) Webpack output doesn't consider Kotlin/JS exports (library mode) + +### Tools. Gradle. Multiplatform + +- [`KT-31570`](https://youtrack.jetbrains.com/issue/KT-31570) Deprecate Kotlin 1.2.x MPP Gradle plugins +- [`KT-35126`](https://youtrack.jetbrains.com/issue/KT-35126) Support Gradle instant execution for Kotlin/JVM and Android tasks +- [`KT-36469`](https://youtrack.jetbrains.com/issue/KT-36469) Dependencies with compileOnly scope are not visible in Gradle build of MPP with source set hierarchies support + +### Tools. Gradle. Native + +- [`KT-29395`](https://youtrack.jetbrains.com/issue/KT-29395) Allow setting custom destination directory for Kotlin/Native binaries +- [`KT-31542`](https://youtrack.jetbrains.com/issue/KT-31542) Allow changing a name of a framework created by CocoaPods Gradle plugin +- [`KT-32750`](https://youtrack.jetbrains.com/issue/KT-32750) Support subspecs in CocoaPods plugin +- [`KT-35352`](https://youtrack.jetbrains.com/issue/KT-35352) MPP Gradle plugin: Support exporting K/N dependencies to shared and static libraries +- [`KT-35934`](https://youtrack.jetbrains.com/issue/KT-35934) Gradle MPP plugin: Spaces are not escaped in K/N compiler parameters +- [`KT-35958`](https://youtrack.jetbrains.com/issue/KT-35958) Kotlin/Native: Gradle: compiling test sources with no sources in main roots halts the Gradle daemon + +### Tools. J2K + +#### New Features + +- [`KT-21811`](https://youtrack.jetbrains.com/issue/KT-21811) Convert string concatenation into multiline string + +#### Performance Improvements + +- [`KT-16774`](https://youtrack.jetbrains.com/issue/KT-16774) UI Freeze: J2K, PlainTextPasteImportResolve: IDEA freezes for 10+ seconds when copy-pasting Java code from external source to Kotlin file + +#### Fixes + +- [`KT-18001`](https://youtrack.jetbrains.com/issue/KT-18001) Multi-line comments parsed inside Kdoc comments +- [`KT-19574`](https://youtrack.jetbrains.com/issue/KT-19574) Code with inferred default parameters and parameter vs property name clashes +- [`KT-32551`](https://youtrack.jetbrains.com/issue/KT-32551) Non-canonical modifiers order inspection is not applied during convertion of inner super class +- [`KT-33637`](https://youtrack.jetbrains.com/issue/KT-33637) Property with getter is converted into incompailable code if backing field was not generated +- [`KT-34673`](https://youtrack.jetbrains.com/issue/KT-34673) First comment in function (if, for, while) block is moved to declaration line of block +- [`KT-35081`](https://youtrack.jetbrains.com/issue/KT-35081) Invalid code with block comment (Javadoc) +- [`KT-35152`](https://youtrack.jetbrains.com/issue/KT-35152) J2K breaks formatting by moving subsequent single line comments to first column +- [`KT-35395`](https://youtrack.jetbrains.com/issue/KT-35395) UninitializedPropertyAccessException through `org.jetbrains.kotlin.nj2k.conversions.ImplicitCastsConversion` when anonymous inner class passes itself as argument to outer method +- [`KT-35431`](https://youtrack.jetbrains.com/issue/KT-35431) "Invalid PSI class com.intellij.psi.PsiLambdaParameterType" with lambda argument in erroneous code +- [`KT-35476`](https://youtrack.jetbrains.com/issue/KT-35476) Expression with compound assignment logical operator is changing operator precedence without parentheses +- [`KT-35478`](https://youtrack.jetbrains.com/issue/KT-35478) Single line comment before constructor results in wrong code +- [`KT-35739`](https://youtrack.jetbrains.com/issue/KT-35739) Line break is not inserted for private property getter +- [`KT-35831`](https://youtrack.jetbrains.com/issue/KT-35831) Error on inserting plain text with `\r` char + +### Tools. Scripts + +- [`KT-34274`](https://youtrack.jetbrains.com/issue/KT-34274) Add support for `@CompilerOptions` annotation in `kotlin-main-kts` +- [`KT-34716`](https://youtrack.jetbrains.com/issue/KT-34716) Implement default cache in main-kts +- [`KT-34893`](https://youtrack.jetbrains.com/issue/KT-34893) Update apache ivy version in kotlin-main-kts +- [`KT-35413`](https://youtrack.jetbrains.com/issue/KT-35413) Implement "evaluate expression" command line parameter and functionality in the JVM cli compiler +- [`KT-35415`](https://youtrack.jetbrains.com/issue/KT-35415) Implement script and expression evaluation in the `kotlin` runner +- [`KT-35416`](https://youtrack.jetbrains.com/issue/KT-35416) load main-kts script definition by default in the jvm compiler, if the jar is available + +### Tools. kapt + +- [`KT-30164`](https://youtrack.jetbrains.com/issue/KT-30164) Default field value not transmitted to Java source model for mutable properties +- [`KT-30368`](https://youtrack.jetbrains.com/issue/KT-30368) Deprecated information not transmitted to Java source model +- [`KT-32832`](https://youtrack.jetbrains.com/issue/KT-32832) Turn worker API on by default +- [`KT-33617`](https://youtrack.jetbrains.com/issue/KT-33617) Java 9+: "IllegalStateException: Should not be called!" +- [`KT-34167`](https://youtrack.jetbrains.com/issue/KT-34167) Annotation Processor incorrectly marked as isolating causes full rebuild silently. +- [`KT-34258`](https://youtrack.jetbrains.com/issue/KT-34258) `kapt.incremental.apt=true` makes build failed after moving annotation processor files +- [`KT-34569`](https://youtrack.jetbrains.com/issue/KT-34569) Kapt doesn't handle methods with both the @Override annotation and `override` keyword +- [`KT-36113`](https://youtrack.jetbrains.com/issue/KT-36113) Enabling kapt.incremental.apt makes remote build cache miss via `classpathStructure$kotlin_gradle_plugin` property + + +## 1.3.61 + +### Compiler + +- [`KT-35004`](https://youtrack.jetbrains.com/issue/KT-35004) "AssertionError: Unsigned type expected" in `when` range check in extension on unsigned type + +### IDE + +- [`KT-34923`](https://youtrack.jetbrains.com/issue/KT-34923) [Regression] KtUltraLightMethod.hasModifierProperty("native") returns false for external Kotlin functions + + +### Libraries + +- [`KT-21445`](https://youtrack.jetbrains.com/issue/KT-21445) W3C DOM Touch events and interfaces are incomplete / missing + +### Tools. Compiler Plugins + +- [`KT-34991`](https://youtrack.jetbrains.com/issue/KT-34991) kotlinx.serialization: False warning "Explicit @Serializable annotation on enum class is required when @SerialName or @SerialInfo annotations are used on its members" + +### Tools. J2K + +- [`KT-34987`](https://youtrack.jetbrains.com/issue/KT-34987) New J2K converter: @NotNull annotations are not removed after converting java code to kotlin +- [`KT-35074`](https://youtrack.jetbrains.com/issue/KT-35074) J2K: No auto conversion in 'for' loop with multiple init variables + +## 1.3.60 + +### Android + +- [`KT-27170`](https://youtrack.jetbrains.com/issue/KT-27170) Android lint tasks fails in Gradle with MPP dependency + +### Compiler + +#### New Features + +- [`KT-31230`](https://youtrack.jetbrains.com/issue/KT-31230) Refine rules for allowed Array-based class literals on different platforms: allow `Array::class` everywhere, disallow `Array<...>::class` on non-JVM +- [`KT-33413`](https://youtrack.jetbrains.com/issue/KT-33413) Allow 'break' and 'continue' in 'when' statement to point to innermost surrounding loop + +#### Performance Improvements + +- [`KT-14513`](https://youtrack.jetbrains.com/issue/KT-14513) Suboptimal compilation of lazy delegated properties with inline getValue +- [`KT-28507`](https://youtrack.jetbrains.com/issue/KT-28507) Extra InlineMarker.mark invocation in generated suspending function bytecode +- [`KT-29229`](https://youtrack.jetbrains.com/issue/KT-29229) Intrinsify 'in' operator for unsigned integer ranges + +#### Fixes + +- [`KT-7354`](https://youtrack.jetbrains.com/issue/KT-7354) Confusing error message when trying to access package local java class +- [`KT-9310`](https://youtrack.jetbrains.com/issue/KT-9310) Don't make interface and DefaultImpls methods synchronized +- [`KT-11430`](https://youtrack.jetbrains.com/issue/KT-11430) Improve diagnostics for dangling lambdas +- [`KT-16526`](https://youtrack.jetbrains.com/issue/KT-16526) Provide better error explanation when one tries to delegate var to read-only delegate +- [`KT-20258`](https://youtrack.jetbrains.com/issue/KT-20258) Improve annotation rendering in diagnostic messages +- [`KT-22275`](https://youtrack.jetbrains.com/issue/KT-22275) Unify exceptions from null checks +- [`KT-27503`](https://youtrack.jetbrains.com/issue/KT-27503) Private functions uses from inside of suspendCoroutine go though accessor +- [`KT-28938`](https://youtrack.jetbrains.com/issue/KT-28938) Coroutines tail-call optimization does not work for generic returns that had instantiated to Unit +- [`KT-29385`](https://youtrack.jetbrains.com/issue/KT-29385) "AnalyzerException: Expected an object reference, but found I" for EXACTLY_ONCE non-inline contract with captured class constructor parameter +- [`KT-29510`](https://youtrack.jetbrains.com/issue/KT-29510) "RuntimeException: Trying to access skipped parameter" with EXACTLY_ONCE contract and nested call of crossinline lambda +- [`KT-29614`](https://youtrack.jetbrains.com/issue/KT-29614) java.lang.VerifyError: Bad type on operand stack - in inlining, crossinline in constructor with EXACTLY_ONCE contract +- [`KT-30275`](https://youtrack.jetbrains.com/issue/KT-30275) Get rid of session in FirElement +- [`KT-30744`](https://youtrack.jetbrains.com/issue/KT-30744) Invoking Interface Static Method from Extension method generates incorrect jvm bytecode +- [`KT-30785`](https://youtrack.jetbrains.com/issue/KT-30785) Equality comparison of inline classes results in boxing +- [`KT-32217`](https://youtrack.jetbrains.com/issue/KT-32217) FIR: support delegated properties resolve +- [`KT-32433`](https://youtrack.jetbrains.com/issue/KT-32433) NI: UninferredParameterTypeConstructor with class property +- [`KT-32587`](https://youtrack.jetbrains.com/issue/KT-32587) NI: Type mismatch "String" vs "String" in IDE on generic .invoke on generic delegated property +- [`KT-32689`](https://youtrack.jetbrains.com/issue/KT-32689) Shuffled line numbers in suspend functions with elvis operator +- [`KT-32851`](https://youtrack.jetbrains.com/issue/KT-32851) Constraint for callable reference argument doesn't take into account use-site variance +- [`KT-32864`](https://youtrack.jetbrains.com/issue/KT-32864) The line number of assertFailsWith in suspending function is lost +- [`KT-33125`](https://youtrack.jetbrains.com/issue/KT-33125) NI: "Rewrite at slice INDEXED_LVALUE_SET" with Mutable Map set index operator inside "@kotlin.BuilderInference" block +- [`KT-33414`](https://youtrack.jetbrains.com/issue/KT-33414) 'java.lang.AssertionError: int type expected, but null was found in basic frames' in kotlin-io while building library train +- [`KT-33421`](https://youtrack.jetbrains.com/issue/KT-33421) Please make NOTHING_TO_INLINE warning shorter +- [`KT-33504`](https://youtrack.jetbrains.com/issue/KT-33504) EA-209823 - ISE: ProjectResolutionFacade$computeModuleResolverProvider$resolverForProject$$.invoke: Can't find builtIns by key CacheKeyBySdk +- [`KT-33572`](https://youtrack.jetbrains.com/issue/KT-33572) Scripting import with implicit receiver doesn't work +- [`KT-33821`](https://youtrack.jetbrains.com/issue/KT-33821) Compiler should not rely on the default locale when generating boxing for suspend functions +- [`KT-18541`](https://youtrack.jetbrains.com/issue/KT-18541) Prohibit "tailrec" modifier on open functions +- [`KT-19844`](https://youtrack.jetbrains.com/issue/KT-19844) Do not render type annotations on symbols rendered in diagnostic messages +- [`KT-24913`](https://youtrack.jetbrains.com/issue/KT-24913) KotlinFrontEndException with local class in init of generic class +- [`KT-28940`](https://youtrack.jetbrains.com/issue/KT-28940) Concurrency issue for lazy values with the post-computation phase +- [`KT-31540`](https://youtrack.jetbrains.com/issue/KT-31540) Change initialization order of default values for tail recursive optimized functions + +### Docs & Examples + +- [`KT-26212`](https://youtrack.jetbrains.com/issue/KT-26212) Update docs to explicitly mention that union is opposite of intersect +- [`KT-34086`](https://youtrack.jetbrains.com/issue/KT-34086) Website, stdlib api docs: unresolved link jvm/stdlib/kotlin.text/-charsets/Charset + +### IDE + +#### Fixes + +- [`KT-8581`](https://youtrack.jetbrains.com/issue/KT-8581) 'Move Statement' doesn't work for statement finished by semicolon +- [`KT-9204`](https://youtrack.jetbrains.com/issue/KT-9204) Shorten references and some other IDE features have problem when package name clash with class name +- [`KT-17993`](https://youtrack.jetbrains.com/issue/KT-17993) Annotations are colored the same as language keywords +- [`KT-21037`](https://youtrack.jetbrains.com/issue/KT-21037) LazyLightClassMemberMatchingError$WrongMatch “Matched :BAR MemberIndex(index=0) to :BAR MemberIndex(index=1) in KtLightClassImpl” after duplicating values inside enum class +- [`KT-23305`](https://youtrack.jetbrains.com/issue/KT-23305) We should be able to see platform-specific errors in common module +- [`KT-23461`](https://youtrack.jetbrains.com/issue/KT-23461) `Move statement up/down` attaches a comment block to the function being moved +- [`KT-26960`](https://youtrack.jetbrains.com/issue/KT-26960) IDE doesn't report `actual` without `expect` placed into a custom platform-agnostic source set +- [`KT-27243`](https://youtrack.jetbrains.com/issue/KT-27243) LazyLightClassMemberMatchingError when overriding hidden member +- [`KT-28404`](https://youtrack.jetbrains.com/issue/KT-28404) Gradle configuration page is missing from a New Project Wizard creation flow for multiplatform templates +- [`KT-30824`](https://youtrack.jetbrains.com/issue/KT-30824) No highlighting of declaration/usage of function with functional-type (lambda) parameter on its usage +- [`KT-31117`](https://youtrack.jetbrains.com/issue/KT-31117) AssertionError at `CompletionBindingContextProvider._getBindingContext` when typing any character within string with injected Kotlin +- [`KT-31139`](https://youtrack.jetbrains.com/issue/KT-31139) "Override members" on enum inserts semicolon before enum body +- [`KT-31810`](https://youtrack.jetbrains.com/issue/KT-31810) Paste inside indented `.trimIndent()` raw string doesn't respect indentation +- [`KT-32401`](https://youtrack.jetbrains.com/issue/KT-32401) Exceptions while running IDEA in headless mode for building searchable options +- [`KT-32543`](https://youtrack.jetbrains.com/issue/KT-32543) UltraLight support for Kotlin collections. +- [`KT-32544`](https://youtrack.jetbrains.com/issue/KT-32544) Support UltraLight classes for local/anonymous/enum classes +- [`KT-32799`](https://youtrack.jetbrains.com/issue/KT-32799) 2019.2 RC (192.5728.74) Kotlin plugin exception during build searchable options (Directory index may not be queried for default project) +- [`KT-33008`](https://youtrack.jetbrains.com/issue/KT-33008) IDEA does not report in MPP: Upper bound of a type parameter cannot be an array +- [`KT-33316`](https://youtrack.jetbrains.com/issue/KT-33316) Kotlin Facet: make sure the order of allPlatforms value is fixed +- [`KT-33561`](https://youtrack.jetbrains.com/issue/KT-33561) LazyLightClassMemberMatchingError when overloading synthetic member +- [`KT-33584`](https://youtrack.jetbrains.com/issue/KT-33584) Make kotlin light classes return no-arg constructor when no-arg (or jpa) compiler plugin is enabled +- [`KT-33775`](https://youtrack.jetbrains.com/issue/KT-33775) please remove usages of org.intellij.plugins.intelliLang.inject.InjectorUtils#putInjectedFileUserData(com.intellij.lang.injection.MultiHostRegistrar, com.intellij.openapi.util.Key, T) deprecated eons ago +- [`KT-33813`](https://youtrack.jetbrains.com/issue/KT-33813) Poor formatting of 'Selected target platforms' and 'Depends on' in facet settings +- [`KT-33937`](https://youtrack.jetbrains.com/issue/KT-33937) delay() completion from kotlinx.coroutines causes happening of root package in code +- [`KT-33973`](https://youtrack.jetbrains.com/issue/KT-33973) Kotlin objects could abuse idea plugin functionality +- [`KT-34000`](https://youtrack.jetbrains.com/issue/KT-34000) Import quickfix does not work for extension methods from objects +- [`KT-34070`](https://youtrack.jetbrains.com/issue/KT-34070) "No target platforms selected" message for commonTest facet at mobile shared library project +- [`KT-34191`](https://youtrack.jetbrains.com/issue/KT-34191) Since-build .. until-build compatibility ranges are the same for 192 and 193 IDE plugins +- [`KT-21153`](https://youtrack.jetbrains.com/issue/KT-21153) IDE: string template + annotation usage: ISE: "Couldn't get delegate" at LightClassDataHolderKt.findDelegate() +- [`KT-33352`](https://youtrack.jetbrains.com/issue/KT-33352) "KotlinExceptionWithAttachments: Couldn't get delegate for class" on nested class/object +- [`KT-34042`](https://youtrack.jetbrains.com/issue/KT-34042) "Error loading Kotlin facets. Kotlin facets are not allowed in Kotlin/Native Module" in 192 IDEA +- [`KT-34237`](https://youtrack.jetbrains.com/issue/KT-34237) MPP with Android target: `common*` source sets are not shown as source roots in IDE +- [`KT-33626`](https://youtrack.jetbrains.com/issue/KT-33626) Deadlock with Kotlin LockBasedStorageManager in IDEA commit dialog +- [`KT-34402`](https://youtrack.jetbrains.com/issue/KT-34402) Unresolved reference to Kotlin.test library in CommonTest in Multiplatform project without JVM target +- [`KT-34639`](https://youtrack.jetbrains.com/issue/KT-34639) Multiplatform project with the only (Android) target is incorrectly imported into IDE + +### IDE. Completion + +- [`KT-10340`](https://youtrack.jetbrains.com/issue/KT-10340) Import completion unable to shorten fq-names when there is a conflict between package name and local identifier +- [`KT-17689`](https://youtrack.jetbrains.com/issue/KT-17689) Code completion for enum typealias doesn't show members +- [`KT-28998`](https://youtrack.jetbrains.com/issue/KT-28998) Slow completion for build.gradle.kts (Kotlin Gradle DSL script) +- [`KT-30996`](https://youtrack.jetbrains.com/issue/KT-30996) DSL extension methods which are not applicable are offered for completion +- [`KT-31902`](https://youtrack.jetbrains.com/issue/KT-31902) Fully qualified name is used for `delay` instead of import and just method name +- [`KT-33903`](https://youtrack.jetbrains.com/issue/KT-33903) Duplicating completion for imported extensions from companion objects + +### IDE. Debugger + +- [`KT-10984`](https://youtrack.jetbrains.com/issue/KT-10984) Disallow placing line breakpoints without executable code (changed) +- [`KT-22116`](https://youtrack.jetbrains.com/issue/KT-22116) Support function breakpoints +- [`KT-24408`](https://youtrack.jetbrains.com/issue/KT-24408) @InlineOnly: Misleading status for breakpoints in inline functions +- [`KT-27645`](https://youtrack.jetbrains.com/issue/KT-27645) Debugger breakpoints do not work in suspend function executed in SpringBoot controller (MVC and WebFlux) +- [`KT-32687`](https://youtrack.jetbrains.com/issue/KT-32687) Disallow breakpoints for @InlineOnly function bodies +- [`KT-32813`](https://youtrack.jetbrains.com/issue/KT-32813) Exception on invoking "Smart Step Into" +- [`KT-32830`](https://youtrack.jetbrains.com/issue/KT-32830) NPE on changing class property in Evaluate Expression window +- [`KT-33064`](https://youtrack.jetbrains.com/issue/KT-33064) “Read access is allowed from event dispatch thread or inside read-action only” from KotlinLineBreakpointType.createLineSourcePosition on adding new line before the current one while stopping on breakpoint +- [`KT-11395`](https://youtrack.jetbrains.com/issue/KT-11395) Breakpoint inside lambda argument of InlineOnly function doesn't work + +### IDE. Folding + +- [`KT-6314`](https://youtrack.jetbrains.com/issue/KT-6314) Folding of "when" construction + +### IDE. Gradle + +- [`KT-33038`](https://youtrack.jetbrains.com/issue/KT-33038) Package prefix is not imported in non-MPP project +- [`KT-33987`](https://youtrack.jetbrains.com/issue/KT-33987) Serialization exception during importing Kotlin project in IDEA 192 +- [`KT-32960`](https://youtrack.jetbrains.com/issue/KT-32960) KotlinMPPGradleModelBuilder takes a long time to process when syncing non-MPP project with IDE +- [`KT-34424`](https://youtrack.jetbrains.com/issue/KT-34424) With Kotlin plugin in Gradle project without Native the IDE fails to start Gradle task: "Kotlin/Native properties file is absent at null/konan/konan.properties" +- [`KT-34256`](https://youtrack.jetbrains.com/issue/KT-34256) Fail to use multiplatform modules with dependsOn with android plugin +- [`KT-34663`](https://youtrack.jetbrains.com/issue/KT-34663) Low performance of MPP 1.2 during import with module-per-source-set enabled + +### IDE. Gradle. Script + +- [`KT-31766`](https://youtrack.jetbrains.com/issue/KT-31766) Gradle Kotlin DSL new project template: use type-safe model accessors +- [`KT-34463`](https://youtrack.jetbrains.com/issue/KT-34463) New Gradle-based project template misses pluginManagement{} block in EAP branch +- [`KT-31767`](https://youtrack.jetbrains.com/issue/KT-31767) Gradle Kotlin DSL new project template: use settings.gradle.kts + +### IDE. Inspections and Intentions + +#### New Features + +- [`KT-26431`](https://youtrack.jetbrains.com/issue/KT-26431) Quickfix to remove redundant label +- [`KT-28049`](https://youtrack.jetbrains.com/issue/KT-28049) Suggest import quickfix for operator extension functions +- [`KT-29622`](https://youtrack.jetbrains.com/issue/KT-29622) "Move to separate file" intention should also work for sealed class +- [`KT-33178`](https://youtrack.jetbrains.com/issue/KT-33178) Use a new compiler flag -Xinline-classes during enabling the feature via IDEA intention +- [`KT-33586`](https://youtrack.jetbrains.com/issue/KT-33586) "Constructors are not allowed for objects" diagnostic needs quickfix to change object to class + +#### Fixes + +- [`KT-12291`](https://youtrack.jetbrains.com/issue/KT-12291) Override/Implement Members: better member positioning inside the class +- [`KT-14899`](https://youtrack.jetbrains.com/issue/KT-14899) Quickfix "Create member function" inserts too many semicolons when applied to Enum +- [`KT-15700`](https://youtrack.jetbrains.com/issue/KT-15700) "Convert lambda to reference" does not work with backtick-escaped references +- [`KT-18772`](https://youtrack.jetbrains.com/issue/KT-18772) "Introduce subject to when": don't choose an object or a constant as the subject +- [`KT-21172`](https://youtrack.jetbrains.com/issue/KT-21172) Join declaration and assignment should place the result at the assignment, not at declaration +- [`KT-25697`](https://youtrack.jetbrains.com/issue/KT-25697) `Replace with dot call` quickfix breaks formatting +- [`KT-26635`](https://youtrack.jetbrains.com/issue/KT-26635) An empty line is added after `actual` modifier on "Create actual annotation class..." quick fix applied to annotation if it is annotated with comment +- [`KT-27270`](https://youtrack.jetbrains.com/issue/KT-27270) "Add jar to classpath" quick fix modifies build.gradle of MPP project in a way that fails to be imported +- [`KT-28471`](https://youtrack.jetbrains.com/issue/KT-28471) "Add initializer" quickfix initializes non-null variable with null +- [`KT-28538`](https://youtrack.jetbrains.com/issue/KT-28538) `create expected ...` quick fix illegally creates `expect` member with a usage of a platform-specific type +- [`KT-28549`](https://youtrack.jetbrains.com/issue/KT-28549) Create actual/expect quick fix for class/object doesn't add import for an inherited member +- [`KT-28620`](https://youtrack.jetbrains.com/issue/KT-28620) `Create expect/actual ...` quick fix could save @Test annotation on generation +- [`KT-28740`](https://youtrack.jetbrains.com/issue/KT-28740) AE “2 declarations in var bar: [ERROR : No type, no body]” after applying “Create actual class” quick fix for class with property which has not specified type +- [`KT-28947`](https://youtrack.jetbrains.com/issue/KT-28947) Backing field has created after applying “Create expected class in common module...” intention +- [`KT-30136`](https://youtrack.jetbrains.com/issue/KT-30136) False negative "Redundant explicit 'this'" with local variable +- [`KT-30794`](https://youtrack.jetbrains.com/issue/KT-30794) Quickfix for unchecked cast produces invalid code +- [`KT-31133`](https://youtrack.jetbrains.com/issue/KT-31133) Liveness analysis on enum does not take into account calls to 'values' +- [`KT-31433`](https://youtrack.jetbrains.com/issue/KT-31433) Incorrect "Create expected class..." for class with supertype +- [`KT-31475`](https://youtrack.jetbrains.com/issue/KT-31475) "Create expect..." should delete 'override' modifier +- [`KT-31587`](https://youtrack.jetbrains.com/issue/KT-31587) Redundant `private` modifier before primary constructor after create `actual` class +- [`KT-31921`](https://youtrack.jetbrains.com/issue/KT-31921) "Create expected ..."/"Create actual..." quick fix: `val` and `vararg` modifiers are misordered in the generated `expect`/`actual` declaration +- [`KT-31999`](https://youtrack.jetbrains.com/issue/KT-31999) "Variable declaration could be moved into `when`" inspection suggests to inline expression containing return (throw) statement +- [`KT-32012`](https://youtrack.jetbrains.com/issue/KT-32012) Change parameter type quick fix: Don't use qualified name +- [`KT-32468`](https://youtrack.jetbrains.com/issue/KT-32468) False positive SimplifiableCall "filter call could be simplified to filterIsInstance" with expression body function and explicit return type +- [`KT-32479`](https://youtrack.jetbrains.com/issue/KT-32479) False positive "Redundant overriding method" with derived property and base function starting with `get`, `set` or `is` (Accidental override) +- [`KT-32571`](https://youtrack.jetbrains.com/issue/KT-32571) "Create expect" quick fix incorrectly treats multiplatform stdlib typealiased types as platform-specific ones +- [`KT-32580`](https://youtrack.jetbrains.com/issue/KT-32580) "Remove braces" QF for single-expression function with inferred lambda return type: "ClassCastException: class kotlin.reflect.jvm.internal.KClassImpl cannot be cast to class kotlin.jvm.internal.ClassBasedDeclarationContainer" +- [`KT-32582`](https://youtrack.jetbrains.com/issue/KT-32582) Ambiguous message for [AMBIGUOUS_ACTUALS] error (master) +- [`KT-32586`](https://youtrack.jetbrains.com/issue/KT-32586) "Make member open" quick fix doesn't update all the related actualisations of an expected member +- [`KT-32616`](https://youtrack.jetbrains.com/issue/KT-32616) "To ordinary string literal" doesn't remove indents, newlines and `trimIndent` +- [`KT-32642`](https://youtrack.jetbrains.com/issue/KT-32642) "Create expect" quick fix doesn't warn about a platform-specific annotation applied to the generated member +- [`KT-32650`](https://youtrack.jetbrains.com/issue/KT-32650) "Replace 'if' with 'when'" removes braces from 'if' statement +- [`KT-32694`](https://youtrack.jetbrains.com/issue/KT-32694) "Create expect"/"create actual" quick fix doesn't transfer use-site annotations +- [`KT-32737`](https://youtrack.jetbrains.com/issue/KT-32737) "Create expect" quick fix adds `actual` modifier to an interface function with default implementation without a warning +- [`KT-32768`](https://youtrack.jetbrains.com/issue/KT-32768) "Create expect" quick fix doesn't warn about a local supertype of an `actual` class while generating an expected declaration +- [`KT-32829`](https://youtrack.jetbrains.com/issue/KT-32829) "Add .jar to the classpath" quick fix creates "compile"/"testCompile" dependencies in build.gradle +- [`KT-32972`](https://youtrack.jetbrains.com/issue/KT-32972) No "remove braces" inspection for ${this} +- [`KT-32981`](https://youtrack.jetbrains.com/issue/KT-32981) "Create enum constant" quick fix adds redundant empty line +- [`KT-33060`](https://youtrack.jetbrains.com/issue/KT-33060) "Cleanup code" does not remove 'final' keyword for overridden function with non-canonical modifiers order +- [`KT-33115`](https://youtrack.jetbrains.com/issue/KT-33115) "Replace overloaded operator with function call" intention should not be shown on incomplete expressions +- [`KT-33150`](https://youtrack.jetbrains.com/issue/KT-33150) Don't suggest create expect function from function with `private` modifier +- [`KT-33153`](https://youtrack.jetbrains.com/issue/KT-33153) False positive "Redundant overriding method" when overriding package private method +- [`KT-33204`](https://youtrack.jetbrains.com/issue/KT-33204) False positive "flatMap call could be simplified to flatten()" with Array +- [`KT-33299`](https://youtrack.jetbrains.com/issue/KT-33299) "Create type parameter from usage" should work with backticks +- [`KT-33300`](https://youtrack.jetbrains.com/issue/KT-33300) "Create type parameter from usage" suggests for top level property +- [`KT-33302`](https://youtrack.jetbrains.com/issue/KT-33302) KNPE after "Create type parameter from usage" with typealias +- [`KT-33357`](https://youtrack.jetbrains.com/issue/KT-33357) 'java.lang.Throwable: Assertion failed: Refactorings should be invoked inside transaction 'exception occurs when extracting sealed class from file with the same name +- [`KT-33362`](https://youtrack.jetbrains.com/issue/KT-33362) Inspection "Extract class from current file" is not available for 'sealed' keyword +- [`KT-33437`](https://youtrack.jetbrains.com/issue/KT-33437) “Argument rangeInElement (0,1) endOffset must not exceed descriptor text range (0, 0) length (0).” on creating Kotlin Script files inside package +- [`KT-33612`](https://youtrack.jetbrains.com/issue/KT-33612) "Replace with safe call" quick fix moves code to another line +- [`KT-33660`](https://youtrack.jetbrains.com/issue/KT-33660) "Convert to anonymous object" with nested SAM interface inserts `object` keyword in the wrong place +- [`KT-33718`](https://youtrack.jetbrains.com/issue/KT-33718) "Create enum constant" quick fix adds after semicolon +- [`KT-33754`](https://youtrack.jetbrains.com/issue/KT-33754) Improve error hint message for "Create expect/actual..." +- [`KT-33880`](https://youtrack.jetbrains.com/issue/KT-33880) "Convert to range check" produces code that is subject to ReplaceRangeToWithUntil for range with exclusive upper bound +- [`KT-33930`](https://youtrack.jetbrains.com/issue/KT-33930) Don't suggest "create expect" quick fix on `lateinit` and `const` top-level properties +- [`KT-33981`](https://youtrack.jetbrains.com/issue/KT-33981) “KotlinCodeInsightWorkspaceSettings is registered as application service, but requested as project one” on opening QF menu for some fixes in IJ193 +- [`KT-32965`](https://youtrack.jetbrains.com/issue/KT-32965) False positive "Redundant qualifier name" with nested enum member call +- [`KT-33597`](https://youtrack.jetbrains.com/issue/KT-33597) False positive "Redundant qualifier name" with class property initialized with same-named object property +- [`KT-33991`](https://youtrack.jetbrains.com/issue/KT-33991) False positive "Redundant qualifier name" with enum member function call +- [`KT-34113`](https://youtrack.jetbrains.com/issue/KT-34113) False positive "Redundant qualifier name" with Enum.values() from a different Enum + +### IDE. KDoc + +- [`KT-20777`](https://youtrack.jetbrains.com/issue/KT-20777) KDoc: Type parameters are not shown in sample code + +### IDE. Multiplatform + +- [`KT-26333`](https://youtrack.jetbrains.com/issue/KT-26333) IDE incorrectly requires `actual` implementations to be present in all the project source sets +- [`KT-28537`](https://youtrack.jetbrains.com/issue/KT-28537) Platform-specific type taken from a dependency module isn't reported in `common` code +- [`KT-32562`](https://youtrack.jetbrains.com/issue/KT-32562) Provide a registry key to enable/disable hierarchical multiplatform mechanism in IDE + +### IDE. Navigation + +- [`KT-28075`](https://youtrack.jetbrains.com/issue/KT-28075) Duplicate "implements" gutter icons on some interfaces +- [`KT-30052`](https://youtrack.jetbrains.com/issue/KT-30052) Duplicated "is subclassed" editor gutter icons +- [`KT-33182`](https://youtrack.jetbrains.com/issue/KT-33182) com.intellij.idea.IdeStarter#main has four (!) icons, should be two + +### IDE. REPL + +- [`KT-33329`](https://youtrack.jetbrains.com/issue/KT-33329) IllegalArgumentException in REPL + +### IDE. Refactorings + +- [`KT-24929`](https://youtrack.jetbrains.com/issue/KT-24929) 'Search for references' checkbox state isn't saved on move of kotlin file +- [`KT-30342`](https://youtrack.jetbrains.com/issue/KT-30342) Move refactoring: suggest file name starting with an uppercase letter +- [`KT-32426`](https://youtrack.jetbrains.com/issue/KT-32426) Invalid code format after "Pull Members Up" on function with comment and another indent +- [`KT-32496`](https://youtrack.jetbrains.com/issue/KT-32496) "Problems Detected" dialog message about conflicting declarations on moving file to another package is absolutely unreadable +- [`KT-33059`](https://youtrack.jetbrains.com/issue/KT-33059) Exception [Assertion failed: Write access is allowed inside write-action only] in case of Move class to nonexistent folder +- [`KT-33972`](https://youtrack.jetbrains.com/issue/KT-33972) Change signature should affect all hierarchy + +### IDE. Run Configurations + +- [`KT-34366`](https://youtrack.jetbrains.com/issue/KT-34366) Implement gutters for running tests (multi-platform projects) + +### IDE. Scratch + +- [`KT-23986`](https://youtrack.jetbrains.com/issue/KT-23986) No access to stdout output in Kotlin scratch +- [`KT-23989`](https://youtrack.jetbrains.com/issue/KT-23989) Scratch: allow copy of a scratch output +- [`KT-28910`](https://youtrack.jetbrains.com/issue/KT-28910) Add hint for Make before Run checkbox +- [`KT-29407`](https://youtrack.jetbrains.com/issue/KT-29407) strange output for long strings +- [`KT-31295`](https://youtrack.jetbrains.com/issue/KT-31295) Kotlin worksheet in projects, not as scratch files +- [`KT-32366`](https://youtrack.jetbrains.com/issue/KT-32366) Sidebar as alternative output layout +- [`KT-33585`](https://youtrack.jetbrains.com/issue/KT-33585) Synchronized highlighting of the main editor and side panel + +### IDE. Script + +- [`KT-30206`](https://youtrack.jetbrains.com/issue/KT-30206) Settings / ... / Kotlin Scripting with no project opened causes ISE: "project.baseDir must not be null" at ScriptTemplatesFromDependenciesProvider.loadScriptDefinitions() +- [`KT-32513`](https://youtrack.jetbrains.com/issue/KT-32513) Intellij hangs in ApplicationUtilsKt.runWriteAction through ScriptDependenciesLoader$submitMakeRootsChange$doNotifyRootsChanged$1.run + +### IDE. Wizards + +- [`KT-27587`](https://youtrack.jetbrains.com/issue/KT-27587) Bump Android build tools version at `Multiplatform (Android/iOS)` template of the New Project Wizard +- [`KT-33927`](https://youtrack.jetbrains.com/issue/KT-33927) MPP, Kotlin New project wizard: broken project generation +- [`KT-34108`](https://youtrack.jetbrains.com/issue/KT-34108) Gradle Kotlin DSL: generated project with `tasks` element fails on configuration stage with Gradle 4.10 +- [`KT-34154`](https://youtrack.jetbrains.com/issue/KT-34154) New Project wizard: build.gradle.kts: type-safe code sets JVM 1.8 for main, but JVM 1.6 for test +- [`KT-34229`](https://youtrack.jetbrains.com/issue/KT-34229) New Project wizard: IDEA 193+: Mobile Android/iOS: creating another project of this type tries to write into previous one + +### JavaScript + +- [`KT-12935`](https://youtrack.jetbrains.com/issue/KT-12935) Generated source maps for JS mention nonexistent dummy.kt +- [`KT-26701`](https://youtrack.jetbrains.com/issue/KT-26701) JS, rollup.js: Application can't depend on a library if both sourcemaps reference "dummy.kt" + +### Libraries + +- [`KT-26309`](https://youtrack.jetbrains.com/issue/KT-26309) Avoid division in string-to-number conversions +- [`KT-27545`](https://youtrack.jetbrains.com/issue/KT-27545) File.copyTo: unclear error message when it fails to delete the destination +- [`KT-28804`](https://youtrack.jetbrains.com/issue/KT-28804) Wrong parameter name in kotlin.text.contentEquals +- [`KT-32024`](https://youtrack.jetbrains.com/issue/KT-32024) Modify `Iterable.take(n)` implementation not to call `.next()` more than necessary +- [`KT-32532`](https://youtrack.jetbrains.com/issue/KT-32532) MutableList.removeAll is lacking documentation +- [`KT-32728`](https://youtrack.jetbrains.com/issue/KT-32728) CollectionsKt.windowed throws IllegalArgumentException (Illegal Capacity: -1) when size param is Integer.MAX_VALUE due to overflow operation +- [`KT-33864`](https://youtrack.jetbrains.com/issue/KT-33864) Read from pseudo-file system is empty + +### Reflection + +- [`KT-13936`](https://youtrack.jetbrains.com/issue/KT-13936) KotlinReflectionInternalError on invoking callBy on overridden member with inherited default argument value +- [`KT-17860`](https://youtrack.jetbrains.com/issue/KT-17860) Improve KParameter.toString for receiver parameters + +### Tools + +- [`KT-17045`](https://youtrack.jetbrains.com/issue/KT-17045) Drop MaxPermSize support from compiler daemon +- [`KT-32259`](https://youtrack.jetbrains.com/issue/KT-32259) `org.jetbrains.annotations` module exported from embeddable compiler, causes problems in Java modular builds + +### Tools. Android Extensions + +- [`KT-32096`](https://youtrack.jetbrains.com/issue/KT-32096) IDE plugin doesn't recognize that Parcelize is no longer experimental + +### Tools. CLI + +- [`KT-24991`](https://youtrack.jetbrains.com/issue/KT-24991) CLI: Empty classpath in `kotlin` script except for `kotlin-runner.jar` +- [`KT-26624`](https://youtrack.jetbrains.com/issue/KT-26624) Set Thread.contextClassLoader when running programs with 'kotlin' launcher script or scripts with 'kotlinc -script' +- [`KT-24966`](https://youtrack.jetbrains.com/issue/KT-24966) Classloader problems when running basic kafka example with `kotlin` and `kotlinc` + +### Tools. Compiler Plugins + +- [`KT-29471`](https://youtrack.jetbrains.com/issue/KT-29471) output from jvm-api-gen plugin on classpath crashes downstream kotlinc-jvm: inline method with inner class +- [`KT-33630`](https://youtrack.jetbrains.com/issue/KT-33630) cannot use @kotlinx.serialization.Transient and lateinit together on 1.3.50 + +### Tools. Daemon + +- [`KT-32992`](https://youtrack.jetbrains.com/issue/KT-32992) Enable assertions in Kotlin Compile Daemon +- [`KT-33027`](https://youtrack.jetbrains.com/issue/KT-33027) Compilation with daemon fails, because IncrementalModuleInfo#serialVersionUID does not match + +### Tools. Gradle + +#### New Features + +- [`KT-20760`](https://youtrack.jetbrains.com/issue/KT-20760) Kotlin Gradle Plugin doesn't allow for configuring friend paths through API +- [`KT-34009`](https://youtrack.jetbrains.com/issue/KT-34009) Associate compilations in the target–compilation project model + +#### Performance Improvements + +- [`KT-31666`](https://youtrack.jetbrains.com/issue/KT-31666) Kotlin plugin configures all tasks in a project when `kotlin.incremental` is enabled + +#### Fixes + +- [`KT-17630`](https://youtrack.jetbrains.com/issue/KT-17630) User test Gradle source set code cannot reach out internal members from the production code +- [`KT-22213`](https://youtrack.jetbrains.com/issue/KT-22213) Android Extensions experimental mode doesn't work with Gradle Kotlin DSL +- [`KT-31077`](https://youtrack.jetbrains.com/issue/KT-31077) android.kotlinOptions block is lacking its type +- [`KT-31641`](https://youtrack.jetbrains.com/issue/KT-31641) Kapt configurations miss attributes to resolve MPP dependencies: Cannot choose between the following variants ... +- [`KT-31713`](https://youtrack.jetbrains.com/issue/KT-31713) ConcurrentModificationException: Realize Pending during execution phase +- [`KT-32678`](https://youtrack.jetbrains.com/issue/KT-32678) Bugfixes in HMPP source set visibility +- [`KT-32679`](https://youtrack.jetbrains.com/issue/KT-32679) Testing & test tasks API in the target–compilation model +- [`KT-32804`](https://youtrack.jetbrains.com/issue/KT-32804) Kapt-generated Java sources in jvm+withJava MPP module are not compiled and bundled +- [`KT-32853`](https://youtrack.jetbrains.com/issue/KT-32853) ConcurrentModificationException when compiling with Gradle. +- [`KT-32872`](https://youtrack.jetbrains.com/issue/KT-32872) Gradle test runner for Native does not show failed build if process quit without starting printing results. +- [`KT-33105`](https://youtrack.jetbrains.com/issue/KT-33105) kapt+withJava in multiplatform module depending on other multiplatform fails on 1.3.50-eap-54 +- [`KT-33469`](https://youtrack.jetbrains.com/issue/KT-33469) Drop support for Gradle versions older than 4.3 in the Kotlin Gradle plugin +- [`KT-33470`](https://youtrack.jetbrains.com/issue/KT-33470) Drop support for Gradle versions older than 4.9 in the Kotlin Gradle plugin +- [`KT-33980`](https://youtrack.jetbrains.com/issue/KT-33980) Read the granular source sets metadata flag value once and cache it for the current Gradle build +- [`KT-34312`](https://youtrack.jetbrains.com/issue/KT-34312) UnsupportedOperationException on `requiresVisibilityOf` in the Kotlin Gradle plugin + +### Tools. Gradle. JS + +#### New Features + +- [`KT-31478`](https://youtrack.jetbrains.com/issue/KT-31478) Gradle, JS tests, Karma: Support sourcemaps in Gradle stacktraces +- [`KT-32073`](https://youtrack.jetbrains.com/issue/KT-32073) Gradle, JS, karma: parse errors and warnings from karma output +- [`KT-32075`](https://youtrack.jetbrains.com/issue/KT-32075) Gradle, JS, karma: download chrome headless using puppeteer + +#### Fixes + +- [`KT-31663`](https://youtrack.jetbrains.com/issue/KT-31663) Gradle/JS: with not installed browser specified for browser test the response is "Successful, 0 tests found" +- [`KT-32216`](https://youtrack.jetbrains.com/issue/KT-32216) Gradle, JS, tests: filter doesn't work +- [`KT-32224`](https://youtrack.jetbrains.com/issue/KT-32224) In Gradle Kotlin/JS projects, the `browserWebpack` task does not rerun when the `main` compilation's outputs change +- [`KT-32281`](https://youtrack.jetbrains.com/issue/KT-32281) Gradle, JS, karma: Headless chrome output is not captured +- [`KT-33288`](https://youtrack.jetbrains.com/issue/KT-33288) JS: Incorrect bundle with webpack output.library and source maps +- [`KT-33313`](https://youtrack.jetbrains.com/issue/KT-33313) When a Kotlin/JS test task runs using a custom compilation, it doesn't track the compilation outputs in its up-to-date checks +- [`KT-33547`](https://youtrack.jetbrains.com/issue/KT-33547) Template JS Client and JVM Server works wrong on 1.3.50 Kotlin +- [`KT-33549`](https://youtrack.jetbrains.com/issue/KT-33549) Gradle Kotlin/JS external declarations: search for `typings` key inside `package.json` +- [`KT-33579`](https://youtrack.jetbrains.com/issue/KT-33579) Js tests with mocha cannot be run +- [`KT-33710`](https://youtrack.jetbrains.com/issue/KT-33710) Task "generateExternals" for automatic Dukat execution does not work +- [`KT-33716`](https://youtrack.jetbrains.com/issue/KT-33716) Gradle, Yarn: yarn is not downloading via YarnSetupTask +- [`KT-34101`](https://youtrack.jetbrains.com/issue/KT-34101) CCE class org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest_Decorated cannot be cast to class org.gradle.api.provider.Provider on importing Gradle project with JS +- [`KT-34123`](https://youtrack.jetbrains.com/issue/KT-34123) "Cannot find node module "kotlin-test-js-runner/kotlin-test-karma-runner.js"" in `JS Client and JVM Server` new project wizard template +- [`KT-32319`](https://youtrack.jetbrains.com/issue/KT-32319) Gradle, js, webpack: source-map-loader failed to load source contents from relative urls +- [`KT-33417`](https://youtrack.jetbrains.com/issue/KT-33417) NodeTest failed with error "Failed to create MD5 hash" after NodeRun is executed +- [`KT-33747`](https://youtrack.jetbrains.com/issue/KT-33747) Exception doesn't fail the test in kotlin js node runner +- [`KT-33828`](https://youtrack.jetbrains.com/issue/KT-33828) jsPackageJson task fails after changing artifact origin repository +- [`KT-34460`](https://youtrack.jetbrains.com/issue/KT-34460) NPM packages clash if declared in dependencies and devDependencies both +- [`KT-34555`](https://youtrack.jetbrains.com/issue/KT-34555) [Kotlin/JS] Unsafe webpack config merge + +### Tools. Gradle. Native + +- [`KT-33076`](https://youtrack.jetbrains.com/issue/KT-33076) MPP Gradle plugin: Produce final native binaries from compilation output instead of sources +- [`KT-33645`](https://youtrack.jetbrains.com/issue/KT-33645) Kotlin/Native: Compilation failure if a library passed by the -Xinclude option contains a constructor annotated with @OverrideInit +- [`KT-34259`](https://youtrack.jetbrains.com/issue/KT-34259) MPP Gradle plugin: Support fat frameworks for watchOS and tvOS +- [`KT-34329`](https://youtrack.jetbrains.com/issue/KT-34329) Support watchOS and tvOS in CocoaPods Gradle plugin + +### Tools. J2K + +#### New Features + +- [`KT-7940`](https://youtrack.jetbrains.com/issue/KT-7940) J2K: convert Integer.MAX_VALUE to Int.MAX_VALUE +- [`KT-22412`](https://youtrack.jetbrains.com/issue/KT-22412) J2K: Intention to replace if(...) throw IAE with require +- [`KT-22680`](https://youtrack.jetbrains.com/issue/KT-22680) Request: when converting Java->Kotlin, try to avoid creating functions for constant fields (`static final`) + +#### Performance Improvements + +- [`KT-33725`](https://youtrack.jetbrains.com/issue/KT-33725) Java->Kotlin converter on paste performs expensive reparse in unrelated contexts +- [`KT-33854`](https://youtrack.jetbrains.com/issue/KT-33854) J2K conversion of Interface freezes UI for more than 10 seconds without progress dialog +- [`KT-33875`](https://youtrack.jetbrains.com/issue/KT-33875) [NewJ2K] InspectionLikeProcessingGroup pipeline rework: query isApplicable in parallel for all element first, apply relevant after in EDT + +#### Fixes + +- [`KT-19603`](https://youtrack.jetbrains.com/issue/KT-19603) A mutable container property updated from another class converts to red code +- [`KT-19607`](https://youtrack.jetbrains.com/issue/KT-19607) Static member qualified by child class converted to red code +- [`KT-20035`](https://youtrack.jetbrains.com/issue/KT-20035) Automatic conversion from Java 1.8 to Kotlin 1.1.4 using Idea 2017.2.2: null!! +- [`KT-21504`](https://youtrack.jetbrains.com/issue/KT-21504) J2K: Convert Long.parseLong(s) to s.toLong() +- [`KT-24293`](https://youtrack.jetbrains.com/issue/KT-24293) Bug: conversion of Java "List" into Kotlin doesn't produce "MutableList" +- [`KT-32253`](https://youtrack.jetbrains.com/issue/KT-32253) Converting Java class with field initialized by constructor parameter used to initialize a different field or named as a different field produces red code +- [`KT-32696`](https://youtrack.jetbrains.com/issue/KT-32696) New J2K: java List is wrongly converted when pasting it to Kotlin file +- [`KT-32903`](https://youtrack.jetbrains.com/issue/KT-32903) J2K: Static import is converted to unresolved reference +- [`KT-33235`](https://youtrack.jetbrains.com/issue/KT-33235) Remove "Replace guard clause with kotlin's function call" inspection and tranform it to J2K post-processing +- [`KT-33434`](https://youtrack.jetbrains.com/issue/KT-33434) UninitializedPropertyAccessException occurs after J2K convertion of package with custom functional interface and it's usage +- [`KT-33445`](https://youtrack.jetbrains.com/issue/KT-33445) Two definitions of org.jetbrains.kotlin.idea.j2k.J2kPostProcessing in Kotlin 1.3.50-rc +- [`KT-33500`](https://youtrack.jetbrains.com/issue/KT-33500) Unresolved reference after J2K convertion of isNaN/isFinite +- [`KT-33556`](https://youtrack.jetbrains.com/issue/KT-33556) J2K converter fails on statically imported global overloaded functions +- [`KT-33679`](https://youtrack.jetbrains.com/issue/KT-33679) Result of assignment with operation differs in kotlin after J2K conversion +- [`KT-33687`](https://youtrack.jetbrains.com/issue/KT-33687) Extra empty lines are added after comment after J2K conversion +- [`KT-33743`](https://youtrack.jetbrains.com/issue/KT-33743) Reference to static field outside its class is unresolved after J2K conversion +- [`KT-33756`](https://youtrack.jetbrains.com/issue/KT-33756) J2K: main method with varargs is converted to non-runnable main kotlin method +- [`KT-33863`](https://youtrack.jetbrains.com/issue/KT-33863) java.lang.IllegalStateException: argument must not be null exception occurs on J2K conversion of Generic class usage without type parameter +- [`KT-19355`](https://youtrack.jetbrains.com/issue/KT-19355) "Variable expected" error after J2K for increment/decrement of an object field +- [`KT-19569`](https://youtrack.jetbrains.com/issue/KT-19569) Java wrappers for primitives are converted to nullable types with nullability errors in Kotlin +- [`KT-30643`](https://youtrack.jetbrains.com/issue/KT-30643) J2K: wrong position of TYPE_USE annotation +- [`KT-32518`](https://youtrack.jetbrains.com/issue/KT-32518) Nullability information is lost after J2K convertion of constructor with null parameter +- [`KT-33941`](https://youtrack.jetbrains.com/issue/KT-33941) J2K: Overload resolution ambiguity with assertThat and `StackOverflowError` in IDEA +- [`KT-33942`](https://youtrack.jetbrains.com/issue/KT-33942) New J2K: `StackOverflowError` from `org.jetbrains.kotlin.nj2k.inference.common.BoundTypeCalculatorImpl.boundTypeUnenhanced` +- [`KT-34164`](https://youtrack.jetbrains.com/issue/KT-34164) J2K: on converting static method references in other .java sources are not corrected +- [`KT-34165`](https://youtrack.jetbrains.com/issue/KT-34165) J2K: imports are lost in conversion, references resolve to different same-named classes +- [`KT-34266`](https://youtrack.jetbrains.com/issue/KT-34266) Multiple errors after converting Java class implementing an interface from another file + +### Tools. JPS + +- [`KT-33808`](https://youtrack.jetbrains.com/issue/KT-33808) JPS compilation is not incremental in IDEA 2019.3 + +### Tools. Maven + +- [`KT-34006`](https://youtrack.jetbrains.com/issue/KT-34006) Maven plugin do not consider .kts files as Kotlin sources +- [`KT-34011`](https://youtrack.jetbrains.com/issue/KT-34011) Kotlin scripting plugin is not loaded by default from kotlin maven plugin + +### Tools. REPL + +- [`KT-27956`](https://youtrack.jetbrains.com/issue/KT-27956) REPL/Script: extract classes and names right from ClassLoader + +### Tools. Scripts + +- [`KT-31661`](https://youtrack.jetbrains.com/issue/KT-31661) ClassNotFoundException in runtime for 'kotlinc -script' while compilation is fine +- [`KT-31704`](https://youtrack.jetbrains.com/issue/KT-31704) [kotlin-scripting] passing `name` to String.toScriptSource make script compilation failed +- [`KT-32234`](https://youtrack.jetbrains.com/issue/KT-32234) "Unable to derive module descriptor" when using Kotlin compiler (embeddable) in Java 9+ modular builds +- [`KT-33529`](https://youtrack.jetbrains.com/issue/KT-33529) NCDF running kotlin script from command line +- [`KT-33554`](https://youtrack.jetbrains.com/issue/KT-33554) Classpath not passed properly when evaluating standard script with `kotlinc` +- [`KT-33892`](https://youtrack.jetbrains.com/issue/KT-33892) REPL/Script: Implement mechanism for resolve top-level functions and properties from classloader +- [`KT-34294`](https://youtrack.jetbrains.com/issue/KT-34294) SamWithReceiver cannot be used with new scripting API + +### Tools. kapt + +- [`KT-31291`](https://youtrack.jetbrains.com/issue/KT-31291) Incremental Kapt: IllegalArgumentException from `org.jetbrains.org.objectweb.asm.ClassVisitor.` +- [`KT-33028`](https://youtrack.jetbrains.com/issue/KT-33028) Kapt error "Unable to find package java.lang in classpath or bootclasspath" on JDK 11 with `-source 8` +- [`KT-33050`](https://youtrack.jetbrains.com/issue/KT-33050) kapt does not honor source/target compatibility of enclosing project +- [`KT-33052`](https://youtrack.jetbrains.com/issue/KT-33052) Kapt generates invalid java stubs for enum members with class bodies on JDK 11 +- [`KT-33056`](https://youtrack.jetbrains.com/issue/KT-33056) Incremental kapt is disabled due to `javaslang.match.PatternsProcessor` processor on classpath when Worker API is enabled +- [`KT-33493`](https://youtrack.jetbrains.com/issue/KT-33493) 1.3.50, org.jetbrains.org.objectweb.asm.ClassVisitor. +- [`KT-33515`](https://youtrack.jetbrains.com/issue/KT-33515) Incremental kapt fails when I remove an annotated file +- [`KT-33889`](https://youtrack.jetbrains.com/issue/KT-33889) Incremental KAPT: NoSuchMethodError: 'java.util.regex.Pattern com.sun.tools.javac.processing.JavacProcessingEnvironment.validImportStringToPattern(java.lang.String)' +- [`KT-33503`](https://youtrack.jetbrains.com/issue/KT-33503) Kapt, Spring Boot: "Could not resolve all files for configuration ':_classStructurekaptKotlin'" +- [`KT-33800`](https://youtrack.jetbrains.com/issue/KT-33800) KAPT aptMode=compile fails to compile certain legitimate code + +## 1.3.50 + +### Compiler + +- [`KT-12787`](https://youtrack.jetbrains.com/issue/KT-12787) Debugger: Generate line number at end of function (to set a breakpoint on the last line of the block) +- [`KT-23675`](https://youtrack.jetbrains.com/issue/KT-23675) "Parameter specified as non-null is null: method org.jetbrains.kotlin.codegen.FrameMapBase.getIndex, parameter descriptor" when classes are defined inside an anonymous extension function and access a field of the extension function's `this` instance +- [`KT-24596`](https://youtrack.jetbrains.com/issue/KT-24596) Refactor / Inline const property does not insert its value into usage in annotation +- [`KT-25497`](https://youtrack.jetbrains.com/issue/KT-25497) kotlinx.serialization - throws Backend Internal error exception during code generation of sealed classes +- [`KT-28927`](https://youtrack.jetbrains.com/issue/KT-28927) "IllegalStateException: Arrays of class literals are not supported yet" in AnnotationDeserializer.resolveArrayElementType +- [`KT-31070`](https://youtrack.jetbrains.com/issue/KT-31070) IndexOutOfBoundsException in Analyzer with @JvmOverloads constructor with 34+ parameters +- [`KT-31265`](https://youtrack.jetbrains.com/issue/KT-31265) FIR: experimental compiler +- [`KT-31535`](https://youtrack.jetbrains.com/issue/KT-31535) False positives from compiler warning IMPLICIT_NOTHING_AS_TYPE_PARAMETER +- [`KT-31969`](https://youtrack.jetbrains.com/issue/KT-31969) NI: false positive USELESS_ELVIS with multiple elvis calls +- [`KT-32044`](https://youtrack.jetbrains.com/issue/KT-32044) For loop over full UByte range terminates at UInt bound. +- [`KT-25432`](https://youtrack.jetbrains.com/issue/KT-25432) No smartcast on qualifier expression of captured type +- [`KT-30796`](https://youtrack.jetbrains.com/issue/KT-30796) psi2ir generates IrErrorType for elvis with generic type having nullable upper-bound when expected type is not nullable +- [`KT-31242`](https://youtrack.jetbrains.com/issue/KT-31242) "Can't find enclosing method" proguard compilation exception with inline and crossinline +- [`KT-31347`](https://youtrack.jetbrains.com/issue/KT-31347) "IndexOutOfBoundsException: Insufficient maximum stack size" with crossinline and suspend +- [`KT-31367`](https://youtrack.jetbrains.com/issue/KT-31367) IllegalStateException: Concrete fake override public open fun (...) defined in TheIssue[PropertyGetterDescriptorImpl@1a03c376] should have exactly one concrete super-declaration: [] +- [`KT-31734`](https://youtrack.jetbrains.com/issue/KT-31734) Empty parameter list required on Annotations of function types +- [`KT-32434`](https://youtrack.jetbrains.com/issue/KT-32434) New type inference fails for Caffeine Cache +- [`KT-32452`](https://youtrack.jetbrains.com/issue/KT-32452) Kotlin 1.3.40 - problem in IDE with new type inference and suspending method reference +- [`KT-32407`](https://youtrack.jetbrains.com/issue/KT-32407) NI: "use property access syntax" intention causes freezes in editor +- [`KT-33127`](https://youtrack.jetbrains.com/issue/KT-33127) Script result value is not calculated properly for the last expression +- [`KT-33157`](https://youtrack.jetbrains.com/issue/KT-33157) Inline class with generic method is considered bad class by javac + +### Docs & Examples + +- [`KT-16602`](https://youtrack.jetbrains.com/issue/KT-16602) Provide examples of sorting API usage +- [`KT-32353`](https://youtrack.jetbrains.com/issue/KT-32353) Document order of array elements initialization + +### IDE + +#### New Features + +- [`KT-28098`](https://youtrack.jetbrains.com/issue/KT-28098) Insert space after automatically closed right brace of nested lambda to follow code style + +#### Fixes + +- [`KT-16476`](https://youtrack.jetbrains.com/issue/KT-16476) Extend selection (Select Word) doesn't select just KDoc if cursor is just before the KDoc +- [`KT-21374`](https://youtrack.jetbrains.com/issue/KT-21374) Imports optimized tooltip is displayed, even if no changes were made +- [`KT-21422`](https://youtrack.jetbrains.com/issue/KT-21422) IDE can't import class from root package +- [`KT-27344`](https://youtrack.jetbrains.com/issue/KT-27344) MPP: jvmWithJava: no IDE module dependency is created between Kotlin test and Java main on import; Gradle build is successful +- [`KT-29667`](https://youtrack.jetbrains.com/issue/KT-29667) Kotlin update settings has wrong looking text boxes for versions +- [`KT-30133`](https://youtrack.jetbrains.com/issue/KT-30133) Update copyright creates duplicates for build.gradle.kts files +- [`KT-30782`](https://youtrack.jetbrains.com/issue/KT-30782) 'Show Method Separators' does not separate expression body Kotlin functions +- [`KT-31022`](https://youtrack.jetbrains.com/issue/KT-31022) `Quick definition` does not show Kotlin code in Java files +- [`KT-31499`](https://youtrack.jetbrains.com/issue/KT-31499) "Extend selection" selects escaped identifier name together with backticks +- [`KT-31595`](https://youtrack.jetbrains.com/issue/KT-31595) "Complete current statement" for method call closes brace at wrong place +- [`KT-31637`](https://youtrack.jetbrains.com/issue/KT-31637) NPE in IDE when organizing imports +- [`KT-31786`](https://youtrack.jetbrains.com/issue/KT-31786) KNPE at copy attempt due to kdoc reference +- [`KT-32276`](https://youtrack.jetbrains.com/issue/KT-32276) Fix flaky test for ultra light classes +- [`KT-32364`](https://youtrack.jetbrains.com/issue/KT-32364) Remove deprecated usages of OUT_OF_CODE_BLOCK_MODIFICATION_COUNT and write a replacement for Kotlin language +- [`KT-32370`](https://youtrack.jetbrains.com/issue/KT-32370) Lambdas should have implicit `return` in Kotlin Uast +- [`KT-12096`](https://youtrack.jetbrains.com/issue/KT-12096) Spring: rename of Kotlin bean defined in `@Bean` annotation fails +- [`KT-28193`](https://youtrack.jetbrains.com/issue/KT-28193) Exception: Mirror element should never be calculated for light classes generated from a single file +- [`KT-28822`](https://youtrack.jetbrains.com/issue/KT-28822) Dependencies in Kotlin MPP project could be wrongly resolved if project was not build before import +- [`KT-29267`](https://youtrack.jetbrains.com/issue/KT-29267) Enable ultra-light classes by default +- [`KT-31129`](https://youtrack.jetbrains.com/issue/KT-31129) Call only Kotlin-specific reference contributors for getting Kotlin references from PSI +- [`KT-32082`](https://youtrack.jetbrains.com/issue/KT-32082) Kotlin facet: 1.3.40 plugin does not properly read target platform settings of 1.3.50 plugin +- [`KT-32969`](https://youtrack.jetbrains.com/issue/KT-32969) Data class extending abstract class with final `toString`, `equals` or `hashCode` causes exception +- [`KT-33245`](https://youtrack.jetbrains.com/issue/KT-33245) IllegalArgumentException exception occurs on Tools->Configure Koltin in Project action in Android Studio + +### IDE. Completion + +- [`KT-9792`](https://youtrack.jetbrains.com/issue/KT-9792) Don't propose the same name for arguments of lambda on completion of function call with lambda template +- [`KT-29572`](https://youtrack.jetbrains.com/issue/KT-29572) Smart completing anonymous object uses incorrect code style +- [`KT-25264`](https://youtrack.jetbrains.com/issue/KT-25264) Freeze in Kotlin file on completion +- [`KT-32519`](https://youtrack.jetbrains.com/issue/KT-32519) Keyword completion: support fixing layout and typo tolerance + +### IDE. Debugger + +#### New Features + +- [`KT-30740`](https://youtrack.jetbrains.com/issue/KT-30740) Display more information about variables when breakpoint is set inside lambda expression + +#### Fixes + +- [`KT-8579`](https://youtrack.jetbrains.com/issue/KT-8579) Debugger: Evaluate expression fails at typed arrays +- [`KT-10183`](https://youtrack.jetbrains.com/issue/KT-10183) Debugger: receiver properties are not shown inline in extension function +- [`KT-11663`](https://youtrack.jetbrains.com/issue/KT-11663) Assignment is not possible in Evaluate expression +- [`KT-11706`](https://youtrack.jetbrains.com/issue/KT-11706) Attempts to evaluate java method calls on 'Array' instance in debugger fail with NoSuchMethodError +- [`KT-11888`](https://youtrack.jetbrains.com/issue/KT-11888) Evaluate Expression for expression with synchronized +- [`KT-11938`](https://youtrack.jetbrains.com/issue/KT-11938) Empty condition is marked as error +- [`KT-13188`](https://youtrack.jetbrains.com/issue/KT-13188) Cannot evaluate expression with local extension function +- [`KT-14421`](https://youtrack.jetbrains.com/issue/KT-14421) Debugger: breakpoint set on trivial if/while is not hit +- [`KT-15259`](https://youtrack.jetbrains.com/issue/KT-15259) Debug: closing brace of object definition is considered executable; ISE: "Don't call this method for local declarations: OBJECT_DECLARATION" at LazyDeclarationResolver.getMemberScopeDeclaredIn() +- [`KT-19084`](https://youtrack.jetbrains.com/issue/KT-19084) Breakpoints on Debugger altering Result +- [`KT-19556`](https://youtrack.jetbrains.com/issue/KT-19556) Kotlin exception while debugging IJ plugin code +- [`KT-19980`](https://youtrack.jetbrains.com/issue/KT-19980) Debug: evaluation fails for setter of member extention property +- [`KT-20560`](https://youtrack.jetbrains.com/issue/KT-20560) Evaluate expression doesn't work for super method call +- [`KT-23526`](https://youtrack.jetbrains.com/issue/KT-23526) In *.kts scripts, debugger ignores breakpoints in top-level statements and members +- [`KT-24914`](https://youtrack.jetbrains.com/issue/KT-24914) AS: Uninitialized yet lazy properties called on first debug point reach +- [`KT-26742`](https://youtrack.jetbrains.com/issue/KT-26742) Debugger can't evaluate expected top-level function from common code +- [`KT-30120`](https://youtrack.jetbrains.com/issue/KT-30120) False positive "Unused equals expression" in evaluate expression window +- [`KT-30730`](https://youtrack.jetbrains.com/issue/KT-30730) Missing tooltip for "Kotlin variables view" button +- [`KT-30919`](https://youtrack.jetbrains.com/issue/KT-30919) Debugger's "Kotlin View" doesn't show variables inside lambdas +- [`KT-30976`](https://youtrack.jetbrains.com/issue/KT-30976) Debugger: No access to receiver evaluating named parameters during call to extension function +- [`KT-31418`](https://youtrack.jetbrains.com/issue/KT-31418) java.lang.ClassCastException : java.lang.annotation.Annotation[] cannot be cast to byte[] +- [`KT-31510`](https://youtrack.jetbrains.com/issue/KT-31510) isDumb should be used only under read action: KotlinEvaluator +- [`KT-31702`](https://youtrack.jetbrains.com/issue/KT-31702) Debugger can't stop on breakpoint on `Unit` expression from coroutine context +- [`KT-31709`](https://youtrack.jetbrains.com/issue/KT-31709) Evaluate: "IllegalArgumentException: Parameter specified as non-null is null: method org.jetbrains.kotlin.codegen.FrameMapBase.getIndex, parameter descriptor" with nested lambda member access +- [`KT-24829`](https://youtrack.jetbrains.com/issue/KT-24829) Access to coroutineContext in 'Evaluate expression' + +### IDE. Gradle + +- [`KT-19693`](https://youtrack.jetbrains.com/issue/KT-19693) Import package prefix from Gradle +- [`KT-30667`](https://youtrack.jetbrains.com/issue/KT-30667) Dependencies of a module on a multiplatform one with a JVM target and `withJava()` configured, are incorrectly resolved in IDE +- [`KT-32300`](https://youtrack.jetbrains.com/issue/KT-32300) Add possibility to distinguish kotlin source root from java source root +- [`KT-31014`](https://youtrack.jetbrains.com/issue/KT-31014) Gradle, JS: Webpack watch mode +- [`KT-31843`](https://youtrack.jetbrains.com/issue/KT-31843) Memory leak caused by KOTLIN_TARGET_DATA_NODE on project reimport + +### IDE. Gradle. Script + +- [`KT-31779`](https://youtrack.jetbrains.com/issue/KT-31779) "Highlighting in scripts is not available" +- [`KT-30638`](https://youtrack.jetbrains.com/issue/KT-30638) "Highlighting in scripts is not available until all Script Dependencies are loaded" in Diff viewer +- [`KT-30974`](https://youtrack.jetbrains.com/issue/KT-30974) Script dependencies resolution failed error while trying to use Kotlin for Gradle +- [`KT-31440`](https://youtrack.jetbrains.com/issue/KT-31440) Add link to Gradle Kotlin DSL logs when script dependencies resolution process fails +- [`KT-32483`](https://youtrack.jetbrains.com/issue/KT-32483) CNFE org.gradle.kotlin.dsl.KotlinBuildScript on creating new Gradle Kotlin project from wizard +- [`KT-21501`](https://youtrack.jetbrains.com/issue/KT-21501) build.gradle.kts displays failures if not using java sdk for module + +### IDE. Inspections and Intentions + +#### New Features + +- [`KT-8958`](https://youtrack.jetbrains.com/issue/KT-8958) ReplaceWith intention message could be more helpful in case of generic substitution +- [`KT-12515`](https://youtrack.jetbrains.com/issue/KT-12515) Quickfix "by Delegates.notNull()" as replacement for "lateinit" for primitive type +- [`KT-14344`](https://youtrack.jetbrains.com/issue/KT-14344) Suggest to replace manual range with explicit `indices` call or iteration over collection +- [`KT-17916`](https://youtrack.jetbrains.com/issue/KT-17916) Import popup does not indicate deprecated classes +- [`KT-23501`](https://youtrack.jetbrains.com/issue/KT-23501) Add intention for converting ordinary properties to 'lazy' and vise versa +- [`KT-25006`](https://youtrack.jetbrains.com/issue/KT-25006) Add inspection "'equals()' between objects of inconvertible primitive / enum / string types" +- [`KT-27353`](https://youtrack.jetbrains.com/issue/KT-27353) Quickfix to add a constructor parameter from parent class to child class +- [`KT-30124`](https://youtrack.jetbrains.com/issue/KT-30124) Add inspection to replace java.util.Arrays.equals with contentEquals +- [`KT-30640`](https://youtrack.jetbrains.com/issue/KT-30640) Add inspection for check/require/checkNotNull/requireNotNull +- [`KT-30775`](https://youtrack.jetbrains.com/issue/KT-30775) Inspection for the case when one lateinit var overrides another lateinit var +- [`KT-31476`](https://youtrack.jetbrains.com/issue/KT-31476) Improve "Create expect..." quickfix +- [`KT-31533`](https://youtrack.jetbrains.com/issue/KT-31533) Make "Add operator modifier" an inspection instead of intention +- [`KT-31795`](https://youtrack.jetbrains.com/issue/KT-31795) Inspection: simplify property setter with custom visibility +- [`KT-31924`](https://youtrack.jetbrains.com/issue/KT-31924) Make "add import" intention more flexible based on caret position +- [`KT-30970`](https://youtrack.jetbrains.com/issue/KT-30970) No warning for empty `if` operator and `also`method + +#### Fixes + +- [`KT-12567`](https://youtrack.jetbrains.com/issue/KT-12567) "Introduce 'when' subject" intention does not work for "this" in extension function +- [`KT-14369`](https://youtrack.jetbrains.com/issue/KT-14369) "Replace elvis expression with 'if" intention produces boilerplate code for 'return' in RHS +- [`KT-16067`](https://youtrack.jetbrains.com/issue/KT-16067) "Replace 'if' expression with elvis expression" suggests replacing an idiomatic code with non-idiomatic +- [`KT-19643`](https://youtrack.jetbrains.com/issue/KT-19643) Tune or disable the FoldInitializerAndIfToElvis inspection +- [`KT-24439`](https://youtrack.jetbrains.com/issue/KT-24439) No method imports suggested +- [`KT-25786`](https://youtrack.jetbrains.com/issue/KT-25786) False positive "Not-null extension receiver of inline function can be made nullable" with `operator fun invoke` +- [`KT-25905`](https://youtrack.jetbrains.com/issue/KT-25905) False positive for 'LeakingThis' on a method call in enum class body +- [`KT-27074`](https://youtrack.jetbrains.com/issue/KT-27074) False positive "Foldable if-then" with Result type +- [`KT-27550`](https://youtrack.jetbrains.com/issue/KT-27550) "Redundant explicit this" false positive with subclass and extension lambda +- [`KT-27563`](https://youtrack.jetbrains.com/issue/KT-27563) Generate toString in common code shouldn't use java.util.Arrays +- [`KT-27822`](https://youtrack.jetbrains.com/issue/KT-27822) Don't suggest `might be const` on `actual` member declaration +- [`KT-28595`](https://youtrack.jetbrains.com/issue/KT-28595) "Assignment should be lifted out of 'if'" false negative for different but compatible derived types +- [`KT-29192`](https://youtrack.jetbrains.com/issue/KT-29192) "Convert property to function" with explicit generic type loses getter body +- [`KT-29716`](https://youtrack.jetbrains.com/issue/KT-29716) With both explicit and implicit package prefixes "Package name does not match containing directory" inspection suggests not usable quick fix +- [`KT-29731`](https://youtrack.jetbrains.com/issue/KT-29731) Don't suggest `Add val/var to parameter` at expect class constructor +- [`KT-30191`](https://youtrack.jetbrains.com/issue/KT-30191) "Lift out of if" intention isn't suggested for assignment of null +- [`KT-30197`](https://youtrack.jetbrains.com/issue/KT-30197) ReplaceWith for deprecated function adds class literal/callable reference argument above unless it is used in substitution +- [`KT-30627`](https://youtrack.jetbrains.com/issue/KT-30627) "Use property access syntax" produces red code if setter argument is a lambda with implicit SAM conversion +- [`KT-30804`](https://youtrack.jetbrains.com/issue/KT-30804) Property declaration goes to annotation comment when removing only modifier using RemoveModifierFix +- [`KT-30975`](https://youtrack.jetbrains.com/issue/KT-30975) ''when' has only 'else' branch and should be simplified' inspection removes subject variable definition used in else branch +- [`KT-31033`](https://youtrack.jetbrains.com/issue/KT-31033) "Create expect ..." quick fix incorrectly works for a secondary constructor in a multiplatform project +- [`KT-31272`](https://youtrack.jetbrains.com/issue/KT-31272) Expand "create expected ..." quick fix highlighting also to a primary constructor +- [`KT-31278`](https://youtrack.jetbrains.com/issue/KT-31278) Inappropriate "Remove redundant .let call" inspection +- [`KT-31341`](https://youtrack.jetbrains.com/issue/KT-31341) Incorrect quickfix "Replace with Kotlin analog" for conversion to an extension, where the first argument is an expression with an operation +- [`KT-31359`](https://youtrack.jetbrains.com/issue/KT-31359) "Invalid property key" inspection false positive for a bundle with several properties files +- [`KT-31362`](https://youtrack.jetbrains.com/issue/KT-31362) 'Move variable declaration into `when`' quickfix comments left brace with EOL comment +- [`KT-31443`](https://youtrack.jetbrains.com/issue/KT-31443) Remove braces intention places caret in a wrong place +- [`KT-31446`](https://youtrack.jetbrains.com/issue/KT-31446) Incorrect quick fix “Create expected class" for inline class with parameter with actual +- [`KT-31518`](https://youtrack.jetbrains.com/issue/KT-31518) Incorrect "Create expect function" for primary constructor +- [`KT-31673`](https://youtrack.jetbrains.com/issue/KT-31673) Only `when` keyword should be highlighted in WhenWithOnlyElseInspection +- [`KT-31716`](https://youtrack.jetbrains.com/issue/KT-31716) Decrease severity of PackageDirectoryMismatchInspection to INFO +- [`KT-31717`](https://youtrack.jetbrains.com/issue/KT-31717) Decrease severity of RemoveCurlyBracesFromTemplateInspection +- [`KT-31816`](https://youtrack.jetbrains.com/issue/KT-31816) "Package directive doesn't match file location" for root package is invisible in editor +- [`KT-31954`](https://youtrack.jetbrains.com/issue/KT-31954) MoveVariableDeclarationIntoWhen should move the caret to the subject expression +- [`KT-32001`](https://youtrack.jetbrains.com/issue/KT-32001) Wrong quickfixes for TOO_MANY_ARGUMENTS +- [`KT-32010`](https://youtrack.jetbrains.com/issue/KT-32010) Convert ReplaceSingleLineLetIntention to inspections +- [`KT-32046`](https://youtrack.jetbrains.com/issue/KT-32046) False negative "Redundant qualifier name" with class literal +- [`KT-32112`](https://youtrack.jetbrains.com/issue/KT-32112) False positive "Redundant qualifier name" +- [`KT-32318`](https://youtrack.jetbrains.com/issue/KT-32318) "Remove argument name" intention does not remove square braces for annotation vararg argument +- [`KT-32320`](https://youtrack.jetbrains.com/issue/KT-32320) False negative "Redundant qualifier name" with local object +- [`KT-32347`](https://youtrack.jetbrains.com/issue/KT-32347) Duplicative "Remove redundant 'public' modifier" suggestion for getter +- [`KT-32365`](https://youtrack.jetbrains.com/issue/KT-32365) "Convert to sealed class" intention should not be suggested when no "class" keyword +- [`KT-32419`](https://youtrack.jetbrains.com/issue/KT-32419) Spurious 'while' has empty body warning when body has explanatory comment +- [`KT-32506`](https://youtrack.jetbrains.com/issue/KT-32506) False negative "Remove redundant qualifier name" with `java.util.ArrayList()` +- [`KT-32454`](https://youtrack.jetbrains.com/issue/KT-32454) "Replace Java static method with Kotlin analog": invalid quick fix on 'abs()' function +- [`KT-26242`](https://youtrack.jetbrains.com/issue/KT-26242) "Create test" intention does nothing in common module +- [`KT-27208`](https://youtrack.jetbrains.com/issue/KT-27208) IDEA reports about the need to declare abstract or implement abstract method, but this method is @JvmStatic in an interface companion +- [`KT-27555`](https://youtrack.jetbrains.com/issue/KT-27555) `Create actual ...` quick fix does nothing if the corresponding source set directory isn't created yet +- [`KT-28121`](https://youtrack.jetbrains.com/issue/KT-28121) IDE: Warn on java files under "src/main/kotlin" or "src/test/kotlin" source roots +- [`KT-28295`](https://youtrack.jetbrains.com/issue/KT-28295) Use `languageSettings` for a quick fix to enable experimental features in multiplatform projects +- [`KT-28529`](https://youtrack.jetbrains.com/issue/KT-28529) Don't suggest `commonMain` source set as a target of `create expected ...` quick fix for a member of `*Test` source set +- [`KT-28746`](https://youtrack.jetbrains.com/issue/KT-28746) “Create actual class” quick fix creates invalid file when is called from files located in package directory but don't have package name +- [`KT-30622`](https://youtrack.jetbrains.com/issue/KT-30622) Add names to call arguments starting from given argument +- [`KT-31404`](https://youtrack.jetbrains.com/issue/KT-31404) Redundant 'requireNotNull' or 'checkNotNull' inspection: don't remove first argument +- [`KT-32705`](https://youtrack.jetbrains.com/issue/KT-32705) "Create expect" quick fix adds `actual` modifier to a `const`/`lateinit` declaration without a warning +- [`KT-32967`](https://youtrack.jetbrains.com/issue/KT-32967) Warning about incorrectly placed Java source file isn't automatically dismissed on move of the file to the proper source root + +### IDE. JS + +- [`KT-31895`](https://youtrack.jetbrains.com/issue/KT-31895) New Project wizard: Kotlin Gradle + Kotlin/JS for Node.js: incorrect DSL is inserted + +### IDE. KDoc + +- [`KT-30985`](https://youtrack.jetbrains.com/issue/KT-30985) Missing line break in quick doc for enum constant + +### IDE. Multiplatform + +- [`KT-29757`](https://youtrack.jetbrains.com/issue/KT-29757) IDE fails to import transitive dependency of a JVM module to a multiplatform one + +### IDE. Navigation + +- [`KT-10215`](https://youtrack.jetbrains.com/issue/KT-10215) Kotlin classes are listed after Java classes in the navigation bar + +### IDE. Refactorings + +- [`KT-29720`](https://youtrack.jetbrains.com/issue/KT-29720) Refactor / Move does not update package statement with implicit prefix +- [`KT-30762`](https://youtrack.jetbrains.com/issue/KT-30762) Inline method produces invalid code for suspend functions with receiver +- [`KT-30748`](https://youtrack.jetbrains.com/issue/KT-30748) 100+ Seconds UI Freeze on performing a Move Refactoring on a file with a lot of usages (KotlinOptimizeImports in thread dump) + +### IDE. Scratch + +- [`KT-23604`](https://youtrack.jetbrains.com/issue/KT-23604) Scratch: end of line is wrongly indented with the end of scratch line output +- [`KT-27963`](https://youtrack.jetbrains.com/issue/KT-27963) Make REPL mode in Scratch files incremental +- [`KT-29534`](https://youtrack.jetbrains.com/issue/KT-29534) Line output jumps to the next line together with cursor +- [`KT-32791`](https://youtrack.jetbrains.com/issue/KT-32791) "Access is allowed from event dispatch thread only" while working with a scratch file + +### IDE. Script + +- [`KT-25187`](https://youtrack.jetbrains.com/issue/KT-25187) Kotlin script in src: warning: classpath entry points to a non-existent location on JDK 9+ +- [`KT-31152`](https://youtrack.jetbrains.com/issue/KT-31152) Errors in IDE when different Java Sdk are set as Project SDK and as Gradle JVM +- [`KT-31521`](https://youtrack.jetbrains.com/issue/KT-31521) CNFE „org.jetbrains.kotlin.idea.caches.project.ScriptBinariesScopeCache“ on creating new Gradle based project +- [`KT-31826`](https://youtrack.jetbrains.com/issue/KT-31826) Gradle clean task causes IDEA to lose kotlin scripting configuration +- [`KT-31837`](https://youtrack.jetbrains.com/issue/KT-31837) TargetPlatform for scripts should depends on scriptDefinition.additionalArguments +- [`KT-30690`](https://youtrack.jetbrains.com/issue/KT-30690) Highlighting for scripts in diff view doesn't work for left part +- [`KT-32061`](https://youtrack.jetbrains.com/issue/KT-32061) Check classpath jars before applying script compilation result from file attributes +- [`KT-32554`](https://youtrack.jetbrains.com/issue/KT-32554) Freezes in ScriptDependenciesUpdater + +### IDE. Tests Support + +- [`KT-30814`](https://youtrack.jetbrains.com/issue/KT-30814) MPP, 191 platform: with Gradle test runner run configuration for platform test is created without tasks + +### IDE. Wizards + +- [`KT-32105`](https://youtrack.jetbrains.com/issue/KT-32105) MPP project wizard: add option for Kotlin Gradle DSL + +### JS. Tools + +- [`KT-31527`](https://youtrack.jetbrains.com/issue/KT-31527) Keep generating empty `jsTest` task +- [`KT-31565`](https://youtrack.jetbrains.com/issue/KT-31565) Gradle/JS: `npmResolve` is never UP-TO-DATE +- [`KT-32326`](https://youtrack.jetbrains.com/issue/KT-32326) Gradle, test runner: support postponing test running error reporting at the end of the build +- [`KT-32393`](https://youtrack.jetbrains.com/issue/KT-32393) Gradle, JS: Resolve projects lazily +- [`KT-31560`](https://youtrack.jetbrains.com/issue/KT-31560) Gradle: provide descriptions for JS tasks +- [`KT-31563`](https://youtrack.jetbrains.com/issue/KT-31563) Gradle/JS: npmResolve fails with "Invalid version" when user project's version does not match npm rules +- [`KT-31566`](https://youtrack.jetbrains.com/issue/KT-31566) Gradle/JS: with explicit call to `nodejs { testTask { useNodeJs() } }` configuration fails : "Could not find which method to invoke" +- [`KT-31694`](https://youtrack.jetbrains.com/issue/KT-31694) Gradle, NPM, windows: creating symlink requires administrator privilege + +### Libraries + +- [`KT-29372`](https://youtrack.jetbrains.com/issue/KT-29372) measureTime that returns both the result of block and elapsed time +- [`KT-32083`](https://youtrack.jetbrains.com/issue/KT-32083) Incorrect ReplaceWith annotation on kotlin.js.pow +- [`KT-12749`](https://youtrack.jetbrains.com/issue/KT-12749) Provide Int.bitCount, Long.bitCount etc. +- [`KT-32359`](https://youtrack.jetbrains.com/issue/KT-32359) Common Array.fill +- [`KT-33225`](https://youtrack.jetbrains.com/issue/KT-33225) JS: Incorrect conversion of infinite Double to Long + +### Reflection + +- [`KT-22923`](https://youtrack.jetbrains.com/issue/KT-22923) Reflection getMemberProperties fails: kotlin.reflect.jvm.internal.KotlinReflectionInternalError +- [`KT-31318`](https://youtrack.jetbrains.com/issue/KT-31318) "KotlinReflectionInternalError: Method is not supported" on accessing array class annotation parameter + +### Tools. Daemon + +- [`KT-31550`](https://youtrack.jetbrains.com/issue/KT-31550) NSME org.jetbrains.kotlin.com.intellij.openapi.vfs.impl.jar.CoreJarFileSystem.clearHandlersCache()V on compileKotlin task with plugin from master +- [`KT-32490`](https://youtrack.jetbrains.com/issue/KT-32490) Compiler daemon tests fail on windows due to directory name being too long +- [`KT-32950`](https://youtrack.jetbrains.com/issue/KT-32950) Daemon should inherit "-XX:MaxMetaspaceSize" of client VM +- [`KT-32992`](https://youtrack.jetbrains.com/issue/KT-32992) Enable assertions in Kotlin Compile Daemon +- [`KT-33027`](https://youtrack.jetbrains.com/issue/KT-33027) Compilation with daemon fails, because IncrementalModuleInfo#serialVersionUID does not match + +### Tools. CLI + +- [`KT-33177`](https://youtrack.jetbrains.com/issue/KT-33177) Introduce compiler flags -Xinline-classes and -Xpolymorphic-signature as a higher priority than -XXLanguage + +### Tools. Compiler Plugins + +- [`KT-28824`](https://youtrack.jetbrains.com/issue/KT-28824) Add jvm-abi-gen-embeddable for use with embeddable compiler +- [`KT-31279`](https://youtrack.jetbrains.com/issue/KT-31279) JPS build with compiler plugin and "Keep compiler alive = No" fails with CCE: "Cannot cast NoArgComponentRegistrar to ComponentRegistrar" at ServiceLoaderLite.loadImplementations() +- [`KT-32346`](https://youtrack.jetbrains.com/issue/KT-32346) kotlinx.serialization: Performance problems with completion/intellisense + +### Tools. Gradle + +#### New Features + +- [`KT-26655`](https://youtrack.jetbrains.com/issue/KT-26655) Precise metadata publishing and consumption for new MPP +- [`KT-31018`](https://youtrack.jetbrains.com/issue/KT-31018) Gradle, JS: yarn +- [`KT-31703`](https://youtrack.jetbrains.com/issue/KT-31703) Gradle, JS: automatically download d.ts and generate kotlin/js external declarations using dukat +- [`KT-31890`](https://youtrack.jetbrains.com/issue/KT-31890) Gradle, JS, webpack: provide property with full bundle file path +- [`KT-32015`](https://youtrack.jetbrains.com/issue/KT-32015) Gradle, JS: resolve configuration only while executing tasks of specific projects +- [`KT-32136`](https://youtrack.jetbrains.com/issue/KT-32136) Gradle, test runner: handle case when test runtime exits abnormally +- [`KT-26256`](https://youtrack.jetbrains.com/issue/KT-26256) In new MPP, support Java compilation in JVM targets +- [`KT-30573`](https://youtrack.jetbrains.com/issue/KT-30573) Gradle, JS: enable source maps by default, change paths relative to node_modules directory +- [`KT-30747`](https://youtrack.jetbrains.com/issue/KT-30747) Gradle, JS tests: provide option to disable test configuration per target +- [`KT-31010`](https://youtrack.jetbrains.com/issue/KT-31010) Gradle, JS tests: Mocha +- [`KT-31011`](https://youtrack.jetbrains.com/issue/KT-31011) Gradle, JS tests: Karma +- [`KT-31013`](https://youtrack.jetbrains.com/issue/KT-31013) Gradle, JS: Webpack +- [`KT-31016`](https://youtrack.jetbrains.com/issue/KT-31016) Gradle: yarn downloading +- [`KT-31017`](https://youtrack.jetbrains.com/issue/KT-31017) Gradle, yarn: support workspaces +- [`KT-31697`](https://youtrack.jetbrains.com/issue/KT-31697) Gradle, NPM: report about clashes in packages_imported + +#### Performance Improvements + +- [`KT-29538`](https://youtrack.jetbrains.com/issue/KT-29538) AndroidSubPlugin#getCommonResDirectories is very slow + +#### Fixes + +- [`KT-29343`](https://youtrack.jetbrains.com/issue/KT-29343) Kotlin MPP source set dependencies are not properly propagated to tests in Android projects +- [`KT-30691`](https://youtrack.jetbrains.com/issue/KT-30691) Gradle, JS tests: Parent operation with id 947 not available when all tests passed +- [`KT-31917`](https://youtrack.jetbrains.com/issue/KT-31917) Gradle, JS: transitive dependency between compilations in same project doesn't work +- [`KT-31985`](https://youtrack.jetbrains.com/issue/KT-31985) Gradle, JS: webpack not working on windows +- [`KT-32072`](https://youtrack.jetbrains.com/issue/KT-32072) Gradle, JS: browser() in DSL triggers project.evaluate() +- [`KT-32204`](https://youtrack.jetbrains.com/issue/KT-32204) In an MPP, a dependency that is added to a non-root source set is incorrectly analyzed for source sets visibility +- [`KT-32225`](https://youtrack.jetbrains.com/issue/KT-32225) In an MPP, if a dependency is added to a source set that does not take part in published compilations, it is not correctly analyzed in source set visibility inference +- [`KT-32564`](https://youtrack.jetbrains.com/issue/KT-32564) Provide a flag to enable/disable hierarchical multiplatform mechanism in Gradle +- [`KT-31023`](https://youtrack.jetbrains.com/issue/KT-31023) Update Gradle module metadata warning in MPP publishing +- [`KT-31696`](https://youtrack.jetbrains.com/issue/KT-31696) Gradle, NPM: select one version between tools and all of compile configurations +- [`KT-31891`](https://youtrack.jetbrains.com/issue/KT-31891) Gradle: JS or Native tests execution: `build --scan` fails with ISE "Expected attachment of type ... but did not find it" +- [`KT-32210`](https://youtrack.jetbrains.com/issue/KT-32210) Kapt randomly fails with java.io.UTFDataFormatException +- [`KT-32706`](https://youtrack.jetbrains.com/issue/KT-32706) Gradle target "jsBrowserWebpack" should use output of JS compile task as input +- [`KT-32697`](https://youtrack.jetbrains.com/issue/KT-32697) [Tests] org.jetbrains.kotlin.gradle.SubpluginsIT +- [`KT-33246`](https://youtrack.jetbrains.com/issue/KT-33246) Kotlin JS & Native tests + Gradle 5.6: No value has been specified for property 'binaryResultsDirectory' + + +### Tools. Incremental Compile + +- [`KT-31310`](https://youtrack.jetbrains.com/issue/KT-31310) Incremental build of Kotlin/JS project fails with KNPE at IncrementalJsCache.nonDirtyPackageParts() + +### Tools. J2K + +#### New Features + +- [`KT-30776`](https://youtrack.jetbrains.com/issue/KT-30776) New J2K +- [`KT-31836`](https://youtrack.jetbrains.com/issue/KT-31836) Suggest user to configure Kotlin in the project when running new J2K file conversion +- [`KT-32512`](https://youtrack.jetbrains.com/issue/KT-32512) ReplaceJavaStaticMethodWithKotlinAnalogInspection: add more cases for java.util.Arrays + +#### Fixes + +- [`KT-15791`](https://youtrack.jetbrains.com/issue/KT-15791) J2K converts class literals including redundant generic <*> +- [`KT-31234`](https://youtrack.jetbrains.com/issue/KT-31234) New J2K: Exception occurs on converting Java class to Kotlin +- [`KT-31250`](https://youtrack.jetbrains.com/issue/KT-31250) J2K: caret position of original file is preserved, adding spaces to resulting file +- [`KT-31251`](https://youtrack.jetbrains.com/issue/KT-31251) J2K: Java class with members is converted to Kotlin class with `final` constructor +- [`KT-31252`](https://youtrack.jetbrains.com/issue/KT-31252) J2K: resulted file is not formatted +- [`KT-31254`](https://youtrack.jetbrains.com/issue/KT-31254) J2K: resulted source uses full qualified references instead of imports +- [`KT-31255`](https://youtrack.jetbrains.com/issue/KT-31255) J2K: redundant modifiers in resulted source +- [`KT-31726`](https://youtrack.jetbrains.com/issue/KT-31726) New J2K converts annotation with array parameter to single value parameter +- [`KT-31809`](https://youtrack.jetbrains.com/issue/KT-31809) "Attempt to modify PSI for non-committed Document!" exception and broken kotlin file after new J2K conversion +- [`KT-31821`](https://youtrack.jetbrains.com/issue/KT-31821) J2K: IDEA Ultimate: local variable: CCE: "PsiLocalVariableImpl cannot be cast to class JvmAnnotatedElement" at JavaToJKTreeBuilder$DeclarationMapper.toJK() +- [`KT-32436`](https://youtrack.jetbrains.com/issue/KT-32436) NewJ2K generic field is not initialized after convertion +- [`KT-19327`](https://youtrack.jetbrains.com/issue/KT-19327) Java to Kotlin converter fails to convert code using Java 8 Stream API +- [`KT-21467`](https://youtrack.jetbrains.com/issue/KT-21467) Convert To Kotlin fails when using chained stream.flatmap methods +- [`KT-24677`](https://youtrack.jetbrains.com/issue/KT-24677) j2k creates nullable type for child function but keeps not null type for parent function +- [`KT-32572`](https://youtrack.jetbrains.com/issue/KT-32572) New J2K: Map with complex type as parameter is wrongly converted +- [`KT-32602`](https://youtrack.jetbrains.com/issue/KT-32602) J2K: no conversion of `String.length()` method call to property access of existing String property +- [`KT-32604`](https://youtrack.jetbrains.com/issue/KT-32604) kotlin.NotImplementedError exception occurs on converting Java call of toString method of data class to Kotlin +- [`KT-32609`](https://youtrack.jetbrains.com/issue/KT-32609) New J2K: Comparable class is wrongly converted to Kotlin if parameter of compareTo marked with @NotNull annotation +- [`KT-32693`](https://youtrack.jetbrains.com/issue/KT-32693) New J2K is throwing „Read access is allowed from event dispatch thread or inside read-action only“ on converting Java code inside Evaluate Expression window +- [`KT-32702`](https://youtrack.jetbrains.com/issue/KT-32702) New J2K: lambda with method reference is converted to lamdba with excessive parameter declaration +- [`KT-32835`](https://youtrack.jetbrains.com/issue/KT-32835) New J2K: NumberFormatException occurs on converting binary literals +- [`KT-32837`](https://youtrack.jetbrains.com/issue/KT-32837) J2K: NumberFormatException occurs on converting literals with underscore characters +- [`KT-22412`](https://youtrack.jetbrains.com/issue/KT-22412) J2K: Intention to replace if(...) throw IAE with require +- [`KT-33371`](https://youtrack.jetbrains.com/issue/KT-33371) Add an ability to switch between old and new J2K via settings window +- [`KT-32863`](https://youtrack.jetbrains.com/issue/KT-32863) New J2K: IllegalArgumentException occurs on Kotlin configuration in java project in Android Studio + +### Tools. JPS + +- [`KT-27181`](https://youtrack.jetbrains.com/issue/KT-27181) Compiler arguments are listed twice on JPS build of Gradle-based project +- [`KT-13563`](https://youtrack.jetbrains.com/issue/KT-13563) Kotlin jps-plugin should allow to instrument bytecode from Intellij IDEA. + +### Tools. REPL + +- [`KT-15125`](https://youtrack.jetbrains.com/issue/KT-15125) Support JSR 223 bindings directly via script variables +- [`KT-32085`](https://youtrack.jetbrains.com/issue/KT-32085) Kotlinc REPL: "java.lang.NoClassDefFoundError: org/jline/reader/LineReaderBuilder" + +### Tools. Scripts + +- [`KT-28137`](https://youtrack.jetbrains.com/issue/KT-28137) Implement result/return value for the regular (non-REPL) scripts + +### Tools. kapt + +- [`KT-30578`](https://youtrack.jetbrains.com/issue/KT-30578) `build/generated/source/kaptKotlin` is added as source directory to `main` instead of `jvmMain` when jvm { withJava() } is configured in a multiplatform project +- [`KT-30739`](https://youtrack.jetbrains.com/issue/KT-30739) Kapt generated sources are not visible from the IDE when "Create separate module per source set" is disabled +- [`KT-31127`](https://youtrack.jetbrains.com/issue/KT-31127) Kotlin-generating processor which uses Filer API breaks JavaCompile task +- [`KT-31378`](https://youtrack.jetbrains.com/issue/KT-31378) v1.3.31: NoSuchElementException in kapt when kapt.incremental.apt=true +- [`KT-32535`](https://youtrack.jetbrains.com/issue/KT-32535) Kapt aptMode=compile don't include files generated at `kapt.kotlin.generated` as sources to compile +- [`KT-31471`](https://youtrack.jetbrains.com/issue/KT-31471) KAPT prints "IncrementalProcessor" instead of processor name in verbose mode + +## 1.3.41 + +### Compiler + +- [`KT-31981`](https://youtrack.jetbrains.com/issue/KT-31981) New type inference asks to use ?. on non-null local variable +- [`KT-32029`](https://youtrack.jetbrains.com/issue/KT-32029) Exception when callable reference is resolved against unresolved type +- [`KT-32037`](https://youtrack.jetbrains.com/issue/KT-32037) No coercion to Unit for last expression with lambda in code block +- [`KT-32038`](https://youtrack.jetbrains.com/issue/KT-32038) Unsubstituted stub type cause type mismatch later for builder inference +- [`KT-32051`](https://youtrack.jetbrains.com/issue/KT-32051) NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER on matching Nothing with generic type parameter +- [`KT-32081`](https://youtrack.jetbrains.com/issue/KT-32081) New type inference fails involving Either and Nothing +- [`KT-32089`](https://youtrack.jetbrains.com/issue/KT-32089) False positive IMPLICIT_NOTHING_AS_TYPE_PARAMETER with lambdas +- [`KT-32094`](https://youtrack.jetbrains.com/issue/KT-32094) NI: member from star import has higher resolution priority than member imported by FQN +- [`KT-32116`](https://youtrack.jetbrains.com/issue/KT-32116) Type inference for HashMap<*,*> fails but compiles +- [`KT-32123`](https://youtrack.jetbrains.com/issue/KT-32123) Wrong unused import for extension method +- [`KT-32133`](https://youtrack.jetbrains.com/issue/KT-32133) Regression in Kotlin 1.3.40 new inference engine +- [`KT-32134`](https://youtrack.jetbrains.com/issue/KT-32134) `java.lang.Throwable: Resolution error of this type shouldn't occur for resolve try as a call` for incomplete try-construction +- [`KT-32143`](https://youtrack.jetbrains.com/issue/KT-32143) 1.3.40 new inference: backward incompatibility in method calls with multiple SAM arguments +- [`KT-32154`](https://youtrack.jetbrains.com/issue/KT-32154) setOf(Map.Entry<*, *>::key) gives error on IDE +- [`KT-32157`](https://youtrack.jetbrains.com/issue/KT-32157) Issue with new type inference in unbounded generics +- [`KT-32175`](https://youtrack.jetbrains.com/issue/KT-32175) New Type Inference Algorithm, RxJava and IDE-Compiler Inconsistency +- [`KT-32184`](https://youtrack.jetbrains.com/issue/KT-32184) NI: Argument for @NotNull parameter 'type' of org/jetbrains/kotlin/types/CommonSupertypes.depth must not be null +- [`KT-32187`](https://youtrack.jetbrains.com/issue/KT-32187) Exception when using callable reference with an unresolved LHS +- [`KT-32218`](https://youtrack.jetbrains.com/issue/KT-32218) Cannot call get on a Map with new type system +- [`KT-32230`](https://youtrack.jetbrains.com/issue/KT-32230) New inference not working with RxJava combineLatest +- [`KT-32235`](https://youtrack.jetbrains.com/issue/KT-32235) New type inference failure with `in` check + +### JavaScript + +- [`KT-32215`](https://youtrack.jetbrains.com/issue/KT-32215) Reified generic doesn't work with `ByteArray` on js + +### Tools. CLI + +- [`KT-32272`](https://youtrack.jetbrains.com/issue/KT-32272) kotlinc - no main manifest attribute, in hello.jar + +### Tools. REPL + +- [`KT-32085`](https://youtrack.jetbrains.com/issue/KT-32085) Kotlinc REPL: "java.lang.NoClassDefFoundError: org/jline/reader/LineReaderBuilder" + +### Tools. Scripts + +- [`KT-32169`](https://youtrack.jetbrains.com/issue/KT-32169) Kotlin 1.3.40 - Crash on running *.main.kts script: "NoSuchMethodError: kotlin.script.templates.standard.ScriptTemplateWithArgs." +- [`KT-32206`](https://youtrack.jetbrains.com/issue/KT-32206) Custom script definitions not loaded in the cli compiler + +## 1.3.40 + +### Android + +#### Fixes + +- [`KT-12402`](https://youtrack.jetbrains.com/issue/KT-12402) Android DataBinding work correctly but the IDE show it as error +- [`KT-31432`](https://youtrack.jetbrains.com/issue/KT-31432) Remove obsolete code introduced in KT-12402 + +### Compiler + +#### New Features + +- [`KT-29915`](https://youtrack.jetbrains.com/issue/KT-29915) Implement `typeOf` on JVM +- [`KT-30467`](https://youtrack.jetbrains.com/issue/KT-30467) Provide a way to to save compiled script(s) as a jar + +#### Performance Improvements + +- [`KT-17755`](https://youtrack.jetbrains.com/issue/KT-17755) Optimize trimIndent and trimMargin on constant strings +- [`KT-30603`](https://youtrack.jetbrains.com/issue/KT-30603) Compiler performance issue: VariableLivenessKt.useVar performance + +#### Fixes + +- [`KT-19227`](https://youtrack.jetbrains.com/issue/KT-19227) Load built-ins from dependencies by default in the compiler, support erroneous "fallback" built-ins +- [`KT-23426`](https://youtrack.jetbrains.com/issue/KT-23426) Actual typealias to Java enum does not match expected enum because of modality +- [`KT-23854`](https://youtrack.jetbrains.com/issue/KT-23854) Inference for common type of two captured types +- [`KT-25105`](https://youtrack.jetbrains.com/issue/KT-25105) False-positive warning "Remove final upper bound" on generic override +- [`KT-25302`](https://youtrack.jetbrains.com/issue/KT-25302) New inference: "Type mismatch" between star projection and `Any?` type argument in specific case +- [`KT-25433`](https://youtrack.jetbrains.com/issue/KT-25433) Wrong order of fixing type variables for callable references +- [`KT-26386`](https://youtrack.jetbrains.com/issue/KT-26386) Front-end recursion problem while analyzing contract function with call expression of self in implies +- [`KT-26412`](https://youtrack.jetbrains.com/issue/KT-26412) Wrong LVT generated if decomposed parameter of suspend lambda is not the first parameter. +- [`KT-27097`](https://youtrack.jetbrains.com/issue/KT-27097) JvmMultifileClass + JvmName causes NoSuchMethodError on sealed class hierarchy for top-level members +- [`KT-28534`](https://youtrack.jetbrains.com/issue/KT-28534) Local variable entries are missing in LVT for suspend lambda parameters +- [`KT-28535`](https://youtrack.jetbrains.com/issue/KT-28535) Rename `result` to `$result` in coroutines' LVT +- [`KT-29184`](https://youtrack.jetbrains.com/issue/KT-29184) Implement inference for coroutines according to the @BuilderInference contract in NI +- [`KT-29772`](https://youtrack.jetbrains.com/issue/KT-29772) Contracts don't work if `contract` function is fully qualified (FQN) +- [`KT-29790`](https://youtrack.jetbrains.com/issue/KT-29790) Incorrect version requirement in metadata of anonymous class for suspend lambda +- [`KT-29948`](https://youtrack.jetbrains.com/issue/KT-29948) NI: incorrect DSLMarker behaviour with generic star projection +- [`KT-30021`](https://youtrack.jetbrains.com/issue/KT-30021) +NewInference on Kotlin Native :: java.lang.StackOverflowError +- [`KT-30242`](https://youtrack.jetbrains.com/issue/KT-30242) Statements are not coerced to Unit in last expressions of lambda +- [`KT-30243`](https://youtrack.jetbrains.com/issue/KT-30243) Include FIR modules into compiler +- [`KT-30250`](https://youtrack.jetbrains.com/issue/KT-30250) Rewrite at slice exception for callable reference argument inside delegated expression +- [`KT-30292`](https://youtrack.jetbrains.com/issue/KT-30292) Reference to function is unresolved when LHS is a star-projected type +- [`KT-30293`](https://youtrack.jetbrains.com/issue/KT-30293) Wrong intersection type for common supertype from String and integer type +- [`KT-30370`](https://youtrack.jetbrains.com/issue/KT-30370) Call is completed too early when there is "Nothing" constraint +- [`KT-30405`](https://youtrack.jetbrains.com/issue/KT-30405) Support expected type from cast in new inference +- [`KT-30406`](https://youtrack.jetbrains.com/issue/KT-30406) Fix testIfOrWhenSpecialCall test for new inference +- [`KT-30590`](https://youtrack.jetbrains.com/issue/KT-30590) Report diagnostic about not enough information for inference in NI +- [`KT-30620`](https://youtrack.jetbrains.com/issue/KT-30620) Exception from the compiler when coroutine-inference is involved even with the explicitly specified types +- [`KT-30656`](https://youtrack.jetbrains.com/issue/KT-30656) Exception is occurred when functions with implicit return-stub types are involved in builder-inference +- [`KT-30658`](https://youtrack.jetbrains.com/issue/KT-30658) Exception from the compiler when getting callable reference to a suspend function +- [`KT-30661`](https://youtrack.jetbrains.com/issue/KT-30661) Disable SAM conversions to Kotlin functions in new-inference by default +- [`KT-30676`](https://youtrack.jetbrains.com/issue/KT-30676) Overload resolution ambiguity when there is a callable reference argument and candidates with different functional return types +- [`KT-30694`](https://youtrack.jetbrains.com/issue/KT-30694) No debug metadata is generated for suspend lambdas which capture crossinline +- [`KT-30724`](https://youtrack.jetbrains.com/issue/KT-30724) False positive error about missing equals when one of the operands is incorrectly inferred to Nothing +- [`KT-30734`](https://youtrack.jetbrains.com/issue/KT-30734) No smartcast inside lambda literal in then/else "if" branch +- [`KT-30737`](https://youtrack.jetbrains.com/issue/KT-30737) Try analysing callable reference preemptively +- [`KT-30780`](https://youtrack.jetbrains.com/issue/KT-30780) Compiler crashes on 'private inline' function accessing private constant in 'inline class' (regression) +- [`KT-30808`](https://youtrack.jetbrains.com/issue/KT-30808) NI: False negative SPREAD_OF_NULLABLE with USELESS_ELVIS_RIGHT_IS_NULL +- [`KT-30816`](https://youtrack.jetbrains.com/issue/KT-30816) BasicJvmScriptEvaluator passes constructor parameters in incorrect order +- [`KT-30826`](https://youtrack.jetbrains.com/issue/KT-30826) There isn't report about unsafe call in the new inference (by invalidating smartcast), NPE +- [`KT-30843`](https://youtrack.jetbrains.com/issue/KT-30843) Duplicate JVM class name for expect/actual classes in JvmMultifileClass-annotated file +- [`KT-30853`](https://youtrack.jetbrains.com/issue/KT-30853) Compiler crashes with NewInference and Kotlinx.Coroutines Flow +- [`KT-30927`](https://youtrack.jetbrains.com/issue/KT-30927) Data flow info isn't used for 'this' which is returned from lambda using labeled return +- [`KT-31081`](https://youtrack.jetbrains.com/issue/KT-31081) Implement ArgumentMatch abstraction in new inference +- [`KT-31113`](https://youtrack.jetbrains.com/issue/KT-31113) Fix failing tests from SlicerTestGenerated +- [`KT-31199`](https://youtrack.jetbrains.com/issue/KT-31199) Unresolved callable references with typealias +- [`KT-31339`](https://youtrack.jetbrains.com/issue/KT-31339) Inliner does not remove redundant continuation classes, leading to CNFE in JMH bytecode processing +- [`KT-31346`](https://youtrack.jetbrains.com/issue/KT-31346) Fix diagnostic DSL_SCOPE_VIOLATION for new inference +- [`KT-31356`](https://youtrack.jetbrains.com/issue/KT-31356) False-positive error about violating dsl scope for new-inference +- [`KT-31360`](https://youtrack.jetbrains.com/issue/KT-31360) NI: inconsistently prohibits member usage without explicit receiver specification with star projection and DSL marker +- [`KT-18563`](https://youtrack.jetbrains.com/issue/KT-18563) Do not generate inline reified functions as private in bytecode +- [`KT-20849`](https://youtrack.jetbrains.com/issue/KT-20849) Inference results in Nothing type argument in case of passing 'out T' to 'in T1' +- [`KT-25290`](https://youtrack.jetbrains.com/issue/KT-25290) New inference: KNPE at ResolutionPartsKt.getExpectedTypeWithSAMConversion() on out projection of Java class +- [`KT-26418`](https://youtrack.jetbrains.com/issue/KT-26418) Back-end (JVM) Internal error when compiling decorated suspend inline functions +- [`KT-26925`](https://youtrack.jetbrains.com/issue/KT-26925) Decorated suspend inline function continuation resumes in wrong spot +- [`KT-28999`](https://youtrack.jetbrains.com/issue/KT-28999) Prohibit type parameters for anonymous objects +- [`KT-29307`](https://youtrack.jetbrains.com/issue/KT-29307) New inference: false negative CONSTANT_EXPECTED_TYPE_MISMATCH with a Map +- [`KT-29475`](https://youtrack.jetbrains.com/issue/KT-29475) IllegalArgumentException at getAbstractTypeFromDescriptor with deeply nested expression inside function named with a right parenthesis +- [`KT-29996`](https://youtrack.jetbrains.com/issue/KT-29996) Properly report errors on attempt to inline bytecode from class files compiled to 1.8 to one compiling to 1.6 +- [`KT-30289`](https://youtrack.jetbrains.com/issue/KT-30289) Don't generate annotations on synthetic methods for methods with default values for parameters +- [`KT-30410`](https://youtrack.jetbrains.com/issue/KT-30410) [NI] Front-end recursion problem while analyzing contract function with call expression of self in implies +- [`KT-30411`](https://youtrack.jetbrains.com/issue/KT-30411) Fold recursive types to star-projected ones when inferring type variables +- [`KT-30706`](https://youtrack.jetbrains.com/issue/KT-30706) Passing noinline lambda as (cross)inline parameter result in wrong state-machine +- [`KT-30707`](https://youtrack.jetbrains.com/issue/KT-30707) Java interop of coroutines inside inline functions is broken +- [`KT-30983`](https://youtrack.jetbrains.com/issue/KT-30983) ClassCastException: DeserializedTypeAliasDescriptor cannot be cast to PackageViewDescriptor on star-import of expect enum class actualized with typealias +- [`KT-31242`](https://youtrack.jetbrains.com/issue/KT-31242) "Can't find enclosing method" proguard compilation exception with inline and crossinline +- [`KT-31347`](https://youtrack.jetbrains.com/issue/KT-31347) "IndexOutOfBoundsException: Insufficient maximum stack size" with crossinline and suspend +- [`KT-31354`](https://youtrack.jetbrains.com/issue/KT-31354) Suspend inline functions with crossinline parameters are inaccessible from java +- [`KT-31367`](https://youtrack.jetbrains.com/issue/KT-31367) IllegalStateException: Concrete fake override public open fun (...) defined in TheIssue[PropertyGetterDescriptorImpl@1a03c376] should have exactly one concrete super-declaration: [] +- [`KT-31461`](https://youtrack.jetbrains.com/issue/KT-31461) NI: NONE_APPLICABLE instead of TYPE_MISMATCH when invoking convention plus operator +- [`KT-31503`](https://youtrack.jetbrains.com/issue/KT-31503) Type mismatch with recursive types and SAM conversions +- [`KT-31507`](https://youtrack.jetbrains.com/issue/KT-31507) Enable new type inference algorithm for IDE analysis +- [`KT-31514`](https://youtrack.jetbrains.com/issue/KT-31514) New inference generates multiple errors on generic inline expression with elvis operator +- [`KT-31520`](https://youtrack.jetbrains.com/issue/KT-31520) False positive "not enough information" for constraint with star projection and covariant type +- [`KT-31606`](https://youtrack.jetbrains.com/issue/KT-31606) Rewrite at slice on using callable reference with array access operator +- [`KT-31620`](https://youtrack.jetbrains.com/issue/KT-31620) False-positive "not enough information" for coroutine-inference when target method is assigned to a variable +- [`KT-31624`](https://youtrack.jetbrains.com/issue/KT-31624) Type from declared upper bound in Java is considered more specific than Nothing producing type mismatch later +- [`KT-31860`](https://youtrack.jetbrains.com/issue/KT-31860) Explicit type argument isn't considered as input type causing errors about "only input types" +- [`KT-31866`](https://youtrack.jetbrains.com/issue/KT-31866) Problems with using star-projections on LHS of callable reference +- [`KT-31868`](https://youtrack.jetbrains.com/issue/KT-31868) No type mismatch error when using NoInfer annotation +- [`KT-31941`](https://youtrack.jetbrains.com/issue/KT-31941) Good code red in IDE with smart cast on parameter of a generic type after null check + +### IDE + +#### New Features + +- [`KT-11242`](https://youtrack.jetbrains.com/issue/KT-11242) Action to copy project diagnostic information to clipboard +- [`KT-24292`](https://youtrack.jetbrains.com/issue/KT-24292) Support external nullability annotations +- [`KT-30453`](https://youtrack.jetbrains.com/issue/KT-30453) Add plugin option (registry?) to enable new inference only in IDE + +#### Performance Improvements + +- [`KT-13841`](https://youtrack.jetbrains.com/issue/KT-13841) Classes and functions should be lazy-parseable +- [`KT-27106`](https://youtrack.jetbrains.com/issue/KT-27106) Performance issue with optimize imports +- [`KT-30442`](https://youtrack.jetbrains.com/issue/KT-30442) Several second lag on project open in KotlinNonJvmSourceRootConverterProvider +- [`KT-30644`](https://youtrack.jetbrains.com/issue/KT-30644) ConfigureKotlinInProjectUtilsKt freezes UI + +#### Fixes + +- [`KT-7380`](https://youtrack.jetbrains.com/issue/KT-7380) Imports insertion on paste does not work correctly when there were alias imports in the source file +- [`KT-10512`](https://youtrack.jetbrains.com/issue/KT-10512) Do not delete imports with unresolved parts when optimizing +- [`KT-13048`](https://youtrack.jetbrains.com/issue/KT-13048) "Strip trailing spaces on Save" should not strip trailing spaces inside multiline strings in Kotlin +- [`KT-17375`](https://youtrack.jetbrains.com/issue/KT-17375) Optimize Imports does not remove unused import alias +- [`KT-27385`](https://youtrack.jetbrains.com/issue/KT-27385) Uast: property references should resolve to getters/setters +- [`KT-28627`](https://youtrack.jetbrains.com/issue/KT-28627) Invalid detection of Kotlin jvmTarget inside Idea/gradle build +- [`KT-29267`](https://youtrack.jetbrains.com/issue/KT-29267) Enable ultra-light classes by default +- [`KT-29892`](https://youtrack.jetbrains.com/issue/KT-29892) A lot of threads are waiting in KotlinConfigurationCheckerComponent +- [`KT-30356`](https://youtrack.jetbrains.com/issue/KT-30356) Kotlin facet: all JVM 9+ target platforms are shown as "Target Platform = JVM 9" in Project Structure dialog +- [`KT-30514`](https://youtrack.jetbrains.com/issue/KT-30514) Auto-import with "Add unambiguous imports on the fly" imports enum members from another package +- [`KT-30583`](https://youtrack.jetbrains.com/issue/KT-30583) Kotlin light elements should be `isEquivalentTo` to it's origins +- [`KT-30688`](https://youtrack.jetbrains.com/issue/KT-30688) Memory leak in the PerModulePackageCacheService.onTooComplexChange method +- [`KT-30949`](https://youtrack.jetbrains.com/issue/KT-30949) Optimize Imports removes used import alias +- [`KT-30957`](https://youtrack.jetbrains.com/issue/KT-30957) Kotlin UAST: USimpleNameReferenceExpression in "imports" for class' member resolves incorrectly to class, not to the member +- [`KT-31090`](https://youtrack.jetbrains.com/issue/KT-31090) java.lang.NoSuchMethodError: org.jetbrains.kotlin.idea.UtilsKt.addModuleDependencyIfNeeded on import of a multiplatform project with Android target (191 IDEA + master) +- [`KT-31092`](https://youtrack.jetbrains.com/issue/KT-31092) Don't check all selected files in CheckComponentsUsageSearchAction.update() +- [`KT-31319`](https://youtrack.jetbrains.com/issue/KT-31319) False positive "Unused import" for `provideDelegate` extension +- [`KT-31332`](https://youtrack.jetbrains.com/issue/KT-31332) Kotlin AnnotatedElementsSearch does't support Kotlin `object` +- [`KT-31129`](https://youtrack.jetbrains.com/issue/KT-31129) Call only Kotlin-specific reference contributors for getting Kotlin references from PSI +- [`KT-31693`](https://youtrack.jetbrains.com/issue/KT-31693) Project with no Kotlin: JPS rebuild fails with NCDFE for GradleSettingsService at KotlinMPPGradleProjectTaskRunner.canRun() +- [`KT-31466`](https://youtrack.jetbrains.com/issue/KT-31466) SOE in Java highlighting when a Kotlin ultra-light method is invoked +- [`KT-31723`](https://youtrack.jetbrains.com/issue/KT-31723) Exception from UAST for attempt to infer types inside unresolved call +- [`KT-31842`](https://youtrack.jetbrains.com/issue/KT-31842) UOE: no descriptor for type constructor of TypeVariable(T) +- [`KT-31992`](https://youtrack.jetbrains.com/issue/KT-31992) Fix ColorsIcon.scale(float) compatibility issue between IU-192.5118.30 and 1.3.40-eap-105 + +### IDE. Completion + +- [`KT-29038`](https://youtrack.jetbrains.com/issue/KT-29038) Autocomplete "suspend" into "suspend fun" at top level and class level (except in kts top level) +- [`KT-29398`](https://youtrack.jetbrains.com/issue/KT-29398) Add "arg" postfix template +- [`KT-30511`](https://youtrack.jetbrains.com/issue/KT-30511) Replace extra space after autocompleting data class with file name by parentheses + +### IDE. Debugger + +- [`KT-10636`](https://youtrack.jetbrains.com/issue/KT-10636) Debugger: can't evaluate call of function type parameter inside inline function +- [`KT-18247`](https://youtrack.jetbrains.com/issue/KT-18247) Debugger: class level watches fail to evaluate outside of class instance context +- [`KT-18263`](https://youtrack.jetbrains.com/issue/KT-18263) Settings / Debugger / Java Type Renderers: unqualified Kotlin class members in Java expressions are shown as errors +- [`KT-23586`](https://youtrack.jetbrains.com/issue/KT-23586) Non-trivial properties autocompletion in evaluation window +- [`KT-30216`](https://youtrack.jetbrains.com/issue/KT-30216) Evaluate expression: declarations annotated with Experimental (LEVEL.ERROR) fail due to compilation error +- [`KT-30610`](https://youtrack.jetbrains.com/issue/KT-30610) Debugger: Variables view shows second `this` instance for inline function even from the same class as caller function +- [`KT-30714`](https://youtrack.jetbrains.com/issue/KT-30714) Breakpoints are shown as invalid for classes that are not loaded yet +- [`KT-30934`](https://youtrack.jetbrains.com/issue/KT-30934) "InvocationException: Exception occurred in target VM" on debugger breakpoint hit (with kotlintest) +- [`KT-31266`](https://youtrack.jetbrains.com/issue/KT-31266) Kotlin debugger incompatibility with latest 192 nightly: KotlinClassWithDelegatedPropertyRenderer +- [`KT-31785`](https://youtrack.jetbrains.com/issue/KT-31785) Exception on attempt to evaluate local function + +### IDE. Gradle + +- [`KT-29854`](https://youtrack.jetbrains.com/issue/KT-29854) File collection dependency does not work with NMPP+JPS +- [`KT-30531`](https://youtrack.jetbrains.com/issue/KT-30531) Gradle: NodeJS downloading +- [`KT-30767`](https://youtrack.jetbrains.com/issue/KT-30767) Kotlin import uses too much memory when working with big projects +- [`KT-29564`](https://youtrack.jetbrains.com/issue/KT-29564) kotlin.parallel.tasks.in.project=true causes idea to create kotlin modules with target JVM 1.6 +- [`KT-31014`](https://youtrack.jetbrains.com/issue/KT-31014) Gradle, JS: Webpack watch mode +- [`KT-31843`](https://youtrack.jetbrains.com/issue/KT-31843) Memory leak caused by KOTLIN_TARGET_DATA_NODE on project reimport +- [`KT-31952`](https://youtrack.jetbrains.com/issue/KT-31952) Fix compatibility issues with IDEA after fixing IDEA-187832 + +### IDE. Gradle. Script + +- [`KT-30638`](https://youtrack.jetbrains.com/issue/KT-30638) "Highlighting in scripts is not available until all Script Dependencies are loaded" in Diff viewer +- [`KT-31124`](https://youtrack.jetbrains.com/issue/KT-31124) “compileKotlin - configuration not found: kotlinScriptDef, the plugin is probably applied by a mistake” after creating new project with IJ and Kotlin from master +- [`KT-30974`](https://youtrack.jetbrains.com/issue/KT-30974) Script dependencies resolution failed error while trying to use Kotlin for Gradle + +### IDE. Hints + +- [`KT-30057`](https://youtrack.jetbrains.com/issue/KT-30057) "View->Type info" shows "Type is unknown" for named argument syntax + +### IDE. Inspections and Intentions + +#### New Features + +- [`KT-11629`](https://youtrack.jetbrains.com/issue/KT-11629) Inspection: creating Throwable without throwing it +- [`KT-12392`](https://youtrack.jetbrains.com/issue/KT-12392) Unused import with alias should be highlighted and removed with Optimize Imports +- [`KT-12721`](https://youtrack.jetbrains.com/issue/KT-12721) inspection should be made for converting Integer.toString(int) to int.toString() +- [`KT-13962`](https://youtrack.jetbrains.com/issue/KT-13962) Intention to replace Java collection constructor calls with function calls from stdlib (ArrayList() → arrayListOf()) +- [`KT-15537`](https://youtrack.jetbrains.com/issue/KT-15537) Add inspection + intention to replace IntRange.start/endInclusive with first/last +- [`KT-21195`](https://youtrack.jetbrains.com/issue/KT-21195) ReplaceWith intention could save generic type arguments +- [`KT-25262`](https://youtrack.jetbrains.com/issue/KT-25262) Intention: Rename class to containing file name +- [`KT-25439`](https://youtrack.jetbrains.com/issue/KT-25439) Inspection "Map replaceable with EnumMap" +- [`KT-26269`](https://youtrack.jetbrains.com/issue/KT-26269) Inspection to replace associate with associateWith or associateBy +- [`KT-26629`](https://youtrack.jetbrains.com/issue/KT-26629) Inspection to replace `==` operator on Double.NaN with `equals` call +- [`KT-27411`](https://youtrack.jetbrains.com/issue/KT-27411) Inspection and Quickfix to replace System.exit() with exitProcess() +- [`KT-29344`](https://youtrack.jetbrains.com/issue/KT-29344) Convert property initializer to getter: suggest on property name +- [`KT-29666`](https://youtrack.jetbrains.com/issue/KT-29666) Quickfix for "DEPRECATED_JAVA_ANNOTATION": migrate arguments +- [`KT-29798`](https://youtrack.jetbrains.com/issue/KT-29798) Add 'Covariant equals' inspection +- [`KT-29799`](https://youtrack.jetbrains.com/issue/KT-29799) Inspection: class with non-null self-reference as a parameter in its primary constructor +- [`KT-30078`](https://youtrack.jetbrains.com/issue/KT-30078) Add "Add getter/setter" quick fix for uninitialized property +- [`KT-30381`](https://youtrack.jetbrains.com/issue/KT-30381) Inspection + quickfix to replace non-null assertion with return +- [`KT-30389`](https://youtrack.jetbrains.com/issue/KT-30389) Fix to convert argument to Int: suggest roundToInt() +- [`KT-30501`](https://youtrack.jetbrains.com/issue/KT-30501) Add inspection to replace filter { it is Foo } with filterIsInstance and filter { it != null } with filterNotNull +- [`KT-30612`](https://youtrack.jetbrains.com/issue/KT-30612) Unused symbol inspection should detect enum entry +- [`KT-30663`](https://youtrack.jetbrains.com/issue/KT-30663) Fully qualified name is added on quick fix for original class name if import alias exists +- [`KT-30725`](https://youtrack.jetbrains.com/issue/KT-30725) Inspection which replaces `.sorted().first()` with `.min()` + +#### Fixes + +- [`KT-5412`](https://youtrack.jetbrains.com/issue/KT-5412) "Replace non-null assertion with `if` expression" should replace parent expression +- [`KT-13549`](https://youtrack.jetbrains.com/issue/KT-13549) "Package directive doesn't match file location" for root package +- [`KT-14040`](https://youtrack.jetbrains.com/issue/KT-14040) Secondary enum class constructor is marked as "unused" by IDE +- [`KT-18459`](https://youtrack.jetbrains.com/issue/KT-18459) Spring: "Autowiring for Bean Class (Kotlin)" inspection adds not working `@Named` annotation to property +- [`KT-21526`](https://youtrack.jetbrains.com/issue/KT-21526) used class is marked as "never used" +- [`KT-22896`](https://youtrack.jetbrains.com/issue/KT-22896) "Change function signature" quickfix on "x overrides nothing" doesn't rename type arguments +- [`KT-27089`](https://youtrack.jetbrains.com/issue/KT-27089) ReplaceWith quickfix doesn't take into account generic parameter +- [`KT-27821`](https://youtrack.jetbrains.com/issue/KT-27821) SimplifiableCallChain inspection quick fix removes comments for intermediate operations +- [`KT-28485`](https://youtrack.jetbrains.com/issue/KT-28485) Incorrect parameter name after running "Add parameter to function" intention when argument variable is upper case const +- [`KT-28619`](https://youtrack.jetbrains.com/issue/KT-28619) "Add braces to 'if' statement" moves end-of-line comment inside an `if` branch if statement inside `if` is block +- [`KT-29556`](https://youtrack.jetbrains.com/issue/KT-29556) "Remove redundant 'let' call" doesn't rename parameter with convention `invoke` call +- [`KT-29677`](https://youtrack.jetbrains.com/issue/KT-29677) "Specify type explicitly" intention produces invalid output for type escaped with backticks +- [`KT-29764`](https://youtrack.jetbrains.com/issue/KT-29764) "Convert property to function" intention doesn't warn about the property overloads at child class constructor +- [`KT-29812`](https://youtrack.jetbrains.com/issue/KT-29812) False positive for HasPlatformType with member extension on 'dynamic' +- [`KT-29869`](https://youtrack.jetbrains.com/issue/KT-29869) 'WhenWithOnlyElse': possibly useless inspection with false grey warning highlighting during editing the code +- [`KT-30038`](https://youtrack.jetbrains.com/issue/KT-30038) 'Remove redundant Unit" false positive when return type is nullable Unit +- [`KT-30082`](https://youtrack.jetbrains.com/issue/KT-30082) False positive "redundant `.let` call" for lambda functions stored in nullable references +- [`KT-30173`](https://youtrack.jetbrains.com/issue/KT-30173) "Nested lambda has shadowed implicit parameter" is suggested when both parameters are logically the same +- [`KT-30208`](https://youtrack.jetbrains.com/issue/KT-30208) Convert to anonymous object: lambda generic type argument is lost +- [`KT-30215`](https://youtrack.jetbrains.com/issue/KT-30215) No "surround with null" check is suggested for an assignment +- [`KT-30228`](https://youtrack.jetbrains.com/issue/KT-30228) 'Convert to also/apply/run/with' intention behaves differently depending on the position of infix function call +- [`KT-30457`](https://youtrack.jetbrains.com/issue/KT-30457) MoveVariableDeclarationIntoWhen: do not report gray warning on variable declarations taking multiple lines / containing preemptive returns +- [`KT-30481`](https://youtrack.jetbrains.com/issue/KT-30481) Do not report ImplicitNullableNothingType on a function/property that overrides a function/property of type 'Nothing?' +- [`KT-30527`](https://youtrack.jetbrains.com/issue/KT-30527) False positive "Type alias is never used" with import of enum member +- [`KT-30559`](https://youtrack.jetbrains.com/issue/KT-30559) Redundant Getter, Redundant Setter: reduce range to getter/setter header +- [`KT-30565`](https://youtrack.jetbrains.com/issue/KT-30565) False positive "Suspicious 'var' property" inspection with annotated default property getter +- [`KT-30579`](https://youtrack.jetbrains.com/issue/KT-30579) Kotlin-gradle groovy inspections should depend on Groovy plugin +- [`KT-30613`](https://youtrack.jetbrains.com/issue/KT-30613) "Convert to anonymous function" should not insert named argument when interoping with Java functions +- [`KT-30614`](https://youtrack.jetbrains.com/issue/KT-30614) String templates suggest removing curly braces for backtick escaped identifiers +- [`KT-30622`](https://youtrack.jetbrains.com/issue/KT-30622) Add names to call arguments starting from given argument +- [`KT-30637`](https://youtrack.jetbrains.com/issue/KT-30637) False positive "unused constructor" for local class +- [`KT-30669`](https://youtrack.jetbrains.com/issue/KT-30669) Import quick fix does not work for property/function with original name if import alias for them exist +- [`KT-30761`](https://youtrack.jetbrains.com/issue/KT-30761) Replace assert boolean with assert equality produces uncompilable code when compared arguments type are different +- [`KT-30769`](https://youtrack.jetbrains.com/issue/KT-30769) Override quickfix creates "sealed fun" +- [`KT-30833`](https://youtrack.jetbrains.com/issue/KT-30833) Exception after "Introduce Import Alias" if invoke in import +- [`KT-30876`](https://youtrack.jetbrains.com/issue/KT-30876) SimplifyNotNullAssert inspection changes semantics +- [`KT-30900`](https://youtrack.jetbrains.com/issue/KT-30900) Invert 'if' condition respects neither code formatting nor inline comments +- [`KT-30910`](https://youtrack.jetbrains.com/issue/KT-30910) "Use property access syntax" is not suitable as text for inspection problem text +- [`KT-30916`](https://youtrack.jetbrains.com/issue/KT-30916) Quickfix "Remove redundant qualifier name" can't work with user type with generic parameter +- [`KT-31103`](https://youtrack.jetbrains.com/issue/KT-31103) Don't invoke Gradle related inspections when Gradle plugin is disabled +- [`KT-31349`](https://youtrack.jetbrains.com/issue/KT-31349) Add name to argument should not be suggested for Java library classes +- [`KT-31404`](https://youtrack.jetbrains.com/issue/KT-31404) Redundant 'requireNotNull' or 'checkNotNull' inspection: don't remove first argument +- [`KT-25465`](https://youtrack.jetbrains.com/issue/KT-25465) "Redundant 'suspend' modifier" with suspend operator invoke +- [`KT-26337`](https://youtrack.jetbrains.com/issue/KT-26337) Exception (resource not found) in quick-fix tests in AS32 +- [`KT-30879`](https://youtrack.jetbrains.com/issue/KT-30879) False positive "Redundant qualifier name" +- [`KT-31415`](https://youtrack.jetbrains.com/issue/KT-31415) UI hangs due to long computations for "Use property access syntax" intention with new inference +- [`KT-31441`](https://youtrack.jetbrains.com/issue/KT-31441) False positive "Remove explicit type arguments" inspection for projection type +- [`KT-30970`](https://youtrack.jetbrains.com/issue/KT-30970) No warning for empty `if` operator and `also`method +- [`KT-31855`](https://youtrack.jetbrains.com/issue/KT-31855) IDE + new inference: Java SAM conversion is not suggested by IDE services + +### IDE. JS + +- [`KT-31895`](https://youtrack.jetbrains.com/issue/KT-31895) New Project wizard: Kotlin Gradle + Kotlin/JS for Node.js: incorrect DSL is inserted + +### IDE. Libraries + +- [`KT-30790`](https://youtrack.jetbrains.com/issue/KT-30790) Unstable IDE navigation behavior to `expect`/`actual` symbols in stdlib +- [`KT-30821`](https://youtrack.jetbrains.com/issue/KT-30821) K/N: Navigation downwards the hierarchy in stdlib source code opens to stubs + +### IDE. Misc + +- [`KT-31364`](https://youtrack.jetbrains.com/issue/KT-31364) IntelliJ routinely hangs and spikes CPU / Memory usage when editing kotlin files + +### IDE. Navigation + +- [`KT-18322`](https://youtrack.jetbrains.com/issue/KT-18322) Find Usages not finding Java usage of @JvmField declared in primary constructor +- [`KT-27332`](https://youtrack.jetbrains.com/issue/KT-27332) Gutter icons are still shown even if disabled + +### IDE. Refactorings + +- [`KT-30471`](https://youtrack.jetbrains.com/issue/KT-30471) Make `KotlinElementActionsFactory.createChangeParametersActions` able to just add parameters + +### IDE. Run Configurations + +- [`KT-29352`](https://youtrack.jetbrains.com/issue/KT-29352) Kotlin + Java 11 + Windows : impossible to run applications with long command lines, even with dynamic.classpath=true + +### IDE. Scratch + +- [`KT-29642`](https://youtrack.jetbrains.com/issue/KT-29642) Once hidden, `Scratch Output` window wouldn't show the results unless the project is reopened + +### IDE. Script + +- [`KT-30295`](https://youtrack.jetbrains.com/issue/KT-30295) Resolver for 'completion/highlighting in ScriptDependenciesSourceInfo...' does not know how to resolve [] or [Library(null)] +- [`KT-30690`](https://youtrack.jetbrains.com/issue/KT-30690) Highlighting for scripts in diff view doesn't work for left part +- [`KT-31452`](https://youtrack.jetbrains.com/issue/KT-31452) IDE editor: MISSING_SCRIPT_STANDARD_TEMPLATE is reported inconsistently with the single line in script + +### IDE. Tests Support + +- [`KT-30995`](https://youtrack.jetbrains.com/issue/KT-30995) Gradle test runner: "No tasks available" for a test class in non-MPP project + +### IDE. Ultimate + +- [`KT-30886`](https://youtrack.jetbrains.com/issue/KT-30886) KotlinIdeaResolutionException in Velocity template (.ft) with Kotlin code + +### IDE. Wizards + +- [`KT-30645`](https://youtrack.jetbrains.com/issue/KT-30645) Update New Project Wizard templates related to Kotlin/JS +- [`KT-31099`](https://youtrack.jetbrains.com/issue/KT-31099) Remove Gradle configuration boilerplate for JS from multiplatform New Project Wizard templates related to Kotlin/JS +- [`KT-31695`](https://youtrack.jetbrains.com/issue/KT-31695) Gradle, JS: update wizard templates + +### JS. Tools + +- [`KT-31563`](https://youtrack.jetbrains.com/issue/KT-31563) Gradle/JS: npmResolve fails with "Invalid version" when user project's version does not match npm rules +- [`KT-31566`](https://youtrack.jetbrains.com/issue/KT-31566) Gradle/JS: with explicit call to `nodejs { testTask { useNodeJs() } }` configuration fails : "Could not find which method to invoke" +- [`KT-31560`](https://youtrack.jetbrains.com/issue/KT-31560) Gradle: provide descriptions for JS tasks +- [`KT-31564`](https://youtrack.jetbrains.com/issue/KT-31564) Gradle/JS: npmResolve reports warning "karma-webpack@3.0.5 has unmet peer dependency" +- [`KT-31662`](https://youtrack.jetbrains.com/issue/KT-31662) Gradle/JS: with empty `useKarma {}` lambda the execution of `jsBrowserTest` never stops +- [`KT-31686`](https://youtrack.jetbrains.com/issue/KT-31686) Gradle/JS: useKarma { useConfigDirectory() } fails to configure +- [`KT-31694`](https://youtrack.jetbrains.com/issue/KT-31694) Gradle, NPM, windows: creating symlink requires administrator privilege +- [`KT-31931`](https://youtrack.jetbrains.com/issue/KT-31931) Gradle JS or Native: test processing fails in some cases + +### JavaScript + +- [`KT-31007`](https://youtrack.jetbrains.com/issue/KT-31007) Kotlin/JS 1.3.30 - private method in an interface in the external library causes ReferenceError + +### Libraries + +- [`KT-30174`](https://youtrack.jetbrains.com/issue/KT-30174) Annotation for experimental stdlib API +- [`KT-30451`](https://youtrack.jetbrains.com/issue/KT-30451) Redundant call of selector in maxBy&minBy +- [`KT-30560`](https://youtrack.jetbrains.com/issue/KT-30560) Fix Throwable::addSuppressed from stdlib to make it work without stdlib-jdk7 in runtime +- [`KT-24810`](https://youtrack.jetbrains.com/issue/KT-24810) Support common string<->ByteArray UTF-8 conversion +- [`KT-29265`](https://youtrack.jetbrains.com/issue/KT-29265) String.toCharArray() is not available in common stdlib +- [`KT-31194`](https://youtrack.jetbrains.com/issue/KT-31194) assertFails and assertFailsWith don't work with suspend functions +- [`KT-31639`](https://youtrack.jetbrains.com/issue/KT-31639) 'Iterbale.drop' drops too much because of overflow +- [`KT-28933`](https://youtrack.jetbrains.com/issue/KT-28933) capitalize() with Locale argument in the JDK stdlib + +### Reflection + +- [`KT-29041`](https://youtrack.jetbrains.com/issue/KT-29041) KAnnotatedElement should have an extension function to verify if certain annotation is present +- [`KT-30344`](https://youtrack.jetbrains.com/issue/KT-30344) Avoid using .kotlin_module in kotlin-reflect + +### Tools. Android Extensions + +- [`KT-30993`](https://youtrack.jetbrains.com/issue/KT-30993) Android Extensions: Make @Parcelize functionality non-experimental + +### Tools. CLI + +- [`KT-27638`](https://youtrack.jetbrains.com/issue/KT-27638) Add -Xjava-sources compiler argument to specify directories with .java source files which can be referenced from the compiled Kotlin sources +- [`KT-27778`](https://youtrack.jetbrains.com/issue/KT-27778) Add -Xpackage-prefix compiler argument to specify package prefix for Java sources resolution +- [`KT-30973`](https://youtrack.jetbrains.com/issue/KT-30973) Compilation on IBM J9 (build 2.9, JRE 1.8.0 AIX ppc64-64-Bit) fails unless -Xuse-javac is specified + +### Tools. Compiler Plugins + +- [`KT-30343`](https://youtrack.jetbrains.com/issue/KT-30343) Add new Quarkus preset to all-open compiler plugin + +### Tools. Gradle + +#### New Features + +- [`KT-20156`](https://youtrack.jetbrains.com/issue/KT-20156) Publish the Kotlin Javascript Gradle plugin to the Gradle Plugins Portal +- [`KT-26256`](https://youtrack.jetbrains.com/issue/KT-26256) In new MPP, support Java compilation in JVM targets +- [`KT-27273`](https://youtrack.jetbrains.com/issue/KT-27273) Support the Gradle 'application' plugin in new MPP or provide an alternative +- [`KT-30528`](https://youtrack.jetbrains.com/issue/KT-30528) Gradle, JS tests: support basic builtin test runner +- [`KT-31015`](https://youtrack.jetbrains.com/issue/KT-31015) Gradle, JS: Change default for new kotlin-js and experimental kotlin-multiplatform plugins +- [`KT-30573`](https://youtrack.jetbrains.com/issue/KT-30573) Gradle, JS: enable source maps by default, change paths relative to node_modules directory +- [`KT-30747`](https://youtrack.jetbrains.com/issue/KT-30747) Gradle, JS tests: provide option to disable test configuration per target +- [`KT-31010`](https://youtrack.jetbrains.com/issue/KT-31010) Gradle, JS tests: Mocha +- [`KT-31011`](https://youtrack.jetbrains.com/issue/KT-31011) Gradle, JS tests: Karma +- [`KT-31013`](https://youtrack.jetbrains.com/issue/KT-31013) Gradle, JS: Webpack +- [`KT-31016`](https://youtrack.jetbrains.com/issue/KT-31016) Gradle: yarn downloading +- [`KT-31017`](https://youtrack.jetbrains.com/issue/KT-31017) Gradle, yarn: support workspaces + +#### Fixes + +- [`KT-13256`](https://youtrack.jetbrains.com/issue/KT-13256) CompileJava tasks in Kotlin2Js Gradle plugin +- [`KT-16355`](https://youtrack.jetbrains.com/issue/KT-16355) Rename "compileKotlin2Js" Gradle task to "compileKotlinJs" +- [`KT-26255`](https://youtrack.jetbrains.com/issue/KT-26255) Using the jvmWithJava preset in new MPP leads to counter-intuitive source set names and directory structure +- [`KT-27640`](https://youtrack.jetbrains.com/issue/KT-27640) Do not use `-Xbuild-file` when invoking the Kotlin compiler in Gradle plugins +- [`KT-29284`](https://youtrack.jetbrains.com/issue/KT-29284) kotlin2js plugin applies java plugin +- [`KT-30132`](https://youtrack.jetbrains.com/issue/KT-30132) Could not initialize class org.jetbrains.kotlin.com.intellij.openapi.util.io.FileUtil on build by gradle +- [`KT-30596`](https://youtrack.jetbrains.com/issue/KT-30596) Kotlin Gradle Plugin: Forward stdout and stderr logger of out of process though gradle logger +- [`KT-31106`](https://youtrack.jetbrains.com/issue/KT-31106) Kotlin compilation fails with locked build script dependencies and Gradle 5 +- [`KT-28985`](https://youtrack.jetbrains.com/issue/KT-28985) Java tests not executed in a module created with presets.jvmWithJava +- [`KT-30340`](https://youtrack.jetbrains.com/issue/KT-30340) kotlin("multiplatform") plugin is not working properly with Spring Boot +- [`KT-30784`](https://youtrack.jetbrains.com/issue/KT-30784) Deprecation warning "API 'variant.getPackageLibrary()' is obsolete and has been replaced with 'variant.getPackageLibraryProvider()'" for a multiplatform library with Android target +- [`KT-31027`](https://youtrack.jetbrains.com/issue/KT-31027) java.lang.NoSuchMethodError: No static method hashCode(Z)I in class Ljava/lang/Boolean; or its super classes (declaration of 'java.lang.Boolean' appears in /system/framework/core-libart.jar) +- [`KT-31696`](https://youtrack.jetbrains.com/issue/KT-31696) Gradle, NPM: select one version between tools and all of compile configurations +- [`KT-31697`](https://youtrack.jetbrains.com/issue/KT-31697) Gradle, NPM: report about clashes in packages_imported +- [`KT-31891`](https://youtrack.jetbrains.com/issue/KT-31891) Gradle: JS or Native tests execution: `build --scan` fails with ISE "Expected attachment of type ... but did not find it" +- [`KT-31023`](https://youtrack.jetbrains.com/issue/KT-31023) Update Gradle module metadata warning in MPP publishing + +### Tools. Incremental Compile + +- [`KT-31131`](https://youtrack.jetbrains.com/issue/KT-31131) Regression: incremental compilation of multi-file part throws exception + +### Tools. J2K + +- [`KT-23023`](https://youtrack.jetbrains.com/issue/KT-23023) J2K: Inspection to convert Arrays.copyOf(a, size) to a.copyOf(size) +- [`KT-26550`](https://youtrack.jetbrains.com/issue/KT-26550) J2K: Check context/applicability of conversion, don't suggest for libraries, jars, etc. +- [`KT-29568`](https://youtrack.jetbrains.com/issue/KT-29568) Disabled "Convert Java File to Kotlin File" action is shown in project view context menu for XML files + +### Tools. JPS + +- [`KT-13563`](https://youtrack.jetbrains.com/issue/KT-13563) Kotlin jps-plugin should allow to instrument bytecode from Intellij IDEA. + +### Tools. REPL + +- [`KT-21443`](https://youtrack.jetbrains.com/issue/KT-21443) Kotlin's JSR223 script engine does not work when used by a fat jar + +### Tools. Scripts + +- [`KT-30986`](https://youtrack.jetbrains.com/issue/KT-30986) Missing dependencies when JSR-223 script engines are used from `kotlin-script-util` + +### Tools. kapt + +- [`KT-26203`](https://youtrack.jetbrains.com/issue/KT-26203) `kapt.use.worker.api=true` throws a NullPointerException on Java 10/11 +- [`KT-30739`](https://youtrack.jetbrains.com/issue/KT-30739) Kapt generated sources are not visible from the IDE when "Create separate module per source set" is disabled +- [`KT-31064`](https://youtrack.jetbrains.com/issue/KT-31064) Periodically build crash when using incremental kapt +- [`KT-23880`](https://youtrack.jetbrains.com/issue/KT-23880) Kapt: Support incremental annotation processors +- [`KT-31322`](https://youtrack.jetbrains.com/issue/KT-31322) Kapt does not run annotation processing when sources change. +- [`KT-30979`](https://youtrack.jetbrains.com/issue/KT-30979) Issue with Dagger2 providers MissingBinding with 1.3.30 +- [`KT-31127`](https://youtrack.jetbrains.com/issue/KT-31127) Kotlin-generating processor which uses Filer API breaks JavaCompile task +- [`KT-31714`](https://youtrack.jetbrains.com/issue/KT-31714) incremental kapt: FileSystemException: Too many open files + +## 1.3.31 + +### Compiler + +#### Fixes + +- [`KT-26418`](https://youtrack.jetbrains.com/issue/KT-26418) Back-end (JVM) Internal error when compiling decorated suspend inline functions +- [`KT-26925`](https://youtrack.jetbrains.com/issue/KT-26925) Decorated suspend inline function continuation resumes in wrong spot +- [`KT-30706`](https://youtrack.jetbrains.com/issue/KT-30706) Passing noinline lambda as (cross)inline parameter result in wrong state-machine +- [`KT-30707`](https://youtrack.jetbrains.com/issue/KT-30707) Java interop of coroutines inside inline functions is broken +- [`KT-30997`](https://youtrack.jetbrains.com/issue/KT-30997) Crash with suspend crossinline + +### IDE. Inspections and Intentions + +- [`KT-30879`](https://youtrack.jetbrains.com/issue/KT-30879) False positive "Redundant qualifier name" +- [`KT-31112`](https://youtrack.jetbrains.com/issue/KT-31112) "Remove redundant qualifier name" inspection false positive for property with irrelevant import + +### JavaScript + +- [`KT-31007`](https://youtrack.jetbrains.com/issue/KT-31007) Kotlin/JS 1.3.30 - private method in an interface in the external library causes ReferenceError + +### Tools. Gradle + +- [`KT-31027`](https://youtrack.jetbrains.com/issue/KT-31027) java.lang.NoSuchMethodError: No static method hashCode(Z)I in class Ljava/lang/Boolean; or its super classes (declaration of 'java.lang.Boolean' appears in /system/framework/core-libart.jar) + +### Tools. kapt + +- [`KT-30979`](https://youtrack.jetbrains.com/issue/KT-30979) Issue with Dagger2 providers MissingBinding with 1.3.30 + +## 1.3.30 + +### Compiler + +#### New Features + +- [`KT-19664`](https://youtrack.jetbrains.com/issue/KT-19664) Allow more permissive visibility for non-virtual actual declarations +- [`KT-29586`](https://youtrack.jetbrains.com/issue/KT-29586) Add support for Android platform annotations +- [`KT-29604`](https://youtrack.jetbrains.com/issue/KT-29604) Do not implicitly propagate deprecations originated in Java + +#### Performance Improvements + +- [`KT-24876`](https://youtrack.jetbrains.com/issue/KT-24876) Emit calls to java.lang.Long.divideUnsigned for unsigned types when target version is 1.8 +- [`KT-25974`](https://youtrack.jetbrains.com/issue/KT-25974) 'when' by unsigned integers is not translated to tableswitch/lookupswitch +- [`KT-28015`](https://youtrack.jetbrains.com/issue/KT-28015) Coroutine state-machine shall use Result.throwOnFailure +- [`KT-29229`](https://youtrack.jetbrains.com/issue/KT-29229) Intrinsify 'in' operator for unsigned integer ranges +- [`KT-29230`](https://youtrack.jetbrains.com/issue/KT-29230) Specialize 'next' method call for unsigned integer range and progression iterators + +#### Fixes + +- [`KT-7185`](https://youtrack.jetbrains.com/issue/KT-7185) Parse import directives in the middle of the file, report a diagnostic instead +- [`KT-7237`](https://youtrack.jetbrains.com/issue/KT-7237) Parser recovery (angle bracket mismatch) +- [`KT-11656`](https://youtrack.jetbrains.com/issue/KT-11656) Could not generate LightClass because of ISE from bridge generation on invalid code +- [`KT-13497`](https://youtrack.jetbrains.com/issue/KT-13497) Better recovery in comma-separated lists in case of missing comma +- [`KT-13703`](https://youtrack.jetbrains.com/issue/KT-13703) Restore parser better when `class` is missing from `enum` declaration +- [`KT-13731`](https://youtrack.jetbrains.com/issue/KT-13731) Recover parser on value parameter without a type +- [`KT-14227`](https://youtrack.jetbrains.com/issue/KT-14227) Incorrect code is generated when using MutableMap.set with plusAssign operator +- [`KT-19389`](https://youtrack.jetbrains.com/issue/KT-19389) Couldn't inline method call 'with' +- [`KT-20065`](https://youtrack.jetbrains.com/issue/KT-20065) "Cannot serialize error type: [ERROR : Unknown type parameter 0]" with generic typealias +- [`KT-20322`](https://youtrack.jetbrains.com/issue/KT-20322) Debug: member value returned from suspending function is not updated immediately +- [`KT-20780`](https://youtrack.jetbrains.com/issue/KT-20780) "Cannot serialize error type: [ERROR : Unknown type parameter 0]" with parameterized inner type alias +- [`KT-21405`](https://youtrack.jetbrains.com/issue/KT-21405) Throwable “Rewrite at slice LEXICAL_SCOPE key: VALUE_PARAMETER_LIST” on editing string literal in kotlin-js module +- [`KT-21775`](https://youtrack.jetbrains.com/issue/KT-21775) "Cannot serialize error type: [ERROR : Unknown type parameter 0]" with typealias used from a different module +- [`KT-22818`](https://youtrack.jetbrains.com/issue/KT-22818) "UnsupportedOperationException: Don't know how to generate outer expression" on using non-trivial expression in default argument of `expect` function +- [`KT-23117`](https://youtrack.jetbrains.com/issue/KT-23117) Local delegate + local object = NoSuchMethodError +- [`KT-23701`](https://youtrack.jetbrains.com/issue/KT-23701) Report error when -Xmultifile-parts-inherit is used and relevant JvmMultifileClass parts have any state +- [`KT-23992`](https://youtrack.jetbrains.com/issue/KT-23992) Target prefixes for annotations on supertype list elements are not checked +- [`KT-24490`](https://youtrack.jetbrains.com/issue/KT-24490) Wrong type is inferred when last expression in lambda has functional type +- [`KT-24871`](https://youtrack.jetbrains.com/issue/KT-24871) Optimize iteration and contains for UIntRange/ULongRange +- [`KT-24964`](https://youtrack.jetbrains.com/issue/KT-24964) "Cannot serialize error type: [ERROR : Unknown type parameter 0]" with `Validated` typealias from Arrow +- [`KT-25383`](https://youtrack.jetbrains.com/issue/KT-25383) Named function as last statement in lambda doesn't coerce to Unit +- [`KT-25431`](https://youtrack.jetbrains.com/issue/KT-25431) Type mismatch when trying to bind mutable property with complex common system +- [`KT-25435`](https://youtrack.jetbrains.com/issue/KT-25435) Try/catch as the last expression of lambda cause type mismatch +- [`KT-25437`](https://youtrack.jetbrains.com/issue/KT-25437) Type variable fixation of postponed arguments and type variables with Nothing constraint +- [`KT-25446`](https://youtrack.jetbrains.com/issue/KT-25446) Empty labeled return doesn't force coercion to Unit +- [`KT-26069`](https://youtrack.jetbrains.com/issue/KT-26069) NoSuchMethodError on calling remove/getOrDefault on a Kotlin subclass of Java subclass of Map +- [`KT-26638`](https://youtrack.jetbrains.com/issue/KT-26638) Check for repeatablilty of annotations doesn't take into account annotations with use-site target +- [`KT-26816`](https://youtrack.jetbrains.com/issue/KT-26816) Lambdas to Nothing is inferred if multilevel collections is used (listOf, mapOf, etc) +- [`KT-27190`](https://youtrack.jetbrains.com/issue/KT-27190) State machine elimination after inlining stopped working (regression) +- [`KT-27241`](https://youtrack.jetbrains.com/issue/KT-27241) Contracts: smartcasts don't work correctly if type checking for contract function is used +- [`KT-27565`](https://youtrack.jetbrains.com/issue/KT-27565) Lack of fallback resolution for SAM conversions for Kotlin functions in new inference +- [`KT-27799`](https://youtrack.jetbrains.com/issue/KT-27799) Prohibit references to reified type parameters in annotation arguments in local classes / anonymous objects +- [`KT-28182`](https://youtrack.jetbrains.com/issue/KT-28182) Kotlin Bytecode tool window shows incorrect output on annotated property with backing field +- [`KT-28236`](https://youtrack.jetbrains.com/issue/KT-28236) "Cannot serialize error type: [ERROR : Unknown type parameter 2]" with inferred type arguments in generic extension function from Arrow +- [`KT-28309`](https://youtrack.jetbrains.com/issue/KT-28309) Do not generate LVT entries with different types pointing to the same slot, but have different types +- [`KT-28317`](https://youtrack.jetbrains.com/issue/KT-28317) Strange behavior in testJvmAssertInlineFunctionAssertionsEnabled on Jdk 6 and exception on JDK 8 +- [`KT-28453`](https://youtrack.jetbrains.com/issue/KT-28453) Mark anonymous classes for callable references as synthetic +- [`KT-28598`](https://youtrack.jetbrains.com/issue/KT-28598) Type is inferred incorrectly to Any on a deep generic type with out projection +- [`KT-28654`](https://youtrack.jetbrains.com/issue/KT-28654) No report about type mismatch inside a lambda in generic functions with a type parameter as a return type +- [`KT-28670`](https://youtrack.jetbrains.com/issue/KT-28670) Not null smartcasts on an intersection of nullable types don't work +- [`KT-28718`](https://youtrack.jetbrains.com/issue/KT-28718) progressive mode plus new inference result in different floating-point number comparisons +- [`KT-28810`](https://youtrack.jetbrains.com/issue/KT-28810) Suspend function's continuation parameter is missing from LVT +- [`KT-28855`](https://youtrack.jetbrains.com/issue/KT-28855) NoSuchMethodError with vararg of unsigned Int in generic class constructor +- [`KT-28984`](https://youtrack.jetbrains.com/issue/KT-28984) Exception when subtype of kotlin.Function is used as an expected one for lambda or callable reference +- [`KT-28993`](https://youtrack.jetbrains.com/issue/KT-28993) Incorrect behavior when two lambdas are passed outside a parenthesized argument list +- [`KT-29144`](https://youtrack.jetbrains.com/issue/KT-29144) Interface with companion object generates invalid bytecode in progressive mode +- [`KT-29228`](https://youtrack.jetbrains.com/issue/KT-29228) Intrinsify 'for' loop for unsigned integer ranges and progressions +- [`KT-29324`](https://youtrack.jetbrains.com/issue/KT-29324) Warnings indexing jdk 11 classes +- [`KT-29367`](https://youtrack.jetbrains.com/issue/KT-29367) New inference doesn't wrap annotated type from java to TypeWithEnhancement +- [`KT-29507`](https://youtrack.jetbrains.com/issue/KT-29507) @field-targeted annotation on property with both getter and setter is absent from bytecode +- [`KT-29705`](https://youtrack.jetbrains.com/issue/KT-29705) 'Rewrite at slice CONSTRUCTOR` of JS class while editing another JVM-class +- [`KT-29792`](https://youtrack.jetbrains.com/issue/KT-29792) UnsupportedOperationException: Unsupported annotation argument type when using Java annotation with infinity or NaN as a default value +- [`KT-29891`](https://youtrack.jetbrains.com/issue/KT-29891) Kotlin doesn't allow to use local class literals as annotation arguments +- [`KT-29912`](https://youtrack.jetbrains.com/issue/KT-29912) Crossinline nonsuspend lambda leads to KNPE during inlining +- [`KT-29965`](https://youtrack.jetbrains.com/issue/KT-29965) Don't generate annotation on $default method +- [`KT-30030`](https://youtrack.jetbrains.com/issue/KT-30030) Extensive 'Rewrite at slice'-exception with contracts in JS module of multiplatform project +- [`KT-22043`](https://youtrack.jetbrains.com/issue/KT-22043) Report an error when comparing enum (==/!=/when) to any other incompatible type since 1.4 +- [`KT-26150`](https://youtrack.jetbrains.com/issue/KT-26150) KotlinFrontendException is thrown when callsInPlace called twice with different InvocationKind in functions with contracts +- [`KT-26153`](https://youtrack.jetbrains.com/issue/KT-26153) Contract is allowed when it's at the beginning in control flow terms, but not in tokens order terms (contract doesn't work) +- [`KT-26191`](https://youtrack.jetbrains.com/issue/KT-26191) Contract may not be the first statement if it's part of the expression +- [`KT-29178`](https://youtrack.jetbrains.com/issue/KT-29178) Prohibit arrays of reified type parameters in annotation arguments in local classes / anonymous objects +- [`KT-20507`](https://youtrack.jetbrains.com/issue/KT-20507) PROTECTED_CONSTRUCTOR_NOT_IN_SUPER_CALL not reported for generic base class constructor call, IAE at run-time +- [`KT-20849`](https://youtrack.jetbrains.com/issue/KT-20849) Inference results in Nothing type argument in case of passing 'out T' to 'in T1' +- [`KT-28285`](https://youtrack.jetbrains.com/issue/KT-28285) NullPointerException on calling Array constructor compiled via Excelsior JET +- [`KT-29376`](https://youtrack.jetbrains.com/issue/KT-29376) Report a deprecation warning when comparing enum to any other incompatible type +- [`KT-29884`](https://youtrack.jetbrains.com/issue/KT-29884) Report warning on @Synchronized on inline method +- [`KT-30073`](https://youtrack.jetbrains.com/issue/KT-30073) ClassCastException on coroutine start with crossinline lambda +- [`KT-30597`](https://youtrack.jetbrains.com/issue/KT-30597) "Extend selection" throws exception in empty class body case +- [`KT-29492`](https://youtrack.jetbrains.com/issue/KT-29492) Double cross-inline of suspending functions produces incorrect code +- [`KT-30508`](https://youtrack.jetbrains.com/issue/KT-30508) Wrong file name in metadata of suspend function capturing crossinline lambda +- [`KT-30679`](https://youtrack.jetbrains.com/issue/KT-30679) "KotlinFrontEndException: Front-end Internal error: Failed to analyze declaration" exception during a compilation of a multiplatform project containing Kotlin Script File + +### IDE + +#### New Features + +- [`KT-26950`](https://youtrack.jetbrains.com/issue/KT-26950) Support Multiline TODO comments +- [`KT-29034`](https://youtrack.jetbrains.com/issue/KT-29034) Make JvmDeclarationSearch find private fields in kotlin classes + +#### Performance Improvements + +- [`KT-29457`](https://youtrack.jetbrains.com/issue/KT-29457) FindImplicitNothingAction#update freezes UI for 30 secs +- [`KT-29551`](https://youtrack.jetbrains.com/issue/KT-29551) CreateKotlinSdkActivity runs on UI thread + +#### Fixes + +- [`KT-11143`](https://youtrack.jetbrains.com/issue/KT-11143) Do not insert closing brace for string template between open brace and identifier +- [`KT-18503`](https://youtrack.jetbrains.com/issue/KT-18503) Optimize imports produces red code +- [`KT-27283`](https://youtrack.jetbrains.com/issue/KT-27283) KotlinULiteralExpression and PsiLanguageInjectionHost mismatch +- [`KT-27794`](https://youtrack.jetbrains.com/issue/KT-27794) KotlinAnnotatedElementsSearcher doesn't process method parameters +- [`KT-28272`](https://youtrack.jetbrains.com/issue/KT-28272) UAST: Need to be able to identify SAM conversions +- [`KT-28360`](https://youtrack.jetbrains.com/issue/KT-28360) Getting tons of "There are 2 classes with same fqName" logs in IntelliJ +- [`KT-28739`](https://youtrack.jetbrains.com/issue/KT-28739) Bad caret position after `Insert curly braces around variable` inspection +- [`KT-29013`](https://youtrack.jetbrains.com/issue/KT-29013) Injection with interpolation loses suffix +- [`KT-29025`](https://youtrack.jetbrains.com/issue/KT-29025) Implement `UReferenceExpression.referenceNameElement` for Kotlin +- [`KT-29287`](https://youtrack.jetbrains.com/issue/KT-29287) Exception in ultra-light classes on method annotated with @Throws +- [`KT-29381`](https://youtrack.jetbrains.com/issue/KT-29381) Highlight return lambda expressions when cursor is one the call with lambda argument +- [`KT-29434`](https://youtrack.jetbrains.com/issue/KT-29434) Can not detect injection host in string passed as argument into arrayOf() function +- [`KT-29464`](https://youtrack.jetbrains.com/issue/KT-29464) Project reopening does not create missing Kotlin SDK for Native modules (like it does for other non-JVM ones) +- [`KT-29467`](https://youtrack.jetbrains.com/issue/KT-29467) Maven/Gradle re-import does not add missing Kotlin SDK for kotlin2js modules (non-MPP JavaScript) +- [`KT-29804`](https://youtrack.jetbrains.com/issue/KT-29804) Probable error in the "Kotlin (Mobile Android/iOS)" new project template in IntelliJ +- [`KT-30033`](https://youtrack.jetbrains.com/issue/KT-30033) UAST: Delegation expression missing from parse tree +- [`KT-30388`](https://youtrack.jetbrains.com/issue/KT-30388) Disable constant exception reporting from release versions +- [`KT-30524`](https://youtrack.jetbrains.com/issue/KT-30524) "java.lang.IllegalStateException: This method shouldn't be invoked for LOCAL visibility" on add import +- [`KT-30534`](https://youtrack.jetbrains.com/issue/KT-30534) KotlinUObjectLiteralExpression returns classReference whose referenceNameElement is null +- [`KT-30546`](https://youtrack.jetbrains.com/issue/KT-30546) Kotlin UImportStatement's children references always resolve to null +- [`KT-5435`](https://youtrack.jetbrains.com/issue/KT-5435) Surround with try/catch should generate more Kotlin-style code + +### IDE. Android + +- [`KT-29847`](https://youtrack.jetbrains.com/issue/KT-29847) Many IDEA plugins are not loaded in presence of Kotlin plugin: "Plugins should not have cyclic dependencies" + +### IDE. Code Style, Formatting + +- [`KT-23295`](https://youtrack.jetbrains.com/issue/KT-23295) One-line comment indentation in functions with expression body +- [`KT-28905`](https://youtrack.jetbrains.com/issue/KT-28905) When is "... if long" hitting? +- [`KT-29304`](https://youtrack.jetbrains.com/issue/KT-29304) Settings / Code Style / Kotlin mentions "methods" instead of functions +- [`KT-26954`](https://youtrack.jetbrains.com/issue/KT-26954) Bad indentation for single function with expression body in new code style + +### IDE. Completion + +- [`KT-18663`](https://youtrack.jetbrains.com/issue/KT-18663) Support "smart enter/complete statement" completion for method calls +- [`KT-28394`](https://youtrack.jetbrains.com/issue/KT-28394) Improve code completion for top level class/interface to incorporate filename +- [`KT-29435`](https://youtrack.jetbrains.com/issue/KT-29435) org.jetbrains.kotlin.types.TypeUtils.contains hanging forever and freezing IntelliJ +- [`KT-27915`](https://youtrack.jetbrains.com/issue/KT-27915) Stop auto-completing braces for companion objects + +### IDE. Debugger + +- [`KT-22250`](https://youtrack.jetbrains.com/issue/KT-22250) Evaluate: 'this' shows different values when evaluated as a variable/watch +- [`KT-24829`](https://youtrack.jetbrains.com/issue/KT-24829) Access to coroutineContext in 'Evaluate expression' +- [`KT-25220`](https://youtrack.jetbrains.com/issue/KT-25220) Evaluator: a instance of Pair returned instead of String ("Extract function" failed) +- [`KT-25222`](https://youtrack.jetbrains.com/issue/KT-25222) Evaluate: ClassCastException: ObjectValue cannot be cast to IntValue ("Extract function" failed) +- [`KT-26913`](https://youtrack.jetbrains.com/issue/KT-26913) Change local variable name mangling ($receiver -> this_

+interface Out + +class Bar(val x: Inv>) + +fun materializeFoo(): Inv = null as Inv + +fun main() { + Bar(materializeFoo()) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/upperBounds/inferringVariableByMaterializeAndUpperBound.kt b/compiler/testData/diagnostics/tests/inference/upperBounds/inferringVariableByMaterializeAndUpperBound.kt new file mode 100644 index 00000000000..7bbe9a58142 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/upperBounds/inferringVariableByMaterializeAndUpperBound.kt @@ -0,0 +1,14 @@ +// !DIAGNOSTICS: -CAST_NEVER_SUCCEEDS + +interface I + +interface Inv

+interface Out + +class Bar(val x: Inv>) + +fun materializeFoo(): Inv = null as Inv + +fun main() { + Bar(materializeFoo()) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/upperBounds/inferringVariableByMaterializeAndUpperBound.txt b/compiler/testData/diagnostics/tests/inference/upperBounds/inferringVariableByMaterializeAndUpperBound.txt new file mode 100644 index 00000000000..27fac7e5e53 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/upperBounds/inferringVariableByMaterializeAndUpperBound.txt @@ -0,0 +1,30 @@ +package + +public fun main(): kotlin.Unit +public fun materializeFoo(): Inv + +public final class Bar { + public constructor Bar(/*0*/ x: Inv>) + public final val x: Inv> + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface I { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface Inv { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface Out { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/suspendFunctions.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/suspendFunctions.kt index 770c150974a..be8a30e59c5 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/suspendFunctions.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/suspendFunctions.kt @@ -19,7 +19,7 @@ fun main() { val x1: suspend (Int) -> Unit = takeSuspend( kotlin.Unit")!>id { it }, kotlin.Unit")!>{ x -> x }) // Here, the error should be - val x2: (Int) -> Unit = takeSuspend( kotlin.Unit")!>id { it }, kotlin.Unit"), TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>{ x -> x }) - val x3: suspend (Int) -> Unit = takeSimpleFunction( kotlin.Unit")!>id { it }, kotlin.Unit"), TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>{ x -> x }) - val x4: (Int) -> Unit = takeSimpleFunction(id Unit> {}, kotlin.Unit"), TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>{}) + val x2: (Int) -> Unit = takeSuspend( kotlin.Unit")!>id { it }, kotlin.Unit"), TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>{ x -> x }) + val x3: suspend (Int) -> Unit = takeSimpleFunction( kotlin.Unit")!>id { it }, kotlin.Unit"), TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>{ x -> x }) + val x4: (Int) -> Unit = takeSimpleFunction(id Unit> {}, kotlin.Unit"), TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>{}) } diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41644.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41644.kt new file mode 100644 index 00000000000..bf660e84702 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41644.kt @@ -0,0 +1,44 @@ +// FIR_IDENTICAL +//!DIAGNOSTICS: -UNUSED_PARAMETER -CAST_NEVER_SUCCEEDS + +sealed class DataType { + sealed class NotNull : DataType() { + abstract class Partial : NotNull() + } +} + +class Tuple8, B, DB : DataType, C, DC : DataType, D, DD : DataType, E, DE : DataType, F, DF : DataType, G, DG : DataType, H, DH : DataType>( + firstName: String, firstType: DA, + secondName: String, secondType: DB, + thirdName: String, thirdType: DC, + fourthName: String, fourthType: DD, + fifthName: String, fifthType: DE, + sixthName: String, sixthType: DF, + seventhName: String, seventhType: DG, + eighthName: String, eighthType: DH +) : Schema>() + +class EitherType>( + schema: SCH +) + +open class Schema + +fun , B, DB : DataType, C, DC : DataType, D, DD : DataType, E, DE : DataType, F, DF : DataType, G, DG : DataType, H, DH : DataType> either8( + firstName: String, firstType: DA, + secondName: String, secondType: DB, + thirdName: String, thirdType: DC, + fourthName: String, fourthType: DD, + fifthName: String, fifthType: DE, + sixthName: String, sixthType: DF, + seventhName: String, seventhType: DG, + eighthName: String, eighthType: DH +): DataType.NotNull.Partial> = + EitherType( + Tuple8( + firstName, firstType, secondName, secondType, thirdName, thirdType, fourthName, fourthType, + fifthName, fifthType, sixthName, sixthType, seventhName, seventhType, eighthName, eighthType + ) + ) as DataType.NotNull.Partial> + +class Either8 diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41644.txt b/compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41644.txt new file mode 100644 index 00000000000..8fc7f0bc599 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41644.txt @@ -0,0 +1,52 @@ +package + +public fun , /*2*/ B, /*3*/ DB : DataType, /*4*/ C, /*5*/ DC : DataType, /*6*/ D, /*7*/ DD : DataType, /*8*/ E, /*9*/ DE : DataType, /*10*/ F, /*11*/ DF : DataType, /*12*/ G, /*13*/ DG : DataType, /*14*/ H, /*15*/ DH : DataType> either8(/*0*/ firstName: kotlin.String, /*1*/ firstType: DA, /*2*/ secondName: kotlin.String, /*3*/ secondType: DB, /*4*/ thirdName: kotlin.String, /*5*/ thirdType: DC, /*6*/ fourthName: kotlin.String, /*7*/ fourthType: DD, /*8*/ fifthName: kotlin.String, /*9*/ fifthType: DE, /*10*/ sixthName: kotlin.String, /*11*/ sixthType: DF, /*12*/ seventhName: kotlin.String, /*13*/ seventhType: DG, /*14*/ eighthName: kotlin.String, /*15*/ eighthType: DH): DataType.NotNull.Partial> + +public sealed class DataType { + private constructor DataType() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public sealed class NotNull : DataType { + private constructor NotNull() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public abstract class Partial : DataType.NotNull { + public constructor Partial() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } +} + +public final class Either8 { + public constructor Either8() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class EitherType> { + public constructor EitherType>(/*0*/ schema: SCH) + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class Schema { + public constructor Schema() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class Tuple8, /*2*/ B, /*3*/ DB : DataType, /*4*/ C, /*5*/ DC : DataType, /*6*/ D, /*7*/ DD : DataType, /*8*/ E, /*9*/ DE : DataType, /*10*/ F, /*11*/ DF : DataType, /*12*/ G, /*13*/ DG : DataType, /*14*/ H, /*15*/ DH : DataType> : Schema> { + public constructor Tuple8, /*2*/ B, /*3*/ DB : DataType, /*4*/ C, /*5*/ DC : DataType, /*6*/ D, /*7*/ DD : DataType, /*8*/ E, /*9*/ DE : DataType, /*10*/ F, /*11*/ DF : DataType, /*12*/ G, /*13*/ DG : DataType, /*14*/ H, /*15*/ DH : DataType>(/*0*/ firstName: kotlin.String, /*1*/ firstType: DA, /*2*/ secondName: kotlin.String, /*3*/ secondType: DB, /*4*/ thirdName: kotlin.String, /*5*/ thirdType: DC, /*6*/ fourthName: kotlin.String, /*7*/ fourthType: DD, /*8*/ fifthName: kotlin.String, /*9*/ fifthType: DE, /*10*/ sixthName: kotlin.String, /*11*/ sixthType: DF, /*12*/ seventhName: kotlin.String, /*13*/ seventhType: DG, /*14*/ eighthName: kotlin.String, /*15*/ eighthType: DH) + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping/kt41741.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41741.kt similarity index 100% rename from compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping/kt41741.kt rename to compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41741.kt diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping/kt41741.txt b/compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41741.txt similarity index 100% rename from compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping/kt41741.txt rename to compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41741.txt diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping/kt42195.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt42195.kt similarity index 100% rename from compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping/kt42195.kt rename to compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt42195.kt diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping/kt42195.txt b/compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt42195.txt similarity index 100% rename from compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping/kt42195.txt rename to compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt42195.txt diff --git a/compiler/testData/diagnostics/testsWithStdLib/tryCatch/tryExpression.kt b/compiler/testData/diagnostics/testsWithStdLib/tryCatch/tryExpression.kt index 7bca0381a93..a1202adfcb2 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/tryCatch/tryExpression.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/tryCatch/tryExpression.kt @@ -27,7 +27,7 @@ fun test1(): Map = run { } fun test2(): Map = run { - try { + try { emptyMap() } catch (e: ExcA) { mapOf("" to "") diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index bf42951674e..1da5d58a8a7 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -12241,6 +12241,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali runTest("compiler/testData/diagnostics/tests/inference/upperBounds/flexibilityInCommonSuperTypeCalculation.ni.kt"); } + @TestMetadata("inferringVariableByMaterializeAndUpperBound.kt") + public void testInferringVariableByMaterializeAndUpperBound() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/upperBounds/inferringVariableByMaterializeAndUpperBound.kt"); + } + @TestMetadata("intersectUpperBounds.kt") public void testIntersectUpperBounds() throws Exception { runTest("compiler/testData/diagnostics/tests/inference/upperBounds/intersectUpperBounds.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java index 3a3b01d4bd6..102b487a90c 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java @@ -3188,29 +3188,6 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW runTest("compiler/testData/diagnostics/testsWithStdLib/inference/recursiveFlexibleAssertions.kt"); } - @TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class AddEqualityConstraintsWithoutSubtyping extends AbstractDiagnosticsTestWithStdLib { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInAddEqualityConstraintsWithoutSubtyping() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); - } - - @TestMetadata("kt41741.kt") - public void testKt41741() throws Exception { - runTest("compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping/kt41741.kt"); - } - - @TestMetadata("kt42195.kt") - public void testKt42195() throws Exception { - runTest("compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping/kt42195.kt"); - } - } - @TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -3523,6 +3500,34 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW runTest("compiler/testData/diagnostics/testsWithStdLib/inference/nothingType/dontSpreadWarningToNotReturningNothingSubResolvedAtoms.kt"); } } + + @TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inference/performance") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Performance extends AbstractDiagnosticsTestWithStdLib { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInPerformance() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/inference/performance"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("kt41644.kt") + public void testKt41644() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41644.kt"); + } + + @TestMetadata("kt41741.kt") + public void testKt41741() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41741.kt"); + } + + @TestMetadata("kt42195.kt") + public void testKt42195() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt42195.kt"); + } + } } @TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inline") diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java index da03bc7b198..25a24d11639 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java @@ -3188,29 +3188,6 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno runTest("compiler/testData/diagnostics/testsWithStdLib/inference/recursiveFlexibleAssertions.kt"); } - @TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class AddEqualityConstraintsWithoutSubtyping extends AbstractDiagnosticsTestWithStdLibUsingJavac { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInAddEqualityConstraintsWithoutSubtyping() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); - } - - @TestMetadata("kt41741.kt") - public void testKt41741() throws Exception { - runTest("compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping/kt41741.kt"); - } - - @TestMetadata("kt42195.kt") - public void testKt42195() throws Exception { - runTest("compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping/kt42195.kt"); - } - } - @TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -3523,6 +3500,34 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno runTest("compiler/testData/diagnostics/testsWithStdLib/inference/nothingType/dontSpreadWarningToNotReturningNothingSubResolvedAtoms.kt"); } } + + @TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inference/performance") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Performance extends AbstractDiagnosticsTestWithStdLibUsingJavac { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInPerformance() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/inference/performance"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("kt41644.kt") + public void testKt41644() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41644.kt"); + } + + @TestMetadata("kt41741.kt") + public void testKt41741() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41741.kt"); + } + + @TestMetadata("kt42195.kt") + public void testKt42195() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt42195.kt"); + } + } } @TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inline") diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java index 2c8875e5bf0..2268109725c 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java @@ -12236,6 +12236,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing runTest("compiler/testData/diagnostics/tests/inference/upperBounds/flexibilityInCommonSuperTypeCalculation.ni.kt"); } + @TestMetadata("inferringVariableByMaterializeAndUpperBound.kt") + public void testInferringVariableByMaterializeAndUpperBound() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/upperBounds/inferringVariableByMaterializeAndUpperBound.kt"); + } + @TestMetadata("intersectUpperBounds.kt") public void testIntersectUpperBounds() throws Exception { runTest("compiler/testData/diagnostics/tests/inference/upperBounds/intersectUpperBounds.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 1b2791231c1..430a827ede8 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -271,6 +271,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations/typeAnnotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } + @TestMetadata("checkingNotincorporatedInputTypes.kt") + public void testCheckingNotincorporatedInputTypes() throws Exception { + runTest("compiler/testData/codegen/box/annotations/typeAnnotations/checkingNotincorporatedInputTypes.kt"); + } + @TestMetadata("implicitReturn.kt") public void testImplicitReturn() throws Exception { runTest("compiler/testData/codegen/box/annotations/typeAnnotations/implicitReturn.kt"); From 04846ca47a32d08444840fa80847a2d013034b32 Mon Sep 17 00:00:00 2001 From: Victor Petukhov Date: Thu, 19 Nov 2020 12:42:04 +0300 Subject: [PATCH 101/698] Rework checking constraints by presented `OnlyInputTypes` annotation in accordance with changed incorporation mechanism --- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 ++ .../model/NewConstraintSystemImpl.kt | 65 +++++++++++++------ .../checkingNotincorporatedInputTypes.kt | 6 ++ .../codegen/BlackBoxCodegenTestGenerated.java | 5 ++ .../ir/IrBlackBoxCodegenTestGenerated.java | 5 ++ .../IrJsCodegenBoxES6TestGenerated.java | 5 ++ .../IrJsCodegenBoxTestGenerated.java | 5 ++ .../semantics/JsCodegenBoxTestGenerated.java | 5 ++ .../IrCodegenBoxWasmTestGenerated.java | 5 ++ 9 files changed, 86 insertions(+), 20 deletions(-) create mode 100644 compiler/testData/codegen/box/annotations/typeAnnotations/checkingNotincorporatedInputTypes.kt diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 80baaeb9c96..12fe003c7d0 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -271,6 +271,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations/typeAnnotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @TestMetadata("checkingNotincorporatedInputTypes.kt") + public void testCheckingNotincorporatedInputTypes() throws Exception { + runTest("compiler/testData/codegen/box/annotations/typeAnnotations/checkingNotincorporatedInputTypes.kt"); + } + @TestMetadata("implicitReturn.kt") public void testImplicitReturn() throws Exception { runTest("compiler/testData/codegen/box/annotations/typeAnnotations/implicitReturn.kt"); diff --git a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/model/NewConstraintSystemImpl.kt b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/model/NewConstraintSystemImpl.kt index fd4527e34ad..76f82239400 100644 --- a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/model/NewConstraintSystemImpl.kt +++ b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/model/NewConstraintSystemImpl.kt @@ -28,6 +28,8 @@ class NewConstraintSystemImpl( { private val utilContext = constraintInjector.constraintIncorporator.utilContext + private val postponedComputationsAfterAllVariablesAreFixed = mutableListOf<() -> Unit>() + private val storage = MutableConstraintStorage() private var state = State.BUILDING private val typeVariablesTransaction: MutableList = SmartList() @@ -321,42 +323,65 @@ class NewConstraintSystemImpl( } // KotlinConstraintSystemCompleter.Context - // TODO: simplify this: do only substitution a fixing type variable rather than running of subtyping and full incorporation - override fun fixVariable(variable: TypeVariableMarker, resultType: KotlinTypeMarker, position: FixVariableConstraintPosition<*>) { + override fun fixVariable( + variable: TypeVariableMarker, + resultType: KotlinTypeMarker, + position: FixVariableConstraintPosition<*> + ) = with(utilContext) { checkState(State.BUILDING, State.COMPLETION) - constraintInjector.addInitialEqualityConstraint( - this, variable.defaultType(), resultType, position - ) + constraintInjector.addInitialEqualityConstraint(this@NewConstraintSystemImpl, variable.defaultType(), resultType, position) val freshTypeConstructor = variable.freshTypeConstructor() - val variableWithConstraints = notFixedTypeVariables.remove(freshTypeConstructor) - checkOnlyInputTypesAnnotation(variableWithConstraints, resultType) - for (variableWithConstraint in notFixedTypeVariables.values) { - variableWithConstraint.removeConstrains { - it.type.contains { it.typeConstructor() == freshTypeConstructor } + for (otherVariableWithConstraints in notFixedTypeVariables.values) { + otherVariableWithConstraints.removeConstrains { otherConstraint -> + otherConstraint.type.contains { it.typeConstructor() == freshTypeConstructor } } } storage.fixedTypeVariables[freshTypeConstructor] = resultType + + postponeOnlyInputTypesCheck(variableWithConstraints, resultType) + + doPostponedComputationsIfAllVariablesAreFixed() } - private fun checkOnlyInputTypesAnnotation( + private fun ConstraintSystemUtilContext.postponeOnlyInputTypesCheck( variableWithConstraints: MutableVariableWithConstraints?, resultType: KotlinTypeMarker ) { - if (variableWithConstraints == null) return - val variableHasOnlyInputTypes = with(utilContext) { variableWithConstraints.typeVariable.hasOnlyInputTypesAttribute() } - if (!variableHasOnlyInputTypes) return - - val resultTypeIsInputType = variableWithConstraints.getProjectedInputCallTypes(utilContext).any { inputType -> - if (AbstractTypeChecker.equalTypes(this, resultType, inputType)) return@any true - val constructor = inputType.typeConstructor() - constructor.isIntersection() && constructor.supertypes().any { AbstractTypeChecker.equalTypes(this, resultType, it) } + if (variableWithConstraints != null && variableWithConstraints.typeVariable.hasOnlyInputTypesAttribute()) { + postponedComputationsAfterAllVariablesAreFixed.add { checkOnlyInputTypesAnnotation(variableWithConstraints, resultType) } } - if (!resultTypeIsInputType) { + } + + private fun doPostponedComputationsIfAllVariablesAreFixed() { + if (notFixedTypeVariables.isEmpty()) { + postponedComputationsAfterAllVariablesAreFixed.forEach { it() } + } + } + + private fun KotlinTypeMarker.substituteIfNecessary(substitutor: TypeSubstitutorMarker): KotlinTypeMarker { + val doesInputTypeContainsOtherVariables = this.contains { it.typeConstructor() is TypeVariableTypeConstructorMarker } + return if (doesInputTypeContainsOtherVariables) substitutor.safeSubstitute(this) else this + } + + private fun checkOnlyInputTypesAnnotation(variableWithConstraints: MutableVariableWithConstraints, resultType: KotlinTypeMarker) { + val substitutor = buildCurrentSubstitutor() + val isResultTypeEqualSomeInputType = variableWithConstraints.getProjectedInputCallTypes(utilContext).any { inputType -> + val inputTypeConstructor = inputType.typeConstructor() + + if (inputTypeConstructor.isIntersection()) { + inputTypeConstructor.supertypes().any { + AbstractTypeChecker.equalTypes(this, resultType, it.substituteIfNecessary(substitutor)) + } + } else { + AbstractTypeChecker.equalTypes(this, resultType, inputType.substituteIfNecessary(substitutor)) + } + } + if (!isResultTypeEqualSomeInputType) { addError(OnlyInputTypesDiagnostic(variableWithConstraints.typeVariable)) } } diff --git a/compiler/testData/codegen/box/annotations/typeAnnotations/checkingNotincorporatedInputTypes.kt b/compiler/testData/codegen/box/annotations/typeAnnotations/checkingNotincorporatedInputTypes.kt new file mode 100644 index 00000000000..0ecff0fc251 --- /dev/null +++ b/compiler/testData/codegen/box/annotations/typeAnnotations/checkingNotincorporatedInputTypes.kt @@ -0,0 +1,6 @@ +// IGNORE_BACKEND: JS_IR +// WITH_RUNTIME + +fun isImportedByDefault(c: String?, x: Set) = c?.let { it.toInt() } in x + +fun box(): String = "OK" diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index d1b41493916..6fbd66a341d 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -271,6 +271,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations/typeAnnotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } + @TestMetadata("checkingNotincorporatedInputTypes.kt") + public void testCheckingNotincorporatedInputTypes() throws Exception { + runTest("compiler/testData/codegen/box/annotations/typeAnnotations/checkingNotincorporatedInputTypes.kt"); + } + @TestMetadata("implicitReturn.kt") public void testImplicitReturn() throws Exception { runTest("compiler/testData/codegen/box/annotations/typeAnnotations/implicitReturn.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 3f5e335323b..43df8c8d995 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -271,6 +271,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations/typeAnnotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @TestMetadata("checkingNotincorporatedInputTypes.kt") + public void testCheckingNotincorporatedInputTypes() throws Exception { + runTest("compiler/testData/codegen/box/annotations/typeAnnotations/checkingNotincorporatedInputTypes.kt"); + } + @TestMetadata("implicitReturn.kt") public void testImplicitReturn() throws Exception { runTest("compiler/testData/codegen/box/annotations/typeAnnotations/implicitReturn.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index ded22676945..fe9e7de73fb 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -85,6 +85,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes public void testAllFilesPresentInTypeAnnotations() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations/typeAnnotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } + + @TestMetadata("checkingNotincorporatedInputTypes.kt") + public void testCheckingNotincorporatedInputTypes() throws Exception { + runTest("compiler/testData/codegen/box/annotations/typeAnnotations/checkingNotincorporatedInputTypes.kt"); + } } } diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index f4943aebaf4..20fbfa79448 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -85,6 +85,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { public void testAllFilesPresentInTypeAnnotations() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations/typeAnnotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } + + @TestMetadata("checkingNotincorporatedInputTypes.kt") + public void testCheckingNotincorporatedInputTypes() throws Exception { + runTest("compiler/testData/codegen/box/annotations/typeAnnotations/checkingNotincorporatedInputTypes.kt"); + } } } diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 18ef3e5b394..8729285c012 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -85,6 +85,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { public void testAllFilesPresentInTypeAnnotations() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations/typeAnnotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } + + @TestMetadata("checkingNotincorporatedInputTypes.kt") + public void testCheckingNotincorporatedInputTypes() throws Exception { + runTest("compiler/testData/codegen/box/annotations/typeAnnotations/checkingNotincorporatedInputTypes.kt"); + } } } diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index 5d69afc5888..7e513f3ed55 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -80,6 +80,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest public void testAllFilesPresentInTypeAnnotations() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations/typeAnnotations"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); } + + @TestMetadata("checkingNotincorporatedInputTypes.kt") + public void testCheckingNotincorporatedInputTypes() throws Exception { + runTest("compiler/testData/codegen/box/annotations/typeAnnotations/checkingNotincorporatedInputTypes.kt"); + } } } From dcdd69d039bc3acf824eb075cd5bcf11cbdb146f Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Mon, 19 Oct 2020 13:24:58 +0300 Subject: [PATCH 102/698] Invalidate caches before resolve in AbstractPerformanceHighlightingTest --- .../kotlin/idea/perf/AbstractPerformanceHighlightingTest.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/idea/performanceTests/test/org/jetbrains/kotlin/idea/perf/AbstractPerformanceHighlightingTest.kt b/idea/performanceTests/test/org/jetbrains/kotlin/idea/perf/AbstractPerformanceHighlightingTest.kt index 11c297ccb0b..8fc826e1da9 100644 --- a/idea/performanceTests/test/org/jetbrains/kotlin/idea/perf/AbstractPerformanceHighlightingTest.kt +++ b/idea/performanceTests/test/org/jetbrains/kotlin/idea/perf/AbstractPerformanceHighlightingTest.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.idea.perf import com.intellij.codeInsight.daemon.impl.HighlightInfo import com.intellij.openapi.application.runWriteAction +import com.intellij.openapi.roots.ProjectRootManager import com.intellij.testFramework.RunAll import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.ensureIndexesUpToDate import com.intellij.util.ThrowableRunnable @@ -80,6 +81,7 @@ abstract class AbstractPerformanceHighlightingTest : KotlinLightCodeInsightFixtu // to load AST for changed files before it's prohibited by "fileTreeAccessFilter" ensureIndexesUpToDate(project) + ProjectRootManager.getInstance(project).incModificationCount() } } From 25a631a1ca8d78f192f4b1a5db2a58d9e886b9b2 Mon Sep 17 00:00:00 2001 From: Vladimir Dolzhenko Date: Wed, 25 Nov 2020 10:08:57 +0100 Subject: [PATCH 103/698] Improved IDE performance tests vega specs --- .../TestData completion-basic - vega.js | 496 +++++++++++++++++ ...Data completion-basic-charFilter - vega.js | 496 +++++++++++++++++ ...estData completion-basic-keyword - vega.js | 496 +++++++++++++++++ .../TestData completion-incremental - vega.js | 496 +++++++++++++++++ .../TestData completion-smart - vega.js | 496 +++++++++++++++++ .../TestData fir highlight - vega.js | 508 ++++++++++++++++++ .../resources/TestData highlight - vega.js | 127 ++++- .../The Kotlin sources highlight - vega.js | 132 ++++- ...urces highlight build.gradle.kts - vega.js | 132 ++++- ... sources highlight empty profile - vega.js | 132 ++++- 10 files changed, 3498 insertions(+), 13 deletions(-) create mode 100644 idea/performanceTests/resources/TestData completion-basic - vega.js create mode 100644 idea/performanceTests/resources/TestData completion-basic-charFilter - vega.js create mode 100644 idea/performanceTests/resources/TestData completion-basic-keyword - vega.js create mode 100644 idea/performanceTests/resources/TestData completion-incremental - vega.js create mode 100644 idea/performanceTests/resources/TestData completion-smart - vega.js create mode 100644 idea/performanceTests/resources/TestData fir highlight - vega.js diff --git a/idea/performanceTests/resources/TestData completion-basic - vega.js b/idea/performanceTests/resources/TestData completion-basic - vega.js new file mode 100644 index 00000000000..794028f6084 --- /dev/null +++ b/idea/performanceTests/resources/TestData completion-basic - vega.js @@ -0,0 +1,496 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +{ + "note": "May https://vega.github.io/vega/docs/ be with you", + "$schema": "https://vega.github.io/schema/vega/v4.3.0.json", + "description": "TestData completion-basic", + "title": "TestData completion-basic", + "width": 800, + "height": 500, + "padding": 5, + "autosize": {"type": "pad", "resize": true}, + "signals": [ + { + "name": "clear", + "value": true, + "on": [ + {"events": "mouseup[!event.item]", "update": "true", "force": true} + ] + }, + { + "name": "shift", + "value": false, + "on": [ + { + "events": "@legendSymbol:click, @legendLabel:click", + "update": "event.shiftKey", + "force": true + } + ] + }, + { + "name": "clicked", + "value": null, + "on": [ + { + "events": "@legendSymbol:click, @legendLabel:click", + "comment": "note: here `datum` is `selected` data set", + "update": "{value: datum.value}", + "force": true + } + ] + }, + { + "name": "brush", + "value": 0, + "on": [ + {"events": {"signal": "clear"}, "update": "clear ? [0, 0] : brush"}, + {"events": "@xaxis:mousedown", "update": "[x(), x()]"}, + { + "events": "[@xaxis:mousedown, window:mouseup] > window:mousemove!", + "update": "[brush[0], clamp(x(), 0, width)]" + }, + { + "events": {"signal": "delta"}, + "update": "clampRange([anchor[0] + delta, anchor[1] + delta], 0, width)" + } + ] + }, + { + "name": "anchor", + "value": null, + "on": [{"events": "@brush:mousedown", "update": "slice(brush)"}] + }, + { + "name": "xdown", + "value": 0, + "on": [{"events": "@brush:mousedown", "update": "x()"}] + }, + { + "name": "delta", + "value": 0, + "on": [ + { + "events": "[@brush:mousedown, window:mouseup] > window:mousemove!", + "update": "x() - xdown" + } + ] + }, + { + "name": "domain", + "on": [ + { + "events": {"signal": "brush"}, + "update": "span(brush) ? invert('x', brush) : null" + } + ] + }, + {"name": "timestamp", "value": true, "bind": {"input": "checkbox"}} + ], + "data": [ + { + "name": "table", + "comment": "To test chart in VEGA editor https://vega.github.io/editor/#/ change `_values` to `values` and rename `url` property", + "_values": { + "aggregations" : { + "benchmark" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 0, + "buckets" : [ + { + "key" : "highlight", + "doc_count" : 1034, + "name" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 0, + "buckets" : [ + { + "key" : "Annotations", + "doc_count" : 23, + "values" : { + "buckets" : [ + { + "key_as_string" : "2020-11-02T09:00:00.000Z", + "key" : 1604307600000, + "doc_count" : 3, + "avgError" : { + "value" : 1.0 + }, + "avgValue" : { + "value" : 129.0 + }, + "buildId" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 1, + "buckets" : [ + { + "key" : 93277596, + "doc_count" : 2 + } + ] + } + }, + { + "key_as_string" : "2020-11-02T21:00:00.000Z", + "key" : 1604350800000, + "doc_count" : 3, + "avgError" : { + "value" : 1.0 + }, + "avgValue" : { + "value" : 41.0 + }, + "buildId" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 2, + "buckets" : [ + { + "key" : 93400366, + "doc_count" : 1 + } + ] + } + }, + { + "key_as_string" : "2020-11-03T09:00:00.000Z", + "key" : 1604394000000, + "doc_count" : 2, + "avgError" : { + "value" : 1.5 + }, + "avgValue" : { + "value" : 42.0 + }, + "buildId" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 1, + "buckets" : [ + { + "key" : 93507855, + "doc_count" : 1 + } + ] + } + } + ], + "interval" : "12h" + } + } + ] + } + } + ] + } + } + }, + "url": { + //"comment": "source index pattern", + "index": "kotlin_ide_benchmarks*", + //"comment": "it's a body of ES _search query to check query place it into `POST /kotlin_ide_benchmarks*/_search`", + //"comment": "it uses Kibana specific %timefilter% for time frame selection", + "body": { + "size": 0, + "query": { + "bool": { + "must": [ + { + "bool": { + "must_not": [ + {"exists": {"field": "warmUp"}}, + {"exists": {"field": "synthetic"}} + ] + } + }, + {"term": {"benchmark.keyword": "completion-basic"}}, + {"range": {"buildTimestamp": {"%timefilter%": true}}} + ] + } + }, + "aggs": { + "benchmark": { + "terms": { + "field": "benchmark.keyword", + "size": 50 + }, + "aggs": { + "name": { + "terms": { + "field": "name.keyword", + "size": 50 + }, + "aggs": { + "values": { + "auto_date_histogram": { + "buckets": 30, + "field": "buildTimestamp", + "minimum_interval": "hour" + }, + "aggs": { + "buildId": { + "terms": { + "size": 1, + "field": "buildId" + } + }, + "avgValue":{ + "avg": { + "field": "metricValue" + } + }, + "avgError":{ + "avg": { + "field": "metricError" + } + } + } + } + } + } + } + } + } + } + }, + "format": {"property": "aggregations"}, + "comment": "we need to have follow data: \"buildId\", \"metricName\", \"metricValue\" and \"metricError\"", + "comment": "so it has to be array of {\"buildId\": \"...\", \"metricName\": \"...\", \"metricValue\": ..., \"metricError\": ...}", + "transform": [ + {"type": "project", "fields": ["benchmark"]}, + {"type": "flatten", "fields": ["benchmark.buckets"], "as": ["benchmark_buckets"]}, + {"type": "project", "fields": ["benchmark_buckets.key", "benchmark_buckets.name"], "as": ["benchmark", "benchmark_buckets_name"]}, + {"type": "flatten", "fields": ["benchmark_buckets_name.buckets"], "as": ["name_buckets"]}, + {"type": "project", "fields": ["benchmark", "name_buckets.key", "name_buckets.values"], "as": ["benchmark", "name", "name_values"]}, + {"type": "flatten", "fields": ["name_values.buckets"], "as": ["name_values_buckets"]}, + {"type": "project", "fields": ["benchmark", "name", "name_values_buckets.key", "name_values_buckets.key_as_string", "name_values_buckets.avgError", "name_values_buckets.avgValue", "name_values_buckets.buildId.buckets"], "as": ["benchmark", "metricName", "buildTimestamp", "timestamp_value", "avgError", "avgValue", "buildId_buckets"]}, + {"type": "formula", "as": "metricError", "expr": "datum.avgError.value"}, + {"type": "formula", "as": "metricValue", "expr": "datum.avgValue.value"}, + {"type": "flatten", "fields": ["buildId_buckets"], "as": ["buildId_values"]}, + {"type": "formula", "as": "buildId", "expr": "datum.buildId_values.key"}, + { + "type": "formula", + "as": "timestamp", + "expr": "timeFormat(toDate(datum.buildTimestamp), '%Y-%m-%d %H:%M')" + }, + { + "comment": "create `url` value that points to TC build", + "type": "formula", + "as": "url", + "expr": "'https://buildserver.labs.intellij.net/buildConfiguration/Kotlin_Benchmarks_PluginPerformanceTests_IdeaPluginPerformanceTests/' + datum.buildId" + }, + {"type": "collect","sort": {"field": "timestamp"}} + ] + }, + { + "name": "selected", + "on": [ + {"trigger": "clear", "remove": true}, + {"trigger": "!shift", "remove": true}, + {"trigger": "!shift && clicked", "insert": "clicked"}, + {"trigger": "shift && clicked", "toggle": "clicked"} + ] + } + ], + "axes": [ + { + "scale": "x", + "grid": true, + "domain": false, + "orient": "bottom", + "labelAngle": -20, + "labelAlign": "right", + "title": {"signal": "timestamp ? 'timestamp' : 'buildId'"}, + "titlePadding": 10, + "tickCount": 5, + "encode": { + "labels": { + "interactive": true, + "update": {"tooltip": {"signal": "datum.label"}} + } + } + }, + { + "scale": "y", + "grid": true, + "domain": false, + "orient": "left", + "titlePadding": 10, + "title": "ms", + "titleAnchor": "end", + "titleAngle": 0 + } + ], + "scales": [ + { + "name": "x", + "type": "point", + "range": "width", + "domain": {"data": "table", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}} + }, + { + "name": "y", + "type": "linear", + "range": "height", + "nice": true, + "zero": true, + "domain": {"data": "table", "field": "metricValue"} + }, + { + "name": "color", + "type": "ordinal", + "range": "category", + "domain": {"data": "table", "field": "metricName"} + }, + { + "name": "size", + "type": "linear", + "round": true, + "nice": false, + "zero": true, + "domain": {"data": "table", "field": "metricError"}, + "range": [1, 100] + } + ], + "legends": [ + { + "title": "Cases", + "stroke": "color", + "strokeColor": "#ccc", + "padding": 8, + "cornerRadius": 4, + "symbolLimit": 50, + "encode": { + "symbols": { + "name": "legendSymbol", + "interactive": true, + "update": { + "fill": {"value": "transparent"}, + "strokeWidth": {"value": 2}, + "opacity": [ + { + "comment": "here `datum` is `selected` data set", + "test": "!length(data('selected')) || indata('selected', 'value', datum.value)", + "value": 0.7 + }, + {"value": 0.15} + ], + "size": {"value": 64} + } + }, + "labels": { + "name": "legendLabel", + "interactive": true, + "update": { + "opacity": [ + { + "comment": "here `datum` is `selected` data set", + "test": "!length(data('selected')) || indata('selected', 'value', datum.value)", + "value": 1 + }, + {"value": 0.25} + ] + } + } + } + } + ], + "marks": [ + { + "type": "group", + "from": { + "facet": {"name": "series", "data": "table", "groupby": "metricName"} + }, + "marks": [ + { + "type": "line", + "from": {"data": "series"}, + "encode": { + "hover": {"opacity": {"value": 1}, "strokeWidth": {"value": 4}}, + "update": { + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}}, + "y": {"scale": "y", "field": "metricValue"}, + "strokeWidth": {"value": 2}, + "opacity": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "value": 0.7 + }, + {"value": 0.15} + ], + "stroke": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "scale": "color", + "field": "metricName" + }, + {"value": "#ccc"} + ] + } + } + }, + { + "type": "symbol", + "from": {"data": "series"}, + "encode": { + "enter": { + "fill": {"value": "#B00"}, + "size": [{ "test": "datum.hasError", "value": 250 }, {"value": 0}], + "shape": {"value": "cross"}, + "angle": {"value": 45}, + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}}, + "y": {"scale": "y", "field": "metricValue"}, + "strokeWidth": {"value": 1}, + "opacity": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && datum.hasError && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "value": 1 + }, + {"value": 0.15} + ] + }, + "update": { + "opacity": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && datum.hasError && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "value": 1 + }, + {"value": 0.15} + ] + } + }, + "zindex": 1 + }, + { + "type": "symbol", + "from": {"data": "series"}, + "encode": { + "enter": { + "tooltip": { + "signal": "datum.metricName + ': ' + datum.metricValue + ' ms'" + }, + "href": {"field": "url"}, + "cursor": {"value": "pointer"}, + "size": {"scale": "size", "field": "metricError"}, + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}}, + "y": {"scale": "y", "field": "metricValue"}, + "strokeWidth": {"value": 1}, + "fill": {"scale": "color", "field": "metricName"} + }, + "update": { + "opacity": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "value": 1 + }, + {"value": 0.15} + ] + } + }, + "zindex": 2 + } + ] + } + ] +} diff --git a/idea/performanceTests/resources/TestData completion-basic-charFilter - vega.js b/idea/performanceTests/resources/TestData completion-basic-charFilter - vega.js new file mode 100644 index 00000000000..d5091175424 --- /dev/null +++ b/idea/performanceTests/resources/TestData completion-basic-charFilter - vega.js @@ -0,0 +1,496 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +{ + "note": "May https://vega.github.io/vega/docs/ be with you", + "$schema": "https://vega.github.io/schema/vega/v4.3.0.json", + "description": "TestData completion-basic-charFilter", + "title": "TestData completion-basic-charFilter", + "width": 800, + "height": 500, + "padding": 5, + "autosize": {"type": "pad", "resize": true}, + "signals": [ + { + "name": "clear", + "value": true, + "on": [ + {"events": "mouseup[!event.item]", "update": "true", "force": true} + ] + }, + { + "name": "shift", + "value": false, + "on": [ + { + "events": "@legendSymbol:click, @legendLabel:click", + "update": "event.shiftKey", + "force": true + } + ] + }, + { + "name": "clicked", + "value": null, + "on": [ + { + "events": "@legendSymbol:click, @legendLabel:click", + "comment": "note: here `datum` is `selected` data set", + "update": "{value: datum.value}", + "force": true + } + ] + }, + { + "name": "brush", + "value": 0, + "on": [ + {"events": {"signal": "clear"}, "update": "clear ? [0, 0] : brush"}, + {"events": "@xaxis:mousedown", "update": "[x(), x()]"}, + { + "events": "[@xaxis:mousedown, window:mouseup] > window:mousemove!", + "update": "[brush[0], clamp(x(), 0, width)]" + }, + { + "events": {"signal": "delta"}, + "update": "clampRange([anchor[0] + delta, anchor[1] + delta], 0, width)" + } + ] + }, + { + "name": "anchor", + "value": null, + "on": [{"events": "@brush:mousedown", "update": "slice(brush)"}] + }, + { + "name": "xdown", + "value": 0, + "on": [{"events": "@brush:mousedown", "update": "x()"}] + }, + { + "name": "delta", + "value": 0, + "on": [ + { + "events": "[@brush:mousedown, window:mouseup] > window:mousemove!", + "update": "x() - xdown" + } + ] + }, + { + "name": "domain", + "on": [ + { + "events": {"signal": "brush"}, + "update": "span(brush) ? invert('x', brush) : null" + } + ] + }, + {"name": "timestamp", "value": true, "bind": {"input": "checkbox"}} + ], + "data": [ + { + "name": "table", + "comment": "To test chart in VEGA editor https://vega.github.io/editor/#/ change `_values` to `values` and rename `url` property", + "_values": { + "aggregations" : { + "benchmark" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 0, + "buckets" : [ + { + "key" : "highlight", + "doc_count" : 1034, + "name" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 0, + "buckets" : [ + { + "key" : "Annotations", + "doc_count" : 23, + "values" : { + "buckets" : [ + { + "key_as_string" : "2020-11-02T09:00:00.000Z", + "key" : 1604307600000, + "doc_count" : 3, + "avgError" : { + "value" : 1.0 + }, + "avgValue" : { + "value" : 129.0 + }, + "buildId" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 1, + "buckets" : [ + { + "key" : 93277596, + "doc_count" : 2 + } + ] + } + }, + { + "key_as_string" : "2020-11-02T21:00:00.000Z", + "key" : 1604350800000, + "doc_count" : 3, + "avgError" : { + "value" : 1.0 + }, + "avgValue" : { + "value" : 41.0 + }, + "buildId" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 2, + "buckets" : [ + { + "key" : 93400366, + "doc_count" : 1 + } + ] + } + }, + { + "key_as_string" : "2020-11-03T09:00:00.000Z", + "key" : 1604394000000, + "doc_count" : 2, + "avgError" : { + "value" : 1.5 + }, + "avgValue" : { + "value" : 42.0 + }, + "buildId" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 1, + "buckets" : [ + { + "key" : 93507855, + "doc_count" : 1 + } + ] + } + } + ], + "interval" : "12h" + } + } + ] + } + } + ] + } + } + }, + "url": { + //"comment": "source index pattern", + "index": "kotlin_ide_benchmarks*", + //"comment": "it's a body of ES _search query to check query place it into `POST /kotlin_ide_benchmarks*/_search`", + //"comment": "it uses Kibana specific %timefilter% for time frame selection", + "body": { + "size": 0, + "query": { + "bool": { + "must": [ + { + "bool": { + "must_not": [ + {"exists": {"field": "warmUp"}}, + {"exists": {"field": "synthetic"}} + ] + } + }, + {"term": {"benchmark.keyword": "completion-basic-charFilter"}}, + {"range": {"buildTimestamp": {"%timefilter%": true}}} + ] + } + }, + "aggs": { + "benchmark": { + "terms": { + "field": "benchmark.keyword", + "size": 50 + }, + "aggs": { + "name": { + "terms": { + "field": "name.keyword", + "size": 50 + }, + "aggs": { + "values": { + "auto_date_histogram": { + "buckets": 30, + "field": "buildTimestamp", + "minimum_interval": "hour" + }, + "aggs": { + "buildId": { + "terms": { + "size": 1, + "field": "buildId" + } + }, + "avgValue":{ + "avg": { + "field": "metricValue" + } + }, + "avgError":{ + "avg": { + "field": "metricError" + } + } + } + } + } + } + } + } + } + } + }, + "format": {"property": "aggregations"}, + "comment": "we need to have follow data: \"buildId\", \"metricName\", \"metricValue\" and \"metricError\"", + "comment": "so it has to be array of {\"buildId\": \"...\", \"metricName\": \"...\", \"metricValue\": ..., \"metricError\": ...}", + "transform": [ + {"type": "project", "fields": ["benchmark"]}, + {"type": "flatten", "fields": ["benchmark.buckets"], "as": ["benchmark_buckets"]}, + {"type": "project", "fields": ["benchmark_buckets.key", "benchmark_buckets.name"], "as": ["benchmark", "benchmark_buckets_name"]}, + {"type": "flatten", "fields": ["benchmark_buckets_name.buckets"], "as": ["name_buckets"]}, + {"type": "project", "fields": ["benchmark", "name_buckets.key", "name_buckets.values"], "as": ["benchmark", "name", "name_values"]}, + {"type": "flatten", "fields": ["name_values.buckets"], "as": ["name_values_buckets"]}, + {"type": "project", "fields": ["benchmark", "name", "name_values_buckets.key", "name_values_buckets.key_as_string", "name_values_buckets.avgError", "name_values_buckets.avgValue", "name_values_buckets.buildId.buckets"], "as": ["benchmark", "metricName", "buildTimestamp", "timestamp_value", "avgError", "avgValue", "buildId_buckets"]}, + {"type": "formula", "as": "metricError", "expr": "datum.avgError.value"}, + {"type": "formula", "as": "metricValue", "expr": "datum.avgValue.value"}, + {"type": "flatten", "fields": ["buildId_buckets"], "as": ["buildId_values"]}, + {"type": "formula", "as": "buildId", "expr": "datum.buildId_values.key"}, + { + "type": "formula", + "as": "timestamp", + "expr": "timeFormat(toDate(datum.buildTimestamp), '%Y-%m-%d %H:%M')" + }, + { + "comment": "create `url` value that points to TC build", + "type": "formula", + "as": "url", + "expr": "'https://buildserver.labs.intellij.net/buildConfiguration/Kotlin_Benchmarks_PluginPerformanceTests_IdeaPluginPerformanceTests/' + datum.buildId" + }, + {"type": "collect","sort": {"field": "timestamp"}} + ] + }, + { + "name": "selected", + "on": [ + {"trigger": "clear", "remove": true}, + {"trigger": "!shift", "remove": true}, + {"trigger": "!shift && clicked", "insert": "clicked"}, + {"trigger": "shift && clicked", "toggle": "clicked"} + ] + } + ], + "axes": [ + { + "scale": "x", + "grid": true, + "domain": false, + "orient": "bottom", + "labelAngle": -20, + "labelAlign": "right", + "title": {"signal": "timestamp ? 'timestamp' : 'buildId'"}, + "titlePadding": 10, + "tickCount": 5, + "encode": { + "labels": { + "interactive": true, + "update": {"tooltip": {"signal": "datum.label"}} + } + } + }, + { + "scale": "y", + "grid": true, + "domain": false, + "orient": "left", + "titlePadding": 10, + "title": "ms", + "titleAnchor": "end", + "titleAngle": 0 + } + ], + "scales": [ + { + "name": "x", + "type": "point", + "range": "width", + "domain": {"data": "table", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}} + }, + { + "name": "y", + "type": "linear", + "range": "height", + "nice": true, + "zero": true, + "domain": {"data": "table", "field": "metricValue"} + }, + { + "name": "color", + "type": "ordinal", + "range": "category", + "domain": {"data": "table", "field": "metricName"} + }, + { + "name": "size", + "type": "linear", + "round": true, + "nice": false, + "zero": true, + "domain": {"data": "table", "field": "metricError"}, + "range": [1, 100] + } + ], + "legends": [ + { + "title": "Cases", + "stroke": "color", + "strokeColor": "#ccc", + "padding": 8, + "cornerRadius": 4, + "symbolLimit": 50, + "encode": { + "symbols": { + "name": "legendSymbol", + "interactive": true, + "update": { + "fill": {"value": "transparent"}, + "strokeWidth": {"value": 2}, + "opacity": [ + { + "comment": "here `datum` is `selected` data set", + "test": "!length(data('selected')) || indata('selected', 'value', datum.value)", + "value": 0.7 + }, + {"value": 0.15} + ], + "size": {"value": 64} + } + }, + "labels": { + "name": "legendLabel", + "interactive": true, + "update": { + "opacity": [ + { + "comment": "here `datum` is `selected` data set", + "test": "!length(data('selected')) || indata('selected', 'value', datum.value)", + "value": 1 + }, + {"value": 0.25} + ] + } + } + } + } + ], + "marks": [ + { + "type": "group", + "from": { + "facet": {"name": "series", "data": "table", "groupby": "metricName"} + }, + "marks": [ + { + "type": "line", + "from": {"data": "series"}, + "encode": { + "hover": {"opacity": {"value": 1}, "strokeWidth": {"value": 4}}, + "update": { + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}}, + "y": {"scale": "y", "field": "metricValue"}, + "strokeWidth": {"value": 2}, + "opacity": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "value": 0.7 + }, + {"value": 0.15} + ], + "stroke": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "scale": "color", + "field": "metricName" + }, + {"value": "#ccc"} + ] + } + } + }, + { + "type": "symbol", + "from": {"data": "series"}, + "encode": { + "enter": { + "fill": {"value": "#B00"}, + "size": [{ "test": "datum.hasError", "value": 250 }, {"value": 0}], + "shape": {"value": "cross"}, + "angle": {"value": 45}, + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}}, + "y": {"scale": "y", "field": "metricValue"}, + "strokeWidth": {"value": 1}, + "opacity": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && datum.hasError && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "value": 1 + }, + {"value": 0.15} + ] + }, + "update": { + "opacity": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && datum.hasError && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "value": 1 + }, + {"value": 0.15} + ] + } + }, + "zindex": 1 + }, + { + "type": "symbol", + "from": {"data": "series"}, + "encode": { + "enter": { + "tooltip": { + "signal": "datum.metricName + ': ' + datum.metricValue + ' ms'" + }, + "href": {"field": "url"}, + "cursor": {"value": "pointer"}, + "size": {"scale": "size", "field": "metricError"}, + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}}, + "y": {"scale": "y", "field": "metricValue"}, + "strokeWidth": {"value": 1}, + "fill": {"scale": "color", "field": "metricName"} + }, + "update": { + "opacity": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "value": 1 + }, + {"value": 0.15} + ] + } + }, + "zindex": 2 + } + ] + } + ] +} diff --git a/idea/performanceTests/resources/TestData completion-basic-keyword - vega.js b/idea/performanceTests/resources/TestData completion-basic-keyword - vega.js new file mode 100644 index 00000000000..7d9b2df47a1 --- /dev/null +++ b/idea/performanceTests/resources/TestData completion-basic-keyword - vega.js @@ -0,0 +1,496 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +{ + "note": "May https://vega.github.io/vega/docs/ be with you", + "$schema": "https://vega.github.io/schema/vega/v4.3.0.json", + "description": "TestData completion-basic-keyword", + "title": "TestData completion-basic-keyword", + "width": 800, + "height": 500, + "padding": 5, + "autosize": {"type": "pad", "resize": true}, + "signals": [ + { + "name": "clear", + "value": true, + "on": [ + {"events": "mouseup[!event.item]", "update": "true", "force": true} + ] + }, + { + "name": "shift", + "value": false, + "on": [ + { + "events": "@legendSymbol:click, @legendLabel:click", + "update": "event.shiftKey", + "force": true + } + ] + }, + { + "name": "clicked", + "value": null, + "on": [ + { + "events": "@legendSymbol:click, @legendLabel:click", + "comment": "note: here `datum` is `selected` data set", + "update": "{value: datum.value}", + "force": true + } + ] + }, + { + "name": "brush", + "value": 0, + "on": [ + {"events": {"signal": "clear"}, "update": "clear ? [0, 0] : brush"}, + {"events": "@xaxis:mousedown", "update": "[x(), x()]"}, + { + "events": "[@xaxis:mousedown, window:mouseup] > window:mousemove!", + "update": "[brush[0], clamp(x(), 0, width)]" + }, + { + "events": {"signal": "delta"}, + "update": "clampRange([anchor[0] + delta, anchor[1] + delta], 0, width)" + } + ] + }, + { + "name": "anchor", + "value": null, + "on": [{"events": "@brush:mousedown", "update": "slice(brush)"}] + }, + { + "name": "xdown", + "value": 0, + "on": [{"events": "@brush:mousedown", "update": "x()"}] + }, + { + "name": "delta", + "value": 0, + "on": [ + { + "events": "[@brush:mousedown, window:mouseup] > window:mousemove!", + "update": "x() - xdown" + } + ] + }, + { + "name": "domain", + "on": [ + { + "events": {"signal": "brush"}, + "update": "span(brush) ? invert('x', brush) : null" + } + ] + }, + {"name": "timestamp", "value": true, "bind": {"input": "checkbox"}} + ], + "data": [ + { + "name": "table", + "comment": "To test chart in VEGA editor https://vega.github.io/editor/#/ change `_values` to `values` and rename `url` property", + "_values": { + "aggregations" : { + "benchmark" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 0, + "buckets" : [ + { + "key" : "highlight", + "doc_count" : 1034, + "name" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 0, + "buckets" : [ + { + "key" : "Annotations", + "doc_count" : 23, + "values" : { + "buckets" : [ + { + "key_as_string" : "2020-11-02T09:00:00.000Z", + "key" : 1604307600000, + "doc_count" : 3, + "avgError" : { + "value" : 1.0 + }, + "avgValue" : { + "value" : 129.0 + }, + "buildId" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 1, + "buckets" : [ + { + "key" : 93277596, + "doc_count" : 2 + } + ] + } + }, + { + "key_as_string" : "2020-11-02T21:00:00.000Z", + "key" : 1604350800000, + "doc_count" : 3, + "avgError" : { + "value" : 1.0 + }, + "avgValue" : { + "value" : 41.0 + }, + "buildId" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 2, + "buckets" : [ + { + "key" : 93400366, + "doc_count" : 1 + } + ] + } + }, + { + "key_as_string" : "2020-11-03T09:00:00.000Z", + "key" : 1604394000000, + "doc_count" : 2, + "avgError" : { + "value" : 1.5 + }, + "avgValue" : { + "value" : 42.0 + }, + "buildId" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 1, + "buckets" : [ + { + "key" : 93507855, + "doc_count" : 1 + } + ] + } + } + ], + "interval" : "12h" + } + } + ] + } + } + ] + } + } + }, + "url": { + //"comment": "source index pattern", + "index": "kotlin_ide_benchmarks*", + //"comment": "it's a body of ES _search query to check query place it into `POST /kotlin_ide_benchmarks*/_search`", + //"comment": "it uses Kibana specific %timefilter% for time frame selection", + "body": { + "size": 0, + "query": { + "bool": { + "must": [ + { + "bool": { + "must_not": [ + {"exists": {"field": "warmUp"}}, + {"exists": {"field": "synthetic"}} + ] + } + }, + {"term": {"benchmark.keyword": "completion-basic-keyword"}}, + {"range": {"buildTimestamp": {"%timefilter%": true}}} + ] + } + }, + "aggs": { + "benchmark": { + "terms": { + "field": "benchmark.keyword", + "size": 50 + }, + "aggs": { + "name": { + "terms": { + "field": "name.keyword", + "size": 50 + }, + "aggs": { + "values": { + "auto_date_histogram": { + "buckets": 30, + "field": "buildTimestamp", + "minimum_interval": "hour" + }, + "aggs": { + "buildId": { + "terms": { + "size": 1, + "field": "buildId" + } + }, + "avgValue":{ + "avg": { + "field": "metricValue" + } + }, + "avgError":{ + "avg": { + "field": "metricError" + } + } + } + } + } + } + } + } + } + } + }, + "format": {"property": "aggregations"}, + "comment": "we need to have follow data: \"buildId\", \"metricName\", \"metricValue\" and \"metricError\"", + "comment": "so it has to be array of {\"buildId\": \"...\", \"metricName\": \"...\", \"metricValue\": ..., \"metricError\": ...}", + "transform": [ + {"type": "project", "fields": ["benchmark"]}, + {"type": "flatten", "fields": ["benchmark.buckets"], "as": ["benchmark_buckets"]}, + {"type": "project", "fields": ["benchmark_buckets.key", "benchmark_buckets.name"], "as": ["benchmark", "benchmark_buckets_name"]}, + {"type": "flatten", "fields": ["benchmark_buckets_name.buckets"], "as": ["name_buckets"]}, + {"type": "project", "fields": ["benchmark", "name_buckets.key", "name_buckets.values"], "as": ["benchmark", "name", "name_values"]}, + {"type": "flatten", "fields": ["name_values.buckets"], "as": ["name_values_buckets"]}, + {"type": "project", "fields": ["benchmark", "name", "name_values_buckets.key", "name_values_buckets.key_as_string", "name_values_buckets.avgError", "name_values_buckets.avgValue", "name_values_buckets.buildId.buckets"], "as": ["benchmark", "metricName", "buildTimestamp", "timestamp_value", "avgError", "avgValue", "buildId_buckets"]}, + {"type": "formula", "as": "metricError", "expr": "datum.avgError.value"}, + {"type": "formula", "as": "metricValue", "expr": "datum.avgValue.value"}, + {"type": "flatten", "fields": ["buildId_buckets"], "as": ["buildId_values"]}, + {"type": "formula", "as": "buildId", "expr": "datum.buildId_values.key"}, + { + "type": "formula", + "as": "timestamp", + "expr": "timeFormat(toDate(datum.buildTimestamp), '%Y-%m-%d %H:%M')" + }, + { + "comment": "create `url` value that points to TC build", + "type": "formula", + "as": "url", + "expr": "'https://buildserver.labs.intellij.net/buildConfiguration/Kotlin_Benchmarks_PluginPerformanceTests_IdeaPluginPerformanceTests/' + datum.buildId" + }, + {"type": "collect","sort": {"field": "timestamp"}} + ] + }, + { + "name": "selected", + "on": [ + {"trigger": "clear", "remove": true}, + {"trigger": "!shift", "remove": true}, + {"trigger": "!shift && clicked", "insert": "clicked"}, + {"trigger": "shift && clicked", "toggle": "clicked"} + ] + } + ], + "axes": [ + { + "scale": "x", + "grid": true, + "domain": false, + "orient": "bottom", + "labelAngle": -20, + "labelAlign": "right", + "title": {"signal": "timestamp ? 'timestamp' : 'buildId'"}, + "titlePadding": 10, + "tickCount": 5, + "encode": { + "labels": { + "interactive": true, + "update": {"tooltip": {"signal": "datum.label"}} + } + } + }, + { + "scale": "y", + "grid": true, + "domain": false, + "orient": "left", + "titlePadding": 10, + "title": "ms", + "titleAnchor": "end", + "titleAngle": 0 + } + ], + "scales": [ + { + "name": "x", + "type": "point", + "range": "width", + "domain": {"data": "table", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}} + }, + { + "name": "y", + "type": "linear", + "range": "height", + "nice": true, + "zero": true, + "domain": {"data": "table", "field": "metricValue"} + }, + { + "name": "color", + "type": "ordinal", + "range": "category", + "domain": {"data": "table", "field": "metricName"} + }, + { + "name": "size", + "type": "linear", + "round": true, + "nice": false, + "zero": true, + "domain": {"data": "table", "field": "metricError"}, + "range": [1, 100] + } + ], + "legends": [ + { + "title": "Cases", + "stroke": "color", + "strokeColor": "#ccc", + "padding": 8, + "cornerRadius": 4, + "symbolLimit": 50, + "encode": { + "symbols": { + "name": "legendSymbol", + "interactive": true, + "update": { + "fill": {"value": "transparent"}, + "strokeWidth": {"value": 2}, + "opacity": [ + { + "comment": "here `datum` is `selected` data set", + "test": "!length(data('selected')) || indata('selected', 'value', datum.value)", + "value": 0.7 + }, + {"value": 0.15} + ], + "size": {"value": 64} + } + }, + "labels": { + "name": "legendLabel", + "interactive": true, + "update": { + "opacity": [ + { + "comment": "here `datum` is `selected` data set", + "test": "!length(data('selected')) || indata('selected', 'value', datum.value)", + "value": 1 + }, + {"value": 0.25} + ] + } + } + } + } + ], + "marks": [ + { + "type": "group", + "from": { + "facet": {"name": "series", "data": "table", "groupby": "metricName"} + }, + "marks": [ + { + "type": "line", + "from": {"data": "series"}, + "encode": { + "hover": {"opacity": {"value": 1}, "strokeWidth": {"value": 4}}, + "update": { + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}}, + "y": {"scale": "y", "field": "metricValue"}, + "strokeWidth": {"value": 2}, + "opacity": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "value": 0.7 + }, + {"value": 0.15} + ], + "stroke": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "scale": "color", + "field": "metricName" + }, + {"value": "#ccc"} + ] + } + } + }, + { + "type": "symbol", + "from": {"data": "series"}, + "encode": { + "enter": { + "fill": {"value": "#B00"}, + "size": [{ "test": "datum.hasError", "value": 250 }, {"value": 0}], + "shape": {"value": "cross"}, + "angle": {"value": 45}, + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}}, + "y": {"scale": "y", "field": "metricValue"}, + "strokeWidth": {"value": 1}, + "opacity": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && datum.hasError && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "value": 1 + }, + {"value": 0.15} + ] + }, + "update": { + "opacity": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && datum.hasError && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "value": 1 + }, + {"value": 0.15} + ] + } + }, + "zindex": 1 + }, + { + "type": "symbol", + "from": {"data": "series"}, + "encode": { + "enter": { + "tooltip": { + "signal": "datum.metricName + ': ' + datum.metricValue + ' ms'" + }, + "href": {"field": "url"}, + "cursor": {"value": "pointer"}, + "size": {"scale": "size", "field": "metricError"}, + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}}, + "y": {"scale": "y", "field": "metricValue"}, + "strokeWidth": {"value": 1}, + "fill": {"scale": "color", "field": "metricName"} + }, + "update": { + "opacity": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "value": 1 + }, + {"value": 0.15} + ] + } + }, + "zindex": 2 + } + ] + } + ] +} diff --git a/idea/performanceTests/resources/TestData completion-incremental - vega.js b/idea/performanceTests/resources/TestData completion-incremental - vega.js new file mode 100644 index 00000000000..6b50dabb863 --- /dev/null +++ b/idea/performanceTests/resources/TestData completion-incremental - vega.js @@ -0,0 +1,496 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +{ + "note": "May https://vega.github.io/vega/docs/ be with you", + "$schema": "https://vega.github.io/schema/vega/v4.3.0.json", + "description": "TestData completion-incremental", + "title": "TestData completion-incremental", + "width": 800, + "height": 500, + "padding": 5, + "autosize": {"type": "pad", "resize": true}, + "signals": [ + { + "name": "clear", + "value": true, + "on": [ + {"events": "mouseup[!event.item]", "update": "true", "force": true} + ] + }, + { + "name": "shift", + "value": false, + "on": [ + { + "events": "@legendSymbol:click, @legendLabel:click", + "update": "event.shiftKey", + "force": true + } + ] + }, + { + "name": "clicked", + "value": null, + "on": [ + { + "events": "@legendSymbol:click, @legendLabel:click", + "comment": "note: here `datum` is `selected` data set", + "update": "{value: datum.value}", + "force": true + } + ] + }, + { + "name": "brush", + "value": 0, + "on": [ + {"events": {"signal": "clear"}, "update": "clear ? [0, 0] : brush"}, + {"events": "@xaxis:mousedown", "update": "[x(), x()]"}, + { + "events": "[@xaxis:mousedown, window:mouseup] > window:mousemove!", + "update": "[brush[0], clamp(x(), 0, width)]" + }, + { + "events": {"signal": "delta"}, + "update": "clampRange([anchor[0] + delta, anchor[1] + delta], 0, width)" + } + ] + }, + { + "name": "anchor", + "value": null, + "on": [{"events": "@brush:mousedown", "update": "slice(brush)"}] + }, + { + "name": "xdown", + "value": 0, + "on": [{"events": "@brush:mousedown", "update": "x()"}] + }, + { + "name": "delta", + "value": 0, + "on": [ + { + "events": "[@brush:mousedown, window:mouseup] > window:mousemove!", + "update": "x() - xdown" + } + ] + }, + { + "name": "domain", + "on": [ + { + "events": {"signal": "brush"}, + "update": "span(brush) ? invert('x', brush) : null" + } + ] + }, + {"name": "timestamp", "value": true, "bind": {"input": "checkbox"}} + ], + "data": [ + { + "name": "table", + "comment": "To test chart in VEGA editor https://vega.github.io/editor/#/ change `_values` to `values` and rename `url` property", + "_values": { + "aggregations" : { + "benchmark" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 0, + "buckets" : [ + { + "key" : "highlight", + "doc_count" : 1034, + "name" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 0, + "buckets" : [ + { + "key" : "Annotations", + "doc_count" : 23, + "values" : { + "buckets" : [ + { + "key_as_string" : "2020-11-02T09:00:00.000Z", + "key" : 1604307600000, + "doc_count" : 3, + "avgError" : { + "value" : 1.0 + }, + "avgValue" : { + "value" : 129.0 + }, + "buildId" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 1, + "buckets" : [ + { + "key" : 93277596, + "doc_count" : 2 + } + ] + } + }, + { + "key_as_string" : "2020-11-02T21:00:00.000Z", + "key" : 1604350800000, + "doc_count" : 3, + "avgError" : { + "value" : 1.0 + }, + "avgValue" : { + "value" : 41.0 + }, + "buildId" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 2, + "buckets" : [ + { + "key" : 93400366, + "doc_count" : 1 + } + ] + } + }, + { + "key_as_string" : "2020-11-03T09:00:00.000Z", + "key" : 1604394000000, + "doc_count" : 2, + "avgError" : { + "value" : 1.5 + }, + "avgValue" : { + "value" : 42.0 + }, + "buildId" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 1, + "buckets" : [ + { + "key" : 93507855, + "doc_count" : 1 + } + ] + } + } + ], + "interval" : "12h" + } + } + ] + } + } + ] + } + } + }, + "url": { + //"comment": "source index pattern", + "index": "kotlin_ide_benchmarks*", + //"comment": "it's a body of ES _search query to check query place it into `POST /kotlin_ide_benchmarks*/_search`", + //"comment": "it uses Kibana specific %timefilter% for time frame selection", + "body": { + "size": 0, + "query": { + "bool": { + "must": [ + { + "bool": { + "must_not": [ + {"exists": {"field": "warmUp"}}, + {"exists": {"field": "synthetic"}} + ] + } + }, + {"term": {"benchmark.keyword": "completion-incremental"}}, + {"range": {"buildTimestamp": {"%timefilter%": true}}} + ] + } + }, + "aggs": { + "benchmark": { + "terms": { + "field": "benchmark.keyword", + "size": 50 + }, + "aggs": { + "name": { + "terms": { + "field": "name.keyword", + "size": 50 + }, + "aggs": { + "values": { + "auto_date_histogram": { + "buckets": 30, + "field": "buildTimestamp", + "minimum_interval": "hour" + }, + "aggs": { + "buildId": { + "terms": { + "size": 1, + "field": "buildId" + } + }, + "avgValue":{ + "avg": { + "field": "metricValue" + } + }, + "avgError":{ + "avg": { + "field": "metricError" + } + } + } + } + } + } + } + } + } + } + }, + "format": {"property": "aggregations"}, + "comment": "we need to have follow data: \"buildId\", \"metricName\", \"metricValue\" and \"metricError\"", + "comment": "so it has to be array of {\"buildId\": \"...\", \"metricName\": \"...\", \"metricValue\": ..., \"metricError\": ...}", + "transform": [ + {"type": "project", "fields": ["benchmark"]}, + {"type": "flatten", "fields": ["benchmark.buckets"], "as": ["benchmark_buckets"]}, + {"type": "project", "fields": ["benchmark_buckets.key", "benchmark_buckets.name"], "as": ["benchmark", "benchmark_buckets_name"]}, + {"type": "flatten", "fields": ["benchmark_buckets_name.buckets"], "as": ["name_buckets"]}, + {"type": "project", "fields": ["benchmark", "name_buckets.key", "name_buckets.values"], "as": ["benchmark", "name", "name_values"]}, + {"type": "flatten", "fields": ["name_values.buckets"], "as": ["name_values_buckets"]}, + {"type": "project", "fields": ["benchmark", "name", "name_values_buckets.key", "name_values_buckets.key_as_string", "name_values_buckets.avgError", "name_values_buckets.avgValue", "name_values_buckets.buildId.buckets"], "as": ["benchmark", "metricName", "buildTimestamp", "timestamp_value", "avgError", "avgValue", "buildId_buckets"]}, + {"type": "formula", "as": "metricError", "expr": "datum.avgError.value"}, + {"type": "formula", "as": "metricValue", "expr": "datum.avgValue.value"}, + {"type": "flatten", "fields": ["buildId_buckets"], "as": ["buildId_values"]}, + {"type": "formula", "as": "buildId", "expr": "datum.buildId_values.key"}, + { + "type": "formula", + "as": "timestamp", + "expr": "timeFormat(toDate(datum.buildTimestamp), '%Y-%m-%d %H:%M')" + }, + { + "comment": "create `url` value that points to TC build", + "type": "formula", + "as": "url", + "expr": "'https://buildserver.labs.intellij.net/buildConfiguration/Kotlin_Benchmarks_PluginPerformanceTests_IdeaPluginPerformanceTests/' + datum.buildId" + }, + {"type": "collect","sort": {"field": "timestamp"}} + ] + }, + { + "name": "selected", + "on": [ + {"trigger": "clear", "remove": true}, + {"trigger": "!shift", "remove": true}, + {"trigger": "!shift && clicked", "insert": "clicked"}, + {"trigger": "shift && clicked", "toggle": "clicked"} + ] + } + ], + "axes": [ + { + "scale": "x", + "grid": true, + "domain": false, + "orient": "bottom", + "labelAngle": -20, + "labelAlign": "right", + "title": {"signal": "timestamp ? 'timestamp' : 'buildId'"}, + "titlePadding": 10, + "tickCount": 5, + "encode": { + "labels": { + "interactive": true, + "update": {"tooltip": {"signal": "datum.label"}} + } + } + }, + { + "scale": "y", + "grid": true, + "domain": false, + "orient": "left", + "titlePadding": 10, + "title": "ms", + "titleAnchor": "end", + "titleAngle": 0 + } + ], + "scales": [ + { + "name": "x", + "type": "point", + "range": "width", + "domain": {"data": "table", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}} + }, + { + "name": "y", + "type": "linear", + "range": "height", + "nice": true, + "zero": true, + "domain": {"data": "table", "field": "metricValue"} + }, + { + "name": "color", + "type": "ordinal", + "range": "category", + "domain": {"data": "table", "field": "metricName"} + }, + { + "name": "size", + "type": "linear", + "round": true, + "nice": false, + "zero": true, + "domain": {"data": "table", "field": "metricError"}, + "range": [1, 100] + } + ], + "legends": [ + { + "title": "Cases", + "stroke": "color", + "strokeColor": "#ccc", + "padding": 8, + "cornerRadius": 4, + "symbolLimit": 50, + "encode": { + "symbols": { + "name": "legendSymbol", + "interactive": true, + "update": { + "fill": {"value": "transparent"}, + "strokeWidth": {"value": 2}, + "opacity": [ + { + "comment": "here `datum` is `selected` data set", + "test": "!length(data('selected')) || indata('selected', 'value', datum.value)", + "value": 0.7 + }, + {"value": 0.15} + ], + "size": {"value": 64} + } + }, + "labels": { + "name": "legendLabel", + "interactive": true, + "update": { + "opacity": [ + { + "comment": "here `datum` is `selected` data set", + "test": "!length(data('selected')) || indata('selected', 'value', datum.value)", + "value": 1 + }, + {"value": 0.25} + ] + } + } + } + } + ], + "marks": [ + { + "type": "group", + "from": { + "facet": {"name": "series", "data": "table", "groupby": "metricName"} + }, + "marks": [ + { + "type": "line", + "from": {"data": "series"}, + "encode": { + "hover": {"opacity": {"value": 1}, "strokeWidth": {"value": 4}}, + "update": { + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}}, + "y": {"scale": "y", "field": "metricValue"}, + "strokeWidth": {"value": 2}, + "opacity": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "value": 0.7 + }, + {"value": 0.15} + ], + "stroke": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "scale": "color", + "field": "metricName" + }, + {"value": "#ccc"} + ] + } + } + }, + { + "type": "symbol", + "from": {"data": "series"}, + "encode": { + "enter": { + "fill": {"value": "#B00"}, + "size": [{ "test": "datum.hasError", "value": 250 }, {"value": 0}], + "shape": {"value": "cross"}, + "angle": {"value": 45}, + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}}, + "y": {"scale": "y", "field": "metricValue"}, + "strokeWidth": {"value": 1}, + "opacity": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && datum.hasError && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "value": 1 + }, + {"value": 0.15} + ] + }, + "update": { + "opacity": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && datum.hasError && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "value": 1 + }, + {"value": 0.15} + ] + } + }, + "zindex": 1 + }, + { + "type": "symbol", + "from": {"data": "series"}, + "encode": { + "enter": { + "tooltip": { + "signal": "datum.metricName + ': ' + datum.metricValue + ' ms'" + }, + "href": {"field": "url"}, + "cursor": {"value": "pointer"}, + "size": {"scale": "size", "field": "metricError"}, + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}}, + "y": {"scale": "y", "field": "metricValue"}, + "strokeWidth": {"value": 1}, + "fill": {"scale": "color", "field": "metricName"} + }, + "update": { + "opacity": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "value": 1 + }, + {"value": 0.15} + ] + } + }, + "zindex": 2 + } + ] + } + ] +} diff --git a/idea/performanceTests/resources/TestData completion-smart - vega.js b/idea/performanceTests/resources/TestData completion-smart - vega.js new file mode 100644 index 00000000000..e456b613761 --- /dev/null +++ b/idea/performanceTests/resources/TestData completion-smart - vega.js @@ -0,0 +1,496 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +{ + "note": "May https://vega.github.io/vega/docs/ be with you", + "$schema": "https://vega.github.io/schema/vega/v4.3.0.json", + "description": "TestData completion-smart", + "title": "TestData completion-smart", + "width": 800, + "height": 500, + "padding": 5, + "autosize": {"type": "pad", "resize": true}, + "signals": [ + { + "name": "clear", + "value": true, + "on": [ + {"events": "mouseup[!event.item]", "update": "true", "force": true} + ] + }, + { + "name": "shift", + "value": false, + "on": [ + { + "events": "@legendSymbol:click, @legendLabel:click", + "update": "event.shiftKey", + "force": true + } + ] + }, + { + "name": "clicked", + "value": null, + "on": [ + { + "events": "@legendSymbol:click, @legendLabel:click", + "comment": "note: here `datum` is `selected` data set", + "update": "{value: datum.value}", + "force": true + } + ] + }, + { + "name": "brush", + "value": 0, + "on": [ + {"events": {"signal": "clear"}, "update": "clear ? [0, 0] : brush"}, + {"events": "@xaxis:mousedown", "update": "[x(), x()]"}, + { + "events": "[@xaxis:mousedown, window:mouseup] > window:mousemove!", + "update": "[brush[0], clamp(x(), 0, width)]" + }, + { + "events": {"signal": "delta"}, + "update": "clampRange([anchor[0] + delta, anchor[1] + delta], 0, width)" + } + ] + }, + { + "name": "anchor", + "value": null, + "on": [{"events": "@brush:mousedown", "update": "slice(brush)"}] + }, + { + "name": "xdown", + "value": 0, + "on": [{"events": "@brush:mousedown", "update": "x()"}] + }, + { + "name": "delta", + "value": 0, + "on": [ + { + "events": "[@brush:mousedown, window:mouseup] > window:mousemove!", + "update": "x() - xdown" + } + ] + }, + { + "name": "domain", + "on": [ + { + "events": {"signal": "brush"}, + "update": "span(brush) ? invert('x', brush) : null" + } + ] + }, + {"name": "timestamp", "value": true, "bind": {"input": "checkbox"}} + ], + "data": [ + { + "name": "table", + "comment": "To test chart in VEGA editor https://vega.github.io/editor/#/ change `_values` to `values` and rename `url` property", + "_values": { + "aggregations" : { + "benchmark" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 0, + "buckets" : [ + { + "key" : "highlight", + "doc_count" : 1034, + "name" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 0, + "buckets" : [ + { + "key" : "Annotations", + "doc_count" : 23, + "values" : { + "buckets" : [ + { + "key_as_string" : "2020-11-02T09:00:00.000Z", + "key" : 1604307600000, + "doc_count" : 3, + "avgError" : { + "value" : 1.0 + }, + "avgValue" : { + "value" : 129.0 + }, + "buildId" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 1, + "buckets" : [ + { + "key" : 93277596, + "doc_count" : 2 + } + ] + } + }, + { + "key_as_string" : "2020-11-02T21:00:00.000Z", + "key" : 1604350800000, + "doc_count" : 3, + "avgError" : { + "value" : 1.0 + }, + "avgValue" : { + "value" : 41.0 + }, + "buildId" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 2, + "buckets" : [ + { + "key" : 93400366, + "doc_count" : 1 + } + ] + } + }, + { + "key_as_string" : "2020-11-03T09:00:00.000Z", + "key" : 1604394000000, + "doc_count" : 2, + "avgError" : { + "value" : 1.5 + }, + "avgValue" : { + "value" : 42.0 + }, + "buildId" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 1, + "buckets" : [ + { + "key" : 93507855, + "doc_count" : 1 + } + ] + } + } + ], + "interval" : "12h" + } + } + ] + } + } + ] + } + } + }, + "url": { + //"comment": "source index pattern", + "index": "kotlin_ide_benchmarks*", + //"comment": "it's a body of ES _search query to check query place it into `POST /kotlin_ide_benchmarks*/_search`", + //"comment": "it uses Kibana specific %timefilter% for time frame selection", + "body": { + "size": 0, + "query": { + "bool": { + "must": [ + { + "bool": { + "must_not": [ + {"exists": {"field": "warmUp"}}, + {"exists": {"field": "synthetic"}} + ] + } + }, + {"term": {"benchmark.keyword": "completion-smart"}}, + {"range": {"buildTimestamp": {"%timefilter%": true}}} + ] + } + }, + "aggs": { + "benchmark": { + "terms": { + "field": "benchmark.keyword", + "size": 50 + }, + "aggs": { + "name": { + "terms": { + "field": "name.keyword", + "size": 50 + }, + "aggs": { + "values": { + "auto_date_histogram": { + "buckets": 30, + "field": "buildTimestamp", + "minimum_interval": "hour" + }, + "aggs": { + "buildId": { + "terms": { + "size": 1, + "field": "buildId" + } + }, + "avgValue":{ + "avg": { + "field": "metricValue" + } + }, + "avgError":{ + "avg": { + "field": "metricError" + } + } + } + } + } + } + } + } + } + } + }, + "format": {"property": "aggregations"}, + "comment": "we need to have follow data: \"buildId\", \"metricName\", \"metricValue\" and \"metricError\"", + "comment": "so it has to be array of {\"buildId\": \"...\", \"metricName\": \"...\", \"metricValue\": ..., \"metricError\": ...}", + "transform": [ + {"type": "project", "fields": ["benchmark"]}, + {"type": "flatten", "fields": ["benchmark.buckets"], "as": ["benchmark_buckets"]}, + {"type": "project", "fields": ["benchmark_buckets.key", "benchmark_buckets.name"], "as": ["benchmark", "benchmark_buckets_name"]}, + {"type": "flatten", "fields": ["benchmark_buckets_name.buckets"], "as": ["name_buckets"]}, + {"type": "project", "fields": ["benchmark", "name_buckets.key", "name_buckets.values"], "as": ["benchmark", "name", "name_values"]}, + {"type": "flatten", "fields": ["name_values.buckets"], "as": ["name_values_buckets"]}, + {"type": "project", "fields": ["benchmark", "name", "name_values_buckets.key", "name_values_buckets.key_as_string", "name_values_buckets.avgError", "name_values_buckets.avgValue", "name_values_buckets.buildId.buckets"], "as": ["benchmark", "metricName", "buildTimestamp", "timestamp_value", "avgError", "avgValue", "buildId_buckets"]}, + {"type": "formula", "as": "metricError", "expr": "datum.avgError.value"}, + {"type": "formula", "as": "metricValue", "expr": "datum.avgValue.value"}, + {"type": "flatten", "fields": ["buildId_buckets"], "as": ["buildId_values"]}, + {"type": "formula", "as": "buildId", "expr": "datum.buildId_values.key"}, + { + "type": "formula", + "as": "timestamp", + "expr": "timeFormat(toDate(datum.buildTimestamp), '%Y-%m-%d %H:%M')" + }, + { + "comment": "create `url` value that points to TC build", + "type": "formula", + "as": "url", + "expr": "'https://buildserver.labs.intellij.net/buildConfiguration/Kotlin_Benchmarks_PluginPerformanceTests_IdeaPluginPerformanceTests/' + datum.buildId" + }, + {"type": "collect","sort": {"field": "timestamp"}} + ] + }, + { + "name": "selected", + "on": [ + {"trigger": "clear", "remove": true}, + {"trigger": "!shift", "remove": true}, + {"trigger": "!shift && clicked", "insert": "clicked"}, + {"trigger": "shift && clicked", "toggle": "clicked"} + ] + } + ], + "axes": [ + { + "scale": "x", + "grid": true, + "domain": false, + "orient": "bottom", + "labelAngle": -20, + "labelAlign": "right", + "title": {"signal": "timestamp ? 'timestamp' : 'buildId'"}, + "titlePadding": 10, + "tickCount": 5, + "encode": { + "labels": { + "interactive": true, + "update": {"tooltip": {"signal": "datum.label"}} + } + } + }, + { + "scale": "y", + "grid": true, + "domain": false, + "orient": "left", + "titlePadding": 10, + "title": "ms", + "titleAnchor": "end", + "titleAngle": 0 + } + ], + "scales": [ + { + "name": "x", + "type": "point", + "range": "width", + "domain": {"data": "table", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}} + }, + { + "name": "y", + "type": "linear", + "range": "height", + "nice": true, + "zero": true, + "domain": {"data": "table", "field": "metricValue"} + }, + { + "name": "color", + "type": "ordinal", + "range": "category", + "domain": {"data": "table", "field": "metricName"} + }, + { + "name": "size", + "type": "linear", + "round": true, + "nice": false, + "zero": true, + "domain": {"data": "table", "field": "metricError"}, + "range": [1, 100] + } + ], + "legends": [ + { + "title": "Cases", + "stroke": "color", + "strokeColor": "#ccc", + "padding": 8, + "cornerRadius": 4, + "symbolLimit": 50, + "encode": { + "symbols": { + "name": "legendSymbol", + "interactive": true, + "update": { + "fill": {"value": "transparent"}, + "strokeWidth": {"value": 2}, + "opacity": [ + { + "comment": "here `datum` is `selected` data set", + "test": "!length(data('selected')) || indata('selected', 'value', datum.value)", + "value": 0.7 + }, + {"value": 0.15} + ], + "size": {"value": 64} + } + }, + "labels": { + "name": "legendLabel", + "interactive": true, + "update": { + "opacity": [ + { + "comment": "here `datum` is `selected` data set", + "test": "!length(data('selected')) || indata('selected', 'value', datum.value)", + "value": 1 + }, + {"value": 0.25} + ] + } + } + } + } + ], + "marks": [ + { + "type": "group", + "from": { + "facet": {"name": "series", "data": "table", "groupby": "metricName"} + }, + "marks": [ + { + "type": "line", + "from": {"data": "series"}, + "encode": { + "hover": {"opacity": {"value": 1}, "strokeWidth": {"value": 4}}, + "update": { + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}}, + "y": {"scale": "y", "field": "metricValue"}, + "strokeWidth": {"value": 2}, + "opacity": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "value": 0.7 + }, + {"value": 0.15} + ], + "stroke": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "scale": "color", + "field": "metricName" + }, + {"value": "#ccc"} + ] + } + } + }, + { + "type": "symbol", + "from": {"data": "series"}, + "encode": { + "enter": { + "fill": {"value": "#B00"}, + "size": [{ "test": "datum.hasError", "value": 250 }, {"value": 0}], + "shape": {"value": "cross"}, + "angle": {"value": 45}, + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}}, + "y": {"scale": "y", "field": "metricValue"}, + "strokeWidth": {"value": 1}, + "opacity": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && datum.hasError && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "value": 1 + }, + {"value": 0.15} + ] + }, + "update": { + "opacity": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && datum.hasError && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "value": 1 + }, + {"value": 0.15} + ] + } + }, + "zindex": 1 + }, + { + "type": "symbol", + "from": {"data": "series"}, + "encode": { + "enter": { + "tooltip": { + "signal": "datum.metricName + ': ' + datum.metricValue + ' ms'" + }, + "href": {"field": "url"}, + "cursor": {"value": "pointer"}, + "size": {"scale": "size", "field": "metricError"}, + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}}, + "y": {"scale": "y", "field": "metricValue"}, + "strokeWidth": {"value": 1}, + "fill": {"scale": "color", "field": "metricName"} + }, + "update": { + "opacity": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "value": 1 + }, + {"value": 0.15} + ] + } + }, + "zindex": 2 + } + ] + } + ] +} diff --git a/idea/performanceTests/resources/TestData fir highlight - vega.js b/idea/performanceTests/resources/TestData fir highlight - vega.js new file mode 100644 index 00000000000..d453d48653e --- /dev/null +++ b/idea/performanceTests/resources/TestData fir highlight - vega.js @@ -0,0 +1,508 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +{ + "note": "May https://vega.github.io/vega/docs/ be with you", + "$schema": "https://vega.github.io/schema/vega/v4.3.0.json", + "description": "TestData FIR highlight", + "title": "TestData FIR highlight", + "width": 800, + "height": 400, + "padding": 5, + "autosize": {"type": "pad", "resize": true}, + "signals": [ + { + "name": "clear", + "value": true, + "on": [ + {"events": "mouseup[!event.item]", "update": "true", "force": true} + ] + }, + { + "name": "shift", + "value": false, + "on": [ + { + "events": "@legendSymbol:click, @legendLabel:click", + "update": "event.shiftKey", + "force": true + } + ] + }, + { + "name": "clicked", + "value": null, + "on": [ + { + "events": "@legendSymbol:click, @legendLabel:click", + "comment": "note: here `datum` is `selected` data set", + "update": "{value: datum.value}", + "force": true + } + ] + }, + { + "name": "brush", + "value": 0, + "on": [ + {"events": {"signal": "clear"}, "update": "clear ? [0, 0] : brush"}, + {"events": "@xaxis:mousedown", "update": "[x(), x()]"}, + { + "events": "[@xaxis:mousedown, window:mouseup] > window:mousemove!", + "update": "[brush[0], clamp(x(), 0, width)]" + }, + { + "events": {"signal": "delta"}, + "update": "clampRange([anchor[0] + delta, anchor[1] + delta], 0, width)" + } + ] + }, + { + "name": "anchor", + "value": null, + "on": [{"events": "@brush:mousedown", "update": "slice(brush)"}] + }, + { + "name": "xdown", + "value": 0, + "on": [{"events": "@brush:mousedown", "update": "x()"}] + }, + { + "name": "delta", + "value": 0, + "on": [ + { + "events": "[@brush:mousedown, window:mouseup] > window:mousemove!", + "update": "x() - xdown" + } + ] + }, + { + "name": "domain", + "on": [ + { + "events": {"signal": "brush"}, + "update": "span(brush) ? invert('x', brush) : null" + } + ] + }, + {"name": "timestamp", "value": true, "bind": {"input": "checkbox"}} + ], + "data": [ + { + "name": "table", + "comment": "To test chart in VEGA editor https://vega.github.io/editor/#/ change `_values` to `values` and rename `url` property", + "_values": { + "aggregations" : { + "benchmark" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 0, + "buckets" : [ + { + "key" : "highlight", + "doc_count" : 1034, + "name" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 0, + "buckets" : [ + { + "key" : "Annotations", + "doc_count" : 23, + "values" : { + "buckets" : [ + { + "key_as_string" : "2020-11-02T09:00:00.000Z", + "key" : 1604307600000, + "doc_count" : 3, + "avgError" : { + "value" : 1.0 + }, + "avgValue" : { + "value" : 129.0 + }, + "buildId" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 1, + "buckets" : [ + { + "key" : 93277596, + "doc_count" : 2 + } + ] + } + }, + { + "key_as_string" : "2020-11-02T21:00:00.000Z", + "key" : 1604350800000, + "doc_count" : 3, + "avgError" : { + "value" : 1.0 + }, + "avgValue" : { + "value" : 41.0 + }, + "buildId" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 2, + "buckets" : [ + { + "key" : 93400366, + "doc_count" : 1 + } + ] + } + }, + { + "key_as_string" : "2020-11-03T09:00:00.000Z", + "key" : 1604394000000, + "doc_count" : 2, + "avgError" : { + "value" : 1.5 + }, + "avgValue" : { + "value" : 42.0 + }, + "buildId" : { + "doc_count_error_upper_bound" : 0, + "sum_other_doc_count" : 1, + "buckets" : [ + { + "key" : 93507855, + "doc_count" : 1 + } + ] + } + } + ], + "interval" : "12h" + } + } + ] + } + } + ] + } + } + }, + "url": { + //"comment": "source index pattern", + "index": "kotlin_ide_benchmarks*", + //"comment": "it's a body of ES _search query to check query place it into `POST /kotlin_ide_benchmarks*/_search`", + //"comment": "it uses Kibana specific %timefilter% for time frame selection", + "body": { + "size": 0, + "query": { + "bool": { + "must": [ + { + "bool": { + "must_not": [ + {"exists": {"field": "warmUp"}}, + {"exists": {"field": "synthetic"}} + ] + } + }, + { + "bool": { + "should": [ + {"term": {"benchmark.keyword": "firHighlight"}}, + {"term": {"benchmark.keyword": "highlight"}} + ] + } + }, + {"range": {"buildTimestamp": {"%timefilter%": true}}} + ] + } + }, + "aggs": { + "benchmark": { + "terms": { + "field": "benchmark.keyword", + "size": 500 + }, + "aggs": { + "name": { + "terms": { + "field": "name.keyword", + "size": 500 + }, + "aggs": { + "values": { + "auto_date_histogram": { + "buckets": 500, + "field": "buildTimestamp", + "minimum_interval": "hour" + }, + "aggs": { + "buildId": { + "terms": { + "size": 1, + "field": "buildId" + } + }, + "avgValue":{ + "avg": { + "field": "metricValue" + } + }, + "avgError":{ + "avg": { + "field": "metricError" + } + } + } + } + } + } + } + } + } + } + }, + "format": {"property": "aggregations"}, + "comment": "we need to have follow data: \"buildId\", \"metricName\", \"metricValue\" and \"metricError\"", + "comment": "so it has to be array of {\"buildId\": \"...\", \"metricName\": \"...\", \"metricValue\": ..., \"metricError\": ...}", + "transform": [ + {"type": "project", "fields": ["benchmark"]}, + {"type": "flatten", "fields": ["benchmark.buckets"], "as": ["benchmark_buckets"]}, + {"type": "project", "fields": ["benchmark_buckets.key", "benchmark_buckets.name"], "as": ["benchmark", "benchmark_buckets_name"]}, + {"type": "flatten", "fields": ["benchmark_buckets_name.buckets"], "as": ["name_buckets"]}, + {"type": "project", "fields": ["benchmark", "name_buckets.key", "name_buckets.values"], "as": ["benchmark", "name", "name_values"]}, + {"type": "flatten", "fields": ["name_values.buckets"], "as": ["name_values_buckets"]}, + {"type": "project", "fields": ["benchmark", "name", "name_values_buckets.key", "name_values_buckets.key_as_string", "name_values_buckets.avgError", "name_values_buckets.avgValue", "name_values_buckets.buildId.buckets"], "as": ["benchmark", "metricNameTmp", "buildTimestamp", "timestamp_value", "avgError", "avgValue", "buildId_buckets"]}, + {"type": "formula", "as": "metricError", "expr": "datum.avgError.value"}, + {"type": "formula", "as": "metricValue", "expr": "datum.avgValue.value"}, + {"type": "flatten", "fields": ["buildId_buckets"], "as": ["buildId_values"]}, + {"type": "formula", "as": "buildId", "expr": "datum.buildId_values.key"}, + { + "type": "formula", + "as": "metricName", + "expr": "(datum.benchmark == 'highlight' ? '' : 'fir:') + datum.metricNameTmp" + }, + { + "type": "formula", + "as": "timestamp", + "expr": "timeFormat(toDate(datum.buildTimestamp), '%Y-%m-%d %H:%M')" + }, + { + "comment": "create `url` value that points to TC build", + "type": "formula", + "as": "url", + "expr": "'https://buildserver.labs.intellij.net/buildConfiguration/Kotlin_Benchmarks_PluginPerformanceTests_IdeaPluginPerformanceTests/' + datum.buildId" + }, + {"type": "collect","sort": {"field": "timestamp"}} + ] + }, + { + "name": "selected", + "on": [ + {"trigger": "clear", "remove": true}, + {"trigger": "!shift", "remove": true}, + {"trigger": "!shift && clicked", "insert": "clicked"}, + {"trigger": "shift && clicked", "toggle": "clicked"} + ] + } + ], + "axes": [ + { + "scale": "x", + "grid": true, + "domain": false, + "orient": "bottom", + "labelAngle": -20, + "labelAlign": "right", + "title": {"signal": "timestamp ? 'timestamp' : 'buildId'"}, + "titlePadding": 10, + "tickCount": 5, + "encode": { + "labels": { + "interactive": true, + "update": {"tooltip": {"signal": "datum.label"}} + } + } + }, + { + "scale": "y", + "grid": true, + "domain": false, + "orient": "left", + "titlePadding": 10, + "title": "ms", + "titleAnchor": "end", + "titleAngle": 0 + } + ], + "scales": [ + { + "name": "x", + "type": "point", + "range": "width", + "domain": {"data": "table", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}} + }, + { + "name": "y", + "type": "linear", + "range": "height", + "nice": true, + "zero": true, + "domain": {"data": "table", "field": "metricValue"} + }, + { + "name": "color", + "type": "ordinal", + "range": "category", + "domain": {"data": "table", "field": "metricName"} + }, + { + "name": "size", + "type": "linear", + "round": true, + "nice": false, + "zero": true, + "domain": {"data": "table", "field": "metricError"}, + "range": [1, 100] + } + ], + "legends": [ + { + "title": "Cases", + "stroke": "color", + "strokeColor": "#ccc", + "padding": 8, + "cornerRadius": 4, + "symbolLimit": 50, + "encode": { + "symbols": { + "name": "legendSymbol", + "interactive": true, + "update": { + "fill": {"value": "transparent"}, + "strokeWidth": {"value": 2}, + "opacity": [ + { + "comment": "here `datum` is `selected` data set", + "test": "!length(data('selected')) || indata('selected', 'value', datum.value)", + "value": 0.7 + }, + {"value": 0.15} + ], + "size": {"value": 64} + } + }, + "labels": { + "name": "legendLabel", + "interactive": true, + "update": { + "opacity": [ + { + "comment": "here `datum` is `selected` data set", + "test": "!length(data('selected')) || indata('selected', 'value', datum.value)", + "value": 1 + }, + {"value": 0.25} + ] + } + } + } + } + ], + "marks": [ + { + "type": "group", + "from": { + "facet": {"name": "series", "data": "table", "groupby": "metricName"} + }, + "marks": [ + { + "type": "line", + "from": {"data": "series"}, + "encode": { + "hover": {"opacity": {"value": 1}, "strokeWidth": {"value": 4}}, + "update": { + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}}, + "y": {"scale": "y", "field": "metricValue"}, + "strokeWidth": {"value": 2}, + "opacity": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "value": 0.7 + }, + {"value": 0.15} + ], + "stroke": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "scale": "color", + "field": "metricName" + }, + {"value": "#ccc"} + ] + } + } + }, + { + "type": "symbol", + "from": {"data": "series"}, + "encode": { + "enter": { + "fill": {"value": "#B00"}, + "size": [{ "test": "datum.hasError", "value": 250 }, {"value": 0}], + "shape": {"value": "cross"}, + "angle": {"value": 45}, + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}}, + "y": {"scale": "y", "field": "metricValue"}, + "strokeWidth": {"value": 1}, + "opacity": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && datum.hasError && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "value": 1 + }, + {"value": 0.15} + ] + }, + "update": { + "opacity": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && datum.hasError && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "value": 1 + }, + {"value": 0.15} + ] + } + }, + "zindex": 1 + }, + { + "type": "symbol", + "from": {"data": "series"}, + "encode": { + "enter": { + "tooltip": { + "signal": "datum.metricName + ': ' + datum.metricValue + ' ms'" + }, + "href": {"field": "url"}, + "cursor": {"value": "pointer"}, + "size": {"scale": "size", "field": "metricError"}, + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}}, + "y": {"scale": "y", "field": "metricValue"}, + "strokeWidth": {"value": 1}, + "fill": {"scale": "color", "field": "metricName"} + }, + "update": { + "opacity": [ + { + "test": "(!domain || inrange(datum.buildId, domain)) && (!length(data('selected')) || indata('selected', 'value', datum.metricName))", + "value": 1 + }, + {"value": 0.15} + ] + } + }, + "zindex": 2 + } + ] + } + ] +} diff --git a/idea/performanceTests/resources/TestData highlight - vega.js b/idea/performanceTests/resources/TestData highlight - vega.js index 9781d7eaaee..060c0adbddd 100644 --- a/idea/performanceTests/resources/TestData highlight - vega.js +++ b/idea/performanceTests/resources/TestData highlight - vega.js @@ -43,6 +43,29 @@ } ] }, + { + "name": "branchShift", + "value": false, + "on": [ + { + "events": "@branchLegendSymbol:click, @branchLegendLabel:click", + "update": "event.shiftKey", + "force": true + } + ] + }, + { + "name": "branchClicked", + "value": null, + "on": [ + { + "events": "@branchLegendSymbol:click, @branchLegendLabel:click", + "comment": "note: here `datum` is `selected` data set", + "update": "{value: datum.value}", + "force": true + } + ] + }, { "name": "brush", "value": 0, @@ -235,6 +258,12 @@ "field": "buildId" } }, + "branch": { + "terms": { + "size": 1, + "field": "buildBranch.keyword" + } + }, "avgValue":{ "avg": { "field": "metricValue" @@ -264,11 +293,13 @@ {"type": "flatten", "fields": ["benchmark_buckets_name.buckets"], "as": ["name_buckets"]}, {"type": "project", "fields": ["benchmark", "name_buckets.key", "name_buckets.values"], "as": ["benchmark", "name", "name_values"]}, {"type": "flatten", "fields": ["name_values.buckets"], "as": ["name_values_buckets"]}, - {"type": "project", "fields": ["benchmark", "name", "name_values_buckets.key", "name_values_buckets.key_as_string", "name_values_buckets.avgError", "name_values_buckets.avgValue", "name_values_buckets.buildId.buckets"], "as": ["benchmark", "metricName", "buildTimestamp", "timestamp_value", "avgError", "avgValue", "buildId_buckets"]}, + {"type": "project", "fields": ["benchmark", "name", "name_values_buckets.key", "name_values_buckets.key_as_string", "name_values_buckets.avgError", "name_values_buckets.avgValue", "name_values_buckets.buildId.buckets", "name_values_buckets.branch.buckets"], "as": ["benchmark", "metricName", "buildTimestamp", "timestamp_value", "avgError", "avgValue", "buildId_buckets", "branch_buckets"]}, {"type": "formula", "as": "metricError", "expr": "datum.avgError.value"}, {"type": "formula", "as": "metricValue", "expr": "datum.avgValue.value"}, {"type": "flatten", "fields": ["buildId_buckets"], "as": ["buildId_values"]}, + {"type": "flatten", "fields": ["branch_buckets"], "as": ["branch_values"]}, {"type": "formula", "as": "buildId", "expr": "datum.buildId_values.key"}, + {"type": "formula", "as": "branch", "expr": "datum.branch_values.key"}, { "type": "formula", "as": "timestamp", @@ -291,6 +322,15 @@ {"trigger": "!shift && clicked", "insert": "clicked"}, {"trigger": "shift && clicked", "toggle": "clicked"} ] + }, + { + "name": "selectedBranch", + "on": [ + {"trigger": "clear", "remove": true}, + {"trigger": "!branchShift", "remove": true}, + {"trigger": "!branchShift && branchClicked", "insert": "branchClicked"}, + {"trigger": "branchShift && branchClicked", "toggle": "branchClicked"} + ] } ], "axes": [ @@ -351,6 +391,12 @@ "zero": true, "domain": {"data": "table", "field": "metricError"}, "range": [1, 100] + }, + { + "name": "branchColor", + "type": "ordinal", + "domain": {"data": "table", "field": "branch"}, + "range": "category" } ], "legends": [ @@ -361,6 +407,7 @@ "padding": 8, "cornerRadius": 4, "symbolLimit": 50, + "labelLimit": 300, "encode": { "symbols": { "name": "legendSymbol", @@ -394,6 +441,48 @@ } } } + }, + { + "title": "Branches", + "stroke": "branchColor", + "fill": "branchColor", + "strokeColor": "#ccc", + "padding": 8, + "cornerRadius": 4, + "symbolLimit": 50, + "labelLimit": 300, + "encode": { + "symbols": { + "name": "branchLegendSymbol", + "interactive": true, + "update": { + "strokeWidth": {"value": 2}, + "opacity": [ + { + "comment": "here `datum` is `selectedBranch` data set", + "test": "!length(data('selectedBranch')) || indata('selectedBranch', 'value', datum.value)", + "value": 0.7 + }, + {"value": 0.15} + ], + "size": {"value": 64} + } + }, + "labels": { + "name": "branchLegendLabel", + "interactive": true, + "update": { + "opacity": [ + { + "comment": "here `datum` is `selectedBranch` data set", + "test": "!length(data('selectedBranch')) || indata('selectedBranch', 'value', datum.value)", + "value": 1 + }, + {"value": 0.25} + ] + } + } + } } ], "marks": [ @@ -403,6 +492,42 @@ "facet": {"name": "series", "data": "table", "groupby": "metricName"} }, "marks": [ + { + "type": "text", + "from": {"data": "series"}, + "encode": { + "update": { + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}}, + "align": {"value": "center"}, + "y": {"value": -10}, + "angle": {"value": 90}, + "fill": {"value": "#000"}, + "text": [{"test": "datum.branch != 'master'", "field": "branch"}, {"value": ""}], + "fontSize": {"value": 10}, + "font": {"value": "monospace"} + } + } + }, + { + "type": "rect", + "from": {"data": "series"}, + "encode": { + "update": { + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}, "offset":-5}, + "x2": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}, "offset": 5}, + "y": {"value": 0}, + "y2": {"signal": "height"}, + "fill": [{"test": "datum.branch != 'master'", "scale": "branchColor", "field": "branch"}, {"value": ""}], + "opacity": [ + { + "test": "(!domain || inrange(datum.branch, domain)) && (!length(data('selectedBranch')) || indata('selectedBranch', 'value', datum.branch))", + "value": 0.1 + }, + {"value": 0.01} + ] + } + } + }, { "type": "line", "from": {"data": "series"}, diff --git a/idea/performanceTests/resources/The Kotlin sources highlight - vega.js b/idea/performanceTests/resources/The Kotlin sources highlight - vega.js index a1602a20106..3ad556b5dd5 100644 --- a/idea/performanceTests/resources/The Kotlin sources highlight - vega.js +++ b/idea/performanceTests/resources/The Kotlin sources highlight - vega.js @@ -43,6 +43,29 @@ } ] }, + { + "name": "branchShift", + "value": false, + "on": [ + { + "events": "@branchLegendSymbol:click, @branchLegendLabel:click", + "update": "event.shiftKey", + "force": true + } + ] + }, + { + "name": "branchClicked", + "value": null, + "on": [ + { + "events": "@branchLegendSymbol:click, @branchLegendLabel:click", + "comment": "note: here `datum` is `selected` data set", + "update": "{value: datum.value}", + "force": true + } + ] + }, { "name": "brush", "value": 0, @@ -161,6 +184,12 @@ "field": "buildId" } }, + "branch": { + "terms": { + "size": 1, + "field": "buildBranch.keyword" + } + }, "avgValue":{ "avg": { "field": "metricValue" @@ -180,7 +209,7 @@ } } }, - "format": {"property": "aggregations"}, + "format": {"property": "aggregations"}, "comment": "we need to have follow data: \"buildId\", \"metricName\", \"metricValue\" and \"metricError\"", "comment": "so it has to be array of {\"buildId\": \"...\", \"metricName\": \"...\", \"metricValue\": ..., \"metricError\": ...}", "transform": [ @@ -190,11 +219,13 @@ {"type": "flatten", "fields": ["benchmark_buckets_name.buckets"], "as": ["name_buckets"]}, {"type": "project", "fields": ["benchmark", "name_buckets.key", "name_buckets.values"], "as": ["benchmark", "name", "name_values"]}, {"type": "flatten", "fields": ["name_values.buckets"], "as": ["name_values_buckets"]}, - {"type": "project", "fields": ["benchmark", "name", "name_values_buckets.key", "name_values_buckets.key_as_string", "name_values_buckets.avgError", "name_values_buckets.avgValue", "name_values_buckets.buildId.buckets"], "as": ["benchmark", "metricName", "buildTimestamp", "timestamp_value", "avgError", "avgValue", "buildId_buckets"]}, + {"type": "project", "fields": ["benchmark", "name", "name_values_buckets.key", "name_values_buckets.key_as_string", "name_values_buckets.avgError", "name_values_buckets.avgValue", "name_values_buckets.buildId.buckets", "name_values_buckets.branch.buckets"], "as": ["benchmark", "metricName", "buildTimestamp", "timestamp_value", "avgError", "avgValue", "buildId_buckets", "branch_buckets"]}, {"type": "formula", "as": "metricError", "expr": "datum.avgError.value"}, {"type": "formula", "as": "metricValue", "expr": "datum.avgValue.value"}, {"type": "flatten", "fields": ["buildId_buckets"], "as": ["buildId_values"]}, + {"type": "flatten", "fields": ["branch_buckets"], "as": ["branch_values"]}, {"type": "formula", "as": "buildId", "expr": "datum.buildId_values.key"}, + {"type": "formula", "as": "branch", "expr": "datum.branch_values.key"}, { "type": "formula", "as": "timestamp", @@ -208,7 +239,6 @@ }, {"type": "collect","sort": {"field": "timestamp"}} ] - }, { "name": "selected", @@ -218,6 +248,15 @@ {"trigger": "!shift && clicked", "insert": "clicked"}, {"trigger": "shift && clicked", "toggle": "clicked"} ] + }, + { + "name": "selectedBranch", + "on": [ + {"trigger": "clear", "remove": true}, + {"trigger": "!branchShift", "remove": true}, + {"trigger": "!branchShift && branchClicked", "insert": "branchClicked"}, + {"trigger": "branchShift && branchClicked", "toggle": "branchClicked"} + ] } ], "axes": [ @@ -277,7 +316,13 @@ "nice": false, "zero": true, "domain": {"data": "table", "field": "metricError"}, - "range": [0, 100] + "range": [1, 100] + }, + { + "name": "branchColor", + "type": "ordinal", + "domain": {"data": "table", "field": "branch"}, + "range": "category" } ], "legends": [ @@ -288,6 +333,7 @@ "padding": 8, "cornerRadius": 4, "symbolLimit": 50, + "labelLimit": 300, "encode": { "symbols": { "name": "legendSymbol", @@ -321,6 +367,48 @@ } } } + }, + { + "title": "Branches", + "stroke": "branchColor", + "fill": "branchColor", + "strokeColor": "#ccc", + "padding": 8, + "cornerRadius": 4, + "symbolLimit": 50, + "labelLimit": 300, + "encode": { + "symbols": { + "name": "branchLegendSymbol", + "interactive": true, + "update": { + "strokeWidth": {"value": 2}, + "opacity": [ + { + "comment": "here `datum` is `selectedBranch` data set", + "test": "!length(data('selectedBranch')) || indata('selectedBranch', 'value', datum.value)", + "value": 0.7 + }, + {"value": 0.15} + ], + "size": {"value": 64} + } + }, + "labels": { + "name": "branchLegendLabel", + "interactive": true, + "update": { + "opacity": [ + { + "comment": "here `datum` is `selectedBranch` data set", + "test": "!length(data('selectedBranch')) || indata('selectedBranch', 'value', datum.value)", + "value": 1 + }, + {"value": 0.25} + ] + } + } + } } ], "marks": [ @@ -330,6 +418,42 @@ "facet": {"name": "series", "data": "table", "groupby": "metricName"} }, "marks": [ + { + "type": "text", + "from": {"data": "series"}, + "encode": { + "update": { + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}}, + "align": {"value": "center"}, + "y": {"value": -10}, + "angle": {"value": 90}, + "fill": {"value": "#000"}, + "text": [{"test": "datum.branch != 'master'", "field": "branch"}, {"value": ""}], + "fontSize": {"value": 10}, + "font": {"value": "monospace"} + } + } + }, + { + "type": "rect", + "from": {"data": "series"}, + "encode": { + "update": { + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}, "offset":-5}, + "x2": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}, "offset": 5}, + "y": {"value": 0}, + "y2": {"signal": "height"}, + "fill": [{"test": "datum.branch != 'master'", "scale": "branchColor", "field": "branch"}, {"value": ""}], + "opacity": [ + { + "test": "(!domain || inrange(datum.branch, domain)) && (!length(data('selectedBranch')) || indata('selectedBranch', 'value', datum.branch))", + "value": 0.1 + }, + {"value": 0.01} + ] + } + } + }, { "type": "line", "from": {"data": "series"}, diff --git a/idea/performanceTests/resources/The Kotlin sources highlight build.gradle.kts - vega.js b/idea/performanceTests/resources/The Kotlin sources highlight build.gradle.kts - vega.js index fd1a6038d95..255c0ff0121 100644 --- a/idea/performanceTests/resources/The Kotlin sources highlight build.gradle.kts - vega.js +++ b/idea/performanceTests/resources/The Kotlin sources highlight build.gradle.kts - vega.js @@ -43,6 +43,29 @@ } ] }, + { + "name": "branchShift", + "value": false, + "on": [ + { + "events": "@branchLegendSymbol:click, @branchLegendLabel:click", + "update": "event.shiftKey", + "force": true + } + ] + }, + { + "name": "branchClicked", + "value": null, + "on": [ + { + "events": "@branchLegendSymbol:click, @branchLegendLabel:click", + "comment": "note: here `datum` is `selected` data set", + "update": "{value: datum.value}", + "force": true + } + ] + }, { "name": "brush", "value": 0, @@ -152,6 +175,12 @@ "field": "buildId" } }, + "branch": { + "terms": { + "size": 1, + "field": "buildBranch.keyword" + } + }, "avgValue":{ "avg": { "field": "metricValue" @@ -171,7 +200,7 @@ } } }, - "format": {"property": "aggregations"}, + "format": {"property": "aggregations"}, "comment": "we need to have follow data: \"buildId\", \"metricName\", \"metricValue\" and \"metricError\"", "comment": "so it has to be array of {\"buildId\": \"...\", \"metricName\": \"...\", \"metricValue\": ..., \"metricError\": ...}", "transform": [ @@ -181,11 +210,13 @@ {"type": "flatten", "fields": ["benchmark_buckets_name.buckets"], "as": ["name_buckets"]}, {"type": "project", "fields": ["benchmark", "name_buckets.key", "name_buckets.values"], "as": ["benchmark", "name", "name_values"]}, {"type": "flatten", "fields": ["name_values.buckets"], "as": ["name_values_buckets"]}, - {"type": "project", "fields": ["benchmark", "name", "name_values_buckets.key", "name_values_buckets.key_as_string", "name_values_buckets.avgError", "name_values_buckets.avgValue", "name_values_buckets.buildId.buckets"], "as": ["benchmark", "metricName", "buildTimestamp", "timestamp_value", "avgError", "avgValue", "buildId_buckets"]}, + {"type": "project", "fields": ["benchmark", "name", "name_values_buckets.key", "name_values_buckets.key_as_string", "name_values_buckets.avgError", "name_values_buckets.avgValue", "name_values_buckets.buildId.buckets", "name_values_buckets.branch.buckets"], "as": ["benchmark", "metricName", "buildTimestamp", "timestamp_value", "avgError", "avgValue", "buildId_buckets", "branch_buckets"]}, {"type": "formula", "as": "metricError", "expr": "datum.avgError.value"}, {"type": "formula", "as": "metricValue", "expr": "datum.avgValue.value"}, {"type": "flatten", "fields": ["buildId_buckets"], "as": ["buildId_values"]}, + {"type": "flatten", "fields": ["branch_buckets"], "as": ["branch_values"]}, {"type": "formula", "as": "buildId", "expr": "datum.buildId_values.key"}, + {"type": "formula", "as": "branch", "expr": "datum.branch_values.key"}, { "type": "formula", "as": "timestamp", @@ -199,7 +230,6 @@ }, {"type": "collect","sort": {"field": "timestamp"}} ] - }, { "name": "selected", @@ -209,6 +239,15 @@ {"trigger": "!shift && clicked", "insert": "clicked"}, {"trigger": "shift && clicked", "toggle": "clicked"} ] + }, + { + "name": "selectedBranch", + "on": [ + {"trigger": "clear", "remove": true}, + {"trigger": "!branchShift", "remove": true}, + {"trigger": "!branchShift && branchClicked", "insert": "branchClicked"}, + {"trigger": "branchShift && branchClicked", "toggle": "branchClicked"} + ] } ], "axes": [ @@ -268,7 +307,13 @@ "nice": false, "zero": true, "domain": {"data": "table", "field": "metricError"}, - "range": [0, 100] + "range": [1, 100] + }, + { + "name": "branchColor", + "type": "ordinal", + "domain": {"data": "table", "field": "branch"}, + "range": "category" } ], "legends": [ @@ -279,6 +324,7 @@ "padding": 8, "cornerRadius": 4, "symbolLimit": 50, + "labelLimit": 300, "encode": { "symbols": { "name": "legendSymbol", @@ -312,6 +358,48 @@ } } } + }, + { + "title": "Branches", + "stroke": "branchColor", + "fill": "branchColor", + "strokeColor": "#ccc", + "padding": 8, + "cornerRadius": 4, + "symbolLimit": 50, + "labelLimit": 300, + "encode": { + "symbols": { + "name": "branchLegendSymbol", + "interactive": true, + "update": { + "strokeWidth": {"value": 2}, + "opacity": [ + { + "comment": "here `datum` is `selectedBranch` data set", + "test": "!length(data('selectedBranch')) || indata('selectedBranch', 'value', datum.value)", + "value": 0.7 + }, + {"value": 0.15} + ], + "size": {"value": 64} + } + }, + "labels": { + "name": "branchLegendLabel", + "interactive": true, + "update": { + "opacity": [ + { + "comment": "here `datum` is `selectedBranch` data set", + "test": "!length(data('selectedBranch')) || indata('selectedBranch', 'value', datum.value)", + "value": 1 + }, + {"value": 0.25} + ] + } + } + } } ], "marks": [ @@ -321,6 +409,42 @@ "facet": {"name": "series", "data": "table", "groupby": "metricName"} }, "marks": [ + { + "type": "text", + "from": {"data": "series"}, + "encode": { + "update": { + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}}, + "align": {"value": "center"}, + "y": {"value": -10}, + "angle": {"value": 90}, + "fill": {"value": "#000"}, + "text": [{"test": "datum.branch != 'master'", "field": "branch"}, {"value": ""}], + "fontSize": {"value": 10}, + "font": {"value": "monospace"} + } + } + }, + { + "type": "rect", + "from": {"data": "series"}, + "encode": { + "update": { + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}, "offset":-5}, + "x2": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}, "offset": 5}, + "y": {"value": 0}, + "y2": {"signal": "height"}, + "fill": [{"test": "datum.branch != 'master'", "scale": "branchColor", "field": "branch"}, {"value": ""}], + "opacity": [ + { + "test": "(!domain || inrange(datum.branch, domain)) && (!length(data('selectedBranch')) || indata('selectedBranch', 'value', datum.branch))", + "value": 0.1 + }, + {"value": 0.01} + ] + } + } + }, { "type": "line", "from": {"data": "series"}, diff --git a/idea/performanceTests/resources/The Kotlin sources highlight empty profile - vega.js b/idea/performanceTests/resources/The Kotlin sources highlight empty profile - vega.js index 688e6191395..e787953685c 100644 --- a/idea/performanceTests/resources/The Kotlin sources highlight empty profile - vega.js +++ b/idea/performanceTests/resources/The Kotlin sources highlight empty profile - vega.js @@ -43,6 +43,29 @@ } ] }, + { + "name": "branchShift", + "value": false, + "on": [ + { + "events": "@branchLegendSymbol:click, @branchLegendLabel:click", + "update": "event.shiftKey", + "force": true + } + ] + }, + { + "name": "branchClicked", + "value": null, + "on": [ + { + "events": "@branchLegendSymbol:click, @branchLegendLabel:click", + "comment": "note: here `datum` is `selected` data set", + "update": "{value: datum.value}", + "force": true + } + ] + }, { "name": "brush", "value": 0, @@ -148,6 +171,12 @@ "field": "buildId" } }, + "branch": { + "terms": { + "size": 1, + "field": "buildBranch.keyword" + } + }, "avgValue":{ "avg": { "field": "metricValue" @@ -167,7 +196,7 @@ } } }, - "format": {"property": "aggregations"}, + "format": {"property": "aggregations"}, "comment": "we need to have follow data: \"buildId\", \"metricName\", \"metricValue\" and \"metricError\"", "comment": "so it has to be array of {\"buildId\": \"...\", \"metricName\": \"...\", \"metricValue\": ..., \"metricError\": ...}", "transform": [ @@ -177,11 +206,13 @@ {"type": "flatten", "fields": ["benchmark_buckets_name.buckets"], "as": ["name_buckets"]}, {"type": "project", "fields": ["benchmark", "name_buckets.key", "name_buckets.values"], "as": ["benchmark", "name", "name_values"]}, {"type": "flatten", "fields": ["name_values.buckets"], "as": ["name_values_buckets"]}, - {"type": "project", "fields": ["benchmark", "name", "name_values_buckets.key", "name_values_buckets.key_as_string", "name_values_buckets.avgError", "name_values_buckets.avgValue", "name_values_buckets.buildId.buckets"], "as": ["benchmark", "metricName", "buildTimestamp", "timestamp_value", "avgError", "avgValue", "buildId_buckets"]}, + {"type": "project", "fields": ["benchmark", "name", "name_values_buckets.key", "name_values_buckets.key_as_string", "name_values_buckets.avgError", "name_values_buckets.avgValue", "name_values_buckets.buildId.buckets", "name_values_buckets.branch.buckets"], "as": ["benchmark", "metricName", "buildTimestamp", "timestamp_value", "avgError", "avgValue", "buildId_buckets", "branch_buckets"]}, {"type": "formula", "as": "metricError", "expr": "datum.avgError.value"}, {"type": "formula", "as": "metricValue", "expr": "datum.avgValue.value"}, {"type": "flatten", "fields": ["buildId_buckets"], "as": ["buildId_values"]}, + {"type": "flatten", "fields": ["branch_buckets"], "as": ["branch_values"]}, {"type": "formula", "as": "buildId", "expr": "datum.buildId_values.key"}, + {"type": "formula", "as": "branch", "expr": "datum.branch_values.key"}, { "type": "formula", "as": "timestamp", @@ -195,7 +226,6 @@ }, {"type": "collect","sort": {"field": "timestamp"}} ] - }, { "name": "selected", @@ -205,6 +235,15 @@ {"trigger": "!shift && clicked", "insert": "clicked"}, {"trigger": "shift && clicked", "toggle": "clicked"} ] + }, + { + "name": "selectedBranch", + "on": [ + {"trigger": "clear", "remove": true}, + {"trigger": "!branchShift", "remove": true}, + {"trigger": "!branchShift && branchClicked", "insert": "branchClicked"}, + {"trigger": "branchShift && branchClicked", "toggle": "branchClicked"} + ] } ], "axes": [ @@ -264,7 +303,13 @@ "nice": false, "zero": true, "domain": {"data": "table", "field": "metricError"}, - "range": [0, 100] + "range": [1, 100] + }, + { + "name": "branchColor", + "type": "ordinal", + "domain": {"data": "table", "field": "branch"}, + "range": "category" } ], "legends": [ @@ -275,6 +320,7 @@ "padding": 8, "cornerRadius": 4, "symbolLimit": 50, + "labelLimit": 300, "encode": { "symbols": { "name": "legendSymbol", @@ -308,6 +354,48 @@ } } } + }, + { + "title": "Branches", + "stroke": "branchColor", + "fill": "branchColor", + "strokeColor": "#ccc", + "padding": 8, + "cornerRadius": 4, + "symbolLimit": 50, + "labelLimit": 300, + "encode": { + "symbols": { + "name": "branchLegendSymbol", + "interactive": true, + "update": { + "strokeWidth": {"value": 2}, + "opacity": [ + { + "comment": "here `datum` is `selectedBranch` data set", + "test": "!length(data('selectedBranch')) || indata('selectedBranch', 'value', datum.value)", + "value": 0.7 + }, + {"value": 0.15} + ], + "size": {"value": 64} + } + }, + "labels": { + "name": "branchLegendLabel", + "interactive": true, + "update": { + "opacity": [ + { + "comment": "here `datum` is `selectedBranch` data set", + "test": "!length(data('selectedBranch')) || indata('selectedBranch', 'value', datum.value)", + "value": 1 + }, + {"value": 0.25} + ] + } + } + } } ], "marks": [ @@ -317,6 +405,42 @@ "facet": {"name": "series", "data": "table", "groupby": "metricName"} }, "marks": [ + { + "type": "text", + "from": {"data": "series"}, + "encode": { + "update": { + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}}, + "align": {"value": "center"}, + "y": {"value": -10}, + "angle": {"value": 90}, + "fill": {"value": "#000"}, + "text": [{"test": "datum.branch != 'master'", "field": "branch"}, {"value": ""}], + "fontSize": {"value": 10}, + "font": {"value": "monospace"} + } + } + }, + { + "type": "rect", + "from": {"data": "series"}, + "encode": { + "update": { + "x": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}, "offset":-5}, + "x2": {"scale": "x", "field": {"signal": "timestamp ? 'timestamp' : 'buildId'"}, "offset": 5}, + "y": {"value": 0}, + "y2": {"signal": "height"}, + "fill": [{"test": "datum.branch != 'master'", "scale": "branchColor", "field": "branch"}, {"value": ""}], + "opacity": [ + { + "test": "(!domain || inrange(datum.branch, domain)) && (!length(data('selectedBranch')) || indata('selectedBranch', 'value', datum.branch))", + "value": 0.1 + }, + {"value": 0.01} + ] + } + } + }, { "type": "line", "from": {"data": "series"}, From c13650fd791b35e237696edf36df41d82f4b0673 Mon Sep 17 00:00:00 2001 From: Andrei Klunnyi Date: Wed, 25 Nov 2020 11:10:22 +0000 Subject: [PATCH 104/698] KT-43511 [Gradle Runner]: run task is not created for top level modules --- .../kotlin/idea/gradle/execution/KotlinGradleAppEnvProvider.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/gradle/execution/KotlinGradleAppEnvProvider.kt b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/gradle/execution/KotlinGradleAppEnvProvider.kt index a5b5bf6aa70..a4b6cbb3d22 100644 --- a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/gradle/execution/KotlinGradleAppEnvProvider.kt +++ b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/gradle/execution/KotlinGradleAppEnvProvider.kt @@ -163,7 +163,7 @@ class KotlinGradleAppEnvProvider : GradleExecutionEnvironmentProvider { val rootProjectName = (extModuleData.parent?.data as? ProjectData)?.externalName ?: "" rootProjectName + projectPath } else { - projectPath // includes rootProject.name already + projectPath.takeIf { ':' in it } ?: "$projectPath:" // includes rootProject.name already, for top level projects has no ':' } val workingDir = ProgramParametersUtil.getWorkingDir(applicationConfiguration, project, module)?.let { From dfc5059d6b01567a9fa224e7970f3dcba9fb8fea Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Thu, 19 Nov 2020 16:33:50 -0800 Subject: [PATCH 105/698] FIR: reproduce KT-43340 --- .../kotlin/fir/Fir2IrTextTestGenerated.java | 5 + .../typeVariableAfterBuildMap.fir.txt | 595 +++++++++++++++++ .../firProblems/typeVariableAfterBuildMap.kt | 68 ++ .../firProblems/typeVariableAfterBuildMap.txt | 599 ++++++++++++++++++ .../kotlin/ir/IrTextTestCaseGenerated.java | 5 + 5 files changed, 1272 insertions(+) create mode 100644 compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.fir.txt create mode 100644 compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.kt create mode 100644 compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.txt diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java index 478ed5273ab..a1714ba5c82 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java @@ -1837,6 +1837,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { runTest("compiler/testData/ir/irText/firProblems/throwableStackTrace.kt"); } + @TestMetadata("typeVariableAfterBuildMap.kt") + public void testTypeVariableAfterBuildMap() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.kt"); + } + @TestMetadata("V8ArrayToList.kt") public void testV8ArrayToList() throws Exception { runTest("compiler/testData/ir/irText/firProblems/V8ArrayToList.kt"); diff --git a/compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.fir.txt b/compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.fir.txt new file mode 100644 index 00000000000..6e20e8a4678 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.fir.txt @@ -0,0 +1,595 @@ +FILE fqName: fileName:/typeVariableAfterBuildMap.kt + CLASS CLASS name:Visibility modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Visibility + CONSTRUCTOR visibility:public <> (name:kotlin.String, isPublicAPI:kotlin.Boolean) returnType:.Visibility [primary] + VALUE_PARAMETER name:name index:0 type:kotlin.String + VALUE_PARAMETER name:isPublicAPI index:1 type:kotlin.Boolean + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Visibility modality:ABSTRACT visibility:public superTypes:[kotlin.Any]' + PROPERTY name:name visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:name type:kotlin.String visibility:private [final] + EXPRESSION_BODY + GET_VAR 'name: kotlin.String declared in .Visibility.' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.String + correspondingProperty: PROPERTY name:name visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Visibility + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .Visibility' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:name type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .Visibility declared in .Visibility.' type=.Visibility origin=null + PROPERTY name:isPublicAPI visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:isPublicAPI type:kotlin.Boolean visibility:private [final] + EXPRESSION_BODY + GET_VAR 'isPublicAPI: kotlin.Boolean declared in .Visibility.' type=kotlin.Boolean origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.Boolean + correspondingProperty: PROPERTY name:isPublicAPI visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Visibility + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Boolean declared in .Visibility' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:isPublicAPI type:kotlin.Boolean visibility:private [final]' type=kotlin.Boolean origin=null + receiver: GET_VAR ': .Visibility declared in .Visibility.' type=.Visibility origin=null + PROPERTY name:internalDisplayName visibility:public modality:OPEN [val] + FUN name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String + correspondingProperty: PROPERTY name:internalDisplayName visibility:public modality:OPEN [val] + $this: VALUE_PARAMETER name: type:.Visibility + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .Visibility' + CALL 'public final fun (): kotlin.String declared in .Visibility' type=kotlin.String origin=GET_PROPERTY + $this: GET_VAR ': .Visibility declared in .Visibility.' type=.Visibility origin=null + PROPERTY name:externalDisplayName visibility:public modality:OPEN [val] + FUN name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String + correspondingProperty: PROPERTY name:externalDisplayName visibility:public modality:OPEN [val] + $this: VALUE_PARAMETER name: type:.Visibility + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .Visibility' + CALL 'public open fun (): kotlin.String declared in .Visibility' type=kotlin.String origin=GET_PROPERTY + $this: GET_VAR ': .Visibility declared in .Visibility.' type=.Visibility origin=null + FUN name:mustCheckInImports visibility:public modality:ABSTRACT <> ($this:.Visibility) returnType:kotlin.Boolean + $this: VALUE_PARAMETER name: type:.Visibility + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS OBJECT name:Visibilities modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Visibilities + CONSTRUCTOR visibility:private <> () returnType:.Visibilities [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Visibilities modality:FINAL visibility:public superTypes:[kotlin.Any]' + CLASS OBJECT name:Private modality:FINAL visibility:public superTypes:[.Visibility] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Visibilities.Private + CONSTRUCTOR visibility:private <> () returnType:.Visibilities.Private [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, isPublicAPI: kotlin.Boolean) [primary] declared in .Visibility' + name: CONST String type=kotlin.String value="private" + isPublicAPI: CONST Boolean type=kotlin.Boolean value=false + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Private modality:FINAL visibility:public superTypes:[.Visibility]' + FUN name:mustCheckInImports visibility:public modality:FINAL <> ($this:.Visibilities.Private) returnType:kotlin.Boolean + overridden: + public abstract fun mustCheckInImports (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibilities.Private + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun mustCheckInImports (): kotlin.Boolean declared in .Visibilities.Private' + CONST Boolean type=kotlin.Boolean value=true + PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.Boolean [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS OBJECT name:PrivateToThis modality:FINAL visibility:public superTypes:[.Visibility] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Visibilities.PrivateToThis + CONSTRUCTOR visibility:private <> () returnType:.Visibilities.PrivateToThis [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, isPublicAPI: kotlin.Boolean) [primary] declared in .Visibility' + name: CONST String type=kotlin.String value="private_to_this" + isPublicAPI: CONST Boolean type=kotlin.Boolean value=false + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:PrivateToThis modality:FINAL visibility:public superTypes:[.Visibility]' + PROPERTY name:internalDisplayName visibility:public modality:FINAL [val] + FUN name: visibility:public modality:FINAL <> ($this:.Visibilities.PrivateToThis) returnType:kotlin.String + correspondingProperty: PROPERTY name:internalDisplayName visibility:public modality:FINAL [val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibilities.PrivateToThis + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .Visibilities.PrivateToThis' + CONST String type=kotlin.String value="private/*private to this*/" + FUN name:mustCheckInImports visibility:public modality:FINAL <> ($this:.Visibilities.PrivateToThis) returnType:kotlin.Boolean + overridden: + public abstract fun mustCheckInImports (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibilities.PrivateToThis + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun mustCheckInImports (): kotlin.Boolean declared in .Visibilities.PrivateToThis' + CONST Boolean type=kotlin.Boolean value=true + PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.Boolean [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS OBJECT name:Protected modality:FINAL visibility:public superTypes:[.Visibility] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Visibilities.Protected + CONSTRUCTOR visibility:private <> () returnType:.Visibilities.Protected [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, isPublicAPI: kotlin.Boolean) [primary] declared in .Visibility' + name: CONST String type=kotlin.String value="protected" + isPublicAPI: CONST Boolean type=kotlin.Boolean value=true + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Protected modality:FINAL visibility:public superTypes:[.Visibility]' + FUN name:mustCheckInImports visibility:public modality:FINAL <> ($this:.Visibilities.Protected) returnType:kotlin.Boolean + overridden: + public abstract fun mustCheckInImports (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibilities.Protected + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun mustCheckInImports (): kotlin.Boolean declared in .Visibilities.Protected' + CONST Boolean type=kotlin.Boolean value=false + PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.Boolean [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS OBJECT name:Internal modality:FINAL visibility:public superTypes:[.Visibility] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Visibilities.Internal + CONSTRUCTOR visibility:private <> () returnType:.Visibilities.Internal [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, isPublicAPI: kotlin.Boolean) [primary] declared in .Visibility' + name: CONST String type=kotlin.String value="internal" + isPublicAPI: CONST Boolean type=kotlin.Boolean value=false + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Internal modality:FINAL visibility:public superTypes:[.Visibility]' + FUN name:mustCheckInImports visibility:public modality:FINAL <> ($this:.Visibilities.Internal) returnType:kotlin.Boolean + overridden: + public abstract fun mustCheckInImports (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibilities.Internal + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun mustCheckInImports (): kotlin.Boolean declared in .Visibilities.Internal' + CONST Boolean type=kotlin.Boolean value=true + PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.Boolean [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS OBJECT name:Public modality:FINAL visibility:public superTypes:[.Visibility] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Visibilities.Public + CONSTRUCTOR visibility:private <> () returnType:.Visibilities.Public [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, isPublicAPI: kotlin.Boolean) [primary] declared in .Visibility' + name: CONST String type=kotlin.String value="public" + isPublicAPI: CONST Boolean type=kotlin.Boolean value=true + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Public modality:FINAL visibility:public superTypes:[.Visibility]' + FUN name:mustCheckInImports visibility:public modality:FINAL <> ($this:.Visibilities.Public) returnType:kotlin.Boolean + overridden: + public abstract fun mustCheckInImports (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibilities.Public + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun mustCheckInImports (): kotlin.Boolean declared in .Visibilities.Public' + CONST Boolean type=kotlin.Boolean value=false + PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.Boolean [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS OBJECT name:Local modality:FINAL visibility:public superTypes:[.Visibility] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Visibilities.Local + CONSTRUCTOR visibility:private <> () returnType:.Visibilities.Local [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, isPublicAPI: kotlin.Boolean) [primary] declared in .Visibility' + name: CONST String type=kotlin.String value="local" + isPublicAPI: CONST Boolean type=kotlin.Boolean value=false + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Local modality:FINAL visibility:public superTypes:[.Visibility]' + FUN name:mustCheckInImports visibility:public modality:FINAL <> ($this:.Visibilities.Local) returnType:kotlin.Boolean + overridden: + public abstract fun mustCheckInImports (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibilities.Local + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun mustCheckInImports (): kotlin.Boolean declared in .Visibilities.Local' + CONST Boolean type=kotlin.Boolean value=true + PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.Boolean [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS OBJECT name:Inherited modality:FINAL visibility:public superTypes:[.Visibility] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Visibilities.Inherited + CONSTRUCTOR visibility:private <> () returnType:.Visibilities.Inherited [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, isPublicAPI: kotlin.Boolean) [primary] declared in .Visibility' + name: CONST String type=kotlin.String value="inherited" + isPublicAPI: CONST Boolean type=kotlin.Boolean value=false + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Inherited modality:FINAL visibility:public superTypes:[.Visibility]' + FUN name:mustCheckInImports visibility:public modality:FINAL <> ($this:.Visibilities.Inherited) returnType:kotlin.Boolean + overridden: + public abstract fun mustCheckInImports (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibilities.Inherited + BLOCK_BODY + THROW type=kotlin.Nothing + CONSTRUCTOR_CALL 'public constructor (p0: kotlin.String?) declared in java.lang.IllegalStateException' type=java.lang.IllegalStateException origin=null + p0: CONST String type=kotlin.String value="This method shouldn't be invoked for INHERITED visibility" + PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.Boolean [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS OBJECT name:InvisibleFake modality:FINAL visibility:public superTypes:[.Visibility] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Visibilities.InvisibleFake + CONSTRUCTOR visibility:private <> () returnType:.Visibilities.InvisibleFake [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, isPublicAPI: kotlin.Boolean) [primary] declared in .Visibility' + name: CONST String type=kotlin.String value="invisible_fake" + isPublicAPI: CONST Boolean type=kotlin.Boolean value=false + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:InvisibleFake modality:FINAL visibility:public superTypes:[.Visibility]' + FUN name:mustCheckInImports visibility:public modality:FINAL <> ($this:.Visibilities.InvisibleFake) returnType:kotlin.Boolean + overridden: + public abstract fun mustCheckInImports (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibilities.InvisibleFake + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun mustCheckInImports (): kotlin.Boolean declared in .Visibilities.InvisibleFake' + CONST Boolean type=kotlin.Boolean value=true + PROPERTY name:externalDisplayName visibility:public modality:FINAL [val] + FUN name: visibility:public modality:FINAL <> ($this:.Visibilities.InvisibleFake) returnType:kotlin.String + correspondingProperty: PROPERTY name:externalDisplayName visibility:public modality:FINAL [val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibilities.InvisibleFake + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .Visibilities.InvisibleFake' + CONST String type=kotlin.String value="invisible (private in a supertype)" + PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.Boolean [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS OBJECT name:Unknown modality:FINAL visibility:public superTypes:[.Visibility] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Visibilities.Unknown + CONSTRUCTOR visibility:private <> () returnType:.Visibilities.Unknown [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, isPublicAPI: kotlin.Boolean) [primary] declared in .Visibility' + name: CONST String type=kotlin.String value="unknown" + isPublicAPI: CONST Boolean type=kotlin.Boolean value=false + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Unknown modality:FINAL visibility:public superTypes:[.Visibility]' + FUN name:mustCheckInImports visibility:public modality:FINAL <> ($this:.Visibilities.Unknown) returnType:kotlin.Boolean + overridden: + public abstract fun mustCheckInImports (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibilities.Unknown + BLOCK_BODY + THROW type=kotlin.Nothing + CONSTRUCTOR_CALL 'public constructor (p0: kotlin.String?) declared in java.lang.IllegalStateException' type=java.lang.IllegalStateException origin=null + p0: CONST String type=kotlin.String value="This method shouldn't be invoked for UNKNOWN visibility" + PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.Boolean [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + PROPERTY name:ORDERED_VISIBILITIES visibility:private modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:ORDERED_VISIBILITIES type:kotlin.collections.Map<.Visibility, kotlin.Int> visibility:private [final] + EXPRESSION_BODY + CALL 'public final fun buildMap (builderAction: @[ExtensionFunctionType] @[ExtensionFunctionType] kotlin.Function1, kotlin.Unit>): kotlin.collections.Map [inline] declared in kotlin.collections' type=kotlin.collections.Map<.Visibility, kotlin.Int> origin=null + : .Visibility + : kotlin.Int + builderAction: FUN_EXPR type=kotlin.Function1.Visibility, kotlin.Int>, kotlin.Unit> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:kotlin.collections.MutableMap<.Visibility, kotlin.Int>) returnType:kotlin.Unit + $receiver: VALUE_PARAMETER name: type:kotlin.collections.MutableMap<.Visibility, kotlin.Int> + BLOCK_BODY + CALL 'public abstract fun put (key: K of kotlin.collections.MutableMap, value: V of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? declared in kotlin.collections.MutableMap' type=IrErrorType origin=null + $this: GET_VAR ': kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap origin=null + key: GET_OBJECT 'CLASS OBJECT name:PrivateToThis modality:FINAL visibility:public superTypes:[.Visibility]' type=.Visibilities.PrivateToThis + value: CONST Int type=kotlin.Int value=0 + CALL 'public abstract fun put (key: K of kotlin.collections.MutableMap, value: V of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? declared in kotlin.collections.MutableMap' type=IrErrorType origin=null + $this: GET_VAR ': kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap origin=null + key: GET_OBJECT 'CLASS OBJECT name:Private modality:FINAL visibility:public superTypes:[.Visibility]' type=.Visibilities.Private + value: CONST Int type=kotlin.Int value=0 + CALL 'public abstract fun put (key: K of kotlin.collections.MutableMap, value: V of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? declared in kotlin.collections.MutableMap' type=IrErrorType origin=null + $this: GET_VAR ': kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap origin=null + key: GET_OBJECT 'CLASS OBJECT name:Internal modality:FINAL visibility:public superTypes:[.Visibility]' type=.Visibilities.Internal + value: CONST Int type=kotlin.Int value=1 + CALL 'public abstract fun put (key: K of kotlin.collections.MutableMap, value: V of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? declared in kotlin.collections.MutableMap' type=IrErrorType origin=null + $this: GET_VAR ': kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap origin=null + key: GET_OBJECT 'CLASS OBJECT name:Protected modality:FINAL visibility:public superTypes:[.Visibility]' type=.Visibilities.Protected + value: CONST Int type=kotlin.Int value=1 + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .Visibilities.ORDERED_VISIBILITIES' + CALL 'public abstract fun put (key: K of kotlin.collections.MutableMap, value: V of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? declared in kotlin.collections.MutableMap' type=IrErrorType origin=null + $this: GET_VAR ': kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap origin=null + key: GET_OBJECT 'CLASS OBJECT name:Public modality:FINAL visibility:public superTypes:[.Visibility]' type=.Visibilities.Public + value: CONST Int type=kotlin.Int value=2 + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.Visibilities) returnType:kotlin.collections.Map<.Visibility, kotlin.Int> + correspondingProperty: PROPERTY name:ORDERED_VISIBILITIES visibility:private modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Visibilities + BLOCK_BODY + RETURN type=kotlin.Nothing from='private final fun (): kotlin.collections.Map<.Visibility, kotlin.Int> declared in .Visibilities' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:ORDERED_VISIBILITIES type:kotlin.collections.Map<.Visibility, kotlin.Int> visibility:private [final]' type=kotlin.collections.Map<.Visibility, kotlin.Int> origin=null + receiver: GET_VAR ': .Visibilities declared in .Visibilities.' type=.Visibilities origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.kt b/compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.kt new file mode 100644 index 00000000000..d98f1b5ed8c --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.kt @@ -0,0 +1,68 @@ +// !USE_EXPERIMENTAL: kotlin.ExperimentalStdlibApi +// WITH_RUNTIME + +abstract class Visibility(val name: String, val isPublicAPI: Boolean) { + open val internalDisplayName: String + get() = name + + open val externalDisplayName: String + get() = internalDisplayName + + abstract fun mustCheckInImports(): Boolean +} + +object Visibilities { + object Private : Visibility("private", isPublicAPI = false) { + override fun mustCheckInImports(): Boolean = true + } + + object PrivateToThis : Visibility("private_to_this", isPublicAPI = false) { + override val internalDisplayName: String + get() = "private/*private to this*/" + + override fun mustCheckInImports(): Boolean = true + } + + object Protected : Visibility("protected", isPublicAPI = true) { + override fun mustCheckInImports(): Boolean = false + } + + object Internal : Visibility("internal", isPublicAPI = false) { + override fun mustCheckInImports(): Boolean = true + } + + object Public : Visibility("public", isPublicAPI = true) { + override fun mustCheckInImports(): Boolean = false + } + + object Local : Visibility("local", isPublicAPI = false) { + override fun mustCheckInImports(): Boolean = true + } + + object Inherited : Visibility("inherited", isPublicAPI = false) { + override fun mustCheckInImports(): Boolean { + throw IllegalStateException("This method shouldn't be invoked for INHERITED visibility") + } + } + + object InvisibleFake : Visibility("invisible_fake", isPublicAPI = false) { + override fun mustCheckInImports(): Boolean = true + + override val externalDisplayName: String + get() = "invisible (private in a supertype)" + } + + object Unknown : Visibility("unknown", isPublicAPI = false) { + override fun mustCheckInImports(): Boolean { + throw IllegalStateException("This method shouldn't be invoked for UNKNOWN visibility") + } + } + + private val ORDERED_VISIBILITIES: Map = buildMap { + put(PrivateToThis, 0) + put(Private, 0) + put(Internal, 1) + put(Protected, 1) + put(Public, 2) + } +} diff --git a/compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.txt b/compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.txt new file mode 100644 index 00000000000..848ef2c9314 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.txt @@ -0,0 +1,599 @@ +FILE fqName: fileName:/typeVariableAfterBuildMap.kt + CLASS CLASS name:Visibility modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Visibility + CONSTRUCTOR visibility:public <> (name:kotlin.String, isPublicAPI:kotlin.Boolean) returnType:.Visibility [primary] + VALUE_PARAMETER name:name index:0 type:kotlin.String + VALUE_PARAMETER name:isPublicAPI index:1 type:kotlin.Boolean + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Visibility modality:ABSTRACT visibility:public superTypes:[kotlin.Any]' + PROPERTY name:name visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:name type:kotlin.String visibility:private [final] + EXPRESSION_BODY + GET_VAR 'name: kotlin.String declared in .Visibility.' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.String + correspondingProperty: PROPERTY name:name visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Visibility + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .Visibility' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:name type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .Visibility declared in .Visibility.' type=.Visibility origin=null + PROPERTY name:isPublicAPI visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:isPublicAPI type:kotlin.Boolean visibility:private [final] + EXPRESSION_BODY + GET_VAR 'isPublicAPI: kotlin.Boolean declared in .Visibility.' type=kotlin.Boolean origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.Boolean + correspondingProperty: PROPERTY name:isPublicAPI visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Visibility + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Boolean declared in .Visibility' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:isPublicAPI type:kotlin.Boolean visibility:private [final]' type=kotlin.Boolean origin=null + receiver: GET_VAR ': .Visibility declared in .Visibility.' type=.Visibility origin=null + PROPERTY name:internalDisplayName visibility:public modality:OPEN [val] + FUN name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String + correspondingProperty: PROPERTY name:internalDisplayName visibility:public modality:OPEN [val] + $this: VALUE_PARAMETER name: type:.Visibility + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .Visibility' + CALL 'public final fun (): kotlin.String declared in .Visibility' type=kotlin.String origin=GET_PROPERTY + $this: GET_VAR ': .Visibility declared in .Visibility.' type=.Visibility origin=null + PROPERTY name:externalDisplayName visibility:public modality:OPEN [val] + FUN name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String + correspondingProperty: PROPERTY name:externalDisplayName visibility:public modality:OPEN [val] + $this: VALUE_PARAMETER name: type:.Visibility + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .Visibility' + CALL 'public open fun (): kotlin.String declared in .Visibility' type=kotlin.String origin=GET_PROPERTY + $this: GET_VAR ': .Visibility declared in .Visibility.' type=.Visibility origin=null + FUN name:mustCheckInImports visibility:public modality:ABSTRACT <> ($this:.Visibility) returnType:kotlin.Boolean + $this: VALUE_PARAMETER name: type:.Visibility + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS OBJECT name:Visibilities modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Visibilities + CONSTRUCTOR visibility:private <> () returnType:.Visibilities [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Visibilities modality:FINAL visibility:public superTypes:[kotlin.Any]' + CLASS OBJECT name:Private modality:FINAL visibility:public superTypes:[.Visibility] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Visibilities.Private + CONSTRUCTOR visibility:private <> () returnType:.Visibilities.Private [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, isPublicAPI: kotlin.Boolean) [primary] declared in .Visibility' + name: CONST String type=kotlin.String value="private" + isPublicAPI: CONST Boolean type=kotlin.Boolean value=false + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Private modality:FINAL visibility:public superTypes:[.Visibility]' + FUN name:mustCheckInImports visibility:public modality:OPEN <> ($this:.Visibilities.Private) returnType:kotlin.Boolean + overridden: + public abstract fun mustCheckInImports (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibilities.Private + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun mustCheckInImports (): kotlin.Boolean declared in .Visibilities.Private' + CONST Boolean type=kotlin.Boolean value=true + PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.Boolean [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + CLASS OBJECT name:PrivateToThis modality:FINAL visibility:public superTypes:[.Visibility] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Visibilities.PrivateToThis + CONSTRUCTOR visibility:private <> () returnType:.Visibilities.PrivateToThis [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, isPublicAPI: kotlin.Boolean) [primary] declared in .Visibility' + name: CONST String type=kotlin.String value="private_to_this" + isPublicAPI: CONST Boolean type=kotlin.Boolean value=false + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:PrivateToThis modality:FINAL visibility:public superTypes:[.Visibility]' + PROPERTY name:internalDisplayName visibility:public modality:OPEN [val] + FUN name: visibility:public modality:OPEN <> ($this:.Visibilities.PrivateToThis) returnType:kotlin.String + correspondingProperty: PROPERTY name:internalDisplayName visibility:public modality:OPEN [val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibilities.PrivateToThis + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .Visibilities.PrivateToThis' + CONST String type=kotlin.String value="private/*private to this*/" + FUN name:mustCheckInImports visibility:public modality:OPEN <> ($this:.Visibilities.PrivateToThis) returnType:kotlin.Boolean + overridden: + public abstract fun mustCheckInImports (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibilities.PrivateToThis + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun mustCheckInImports (): kotlin.Boolean declared in .Visibilities.PrivateToThis' + CONST Boolean type=kotlin.Boolean value=true + PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.Boolean [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + CLASS OBJECT name:Protected modality:FINAL visibility:public superTypes:[.Visibility] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Visibilities.Protected + CONSTRUCTOR visibility:private <> () returnType:.Visibilities.Protected [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, isPublicAPI: kotlin.Boolean) [primary] declared in .Visibility' + name: CONST String type=kotlin.String value="protected" + isPublicAPI: CONST Boolean type=kotlin.Boolean value=true + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Protected modality:FINAL visibility:public superTypes:[.Visibility]' + FUN name:mustCheckInImports visibility:public modality:OPEN <> ($this:.Visibilities.Protected) returnType:kotlin.Boolean + overridden: + public abstract fun mustCheckInImports (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibilities.Protected + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun mustCheckInImports (): kotlin.Boolean declared in .Visibilities.Protected' + CONST Boolean type=kotlin.Boolean value=false + PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.Boolean [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + CLASS OBJECT name:Internal modality:FINAL visibility:public superTypes:[.Visibility] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Visibilities.Internal + CONSTRUCTOR visibility:private <> () returnType:.Visibilities.Internal [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, isPublicAPI: kotlin.Boolean) [primary] declared in .Visibility' + name: CONST String type=kotlin.String value="internal" + isPublicAPI: CONST Boolean type=kotlin.Boolean value=false + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Internal modality:FINAL visibility:public superTypes:[.Visibility]' + FUN name:mustCheckInImports visibility:public modality:OPEN <> ($this:.Visibilities.Internal) returnType:kotlin.Boolean + overridden: + public abstract fun mustCheckInImports (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibilities.Internal + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun mustCheckInImports (): kotlin.Boolean declared in .Visibilities.Internal' + CONST Boolean type=kotlin.Boolean value=true + PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.Boolean [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + CLASS OBJECT name:Public modality:FINAL visibility:public superTypes:[.Visibility] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Visibilities.Public + CONSTRUCTOR visibility:private <> () returnType:.Visibilities.Public [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, isPublicAPI: kotlin.Boolean) [primary] declared in .Visibility' + name: CONST String type=kotlin.String value="public" + isPublicAPI: CONST Boolean type=kotlin.Boolean value=true + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Public modality:FINAL visibility:public superTypes:[.Visibility]' + FUN name:mustCheckInImports visibility:public modality:OPEN <> ($this:.Visibilities.Public) returnType:kotlin.Boolean + overridden: + public abstract fun mustCheckInImports (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibilities.Public + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun mustCheckInImports (): kotlin.Boolean declared in .Visibilities.Public' + CONST Boolean type=kotlin.Boolean value=false + PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.Boolean [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + CLASS OBJECT name:Local modality:FINAL visibility:public superTypes:[.Visibility] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Visibilities.Local + CONSTRUCTOR visibility:private <> () returnType:.Visibilities.Local [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, isPublicAPI: kotlin.Boolean) [primary] declared in .Visibility' + name: CONST String type=kotlin.String value="local" + isPublicAPI: CONST Boolean type=kotlin.Boolean value=false + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Local modality:FINAL visibility:public superTypes:[.Visibility]' + FUN name:mustCheckInImports visibility:public modality:OPEN <> ($this:.Visibilities.Local) returnType:kotlin.Boolean + overridden: + public abstract fun mustCheckInImports (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibilities.Local + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun mustCheckInImports (): kotlin.Boolean declared in .Visibilities.Local' + CONST Boolean type=kotlin.Boolean value=true + PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.Boolean [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + CLASS OBJECT name:Inherited modality:FINAL visibility:public superTypes:[.Visibility] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Visibilities.Inherited + CONSTRUCTOR visibility:private <> () returnType:.Visibilities.Inherited [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, isPublicAPI: kotlin.Boolean) [primary] declared in .Visibility' + name: CONST String type=kotlin.String value="inherited" + isPublicAPI: CONST Boolean type=kotlin.Boolean value=false + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Inherited modality:FINAL visibility:public superTypes:[.Visibility]' + FUN name:mustCheckInImports visibility:public modality:OPEN <> ($this:.Visibilities.Inherited) returnType:kotlin.Boolean + overridden: + public abstract fun mustCheckInImports (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibilities.Inherited + BLOCK_BODY + THROW type=kotlin.Nothing + CONSTRUCTOR_CALL 'public constructor (p0: @[FlexibleNullability] kotlin.String?) declared in java.lang.IllegalStateException' type=java.lang.IllegalStateException origin=null + p0: CONST String type=kotlin.String value="This method shouldn't be invoked for INHERITED visibility" + PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.Boolean [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + CLASS OBJECT name:InvisibleFake modality:FINAL visibility:public superTypes:[.Visibility] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Visibilities.InvisibleFake + CONSTRUCTOR visibility:private <> () returnType:.Visibilities.InvisibleFake [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, isPublicAPI: kotlin.Boolean) [primary] declared in .Visibility' + name: CONST String type=kotlin.String value="invisible_fake" + isPublicAPI: CONST Boolean type=kotlin.Boolean value=false + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:InvisibleFake modality:FINAL visibility:public superTypes:[.Visibility]' + FUN name:mustCheckInImports visibility:public modality:OPEN <> ($this:.Visibilities.InvisibleFake) returnType:kotlin.Boolean + overridden: + public abstract fun mustCheckInImports (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibilities.InvisibleFake + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun mustCheckInImports (): kotlin.Boolean declared in .Visibilities.InvisibleFake' + CONST Boolean type=kotlin.Boolean value=true + PROPERTY name:externalDisplayName visibility:public modality:OPEN [val] + FUN name: visibility:public modality:OPEN <> ($this:.Visibilities.InvisibleFake) returnType:kotlin.String + correspondingProperty: PROPERTY name:externalDisplayName visibility:public modality:OPEN [val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibilities.InvisibleFake + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .Visibilities.InvisibleFake' + CONST String type=kotlin.String value="invisible (private in a supertype)" + PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.Boolean [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + CLASS OBJECT name:Unknown modality:FINAL visibility:public superTypes:[.Visibility] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Visibilities.Unknown + CONSTRUCTOR visibility:private <> () returnType:.Visibilities.Unknown [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, isPublicAPI: kotlin.Boolean) [primary] declared in .Visibility' + name: CONST String type=kotlin.String value="unknown" + isPublicAPI: CONST Boolean type=kotlin.Boolean value=false + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Unknown modality:FINAL visibility:public superTypes:[.Visibility]' + FUN name:mustCheckInImports visibility:public modality:OPEN <> ($this:.Visibilities.Unknown) returnType:kotlin.Boolean + overridden: + public abstract fun mustCheckInImports (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibilities.Unknown + BLOCK_BODY + THROW type=kotlin.Nothing + CONSTRUCTOR_CALL 'public constructor (p0: @[FlexibleNullability] kotlin.String?) declared in java.lang.IllegalStateException' type=java.lang.IllegalStateException origin=null + p0: CONST String type=kotlin.String value="This method shouldn't be invoked for UNKNOWN visibility" + PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.Boolean [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:isPublicAPI visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Boolean declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in .Visibility + $this: VALUE_PARAMETER name: type:kotlin.Any + PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:externalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.Visibility) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:internalDisplayName visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.String declared in .Visibility + $this: VALUE_PARAMETER name: type:.Visibility + PROPERTY name:ORDERED_VISIBILITIES visibility:private modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:ORDERED_VISIBILITIES type:kotlin.collections.Map<.Visibility, kotlin.Int> visibility:private [final] + EXPRESSION_BODY + CALL 'public final fun buildMap (builderAction: @[ExtensionFunctionType] kotlin.Function1, kotlin.Unit>): kotlin.collections.Map [inline] declared in kotlin.collections' type=kotlin.collections.Map<.Visibility, kotlin.Int> origin=null + : .Visibility + : kotlin.Int + builderAction: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1.Visibility, kotlin.Int>, kotlin.Unit> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:kotlin.collections.MutableMap<.Visibility, kotlin.Int>) returnType:kotlin.Unit + $receiver: VALUE_PARAMETER name:$this$buildMap type:kotlin.collections.MutableMap<.Visibility, kotlin.Int> + BLOCK_BODY + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public abstract fun put (key: K of kotlin.collections.MutableMap, value: V of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? declared in kotlin.collections.MutableMap' type=kotlin.Int? origin=null + $this: GET_VAR '$this$buildMap: kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap<.Visibility, kotlin.Int> origin=null + key: GET_OBJECT 'CLASS OBJECT name:PrivateToThis modality:FINAL visibility:public superTypes:[.Visibility]' type=.Visibilities.PrivateToThis + value: CONST Int type=kotlin.Int value=0 + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public abstract fun put (key: K of kotlin.collections.MutableMap, value: V of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? declared in kotlin.collections.MutableMap' type=kotlin.Int? origin=null + $this: GET_VAR '$this$buildMap: kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap<.Visibility, kotlin.Int> origin=null + key: GET_OBJECT 'CLASS OBJECT name:Private modality:FINAL visibility:public superTypes:[.Visibility]' type=.Visibilities.Private + value: CONST Int type=kotlin.Int value=0 + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public abstract fun put (key: K of kotlin.collections.MutableMap, value: V of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? declared in kotlin.collections.MutableMap' type=kotlin.Int? origin=null + $this: GET_VAR '$this$buildMap: kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap<.Visibility, kotlin.Int> origin=null + key: GET_OBJECT 'CLASS OBJECT name:Internal modality:FINAL visibility:public superTypes:[.Visibility]' type=.Visibilities.Internal + value: CONST Int type=kotlin.Int value=1 + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public abstract fun put (key: K of kotlin.collections.MutableMap, value: V of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? declared in kotlin.collections.MutableMap' type=kotlin.Int? origin=null + $this: GET_VAR '$this$buildMap: kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap<.Visibility, kotlin.Int> origin=null + key: GET_OBJECT 'CLASS OBJECT name:Protected modality:FINAL visibility:public superTypes:[.Visibility]' type=.Visibilities.Protected + value: CONST Int type=kotlin.Int value=1 + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public abstract fun put (key: K of kotlin.collections.MutableMap, value: V of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? declared in kotlin.collections.MutableMap' type=kotlin.Int? origin=null + $this: GET_VAR '$this$buildMap: kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap<.Visibility, kotlin.Int> origin=null + key: GET_OBJECT 'CLASS OBJECT name:Public modality:FINAL visibility:public superTypes:[.Visibility]' type=.Visibilities.Public + value: CONST Int type=kotlin.Int value=2 + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.Visibilities) returnType:kotlin.collections.Map<.Visibility, kotlin.Int> + correspondingProperty: PROPERTY name:ORDERED_VISIBILITIES visibility:private modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Visibilities + BLOCK_BODY + RETURN type=kotlin.Nothing from='private final fun (): kotlin.collections.Map<.Visibility, kotlin.Int> declared in .Visibilities' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:ORDERED_VISIBILITIES type:kotlin.collections.Map<.Visibility, kotlin.Int> visibility:private [final]' type=kotlin.collections.Map<.Visibility, kotlin.Int> origin=null + receiver: GET_VAR ': .Visibilities declared in .Visibilities.' type=.Visibilities origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index 3d038845229..3a4d521ad53 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -1836,6 +1836,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { runTest("compiler/testData/ir/irText/firProblems/throwableStackTrace.kt"); } + @TestMetadata("typeVariableAfterBuildMap.kt") + public void testTypeVariableAfterBuildMap() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.kt"); + } + @TestMetadata("V8ArrayToList.kt") public void testV8ArrayToList() throws Exception { runTest("compiler/testData/ir/irText/firProblems/V8ArrayToList.kt"); From a0dd62f8c58d5ce76c291d88a263d9f0ce9ebc36 Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Thu, 19 Nov 2020 16:37:42 -0800 Subject: [PATCH 106/698] Remove unnecessary expression --- .../org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt index fbbcdfe2ecf..50bfa79c876 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt @@ -239,7 +239,7 @@ internal object CheckLowPriorityInOverloadResolution : CheckerStage() { } internal object PostponedVariablesInitializerResolutionStage : ResolutionStage() { - val BUILDER_INFERENCE_CLASS_ID: ClassId = ClassId.fromString("kotlin/BuilderInference") + private val BUILDER_INFERENCE_CLASS_ID: ClassId = ClassId.fromString("kotlin/BuilderInference") override suspend fun check(candidate: Candidate, callInfo: CallInfo, sink: CheckerSink, context: ResolutionContext) { val argumentMapping = candidate.argumentMapping ?: return @@ -251,7 +251,6 @@ internal object PostponedVariablesInitializerResolutionStage : ResolutionStage() val receiverType = type.receiverType(callInfo.session) ?: continue for (freshVariable in candidate.freshVariables) { - candidate.typeArgumentMapping if (candidate.csBuilder.isPostponedTypeVariable(freshVariable)) continue if (freshVariable !is TypeParameterBasedTypeVariable) continue val typeParameterSymbol = freshVariable.typeParameterSymbol From d58e5b1d95a6c8c1ca8c4201201ee381c67f5040 Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Thu, 19 Nov 2020 16:38:12 -0800 Subject: [PATCH 107/698] Remove unnecessary semi-colons --- .../src/org/jetbrains/kotlin/descriptors/Visibilities.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/compiler.common/src/org/jetbrains/kotlin/descriptors/Visibilities.kt b/core/compiler.common/src/org/jetbrains/kotlin/descriptors/Visibilities.kt index 1f7d06960ef..d4fb425499a 100644 --- a/core/compiler.common/src/org/jetbrains/kotlin/descriptors/Visibilities.kt +++ b/core/compiler.common/src/org/jetbrains/kotlin/descriptors/Visibilities.kt @@ -55,10 +55,10 @@ object Visibilities { @OptIn(ExperimentalStdlibApi::class) private val ORDERED_VISIBILITIES: Map = buildMap { put(PrivateToThis, 0) - put(Private, 0); - put(Internal, 1); - put(Protected, 1); - put(Public, 2); + put(Private, 0) + put(Internal, 1) + put(Protected, 1) + put(Public, 2) } fun compare(first: Visibility, second: Visibility): Int? { From 30c97e6cb46f9a95d6ae2e76aa30596163b907ab Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Fri, 20 Nov 2020 15:49:04 -0800 Subject: [PATCH 108/698] FIR: update unsubstituted return types in builder #KT-43340 Fixed --- .../inference/FirBuilderInferenceSession.kt | 30 ++++++++++--- .../typeVariableAfterBuildMap.fir.txt | 45 ++++++++++--------- .../castsInsideCoroutineInference.fir.txt | 2 +- 3 files changed, 51 insertions(+), 26 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/FirBuilderInferenceSession.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/FirBuilderInferenceSession.kt index efe53431a2b..1f995e9b6d6 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/FirBuilderInferenceSession.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/FirBuilderInferenceSession.kt @@ -5,15 +5,13 @@ package org.jetbrains.kotlin.fir.resolve.inference +import org.jetbrains.kotlin.fir.expressions.FirFunctionCall import org.jetbrains.kotlin.fir.expressions.FirResolvable import org.jetbrains.kotlin.fir.expressions.FirStatement import org.jetbrains.kotlin.fir.resolve.calls.Candidate import org.jetbrains.kotlin.fir.resolve.calls.ResolutionContext import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor -import org.jetbrains.kotlin.fir.types.ConeKotlinType -import org.jetbrains.kotlin.fir.types.ConeStubType -import org.jetbrains.kotlin.fir.types.ConeTypeVariable -import org.jetbrains.kotlin.fir.types.ConeTypeVariableTypeConstructor +import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.visitors.transformSingle import org.jetbrains.kotlin.resolve.calls.inference.buildAbstractResultingSubstitutor import org.jetbrains.kotlin.resolve.calls.inference.components.ConstraintSystemCompletionMode @@ -203,11 +201,33 @@ class FirBuilderInferenceSession( val commonSystemSubstitutor = commonSystem.buildCurrentSubstitutor() as ConeSubstitutor val nonFixedTypesToResultSubstitutor = ConeComposedSubstitutor(commonSystemSubstitutor, nonFixedToVariablesSubstitutor) val completionResultsWriter = components.callCompleter.createCompletionResultsWriter(nonFixedTypesToResultSubstitutor) + + for ((completedCall, _) in commonCalls) { + // TODO: Only update return type? Should we need to visit all appearances of unsubstituted postponed variables in types? + // [transformSingle] bails out very early since the completed call is literally completed, and not a named reference. + (completedCall as? FirFunctionCall)?.let { call -> + val resultType = call.typeRef.substituteTypeRef(nonFixedTypesToResultSubstitutor) + if (resultType != call.typeRef) { + call.replaceTypeRef(resultType) + } + } + // TODO: support diagnostics, see [CoroutineInferenceSession#updateCalls] + } + for ((call, _) in partiallyResolvedCalls) { call.transformSingle(completionResultsWriter, null) - // TODO: support diagnostics, see CoroutineInferenceSession.kt:286 + // TODO: support diagnostics, see [CoroutineInferenceSession#updateCalls] } } + + private fun FirTypeRef.substituteTypeRef( + substitutor: ConeSubstitutor, + ): FirTypeRef = + (this as? FirResolvedTypeRef)?.let { + substitutor.substituteOrNull(this.type)?.let { + this.withReplacedConeType(it) + } + } ?: this } class ConeComposedSubstitutor(val left: ConeSubstitutor, val right: ConeSubstitutor) : ConeSubstitutor() { diff --git a/compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.fir.txt b/compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.fir.txt index 6e20e8a4678..58910843129 100644 --- a/compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.fir.txt +++ b/compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.fir.txt @@ -552,27 +552,32 @@ FILE fqName: fileName:/typeVariableAfterBuildMap.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:kotlin.collections.MutableMap<.Visibility, kotlin.Int>) returnType:kotlin.Unit $receiver: VALUE_PARAMETER name: type:kotlin.collections.MutableMap<.Visibility, kotlin.Int> BLOCK_BODY - CALL 'public abstract fun put (key: K of kotlin.collections.MutableMap, value: V of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? declared in kotlin.collections.MutableMap' type=IrErrorType origin=null - $this: GET_VAR ': kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap origin=null - key: GET_OBJECT 'CLASS OBJECT name:PrivateToThis modality:FINAL visibility:public superTypes:[.Visibility]' type=.Visibilities.PrivateToThis - value: CONST Int type=kotlin.Int value=0 - CALL 'public abstract fun put (key: K of kotlin.collections.MutableMap, value: V of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? declared in kotlin.collections.MutableMap' type=IrErrorType origin=null - $this: GET_VAR ': kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap origin=null - key: GET_OBJECT 'CLASS OBJECT name:Private modality:FINAL visibility:public superTypes:[.Visibility]' type=.Visibilities.Private - value: CONST Int type=kotlin.Int value=0 - CALL 'public abstract fun put (key: K of kotlin.collections.MutableMap, value: V of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? declared in kotlin.collections.MutableMap' type=IrErrorType origin=null - $this: GET_VAR ': kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap origin=null - key: GET_OBJECT 'CLASS OBJECT name:Internal modality:FINAL visibility:public superTypes:[.Visibility]' type=.Visibilities.Internal - value: CONST Int type=kotlin.Int value=1 - CALL 'public abstract fun put (key: K of kotlin.collections.MutableMap, value: V of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? declared in kotlin.collections.MutableMap' type=IrErrorType origin=null - $this: GET_VAR ': kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap origin=null - key: GET_OBJECT 'CLASS OBJECT name:Protected modality:FINAL visibility:public superTypes:[.Visibility]' type=.Visibilities.Protected - value: CONST Int type=kotlin.Int value=1 - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .Visibilities.ORDERED_VISIBILITIES' - CALL 'public abstract fun put (key: K of kotlin.collections.MutableMap, value: V of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? declared in kotlin.collections.MutableMap' type=IrErrorType origin=null + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public abstract fun put (key: K of kotlin.collections.MutableMap, value: V of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? declared in kotlin.collections.MutableMap' type=kotlin.Int? origin=null $this: GET_VAR ': kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap origin=null - key: GET_OBJECT 'CLASS OBJECT name:Public modality:FINAL visibility:public superTypes:[.Visibility]' type=.Visibilities.Public - value: CONST Int type=kotlin.Int value=2 + key: GET_OBJECT 'CLASS OBJECT name:PrivateToThis modality:FINAL visibility:public superTypes:[.Visibility]' type=.Visibilities.PrivateToThis + value: CONST Int type=kotlin.Int value=0 + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public abstract fun put (key: K of kotlin.collections.MutableMap, value: V of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? declared in kotlin.collections.MutableMap' type=kotlin.Int? origin=null + $this: GET_VAR ': kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap origin=null + key: GET_OBJECT 'CLASS OBJECT name:Private modality:FINAL visibility:public superTypes:[.Visibility]' type=.Visibilities.Private + value: CONST Int type=kotlin.Int value=0 + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public abstract fun put (key: K of kotlin.collections.MutableMap, value: V of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? declared in kotlin.collections.MutableMap' type=kotlin.Int? origin=null + $this: GET_VAR ': kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap origin=null + key: GET_OBJECT 'CLASS OBJECT name:Internal modality:FINAL visibility:public superTypes:[.Visibility]' type=.Visibilities.Internal + value: CONST Int type=kotlin.Int value=1 + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public abstract fun put (key: K of kotlin.collections.MutableMap, value: V of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? declared in kotlin.collections.MutableMap' type=kotlin.Int? origin=null + $this: GET_VAR ': kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap origin=null + key: GET_OBJECT 'CLASS OBJECT name:Protected modality:FINAL visibility:public superTypes:[.Visibility]' type=.Visibilities.Protected + value: CONST Int type=kotlin.Int value=1 + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .Visibilities.ORDERED_VISIBILITIES' + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public abstract fun put (key: K of kotlin.collections.MutableMap, value: V of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? declared in kotlin.collections.MutableMap' type=kotlin.Int? origin=null + $this: GET_VAR ': kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap origin=null + key: GET_OBJECT 'CLASS OBJECT name:Public modality:FINAL visibility:public superTypes:[.Visibility]' type=.Visibilities.Public + value: CONST Int type=kotlin.Int value=2 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.Visibilities) returnType:kotlin.collections.Map<.Visibility, kotlin.Int> correspondingProperty: PROPERTY name:ORDERED_VISIBILITIES visibility:private modality:FINAL [val] $this: VALUE_PARAMETER name: type:.Visibilities diff --git a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.txt b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.txt index 1da9b222f7e..a804528e851 100644 --- a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.txt +++ b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.txt @@ -39,7 +39,7 @@ FILE fqName: fileName:/castsInsideCoroutineInference.kt $receiver: VALUE_PARAMETER name: type:.FlowCollector.onCompletion> BLOCK_BODY VAR name:safeCollector type:.SafeCollector [val] - CONSTRUCTOR_CALL 'public constructor (collector: .FlowCollector.SafeCollector>) [primary] declared in .SafeCollector' type=.SafeCollector origin=null + CONSTRUCTOR_CALL 'public constructor (collector: .FlowCollector.SafeCollector>) [primary] declared in .SafeCollector' type=.SafeCollector.onCompletion> origin=null : IrErrorType collector: GET_VAR ': .FlowCollector.onCompletion> declared in .onCompletion.' type=.FlowCollector origin=null CALL 'public final fun invokeSafely (action: @[ExtensionFunctionType] @[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<.FlowCollector.invokeSafely>, kotlin.Throwable?, kotlin.Unit>): kotlin.Unit [suspend] declared in ' type=kotlin.Unit origin=null From 0a5b899aab588457c593b6b0d4390887a9e37273 Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Mon, 23 Nov 2020 14:58:01 -0800 Subject: [PATCH 109/698] FIR: more comprehensive substitution of stub types after builder inference --- .../inference/FirBuilderInferenceSession.kt | 43 +++++++++++-------- .../impl/FirResolvedArgumentList.kt | 14 +++++- .../lackOfNullCheckOnNullableInsideBuild.kt | 1 - .../substituteStubTypeIntoCR.kt | 1 - ...teStubTypeIntolambdaParameterDescriptor.kt | 1 - ...peVariableIntolambdaParameterDescriptor.kt | 1 - .../typeVariableAfterBuildMap.fir.txt | 10 ++--- .../castsInsideCoroutineInference.fir.txt | 13 +++--- 8 files changed, 49 insertions(+), 35 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/FirBuilderInferenceSession.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/FirBuilderInferenceSession.kt index 1f995e9b6d6..1a923125c2d 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/FirBuilderInferenceSession.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/FirBuilderInferenceSession.kt @@ -5,14 +5,15 @@ package org.jetbrains.kotlin.fir.resolve.inference -import org.jetbrains.kotlin.fir.expressions.FirFunctionCall +import org.jetbrains.kotlin.fir.FirElement +import org.jetbrains.kotlin.fir.expressions.FirArgumentList import org.jetbrains.kotlin.fir.expressions.FirResolvable import org.jetbrains.kotlin.fir.expressions.FirStatement import org.jetbrains.kotlin.fir.resolve.calls.Candidate import org.jetbrains.kotlin.fir.resolve.calls.ResolutionContext import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor import org.jetbrains.kotlin.fir.types.* -import org.jetbrains.kotlin.fir.visitors.transformSingle +import org.jetbrains.kotlin.fir.visitors.* import org.jetbrains.kotlin.resolve.calls.inference.buildAbstractResultingSubstitutor import org.jetbrains.kotlin.resolve.calls.inference.components.ConstraintSystemCompletionMode import org.jetbrains.kotlin.resolve.calls.inference.model.ConstraintKind @@ -196,21 +197,16 @@ class FirBuilderInferenceSession( return introducedConstraint } + // TODO: besides calls, perhaps use the stub type substitutor for all top-level expressions inside the lambda private fun updateCalls(commonSystem: NewConstraintSystemImpl) { val nonFixedToVariablesSubstitutor = createNonFixedTypeToVariableSubstitutor() val commonSystemSubstitutor = commonSystem.buildCurrentSubstitutor() as ConeSubstitutor val nonFixedTypesToResultSubstitutor = ConeComposedSubstitutor(commonSystemSubstitutor, nonFixedToVariablesSubstitutor) val completionResultsWriter = components.callCompleter.createCompletionResultsWriter(nonFixedTypesToResultSubstitutor) + val stubTypeSubstitutor = FirStubTypeTransformer(nonFixedTypesToResultSubstitutor) for ((completedCall, _) in commonCalls) { - // TODO: Only update return type? Should we need to visit all appearances of unsubstituted postponed variables in types? - // [transformSingle] bails out very early since the completed call is literally completed, and not a named reference. - (completedCall as? FirFunctionCall)?.let { call -> - val resultType = call.typeRef.substituteTypeRef(nonFixedTypesToResultSubstitutor) - if (resultType != call.typeRef) { - call.replaceTypeRef(resultType) - } - } + completedCall.transformSingle(stubTypeSubstitutor, null) // TODO: support diagnostics, see [CoroutineInferenceSession#updateCalls] } @@ -219,15 +215,6 @@ class FirBuilderInferenceSession( // TODO: support diagnostics, see [CoroutineInferenceSession#updateCalls] } } - - private fun FirTypeRef.substituteTypeRef( - substitutor: ConeSubstitutor, - ): FirTypeRef = - (this as? FirResolvedTypeRef)?.let { - substitutor.substituteOrNull(this.type)?.let { - this.withReplacedConeType(it) - } - } ?: this } class ConeComposedSubstitutor(val left: ConeSubstitutor, val right: ConeSubstitutor) : ConeSubstitutor() { @@ -236,3 +223,21 @@ class ConeComposedSubstitutor(val left: ConeSubstitutor, val right: ConeSubstitu return left.substituteOrNull(rightSubstitution ?: type) } } + +class FirStubTypeTransformer( + private val substitutor: ConeSubstitutor +) : FirDefaultTransformer() { + + override fun transformElement(element: E, data: Nothing?): CompositeTransformResult { + @Suppress("UNCHECKED_CAST") + return (element.transformChildren(this, data) as E).compose() + } + + override fun transformResolvedTypeRef(resolvedTypeRef: FirResolvedTypeRef, data: Nothing?): CompositeTransformResult = + substitutor.substituteOrNull(resolvedTypeRef.type)?.let { + resolvedTypeRef.withReplacedConeType(it).compose() + } ?: resolvedTypeRef.compose() + + override fun transformArgumentList(argumentList: FirArgumentList, data: Nothing?): CompositeTransformResult = + argumentList.transformArguments(this, data).compose() +} diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirResolvedArgumentList.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirResolvedArgumentList.kt index f3d8cefb5ba..caf5e50a2ce 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirResolvedArgumentList.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirResolvedArgumentList.kt @@ -7,12 +7,19 @@ package org.jetbrains.kotlin.fir.expressions.impl import org.jetbrains.kotlin.fir.declarations.FirValueParameter import org.jetbrains.kotlin.fir.expressions.FirAbstractArgumentList +import org.jetbrains.kotlin.fir.expressions.FirArgumentList import org.jetbrains.kotlin.fir.expressions.FirExpression +import org.jetbrains.kotlin.fir.visitors.FirTransformer import org.jetbrains.kotlin.fir.visitors.FirVisitor +import org.jetbrains.kotlin.fir.visitors.transformSingle class FirResolvedArgumentList internal constructor( - val mapping: LinkedHashMap + mapping: LinkedHashMap ) : FirAbstractArgumentList() { + + var mapping: LinkedHashMap = mapping + private set + override val arguments: List get() = mapping.keys.toList() @@ -21,4 +28,9 @@ class FirResolvedArgumentList internal constructor( argument.accept(visitor, data) } } + + override fun transformArguments(transformer: FirTransformer, data: D): FirArgumentList { + mapping = mapping.mapKeys { (k, _) -> k.transformSingle(transformer, data) } as LinkedHashMap + return this + } } diff --git a/compiler/testData/codegen/box/builderInference/lackOfNullCheckOnNullableInsideBuild.kt b/compiler/testData/codegen/box/builderInference/lackOfNullCheckOnNullableInsideBuild.kt index c0a0d42b12c..6dc61506d08 100644 --- a/compiler/testData/codegen/box/builderInference/lackOfNullCheckOnNullableInsideBuild.kt +++ b/compiler/testData/codegen/box/builderInference/lackOfNullCheckOnNullableInsideBuild.kt @@ -1,6 +1,5 @@ // !LANGUAGE: +NewInference // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR // Issue: KT-36371 import kotlin.experimental.ExperimentalTypeInference diff --git a/compiler/testData/codegen/box/builderInference/substituteStubTypeIntoCR.kt b/compiler/testData/codegen/box/builderInference/substituteStubTypeIntoCR.kt index e719bf80692..c1aee44c2fe 100644 --- a/compiler/testData/codegen/box/builderInference/substituteStubTypeIntoCR.kt +++ b/compiler/testData/codegen/box/builderInference/substituteStubTypeIntoCR.kt @@ -1,6 +1,5 @@ // DONT_TARGET_EXACT_BACKEND: WASM // WASM_MUTE_REASON: COROUTINES -// IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JVM_IR // IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: NATIVE diff --git a/compiler/testData/codegen/box/builderInference/substituteStubTypeIntolambdaParameterDescriptor.kt b/compiler/testData/codegen/box/builderInference/substituteStubTypeIntolambdaParameterDescriptor.kt index b4c5fea00ff..302659e526a 100644 --- a/compiler/testData/codegen/box/builderInference/substituteStubTypeIntolambdaParameterDescriptor.kt +++ b/compiler/testData/codegen/box/builderInference/substituteStubTypeIntolambdaParameterDescriptor.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME import kotlin.experimental.ExperimentalTypeInference diff --git a/compiler/testData/codegen/box/builderInference/substituteTypeVariableIntolambdaParameterDescriptor.kt b/compiler/testData/codegen/box/builderInference/substituteTypeVariableIntolambdaParameterDescriptor.kt index bd4304c16c5..36c7836fc25 100644 --- a/compiler/testData/codegen/box/builderInference/substituteTypeVariableIntolambdaParameterDescriptor.kt +++ b/compiler/testData/codegen/box/builderInference/substituteTypeVariableIntolambdaParameterDescriptor.kt @@ -1,5 +1,4 @@ // TARGET_BACKEND: JVM -// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME class Foo diff --git a/compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.fir.txt b/compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.fir.txt index 58910843129..102f6689c32 100644 --- a/compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.fir.txt +++ b/compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.fir.txt @@ -554,28 +554,28 @@ FILE fqName: fileName:/typeVariableAfterBuildMap.kt BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'public abstract fun put (key: K of kotlin.collections.MutableMap, value: V of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? declared in kotlin.collections.MutableMap' type=kotlin.Int? origin=null - $this: GET_VAR ': kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap origin=null + $this: GET_VAR ': kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap<.Visibility, kotlin.Int> origin=null key: GET_OBJECT 'CLASS OBJECT name:PrivateToThis modality:FINAL visibility:public superTypes:[.Visibility]' type=.Visibilities.PrivateToThis value: CONST Int type=kotlin.Int value=0 TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'public abstract fun put (key: K of kotlin.collections.MutableMap, value: V of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? declared in kotlin.collections.MutableMap' type=kotlin.Int? origin=null - $this: GET_VAR ': kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap origin=null + $this: GET_VAR ': kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap<.Visibility, kotlin.Int> origin=null key: GET_OBJECT 'CLASS OBJECT name:Private modality:FINAL visibility:public superTypes:[.Visibility]' type=.Visibilities.Private value: CONST Int type=kotlin.Int value=0 TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'public abstract fun put (key: K of kotlin.collections.MutableMap, value: V of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? declared in kotlin.collections.MutableMap' type=kotlin.Int? origin=null - $this: GET_VAR ': kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap origin=null + $this: GET_VAR ': kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap<.Visibility, kotlin.Int> origin=null key: GET_OBJECT 'CLASS OBJECT name:Internal modality:FINAL visibility:public superTypes:[.Visibility]' type=.Visibilities.Internal value: CONST Int type=kotlin.Int value=1 TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'public abstract fun put (key: K of kotlin.collections.MutableMap, value: V of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? declared in kotlin.collections.MutableMap' type=kotlin.Int? origin=null - $this: GET_VAR ': kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap origin=null + $this: GET_VAR ': kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap<.Visibility, kotlin.Int> origin=null key: GET_OBJECT 'CLASS OBJECT name:Protected modality:FINAL visibility:public superTypes:[.Visibility]' type=.Visibilities.Protected value: CONST Int type=kotlin.Int value=1 RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .Visibilities.ORDERED_VISIBILITIES' TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'public abstract fun put (key: K of kotlin.collections.MutableMap, value: V of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? declared in kotlin.collections.MutableMap' type=kotlin.Int? origin=null - $this: GET_VAR ': kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap origin=null + $this: GET_VAR ': kotlin.collections.MutableMap<.Visibility, kotlin.Int> declared in .Visibilities.ORDERED_VISIBILITIES.' type=kotlin.collections.MutableMap<.Visibility, kotlin.Int> origin=null key: GET_OBJECT 'CLASS OBJECT name:Public modality:FINAL visibility:public superTypes:[.Visibility]' type=.Visibilities.Public value: CONST Int type=kotlin.Int value=2 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.Visibilities) returnType:kotlin.collections.Map<.Visibility, kotlin.Int> diff --git a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.txt b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.txt index a804528e851..bc4273f3b70 100644 --- a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.txt +++ b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.txt @@ -25,7 +25,8 @@ FILE fqName: fileName:/castsInsideCoroutineInference.kt CALL 'public abstract fun invoke (p1: P1 of kotlin.coroutines.SuspendFunction2, p2: P2 of kotlin.coroutines.SuspendFunction2): R of kotlin.coroutines.SuspendFunction2 [suspend,operator] declared in kotlin.coroutines.SuspendFunction2' type=kotlin.Unit origin=null $this: GET_VAR 'block: @[ExtensionFunctionType] @[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<.CoroutineScope, .FlowCollector.scopedFlow>, kotlin.Unit> declared in .scopedFlow' type=@[ExtensionFunctionType] @[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<.CoroutineScope, .FlowCollector.scopedFlow>, kotlin.Unit> origin=VARIABLE_AS_FUNCTION p1: GET_VAR ': .CoroutineScope declared in .scopedFlow..' type=.CoroutineScope origin=null - p2: GET_VAR 'val collector: .FlowCollector [val] declared in .scopedFlow.' type=.FlowCollector origin=null + p2: TYPE_OP type=.FlowCollector origin=IMPLICIT_CAST typeOperand=.FlowCollector + GET_VAR 'val collector: .FlowCollector [val] declared in .scopedFlow.' type=.FlowCollector.scopedFlow> origin=null FUN name:onCompletion visibility:public modality:FINAL ($receiver:.Flow.onCompletion>, action:@[ExtensionFunctionType] @[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<.FlowCollector.onCompletion>, kotlin.Throwable?, kotlin.Unit>) returnType:.Flow.onCompletion> TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] $receiver: VALUE_PARAMETER name: type:.Flow.onCompletion> @@ -40,11 +41,11 @@ FILE fqName: fileName:/castsInsideCoroutineInference.kt BLOCK_BODY VAR name:safeCollector type:.SafeCollector [val] CONSTRUCTOR_CALL 'public constructor (collector: .FlowCollector.SafeCollector>) [primary] declared in .SafeCollector' type=.SafeCollector.onCompletion> origin=null - : IrErrorType - collector: GET_VAR ': .FlowCollector.onCompletion> declared in .onCompletion.' type=.FlowCollector origin=null + : T of .onCompletion + collector: GET_VAR ': .FlowCollector.onCompletion> declared in .onCompletion.' type=.FlowCollector.onCompletion> origin=null CALL 'public final fun invokeSafely (action: @[ExtensionFunctionType] @[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<.FlowCollector.invokeSafely>, kotlin.Throwable?, kotlin.Unit>): kotlin.Unit [suspend] declared in ' type=kotlin.Unit origin=null : T of .onCompletion - $receiver: GET_VAR 'val safeCollector: .SafeCollector [val] declared in .onCompletion.' type=.SafeCollector origin=null + $receiver: GET_VAR 'val safeCollector: .SafeCollector [val] declared in .onCompletion.' type=.SafeCollector.onCompletion> origin=null action: GET_VAR 'action: @[ExtensionFunctionType] @[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<.FlowCollector.onCompletion>, kotlin.Throwable?, kotlin.Unit> declared in .onCompletion' type=@[ExtensionFunctionType] @[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<.FlowCollector.onCompletion>, kotlin.Throwable?, kotlin.Unit> origin=null FUN name:invokeSafely visibility:public modality:FINAL ($receiver:.FlowCollector.invokeSafely>, action:@[ExtensionFunctionType] @[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<.FlowCollector.invokeSafely>, kotlin.Throwable?, kotlin.Unit>) returnType:kotlin.Unit [suspend] TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] @@ -136,8 +137,8 @@ FILE fqName: fileName:/castsInsideCoroutineInference.kt BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (value: kotlin.Any?): kotlin.Unit [suspend] declared in .asChannel.' CALL 'public abstract fun send (e: E of .SendChannel): kotlin.Unit [suspend] declared in .SendChannel' type=kotlin.Unit origin=null - $this: CALL 'public abstract fun (): .SendChannel.ProducerScope> declared in .ProducerScope' type=.SendChannel origin=GET_PROPERTY - $this: GET_VAR ': .ProducerScope declared in .asChannel.' type=.ProducerScope origin=null + $this: CALL 'public abstract fun (): .SendChannel.ProducerScope> declared in .ProducerScope' type=.SendChannel origin=GET_PROPERTY + $this: GET_VAR ': .ProducerScope declared in .asChannel.' type=.ProducerScope origin=null e: BLOCK type=kotlin.Any origin=ELVIS VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Any? [val] GET_VAR 'value: kotlin.Any? declared in .asChannel..' type=kotlin.Any? origin=null From 7327c202006cf8ea2f6556e1ed9fb98cb0209037 Mon Sep 17 00:00:00 2001 From: pyos Date: Tue, 17 Nov 2020 14:02:35 +0100 Subject: [PATCH 110/698] FIR: add a resolution mode for property delegates Like function arguments, they are context-dependent, but unlike function arguments, callable references should be resolved eagerly as if they are explicit receivers. --- .../generators/CallAndReferenceGenerator.kt | 20 +++++++------- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 ++++ .../kotlin/fir/builder/ConversionUtils.kt | 27 ++++++++++--------- .../kotlin/fir/resolve/ResolutionMode.kt | 1 + .../FirDeclarationsResolveTransformer.kt | 8 +++--- .../FirExpressionsResolveTransformer.kt | 3 +-- .../delegatedProperty/delegateToAnother.kt | 9 +++++++ ...eDelegateOnFunctionalTypeWithThis.fir.fail | 2 -- ...ideDelegateOnFunctionalTypeWithThis.fir.kt | 2 +- .../codegen/BlackBoxCodegenTestGenerated.java | 5 ++++ .../LightAnalysisModeTestGenerated.java | 5 ++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 5 ++++ .../IrJsCodegenBoxES6TestGenerated.java | 5 ++++ .../IrJsCodegenBoxTestGenerated.java | 5 ++++ .../semantics/JsCodegenBoxTestGenerated.java | 5 ++++ 15 files changed, 75 insertions(+), 32 deletions(-) create mode 100644 compiler/testData/codegen/box/delegatedProperty/delegateToAnother.kt delete mode 100644 compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/provideDelegateOnFunctionalTypeWithThis.fir.fail diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt index e647039c01f..67f3a8d6c0e 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt @@ -6,12 +6,12 @@ package org.jetbrains.kotlin.fir.backend.generators import org.jetbrains.kotlin.descriptors.Visibilities +import org.jetbrains.kotlin.fir.FirFakeSourceElementKind import org.jetbrains.kotlin.fir.backend.* import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.dispatchReceiverClassOrNull import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.expressions.impl.FirNoReceiverExpression -import org.jetbrains.kotlin.fir.psi import org.jetbrains.kotlin.fir.references.FirDelegateFieldReference import org.jetbrains.kotlin.fir.references.FirReference import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference @@ -35,7 +35,6 @@ import org.jetbrains.kotlin.ir.expressions.impl.* import org.jetbrains.kotlin.ir.symbols.* import org.jetbrains.kotlin.ir.types.* import org.jetbrains.kotlin.ir.util.* -import org.jetbrains.kotlin.psi.KtPropertyDelegate import org.jetbrains.kotlin.psi2ir.generators.hasNoSideEffects import org.jetbrains.kotlin.types.AbstractTypeApproximator @@ -59,11 +58,12 @@ class CallAndReferenceGenerator( val symbol = callableReferenceAccess.calleeReference.toSymbolForCall(session, classifierStorage, declarationStorage, conversionScope) val type = callableReferenceAccess.typeRef.toIrType() - fun propertyOrigin(): IrStatementOrigin? = - when (callableReferenceAccess.source?.psi?.parent) { - is KtPropertyDelegate -> IrStatementOrigin.PROPERTY_REFERENCE_FOR_DELEGATE - else -> null - } + // val x by y -> + // val `x$delegate` = y + // val x get() = `x$delegate`.getValue(this, ::x) + // The reference here (like the rest of the accessor) has DefaultAccessor source kind. + val isForDelegate = callableReferenceAccess.source?.kind == FirFakeSourceElementKind.DefaultAccessor + val origin = if (isForDelegate) IrStatementOrigin.PROPERTY_REFERENCE_FOR_DELEGATE else null return callableReferenceAccess.convertWithOffsets { startOffset, endOffset -> when (symbol) { is IrPropertySymbol -> { @@ -82,7 +82,7 @@ class CallAndReferenceGenerator( field = backingFieldSymbol, getter = referencedPropertyGetter?.symbol, setter = referencedPropertySetterSymbol, - propertyOrigin() + origin = origin ) } is IrLocalDelegatedPropertySymbol -> { @@ -91,7 +91,7 @@ class CallAndReferenceGenerator( delegate = symbol.owner.delegate.symbol, getter = symbol.owner.getter.symbol, setter = symbol.owner.setter?.symbol, - IrStatementOrigin.PROPERTY_REFERENCE_FOR_DELEGATE + origin = origin ) } is IrFieldSymbol -> { @@ -111,7 +111,7 @@ class CallAndReferenceGenerator( field = symbol, getter = if (referencedField.isStatic) null else propertySymbol.owner.getter?.symbol, setter = if (referencedField.isStatic) null else propertySymbol.owner.setter?.symbol, - propertyOrigin() + origin ) } is IrConstructorSymbol -> { diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 12fe003c7d0..500f8d943e2 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -10028,6 +10028,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/delegatedProperty/delegateForExtPropertyInClass.kt"); } + @TestMetadata("delegateToAnother.kt") + public void testDelegateToAnother() throws Exception { + runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnother.kt"); + } + @TestMetadata("delegateWithPrivateSet.kt") public void testDelegateWithPrivateSet() throws Exception { runTest("compiler/testData/codegen/box/delegatedProperty/delegateWithPrivateSet.kt"); diff --git a/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/ConversionUtils.kt b/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/ConversionUtils.kt index 962a5e4afa1..ea464e31fd5 100644 --- a/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/ConversionUtils.kt +++ b/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/ConversionUtils.kt @@ -292,6 +292,7 @@ fun FirPropertyBuilder.generateAccessorsByDelegate( else -> null } val isMember = ownerSymbol != null + val fakeSource = delegateBuilder.source?.fakeElement(FirFakeSourceElementKind.DefaultAccessor) /* * If we have delegation with provide delegate then we generate call like @@ -310,7 +311,7 @@ fun FirPropertyBuilder.generateAccessorsByDelegate( fun thisRef(isForDelegateProviderCall: Boolean = false): FirExpression = when { ownerSymbol != null -> buildThisReceiverExpression { - source = delegateBuilder.source + source = fakeSource calleeReference = buildImplicitThisReference { boundSymbol = ownerSymbol } @@ -320,7 +321,7 @@ fun FirPropertyBuilder.generateAccessorsByDelegate( } } isExtension && !isForDelegateProviderCall -> buildThisReceiverExpression { - source = delegateBuilder.source + source = fakeSource calleeReference = buildImplicitThisReference { boundSymbol = this@generateAccessorsByDelegate.symbol } @@ -329,7 +330,7 @@ fun FirPropertyBuilder.generateAccessorsByDelegate( } fun delegateAccess() = buildQualifiedAccessExpression { - source = delegateBuilder.source + source = fakeSource calleeReference = buildDelegateFieldReference { resolvedSymbol = delegateFieldSymbol } @@ -340,9 +341,9 @@ fun FirPropertyBuilder.generateAccessorsByDelegate( val isVar = this@generateAccessorsByDelegate.isVar fun propertyRef() = buildCallableReferenceAccess { - source = delegateBuilder.source + source = fakeSource calleeReference = buildResolvedNamedReference { - source = delegateBuilder.source + source = fakeSource name = this@generateAccessorsByDelegate.name resolvedSymbol = this@generateAccessorsByDelegate.symbol } @@ -368,7 +369,7 @@ fun FirPropertyBuilder.generateAccessorsByDelegate( delegateBuilder.delegateProvider = if (stubMode) buildExpressionStub() else buildFunctionCall { explicitReceiver = receiver calleeReference = buildSimpleNamedReference { - source = delegateBuilder.source + source = fakeSource name = PROVIDE_DELEGATE } argumentList = buildBinaryArgumentList(thisRef(isForDelegateProviderCall = true), propertyRef()) @@ -379,7 +380,7 @@ fun FirPropertyBuilder.generateAccessorsByDelegate( val annotations = getter?.annotations val returnTarget = FirFunctionTarget(null, isLambda = false) getter = buildPropertyAccessor { - this.source = delegateBuilder.source + this.source = fakeSource this.session = session origin = FirDeclarationOrigin.Source returnTypeRef = buildImplicitTypeRef() @@ -390,10 +391,10 @@ fun FirPropertyBuilder.generateAccessorsByDelegate( body = FirSingleExpressionBlock( buildReturnExpression { result = buildFunctionCall { - source = delegateBuilder.source + source = fakeSource explicitReceiver = delegateAccess() calleeReference = buildSimpleNamedReference { - source = delegateBuilder.source + source = fakeSource name = GET_VALUE } argumentList = buildBinaryArgumentList(thisRef(), propertyRef()) @@ -411,14 +412,14 @@ fun FirPropertyBuilder.generateAccessorsByDelegate( if (isVar && (setter == null || setter is FirDefaultPropertyAccessor)) { val annotations = setter?.annotations setter = buildPropertyAccessor { - this.source = delegateBuilder.source + this.source = fakeSource this.session = session origin = FirDeclarationOrigin.Source returnTypeRef = session.builtinTypes.unitType isGetter = false status = FirDeclarationStatusImpl(Visibilities.Unknown, Modality.FINAL) val parameter = buildValueParameter { - source = delegateBuilder.source + source = fakeSource this.session = session origin = FirDeclarationOrigin.Source returnTypeRef = buildImplicitTypeRef() @@ -432,7 +433,7 @@ fun FirPropertyBuilder.generateAccessorsByDelegate( symbol = FirPropertyAccessorSymbol() body = FirSingleExpressionBlock( buildFunctionCall { - source = delegateBuilder.source + source = fakeSource explicitReceiver = delegateAccess() calleeReference = buildSimpleNamedReference { name = SET_VALUE @@ -442,7 +443,7 @@ fun FirPropertyBuilder.generateAccessorsByDelegate( arguments += propertyRef() arguments += buildQualifiedAccessExpression { calleeReference = buildResolvedNamedReference { - source = delegateBuilder.source + source = fakeSource name = DELEGATED_SETTER_PARAM resolvedSymbol = parameter.symbol } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolutionMode.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolutionMode.kt index b3622423aad..44d33bb116f 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolutionMode.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolutionMode.kt @@ -13,6 +13,7 @@ import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef sealed class ResolutionMode { object ContextDependent : ResolutionMode() + object ContextDependentDelegate : ResolutionMode() object ContextIndependent : ResolutionMode() // TODO: it's better not to use WithExpectedType(FirImplicitTypeRef) class WithExpectedType(val expectedTypeRef: FirTypeRef) : ResolutionMode() diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt index 9b35691af73..2772a559120 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt @@ -192,7 +192,7 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor } private fun transformPropertyWithDelegate(property: FirProperty) { - property.transformDelegate(transformer, ResolutionMode.ContextDependent) + property.transformDelegate(transformer, ResolutionMode.ContextDependentDelegate) val delegateExpression = property.delegate!! @@ -230,7 +230,7 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor ): CompositeTransformResult { dataFlowAnalyzer.enterDelegateExpression() try { - val delegateProvider = wrappedDelegateExpression.delegateProvider.transformSingle(transformer, ResolutionMode.ContextDependent) + val delegateProvider = wrappedDelegateExpression.delegateProvider.transformSingle(transformer, data) when (val calleeReference = (delegateProvider as FirResolvable).calleeReference) { is FirResolvedNamedReference -> return delegateProvider.compose() is FirNamedReferenceWithCandidate -> { @@ -243,7 +243,7 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor (delegateProvider as? FirFunctionCall)?.let { dataFlowAnalyzer.dropSubgraphFromCall(it) } return wrappedDelegateExpression.expression - .transformSingle(transformer, ResolutionMode.ContextDependent) + .transformSingle(transformer, data) .approximateIfIsIntegerConst() .compose() } finally { @@ -669,7 +669,7 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor context.saveContextForAnonymousFunction(anonymousFunction) } return when (data) { - ResolutionMode.ContextDependent -> { + is ResolutionMode.ContextDependent, is ResolutionMode.ContextDependentDelegate -> { dataFlowAnalyzer.visitPostponedAnonymousFunction(anonymousFunction) anonymousFunction.addReturn().compose() } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt index 82218152e9e..340b9122ad8 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt @@ -33,7 +33,6 @@ import org.jetbrains.kotlin.fir.symbols.impl.FirVariableSymbol import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.types.builder.* import org.jetbrains.kotlin.fir.visitors.* -import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.calls.tower.CandidateApplicability import org.jetbrains.kotlin.types.TypeApproximatorConfiguration @@ -612,7 +611,7 @@ open class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransform else callableReferenceAccess - if (data !is ResolutionMode.ContextDependent) { + if (data !is ResolutionMode.ContextDependent /* ContextDependentDelegate is Ok here */) { val resolvedReference = components.syntheticCallGenerator.resolveCallableReferenceWithSyntheticOuterCall( callableReferenceAccess, data.expectedType, resolutionContext, diff --git a/compiler/testData/codegen/box/delegatedProperty/delegateToAnother.kt b/compiler/testData/codegen/box/delegatedProperty/delegateToAnother.kt new file mode 100644 index 00000000000..12365e86222 --- /dev/null +++ b/compiler/testData/codegen/box/delegatedProperty/delegateToAnother.kt @@ -0,0 +1,9 @@ +// WITH_REFLECT +// WITH_RUNTIME +class C(val x: String) + +val x = "O" +val y by ::x +val z by C("K")::x + +fun box(): String = y + z diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/provideDelegateOnFunctionalTypeWithThis.fir.fail b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/provideDelegateOnFunctionalTypeWithThis.fir.fail deleted file mode 100644 index 54d7f40e102..00000000000 --- a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/provideDelegateOnFunctionalTypeWithThis.fir.fail +++ /dev/null @@ -1,2 +0,0 @@ -Failures detected in FirBodyResolveTransformerAdapter, file: /provideDelegateOnFunctionalTypeWithThis.fir.kt -Cause: java.lang.ClassCastException: org.jetbrains.kotlin.fir.types.impl.FirImplicitTypeRefImpl cannot be cast to org.jetbrains.kotlin.fir.types.FirResolvedTypeRef diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/provideDelegateOnFunctionalTypeWithThis.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/provideDelegateOnFunctionalTypeWithThis.fir.kt index 9a645ad5a63..9b80648ff3b 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/provideDelegateOnFunctionalTypeWithThis.fir.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/provideDelegateOnFunctionalTypeWithThis.fir.kt @@ -13,7 +13,7 @@ fun wrong(arg: Wrong) {} class Wrong class Right { - val prop: () -> Unit by ::wrong + val prop: () -> Unit by ::wrong } fun box(): String { diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 6fbd66a341d..0f2bb3db218 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -11428,6 +11428,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/delegatedProperty/delegateForExtPropertyInClass.kt"); } + @TestMetadata("delegateToAnother.kt") + public void testDelegateToAnother() throws Exception { + runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnother.kt"); + } + @TestMetadata("delegateWithPrivateSet.kt") public void testDelegateWithPrivateSet() throws Exception { runTest("compiler/testData/codegen/box/delegatedProperty/delegateWithPrivateSet.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 430a827ede8..133cec36ca8 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -11433,6 +11433,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/delegatedProperty/delegateForExtPropertyInClass.kt"); } + @TestMetadata("delegateToAnother.kt") + public void testDelegateToAnother() throws Exception { + runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnother.kt"); + } + @TestMetadata("delegateWithPrivateSet.kt") public void testDelegateWithPrivateSet() throws Exception { runTest("compiler/testData/codegen/box/delegatedProperty/delegateWithPrivateSet.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 43df8c8d995..44178290ef3 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -10028,6 +10028,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/delegatedProperty/delegateForExtPropertyInClass.kt"); } + @TestMetadata("delegateToAnother.kt") + public void testDelegateToAnother() throws Exception { + runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnother.kt"); + } + @TestMetadata("delegateWithPrivateSet.kt") public void testDelegateWithPrivateSet() throws Exception { runTest("compiler/testData/codegen/box/delegatedProperty/delegateWithPrivateSet.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index fe9e7de73fb..532559db1f0 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -8543,6 +8543,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/delegatedProperty/delegateForExtPropertyInClass.kt"); } + @TestMetadata("delegateToAnother.kt") + public void testDelegateToAnother() throws Exception { + runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnother.kt"); + } + @TestMetadata("delegateWithPrivateSet.kt") public void testDelegateWithPrivateSet() throws Exception { runTest("compiler/testData/codegen/box/delegatedProperty/delegateWithPrivateSet.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 20fbfa79448..05738d7f7ab 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -8543,6 +8543,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/delegatedProperty/delegateForExtPropertyInClass.kt"); } + @TestMetadata("delegateToAnother.kt") + public void testDelegateToAnother() throws Exception { + runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnother.kt"); + } + @TestMetadata("delegateWithPrivateSet.kt") public void testDelegateWithPrivateSet() throws Exception { runTest("compiler/testData/codegen/box/delegatedProperty/delegateWithPrivateSet.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 8729285c012..aac27644c42 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -8543,6 +8543,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/delegatedProperty/delegateForExtPropertyInClass.kt"); } + @TestMetadata("delegateToAnother.kt") + public void testDelegateToAnother() throws Exception { + runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnother.kt"); + } + @TestMetadata("delegateWithPrivateSet.kt") public void testDelegateWithPrivateSet() throws Exception { runTest("compiler/testData/codegen/box/delegatedProperty/delegateWithPrivateSet.kt"); From f6c73720895ccf675eec5f328a50b107c3df5a26 Mon Sep 17 00:00:00 2001 From: Sergey Shanshin Date: Wed, 25 Nov 2020 17:06:10 +0300 Subject: [PATCH 111/698] Fix serializing properties with custom accessors (#3907) Fixes Kotlin/kotlinx.serialization#956 --- .../serialization/compiler/resolve/SerializableProperties.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/resolve/SerializableProperties.kt b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/resolve/SerializableProperties.kt index 86e88e16a28..2382943ebf0 100644 --- a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/resolve/SerializableProperties.kt +++ b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/resolve/SerializableProperties.kt @@ -15,7 +15,6 @@ import org.jetbrains.kotlin.serialization.deserialization.descriptors.Deserializ import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedPropertyDescriptor import org.jetbrains.kotlin.serialization.deserialization.getName import org.jetbrains.kotlinx.serialization.compiler.diagnostic.SERIALIZABLE_PROPERTIES -import org.jetbrains.kotlinx.serialization.compiler.extensions.SerializationComponentRegistrar import org.jetbrains.kotlinx.serialization.compiler.extensions.SerializationDescriptorSerializerPlugin import org.jetbrains.kotlinx.serialization.compiler.extensions.SerializationPluginMetadataExtensions @@ -52,6 +51,9 @@ class SerializableProperties(private val serializableClass: ClassDescriptor, val prop, primaryConstructorProperties[prop] ?: false, prop.hasBackingField(bindingContext) || (prop is DeserializedPropertyDescriptor && prop.backingField != null) // workaround for TODO in .hasBackingField + // workaround for overridden getter (val) and getter+setter (var) - in this case hasBackingField returning false + // but initializer presents only for property with backing field + || prop.declaresDefaultValue ) } .filterNot { it.transient } From 498047e64e8a1e346ef21259d7548a4d1ccee6a4 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Wed, 25 Nov 2020 11:54:48 +0300 Subject: [PATCH 112/698] KT-43562 don't remap static inline class funs as special builtins --- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 +++ .../jvm/codegen/MethodSignatureMapper.kt | 10 ++++- .../box/unsignedTypes/unsignedArraySize.kt | 13 +++++++ .../specialBridges/unsignedArray.kt | 10 +++++ .../specialBridges/unsignedArray.txt | 38 +++++++++++++++++++ .../specialBridges/unsignedArray_ir.txt | 38 +++++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 5 +++ .../codegen/BytecodeListingTestGenerated.java | 5 +++ .../LightAnalysisModeTestGenerated.java | 5 +++ .../ir/IrBlackBoxCodegenTestGenerated.java | 5 +++ .../ir/IrBytecodeListingTestGenerated.java | 5 +++ .../IrJsCodegenBoxES6TestGenerated.java | 5 +++ .../IrJsCodegenBoxTestGenerated.java | 5 +++ .../semantics/JsCodegenBoxTestGenerated.java | 5 +++ 14 files changed, 152 insertions(+), 2 deletions(-) create mode 100644 compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt create mode 100644 compiler/testData/codegen/bytecodeListing/specialBridges/unsignedArray.kt create mode 100644 compiler/testData/codegen/bytecodeListing/specialBridges/unsignedArray.txt create mode 100644 compiler/testData/codegen/bytecodeListing/specialBridges/unsignedArray_ir.txt diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 500f8d943e2..ce36177dc77 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -32046,6 +32046,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/unsignedTypes/nullableUnsignedEqualsLiteral.kt"); } + @TestMetadata("unsignedArraySize.kt") + public void testUnsignedArraySize() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt"); + } + @TestMetadata("unsignedIntCompare.kt") public void testUnsignedIntCompare() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/unsignedIntCompare.kt"); diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt index 5ad6d6c6fd8..3a76c6f47ac 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt @@ -427,8 +427,14 @@ class MethodSignatureMapper(private val context: JvmBackendContext) { return current } - private fun getJvmMethodNameIfSpecial(irFunction: IrSimpleFunction): String? = - irFunction.getBuiltinSpecialPropertyGetterName() ?: irFunction.getDifferentNameForJvmBuiltinFunction() + private fun getJvmMethodNameIfSpecial(irFunction: IrSimpleFunction): String? { + if (irFunction.origin == JvmLoweredDeclarationOrigin.STATIC_INLINE_CLASS_REPLACEMENT) { + return null + } + + return irFunction.getBuiltinSpecialPropertyGetterName() + ?: irFunction.getDifferentNameForJvmBuiltinFunction() + } private val IrSimpleFunction.isBuiltIn: Boolean get() = getPackageFragment()?.fqName == StandardNames.BUILT_INS_PACKAGE_FQ_NAME || diff --git a/compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt b/compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt new file mode 100644 index 00000000000..195b143ce92 --- /dev/null +++ b/compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt @@ -0,0 +1,13 @@ +// DONT_TARGET_EXACT_BACKEND: WASM +// WASM_MUTE_REASON: STDLIB_COLLECTIONS +// KJS_WITH_FULL_RUNTIME +// WITH_RUNTIME +// IGNORE_BACKEND_FIR: JVM_IR + +fun test() = uintArrayOf(1u).size + +fun box(): String { + val test = test() + if (test != 1) return "Failed: $test" + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/specialBridges/unsignedArray.kt b/compiler/testData/codegen/bytecodeListing/specialBridges/unsignedArray.kt new file mode 100644 index 00000000000..ca6959fb370 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/specialBridges/unsignedArray.kt @@ -0,0 +1,10 @@ +// WITH_RUNTIME +// IGNORE_ANNOTATIONS + +inline class UIntArray(@PublishedApi internal val storage: IntArray) : Collection { + override val size: Int get() = TODO() + override operator fun iterator() = TODO() + override fun contains(element: UInt): Boolean = TODO() + override fun containsAll(elements: Collection): Boolean = TODO() + override fun isEmpty(): Boolean = TODO() +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/specialBridges/unsignedArray.txt b/compiler/testData/codegen/bytecodeListing/specialBridges/unsignedArray.txt new file mode 100644 index 00000000000..e2fb6af2510 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/specialBridges/unsignedArray.txt @@ -0,0 +1,38 @@ +public final class UIntArray { + // source: 'unsignedArray.kt' + private final field storage: int[] + private synthetic method (p0: int[]): void + public synthetic method add(p0: java.lang.Object): boolean + public method add-WZ4Q5Ns(p0: int): boolean + public method addAll(p0: java.util.Collection): boolean + public synthetic final static method box-impl(p0: int[]): UIntArray + public method clear(): void + public static method constructor-impl(p0: int[]): int[] + public bridge final method contains(p0: java.lang.Object): boolean + public method contains-WZ4Q5Ns(p0: int): boolean + public static method contains-WZ4Q5Ns(p0: int[], p1: int): boolean + public method containsAll(p0: java.util.Collection): boolean + public static method containsAll-impl(p0: int[], p1: java.util.Collection): boolean + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: int[], p1: java.lang.Object): boolean + public final static method equals-impl0(p0: int[], p1: int[]): boolean + public method getSize(): int + public static method getSize-impl(p0: int[]): int + public synthetic deprecated static method getStorage$annotations(): void + public method hashCode(): int + public static method hashCode-impl(p0: int[]): int + public method isEmpty(): boolean + public static method isEmpty-impl(p0: int[]): boolean + public method iterator(): java.lang.Void + public synthetic bridge method iterator(): java.util.Iterator + public static method iterator-impl(p0: int[]): java.lang.Void + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] + public method toString(): java.lang.String + public static method toString-impl(p0: int[]): java.lang.String + public synthetic final method unbox-impl(): int[] +} diff --git a/compiler/testData/codegen/bytecodeListing/specialBridges/unsignedArray_ir.txt b/compiler/testData/codegen/bytecodeListing/specialBridges/unsignedArray_ir.txt new file mode 100644 index 00000000000..a42fe476c10 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/specialBridges/unsignedArray_ir.txt @@ -0,0 +1,38 @@ +public final class UIntArray { + // source: 'unsignedArray.kt' + private final field storage: int[] + private synthetic method (p0: int[]): void + public synthetic bridge method add(p0: java.lang.Object): boolean + public method add-WZ4Q5Ns(p0: int): boolean + public method addAll(p0: java.util.Collection): boolean + public synthetic final static method box-impl(p0: int[]): UIntArray + public method clear(): void + public static method constructor-impl(p0: int[]): int[] + public synthetic bridge method contains(p0: java.lang.Object): boolean + public method contains-WZ4Q5Ns(p0: int): boolean + public static method contains-WZ4Q5Ns(p0: int[], p1: int): boolean + public method containsAll(p0: java.util.Collection): boolean + public static method containsAll-impl(p0: int[], p1: java.util.Collection): boolean + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: int[], p1: java.lang.Object): boolean + public final static method equals-impl0(p0: int[], p1: int[]): boolean + public method getSize(): int + public static method getSize-impl(p0: int[]): int + public synthetic deprecated static method getStorage$annotations(): void + public method hashCode(): int + public static method hashCode-impl(p0: int[]): int + public method isEmpty(): boolean + public static method isEmpty-impl(p0: int[]): boolean + public method iterator(): java.lang.Void + public synthetic bridge method iterator(): java.util.Iterator + public static method iterator-impl(p0: int[]): java.lang.Void + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public synthetic bridge method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] + public method toString(): java.lang.String + public static method toString-impl(p0: int[]): java.lang.String + public synthetic final method unbox-impl(): int[] +} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 0f2bb3db218..53ecbd37c55 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -33817,6 +33817,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/unsignedTypes/nullableUnsignedEqualsLiteral.kt"); } + @TestMetadata("unsignedArraySize.kt") + public void testUnsignedArraySize() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt"); + } + @TestMetadata("unsignedIntCompare.kt") public void testUnsignedIntCompare() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/unsignedIntCompare.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index 5b6cc7ce033..3819622fa50 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -1510,6 +1510,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/specialBridges/removeAtTwoSpecialBridges.kt"); } + @TestMetadata("unsignedArray.kt") + public void testUnsignedArray() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/specialBridges/unsignedArray.kt"); + } + @TestMetadata("compiler/testData/codegen/bytecodeListing/specialBridges/signatures") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 133cec36ca8..b0dd00e8126 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -31451,6 +31451,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/unsignedTypes/nullableUnsignedEqualsLiteral.kt"); } + @TestMetadata("unsignedArraySize.kt") + public void testUnsignedArraySize() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt"); + } + @TestMetadata("unsignedIntCompare.kt") public void testUnsignedIntCompare() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/unsignedIntCompare.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 44178290ef3..a34cf8c8247 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -32046,6 +32046,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/unsignedTypes/nullableUnsignedEqualsLiteral.kt"); } + @TestMetadata("unsignedArraySize.kt") + public void testUnsignedArraySize() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt"); + } + @TestMetadata("unsignedIntCompare.kt") public void testUnsignedIntCompare() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/unsignedIntCompare.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index 5cdf9872f30..cd94d0bd371 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -1480,6 +1480,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/specialBridges/removeAtTwoSpecialBridges.kt"); } + @TestMetadata("unsignedArray.kt") + public void testUnsignedArray() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/specialBridges/unsignedArray.kt"); + } + @TestMetadata("compiler/testData/codegen/bytecodeListing/specialBridges/signatures") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index 532559db1f0..fc028038110 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -26012,6 +26012,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/unsignedTypes/nullableUnsignedEqualsLiteral.kt"); } + @TestMetadata("unsignedArraySize.kt") + public void testUnsignedArraySize() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt"); + } + @TestMetadata("unsignedIntCompare.kt") public void testUnsignedIntCompare() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/unsignedIntCompare.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 05738d7f7ab..330d600d2da 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -26012,6 +26012,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/unsignedTypes/nullableUnsignedEqualsLiteral.kt"); } + @TestMetadata("unsignedArraySize.kt") + public void testUnsignedArraySize() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt"); + } + @TestMetadata("unsignedIntCompare.kt") public void testUnsignedIntCompare() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/unsignedIntCompare.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index aac27644c42..1b86ccfe43b 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -26027,6 +26027,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/unsignedTypes/nullableUnsignedEqualsLiteral.kt"); } + @TestMetadata("unsignedArraySize.kt") + public void testUnsignedArraySize() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt"); + } + @TestMetadata("unsignedIntCompare.kt") public void testUnsignedIntCompare() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/unsignedIntCompare.kt"); From f6abc5c3cf2372a585f24e1d2e28a18ca78ce4a4 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Wed, 25 Nov 2020 12:56:47 +0300 Subject: [PATCH 113/698] KT-43286 use JVM 1.8 intrinsics for coercible unsigned values only --- .../ir/FirBlackBoxCodegenTestGenerated.java | 10 +++++ .../JvmStandardLibraryBuiltInsLowering.kt | 44 +++++++++++-------- .../codegen/box/unsignedTypes/kt43286.kt | 26 +++++++++++ .../codegen/box/unsignedTypes/kt43286a.kt | 8 ++++ .../codegen/BlackBoxCodegenTestGenerated.java | 10 +++++ .../LightAnalysisModeTestGenerated.java | 10 +++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 10 +++++ .../IrJsCodegenBoxES6TestGenerated.java | 10 +++++ .../IrJsCodegenBoxTestGenerated.java | 10 +++++ .../semantics/JsCodegenBoxTestGenerated.java | 10 +++++ .../IrCodegenBoxWasmTestGenerated.java | 10 +++++ 11 files changed, 140 insertions(+), 18 deletions(-) create mode 100644 compiler/testData/codegen/box/unsignedTypes/kt43286.kt create mode 100644 compiler/testData/codegen/box/unsignedTypes/kt43286a.kt diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index ce36177dc77..378ef87901b 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -32036,6 +32036,16 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/unsignedTypes/kt25784.kt"); } + @TestMetadata("kt43286.kt") + public void testKt43286() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/kt43286.kt"); + } + + @TestMetadata("kt43286a.kt") + public void testKt43286a() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/kt43286a.kt"); + } + @TestMetadata("literalEqualsNullableUnsigned.kt") public void testLiteralEqualsNullableUnsigned() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/literalEqualsNullableUnsigned.kt"); diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmStandardLibraryBuiltInsLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmStandardLibraryBuiltInsLowering.kt index 5d3a399f81e..73a80287ddd 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmStandardLibraryBuiltInsLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmStandardLibraryBuiltInsLowering.kt @@ -35,8 +35,8 @@ class JvmStandardLibraryBuiltInsLowering(val context: JvmBackendContext) : FileL val parentClass = expression.symbol.owner.parent.fqNameForIrSerialization.asString() val functionName = expression.symbol.owner.name.asString() - Jvm8builtInReplacements[parentClass to functionName]?.let { - return expression.replaceWithCallTo(it) + jvm8builtInReplacements[parentClass to functionName]?.let { replacement -> + return expression.replaceWithCallTo(replacement) } return expression @@ -46,7 +46,7 @@ class JvmStandardLibraryBuiltInsLowering(val context: JvmBackendContext) : FileL irFile.transformChildren(transformer, null) } - private val Jvm8builtInReplacements = mapOf( + private val jvm8builtInReplacements = mapOf( ("kotlin.UInt" to "compareTo") to context.ir.symbols.compareUnsignedInt, ("kotlin.UInt" to "div") to context.ir.symbols.divideUnsignedInt, ("kotlin.UInt" to "rem") to context.ir.symbols.remainderUnsignedInt, @@ -59,7 +59,8 @@ class JvmStandardLibraryBuiltInsLowering(val context: JvmBackendContext) : FileL // Originals are so far only instance methods, and the replacements are // statics, so we copy dispatch receivers to a value argument if needed. - private fun IrCall.replaceWithCallTo(replacement: IrSimpleFunctionSymbol) = + // If we can't coerce arguments to required types, keep original expression (see below). + private fun IrCall.replaceWithCallTo(replacement: IrSimpleFunctionSymbol): IrCall = IrCallImpl.fromSymbolOwner( startOffset, endOffset, @@ -68,23 +69,30 @@ class JvmStandardLibraryBuiltInsLowering(val context: JvmBackendContext) : FileL ).also { newCall -> var valueArgumentOffset = 0 this.dispatchReceiver?.let { - newCall.putValueArgument(valueArgumentOffset, it.coerceTo(replacement.owner.valueParameters[valueArgumentOffset].type)) + val coercedDispatchReceiver = it.coerceIfPossible(replacement.owner.valueParameters[valueArgumentOffset].type) + ?: return this@replaceWithCallTo + newCall.putValueArgument(valueArgumentOffset, coercedDispatchReceiver) valueArgumentOffset++ } - (0 until valueArgumentsCount).forEach { - newCall.putValueArgument(it + valueArgumentOffset, getValueArgument(it)!!.coerceTo(replacement.owner.valueParameters[it].type)) + for (index in 0 until valueArgumentsCount) { + val coercedValueArgument = getValueArgument(index)!!.coerceIfPossible(replacement.owner.valueParameters[index].type) + ?: return this@replaceWithCallTo + newCall.putValueArgument(index + valueArgumentOffset, coercedValueArgument) } } - private fun IrExpression.coerceTo(target: IrType): IrExpression = - IrCallImpl.fromSymbolOwner( - startOffset, - endOffset, - target, - context.ir.symbols.unsafeCoerceIntrinsic - ).also { call -> - call.putTypeArgument(0, type) - call.putTypeArgument(1, target) - call.putValueArgument(0, this) - } + private fun IrExpression.coerceIfPossible(toType: IrType): IrExpression? { + // TODO maybe UnsafeCoerce could handle types with different, but coercible underlying representations. + // See KT-43286 and related tests for details. + val fromJvmType = context.typeMapper.mapType(type) + val toJvmType = context.typeMapper.mapType(toType) + return if (fromJvmType != toJvmType) + null + else + IrCallImpl.fromSymbolOwner(startOffset, endOffset, toType, context.ir.symbols.unsafeCoerceIntrinsic).also { call -> + call.putTypeArgument(0, type) + call.putTypeArgument(1, toType) + call.putValueArgument(0, this) + } + } } diff --git a/compiler/testData/codegen/box/unsignedTypes/kt43286.kt b/compiler/testData/codegen/box/unsignedTypes/kt43286.kt new file mode 100644 index 00000000000..ac571b4592a --- /dev/null +++ b/compiler/testData/codegen/box/unsignedTypes/kt43286.kt @@ -0,0 +1,26 @@ +// JVM_TARGET: 1.8 +// WITH_RUNTIME +// KJS_WITH_FULL_RUNTIME + +class D(val x: UInt?) + +class E(val x: Any) + +fun f(d: D): String { + return d.x?.let { d.x.toString() } ?: "" +} + +fun g(e: E): String { + if (e.x is UInt) return e.x.toString() + return "" +} + +fun box(): String { + val test1 = f(D(42u)) + if (test1 != "42") throw Exception(test1) + + val test2 = g(E(42u)) + if (test2 != "42") throw Exception(test2) + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/unsignedTypes/kt43286a.kt b/compiler/testData/codegen/box/unsignedTypes/kt43286a.kt new file mode 100644 index 00000000000..917ec50c25e --- /dev/null +++ b/compiler/testData/codegen/box/unsignedTypes/kt43286a.kt @@ -0,0 +1,8 @@ +// JVM_TARGET: 1.8 +// WITH_RUNTIME +// KJS_WITH_FULL_RUNTIME + +fun box(): String { + val x = 3UL % 2U + return if (x == 1UL) "OK" else "Fail: $x" +} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 53ecbd37c55..442ecc7ec94 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -33807,6 +33807,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/unsignedTypes/kt25784.kt"); } + @TestMetadata("kt43286.kt") + public void testKt43286() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/kt43286.kt"); + } + + @TestMetadata("kt43286a.kt") + public void testKt43286a() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/kt43286a.kt"); + } + @TestMetadata("literalEqualsNullableUnsigned.kt") public void testLiteralEqualsNullableUnsigned() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/literalEqualsNullableUnsigned.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index b0dd00e8126..beb97d7683d 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -31441,6 +31441,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/unsignedTypes/kt25784.kt"); } + @TestMetadata("kt43286.kt") + public void testKt43286() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/kt43286.kt"); + } + + @TestMetadata("kt43286a.kt") + public void testKt43286a() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/kt43286a.kt"); + } + @TestMetadata("literalEqualsNullableUnsigned.kt") public void testLiteralEqualsNullableUnsigned() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/literalEqualsNullableUnsigned.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index a34cf8c8247..ed92a8e0f66 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -32036,6 +32036,16 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/unsignedTypes/kt25784.kt"); } + @TestMetadata("kt43286.kt") + public void testKt43286() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/kt43286.kt"); + } + + @TestMetadata("kt43286a.kt") + public void testKt43286a() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/kt43286a.kt"); + } + @TestMetadata("literalEqualsNullableUnsigned.kt") public void testLiteralEqualsNullableUnsigned() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/literalEqualsNullableUnsigned.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index fc028038110..ea0a206b712 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -26002,6 +26002,16 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/unsignedTypes/kt25784.kt"); } + @TestMetadata("kt43286.kt") + public void testKt43286() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/kt43286.kt"); + } + + @TestMetadata("kt43286a.kt") + public void testKt43286a() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/kt43286a.kt"); + } + @TestMetadata("literalEqualsNullableUnsigned.kt") public void testLiteralEqualsNullableUnsigned() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/literalEqualsNullableUnsigned.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 330d600d2da..76205ae7973 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -26002,6 +26002,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/unsignedTypes/kt25784.kt"); } + @TestMetadata("kt43286.kt") + public void testKt43286() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/kt43286.kt"); + } + + @TestMetadata("kt43286a.kt") + public void testKt43286a() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/kt43286a.kt"); + } + @TestMetadata("literalEqualsNullableUnsigned.kt") public void testLiteralEqualsNullableUnsigned() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/literalEqualsNullableUnsigned.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 1b86ccfe43b..622042f2b57 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -26017,6 +26017,16 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/unsignedTypes/kt25784.kt"); } + @TestMetadata("kt43286.kt") + public void testKt43286() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/kt43286.kt"); + } + + @TestMetadata("kt43286a.kt") + public void testKt43286a() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/kt43286a.kt"); + } + @TestMetadata("literalEqualsNullableUnsigned.kt") public void testLiteralEqualsNullableUnsigned() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/literalEqualsNullableUnsigned.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index 7e513f3ed55..86efc618ee6 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -14305,6 +14305,16 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/unsignedTypes/iterateOverListOfBoxedUnsignedValues.kt"); } + @TestMetadata("kt43286.kt") + public void testKt43286() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/kt43286.kt"); + } + + @TestMetadata("kt43286a.kt") + public void testKt43286a() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/kt43286a.kt"); + } + @TestMetadata("literalEqualsNullableUnsigned.kt") public void testLiteralEqualsNullableUnsigned() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/literalEqualsNullableUnsigned.kt"); From e5dce9f994c3c9233b1148a51d4349d045086308 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Wed, 25 Nov 2020 13:39:15 +0300 Subject: [PATCH 114/698] KT-42933 inline class backing field can't be static --- .../codegen/ir/FirBlackBoxCodegenTestGenerated.java | 5 +++++ .../org/jetbrains/kotlin/ir/util/InlineClasses.kt | 10 +++++++--- .../box/inlineClasses/propertyDelegation/kt42933.kt | 12 ++++++++++++ .../kotlin/codegen/BlackBoxCodegenTestGenerated.java | 5 +++++ .../codegen/LightAnalysisModeTestGenerated.java | 5 +++++ .../codegen/ir/IrBlackBoxCodegenTestGenerated.java | 5 +++++ .../semantics/IrJsCodegenBoxES6TestGenerated.java | 5 +++++ .../ir/semantics/IrJsCodegenBoxTestGenerated.java | 5 +++++ .../js/test/semantics/JsCodegenBoxTestGenerated.java | 5 +++++ .../semantics/IrCodegenBoxWasmTestGenerated.java | 5 +++++ 10 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt42933.kt diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 378ef87901b..3336d040de2 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -15155,6 +15155,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT public void testKt27070() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt27070.kt"); } + + @TestMetadata("kt42933.kt") + public void testKt42933() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt42933.kt"); + } } @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter") diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/InlineClasses.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/InlineClasses.kt index 9452afa3261..ed569d322ac 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/InlineClasses.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/InlineClasses.kt @@ -69,11 +69,15 @@ fun getInlineClassUnderlyingType(irClass: IrClass): IrType { fun getInlineClassBackingField(irClass: IrClass): IrField { for (declaration in irClass.declarations) { - if (declaration is IrField) + if (declaration is IrField && !declaration.isStatic) return declaration - if (declaration is IrProperty) - return declaration.backingField ?: continue + if (declaration is IrProperty) { + val backingField = declaration.backingField + if (backingField != null && !backingField.isStatic) { + return backingField + } + } } error("Inline class has no field: ${irClass.fqNameWhenAvailable}") } diff --git a/compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt42933.kt b/compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt42933.kt new file mode 100644 index 00000000000..29c5328bd16 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt42933.kt @@ -0,0 +1,12 @@ +class Delegate { + operator fun getValue(t: Any?, p: Any): String = "OK" +} + +inline class Kla1(val default: Int) { + fun getValue(): String { + val prop by Delegate() + return prop + } +} + +fun box() = Kla1(1).getValue() \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 442ecc7ec94..0b527485966 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -16555,6 +16555,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { public void testKt27070() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt27070.kt"); } + + @TestMetadata("kt42933.kt") + public void testKt42933() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt42933.kt"); + } } @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index beb97d7683d..a3e551d817e 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -16555,6 +16555,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes public void testKt27070() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt27070.kt"); } + + @TestMetadata("kt42933.kt") + public void testKt42933() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt42933.kt"); + } } @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index ed92a8e0f66..01c6f247826 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -15155,6 +15155,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes public void testKt27070() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt27070.kt"); } + + @TestMetadata("kt42933.kt") + public void testKt42933() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt42933.kt"); + } } @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index ea0a206b712..29c99181d5e 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -13125,6 +13125,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes public void testKt27070() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt27070.kt"); } + + @TestMetadata("kt42933.kt") + public void testKt42933() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt42933.kt"); + } } @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 76205ae7973..3be1ff3e341 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -13125,6 +13125,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { public void testKt27070() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt27070.kt"); } + + @TestMetadata("kt42933.kt") + public void testKt42933() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt42933.kt"); + } } @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 622042f2b57..fef08948512 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -13190,6 +13190,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { public void testKt27070() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt27070.kt"); } + + @TestMetadata("kt42933.kt") + public void testKt42933() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt42933.kt"); + } } @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index 86efc618ee6..b1654e02dd5 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -7440,6 +7440,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest public void testAllFilesPresentInPropertyDelegation() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/propertyDelegation"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); } + + @TestMetadata("kt42933.kt") + public void testKt42933() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt42933.kt"); + } } @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter") From 7cc6204d6bfbaf657cd6ce3bdca1f9eaf9405b56 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Wed, 25 Nov 2020 15:17:04 +0300 Subject: [PATCH 115/698] Minor: update testData --- .../codegen/box/inlineClasses/propertyDelegation/kt42933.kt | 3 +++ compiler/testData/codegen/box/unsignedTypes/kt43286a.kt | 1 + .../testData/codegen/box/unsignedTypes/unsignedArraySize.kt | 1 - .../test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java | 5 ----- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt42933.kt b/compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt42933.kt index 29c5328bd16..1578a826805 100644 --- a/compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt42933.kt +++ b/compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt42933.kt @@ -1,3 +1,6 @@ +// DONT_TARGET_EXACT_BACKEND: WASM +// WASM_MUTE_REASON: PROPERTY_REFERENCES + class Delegate { operator fun getValue(t: Any?, p: Any): String = "OK" } diff --git a/compiler/testData/codegen/box/unsignedTypes/kt43286a.kt b/compiler/testData/codegen/box/unsignedTypes/kt43286a.kt index 917ec50c25e..b0677e0fb69 100644 --- a/compiler/testData/codegen/box/unsignedTypes/kt43286a.kt +++ b/compiler/testData/codegen/box/unsignedTypes/kt43286a.kt @@ -1,6 +1,7 @@ // JVM_TARGET: 1.8 // WITH_RUNTIME // KJS_WITH_FULL_RUNTIME +// IGNORE_BACKEND_FIR: JVM_IR fun box(): String { val x = 3UL % 2U diff --git a/compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt b/compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt index 195b143ce92..6ec82773bea 100644 --- a/compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt +++ b/compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt @@ -2,7 +2,6 @@ // WASM_MUTE_REASON: STDLIB_COLLECTIONS // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR fun test() = uintArrayOf(1u).size diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index b1654e02dd5..86efc618ee6 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -7440,11 +7440,6 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest public void testAllFilesPresentInPropertyDelegation() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/propertyDelegation"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); } - - @TestMetadata("kt42933.kt") - public void testKt42933() throws Exception { - runTest("compiler/testData/codegen/box/inlineClasses/propertyDelegation/kt42933.kt"); - } } @TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter") From c90546104e55145ef6de8018b529dc16faeb7a08 Mon Sep 17 00:00:00 2001 From: Kevin Bierhoff Date: Wed, 25 Nov 2020 07:21:14 -0800 Subject: [PATCH 116/698] Uast: partial fix for reified functions resolve (#3923, KT-41279) doesn't take into account compiled reified functions from jars --- .../internal/kotlinInternalUastUtils.kt | 4 ++-- .../uast-kotlin/testData/ReifiedResolve.kt | 17 ++++++++++++++ .../testData/ReifiedResolve.resolved.txt | 22 +++++++++++++++++++ .../tests/KotlinUastResolveEverythingTest.kt | 3 +++ 4 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 plugins/uast-kotlin/testData/ReifiedResolve.kt create mode 100644 plugins/uast-kotlin/testData/ReifiedResolve.resolved.txt diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/internal/kotlinInternalUastUtils.kt b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/internal/kotlinInternalUastUtils.kt index 632e3616da5..bdaa26c942a 100644 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/internal/kotlinInternalUastUtils.kt +++ b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/internal/kotlinInternalUastUtils.kt @@ -312,8 +312,8 @@ internal fun resolveToPsiMethod( is KtFunction -> if (source.isLocal) getContainingLightClass(source)?.let { UastFakeLightMethod(source, it) } - else - LightClassUtil.getLightClassMethod(source) + else // UltraLightMembersCreator.createMethods() returns nothing for JVM-invisible methods, so fake it if we get null here + LightClassUtil.getLightClassMethod(source) ?: getContainingLightClass(source)?.let { UastFakeLightMethod(source, it) } is PsiMethod -> source null -> resolveDeserialized(context, descriptor) as? PsiMethod else -> null diff --git a/plugins/uast-kotlin/testData/ReifiedResolve.kt b/plugins/uast-kotlin/testData/ReifiedResolve.kt new file mode 100644 index 00000000000..651d78826e0 --- /dev/null +++ b/plugins/uast-kotlin/testData/ReifiedResolve.kt @@ -0,0 +1,17 @@ +inline fun foo(init: T.() -> Unit = {}): T { + TODO("message") +} + +inline fun bar(init: T.() -> Unit = {}): T { + TODO("message") +} + +fun resolve() { + foo() + val x: String = foo() + + bar() + val y: String = bar() + + val z = listOf("foo").filterIsInstance() +} diff --git a/plugins/uast-kotlin/testData/ReifiedResolve.resolved.txt b/plugins/uast-kotlin/testData/ReifiedResolve.resolved.txt new file mode 100644 index 00000000000..8fdca272777 --- /dev/null +++ b/plugins/uast-kotlin/testData/ReifiedResolve.resolved.txt @@ -0,0 +1,22 @@ +UTypeReferenceExpression (name = java.lang.Object) -> USimpleNameReferenceExpression (identifier = Any) -> PsiClass:Object: Object +UTypeReferenceExpression (name = T) -> USimpleNameReferenceExpression (identifier = T) -> Light PSI class: T: T +UTypeReferenceExpression (name = void) -> USimpleNameReferenceExpression (identifier = Unit) -> PsiClass:Void: Void +UTypeReferenceExpression (name = T) -> USimpleNameReferenceExpression (identifier = T) -> Light PSI class: T: T + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))(resolves to PsiMethod:TODO) -> USimpleNameReferenceExpression (identifier = TODO) -> PsiMethod:TODO: TODO +UTypeReferenceExpression (name = java.lang.Object) -> USimpleNameReferenceExpression (identifier = Any) -> PsiClass:Object: Object +UTypeReferenceExpression (name = T) -> USimpleNameReferenceExpression (identifier = T) -> Light PSI class: T: T +UTypeReferenceExpression (name = void) -> USimpleNameReferenceExpression (identifier = Unit) -> PsiClass:Void: Void +UTypeReferenceExpression (name = T) -> USimpleNameReferenceExpression (identifier = T) -> Light PSI class: T: T + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))(resolves to PsiMethod:TODO) -> USimpleNameReferenceExpression (identifier = TODO) -> PsiMethod:TODO: TODO + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))(resolves to LightMethodBuilder:foo) -> USimpleNameReferenceExpression (identifier = foo) -> LightMethodBuilder:foo: foo + UTypeReferenceExpression (name = java.lang.String) -> USimpleNameReferenceExpression (identifier = String) -> PsiClass:String: String + UTypeReferenceExpression (name = java.lang.String) -> USimpleNameReferenceExpression (identifier = String) -> PsiClass:String: String + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))(resolves to LightMethodBuilder:foo) -> USimpleNameReferenceExpression (identifier = foo) -> LightMethodBuilder:foo: foo + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))(resolves to KtUltraLightMethodForSourceDeclaration:bar) -> USimpleNameReferenceExpression (identifier = bar) -> KtUltraLightMethodForSourceDeclaration:bar: bar + UTypeReferenceExpression (name = java.lang.String) -> USimpleNameReferenceExpression (identifier = String) -> PsiClass:String: String + UTypeReferenceExpression (name = java.lang.String) -> USimpleNameReferenceExpression (identifier = String) -> PsiClass:String: String + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))(resolves to KtUltraLightMethodForSourceDeclaration:bar) -> USimpleNameReferenceExpression (identifier = bar) -> KtUltraLightMethodForSourceDeclaration:bar: bar + ULocalVariable (name = z) -> UQualifiedReferenceExpression -> null: null + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))(resolves to PsiMethod:listOf) -> USimpleNameReferenceExpression (identifier = listOf) -> PsiMethod:listOf: listOf + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))(resolves to null) -> USimpleNameReferenceExpression (identifier = filterIsInstance) -> null: null + UTypeReferenceExpression (name = java.lang.String) -> USimpleNameReferenceExpression (identifier = String) -> PsiClass:String: String diff --git a/plugins/uast-kotlin/tests/KotlinUastResolveEverythingTest.kt b/plugins/uast-kotlin/tests/KotlinUastResolveEverythingTest.kt index 7346c1f11c7..ddfaa28ae28 100644 --- a/plugins/uast-kotlin/tests/KotlinUastResolveEverythingTest.kt +++ b/plugins/uast-kotlin/tests/KotlinUastResolveEverythingTest.kt @@ -30,6 +30,9 @@ class KotlinUastResolveEverythingTest : AbstractKotlinResolveEverythingTest() { @Test fun testImports() = doTest("Imports") + @Test + fun testReifiedResolve() = doTest("ReifiedResolve") + @Test fun testResolve() = doTest("Resolve") From 07a797cc3a7cf82acc4a29e18aea12d4348d9df7 Mon Sep 17 00:00:00 2001 From: Igor Chevdar Date: Thu, 29 Oct 2020 13:47:04 +0500 Subject: [PATCH 117/698] [IR] Fixed bug with type parameters of referenced constructor --- .../backend/common/lower/LocalDeclarationsLowering.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt index d9a850e635c..5ec8868dc3c 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt @@ -390,18 +390,22 @@ class LocalDeclarationsLowering( val newCallee = oldCallee.transformed ?: return expression val newReflectionTarget = expression.reflectionTarget?.run { owner.transformed } + val typeParameters = if (newCallee is IrConstructor) + newCallee.parentAsClass.typeParameters + else + newCallee.typeParameters return IrFunctionReferenceImpl( expression.startOffset, expression.endOffset, expression.type, // TODO functional type for transformed descriptor newCallee.symbol, - typeArgumentsCount = newCallee.typeParameters.size, + typeArgumentsCount = typeParameters.size, valueArgumentsCount = newCallee.valueParameters.size, reflectionTarget = newReflectionTarget?.symbol, origin = expression.origin ).also { it.fillArguments2(expression, newCallee) it.setLocalTypeArguments(oldCallee) - it.copyTypeArgumentsFrom(expression, shift = newCallee.typeParameters.size - expression.typeArgumentsCount) + it.copyTypeArgumentsFrom(expression, shift = typeParameters.size - expression.typeArgumentsCount) it.copyAttributes(expression) } } From 4bf63a953958fc1342312274cbdfe23d085347a3 Mon Sep 17 00:00:00 2001 From: Hung Nguyen Date: Thu, 12 Nov 2020 12:51:47 +0000 Subject: [PATCH 118/698] Sort class members to ensure deterministic builds Class methods and fields are currently sorted at serialization (see DescriptorSerializer.sort) and at deserialization (see DeserializedMemberScope.OptimizedImplementation#addMembers). Therefore, the contents of the generated stub files are sorted in incremental builds but not in clean builds. The consequence is that the contents of the generated stub files may not be consistent across a clean build and an incremental build, making the build non-deterministic and dependent tasks run unnecessarily (see KT-40882). To work around that, this commit sorts class methods and fields when outputting stub files. Bug: KT-40882 (there are actually 2 issues in here; this commit fixes the first one) Test: New DeterministicBuildIT + Updated existing test expectation files --- .../kotlin/gradle/DeterministicBuildIT.kt | 93 +++++ .../org/jetbrains/kotlin/gradle/Kapt3IT.kt | 4 +- .../stubs/ClassFileToSourceStubConverter.kt | 14 +- .../testData/converter/abstractEnum.txt | 22 +- .../testData/converter/abstractMethods.txt | 16 +- .../testData/converter/aliasedImports.txt | 84 ++-- .../testData/converter/annotations.txt | 38 +- .../testData/converter/annotations2.txt | 52 +-- .../converter/annotationsWithTargets.txt | 36 +- .../testData/converter/comments.txt | 82 ++-- .../testData/converter/dataClass.txt | 46 +-- .../testData/converter/defaultImpls.txt | 8 +- .../converter/defaultParameterValueOff.txt | 192 ++++----- .../converter/defaultParameterValueOn.txt | 192 ++++----- .../testData/converter/deprecated.txt | 24 +- .../testData/converter/enumInCompanion.txt | 8 +- .../testData/converter/enums.txt | 18 +- .../converter/errorLocationMapping.txt | 84 ++-- .../testData/converter/errorSuperclass.txt | 14 +- .../errorSuperclassCorrectErrorTypes.txt | 44 +- .../testData/converter/functions.txt | 8 +- .../testData/converter/genericParameters.txt | 20 +- .../converter/genericRawSignatures.txt | 8 +- .../testData/converter/genericSimple.txt | 8 +- .../testData/converter/ignoredMembers.txt | 6 +- .../converter/implicitReturnTypes.txt | 10 +- .../testData/converter/inheritanceSimple.txt | 16 +- .../testData/converter/inlineClasses.txt | 14 +- .../converter/interfaceImplementation.txt | 10 +- .../testData/converter/javadoc.txt | 8 +- .../testData/converter/jvmDefaultAll.txt | 4 +- .../converter/jvmDefaultAllCompatibility.txt | 4 +- .../testData/converter/jvmDefaultDisable.txt | 4 +- .../testData/converter/jvmDefaultEnable.txt | 4 +- .../testData/converter/jvmOverloads.txt | 64 +-- .../testData/converter/jvmStatic.txt | 26 +- .../converter/jvmStaticFieldInParent.txt | 12 +- .../testData/converter/kt14996.txt | 12 +- .../testData/converter/kt14998.txt | 48 +-- .../testData/converter/kt17567.txt | 10 +- .../testData/converter/kt18791.txt | 132 +++--- .../testData/converter/kt24272.txt | 20 +- .../testData/converter/kt25071.txt | 14 +- .../testData/converter/kt27126.txt | 46 +-- .../testData/converter/kt34569.txt | 8 +- .../testData/converter/lazyProperty.txt | 12 +- .../testData/converter/maxErrorCount.txt | 8 +- .../converter/methodParameterNames.txt | 16 +- .../methodPropertySignatureClash.txt | 8 +- .../testData/converter/modifiers.txt | 24 +- .../testData/converter/nestedClasses.txt | 10 +- .../testData/converter/nestedClasses2.txt | 14 +- .../converter/nestedClassesNonRootPackage.txt | 14 +- .../testData/converter/nonExistentClass.txt | 36 +- .../nonExistentClassTypesConversion.txt | 388 +++++++++--------- .../nonExistentClassWIthoutCorrection.txt | 96 ++--- .../testData/converter/primitiveTypes.txt | 78 ++-- .../converter/propertyAnnotations.txt | 12 +- .../testData/converter/recentlyNullable.txt | 10 +- .../converter/repeatableAnnotations.txt | 62 +-- .../converter/secondaryConstructor.txt | 10 +- .../testData/converter/strangeIdentifiers.txt | 18 +- .../testData/converter/stripMetadata.txt | 16 +- .../testData/converter/suspendErrorTypes.txt | 8 +- .../testData/converter/topLevel.txt | 54 +-- .../converter/unsafePropertyInitializers.txt | 132 +++--- .../DefaultParameterValues.it.txt | 10 +- .../kotlinRunner/NestedClasses.it.txt | 8 +- .../testData/kotlinRunner/Overloads.it.txt | 18 +- .../testData/kotlinRunner/Simple.it.txt | 8 +- 70 files changed, 1380 insertions(+), 1277 deletions(-) create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/DeterministicBuildIT.kt diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/DeterministicBuildIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/DeterministicBuildIT.kt new file mode 100644 index 00000000000..32e6eaf8eef --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/DeterministicBuildIT.kt @@ -0,0 +1,93 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.gradle + +import org.jetbrains.kotlin.gradle.util.allJavaFiles +import org.junit.Test +import java.io.File +import kotlin.test.assertEquals + +/** Tests that the outputs of a build are deterministic. */ +class DeterministicBuildIT : BaseGradleIT() { + + @Test + fun `test KaptGenerateStubsTask - KT-40882`() = with( + Project("simple", directoryPrefix = "kapt2") + ) { + setupWorkingDir() + projectDir + .resolve("src/main/java/Foo.kt") + .writeText( + """ + class Foo : Bar { + // The fields and methods are ordered such that any sorting by KGP will be detected. + val fooField1 = 1 + val fooField3 = 3 + val fooField2 = 2 + fun fooMethod1() {} + fun fooMethod3() {} + fun fooMethod2() {} + } + """.trimIndent() + ) + projectDir + .resolve("src/main/java/Bar.kt") + .writeText( + """ + interface Bar { + val barField1 = 1 + val barField3 = 3 + val barField2 = 2 + fun barMethod1() {} + fun barMethod3() {} + fun barMethod2() {} + } + """.trimIndent() + ) + + val buildAndSnapshotStubFiles: () -> Map = { + lateinit var stubFiles: Map + build(":kaptGenerateStubsKotlin") { + assertSuccessful() + assertTasksExecuted(":kaptGenerateStubsKotlin") + stubFiles = fileInWorkingDir("build/tmp/kapt3/stubs").allJavaFiles().map { + it to it.readText() + }.toMap() + } + stubFiles + } + + // Run the first build + val stubFilesAfterFirstBuild = buildAndSnapshotStubFiles() + + // Make a change + projectDir.resolve("src/main/java/Foo.kt").also { + it.writeText( + """ + class Foo : Bar { + val fooField1 = 1 + val fooField3 = 3 + val fooField2 = 2 + fun fooMethod1() { println("Method body changed!") } + fun fooMethod3() {} + fun fooMethod2() {} + } + """.trimIndent() + ) + } + + // Run the second build + val stubFilesAfterSecondBuild = buildAndSnapshotStubFiles() + + // Check that the build outputs are deterministic + assertEquals(stubFilesAfterFirstBuild.size, stubFilesAfterSecondBuild.size) + for (file in stubFilesAfterFirstBuild.keys) { + val fileContentsAfterFirstBuild = stubFilesAfterFirstBuild[file] + val fileContentsAfterSecondBuild = stubFilesAfterSecondBuild[file] + assertEquals(fileContentsAfterFirstBuild, fileContentsAfterSecondBuild) + } + } +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kapt3IT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kapt3IT.kt index 85c32f77ebd..666197a3a18 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kapt3IT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kapt3IT.kt @@ -398,9 +398,9 @@ open class Kapt3IT : Kapt3BaseIT() { val actual = getErrorMessages() // try as 0 starting lines first, then as 1 starting line try { - Assert.assertEquals(genJavaErrorString(8, 16), actual) + Assert.assertEquals(genJavaErrorString(8, 15), actual) } catch (e: AssertionError) { - Assert.assertEquals(genJavaErrorString(9, 17), actual) + Assert.assertEquals(genJavaErrorString(9, 16), actual) } } diff --git a/plugins/kapt3/kapt3-compiler/src/org/jetbrains/kotlin/kapt3/stubs/ClassFileToSourceStubConverter.kt b/plugins/kapt3/kapt3-compiler/src/org/jetbrains/kotlin/kapt3/stubs/ClassFileToSourceStubConverter.kt index b1e76f91cb5..39bad43bd21 100644 --- a/plugins/kapt3/kapt3-compiler/src/org/jetbrains/kotlin/kapt3/stubs/ClassFileToSourceStubConverter.kt +++ b/plugins/kapt3/kapt3-compiler/src/org/jetbrains/kotlin/kapt3/stubs/ClassFileToSourceStubConverter.kt @@ -387,11 +387,21 @@ class ClassFileToSourceStubConverter(val kaptContext: KaptContextForStubGenerati ) } - val fields = mapJList(clazz.fields) { + // Class methods and fields are currently sorted at serialization (see DescriptorSerializer.sort) and at deserialization (see + // DeserializedMemberScope.OptimizedImplementation#addMembers). Therefore, the contents of the generated stub files are sorted in + // incremental builds but not in clean builds. + // The consequence is that the contents of the generated stub files may not be consistent across a clean build and an incremental + // build, making the build non-deterministic and dependent tasks run unnecessarily (see KT-40882). + // To work around that, we always sort class methods and fields when outputting stub files. Once we remove the sorting at both + // serialization and deserialization (KT-20980), we can remove this workaround. + val sortedFields = clazz.fields.toList().sortedWith(compareBy({ it.name }, { it.desc })) + val sortedMethods = clazz.methods.toList().sortedWith(compareBy({ it.name }, { it.desc })) + + val fields = mapJList(sortedFields) { if (it.isEnumValue()) null else convertField(it, clazz, lineMappings, packageFqName) } - val methods = mapJList(clazz.methods) { + val methods = mapJList(sortedMethods) { if (isEnum) { if (it.name == "values" && it.desc == "()[L${clazz.name};") return@mapJList null if (it.name == "valueOf" && it.desc == "(Ljava/lang/String;)L${clazz.name};") return@mapJList null diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/abstractEnum.txt b/plugins/kapt3/kapt3-compiler/testData/converter/abstractEnum.txt index 5da6cc6ef88..ba16efee0a0 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/abstractEnum.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/abstractEnum.txt @@ -5,14 +5,14 @@ public enum E { /*public static final*/ X /* = new E() */, /*public static final*/ Y /* = new E() */; + E() { + } + public abstract void a(); public final void b() { } - E() { - } - @kotlin.Metadata() public static final class Obj { @org.jetbrains.annotations.NotNull() @@ -42,13 +42,13 @@ public enum E2 { /*public static final*/ X /* = new E2() */, /*public static final*/ Y /* = new E2() */; - public abstract void a(); - E2(int n) { } E2(java.lang.String s) { } + + public abstract void a(); } //////////////////// @@ -63,13 +63,13 @@ public enum E3 { @org.jetbrains.annotations.NotNull() private final java.lang.String a = null; + E3(java.lang.String a) { + } + @org.jetbrains.annotations.NotNull() public final java.lang.String getA() { return null; } - - E3(java.lang.String a) { - } } //////////////////// @@ -86,6 +86,9 @@ public enum E4 { private final long c = 0L; private final boolean d = false; + E4(java.lang.String a, int b, long c, boolean d) { + } + @org.jetbrains.annotations.NotNull() public final java.lang.String getA() { return null; @@ -102,7 +105,4 @@ public enum E4 { public final boolean getD() { return false; } - - E4(java.lang.String a, int b, long c, boolean d) { - } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/abstractMethods.txt b/plugins/kapt3/kapt3-compiler/testData/converter/abstractMethods.txt index d7a55aa13d2..1625b6d5ecd 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/abstractMethods.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/abstractMethods.txt @@ -3,15 +3,15 @@ import java.lang.System; @kotlin.Metadata() public abstract class Base { + public Base() { + super(); + } + protected abstract void doJob(@org.jetbrains.annotations.NotNull() java.lang.String job, int delay); protected abstract void doJobGeneric(@org.jetbrains.annotations.NotNull() T job, int delay); - - public Base() { - super(); - } } //////////////////// @@ -22,6 +22,10 @@ import java.lang.System; @kotlin.Metadata() public final class Impl extends Base { + public Impl() { + super(); + } + @java.lang.Override() protected void doJob(@org.jetbrains.annotations.NotNull() java.lang.String job, int delay) { @@ -31,8 +35,4 @@ public final class Impl extends Base { protected void doJobGeneric(@org.jetbrains.annotations.NotNull() T job, int delay) { } - - public Impl() { - super(); - } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/aliasedImports.txt b/plugins/kapt3/kapt3-compiler/testData/converter/aliasedImports.txt index 35770662333..ba7cb8add43 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/aliasedImports.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/aliasedImports.txt @@ -4,37 +4,14 @@ import a.b.ABC; @kotlin.Metadata() public final class Test { - public Test.MyDate date; - public java.util.concurrent.TimeUnit timeUnit; - public java.util.concurrent.TimeUnit microseconds; public a.b.ABC abc; public bcd bcd; + public Test.MyDate date; + public java.util.concurrent.TimeUnit microseconds; + public java.util.concurrent.TimeUnit timeUnit; - @org.jetbrains.annotations.NotNull() - public final Test.MyDate getDate() { - return null; - } - - public final void setDate(@org.jetbrains.annotations.NotNull() - Test.MyDate p0) { - } - - @org.jetbrains.annotations.NotNull() - public final java.util.concurrent.TimeUnit getTimeUnit() { - return null; - } - - public final void setTimeUnit(@org.jetbrains.annotations.NotNull() - java.util.concurrent.TimeUnit p0) { - } - - @org.jetbrains.annotations.NotNull() - public final java.util.concurrent.TimeUnit getMicroseconds() { - return null; - } - - public final void setMicroseconds(@org.jetbrains.annotations.NotNull() - java.util.concurrent.TimeUnit p0) { + public Test() { + super(); } @org.jetbrains.annotations.NotNull() @@ -42,27 +19,54 @@ public final class Test { return null; } - public final void setAbc(@org.jetbrains.annotations.NotNull() - a.b.ABC p0) { - } - @org.jetbrains.annotations.NotNull() public final bcd getBcd() { return null; } + @org.jetbrains.annotations.NotNull() + public final Test.MyDate getDate() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.util.concurrent.TimeUnit getMicroseconds() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.util.concurrent.TimeUnit getTimeUnit() { + return null; + } + + public final void setAbc(@org.jetbrains.annotations.NotNull() + a.b.ABC p0) { + } + public final void setBcd(@org.jetbrains.annotations.NotNull() bcd p0) { } - public Test() { - super(); + public final void setDate(@org.jetbrains.annotations.NotNull() + Test.MyDate p0) { + } + + public final void setMicroseconds(@org.jetbrains.annotations.NotNull() + java.util.concurrent.TimeUnit p0) { + } + + public final void setTimeUnit(@org.jetbrains.annotations.NotNull() + java.util.concurrent.TimeUnit p0) { } @kotlin.Metadata() public static final class MyDate { public Test.MyDate date2; + public MyDate() { + super(); + } + @org.jetbrains.annotations.NotNull() public final Test.MyDate getDate2() { return null; @@ -71,10 +75,6 @@ public final class Test { public final void setDate2(@org.jetbrains.annotations.NotNull() Test.MyDate p0) { } - - public MyDate() { - super(); - } } } @@ -89,6 +89,10 @@ import a.b.ABC; public final class Test2 { public java.util.Date date; + public Test2() { + super(); + } + @org.jetbrains.annotations.NotNull() public final java.util.Date getDate() { return null; @@ -97,8 +101,4 @@ public final class Test2 { public final void setDate(@org.jetbrains.annotations.NotNull() java.util.Date p0) { } - - public Test2() { - super(); - } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/annotations.txt b/plugins/kapt3/kapt3-compiler/testData/converter/annotations.txt index ddbaa8f4059..6e63ebd5eb6 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/annotations.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/annotations.txt @@ -14,23 +14,23 @@ import java.lang.System; @java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME) public abstract @interface Anno2 { - public abstract int i() default 5; - - public abstract java.lang.String s() default "ABC"; - - public abstract int[] ii() default {1, 2, 3}; - - public abstract java.lang.String[] ss() default {"A", "B"}; - public abstract Anno1 a(); + public abstract java.lang.Class[] classes(); + + public abstract java.lang.Class clazz(); + public abstract Colors color() default Colors.BLACK; public abstract Colors[] colors() default {Colors.BLACK, Colors.WHITE}; - public abstract java.lang.Class clazz(); + public abstract int i() default 5; - public abstract java.lang.Class[] classes(); + public abstract int[] ii() default {1, 2, 3}; + + public abstract java.lang.String s() default "ABC"; + + public abstract java.lang.String[] ss() default {"A", "B"}; } //////////////////// @@ -103,30 +103,30 @@ public final class TestAnno2 { @Anno3(value = "field") private java.lang.String b = "property initializer"; + public TestAnno2() { + super(); + } + @Anno1() public final void a(@org.jetbrains.annotations.NotNull() @Anno3(value = "param-pam-pam") java.lang.String param) { } - @Anno3(value = "property") - @java.lang.Deprecated() - public static void getB$annotations() { - } - @org.jetbrains.annotations.NotNull() @Anno3(value = "getter") public final java.lang.String getB() { return null; } + @Anno3(value = "property") + @java.lang.Deprecated() + public static void getB$annotations() { + } + @Anno3(value = "setter") public final void setB(@org.jetbrains.annotations.NotNull() @Anno3(value = "setparam") java.lang.String p0) { } - - public TestAnno2() { - super(); - } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/annotations2.txt b/plugins/kapt3/kapt3-compiler/testData/converter/annotations2.txt index 1ecb47c7377..389dc7f00bb 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/annotations2.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/annotations2.txt @@ -23,10 +23,10 @@ public final class AnnotationsTest { super(); } - @Anno(value = "top-level-fun") - public static final void topLevelFun(@org.jetbrains.annotations.NotNull() - @Anno(value = "top-level-fun-receiver") - java.lang.String $this$topLevelFun) { + @org.jetbrains.annotations.NotNull() + public static final java.lang.String getTopLevelVal(@Anno(value = "top-level-val-receiver") + int $this$topLevelVal) { + return null; } @Anno(value = "top-level-val") @@ -34,10 +34,10 @@ public final class AnnotationsTest { public static void getTopLevelVal$annotations(int p0) { } - @org.jetbrains.annotations.NotNull() - public static final java.lang.String getTopLevelVal(@Anno(value = "top-level-val-receiver") - int $this$topLevelVal) { - return null; + @Anno(value = "top-level-fun") + public static final void topLevelFun(@org.jetbrains.annotations.NotNull() + @Anno(value = "top-level-fun-receiver") + java.lang.String $this$topLevelFun) { } } @@ -56,14 +56,14 @@ public enum Enum { /*public static final*/ BLACK /* = new Enum() */; private final int x = 0; - public final int getX() { - return 0; - } - @Anno(value = "enum-constructor") Enum(@Anno(value = "x") int x) { } + + public final int getX() { + return 0; + } } //////////////////// @@ -78,21 +78,23 @@ public abstract class Test { @org.jetbrains.annotations.NotNull() private java.lang.String v; + @Anno(value = "test-constructor") + protected Test(@org.jetbrains.annotations.NotNull() + @Anno(value = "v-param") + java.lang.String v) { + super(); + } + @org.jetbrains.annotations.NotNull() @Anno(value = "abstract-method") public abstract java.lang.String abstractMethod(); - @Anno(value = "abstract-val") - @java.lang.Deprecated() - public static void getAbstractVal$annotations() { - } - @org.jetbrains.annotations.NotNull() public abstract java.lang.String getAbstractVal(); - @Anno(value = "v-property") + @Anno(value = "abstract-val") @java.lang.Deprecated() - public static void getV$annotations() { + public static void getAbstractVal$annotations() { } @org.jetbrains.annotations.NotNull() @@ -101,16 +103,14 @@ public abstract class Test { return null; } + @Anno(value = "v-property") + @java.lang.Deprecated() + public static void getV$annotations() { + } + @Anno(value = "v-set") public final void setV(@org.jetbrains.annotations.NotNull() @Anno(value = "v-setparam") java.lang.String p0) { } - - @Anno(value = "test-constructor") - protected Test(@org.jetbrains.annotations.NotNull() - @Anno(value = "v-param") - java.lang.String v) { - super(); - } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/annotationsWithTargets.txt b/plugins/kapt3/kapt3-compiler/testData/converter/annotationsWithTargets.txt index 71efe5e7a30..741bdac2ba0 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/annotationsWithTargets.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/annotationsWithTargets.txt @@ -16,10 +16,8 @@ public final class Bar { @FieldAnno() private final java.lang.String a = ""; - @Anno() - @PropertyAnno() - @java.lang.Deprecated() - public static void getA$annotations() { + public Bar() { + super(); } @org.jetbrains.annotations.NotNull() @@ -27,8 +25,10 @@ public final class Bar { return null; } - public Bar() { - super(); + @Anno() + @PropertyAnno() + @java.lang.Deprecated() + public static void getA$annotations() { } } @@ -43,14 +43,14 @@ public final class Baz { @FieldAnno() public final java.lang.String a = ""; + public Baz() { + super(); + } + @Anno() @java.lang.Deprecated() public static void getA$annotations() { } - - public Baz() { - super(); - } } //////////////////// @@ -76,9 +76,11 @@ public final class Foo { @FieldAnno() private final java.lang.String a = null; - @PropertyAnno() - @java.lang.Deprecated() - public static void getA$annotations() { + public Foo(@org.jetbrains.annotations.NotNull() + @Anno() + @ParameterAnno() + java.lang.String a) { + super(); } @org.jetbrains.annotations.NotNull() @@ -86,11 +88,9 @@ public final class Foo { return null; } - public Foo(@org.jetbrains.annotations.NotNull() - @Anno() - @ParameterAnno() - java.lang.String a) { - super(); + @PropertyAnno() + @java.lang.Deprecated() + public static void getA$annotations() { } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/comments.txt b/plugins/kapt3/kapt3-compiler/testData/converter/comments.txt index 27375cccb3c..69e35a0fdce 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/comments.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/comments.txt @@ -17,11 +17,11 @@ public enum EnumError { /*public static final*/ One /* = new EnumError() */, /*public static final*/ Two /* = new EnumError() */; - @org.jetbrains.annotations.NotNull() - public abstract java.lang.String doIt(); - EnumError() { } + + @org.jetbrains.annotations.NotNull() + public abstract java.lang.String doIt(); } //////////////////// @@ -65,6 +65,31 @@ public final class Test { @org.jetbrains.annotations.NotNull() private final java.lang.String prop2 = ""; + public Test() { + super(); + } + + @org.jetbrains.annotations.NotNull() + public final java.lang.String getProp2() { + return null; + } + + /** + * prop2. + */ + @Anno() + @java.lang.Deprecated() + public static void getProp2$annotations() { + } + + /** + * get. + */ + @org.jetbrains.annotations.NotNull() + public final java.lang.String getProp3() { + return null; + } + /** * method(). */ @@ -84,37 +109,12 @@ public final class Test { java.lang.String a) { } - /** - * prop2. - */ - @Anno() - @java.lang.Deprecated() - public static void getProp2$annotations() { - } - - @org.jetbrains.annotations.NotNull() - public final java.lang.String getProp2() { - return null; - } - - /** - * get. - */ - @org.jetbrains.annotations.NotNull() - public final java.lang.String getProp3() { - return null; - } - /** * set. */ public final void setProp3(@org.jetbrains.annotations.NotNull() java.lang.String v) { } - - public Test() { - super(); - } } //////////////////// @@ -132,15 +132,15 @@ public final class Test2 { @org.jetbrains.annotations.NotNull() private final java.lang.String a = null; - @org.jetbrains.annotations.NotNull() - public final java.lang.String getA() { - return null; - } - public Test2(@org.jetbrains.annotations.NotNull() java.lang.String a) { super(); } + + @org.jetbrains.annotations.NotNull() + public final java.lang.String getA() { + return null; + } } //////////////////// @@ -156,15 +156,15 @@ public final class Test3 { @org.jetbrains.annotations.NotNull() private final java.lang.String a = null; - @org.jetbrains.annotations.NotNull() - public final java.lang.String getA() { - return null; - } - protected Test3(@org.jetbrains.annotations.NotNull() java.lang.String a) { super(); } + + @org.jetbrains.annotations.NotNull() + public final java.lang.String getA() { + return null; + } } //////////////////// @@ -175,12 +175,12 @@ import java.lang.System; @kotlin.Metadata() public final class Test4 { - public final void method() { - } - public Test4() { super(); } + + public final void method() { + } } //////////////////// diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/dataClass.txt b/plugins/kapt3/kapt3-compiler/testData/converter/dataClass.txt index 7342fc46d0d..143928c7196 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/dataClass.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/dataClass.txt @@ -2,28 +2,11 @@ import java.lang.System; @kotlin.Metadata() public final class User { + private final int age = 0; @org.jetbrains.annotations.NotNull() private final java.lang.String firstName = null; @org.jetbrains.annotations.NotNull() private final java.lang.String secondName = null; - private final int age = 0; - - public final void procedure() { - } - - @org.jetbrains.annotations.NotNull() - public final java.lang.String getFirstName() { - return null; - } - - @org.jetbrains.annotations.NotNull() - public final java.lang.String getSecondName() { - return null; - } - - public final int getAge() { - return 0; - } public User(@org.jetbrains.annotations.NotNull() java.lang.String firstName, @org.jetbrains.annotations.NotNull() @@ -52,9 +35,23 @@ public final class User { return null; } - @org.jetbrains.annotations.NotNull() @java.lang.Override() - public java.lang.String toString() { + public boolean equals(@org.jetbrains.annotations.Nullable() + java.lang.Object p0) { + return false; + } + + public final int getAge() { + return 0; + } + + @org.jetbrains.annotations.NotNull() + public final java.lang.String getFirstName() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.lang.String getSecondName() { return null; } @@ -63,9 +60,12 @@ public final class User { return 0; } + public final void procedure() { + } + + @org.jetbrains.annotations.NotNull() @java.lang.Override() - public boolean equals(@org.jetbrains.annotations.Nullable() - java.lang.Object p0) { - return false; + public java.lang.String toString() { + return null; } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/defaultImpls.txt b/plugins/kapt3/kapt3-compiler/testData/converter/defaultImpls.txt index 293604959eb..bb9b88f9eee 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/defaultImpls.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/defaultImpls.txt @@ -26,13 +26,13 @@ public abstract interface Intf { private static final int BLACK = 1; public static final int WHITE = 2; - public final int getBLACK() { - return 0; - } - private Companion() { super(); } + + public final int getBLACK() { + return 0; + } } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/defaultParameterValueOff.txt b/plugins/kapt3/kapt3-compiler/testData/converter/defaultParameterValueOff.txt index a20dea0e171..9dcf29f3c42 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/defaultParameterValueOff.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/defaultParameterValueOff.txt @@ -16,116 +16,36 @@ import java.lang.System; @kotlin.Metadata() public final class Foo { - private final boolean z = false; private final byte b = 0; private final char c = '\u0000'; private final char c2 = '\u0000'; - private final short sh = 0; - private final int i = 0; - private final long l = 0L; - private final float f = 0.0F; - private final double d = 0.0; - @org.jetbrains.annotations.NotNull() - private final java.lang.String s = null; - @org.jetbrains.annotations.NotNull() - private final int[] iarr = null; - @org.jetbrains.annotations.NotNull() - private final long[] larr = null; - @org.jetbrains.annotations.NotNull() - private final double[] darr = null; - @org.jetbrains.annotations.NotNull() - private final java.lang.String[] sarr = null; @org.jetbrains.annotations.NotNull() private final java.lang.Class cl = null; @org.jetbrains.annotations.NotNull() private final java.lang.Class[] clarr = null; + private final double d = 0.0; + @org.jetbrains.annotations.NotNull() + private final double[] darr = null; @org.jetbrains.annotations.NotNull() private final Em em = null; @org.jetbrains.annotations.NotNull() private final Em[] emarr = null; - - public final void foo(int a) { - } - - public final boolean getZ() { - return false; - } - - public final byte getB() { - return 0; - } - - public final char getC() { - return '\u0000'; - } - - public final char getC2() { - return '\u0000'; - } - - public final short getSh() { - return 0; - } - - public final int getI() { - return 0; - } - - public final long getL() { - return 0L; - } - - public final float getF() { - return 0.0F; - } - - public final double getD() { - return 0.0; - } - + private final float f = 0.0F; + private final int i = 0; @org.jetbrains.annotations.NotNull() - public final java.lang.String getS() { - return null; - } - + private final int[] iarr = null; + private final long l = 0L; @org.jetbrains.annotations.NotNull() - public final int[] getIarr() { - return null; - } - + private final long[] larr = null; @org.jetbrains.annotations.NotNull() - public final long[] getLarr() { - return null; - } - + private final java.lang.String s = null; @org.jetbrains.annotations.NotNull() - public final double[] getDarr() { - return null; - } + private final java.lang.String[] sarr = null; + private final short sh = 0; + private final boolean z = false; - @org.jetbrains.annotations.NotNull() - public final java.lang.String[] getSarr() { - return null; - } - - @org.jetbrains.annotations.NotNull() - public final java.lang.Class getCl() { - return null; - } - - @org.jetbrains.annotations.NotNull() - public final java.lang.Class[] getClarr() { - return null; - } - - @org.jetbrains.annotations.NotNull() - public final Em getEm() { - return null; - } - - @org.jetbrains.annotations.NotNull() - public final Em[] getEmarr() { - return null; + public Foo() { + super(); } public Foo(boolean z, byte b, char c, char c2, short sh, int i, long l, float f, double d, @org.jetbrains.annotations.NotNull() @@ -141,7 +61,87 @@ public final class Foo { super(); } - public Foo() { - super(); + public final void foo(int a) { + } + + public final byte getB() { + return 0; + } + + public final char getC() { + return '\u0000'; + } + + public final char getC2() { + return '\u0000'; + } + + @org.jetbrains.annotations.NotNull() + public final java.lang.Class getCl() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.lang.Class[] getClarr() { + return null; + } + + public final double getD() { + return 0.0; + } + + @org.jetbrains.annotations.NotNull() + public final double[] getDarr() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final Em getEm() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final Em[] getEmarr() { + return null; + } + + public final float getF() { + return 0.0F; + } + + public final int getI() { + return 0; + } + + @org.jetbrains.annotations.NotNull() + public final int[] getIarr() { + return null; + } + + public final long getL() { + return 0L; + } + + @org.jetbrains.annotations.NotNull() + public final long[] getLarr() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.lang.String getS() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.lang.String[] getSarr() { + return null; + } + + public final short getSh() { + return 0; + } + + public final boolean getZ() { + return false; } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/defaultParameterValueOn.txt b/plugins/kapt3/kapt3-compiler/testData/converter/defaultParameterValueOn.txt index a9a400e9d5f..78f807176f4 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/defaultParameterValueOn.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/defaultParameterValueOn.txt @@ -16,116 +16,36 @@ import java.lang.System; @kotlin.Metadata() public final class Foo { - private final boolean z = true; private final byte b = (byte)0; private final char c = 'c'; private final char c2 = '\n'; - private final short sh = (short)10; - private final int i = 10; - private final long l = -10L; - private final float f = 1.0F; - private final double d = -1.0; - @org.jetbrains.annotations.NotNull() - private final java.lang.String s = "foo"; - @org.jetbrains.annotations.NotNull() - private final int[] iarr = {1, 2, 3}; - @org.jetbrains.annotations.NotNull() - private final long[] larr = {-1L, 0L, 1L}; - @org.jetbrains.annotations.NotNull() - private final double[] darr = {7.3}; - @org.jetbrains.annotations.NotNull() - private final java.lang.String[] sarr = {"a", "bc"}; @org.jetbrains.annotations.NotNull() private final java.lang.Class cl = null; @org.jetbrains.annotations.NotNull() private final java.lang.Class[] clarr = null; + private final double d = -1.0; + @org.jetbrains.annotations.NotNull() + private final double[] darr = {7.3}; @org.jetbrains.annotations.NotNull() private final Em em = Em.BAR; @org.jetbrains.annotations.NotNull() private final Em[] emarr = {Em.FOO, Em.BAR}; - - public final void foo(int a) { - } - - public final boolean getZ() { - return false; - } - - public final byte getB() { - return 0; - } - - public final char getC() { - return '\u0000'; - } - - public final char getC2() { - return '\u0000'; - } - - public final short getSh() { - return 0; - } - - public final int getI() { - return 0; - } - - public final long getL() { - return 0L; - } - - public final float getF() { - return 0.0F; - } - - public final double getD() { - return 0.0; - } - + private final float f = 1.0F; + private final int i = 10; @org.jetbrains.annotations.NotNull() - public final java.lang.String getS() { - return null; - } - + private final int[] iarr = {1, 2, 3}; + private final long l = -10L; @org.jetbrains.annotations.NotNull() - public final int[] getIarr() { - return null; - } - + private final long[] larr = {-1L, 0L, 1L}; @org.jetbrains.annotations.NotNull() - public final long[] getLarr() { - return null; - } - + private final java.lang.String s = "foo"; @org.jetbrains.annotations.NotNull() - public final double[] getDarr() { - return null; - } + private final java.lang.String[] sarr = {"a", "bc"}; + private final short sh = (short)10; + private final boolean z = true; - @org.jetbrains.annotations.NotNull() - public final java.lang.String[] getSarr() { - return null; - } - - @org.jetbrains.annotations.NotNull() - public final java.lang.Class getCl() { - return null; - } - - @org.jetbrains.annotations.NotNull() - public final java.lang.Class[] getClarr() { - return null; - } - - @org.jetbrains.annotations.NotNull() - public final Em getEm() { - return null; - } - - @org.jetbrains.annotations.NotNull() - public final Em[] getEmarr() { - return null; + public Foo() { + super(); } public Foo(boolean z, byte b, char c, char c2, short sh, int i, long l, float f, double d, @org.jetbrains.annotations.NotNull() @@ -141,7 +61,87 @@ public final class Foo { super(); } - public Foo() { - super(); + public final void foo(int a) { + } + + public final byte getB() { + return 0; + } + + public final char getC() { + return '\u0000'; + } + + public final char getC2() { + return '\u0000'; + } + + @org.jetbrains.annotations.NotNull() + public final java.lang.Class getCl() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.lang.Class[] getClarr() { + return null; + } + + public final double getD() { + return 0.0; + } + + @org.jetbrains.annotations.NotNull() + public final double[] getDarr() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final Em getEm() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final Em[] getEmarr() { + return null; + } + + public final float getF() { + return 0.0F; + } + + public final int getI() { + return 0; + } + + @org.jetbrains.annotations.NotNull() + public final int[] getIarr() { + return null; + } + + public final long getL() { + return 0L; + } + + @org.jetbrains.annotations.NotNull() + public final long[] getLarr() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.lang.String getS() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.lang.String[] getSarr() { + return null; + } + + public final short getSh() { + return 0; + } + + public final boolean getZ() { + return false; } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/deprecated.txt b/plugins/kapt3/kapt3-compiler/testData/converter/deprecated.txt index 5c990f5e91b..9be873c384c 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/deprecated.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/deprecated.txt @@ -21,29 +21,29 @@ public final class Foo { @java.lang.Deprecated() private final int prop = 0; + public Foo() { + super(); + } + @java.lang.Deprecated() public final void foo(int a) { } - @java.lang.Deprecated() - public static void getProp$annotations() { - } - - @java.lang.Deprecated() - public final int getProp() { - return 0; - } - @java.lang.Deprecated() public final int getFoo() { return 0; } @java.lang.Deprecated() - public final void setFoo(int value) { + public final int getProp() { + return 0; } - public Foo() { - super(); + @java.lang.Deprecated() + public static void getProp$annotations() { + } + + @java.lang.Deprecated() + public final void setFoo(int value) { } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/enumInCompanion.txt b/plugins/kapt3/kapt3-compiler/testData/converter/enumInCompanion.txt index 445dabca9b1..2e9cc543a88 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/enumInCompanion.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/enumInCompanion.txt @@ -2,9 +2,9 @@ import java.lang.System; @kotlin.Metadata() public final class Test { - private final Test.Companion.Example foo; @org.jetbrains.annotations.NotNull() public static final Test.Companion Companion = null; + private final Test.Companion.Example foo; public Test() { super(); @@ -34,9 +34,9 @@ import java.lang.System; @kotlin.Metadata() public final class Test2 { - private final Test2.Amigo.Example foo; @org.jetbrains.annotations.NotNull() public static final Test2.Amigo Amigo = null; + private final Test2.Amigo.Example foo; public Test2() { super(); @@ -98,9 +98,9 @@ import java.lang.System; @kotlin.Metadata() public final class Test4 { - private final int foo = 1; @org.jetbrains.annotations.NotNull() public static final Test4.Companion Companion = null; + private final int foo = 1; public Test4() { super(); @@ -115,9 +115,9 @@ public final class Test4 { @kotlin.Metadata() public static final class Foo { - public static final int constProperty = 1; @org.jetbrains.annotations.NotNull() public static final Test4.Companion.Foo INSTANCE = null; + public static final int constProperty = 1; private Foo() { super(); diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/enums.txt b/plugins/kapt3/kapt3-compiler/testData/converter/enums.txt index 90bb77c418d..d5464a0f098 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/enums.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/enums.txt @@ -34,17 +34,16 @@ public enum Enum2 { private final java.lang.String col = null; private final int col2 = 0; + Enum2(@Anno1(value = "first") + java.lang.String col, @Anno1(value = "second") + int col2) { + } + @org.jetbrains.annotations.NotNull() public final java.lang.String color() { return null; } - private final void privateEnumFun() { - } - - public final void publicEnumFun() { - } - @org.jetbrains.annotations.NotNull() public final java.lang.String getCol() { return null; @@ -54,9 +53,10 @@ public enum Enum2 { return 0; } - Enum2(@Anno1(value = "first") - java.lang.String col, @Anno1(value = "second") - int col2) { + private final void privateEnumFun() { + } + + public final void publicEnumFun() { } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/errorLocationMapping.txt b/plugins/kapt3/kapt3-compiler/testData/converter/errorLocationMapping.txt index d2059974e1b..7964af87856 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/errorLocationMapping.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/errorLocationMapping.txt @@ -35,6 +35,13 @@ public final class ErrorInConstructorParameter { @org.jetbrains.annotations.NotNull() private final java.util.List c = null; + public ErrorInConstructorParameter(@org.jetbrains.annotations.NotNull() + java.lang.String a, @org.jetbrains.annotations.NotNull() + ABC b, @org.jetbrains.annotations.NotNull() + java.util.List c) { + super(); + } + @org.jetbrains.annotations.NotNull() public final java.lang.String getA() { return null; @@ -49,13 +56,6 @@ public final class ErrorInConstructorParameter { public final java.util.List getC() { return null; } - - public ErrorInConstructorParameter(@org.jetbrains.annotations.NotNull() - java.lang.String a, @org.jetbrains.annotations.NotNull() - ABC b, @org.jetbrains.annotations.NotNull() - java.util.List c) { - super(); - } } //////////////////// @@ -69,39 +69,8 @@ public final class ErrorInDeclarations { public ABC p2; public BCD p3; - @org.jetbrains.annotations.NotNull() - public final java.lang.String getP1() { - return null; - } - - public final void setP1(@org.jetbrains.annotations.NotNull() - java.lang.String p0) { - } - - @org.jetbrains.annotations.NotNull() - public final ABC getP2() { - return null; - } - - public final void setP2(@org.jetbrains.annotations.NotNull() - ABC p0) { - } - - @org.jetbrains.annotations.NotNull() - public final BCD getP3() { - return null; - } - - public final void setP3(@org.jetbrains.annotations.NotNull() - BCD p0) { - } - - public final void overloads(@org.jetbrains.annotations.NotNull() - java.lang.String a) { - } - - public final void overloads(@org.jetbrains.annotations.NotNull() - ABC a) { + public ErrorInDeclarations() { + super(); } public final void f1(@org.jetbrains.annotations.NotNull() @@ -120,8 +89,39 @@ public final class ErrorInDeclarations { return null; } - public ErrorInDeclarations() { - super(); + @org.jetbrains.annotations.NotNull() + public final java.lang.String getP1() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final ABC getP2() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final BCD getP3() { + return null; + } + + public final void overloads(@org.jetbrains.annotations.NotNull() + ABC a) { + } + + public final void overloads(@org.jetbrains.annotations.NotNull() + java.lang.String a) { + } + + public final void setP1(@org.jetbrains.annotations.NotNull() + java.lang.String p0) { + } + + public final void setP2(@org.jetbrains.annotations.NotNull() + ABC p0) { + } + + public final void setP3(@org.jetbrains.annotations.NotNull() + BCD p0) { } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/errorSuperclass.txt b/plugins/kapt3/kapt3-compiler/testData/converter/errorSuperclass.txt index 0fdad8ea0d2..91968329e1b 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/errorSuperclass.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/errorSuperclass.txt @@ -22,17 +22,17 @@ public final class ClassWithParent implements java.lang.CharSequence { super(); } - @java.lang.Override() - public final int length() { - return 0; - } - - public abstract int getLength(); - @java.lang.Override() public final char charAt(int p0) { return '\u0000'; } public abstract char get(int p0); + + public abstract int getLength(); + + @java.lang.Override() + public final int length() { + return 0; + } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/errorSuperclassCorrectErrorTypes.txt b/plugins/kapt3/kapt3-compiler/testData/converter/errorSuperclassCorrectErrorTypes.txt index 01c641b3783..b75ff4d79f0 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/errorSuperclassCorrectErrorTypes.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/errorSuperclassCorrectErrorTypes.txt @@ -9,19 +9,14 @@ public final class Child extends kotlin.collections.AbstractList extends kotlin.collections.AbstractList implements java.util.List { + public MappedList() { + super(); + } + @org.jetbrains.annotations.NotNull() @java.lang.Override() public java.lang.Void get(int index) { @@ -125,10 +129,6 @@ public final class MappedList extends kotlin.collect public int getSize() { return 0; } - - public MappedList() { - super(); - } } //////////////////// @@ -180,15 +180,15 @@ public final class TFooBar extends Foo implements test.Intf, Bar { @org.jetbrains.annotations.NotNull() private final X a = null; - @org.jetbrains.annotations.NotNull() - public final X getA() { - return null; - } - public TFooBar(@org.jetbrains.annotations.NotNull() X a) { super(); } + + @org.jetbrains.annotations.NotNull() + public final X getA() { + return null; + } } //////////////////// @@ -202,15 +202,15 @@ public final class TFooBar2 implements Foo, Bar { @org.jetbrains.annotations.NotNull() private final X a = null; - @org.jetbrains.annotations.NotNull() - public final X getA() { - return null; - } - public TFooBar2(@org.jetbrains.annotations.NotNull() X a) { super(); } + + @org.jetbrains.annotations.NotNull() + public final X getA() { + return null; + } } //////////////////// diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/functions.txt b/plugins/kapt3/kapt3-compiler/testData/converter/functions.txt index c3022a4f96c..39c2d66e87f 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/functions.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/functions.txt @@ -3,6 +3,10 @@ import java.lang.System; @kotlin.Metadata() public final class FunctionsTest { + public FunctionsTest() { + super(); + } + @org.jetbrains.annotations.NotNull() public final kotlin.reflect.KProperty1 f() { return null; @@ -19,8 +23,4 @@ public final class FunctionsTest { public final int f4() { return 0; } - - public FunctionsTest() { - super(); - } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/genericParameters.txt b/plugins/kapt3/kapt3-compiler/testData/converter/genericParameters.txt index 3124b0ba9ac..511e325eeb5 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/genericParameters.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/genericParameters.txt @@ -2,28 +2,28 @@ import java.lang.System; @kotlin.Metadata() public final class MappedList extends kotlin.collections.AbstractList implements java.util.List { + private final kotlin.jvm.functions.Function1 function = null; @org.jetbrains.annotations.NotNull() private final java.util.List list = null; - private final kotlin.jvm.functions.Function1 function = null; + + public MappedList(@org.jetbrains.annotations.NotNull() + java.util.List list, @org.jetbrains.annotations.NotNull() + kotlin.jvm.functions.Function1 function) { + super(); + } @java.lang.Override() public R get(int index) { return null; } - @java.lang.Override() - public int getSize() { - return 0; - } - @org.jetbrains.annotations.NotNull() public final java.util.List getList() { return null; } - public MappedList(@org.jetbrains.annotations.NotNull() - java.util.List list, @org.jetbrains.annotations.NotNull() - kotlin.jvm.functions.Function1 function) { - super(); + @java.lang.Override() + public int getSize() { + return 0; } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/genericRawSignatures.txt b/plugins/kapt3/kapt3-compiler/testData/converter/genericRawSignatures.txt index e8a57c8a56a..63525d2d679 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/genericRawSignatures.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/genericRawSignatures.txt @@ -3,6 +3,10 @@ import java.lang.System; @kotlin.Metadata() public final class GenericRawSignatures { + public GenericRawSignatures() { + super(); + } + @org.jetbrains.annotations.Nullable() public final T genericFun() { return null; @@ -12,8 +16,4 @@ public final class GenericRawSignatures { public final java.lang.String nonGenericFun() { return null; } - - public GenericRawSignatures() { - super(); - } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/genericSimple.txt b/plugins/kapt3/kapt3-compiler/testData/converter/genericSimple.txt index 2cc611e3767..f84e05a9a50 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/genericSimple.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/genericSimple.txt @@ -54,14 +54,14 @@ public final class MyClass> fld = null; + public MyClass() { + super(); + } + @org.jetbrains.annotations.Nullable() public final java.util.List> getFld() { return null; } - - public MyClass() { - super(); - } } //////////////////// diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/ignoredMembers.txt b/plugins/kapt3/kapt3-compiler/testData/converter/ignoredMembers.txt index 5becde66c24..93dd767e558 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/ignoredMembers.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/ignoredMembers.txt @@ -7,7 +7,8 @@ public final class Test { @org.jetbrains.annotations.NotNull() private final java.lang.String nonIgnoredProperty = ""; - public final void nonIgnoredFun() { + public Test() { + super(); } @org.jetbrains.annotations.NotNull() @@ -15,7 +16,6 @@ public final class Test { return null; } - public Test() { - super(); + public final void nonIgnoredFun() { } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/implicitReturnTypes.txt b/plugins/kapt3/kapt3-compiler/testData/converter/implicitReturnTypes.txt index c8072353f9f..6d11ec00330 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/implicitReturnTypes.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/implicitReturnTypes.txt @@ -22,6 +22,11 @@ public final class Cl { @org.jetbrains.annotations.NotNull() private java.lang.String name; + public Cl(@org.jetbrains.annotations.NotNull() + java.lang.String name) { + super(); + } + @org.jetbrains.annotations.NotNull() public final java.lang.String getName() { return null; @@ -30,11 +35,6 @@ public final class Cl { public final void setName(@org.jetbrains.annotations.NotNull() java.lang.String p0) { } - - public Cl(@org.jetbrains.annotations.NotNull() - java.lang.String name) { - super(); - } } //////////////////// diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/inheritanceSimple.txt b/plugins/kapt3/kapt3-compiler/testData/converter/inheritanceSimple.txt index 40e01b3c9e5..8b89f115836 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/inheritanceSimple.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/inheritanceSimple.txt @@ -3,13 +3,13 @@ import java.lang.System; @kotlin.Metadata() public abstract class BaseClass { - @org.jetbrains.annotations.NotNull() - public abstract Result doJob(); - public BaseClass(@org.jetbrains.annotations.NotNull() Context context, int num, boolean bool) { super(); } + + @org.jetbrains.annotations.NotNull() + public abstract Result doJob(); } //////////////////// @@ -29,16 +29,16 @@ import java.lang.System; @kotlin.Metadata() public final class Inheritor extends BaseClass { + public Inheritor(@org.jetbrains.annotations.NotNull() + Context context) { + super(null, 0, false); + } + @org.jetbrains.annotations.NotNull() @java.lang.Override() public Result doJob() { return null; } - - public Inheritor(@org.jetbrains.annotations.NotNull() - Context context) { - super(null, 0, false); - } } //////////////////// diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/inlineClasses.txt b/plugins/kapt3/kapt3-compiler/testData/converter/inlineClasses.txt index adbce593298..82a85d03fa2 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/inlineClasses.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/inlineClasses.txt @@ -9,13 +9,13 @@ public final class Cl { @org.jetbrains.annotations.NotNull() private final java.lang.String a = null; - @org.jetbrains.annotations.NotNull() - public final java.lang.String getA() { - return null; + @java.lang.Override() + public boolean equals(java.lang.Object p0) { + return false; } - @java.lang.Override() - public java.lang.String toString() { + @org.jetbrains.annotations.NotNull() + public final java.lang.String getA() { return null; } @@ -25,7 +25,7 @@ public final class Cl { } @java.lang.Override() - public boolean equals(java.lang.Object p0) { - return false; + public java.lang.String toString() { + return null; } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/interfaceImplementation.txt b/plugins/kapt3/kapt3-compiler/testData/converter/interfaceImplementation.txt index fe33cd8aad0..f40f0dcbf44 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/interfaceImplementation.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/interfaceImplementation.txt @@ -17,6 +17,11 @@ public final class Product2 implements Named { @org.jetbrains.annotations.Nullable() private java.lang.String name; + public Product2(@org.jetbrains.annotations.NotNull() + java.lang.String otherName) { + super(); + } + @org.jetbrains.annotations.Nullable() @java.lang.Override() public java.lang.String getName() { @@ -26,9 +31,4 @@ public final class Product2 implements Named { public void setName(@org.jetbrains.annotations.Nullable() java.lang.String p0) { } - - public Product2(@org.jetbrains.annotations.NotNull() - java.lang.String otherName) { - super(); - } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/javadoc.txt b/plugins/kapt3/kapt3-compiler/testData/converter/javadoc.txt index c8e28d7075d..cf13a91ae8a 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/javadoc.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/javadoc.txt @@ -57,6 +57,10 @@ public final class B { @org.jetbrains.annotations.NotNull() private final java.lang.String d = ""; + public B() { + super(); + } + @org.jetbrains.annotations.NotNull() public final java.lang.String getA() { return null; @@ -76,8 +80,4 @@ public final class B { public final java.lang.String getD() { return null; } - - public B() { - super(); - } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/jvmDefaultAll.txt b/plugins/kapt3/kapt3-compiler/testData/converter/jvmDefaultAll.txt index 9deab10689b..556fbf20e9e 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/jvmDefaultAll.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/jvmDefaultAll.txt @@ -3,11 +3,11 @@ import java.lang.System; @kotlin.Metadata() public abstract interface Foo { + public abstract void bar(); + public default void foo() { } public default void foo2(int a) { } - - public abstract void bar(); } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/jvmDefaultAllCompatibility.txt b/plugins/kapt3/kapt3-compiler/testData/converter/jvmDefaultAllCompatibility.txt index 2f19e15188d..eba77fd99fb 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/jvmDefaultAllCompatibility.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/jvmDefaultAllCompatibility.txt @@ -3,14 +3,14 @@ import java.lang.System; @kotlin.Metadata() public abstract interface Foo { + public abstract void bar(); + public default void foo() { } public default void foo2(int a) { } - public abstract void bar(); - @kotlin.Metadata() public static final class DefaultImpls { diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/jvmDefaultDisable.txt b/plugins/kapt3/kapt3-compiler/testData/converter/jvmDefaultDisable.txt index 7459312db60..c8537c35787 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/jvmDefaultDisable.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/jvmDefaultDisable.txt @@ -3,13 +3,13 @@ import java.lang.System; @kotlin.Metadata() public abstract interface Foo { + public abstract void bar(); + public abstract void foo(); public default void foo2(int a) { } - public abstract void bar(); - @kotlin.Metadata() public static final class DefaultImpls { diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/jvmDefaultEnable.txt b/plugins/kapt3/kapt3-compiler/testData/converter/jvmDefaultEnable.txt index 7459312db60..c8537c35787 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/jvmDefaultEnable.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/jvmDefaultEnable.txt @@ -3,13 +3,13 @@ import java.lang.System; @kotlin.Metadata() public abstract interface Foo { + public abstract void bar(); + public abstract void foo(); public default void foo2(int a) { } - public abstract void bar(); - @kotlin.Metadata() public static final class DefaultImpls { diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/jvmOverloads.txt b/plugins/kapt3/kapt3-compiler/testData/converter/jvmOverloads.txt index 2b92efc2804..2a3dc2061f3 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/jvmOverloads.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/jvmOverloads.txt @@ -7,6 +7,15 @@ public final class State { @org.jetbrains.annotations.NotNull() private final java.lang.String someString = null; + public State(int someInt, long someLong) { + super(); + } + + public State(int someInt, long someLong, @org.jetbrains.annotations.NotNull() + java.lang.String someString) { + super(); + } + public final int getSomeInt() { return 0; } @@ -19,15 +28,6 @@ public final class State { public final java.lang.String getSomeString() { return null; } - - public State(int someInt, long someLong, @org.jetbrains.annotations.NotNull() - java.lang.String someString) { - super(); - } - - public State(int someInt, long someLong) { - super(); - } } //////////////////// @@ -42,28 +42,7 @@ public final class State2 { @org.jetbrains.annotations.NotNull() public final java.lang.String someString = null; - public final int test(int someInt, long someLong, @org.jetbrains.annotations.NotNull() - java.lang.String someString) { - return 0; - } - - public final int test(int someInt, long someLong) { - return 0; - } - - public final int test(int someInt) { - return 0; - } - - public final void someMethod(@org.jetbrains.annotations.NotNull() - java.lang.String str) { - } - - public final void methodWithoutArgs() { - } - - public State2(int someInt, long someLong, @org.jetbrains.annotations.NotNull() - java.lang.String someString) { + public State2(int someInt) { super(); } @@ -71,7 +50,28 @@ public final class State2 { super(); } - public State2(int someInt) { + public State2(int someInt, long someLong, @org.jetbrains.annotations.NotNull() + java.lang.String someString) { super(); } + + public final void methodWithoutArgs() { + } + + public final void someMethod(@org.jetbrains.annotations.NotNull() + java.lang.String str) { + } + + public final int test(int someInt) { + return 0; + } + + public final int test(int someInt, long someLong) { + return 0; + } + + public final int test(int someInt, long someLong, @org.jetbrains.annotations.NotNull() + java.lang.String someString) { + return 0; + } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/jvmStatic.txt b/plugins/kapt3/kapt3-compiler/testData/converter/jvmStatic.txt index f92ab58e9c3..475d383db7e 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/jvmStatic.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/jvmStatic.txt @@ -14,15 +14,15 @@ public abstract interface FooComponent { @kotlin.Metadata() public static final class Companion { + private Companion() { + super(); + } + @org.jetbrains.annotations.NotNull() public final java.lang.String create(@org.jetbrains.annotations.NotNull() java.lang.String context) { return null; } - - private Companion() { - super(); - } } } @@ -33,13 +33,13 @@ import java.lang.System; @kotlin.Metadata() public final class JvmStaticTest { - public final byte three = (byte)3; - public final char d = 'D'; - private static final int one = 1; - public static final int two = 2; - public static final char c = 'C'; @org.jetbrains.annotations.NotNull() public static final JvmStaticTest.Companion Companion = null; + public static final char c = 'C'; + public final char d = 'D'; + private static final int one = 1; + public final byte three = (byte)3; + public static final int two = 2; public JvmStaticTest() { super(); @@ -52,16 +52,16 @@ public final class JvmStaticTest { @kotlin.Metadata() public static final class Companion { - @java.lang.Deprecated() - public static void getOne$annotations() { + private Companion() { + super(); } public final int getOne() { return 0; } - private Companion() { - super(); + @java.lang.Deprecated() + public static void getOne$annotations() { } } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/jvmStaticFieldInParent.txt b/plugins/kapt3/kapt3-compiler/testData/converter/jvmStaticFieldInParent.txt index 74e088d08fa..72350b059c0 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/jvmStaticFieldInParent.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/jvmStaticFieldInParent.txt @@ -2,10 +2,10 @@ import java.lang.System; @kotlin.Metadata() public final class Test { - @org.jetbrains.annotations.NotNull() - private static final java.lang.String test = ""; @org.jetbrains.annotations.NotNull() public static final Test.A A = null; + @org.jetbrains.annotations.NotNull() + private static final java.lang.String test = ""; public Test() { super(); @@ -19,8 +19,8 @@ public final class Test { @kotlin.Metadata() public static final class A { - @java.lang.Deprecated() - public static void getTest$annotations() { + private A() { + super(); } @org.jetbrains.annotations.NotNull() @@ -28,8 +28,8 @@ public final class Test { return null; } - private A() { - super(); + @java.lang.Deprecated() + public static void getTest$annotations() { } } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/kt14996.txt b/plugins/kapt3/kapt3-compiler/testData/converter/kt14996.txt index a7516a202c5..b31105677bc 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/kt14996.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/kt14996.txt @@ -7,15 +7,15 @@ public final class Kt14996Kt { super(); } - @org.jetbrains.annotations.NotNull() - public static final java.lang.String crashMe(@org.jetbrains.annotations.NotNull() - java.util.List values) { - return null; - } - @org.jetbrains.annotations.NotNull() public static final java.lang.CharSequence crashMe(@org.jetbrains.annotations.NotNull() java.util.List values) { return null; } + + @org.jetbrains.annotations.NotNull() + public static final java.lang.String crashMe(@org.jetbrains.annotations.NotNull() + java.util.List values) { + return null; + } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/kt14998.txt b/plugins/kapt3/kapt3-compiler/testData/converter/kt14998.txt index 3bf3b1ad424..45a73433e10 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/kt14998.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/kt14998.txt @@ -3,48 +3,49 @@ import java.lang.System; @kotlin.Metadata() public final class Outer { - public final void nonAbstract(@org.jetbrains.annotations.NotNull() - java.lang.String s, int i) { - } - public Outer() { super(); } + public final void nonAbstract(@org.jetbrains.annotations.NotNull() + java.lang.String s, int i) { + } + @kotlin.Metadata() final class Inner { - @org.jetbrains.annotations.NotNull() - private final java.lang.String foo = null; @org.jetbrains.annotations.NotNull() private final java.lang.String bar = null; - @org.jetbrains.annotations.NotNull() - public final java.lang.String getFoo() { - return null; - } - - @org.jetbrains.annotations.NotNull() - public final java.lang.String getBar() { - return null; - } + private final java.lang.String foo = null; public Inner(@org.jetbrains.annotations.NotNull() java.lang.String foo, @org.jetbrains.annotations.NotNull() java.lang.String bar) { super(); } + + @org.jetbrains.annotations.NotNull() + public final java.lang.String getBar() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.lang.String getFoo() { + return null; + } } @kotlin.Metadata() static final class Nested { - @org.jetbrains.annotations.NotNull() - private final java.lang.String foo = null; @org.jetbrains.annotations.NotNull() private final java.lang.String bar = null; - @org.jetbrains.annotations.NotNull() - public final java.lang.String getFoo() { - return null; + private final java.lang.String foo = null; + + public Nested(@org.jetbrains.annotations.NotNull() + java.lang.String foo, @org.jetbrains.annotations.NotNull() + java.lang.String bar) { + super(); } @org.jetbrains.annotations.NotNull() @@ -52,10 +53,9 @@ public final class Outer { return null; } - public Nested(@org.jetbrains.annotations.NotNull() - java.lang.String foo, @org.jetbrains.annotations.NotNull() - java.lang.String bar) { - super(); + @org.jetbrains.annotations.NotNull() + public final java.lang.String getFoo() { + return null; } } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/kt17567.txt b/plugins/kapt3/kapt3-compiler/testData/converter/kt17567.txt index 3f272ea4f5b..4a865d9f846 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/kt17567.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/kt17567.txt @@ -7,13 +7,13 @@ public final class MutableEntry internal = null; private final K key = null; - @java.lang.Override() - public K getKey() { - return null; - } - public MutableEntry(@org.jetbrains.annotations.NotNull() java.util.Map internal, K key, V value) { super(); } + + @java.lang.Override() + public K getKey() { + return null; + } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/kt18791.txt b/plugins/kapt3/kapt3-compiler/testData/converter/kt18791.txt index 88d1bf86686..d3ea90577db 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/kt18791.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/kt18791.txt @@ -89,14 +89,13 @@ import java.lang.System; @kotlin.Metadata() public final class JJ { - @org.jetbrains.annotations.NotNull() - private static final java.lang.String b = null; @org.jetbrains.annotations.NotNull() public static final app.JJ INSTANCE = null; - @org.jetbrains.annotations.NotNull() - public final java.lang.String getB() { - return null; + private static final java.lang.String b = null; + + private JJ() { + super(); } @org.jetbrains.annotations.NotNull() @@ -104,8 +103,9 @@ public final class JJ { return null; } - private JJ() { - super(); + @org.jetbrains.annotations.NotNull() + public final java.lang.String getB() { + return null; } } @@ -136,59 +136,8 @@ public final class MyActivity { public int propE = app.B.id.textView; private final int propF = 0; - @Bind(id = lib.R.id.textView) - @java.lang.Deprecated() - public static void getA$annotations() { - } - - public final int getA() { - return 0; - } - - @Bind(id = lib.R.id.textView) - @java.lang.Deprecated() - public static void getB$annotations() { - } - - public final int getB() { - return 0; - } - - @Bind(id = app.R.layout.mainActivity) - @java.lang.Deprecated() - public static void getC$annotations() { - } - - public final int getC() { - return 0; - } - - @Bind(id = app.R.layout.mainActivity) - @java.lang.Deprecated() - public static void getD$annotations() { - } - - public final int getD() { - return 0; - } - - @Anno(a1 = app.B.a1, a2 = app.B.a2, a3 = app.B.a3, a4 = app.B.a4, a5 = app.B.a5, a6 = app.B.a6, a7 = app.B.a7, a8 = app.B.a8, a9 = "A") - @Bind(id = app.R2.layout.mainActivity) - @java.lang.Deprecated() - public static void getE$annotations() { - } - - public final int getE() { - return 0; - } - - @Bind(id = app.B.id.textView) - @java.lang.Deprecated() - public static void getF$annotations() { - } - - public final int getF() { - return 0; + public MyActivity() { + super(); } @Bind(id = lib.R.id.textView) @@ -212,8 +161,59 @@ public final class MyActivity { public final void foo5() { } + public final int getA() { + return 0; + } + + @Bind(id = lib.R.id.textView) + @java.lang.Deprecated() + public static void getA$annotations() { + } + + public final int getB() { + return 0; + } + + @Bind(id = lib.R.id.textView) + @java.lang.Deprecated() + public static void getB$annotations() { + } + + public final int getC() { + return 0; + } + + @Bind(id = app.R.layout.mainActivity) + @java.lang.Deprecated() + public static void getC$annotations() { + } + + public final int getD() { + return 0; + } + + @Bind(id = app.R.layout.mainActivity) + @java.lang.Deprecated() + public static void getD$annotations() { + } + + public final int getE() { + return 0; + } + + @Anno(a1 = app.B.a1, a2 = app.B.a2, a3 = app.B.a3, a4 = app.B.a4, a5 = app.B.a5, a6 = app.B.a6, a7 = app.B.a7, a8 = app.B.a8, a9 = "A") + @Bind(id = app.R2.layout.mainActivity) + @java.lang.Deprecated() + public static void getE$annotations() { + } + + public final int getF() { + return 0; + } + @Bind(id = app.B.id.textView) - public final void plainIntConstant() { + @java.lang.Deprecated() + public static void getF$annotations() { } public final int getPropB() { @@ -224,15 +224,15 @@ public final class MyActivity { return 0; } - public final void setPropC(int p0) { - } - public final int getPropF() { return 0; } - public MyActivity() { - super(); + @Bind(id = app.B.id.textView) + public final void plainIntConstant() { + } + + public final void setPropC(int p0) { } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/kt24272.txt b/plugins/kapt3/kapt3-compiler/testData/converter/kt24272.txt index b3fbf47e87c..99e83853ff7 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/kt24272.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/kt24272.txt @@ -6,16 +6,16 @@ public final class Foo { private final Foo.Bar bar = null; private final java.lang.String string = null; - @org.jetbrains.annotations.NotNull() - public final Foo.Bar getBar() { - return null; - } - public Foo(@org.jetbrains.annotations.NotNull() java.lang.String string) { super(); } + @org.jetbrains.annotations.NotNull() + public final Foo.Bar getBar() { + return null; + } + @kotlin.Metadata() public static final class Bar { @org.jetbrains.annotations.NotNull() @@ -23,6 +23,11 @@ public final class Foo { @org.jetbrains.annotations.NotNull() private final java.lang.String string = null; + public Bar(@org.jetbrains.annotations.NotNull() + java.lang.String string) { + super(); + } + @org.jetbrains.annotations.NotNull() public final java.util.ArrayList getBars() { return null; @@ -32,10 +37,5 @@ public final class Foo { public final java.lang.String getString() { return null; } - - public Bar(@org.jetbrains.annotations.NotNull() - java.lang.String string) { - super(); - } } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/kt25071.txt b/plugins/kapt3/kapt3-compiler/testData/converter/kt25071.txt index d3065ba81c7..47d5bea2ace 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/kt25071.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/kt25071.txt @@ -4,13 +4,13 @@ import java.lang.System; @kotlin.Metadata() public final class StaticImport { - private final java.util.Collection x = null; private final kapt.StaticMethod l = null; private final kapt.StaticMethod m = null; + private final java.util.Collection x = null; private final int y = 0; - public final java.util.Collection getX() { - return null; + public StaticImport() { + super(); } public final kapt.StaticMethod getL() { @@ -21,12 +21,12 @@ public final class StaticImport { return null; } - public final int getY() { - return 0; + public final java.util.Collection getX() { + return null; } - public StaticImport() { - super(); + public final int getY() { + return 0; } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/kt27126.txt b/plugins/kapt3/kapt3-compiler/testData/converter/kt27126.txt index 9b1ef49ee4a..3abef07994c 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/kt27126.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/kt27126.txt @@ -5,11 +5,9 @@ import java.lang.System; @kotlin.Metadata() public abstract class BundleProperty extends test.NullableBundleProperty { - @java.lang.Override() - public final void setValue(@org.jetbrains.annotations.NotNull() - java.lang.Object thisRef, @org.jetbrains.annotations.NotNull() - kotlin.reflect.KProperty property, @org.jetbrains.annotations.Nullable() - AA value) { + public BundleProperty(@org.jetbrains.annotations.Nullable() + java.lang.String key) { + super(null); } @java.lang.Override() @@ -30,9 +28,11 @@ public abstract class BundleProperty extends test.N java.lang.Object bundle, @org.jetbrains.annotations.NotNull() java.lang.String key, AA value); - public BundleProperty(@org.jetbrains.annotations.Nullable() - java.lang.String key) { - super(null); + @java.lang.Override() + public final void setValue(@org.jetbrains.annotations.NotNull() + java.lang.Object thisRef, @org.jetbrains.annotations.NotNull() + kotlin.reflect.KProperty property, @org.jetbrains.annotations.Nullable() + AA value) { } } @@ -67,10 +67,16 @@ import java.lang.System; public abstract class NullableBundleProperty implements kotlin.properties.ReadWriteProperty { private final java.lang.String key = null; - private final java.lang.String toKey(kotlin.reflect.KProperty $this$toKey) { - return null; + public NullableBundleProperty(@org.jetbrains.annotations.Nullable() + java.lang.String key) { + super(); } + @org.jetbrains.annotations.Nullable() + public abstract EE getValue(@org.jetbrains.annotations.NotNull() + java.lang.Object bundle, @org.jetbrains.annotations.NotNull() + java.lang.String key); + @org.jetbrains.annotations.Nullable() @java.lang.Override() public EE getValue(@org.jetbrains.annotations.NotNull() @@ -79,6 +85,11 @@ public abstract class NullableBundleProperty implem return null; } + public abstract void setNullableValue(@org.jetbrains.annotations.NotNull() + java.lang.Object bundle, @org.jetbrains.annotations.NotNull() + java.lang.String key, @org.jetbrains.annotations.Nullable() + EE value); + @java.lang.Override() public void setValue(@org.jetbrains.annotations.NotNull() java.lang.Object thisRef, @org.jetbrains.annotations.NotNull() @@ -86,18 +97,7 @@ public abstract class NullableBundleProperty implem EE value) { } - @org.jetbrains.annotations.Nullable() - public abstract EE getValue(@org.jetbrains.annotations.NotNull() - java.lang.Object bundle, @org.jetbrains.annotations.NotNull() - java.lang.String key); - - public abstract void setNullableValue(@org.jetbrains.annotations.NotNull() - java.lang.Object bundle, @org.jetbrains.annotations.NotNull() - java.lang.String key, @org.jetbrains.annotations.Nullable() - EE value); - - public NullableBundleProperty(@org.jetbrains.annotations.Nullable() - java.lang.String key) { - super(); + private final java.lang.String toKey(kotlin.reflect.KProperty $this$toKey) { + return null; } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/kt34569.txt b/plugins/kapt3/kapt3-compiler/testData/converter/kt34569.txt index 10fbe967c0f..482d0e87194 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/kt34569.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/kt34569.txt @@ -3,11 +3,11 @@ import java.lang.System; @kotlin.Metadata() public final class T implements java.lang.Runnable { - @java.lang.Override() - public void run() { - } - public T() { super(); } + + @java.lang.Override() + public void run() { + } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/lazyProperty.txt b/plugins/kapt3/kapt3-compiler/testData/converter/lazyProperty.txt index c94dce768d6..bca7d1b6c14 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/lazyProperty.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/lazyProperty.txt @@ -2,13 +2,13 @@ import java.lang.System; @kotlin.Metadata() public final class Foo { - private final kotlin.Lazy foo$delegate = null; private final kotlin.Lazy bar$delegate = null; private final kotlin.Lazy baz$delegate = null; + private final kotlin.Lazy foo$delegate = null; private final kotlin.Lazy generic1$delegate = null; - private final java.lang.Runnable getFoo() { - return null; + public Foo() { + super(); } private final java.lang.Object getBar() { @@ -19,12 +19,12 @@ public final class Foo { return null; } - private final GenericIntf getGeneric1() { + private final java.lang.Runnable getFoo() { return null; } - public Foo() { - super(); + private final GenericIntf getGeneric1() { + return null; } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/maxErrorCount.txt b/plugins/kapt3/kapt3-compiler/testData/converter/maxErrorCount.txt index e762ee7db60..238868dcb69 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/maxErrorCount.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/maxErrorCount.txt @@ -3,12 +3,12 @@ import kotlin.reflect.KClass; @kotlin.Metadata() public final class Test { + public Test() { + super(); + } + public final void a(@org.jetbrains.annotations.NotNull() ABC a, @org.jetbrains.annotations.NotNull() BCD b) { } - - public Test() { - super(); - } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/methodParameterNames.txt b/plugins/kapt3/kapt3-compiler/testData/converter/methodParameterNames.txt index 9891cc7ef2a..35c868cb5b2 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/methodParameterNames.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/methodParameterNames.txt @@ -3,17 +3,17 @@ import java.lang.System; @kotlin.Metadata() public abstract class Cls { - public abstract void foo(@org.jetbrains.annotations.NotNull() - java.lang.String abc); + public Cls() { + super(); + } @org.jetbrains.annotations.NotNull() public final java.lang.String bar(int bcd) { return null; } - public Cls() { - super(); - } + public abstract void foo(@org.jetbrains.annotations.NotNull() + java.lang.String abc); } //////////////////// @@ -24,12 +24,12 @@ import java.lang.System; @kotlin.Metadata() public abstract interface Intf { - public abstract void foo(@org.jetbrains.annotations.NotNull() - java.lang.String abc); - @org.jetbrains.annotations.NotNull() public abstract java.lang.String bar(int bcd); + public abstract void foo(@org.jetbrains.annotations.NotNull() + java.lang.String abc); + @kotlin.Metadata() public static final class DefaultImpls { diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/methodPropertySignatureClash.txt b/plugins/kapt3/kapt3-compiler/testData/converter/methodPropertySignatureClash.txt index 73e9d91ae0d..dad68ddd0ba 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/methodPropertySignatureClash.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/methodPropertySignatureClash.txt @@ -4,6 +4,10 @@ import java.lang.System; public final class CrashMe { private final int resources = 1; + public CrashMe() { + super(); + } + public final int getResources() { return 0; } @@ -12,8 +16,4 @@ public final class CrashMe { public final java.lang.String getResources() { return null; } - - public CrashMe() { - super(); - } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/modifiers.txt b/plugins/kapt3/kapt3-compiler/testData/converter/modifiers.txt index f54ffd3f1da..ea063374792 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/modifiers.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/modifiers.txt @@ -33,6 +33,10 @@ public final class Modifiers { @org.jetbrains.annotations.NotNull() private volatile java.lang.String volatileField = ""; + public Modifiers() { + super(); + } + @org.jetbrains.annotations.NotNull() public final java.lang.String getTransientField() { return null; @@ -43,16 +47,8 @@ public final class Modifiers { return null; } - public final void setVolatileField(@org.jetbrains.annotations.NotNull() - java.lang.String p0) { - } - - public final strictfp void strictFp() { - } - @org.jetbrains.annotations.NotNull() - public final java.lang.String overloads(@org.jetbrains.annotations.NotNull() - java.lang.String a, int n) { + public final java.lang.String overloads() { return null; } @@ -63,12 +59,16 @@ public final class Modifiers { } @org.jetbrains.annotations.NotNull() - public final java.lang.String overloads() { + public final java.lang.String overloads(@org.jetbrains.annotations.NotNull() + java.lang.String a, int n) { return null; } - public Modifiers() { - super(); + public final void setVolatileField(@org.jetbrains.annotations.NotNull() + java.lang.String p0) { + } + + public final strictfp void strictFp() { } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/nestedClasses.txt b/plugins/kapt3/kapt3-compiler/testData/converter/nestedClasses.txt index cc890eed4ce..e51f108525d 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/nestedClasses.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/nestedClasses.txt @@ -5,9 +5,8 @@ public final class A { @org.jetbrains.annotations.Nullable() private final A x = null; - @org.jetbrains.annotations.Nullable() - public final A getX() { - return null; + public A() { + super(); } @org.jetbrains.annotations.Nullable() @@ -17,8 +16,9 @@ public final class A { return null; } - public A() { - super(); + @org.jetbrains.annotations.Nullable() + public final A getX() { + return null; } @kotlin.Metadata() diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/nestedClasses2.txt b/plugins/kapt3/kapt3-compiler/testData/converter/nestedClasses2.txt index 595a64167ff..cebef3ed0e0 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/nestedClasses2.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/nestedClasses2.txt @@ -4,10 +4,10 @@ import java.lang.System; public final class A$B { public A$B.C c; public A$B.D$E de; - public J$B.C jc; - public J$B.D$E jde; public A$B.D$$E dee; public A$B.D$$$E deee; + public J$B.C jc; + public J$B.D$E jde; public J$B.D$$E jdee; public J$B.D$$$E jdeee; @@ -245,6 +245,11 @@ public final class Test1 extends Foo.Bar implements IFoo.IBar, IFoo.IBar.IZoo { @org.jetbrains.annotations.NotNull() private final Foo.Bar.Zoo zoo = null; + public Test1(@org.jetbrains.annotations.NotNull() + Foo.Bar.Zoo zoo) { + super(); + } + @org.jetbrains.annotations.NotNull() public final java.lang.Thread.State a() { return null; @@ -259,9 +264,4 @@ public final class Test1 extends Foo.Bar implements IFoo.IBar, IFoo.IBar.IZoo { public final Foo.Bar.Zoo getZoo() { return null; } - - public Test1(@org.jetbrains.annotations.NotNull() - Foo.Bar.Zoo zoo) { - super(); - } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/nestedClassesNonRootPackage.txt b/plugins/kapt3/kapt3-compiler/testData/converter/nestedClassesNonRootPackage.txt index 4b911cb1093..fa4e412063a 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/nestedClassesNonRootPackage.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/nestedClassesNonRootPackage.txt @@ -6,10 +6,10 @@ import java.lang.System; public final class A$B { public test.A$B.C c; public test.A$B.D$E de; - public test.J$B.C jc; - public test.J$B.D$E jde; public test.A$B.D$$E dee; public test.A$B.D$$$E deee; + public test.J$B.C jc; + public test.J$B.D$E jde; public test.J$B.D$$E jdee; public test.J$B.D$$$E jdeee; @@ -253,6 +253,11 @@ public final class Test1 extends test.Foo.Bar implements test.IFoo.IBar, test.IF @org.jetbrains.annotations.NotNull() private final test.Foo.Bar.Zoo zoo = null; + public Test1(@org.jetbrains.annotations.NotNull() + test.Foo.Bar.Zoo zoo) { + super(); + } + @org.jetbrains.annotations.NotNull() public final java.lang.Thread.State a() { return null; @@ -267,9 +272,4 @@ public final class Test1 extends test.Foo.Bar implements test.IFoo.IBar, test.IF public final test.Foo.Bar.Zoo getZoo() { return null; } - - public Test1(@org.jetbrains.annotations.NotNull() - test.Foo.Bar.Zoo zoo) { - super(); - } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/nonExistentClass.txt b/plugins/kapt3/kapt3-compiler/testData/converter/nonExistentClass.txt index 0c835f604aa..674182486da 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/nonExistentClass.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/nonExistentClass.txt @@ -3,6 +3,8 @@ import java.lang.System; @kotlin.Suppress(names = {"UNRESOLVED_REFERENCE"}) @kotlin.Metadata() public final class NonExistentType { + @org.jetbrains.annotations.NotNull() + public static final NonExistentType INSTANCE = null; @org.jetbrains.annotations.Nullable() private static final ABCDEF a = null; @org.jetbrains.annotations.Nullable() @@ -11,8 +13,23 @@ public final class NonExistentType { private static final Function1 c = null; @org.jetbrains.annotations.Nullable() private static final ABCDEF, kotlin.Unit>> d = null; + + private NonExistentType() { + super(); + } + @org.jetbrains.annotations.NotNull() - public static final NonExistentType INSTANCE = null; + public final ABCDEF a(@org.jetbrains.annotations.NotNull() + ABCDEF a, @org.jetbrains.annotations.NotNull() + java.lang.String s) { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final ABCDEF b(@org.jetbrains.annotations.NotNull() + java.lang.String s) { + return null; + } @org.jetbrains.annotations.Nullable() public final ABCDEF getA() { @@ -33,23 +50,6 @@ public final class NonExistentType { public final ABCDEF, kotlin.Unit>> getD() { return null; } - - @org.jetbrains.annotations.NotNull() - public final ABCDEF a(@org.jetbrains.annotations.NotNull() - ABCDEF a, @org.jetbrains.annotations.NotNull() - java.lang.String s) { - return null; - } - - @org.jetbrains.annotations.NotNull() - public final ABCDEF b(@org.jetbrains.annotations.NotNull() - java.lang.String s) { - return null; - } - - private NonExistentType() { - super(); - } } //////////////////// diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/nonExistentClassTypesConversion.txt b/plugins/kapt3/kapt3-compiler/testData/converter/nonExistentClassTypesConversion.txt index 660b3b0dcca..d6e2263e680 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/nonExistentClassTypesConversion.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/nonExistentClassTypesConversion.txt @@ -53,6 +53,11 @@ public final class Test { private final ABC b = null; @org.jetbrains.annotations.Nullable() private final java.util.List c = null; + public ABC coocoo; + public ABC coocoo2; + public ABC coocoo21; + public ABC coocoo3; + public ABC> coocoo31; @org.jetbrains.annotations.Nullable() private final java.util.List>>> d = null; public java.util.List> e; @@ -63,205 +68,17 @@ public final class Test { public Function0 j; public Function2, CDE> k; public ABC.BCD.EFG l; - public ABC coocoo; - public ABC coocoo2; - public ABC coocoo21; - public ABC coocoo3; - public ABC> coocoo31; - public ABC nested; @org.jetbrains.annotations.NotNull() private final java.lang.Object m = null; @org.jetbrains.annotations.NotNull() private final java.lang.String n = ""; - public java.util.List>>>>>>>>> o11; + public ABC nested; public java.util.List>>>>>>>> o10; + public java.util.List>>>>>>>>> o11; public java.util.Calendar.Builder p; - @org.jetbrains.annotations.NotNull() - public final ABC getA() { - return null; - } - - public final void setA(@org.jetbrains.annotations.NotNull() - ABC p0) { - } - - @org.jetbrains.annotations.Nullable() - public final ABC getB() { - return null; - } - - @org.jetbrains.annotations.Nullable() - public final java.util.List getC() { - return null; - } - - @org.jetbrains.annotations.Nullable() - public final java.util.List>>> getD() { - return null; - } - - @org.jetbrains.annotations.NotNull() - public final java.util.List> getE() { - return null; - } - - public final void setE(@org.jetbrains.annotations.NotNull() - java.util.List> p0) { - } - - @org.jetbrains.annotations.NotNull() - public final ABC getF() { - return null; - } - - public final void setF(@org.jetbrains.annotations.NotNull() - ABC p0) { - } - - @org.jetbrains.annotations.NotNull() - public final java.util.List getG() { - return null; - } - - public final void setG(@org.jetbrains.annotations.NotNull() - java.util.List p0) { - } - - @org.jetbrains.annotations.NotNull() - public final ABC getH() { - return null; - } - - public final void setH(@org.jetbrains.annotations.NotNull() - ABC p0) { - } - - @org.jetbrains.annotations.NotNull() - public final Function2, CDE> getI() { - return null; - } - - public final void setI(@org.jetbrains.annotations.NotNull() - Function2, CDE> p0) { - } - - @org.jetbrains.annotations.NotNull() - public final Function0 getJ() { - return null; - } - - public final void setJ(@org.jetbrains.annotations.NotNull() - Function0 p0) { - } - - @org.jetbrains.annotations.NotNull() - public final Function2, CDE> getK() { - return null; - } - - public final void setK(@org.jetbrains.annotations.NotNull() - Function2, CDE> p0) { - } - - @org.jetbrains.annotations.NotNull() - public final ABC.BCD.EFG getL() { - return null; - } - - public final void setL(@org.jetbrains.annotations.NotNull() - ABC.BCD.EFG p0) { - } - - @org.jetbrains.annotations.NotNull() - public final ABC getCoocoo() { - return null; - } - - public final void setCoocoo(@org.jetbrains.annotations.NotNull() - ABC p0) { - } - - @org.jetbrains.annotations.NotNull() - public final ABC getCoocoo2() { - return null; - } - - public final void setCoocoo2(@org.jetbrains.annotations.NotNull() - ABC p0) { - } - - @org.jetbrains.annotations.NotNull() - public final ABC getCoocoo21() { - return null; - } - - public final void setCoocoo21(@org.jetbrains.annotations.NotNull() - ABC p0) { - } - - @org.jetbrains.annotations.NotNull() - public final ABC getCoocoo3() { - return null; - } - - public final void setCoocoo3(@org.jetbrains.annotations.NotNull() - ABC p0) { - } - - @org.jetbrains.annotations.NotNull() - public final ABC> getCoocoo31() { - return null; - } - - public final void setCoocoo31(@org.jetbrains.annotations.NotNull() - ABC> p0) { - } - - @org.jetbrains.annotations.NotNull() - public final ABC getNested() { - return null; - } - - public final void setNested(@org.jetbrains.annotations.NotNull() - ABC p0) { - } - - @org.jetbrains.annotations.NotNull() - public final java.lang.Object getM() { - return null; - } - - @org.jetbrains.annotations.NotNull() - public final java.lang.String getN() { - return null; - } - - @org.jetbrains.annotations.NotNull() - public final java.util.List>>>>>>>>> getO11() { - return null; - } - - public final void setO11(@org.jetbrains.annotations.NotNull() - java.util.List>>>>>>>>> p0) { - } - - @org.jetbrains.annotations.NotNull() - public final java.util.List>>>>>>>> getO10() { - return null; - } - - public final void setO10(@org.jetbrains.annotations.NotNull() - java.util.List>>>>>>>> p0) { - } - - @org.jetbrains.annotations.NotNull() - public final java.util.Calendar.Builder getP() { - return null; - } - - public final void setP(@org.jetbrains.annotations.NotNull() - java.util.Calendar.Builder p0) { + public Test() { + super(); } @org.jetbrains.annotations.Nullable() @@ -290,8 +107,191 @@ public final class Test { return null; } - public Test() { - super(); + @org.jetbrains.annotations.NotNull() + public final ABC getA() { + return null; + } + + @org.jetbrains.annotations.Nullable() + public final ABC getB() { + return null; + } + + @org.jetbrains.annotations.Nullable() + public final java.util.List getC() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final ABC getCoocoo() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final ABC getCoocoo2() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final ABC getCoocoo21() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final ABC getCoocoo3() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final ABC> getCoocoo31() { + return null; + } + + @org.jetbrains.annotations.Nullable() + public final java.util.List>>> getD() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.util.List> getE() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final ABC getF() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.util.List getG() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final ABC getH() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final Function2, CDE> getI() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final Function0 getJ() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final Function2, CDE> getK() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final ABC.BCD.EFG getL() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.lang.Object getM() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.lang.String getN() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final ABC getNested() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.util.List>>>>>>>> getO10() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.util.List>>>>>>>>> getO11() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.util.Calendar.Builder getP() { + return null; + } + + public final void setA(@org.jetbrains.annotations.NotNull() + ABC p0) { + } + + public final void setCoocoo(@org.jetbrains.annotations.NotNull() + ABC p0) { + } + + public final void setCoocoo2(@org.jetbrains.annotations.NotNull() + ABC p0) { + } + + public final void setCoocoo21(@org.jetbrains.annotations.NotNull() + ABC p0) { + } + + public final void setCoocoo3(@org.jetbrains.annotations.NotNull() + ABC p0) { + } + + public final void setCoocoo31(@org.jetbrains.annotations.NotNull() + ABC> p0) { + } + + public final void setE(@org.jetbrains.annotations.NotNull() + java.util.List> p0) { + } + + public final void setF(@org.jetbrains.annotations.NotNull() + ABC p0) { + } + + public final void setG(@org.jetbrains.annotations.NotNull() + java.util.List p0) { + } + + public final void setH(@org.jetbrains.annotations.NotNull() + ABC p0) { + } + + public final void setI(@org.jetbrains.annotations.NotNull() + Function2, CDE> p0) { + } + + public final void setJ(@org.jetbrains.annotations.NotNull() + Function0 p0) { + } + + public final void setK(@org.jetbrains.annotations.NotNull() + Function2, CDE> p0) { + } + + public final void setL(@org.jetbrains.annotations.NotNull() + ABC.BCD.EFG p0) { + } + + public final void setNested(@org.jetbrains.annotations.NotNull() + ABC p0) { + } + + public final void setO10(@org.jetbrains.annotations.NotNull() + java.util.List>>>>>>>> p0) { + } + + public final void setO11(@org.jetbrains.annotations.NotNull() + java.util.List>>>>>>>>> p0) { + } + + public final void setP(@org.jetbrains.annotations.NotNull() + java.util.Calendar.Builder p0) { } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/nonExistentClassWIthoutCorrection.txt b/plugins/kapt3/kapt3-compiler/testData/converter/nonExistentClassWIthoutCorrection.txt index b3e1e450e83..0d7b08151a8 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/nonExistentClassWIthoutCorrection.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/nonExistentClassWIthoutCorrection.txt @@ -12,22 +12,39 @@ import java.lang.System; @kotlin.Metadata() public final class NonExistentType { + @org.jetbrains.annotations.NotNull() + public static final NonExistentType INSTANCE = null; @org.jetbrains.annotations.Nullable() private static final error.NonExistentClass a = null; @org.jetbrains.annotations.Nullable() private static final java.util.List b = null; @org.jetbrains.annotations.NotNull() private static final kotlin.jvm.functions.Function1 c = null; - @org.jetbrains.annotations.Nullable() - private static final error.NonExistentClass d = null; - public static java.lang.String string2; public static error.NonExistentClass coocoo; public static error.NonExistentClass coocoo2; public static error.NonExistentClass coocoo21; public static error.NonExistentClass coocoo3; public static error.NonExistentClass coocoo31; + @org.jetbrains.annotations.Nullable() + private static final error.NonExistentClass d = null; + public static java.lang.String string2; + + private NonExistentType() { + super(); + } + @org.jetbrains.annotations.NotNull() - public static final NonExistentType INSTANCE = null; + public final error.NonExistentClass a(@org.jetbrains.annotations.NotNull() + error.NonExistentClass a, @org.jetbrains.annotations.NotNull() + java.lang.String s) { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final error.NonExistentClass b(@org.jetbrains.annotations.NotNull() + java.lang.String s) { + return null; + } @org.jetbrains.annotations.Nullable() public final error.NonExistentClass getA() { @@ -44,6 +61,31 @@ public final class NonExistentType { return null; } + @org.jetbrains.annotations.NotNull() + public final error.NonExistentClass getCoocoo() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final error.NonExistentClass getCoocoo2() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final error.NonExistentClass getCoocoo21() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final error.NonExistentClass getCoocoo3() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final error.NonExistentClass getCoocoo31() { + return null; + } + @org.jetbrains.annotations.Nullable() public final error.NonExistentClass getD() { return null; @@ -54,70 +96,28 @@ public final class NonExistentType { return null; } - public final void setString2(@org.jetbrains.annotations.NotNull() - java.lang.String p0) { - } - - @org.jetbrains.annotations.NotNull() - public final error.NonExistentClass getCoocoo() { - return null; - } - public final void setCoocoo(@org.jetbrains.annotations.NotNull() error.NonExistentClass p0) { } - @org.jetbrains.annotations.NotNull() - public final error.NonExistentClass getCoocoo2() { - return null; - } - public final void setCoocoo2(@org.jetbrains.annotations.NotNull() error.NonExistentClass p0) { } - @org.jetbrains.annotations.NotNull() - public final error.NonExistentClass getCoocoo21() { - return null; - } - public final void setCoocoo21(@org.jetbrains.annotations.NotNull() error.NonExistentClass p0) { } - @org.jetbrains.annotations.NotNull() - public final error.NonExistentClass getCoocoo3() { - return null; - } - public final void setCoocoo3(@org.jetbrains.annotations.NotNull() error.NonExistentClass p0) { } - @org.jetbrains.annotations.NotNull() - public final error.NonExistentClass getCoocoo31() { - return null; - } - public final void setCoocoo31(@org.jetbrains.annotations.NotNull() error.NonExistentClass p0) { } - @org.jetbrains.annotations.NotNull() - public final error.NonExistentClass a(@org.jetbrains.annotations.NotNull() - error.NonExistentClass a, @org.jetbrains.annotations.NotNull() - java.lang.String s) { - return null; - } - - @org.jetbrains.annotations.NotNull() - public final error.NonExistentClass b(@org.jetbrains.annotations.NotNull() - java.lang.String s) { - return null; - } - - private NonExistentType() { - super(); + public final void setString2(@org.jetbrains.annotations.NotNull() + java.lang.String p0) { } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/primitiveTypes.txt b/plugins/kapt3/kapt3-compiler/testData/converter/primitiveTypes.txt index d662b8fdabc..115e31a3585 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/primitiveTypes.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/primitiveTypes.txt @@ -2,57 +2,45 @@ import java.lang.System; @kotlin.Metadata() public final class PrimitiveTypes { + @org.jetbrains.annotations.NotNull() + public static final PrimitiveTypes INSTANCE = null; public static final boolean booleanFalse = false; public static final boolean booleanTrue = true; - public static final int int0 = 0; - public static final int intMinus1000 = -1000; - public static final int intMinValue = -2147483648; - public static final int intMaxValue = 2147483647; - public static final int intHex = -1; public static final byte byte0 = (byte)0; public static final byte byte50 = (byte)50; - public static final short short5 = (short)5; - public static final char charC = 'C'; public static final char char0 = '\u0000'; public static final char char10 = '\n'; public static final char char13 = '\r'; - public static final long long0 = 0L; - public static final long longMaxValue = 9223372036854775807L; - public static final long longMinValue = -9223372036854775808L; - public static final long longHex = 4294967295L; - public static final float float54 = 5.4F; - private static final float floatMaxValue = 3.4028235E38F; - private static final float floatNan = 0.0F / 0.0F; - private static final float floatPositiveInfinity = 1.0F / 0.0F; - private static final float floatNegativeInfinity = -1.0F / 0.0F; + public static final char charC = 'C'; public static final double double54 = 5.4; private static final double doubleMaxValue = 1.7976931348623157E308; private static final double doubleNan = 0.0 / 0.0; - private static final double doublePositiveInfinity = 1.0 / 0.0; private static final double doubleNegativeInfinity = -1.0 / 0.0; + private static final double doublePositiveInfinity = 1.0 / 0.0; + public static final float float54 = 5.4F; + private static final float floatMaxValue = 3.4028235E38F; + private static final float floatNan = 0.0F / 0.0F; + private static final float floatNegativeInfinity = -1.0F / 0.0F; + private static final float floatPositiveInfinity = 1.0F / 0.0F; + public static final int int0 = 0; + public static final int intHex = -1; + public static final int intMaxValue = 2147483647; + public static final int intMinValue = -2147483648; + public static final int intMinus1000 = -1000; + public static final long long0 = 0L; + public static final long longHex = 4294967295L; + public static final long longMaxValue = 9223372036854775807L; + public static final long longMinValue = -9223372036854775808L; + public static final short short5 = (short)5; @org.jetbrains.annotations.NotNull() public static final java.lang.String stringHelloWorld = "Hello, world!"; @org.jetbrains.annotations.NotNull() public static final java.lang.String stringQuotes = "quotes \" \'\'quotes"; @org.jetbrains.annotations.NotNull() public static final java.lang.String stringRN = "\r\n"; - @org.jetbrains.annotations.NotNull() - public static final PrimitiveTypes INSTANCE = null; - public final float getFloatMaxValue() { - return 0.0F; - } - - public final float getFloatNan() { - return 0.0F; - } - - public final float getFloatPositiveInfinity() { - return 0.0F; - } - - public final float getFloatNegativeInfinity() { - return 0.0F; + private PrimitiveTypes() { + super(); } public final double getDoubleMaxValue() { @@ -63,15 +51,27 @@ public final class PrimitiveTypes { return 0.0; } - public final double getDoublePositiveInfinity() { - return 0.0; - } - public final double getDoubleNegativeInfinity() { return 0.0; } - private PrimitiveTypes() { - super(); + public final double getDoublePositiveInfinity() { + return 0.0; + } + + public final float getFloatMaxValue() { + return 0.0F; + } + + public final float getFloatNan() { + return 0.0F; + } + + public final float getFloatNegativeInfinity() { + return 0.0F; + } + + public final float getFloatPositiveInfinity() { + return 0.0F; } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/propertyAnnotations.txt b/plugins/kapt3/kapt3-compiler/testData/converter/propertyAnnotations.txt index 4452a93f9e6..be5c8274a2a 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/propertyAnnotations.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/propertyAnnotations.txt @@ -27,10 +27,8 @@ public final class Test { @org.jetbrains.annotations.NotNull() private final java.lang.String prop = "A"; - @Anno2() - @Anno() - @java.lang.Deprecated() - public static void getProp$annotations() { + public Test() { + super(); } @org.jetbrains.annotations.NotNull() @@ -38,7 +36,9 @@ public final class Test { return null; } - public Test() { - super(); + @Anno2() + @Anno() + @java.lang.Deprecated() + public static void getProp$annotations() { } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/recentlyNullable.txt b/plugins/kapt3/kapt3-compiler/testData/converter/recentlyNullable.txt index 60e2db544c7..ee22f8c5c73 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/recentlyNullable.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/recentlyNullable.txt @@ -28,11 +28,6 @@ public final class KBox implements androidx.annotation.Box { @org.jetbrains.annotations.NotNull() private final androidx.annotation.Box delegate = null; - @org.jetbrains.annotations.NotNull() - public final androidx.annotation.Box getDelegate() { - return null; - } - public KBox(@org.jetbrains.annotations.NotNull() androidx.annotation.Box delegate) { super(); @@ -43,4 +38,9 @@ public final class KBox implements androidx.annotation.Box { public java.lang.String foo() { return null; } + + @org.jetbrains.annotations.NotNull() + public final androidx.annotation.Box getDelegate() { + return null; + } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/repeatableAnnotations.txt b/plugins/kapt3/kapt3-compiler/testData/converter/repeatableAnnotations.txt index 75af5872492..b7aad884ada 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/repeatableAnnotations.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/repeatableAnnotations.txt @@ -4,9 +4,9 @@ import java.lang.System; @java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME) public abstract @interface AnnoArray { - public abstract int x(); - public abstract java.lang.String[] a(); + + public abstract int x(); } //////////////////// @@ -18,9 +18,9 @@ import java.lang.System; @java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME) public abstract @interface AnnoBoolean { - public abstract int x(); - public abstract boolean bool(); + + public abstract int x(); } //////////////////// @@ -32,9 +32,9 @@ import java.lang.System; @java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME) public abstract @interface AnnoChar { - public abstract int x(); - public abstract char chr(); + + public abstract int x(); } //////////////////// @@ -46,9 +46,9 @@ import java.lang.System; @java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME) public abstract @interface AnnoClass { - public abstract int x(); - public abstract java.lang.Class c(); + + public abstract int x(); } //////////////////// @@ -60,9 +60,9 @@ import java.lang.System; @java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME) public abstract @interface AnnoDouble { - public abstract int x(); - public abstract double dbl(); + + public abstract int x(); } //////////////////// @@ -74,9 +74,9 @@ import java.lang.System; @java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME) public abstract @interface AnnoEnum { - public abstract int x(); - public abstract Color c(); + + public abstract int x(); } //////////////////// @@ -88,9 +88,9 @@ import java.lang.System; @java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME) public abstract @interface AnnoFloat { - public abstract int x(); - public abstract float flt(); + + public abstract int x(); } //////////////////// @@ -102,9 +102,9 @@ import java.lang.System; @java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME) public abstract @interface AnnoInt { - public abstract int x(); - public abstract int i(); + + public abstract int x(); } //////////////////// @@ -116,9 +116,9 @@ import java.lang.System; @java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME) public abstract @interface AnnoIntArray { - public abstract int x(); - public abstract int[] b(); + + public abstract int x(); } //////////////////// @@ -130,9 +130,9 @@ import java.lang.System; @java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME) public abstract @interface AnnoLong { - public abstract int x(); - public abstract long l(); + + public abstract int x(); } //////////////////// @@ -144,9 +144,9 @@ import java.lang.System; @java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME) public abstract @interface AnnoLongArray { - public abstract int x(); - public abstract long[] b(); + + public abstract int x(); } //////////////////// @@ -158,9 +158,9 @@ import java.lang.System; @java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME) public abstract @interface AnnoString { - public abstract int x(); - public abstract java.lang.String s(); + + public abstract int x(); } //////////////////// @@ -186,11 +186,8 @@ public final class Test { @org.jetbrains.annotations.NotNull() private final java.lang.String value = ""; - @lib.Anno(value = "3", construct = {"C"}) - @lib.Anno(value = "2", construct = {"A", "B"}) - @lib.Anno(value = "1") - @java.lang.Deprecated() - public static void getValue$annotations() { + public Test() { + super(); } @org.jetbrains.annotations.NotNull() @@ -198,8 +195,11 @@ public final class Test { return null; } - public Test() { - super(); + @lib.Anno(value = "3", construct = {"C"}) + @lib.Anno(value = "2", construct = {"A", "B"}) + @lib.Anno(value = "1") + @java.lang.Deprecated() + public static void getValue$annotations() { } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/secondaryConstructor.txt b/plugins/kapt3/kapt3-compiler/testData/converter/secondaryConstructor.txt index b032273355c..e529d512125 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/secondaryConstructor.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/secondaryConstructor.txt @@ -20,6 +20,11 @@ public final class Product2 implements secondary.Named { @org.jetbrains.annotations.Nullable() private java.lang.String name; + public Product2(@org.jetbrains.annotations.NotNull() + java.lang.String otherName) { + super(); + } + @org.jetbrains.annotations.Nullable() @java.lang.Override() public java.lang.String getName() { @@ -29,9 +34,4 @@ public final class Product2 implements secondary.Named { public void setName(@org.jetbrains.annotations.Nullable() java.lang.String p0) { } - - public Product2(@org.jetbrains.annotations.NotNull() - java.lang.String otherName) { - super(); - } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/strangeIdentifiers.txt b/plugins/kapt3/kapt3-compiler/testData/converter/strangeIdentifiers.txt index eac1a965387..9bd625193c6 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/strangeIdentifiers.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/strangeIdentifiers.txt @@ -4,9 +4,9 @@ import java.lang.System; @java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME) public abstract @interface Anno { - public abstract StrangeEnum size(); - public abstract java.lang.String name(); + + public abstract StrangeEnum size(); } //////////////////// @@ -20,13 +20,13 @@ public enum StrangeEnum { @org.jetbrains.annotations.NotNull() private final java.lang.String size = null; + StrangeEnum(java.lang.String size) { + } + @org.jetbrains.annotations.NotNull() public final java.lang.String getSize() { return null; } - - StrangeEnum(java.lang.String size) { - } } //////////////////// @@ -38,6 +38,10 @@ import java.lang.System; public final class Test { public java.lang.String simpleName; + public Test() { + super(); + } + @org.jetbrains.annotations.NotNull() public final java.lang.String getSimpleName() { return null; @@ -56,8 +60,4 @@ public final class Test { java.lang.String a, @org.jetbrains.annotations.NotNull() java.lang.String p1_949560896) { } - - public Test() { - super(); - } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/stripMetadata.txt b/plugins/kapt3/kapt3-compiler/testData/converter/stripMetadata.txt index 030ac7a8089..cebb5bd4334 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/stripMetadata.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/stripMetadata.txt @@ -2,13 +2,13 @@ import java.lang.System; public abstract class BaseClass { - @org.jetbrains.annotations.NotNull() - public abstract Result doJob(); - public BaseClass(@org.jetbrains.annotations.NotNull() Context context, int num, boolean bool) { super(); } + + @org.jetbrains.annotations.NotNull() + public abstract Result doJob(); } //////////////////// @@ -26,16 +26,16 @@ import java.lang.System; public final class Inheritor extends BaseClass { + public Inheritor(@org.jetbrains.annotations.NotNull() + Context context) { + super(null, 0, false); + } + @org.jetbrains.annotations.NotNull() @java.lang.Override() public Result doJob() { return null; } - - public Inheritor(@org.jetbrains.annotations.NotNull() - Context context) { - super(null, 0, false); - } } //////////////////// diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/suspendErrorTypes.txt b/plugins/kapt3/kapt3-compiler/testData/converter/suspendErrorTypes.txt index 6eab8beba61..7a89cb4c587 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/suspendErrorTypes.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/suspendErrorTypes.txt @@ -3,13 +3,13 @@ import java.lang.System; @kotlin.Metadata() public final class Foo { + public Foo() { + super(); + } + @org.jetbrains.annotations.Nullable() public final java.lang.Object a(@org.jetbrains.annotations.NotNull() kotlin.coroutines.Continuation p0) { return null; } - - public Foo() { - super(); - } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/topLevel.txt b/plugins/kapt3/kapt3-compiler/testData/converter/topLevel.txt index b1ab9c7f33d..55c3a2b3e6c 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/topLevel.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/topLevel.txt @@ -21,17 +21,28 @@ public final class TopLevelKt { public TopLevelKt() { super(); } - private static final int topLevelProperty = 2; public static final int topLevelConstProperty = 2; + private static final int topLevelProperty = 2; - @org.jetbrains.annotations.Nullable() - public static final java.lang.String topLevelFunction() { + public static final void extensionFunction(@org.jetbrains.annotations.NotNull() + @Anno(value = "rec") + java.lang.String $this$extensionFunction, @org.jetbrains.annotations.NotNull() + @Anno(value = "1") + java.lang.String a, @org.jetbrains.annotations.NotNull() + @Anno(value = "2") + java.lang.String b) { + } + + @org.jetbrains.annotations.NotNull() + public static final java.lang.String getExtensionProperty(@org.jetbrains.annotations.NotNull() + @Anno(value = "propRec") + T $this$extensionProperty) { return null; } - @org.jetbrains.annotations.Nullable() - public static final >T topLevelGenericFunction() { - return null; + @Anno(value = "extpr") + @java.lang.Deprecated() + public static void getExtensionProperty$annotations(java.lang.Object p0) { } public static final int getTopLevelProperty() { @@ -43,31 +54,20 @@ public final class TopLevelKt { return null; } - public static final void extensionFunction(@org.jetbrains.annotations.NotNull() - @Anno(value = "rec") - java.lang.String $this$extensionFunction, @org.jetbrains.annotations.NotNull() - @Anno(value = "1") - java.lang.String a, @org.jetbrains.annotations.NotNull() - @Anno(value = "2") - java.lang.String b) { - } - - @Anno(value = "extpr") - @java.lang.Deprecated() - public static void getExtensionProperty$annotations(java.lang.Object p0) { - } - - @org.jetbrains.annotations.NotNull() - public static final java.lang.String getExtensionProperty(@org.jetbrains.annotations.NotNull() - @Anno(value = "propRec") - T $this$extensionProperty) { - return null; - } - public static final void setExtensionProperty(@org.jetbrains.annotations.NotNull() @Anno(value = "propRec") T $this$extensionProperty, @org.jetbrains.annotations.NotNull() @Anno(value = "setparam") java.lang.String setParamName) { } + + @org.jetbrains.annotations.Nullable() + public static final java.lang.String topLevelFunction() { + return null; + } + + @org.jetbrains.annotations.Nullable() + public static final >T topLevelGenericFunction() { + return null; + } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/unsafePropertyInitializers.txt b/plugins/kapt3/kapt3-compiler/testData/converter/unsafePropertyInitializers.txt index b929d8e55a1..2643916a4ab 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/unsafePropertyInitializers.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/unsafePropertyInitializers.txt @@ -2,14 +2,13 @@ import java.lang.System; @kotlin.Metadata() public final class Boo { - @org.jetbrains.annotations.NotNull() - private static final java.lang.String z = null; @org.jetbrains.annotations.NotNull() public static final Boo INSTANCE = null; - @org.jetbrains.annotations.NotNull() - public final java.lang.String getZ() { - return null; + private static final java.lang.String z = null; + + private Boo() { + super(); } @org.jetbrains.annotations.NotNull() @@ -17,8 +16,9 @@ public final class Boo { return null; } - private Boo() { - super(); + @org.jetbrains.annotations.NotNull() + public final java.lang.String getZ() { + return null; } } @@ -30,15 +30,17 @@ import java.lang.System; @kotlin.Metadata() public final class Foo { @org.jetbrains.annotations.NotNull() - public static final java.lang.String aString = "foo"; + public static final Foo INSTANCE = null; public static final int aInt = 3; @org.jetbrains.annotations.NotNull() - private static final java.lang.String bString = "bar"; + public static final java.lang.String aString = "foo"; private static final int bInt = 5; @org.jetbrains.annotations.NotNull() - private static java.lang.String cString = "baz"; + private static final java.lang.String bString = "bar"; private static int cInt = 7; @org.jetbrains.annotations.NotNull() + private static java.lang.String cString = "baz"; + @org.jetbrains.annotations.NotNull() private static final java.lang.String d = null; private static final int e = 0; private static final int f = 8; @@ -50,12 +52,9 @@ public final class Foo { private static final java.lang.String j = null; @org.jetbrains.annotations.NotNull() private static final java.lang.String k = null; - @org.jetbrains.annotations.NotNull() - public static final Foo INSTANCE = null; - @org.jetbrains.annotations.NotNull() - public final java.lang.String getBString() { - return null; + private Foo() { + super(); } public final int getBInt() { @@ -63,19 +62,17 @@ public final class Foo { } @org.jetbrains.annotations.NotNull() - public final java.lang.String getCString() { + public final java.lang.String getBString() { return null; } - public final void setCString(@org.jetbrains.annotations.NotNull() - java.lang.String p0) { - } - public final int getCInt() { return 0; } - public final void setCInt(int p0) { + @org.jetbrains.annotations.NotNull() + public final java.lang.String getCString() { + return null; } @org.jetbrains.annotations.NotNull() @@ -114,8 +111,11 @@ public final class Foo { return null; } - private Foo() { - super(); + public final void setCInt(int p0) { + } + + public final void setCString(@org.jetbrains.annotations.NotNull() + java.lang.String p0) { } } @@ -126,6 +126,18 @@ import java.lang.System; @kotlin.Metadata() public final class HavingState { + @org.jetbrains.annotations.NotNull() + private final kotlin.reflect.KClass anonymous = null; + @org.jetbrains.annotations.NotNull() + private final kotlin.reflect.KClass clazz = null; + @org.jetbrains.annotations.NotNull() + private final float[] floatArray = {-1.0F}; + @org.jetbrains.annotations.NotNull() + private final java.lang.Integer[] intArray = {1}; + @org.jetbrains.annotations.NotNull() + private final java.util.List intList = null; + @org.jetbrains.annotations.NotNull() + private final java.lang.Class javaClass = null; @org.jetbrains.annotations.NotNull() private final State state = State.START; @org.jetbrains.annotations.NotNull() @@ -134,23 +146,45 @@ public final class HavingState { private final java.lang.String[] stringArray = {"foo"}; @org.jetbrains.annotations.NotNull() private final java.util.List stringList = null; - @org.jetbrains.annotations.NotNull() - private final java.lang.Integer[] intArray = {1}; - @org.jetbrains.annotations.NotNull() - private final float[] floatArray = {-1.0F}; - @org.jetbrains.annotations.NotNull() - private final java.util.List intList = null; private final int uint = 1; @org.jetbrains.annotations.NotNull() private final kotlin.UInt[] uintArray = {1}; @org.jetbrains.annotations.NotNull() private final java.util.List uintList = null; + + public HavingState() { + super(); + } + @org.jetbrains.annotations.NotNull() - private final kotlin.reflect.KClass clazz = null; + public final kotlin.reflect.KClass getAnonymous() { + return null; + } + @org.jetbrains.annotations.NotNull() - private final java.lang.Class javaClass = null; + public final kotlin.reflect.KClass getClazz() { + return null; + } + @org.jetbrains.annotations.NotNull() - private final kotlin.reflect.KClass anonymous = null; + public final float[] getFloatArray() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.lang.Integer[] getIntArray() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.util.List getIntList() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.lang.Class getJavaClass() { + return null; + } @org.jetbrains.annotations.NotNull() public final State getState() { @@ -172,21 +206,6 @@ public final class HavingState { return null; } - @org.jetbrains.annotations.NotNull() - public final java.lang.Integer[] getIntArray() { - return null; - } - - @org.jetbrains.annotations.NotNull() - public final float[] getFloatArray() { - return null; - } - - @org.jetbrains.annotations.NotNull() - public final java.util.List getIntList() { - return null; - } - @org.jetbrains.annotations.NotNull() public final kotlin.UInt[] getUintArray() { return null; @@ -196,25 +215,6 @@ public final class HavingState { public final java.util.List getUintList() { return null; } - - @org.jetbrains.annotations.NotNull() - public final kotlin.reflect.KClass getClazz() { - return null; - } - - @org.jetbrains.annotations.NotNull() - public final java.lang.Class getJavaClass() { - return null; - } - - @org.jetbrains.annotations.NotNull() - public final kotlin.reflect.KClass getAnonymous() { - return null; - } - - public HavingState() { - super(); - } } //////////////////// diff --git a/plugins/kapt3/kapt3-compiler/testData/kotlinRunner/DefaultParameterValues.it.txt b/plugins/kapt3/kapt3-compiler/testData/kotlinRunner/DefaultParameterValues.it.txt index 17ea210a959..25db5a27ae6 100644 --- a/plugins/kapt3/kapt3-compiler/testData/kotlinRunner/DefaultParameterValues.it.txt +++ b/plugins/kapt3/kapt3-compiler/testData/kotlinRunner/DefaultParameterValues.it.txt @@ -26,9 +26,8 @@ public final class User { @org.jetbrains.annotations.NotNull() private final java.lang.String name = "John"; - @org.jetbrains.annotations.NotNull() - public final java.lang.String getName() { - return null; + public User() { + super(); } public User(@org.jetbrains.annotations.NotNull() @@ -36,7 +35,8 @@ public final class User { super(); } - public User() { - super(); + @org.jetbrains.annotations.NotNull() + public final java.lang.String getName() { + return null; } } diff --git a/plugins/kapt3/kapt3-compiler/testData/kotlinRunner/NestedClasses.it.txt b/plugins/kapt3/kapt3-compiler/testData/kotlinRunner/NestedClasses.it.txt index f4f708a7577..ba17fd805b6 100644 --- a/plugins/kapt3/kapt3-compiler/testData/kotlinRunner/NestedClasses.it.txt +++ b/plugins/kapt3/kapt3-compiler/testData/kotlinRunner/NestedClasses.it.txt @@ -25,14 +25,14 @@ public final class Simple { @org.jetbrains.annotations.NotNull() public static final test.Simple.Companion Companion = null; - @MyAnnotation() - public final void myMethod() { - } - public Simple() { super(); } + @MyAnnotation() + public final void myMethod() { + } + @kotlin.Metadata() public static final class NestedClass { diff --git a/plugins/kapt3/kapt3-compiler/testData/kotlinRunner/Overloads.it.txt b/plugins/kapt3/kapt3-compiler/testData/kotlinRunner/Overloads.it.txt index 9fb0cd3bbc5..4ad07e8b2c4 100644 --- a/plugins/kapt3/kapt3-compiler/testData/kotlinRunner/Overloads.it.txt +++ b/plugins/kapt3/kapt3-compiler/testData/kotlinRunner/Overloads.it.txt @@ -28,6 +28,15 @@ public final class State { @org.jetbrains.annotations.NotNull() private final java.lang.String someString = null; + public State(int someInt, long someLong) { + super(); + } + + public State(int someInt, long someLong, @org.jetbrains.annotations.NotNull() + java.lang.String someString) { + super(); + } + public final int getSomeInt() { return 0; } @@ -40,13 +49,4 @@ public final class State { public final java.lang.String getSomeString() { return null; } - - public State(int someInt, long someLong, @org.jetbrains.annotations.NotNull() - java.lang.String someString) { - super(); - } - - public State(int someInt, long someLong) { - super(); - } } diff --git a/plugins/kapt3/kapt3-compiler/testData/kotlinRunner/Simple.it.txt b/plugins/kapt3/kapt3-compiler/testData/kotlinRunner/Simple.it.txt index ce4fd90be1b..43c3e12f4ba 100644 --- a/plugins/kapt3/kapt3-compiler/testData/kotlinRunner/Simple.it.txt +++ b/plugins/kapt3/kapt3-compiler/testData/kotlinRunner/Simple.it.txt @@ -16,16 +16,16 @@ import java.lang.System; @kotlin.Metadata() public final class Simple { - @MyAnnotation() - public final void myMethod() { + public Simple() { + super(); } public final int heavyMethod() { return 0; } - public Simple() { - super(); + @MyAnnotation() + public final void myMethod() { } } From 52c22d891f9a1f940297e15d72cefbdb52db21fe Mon Sep 17 00:00:00 2001 From: Bingran Date: Wed, 28 Oct 2020 17:27:03 +0000 Subject: [PATCH 119/698] MPP plugin: add expectedBy deps to "api" configuration Currently, KotlinPlatformJvmPlugin and KotlinPlatformJsPlugin are adding expectedBy deps to "compile" configuration which is deprecated by Gradle. This PR fixes that by replacing "compile" with "api" which is what we are doing in KotlinPlatformAndroidPlugin. This PR also makes integration tests running with warning-mode=fail by default and fixes most of the integration tests. For the remaining tests to be fixed, we make them run with warning-mode=summary and will fix them incrementally in following PRs. --- .../jetbrains/kotlin/gradle/BaseGradleIT.kt | 19 +++++++++++++++++- .../kotlin/gradle/BuildCacheRelocationIT.kt | 20 ++++++++++++------- .../gradle/ConfigurationCacheForAndroidIT.kt | 4 +++- .../kotlin/gradle/Kotlin2JsGradlePluginIT.kt | 11 ++++++++++ .../kotlin/gradle/KotlinGradlePluginIT.kt | 11 +++++++--- .../kotlin/gradle/MultiplatformGradleIT.kt | 2 +- .../kotlin/gradle/NewMultiplatformIT.kt | 5 +++++ .../gradle/VariantAwareDependenciesIT.kt | 5 +++++ .../kotlin/gradle/native/GeneralNativeIT.kt | 5 +++++ .../Project Path With Spaces/build.gradle | 6 +++--- .../testProject/buildCacheSimple/build.gradle | 2 +- .../testProject/classpathTest/build.gradle | 6 +++--- .../convertBetweenJavaAndKotlin/build.gradle | 2 +- .../customCompilerFile/build.gradle | 4 ++-- .../instantExecution/lib-project/build.gradle | 2 +- .../main-project/src/build.gradle | 4 ++-- .../instantExecutionToJs/build.gradle | 6 +++--- .../testProject/internalTest/build.gradle | 4 ++-- .../javaLibraryProject/app/build.gradle | 4 ++-- .../javaPackagePrefix/build.gradle | 2 +- .../testProject/jvmTarget/build.gradle | 2 +- .../kapt2/kaptAvoidance/app/build.gradle | 6 +++--- .../kapt2/kaptAvoidance/lib/build.gradle | 2 +- .../testProject/kapt2/simple/build.gradle | 6 +++--- .../libraryProject/build.gradle | 2 +- .../mainProject/build.gradle | 6 +++--- .../kotlin2JsNoOutputFileProject/build.gradle | 2 +- .../kotlinBuiltins/app/build.gradle | 2 +- .../testProject/kotlinInJavaRoot/build.gradle | 6 +++--- .../kotlinJavaProject/build.gradle | 10 +++++----- .../testProject/kotlinProject/build.gradle | 6 +++--- .../buildSrc/build.gradle | 2 +- .../testProject/kt-29971/jvm-app/build.gradle | 2 +- .../testProject/manyClasses/build.gradle | 2 +- .../moveClassToOtherModule/app/build.gradle | 4 ++-- .../moveClassToOtherModule/lib/build.gradle | 2 +- .../multiplatformProject/libJvm/build.gradle | 4 ++-- .../subproject/build.gradle | 6 +++--- .../projA/build.gradle | 2 +- .../projB/build.gradle | 4 ++-- .../app-common/build.gradle | 2 +- .../sample-old-style-app/app-js/build.gradle | 2 +- .../sample-old-style-app/app-jvm/build.gradle | 2 +- .../pluginsDsl/allopenPluginsDsl/build.gradle | 4 ++-- .../testProject/simpleProject/build.gradle | 10 +++++----- .../testProject/typeAlias/build.gradle | 2 +- .../plugin/KotlinMultiplatformPlugin.kt | 6 +----- 47 files changed, 141 insertions(+), 89 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/BaseGradleIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/BaseGradleIT.kt index e0364c9b69c..3ed8a1e226e 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/BaseGradleIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/BaseGradleIT.kt @@ -153,6 +153,20 @@ abstract class BaseGradleIT { return wrapper } + fun mightUpdateSettingsScript(wrapperVersion: String, settingsScript: File) { + // enableFeaturePreview("GRADLE_METADATA") is no longer needed when building with Gradle 5.4 or above + if (GradleVersion.version(wrapperVersion) > GradleVersion.version("5.3")) { + settingsScript.apply { + if(exists()) { + modify { + it.replace("enableFeaturePreview('GRADLE_METADATA')", "//") + it.replace("enableFeaturePreview(\"GRADLE_METADATA\")", "//") + } + } + } + } + } + private fun createNewWrapperDir(version: String): File = createTempDir("GradleWrapper-$version-") .apply { @@ -215,7 +229,7 @@ abstract class BaseGradleIT { val jsCompilerType: KotlinJsCompilerType? = null, val configurationCache: Boolean = false, val configurationCacheProblems: ConfigurationCacheProblems = ConfigurationCacheProblems.FAIL, - val warningMode: WarningMode = WarningMode.Summary + val warningMode: WarningMode = WarningMode.Fail ) enum class ConfigurationCacheProblems { @@ -321,6 +335,9 @@ abstract class BaseGradleIT { val env = createEnvironmentVariablesMap(options) val wrapperDir = prepareWrapper(wrapperVersion, env) + + mightUpdateSettingsScript(wrapperVersion, gradleSettingsScript()) + val cmd = createBuildCommand(wrapperDir, params, options) println("<=== Test build: ${this.projectName} $cmd ===>") diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/BuildCacheRelocationIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/BuildCacheRelocationIT.kt index 4e263436db6..4a5f06b3ea6 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/BuildCacheRelocationIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/BuildCacheRelocationIT.kt @@ -37,7 +37,6 @@ class BuildCacheRelocationIT : BaseGradleIT() { override fun defaultBuildOptions(): BuildOptions = super.defaultBuildOptions().copy( withBuildCache = true, - androidGradlePluginVersion = AGPVersion.v3_6_0, androidHome = KotlinTestUtils.findAndroidSdk() ) @@ -65,7 +64,10 @@ class BuildCacheRelocationIT : BaseGradleIT() { lateinit var firstOutputHashes: List> workingDir = workingDirs[0] - firstProject.build(*testCase.taskToExecute) { + firstProject.build( + *testCase.taskToExecute, + options = defaultBuildOptions().copy(androidGradlePluginVersion = testCase.androidGradlePluginVersion) + ) { assertSuccessful() firstOutputHashes = hashOutputFiles(outputRoots) cacheableTaskNames.forEach { assertTaskPackedToCache(":$it") } @@ -74,9 +76,10 @@ class BuildCacheRelocationIT : BaseGradleIT() { workingDir = workingDirs[1] val alternateBuildEnvOptions = if (withAnotherGradleHome) { val alternateGradleHome = File(firstProject.projectDir.parentFile, "gradleUserHome") - defaultBuildOptions().copy(gradleUserHome = alternateGradleHome) + defaultBuildOptions().copy( + gradleUserHome = alternateGradleHome, androidGradlePluginVersion = testCase.androidGradlePluginVersion) } else { - defaultBuildOptions() + defaultBuildOptions().copy(androidGradlePluginVersion = testCase.androidGradlePluginVersion) } secondProject.build(*testCase.taskToExecute, options = alternateBuildEnvOptions) { assertSuccessful() @@ -98,7 +101,8 @@ class BuildCacheRelocationIT : BaseGradleIT() { val initProject: Project.() -> Unit = {}, val taskToExecute: Array, val withAnotherGradleHome: Boolean = false, - val gradleVersionRequired: GradleVersionRequired = DEFAULT_GRADLE_VERSION + val gradleVersionRequired: GradleVersionRequired = DEFAULT_GRADLE_VERSION, + val androidGradlePluginVersion: AGPVersion? = null ) { override fun toString(): String = (projectDirectoryPrefix?.plus("/") ?: "") + projectName @@ -157,7 +161,8 @@ class BuildCacheRelocationIT : BaseGradleIT() { } } }, - outputRootPaths = listOf("Lib", "Android", "Test").map { "$it/build" } + outputRootPaths = listOf("Lib", "Android", "Test").map { "$it/build" }, + androidGradlePluginVersion = AGPVersion.v3_6_0 ), TestCase("android-dagger", taskToExecute = arrayOf("assembleDebug"), @@ -168,7 +173,8 @@ class BuildCacheRelocationIT : BaseGradleIT() { } }, outputRootPaths = listOf("app/build"), - initProject = { File(projectDir, "app/build.gradle").appendText("\nkapt.useBuildCache = true") } + initProject = { File(projectDir, "app/build.gradle").appendText("\nkapt.useBuildCache = true") }, + androidGradlePluginVersion = AGPVersion.v3_6_0 ), TestCase("native-build-cache", taskToExecute = arrayOf("build-cache-lib:publish", "build-cache-app:assemble"), diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ConfigurationCacheForAndroidIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ConfigurationCacheForAndroidIT.kt index 5192dd623b0..f65b3335427 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ConfigurationCacheForAndroidIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ConfigurationCacheForAndroidIT.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.gradle +import org.gradle.api.logging.configuration.WarningMode import org.jetbrains.kotlin.gradle.util.AGPVersion import org.jetbrains.kotlin.test.KotlinTestUtils import org.junit.Test @@ -18,7 +19,8 @@ class ConfigurationCacheForAndroidIT : AbstractConfigurationCacheIT() { androidHome = KotlinTestUtils.findAndroidSdk(), androidGradlePluginVersion = androidGradlePluginVersion, configurationCache = true, - configurationCacheProblems = ConfigurationCacheProblems.FAIL + configurationCacheProblems = ConfigurationCacheProblems.FAIL, + warningMode = WarningMode.Summary ) @Test diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kotlin2JsGradlePluginIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kotlin2JsGradlePluginIT.kt index da584bc7161..d719b450e61 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kotlin2JsGradlePluginIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kotlin2JsGradlePluginIT.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.gradle import com.google.gson.Gson import org.gradle.api.logging.LogLevel +import org.gradle.api.logging.configuration.WarningMode import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType import org.jetbrains.kotlin.gradle.targets.js.ir.KLIB_TYPE import org.jetbrains.kotlin.gradle.targets.js.npm.* @@ -22,6 +23,11 @@ import kotlin.test.assertEquals import kotlin.test.assertTrue class Kotlin2JsIrGradlePluginIT : AbstractKotlin2JsGradlePluginIT(true) { + + override fun defaultBuildOptions(): BuildOptions { + return super.defaultBuildOptions().copy(warningMode = WarningMode.Summary) + } + @Test fun generateDts() { val project = Project("kotlin2JsIrDtsGeneration") @@ -116,6 +122,11 @@ class Kotlin2JsIrGradlePluginIT : AbstractKotlin2JsGradlePluginIT(true) { } class Kotlin2JsGradlePluginIT : AbstractKotlin2JsGradlePluginIT(false) { + + override fun defaultBuildOptions(): BuildOptions { + return super.defaultBuildOptions().copy(warningMode = WarningMode.Summary) + } + @Test fun testKotlinJsBuiltins() { val project = Project("kotlinBuiltins") diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KotlinGradlePluginIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KotlinGradlePluginIT.kt index a310d8aee48..50b93b37d12 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KotlinGradlePluginIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KotlinGradlePluginIT.kt @@ -17,6 +17,7 @@ package org.jetbrains.kotlin.gradle import org.gradle.api.logging.LogLevel +import org.gradle.api.logging.configuration.WarningMode import org.jetbrains.kotlin.gradle.plugin.MULTIPLE_KOTLIN_PLUGINS_LOADED_WARNING import org.jetbrains.kotlin.gradle.plugin.MULTIPLE_KOTLIN_PLUGINS_SPECIFIC_PROJECTS_WARNING import org.jetbrains.kotlin.gradle.scripting.internal.ScriptingGradleSubplugin @@ -35,6 +36,10 @@ import kotlin.test.assertTrue class KotlinGradleIT : BaseGradleIT() { + override fun defaultBuildOptions(): BuildOptions { + return super.defaultBuildOptions().copy(warningMode = WarningMode.Summary) + } + @Test fun testCrossCompile() { val project = Project("kotlinJavaProject") @@ -774,12 +779,12 @@ class KotlinGradleIT : BaseGradleIT() { with(Project("simpleProject")) { setupWorkingDir() // Add a dependency with an explicit lower Kotlin version that has a kotlin-stdlib transitive dependency: - gradleBuildScript().appendText("\ndependencies { compile 'org.jetbrains.kotlin:kotlin-reflect:1.2.71' }") + gradleBuildScript().appendText("\ndependencies { implementation 'org.jetbrains.kotlin:kotlin-reflect:1.2.71' }") testResolveAllConfigurations { assertSuccessful() - assertContains(">> :compile --> kotlin-reflect-1.2.71.jar") + assertContains(">> :compileClasspath --> kotlin-reflect-1.2.71.jar") // Check that the default newer Kotlin version still wins for 'kotlin-stdlib': - assertContains(">> :compile --> kotlin-stdlib-${defaultBuildOptions().kotlinVersion}.jar") + assertContains(">> :compileClasspath --> kotlin-stdlib-${defaultBuildOptions().kotlinVersion}.jar") } } diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/MultiplatformGradleIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/MultiplatformGradleIT.kt index 3fcfad9e16c..511348ab314 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/MultiplatformGradleIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/MultiplatformGradleIT.kt @@ -226,7 +226,7 @@ class MultiplatformGradleIT : BaseGradleIT() { ${'\n'} task printCompileConfiguration(type: DefaultTask) { doFirst { - configurations.compile.resolvedConfiguration.resolvedArtifacts.each { + configurations.getByName("api").dependencies.each { println("Dependency: '" + it.name + "'") } } diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/NewMultiplatformIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/NewMultiplatformIT.kt index 0be7879e3fc..d6c31353717 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/NewMultiplatformIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/NewMultiplatformIT.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.gradle import org.jetbrains.kotlin.gradle.native.GeneralNativeIT.Companion.checkNativeCommandLineArguments import org.jetbrains.kotlin.gradle.native.GeneralNativeIT.Companion.containsSequentially +import org.gradle.api.logging.configuration.WarningMode import org.jetbrains.kotlin.gradle.native.MPPNativeTargets import org.jetbrains.kotlin.gradle.native.configureMemoryInGradleProperties import org.jetbrains.kotlin.gradle.native.transformNativeTestProject @@ -43,6 +44,10 @@ class NewMultiplatformIT : BaseGradleIT() { private fun Project.targetClassesDir(targetName: String, sourceSetName: String = "main") = classesDir(sourceSet = "$targetName/$sourceSetName") + override fun defaultBuildOptions(): BuildOptions { + return super.defaultBuildOptions().copy(warningMode = WarningMode.Summary) + } + @Test fun testLibAndApp() = doTestLibAndApp( "sample-lib", diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/VariantAwareDependenciesIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/VariantAwareDependenciesIT.kt index 5a8904e126e..159771ba539 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/VariantAwareDependenciesIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/VariantAwareDependenciesIT.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.gradle +import org.gradle.api.logging.configuration.WarningMode import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType import org.jetbrains.kotlin.gradle.util.* import org.junit.Test @@ -13,6 +14,10 @@ import kotlin.test.assertTrue class VariantAwareDependenciesIT : BaseGradleIT() { private val gradleVersion = GradleVersionRequired.FOR_MPP_SUPPORT + override fun defaultBuildOptions(): BuildOptions { + return super.defaultBuildOptions().copy(warningMode = WarningMode.Summary) + } + @Test fun testJvmKtAppResolvesMppLib() { val outerProject = Project("sample-lib", gradleVersion, "new-mpp-lib-and-app") diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/GeneralNativeIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/GeneralNativeIT.kt index bbf0dea1eba..11b64504a84 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/GeneralNativeIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/GeneralNativeIT.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.gradle.native import com.intellij.testFramework.TestDataFile +import org.gradle.api.logging.configuration.WarningMode import org.jdom.input.SAXBuilder import org.jetbrains.kotlin.gradle.BaseGradleIT import org.jetbrains.kotlin.gradle.GradleVersionRequired @@ -93,6 +94,10 @@ class GeneralNativeIT : BaseGradleIT() { override val defaultGradleVersion: GradleVersionRequired get() = GradleVersionRequired.FOR_MPP_SUPPORT + override fun defaultBuildOptions(): BuildOptions { + return super.defaultBuildOptions().copy(warningMode = WarningMode.Summary) + } + @Test fun testParallelExecutionSmoke(): Unit = with(transformNativeTestProjectWithPluginDsl("native-parallel")) { // Check that the K/N compiler can be started in-process in parallel. diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/Project Path With Spaces/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/Project Path With Spaces/build.gradle index 2739c96398f..7d140d98fe3 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/Project Path With Spaces/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/Project Path With Spaces/build.gradle @@ -16,9 +16,9 @@ repositories { } dependencies { - compile 'com.google.guava:guava:12.0' - testCompile 'org.testng:testng:6.8' - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'com.google.guava:guava:12.0' + testImplementation 'org.testng:testng:6.8' + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } test { diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/buildCacheSimple/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/buildCacheSimple/build.gradle index 5cda9ec552d..1d23fc46979 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/buildCacheSimple/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/buildCacheSimple/build.gradle @@ -17,5 +17,5 @@ repositories { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/classpathTest/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/classpathTest/build.gradle index 025e90cf281..d2f1da10d9e 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/classpathTest/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/classpathTest/build.gradle @@ -16,9 +16,9 @@ repositories { } dependencies { - compile 'com.google.guava:guava:12.0' - testCompile 'org.testng:testng:6.8' - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'com.google.guava:guava:12.0' + testImplementation 'org.testng:testng:6.8' + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } test { diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/convertBetweenJavaAndKotlin/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/convertBetweenJavaAndKotlin/build.gradle index 90f5aca74c6..16abee31975 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/convertBetweenJavaAndKotlin/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/convertBetweenJavaAndKotlin/build.gradle @@ -17,7 +17,7 @@ repositories { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } compileJava { diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/customCompilerFile/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/customCompilerFile/build.gradle index d2c1649253d..1d8128d529b 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/customCompilerFile/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/customCompilerFile/build.gradle @@ -16,8 +16,8 @@ repositories { } dependencies { - testCompile 'junit:junit:4.12' - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + testImplementation 'junit:junit:4.12' + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } compileKotlin.compilerJarFile = project.file("compiler.jar") diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/instantExecution/lib-project/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/instantExecution/lib-project/build.gradle index ee7434e1b5d..83e41992508 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/instantExecution/lib-project/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/instantExecution/lib-project/build.gradle @@ -1,5 +1,5 @@ apply plugin: 'kotlin' dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/instantExecution/main-project/src/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/instantExecution/main-project/src/build.gradle index b3a0aaed263..17727757143 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/instantExecution/main-project/src/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/instantExecution/main-project/src/build.gradle @@ -1,6 +1,6 @@ apply plugin: 'kotlin' dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile project(':lib-project') + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation project(':lib-project') } diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/instantExecutionToJs/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/instantExecutionToJs/build.gradle index c9c914635f1..f1ce614f7ad 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/instantExecutionToJs/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/instantExecutionToJs/build.gradle @@ -16,8 +16,8 @@ repositories { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" - testCompile "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" + testImplementation "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version" } task jarSources(type: Jar) { @@ -25,7 +25,7 @@ task jarSources(type: Jar) { classifier = 'source' } artifacts { - compile jarSources + implementation jarSources } compileKotlin2Js.kotlinOptions.outputFile = "${buildDir}/kotlin2js/main/module.js" diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/internalTest/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/internalTest/build.gradle index ecd6130193e..add556d4541 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/internalTest/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/internalTest/build.gradle @@ -17,8 +17,8 @@ repositories { } dependencies { - testCompile 'org.testng:testng:6.8' - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + testImplementation 'org.testng:testng:6.8' + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } test { diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/javaLibraryProject/app/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/javaLibraryProject/app/build.gradle index 95dc2cf7ef7..4751de79db8 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/javaLibraryProject/app/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/javaLibraryProject/app/build.gradle @@ -2,6 +2,6 @@ apply plugin: 'java' apply plugin: 'kotlin' dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile project(':libB') + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation project(':libB') } \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/javaPackagePrefix/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/javaPackagePrefix/build.gradle index c00b9261bb8..44aa27fa00b 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/javaPackagePrefix/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/javaPackagePrefix/build.gradle @@ -17,7 +17,7 @@ repositories { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } compileKotlin.javaPackagePrefix = "my.pack.name" \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/jvmTarget/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/jvmTarget/build.gradle index 0c84d98a803..16bc0092a9b 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/jvmTarget/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/jvmTarget/build.gradle @@ -24,7 +24,7 @@ repositories { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } compileKotlin { diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kapt2/kaptAvoidance/app/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kapt2/kaptAvoidance/app/build.gradle index 3bd793424f7..9c3f7de4d94 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kapt2/kaptAvoidance/app/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kapt2/kaptAvoidance/app/build.gradle @@ -2,10 +2,10 @@ apply plugin: "kotlin" apply plugin: "kotlin-kapt" dependencies { - compile project(":lib") - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation project(":lib") + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version" + implementation "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version" kapt "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version" // actually unused, but kapt skips AP when annotation processing classpath is empty (see checkOptions) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kapt2/kaptAvoidance/lib/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kapt2/kaptAvoidance/lib/build.gradle index 380c6aac370..e0b0571f046 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kapt2/kaptAvoidance/lib/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kapt2/kaptAvoidance/lib/build.gradle @@ -1,5 +1,5 @@ apply plugin: "kotlin" dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kapt2/simple/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kapt2/simple/build.gradle index 4c08899f45c..ff391bc3af9 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kapt2/simple/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kapt2/simple/build.gradle @@ -18,10 +18,10 @@ repositories { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version" kapt "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version" - testCompile 'junit:junit:4.12' + testImplementation 'junit:junit:4.12' } compileKotlin.kotlinOptions.allWarningsAsErrors = true \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsDceProject/libraryProject/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsDceProject/libraryProject/build.gradle index a8cda8d8a2f..d32d1026f23 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsDceProject/libraryProject/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsDceProject/libraryProject/build.gradle @@ -16,7 +16,7 @@ repositories { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" } compileKotlin2Js.kotlinOptions.outputFile = "${buildDir}/examplelib.js" diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsDceProject/mainProject/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsDceProject/mainProject/build.gradle index 18d5928527d..02f628ed44e 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsDceProject/mainProject/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsDceProject/mainProject/build.gradle @@ -17,9 +17,9 @@ repositories { } dependencies { - compile project(":libraryProject") - compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" - compile "org.mozilla:rhino:1.7.7.1" + implementation project(":libraryProject") + implementation "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" + implementation "org.mozilla:rhino:1.7.7.1" } compileKotlin2Js.kotlinOptions.sourceMap = true diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsNoOutputFileProject/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsNoOutputFileProject/build.gradle index 5a5b3dd30c7..f72cdd7d48e 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsNoOutputFileProject/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsNoOutputFileProject/build.gradle @@ -16,7 +16,7 @@ repositories { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" } if (project.findProperty("kotlin.js.useIrBackend")?.toBoolean() == true) { diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlinBuiltins/app/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlinBuiltins/app/build.gradle index 30588c2e583..2a8815ebd3e 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlinBuiltins/app/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlinBuiltins/app/build.gradle @@ -6,5 +6,5 @@ repositories { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlinInJavaRoot/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlinInJavaRoot/build.gradle index f810995b000..6b0b8786360 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlinInJavaRoot/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlinInJavaRoot/build.gradle @@ -21,9 +21,9 @@ sourceSets { } dependencies { - compile 'com.google.guava:guava:12.0' - testCompile 'org.testng:testng:6.8' - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'com.google.guava:guava:12.0' + testImplementation 'org.testng:testng:6.8' + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } test { diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlinJavaProject/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlinJavaProject/build.gradle index c18cf3c9095..8b674103187 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlinJavaProject/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlinJavaProject/build.gradle @@ -21,11 +21,11 @@ repositories { } dependencies { - compile 'com.google.guava:guava:12.0' - deployCompile 'com.google.guava:guava:12.0' - testCompile 'org.testng:testng:6.8' - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - deployCompile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'com.google.guava:guava:12.0' + deployImplementation 'com.google.guava:guava:12.0' + testImplementation 'org.testng:testng:6.8' + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + deployImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } test { diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlinProject/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlinProject/build.gradle index 2739c96398f..7d140d98fe3 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlinProject/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlinProject/build.gradle @@ -16,9 +16,9 @@ repositories { } dependencies { - compile 'com.google.guava:guava:12.0' - testCompile 'org.testng:testng:6.8' - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'com.google.guava:guava:12.0' + testImplementation 'org.testng:testng:6.8' + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } test { diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlinProjectWithBuildSrc/buildSrc/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlinProjectWithBuildSrc/buildSrc/build.gradle index d8e13a3152c..79f4cc42dc0 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlinProjectWithBuildSrc/buildSrc/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlinProjectWithBuildSrc/buildSrc/build.gradle @@ -6,5 +6,5 @@ repositories { apply plugin: 'java' dependencies { - runtime "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + runtimeOnly "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kt-29971/jvm-app/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kt-29971/jvm-app/build.gradle index 50154d056ff..e4ce4dc88de 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kt-29971/jvm-app/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kt-29971/jvm-app/build.gradle @@ -6,5 +6,5 @@ group = "com.example.jvm" version = "1.0" dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/manyClasses/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/manyClasses/build.gradle index d78e0ec9d91..99d2edf7d15 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/manyClasses/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/manyClasses/build.gradle @@ -16,5 +16,5 @@ repositories { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/moveClassToOtherModule/app/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/moveClassToOtherModule/app/build.gradle index 6b6a43b35cf..db36830d9d1 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/moveClassToOtherModule/app/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/moveClassToOtherModule/app/build.gradle @@ -1,6 +1,6 @@ apply plugin: 'kotlin' dependencies { - compile project(':lib') - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation project(':lib') + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/moveClassToOtherModule/lib/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/moveClassToOtherModule/lib/build.gradle index ee7434e1b5d..83e41992508 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/moveClassToOtherModule/lib/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/moveClassToOtherModule/lib/build.gradle @@ -1,5 +1,5 @@ apply plugin: 'kotlin' dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/multiplatformProject/libJvm/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/multiplatformProject/libJvm/build.gradle index 9f694bbd6a1..ad2bb7df041 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/multiplatformProject/libJvm/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/multiplatformProject/libJvm/build.gradle @@ -2,6 +2,6 @@ apply plugin: 'kotlin-platform-jvm' dependencies { expectedBy project(":lib") - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile 'com.google.guava:guava:20.0' + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'com.google.guava:guava:20.0' } diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/multiprojectClassPathTest/subproject/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/multiprojectClassPathTest/subproject/build.gradle index 6bf3dc15e13..7004b107968 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/multiprojectClassPathTest/subproject/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/multiprojectClassPathTest/subproject/build.gradle @@ -1,9 +1,9 @@ apply plugin: "kotlin" dependencies { - compile 'com.google.guava:guava:12.0' - testCompile 'org.testng:testng:6.8' - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'com.google.guava:guava:12.0' + testImplementation 'org.testng:testng:6.8' + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } test { diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/multiprojectWithDependency/projA/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/multiprojectWithDependency/projA/build.gradle index 3b0ff938324..ae9666ab55c 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/multiprojectWithDependency/projA/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/multiprojectWithDependency/projA/build.gradle @@ -1,5 +1,5 @@ apply plugin: "kotlin" dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/multiprojectWithDependency/projB/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/multiprojectWithDependency/projB/build.gradle index 74c5be77652..058dff93b37 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/multiprojectWithDependency/projB/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/multiprojectWithDependency/projB/build.gradle @@ -1,6 +1,6 @@ apply plugin: "kotlin" dependencies { - compile project(':projA') - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation project(':projA') + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-lib-and-app/sample-old-style-app/app-common/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-lib-and-app/sample-old-style-app/app-common/build.gradle index 56e29c9786f..6f0d0f42837 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-lib-and-app/sample-old-style-app/app-common/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-lib-and-app/sample-old-style-app/app-common/build.gradle @@ -1,5 +1,5 @@ apply plugin: 'kotlin-platform-common' dependencies { - compile 'com.example:sample-lib:1.0' + implementation 'com.example:sample-lib:1.0' } \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-lib-and-app/sample-old-style-app/app-js/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-lib-and-app/sample-old-style-app/app-js/build.gradle index 6c9ab01026c..634a54d5525 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-lib-and-app/sample-old-style-app/app-js/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-lib-and-app/sample-old-style-app/app-js/build.gradle @@ -1,5 +1,5 @@ apply plugin: 'kotlin2js' dependencies { - compile 'com.example:sample-lib:1.0' + implementation 'com.example:sample-lib:1.0' } \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-lib-and-app/sample-old-style-app/app-jvm/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-lib-and-app/sample-old-style-app/app-jvm/build.gradle index b0f14c7a72c..04ee34aa550 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-lib-and-app/sample-old-style-app/app-jvm/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-lib-and-app/sample-old-style-app/app-jvm/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'kotlin' apply plugin: 'application' dependencies { - compile 'com.example:sample-lib:1.0' + implementation 'com.example:sample-lib:1.0' } mainClassName = 'com.example.app.JvmAppKt' \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/pluginsDsl/allopenPluginsDsl/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/pluginsDsl/allopenPluginsDsl/build.gradle index 26c7f5587ee..c7210d2f783 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/pluginsDsl/allopenPluginsDsl/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/pluginsDsl/allopenPluginsDsl/build.gradle @@ -13,6 +13,6 @@ allOpen { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8" - testCompile "junit:junit:4.12" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" + testImplementation "junit:junit:4.12" } \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/simpleProject/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/simpleProject/build.gradle index f212061aae5..aa20c0b601b 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/simpleProject/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/simpleProject/build.gradle @@ -21,11 +21,11 @@ repositories { } dependencies { - compile 'com.google.guava:guava:12.0' - deployCompile 'com.google.guava:guava:12.0' - testCompile 'org.testng:testng:6.8' - compile "org.jetbrains.kotlin:kotlin-stdlib" - deployCompile "org.jetbrains.kotlin:kotlin-stdlib" + implementation 'com.google.guava:guava:12.0' + deployImplementation 'com.google.guava:guava:12.0' + testImplementation 'org.testng:testng:6.8' + implementation "org.jetbrains.kotlin:kotlin-stdlib" + deployImplementation "org.jetbrains.kotlin:kotlin-stdlib" } test { diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/typeAlias/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/typeAlias/build.gradle index 30f34663a36..e25c321b2ee 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/typeAlias/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/typeAlias/build.gradle @@ -16,5 +16,5 @@ repositories { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinMultiplatformPlugin.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinMultiplatformPlugin.kt index 3e408b4c360..4bd2232a4da 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinMultiplatformPlugin.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinMultiplatformPlugin.kt @@ -56,7 +56,7 @@ open class KotlinPlatformImplementationPluginBase(platformName: String) : Kotlin private val commonProjects = arrayListOf() protected open fun configurationsForCommonModuleDependency(project: Project): List = - listOf(project.configurations.getByName("compile")) + listOf(project.configurations.getByName("api")) override fun apply(project: Project) { warnAboutKotlin12xMppDeprecation(project) @@ -239,10 +239,6 @@ open class KotlinPlatformAndroidPlugin : KotlinPlatformImplementationPluginBase( super.apply(project) } - override fun configurationsForCommonModuleDependency(project: Project): List = - (project.configurations.findByName("api"))?.let(::listOf) - ?: super.configurationsForCommonModuleDependency(project) // older Android plugins don't have api/implementation configs - override fun namedSourceSetsContainer(project: Project): NamedDomainObjectContainer<*> = (project.extensions.getByName("android") as BaseExtension).sourceSets From 858f73124dd87de4fffb2b040a36ce42a5c038ce Mon Sep 17 00:00:00 2001 From: Bingran Date: Fri, 13 Nov 2020 11:04:26 +0000 Subject: [PATCH 120/698] Update settings script properly, more tests with warning-mode=fail For some test class where most of the sub tests are able to run warning-mode=fail, we should not disable that warning mode for all sub tests in that class. --- .../kotlin/org/jetbrains/kotlin/gradle/BaseGradleIT.kt | 10 ++++++---- .../kotlin/gradle/ConfigurationCacheForAndroidIT.kt | 8 +++++--- .../jetbrains/kotlin/gradle/ConfigurationCacheIT.kt | 2 +- .../jetbrains/kotlin/gradle/KotlinGradlePluginIT.kt | 8 ++------ .../kotlin/gradle/util/testResolveAllConfigurations.kt | 3 ++- .../kotlin/gradle/plugin/KotlinMultiplatformPlugin.kt | 2 +- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/BaseGradleIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/BaseGradleIT.kt index 3ed8a1e226e..f472fb0ee85 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/BaseGradleIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/BaseGradleIT.kt @@ -153,13 +153,15 @@ abstract class BaseGradleIT { return wrapper } - fun mightUpdateSettingsScript(wrapperVersion: String, settingsScript: File) { + fun maybeUpdateSettingsScript(wrapperVersion: String, settingsScript: File) { // enableFeaturePreview("GRADLE_METADATA") is no longer needed when building with Gradle 5.4 or above - if (GradleVersion.version(wrapperVersion) > GradleVersion.version("5.3")) { + if (GradleVersion.version(wrapperVersion) >= GradleVersion.version("5.4")) { settingsScript.apply { if(exists()) { modify { it.replace("enableFeaturePreview('GRADLE_METADATA')", "//") + } + modify { it.replace("enableFeaturePreview(\"GRADLE_METADATA\")", "//") } } @@ -336,8 +338,6 @@ abstract class BaseGradleIT { val env = createEnvironmentVariablesMap(options) val wrapperDir = prepareWrapper(wrapperVersion, env) - mightUpdateSettingsScript(wrapperVersion, gradleSettingsScript()) - val cmd = createBuildCommand(wrapperDir, params, options) println("<=== Test build: ${this.projectName} $cmd ===>") @@ -346,6 +346,8 @@ abstract class BaseGradleIT { setupWorkingDir() } + maybeUpdateSettingsScript(wrapperVersion, gradleSettingsScript()) + val result = runProcess(cmd, projectDir, env, options) try { CompiledProject(this, result.output, result.exitCode).check() diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ConfigurationCacheForAndroidIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ConfigurationCacheForAndroidIT.kt index f65b3335427..59344b3df39 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ConfigurationCacheForAndroidIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ConfigurationCacheForAndroidIT.kt @@ -19,8 +19,7 @@ class ConfigurationCacheForAndroidIT : AbstractConfigurationCacheIT() { androidHome = KotlinTestUtils.findAndroidSdk(), androidGradlePluginVersion = androidGradlePluginVersion, configurationCache = true, - configurationCacheProblems = ConfigurationCacheProblems.FAIL, - warningMode = WarningMode.Summary + configurationCacheProblems = ConfigurationCacheProblems.FAIL ) @Test @@ -39,7 +38,10 @@ class ConfigurationCacheForAndroidIT : AbstractConfigurationCacheIT() { @Test fun testKotlinAndroidProjectTests() = with(Project("AndroidIncrementalMultiModule")) { applyAndroid40Alpha4KotlinVersionWorkaround() - testConfigurationCacheOf(":app:compileDebugAndroidTestKotlin", ":app:compileDebugUnitTestKotlin") + testConfigurationCacheOf( + ":app:compileDebugAndroidTestKotlin", ":app:compileDebugUnitTestKotlin", + buildOptions = defaultBuildOptions().copy(warningMode = WarningMode.Summary) + ) } /** diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ConfigurationCacheIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ConfigurationCacheIT.kt index 3bb76c5ec5a..fa18ab1ffd5 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ConfigurationCacheIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ConfigurationCacheIT.kt @@ -93,7 +93,7 @@ abstract class AbstractConfigurationCacheIT : BaseGradleIT() { checkInstantExecutionSucceeded() } - build("clean") { + build("clean", options = buildOptions) { assertSuccessful() } diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KotlinGradlePluginIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KotlinGradlePluginIT.kt index 50b93b37d12..4494ee65b35 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KotlinGradlePluginIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KotlinGradlePluginIT.kt @@ -36,10 +36,6 @@ import kotlin.test.assertTrue class KotlinGradleIT : BaseGradleIT() { - override fun defaultBuildOptions(): BuildOptions { - return super.defaultBuildOptions().copy(warningMode = WarningMode.Summary) - } - @Test fun testCrossCompile() { val project = Project("kotlinJavaProject") @@ -395,7 +391,7 @@ class KotlinGradleIT : BaseGradleIT() { """.trimIndent() } - project.build("build", "install") { + project.build("build", "install", options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) { assertSuccessful() assertTasksExecuted(":compileKotlin", ":compileTestKotlin") val pomLines = File(project.projectDir, "build/poms/pom-default.xml").readLines() @@ -934,7 +930,7 @@ class KotlinGradleIT : BaseGradleIT() { setupWorkingDir() gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl) - build("publish", "check", "runBenchmark") { + build("publish", "check", "runBenchmark", options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) { assertSuccessful() assertTasksExecuted(":compileKotlin", ":compileTestKotlin", ":compileBenchmarkKotlin", ":test", ":runBenchmark") diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/util/testResolveAllConfigurations.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/util/testResolveAllConfigurations.kt index 35e9314189c..00a0becad39 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/util/testResolveAllConfigurations.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/util/testResolveAllConfigurations.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.gradle.util +import org.gradle.api.logging.configuration.WarningMode import org.jetbrains.kotlin.gradle.BaseGradleIT import kotlin.test.assertTrue @@ -31,7 +32,7 @@ fun BaseGradleIT.Project.testResolveAllConfigurations( } } - build(RESOLVE_ALL_CONFIGURATIONS_TASK_NAME) { + build(RESOLVE_ALL_CONFIGURATIONS_TASK_NAME, options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) { assertSuccessful() assertTasksExecuted(":${subproject?.let { "$it:" }.orEmpty()}$RESOLVE_ALL_CONFIGURATIONS_TASK_NAME") val unresolvedConfigurations = unresolvedConfigurationRegex.findAll(output).map { it.groupValues[1] }.toList() diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinMultiplatformPlugin.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinMultiplatformPlugin.kt index 4bd2232a4da..6e0f78dce99 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinMultiplatformPlugin.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinMultiplatformPlugin.kt @@ -55,7 +55,7 @@ const val IMPLEMENT_DEPRECATION_WARNING = "The '$IMPLEMENT_CONFIG_NAME' configur open class KotlinPlatformImplementationPluginBase(platformName: String) : KotlinPlatformPluginBase(platformName) { private val commonProjects = arrayListOf() - protected open fun configurationsForCommonModuleDependency(project: Project): List = + private fun configurationsForCommonModuleDependency(project: Project): List = listOf(project.configurations.getByName("api")) override fun apply(project: Project) { From b0ebb02b6fe6aa7cd9eb3df3b2aa7469eaba87dc Mon Sep 17 00:00:00 2001 From: Bingran Date: Fri, 13 Nov 2020 18:25:52 +0000 Subject: [PATCH 121/698] Fix more deprecated configurations and disable fail mode for some tests --- .../jetbrains/kotlin/gradle/DukatIntegrationIT.kt | 5 +++-- .../gradle/IncrementalCompilationMultiProjectIT.kt | 4 ++-- .../kotlin/org/jetbrains/kotlin/gradle/Kapt3IT.kt | 3 ++- .../kotlin/gradle/KotlinGradlePluginIT.kt | 2 +- .../kotlin/gradle/MultiplatformGradleIT.kt | 5 +++-- .../jetbrains/kotlin/gradle/NewMultiplatformIT.kt | 14 +++++--------- .../kotlin/gradle/SimpleKotlinGradleIT.kt | 5 +++++ .../org/jetbrains/kotlin/gradle/SubpluginsIT.kt | 6 ++++++ .../kotlin/gradle/native/GeneralNativeIT.kt | 5 ----- .../gradle/util/testResolveAllConfigurations.kt | 3 ++- .../testProject/duplicatedClass/app/build.gradle | 4 ++-- .../testProject/duplicatedClass/lib/build.gradle | 2 +- .../testProject/gradleDaemonMemory/build.gradle | 2 +- .../testProject/javaUpToDate/build.gradle | 2 +- .../pluginsDsl/applyAllPlugins/build.gradle | 4 ++-- .../applyToSubprojects/subproject/build.gradle | 6 +++--- 16 files changed, 39 insertions(+), 33 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/DukatIntegrationIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/DukatIntegrationIT.kt index 89ed6c99fc3..acd22bb043a 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/DukatIntegrationIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/DukatIntegrationIT.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.gradle +import org.gradle.api.logging.configuration.WarningMode import org.jetbrains.kotlin.gradle.targets.js.dukat.ExternalsOutputFormat import org.jetbrains.kotlin.gradle.util.modify import org.junit.Test @@ -330,7 +331,7 @@ class DukatIntegrationIT : BaseGradleIT() { project.setupWorkingDir() project.gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl) - project.build("assemble") { + project.build("assemble", options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) { assertSuccessful() } } @@ -381,7 +382,7 @@ class DukatIntegrationIT : BaseGradleIT() { } val externalSrcs = "build/externals/both-jsIr/src" - project.build("assemble") { + project.build("assemble", options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) { assertSuccessful() assertTasksExecuted(":irGenerateExternalsIntegrated") diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/IncrementalCompilationMultiProjectIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/IncrementalCompilationMultiProjectIT.kt index 2425c7fa4a9..e14da624cf5 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/IncrementalCompilationMultiProjectIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/IncrementalCompilationMultiProjectIT.kt @@ -71,8 +71,8 @@ class IncrementalCompilationJvmMultiProjectIT : BaseIncrementalCompilationMultiP apply plugin: 'kotlin' dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:${"$"}kotlin_version" - compile 'org.codehaus.groovy:groovy-all:2.4.8' + implementation "org.jetbrains.kotlin:kotlin-stdlib:${"$"}kotlin_version" + implementation 'org.codehaus.groovy:groovy-all:2.4.8' } """.trimIndent() } diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kapt3IT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kapt3IT.kt index 666197a3a18..c14ab73a1fc 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kapt3IT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kapt3IT.kt @@ -16,6 +16,7 @@ package org.jetbrains.kotlin.gradle +import org.gradle.api.logging.configuration.WarningMode import org.jetbrains.kotlin.gradle.tasks.USING_JVM_INCREMENTAL_COMPILATION_MESSAGE import org.jetbrains.kotlin.gradle.util.* import org.junit.Assert @@ -30,7 +31,7 @@ abstract class Kapt3BaseIT : BaseGradleIT() { } override fun defaultBuildOptions(): BuildOptions = - super.defaultBuildOptions().copy(kaptOptions = kaptOptions()) + super.defaultBuildOptions().copy(kaptOptions = kaptOptions(), warningMode = WarningMode.Summary) protected open fun kaptOptions(): KaptOptions = KaptOptions(verbose = true, useWorkers = false) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KotlinGradlePluginIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KotlinGradlePluginIT.kt index 4494ee65b35..dcaec936d7d 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KotlinGradlePluginIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KotlinGradlePluginIT.kt @@ -776,7 +776,7 @@ class KotlinGradleIT : BaseGradleIT() { setupWorkingDir() // Add a dependency with an explicit lower Kotlin version that has a kotlin-stdlib transitive dependency: gradleBuildScript().appendText("\ndependencies { implementation 'org.jetbrains.kotlin:kotlin-reflect:1.2.71' }") - testResolveAllConfigurations { + testResolveAllConfigurations(options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) { assertSuccessful() assertContains(">> :compileClasspath --> kotlin-reflect-1.2.71.jar") // Check that the default newer Kotlin version still wins for 'kotlin-stdlib': diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/MultiplatformGradleIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/MultiplatformGradleIT.kt index 511348ab314..c7eb4983425 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/MultiplatformGradleIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/MultiplatformGradleIT.kt @@ -17,6 +17,7 @@ package org.jetbrains.kotlin.gradle import com.intellij.testFramework.TestDataPath +import org.gradle.api.logging.configuration.WarningMode import org.jetbrains.kotlin.gradle.internals.KOTLIN_12X_MPP_DEPRECATION_WARNING import org.jetbrains.kotlin.gradle.plugin.EXPECTED_BY_CONFIG_NAME import org.jetbrains.kotlin.gradle.plugin.IMPLEMENT_CONFIG_NAME @@ -175,7 +176,7 @@ class MultiplatformGradleIT : BaseGradleIT() { @Test fun testMultipleCommonModules(): Unit = with(Project("multiplatformMultipleCommonModules")) { - build("build") { + build("build", options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) { assertSuccessful() val sourceSets = listOf("", "Test") @@ -305,7 +306,7 @@ class MultiplatformGradleIT : BaseGradleIT() { val customSourceSetCompileTasks = listOf(":lib" to "Common", ":libJs" to "2Js", ":libJvm" to "") .map { (module, platform) -> "$module:compile${sourceSetName.capitalize()}Kotlin$platform" } - build(*customSourceSetCompileTasks.toTypedArray()) { + build(*customSourceSetCompileTasks.toTypedArray(), options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) { assertSuccessful() assertTasksExecuted(customSourceSetCompileTasks) } diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/NewMultiplatformIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/NewMultiplatformIT.kt index d6c31353717..7f098031483 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/NewMultiplatformIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/NewMultiplatformIT.kt @@ -44,10 +44,6 @@ class NewMultiplatformIT : BaseGradleIT() { private fun Project.targetClassesDir(targetName: String, sourceSetName: String = "main") = classesDir(sourceSet = "$targetName/$sourceSetName") - override fun defaultBuildOptions(): BuildOptions { - return super.defaultBuildOptions().copy(warningMode = WarningMode.Summary) - } - @Test fun testLibAndApp() = doTestLibAndApp( "sample-lib", @@ -1280,7 +1276,7 @@ class NewMultiplatformIT : BaseGradleIT() { @Test fun testJsDceInMpp() = with(Project("new-mpp-js-dce", gradleVersion)) { - build("runRhino") { + build("runRhino", options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) { assertSuccessful() assertTasksExecuted(":mainProject:runDceNodeJsKotlin") @@ -1365,7 +1361,7 @@ class NewMultiplatformIT : BaseGradleIT() { fun testDependenciesDsl() = with(transformProjectWithPluginsDsl("newMppDependenciesDsl")) { val originalBuildscriptContent = gradleBuildScript("app").readText() - fun testDependencies() = testResolveAllConfigurations("app") { + fun testDependencies() = testResolveAllConfigurations("app", options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) { assertContains(">> :app:testNonTransitiveStringNotationApiDependenciesMetadata --> junit-4.12.jar") assertEquals( 1, @@ -1399,7 +1395,7 @@ class NewMultiplatformIT : BaseGradleIT() { @Test fun testMultipleTargetsSamePlatform() = with(Project("newMppMultipleTargetsSamePlatform", gradleVersion)) { - testResolveAllConfigurations("app") { + testResolveAllConfigurations("app", options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) { assertContains(">> :app:junitCompileClasspath --> lib-junit.jar") assertContains(">> :app:junitCompileClasspath --> junit-4.12.jar") @@ -1489,7 +1485,7 @@ class NewMultiplatformIT : BaseGradleIT() { val groupDir = "build/repo/com/example/" - build(":mpp-lib:publish") { + build(":mpp-lib:publish", options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) { assertSuccessful() assertFileExists(groupDir + "mpp-lib") assertFileExists(groupDir + "mpp-lib-myjvm") @@ -1506,7 +1502,7 @@ class NewMultiplatformIT : BaseGradleIT() { add("-Pkotlin.mpp.keepMppDependenciesIntactInPoms=true") }.toTypedArray() - build(*params) { + build(*params, options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) { assertSuccessful() if (legacyPublishing) { assertTasksExecuted(":jvm-app:uploadArchives") diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/SimpleKotlinGradleIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/SimpleKotlinGradleIT.kt index 9cb76dd0ed7..11582abb572 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/SimpleKotlinGradleIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/SimpleKotlinGradleIT.kt @@ -1,5 +1,6 @@ package org.jetbrains.kotlin.gradle +import org.gradle.api.logging.configuration.WarningMode import org.jetbrains.kotlin.gradle.util.modify import org.junit.Test import java.io.File @@ -7,6 +8,10 @@ import kotlin.test.assertTrue class SimpleKotlinGradleIT : BaseGradleIT() { + override fun defaultBuildOptions(): BuildOptions { + return super.defaultBuildOptions().copy(warningMode = WarningMode.Summary) + } + @Test fun testSimpleCompile() { val project = Project("simpleProject") diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/SubpluginsIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/SubpluginsIT.kt index 14395c033ea..ae78f872008 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/SubpluginsIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/SubpluginsIT.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.gradle +import org.gradle.api.logging.configuration.WarningMode import org.jetbrains.kotlin.gradle.util.AGPVersion import org.jetbrains.kotlin.gradle.util.checkBytecodeContains import org.jetbrains.kotlin.gradle.util.modify @@ -14,6 +15,11 @@ import java.io.File import kotlin.test.assertTrue class SubpluginsIT : BaseGradleIT() { + + override fun defaultBuildOptions(): BuildOptions { + return super.defaultBuildOptions().copy(warningMode = WarningMode.Summary) + } + @Test fun testGradleSubplugin() { val project = Project("kotlinGradleSubplugin") diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/GeneralNativeIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/GeneralNativeIT.kt index 11b64504a84..bbf0dea1eba 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/GeneralNativeIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/GeneralNativeIT.kt @@ -6,7 +6,6 @@ package org.jetbrains.kotlin.gradle.native import com.intellij.testFramework.TestDataFile -import org.gradle.api.logging.configuration.WarningMode import org.jdom.input.SAXBuilder import org.jetbrains.kotlin.gradle.BaseGradleIT import org.jetbrains.kotlin.gradle.GradleVersionRequired @@ -94,10 +93,6 @@ class GeneralNativeIT : BaseGradleIT() { override val defaultGradleVersion: GradleVersionRequired get() = GradleVersionRequired.FOR_MPP_SUPPORT - override fun defaultBuildOptions(): BuildOptions { - return super.defaultBuildOptions().copy(warningMode = WarningMode.Summary) - } - @Test fun testParallelExecutionSmoke(): Unit = with(transformNativeTestProjectWithPluginDsl("native-parallel")) { // Check that the K/N compiler can be started in-process in parallel. diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/util/testResolveAllConfigurations.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/util/testResolveAllConfigurations.kt index 00a0becad39..42d9a25933d 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/util/testResolveAllConfigurations.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/util/testResolveAllConfigurations.kt @@ -17,6 +17,7 @@ fun BaseGradleIT.Project.testResolveAllConfigurations( subproject: String? = null, skipSetup: Boolean = false, excludePredicate: String = "false", + options: BaseGradleIT.BuildOptions = testCase.defaultBuildOptions(), withUnresolvedConfigurationNames: BaseGradleIT.CompiledProject.(List) -> Unit = { assertTrue("Unresolved configurations: $it") { it.isEmpty() } } ) = with(testCase) { @@ -32,7 +33,7 @@ fun BaseGradleIT.Project.testResolveAllConfigurations( } } - build(RESOLVE_ALL_CONFIGURATIONS_TASK_NAME, options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) { + build(RESOLVE_ALL_CONFIGURATIONS_TASK_NAME, options = options) { assertSuccessful() assertTasksExecuted(":${subproject?.let { "$it:" }.orEmpty()}$RESOLVE_ALL_CONFIGURATIONS_TASK_NAME") val unresolvedConfigurations = unresolvedConfigurationRegex.findAll(output).map { it.groupValues[1] }.toList() diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/duplicatedClass/app/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/duplicatedClass/app/build.gradle index b5432a9eb42..14dcf14ce9d 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/duplicatedClass/app/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/duplicatedClass/app/build.gradle @@ -1,6 +1,6 @@ apply plugin: 'kotlin' dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile project(':lib') + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation project(':lib') } diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/duplicatedClass/lib/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/duplicatedClass/lib/build.gradle index ee7434e1b5d..83e41992508 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/duplicatedClass/lib/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/duplicatedClass/lib/build.gradle @@ -1,5 +1,5 @@ apply plugin: 'kotlin' dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/gradleDaemonMemory/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/gradleDaemonMemory/build.gradle index 4b43348d5bb..9b88a6b1b5d 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/gradleDaemonMemory/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/gradleDaemonMemory/build.gradle @@ -16,7 +16,7 @@ repositories { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } task('exit') { diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/javaUpToDate/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/javaUpToDate/build.gradle index 1e12b34c08a..b51ecf61c66 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/javaUpToDate/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/javaUpToDate/build.gradle @@ -17,5 +17,5 @@ repositories { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/pluginsDsl/applyAllPlugins/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/pluginsDsl/applyAllPlugins/build.gradle index 25453af6be8..590f2a51e9c 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/pluginsDsl/applyAllPlugins/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/pluginsDsl/applyAllPlugins/build.gradle @@ -13,8 +13,8 @@ repositories { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8" - testCompile "junit:junit:4.12" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" + testImplementation "junit:junit:4.12" } afterEvaluate { diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/pluginsDsl/applyToSubprojects/subproject/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/pluginsDsl/applyToSubprojects/subproject/build.gradle index aff049022b6..3522d887da3 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/pluginsDsl/applyToSubprojects/subproject/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/pluginsDsl/applyToSubprojects/subproject/build.gradle @@ -1,7 +1,7 @@ dependencies { - compile 'com.google.guava:guava:12.0' - testCompile 'org.testng:testng:6.8' - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'com.google.guava:guava:12.0' + testImplementation 'org.testng:testng:6.8' + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } test { From f9503efb74ae5ebcf0d1ced6b20eebf17ad99cf0 Mon Sep 17 00:00:00 2001 From: Svyatoslav Kuzmich Date: Wed, 25 Nov 2020 15:18:02 +0300 Subject: [PATCH 122/698] [JS IR] Make WITH_RUNTIME imply KJS_WITH_FULL_RUNTIME There is a lot of intersection between these --- .../typeAnnotations/checkingNotincorporatedInputTypes.kt | 1 - .../builderInference/callableReferenceAndCoercionToUnit.kt | 1 - .../suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt | 1 - .../typeOf/noReflect/typeReferenceEqualsHashCode.kt | 1 - js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt | 4 +++- 5 files changed, 3 insertions(+), 5 deletions(-) diff --git a/compiler/testData/codegen/box/annotations/typeAnnotations/checkingNotincorporatedInputTypes.kt b/compiler/testData/codegen/box/annotations/typeAnnotations/checkingNotincorporatedInputTypes.kt index 0ecff0fc251..f6b6f884fc1 100644 --- a/compiler/testData/codegen/box/annotations/typeAnnotations/checkingNotincorporatedInputTypes.kt +++ b/compiler/testData/codegen/box/annotations/typeAnnotations/checkingNotincorporatedInputTypes.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // WITH_RUNTIME fun isImportedByDefault(c: String?, x: Set) = c?.let { it.toInt() } in x diff --git a/compiler/testData/codegen/box/builderInference/callableReferenceAndCoercionToUnit.kt b/compiler/testData/codegen/box/builderInference/callableReferenceAndCoercionToUnit.kt index 563458e1afe..02317a10afa 100644 --- a/compiler/testData/codegen/box/builderInference/callableReferenceAndCoercionToUnit.kt +++ b/compiler/testData/codegen/box/builderInference/callableReferenceAndCoercionToUnit.kt @@ -1,6 +1,5 @@ // DONT_TARGET_EXACT_BACKEND: WASM // WASM_MUTE_REASON: STDLIB_COLLECTIONS -// IGNORE_BACKEND: JS_IR // !LANGUAGE: +NewInference // !DIAGNOSTICS: -EXPERIMENTAL_API_USAGE_ERROR -UNUSED_EXPRESSION // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt b/compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt index 8463211e92a..c5959647e05 100644 --- a/compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt +++ b/compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt @@ -1,5 +1,4 @@ // IGNORE_BACKEND: NATIVE -// IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: JS_IR_ES6 // WITH_RUNTIME // WITH_COROUTINES diff --git a/compiler/testData/codegen/box/reflection/typeOf/noReflect/typeReferenceEqualsHashCode.kt b/compiler/testData/codegen/box/reflection/typeOf/noReflect/typeReferenceEqualsHashCode.kt index 2e06a4c8c46..d0ce9a19059 100644 --- a/compiler/testData/codegen/box/reflection/typeOf/noReflect/typeReferenceEqualsHashCode.kt +++ b/compiler/testData/codegen/box/reflection/typeOf/noReflect/typeReferenceEqualsHashCode.kt @@ -1,6 +1,5 @@ // !USE_EXPERIMENTAL: kotlin.ExperimentalStdlibApi // !LANGUAGE: +NewInference -// IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: JS_IR_ES6 // WITH_RUNTIME diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt index 9c4c05785a2..6f889fa8d6f 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt @@ -114,7 +114,8 @@ abstract class BasicBoxTest( fileContent = fileContent.replace("COROUTINES_PACKAGE", coroutinesPackage) } - val needsFullIrRuntime = KJS_WITH_FULL_RUNTIME.matcher(fileContent).find() + val needsFullIrRuntime = KJS_WITH_FULL_RUNTIME.matcher(fileContent).find() || WITH_RUNTIME.matcher(fileContent).find() + val actualMainCallParameters = if (CALL_MAIN_PATTERN.matcher(fileContent).find()) MainCallParameters.mainWithArguments(listOf("testArg")) else mainCallParameters @@ -1019,6 +1020,7 @@ abstract class BasicBoxTest( private val SOURCE_MAP_SOURCE_EMBEDDING = Regex("^// *SOURCE_MAP_EMBED_SOURCES: ([A-Z]+)*\$", RegexOption.MULTILINE) private val CALL_MAIN_PATTERN = Pattern.compile("^// *CALL_MAIN *$", Pattern.MULTILINE) private val KJS_WITH_FULL_RUNTIME = Pattern.compile("^// *KJS_WITH_FULL_RUNTIME *\$", Pattern.MULTILINE) + private val WITH_RUNTIME = Pattern.compile("^// *WITH_RUNTIME *\$", Pattern.MULTILINE) private val EXPECT_ACTUAL_LINKER = Pattern.compile("^// EXPECT_ACTUAL_LINKER *$", Pattern.MULTILINE) private val SKIP_DCE_DRIVEN = Pattern.compile("^// *SKIP_DCE_DRIVEN *$", Pattern.MULTILINE) private val SPLIT_PER_MODULE = Pattern.compile("^// *SPLIT_PER_MODULE *$", Pattern.MULTILINE) From b5143ba2ab3777439f5017c751a22f224ea0591f Mon Sep 17 00:00:00 2001 From: Sergey Shanshin Date: Wed, 25 Nov 2020 21:50:42 +0300 Subject: [PATCH 123/698] Optimize check for missing fields in deserialization (#3862) Fixes Kotlin/kotlinx.serialization#662 Kotlin/kotlinx.serialization#657 --- .../backend/common/SerializableCodegen.kt | 41 ++++ .../compiler/backend/ir/GeneratorHelpers.kt | 40 +++- .../ir/SerialInfoImplJvmIrGenerator.kt | 4 +- .../backend/ir/SerializableIrGenerator.kt | 192 +++++++++++++++++- .../backend/ir/SerializerIrGenerator.kt | 5 +- .../compiler/backend/jvm/JVMCodegenUtil.kt | 8 +- .../backend/jvm/SerializableCodegenImpl.kt | 137 +++++++++++-- .../compiler/diagnostic/VersionReader.kt | 8 +- .../compiler/resolve/NamingConventions.kt | 8 + .../compiler/resolve/SearchUtils.kt | 10 + 10 files changed, 425 insertions(+), 28 deletions(-) diff --git a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/common/SerializableCodegen.kt b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/common/SerializableCodegen.kt index 97c023c4abe..36537011385 100644 --- a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/common/SerializableCodegen.kt +++ b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/common/SerializableCodegen.kt @@ -16,11 +16,14 @@ package org.jetbrains.kotlinx.serialization.compiler.backend.common +import org.jetbrains.kotlin.config.ApiVersion import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.resolve.BindingContext +import org.jetbrains.kotlin.resolve.descriptorUtil.module import org.jetbrains.kotlin.resolve.descriptorUtil.secondaryConstructors +import org.jetbrains.kotlinx.serialization.compiler.diagnostic.VersionReader import org.jetbrains.kotlinx.serialization.compiler.resolve.* abstract class SerializableCodegen( @@ -28,6 +31,10 @@ abstract class SerializableCodegen( bindingContext: BindingContext ) : AbstractSerialGenerator(bindingContext, serializableDescriptor) { protected val properties = bindingContext.serializablePropertiesFor(serializableDescriptor) + protected val staticDescriptor = serializableDescriptor.declaredTypeParameters.isEmpty() + + private val fieldMissingOptimizationVersion = ApiVersion.parse("1.1")!! + protected val useFieldMissingOptimization = canUseFieldMissingOptimization() fun generate() { generateSyntheticInternalConstructor() @@ -50,6 +57,40 @@ abstract class SerializableCodegen( } } + protected fun getGoldenMask(): Int { + var goldenMask = 0 + var requiredBit = 1 + for (property in properties.serializableProperties) { + if (!property.optional) { + goldenMask = goldenMask or requiredBit + } + requiredBit = requiredBit shl 1 + } + return goldenMask + } + + protected fun getGoldenMaskList(): List { + val maskSlotCount = properties.serializableProperties.bitMaskSlotCount() + val goldenMaskList = MutableList(maskSlotCount) { 0 } + + for (i in properties.serializableProperties.indices) { + if (!properties.serializableProperties[i].optional) { + val slotNumber = i / 32 + val bitInSlot = i % 32 + goldenMaskList[slotNumber] = goldenMaskList[slotNumber] or (1 shl bitInSlot) + } + } + return goldenMaskList + } + + private fun canUseFieldMissingOptimization(): Boolean { + val implementationVersion = VersionReader.getVersionsForCurrentModuleFromContext( + serializableDescriptor.module, + bindingContext + )?.implementationVersion + return if (implementationVersion != null) implementationVersion >= fieldMissingOptimizationVersion else false + } + protected abstract fun generateInternalConstructor(constructorDescriptor: ClassConstructorDescriptor) protected open fun generateWriteSelfMethod(methodDescriptor: FunctionDescriptor) { diff --git a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/GeneratorHelpers.kt b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/GeneratorHelpers.kt index da69145f543..42a41eb3847 100644 --- a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/GeneratorHelpers.kt +++ b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/GeneratorHelpers.kt @@ -11,6 +11,7 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.annotations.Annotations import org.jetbrains.kotlin.ir.builders.* +import org.jetbrains.kotlin.ir.builders.declarations.buildFun import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.* @@ -67,6 +68,30 @@ interface IrBuilderExtension { ) { bodyGen(c) } } + // function will not be created in the real class + fun IrClass.createInlinedFunction( + name: Name, + visibility: DescriptorVisibility, + origin: IrDeclarationOrigin, + returnType: IrType, + bodyGen: IrBlockBodyBuilder.(IrFunction) -> Unit + ): IrSimpleFunction { + val function = factory.buildFun { + this.name = name + this.visibility = visibility + this.origin = origin + this.isInline = true + this.returnType = returnType + } + val functionSymbol = function.symbol + function.parent = this + function.body = DeclarationIrBuilder(compilerContext, functionSymbol, startOffset, endOffset).irBlockBody( + startOffset, + endOffset + ) { bodyGen(function) } + return function + } + fun IrBuilderWithScope.irInvoke( dispatchReceiver: IrExpression? = null, callee: IrFunctionSymbol, @@ -109,6 +134,19 @@ interface IrBuilderExtension { } } + fun IrBuilderWithScope.createPrimitiveArrayOfExpression( + elementPrimitiveType: IrType, + arrayElements: List + ): IrExpression { + val arrayType = compilerContext.irBuiltIns.primitiveArrayForType.getValue(elementPrimitiveType).defaultType + val arg0 = IrVarargImpl(startOffset, endOffset, arrayType, elementPrimitiveType, arrayElements) + val typeArguments = listOf(elementPrimitiveType) + + return irCall(compilerContext.symbols.arrayOf, arrayType, typeArguments = typeArguments).apply { + putValueArgument(0, arg0) + } + } + fun IrBuilderWithScope.irBinOp(name: Name, lhs: IrExpression, rhs: IrExpression): IrExpression { val classFqName = (lhs.type as IrSimpleType).classOrNull!!.owner.fqNameWhenAvailable!! val symbol = compilerContext.referenceFunctions(classFqName.child(name)).single() @@ -766,4 +804,4 @@ interface IrBuilderExtension { return superClasses.singleOrNull { it.kind == ClassKind.CLASS } } -} \ No newline at end of file +} diff --git a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/SerialInfoImplJvmIrGenerator.kt b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/SerialInfoImplJvmIrGenerator.kt index 980291dd50d..391d2a7f95f 100644 --- a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/SerialInfoImplJvmIrGenerator.kt +++ b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/SerialInfoImplJvmIrGenerator.kt @@ -68,7 +68,7 @@ class SerialInfoImplJvmIrGenerator( generateSimplePropertyWithBackingField(property.descriptor, irClass, Name.identifier("_" + property.name.asString())) val getter = property.getter!! - getter.origin = SERIALIZABLE_SYNTHETIC_ORIGIN + getter.origin = SERIALIZABLE_PLUGIN_ORIGIN // Add JvmName annotation to property getters to force the resulting JVM method name for 'x' be 'x', instead of 'getX', // and to avoid having useless bridges for it generated in BridgeLowering. // Unfortunately, this results in an extra `@JvmName` annotation in the bytecode, but it shouldn't matter very much. @@ -76,7 +76,7 @@ class SerialInfoImplJvmIrGenerator( val field = property.backingField!! field.visibility = DescriptorVisibilities.PRIVATE - field.origin = SERIALIZABLE_SYNTHETIC_ORIGIN + field.origin = SERIALIZABLE_PLUGIN_ORIGIN val parameter = ctor.addValueParameter(property.name.asString(), getter.returnType) ctorBody.statements += IrSetFieldImpl( diff --git a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/SerializableIrGenerator.kt b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/SerializableIrGenerator.kt index 07af3bde9cd..96c7de0d3df 100644 --- a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/SerializableIrGenerator.kt +++ b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/SerializableIrGenerator.kt @@ -8,24 +8,31 @@ package org.jetbrains.kotlinx.serialization.compiler.backend.ir import org.jetbrains.kotlin.backend.common.deepCopyWithVariables import org.jetbrains.kotlin.backend.common.lower.irThrow import org.jetbrains.kotlin.codegen.CompilationException -import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor -import org.jetbrains.kotlin.descriptors.ClassKind -import org.jetbrains.kotlin.descriptors.FunctionDescriptor +import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.ir.builders.* +import org.jetbrains.kotlin.ir.builders.declarations.addField import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.impl.IrDelegatingConstructorCallImpl +import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol import org.jetbrains.kotlin.ir.types.* -import org.jetbrains.kotlin.ir.util.getAnnotation -import org.jetbrains.kotlin.ir.util.patchDeclarationParents +import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.js.resolve.diagnostics.findPsi +import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.BindingContext +import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe +import org.jetbrains.kotlin.resolve.descriptorUtil.module import org.jetbrains.kotlin.util.OperatorNameConventions import org.jetbrains.kotlinx.serialization.compiler.backend.common.SerializableCodegen +import org.jetbrains.kotlinx.serialization.compiler.backend.common.serialName import org.jetbrains.kotlinx.serialization.compiler.diagnostic.serializableAnnotationIsUseless import org.jetbrains.kotlinx.serialization.compiler.extensions.SerializationPluginContext import org.jetbrains.kotlinx.serialization.compiler.resolve.* +import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.ARRAY_MASK_FIELD_MISSING_FUNC_FQ import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.MISSING_FIELD_EXC +import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.SERIAL_DESC_FIELD +import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.SINGLE_MASK_FIELD_MISSING_FUNC_FQ +import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.initializedDescriptorFieldName class SerializableIrGenerator( val irClass: IrClass, @@ -33,7 +40,20 @@ class SerializableIrGenerator( bindingContext: BindingContext ) : SerializableCodegen(irClass.descriptor, bindingContext), IrBuilderExtension { + private val descriptorGenerationFunctionName = "createInitializedDescriptor" + private val serialDescClass: ClassDescriptor = serializableDescriptor.module + .getClassFromSerializationDescriptorsPackage(SerialEntityNames.SERIAL_DESCRIPTOR_CLASS) + + private val serialDescImplClass: ClassDescriptor = serializableDescriptor + .getClassFromInternalSerializationPackage(SerialEntityNames.SERIAL_DESCRIPTOR_CLASS_IMPL) + + private val addElementFun = serialDescImplClass.findFunctionSymbol(CallingConventions.addElement) + + val throwMissedFieldExceptionFunc = + if (useFieldMissingOptimization) compilerContext.referenceFunctions(SINGLE_MASK_FIELD_MISSING_FUNC_FQ).single() else null + val throwMissedFieldExceptionArrayFunc = + if (useFieldMissingOptimization) compilerContext.referenceFunctions(ARRAY_MASK_FIELD_MISSING_FUNC_FQ).single() else null private fun IrClass.hasSerializableAnnotationWithoutArgs(): Boolean { val annot = getAnnotation(SerializationAnnotations.serializableAnnotationFqName) ?: return false @@ -64,6 +84,10 @@ class SerializableIrGenerator( val thiz = irClass.thisReceiver!! val superClass = irClass.getSuperClassOrAny() var startPropOffset: Int = 0 + + if (useFieldMissingOptimization) { + generateOptimizedGoldenMaskCheck(seenVars) + } when { superClass.symbol == compilerContext.irBuiltIns.anyClass -> generateAnySuperConstructorCall(toBuilder = this@contributeConstructor) superClass.isInternalSerializable -> { @@ -83,7 +107,14 @@ class SerializableIrGenerator( requireNotNull(transformFieldInitializer(prop.irField)) { "Optional value without an initializer" } // todo: filter abstract here setProperty(irGet(thiz), prop.irProp, initializerBody) } else { - irThrow(irInvoke(null, exceptionCtorRef, irString(prop.name), typeHint = exceptionType)) + // property required + if (useFieldMissingOptimization) { + // field definitely not empty as it's checked before - no need another IF, only assign property from param + +assignParamExpr + continue + } else { + irThrow(irInvoke(null, exceptionCtorRef, irString(prop.name), typeHint = exceptionType)) + } } val propNotSeenTest = @@ -116,6 +147,153 @@ class SerializableIrGenerator( } } + private fun IrBlockBodyBuilder.generateOptimizedGoldenMaskCheck(seenVars: List) { + if (serializableDescriptor.isAbstractSerializableClass() || serializableDescriptor.isSealedSerializableClass()) { + // for abstract classes fields MUST BE checked in child classes + return + } + + val fieldsMissedTest: IrExpression + val throwErrorExpr: IrExpression + + val maskSlotCount = seenVars.size + if (maskSlotCount == 1) { + val goldenMask = getGoldenMask() + + throwErrorExpr = irInvoke( + null, + throwMissedFieldExceptionFunc!!, + irGet(seenVars[0]), + irInt(goldenMask), + getSerialDescriptorExpr(), + typeHint = compilerContext.irBuiltIns.unitType + ) + + fieldsMissedTest = irNotEquals( + irInt(goldenMask), + irBinOp( + OperatorNameConventions.AND, + irInt(goldenMask), + irGet(seenVars[0]) + ) + ) + } else { + val goldenMaskList = getGoldenMaskList() + + var compositeExpression: IrExpression? = null + for (i in goldenMaskList.indices) { + val singleCheckExpr = irNotEquals( + irInt(goldenMaskList[i]), + irBinOp( + OperatorNameConventions.AND, + irInt(goldenMaskList[i]), + irGet(seenVars[i]) + ) + ) + + compositeExpression = if (compositeExpression == null) { + singleCheckExpr + } else { + irBinOp( + OperatorNameConventions.OR, + compositeExpression, + singleCheckExpr + ) + } + } + + fieldsMissedTest = compositeExpression!! + + throwErrorExpr = irBlock { + +irInvoke( + null, + throwMissedFieldExceptionArrayFunc!!, + createPrimitiveArrayOfExpression(compilerContext.irBuiltIns.intType, goldenMaskList.indices.map { irGet(seenVars[it]) }), + createPrimitiveArrayOfExpression(compilerContext.irBuiltIns.intType, goldenMaskList.map { irInt(it) }), + getSerialDescriptorExpr(), + typeHint = compilerContext.irBuiltIns.unitType + ) + } + } + + +irIfThen(compilerContext.irBuiltIns.unitType, fieldsMissedTest, throwErrorExpr) + } + + private fun IrBlockBodyBuilder.getSerialDescriptorExpr(): IrExpression { + return if (serializableDescriptor.shouldHaveGeneratedSerializer && staticDescriptor) { + val serializer = serializableDescriptor.classSerializer!! + val serialDescriptorGetter = compilerContext.referenceClass(serializer.fqNameSafe)!!.getPropertyGetter(SERIAL_DESC_FIELD)!! + irGet( + serialDescriptorGetter.owner.returnType, + irGetObject(serializer), + serialDescriptorGetter.owner.symbol + ) + } else { + irGetField(null, generateStaticDescriptorField()) + } + } + + private fun IrBlockBodyBuilder.generateStaticDescriptorField(): IrField { + val serialDescItType = serialDescClass.defaultType.toIrType() + + val function = irClass.createInlinedFunction( + Name.identifier(descriptorGenerationFunctionName), + DescriptorVisibilities.PRIVATE, + SERIALIZABLE_PLUGIN_ORIGIN, + serialDescItType + ) { + val serialDescVar = irTemporary( + getInstantiateDescriptorExpr(), + nameHint = "serialDesc" + ) + for (property in properties.serializableProperties) { + +getAddElementToDescriptorExpr(property, serialDescVar) + } + +irReturn(irGet(serialDescVar)) + } + + return irClass.addField { + name = Name.identifier(initializedDescriptorFieldName) + visibility = DescriptorVisibilities.PRIVATE + origin = SERIALIZABLE_PLUGIN_ORIGIN + isFinal = true + isStatic = true + type = serialDescItType + }.apply { initializer = irClass.factory.createExpressionBody(irCall(function)) } + } + + private fun IrBlockBodyBuilder.getInstantiateDescriptorExpr(): IrExpression { + val classConstructors = compilerContext.referenceConstructors(serialDescImplClass.fqNameSafe) + val serialClassDescImplCtor = classConstructors.single { it.owner.isPrimary } + return irInvoke( + null, serialClassDescImplCtor, + irString(serializableDescriptor.serialName()), irNull(), irInt(properties.serializableProperties.size) + ) + } + + private fun IrBlockBodyBuilder.getAddElementToDescriptorExpr( + property: SerializableProperty, + serialDescVar: IrVariable + ): IrExpression { + return irInvoke( + irGet(serialDescVar), + addElementFun, + irString(property.name), + irBoolean(property.optional), + typeHint = compilerContext.irBuiltIns.unitType + ) + } + + private inline fun ClassDescriptor.findFunctionSymbol( + functionName: String, + predicate: (IrSimpleFunction) -> Boolean = { true } + ): IrFunctionSymbol { + val irClass = compilerContext.referenceClass(fqNameSafe)?.owner ?: error("Couldn't load class $this") + val simpleFunctions = irClass.declarations.filterIsInstance() + + return simpleFunctions.filter { it.name.asString() == functionName }.single { predicate(it) }.symbol + } + private fun IrBlockBodyBuilder.generateSuperNonSerializableCall(superClass: IrClass) { val ctorRef = superClass.declarations.filterIsInstance().singleOrNull { it.valueParameters.isEmpty() } ?: error("Non-serializable parent of serializable $serializableDescriptor must have no arg constructor") @@ -189,4 +367,4 @@ class SerializableIrGenerator( } } } -} \ No newline at end of file +} diff --git a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/SerializerIrGenerator.kt b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/SerializerIrGenerator.kt index 66041a9022e..ad297605d38 100644 --- a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/SerializerIrGenerator.kt +++ b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/SerializerIrGenerator.kt @@ -37,10 +37,7 @@ import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.ST import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.STRUCTURE_ENCODER_CLASS import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.UNKNOWN_FIELD_EXC -object SERIALIZABLE_PLUGIN_ORIGIN : IrDeclarationOriginImpl("SERIALIZER") - -// TODO: use in places where elements need to have ACC_SYNTHETIC on JVM -object SERIALIZABLE_SYNTHETIC_ORIGIN : IrDeclarationOriginImpl("SERIALIZER") +object SERIALIZABLE_PLUGIN_ORIGIN : IrDeclarationOriginImpl("SERIALIZER", true) open class SerializerIrGenerator( val irClass: IrClass, diff --git a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/jvm/JVMCodegenUtil.kt b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/jvm/JVMCodegenUtil.kt index f89009a67df..02bdd551272 100644 --- a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/jvm/JVMCodegenUtil.kt +++ b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/jvm/JVMCodegenUtil.kt @@ -9,6 +9,7 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.codegen.* import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.js.resolve.diagnostics.findPsi +import org.jetbrains.kotlin.load.java.JvmAbi import org.jetbrains.kotlin.load.kotlin.TypeMappingMode import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.Name @@ -25,10 +26,12 @@ import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.DE import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.ENCODER_CLASS import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.KSERIALIZER_CLASS import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.MISSING_FIELD_EXC +import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.PLUGIN_EXCEPTIONS_FILE import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.SERIAL_CTOR_MARKER_NAME import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.SERIAL_DESCRIPTOR_CLASS import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.SERIAL_DESCRIPTOR_CLASS_IMPL import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.SERIAL_DESCRIPTOR_FOR_ENUM +import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.SERIAL_DESC_FIELD import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.SERIAL_EXC import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.SERIAL_LOADER_CLASS import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.SERIAL_SAVER_CLASS @@ -50,7 +53,7 @@ internal val kOutputType = Type.getObjectType("kotlinx/serialization/encoding/$S internal val encoderType = Type.getObjectType("kotlinx/serialization/encoding/$ENCODER_CLASS") internal val decoderType = Type.getObjectType("kotlinx/serialization/encoding/$DECODER_CLASS") internal val kInputType = Type.getObjectType("kotlinx/serialization/encoding/$STRUCTURE_DECODER_CLASS") - +internal val pluginUtilsType = Type.getObjectType("kotlinx/serialization/internal/${PLUGIN_EXCEPTIONS_FILE}Kt") internal val kSerialSaverType = Type.getObjectType("kotlinx/serialization/$SERIAL_SAVER_CLASS") internal val kSerialLoaderType = Type.getObjectType("kotlinx/serialization/$SERIAL_LOADER_CLASS") @@ -61,6 +64,9 @@ internal val serializationExceptionName = "kotlinx/serialization/$SERIAL_EXC" internal val serializationExceptionMissingFieldName = "kotlinx/serialization/$MISSING_FIELD_EXC" internal val serializationExceptionUnknownIndexName = "kotlinx/serialization/$UNKNOWN_FIELD_EXC" +internal val descriptorGetterName = JvmAbi.getterName(SERIAL_DESC_FIELD) + + val OPT_MASK_TYPE: Type = Type.INT_TYPE val OPT_MASK_BITS = 32 diff --git a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/jvm/SerializableCodegenImpl.kt b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/jvm/SerializableCodegenImpl.kt index 15d988a8155..946c85ee490 100644 --- a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/jvm/SerializableCodegenImpl.kt +++ b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/jvm/SerializableCodegenImpl.kt @@ -28,10 +28,15 @@ import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperClassOrAny import org.jetbrains.kotlin.resolve.descriptorUtil.module +import org.jetbrains.kotlin.resolve.jvm.diagnostics.OtherOrigin import org.jetbrains.kotlinx.serialization.compiler.backend.common.* import org.jetbrains.kotlinx.serialization.compiler.diagnostic.serializableAnnotationIsUseless import org.jetbrains.kotlinx.serialization.compiler.resolve.* +import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.ARRAY_MASK_FIELD_MISSING_FUNC_NAME +import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.SINGLE_MASK_FIELD_MISSING_FUNC_NAME +import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.initializedDescriptorFieldName import org.jetbrains.org.objectweb.asm.Label +import org.jetbrains.org.objectweb.asm.Opcodes import org.jetbrains.org.objectweb.asm.Type import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter @@ -179,20 +184,28 @@ class SerializableCodegenImpl( } private fun InstructionAdapter.doGenerateConstructorImpl(exprCodegen: ExpressionCodegen) { - val seenMask = 1 - val bitMaskOff = fun(it: Int): Int { return seenMask + bitMaskSlotAt(it) } - val bitMaskEnd = seenMask + properties.serializableProperties.bitMaskSlotCount() - var (propIndex, propOffset) = generateSuperSerializableCall(bitMaskEnd) + val seenMaskVar = 1 + val bitMaskOff = fun(it: Int): Int { return seenMaskVar + bitMaskSlotAt(it) } + val bitMaskEnd = seenMaskVar + properties.serializableProperties.bitMaskSlotCount() + + if (useFieldMissingOptimization) { + generateOptimizedGoldenMaskCheck(seenMaskVar) + } + + var (propIndex, propOffset) = generateSuperSerializableCall(seenMaskVar, bitMaskEnd) for (i in propIndex until properties.serializableProperties.size) { val prop = properties[i] val propType = prop.asmType if (!prop.optional) { - // primary were validated before constructor call - genValidateProperty(i, bitMaskOff(i)) - val nonThrowLabel = Label() - ificmpne(nonThrowLabel) - genMissingFieldExceptionThrow(prop.name) - visitLabel(nonThrowLabel) + if (!useFieldMissingOptimization) { + // primary were validated before constructor call + genValidateProperty(i, bitMaskOff(i)) + val nonThrowLabel = Label() + ificmpne(nonThrowLabel) + genMissingFieldExceptionThrow(prop.name) + visitLabel(nonThrowLabel) + } + // setting field load(0, thisAsmType) load(propOffset, propType) @@ -237,7 +250,7 @@ class SerializableCodegenImpl( areturn(Type.VOID_TYPE) } - private fun InstructionAdapter.generateSuperSerializableCall(propStartVar: Int): Pair { + private fun InstructionAdapter.generateSuperSerializableCall(maskVar: Int, propStartVar: Int): Pair { val superClass = serializableDescriptor.getSuperClassOrAny() val superType = classCodegen.typeMapper.mapType(superClass).internalName @@ -261,12 +274,112 @@ class SerializableCodegenImpl( return 0 to propStartVar } else { val superProps = bindingContext.serializablePropertiesFor(superClass).serializableProperties - val creator = buildInternalConstructorDesc(propStartVar, 1, classCodegen, superProps) + val creator = buildInternalConstructorDesc(propStartVar, maskVar, classCodegen, superProps) invokespecial(superType, "", creator, false) return superProps.size to propStartVar + superProps.sumBy { it.asmType.size } } } + private fun InstructionAdapter.generateOptimizedGoldenMaskCheck(maskVar: Int) { + if (serializableDescriptor.isAbstractSerializableClass() || serializableDescriptor.isSealedSerializableClass()) { + // for abstract classes fields MUST BE checked in child classes + return + } + + val allPresentsLabel = Label() + val maskSlotCount = properties.serializableProperties.bitMaskSlotCount() + if (maskSlotCount == 1) { + val goldenMask = getGoldenMask() + + iconst(goldenMask) + dup() + load(maskVar, OPT_MASK_TYPE) + and(OPT_MASK_TYPE) + ificmpeq(allPresentsLabel) + + load(maskVar, OPT_MASK_TYPE) + iconst(goldenMask) + + stackSerialDescriptor() + invokestatic( + pluginUtilsType.internalName, + SINGLE_MASK_FIELD_MISSING_FUNC_NAME.asString(), + "(II${descType.descriptor})V", + false + ) + } else { + val fieldsMissingLabel = Label() + + val goldenMaskList = getGoldenMaskList() + goldenMaskList.forEachIndexed { i, goldenMask -> + val maskIndex = maskVar + i + // if( (goldenMask & seen) != goldenMask ) + iconst(goldenMask) + dup() + load(maskIndex, OPT_MASK_TYPE) + and(OPT_MASK_TYPE) + ificmpne(fieldsMissingLabel) + } + goTo(allPresentsLabel) + + visitLabel(fieldsMissingLabel) + // prepare seen array + fillArray(OPT_MASK_TYPE, goldenMaskList) { i, _ -> + load(maskVar + i, OPT_MASK_TYPE) + } + // prepare golden mask array + fillArray(OPT_MASK_TYPE, goldenMaskList) { _, goldenMask -> + iconst(goldenMask) + } + stackSerialDescriptor() + invokestatic( + pluginUtilsType.internalName, + ARRAY_MASK_FIELD_MISSING_FUNC_NAME.asString(), + "([I[I${descType.descriptor})V", + false + ) + } + visitLabel(allPresentsLabel) + } + + private fun InstructionAdapter.stackSerialDescriptor() { + if (serializableDescriptor.shouldHaveGeneratedSerializer && staticDescriptor) { + val serializer = serializableDescriptor.classSerializer!! + StackValue.singleton(serializer, classCodegen.typeMapper).put(kSerializerType, this) + invokeinterface(kSerializerType.internalName, descriptorGetterName, "()${descType.descriptor}") + } else { + generateStaticDescriptorField() + + getstatic(thisAsmType.internalName, initializedDescriptorFieldName, descType.descriptor) + } + } + + private fun generateStaticDescriptorField() { + val flags = Opcodes.ACC_PRIVATE or Opcodes.ACC_FINAL or Opcodes.ACC_SYNTHETIC or Opcodes.ACC_STATIC + classCodegen.v.newField( + OtherOrigin(classCodegen.myClass.psiOrParent), flags, + initializedDescriptorFieldName, descType.descriptor, null, null + ) + + val clInit = classCodegen.createOrGetClInitCodegen() + with(clInit.v) { + anew(descImplType) + dup() + aconst(serializableDescriptor.serialName()) + aconst(null) + aconst(properties.serializableProperties.size) + invokespecial(descImplType.internalName, "", "(Ljava/lang/String;${generatedSerializerType.descriptor}I)V", false) + for (property in properties.serializableProperties) { + dup() + aconst(property.name) + iconst(if (property.optional) 1 else 0) + invokevirtual(descImplType.internalName, CallingConventions.addElement, "(Ljava/lang/String;Z)V", false) + } + + putstatic(thisAsmType.internalName, initializedDescriptorFieldName, descType.descriptor) + } + } + private fun ExpressionCodegen.genInitProperty(prop: SerializableProperty) = getProp(prop)?.let { classCodegen.initializeProperty(this, it) } diff --git a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/diagnostic/VersionReader.kt b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/diagnostic/VersionReader.kt index 749b0a74862..22137b76b2f 100644 --- a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/diagnostic/VersionReader.kt +++ b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/diagnostic/VersionReader.kt @@ -10,6 +10,7 @@ import org.jetbrains.kotlin.config.ApiVersion import org.jetbrains.kotlin.config.KotlinCompilerVersion import org.jetbrains.kotlin.descriptors.ModuleDescriptor import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinarySourceElement +import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.BindingTrace import org.jetbrains.kotlin.util.slicedMap.Slices import org.jetbrains.kotlin.util.slicedMap.WritableSlice @@ -50,6 +51,11 @@ object VersionReader { return versions } + fun getVersionsForCurrentModuleFromContext(module: ModuleDescriptor, context: BindingContext): RuntimeVersions? { + context.get(VERSIONS_SLICE, module)?.let { return it } + return getVersionsForCurrentModule(module) + } + fun getVersionsForCurrentModule(module: ModuleDescriptor): RuntimeVersions? { val markerClass = module.getClassFromSerializationPackage(SerialEntityNames.KSERIALIZER_CLASS) val location = (markerClass.source as? KotlinJvmBinarySourceElement)?.binaryClass?.location ?: return null @@ -59,4 +65,4 @@ object VersionReader { if (!file.exists()) return null return getVersionsFromManifest(file) } -} \ No newline at end of file +} diff --git a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/resolve/NamingConventions.kt b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/resolve/NamingConventions.kt index dab16d9f867..2d99e69c211 100644 --- a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/resolve/NamingConventions.kt +++ b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/resolve/NamingConventions.kt @@ -44,6 +44,8 @@ object SerialEntityNames { const val LOAD = "deserialize" const val SERIALIZER_CLASS = "\$serializer" + const val initializedDescriptorFieldName = "\$initializedDescriptor" + // classes val KSERIALIZER_NAME = Name.identifier(KSERIALIZER_CLASS) val SERIAL_CTOR_MARKER_NAME = Name.identifier("SerializationConstructorMarker") @@ -68,6 +70,8 @@ object SerialEntityNames { const val SERIAL_DESCRIPTOR_CLASS_IMPL = "PluginGeneratedSerialDescriptor" const val SERIAL_DESCRIPTOR_FOR_ENUM = "EnumDescriptor" + const val PLUGIN_EXCEPTIONS_FILE = "PluginExceptions" + //exceptions const val SERIAL_EXC = "SerializationException" const val MISSING_FIELD_EXC = "MissingFieldException" @@ -81,6 +85,10 @@ object SerialEntityNames { val TYPE_PARAMS_SERIALIZERS_GETTER = Name.identifier("typeParametersSerializers") val WRITE_SELF_NAME = Name.identifier("write\$Self") val SERIALIZER_PROVIDER_NAME = Name.identifier("serializer") + val SINGLE_MASK_FIELD_MISSING_FUNC_NAME = Name.identifier("throwMissingFieldException") + val ARRAY_MASK_FIELD_MISSING_FUNC_NAME = Name.identifier("throwArrayMissingFieldException") + val SINGLE_MASK_FIELD_MISSING_FUNC_FQ = SerializationPackages.internalPackageFqName.child(SINGLE_MASK_FIELD_MISSING_FUNC_NAME) + val ARRAY_MASK_FIELD_MISSING_FUNC_FQ = SerializationPackages.internalPackageFqName.child(ARRAY_MASK_FIELD_MISSING_FUNC_NAME) // parameters val dummyParamName = Name.identifier("serializationConstructorMarker") diff --git a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/resolve/SearchUtils.kt b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/resolve/SearchUtils.kt index 7f200d55457..660de3a9e0f 100644 --- a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/resolve/SearchUtils.kt +++ b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/resolve/SearchUtils.kt @@ -82,6 +82,16 @@ internal fun ModuleDescriptor.getClassFromInternalSerializationPackage(classSimp ) ) { "Can't locate class $classSimpleName from package ${SerializationPackages.internalPackageFqName}" } +internal fun ModuleDescriptor.getClassFromSerializationDescriptorsPackage(classSimpleName: String) = + requireNotNull( + findClassAcrossModuleDependencies( + ClassId( + SerializationPackages.descriptorsPackageFqName, + Name.identifier(classSimpleName) + ) + ) + ) { "Can't locate class $classSimpleName from package ${SerializationPackages.descriptorsPackageFqName}" } + internal fun getSerializationPackageFqn(classSimpleName: String): FqName = SerializationPackages.packageFqName.child(Name.identifier(classSimpleName)) From 8f187f328ad73d81d9859e7de4e829d119bfffd2 Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Wed, 25 Nov 2020 08:16:11 +0100 Subject: [PATCH 124/698] Switch ASM artifact --- .../build.gradle.kts | 2 +- .../incapt/IncrementalBinaryIsolatingProcessor.java | 10 +++++----- .../kotlin/gradle/KaptIncrementalWithIsolatingApt.kt | 2 +- .../build.gradle | 5 ++++- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle.kts b/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle.kts index 545746fd04b..48ba118ee31 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle.kts +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle.kts @@ -45,7 +45,7 @@ dependencies { // Workaround for missing transitive import of the common(project `kotlin-test-common` // for `kotlin-test-jvm` into the IDE: testCompileOnly(project(":kotlin-test:kotlin-test-common")) { isTransitive = false } - testCompileOnly("org.ow2.asm:asm:9.0") + testCompileOnly("org.jetbrains.intellij.deps:asm-all:9.0") } // Aapt2 from Android Gradle Plugin 3.2 and below does not handle long paths on Windows. diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/java/org/jetbrains/kotlin/gradle/incapt/IncrementalBinaryIsolatingProcessor.java b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/java/org/jetbrains/kotlin/gradle/incapt/IncrementalBinaryIsolatingProcessor.java index 3d80ceb23ef..dd3f067670c 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/java/org/jetbrains/kotlin/gradle/incapt/IncrementalBinaryIsolatingProcessor.java +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/java/org/jetbrains/kotlin/gradle/incapt/IncrementalBinaryIsolatingProcessor.java @@ -5,9 +5,9 @@ package org.jetbrains.kotlin.gradle.incapt; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.Type; +import org.jetbrains.org.objectweb.asm.ClassWriter; +import org.jetbrains.org.objectweb.asm.Opcodes; +import org.jetbrains.org.objectweb.asm.Type; import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.RoundEnvironment; @@ -20,8 +20,8 @@ import java.io.OutputStream; import java.util.Collections; import java.util.Set; -import static org.objectweb.asm.Opcodes.ACC_PUBLIC; -import static org.objectweb.asm.Opcodes.ACC_SUPER; +import static org.jetbrains.org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static org.jetbrains.org.objectweb.asm.Opcodes.ACC_SUPER; /** Simple processor that generates a class for every annotated element (class, field, method). */ public class IncrementalBinaryIsolatingProcessor extends AbstractProcessor { diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt index 71e9ec7c981..30a7a13dbc2 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt @@ -218,7 +218,7 @@ fun BaseGradleIT.Project.setupIncrementalAptProject( val processorPath = generateProcessor(*processors) val updatedContent = content.replace( - Regex("^\\s*kapt\\s\"org\\.jetbrain.*$", RegexOption.MULTILINE), + Regex("^\\s*kapt\\s\"org\\.jetbrains\\.kotlin.*$", RegexOption.MULTILINE), " kapt files(\"${processorPath.invariantSeparatorsPath}\")" ) buildFile.writeText(updatedContent) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalAggregatingProcessorProject/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalAggregatingProcessorProject/build.gradle index dd8fa25bfdc..f1f80a4ca42 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalAggregatingProcessorProject/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalAggregatingProcessorProject/build.gradle @@ -15,12 +15,15 @@ apply plugin: "kotlin-kapt" repositories { jcenter() mavenLocal() + maven { + url "https://jetbrains.bintray.com/intellij-third-party-dependencies/" + } } dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version" kapt "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version" - kapt "org.ow2.asm:asm:9.0" + kapt "org.jetbrains.intellij.deps:asm-all:9.0" testImplementation 'junit:junit:4.12' } \ No newline at end of file From 6241f9be2db081f14977e7e021f4412508ac31f5 Mon Sep 17 00:00:00 2001 From: Vyacheslav Gerasimov Date: Tue, 24 Nov 2020 00:30:02 +0300 Subject: [PATCH 125/698] Build: Fix ide plugin maven artifacts publication --- gradle/kotlinPluginPublication.gradle.kts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gradle/kotlinPluginPublication.gradle.kts b/gradle/kotlinPluginPublication.gradle.kts index 94b2179e3f2..2ee60686610 100644 --- a/gradle/kotlinPluginPublication.gradle.kts +++ b/gradle/kotlinPluginPublication.gradle.kts @@ -6,8 +6,6 @@ configure { val artifactName = if (project.name == "idea-plugin") "kotlin-plugin" else project.name artifactId = "$artifactName-${IdeVersionConfigurator.currentIde.name.toLowerCase()}" from(components["java"]) - artifact(tasks["sourcesJar"]) - artifact(tasks["javadocJar"]) pom { name.set("${project.group}:$artifactId") @@ -53,6 +51,10 @@ configure { } } +tasks.withType { + enabled = false +} + // Disable default `publish` task so publishing will not be done during maven artifact publish // We should use specialized tasks since we have multiple publications in project tasks.named("publish") { From d2022ab115f4a137ff6440e986817802ceff975c Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Thu, 5 Nov 2020 02:45:28 +0300 Subject: [PATCH 126/698] [IR] hack AbstractIrTextTestCase to test dumpKotlinLike --- .../kotlin/ir/AbstractIrTextTestCase.kt | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt index 0c171474100..343146a7b2e 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt @@ -1,17 +1,6 @@ /* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.ir @@ -39,6 +28,7 @@ import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.scripting.compiler.plugin.loadScriptConfiguration import org.jetbrains.kotlin.test.KotlinTestUtils import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase +import org.jetbrains.kotlin.utils.fileUtils.withReplacedExtensionOrNull import org.jetbrains.kotlin.utils.rethrow import java.io.File import java.util.regex.Pattern @@ -123,6 +113,20 @@ abstract class AbstractIrTextTestCase : AbstractIrGeneratorTestCase() { KotlinTestUtils.assertEqualsToFile(irTreeFileLabel.expectedTextFile, actualTrees) verify(irFile) + val kotlinLikeDump = irFile.dumpKotlinLike( + KotlinLikeDumpOptions( + printFileName = false, + printFilePath = false, + printFakeOverridesStrategy = FakeOverridesStrategy.NONE + ) + ) + val kotlinLikeDumpExpectedFile = irTreeFileLabel.expectedTextFile.withReplacedExtensionOrNull(".txt", ".kt.txt")!! +// KotlinTestUtils.assertEqualsToFile(kotlinLikeDumpExpectedFile, kotlinLikeDump) + + val kotlinLikeDumpExpectedText = if (kotlinLikeDumpExpectedFile.exists()) kotlinLikeDumpExpectedFile.readText() else "" + kotlinLikeDumpExpectedFile.writeText(kotlinLikeDump) + assertEquals(kotlinLikeDumpExpectedText, kotlinLikeDump) + // Check that deep copy produces an equivalent result val irFileCopy = irFile.deepCopyWithSymbols() val copiedTrees = irFileCopy.dumpTreesFromLineNumber(irTreeFileLabel.lineNumber, normalizeNames = true) From 8d5facb15f51938ef3f8ef382cbfce481dd4776c Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Thu, 5 Nov 2020 02:47:53 +0300 Subject: [PATCH 127/698] [IR] add testdata for dumpKotlinLike --- .../ir/irText/classes/abstractMembers.kt.txt | 34 +++ .../irText/classes/annotationClasses.kt.txt | 44 +++ ...orderingInDelegatingConstructorCall.kt.txt | 54 ++++ .../ir/irText/classes/classMembers.kt.txt | 93 +++++++ .../testData/ir/irText/classes/classes.kt.txt | 57 ++++ .../ir/irText/classes/companionObject.kt.txt | 48 ++++ .../classes/dataClassWithArrayMembers.kt.txt | 253 ++++++++++++++++++ .../ir/irText/classes/dataClasses.kt.txt | 217 +++++++++++++++ .../irText/classes/dataClassesGeneric.kt.txt | 187 +++++++++++++ .../delegatedGenericImplementation.kt.txt | 79 ++++++ .../classes/delegatedImplementation.kt.txt | 168 ++++++++++++ ...dImplementationWithExplicitOverride.kt.txt | 46 ++++ ...nstructorCallToTypeAliasConstructor.kt.txt | 42 +++ ...tructorCallsInSecondaryConstructors.kt.txt | 34 +++ .../testData/ir/irText/classes/enum.kt.txt | 150 +++++++++++ .../irText/classes/enumClassModality.kt.txt | 159 +++++++++++ .../classes/enumWithMultipleCtors.kt.txt | 54 ++++ .../classes/enumWithSecondaryCtor.kt.txt | 85 ++++++ .../fakeOverridesForJavaStaticMembers.kt.txt | 14 + ...citNotNullOnDelegatedImplementation.kt.txt | 150 +++++++++++ .../ir/irText/classes/initBlock.kt.txt | 104 +++++++ .../testData/ir/irText/classes/initVal.kt.txt | 51 ++++ .../ir/irText/classes/initValInLambda.kt.txt | 22 ++ .../testData/ir/irText/classes/initVar.kt.txt | 114 ++++++++ .../ir/irText/classes/inlineClass.kt.txt | 35 +++ .../inlineClassSyntheticMethods.kt.txt | 66 +++++ .../ir/irText/classes/innerClass.kt.txt | 36 +++ ...innerClassWithDelegatingConstructor.kt.txt | 32 +++ .../testData/ir/irText/classes/kt31649.kt.txt | 87 ++++++ .../lambdaInDataClassDefaultParameter.kt.txt | 110 ++++++++ .../ir/irText/classes/localClasses.kt.txt | 20 ++ .../classes/objectLiteralExpressions.kt.txt | 120 +++++++++ .../classes/objectWithInitializers.kt.txt | 35 +++ .../ir/irText/classes/outerClassAccess.kt.txt | 52 ++++ .../irText/classes/primaryConstructor.kt.txt | 63 +++++ ...ConstructorWithSuperConstructorCall.kt.txt | 60 +++++ .../irText/classes/qualifiedSuperCalls.kt.txt | 50 ++++ .../ir/irText/classes/sealedClasses.kt.txt | 60 +++++ ...ructorWithInitializersFromClassBody.kt.txt | 57 ++++ .../classes/secondaryConstructors.kt.txt | 16 ++ .../ir/irText/classes/superCalls.kt.txt | 43 +++ .../irText/classes/superCallsComposed.kt.txt | 50 ++++ .../annotationsInAnnotationArguments.kt.txt | 38 +++ ...notationsWithDefaultParameterValues.kt.txt | 35 +++ .../annotationsWithVarargParameters.kt.txt | 23 ++ .../arrayInAnnotationArguments.kt.txt | 32 +++ .../classLiteralInAnnotation.kt.txt | 27 ++ .../annotations/classesWithAnnotations.kt.txt | 98 +++++++ ...nstExpressionsInAnnotationArguments.kt.txt | 23 ++ .../constructorsWithAnnotations.kt.txt | 29 ++ .../delegateFieldWithAnnotations.kt.txt | 16 ++ ...tedPropertyAccessorsWithAnnotations.kt.txt | 54 ++++ .../enumEntriesWithAnnotations.kt.txt | 33 +++ .../enumsInAnnotationArguments.kt.txt | 35 +++ .../annotations/fieldsWithAnnotations.kt.txt | 20 ++ .../annotations/fileAnnotations.kt.txt | 15 ++ .../functionsWithAnnotations.kt.txt | 15 ++ .../annotations/javaAnnotation.kt.txt | 12 + ...lDelegatedPropertiesWithAnnotations.kt.txt | 25 ++ ...multipleAnnotationsInSquareBrackets.kt.txt | 27 ++ ...ConstructorParameterWithAnnotations.kt.txt | 23 ++ .../propertiesWithAnnotations.kt.txt | 16 ++ ...ssorsFromClassHeaderWithAnnotations.kt.txt | 35 +++ .../propertyAccessorsWithAnnotations.kt.txt | 38 +++ ...pertySetterParameterWithAnnotations.kt.txt | 29 ++ .../receiverParameterWithAnnotations.kt.txt | 37 +++ ...spreadOperatorInAnnotationArguments.kt.txt | 15 ++ .../typeAliasesWithAnnotations.kt.txt | 14 + .../typeParametersWithAnnotations.kt.txt | 11 + .../valueParametersWithAnnotations.kt.txt | 30 +++ .../varargsInAnnotationArguments.kt.txt | 45 ++++ .../variablesWithAnnotations.kt.txt | 18 ++ .../catchParameterInTopLevelProperty.kt.txt | 8 + .../declarations/classLevelProperties.kt.txt | 60 +++++ .../declarations/constValInitializers.kt.txt | 28 ++ .../declarations/defaultArguments.kt.txt | 7 + .../declarations/delegatedProperties.kt.txt | 52 ++++ .../declarations/deprecatedProperty.kt.txt | 67 +++++ .../declarations/extensionProperties.kt.txt | 36 +++ .../irText/declarations/fakeOverrides.kt.txt | 48 ++++ .../declarations/fileWithAnnotations.kt.txt | 9 + .../fileWithTypeAliasesOnly.kt.txt | 1 + .../genericDelegatedProperty.kt.txt | 40 +++ .../declarations/interfaceProperties.kt.txt | 25 ++ .../ir/irText/declarations/kt27005.kt.txt | 12 + .../ir/irText/declarations/kt29833.kt.txt | 22 ++ .../ir/irText/declarations/kt35550.kt.txt | 29 ++ .../localClassWithOverrides.kt.txt | 49 ++++ .../localDelegatedProperties.kt.txt | 34 +++ .../declarations/localVarInDoWhile.kt.txt | 8 + .../multiplatform/expectClassInherited.kt.txt | 48 ++++ .../multiplatform/expectedEnumClass.kt.txt | 36 +++ .../multiplatform/expectedSealedClass.kt.txt | 38 +++ .../packageLevelProperties.kt.txt | 48 ++++ .../declarations/parameters/class.kt.txt | 48 ++++ .../parameters/constructor.kt.txt | 96 +++++++ .../parameters/dataClassMembers.kt.txt | 63 +++++ .../defaultPropertyAccessors.kt.txt | 51 ++++ .../parameters/delegatedMembers.kt.txt | 37 +++ .../irText/declarations/parameters/fun.kt.txt | 30 +++ .../parameters/genericInnerClass.kt.txt | 27 ++ .../declarations/parameters/lambdas.kt.txt | 27 ++ .../declarations/parameters/localFun.kt.txt | 19 ++ .../parameters/propertyAccessors.kt.txt | 84 ++++++ .../typeParameterBeforeBound.kt.txt | 21 ++ .../typeParameterBoundedBySubclass.kt.txt | 52 ++++ .../parameters/useNextParamInLambda.kt.txt | 28 ++ .../primaryCtorDefaultArguments.kt.txt | 16 ++ .../declarations/primaryCtorProperties.kt.txt | 21 ++ .../provideDelegate/differentReceivers.kt.txt | 40 +++ .../declarations/provideDelegate/local.kt.txt | 50 ++++ .../localDifferentReceivers.kt.txt | 43 +++ .../provideDelegate/member.kt.txt | 58 ++++ .../provideDelegate/memberExtension.kt.txt | 46 ++++ .../provideDelegate/topLevel.kt.txt | 46 ++++ .../ir/irText/declarations/typeAlias.kt.txt | 20 ++ .../errors/suppressedNonPublicCall.kt.txt | 19 ++ .../irText/errors/unresolvedReference.kt.txt | 16 ++ .../argumentMappedWithError.kt.txt | 12 + .../ir/irText/expressions/arrayAccess.kt.txt | 12 + .../irText/expressions/arrayAssignment.kt.txt | 13 + .../arrayAugmentedAssignment1.kt.txt | 51 ++++ .../arrayAugmentedAssignment2.kt.txt | 22 ++ .../ir/irText/expressions/assignments.kt.txt | 27 ++ .../expressions/augmentedAssignment1.kt.txt | 32 +++ .../expressions/augmentedAssignment2.kt.txt | 58 ++++ .../augmentedAssignmentWithExpression.kt.txt | 35 +++ .../expressions/badBreakContinue.kt.txt | 29 ++ .../ir/irText/expressions/bangbang.kt.txt | 30 +++ .../booleanConstsInAndAndOrOr.kt.txt | 14 + .../expressions/booleanOperators.kt.txt | 22 ++ .../boundCallableReferences.kt.txt | 34 +++ .../ir/irText/expressions/boxOk.kt.txt | 4 + .../irText/expressions/breakContinue.kt.txt | 51 ++++ .../breakContinueInLoopHeader.kt.txt | 83 ++++++ .../expressions/breakContinueInWhen.kt.txt | 82 ++++++ .../callWithReorderedArguments.kt.txt | 32 +++ .../adaptedExtensionFunctions.kt.txt | 45 ++++ .../adaptedWithCoercionToUnit.kt.txt | 46 ++++ .../boundInlineAdaptedReference.kt.txt | 20 ++ .../boundInnerGenericConstructor.kt.txt | 44 +++ .../caoWithAdaptationForSam.kt.txt | 117 ++++++++ .../constructorWithAdaptedArguments.kt.txt | 70 +++++ ...ithDefaultParametersAsKCallableStar.kt.txt | 47 ++++ .../callableReferences/genericMember.kt.txt | 27 ++ .../importedFromObject.kt.txt | 38 +++ .../callableReferences/kt37131.kt.txt | 38 +++ .../suspendConversion.kt.txt | 105 ++++++++ .../callableReferences/typeArguments.kt.txt | 33 +++ ...MemberReferenceWithAdaptedArguments.kt.txt | 67 +++++ .../withAdaptationForSam.kt.txt | 21 ++ .../withAdaptedArguments.kt.txt | 85 ++++++ .../withArgumentAdaptationAndReceiver.kt.txt | 79 ++++++ .../withVarargViewedAsArray.kt.txt | 53 ++++ .../ir/irText/expressions/calls.kt.txt | 24 ++ .../expressions/castToTypeParameter.kt.txt | 51 ++++ .../expressions/catchParameterAccess.kt.txt | 10 + .../expressions/chainOfSafeCalls.kt.txt | 48 ++++ .../irText/expressions/classReference.kt.txt | 19 ++ .../irText/expressions/coercionToUnit.kt.txt | 28 ++ .../complexAugmentedAssignment.kt.txt | 133 +++++++++ ...onstructorWithOwnTypeParametersCall.kt.txt | 32 +++ .../irText/expressions/contructorCall.kt.txt | 16 ++ .../expressions/conventionComparisons.kt.txt | 29 ++ .../irText/expressions/destructuring1.kt.txt | 40 +++ .../destructuringWithUnderscore.kt.txt | 44 +++ .../ir/irText/expressions/dotQualified.kt.txt | 14 + .../ir/irText/expressions/elvis.kt.txt | 64 +++++ .../expressions/enumEntryAsReceiver.kt.txt | 27 ++ ...numEntryReferenceFromEnumEntryClass.kt.txt | 20 ++ .../ir/irText/expressions/equality.kt.txt | 12 + .../ir/irText/expressions/equals.kt.txt | 16 ++ .../expressions/extFunInvokeAsFun.kt.txt | 8 + .../expressions/extFunSafeInvoke.kt.txt | 10 + .../extensionPropertyGetterCall.kt.txt | 9 + .../ir/irText/expressions/field.kt.txt | 14 + .../comparableWithDoubleOrFloat.kt.txt | 20 ++ ...qeqRhsConditionPossiblyAffectingLhs.kt.txt | 7 + .../floatingPointCompareTo.kt.txt | 80 ++++++ .../floatingPointEqeq.kt.txt | 86 ++++++ .../floatingPointEquals.kt.txt | 116 ++++++++ .../floatingPointExcleq.kt.txt | 86 ++++++ .../floatingPointLess.kt.txt | 62 +++++ .../nullableAnyAsIntToDouble.kt.txt | 13 + .../nullableFloatingPointEqeq.kt.txt | 46 ++++ ...ameterWithPrimitiveNumericSupertype.kt.txt | 68 +++++ .../whenByFloatingPoint.kt.txt | 80 ++++++ .../testData/ir/irText/expressions/for.kt.txt | 45 ++++ .../expressions/forWithBreakContinue.kt.txt | 70 +++++ .../forWithImplicitReceivers.kt.txt | 66 +++++ .../expressions/funImportedFromObject.kt.txt | 22 ++ .../arrayAsVarargAfterSamArgument_fi.kt.txt | 58 ++++ .../basicFunInterfaceConversion.kt.txt | 18 ++ .../funInterface/castFromAny.kt.txt | 12 + .../funInterface/partialSam.kt.txt | 80 ++++++ .../samConversionInVarargs.kt.txt | 41 +++ .../samConversionInVarargsMixed.kt.txt | 21 ++ .../samConversionOnCallableReference.kt.txt | 39 +++ .../samConversionsWithSmartCasts.kt.txt | 80 ++++++ ...ricConstructorCallWithTypeArguments.kt.txt | 24 ++ .../expressions/genericPropertyCall.kt.txt | 9 + .../expressions/genericPropertyRef.kt.txt | 77 ++++++ .../ir/irText/expressions/identity.kt.txt | 12 + .../ir/irText/expressions/ifElseIf.kt.txt | 40 +++ ...implicitCastInReturnFromConstructor.kt.txt | 19 ++ .../implicitCastOnPlatformType.kt.txt | 4 + .../expressions/implicitCastToNonNull.kt.txt | 34 +++ .../implicitCastToTypeParameter.kt.txt | 41 +++ ...citNotNullInDestructuringAssignment.kt.txt | 16 ++ .../testData/ir/irText/expressions/in.kt.txt | 16 ++ .../expressions/incrementDecrement.kt.txt | 98 +++++++ .../expressions/interfaceThisRef.kt.txt | 11 + .../javaSyntheticGenericPropertyAccess.kt.txt | 17 ++ .../javaSyntheticPropertyAccess.kt.txt | 17 ++ .../jvmFieldWithIntersectionTypes.kt.txt | 85 ++++++ .../jvmInstanceFieldReference.kt.txt | 24 ++ .../jvmStaticFieldReference.kt.txt | 38 +++ .../ir/irText/expressions/kt16904.kt.txt | 72 +++++ .../ir/irText/expressions/kt16905.kt.txt | 53 ++++ .../ir/irText/expressions/kt23030.kt.txt | 58 ++++ .../ir/irText/expressions/kt24804.kt.txt | 27 ++ .../ir/irText/expressions/kt27933.kt.txt | 13 + .../ir/irText/expressions/kt28006.kt.txt | 40 +++ .../ir/irText/expressions/kt28456.kt.txt | 43 +++ .../ir/irText/expressions/kt28456a.kt.txt | 19 ++ .../ir/irText/expressions/kt28456b.kt.txt | 41 +++ .../ir/irText/expressions/kt30020.kt.txt | 90 +++++++ .../ir/irText/expressions/kt30796.kt.txt | 86 ++++++ .../ir/irText/expressions/kt35730.kt.txt | 27 ++ .../ir/irText/expressions/kt36956.kt.txt | 37 +++ .../ir/irText/expressions/kt36963.kt.txt | 7 + .../ir/irText/expressions/kt37570.kt.txt | 26 ++ .../ir/irText/expressions/kt37779.kt.txt | 11 + .../ir/irText/expressions/lambdaInCAO.kt.txt | 41 +++ .../ir/irText/expressions/literals.kt.txt | 68 +++++ .../expressions/memberTypeArguments.kt.txt | 20 ++ .../membersImportedFromObject.kt.txt | 45 ++++ .../expressions/multipleThisReferences.kt.txt | 67 +++++ .../nullCheckOnGenericLambdaReturn.kt.txt | 48 ++++ .../nullCheckOnLambdaReturn.kt.txt | 54 ++++ .../expressions/objectAsCallable.kt.txt | 48 ++++ .../expressions/objectClassReference.kt.txt | 17 ++ .../irText/expressions/objectReference.kt.txt | 103 +++++++ ...enceInClosureInSuperConstructorCall.kt.txt | 28 ++ .../objectReferenceInFieldInitializer.kt.txt | 25 ++ .../outerClassInstanceReference.kt.txt | 31 +++ .../expressions/primitiveComparisons.kt.txt | 96 +++++++ .../primitivesImplicitConversions.kt.txt | 53 ++++ .../expressions/propertyReferences.kt.txt | 138 ++++++++++ .../ir/irText/expressions/references.kt.txt | 39 +++ .../expressions/reflectionLiterals.kt.txt | 46 ++++ .../irText/expressions/safeAssignment.kt.txt | 27 ++ .../safeCallWithIncrementDecrement.kt.txt | 71 +++++ .../ir/irText/expressions/safeCalls.kt.txt | 91 +++++++ .../sam/arrayAsVarargAfterSamArgument.kt.txt | 45 ++++ .../sam/genericSamProjectedOut.kt.txt | 15 ++ .../expressions/sam/samByProjectedType.kt.txt | 7 + .../expressions/sam/samConstructors.kt.txt | 25 ++ ...mConversionInGenericConstructorCall.kt.txt | 9 + ...nversionInGenericConstructorCall_NI.kt.txt | 49 ++++ .../sam/samConversionToGeneric.kt.txt | 52 ++++ .../expressions/sam/samConversions.kt.txt | 30 +++ .../sam/samConversionsWithSmartCasts.kt.txt | 67 +++++ .../expressions/sam/samOperators.kt.txt | 18 ++ .../setFieldWithImplicitCast.kt.txt | 20 ++ ...nedToUnsignedConversions_annotation.kt.txt | 9 + .../signedToUnsignedConversions_test.kt.txt | 58 ++++ .../irText/expressions/simpleOperators.kt.txt | 44 +++ .../expressions/simpleUnaryOperators.kt.txt | 24 ++ .../ir/irText/expressions/smartCasts.kt.txt | 38 +++ .../smartCastsWithDestructuring.kt.txt | 31 +++ ...specializedTypeAliasConstructorCall.kt.txt | 21 ++ .../expressions/stringComparisons.kt.txt | 16 ++ .../ir/irText/expressions/stringPlus.kt.txt | 12 + .../irText/expressions/stringTemplates.kt.txt | 48 ++++ ...pendConversionOnArbitraryExpression.kt.txt | 177 ++++++++++++ .../temporaryInEnumEntryInitializer.kt.txt | 28 ++ .../expressions/temporaryInInitBlock.kt.txt | 25 ++ .../thisOfGenericOuterClass.kt.txt | 55 ++++ ...oObjectInNestedClassConstructorCall.kt.txt | 52 ++++ .../thisReferenceBeforeClassDeclared.kt.txt | 63 +++++ .../ir/irText/expressions/throw.kt.txt | 12 + .../ir/irText/expressions/tryCatch.kt.txt | 27 ++ .../tryCatchWithImplicitCast.kt.txt | 13 + .../typeAliasConstructorReference.kt.txt | 46 ++++ .../irText/expressions/typeArguments.kt.txt | 7 + .../irText/expressions/typeOperators.kt.txt | 22 ++ .../typeParameterClassLiteral.kt.txt | 38 +++ .../unsignedIntegerLiterals.kt.txt | 40 +++ .../expressions/useImportedMember.kt.txt | 114 ++++++++ .../ir/irText/expressions/values.kt.txt | 76 ++++++ .../ir/irText/expressions/vararg.kt.txt | 12 + .../expressions/varargWithImplicitCast.kt.txt | 14 + .../expressions/variableAsFunctionCall.kt.txt | 35 +++ .../variableAsFunctionCallWithGenerics.kt.txt | 24 ++ .../ir/irText/expressions/when.kt.txt | 67 +++++ .../expressions/whenCoercedToUnit.kt.txt | 9 + .../ir/irText/expressions/whenElse.kt.txt | 6 + .../ir/irText/expressions/whenReturn.kt.txt | 14 + .../irText/expressions/whenReturnUnit.kt.txt | 16 ++ .../expressions/whenUnusedExpression.kt.txt | 15 ++ .../whenWithSubjectVariable.kt.txt | 18 ++ .../ir/irText/expressions/whileDoWhile.kt.txt | 50 ++++ .../irText/firProblems/BaseFirBuilder.kt.txt | 16 ++ .../ir/irText/firProblems/FirBuilder.kt.txt | 26 ++ .../ir/irText/firProblems/deprecated.kt.txt | 14 + .../irText/lambdas/anonymousFunction.kt.txt | 7 + .../lambdas/destructuringInLambda.kt.txt | 69 +++++ .../ir/irText/lambdas/extensionLambda.kt.txt | 7 + .../ir/irText/lambdas/justLambda.kt.txt | 14 + .../ir/irText/lambdas/localFunction.kt.txt | 14 + .../lambdas/multipleImplicitReceivers.kt.txt | 58 ++++ .../ir/irText/lambdas/nonLocalReturn.kt.txt | 51 ++++ .../ir/irText/lambdas/samAdapter.kt.txt | 8 + .../irText/regressions/coercionInLoop.kt.txt | 18 ++ .../regressions/integerCoercionToT.kt.txt | 50 ++++ .../ir/irText/regressions/kt24114.kt.txt | 44 +++ .../newInference/fixationOrder1.kt.txt | 23 ++ .../typeAliasCtorForGenericClass.kt.txt | 23 ++ .../typeParametersInImplicitCast.kt.txt | 7 + .../ir/irText/singletons/companion.kt.txt | 31 +++ .../ir/irText/singletons/enumEntry.kt.txt | 20 ++ .../ir/irText/singletons/object.kt.txt | 31 +++ .../ir/irText/stubs/builtinMap.kt.txt | 10 + .../ir/irText/stubs/constFromBuiltins.kt.txt | 4 + .../genericClassInDifferentModule_m1.kt.txt | 25 ++ .../genericClassInDifferentModule_m2.kt.txt | 28 ++ .../javaConstructorWithTypeParameters.kt.txt | 16 ++ .../testData/ir/irText/stubs/javaEnum.kt.txt | 4 + .../ir/irText/stubs/javaInnerClass.kt.txt | 17 ++ .../ir/irText/stubs/javaMethod.kt.txt | 4 + .../ir/irText/stubs/javaNestedClass.kt.txt | 4 + .../ir/irText/stubs/javaStaticMethod.kt.txt | 4 + .../irText/stubs/javaSyntheticProperty.kt.txt | 4 + .../stubs/jdkClassSyntheticProperty.kt.txt | 5 + .../ir/irText/stubs/kotlinInnerClass.kt.txt | 4 + .../testData/ir/irText/stubs/simple.kt.txt | 4 + .../ir/irText/types/abbreviatedTypes.kt.txt | 18 ++ .../ir/irText/types/asOnPlatformType.kt.txt | 17 ++ .../castsInsideCoroutineInference.kt.txt | 164 ++++++++++++ .../coercionToUnitInLambdaReturnValue.kt.txt | 10 + .../types/genericDelegatedDeepProperty.kt.txt | 173 ++++++++++++ .../ir/irText/types/genericFunWithStar.kt.txt | 41 +++ .../types/genericPropertyReferenceType.kt.txt | 37 +++ .../inStarProjectionInReceiverType.kt.txt | 23 ++ .../irText/types/intersectionType1_NI.kt.txt | 30 +++ .../irText/types/intersectionType1_OI.kt.txt | 30 +++ .../irText/types/intersectionType2_NI.kt.txt | 53 ++++ .../irText/types/intersectionType2_OI.kt.txt | 53 ++++ .../irText/types/intersectionType3_NI.kt.txt | 78 ++++++ .../irText/types/intersectionType3_OI.kt.txt | 78 ++++++ .../testData/ir/irText/types/kt36143.kt.txt | 4 + .../localVariableOfIntersectionType_NI.kt.txt | 44 +++ .../nullChecks/enhancedNullability.kt.txt | 36 +++ ...ullabilityInDestructuringAssignment.kt.txt | 102 +++++++ .../enhancedNullabilityInForLoop.kt.txt | 138 ++++++++++ ...ompareToCallsOnPlatformTypeReceiver.kt.txt | 24 ++ .../implicitNotNullOnPlatformType.kt.txt | 46 ++++ ...abilityAssertionOnExtensionReceiver.kt.txt | 26 ++ .../nullChecks/platformTypeReceiver.kt.txt | 8 + .../types/receiverOfIntersectionType.kt.txt | 73 +++++ .../smartCastOnFakeOverrideReceiver.kt.txt | 102 +++++++ ...artCastOnFieldReceiverOfGenericType.kt.txt | 11 + .../smartCastOnReceiverOfGenericType.kt.txt | 69 +++++ .../ir/irText/types/starProjection_OI.kt.txt | 19 ++ 365 files changed, 15516 insertions(+) create mode 100644 compiler/testData/ir/irText/classes/abstractMembers.kt.txt create mode 100644 compiler/testData/ir/irText/classes/annotationClasses.kt.txt create mode 100644 compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.kt.txt create mode 100644 compiler/testData/ir/irText/classes/classMembers.kt.txt create mode 100644 compiler/testData/ir/irText/classes/classes.kt.txt create mode 100644 compiler/testData/ir/irText/classes/companionObject.kt.txt create mode 100644 compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt create mode 100644 compiler/testData/ir/irText/classes/dataClasses.kt.txt create mode 100644 compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt create mode 100644 compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt create mode 100644 compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt create mode 100644 compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt create mode 100644 compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.kt.txt create mode 100644 compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.kt.txt create mode 100644 compiler/testData/ir/irText/classes/enum.kt.txt create mode 100644 compiler/testData/ir/irText/classes/enumClassModality.kt.txt create mode 100644 compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt create mode 100644 compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt.txt create mode 100644 compiler/testData/ir/irText/classes/fakeOverridesForJavaStaticMembers.kt.txt create mode 100644 compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt create mode 100644 compiler/testData/ir/irText/classes/initBlock.kt.txt create mode 100644 compiler/testData/ir/irText/classes/initVal.kt.txt create mode 100644 compiler/testData/ir/irText/classes/initValInLambda.kt.txt create mode 100644 compiler/testData/ir/irText/classes/initVar.kt.txt create mode 100644 compiler/testData/ir/irText/classes/inlineClass.kt.txt create mode 100644 compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt create mode 100644 compiler/testData/ir/irText/classes/innerClass.kt.txt create mode 100644 compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.kt.txt create mode 100644 compiler/testData/ir/irText/classes/kt31649.kt.txt create mode 100644 compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt create mode 100644 compiler/testData/ir/irText/classes/localClasses.kt.txt create mode 100644 compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt create mode 100644 compiler/testData/ir/irText/classes/objectWithInitializers.kt.txt create mode 100644 compiler/testData/ir/irText/classes/outerClassAccess.kt.txt create mode 100644 compiler/testData/ir/irText/classes/primaryConstructor.kt.txt create mode 100644 compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.kt.txt create mode 100644 compiler/testData/ir/irText/classes/qualifiedSuperCalls.kt.txt create mode 100644 compiler/testData/ir/irText/classes/sealedClasses.kt.txt create mode 100644 compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt.txt create mode 100644 compiler/testData/ir/irText/classes/secondaryConstructors.kt.txt create mode 100644 compiler/testData/ir/irText/classes/superCalls.kt.txt create mode 100644 compiler/testData/ir/irText/classes/superCallsComposed.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/annotationsInAnnotationArguments.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/annotationsWithVarargParameters.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/arrayInAnnotationArguments.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/constExpressionsInAnnotationArguments.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/fieldsWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/fileAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/functionsWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/javaAnnotation.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/multipleAnnotationsInSquareBrackets.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/propertiesWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/propertyAccessorsWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/propertySetterParameterWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/receiverParameterWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/spreadOperatorInAnnotationArguments.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/typeAliasesWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/typeParametersWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/varargsInAnnotationArguments.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/variablesWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/catchParameterInTopLevelProperty.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/constValInitializers.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/defaultArguments.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/deprecatedProperty.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/extensionProperties.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/fakeOverrides.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/fileWithAnnotations.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/fileWithTypeAliasesOnly.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/interfaceProperties.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/kt27005.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/kt29833.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/kt35550.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/localClassWithOverrides.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/localDelegatedProperties.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/localVarInDoWhile.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/multiplatform/expectClassInherited.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/packageLevelProperties.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/class.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/constructor.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/fun.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/genericInnerClass.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/lambdas.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/localFun.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/propertyAccessors.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/typeParameterBeforeBound.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/typeParameterBoundedBySubclass.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/primaryCtorProperties.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/provideDelegate/local.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/provideDelegate/topLevel.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/typeAlias.kt.txt create mode 100644 compiler/testData/ir/irText/errors/suppressedNonPublicCall.kt.txt create mode 100644 compiler/testData/ir/irText/errors/unresolvedReference.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/argumentMappedWithError.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/arrayAccess.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/arrayAssignment.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/assignments.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/augmentedAssignment1.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/bangbang.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/booleanConstsInAndAndOrOr.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/booleanOperators.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/boundCallableReferences.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/boxOk.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/breakContinue.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/breakContinueInWhen.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callWithReorderedArguments.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/adaptedWithCoercionToUnit.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/importedFromObject.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/typeArguments.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/withAdaptationForSam.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/calls.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/castToTypeParameter.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/catchParameterAccess.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/classReference.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/coercionToUnit.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/contructorCall.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/conventionComparisons.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/destructuring1.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/destructuringWithUnderscore.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/dotQualified.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/elvis.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/equality.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/equals.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/extFunInvokeAsFun.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/extFunSafeInvoke.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/extensionPropertyGetterCall.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/field.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/comparableWithDoubleOrFloat.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/eqeqRhsConditionPossiblyAffectingLhs.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointCompareTo.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEqeq.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEquals.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointExcleq.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointLess.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/for.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/forWithBreakContinue.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/funImportedFromObject.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/funInterface/castFromAny.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargs.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/genericPropertyCall.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/identity.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/ifElseIf.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/implicitCastOnPlatformType.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/implicitCastToNonNull.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/implicitNotNullInDestructuringAssignment.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/in.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/incrementDecrement.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/interfaceThisRef.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/javaSyntheticGenericPropertyAccess.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/javaSyntheticPropertyAccess.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt16904.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt16905.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt23030.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt24804.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt27933.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt28006.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt28456.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt28456a.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt28456b.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt30020.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt30796.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt35730.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt36956.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt36963.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt37570.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt37779.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/lambdaInCAO.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/literals.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/memberTypeArguments.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/membersImportedFromObject.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/nullCheckOnGenericLambdaReturn.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/nullCheckOnLambdaReturn.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/objectClassReference.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/objectReference.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/primitiveComparisons.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/primitivesImplicitConversions.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/propertyReferences.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/references.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/safeAssignment.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/safeCalls.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/samByProjectedType.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/samConstructors.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/samConversions.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/samOperators.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/signedToUnsignedConversions_annotation.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/simpleOperators.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/simpleUnaryOperators.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/smartCasts.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/stringComparisons.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/stringPlus.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/stringTemplates.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/throw.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/tryCatch.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/typeAliasConstructorReference.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/typeArguments.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/typeOperators.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/typeParameterClassLiteral.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/unsignedIntegerLiterals.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/useImportedMember.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/values.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/vararg.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/varargWithImplicitCast.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/variableAsFunctionCall.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/when.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/whenCoercedToUnit.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/whenElse.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/whenReturn.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/whenReturnUnit.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/whenUnusedExpression.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/whenWithSubjectVariable.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/whileDoWhile.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/BaseFirBuilder.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/FirBuilder.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/deprecated.kt.txt create mode 100644 compiler/testData/ir/irText/lambdas/anonymousFunction.kt.txt create mode 100644 compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt create mode 100644 compiler/testData/ir/irText/lambdas/extensionLambda.kt.txt create mode 100644 compiler/testData/ir/irText/lambdas/justLambda.kt.txt create mode 100644 compiler/testData/ir/irText/lambdas/localFunction.kt.txt create mode 100644 compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt create mode 100644 compiler/testData/ir/irText/lambdas/nonLocalReturn.kt.txt create mode 100644 compiler/testData/ir/irText/lambdas/samAdapter.kt.txt create mode 100644 compiler/testData/ir/irText/regressions/coercionInLoop.kt.txt create mode 100644 compiler/testData/ir/irText/regressions/integerCoercionToT.kt.txt create mode 100644 compiler/testData/ir/irText/regressions/kt24114.kt.txt create mode 100644 compiler/testData/ir/irText/regressions/newInference/fixationOrder1.kt.txt create mode 100644 compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.kt.txt create mode 100644 compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.kt.txt create mode 100644 compiler/testData/ir/irText/singletons/companion.kt.txt create mode 100644 compiler/testData/ir/irText/singletons/enumEntry.kt.txt create mode 100644 compiler/testData/ir/irText/singletons/object.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/builtinMap.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/constFromBuiltins.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m1.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m2.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/javaConstructorWithTypeParameters.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/javaEnum.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/javaInnerClass.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/javaMethod.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/javaNestedClass.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/javaStaticMethod.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/javaSyntheticProperty.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/jdkClassSyntheticProperty.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/kotlinInnerClass.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/simple.kt.txt create mode 100644 compiler/testData/ir/irText/types/abbreviatedTypes.kt.txt create mode 100644 compiler/testData/ir/irText/types/asOnPlatformType.kt.txt create mode 100644 compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt create mode 100644 compiler/testData/ir/irText/types/coercionToUnitInLambdaReturnValue.kt.txt create mode 100644 compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt create mode 100644 compiler/testData/ir/irText/types/genericFunWithStar.kt.txt create mode 100644 compiler/testData/ir/irText/types/genericPropertyReferenceType.kt.txt create mode 100644 compiler/testData/ir/irText/types/inStarProjectionInReceiverType.kt.txt create mode 100644 compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt create mode 100644 compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt create mode 100644 compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt create mode 100644 compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt create mode 100644 compiler/testData/ir/irText/types/intersectionType3_NI.kt.txt create mode 100644 compiler/testData/ir/irText/types/intersectionType3_OI.kt.txt create mode 100644 compiler/testData/ir/irText/types/kt36143.kt.txt create mode 100644 compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/enhancedNullability.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/platformTypeReceiver.kt.txt create mode 100644 compiler/testData/ir/irText/types/receiverOfIntersectionType.kt.txt create mode 100644 compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.kt.txt create mode 100644 compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.kt.txt create mode 100644 compiler/testData/ir/irText/types/smartCastOnReceiverOfGenericType.kt.txt create mode 100644 compiler/testData/ir/irText/types/starProjection_OI.kt.txt diff --git a/compiler/testData/ir/irText/classes/abstractMembers.kt.txt b/compiler/testData/ir/irText/classes/abstractMembers.kt.txt new file mode 100644 index 00000000000..4ff5e02855d --- /dev/null +++ b/compiler/testData/ir/irText/classes/abstractMembers.kt.txt @@ -0,0 +1,34 @@ +abstract class AbstractClass { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + abstract fun abstractFun() + abstract val abstractVal: Int + abstract get + + abstract var abstractVar: Int + abstract get + abstract set + + + + +} + +interface Interface { + abstract fun abstractFun() + abstract val abstractVal: Int + abstract get + + abstract var abstractVar: Int + abstract get + abstract set + + + + +} + diff --git a/compiler/testData/ir/irText/classes/annotationClasses.kt.txt b/compiler/testData/ir/irText/classes/annotationClasses.kt.txt new file mode 100644 index 00000000000..bbf1dc063fe --- /dev/null +++ b/compiler/testData/ir/irText/classes/annotationClasses.kt.txt @@ -0,0 +1,44 @@ +annotation class Test1 : Annotation { + constructor(x: Int) /* primary */ + val x: Int + field = x + get + + + + +} + +annotation class Test2 : Annotation { + constructor(x: Int = 0) /* primary */ + val x: Int + field = x + get + + + + +} + +annotation class Test3 : Annotation { + constructor(x: Test1) /* primary */ + val x: Test1 + field = x + get + + + + +} + +annotation class Test4 : Annotation { + constructor(vararg xs: Int) /* primary */ + val xs: IntArray + field = xs + get + + + + +} + diff --git a/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.kt.txt b/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.kt.txt new file mode 100644 index 00000000000..2710a340fb5 --- /dev/null +++ b/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.kt.txt @@ -0,0 +1,54 @@ +open class Base { + constructor(x: Int, y: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + val y: Int + field = y + get + + + + +} + +class Test1 : Base { + constructor(xx: Int, yy: Int) /* primary */ { + { //BLOCK + TODO("IrDelegatingConstructorCall") + } + /* InstanceInitializerCall */ + + } + + + + +} + +class Test2 : Base { + constructor(xx: Int, yy: Int) { + { //BLOCK + TODO("IrDelegatingConstructorCall") + } + /* InstanceInitializerCall */ + + } + + constructor(xxx: Int, yyy: Int, a: Any) { + { //BLOCK + TODO("IrDelegatingConstructorCall") + } + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/classMembers.kt.txt b/compiler/testData/ir/irText/classes/classMembers.kt.txt new file mode 100644 index 00000000000..7aee7e54609 --- /dev/null +++ b/compiler/testData/ir/irText/classes/classMembers.kt.txt @@ -0,0 +1,93 @@ +class C { + constructor(x: Int, y: Int, z: Int = 1) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val y: Int + field = y + get + + var z: Int + field = z + get + set + + constructor() { + TODO("IrDelegatingConstructorCall") + } + + val property: Int + field = 0 + get + + val propertyWithGet: Int + get(): Int { + return 42 + } + + var propertyWithGetAndSet: Int + get(): Int { + return .() + } + set(value: Int) { + .( = value) + } + + fun function() { + println(message = "1") + } + + fun Int.memberExtensionFunction() { + println(message = "2") + } + + class NestedClass { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun function() { + println(message = "3") + } + + fun Int.memberExtensionFunction() { + println(message = "4") + } + + + + + } + + interface NestedInterface { + abstract fun foo() + fun bar() { + return .foo() + } + + + + + } + + companion object Companion { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/classes.kt.txt b/compiler/testData/ir/irText/classes/classes.kt.txt new file mode 100644 index 00000000000..6555e18c50f --- /dev/null +++ b/compiler/testData/ir/irText/classes/classes.kt.txt @@ -0,0 +1,57 @@ +class TestClass { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +interface TestInterface { + + + +} + +object TestObject { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +annotation class TestAnnotationClass : Annotation { + constructor() /* primary */ + + + +} + +enum class TestEnumClass : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnumClass /* Synthetic body for ENUM_VALUEOF */ + +} + diff --git a/compiler/testData/ir/irText/classes/companionObject.kt.txt b/compiler/testData/ir/irText/classes/companionObject.kt.txt new file mode 100644 index 00000000000..4a415351883 --- /dev/null +++ b/compiler/testData/ir/irText/classes/companionObject.kt.txt @@ -0,0 +1,48 @@ +class Test1 { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + companion object Companion { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + +class Test2 { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + companion object Named { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt new file mode 100644 index 00000000000..6aa615d168a --- /dev/null +++ b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt @@ -0,0 +1,253 @@ +data class Test1 { + constructor(stringArray: Array, charArray: CharArray, booleanArray: BooleanArray, byteArray: ByteArray, shortArray: ShortArray, intArray: IntArray, longArray: LongArray, floatArray: FloatArray, doubleArray: DoubleArray) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val stringArray: Array + field = stringArray + get + + val charArray: CharArray + field = charArray + get + + val booleanArray: BooleanArray + field = booleanArray + get + + val byteArray: ByteArray + field = byteArray + get + + val shortArray: ShortArray + field = shortArray + get + + val intArray: IntArray + field = intArray + get + + val longArray: LongArray + field = longArray + get + + val floatArray: FloatArray + field = floatArray + get + + val doubleArray: DoubleArray + field = doubleArray + get + + operator fun component1(): Array { + return #stringArray + } + + operator fun component2(): CharArray { + return #charArray + } + + operator fun component3(): BooleanArray { + return #booleanArray + } + + operator fun component4(): ByteArray { + return #byteArray + } + + operator fun component5(): ShortArray { + return #shortArray + } + + operator fun component6(): IntArray { + return #intArray + } + + operator fun component7(): LongArray { + return #longArray + } + + operator fun component8(): FloatArray { + return #floatArray + } + + operator fun component9(): DoubleArray { + return #doubleArray + } + + fun copy(stringArray: Array = #stringArray, charArray: CharArray = #charArray, booleanArray: BooleanArray = #booleanArray, byteArray: ByteArray = #byteArray, shortArray: ShortArray = #shortArray, intArray: IntArray = #intArray, longArray: LongArray = #longArray, floatArray: FloatArray = #floatArray, doubleArray: DoubleArray = #doubleArray): Test1 { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "Test1(" + +"stringArray=" + +dataClassArrayMemberToString(arg0 = #stringArray) + +", " + +"charArray=" + +dataClassArrayMemberToString(arg0 = #charArray) + +", " + +"booleanArray=" + +dataClassArrayMemberToString(arg0 = #booleanArray) + +", " + +"byteArray=" + +dataClassArrayMemberToString(arg0 = #byteArray) + +", " + +"shortArray=" + +dataClassArrayMemberToString(arg0 = #shortArray) + +", " + +"intArray=" + +dataClassArrayMemberToString(arg0 = #intArray) + +", " + +"longArray=" + +dataClassArrayMemberToString(arg0 = #longArray) + +", " + +"floatArray=" + +dataClassArrayMemberToString(arg0 = #floatArray) + +", " + +"doubleArray=" + +dataClassArrayMemberToString(arg0 = #doubleArray) + +")" + } + + override fun hashCode(): Int { + return dataClassArrayMemberHashCode(arg0 = #stringArray).times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #charArray)).times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #booleanArray)).times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #byteArray)).times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #shortArray)).times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #intArray)).times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #longArray)).times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #floatArray)).times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #doubleArray)) + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test1 -> return false + } + val tmp0_other_with_cast: Test1 = other as Test1 + when { + EQEQ(arg0 = #stringArray, arg1 = #stringArray).not() -> return false + } + when { + EQEQ(arg0 = #charArray, arg1 = #charArray).not() -> return false + } + when { + EQEQ(arg0 = #booleanArray, arg1 = #booleanArray).not() -> return false + } + when { + EQEQ(arg0 = #byteArray, arg1 = #byteArray).not() -> return false + } + when { + EQEQ(arg0 = #shortArray, arg1 = #shortArray).not() -> return false + } + when { + EQEQ(arg0 = #intArray, arg1 = #intArray).not() -> return false + } + when { + EQEQ(arg0 = #longArray, arg1 = #longArray).not() -> return false + } + when { + EQEQ(arg0 = #floatArray, arg1 = #floatArray).not() -> return false + } + when { + EQEQ(arg0 = #doubleArray, arg1 = #doubleArray).not() -> return false + } + return true + } + +} + +data class Test2 { + constructor(genericArray: Array) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val genericArray: Array + field = genericArray + get + + operator fun component1(): Array { + return #genericArray + } + + fun copy(genericArray: Array = #genericArray): Test2 { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "Test2(" + +"genericArray=" + +dataClassArrayMemberToString(arg0 = #genericArray) + +")" + } + + override fun hashCode(): Int { + return dataClassArrayMemberHashCode(arg0 = #genericArray) + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test2 -> return false + } + val tmp0_other_with_cast: Test2 = other as Test2 + when { + EQEQ(arg0 = #genericArray, arg1 = #genericArray).not() -> return false + } + return true + } + +} + +data class Test3 { + constructor(anyArrayN: Array?) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val anyArrayN: Array? + field = anyArrayN + get + + operator fun component1(): Array? { + return #anyArrayN + } + + fun copy(anyArrayN: Array? = #anyArrayN): Test3 { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "Test3(" + +"anyArrayN=" + +dataClassArrayMemberToString(arg0 = #anyArrayN) + +")" + } + + override fun hashCode(): Int { + return when { + EQEQ(arg0 = #anyArrayN, arg1 = null) -> 0 + true -> dataClassArrayMemberHashCode(arg0 = #anyArrayN) + } + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test3 -> return false + } + val tmp0_other_with_cast: Test3 = other as Test3 + when { + EQEQ(arg0 = #anyArrayN, arg1 = #anyArrayN).not() -> return false + } + return true + } + +} + diff --git a/compiler/testData/ir/irText/classes/dataClasses.kt.txt b/compiler/testData/ir/irText/classes/dataClasses.kt.txt new file mode 100644 index 00000000000..365ccecd75f --- /dev/null +++ b/compiler/testData/ir/irText/classes/dataClasses.kt.txt @@ -0,0 +1,217 @@ +data class Test1 { + constructor(x: Int, y: String, z: Any) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + val y: String + field = y + get + + val z: Any + field = z + get + + operator fun component1(): Int { + return #x + } + + operator fun component2(): String { + return #y + } + + operator fun component3(): Any { + return #z + } + + fun copy(x: Int = #x, y: String = #y, z: Any = #z): Test1 { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "Test1(" + +"x=" + +#x + +", " + +"y=" + +#y + +", " + +"z=" + +#z + +")" + } + + override fun hashCode(): Int { + return #x.hashCode().times(other = 31).plus(other = #y.hashCode()).times(other = 31).plus(other = #z.hashCode()) + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test1 -> return false + } + val tmp0_other_with_cast: Test1 = other as Test1 + when { + EQEQ(arg0 = #x, arg1 = #x).not() -> return false + } + when { + EQEQ(arg0 = #y, arg1 = #y).not() -> return false + } + when { + EQEQ(arg0 = #z, arg1 = #z).not() -> return false + } + return true + } + +} + +data class Test2 { + constructor(x: Any?) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Any? + field = x + get + + operator fun component1(): Any? { + return #x + } + + fun copy(x: Any? = #x): Test2 { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "Test2(" + +"x=" + +#x + +")" + } + + override fun hashCode(): Int { + return when { + EQEQ(arg0 = #x, arg1 = null) -> 0 + true -> #x.hashCode() + } + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test2 -> return false + } + val tmp0_other_with_cast: Test2 = other as Test2 + when { + EQEQ(arg0 = #x, arg1 = #x).not() -> return false + } + return true + } + +} + +data class Test3 { + constructor(d: Double, dn: Double?, f: Float, df: Float?) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val d: Double + field = d + get + + val dn: Double? + field = dn + get + + val f: Float + field = f + get + + val df: Float? + field = df + get + + operator fun component1(): Double { + return #d + } + + operator fun component2(): Double? { + return #dn + } + + operator fun component3(): Float { + return #f + } + + operator fun component4(): Float? { + return #df + } + + fun copy(d: Double = #d, dn: Double? = #dn, f: Float = #f, df: Float? = #df): Test3 { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "Test3(" + +"d=" + +#d + +", " + +"dn=" + +#dn + +", " + +"f=" + +#f + +", " + +"df=" + +#df + +")" + } + + override fun hashCode(): Int { + return #d.hashCode().times(other = 31).plus(other = when { + EQEQ(arg0 = #dn, arg1 = null) -> 0 + true -> #dn.hashCode() + }).times(other = 31).plus(other = #f.hashCode()).times(other = 31).plus(other = when { + EQEQ(arg0 = #df, arg1 = null) -> 0 + true -> #df.hashCode() + }) + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test3 -> return false + } + val tmp0_other_with_cast: Test3 = other as Test3 + when { + EQEQ(arg0 = #d, arg1 = #d).not() -> return false + } + when { + EQEQ(arg0 = #dn, arg1 = #dn).not() -> return false + } + when { + EQEQ(arg0 = #f, arg1 = #f).not() -> return false + } + when { + EQEQ(arg0 = #df, arg1 = #df).not() -> return false + } + return true + } + +} + diff --git a/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt b/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt new file mode 100644 index 00000000000..09d3531af7e --- /dev/null +++ b/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt @@ -0,0 +1,187 @@ +data class Test1 { + constructor(x: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: T + field = x + get + + operator fun component1(): T { + return #x + } + + fun copy(x: T = #x): Test1 { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "Test1(" + +"x=" + +#x + +")" + } + + override fun hashCode(): Int { + return when { + EQEQ(arg0 = #x, arg1 = null) -> 0 + true -> #x.hashCode() + } + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test1 -> return false + } + val tmp0_other_with_cast: Test1 = other as Test1 + when { + EQEQ(arg0 = #x, arg1 = #x).not() -> return false + } + return true + } + +} + +data class Test2 { + constructor(x: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: T + field = x + get + + operator fun component1(): T { + return #x + } + + fun copy(x: T = #x): Test2 { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "Test2(" + +"x=" + +#x + +")" + } + + override fun hashCode(): Int { + return #x.hashCode() + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test2 -> return false + } + val tmp0_other_with_cast: Test2 = other as Test2 + when { + EQEQ(arg0 = #x, arg1 = #x).not() -> return false + } + return true + } + +} + +data class Test3 { + constructor(x: List) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: List + field = x + get + + operator fun component1(): List { + return #x + } + + fun copy(x: List = #x): Test3 { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "Test3(" + +"x=" + +#x + +")" + } + + override fun hashCode(): Int { + return #x.hashCode() + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test3 -> return false + } + val tmp0_other_with_cast: Test3 = other as Test3 + when { + EQEQ(arg0 = #x, arg1 = #x).not() -> return false + } + return true + } + +} + +data class Test4 { + constructor(x: List) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: List + field = x + get + + operator fun component1(): List { + return #x + } + + fun copy(x: List = #x): Test4 { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "Test4(" + +"x=" + +#x + +")" + } + + override fun hashCode(): Int { + return #x.hashCode() + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test4 -> return false + } + val tmp0_other_with_cast: Test4 = other as Test4 + when { + EQEQ(arg0 = #x, arg1 = #x).not() -> return false + } + return true + } + +} + diff --git a/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt b/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt new file mode 100644 index 00000000000..ebcc4edecfa --- /dev/null +++ b/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt @@ -0,0 +1,79 @@ +interface IBase { + abstract fun foo(a: A, b: B) + abstract val C.id: Map? + abstract get + + abstract var List.x: D? + abstract get + abstract set + + + + +} + +class Test1 : IBase { + constructor(i: IBase) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: IBase = i + override fun foo(a: E, b: B) { + #$$delegate_0.foo(a = a, b = b) + } + + override val C.id: Map? + override get(): Map? { + return #$$delegate_0.($receiver = ) + } + + override var List.x: D? + override get(): D? { + return #$$delegate_0.($receiver = ) + } + override set(: D?) { + #$$delegate_0.($receiver = , = ) + } + + + + +} + +class Test2 : IBase { + constructor(j: IBase) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var j: IBase + field = j + get + set + + private /*final field*/ val $$delegate_0: IBase = j + override fun foo(a: String, b: B) { + #$$delegate_0.foo(a = a, b = b) + } + + override val C.id: Map? + override get(): Map? { + return #$$delegate_0.($receiver = ) + } + + override var List.x: D? + override get(): D? { + return #$$delegate_0.($receiver = ) + } + override set(: D?) { + #$$delegate_0.($receiver = , = ) + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt new file mode 100644 index 00000000000..83accae49bc --- /dev/null +++ b/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt @@ -0,0 +1,168 @@ +interface IBase { + abstract fun foo(x: Int, s: String) + abstract fun bar(): Int + abstract fun String.qux() + + + +} + +object BaseImpl : IBase { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo(x: Int, s: String) { + } + + override fun bar(): Int { + return 42 + } + + override fun String.qux() { + } + + + + +} + +interface IOther { + abstract val x: String + abstract get + + abstract var y: Int + abstract get + abstract set + + abstract val Byte.z1: Int + abstract get + + abstract var Byte.z2: Int + abstract get + abstract set + + + + +} + +fun otherImpl(x0: String, y0: Int): IOther { + return { //BLOCK + local class : IOther { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override val x: String + field = x0 + override get + + override var y: Int + field = y0 + override get + override set + + override val Byte.z1: Int + override get(): Int { + return 1 + } + + override var Byte.z2: Int + override get(): Int { + return 2 + } + override set(value: Int) { + } + + + + + } + + + TODO("IrConstructorCall") + } +} + +class Test1 : IBase { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: BaseImpl = BaseImpl + override fun bar(): Int { + return #$$delegate_0.bar() + } + + override fun foo(x: Int, s: String) { + #$$delegate_0.foo(x = x, s = s) + } + + override fun String.qux() { + #$$delegate_0.qux($receiver = ) + } + + + + +} + +class Test2 : IBase, IOther { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: BaseImpl = BaseImpl + override fun bar(): Int { + return #$$delegate_0.bar() + } + + override fun foo(x: Int, s: String) { + #$$delegate_0.foo(x = x, s = s) + } + + override fun String.qux() { + #$$delegate_0.qux($receiver = ) + } + + private /*final field*/ val $$delegate_1: IOther = otherImpl(x0 = "", y0 = 42) + override val Byte.z1: Int + override get(): Int { + return #$$delegate_1.($receiver = ) + } + + override val x: String + override get(): String { + return #$$delegate_1.() + } + + override var Byte.z2: Int + override get(): Int { + return #$$delegate_1.($receiver = ) + } + override set(: Int) { + #$$delegate_1.($receiver = , = ) + } + + override var y: Int + override get(): Int { + return #$$delegate_1.() + } + override set(: Int) { + #$$delegate_1.( = ) + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt new file mode 100644 index 00000000000..d828aae732e --- /dev/null +++ b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt @@ -0,0 +1,46 @@ +interface IFooBar { + abstract fun foo() + abstract fun bar() + + + +} + +object FooBarImpl : IFooBar { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo() { + } + + override fun bar() { + } + + + + +} + +class C : IFooBar { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: FooBarImpl = FooBarImpl + override fun foo() { + #$$delegate_0.foo() + } + + override fun bar() { + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.kt.txt b/compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.kt.txt new file mode 100644 index 00000000000..19e317cd18d --- /dev/null +++ b/compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.kt.txt @@ -0,0 +1,42 @@ +open class Cell { + constructor(value: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: T + field = value + get + + + + +} + +typealias CT = Cell +typealias CStr = Cell +class C1 : Cell { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class C2 : Cell { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.kt.txt b/compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.kt.txt new file mode 100644 index 00000000000..42314e1dd52 --- /dev/null +++ b/compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.kt.txt @@ -0,0 +1,34 @@ +open class Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class Test : Base { + constructor() { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + constructor(xx: Int) { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + constructor(xx: Short) { + TODO("IrDelegatingConstructorCall") + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/enum.kt.txt b/compiler/testData/ir/irText/classes/enum.kt.txt new file mode 100644 index 00000000000..ab55bfd4ecb --- /dev/null +++ b/compiler/testData/ir/irText/classes/enum.kt.txt @@ -0,0 +1,150 @@ +enum class TestEnum1 : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + TEST1 init = TODO("IrEnumConstructorCall") TEST2 init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnum1 /* Synthetic body for ENUM_VALUEOF */ + +} + +enum class TestEnum2 : Enum { + private constructor(x: Int) /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + TEST1 init = TODO("IrEnumConstructorCall") TEST2 init = TODO("IrEnumConstructorCall") TEST3 init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnum2 /* Synthetic body for ENUM_VALUEOF */ + +} + +abstract enum class TestEnum3 : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + TEST init = TODO("IrEnumConstructorCall") abstract fun foo() + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnum3 /* Synthetic body for ENUM_VALUEOF */ + +} + +abstract enum class TestEnum4 : Enum { + private constructor(x: Int) /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + TEST1 init = TODO("IrEnumConstructorCall") TEST2 init = TODO("IrEnumConstructorCall") abstract fun foo() + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnum4 /* Synthetic body for ENUM_VALUEOF */ + +} + +enum class TestEnum5 : Enum { + private constructor(x: Int = 0) /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + TEST1 init = TODO("IrEnumConstructorCall") TEST2 init = TODO("IrEnumConstructorCall") TEST3 init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnum5 /* Synthetic body for ENUM_VALUEOF */ + +} + +fun f(): Int { + return 1 +} + +enum class TestEnum6 : Enum { + private constructor(x: Int, y: Int) /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + val y: Int + field = y + get + + TEST init = { //BLOCK + val tmp0_y: Int = f() + val tmp1_x: Int = f() + TODO("IrEnumConstructorCall") + } + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnum6 /* Synthetic body for ENUM_VALUEOF */ + +} + diff --git a/compiler/testData/ir/irText/classes/enumClassModality.kt.txt b/compiler/testData/ir/irText/classes/enumClassModality.kt.txt new file mode 100644 index 00000000000..c31de7f8af7 --- /dev/null +++ b/compiler/testData/ir/irText/classes/enumClassModality.kt.txt @@ -0,0 +1,159 @@ +enum class TestFinalEnum1 : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + X1 init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestFinalEnum1 /* Synthetic body for ENUM_VALUEOF */ + +} + +enum class TestFinalEnum2 : Enum { + private constructor(x: Int) /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + X1 init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestFinalEnum2 /* Synthetic body for ENUM_VALUEOF */ + +} + +enum class TestFinalEnum3 : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + X1 init = TODO("IrEnumConstructorCall") fun doStuff() { + } + + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestFinalEnum3 /* Synthetic body for ENUM_VALUEOF */ + +} + +open enum class TestOpenEnum1 : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + X1 init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestOpenEnum1 /* Synthetic body for ENUM_VALUEOF */ + +} + +open enum class TestOpenEnum2 : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + X1 init = TODO("IrEnumConstructorCall") open fun foo() { + } + + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestOpenEnum2 /* Synthetic body for ENUM_VALUEOF */ + +} + +abstract enum class TestAbstractEnum1 : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + X1 init = TODO("IrEnumConstructorCall") abstract fun foo() + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestAbstractEnum1 /* Synthetic body for ENUM_VALUEOF */ + +} + +interface IFoo { + abstract fun foo() + + + +} + +abstract enum class TestAbstractEnum2 : Enum, IFoo { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + X1 init = TODO("IrEnumConstructorCall") + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestAbstractEnum2 /* Synthetic body for ENUM_VALUEOF */ + +} + diff --git a/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt b/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt new file mode 100644 index 00000000000..765cdea7920 --- /dev/null +++ b/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt @@ -0,0 +1,54 @@ +open enum class A : Enum { + X init = TODO("IrEnumConstructorCall") Y init = TODO("IrEnumConstructorCall") Z init = TODO("IrEnumConstructorCall") val prop1: String + get + + val prop2: String + field = "const2" + get + + var prop3: String + field = "" + get + set + + private constructor(arg: String) { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + #prop1 = arg + } + + private constructor() { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + #prop1 = "default" + .( = "empty") + } + + private constructor(x: Int) { + TODO("IrDelegatingConstructorCall") + .( = "int") + } + + open fun f(): String { + return .() + +"#" + +.() + +"#" + +.() + } + + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): A /* Synthetic body for ENUM_VALUEOF */ + +} + diff --git a/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt.txt b/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt.txt new file mode 100644 index 00000000000..53dbb28b14b --- /dev/null +++ b/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt.txt @@ -0,0 +1,85 @@ +enum class Test0 : Enum { + private constructor(x: Int) /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + ZERO init = TODO("IrEnumConstructorCall") private constructor() { + TODO("IrDelegatingConstructorCall") + } + + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): Test0 /* Synthetic body for ENUM_VALUEOF */ + +} + +enum class Test1 : Enum { + private constructor(x: Int) /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + ZERO init = TODO("IrEnumConstructorCall") ONE init = TODO("IrEnumConstructorCall") private constructor() { + TODO("IrDelegatingConstructorCall") + } + + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): Test1 /* Synthetic body for ENUM_VALUEOF */ + +} + +abstract enum class Test2 : Enum { + private constructor(x: Int) /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + ZERO init = TODO("IrEnumConstructorCall") ONE init = TODO("IrEnumConstructorCall") private constructor() { + TODO("IrDelegatingConstructorCall") + } + + abstract fun foo() + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): Test2 /* Synthetic body for ENUM_VALUEOF */ + +} + diff --git a/compiler/testData/ir/irText/classes/fakeOverridesForJavaStaticMembers.kt.txt b/compiler/testData/ir/irText/classes/fakeOverridesForJavaStaticMembers.kt.txt new file mode 100644 index 00000000000..48d79c255f3 --- /dev/null +++ b/compiler/testData/ir/irText/classes/fakeOverridesForJavaStaticMembers.kt.txt @@ -0,0 +1,14 @@ +class Test : Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + + +} + diff --git a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt new file mode 100644 index 00000000000..b745983c032 --- /dev/null +++ b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt @@ -0,0 +1,150 @@ +interface IFoo { + abstract fun foo(): String + + + +} + +class K1 : JFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + +} + +class K2 : JFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo(): String { + return .foo() /*!! String */ + } + + + + +} + +class K3 : JUnrelatedFoo, IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + +} + +class K4 : JUnrelatedFoo, IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo(): @FlexibleNullability String? { + return .foo() + } + + + + +} + +class TestJFoo : IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: JFoo = TODO("IrConstructorCall") + override fun foo(): String { + return #$$delegate_0.foo() /*!! String */ + } + + + + +} + +class TestK1 : IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: K1 = TODO("IrConstructorCall") + override fun foo(): String { + return #$$delegate_0.foo() /*!! String */ + } + + + + +} + +class TestK2 : IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: K2 = TODO("IrConstructorCall") + override fun foo(): String { + return #$$delegate_0.foo() + } + + + + +} + +class TestK3 : IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: K3 = TODO("IrConstructorCall") + override fun foo(): String { + return #$$delegate_0.foo() + } + + + + +} + +class TestK4 : IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: K4 = TODO("IrConstructorCall") + override fun foo(): String { + return #$$delegate_0.foo() /*!! String */ + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/initBlock.kt.txt b/compiler/testData/ir/irText/classes/initBlock.kt.txt new file mode 100644 index 00000000000..56e174c6b99 --- /dev/null +++ b/compiler/testData/ir/irText/classes/initBlock.kt.txt @@ -0,0 +1,104 @@ +class Test1 { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + init { + println() + } + + + + +} + +class Test2 { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + init { + println() + } + + + + +} + +class Test3 { + init { + println() + } + + constructor() { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class Test4 { + init { + println(message = "1") + } + + constructor() { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + init { + println(message = "2") + } + + + + +} + +class Test5 { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + init { + println(message = "1") + } + + inner class TestInner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + init { + println(message = "2") + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/initVal.kt.txt b/compiler/testData/ir/irText/classes/initVal.kt.txt new file mode 100644 index 00000000000..2107ee26618 --- /dev/null +++ b/compiler/testData/ir/irText/classes/initVal.kt.txt @@ -0,0 +1,51 @@ +class TestInitValFromParameter { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + + + +} + +class TestInitValInClass { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = 0 + get + + + + +} + +class TestInitValInInitBlock { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + get + + init { + #x = 0 + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/initValInLambda.kt.txt b/compiler/testData/ir/irText/classes/initValInLambda.kt.txt new file mode 100644 index 00000000000..525feca16f4 --- /dev/null +++ b/compiler/testData/ir/irText/classes/initValInLambda.kt.txt @@ -0,0 +1,22 @@ +class TestInitValInLambdaCalledOnce { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + get + + init { + run($receiver = 1, block = local fun Int.() { + #x = 0 + } +) + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/initVar.kt.txt b/compiler/testData/ir/irText/classes/initVar.kt.txt new file mode 100644 index 00000000000..d10a3f0de4f --- /dev/null +++ b/compiler/testData/ir/irText/classes/initVar.kt.txt @@ -0,0 +1,114 @@ +class TestInitVarFromParameter { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var x: Int + field = x + get + set + + + + +} + +class TestInitVarInClass { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var x: Int + field = 0 + get + set + + + + +} + +class TestInitVarInInitBlock { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var x: Int + get + set + + init { + .( = 0) + } + + + + +} + +class TestInitVarWithCustomSetter { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var x: Int + field = 0 + get + set(value: Int) { + #x = value + } + + + + +} + +class TestInitVarWithCustomSetterWithExplicitCtor { + var x: Int + get + set(value: Int) { + #x = value + } + + init { + .(value = 0) + } + + constructor() { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class TestInitVarWithCustomSetterInCtor { + var x: Int + get + set(value: Int) { + #x = value + } + + constructor() { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + .(value = 42) + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/inlineClass.kt.txt b/compiler/testData/ir/irText/classes/inlineClass.kt.txt new file mode 100644 index 00000000000..a8872d7b16e --- /dev/null +++ b/compiler/testData/ir/irText/classes/inlineClass.kt.txt @@ -0,0 +1,35 @@ +inline class Test { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + override fun toString(): String { + return "Test(" + +"x=" + +#x + +")" + } + + override fun hashCode(): Int { + return #x.hashCode() + } + + override operator fun equals(other: Any?): Boolean { + when { + other !is Test -> return false + } + val tmp0_other_with_cast: Test = other as Test + when { + EQEQ(arg0 = #x, arg1 = #x).not() -> return false + } + return true + } + +} + diff --git a/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt b/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt new file mode 100644 index 00000000000..ca2844cba72 --- /dev/null +++ b/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt @@ -0,0 +1,66 @@ +class C { + constructor(t: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val t: T + field = t + get + + override fun hashCode(): Int { + return .() as Int + } + + + +} + +inline class IC { + constructor(c: C) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val c: C + field = c + get + + fun foo(): Int { + return .().hashCode() + } + + override fun toString(): String { + return "IC(" + +"c=" + +#c + +")" + } + + override fun hashCode(): Int { + return #c.hashCode() + } + + override operator fun equals(other: Any?): Boolean { + when { + other !is IC -> return false + } + val tmp0_other_with_cast: IC = other as IC + when { + EQEQ(arg0 = #c, arg1 = #c).not() -> return false + } + return true + } + +} + +fun box(): String { + val ic: IC = TODO("IrConstructorCall") + when { + EQEQ(arg0 = ic.foo(), arg1 = 42).not() -> return "FAIL" + } + return "OK" +} + diff --git a/compiler/testData/ir/irText/classes/innerClass.kt.txt b/compiler/testData/ir/irText/classes/innerClass.kt.txt new file mode 100644 index 00000000000..268f89f2e3d --- /dev/null +++ b/compiler/testData/ir/irText/classes/innerClass.kt.txt @@ -0,0 +1,36 @@ +class Outer { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + open inner class TestInnerClass { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + inner class DerivedInnerClass : TestInnerClass { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.kt.txt b/compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.kt.txt new file mode 100644 index 00000000000..0672a360cf6 --- /dev/null +++ b/compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.kt.txt @@ -0,0 +1,32 @@ +class Outer { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + inner class Inner { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + constructor() { + TODO("IrDelegatingConstructorCall") + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/kt31649.kt.txt b/compiler/testData/ir/irText/classes/kt31649.kt.txt new file mode 100644 index 00000000000..2cb80495b4c --- /dev/null +++ b/compiler/testData/ir/irText/classes/kt31649.kt.txt @@ -0,0 +1,87 @@ +data class TestData { + constructor(nn: Nothing?) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val nn: Nothing? + field = nn + get + + operator fun component1(): Nothing? { + return #nn + } + + fun copy(nn: Nothing? = #nn): TestData { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "TestData(" + +"nn=" + +#nn + +")" + } + + override fun hashCode(): Int { + return when { + EQEQ(arg0 = #nn, arg1 = null) -> 0 + true -> #nn.hashCode() + } + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is TestData -> return false + } + val tmp0_other_with_cast: TestData = other as TestData + when { + EQEQ(arg0 = #nn, arg1 = #nn).not() -> return false + } + return true + } + +} + +inline class TestInline { + constructor(nn: Nothing?) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val nn: Nothing? + field = nn + get + + override fun toString(): String { + return "TestInline(" + +"nn=" + +#nn + +")" + } + + override fun hashCode(): Int { + return when { + EQEQ(arg0 = #nn, arg1 = null) -> 0 + true -> #nn.hashCode() + } + } + + override operator fun equals(other: Any?): Boolean { + when { + other !is TestInline -> return false + } + val tmp0_other_with_cast: TestInline = other as TestInline + when { + EQEQ(arg0 = #nn, arg1 = #nn).not() -> return false + } + return true + } + +} + diff --git a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt new file mode 100644 index 00000000000..4af7ccf6a7f --- /dev/null +++ b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt @@ -0,0 +1,110 @@ +data class A { + constructor(runA: @ExtensionFunctionType Function2 = local fun A.(it: String) { + return Unit + } +) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val runA: @ExtensionFunctionType Function2 + field = runA + get + + operator fun component1(): @ExtensionFunctionType Function2 { + return #runA + } + + fun copy(runA: @ExtensionFunctionType Function2 = #runA): A { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "A(" + +"runA=" + +#runA + +")" + } + + override fun hashCode(): Int { + return #runA.hashCode() + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is A -> return false + } + val tmp0_other_with_cast: A = other as A + when { + EQEQ(arg0 = #runA, arg1 = #runA).not() -> return false + } + return true + } + +} + +data class B { + constructor(x: Any = { //BLOCK + local class { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + TODO("IrConstructorCall") + }) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Any + field = x + get + + operator fun component1(): Any { + return #x + } + + fun copy(x: Any = #x): B { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "B(" + +"x=" + +#x + +")" + } + + override fun hashCode(): Int { + return #x.hashCode() + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is B -> return false + } + val tmp0_other_with_cast: B = other as B + when { + EQEQ(arg0 = #x, arg1 = #x).not() -> return false + } + return true + } + +} + diff --git a/compiler/testData/ir/irText/classes/localClasses.kt.txt b/compiler/testData/ir/irText/classes/localClasses.kt.txt new file mode 100644 index 00000000000..5db69d14320 --- /dev/null +++ b/compiler/testData/ir/irText/classes/localClasses.kt.txt @@ -0,0 +1,20 @@ +fun outer() { + local class LocalClass { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo() { + } + + + + + } + + + TODO("IrConstructorCall").foo() +} + diff --git a/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt b/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt new file mode 100644 index 00000000000..d254b1ecea7 --- /dev/null +++ b/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt @@ -0,0 +1,120 @@ +interface IFoo { + abstract fun foo() + + + +} + +val test1: Any + field = { //BLOCK + local class { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + TODO("IrConstructorCall") + } + get + +val test2: IFoo + field = { //BLOCK + local class : IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo() { + println(message = "foo") + } + + + + + } + + + TODO("IrConstructorCall") + } + get + +class Outer { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + abstract inner class Inner : IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + + } + + fun test3(): Inner { + return { //BLOCK + local class : Inner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo() { + println(message = "foo") + } + + + + + } + + + TODO("IrConstructorCall") + } + } + + + + +} + +fun Outer.test4(): Inner { + return { //BLOCK + local class : Inner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo() { + println(message = "foo") + } + + + + + } + + + TODO("IrConstructorCall") + } +} + diff --git a/compiler/testData/ir/irText/classes/objectWithInitializers.kt.txt b/compiler/testData/ir/irText/classes/objectWithInitializers.kt.txt new file mode 100644 index 00000000000..4102d112929 --- /dev/null +++ b/compiler/testData/ir/irText/classes/objectWithInitializers.kt.txt @@ -0,0 +1,35 @@ +abstract class Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +object Test : Base { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = 1 + get + + val y: Int + get + + init { + #y = .() + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/outerClassAccess.kt.txt b/compiler/testData/ir/irText/classes/outerClassAccess.kt.txt new file mode 100644 index 00000000000..86e5f75aacf --- /dev/null +++ b/compiler/testData/ir/irText/classes/outerClassAccess.kt.txt @@ -0,0 +1,52 @@ +class Outer { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo() { + } + + inner class Inner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun test() { + .foo() + } + + inner class Inner2 { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun test2() { + .test() + .foo() + } + + fun Outer.test3() { + .foo() + } + + + + + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/primaryConstructor.kt.txt b/compiler/testData/ir/irText/classes/primaryConstructor.kt.txt new file mode 100644 index 00000000000..6986ef5d11c --- /dev/null +++ b/compiler/testData/ir/irText/classes/primaryConstructor.kt.txt @@ -0,0 +1,63 @@ +class Test1 { + constructor(x: Int, y: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + val y: Int + field = y + get + + + + +} + +class Test2 { + constructor(x: Int, y: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val y: Int + field = y + get + + val x: Int + field = x + get + + + + +} + +class Test3 { + constructor(x: Int, y: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val y: Int + field = y + get + + val x: Int + get + + init { + #x = x + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.kt.txt b/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.kt.txt new file mode 100644 index 00000000000..20e8d88c741 --- /dev/null +++ b/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.kt.txt @@ -0,0 +1,60 @@ +open class Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class TestImplicitPrimaryConstructor : Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class TestExplicitPrimaryConstructor : Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class TestWithDelegatingConstructor : Base { + constructor(x: Int, y: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + val y: Int + field = y + get + + constructor(x: Int) { + TODO("IrDelegatingConstructorCall") + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/qualifiedSuperCalls.kt.txt b/compiler/testData/ir/irText/classes/qualifiedSuperCalls.kt.txt new file mode 100644 index 00000000000..fba2cb790c6 --- /dev/null +++ b/compiler/testData/ir/irText/classes/qualifiedSuperCalls.kt.txt @@ -0,0 +1,50 @@ +interface ILeft { + fun foo() { + } + + val bar: Int + get(): Int { + return 1 + } + + + + +} + +interface IRight { + fun foo() { + } + + val bar: Int + get(): Int { + return 2 + } + + + + +} + +class CBoth : ILeft, IRight { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo() { + .foo() + .foo() + } + + override val bar: Int + override get(): Int { + return .().plus(other = .()) + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/sealedClasses.kt.txt b/compiler/testData/ir/irText/classes/sealedClasses.kt.txt new file mode 100644 index 00000000000..3b3f1691774 --- /dev/null +++ b/compiler/testData/ir/irText/classes/sealedClasses.kt.txt @@ -0,0 +1,60 @@ +sealed class Expr { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + class Const : Expr { + constructor(number: Double) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val number: Double + field = number + get + + + + + } + + class Sum : Expr { + constructor(e1: Expr, e2: Expr) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val e1: Expr + field = e1 + get + + val e2: Expr + field = e2 + get + + + + + } + + object NotANumber : Expr { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt.txt b/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt.txt new file mode 100644 index 00000000000..c2fd12e91f7 --- /dev/null +++ b/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt.txt @@ -0,0 +1,57 @@ +open class Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class TestProperty : Base { + val x: Int + field = 0 + get + + constructor() { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class TestInitBlock : Base { + val x: Int + get + + init { + #x = 0 + } + + constructor() { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + constructor(z: Any) { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + constructor(y: Int) { + TODO("IrDelegatingConstructorCall") + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/secondaryConstructors.kt.txt b/compiler/testData/ir/irText/classes/secondaryConstructors.kt.txt new file mode 100644 index 00000000000..8799103a85a --- /dev/null +++ b/compiler/testData/ir/irText/classes/secondaryConstructors.kt.txt @@ -0,0 +1,16 @@ +class C { + constructor() { + TODO("IrDelegatingConstructorCall") + } + + constructor(x: Int) { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/superCalls.kt.txt b/compiler/testData/ir/irText/classes/superCalls.kt.txt new file mode 100644 index 00000000000..93db015d34e --- /dev/null +++ b/compiler/testData/ir/irText/classes/superCalls.kt.txt @@ -0,0 +1,43 @@ +open class Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + open fun foo() { + } + + open val bar: String + field = "" + open get + + override fun hashCode(): Int { + return .hashCode() + } + + + +} + +class Derived : Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo() { + .foo() + } + + override val bar: String + override get(): String { + return .() + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/superCallsComposed.kt.txt b/compiler/testData/ir/irText/classes/superCallsComposed.kt.txt new file mode 100644 index 00000000000..975613f7844 --- /dev/null +++ b/compiler/testData/ir/irText/classes/superCallsComposed.kt.txt @@ -0,0 +1,50 @@ +open class Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + open fun foo() { + } + + open val bar: String + field = "" + open get + + + + +} + +interface BaseI { + abstract fun foo() + abstract val bar: String + abstract get + + + + +} + +class Derived : Base, BaseI { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo() { + .foo() + } + + override val bar: String + override get(): String { + return .() + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsInAnnotationArguments.kt.txt new file mode 100644 index 00000000000..711c1e775ef --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsInAnnotationArguments.kt.txt @@ -0,0 +1,38 @@ +annotation class A1 : Annotation { + constructor(x: Int) /* primary */ + val x: Int + field = x + get + + + + +} + +annotation class A2 : Annotation { + constructor(a: A1) /* primary */ + val a: A1 + field = a + get + + + + +} + +annotation class AA : Annotation { + constructor(xs: Array) /* primary */ + val xs: Array + field = xs + get + + + + +} + +@A2(...) +@AA(...) +fun test() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.kt.txt new file mode 100644 index 00000000000..81c99af6ec3 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.kt.txt @@ -0,0 +1,35 @@ +annotation class A : Annotation { + constructor(x: String = "", y: Int = 42) /* primary */ + val x: String + field = x + get + + val y: Int + field = y + get + + + + +} + +@A(...) +fun test1() { +} + +@A(...) +fun test2() { +} + +@A(...) +fun test3() { +} + +@A(...) +fun test4() { +} + +@A(...) +fun test5() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsWithVarargParameters.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsWithVarargParameters.kt.txt new file mode 100644 index 00000000000..85037c6c8e0 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsWithVarargParameters.kt.txt @@ -0,0 +1,23 @@ +annotation class A : Annotation { + constructor(vararg xs: String) /* primary */ + val xs: Array + field = xs + get + + + + +} + +@A(...) +fun test1() { +} + +@A(...) +fun test2() { +} + +@A(...) +fun test3() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/arrayInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/arrayInAnnotationArguments.kt.txt new file mode 100644 index 00000000000..022c8245694 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/arrayInAnnotationArguments.kt.txt @@ -0,0 +1,32 @@ +annotation class TestAnnWithIntArray : Annotation { + constructor(x: IntArray) /* primary */ + val x: IntArray + field = x + get + + + + +} + +annotation class TestAnnWithStringArray : Annotation { + constructor(x: Array) /* primary */ + val x: Array + field = x + get + + + + +} + +@TestAnnWithIntArray(...) +@TestAnnWithStringArray(...) +fun test1() { +} + +@TestAnnWithIntArray(...) +@TestAnnWithStringArray(...) +fun test2() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.kt.txt b/compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.kt.txt new file mode 100644 index 00000000000..6e6eab96d8e --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.kt.txt @@ -0,0 +1,27 @@ +annotation class A : Annotation { + constructor(klass: KClass<*>) /* primary */ + val klass: KClass<*> + field = klass + get + + + + +} + +class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +@A(...) +fun test1() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt new file mode 100644 index 00000000000..d16a9469969 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt @@ -0,0 +1,98 @@ +annotation class TestAnn : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + + + + +} + +@TestAnn(...) +class TestClass { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +@TestAnn(...) +interface TestInterface { + + + +} + +@TestAnn(...) +object TestObject { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class Host { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + @TestAnn(...) + companion object TestCompanion { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + +@TestAnn(...) +enum class TestEnum : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnum /* Synthetic body for ENUM_VALUEOF */ + +} + +@TestAnn(...) +annotation class TestAnnotation : Annotation { + constructor() /* primary */ + + + +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/constExpressionsInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/constExpressionsInAnnotationArguments.kt.txt new file mode 100644 index 00000000000..22b8ae751cd --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/constExpressionsInAnnotationArguments.kt.txt @@ -0,0 +1,23 @@ +const val ONE: Int + field = 1 + get + +annotation class A : Annotation { + constructor(x: Int) /* primary */ + val x: Int + field = x + get + + + + +} + +@A(...) +fun test1() { +} + +@A(...) +fun test2() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.kt.txt new file mode 100644 index 00000000000..0eb4c898228 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.kt.txt @@ -0,0 +1,29 @@ +annotation class TestAnn : Annotation { + constructor(x: Int) /* primary */ + val x: Int + field = x + get + + + + +} + +class TestClass { + @TestAnn(...) + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + @TestAnn(...) + constructor(x: Int) { + TODO("IrDelegatingConstructorCall") + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.kt.txt new file mode 100644 index 00000000000..b8983dcc818 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.kt.txt @@ -0,0 +1,16 @@ +annotation class Ann : Annotation { + constructor() /* primary */ + + + +} + +val test1: Int /* by */ + field = lazy(initializer = local fun (): Int { + return 42 + } +) + get(): Int { + return getValue($receiver = #test1$delegate, thisRef = null, property = ::test1) + } + diff --git a/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt new file mode 100644 index 00000000000..18880d0e373 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt @@ -0,0 +1,54 @@ +annotation class A : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + + + + +} + +class Cell { + constructor(value: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var value: Int + field = value + get + set + + operator fun getValue(thisRef: Any?, kProp: Any?): Int { + return .() + } + + operator fun setValue(thisRef: Any?, kProp: Any?, newValue: Int) { + .( = newValue) + } + + + + +} + +val test1: Int /* by */ + field = TODO("IrConstructorCall") + @A(...) + get(): Int { + return #test1$delegate.getValue(thisRef = null, kProp = ::test1) + } + +var test2: Int /* by */ + field = TODO("IrConstructorCall") + @A(...) + get(): Int { + return #test2$delegate.getValue(thisRef = null, kProp = ::test2) + } + @A(...) + set(: Int) { + return #test2$delegate.setValue(thisRef = null, kProp = ::test2, newValue = ) + } + diff --git a/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.kt.txt new file mode 100644 index 00000000000..7b20269bb30 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.kt.txt @@ -0,0 +1,33 @@ +annotation class TestAnn : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + + + + +} + +open enum class TestEnum : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + @TestAnn(...) + ENTRY1 init = TODO("IrEnumConstructorCall") @TestAnn(...) + ENTRY2 init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnum /* Synthetic body for ENUM_VALUEOF */ + +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt new file mode 100644 index 00000000000..738f36ef3cf --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt @@ -0,0 +1,35 @@ +enum class En : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + A init = TODO("IrEnumConstructorCall") B init = TODO("IrEnumConstructorCall") C init = TODO("IrEnumConstructorCall") D init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): En /* Synthetic body for ENUM_VALUEOF */ + +} + +annotation class TestAnn : Annotation { + constructor(x: En) /* primary */ + val x: En + field = x + get + + + + +} + +@TestAnn(...) +fun test1() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/fieldsWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/fieldsWithAnnotations.kt.txt new file mode 100644 index 00000000000..71c9a5e261f --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/fieldsWithAnnotations.kt.txt @@ -0,0 +1,20 @@ +annotation class TestAnn : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + + + + +} + +val testVal: String + field = "a val" + get + +var testVar: String + field = "a var" + get + set + diff --git a/compiler/testData/ir/irText/declarations/annotations/fileAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/fileAnnotations.kt.txt new file mode 100644 index 00000000000..6f671ccd6ea --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/fileAnnotations.kt.txt @@ -0,0 +1,15 @@ +@file:A(...) +package test + +@Target(...) +annotation class A : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/functionsWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/functionsWithAnnotations.kt.txt new file mode 100644 index 00000000000..615eedabed1 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/functionsWithAnnotations.kt.txt @@ -0,0 +1,15 @@ +annotation class TestAnn : Annotation { + constructor(x: Int) /* primary */ + val x: Int + field = x + get + + + + +} + +@TestAnn(...) +fun testSimpleFunction() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/javaAnnotation.kt.txt b/compiler/testData/ir/irText/declarations/annotations/javaAnnotation.kt.txt new file mode 100644 index 00000000000..0adaea091db --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/javaAnnotation.kt.txt @@ -0,0 +1,12 @@ +@JavaAnn(...) +fun test1() { +} + +@JavaAnn(...) +fun test2() { +} + +@JavaAnn(...) +fun test3() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.kt.txt new file mode 100644 index 00000000000..ab8caeb375d --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.kt.txt @@ -0,0 +1,25 @@ +annotation class A : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + + + + +} + +fun foo(m: Map) { + @A(...) + val test: Int + val test$delegate: Lazy = lazy(initializer = local fun (): Int { + return 42 + } +) + local get(): Int { + return getValue($receiver = test$delegate, thisRef = null, property = ::test) + } + + +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/multipleAnnotationsInSquareBrackets.kt.txt b/compiler/testData/ir/irText/declarations/annotations/multipleAnnotationsInSquareBrackets.kt.txt new file mode 100644 index 00000000000..1f9fe854869 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/multipleAnnotationsInSquareBrackets.kt.txt @@ -0,0 +1,27 @@ +annotation class A1 : Annotation { + constructor() /* primary */ + + + +} + +annotation class A2 : Annotation { + constructor() /* primary */ + + + +} + +annotation class A3 : Annotation { + constructor() /* primary */ + + + +} + +@A1 +@A2 +@A3 +fun test() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.kt.txt new file mode 100644 index 00000000000..e40a2cd8d16 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.kt.txt @@ -0,0 +1,23 @@ +annotation class Ann : Annotation { + constructor() /* primary */ + + + +} + +class Test { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/propertiesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/propertiesWithAnnotations.kt.txt new file mode 100644 index 00000000000..671adf72795 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/propertiesWithAnnotations.kt.txt @@ -0,0 +1,16 @@ +annotation class TestAnn : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + + + + +} + +@TestAnn(...) +val testVal: String + field = "" + get + diff --git a/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.kt.txt new file mode 100644 index 00000000000..1b03d965163 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.kt.txt @@ -0,0 +1,35 @@ +annotation class A : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + + + + +} + +class C { + constructor(x: Int, y: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + @A(...) + get + + var y: Int + field = y + @A(...) + get + @A(...) + set + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsWithAnnotations.kt.txt new file mode 100644 index 00000000000..aeeb6ff9e3b --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsWithAnnotations.kt.txt @@ -0,0 +1,38 @@ +annotation class TestAnn : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + + + + +} + +val test1: String + @TestAnn(...) + get(): String { + return "" + } + +var test2: String + @TestAnn(...) + get(): String { + return "" + } + @TestAnn(...) + set(value: String) { + } + +val test3: String + field = "" + @TestAnn(...) + get + +var test4: String + field = "" + @TestAnn(...) + get + @TestAnn(...) + set + diff --git a/compiler/testData/ir/irText/declarations/annotations/propertySetterParameterWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/propertySetterParameterWithAnnotations.kt.txt new file mode 100644 index 00000000000..58fe08cf983 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/propertySetterParameterWithAnnotations.kt.txt @@ -0,0 +1,29 @@ +annotation class AnnParam : Annotation { + constructor() /* primary */ + + + +} + +var p: Int + field = 0 + get + set + +class C { + constructor(p: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var p: Int + field = p + get + set + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/receiverParameterWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/receiverParameterWithAnnotations.kt.txt new file mode 100644 index 00000000000..982aab5d8d0 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/receiverParameterWithAnnotations.kt.txt @@ -0,0 +1,37 @@ +annotation class Ann : Annotation { + constructor() /* primary */ + + + +} + +class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun String.f(): String { + return "" + } + + val String?.p: String + get(): String { + return "" + } + + + + +} + +fun String?.topLevelF(): String { + return "" +} + +val String.topLevelP: String + get(): String { + return "" + } + diff --git a/compiler/testData/ir/irText/declarations/annotations/spreadOperatorInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/spreadOperatorInAnnotationArguments.kt.txt new file mode 100644 index 00000000000..fe14e8913cc --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/spreadOperatorInAnnotationArguments.kt.txt @@ -0,0 +1,15 @@ +annotation class A : Annotation { + constructor(vararg xs: String) /* primary */ + val xs: Array + field = xs + get + + + + +} + +@A(...) +fun test() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/typeAliasesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/typeAliasesWithAnnotations.kt.txt new file mode 100644 index 00000000000..64585d31b17 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/typeAliasesWithAnnotations.kt.txt @@ -0,0 +1,14 @@ +@Target(...) +annotation class TestAnn : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + + + + +} + +@TestAnn(...) +typealias TestTypeAlias = String diff --git a/compiler/testData/ir/irText/declarations/annotations/typeParametersWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/typeParametersWithAnnotations.kt.txt new file mode 100644 index 00000000000..4ac7ec179e9 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/typeParametersWithAnnotations.kt.txt @@ -0,0 +1,11 @@ +@Target(...) +annotation class Anno : Annotation { + constructor() /* primary */ + + + +} + +fun <@Anno T : Any?> foo() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.kt.txt new file mode 100644 index 00000000000..6485b01a174 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.kt.txt @@ -0,0 +1,30 @@ +annotation class TestAnn : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + + + + +} + +fun testFun(x: Int) { +} + +class TestClassConstructor1 { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val xx: Int + field = x + get + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/varargsInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/varargsInAnnotationArguments.kt.txt new file mode 100644 index 00000000000..942b42a11a7 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/varargsInAnnotationArguments.kt.txt @@ -0,0 +1,45 @@ +annotation class A1 : Annotation { + constructor(vararg xs: Int) /* primary */ + val xs: IntArray + field = xs + get + + + + +} + +annotation class A2 : Annotation { + constructor(vararg xs: String) /* primary */ + val xs: Array + field = xs + get + + + + +} + +annotation class AA : Annotation { + constructor(vararg xs: A1) /* primary */ + val xs: Array + field = xs + get + + + + +} + +@A1(...) +@A2(...) +@AA(...) +fun test1() { +} + +@A1(...) +@A2(...) +@AA(...) +fun test2() { +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/variablesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/variablesWithAnnotations.kt.txt new file mode 100644 index 00000000000..b9795f116f8 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/variablesWithAnnotations.kt.txt @@ -0,0 +1,18 @@ +annotation class TestAnn : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + + + + +} + +fun foo() { + @TestAnn(...) + val testVal: String = "testVal" + @TestAnn(...) + var testVar: String = "testVar" +} + diff --git a/compiler/testData/ir/irText/declarations/catchParameterInTopLevelProperty.kt.txt b/compiler/testData/ir/irText/declarations/catchParameterInTopLevelProperty.kt.txt new file mode 100644 index 00000000000..81a302db6ff --- /dev/null +++ b/compiler/testData/ir/irText/declarations/catchParameterInTopLevelProperty.kt.txt @@ -0,0 +1,8 @@ +val test: Unit + field = try { //BLOCK + } + catch (...) { //BLOCK + } + + get + diff --git a/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt b/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt new file mode 100644 index 00000000000..61768233b4d --- /dev/null +++ b/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt @@ -0,0 +1,60 @@ +class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val test1: Int + field = 0 + get + + val test2: Int + get(): Int { + return 0 + } + + var test3: Int + field = 0 + get + set + + var test4: Int + field = 1 + get + set(value: Int) { + #test4 = value + } + + var test5: Int + field = 1 + get + private set + + val test6: Int + field = 1 + get + + val test7: Int /* by */ + field = lazy(initializer = local fun (): Int { + return 42 + } +) + get(): Int { + return getValue($receiver = #test7$delegate, thisRef = , property = ::test7) + } + + var test8: Int /* by */ + field = hashMapOf() + get(): Int { + return getValue($receiver = #test8$delegate, thisRef = , property = ::test8) + } + set(: Int) { + return setValue($receiver = #test8$delegate, thisRef = , property = ::test8, value = ) + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/constValInitializers.kt.txt b/compiler/testData/ir/irText/declarations/constValInitializers.kt.txt new file mode 100644 index 00000000000..d1caf458f2a --- /dev/null +++ b/compiler/testData/ir/irText/declarations/constValInitializers.kt.txt @@ -0,0 +1,28 @@ +const val I0: Int + field = 0 + get + +const val I1: Int + field = 1 + get + +const val I2: Int + field = 2 + get + +const val STR1: String + field = "String1" + get + +const val STR2: String + field = "String2" + get + +const val STR3: String + field = "String1String2" + get + +const val STR4: String + field = "String1String2" + get + diff --git a/compiler/testData/ir/irText/declarations/defaultArguments.kt.txt b/compiler/testData/ir/irText/declarations/defaultArguments.kt.txt new file mode 100644 index 00000000000..a2dca6a28e0 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/defaultArguments.kt.txt @@ -0,0 +1,7 @@ +fun test1(x: Int, y: Int = 0, z: String = "abc") { + local fun local(xx: Int = x, yy: Int = y, zz: String = z) { + } + + +} + diff --git a/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt b/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt new file mode 100644 index 00000000000..8adc36222ad --- /dev/null +++ b/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt @@ -0,0 +1,52 @@ +val test1: Int /* by */ + field = lazy(initializer = local fun (): Int { + return 42 + } +) + get(): Int { + return getValue($receiver = #test1$delegate, thisRef = null, property = ::test1) + } + +class C { + constructor(map: MutableMap) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val map: MutableMap + field = map + get + + val test2: Int /* by */ + field = lazy(initializer = local fun (): Int { + return 42 + } +) + get(): Int { + return getValue($receiver = #test2$delegate, thisRef = , property = ::test2) + } + + var test3: Any /* by */ + field = .() + get(): Any { + return getValue($receiver = #test3$delegate, thisRef = , property = ::test3) + } + set(: Any) { + return setValue($receiver = #test3$delegate, thisRef = , property = ::test3, value = ) + } + + + + +} + +var test4: Any /* by */ + field = hashMapOf() + get(): Any { + return getValue($receiver = #test4$delegate, thisRef = null, property = ::test4) + } + set(: Any) { + return setValue($receiver = #test4$delegate, thisRef = null, property = ::test4, value = ) + } + diff --git a/compiler/testData/ir/irText/declarations/deprecatedProperty.kt.txt b/compiler/testData/ir/irText/declarations/deprecatedProperty.kt.txt new file mode 100644 index 00000000000..af4c0bc60ad --- /dev/null +++ b/compiler/testData/ir/irText/declarations/deprecatedProperty.kt.txt @@ -0,0 +1,67 @@ +@Deprecated(...) +val testVal: Int + field = 1 + get + +@Deprecated(...) +var testVar: Int + field = 1 + get + set + +@Deprecated(...) +val testValWithExplicitDefaultGet: Int + field = 1 + get + +@Deprecated(...) +val testValWithExplicitGet: Int + get(): Int { + return 1 + } + +@Deprecated(...) +var testVarWithExplicitDefaultGet: Int + field = 1 + get + set + +@Deprecated(...) +var testVarWithExplicitDefaultSet: Int + field = 1 + get + set + +@Deprecated(...) +var testVarWithExplicitDefaultGetSet: Int + field = 1 + get + set + +@Deprecated(...) +var testVarWithExplicitGetSet: Int + get(): Int { + return 1 + } + set(v: Int) { + } + +@Deprecated(...) +lateinit var testLateinitVar: Any + get + set + +@Deprecated(...) +val Any.testExtVal: Int + get(): Int { + return 1 + } + +@Deprecated(...) +var Any.textExtVar: Int + get(): Int { + return 1 + } + set(v: Int) { + } + diff --git a/compiler/testData/ir/irText/declarations/extensionProperties.kt.txt b/compiler/testData/ir/irText/declarations/extensionProperties.kt.txt new file mode 100644 index 00000000000..89d96b22654 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/extensionProperties.kt.txt @@ -0,0 +1,36 @@ +val String.test1: Int + get(): Int { + return 42 + } + +var String.test2: Int + get(): Int { + return 42 + } + set(value: Int) { + } + +class Host { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val String.test3: Int + get(): Int { + return 42 + } + + var String.test4: Int + get(): Int { + return 42 + } + set(value: Int) { + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/fakeOverrides.kt.txt b/compiler/testData/ir/irText/declarations/fakeOverrides.kt.txt new file mode 100644 index 00000000000..b4b4e8be196 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/fakeOverrides.kt.txt @@ -0,0 +1,48 @@ +interface IFooStr { + abstract fun foo(x: String) + + + +} + +interface IBar { + abstract val bar: Int + abstract get + + + + +} + +abstract class CFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo(x: T) { + } + + + + +} + +class Test1 : CFoo, IFooStr, IBar { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override val bar: Int + field = 42 + override get + + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/fileWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/fileWithAnnotations.kt.txt new file mode 100644 index 00000000000..8d420ce8046 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/fileWithAnnotations.kt.txt @@ -0,0 +1,9 @@ +@file:JvmName(...) + +fun foo() { +} + +val bar: Int + field = 42 + get + diff --git a/compiler/testData/ir/irText/declarations/fileWithTypeAliasesOnly.kt.txt b/compiler/testData/ir/irText/declarations/fileWithTypeAliasesOnly.kt.txt new file mode 100644 index 00000000000..50f697dbc77 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/fileWithTypeAliasesOnly.kt.txt @@ -0,0 +1 @@ +typealias Bar = Function1 diff --git a/compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt.txt b/compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt.txt new file mode 100644 index 00000000000..e251ad487c7 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt.txt @@ -0,0 +1,40 @@ +class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +object Delegate { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + operator fun getValue(thisRef: Any?, kProp: Any?): Int { + return 42 + } + + operator fun setValue(thisRef: Any?, kProp: Any?, newValue: Int) { + } + + + + +} + +var C.genericDelegatedProperty: Int /* by */ + field = Delegate + get(): Int { + return #genericDelegatedProperty$delegate.getValue(thisRef = , kProp = ::genericDelegatedProperty) + } + set(: Int) { + return #genericDelegatedProperty$delegate.setValue(thisRef = , kProp = ::genericDelegatedProperty, newValue = ) + } + diff --git a/compiler/testData/ir/irText/declarations/interfaceProperties.kt.txt b/compiler/testData/ir/irText/declarations/interfaceProperties.kt.txt new file mode 100644 index 00000000000..fb728387d4a --- /dev/null +++ b/compiler/testData/ir/irText/declarations/interfaceProperties.kt.txt @@ -0,0 +1,25 @@ +interface C { + abstract val test1: Int + abstract get + + val test2: Int + get(): Int { + return 0 + } + + abstract var test3: Int + abstract get + abstract set + + var test4: Int + get(): Int { + return 0 + } + set(value: Int) { + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/kt27005.kt.txt b/compiler/testData/ir/irText/declarations/kt27005.kt.txt new file mode 100644 index 00000000000..0601dd1634d --- /dev/null +++ b/compiler/testData/ir/irText/declarations/kt27005.kt.txt @@ -0,0 +1,12 @@ +suspend fun foo() { + return baz() +} + +suspend fun bar(): Any { + return baz() +} + +suspend fun baz(): T { + TODO() +} + diff --git a/compiler/testData/ir/irText/declarations/kt29833.kt.txt b/compiler/testData/ir/irText/declarations/kt29833.kt.txt new file mode 100644 index 00000000000..476db0fd560 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/kt29833.kt.txt @@ -0,0 +1,22 @@ +package interop + +object Definitions { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + const val KT_CONSTANT: String + field = "constant" + get + + val ktValue: String + field = #CONSTANT + get + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/kt35550.kt.txt b/compiler/testData/ir/irText/declarations/kt35550.kt.txt new file mode 100644 index 00000000000..2c5d4c77ac6 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/kt35550.kt.txt @@ -0,0 +1,29 @@ +interface I { + val T.id: T + get(): T { + return + } + + + + +} + +class A : I { + constructor(i: I) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: I = i + override val T.id: T + override get(): T { + return #$$delegate_0.($receiver = ) + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/localClassWithOverrides.kt.txt b/compiler/testData/ir/irText/declarations/localClassWithOverrides.kt.txt new file mode 100644 index 00000000000..d30600b0bdf --- /dev/null +++ b/compiler/testData/ir/irText/declarations/localClassWithOverrides.kt.txt @@ -0,0 +1,49 @@ +fun outer() { + local abstract class ALocal { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + abstract fun afun() + abstract val aval: Int + abstract get + + abstract var avar: Int + abstract get + abstract set + + + + + } + + + local class Local : ALocal { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun afun() { + } + + override val aval: Int + field = 1 + override get + + override var avar: Int + field = 2 + override get + override set + + + + + } + + +} + diff --git a/compiler/testData/ir/irText/declarations/localDelegatedProperties.kt.txt b/compiler/testData/ir/irText/declarations/localDelegatedProperties.kt.txt new file mode 100644 index 00000000000..c09352b6bbb --- /dev/null +++ b/compiler/testData/ir/irText/declarations/localDelegatedProperties.kt.txt @@ -0,0 +1,34 @@ +fun test1() { + val x: Int + val x$delegate: Lazy = lazy(initializer = local fun (): Int { + return 42 + } +) + local get(): Int { + return getValue($receiver = x$delegate, thisRef = null, property = ::x) + } + + + println(message = ()) +} + +fun test2() { + var x: Int + val x$delegate: HashMap = hashMapOf() + local get(): Int { + return getValue($receiver = x$delegate, thisRef = null, property = ::x) + } + local set(value: Int) { + return setValue($receiver = x$delegate, thisRef = null, property = ::x, value = value) + } + + + (value = 0) + { //BLOCK + val tmp0: Int = () + (value = tmp0.inc()) + tmp0 + } /*~> Unit */ + (value = ().plus(other = 1)) +} + diff --git a/compiler/testData/ir/irText/declarations/localVarInDoWhile.kt.txt b/compiler/testData/ir/irText/declarations/localVarInDoWhile.kt.txt new file mode 100644 index 00000000000..0ba20a802ad --- /dev/null +++ b/compiler/testData/ir/irText/declarations/localVarInDoWhile.kt.txt @@ -0,0 +1,8 @@ +fun foo() { + { //BLOCK + do// COMPOSITE { + val x: Int = 42 + // } while (EQEQ(arg0 = x, arg1 = 42).not()) + } +} + diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectClassInherited.kt.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectClassInherited.kt.txt new file mode 100644 index 00000000000..cb047fd67b3 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectClassInherited.kt.txt @@ -0,0 +1,48 @@ +expect abstract class A { + protected expect constructor() /* primary */ + expect abstract fun foo() + + + +} + +expect open class B : A { + expect constructor(i: Int) /* primary */ + expect override fun foo() + expect open fun bar(s: String) + + + +} + +abstract class A { + protected constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + abstract fun foo() + + + +} + +open class B : A { + constructor(i: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo() { + } + + open fun bar(s: String) { + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.kt.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.kt.txt new file mode 100644 index 00000000000..c0bc3b9a218 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.kt.txt @@ -0,0 +1,36 @@ +expect enum class MyEnum : Enum { + FOO + BAR + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): MyEnum /* Synthetic body for ENUM_VALUEOF */ + +} + +enum class MyEnum : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + FOO init = TODO("IrEnumConstructorCall") BAR init = TODO("IrEnumConstructorCall") BAZ init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): MyEnum /* Synthetic body for ENUM_VALUEOF */ + +} + diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.kt.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.kt.txt new file mode 100644 index 00000000000..0593c6a91cd --- /dev/null +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.kt.txt @@ -0,0 +1,38 @@ +expect sealed class Ops { + private expect constructor() /* primary */ + + + +} + +expect class Add : Ops { + expect constructor() /* primary */ + + + +} + +sealed class Ops { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class Add : Ops { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/packageLevelProperties.kt.txt b/compiler/testData/ir/irText/declarations/packageLevelProperties.kt.txt new file mode 100644 index 00000000000..cfb6b100bc7 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/packageLevelProperties.kt.txt @@ -0,0 +1,48 @@ +val test1: Int + field = 0 + get + +val test2: Int + get(): Int { + return 0 + } + +var test3: Int + field = 0 + get + set + +var test4: Int + field = 1 + get + set(value: Int) { + #test4 = value + } + +var test5: Int + field = 1 + get + private set + +val test6: Int + field = 1 + get + +val test7: Int /* by */ + field = lazy(initializer = local fun (): Int { + return 42 + } +) + get(): Int { + return getValue($receiver = #test7$delegate, thisRef = null, property = ::test7) + } + +var test8: Int /* by */ + field = hashMapOf() + get(): Int { + return getValue($receiver = #test8$delegate, thisRef = null, property = ::test8) + } + set(: Int) { + return setValue($receiver = #test8$delegate, thisRef = null, property = ::test8, value = ) + } + diff --git a/compiler/testData/ir/irText/declarations/parameters/class.kt.txt b/compiler/testData/ir/irText/declarations/parameters/class.kt.txt new file mode 100644 index 00000000000..e0dabfcde44 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/class.kt.txt @@ -0,0 +1,48 @@ +interface TestInterface { + interface TestNestedInterface { + + + + } + + + + +} + +class Test { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + class TestNested { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + inner class TestInner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/parameters/constructor.kt.txt b/compiler/testData/ir/irText/declarations/parameters/constructor.kt.txt new file mode 100644 index 00000000000..c6459372149 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/constructor.kt.txt @@ -0,0 +1,96 @@ +class Test1 { + constructor(x: T1, y: T2) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: T1 + field = x + get + + val y: T2 + field = y + get + + + + +} + +class Test2 { + constructor(x: Int, y: String) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val y: String + field = y + get + + inner class TestInner { + constructor(z: Z) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val z: Z + field = z + get + + constructor(z: Z, i: Int) { + TODO("IrDelegatingConstructorCall") + } + + + + + } + + + + +} + +class Test3 { + constructor(x: Int, y: String = "") /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + val y: String + field = y + get + + + + +} + +class Test4 { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + constructor(x: Int, y: Int = 42) { + TODO("IrDelegatingConstructorCall") + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt new file mode 100644 index 00000000000..97c51aa08c6 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt @@ -0,0 +1,63 @@ +data class Test { + constructor(x: T, y: String = "") /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: T + field = x + get + + val y: String + field = y + get + + operator fun component1(): T { + return #x + } + + operator fun component2(): String { + return #y + } + + fun copy(x: T = #x, y: String = #y): Test { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "Test(" + +"x=" + +#x + +", " + +"y=" + +#y + +")" + } + + override fun hashCode(): Int { + return when { + EQEQ(arg0 = #x, arg1 = null) -> 0 + true -> #x.hashCode() + }.times(other = 31).plus(other = #y.hashCode()) + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test -> return false + } + val tmp0_other_with_cast: Test = other as Test + when { + EQEQ(arg0 = #x, arg1 = #x).not() -> return false + } + when { + EQEQ(arg0 = #y, arg1 = #y).not() -> return false + } + return true + } + +} + diff --git a/compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.kt.txt b/compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.kt.txt new file mode 100644 index 00000000000..11dc09f1d13 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.kt.txt @@ -0,0 +1,51 @@ +val test1: Int + field = 42 + get + +var test2: Int + field = 42 + get + set + +class Host { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val testMember1: Int + field = 42 + get + + var testMember2: Int + field = 42 + get + set + + + + +} + +class InPrimaryCtor { + constructor(testInPrimaryCtor1: T, testInPrimaryCtor2: Int = 42) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val testInPrimaryCtor1: T + field = testInPrimaryCtor1 + get + + var testInPrimaryCtor2: Int + field = testInPrimaryCtor2 + get + set + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt new file mode 100644 index 00000000000..b46221efc9f --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt @@ -0,0 +1,37 @@ +interface IBase { + abstract fun foo(x: Int) + abstract val bar: Int + abstract get + + abstract fun qux(t: T, x: X) + + + +} + +class Test : IBase { + constructor(impl: IBase) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: IBase = impl + override fun qux(t: TT, x: X) { + #$$delegate_0.qux(t = t, x = x) + } + + override fun foo(x: Int) { + #$$delegate_0.foo(x = x) + } + + override val bar: Int + override get(): Int { + return #$$delegate_0.() + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/parameters/fun.kt.txt b/compiler/testData/ir/irText/declarations/parameters/fun.kt.txt new file mode 100644 index 00000000000..b037bbb251f --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/fun.kt.txt @@ -0,0 +1,30 @@ +fun test1(i: Int, j: T) { +} + +fun test2(i: Int = 0, j: String = "") { +} + +fun test3(vararg args: String) { +} + +fun String.textExt1(i: Int, j: String) { +} + +class Host { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun String.testMembetExt1(i: Int, j: String) { + } + + fun String.testMembetExt2(i: Int, j: T) { + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/parameters/genericInnerClass.kt.txt b/compiler/testData/ir/irText/declarations/parameters/genericInnerClass.kt.txt new file mode 100644 index 00000000000..1d8f8e12210 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/genericInnerClass.kt.txt @@ -0,0 +1,27 @@ +class Outer { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + inner class Inner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo(x1: T1, x2: T2) { + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/parameters/lambdas.kt.txt b/compiler/testData/ir/irText/declarations/parameters/lambdas.kt.txt new file mode 100644 index 00000000000..925e802a909 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/lambdas.kt.txt @@ -0,0 +1,27 @@ +val test1: Function1 + field = local fun (it: String): String { + return it + } + + get + +val test2: @ExtensionFunctionType Function2 + field = local fun Any.(it: Any): Int { + return it.hashCode() + } + + get + +val test3: Function2 + field = local fun (i: Int, j: Int) { + return Unit + } + + get + +val test4: Function2 + field = local fun (i: Int, j: Int) { + } + + get + diff --git a/compiler/testData/ir/irText/declarations/parameters/localFun.kt.txt b/compiler/testData/ir/irText/declarations/parameters/localFun.kt.txt new file mode 100644 index 00000000000..eb35ac3ce24 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/localFun.kt.txt @@ -0,0 +1,19 @@ +fun outer() { + local fun test1(i: Int, j: T) { + } + + + local fun test2(i: Int = 0, j: String = "") { + } + + + local fun test3(vararg args: String) { + } + + + local fun String.textExt1(i: Int, j: TT) { + } + + +} + diff --git a/compiler/testData/ir/irText/declarations/parameters/propertyAccessors.kt.txt b/compiler/testData/ir/irText/declarations/parameters/propertyAccessors.kt.txt new file mode 100644 index 00000000000..b7c7fa7e6c3 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/propertyAccessors.kt.txt @@ -0,0 +1,84 @@ +val test1: Int + get(): Int { + return 42 + } + +var test2: Int + get(): Int { + return 42 + } + set(value: Int) { + } + +val String.testExt1: Int + get(): Int { + return 42 + } + +var String.testExt2: Int + get(): Int { + return 42 + } + set(value: Int) { + } + +val T.testExt3: Int + get(): Int { + return 42 + } + +var T.testExt4: Int + get(): Int { + return 42 + } + set(value: Int) { + } + +class Host { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val testMem1: Int + get(): Int { + return 42 + } + + var testMem2: Int + get(): Int { + return 42 + } + set(value: Int) { + } + + val String.testMemExt1: Int + get(): Int { + return 42 + } + + var String.testMemExt2: Int + get(): Int { + return 42 + } + set(value: Int) { + } + + val TT.testMemExt3: Int + get(): Int { + return 42 + } + + var TT.testMemExt4: Int + get(): Int { + return 42 + } + set(value: Int) { + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/parameters/typeParameterBeforeBound.kt.txt b/compiler/testData/ir/irText/declarations/parameters/typeParameterBeforeBound.kt.txt new file mode 100644 index 00000000000..d4357727646 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/typeParameterBeforeBound.kt.txt @@ -0,0 +1,21 @@ +class Test1 { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +fun test2() { +} + +var Test1.test3: Unit + get() { + } + set(value: Unit) { + } + diff --git a/compiler/testData/ir/irText/declarations/parameters/typeParameterBoundedBySubclass.kt.txt b/compiler/testData/ir/irText/declarations/parameters/typeParameterBoundedBySubclass.kt.txt new file mode 100644 index 00000000000..67a57838a10 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/typeParameterBoundedBySubclass.kt.txt @@ -0,0 +1,52 @@ +abstract class Base1 { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class Derived1 : Base1 { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +abstract class Base2 { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo(x: T) { + } + + + + +} + +class Derived2 : Base2 { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.kt.txt b/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.kt.txt new file mode 100644 index 00000000000..8d97fb2bef8 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.kt.txt @@ -0,0 +1,28 @@ +fun f(f1: Function0 = local fun (): String { + return f2.invoke() +} +, f2: Function0 = local fun (): String { + return "FAIL" +} +): String { + return f1.invoke() +} + +fun box(): String { + var result: String = "fail" + try { //BLOCK + f() /*~> Unit */ + } + catch (...) { //BLOCK + result = "OK" + } + + return f(, f2 = local fun (): String { + return "O" + } +).plus(other = f(f1 = local fun (): String { + return "K" + } +)) +} + diff --git a/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.kt.txt b/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.kt.txt new file mode 100644 index 00000000000..3ddc35b5ccf --- /dev/null +++ b/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.kt.txt @@ -0,0 +1,16 @@ +class Test { + constructor(x: Int = 0) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/primaryCtorProperties.kt.txt b/compiler/testData/ir/irText/declarations/primaryCtorProperties.kt.txt new file mode 100644 index 00000000000..0490a0fead8 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/primaryCtorProperties.kt.txt @@ -0,0 +1,21 @@ +class C { + constructor(test1: Int, test2: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val test1: Int + field = test1 + get + + var test2: Int + field = test2 + get + set + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt new file mode 100644 index 00000000000..1f6a03a16b7 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt @@ -0,0 +1,40 @@ +class MyClass { + constructor(value: String) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: String + field = value + get + + + + +} + +operator fun MyClass.provideDelegate(host: Any?, p: Any): String { + return .() +} + +operator fun String.getValue(receiver: Any?, p: Any): String { + return +} + +val testO: String /* by */ + field = provideDelegate($receiver = TODO("IrConstructorCall"), host = null, p = ::testO) + get(): String { + return getValue($receiver = #testO$delegate, receiver = null, p = ::testO) + } + +val testK: String /* by */ + field = "K" + get(): String { + return getValue($receiver = #testK$delegate, receiver = null, p = ::testK) + } + +val testOK: String + field = ().plus(other = ()) + get + diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/local.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/local.kt.txt new file mode 100644 index 00000000000..1721d1eea00 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/provideDelegate/local.kt.txt @@ -0,0 +1,50 @@ +class Delegate { + constructor(value: String) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: String + field = value + get + + operator fun getValue(thisRef: Any?, property: Any?): String { + return .() + } + + + + +} + +class DelegateProvider { + constructor(value: String) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: String + field = value + get + + operator fun provideDelegate(thisRef: Any?, property: Any?): Delegate { + return TODO("IrConstructorCall") + } + + + + +} + +fun foo() { + val testMember: String + val testMember$delegate: Delegate = TODO("IrConstructorCall").provideDelegate(thisRef = null, property = ::testMember) + local get(): String { + return testMember$delegate.getValue(thisRef = null, property = ::testMember) + } + + +} + diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt new file mode 100644 index 00000000000..4555d57fb14 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt @@ -0,0 +1,43 @@ +class MyClass { + constructor(value: String) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: String + field = value + get + + + + +} + +operator fun MyClass.provideDelegate(host: Any?, p: Any): String { + return .() +} + +operator fun String.getValue(receiver: Any?, p: Any): String { + return +} + +fun box(): String { + val testO: String + val testO$delegate: String = provideDelegate($receiver = TODO("IrConstructorCall"), host = null, p = ::testO) + local get(): String { + return getValue($receiver = testO$delegate, receiver = null, p = ::testO) + } + + + val testK: String + val testK$delegate: String = "K" + local get(): String { + return getValue($receiver = testK$delegate, receiver = null, p = ::testK) + } + + + val testOK: String = ().plus(other = ()) + return testOK +} + diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt new file mode 100644 index 00000000000..98919c32093 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt @@ -0,0 +1,58 @@ +class Delegate { + constructor(value: String) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: String + field = value + get + + operator fun getValue(thisRef: Any?, property: Any?): String { + return .() + } + + + + +} + +class DelegateProvider { + constructor(value: String) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: String + field = value + get + + operator fun provideDelegate(thisRef: Any?, property: Any?): Delegate { + return TODO("IrConstructorCall") + } + + + + +} + +class Host { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val testMember: String /* by */ + field = TODO("IrConstructorCall").provideDelegate(thisRef = , property = ::testMember) + get(): String { + return #testMember$delegate.getValue(thisRef = , property = ::testMember) + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt new file mode 100644 index 00000000000..27443f19648 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt @@ -0,0 +1,46 @@ +object Host { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + class StringDelegate { + constructor(s: String) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val s: String + field = s + get + + operator fun getValue(receiver: String, p: Any): String { + return receiver.plus(other = .()) + } + + + + + } + + operator fun String.provideDelegate(host: Any?, p: Any): StringDelegate { + return TODO("IrConstructorCall") + } + + val String.plusK: String /* by */ + field = .provideDelegate($receiver = "K", host = , p = ::plusK) + get(): String { + return #plusK$delegate.getValue(receiver = , p = ::plusK) + } + + val ok: String + field = .($receiver = "O") + get + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.kt.txt new file mode 100644 index 00000000000..e470542c0da --- /dev/null +++ b/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.kt.txt @@ -0,0 +1,46 @@ +class Delegate { + constructor(value: String) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: String + field = value + get + + operator fun getValue(thisRef: Any?, property: Any?): String { + return .() + } + + + + +} + +class DelegateProvider { + constructor(value: String) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: String + field = value + get + + operator fun provideDelegate(thisRef: Any?, property: Any?): Delegate { + return TODO("IrConstructorCall") + } + + + + +} + +val testTopLevel: String /* by */ + field = TODO("IrConstructorCall").provideDelegate(thisRef = null, property = ::testTopLevel) + get(): String { + return #testTopLevel$delegate.getValue(thisRef = null, property = ::testTopLevel) + } + diff --git a/compiler/testData/ir/irText/declarations/typeAlias.kt.txt b/compiler/testData/ir/irText/declarations/typeAlias.kt.txt new file mode 100644 index 00000000000..1a0b5a5c619 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/typeAlias.kt.txt @@ -0,0 +1,20 @@ +typealias Test1 = String +fun foo() { + { //BLOCK + } +} + +class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + @Suppress(...) + typealias TestNested = String + + + +} + diff --git a/compiler/testData/ir/irText/errors/suppressedNonPublicCall.kt.txt b/compiler/testData/ir/irText/errors/suppressedNonPublicCall.kt.txt new file mode 100644 index 00000000000..6b5513aa06e --- /dev/null +++ b/compiler/testData/ir/irText/errors/suppressedNonPublicCall.kt.txt @@ -0,0 +1,19 @@ +class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + internal fun bar() { + } + + + + +} + +inline fun C.foo() { + .bar() +} + diff --git a/compiler/testData/ir/irText/errors/unresolvedReference.kt.txt b/compiler/testData/ir/irText/errors/unresolvedReference.kt.txt new file mode 100644 index 00000000000..c72f3b8a302 --- /dev/null +++ b/compiler/testData/ir/irText/errors/unresolvedReference.kt.txt @@ -0,0 +1,16 @@ +val test1: ErrorType /* ERROR */ + field = error("") /* ERROR CALL */ + get + +val test2: ErrorType /* ERROR */ + field = error("") /* ERROR CALL */ + get + +val test3: ErrorType /* ERROR */ + field = error("") /* ERROR CALL */ + get + +val test4: ErrorType /* ERROR */ + field = error("") /* ERROR EXPRESSION */ + get + diff --git a/compiler/testData/ir/irText/expressions/argumentMappedWithError.kt.txt b/compiler/testData/ir/irText/expressions/argumentMappedWithError.kt.txt new file mode 100644 index 00000000000..1f6e1b67494 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/argumentMappedWithError.kt.txt @@ -0,0 +1,12 @@ +fun Number.convert(): R { + TODO() +} + +fun foo(arg: Number) { +} + +fun main(args: Array) { + val x: Int = 0 + foo(arg = convert($receiver = x)) +} + diff --git a/compiler/testData/ir/irText/expressions/arrayAccess.kt.txt b/compiler/testData/ir/irText/expressions/arrayAccess.kt.txt new file mode 100644 index 00000000000..31fe99fc065 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/arrayAccess.kt.txt @@ -0,0 +1,12 @@ +val p: Int + field = 0 + get + +fun foo(): Int { + return 1 +} + +fun test(a: IntArray): Int { + return a.get(index = 0).plus(other = a.get(index = ())).plus(other = a.get(index = foo())) +} + diff --git a/compiler/testData/ir/irText/expressions/arrayAssignment.kt.txt b/compiler/testData/ir/irText/expressions/arrayAssignment.kt.txt new file mode 100644 index 00000000000..1908e6e16f3 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/arrayAssignment.kt.txt @@ -0,0 +1,13 @@ +fun test() { + val x: IntArray = intArrayOf(elements = [1, 2, 3]) + x.set(index = 1, value = 0) +} + +fun foo(): Int { + return 1 +} + +fun test2() { + intArrayOf(elements = [1, 2, 3]).set(index = foo(), value = 1) +} + diff --git a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.kt.txt b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.kt.txt new file mode 100644 index 00000000000..9d2b50ff744 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.kt.txt @@ -0,0 +1,51 @@ +fun foo(): IntArray { + return intArrayOf(elements = [1, 2, 3]) +} + +fun bar(): Int { + return 42 +} + +class C { + constructor(x: IntArray) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: IntArray + field = x + get + + + + +} + +fun testVariable() { + var x: IntArray = foo() + { //BLOCK + val tmp0_array: IntArray = x + val tmp1_index0: Int = 0 + tmp0_array.set(index = tmp1_index0, value = tmp0_array.get(index = tmp1_index0).plus(other = 1)) + } +} + +fun testCall() { + { //BLOCK + val tmp0_array: IntArray = foo() + val tmp1_index0: Int = bar() + tmp0_array.set(index = tmp1_index0, value = tmp0_array.get(index = tmp1_index0).times(other = 2)) + } +} + +fun testMember(c: C) { + { //BLOCK + val tmp0_array: IntArray = c.() + val tmp1_index0: Int = 0 + val tmp2: Int = tmp0_array.get(index = tmp1_index0) + tmp0_array.set(index = tmp1_index0, value = tmp2.inc()) + tmp2 + } /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.kt.txt b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.kt.txt new file mode 100644 index 00000000000..79450c07ee4 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.kt.txt @@ -0,0 +1,22 @@ +interface IA { + abstract operator fun get(index: String): Int + + + +} + +interface IB { + abstract operator fun IA.set(index: String, value: Int) + + + +} + +fun IB.test(a: IA) { + { //BLOCK + val tmp0_array: IA = a + val tmp1_index0: String = "" + .set($receiver = tmp0_array, index = tmp1_index0, value = tmp0_array.get(index = tmp1_index0).plus(other = 42)) + } +} + diff --git a/compiler/testData/ir/irText/expressions/assignments.kt.txt b/compiler/testData/ir/irText/expressions/assignments.kt.txt new file mode 100644 index 00000000000..dee27ccad05 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/assignments.kt.txt @@ -0,0 +1,27 @@ +class Ref { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var x: Int + field = x + get + set + + + + +} + +fun test1() { + var x: Int = 0 + x = 1 + x = x.plus(other = 1) +} + +fun test2(r: Ref) { + r.( = 0) +} + diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignment1.kt.txt b/compiler/testData/ir/irText/expressions/augmentedAssignment1.kt.txt new file mode 100644 index 00000000000..b7083314874 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/augmentedAssignment1.kt.txt @@ -0,0 +1,32 @@ +var p: Int + field = 0 + get + set + +fun testVariable() { + var x: Int = 0 + x = x.plus(other = 1) + x = x.minus(other = 2) + x = x.times(other = 3) + x = x.div(other = 4) + x = x.rem(other = 5) +} + +fun testProperty() { + { //BLOCK + ( = ().plus(other = 1)) + } + { //BLOCK + ( = ().minus(other = 2)) + } + { //BLOCK + ( = ().times(other = 3)) + } + { //BLOCK + ( = ().div(other = 4)) + } + { //BLOCK + ( = ().rem(other = 5)) + } +} + diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt b/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt new file mode 100644 index 00000000000..7a7ef1f3ec7 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt @@ -0,0 +1,58 @@ +class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +operator fun A.plusAssign(s: String) { +} + +operator fun A.minusAssign(s: String) { +} + +operator fun A.timesAssign(s: String) { +} + +operator fun A.divAssign(s: String) { +} + +operator fun A.remAssign(s: String) { +} + +val p: A + field = TODO("IrConstructorCall") + get + +fun testVariable() { + val a: A = TODO("IrConstructorCall") + plusAssign($receiver = a, s = "+=") + minusAssign($receiver = a, s = "-=") + timesAssign($receiver = a, s = "*=") + divAssign($receiver = a, s = "/=") + remAssign($receiver = a, s = "*=") +} + +fun testProperty() { + { //BLOCK + plusAssign($receiver = (), s = "+=") + } + { //BLOCK + minusAssign($receiver = (), s = "-=") + } + { //BLOCK + timesAssign($receiver = (), s = "*=") + } + { //BLOCK + divAssign($receiver = (), s = "/=") + } + { //BLOCK + remAssign($receiver = (), s = "%=") + } +} + diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.kt.txt b/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.kt.txt new file mode 100644 index 00000000000..44a19d655a0 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.kt.txt @@ -0,0 +1,35 @@ +class Host { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + operator fun plusAssign(x: Int) { + } + + fun test1() { + .plusAssign(x = 1) + } + + + + +} + +fun foo(): Host { + return TODO("IrConstructorCall") +} + +fun Host.test2() { + .plusAssign(x = 1) +} + +fun test3() { + foo().plusAssign(x = 1) +} + +fun test4(a: Function0) { + a.invoke().plusAssign(x = 1) +} + diff --git a/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt b/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt new file mode 100644 index 00000000000..ed3662cbd10 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt @@ -0,0 +1,29 @@ +fun test1() { + error("") /* ERROR EXPRESSION */ + error("") /* ERROR EXPRESSION */ +} + +fun test2() { + while (true) { //BLOCK + error("") /* ERROR EXPRESSION */ + error("") /* ERROR EXPRESSION */ + } +} + +fun test3() { + while (true) { //BLOCK + val lambda: Function0 = local fun (): Nothing { + error("") /* ERROR EXPRESSION */ + error("") /* ERROR EXPRESSION */ + } + + } +} + +fun test4() { + while (error("") /* ERROR EXPRESSION */) { //BLOCK + } + while (error("") /* ERROR EXPRESSION */) { //BLOCK + } +} + diff --git a/compiler/testData/ir/irText/expressions/bangbang.kt.txt b/compiler/testData/ir/irText/expressions/bangbang.kt.txt new file mode 100644 index 00000000000..d81e5dd97e7 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/bangbang.kt.txt @@ -0,0 +1,30 @@ +fun test1(a: Any?): Any { + return CHECK_NOT_NULL(arg0 = a) +} + +fun test2(a: Any?): Int { + return CHECK_NOT_NULL(arg0 = { //BLOCK + val tmp0_safe_receiver: Any? = a + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver.hashCode() + } + }) +} + +fun test3(a: X): X { + return CHECK_NOT_NULL(arg0 = a) +} + +fun useString(s: String) { +} + +fun test4(a: X) { + when { + a is String? -> CHECK_NOT_NULL(arg0 = a) /*~> Unit */ + } + when { + a is String? -> useString(s = CHECK_NOT_NULL(arg0 = a) /*as String */) + } +} + diff --git a/compiler/testData/ir/irText/expressions/booleanConstsInAndAndOrOr.kt.txt b/compiler/testData/ir/irText/expressions/booleanConstsInAndAndOrOr.kt.txt new file mode 100644 index 00000000000..4b1c944a331 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/booleanConstsInAndAndOrOr.kt.txt @@ -0,0 +1,14 @@ +fun test1(b: Boolean) { + when { + b -> return Unit + true -> false + } /*~> Unit */ +} + +fun test2(b: Boolean) { + when { + b -> true + true -> return Unit + } /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/booleanOperators.kt.txt b/compiler/testData/ir/irText/expressions/booleanOperators.kt.txt new file mode 100644 index 00000000000..ea168900519 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/booleanOperators.kt.txt @@ -0,0 +1,22 @@ +fun test1(a: Boolean, b: Boolean): Boolean { + return when { + a -> b + true -> false + } +} + +fun test2(a: Boolean, b: Boolean): Boolean { + return when { + a -> true + true -> b + } +} + +fun test1x(a: Boolean, b: Boolean): Boolean { + return a.and(other = b) +} + +fun test2x(a: Boolean, b: Boolean): Boolean { + return a.or(other = b) +} + diff --git a/compiler/testData/ir/irText/expressions/boundCallableReferences.kt.txt b/compiler/testData/ir/irText/expressions/boundCallableReferences.kt.txt new file mode 100644 index 00000000000..1741503e0cf --- /dev/null +++ b/compiler/testData/ir/irText/expressions/boundCallableReferences.kt.txt @@ -0,0 +1,34 @@ +class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo() { + } + + val bar: Int + field = 0 + get + + + + +} + +fun A.qux() { +} + +val test1: KFunction0 + field = ::foo + get + +val test2: KProperty0 + field = ::bar + get + +val test3: KFunction0 + field = ::qux + get + diff --git a/compiler/testData/ir/irText/expressions/boxOk.kt.txt b/compiler/testData/ir/irText/expressions/boxOk.kt.txt new file mode 100644 index 00000000000..2ac23663c71 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/boxOk.kt.txt @@ -0,0 +1,4 @@ +fun box(): String { + return "OK" +} + diff --git a/compiler/testData/ir/irText/expressions/breakContinue.kt.txt b/compiler/testData/ir/irText/expressions/breakContinue.kt.txt new file mode 100644 index 00000000000..4969dd48d79 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/breakContinue.kt.txt @@ -0,0 +1,51 @@ +fun test1() { + while (true) { //BLOCK + break + } + { //BLOCK + do// COMPOSITE { + break + // } while (true) + } + while (true) { //BLOCK + continue + } + { //BLOCK + do// COMPOSITE { + continue + // } while (true) + } +} + +fun test2() { + while (true) { //BLOCK + while (true) { //BLOCK + break + break + } + break + } + while (true) { //BLOCK + while (true) { //BLOCK + continue + continue + } + continue + } +} + +fun test3() { + while (true) { //BLOCK + while (true) { //BLOCK + break + } + break + } + while (true) { //BLOCK + while (true) { //BLOCK + continue + } + continue + } +} + diff --git a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.kt.txt b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.kt.txt new file mode 100644 index 00000000000..5db7499dcae --- /dev/null +++ b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.kt.txt @@ -0,0 +1,83 @@ +fun test1(c: Boolean?) { + while (true) { //BLOCK + while ({ //BLOCK + val tmp0_elvis_lhs: Boolean? = c + when { + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> break + true -> tmp0_elvis_lhs + } + }) + } +} + +fun test2(c: Boolean?) { + while (true) { //BLOCK + while ({ //BLOCK + val tmp0_elvis_lhs: Boolean? = c + when { + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> continue + true -> tmp0_elvis_lhs + } + }) + } +} + +fun test3(ss: List?) { + while (true) { //BLOCK + { //BLOCK + val tmp1_iterator: Iterator = { //BLOCK + val tmp0_elvis_lhs: List? = ss + when { + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> continue + true -> tmp0_elvis_lhs + } + }.iterator() + while (tmp1_iterator.hasNext()) { //BLOCK + val s: String = tmp1_iterator.next() + } + } + } +} + +fun test4(ss: List?) { + while (true) { //BLOCK + { //BLOCK + val tmp1_iterator: Iterator = { //BLOCK + val tmp0_elvis_lhs: List? = ss + when { + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> break + true -> tmp0_elvis_lhs + } + }.iterator() + while (tmp1_iterator.hasNext()) { //BLOCK + val s: String = tmp1_iterator.next() + } + } + } +} + +fun test5() { + var i: Int = 0 + while (true) { //BLOCK + { //BLOCK + i = i.inc() + i + } /*~> Unit */ + var j: Int = 0 + { //BLOCK + do// COMPOSITE { + { //BLOCK + j = j.inc() + j + } /*~> Unit */ + // } while (when { + greaterOrEqual(arg0 = j, arg1 = 3) -> false + true -> break + }) + } + when { + EQEQ(arg0 = i, arg1 = 3) -> break + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/breakContinueInWhen.kt.txt b/compiler/testData/ir/irText/expressions/breakContinueInWhen.kt.txt new file mode 100644 index 00000000000..4a82137af47 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/breakContinueInWhen.kt.txt @@ -0,0 +1,82 @@ +fun testBreakFor() { + val xs: IntArray = TODO("IrConstructorCall") + var k: Int = 0 + { //BLOCK + val tmp0_iterator: IntIterator = xs.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val x: Int = tmp0_iterator.next() + { //BLOCK + when { + greater(arg0 = k, arg1 = 2) -> break + } + } + } + } +} + +fun testBreakWhile() { + var k: Int = 0 + while (less(arg0 = k, arg1 = 10)) { //BLOCK + when { + greater(arg0 = k, arg1 = 2) -> break + } + } +} + +fun testBreakDoWhile() { + var k: Int = 0 + { //BLOCK + do// COMPOSITE { + when { + greater(arg0 = k, arg1 = 2) -> break + } + // } while (less(arg0 = k, arg1 = 10)) + } +} + +fun testContinueFor() { + val xs: IntArray = TODO("IrConstructorCall") + var k: Int = 0 + { //BLOCK + val tmp0_iterator: IntIterator = xs.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val x: Int = tmp0_iterator.next() + { //BLOCK + when { + greater(arg0 = k, arg1 = 2) -> continue + } + } + } + } +} + +fun testContinueWhile() { + var k: Int = 0 + while (less(arg0 = k, arg1 = 10)) { //BLOCK + when { + greater(arg0 = k, arg1 = 2) -> continue + } + } +} + +fun testContinueDoWhile() { + var k: Int = 0 + var s: String = "" + { //BLOCK + do// COMPOSITE { + { //BLOCK + k = k.inc() + k + } /*~> Unit */ + when { + greater(arg0 = k, arg1 = 2) -> continue + } + s = s.plus(other = k + +";") + // } while (less(arg0 = k, arg1 = 10)) + } + when { + EQEQ(arg0 = s, arg1 = "1;2;").not() -> throw TODO("IrConstructorCall") + } +} + diff --git a/compiler/testData/ir/irText/expressions/callWithReorderedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callWithReorderedArguments.kt.txt new file mode 100644 index 00000000000..4919fc6ef7b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callWithReorderedArguments.kt.txt @@ -0,0 +1,32 @@ +fun foo(a: Int, b: Int) { +} + +fun noReorder1(): Int { + return 1 +} + +fun noReorder2(): Int { + return 2 +} + +fun reordered1(): Int { + return 1 +} + +fun reordered2(): Int { + return 2 +} + +fun test() { + foo(a = noReorder1(), b = noReorder2()) + { //BLOCK + val tmp0_b: Int = reordered1() + val tmp1_a: Int = reordered2() + foo(a = tmp1_a, b = tmp0_b) + } + { //BLOCK + val tmp2_a: Int = reordered2() + foo(a = tmp2_a, b = 1) + } +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt new file mode 100644 index 00000000000..b27a9d1f0c7 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt @@ -0,0 +1,45 @@ +fun use(f: @ExtensionFunctionType Function2) { +} + +class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +fun C.extensionVararg(i: Int, vararg s: String) { +} + +fun C.extensionDefault(i: Int, s: String = "") { +} + +fun C.extensionBoth(i: Int, s: String = "", vararg t: String) { +} + +fun testExtensionVararg() { + use(f = local fun extensionVararg(p0: C, p1: Int) { + extensionVararg($receiver = p0, i = p1) + } +) +} + +fun testExtensionDefault() { + use(f = local fun extensionDefault(p0: C, p1: Int) { + extensionDefault($receiver = p0, i = p1) + } +) +} + +fun testExtensionBoth() { + use(f = local fun extensionBoth(p0: C, p1: Int) { + extensionBoth($receiver = p0, i = p1) + } +) +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/adaptedWithCoercionToUnit.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/adaptedWithCoercionToUnit.kt.txt new file mode 100644 index 00000000000..e8737a2c15d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/adaptedWithCoercionToUnit.kt.txt @@ -0,0 +1,46 @@ +fun useUnit0(fn: Function0) { +} + +fun useUnit1(fn: Function1) { +} + +fun fn0(): Int { + return 1 +} + +fun fn1(x: Int): Int { + return 1 +} + +fun fnv(vararg xs: Int): Int { + return 1 +} + +fun test0() { + return useUnit0(fn = local fun fn0() { + fn0() /*~> Unit */ + } +) +} + +fun test1() { + return useUnit1(fn = local fun fn1(p0: Int) { + fn1(x = p0) /*~> Unit */ + } +) +} + +fun testV0() { + return useUnit0(fn = local fun fnv() { + fnv() /*~> Unit */ + } +) +} + +fun testV1() { + return useUnit1(fn = local fun fnv(p0: Int) { + fnv(xs = [p0]) /*~> Unit */ + } +) +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.kt.txt new file mode 100644 index 00000000000..e1e655aeec1 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.kt.txt @@ -0,0 +1,20 @@ +package test + +inline fun foo(x: Function0) { +} + +fun String.id(s: String = , vararg xs: Int): String { + return s +} + +fun test() { + foo(x = { //BLOCK + local fun String.id() { + id($receiver = receiver, ) /*~> Unit */ + } + + + ::id + }) +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt new file mode 100644 index 00000000000..d3e0c0d349b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt @@ -0,0 +1,44 @@ +package test + +class Foo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + inner class Inner

{ + constructor(a: T, b: P) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val a: T + field = a + get + + val b: P + field = b + get + + + + + } + + + + +} + +inline fun foo(a: A, b: B, x: Function2>): Inner { + return x.invoke(p1 = a, p2 = b) +} + +fun box(): String { + val z: Foo = TODO("IrConstructorCall") + val foo: Inner = foo(a = "O", b = "K", x = ::) + return foo.().plus(other = foo.()) +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt new file mode 100644 index 00000000000..05d9093bfdb --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt @@ -0,0 +1,117 @@ +fun interface IFoo { + abstract fun foo(i: Int) + + + +} + +fun interface IFoo2 : IFoo { + + + + +} + +object A { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +object B { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +operator fun A.get(i: IFoo): Int { + return 1 +} + +operator fun A.set(i: IFoo, newValue: Int) { +} + +operator fun B.get(i: IFoo): Int { + return 1 +} + +operator fun B.set(i: IFoo2, newValue: Int) { +} + +fun withVararg(vararg xs: Int): Int { + return 42 +} + +fun test1() { + { //BLOCK + val tmp0_array: A = A + val tmp2_sam: IFoo = local fun withVararg(p0: Int) { + withVararg(xs = [p0]) /*~> Unit */ + } + /*-> IFoo */ + set($receiver = tmp0_array, i = tmp2_sam, newValue = get($receiver = tmp0_array, i = tmp2_sam).plus(other = 1)) + } +} + +fun test2() { + { //BLOCK + val tmp0_array: B = B + val tmp2_sam: IFoo2 = local fun withVararg(p0: Int) { + withVararg(xs = [p0]) /*~> Unit */ + } + /*-> IFoo2 */ + set($receiver = tmp0_array, i = tmp2_sam, newValue = get($receiver = tmp0_array, i = tmp2_sam).plus(other = 1)) + } +} + +fun test3(fn: Function1) { + { //BLOCK + val tmp0_array: A = A + val tmp2_sam: IFoo = fn /*-> IFoo */ + set($receiver = tmp0_array, i = tmp2_sam, newValue = get($receiver = tmp0_array, i = tmp2_sam).plus(other = 1)) + } +} + +fun test4(fn: Function1) { + when { + fn is IFoo -> { //BLOCK + { //BLOCK + val tmp0_array: A = A + val tmp1_index0: Function1 = fn + set($receiver = tmp0_array, i = tmp1_index0 /*as IFoo */, newValue = get($receiver = tmp0_array, i = tmp1_index0 /*as IFoo */).plus(other = 1)) + } + } + } +} + +fun test5(a: Any) { + a as Function1 /*~> Unit */ + { //BLOCK + val tmp0_array: A = A + val tmp2_sam: IFoo = a /*as Function1<@ParameterName(...) Int, Unit> */ /*-> IFoo */ + set($receiver = tmp0_array, i = tmp2_sam, newValue = get($receiver = tmp0_array, i = tmp2_sam).plus(other = 1)) + } +} + +fun test6(a: Any) { + a as Function1 /*~> Unit */ + a as IFoo /*~> Unit */ + { //BLOCK + val tmp0_array: A = A + val tmp1_index0: Any = a + set($receiver = tmp0_array, i = tmp1_index0 /*as IFoo */, newValue = get($receiver = tmp0_array, i = tmp1_index0 /*as IFoo */).plus(other = 1)) + } +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt new file mode 100644 index 00000000000..dd0c80c1529 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt @@ -0,0 +1,70 @@ +fun use(fn: Function1): Any { + return fn.invoke(p1 = 42) +} + +class C { + constructor(vararg xs: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class Outer { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + inner class Inner { + constructor(vararg xs: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + +fun testConstructor(): Any { + return use(fn = local fun (p0: Int): C { + return TODO("IrConstructorCall") + } +) +} + +fun testInnerClassConstructor(outer: Outer): Any { + return use(fn = { //BLOCK + local fun Outer.(p0: Int): Inner { + return TODO("IrConstructorCall") + } + + + :: + }) +} + +fun testInnerClassConstructorCapturingOuter(): Any { + return use(fn = { //BLOCK + val tmp0_receiver: Outer = TODO("IrConstructorCall") + local fun Outer.(p0: Int): Inner { + return TODO("IrConstructorCall") + } + + + :: + }) +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt.txt new file mode 100644 index 00000000000..3ce6d92060e --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt.txt @@ -0,0 +1,47 @@ +fun defaultsOnly(x: String = ""): Int { + return 1 +} + +fun regularAndDefaults(x1: String, x2: String = ""): Int { + return 1 +} + +fun varargs(vararg xs: String): Int { + return 1 +} + +class C { + constructor(x: String = "") /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: String + field = x + get + + + + +} + +fun useKCallableStar(fn: KCallable<*>) { +} + +fun testDefaultsOnlyStar() { + useKCallableStar(fn = ::defaultsOnly) +} + +fun testRegularAndDefaultsStar() { + useKCallableStar(fn = ::regularAndDefaults) +} + +fun testVarargsStar() { + useKCallableStar(fn = ::varargs) +} + +fun testCtorStar() { + useKCallableStar(fn = ::) +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt.txt new file mode 100644 index 00000000000..4ed9992e164 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt.txt @@ -0,0 +1,27 @@ +class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo() { + } + + val bar: Int + field = 42 + get + + + + +} + +val test1: KFunction1, Unit> + field = ::foo + get + +val test2: KProperty1, Int> + field = ::bar + get + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/importedFromObject.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/importedFromObject.kt.txt new file mode 100644 index 00000000000..239e7d250a0 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/importedFromObject.kt.txt @@ -0,0 +1,38 @@ +package test + +object Foo { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val a: String + field = "" + get + + fun foo(): String { + return "" + } + + + + +} + +val test1: KProperty0 + field = ::a + get + +val test1a: KProperty0 + field = ::a + get + +val test2: KFunction0 + field = ::foo + get + +val test2a: KFunction0 + field = ::foo + get + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt new file mode 100644 index 00000000000..4acb5f7853b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt @@ -0,0 +1,38 @@ +fun foo(x: String = ""): String { + return x +} + +class C { + constructor(x: String = "") /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: String + field = x + get + + + + +} + +fun use(fn: Function0): Any { + return fn.invoke() +} + +fun testFn(): Any { + return use(fn = local fun foo(): String { + return foo() + } +) +} + +fun testCtor(): Any { + return use(fn = local fun (): C { + return TODO("IrConstructorCall") + } +) +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt new file mode 100644 index 00000000000..89ba234d95b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt @@ -0,0 +1,105 @@ +fun useSuspend(fn: SuspendFunction0) { +} + +fun useSuspendInt(fn: SuspendFunction1) { +} + +suspend fun foo0() { +} + +fun foo1() { +} + +fun fooInt(x: Int) { +} + +fun foo2(vararg xs: Int) { +} + +fun foo3(): Int { + return 42 +} + +fun foo4(i: Int = 42) { +} + +class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun bar() { + } + + + + +} + +fun testLambda() { + useSuspend(fn = local suspend fun () { + foo1() + } +) +} + +fun testNoCoversion() { + useSuspend(fn = ::foo0) +} + +fun testSuspendPlain() { + useSuspend(fn = local suspend fun foo1() { + foo1() + } +) +} + +fun testSuspendWithArgs() { + useSuspendInt(fn = local suspend fun fooInt(p0: Int) { + fooInt(x = p0) + } +) +} + +fun testWithVararg() { + useSuspend(fn = local suspend fun foo2() { + foo2() + } +) +} + +fun testWithVarargMapped() { + useSuspendInt(fn = local suspend fun foo2(p0: Int) { + foo2(xs = [p0]) + } +) +} + +fun testWithCoercionToUnit() { + useSuspend(fn = local suspend fun foo3() { + foo3() /*~> Unit */ + } +) +} + +fun testWithDefaults() { + useSuspend(fn = local suspend fun foo4() { + foo4() + } +) +} + +fun testWithBoundReceiver() { + useSuspend(fn = { //BLOCK + val tmp0_receiver: C = TODO("IrConstructorCall") + local suspend fun C.bar() { + receiver.bar() + } + + + ::bar + }) +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/typeArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/typeArguments.kt.txt new file mode 100644 index 00000000000..9dd004801f2 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/typeArguments.kt.txt @@ -0,0 +1,33 @@ +object Host { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + inline fun objectMember(x: T) { + } + + + + +} + +inline fun topLevel1(x: T) { +} + +inline fun topLevel2(x: List) { +} + +val test1: Function1 + field = ::topLevel1 + get + +val test2: Function1, Unit> + field = ::topLevel2 + get + +val test3: Function1 + field = ::objectMember + get + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt new file mode 100644 index 00000000000..7cfb59d2b7c --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt @@ -0,0 +1,67 @@ +fun use1(fn: Function2) { +} + +fun use2(fn: Function1) { +} + +open class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + open fun foo(vararg xs: Int): Int { + return 1 + } + + + + +} + +object Obj : A { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo(vararg xs: Int): Int { + return 1 + } + + + + +} + +fun testUnbound() { + use1(fn = local fun foo(p0: A, p1: Int) { + p0.foo(xs = [p1]) /*~> Unit */ + } +) +} + +fun testBound(a: A) { + use2(fn = { //BLOCK + local fun A.foo(p0: Int) { + receiver.foo(xs = [p0]) /*~> Unit */ + } + + + ::foo + }) +} + +fun testObject() { + use2(fn = { //BLOCK + local fun Obj.foo(p0: Int) { + receiver.foo(xs = [p0]) /*~> Unit */ + } + + + ::foo + }) +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withAdaptationForSam.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptationForSam.kt.txt new file mode 100644 index 00000000000..aca3d60d7cd --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptationForSam.kt.txt @@ -0,0 +1,21 @@ +fun interface IFoo { + abstract fun foo(i: Int) + + + +} + +fun useFoo(foo: IFoo) { +} + +fun withVararg(vararg xs: Int): Int { + return 42 +} + +fun test() { + useFoo(foo = local fun withVararg(p0: Int) { + withVararg(xs = [p0]) /*~> Unit */ + } + /*-> IFoo */) +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt new file mode 100644 index 00000000000..6638a71bbd2 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt @@ -0,0 +1,85 @@ +fun use(fn: Function1): String { + return fn.invoke(p1 = 1) +} + +fun use0(fn: Function0): String { + return fn.invoke() +} + +fun coerceToUnit(fn: Function1) { +} + +fun fnWithDefault(a: Int, b: Int = 42): String { + return "abc" +} + +fun fnWithDefaults(a: Int = 1, b: Int = 2): String { + return "" +} + +fun fnWithVarargs(vararg xs: Int): String { + return "abc" +} + +object Host { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun importedObjectMemberWithVarargs(vararg xs: Int): String { + return "abc" + } + + + + +} + +fun testDefault(): String { + return use(fn = local fun fnWithDefault(p0: Int): String { + return fnWithDefault(a = p0) + } +) +} + +fun testVararg(): String { + return use(fn = local fun fnWithVarargs(p0: Int): String { + return fnWithVarargs(xs = [p0]) + } +) +} + +fun testCoercionToUnit() { + return coerceToUnit(fn = local fun fnWithDefault(p0: Int) { + fnWithDefault(a = p0) /*~> Unit */ + } +) +} + +fun testImportedObjectMember(): String { + return use(fn = { //BLOCK + local fun importedObjectMemberWithVarargs(p0: Int): String { + return importedObjectMemberWithVarargs(xs = [p0]) + } + + + ::importedObjectMemberWithVarargs + }) +} + +fun testDefault0(): String { + return use0(fn = local fun fnWithDefaults(): String { + return fnWithDefaults() + } +) +} + +fun testVararg0(): String { + return use0(fn = local fun fnWithVarargs(): String { + return fnWithVarargs() + } +) +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt new file mode 100644 index 00000000000..a1c811febbe --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt @@ -0,0 +1,79 @@ +fun use(fn: Function1) { + fn.invoke(p1 = 1) +} + +class Host { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun withVararg(vararg xs: Int): String { + return "" + } + + fun testImplicitThis() { + use(fn = { //BLOCK + local fun Host.withVararg(p0: Int) { + receiver.withVararg(xs = [p0]) /*~> Unit */ + } + + + ::withVararg + }) + } + + fun testBoundReceiverLocalVal() { + val h: Host = TODO("IrConstructorCall") + use(fn = { //BLOCK + local fun Host.withVararg(p0: Int) { + receiver.withVararg(xs = [p0]) /*~> Unit */ + } + + + ::withVararg + }) + } + + fun testBoundReceiverLocalVar() { + var h: Host = TODO("IrConstructorCall") + use(fn = { //BLOCK + val tmp0_receiver: Host = h + local fun Host.withVararg(p0: Int) { + receiver.withVararg(xs = [p0]) /*~> Unit */ + } + + + ::withVararg + }) + } + + fun testBoundReceiverParameter(h: Host) { + use(fn = { //BLOCK + local fun Host.withVararg(p0: Int) { + receiver.withVararg(xs = [p0]) /*~> Unit */ + } + + + ::withVararg + }) + } + + fun testBoundReceiverExpression() { + use(fn = { //BLOCK + val tmp0_receiver: Host = TODO("IrConstructorCall") + local fun Host.withVararg(p0: Int) { + receiver.withVararg(xs = [p0]) /*~> Unit */ + } + + + ::withVararg + }) + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.kt.txt new file mode 100644 index 00000000000..7933bb1475f --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.kt.txt @@ -0,0 +1,53 @@ +fun sum(vararg args: Int): Int { + var result: Int = 0 + { //BLOCK + val tmp0_iterator: IntIterator = args.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val arg: Int = tmp0_iterator.next() + result = result.plus(other = arg) + } + } + return result +} + +fun nsum(vararg args: Number): Int { + return sum(args = [*TODO("IrConstructorCall")]) +} + +fun zap(vararg b: String, k: Int = 42) { +} + +fun usePlainArgs(fn: Function2) { +} + +fun usePrimitiveArray(fn: Function1) { +} + +fun useArray(fn: Function1, Int>) { +} + +fun useStringArray(fn: Function1, Unit>) { +} + +fun testPlainArgs() { + usePlainArgs(fn = local fun sum(p0: Int, p1: Int): Int { + return sum(args = [p0, p1]) + } +) +} + +fun testPrimitiveArrayAsVararg() { + usePrimitiveArray(fn = ::sum) +} + +fun testArrayAsVararg() { + useArray(fn = ::nsum) +} + +fun testArrayAndDefaults() { + useStringArray(fn = local fun zap(p0: Array) { + zap(b = [*p0]) + } +) +} + diff --git a/compiler/testData/ir/irText/expressions/calls.kt.txt b/compiler/testData/ir/irText/expressions/calls.kt.txt new file mode 100644 index 00000000000..660fedd9984 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/calls.kt.txt @@ -0,0 +1,24 @@ +fun foo(x: Int, y: Int): Int { + return x +} + +fun bar(x: Int): Int { + return foo(x = x, y = 1) +} + +fun qux(x: Int): Int { + return foo(x = foo(x = x, y = x), y = x) +} + +fun Int.ext1(): Int { + return +} + +fun Int.ext2(x: Int): Int { + return foo(x = , y = x) +} + +fun Int.ext3(x: Int): Int { + return foo(x = ext1($receiver = ), y = x) +} + diff --git a/compiler/testData/ir/irText/expressions/castToTypeParameter.kt.txt b/compiler/testData/ir/irText/expressions/castToTypeParameter.kt.txt new file mode 100644 index 00000000000..8d5ceedc488 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/castToTypeParameter.kt.txt @@ -0,0 +1,51 @@ +fun castFun(x: Any): T { + return x as T +} + +fun Any.castExtFun(): T { + return as T +} + +val T.castExtVal: T + get(): T { + return as T + } + +class Host { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun castMemberFun(x: Any): T { + return x as T + } + + fun castGenericMemberFun(x: Any): TF { + return x as TF + } + + fun Any.castMemberExtFun(): T { + return as T + } + + fun Any.castGenericMemberExtFun(): TF { + return as TF + } + + val Any.castMemberExtVal: T + get(): T { + return as T + } + + val TV.castGenericMemberExtVal: TV + get(): TV { + return as TV + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/catchParameterAccess.kt.txt b/compiler/testData/ir/irText/expressions/catchParameterAccess.kt.txt new file mode 100644 index 00000000000..5782f8d74c3 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/catchParameterAccess.kt.txt @@ -0,0 +1,10 @@ +fun test(f: Function0) { + return try { //BLOCK + f.invoke() + } + catch (...) { //BLOCK + throw e + } + +} + diff --git a/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt b/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt new file mode 100644 index 00000000000..b90840074d2 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt @@ -0,0 +1,48 @@ +class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo(): C { + return + } + + fun bar(): C? { + return + } + + + + +} + +fun test(nc: C?): C? { + return { //BLOCK + val tmp3_safe_receiver: C? = { //BLOCK + val tmp2_safe_receiver: C? = { //BLOCK + val tmp1_safe_receiver: C? = { //BLOCK + val tmp0_safe_receiver: C? = nc + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver.foo() + } + } + when { + EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null + true -> tmp1_safe_receiver.bar() + } + } + when { + EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null + true -> tmp2_safe_receiver.foo() + } + } + when { + EQEQ(arg0 = tmp3_safe_receiver, arg1 = null) -> null + true -> tmp3_safe_receiver.foo() + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/classReference.kt.txt b/compiler/testData/ir/irText/expressions/classReference.kt.txt new file mode 100644 index 00000000000..cbbc7eb3ecb --- /dev/null +++ b/compiler/testData/ir/irText/expressions/classReference.kt.txt @@ -0,0 +1,19 @@ +class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +fun test() { + A::class /*~> Unit */ + TODO("IrConstructorCall")::class /*~> Unit */ + ($receiver = A::class) /*~> Unit */ + ($receiver = TODO("IrConstructorCall")::class) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/coercionToUnit.kt.txt b/compiler/testData/ir/irText/expressions/coercionToUnit.kt.txt new file mode 100644 index 00000000000..286dd825a11 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/coercionToUnit.kt.txt @@ -0,0 +1,28 @@ +val test1: Function0 + field = local fun () { + 42 /*~> Unit */ + } + + get + +fun test2(mc: MutableCollection) { + mc.add(element = "") /*~> Unit */ +} + +fun test3() { + { //BLOCK + val tmp0_safe_receiver: @FlexibleNullability PrintStream? = #out + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver /*!! PrintStream */.println(p0 = "Hello,") + } + } /*~> Unit */ + { //BLOCK + val tmp1_safe_receiver: @FlexibleNullability PrintStream? = #out + when { + EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null + true -> tmp1_safe_receiver /*!! PrintStream */.println(p0 = "world!") + } + } /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt new file mode 100644 index 00000000000..905bb2523ee --- /dev/null +++ b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt @@ -0,0 +1,133 @@ +object X1 { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var x1: Int + field = 0 + get + set + + object X2 { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var x2: Int + field = 0 + get + set + + object X3 { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var x3: Int + field = 0 + get + set + + + + + } + + + + + } + + + + +} + +fun test1(a: IntArray) { + var i: Int = 0 + { //BLOCK + val tmp1_array: IntArray = a + val tmp2_index0: Int = { //BLOCK + val tmp0: Int = i + i = tmp0.inc() + tmp0 + } + val tmp3: Int = tmp1_array.get(index = tmp2_index0) + tmp1_array.set(index = tmp2_index0, value = tmp3.inc()) + tmp3 + } /*~> Unit */ +} + +fun test2() { + { //BLOCK + val tmp0_this: X1 = X1 + { //BLOCK + val tmp1: Int = tmp0_this.() + tmp0_this.( = tmp1.inc()) + tmp1 + } + } /*~> Unit */ + { //BLOCK + val tmp2_this: X2 = X2 + { //BLOCK + val tmp3: Int = tmp2_this.() + tmp2_this.( = tmp3.inc()) + tmp3 + } + } /*~> Unit */ + { //BLOCK + val tmp4_this: X3 = X3 + { //BLOCK + val tmp5: Int = tmp4_this.() + tmp4_this.( = tmp5.inc()) + tmp5 + } + } /*~> Unit */ +} + +class B { + constructor(s: Int = 0) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var s: Int + field = s + get + set + + + + +} + +object Host { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + operator fun B.plusAssign(b: B) { + { //BLOCK + val tmp0_this: B = + tmp0_this.( = tmp0_this.().plus(other = b.())) + } + } + + + + +} + +fun Host.test3(v: B) { + .plusAssign($receiver = v, b = TODO("IrConstructorCall")) +} + diff --git a/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.kt.txt b/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.kt.txt new file mode 100644 index 00000000000..196d9d50448 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.kt.txt @@ -0,0 +1,32 @@ +fun testKotlin(): K2 { + return TODO("IrConstructorCall") +} + +fun testJava(): J2 { + return TODO("IrConstructorCall") +} + +class K1 { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + inner class K2 { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/contructorCall.kt.txt b/compiler/testData/ir/irText/expressions/contructorCall.kt.txt new file mode 100644 index 00000000000..cbc8e47516b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/contructorCall.kt.txt @@ -0,0 +1,16 @@ +class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +val test: A + field = TODO("IrConstructorCall") + get + diff --git a/compiler/testData/ir/irText/expressions/conventionComparisons.kt.txt b/compiler/testData/ir/irText/expressions/conventionComparisons.kt.txt new file mode 100644 index 00000000000..aa20ef1e64b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/conventionComparisons.kt.txt @@ -0,0 +1,29 @@ +interface IA { + + + +} + +interface IB { + abstract operator fun IA.compareTo(other: IA): Int + + + +} + +fun IB.test1(a1: IA, a2: IA): Boolean { + return greater(arg0 = .compareTo($receiver = a1, other = a2), arg1 = 0) +} + +fun IB.test2(a1: IA, a2: IA): Boolean { + return greaterOrEqual(arg0 = .compareTo($receiver = a1, other = a2), arg1 = 0) +} + +fun IB.test3(a1: IA, a2: IA): Boolean { + return less(arg0 = .compareTo($receiver = a1, other = a2), arg1 = 0) +} + +fun IB.test4(a1: IA, a2: IA): Boolean { + return lessOrEqual(arg0 = .compareTo($receiver = a1, other = a2), arg1 = 0) +} + diff --git a/compiler/testData/ir/irText/expressions/destructuring1.kt.txt b/compiler/testData/ir/irText/expressions/destructuring1.kt.txt new file mode 100644 index 00000000000..8e2163433d8 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/destructuring1.kt.txt @@ -0,0 +1,40 @@ +object A { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +object B { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + operator fun A.component1(): Int { + return 1 + } + + operator fun A.component2(): Int { + return 2 + } + + + + +} + +fun B.test() { + // COMPOSITE { + val tmp0_container: A = A + val x: Int = .component1($receiver = tmp0_container) + val y: Int = .component2($receiver = tmp0_container) + // } +} + diff --git a/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.kt.txt b/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.kt.txt new file mode 100644 index 00000000000..43cd12bc9e7 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.kt.txt @@ -0,0 +1,44 @@ +object A { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +object B { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + operator fun A.component1(): Int { + return 1 + } + + operator fun A.component2(): Int { + return 2 + } + + operator fun A.component3(): Int { + return 3 + } + + + + +} + +fun B.test() { + // COMPOSITE { + val tmp0_container: A = A + val x: Int = .component1($receiver = tmp0_container) + val z: Int = .component3($receiver = tmp0_container) + // } +} + diff --git a/compiler/testData/ir/irText/expressions/dotQualified.kt.txt b/compiler/testData/ir/irText/expressions/dotQualified.kt.txt new file mode 100644 index 00000000000..5302517c8b7 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/dotQualified.kt.txt @@ -0,0 +1,14 @@ +fun length(s: String): Int { + return s.() +} + +fun lengthN(s: String?): Int? { + return { //BLOCK + val tmp0_safe_receiver: String? = s + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver.() + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/elvis.kt.txt b/compiler/testData/ir/irText/expressions/elvis.kt.txt new file mode 100644 index 00000000000..ab1ac410e8a --- /dev/null +++ b/compiler/testData/ir/irText/expressions/elvis.kt.txt @@ -0,0 +1,64 @@ +val p: Any? + field = null + get + +fun foo(): Any? { + return null +} + +fun test1(a: Any?, b: Any): Any { + return { //BLOCK + val tmp0_elvis_lhs: Any? = a + when { + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> b + true -> tmp0_elvis_lhs + } + } +} + +fun test2(a: String?, b: Any): Any { + return { //BLOCK + val tmp0_elvis_lhs: String? = a + when { + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> b + true -> tmp0_elvis_lhs + } + } +} + +fun test3(a: Any?, b: Any?): String { + when { + b !is String -> return "" + } + when { + a !is String? -> return "" + } + return { //BLOCK + val tmp0_elvis_lhs: Any? = a + when { + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> b /*as String */ + true -> tmp0_elvis_lhs /*as String */ + } + } +} + +fun test4(x: Any): Any { + return { //BLOCK + val tmp0_elvis_lhs: Any? = () + when { + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> x + true -> tmp0_elvis_lhs + } + } +} + +fun test5(x: Any): Any { + return { //BLOCK + val tmp0_elvis_lhs: Any? = foo() + when { + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> x + true -> tmp0_elvis_lhs + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt b/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt new file mode 100644 index 00000000000..8882593ebcd --- /dev/null +++ b/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt @@ -0,0 +1,27 @@ +abstract enum class X : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + B init = TODO("IrEnumConstructorCall") abstract val value: Function0 + abstract get + + + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): X /* Synthetic body for ENUM_VALUEOF */ + +} + +fun box(): String { + return X.().invoke() +} + diff --git a/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt new file mode 100644 index 00000000000..61a32c983ab --- /dev/null +++ b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt @@ -0,0 +1,20 @@ +open enum class MyEnum : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + Z init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): MyEnum /* Synthetic body for ENUM_VALUEOF */ + +} + diff --git a/compiler/testData/ir/irText/expressions/equality.kt.txt b/compiler/testData/ir/irText/expressions/equality.kt.txt new file mode 100644 index 00000000000..f07911ec9f9 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/equality.kt.txt @@ -0,0 +1,12 @@ +fun test1(a: Int, b: Int): Boolean { + return EQEQ(arg0 = a, arg1 = b) +} + +fun test2(a: Int, b: Int): Boolean { + return EQEQ(arg0 = a, arg1 = b).not() +} + +fun test3(a: Any?, b: Any?): Boolean { + return EQEQ(arg0 = a, arg1 = b) +} + diff --git a/compiler/testData/ir/irText/expressions/equals.kt.txt b/compiler/testData/ir/irText/expressions/equals.kt.txt new file mode 100644 index 00000000000..ede412500df --- /dev/null +++ b/compiler/testData/ir/irText/expressions/equals.kt.txt @@ -0,0 +1,16 @@ +fun testEqeq(a: Int, b: Int): Boolean { + return EQEQ(arg0 = a, arg1 = b) +} + +fun testEquals(a: Int, b: Int): Boolean { + return a.equals(other = b) +} + +fun testJEqeqNull(): Boolean { + return EQEQ(arg0 = #INT_NULL, arg1 = null) +} + +fun testJEqualsNull(): Boolean { + return #INT_NULL /*!! Int */.equals(other = null) +} + diff --git a/compiler/testData/ir/irText/expressions/extFunInvokeAsFun.kt.txt b/compiler/testData/ir/irText/expressions/extFunInvokeAsFun.kt.txt new file mode 100644 index 00000000000..9f2f7f30034 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/extFunInvokeAsFun.kt.txt @@ -0,0 +1,8 @@ +fun with1(receiver: Any?, block: @ExtensionFunctionType Function1) { + return block.invoke(p1 = receiver) +} + +fun with2(receiver: Any?, block: @ExtensionFunctionType Function1) { + return block.invoke(p1 = receiver) +} + diff --git a/compiler/testData/ir/irText/expressions/extFunSafeInvoke.kt.txt b/compiler/testData/ir/irText/expressions/extFunSafeInvoke.kt.txt new file mode 100644 index 00000000000..c2766260f48 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/extFunSafeInvoke.kt.txt @@ -0,0 +1,10 @@ +fun test(receiver: Any?, fn: @ExtensionFunctionType Function3): Unit? { + return { //BLOCK + val tmp0_safe_receiver: Any? = receiver + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> fn.invoke(p1 = tmp0_safe_receiver, p2 = 42, p3 = "Hello") + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/extensionPropertyGetterCall.kt.txt b/compiler/testData/ir/irText/expressions/extensionPropertyGetterCall.kt.txt new file mode 100644 index 00000000000..45536fe0b0d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/extensionPropertyGetterCall.kt.txt @@ -0,0 +1,9 @@ +val String.okext: String + get(): String { + return "OK" + } + +fun String.test5(): String { + return ($receiver = ) +} + diff --git a/compiler/testData/ir/irText/expressions/field.kt.txt b/compiler/testData/ir/irText/expressions/field.kt.txt new file mode 100644 index 00000000000..ee5b89c04ff --- /dev/null +++ b/compiler/testData/ir/irText/expressions/field.kt.txt @@ -0,0 +1,14 @@ +var testSimple: Int + field = 0 + get + set(value: Int) { + #testSimple = value + } + +var testAugmented: Int + field = 0 + get + set(value: Int) { + #testAugmented = #testAugmented.plus(other = value) + } + diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/comparableWithDoubleOrFloat.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/comparableWithDoubleOrFloat.kt.txt new file mode 100644 index 00000000000..8fa59fd4c0e --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/comparableWithDoubleOrFloat.kt.txt @@ -0,0 +1,20 @@ +fun testD(x: Comparable, y: Comparable): Boolean { + return when { + when { + x is Double -> y is Double + true -> false + } -> less(arg0 = x /*as Double */, arg1 = y /*as Double */) + true -> false + } +} + +fun testF(x: Comparable, y: Comparable): Boolean { + return when { + when { + x is Float -> y is Float + true -> false + } -> less(arg0 = x /*as Float */, arg1 = y /*as Float */) + true -> false + } +} + diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/eqeqRhsConditionPossiblyAffectingLhs.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/eqeqRhsConditionPossiblyAffectingLhs.kt.txt new file mode 100644 index 00000000000..f137776502b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/eqeqRhsConditionPossiblyAffectingLhs.kt.txt @@ -0,0 +1,7 @@ +fun test(x: Any): Boolean { + return EQEQ(arg0 = x, arg1 = when { + x !is Double -> CHECK_NOT_NULL(arg0 = null) + true -> x /*as Double */ + }) +} + diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointCompareTo.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointCompareTo.kt.txt new file mode 100644 index 00000000000..7ae48f901bc --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointCompareTo.kt.txt @@ -0,0 +1,80 @@ +fun test1d(x: Double, y: Double): Int { + return x.compareTo(other = y) +} + +fun test2d(x: Double, y: Any): Boolean { + return when { + y is Double -> EQEQ(arg0 = x.compareTo(other = y /*as Double */), arg1 = 0) + true -> false + } +} + +fun test3d(x: Any, y: Any): Boolean { + return when { + when { + x is Double -> y is Double + true -> false + } -> EQEQ(arg0 = x /*as Double */.compareTo(other = y /*as Double */), arg1 = 0) + true -> false + } +} + +fun test1f(x: Float, y: Float): Int { + return x.compareTo(other = y) +} + +fun test2f(x: Float, y: Any): Boolean { + return when { + y is Float -> EQEQ(arg0 = x.compareTo(other = y /*as Float */), arg1 = 0) + true -> false + } +} + +fun test3f(x: Any, y: Any): Boolean { + return when { + when { + x is Float -> y is Float + true -> false + } -> EQEQ(arg0 = x /*as Float */.compareTo(other = y /*as Float */), arg1 = 0) + true -> false + } +} + +fun testFD(x: Any, y: Any): Boolean { + return when { + when { + x is Float -> y is Double + true -> false + } -> EQEQ(arg0 = x /*as Float */.compareTo(other = y /*as Double */), arg1 = 0) + true -> false + } +} + +fun testDF(x: Any, y: Any): Boolean { + return when { + when { + x is Double -> y is Float + true -> false + } -> EQEQ(arg0 = x /*as Double */.compareTo(other = y /*as Float */), arg1 = 0) + true -> false + } +} + +fun Float.test1fr(x: Float): Int { + return .compareTo(other = x) +} + +fun Float.test2fr(x: Any): Boolean { + return when { + x is Float -> EQEQ(arg0 = .compareTo(other = x /*as Float */), arg1 = 0) + true -> false + } +} + +fun Float.test3fr(x: Any): Boolean { + return when { + x is Double -> EQEQ(arg0 = .compareTo(other = x /*as Double */), arg1 = 0) + true -> false + } +} + diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEqeq.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEqeq.kt.txt new file mode 100644 index 00000000000..492e74a474b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEqeq.kt.txt @@ -0,0 +1,86 @@ +fun test1d(x: Double, y: Double): Boolean { + return ieee754equals(arg0 = x, arg1 = y) +} + +fun test2d(x: Double, y: Double?): Boolean { + return ieee754equals(arg0 = x, arg1 = y) +} + +fun test3d(x: Double, y: Any): Boolean { + return EQEQ(arg0 = x, arg1 = y) +} + +fun test4d(x: Double, y: Number): Boolean { + return EQEQ(arg0 = x, arg1 = y) +} + +fun test5d(x: Double, y: Any): Boolean { + return when { + y is Double -> ieee754equals(arg0 = x, arg1 = y /*as Double */) + true -> false + } +} + +fun test6d(x: Any, y: Any): Boolean { + return when { + when { + x is Double -> y is Double + true -> false + } -> ieee754equals(arg0 = x /*as Double */, arg1 = y /*as Double */) + true -> false + } +} + +fun test1f(x: Float, y: Float): Boolean { + return ieee754equals(arg0 = x, arg1 = y) +} + +fun test2f(x: Float, y: Float?): Boolean { + return ieee754equals(arg0 = x, arg1 = y) +} + +fun test3f(x: Float, y: Any): Boolean { + return EQEQ(arg0 = x, arg1 = y) +} + +fun test4f(x: Float, y: Number): Boolean { + return EQEQ(arg0 = x, arg1 = y) +} + +fun test5f(x: Float, y: Any): Boolean { + return when { + y is Float -> ieee754equals(arg0 = x, arg1 = y /*as Float */) + true -> false + } +} + +fun test6f(x: Any, y: Any): Boolean { + return when { + when { + x is Float -> y is Float + true -> false + } -> ieee754equals(arg0 = x /*as Float */, arg1 = y /*as Float */) + true -> false + } +} + +fun testFD(x: Any, y: Any): Boolean { + return when { + when { + x is Float -> y is Double + true -> false + } -> ieee754equals(arg0 = x /*as Float */.toDouble(), arg1 = y /*as Double */) + true -> false + } +} + +fun testDF(x: Any, y: Any): Boolean { + return when { + when { + x is Double -> y is Float + true -> false + } -> ieee754equals(arg0 = x /*as Double */, arg1 = y /*as Float */.toDouble()) + true -> false + } +} + diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEquals.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEquals.kt.txt new file mode 100644 index 00000000000..9564dd41ed4 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEquals.kt.txt @@ -0,0 +1,116 @@ +fun test1d(x: Double, y: Double): Boolean { + return x.equals(other = y) +} + +fun test2d(x: Double, y: Double?): Boolean { + return x.equals(other = y) +} + +fun test3d(x: Double, y: Any): Boolean { + return x.equals(other = y) +} + +fun test4d(x: Double, y: Number): Boolean { + return x.equals(other = y) +} + +fun test5d(x: Double, y: Any): Boolean { + return when { + y is Double -> x.equals(other = y) + true -> false + } +} + +fun test6d(x: Any, y: Any): Boolean { + return when { + when { + x is Double -> y is Double + true -> false + } -> x.equals(other = y) + true -> false + } +} + +fun test1f(x: Float, y: Float): Boolean { + return x.equals(other = y) +} + +fun test2f(x: Float, y: Float?): Boolean { + return x.equals(other = y) +} + +fun test3f(x: Float, y: Any): Boolean { + return x.equals(other = y) +} + +fun test4f(x: Float, y: Number): Boolean { + return x.equals(other = y) +} + +fun test5f(x: Float, y: Any): Boolean { + return when { + y is Float -> x.equals(other = y) + true -> false + } +} + +fun test6f(x: Any, y: Any): Boolean { + return when { + when { + x is Float -> y is Float + true -> false + } -> x.equals(other = y) + true -> false + } +} + +fun testFD(x: Any, y: Any): Boolean { + return when { + when { + x is Float -> y is Double + true -> false + } -> x.equals(other = y) + true -> false + } +} + +fun testDF(x: Any, y: Any): Boolean { + return when { + when { + x is Double -> y is Float + true -> false + } -> x.equals(other = y) + true -> false + } +} + +fun Float.test1fr(x: Float): Boolean { + return .equals(other = x) +} + +fun Float.test2fr(x: Float?): Boolean { + return .equals(other = x) +} + +fun Float.test3fr(x: Any): Boolean { + return .equals(other = x) +} + +fun Float.test4fr(x: Number): Boolean { + return .equals(other = x) +} + +fun Float.test5fr(x: Any): Boolean { + return when { + x is Float -> .equals(other = x) + true -> false + } +} + +fun Float.test6fr(x: Any): Boolean { + return when { + x is Double -> .equals(other = x) + true -> false + } +} + diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointExcleq.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointExcleq.kt.txt new file mode 100644 index 00000000000..6cda9b7081f --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointExcleq.kt.txt @@ -0,0 +1,86 @@ +fun test1d(x: Double, y: Double): Boolean { + return ieee754equals(arg0 = x, arg1 = y).not() +} + +fun test2d(x: Double, y: Double?): Boolean { + return ieee754equals(arg0 = x, arg1 = y).not() +} + +fun test3d(x: Double, y: Any): Boolean { + return EQEQ(arg0 = x, arg1 = y).not() +} + +fun test4d(x: Double, y: Number): Boolean { + return EQEQ(arg0 = x, arg1 = y).not() +} + +fun test5d(x: Double, y: Any): Boolean { + return when { + y is Double -> ieee754equals(arg0 = x, arg1 = y /*as Double */).not() + true -> false + } +} + +fun test6d(x: Any, y: Any): Boolean { + return when { + when { + x is Double -> y is Double + true -> false + } -> ieee754equals(arg0 = x /*as Double */, arg1 = y /*as Double */).not() + true -> false + } +} + +fun test1f(x: Float, y: Float): Boolean { + return ieee754equals(arg0 = x, arg1 = y).not() +} + +fun test2f(x: Float, y: Float?): Boolean { + return ieee754equals(arg0 = x, arg1 = y).not() +} + +fun test3f(x: Float, y: Any): Boolean { + return EQEQ(arg0 = x, arg1 = y).not() +} + +fun test4f(x: Float, y: Number): Boolean { + return EQEQ(arg0 = x, arg1 = y).not() +} + +fun test5f(x: Float, y: Any): Boolean { + return when { + y is Float -> ieee754equals(arg0 = x, arg1 = y /*as Float */).not() + true -> false + } +} + +fun test6f(x: Any, y: Any): Boolean { + return when { + when { + x is Float -> y is Float + true -> false + } -> ieee754equals(arg0 = x /*as Float */, arg1 = y /*as Float */).not() + true -> false + } +} + +fun testFD(x: Any, y: Any): Boolean { + return when { + when { + x is Float -> y is Double + true -> false + } -> ieee754equals(arg0 = x /*as Float */.toDouble(), arg1 = y /*as Double */).not() + true -> false + } +} + +fun testDF(x: Any, y: Any): Boolean { + return when { + when { + x is Double -> y is Float + true -> false + } -> ieee754equals(arg0 = x /*as Double */, arg1 = y /*as Float */.toDouble()).not() + true -> false + } +} + diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointLess.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointLess.kt.txt new file mode 100644 index 00000000000..b070fa875d4 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointLess.kt.txt @@ -0,0 +1,62 @@ +fun test1d(x: Double, y: Double): Boolean { + return less(arg0 = x, arg1 = y) +} + +fun test2d(x: Double, y: Any): Boolean { + return when { + y is Double -> less(arg0 = x, arg1 = y /*as Double */) + true -> false + } +} + +fun test3d(x: Any, y: Any): Boolean { + return when { + when { + x is Double -> y is Double + true -> false + } -> less(arg0 = x /*as Double */, arg1 = y /*as Double */) + true -> false + } +} + +fun test1f(x: Float, y: Float): Boolean { + return less(arg0 = x, arg1 = y) +} + +fun test2f(x: Float, y: Any): Boolean { + return when { + y is Float -> less(arg0 = x, arg1 = y /*as Float */) + true -> false + } +} + +fun test3f(x: Any, y: Any): Boolean { + return when { + when { + x is Float -> y is Float + true -> false + } -> less(arg0 = x /*as Float */, arg1 = y /*as Float */) + true -> false + } +} + +fun testFD(x: Any, y: Any): Boolean { + return when { + when { + x is Float -> y is Double + true -> false + } -> less(arg0 = x /*as Float */.toDouble(), arg1 = y /*as Double */) + true -> false + } +} + +fun testDF(x: Any, y: Any): Boolean { + return when { + when { + x is Double -> y is Float + true -> false + } -> less(arg0 = x /*as Double */, arg1 = y /*as Float */.toDouble()) + true -> false + } +} + diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.kt.txt new file mode 100644 index 00000000000..a12320e1b87 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.kt.txt @@ -0,0 +1,13 @@ +fun test(x: Any?, y: Double): Boolean { + return when { + x is Int -> less(arg0 = { //BLOCK + val tmp0_safe_receiver: Any? = x + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver /*as Int */.toDouble() + } + }, arg1 = y) + true -> false + } +} + diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.kt.txt new file mode 100644 index 00000000000..2a66efd6bc5 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.kt.txt @@ -0,0 +1,46 @@ +fun testDD(x: Double?, y: Double?): Boolean { + return ieee754equals(arg0 = x, arg1 = y) +} + +fun testDF(x: Double?, y: Any?): Boolean { + return when { + y is Float? -> ieee754equals(arg0 = x, arg1 = { //BLOCK + val tmp0_safe_receiver: Any? = y + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver /*as Float */.toDouble() + } + }) + true -> false + } +} + +fun testDI(x: Double?, y: Any?): Boolean { + return when { + y is Int? -> ieee754equals(arg0 = x, arg1 = { //BLOCK + val tmp0_safe_receiver: Any? = y + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver /*as Int */.toDouble() + } + }) + true -> false + } +} + +fun testDI2(x: Any?, y: Any?): Boolean { + return when { + when { + x is Int? -> y is Double + true -> false + } -> ieee754equals(arg0 = { //BLOCK + val tmp0_safe_receiver: Any? = x + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver /*as Int */.toDouble() + } + }, arg1 = y /*as Double? */) + true -> false + } +} + diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.kt.txt new file mode 100644 index 00000000000..59edd1194bb --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.kt.txt @@ -0,0 +1,68 @@ +fun test0(x: Any, y: T): Boolean { + return when { + x is Int -> EQEQ(arg0 = x, arg1 = y) + true -> false + } +} + +fun test1(x: Any, y: T): Boolean { + return when { + x is Float -> ieee754equals(arg0 = x /*as Float */, arg1 = y) + true -> false + } +} + +fun test2(x: Any, y: T): Boolean { + return when { + x is Float -> ieee754equals(arg0 = x /*as Float */.toDouble(), arg1 = y) + true -> false + } +} + +fun test3(x: Any, y: T): Boolean { + return when { + x is Int -> ieee754equals(arg0 = x /*as Int */.toFloat(), arg1 = y) + true -> false + } +} + +fun test4(x: Any, y: T): Boolean { + return when { + x is Int -> ieee754equals(arg0 = x /*as Int */.toFloat(), arg1 = y) + true -> false + } +} + +fun test5(x: Any, y: R): Boolean { + return when { + x is Int -> ieee754equals(arg0 = x /*as Int */.toFloat(), arg1 = y) + true -> false + } +} + +fun test6(x: Any, y: T): Boolean { + return when { + x is Int -> EQEQ(arg0 = x, arg1 = y) + true -> false + } +} + +class F { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun testCapturedType(x: T, y: Any): Boolean { + return when { + y is Double -> ieee754equals(arg0 = x.toDouble(), arg1 = y /*as Double */) + true -> false + } + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.kt.txt new file mode 100644 index 00000000000..b44336eeca2 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.kt.txt @@ -0,0 +1,80 @@ +fun testSimple(x: Double): Int { + return { //BLOCK + val tmp0_subject: Double = x + when { + ieee754equals(arg0 = tmp0_subject, arg1 = 0.0D) -> 0 + true -> 1 + } + } +} + +fun testSmartCastInWhenSubject(x: Any): Int { + when { + x !is Double -> return -1 + } + return { //BLOCK + val tmp0_subject: Any = x + when { + ieee754equals(arg0 = tmp0_subject /*as Double */, arg1 = 0.0D) -> 0 + true -> 1 + } + } +} + +fun testSmartCastInWhenCondition(x: Double, y: Any): Int { + when { + y !is Double -> return -1 + } + return { //BLOCK + val tmp0_subject: Double = x + when { + ieee754equals(arg0 = tmp0_subject, arg1 = y /*as Double */) -> 0 + true -> 1 + } + } +} + +fun testSmartCastInWhenConditionInBranch(x: Any): Int { + return { //BLOCK + val tmp0_subject: Any = x + when { + tmp0_subject is Double.not() -> -1 + ieee754equals(arg0 = tmp0_subject /*as Double */, arg1 = 0.0D) -> 0 + true -> 1 + } + } +} + +fun testSmartCastToDifferentTypes(x: Any, y: Any): Int { + when { + x !is Double -> return -1 + } + when { + y !is Float -> return -1 + } + return { //BLOCK + val tmp0_subject: Any = x + when { + ieee754equals(arg0 = tmp0_subject /*as Double */, arg1 = y /*as Float */.toDouble()) -> 0 + true -> 1 + } + } +} + +fun foo(x: Double): Double { + return x +} + +fun testWithPrematureExitInConditionSubexpression(x: Any): Int { + return { //BLOCK + val tmp0_subject: Any = x + when { + EQEQ(arg0 = tmp0_subject, arg1 = foo(x = when { + x !is Double -> return 42 + true -> x /*as Double */ + })) -> 0 + true -> 1 + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/for.kt.txt b/compiler/testData/ir/irText/expressions/for.kt.txt new file mode 100644 index 00000000000..a1ab4dfddbe --- /dev/null +++ b/compiler/testData/ir/irText/expressions/for.kt.txt @@ -0,0 +1,45 @@ +fun testEmpty(ss: List) { + { //BLOCK + val tmp0_iterator: Iterator = ss.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val s: String = tmp0_iterator.next() + } + } +} + +fun testIterable(ss: List) { + { //BLOCK + val tmp0_iterator: Iterator = ss.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val s: String = tmp0_iterator.next() + { //BLOCK + println(message = s) + } + } + } +} + +fun testDestructuring(pp: List>) { + { //BLOCK + val tmp0_iterator: Iterator> = pp.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val tmp1_loop_parameter: Pair = tmp0_iterator.next() + val i: Int = tmp1_loop_parameter.component1() + val s: String = tmp1_loop_parameter.component2() + { //BLOCK + println(message = i) + println(message = s) + } + } + } +} + +fun testRange() { + { //BLOCK + val tmp0_iterator: IntIterator = 1.rangeTo(other = 10).iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val i: Int = tmp0_iterator.next() + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/forWithBreakContinue.kt.txt b/compiler/testData/ir/irText/expressions/forWithBreakContinue.kt.txt new file mode 100644 index 00000000000..361ffee9399 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/forWithBreakContinue.kt.txt @@ -0,0 +1,70 @@ +fun testForBreak1(ss: List) { + { //BLOCK + val tmp0_iterator: Iterator = ss.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val s: String = tmp0_iterator.next() + { //BLOCK + break + } + } + } +} + +fun testForBreak2(ss: List) { + { //BLOCK + val tmp0_iterator: Iterator = ss.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val s1: String = tmp0_iterator.next() + { //BLOCK + { //BLOCK + val tmp1_iterator: Iterator = ss.iterator() + while (tmp1_iterator.hasNext()) { //BLOCK + val s2: String = tmp1_iterator.next() + { //BLOCK + break + break + break + } + } + } + break + } + } + } +} + +fun testForContinue1(ss: List) { + { //BLOCK + val tmp0_iterator: Iterator = ss.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val s: String = tmp0_iterator.next() + { //BLOCK + continue + } + } + } +} + +fun testForContinue2(ss: List) { + { //BLOCK + val tmp0_iterator: Iterator = ss.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val s1: String = tmp0_iterator.next() + { //BLOCK + { //BLOCK + val tmp1_iterator: Iterator = ss.iterator() + while (tmp1_iterator.hasNext()) { //BLOCK + val s2: String = tmp1_iterator.next() + { //BLOCK + continue + continue + continue + } + } + } + continue + } + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt new file mode 100644 index 00000000000..7cb41718f38 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt @@ -0,0 +1,66 @@ +object FiveTimes { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class IntCell { + constructor(value: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var value: Int + field = value + get + set + + + + +} + +interface IReceiver { + operator fun FiveTimes.iterator(): IntCell { + return TODO("IrConstructorCall") + } + + operator fun IntCell.hasNext(): Boolean { + return greater(arg0 = .(), arg1 = 0) + } + + operator fun IntCell.next(): Int { + return { //BLOCK + val tmp0_this: IntCell = + { //BLOCK + val tmp1: Int = tmp0_this.() + tmp0_this.( = tmp1.dec()) + tmp1 + } + } + } + + + + +} + +fun IReceiver.test() { + { //BLOCK + val tmp0_iterator: IntCell = .iterator($receiver = FiveTimes) + while (.hasNext($receiver = tmp0_iterator)) { //BLOCK + val i: Int = .next($receiver = tmp0_iterator) + { //BLOCK + println(message = i) + } + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/funImportedFromObject.kt.txt b/compiler/testData/ir/irText/expressions/funImportedFromObject.kt.txt new file mode 100644 index 00000000000..7208c4f9bc6 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funImportedFromObject.kt.txt @@ -0,0 +1,22 @@ +package test + +object Host { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + inline fun foo(): String { + return "OK" + } + + + + +} + +fun test(): String { + return Host.foo() +} + diff --git a/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt.txt new file mode 100644 index 00000000000..4aaa2ddab5d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt.txt @@ -0,0 +1,58 @@ +fun interface IRunnable { + abstract fun run() + + + +} + +fun foo1(r: IRunnable, vararg s: String) { +} + +fun foo2(r1: IRunnable, r2: IRunnable, vararg s: String) { +} + +fun test(fn: Function0, r: IRunnable, s: String, arr: Array) { + foo1(r = local fun () { + return Unit + } + /*-> IRunnable */, s = [s]) + foo1(r = local fun () { + return Unit + } + /*-> IRunnable */, s = [*arr]) + foo1(r = fn /*-> IRunnable */, s = [s]) + foo1(r = fn /*-> IRunnable */, s = [*arr]) + foo1(r = r, s = [s]) + foo1(r = r, s = [*arr]) + foo2(r1 = local fun () { + return Unit + } + /*-> IRunnable */, r2 = local fun () { + return Unit + } + /*-> IRunnable */, s = [s]) + foo2(r1 = local fun () { + return Unit + } + /*-> IRunnable */, r2 = local fun () { + return Unit + } + /*-> IRunnable */, s = [*arr]) + foo2(r1 = fn /*-> IRunnable */, r2 = local fun () { + return Unit + } + /*-> IRunnable */, s = [s]) + foo2(r1 = fn /*-> IRunnable */, r2 = local fun () { + return Unit + } + /*-> IRunnable */, s = [*arr]) + foo2(r1 = r, r2 = local fun () { + return Unit + } + /*-> IRunnable */, s = [s]) + foo2(r1 = r, r2 = local fun () { + return Unit + } + /*-> IRunnable */, s = [*arr]) +} + diff --git a/compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.kt.txt new file mode 100644 index 00000000000..d97ac04a4e5 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.kt.txt @@ -0,0 +1,18 @@ +fun interface Foo { + abstract fun invoke(): String + + + +} + +fun foo(f: Foo): String { + return f.invoke() +} + +fun test(): String { + return foo(f = local fun (): String { + return "OK" + } + /*-> Foo */) +} + diff --git a/compiler/testData/ir/irText/expressions/funInterface/castFromAny.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/castFromAny.kt.txt new file mode 100644 index 00000000000..316d45be194 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funInterface/castFromAny.kt.txt @@ -0,0 +1,12 @@ +fun interface KRunnable { + abstract fun invoke() + + + +} + +fun test(a: Any?) { + a as Function0 /*~> Unit */ + a /*as Function0 */ /*-> KRunnable */.invoke() +} + diff --git a/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt new file mode 100644 index 00000000000..cca51d2739b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt @@ -0,0 +1,80 @@ +fun interface Fn { + abstract fun run(s: String, i: Int, t: T): R + + + +} + +class J { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun runConversion(f1: Fn, f2: Fn): Int { + return f1.run(s = "Bar", i = 1, t = f2.run(s = "Foo", i = 42, t = 239)) + } + + + + +} + +val fsi: Fn + field = { //BLOCK + local class : Fn { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun run(s: String, i: Int, t: String): Int { + return 1 + } + + + + + } + + + TODO("IrConstructorCall") + } + get + +val fis: Fn + field = { //BLOCK + local class : Fn { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun run(s: String, i: Int, t: Int): String { + return "" + } + + + + + } + + + TODO("IrConstructorCall") + } + get + +fun test(j: J) { + j.runConversion(f1 = (), f2 = local fun (s: String, i: Int, ti: Int): String { + return "" + } + /*-> Fn */) /*~> Unit */ + j.runConversion(f1 = local fun (s: String, i: Int, ts: String): Int { + return 1 + } + /*-> Fn */, f2 = ()) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargs.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargs.kt.txt new file mode 100644 index 00000000000..236c0c99fe2 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargs.kt.txt @@ -0,0 +1,41 @@ +fun interface IFoo { + abstract fun foo(i: Int) + + + +} + +fun useVararg(vararg foos: IFoo) { +} + +fun testLambda() { + useVararg(foos = [ local fun (it: Int) { + return Unit + } + /*-> IFoo */]) +} + +fun testSeveralLambdas() { + useVararg(foos = [ local fun (it: Int) { + return Unit + } + /*-> IFoo */, local fun (it: Int) { + return Unit + } + /*-> IFoo */, local fun (it: Int) { + return Unit + } + /*-> IFoo */]) +} + +fun withVarargOfInt(vararg xs: Int): String { + return "" +} + +fun testAdaptedCR() { + useVararg(foos = [ local fun withVarargOfInt(p0: Int) { + withVarargOfInt(xs = [p0]) /*~> Unit */ + } + /*-> IFoo */]) +} + diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.kt.txt new file mode 100644 index 00000000000..2f043ee06e3 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.kt.txt @@ -0,0 +1,21 @@ +fun interface MyRunnable { + abstract fun run() + + + +} + +fun test(a: Any, r: MyRunnable) { + when { + a is MyRunnable -> { //BLOCK + foo(rs = [ local fun () { + return Unit + } + /*-> MyRunnable */, r, a /*as MyRunnable */]) + } + } +} + +fun foo(vararg rs: MyRunnable) { +} + diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.kt.txt new file mode 100644 index 00000000000..9b71c6464c9 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.kt.txt @@ -0,0 +1,39 @@ +fun interface KRunnable { + abstract fun run() + + + +} + +fun foo0() { +} + +fun foo1(vararg xs: Int): Int { + return 1 +} + +fun use(r: KRunnable) { +} + +fun testSamConstructor(): KRunnable { + return ::foo0 /*-> KRunnable */ +} + +fun testSamCosntructorOnAdapted(): KRunnable { + return local fun foo1() { + foo1() /*~> Unit */ + } + /*-> KRunnable */ +} + +fun testSamConversion() { + use(r = ::foo0 /*-> KRunnable */) +} + +fun testSamConversionOnAdapted() { + use(r = local fun foo1() { + foo1() /*~> Unit */ + } + /*-> KRunnable */) +} + diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.kt.txt new file mode 100644 index 00000000000..a08314e70c3 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.kt.txt @@ -0,0 +1,80 @@ +fun interface KRunnable { + abstract fun run() + + + +} + +fun id(x: T): T { + return x +} + +fun run1(r: KRunnable) { +} + +fun run2(r1: KRunnable, r2: KRunnable) { +} + +fun test0(a: T) where T : KRunnable, T : Function0 { + run1(r = a) +} + +fun test1(a: Function0) { + when { + a is KRunnable -> { //BLOCK + run1(r = a /*as KRunnable */) + } + } +} + +fun test2(a: KRunnable) { + a as Function0 /*~> Unit */ + run1(r = a) +} + +fun test3(a: Function0) { + when { + a is KRunnable -> { //BLOCK + run2(r1 = a /*as KRunnable */, r2 = a /*as KRunnable */) + } + } +} + +fun test4(a: Function0, b: Function0) { + when { + a is KRunnable -> { //BLOCK + run2(r1 = a /*as KRunnable */, r2 = b /*-> KRunnable */) + } + } +} + +fun test5(a: Any) { + when { + a is KRunnable -> { //BLOCK + run1(r = a /*as KRunnable */) + } + } +} + +fun test5x(a: Any) { + when { + a is KRunnable -> { //BLOCK + a as Function0 /*~> Unit */ + run1(r = a /*as KRunnable */) + } + } +} + +fun test6(a: Any) { + a as Function0 /*~> Unit */ + run1(r = a /*as Function0 */ /*-> KRunnable */) +} + +fun test8(a: Function0) { + run1(r = id>(x = a) /*-> KRunnable */) +} + +fun test9() { + run1(r = ::test9 /*-> KRunnable */) +} + diff --git a/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt b/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt new file mode 100644 index 00000000000..de733a79f3d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt @@ -0,0 +1,24 @@ +fun testSimple(): Box { + return TODO("IrConstructorCall") +} + +inline fun testArray(n: Int, crossinline block: Function0): Array { + return TODO("IrConstructorCall") +} + +class Box { + constructor(value: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: T + field = value + get + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/genericPropertyCall.kt.txt b/compiler/testData/ir/irText/expressions/genericPropertyCall.kt.txt new file mode 100644 index 00000000000..7902ef55981 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/genericPropertyCall.kt.txt @@ -0,0 +1,9 @@ +val T.id: T + get(): T { + return + } + +val test: String + field = ($receiver = "abc") + get + diff --git a/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt b/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt new file mode 100644 index 00000000000..7f609db12b1 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt @@ -0,0 +1,77 @@ +class Value { + constructor(value: T = null as T, text: String? = null) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var value: T + field = value + get + set + + var text: String? + field = text + get + set + + + + +} + +val Value.additionalText: Int /* by */ + field = TODO("IrConstructorCall") + get(): Int { + return #additionalText$delegate.getValue(t = , p = ::additionalText) + } + +val Value.additionalValue: Int /* by */ + field = TODO("IrConstructorCall") + get(): Int { + return #additionalValue$delegate.getValue(t = , p = ::additionalValue) + } + +class DVal { + constructor(kmember: Any) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val kmember: Any + field = kmember + get + + operator fun getValue(t: Any?, p: Any): Int { + return 42 + } + + + + +} + +var recivier: Any? + field = "fail" + get + set + +var value2: Any? + field = "fail2" + get + set + +var T.bar: T + get(): T { + return + } + set(value: T) { + ( = ) + ( = value) + } + +val barRef: KMutableProperty1 + field = ::bar + get + diff --git a/compiler/testData/ir/irText/expressions/identity.kt.txt b/compiler/testData/ir/irText/expressions/identity.kt.txt new file mode 100644 index 00000000000..e756c6d2c06 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/identity.kt.txt @@ -0,0 +1,12 @@ +fun test1(a: Int, b: Int): Boolean { + return EQEQEQ(arg0 = a, arg1 = b) +} + +fun test2(a: Int, b: Int): Boolean { + return EQEQEQ(arg0 = a, arg1 = b).not() +} + +fun test3(a: Any?, b: Any?): Boolean { + return EQEQEQ(arg0 = a, arg1 = b) +} + diff --git a/compiler/testData/ir/irText/expressions/ifElseIf.kt.txt b/compiler/testData/ir/irText/expressions/ifElseIf.kt.txt new file mode 100644 index 00000000000..04dca45f626 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/ifElseIf.kt.txt @@ -0,0 +1,40 @@ +fun test(i: Int): Int { + return when { + greater(arg0 = i, arg1 = 0) -> 1 + less(arg0 = i, arg1 = 0) -> -1 + true -> 0 + } +} + +fun testEmptyBranches1(flag: Boolean) { + when { + flag -> { //BLOCK + } + true -> true /*~> Unit */ + } + when { + flag -> true /*~> Unit */ + } +} + +fun testEmptyBranches2(flag: Boolean) { + when { + flag -> { //BLOCK + } + true -> true /*~> Unit */ + } + when { + flag -> true /*~> Unit */ + true -> { //BLOCK + } + } +} + +fun testEmptyBranches3(flag: Boolean) { + when { + flag -> { //BLOCK + } + true -> true /*~> Unit */ + } +} + diff --git a/compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.kt.txt b/compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.kt.txt new file mode 100644 index 00000000000..72cc93ab5f6 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.kt.txt @@ -0,0 +1,19 @@ +class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + constructor(x: Any?) { + TODO("IrDelegatingConstructorCall") + when { + x is Unit -> return x /*~> Unit */ + } + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/implicitCastOnPlatformType.kt.txt b/compiler/testData/ir/irText/expressions/implicitCastOnPlatformType.kt.txt new file mode 100644 index 00000000000..ca9ae90b00f --- /dev/null +++ b/compiler/testData/ir/irText/expressions/implicitCastOnPlatformType.kt.txt @@ -0,0 +1,4 @@ +fun test(): String { + return getProperty(p0 = "test") /*!! String */ +} + diff --git a/compiler/testData/ir/irText/expressions/implicitCastToNonNull.kt.txt b/compiler/testData/ir/irText/expressions/implicitCastToNonNull.kt.txt new file mode 100644 index 00000000000..157fc95f689 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/implicitCastToNonNull.kt.txt @@ -0,0 +1,34 @@ +fun test1(x: String?): Int { + return when { + EQEQ(arg0 = x, arg1 = null) -> 0 + true -> x.() + } +} + +fun test2(x: T): Int { + return when { + EQEQ(arg0 = x, arg1 = null) -> 0 + true -> x.() + } +} + +inline fun test3(x: Any): Int { + return when { + x !is T -> 0 + true -> x /*as CharSequence */.() + } +} + +inline fun test4(x: Any?): Int { + return when { + x !is T -> 0 + true -> x /*as CharSequence */.() + } +} + +fun test5(x: T, fn: Function1) { + when { + EQEQ(arg0 = x, arg1 = null).not() -> fn.invoke(p1 = x) + } +} + diff --git a/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.kt.txt b/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.kt.txt new file mode 100644 index 00000000000..d0bccb88e35 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.kt.txt @@ -0,0 +1,41 @@ +inline fun Any.test1(): T? { + return when { + is T -> /*as T */ + true -> null + } +} + +interface Foo { + + + +} + +val Foo.asT: T? + inline get(): T? { + return when { + is T -> /*as T */ + true -> null + } + } + +class Bar { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun test(arg: Any) { + arg as T /*~> Unit */ + .useT(t = arg /*as T */) + } + + fun useT(t: T) { + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/implicitNotNullInDestructuringAssignment.kt.txt b/compiler/testData/ir/irText/expressions/implicitNotNullInDestructuringAssignment.kt.txt new file mode 100644 index 00000000000..b10b98aae22 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/implicitNotNullInDestructuringAssignment.kt.txt @@ -0,0 +1,16 @@ +operator fun J?.component1(): Int { + return 1 +} + +private operator fun J.component2(): Int { + return 2 +} + +fun test() { + // COMPOSITE { + val tmp0_container: @FlexibleNullability J? = j() + val a: Int = component1($receiver = tmp0_container) + val b: Int = component2($receiver = tmp0_container /*!! J */) + // } +} + diff --git a/compiler/testData/ir/irText/expressions/in.kt.txt b/compiler/testData/ir/irText/expressions/in.kt.txt new file mode 100644 index 00000000000..2a0919283e2 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/in.kt.txt @@ -0,0 +1,16 @@ +fun test1(a: Any, x: Collection): Boolean { + return x.contains(element = a) +} + +fun test2(a: Any, x: Collection): Boolean { + return x.contains(element = a).not() +} + +fun test3(a: T, x: Collection): Boolean { + return x.contains(element = a) +} + +fun test4(a: T, x: Collection): Boolean { + return x.contains(element = a).not() +} + diff --git a/compiler/testData/ir/irText/expressions/incrementDecrement.kt.txt b/compiler/testData/ir/irText/expressions/incrementDecrement.kt.txt new file mode 100644 index 00000000000..37c658b7a50 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/incrementDecrement.kt.txt @@ -0,0 +1,98 @@ +var p: Int + field = 0 + get + set + +val arr: IntArray + field = intArrayOf(elements = [1, 2, 3]) + get + +fun testVarPrefix() { + var x: Int = 0 + val x1: Int = { //BLOCK + x = x.inc() + x + } + val x2: Int = { //BLOCK + x = x.dec() + x + } +} + +fun testVarPostfix() { + var x: Int = 0 + val x1: Int = { //BLOCK + val tmp0: Int = x + x = tmp0.inc() + tmp0 + } + val x2: Int = { //BLOCK + val tmp1: Int = x + x = tmp1.dec() + tmp1 + } +} + +fun testPropPrefix() { + val p1: Int = { //BLOCK + { //BLOCK + ( = ().inc()) + () + } + } + val p2: Int = { //BLOCK + { //BLOCK + ( = ().dec()) + () + } + } +} + +fun testPropPostfix() { + val p1: Int = { //BLOCK + { //BLOCK + val tmp0: Int = () + ( = tmp0.inc()) + tmp0 + } + } + val p2: Int = { //BLOCK + { //BLOCK + ( = ().dec()) + () + } + } +} + +fun testArrayPrefix() { + val a1: Int = { //BLOCK + val tmp0_array: IntArray = () + val tmp1_index0: Int = 0 + tmp0_array.set(index = tmp1_index0, value = tmp0_array.get(index = tmp1_index0).inc()) + tmp0_array.get(index = tmp1_index0) + } + val a2: Int = { //BLOCK + val tmp2_array: IntArray = () + val tmp3_index0: Int = 0 + tmp2_array.set(index = tmp3_index0, value = tmp2_array.get(index = tmp3_index0).dec()) + tmp2_array.get(index = tmp3_index0) + } +} + +fun testArrayPostfix() { + val a1: Int = { //BLOCK + val tmp0_array: IntArray = () + val tmp1_index0: Int = 0 + val tmp2: Int = tmp0_array.get(index = tmp1_index0) + tmp0_array.set(index = tmp1_index0, value = tmp2.inc()) + tmp2 + } + val a2: Int = { //BLOCK + val tmp3_array: IntArray = () + val tmp4_index0: Int = 0 + val tmp5: Int = tmp3_array.get(index = tmp4_index0) + tmp3_array.set(index = tmp4_index0, value = tmp5.dec()) + tmp5 + } +} + diff --git a/compiler/testData/ir/irText/expressions/interfaceThisRef.kt.txt b/compiler/testData/ir/irText/expressions/interfaceThisRef.kt.txt new file mode 100644 index 00000000000..1537efb3157 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/interfaceThisRef.kt.txt @@ -0,0 +1,11 @@ +interface IFoo { + abstract fun foo() + fun bar() { + .foo() + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/javaSyntheticGenericPropertyAccess.kt.txt b/compiler/testData/ir/irText/expressions/javaSyntheticGenericPropertyAccess.kt.txt new file mode 100644 index 00000000000..98c77cbdc76 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/javaSyntheticGenericPropertyAccess.kt.txt @@ -0,0 +1,17 @@ +fun test(j: J) { + j.getFoo() /*~> Unit */ + j.setFoo(x = 1) + { //BLOCK + val tmp0_receiver: J = j + { //BLOCK + val tmp1: Int = tmp0_receiver.getFoo() + tmp0_receiver.setFoo(x = tmp1.inc()) + tmp1 + } + } /*~> Unit */ + { //BLOCK + val tmp2_receiver: J = j + tmp2_receiver.setFoo(x = tmp2_receiver.getFoo().plus(other = 1)) + } +} + diff --git a/compiler/testData/ir/irText/expressions/javaSyntheticPropertyAccess.kt.txt b/compiler/testData/ir/irText/expressions/javaSyntheticPropertyAccess.kt.txt new file mode 100644 index 00000000000..5ba46d3caee --- /dev/null +++ b/compiler/testData/ir/irText/expressions/javaSyntheticPropertyAccess.kt.txt @@ -0,0 +1,17 @@ +fun test(j: J) { + j.getFoo() /*~> Unit */ + j.setFoo(x = 1) + { //BLOCK + val tmp0_receiver: J = j + { //BLOCK + val tmp1: Int = tmp0_receiver.getFoo() + tmp0_receiver.setFoo(x = tmp1.inc()) + tmp1 + } + } /*~> Unit */ + { //BLOCK + val tmp2_receiver: J = j + tmp2_receiver.setFoo(x = tmp2_receiver.getFoo().plus(other = 1)) + } +} + diff --git a/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt b/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt new file mode 100644 index 00000000000..4e9fd5ade2a --- /dev/null +++ b/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt @@ -0,0 +1,85 @@ +interface IFoo { + + + +} + +class Derived1 : JFieldOwner, IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class Derived2 : JFieldOwner, IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +open class Mid : JFieldOwner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class DerivedThroughMid1 : Mid, IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class DerivedThroughMid2 : Mid, IFoo { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +fun test(b: Boolean) { + val d1: Derived1 = TODO("IrConstructorCall") + val d2: Derived2 = TODO("IrConstructorCall") + val k: Any = when { + b -> d1 + true -> d2 + } + #f = 42 + #f /*~> Unit */ + val md1: DerivedThroughMid1 = TODO("IrConstructorCall") + val md2: DerivedThroughMid2 = TODO("IrConstructorCall") + val mk: Any = when { + b -> md1 + true -> md2 + } + #f = 44 + #f /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt.txt b/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt.txt new file mode 100644 index 00000000000..31e26fb0fdb --- /dev/null +++ b/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt.txt @@ -0,0 +1,24 @@ +class Derived : Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + init { + #value = 0 + } + + fun getValue(): Int { + return #value + } + + fun setValue(value: Int) { + #value = value + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt new file mode 100644 index 00000000000..4ccf6c4bd1f --- /dev/null +++ b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt @@ -0,0 +1,38 @@ +fun testFun() { + #out /*!! PrintStream */.println(p0 = "testFun") +} + +var testProp: Any + get(): Any { + #out /*!! PrintStream */.println(p0 = "testProp/get") + return 42 + } + set(value: Any) { + #out /*!! PrintStream */.println(p0 = "testProp/set") + } + +class TestClass { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val test: Int + field = when { + true -> { //BLOCK + #out /*!! PrintStream */.println(p0 = "TestClass/test") + 42 + } + } + get + + init { + #out /*!! PrintStream */.println(p0 = "TestClass/init") + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/kt16904.kt.txt b/compiler/testData/ir/irText/expressions/kt16904.kt.txt new file mode 100644 index 00000000000..f3b9ea81a45 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt16904.kt.txt @@ -0,0 +1,72 @@ +abstract class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: B + field = TODO("IrConstructorCall") + get + + var y: Int + field = 0 + get + set + + + + +} + +class B { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + operator fun plusAssign(x: Int) { + } + + + + +} + +class Test1 : A { + constructor() { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + { //BLOCK + val tmp0_this: Test1 = + tmp0_this.().plusAssign(x = 42) + } + { //BLOCK + val tmp1_this: Test1 = + tmp1_this.( = tmp1_this.().plus(other = 42)) + } + } + + + + +} + +class Test2 : J { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + init { + #field = 42 + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/kt16905.kt.txt b/compiler/testData/ir/irText/expressions/kt16905.kt.txt new file mode 100644 index 00000000000..99a9519206c --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt16905.kt.txt @@ -0,0 +1,53 @@ +class Outer { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + open inner class Inner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + inner class InnerDerived0 : Inner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + inner class InnerDerived1 : Inner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + +typealias OI = Inner +fun test(): Inner { + return TODO("IrConstructorCall") +} + diff --git a/compiler/testData/ir/irText/expressions/kt23030.kt.txt b/compiler/testData/ir/irText/expressions/kt23030.kt.txt new file mode 100644 index 00000000000..a82a6196c34 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt23030.kt.txt @@ -0,0 +1,58 @@ +operator fun Int.compareTo(c: Char): Int { + return 0 +} + +fun testOverloadedCompareToCall(x: Int, y: Char): Boolean { + return less(arg0 = compareTo($receiver = x, c = y), arg1 = 0) +} + +fun testOverloadedCompareToCallWithSmartCast(x: Any, y: Any): Boolean { + return when { + when { + x is Int -> y is Char + true -> false + } -> less(arg0 = compareTo($receiver = x /*as Int */, c = y /*as Char */), arg1 = 0) + true -> false + } +} + +fun testEqualsWithSmartCast(x: Any, y: Any): Boolean { + return when { + when { + x is Int -> y is Char + true -> false + } -> EQEQ(arg0 = x, arg1 = y) + true -> false + } +} + +class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + operator fun Int.compareTo(c: Char): Int { + return 0 + } + + fun testMemberExtensionCompareToCall(x: Int, y: Char): Boolean { + return less(arg0 = .compareTo($receiver = x, c = y), arg1 = 0) + } + + fun testMemberExtensionCompareToCallWithSmartCast(x: Any, y: Any): Boolean { + return when { + when { + x is Int -> y is Char + true -> false + } -> less(arg0 = .compareTo($receiver = x /*as Int */, c = y /*as Char */), arg1 = 0) + true -> false + } + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/kt24804.kt.txt b/compiler/testData/ir/irText/expressions/kt24804.kt.txt new file mode 100644 index 00000000000..55eef83097a --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt24804.kt.txt @@ -0,0 +1,27 @@ +inline fun foo(): Boolean { + return false +} + +fun run(x: Boolean, y: Boolean): String { + var z: Int = 10 + { //BLOCK + do// COMPOSITE { + z = z.plus(other = 1) + when { + greater(arg0 = z, arg1 = 100) -> return "NOT_OK" + } + when { + x -> continue + } + when { + y -> continue + } + // } while (foo()) + } + return "OK" +} + +fun box(): String { + return run(x = true, y = true) +} + diff --git a/compiler/testData/ir/irText/expressions/kt27933.kt.txt b/compiler/testData/ir/irText/expressions/kt27933.kt.txt new file mode 100644 index 00000000000..93a84bbe326 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt27933.kt.txt @@ -0,0 +1,13 @@ +fun box(): String { + var r: String = "" + when { + EQEQ(arg0 = r, arg1 = "").not() -> { //BLOCK + } + true -> r = r.plus(other = "O") + } + when { + EQEQ(arg0 = r, arg1 = "O") -> r = r.plus(other = "K") + } + return r +} + diff --git a/compiler/testData/ir/irText/expressions/kt28006.kt.txt b/compiler/testData/ir/irText/expressions/kt28006.kt.txt new file mode 100644 index 00000000000..9e923701440 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt28006.kt.txt @@ -0,0 +1,40 @@ +val test1: String + field = "🤗" + get + +val test2: String + field = "🤗🤗" + get + +const val testConst1: String + field = "🤗" + get + +const val testConst2: String + field = "🤗🤗" + get + +const val testConst3: String + field = "🤗🤗🤗" + get + +const val testConst4: String + field = "🤗🤗🤗🤗" + get + +fun test1(x: Int): String { + return "🤗" + +x +} + +fun test2(x: Int): String { + return x + +"🤗" +} + +fun test3(x: Int): String { + return x + +"🤗" + +x +} + diff --git a/compiler/testData/ir/irText/expressions/kt28456.kt.txt b/compiler/testData/ir/irText/expressions/kt28456.kt.txt new file mode 100644 index 00000000000..610133346bd --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt28456.kt.txt @@ -0,0 +1,43 @@ +class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +operator fun A.get(vararg xs: Int): Int { + return 0 +} + +operator fun A.set(i: Int, j: Int, v: Int) { +} + +fun testSimpleAssignment(a: A) { + set($receiver = a, i = 1, j = 2, v = 0) +} + +fun testPostfixIncrement(a: A): Int { + return { //BLOCK + val tmp0_array: A = a + val tmp1_index0: Int = 1 + val tmp2_index1: Int = 2 + val tmp3: Int = get($receiver = tmp0_array, xs = [tmp1_index0, tmp2_index1]) + set($receiver = tmp0_array, i = tmp1_index0, j = tmp2_index1, v = tmp3.inc()) + tmp3 + } +} + +fun testCompoundAssignment(a: A) { + { //BLOCK + val tmp0_array: A = a + val tmp1_index0: Int = 1 + val tmp2_index1: Int = 2 + set($receiver = tmp0_array, i = tmp1_index0, j = tmp2_index1, v = get($receiver = tmp0_array, xs = [tmp1_index0, tmp2_index1]).plus(other = 10)) + } +} + diff --git a/compiler/testData/ir/irText/expressions/kt28456a.kt.txt b/compiler/testData/ir/irText/expressions/kt28456a.kt.txt new file mode 100644 index 00000000000..e1d3a1342c9 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt28456a.kt.txt @@ -0,0 +1,19 @@ +class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +operator fun A.set(vararg i: Int, v: Int) { +} + +fun testSimpleAssignment(a: A) { + set($receiver = a, i = [1, 2, 3], v = 0) +} + diff --git a/compiler/testData/ir/irText/expressions/kt28456b.kt.txt b/compiler/testData/ir/irText/expressions/kt28456b.kt.txt new file mode 100644 index 00000000000..07efb170f58 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt28456b.kt.txt @@ -0,0 +1,41 @@ +class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +operator fun A.get(i: Int, a: Int = 1, b: Int = 2, c: Int = 3, d: Int = 4): Int { + return 0 +} + +operator fun A.set(i: Int, j: Int = 42, v: Int) { +} + +fun testSimpleAssignment(a: A) { + set($receiver = a, i = 1, v = 0) +} + +fun testPostfixIncrement(a: A): Int { + return { //BLOCK + val tmp0_array: A = a + val tmp1_index0: Int = 1 + val tmp2: Int = get($receiver = tmp0_array, i = tmp1_index0) + set($receiver = tmp0_array, i = tmp1_index0, v = tmp2.inc()) + tmp2 + } +} + +fun testCompoundAssignment(a: A) { + { //BLOCK + val tmp0_array: A = a + val tmp1_index0: Int = 1 + set($receiver = tmp0_array, i = tmp1_index0, v = get($receiver = tmp0_array, i = tmp1_index0).plus(other = 10)) + } +} + diff --git a/compiler/testData/ir/irText/expressions/kt30020.kt.txt b/compiler/testData/ir/irText/expressions/kt30020.kt.txt new file mode 100644 index 00000000000..4b7723bab37 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt30020.kt.txt @@ -0,0 +1,90 @@ +interface X { + abstract val xs: MutableList + abstract get + + abstract fun f(): MutableList + + + +} + +fun test(x: X, nx: X?) { + { //BLOCK + val tmp0_this: X = x + plusAssign($receiver = tmp0_this.(), element = 1) + } + plusAssign($receiver = x.f(), element = 2) + plusAssign($receiver = x.() as MutableList, element = 3) + plusAssign($receiver = x.f() as MutableList, element = 4) + plusAssign($receiver = CHECK_NOT_NULL>(arg0 = { //BLOCK + val tmp1_safe_receiver: X? = nx + when { + EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null + true -> tmp1_safe_receiver.() + } + }), element = 5) + plusAssign($receiver = CHECK_NOT_NULL>(arg0 = { //BLOCK + val tmp2_safe_receiver: X? = nx + when { + EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null + true -> tmp2_safe_receiver.f() + } + }), element = 6) +} + +fun MutableList.testExtensionReceiver() { + plusAssign($receiver = , element = 100) +} + +abstract class AML : MutableList { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun testExplicitThis() { + plusAssign($receiver = , element = 200) + } + + inner class Inner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun testOuterThis() { + plusAssign($receiver = , element = 300) + } + + + + + } + + + + + + + + + + + + + + + + + + + + + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/kt30796.kt.txt b/compiler/testData/ir/irText/expressions/kt30796.kt.txt new file mode 100644 index 00000000000..9af83d46b08 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt30796.kt.txt @@ -0,0 +1,86 @@ +fun magic(): T { + throw TODO("IrConstructorCall") +} + +fun test(value: T, value2: T) { + val x1: Any = { //BLOCK + val tmp0_elvis_lhs: T = value + when { + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> 42 + true -> tmp0_elvis_lhs + } + } + val x2: Any = { //BLOCK + val tmp2_elvis_lhs: T = value + when { + EQEQ(arg0 = tmp2_elvis_lhs, arg1 = null) -> { //BLOCK + val tmp1_elvis_lhs: T = value2 + when { + EQEQ(arg0 = tmp1_elvis_lhs, arg1 = null) -> 42 + true -> tmp1_elvis_lhs + } + } + true -> tmp2_elvis_lhs + } + } + val x3: Any = { //BLOCK + val tmp4_elvis_lhs: T = { //BLOCK + val tmp3_elvis_lhs: T = value + when { + EQEQ(arg0 = tmp3_elvis_lhs, arg1 = null) -> value2 + true -> tmp3_elvis_lhs + } + } + when { + EQEQ(arg0 = tmp4_elvis_lhs, arg1 = null) -> 42 + true -> tmp4_elvis_lhs + } + } + val x4: Any = { //BLOCK + val tmp6_elvis_lhs: T = { //BLOCK + val tmp5_elvis_lhs: T = value + when { + EQEQ(arg0 = tmp5_elvis_lhs, arg1 = null) -> value2 + true -> tmp5_elvis_lhs + } + } + when { + EQEQ(arg0 = tmp6_elvis_lhs, arg1 = null) -> 42 + true -> tmp6_elvis_lhs + } + } + val x5: Any = { //BLOCK + val tmp7_elvis_lhs: Any? = magic() + when { + EQEQ(arg0 = tmp7_elvis_lhs, arg1 = null) -> 42 + true -> tmp7_elvis_lhs + } + } + val x6: Any = { //BLOCK + val tmp9_elvis_lhs: Any? = { //BLOCK + val tmp8_elvis_lhs: T = value + when { + EQEQ(arg0 = tmp8_elvis_lhs, arg1 = null) -> magic() + true -> tmp8_elvis_lhs + } + } + when { + EQEQ(arg0 = tmp9_elvis_lhs, arg1 = null) -> 42 + true -> tmp9_elvis_lhs + } + } + val x7: Any = { //BLOCK + val tmp11_elvis_lhs: Any? = { //BLOCK + val tmp10_elvis_lhs: Any? = magic() + when { + EQEQ(arg0 = tmp10_elvis_lhs, arg1 = null) -> value + true -> tmp10_elvis_lhs + } + } + when { + EQEQ(arg0 = tmp11_elvis_lhs, arg1 = null) -> 42 + true -> tmp11_elvis_lhs + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/kt35730.kt.txt b/compiler/testData/ir/irText/expressions/kt35730.kt.txt new file mode 100644 index 00000000000..612643b1a73 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt35730.kt.txt @@ -0,0 +1,27 @@ +interface Base { + fun foo() { + } + + + + +} + +object Derived : Base { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + +} + +fun test() { + Derived.foo() + Derived.foo() +} + diff --git a/compiler/testData/ir/irText/expressions/kt36956.kt.txt b/compiler/testData/ir/irText/expressions/kt36956.kt.txt new file mode 100644 index 00000000000..83ffb5581e1 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt36956.kt.txt @@ -0,0 +1,37 @@ +class A { + constructor(value: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private val value: T + field = value + private get + + operator fun get(i: Int): T { + return .() + } + + operator fun set(i: Int, v: T) { + } + + + + +} + +val aFloat: A + field = TODO("IrConstructorCall") + get + +val aInt: Float + field = { //BLOCK + val tmp0_array: A = () + val tmp1_index0: Int = 1 + val tmp2: Float = tmp0_array.get(i = tmp1_index0) + tmp0_array.set(i = tmp1_index0, v = tmp2.dec()) + tmp2 + } + get + diff --git a/compiler/testData/ir/irText/expressions/kt36963.kt.txt b/compiler/testData/ir/irText/expressions/kt36963.kt.txt new file mode 100644 index 00000000000..3e01d5be37d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt36963.kt.txt @@ -0,0 +1,7 @@ +fun foo() { +} + +fun test(): ErrorType /* ERROR */ { + return CHECK_NOT_NULL>(arg0 = ::foo) +} + diff --git a/compiler/testData/ir/irText/expressions/kt37570.kt.txt b/compiler/testData/ir/irText/expressions/kt37570.kt.txt new file mode 100644 index 00000000000..1fa6d962f43 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt37570.kt.txt @@ -0,0 +1,26 @@ +fun a(): String { + return "string" +} + +class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val b: String + get + + init { + apply($receiver = a(), block = local fun String.() { + #b = + } +) /*~> Unit */ + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/kt37779.kt.txt b/compiler/testData/ir/irText/expressions/kt37779.kt.txt new file mode 100644 index 00000000000..d19ebdb93db --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt37779.kt.txt @@ -0,0 +1,11 @@ +fun foo(vararg s: String) { +} + +fun test1() { + foo(s = [*arrayOf(elements = ["", "OK"])]) +} + +fun test2(ss: Array) { + foo(s = [*ss]) +} + diff --git a/compiler/testData/ir/irText/expressions/lambdaInCAO.kt.txt b/compiler/testData/ir/irText/expressions/lambdaInCAO.kt.txt new file mode 100644 index 00000000000..b86ae164b7f --- /dev/null +++ b/compiler/testData/ir/irText/expressions/lambdaInCAO.kt.txt @@ -0,0 +1,41 @@ +operator fun Any.plusAssign(lambda: Function0) { +} + +operator fun Any.get(index: Function0): Int { + return 42 +} + +operator fun Any.set(index: Function0, value: Int) { +} + +fun test1(a: Any) { + plusAssign($receiver = a, lambda = local fun () { + return Unit + } +) +} + +fun test2(a: Any) { + { //BLOCK + val tmp0_array: Any = a + val tmp1_index0: Function0 = local fun () { + return Unit + } + + set($receiver = tmp0_array, index = tmp1_index0, value = get($receiver = tmp0_array, index = tmp1_index0).plus(other = 42)) + } +} + +fun test3(a: Any) { + { //BLOCK + val tmp0_array: Any = a + val tmp1_index0: Function0 = local fun () { + return Unit + } + + val tmp2: Int = get($receiver = tmp0_array, index = tmp1_index0) + set($receiver = tmp0_array, index = tmp1_index0, value = tmp2.inc()) + tmp2 + } /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/literals.kt.txt b/compiler/testData/ir/irText/expressions/literals.kt.txt new file mode 100644 index 00000000000..45e61a98908 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/literals.kt.txt @@ -0,0 +1,68 @@ +val test1: Int + field = 1 + get + +val test2: Int + field = -1 + get + +val test3: Boolean + field = true + get + +val test4: Boolean + field = false + get + +val test5: String + field = "abc" + get + +val test6: Nothing? + field = null + get + +val test7: Long + field = 1L + get + +val test8: Long + field = -1L + get + +val test9: Double + field = 1.0D + get + +val test10: Double + field = -1.0D + get + +val test11: Float + field = 1.0F + get + +val test12: Float + field = -1.0F + get + +val test13: Char + field = 'a' + get + +val testB: Byte + field = 1B + get + +val testS: Short + field = 1S + get + +val testI: Int + field = 1 + get + +val testL: Long + field = 1L + get + diff --git a/compiler/testData/ir/irText/expressions/memberTypeArguments.kt.txt b/compiler/testData/ir/irText/expressions/memberTypeArguments.kt.txt new file mode 100644 index 00000000000..4102378e6ae --- /dev/null +++ b/compiler/testData/ir/irText/expressions/memberTypeArguments.kt.txt @@ -0,0 +1,20 @@ +class GenericClass { + constructor(value: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: T + field = value + get + + fun withNewValue(newValue: T): GenericClass { + return TODO("IrConstructorCall") + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/membersImportedFromObject.kt.txt b/compiler/testData/ir/irText/expressions/membersImportedFromObject.kt.txt new file mode 100644 index 00000000000..f9d9c9de7d7 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/membersImportedFromObject.kt.txt @@ -0,0 +1,45 @@ +object A { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo(): Int { + return 1 + } + + fun Int.fooExt(): Int { + return 2 + } + + val bar: Int + field = 42 + get + + val Int.barExt: Int + get(): Int { + return 43 + } + + + + +} + +val test1: Int + field = A.foo() + get + +val test2: Int + field = A.() + get + +val test3: Int + field = A.fooExt($receiver = 1) + get + +val test4: Int + field = A.($receiver = 1) + get + diff --git a/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt b/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt new file mode 100644 index 00000000000..a931c661a06 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt @@ -0,0 +1,67 @@ +class Outer { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + open inner class Inner { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + + + + } + + + + +} + +class Host { + constructor(y: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val y: Int + field = y + get + + fun Outer.test(): Inner { + return { //BLOCK + local class : Inner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val xx: Int + field = .().plus(other = .()) + get + + + + + } + + + TODO("IrConstructorCall") + } + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/nullCheckOnGenericLambdaReturn.kt.txt b/compiler/testData/ir/irText/expressions/nullCheckOnGenericLambdaReturn.kt.txt new file mode 100644 index 00000000000..5aaa42f70a7 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/nullCheckOnGenericLambdaReturn.kt.txt @@ -0,0 +1,48 @@ +fun checkAny(fn: Function0): Any { + return fn.invoke() +} + +fun checkAnyN(fn: Function0): Any? { + return fn.invoke() +} + +fun checkT(fn: Function0): T { + return fn.invoke() +} + +fun checkTAny(fn: Function0): T { + return fn.invoke() +} + +fun id(x: T): T { + return x +} + +fun test1(): @FlexibleNullability String? { + return checkT<@FlexibleNullability String?>(fn = local fun (): @FlexibleNullability String? { + return foo() + } +) +} + +fun test2(): String { + return checkT(fn = local fun (): String? { + return nnFoo() + } +) /*!! String */ +} + +fun test3(): @FlexibleNullability String? { + return checkTAny<@FlexibleNullability String?>(fn = local fun (): @FlexibleNullability String? { + return foo() + } +) +} + +fun test4(): String { + return checkTAny(fn = local fun (): String? { + return nnFoo() + } +) /*!! String */ +} + diff --git a/compiler/testData/ir/irText/expressions/nullCheckOnLambdaReturn.kt.txt b/compiler/testData/ir/irText/expressions/nullCheckOnLambdaReturn.kt.txt new file mode 100644 index 00000000000..d2fd6166b45 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/nullCheckOnLambdaReturn.kt.txt @@ -0,0 +1,54 @@ +fun checkAny(fn: Function0): Any { + return fn.invoke() +} + +fun checkAnyN(fn: Function0): Any? { + return fn.invoke() +} + +fun id(x: T): T { + return x +} + +fun test1(): Any { + return checkAny(fn = local fun (): Any { + return foo() /*!! String */ + } +) +} + +val test2: Function0 + field = local fun (): @FlexibleNullability String? { + return foo() /*!! String */ + } + + get + +val test3: Function0 + field = local fun (): @FlexibleNullability String? { + return foo() + } + as Function0 + get + +val test4: Function0 + field = id>(x = local fun (): @FlexibleNullability String? { + return foo() + } +) + get + +fun test5(): Any? { + return checkAnyN(fn = local fun (): Any? { + return foo() + } +) +} + +fun test6(): Any? { + return checkAnyN(fn = local fun (): Any? { + return nnFoo() + } +) +} + diff --git a/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt b/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt new file mode 100644 index 00000000000..2b1164076df --- /dev/null +++ b/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt @@ -0,0 +1,48 @@ +object A { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +enum class En : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + X init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): En /* Synthetic body for ENUM_VALUEOF */ + +} + +operator fun A.invoke(i: Int): Int { + return i +} + +operator fun En.invoke(i: Int): Int { + return i +} + +val test1: Int + field = invoke($receiver = A, i = 42) + get + +val test2: Int + field = invoke($receiver = En, i = 42) + get + diff --git a/compiler/testData/ir/irText/expressions/objectClassReference.kt.txt b/compiler/testData/ir/irText/expressions/objectClassReference.kt.txt new file mode 100644 index 00000000000..9430fd8dc6d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/objectClassReference.kt.txt @@ -0,0 +1,17 @@ +object A { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +fun test() { + A::class /*~> Unit */ + ($receiver = A::class) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/objectReference.kt.txt b/compiler/testData/ir/irText/expressions/objectReference.kt.txt new file mode 100644 index 00000000000..ea15cb71400 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/objectReference.kt.txt @@ -0,0 +1,103 @@ +object Z { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var counter: Int + field = 0 + get + set + + fun foo() { + } + + fun bar() { + .( = 1) + .foo() + Z.( = 1) + Z.foo() + } + + class Nested { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + init { + Z.( = 1) + Z.foo() + Z.( = 1) + Z.foo() + } + + fun test() { + Z.( = 1) + Z.foo() + Z.( = 1) + Z.foo() + } + + + + + } + + val aLambda: Function0 + field = local fun () { + Z.( = 1) + Z.foo() + Z.( = 1) + Z.foo() + } + + get + + val anObject: Any + field = { //BLOCK + local class { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + init { + Z.( = 1) + Z.foo() + Z.( = 1) + Z.foo() + } + + fun test() { + Z.( = 1) + Z.foo() + Z.( = 1) + Z.foo() + } + + + + + } + + + TODO("IrConstructorCall") + } + get + + + + +} + +fun Z.test() { + .( = 1) + .foo() + Z.( = 1) + Z.foo() +} + diff --git a/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.kt.txt b/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.kt.txt new file mode 100644 index 00000000000..652cd8c32c9 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.kt.txt @@ -0,0 +1,28 @@ +abstract class Base { + constructor(lambda: Function0) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val lambda: Function0 + field = lambda + get + + + + +} + +object Test : Base { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.kt.txt b/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.kt.txt new file mode 100644 index 00000000000..2bc62bb9d23 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.kt.txt @@ -0,0 +1,25 @@ +object A { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private val a: String + field = "$" + private get + + private val b: String + field = "1234" + +.() + private get + + private val c: Int + field = 10000 + private get + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt.txt b/compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt.txt new file mode 100644 index 00000000000..c27264b8e7c --- /dev/null +++ b/compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt.txt @@ -0,0 +1,31 @@ +class Outer { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun outer() { + } + + inner class Inner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun inner() { + return .outer() + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/primitiveComparisons.kt.txt b/compiler/testData/ir/irText/expressions/primitiveComparisons.kt.txt new file mode 100644 index 00000000000..86a72670df2 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/primitiveComparisons.kt.txt @@ -0,0 +1,96 @@ +fun btest1(a: Byte, b: Byte): Boolean { + return greater(arg0 = a.toInt(), arg1 = b.toInt()) +} + +fun btest2(a: Byte, b: Byte): Boolean { + return less(arg0 = a.toInt(), arg1 = b.toInt()) +} + +fun btest3(a: Byte, b: Byte): Boolean { + return greaterOrEqual(arg0 = a.toInt(), arg1 = b.toInt()) +} + +fun btest4(a: Byte, b: Byte): Boolean { + return lessOrEqual(arg0 = a.toInt(), arg1 = b.toInt()) +} + +fun stest1(a: Short, b: Short): Boolean { + return greater(arg0 = a.toInt(), arg1 = b.toInt()) +} + +fun stest2(a: Short, b: Short): Boolean { + return less(arg0 = a.toInt(), arg1 = b.toInt()) +} + +fun stest3(a: Short, b: Short): Boolean { + return greaterOrEqual(arg0 = a.toInt(), arg1 = b.toInt()) +} + +fun stest4(a: Short, b: Short): Boolean { + return lessOrEqual(arg0 = a.toInt(), arg1 = b.toInt()) +} + +fun itest1(a: Int, b: Int): Boolean { + return greater(arg0 = a, arg1 = b) +} + +fun itest2(a: Int, b: Int): Boolean { + return less(arg0 = a, arg1 = b) +} + +fun itest3(a: Int, b: Int): Boolean { + return greaterOrEqual(arg0 = a, arg1 = b) +} + +fun itest4(a: Int, b: Int): Boolean { + return lessOrEqual(arg0 = a, arg1 = b) +} + +fun ltest1(a: Long, b: Long): Boolean { + return greater(arg0 = a, arg1 = b) +} + +fun ltest2(a: Long, b: Long): Boolean { + return less(arg0 = a, arg1 = b) +} + +fun ltest3(a: Long, b: Long): Boolean { + return greaterOrEqual(arg0 = a, arg1 = b) +} + +fun ltest4(a: Long, b: Long): Boolean { + return lessOrEqual(arg0 = a, arg1 = b) +} + +fun ftest1(a: Float, b: Float): Boolean { + return greater(arg0 = a, arg1 = b) +} + +fun ftest2(a: Float, b: Float): Boolean { + return less(arg0 = a, arg1 = b) +} + +fun ftest3(a: Float, b: Float): Boolean { + return greaterOrEqual(arg0 = a, arg1 = b) +} + +fun ftest4(a: Float, b: Float): Boolean { + return lessOrEqual(arg0 = a, arg1 = b) +} + +fun dtest1(a: Double, b: Double): Boolean { + return greater(arg0 = a, arg1 = b) +} + +fun dtest2(a: Double, b: Double): Boolean { + return less(arg0 = a, arg1 = b) +} + +fun dtest3(a: Double, b: Double): Boolean { + return greaterOrEqual(arg0 = a, arg1 = b) +} + +fun dtest4(a: Double, b: Double): Boolean { + return lessOrEqual(arg0 = a, arg1 = b) +} + diff --git a/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.kt.txt b/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.kt.txt new file mode 100644 index 00000000000..997fb638841 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.kt.txt @@ -0,0 +1,53 @@ +val test1: Long + field = 42L + get + +val test2: Short + field = 42S + get + +val test3: Byte + field = 42B + get + +val test4: Long + field = 42.unaryMinus().toLong() + get + +val test5: Short + field = 42.unaryMinus().toShort() + get + +val test6: Byte + field = 42.unaryMinus().toByte() + get + +fun test() { + val test1: Int? = 42 + val test2: Long = 42L + val test3: Long? = 42L + val test4: Long? = -1L + val test5: Long? = 1.unaryMinus().toLong() + val test6: Short? = 1.unaryMinus().toShort() + val test7: Byte? = 1.unaryMinus().toByte() +} + +fun testImplicitArguments(x: Long = 1.unaryMinus().toLong()) { +} + +class TestImplicitArguments { + constructor(x: Long = 1.unaryMinus().toLong()) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Long + field = x + get + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/propertyReferences.kt.txt b/compiler/testData/ir/irText/expressions/propertyReferences.kt.txt new file mode 100644 index 00000000000..5ceb572b2cf --- /dev/null +++ b/compiler/testData/ir/irText/expressions/propertyReferences.kt.txt @@ -0,0 +1,138 @@ +object Delegate { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + operator fun getValue(thisRef: Any?, kProp: Any): Int { + return 1 + } + + operator fun setValue(thisRef: Any?, kProp: Any, value: Int) { + } + + + + +} + +open class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var varWithPrivateSet: Int + field = 1 + get + private set + + var varWithProtectedSet: Int + field = 1 + get + protected set + + + + +} + +val valWithBackingField: Int + field = 1 + get + +val test_valWithBackingField: KProperty0 + field = ::valWithBackingField + get + +var varWithBackingField: Int + field = 1 + get + set + +val test_varWithBackingField: KMutableProperty0 + field = ::varWithBackingField + get + +var varWithBackingFieldAndAccessors: Int + field = 1 + get(): Int { + return #varWithBackingFieldAndAccessors + } + set(value: Int) { + #varWithBackingFieldAndAccessors = value + } + +val test_varWithBackingFieldAndAccessors: KMutableProperty0 + field = ::varWithBackingFieldAndAccessors + get + +val valWithAccessors: Int + get(): Int { + return 1 + } + +val test_valWithAccessors: KProperty0 + field = ::valWithAccessors + get + +var varWithAccessors: Int + get(): Int { + return 1 + } + set(value: Int) { + } + +val test_varWithAccessors: KMutableProperty0 + field = ::varWithAccessors + get + +val delegatedVal: Int /* by */ + field = Delegate + get(): Int { + return #delegatedVal$delegate.getValue(thisRef = null, kProp = ::delegatedVal) + } + +val test_delegatedVal: KProperty0 + field = ::delegatedVal + get + +var delegatedVar: Int /* by */ + field = Delegate + get(): Int { + return #delegatedVar$delegate.getValue(thisRef = null, kProp = ::delegatedVar) + } + set(: Int) { + return #delegatedVar$delegate.setValue(thisRef = null, kProp = ::delegatedVar, value = ) + } + +val test_delegatedVar: KMutableProperty0 + field = ::delegatedVar + get + +val constVal: Int + field = 1 + get + +val test_constVal: KProperty0 + field = ::constVal + get + +val test_J_CONST: KProperty0 + field = ::CONST + get + +val test_J_nonConst: KMutableProperty0 + field = ::nonConst + get + +val test_varWithPrivateSet: KProperty1 + field = ::varWithPrivateSet + get + +val test_varWithProtectedSet: KProperty1 + field = ::varWithProtectedSet + get + diff --git a/compiler/testData/ir/irText/expressions/references.kt.txt b/compiler/testData/ir/irText/expressions/references.kt.txt new file mode 100644 index 00000000000..b7271694093 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/references.kt.txt @@ -0,0 +1,39 @@ +val ok: String + field = "OK" + get + +val ok2: String + field = () + get + +val ok3: String + get(): String { + return "OK" + } + +fun test1(): String { + return () +} + +fun test2(x: String): String { + return x +} + +fun test3(): String { + val x: String = "OK" + return x +} + +fun test4(): String { + return () +} + +val String.okext: String + get(): String { + return "OK" + } + +fun String.test5(): String { + return ($receiver = ) +} + diff --git a/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt b/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt new file mode 100644 index 00000000000..0d7c07ce188 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt @@ -0,0 +1,46 @@ +class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo() { + } + + + + +} + +fun bar() { +} + +val qux: Int + field = 1 + get + +val test1: KClass + field = A::class + get + +val test2: KClass + field = ()::class + get + +val test3: KFunction1 + field = ::foo + get + +val test4: KFunction0 + field = :: + get + +val test5: KFunction0 + field = ::foo + get + +val test6: KFunction0 + field = ::bar + get + diff --git a/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt b/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt new file mode 100644 index 00000000000..d6b7db03636 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt @@ -0,0 +1,27 @@ +class C { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var x: Int + field = x + get + set + + + + +} + +fun test(nc: C?) { + { //BLOCK + val tmp0_safe_receiver: C? = nc + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null /*~> Unit */ + true -> tmp0_safe_receiver.( = 42) + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt new file mode 100644 index 00000000000..325d9e64596 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt @@ -0,0 +1,71 @@ +package test + +class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +var C?.p: Int + get(): Int { + return 42 + } + set(value: Int) { + } + +operator fun Int?.inc(): Int? { + return { //BLOCK + val tmp0_safe_receiver: Int? = + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver.inc() + } + } +} + +operator fun Int?.get(index: Int): Int { + return 42 +} + +operator fun Int?.set(index: Int, value: Int) { +} + +fun testProperty(nc: C?) { + { //BLOCK + val tmp0_safe_receiver: C? = nc + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> { //BLOCK + val tmp1_receiver: C? = tmp0_safe_receiver + { //BLOCK + val tmp2: Int = ($receiver = tmp1_receiver) + ($receiver = tmp1_receiver, value = inc($receiver = tmp2)) + tmp2 + } + } + } + } /*~> Unit */ +} + +fun testArrayAccess(nc: C?) { + { //BLOCK + val tmp1_array: Int? = { //BLOCK + val tmp0_safe_receiver: C? = nc + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> ($receiver = tmp0_safe_receiver) + } + } + val tmp2_index0: Int = 0 + val tmp3: Int = get($receiver = tmp1_array, index = tmp2_index0) + set($receiver = tmp1_array, index = tmp2_index0, value = tmp3.inc()) + tmp3 + } /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/safeCalls.kt.txt b/compiler/testData/ir/irText/expressions/safeCalls.kt.txt new file mode 100644 index 00000000000..01a40661271 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/safeCalls.kt.txt @@ -0,0 +1,91 @@ +class Ref { + constructor(value: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var value: Int + field = value + get + set + + + + +} + +interface IHost { + fun String.extLength(): Int { + return .() + } + + + + +} + +fun test1(x: String?): Int? { + return { //BLOCK + val tmp0_safe_receiver: String? = x + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver.() + } + } +} + +fun test2(x: String?): Int? { + return { //BLOCK + val tmp0_safe_receiver: String? = x + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver.hashCode() + } + } +} + +fun test3(x: String?, y: Any?): Boolean? { + return { //BLOCK + val tmp0_safe_receiver: String? = x + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver.equals(other = y) + } + } +} + +fun test4(x: Ref?) { + { //BLOCK + val tmp0_safe_receiver: Ref? = x + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null /*~> Unit */ + true -> tmp0_safe_receiver.( = 0) + } + } +} + +fun IHost.test5(s: String?): Int? { + return { //BLOCK + val tmp0_safe_receiver: String? = s + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> .extLength($receiver = tmp0_safe_receiver) + } + } +} + +fun Int.foo(): Int { + return 239 +} + +fun box() { + { //BLOCK + val tmp0_safe_receiver: Int = 42 + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> foo($receiver = tmp0_safe_receiver) + } + } /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.kt.txt b/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.kt.txt new file mode 100644 index 00000000000..226510ea91a --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.kt.txt @@ -0,0 +1,45 @@ +fun test(fn: Function0, r: Runnable, arr: Array) { + foo1(r = local fun () { + return Unit + } + /*-> @FlexibleNullability Runnable? */, strs = arr) /*~> Unit */ + foo1(r = local fun () { + return Unit + } + /*-> @FlexibleNullability Runnable? */, strs = [*arr]) /*~> Unit */ + foo1(r = fn /*-> @FlexibleNullability Runnable? */, strs = arr) /*~> Unit */ + foo1(r = fn /*-> @FlexibleNullability Runnable? */, strs = [*arr]) /*~> Unit */ + foo1(r = r, strs = [""]) /*~> Unit */ + foo1(r = fn /*-> @FlexibleNullability Runnable? */, strs = arr) /*~> Unit */ + foo1(r = fn /*-> @FlexibleNullability Runnable? */, strs = [*arr]) /*~> Unit */ + foo1(r = r, strs = [*arr]) /*~> Unit */ + val i1: Test = TODO("IrConstructorCall") + val i2: Test = TODO("IrConstructorCall") + val i3: Test = TODO("IrConstructorCall") + val i4: Test = TODO("IrConstructorCall") + val i5: Test = TODO("IrConstructorCall") + val i6: Test = TODO("IrConstructorCall") + i1.foo2(r1 = local fun () { + return Unit + } + /*-> @FlexibleNullability Runnable? */, r2 = local fun () { + return Unit + } + /*-> @FlexibleNullability Runnable? */, strs = arr) /*~> Unit */ + i1.foo2(r1 = r, r2 = local fun () { + return Unit + } + /*-> @FlexibleNullability Runnable? */, strs = [""]) /*~> Unit */ + i1.foo2(r1 = local fun () { + return Unit + } + /*-> @FlexibleNullability Runnable? */, r2 = local fun () { + return Unit + } + /*-> @FlexibleNullability Runnable? */, strs = [*arr]) /*~> Unit */ + i1.foo2(r1 = r, r2 = local fun () { + return Unit + } + /*-> @FlexibleNullability Runnable? */, strs = [*arr]) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.kt.txt b/compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.kt.txt new file mode 100644 index 00000000000..86d7ed9b968 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.kt.txt @@ -0,0 +1,15 @@ +fun test(a: SomeJavaClass) { + a.someFunction(hello = local fun (it: @FlexibleNullability String?) { + return Unit + } + /*-> @FlexibleNullability Hello? */) + a.plus(hello = local fun (it: @FlexibleNullability String?) { + return Unit + } + /*-> @FlexibleNullability Hello? */) + a.get(hello = local fun (it: @FlexibleNullability String?) { + return Unit + } + /*-> @FlexibleNullability Hello? */) +} + diff --git a/compiler/testData/ir/irText/expressions/sam/samByProjectedType.kt.txt b/compiler/testData/ir/irText/expressions/sam/samByProjectedType.kt.txt new file mode 100644 index 00000000000..ae78644935d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/samByProjectedType.kt.txt @@ -0,0 +1,7 @@ +fun test1() { + bar(j = local fun (x: Any): @FlexibleNullability Any? { + return x + } + /*-> @FlexibleNullability J<@FlexibleNullability Any?>? */) +} + diff --git a/compiler/testData/ir/irText/expressions/sam/samConstructors.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConstructors.kt.txt new file mode 100644 index 00000000000..100df56b438 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/samConstructors.kt.txt @@ -0,0 +1,25 @@ +fun test1(): Runnable { + return local fun () { + return Unit + } + /*-> Runnable */ +} + +fun test2(a: Function0): Runnable { + return a /*-> Runnable */ +} + +fun foo() { +} + +fun test3(): Runnable { + return ::foo /*-> Runnable */ +} + +fun test4(): Comparator { + return local fun (a: @FlexibleNullability Int?, b: @FlexibleNullability Int?): Int { + return a /*!! Int */.minus(other = b /*!! Int */) + } + /*-> Comparator */ +} + diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall.kt.txt new file mode 100644 index 00000000000..a9f824ba338 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall.kt.txt @@ -0,0 +1,9 @@ +fun test1(f: Function1): C<@FlexibleNullability String?> { + return TODO("IrConstructorCall") +} + +fun test2(x: Any) { + x as Function1 /*~> Unit */ + TODO("IrConstructorCall") /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt new file mode 100644 index 00000000000..4043b3ac501 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt @@ -0,0 +1,49 @@ +fun test3(f1: Function1, f2: Function1): D<@FlexibleNullability Int?, @FlexibleNullability String?> { + return TODO("IrConstructorCall") +} + +class Outer { + constructor(j11: J) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val j11: J + field = j11 + get + + inner class Inner { + constructor(j12: J) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val j12: J + field = j12 + get + + + + + } + + + + +} + +fun test4(f: Function1, g: Function1): Inner<@FlexibleNullability Any?, @FlexibleNullability String?> { + return TODO("IrConstructorCall") +} + +fun testGenericJavaCtor1(f: Function1): G<@FlexibleNullability String?> { + return TODO("IrConstructorCall") +} + +fun testGenericJavaCtor2(x: Any) { + x as Function1 /*~> Unit */ + TODO("IrConstructorCall") /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.kt.txt new file mode 100644 index 00000000000..6da8d3ea5da --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.kt.txt @@ -0,0 +1,52 @@ +fun test1(): J { + return local fun (x: @FlexibleNullability String?): @FlexibleNullability String? { + return x + } + /*-> J */ +} + +fun test2(): J<@FlexibleNullability String?> { + return local fun (x: String): @FlexibleNullability String? { + return x + } + /*-> J<@FlexibleNullability String?> */ +} + +fun test3() { + return bar<@FlexibleNullability String?>(j = local fun (x: String): @FlexibleNullability String? { + return x + } + /*-> @FlexibleNullability J<@FlexibleNullability String?>? */) +} + +fun test4(a: Any) { + a as J /*~> Unit */ + bar<@FlexibleNullability String?>(j = a /*as J<@FlexibleNullability String?> */) +} + +fun test5(a: Any) { + a as Function1 /*~> Unit */ + bar<@FlexibleNullability String?>(j = a /*as Function1<@ParameterName(...) @FlexibleNullability String?, @FlexibleNullability String?> */ /*-> @FlexibleNullability J<@FlexibleNullability String?>? */) +} + +fun test6(a: Function1) { + bar(j = a /*-> @FlexibleNullability J? */) +} + +fun test7(a: Any) { + a as Function1 /*~> Unit */ + bar(j = a /*as Function1<@ParameterName(...) T?, T?> */ /*-> @FlexibleNullability J? */) +} + +fun test8(efn: @ExtensionFunctionType Function1): J<@FlexibleNullability String?> { + return efn /*-> J<@FlexibleNullability String?> */ +} + +fun test9(efn: @ExtensionFunctionType Function1) { + bar<@FlexibleNullability String?>(j = efn /*-> @FlexibleNullability J<@FlexibleNullability String?>? */) +} + +fun test10(fn: Function1) { + bar2x<@FlexibleNullability Int?>(j2x = fn /*-> @FlexibleNullability J2X<@FlexibleNullability Int?>? */) +} + diff --git a/compiler/testData/ir/irText/expressions/sam/samConversions.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversions.kt.txt new file mode 100644 index 00000000000..c73f33c98a1 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/samConversions.kt.txt @@ -0,0 +1,30 @@ +fun J.test0(a: Runnable) { + runStatic(r = a) + .runIt(r = a) +} + +fun test1() { + runStatic(r = local fun () { + test1() + } + /*-> @FlexibleNullability Runnable? */) +} + +fun J.test2() { + .runIt(r = local fun () { + test1() + } + /*-> @FlexibleNullability Runnable? */) +} + +fun J.test3(a: Function0) { + .run2(r1 = a /*-> @FlexibleNullability Runnable? */, r2 = a /*-> @FlexibleNullability Runnable? */) +} + +fun J.test4(a: Function0, b: Function0, flag: Boolean) { + .runIt(r = when { + flag -> a + true -> b + } /*-> @FlexibleNullability Runnable? */) +} + diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.kt.txt new file mode 100644 index 00000000000..cc591c082b1 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.kt.txt @@ -0,0 +1,67 @@ +fun test1(a: Function0) { + when { + a is Runnable -> { //BLOCK + runStatic(r = a /*as Runnable */) + } + } +} + +fun test2(a: Function0) { + when { + a is Runnable -> { //BLOCK + TODO("IrConstructorCall").run1(r = a /*as Runnable */) + } + } +} + +fun test3(a: Function0) { + when { + a is Runnable -> { //BLOCK + TODO("IrConstructorCall").run2(r1 = a /*as Runnable */, r2 = a /*as Runnable */) + } + } +} + +fun test4(a: Function0, b: Function0) { + when { + a is Runnable -> { //BLOCK + TODO("IrConstructorCall").run2(r1 = a /*-> @FlexibleNullability Runnable? */, r2 = b /*-> @FlexibleNullability Runnable? */) + } + } +} + +fun test5(a: Any) { + when { + a is Runnable -> { //BLOCK + TODO("IrConstructorCall").run1(r = a /*as Runnable */) + } + } +} + +fun test5x(a: Any) { + when { + a is Runnable -> { //BLOCK + a as Function0 /*~> Unit */ + TODO("IrConstructorCall").run1(r = a /*as Runnable */) + } + } +} + +fun test6(a: Any) { + a as Function0 /*~> Unit */ + TODO("IrConstructorCall").run1(r = a /*as Function0 */ /*-> @FlexibleNullability Runnable? */) +} + +fun test7(a: Function1) { + a as Function0 /*~> Unit */ + TODO("IrConstructorCall").run1(r = a /*as Function0 */ /*-> @FlexibleNullability Runnable? */) +} + +fun test8(a: Function0) { + TODO("IrConstructorCall").run1(r = id<@FlexibleNullability Function0?>(x = a) /*!! Function0 */ /*-> @FlexibleNullability Runnable? */) +} + +fun test9() { + TODO("IrConstructorCall").run1(r = ::test9 /*-> @FlexibleNullability Runnable? */) +} + diff --git a/compiler/testData/ir/irText/expressions/sam/samOperators.kt.txt b/compiler/testData/ir/irText/expressions/sam/samOperators.kt.txt new file mode 100644 index 00000000000..311a011a2d0 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/samOperators.kt.txt @@ -0,0 +1,18 @@ +fun f() { +} + +fun J.test1() { + .get(k = ::f /*-> @FlexibleNullability Runnable? */) + .get(k = ::f /*-> @FlexibleNullability Runnable? */, m = ::f /*-> @FlexibleNullability Runnable? */) +} + +fun J.test2() { + .set(k = ::f /*-> @FlexibleNullability Runnable? */, v = ::f /*-> @FlexibleNullability Runnable? */) + .set(k = ::f /*-> @FlexibleNullability Runnable? */, m = ::f /*-> @FlexibleNullability Runnable? */, v = ::f /*-> @FlexibleNullability Runnable? */) +} + +fun J.test3() { + .plusAssign(i = ::f /*-> @FlexibleNullability Runnable? */) + .minusAssign(i = ::f /*-> @FlexibleNullability Runnable? */) +} + diff --git a/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt new file mode 100644 index 00000000000..8cd1a219d9f --- /dev/null +++ b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt @@ -0,0 +1,20 @@ +class Derived : Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun setValue(v: Any) { + when { + v is String -> { //BLOCK + #value = v /*as String */ + } + } + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_annotation.kt.txt b/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_annotation.kt.txt new file mode 100644 index 00000000000..7593e9e50a4 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_annotation.kt.txt @@ -0,0 +1,9 @@ +package kotlin.internal + +annotation class ImplicitIntegerCoercion : Annotation { + constructor() /* primary */ + + + +} + diff --git a/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.kt.txt b/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.kt.txt new file mode 100644 index 00000000000..23f17f68081 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.kt.txt @@ -0,0 +1,58 @@ +@ImplicitIntegerCoercion +const val IMPLICIT_INT: Int + field = 255 + get + +@ImplicitIntegerCoercion +const val EXPLICIT_INT: Int + field = 255 + get + +@ImplicitIntegerCoercion +const val LONG_CONST: Long + field = 255L + get + +@ImplicitIntegerCoercion +val NON_CONST: Int + field = 255 + get + +@ImplicitIntegerCoercion +const val BIGGER_THAN_UBYTE: Int + field = 256 + get + +@ImplicitIntegerCoercion +const val UINT_CONST: UInt + field = 42 + get + +fun takeUByte(u: UByte) { +} + +fun takeUShort(u: UShort) { +} + +fun takeUInt(u: UInt) { +} + +fun takeULong(u: ULong) { +} + +fun takeUBytes(vararg u: UByte) { +} + +fun takeLong(l: Long) { +} + +fun test() { + takeUByte(u = toUByte($receiver = ())) + takeUByte(u = toUByte($receiver = ())) + takeUShort(u = toUShort($receiver = ())) + takeUShort(u = toUShort($receiver = ())) + takeUInt(u = toUInt($receiver = ())) + takeULong(u = toULong($receiver = ())) + takeUBytes(u = [toUByte($receiver = ()), toUByte($receiver = ()), 42B]) +} + diff --git a/compiler/testData/ir/irText/expressions/simpleOperators.kt.txt b/compiler/testData/ir/irText/expressions/simpleOperators.kt.txt new file mode 100644 index 00000000000..9e80cfff977 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/simpleOperators.kt.txt @@ -0,0 +1,44 @@ +fun test1(a: Int, b: Int): Int { + return a.plus(other = b) +} + +fun test2(a: Int, b: Int): Int { + return a.minus(other = b) +} + +fun test3(a: Int, b: Int): Int { + return a.times(other = b) +} + +fun test4(a: Int, b: Int): Int { + return a.div(other = b) +} + +fun test5(a: Int, b: Int): Int { + return a.rem(other = b) +} + +fun test6(a: Int, b: Int): IntRange { + return a.rangeTo(other = b) +} + +fun test1x(a: Int, b: Int): Int { + return a.plus(other = b) +} + +fun test2x(a: Int, b: Int): Int { + return a.minus(other = b) +} + +fun test3x(a: Int, b: Int): Int { + return a.times(other = b) +} + +fun test4x(a: Int, b: Int): Int { + return a.div(other = b) +} + +fun test5x(a: Int, b: Int): Int { + return a.rem(other = b) +} + diff --git a/compiler/testData/ir/irText/expressions/simpleUnaryOperators.kt.txt b/compiler/testData/ir/irText/expressions/simpleUnaryOperators.kt.txt new file mode 100644 index 00000000000..c2b7bca047d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/simpleUnaryOperators.kt.txt @@ -0,0 +1,24 @@ +fun test1(x: Int): Int { + return x.unaryMinus() +} + +fun test2(): Int { + return -42 +} + +fun test3(x: Int): Int { + return x.unaryPlus() +} + +fun test4(): Int { + return 42 +} + +fun test5(x: Boolean): Boolean { + return x.not() +} + +fun test6(): Boolean { + return false +} + diff --git a/compiler/testData/ir/irText/expressions/smartCasts.kt.txt b/compiler/testData/ir/irText/expressions/smartCasts.kt.txt new file mode 100644 index 00000000000..9de2088812f --- /dev/null +++ b/compiler/testData/ir/irText/expressions/smartCasts.kt.txt @@ -0,0 +1,38 @@ +fun expectsString(s: String) { +} + +fun expectsInt(i: Int) { +} + +fun overloaded(s: String): String { + return s +} + +fun overloaded(x: Any): Any { + return x +} + +fun test1(x: Any) { + when { + x !is String -> return Unit + } + println(message = x /*as String */.()) + expectsString(s = x /*as String */) + expectsInt(i = x /*as String */.()) + expectsString(s = overloaded(s = x /*as String */)) +} + +fun test2(x: Any): String { + when { + x !is String -> return "" + } + return overloaded(s = x /*as String */) +} + +fun test3(x: Any): String { + when { + x !is String -> return "" + } + return x /*as String */ +} + diff --git a/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.kt.txt b/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.kt.txt new file mode 100644 index 00000000000..87c413436c0 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.kt.txt @@ -0,0 +1,31 @@ +interface I1 { + + + +} + +interface I2 { + + + +} + +operator fun I1.component1(): Int { + return 1 +} + +operator fun I2.component2(): String { + return "" +} + +fun test(x: I1) { + when { + x !is I2 -> return Unit + } + // COMPOSITE { + val tmp0_container: I1 = x + val c1: Int = component1($receiver = tmp0_container) + val c2: String = component2($receiver = tmp0_container /*as I2 */) + // } +} + diff --git a/compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.kt.txt b/compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.kt.txt new file mode 100644 index 00000000000..21bb6a5cf5e --- /dev/null +++ b/compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.kt.txt @@ -0,0 +1,21 @@ +class Cell { + constructor(value: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: T + field = value + get + + + + +} + +typealias IntAlias = Cell +fun test(): Cell { + return TODO("IrConstructorCall") +} + diff --git a/compiler/testData/ir/irText/expressions/stringComparisons.kt.txt b/compiler/testData/ir/irText/expressions/stringComparisons.kt.txt new file mode 100644 index 00000000000..6096c5b759b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/stringComparisons.kt.txt @@ -0,0 +1,16 @@ +fun test1(a: String, b: String): Boolean { + return greater(arg0 = a.compareTo(other = b), arg1 = 0) +} + +fun test2(a: String, b: String): Boolean { + return less(arg0 = a.compareTo(other = b), arg1 = 0) +} + +fun test3(a: String, b: String): Boolean { + return greaterOrEqual(arg0 = a.compareTo(other = b), arg1 = 0) +} + +fun test4(a: String, b: String): Boolean { + return lessOrEqual(arg0 = a.compareTo(other = b), arg1 = 0) +} + diff --git a/compiler/testData/ir/irText/expressions/stringPlus.kt.txt b/compiler/testData/ir/irText/expressions/stringPlus.kt.txt new file mode 100644 index 00000000000..fbdd34bca55 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/stringPlus.kt.txt @@ -0,0 +1,12 @@ +fun test1(a: String, b: Any): String { + return a.plus(other = b) +} + +fun test2(a: String, b: Int): String { + return a.plus(other = "+").plus(other = b) +} + +fun test3(a: String, b: Int): String { + return a.plus(other = "+").plus(other = b.plus(other = 1)).plus(other = a) +} + diff --git a/compiler/testData/ir/irText/expressions/stringTemplates.kt.txt b/compiler/testData/ir/irText/expressions/stringTemplates.kt.txt new file mode 100644 index 00000000000..e8e47b4168a --- /dev/null +++ b/compiler/testData/ir/irText/expressions/stringTemplates.kt.txt @@ -0,0 +1,48 @@ +fun foo(): String { + return "" +} + +val x: Int + field = 42 + get + +val test1: String + field = "" + get + +val test2: String + field = "abc" + get + +val test3: String + field = "" + get + +val test4: String + field = "abc" + get + +val test5: String + field = " +abc +" + get + +val test6: String + field = () + +" " + +foo() + get + +val test7: String + field = () + get + +val test8: String + field = foo() + get + +val test9: String + field = () + get + diff --git a/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt b/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt new file mode 100644 index 00000000000..b70dd223235 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt @@ -0,0 +1,177 @@ +fun useSuspend(sfn: SuspendFunction0) { +} + +fun useSuspendExt(sfn: @ExtensionFunctionType SuspendFunction1) { +} + +fun useSuspendArg(sfn: SuspendFunction1) { +} + +fun useSuspendArgT(sfn: SuspendFunction1) { +} + +fun useSuspendExtT(sfn: @ExtensionFunctionType SuspendFunction1) { +} + +fun produceFun(): Function0 { + return local fun () { + return Unit + } + +} + +fun testSimple(fn: Function0) { + useSuspend(sfn = { //BLOCK + local suspend fun suspendConversion0() { + fn.invoke() + } + + }) +} + +fun testSimpleNonVal() { + useSuspend(sfn = { //BLOCK + val tmp0: Function0 = produceFun() + local suspend fun suspendConversion1() { + tmp0.invoke() + } + + }) +} + +fun testExtAsExt(fn: @ExtensionFunctionType Function1) { + useSuspendExt(sfn = { //BLOCK + local suspend fun suspendConversion0(p0: Int) { + fn.invoke(p1 = p0) + } + + }) +} + +fun testExtAsSimple(fn: @ExtensionFunctionType Function1) { + useSuspendArg(sfn = { //BLOCK + local suspend fun suspendConversion0(p0: Int) { + fn.invoke(p1 = p0) + } + + }) +} + +fun testSimpleAsExt(fn: Function1) { + useSuspendExt(sfn = { //BLOCK + local suspend fun suspendConversion0(p0: Int) { + fn.invoke(p1 = p0) + } + + }) +} + +fun testSimpleAsSimpleT(fn: Function1) { + useSuspendArgT(sfn = { //BLOCK + local suspend fun suspendConversion0(p0: Int) { + fn.invoke(p1 = p0) + } + + }) +} + +fun testSimpleAsExtT(fn: Function1) { + useSuspendExtT(sfn = { //BLOCK + local suspend fun suspendConversion0(p0: Int) { + fn.invoke(p1 = p0) + } + + }) +} + +fun testExtAsSimpleT(fn: @ExtensionFunctionType Function1) { + useSuspendArgT(sfn = { //BLOCK + local suspend fun suspendConversion0(p0: Int) { + fn.invoke(p1 = p0) + } + + }) +} + +fun testExtAsExtT(fn: @ExtensionFunctionType Function1) { + useSuspendExtT(sfn = { //BLOCK + local suspend fun suspendConversion0(p0: Int) { + fn.invoke(p1 = p0) + } + + }) +} + +fun testSimpleSAsSimpleT(fn: Function1) { + useSuspendArgT(sfn = { //BLOCK + local suspend fun suspendConversion0(p0: S) { + fn.invoke(p1 = p0) + } + + }) +} + +fun testSimpleSAsExtT(fn: Function1) { + useSuspendExtT(sfn = { //BLOCK + local suspend fun suspendConversion0(p0: S) { + fn.invoke(p1 = p0) + } + + }) +} + +fun testExtSAsSimpleT(fn: @ExtensionFunctionType Function1) { + useSuspendArgT(sfn = { //BLOCK + local suspend fun suspendConversion0(p0: S) { + fn.invoke(p1 = p0) + } + + }) +} + +fun testExtSAsExtT(fn: @ExtensionFunctionType Function1) { + useSuspendExtT(sfn = { //BLOCK + local suspend fun suspendConversion0(p0: S) { + fn.invoke(p1 = p0) + } + + }) +} + +fun testSmartCastWithSuspendConversion(a: Any) { + a as Function0 /*~> Unit */ + useSuspend(sfn = { //BLOCK + local suspend fun suspendConversion0() { + a /*as Function0 */.invoke() + } + + }) +} + +fun testSmartCastOnVarWithSuspendConversion(a: Any) { + var b: Any = a + b as Function0 /*~> Unit */ + useSuspend(sfn = { //BLOCK + val tmp0: Function0 = b /*as Function0 */ + local suspend fun suspendConversion1() { + tmp0.invoke() + } + + }) +} + +fun testSmartCastVsSuspendConversion(a: Function0) { + a as SuspendFunction0 /*~> Unit */ + useSuspend(sfn = a /*as SuspendFunction0 */) +} + +fun testSmartCastOnVarVsSuspendConversion(a: Function0) { + var b: Function0 = a + b as SuspendFunction0 /*~> Unit */ + useSuspend(sfn = b /*as SuspendFunction0 */) +} + +fun testIntersectionVsSuspendConversion(x: T) where T : Function0, T : SuspendFunction0 { + useSuspend(sfn = x) +} + diff --git a/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.kt.txt b/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.kt.txt new file mode 100644 index 00000000000..b04530ede70 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.kt.txt @@ -0,0 +1,28 @@ +val n: Any? + field = null + get + +enum class En : Enum { + private constructor(x: String?) /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: String? + field = x + get + + ENTRY init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): En /* Synthetic body for ENUM_VALUEOF */ + +} + diff --git a/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt b/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt new file mode 100644 index 00000000000..9247da77c6c --- /dev/null +++ b/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt @@ -0,0 +1,25 @@ +class C { + constructor(x: Any?) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val s: String? + get + + init { + #s = { //BLOCK + val tmp0_safe_receiver: Any? = x + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver.toString() + } + } + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt b/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt new file mode 100644 index 00000000000..5aa5c99dbef --- /dev/null +++ b/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt @@ -0,0 +1,55 @@ +class Outer { + constructor(x: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: T + field = x + get + + open inner class Inner { + constructor(y: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val y: Int + field = y + get + + + + + } + + + + +} + +fun Outer.test(): Inner { + return { //BLOCK + local class : Inner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val xx: Int + field = .().plus(other = .()) + get + + + + + } + + + TODO("IrConstructorCall") + } +} + diff --git a/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.kt.txt b/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.kt.txt new file mode 100644 index 00000000000..bd5b304ba62 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.kt.txt @@ -0,0 +1,52 @@ +open class Base { + constructor(x: Any) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Any + field = x + get + + + + +} + +object Host { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + class Derived1 : Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + class Derived2 : Base { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt b/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt new file mode 100644 index 00000000000..160498490c3 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt @@ -0,0 +1,63 @@ +fun WithCompanion.test() { + val test1: = { //BLOCK + local class : WithCompanion { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + TODO("IrConstructorCall") + } + val test2: = { //BLOCK + local class : WithCompanion { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + TODO("IrConstructorCall") + } +} + +open class WithCompanion { + constructor(a: Companion) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + companion object Companion { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo(): Companion { + return + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/throw.kt.txt b/compiler/testData/ir/irText/expressions/throw.kt.txt new file mode 100644 index 00000000000..ab082bfb927 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/throw.kt.txt @@ -0,0 +1,12 @@ +fun test1() { + throw TODO("IrConstructorCall") +} + +fun testImplicitCast(a: Any) { + when { + a is Throwable -> { //BLOCK + throw a /*as Throwable */ + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/tryCatch.kt.txt b/compiler/testData/ir/irText/expressions/tryCatch.kt.txt new file mode 100644 index 00000000000..20dc663e17b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/tryCatch.kt.txt @@ -0,0 +1,27 @@ +fun test1() { + try { //BLOCK + println() + } + catch (...) { //BLOCK + println() + } + finally { //BLOCK + println() + } +} + +fun test2(): Int { + return try { //BLOCK + println() + 42 + } + catch (...) { //BLOCK + println() + 24 + } + finally { //BLOCK + println() + 555 /*~> Unit */ + } +} + diff --git a/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.kt.txt b/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.kt.txt new file mode 100644 index 00000000000..f629a1d3fc9 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.kt.txt @@ -0,0 +1,13 @@ +fun testImplicitCast(a: Any) { + when { + a !is String -> return Unit + } + val t: String = try { //BLOCK + a + } /*as String */ + catch (...) { //BLOCK + "" + } + +} + diff --git a/compiler/testData/ir/irText/expressions/typeAliasConstructorReference.kt.txt b/compiler/testData/ir/irText/expressions/typeAliasConstructorReference.kt.txt new file mode 100644 index 00000000000..e8914501210 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/typeAliasConstructorReference.kt.txt @@ -0,0 +1,46 @@ +class C { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +typealias CA = C +object Host { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + class Nested { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + +typealias NA = Nested +val test1: Function1 + field = :: + get + +val test2: Function1 + field = :: + get + diff --git a/compiler/testData/ir/irText/expressions/typeArguments.kt.txt b/compiler/testData/ir/irText/expressions/typeArguments.kt.txt new file mode 100644 index 00000000000..93a36d84fdf --- /dev/null +++ b/compiler/testData/ir/irText/expressions/typeArguments.kt.txt @@ -0,0 +1,7 @@ +fun test1(x: Any): Boolean { + return when { + x is Array<*> -> isArrayOf($receiver = x /*as Array<*> */) + true -> false + } +} + diff --git a/compiler/testData/ir/irText/expressions/typeOperators.kt.txt b/compiler/testData/ir/irText/expressions/typeOperators.kt.txt new file mode 100644 index 00000000000..bd40e188054 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/typeOperators.kt.txt @@ -0,0 +1,22 @@ +interface IThing { + + + +} + +fun test1(x: Any): Boolean { + return x is IThing +} + +fun test2(x: Any): Boolean { + return x !is IThing +} + +fun test3(x: Any): IThing { + return x as IThing +} + +fun test4(x: Any): IThing? { + return x as? IThing +} + diff --git a/compiler/testData/ir/irText/expressions/typeParameterClassLiteral.kt.txt b/compiler/testData/ir/irText/expressions/typeParameterClassLiteral.kt.txt new file mode 100644 index 00000000000..e07c6b9bd7e --- /dev/null +++ b/compiler/testData/ir/irText/expressions/typeParameterClassLiteral.kt.txt @@ -0,0 +1,38 @@ +inline fun classRefFun(): KClass { + return T::class +} + +inline fun Any.classRefExtFun(): KClass { + return T::class +} + +val T.classRefExtVal: KClass + inline get(): KClass { + return T::class + } + +class Host { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + inline fun classRefGenericMemberFun(): KClass { + return TF::class + } + + inline fun Any.classRefGenericMemberExtFun(): KClass { + return TF::class + } + + val TV.classRefGenericMemberExtVal: KClass + inline get(): KClass { + return TV::class + } + + + + +} + diff --git a/compiler/testData/ir/irText/expressions/unsignedIntegerLiterals.kt.txt b/compiler/testData/ir/irText/expressions/unsignedIntegerLiterals.kt.txt new file mode 100644 index 00000000000..63a971bead9 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/unsignedIntegerLiterals.kt.txt @@ -0,0 +1,40 @@ +val testSimpleUIntLiteral: UInt + field = 1 + get + +val testSimpleUIntLiteralWithOverflow: UInt + field = -1 + get + +val testUByteWithExpectedType: UByte + field = 1B + get + +val testUShortWithExpectedType: UShort + field = 1S + get + +val testUIntWithExpectedType: UInt + field = 1 + get + +val testULongWithExpectedType: ULong + field = 1L + get + +val testToUByte: UByte + field = toUByte($receiver = 1) + get + +val testToUShort: UShort + field = toUShort($receiver = 1) + get + +val testToUInt: UInt + field = toUInt($receiver = 1) + get + +val testToULong: ULong + field = toULong($receiver = 1) + get + diff --git a/compiler/testData/ir/irText/expressions/useImportedMember.kt.txt b/compiler/testData/ir/irText/expressions/useImportedMember.kt.txt new file mode 100644 index 00000000000..6278864c86a --- /dev/null +++ b/compiler/testData/ir/irText/expressions/useImportedMember.kt.txt @@ -0,0 +1,114 @@ +interface I { + fun T.fromInterface(): T { + return + } + + fun genericFromSuper(g: G): G { + return g + } + + + + +} + +open class BaseClass { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val T.fromClass: T + get(): T { + return + } + + + + +} + +object C : BaseClass, I { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun f(s: Int): Int { + return 1 + } + + fun f(s: String): Int { + return 2 + } + + fun Boolean.f(): Int { + return 3 + } + + var p: Int + field = 4 + get + set + + val Int.ext: Int + get(): Int { + return 6 + } + + fun g1(t: T): T { + return t + } + + val T.g2: T + get(): T { + return + } + + + + + + +} + +fun box(): String { + when { + EQEQ(arg0 = C.f(s = 1), arg1 = 1).not() -> return "1" + } + when { + EQEQ(arg0 = C.f(s = "s"), arg1 = 2).not() -> return "2" + } + when { + EQEQ(arg0 = C.f($receiver = true), arg1 = 3).not() -> return "3" + } + when { + EQEQ(arg0 = C.(), arg1 = 4).not() -> return "4" + } + C.( = 5) + when { + EQEQ(arg0 = C.(), arg1 = 5).not() -> return "5" + } + when { + EQEQ(arg0 = C.($receiver = 5), arg1 = 6).not() -> return "6" + } + when { + EQEQ(arg0 = C.g1(t = "7"), arg1 = "7").not() -> return "7" + } + when { + EQEQ(arg0 = C.($receiver = "8"), arg1 = "8").not() -> return "8" + } + when { + EQEQ(arg0 = C.fromInterface($receiver = 9), arg1 = 9).not() -> return "9" + } + when { + EQEQ(arg0 = C.($receiver = "10"), arg1 = "10").not() -> return "10" + } + when { + EQEQ(arg0 = C.genericFromSuper(g = "11"), arg1 = "11").not() -> return "11" + } + return "OK" +} + diff --git a/compiler/testData/ir/irText/expressions/values.kt.txt b/compiler/testData/ir/irText/expressions/values.kt.txt new file mode 100644 index 00000000000..6eb95edb4fa --- /dev/null +++ b/compiler/testData/ir/irText/expressions/values.kt.txt @@ -0,0 +1,76 @@ +enum class Enum : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + A init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): Enum /* Synthetic body for ENUM_VALUEOF */ + +} + +object A { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +val a: Int + field = 0 + get + +class Z { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + companion object Companion { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + } + + + + +} + +fun test1(): Enum { + return Enum +} + +fun test2(): A { + return A +} + +fun test3(): Int { + return () +} + +fun test4(): Companion { + return Companion +} + diff --git a/compiler/testData/ir/irText/expressions/vararg.kt.txt b/compiler/testData/ir/irText/expressions/vararg.kt.txt new file mode 100644 index 00000000000..8b80161b75d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/vararg.kt.txt @@ -0,0 +1,12 @@ +val test1: Array + field = arrayOf() + get + +val test2: Array + field = arrayOf(elements = ["1", "2", "3"]) + get + +val test3: Array + field = arrayOf(elements = ["0", *(), *(), "4"]) + get + diff --git a/compiler/testData/ir/irText/expressions/varargWithImplicitCast.kt.txt b/compiler/testData/ir/irText/expressions/varargWithImplicitCast.kt.txt new file mode 100644 index 00000000000..0890435cbdd --- /dev/null +++ b/compiler/testData/ir/irText/expressions/varargWithImplicitCast.kt.txt @@ -0,0 +1,14 @@ +fun testScalar(a: Any): IntArray { + when { + a !is Int -> return intArrayOf() + } + return intArrayOf(elements = [a /*as Int */]) +} + +fun testSpread(a: Any): IntArray { + when { + a !is IntArray -> return intArrayOf() + } + return intArrayOf(elements = [*a /*as IntArray */]) +} + diff --git a/compiler/testData/ir/irText/expressions/variableAsFunctionCall.kt.txt b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.kt.txt new file mode 100644 index 00000000000..6ee5073ed4e --- /dev/null +++ b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.kt.txt @@ -0,0 +1,35 @@ +fun String.k(): Function0 { + return local fun (): String { + return + } + +} + +fun test1(f: Function0) { + return f.invoke() +} + +fun test2(f: @ExtensionFunctionType Function1) { + return f.invoke(p1 = "hello") +} + +fun test3(): String { + return k($receiver = "hello").invoke() +} + +fun test4(ns: String?): String? { + return { //BLOCK + val tmp1_safe_receiver: Function0? = { //BLOCK + val tmp0_safe_receiver: String? = ns + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> k($receiver = tmp0_safe_receiver) + } + } + when { + EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null + true -> tmp1_safe_receiver.invoke() + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.kt.txt b/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.kt.txt new file mode 100644 index 00000000000..06742e65472 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.kt.txt @@ -0,0 +1,24 @@ +val T.gk: Function0 + get(): Function0 { + return local fun (): T { + return + } + + } + +fun testGeneric1(x: String): String { + return ($receiver = x).invoke() +} + +val T.kt26531Val: Function0 + get(): Function0 { + return local fun (): T { + return + } + + } + +fun kt26531(): Int { + return ($receiver = 7).invoke() +} + diff --git a/compiler/testData/ir/irText/expressions/when.kt.txt b/compiler/testData/ir/irText/expressions/when.kt.txt new file mode 100644 index 00000000000..d1d46871060 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/when.kt.txt @@ -0,0 +1,67 @@ +object A { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +fun testWithSubject(x: Any?): String { + return { //BLOCK + val tmp0_subject: Any? = x + when { + EQEQ(arg0 = tmp0_subject, arg1 = null) -> "null" + EQEQ(arg0 = tmp0_subject, arg1 = A) -> "A" + tmp0_subject is String -> "String" + tmp0_subject is Number.not() -> "!Number" + contains($receiver = setOf(), element = tmp0_subject /*as Number */) -> "nothingness?" + true -> "something" + } + } +} + +fun test(x: Any?): String { + return when { + EQEQ(arg0 = x, arg1 = null) -> "null" + EQEQ(arg0 = x, arg1 = A) -> "A" + x is String -> "String" + x !is Number -> "!Number" + contains($receiver = setOf(), element = x /*as Number */) -> "nothingness?" + true -> "something" + } +} + +fun testComma(x: Int): String { + return { //BLOCK + val tmp0_subject: Int = x + when { + when { + when { + when { + EQEQ(arg0 = tmp0_subject, arg1 = 1) -> true + true -> EQEQ(arg0 = tmp0_subject, arg1 = 2) + } -> true + true -> EQEQ(arg0 = tmp0_subject, arg1 = 3) + } -> true + true -> EQEQ(arg0 = tmp0_subject, arg1 = 4) + } -> "1234" + when { + when { + EQEQ(arg0 = tmp0_subject, arg1 = 5) -> true + true -> EQEQ(arg0 = tmp0_subject, arg1 = 6) + } -> true + true -> EQEQ(arg0 = tmp0_subject, arg1 = 7) + } -> "567" + when { + EQEQ(arg0 = tmp0_subject, arg1 = 8) -> true + true -> EQEQ(arg0 = tmp0_subject, arg1 = 9) + } -> "89" + true -> "?" + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/whenCoercedToUnit.kt.txt b/compiler/testData/ir/irText/expressions/whenCoercedToUnit.kt.txt new file mode 100644 index 00000000000..f43dc7c7d66 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/whenCoercedToUnit.kt.txt @@ -0,0 +1,9 @@ +fun foo(x: Int) { + { //BLOCK + val tmp0_subject: Int = x + when { + EQEQ(arg0 = tmp0_subject, arg1 = 0) -> 0 /*~> Unit */ + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/whenElse.kt.txt b/compiler/testData/ir/irText/expressions/whenElse.kt.txt new file mode 100644 index 00000000000..75b6657e3a1 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/whenElse.kt.txt @@ -0,0 +1,6 @@ +fun test(): Int { + return when { + true -> 42 + } +} + diff --git a/compiler/testData/ir/irText/expressions/whenReturn.kt.txt b/compiler/testData/ir/irText/expressions/whenReturn.kt.txt new file mode 100644 index 00000000000..0a6b0fd9593 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/whenReturn.kt.txt @@ -0,0 +1,14 @@ +fun toString(grade: String): String { + { //BLOCK + val tmp0_subject: String = grade + when { + EQEQ(arg0 = tmp0_subject, arg1 = "A") -> return "Excellent" + EQEQ(arg0 = tmp0_subject, arg1 = "B") -> return "Good" + EQEQ(arg0 = tmp0_subject, arg1 = "C") -> return "Mediocre" + EQEQ(arg0 = tmp0_subject, arg1 = "D") -> return "Fair" + true -> return "Failure" + } + } + return "???" +} + diff --git a/compiler/testData/ir/irText/expressions/whenReturnUnit.kt.txt b/compiler/testData/ir/irText/expressions/whenReturnUnit.kt.txt new file mode 100644 index 00000000000..cf685aacbea --- /dev/null +++ b/compiler/testData/ir/irText/expressions/whenReturnUnit.kt.txt @@ -0,0 +1,16 @@ +fun run(block: Function0) { +} + +fun branch(x: Int) { + return run(block = local fun () { + { //BLOCK + val tmp0_subject: Int = x + when { + EQEQ(arg0 = tmp0_subject, arg1 = 1) -> TODO(reason = "1") + EQEQ(arg0 = tmp0_subject, arg1 = 2) -> TODO(reason = "2") + } + } + } +) +} + diff --git a/compiler/testData/ir/irText/expressions/whenUnusedExpression.kt.txt b/compiler/testData/ir/irText/expressions/whenUnusedExpression.kt.txt new file mode 100644 index 00000000000..48b6c1f32c2 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/whenUnusedExpression.kt.txt @@ -0,0 +1,15 @@ +fun test(b: Boolean, i: Int) { + when { + b -> { //BLOCK + { //BLOCK + val tmp0_subject: Int = i + when { + EQEQ(arg0 = tmp0_subject, arg1 = 0) -> 1 /*~> Unit */ + true -> null /*~> Unit */ + } + } + } + true -> null /*~> Unit */ + } +} + diff --git a/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.kt.txt b/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.kt.txt new file mode 100644 index 00000000000..276726d19f6 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.kt.txt @@ -0,0 +1,18 @@ +fun foo(): Any { + return 1 +} + +fun test(): Int { + return { //BLOCK + val y: Any = foo() + when { + EQEQ(arg0 = y, arg1 = 42) -> 1 + y is String -> y /*as String */.() + y is Int.not() -> 2 + 0.rangeTo(other = 10).contains(value = y /*as Int */) -> 3 + 10.rangeTo(other = 20).contains(value = y /*as Int */).not() -> 4 + true -> -1 + } + } +} + diff --git a/compiler/testData/ir/irText/expressions/whileDoWhile.kt.txt b/compiler/testData/ir/irText/expressions/whileDoWhile.kt.txt new file mode 100644 index 00000000000..ffe8dac5c36 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/whileDoWhile.kt.txt @@ -0,0 +1,50 @@ +fun test() { + var x: Int = 0 + while (less(arg0 = x, arg1 = 0)) + while (less(arg0 = x, arg1 = 5)) { //BLOCK + val tmp0: Int = x + x = tmp0.inc() + tmp0 + } /*~> Unit */ + while (less(arg0 = x, arg1 = 10)) { //BLOCK + { //BLOCK + val tmp1: Int = x + x = tmp1.inc() + tmp1 + } /*~> Unit */ + } + { //BLOCK + do while (less(arg0 = x, arg1 = 0)) + } + { //BLOCK + do{ //BLOCK + val tmp2: Int = x + x = tmp2.inc() + tmp2 + } /*~> Unit */ while (less(arg0 = x, arg1 = 15)) + } + { //BLOCK + do// COMPOSITE { + { //BLOCK + val tmp3: Int = x + x = tmp3.inc() + tmp3 + } /*~> Unit */ + // } while (less(arg0 = x, arg1 = 20)) + } +} + +fun testSmartcastInCondition() { + val a: Any? = null + when { + a is Boolean -> { //BLOCK + while (a /*as Boolean */) { //BLOCK + } + { //BLOCK + do// COMPOSITE { + // } while (a /*as Boolean */) + } + } + } +} + diff --git a/compiler/testData/ir/irText/firProblems/BaseFirBuilder.kt.txt b/compiler/testData/ir/irText/firProblems/BaseFirBuilder.kt.txt new file mode 100644 index 00000000000..e2f748eba3c --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/BaseFirBuilder.kt.txt @@ -0,0 +1,16 @@ +abstract class BaseFirBuilder { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + inline fun withCapturedTypeParameters(block: Function0): T { + return block.invoke() + } + + + + +} + diff --git a/compiler/testData/ir/irText/firProblems/FirBuilder.kt.txt b/compiler/testData/ir/irText/firProblems/FirBuilder.kt.txt new file mode 100644 index 00000000000..c635a2d1a3e --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/FirBuilder.kt.txt @@ -0,0 +1,26 @@ +open class BaseConverter : BaseFirBuilder { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + +} + +class DeclarationsConverter : BaseConverter { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + +} + diff --git a/compiler/testData/ir/irText/firProblems/deprecated.kt.txt b/compiler/testData/ir/irText/firProblems/deprecated.kt.txt new file mode 100644 index 00000000000..eae1d38ae00 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/deprecated.kt.txt @@ -0,0 +1,14 @@ +fun create(): String { + return "OK" +} + +@Deprecated(...) +fun create(s: String): String { + return create() +} + +@Deprecated(...) +fun create(b: Boolean): String { + return create() +} + diff --git a/compiler/testData/ir/irText/lambdas/anonymousFunction.kt.txt b/compiler/testData/ir/irText/lambdas/anonymousFunction.kt.txt new file mode 100644 index 00000000000..14c11affbd6 --- /dev/null +++ b/compiler/testData/ir/irText/lambdas/anonymousFunction.kt.txt @@ -0,0 +1,7 @@ +val anonymous: Function0 + field = local fun () { + println() + } + + get + diff --git a/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt b/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt new file mode 100644 index 00000000000..ad8b381ab8d --- /dev/null +++ b/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt @@ -0,0 +1,69 @@ +data class A { + constructor(x: Int, y: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + val y: Int + field = y + get + + operator fun component1(): Int { + return #x + } + + operator fun component2(): Int { + return #y + } + + fun copy(x: Int = #x, y: Int = #y): A { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "A(" + +"x=" + +#x + +", " + +"y=" + +#y + +")" + } + + override fun hashCode(): Int { + return #x.hashCode().times(other = 31).plus(other = #y.hashCode()) + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is A -> return false + } + val tmp0_other_with_cast: A = other as A + when { + EQEQ(arg0 = #x, arg1 = #x).not() -> return false + } + when { + EQEQ(arg0 = #y, arg1 = #y).not() -> return false + } + return true + } + +} + +var fn: Function1 + field = local fun (: A): Int { + val y: Int = .component2() + return 42.plus(other = y) + } + + get + set + diff --git a/compiler/testData/ir/irText/lambdas/extensionLambda.kt.txt b/compiler/testData/ir/irText/lambdas/extensionLambda.kt.txt new file mode 100644 index 00000000000..36d8b533ba2 --- /dev/null +++ b/compiler/testData/ir/irText/lambdas/extensionLambda.kt.txt @@ -0,0 +1,7 @@ +fun test1(): Int { + return run($receiver = "42", block = local fun String.(): Int { + return .() + } +) +} + diff --git a/compiler/testData/ir/irText/lambdas/justLambda.kt.txt b/compiler/testData/ir/irText/lambdas/justLambda.kt.txt new file mode 100644 index 00000000000..a5e160af1e9 --- /dev/null +++ b/compiler/testData/ir/irText/lambdas/justLambda.kt.txt @@ -0,0 +1,14 @@ +val test1: Function0 + field = local fun (): Int { + return 42 + } + + get + +val test2: Function0 + field = local fun () { + return Unit + } + + get + diff --git a/compiler/testData/ir/irText/lambdas/localFunction.kt.txt b/compiler/testData/ir/irText/lambdas/localFunction.kt.txt new file mode 100644 index 00000000000..f65d2beb7d1 --- /dev/null +++ b/compiler/testData/ir/irText/lambdas/localFunction.kt.txt @@ -0,0 +1,14 @@ +fun outer() { + var x: Int = 0 + local fun local() { + { //BLOCK + val tmp0: Int = x + x = tmp0.inc() + tmp0 + } /*~> Unit */ + } + + + local() +} + diff --git a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt new file mode 100644 index 00000000000..1a1e33cdc4e --- /dev/null +++ b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt @@ -0,0 +1,58 @@ +object A { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +object B { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +interface IFoo { + val A.foo: B + get(): B { + return B + } + + + + +} + +interface IInvoke { + operator fun B.invoke(): Int { + return 42 + } + + + + +} + +fun test(fooImpl: IFoo, invokeImpl: IInvoke) { + with(receiver = A, block = local fun A.(): Int { + return with(receiver = fooImpl, block = local fun IFoo.(): Int { + return with(receiver = invokeImpl, block = local fun IInvoke.(): Int { + return .invoke($receiver = .($receiver = )) + } +) + } +) + } +) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/lambdas/nonLocalReturn.kt.txt b/compiler/testData/ir/irText/lambdas/nonLocalReturn.kt.txt new file mode 100644 index 00000000000..04737ae5225 --- /dev/null +++ b/compiler/testData/ir/irText/lambdas/nonLocalReturn.kt.txt @@ -0,0 +1,51 @@ +fun test0() { + run(block = local fun (): Nothing { + return Unit + } +) +} + +fun test1() { + run(block = local fun () { + return Unit + } +) +} + +fun test2() { + run(block = local fun () { + return Unit + } +) +} + +fun test3() { + run(block = local fun () { + run(block = local fun (): Nothing { + return Unit + } +) + } +) +} + +fun testLrmFoo1(ints: List) { + forEach($receiver = ints, action = local fun (it: Int) { + when { + EQEQ(arg0 = it, arg1 = 0) -> return Unit + } + print(message = it) + } +) +} + +fun testLrmFoo2(ints: List) { + forEach($receiver = ints, action = local fun (it: Int) { + when { + EQEQ(arg0 = it, arg1 = 0) -> return Unit + } + print(message = it) + } +) +} + diff --git a/compiler/testData/ir/irText/lambdas/samAdapter.kt.txt b/compiler/testData/ir/irText/lambdas/samAdapter.kt.txt new file mode 100644 index 00000000000..fa3fe129201 --- /dev/null +++ b/compiler/testData/ir/irText/lambdas/samAdapter.kt.txt @@ -0,0 +1,8 @@ +fun test1() { + val hello: Runnable = local fun () { + println(message = "Hello, world!") + } + /*-> Runnable */ + hello.run() +} + diff --git a/compiler/testData/ir/irText/regressions/coercionInLoop.kt.txt b/compiler/testData/ir/irText/regressions/coercionInLoop.kt.txt new file mode 100644 index 00000000000..c748f81b178 --- /dev/null +++ b/compiler/testData/ir/irText/regressions/coercionInLoop.kt.txt @@ -0,0 +1,18 @@ +fun box(): String { + val a: DoubleArray = TODO("IrConstructorCall") + val x: DoubleIterator = a.iterator() + var i: Int = 0 + while (x.hasNext()) { //BLOCK + when { + ieee754equals(arg0 = a.get(index = i), arg1 = x.next()).not() -> return "Fail " + +i + } + { //BLOCK + val tmp0: Int = i + i = tmp0.inc() + tmp0 + } /*~> Unit */ + } + return "OK" +} + diff --git a/compiler/testData/ir/irText/regressions/integerCoercionToT.kt.txt b/compiler/testData/ir/irText/regressions/integerCoercionToT.kt.txt new file mode 100644 index 00000000000..3d8515b7bad --- /dev/null +++ b/compiler/testData/ir/irText/regressions/integerCoercionToT.kt.txt @@ -0,0 +1,50 @@ +interface CPointed { + + + +} + +inline fun CPointed.reinterpret(): T { + TODO() +} + +class CInt32VarX : CPointed { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +typealias CInt32Var = CInt32VarX +var CInt32VarX.value: T_INT + get(): T_INT { + TODO() + } + set(value: T_INT) { + } + +class IdType : CPointed { + constructor(value: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: Int + field = value + get + + + + +} + +fun foo(value: IdType, cv: CInt32VarX) { + ($receiver = cv, value = value.()) +} + diff --git a/compiler/testData/ir/irText/regressions/kt24114.kt.txt b/compiler/testData/ir/irText/regressions/kt24114.kt.txt new file mode 100644 index 00000000000..53addefba7f --- /dev/null +++ b/compiler/testData/ir/irText/regressions/kt24114.kt.txt @@ -0,0 +1,44 @@ +fun one(): Int { + return 1 +} + +fun two(): Int { + return 2 +} + +fun test1(): Int { + while (true) { //BLOCK + { //BLOCK + val tmp0_subject: Int = one() + when { + EQEQ(arg0 = tmp0_subject, arg1 = 1) -> { //BLOCK + { //BLOCK + val tmp1_subject: Int = two() + when { + EQEQ(arg0 = tmp1_subject, arg1 = 2) -> return 2 + } + } + } + true -> return 3 + } + } + } +} + +fun test2(): Int { + while (true) { //BLOCK + { //BLOCK + val tmp0_subject: Int = one() + when { + EQEQ(arg0 = tmp0_subject, arg1 = 1) -> { //BLOCK + val tmp1_subject: Int = two() + when { + EQEQ(arg0 = tmp1_subject, arg1 = 2) -> return 2 + } + } + true -> return 3 + } + } + } +} + diff --git a/compiler/testData/ir/irText/regressions/newInference/fixationOrder1.kt.txt b/compiler/testData/ir/irText/regressions/newInference/fixationOrder1.kt.txt new file mode 100644 index 00000000000..541186a002a --- /dev/null +++ b/compiler/testData/ir/irText/regressions/newInference/fixationOrder1.kt.txt @@ -0,0 +1,23 @@ +fun foo(): Function1 { + TODO() +} + +interface Inv2 { + + + +} + +fun check(x: T, y: R, f: Function1): Inv2 { + TODO() +} + +fun test(): Inv2 { + return check(x = "", y = 1, f = foo()) +} + +fun box(): String { + val x: Inv2 = test() + return "OK" +} + diff --git a/compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.kt.txt b/compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.kt.txt new file mode 100644 index 00000000000..024fd5d302a --- /dev/null +++ b/compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.kt.txt @@ -0,0 +1,23 @@ +class A { + constructor(q: Q) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val q: Q + field = q + get + + + + +} + +typealias B = A +typealias B2 = A> +fun bar() { + val b: A = TODO("IrConstructorCall") + val b2: A> = TODO("IrConstructorCall") +} + diff --git a/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.kt.txt b/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.kt.txt new file mode 100644 index 00000000000..886ee3f0599 --- /dev/null +++ b/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.kt.txt @@ -0,0 +1,7 @@ +fun problematic(lss: List>): List { + return flatMap, T?>($receiver = lss, transform = local fun (it: List): List? { + return id(v = it) /*!! List */ + } +) +} + diff --git a/compiler/testData/ir/irText/singletons/companion.kt.txt b/compiler/testData/ir/irText/singletons/companion.kt.txt new file mode 100644 index 00000000000..3b548757f67 --- /dev/null +++ b/compiler/testData/ir/irText/singletons/companion.kt.txt @@ -0,0 +1,31 @@ +class Z { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun test2() { + Companion.test() + } + + companion object Companion { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun test() { + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/singletons/enumEntry.kt.txt b/compiler/testData/ir/irText/singletons/enumEntry.kt.txt new file mode 100644 index 00000000000..30252f8a6a6 --- /dev/null +++ b/compiler/testData/ir/irText/singletons/enumEntry.kt.txt @@ -0,0 +1,20 @@ +open enum class Z : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + ENTRY init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): Z /* Synthetic body for ENUM_VALUEOF */ + +} + diff --git a/compiler/testData/ir/irText/singletons/object.kt.txt b/compiler/testData/ir/irText/singletons/object.kt.txt new file mode 100644 index 00000000000..2048f181764 --- /dev/null +++ b/compiler/testData/ir/irText/singletons/object.kt.txt @@ -0,0 +1,31 @@ +object Z { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun test() { + } + + class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun test2() { + Z.test() + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/stubs/builtinMap.kt.txt b/compiler/testData/ir/irText/stubs/builtinMap.kt.txt new file mode 100644 index 00000000000..24e6bbe40b2 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/builtinMap.kt.txt @@ -0,0 +1,10 @@ +fun Map.plus(pair: Pair): Map { + return when { + .isEmpty() -> mapOf(pair = pair) + true -> apply>($receiver = TODO("IrConstructorCall"), block = local fun LinkedHashMap.() { + .put(key = pair.(), value = pair.()) /*~> Unit */ + } +) + } +} + diff --git a/compiler/testData/ir/irText/stubs/constFromBuiltins.kt.txt b/compiler/testData/ir/irText/stubs/constFromBuiltins.kt.txt new file mode 100644 index 00000000000..93fc677192d --- /dev/null +++ b/compiler/testData/ir/irText/stubs/constFromBuiltins.kt.txt @@ -0,0 +1,4 @@ +val test: Int + field = Companion.() + get + diff --git a/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m1.kt.txt b/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m1.kt.txt new file mode 100644 index 00000000000..ccaa54f2166 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m1.kt.txt @@ -0,0 +1,25 @@ +abstract class Base { + constructor(x: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: T + field = x + get + + abstract fun foo(y: Y): T + abstract var bar: T + abstract get + abstract set + + abstract var Z.exn: T + abstract get + abstract set + + + + +} + diff --git a/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m2.kt.txt b/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m2.kt.txt new file mode 100644 index 00000000000..e53327404d9 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m2.kt.txt @@ -0,0 +1,28 @@ +class Derived1 : Base { + constructor(x: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun foo(y: Y): T { + return .() + } + + override var bar: T + field = x + override get + override set + + override var Z.exn: T + override get(): T { + return .() + } + override set(value: T) { + } + + + + +} + diff --git a/compiler/testData/ir/irText/stubs/javaConstructorWithTypeParameters.kt.txt b/compiler/testData/ir/irText/stubs/javaConstructorWithTypeParameters.kt.txt new file mode 100644 index 00000000000..9e547cac5c6 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/javaConstructorWithTypeParameters.kt.txt @@ -0,0 +1,16 @@ +fun test1(): J1 { + return TODO("IrConstructorCall") +} + +fun test2(): J1 { + return TODO("IrConstructorCall") +} + +fun test3(j1: J1): J2 { + return TODO("IrConstructorCall") +} + +fun test4(j1: J1): J2 { + return TODO("IrConstructorCall") +} + diff --git a/compiler/testData/ir/irText/stubs/javaEnum.kt.txt b/compiler/testData/ir/irText/stubs/javaEnum.kt.txt new file mode 100644 index 00000000000..b208fba4cc9 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/javaEnum.kt.txt @@ -0,0 +1,4 @@ +val test: JEnum + field = JEnum + get + diff --git a/compiler/testData/ir/irText/stubs/javaInnerClass.kt.txt b/compiler/testData/ir/irText/stubs/javaInnerClass.kt.txt new file mode 100644 index 00000000000..c516dc6d2c3 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/javaInnerClass.kt.txt @@ -0,0 +1,17 @@ +class Test1 : J { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val test: JInner + field = TODO("IrConstructorCall") + get + + + + + +} + diff --git a/compiler/testData/ir/irText/stubs/javaMethod.kt.txt b/compiler/testData/ir/irText/stubs/javaMethod.kt.txt new file mode 100644 index 00000000000..1c840c120a9 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/javaMethod.kt.txt @@ -0,0 +1,4 @@ +fun test(j: J) { + return j.bar() +} + diff --git a/compiler/testData/ir/irText/stubs/javaNestedClass.kt.txt b/compiler/testData/ir/irText/stubs/javaNestedClass.kt.txt new file mode 100644 index 00000000000..082b99ef617 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/javaNestedClass.kt.txt @@ -0,0 +1,4 @@ +fun test(jj: JJ) { + return jj.foo() +} + diff --git a/compiler/testData/ir/irText/stubs/javaStaticMethod.kt.txt b/compiler/testData/ir/irText/stubs/javaStaticMethod.kt.txt new file mode 100644 index 00000000000..7b1dbb41f68 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/javaStaticMethod.kt.txt @@ -0,0 +1,4 @@ +fun test() { + return bar() +} + diff --git a/compiler/testData/ir/irText/stubs/javaSyntheticProperty.kt.txt b/compiler/testData/ir/irText/stubs/javaSyntheticProperty.kt.txt new file mode 100644 index 00000000000..fd847fac41e --- /dev/null +++ b/compiler/testData/ir/irText/stubs/javaSyntheticProperty.kt.txt @@ -0,0 +1,4 @@ +val test: @FlexibleNullability String? + field = TODO("IrConstructorCall").getFoo() + get + diff --git a/compiler/testData/ir/irText/stubs/jdkClassSyntheticProperty.kt.txt b/compiler/testData/ir/irText/stubs/jdkClassSyntheticProperty.kt.txt new file mode 100644 index 00000000000..6c39f9962d8 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/jdkClassSyntheticProperty.kt.txt @@ -0,0 +1,5 @@ +val Class<*>.test: @FlexibleNullability Array? + get(): @FlexibleNullability Array? { + return .getDeclaredFields<@FlexibleNullability Any?>() + } + diff --git a/compiler/testData/ir/irText/stubs/kotlinInnerClass.kt.txt b/compiler/testData/ir/irText/stubs/kotlinInnerClass.kt.txt new file mode 100644 index 00000000000..9b09175f86f --- /dev/null +++ b/compiler/testData/ir/irText/stubs/kotlinInnerClass.kt.txt @@ -0,0 +1,4 @@ +fun test(inner: Inner) { + return inner.foo() +} + diff --git a/compiler/testData/ir/irText/stubs/simple.kt.txt b/compiler/testData/ir/irText/stubs/simple.kt.txt new file mode 100644 index 00000000000..136cd737001 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/simple.kt.txt @@ -0,0 +1,4 @@ +val test: Int + field = 2.plus(other = 2) + get + diff --git a/compiler/testData/ir/irText/types/abbreviatedTypes.kt.txt b/compiler/testData/ir/irText/types/abbreviatedTypes.kt.txt new file mode 100644 index 00000000000..8aaac2081fa --- /dev/null +++ b/compiler/testData/ir/irText/types/abbreviatedTypes.kt.txt @@ -0,0 +1,18 @@ +typealias I = Int +typealias L = List +fun test1(x: List): List { + return x +} + +fun test2(x: List>): List> { + return x +} + +fun test3(x: List>): List> { + return x +} + +fun test4(x: List>): List> { + return x +} + diff --git a/compiler/testData/ir/irText/types/asOnPlatformType.kt.txt b/compiler/testData/ir/irText/types/asOnPlatformType.kt.txt new file mode 100644 index 00000000000..bf2a6d538a2 --- /dev/null +++ b/compiler/testData/ir/irText/types/asOnPlatformType.kt.txt @@ -0,0 +1,17 @@ +fun test() { + val nullStr: @FlexibleNullability String? = nullString() + val nonnullStr: @FlexibleNullability String? = nonnullString() + foo<@FlexibleNullability String?>($receiver = nullStr) /*~> Unit */ + foo<@FlexibleNullability String?>($receiver = nonnullStr) /*~> Unit */ + fooN<@FlexibleNullability String?>($receiver = nullStr) /*~> Unit */ + fooN<@FlexibleNullability String?>($receiver = nonnullStr) /*~> Unit */ +} + +inline fun T.foo(): T { + return as T +} + +inline fun T.fooN(): T? { + return as T? +} + diff --git a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt new file mode 100644 index 00000000000..41a3a294579 --- /dev/null +++ b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt @@ -0,0 +1,164 @@ +@OptIn(...) +fun scopedFlow(block: @ExtensionFunctionType SuspendFunction2, Unit>): Flow { + return flow(block = local suspend fun FlowCollector.() { + val collector: FlowCollector = + flowScope(block = local suspend fun CoroutineScope.() { + block.invoke(p1 = , p2 = collector) + } +) + } +) +} + +fun Flow.onCompletion(action: @ExtensionFunctionType SuspendFunction2, @ParameterName(...) Throwable?, Unit>): Flow { + return unsafeFlow(block = local suspend fun FlowCollector.() { + val safeCollector: SafeCollector = TODO("IrConstructorCall") + invokeSafely($receiver = safeCollector, action = action) + } +) +} + +suspend fun FlowCollector.invokeSafely(action: @ExtensionFunctionType SuspendFunction2, @ParameterName(...) Throwable?, Unit>) { +} + +@OptIn(...) +inline fun unsafeFlow(crossinline block: @ExtensionFunctionType SuspendFunction1, Unit>): Flow { + TODO() +} + +@Deprecated(...) +fun Flow.onCompletion(action: SuspendFunction1<@ParameterName(...) Throwable?, Unit>): Flow { + return onCompletion($receiver = , action = local suspend fun FlowCollector.(it: Throwable?) { + action.invoke(p1 = it) + } +) +} + +private fun CoroutineScope.asFairChannel(flow: Flow<*>): ReceiveChannel { + return produce($receiver = , block = local suspend fun ProducerScope.() { + val channel: ChannelCoroutine = .() as ChannelCoroutine + collect($receiver = flow, action = local suspend fun (value: Any?) { + return channel.sendFair(element = { //BLOCK + val tmp0_elvis_lhs: Any? = value + when { + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> TODO("IrConstructorCall") + true -> tmp0_elvis_lhs + } + }) + } +) + } +) +} + +private fun CoroutineScope.asChannel(flow: Flow<*>): ReceiveChannel { + return produce($receiver = , block = local suspend fun ProducerScope.() { + collect($receiver = flow, action = local suspend fun (value: Any?) { + return .().send(e = { //BLOCK + val tmp0_elvis_lhs: Any? = value + when { + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> TODO("IrConstructorCall") + true -> tmp0_elvis_lhs + } + }) + } +) + } +) +} + +class SafeCollector : FlowCollector { + constructor(collector: FlowCollector) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + internal val collector: FlowCollector + field = collector + internal get + + override suspend fun emit(value: T) { + } + + + + +} + +@OptIn(...) +fun flow(block: @ExtensionFunctionType SuspendFunction1, Unit>): Flow { + TODO() +} + +@OptIn(...) +suspend fun flowScope(block: @ExtensionFunctionType SuspendFunction1): R { + TODO() +} + +suspend inline fun Flow.collect(crossinline action: SuspendFunction1<@ParameterName(...) T, Unit>) { +} + +open class ChannelCoroutine { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + suspend fun sendFair(element: E) { + } + + + + +} + +interface CoroutineScope { + + + +} + +interface Flow { + abstract suspend fun collect(collector: FlowCollector) + + + +} + +interface FlowCollector { + abstract suspend fun emit(value: T) + + + +} + +interface ReceiveChannel { + + + +} + +@OptIn(...) +fun CoroutineScope.produce(block: @ExtensionFunctionType SuspendFunction1, Unit>): ReceiveChannel { + TODO() +} + +interface ProducerScope : CoroutineScope, SendChannel { + abstract val channel: SendChannel + abstract get + + + + + +} + +interface SendChannel { + abstract suspend fun send(e: E) + + + +} + diff --git a/compiler/testData/ir/irText/types/coercionToUnitInLambdaReturnValue.kt.txt b/compiler/testData/ir/irText/types/coercionToUnitInLambdaReturnValue.kt.txt new file mode 100644 index 00000000000..54f08eb9099 --- /dev/null +++ b/compiler/testData/ir/irText/types/coercionToUnitInLambdaReturnValue.kt.txt @@ -0,0 +1,10 @@ +fun use(fn: Function0) { +} + +fun test() { + use(fn = local fun () { + 42 /*~> Unit */ + } +) +} + diff --git a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt new file mode 100644 index 00000000000..90607b21952 --- /dev/null +++ b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt @@ -0,0 +1,173 @@ +class Value> { + constructor(value1: T, value2: IT) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var value1: T + field = value1 + get + set + + val value2: IT + field = value2 + get + + + + +} + +interface IDelegate1 { + abstract operator fun getValue(t: T1, p: KProperty<*>): R1 + + + +} + +interface IDelegate2 { + abstract operator fun getValue(t: T2, p: KProperty<*>): R2 + + + +} + +interface IR { + abstract fun foo(): R + + + +} + +class CR : IR { + constructor(r: R) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val r: R + field = r + get + + override fun foo(): R { + return .() + } + + + + +} + +class P { + constructor(p1: P1, p2: P2) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val p1: P1 + field = p1 + get + + val p2: P2 + field = p2 + get + + + + +} + +val Value>.additionalText: P /* by */ + field = { //BLOCK + local class : IDelegate1>, P> { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun qux11(t: F11T): F11T { + return t + } + + fun > qux12(t: F12T): Any? { + return t.foo() /*as Any? */ + } + + private val Value>.deepO: Any? /* by */ + field = { //BLOCK + local class : IDelegate1>, Any?> { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override operator fun getValue(t: Value>, p: KProperty<*>): Any? { + return t.() /*as Any? */ + } + + fun qux21(t: F21T): F21T { + return t + } + + fun > qux22(t: F22T): Any? { + return t.foo() /*as Any? */ + } + + + + + } + + + TODO("IrConstructorCall") + } + private get(): Any? { + return #deepO$delegate.getValue(t = , p = ::deepO) /*as Any? */ + } + + private val Value>.deepK: Any? /* by */ + field = { //BLOCK + local class : IDelegate1>, Any?> { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override operator fun getValue(t: Value>, p: KProperty<*>): Any? { + return t.().foo() /*as Any? */ + } + + + + + } + + + TODO("IrConstructorCall") + } + private get(): Any? { + return #deepK$delegate.getValue(t = , p = ::deepK) /*as Any? */ + } + + override operator fun getValue(t: Value>, p: KProperty<*>): P { + return TODO("IrConstructorCall") + } + + + + + } + + + TODO("IrConstructorCall") + } + get(): P { + return #additionalText$delegate.getValue(t = , p = ::additionalText) + } + diff --git a/compiler/testData/ir/irText/types/genericFunWithStar.kt.txt b/compiler/testData/ir/irText/types/genericFunWithStar.kt.txt new file mode 100644 index 00000000000..74f305daa01 --- /dev/null +++ b/compiler/testData/ir/irText/types/genericFunWithStar.kt.txt @@ -0,0 +1,41 @@ +interface IBase { + + + +} + +interface IFoo : IBase { + + + +} + +interface IBar : IBase { + + + +} + +interface I where G : IFoo, G : IBar { + + + +} + +abstract class Box : IFoo, IBar where T : IFoo, T : IBar { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + abstract fun foo(tSerializer: I): I> where F : IFoo, F : IBar + fun bar(vararg serializers: I<*>): I<*> { + return .foo(tSerializer = serializers.get(index = 0)) + } + + + + +} + diff --git a/compiler/testData/ir/irText/types/genericPropertyReferenceType.kt.txt b/compiler/testData/ir/irText/types/genericPropertyReferenceType.kt.txt new file mode 100644 index 00000000000..055b8579fd4 --- /dev/null +++ b/compiler/testData/ir/irText/types/genericPropertyReferenceType.kt.txt @@ -0,0 +1,37 @@ +class C { + constructor(x: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var x: T + field = x + get + set + + + + +} + +var C.y: T + get(): T { + return .() + } + set(v: T) { + .( = v) + } + +fun use(p: KMutableProperty) { +} + +fun test1() { + use(p = ::y) +} + +fun test2(a: Any) { + a as C /*~> Unit */ + use(p = ::y) +} + diff --git a/compiler/testData/ir/irText/types/inStarProjectionInReceiverType.kt.txt b/compiler/testData/ir/irText/types/inStarProjectionInReceiverType.kt.txt new file mode 100644 index 00000000000..ff7854095ab --- /dev/null +++ b/compiler/testData/ir/irText/types/inStarProjectionInReceiverType.kt.txt @@ -0,0 +1,23 @@ +interface Foo { + abstract val x: Int + abstract get + + abstract fun foo(x: T) + + + +} + +fun Foo<*>.testReceiver(): Int { + return .() +} + +fun Foo<*>.testSmartCastOnExtensionReceiver() { + as Foo /*~> Unit */ + /*as Foo */.foo(x = "string") +} + +fun testValueParameter(vp: Foo<*>): Int { + return vp.() +} + diff --git a/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt b/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt new file mode 100644 index 00000000000..08efc161190 --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt @@ -0,0 +1,30 @@ +class In { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +fun select(x: S, y: S): S { + return x +} + +fun foo(a: Array>, b: Array>): Boolean { + return ofType($receiver = select>>(x = a, y = b).get(index = 0), y = true) +} + +inline fun In.ofType(y: Any?): Boolean { + return y is K +} + +fun test() { + val a1: Array> = arrayOf>(elements = [TODO("IrConstructorCall")]) + val a2: Array> = arrayOf>(elements = [TODO("IrConstructorCall")]) + foo(a = a1, b = a2) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt b/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt new file mode 100644 index 00000000000..68a9dff7d40 --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt @@ -0,0 +1,30 @@ +class In { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +fun select(x: S, y: S): S { + return x +} + +fun foo(a: Array>, b: Array>): Boolean { + return ofType($receiver = select>>(x = a, y = b).get(index = 0), y = true) +} + +inline fun In.ofType(y: Any?): Boolean { + return y is K +} + +fun test() { + val a1: Array> = arrayOf>(elements = [TODO("IrConstructorCall")]) + val a2: Array> = arrayOf>(elements = [TODO("IrConstructorCall")]) + foo(a = a1, b = a2) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt b/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt new file mode 100644 index 00000000000..36ffdc3287b --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt @@ -0,0 +1,53 @@ +interface A { + + + +} + +interface Foo { + + + +} + +open class B : Foo, A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +open class C : Foo, A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +fun run(fn: Function0): T { + return fn.invoke() +} + +fun foo(): Any { + return run(fn = local fun (): Any { + val mm: B = TODO("IrConstructorCall") + val nn: C = TODO("IrConstructorCall") + val c: Any = when { + true -> mm + true -> nn + } + return c + } +) +} + diff --git a/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt b/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt new file mode 100644 index 00000000000..36ffdc3287b --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt @@ -0,0 +1,53 @@ +interface A { + + + +} + +interface Foo { + + + +} + +open class B : Foo, A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +open class C : Foo, A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +fun run(fn: Function0): T { + return fn.invoke() +} + +fun foo(): Any { + return run(fn = local fun (): Any { + val mm: B = TODO("IrConstructorCall") + val nn: C = TODO("IrConstructorCall") + val c: Any = when { + true -> mm + true -> nn + } + return c + } +) +} + diff --git a/compiler/testData/ir/irText/types/intersectionType3_NI.kt.txt b/compiler/testData/ir/irText/types/intersectionType3_NI.kt.txt new file mode 100644 index 00000000000..32f1d493de0 --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType3_NI.kt.txt @@ -0,0 +1,78 @@ +interface In { + + + +} + +inline fun In.isT(): Boolean { + return is T +} + +inline fun In.asT() { + as T /*~> Unit */ +} + +fun sel(x: S, y: S): S { + return x +} + +interface A { + + + +} + +interface B { + + + +} + +interface A1 : A { + + + +} + +interface A2 : A { + + + +} + +interface Z1 : A, B { + + + +} + +interface Z2 : A, B { + + + +} + +fun testInIs1(x: In, y: In): Boolean { + return isT($receiver = sel>(x = x, y = y)) +} + +fun testInIs2(x: In, y: In): Boolean { + return isT($receiver = sel>(x = x, y = y)) +} + +fun testInIs3(x: In, y: In): Boolean { + return isT($receiver = sel>(x = x, y = y)) +} + +fun testInAs1(x: In, y: In) { + return asT($receiver = sel>(x = x, y = y)) +} + +fun testInAs2(x: In, y: In) { + return asT($receiver = sel>(x = x, y = y)) +} + +fun testInAs3(x: In, y: In) { + return asT($receiver = sel>(x = x, y = y)) +} + diff --git a/compiler/testData/ir/irText/types/intersectionType3_OI.kt.txt b/compiler/testData/ir/irText/types/intersectionType3_OI.kt.txt new file mode 100644 index 00000000000..6ea3d70446a --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType3_OI.kt.txt @@ -0,0 +1,78 @@ +interface In { + + + +} + +inline fun In.isT(): Boolean { + return is T +} + +inline fun In.asT() { + as T /*~> Unit */ +} + +fun sel(x: S, y: S): S { + return x +} + +interface A { + + + +} + +interface B { + + + +} + +interface A1 : A { + + + +} + +interface A2 : A { + + + +} + +interface Z1 : A, B { + + + +} + +interface Z2 : A, B { + + + +} + +fun testInIs1(x: In, y: In): Boolean { + return isT($receiver = sel>(x = x, y = y)) +} + +fun testInIs2(x: In, y: In): Boolean { + return isT($receiver = sel>(x = x, y = y)) +} + +fun testInIs3(x: In, y: In): Boolean { + return isT($receiver = sel>(x = x, y = y)) +} + +fun testInAs1(x: In, y: In) { + return asT($receiver = sel>(x = x, y = y)) +} + +fun testInAs2(x: In, y: In) { + return asT($receiver = sel>(x = x, y = y)) +} + +fun testInAs3(x: In, y: In) { + return asT($receiver = sel>(x = x, y = y)) +} + diff --git a/compiler/testData/ir/irText/types/kt36143.kt.txt b/compiler/testData/ir/irText/types/kt36143.kt.txt new file mode 100644 index 00000000000..c182da4f6fc --- /dev/null +++ b/compiler/testData/ir/irText/types/kt36143.kt.txt @@ -0,0 +1,4 @@ +fun Array.test(): Int { + return .() +} + diff --git a/compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.kt.txt b/compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.kt.txt new file mode 100644 index 00000000000..7c5f4680669 --- /dev/null +++ b/compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.kt.txt @@ -0,0 +1,44 @@ +interface In { + + + +} + +interface Inv { + abstract val t: T + abstract get + + + + +} + +interface Z { + abstract fun create(x: In, y: In): Inv + + + +} + +interface IA { + abstract fun foo() + + + +} + +interface IB { + abstract fun bar() + + + +} + +fun test(a: In, b: In, z: Z) { + z.create(x = a, y = b).() /*as IA */.foo() + z.create(x = a, y = b).() /*as IB */.bar() + val t: Any = z.create(x = a, y = b).() + t /*as IA */.foo() + t /*as IB */.bar() +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullability.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullability.kt.txt new file mode 100644 index 00000000000..ba76c34a25e --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullability.kt.txt @@ -0,0 +1,36 @@ +fun use(s: String) { +} + +fun testUse() { + use(s = notNullString() /*!! String */) +} + +fun testLocalVal() { + val local: String = notNullString() /*!! String */ +} + +fun testReturnValue(): String { + return notNullString() /*!! String */ +} + +val testGlobalVal: String + field = notNullString() /*!! String */ + get + +val testGlobalValGetter: String + get(): String { + return notNullString() /*!! String */ + } + +fun testJUse() { + use(s = nullString()) + use(s = notNullString()) +} + +fun testLocalVarUse() { + val ns: @FlexibleNullability String? = nullString() + use(s = ns) + val nns: String = notNullString() /*!! String */ + use(s = nns) +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt new file mode 100644 index 00000000000..415a84ae4a2 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt @@ -0,0 +1,102 @@ +fun use(x: Any, y: Any) { +} + +class P { + constructor(x: Int, y: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + val y: Int + field = y + get + + operator fun component1(): Int { + return .() + } + + operator fun component2(): Int { + return .() + } + + + + +} + +class Q { + constructor(x: T1, y: T2) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: T1 + field = x + get + + val y: T2 + field = y + get + + operator fun component1(): T1 { + return .() + } + + operator fun component2(): T2 { + return .() + } + + + + +} + +fun test1() { + // COMPOSITE { + val tmp0_container: P? = notNullP() + val x: Int = tmp0_container /*!! P */.component1() + val y: Int = tmp0_container /*!! P */.component2() + // } + use(x = x, y = y) +} + +fun test2() { + // COMPOSITE { + val tmp0_container: @FlexibleNullability Q<@NotNull(...) String?, @NotNull(...) String?>? = notNullComponents() + val x: @NotNull(...) String? = tmp0_container /*!! Q<@NotNull(...) String?, @NotNull(...) String?> */.component1() + val y: @NotNull(...) String? = tmp0_container /*!! Q<@NotNull(...) String?, @NotNull(...) String?> */.component2() + // } + use(x = x /*!! @NotNull(...) String */, y = y /*!! @NotNull(...) String */) +} + +fun test2Desugared() { + val tmp: @FlexibleNullability Q<@NotNull(...) String?, @NotNull(...) String?>? = notNullComponents() + val x: @NotNull(...) String = tmp /*!! Q<@NotNull(...) String?, @NotNull(...) String?> */.component1() /*!! @NotNull(...) String */ + val y: @NotNull(...) String = tmp /*!! Q<@NotNull(...) String?, @NotNull(...) String?> */.component2() /*!! @NotNull(...) String */ + use(x = x, y = y) +} + +fun test3() { + // COMPOSITE { + val tmp0_container: Q<@NotNull(...) String?, @NotNull(...) String?>? = notNullQAndComponents() + val x: @NotNull(...) String? = tmp0_container /*!! Q<@NotNull(...) String?, @NotNull(...) String?> */.component1() + val y: @NotNull(...) String? = tmp0_container /*!! Q<@NotNull(...) String?, @NotNull(...) String?> */.component2() + // } + use(x = x /*!! @NotNull(...) String */, y = y /*!! @NotNull(...) String */) +} + +fun test4() { + // COMPOSITE { + val tmp0_container: IndexedValue<@NotNull(...) P?> = first>($receiver = withIndex<@NotNull(...) P?>($receiver = listOfNotNull() /*!! List<@NotNull(...) P?> */)) + val x: Int = tmp0_container.component1() + val y: @NotNull(...) P? = tmp0_container.component2() + // } + use(x = x, y = y /*!! @NotNull(...) P */) +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt new file mode 100644 index 00000000000..eb8bed36719 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt @@ -0,0 +1,138 @@ +fun use(s: P) { +} + +fun testForInListUnused() { + { //BLOCK + val tmp0_iterator: MutableIterator<@NotNull(...) P?> = listOfNotNull() /*!! List<@NotNull(...) P?> */ /*as MutableList<*> */.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val x: @NotNull(...) P? = tmp0_iterator.next() + { //BLOCK + } + } + } +} + +fun testForInListDestructured() { + { //BLOCK + val tmp0_iterator: MutableIterator<@NotNull(...) P?> = listOfNotNull() /*!! List<@NotNull(...) P?> */ /*as MutableList<*> */.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val tmp1_loop_parameter: @NotNull(...) P? = tmp0_iterator.next() + val x: Int = tmp1_loop_parameter /*!! @NotNull(...) P */.component1() + val y: Int = tmp1_loop_parameter /*!! @NotNull(...) P */.component2() + { //BLOCK + } + } + } +} + +fun testDesugaredForInList() { + val iterator: MutableIterator<@NotNull(...) P?> = listOfNotNull() /*!! List<@NotNull(...) P?> */ /*as MutableList<*> */.iterator() + while (iterator.hasNext()) { //BLOCK + val x: @NotNull(...) P = iterator.next() /*!! @NotNull(...) P */ + } +} + +fun testForInArrayUnused(j: J) { + { //BLOCK + val tmp0_iterator: Iterator = j.arrayOfNotNull() /*!! Array */ /*as Array */.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val x: P? = tmp0_iterator.next() + { //BLOCK + } + } + } +} + +fun testForInListUse() { + { //BLOCK + val tmp0_iterator: MutableIterator<@NotNull(...) P?> = listOfNotNull() /*!! List<@NotNull(...) P?> */ /*as MutableList<*> */.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val x: @NotNull(...) P? = tmp0_iterator.next() + { //BLOCK + use(s = x /*!! @NotNull(...) P */) + use(s = x) + } + } + } +} + +fun testForInArrayUse(j: J) { + { //BLOCK + val tmp0_iterator: Iterator = j.arrayOfNotNull() /*!! Array */ /*as Array */.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val x: P? = tmp0_iterator.next() + { //BLOCK + use(s = x /*!! P */) + use(s = x) + } + } + } +} + +interface K { + abstract fun arrayOfNotNull(): Array

+ + + +} + +data class P { + constructor(x: Int, y: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + val y: Int + field = y + get + + operator fun component1(): Int { + return #x + } + + operator fun component2(): Int { + return #y + } + + fun copy(x: Int = #x, y: Int = #y): P { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "P(" + +"x=" + +#x + +", " + +"y=" + +#y + +")" + } + + override fun hashCode(): Int { + return #x.hashCode().times(other = 31).plus(other = #y.hashCode()) + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is P -> return false + } + val tmp0_other_with_cast: P = other as P + when { + EQEQ(arg0 = #x, arg1 = #x).not() -> return false + } + when { + EQEQ(arg0 = #y, arg1 = #y).not() -> return false + } + return true + } + +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.kt.txt b/compiler/testData/ir/irText/types/nullChecks/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.kt.txt new file mode 100644 index 00000000000..a81b1bde5ee --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.kt.txt @@ -0,0 +1,24 @@ +fun JavaClass.testPlatformEqualsPlatform(): Boolean { + return .null0() /*!! Double */.equals(other = .null0()) +} + +fun JavaClass.testPlatformEqualsKotlin(): Boolean { + return .null0() /*!! Double */.equals(other = 0.0D) +} + +fun JavaClass.testKotlinEqualsPlatform(): Boolean { + return 0.0D.equals(other = .null0()) +} + +fun JavaClass.testPlatformCompareToPlatform(): Int { + return .null0() /*!! Double */.compareTo(other = .null0() /*!! Double */) +} + +fun JavaClass.testPlatformCompareToKotlin(): Int { + return .null0() /*!! Double */.compareTo(other = 0.0D) +} + +fun JavaClass.testKotlinCompareToPlatform(): Int { + return 0.0D.compareTo(other = .null0() /*!! Double */) +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.kt.txt b/compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.kt.txt new file mode 100644 index 00000000000..c99a6d62535 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.kt.txt @@ -0,0 +1,46 @@ +fun f(s: String) { +} + +class MySet : Set { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override val size: Int + override get(): Int { + TODO() + } + + override operator fun contains(element: String): Boolean { + TODO() + } + + override fun containsAll(elements: Collection): Boolean { + TODO() + } + + override fun isEmpty(): Boolean { + TODO() + } + + override operator fun iterator(): Iterator { + TODO() + } + + + + +} + +fun test() { + f(s = s() /*!! String */) + f(s = #STRING /*!! String */) +} + +fun testContains(m: MySet) { + m.contains(element = #STRING /*!! String */) /*~> Unit */ + m.contains(element = "abc") /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.kt.txt new file mode 100644 index 00000000000..4e77b4e03f0 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.kt.txt @@ -0,0 +1,26 @@ +fun String.extension() { +} + +class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun String.memberExtension() { + } + + + + +} + +fun testExt() { + extension($receiver = s() /*!! String */) +} + +fun C.testMemberExt() { + .memberExtension($receiver = s() /*!! String */) +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/platformTypeReceiver.kt.txt b/compiler/testData/ir/irText/types/nullChecks/platformTypeReceiver.kt.txt new file mode 100644 index 00000000000..f27bf404707 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/platformTypeReceiver.kt.txt @@ -0,0 +1,8 @@ +fun test1(): Boolean { + return #BOOL_NULL /*!! Boolean */.equals(other = null) +} + +fun test2(): Boolean { + return boolNull() /*!! Boolean */.equals(other = null) +} + diff --git a/compiler/testData/ir/irText/types/receiverOfIntersectionType.kt.txt b/compiler/testData/ir/irText/types/receiverOfIntersectionType.kt.txt new file mode 100644 index 00000000000..4254ac59ad9 --- /dev/null +++ b/compiler/testData/ir/irText/types/receiverOfIntersectionType.kt.txt @@ -0,0 +1,73 @@ +interface K { + + + +} + +interface I : K { + abstract fun ff() + + + +} + +interface J : K { + + + +} + +class A : I, J { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun ff() { + } + + + + +} + +class B : I, J { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun ff() { + } + + + + +} + +fun testIntersection(a: A, b: B) { + val v: K = when { + true -> a + true -> b + } + v /*as I */.ff() +} + +fun testFlexible1() { + val v: @FlexibleNullability K? = when { + true -> a() + true -> b() + } + v /*!! K */ /*as I */.ff() +} + +fun testFlexible2(a: A, b: B) { + val v: @FlexibleNullability K? = when { + true -> id<@FlexibleNullability A?>(x = a) + true -> id<@FlexibleNullability B?>(x = b) + } + v /*!! K */ /*as I */.ff() +} + diff --git a/compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.kt.txt b/compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.kt.txt new file mode 100644 index 00000000000..471272e1d2d --- /dev/null +++ b/compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.kt.txt @@ -0,0 +1,102 @@ +open class A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun f(): Int { + return 1 + } + + val aVal: Int + field = 42 + get + + fun testA1(x: Any): Int? { + return when { + x is B -> x /*as B */.f() + true -> null + } + } + + fun testA2(x: Any): Int? { + return when { + x is B -> x /*as B */.() + true -> null + } + } + + + + +} + +class B : A { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun testB1(x: Any): Int? { + return when { + x is B -> x /*as B */.f() + true -> null + } + } + + fun testB2(x: Any): Int? { + return when { + x is B -> x /*as B */.() + true -> null + } + } + + + + + + + +} + +open class GA { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun f(): Int { + return 1 + } + + val aVal: Int + field = 42 + get + + + + +} + +class GB : GA { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun testGB1(a: Any) { + a as GB /*~> Unit */ + a /*as GB<*, *> */.f() /*~> Unit */ + a /*as GB<*, *> */.() /*~> Unit */ + } + + + + + +} + diff --git a/compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.kt.txt b/compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.kt.txt new file mode 100644 index 00000000000..bffe9e72a4c --- /dev/null +++ b/compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.kt.txt @@ -0,0 +1,11 @@ +fun testSetField(a: Any, b: Any) { + a as JCell /*~> Unit */ + b as String /*~> Unit */ + #value = b /*as String */ +} + +fun testGetField(a: Any): String { + a as JCell /*~> Unit */ + return #value /*!! String */ +} + diff --git a/compiler/testData/ir/irText/types/smartCastOnReceiverOfGenericType.kt.txt b/compiler/testData/ir/irText/types/smartCastOnReceiverOfGenericType.kt.txt new file mode 100644 index 00000000000..248bec9ca42 --- /dev/null +++ b/compiler/testData/ir/irText/types/smartCastOnReceiverOfGenericType.kt.txt @@ -0,0 +1,69 @@ +fun testFunction(a: Any, b: Any) { + a as MutableList /*~> Unit */ + b as String /*~> Unit */ + a /*as MutableList */.add(element = b /*as String */) /*~> Unit */ +} + +fun testProperty(a: Any, b: Any) { + a as Cell /*~> Unit */ + b as String /*~> Unit */ + a /*as Cell */.( = b /*as String */) +} + +fun testInnerClass(a: Any, b: Any, c: Any) { + a as Inner /*~> Unit */ + b as Int /*~> Unit */ + c as String /*~> Unit */ + a /*as Inner */.use(x1 = b /*as Int */, x2 = c /*as String */) +} + +fun testNonSubstitutedTypeParameter(a: Any, b: Any) { + a as MutableList> /*~> Unit */ + b as List /*~> Unit */ + a /*as MutableList> */.add(element = b /*as List */) /*~> Unit */ +} + +class Cell { + constructor(value: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var value: T + field = value + get + set + + + + +} + +class Outer { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + inner class Inner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun use(x1: T1, x2: T2) { + } + + + + + } + + + + +} + diff --git a/compiler/testData/ir/irText/types/starProjection_OI.kt.txt b/compiler/testData/ir/irText/types/starProjection_OI.kt.txt new file mode 100644 index 00000000000..9b36f3fef33 --- /dev/null +++ b/compiler/testData/ir/irText/types/starProjection_OI.kt.txt @@ -0,0 +1,19 @@ +interface Continuation { + + + +} + +abstract class C { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + abstract fun dispatchResumeWithException(exception: Throwable, continuation: Continuation<*>): Boolean + + + +} + From 7abd09ce96cf91d0ea3861a42db980fb4acb6a0a Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Thu, 5 Nov 2020 02:48:10 +0300 Subject: [PATCH 128/698] [IR] initial version of dumpKotlinLike --- .../kotlin/ir/util/KotlinLikeDumper.kt | 1102 +++++++++++++++++ 1 file changed, 1102 insertions(+) create mode 100644 compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt new file mode 100644 index 00000000000..2c924036079 --- /dev/null +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -0,0 +1,1102 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.ir.util + +import org.jetbrains.kotlin.descriptors.ClassKind +import org.jetbrains.kotlin.descriptors.Modality +import org.jetbrains.kotlin.descriptors.Visibilities +import org.jetbrains.kotlin.descriptors.Visibility +import org.jetbrains.kotlin.ir.IrElement +import org.jetbrains.kotlin.ir.declarations.* +import org.jetbrains.kotlin.ir.expressions.* +import org.jetbrains.kotlin.ir.types.* +import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid +import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid +import org.jetbrains.kotlin.ir.visitors.acceptVoid +import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.types.Variance +import org.jetbrains.kotlin.utils.Printer +// TODO look at +// IrSourcePrinter.kt -- androidx-master-dev/frameworks/support/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/IrSourcePrinter.kt +// DumpIrTree.kt -- compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DumpIrTree.kt +// RenderIrElement.kt -- + +/* TODO + * origin : class, function, property, ... + * don't print any members in interfaces? // or just print something like /* Any members */ + * @(...) Function2 // (...) -> ... + * IrEnumEntryImpl + * replace `if (cond) p.printWithNoIndent(something)` with `p(cond, something)` + * use FQNs? + * don't print coercion to Unit on top level? blocks? + * name & ordinal in enums + * special render for accessors? + * FlexibleNullability + * ExtensionFunctionType + * don't crash on unbound symbols + * unique ids for symbols, or SignatureID? + * "normalize" names for tmps? + */ + +fun IrElement.dumpKotlinLike(options: KotlinLikeDumpOptions = KotlinLikeDumpOptions()): String { + val sb = StringBuilder() + acceptVoid(KotlinLikeDumper(Printer(sb, " "), options)) + return sb.toString() +} + +class KotlinLikeDumpOptions( + val printRegionsPerFile: Boolean = false, + val printFileName: Boolean = true, + val printFilePath: Boolean = true, + val useNamedArguments: Boolean = false, + val labelStrategy: LabelPrintingStrategy = LabelPrintingStrategy.NEVER, + val printFakeOverridesStrategy: FakeOverridesStrategy = FakeOverridesStrategy.ALL, + /* + visibility? + modality + special names? + print fake overrides + omit local visibility? + print body for default accessors + print get/set for default accessors + print type of expressions + ability to omit all or part of types for local variables + omit IrSyntheticBody? or even whole declaration + */ +) + +enum class LabelPrintingStrategy { + NEVER, + ALWAYS, + SMART // WHEN_REQUIRED +} + +enum class FakeOverridesStrategy { + ALL, + ALL_EXCEPT_ANY, + NONE +} + +private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOptions) : IrElementVisitorVoid { + override fun visitElement(element: IrElement) { + val e = "/* ERROR: unsupported element type: " + element.javaClass.simpleName + " */" + if (element is IrExpression) { + // TODO message? + // TODO better process expressions and statements + p.printlnWithNoIndent("error(\"\") $e") + } else { + p.println(e) + } + } + + override fun visitModuleFragment(declaration: IrModuleFragment) { + declaration.acceptChildrenVoid(this) + } + + override fun visitFile(declaration: IrFile) { + if (options.printRegionsPerFile) p.println("//region block: ${declaration.name}") + + if (options.printFileName) p.println("// FILE: ${declaration.name}") + if (options.printFilePath) p.println("// path: ${declaration.path}") + declaration.printlnAnnotations("file") + val packageFqName = declaration.packageFragmentDescriptor.fqName + if (!packageFqName.isRoot) { + p.println("package ${packageFqName.asString()}") + } + if (!p.isEmpty) p.printlnWithNoIndent() + + declaration.declarations.forEach { it.acceptVoid(this) } + + if (options.printRegionsPerFile) p.println("//endregion") + } + + override fun visitClass(declaration: IrClass) { + // TODO omit super class for enums, annotations? + // TODO omit Companion name for companion objects? + // TODO thisReceiver + // TODO primary constructor? + + declaration.printlnAnnotations() + p.print("") + + declaration.run { + printModifiersWithNoIndent( + visibility, + isExpect, + modality, + isExternal, + isOverride = INAPPLICABLE, + isFakeOverride = INAPPLICABLE, + isLateinit = INAPPLICABLE, + isTailrec = INAPPLICABLE, + isVararg = INAPPLICABLE, + isSuspend = INAPPLICABLE, + isInner, + isInline, + isData, + isCompanion, + isFun, + kind, + isInfix = INAPPLICABLE, + isOperator = INAPPLICABLE, + isInterfaceMember = INAPPLICABLE + ) + } + + p.printWithNoIndent(declaration.name.asString()) + + declaration.printTypeParametersWithNoIndent() + if (declaration.superTypes.isNotEmpty()) { + var first = true + for (type in declaration.superTypes) { + if (type.isAny()) continue + + if (!first) { + p.printWithNoIndent(", ") + } else { + p.printWithNoIndent(" : ") + first = false + } + + type.printTypeWithNoIndent() + } + + } + + declaration.printWhereClauseIfNeededWithNoIndent() + + p.printlnWithNoIndent(" {") + p.pushIndent() + + declaration.declarations.forEach { it.acceptVoid(this) } + + p.popIndent() + p.println("}") + p.printlnWithNoIndent() + } + + private fun IrFunction.printValueParametersWithNoIndent() { + p.printWithNoIndent("(") + var first = true + valueParameters.forEach { + if (!first) { + p.printWithNoIndent(", ") + } else { + first = false + } + + printParameterModifiersWithNoIndent( + isVararg = it.varargElementType != null, + it.isCrossinline, + it.isNoinline, + ) + + p.printWithNoIndent(it.name.asString()) + p.printWithNoIndent(": ") + (it.varargElementType ?: it.type).printTypeWithNoIndent() + // TODO print it.type too for varargs? + + it.defaultValue?.let { v -> + p.printWithNoIndent(" = ") + v.acceptVoid(this@KotlinLikeDumper) + } + } + p.printWithNoIndent(")") + } + + private fun IrTypeParametersContainer.printWhereClauseIfNeededWithNoIndent() { + if (typeParameters.none { it.superTypes.size > 1 }) return + + p.printWithNoIndent(" where ") + + var first = true + typeParameters.forEach { + if (it.superTypes.size > 1) { + it.superTypes.forEach { superType -> + if (!first) { + p.printWithNoIndent(", ") + } else { + first = false + } + + p.printWithNoIndent(it.name.asString()) + p.printWithNoIndent(" : ") + superType.printTypeWithNoIndent() + } + } + } + } + + private fun IrTypeParametersContainer.printTypeParametersWithNoIndent(postfix: String = "") { + if (typeParameters.isEmpty()) return + + p.printWithNoIndent("<") + var first = true + // TODO no commas in some types + typeParameters.forEach { + if (!first) { + p.printWithNoIndent(", ") + } else { + first = false + } + + it.variance.printVarianceWithNoIndent() + if (it.isReified) p.printWithNoIndent("reified ") + + it.printAnnotationsWithNoIndent() + + p.printWithNoIndent(it.name.asString()) + + if (it.superTypes.size == 1) { + p.printWithNoIndent(" : ") + it.superTypes.single().printTypeWithNoIndent() + } + } + p.printWithNoIndent(">") + p.printWithNoIndent(postfix) + } + + private fun Variance.printVarianceWithNoIndent() { + if (this != Variance.INVARIANT) { + p.printWithNoIndent("$label ") + } + } + + private fun IrConstructorCall.printAnAnnotationWithNoIndent(prefix: String = "") { + val clazz = symbol.owner.parentAsClass + assert(clazz.isAnnotationClass) + // TODO render arguments / reuse visitCall or visitConstructorCall + p.printWithNoIndent("@" + (if (prefix.isEmpty()) "" else "$prefix:") + clazz.name.asString()) + if (valueArgumentsCount > 0) p.printWithNoIndent("(...)") + } + + private fun IrAnnotationContainer.printlnAnnotations(prefix: String = "") { + annotations.forEach { + p.print("") + it.printAnAnnotationWithNoIndent(prefix) + p.printlnWithNoIndent() + } + } + + private fun IrAnnotationContainer.printAnnotationsWithNoIndent() { + annotations.forEach { + it.printAnAnnotationWithNoIndent() + p.printWithNoIndent(" ") + } + } + + private fun IrType.printTypeWithNoIndent() { + // TODO don't print `Any?` upper bound? + printAnnotationsWithNoIndent() + when (this) { + is IrSimpleType -> { + // TODO abbreviation + + p.printWithNoIndent((classifier.owner as IrDeclarationWithName).name.asString()) + + if (arguments.isNotEmpty()) { + p.printWithNoIndent("<") + var first = true + arguments.forEach { + if (!first) { + p.printWithNoIndent(", ") + } else { + first = false + } + + when(it) { + is IrStarProjection -> + p.printWithNoIndent("*") + is IrTypeProjection -> { + it.variance.printVarianceWithNoIndent() + it.type.printTypeWithNoIndent() + } + } + } + p.printWithNoIndent(">") + } + + if (hasQuestionMark) p.printWithNoIndent("?") + } + is IrDynamicType -> + p.printWithNoIndent("dynamic") + is IrErrorType -> + p.printWithNoIndent("ErrorType /* ERROR */") + else -> + p.printWithNoIndent("??? /* ERROR: unknown type: ${this.javaClass.simpleName} */") + } + } + + private fun p(condition: Boolean, s: String) { + if (condition) p.printWithNoIndent("$s ") + } + + private fun p(value: T?, defaultValue: T? = null, getString: T.() -> String) { + if (value == null) return + p(value != defaultValue, value.getString()) + } + + /* + https://kotlinlang.org/docs/reference/coding-conventions.html#modifiers + Modifiers order: + public / protected / private / internal + expect / actual + final / open / abstract / sealed / const + external + override + lateinit + tailrec + vararg + suspend + inner + enum / annotation / fun // as a modifier in `fun interface` + companion + inline + infix + operator + data + */ + private fun printModifiersWithNoIndent( + visibility: Visibility, + isExpect: Boolean, + modality: Modality?, + isExternal: Boolean, + isOverride: Boolean, + isFakeOverride: Boolean, + isLateinit: Boolean, + isTailrec: Boolean, + isVararg: Boolean, + isSuspend: Boolean, + isInner: Boolean, + isInline: Boolean, + isData: Boolean, + isCompanion: Boolean, + isFunInterface: Boolean, + classKind: ClassKind?, + isInfix: Boolean, + isOperator: Boolean, + isInterfaceMember: Boolean, + ) { + printVisibility(visibility) + p(isExpect, "expect") // TODO actual? + val defaultModality = when { + isInterfaceMember || (isOverride || isFakeOverride) && modality == Modality.OPEN -> + Modality.OPEN + classKind == ClassKind.INTERFACE -> + Modality.ABSTRACT + else -> + Modality.FINAL + } + p(modality, defaultModality) { name.toLowerCase() } + p(isExternal, "external") + p(isFakeOverride, "fake") // TODO + p(isOverride, "override") + p(isLateinit, "lateinit") + p(isTailrec, "tailrec") + printParameterModifiersWithNoIndent( + isVararg, + isCrossinline = INAPPLICABLE, + isNoinline = INAPPLICABLE + ) + p(isSuspend, "suspend") + p(isInner, "inner") + p(isInline, "inline") + p(isData, "data") + p(isCompanion, "companion") + p(isFunInterface, "fun") + p(classKind) { name.toLowerCase().replace('_', ' ') } + p(isInfix, "infix") + p(isOperator, "operator") + } + + private fun printVisibility(visibility: Visibility) { + // TODO don't print visibility if it's not changed in override? + p(visibility, Visibilities.DEFAULT_VISIBILITY) { name } + } + + private fun printParameterModifiersWithNoIndent( + isVararg: Boolean, + isCrossinline: Boolean, + isNoinline: Boolean, + ) { + p(isVararg, "vararg") + p(isCrossinline, "crossinline") + p(isNoinline, "noinline") + } + + private val INAPPLICABLE = false + private val INAPPLICABLE_N = null + + override fun visitSimpleFunction(declaration: IrSimpleFunction) { + declaration.printSimpleFunction( + "fun ", + declaration.name.asString(), + printTypeParametersAndExtensionReceiver = true, + printSignatureAndBody = true + ) + p.printlnWithNoIndent() + } + + private fun IrValueParameter.printExtensionReceiverParameter() { + type.printTypeWithNoIndent() + p.printWithNoIndent(".") + } + + private fun IrSimpleFunction.printSimpleFunction( + keyword: String, + name: String, + printTypeParametersAndExtensionReceiver: Boolean, + printSignatureAndBody: Boolean + ) { + /* TODO + correspondingProperty + overridden + dispatchReceiverParameter + */ + + if (options.printFakeOverridesStrategy == FakeOverridesStrategy.NONE && isFakeOverride || + options.printFakeOverridesStrategy == FakeOverridesStrategy.ALL_EXCEPT_ANY && isFakeOverriddenFromAny() + ) { + return + } + + printlnAnnotations() + p.print("") + + run { + printModifiersWithNoIndent( + visibility, + isExpect, + modality, + isExternal, + isOverride = overriddenSymbols.isNotEmpty(), // TODO override + isFakeOverride, + isLateinit = INAPPLICABLE, + isTailrec, + isVararg = INAPPLICABLE, + isSuspend, + isInner = INAPPLICABLE, + isInline, + isData = INAPPLICABLE, + isCompanion = INAPPLICABLE, + isFunInterface = INAPPLICABLE, + classKind = INAPPLICABLE_N, + isInfix, + isOperator, + isInterfaceMember = (this@printSimpleFunction.parent as? IrClass)?.isInterface == true + ) + } + + p.printWithNoIndent(keyword) + + if (printTypeParametersAndExtensionReceiver) printTypeParametersWithNoIndent(postfix = " ") + + if (printTypeParametersAndExtensionReceiver) { + extensionReceiverParameter?.printExtensionReceiverParameter() + } + + p.printWithNoIndent(name) + + if (printSignatureAndBody) { + printValueParametersWithNoIndent() + + if (!returnType.isUnit()) { + p.printWithNoIndent(": ") + returnType.printTypeWithNoIndent() + } + printWhereClauseIfNeededWithNoIndent() + p.printWithNoIndent(" ") + + body?.acceptVoid(this@KotlinLikeDumper) + } else { + p.printlnWithNoIndent() + } + } + + override fun visitConstructor(declaration: IrConstructor) { + // TODO primary!!! + // TODO name? + // TODO is it worth to merge code for IrConstructor and IrSimpleFunction? + // TODO dispatchReceiverParameter -- outer `this` for inner classes + // TODO return type? + + declaration.printlnAnnotations() + p.print("") + + declaration.run { + printModifiersWithNoIndent( + visibility, + isExpect, + modality = INAPPLICABLE_N, + isExternal, + isOverride = INAPPLICABLE, + isFakeOverride = INAPPLICABLE, + isLateinit = INAPPLICABLE, + isTailrec = INAPPLICABLE, + isVararg = INAPPLICABLE, + isSuspend = INAPPLICABLE, + isInner = INAPPLICABLE, + isInline, + isData = INAPPLICABLE, + isCompanion = INAPPLICABLE, + isFunInterface = INAPPLICABLE, + classKind = INAPPLICABLE_N, + isInfix = INAPPLICABLE, + isOperator = INAPPLICABLE, + isInterfaceMember = INAPPLICABLE + ) + } + + p.printWithNoIndent("constructor") + declaration.printTypeParametersWithNoIndent() + declaration.printValueParametersWithNoIndent() + declaration.printWhereClauseIfNeededWithNoIndent() + p.printWithNoIndent(" ") + p(declaration.isPrimary, commentBlockH("primary")) + declaration.body?.acceptVoid(this) + p.printlnWithNoIndent() + } + + private fun commentBlock(text: String) = "/* $text */" + private fun commentBlockH(text: String) = "/* $text */" + + override fun visitProperty(declaration: IrProperty) { + if (options.printFakeOverridesStrategy == FakeOverridesStrategy.NONE && declaration.isFakeOverride) return + + declaration.printlnAnnotations() + p.print("") + + // TODO better rendering for modifiers on property and accessors + // modifiers that could be different between accessors and property have a comment + declaration.run { + printModifiersWithNoIndent( + // accessors by default have same visibility, but the can define own value + visibility, + isExpect, + modality, + isExternal, + // couldn't be different for getter, possible for set, but it's invalid kotlin + isOverride = getter?.overriddenSymbols?.isNotEmpty() == true, + isFakeOverride, + isLateinit, + isTailrec = INAPPLICABLE, + isVararg = INAPPLICABLE, + isSuspend = getter?.isSuspend == true, + isInner = INAPPLICABLE, + // could be used on property if all all accessors have same state, otherwise must be defined on each accessor + isInline = false, + isData = INAPPLICABLE, + isCompanion = INAPPLICABLE, + isFunInterface = INAPPLICABLE, + classKind = INAPPLICABLE_N, + isInfix = INAPPLICABLE, + isOperator = INAPPLICABLE, + isInterfaceMember = (declaration.parent as? IrClass)?.isInterface == true + ) + } + + // TODO don't print borrowed flags and assert that they are same with setter(???) or don't borrow? + // TODO we can omit type for set parameter + + p(declaration.isConst, "const") + p.printWithNoIndent(if (declaration.isVar) "var" else "val") + p.printWithNoIndent(" ") + + // TODO assert that typeparameters and receiver are ~same for getter ans setter + + declaration.getter?.printTypeParametersWithNoIndent(postfix = " ") + + declaration.getter?.extensionReceiverParameter?.printExtensionReceiverParameter() + + p.printWithNoIndent(declaration.name.asString()) + + declaration.getter?.returnType?.let { + p.printWithNoIndent(": ") + it.printTypeWithNoIndent() + } + + /* TODO better rendering for + * field + * isDelegated + * delegated w/o backing field + * provideDelegate + */ + + p(declaration.isDelegated, " " + commentBlock("by")) + + p.printlnWithNoIndent() + p.pushIndent() + + // TODO share code with visitField? + // TODO it's not valid kotlin + declaration.backingField?.initializer?.let { + p.print("field = ") + it.acceptVoid(this) + p.printlnWithNoIndent() + } + + // TODO generate better name for set parameter ``? + declaration.getter?.printAccessor("get") + declaration.setter?.printAccessor("set") + + p.popIndent() + p.printlnWithNoIndent() + } + + private fun IrSimpleFunction.printAccessor(s: String) { + val isDefaultAccessor = origin != IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR + printSimpleFunction("", s, printTypeParametersAndExtensionReceiver = false, printSignatureAndBody = isDefaultAccessor) + } + + override fun visitField(declaration: IrField) { + declaration.printlnAnnotations() + p.print("") + + declaration.run { + printModifiersWithNoIndent( + visibility, + isExpect = INAPPLICABLE, + modality = INAPPLICABLE_N, + isExternal, + isOverride = INAPPLICABLE, + isFakeOverride = INAPPLICABLE, + isLateinit = INAPPLICABLE, + isTailrec = INAPPLICABLE, + isVararg = INAPPLICABLE, + isSuspend = INAPPLICABLE, + isInner = INAPPLICABLE, + isInline = INAPPLICABLE, + isData = INAPPLICABLE, + isCompanion = INAPPLICABLE, + isFunInterface = INAPPLICABLE, + classKind = INAPPLICABLE_N, + isInfix = INAPPLICABLE, + isOperator = INAPPLICABLE, + isInterfaceMember = (declaration.parent as? IrClass)?.isInterface == true + ) + } + + if (declaration.isStatic || declaration.isFinal) { + p.printWithNoIndent("/*") + p(declaration.isStatic, "static") + p(declaration.isFinal, "final") + p.printWithNoIndent("field*/ ") + } + + p.printWithNoIndent(if (declaration.isFinal) "val " else "var ") + p.printWithNoIndent(declaration.name.asString() + ": ") + declaration.type.printTypeWithNoIndent() + + declaration.initializer?.let { + p.printWithNoIndent(" = ") + it.acceptVoid(this) + } + + // TODO correspondingPropertySymbol + + p.printlnWithNoIndent() + } + + override fun visitTypeAlias(declaration: IrTypeAlias) { + declaration.printlnAnnotations() + p.print("") + + printVisibility(declaration.visibility) + p(declaration.isActual, "actual") + + p.printWithNoIndent("typealias ") + p.printWithNoIndent(declaration.name.asString()) + // TODO IrDump doesn't have typeparameters + declaration.printTypeParametersWithNoIndent() + p.printWithNoIndent(" = ") + declaration.expandedType.printTypeWithNoIndent() + + p.printlnWithNoIndent() + } + + override fun visitVariable(declaration: IrVariable) { + declaration.printlnAnnotations() + p.print("") + + p(declaration.isLateinit, "lateinit") + p(declaration.isConst, "const") + declaration.run { printVariable(isVar, name, type) } + + declaration.initializer?.let { + p.printWithNoIndent(" = ") + it.acceptVoid(this) + } + } + + private fun printVariable(isVar: Boolean, name: Name, type: IrType) { + p.printWithNoIndent(if (isVar) "var" else "val") + p.printWithNoIndent(" ") + p.printWithNoIndent(name.asString()) + p.printWithNoIndent(": ") + type.printTypeWithNoIndent() + } + + override fun visitEnumEntry(declaration: IrEnumEntry) { + declaration.printlnAnnotations() + p.print("") + + // TODO correspondingClass + p.printWithNoIndent(declaration.name) + declaration.initializerExpression?.let { + // TODO better rendering for init + p.printWithNoIndent(" init = ") + it.acceptVoid(this) + } ?: p.printlnWithNoIndent() + } + + override fun visitAnonymousInitializer(declaration: IrAnonymousInitializer) { + // Looks like IrAnonymousInitializer has annotations accidentally. No tests. + declaration.printlnAnnotations() + p.print("") + + // TODO looks like there are no irText tests for isStatic flag + p(declaration.isStatic, commentBlockH("static")) + p.printWithNoIndent("init ") + declaration.body.acceptVoid(this) + + p.printlnWithNoIndent() + } + + override fun visitLocalDelegatedProperty(declaration: IrLocalDelegatedProperty) { + declaration.printlnAnnotations() + p.print("") + + // TODO think about better rendering + declaration.run { printVariable(isVar, name, type) } + + p.printlnWithNoIndent() + p.pushIndent() + + declaration.delegate.acceptVoid(this) + p.printlnWithNoIndent() + + declaration.getter.printAccessor("get") + declaration.setter?.printAccessor("set") + + p.popIndent() + p.printlnWithNoIndent() + } + + override fun visitExpressionBody(body: IrExpressionBody) { + // TODO should we print something here? + body.expression.acceptVoid(this) + } + + override fun visitBlockBody(body: IrBlockBody) { + body.printStatementContainer("{", "}") + p.printlnWithNoIndent() + } + + private fun IrStatementContainer.printStatementContainer(before: String, after: String, withIndentation: Boolean = true) { + p.printlnWithNoIndent(before) + if (withIndentation) p.pushIndent() + + statements.forEach { + if (it is IrExpression) p.printIndent() + it.acceptVoid(this@KotlinLikeDumper) + p.printlnWithNoIndent() + } + + if (withIndentation) p.popIndent() + p.print(after) + } + + override fun visitSyntheticBody(body: IrSyntheticBody) { + p.printlnWithNoIndent("/* Synthetic body for ${body.kind} */") + } + + override fun visitCall(expression: IrCall) { + val declaration = expression.symbol.owner + + expression.dispatchReceiver?.let { + it.acceptVoid(this) + p.printWithNoIndent(".") + } + + p.printWithNoIndent(declaration.name.asString()) + + if (expression.typeArgumentsCount > 0) { + p.printWithNoIndent("<") + repeat(expression.typeArgumentsCount) { + if (it > 0) { + p.printWithNoIndent(", ") + } + expression.getTypeArgument(it)!!.printTypeWithNoIndent() + } + p.printWithNoIndent(">") + } + + p.printWithNoIndent("(") + expression.extensionReceiver?.let { + // TODO + p.printWithNoIndent("\$receiver = ") + it.acceptVoid(this) + if (expression.valueArgumentsCount > 0) p.printWithNoIndent(", ") + } + + repeat(expression.valueArgumentsCount) { i -> + expression.getValueArgument(i)?.let { + if (i > 0) p.printWithNoIndent(", ") + p.printWithNoIndent(declaration.valueParameters[i].name.asString() + " = ") + it.acceptVoid(this) + } + } + + p.printWithNoIndent(")") + } + + override fun visitConstructorCall(expression: IrConstructorCall) { + // TODO + p.printWithNoIndent("TODO(\"IrConstructorCall\")") + } + + override fun visitDelegatingConstructorCall(expression: IrDelegatingConstructorCall) { + // TODO + p.printWithNoIndent("TODO(\"IrDelegatingConstructorCall\")") + } + + override fun visitEnumConstructorCall(expression: IrEnumConstructorCall) { + // TODO + p.printWithNoIndent("TODO(\"IrEnumConstructorCall\")") + } + + override fun visitFunctionExpression(expression: IrFunctionExpression) { + // TODO support + // TODO omit the name when it's possible + // TODO Is there a difference between `` and ``? + // TODO Is name of function used somehere? How it's important? + // TODO Use lambda syntax when possible + // TODO don't print visibility? + // TODO don't insert indentations, including when there are annotations + expression.function.printSimpleFunction("fun ", expression.function.name.asString(), printTypeParametersAndExtensionReceiver = true, printSignatureAndBody = true) + } + + private fun IrFieldAccessExpression.printFieldAccess() { + // TODO receiver, superQualifierSymbol? + // TODO is not valid kotlin + p.printWithNoIndent("#" + symbol.owner.name.asString()) + } + + override fun visitGetField(expression: IrGetField) { + expression.printFieldAccess() + } + + override fun visitSetField(expression: IrSetField) { + expression.printFieldAccess() + p.printWithNoIndent(" = ") + expression.value.acceptVoid(this) + } + + override fun visitReturn(expression: IrReturn) { + p.printWithNoIndent("return ") + expression.value.acceptVoid(this) + } + + override fun visitThrow(expression: IrThrow) { + p.printWithNoIndent("throw ") + expression.value.acceptVoid(this) + } + + override fun visitComposite(expression: IrComposite) { + expression.printStatementContainer("// COMPOSITE {", "// }", withIndentation = false) + } + + override fun visitBlock(expression: IrBlock) { + expression.printStatementContainer("{ //BLOCK", "}") + } + + override fun visitStringConcatenation(expression: IrStringConcatenation) { + // TODO escape? see IrTextTestCaseGenerated.Expressions#testStringTemplates + expression.arguments.forEachIndexed { i, e -> + if (i > 0) { + p.printlnWithNoIndent(" + ") + } + e.acceptVoid(this) + } + } + + override fun visitConst(expression: IrConst) { + val kind = expression.kind + + val (prefix, postfix) = when (kind) { + is IrConstKind.Null -> "" to "" + is IrConstKind.Boolean -> "" to "" + is IrConstKind.Char -> "'" to "'" + is IrConstKind.Byte -> "" to "B" + is IrConstKind.Short -> "" to "S" + is IrConstKind.Int -> "" to "" + is IrConstKind.Long -> "" to "L" + is IrConstKind.String -> "\"" to "\"" + is IrConstKind.Float -> "" to "F" + is IrConstKind.Double -> "" to "D" + } + + p.printWithNoIndent(prefix, expression.value ?: "null", postfix) + } + + override fun visitVararg(expression: IrVararg) { + p.printWithNoIndent("[") + expression.elements.forEachIndexed { i, e -> + if (i > 0) p.printWithNoIndent(", ") + e.acceptVoid(this) + } + p.printWithNoIndent("]") + } + + override fun visitSpreadElement(spread: IrSpreadElement) { + p.printWithNoIndent("*") + spread.expression.acceptVoid(this) + } + + override fun visitDeclarationReference(expression: IrDeclarationReference) { + super.visitDeclarationReference(expression) + } + + override fun visitSingletonReference(expression: IrGetSingletonValue) { + // TODO check + expression.type.printTypeWithNoIndent() + } + + override fun visitGetValue(expression: IrGetValue) { + // TODO support `this` and receiver + p.printWithNoIndent(expression.symbol.owner.name.asString()) + } + + override fun visitSetVariable(expression: IrSetVariable) { + p.printWithNoIndent(expression.symbol.owner.name.asString() + " = ") + expression.value.acceptVoid(this) + } + + override fun visitGetClass(expression: IrGetClass) { + expression.argument.acceptVoid(this) + p.printWithNoIndent("::class") + } + + override fun visitCallableReference(expression: IrCallableReference<*>) { + // TODO check + p.printWithNoIndent("::") + p.printWithNoIndent(expression.referencedName.asString()) + } + + override fun visitClassReference(expression: IrClassReference) { + // TODO use type + p.printWithNoIndent((expression.symbol.owner as IrDeclarationWithName).name.asString()) + p.printWithNoIndent("::class") + } + + override fun visitInstanceInitializerCall(expression: IrInstanceInitializerCall) { + p.println("/* InstanceInitializerCall */") + } + + override fun visitTypeOperator(expression: IrTypeOperatorCall) { + val (operator, after) = when (expression.operator) { + IrTypeOperator.CAST -> "as" to "" + IrTypeOperator.IMPLICIT_CAST -> "/*as" to " */" + IrTypeOperator.IMPLICIT_NOTNULL -> "/*!!" to " */" + IrTypeOperator.IMPLICIT_COERCION_TO_UNIT -> "/*~>" to " */" + IrTypeOperator.SAFE_CAST -> "as?" to "" + IrTypeOperator.INSTANCEOF -> "is" to "" + IrTypeOperator.NOT_INSTANCEOF -> "!is" to "" + IrTypeOperator.IMPLICIT_INTEGER_COERCION -> "/*~>" to " */" + IrTypeOperator.SAM_CONVERSION -> "/*->" to " */" + IrTypeOperator.IMPLICIT_DYNAMIC_CAST -> "/*~>" to " */" + IrTypeOperator.REINTERPRET_CAST -> "/*=>" to " */" + } + + expression.argument.acceptVoid(this) + p.printWithNoIndent(" $operator ") + expression.typeOperand.printTypeWithNoIndent() + p.printWithNoIndent(after) + + } + + override fun visitWhen(expression: IrWhen) { + p.printlnWithNoIndent("when {") + p.pushIndent() + + for (b in expression.branches) { + p.printIndent() + b.condition.acceptVoid(this) + + p.printWithNoIndent(" -> ") + + b.result.acceptVoid(this) + + p.println() + } + + p.popIndent() + p.print("}") + } + + override fun visitWhileLoop(loop: IrWhileLoop) { + p.printWithNoIndent("while (") + loop.condition.acceptVoid(this) + + p.printWithNoIndent(") ") + + loop.body?.acceptVoid(this) + } + + override fun visitDoWhileLoop(loop: IrDoWhileLoop) { + p.printWithNoIndent("do") + + loop.body?.acceptVoid(this) + + p.print("while (") + loop.condition.acceptVoid(this) + p.printWithNoIndent(")") + + } + + override fun visitTry(aTry: IrTry) { + p.printWithNoIndent("try ") + aTry.tryResult.acceptVoid(this) + p.printlnWithNoIndent() + + aTry.catches.forEach { it.acceptVoid(this) } + + aTry.finallyExpression?.let { + p.print("finally ") + it.acceptVoid(this) + } + } + + override fun visitCatch(aCatch: IrCatch) { + p.print("catch (...) ") + aCatch.result.acceptVoid(this) + p.printlnWithNoIndent() + } + + override fun visitBreak(jump: IrBreak) { + // TODO label + p.printWithNoIndent("break") + } + + override fun visitContinue(jump: IrContinue) { + // TODO label + p.printWithNoIndent("continue") + } + + override fun visitErrorDeclaration(declaration: IrErrorDeclaration) { + p.println("/* ERROR DECLARATION */") + } + + override fun visitErrorExpression(expression: IrErrorExpression) { + // TODO description + p.printWithNoIndent("error(\"\") /* ERROR EXPRESSION */") + } + + override fun visitErrorCallExpression(expression: IrErrorCallExpression) { + // TODO receiver, arguments + p.printWithNoIndent("error(\"\") /* ERROR CALL */") + } +} From 1c6c996084a644c2fcd24fb3730b4c58d5aea90a Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Thu, 5 Nov 2020 19:47:13 +0300 Subject: [PATCH 129/698] [IR] KotlinLikeDumper: fixes after rebase --- .../jetbrains/kotlin/ir/util/KotlinLikeDumper.kt | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index 2c924036079..b5cd8900a2c 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -5,10 +5,7 @@ package org.jetbrains.kotlin.ir.util -import org.jetbrains.kotlin.descriptors.ClassKind -import org.jetbrains.kotlin.descriptors.Modality -import org.jetbrains.kotlin.descriptors.Visibilities -import org.jetbrains.kotlin.descriptors.Visibility +import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.* @@ -360,7 +357,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption data */ private fun printModifiersWithNoIndent( - visibility: Visibility, + visibility: DescriptorVisibility, isExpect: Boolean, modality: Modality?, isExternal: Boolean, @@ -412,9 +409,9 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p(isOperator, "operator") } - private fun printVisibility(visibility: Visibility) { + private fun printVisibility(visibility: DescriptorVisibility) { // TODO don't print visibility if it's not changed in override? - p(visibility, Visibilities.DEFAULT_VISIBILITY) { name } + p(visibility, DescriptorVisibilities.DEFAULT_VISIBILITY) { name } } private fun printParameterModifiersWithNoIndent( @@ -970,7 +967,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printWithNoIndent(expression.symbol.owner.name.asString()) } - override fun visitSetVariable(expression: IrSetVariable) { + override fun visitSetValue(expression: IrSetValue) { p.printWithNoIndent(expression.symbol.owner.name.asString() + " = ") expression.value.acceptVoid(this) } From 3b1a6389ab240f113cfb0b17cf58aa52c9c9ec3b Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Thu, 5 Nov 2020 23:27:19 +0300 Subject: [PATCH 130/698] [IR] update testdata after rebase --- .../classes/dataClassWithArrayMembers.kt.txt | 11 ++- .../ir/irText/classes/dataClasses.kt.txt | 13 ++- .../parameters/dataClassMembers.kt.txt | 6 +- .../constructorWithAdaptedArguments.kt.txt | 1 - .../suspendConversion.kt.txt | 1 - .../withArgumentAdaptationAndReceiver.kt.txt | 2 - .../nullCheckOnGenericLambdaReturn.kt.txt | 4 +- .../sam/samConversionToGeneric.kt.txt | 4 +- ...pendConversionOnArbitraryExpression.kt.txt | 92 ++++++++++++------- .../lambdas/destructuringInLambda.kt.txt | 4 +- .../typeParametersInImplicitCast.kt.txt | 4 +- .../ir/irText/stubs/builtinMap.kt.txt | 2 +- ...ullabilityInDestructuringAssignment.kt.txt | 24 ++--- .../enhancedNullabilityInForLoop.kt.txt | 26 +++--- 14 files changed, 120 insertions(+), 74 deletions(-) diff --git a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt index 6aa615d168a..627395f11ae 100644 --- a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt +++ b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt @@ -113,7 +113,16 @@ dataClassArrayMemberToString(arg0 = #doubleArray) + } override fun hashCode(): Int { - return dataClassArrayMemberHashCode(arg0 = #stringArray).times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #charArray)).times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #booleanArray)).times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #byteArray)).times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #shortArray)).times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #intArray)).times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #longArray)).times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #floatArray)).times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #doubleArray)) + var result: Int = dataClassArrayMemberHashCode(arg0 = #stringArray) + result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #charArray)) + result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #booleanArray)) + result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #byteArray)) + result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #shortArray)) + result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #intArray)) + result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #longArray)) + result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #floatArray)) + result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #doubleArray)) + return result } override operator fun equals(other: Any?): Boolean { diff --git a/compiler/testData/ir/irText/classes/dataClasses.kt.txt b/compiler/testData/ir/irText/classes/dataClasses.kt.txt index 365ccecd75f..2f90fd974eb 100644 --- a/compiler/testData/ir/irText/classes/dataClasses.kt.txt +++ b/compiler/testData/ir/irText/classes/dataClasses.kt.txt @@ -47,7 +47,10 @@ data class Test1 { } override fun hashCode(): Int { - return #x.hashCode().times(other = 31).plus(other = #y.hashCode()).times(other = 31).plus(other = #z.hashCode()) + var result: Int = #x.hashCode() + result = result.times(other = 31).plus(other = #y.hashCode()) + result = result.times(other = 31).plus(other = #z.hashCode()) + return result } override operator fun equals(other: Any?): Boolean { @@ -181,13 +184,17 @@ data class Test3 { } override fun hashCode(): Int { - return #d.hashCode().times(other = 31).plus(other = when { + var result: Int = #d.hashCode() + result = result.times(other = 31).plus(other = when { EQEQ(arg0 = #dn, arg1 = null) -> 0 true -> #dn.hashCode() - }).times(other = 31).plus(other = #f.hashCode()).times(other = 31).plus(other = when { + }) + result = result.times(other = 31).plus(other = #f.hashCode()) + result = result.times(other = 31).plus(other = when { EQEQ(arg0 = #df, arg1 = null) -> 0 true -> #df.hashCode() }) + return result } override operator fun equals(other: Any?): Boolean { diff --git a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt index 97c51aa08c6..ebe8fb1c107 100644 --- a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt @@ -36,10 +36,12 @@ data class Test { } override fun hashCode(): Int { - return when { + var result: Int = when { EQEQ(arg0 = #x, arg1 = null) -> 0 true -> #x.hashCode() - }.times(other = 31).plus(other = #y.hashCode()) + } + result = result.times(other = 31).plus(other = #y.hashCode()) + return result } override operator fun equals(other: Any?): Boolean { diff --git a/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt index dd0c80c1529..f2c58b93104 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt @@ -58,7 +58,6 @@ fun testInnerClassConstructor(outer: Outer): Any { fun testInnerClassConstructorCapturingOuter(): Any { return use(fn = { //BLOCK - val tmp0_receiver: Outer = TODO("IrConstructorCall") local fun Outer.(p0: Int): Inner { return TODO("IrConstructorCall") } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt index 89ba234d95b..24cdb8da7dc 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt @@ -93,7 +93,6 @@ fun testWithDefaults() { fun testWithBoundReceiver() { useSuspend(fn = { //BLOCK - val tmp0_receiver: C = TODO("IrConstructorCall") local suspend fun C.bar() { receiver.bar() } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt index a1c811febbe..a81f4d2bffd 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt @@ -39,7 +39,6 @@ class Host { fun testBoundReceiverLocalVar() { var h: Host = TODO("IrConstructorCall") use(fn = { //BLOCK - val tmp0_receiver: Host = h local fun Host.withVararg(p0: Int) { receiver.withVararg(xs = [p0]) /*~> Unit */ } @@ -62,7 +61,6 @@ class Host { fun testBoundReceiverExpression() { use(fn = { //BLOCK - val tmp0_receiver: Host = TODO("IrConstructorCall") local fun Host.withVararg(p0: Int) { receiver.withVararg(xs = [p0]) /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/nullCheckOnGenericLambdaReturn.kt.txt b/compiler/testData/ir/irText/expressions/nullCheckOnGenericLambdaReturn.kt.txt index 5aaa42f70a7..d905244704e 100644 --- a/compiler/testData/ir/irText/expressions/nullCheckOnGenericLambdaReturn.kt.txt +++ b/compiler/testData/ir/irText/expressions/nullCheckOnGenericLambdaReturn.kt.txt @@ -26,7 +26,7 @@ fun test1(): @FlexibleNullability String? { } fun test2(): String { - return checkT(fn = local fun (): String? { + return checkT<@EnhancedNullability String>(fn = local fun (): @EnhancedNullability String { return nnFoo() } ) /*!! String */ @@ -40,7 +40,7 @@ fun test3(): @FlexibleNullability String? { } fun test4(): String { - return checkTAny(fn = local fun (): String? { + return checkTAny<@EnhancedNullability String>(fn = local fun (): @EnhancedNullability String { return nnFoo() } ) /*!! String */ diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.kt.txt index 6da8d3ea5da..927108ed90c 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.kt.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.kt.txt @@ -30,12 +30,12 @@ fun test5(a: Any) { } fun test6(a: Function1) { - bar(j = a /*-> @FlexibleNullability J? */) + bar<@FlexibleNullability T?>(j = a /*-> @FlexibleNullability J<@FlexibleNullability T?>? */) } fun test7(a: Any) { a as Function1 /*~> Unit */ - bar(j = a /*as Function1<@ParameterName(...) T?, T?> */ /*-> @FlexibleNullability J? */) + bar<@FlexibleNullability T?>(j = a /*as Function1<@ParameterName(...) @FlexibleNullability T?, @FlexibleNullability T?> */ /*-> @FlexibleNullability J<@FlexibleNullability T?>? */) } fun test8(efn: @ExtensionFunctionType Function1): J<@FlexibleNullability String?> { diff --git a/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt b/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt index b70dd223235..aacf697d0fe 100644 --- a/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt +++ b/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt @@ -22,129 +22,156 @@ fun produceFun(): Function0 { fun testSimple(fn: Function0) { useSuspend(sfn = { //BLOCK - local suspend fun suspendConversion0() { - fn.invoke() + local suspend fun Function0.suspendConversion0() { + callee.invoke() } + + ::suspendConversion0 }) } fun testSimpleNonVal() { useSuspend(sfn = { //BLOCK - val tmp0: Function0 = produceFun() - local suspend fun suspendConversion1() { - tmp0.invoke() + local suspend fun Function0.suspendConversion0() { + callee.invoke() } + + ::suspendConversion0 }) } fun testExtAsExt(fn: @ExtensionFunctionType Function1) { useSuspendExt(sfn = { //BLOCK - local suspend fun suspendConversion0(p0: Int) { - fn.invoke(p1 = p0) + local suspend fun @ExtensionFunctionType Function1.suspendConversion0(p0: Int) { + callee.invoke(p1 = p0) } + + ::suspendConversion0 }) } fun testExtAsSimple(fn: @ExtensionFunctionType Function1) { useSuspendArg(sfn = { //BLOCK - local suspend fun suspendConversion0(p0: Int) { - fn.invoke(p1 = p0) + local suspend fun Function1.suspendConversion0(p0: Int) { + callee.invoke(p1 = p0) } + + ::suspendConversion0 }) } fun testSimpleAsExt(fn: Function1) { useSuspendExt(sfn = { //BLOCK - local suspend fun suspendConversion0(p0: Int) { - fn.invoke(p1 = p0) + local suspend fun @ExtensionFunctionType Function1.suspendConversion0(p0: Int) { + callee.invoke(p1 = p0) } + + ::suspendConversion0 }) } fun testSimpleAsSimpleT(fn: Function1) { useSuspendArgT(sfn = { //BLOCK - local suspend fun suspendConversion0(p0: Int) { - fn.invoke(p1 = p0) + local suspend fun Function1.suspendConversion0(p0: Int) { + callee.invoke(p1 = p0) } + + ::suspendConversion0 }) } fun testSimpleAsExtT(fn: Function1) { useSuspendExtT(sfn = { //BLOCK - local suspend fun suspendConversion0(p0: Int) { - fn.invoke(p1 = p0) + local suspend fun @ExtensionFunctionType Function1.suspendConversion0(p0: Int) { + callee.invoke(p1 = p0) } + + ::suspendConversion0 }) } fun testExtAsSimpleT(fn: @ExtensionFunctionType Function1) { useSuspendArgT(sfn = { //BLOCK - local suspend fun suspendConversion0(p0: Int) { - fn.invoke(p1 = p0) + local suspend fun Function1.suspendConversion0(p0: Int) { + callee.invoke(p1 = p0) } + + ::suspendConversion0 }) } fun testExtAsExtT(fn: @ExtensionFunctionType Function1) { useSuspendExtT(sfn = { //BLOCK - local suspend fun suspendConversion0(p0: Int) { - fn.invoke(p1 = p0) + local suspend fun @ExtensionFunctionType Function1.suspendConversion0(p0: Int) { + callee.invoke(p1 = p0) } + + ::suspendConversion0 }) } fun testSimpleSAsSimpleT(fn: Function1) { useSuspendArgT(sfn = { //BLOCK - local suspend fun suspendConversion0(p0: S) { - fn.invoke(p1 = p0) + local suspend fun Function1.suspendConversion0(p0: S) { + callee.invoke(p1 = p0) } + + ::suspendConversion0 }) } fun testSimpleSAsExtT(fn: Function1) { useSuspendExtT(sfn = { //BLOCK - local suspend fun suspendConversion0(p0: S) { - fn.invoke(p1 = p0) + local suspend fun @ExtensionFunctionType Function1.suspendConversion0(p0: S) { + callee.invoke(p1 = p0) } + + ::suspendConversion0 }) } fun testExtSAsSimpleT(fn: @ExtensionFunctionType Function1) { useSuspendArgT(sfn = { //BLOCK - local suspend fun suspendConversion0(p0: S) { - fn.invoke(p1 = p0) + local suspend fun Function1.suspendConversion0(p0: S) { + callee.invoke(p1 = p0) } + + ::suspendConversion0 }) } fun testExtSAsExtT(fn: @ExtensionFunctionType Function1) { useSuspendExtT(sfn = { //BLOCK - local suspend fun suspendConversion0(p0: S) { - fn.invoke(p1 = p0) + local suspend fun @ExtensionFunctionType Function1.suspendConversion0(p0: S) { + callee.invoke(p1 = p0) } + + ::suspendConversion0 }) } fun testSmartCastWithSuspendConversion(a: Any) { a as Function0 /*~> Unit */ useSuspend(sfn = { //BLOCK - local suspend fun suspendConversion0() { - a /*as Function0 */.invoke() + local suspend fun Function0.suspendConversion0() { + callee.invoke() } + + ::suspendConversion0 }) } @@ -152,11 +179,12 @@ fun testSmartCastOnVarWithSuspendConversion(a: Any) { var b: Any = a b as Function0 /*~> Unit */ useSuspend(sfn = { //BLOCK - val tmp0: Function0 = b /*as Function0 */ - local suspend fun suspendConversion1() { - tmp0.invoke() + local suspend fun Function0.suspendConversion0() { + callee.invoke() } + + ::suspendConversion0 }) } diff --git a/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt b/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt index ad8b381ab8d..eb461e9e0e7 100644 --- a/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt +++ b/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt @@ -36,7 +36,9 @@ data class A { } override fun hashCode(): Int { - return #x.hashCode().times(other = 31).plus(other = #y.hashCode()) + var result: Int = #x.hashCode() + result = result.times(other = 31).plus(other = #y.hashCode()) + return result } override operator fun equals(other: Any?): Boolean { diff --git a/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.kt.txt b/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.kt.txt index 886ee3f0599..7e9005e86ce 100644 --- a/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.kt.txt +++ b/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.kt.txt @@ -1,6 +1,6 @@ fun problematic(lss: List>): List { - return flatMap, T?>($receiver = lss, transform = local fun (it: List): List? { - return id(v = it) /*!! List */ + return flatMap, @FlexibleNullability T?>($receiver = lss, transform = local fun (it: List): @EnhancedNullability MutableList<@FlexibleNullability T?> { + return id<@FlexibleNullability T?>(v = it) /*!! List<@FlexibleNullability T?> */ } ) } diff --git a/compiler/testData/ir/irText/stubs/builtinMap.kt.txt b/compiler/testData/ir/irText/stubs/builtinMap.kt.txt index 24e6bbe40b2..00bcabf5d8c 100644 --- a/compiler/testData/ir/irText/stubs/builtinMap.kt.txt +++ b/compiler/testData/ir/irText/stubs/builtinMap.kt.txt @@ -1,7 +1,7 @@ fun Map.plus(pair: Pair): Map { return when { .isEmpty() -> mapOf(pair = pair) - true -> apply>($receiver = TODO("IrConstructorCall"), block = local fun LinkedHashMap.() { + true -> apply>($receiver = TODO("IrConstructorCall"), block = local fun LinkedHashMap<@FlexibleNullability K1?, @FlexibleNullability V1?>.() { .put(key = pair.(), value = pair.()) /*~> Unit */ } ) diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt index 415a84ae4a2..0f01555b3d5 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt @@ -59,7 +59,7 @@ class Q { fun test1() { // COMPOSITE { - val tmp0_container: P? = notNullP() + val tmp0_container: @EnhancedNullability P = notNullP() val x: Int = tmp0_container /*!! P */.component1() val y: Int = tmp0_container /*!! P */.component2() // } @@ -68,34 +68,34 @@ fun test1() { fun test2() { // COMPOSITE { - val tmp0_container: @FlexibleNullability Q<@NotNull(...) String?, @NotNull(...) String?>? = notNullComponents() - val x: @NotNull(...) String? = tmp0_container /*!! Q<@NotNull(...) String?, @NotNull(...) String?> */.component1() - val y: @NotNull(...) String? = tmp0_container /*!! Q<@NotNull(...) String?, @NotNull(...) String?> */.component2() + val tmp0_container: @FlexibleNullability Q<@NotNull(...) @EnhancedNullability String, @NotNull(...) @EnhancedNullability String>? = notNullComponents() + val x: @NotNull(...) @EnhancedNullability String = tmp0_container /*!! Q<@NotNull(...) @EnhancedNullability String, @NotNull(...) @EnhancedNullability String> */.component1() + val y: @NotNull(...) @EnhancedNullability String = tmp0_container /*!! Q<@NotNull(...) @EnhancedNullability String, @NotNull(...) @EnhancedNullability String> */.component2() // } use(x = x /*!! @NotNull(...) String */, y = y /*!! @NotNull(...) String */) } fun test2Desugared() { - val tmp: @FlexibleNullability Q<@NotNull(...) String?, @NotNull(...) String?>? = notNullComponents() - val x: @NotNull(...) String = tmp /*!! Q<@NotNull(...) String?, @NotNull(...) String?> */.component1() /*!! @NotNull(...) String */ - val y: @NotNull(...) String = tmp /*!! Q<@NotNull(...) String?, @NotNull(...) String?> */.component2() /*!! @NotNull(...) String */ + val tmp: @FlexibleNullability Q<@NotNull(...) @EnhancedNullability String, @NotNull(...) @EnhancedNullability String>? = notNullComponents() + val x: @NotNull(...) String = tmp /*!! Q<@NotNull(...) @EnhancedNullability String, @NotNull(...) @EnhancedNullability String> */.component1() /*!! @NotNull(...) String */ + val y: @NotNull(...) String = tmp /*!! Q<@NotNull(...) @EnhancedNullability String, @NotNull(...) @EnhancedNullability String> */.component2() /*!! @NotNull(...) String */ use(x = x, y = y) } fun test3() { // COMPOSITE { - val tmp0_container: Q<@NotNull(...) String?, @NotNull(...) String?>? = notNullQAndComponents() - val x: @NotNull(...) String? = tmp0_container /*!! Q<@NotNull(...) String?, @NotNull(...) String?> */.component1() - val y: @NotNull(...) String? = tmp0_container /*!! Q<@NotNull(...) String?, @NotNull(...) String?> */.component2() + val tmp0_container: @EnhancedNullability Q<@NotNull(...) @EnhancedNullability String, @NotNull(...) @EnhancedNullability String> = notNullQAndComponents() + val x: @NotNull(...) @EnhancedNullability String = tmp0_container /*!! Q<@NotNull(...) @EnhancedNullability String, @NotNull(...) @EnhancedNullability String> */.component1() + val y: @NotNull(...) @EnhancedNullability String = tmp0_container /*!! Q<@NotNull(...) @EnhancedNullability String, @NotNull(...) @EnhancedNullability String> */.component2() // } use(x = x /*!! @NotNull(...) String */, y = y /*!! @NotNull(...) String */) } fun test4() { // COMPOSITE { - val tmp0_container: IndexedValue<@NotNull(...) P?> = first>($receiver = withIndex<@NotNull(...) P?>($receiver = listOfNotNull() /*!! List<@NotNull(...) P?> */)) + val tmp0_container: IndexedValue<@NotNull(...) @EnhancedNullability P> = first>($receiver = withIndex<@NotNull(...) @EnhancedNullability P>($receiver = listOfNotNull() /*!! List<@NotNull(...) @EnhancedNullability P> */)) val x: Int = tmp0_container.component1() - val y: @NotNull(...) P? = tmp0_container.component2() + val y: @NotNull(...) @EnhancedNullability P = tmp0_container.component2() // } use(x = x, y = y /*!! @NotNull(...) P */) } diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt index eb8bed36719..d8965c05dcc 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt @@ -3,9 +3,9 @@ fun use(s: P) { fun testForInListUnused() { { //BLOCK - val tmp0_iterator: MutableIterator<@NotNull(...) P?> = listOfNotNull() /*!! List<@NotNull(...) P?> */ /*as MutableList<*> */.iterator() + val tmp0_iterator: MutableIterator<@NotNull(...) @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull(...) @EnhancedNullability P> */ /*as MutableList<*> */.iterator() while (tmp0_iterator.hasNext()) { //BLOCK - val x: @NotNull(...) P? = tmp0_iterator.next() + val x: @NotNull(...) @EnhancedNullability P = tmp0_iterator.next() { //BLOCK } } @@ -14,9 +14,9 @@ fun testForInListUnused() { fun testForInListDestructured() { { //BLOCK - val tmp0_iterator: MutableIterator<@NotNull(...) P?> = listOfNotNull() /*!! List<@NotNull(...) P?> */ /*as MutableList<*> */.iterator() + val tmp0_iterator: MutableIterator<@NotNull(...) @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull(...) @EnhancedNullability P> */ /*as MutableList<*> */.iterator() while (tmp0_iterator.hasNext()) { //BLOCK - val tmp1_loop_parameter: @NotNull(...) P? = tmp0_iterator.next() + val tmp1_loop_parameter: @NotNull(...) @EnhancedNullability P = tmp0_iterator.next() val x: Int = tmp1_loop_parameter /*!! @NotNull(...) P */.component1() val y: Int = tmp1_loop_parameter /*!! @NotNull(...) P */.component2() { //BLOCK @@ -26,7 +26,7 @@ fun testForInListDestructured() { } fun testDesugaredForInList() { - val iterator: MutableIterator<@NotNull(...) P?> = listOfNotNull() /*!! List<@NotNull(...) P?> */ /*as MutableList<*> */.iterator() + val iterator: MutableIterator<@NotNull(...) @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull(...) @EnhancedNullability P> */ /*as MutableList<*> */.iterator() while (iterator.hasNext()) { //BLOCK val x: @NotNull(...) P = iterator.next() /*!! @NotNull(...) P */ } @@ -34,9 +34,9 @@ fun testDesugaredForInList() { fun testForInArrayUnused(j: J) { { //BLOCK - val tmp0_iterator: Iterator = j.arrayOfNotNull() /*!! Array */ /*as Array */.iterator() + val tmp0_iterator: Iterator<@EnhancedNullability P> = j.arrayOfNotNull() /*!! Array */ /*as Array<@EnhancedNullability P> */.iterator() while (tmp0_iterator.hasNext()) { //BLOCK - val x: P? = tmp0_iterator.next() + val x: @EnhancedNullability P = tmp0_iterator.next() { //BLOCK } } @@ -45,9 +45,9 @@ fun testForInArrayUnused(j: J) { fun testForInListUse() { { //BLOCK - val tmp0_iterator: MutableIterator<@NotNull(...) P?> = listOfNotNull() /*!! List<@NotNull(...) P?> */ /*as MutableList<*> */.iterator() + val tmp0_iterator: MutableIterator<@NotNull(...) @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull(...) @EnhancedNullability P> */ /*as MutableList<*> */.iterator() while (tmp0_iterator.hasNext()) { //BLOCK - val x: @NotNull(...) P? = tmp0_iterator.next() + val x: @NotNull(...) @EnhancedNullability P = tmp0_iterator.next() { //BLOCK use(s = x /*!! @NotNull(...) P */) use(s = x) @@ -58,9 +58,9 @@ fun testForInListUse() { fun testForInArrayUse(j: J) { { //BLOCK - val tmp0_iterator: Iterator = j.arrayOfNotNull() /*!! Array */ /*as Array */.iterator() + val tmp0_iterator: Iterator<@EnhancedNullability P> = j.arrayOfNotNull() /*!! Array */ /*as Array<@EnhancedNullability P> */.iterator() while (tmp0_iterator.hasNext()) { //BLOCK - val x: P? = tmp0_iterator.next() + val x: @EnhancedNullability P = tmp0_iterator.next() { //BLOCK use(s = x /*!! P */) use(s = x) @@ -114,7 +114,9 @@ data class P { } override fun hashCode(): Int { - return #x.hashCode().times(other = 31).plus(other = #y.hashCode()) + var result: Int = #x.hashCode() + result = result.times(other = 31).plus(other = #y.hashCode()) + return result } override operator fun equals(other: Any?): Boolean { From a5b224fda183ecf4ac696973d187abff2fb7baed Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Thu, 5 Nov 2020 23:27:41 +0300 Subject: [PATCH 131/698] [IR] add new testdata after rebase --- .../ir/irText/classes/cloneable.kt.txt | 49 ++++++ ...egatedImplementationOfJavaInterface.kt.txt | 42 +++++ .../annotationsOnDelegatedMembers.kt.txt | 58 +++++++ .../inlineCollectionOfInlineClass.kt.txt | 115 +++++++++++++ .../exhaustiveWhenElseBranch.kt.txt | 123 ++++++++++++++ .../sam/genericSamSmartcast.kt.txt | 12 ++ .../firProblems/AbstractMutableMap.kt.txt | 40 +++++ .../irText/firProblems/AllCandidates.kt.txt | 38 +++++ .../firProblems/AnnotationInAnnotation.kt.txt | 39 +++++ .../ClashResolutionDescriptor.kt.txt | 77 +++++++++ .../irText/firProblems/DeepCopyIrTree.kt.txt | 97 +++++++++++ .../DelegationAndInheritanceFromJava.kt.txt | 62 +++++++ .../firProblems/InnerClassInAnonymous.kt.txt | 60 +++++++ .../ir/irText/firProblems/MultiList.kt.txt | 159 ++++++++++++++++++ .../SameJavaFieldReferences.kt.txt | 5 + .../irText/firProblems/SignatureClash.kt.txt | 91 ++++++++++ .../ir/irText/firProblems/VarInInit.kt.txt | 25 +++ .../irText/firProblems/candidateSymbol.kt.txt | 67 ++++++++ .../coercionToUnitForNestedWhen.kt.txt | 40 +++++ .../ir/irText/firProblems/putIfAbsent.kt.txt | 17 ++ .../irText/firProblems/v8arrayToList.kt.txt | 18 ++ .../ir/irText/types/javaWildcardType.kt.txt | 56 ++++++ .../nnStringVsT.kt.txt | 11 ++ .../nnStringVsTAny.kt.txt | 11 ++ .../nnStringVsTConstrained.kt.txt | 11 ++ .../nnStringVsTXArray.kt.txt | 11 ++ .../nnStringVsTXString.kt.txt | 11 ++ .../nullCheckOnLambdaResult/stringVsT.kt.txt | 11 ++ .../stringVsTAny.kt.txt | 11 ++ .../stringVsTConstrained.kt.txt | 11 ++ .../stringVsTXArray.kt.txt | 11 ++ .../stringVsTXString.kt.txt | 11 ++ .../ir/irText/types/rawTypeInSignature.kt.txt | 93 ++++++++++ 33 files changed, 1493 insertions(+) create mode 100644 compiler/testData/ir/irText/classes/cloneable.kt.txt create mode 100644 compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/genericSamSmartcast.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/AbstractMutableMap.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/MultiList.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/SameJavaFieldReferences.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/VarInInit.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/putIfAbsent.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/v8arrayToList.kt.txt create mode 100644 compiler/testData/ir/irText/types/javaWildcardType.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsT.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTAny.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTConstrained.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTXArray.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTXString.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsT.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTAny.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTConstrained.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXArray.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXString.kt.txt create mode 100644 compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt diff --git a/compiler/testData/ir/irText/classes/cloneable.kt.txt b/compiler/testData/ir/irText/classes/cloneable.kt.txt new file mode 100644 index 00000000000..52bc36eeb0c --- /dev/null +++ b/compiler/testData/ir/irText/classes/cloneable.kt.txt @@ -0,0 +1,49 @@ +class A : Cloneable { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + +} + +interface I : Cloneable { + + + + +} + +class C : I { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + +} + +class OC : I { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + protected override fun clone(): OC { + return TODO("IrConstructorCall") + } + + + + +} + diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt new file mode 100644 index 00000000000..3a45ad54790 --- /dev/null +++ b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt @@ -0,0 +1,42 @@ +class Test : J { + constructor(j: J) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private val j: J + field = j + private get + + @NotNull(...) + override fun returnNotNull(): @EnhancedNullability String { + return #j.returnNotNull() + } + + @Nullable(...) + override fun returnNullable(): @EnhancedNullability String? { + return #j.returnNullable() + } + + override fun returnsFlexible(): @FlexibleNullability String? { + return #j.returnsFlexible() + } + + override fun takeFlexible(x: @FlexibleNullability String?) { + #j.takeFlexible(x = x) + } + + override fun takeNotNull(x: @EnhancedNullability String) { + #j.takeNotNull(x = x) + } + + override fun takeNullable(x: @EnhancedNullability String?) { + #j.takeNullable(x = x) + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt new file mode 100644 index 00000000000..eee0a88853e --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt @@ -0,0 +1,58 @@ +annotation class Ann : Annotation { + constructor() /* primary */ + + + +} + +interface IFoo { + @Ann + abstract val testVal: String + abstract get + + @Ann + abstract fun testFun() + @Ann + abstract val String.testExtVal: String + abstract get + + @Ann + abstract fun String.testExtFun() + + + +} + +class DFoo : IFoo { + constructor(d: IFoo) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: IFoo = d + @Ann + override fun String.testExtFun() { + #$$delegate_0.testExtFun($receiver = ) + } + + @Ann + override fun testFun() { + #$$delegate_0.testFun() + } + + override val String.testExtVal: String + override get(): String { + return #$$delegate_0.($receiver = ) + } + + override val testVal: String + override get(): String { + return #$$delegate_0.() + } + + + + +} + diff --git a/compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.kt.txt b/compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.kt.txt new file mode 100644 index 00000000000..ab6ed5434a2 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.kt.txt @@ -0,0 +1,115 @@ +inline class IT { + constructor(x: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val x: Int + field = x + get + + override fun toString(): String { + return "IT(" + +"x=" + +#x + +")" + } + + override fun hashCode(): Int { + return #x.hashCode() + } + + override operator fun equals(other: Any?): Boolean { + when { + other !is IT -> return false + } + val tmp0_other_with_cast: IT = other as IT + when { + EQEQ(arg0 = #x, arg1 = #x).not() -> return false + } + return true + } + +} + +inline class InlineMutableSet : MutableSet { + constructor(ms: MutableSet) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private val ms: MutableSet + field = ms + private get + + override val size: Int + override get(): Int { + return .().() + } + + override operator fun contains(element: IT): Boolean { + return .().contains(element = element) + } + + override fun containsAll(elements: Collection): Boolean { + return .().containsAll(elements = elements) + } + + override fun isEmpty(): Boolean { + return .().isEmpty() + } + + override fun add(element: IT): Boolean { + return .().add(element = element) + } + + override fun addAll(elements: Collection): Boolean { + return .().addAll(elements = elements) + } + + override fun clear() { + .().clear() + } + + override operator fun iterator(): MutableIterator { + return .().iterator() + } + + override fun remove(element: IT): Boolean { + return .().remove(element = element) + } + + override fun removeAll(elements: Collection): Boolean { + return .().removeAll(elements = elements) + } + + override fun retainAll(elements: Collection): Boolean { + return .().retainAll(elements = elements) + } + + override fun toString(): String { + return "InlineMutableSet(" + +"ms=" + +#ms + +")" + } + + override fun hashCode(): Int { + return #ms.hashCode() + } + + override operator fun equals(other: Any?): Boolean { + when { + other !is InlineMutableSet -> return false + } + val tmp0_other_with_cast: InlineMutableSet = other as InlineMutableSet + when { + EQEQ(arg0 = #ms, arg1 = #ms).not() -> return false + } + return true + } + +} + diff --git a/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt b/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt new file mode 100644 index 00000000000..add11e0452e --- /dev/null +++ b/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt @@ -0,0 +1,123 @@ +enum class A : Enum { + private constructor() /* primary */ { + TODO("IrEnumConstructorCall") + /* InstanceInitializerCall */ + + } + + V1 init = TODO("IrEnumConstructorCall") + + + + + + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): A /* Synthetic body for ENUM_VALUEOF */ + +} + +fun testVariableAssignment_throws(a: A) { + val x: Int + { //BLOCK + val tmp0_subject: A = a + when { + EQEQ(arg0 = tmp0_subject, arg1 = A) -> x = 11 + true -> noWhenBranchMatchedException() + } + } +} + +fun testStatement_empty(a: A) { + { //BLOCK + val tmp0_subject: A = a + when { + EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */ + } + } +} + +fun testParenthesized_throwsJvm(a: A) { + { //BLOCK + val tmp0_subject: A = a + when { + EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */ + } + } +} + +fun testAnnotated_throwsJvm(a: A) { + { //BLOCK + val tmp0_subject: A = a + when { + EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */ + } + } +} + +fun testExpression_throws(a: A): Int { + return { //BLOCK + val tmp0_subject: A = a + when { + EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 + true -> noWhenBranchMatchedException() + } + } +} + +fun testIfTheElseStatement_empty(a: A, flag: Boolean) { + when { + flag -> 0 /*~> Unit */ + true -> { //BLOCK + { //BLOCK + val tmp0_subject: A = a + when { + EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */ + } + } + } + } +} + +fun testIfTheElseParenthesized_throwsJvm(a: A, flag: Boolean) { + when { + flag -> 0 /*~> Unit */ + true -> { //BLOCK + { //BLOCK + val tmp0_subject: A = a + when { + EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */ + } + } + } + } +} + +fun testIfTheElseAnnotated_throwsJvm(a: A, flag: Boolean) { + when { + flag -> 0 /*~> Unit */ + true -> { //BLOCK + { //BLOCK + val tmp0_subject: A = a + when { + EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */ + } + } + } + } +} + +fun testLambdaResultExpression_throws(a: A) { + local fun (): Int { + return { //BLOCK + val tmp0_subject: A = a + when { + EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 + true -> noWhenBranchMatchedException() + } + } + } +.invoke() /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/expressions/sam/genericSamSmartcast.kt.txt b/compiler/testData/ir/irText/expressions/sam/genericSamSmartcast.kt.txt new file mode 100644 index 00000000000..1f3d46dbcf1 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/genericSamSmartcast.kt.txt @@ -0,0 +1,12 @@ +fun f(x: Any): String { + when { + x is A<*> -> { //BLOCK + return x /*as A */.call(block = local fun (y: Any?): @FlexibleNullability String? { + return "OK" + } + /*-> @FlexibleNullability I<@FlexibleNullability T?>? */) /*!! String */ + } + } + return "Fail" +} + diff --git a/compiler/testData/ir/irText/firProblems/AbstractMutableMap.kt.txt b/compiler/testData/ir/irText/firProblems/AbstractMutableMap.kt.txt new file mode 100644 index 00000000000..f9802b6e6c8 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/AbstractMutableMap.kt.txt @@ -0,0 +1,40 @@ +class MyMap : AbstractMutableMap { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + override fun put(key: K, value: V): V? { + return null + } + + override val entries: MutableSet> + override get(): MutableSet> { + return mutableSetOf>() + } + + + + + + + + + + + + + + + + + + + + + + + +} + diff --git a/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt b/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt new file mode 100644 index 00000000000..eaff1fa52d2 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt @@ -0,0 +1,38 @@ +class ResolvedCall { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class MyCandidate { + constructor(resolvedCall: ResolvedCall<*>) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val resolvedCall: ResolvedCall<*> + field = resolvedCall + get + + + + +} + +private fun allCandidatesResult(allCandidates: Collection): @FlexibleNullability OverloadResolutionResultsImpl<@FlexibleNullability A?>? { + return apply<@FlexibleNullability OverloadResolutionResultsImpl<@FlexibleNullability A?>?>($receiver = nameNotFound<@FlexibleNullability A?>(), block = local fun @FlexibleNullability OverloadResolutionResultsImpl<@FlexibleNullability A?>?.() { + /*!! OverloadResolutionResultsImpl<@FlexibleNullability A?> */.setAllCandidates<@FlexibleNullability A?>(allCandidates = map>($receiver = allCandidates, transform = local fun (it: MyCandidate): ResolvedCall { + return it.() as ResolvedCall + } +)) + } +) +} + diff --git a/compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.kt.txt b/compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.kt.txt new file mode 100644 index 00000000000..a0ca0adc401 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.kt.txt @@ -0,0 +1,39 @@ +annotation class Storage : Annotation { + constructor(value: String) /* primary */ + val value: String + field = value + get + + + + +} + +annotation class State : Annotation { + constructor(name: String, storages: Array) /* primary */ + val name: String + field = name + get + + val storages: Array + field = storages + get + + + + +} + +@State(...) +class Test { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + diff --git a/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt new file mode 100644 index 00000000000..51444e6a76f --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt @@ -0,0 +1,77 @@ +interface ComponentContainer { + + + +} + +interface PlatformSpecificExtension> { + + + +} + +interface ComponentDescriptor { + + + +} + +abstract class PlatformExtensionsClashResolver> { + constructor(applicableTo: Class) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val applicableTo: Class + field = applicableTo + get + + + + +} + +class ClashResolutionDescriptor> { + constructor(container: ComponentContainer, resolver: PlatformExtensionsClashResolver, clashedComponents: List) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private val resolver: PlatformExtensionsClashResolver + field = resolver + private get + + private val clashedComponents: List + field = clashedComponents + private get + + + + +} + +private val registrationMap: HashMap + field = hashMapOf() + private get + +fun resolveClashesIfAny(container: ComponentContainer, clashResolvers: List>) { + { //BLOCK + val tmp0_iterator: Iterator> = clashResolvers.iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val resolver: PlatformExtensionsClashResolver<*> = tmp0_iterator.next() + { //BLOCK + val clashedComponents: Collection = { //BLOCK + val tmp1_elvis_lhs: Collection? = ().get(key = resolver.()) as? Collection + when { + EQEQ(arg0 = tmp1_elvis_lhs, arg1 = null) -> continue + true -> tmp1_elvis_lhs + } + } + val substituteDescriptor: ClashResolutionDescriptor>>>>> = TODO("IrConstructorCall") + } + } + } +} + diff --git a/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt new file mode 100644 index 00000000000..ef5e95b41a7 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt @@ -0,0 +1,97 @@ +interface IrType { + + + +} + +interface TypeRemapper { + abstract fun enterScope(irTypeParametersContainer: IrTypeParametersContainer) + abstract fun remapType(type: IrType): IrType + abstract fun leaveScope() + + + +} + +interface IrTypeParametersContainer : IrDeclaration, IrDeclarationParent { + abstract var typeParameters: List + abstract get + abstract set + + + + +} + +interface IrDeclaration { + + + +} + +interface IrTypeParameter : IrDeclaration { + abstract val superTypes: MutableList + abstract get + + + + +} + +interface IrDeclarationParent { + + + +} + +class DeepCopyIrTreeWithSymbols { + constructor(typeRemapper: TypeRemapper) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private val typeRemapper: TypeRemapper + field = typeRemapper + private get + + private fun copyTypeParameter(declaration: IrTypeParameter): IrTypeParameter { + return declaration + } + + fun IrTypeParametersContainer.copyTypeParametersFrom(other: IrTypeParametersContainer) { + .( = map($receiver = other.(), transform = local fun (it: IrTypeParameter): IrTypeParameter { + return .copyTypeParameter(declaration = it) + } +)) + withinScope($receiver = .(), irTypeParametersContainer = , fn = local fun () { + { //BLOCK + val tmp0_iterator: Iterator> = zip($receiver = .(), other = other.()).iterator() + while (tmp0_iterator.hasNext()) { //BLOCK + val tmp1_loop_parameter: Pair = tmp0_iterator.next() + val thisTypeParameter: IrTypeParameter = tmp1_loop_parameter.component1() + val otherTypeParameter: IrTypeParameter = tmp1_loop_parameter.component2() + { //BLOCK + mapTo>($receiver = otherTypeParameter.(), destination = thisTypeParameter.(), transform = local fun (it: IrType): IrType { + return .().remapType(type = it) + } +) /*~> Unit */ + } + } + } + } +) + } + + + + +} + +inline fun TypeRemapper.withinScope(irTypeParametersContainer: IrTypeParametersContainer, fn: Function0): T { + .enterScope(irTypeParametersContainer = irTypeParametersContainer) + val result: T = fn.invoke() + .leaveScope() + return result +} + diff --git a/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt new file mode 100644 index 00000000000..4587750062c --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt @@ -0,0 +1,62 @@ +class Impl : A, B { + constructor(b: B) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: B = b + override fun add(element: @FlexibleNullability String?): Boolean { + return #$$delegate_0.add(element = element) + } + + override fun addAll(elements: Collection<@FlexibleNullability String?>): Boolean { + return #$$delegate_0.addAll(elements = elements) + } + + override fun clear() { + #$$delegate_0.clear() + } + + override operator fun contains(element: @FlexibleNullability String?): Boolean { + return #$$delegate_0.contains(element = element) + } + + override fun containsAll(elements: Collection<@FlexibleNullability String?>): Boolean { + return #$$delegate_0.containsAll(elements = elements) + } + + override fun isEmpty(): Boolean { + return #$$delegate_0.isEmpty() + } + + override operator fun iterator(): MutableIterator<@FlexibleNullability String?> { + return #$$delegate_0.iterator() + } + + override fun remove(element: @FlexibleNullability String?): Boolean { + return #$$delegate_0.remove(element = element) + } + + override fun removeAll(elements: Collection<@FlexibleNullability String?>): Boolean { + return #$$delegate_0.removeAll(elements = elements) + } + + override fun retainAll(elements: Collection<@FlexibleNullability String?>): Boolean { + return #$$delegate_0.retainAll(elements = elements) + } + + override val size: Int + override get(): Int { + return #$$delegate_0.() + } + + + + +} + +fun box(): String { + return "OK" +} + diff --git a/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt b/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt new file mode 100644 index 00000000000..ac1758bf056 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt @@ -0,0 +1,60 @@ +fun box(): String { + val obj: = { //BLOCK + local class { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val end: String + field = "K" + get + + fun foo(): String { + return TODO("IrConstructorCall").bar() + } + + local inner class Some : Base { + constructor(s: String) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun bar(): String { + return .().plus(other = .()) + } + + + + + } + + local open inner class Base { + constructor(s: String) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val s: String + field = s + get + + + + + } + + + + + } + + + TODO("IrConstructorCall") + } + return obj.foo() +} + diff --git a/compiler/testData/ir/irText/firProblems/MultiList.kt.txt b/compiler/testData/ir/irText/firProblems/MultiList.kt.txt new file mode 100644 index 00000000000..d3f9d6e0079 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/MultiList.kt.txt @@ -0,0 +1,159 @@ +data class Some { + constructor(value: T) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val value: T + field = value + get + + operator fun component1(): T { + return #value + } + + fun copy(value: T = #value): Some { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "Some(" + +"value=" + +#value + +")" + } + + override fun hashCode(): Int { + return when { + EQEQ(arg0 = #value, arg1 = null) -> 0 + true -> #value.hashCode() + } + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Some -> return false + } + val tmp0_other_with_cast: Some = other as Some + when { + EQEQ(arg0 = #value, arg1 = #value).not() -> return false + } + return true + } + +} + +interface MyList : List> { + + + + + + + + + + + + + + + + + +} + +open class SomeList : MyList, ArrayList> { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +class FinalList : SomeList { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + diff --git a/compiler/testData/ir/irText/firProblems/SameJavaFieldReferences.kt.txt b/compiler/testData/ir/irText/firProblems/SameJavaFieldReferences.kt.txt new file mode 100644 index 00000000000..28599c3a714 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/SameJavaFieldReferences.kt.txt @@ -0,0 +1,5 @@ +fun foo() { + val ref1: KProperty0 = ::someJavaField + val ref2: KProperty0 = ::someJavaField +} + diff --git a/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt b/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt new file mode 100644 index 00000000000..a5ba4f95802 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt @@ -0,0 +1,91 @@ +typealias Some = Function1 +object Factory { + private constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo(a: String): String { + return "Alpha" + } + + fun foo(a: String, f: Function1): String { + return "Omega" + } + + + + +} + +interface Base { + + + +} + +interface Delegate : Base { + abstract fun bar() + + + +} + +interface Derived : Delegate { + + + + +} + +data class DataClass : Derived, Delegate { + constructor(delegate: Delegate) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val delegate: Delegate + field = delegate + get + + override fun bar() { + #delegate.bar() + } + + operator fun component1(): Delegate { + return #delegate + } + + fun copy(delegate: Delegate = #delegate): DataClass { + return TODO("IrConstructorCall") + } + + override fun toString(): String { + return "DataClass(" + +"delegate=" + +#delegate + +")" + } + + override fun hashCode(): Int { + return #delegate.hashCode() + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is DataClass -> return false + } + val tmp0_other_with_cast: DataClass = other as DataClass + when { + EQEQ(arg0 = #delegate, arg1 = #delegate).not() -> return false + } + return true + } + +} + diff --git a/compiler/testData/ir/irText/firProblems/VarInInit.kt.txt b/compiler/testData/ir/irText/firProblems/VarInInit.kt.txt new file mode 100644 index 00000000000..b0a0634a3c6 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/VarInInit.kt.txt @@ -0,0 +1,25 @@ +class Some { + constructor(foo: Int) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + var foo: Int + field = foo + get + set + + init { + when { + less(arg0 = .(), arg1 = 0) -> { //BLOCK + .( = 0) + } + } + } + + + + +} + diff --git a/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt b/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt new file mode 100644 index 00000000000..30d819580f8 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt @@ -0,0 +1,67 @@ +class Candidate { + constructor(symbol: AbstractFirBasedSymbol<*>) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + val symbol: AbstractFirBasedSymbol<*> + field = symbol + get + + + + +} + +abstract class AbstractFirBasedSymbol where E : FirSymbolOwner, E : FirDeclaration { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + lateinit var fir: E + get + set + + + + +} + +interface FirDeclaration { + + + +} + +interface FirSymbolOwner where E : FirSymbolOwner, E : FirDeclaration { + abstract val symbol: AbstractFirBasedSymbol + abstract get + + + + +} + +interface FirCallableMemberDeclaration> : FirSymbolOwner, FirDeclaration { + abstract override val symbol: AbstractFirBasedSymbol + abstract override get + + + + +} + +fun foo(candidate: Candidate) { + val me: FirSymbolOwner<*> = candidate.().() + when { + when { + me is FirCallableMemberDeclaration<*> -> EQEQ(arg0 = me /*as FirCallableMemberDeclaration> */.(), arg1 = null).not() + true -> false + } -> { //BLOCK + } + } +} + diff --git a/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt b/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt new file mode 100644 index 00000000000..8f3c59033f7 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt @@ -0,0 +1,40 @@ +private const val BACKSLASH: Char + field = '\' + private get + +private fun Reader.nextChar(): Char? { + return { //BLOCK + val tmp0_safe_receiver: Int? = takeUnless($receiver = .read(), predicate = local fun (it: Int): Boolean { + return EQEQ(arg0 = it, arg1 = -1) + } +) + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver.toChar() + } + } +} + +fun Reader.consumeRestOfQuotedSequence(sb: StringBuilder, quote: Char) { + var ch: Char? = nextChar($receiver = ) + while (when { + EQEQ(arg0 = ch, arg1 = null).not() -> EQEQ(arg0 = ch, arg1 = quote).not() + true -> false + }) { //BLOCK + when { + EQEQ(arg0 = ch, arg1 = ()) -> { //BLOCK + val tmp0_safe_receiver: Char? = nextChar($receiver = ) + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> let($receiver = tmp0_safe_receiver, block = local fun (it: Char): @FlexibleNullability StringBuilder? { + return sb.append(p0 = it) + } +) + } + } /*~> Unit */ + true -> sb.append(p0 = ch) /*~> Unit */ + } + ch = nextChar($receiver = ) + } +} + diff --git a/compiler/testData/ir/irText/firProblems/putIfAbsent.kt.txt b/compiler/testData/ir/irText/firProblems/putIfAbsent.kt.txt new file mode 100644 index 00000000000..21fba8220b0 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/putIfAbsent.kt.txt @@ -0,0 +1,17 @@ +class Owner { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + fun foo(x: T, y: T) { + val map: MutableMap = mutableMapOf() + map.putIfAbsent(p0 = x, p1 = y) /*~> Unit */ + } + + + + +} + diff --git a/compiler/testData/ir/irText/firProblems/v8arrayToList.kt.txt b/compiler/testData/ir/irText/firProblems/v8arrayToList.kt.txt new file mode 100644 index 00000000000..cc6c848bb8d --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/v8arrayToList.kt.txt @@ -0,0 +1,18 @@ +class V8Array { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +fun box(): String { + val array: V8Array = TODO("IrConstructorCall") + val list: List = toList(array = array) as List + return list.get(index = 0) +} + diff --git a/compiler/testData/ir/irText/types/javaWildcardType.kt.txt b/compiler/testData/ir/irText/types/javaWildcardType.kt.txt new file mode 100644 index 00000000000..c2b7a406202 --- /dev/null +++ b/compiler/testData/ir/irText/types/javaWildcardType.kt.txt @@ -0,0 +1,56 @@ +interface K { + abstract fun kf1(): Collection + abstract fun kf2(): Collection + abstract fun kg1(c: Collection) + abstract fun kg2(c: Collection) + + + +} + +class C : J, K { + constructor(j: J, k: K) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: J = j + override fun jf1(): @FlexibleNullability MutableCollection? { + return #$$delegate_0.jf1() + } + + override fun jf2(): @FlexibleNullability MutableCollection<@FlexibleNullability CharSequence?>? { + return #$$delegate_0.jf2() + } + + override fun jg1(c: @FlexibleNullability MutableCollection?) { + #$$delegate_0.jg1(c = c) + } + + override fun jg2(c: @FlexibleNullability MutableCollection<@FlexibleNullability CharSequence?>?) { + #$$delegate_0.jg2(c = c) + } + + private /*final field*/ val $$delegate_1: K = k + override fun kf1(): Collection { + return #$$delegate_1.kf1() + } + + override fun kf2(): Collection { + return #$$delegate_1.kf2() + } + + override fun kg1(c: Collection) { + #$$delegate_1.kg1(c = c) + } + + override fun kg2(c: Collection) { + #$$delegate_1.kg2(c = c) + } + + + + +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsT.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsT.kt.txt new file mode 100644 index 00000000000..88a2da6bc36 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsT.kt.txt @@ -0,0 +1,11 @@ +fun useT(fn: Function0): T { + return fn.invoke() +} + +fun testNoNullCheck() { + useT<@EnhancedNullability String>(fn = local fun (): @EnhancedNullability String { + return notNullString() + } +) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTAny.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTAny.kt.txt new file mode 100644 index 00000000000..59069d0279c --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTAny.kt.txt @@ -0,0 +1,11 @@ +fun useTAny(fn: Function0): T { + return fn.invoke() +} + +fun testNoNullCheck() { + useTAny<@EnhancedNullability String>(fn = local fun (): @EnhancedNullability String { + return notNullString() + } +) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTConstrained.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTConstrained.kt.txt new file mode 100644 index 00000000000..7fdb4b1b7aa --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTConstrained.kt.txt @@ -0,0 +1,11 @@ +fun useTConstrained(xs: Array, fn: Function0): T { + return fn.invoke() +} + +fun testWithNullCheck(xs: Array) { + useTConstrained(xs = xs, fn = local fun (): String { + return notNullString() /*!! String */ + } +) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTXArray.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTXArray.kt.txt new file mode 100644 index 00000000000..acd032fcdb5 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTXArray.kt.txt @@ -0,0 +1,11 @@ +fun useTX(x: T, fn: Function0): T { + return fn.invoke() +} + +fun testWithNullCheck(xs: Array) { + useTX(x = xs, fn = local fun (): Serializable { + return notNullString() /*!! String */ + } +) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTXString.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTXString.kt.txt new file mode 100644 index 00000000000..a4457625d58 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTXString.kt.txt @@ -0,0 +1,11 @@ +fun useTX(x: T, fn: Function0): T { + return fn.invoke() +} + +fun testWithNullCheck() { + useTX(x = "", fn = local fun (): String { + return notNullString() /*!! String */ + } +) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsT.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsT.kt.txt new file mode 100644 index 00000000000..3fa5e00208b --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsT.kt.txt @@ -0,0 +1,11 @@ +fun useT(fn: Function0): T { + return fn.invoke() +} + +fun testNoNullCheck() { + useT<@FlexibleNullability String?>(fn = local fun (): @FlexibleNullability String? { + return string() + } +) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTAny.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTAny.kt.txt new file mode 100644 index 00000000000..9dadc44a84a --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTAny.kt.txt @@ -0,0 +1,11 @@ +fun useTAny(fn: Function0): T { + return fn.invoke() +} + +fun testNoNullCheck() { + useTAny<@FlexibleNullability String?>(fn = local fun (): @FlexibleNullability String? { + return string() + } +) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTConstrained.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTConstrained.kt.txt new file mode 100644 index 00000000000..1eb947d9c69 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTConstrained.kt.txt @@ -0,0 +1,11 @@ +fun useTConstrained(xs: Array, fn: Function0): T { + return fn.invoke() +} + +fun testWithNullCheck(xs: Array) { + useTConstrained(xs = xs, fn = local fun (): String { + return string() /*!! String */ + } +) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXArray.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXArray.kt.txt new file mode 100644 index 00000000000..ffd23807511 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXArray.kt.txt @@ -0,0 +1,11 @@ +fun useTX(x: T, fn: Function0): T { + return fn.invoke() +} + +fun testNoNullCheck(xs: Array) { + useTX<@FlexibleNullability Serializable?>(x = xs, fn = local fun (): @FlexibleNullability Serializable? { + return string() + } +) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXString.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXString.kt.txt new file mode 100644 index 00000000000..db333c23664 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXString.kt.txt @@ -0,0 +1,11 @@ +fun useTX(x: T, fn: Function0): T { + return fn.invoke() +} + +fun testNoNullCheck() { + useTX<@FlexibleNullability String?>(x = "", fn = local fun (): @FlexibleNullability String? { + return string() + } +) /*~> Unit */ +} + diff --git a/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt b/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt new file mode 100644 index 00000000000..2ba226222d0 --- /dev/null +++ b/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt @@ -0,0 +1,93 @@ +class GenericInv { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class GenericIn { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +class GenericOut { + constructor() /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + + + +} + +fun testReturnsRawGenericInv(j: JRaw): @FlexibleNullability @RawType GenericInv? { + return j.returnsRawGenericInv() +} + +fun testReturnsRawGenericIn(j: JRaw): @FlexibleNullability @RawType GenericIn? { + return j.returnsRawGenericIn() +} + +fun testReturnsRawGenericOut(j: JRaw): @FlexibleNullability @RawType GenericOut? { + return j.returnsRawGenericOut() +} + +class KRaw : JRaw { + constructor(j: JRaw) /* primary */ { + TODO("IrDelegatingConstructorCall") + /* InstanceInitializerCall */ + + } + + private /*final field*/ val $$delegate_0: JRaw = j + override fun returnsRawGenericIn(): @FlexibleNullability @RawType GenericIn? { + return #$$delegate_0.returnsRawGenericIn() + } + + override fun returnsRawGenericInv(): @FlexibleNullability @RawType GenericInv? { + return #$$delegate_0.returnsRawGenericInv() + } + + override fun returnsRawGenericOut(): @FlexibleNullability @RawType GenericOut? { + return #$$delegate_0.returnsRawGenericOut() + } + + override fun returnsRawList(): @FlexibleNullability @RawType MutableList? { + return #$$delegate_0.returnsRawList() + } + + override fun takesRawGenericIn(g: @FlexibleNullability @RawType GenericIn?) { + #$$delegate_0.takesRawGenericIn(g = g) + } + + override fun takesRawGenericInv(g: @FlexibleNullability @RawType GenericInv?) { + #$$delegate_0.takesRawGenericInv(g = g) + } + + override fun takesRawGenericOut(g: @FlexibleNullability @RawType GenericOut?) { + #$$delegate_0.takesRawGenericOut(g = g) + } + + override fun takesRawList(list: @FlexibleNullability @RawType MutableList?) { + #$$delegate_0.takesRawList(list = list) + } + + + + +} + From 0294ff4f106ba02eead52d26e84638d581868530 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Thu, 5 Nov 2020 23:38:25 +0300 Subject: [PATCH 132/698] [IR] add TODO to RenderIrElement --- .../jetbrains/kotlin/ir/util/RenderIrElement.kt | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/RenderIrElement.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/RenderIrElement.kt index cc6d908565d..fd6bd60ec17 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/RenderIrElement.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/RenderIrElement.kt @@ -1,17 +1,6 @@ /* - * Copyright 2010-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.ir.util @@ -577,6 +566,7 @@ class RenderIrElementVisitor(private val normalizeNames: Boolean = false) : IrEl override fun visitSpreadElement(spread: IrSpreadElement, data: Nothing?): String = "SPREAD_ELEMENT" + // TODO do we need a special support for IrReturnableBlock here? override fun visitBlock(expression: IrBlock, data: Nothing?): String = "BLOCK type=${expression.type.render()} origin=${expression.origin}" From 6a1ab1b325e8a9c5d2cac61c82cb0f6af0d3cb6d Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Thu, 5 Nov 2020 23:40:10 +0300 Subject: [PATCH 133/698] [IR] KotlinLikeDumper: WIP * rearrange some declarations * add space for before "BLOCK" * add comment for "RETURNABLE BLOCK" --- .../kotlin/ir/util/KotlinLikeDumper.kt | 67 ++++++++++--------- 1 file changed, 37 insertions(+), 30 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index b5cd8900a2c..dc70107b4e6 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -424,19 +424,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p(isNoinline, "noinline") } - private val INAPPLICABLE = false - private val INAPPLICABLE_N = null - - override fun visitSimpleFunction(declaration: IrSimpleFunction) { - declaration.printSimpleFunction( - "fun ", - declaration.name.asString(), - printTypeParametersAndExtensionReceiver = true, - printSignatureAndBody = true - ) - p.printlnWithNoIndent() - } - private fun IrValueParameter.printExtensionReceiverParameter() { type.printTypeWithNoIndent() p.printWithNoIndent(".") @@ -513,6 +500,16 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } } + override fun visitSimpleFunction(declaration: IrSimpleFunction) { + declaration.printSimpleFunction( + "fun ", + declaration.name.asString(), + printTypeParametersAndExtensionReceiver = true, + printSignatureAndBody = true + ) + p.printlnWithNoIndent() + } + override fun visitConstructor(declaration: IrConstructor) { // TODO primary!!! // TODO name? @@ -557,9 +554,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printlnWithNoIndent() } - private fun commentBlock(text: String) = "/* $text */" - private fun commentBlockH(text: String) = "/* $text */" - override fun visitProperty(declaration: IrProperty) { if (options.printFakeOverridesStrategy == FakeOverridesStrategy.NONE && declaration.isFakeOverride) return @@ -792,7 +786,20 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printlnWithNoIndent() } + override fun visitComposite(expression: IrComposite) { + expression.printStatementContainer("// COMPOSITE {", "// }", withIndentation = false) + } + + override fun visitBlock(expression: IrBlock) { + // TODO special blocks using `origin` + // TODO inlineFunctionSymbol for IrReturnableBlock + // TODO no tests for IrReturnableBlock? + val kind = if (expression is IrReturnableBlock) "RETURNABLE BLOCK" else "BLOCK" + expression.printStatementContainer("{ // $kind", "}") + } + private fun IrStatementContainer.printStatementContainer(before: String, after: String, withIndentation: Boolean = true) { + // TODO type for IrContainerExpression p.printlnWithNoIndent(before) if (withIndentation) p.pushIndent() @@ -876,12 +883,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption expression.function.printSimpleFunction("fun ", expression.function.name.asString(), printTypeParametersAndExtensionReceiver = true, printSignatureAndBody = true) } - private fun IrFieldAccessExpression.printFieldAccess() { - // TODO receiver, superQualifierSymbol? - // TODO is not valid kotlin - p.printWithNoIndent("#" + symbol.owner.name.asString()) - } - override fun visitGetField(expression: IrGetField) { expression.printFieldAccess() } @@ -892,6 +893,12 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption expression.value.acceptVoid(this) } + private fun IrFieldAccessExpression.printFieldAccess() { + // TODO receiver, superQualifierSymbol? + // TODO is not valid kotlin + p.printWithNoIndent("#" + symbol.owner.name.asString()) + } + override fun visitReturn(expression: IrReturn) { p.printWithNoIndent("return ") expression.value.acceptVoid(this) @@ -902,14 +909,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption expression.value.acceptVoid(this) } - override fun visitComposite(expression: IrComposite) { - expression.printStatementContainer("// COMPOSITE {", "// }", withIndentation = false) - } - - override fun visitBlock(expression: IrBlock) { - expression.printStatementContainer("{ //BLOCK", "}") - } - override fun visitStringConcatenation(expression: IrStringConcatenation) { // TODO escape? see IrTextTestCaseGenerated.Expressions#testStringTemplates expression.arguments.forEachIndexed { i, e -> @@ -1096,4 +1095,12 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption // TODO receiver, arguments p.printWithNoIndent("error(\"\") /* ERROR CALL */") } + + private fun commentBlock(text: String) = "/* $text */" + private fun commentBlockH(text: String) = "/* $text */" + + private companion object { + private const val INAPPLICABLE = false + private val INAPPLICABLE_N = null + } } From fc5c674c609f4e2c4994a30a8fd49a533e4091a5 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Thu, 5 Nov 2020 23:40:21 +0300 Subject: [PATCH 134/698] [IR] update testdata --- ...orderingInDelegatingConstructorCall.kt.txt | 6 ++-- .../classes/delegatedImplementation.kt.txt | 2 +- .../testData/ir/irText/classes/enum.kt.txt | 2 +- .../lambdaInDataClassDefaultParameter.kt.txt | 2 +- .../classes/objectLiteralExpressions.kt.txt | 8 ++--- .../catchParameterInTopLevelProperty.kt.txt | 4 +-- .../localDelegatedProperties.kt.txt | 2 +- .../declarations/localVarInDoWhile.kt.txt | 2 +- .../parameters/useNextParamInLambda.kt.txt | 4 +-- .../ir/irText/declarations/typeAlias.kt.txt | 2 +- .../arrayAugmentedAssignment1.kt.txt | 6 ++-- .../arrayAugmentedAssignment2.kt.txt | 2 +- .../expressions/augmentedAssignment1.kt.txt | 10 +++--- .../expressions/augmentedAssignment2.kt.txt | 10 +++--- .../expressions/badBreakContinue.kt.txt | 8 ++--- .../ir/irText/expressions/bangbang.kt.txt | 2 +- .../irText/expressions/breakContinue.kt.txt | 24 ++++++------- .../breakContinueInLoopHeader.kt.txt | 32 ++++++++--------- .../expressions/breakContinueInWhen.kt.txt | 22 ++++++------ .../callWithReorderedArguments.kt.txt | 4 +-- .../boundInlineAdaptedReference.kt.txt | 2 +- .../caoWithAdaptationForSam.kt.txt | 14 ++++---- .../constructorWithAdaptedArguments.kt.txt | 4 +-- .../suspendConversion.kt.txt | 2 +- ...MemberReferenceWithAdaptedArguments.kt.txt | 4 +-- .../withAdaptedArguments.kt.txt | 2 +- .../withArgumentAdaptationAndReceiver.kt.txt | 10 +++--- .../withVarargViewedAsArray.kt.txt | 4 +-- .../expressions/catchParameterAccess.kt.txt | 4 +-- .../expressions/chainOfSafeCalls.kt.txt | 8 ++--- .../irText/expressions/coercionToUnit.kt.txt | 4 +-- .../complexAugmentedAssignment.kt.txt | 18 +++++----- .../ir/irText/expressions/dotQualified.kt.txt | 2 +- .../ir/irText/expressions/elvis.kt.txt | 10 +++--- .../exhaustiveWhenElseBranch.kt.txt | 24 ++++++------- .../expressions/extFunSafeInvoke.kt.txt | 2 +- .../nullableAnyAsIntToDouble.kt.txt | 2 +- .../nullableFloatingPointEqeq.kt.txt | 6 ++-- .../whenByFloatingPoint.kt.txt | 12 +++---- .../testData/ir/irText/expressions/for.kt.txt | 20 +++++------ .../expressions/forWithBreakContinue.kt.txt | 36 +++++++++---------- .../forWithImplicitReceivers.kt.txt | 10 +++--- .../funInterface/partialSam.kt.txt | 4 +-- .../samConversionInVarargsMixed.kt.txt | 2 +- .../samConversionsWithSmartCasts.kt.txt | 10 +++--- .../ir/irText/expressions/ifElseIf.kt.txt | 8 ++--- .../expressions/incrementDecrement.kt.txt | 32 ++++++++--------- .../javaSyntheticGenericPropertyAccess.kt.txt | 6 ++-- .../javaSyntheticPropertyAccess.kt.txt | 6 ++-- .../jvmStaticFieldReference.kt.txt | 2 +- .../ir/irText/expressions/kt16904.kt.txt | 4 +-- .../ir/irText/expressions/kt24804.kt.txt | 2 +- .../ir/irText/expressions/kt27933.kt.txt | 2 +- .../ir/irText/expressions/kt28456.kt.txt | 4 +-- .../ir/irText/expressions/kt28456b.kt.txt | 4 +-- .../ir/irText/expressions/kt30020.kt.txt | 6 ++-- .../ir/irText/expressions/kt30796.kt.txt | 24 ++++++------- .../ir/irText/expressions/kt36956.kt.txt | 2 +- .../ir/irText/expressions/lambdaInCAO.kt.txt | 4 +-- .../expressions/multipleThisReferences.kt.txt | 2 +- .../irText/expressions/objectReference.kt.txt | 2 +- .../irText/expressions/safeAssignment.kt.txt | 2 +- .../safeCallWithIncrementDecrement.kt.txt | 12 +++---- .../ir/irText/expressions/safeCalls.kt.txt | 12 +++---- .../sam/genericSamSmartcast.kt.txt | 2 +- .../sam/samConversionsWithSmartCasts.kt.txt | 12 +++---- .../setFieldWithImplicitCast.kt.txt | 2 +- ...pendConversionOnArbitraryExpression.kt.txt | 30 ++++++++-------- .../expressions/temporaryInInitBlock.kt.txt | 2 +- .../thisOfGenericOuterClass.kt.txt | 2 +- .../thisReferenceBeforeClassDeclared.kt.txt | 4 +-- .../ir/irText/expressions/throw.kt.txt | 2 +- .../ir/irText/expressions/tryCatch.kt.txt | 12 +++---- .../tryCatchWithImplicitCast.kt.txt | 4 +-- .../expressions/variableAsFunctionCall.kt.txt | 4 +-- .../ir/irText/expressions/when.kt.txt | 4 +-- .../expressions/whenCoercedToUnit.kt.txt | 2 +- .../ir/irText/expressions/whenReturn.kt.txt | 2 +- .../irText/expressions/whenReturnUnit.kt.txt | 2 +- .../expressions/whenUnusedExpression.kt.txt | 4 +-- .../whenWithSubjectVariable.kt.txt | 2 +- .../ir/irText/expressions/whileDoWhile.kt.txt | 22 ++++++------ .../ClashResolutionDescriptor.kt.txt | 8 ++--- .../irText/firProblems/DeepCopyIrTree.kt.txt | 6 ++-- .../firProblems/InnerClassInAnonymous.kt.txt | 2 +- .../ir/irText/firProblems/VarInInit.kt.txt | 2 +- .../irText/firProblems/candidateSymbol.kt.txt | 2 +- .../coercionToUnitForNestedWhen.kt.txt | 6 ++-- .../ir/irText/lambdas/localFunction.kt.txt | 2 +- .../irText/regressions/coercionInLoop.kt.txt | 4 +-- .../ir/irText/regressions/kt24114.kt.txt | 14 ++++---- .../castsInsideCoroutineInference.kt.txt | 4 +-- .../types/genericDelegatedDeepProperty.kt.txt | 6 ++-- .../enhancedNullabilityInForLoop.kt.txt | 32 ++++++++--------- 94 files changed, 354 insertions(+), 354 deletions(-) diff --git a/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.kt.txt b/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.kt.txt index 2710a340fb5..fca7a4de600 100644 --- a/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.kt.txt +++ b/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.kt.txt @@ -20,7 +20,7 @@ open class Base { class Test1 : Base { constructor(xx: Int, yy: Int) /* primary */ { - { //BLOCK + { // BLOCK TODO("IrDelegatingConstructorCall") } /* InstanceInitializerCall */ @@ -34,7 +34,7 @@ class Test1 : Base { class Test2 : Base { constructor(xx: Int, yy: Int) { - { //BLOCK + { // BLOCK TODO("IrDelegatingConstructorCall") } /* InstanceInitializerCall */ @@ -42,7 +42,7 @@ class Test2 : Base { } constructor(xxx: Int, yyy: Int, a: Any) { - { //BLOCK + { // BLOCK TODO("IrDelegatingConstructorCall") } } diff --git a/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt index 83accae49bc..a7165bb0037 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt @@ -50,7 +50,7 @@ interface IOther { } fun otherImpl(x0: String, y0: Int): IOther { - return { //BLOCK + return { // BLOCK local class : IOther { constructor() /* primary */ { TODO("IrDelegatingConstructorCall") diff --git a/compiler/testData/ir/irText/classes/enum.kt.txt b/compiler/testData/ir/irText/classes/enum.kt.txt index ab55bfd4ecb..6ad8f99f218 100644 --- a/compiler/testData/ir/irText/classes/enum.kt.txt +++ b/compiler/testData/ir/irText/classes/enum.kt.txt @@ -131,7 +131,7 @@ enum class TestEnum6 : Enum { field = y get - TEST init = { //BLOCK + TEST init = { // BLOCK val tmp0_y: Int = f() val tmp1_x: Int = f() TODO("IrEnumConstructorCall") diff --git a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt index 4af7ccf6a7f..75a2bdf6f53 100644 --- a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt +++ b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt @@ -48,7 +48,7 @@ data class A { } data class B { - constructor(x: Any = { //BLOCK + constructor(x: Any = { // BLOCK local class { constructor() /* primary */ { TODO("IrDelegatingConstructorCall") diff --git a/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt b/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt index d254b1ecea7..7e0a87fe7cf 100644 --- a/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt +++ b/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt @@ -6,7 +6,7 @@ interface IFoo { } val test1: Any - field = { //BLOCK + field = { // BLOCK local class { constructor() /* primary */ { TODO("IrDelegatingConstructorCall") @@ -25,7 +25,7 @@ val test1: Any get val test2: IFoo - field = { //BLOCK + field = { // BLOCK local class : IFoo { constructor() /* primary */ { TODO("IrDelegatingConstructorCall") @@ -68,7 +68,7 @@ class Outer { } fun test3(): Inner { - return { //BLOCK + return { // BLOCK local class : Inner { constructor() /* primary */ { TODO("IrDelegatingConstructorCall") @@ -96,7 +96,7 @@ class Outer { } fun Outer.test4(): Inner { - return { //BLOCK + return { // BLOCK local class : Inner { constructor() /* primary */ { TODO("IrDelegatingConstructorCall") diff --git a/compiler/testData/ir/irText/declarations/catchParameterInTopLevelProperty.kt.txt b/compiler/testData/ir/irText/declarations/catchParameterInTopLevelProperty.kt.txt index 81a302db6ff..3ceb39a0453 100644 --- a/compiler/testData/ir/irText/declarations/catchParameterInTopLevelProperty.kt.txt +++ b/compiler/testData/ir/irText/declarations/catchParameterInTopLevelProperty.kt.txt @@ -1,7 +1,7 @@ val test: Unit - field = try { //BLOCK + field = try { // BLOCK } - catch (...) { //BLOCK + catch (...) { // BLOCK } get diff --git a/compiler/testData/ir/irText/declarations/localDelegatedProperties.kt.txt b/compiler/testData/ir/irText/declarations/localDelegatedProperties.kt.txt index c09352b6bbb..19fe4213191 100644 --- a/compiler/testData/ir/irText/declarations/localDelegatedProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/localDelegatedProperties.kt.txt @@ -24,7 +24,7 @@ fun test2() { (value = 0) - { //BLOCK + { // BLOCK val tmp0: Int = () (value = tmp0.inc()) tmp0 diff --git a/compiler/testData/ir/irText/declarations/localVarInDoWhile.kt.txt b/compiler/testData/ir/irText/declarations/localVarInDoWhile.kt.txt index 0ba20a802ad..554937bf85b 100644 --- a/compiler/testData/ir/irText/declarations/localVarInDoWhile.kt.txt +++ b/compiler/testData/ir/irText/declarations/localVarInDoWhile.kt.txt @@ -1,5 +1,5 @@ fun foo() { - { //BLOCK + { // BLOCK do// COMPOSITE { val x: Int = 42 // } while (EQEQ(arg0 = x, arg1 = 42).not()) diff --git a/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.kt.txt b/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.kt.txt index 8d97fb2bef8..47a9dfdf77e 100644 --- a/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.kt.txt @@ -10,10 +10,10 @@ fun f(f1: Function0 = local fun (): String { fun box(): String { var result: String = "fail" - try { //BLOCK + try { // BLOCK f() /*~> Unit */ } - catch (...) { //BLOCK + catch (...) { // BLOCK result = "OK" } diff --git a/compiler/testData/ir/irText/declarations/typeAlias.kt.txt b/compiler/testData/ir/irText/declarations/typeAlias.kt.txt index 1a0b5a5c619..68d461e21a3 100644 --- a/compiler/testData/ir/irText/declarations/typeAlias.kt.txt +++ b/compiler/testData/ir/irText/declarations/typeAlias.kt.txt @@ -1,6 +1,6 @@ typealias Test1 = String fun foo() { - { //BLOCK + { // BLOCK } } diff --git a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.kt.txt b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.kt.txt index 9d2b50ff744..33fe1816fe2 100644 --- a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.kt.txt +++ b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.kt.txt @@ -24,7 +24,7 @@ class C { fun testVariable() { var x: IntArray = foo() - { //BLOCK + { // BLOCK val tmp0_array: IntArray = x val tmp1_index0: Int = 0 tmp0_array.set(index = tmp1_index0, value = tmp0_array.get(index = tmp1_index0).plus(other = 1)) @@ -32,7 +32,7 @@ fun testVariable() { } fun testCall() { - { //BLOCK + { // BLOCK val tmp0_array: IntArray = foo() val tmp1_index0: Int = bar() tmp0_array.set(index = tmp1_index0, value = tmp0_array.get(index = tmp1_index0).times(other = 2)) @@ -40,7 +40,7 @@ fun testCall() { } fun testMember(c: C) { - { //BLOCK + { // BLOCK val tmp0_array: IntArray = c.() val tmp1_index0: Int = 0 val tmp2: Int = tmp0_array.get(index = tmp1_index0) diff --git a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.kt.txt b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.kt.txt index 79450c07ee4..00549a2d611 100644 --- a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.kt.txt +++ b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.kt.txt @@ -13,7 +13,7 @@ interface IB { } fun IB.test(a: IA) { - { //BLOCK + { // BLOCK val tmp0_array: IA = a val tmp1_index0: String = "" .set($receiver = tmp0_array, index = tmp1_index0, value = tmp0_array.get(index = tmp1_index0).plus(other = 42)) diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignment1.kt.txt b/compiler/testData/ir/irText/expressions/augmentedAssignment1.kt.txt index b7083314874..0552bd582aa 100644 --- a/compiler/testData/ir/irText/expressions/augmentedAssignment1.kt.txt +++ b/compiler/testData/ir/irText/expressions/augmentedAssignment1.kt.txt @@ -13,19 +13,19 @@ fun testVariable() { } fun testProperty() { - { //BLOCK + { // BLOCK ( = ().plus(other = 1)) } - { //BLOCK + { // BLOCK ( = ().minus(other = 2)) } - { //BLOCK + { // BLOCK ( = ().times(other = 3)) } - { //BLOCK + { // BLOCK ( = ().div(other = 4)) } - { //BLOCK + { // BLOCK ( = ().rem(other = 5)) } } diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt b/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt index 7a7ef1f3ec7..afa5af875fd 100644 --- a/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt +++ b/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt @@ -39,19 +39,19 @@ fun testVariable() { } fun testProperty() { - { //BLOCK + { // BLOCK plusAssign($receiver = (), s = "+=") } - { //BLOCK + { // BLOCK minusAssign($receiver = (), s = "-=") } - { //BLOCK + { // BLOCK timesAssign($receiver = (), s = "*=") } - { //BLOCK + { // BLOCK divAssign($receiver = (), s = "/=") } - { //BLOCK + { // BLOCK remAssign($receiver = (), s = "%=") } } diff --git a/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt b/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt index ed3662cbd10..c05774f4d11 100644 --- a/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt +++ b/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt @@ -4,14 +4,14 @@ fun test1() { } fun test2() { - while (true) { //BLOCK + while (true) { // BLOCK error("") /* ERROR EXPRESSION */ error("") /* ERROR EXPRESSION */ } } fun test3() { - while (true) { //BLOCK + while (true) { // BLOCK val lambda: Function0 = local fun (): Nothing { error("") /* ERROR EXPRESSION */ error("") /* ERROR EXPRESSION */ @@ -21,9 +21,9 @@ fun test3() { } fun test4() { - while (error("") /* ERROR EXPRESSION */) { //BLOCK + while (error("") /* ERROR EXPRESSION */) { // BLOCK } - while (error("") /* ERROR EXPRESSION */) { //BLOCK + while (error("") /* ERROR EXPRESSION */) { // BLOCK } } diff --git a/compiler/testData/ir/irText/expressions/bangbang.kt.txt b/compiler/testData/ir/irText/expressions/bangbang.kt.txt index d81e5dd97e7..f23cea9dc98 100644 --- a/compiler/testData/ir/irText/expressions/bangbang.kt.txt +++ b/compiler/testData/ir/irText/expressions/bangbang.kt.txt @@ -3,7 +3,7 @@ fun test1(a: Any?): Any { } fun test2(a: Any?): Int { - return CHECK_NOT_NULL(arg0 = { //BLOCK + return CHECK_NOT_NULL(arg0 = { // BLOCK val tmp0_safe_receiver: Any? = a when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null diff --git a/compiler/testData/ir/irText/expressions/breakContinue.kt.txt b/compiler/testData/ir/irText/expressions/breakContinue.kt.txt index 4969dd48d79..273c2cfe566 100644 --- a/compiler/testData/ir/irText/expressions/breakContinue.kt.txt +++ b/compiler/testData/ir/irText/expressions/breakContinue.kt.txt @@ -1,16 +1,16 @@ fun test1() { - while (true) { //BLOCK + while (true) { // BLOCK break } - { //BLOCK + { // BLOCK do// COMPOSITE { break // } while (true) } - while (true) { //BLOCK + while (true) { // BLOCK continue } - { //BLOCK + { // BLOCK do// COMPOSITE { continue // } while (true) @@ -18,15 +18,15 @@ fun test1() { } fun test2() { - while (true) { //BLOCK - while (true) { //BLOCK + while (true) { // BLOCK + while (true) { // BLOCK break break } break } - while (true) { //BLOCK - while (true) { //BLOCK + while (true) { // BLOCK + while (true) { // BLOCK continue continue } @@ -35,14 +35,14 @@ fun test2() { } fun test3() { - while (true) { //BLOCK - while (true) { //BLOCK + while (true) { // BLOCK + while (true) { // BLOCK break } break } - while (true) { //BLOCK - while (true) { //BLOCK + while (true) { // BLOCK + while (true) { // BLOCK continue } continue diff --git a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.kt.txt b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.kt.txt index 5db7499dcae..1fc4fd54d33 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.kt.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.kt.txt @@ -1,6 +1,6 @@ fun test1(c: Boolean?) { - while (true) { //BLOCK - while ({ //BLOCK + while (true) { // BLOCK + while ({ // BLOCK val tmp0_elvis_lhs: Boolean? = c when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> break @@ -11,8 +11,8 @@ fun test1(c: Boolean?) { } fun test2(c: Boolean?) { - while (true) { //BLOCK - while ({ //BLOCK + while (true) { // BLOCK + while ({ // BLOCK val tmp0_elvis_lhs: Boolean? = c when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> continue @@ -23,16 +23,16 @@ fun test2(c: Boolean?) { } fun test3(ss: List?) { - while (true) { //BLOCK - { //BLOCK - val tmp1_iterator: Iterator = { //BLOCK + while (true) { // BLOCK + { // BLOCK + val tmp1_iterator: Iterator = { // BLOCK val tmp0_elvis_lhs: List? = ss when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> continue true -> tmp0_elvis_lhs } }.iterator() - while (tmp1_iterator.hasNext()) { //BLOCK + while (tmp1_iterator.hasNext()) { // BLOCK val s: String = tmp1_iterator.next() } } @@ -40,16 +40,16 @@ fun test3(ss: List?) { } fun test4(ss: List?) { - while (true) { //BLOCK - { //BLOCK - val tmp1_iterator: Iterator = { //BLOCK + while (true) { // BLOCK + { // BLOCK + val tmp1_iterator: Iterator = { // BLOCK val tmp0_elvis_lhs: List? = ss when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> break true -> tmp0_elvis_lhs } }.iterator() - while (tmp1_iterator.hasNext()) { //BLOCK + while (tmp1_iterator.hasNext()) { // BLOCK val s: String = tmp1_iterator.next() } } @@ -58,15 +58,15 @@ fun test4(ss: List?) { fun test5() { var i: Int = 0 - while (true) { //BLOCK - { //BLOCK + while (true) { // BLOCK + { // BLOCK i = i.inc() i } /*~> Unit */ var j: Int = 0 - { //BLOCK + { // BLOCK do// COMPOSITE { - { //BLOCK + { // BLOCK j = j.inc() j } /*~> Unit */ diff --git a/compiler/testData/ir/irText/expressions/breakContinueInWhen.kt.txt b/compiler/testData/ir/irText/expressions/breakContinueInWhen.kt.txt index 4a82137af47..7af7d6a25a8 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInWhen.kt.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInWhen.kt.txt @@ -1,11 +1,11 @@ fun testBreakFor() { val xs: IntArray = TODO("IrConstructorCall") var k: Int = 0 - { //BLOCK + { // BLOCK val tmp0_iterator: IntIterator = xs.iterator() - while (tmp0_iterator.hasNext()) { //BLOCK + while (tmp0_iterator.hasNext()) { // BLOCK val x: Int = tmp0_iterator.next() - { //BLOCK + { // BLOCK when { greater(arg0 = k, arg1 = 2) -> break } @@ -16,7 +16,7 @@ fun testBreakFor() { fun testBreakWhile() { var k: Int = 0 - while (less(arg0 = k, arg1 = 10)) { //BLOCK + while (less(arg0 = k, arg1 = 10)) { // BLOCK when { greater(arg0 = k, arg1 = 2) -> break } @@ -25,7 +25,7 @@ fun testBreakWhile() { fun testBreakDoWhile() { var k: Int = 0 - { //BLOCK + { // BLOCK do// COMPOSITE { when { greater(arg0 = k, arg1 = 2) -> break @@ -37,11 +37,11 @@ fun testBreakDoWhile() { fun testContinueFor() { val xs: IntArray = TODO("IrConstructorCall") var k: Int = 0 - { //BLOCK + { // BLOCK val tmp0_iterator: IntIterator = xs.iterator() - while (tmp0_iterator.hasNext()) { //BLOCK + while (tmp0_iterator.hasNext()) { // BLOCK val x: Int = tmp0_iterator.next() - { //BLOCK + { // BLOCK when { greater(arg0 = k, arg1 = 2) -> continue } @@ -52,7 +52,7 @@ fun testContinueFor() { fun testContinueWhile() { var k: Int = 0 - while (less(arg0 = k, arg1 = 10)) { //BLOCK + while (less(arg0 = k, arg1 = 10)) { // BLOCK when { greater(arg0 = k, arg1 = 2) -> continue } @@ -62,9 +62,9 @@ fun testContinueWhile() { fun testContinueDoWhile() { var k: Int = 0 var s: String = "" - { //BLOCK + { // BLOCK do// COMPOSITE { - { //BLOCK + { // BLOCK k = k.inc() k } /*~> Unit */ diff --git a/compiler/testData/ir/irText/expressions/callWithReorderedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callWithReorderedArguments.kt.txt index 4919fc6ef7b..e826599375a 100644 --- a/compiler/testData/ir/irText/expressions/callWithReorderedArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/callWithReorderedArguments.kt.txt @@ -19,12 +19,12 @@ fun reordered2(): Int { fun test() { foo(a = noReorder1(), b = noReorder2()) - { //BLOCK + { // BLOCK val tmp0_b: Int = reordered1() val tmp1_a: Int = reordered2() foo(a = tmp1_a, b = tmp0_b) } - { //BLOCK + { // BLOCK val tmp2_a: Int = reordered2() foo(a = tmp2_a, b = 1) } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.kt.txt index e1e655aeec1..11d91d981b0 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.kt.txt @@ -8,7 +8,7 @@ fun String.id(s: String = , vararg xs: Int): String { } fun test() { - foo(x = { //BLOCK + foo(x = { // BLOCK local fun String.id() { id($receiver = receiver, ) /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt index 05d9093bfdb..b8d86b1f161 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt @@ -55,7 +55,7 @@ fun withVararg(vararg xs: Int): Int { } fun test1() { - { //BLOCK + { // BLOCK val tmp0_array: A = A val tmp2_sam: IFoo = local fun withVararg(p0: Int) { withVararg(xs = [p0]) /*~> Unit */ @@ -66,7 +66,7 @@ fun test1() { } fun test2() { - { //BLOCK + { // BLOCK val tmp0_array: B = B val tmp2_sam: IFoo2 = local fun withVararg(p0: Int) { withVararg(xs = [p0]) /*~> Unit */ @@ -77,7 +77,7 @@ fun test2() { } fun test3(fn: Function1) { - { //BLOCK + { // BLOCK val tmp0_array: A = A val tmp2_sam: IFoo = fn /*-> IFoo */ set($receiver = tmp0_array, i = tmp2_sam, newValue = get($receiver = tmp0_array, i = tmp2_sam).plus(other = 1)) @@ -86,8 +86,8 @@ fun test3(fn: Function1) { fun test4(fn: Function1) { when { - fn is IFoo -> { //BLOCK - { //BLOCK + fn is IFoo -> { // BLOCK + { // BLOCK val tmp0_array: A = A val tmp1_index0: Function1 = fn set($receiver = tmp0_array, i = tmp1_index0 /*as IFoo */, newValue = get($receiver = tmp0_array, i = tmp1_index0 /*as IFoo */).plus(other = 1)) @@ -98,7 +98,7 @@ fun test4(fn: Function1) { fun test5(a: Any) { a as Function1 /*~> Unit */ - { //BLOCK + { // BLOCK val tmp0_array: A = A val tmp2_sam: IFoo = a /*as Function1<@ParameterName(...) Int, Unit> */ /*-> IFoo */ set($receiver = tmp0_array, i = tmp2_sam, newValue = get($receiver = tmp0_array, i = tmp2_sam).plus(other = 1)) @@ -108,7 +108,7 @@ fun test5(a: Any) { fun test6(a: Any) { a as Function1 /*~> Unit */ a as IFoo /*~> Unit */ - { //BLOCK + { // BLOCK val tmp0_array: A = A val tmp1_index0: Any = a set($receiver = tmp0_array, i = tmp1_index0 /*as IFoo */, newValue = get($receiver = tmp0_array, i = tmp1_index0 /*as IFoo */).plus(other = 1)) diff --git a/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt index f2c58b93104..53498fc83f2 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt @@ -46,7 +46,7 @@ fun testConstructor(): Any { } fun testInnerClassConstructor(outer: Outer): Any { - return use(fn = { //BLOCK + return use(fn = { // BLOCK local fun Outer.(p0: Int): Inner { return TODO("IrConstructorCall") } @@ -57,7 +57,7 @@ fun testInnerClassConstructor(outer: Outer): Any { } fun testInnerClassConstructorCapturingOuter(): Any { - return use(fn = { //BLOCK + return use(fn = { // BLOCK local fun Outer.(p0: Int): Inner { return TODO("IrConstructorCall") } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt index 24cdb8da7dc..87421fecd5b 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt @@ -92,7 +92,7 @@ fun testWithDefaults() { } fun testWithBoundReceiver() { - useSuspend(fn = { //BLOCK + useSuspend(fn = { // BLOCK local suspend fun C.bar() { receiver.bar() } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt index 7cfb59d2b7c..b704e5d316c 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt @@ -44,7 +44,7 @@ fun testUnbound() { } fun testBound(a: A) { - use2(fn = { //BLOCK + use2(fn = { // BLOCK local fun A.foo(p0: Int) { receiver.foo(xs = [p0]) /*~> Unit */ } @@ -55,7 +55,7 @@ fun testBound(a: A) { } fun testObject() { - use2(fn = { //BLOCK + use2(fn = { // BLOCK local fun Obj.foo(p0: Int) { receiver.foo(xs = [p0]) /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt index 6638a71bbd2..c2501fd68f7 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt @@ -59,7 +59,7 @@ fun testCoercionToUnit() { } fun testImportedObjectMember(): String { - return use(fn = { //BLOCK + return use(fn = { // BLOCK local fun importedObjectMemberWithVarargs(p0: Int): String { return importedObjectMemberWithVarargs(xs = [p0]) } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt index a81f4d2bffd..6c79c42a820 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt @@ -14,7 +14,7 @@ class Host { } fun testImplicitThis() { - use(fn = { //BLOCK + use(fn = { // BLOCK local fun Host.withVararg(p0: Int) { receiver.withVararg(xs = [p0]) /*~> Unit */ } @@ -26,7 +26,7 @@ class Host { fun testBoundReceiverLocalVal() { val h: Host = TODO("IrConstructorCall") - use(fn = { //BLOCK + use(fn = { // BLOCK local fun Host.withVararg(p0: Int) { receiver.withVararg(xs = [p0]) /*~> Unit */ } @@ -38,7 +38,7 @@ class Host { fun testBoundReceiverLocalVar() { var h: Host = TODO("IrConstructorCall") - use(fn = { //BLOCK + use(fn = { // BLOCK local fun Host.withVararg(p0: Int) { receiver.withVararg(xs = [p0]) /*~> Unit */ } @@ -49,7 +49,7 @@ class Host { } fun testBoundReceiverParameter(h: Host) { - use(fn = { //BLOCK + use(fn = { // BLOCK local fun Host.withVararg(p0: Int) { receiver.withVararg(xs = [p0]) /*~> Unit */ } @@ -60,7 +60,7 @@ class Host { } fun testBoundReceiverExpression() { - use(fn = { //BLOCK + use(fn = { // BLOCK local fun Host.withVararg(p0: Int) { receiver.withVararg(xs = [p0]) /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.kt.txt index 7933bb1475f..3ec8016a282 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.kt.txt @@ -1,8 +1,8 @@ fun sum(vararg args: Int): Int { var result: Int = 0 - { //BLOCK + { // BLOCK val tmp0_iterator: IntIterator = args.iterator() - while (tmp0_iterator.hasNext()) { //BLOCK + while (tmp0_iterator.hasNext()) { // BLOCK val arg: Int = tmp0_iterator.next() result = result.plus(other = arg) } diff --git a/compiler/testData/ir/irText/expressions/catchParameterAccess.kt.txt b/compiler/testData/ir/irText/expressions/catchParameterAccess.kt.txt index 5782f8d74c3..6b8a18927e0 100644 --- a/compiler/testData/ir/irText/expressions/catchParameterAccess.kt.txt +++ b/compiler/testData/ir/irText/expressions/catchParameterAccess.kt.txt @@ -1,8 +1,8 @@ fun test(f: Function0) { - return try { //BLOCK + return try { // BLOCK f.invoke() } - catch (...) { //BLOCK + catch (...) { // BLOCK throw e } diff --git a/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt b/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt index b90840074d2..6597c23668d 100644 --- a/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt +++ b/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt @@ -19,10 +19,10 @@ class C { } fun test(nc: C?): C? { - return { //BLOCK - val tmp3_safe_receiver: C? = { //BLOCK - val tmp2_safe_receiver: C? = { //BLOCK - val tmp1_safe_receiver: C? = { //BLOCK + return { // BLOCK + val tmp3_safe_receiver: C? = { // BLOCK + val tmp2_safe_receiver: C? = { // BLOCK + val tmp1_safe_receiver: C? = { // BLOCK val tmp0_safe_receiver: C? = nc when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null diff --git a/compiler/testData/ir/irText/expressions/coercionToUnit.kt.txt b/compiler/testData/ir/irText/expressions/coercionToUnit.kt.txt index 286dd825a11..e29ccce9721 100644 --- a/compiler/testData/ir/irText/expressions/coercionToUnit.kt.txt +++ b/compiler/testData/ir/irText/expressions/coercionToUnit.kt.txt @@ -10,14 +10,14 @@ fun test2(mc: MutableCollection) { } fun test3() { - { //BLOCK + { // BLOCK val tmp0_safe_receiver: @FlexibleNullability PrintStream? = #out when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null true -> tmp0_safe_receiver /*!! PrintStream */.println(p0 = "Hello,") } } /*~> Unit */ - { //BLOCK + { // BLOCK val tmp1_safe_receiver: @FlexibleNullability PrintStream? = #out when { EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null diff --git a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt index 905bb2523ee..d452608ed84 100644 --- a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt +++ b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt @@ -51,9 +51,9 @@ object X1 { fun test1(a: IntArray) { var i: Int = 0 - { //BLOCK + { // BLOCK val tmp1_array: IntArray = a - val tmp2_index0: Int = { //BLOCK + val tmp2_index0: Int = { // BLOCK val tmp0: Int = i i = tmp0.inc() tmp0 @@ -65,25 +65,25 @@ fun test1(a: IntArray) { } fun test2() { - { //BLOCK + { // BLOCK val tmp0_this: X1 = X1 - { //BLOCK + { // BLOCK val tmp1: Int = tmp0_this.() tmp0_this.( = tmp1.inc()) tmp1 } } /*~> Unit */ - { //BLOCK + { // BLOCK val tmp2_this: X2 = X2 - { //BLOCK + { // BLOCK val tmp3: Int = tmp2_this.() tmp2_this.( = tmp3.inc()) tmp3 } } /*~> Unit */ - { //BLOCK + { // BLOCK val tmp4_this: X3 = X3 - { //BLOCK + { // BLOCK val tmp5: Int = tmp4_this.() tmp4_this.( = tmp5.inc()) tmp5 @@ -116,7 +116,7 @@ object Host { } operator fun B.plusAssign(b: B) { - { //BLOCK + { // BLOCK val tmp0_this: B = tmp0_this.( = tmp0_this.().plus(other = b.())) } diff --git a/compiler/testData/ir/irText/expressions/dotQualified.kt.txt b/compiler/testData/ir/irText/expressions/dotQualified.kt.txt index 5302517c8b7..a42eda1db63 100644 --- a/compiler/testData/ir/irText/expressions/dotQualified.kt.txt +++ b/compiler/testData/ir/irText/expressions/dotQualified.kt.txt @@ -3,7 +3,7 @@ fun length(s: String): Int { } fun lengthN(s: String?): Int? { - return { //BLOCK + return { // BLOCK val tmp0_safe_receiver: String? = s when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null diff --git a/compiler/testData/ir/irText/expressions/elvis.kt.txt b/compiler/testData/ir/irText/expressions/elvis.kt.txt index ab1ac410e8a..394c9f17880 100644 --- a/compiler/testData/ir/irText/expressions/elvis.kt.txt +++ b/compiler/testData/ir/irText/expressions/elvis.kt.txt @@ -7,7 +7,7 @@ fun foo(): Any? { } fun test1(a: Any?, b: Any): Any { - return { //BLOCK + return { // BLOCK val tmp0_elvis_lhs: Any? = a when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> b @@ -17,7 +17,7 @@ fun test1(a: Any?, b: Any): Any { } fun test2(a: String?, b: Any): Any { - return { //BLOCK + return { // BLOCK val tmp0_elvis_lhs: String? = a when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> b @@ -33,7 +33,7 @@ fun test3(a: Any?, b: Any?): String { when { a !is String? -> return "" } - return { //BLOCK + return { // BLOCK val tmp0_elvis_lhs: Any? = a when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> b /*as String */ @@ -43,7 +43,7 @@ fun test3(a: Any?, b: Any?): String { } fun test4(x: Any): Any { - return { //BLOCK + return { // BLOCK val tmp0_elvis_lhs: Any? = () when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> x @@ -53,7 +53,7 @@ fun test4(x: Any): Any { } fun test5(x: Any): Any { - return { //BLOCK + return { // BLOCK val tmp0_elvis_lhs: Any? = foo() when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> x diff --git a/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt b/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt index add11e0452e..9104cd49273 100644 --- a/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt +++ b/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt @@ -20,7 +20,7 @@ enum class A : Enum { fun testVariableAssignment_throws(a: A) { val x: Int - { //BLOCK + { // BLOCK val tmp0_subject: A = a when { EQEQ(arg0 = tmp0_subject, arg1 = A) -> x = 11 @@ -30,7 +30,7 @@ fun testVariableAssignment_throws(a: A) { } fun testStatement_empty(a: A) { - { //BLOCK + { // BLOCK val tmp0_subject: A = a when { EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */ @@ -39,7 +39,7 @@ fun testStatement_empty(a: A) { } fun testParenthesized_throwsJvm(a: A) { - { //BLOCK + { // BLOCK val tmp0_subject: A = a when { EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */ @@ -48,7 +48,7 @@ fun testParenthesized_throwsJvm(a: A) { } fun testAnnotated_throwsJvm(a: A) { - { //BLOCK + { // BLOCK val tmp0_subject: A = a when { EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */ @@ -57,7 +57,7 @@ fun testAnnotated_throwsJvm(a: A) { } fun testExpression_throws(a: A): Int { - return { //BLOCK + return { // BLOCK val tmp0_subject: A = a when { EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 @@ -69,8 +69,8 @@ fun testExpression_throws(a: A): Int { fun testIfTheElseStatement_empty(a: A, flag: Boolean) { when { flag -> 0 /*~> Unit */ - true -> { //BLOCK - { //BLOCK + true -> { // BLOCK + { // BLOCK val tmp0_subject: A = a when { EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */ @@ -83,8 +83,8 @@ fun testIfTheElseStatement_empty(a: A, flag: Boolean) { fun testIfTheElseParenthesized_throwsJvm(a: A, flag: Boolean) { when { flag -> 0 /*~> Unit */ - true -> { //BLOCK - { //BLOCK + true -> { // BLOCK + { // BLOCK val tmp0_subject: A = a when { EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */ @@ -97,8 +97,8 @@ fun testIfTheElseParenthesized_throwsJvm(a: A, flag: Boolean) { fun testIfTheElseAnnotated_throwsJvm(a: A, flag: Boolean) { when { flag -> 0 /*~> Unit */ - true -> { //BLOCK - { //BLOCK + true -> { // BLOCK + { // BLOCK val tmp0_subject: A = a when { EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */ @@ -110,7 +110,7 @@ fun testIfTheElseAnnotated_throwsJvm(a: A, flag: Boolean) { fun testLambdaResultExpression_throws(a: A) { local fun (): Int { - return { //BLOCK + return { // BLOCK val tmp0_subject: A = a when { EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 diff --git a/compiler/testData/ir/irText/expressions/extFunSafeInvoke.kt.txt b/compiler/testData/ir/irText/expressions/extFunSafeInvoke.kt.txt index c2766260f48..cde2bea701e 100644 --- a/compiler/testData/ir/irText/expressions/extFunSafeInvoke.kt.txt +++ b/compiler/testData/ir/irText/expressions/extFunSafeInvoke.kt.txt @@ -1,5 +1,5 @@ fun test(receiver: Any?, fn: @ExtensionFunctionType Function3): Unit? { - return { //BLOCK + return { // BLOCK val tmp0_safe_receiver: Any? = receiver when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.kt.txt index a12320e1b87..38196c6f7df 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.kt.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.kt.txt @@ -1,6 +1,6 @@ fun test(x: Any?, y: Double): Boolean { return when { - x is Int -> less(arg0 = { //BLOCK + x is Int -> less(arg0 = { // BLOCK val tmp0_safe_receiver: Any? = x when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.kt.txt index 2a66efd6bc5..0fc7eaf8fb0 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.kt.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.kt.txt @@ -4,7 +4,7 @@ fun testDD(x: Double?, y: Double?): Boolean { fun testDF(x: Double?, y: Any?): Boolean { return when { - y is Float? -> ieee754equals(arg0 = x, arg1 = { //BLOCK + y is Float? -> ieee754equals(arg0 = x, arg1 = { // BLOCK val tmp0_safe_receiver: Any? = y when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null @@ -17,7 +17,7 @@ fun testDF(x: Double?, y: Any?): Boolean { fun testDI(x: Double?, y: Any?): Boolean { return when { - y is Int? -> ieee754equals(arg0 = x, arg1 = { //BLOCK + y is Int? -> ieee754equals(arg0 = x, arg1 = { // BLOCK val tmp0_safe_receiver: Any? = y when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null @@ -33,7 +33,7 @@ fun testDI2(x: Any?, y: Any?): Boolean { when { x is Int? -> y is Double true -> false - } -> ieee754equals(arg0 = { //BLOCK + } -> ieee754equals(arg0 = { // BLOCK val tmp0_safe_receiver: Any? = x when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.kt.txt index b44336eeca2..9d6bff99c73 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.kt.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.kt.txt @@ -1,5 +1,5 @@ fun testSimple(x: Double): Int { - return { //BLOCK + return { // BLOCK val tmp0_subject: Double = x when { ieee754equals(arg0 = tmp0_subject, arg1 = 0.0D) -> 0 @@ -12,7 +12,7 @@ fun testSmartCastInWhenSubject(x: Any): Int { when { x !is Double -> return -1 } - return { //BLOCK + return { // BLOCK val tmp0_subject: Any = x when { ieee754equals(arg0 = tmp0_subject /*as Double */, arg1 = 0.0D) -> 0 @@ -25,7 +25,7 @@ fun testSmartCastInWhenCondition(x: Double, y: Any): Int { when { y !is Double -> return -1 } - return { //BLOCK + return { // BLOCK val tmp0_subject: Double = x when { ieee754equals(arg0 = tmp0_subject, arg1 = y /*as Double */) -> 0 @@ -35,7 +35,7 @@ fun testSmartCastInWhenCondition(x: Double, y: Any): Int { } fun testSmartCastInWhenConditionInBranch(x: Any): Int { - return { //BLOCK + return { // BLOCK val tmp0_subject: Any = x when { tmp0_subject is Double.not() -> -1 @@ -52,7 +52,7 @@ fun testSmartCastToDifferentTypes(x: Any, y: Any): Int { when { y !is Float -> return -1 } - return { //BLOCK + return { // BLOCK val tmp0_subject: Any = x when { ieee754equals(arg0 = tmp0_subject /*as Double */, arg1 = y /*as Float */.toDouble()) -> 0 @@ -66,7 +66,7 @@ fun foo(x: Double): Double { } fun testWithPrematureExitInConditionSubexpression(x: Any): Int { - return { //BLOCK + return { // BLOCK val tmp0_subject: Any = x when { EQEQ(arg0 = tmp0_subject, arg1 = foo(x = when { diff --git a/compiler/testData/ir/irText/expressions/for.kt.txt b/compiler/testData/ir/irText/expressions/for.kt.txt index a1ab4dfddbe..0f2fc03ca99 100644 --- a/compiler/testData/ir/irText/expressions/for.kt.txt +++ b/compiler/testData/ir/irText/expressions/for.kt.txt @@ -1,18 +1,18 @@ fun testEmpty(ss: List) { - { //BLOCK + { // BLOCK val tmp0_iterator: Iterator = ss.iterator() - while (tmp0_iterator.hasNext()) { //BLOCK + while (tmp0_iterator.hasNext()) { // BLOCK val s: String = tmp0_iterator.next() } } } fun testIterable(ss: List) { - { //BLOCK + { // BLOCK val tmp0_iterator: Iterator = ss.iterator() - while (tmp0_iterator.hasNext()) { //BLOCK + while (tmp0_iterator.hasNext()) { // BLOCK val s: String = tmp0_iterator.next() - { //BLOCK + { // BLOCK println(message = s) } } @@ -20,13 +20,13 @@ fun testIterable(ss: List) { } fun testDestructuring(pp: List>) { - { //BLOCK + { // BLOCK val tmp0_iterator: Iterator> = pp.iterator() - while (tmp0_iterator.hasNext()) { //BLOCK + while (tmp0_iterator.hasNext()) { // BLOCK val tmp1_loop_parameter: Pair = tmp0_iterator.next() val i: Int = tmp1_loop_parameter.component1() val s: String = tmp1_loop_parameter.component2() - { //BLOCK + { // BLOCK println(message = i) println(message = s) } @@ -35,9 +35,9 @@ fun testDestructuring(pp: List>) { } fun testRange() { - { //BLOCK + { // BLOCK val tmp0_iterator: IntIterator = 1.rangeTo(other = 10).iterator() - while (tmp0_iterator.hasNext()) { //BLOCK + while (tmp0_iterator.hasNext()) { // BLOCK val i: Int = tmp0_iterator.next() } } diff --git a/compiler/testData/ir/irText/expressions/forWithBreakContinue.kt.txt b/compiler/testData/ir/irText/expressions/forWithBreakContinue.kt.txt index 361ffee9399..103f58c1e4d 100644 --- a/compiler/testData/ir/irText/expressions/forWithBreakContinue.kt.txt +++ b/compiler/testData/ir/irText/expressions/forWithBreakContinue.kt.txt @@ -1,9 +1,9 @@ fun testForBreak1(ss: List) { - { //BLOCK + { // BLOCK val tmp0_iterator: Iterator = ss.iterator() - while (tmp0_iterator.hasNext()) { //BLOCK + while (tmp0_iterator.hasNext()) { // BLOCK val s: String = tmp0_iterator.next() - { //BLOCK + { // BLOCK break } } @@ -11,16 +11,16 @@ fun testForBreak1(ss: List) { } fun testForBreak2(ss: List) { - { //BLOCK + { // BLOCK val tmp0_iterator: Iterator = ss.iterator() - while (tmp0_iterator.hasNext()) { //BLOCK + while (tmp0_iterator.hasNext()) { // BLOCK val s1: String = tmp0_iterator.next() - { //BLOCK - { //BLOCK + { // BLOCK + { // BLOCK val tmp1_iterator: Iterator = ss.iterator() - while (tmp1_iterator.hasNext()) { //BLOCK + while (tmp1_iterator.hasNext()) { // BLOCK val s2: String = tmp1_iterator.next() - { //BLOCK + { // BLOCK break break break @@ -34,11 +34,11 @@ fun testForBreak2(ss: List) { } fun testForContinue1(ss: List) { - { //BLOCK + { // BLOCK val tmp0_iterator: Iterator = ss.iterator() - while (tmp0_iterator.hasNext()) { //BLOCK + while (tmp0_iterator.hasNext()) { // BLOCK val s: String = tmp0_iterator.next() - { //BLOCK + { // BLOCK continue } } @@ -46,16 +46,16 @@ fun testForContinue1(ss: List) { } fun testForContinue2(ss: List) { - { //BLOCK + { // BLOCK val tmp0_iterator: Iterator = ss.iterator() - while (tmp0_iterator.hasNext()) { //BLOCK + while (tmp0_iterator.hasNext()) { // BLOCK val s1: String = tmp0_iterator.next() - { //BLOCK - { //BLOCK + { // BLOCK + { // BLOCK val tmp1_iterator: Iterator = ss.iterator() - while (tmp1_iterator.hasNext()) { //BLOCK + while (tmp1_iterator.hasNext()) { // BLOCK val s2: String = tmp1_iterator.next() - { //BLOCK + { // BLOCK continue continue continue diff --git a/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt index 7cb41718f38..b2b23e39172 100644 --- a/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt +++ b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt @@ -37,9 +37,9 @@ interface IReceiver { } operator fun IntCell.next(): Int { - return { //BLOCK + return { // BLOCK val tmp0_this: IntCell = - { //BLOCK + { // BLOCK val tmp1: Int = tmp0_this.() tmp0_this.( = tmp1.dec()) tmp1 @@ -53,11 +53,11 @@ interface IReceiver { } fun IReceiver.test() { - { //BLOCK + { // BLOCK val tmp0_iterator: IntCell = .iterator($receiver = FiveTimes) - while (.hasNext($receiver = tmp0_iterator)) { //BLOCK + while (.hasNext($receiver = tmp0_iterator)) { // BLOCK val i: Int = .next($receiver = tmp0_iterator) - { //BLOCK + { // BLOCK println(message = i) } } diff --git a/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt index cca51d2739b..9f09ca71bd9 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt @@ -22,7 +22,7 @@ class J { } val fsi: Fn - field = { //BLOCK + field = { // BLOCK local class : Fn { constructor() /* primary */ { TODO("IrDelegatingConstructorCall") @@ -45,7 +45,7 @@ val fsi: Fn get val fis: Fn - field = { //BLOCK + field = { // BLOCK local class : Fn { constructor() /* primary */ { TODO("IrDelegatingConstructorCall") diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.kt.txt index 2f043ee06e3..91714c66362 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.kt.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.kt.txt @@ -7,7 +7,7 @@ fun interface MyRunnable { fun test(a: Any, r: MyRunnable) { when { - a is MyRunnable -> { //BLOCK + a is MyRunnable -> { // BLOCK foo(rs = [ local fun () { return Unit } diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.kt.txt index a08314e70c3..163d4f2b02d 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.kt.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.kt.txt @@ -21,7 +21,7 @@ fun test0(a: T) where T : KRunnable, T : Function0 { fun test1(a: Function0) { when { - a is KRunnable -> { //BLOCK + a is KRunnable -> { // BLOCK run1(r = a /*as KRunnable */) } } @@ -34,7 +34,7 @@ fun test2(a: KRunnable) { fun test3(a: Function0) { when { - a is KRunnable -> { //BLOCK + a is KRunnable -> { // BLOCK run2(r1 = a /*as KRunnable */, r2 = a /*as KRunnable */) } } @@ -42,7 +42,7 @@ fun test3(a: Function0) { fun test4(a: Function0, b: Function0) { when { - a is KRunnable -> { //BLOCK + a is KRunnable -> { // BLOCK run2(r1 = a /*as KRunnable */, r2 = b /*-> KRunnable */) } } @@ -50,7 +50,7 @@ fun test4(a: Function0, b: Function0) { fun test5(a: Any) { when { - a is KRunnable -> { //BLOCK + a is KRunnable -> { // BLOCK run1(r = a /*as KRunnable */) } } @@ -58,7 +58,7 @@ fun test5(a: Any) { fun test5x(a: Any) { when { - a is KRunnable -> { //BLOCK + a is KRunnable -> { // BLOCK a as Function0 /*~> Unit */ run1(r = a /*as KRunnable */) } diff --git a/compiler/testData/ir/irText/expressions/ifElseIf.kt.txt b/compiler/testData/ir/irText/expressions/ifElseIf.kt.txt index 04dca45f626..158a5e08ddc 100644 --- a/compiler/testData/ir/irText/expressions/ifElseIf.kt.txt +++ b/compiler/testData/ir/irText/expressions/ifElseIf.kt.txt @@ -8,7 +8,7 @@ fun test(i: Int): Int { fun testEmptyBranches1(flag: Boolean) { when { - flag -> { //BLOCK + flag -> { // BLOCK } true -> true /*~> Unit */ } @@ -19,20 +19,20 @@ fun testEmptyBranches1(flag: Boolean) { fun testEmptyBranches2(flag: Boolean) { when { - flag -> { //BLOCK + flag -> { // BLOCK } true -> true /*~> Unit */ } when { flag -> true /*~> Unit */ - true -> { //BLOCK + true -> { // BLOCK } } } fun testEmptyBranches3(flag: Boolean) { when { - flag -> { //BLOCK + flag -> { // BLOCK } true -> true /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/incrementDecrement.kt.txt b/compiler/testData/ir/irText/expressions/incrementDecrement.kt.txt index 37c658b7a50..74c0b03838d 100644 --- a/compiler/testData/ir/irText/expressions/incrementDecrement.kt.txt +++ b/compiler/testData/ir/irText/expressions/incrementDecrement.kt.txt @@ -9,11 +9,11 @@ val arr: IntArray fun testVarPrefix() { var x: Int = 0 - val x1: Int = { //BLOCK + val x1: Int = { // BLOCK x = x.inc() x } - val x2: Int = { //BLOCK + val x2: Int = { // BLOCK x = x.dec() x } @@ -21,12 +21,12 @@ fun testVarPrefix() { fun testVarPostfix() { var x: Int = 0 - val x1: Int = { //BLOCK + val x1: Int = { // BLOCK val tmp0: Int = x x = tmp0.inc() tmp0 } - val x2: Int = { //BLOCK + val x2: Int = { // BLOCK val tmp1: Int = x x = tmp1.dec() tmp1 @@ -34,14 +34,14 @@ fun testVarPostfix() { } fun testPropPrefix() { - val p1: Int = { //BLOCK - { //BLOCK + val p1: Int = { // BLOCK + { // BLOCK ( = ().inc()) () } } - val p2: Int = { //BLOCK - { //BLOCK + val p2: Int = { // BLOCK + { // BLOCK ( = ().dec()) () } @@ -49,15 +49,15 @@ fun testPropPrefix() { } fun testPropPostfix() { - val p1: Int = { //BLOCK - { //BLOCK + val p1: Int = { // BLOCK + { // BLOCK val tmp0: Int = () ( = tmp0.inc()) tmp0 } } - val p2: Int = { //BLOCK - { //BLOCK + val p2: Int = { // BLOCK + { // BLOCK ( = ().dec()) () } @@ -65,13 +65,13 @@ fun testPropPostfix() { } fun testArrayPrefix() { - val a1: Int = { //BLOCK + val a1: Int = { // BLOCK val tmp0_array: IntArray = () val tmp1_index0: Int = 0 tmp0_array.set(index = tmp1_index0, value = tmp0_array.get(index = tmp1_index0).inc()) tmp0_array.get(index = tmp1_index0) } - val a2: Int = { //BLOCK + val a2: Int = { // BLOCK val tmp2_array: IntArray = () val tmp3_index0: Int = 0 tmp2_array.set(index = tmp3_index0, value = tmp2_array.get(index = tmp3_index0).dec()) @@ -80,14 +80,14 @@ fun testArrayPrefix() { } fun testArrayPostfix() { - val a1: Int = { //BLOCK + val a1: Int = { // BLOCK val tmp0_array: IntArray = () val tmp1_index0: Int = 0 val tmp2: Int = tmp0_array.get(index = tmp1_index0) tmp0_array.set(index = tmp1_index0, value = tmp2.inc()) tmp2 } - val a2: Int = { //BLOCK + val a2: Int = { // BLOCK val tmp3_array: IntArray = () val tmp4_index0: Int = 0 val tmp5: Int = tmp3_array.get(index = tmp4_index0) diff --git a/compiler/testData/ir/irText/expressions/javaSyntheticGenericPropertyAccess.kt.txt b/compiler/testData/ir/irText/expressions/javaSyntheticGenericPropertyAccess.kt.txt index 98c77cbdc76..0d4ca8768c5 100644 --- a/compiler/testData/ir/irText/expressions/javaSyntheticGenericPropertyAccess.kt.txt +++ b/compiler/testData/ir/irText/expressions/javaSyntheticGenericPropertyAccess.kt.txt @@ -1,15 +1,15 @@ fun test(j: J) { j.getFoo() /*~> Unit */ j.setFoo(x = 1) - { //BLOCK + { // BLOCK val tmp0_receiver: J = j - { //BLOCK + { // BLOCK val tmp1: Int = tmp0_receiver.getFoo() tmp0_receiver.setFoo(x = tmp1.inc()) tmp1 } } /*~> Unit */ - { //BLOCK + { // BLOCK val tmp2_receiver: J = j tmp2_receiver.setFoo(x = tmp2_receiver.getFoo().plus(other = 1)) } diff --git a/compiler/testData/ir/irText/expressions/javaSyntheticPropertyAccess.kt.txt b/compiler/testData/ir/irText/expressions/javaSyntheticPropertyAccess.kt.txt index 5ba46d3caee..67c0f252354 100644 --- a/compiler/testData/ir/irText/expressions/javaSyntheticPropertyAccess.kt.txt +++ b/compiler/testData/ir/irText/expressions/javaSyntheticPropertyAccess.kt.txt @@ -1,15 +1,15 @@ fun test(j: J) { j.getFoo() /*~> Unit */ j.setFoo(x = 1) - { //BLOCK + { // BLOCK val tmp0_receiver: J = j - { //BLOCK + { // BLOCK val tmp1: Int = tmp0_receiver.getFoo() tmp0_receiver.setFoo(x = tmp1.inc()) tmp1 } } /*~> Unit */ - { //BLOCK + { // BLOCK val tmp2_receiver: J = j tmp2_receiver.setFoo(x = tmp2_receiver.getFoo().plus(other = 1)) } diff --git a/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt index 4ccf6c4bd1f..06d44251ce8 100644 --- a/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt @@ -20,7 +20,7 @@ class TestClass { val test: Int field = when { - true -> { //BLOCK + true -> { // BLOCK #out /*!! PrintStream */.println(p0 = "TestClass/test") 42 } diff --git a/compiler/testData/ir/irText/expressions/kt16904.kt.txt b/compiler/testData/ir/irText/expressions/kt16904.kt.txt index f3b9ea81a45..955aaa204a8 100644 --- a/compiler/testData/ir/irText/expressions/kt16904.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt16904.kt.txt @@ -39,11 +39,11 @@ class Test1 : A { TODO("IrDelegatingConstructorCall") /* InstanceInitializerCall */ - { //BLOCK + { // BLOCK val tmp0_this: Test1 = tmp0_this.().plusAssign(x = 42) } - { //BLOCK + { // BLOCK val tmp1_this: Test1 = tmp1_this.( = tmp1_this.().plus(other = 42)) } diff --git a/compiler/testData/ir/irText/expressions/kt24804.kt.txt b/compiler/testData/ir/irText/expressions/kt24804.kt.txt index 55eef83097a..4a437a80b86 100644 --- a/compiler/testData/ir/irText/expressions/kt24804.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt24804.kt.txt @@ -4,7 +4,7 @@ inline fun foo(): Boolean { fun run(x: Boolean, y: Boolean): String { var z: Int = 10 - { //BLOCK + { // BLOCK do// COMPOSITE { z = z.plus(other = 1) when { diff --git a/compiler/testData/ir/irText/expressions/kt27933.kt.txt b/compiler/testData/ir/irText/expressions/kt27933.kt.txt index 93a84bbe326..204ef061ef7 100644 --- a/compiler/testData/ir/irText/expressions/kt27933.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt27933.kt.txt @@ -1,7 +1,7 @@ fun box(): String { var r: String = "" when { - EQEQ(arg0 = r, arg1 = "").not() -> { //BLOCK + EQEQ(arg0 = r, arg1 = "").not() -> { // BLOCK } true -> r = r.plus(other = "O") } diff --git a/compiler/testData/ir/irText/expressions/kt28456.kt.txt b/compiler/testData/ir/irText/expressions/kt28456.kt.txt index 610133346bd..9d097e282a3 100644 --- a/compiler/testData/ir/irText/expressions/kt28456.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt28456.kt.txt @@ -22,7 +22,7 @@ fun testSimpleAssignment(a: A) { } fun testPostfixIncrement(a: A): Int { - return { //BLOCK + return { // BLOCK val tmp0_array: A = a val tmp1_index0: Int = 1 val tmp2_index1: Int = 2 @@ -33,7 +33,7 @@ fun testPostfixIncrement(a: A): Int { } fun testCompoundAssignment(a: A) { - { //BLOCK + { // BLOCK val tmp0_array: A = a val tmp1_index0: Int = 1 val tmp2_index1: Int = 2 diff --git a/compiler/testData/ir/irText/expressions/kt28456b.kt.txt b/compiler/testData/ir/irText/expressions/kt28456b.kt.txt index 07efb170f58..19be20de821 100644 --- a/compiler/testData/ir/irText/expressions/kt28456b.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt28456b.kt.txt @@ -22,7 +22,7 @@ fun testSimpleAssignment(a: A) { } fun testPostfixIncrement(a: A): Int { - return { //BLOCK + return { // BLOCK val tmp0_array: A = a val tmp1_index0: Int = 1 val tmp2: Int = get($receiver = tmp0_array, i = tmp1_index0) @@ -32,7 +32,7 @@ fun testPostfixIncrement(a: A): Int { } fun testCompoundAssignment(a: A) { - { //BLOCK + { // BLOCK val tmp0_array: A = a val tmp1_index0: Int = 1 set($receiver = tmp0_array, i = tmp1_index0, v = get($receiver = tmp0_array, i = tmp1_index0).plus(other = 10)) diff --git a/compiler/testData/ir/irText/expressions/kt30020.kt.txt b/compiler/testData/ir/irText/expressions/kt30020.kt.txt index 4b7723bab37..24d63966eb3 100644 --- a/compiler/testData/ir/irText/expressions/kt30020.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt30020.kt.txt @@ -9,21 +9,21 @@ interface X { } fun test(x: X, nx: X?) { - { //BLOCK + { // BLOCK val tmp0_this: X = x plusAssign($receiver = tmp0_this.(), element = 1) } plusAssign($receiver = x.f(), element = 2) plusAssign($receiver = x.() as MutableList, element = 3) plusAssign($receiver = x.f() as MutableList, element = 4) - plusAssign($receiver = CHECK_NOT_NULL>(arg0 = { //BLOCK + plusAssign($receiver = CHECK_NOT_NULL>(arg0 = { // BLOCK val tmp1_safe_receiver: X? = nx when { EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null true -> tmp1_safe_receiver.() } }), element = 5) - plusAssign($receiver = CHECK_NOT_NULL>(arg0 = { //BLOCK + plusAssign($receiver = CHECK_NOT_NULL>(arg0 = { // BLOCK val tmp2_safe_receiver: X? = nx when { EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null diff --git a/compiler/testData/ir/irText/expressions/kt30796.kt.txt b/compiler/testData/ir/irText/expressions/kt30796.kt.txt index 9af83d46b08..12526d1473e 100644 --- a/compiler/testData/ir/irText/expressions/kt30796.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt30796.kt.txt @@ -3,17 +3,17 @@ fun magic(): T { } fun test(value: T, value2: T) { - val x1: Any = { //BLOCK + val x1: Any = { // BLOCK val tmp0_elvis_lhs: T = value when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> 42 true -> tmp0_elvis_lhs } } - val x2: Any = { //BLOCK + val x2: Any = { // BLOCK val tmp2_elvis_lhs: T = value when { - EQEQ(arg0 = tmp2_elvis_lhs, arg1 = null) -> { //BLOCK + EQEQ(arg0 = tmp2_elvis_lhs, arg1 = null) -> { // BLOCK val tmp1_elvis_lhs: T = value2 when { EQEQ(arg0 = tmp1_elvis_lhs, arg1 = null) -> 42 @@ -23,8 +23,8 @@ fun test(value: T, value2: T) { true -> tmp2_elvis_lhs } } - val x3: Any = { //BLOCK - val tmp4_elvis_lhs: T = { //BLOCK + val x3: Any = { // BLOCK + val tmp4_elvis_lhs: T = { // BLOCK val tmp3_elvis_lhs: T = value when { EQEQ(arg0 = tmp3_elvis_lhs, arg1 = null) -> value2 @@ -36,8 +36,8 @@ fun test(value: T, value2: T) { true -> tmp4_elvis_lhs } } - val x4: Any = { //BLOCK - val tmp6_elvis_lhs: T = { //BLOCK + val x4: Any = { // BLOCK + val tmp6_elvis_lhs: T = { // BLOCK val tmp5_elvis_lhs: T = value when { EQEQ(arg0 = tmp5_elvis_lhs, arg1 = null) -> value2 @@ -49,15 +49,15 @@ fun test(value: T, value2: T) { true -> tmp6_elvis_lhs } } - val x5: Any = { //BLOCK + val x5: Any = { // BLOCK val tmp7_elvis_lhs: Any? = magic() when { EQEQ(arg0 = tmp7_elvis_lhs, arg1 = null) -> 42 true -> tmp7_elvis_lhs } } - val x6: Any = { //BLOCK - val tmp9_elvis_lhs: Any? = { //BLOCK + val x6: Any = { // BLOCK + val tmp9_elvis_lhs: Any? = { // BLOCK val tmp8_elvis_lhs: T = value when { EQEQ(arg0 = tmp8_elvis_lhs, arg1 = null) -> magic() @@ -69,8 +69,8 @@ fun test(value: T, value2: T) { true -> tmp9_elvis_lhs } } - val x7: Any = { //BLOCK - val tmp11_elvis_lhs: Any? = { //BLOCK + val x7: Any = { // BLOCK + val tmp11_elvis_lhs: Any? = { // BLOCK val tmp10_elvis_lhs: Any? = magic() when { EQEQ(arg0 = tmp10_elvis_lhs, arg1 = null) -> value diff --git a/compiler/testData/ir/irText/expressions/kt36956.kt.txt b/compiler/testData/ir/irText/expressions/kt36956.kt.txt index 83ffb5581e1..90da1570330 100644 --- a/compiler/testData/ir/irText/expressions/kt36956.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt36956.kt.txt @@ -26,7 +26,7 @@ val aFloat: A get val aInt: Float - field = { //BLOCK + field = { // BLOCK val tmp0_array: A = () val tmp1_index0: Int = 1 val tmp2: Float = tmp0_array.get(i = tmp1_index0) diff --git a/compiler/testData/ir/irText/expressions/lambdaInCAO.kt.txt b/compiler/testData/ir/irText/expressions/lambdaInCAO.kt.txt index b86ae164b7f..76d87b6809b 100644 --- a/compiler/testData/ir/irText/expressions/lambdaInCAO.kt.txt +++ b/compiler/testData/ir/irText/expressions/lambdaInCAO.kt.txt @@ -16,7 +16,7 @@ fun test1(a: Any) { } fun test2(a: Any) { - { //BLOCK + { // BLOCK val tmp0_array: Any = a val tmp1_index0: Function0 = local fun () { return Unit @@ -27,7 +27,7 @@ fun test2(a: Any) { } fun test3(a: Any) { - { //BLOCK + { // BLOCK val tmp0_array: Any = a val tmp1_index0: Function0 = local fun () { return Unit diff --git a/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt b/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt index a931c661a06..570c8ea6ce0 100644 --- a/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt +++ b/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt @@ -38,7 +38,7 @@ class Host { get fun Outer.test(): Inner { - return { //BLOCK + return { // BLOCK local class : Inner { constructor() /* primary */ { TODO("IrDelegatingConstructorCall") diff --git a/compiler/testData/ir/irText/expressions/objectReference.kt.txt b/compiler/testData/ir/irText/expressions/objectReference.kt.txt index ea15cb71400..302e727b38a 100644 --- a/compiler/testData/ir/irText/expressions/objectReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/objectReference.kt.txt @@ -57,7 +57,7 @@ object Z { get val anObject: Any - field = { //BLOCK + field = { // BLOCK local class { constructor() /* primary */ { TODO("IrDelegatingConstructorCall") diff --git a/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt b/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt index d6b7db03636..775ce838759 100644 --- a/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt +++ b/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt @@ -16,7 +16,7 @@ class C { } fun test(nc: C?) { - { //BLOCK + { // BLOCK val tmp0_safe_receiver: C? = nc when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null /*~> Unit */ diff --git a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt index 325d9e64596..dd5c708cf03 100644 --- a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt +++ b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt @@ -20,7 +20,7 @@ var C?.p: Int } operator fun Int?.inc(): Int? { - return { //BLOCK + return { // BLOCK val tmp0_safe_receiver: Int? = when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null @@ -37,13 +37,13 @@ operator fun Int?.set(index: Int, value: Int) { } fun testProperty(nc: C?) { - { //BLOCK + { // BLOCK val tmp0_safe_receiver: C? = nc when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> { //BLOCK + true -> { // BLOCK val tmp1_receiver: C? = tmp0_safe_receiver - { //BLOCK + { // BLOCK val tmp2: Int = ($receiver = tmp1_receiver) ($receiver = tmp1_receiver, value = inc($receiver = tmp2)) tmp2 @@ -54,8 +54,8 @@ fun testProperty(nc: C?) { } fun testArrayAccess(nc: C?) { - { //BLOCK - val tmp1_array: Int? = { //BLOCK + { // BLOCK + val tmp1_array: Int? = { // BLOCK val tmp0_safe_receiver: C? = nc when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null diff --git a/compiler/testData/ir/irText/expressions/safeCalls.kt.txt b/compiler/testData/ir/irText/expressions/safeCalls.kt.txt index 01a40661271..aa175df6b49 100644 --- a/compiler/testData/ir/irText/expressions/safeCalls.kt.txt +++ b/compiler/testData/ir/irText/expressions/safeCalls.kt.txt @@ -26,7 +26,7 @@ interface IHost { } fun test1(x: String?): Int? { - return { //BLOCK + return { // BLOCK val tmp0_safe_receiver: String? = x when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null @@ -36,7 +36,7 @@ fun test1(x: String?): Int? { } fun test2(x: String?): Int? { - return { //BLOCK + return { // BLOCK val tmp0_safe_receiver: String? = x when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null @@ -46,7 +46,7 @@ fun test2(x: String?): Int? { } fun test3(x: String?, y: Any?): Boolean? { - return { //BLOCK + return { // BLOCK val tmp0_safe_receiver: String? = x when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null @@ -56,7 +56,7 @@ fun test3(x: String?, y: Any?): Boolean? { } fun test4(x: Ref?) { - { //BLOCK + { // BLOCK val tmp0_safe_receiver: Ref? = x when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null /*~> Unit */ @@ -66,7 +66,7 @@ fun test4(x: Ref?) { } fun IHost.test5(s: String?): Int? { - return { //BLOCK + return { // BLOCK val tmp0_safe_receiver: String? = s when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null @@ -80,7 +80,7 @@ fun Int.foo(): Int { } fun box() { - { //BLOCK + { // BLOCK val tmp0_safe_receiver: Int = 42 when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null diff --git a/compiler/testData/ir/irText/expressions/sam/genericSamSmartcast.kt.txt b/compiler/testData/ir/irText/expressions/sam/genericSamSmartcast.kt.txt index 1f3d46dbcf1..39514e81528 100644 --- a/compiler/testData/ir/irText/expressions/sam/genericSamSmartcast.kt.txt +++ b/compiler/testData/ir/irText/expressions/sam/genericSamSmartcast.kt.txt @@ -1,6 +1,6 @@ fun f(x: Any): String { when { - x is A<*> -> { //BLOCK + x is A<*> -> { // BLOCK return x /*as A */.call(block = local fun (y: Any?): @FlexibleNullability String? { return "OK" } diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.kt.txt index cc591c082b1..8fbbf0f2a7e 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.kt.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.kt.txt @@ -1,6 +1,6 @@ fun test1(a: Function0) { when { - a is Runnable -> { //BLOCK + a is Runnable -> { // BLOCK runStatic(r = a /*as Runnable */) } } @@ -8,7 +8,7 @@ fun test1(a: Function0) { fun test2(a: Function0) { when { - a is Runnable -> { //BLOCK + a is Runnable -> { // BLOCK TODO("IrConstructorCall").run1(r = a /*as Runnable */) } } @@ -16,7 +16,7 @@ fun test2(a: Function0) { fun test3(a: Function0) { when { - a is Runnable -> { //BLOCK + a is Runnable -> { // BLOCK TODO("IrConstructorCall").run2(r1 = a /*as Runnable */, r2 = a /*as Runnable */) } } @@ -24,7 +24,7 @@ fun test3(a: Function0) { fun test4(a: Function0, b: Function0) { when { - a is Runnable -> { //BLOCK + a is Runnable -> { // BLOCK TODO("IrConstructorCall").run2(r1 = a /*-> @FlexibleNullability Runnable? */, r2 = b /*-> @FlexibleNullability Runnable? */) } } @@ -32,7 +32,7 @@ fun test4(a: Function0, b: Function0) { fun test5(a: Any) { when { - a is Runnable -> { //BLOCK + a is Runnable -> { // BLOCK TODO("IrConstructorCall").run1(r = a /*as Runnable */) } } @@ -40,7 +40,7 @@ fun test5(a: Any) { fun test5x(a: Any) { when { - a is Runnable -> { //BLOCK + a is Runnable -> { // BLOCK a as Function0 /*~> Unit */ TODO("IrConstructorCall").run1(r = a /*as Runnable */) } diff --git a/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt index 8cd1a219d9f..382a7e2aa37 100644 --- a/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt +++ b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt @@ -7,7 +7,7 @@ class Derived : Base { fun setValue(v: Any) { when { - v is String -> { //BLOCK + v is String -> { // BLOCK #value = v /*as String */ } } diff --git a/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt b/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt index aacf697d0fe..19c59c3abcd 100644 --- a/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt +++ b/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt @@ -21,7 +21,7 @@ fun produceFun(): Function0 { } fun testSimple(fn: Function0) { - useSuspend(sfn = { //BLOCK + useSuspend(sfn = { // BLOCK local suspend fun Function0.suspendConversion0() { callee.invoke() } @@ -32,7 +32,7 @@ fun testSimple(fn: Function0) { } fun testSimpleNonVal() { - useSuspend(sfn = { //BLOCK + useSuspend(sfn = { // BLOCK local suspend fun Function0.suspendConversion0() { callee.invoke() } @@ -43,7 +43,7 @@ fun testSimpleNonVal() { } fun testExtAsExt(fn: @ExtensionFunctionType Function1) { - useSuspendExt(sfn = { //BLOCK + useSuspendExt(sfn = { // BLOCK local suspend fun @ExtensionFunctionType Function1.suspendConversion0(p0: Int) { callee.invoke(p1 = p0) } @@ -54,7 +54,7 @@ fun testExtAsExt(fn: @ExtensionFunctionType Function1) { } fun testExtAsSimple(fn: @ExtensionFunctionType Function1) { - useSuspendArg(sfn = { //BLOCK + useSuspendArg(sfn = { // BLOCK local suspend fun Function1.suspendConversion0(p0: Int) { callee.invoke(p1 = p0) } @@ -65,7 +65,7 @@ fun testExtAsSimple(fn: @ExtensionFunctionType Function1) { } fun testSimpleAsExt(fn: Function1) { - useSuspendExt(sfn = { //BLOCK + useSuspendExt(sfn = { // BLOCK local suspend fun @ExtensionFunctionType Function1.suspendConversion0(p0: Int) { callee.invoke(p1 = p0) } @@ -76,7 +76,7 @@ fun testSimpleAsExt(fn: Function1) { } fun testSimpleAsSimpleT(fn: Function1) { - useSuspendArgT(sfn = { //BLOCK + useSuspendArgT(sfn = { // BLOCK local suspend fun Function1.suspendConversion0(p0: Int) { callee.invoke(p1 = p0) } @@ -87,7 +87,7 @@ fun testSimpleAsSimpleT(fn: Function1) { } fun testSimpleAsExtT(fn: Function1) { - useSuspendExtT(sfn = { //BLOCK + useSuspendExtT(sfn = { // BLOCK local suspend fun @ExtensionFunctionType Function1.suspendConversion0(p0: Int) { callee.invoke(p1 = p0) } @@ -98,7 +98,7 @@ fun testSimpleAsExtT(fn: Function1) { } fun testExtAsSimpleT(fn: @ExtensionFunctionType Function1) { - useSuspendArgT(sfn = { //BLOCK + useSuspendArgT(sfn = { // BLOCK local suspend fun Function1.suspendConversion0(p0: Int) { callee.invoke(p1 = p0) } @@ -109,7 +109,7 @@ fun testExtAsSimpleT(fn: @ExtensionFunctionType Function1) { } fun testExtAsExtT(fn: @ExtensionFunctionType Function1) { - useSuspendExtT(sfn = { //BLOCK + useSuspendExtT(sfn = { // BLOCK local suspend fun @ExtensionFunctionType Function1.suspendConversion0(p0: Int) { callee.invoke(p1 = p0) } @@ -120,7 +120,7 @@ fun testExtAsExtT(fn: @ExtensionFunctionType Function1) { } fun testSimpleSAsSimpleT(fn: Function1) { - useSuspendArgT(sfn = { //BLOCK + useSuspendArgT(sfn = { // BLOCK local suspend fun Function1.suspendConversion0(p0: S) { callee.invoke(p1 = p0) } @@ -131,7 +131,7 @@ fun testSimpleSAsSimpleT(fn: Function1) { } fun testSimpleSAsExtT(fn: Function1) { - useSuspendExtT(sfn = { //BLOCK + useSuspendExtT(sfn = { // BLOCK local suspend fun @ExtensionFunctionType Function1.suspendConversion0(p0: S) { callee.invoke(p1 = p0) } @@ -142,7 +142,7 @@ fun testSimpleSAsExtT(fn: Function1) { } fun testExtSAsSimpleT(fn: @ExtensionFunctionType Function1) { - useSuspendArgT(sfn = { //BLOCK + useSuspendArgT(sfn = { // BLOCK local suspend fun Function1.suspendConversion0(p0: S) { callee.invoke(p1 = p0) } @@ -153,7 +153,7 @@ fun testExtSAsSimpleT(fn: @ExtensionFunctionType Function1) } fun testExtSAsExtT(fn: @ExtensionFunctionType Function1) { - useSuspendExtT(sfn = { //BLOCK + useSuspendExtT(sfn = { // BLOCK local suspend fun @ExtensionFunctionType Function1.suspendConversion0(p0: S) { callee.invoke(p1 = p0) } @@ -165,7 +165,7 @@ fun testExtSAsExtT(fn: @ExtensionFunctionType Function1) { fun testSmartCastWithSuspendConversion(a: Any) { a as Function0 /*~> Unit */ - useSuspend(sfn = { //BLOCK + useSuspend(sfn = { // BLOCK local suspend fun Function0.suspendConversion0() { callee.invoke() } @@ -178,7 +178,7 @@ fun testSmartCastWithSuspendConversion(a: Any) { fun testSmartCastOnVarWithSuspendConversion(a: Any) { var b: Any = a b as Function0 /*~> Unit */ - useSuspend(sfn = { //BLOCK + useSuspend(sfn = { // BLOCK local suspend fun Function0.suspendConversion0() { callee.invoke() } diff --git a/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt b/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt index 9247da77c6c..380fc2d7a00 100644 --- a/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt +++ b/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt @@ -9,7 +9,7 @@ class C { get init { - #s = { //BLOCK + #s = { // BLOCK val tmp0_safe_receiver: Any? = x when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null diff --git a/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt b/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt index 5aa5c99dbef..8da74d6a5a8 100644 --- a/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt +++ b/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt @@ -31,7 +31,7 @@ class Outer { } fun Outer.test(): Inner { - return { //BLOCK + return { // BLOCK local class : Inner { constructor() /* primary */ { TODO("IrDelegatingConstructorCall") diff --git a/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt b/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt index 160498490c3..fb28868a546 100644 --- a/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt +++ b/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt @@ -1,5 +1,5 @@ fun WithCompanion.test() { - val test1: = { //BLOCK + val test1: = { // BLOCK local class : WithCompanion { constructor() /* primary */ { TODO("IrDelegatingConstructorCall") @@ -15,7 +15,7 @@ fun WithCompanion.test() { TODO("IrConstructorCall") } - val test2: = { //BLOCK + val test2: = { // BLOCK local class : WithCompanion { constructor() /* primary */ { TODO("IrDelegatingConstructorCall") diff --git a/compiler/testData/ir/irText/expressions/throw.kt.txt b/compiler/testData/ir/irText/expressions/throw.kt.txt index ab082bfb927..fdd10538152 100644 --- a/compiler/testData/ir/irText/expressions/throw.kt.txt +++ b/compiler/testData/ir/irText/expressions/throw.kt.txt @@ -4,7 +4,7 @@ fun test1() { fun testImplicitCast(a: Any) { when { - a is Throwable -> { //BLOCK + a is Throwable -> { // BLOCK throw a /*as Throwable */ } } diff --git a/compiler/testData/ir/irText/expressions/tryCatch.kt.txt b/compiler/testData/ir/irText/expressions/tryCatch.kt.txt index 20dc663e17b..999a57277cc 100644 --- a/compiler/testData/ir/irText/expressions/tryCatch.kt.txt +++ b/compiler/testData/ir/irText/expressions/tryCatch.kt.txt @@ -1,25 +1,25 @@ fun test1() { - try { //BLOCK + try { // BLOCK println() } - catch (...) { //BLOCK + catch (...) { // BLOCK println() } - finally { //BLOCK + finally { // BLOCK println() } } fun test2(): Int { - return try { //BLOCK + return try { // BLOCK println() 42 } - catch (...) { //BLOCK + catch (...) { // BLOCK println() 24 } - finally { //BLOCK + finally { // BLOCK println() 555 /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.kt.txt b/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.kt.txt index f629a1d3fc9..9dd92f483db 100644 --- a/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.kt.txt +++ b/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.kt.txt @@ -2,10 +2,10 @@ fun testImplicitCast(a: Any) { when { a !is String -> return Unit } - val t: String = try { //BLOCK + val t: String = try { // BLOCK a } /*as String */ - catch (...) { //BLOCK + catch (...) { // BLOCK "" } diff --git a/compiler/testData/ir/irText/expressions/variableAsFunctionCall.kt.txt b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.kt.txt index 6ee5073ed4e..a60aecfe3c1 100644 --- a/compiler/testData/ir/irText/expressions/variableAsFunctionCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.kt.txt @@ -18,8 +18,8 @@ fun test3(): String { } fun test4(ns: String?): String? { - return { //BLOCK - val tmp1_safe_receiver: Function0? = { //BLOCK + return { // BLOCK + val tmp1_safe_receiver: Function0? = { // BLOCK val tmp0_safe_receiver: String? = ns when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null diff --git a/compiler/testData/ir/irText/expressions/when.kt.txt b/compiler/testData/ir/irText/expressions/when.kt.txt index d1d46871060..74e681094a3 100644 --- a/compiler/testData/ir/irText/expressions/when.kt.txt +++ b/compiler/testData/ir/irText/expressions/when.kt.txt @@ -11,7 +11,7 @@ object A { } fun testWithSubject(x: Any?): String { - return { //BLOCK + return { // BLOCK val tmp0_subject: Any? = x when { EQEQ(arg0 = tmp0_subject, arg1 = null) -> "null" @@ -36,7 +36,7 @@ fun test(x: Any?): String { } fun testComma(x: Int): String { - return { //BLOCK + return { // BLOCK val tmp0_subject: Int = x when { when { diff --git a/compiler/testData/ir/irText/expressions/whenCoercedToUnit.kt.txt b/compiler/testData/ir/irText/expressions/whenCoercedToUnit.kt.txt index f43dc7c7d66..efb76684766 100644 --- a/compiler/testData/ir/irText/expressions/whenCoercedToUnit.kt.txt +++ b/compiler/testData/ir/irText/expressions/whenCoercedToUnit.kt.txt @@ -1,5 +1,5 @@ fun foo(x: Int) { - { //BLOCK + { // BLOCK val tmp0_subject: Int = x when { EQEQ(arg0 = tmp0_subject, arg1 = 0) -> 0 /*~> Unit */ diff --git a/compiler/testData/ir/irText/expressions/whenReturn.kt.txt b/compiler/testData/ir/irText/expressions/whenReturn.kt.txt index 0a6b0fd9593..aeb3926d9f1 100644 --- a/compiler/testData/ir/irText/expressions/whenReturn.kt.txt +++ b/compiler/testData/ir/irText/expressions/whenReturn.kt.txt @@ -1,5 +1,5 @@ fun toString(grade: String): String { - { //BLOCK + { // BLOCK val tmp0_subject: String = grade when { EQEQ(arg0 = tmp0_subject, arg1 = "A") -> return "Excellent" diff --git a/compiler/testData/ir/irText/expressions/whenReturnUnit.kt.txt b/compiler/testData/ir/irText/expressions/whenReturnUnit.kt.txt index cf685aacbea..f4137c00118 100644 --- a/compiler/testData/ir/irText/expressions/whenReturnUnit.kt.txt +++ b/compiler/testData/ir/irText/expressions/whenReturnUnit.kt.txt @@ -3,7 +3,7 @@ fun run(block: Function0) { fun branch(x: Int) { return run(block = local fun () { - { //BLOCK + { // BLOCK val tmp0_subject: Int = x when { EQEQ(arg0 = tmp0_subject, arg1 = 1) -> TODO(reason = "1") diff --git a/compiler/testData/ir/irText/expressions/whenUnusedExpression.kt.txt b/compiler/testData/ir/irText/expressions/whenUnusedExpression.kt.txt index 48b6c1f32c2..baed6e41583 100644 --- a/compiler/testData/ir/irText/expressions/whenUnusedExpression.kt.txt +++ b/compiler/testData/ir/irText/expressions/whenUnusedExpression.kt.txt @@ -1,7 +1,7 @@ fun test(b: Boolean, i: Int) { when { - b -> { //BLOCK - { //BLOCK + b -> { // BLOCK + { // BLOCK val tmp0_subject: Int = i when { EQEQ(arg0 = tmp0_subject, arg1 = 0) -> 1 /*~> Unit */ diff --git a/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.kt.txt b/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.kt.txt index 276726d19f6..5fe9c6b4c04 100644 --- a/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.kt.txt +++ b/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.kt.txt @@ -3,7 +3,7 @@ fun foo(): Any { } fun test(): Int { - return { //BLOCK + return { // BLOCK val y: Any = foo() when { EQEQ(arg0 = y, arg1 = 42) -> 1 diff --git a/compiler/testData/ir/irText/expressions/whileDoWhile.kt.txt b/compiler/testData/ir/irText/expressions/whileDoWhile.kt.txt index ffe8dac5c36..46212964887 100644 --- a/compiler/testData/ir/irText/expressions/whileDoWhile.kt.txt +++ b/compiler/testData/ir/irText/expressions/whileDoWhile.kt.txt @@ -1,31 +1,31 @@ fun test() { var x: Int = 0 while (less(arg0 = x, arg1 = 0)) - while (less(arg0 = x, arg1 = 5)) { //BLOCK + while (less(arg0 = x, arg1 = 5)) { // BLOCK val tmp0: Int = x x = tmp0.inc() tmp0 } /*~> Unit */ - while (less(arg0 = x, arg1 = 10)) { //BLOCK - { //BLOCK + while (less(arg0 = x, arg1 = 10)) { // BLOCK + { // BLOCK val tmp1: Int = x x = tmp1.inc() tmp1 } /*~> Unit */ } - { //BLOCK + { // BLOCK do while (less(arg0 = x, arg1 = 0)) } - { //BLOCK - do{ //BLOCK + { // BLOCK + do{ // BLOCK val tmp2: Int = x x = tmp2.inc() tmp2 } /*~> Unit */ while (less(arg0 = x, arg1 = 15)) } - { //BLOCK + { // BLOCK do// COMPOSITE { - { //BLOCK + { // BLOCK val tmp3: Int = x x = tmp3.inc() tmp3 @@ -37,10 +37,10 @@ fun test() { fun testSmartcastInCondition() { val a: Any? = null when { - a is Boolean -> { //BLOCK - while (a /*as Boolean */) { //BLOCK + a is Boolean -> { // BLOCK + while (a /*as Boolean */) { // BLOCK } - { //BLOCK + { // BLOCK do// COMPOSITE { // } while (a /*as Boolean */) } diff --git a/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt index 51444e6a76f..3964e87a4cd 100644 --- a/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt +++ b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt @@ -57,12 +57,12 @@ private val registrationMap: HashMap private get fun resolveClashesIfAny(container: ComponentContainer, clashResolvers: List>) { - { //BLOCK + { // BLOCK val tmp0_iterator: Iterator> = clashResolvers.iterator() - while (tmp0_iterator.hasNext()) { //BLOCK + while (tmp0_iterator.hasNext()) { // BLOCK val resolver: PlatformExtensionsClashResolver<*> = tmp0_iterator.next() - { //BLOCK - val clashedComponents: Collection = { //BLOCK + { // BLOCK + val clashedComponents: Collection = { // BLOCK val tmp1_elvis_lhs: Collection? = ().get(key = resolver.()) as? Collection when { EQEQ(arg0 = tmp1_elvis_lhs, arg1 = null) -> continue diff --git a/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt index ef5e95b41a7..dd44f5ebe92 100644 --- a/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt +++ b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt @@ -65,13 +65,13 @@ class DeepCopyIrTreeWithSymbols { } )) withinScope($receiver = .(), irTypeParametersContainer = , fn = local fun () { - { //BLOCK + { // BLOCK val tmp0_iterator: Iterator> = zip($receiver = .(), other = other.()).iterator() - while (tmp0_iterator.hasNext()) { //BLOCK + while (tmp0_iterator.hasNext()) { // BLOCK val tmp1_loop_parameter: Pair = tmp0_iterator.next() val thisTypeParameter: IrTypeParameter = tmp1_loop_parameter.component1() val otherTypeParameter: IrTypeParameter = tmp1_loop_parameter.component2() - { //BLOCK + { // BLOCK mapTo>($receiver = otherTypeParameter.(), destination = thisTypeParameter.(), transform = local fun (it: IrType): IrType { return .().remapType(type = it) } diff --git a/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt b/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt index ac1758bf056..2e326ce32da 100644 --- a/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt +++ b/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt @@ -1,5 +1,5 @@ fun box(): String { - val obj: = { //BLOCK + val obj: = { // BLOCK local class { constructor() /* primary */ { TODO("IrDelegatingConstructorCall") diff --git a/compiler/testData/ir/irText/firProblems/VarInInit.kt.txt b/compiler/testData/ir/irText/firProblems/VarInInit.kt.txt index b0a0634a3c6..fe7198ef8ed 100644 --- a/compiler/testData/ir/irText/firProblems/VarInInit.kt.txt +++ b/compiler/testData/ir/irText/firProblems/VarInInit.kt.txt @@ -12,7 +12,7 @@ class Some { init { when { - less(arg0 = .(), arg1 = 0) -> { //BLOCK + less(arg0 = .(), arg1 = 0) -> { // BLOCK .( = 0) } } diff --git a/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt b/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt index 30d819580f8..d3f666afc67 100644 --- a/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt +++ b/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt @@ -60,7 +60,7 @@ fun foo(candidate: Candidate) { when { me is FirCallableMemberDeclaration<*> -> EQEQ(arg0 = me /*as FirCallableMemberDeclaration> */.(), arg1 = null).not() true -> false - } -> { //BLOCK + } -> { // BLOCK } } } diff --git a/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt b/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt index 8f3c59033f7..f9bd364c41b 100644 --- a/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt +++ b/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt @@ -3,7 +3,7 @@ private const val BACKSLASH: Char private get private fun Reader.nextChar(): Char? { - return { //BLOCK + return { // BLOCK val tmp0_safe_receiver: Int? = takeUnless($receiver = .read(), predicate = local fun (it: Int): Boolean { return EQEQ(arg0 = it, arg1 = -1) } @@ -20,9 +20,9 @@ fun Reader.consumeRestOfQuotedSequence(sb: StringBuilder, quote: Char) { while (when { EQEQ(arg0 = ch, arg1 = null).not() -> EQEQ(arg0 = ch, arg1 = quote).not() true -> false - }) { //BLOCK + }) { // BLOCK when { - EQEQ(arg0 = ch, arg1 = ()) -> { //BLOCK + EQEQ(arg0 = ch, arg1 = ()) -> { // BLOCK val tmp0_safe_receiver: Char? = nextChar($receiver = ) when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null diff --git a/compiler/testData/ir/irText/lambdas/localFunction.kt.txt b/compiler/testData/ir/irText/lambdas/localFunction.kt.txt index f65d2beb7d1..2824390cd82 100644 --- a/compiler/testData/ir/irText/lambdas/localFunction.kt.txt +++ b/compiler/testData/ir/irText/lambdas/localFunction.kt.txt @@ -1,7 +1,7 @@ fun outer() { var x: Int = 0 local fun local() { - { //BLOCK + { // BLOCK val tmp0: Int = x x = tmp0.inc() tmp0 diff --git a/compiler/testData/ir/irText/regressions/coercionInLoop.kt.txt b/compiler/testData/ir/irText/regressions/coercionInLoop.kt.txt index c748f81b178..fab7b050566 100644 --- a/compiler/testData/ir/irText/regressions/coercionInLoop.kt.txt +++ b/compiler/testData/ir/irText/regressions/coercionInLoop.kt.txt @@ -2,12 +2,12 @@ fun box(): String { val a: DoubleArray = TODO("IrConstructorCall") val x: DoubleIterator = a.iterator() var i: Int = 0 - while (x.hasNext()) { //BLOCK + while (x.hasNext()) { // BLOCK when { ieee754equals(arg0 = a.get(index = i), arg1 = x.next()).not() -> return "Fail " + i } - { //BLOCK + { // BLOCK val tmp0: Int = i i = tmp0.inc() tmp0 diff --git a/compiler/testData/ir/irText/regressions/kt24114.kt.txt b/compiler/testData/ir/irText/regressions/kt24114.kt.txt index 53addefba7f..7215c3bba53 100644 --- a/compiler/testData/ir/irText/regressions/kt24114.kt.txt +++ b/compiler/testData/ir/irText/regressions/kt24114.kt.txt @@ -7,12 +7,12 @@ fun two(): Int { } fun test1(): Int { - while (true) { //BLOCK - { //BLOCK + while (true) { // BLOCK + { // BLOCK val tmp0_subject: Int = one() when { - EQEQ(arg0 = tmp0_subject, arg1 = 1) -> { //BLOCK - { //BLOCK + EQEQ(arg0 = tmp0_subject, arg1 = 1) -> { // BLOCK + { // BLOCK val tmp1_subject: Int = two() when { EQEQ(arg0 = tmp1_subject, arg1 = 2) -> return 2 @@ -26,11 +26,11 @@ fun test1(): Int { } fun test2(): Int { - while (true) { //BLOCK - { //BLOCK + while (true) { // BLOCK + { // BLOCK val tmp0_subject: Int = one() when { - EQEQ(arg0 = tmp0_subject, arg1 = 1) -> { //BLOCK + EQEQ(arg0 = tmp0_subject, arg1 = 1) -> { // BLOCK val tmp1_subject: Int = two() when { EQEQ(arg0 = tmp1_subject, arg1 = 2) -> return 2 diff --git a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt index 41a3a294579..60879c7cacd 100644 --- a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt +++ b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt @@ -38,7 +38,7 @@ private fun CoroutineScope.asFairChannel(flow: Flow<*>): ReceiveChannel { return produce($receiver = , block = local suspend fun ProducerScope.() { val channel: ChannelCoroutine = .() as ChannelCoroutine collect($receiver = flow, action = local suspend fun (value: Any?) { - return channel.sendFair(element = { //BLOCK + return channel.sendFair(element = { // BLOCK val tmp0_elvis_lhs: Any? = value when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> TODO("IrConstructorCall") @@ -54,7 +54,7 @@ private fun CoroutineScope.asFairChannel(flow: Flow<*>): ReceiveChannel { private fun CoroutineScope.asChannel(flow: Flow<*>): ReceiveChannel { return produce($receiver = , block = local suspend fun ProducerScope.() { collect($receiver = flow, action = local suspend fun (value: Any?) { - return .().send(e = { //BLOCK + return .().send(e = { // BLOCK val tmp0_elvis_lhs: Any? = value when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> TODO("IrConstructorCall") diff --git a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt index 90607b21952..b8676199a9c 100644 --- a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt +++ b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt @@ -81,7 +81,7 @@ class P { } val Value>.additionalText: P /* by */ - field = { //BLOCK + field = { // BLOCK local class : IDelegate1>, P> { constructor() /* primary */ { TODO("IrDelegatingConstructorCall") @@ -98,7 +98,7 @@ val Value>.additionalText: P /* by */ } private val Value>.deepO: Any? /* by */ - field = { //BLOCK + field = { // BLOCK local class : IDelegate1>, Any?> { constructor() /* primary */ { TODO("IrDelegatingConstructorCall") @@ -131,7 +131,7 @@ val Value>.additionalText: P /* by */ } private val Value>.deepK: Any? /* by */ - field = { //BLOCK + field = { // BLOCK local class : IDelegate1>, Any?> { constructor() /* primary */ { TODO("IrDelegatingConstructorCall") diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt index d8965c05dcc..26b9674931d 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt @@ -2,24 +2,24 @@ fun use(s: P) { } fun testForInListUnused() { - { //BLOCK + { // BLOCK val tmp0_iterator: MutableIterator<@NotNull(...) @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull(...) @EnhancedNullability P> */ /*as MutableList<*> */.iterator() - while (tmp0_iterator.hasNext()) { //BLOCK + while (tmp0_iterator.hasNext()) { // BLOCK val x: @NotNull(...) @EnhancedNullability P = tmp0_iterator.next() - { //BLOCK + { // BLOCK } } } } fun testForInListDestructured() { - { //BLOCK + { // BLOCK val tmp0_iterator: MutableIterator<@NotNull(...) @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull(...) @EnhancedNullability P> */ /*as MutableList<*> */.iterator() - while (tmp0_iterator.hasNext()) { //BLOCK + while (tmp0_iterator.hasNext()) { // BLOCK val tmp1_loop_parameter: @NotNull(...) @EnhancedNullability P = tmp0_iterator.next() val x: Int = tmp1_loop_parameter /*!! @NotNull(...) P */.component1() val y: Int = tmp1_loop_parameter /*!! @NotNull(...) P */.component2() - { //BLOCK + { // BLOCK } } } @@ -27,28 +27,28 @@ fun testForInListDestructured() { fun testDesugaredForInList() { val iterator: MutableIterator<@NotNull(...) @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull(...) @EnhancedNullability P> */ /*as MutableList<*> */.iterator() - while (iterator.hasNext()) { //BLOCK + while (iterator.hasNext()) { // BLOCK val x: @NotNull(...) P = iterator.next() /*!! @NotNull(...) P */ } } fun testForInArrayUnused(j: J) { - { //BLOCK + { // BLOCK val tmp0_iterator: Iterator<@EnhancedNullability P> = j.arrayOfNotNull() /*!! Array */ /*as Array<@EnhancedNullability P> */.iterator() - while (tmp0_iterator.hasNext()) { //BLOCK + while (tmp0_iterator.hasNext()) { // BLOCK val x: @EnhancedNullability P = tmp0_iterator.next() - { //BLOCK + { // BLOCK } } } } fun testForInListUse() { - { //BLOCK + { // BLOCK val tmp0_iterator: MutableIterator<@NotNull(...) @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull(...) @EnhancedNullability P> */ /*as MutableList<*> */.iterator() - while (tmp0_iterator.hasNext()) { //BLOCK + while (tmp0_iterator.hasNext()) { // BLOCK val x: @NotNull(...) @EnhancedNullability P = tmp0_iterator.next() - { //BLOCK + { // BLOCK use(s = x /*!! @NotNull(...) P */) use(s = x) } @@ -57,11 +57,11 @@ fun testForInListUse() { } fun testForInArrayUse(j: J) { - { //BLOCK + { // BLOCK val tmp0_iterator: Iterator<@EnhancedNullability P> = j.arrayOfNotNull() /*!! Array */ /*as Array<@EnhancedNullability P> */.iterator() - while (tmp0_iterator.hasNext()) { //BLOCK + while (tmp0_iterator.hasNext()) { // BLOCK val x: @EnhancedNullability P = tmp0_iterator.next() - { //BLOCK + { // BLOCK use(s = x /*!! P */) use(s = x) } From ef2adfa835de74ec19611c3cd83827ea70ca8b17 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Fri, 6 Nov 2020 01:47:24 +0300 Subject: [PATCH 135/698] [IR] KotlinLikeDumper: better support for calls and annotations * IrCall * IrConstructorCall * IrDelegatingConstructorCall * print arguments for annotations --- .../kotlin/ir/util/KotlinLikeDumper.kt | 104 +++++++++++++----- 1 file changed, 77 insertions(+), 27 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index dc70107b4e6..9aea6843ac1 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -9,6 +9,7 @@ import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.* +import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.ir.types.* import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid @@ -263,11 +264,8 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } private fun IrConstructorCall.printAnAnnotationWithNoIndent(prefix: String = "") { - val clazz = symbol.owner.parentAsClass - assert(clazz.isAnnotationClass) - // TODO render arguments / reuse visitCall or visitConstructorCall - p.printWithNoIndent("@" + (if (prefix.isEmpty()) "" else "$prefix:") + clazz.name.asString()) - if (valueArgumentsCount > 0) p.printWithNoIndent("(...)") + p.printWithNoIndent("@" + (if (prefix.isEmpty()) "" else "$prefix:")) + visitConstructorCall(this) } private fun IrAnnotationContainer.printlnAnnotations(prefix: String = "") { @@ -818,50 +816,101 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } override fun visitCall(expression: IrCall) { - val declaration = expression.symbol.owner + // TODO process specially builtin symbols + expression.printIrFunctionAccessExpressionWithNoIndent( + expression.symbol.owner.name, + superQualifierSymbol = expression.superQualifierSymbol, + omitBracesIfNoArguments = false + ) + } - expression.dispatchReceiver?.let { - it.acceptVoid(this) + override fun visitConstructorCall(expression: IrConstructorCall) { + // TODO could constructors have receiver? + val clazz = expression.symbol.owner.parentAsClass + expression.printIrFunctionAccessExpressionWithNoIndent( + clazz.name, + superQualifierSymbol = null, + omitBracesIfNoArguments = clazz.isAnnotationClass + ) + } + + private fun IrFunctionAccessExpression.printIrFunctionAccessExpressionWithNoIndent( + name: Name, + superQualifierSymbol: IrClassSymbol?, + omitBracesIfNoArguments: Boolean + ) { + // TODO origin + + val twoReceivers = + (dispatchReceiver != null || superQualifierSymbol != null) && extensionReceiver != null + + if (twoReceivers) { + p.printWithNoIndent("(") + } + + superQualifierSymbol?.let { + // TODO should we print super classifier somehow? + p.printWithNoIndent("super") + } + + dispatchReceiver?.let { + if (superQualifierSymbol == null) it.acceptVoid(this@KotlinLikeDumper) + // else assert dispatchReceiver === this + } + if (twoReceivers) { + p.printWithNoIndent(", ") + } + extensionReceiver?.acceptVoid(this@KotlinLikeDumper) + if (twoReceivers) { + p.printWithNoIndent(")") + } + + + if (dispatchReceiver != null || extensionReceiver != null || superQualifierSymbol != null) { p.printWithNoIndent(".") } - p.printWithNoIndent(declaration.name.asString()) + // what if it's unbound + val declaration = symbol.owner - if (expression.typeArgumentsCount > 0) { + p.printWithNoIndent(name.asString()) + + if (typeArgumentsCount > 0) { p.printWithNoIndent("<") - repeat(expression.typeArgumentsCount) { + repeat(typeArgumentsCount) { if (it > 0) { p.printWithNoIndent(", ") } - expression.getTypeArgument(it)!!.printTypeWithNoIndent() + // TODO flag to print type param name? + getTypeArgument(it)!!.printTypeWithNoIndent() } p.printWithNoIndent(">") } - p.printWithNoIndent("(") - expression.extensionReceiver?.let { - // TODO - p.printWithNoIndent("\$receiver = ") - it.acceptVoid(this) - if (expression.valueArgumentsCount > 0) p.printWithNoIndent(", ") - } + if (omitBracesIfNoArguments && valueArgumentsCount == 0 && typeArgumentsCount == 0) return - repeat(expression.valueArgumentsCount) { i -> - expression.getValueArgument(i)?.let { + p.printWithNoIndent("(") + +// TODO introduce a flag to print receiver this way? +// +// expression.extensionReceiver?.let { +// p.printWithNoIndent("\$receiver = ") +// it.acceptVoid(this) +// if (expression.valueArgumentsCount > 0) p.printWithNoIndent(", ") +// } + + repeat(valueArgumentsCount) { i -> + getValueArgument(i)?.let { if (i > 0) p.printWithNoIndent(", ") + // TODO flag to print param name p.printWithNoIndent(declaration.valueParameters[i].name.asString() + " = ") - it.acceptVoid(this) + it.acceptVoid(this@KotlinLikeDumper) } } p.printWithNoIndent(")") } - override fun visitConstructorCall(expression: IrConstructorCall) { - // TODO - p.printWithNoIndent("TODO(\"IrConstructorCall\")") - } - override fun visitDelegatingConstructorCall(expression: IrDelegatingConstructorCall) { // TODO p.printWithNoIndent("TODO(\"IrDelegatingConstructorCall\")") @@ -939,6 +988,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } override fun visitVararg(expression: IrVararg) { + // TODO ??? p.printWithNoIndent("[") expression.elements.forEachIndexed { i, e -> if (i > 0) p.printWithNoIndent(", ") From 197f5ca885a7be904fe5d4dbc8dc511f527d1a85 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Fri, 6 Nov 2020 01:14:47 +0300 Subject: [PATCH 136/698] [IR] update testdata: better support for IrCall --- .../delegatedGenericImplementation.kt.txt | 12 +++++----- .../classes/delegatedImplementation.kt.txt | 10 ++++----- ...citNotNullOnDelegatedImplementation.kt.txt | 4 ++-- .../ir/irText/classes/initValInLambda.kt.txt | 2 +- .../irText/classes/qualifiedSuperCalls.kt.txt | 6 ++--- .../ir/irText/classes/superCalls.kt.txt | 6 ++--- .../irText/classes/superCallsComposed.kt.txt | 4 ++-- .../annotationsOnDelegatedMembers.kt.txt | 4 ++-- .../delegateFieldWithAnnotations.kt.txt | 2 +- ...lDelegatedPropertiesWithAnnotations.kt.txt | 2 +- .../declarations/classLevelProperties.kt.txt | 6 ++--- .../declarations/delegatedProperties.kt.txt | 12 +++++----- .../ir/irText/declarations/kt35550.kt.txt | 2 +- .../localDelegatedProperties.kt.txt | 6 ++--- .../packageLevelProperties.kt.txt | 6 ++--- .../provideDelegate/differentReceivers.kt.txt | 6 ++--- .../localDifferentReceivers.kt.txt | 6 ++--- .../provideDelegate/memberExtension.kt.txt | 4 ++-- .../argumentMappedWithError.kt.txt | 2 +- .../arrayAugmentedAssignment2.kt.txt | 2 +- .../expressions/augmentedAssignment2.kt.txt | 20 ++++++++--------- .../adaptedExtensionFunctions.kt.txt | 6 ++--- .../boundInlineAdaptedReference.kt.txt | 2 +- .../caoWithAdaptationForSam.kt.txt | 12 +++++----- .../ir/irText/expressions/calls.kt.txt | 2 +- .../irText/expressions/classReference.kt.txt | 4 ++-- .../complexAugmentedAssignment.kt.txt | 2 +- .../expressions/conventionComparisons.kt.txt | 8 +++---- .../irText/expressions/destructuring1.kt.txt | 4 ++-- .../destructuringWithUnderscore.kt.txt | 4 ++-- .../extensionPropertyGetterCall.kt.txt | 2 +- .../forWithImplicitReceivers.kt.txt | 6 ++--- .../expressions/genericPropertyCall.kt.txt | 2 +- ...citNotNullInDestructuringAssignment.kt.txt | 4 ++-- .../ir/irText/expressions/kt23030.kt.txt | 8 +++---- .../ir/irText/expressions/kt28456.kt.txt | 8 +++---- .../ir/irText/expressions/kt28456a.kt.txt | 2 +- .../ir/irText/expressions/kt28456b.kt.txt | 8 +++---- .../ir/irText/expressions/kt30020.kt.txt | 22 +++++++++---------- .../ir/irText/expressions/kt37570.kt.txt | 2 +- .../ir/irText/expressions/lambdaInCAO.kt.txt | 8 +++---- .../membersImportedFromObject.kt.txt | 4 ++-- .../expressions/objectAsCallable.kt.txt | 4 ++-- .../expressions/objectClassReference.kt.txt | 2 +- .../ir/irText/expressions/references.kt.txt | 2 +- .../safeCallWithIncrementDecrement.kt.txt | 10 ++++----- .../ir/irText/expressions/safeCalls.kt.txt | 4 ++-- .../signedToUnsignedConversions_test.kt.txt | 14 ++++++------ .../smartCastsWithDestructuring.kt.txt | 4 ++-- .../irText/expressions/typeArguments.kt.txt | 2 +- .../unsignedIntegerLiterals.kt.txt | 8 +++---- .../expressions/useImportedMember.kt.txt | 10 ++++----- .../expressions/variableAsFunctionCall.kt.txt | 4 ++-- .../variableAsFunctionCallWithGenerics.kt.txt | 4 ++-- .../ir/irText/expressions/when.kt.txt | 4 ++-- .../irText/firProblems/AllCandidates.kt.txt | 4 ++-- .../irText/firProblems/DeepCopyIrTree.kt.txt | 8 +++---- .../coercionToUnitForNestedWhen.kt.txt | 10 ++++----- .../ir/irText/lambdas/extensionLambda.kt.txt | 2 +- .../lambdas/multipleImplicitReceivers.kt.txt | 2 +- .../ir/irText/lambdas/nonLocalReturn.kt.txt | 4 ++-- .../regressions/integerCoercionToT.kt.txt | 2 +- .../typeParametersInImplicitCast.kt.txt | 2 +- .../ir/irText/stubs/builtinMap.kt.txt | 2 +- .../ir/irText/types/asOnPlatformType.kt.txt | 8 +++---- .../castsInsideCoroutineInference.kt.txt | 12 +++++----- .../irText/types/intersectionType1_NI.kt.txt | 2 +- .../irText/types/intersectionType1_OI.kt.txt | 2 +- .../irText/types/intersectionType3_NI.kt.txt | 12 +++++----- .../irText/types/intersectionType3_OI.kt.txt | 12 +++++----- ...ullabilityInDestructuringAssignment.kt.txt | 2 +- ...abilityAssertionOnExtensionReceiver.kt.txt | 4 ++-- 72 files changed, 203 insertions(+), 203 deletions(-) diff --git a/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt b/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt index ebcc4edecfa..965d3bb0b8c 100644 --- a/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt @@ -26,15 +26,15 @@ class Test1 : IBase { override val C.id: Map? override get(): Map? { - return #$$delegate_0.($receiver = ) + return (#$$delegate_0, ).() } override var List.x: D? override get(): D? { - return #$$delegate_0.($receiver = ) + return (#$$delegate_0, ).() } override set(: D?) { - #$$delegate_0.($receiver = , = ) + (#$$delegate_0, ).( = ) } @@ -61,15 +61,15 @@ class Test2 : IBase { override val C.id: Map? override get(): Map? { - return #$$delegate_0.($receiver = ) + return (#$$delegate_0, ).() } override var List.x: D? override get(): D? { - return #$$delegate_0.($receiver = ) + return (#$$delegate_0, ).() } override set(: D?) { - #$$delegate_0.($receiver = , = ) + (#$$delegate_0, ).( = ) } diff --git a/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt index a7165bb0037..1bb1fe367b4 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt @@ -106,7 +106,7 @@ class Test1 : IBase { } override fun String.qux() { - #$$delegate_0.qux($receiver = ) + (#$$delegate_0, ).qux() } @@ -131,13 +131,13 @@ class Test2 : IBase, IOther { } override fun String.qux() { - #$$delegate_0.qux($receiver = ) + (#$$delegate_0, ).qux() } private /*final field*/ val $$delegate_1: IOther = otherImpl(x0 = "", y0 = 42) override val Byte.z1: Int override get(): Int { - return #$$delegate_1.($receiver = ) + return (#$$delegate_1, ).() } override val x: String @@ -147,10 +147,10 @@ class Test2 : IBase, IOther { override var Byte.z2: Int override get(): Int { - return #$$delegate_1.($receiver = ) + return (#$$delegate_1, ).() } override set(: Int) { - #$$delegate_1.($receiver = , = ) + (#$$delegate_1, ).( = ) } override var y: Int diff --git a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt index b745983c032..815218a77c3 100644 --- a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt +++ b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt @@ -26,7 +26,7 @@ class K2 : JFoo { } override fun foo(): String { - return .foo() /*!! String */ + return super.foo() /*!! String */ } @@ -55,7 +55,7 @@ class K4 : JUnrelatedFoo, IFoo { } override fun foo(): @FlexibleNullability String? { - return .foo() + return super.foo() } diff --git a/compiler/testData/ir/irText/classes/initValInLambda.kt.txt b/compiler/testData/ir/irText/classes/initValInLambda.kt.txt index 525feca16f4..f5b6ec32943 100644 --- a/compiler/testData/ir/irText/classes/initValInLambda.kt.txt +++ b/compiler/testData/ir/irText/classes/initValInLambda.kt.txt @@ -9,7 +9,7 @@ class TestInitValInLambdaCalledOnce { get init { - run($receiver = 1, block = local fun Int.() { + 1.run(block = local fun Int.() { #x = 0 } ) diff --git a/compiler/testData/ir/irText/classes/qualifiedSuperCalls.kt.txt b/compiler/testData/ir/irText/classes/qualifiedSuperCalls.kt.txt index fba2cb790c6..5969221ee45 100644 --- a/compiler/testData/ir/irText/classes/qualifiedSuperCalls.kt.txt +++ b/compiler/testData/ir/irText/classes/qualifiedSuperCalls.kt.txt @@ -34,13 +34,13 @@ class CBoth : ILeft, IRight { } override fun foo() { - .foo() - .foo() + super.foo() + super.foo() } override val bar: Int override get(): Int { - return .().plus(other = .()) + return super.().plus(other = super.()) } diff --git a/compiler/testData/ir/irText/classes/superCalls.kt.txt b/compiler/testData/ir/irText/classes/superCalls.kt.txt index 93db015d34e..8165334d033 100644 --- a/compiler/testData/ir/irText/classes/superCalls.kt.txt +++ b/compiler/testData/ir/irText/classes/superCalls.kt.txt @@ -13,7 +13,7 @@ open class Base { open get override fun hashCode(): Int { - return .hashCode() + return super.hashCode() } @@ -28,12 +28,12 @@ class Derived : Base { } override fun foo() { - .foo() + super.foo() } override val bar: String override get(): String { - return .() + return super.() } diff --git a/compiler/testData/ir/irText/classes/superCallsComposed.kt.txt b/compiler/testData/ir/irText/classes/superCallsComposed.kt.txt index 975613f7844..2370c0810d2 100644 --- a/compiler/testData/ir/irText/classes/superCallsComposed.kt.txt +++ b/compiler/testData/ir/irText/classes/superCallsComposed.kt.txt @@ -35,12 +35,12 @@ class Derived : Base, BaseI { } override fun foo() { - .foo() + super.foo() } override val bar: String override get(): String { - return .() + return super.() } diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt index eee0a88853e..07ec45757f0 100644 --- a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt @@ -33,7 +33,7 @@ class DFoo : IFoo { private /*final field*/ val $$delegate_0: IFoo = d @Ann override fun String.testExtFun() { - #$$delegate_0.testExtFun($receiver = ) + (#$$delegate_0, ).testExtFun() } @Ann @@ -43,7 +43,7 @@ class DFoo : IFoo { override val String.testExtVal: String override get(): String { - return #$$delegate_0.($receiver = ) + return (#$$delegate_0, ).() } override val testVal: String diff --git a/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.kt.txt index b8983dcc818..0c8de284486 100644 --- a/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.kt.txt @@ -11,6 +11,6 @@ val test1: Int /* by */ } ) get(): Int { - return getValue($receiver = #test1$delegate, thisRef = null, property = ::test1) + return #test1$delegate.getValue(thisRef = null, property = ::test1) } diff --git a/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.kt.txt index ab8caeb375d..de2ee0b7ac9 100644 --- a/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.kt.txt @@ -17,7 +17,7 @@ fun foo(m: Map) { } ) local get(): Int { - return getValue($receiver = test$delegate, thisRef = null, property = ::test) + return test$delegate.getValue(thisRef = null, property = ::test) } diff --git a/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt b/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt index 61768233b4d..2d9c02f7fa6 100644 --- a/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt @@ -41,16 +41,16 @@ class C { } ) get(): Int { - return getValue($receiver = #test7$delegate, thisRef = , property = ::test7) + return #test7$delegate.getValue(thisRef = , property = ::test7) } var test8: Int /* by */ field = hashMapOf() get(): Int { - return getValue($receiver = #test8$delegate, thisRef = , property = ::test8) + return #test8$delegate.getValue(thisRef = , property = ::test8) } set(: Int) { - return setValue($receiver = #test8$delegate, thisRef = , property = ::test8, value = ) + return #test8$delegate.setValue(thisRef = , property = ::test8, value = ) } diff --git a/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt b/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt index 8adc36222ad..d2857b358b7 100644 --- a/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt @@ -4,7 +4,7 @@ val test1: Int /* by */ } ) get(): Int { - return getValue($receiver = #test1$delegate, thisRef = null, property = ::test1) + return #test1$delegate.getValue(thisRef = null, property = ::test1) } class C { @@ -24,16 +24,16 @@ class C { } ) get(): Int { - return getValue($receiver = #test2$delegate, thisRef = , property = ::test2) + return #test2$delegate.getValue(thisRef = , property = ::test2) } var test3: Any /* by */ field = .() get(): Any { - return getValue($receiver = #test3$delegate, thisRef = , property = ::test3) + return #test3$delegate.getValue(thisRef = , property = ::test3) } set(: Any) { - return setValue($receiver = #test3$delegate, thisRef = , property = ::test3, value = ) + return #test3$delegate.setValue(thisRef = , property = ::test3, value = ) } @@ -44,9 +44,9 @@ class C { var test4: Any /* by */ field = hashMapOf() get(): Any { - return getValue($receiver = #test4$delegate, thisRef = null, property = ::test4) + return #test4$delegate.getValue(thisRef = null, property = ::test4) } set(: Any) { - return setValue($receiver = #test4$delegate, thisRef = null, property = ::test4, value = ) + return #test4$delegate.setValue(thisRef = null, property = ::test4, value = ) } diff --git a/compiler/testData/ir/irText/declarations/kt35550.kt.txt b/compiler/testData/ir/irText/declarations/kt35550.kt.txt index 2c5d4c77ac6..34b3aeaf6ac 100644 --- a/compiler/testData/ir/irText/declarations/kt35550.kt.txt +++ b/compiler/testData/ir/irText/declarations/kt35550.kt.txt @@ -19,7 +19,7 @@ class A : I { private /*final field*/ val $$delegate_0: I = i override val T.id: T override get(): T { - return #$$delegate_0.($receiver = ) + return (#$$delegate_0, ).() } diff --git a/compiler/testData/ir/irText/declarations/localDelegatedProperties.kt.txt b/compiler/testData/ir/irText/declarations/localDelegatedProperties.kt.txt index 19fe4213191..3bacaf906ae 100644 --- a/compiler/testData/ir/irText/declarations/localDelegatedProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/localDelegatedProperties.kt.txt @@ -5,7 +5,7 @@ fun test1() { } ) local get(): Int { - return getValue($receiver = x$delegate, thisRef = null, property = ::x) + return x$delegate.getValue(thisRef = null, property = ::x) } @@ -16,10 +16,10 @@ fun test2() { var x: Int val x$delegate: HashMap = hashMapOf() local get(): Int { - return getValue($receiver = x$delegate, thisRef = null, property = ::x) + return x$delegate.getValue(thisRef = null, property = ::x) } local set(value: Int) { - return setValue($receiver = x$delegate, thisRef = null, property = ::x, value = value) + return x$delegate.setValue(thisRef = null, property = ::x, value = value) } diff --git a/compiler/testData/ir/irText/declarations/packageLevelProperties.kt.txt b/compiler/testData/ir/irText/declarations/packageLevelProperties.kt.txt index cfb6b100bc7..e7cfcc6ca3b 100644 --- a/compiler/testData/ir/irText/declarations/packageLevelProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/packageLevelProperties.kt.txt @@ -34,15 +34,15 @@ val test7: Int /* by */ } ) get(): Int { - return getValue($receiver = #test7$delegate, thisRef = null, property = ::test7) + return #test7$delegate.getValue(thisRef = null, property = ::test7) } var test8: Int /* by */ field = hashMapOf() get(): Int { - return getValue($receiver = #test8$delegate, thisRef = null, property = ::test8) + return #test8$delegate.getValue(thisRef = null, property = ::test8) } set(: Int) { - return setValue($receiver = #test8$delegate, thisRef = null, property = ::test8, value = ) + return #test8$delegate.setValue(thisRef = null, property = ::test8, value = ) } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt index 1f6a03a16b7..e8c6c6886cc 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt @@ -23,15 +23,15 @@ operator fun String.getValue(receiver: Any?, p: Any): String { } val testO: String /* by */ - field = provideDelegate($receiver = TODO("IrConstructorCall"), host = null, p = ::testO) + field = TODO("IrConstructorCall").provideDelegate(host = null, p = ::testO) get(): String { - return getValue($receiver = #testO$delegate, receiver = null, p = ::testO) + return #testO$delegate.getValue(receiver = null, p = ::testO) } val testK: String /* by */ field = "K" get(): String { - return getValue($receiver = #testK$delegate, receiver = null, p = ::testK) + return #testK$delegate.getValue(receiver = null, p = ::testK) } val testOK: String diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt index 4555d57fb14..0fffed7d102 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt @@ -24,16 +24,16 @@ operator fun String.getValue(receiver: Any?, p: Any): String { fun box(): String { val testO: String - val testO$delegate: String = provideDelegate($receiver = TODO("IrConstructorCall"), host = null, p = ::testO) + val testO$delegate: String = TODO("IrConstructorCall").provideDelegate(host = null, p = ::testO) local get(): String { - return getValue($receiver = testO$delegate, receiver = null, p = ::testO) + return testO$delegate.getValue(receiver = null, p = ::testO) } val testK: String val testK$delegate: String = "K" local get(): String { - return getValue($receiver = testK$delegate, receiver = null, p = ::testK) + return testK$delegate.getValue(receiver = null, p = ::testK) } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt index 27443f19648..ca89f230f9b 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt @@ -30,13 +30,13 @@ object Host { } val String.plusK: String /* by */ - field = .provideDelegate($receiver = "K", host = , p = ::plusK) + field = (, "K").provideDelegate(host = , p = ::plusK) get(): String { return #plusK$delegate.getValue(receiver = , p = ::plusK) } val ok: String - field = .($receiver = "O") + field = (, "O").() get diff --git a/compiler/testData/ir/irText/expressions/argumentMappedWithError.kt.txt b/compiler/testData/ir/irText/expressions/argumentMappedWithError.kt.txt index 1f6e1b67494..6a88ea35abe 100644 --- a/compiler/testData/ir/irText/expressions/argumentMappedWithError.kt.txt +++ b/compiler/testData/ir/irText/expressions/argumentMappedWithError.kt.txt @@ -7,6 +7,6 @@ fun foo(arg: Number) { fun main(args: Array) { val x: Int = 0 - foo(arg = convert($receiver = x)) + foo(arg = x.convert()) } diff --git a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.kt.txt b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.kt.txt index 00549a2d611..ba7f609d100 100644 --- a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.kt.txt +++ b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.kt.txt @@ -16,7 +16,7 @@ fun IB.test(a: IA) { { // BLOCK val tmp0_array: IA = a val tmp1_index0: String = "" - .set($receiver = tmp0_array, index = tmp1_index0, value = tmp0_array.get(index = tmp1_index0).plus(other = 42)) + (, tmp0_array).set(index = tmp1_index0, value = tmp0_array.get(index = tmp1_index0).plus(other = 42)) } } diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt b/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt index afa5af875fd..72601051367 100644 --- a/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt +++ b/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt @@ -31,28 +31,28 @@ val p: A fun testVariable() { val a: A = TODO("IrConstructorCall") - plusAssign($receiver = a, s = "+=") - minusAssign($receiver = a, s = "-=") - timesAssign($receiver = a, s = "*=") - divAssign($receiver = a, s = "/=") - remAssign($receiver = a, s = "*=") + a.plusAssign(s = "+=") + a.minusAssign(s = "-=") + a.timesAssign(s = "*=") + a.divAssign(s = "/=") + a.remAssign(s = "*=") } fun testProperty() { { // BLOCK - plusAssign($receiver = (), s = "+=") + ().plusAssign(s = "+=") } { // BLOCK - minusAssign($receiver = (), s = "-=") + ().minusAssign(s = "-=") } { // BLOCK - timesAssign($receiver = (), s = "*=") + ().timesAssign(s = "*=") } { // BLOCK - divAssign($receiver = (), s = "/=") + ().divAssign(s = "/=") } { // BLOCK - remAssign($receiver = (), s = "%=") + ().remAssign(s = "%=") } } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt index b27a9d1f0c7..431fcc1667d 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt @@ -24,21 +24,21 @@ fun C.extensionBoth(i: Int, s: String = "", vararg t: String) { fun testExtensionVararg() { use(f = local fun extensionVararg(p0: C, p1: Int) { - extensionVararg($receiver = p0, i = p1) + p0.extensionVararg(i = p1) } ) } fun testExtensionDefault() { use(f = local fun extensionDefault(p0: C, p1: Int) { - extensionDefault($receiver = p0, i = p1) + p0.extensionDefault(i = p1) } ) } fun testExtensionBoth() { use(f = local fun extensionBoth(p0: C, p1: Int) { - extensionBoth($receiver = p0, i = p1) + p0.extensionBoth(i = p1) } ) } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.kt.txt index 11d91d981b0..e1560da0c0f 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.kt.txt @@ -10,7 +10,7 @@ fun String.id(s: String = , vararg xs: Int): String { fun test() { foo(x = { // BLOCK local fun String.id() { - id($receiver = receiver, ) /*~> Unit */ + receiver.id() /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt index b8d86b1f161..8371df7b87c 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt @@ -61,7 +61,7 @@ fun test1() { withVararg(xs = [p0]) /*~> Unit */ } /*-> IFoo */ - set($receiver = tmp0_array, i = tmp2_sam, newValue = get($receiver = tmp0_array, i = tmp2_sam).plus(other = 1)) + tmp0_array.set(i = tmp2_sam, newValue = tmp0_array.get(i = tmp2_sam).plus(other = 1)) } } @@ -72,7 +72,7 @@ fun test2() { withVararg(xs = [p0]) /*~> Unit */ } /*-> IFoo2 */ - set($receiver = tmp0_array, i = tmp2_sam, newValue = get($receiver = tmp0_array, i = tmp2_sam).plus(other = 1)) + tmp0_array.set(i = tmp2_sam, newValue = tmp0_array.get(i = tmp2_sam).plus(other = 1)) } } @@ -80,7 +80,7 @@ fun test3(fn: Function1) { { // BLOCK val tmp0_array: A = A val tmp2_sam: IFoo = fn /*-> IFoo */ - set($receiver = tmp0_array, i = tmp2_sam, newValue = get($receiver = tmp0_array, i = tmp2_sam).plus(other = 1)) + tmp0_array.set(i = tmp2_sam, newValue = tmp0_array.get(i = tmp2_sam).plus(other = 1)) } } @@ -90,7 +90,7 @@ fun test4(fn: Function1) { { // BLOCK val tmp0_array: A = A val tmp1_index0: Function1 = fn - set($receiver = tmp0_array, i = tmp1_index0 /*as IFoo */, newValue = get($receiver = tmp0_array, i = tmp1_index0 /*as IFoo */).plus(other = 1)) + tmp0_array.set(i = tmp1_index0 /*as IFoo */, newValue = tmp0_array.get(i = tmp1_index0 /*as IFoo */).plus(other = 1)) } } } @@ -101,7 +101,7 @@ fun test5(a: Any) { { // BLOCK val tmp0_array: A = A val tmp2_sam: IFoo = a /*as Function1<@ParameterName(...) Int, Unit> */ /*-> IFoo */ - set($receiver = tmp0_array, i = tmp2_sam, newValue = get($receiver = tmp0_array, i = tmp2_sam).plus(other = 1)) + tmp0_array.set(i = tmp2_sam, newValue = tmp0_array.get(i = tmp2_sam).plus(other = 1)) } } @@ -111,7 +111,7 @@ fun test6(a: Any) { { // BLOCK val tmp0_array: A = A val tmp1_index0: Any = a - set($receiver = tmp0_array, i = tmp1_index0 /*as IFoo */, newValue = get($receiver = tmp0_array, i = tmp1_index0 /*as IFoo */).plus(other = 1)) + tmp0_array.set(i = tmp1_index0 /*as IFoo */, newValue = tmp0_array.get(i = tmp1_index0 /*as IFoo */).plus(other = 1)) } } diff --git a/compiler/testData/ir/irText/expressions/calls.kt.txt b/compiler/testData/ir/irText/expressions/calls.kt.txt index 660fedd9984..42cd340db3c 100644 --- a/compiler/testData/ir/irText/expressions/calls.kt.txt +++ b/compiler/testData/ir/irText/expressions/calls.kt.txt @@ -19,6 +19,6 @@ fun Int.ext2(x: Int): Int { } fun Int.ext3(x: Int): Int { - return foo(x = ext1($receiver = ), y = x) + return foo(x = .ext1(), y = x) } diff --git a/compiler/testData/ir/irText/expressions/classReference.kt.txt b/compiler/testData/ir/irText/expressions/classReference.kt.txt index cbbc7eb3ecb..8c24a32e11f 100644 --- a/compiler/testData/ir/irText/expressions/classReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/classReference.kt.txt @@ -13,7 +13,7 @@ class A { fun test() { A::class /*~> Unit */ TODO("IrConstructorCall")::class /*~> Unit */ - ($receiver = A::class) /*~> Unit */ - ($receiver = TODO("IrConstructorCall")::class) /*~> Unit */ + A::class.() /*~> Unit */ + TODO("IrConstructorCall")::class.() /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt index d452608ed84..09e220cb5f4 100644 --- a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt +++ b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt @@ -128,6 +128,6 @@ object Host { } fun Host.test3(v: B) { - .plusAssign($receiver = v, b = TODO("IrConstructorCall")) + (, v).plusAssign(b = TODO("IrConstructorCall")) } diff --git a/compiler/testData/ir/irText/expressions/conventionComparisons.kt.txt b/compiler/testData/ir/irText/expressions/conventionComparisons.kt.txt index aa20ef1e64b..acc623bd0a3 100644 --- a/compiler/testData/ir/irText/expressions/conventionComparisons.kt.txt +++ b/compiler/testData/ir/irText/expressions/conventionComparisons.kt.txt @@ -12,18 +12,18 @@ interface IB { } fun IB.test1(a1: IA, a2: IA): Boolean { - return greater(arg0 = .compareTo($receiver = a1, other = a2), arg1 = 0) + return greater(arg0 = (, a1).compareTo(other = a2), arg1 = 0) } fun IB.test2(a1: IA, a2: IA): Boolean { - return greaterOrEqual(arg0 = .compareTo($receiver = a1, other = a2), arg1 = 0) + return greaterOrEqual(arg0 = (, a1).compareTo(other = a2), arg1 = 0) } fun IB.test3(a1: IA, a2: IA): Boolean { - return less(arg0 = .compareTo($receiver = a1, other = a2), arg1 = 0) + return less(arg0 = (, a1).compareTo(other = a2), arg1 = 0) } fun IB.test4(a1: IA, a2: IA): Boolean { - return lessOrEqual(arg0 = .compareTo($receiver = a1, other = a2), arg1 = 0) + return lessOrEqual(arg0 = (, a1).compareTo(other = a2), arg1 = 0) } diff --git a/compiler/testData/ir/irText/expressions/destructuring1.kt.txt b/compiler/testData/ir/irText/expressions/destructuring1.kt.txt index 8e2163433d8..19c4b21fa6a 100644 --- a/compiler/testData/ir/irText/expressions/destructuring1.kt.txt +++ b/compiler/testData/ir/irText/expressions/destructuring1.kt.txt @@ -33,8 +33,8 @@ object B { fun B.test() { // COMPOSITE { val tmp0_container: A = A - val x: Int = .component1($receiver = tmp0_container) - val y: Int = .component2($receiver = tmp0_container) + val x: Int = (, tmp0_container).component1() + val y: Int = (, tmp0_container).component2() // } } diff --git a/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.kt.txt b/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.kt.txt index 43cd12bc9e7..413332d666d 100644 --- a/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.kt.txt +++ b/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.kt.txt @@ -37,8 +37,8 @@ object B { fun B.test() { // COMPOSITE { val tmp0_container: A = A - val x: Int = .component1($receiver = tmp0_container) - val z: Int = .component3($receiver = tmp0_container) + val x: Int = (, tmp0_container).component1() + val z: Int = (, tmp0_container).component3() // } } diff --git a/compiler/testData/ir/irText/expressions/extensionPropertyGetterCall.kt.txt b/compiler/testData/ir/irText/expressions/extensionPropertyGetterCall.kt.txt index 45536fe0b0d..3a5610cf77d 100644 --- a/compiler/testData/ir/irText/expressions/extensionPropertyGetterCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/extensionPropertyGetterCall.kt.txt @@ -4,6 +4,6 @@ val String.okext: String } fun String.test5(): String { - return ($receiver = ) + return .() } diff --git a/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt index b2b23e39172..63d9f5759ec 100644 --- a/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt +++ b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt @@ -54,9 +54,9 @@ interface IReceiver { fun IReceiver.test() { { // BLOCK - val tmp0_iterator: IntCell = .iterator($receiver = FiveTimes) - while (.hasNext($receiver = tmp0_iterator)) { // BLOCK - val i: Int = .next($receiver = tmp0_iterator) + val tmp0_iterator: IntCell = (, FiveTimes).iterator() + while ((, tmp0_iterator).hasNext()) { // BLOCK + val i: Int = (, tmp0_iterator).next() { // BLOCK println(message = i) } diff --git a/compiler/testData/ir/irText/expressions/genericPropertyCall.kt.txt b/compiler/testData/ir/irText/expressions/genericPropertyCall.kt.txt index 7902ef55981..32d611c152e 100644 --- a/compiler/testData/ir/irText/expressions/genericPropertyCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/genericPropertyCall.kt.txt @@ -4,6 +4,6 @@ val T.id: T } val test: String - field = ($receiver = "abc") + field = "abc".() get diff --git a/compiler/testData/ir/irText/expressions/implicitNotNullInDestructuringAssignment.kt.txt b/compiler/testData/ir/irText/expressions/implicitNotNullInDestructuringAssignment.kt.txt index b10b98aae22..afa12bb5595 100644 --- a/compiler/testData/ir/irText/expressions/implicitNotNullInDestructuringAssignment.kt.txt +++ b/compiler/testData/ir/irText/expressions/implicitNotNullInDestructuringAssignment.kt.txt @@ -9,8 +9,8 @@ private operator fun J.component2(): Int { fun test() { // COMPOSITE { val tmp0_container: @FlexibleNullability J? = j() - val a: Int = component1($receiver = tmp0_container) - val b: Int = component2($receiver = tmp0_container /*!! J */) + val a: Int = tmp0_container.component1() + val b: Int = tmp0_container /*!! J */.component2() // } } diff --git a/compiler/testData/ir/irText/expressions/kt23030.kt.txt b/compiler/testData/ir/irText/expressions/kt23030.kt.txt index a82a6196c34..7101d467fd5 100644 --- a/compiler/testData/ir/irText/expressions/kt23030.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt23030.kt.txt @@ -3,7 +3,7 @@ operator fun Int.compareTo(c: Char): Int { } fun testOverloadedCompareToCall(x: Int, y: Char): Boolean { - return less(arg0 = compareTo($receiver = x, c = y), arg1 = 0) + return less(arg0 = x.compareTo(c = y), arg1 = 0) } fun testOverloadedCompareToCallWithSmartCast(x: Any, y: Any): Boolean { @@ -11,7 +11,7 @@ fun testOverloadedCompareToCallWithSmartCast(x: Any, y: Any): Boolean { when { x is Int -> y is Char true -> false - } -> less(arg0 = compareTo($receiver = x /*as Int */, c = y /*as Char */), arg1 = 0) + } -> less(arg0 = x /*as Int */.compareTo(c = y /*as Char */), arg1 = 0) true -> false } } @@ -38,7 +38,7 @@ class C { } fun testMemberExtensionCompareToCall(x: Int, y: Char): Boolean { - return less(arg0 = .compareTo($receiver = x, c = y), arg1 = 0) + return less(arg0 = (, x).compareTo(c = y), arg1 = 0) } fun testMemberExtensionCompareToCallWithSmartCast(x: Any, y: Any): Boolean { @@ -46,7 +46,7 @@ class C { when { x is Int -> y is Char true -> false - } -> less(arg0 = .compareTo($receiver = x /*as Int */, c = y /*as Char */), arg1 = 0) + } -> less(arg0 = (, x /*as Int */).compareTo(c = y /*as Char */), arg1 = 0) true -> false } } diff --git a/compiler/testData/ir/irText/expressions/kt28456.kt.txt b/compiler/testData/ir/irText/expressions/kt28456.kt.txt index 9d097e282a3..206a8b0fa28 100644 --- a/compiler/testData/ir/irText/expressions/kt28456.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt28456.kt.txt @@ -18,7 +18,7 @@ operator fun A.set(i: Int, j: Int, v: Int) { } fun testSimpleAssignment(a: A) { - set($receiver = a, i = 1, j = 2, v = 0) + a.set(i = 1, j = 2, v = 0) } fun testPostfixIncrement(a: A): Int { @@ -26,8 +26,8 @@ fun testPostfixIncrement(a: A): Int { val tmp0_array: A = a val tmp1_index0: Int = 1 val tmp2_index1: Int = 2 - val tmp3: Int = get($receiver = tmp0_array, xs = [tmp1_index0, tmp2_index1]) - set($receiver = tmp0_array, i = tmp1_index0, j = tmp2_index1, v = tmp3.inc()) + val tmp3: Int = tmp0_array.get(xs = [tmp1_index0, tmp2_index1]) + tmp0_array.set(i = tmp1_index0, j = tmp2_index1, v = tmp3.inc()) tmp3 } } @@ -37,7 +37,7 @@ fun testCompoundAssignment(a: A) { val tmp0_array: A = a val tmp1_index0: Int = 1 val tmp2_index1: Int = 2 - set($receiver = tmp0_array, i = tmp1_index0, j = tmp2_index1, v = get($receiver = tmp0_array, xs = [tmp1_index0, tmp2_index1]).plus(other = 10)) + tmp0_array.set(i = tmp1_index0, j = tmp2_index1, v = tmp0_array.get(xs = [tmp1_index0, tmp2_index1]).plus(other = 10)) } } diff --git a/compiler/testData/ir/irText/expressions/kt28456a.kt.txt b/compiler/testData/ir/irText/expressions/kt28456a.kt.txt index e1d3a1342c9..70874414592 100644 --- a/compiler/testData/ir/irText/expressions/kt28456a.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt28456a.kt.txt @@ -14,6 +14,6 @@ operator fun A.set(vararg i: Int, v: Int) { } fun testSimpleAssignment(a: A) { - set($receiver = a, i = [1, 2, 3], v = 0) + a.set(i = [1, 2, 3], v = 0) } diff --git a/compiler/testData/ir/irText/expressions/kt28456b.kt.txt b/compiler/testData/ir/irText/expressions/kt28456b.kt.txt index 19be20de821..76b604178e0 100644 --- a/compiler/testData/ir/irText/expressions/kt28456b.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt28456b.kt.txt @@ -18,15 +18,15 @@ operator fun A.set(i: Int, j: Int = 42, v: Int) { } fun testSimpleAssignment(a: A) { - set($receiver = a, i = 1, v = 0) + a.set(i = 1, v = 0) } fun testPostfixIncrement(a: A): Int { return { // BLOCK val tmp0_array: A = a val tmp1_index0: Int = 1 - val tmp2: Int = get($receiver = tmp0_array, i = tmp1_index0) - set($receiver = tmp0_array, i = tmp1_index0, v = tmp2.inc()) + val tmp2: Int = tmp0_array.get(i = tmp1_index0) + tmp0_array.set(i = tmp1_index0, v = tmp2.inc()) tmp2 } } @@ -35,7 +35,7 @@ fun testCompoundAssignment(a: A) { { // BLOCK val tmp0_array: A = a val tmp1_index0: Int = 1 - set($receiver = tmp0_array, i = tmp1_index0, v = get($receiver = tmp0_array, i = tmp1_index0).plus(other = 10)) + tmp0_array.set(i = tmp1_index0, v = tmp0_array.get(i = tmp1_index0).plus(other = 10)) } } diff --git a/compiler/testData/ir/irText/expressions/kt30020.kt.txt b/compiler/testData/ir/irText/expressions/kt30020.kt.txt index 24d63966eb3..53f81d66ae7 100644 --- a/compiler/testData/ir/irText/expressions/kt30020.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt30020.kt.txt @@ -11,29 +11,29 @@ interface X { fun test(x: X, nx: X?) { { // BLOCK val tmp0_this: X = x - plusAssign($receiver = tmp0_this.(), element = 1) + tmp0_this.().plusAssign(element = 1) } - plusAssign($receiver = x.f(), element = 2) - plusAssign($receiver = x.() as MutableList, element = 3) - plusAssign($receiver = x.f() as MutableList, element = 4) - plusAssign($receiver = CHECK_NOT_NULL>(arg0 = { // BLOCK + x.f().plusAssign(element = 2) + x.() as MutableList.plusAssign(element = 3) + x.f() as MutableList.plusAssign(element = 4) + CHECK_NOT_NULL>(arg0 = { // BLOCK val tmp1_safe_receiver: X? = nx when { EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null true -> tmp1_safe_receiver.() } - }), element = 5) - plusAssign($receiver = CHECK_NOT_NULL>(arg0 = { // BLOCK + }).plusAssign(element = 5) + CHECK_NOT_NULL>(arg0 = { // BLOCK val tmp2_safe_receiver: X? = nx when { EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null true -> tmp2_safe_receiver.f() } - }), element = 6) + }).plusAssign(element = 6) } fun MutableList.testExtensionReceiver() { - plusAssign($receiver = , element = 100) + .plusAssign(element = 100) } abstract class AML : MutableList { @@ -44,7 +44,7 @@ abstract class AML : MutableList { } fun testExplicitThis() { - plusAssign($receiver = , element = 200) + .plusAssign(element = 200) } inner class Inner { @@ -55,7 +55,7 @@ abstract class AML : MutableList { } fun testOuterThis() { - plusAssign($receiver = , element = 300) + .plusAssign(element = 300) } diff --git a/compiler/testData/ir/irText/expressions/kt37570.kt.txt b/compiler/testData/ir/irText/expressions/kt37570.kt.txt index 1fa6d962f43..ca7f8184047 100644 --- a/compiler/testData/ir/irText/expressions/kt37570.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt37570.kt.txt @@ -13,7 +13,7 @@ class A { get init { - apply($receiver = a(), block = local fun String.() { + a().apply(block = local fun String.() { #b = } ) /*~> Unit */ diff --git a/compiler/testData/ir/irText/expressions/lambdaInCAO.kt.txt b/compiler/testData/ir/irText/expressions/lambdaInCAO.kt.txt index 76d87b6809b..843798b59bf 100644 --- a/compiler/testData/ir/irText/expressions/lambdaInCAO.kt.txt +++ b/compiler/testData/ir/irText/expressions/lambdaInCAO.kt.txt @@ -9,7 +9,7 @@ operator fun Any.set(index: Function0, value: Int) { } fun test1(a: Any) { - plusAssign($receiver = a, lambda = local fun () { + a.plusAssign(lambda = local fun () { return Unit } ) @@ -22,7 +22,7 @@ fun test2(a: Any) { return Unit } - set($receiver = tmp0_array, index = tmp1_index0, value = get($receiver = tmp0_array, index = tmp1_index0).plus(other = 42)) + tmp0_array.set(index = tmp1_index0, value = tmp0_array.get(index = tmp1_index0).plus(other = 42)) } } @@ -33,8 +33,8 @@ fun test3(a: Any) { return Unit } - val tmp2: Int = get($receiver = tmp0_array, index = tmp1_index0) - set($receiver = tmp0_array, index = tmp1_index0, value = tmp2.inc()) + val tmp2: Int = tmp0_array.get(index = tmp1_index0) + tmp0_array.set(index = tmp1_index0, value = tmp2.inc()) tmp2 } /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/membersImportedFromObject.kt.txt b/compiler/testData/ir/irText/expressions/membersImportedFromObject.kt.txt index f9d9c9de7d7..9a510e14c48 100644 --- a/compiler/testData/ir/irText/expressions/membersImportedFromObject.kt.txt +++ b/compiler/testData/ir/irText/expressions/membersImportedFromObject.kt.txt @@ -36,10 +36,10 @@ val test2: Int get val test3: Int - field = A.fooExt($receiver = 1) + field = (A, 1).fooExt() get val test4: Int - field = A.($receiver = 1) + field = (A, 1).() get diff --git a/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt b/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt index 2b1164076df..894dfad5cbe 100644 --- a/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt +++ b/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt @@ -39,10 +39,10 @@ operator fun En.invoke(i: Int): Int { } val test1: Int - field = invoke($receiver = A, i = 42) + field = A.invoke(i = 42) get val test2: Int - field = invoke($receiver = En, i = 42) + field = En.invoke(i = 42) get diff --git a/compiler/testData/ir/irText/expressions/objectClassReference.kt.txt b/compiler/testData/ir/irText/expressions/objectClassReference.kt.txt index 9430fd8dc6d..3225c4ab84c 100644 --- a/compiler/testData/ir/irText/expressions/objectClassReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/objectClassReference.kt.txt @@ -12,6 +12,6 @@ object A { fun test() { A::class /*~> Unit */ - ($receiver = A::class) /*~> Unit */ + A::class.() /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/references.kt.txt b/compiler/testData/ir/irText/expressions/references.kt.txt index b7271694093..a4fbb1e4897 100644 --- a/compiler/testData/ir/irText/expressions/references.kt.txt +++ b/compiler/testData/ir/irText/expressions/references.kt.txt @@ -34,6 +34,6 @@ val String.okext: String } fun String.test5(): String { - return ($receiver = ) + return .() } diff --git a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt index dd5c708cf03..f1a0f69545c 100644 --- a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt +++ b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt @@ -44,8 +44,8 @@ fun testProperty(nc: C?) { true -> { // BLOCK val tmp1_receiver: C? = tmp0_safe_receiver { // BLOCK - val tmp2: Int = ($receiver = tmp1_receiver) - ($receiver = tmp1_receiver, value = inc($receiver = tmp2)) + val tmp2: Int = tmp1_receiver.() + tmp1_receiver.(value = tmp2.inc()) tmp2 } } @@ -59,12 +59,12 @@ fun testArrayAccess(nc: C?) { val tmp0_safe_receiver: C? = nc when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> ($receiver = tmp0_safe_receiver) + true -> tmp0_safe_receiver.() } } val tmp2_index0: Int = 0 - val tmp3: Int = get($receiver = tmp1_array, index = tmp2_index0) - set($receiver = tmp1_array, index = tmp2_index0, value = tmp3.inc()) + val tmp3: Int = tmp1_array.get(index = tmp2_index0) + tmp1_array.set(index = tmp2_index0, value = tmp3.inc()) tmp3 } /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/safeCalls.kt.txt b/compiler/testData/ir/irText/expressions/safeCalls.kt.txt index aa175df6b49..a1de2db7012 100644 --- a/compiler/testData/ir/irText/expressions/safeCalls.kt.txt +++ b/compiler/testData/ir/irText/expressions/safeCalls.kt.txt @@ -70,7 +70,7 @@ fun IHost.test5(s: String?): Int? { val tmp0_safe_receiver: String? = s when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> .extLength($receiver = tmp0_safe_receiver) + true -> (, tmp0_safe_receiver).extLength() } } } @@ -84,7 +84,7 @@ fun box() { val tmp0_safe_receiver: Int = 42 when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> foo($receiver = tmp0_safe_receiver) + true -> tmp0_safe_receiver.foo() } } /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.kt.txt b/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.kt.txt index 23f17f68081..ed290218075 100644 --- a/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.kt.txt +++ b/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.kt.txt @@ -47,12 +47,12 @@ fun takeLong(l: Long) { } fun test() { - takeUByte(u = toUByte($receiver = ())) - takeUByte(u = toUByte($receiver = ())) - takeUShort(u = toUShort($receiver = ())) - takeUShort(u = toUShort($receiver = ())) - takeUInt(u = toUInt($receiver = ())) - takeULong(u = toULong($receiver = ())) - takeUBytes(u = [toUByte($receiver = ()), toUByte($receiver = ()), 42B]) + takeUByte(u = ().toUByte()) + takeUByte(u = ().toUByte()) + takeUShort(u = ().toUShort()) + takeUShort(u = ().toUShort()) + takeUInt(u = ().toUInt()) + takeULong(u = ().toULong()) + takeUBytes(u = [().toUByte(), ().toUByte(), 42B]) } diff --git a/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.kt.txt b/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.kt.txt index 87c413436c0..29195ac0858 100644 --- a/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.kt.txt +++ b/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.kt.txt @@ -24,8 +24,8 @@ fun test(x: I1) { } // COMPOSITE { val tmp0_container: I1 = x - val c1: Int = component1($receiver = tmp0_container) - val c2: String = component2($receiver = tmp0_container /*as I2 */) + val c1: Int = tmp0_container.component1() + val c2: String = tmp0_container /*as I2 */.component2() // } } diff --git a/compiler/testData/ir/irText/expressions/typeArguments.kt.txt b/compiler/testData/ir/irText/expressions/typeArguments.kt.txt index 93a36d84fdf..511e07ec7d5 100644 --- a/compiler/testData/ir/irText/expressions/typeArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/typeArguments.kt.txt @@ -1,6 +1,6 @@ fun test1(x: Any): Boolean { return when { - x is Array<*> -> isArrayOf($receiver = x /*as Array<*> */) + x is Array<*> -> x /*as Array<*> */.isArrayOf() true -> false } } diff --git a/compiler/testData/ir/irText/expressions/unsignedIntegerLiterals.kt.txt b/compiler/testData/ir/irText/expressions/unsignedIntegerLiterals.kt.txt index 63a971bead9..8972b17eadd 100644 --- a/compiler/testData/ir/irText/expressions/unsignedIntegerLiterals.kt.txt +++ b/compiler/testData/ir/irText/expressions/unsignedIntegerLiterals.kt.txt @@ -23,18 +23,18 @@ val testULongWithExpectedType: ULong get val testToUByte: UByte - field = toUByte($receiver = 1) + field = 1.toUByte() get val testToUShort: UShort - field = toUShort($receiver = 1) + field = 1.toUShort() get val testToUInt: UInt - field = toUInt($receiver = 1) + field = 1.toUInt() get val testToULong: ULong - field = toULong($receiver = 1) + field = 1.toULong() get diff --git a/compiler/testData/ir/irText/expressions/useImportedMember.kt.txt b/compiler/testData/ir/irText/expressions/useImportedMember.kt.txt index 6278864c86a..09d3fd964e8 100644 --- a/compiler/testData/ir/irText/expressions/useImportedMember.kt.txt +++ b/compiler/testData/ir/irText/expressions/useImportedMember.kt.txt @@ -82,7 +82,7 @@ fun box(): String { EQEQ(arg0 = C.f(s = "s"), arg1 = 2).not() -> return "2" } when { - EQEQ(arg0 = C.f($receiver = true), arg1 = 3).not() -> return "3" + EQEQ(arg0 = (C, true).f(), arg1 = 3).not() -> return "3" } when { EQEQ(arg0 = C.(), arg1 = 4).not() -> return "4" @@ -92,19 +92,19 @@ fun box(): String { EQEQ(arg0 = C.(), arg1 = 5).not() -> return "5" } when { - EQEQ(arg0 = C.($receiver = 5), arg1 = 6).not() -> return "6" + EQEQ(arg0 = (C, 5).(), arg1 = 6).not() -> return "6" } when { EQEQ(arg0 = C.g1(t = "7"), arg1 = "7").not() -> return "7" } when { - EQEQ(arg0 = C.($receiver = "8"), arg1 = "8").not() -> return "8" + EQEQ(arg0 = (C, "8").(), arg1 = "8").not() -> return "8" } when { - EQEQ(arg0 = C.fromInterface($receiver = 9), arg1 = 9).not() -> return "9" + EQEQ(arg0 = (C, 9).fromInterface(), arg1 = 9).not() -> return "9" } when { - EQEQ(arg0 = C.($receiver = "10"), arg1 = "10").not() -> return "10" + EQEQ(arg0 = (C, "10").(), arg1 = "10").not() -> return "10" } when { EQEQ(arg0 = C.genericFromSuper(g = "11"), arg1 = "11").not() -> return "11" diff --git a/compiler/testData/ir/irText/expressions/variableAsFunctionCall.kt.txt b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.kt.txt index a60aecfe3c1..04eea7c4fe4 100644 --- a/compiler/testData/ir/irText/expressions/variableAsFunctionCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.kt.txt @@ -14,7 +14,7 @@ fun test2(f: @ExtensionFunctionType Function1) { } fun test3(): String { - return k($receiver = "hello").invoke() + return "hello".k().invoke() } fun test4(ns: String?): String? { @@ -23,7 +23,7 @@ fun test4(ns: String?): String? { val tmp0_safe_receiver: String? = ns when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> k($receiver = tmp0_safe_receiver) + true -> tmp0_safe_receiver.k() } } when { diff --git a/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.kt.txt b/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.kt.txt index 06742e65472..21f5ee096a0 100644 --- a/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.kt.txt +++ b/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.kt.txt @@ -7,7 +7,7 @@ val T.gk: Function0 } fun testGeneric1(x: String): String { - return ($receiver = x).invoke() + return x.().invoke() } val T.kt26531Val: Function0 @@ -19,6 +19,6 @@ val T.kt26531Val: Function0 } fun kt26531(): Int { - return ($receiver = 7).invoke() + return 7.().invoke() } diff --git a/compiler/testData/ir/irText/expressions/when.kt.txt b/compiler/testData/ir/irText/expressions/when.kt.txt index 74e681094a3..57e50ca1068 100644 --- a/compiler/testData/ir/irText/expressions/when.kt.txt +++ b/compiler/testData/ir/irText/expressions/when.kt.txt @@ -18,7 +18,7 @@ fun testWithSubject(x: Any?): String { EQEQ(arg0 = tmp0_subject, arg1 = A) -> "A" tmp0_subject is String -> "String" tmp0_subject is Number.not() -> "!Number" - contains($receiver = setOf(), element = tmp0_subject /*as Number */) -> "nothingness?" + setOf().contains(element = tmp0_subject /*as Number */) -> "nothingness?" true -> "something" } } @@ -30,7 +30,7 @@ fun test(x: Any?): String { EQEQ(arg0 = x, arg1 = A) -> "A" x is String -> "String" x !is Number -> "!Number" - contains($receiver = setOf(), element = x /*as Number */) -> "nothingness?" + setOf().contains(element = x /*as Number */) -> "nothingness?" true -> "something" } } diff --git a/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt b/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt index eaff1fa52d2..29873cc7b25 100644 --- a/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt +++ b/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt @@ -27,8 +27,8 @@ class MyCandidate { } private fun allCandidatesResult(allCandidates: Collection): @FlexibleNullability OverloadResolutionResultsImpl<@FlexibleNullability A?>? { - return apply<@FlexibleNullability OverloadResolutionResultsImpl<@FlexibleNullability A?>?>($receiver = nameNotFound<@FlexibleNullability A?>(), block = local fun @FlexibleNullability OverloadResolutionResultsImpl<@FlexibleNullability A?>?.() { - /*!! OverloadResolutionResultsImpl<@FlexibleNullability A?> */.setAllCandidates<@FlexibleNullability A?>(allCandidates = map>($receiver = allCandidates, transform = local fun (it: MyCandidate): ResolvedCall { + return nameNotFound<@FlexibleNullability A?>().apply<@FlexibleNullability OverloadResolutionResultsImpl<@FlexibleNullability A?>?>(block = local fun @FlexibleNullability OverloadResolutionResultsImpl<@FlexibleNullability A?>?.() { + /*!! OverloadResolutionResultsImpl<@FlexibleNullability A?> */.setAllCandidates<@FlexibleNullability A?>(allCandidates = allCandidates.map>(transform = local fun (it: MyCandidate): ResolvedCall { return it.() as ResolvedCall } )) diff --git a/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt index dd44f5ebe92..b003eb7047c 100644 --- a/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt +++ b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt @@ -60,19 +60,19 @@ class DeepCopyIrTreeWithSymbols { } fun IrTypeParametersContainer.copyTypeParametersFrom(other: IrTypeParametersContainer) { - .( = map($receiver = other.(), transform = local fun (it: IrTypeParameter): IrTypeParameter { + .( = other.().map(transform = local fun (it: IrTypeParameter): IrTypeParameter { return .copyTypeParameter(declaration = it) } )) - withinScope($receiver = .(), irTypeParametersContainer = , fn = local fun () { + .().withinScope(irTypeParametersContainer = , fn = local fun () { { // BLOCK - val tmp0_iterator: Iterator> = zip($receiver = .(), other = other.()).iterator() + val tmp0_iterator: Iterator> = .().zip(other = other.()).iterator() while (tmp0_iterator.hasNext()) { // BLOCK val tmp1_loop_parameter: Pair = tmp0_iterator.next() val thisTypeParameter: IrTypeParameter = tmp1_loop_parameter.component1() val otherTypeParameter: IrTypeParameter = tmp1_loop_parameter.component2() { // BLOCK - mapTo>($receiver = otherTypeParameter.(), destination = thisTypeParameter.(), transform = local fun (it: IrType): IrType { + otherTypeParameter.().mapTo>(destination = thisTypeParameter.(), transform = local fun (it: IrType): IrType { return .().remapType(type = it) } ) /*~> Unit */ diff --git a/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt b/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt index f9bd364c41b..46bec19d53d 100644 --- a/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt +++ b/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt @@ -4,7 +4,7 @@ private const val BACKSLASH: Char private fun Reader.nextChar(): Char? { return { // BLOCK - val tmp0_safe_receiver: Int? = takeUnless($receiver = .read(), predicate = local fun (it: Int): Boolean { + val tmp0_safe_receiver: Int? = .read().takeUnless(predicate = local fun (it: Int): Boolean { return EQEQ(arg0 = it, arg1 = -1) } ) @@ -16,17 +16,17 @@ private fun Reader.nextChar(): Char? { } fun Reader.consumeRestOfQuotedSequence(sb: StringBuilder, quote: Char) { - var ch: Char? = nextChar($receiver = ) + var ch: Char? = .nextChar() while (when { EQEQ(arg0 = ch, arg1 = null).not() -> EQEQ(arg0 = ch, arg1 = quote).not() true -> false }) { // BLOCK when { EQEQ(arg0 = ch, arg1 = ()) -> { // BLOCK - val tmp0_safe_receiver: Char? = nextChar($receiver = ) + val tmp0_safe_receiver: Char? = .nextChar() when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> let($receiver = tmp0_safe_receiver, block = local fun (it: Char): @FlexibleNullability StringBuilder? { + true -> tmp0_safe_receiver.let(block = local fun (it: Char): @FlexibleNullability StringBuilder? { return sb.append(p0 = it) } ) @@ -34,7 +34,7 @@ fun Reader.consumeRestOfQuotedSequence(sb: StringBuilder, quote: Char) { } /*~> Unit */ true -> sb.append(p0 = ch) /*~> Unit */ } - ch = nextChar($receiver = ) + ch = .nextChar() } } diff --git a/compiler/testData/ir/irText/lambdas/extensionLambda.kt.txt b/compiler/testData/ir/irText/lambdas/extensionLambda.kt.txt index 36d8b533ba2..d57df6d9b46 100644 --- a/compiler/testData/ir/irText/lambdas/extensionLambda.kt.txt +++ b/compiler/testData/ir/irText/lambdas/extensionLambda.kt.txt @@ -1,5 +1,5 @@ fun test1(): Int { - return run($receiver = "42", block = local fun String.(): Int { + return "42".run(block = local fun String.(): Int { return .() } ) diff --git a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt index 1a1e33cdc4e..2c344f4fdcb 100644 --- a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt +++ b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt @@ -47,7 +47,7 @@ fun test(fooImpl: IFoo, invokeImpl: IInvoke) { with(receiver = A, block = local fun A.(): Int { return with(receiver = fooImpl, block = local fun IFoo.(): Int { return with(receiver = invokeImpl, block = local fun IInvoke.(): Int { - return .invoke($receiver = .($receiver = )) + return (, (, ).()).invoke() } ) } diff --git a/compiler/testData/ir/irText/lambdas/nonLocalReturn.kt.txt b/compiler/testData/ir/irText/lambdas/nonLocalReturn.kt.txt index 04737ae5225..fdd258643b5 100644 --- a/compiler/testData/ir/irText/lambdas/nonLocalReturn.kt.txt +++ b/compiler/testData/ir/irText/lambdas/nonLocalReturn.kt.txt @@ -30,7 +30,7 @@ fun test3() { } fun testLrmFoo1(ints: List) { - forEach($receiver = ints, action = local fun (it: Int) { + ints.forEach(action = local fun (it: Int) { when { EQEQ(arg0 = it, arg1 = 0) -> return Unit } @@ -40,7 +40,7 @@ fun testLrmFoo1(ints: List) { } fun testLrmFoo2(ints: List) { - forEach($receiver = ints, action = local fun (it: Int) { + ints.forEach(action = local fun (it: Int) { when { EQEQ(arg0 = it, arg1 = 0) -> return Unit } diff --git a/compiler/testData/ir/irText/regressions/integerCoercionToT.kt.txt b/compiler/testData/ir/irText/regressions/integerCoercionToT.kt.txt index 3d8515b7bad..830c5ac39ea 100644 --- a/compiler/testData/ir/irText/regressions/integerCoercionToT.kt.txt +++ b/compiler/testData/ir/irText/regressions/integerCoercionToT.kt.txt @@ -45,6 +45,6 @@ class IdType : CPointed { } fun foo(value: IdType, cv: CInt32VarX) { - ($receiver = cv, value = value.()) + cv.(value = value.()) } diff --git a/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.kt.txt b/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.kt.txt index 7e9005e86ce..3c58f6cb39f 100644 --- a/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.kt.txt +++ b/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.kt.txt @@ -1,5 +1,5 @@ fun problematic(lss: List>): List { - return flatMap, @FlexibleNullability T?>($receiver = lss, transform = local fun (it: List): @EnhancedNullability MutableList<@FlexibleNullability T?> { + return lss.flatMap, @FlexibleNullability T?>(transform = local fun (it: List): @EnhancedNullability MutableList<@FlexibleNullability T?> { return id<@FlexibleNullability T?>(v = it) /*!! List<@FlexibleNullability T?> */ } ) diff --git a/compiler/testData/ir/irText/stubs/builtinMap.kt.txt b/compiler/testData/ir/irText/stubs/builtinMap.kt.txt index 00bcabf5d8c..8a53451e0b3 100644 --- a/compiler/testData/ir/irText/stubs/builtinMap.kt.txt +++ b/compiler/testData/ir/irText/stubs/builtinMap.kt.txt @@ -1,7 +1,7 @@ fun Map.plus(pair: Pair): Map { return when { .isEmpty() -> mapOf(pair = pair) - true -> apply>($receiver = TODO("IrConstructorCall"), block = local fun LinkedHashMap<@FlexibleNullability K1?, @FlexibleNullability V1?>.() { + true -> TODO("IrConstructorCall").apply>(block = local fun LinkedHashMap<@FlexibleNullability K1?, @FlexibleNullability V1?>.() { .put(key = pair.(), value = pair.()) /*~> Unit */ } ) diff --git a/compiler/testData/ir/irText/types/asOnPlatformType.kt.txt b/compiler/testData/ir/irText/types/asOnPlatformType.kt.txt index bf2a6d538a2..637b9bb1368 100644 --- a/compiler/testData/ir/irText/types/asOnPlatformType.kt.txt +++ b/compiler/testData/ir/irText/types/asOnPlatformType.kt.txt @@ -1,10 +1,10 @@ fun test() { val nullStr: @FlexibleNullability String? = nullString() val nonnullStr: @FlexibleNullability String? = nonnullString() - foo<@FlexibleNullability String?>($receiver = nullStr) /*~> Unit */ - foo<@FlexibleNullability String?>($receiver = nonnullStr) /*~> Unit */ - fooN<@FlexibleNullability String?>($receiver = nullStr) /*~> Unit */ - fooN<@FlexibleNullability String?>($receiver = nonnullStr) /*~> Unit */ + nullStr.foo<@FlexibleNullability String?>() /*~> Unit */ + nonnullStr.foo<@FlexibleNullability String?>() /*~> Unit */ + nullStr.fooN<@FlexibleNullability String?>() /*~> Unit */ + nonnullStr.fooN<@FlexibleNullability String?>() /*~> Unit */ } inline fun T.foo(): T { diff --git a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt index 60879c7cacd..c7a1a14e73d 100644 --- a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt +++ b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt @@ -13,7 +13,7 @@ fun scopedFlow(block: @ExtensionFunctionType SuspendFunction2 Flow.onCompletion(action: @ExtensionFunctionType SuspendFunction2, @ParameterName(...) Throwable?, Unit>): Flow { return unsafeFlow(block = local suspend fun FlowCollector.() { val safeCollector: SafeCollector = TODO("IrConstructorCall") - invokeSafely($receiver = safeCollector, action = action) + safeCollector.invokeSafely(action = action) } ) } @@ -28,16 +28,16 @@ inline fun unsafeFlow(crossinline block: @ExtensionFunctionType Suspe @Deprecated(...) fun Flow.onCompletion(action: SuspendFunction1<@ParameterName(...) Throwable?, Unit>): Flow { - return onCompletion($receiver = , action = local suspend fun FlowCollector.(it: Throwable?) { + return .onCompletion(action = local suspend fun FlowCollector.(it: Throwable?) { action.invoke(p1 = it) } ) } private fun CoroutineScope.asFairChannel(flow: Flow<*>): ReceiveChannel { - return produce($receiver = , block = local suspend fun ProducerScope.() { + return .produce(block = local suspend fun ProducerScope.() { val channel: ChannelCoroutine = .() as ChannelCoroutine - collect($receiver = flow, action = local suspend fun (value: Any?) { + flow.collect(action = local suspend fun (value: Any?) { return channel.sendFair(element = { // BLOCK val tmp0_elvis_lhs: Any? = value when { @@ -52,8 +52,8 @@ private fun CoroutineScope.asFairChannel(flow: Flow<*>): ReceiveChannel { } private fun CoroutineScope.asChannel(flow: Flow<*>): ReceiveChannel { - return produce($receiver = , block = local suspend fun ProducerScope.() { - collect($receiver = flow, action = local suspend fun (value: Any?) { + return .produce(block = local suspend fun ProducerScope.() { + flow.collect(action = local suspend fun (value: Any?) { return .().send(e = { // BLOCK val tmp0_elvis_lhs: Any? = value when { diff --git a/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt b/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt index 08efc161190..eb8c9479b9d 100644 --- a/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt @@ -15,7 +15,7 @@ fun select(x: S, y: S): S { } fun foo(a: Array>, b: Array>): Boolean { - return ofType($receiver = select>>(x = a, y = b).get(index = 0), y = true) + return select>>(x = a, y = b).get(index = 0).ofType(y = true) } inline fun In.ofType(y: Any?): Boolean { diff --git a/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt b/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt index 68a9dff7d40..231741a25c6 100644 --- a/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt @@ -15,7 +15,7 @@ fun select(x: S, y: S): S { } fun foo(a: Array>, b: Array>): Boolean { - return ofType($receiver = select>>(x = a, y = b).get(index = 0), y = true) + return select>>(x = a, y = b).get(index = 0).ofType(y = true) } inline fun In.ofType(y: Any?): Boolean { diff --git a/compiler/testData/ir/irText/types/intersectionType3_NI.kt.txt b/compiler/testData/ir/irText/types/intersectionType3_NI.kt.txt index 32f1d493de0..73ba6697aad 100644 --- a/compiler/testData/ir/irText/types/intersectionType3_NI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType3_NI.kt.txt @@ -53,26 +53,26 @@ interface Z2 : A, B { } fun testInIs1(x: In, y: In): Boolean { - return isT($receiver = sel>(x = x, y = y)) + return sel>(x = x, y = y).isT() } fun testInIs2(x: In, y: In): Boolean { - return isT($receiver = sel>(x = x, y = y)) + return sel>(x = x, y = y).isT() } fun testInIs3(x: In, y: In): Boolean { - return isT($receiver = sel>(x = x, y = y)) + return sel>(x = x, y = y).isT() } fun testInAs1(x: In, y: In) { - return asT($receiver = sel>(x = x, y = y)) + return sel>(x = x, y = y).asT() } fun testInAs2(x: In, y: In) { - return asT($receiver = sel>(x = x, y = y)) + return sel>(x = x, y = y).asT() } fun testInAs3(x: In, y: In) { - return asT($receiver = sel>(x = x, y = y)) + return sel>(x = x, y = y).asT() } diff --git a/compiler/testData/ir/irText/types/intersectionType3_OI.kt.txt b/compiler/testData/ir/irText/types/intersectionType3_OI.kt.txt index 6ea3d70446a..e1dc3be1f36 100644 --- a/compiler/testData/ir/irText/types/intersectionType3_OI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType3_OI.kt.txt @@ -53,26 +53,26 @@ interface Z2 : A, B { } fun testInIs1(x: In, y: In): Boolean { - return isT($receiver = sel>(x = x, y = y)) + return sel>(x = x, y = y).isT() } fun testInIs2(x: In, y: In): Boolean { - return isT($receiver = sel>(x = x, y = y)) + return sel>(x = x, y = y).isT() } fun testInIs3(x: In, y: In): Boolean { - return isT($receiver = sel>(x = x, y = y)) + return sel>(x = x, y = y).isT() } fun testInAs1(x: In, y: In) { - return asT($receiver = sel>(x = x, y = y)) + return sel>(x = x, y = y).asT() } fun testInAs2(x: In, y: In) { - return asT($receiver = sel>(x = x, y = y)) + return sel>(x = x, y = y).asT() } fun testInAs3(x: In, y: In) { - return asT($receiver = sel>(x = x, y = y)) + return sel>(x = x, y = y).asT() } diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt index 0f01555b3d5..4c62f03f9b8 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt @@ -93,7 +93,7 @@ fun test3() { fun test4() { // COMPOSITE { - val tmp0_container: IndexedValue<@NotNull(...) @EnhancedNullability P> = first>($receiver = withIndex<@NotNull(...) @EnhancedNullability P>($receiver = listOfNotNull() /*!! List<@NotNull(...) @EnhancedNullability P> */)) + val tmp0_container: IndexedValue<@NotNull(...) @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull(...) @EnhancedNullability P> */.withIndex<@NotNull(...) @EnhancedNullability P>().first>() val x: Int = tmp0_container.component1() val y: @NotNull(...) @EnhancedNullability P = tmp0_container.component2() // } diff --git a/compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.kt.txt index 4e77b4e03f0..a95081d4bce 100644 --- a/compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.kt.txt @@ -17,10 +17,10 @@ class C { } fun testExt() { - extension($receiver = s() /*!! String */) + s() /*!! String */.extension() } fun C.testMemberExt() { - .memberExtension($receiver = s() /*!! String */) + (, s() /*!! String */).memberExtension() } From 2a19dc32f29f898a9247f42429b5c47beb34e559 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Fri, 6 Nov 2020 01:22:57 +0300 Subject: [PATCH 137/698] [IR] update testdata: better support for IrConstructorCall --- .../ir/irText/classes/cloneable.kt.txt | 2 +- .../classes/dataClassWithArrayMembers.kt.txt | 6 ++-- .../ir/irText/classes/dataClasses.kt.txt | 6 ++-- .../irText/classes/dataClassesGeneric.kt.txt | 8 ++--- .../classes/delegatedImplementation.kt.txt | 2 +- ...citNotNullOnDelegatedImplementation.kt.txt | 10 +++--- .../inlineClassSyntheticMethods.kt.txt | 2 +- .../testData/ir/irText/classes/kt31649.kt.txt | 2 +- .../lambdaInDataClassDefaultParameter.kt.txt | 6 ++-- .../ir/irText/classes/localClasses.kt.txt | 2 +- .../classes/objectLiteralExpressions.kt.txt | 8 ++--- ...tedPropertyAccessorsWithAnnotations.kt.txt | 4 +-- .../parameters/dataClassMembers.kt.txt | 2 +- .../provideDelegate/differentReceivers.kt.txt | 2 +- .../declarations/provideDelegate/local.kt.txt | 4 +-- .../localDifferentReceivers.kt.txt | 2 +- .../provideDelegate/member.kt.txt | 4 +-- .../provideDelegate/memberExtension.kt.txt | 2 +- .../provideDelegate/topLevel.kt.txt | 4 +-- .../expressions/augmentedAssignment2.kt.txt | 4 +-- .../augmentedAssignmentWithExpression.kt.txt | 2 +- .../expressions/breakContinueInWhen.kt.txt | 12 +++++-- .../boundInnerGenericConstructor.kt.txt | 2 +- .../constructorWithAdaptedArguments.kt.txt | 6 ++-- .../callableReferences/kt37131.kt.txt | 2 +- .../withArgumentAdaptationAndReceiver.kt.txt | 4 +-- .../withVarargViewedAsArray.kt.txt | 5 ++- .../irText/expressions/classReference.kt.txt | 4 +-- .../complexAugmentedAssignment.kt.txt | 2 +- ...onstructorWithOwnTypeParametersCall.kt.txt | 4 +-- .../irText/expressions/contructorCall.kt.txt | 2 +- .../forWithImplicitReceivers.kt.txt | 2 +- .../funInterface/partialSam.kt.txt | 4 +-- ...ricConstructorCallWithTypeArguments.kt.txt | 7 ++-- .../expressions/genericPropertyRef.kt.txt | 4 +-- .../jvmFieldWithIntersectionTypes.kt.txt | 8 ++--- .../ir/irText/expressions/kt16904.kt.txt | 2 +- .../ir/irText/expressions/kt16905.kt.txt | 2 +- .../ir/irText/expressions/kt30796.kt.txt | 2 +- .../ir/irText/expressions/kt36956.kt.txt | 2 +- .../expressions/memberTypeArguments.kt.txt | 2 +- .../expressions/multipleThisReferences.kt.txt | 2 +- .../irText/expressions/objectReference.kt.txt | 2 +- .../sam/arrayAsVarargAfterSamArgument.kt.txt | 36 +++++++++++++++---- ...mConversionInGenericConstructorCall.kt.txt | 4 +-- ...nversionInGenericConstructorCall_NI.kt.txt | 8 ++--- .../sam/samConversionsWithSmartCasts.kt.txt | 18 +++++----- ...specializedTypeAliasConstructorCall.kt.txt | 2 +- .../thisOfGenericOuterClass.kt.txt | 2 +- .../thisReferenceBeforeClassDeclared.kt.txt | 4 +-- .../ir/irText/expressions/throw.kt.txt | 2 +- .../ClashResolutionDescriptor.kt.txt | 2 +- .../firProblems/InnerClassInAnonymous.kt.txt | 4 +-- .../ir/irText/firProblems/MultiList.kt.txt | 2 +- .../irText/firProblems/SignatureClash.kt.txt | 2 +- .../irText/firProblems/v8arrayToList.kt.txt | 2 +- .../lambdas/destructuringInLambda.kt.txt | 2 +- .../irText/regressions/coercionInLoop.kt.txt | 2 +- .../typeAliasCtorForGenericClass.kt.txt | 4 +-- .../ir/irText/stubs/builtinMap.kt.txt | 2 +- .../javaConstructorWithTypeParameters.kt.txt | 8 ++--- .../ir/irText/stubs/javaInnerClass.kt.txt | 2 +- .../irText/stubs/javaSyntheticProperty.kt.txt | 2 +- .../castsInsideCoroutineInference.kt.txt | 6 ++-- .../types/genericDelegatedDeepProperty.kt.txt | 8 ++--- .../irText/types/intersectionType1_NI.kt.txt | 4 +-- .../irText/types/intersectionType1_OI.kt.txt | 4 +-- .../irText/types/intersectionType2_NI.kt.txt | 4 +-- .../irText/types/intersectionType2_OI.kt.txt | 4 +-- .../enhancedNullabilityInForLoop.kt.txt | 2 +- 70 files changed, 172 insertions(+), 136 deletions(-) diff --git a/compiler/testData/ir/irText/classes/cloneable.kt.txt b/compiler/testData/ir/irText/classes/cloneable.kt.txt index 52bc36eeb0c..118dad1ff6c 100644 --- a/compiler/testData/ir/irText/classes/cloneable.kt.txt +++ b/compiler/testData/ir/irText/classes/cloneable.kt.txt @@ -39,7 +39,7 @@ class OC : I { } protected override fun clone(): OC { - return TODO("IrConstructorCall") + return OC() } diff --git a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt index 627395f11ae..777980d7c9a 100644 --- a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt +++ b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt @@ -78,7 +78,7 @@ data class Test1 { } fun copy(stringArray: Array = #stringArray, charArray: CharArray = #charArray, booleanArray: BooleanArray = #booleanArray, byteArray: ByteArray = #byteArray, shortArray: ShortArray = #shortArray, intArray: IntArray = #intArray, longArray: LongArray = #longArray, floatArray: FloatArray = #floatArray, doubleArray: DoubleArray = #doubleArray): Test1 { - return TODO("IrConstructorCall") + return Test1(stringArray = stringArray, charArray = charArray, booleanArray = booleanArray, byteArray = byteArray, shortArray = shortArray, intArray = intArray, longArray = longArray, floatArray = floatArray, doubleArray = doubleArray) } override fun toString(): String { @@ -181,7 +181,7 @@ data class Test2 { } fun copy(genericArray: Array = #genericArray): Test2 { - return TODO("IrConstructorCall") + return Test2(genericArray = genericArray) } override fun toString(): String { @@ -227,7 +227,7 @@ data class Test3 { } fun copy(anyArrayN: Array? = #anyArrayN): Test3 { - return TODO("IrConstructorCall") + return Test3(anyArrayN = anyArrayN) } override fun toString(): String { diff --git a/compiler/testData/ir/irText/classes/dataClasses.kt.txt b/compiler/testData/ir/irText/classes/dataClasses.kt.txt index 2f90fd974eb..b0998ba1ee4 100644 --- a/compiler/testData/ir/irText/classes/dataClasses.kt.txt +++ b/compiler/testData/ir/irText/classes/dataClasses.kt.txt @@ -30,7 +30,7 @@ data class Test1 { } fun copy(x: Int = #x, y: String = #y, z: Any = #z): Test1 { - return TODO("IrConstructorCall") + return Test1(x = x, y = y, z = z) } override fun toString(): String { @@ -91,7 +91,7 @@ data class Test2 { } fun copy(x: Any? = #x): Test2 { - return TODO("IrConstructorCall") + return Test2(x = x) } override fun toString(): String { @@ -164,7 +164,7 @@ data class Test3 { } fun copy(d: Double = #d, dn: Double? = #dn, f: Float = #f, df: Float? = #df): Test3 { - return TODO("IrConstructorCall") + return Test3(d = d, dn = dn, f = f, df = df) } override fun toString(): String { diff --git a/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt b/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt index 09d3531af7e..94a9694adcb 100644 --- a/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt +++ b/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt @@ -14,7 +14,7 @@ data class Test1 { } fun copy(x: T = #x): Test1 { - return TODO("IrConstructorCall") + return Test1(x = x) } override fun toString(): String { @@ -63,7 +63,7 @@ data class Test2 { } fun copy(x: T = #x): Test2 { - return TODO("IrConstructorCall") + return Test2(x = x) } override fun toString(): String { @@ -109,7 +109,7 @@ data class Test3 { } fun copy(x: List = #x): Test3 { - return TODO("IrConstructorCall") + return Test3(x = x) } override fun toString(): String { @@ -155,7 +155,7 @@ data class Test4 { } fun copy(x: List = #x): Test4 { - return TODO("IrConstructorCall") + return Test4(x = x) } override fun toString(): String { diff --git a/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt index 1bb1fe367b4..ff0bd6541fd 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt @@ -85,7 +85,7 @@ fun otherImpl(x0: String, y0: Int): IOther { } - TODO("IrConstructorCall") + () } } diff --git a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt index 815218a77c3..2b8b02ffb3c 100644 --- a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt +++ b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt @@ -70,7 +70,7 @@ class TestJFoo : IFoo { } - private /*final field*/ val $$delegate_0: JFoo = TODO("IrConstructorCall") + private /*final field*/ val $$delegate_0: JFoo = JFoo() override fun foo(): String { return #$$delegate_0.foo() /*!! String */ } @@ -87,7 +87,7 @@ class TestK1 : IFoo { } - private /*final field*/ val $$delegate_0: K1 = TODO("IrConstructorCall") + private /*final field*/ val $$delegate_0: K1 = K1() override fun foo(): String { return #$$delegate_0.foo() /*!! String */ } @@ -104,7 +104,7 @@ class TestK2 : IFoo { } - private /*final field*/ val $$delegate_0: K2 = TODO("IrConstructorCall") + private /*final field*/ val $$delegate_0: K2 = K2() override fun foo(): String { return #$$delegate_0.foo() } @@ -121,7 +121,7 @@ class TestK3 : IFoo { } - private /*final field*/ val $$delegate_0: K3 = TODO("IrConstructorCall") + private /*final field*/ val $$delegate_0: K3 = K3() override fun foo(): String { return #$$delegate_0.foo() } @@ -138,7 +138,7 @@ class TestK4 : IFoo { } - private /*final field*/ val $$delegate_0: K4 = TODO("IrConstructorCall") + private /*final field*/ val $$delegate_0: K4 = K4() override fun foo(): String { return #$$delegate_0.foo() /*!! String */ } diff --git a/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt b/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt index ca2844cba72..ef74f18ac2b 100644 --- a/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt +++ b/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt @@ -57,7 +57,7 @@ inline class IC { } fun box(): String { - val ic: IC = TODO("IrConstructorCall") + val ic: IC = IC(c = C(t = 42)) when { EQEQ(arg0 = ic.foo(), arg1 = 42).not() -> return "FAIL" } diff --git a/compiler/testData/ir/irText/classes/kt31649.kt.txt b/compiler/testData/ir/irText/classes/kt31649.kt.txt index 2cb80495b4c..87269fe8b44 100644 --- a/compiler/testData/ir/irText/classes/kt31649.kt.txt +++ b/compiler/testData/ir/irText/classes/kt31649.kt.txt @@ -14,7 +14,7 @@ data class TestData { } fun copy(nn: Nothing? = #nn): TestData { - return TODO("IrConstructorCall") + return TestData(nn = nn) } override fun toString(): String { diff --git a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt index 75a2bdf6f53..e859d69fc58 100644 --- a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt +++ b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt @@ -17,7 +17,7 @@ data class A { } fun copy(runA: @ExtensionFunctionType Function2 = #runA): A { - return TODO("IrConstructorCall") + return A(runA = runA) } override fun toString(): String { @@ -62,7 +62,7 @@ data class B { } - TODO("IrConstructorCall") + () }) /* primary */ { TODO("IrDelegatingConstructorCall") /* InstanceInitializerCall */ @@ -78,7 +78,7 @@ data class B { } fun copy(x: Any = #x): B { - return TODO("IrConstructorCall") + return B(x = x) } override fun toString(): String { diff --git a/compiler/testData/ir/irText/classes/localClasses.kt.txt b/compiler/testData/ir/irText/classes/localClasses.kt.txt index 5db69d14320..1f6a1e03773 100644 --- a/compiler/testData/ir/irText/classes/localClasses.kt.txt +++ b/compiler/testData/ir/irText/classes/localClasses.kt.txt @@ -15,6 +15,6 @@ fun outer() { } - TODO("IrConstructorCall").foo() + LocalClass().foo() } diff --git a/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt b/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt index 7e0a87fe7cf..402c0fc06b7 100644 --- a/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt +++ b/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt @@ -20,7 +20,7 @@ val test1: Any } - TODO("IrConstructorCall") + () } get @@ -43,7 +43,7 @@ val test2: IFoo } - TODO("IrConstructorCall") + () } get @@ -86,7 +86,7 @@ class Outer { } - TODO("IrConstructorCall") + () } } @@ -114,7 +114,7 @@ fun Outer.test4(): Inner { } - TODO("IrConstructorCall") + () } } diff --git a/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt index 18880d0e373..93bd5b87aa4 100644 --- a/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt @@ -35,14 +35,14 @@ class Cell { } val test1: Int /* by */ - field = TODO("IrConstructorCall") + field = Cell(value = 1) @A(...) get(): Int { return #test1$delegate.getValue(thisRef = null, kProp = ::test1) } var test2: Int /* by */ - field = TODO("IrConstructorCall") + field = Cell(value = 2) @A(...) get(): Int { return #test2$delegate.getValue(thisRef = null, kProp = ::test2) diff --git a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt index ebe8fb1c107..a8d51a25362 100644 --- a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt @@ -22,7 +22,7 @@ data class Test { } fun copy(x: T = #x, y: String = #y): Test { - return TODO("IrConstructorCall") + return Test(x = x, y = y) } override fun toString(): String { diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt index e8c6c6886cc..2ba14cf5ff2 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt @@ -23,7 +23,7 @@ operator fun String.getValue(receiver: Any?, p: Any): String { } val testO: String /* by */ - field = TODO("IrConstructorCall").provideDelegate(host = null, p = ::testO) + field = MyClass(value = "O").provideDelegate(host = null, p = ::testO) get(): String { return #testO$delegate.getValue(receiver = null, p = ::testO) } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/local.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/local.kt.txt index 1721d1eea00..6e10c0bab61 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/local.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/local.kt.txt @@ -30,7 +30,7 @@ class DelegateProvider { get operator fun provideDelegate(thisRef: Any?, property: Any?): Delegate { - return TODO("IrConstructorCall") + return Delegate(value = .()) } @@ -40,7 +40,7 @@ class DelegateProvider { fun foo() { val testMember: String - val testMember$delegate: Delegate = TODO("IrConstructorCall").provideDelegate(thisRef = null, property = ::testMember) + val testMember$delegate: Delegate = DelegateProvider(value = "OK").provideDelegate(thisRef = null, property = ::testMember) local get(): String { return testMember$delegate.getValue(thisRef = null, property = ::testMember) } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt index 0fffed7d102..0f8ebc3ca62 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt @@ -24,7 +24,7 @@ operator fun String.getValue(receiver: Any?, p: Any): String { fun box(): String { val testO: String - val testO$delegate: String = TODO("IrConstructorCall").provideDelegate(host = null, p = ::testO) + val testO$delegate: String = MyClass(value = "O").provideDelegate(host = null, p = ::testO) local get(): String { return testO$delegate.getValue(receiver = null, p = ::testO) } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt index 98919c32093..3d2696aee1d 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt @@ -30,7 +30,7 @@ class DelegateProvider { get operator fun provideDelegate(thisRef: Any?, property: Any?): Delegate { - return TODO("IrConstructorCall") + return Delegate(value = .()) } @@ -46,7 +46,7 @@ class Host { } val testMember: String /* by */ - field = TODO("IrConstructorCall").provideDelegate(thisRef = , property = ::testMember) + field = DelegateProvider(value = "OK").provideDelegate(thisRef = , property = ::testMember) get(): String { return #testMember$delegate.getValue(thisRef = , property = ::testMember) } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt index ca89f230f9b..4c102029584 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt @@ -26,7 +26,7 @@ object Host { } operator fun String.provideDelegate(host: Any?, p: Any): StringDelegate { - return TODO("IrConstructorCall") + return StringDelegate(s = ) } val String.plusK: String /* by */ diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.kt.txt index e470542c0da..20d42a51f8a 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.kt.txt @@ -30,7 +30,7 @@ class DelegateProvider { get operator fun provideDelegate(thisRef: Any?, property: Any?): Delegate { - return TODO("IrConstructorCall") + return Delegate(value = .()) } @@ -39,7 +39,7 @@ class DelegateProvider { } val testTopLevel: String /* by */ - field = TODO("IrConstructorCall").provideDelegate(thisRef = null, property = ::testTopLevel) + field = DelegateProvider(value = "OK").provideDelegate(thisRef = null, property = ::testTopLevel) get(): String { return #testTopLevel$delegate.getValue(thisRef = null, property = ::testTopLevel) } diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt b/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt index 72601051367..0c43289a5a7 100644 --- a/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt +++ b/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt @@ -26,11 +26,11 @@ operator fun A.remAssign(s: String) { } val p: A - field = TODO("IrConstructorCall") + field = A() get fun testVariable() { - val a: A = TODO("IrConstructorCall") + val a: A = A() a.plusAssign(s = "+=") a.minusAssign(s = "-=") a.timesAssign(s = "*=") diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.kt.txt b/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.kt.txt index 44a19d655a0..1c170efdb74 100644 --- a/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.kt.txt +++ b/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.kt.txt @@ -18,7 +18,7 @@ class Host { } fun foo(): Host { - return TODO("IrConstructorCall") + return Host() } fun Host.test2() { diff --git a/compiler/testData/ir/irText/expressions/breakContinueInWhen.kt.txt b/compiler/testData/ir/irText/expressions/breakContinueInWhen.kt.txt index 7af7d6a25a8..9e07f1a3a99 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInWhen.kt.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInWhen.kt.txt @@ -1,5 +1,8 @@ fun testBreakFor() { - val xs: IntArray = TODO("IrConstructorCall") + val xs: IntArray = IntArray(size = 10, init = local fun (i: Int): Int { + return i + } +) var k: Int = 0 { // BLOCK val tmp0_iterator: IntIterator = xs.iterator() @@ -35,7 +38,10 @@ fun testBreakDoWhile() { } fun testContinueFor() { - val xs: IntArray = TODO("IrConstructorCall") + val xs: IntArray = IntArray(size = 10, init = local fun (i: Int): Int { + return i + } +) var k: Int = 0 { // BLOCK val tmp0_iterator: IntIterator = xs.iterator() @@ -76,7 +82,7 @@ fun testContinueDoWhile() { // } while (less(arg0 = k, arg1 = 10)) } when { - EQEQ(arg0 = s, arg1 = "1;2;").not() -> throw TODO("IrConstructorCall") + EQEQ(arg0 = s, arg1 = "1;2;").not() -> throw AssertionError(p0 = s) } } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt index d3e0c0d349b..d2cb7bca6f3 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt @@ -37,7 +37,7 @@ inline fun foo(a: A, b: B, x: Function2>) } fun box(): String { - val z: Foo = TODO("IrConstructorCall") + val z: Foo = Foo() val foo: Inner = foo(a = "O", b = "K", x = ::) return foo.().plus(other = foo.()) } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt index 53498fc83f2..be01cbbcdc8 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt @@ -40,7 +40,7 @@ class Outer { fun testConstructor(): Any { return use(fn = local fun (p0: Int): C { - return TODO("IrConstructorCall") + return C(xs = [p0]) } ) } @@ -48,7 +48,7 @@ fun testConstructor(): Any { fun testInnerClassConstructor(outer: Outer): Any { return use(fn = { // BLOCK local fun Outer.(p0: Int): Inner { - return TODO("IrConstructorCall") + return receiver.Inner(xs = [p0]) } @@ -59,7 +59,7 @@ fun testInnerClassConstructor(outer: Outer): Any { fun testInnerClassConstructorCapturingOuter(): Any { return use(fn = { // BLOCK local fun Outer.(p0: Int): Inner { - return TODO("IrConstructorCall") + return receiver.Inner(xs = [p0]) } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt index 4acb5f7853b..4c19b2b4a82 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt @@ -31,7 +31,7 @@ fun testFn(): Any { fun testCtor(): Any { return use(fn = local fun (): C { - return TODO("IrConstructorCall") + return C() } ) } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt index 6c79c42a820..23a8b1814df 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt @@ -25,7 +25,7 @@ class Host { } fun testBoundReceiverLocalVal() { - val h: Host = TODO("IrConstructorCall") + val h: Host = Host() use(fn = { // BLOCK local fun Host.withVararg(p0: Int) { receiver.withVararg(xs = [p0]) /*~> Unit */ @@ -37,7 +37,7 @@ class Host { } fun testBoundReceiverLocalVar() { - var h: Host = TODO("IrConstructorCall") + var h: Host = Host() use(fn = { // BLOCK local fun Host.withVararg(p0: Int) { receiver.withVararg(xs = [p0]) /*~> Unit */ diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.kt.txt index 3ec8016a282..be006419800 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.kt.txt @@ -11,7 +11,10 @@ fun sum(vararg args: Int): Int { } fun nsum(vararg args: Number): Int { - return sum(args = [*TODO("IrConstructorCall")]) + return sum(args = [*IntArray(size = args.(), init = local fun (it: Int): Int { + return args.get(index = it).toInt() + } +)]) } fun zap(vararg b: String, k: Int = 42) { diff --git a/compiler/testData/ir/irText/expressions/classReference.kt.txt b/compiler/testData/ir/irText/expressions/classReference.kt.txt index 8c24a32e11f..34cb3830d0f 100644 --- a/compiler/testData/ir/irText/expressions/classReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/classReference.kt.txt @@ -12,8 +12,8 @@ class A { fun test() { A::class /*~> Unit */ - TODO("IrConstructorCall")::class /*~> Unit */ + A()::class /*~> Unit */ A::class.() /*~> Unit */ - TODO("IrConstructorCall")::class.() /*~> Unit */ + A()::class.() /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt index 09e220cb5f4..cd52c691590 100644 --- a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt +++ b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt @@ -128,6 +128,6 @@ object Host { } fun Host.test3(v: B) { - (, v).plusAssign(b = TODO("IrConstructorCall")) + (, v).plusAssign(b = B(s = 1000)) } diff --git a/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.kt.txt b/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.kt.txt index 196d9d50448..6a0928581a0 100644 --- a/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.kt.txt @@ -1,9 +1,9 @@ fun testKotlin(): K2 { - return TODO("IrConstructorCall") + return K1().K2() } fun testJava(): J2 { - return TODO("IrConstructorCall") + return J1<@FlexibleNullability Int?, @FlexibleNullability String?>().J2<@FlexibleNullability Double?, @FlexibleNullability CharSequence?>() } class K1 { diff --git a/compiler/testData/ir/irText/expressions/contructorCall.kt.txt b/compiler/testData/ir/irText/expressions/contructorCall.kt.txt index cbc8e47516b..50dcca237b7 100644 --- a/compiler/testData/ir/irText/expressions/contructorCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/contructorCall.kt.txt @@ -11,6 +11,6 @@ class A { } val test: A - field = TODO("IrConstructorCall") + field = A() get diff --git a/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt index 63d9f5759ec..af15c51841f 100644 --- a/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt +++ b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt @@ -29,7 +29,7 @@ class IntCell { interface IReceiver { operator fun FiveTimes.iterator(): IntCell { - return TODO("IrConstructorCall") + return IntCell(value = 5) } operator fun IntCell.hasNext(): Boolean { diff --git a/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt index 9f09ca71bd9..afbecadfe46 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt @@ -40,7 +40,7 @@ val fsi: Fn } - TODO("IrConstructorCall") + () } get @@ -63,7 +63,7 @@ val fis: Fn } - TODO("IrConstructorCall") + () } get diff --git a/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt b/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt index de733a79f3d..7b8f08c1967 100644 --- a/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt @@ -1,9 +1,12 @@ fun testSimple(): Box { - return TODO("IrConstructorCall") + return Box(value = 2L.times(other = 3)) } inline fun testArray(n: Int, crossinline block: Function0): Array { - return TODO("IrConstructorCall") + return Array(size = n, init = local fun (it: Int): T { + return block.invoke() + } +) } class Box { diff --git a/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt b/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt index 7f609db12b1..3a91b1db879 100644 --- a/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt +++ b/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt @@ -21,13 +21,13 @@ class Value { } val Value.additionalText: Int /* by */ - field = TODO("IrConstructorCall") + field = DVal(kmember = ::text) get(): Int { return #additionalText$delegate.getValue(t = , p = ::additionalText) } val Value.additionalValue: Int /* by */ - field = TODO("IrConstructorCall") + field = DVal(kmember = ::value) get(): Int { return #additionalValue$delegate.getValue(t = , p = ::additionalValue) } diff --git a/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt b/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt index 4e9fd5ade2a..283ab4d59c4 100644 --- a/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt +++ b/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt @@ -65,16 +65,16 @@ class DerivedThroughMid2 : Mid, IFoo { } fun test(b: Boolean) { - val d1: Derived1 = TODO("IrConstructorCall") - val d2: Derived2 = TODO("IrConstructorCall") + val d1: Derived1 = Derived1() + val d2: Derived2 = Derived2() val k: Any = when { b -> d1 true -> d2 } #f = 42 #f /*~> Unit */ - val md1: DerivedThroughMid1 = TODO("IrConstructorCall") - val md2: DerivedThroughMid2 = TODO("IrConstructorCall") + val md1: DerivedThroughMid1 = DerivedThroughMid1() + val md2: DerivedThroughMid2 = DerivedThroughMid2() val mk: Any = when { b -> md1 true -> md2 diff --git a/compiler/testData/ir/irText/expressions/kt16904.kt.txt b/compiler/testData/ir/irText/expressions/kt16904.kt.txt index 955aaa204a8..a718472cb3f 100644 --- a/compiler/testData/ir/irText/expressions/kt16904.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt16904.kt.txt @@ -6,7 +6,7 @@ abstract class A { } val x: B - field = TODO("IrConstructorCall") + field = B() get var y: Int diff --git a/compiler/testData/ir/irText/expressions/kt16905.kt.txt b/compiler/testData/ir/irText/expressions/kt16905.kt.txt index 99a9519206c..30a1416661a 100644 --- a/compiler/testData/ir/irText/expressions/kt16905.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt16905.kt.txt @@ -48,6 +48,6 @@ class Outer { typealias OI = Inner fun test(): Inner { - return TODO("IrConstructorCall") + return Outer().Inner() } diff --git a/compiler/testData/ir/irText/expressions/kt30796.kt.txt b/compiler/testData/ir/irText/expressions/kt30796.kt.txt index 12526d1473e..6e9bd7a3268 100644 --- a/compiler/testData/ir/irText/expressions/kt30796.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt30796.kt.txt @@ -1,5 +1,5 @@ fun magic(): T { - throw TODO("IrConstructorCall") + throw Exception() } fun test(value: T, value2: T) { diff --git a/compiler/testData/ir/irText/expressions/kt36956.kt.txt b/compiler/testData/ir/irText/expressions/kt36956.kt.txt index 90da1570330..8b8e5d02e33 100644 --- a/compiler/testData/ir/irText/expressions/kt36956.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt36956.kt.txt @@ -22,7 +22,7 @@ class A { } val aFloat: A - field = TODO("IrConstructorCall") + field = A(value = 0.0F) get val aInt: Float diff --git a/compiler/testData/ir/irText/expressions/memberTypeArguments.kt.txt b/compiler/testData/ir/irText/expressions/memberTypeArguments.kt.txt index 4102378e6ae..15b69e36805 100644 --- a/compiler/testData/ir/irText/expressions/memberTypeArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/memberTypeArguments.kt.txt @@ -10,7 +10,7 @@ class GenericClass { get fun withNewValue(newValue: T): GenericClass { - return TODO("IrConstructorCall") + return GenericClass(value = newValue) } diff --git a/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt b/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt index 570c8ea6ce0..504335e0a82 100644 --- a/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt +++ b/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt @@ -56,7 +56,7 @@ class Host { } - TODO("IrConstructorCall") + () } } diff --git a/compiler/testData/ir/irText/expressions/objectReference.kt.txt b/compiler/testData/ir/irText/expressions/objectReference.kt.txt index 302e727b38a..ed74279f699 100644 --- a/compiler/testData/ir/irText/expressions/objectReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/objectReference.kt.txt @@ -85,7 +85,7 @@ object Z { } - TODO("IrConstructorCall") + () } get diff --git a/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.kt.txt b/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.kt.txt index 226510ea91a..71767b36eba 100644 --- a/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.kt.txt +++ b/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.kt.txt @@ -13,12 +13,36 @@ fun test(fn: Function0, r: Runnable, arr: Array) { foo1(r = fn /*-> @FlexibleNullability Runnable? */, strs = arr) /*~> Unit */ foo1(r = fn /*-> @FlexibleNullability Runnable? */, strs = [*arr]) /*~> Unit */ foo1(r = r, strs = [*arr]) /*~> Unit */ - val i1: Test = TODO("IrConstructorCall") - val i2: Test = TODO("IrConstructorCall") - val i3: Test = TODO("IrConstructorCall") - val i4: Test = TODO("IrConstructorCall") - val i5: Test = TODO("IrConstructorCall") - val i6: Test = TODO("IrConstructorCall") + val i1: Test = Test(r = local fun () { + return Unit + } + /*-> @FlexibleNullability Runnable? */, strs = arr) + val i2: Test = Test(r = local fun () { + return Unit + } + /*-> @FlexibleNullability Runnable? */, strs = [*arr]) + val i3: Test = Test(r1 = local fun () { + return Unit + } + /*-> @FlexibleNullability Runnable? */, r2 = local fun () { + return Unit + } + /*-> @FlexibleNullability Runnable? */, strs = arr) + val i4: Test = Test(r1 = r, r2 = local fun () { + return Unit + } + /*-> @FlexibleNullability Runnable? */, strs = [""]) + val i5: Test = Test(r1 = local fun () { + return Unit + } + /*-> @FlexibleNullability Runnable? */, r2 = local fun () { + return Unit + } + /*-> @FlexibleNullability Runnable? */, strs = [*arr]) + val i6: Test = Test(r1 = r, r2 = local fun () { + return Unit + } + /*-> @FlexibleNullability Runnable? */, strs = [*arr]) i1.foo2(r1 = local fun () { return Unit } diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall.kt.txt index a9f824ba338..695c032f2d0 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall.kt.txt @@ -1,9 +1,9 @@ fun test1(f: Function1): C<@FlexibleNullability String?> { - return TODO("IrConstructorCall") + return C<@FlexibleNullability String?>(jxx = f /*-> @FlexibleNullability J<@FlexibleNullability String?, @FlexibleNullability String?>? */) } fun test2(x: Any) { x as Function1 /*~> Unit */ - TODO("IrConstructorCall") /*~> Unit */ + C<@FlexibleNullability String?>(jxx = x /*as Function1<@ParameterName(...) @FlexibleNullability String?, @FlexibleNullability String?> */ /*-> @FlexibleNullability J<@FlexibleNullability String?, @FlexibleNullability String?>? */) /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt index 4043b3ac501..76b72398f61 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt @@ -1,5 +1,5 @@ fun test3(f1: Function1, f2: Function1): D<@FlexibleNullability Int?, @FlexibleNullability String?> { - return TODO("IrConstructorCall") + return C<@FlexibleNullability String?>(jxx = f1 /*-> @FlexibleNullability J<@FlexibleNullability String?, @FlexibleNullability String?>? */).D<@FlexibleNullability Int?>(jxy = f2 /*-> @FlexibleNullability J<@FlexibleNullability String?, @FlexibleNullability Int?>? */) } class Outer { @@ -35,15 +35,15 @@ class Outer { } fun test4(f: Function1, g: Function1): Inner<@FlexibleNullability Any?, @FlexibleNullability String?> { - return TODO("IrConstructorCall") + return Outer<@FlexibleNullability String?>(j11 = f /*-> J<@FlexibleNullability String?, @FlexibleNullability String?> */).Inner<@FlexibleNullability Any?>(j12 = g /*-> J<@FlexibleNullability String?, @FlexibleNullability Any?> */) } fun testGenericJavaCtor1(f: Function1): G<@FlexibleNullability String?> { - return TODO("IrConstructorCall") + return G<@FlexibleNullability String?, @FlexibleNullability Int?>(x = f /*-> @FlexibleNullability J<@FlexibleNullability Int?, @FlexibleNullability String?>? */) } fun testGenericJavaCtor2(x: Any) { x as Function1 /*~> Unit */ - TODO("IrConstructorCall") /*~> Unit */ + G<@FlexibleNullability String?, @FlexibleNullability Int?>(x = x /*as Function1<@ParameterName(...) @FlexibleNullability String?, @FlexibleNullability Int?> */ /*-> @FlexibleNullability J<@FlexibleNullability Int?, @FlexibleNullability String?>? */) /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.kt.txt index 8fbbf0f2a7e..396d6a3ad01 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.kt.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.kt.txt @@ -9,7 +9,7 @@ fun test1(a: Function0) { fun test2(a: Function0) { when { a is Runnable -> { // BLOCK - TODO("IrConstructorCall").run1(r = a /*as Runnable */) + J().run1(r = a /*as Runnable */) } } } @@ -17,7 +17,7 @@ fun test2(a: Function0) { fun test3(a: Function0) { when { a is Runnable -> { // BLOCK - TODO("IrConstructorCall").run2(r1 = a /*as Runnable */, r2 = a /*as Runnable */) + J().run2(r1 = a /*as Runnable */, r2 = a /*as Runnable */) } } } @@ -25,7 +25,7 @@ fun test3(a: Function0) { fun test4(a: Function0, b: Function0) { when { a is Runnable -> { // BLOCK - TODO("IrConstructorCall").run2(r1 = a /*-> @FlexibleNullability Runnable? */, r2 = b /*-> @FlexibleNullability Runnable? */) + J().run2(r1 = a /*-> @FlexibleNullability Runnable? */, r2 = b /*-> @FlexibleNullability Runnable? */) } } } @@ -33,7 +33,7 @@ fun test4(a: Function0, b: Function0) { fun test5(a: Any) { when { a is Runnable -> { // BLOCK - TODO("IrConstructorCall").run1(r = a /*as Runnable */) + J().run1(r = a /*as Runnable */) } } } @@ -42,26 +42,26 @@ fun test5x(a: Any) { when { a is Runnable -> { // BLOCK a as Function0 /*~> Unit */ - TODO("IrConstructorCall").run1(r = a /*as Runnable */) + J().run1(r = a /*as Runnable */) } } } fun test6(a: Any) { a as Function0 /*~> Unit */ - TODO("IrConstructorCall").run1(r = a /*as Function0 */ /*-> @FlexibleNullability Runnable? */) + J().run1(r = a /*as Function0 */ /*-> @FlexibleNullability Runnable? */) } fun test7(a: Function1) { a as Function0 /*~> Unit */ - TODO("IrConstructorCall").run1(r = a /*as Function0 */ /*-> @FlexibleNullability Runnable? */) + J().run1(r = a /*as Function0 */ /*-> @FlexibleNullability Runnable? */) } fun test8(a: Function0) { - TODO("IrConstructorCall").run1(r = id<@FlexibleNullability Function0?>(x = a) /*!! Function0 */ /*-> @FlexibleNullability Runnable? */) + J().run1(r = id<@FlexibleNullability Function0?>(x = a) /*!! Function0 */ /*-> @FlexibleNullability Runnable? */) } fun test9() { - TODO("IrConstructorCall").run1(r = ::test9 /*-> @FlexibleNullability Runnable? */) + J().run1(r = ::test9 /*-> @FlexibleNullability Runnable? */) } diff --git a/compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.kt.txt b/compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.kt.txt index 21bb6a5cf5e..03d6718bd5e 100644 --- a/compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.kt.txt @@ -16,6 +16,6 @@ class Cell { typealias IntAlias = Cell fun test(): Cell { - return TODO("IrConstructorCall") + return Cell(value = 42) } diff --git a/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt b/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt index 8da74d6a5a8..899e289caa3 100644 --- a/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt +++ b/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt @@ -49,7 +49,7 @@ fun Outer.test(): Inner { } - TODO("IrConstructorCall") + () } } diff --git a/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt b/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt index fb28868a546..2035f6a97aa 100644 --- a/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt +++ b/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt @@ -13,7 +13,7 @@ fun WithCompanion.test() { } - TODO("IrConstructorCall") + () } val test2: = { // BLOCK local class : WithCompanion { @@ -29,7 +29,7 @@ fun WithCompanion.test() { } - TODO("IrConstructorCall") + () } } diff --git a/compiler/testData/ir/irText/expressions/throw.kt.txt b/compiler/testData/ir/irText/expressions/throw.kt.txt index fdd10538152..e80fdc7a1f5 100644 --- a/compiler/testData/ir/irText/expressions/throw.kt.txt +++ b/compiler/testData/ir/irText/expressions/throw.kt.txt @@ -1,5 +1,5 @@ fun test1() { - throw TODO("IrConstructorCall") + throw Throwable() } fun testImplicitCast(a: Any) { diff --git a/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt index 3964e87a4cd..bd1b4d57924 100644 --- a/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt +++ b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt @@ -69,7 +69,7 @@ fun resolveClashesIfAny(container: ComponentContainer, clashResolvers: List tmp1_elvis_lhs } } - val substituteDescriptor: ClashResolutionDescriptor>>>>> = TODO("IrConstructorCall") + val substituteDescriptor: ClashResolutionDescriptor>>>>> = ClashResolutionDescriptor>>>>>(container = container, resolver = resolver, clashedComponents = clashedComponents.toList()) } } } diff --git a/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt b/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt index 2e326ce32da..9cda3191fef 100644 --- a/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt +++ b/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt @@ -12,7 +12,7 @@ fun box(): String { get fun foo(): String { - return TODO("IrConstructorCall").bar() + return .Some(s = "O").bar() } local inner class Some : Base { @@ -53,7 +53,7 @@ fun box(): String { } - TODO("IrConstructorCall") + () } return obj.foo() } diff --git a/compiler/testData/ir/irText/firProblems/MultiList.kt.txt b/compiler/testData/ir/irText/firProblems/MultiList.kt.txt index d3f9d6e0079..32ce6da9caf 100644 --- a/compiler/testData/ir/irText/firProblems/MultiList.kt.txt +++ b/compiler/testData/ir/irText/firProblems/MultiList.kt.txt @@ -14,7 +14,7 @@ data class Some { } fun copy(value: T = #value): Some { - return TODO("IrConstructorCall") + return Some(value = value) } override fun toString(): String { diff --git a/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt b/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt index a5ba4f95802..824d78dbb52 100644 --- a/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt +++ b/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt @@ -59,7 +59,7 @@ data class DataClass : Derived, Delegate { } fun copy(delegate: Delegate = #delegate): DataClass { - return TODO("IrConstructorCall") + return DataClass(delegate = delegate) } override fun toString(): String { diff --git a/compiler/testData/ir/irText/firProblems/v8arrayToList.kt.txt b/compiler/testData/ir/irText/firProblems/v8arrayToList.kt.txt index cc6c848bb8d..922223e6148 100644 --- a/compiler/testData/ir/irText/firProblems/v8arrayToList.kt.txt +++ b/compiler/testData/ir/irText/firProblems/v8arrayToList.kt.txt @@ -11,7 +11,7 @@ class V8Array { } fun box(): String { - val array: V8Array = TODO("IrConstructorCall") + val array: V8Array = V8Array() val list: List = toList(array = array) as List return list.get(index = 0) } diff --git a/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt b/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt index eb461e9e0e7..18a78f1ae74 100644 --- a/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt +++ b/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt @@ -22,7 +22,7 @@ data class A { } fun copy(x: Int = #x, y: Int = #y): A { - return TODO("IrConstructorCall") + return A(x = x, y = y) } override fun toString(): String { diff --git a/compiler/testData/ir/irText/regressions/coercionInLoop.kt.txt b/compiler/testData/ir/irText/regressions/coercionInLoop.kt.txt index fab7b050566..eeb31095210 100644 --- a/compiler/testData/ir/irText/regressions/coercionInLoop.kt.txt +++ b/compiler/testData/ir/irText/regressions/coercionInLoop.kt.txt @@ -1,5 +1,5 @@ fun box(): String { - val a: DoubleArray = TODO("IrConstructorCall") + val a: DoubleArray = DoubleArray(size = 5) val x: DoubleIterator = a.iterator() var i: Int = 0 while (x.hasNext()) { // BLOCK diff --git a/compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.kt.txt b/compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.kt.txt index 024fd5d302a..0ef13c0c97c 100644 --- a/compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.kt.txt +++ b/compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.kt.txt @@ -17,7 +17,7 @@ class A { typealias B = A typealias B2 = A> fun bar() { - val b: A = TODO("IrConstructorCall") - val b2: A> = TODO("IrConstructorCall") + val b: A = A(q = 2) + val b2: A> = A>(q = b) } diff --git a/compiler/testData/ir/irText/stubs/builtinMap.kt.txt b/compiler/testData/ir/irText/stubs/builtinMap.kt.txt index 8a53451e0b3..8cef277aeac 100644 --- a/compiler/testData/ir/irText/stubs/builtinMap.kt.txt +++ b/compiler/testData/ir/irText/stubs/builtinMap.kt.txt @@ -1,7 +1,7 @@ fun Map.plus(pair: Pair): Map { return when { .isEmpty() -> mapOf(pair = pair) - true -> TODO("IrConstructorCall").apply>(block = local fun LinkedHashMap<@FlexibleNullability K1?, @FlexibleNullability V1?>.() { + true -> LinkedHashMap<@FlexibleNullability K1?, @FlexibleNullability V1?>(p0 = ).apply>(block = local fun LinkedHashMap<@FlexibleNullability K1?, @FlexibleNullability V1?>.() { .put(key = pair.(), value = pair.()) /*~> Unit */ } ) diff --git a/compiler/testData/ir/irText/stubs/javaConstructorWithTypeParameters.kt.txt b/compiler/testData/ir/irText/stubs/javaConstructorWithTypeParameters.kt.txt index 9e547cac5c6..f0707ec2280 100644 --- a/compiler/testData/ir/irText/stubs/javaConstructorWithTypeParameters.kt.txt +++ b/compiler/testData/ir/irText/stubs/javaConstructorWithTypeParameters.kt.txt @@ -1,16 +1,16 @@ fun test1(): J1 { - return TODO("IrConstructorCall") + return J1<@FlexibleNullability Int?>() } fun test2(): J1 { - return TODO("IrConstructorCall") + return J1<@FlexibleNullability Int?, @FlexibleNullability Int?>(x1 = 1) } fun test3(j1: J1): J2 { - return TODO("IrConstructorCall") + return j1.J2<@FlexibleNullability Int?>() } fun test4(j1: J1): J2 { - return TODO("IrConstructorCall") + return j1.J2<@FlexibleNullability Int?, @FlexibleNullability Int?>(x2 = 1) } diff --git a/compiler/testData/ir/irText/stubs/javaInnerClass.kt.txt b/compiler/testData/ir/irText/stubs/javaInnerClass.kt.txt index c516dc6d2c3..4e94cf73896 100644 --- a/compiler/testData/ir/irText/stubs/javaInnerClass.kt.txt +++ b/compiler/testData/ir/irText/stubs/javaInnerClass.kt.txt @@ -6,7 +6,7 @@ class Test1 : J { } val test: JInner - field = TODO("IrConstructorCall") + field = .JInner() get diff --git a/compiler/testData/ir/irText/stubs/javaSyntheticProperty.kt.txt b/compiler/testData/ir/irText/stubs/javaSyntheticProperty.kt.txt index fd847fac41e..695d8b841e8 100644 --- a/compiler/testData/ir/irText/stubs/javaSyntheticProperty.kt.txt +++ b/compiler/testData/ir/irText/stubs/javaSyntheticProperty.kt.txt @@ -1,4 +1,4 @@ val test: @FlexibleNullability String? - field = TODO("IrConstructorCall").getFoo() + field = J().getFoo() get diff --git a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt index c7a1a14e73d..3db7e18aa7d 100644 --- a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt +++ b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt @@ -12,7 +12,7 @@ fun scopedFlow(block: @ExtensionFunctionType SuspendFunction2 Flow.onCompletion(action: @ExtensionFunctionType SuspendFunction2, @ParameterName(...) Throwable?, Unit>): Flow { return unsafeFlow(block = local suspend fun FlowCollector.() { - val safeCollector: SafeCollector = TODO("IrConstructorCall") + val safeCollector: SafeCollector = SafeCollector(collector = ) safeCollector.invokeSafely(action = action) } ) @@ -41,7 +41,7 @@ private fun CoroutineScope.asFairChannel(flow: Flow<*>): ReceiveChannel { return channel.sendFair(element = { // BLOCK val tmp0_elvis_lhs: Any? = value when { - EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> TODO("IrConstructorCall") + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> Any() true -> tmp0_elvis_lhs } }) @@ -57,7 +57,7 @@ private fun CoroutineScope.asChannel(flow: Flow<*>): ReceiveChannel { return .().send(e = { // BLOCK val tmp0_elvis_lhs: Any? = value when { - EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> TODO("IrConstructorCall") + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> Any() true -> tmp0_elvis_lhs } }) diff --git a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt index b8676199a9c..d97dd0b3864 100644 --- a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt +++ b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt @@ -124,7 +124,7 @@ val Value>.additionalText: P /* by */ } - TODO("IrConstructorCall") + () } private get(): Any? { return #deepO$delegate.getValue(t = , p = ::deepO) /*as Any? */ @@ -149,14 +149,14 @@ val Value>.additionalText: P /* by */ } - TODO("IrConstructorCall") + () } private get(): Any? { return #deepK$delegate.getValue(t = , p = ::deepK) /*as Any? */ } override operator fun getValue(t: Value>, p: KProperty<*>): P { - return TODO("IrConstructorCall") + return P(p1 = (, t).() /*as Any? */, p2 = (, t).() /*as Any? */) } @@ -165,7 +165,7 @@ val Value>.additionalText: P /* by */ } - TODO("IrConstructorCall") + () } get(): P { return #additionalText$delegate.getValue(t = , p = ::additionalText) diff --git a/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt b/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt index eb8c9479b9d..af41877bf00 100644 --- a/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt @@ -23,8 +23,8 @@ inline fun In.ofType(y: Any?): Boolean { } fun test() { - val a1: Array> = arrayOf>(elements = [TODO("IrConstructorCall")]) - val a2: Array> = arrayOf>(elements = [TODO("IrConstructorCall")]) + val a1: Array> = arrayOf>(elements = [In()]) + val a2: Array> = arrayOf>(elements = [In()]) foo(a = a1, b = a2) /*~> Unit */ } diff --git a/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt b/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt index 231741a25c6..fc1ecd782b3 100644 --- a/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt @@ -23,8 +23,8 @@ inline fun In.ofType(y: Any?): Boolean { } fun test() { - val a1: Array> = arrayOf>(elements = [TODO("IrConstructorCall")]) - val a2: Array> = arrayOf>(elements = [TODO("IrConstructorCall")]) + val a1: Array> = arrayOf>(elements = [In()]) + val a2: Array> = arrayOf>(elements = [In()]) foo(a = a1, b = a2) /*~> Unit */ } diff --git a/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt b/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt index 36ffdc3287b..1319b782b2b 100644 --- a/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt @@ -40,8 +40,8 @@ fun run(fn: Function0): T { fun foo(): Any { return run(fn = local fun (): Any { - val mm: B = TODO("IrConstructorCall") - val nn: C = TODO("IrConstructorCall") + val mm: B = B() + val nn: C = C() val c: Any = when { true -> mm true -> nn diff --git a/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt b/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt index 36ffdc3287b..1319b782b2b 100644 --- a/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt @@ -40,8 +40,8 @@ fun run(fn: Function0): T { fun foo(): Any { return run(fn = local fun (): Any { - val mm: B = TODO("IrConstructorCall") - val nn: C = TODO("IrConstructorCall") + val mm: B = B() + val nn: C = C() val c: Any = when { true -> mm true -> nn diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt index 26b9674931d..ac107a86453 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt @@ -100,7 +100,7 @@ data class P { } fun copy(x: Int = #x, y: Int = #y): P { - return TODO("IrConstructorCall") + return P(x = x, y = y) } override fun toString(): String { From 84d6e4359078d4d6462f54efe2e09afc1464f1bf Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Fri, 6 Nov 2020 01:35:38 +0300 Subject: [PATCH 138/698] [IR] update testdata: print arguments for annotations --- ...egatedImplementationOfJavaInterface.kt.txt | 4 +-- .../annotationsInAnnotationArguments.kt.txt | 4 +-- ...notationsWithDefaultParameterValues.kt.txt | 10 +++---- .../annotationsWithVarargParameters.kt.txt | 6 ++-- .../arrayInAnnotationArguments.kt.txt | 8 +++--- .../classLiteralInAnnotation.kt.txt | 2 +- .../annotations/classesWithAnnotations.kt.txt | 12 ++++---- ...nstExpressionsInAnnotationArguments.kt.txt | 4 +-- .../constructorsWithAnnotations.kt.txt | 4 +-- ...tedPropertyAccessorsWithAnnotations.kt.txt | 6 ++-- .../enumEntriesWithAnnotations.kt.txt | 4 +-- .../enumsInAnnotationArguments.kt.txt | 2 +- .../annotations/fileAnnotations.kt.txt | 4 +-- .../functionsWithAnnotations.kt.txt | 2 +- .../annotations/javaAnnotation.kt.txt | 6 ++-- ...lDelegatedPropertiesWithAnnotations.kt.txt | 2 +- .../propertiesWithAnnotations.kt.txt | 2 +- ...ssorsFromClassHeaderWithAnnotations.kt.txt | 6 ++-- .../propertyAccessorsWithAnnotations.kt.txt | 12 ++++---- ...spreadOperatorInAnnotationArguments.kt.txt | 2 +- .../typeAliasesWithAnnotations.kt.txt | 4 +-- .../typeParametersWithAnnotations.kt.txt | 2 +- .../varargsInAnnotationArguments.kt.txt | 12 ++++---- .../variablesWithAnnotations.kt.txt | 4 +-- .../declarations/deprecatedProperty.kt.txt | 22 +++++++-------- .../declarations/fileWithAnnotations.kt.txt | 2 +- .../ir/irText/declarations/typeAlias.kt.txt | 2 +- .../caoWithAdaptationForSam.kt.txt | 2 +- ...mConversionInGenericConstructorCall.kt.txt | 2 +- ...nversionInGenericConstructorCall_NI.kt.txt | 2 +- .../sam/samConversionToGeneric.kt.txt | 4 +-- .../firProblems/AnnotationInAnnotation.kt.txt | 2 +- .../ir/irText/firProblems/deprecated.kt.txt | 4 +-- .../castsInsideCoroutineInference.kt.txt | 20 ++++++------- ...ullabilityInDestructuringAssignment.kt.txt | 28 +++++++++---------- .../enhancedNullabilityInForLoop.kt.txt | 22 +++++++-------- 36 files changed, 118 insertions(+), 118 deletions(-) diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt index 3a45ad54790..86f4514d770 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt @@ -9,12 +9,12 @@ class Test : J { field = j private get - @NotNull(...) + @NotNull() override fun returnNotNull(): @EnhancedNullability String { return #j.returnNotNull() } - @Nullable(...) + @Nullable() override fun returnNullable(): @EnhancedNullability String? { return #j.returnNullable() } diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsInAnnotationArguments.kt.txt index 711c1e775ef..2f363923fe6 100644 --- a/compiler/testData/ir/irText/declarations/annotations/annotationsInAnnotationArguments.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsInAnnotationArguments.kt.txt @@ -31,8 +31,8 @@ annotation class AA : Annotation { } -@A2(...) -@AA(...) +@A2(a = A1(x = 42)) +@AA(xs = [A1(x = 1), A1(x = 2)]) fun test() { } diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.kt.txt index 81c99af6ec3..00f1bbc1501 100644 --- a/compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.kt.txt @@ -13,23 +13,23 @@ annotation class A : Annotation { } -@A(...) +@A(x = "abc", y = 123) fun test1() { } -@A(...) +@A(x = "def") fun test2() { } -@A(...) +@A(x = "ghi") fun test3() { } -@A(...) +@A(, y = 456) fun test4() { } -@A(...) +@A() fun test5() { } diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsWithVarargParameters.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsWithVarargParameters.kt.txt index 85037c6c8e0..8097e7ff61d 100644 --- a/compiler/testData/ir/irText/declarations/annotations/annotationsWithVarargParameters.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsWithVarargParameters.kt.txt @@ -9,15 +9,15 @@ annotation class A : Annotation { } -@A(...) +@A(xs = ["abc", "def"]) fun test1() { } -@A(...) +@A(xs = ["abc"]) fun test2() { } -@A(...) +@A(xs = []) fun test3() { } diff --git a/compiler/testData/ir/irText/declarations/annotations/arrayInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/arrayInAnnotationArguments.kt.txt index 022c8245694..3c178b9482e 100644 --- a/compiler/testData/ir/irText/declarations/annotations/arrayInAnnotationArguments.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/arrayInAnnotationArguments.kt.txt @@ -20,13 +20,13 @@ annotation class TestAnnWithStringArray : Annotation { } -@TestAnnWithIntArray(...) -@TestAnnWithStringArray(...) +@TestAnnWithIntArray(x = [1, 2, 3]) +@TestAnnWithStringArray(x = ["a", "b", "c"]) fun test1() { } -@TestAnnWithIntArray(...) -@TestAnnWithStringArray(...) +@TestAnnWithIntArray(x = [4, 5, 6]) +@TestAnnWithStringArray(x = ["d", "e", "f"]) fun test2() { } diff --git a/compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.kt.txt b/compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.kt.txt index 6e6eab96d8e..b5500f3de3b 100644 --- a/compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.kt.txt @@ -21,7 +21,7 @@ class C { } -@A(...) +@A(klass = C::class) fun test1() { } diff --git a/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt index d16a9469969..e50f8ed8d4a 100644 --- a/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt @@ -9,7 +9,7 @@ annotation class TestAnn : Annotation { } -@TestAnn(...) +@TestAnn(x = "class") class TestClass { constructor() /* primary */ { TODO("IrDelegatingConstructorCall") @@ -22,14 +22,14 @@ class TestClass { } -@TestAnn(...) +@TestAnn(x = "interface") interface TestInterface { } -@TestAnn(...) +@TestAnn(x = "object") object TestObject { private constructor() /* primary */ { TODO("IrDelegatingConstructorCall") @@ -49,7 +49,7 @@ class Host { } - @TestAnn(...) + @TestAnn(x = "companion") companion object TestCompanion { private constructor() /* primary */ { TODO("IrDelegatingConstructorCall") @@ -67,7 +67,7 @@ class Host { } -@TestAnn(...) +@TestAnn(x = "enum") enum class TestEnum : Enum { private constructor() /* primary */ { TODO("IrEnumConstructorCall") @@ -88,7 +88,7 @@ enum class TestEnum : Enum { } -@TestAnn(...) +@TestAnn(x = "annotation") annotation class TestAnnotation : Annotation { constructor() /* primary */ diff --git a/compiler/testData/ir/irText/declarations/annotations/constExpressionsInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/constExpressionsInAnnotationArguments.kt.txt index 22b8ae751cd..c88bd0dff4f 100644 --- a/compiler/testData/ir/irText/declarations/annotations/constExpressionsInAnnotationArguments.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/constExpressionsInAnnotationArguments.kt.txt @@ -13,11 +13,11 @@ annotation class A : Annotation { } -@A(...) +@A(x = 1) fun test1() { } -@A(...) +@A(x = 2) fun test2() { } diff --git a/compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.kt.txt index 0eb4c898228..063b9b7a047 100644 --- a/compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.kt.txt @@ -10,14 +10,14 @@ annotation class TestAnn : Annotation { } class TestClass { - @TestAnn(...) + @TestAnn(x = 1) constructor() /* primary */ { TODO("IrDelegatingConstructorCall") /* InstanceInitializerCall */ } - @TestAnn(...) + @TestAnn(x = 2) constructor(x: Int) { TODO("IrDelegatingConstructorCall") } diff --git a/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt index 93bd5b87aa4..d9811eb7188 100644 --- a/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt @@ -36,18 +36,18 @@ class Cell { val test1: Int /* by */ field = Cell(value = 1) - @A(...) + @A(x = "test1.get") get(): Int { return #test1$delegate.getValue(thisRef = null, kProp = ::test1) } var test2: Int /* by */ field = Cell(value = 2) - @A(...) + @A(x = "test2.get") get(): Int { return #test2$delegate.getValue(thisRef = null, kProp = ::test2) } - @A(...) + @A(x = "test2.set") set(: Int) { return #test2$delegate.setValue(thisRef = null, kProp = ::test2, newValue = ) } diff --git a/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.kt.txt index 7b20269bb30..638abe752af 100644 --- a/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.kt.txt @@ -16,8 +16,8 @@ open enum class TestEnum : Enum { } - @TestAnn(...) - ENTRY1 init = TODO("IrEnumConstructorCall") @TestAnn(...) + @TestAnn(x = "ENTRY1") + ENTRY1 init = TODO("IrEnumConstructorCall") @TestAnn(x = "ENTRY2") ENTRY2 init = TODO("IrEnumConstructorCall") diff --git a/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt index 738f36ef3cf..cfc72b1db32 100644 --- a/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt @@ -29,7 +29,7 @@ annotation class TestAnn : Annotation { } -@TestAnn(...) +@TestAnn(x = En) fun test1() { } diff --git a/compiler/testData/ir/irText/declarations/annotations/fileAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/fileAnnotations.kt.txt index 6f671ccd6ea..2a5dc1df86b 100644 --- a/compiler/testData/ir/irText/declarations/annotations/fileAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/fileAnnotations.kt.txt @@ -1,7 +1,7 @@ -@file:A(...) +@file:A(x = "File annotation") package test -@Target(...) +@Target(allowedTargets = [AnnotationTarget]) annotation class A : Annotation { constructor(x: String) /* primary */ val x: String diff --git a/compiler/testData/ir/irText/declarations/annotations/functionsWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/functionsWithAnnotations.kt.txt index 615eedabed1..21ea5ae1e19 100644 --- a/compiler/testData/ir/irText/declarations/annotations/functionsWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/functionsWithAnnotations.kt.txt @@ -9,7 +9,7 @@ annotation class TestAnn : Annotation { } -@TestAnn(...) +@TestAnn(x = 42) fun testSimpleFunction() { } diff --git a/compiler/testData/ir/irText/declarations/annotations/javaAnnotation.kt.txt b/compiler/testData/ir/irText/declarations/annotations/javaAnnotation.kt.txt index 0adaea091db..7ab3c0d2ffc 100644 --- a/compiler/testData/ir/irText/declarations/annotations/javaAnnotation.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/javaAnnotation.kt.txt @@ -1,12 +1,12 @@ -@JavaAnn(...) +@JavaAnn() fun test1() { } -@JavaAnn(...) +@JavaAnn(value = "abc", i = 123) fun test2() { } -@JavaAnn(...) +@JavaAnn(value = "abc", i = 123) fun test3() { } diff --git a/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.kt.txt index de2ee0b7ac9..e658174a19c 100644 --- a/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.kt.txt @@ -10,7 +10,7 @@ annotation class A : Annotation { } fun foo(m: Map) { - @A(...) + @A(x = "foo/test") val test: Int val test$delegate: Lazy = lazy(initializer = local fun (): Int { return 42 diff --git a/compiler/testData/ir/irText/declarations/annotations/propertiesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/propertiesWithAnnotations.kt.txt index 671adf72795..edf356c30d0 100644 --- a/compiler/testData/ir/irText/declarations/annotations/propertiesWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/propertiesWithAnnotations.kt.txt @@ -9,7 +9,7 @@ annotation class TestAnn : Annotation { } -@TestAnn(...) +@TestAnn(x = "testVal.property") val testVal: String field = "" get diff --git a/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.kt.txt index 1b03d965163..ef7f463ecae 100644 --- a/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.kt.txt @@ -18,14 +18,14 @@ class C { val x: Int field = x - @A(...) + @A(x = "C.x.get") get var y: Int field = y - @A(...) + @A(x = "C.y.get") get - @A(...) + @A(x = "C.y.set") set diff --git a/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsWithAnnotations.kt.txt index aeeb6ff9e3b..a5b4a7a3705 100644 --- a/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsWithAnnotations.kt.txt @@ -10,29 +10,29 @@ annotation class TestAnn : Annotation { } val test1: String - @TestAnn(...) + @TestAnn(x = "test1.get") get(): String { return "" } var test2: String - @TestAnn(...) + @TestAnn(x = "test2.get") get(): String { return "" } - @TestAnn(...) + @TestAnn(x = "test2.set") set(value: String) { } val test3: String field = "" - @TestAnn(...) + @TestAnn(x = "test3.get") get var test4: String field = "" - @TestAnn(...) + @TestAnn(x = "test4.get") get - @TestAnn(...) + @TestAnn(x = "test4.set") set diff --git a/compiler/testData/ir/irText/declarations/annotations/spreadOperatorInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/spreadOperatorInAnnotationArguments.kt.txt index fe14e8913cc..ab258cd7824 100644 --- a/compiler/testData/ir/irText/declarations/annotations/spreadOperatorInAnnotationArguments.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/spreadOperatorInAnnotationArguments.kt.txt @@ -9,7 +9,7 @@ annotation class A : Annotation { } -@A(...) +@A(xs = [["a"], ["b"]]) fun test() { } diff --git a/compiler/testData/ir/irText/declarations/annotations/typeAliasesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/typeAliasesWithAnnotations.kt.txt index 64585d31b17..a1968539cec 100644 --- a/compiler/testData/ir/irText/declarations/annotations/typeAliasesWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/typeAliasesWithAnnotations.kt.txt @@ -1,4 +1,4 @@ -@Target(...) +@Target(allowedTargets = [AnnotationTarget]) annotation class TestAnn : Annotation { constructor(x: String) /* primary */ val x: String @@ -10,5 +10,5 @@ annotation class TestAnn : Annotation { } -@TestAnn(...) +@TestAnn(x = "TestTypeAlias") typealias TestTypeAlias = String diff --git a/compiler/testData/ir/irText/declarations/annotations/typeParametersWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/typeParametersWithAnnotations.kt.txt index 4ac7ec179e9..1434b0cc418 100644 --- a/compiler/testData/ir/irText/declarations/annotations/typeParametersWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/typeParametersWithAnnotations.kt.txt @@ -1,4 +1,4 @@ -@Target(...) +@Target(allowedTargets = [AnnotationTarget]) annotation class Anno : Annotation { constructor() /* primary */ diff --git a/compiler/testData/ir/irText/declarations/annotations/varargsInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/varargsInAnnotationArguments.kt.txt index 942b42a11a7..71e88ec54c8 100644 --- a/compiler/testData/ir/irText/declarations/annotations/varargsInAnnotationArguments.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/varargsInAnnotationArguments.kt.txt @@ -31,15 +31,15 @@ annotation class AA : Annotation { } -@A1(...) -@A2(...) -@AA(...) +@A1(xs = [1, 2, 3]) +@A2(xs = ["a", "b", "c"]) +@AA(xs = [A1(xs = [4]), A1(xs = [5]), A1(xs = [6])]) fun test1() { } -@A1(...) -@A2(...) -@AA(...) +@A1(xs = []) +@A2(xs = []) +@AA(xs = []) fun test2() { } diff --git a/compiler/testData/ir/irText/declarations/annotations/variablesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/variablesWithAnnotations.kt.txt index b9795f116f8..cf6e8abd585 100644 --- a/compiler/testData/ir/irText/declarations/annotations/variablesWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/variablesWithAnnotations.kt.txt @@ -10,9 +10,9 @@ annotation class TestAnn : Annotation { } fun foo() { - @TestAnn(...) + @TestAnn(x = "foo/testVal") val testVal: String = "testVal" - @TestAnn(...) + @TestAnn(x = "foo/testVar") var testVar: String = "testVar" } diff --git a/compiler/testData/ir/irText/declarations/deprecatedProperty.kt.txt b/compiler/testData/ir/irText/declarations/deprecatedProperty.kt.txt index af4c0bc60ad..34356b85bf0 100644 --- a/compiler/testData/ir/irText/declarations/deprecatedProperty.kt.txt +++ b/compiler/testData/ir/irText/declarations/deprecatedProperty.kt.txt @@ -1,44 +1,44 @@ -@Deprecated(...) +@Deprecated(message = "") val testVal: Int field = 1 get -@Deprecated(...) +@Deprecated(message = "") var testVar: Int field = 1 get set -@Deprecated(...) +@Deprecated(message = "") val testValWithExplicitDefaultGet: Int field = 1 get -@Deprecated(...) +@Deprecated(message = "") val testValWithExplicitGet: Int get(): Int { return 1 } -@Deprecated(...) +@Deprecated(message = "") var testVarWithExplicitDefaultGet: Int field = 1 get set -@Deprecated(...) +@Deprecated(message = "") var testVarWithExplicitDefaultSet: Int field = 1 get set -@Deprecated(...) +@Deprecated(message = "") var testVarWithExplicitDefaultGetSet: Int field = 1 get set -@Deprecated(...) +@Deprecated(message = "") var testVarWithExplicitGetSet: Int get(): Int { return 1 @@ -46,18 +46,18 @@ var testVarWithExplicitGetSet: Int set(v: Int) { } -@Deprecated(...) +@Deprecated(message = "") lateinit var testLateinitVar: Any get set -@Deprecated(...) +@Deprecated(message = "") val Any.testExtVal: Int get(): Int { return 1 } -@Deprecated(...) +@Deprecated(message = "") var Any.textExtVar: Int get(): Int { return 1 diff --git a/compiler/testData/ir/irText/declarations/fileWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/fileWithAnnotations.kt.txt index 8d420ce8046..7bb59541a43 100644 --- a/compiler/testData/ir/irText/declarations/fileWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/fileWithAnnotations.kt.txt @@ -1,4 +1,4 @@ -@file:JvmName(...) +@file:JvmName(name = "FileWithAnnotations") fun foo() { } diff --git a/compiler/testData/ir/irText/declarations/typeAlias.kt.txt b/compiler/testData/ir/irText/declarations/typeAlias.kt.txt index 68d461e21a3..f37b3737bef 100644 --- a/compiler/testData/ir/irText/declarations/typeAlias.kt.txt +++ b/compiler/testData/ir/irText/declarations/typeAlias.kt.txt @@ -11,7 +11,7 @@ class C { } - @Suppress(...) + @Suppress(names = ["TOPLEVEL_TYPEALIASES_ONLY"]) typealias TestNested = String diff --git a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt index 8371df7b87c..73c5a3b80b3 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt @@ -100,7 +100,7 @@ fun test5(a: Any) { a as Function1 /*~> Unit */ { // BLOCK val tmp0_array: A = A - val tmp2_sam: IFoo = a /*as Function1<@ParameterName(...) Int, Unit> */ /*-> IFoo */ + val tmp2_sam: IFoo = a /*as Function1<@ParameterName(name = "i") Int, Unit> */ /*-> IFoo */ tmp0_array.set(i = tmp2_sam, newValue = tmp0_array.get(i = tmp2_sam).plus(other = 1)) } } diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall.kt.txt index 695c032f2d0..799c183c678 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall.kt.txt @@ -4,6 +4,6 @@ fun test1(f: Function1): C<@FlexibleNullability String?> { fun test2(x: Any) { x as Function1 /*~> Unit */ - C<@FlexibleNullability String?>(jxx = x /*as Function1<@ParameterName(...) @FlexibleNullability String?, @FlexibleNullability String?> */ /*-> @FlexibleNullability J<@FlexibleNullability String?, @FlexibleNullability String?>? */) /*~> Unit */ + C<@FlexibleNullability String?>(jxx = x /*as Function1<@ParameterName(name = "x") @FlexibleNullability String?, @FlexibleNullability String?> */ /*-> @FlexibleNullability J<@FlexibleNullability String?, @FlexibleNullability String?>? */) /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt index 76b72398f61..78a3a61152b 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt @@ -44,6 +44,6 @@ fun testGenericJavaCtor1(f: Function1): G<@FlexibleNullability Stri fun testGenericJavaCtor2(x: Any) { x as Function1 /*~> Unit */ - G<@FlexibleNullability String?, @FlexibleNullability Int?>(x = x /*as Function1<@ParameterName(...) @FlexibleNullability String?, @FlexibleNullability Int?> */ /*-> @FlexibleNullability J<@FlexibleNullability Int?, @FlexibleNullability String?>? */) /*~> Unit */ + G<@FlexibleNullability String?, @FlexibleNullability Int?>(x = x /*as Function1<@ParameterName(name = "x") @FlexibleNullability String?, @FlexibleNullability Int?> */ /*-> @FlexibleNullability J<@FlexibleNullability Int?, @FlexibleNullability String?>? */) /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.kt.txt index 927108ed90c..0b7296342a5 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.kt.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.kt.txt @@ -26,7 +26,7 @@ fun test4(a: Any) { fun test5(a: Any) { a as Function1 /*~> Unit */ - bar<@FlexibleNullability String?>(j = a /*as Function1<@ParameterName(...) @FlexibleNullability String?, @FlexibleNullability String?> */ /*-> @FlexibleNullability J<@FlexibleNullability String?>? */) + bar<@FlexibleNullability String?>(j = a /*as Function1<@ParameterName(name = "x") @FlexibleNullability String?, @FlexibleNullability String?> */ /*-> @FlexibleNullability J<@FlexibleNullability String?>? */) } fun test6(a: Function1) { @@ -35,7 +35,7 @@ fun test6(a: Function1) { fun test7(a: Any) { a as Function1 /*~> Unit */ - bar<@FlexibleNullability T?>(j = a /*as Function1<@ParameterName(...) @FlexibleNullability T?, @FlexibleNullability T?> */ /*-> @FlexibleNullability J<@FlexibleNullability T?>? */) + bar<@FlexibleNullability T?>(j = a /*as Function1<@ParameterName(name = "x") @FlexibleNullability T?, @FlexibleNullability T?> */ /*-> @FlexibleNullability J<@FlexibleNullability T?>? */) } fun test8(efn: @ExtensionFunctionType Function1): J<@FlexibleNullability String?> { diff --git a/compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.kt.txt b/compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.kt.txt index a0ca0adc401..8757821451f 100644 --- a/compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.kt.txt +++ b/compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.kt.txt @@ -24,7 +24,7 @@ annotation class State : Annotation { } -@State(...) +@State(name = "1", storages = [Storage(value = "HELLO")]) class Test { constructor() /* primary */ { TODO("IrDelegatingConstructorCall") diff --git a/compiler/testData/ir/irText/firProblems/deprecated.kt.txt b/compiler/testData/ir/irText/firProblems/deprecated.kt.txt index eae1d38ae00..11d90a9c7dc 100644 --- a/compiler/testData/ir/irText/firProblems/deprecated.kt.txt +++ b/compiler/testData/ir/irText/firProblems/deprecated.kt.txt @@ -2,12 +2,12 @@ fun create(): String { return "OK" } -@Deprecated(...) +@Deprecated(message = "Use create() instead()", replaceWith = ReplaceWith(expression = "create()", imports = [])) fun create(s: String): String { return create() } -@Deprecated(...) +@Deprecated(message = "Use create() instead()") fun create(b: Boolean): String { return create() } diff --git a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt index 3db7e18aa7d..e8234dee409 100644 --- a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt +++ b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt @@ -1,4 +1,4 @@ -@OptIn(...) +@OptIn(markerClass = [ExperimentalTypeInference::class]) fun scopedFlow(block: @ExtensionFunctionType SuspendFunction2, Unit>): Flow { return flow(block = local suspend fun FlowCollector.() { val collector: FlowCollector = @@ -10,7 +10,7 @@ fun scopedFlow(block: @ExtensionFunctionType SuspendFunction2 Flow.onCompletion(action: @ExtensionFunctionType SuspendFunction2, @ParameterName(...) Throwable?, Unit>): Flow { +fun Flow.onCompletion(action: @ExtensionFunctionType SuspendFunction2, @ParameterName(name = "cause") Throwable?, Unit>): Flow { return unsafeFlow(block = local suspend fun FlowCollector.() { val safeCollector: SafeCollector = SafeCollector(collector = ) safeCollector.invokeSafely(action = action) @@ -18,16 +18,16 @@ fun Flow.onCompletion(action: @ExtensionFunctionType SuspendFuncti ) } -suspend fun FlowCollector.invokeSafely(action: @ExtensionFunctionType SuspendFunction2, @ParameterName(...) Throwable?, Unit>) { +suspend fun FlowCollector.invokeSafely(action: @ExtensionFunctionType SuspendFunction2, @ParameterName(name = "cause") Throwable?, Unit>) { } -@OptIn(...) +@OptIn(markerClass = [ExperimentalTypeInference::class]) inline fun unsafeFlow(crossinline block: @ExtensionFunctionType SuspendFunction1, Unit>): Flow { TODO() } -@Deprecated(...) -fun Flow.onCompletion(action: SuspendFunction1<@ParameterName(...) Throwable?, Unit>): Flow { +@Deprecated(message = "binary compatibility with a version w/o FlowCollector receiver", level = DeprecationLevel) +fun Flow.onCompletion(action: SuspendFunction1<@ParameterName(name = "cause") Throwable?, Unit>): Flow { return .onCompletion(action = local suspend fun FlowCollector.(it: Throwable?) { action.invoke(p1 = it) } @@ -86,17 +86,17 @@ class SafeCollector : FlowCollector { } -@OptIn(...) +@OptIn(markerClass = [ExperimentalTypeInference::class]) fun flow(block: @ExtensionFunctionType SuspendFunction1, Unit>): Flow { TODO() } -@OptIn(...) +@OptIn(markerClass = [ExperimentalTypeInference::class]) suspend fun flowScope(block: @ExtensionFunctionType SuspendFunction1): R { TODO() } -suspend inline fun Flow.collect(crossinline action: SuspendFunction1<@ParameterName(...) T, Unit>) { +suspend inline fun Flow.collect(crossinline action: SuspendFunction1<@ParameterName(name = "value") T, Unit>) { } open class ChannelCoroutine { @@ -140,7 +140,7 @@ interface ReceiveChannel { } -@OptIn(...) +@OptIn(markerClass = [ExperimentalTypeInference::class]) fun CoroutineScope.produce(block: @ExtensionFunctionType SuspendFunction1, Unit>): ReceiveChannel { TODO() } diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt index 4c62f03f9b8..5e2c7daf623 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt @@ -68,35 +68,35 @@ fun test1() { fun test2() { // COMPOSITE { - val tmp0_container: @FlexibleNullability Q<@NotNull(...) @EnhancedNullability String, @NotNull(...) @EnhancedNullability String>? = notNullComponents() - val x: @NotNull(...) @EnhancedNullability String = tmp0_container /*!! Q<@NotNull(...) @EnhancedNullability String, @NotNull(...) @EnhancedNullability String> */.component1() - val y: @NotNull(...) @EnhancedNullability String = tmp0_container /*!! Q<@NotNull(...) @EnhancedNullability String, @NotNull(...) @EnhancedNullability String> */.component2() + val tmp0_container: @FlexibleNullability Q<@NotNull() @EnhancedNullability String, @NotNull() @EnhancedNullability String>? = notNullComponents() + val x: @NotNull() @EnhancedNullability String = tmp0_container /*!! Q<@NotNull() @EnhancedNullability String, @NotNull() @EnhancedNullability String> */.component1() + val y: @NotNull() @EnhancedNullability String = tmp0_container /*!! Q<@NotNull() @EnhancedNullability String, @NotNull() @EnhancedNullability String> */.component2() // } - use(x = x /*!! @NotNull(...) String */, y = y /*!! @NotNull(...) String */) + use(x = x /*!! @NotNull() String */, y = y /*!! @NotNull() String */) } fun test2Desugared() { - val tmp: @FlexibleNullability Q<@NotNull(...) @EnhancedNullability String, @NotNull(...) @EnhancedNullability String>? = notNullComponents() - val x: @NotNull(...) String = tmp /*!! Q<@NotNull(...) @EnhancedNullability String, @NotNull(...) @EnhancedNullability String> */.component1() /*!! @NotNull(...) String */ - val y: @NotNull(...) String = tmp /*!! Q<@NotNull(...) @EnhancedNullability String, @NotNull(...) @EnhancedNullability String> */.component2() /*!! @NotNull(...) String */ + val tmp: @FlexibleNullability Q<@NotNull() @EnhancedNullability String, @NotNull() @EnhancedNullability String>? = notNullComponents() + val x: @NotNull() String = tmp /*!! Q<@NotNull() @EnhancedNullability String, @NotNull() @EnhancedNullability String> */.component1() /*!! @NotNull() String */ + val y: @NotNull() String = tmp /*!! Q<@NotNull() @EnhancedNullability String, @NotNull() @EnhancedNullability String> */.component2() /*!! @NotNull() String */ use(x = x, y = y) } fun test3() { // COMPOSITE { - val tmp0_container: @EnhancedNullability Q<@NotNull(...) @EnhancedNullability String, @NotNull(...) @EnhancedNullability String> = notNullQAndComponents() - val x: @NotNull(...) @EnhancedNullability String = tmp0_container /*!! Q<@NotNull(...) @EnhancedNullability String, @NotNull(...) @EnhancedNullability String> */.component1() - val y: @NotNull(...) @EnhancedNullability String = tmp0_container /*!! Q<@NotNull(...) @EnhancedNullability String, @NotNull(...) @EnhancedNullability String> */.component2() + val tmp0_container: @EnhancedNullability Q<@NotNull() @EnhancedNullability String, @NotNull() @EnhancedNullability String> = notNullQAndComponents() + val x: @NotNull() @EnhancedNullability String = tmp0_container /*!! Q<@NotNull() @EnhancedNullability String, @NotNull() @EnhancedNullability String> */.component1() + val y: @NotNull() @EnhancedNullability String = tmp0_container /*!! Q<@NotNull() @EnhancedNullability String, @NotNull() @EnhancedNullability String> */.component2() // } - use(x = x /*!! @NotNull(...) String */, y = y /*!! @NotNull(...) String */) + use(x = x /*!! @NotNull() String */, y = y /*!! @NotNull() String */) } fun test4() { // COMPOSITE { - val tmp0_container: IndexedValue<@NotNull(...) @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull(...) @EnhancedNullability P> */.withIndex<@NotNull(...) @EnhancedNullability P>().first>() + val tmp0_container: IndexedValue<@NotNull() @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull() @EnhancedNullability P> */.withIndex<@NotNull() @EnhancedNullability P>().first>() val x: Int = tmp0_container.component1() - val y: @NotNull(...) @EnhancedNullability P = tmp0_container.component2() + val y: @NotNull() @EnhancedNullability P = tmp0_container.component2() // } - use(x = x, y = y /*!! @NotNull(...) P */) + use(x = x, y = y /*!! @NotNull() P */) } diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt index ac107a86453..3426a07de12 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt @@ -3,9 +3,9 @@ fun use(s: P) { fun testForInListUnused() { { // BLOCK - val tmp0_iterator: MutableIterator<@NotNull(...) @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull(...) @EnhancedNullability P> */ /*as MutableList<*> */.iterator() + val tmp0_iterator: MutableIterator<@NotNull() @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull() @EnhancedNullability P> */ /*as MutableList<*> */.iterator() while (tmp0_iterator.hasNext()) { // BLOCK - val x: @NotNull(...) @EnhancedNullability P = tmp0_iterator.next() + val x: @NotNull() @EnhancedNullability P = tmp0_iterator.next() { // BLOCK } } @@ -14,11 +14,11 @@ fun testForInListUnused() { fun testForInListDestructured() { { // BLOCK - val tmp0_iterator: MutableIterator<@NotNull(...) @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull(...) @EnhancedNullability P> */ /*as MutableList<*> */.iterator() + val tmp0_iterator: MutableIterator<@NotNull() @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull() @EnhancedNullability P> */ /*as MutableList<*> */.iterator() while (tmp0_iterator.hasNext()) { // BLOCK - val tmp1_loop_parameter: @NotNull(...) @EnhancedNullability P = tmp0_iterator.next() - val x: Int = tmp1_loop_parameter /*!! @NotNull(...) P */.component1() - val y: Int = tmp1_loop_parameter /*!! @NotNull(...) P */.component2() + val tmp1_loop_parameter: @NotNull() @EnhancedNullability P = tmp0_iterator.next() + val x: Int = tmp1_loop_parameter /*!! @NotNull() P */.component1() + val y: Int = tmp1_loop_parameter /*!! @NotNull() P */.component2() { // BLOCK } } @@ -26,9 +26,9 @@ fun testForInListDestructured() { } fun testDesugaredForInList() { - val iterator: MutableIterator<@NotNull(...) @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull(...) @EnhancedNullability P> */ /*as MutableList<*> */.iterator() + val iterator: MutableIterator<@NotNull() @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull() @EnhancedNullability P> */ /*as MutableList<*> */.iterator() while (iterator.hasNext()) { // BLOCK - val x: @NotNull(...) P = iterator.next() /*!! @NotNull(...) P */ + val x: @NotNull() P = iterator.next() /*!! @NotNull() P */ } } @@ -45,11 +45,11 @@ fun testForInArrayUnused(j: J) { fun testForInListUse() { { // BLOCK - val tmp0_iterator: MutableIterator<@NotNull(...) @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull(...) @EnhancedNullability P> */ /*as MutableList<*> */.iterator() + val tmp0_iterator: MutableIterator<@NotNull() @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull() @EnhancedNullability P> */ /*as MutableList<*> */.iterator() while (tmp0_iterator.hasNext()) { // BLOCK - val x: @NotNull(...) @EnhancedNullability P = tmp0_iterator.next() + val x: @NotNull() @EnhancedNullability P = tmp0_iterator.next() { // BLOCK - use(s = x /*!! @NotNull(...) P */) + use(s = x /*!! @NotNull() P */) use(s = x) } } From b518c19b385cd409eed69f1ade0f206cc403cd49 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Fri, 6 Nov 2020 02:24:57 +0300 Subject: [PATCH 139/698] [IR] update testdata: support for IrDelegatingConstructorCall --- .../ir/irText/classes/abstractMembers.kt.txt | 2 +- ...eorderingInDelegatingConstructorCall.kt.txt | 8 ++++---- .../ir/irText/classes/classMembers.kt.txt | 8 ++++---- .../testData/ir/irText/classes/classes.kt.txt | 4 ++-- .../ir/irText/classes/cloneable.kt.txt | 6 +++--- .../ir/irText/classes/companionObject.kt.txt | 8 ++++---- .../classes/dataClassWithArrayMembers.kt.txt | 6 +++--- .../ir/irText/classes/dataClasses.kt.txt | 6 +++--- .../irText/classes/dataClassesGeneric.kt.txt | 8 ++++---- .../delegatedGenericImplementation.kt.txt | 4 ++-- .../classes/delegatedImplementation.kt.txt | 8 ++++---- ...legatedImplementationOfJavaInterface.kt.txt | 2 +- ...edImplementationWithExplicitOverride.kt.txt | 4 ++-- ...onstructorCallToTypeAliasConstructor.kt.txt | 6 +++--- ...structorCallsInSecondaryConstructors.kt.txt | 8 ++++---- .../classes/enumWithMultipleCtors.kt.txt | 2 +- .../classes/enumWithSecondaryCtor.kt.txt | 6 +++--- .../fakeOverridesForJavaStaticMembers.kt.txt | 2 +- ...icitNotNullOnDelegatedImplementation.kt.txt | 18 +++++++++--------- .../ir/irText/classes/initBlock.kt.txt | 12 ++++++------ .../testData/ir/irText/classes/initVal.kt.txt | 6 +++--- .../ir/irText/classes/initValInLambda.kt.txt | 2 +- .../testData/ir/irText/classes/initVar.kt.txt | 12 ++++++------ .../ir/irText/classes/inlineClass.kt.txt | 2 +- .../classes/inlineClassSyntheticMethods.kt.txt | 4 ++-- .../ir/irText/classes/innerClass.kt.txt | 6 +++--- .../innerClassWithDelegatingConstructor.kt.txt | 6 +++--- .../testData/ir/irText/classes/kt31649.kt.txt | 4 ++-- .../lambdaInDataClassDefaultParameter.kt.txt | 6 +++--- .../ir/irText/classes/localClasses.kt.txt | 2 +- .../classes/objectLiteralExpressions.kt.txt | 12 ++++++------ .../classes/objectWithInitializers.kt.txt | 4 ++-- .../ir/irText/classes/outerClassAccess.kt.txt | 6 +++--- .../irText/classes/primaryConstructor.kt.txt | 6 +++--- ...yConstructorWithSuperConstructorCall.kt.txt | 10 +++++----- .../irText/classes/qualifiedSuperCalls.kt.txt | 2 +- .../ir/irText/classes/sealedClasses.kt.txt | 8 ++++---- ...tructorWithInitializersFromClassBody.kt.txt | 10 +++++----- .../classes/secondaryConstructors.kt.txt | 4 ++-- .../ir/irText/classes/superCalls.kt.txt | 4 ++-- .../irText/classes/superCallsComposed.kt.txt | 4 ++-- .../annotationsOnDelegatedMembers.kt.txt | 2 +- .../classLiteralInAnnotation.kt.txt | 2 +- .../annotations/classesWithAnnotations.kt.txt | 8 ++++---- .../constructorsWithAnnotations.kt.txt | 4 ++-- ...atedPropertyAccessorsWithAnnotations.kt.txt | 2 +- ...yConstructorParameterWithAnnotations.kt.txt | 2 +- ...essorsFromClassHeaderWithAnnotations.kt.txt | 2 +- ...opertySetterParameterWithAnnotations.kt.txt | 2 +- .../receiverParameterWithAnnotations.kt.txt | 2 +- .../valueParametersWithAnnotations.kt.txt | 2 +- .../declarations/classLevelProperties.kt.txt | 2 +- .../declarations/delegatedProperties.kt.txt | 2 +- .../declarations/extensionProperties.kt.txt | 2 +- .../irText/declarations/fakeOverrides.kt.txt | 4 ++-- .../genericDelegatedProperty.kt.txt | 4 ++-- .../inlineCollectionOfInlineClass.kt.txt | 4 ++-- .../ir/irText/declarations/kt29833.kt.txt | 2 +- .../ir/irText/declarations/kt35550.kt.txt | 2 +- .../localClassWithOverrides.kt.txt | 4 ++-- .../multiplatform/expectClassInherited.kt.txt | 4 ++-- .../multiplatform/expectedSealedClass.kt.txt | 4 ++-- .../declarations/parameters/class.kt.txt | 6 +++--- .../declarations/parameters/constructor.kt.txt | 14 +++++++------- .../parameters/dataClassMembers.kt.txt | 2 +- .../parameters/defaultPropertyAccessors.kt.txt | 4 ++-- .../parameters/delegatedMembers.kt.txt | 2 +- .../irText/declarations/parameters/fun.kt.txt | 2 +- .../parameters/genericInnerClass.kt.txt | 4 ++-- .../parameters/propertyAccessors.kt.txt | 2 +- .../parameters/typeParameterBeforeBound.kt.txt | 2 +- .../typeParameterBoundedBySubclass.kt.txt | 8 ++++---- .../primaryCtorDefaultArguments.kt.txt | 2 +- .../declarations/primaryCtorProperties.kt.txt | 2 +- .../provideDelegate/differentReceivers.kt.txt | 2 +- .../declarations/provideDelegate/local.kt.txt | 4 ++-- .../localDifferentReceivers.kt.txt | 2 +- .../declarations/provideDelegate/member.kt.txt | 6 +++--- .../provideDelegate/memberExtension.kt.txt | 4 ++-- .../provideDelegate/topLevel.kt.txt | 4 ++-- .../ir/irText/declarations/typeAlias.kt.txt | 2 +- .../errors/suppressedNonPublicCall.kt.txt | 2 +- .../arrayAugmentedAssignment1.kt.txt | 2 +- .../ir/irText/expressions/assignments.kt.txt | 2 +- .../expressions/augmentedAssignment2.kt.txt | 2 +- .../augmentedAssignmentWithExpression.kt.txt | 2 +- .../expressions/boundCallableReferences.kt.txt | 2 +- .../adaptedExtensionFunctions.kt.txt | 2 +- .../boundInnerGenericConstructor.kt.txt | 4 ++-- .../caoWithAdaptationForSam.kt.txt | 4 ++-- .../constructorWithAdaptedArguments.kt.txt | 6 +++--- ...WithDefaultParametersAsKCallableStar.kt.txt | 2 +- .../callableReferences/genericMember.kt.txt | 2 +- .../importedFromObject.kt.txt | 2 +- .../callableReferences/kt37131.kt.txt | 2 +- .../suspendConversion.kt.txt | 2 +- .../callableReferences/typeArguments.kt.txt | 2 +- ...dMemberReferenceWithAdaptedArguments.kt.txt | 4 ++-- .../withAdaptedArguments.kt.txt | 2 +- .../withArgumentAdaptationAndReceiver.kt.txt | 2 +- .../expressions/castToTypeParameter.kt.txt | 2 +- .../irText/expressions/chainOfSafeCalls.kt.txt | 2 +- .../irText/expressions/classReference.kt.txt | 2 +- .../complexAugmentedAssignment.kt.txt | 10 +++++----- ...constructorWithOwnTypeParametersCall.kt.txt | 4 ++-- .../irText/expressions/contructorCall.kt.txt | 2 +- .../irText/expressions/destructuring1.kt.txt | 4 ++-- .../destructuringWithUnderscore.kt.txt | 4 ++-- ...rameterWithPrimitiveNumericSupertype.kt.txt | 2 +- .../forWithImplicitReceivers.kt.txt | 4 ++-- .../expressions/funImportedFromObject.kt.txt | 2 +- .../expressions/funInterface/partialSam.kt.txt | 6 +++--- ...ericConstructorCallWithTypeArguments.kt.txt | 2 +- .../expressions/genericPropertyRef.kt.txt | 4 ++-- .../implicitCastInReturnFromConstructor.kt.txt | 4 ++-- .../implicitCastToTypeParameter.kt.txt | 2 +- .../jvmFieldWithIntersectionTypes.kt.txt | 10 +++++----- .../jvmInstanceFieldReference.kt.txt | 2 +- .../expressions/jvmStaticFieldReference.kt.txt | 2 +- .../ir/irText/expressions/kt16904.kt.txt | 8 ++++---- .../ir/irText/expressions/kt16905.kt.txt | 8 ++++---- .../ir/irText/expressions/kt23030.kt.txt | 2 +- .../ir/irText/expressions/kt28456.kt.txt | 2 +- .../ir/irText/expressions/kt28456a.kt.txt | 2 +- .../ir/irText/expressions/kt28456b.kt.txt | 2 +- .../ir/irText/expressions/kt30020.kt.txt | 4 ++-- .../ir/irText/expressions/kt35730.kt.txt | 2 +- .../ir/irText/expressions/kt36956.kt.txt | 2 +- .../ir/irText/expressions/kt37570.kt.txt | 2 +- .../expressions/memberTypeArguments.kt.txt | 2 +- .../membersImportedFromObject.kt.txt | 2 +- .../expressions/multipleThisReferences.kt.txt | 8 ++++---- .../irText/expressions/objectAsCallable.kt.txt | 2 +- .../expressions/objectClassReference.kt.txt | 2 +- .../irText/expressions/objectReference.kt.txt | 6 +++--- ...renceInClosureInSuperConstructorCall.kt.txt | 7 +++++-- .../objectReferenceInFieldInitializer.kt.txt | 2 +- .../outerClassInstanceReference.kt.txt | 4 ++-- .../primitivesImplicitConversions.kt.txt | 2 +- .../expressions/propertyReferences.kt.txt | 4 ++-- .../expressions/reflectionLiterals.kt.txt | 2 +- .../irText/expressions/safeAssignment.kt.txt | 2 +- .../safeCallWithIncrementDecrement.kt.txt | 2 +- .../ir/irText/expressions/safeCalls.kt.txt | 2 +- ...onversionInGenericConstructorCall_NI.kt.txt | 4 ++-- .../setFieldWithImplicitCast.kt.txt | 2 +- .../specializedTypeAliasConstructorCall.kt.txt | 2 +- .../expressions/temporaryInInitBlock.kt.txt | 2 +- .../expressions/thisOfGenericOuterClass.kt.txt | 6 +++--- ...ToObjectInNestedClassConstructorCall.kt.txt | 8 ++++---- .../thisReferenceBeforeClassDeclared.kt.txt | 8 ++++---- .../typeAliasConstructorReference.kt.txt | 6 +++--- .../typeParameterClassLiteral.kt.txt | 2 +- .../expressions/useImportedMember.kt.txt | 4 ++-- .../ir/irText/expressions/values.kt.txt | 6 +++--- .../testData/ir/irText/expressions/when.kt.txt | 2 +- .../firProblems/AbstractMutableMap.kt.txt | 2 +- .../ir/irText/firProblems/AllCandidates.kt.txt | 4 ++-- .../firProblems/AnnotationInAnnotation.kt.txt | 2 +- .../irText/firProblems/BaseFirBuilder.kt.txt | 2 +- .../ClashResolutionDescriptor.kt.txt | 4 ++-- .../irText/firProblems/DeepCopyIrTree.kt.txt | 2 +- .../DelegationAndInheritanceFromJava.kt.txt | 2 +- .../ir/irText/firProblems/FirBuilder.kt.txt | 4 ++-- .../firProblems/InnerClassInAnonymous.kt.txt | 6 +++--- .../ir/irText/firProblems/MultiList.kt.txt | 6 +++--- .../irText/firProblems/SignatureClash.kt.txt | 4 ++-- .../ir/irText/firProblems/VarInInit.kt.txt | 2 +- .../irText/firProblems/candidateSymbol.kt.txt | 4 ++-- .../ir/irText/firProblems/putIfAbsent.kt.txt | 2 +- .../ir/irText/firProblems/v8arrayToList.kt.txt | 2 +- .../lambdas/destructuringInLambda.kt.txt | 2 +- .../lambdas/multipleImplicitReceivers.kt.txt | 4 ++-- .../regressions/integerCoercionToT.kt.txt | 4 ++-- .../typeAliasCtorForGenericClass.kt.txt | 2 +- .../ir/irText/singletons/companion.kt.txt | 4 ++-- .../ir/irText/singletons/object.kt.txt | 4 ++-- .../genericClassInDifferentModule_m1.kt.txt | 2 +- .../genericClassInDifferentModule_m2.kt.txt | 2 +- .../ir/irText/stubs/javaInnerClass.kt.txt | 2 +- .../types/castsInsideCoroutineInference.kt.txt | 4 ++-- .../types/genericDelegatedDeepProperty.kt.txt | 12 ++++++------ .../ir/irText/types/genericFunWithStar.kt.txt | 2 +- .../types/genericPropertyReferenceType.kt.txt | 2 +- .../irText/types/intersectionType1_NI.kt.txt | 2 +- .../irText/types/intersectionType1_OI.kt.txt | 2 +- .../irText/types/intersectionType2_NI.kt.txt | 4 ++-- .../irText/types/intersectionType2_OI.kt.txt | 4 ++-- .../ir/irText/types/javaWildcardType.kt.txt | 2 +- ...NullabilityInDestructuringAssignment.kt.txt | 4 ++-- .../enhancedNullabilityInForLoop.kt.txt | 2 +- .../implicitNotNullOnPlatformType.kt.txt | 2 +- ...labilityAssertionOnExtensionReceiver.kt.txt | 2 +- .../ir/irText/types/rawTypeInSignature.kt.txt | 8 ++++---- .../types/receiverOfIntersectionType.kt.txt | 4 ++-- .../smartCastOnFakeOverrideReceiver.kt.txt | 8 ++++---- .../smartCastOnReceiverOfGenericType.kt.txt | 6 +++--- .../ir/irText/types/starProjection_OI.kt.txt | 2 +- 198 files changed, 393 insertions(+), 390 deletions(-) diff --git a/compiler/testData/ir/irText/classes/abstractMembers.kt.txt b/compiler/testData/ir/irText/classes/abstractMembers.kt.txt index 4ff5e02855d..143d28ef1ab 100644 --- a/compiler/testData/ir/irText/classes/abstractMembers.kt.txt +++ b/compiler/testData/ir/irText/classes/abstractMembers.kt.txt @@ -1,6 +1,6 @@ abstract class AbstractClass { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.kt.txt b/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.kt.txt index fca7a4de600..74eba17f982 100644 --- a/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.kt.txt +++ b/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.kt.txt @@ -1,6 +1,6 @@ open class Base { constructor(x: Int, y: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -21,7 +21,7 @@ open class Base { class Test1 : Base { constructor(xx: Int, yy: Int) /* primary */ { { // BLOCK - TODO("IrDelegatingConstructorCall") + super/*Base*/(x = xx, y = yy) } /* InstanceInitializerCall */ @@ -35,7 +35,7 @@ class Test1 : Base { class Test2 : Base { constructor(xx: Int, yy: Int) { { // BLOCK - TODO("IrDelegatingConstructorCall") + super/*Base*/(x = xx, y = yy) } /* InstanceInitializerCall */ @@ -43,7 +43,7 @@ class Test2 : Base { constructor(xxx: Int, yyy: Int, a: Any) { { // BLOCK - TODO("IrDelegatingConstructorCall") + this/*Test2*/(xx = xxx, yy = yyy) } } diff --git a/compiler/testData/ir/irText/classes/classMembers.kt.txt b/compiler/testData/ir/irText/classes/classMembers.kt.txt index 7aee7e54609..a482088386c 100644 --- a/compiler/testData/ir/irText/classes/classMembers.kt.txt +++ b/compiler/testData/ir/irText/classes/classMembers.kt.txt @@ -1,6 +1,6 @@ class C { constructor(x: Int, y: Int, z: Int = 1) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -15,7 +15,7 @@ class C { set constructor() { - TODO("IrDelegatingConstructorCall") + this/*C*/(x = 0, y = 0, z = 0) } val property: Int @@ -45,7 +45,7 @@ class C { class NestedClass { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -76,7 +76,7 @@ class C { companion object Companion { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/classes.kt.txt b/compiler/testData/ir/irText/classes/classes.kt.txt index 6555e18c50f..414581b0b90 100644 --- a/compiler/testData/ir/irText/classes/classes.kt.txt +++ b/compiler/testData/ir/irText/classes/classes.kt.txt @@ -1,6 +1,6 @@ class TestClass { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -18,7 +18,7 @@ interface TestInterface { object TestObject { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/cloneable.kt.txt b/compiler/testData/ir/irText/classes/cloneable.kt.txt index 118dad1ff6c..101ed36605e 100644 --- a/compiler/testData/ir/irText/classes/cloneable.kt.txt +++ b/compiler/testData/ir/irText/classes/cloneable.kt.txt @@ -1,6 +1,6 @@ class A : Cloneable { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -20,7 +20,7 @@ interface I : Cloneable { class C : I { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -33,7 +33,7 @@ class C : I { class OC : I { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/companionObject.kt.txt b/compiler/testData/ir/irText/classes/companionObject.kt.txt index 4a415351883..47159f84152 100644 --- a/compiler/testData/ir/irText/classes/companionObject.kt.txt +++ b/compiler/testData/ir/irText/classes/companionObject.kt.txt @@ -1,13 +1,13 @@ class Test1 { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } companion object Companion { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -24,14 +24,14 @@ class Test1 { class Test2 { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } companion object Named { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt index 777980d7c9a..a6b96771542 100644 --- a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt +++ b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt @@ -1,6 +1,6 @@ data class Test1 { constructor(stringArray: Array, charArray: CharArray, booleanArray: BooleanArray, byteArray: ByteArray, shortArray: ShortArray, intArray: IntArray, longArray: LongArray, floatArray: FloatArray, doubleArray: DoubleArray) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -167,7 +167,7 @@ dataClassArrayMemberToString(arg0 = #doubleArray) + data class Test2 { constructor(genericArray: Array) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -213,7 +213,7 @@ dataClassArrayMemberToString(arg0 = #genericArray) + data class Test3 { constructor(anyArrayN: Array?) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/dataClasses.kt.txt b/compiler/testData/ir/irText/classes/dataClasses.kt.txt index b0998ba1ee4..d1663fc90ff 100644 --- a/compiler/testData/ir/irText/classes/dataClasses.kt.txt +++ b/compiler/testData/ir/irText/classes/dataClasses.kt.txt @@ -1,6 +1,6 @@ data class Test1 { constructor(x: Int, y: String, z: Any) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -77,7 +77,7 @@ data class Test1 { data class Test2 { constructor(x: Any?) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -126,7 +126,7 @@ data class Test2 { data class Test3 { constructor(d: Double, dn: Double?, f: Float, df: Float?) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt b/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt index 94a9694adcb..766c41c024e 100644 --- a/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt +++ b/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt @@ -1,6 +1,6 @@ data class Test1 { constructor(x: T) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -49,7 +49,7 @@ data class Test1 { data class Test2 { constructor(x: T) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -95,7 +95,7 @@ data class Test2 { data class Test3 { constructor(x: List) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -141,7 +141,7 @@ data class Test3 { data class Test4 { constructor(x: List) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt b/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt index 965d3bb0b8c..9dd35f4c4ee 100644 --- a/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt @@ -14,7 +14,7 @@ interface IBase { class Test1 : IBase { constructor(i: IBase) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -44,7 +44,7 @@ class Test1 : IBase { class Test2 : IBase { constructor(j: IBase) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt index ff0bd6541fd..64aa130d592 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt @@ -9,7 +9,7 @@ interface IBase { object BaseImpl : IBase { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -53,7 +53,7 @@ fun otherImpl(x0: String, y0: Int): IOther { return { // BLOCK local class : IOther { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -91,7 +91,7 @@ fun otherImpl(x0: String, y0: Int): IOther { class Test1 : IBase { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -116,7 +116,7 @@ class Test1 : IBase { class Test2 : IBase, IOther { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt index 86f4514d770..14ec7f7f664 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt @@ -1,6 +1,6 @@ class Test : J { constructor(j: J) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt index d828aae732e..ce63aa83b35 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt @@ -8,7 +8,7 @@ interface IFooBar { object FooBarImpl : IFooBar { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -26,7 +26,7 @@ object FooBarImpl : IFooBar { class C : IFooBar { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.kt.txt b/compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.kt.txt index 19e317cd18d..c4b1ef7e9cd 100644 --- a/compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.kt.txt @@ -1,6 +1,6 @@ open class Cell { constructor(value: T) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -18,7 +18,7 @@ typealias CT = Cell typealias CStr = Cell class C1 : Cell { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Cell*/(value = "O") /* InstanceInitializerCall */ } @@ -30,7 +30,7 @@ class C1 : Cell { class C2 : Cell { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Cell*/(value = "K") /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.kt.txt b/compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.kt.txt index 42314e1dd52..1057ab5bf15 100644 --- a/compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.kt.txt @@ -1,6 +1,6 @@ open class Base { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -12,19 +12,19 @@ open class Base { class Test : Base { constructor() { - TODO("IrDelegatingConstructorCall") + super/*Base*/() /* InstanceInitializerCall */ } constructor(xx: Int) { - TODO("IrDelegatingConstructorCall") + super/*Base*/() /* InstanceInitializerCall */ } constructor(xx: Short) { - TODO("IrDelegatingConstructorCall") + this/*Test*/() } diff --git a/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt b/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt index 765cdea7920..8ff9f27cbd6 100644 --- a/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt +++ b/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt @@ -27,7 +27,7 @@ open enum class A : Enum { } private constructor(x: Int) { - TODO("IrDelegatingConstructorCall") + this/*A*/(arg = x.toString()) .( = "int") } diff --git a/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt.txt b/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt.txt index 53dbb28b14b..ce710eeb909 100644 --- a/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt.txt +++ b/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt.txt @@ -10,7 +10,7 @@ enum class Test0 : Enum { get ZERO init = TODO("IrEnumConstructorCall") private constructor() { - TODO("IrDelegatingConstructorCall") + this/*Test0*/(x = 0) } @@ -38,7 +38,7 @@ enum class Test1 : Enum { get ZERO init = TODO("IrEnumConstructorCall") ONE init = TODO("IrEnumConstructorCall") private constructor() { - TODO("IrDelegatingConstructorCall") + this/*Test1*/(x = 0) } @@ -66,7 +66,7 @@ abstract enum class Test2 : Enum { get ZERO init = TODO("IrEnumConstructorCall") ONE init = TODO("IrEnumConstructorCall") private constructor() { - TODO("IrDelegatingConstructorCall") + this/*Test2*/(x = 0) } abstract fun foo() diff --git a/compiler/testData/ir/irText/classes/fakeOverridesForJavaStaticMembers.kt.txt b/compiler/testData/ir/irText/classes/fakeOverridesForJavaStaticMembers.kt.txt index 48d79c255f3..ab8cc7321a6 100644 --- a/compiler/testData/ir/irText/classes/fakeOverridesForJavaStaticMembers.kt.txt +++ b/compiler/testData/ir/irText/classes/fakeOverridesForJavaStaticMembers.kt.txt @@ -1,6 +1,6 @@ class Test : Base { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Base*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt index 2b8b02ffb3c..3d8c0f3e0f3 100644 --- a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt +++ b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt @@ -7,7 +7,7 @@ interface IFoo { class K1 : JFoo { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*JFoo*/() /* InstanceInitializerCall */ } @@ -20,7 +20,7 @@ class K1 : JFoo { class K2 : JFoo { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*JFoo*/() /* InstanceInitializerCall */ } @@ -36,7 +36,7 @@ class K2 : JFoo { class K3 : JUnrelatedFoo, IFoo { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*JUnrelatedFoo*/() /* InstanceInitializerCall */ } @@ -49,7 +49,7 @@ class K3 : JUnrelatedFoo, IFoo { class K4 : JUnrelatedFoo, IFoo { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*JUnrelatedFoo*/() /* InstanceInitializerCall */ } @@ -65,7 +65,7 @@ class K4 : JUnrelatedFoo, IFoo { class TestJFoo : IFoo { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -82,7 +82,7 @@ class TestJFoo : IFoo { class TestK1 : IFoo { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -99,7 +99,7 @@ class TestK1 : IFoo { class TestK2 : IFoo { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -116,7 +116,7 @@ class TestK2 : IFoo { class TestK3 : IFoo { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -133,7 +133,7 @@ class TestK3 : IFoo { class TestK4 : IFoo { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/initBlock.kt.txt b/compiler/testData/ir/irText/classes/initBlock.kt.txt index 56e174c6b99..89e6a0e7940 100644 --- a/compiler/testData/ir/irText/classes/initBlock.kt.txt +++ b/compiler/testData/ir/irText/classes/initBlock.kt.txt @@ -1,6 +1,6 @@ class Test1 { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -16,7 +16,7 @@ class Test1 { class Test2 { constructor(x: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -40,7 +40,7 @@ class Test3 { } constructor() { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -56,7 +56,7 @@ class Test4 { } constructor() { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -72,7 +72,7 @@ class Test4 { class Test5 { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -83,7 +83,7 @@ class Test5 { inner class TestInner { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/initVal.kt.txt b/compiler/testData/ir/irText/classes/initVal.kt.txt index 2107ee26618..3b3524247c2 100644 --- a/compiler/testData/ir/irText/classes/initVal.kt.txt +++ b/compiler/testData/ir/irText/classes/initVal.kt.txt @@ -1,6 +1,6 @@ class TestInitValFromParameter { constructor(x: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -16,7 +16,7 @@ class TestInitValFromParameter { class TestInitValInClass { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -32,7 +32,7 @@ class TestInitValInClass { class TestInitValInInitBlock { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/initValInLambda.kt.txt b/compiler/testData/ir/irText/classes/initValInLambda.kt.txt index f5b6ec32943..5da9fc2ba4d 100644 --- a/compiler/testData/ir/irText/classes/initValInLambda.kt.txt +++ b/compiler/testData/ir/irText/classes/initValInLambda.kt.txt @@ -1,6 +1,6 @@ class TestInitValInLambdaCalledOnce { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/initVar.kt.txt b/compiler/testData/ir/irText/classes/initVar.kt.txt index d10a3f0de4f..cfc31ea7e0a 100644 --- a/compiler/testData/ir/irText/classes/initVar.kt.txt +++ b/compiler/testData/ir/irText/classes/initVar.kt.txt @@ -1,6 +1,6 @@ class TestInitVarFromParameter { constructor(x: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -17,7 +17,7 @@ class TestInitVarFromParameter { class TestInitVarInClass { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -34,7 +34,7 @@ class TestInitVarInClass { class TestInitVarInInitBlock { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -54,7 +54,7 @@ class TestInitVarInInitBlock { class TestInitVarWithCustomSetter { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -83,7 +83,7 @@ class TestInitVarWithCustomSetterWithExplicitCtor { } constructor() { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -101,7 +101,7 @@ class TestInitVarWithCustomSetterInCtor { } constructor() { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ .(value = 42) diff --git a/compiler/testData/ir/irText/classes/inlineClass.kt.txt b/compiler/testData/ir/irText/classes/inlineClass.kt.txt index a8872d7b16e..ec41ac4d6f0 100644 --- a/compiler/testData/ir/irText/classes/inlineClass.kt.txt +++ b/compiler/testData/ir/irText/classes/inlineClass.kt.txt @@ -1,6 +1,6 @@ inline class Test { constructor(x: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt b/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt index ef74f18ac2b..6ee796d0517 100644 --- a/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt +++ b/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt @@ -1,6 +1,6 @@ class C { constructor(t: T) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -19,7 +19,7 @@ class C { inline class IC { constructor(c: C) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/innerClass.kt.txt b/compiler/testData/ir/irText/classes/innerClass.kt.txt index 268f89f2e3d..41fa593fcf0 100644 --- a/compiler/testData/ir/irText/classes/innerClass.kt.txt +++ b/compiler/testData/ir/irText/classes/innerClass.kt.txt @@ -1,13 +1,13 @@ class Outer { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } open inner class TestInnerClass { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -19,7 +19,7 @@ class Outer { inner class DerivedInnerClass : TestInnerClass { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + .super/*TestInnerClass*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.kt.txt b/compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.kt.txt index 0672a360cf6..835e3cbd4bf 100644 --- a/compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.kt.txt +++ b/compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.kt.txt @@ -1,13 +1,13 @@ class Outer { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } inner class Inner { constructor(x: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -17,7 +17,7 @@ class Outer { get constructor() { - TODO("IrDelegatingConstructorCall") + .this/*Inner*/(x = 0) } diff --git a/compiler/testData/ir/irText/classes/kt31649.kt.txt b/compiler/testData/ir/irText/classes/kt31649.kt.txt index 87269fe8b44..84a85f99755 100644 --- a/compiler/testData/ir/irText/classes/kt31649.kt.txt +++ b/compiler/testData/ir/irText/classes/kt31649.kt.txt @@ -1,6 +1,6 @@ data class TestData { constructor(nn: Nothing?) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -49,7 +49,7 @@ data class TestData { inline class TestInline { constructor(nn: Nothing?) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt index e859d69fc58..1018cf3264a 100644 --- a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt +++ b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt @@ -3,7 +3,7 @@ data class A { return Unit } ) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -51,7 +51,7 @@ data class B { constructor(x: Any = { // BLOCK local class { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -64,7 +64,7 @@ data class B { () }) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/localClasses.kt.txt b/compiler/testData/ir/irText/classes/localClasses.kt.txt index 1f6a1e03773..79d3da43b61 100644 --- a/compiler/testData/ir/irText/classes/localClasses.kt.txt +++ b/compiler/testData/ir/irText/classes/localClasses.kt.txt @@ -1,7 +1,7 @@ fun outer() { local class LocalClass { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt b/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt index 402c0fc06b7..88562d2df7c 100644 --- a/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt +++ b/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt @@ -9,7 +9,7 @@ val test1: Any field = { // BLOCK local class { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -28,7 +28,7 @@ val test2: IFoo field = { // BLOCK local class : IFoo { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -49,14 +49,14 @@ val test2: IFoo class Outer { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } abstract inner class Inner : IFoo { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -71,7 +71,7 @@ class Outer { return { // BLOCK local class : Inner { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + .super/*Inner*/() /* InstanceInitializerCall */ } @@ -99,7 +99,7 @@ fun Outer.test4(): Inner { return { // BLOCK local class : Inner { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + .super/*Inner*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/objectWithInitializers.kt.txt b/compiler/testData/ir/irText/classes/objectWithInitializers.kt.txt index 4102d112929..024c0a9c4a9 100644 --- a/compiler/testData/ir/irText/classes/objectWithInitializers.kt.txt +++ b/compiler/testData/ir/irText/classes/objectWithInitializers.kt.txt @@ -1,6 +1,6 @@ abstract class Base { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -12,7 +12,7 @@ abstract class Base { object Test : Base { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Base*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/outerClassAccess.kt.txt b/compiler/testData/ir/irText/classes/outerClassAccess.kt.txt index 86e5f75aacf..624311b5246 100644 --- a/compiler/testData/ir/irText/classes/outerClassAccess.kt.txt +++ b/compiler/testData/ir/irText/classes/outerClassAccess.kt.txt @@ -1,6 +1,6 @@ class Outer { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -10,7 +10,7 @@ class Outer { inner class Inner { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -21,7 +21,7 @@ class Outer { inner class Inner2 { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/primaryConstructor.kt.txt b/compiler/testData/ir/irText/classes/primaryConstructor.kt.txt index 6986ef5d11c..473c5f08f63 100644 --- a/compiler/testData/ir/irText/classes/primaryConstructor.kt.txt +++ b/compiler/testData/ir/irText/classes/primaryConstructor.kt.txt @@ -1,6 +1,6 @@ class Test1 { constructor(x: Int, y: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -20,7 +20,7 @@ class Test1 { class Test2 { constructor(x: Int, y: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -40,7 +40,7 @@ class Test2 { class Test3 { constructor(x: Int, y: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.kt.txt b/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.kt.txt index 20e8d88c741..2d0f2815013 100644 --- a/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.kt.txt +++ b/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.kt.txt @@ -1,6 +1,6 @@ open class Base { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -12,7 +12,7 @@ open class Base { class TestImplicitPrimaryConstructor : Base { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Base*/() /* InstanceInitializerCall */ } @@ -24,7 +24,7 @@ class TestImplicitPrimaryConstructor : Base { class TestExplicitPrimaryConstructor : Base { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Base*/() /* InstanceInitializerCall */ } @@ -36,7 +36,7 @@ class TestExplicitPrimaryConstructor : Base { class TestWithDelegatingConstructor : Base { constructor(x: Int, y: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Base*/() /* InstanceInitializerCall */ } @@ -50,7 +50,7 @@ class TestWithDelegatingConstructor : Base { get constructor(x: Int) { - TODO("IrDelegatingConstructorCall") + this/*TestWithDelegatingConstructor*/(x = x, y = 0) } diff --git a/compiler/testData/ir/irText/classes/qualifiedSuperCalls.kt.txt b/compiler/testData/ir/irText/classes/qualifiedSuperCalls.kt.txt index 5969221ee45..66a4d4e8f02 100644 --- a/compiler/testData/ir/irText/classes/qualifiedSuperCalls.kt.txt +++ b/compiler/testData/ir/irText/classes/qualifiedSuperCalls.kt.txt @@ -28,7 +28,7 @@ interface IRight { class CBoth : ILeft, IRight { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/sealedClasses.kt.txt b/compiler/testData/ir/irText/classes/sealedClasses.kt.txt index 3b3f1691774..7fef692aa0d 100644 --- a/compiler/testData/ir/irText/classes/sealedClasses.kt.txt +++ b/compiler/testData/ir/irText/classes/sealedClasses.kt.txt @@ -1,13 +1,13 @@ sealed class Expr { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } class Const : Expr { constructor(number: Double) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Expr*/() /* InstanceInitializerCall */ } @@ -23,7 +23,7 @@ sealed class Expr { class Sum : Expr { constructor(e1: Expr, e2: Expr) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Expr*/() /* InstanceInitializerCall */ } @@ -43,7 +43,7 @@ sealed class Expr { object NotANumber : Expr { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Expr*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt.txt b/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt.txt index c2fd12e91f7..a4aec4ddbbf 100644 --- a/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt.txt +++ b/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt.txt @@ -1,6 +1,6 @@ open class Base { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -16,7 +16,7 @@ class TestProperty : Base { get constructor() { - TODO("IrDelegatingConstructorCall") + super/*Base*/() /* InstanceInitializerCall */ } @@ -35,19 +35,19 @@ class TestInitBlock : Base { } constructor() { - TODO("IrDelegatingConstructorCall") + super/*Base*/() /* InstanceInitializerCall */ } constructor(z: Any) { - TODO("IrDelegatingConstructorCall") + super/*Base*/() /* InstanceInitializerCall */ } constructor(y: Int) { - TODO("IrDelegatingConstructorCall") + this/*TestInitBlock*/() } diff --git a/compiler/testData/ir/irText/classes/secondaryConstructors.kt.txt b/compiler/testData/ir/irText/classes/secondaryConstructors.kt.txt index 8799103a85a..bc131aea7f1 100644 --- a/compiler/testData/ir/irText/classes/secondaryConstructors.kt.txt +++ b/compiler/testData/ir/irText/classes/secondaryConstructors.kt.txt @@ -1,10 +1,10 @@ class C { constructor() { - TODO("IrDelegatingConstructorCall") + this/*C*/(x = 0) } constructor(x: Int) { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/superCalls.kt.txt b/compiler/testData/ir/irText/classes/superCalls.kt.txt index 8165334d033..5c2934f53dc 100644 --- a/compiler/testData/ir/irText/classes/superCalls.kt.txt +++ b/compiler/testData/ir/irText/classes/superCalls.kt.txt @@ -1,6 +1,6 @@ open class Base { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -22,7 +22,7 @@ open class Base { class Derived : Base { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Base*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/superCallsComposed.kt.txt b/compiler/testData/ir/irText/classes/superCallsComposed.kt.txt index 2370c0810d2..18360a4f0e2 100644 --- a/compiler/testData/ir/irText/classes/superCallsComposed.kt.txt +++ b/compiler/testData/ir/irText/classes/superCallsComposed.kt.txt @@ -1,6 +1,6 @@ open class Base { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -29,7 +29,7 @@ interface BaseI { class Derived : Base, BaseI { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Base*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt index 07ec45757f0..f10f901fb22 100644 --- a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt @@ -25,7 +25,7 @@ interface IFoo { class DFoo : IFoo { constructor(d: IFoo) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.kt.txt b/compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.kt.txt index b5500f3de3b..9a13f6b2db9 100644 --- a/compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.kt.txt @@ -11,7 +11,7 @@ annotation class A : Annotation { class C { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt index e50f8ed8d4a..a928df16e3d 100644 --- a/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt @@ -12,7 +12,7 @@ annotation class TestAnn : Annotation { @TestAnn(x = "class") class TestClass { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -32,7 +32,7 @@ interface TestInterface { @TestAnn(x = "object") object TestObject { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -44,7 +44,7 @@ object TestObject { class Host { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -52,7 +52,7 @@ class Host { @TestAnn(x = "companion") companion object TestCompanion { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.kt.txt index 063b9b7a047..0a8c870d2a1 100644 --- a/compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.kt.txt @@ -12,14 +12,14 @@ annotation class TestAnn : Annotation { class TestClass { @TestAnn(x = 1) constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @TestAnn(x = 2) constructor(x: Int) { - TODO("IrDelegatingConstructorCall") + this/*TestClass*/() } diff --git a/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt index d9811eb7188..be0971eb8e8 100644 --- a/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt @@ -11,7 +11,7 @@ annotation class A : Annotation { class Cell { constructor(value: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.kt.txt index e40a2cd8d16..5dd5f482f40 100644 --- a/compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.kt.txt @@ -7,7 +7,7 @@ annotation class Ann : Annotation { class Test { constructor(x: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.kt.txt index ef7f463ecae..437cf04b1bc 100644 --- a/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.kt.txt @@ -11,7 +11,7 @@ annotation class A : Annotation { class C { constructor(x: Int, y: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/annotations/propertySetterParameterWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/propertySetterParameterWithAnnotations.kt.txt index 58fe08cf983..57e56d9ae1c 100644 --- a/compiler/testData/ir/irText/declarations/annotations/propertySetterParameterWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/propertySetterParameterWithAnnotations.kt.txt @@ -12,7 +12,7 @@ var p: Int class C { constructor(p: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/annotations/receiverParameterWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/receiverParameterWithAnnotations.kt.txt index 982aab5d8d0..b97ddc482ae 100644 --- a/compiler/testData/ir/irText/declarations/annotations/receiverParameterWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/receiverParameterWithAnnotations.kt.txt @@ -7,7 +7,7 @@ annotation class Ann : Annotation { class A { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.kt.txt index 6485b01a174..20570ae43f8 100644 --- a/compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.kt.txt @@ -14,7 +14,7 @@ fun testFun(x: Int) { class TestClassConstructor1 { constructor(x: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt b/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt index 2d9c02f7fa6..14e3597ecf5 100644 --- a/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt @@ -1,6 +1,6 @@ class C { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt b/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt index d2857b358b7..69bef8dea13 100644 --- a/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt @@ -9,7 +9,7 @@ val test1: Int /* by */ class C { constructor(map: MutableMap) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/extensionProperties.kt.txt b/compiler/testData/ir/irText/declarations/extensionProperties.kt.txt index 89d96b22654..44d5ab7067b 100644 --- a/compiler/testData/ir/irText/declarations/extensionProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/extensionProperties.kt.txt @@ -12,7 +12,7 @@ var String.test2: Int class Host { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/fakeOverrides.kt.txt b/compiler/testData/ir/irText/declarations/fakeOverrides.kt.txt index b4b4e8be196..98bffbc0249 100644 --- a/compiler/testData/ir/irText/declarations/fakeOverrides.kt.txt +++ b/compiler/testData/ir/irText/declarations/fakeOverrides.kt.txt @@ -16,7 +16,7 @@ interface IBar { abstract class CFoo { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -31,7 +31,7 @@ abstract class CFoo { class Test1 : CFoo, IFooStr, IBar { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*CFoo*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt.txt b/compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt.txt index e251ad487c7..a0816c0080e 100644 --- a/compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt.txt +++ b/compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt.txt @@ -1,6 +1,6 @@ class C { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -12,7 +12,7 @@ class C { object Delegate { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.kt.txt b/compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.kt.txt index ab6ed5434a2..2e27521ce6f 100644 --- a/compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.kt.txt +++ b/compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.kt.txt @@ -1,6 +1,6 @@ inline class IT { constructor(x: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -35,7 +35,7 @@ inline class IT { inline class InlineMutableSet : MutableSet { constructor(ms: MutableSet) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/kt29833.kt.txt b/compiler/testData/ir/irText/declarations/kt29833.kt.txt index 476db0fd560..6b5e7862faa 100644 --- a/compiler/testData/ir/irText/declarations/kt29833.kt.txt +++ b/compiler/testData/ir/irText/declarations/kt29833.kt.txt @@ -2,7 +2,7 @@ package interop object Definitions { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/kt35550.kt.txt b/compiler/testData/ir/irText/declarations/kt35550.kt.txt index 34b3aeaf6ac..7b60fa0af31 100644 --- a/compiler/testData/ir/irText/declarations/kt35550.kt.txt +++ b/compiler/testData/ir/irText/declarations/kt35550.kt.txt @@ -11,7 +11,7 @@ interface I { class A : I { constructor(i: I) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/localClassWithOverrides.kt.txt b/compiler/testData/ir/irText/declarations/localClassWithOverrides.kt.txt index d30600b0bdf..aecdbb903cd 100644 --- a/compiler/testData/ir/irText/declarations/localClassWithOverrides.kt.txt +++ b/compiler/testData/ir/irText/declarations/localClassWithOverrides.kt.txt @@ -1,7 +1,7 @@ fun outer() { local abstract class ALocal { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -22,7 +22,7 @@ fun outer() { local class Local : ALocal { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*ALocal*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectClassInherited.kt.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectClassInherited.kt.txt index cb047fd67b3..1549c8563e9 100644 --- a/compiler/testData/ir/irText/declarations/multiplatform/expectClassInherited.kt.txt +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectClassInherited.kt.txt @@ -17,7 +17,7 @@ expect open class B : A { abstract class A { protected constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -30,7 +30,7 @@ abstract class A { open class B : A { constructor(i: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*A*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.kt.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.kt.txt index 0593c6a91cd..0140f87e3b4 100644 --- a/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.kt.txt +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.kt.txt @@ -14,7 +14,7 @@ expect class Add : Ops { sealed class Ops { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -26,7 +26,7 @@ sealed class Ops { class Add : Ops { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Ops*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/parameters/class.kt.txt b/compiler/testData/ir/irText/declarations/parameters/class.kt.txt index e0dabfcde44..2431fae6cdd 100644 --- a/compiler/testData/ir/irText/declarations/parameters/class.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/class.kt.txt @@ -12,14 +12,14 @@ interface TestInterface { class Test { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } class TestNested { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -31,7 +31,7 @@ class Test { inner class TestInner { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/parameters/constructor.kt.txt b/compiler/testData/ir/irText/declarations/parameters/constructor.kt.txt index c6459372149..7f984f257d9 100644 --- a/compiler/testData/ir/irText/declarations/parameters/constructor.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/constructor.kt.txt @@ -1,6 +1,6 @@ class Test1 { constructor(x: T1, y: T2) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -20,7 +20,7 @@ class Test1 { class Test2 { constructor(x: Int, y: String) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -31,7 +31,7 @@ class Test2 { inner class TestInner { constructor(z: Z) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -41,7 +41,7 @@ class Test2 { get constructor(z: Z, i: Int) { - TODO("IrDelegatingConstructorCall") + .this/*TestInner*/(z = z) } @@ -56,7 +56,7 @@ class Test2 { class Test3 { constructor(x: Int, y: String = "") /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -76,7 +76,7 @@ class Test3 { class Test4 { constructor(x: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -86,7 +86,7 @@ class Test4 { get constructor(x: Int, y: Int = 42) { - TODO("IrDelegatingConstructorCall") + this/*Test4*/(x = x.plus(other = y)) } diff --git a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt index a8d51a25362..74902ebe9b5 100644 --- a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt @@ -1,6 +1,6 @@ data class Test { constructor(x: T, y: String = "") /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.kt.txt b/compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.kt.txt index 11dc09f1d13..c1ce99196b0 100644 --- a/compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.kt.txt @@ -9,7 +9,7 @@ var test2: Int class Host { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -30,7 +30,7 @@ class Host { class InPrimaryCtor { constructor(testInPrimaryCtor1: T, testInPrimaryCtor2: Int = 42) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt index b46221efc9f..c291494358f 100644 --- a/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt @@ -11,7 +11,7 @@ interface IBase { class Test : IBase { constructor(impl: IBase) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/parameters/fun.kt.txt b/compiler/testData/ir/irText/declarations/parameters/fun.kt.txt index b037bbb251f..f9fd4a63458 100644 --- a/compiler/testData/ir/irText/declarations/parameters/fun.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/fun.kt.txt @@ -12,7 +12,7 @@ fun String.textExt1(i: Int, j: String) { class Host { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/parameters/genericInnerClass.kt.txt b/compiler/testData/ir/irText/declarations/parameters/genericInnerClass.kt.txt index 1d8f8e12210..93bb6cd2ff7 100644 --- a/compiler/testData/ir/irText/declarations/parameters/genericInnerClass.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/genericInnerClass.kt.txt @@ -1,13 +1,13 @@ class Outer { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } inner class Inner { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/parameters/propertyAccessors.kt.txt b/compiler/testData/ir/irText/declarations/parameters/propertyAccessors.kt.txt index b7c7fa7e6c3..c88b9fae673 100644 --- a/compiler/testData/ir/irText/declarations/parameters/propertyAccessors.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/propertyAccessors.kt.txt @@ -36,7 +36,7 @@ var T.testExt4: Int class Host { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/parameters/typeParameterBeforeBound.kt.txt b/compiler/testData/ir/irText/declarations/parameters/typeParameterBeforeBound.kt.txt index d4357727646..af3034679f2 100644 --- a/compiler/testData/ir/irText/declarations/parameters/typeParameterBeforeBound.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/typeParameterBeforeBound.kt.txt @@ -1,6 +1,6 @@ class Test1 { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/parameters/typeParameterBoundedBySubclass.kt.txt b/compiler/testData/ir/irText/declarations/parameters/typeParameterBoundedBySubclass.kt.txt index 67a57838a10..acd405e91cd 100644 --- a/compiler/testData/ir/irText/declarations/parameters/typeParameterBoundedBySubclass.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/typeParameterBoundedBySubclass.kt.txt @@ -1,6 +1,6 @@ abstract class Base1 { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -12,7 +12,7 @@ abstract class Base1 { class Derived1 : Base1 { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Base1*/() /* InstanceInitializerCall */ } @@ -24,7 +24,7 @@ class Derived1 : Base1 { abstract class Base2 { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -39,7 +39,7 @@ abstract class Base2 { class Derived2 : Base2 { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Base2*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.kt.txt b/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.kt.txt index 3ddc35b5ccf..e1f95d49969 100644 --- a/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.kt.txt +++ b/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.kt.txt @@ -1,6 +1,6 @@ class Test { constructor(x: Int = 0) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/primaryCtorProperties.kt.txt b/compiler/testData/ir/irText/declarations/primaryCtorProperties.kt.txt index 0490a0fead8..37b4c154856 100644 --- a/compiler/testData/ir/irText/declarations/primaryCtorProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/primaryCtorProperties.kt.txt @@ -1,6 +1,6 @@ class C { constructor(test1: Int, test2: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt index 2ba14cf5ff2..719dc756ba1 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt @@ -1,6 +1,6 @@ class MyClass { constructor(value: String) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/local.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/local.kt.txt index 6e10c0bab61..3313b337599 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/local.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/local.kt.txt @@ -1,6 +1,6 @@ class Delegate { constructor(value: String) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -20,7 +20,7 @@ class Delegate { class DelegateProvider { constructor(value: String) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt index 0f8ebc3ca62..dc4ba18992b 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt @@ -1,6 +1,6 @@ class MyClass { constructor(value: String) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt index 3d2696aee1d..7fb97f6eb25 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt @@ -1,6 +1,6 @@ class Delegate { constructor(value: String) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -20,7 +20,7 @@ class Delegate { class DelegateProvider { constructor(value: String) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -40,7 +40,7 @@ class DelegateProvider { class Host { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt index 4c102029584..fef16a625c0 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt @@ -1,13 +1,13 @@ object Host { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } class StringDelegate { constructor(s: String) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.kt.txt index 20d42a51f8a..19df8d06c16 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.kt.txt @@ -1,6 +1,6 @@ class Delegate { constructor(value: String) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -20,7 +20,7 @@ class Delegate { class DelegateProvider { constructor(value: String) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/typeAlias.kt.txt b/compiler/testData/ir/irText/declarations/typeAlias.kt.txt index f37b3737bef..e2d1093c71c 100644 --- a/compiler/testData/ir/irText/declarations/typeAlias.kt.txt +++ b/compiler/testData/ir/irText/declarations/typeAlias.kt.txt @@ -6,7 +6,7 @@ fun foo() { class C { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/errors/suppressedNonPublicCall.kt.txt b/compiler/testData/ir/irText/errors/suppressedNonPublicCall.kt.txt index 6b5513aa06e..9e4bbc7e90d 100644 --- a/compiler/testData/ir/irText/errors/suppressedNonPublicCall.kt.txt +++ b/compiler/testData/ir/irText/errors/suppressedNonPublicCall.kt.txt @@ -1,6 +1,6 @@ class C { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.kt.txt b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.kt.txt index 33fe1816fe2..d80382fd23a 100644 --- a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.kt.txt +++ b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.kt.txt @@ -8,7 +8,7 @@ fun bar(): Int { class C { constructor(x: IntArray) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/assignments.kt.txt b/compiler/testData/ir/irText/expressions/assignments.kt.txt index dee27ccad05..f1c6442fb24 100644 --- a/compiler/testData/ir/irText/expressions/assignments.kt.txt +++ b/compiler/testData/ir/irText/expressions/assignments.kt.txt @@ -1,6 +1,6 @@ class Ref { constructor(x: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt b/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt index 0c43289a5a7..c70172fe157 100644 --- a/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt +++ b/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt @@ -1,6 +1,6 @@ class A { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.kt.txt b/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.kt.txt index 1c170efdb74..2f39d141072 100644 --- a/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.kt.txt +++ b/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.kt.txt @@ -1,6 +1,6 @@ class Host { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/boundCallableReferences.kt.txt b/compiler/testData/ir/irText/expressions/boundCallableReferences.kt.txt index 1741503e0cf..b105755a710 100644 --- a/compiler/testData/ir/irText/expressions/boundCallableReferences.kt.txt +++ b/compiler/testData/ir/irText/expressions/boundCallableReferences.kt.txt @@ -1,6 +1,6 @@ class A { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt index 431fcc1667d..32c26034831 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt @@ -3,7 +3,7 @@ fun use(f: @ExtensionFunctionType Function2) { class C { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt index d2cb7bca6f3..ebcd44676e5 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt @@ -2,14 +2,14 @@ package test class Foo { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } inner class Inner

{ constructor(a: T, b: P) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt index 73c5a3b80b3..5752ccfed7b 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt @@ -14,7 +14,7 @@ fun interface IFoo2 : IFoo { object A { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -26,7 +26,7 @@ object A { object B { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt index be01cbbcdc8..8741d8f2284 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt @@ -4,7 +4,7 @@ fun use(fn: Function1): Any { class C { constructor(vararg xs: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -16,14 +16,14 @@ class C { class Outer { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } inner class Inner { constructor(vararg xs: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt.txt index 3ce6d92060e..812e06d5e9b 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt.txt @@ -12,7 +12,7 @@ fun varargs(vararg xs: String): Int { class C { constructor(x: String = "") /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt.txt index 4ed9992e164..6193921ad24 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt.txt @@ -1,6 +1,6 @@ class A { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/importedFromObject.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/importedFromObject.kt.txt index 239e7d250a0..faad8ad2eb3 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/importedFromObject.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/importedFromObject.kt.txt @@ -2,7 +2,7 @@ package test object Foo { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt index 4c19b2b4a82..5c6e480fec5 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt @@ -4,7 +4,7 @@ fun foo(x: String = ""): String { class C { constructor(x: String = "") /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt index 87421fecd5b..e7547614223 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt @@ -25,7 +25,7 @@ fun foo4(i: Int = 42) { class C { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/typeArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/typeArguments.kt.txt index 9dd004801f2..a00ffca033a 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/typeArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/typeArguments.kt.txt @@ -1,6 +1,6 @@ object Host { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt index b704e5d316c..e56e9434e96 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt @@ -6,7 +6,7 @@ fun use2(fn: Function1) { open class A { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -22,7 +22,7 @@ open class A { object Obj : A { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*A*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt index c2501fd68f7..4de0ab9c9df 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt @@ -23,7 +23,7 @@ fun fnWithVarargs(vararg xs: Int): String { object Host { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt index 23a8b1814df..55b9a8d3122 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt @@ -4,7 +4,7 @@ fun use(fn: Function1) { class Host { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/castToTypeParameter.kt.txt b/compiler/testData/ir/irText/expressions/castToTypeParameter.kt.txt index 8d5ceedc488..d718a0a4519 100644 --- a/compiler/testData/ir/irText/expressions/castToTypeParameter.kt.txt +++ b/compiler/testData/ir/irText/expressions/castToTypeParameter.kt.txt @@ -13,7 +13,7 @@ val T.castExtVal: T class Host { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt b/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt index 6597c23668d..f0c2381a393 100644 --- a/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt +++ b/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt @@ -1,6 +1,6 @@ class C { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/classReference.kt.txt b/compiler/testData/ir/irText/expressions/classReference.kt.txt index 34cb3830d0f..7212d0a36bf 100644 --- a/compiler/testData/ir/irText/expressions/classReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/classReference.kt.txt @@ -1,6 +1,6 @@ class A { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt index cd52c691590..571a89e312e 100644 --- a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt +++ b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt @@ -1,6 +1,6 @@ object X1 { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -12,7 +12,7 @@ object X1 { object X2 { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -24,7 +24,7 @@ object X1 { object X3 { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -93,7 +93,7 @@ fun test2() { class B { constructor(s: Int = 0) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -110,7 +110,7 @@ class B { object Host { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.kt.txt b/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.kt.txt index 6a0928581a0..0970f573761 100644 --- a/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.kt.txt @@ -8,14 +8,14 @@ fun testJava(): J2 { class K1 { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } inner class K2 { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/contructorCall.kt.txt b/compiler/testData/ir/irText/expressions/contructorCall.kt.txt index 50dcca237b7..ef069c6ac81 100644 --- a/compiler/testData/ir/irText/expressions/contructorCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/contructorCall.kt.txt @@ -1,6 +1,6 @@ class A { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/destructuring1.kt.txt b/compiler/testData/ir/irText/expressions/destructuring1.kt.txt index 19c4b21fa6a..657099389e5 100644 --- a/compiler/testData/ir/irText/expressions/destructuring1.kt.txt +++ b/compiler/testData/ir/irText/expressions/destructuring1.kt.txt @@ -1,6 +1,6 @@ object A { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -12,7 +12,7 @@ object A { object B { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.kt.txt b/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.kt.txt index 413332d666d..be0be0655ee 100644 --- a/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.kt.txt +++ b/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.kt.txt @@ -1,6 +1,6 @@ object A { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -12,7 +12,7 @@ object A { object B { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.kt.txt index 59edd1194bb..2324f39b03a 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.kt.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.kt.txt @@ -49,7 +49,7 @@ fun test6(x: Any, y: T): Boolean { class F { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt index af15c51841f..0abe18d695b 100644 --- a/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt +++ b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt @@ -1,6 +1,6 @@ object FiveTimes { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -12,7 +12,7 @@ object FiveTimes { class IntCell { constructor(value: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/funImportedFromObject.kt.txt b/compiler/testData/ir/irText/expressions/funImportedFromObject.kt.txt index 7208c4f9bc6..aafc48b7a65 100644 --- a/compiler/testData/ir/irText/expressions/funImportedFromObject.kt.txt +++ b/compiler/testData/ir/irText/expressions/funImportedFromObject.kt.txt @@ -2,7 +2,7 @@ package test object Host { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt index afbecadfe46..596d0026e9a 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt @@ -7,7 +7,7 @@ fun interface Fn { class J { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -25,7 +25,7 @@ val fsi: Fn field = { // BLOCK local class : Fn { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -48,7 +48,7 @@ val fis: Fn field = { // BLOCK local class : Fn { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt b/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt index 7b8f08c1967..56fcf80db15 100644 --- a/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt @@ -11,7 +11,7 @@ inline fun testArray(n: Int, crossinline block: Function0) class Box { constructor(value: T) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt b/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt index 3a91b1db879..d8d40af7493 100644 --- a/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt +++ b/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt @@ -1,6 +1,6 @@ class Value { constructor(value: T = null as T, text: String? = null) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -34,7 +34,7 @@ val Value.additionalValue: Int /* by */ class DVal { constructor(kmember: Any) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.kt.txt b/compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.kt.txt index 72cc93ab5f6..bcdbe848f86 100644 --- a/compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.kt.txt +++ b/compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.kt.txt @@ -1,12 +1,12 @@ class C { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } constructor(x: Any?) { - TODO("IrDelegatingConstructorCall") + this/*C*/() when { x is Unit -> return x /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.kt.txt b/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.kt.txt index d0bccb88e35..a5b6f66c2bb 100644 --- a/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.kt.txt +++ b/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.kt.txt @@ -21,7 +21,7 @@ val Foo.asT: T? class Bar { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt b/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt index 283ab4d59c4..0608cd4cb58 100644 --- a/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt +++ b/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt @@ -6,7 +6,7 @@ interface IFoo { class Derived1 : JFieldOwner, IFoo { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*JFieldOwner*/() /* InstanceInitializerCall */ } @@ -18,7 +18,7 @@ class Derived1 : JFieldOwner, IFoo { class Derived2 : JFieldOwner, IFoo { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*JFieldOwner*/() /* InstanceInitializerCall */ } @@ -30,7 +30,7 @@ class Derived2 : JFieldOwner, IFoo { open class Mid : JFieldOwner { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*JFieldOwner*/() /* InstanceInitializerCall */ } @@ -42,7 +42,7 @@ open class Mid : JFieldOwner { class DerivedThroughMid1 : Mid, IFoo { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Mid*/() /* InstanceInitializerCall */ } @@ -54,7 +54,7 @@ class DerivedThroughMid1 : Mid, IFoo { class DerivedThroughMid2 : Mid, IFoo { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Mid*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt.txt b/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt.txt index 31e26fb0fdb..706e32e32d7 100644 --- a/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt.txt @@ -1,6 +1,6 @@ class Derived : Base { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Base*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt index 06d44251ce8..acddda85fd6 100644 --- a/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt @@ -13,7 +13,7 @@ var testProp: Any class TestClass { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/kt16904.kt.txt b/compiler/testData/ir/irText/expressions/kt16904.kt.txt index a718472cb3f..8ad0b469529 100644 --- a/compiler/testData/ir/irText/expressions/kt16904.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt16904.kt.txt @@ -1,6 +1,6 @@ abstract class A { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -21,7 +21,7 @@ abstract class A { class B { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -36,7 +36,7 @@ class B { class Test1 : A { constructor() { - TODO("IrDelegatingConstructorCall") + super/*A*/() /* InstanceInitializerCall */ { // BLOCK @@ -56,7 +56,7 @@ class Test1 : A { class Test2 : J { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*J*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/kt16905.kt.txt b/compiler/testData/ir/irText/expressions/kt16905.kt.txt index 30a1416661a..9cbb1a1aab9 100644 --- a/compiler/testData/ir/irText/expressions/kt16905.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt16905.kt.txt @@ -1,13 +1,13 @@ class Outer { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } open inner class Inner { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -19,7 +19,7 @@ class Outer { inner class InnerDerived0 : Inner { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + .super/*Inner*/() /* InstanceInitializerCall */ } @@ -31,7 +31,7 @@ class Outer { inner class InnerDerived1 : Inner { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + .super/*Inner*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/kt23030.kt.txt b/compiler/testData/ir/irText/expressions/kt23030.kt.txt index 7101d467fd5..b3bd4c4d157 100644 --- a/compiler/testData/ir/irText/expressions/kt23030.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt23030.kt.txt @@ -28,7 +28,7 @@ fun testEqualsWithSmartCast(x: Any, y: Any): Boolean { class C { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/kt28456.kt.txt b/compiler/testData/ir/irText/expressions/kt28456.kt.txt index 206a8b0fa28..b0009d1e305 100644 --- a/compiler/testData/ir/irText/expressions/kt28456.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt28456.kt.txt @@ -1,6 +1,6 @@ class A { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/kt28456a.kt.txt b/compiler/testData/ir/irText/expressions/kt28456a.kt.txt index 70874414592..72003754a75 100644 --- a/compiler/testData/ir/irText/expressions/kt28456a.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt28456a.kt.txt @@ -1,6 +1,6 @@ class A { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/kt28456b.kt.txt b/compiler/testData/ir/irText/expressions/kt28456b.kt.txt index 76b604178e0..d6804f792c0 100644 --- a/compiler/testData/ir/irText/expressions/kt28456b.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt28456b.kt.txt @@ -1,6 +1,6 @@ class A { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/kt30020.kt.txt b/compiler/testData/ir/irText/expressions/kt30020.kt.txt index 53f81d66ae7..0b61796d6ff 100644 --- a/compiler/testData/ir/irText/expressions/kt30020.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt30020.kt.txt @@ -38,7 +38,7 @@ fun MutableList.testExtensionReceiver() { abstract class AML : MutableList { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -49,7 +49,7 @@ abstract class AML : MutableList { inner class Inner { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/kt35730.kt.txt b/compiler/testData/ir/irText/expressions/kt35730.kt.txt index 612643b1a73..bbe6def41d9 100644 --- a/compiler/testData/ir/irText/expressions/kt35730.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt35730.kt.txt @@ -9,7 +9,7 @@ interface Base { object Derived : Base { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/kt36956.kt.txt b/compiler/testData/ir/irText/expressions/kt36956.kt.txt index 8b8e5d02e33..c2875df8452 100644 --- a/compiler/testData/ir/irText/expressions/kt36956.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt36956.kt.txt @@ -1,6 +1,6 @@ class A { constructor(value: T) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/kt37570.kt.txt b/compiler/testData/ir/irText/expressions/kt37570.kt.txt index ca7f8184047..511a7f5a3f8 100644 --- a/compiler/testData/ir/irText/expressions/kt37570.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt37570.kt.txt @@ -4,7 +4,7 @@ fun a(): String { class A { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/memberTypeArguments.kt.txt b/compiler/testData/ir/irText/expressions/memberTypeArguments.kt.txt index 15b69e36805..ffed8fe90ac 100644 --- a/compiler/testData/ir/irText/expressions/memberTypeArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/memberTypeArguments.kt.txt @@ -1,6 +1,6 @@ class GenericClass { constructor(value: T) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/membersImportedFromObject.kt.txt b/compiler/testData/ir/irText/expressions/membersImportedFromObject.kt.txt index 9a510e14c48..96eddea213c 100644 --- a/compiler/testData/ir/irText/expressions/membersImportedFromObject.kt.txt +++ b/compiler/testData/ir/irText/expressions/membersImportedFromObject.kt.txt @@ -1,6 +1,6 @@ object A { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt b/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt index 504335e0a82..7beac7158c2 100644 --- a/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt +++ b/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt @@ -1,13 +1,13 @@ class Outer { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } open inner class Inner { constructor(x: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -28,7 +28,7 @@ class Outer { class Host { constructor(y: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -41,7 +41,7 @@ class Host { return { // BLOCK local class : Inner { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + .super/*Inner*/(x = 42) /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt b/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt index 894dfad5cbe..8d2b46f20ba 100644 --- a/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt +++ b/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt @@ -1,6 +1,6 @@ object A { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/objectClassReference.kt.txt b/compiler/testData/ir/irText/expressions/objectClassReference.kt.txt index 3225c4ab84c..c67b1eff3b8 100644 --- a/compiler/testData/ir/irText/expressions/objectClassReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/objectClassReference.kt.txt @@ -1,6 +1,6 @@ object A { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/objectReference.kt.txt b/compiler/testData/ir/irText/expressions/objectReference.kt.txt index ed74279f699..613c811fe9e 100644 --- a/compiler/testData/ir/irText/expressions/objectReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/objectReference.kt.txt @@ -1,6 +1,6 @@ object Z { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -22,7 +22,7 @@ object Z { class Nested { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -60,7 +60,7 @@ object Z { field = { // BLOCK local class { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.kt.txt b/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.kt.txt index 652cd8c32c9..adb4082d614 100644 --- a/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.kt.txt @@ -1,6 +1,6 @@ abstract class Base { constructor(lambda: Function0) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -16,7 +16,10 @@ abstract class Base { object Test : Base { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Base*/(lambda = local fun (): Any { + return Test + } +) /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.kt.txt b/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.kt.txt index 2bc62bb9d23..de292e4f24f 100644 --- a/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.kt.txt +++ b/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.kt.txt @@ -1,6 +1,6 @@ object A { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt.txt b/compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt.txt index c27264b8e7c..beef491f733 100644 --- a/compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt.txt @@ -1,6 +1,6 @@ class Outer { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -10,7 +10,7 @@ class Outer { inner class Inner { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.kt.txt b/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.kt.txt index 997fb638841..261741782c8 100644 --- a/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.kt.txt +++ b/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.kt.txt @@ -37,7 +37,7 @@ fun testImplicitArguments(x: Long = 1.unaryMinus().toLong()) { class TestImplicitArguments { constructor(x: Long = 1.unaryMinus().toLong()) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/propertyReferences.kt.txt b/compiler/testData/ir/irText/expressions/propertyReferences.kt.txt index 5ceb572b2cf..5a7c79594f1 100644 --- a/compiler/testData/ir/irText/expressions/propertyReferences.kt.txt +++ b/compiler/testData/ir/irText/expressions/propertyReferences.kt.txt @@ -1,6 +1,6 @@ object Delegate { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -19,7 +19,7 @@ object Delegate { open class C { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt b/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt index 0d7c07ce188..e2507de1434 100644 --- a/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt +++ b/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt @@ -1,6 +1,6 @@ class A { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt b/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt index 775ce838759..81befe5abd9 100644 --- a/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt +++ b/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt @@ -1,6 +1,6 @@ class C { constructor(x: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt index f1a0f69545c..5003e3cb3e1 100644 --- a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt +++ b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt @@ -2,7 +2,7 @@ package test class C { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/safeCalls.kt.txt b/compiler/testData/ir/irText/expressions/safeCalls.kt.txt index a1de2db7012..033184eefc9 100644 --- a/compiler/testData/ir/irText/expressions/safeCalls.kt.txt +++ b/compiler/testData/ir/irText/expressions/safeCalls.kt.txt @@ -1,6 +1,6 @@ class Ref { constructor(value: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt index 78a3a61152b..47a73284e4e 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt @@ -4,7 +4,7 @@ fun test3(f1: Function1, f2: Function1): D<@Flexibl class Outer { constructor(j11: J) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -15,7 +15,7 @@ class Outer { inner class Inner { constructor(j12: J) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt index 382a7e2aa37..8b74b7bb4e0 100644 --- a/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt +++ b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt @@ -1,6 +1,6 @@ class Derived : Base { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Base*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.kt.txt b/compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.kt.txt index 03d6718bd5e..4153e1dfd87 100644 --- a/compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.kt.txt @@ -1,6 +1,6 @@ class Cell { constructor(value: T) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt b/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt index 380fc2d7a00..9504e2eb01b 100644 --- a/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt +++ b/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt @@ -1,6 +1,6 @@ class C { constructor(x: Any?) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt b/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt index 899e289caa3..48fe3b0173f 100644 --- a/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt +++ b/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt @@ -1,6 +1,6 @@ class Outer { constructor(x: T) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -11,7 +11,7 @@ class Outer { open inner class Inner { constructor(y: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -34,7 +34,7 @@ fun Outer.test(): Inner { return { // BLOCK local class : Inner { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + .super/*Inner*/(y = 42) /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.kt.txt b/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.kt.txt index bd5b304ba62..a0d57b67f16 100644 --- a/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.kt.txt @@ -1,6 +1,6 @@ open class Base { constructor(x: Any) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -16,14 +16,14 @@ open class Base { object Host { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } class Derived1 : Base { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Base*/(x = Host) /* InstanceInitializerCall */ } @@ -35,7 +35,7 @@ object Host { class Derived2 : Base { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Base*/(x = Host) /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt b/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt index 2035f6a97aa..b84ea5df90f 100644 --- a/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt +++ b/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt @@ -2,7 +2,7 @@ fun WithCompanion.test() { val test1: = { // BLOCK local class : WithCompanion { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*WithCompanion*/(a = Companion) /* InstanceInitializerCall */ } @@ -18,7 +18,7 @@ fun WithCompanion.test() { val test2: = { // BLOCK local class : WithCompanion { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*WithCompanion*/(a = Companion.foo()) /* InstanceInitializerCall */ } @@ -35,14 +35,14 @@ fun WithCompanion.test() { open class WithCompanion { constructor(a: Companion) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } companion object Companion { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/typeAliasConstructorReference.kt.txt b/compiler/testData/ir/irText/expressions/typeAliasConstructorReference.kt.txt index e8914501210..6464cc8e12c 100644 --- a/compiler/testData/ir/irText/expressions/typeAliasConstructorReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/typeAliasConstructorReference.kt.txt @@ -1,6 +1,6 @@ class C { constructor(x: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -13,14 +13,14 @@ class C { typealias CA = C object Host { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } class Nested { constructor(x: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/typeParameterClassLiteral.kt.txt b/compiler/testData/ir/irText/expressions/typeParameterClassLiteral.kt.txt index e07c6b9bd7e..ea6db7d4e79 100644 --- a/compiler/testData/ir/irText/expressions/typeParameterClassLiteral.kt.txt +++ b/compiler/testData/ir/irText/expressions/typeParameterClassLiteral.kt.txt @@ -13,7 +13,7 @@ val T.classRefExtVal: KClass class Host { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/useImportedMember.kt.txt b/compiler/testData/ir/irText/expressions/useImportedMember.kt.txt index 09d3fd964e8..3101e945445 100644 --- a/compiler/testData/ir/irText/expressions/useImportedMember.kt.txt +++ b/compiler/testData/ir/irText/expressions/useImportedMember.kt.txt @@ -14,7 +14,7 @@ interface I { open class BaseClass { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -31,7 +31,7 @@ open class BaseClass { object C : BaseClass, I { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*BaseClass*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/values.kt.txt b/compiler/testData/ir/irText/expressions/values.kt.txt index 6eb95edb4fa..766800e5eee 100644 --- a/compiler/testData/ir/irText/expressions/values.kt.txt +++ b/compiler/testData/ir/irText/expressions/values.kt.txt @@ -20,7 +20,7 @@ enum class Enum : Enum { object A { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -36,14 +36,14 @@ val a: Int class Z { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } companion object Companion { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/expressions/when.kt.txt b/compiler/testData/ir/irText/expressions/when.kt.txt index 57e50ca1068..5c37ea8183a 100644 --- a/compiler/testData/ir/irText/expressions/when.kt.txt +++ b/compiler/testData/ir/irText/expressions/when.kt.txt @@ -1,6 +1,6 @@ object A { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/firProblems/AbstractMutableMap.kt.txt b/compiler/testData/ir/irText/firProblems/AbstractMutableMap.kt.txt index f9802b6e6c8..4d47ef4744f 100644 --- a/compiler/testData/ir/irText/firProblems/AbstractMutableMap.kt.txt +++ b/compiler/testData/ir/irText/firProblems/AbstractMutableMap.kt.txt @@ -1,6 +1,6 @@ class MyMap : AbstractMutableMap { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*AbstractMutableMap*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt b/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt index 29873cc7b25..572fc7d8644 100644 --- a/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt +++ b/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt @@ -1,6 +1,6 @@ class ResolvedCall { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -12,7 +12,7 @@ class ResolvedCall { class MyCandidate { constructor(resolvedCall: ResolvedCall<*>) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.kt.txt b/compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.kt.txt index 8757821451f..4b403e60b42 100644 --- a/compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.kt.txt +++ b/compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.kt.txt @@ -27,7 +27,7 @@ annotation class State : Annotation { @State(name = "1", storages = [Storage(value = "HELLO")]) class Test { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/firProblems/BaseFirBuilder.kt.txt b/compiler/testData/ir/irText/firProblems/BaseFirBuilder.kt.txt index e2f748eba3c..808e2406597 100644 --- a/compiler/testData/ir/irText/firProblems/BaseFirBuilder.kt.txt +++ b/compiler/testData/ir/irText/firProblems/BaseFirBuilder.kt.txt @@ -1,6 +1,6 @@ abstract class BaseFirBuilder { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt index bd1b4d57924..4ac329e6280 100644 --- a/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt +++ b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt @@ -18,7 +18,7 @@ interface ComponentDescriptor { abstract class PlatformExtensionsClashResolver> { constructor(applicableTo: Class) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -34,7 +34,7 @@ abstract class PlatformExtensionsClashResolver> class ClashResolutionDescriptor> { constructor(container: ComponentContainer, resolver: PlatformExtensionsClashResolver, clashedComponents: List) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt index b003eb7047c..211a9a3ab8b 100644 --- a/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt +++ b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt @@ -46,7 +46,7 @@ interface IrDeclarationParent { class DeepCopyIrTreeWithSymbols { constructor(typeRemapper: TypeRemapper) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt index 4587750062c..0cf12e16dec 100644 --- a/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt +++ b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt @@ -1,6 +1,6 @@ class Impl : A, B { constructor(b: B) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/firProblems/FirBuilder.kt.txt b/compiler/testData/ir/irText/firProblems/FirBuilder.kt.txt index c635a2d1a3e..ab83025d3a4 100644 --- a/compiler/testData/ir/irText/firProblems/FirBuilder.kt.txt +++ b/compiler/testData/ir/irText/firProblems/FirBuilder.kt.txt @@ -1,6 +1,6 @@ open class BaseConverter : BaseFirBuilder { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*BaseFirBuilder*/() /* InstanceInitializerCall */ } @@ -13,7 +13,7 @@ open class BaseConverter : BaseFirBuilder { class DeclarationsConverter : BaseConverter { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*BaseConverter*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt b/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt index 9cda3191fef..a82b4db611b 100644 --- a/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt +++ b/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt @@ -2,7 +2,7 @@ fun box(): String { val obj: = { // BLOCK local class { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -17,7 +17,7 @@ fun box(): String { local inner class Some : Base { constructor(s: String) /* primary */ { - TODO("IrDelegatingConstructorCall") + .super/*Base*/(s = s) /* InstanceInitializerCall */ } @@ -33,7 +33,7 @@ fun box(): String { local open inner class Base { constructor(s: String) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/firProblems/MultiList.kt.txt b/compiler/testData/ir/irText/firProblems/MultiList.kt.txt index 32ce6da9caf..818cbe181a4 100644 --- a/compiler/testData/ir/irText/firProblems/MultiList.kt.txt +++ b/compiler/testData/ir/irText/firProblems/MultiList.kt.txt @@ -1,6 +1,6 @@ data class Some { constructor(value: T) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -69,7 +69,7 @@ interface MyList : List> { open class SomeList : MyList, ArrayList> { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*ArrayList*/<@FlexibleNullability Some?>() /* InstanceInitializerCall */ } @@ -114,7 +114,7 @@ open class SomeList : MyList, ArrayList> { class FinalList : SomeList { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*SomeList*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt b/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt index 824d78dbb52..9dd093e8b12 100644 --- a/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt +++ b/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt @@ -1,7 +1,7 @@ typealias Some = Function1 object Factory { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -41,7 +41,7 @@ interface Derived : Delegate { data class DataClass : Derived, Delegate { constructor(delegate: Delegate) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/firProblems/VarInInit.kt.txt b/compiler/testData/ir/irText/firProblems/VarInInit.kt.txt index fe7198ef8ed..cf1f115f43c 100644 --- a/compiler/testData/ir/irText/firProblems/VarInInit.kt.txt +++ b/compiler/testData/ir/irText/firProblems/VarInInit.kt.txt @@ -1,6 +1,6 @@ class Some { constructor(foo: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt b/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt index d3f666afc67..ca0b05b3d06 100644 --- a/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt +++ b/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt @@ -1,6 +1,6 @@ class Candidate { constructor(symbol: AbstractFirBasedSymbol<*>) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -16,7 +16,7 @@ class Candidate { abstract class AbstractFirBasedSymbol where E : FirSymbolOwner, E : FirDeclaration { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/firProblems/putIfAbsent.kt.txt b/compiler/testData/ir/irText/firProblems/putIfAbsent.kt.txt index 21fba8220b0..b40c904496c 100644 --- a/compiler/testData/ir/irText/firProblems/putIfAbsent.kt.txt +++ b/compiler/testData/ir/irText/firProblems/putIfAbsent.kt.txt @@ -1,6 +1,6 @@ class Owner { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/firProblems/v8arrayToList.kt.txt b/compiler/testData/ir/irText/firProblems/v8arrayToList.kt.txt index 922223e6148..a01e40c8e3c 100644 --- a/compiler/testData/ir/irText/firProblems/v8arrayToList.kt.txt +++ b/compiler/testData/ir/irText/firProblems/v8arrayToList.kt.txt @@ -1,6 +1,6 @@ class V8Array { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt b/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt index 18a78f1ae74..ffea653d202 100644 --- a/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt +++ b/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt @@ -1,6 +1,6 @@ data class A { constructor(x: Int, y: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt index 2c344f4fdcb..6f72c26c9af 100644 --- a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt +++ b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt @@ -1,6 +1,6 @@ object A { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -12,7 +12,7 @@ object A { object B { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/regressions/integerCoercionToT.kt.txt b/compiler/testData/ir/irText/regressions/integerCoercionToT.kt.txt index 830c5ac39ea..eff25bcc191 100644 --- a/compiler/testData/ir/irText/regressions/integerCoercionToT.kt.txt +++ b/compiler/testData/ir/irText/regressions/integerCoercionToT.kt.txt @@ -10,7 +10,7 @@ inline fun CPointed.reinterpret(): T { class CInt32VarX : CPointed { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -30,7 +30,7 @@ var CInt32VarX.value: T_INT class IdType : CPointed { constructor(value: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.kt.txt b/compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.kt.txt index 0ef13c0c97c..8848b86f172 100644 --- a/compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.kt.txt +++ b/compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.kt.txt @@ -1,6 +1,6 @@ class A { constructor(q: Q) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/singletons/companion.kt.txt b/compiler/testData/ir/irText/singletons/companion.kt.txt index 3b548757f67..b1c4ca900ed 100644 --- a/compiler/testData/ir/irText/singletons/companion.kt.txt +++ b/compiler/testData/ir/irText/singletons/companion.kt.txt @@ -1,6 +1,6 @@ class Z { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -11,7 +11,7 @@ class Z { companion object Companion { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/singletons/object.kt.txt b/compiler/testData/ir/irText/singletons/object.kt.txt index 2048f181764..2f030b0034c 100644 --- a/compiler/testData/ir/irText/singletons/object.kt.txt +++ b/compiler/testData/ir/irText/singletons/object.kt.txt @@ -1,6 +1,6 @@ object Z { private constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -10,7 +10,7 @@ object Z { class A { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m1.kt.txt b/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m1.kt.txt index ccaa54f2166..50383959c5f 100644 --- a/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m1.kt.txt +++ b/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m1.kt.txt @@ -1,6 +1,6 @@ abstract class Base { constructor(x: T) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m2.kt.txt b/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m2.kt.txt index e53327404d9..53407fa0166 100644 --- a/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m2.kt.txt +++ b/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m2.kt.txt @@ -1,6 +1,6 @@ class Derived1 : Base { constructor(x: T) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Base*/(x = x) /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/stubs/javaInnerClass.kt.txt b/compiler/testData/ir/irText/stubs/javaInnerClass.kt.txt index 4e94cf73896..b194aaedf0d 100644 --- a/compiler/testData/ir/irText/stubs/javaInnerClass.kt.txt +++ b/compiler/testData/ir/irText/stubs/javaInnerClass.kt.txt @@ -1,6 +1,6 @@ class Test1 : J { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*J*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt index e8234dee409..93f7ead5276 100644 --- a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt +++ b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt @@ -69,7 +69,7 @@ private fun CoroutineScope.asChannel(flow: Flow<*>): ReceiveChannel { class SafeCollector : FlowCollector { constructor(collector: FlowCollector) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -101,7 +101,7 @@ suspend inline fun Flow.collect(crossinline action: SuspendFunctio open class ChannelCoroutine { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt index d97dd0b3864..c09549b34e2 100644 --- a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt +++ b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt @@ -1,6 +1,6 @@ class Value> { constructor(value1: T, value2: IT) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -42,7 +42,7 @@ interface IR { class CR : IR { constructor(r: R) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -62,7 +62,7 @@ class CR : IR { class P { constructor(p1: P1, p2: P2) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -84,7 +84,7 @@ val Value>.additionalText: P /* by */ field = { // BLOCK local class : IDelegate1>, P> { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -101,7 +101,7 @@ val Value>.additionalText: P /* by */ field = { // BLOCK local class : IDelegate1>, Any?> { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -134,7 +134,7 @@ val Value>.additionalText: P /* by */ field = { // BLOCK local class : IDelegate1>, Any?> { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/types/genericFunWithStar.kt.txt b/compiler/testData/ir/irText/types/genericFunWithStar.kt.txt index 74f305daa01..4f25efa9c00 100644 --- a/compiler/testData/ir/irText/types/genericFunWithStar.kt.txt +++ b/compiler/testData/ir/irText/types/genericFunWithStar.kt.txt @@ -24,7 +24,7 @@ interface I where G : IFoo, G : IBar { abstract class Box : IFoo, IBar where T : IFoo, T : IBar { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/types/genericPropertyReferenceType.kt.txt b/compiler/testData/ir/irText/types/genericPropertyReferenceType.kt.txt index 055b8579fd4..efbea8dccb5 100644 --- a/compiler/testData/ir/irText/types/genericPropertyReferenceType.kt.txt +++ b/compiler/testData/ir/irText/types/genericPropertyReferenceType.kt.txt @@ -1,6 +1,6 @@ class C { constructor(x: T) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt b/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt index af41877bf00..568deb3416b 100644 --- a/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt @@ -1,6 +1,6 @@ class In { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt b/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt index fc1ecd782b3..b0234031d71 100644 --- a/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt @@ -1,6 +1,6 @@ class In { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt b/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt index 1319b782b2b..bb3cefa634b 100644 --- a/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt @@ -12,7 +12,7 @@ interface Foo { open class B : Foo, A { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -24,7 +24,7 @@ open class B : Foo, A { open class C : Foo, A { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt b/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt index 1319b782b2b..bb3cefa634b 100644 --- a/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt @@ -12,7 +12,7 @@ interface Foo { open class B : Foo, A { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -24,7 +24,7 @@ open class B : Foo, A { open class C : Foo, A { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/types/javaWildcardType.kt.txt b/compiler/testData/ir/irText/types/javaWildcardType.kt.txt index c2b7a406202..901940a1b58 100644 --- a/compiler/testData/ir/irText/types/javaWildcardType.kt.txt +++ b/compiler/testData/ir/irText/types/javaWildcardType.kt.txt @@ -10,7 +10,7 @@ interface K { class C : J, K { constructor(j: J, k: K) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt index 5e2c7daf623..d8560ef46ae 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt @@ -3,7 +3,7 @@ fun use(x: Any, y: Any) { class P { constructor(x: Int, y: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -31,7 +31,7 @@ class P { class Q { constructor(x: T1, y: T2) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt index 3426a07de12..ffbc1791fe6 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt @@ -78,7 +78,7 @@ interface K { data class P { constructor(x: Int, y: Int) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.kt.txt b/compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.kt.txt index c99a6d62535..7638e6b31c5 100644 --- a/compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.kt.txt @@ -3,7 +3,7 @@ fun f(s: String) { class MySet : Set { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.kt.txt index a95081d4bce..41e674060ba 100644 --- a/compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.kt.txt @@ -3,7 +3,7 @@ fun String.extension() { class C { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt b/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt index 2ba226222d0..d412047c67b 100644 --- a/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt +++ b/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt @@ -1,6 +1,6 @@ class GenericInv { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -12,7 +12,7 @@ class GenericInv { class GenericIn { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -24,7 +24,7 @@ class GenericIn { class GenericOut { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -48,7 +48,7 @@ fun testReturnsRawGenericOut(j: JRaw): @FlexibleNullability @RawType GenericOut< class KRaw : JRaw { constructor(j: JRaw) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/types/receiverOfIntersectionType.kt.txt b/compiler/testData/ir/irText/types/receiverOfIntersectionType.kt.txt index 4254ac59ad9..10f3b64dd6c 100644 --- a/compiler/testData/ir/irText/types/receiverOfIntersectionType.kt.txt +++ b/compiler/testData/ir/irText/types/receiverOfIntersectionType.kt.txt @@ -19,7 +19,7 @@ interface J : K { class A : I, J { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -34,7 +34,7 @@ class A : I, J { class B : I, J { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.kt.txt b/compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.kt.txt index 471272e1d2d..76086dc681c 100644 --- a/compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.kt.txt +++ b/compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.kt.txt @@ -1,6 +1,6 @@ open class A { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -34,7 +34,7 @@ open class A { class B : A { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*A*/() /* InstanceInitializerCall */ } @@ -63,7 +63,7 @@ class B : A { open class GA { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -83,7 +83,7 @@ open class GA { class GB : GA { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*GA*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/types/smartCastOnReceiverOfGenericType.kt.txt b/compiler/testData/ir/irText/types/smartCastOnReceiverOfGenericType.kt.txt index 248bec9ca42..24b145f0ba0 100644 --- a/compiler/testData/ir/irText/types/smartCastOnReceiverOfGenericType.kt.txt +++ b/compiler/testData/ir/irText/types/smartCastOnReceiverOfGenericType.kt.txt @@ -25,7 +25,7 @@ fun testNonSubstitutedTypeParameter(a: Any, b: Any) { class Cell { constructor(value: T) /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } @@ -42,14 +42,14 @@ class Cell { class Outer { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } inner class Inner { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/types/starProjection_OI.kt.txt b/compiler/testData/ir/irText/types/starProjection_OI.kt.txt index 9b36f3fef33..e112139fad3 100644 --- a/compiler/testData/ir/irText/types/starProjection_OI.kt.txt +++ b/compiler/testData/ir/irText/types/starProjection_OI.kt.txt @@ -6,7 +6,7 @@ interface Continuation { abstract class C { constructor() /* primary */ { - TODO("IrDelegatingConstructorCall") + super/*Any*/() /* InstanceInitializerCall */ } From 6e318893f65520e23c0df0cfea4404dbca385fb5 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Fri, 6 Nov 2020 03:24:03 +0300 Subject: [PATCH 140/698] [IR] KotlinLikeDumper: support for IrEnumConstructorCall and better rendering for IrEnumEntry --- .../kotlin/ir/util/KotlinLikeDumper.kt | 276 ++++++++++-------- 1 file changed, 158 insertions(+), 118 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index 9aea6843ac1..feb7ef12dd0 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -11,9 +11,7 @@ import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.ir.types.* -import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid -import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid -import org.jetbrains.kotlin.ir.visitors.acceptVoid +import org.jetbrains.kotlin.ir.visitors.IrElementVisitor import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.types.Variance import org.jetbrains.kotlin.utils.Printer @@ -41,7 +39,7 @@ import org.jetbrains.kotlin.utils.Printer fun IrElement.dumpKotlinLike(options: KotlinLikeDumpOptions = KotlinLikeDumpOptions()): String { val sb = StringBuilder() - acceptVoid(KotlinLikeDumper(Printer(sb, " "), options)) + accept(KotlinLikeDumper(Printer(sb, 1, " "), options), null) return sb.toString() } @@ -78,8 +76,8 @@ enum class FakeOverridesStrategy { NONE } -private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOptions) : IrElementVisitorVoid { - override fun visitElement(element: IrElement) { +private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOptions) : IrElementVisitor { + override fun visitElement(element: IrElement, data: IrDeclaration?) { val e = "/* ERROR: unsupported element type: " + element.javaClass.simpleName + " */" if (element is IrExpression) { // TODO message? @@ -90,11 +88,11 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } } - override fun visitModuleFragment(declaration: IrModuleFragment) { - declaration.acceptChildrenVoid(this) + override fun visitModuleFragment(declaration: IrModuleFragment, data: IrDeclaration?) { + declaration.acceptChildren(this, null) } - override fun visitFile(declaration: IrFile) { + override fun visitFile(declaration: IrFile, data: IrDeclaration?) { if (options.printRegionsPerFile) p.println("//region block: ${declaration.name}") if (options.printFileName) p.println("// FILE: ${declaration.name}") @@ -106,12 +104,12 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } if (!p.isEmpty) p.printlnWithNoIndent() - declaration.declarations.forEach { it.acceptVoid(this) } + declaration.declarations.forEach { it.accept(this, null) } if (options.printRegionsPerFile) p.println("//endregion") } - override fun visitClass(declaration: IrClass) { + override fun visitClass(declaration: IrClass, data: IrDeclaration?) { // TODO omit super class for enums, annotations? // TODO omit Companion name for companion objects? // TODO thisReceiver @@ -169,7 +167,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printlnWithNoIndent(" {") p.pushIndent() - declaration.declarations.forEach { it.acceptVoid(this) } + declaration.declarations.forEach { it.accept(this, declaration) } p.popIndent() p.println("}") @@ -199,7 +197,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption it.defaultValue?.let { v -> p.printWithNoIndent(" = ") - v.acceptVoid(this@KotlinLikeDumper) + v.accept(this@KotlinLikeDumper, this) } } p.printWithNoIndent(")") @@ -265,7 +263,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption private fun IrConstructorCall.printAnAnnotationWithNoIndent(prefix: String = "") { p.printWithNoIndent("@" + (if (prefix.isEmpty()) "" else "$prefix:")) - visitConstructorCall(this) + visitConstructorCall(this, null) } private fun IrAnnotationContainer.printlnAnnotations(prefix: String = "") { @@ -402,7 +400,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p(isData, "data") p(isCompanion, "companion") p(isFunInterface, "fun") - p(classKind) { name.toLowerCase().replace('_', ' ') } + p(classKind) { name.toLowerCase().replace('_', ' ') + if (this == ClassKind.ENUM_ENTRY) " class" else "" } p(isInfix, "infix") p(isOperator, "operator") } @@ -492,13 +490,13 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption printWhereClauseIfNeededWithNoIndent() p.printWithNoIndent(" ") - body?.acceptVoid(this@KotlinLikeDumper) + body?.accept(this@KotlinLikeDumper, null) } else { p.printlnWithNoIndent() } } - override fun visitSimpleFunction(declaration: IrSimpleFunction) { + override fun visitSimpleFunction(declaration: IrSimpleFunction, data: IrDeclaration?) { declaration.printSimpleFunction( "fun ", declaration.name.asString(), @@ -508,7 +506,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printlnWithNoIndent() } - override fun visitConstructor(declaration: IrConstructor) { + override fun visitConstructor(declaration: IrConstructor, data: IrDeclaration?) { // TODO primary!!! // TODO name? // TODO is it worth to merge code for IrConstructor and IrSimpleFunction? @@ -548,11 +546,11 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption declaration.printWhereClauseIfNeededWithNoIndent() p.printWithNoIndent(" ") p(declaration.isPrimary, commentBlockH("primary")) - declaration.body?.acceptVoid(this) + declaration.body?.accept(this, declaration) p.printlnWithNoIndent() } - override fun visitProperty(declaration: IrProperty) { + override fun visitProperty(declaration: IrProperty, data: IrDeclaration?) { if (options.printFakeOverridesStrategy == FakeOverridesStrategy.NONE && declaration.isFakeOverride) return declaration.printlnAnnotations() @@ -623,7 +621,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption // TODO it's not valid kotlin declaration.backingField?.initializer?.let { p.print("field = ") - it.acceptVoid(this) + it.accept(this, declaration) p.printlnWithNoIndent() } @@ -640,7 +638,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption printSimpleFunction("", s, printTypeParametersAndExtensionReceiver = false, printSignatureAndBody = isDefaultAccessor) } - override fun visitField(declaration: IrField) { + override fun visitField(declaration: IrField, data: IrDeclaration?) { declaration.printlnAnnotations() p.print("") @@ -681,7 +679,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption declaration.initializer?.let { p.printWithNoIndent(" = ") - it.acceptVoid(this) + it.accept(this, declaration) } // TODO correspondingPropertySymbol @@ -689,7 +687,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printlnWithNoIndent() } - override fun visitTypeAlias(declaration: IrTypeAlias) { + override fun visitTypeAlias(declaration: IrTypeAlias, data: IrDeclaration?) { declaration.printlnAnnotations() p.print("") @@ -706,7 +704,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printlnWithNoIndent() } - override fun visitVariable(declaration: IrVariable) { + override fun visitVariable(declaration: IrVariable, data: IrDeclaration?) { declaration.printlnAnnotations() p.print("") @@ -716,7 +714,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption declaration.initializer?.let { p.printWithNoIndent(" = ") - it.acceptVoid(this) + it.accept(this, declaration) } } @@ -728,20 +726,26 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption type.printTypeWithNoIndent() } - override fun visitEnumEntry(declaration: IrEnumEntry) { + override fun visitEnumEntry(declaration: IrEnumEntry, data: IrDeclaration?) { + // TODO better rendering for enum entries + + declaration.correspondingClass?.let { p.println() } + declaration.printlnAnnotations() p.print("") - - // TODO correspondingClass p.printWithNoIndent(declaration.name) declaration.initializerExpression?.let { - // TODO better rendering for init - p.printWithNoIndent(" init = ") - it.acceptVoid(this) - } ?: p.printlnWithNoIndent() + p.printWithNoIndent(" = ") + it.accept(this, declaration) + } + p.println() + + declaration.correspondingClass?.accept(this, declaration) + + p.println() } - override fun visitAnonymousInitializer(declaration: IrAnonymousInitializer) { + override fun visitAnonymousInitializer(declaration: IrAnonymousInitializer, data: IrDeclaration?) { // Looks like IrAnonymousInitializer has annotations accidentally. No tests. declaration.printlnAnnotations() p.print("") @@ -749,12 +753,12 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption // TODO looks like there are no irText tests for isStatic flag p(declaration.isStatic, commentBlockH("static")) p.printWithNoIndent("init ") - declaration.body.acceptVoid(this) + declaration.body.accept(this, declaration) p.printlnWithNoIndent() } - override fun visitLocalDelegatedProperty(declaration: IrLocalDelegatedProperty) { + override fun visitLocalDelegatedProperty(declaration: IrLocalDelegatedProperty, data: IrDeclaration?) { declaration.printlnAnnotations() p.print("") @@ -764,7 +768,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printlnWithNoIndent() p.pushIndent() - declaration.delegate.acceptVoid(this) + declaration.delegate.accept(this, declaration) p.printlnWithNoIndent() declaration.getter.printAccessor("get") @@ -774,36 +778,41 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printlnWithNoIndent() } - override fun visitExpressionBody(body: IrExpressionBody) { + override fun visitExpressionBody(body: IrExpressionBody, data: IrDeclaration?) { // TODO should we print something here? - body.expression.acceptVoid(this) + body.expression.accept(this, data) } - override fun visitBlockBody(body: IrBlockBody) { - body.printStatementContainer("{", "}") + override fun visitBlockBody(body: IrBlockBody, data: IrDeclaration?) { + body.printStatementContainer("{", "}", data) p.printlnWithNoIndent() } - override fun visitComposite(expression: IrComposite) { - expression.printStatementContainer("// COMPOSITE {", "// }", withIndentation = false) + override fun visitComposite(expression: IrComposite, data: IrDeclaration?) { + expression.printStatementContainer("// COMPOSITE {", "// }", data, withIndentation = false) } - override fun visitBlock(expression: IrBlock) { + override fun visitBlock(expression: IrBlock, data: IrDeclaration?) { // TODO special blocks using `origin` // TODO inlineFunctionSymbol for IrReturnableBlock // TODO no tests for IrReturnableBlock? val kind = if (expression is IrReturnableBlock) "RETURNABLE BLOCK" else "BLOCK" - expression.printStatementContainer("{ // $kind", "}") + expression.printStatementContainer("{ // $kind", "}", data) } - private fun IrStatementContainer.printStatementContainer(before: String, after: String, withIndentation: Boolean = true) { + private fun IrStatementContainer.printStatementContainer( + before: String, + after: String, + data: IrDeclaration?, + withIndentation: Boolean = true + ) { // TODO type for IrContainerExpression p.printlnWithNoIndent(before) if (withIndentation) p.pushIndent() statements.forEach { if (it is IrExpression) p.printIndent() - it.acceptVoid(this@KotlinLikeDumper) + it.accept(this@KotlinLikeDumper, data) p.printlnWithNoIndent() } @@ -811,33 +820,73 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.print(after) } - override fun visitSyntheticBody(body: IrSyntheticBody) { + override fun visitSyntheticBody(body: IrSyntheticBody, data: IrDeclaration?) { p.printlnWithNoIndent("/* Synthetic body for ${body.kind} */") } - override fun visitCall(expression: IrCall) { + override fun visitCall(expression: IrCall, data: IrDeclaration?) { // TODO process specially builtin symbols expression.printIrFunctionAccessExpressionWithNoIndent( - expression.symbol.owner.name, + expression.symbol.owner.name.asString(), superQualifierSymbol = expression.superQualifierSymbol, - omitBracesIfNoArguments = false + omitBracesIfNoArguments = false, + data ) } - override fun visitConstructorCall(expression: IrConstructorCall) { + override fun visitConstructorCall(expression: IrConstructorCall, data: IrDeclaration?) { // TODO could constructors have receiver? val clazz = expression.symbol.owner.parentAsClass expression.printIrFunctionAccessExpressionWithNoIndent( - clazz.name, + clazz.name.asString(), superQualifierSymbol = null, - omitBracesIfNoArguments = clazz.isAnnotationClass + omitBracesIfNoArguments = clazz.isAnnotationClass, + data + ) + } + + override fun visitDelegatingConstructorCall(expression: IrDelegatingConstructorCall, data: IrDeclaration?) { + // TODO skip Any? + // TODO flag to omit comment block? + val delegatingClass = expression.symbol.owner.parentAsClass + val currentClass = data?.parentAsClass + val delegatingClassName = delegatingClass.name.asString() + val name = when (currentClass) { + null -> "delegating/*$delegatingClassName*/" + delegatingClass -> "this/*$delegatingClassName*/" + else -> "super/*$delegatingClassName*/" + } + expression.printIrFunctionAccessExpressionWithNoIndent( + name, + superQualifierSymbol = null, + omitBracesIfNoArguments = false, + data + ) + } + + override fun visitEnumConstructorCall(expression: IrEnumConstructorCall, data: IrDeclaration?) { + val delegatingClass = expression.symbol.owner.parentAsClass + val currentClass = data?.parentAsClass + val delegatingClassName = delegatingClass.name.asString() + val name = when { + data !is IrConstructor -> delegatingClassName + currentClass == null -> "delegating/*$delegatingClassName*/" + currentClass == delegatingClass -> "this/*$delegatingClassName*/" + else -> "super/*$delegatingClassName*/" + } + expression.printIrFunctionAccessExpressionWithNoIndent( + name, + superQualifierSymbol = null, + omitBracesIfNoArguments = false, + data ) } private fun IrFunctionAccessExpression.printIrFunctionAccessExpressionWithNoIndent( - name: Name, + name: String, superQualifierSymbol: IrClassSymbol?, - omitBracesIfNoArguments: Boolean + omitBracesIfNoArguments: Boolean, + data: IrDeclaration? ) { // TODO origin @@ -850,17 +899,18 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption superQualifierSymbol?.let { // TODO should we print super classifier somehow? + // TODO which supper? smart mode? p.printWithNoIndent("super") } dispatchReceiver?.let { - if (superQualifierSymbol == null) it.acceptVoid(this@KotlinLikeDumper) + if (superQualifierSymbol == null) it.accept(this@KotlinLikeDumper, data) // else assert dispatchReceiver === this } if (twoReceivers) { p.printWithNoIndent(", ") } - extensionReceiver?.acceptVoid(this@KotlinLikeDumper) + extensionReceiver?.accept(this@KotlinLikeDumper, data) if (twoReceivers) { p.printWithNoIndent(")") } @@ -873,7 +923,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption // what if it's unbound val declaration = symbol.owner - p.printWithNoIndent(name.asString()) + p.printWithNoIndent(name) if (typeArgumentsCount > 0) { p.printWithNoIndent("<") @@ -904,24 +954,14 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption if (i > 0) p.printWithNoIndent(", ") // TODO flag to print param name p.printWithNoIndent(declaration.valueParameters[i].name.asString() + " = ") - it.acceptVoid(this@KotlinLikeDumper) + it.accept(this@KotlinLikeDumper, data) } } p.printWithNoIndent(")") } - override fun visitDelegatingConstructorCall(expression: IrDelegatingConstructorCall) { - // TODO - p.printWithNoIndent("TODO(\"IrDelegatingConstructorCall\")") - } - - override fun visitEnumConstructorCall(expression: IrEnumConstructorCall) { - // TODO - p.printWithNoIndent("TODO(\"IrEnumConstructorCall\")") - } - - override fun visitFunctionExpression(expression: IrFunctionExpression) { + override fun visitFunctionExpression(expression: IrFunctionExpression, data: IrDeclaration?) { // TODO support // TODO omit the name when it's possible // TODO Is there a difference between `` and ``? @@ -932,14 +972,14 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption expression.function.printSimpleFunction("fun ", expression.function.name.asString(), printTypeParametersAndExtensionReceiver = true, printSignatureAndBody = true) } - override fun visitGetField(expression: IrGetField) { + override fun visitGetField(expression: IrGetField, data: IrDeclaration?) { expression.printFieldAccess() } - override fun visitSetField(expression: IrSetField) { + override fun visitSetField(expression: IrSetField, data: IrDeclaration?) { expression.printFieldAccess() p.printWithNoIndent(" = ") - expression.value.acceptVoid(this) + expression.value.accept(this, data) } private fun IrFieldAccessExpression.printFieldAccess() { @@ -948,27 +988,27 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printWithNoIndent("#" + symbol.owner.name.asString()) } - override fun visitReturn(expression: IrReturn) { + override fun visitReturn(expression: IrReturn, data: IrDeclaration?) { p.printWithNoIndent("return ") - expression.value.acceptVoid(this) + expression.value.accept(this, data) } - override fun visitThrow(expression: IrThrow) { + override fun visitThrow(expression: IrThrow, data: IrDeclaration?) { p.printWithNoIndent("throw ") - expression.value.acceptVoid(this) + expression.value.accept(this, data) } - override fun visitStringConcatenation(expression: IrStringConcatenation) { + override fun visitStringConcatenation(expression: IrStringConcatenation, data: IrDeclaration?) { // TODO escape? see IrTextTestCaseGenerated.Expressions#testStringTemplates expression.arguments.forEachIndexed { i, e -> if (i > 0) { p.printlnWithNoIndent(" + ") } - e.acceptVoid(this) + e.accept(this, data) } } - override fun visitConst(expression: IrConst) { + override fun visitConst(expression: IrConst, data: IrDeclaration?) { val kind = expression.kind val (prefix, postfix) = when (kind) { @@ -987,62 +1027,62 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printWithNoIndent(prefix, expression.value ?: "null", postfix) } - override fun visitVararg(expression: IrVararg) { + override fun visitVararg(expression: IrVararg, data: IrDeclaration?) { // TODO ??? p.printWithNoIndent("[") expression.elements.forEachIndexed { i, e -> if (i > 0) p.printWithNoIndent(", ") - e.acceptVoid(this) + e.accept(this, data) } p.printWithNoIndent("]") } - override fun visitSpreadElement(spread: IrSpreadElement) { + override fun visitSpreadElement(spread: IrSpreadElement, data: IrDeclaration?) { p.printWithNoIndent("*") - spread.expression.acceptVoid(this) + spread.expression.accept(this, data) } - override fun visitDeclarationReference(expression: IrDeclarationReference) { - super.visitDeclarationReference(expression) + override fun visitDeclarationReference(expression: IrDeclarationReference, data: IrDeclaration?) { + super.visitDeclarationReference(expression, data) } - override fun visitSingletonReference(expression: IrGetSingletonValue) { + override fun visitSingletonReference(expression: IrGetSingletonValue, data: IrDeclaration?) { // TODO check expression.type.printTypeWithNoIndent() } - override fun visitGetValue(expression: IrGetValue) { + override fun visitGetValue(expression: IrGetValue, data: IrDeclaration?) { // TODO support `this` and receiver p.printWithNoIndent(expression.symbol.owner.name.asString()) } - override fun visitSetValue(expression: IrSetValue) { + override fun visitSetValue(expression: IrSetValue, data: IrDeclaration?) { p.printWithNoIndent(expression.symbol.owner.name.asString() + " = ") - expression.value.acceptVoid(this) + expression.value.accept(this, data) } - override fun visitGetClass(expression: IrGetClass) { - expression.argument.acceptVoid(this) + override fun visitGetClass(expression: IrGetClass, data: IrDeclaration?) { + expression.argument.accept(this, data) p.printWithNoIndent("::class") } - override fun visitCallableReference(expression: IrCallableReference<*>) { + override fun visitCallableReference(expression: IrCallableReference<*>, data: IrDeclaration?) { // TODO check p.printWithNoIndent("::") p.printWithNoIndent(expression.referencedName.asString()) } - override fun visitClassReference(expression: IrClassReference) { + override fun visitClassReference(expression: IrClassReference, data: IrDeclaration?) { // TODO use type p.printWithNoIndent((expression.symbol.owner as IrDeclarationWithName).name.asString()) p.printWithNoIndent("::class") } - override fun visitInstanceInitializerCall(expression: IrInstanceInitializerCall) { + override fun visitInstanceInitializerCall(expression: IrInstanceInitializerCall, data: IrDeclaration?) { p.println("/* InstanceInitializerCall */") } - override fun visitTypeOperator(expression: IrTypeOperatorCall) { + override fun visitTypeOperator(expression: IrTypeOperatorCall, data: IrDeclaration?) { val (operator, after) = when (expression.operator) { IrTypeOperator.CAST -> "as" to "" IrTypeOperator.IMPLICIT_CAST -> "/*as" to " */" @@ -1057,24 +1097,24 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption IrTypeOperator.REINTERPRET_CAST -> "/*=>" to " */" } - expression.argument.acceptVoid(this) + expression.argument.accept(this, data) p.printWithNoIndent(" $operator ") expression.typeOperand.printTypeWithNoIndent() p.printWithNoIndent(after) } - override fun visitWhen(expression: IrWhen) { + override fun visitWhen(expression: IrWhen, data: IrDeclaration?) { p.printlnWithNoIndent("when {") p.pushIndent() for (b in expression.branches) { p.printIndent() - b.condition.acceptVoid(this) + b.condition.accept(this, data) p.printWithNoIndent(" -> ") - b.result.acceptVoid(this) + b.result.accept(this, data) p.println() } @@ -1083,65 +1123,65 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.print("}") } - override fun visitWhileLoop(loop: IrWhileLoop) { + override fun visitWhileLoop(loop: IrWhileLoop, data: IrDeclaration?) { p.printWithNoIndent("while (") - loop.condition.acceptVoid(this) + loop.condition.accept(this, data) p.printWithNoIndent(") ") - loop.body?.acceptVoid(this) + loop.body?.accept(this, data) } - override fun visitDoWhileLoop(loop: IrDoWhileLoop) { + override fun visitDoWhileLoop(loop: IrDoWhileLoop, data: IrDeclaration?) { p.printWithNoIndent("do") - loop.body?.acceptVoid(this) + loop.body?.accept(this, data) p.print("while (") - loop.condition.acceptVoid(this) + loop.condition.accept(this, data) p.printWithNoIndent(")") } - override fun visitTry(aTry: IrTry) { + override fun visitTry(aTry: IrTry, data: IrDeclaration?) { p.printWithNoIndent("try ") - aTry.tryResult.acceptVoid(this) + aTry.tryResult.accept(this, data) p.printlnWithNoIndent() - aTry.catches.forEach { it.acceptVoid(this) } + aTry.catches.forEach { it.accept(this, data) } aTry.finallyExpression?.let { p.print("finally ") - it.acceptVoid(this) + it.accept(this, data) } } - override fun visitCatch(aCatch: IrCatch) { + override fun visitCatch(aCatch: IrCatch, data: IrDeclaration?) { p.print("catch (...) ") - aCatch.result.acceptVoid(this) + aCatch.result.accept(this, data) p.printlnWithNoIndent() } - override fun visitBreak(jump: IrBreak) { + override fun visitBreak(jump: IrBreak, data: IrDeclaration?) { // TODO label p.printWithNoIndent("break") } - override fun visitContinue(jump: IrContinue) { + override fun visitContinue(jump: IrContinue, data: IrDeclaration?) { // TODO label p.printWithNoIndent("continue") } - override fun visitErrorDeclaration(declaration: IrErrorDeclaration) { + override fun visitErrorDeclaration(declaration: IrErrorDeclaration, data: IrDeclaration?) { p.println("/* ERROR DECLARATION */") } - override fun visitErrorExpression(expression: IrErrorExpression) { + override fun visitErrorExpression(expression: IrErrorExpression, data: IrDeclaration?) { // TODO description p.printWithNoIndent("error(\"\") /* ERROR EXPRESSION */") } - override fun visitErrorCallExpression(expression: IrErrorCallExpression) { + override fun visitErrorCallExpression(expression: IrErrorCallExpression, data: IrDeclaration?) { // TODO receiver, arguments p.printWithNoIndent("error(\"\") /* ERROR CALL */") } From 602f0ddbc86e26220175e7624779371bc6ca4354 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Fri, 6 Nov 2020 02:47:33 +0300 Subject: [PATCH 141/698] [IR] update testdata after using maxBlankLines=1 for Printer --- .../ir/irText/classes/abstractMembers.kt.txt | 6 -- .../irText/classes/annotationClasses.kt.txt | 12 --- ...orderingInDelegatingConstructorCall.kt.txt | 9 -- .../ir/irText/classes/classMembers.kt.txt | 12 --- .../testData/ir/irText/classes/classes.kt.txt | 17 ---- .../ir/irText/classes/cloneable.kt.txt | 14 --- .../ir/irText/classes/companionObject.kt.txt | 12 --- .../delegatedGenericImplementation.kt.txt | 9 -- .../classes/delegatedImplementation.kt.txt | 18 ---- ...egatedImplementationOfJavaInterface.kt.txt | 3 - ...dImplementationWithExplicitOverride.kt.txt | 8 -- ...nstructorCallToTypeAliasConstructor.kt.txt | 9 -- ...tructorCallsInSecondaryConstructors.kt.txt | 6 -- .../testData/ir/irText/classes/enum.kt.txt | 32 ------- .../irText/classes/enumClassModality.kt.txt | 43 --------- .../classes/enumWithMultipleCtors.kt.txt | 7 -- .../classes/enumWithSecondaryCtor.kt.txt | 20 ----- .../fakeOverridesForJavaStaticMembers.kt.txt | 5 -- ...citNotNullOnDelegatedImplementation.kt.txt | 31 ------- .../ir/irText/classes/initBlock.kt.txt | 18 ---- .../testData/ir/irText/classes/initVal.kt.txt | 9 -- .../ir/irText/classes/initValInLambda.kt.txt | 3 - .../testData/ir/irText/classes/initVar.kt.txt | 18 ---- .../inlineClassSyntheticMethods.kt.txt | 2 - .../ir/irText/classes/innerClass.kt.txt | 9 -- ...innerClassWithDelegatingConstructor.kt.txt | 6 -- .../lambdaInDataClassDefaultParameter.kt.txt | 4 - .../ir/irText/classes/localClasses.kt.txt | 4 - .../classes/objectLiteralExpressions.kt.txt | 25 ------ .../classes/objectWithInitializers.kt.txt | 6 -- .../ir/irText/classes/outerClassAccess.kt.txt | 9 -- .../irText/classes/primaryConstructor.kt.txt | 9 -- ...ConstructorWithSuperConstructorCall.kt.txt | 12 --- .../irText/classes/qualifiedSuperCalls.kt.txt | 9 -- .../ir/irText/classes/sealedClasses.kt.txt | 12 --- ...ructorWithInitializersFromClassBody.kt.txt | 9 -- .../classes/secondaryConstructors.kt.txt | 3 - .../ir/irText/classes/superCalls.kt.txt | 5 -- .../irText/classes/superCallsComposed.kt.txt | 9 -- .../annotationsInAnnotationArguments.kt.txt | 9 -- .../annotationsOnDelegatedMembers.kt.txt | 7 -- ...notationsWithDefaultParameterValues.kt.txt | 3 - .../annotationsWithVarargParameters.kt.txt | 3 - .../arrayInAnnotationArguments.kt.txt | 6 -- .../classLiteralInAnnotation.kt.txt | 6 -- .../annotations/classesWithAnnotations.kt.txt | 26 ------ ...nstExpressionsInAnnotationArguments.kt.txt | 3 - .../constructorsWithAnnotations.kt.txt | 6 -- .../delegateFieldWithAnnotations.kt.txt | 2 - ...tedPropertyAccessorsWithAnnotations.kt.txt | 6 -- .../enumEntriesWithAnnotations.kt.txt | 8 -- .../enumsInAnnotationArguments.kt.txt | 8 -- .../annotations/fieldsWithAnnotations.kt.txt | 3 - .../annotations/fileAnnotations.kt.txt | 3 - .../functionsWithAnnotations.kt.txt | 3 - ...lDelegatedPropertiesWithAnnotations.kt.txt | 4 - ...multipleAnnotationsInSquareBrackets.kt.txt | 6 -- ...ConstructorParameterWithAnnotations.kt.txt | 5 -- .../propertiesWithAnnotations.kt.txt | 3 - ...ssorsFromClassHeaderWithAnnotations.kt.txt | 6 -- .../propertyAccessorsWithAnnotations.kt.txt | 3 - ...pertySetterParameterWithAnnotations.kt.txt | 5 -- .../receiverParameterWithAnnotations.kt.txt | 5 -- ...spreadOperatorInAnnotationArguments.kt.txt | 3 - .../typeAliasesWithAnnotations.kt.txt | 3 - .../typeParametersWithAnnotations.kt.txt | 2 - .../valueParametersWithAnnotations.kt.txt | 6 -- .../varargsInAnnotationArguments.kt.txt | 9 -- .../variablesWithAnnotations.kt.txt | 3 - .../declarations/classLevelProperties.kt.txt | 3 - .../declarations/defaultArguments.kt.txt | 1 - .../declarations/delegatedProperties.kt.txt | 3 - .../declarations/extensionProperties.kt.txt | 3 - .../irText/declarations/fakeOverrides.kt.txt | 12 --- .../genericDelegatedProperty.kt.txt | 6 -- .../declarations/interfaceProperties.kt.txt | 3 - .../ir/irText/declarations/kt29833.kt.txt | 3 - .../ir/irText/declarations/kt35550.kt.txt | 6 -- .../localClassWithOverrides.kt.txt | 8 -- .../localDelegatedProperties.kt.txt | 2 - .../multiplatform/expectClassInherited.kt.txt | 9 -- .../multiplatform/expectedEnumClass.kt.txt | 11 --- .../multiplatform/expectedSealedClass.kt.txt | 10 --- .../declarations/parameters/class.kt.txt | 14 --- .../parameters/constructor.kt.txt | 15 ---- .../defaultPropertyAccessors.kt.txt | 6 -- .../parameters/delegatedMembers.kt.txt | 5 -- .../irText/declarations/parameters/fun.kt.txt | 3 - .../parameters/genericInnerClass.kt.txt | 6 -- .../declarations/parameters/localFun.kt.txt | 4 - .../parameters/propertyAccessors.kt.txt | 3 - .../typeParameterBeforeBound.kt.txt | 3 - .../typeParameterBoundedBySubclass.kt.txt | 13 --- .../primaryCtorDefaultArguments.kt.txt | 3 - .../declarations/primaryCtorProperties.kt.txt | 3 - .../provideDelegate/differentReceivers.kt.txt | 3 - .../declarations/provideDelegate/local.kt.txt | 7 -- .../localDifferentReceivers.kt.txt | 5 -- .../provideDelegate/member.kt.txt | 9 -- .../provideDelegate/memberExtension.kt.txt | 6 -- .../provideDelegate/topLevel.kt.txt | 6 -- .../ir/irText/declarations/typeAlias.kt.txt | 2 - .../errors/suppressedNonPublicCall.kt.txt | 3 - .../arrayAugmentedAssignment1.kt.txt | 3 - .../arrayAugmentedAssignment2.kt.txt | 4 - .../ir/irText/expressions/assignments.kt.txt | 3 - .../expressions/augmentedAssignment2.kt.txt | 3 - .../augmentedAssignmentWithExpression.kt.txt | 3 - .../boundCallableReferences.kt.txt | 3 - .../adaptedExtensionFunctions.kt.txt | 3 - .../boundInlineAdaptedReference.kt.txt | 1 - .../boundInnerGenericConstructor.kt.txt | 6 -- .../caoWithAdaptationForSam.kt.txt | 11 --- .../constructorWithAdaptedArguments.kt.txt | 11 --- ...ithDefaultParametersAsKCallableStar.kt.txt | 3 - .../callableReferences/genericMember.kt.txt | 3 - .../importedFromObject.kt.txt | 3 - .../callableReferences/kt37131.kt.txt | 3 - .../suspendConversion.kt.txt | 4 - .../callableReferences/typeArguments.kt.txt | 3 - ...MemberReferenceWithAdaptedArguments.kt.txt | 8 -- .../withAdaptationForSam.kt.txt | 2 - .../withAdaptedArguments.kt.txt | 4 - .../withArgumentAdaptationAndReceiver.kt.txt | 8 -- .../expressions/castToTypeParameter.kt.txt | 3 - .../expressions/chainOfSafeCalls.kt.txt | 3 - .../irText/expressions/classReference.kt.txt | 3 - .../complexAugmentedAssignment.kt.txt | 15 ---- ...onstructorWithOwnTypeParametersCall.kt.txt | 6 -- .../irText/expressions/contructorCall.kt.txt | 3 - .../expressions/conventionComparisons.kt.txt | 4 - .../irText/expressions/destructuring1.kt.txt | 6 -- .../destructuringWithUnderscore.kt.txt | 6 -- .../expressions/enumEntryAsReceiver.kt.txt | 7 -- ...numEntryReferenceFromEnumEntryClass.kt.txt | 5 -- .../exhaustiveWhenElseBranch.kt.txt | 5 -- ...ameterWithPrimitiveNumericSupertype.kt.txt | 3 - .../forWithImplicitReceivers.kt.txt | 9 -- .../expressions/funImportedFromObject.kt.txt | 3 - .../arrayAsVarargAfterSamArgument_fi.kt.txt | 2 - .../basicFunInterfaceConversion.kt.txt | 2 - .../funInterface/castFromAny.kt.txt | 2 - .../funInterface/partialSam.kt.txt | 13 --- .../samConversionInVarargs.kt.txt | 2 - .../samConversionInVarargsMixed.kt.txt | 2 - .../samConversionOnCallableReference.kt.txt | 2 - .../samConversionsWithSmartCasts.kt.txt | 2 - ...ricConstructorCallWithTypeArguments.kt.txt | 3 - .../expressions/genericPropertyRef.kt.txt | 6 -- ...implicitCastInReturnFromConstructor.kt.txt | 3 - .../implicitCastToTypeParameter.kt.txt | 5 -- .../expressions/interfaceThisRef.kt.txt | 3 - .../jvmFieldWithIntersectionTypes.kt.txt | 17 ---- .../jvmInstanceFieldReference.kt.txt | 3 - .../jvmStaticFieldReference.kt.txt | 3 - .../ir/irText/expressions/kt16904.kt.txt | 12 --- .../ir/irText/expressions/kt16905.kt.txt | 12 --- .../ir/irText/expressions/kt23030.kt.txt | 3 - .../ir/irText/expressions/kt28456.kt.txt | 3 - .../ir/irText/expressions/kt28456a.kt.txt | 3 - .../ir/irText/expressions/kt28456b.kt.txt | 3 - .../ir/irText/expressions/kt30020.kt.txt | 28 ------ .../ir/irText/expressions/kt35730.kt.txt | 7 -- .../ir/irText/expressions/kt36956.kt.txt | 3 - .../ir/irText/expressions/kt37570.kt.txt | 3 - .../expressions/memberTypeArguments.kt.txt | 3 - .../membersImportedFromObject.kt.txt | 3 - .../expressions/multipleThisReferences.kt.txt | 13 --- .../expressions/objectAsCallable.kt.txt | 8 -- .../expressions/objectClassReference.kt.txt | 3 - .../irText/expressions/objectReference.kt.txt | 10 --- ...enceInClosureInSuperConstructorCall.kt.txt | 6 -- .../objectReferenceInFieldInitializer.kt.txt | 3 - .../outerClassInstanceReference.kt.txt | 6 -- .../primitivesImplicitConversions.kt.txt | 3 - .../expressions/propertyReferences.kt.txt | 6 -- .../expressions/reflectionLiterals.kt.txt | 3 - .../irText/expressions/safeAssignment.kt.txt | 3 - .../safeCallWithIncrementDecrement.kt.txt | 3 - .../ir/irText/expressions/safeCalls.kt.txt | 6 -- ...nversionInGenericConstructorCall_NI.kt.txt | 6 -- .../setFieldWithImplicitCast.kt.txt | 3 - ...nedToUnsignedConversions_annotation.kt.txt | 2 - .../smartCastsWithDestructuring.kt.txt | 4 - ...specializedTypeAliasConstructorCall.kt.txt | 3 - ...pendConversionOnArbitraryExpression.kt.txt | 15 ---- .../temporaryInEnumEntryInitializer.kt.txt | 5 -- .../expressions/temporaryInInitBlock.kt.txt | 3 - .../thisOfGenericOuterClass.kt.txt | 10 --- ...oObjectInNestedClassConstructorCall.kt.txt | 12 --- .../thisReferenceBeforeClassDeclared.kt.txt | 14 --- .../typeAliasConstructorReference.kt.txt | 9 -- .../irText/expressions/typeOperators.kt.txt | 2 - .../typeParameterClassLiteral.kt.txt | 3 - .../expressions/useImportedMember.kt.txt | 11 --- .../ir/irText/expressions/values.kt.txt | 14 --- .../ir/irText/expressions/when.kt.txt | 3 - .../firProblems/AbstractMutableMap.kt.txt | 22 ----- .../irText/firProblems/AllCandidates.kt.txt | 6 -- .../firProblems/AnnotationInAnnotation.kt.txt | 9 -- .../irText/firProblems/BaseFirBuilder.kt.txt | 3 - .../ClashResolutionDescriptor.kt.txt | 12 --- .../irText/firProblems/DeepCopyIrTree.kt.txt | 17 ---- .../DelegationAndInheritanceFromJava.kt.txt | 3 - .../firProblems/InnerClassInAnonymous.kt.txt | 10 --- .../ir/irText/firProblems/MultiList.kt.txt | 88 ------------------- .../irText/firProblems/SignatureClash.kt.txt | 10 --- .../ir/irText/firProblems/VarInInit.kt.txt | 3 - .../irText/firProblems/candidateSymbol.kt.txt | 14 --- .../ir/irText/firProblems/putIfAbsent.kt.txt | 3 - .../irText/firProblems/v8arrayToList.kt.txt | 3 - .../ir/irText/lambdas/localFunction.kt.txt | 1 - .../lambdas/multipleImplicitReceivers.kt.txt | 12 --- .../regressions/integerCoercionToT.kt.txt | 8 -- .../newInference/fixationOrder1.kt.txt | 2 - .../typeAliasCtorForGenericClass.kt.txt | 3 - .../ir/irText/singletons/companion.kt.txt | 6 -- .../ir/irText/singletons/enumEntry.kt.txt | 5 -- .../ir/irText/singletons/object.kt.txt | 6 -- .../genericClassInDifferentModule_m1.kt.txt | 3 - .../ir/irText/stubs/javaInnerClass.kt.txt | 4 - .../castsInsideCoroutineInference.kt.txt | 20 ----- .../types/genericDelegatedDeepProperty.kt.txt | 27 ------ .../ir/irText/types/genericFunWithStar.kt.txt | 11 --- .../types/genericPropertyReferenceType.kt.txt | 3 - .../inStarProjectionInReceiverType.kt.txt | 2 - .../irText/types/intersectionType1_NI.kt.txt | 3 - .../irText/types/intersectionType1_OI.kt.txt | 3 - .../irText/types/intersectionType2_NI.kt.txt | 10 --- .../irText/types/intersectionType2_OI.kt.txt | 10 --- .../irText/types/intersectionType3_NI.kt.txt | 14 --- .../irText/types/intersectionType3_OI.kt.txt | 14 --- .../ir/irText/types/javaWildcardType.kt.txt | 5 -- .../localVariableOfIntersectionType_NI.kt.txt | 11 --- ...ullabilityInDestructuringAssignment.kt.txt | 6 -- .../enhancedNullabilityInForLoop.kt.txt | 2 - .../implicitNotNullOnPlatformType.kt.txt | 3 - ...abilityAssertionOnExtensionReceiver.kt.txt | 3 - .../ir/irText/types/rawTypeInSignature.kt.txt | 12 --- .../types/receiverOfIntersectionType.kt.txt | 12 --- .../smartCastOnFakeOverrideReceiver.kt.txt | 16 ---- .../smartCastOnReceiverOfGenericType.kt.txt | 9 -- .../ir/irText/types/starProjection_OI.kt.txt | 4 - 243 files changed, 1789 deletions(-) diff --git a/compiler/testData/ir/irText/classes/abstractMembers.kt.txt b/compiler/testData/ir/irText/classes/abstractMembers.kt.txt index 143d28ef1ab..27b5b6c4a34 100644 --- a/compiler/testData/ir/irText/classes/abstractMembers.kt.txt +++ b/compiler/testData/ir/irText/classes/abstractMembers.kt.txt @@ -13,9 +13,6 @@ abstract class AbstractClass { abstract get abstract set - - - } interface Interface { @@ -27,8 +24,5 @@ interface Interface { abstract get abstract set - - - } diff --git a/compiler/testData/ir/irText/classes/annotationClasses.kt.txt b/compiler/testData/ir/irText/classes/annotationClasses.kt.txt index bbf1dc063fe..a9ac442c399 100644 --- a/compiler/testData/ir/irText/classes/annotationClasses.kt.txt +++ b/compiler/testData/ir/irText/classes/annotationClasses.kt.txt @@ -4,9 +4,6 @@ annotation class Test1 : Annotation { field = x get - - - } annotation class Test2 : Annotation { @@ -15,9 +12,6 @@ annotation class Test2 : Annotation { field = x get - - - } annotation class Test3 : Annotation { @@ -26,9 +20,6 @@ annotation class Test3 : Annotation { field = x get - - - } annotation class Test4 : Annotation { @@ -37,8 +28,5 @@ annotation class Test4 : Annotation { field = xs get - - - } diff --git a/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.kt.txt b/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.kt.txt index 74eba17f982..efcaa40dc09 100644 --- a/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.kt.txt +++ b/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.kt.txt @@ -13,9 +13,6 @@ open class Base { field = y get - - - } class Test1 : Base { @@ -27,9 +24,6 @@ class Test1 : Base { } - - - } class Test2 : Base { @@ -47,8 +41,5 @@ class Test2 : Base { } } - - - } diff --git a/compiler/testData/ir/irText/classes/classMembers.kt.txt b/compiler/testData/ir/irText/classes/classMembers.kt.txt index a482088386c..d3b527f9bd1 100644 --- a/compiler/testData/ir/irText/classes/classMembers.kt.txt +++ b/compiler/testData/ir/irText/classes/classMembers.kt.txt @@ -58,9 +58,6 @@ class C { println(message = "4") } - - - } interface NestedInterface { @@ -69,9 +66,6 @@ class C { return .foo() } - - - } companion object Companion { @@ -81,13 +75,7 @@ class C { } - - - } - - - } diff --git a/compiler/testData/ir/irText/classes/classes.kt.txt b/compiler/testData/ir/irText/classes/classes.kt.txt index 414581b0b90..e1e793454e9 100644 --- a/compiler/testData/ir/irText/classes/classes.kt.txt +++ b/compiler/testData/ir/irText/classes/classes.kt.txt @@ -5,15 +5,10 @@ class TestClass { } - - - } interface TestInterface { - - } object TestObject { @@ -23,16 +18,11 @@ object TestObject { } - - - } annotation class TestAnnotationClass : Annotation { constructor() /* primary */ - - } enum class TestEnumClass : Enum { @@ -42,13 +32,6 @@ enum class TestEnumClass : Enum { } - - - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): TestEnumClass /* Synthetic body for ENUM_VALUEOF */ diff --git a/compiler/testData/ir/irText/classes/cloneable.kt.txt b/compiler/testData/ir/irText/classes/cloneable.kt.txt index 101ed36605e..54414875278 100644 --- a/compiler/testData/ir/irText/classes/cloneable.kt.txt +++ b/compiler/testData/ir/irText/classes/cloneable.kt.txt @@ -5,17 +5,10 @@ class A : Cloneable { } - - - - } interface I : Cloneable { - - - } class C : I { @@ -25,10 +18,6 @@ class C : I { } - - - - } class OC : I { @@ -42,8 +31,5 @@ class OC : I { return OC() } - - - } diff --git a/compiler/testData/ir/irText/classes/companionObject.kt.txt b/compiler/testData/ir/irText/classes/companionObject.kt.txt index 47159f84152..d98863848f0 100644 --- a/compiler/testData/ir/irText/classes/companionObject.kt.txt +++ b/compiler/testData/ir/irText/classes/companionObject.kt.txt @@ -12,14 +12,8 @@ class Test1 { } - - - } - - - } class Test2 { @@ -36,13 +30,7 @@ class Test2 { } - - - } - - - } diff --git a/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt b/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt index 9dd35f4c4ee..a69d0ad3620 100644 --- a/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt @@ -7,9 +7,6 @@ interface IBase { abstract get abstract set - - - } class Test1 : IBase { @@ -37,9 +34,6 @@ class Test1 : IBase { (#$$delegate_0, ).( = ) } - - - } class Test2 : IBase { @@ -72,8 +66,5 @@ class Test2 : IBase { (#$$delegate_0, ).( = ) } - - - } diff --git a/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt index 64aa130d592..eb5f33ee9e0 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt @@ -3,8 +3,6 @@ interface IBase { abstract fun bar(): Int abstract fun String.qux() - - } object BaseImpl : IBase { @@ -24,9 +22,6 @@ object BaseImpl : IBase { override fun String.qux() { } - - - } interface IOther { @@ -44,9 +39,6 @@ interface IOther { abstract get abstract set - - - } fun otherImpl(x0: String, y0: Int): IOther { @@ -79,12 +71,8 @@ fun otherImpl(x0: String, y0: Int): IOther { override set(value: Int) { } - - - } - () } } @@ -109,9 +97,6 @@ class Test1 : IBase { (#$$delegate_0, ).qux() } - - - } class Test2 : IBase, IOther { @@ -161,8 +146,5 @@ class Test2 : IBase, IOther { #$$delegate_1.( = ) } - - - } diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt index 14ec7f7f664..e3903ec27f5 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt @@ -35,8 +35,5 @@ class Test : J { #j.takeNullable(x = x) } - - - } diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt index ce63aa83b35..8f49add819e 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt @@ -2,8 +2,6 @@ interface IFooBar { abstract fun foo() abstract fun bar() - - } object FooBarImpl : IFooBar { @@ -19,9 +17,6 @@ object FooBarImpl : IFooBar { override fun bar() { } - - - } class C : IFooBar { @@ -39,8 +34,5 @@ class C : IFooBar { override fun bar() { } - - - } diff --git a/compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.kt.txt b/compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.kt.txt index c4b1ef7e9cd..e22727b3a35 100644 --- a/compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.kt.txt @@ -9,9 +9,6 @@ open class Cell { field = value get - - - } typealias CT = Cell @@ -23,9 +20,6 @@ class C1 : Cell { } - - - } class C2 : Cell { @@ -35,8 +29,5 @@ class C2 : Cell { } - - - } diff --git a/compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.kt.txt b/compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.kt.txt index 1057ab5bf15..0283ae6dc8b 100644 --- a/compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.kt.txt @@ -5,9 +5,6 @@ open class Base { } - - - } class Test : Base { @@ -27,8 +24,5 @@ class Test : Base { this/*Test*/() } - - - } diff --git a/compiler/testData/ir/irText/classes/enum.kt.txt b/compiler/testData/ir/irText/classes/enum.kt.txt index 6ad8f99f218..b8ac6ed26ab 100644 --- a/compiler/testData/ir/irText/classes/enum.kt.txt +++ b/compiler/testData/ir/irText/classes/enum.kt.txt @@ -7,11 +7,6 @@ enum class TestEnum1 : Enum { TEST1 init = TODO("IrEnumConstructorCall") TEST2 init = TODO("IrEnumConstructorCall") - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): TestEnum1 /* Synthetic body for ENUM_VALUEOF */ @@ -31,11 +26,6 @@ enum class TestEnum2 : Enum { TEST1 init = TODO("IrEnumConstructorCall") TEST2 init = TODO("IrEnumConstructorCall") TEST3 init = TODO("IrEnumConstructorCall") - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): TestEnum2 /* Synthetic body for ENUM_VALUEOF */ @@ -51,12 +41,6 @@ abstract enum class TestEnum3 : Enum { TEST init = TODO("IrEnumConstructorCall") abstract fun foo() - - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): TestEnum3 /* Synthetic body for ENUM_VALUEOF */ @@ -76,12 +60,6 @@ abstract enum class TestEnum4 : Enum { TEST1 init = TODO("IrEnumConstructorCall") TEST2 init = TODO("IrEnumConstructorCall") abstract fun foo() - - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): TestEnum4 /* Synthetic body for ENUM_VALUEOF */ @@ -101,11 +79,6 @@ enum class TestEnum5 : Enum { TEST1 init = TODO("IrEnumConstructorCall") TEST2 init = TODO("IrEnumConstructorCall") TEST3 init = TODO("IrEnumConstructorCall") - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): TestEnum5 /* Synthetic body for ENUM_VALUEOF */ @@ -137,11 +110,6 @@ enum class TestEnum6 : Enum { TODO("IrEnumConstructorCall") } - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): TestEnum6 /* Synthetic body for ENUM_VALUEOF */ diff --git a/compiler/testData/ir/irText/classes/enumClassModality.kt.txt b/compiler/testData/ir/irText/classes/enumClassModality.kt.txt index c31de7f8af7..4443fe2d8a7 100644 --- a/compiler/testData/ir/irText/classes/enumClassModality.kt.txt +++ b/compiler/testData/ir/irText/classes/enumClassModality.kt.txt @@ -7,11 +7,6 @@ enum class TestFinalEnum1 : Enum { X1 init = TODO("IrEnumConstructorCall") - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): TestFinalEnum1 /* Synthetic body for ENUM_VALUEOF */ @@ -31,11 +26,6 @@ enum class TestFinalEnum2 : Enum { X1 init = TODO("IrEnumConstructorCall") - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): TestFinalEnum2 /* Synthetic body for ENUM_VALUEOF */ @@ -52,13 +42,6 @@ enum class TestFinalEnum3 : Enum { X1 init = TODO("IrEnumConstructorCall") fun doStuff() { } - - - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): TestFinalEnum3 /* Synthetic body for ENUM_VALUEOF */ @@ -74,11 +57,6 @@ open enum class TestOpenEnum1 : Enum { X1 init = TODO("IrEnumConstructorCall") - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): TestOpenEnum1 /* Synthetic body for ENUM_VALUEOF */ @@ -95,13 +73,6 @@ open enum class TestOpenEnum2 : Enum { X1 init = TODO("IrEnumConstructorCall") open fun foo() { } - - - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): TestOpenEnum2 /* Synthetic body for ENUM_VALUEOF */ @@ -117,12 +88,6 @@ abstract enum class TestAbstractEnum1 : Enum { X1 init = TODO("IrEnumConstructorCall") abstract fun foo() - - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): TestAbstractEnum1 /* Synthetic body for ENUM_VALUEOF */ @@ -132,8 +97,6 @@ abstract enum class TestAbstractEnum1 : Enum { interface IFoo { abstract fun foo() - - } abstract enum class TestAbstractEnum2 : Enum, IFoo { @@ -145,12 +108,6 @@ abstract enum class TestAbstractEnum2 : Enum, IFoo { X1 init = TODO("IrEnumConstructorCall") - - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): TestAbstractEnum2 /* Synthetic body for ENUM_VALUEOF */ diff --git a/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt b/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt index 8ff9f27cbd6..fc478384828 100644 --- a/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt +++ b/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt @@ -39,13 +39,6 @@ open enum class A : Enum { .() } - - - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): A /* Synthetic body for ENUM_VALUEOF */ diff --git a/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt.txt b/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt.txt index ce710eeb909..995c4521e02 100644 --- a/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt.txt +++ b/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt.txt @@ -13,13 +13,6 @@ enum class Test0 : Enum { this/*Test0*/(x = 0) } - - - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): Test0 /* Synthetic body for ENUM_VALUEOF */ @@ -41,13 +34,6 @@ enum class Test1 : Enum { this/*Test1*/(x = 0) } - - - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): Test1 /* Synthetic body for ENUM_VALUEOF */ @@ -71,12 +57,6 @@ abstract enum class Test2 : Enum { abstract fun foo() - - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): Test2 /* Synthetic body for ENUM_VALUEOF */ diff --git a/compiler/testData/ir/irText/classes/fakeOverridesForJavaStaticMembers.kt.txt b/compiler/testData/ir/irText/classes/fakeOverridesForJavaStaticMembers.kt.txt index ab8cc7321a6..b25c8fe0aee 100644 --- a/compiler/testData/ir/irText/classes/fakeOverridesForJavaStaticMembers.kt.txt +++ b/compiler/testData/ir/irText/classes/fakeOverridesForJavaStaticMembers.kt.txt @@ -5,10 +5,5 @@ class Test : Base { } - - - - - } diff --git a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt index 3d8c0f3e0f3..b006064a36c 100644 --- a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt +++ b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt @@ -1,8 +1,6 @@ interface IFoo { abstract fun foo(): String - - } class K1 : JFoo { @@ -12,10 +10,6 @@ class K1 : JFoo { } - - - - } class K2 : JFoo { @@ -29,9 +23,6 @@ class K2 : JFoo { return super.foo() /*!! String */ } - - - } class K3 : JUnrelatedFoo, IFoo { @@ -41,10 +32,6 @@ class K3 : JUnrelatedFoo, IFoo { } - - - - } class K4 : JUnrelatedFoo, IFoo { @@ -58,9 +45,6 @@ class K4 : JUnrelatedFoo, IFoo { return super.foo() } - - - } class TestJFoo : IFoo { @@ -75,9 +59,6 @@ class TestJFoo : IFoo { return #$$delegate_0.foo() /*!! String */ } - - - } class TestK1 : IFoo { @@ -92,9 +73,6 @@ class TestK1 : IFoo { return #$$delegate_0.foo() /*!! String */ } - - - } class TestK2 : IFoo { @@ -109,9 +87,6 @@ class TestK2 : IFoo { return #$$delegate_0.foo() } - - - } class TestK3 : IFoo { @@ -126,9 +101,6 @@ class TestK3 : IFoo { return #$$delegate_0.foo() } - - - } class TestK4 : IFoo { @@ -143,8 +115,5 @@ class TestK4 : IFoo { return #$$delegate_0.foo() /*!! String */ } - - - } diff --git a/compiler/testData/ir/irText/classes/initBlock.kt.txt b/compiler/testData/ir/irText/classes/initBlock.kt.txt index 89e6a0e7940..6163ec91fff 100644 --- a/compiler/testData/ir/irText/classes/initBlock.kt.txt +++ b/compiler/testData/ir/irText/classes/initBlock.kt.txt @@ -9,9 +9,6 @@ class Test1 { println() } - - - } class Test2 { @@ -29,9 +26,6 @@ class Test2 { println() } - - - } class Test3 { @@ -45,9 +39,6 @@ class Test3 { } - - - } class Test4 { @@ -65,9 +56,6 @@ class Test4 { println(message = "2") } - - - } class Test5 { @@ -92,13 +80,7 @@ class Test5 { println(message = "2") } - - - } - - - } diff --git a/compiler/testData/ir/irText/classes/initVal.kt.txt b/compiler/testData/ir/irText/classes/initVal.kt.txt index 3b3524247c2..4b3f935070a 100644 --- a/compiler/testData/ir/irText/classes/initVal.kt.txt +++ b/compiler/testData/ir/irText/classes/initVal.kt.txt @@ -9,9 +9,6 @@ class TestInitValFromParameter { field = x get - - - } class TestInitValInClass { @@ -25,9 +22,6 @@ class TestInitValInClass { field = 0 get - - - } class TestInitValInInitBlock { @@ -44,8 +38,5 @@ class TestInitValInInitBlock { #x = 0 } - - - } diff --git a/compiler/testData/ir/irText/classes/initValInLambda.kt.txt b/compiler/testData/ir/irText/classes/initValInLambda.kt.txt index 5da9fc2ba4d..204bcdda7aa 100644 --- a/compiler/testData/ir/irText/classes/initValInLambda.kt.txt +++ b/compiler/testData/ir/irText/classes/initValInLambda.kt.txt @@ -15,8 +15,5 @@ class TestInitValInLambdaCalledOnce { ) } - - - } diff --git a/compiler/testData/ir/irText/classes/initVar.kt.txt b/compiler/testData/ir/irText/classes/initVar.kt.txt index cfc31ea7e0a..3233525aa99 100644 --- a/compiler/testData/ir/irText/classes/initVar.kt.txt +++ b/compiler/testData/ir/irText/classes/initVar.kt.txt @@ -10,9 +10,6 @@ class TestInitVarFromParameter { get set - - - } class TestInitVarInClass { @@ -27,9 +24,6 @@ class TestInitVarInClass { get set - - - } class TestInitVarInInitBlock { @@ -47,9 +41,6 @@ class TestInitVarInInitBlock { .( = 0) } - - - } class TestInitVarWithCustomSetter { @@ -66,9 +57,6 @@ class TestInitVarWithCustomSetter { #x = value } - - - } class TestInitVarWithCustomSetterWithExplicitCtor { @@ -88,9 +76,6 @@ class TestInitVarWithCustomSetterWithExplicitCtor { } - - - } class TestInitVarWithCustomSetterInCtor { @@ -107,8 +92,5 @@ class TestInitVarWithCustomSetterInCtor { .(value = 42) } - - - } diff --git a/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt b/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt index 6ee796d0517..2f95546e087 100644 --- a/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt +++ b/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt @@ -13,8 +13,6 @@ class C { return .() as Int } - - } inline class IC { diff --git a/compiler/testData/ir/irText/classes/innerClass.kt.txt b/compiler/testData/ir/irText/classes/innerClass.kt.txt index 41fa593fcf0..e766ce646a8 100644 --- a/compiler/testData/ir/irText/classes/innerClass.kt.txt +++ b/compiler/testData/ir/irText/classes/innerClass.kt.txt @@ -12,9 +12,6 @@ class Outer { } - - - } inner class DerivedInnerClass : TestInnerClass { @@ -24,13 +21,7 @@ class Outer { } - - - } - - - } diff --git a/compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.kt.txt b/compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.kt.txt index 835e3cbd4bf..49ca52b3f0a 100644 --- a/compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.kt.txt +++ b/compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.kt.txt @@ -20,13 +20,7 @@ class Outer { .this/*Inner*/(x = 0) } - - - } - - - } diff --git a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt index 1018cf3264a..ab68f45edbd 100644 --- a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt +++ b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt @@ -56,12 +56,8 @@ data class B { } - - - } - () }) /* primary */ { super/*Any*/() diff --git a/compiler/testData/ir/irText/classes/localClasses.kt.txt b/compiler/testData/ir/irText/classes/localClasses.kt.txt index 79d3da43b61..c1f5c521051 100644 --- a/compiler/testData/ir/irText/classes/localClasses.kt.txt +++ b/compiler/testData/ir/irText/classes/localClasses.kt.txt @@ -9,12 +9,8 @@ fun outer() { fun foo() { } - - - } - LocalClass().foo() } diff --git a/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt b/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt index 88562d2df7c..8a44e6a8ce3 100644 --- a/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt +++ b/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt @@ -1,8 +1,6 @@ interface IFoo { abstract fun foo() - - } val test1: Any @@ -14,12 +12,8 @@ val test1: Any } - - - } - () } get @@ -37,12 +31,8 @@ val test2: IFoo println(message = "foo") } - - - } - () } get @@ -61,10 +51,6 @@ class Outer { } - - - - } fun test3(): Inner { @@ -80,19 +66,12 @@ class Outer { println(message = "foo") } - - - } - () } } - - - } fun Outer.test4(): Inner { @@ -108,12 +87,8 @@ fun Outer.test4(): Inner { println(message = "foo") } - - - } - () } } diff --git a/compiler/testData/ir/irText/classes/objectWithInitializers.kt.txt b/compiler/testData/ir/irText/classes/objectWithInitializers.kt.txt index 024c0a9c4a9..f17d0654ee9 100644 --- a/compiler/testData/ir/irText/classes/objectWithInitializers.kt.txt +++ b/compiler/testData/ir/irText/classes/objectWithInitializers.kt.txt @@ -5,9 +5,6 @@ abstract class Base { } - - - } object Test : Base { @@ -28,8 +25,5 @@ object Test : Base { #y = .() } - - - } diff --git a/compiler/testData/ir/irText/classes/outerClassAccess.kt.txt b/compiler/testData/ir/irText/classes/outerClassAccess.kt.txt index 624311b5246..bcf17a607a9 100644 --- a/compiler/testData/ir/irText/classes/outerClassAccess.kt.txt +++ b/compiler/testData/ir/irText/classes/outerClassAccess.kt.txt @@ -35,18 +35,9 @@ class Outer { .foo() } - - - } - - - } - - - } diff --git a/compiler/testData/ir/irText/classes/primaryConstructor.kt.txt b/compiler/testData/ir/irText/classes/primaryConstructor.kt.txt index 473c5f08f63..17c007334ee 100644 --- a/compiler/testData/ir/irText/classes/primaryConstructor.kt.txt +++ b/compiler/testData/ir/irText/classes/primaryConstructor.kt.txt @@ -13,9 +13,6 @@ class Test1 { field = y get - - - } class Test2 { @@ -33,9 +30,6 @@ class Test2 { field = x get - - - } class Test3 { @@ -56,8 +50,5 @@ class Test3 { #x = x } - - - } diff --git a/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.kt.txt b/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.kt.txt index 2d0f2815013..b2b8e87b6bf 100644 --- a/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.kt.txt +++ b/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.kt.txt @@ -5,9 +5,6 @@ open class Base { } - - - } class TestImplicitPrimaryConstructor : Base { @@ -17,9 +14,6 @@ class TestImplicitPrimaryConstructor : Base { } - - - } class TestExplicitPrimaryConstructor : Base { @@ -29,9 +23,6 @@ class TestExplicitPrimaryConstructor : Base { } - - - } class TestWithDelegatingConstructor : Base { @@ -53,8 +44,5 @@ class TestWithDelegatingConstructor : Base { this/*TestWithDelegatingConstructor*/(x = x, y = 0) } - - - } diff --git a/compiler/testData/ir/irText/classes/qualifiedSuperCalls.kt.txt b/compiler/testData/ir/irText/classes/qualifiedSuperCalls.kt.txt index 66a4d4e8f02..70c147ecab9 100644 --- a/compiler/testData/ir/irText/classes/qualifiedSuperCalls.kt.txt +++ b/compiler/testData/ir/irText/classes/qualifiedSuperCalls.kt.txt @@ -7,9 +7,6 @@ interface ILeft { return 1 } - - - } interface IRight { @@ -21,9 +18,6 @@ interface IRight { return 2 } - - - } class CBoth : ILeft, IRight { @@ -43,8 +37,5 @@ class CBoth : ILeft, IRight { return super.().plus(other = super.()) } - - - } diff --git a/compiler/testData/ir/irText/classes/sealedClasses.kt.txt b/compiler/testData/ir/irText/classes/sealedClasses.kt.txt index 7fef692aa0d..118d203db34 100644 --- a/compiler/testData/ir/irText/classes/sealedClasses.kt.txt +++ b/compiler/testData/ir/irText/classes/sealedClasses.kt.txt @@ -16,9 +16,6 @@ sealed class Expr { field = number get - - - } class Sum : Expr { @@ -36,9 +33,6 @@ sealed class Expr { field = e2 get - - - } object NotANumber : Expr { @@ -48,13 +42,7 @@ sealed class Expr { } - - - } - - - } diff --git a/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt.txt b/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt.txt index a4aec4ddbbf..b3b9e2c55da 100644 --- a/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt.txt +++ b/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt.txt @@ -5,9 +5,6 @@ open class Base { } - - - } class TestProperty : Base { @@ -21,9 +18,6 @@ class TestProperty : Base { } - - - } class TestInitBlock : Base { @@ -50,8 +44,5 @@ class TestInitBlock : Base { this/*TestInitBlock*/() } - - - } diff --git a/compiler/testData/ir/irText/classes/secondaryConstructors.kt.txt b/compiler/testData/ir/irText/classes/secondaryConstructors.kt.txt index bc131aea7f1..c267adaeb30 100644 --- a/compiler/testData/ir/irText/classes/secondaryConstructors.kt.txt +++ b/compiler/testData/ir/irText/classes/secondaryConstructors.kt.txt @@ -9,8 +9,5 @@ class C { } - - - } diff --git a/compiler/testData/ir/irText/classes/superCalls.kt.txt b/compiler/testData/ir/irText/classes/superCalls.kt.txt index 5c2934f53dc..93cf125f348 100644 --- a/compiler/testData/ir/irText/classes/superCalls.kt.txt +++ b/compiler/testData/ir/irText/classes/superCalls.kt.txt @@ -16,8 +16,6 @@ open class Base { return super.hashCode() } - - } class Derived : Base { @@ -36,8 +34,5 @@ class Derived : Base { return super.() } - - - } diff --git a/compiler/testData/ir/irText/classes/superCallsComposed.kt.txt b/compiler/testData/ir/irText/classes/superCallsComposed.kt.txt index 18360a4f0e2..471013b28f6 100644 --- a/compiler/testData/ir/irText/classes/superCallsComposed.kt.txt +++ b/compiler/testData/ir/irText/classes/superCallsComposed.kt.txt @@ -12,9 +12,6 @@ open class Base { field = "" open get - - - } interface BaseI { @@ -22,9 +19,6 @@ interface BaseI { abstract val bar: String abstract get - - - } class Derived : Base, BaseI { @@ -43,8 +37,5 @@ class Derived : Base, BaseI { return super.() } - - - } diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsInAnnotationArguments.kt.txt index 2f363923fe6..f680f764500 100644 --- a/compiler/testData/ir/irText/declarations/annotations/annotationsInAnnotationArguments.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsInAnnotationArguments.kt.txt @@ -4,9 +4,6 @@ annotation class A1 : Annotation { field = x get - - - } annotation class A2 : Annotation { @@ -15,9 +12,6 @@ annotation class A2 : Annotation { field = a get - - - } annotation class AA : Annotation { @@ -26,9 +20,6 @@ annotation class AA : Annotation { field = xs get - - - } @A2(a = A1(x = 42)) diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt index f10f901fb22..6a73fe8de59 100644 --- a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt @@ -1,8 +1,6 @@ annotation class Ann : Annotation { constructor() /* primary */ - - } interface IFoo { @@ -19,8 +17,6 @@ interface IFoo { @Ann abstract fun String.testExtFun() - - } class DFoo : IFoo { @@ -51,8 +47,5 @@ class DFoo : IFoo { return #$$delegate_0.() } - - - } diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.kt.txt index 00f1bbc1501..01f26c9f37c 100644 --- a/compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.kt.txt @@ -8,9 +8,6 @@ annotation class A : Annotation { field = y get - - - } @A(x = "abc", y = 123) diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsWithVarargParameters.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsWithVarargParameters.kt.txt index 8097e7ff61d..dfe32782f06 100644 --- a/compiler/testData/ir/irText/declarations/annotations/annotationsWithVarargParameters.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsWithVarargParameters.kt.txt @@ -4,9 +4,6 @@ annotation class A : Annotation { field = xs get - - - } @A(xs = ["abc", "def"]) diff --git a/compiler/testData/ir/irText/declarations/annotations/arrayInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/arrayInAnnotationArguments.kt.txt index 3c178b9482e..08457e535cb 100644 --- a/compiler/testData/ir/irText/declarations/annotations/arrayInAnnotationArguments.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/arrayInAnnotationArguments.kt.txt @@ -4,9 +4,6 @@ annotation class TestAnnWithIntArray : Annotation { field = x get - - - } annotation class TestAnnWithStringArray : Annotation { @@ -15,9 +12,6 @@ annotation class TestAnnWithStringArray : Annotation { field = x get - - - } @TestAnnWithIntArray(x = [1, 2, 3]) diff --git a/compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.kt.txt b/compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.kt.txt index 9a13f6b2db9..7ff0acf5306 100644 --- a/compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.kt.txt @@ -4,9 +4,6 @@ annotation class A : Annotation { field = klass get - - - } class C { @@ -16,9 +13,6 @@ class C { } - - - } @A(klass = C::class) diff --git a/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt index a928df16e3d..534e06beef1 100644 --- a/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt @@ -4,9 +4,6 @@ annotation class TestAnn : Annotation { field = x get - - - } @TestAnn(x = "class") @@ -17,16 +14,11 @@ class TestClass { } - - - } @TestAnn(x = "interface") interface TestInterface { - - } @TestAnn(x = "object") @@ -37,9 +29,6 @@ object TestObject { } - - - } class Host { @@ -57,14 +46,8 @@ class Host { } - - - } - - - } @TestAnn(x = "enum") @@ -75,13 +58,6 @@ enum class TestEnum : Enum { } - - - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): TestEnum /* Synthetic body for ENUM_VALUEOF */ @@ -92,7 +68,5 @@ enum class TestEnum : Enum { annotation class TestAnnotation : Annotation { constructor() /* primary */ - - } diff --git a/compiler/testData/ir/irText/declarations/annotations/constExpressionsInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/constExpressionsInAnnotationArguments.kt.txt index c88bd0dff4f..f5501498df1 100644 --- a/compiler/testData/ir/irText/declarations/annotations/constExpressionsInAnnotationArguments.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/constExpressionsInAnnotationArguments.kt.txt @@ -8,9 +8,6 @@ annotation class A : Annotation { field = x get - - - } @A(x = 1) diff --git a/compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.kt.txt index 0a8c870d2a1..506df0bf49d 100644 --- a/compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.kt.txt @@ -4,9 +4,6 @@ annotation class TestAnn : Annotation { field = x get - - - } class TestClass { @@ -22,8 +19,5 @@ class TestClass { this/*TestClass*/() } - - - } diff --git a/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.kt.txt index 0c8de284486..b7e8fcf366d 100644 --- a/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.kt.txt @@ -1,8 +1,6 @@ annotation class Ann : Annotation { constructor() /* primary */ - - } val test1: Int /* by */ diff --git a/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt index be0971eb8e8..357f2ac0469 100644 --- a/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt @@ -4,9 +4,6 @@ annotation class A : Annotation { field = x get - - - } class Cell { @@ -29,9 +26,6 @@ class Cell { .( = newValue) } - - - } val test1: Int /* by */ diff --git a/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.kt.txt index 638abe752af..02edbb448d9 100644 --- a/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.kt.txt @@ -4,9 +4,6 @@ annotation class TestAnn : Annotation { field = x get - - - } open enum class TestEnum : Enum { @@ -20,11 +17,6 @@ open enum class TestEnum : Enum { ENTRY1 init = TODO("IrEnumConstructorCall") @TestAnn(x = "ENTRY2") ENTRY2 init = TODO("IrEnumConstructorCall") - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): TestEnum /* Synthetic body for ENUM_VALUEOF */ diff --git a/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt index cfc72b1db32..d65b4df9e6d 100644 --- a/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt @@ -7,11 +7,6 @@ enum class En : Enum { A init = TODO("IrEnumConstructorCall") B init = TODO("IrEnumConstructorCall") C init = TODO("IrEnumConstructorCall") D init = TODO("IrEnumConstructorCall") - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): En /* Synthetic body for ENUM_VALUEOF */ @@ -24,9 +19,6 @@ annotation class TestAnn : Annotation { field = x get - - - } @TestAnn(x = En) diff --git a/compiler/testData/ir/irText/declarations/annotations/fieldsWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/fieldsWithAnnotations.kt.txt index 71c9a5e261f..278bf188595 100644 --- a/compiler/testData/ir/irText/declarations/annotations/fieldsWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/fieldsWithAnnotations.kt.txt @@ -4,9 +4,6 @@ annotation class TestAnn : Annotation { field = x get - - - } val testVal: String diff --git a/compiler/testData/ir/irText/declarations/annotations/fileAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/fileAnnotations.kt.txt index 2a5dc1df86b..5e2e386d819 100644 --- a/compiler/testData/ir/irText/declarations/annotations/fileAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/fileAnnotations.kt.txt @@ -8,8 +8,5 @@ annotation class A : Annotation { field = x get - - - } diff --git a/compiler/testData/ir/irText/declarations/annotations/functionsWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/functionsWithAnnotations.kt.txt index 21ea5ae1e19..529a3f973e2 100644 --- a/compiler/testData/ir/irText/declarations/annotations/functionsWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/functionsWithAnnotations.kt.txt @@ -4,9 +4,6 @@ annotation class TestAnn : Annotation { field = x get - - - } @TestAnn(x = 42) diff --git a/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.kt.txt index e658174a19c..8c127cd8d0b 100644 --- a/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.kt.txt @@ -4,9 +4,6 @@ annotation class A : Annotation { field = x get - - - } fun foo(m: Map) { @@ -20,6 +17,5 @@ fun foo(m: Map) { return test$delegate.getValue(thisRef = null, property = ::test) } - } diff --git a/compiler/testData/ir/irText/declarations/annotations/multipleAnnotationsInSquareBrackets.kt.txt b/compiler/testData/ir/irText/declarations/annotations/multipleAnnotationsInSquareBrackets.kt.txt index 1f9fe854869..6c0bec81547 100644 --- a/compiler/testData/ir/irText/declarations/annotations/multipleAnnotationsInSquareBrackets.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/multipleAnnotationsInSquareBrackets.kt.txt @@ -1,22 +1,16 @@ annotation class A1 : Annotation { constructor() /* primary */ - - } annotation class A2 : Annotation { constructor() /* primary */ - - } annotation class A3 : Annotation { constructor() /* primary */ - - } @A1 diff --git a/compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.kt.txt index 5dd5f482f40..3151a9e8a65 100644 --- a/compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.kt.txt @@ -1,8 +1,6 @@ annotation class Ann : Annotation { constructor() /* primary */ - - } class Test { @@ -16,8 +14,5 @@ class Test { field = x get - - - } diff --git a/compiler/testData/ir/irText/declarations/annotations/propertiesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/propertiesWithAnnotations.kt.txt index edf356c30d0..e9e9b8d906e 100644 --- a/compiler/testData/ir/irText/declarations/annotations/propertiesWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/propertiesWithAnnotations.kt.txt @@ -4,9 +4,6 @@ annotation class TestAnn : Annotation { field = x get - - - } @TestAnn(x = "testVal.property") diff --git a/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.kt.txt index 437cf04b1bc..0235470af25 100644 --- a/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.kt.txt @@ -4,9 +4,6 @@ annotation class A : Annotation { field = x get - - - } class C { @@ -28,8 +25,5 @@ class C { @A(x = "C.y.set") set - - - } diff --git a/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsWithAnnotations.kt.txt index a5b4a7a3705..1a6bd5bda32 100644 --- a/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsWithAnnotations.kt.txt @@ -4,9 +4,6 @@ annotation class TestAnn : Annotation { field = x get - - - } val test1: String diff --git a/compiler/testData/ir/irText/declarations/annotations/propertySetterParameterWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/propertySetterParameterWithAnnotations.kt.txt index 57e56d9ae1c..454dd388aac 100644 --- a/compiler/testData/ir/irText/declarations/annotations/propertySetterParameterWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/propertySetterParameterWithAnnotations.kt.txt @@ -1,8 +1,6 @@ annotation class AnnParam : Annotation { constructor() /* primary */ - - } var p: Int @@ -22,8 +20,5 @@ class C { get set - - - } diff --git a/compiler/testData/ir/irText/declarations/annotations/receiverParameterWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/receiverParameterWithAnnotations.kt.txt index b97ddc482ae..71c6e613a39 100644 --- a/compiler/testData/ir/irText/declarations/annotations/receiverParameterWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/receiverParameterWithAnnotations.kt.txt @@ -1,8 +1,6 @@ annotation class Ann : Annotation { constructor() /* primary */ - - } class A { @@ -21,9 +19,6 @@ class A { return "" } - - - } fun String?.topLevelF(): String { diff --git a/compiler/testData/ir/irText/declarations/annotations/spreadOperatorInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/spreadOperatorInAnnotationArguments.kt.txt index ab258cd7824..acb5cbbf55f 100644 --- a/compiler/testData/ir/irText/declarations/annotations/spreadOperatorInAnnotationArguments.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/spreadOperatorInAnnotationArguments.kt.txt @@ -4,9 +4,6 @@ annotation class A : Annotation { field = xs get - - - } @A(xs = [["a"], ["b"]]) diff --git a/compiler/testData/ir/irText/declarations/annotations/typeAliasesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/typeAliasesWithAnnotations.kt.txt index a1968539cec..166490a4b6d 100644 --- a/compiler/testData/ir/irText/declarations/annotations/typeAliasesWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/typeAliasesWithAnnotations.kt.txt @@ -5,9 +5,6 @@ annotation class TestAnn : Annotation { field = x get - - - } @TestAnn(x = "TestTypeAlias") diff --git a/compiler/testData/ir/irText/declarations/annotations/typeParametersWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/typeParametersWithAnnotations.kt.txt index 1434b0cc418..e69304f97f9 100644 --- a/compiler/testData/ir/irText/declarations/annotations/typeParametersWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/typeParametersWithAnnotations.kt.txt @@ -2,8 +2,6 @@ annotation class Anno : Annotation { constructor() /* primary */ - - } fun <@Anno T : Any?> foo() { diff --git a/compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.kt.txt index 20570ae43f8..b105f6e0f5d 100644 --- a/compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.kt.txt @@ -4,9 +4,6 @@ annotation class TestAnn : Annotation { field = x get - - - } fun testFun(x: Int) { @@ -23,8 +20,5 @@ class TestClassConstructor1 { field = x get - - - } diff --git a/compiler/testData/ir/irText/declarations/annotations/varargsInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/varargsInAnnotationArguments.kt.txt index 71e88ec54c8..402a6bfe286 100644 --- a/compiler/testData/ir/irText/declarations/annotations/varargsInAnnotationArguments.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/varargsInAnnotationArguments.kt.txt @@ -4,9 +4,6 @@ annotation class A1 : Annotation { field = xs get - - - } annotation class A2 : Annotation { @@ -15,9 +12,6 @@ annotation class A2 : Annotation { field = xs get - - - } annotation class AA : Annotation { @@ -26,9 +20,6 @@ annotation class AA : Annotation { field = xs get - - - } @A1(xs = [1, 2, 3]) diff --git a/compiler/testData/ir/irText/declarations/annotations/variablesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/variablesWithAnnotations.kt.txt index cf6e8abd585..dce3071fe44 100644 --- a/compiler/testData/ir/irText/declarations/annotations/variablesWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/variablesWithAnnotations.kt.txt @@ -4,9 +4,6 @@ annotation class TestAnn : Annotation { field = x get - - - } fun foo() { diff --git a/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt b/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt index 14e3597ecf5..a1d5fd7b042 100644 --- a/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt @@ -53,8 +53,5 @@ class C { return #test8$delegate.setValue(thisRef = , property = ::test8, value = ) } - - - } diff --git a/compiler/testData/ir/irText/declarations/defaultArguments.kt.txt b/compiler/testData/ir/irText/declarations/defaultArguments.kt.txt index a2dca6a28e0..1f84ece1d9d 100644 --- a/compiler/testData/ir/irText/declarations/defaultArguments.kt.txt +++ b/compiler/testData/ir/irText/declarations/defaultArguments.kt.txt @@ -2,6 +2,5 @@ fun test1(x: Int, y: Int = 0, z: String = "abc") { local fun local(xx: Int = x, yy: Int = y, zz: String = z) { } - } diff --git a/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt b/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt index 69bef8dea13..21581e024dc 100644 --- a/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt @@ -36,9 +36,6 @@ class C { return #test3$delegate.setValue(thisRef = , property = ::test3, value = ) } - - - } var test4: Any /* by */ diff --git a/compiler/testData/ir/irText/declarations/extensionProperties.kt.txt b/compiler/testData/ir/irText/declarations/extensionProperties.kt.txt index 44d5ab7067b..267b1e31f28 100644 --- a/compiler/testData/ir/irText/declarations/extensionProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/extensionProperties.kt.txt @@ -29,8 +29,5 @@ class Host { set(value: Int) { } - - - } diff --git a/compiler/testData/ir/irText/declarations/fakeOverrides.kt.txt b/compiler/testData/ir/irText/declarations/fakeOverrides.kt.txt index 98bffbc0249..4110a02f158 100644 --- a/compiler/testData/ir/irText/declarations/fakeOverrides.kt.txt +++ b/compiler/testData/ir/irText/declarations/fakeOverrides.kt.txt @@ -1,17 +1,12 @@ interface IFooStr { abstract fun foo(x: String) - - } interface IBar { abstract val bar: Int abstract get - - - } abstract class CFoo { @@ -24,9 +19,6 @@ abstract class CFoo { fun foo(x: T) { } - - - } class Test1 : CFoo, IFooStr, IBar { @@ -40,9 +32,5 @@ class Test1 : CFoo, IFooStr, IBar { field = 42 override get - - - - } diff --git a/compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt.txt b/compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt.txt index a0816c0080e..ca34745c9e5 100644 --- a/compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt.txt +++ b/compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt.txt @@ -5,9 +5,6 @@ class C { } - - - } object Delegate { @@ -24,9 +21,6 @@ object Delegate { operator fun setValue(thisRef: Any?, kProp: Any?, newValue: Int) { } - - - } var C.genericDelegatedProperty: Int /* by */ diff --git a/compiler/testData/ir/irText/declarations/interfaceProperties.kt.txt b/compiler/testData/ir/irText/declarations/interfaceProperties.kt.txt index fb728387d4a..01677a7b2f3 100644 --- a/compiler/testData/ir/irText/declarations/interfaceProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/interfaceProperties.kt.txt @@ -18,8 +18,5 @@ interface C { set(value: Int) { } - - - } diff --git a/compiler/testData/ir/irText/declarations/kt29833.kt.txt b/compiler/testData/ir/irText/declarations/kt29833.kt.txt index 6b5e7862faa..4f17ab6bb51 100644 --- a/compiler/testData/ir/irText/declarations/kt29833.kt.txt +++ b/compiler/testData/ir/irText/declarations/kt29833.kt.txt @@ -15,8 +15,5 @@ object Definitions { field = #CONSTANT get - - - } diff --git a/compiler/testData/ir/irText/declarations/kt35550.kt.txt b/compiler/testData/ir/irText/declarations/kt35550.kt.txt index 7b60fa0af31..3eefd726acd 100644 --- a/compiler/testData/ir/irText/declarations/kt35550.kt.txt +++ b/compiler/testData/ir/irText/declarations/kt35550.kt.txt @@ -4,9 +4,6 @@ interface I { return } - - - } class A : I { @@ -22,8 +19,5 @@ class A : I { return (#$$delegate_0, ).() } - - - } diff --git a/compiler/testData/ir/irText/declarations/localClassWithOverrides.kt.txt b/compiler/testData/ir/irText/declarations/localClassWithOverrides.kt.txt index aecdbb903cd..be3fb0a6c6f 100644 --- a/compiler/testData/ir/irText/declarations/localClassWithOverrides.kt.txt +++ b/compiler/testData/ir/irText/declarations/localClassWithOverrides.kt.txt @@ -14,12 +14,8 @@ fun outer() { abstract get abstract set - - - } - local class Local : ALocal { constructor() /* primary */ { super/*ALocal*/() @@ -39,11 +35,7 @@ fun outer() { override get override set - - - } - } diff --git a/compiler/testData/ir/irText/declarations/localDelegatedProperties.kt.txt b/compiler/testData/ir/irText/declarations/localDelegatedProperties.kt.txt index 3bacaf906ae..c7bcd592dd8 100644 --- a/compiler/testData/ir/irText/declarations/localDelegatedProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/localDelegatedProperties.kt.txt @@ -8,7 +8,6 @@ fun test1() { return x$delegate.getValue(thisRef = null, property = ::x) } - println(message = ()) } @@ -22,7 +21,6 @@ fun test2() { return x$delegate.setValue(thisRef = null, property = ::x, value = value) } - (value = 0) { // BLOCK val tmp0: Int = () diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectClassInherited.kt.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectClassInherited.kt.txt index 1549c8563e9..7702aaae39a 100644 --- a/compiler/testData/ir/irText/declarations/multiplatform/expectClassInherited.kt.txt +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectClassInherited.kt.txt @@ -2,8 +2,6 @@ expect abstract class A { protected expect constructor() /* primary */ expect abstract fun foo() - - } expect open class B : A { @@ -11,8 +9,6 @@ expect open class B : A { expect override fun foo() expect open fun bar(s: String) - - } abstract class A { @@ -24,8 +20,6 @@ abstract class A { abstract fun foo() - - } open class B : A { @@ -41,8 +35,5 @@ open class B : A { open fun bar(s: String) { } - - - } diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.kt.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.kt.txt index c0bc3b9a218..8dc5853177d 100644 --- a/compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.kt.txt +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.kt.txt @@ -2,12 +2,6 @@ expect enum class MyEnum : Enum { FOO BAR - - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): MyEnum /* Synthetic body for ENUM_VALUEOF */ @@ -23,11 +17,6 @@ enum class MyEnum : Enum { FOO init = TODO("IrEnumConstructorCall") BAR init = TODO("IrEnumConstructorCall") BAZ init = TODO("IrEnumConstructorCall") - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): MyEnum /* Synthetic body for ENUM_VALUEOF */ diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.kt.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.kt.txt index 0140f87e3b4..ec28ed7f4c7 100644 --- a/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.kt.txt +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.kt.txt @@ -1,15 +1,11 @@ expect sealed class Ops { private expect constructor() /* primary */ - - } expect class Add : Ops { expect constructor() /* primary */ - - } sealed class Ops { @@ -19,9 +15,6 @@ sealed class Ops { } - - - } class Add : Ops { @@ -31,8 +24,5 @@ class Add : Ops { } - - - } diff --git a/compiler/testData/ir/irText/declarations/parameters/class.kt.txt b/compiler/testData/ir/irText/declarations/parameters/class.kt.txt index 2431fae6cdd..414681de8f4 100644 --- a/compiler/testData/ir/irText/declarations/parameters/class.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/class.kt.txt @@ -1,13 +1,8 @@ interface TestInterface { interface TestNestedInterface { - - } - - - } class Test { @@ -24,9 +19,6 @@ class Test { } - - - } inner class TestInner { @@ -36,13 +28,7 @@ class Test { } - - - } - - - } diff --git a/compiler/testData/ir/irText/declarations/parameters/constructor.kt.txt b/compiler/testData/ir/irText/declarations/parameters/constructor.kt.txt index 7f984f257d9..b0970a65095 100644 --- a/compiler/testData/ir/irText/declarations/parameters/constructor.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/constructor.kt.txt @@ -13,9 +13,6 @@ class Test1 { field = y get - - - } class Test2 { @@ -44,14 +41,8 @@ class Test2 { .this/*TestInner*/(z = z) } - - - } - - - } class Test3 { @@ -69,9 +60,6 @@ class Test3 { field = y get - - - } class Test4 { @@ -89,8 +77,5 @@ class Test4 { this/*Test4*/(x = x.plus(other = y)) } - - - } diff --git a/compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.kt.txt b/compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.kt.txt index c1ce99196b0..a94798f1eac 100644 --- a/compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.kt.txt @@ -23,9 +23,6 @@ class Host { get set - - - } class InPrimaryCtor { @@ -44,8 +41,5 @@ class InPrimaryCtor { get set - - - } diff --git a/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt index c291494358f..a49deaf0140 100644 --- a/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt @@ -5,8 +5,6 @@ interface IBase { abstract fun qux(t: T, x: X) - - } class Test : IBase { @@ -30,8 +28,5 @@ class Test : IBase { return #$$delegate_0.() } - - - } diff --git a/compiler/testData/ir/irText/declarations/parameters/fun.kt.txt b/compiler/testData/ir/irText/declarations/parameters/fun.kt.txt index f9fd4a63458..f985b350851 100644 --- a/compiler/testData/ir/irText/declarations/parameters/fun.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/fun.kt.txt @@ -23,8 +23,5 @@ class Host { fun String.testMembetExt2(i: Int, j: T) { } - - - } diff --git a/compiler/testData/ir/irText/declarations/parameters/genericInnerClass.kt.txt b/compiler/testData/ir/irText/declarations/parameters/genericInnerClass.kt.txt index 93bb6cd2ff7..503250dcd03 100644 --- a/compiler/testData/ir/irText/declarations/parameters/genericInnerClass.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/genericInnerClass.kt.txt @@ -15,13 +15,7 @@ class Outer { fun foo(x1: T1, x2: T2) { } - - - } - - - } diff --git a/compiler/testData/ir/irText/declarations/parameters/localFun.kt.txt b/compiler/testData/ir/irText/declarations/parameters/localFun.kt.txt index eb35ac3ce24..fa27fdb1460 100644 --- a/compiler/testData/ir/irText/declarations/parameters/localFun.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/localFun.kt.txt @@ -2,18 +2,14 @@ fun outer() { local fun test1(i: Int, j: T) { } - local fun test2(i: Int = 0, j: String = "") { } - local fun test3(vararg args: String) { } - local fun String.textExt1(i: Int, j: TT) { } - } diff --git a/compiler/testData/ir/irText/declarations/parameters/propertyAccessors.kt.txt b/compiler/testData/ir/irText/declarations/parameters/propertyAccessors.kt.txt index c88b9fae673..5165f6c13d8 100644 --- a/compiler/testData/ir/irText/declarations/parameters/propertyAccessors.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/propertyAccessors.kt.txt @@ -77,8 +77,5 @@ class Host { set(value: Int) { } - - - } diff --git a/compiler/testData/ir/irText/declarations/parameters/typeParameterBeforeBound.kt.txt b/compiler/testData/ir/irText/declarations/parameters/typeParameterBeforeBound.kt.txt index af3034679f2..f7f88a64ada 100644 --- a/compiler/testData/ir/irText/declarations/parameters/typeParameterBeforeBound.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/typeParameterBeforeBound.kt.txt @@ -5,9 +5,6 @@ class Test1 { } - - - } fun test2() { diff --git a/compiler/testData/ir/irText/declarations/parameters/typeParameterBoundedBySubclass.kt.txt b/compiler/testData/ir/irText/declarations/parameters/typeParameterBoundedBySubclass.kt.txt index acd405e91cd..0407f0fedf2 100644 --- a/compiler/testData/ir/irText/declarations/parameters/typeParameterBoundedBySubclass.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/typeParameterBoundedBySubclass.kt.txt @@ -5,9 +5,6 @@ abstract class Base1 { } - - - } class Derived1 : Base1 { @@ -17,9 +14,6 @@ class Derived1 : Base1 { } - - - } abstract class Base2 { @@ -32,9 +26,6 @@ abstract class Base2 { fun foo(x: T) { } - - - } class Derived2 : Base2 { @@ -44,9 +35,5 @@ class Derived2 : Base2 { } - - - - } diff --git a/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.kt.txt b/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.kt.txt index e1f95d49969..d6e01b5c993 100644 --- a/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.kt.txt +++ b/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.kt.txt @@ -9,8 +9,5 @@ class Test { field = x get - - - } diff --git a/compiler/testData/ir/irText/declarations/primaryCtorProperties.kt.txt b/compiler/testData/ir/irText/declarations/primaryCtorProperties.kt.txt index 37b4c154856..59230d68345 100644 --- a/compiler/testData/ir/irText/declarations/primaryCtorProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/primaryCtorProperties.kt.txt @@ -14,8 +14,5 @@ class C { get set - - - } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt index 719dc756ba1..995dc1647e9 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt @@ -9,9 +9,6 @@ class MyClass { field = value get - - - } operator fun MyClass.provideDelegate(host: Any?, p: Any): String { diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/local.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/local.kt.txt index 3313b337599..f59a769225a 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/local.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/local.kt.txt @@ -13,9 +13,6 @@ class Delegate { return .() } - - - } class DelegateProvider { @@ -33,9 +30,6 @@ class DelegateProvider { return Delegate(value = .()) } - - - } fun foo() { @@ -45,6 +39,5 @@ fun foo() { return testMember$delegate.getValue(thisRef = null, property = ::testMember) } - } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt index dc4ba18992b..4cfecc03c66 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt @@ -9,9 +9,6 @@ class MyClass { field = value get - - - } operator fun MyClass.provideDelegate(host: Any?, p: Any): String { @@ -29,14 +26,12 @@ fun box(): String { return testO$delegate.getValue(receiver = null, p = ::testO) } - val testK: String val testK$delegate: String = "K" local get(): String { return testK$delegate.getValue(receiver = null, p = ::testK) } - val testOK: String = ().plus(other = ()) return testOK } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt index 7fb97f6eb25..881cb1e698e 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt @@ -13,9 +13,6 @@ class Delegate { return .() } - - - } class DelegateProvider { @@ -33,9 +30,6 @@ class DelegateProvider { return Delegate(value = .()) } - - - } class Host { @@ -51,8 +45,5 @@ class Host { return #testMember$delegate.getValue(thisRef = , property = ::testMember) } - - - } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt index fef16a625c0..2175f0337a6 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt @@ -20,9 +20,6 @@ object Host { return receiver.plus(other = .()) } - - - } operator fun String.provideDelegate(host: Any?, p: Any): StringDelegate { @@ -39,8 +36,5 @@ object Host { field = (, "O").() get - - - } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.kt.txt index 19df8d06c16..3b97be38e4e 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.kt.txt @@ -13,9 +13,6 @@ class Delegate { return .() } - - - } class DelegateProvider { @@ -33,9 +30,6 @@ class DelegateProvider { return Delegate(value = .()) } - - - } val testTopLevel: String /* by */ diff --git a/compiler/testData/ir/irText/declarations/typeAlias.kt.txt b/compiler/testData/ir/irText/declarations/typeAlias.kt.txt index e2d1093c71c..80cf0757892 100644 --- a/compiler/testData/ir/irText/declarations/typeAlias.kt.txt +++ b/compiler/testData/ir/irText/declarations/typeAlias.kt.txt @@ -14,7 +14,5 @@ class C { @Suppress(names = ["TOPLEVEL_TYPEALIASES_ONLY"]) typealias TestNested = String - - } diff --git a/compiler/testData/ir/irText/errors/suppressedNonPublicCall.kt.txt b/compiler/testData/ir/irText/errors/suppressedNonPublicCall.kt.txt index 9e4bbc7e90d..be2ddfddf77 100644 --- a/compiler/testData/ir/irText/errors/suppressedNonPublicCall.kt.txt +++ b/compiler/testData/ir/irText/errors/suppressedNonPublicCall.kt.txt @@ -8,9 +8,6 @@ class C { internal fun bar() { } - - - } inline fun C.foo() { diff --git a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.kt.txt b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.kt.txt index d80382fd23a..dc6157aa590 100644 --- a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.kt.txt +++ b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.kt.txt @@ -17,9 +17,6 @@ class C { field = x get - - - } fun testVariable() { diff --git a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.kt.txt b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.kt.txt index ba7f609d100..f559f43b413 100644 --- a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.kt.txt +++ b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.kt.txt @@ -1,15 +1,11 @@ interface IA { abstract operator fun get(index: String): Int - - } interface IB { abstract operator fun IA.set(index: String, value: Int) - - } fun IB.test(a: IA) { diff --git a/compiler/testData/ir/irText/expressions/assignments.kt.txt b/compiler/testData/ir/irText/expressions/assignments.kt.txt index f1c6442fb24..2bb0575af4a 100644 --- a/compiler/testData/ir/irText/expressions/assignments.kt.txt +++ b/compiler/testData/ir/irText/expressions/assignments.kt.txt @@ -10,9 +10,6 @@ class Ref { get set - - - } fun test1() { diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt b/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt index c70172fe157..20f7ee9d601 100644 --- a/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt +++ b/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt @@ -5,9 +5,6 @@ class A { } - - - } operator fun A.plusAssign(s: String) { diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.kt.txt b/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.kt.txt index 2f39d141072..b68fc3d5dce 100644 --- a/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.kt.txt +++ b/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.kt.txt @@ -12,9 +12,6 @@ class Host { .plusAssign(x = 1) } - - - } fun foo(): Host { diff --git a/compiler/testData/ir/irText/expressions/boundCallableReferences.kt.txt b/compiler/testData/ir/irText/expressions/boundCallableReferences.kt.txt index b105755a710..42e41290c72 100644 --- a/compiler/testData/ir/irText/expressions/boundCallableReferences.kt.txt +++ b/compiler/testData/ir/irText/expressions/boundCallableReferences.kt.txt @@ -12,9 +12,6 @@ class A { field = 0 get - - - } fun A.qux() { diff --git a/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt index 32c26034831..d1d857ad4f7 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt @@ -8,9 +8,6 @@ class C { } - - - } fun C.extensionVararg(i: Int, vararg s: String) { diff --git a/compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.kt.txt index e1560da0c0f..1a6e2eb66ea 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.kt.txt @@ -13,7 +13,6 @@ fun test() { receiver.id() /*~> Unit */ } - ::id }) } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt index ebcd44676e5..f283591c503 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt @@ -22,14 +22,8 @@ class Foo { field = b get - - - } - - - } inline fun foo(a: A, b: B, x: Function2>): Inner { diff --git a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt index 5752ccfed7b..24878a4d8b4 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt @@ -1,15 +1,10 @@ fun interface IFoo { abstract fun foo(i: Int) - - } fun interface IFoo2 : IFoo { - - - } object A { @@ -19,9 +14,6 @@ object A { } - - - } object B { @@ -31,9 +23,6 @@ object B { } - - - } operator fun A.get(i: IFoo): Int { diff --git a/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt index 8741d8f2284..bfb7f9bba69 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt @@ -9,9 +9,6 @@ class C { } - - - } class Outer { @@ -28,14 +25,8 @@ class Outer { } - - - } - - - } fun testConstructor(): Any { @@ -51,7 +42,6 @@ fun testInnerClassConstructor(outer: Outer): Any { return receiver.Inner(xs = [p0]) } - :: }) } @@ -62,7 +52,6 @@ fun testInnerClassConstructorCapturingOuter(): Any { return receiver.Inner(xs = [p0]) } - :: }) } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt.txt index 812e06d5e9b..bfaf53bbc2b 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt.txt @@ -21,9 +21,6 @@ class C { field = x get - - - } fun useKCallableStar(fn: KCallable<*>) { diff --git a/compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt.txt index 6193921ad24..fd79b49f155 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt.txt @@ -12,9 +12,6 @@ class A { field = 42 get - - - } val test1: KFunction1, Unit> diff --git a/compiler/testData/ir/irText/expressions/callableReferences/importedFromObject.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/importedFromObject.kt.txt index faad8ad2eb3..ebb869ef4ef 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/importedFromObject.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/importedFromObject.kt.txt @@ -15,9 +15,6 @@ object Foo { return "" } - - - } val test1: KProperty0 diff --git a/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt index 5c6e480fec5..e0950390950 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt @@ -13,9 +13,6 @@ class C { field = x get - - - } fun use(fn: Function0): Any { diff --git a/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt index e7547614223..1036bd906ae 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt @@ -33,9 +33,6 @@ class C { fun bar() { } - - - } fun testLambda() { @@ -97,7 +94,6 @@ fun testWithBoundReceiver() { receiver.bar() } - ::bar }) } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/typeArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/typeArguments.kt.txt index a00ffca033a..909ea6478f4 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/typeArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/typeArguments.kt.txt @@ -8,9 +8,6 @@ object Host { inline fun objectMember(x: T) { } - - - } inline fun topLevel1(x: T) { diff --git a/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt index e56e9434e96..9890992ceda 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt @@ -15,9 +15,6 @@ open class A { return 1 } - - - } object Obj : A { @@ -31,9 +28,6 @@ object Obj : A { return 1 } - - - } fun testUnbound() { @@ -49,7 +43,6 @@ fun testBound(a: A) { receiver.foo(xs = [p0]) /*~> Unit */ } - ::foo }) } @@ -60,7 +53,6 @@ fun testObject() { receiver.foo(xs = [p0]) /*~> Unit */ } - ::foo }) } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withAdaptationForSam.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptationForSam.kt.txt index aca3d60d7cd..9ac7eb2bc0c 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/withAdaptationForSam.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptationForSam.kt.txt @@ -1,8 +1,6 @@ fun interface IFoo { abstract fun foo(i: Int) - - } fun useFoo(foo: IFoo) { diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt index 4de0ab9c9df..3b81f93c538 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt @@ -32,9 +32,6 @@ object Host { return "abc" } - - - } fun testDefault(): String { @@ -64,7 +61,6 @@ fun testImportedObjectMember(): String { return importedObjectMemberWithVarargs(xs = [p0]) } - ::importedObjectMemberWithVarargs }) } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt index 55b9a8d3122..778c1d5ef1f 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt @@ -19,7 +19,6 @@ class Host { receiver.withVararg(xs = [p0]) /*~> Unit */ } - ::withVararg }) } @@ -31,7 +30,6 @@ class Host { receiver.withVararg(xs = [p0]) /*~> Unit */ } - ::withVararg }) } @@ -43,7 +41,6 @@ class Host { receiver.withVararg(xs = [p0]) /*~> Unit */ } - ::withVararg }) } @@ -54,7 +51,6 @@ class Host { receiver.withVararg(xs = [p0]) /*~> Unit */ } - ::withVararg }) } @@ -65,13 +61,9 @@ class Host { receiver.withVararg(xs = [p0]) /*~> Unit */ } - ::withVararg }) } - - - } diff --git a/compiler/testData/ir/irText/expressions/castToTypeParameter.kt.txt b/compiler/testData/ir/irText/expressions/castToTypeParameter.kt.txt index d718a0a4519..d37018e51b7 100644 --- a/compiler/testData/ir/irText/expressions/castToTypeParameter.kt.txt +++ b/compiler/testData/ir/irText/expressions/castToTypeParameter.kt.txt @@ -44,8 +44,5 @@ class Host { return as TV } - - - } diff --git a/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt b/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt index f0c2381a393..44aa31dbb1f 100644 --- a/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt +++ b/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt @@ -13,9 +13,6 @@ class C { return } - - - } fun test(nc: C?): C? { diff --git a/compiler/testData/ir/irText/expressions/classReference.kt.txt b/compiler/testData/ir/irText/expressions/classReference.kt.txt index 7212d0a36bf..ee6e13d7e6f 100644 --- a/compiler/testData/ir/irText/expressions/classReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/classReference.kt.txt @@ -5,9 +5,6 @@ class A { } - - - } fun test() { diff --git a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt index 571a89e312e..283189eb48b 100644 --- a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt +++ b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt @@ -34,19 +34,10 @@ object X1 { get set - - - } - - - } - - - } fun test1(a: IntArray) { @@ -103,9 +94,6 @@ class B { get set - - - } object Host { @@ -122,9 +110,6 @@ object Host { } } - - - } fun Host.test3(v: B) { diff --git a/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.kt.txt b/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.kt.txt index 0970f573761..322337e59bc 100644 --- a/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.kt.txt @@ -20,13 +20,7 @@ class K1 { } - - - } - - - } diff --git a/compiler/testData/ir/irText/expressions/contructorCall.kt.txt b/compiler/testData/ir/irText/expressions/contructorCall.kt.txt index ef069c6ac81..45f4be27318 100644 --- a/compiler/testData/ir/irText/expressions/contructorCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/contructorCall.kt.txt @@ -5,9 +5,6 @@ class A { } - - - } val test: A diff --git a/compiler/testData/ir/irText/expressions/conventionComparisons.kt.txt b/compiler/testData/ir/irText/expressions/conventionComparisons.kt.txt index acc623bd0a3..3abaddedb9b 100644 --- a/compiler/testData/ir/irText/expressions/conventionComparisons.kt.txt +++ b/compiler/testData/ir/irText/expressions/conventionComparisons.kt.txt @@ -1,14 +1,10 @@ interface IA { - - } interface IB { abstract operator fun IA.compareTo(other: IA): Int - - } fun IB.test1(a1: IA, a2: IA): Boolean { diff --git a/compiler/testData/ir/irText/expressions/destructuring1.kt.txt b/compiler/testData/ir/irText/expressions/destructuring1.kt.txt index 657099389e5..f4e556343c9 100644 --- a/compiler/testData/ir/irText/expressions/destructuring1.kt.txt +++ b/compiler/testData/ir/irText/expressions/destructuring1.kt.txt @@ -5,9 +5,6 @@ object A { } - - - } object B { @@ -25,9 +22,6 @@ object B { return 2 } - - - } fun B.test() { diff --git a/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.kt.txt b/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.kt.txt index be0be0655ee..2d7aaf67116 100644 --- a/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.kt.txt +++ b/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.kt.txt @@ -5,9 +5,6 @@ object A { } - - - } object B { @@ -29,9 +26,6 @@ object B { return 3 } - - - } fun B.test() { diff --git a/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt b/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt index 8882593ebcd..e28e71ff06a 100644 --- a/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt +++ b/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt @@ -8,13 +8,6 @@ abstract enum class X : Enum { B init = TODO("IrEnumConstructorCall") abstract val value: Function0 abstract get - - - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): X /* Synthetic body for ENUM_VALUEOF */ diff --git a/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt index 61a32c983ab..054127a2884 100644 --- a/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt +++ b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt @@ -7,11 +7,6 @@ open enum class MyEnum : Enum { Z init = TODO("IrEnumConstructorCall") - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): MyEnum /* Synthetic body for ENUM_VALUEOF */ diff --git a/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt b/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt index 9104cd49273..7c80a404e92 100644 --- a/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt +++ b/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt @@ -7,11 +7,6 @@ enum class A : Enum { V1 init = TODO("IrEnumConstructorCall") - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): A /* Synthetic body for ENUM_VALUEOF */ diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.kt.txt index 2324f39b03a..6dfe5b398c9 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.kt.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.kt.txt @@ -61,8 +61,5 @@ class F { } } - - - } diff --git a/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt index 0abe18d695b..d0cc3943588 100644 --- a/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt +++ b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt @@ -5,9 +5,6 @@ object FiveTimes { } - - - } class IntCell { @@ -22,9 +19,6 @@ class IntCell { get set - - - } interface IReceiver { @@ -47,9 +41,6 @@ interface IReceiver { } } - - - } fun IReceiver.test() { diff --git a/compiler/testData/ir/irText/expressions/funImportedFromObject.kt.txt b/compiler/testData/ir/irText/expressions/funImportedFromObject.kt.txt index aafc48b7a65..0c6c653fdd4 100644 --- a/compiler/testData/ir/irText/expressions/funImportedFromObject.kt.txt +++ b/compiler/testData/ir/irText/expressions/funImportedFromObject.kt.txt @@ -11,9 +11,6 @@ object Host { return "OK" } - - - } fun test(): String { diff --git a/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt.txt index 4aaa2ddab5d..a88cc4b0f0a 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt.txt @@ -1,8 +1,6 @@ fun interface IRunnable { abstract fun run() - - } fun foo1(r: IRunnable, vararg s: String) { diff --git a/compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.kt.txt index d97ac04a4e5..9755c2389c3 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.kt.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.kt.txt @@ -1,8 +1,6 @@ fun interface Foo { abstract fun invoke(): String - - } fun foo(f: Foo): String { diff --git a/compiler/testData/ir/irText/expressions/funInterface/castFromAny.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/castFromAny.kt.txt index 316d45be194..6360ffbef08 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/castFromAny.kt.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/castFromAny.kt.txt @@ -1,8 +1,6 @@ fun interface KRunnable { abstract fun invoke() - - } fun test(a: Any?) { diff --git a/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt index 596d0026e9a..1b6caa75643 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt @@ -1,8 +1,6 @@ fun interface Fn { abstract fun run(s: String, i: Int, t: T): R - - } class J { @@ -16,9 +14,6 @@ class J { return f1.run(s = "Bar", i = 1, t = f2.run(s = "Foo", i = 42, t = 239)) } - - - } val fsi: Fn @@ -34,12 +29,8 @@ val fsi: Fn return 1 } - - - } - () } get @@ -57,12 +48,8 @@ val fis: Fn return "" } - - - } - () } get diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargs.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargs.kt.txt index 236c0c99fe2..b7d224afc3f 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargs.kt.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargs.kt.txt @@ -1,8 +1,6 @@ fun interface IFoo { abstract fun foo(i: Int) - - } fun useVararg(vararg foos: IFoo) { diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.kt.txt index 91714c66362..ca03e3fbd49 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.kt.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.kt.txt @@ -1,8 +1,6 @@ fun interface MyRunnable { abstract fun run() - - } fun test(a: Any, r: MyRunnable) { diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.kt.txt index 9b71c6464c9..b217e5e1faa 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.kt.txt @@ -1,8 +1,6 @@ fun interface KRunnable { abstract fun run() - - } fun foo0() { diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.kt.txt index 163d4f2b02d..3898a38ccff 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.kt.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.kt.txt @@ -1,8 +1,6 @@ fun interface KRunnable { abstract fun run() - - } fun id(x: T): T { diff --git a/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt b/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt index 56fcf80db15..36b9c18af8d 100644 --- a/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt @@ -20,8 +20,5 @@ class Box { field = value get - - - } diff --git a/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt b/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt index d8d40af7493..d8fd56dbcd2 100644 --- a/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt +++ b/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt @@ -15,9 +15,6 @@ class Value { get set - - - } val Value.additionalText: Int /* by */ @@ -47,9 +44,6 @@ class DVal { return 42 } - - - } var recivier: Any? diff --git a/compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.kt.txt b/compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.kt.txt index bcdbe848f86..ea241dbb39c 100644 --- a/compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.kt.txt +++ b/compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.kt.txt @@ -12,8 +12,5 @@ class C { } } - - - } diff --git a/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.kt.txt b/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.kt.txt index a5b6f66c2bb..04559c16e41 100644 --- a/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.kt.txt +++ b/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.kt.txt @@ -7,8 +7,6 @@ inline fun Any.test1(): T? { interface Foo { - - } val Foo.asT: T? @@ -34,8 +32,5 @@ class Bar { fun useT(t: T) { } - - - } diff --git a/compiler/testData/ir/irText/expressions/interfaceThisRef.kt.txt b/compiler/testData/ir/irText/expressions/interfaceThisRef.kt.txt index 1537efb3157..94965567f3a 100644 --- a/compiler/testData/ir/irText/expressions/interfaceThisRef.kt.txt +++ b/compiler/testData/ir/irText/expressions/interfaceThisRef.kt.txt @@ -4,8 +4,5 @@ interface IFoo { .foo() } - - - } diff --git a/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt b/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt index 0608cd4cb58..4325bd0132e 100644 --- a/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt +++ b/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt @@ -1,7 +1,5 @@ interface IFoo { - - } class Derived1 : JFieldOwner, IFoo { @@ -11,9 +9,6 @@ class Derived1 : JFieldOwner, IFoo { } - - - } class Derived2 : JFieldOwner, IFoo { @@ -23,9 +18,6 @@ class Derived2 : JFieldOwner, IFoo { } - - - } open class Mid : JFieldOwner { @@ -35,9 +27,6 @@ open class Mid : JFieldOwner { } - - - } class DerivedThroughMid1 : Mid, IFoo { @@ -47,9 +36,6 @@ class DerivedThroughMid1 : Mid, IFoo { } - - - } class DerivedThroughMid2 : Mid, IFoo { @@ -59,9 +45,6 @@ class DerivedThroughMid2 : Mid, IFoo { } - - - } fun test(b: Boolean) { diff --git a/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt.txt b/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt.txt index 706e32e32d7..8ead844afc8 100644 --- a/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt.txt @@ -17,8 +17,5 @@ class Derived : Base { #value = value } - - - } diff --git a/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt index acddda85fd6..8061ef43ab6 100644 --- a/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt @@ -31,8 +31,5 @@ class TestClass { #out /*!! PrintStream */.println(p0 = "TestClass/init") } - - - } diff --git a/compiler/testData/ir/irText/expressions/kt16904.kt.txt b/compiler/testData/ir/irText/expressions/kt16904.kt.txt index 8ad0b469529..f4e3c7039d5 100644 --- a/compiler/testData/ir/irText/expressions/kt16904.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt16904.kt.txt @@ -14,9 +14,6 @@ abstract class A { get set - - - } class B { @@ -29,9 +26,6 @@ class B { operator fun plusAssign(x: Int) { } - - - } class Test1 : A { @@ -49,9 +43,6 @@ class Test1 : A { } } - - - } class Test2 : J { @@ -65,8 +56,5 @@ class Test2 : J { #field = 42 } - - - } diff --git a/compiler/testData/ir/irText/expressions/kt16905.kt.txt b/compiler/testData/ir/irText/expressions/kt16905.kt.txt index 9cbb1a1aab9..64e44df3078 100644 --- a/compiler/testData/ir/irText/expressions/kt16905.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt16905.kt.txt @@ -12,9 +12,6 @@ class Outer { } - - - } inner class InnerDerived0 : Inner { @@ -24,9 +21,6 @@ class Outer { } - - - } inner class InnerDerived1 : Inner { @@ -36,14 +30,8 @@ class Outer { } - - - } - - - } typealias OI = Inner diff --git a/compiler/testData/ir/irText/expressions/kt23030.kt.txt b/compiler/testData/ir/irText/expressions/kt23030.kt.txt index b3bd4c4d157..3a5663bb02c 100644 --- a/compiler/testData/ir/irText/expressions/kt23030.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt23030.kt.txt @@ -51,8 +51,5 @@ class C { } } - - - } diff --git a/compiler/testData/ir/irText/expressions/kt28456.kt.txt b/compiler/testData/ir/irText/expressions/kt28456.kt.txt index b0009d1e305..647b654b1c6 100644 --- a/compiler/testData/ir/irText/expressions/kt28456.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt28456.kt.txt @@ -5,9 +5,6 @@ class A { } - - - } operator fun A.get(vararg xs: Int): Int { diff --git a/compiler/testData/ir/irText/expressions/kt28456a.kt.txt b/compiler/testData/ir/irText/expressions/kt28456a.kt.txt index 72003754a75..e36f59d42a2 100644 --- a/compiler/testData/ir/irText/expressions/kt28456a.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt28456a.kt.txt @@ -5,9 +5,6 @@ class A { } - - - } operator fun A.set(vararg i: Int, v: Int) { diff --git a/compiler/testData/ir/irText/expressions/kt28456b.kt.txt b/compiler/testData/ir/irText/expressions/kt28456b.kt.txt index d6804f792c0..2ff00d0d234 100644 --- a/compiler/testData/ir/irText/expressions/kt28456b.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt28456b.kt.txt @@ -5,9 +5,6 @@ class A { } - - - } operator fun A.get(i: Int, a: Int = 1, b: Int = 2, c: Int = 3, d: Int = 4): Int { diff --git a/compiler/testData/ir/irText/expressions/kt30020.kt.txt b/compiler/testData/ir/irText/expressions/kt30020.kt.txt index 0b61796d6ff..72a23624845 100644 --- a/compiler/testData/ir/irText/expressions/kt30020.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt30020.kt.txt @@ -4,8 +4,6 @@ interface X { abstract fun f(): MutableList - - } fun test(x: X, nx: X?) { @@ -58,33 +56,7 @@ abstract class AML : MutableList { .plusAssign(element = 300) } - - - } - - - - - - - - - - - - - - - - - - - - - - - } diff --git a/compiler/testData/ir/irText/expressions/kt35730.kt.txt b/compiler/testData/ir/irText/expressions/kt35730.kt.txt index bbe6def41d9..76ab247e155 100644 --- a/compiler/testData/ir/irText/expressions/kt35730.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt35730.kt.txt @@ -2,9 +2,6 @@ interface Base { fun foo() { } - - - } object Derived : Base { @@ -14,10 +11,6 @@ object Derived : Base { } - - - - } fun test() { diff --git a/compiler/testData/ir/irText/expressions/kt36956.kt.txt b/compiler/testData/ir/irText/expressions/kt36956.kt.txt index c2875df8452..fd7eb787089 100644 --- a/compiler/testData/ir/irText/expressions/kt36956.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt36956.kt.txt @@ -16,9 +16,6 @@ class A { operator fun set(i: Int, v: T) { } - - - } val aFloat: A diff --git a/compiler/testData/ir/irText/expressions/kt37570.kt.txt b/compiler/testData/ir/irText/expressions/kt37570.kt.txt index 511a7f5a3f8..1feada39ea7 100644 --- a/compiler/testData/ir/irText/expressions/kt37570.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt37570.kt.txt @@ -19,8 +19,5 @@ class A { ) /*~> Unit */ } - - - } diff --git a/compiler/testData/ir/irText/expressions/memberTypeArguments.kt.txt b/compiler/testData/ir/irText/expressions/memberTypeArguments.kt.txt index ffed8fe90ac..117a06696a6 100644 --- a/compiler/testData/ir/irText/expressions/memberTypeArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/memberTypeArguments.kt.txt @@ -13,8 +13,5 @@ class GenericClass { return GenericClass(value = newValue) } - - - } diff --git a/compiler/testData/ir/irText/expressions/membersImportedFromObject.kt.txt b/compiler/testData/ir/irText/expressions/membersImportedFromObject.kt.txt index 96eddea213c..2eacbd959f6 100644 --- a/compiler/testData/ir/irText/expressions/membersImportedFromObject.kt.txt +++ b/compiler/testData/ir/irText/expressions/membersImportedFromObject.kt.txt @@ -22,9 +22,6 @@ object A { return 43 } - - - } val test1: Int diff --git a/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt b/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt index 7beac7158c2..67aaed18e2b 100644 --- a/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt +++ b/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt @@ -16,14 +16,8 @@ class Outer { field = x get - - - } - - - } class Host { @@ -50,18 +44,11 @@ class Host { field = .().plus(other = .()) get - - - } - () } } - - - } diff --git a/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt b/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt index 8d2b46f20ba..3d214de2022 100644 --- a/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt +++ b/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt @@ -5,9 +5,6 @@ object A { } - - - } enum class En : Enum { @@ -19,11 +16,6 @@ enum class En : Enum { X init = TODO("IrEnumConstructorCall") - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): En /* Synthetic body for ENUM_VALUEOF */ diff --git a/compiler/testData/ir/irText/expressions/objectClassReference.kt.txt b/compiler/testData/ir/irText/expressions/objectClassReference.kt.txt index c67b1eff3b8..e6eed1deb85 100644 --- a/compiler/testData/ir/irText/expressions/objectClassReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/objectClassReference.kt.txt @@ -5,9 +5,6 @@ object A { } - - - } fun test() { diff --git a/compiler/testData/ir/irText/expressions/objectReference.kt.txt b/compiler/testData/ir/irText/expressions/objectReference.kt.txt index 613c811fe9e..14a7bdbe308 100644 --- a/compiler/testData/ir/irText/expressions/objectReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/objectReference.kt.txt @@ -41,9 +41,6 @@ object Z { Z.foo() } - - - } val aLambda: Function0 @@ -79,19 +76,12 @@ object Z { Z.foo() } - - - } - () } get - - - } fun Z.test() { diff --git a/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.kt.txt b/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.kt.txt index adb4082d614..259f55f1e76 100644 --- a/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.kt.txt @@ -9,9 +9,6 @@ abstract class Base { field = lambda get - - - } object Test : Base { @@ -24,8 +21,5 @@ object Test : Base { } - - - } diff --git a/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.kt.txt b/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.kt.txt index de292e4f24f..38519769ffc 100644 --- a/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.kt.txt +++ b/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.kt.txt @@ -18,8 +18,5 @@ object A { field = 10000 private get - - - } diff --git a/compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt.txt b/compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt.txt index beef491f733..b9239e02aa2 100644 --- a/compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt.txt @@ -19,13 +19,7 @@ class Outer { return .outer() } - - - } - - - } diff --git a/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.kt.txt b/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.kt.txt index 261741782c8..00520217d00 100644 --- a/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.kt.txt +++ b/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.kt.txt @@ -46,8 +46,5 @@ class TestImplicitArguments { field = x get - - - } diff --git a/compiler/testData/ir/irText/expressions/propertyReferences.kt.txt b/compiler/testData/ir/irText/expressions/propertyReferences.kt.txt index 5a7c79594f1..6753cc9a772 100644 --- a/compiler/testData/ir/irText/expressions/propertyReferences.kt.txt +++ b/compiler/testData/ir/irText/expressions/propertyReferences.kt.txt @@ -12,9 +12,6 @@ object Delegate { operator fun setValue(thisRef: Any?, kProp: Any, value: Int) { } - - - } open class C { @@ -34,9 +31,6 @@ open class C { get protected set - - - } val valWithBackingField: Int diff --git a/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt b/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt index e2507de1434..f05330c983a 100644 --- a/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt +++ b/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt @@ -8,9 +8,6 @@ class A { fun foo() { } - - - } fun bar() { diff --git a/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt b/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt index 81befe5abd9..bbf4d5c2f5d 100644 --- a/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt +++ b/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt @@ -10,9 +10,6 @@ class C { get set - - - } fun test(nc: C?) { diff --git a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt index 5003e3cb3e1..2e0d38619f9 100644 --- a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt +++ b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt @@ -7,9 +7,6 @@ class C { } - - - } var C?.p: Int diff --git a/compiler/testData/ir/irText/expressions/safeCalls.kt.txt b/compiler/testData/ir/irText/expressions/safeCalls.kt.txt index 033184eefc9..1c691717344 100644 --- a/compiler/testData/ir/irText/expressions/safeCalls.kt.txt +++ b/compiler/testData/ir/irText/expressions/safeCalls.kt.txt @@ -10,9 +10,6 @@ class Ref { get set - - - } interface IHost { @@ -20,9 +17,6 @@ interface IHost { return .() } - - - } fun test1(x: String?): Int? { diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt index 47a73284e4e..dbb69d78f6c 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt @@ -24,14 +24,8 @@ class Outer { field = j12 get - - - } - - - } fun test4(f: Function1, g: Function1): Inner<@FlexibleNullability Any?, @FlexibleNullability String?> { diff --git a/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt index 8b74b7bb4e0..6dacaaf3fd5 100644 --- a/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt +++ b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt @@ -13,8 +13,5 @@ class Derived : Base { } } - - - } diff --git a/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_annotation.kt.txt b/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_annotation.kt.txt index 7593e9e50a4..5ff874c983e 100644 --- a/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_annotation.kt.txt +++ b/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_annotation.kt.txt @@ -3,7 +3,5 @@ package kotlin.internal annotation class ImplicitIntegerCoercion : Annotation { constructor() /* primary */ - - } diff --git a/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.kt.txt b/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.kt.txt index 29195ac0858..b67ccc83075 100644 --- a/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.kt.txt +++ b/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.kt.txt @@ -1,13 +1,9 @@ interface I1 { - - } interface I2 { - - } operator fun I1.component1(): Int { diff --git a/compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.kt.txt b/compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.kt.txt index 4153e1dfd87..3d5368d3e83 100644 --- a/compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.kt.txt @@ -9,9 +9,6 @@ class Cell { field = value get - - - } typealias IntAlias = Cell diff --git a/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt b/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt index 19c59c3abcd..7e2d3e48b05 100644 --- a/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt +++ b/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt @@ -26,7 +26,6 @@ fun testSimple(fn: Function0) { callee.invoke() } - ::suspendConversion0 }) } @@ -37,7 +36,6 @@ fun testSimpleNonVal() { callee.invoke() } - ::suspendConversion0 }) } @@ -48,7 +46,6 @@ fun testExtAsExt(fn: @ExtensionFunctionType Function1) { callee.invoke(p1 = p0) } - ::suspendConversion0 }) } @@ -59,7 +56,6 @@ fun testExtAsSimple(fn: @ExtensionFunctionType Function1) { callee.invoke(p1 = p0) } - ::suspendConversion0 }) } @@ -70,7 +66,6 @@ fun testSimpleAsExt(fn: Function1) { callee.invoke(p1 = p0) } - ::suspendConversion0 }) } @@ -81,7 +76,6 @@ fun testSimpleAsSimpleT(fn: Function1) { callee.invoke(p1 = p0) } - ::suspendConversion0 }) } @@ -92,7 +86,6 @@ fun testSimpleAsExtT(fn: Function1) { callee.invoke(p1 = p0) } - ::suspendConversion0 }) } @@ -103,7 +96,6 @@ fun testExtAsSimpleT(fn: @ExtensionFunctionType Function1) { callee.invoke(p1 = p0) } - ::suspendConversion0 }) } @@ -114,7 +106,6 @@ fun testExtAsExtT(fn: @ExtensionFunctionType Function1) { callee.invoke(p1 = p0) } - ::suspendConversion0 }) } @@ -125,7 +116,6 @@ fun testSimpleSAsSimpleT(fn: Function1) { callee.invoke(p1 = p0) } - ::suspendConversion0 }) } @@ -136,7 +126,6 @@ fun testSimpleSAsExtT(fn: Function1) { callee.invoke(p1 = p0) } - ::suspendConversion0 }) } @@ -147,7 +136,6 @@ fun testExtSAsSimpleT(fn: @ExtensionFunctionType Function1) callee.invoke(p1 = p0) } - ::suspendConversion0 }) } @@ -158,7 +146,6 @@ fun testExtSAsExtT(fn: @ExtensionFunctionType Function1) { callee.invoke(p1 = p0) } - ::suspendConversion0 }) } @@ -170,7 +157,6 @@ fun testSmartCastWithSuspendConversion(a: Any) { callee.invoke() } - ::suspendConversion0 }) } @@ -183,7 +169,6 @@ fun testSmartCastOnVarWithSuspendConversion(a: Any) { callee.invoke() } - ::suspendConversion0 }) } diff --git a/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.kt.txt b/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.kt.txt index b04530ede70..54533111596 100644 --- a/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.kt.txt +++ b/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.kt.txt @@ -15,11 +15,6 @@ enum class En : Enum { ENTRY init = TODO("IrEnumConstructorCall") - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): En /* Synthetic body for ENUM_VALUEOF */ diff --git a/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt b/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt index 9504e2eb01b..55002ec2aea 100644 --- a/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt +++ b/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt @@ -18,8 +18,5 @@ class C { } } - - - } diff --git a/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt b/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt index 48fe3b0173f..359f6dd82ef 100644 --- a/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt +++ b/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt @@ -20,14 +20,8 @@ class Outer { field = y get - - - } - - - } fun Outer.test(): Inner { @@ -43,12 +37,8 @@ fun Outer.test(): Inner { field = .().plus(other = .()) get - - - } - () } } diff --git a/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.kt.txt b/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.kt.txt index a0d57b67f16..b230231eedc 100644 --- a/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.kt.txt @@ -9,9 +9,6 @@ open class Base { field = x get - - - } object Host { @@ -28,9 +25,6 @@ object Host { } - - - } class Derived2 : Base { @@ -40,13 +34,7 @@ object Host { } - - - } - - - } diff --git a/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt b/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt index b84ea5df90f..d8bd16379d1 100644 --- a/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt +++ b/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt @@ -7,12 +7,8 @@ fun WithCompanion.test() { } - - - } - () } val test2: = { // BLOCK @@ -23,12 +19,8 @@ fun WithCompanion.test() { } - - - } - () } } @@ -51,13 +43,7 @@ open class WithCompanion { return } - - - } - - - } diff --git a/compiler/testData/ir/irText/expressions/typeAliasConstructorReference.kt.txt b/compiler/testData/ir/irText/expressions/typeAliasConstructorReference.kt.txt index 6464cc8e12c..2e197270852 100644 --- a/compiler/testData/ir/irText/expressions/typeAliasConstructorReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/typeAliasConstructorReference.kt.txt @@ -5,9 +5,6 @@ class C { } - - - } typealias CA = C @@ -25,14 +22,8 @@ object Host { } - - - } - - - } typealias NA = Nested diff --git a/compiler/testData/ir/irText/expressions/typeOperators.kt.txt b/compiler/testData/ir/irText/expressions/typeOperators.kt.txt index bd40e188054..d6a07a733a4 100644 --- a/compiler/testData/ir/irText/expressions/typeOperators.kt.txt +++ b/compiler/testData/ir/irText/expressions/typeOperators.kt.txt @@ -1,7 +1,5 @@ interface IThing { - - } fun test1(x: Any): Boolean { diff --git a/compiler/testData/ir/irText/expressions/typeParameterClassLiteral.kt.txt b/compiler/testData/ir/irText/expressions/typeParameterClassLiteral.kt.txt index ea6db7d4e79..86ba0ec7ca5 100644 --- a/compiler/testData/ir/irText/expressions/typeParameterClassLiteral.kt.txt +++ b/compiler/testData/ir/irText/expressions/typeParameterClassLiteral.kt.txt @@ -31,8 +31,5 @@ class Host { return TV::class } - - - } diff --git a/compiler/testData/ir/irText/expressions/useImportedMember.kt.txt b/compiler/testData/ir/irText/expressions/useImportedMember.kt.txt index 3101e945445..35532431123 100644 --- a/compiler/testData/ir/irText/expressions/useImportedMember.kt.txt +++ b/compiler/testData/ir/irText/expressions/useImportedMember.kt.txt @@ -7,9 +7,6 @@ interface I { return g } - - - } open class BaseClass { @@ -24,9 +21,6 @@ open class BaseClass { return } - - - } object C : BaseClass, I { @@ -67,11 +61,6 @@ object C : BaseClass, I { return } - - - - - } fun box(): String { diff --git a/compiler/testData/ir/irText/expressions/values.kt.txt b/compiler/testData/ir/irText/expressions/values.kt.txt index 766800e5eee..98c2fc9ffe1 100644 --- a/compiler/testData/ir/irText/expressions/values.kt.txt +++ b/compiler/testData/ir/irText/expressions/values.kt.txt @@ -7,11 +7,6 @@ enum class Enum : Enum { A init = TODO("IrEnumConstructorCall") - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): Enum /* Synthetic body for ENUM_VALUEOF */ @@ -25,9 +20,6 @@ object A { } - - - } val a: Int @@ -48,14 +40,8 @@ class Z { } - - - } - - - } fun test1(): Enum { diff --git a/compiler/testData/ir/irText/expressions/when.kt.txt b/compiler/testData/ir/irText/expressions/when.kt.txt index 5c37ea8183a..e731e9caf78 100644 --- a/compiler/testData/ir/irText/expressions/when.kt.txt +++ b/compiler/testData/ir/irText/expressions/when.kt.txt @@ -5,9 +5,6 @@ object A { } - - - } fun testWithSubject(x: Any?): String { diff --git a/compiler/testData/ir/irText/firProblems/AbstractMutableMap.kt.txt b/compiler/testData/ir/irText/firProblems/AbstractMutableMap.kt.txt index 4d47ef4744f..5d5198585c6 100644 --- a/compiler/testData/ir/irText/firProblems/AbstractMutableMap.kt.txt +++ b/compiler/testData/ir/irText/firProblems/AbstractMutableMap.kt.txt @@ -14,27 +14,5 @@ class MyMap : AbstractMutableMap { return mutableSetOf>() } - - - - - - - - - - - - - - - - - - - - - - } diff --git a/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt b/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt index 572fc7d8644..be3662a35fb 100644 --- a/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt +++ b/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt @@ -5,9 +5,6 @@ class ResolvedCall { } - - - } class MyCandidate { @@ -21,9 +18,6 @@ class MyCandidate { field = resolvedCall get - - - } private fun allCandidatesResult(allCandidates: Collection): @FlexibleNullability OverloadResolutionResultsImpl<@FlexibleNullability A?>? { diff --git a/compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.kt.txt b/compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.kt.txt index 4b403e60b42..82d9bea15dc 100644 --- a/compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.kt.txt +++ b/compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.kt.txt @@ -4,9 +4,6 @@ annotation class Storage : Annotation { field = value get - - - } annotation class State : Annotation { @@ -19,9 +16,6 @@ annotation class State : Annotation { field = storages get - - - } @State(name = "1", storages = [Storage(value = "HELLO")]) @@ -32,8 +26,5 @@ class Test { } - - - } diff --git a/compiler/testData/ir/irText/firProblems/BaseFirBuilder.kt.txt b/compiler/testData/ir/irText/firProblems/BaseFirBuilder.kt.txt index 808e2406597..4f244a4522c 100644 --- a/compiler/testData/ir/irText/firProblems/BaseFirBuilder.kt.txt +++ b/compiler/testData/ir/irText/firProblems/BaseFirBuilder.kt.txt @@ -9,8 +9,5 @@ abstract class BaseFirBuilder { return block.invoke() } - - - } diff --git a/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt index 4ac329e6280..73129fe08a1 100644 --- a/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt +++ b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt @@ -1,19 +1,13 @@ interface ComponentContainer { - - } interface PlatformSpecificExtension> { - - } interface ComponentDescriptor { - - } abstract class PlatformExtensionsClashResolver> { @@ -27,9 +21,6 @@ abstract class PlatformExtensionsClashResolver> field = applicableTo get - - - } class ClashResolutionDescriptor> { @@ -47,9 +38,6 @@ class ClashResolutionDescriptor> { field = clashedComponents private get - - - } private val registrationMap: HashMap diff --git a/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt index 211a9a3ab8b..486ff7b24a4 100644 --- a/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt +++ b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt @@ -1,7 +1,5 @@ interface IrType { - - } interface TypeRemapper { @@ -9,8 +7,6 @@ interface TypeRemapper { abstract fun remapType(type: IrType): IrType abstract fun leaveScope() - - } interface IrTypeParametersContainer : IrDeclaration, IrDeclarationParent { @@ -18,30 +14,20 @@ interface IrTypeParametersContainer : IrDeclaration, IrDeclarationParent { abstract get abstract set - - - } interface IrDeclaration { - - } interface IrTypeParameter : IrDeclaration { abstract val superTypes: MutableList abstract get - - - } interface IrDeclarationParent { - - } class DeepCopyIrTreeWithSymbols { @@ -83,9 +69,6 @@ class DeepCopyIrTreeWithSymbols { ) } - - - } inline fun TypeRemapper.withinScope(irTypeParametersContainer: IrTypeParametersContainer, fn: Function0): T { diff --git a/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt index 0cf12e16dec..1628eec04df 100644 --- a/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt +++ b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt @@ -51,9 +51,6 @@ class Impl : A, B { return #$$delegate_0.() } - - - } fun box(): String { diff --git a/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt b/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt index a82b4db611b..dd2f50ea9eb 100644 --- a/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt +++ b/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt @@ -26,9 +26,6 @@ fun box(): String { return .().plus(other = .()) } - - - } local open inner class Base { @@ -42,17 +39,10 @@ fun box(): String { field = s get - - - } - - - } - () } return obj.foo() diff --git a/compiler/testData/ir/irText/firProblems/MultiList.kt.txt b/compiler/testData/ir/irText/firProblems/MultiList.kt.txt index 818cbe181a4..a15efac40c9 100644 --- a/compiler/testData/ir/irText/firProblems/MultiList.kt.txt +++ b/compiler/testData/ir/irText/firProblems/MultiList.kt.txt @@ -49,22 +49,6 @@ data class Some { interface MyList : List> { - - - - - - - - - - - - - - - - } open class SomeList : MyList, ArrayList> { @@ -74,42 +58,6 @@ open class SomeList : MyList, ArrayList> { } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - } class FinalList : SomeList { @@ -119,41 +67,5 @@ class FinalList : SomeList { } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - } diff --git a/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt b/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt index 9dd093e8b12..77b50e068a2 100644 --- a/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt +++ b/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt @@ -14,29 +14,19 @@ object Factory { return "Omega" } - - - } interface Base { - - } interface Delegate : Base { abstract fun bar() - - } interface Derived : Delegate { - - - } data class DataClass : Derived, Delegate { diff --git a/compiler/testData/ir/irText/firProblems/VarInInit.kt.txt b/compiler/testData/ir/irText/firProblems/VarInInit.kt.txt index cf1f115f43c..d1ac0d01a32 100644 --- a/compiler/testData/ir/irText/firProblems/VarInInit.kt.txt +++ b/compiler/testData/ir/irText/firProblems/VarInInit.kt.txt @@ -18,8 +18,5 @@ class Some { } } - - - } diff --git a/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt b/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt index ca0b05b3d06..d67903a698c 100644 --- a/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt +++ b/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt @@ -9,9 +9,6 @@ class Candidate { field = symbol get - - - } abstract class AbstractFirBasedSymbol where E : FirSymbolOwner, E : FirDeclaration { @@ -25,33 +22,22 @@ abstract class AbstractFirBasedSymbol where E : FirSymbolOwner, E : FirDec get set - - - } interface FirDeclaration { - - } interface FirSymbolOwner where E : FirSymbolOwner, E : FirDeclaration { abstract val symbol: AbstractFirBasedSymbol abstract get - - - } interface FirCallableMemberDeclaration> : FirSymbolOwner, FirDeclaration { abstract override val symbol: AbstractFirBasedSymbol abstract override get - - - } fun foo(candidate: Candidate) { diff --git a/compiler/testData/ir/irText/firProblems/putIfAbsent.kt.txt b/compiler/testData/ir/irText/firProblems/putIfAbsent.kt.txt index b40c904496c..8806823616d 100644 --- a/compiler/testData/ir/irText/firProblems/putIfAbsent.kt.txt +++ b/compiler/testData/ir/irText/firProblems/putIfAbsent.kt.txt @@ -10,8 +10,5 @@ class Owner { map.putIfAbsent(p0 = x, p1 = y) /*~> Unit */ } - - - } diff --git a/compiler/testData/ir/irText/firProblems/v8arrayToList.kt.txt b/compiler/testData/ir/irText/firProblems/v8arrayToList.kt.txt index a01e40c8e3c..c6342544da1 100644 --- a/compiler/testData/ir/irText/firProblems/v8arrayToList.kt.txt +++ b/compiler/testData/ir/irText/firProblems/v8arrayToList.kt.txt @@ -5,9 +5,6 @@ class V8Array { } - - - } fun box(): String { diff --git a/compiler/testData/ir/irText/lambdas/localFunction.kt.txt b/compiler/testData/ir/irText/lambdas/localFunction.kt.txt index 2824390cd82..7251b63792a 100644 --- a/compiler/testData/ir/irText/lambdas/localFunction.kt.txt +++ b/compiler/testData/ir/irText/lambdas/localFunction.kt.txt @@ -8,7 +8,6 @@ fun outer() { } /*~> Unit */ } - local() } diff --git a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt index 6f72c26c9af..174418edc75 100644 --- a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt +++ b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt @@ -5,9 +5,6 @@ object A { } - - - } object B { @@ -17,9 +14,6 @@ object B { } - - - } interface IFoo { @@ -28,9 +22,6 @@ interface IFoo { return B } - - - } interface IInvoke { @@ -38,9 +29,6 @@ interface IInvoke { return 42 } - - - } fun test(fooImpl: IFoo, invokeImpl: IInvoke) { diff --git a/compiler/testData/ir/irText/regressions/integerCoercionToT.kt.txt b/compiler/testData/ir/irText/regressions/integerCoercionToT.kt.txt index eff25bcc191..1b6f4313f15 100644 --- a/compiler/testData/ir/irText/regressions/integerCoercionToT.kt.txt +++ b/compiler/testData/ir/irText/regressions/integerCoercionToT.kt.txt @@ -1,7 +1,5 @@ interface CPointed { - - } inline fun CPointed.reinterpret(): T { @@ -15,9 +13,6 @@ class CInt32VarX : CPointed { } - - - } typealias CInt32Var = CInt32VarX @@ -39,9 +34,6 @@ class IdType : CPointed { field = value get - - - } fun foo(value: IdType, cv: CInt32VarX) { diff --git a/compiler/testData/ir/irText/regressions/newInference/fixationOrder1.kt.txt b/compiler/testData/ir/irText/regressions/newInference/fixationOrder1.kt.txt index 541186a002a..4b06006e664 100644 --- a/compiler/testData/ir/irText/regressions/newInference/fixationOrder1.kt.txt +++ b/compiler/testData/ir/irText/regressions/newInference/fixationOrder1.kt.txt @@ -4,8 +4,6 @@ fun foo(): Function1 { interface Inv2 { - - } fun check(x: T, y: R, f: Function1): Inv2 { diff --git a/compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.kt.txt b/compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.kt.txt index 8848b86f172..5d5f67df51b 100644 --- a/compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.kt.txt +++ b/compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.kt.txt @@ -9,9 +9,6 @@ class A { field = q get - - - } typealias B = A diff --git a/compiler/testData/ir/irText/singletons/companion.kt.txt b/compiler/testData/ir/irText/singletons/companion.kt.txt index b1c4ca900ed..4b5b9297218 100644 --- a/compiler/testData/ir/irText/singletons/companion.kt.txt +++ b/compiler/testData/ir/irText/singletons/companion.kt.txt @@ -19,13 +19,7 @@ class Z { fun test() { } - - - } - - - } diff --git a/compiler/testData/ir/irText/singletons/enumEntry.kt.txt b/compiler/testData/ir/irText/singletons/enumEntry.kt.txt index 30252f8a6a6..6a61e578825 100644 --- a/compiler/testData/ir/irText/singletons/enumEntry.kt.txt +++ b/compiler/testData/ir/irText/singletons/enumEntry.kt.txt @@ -7,11 +7,6 @@ open enum class Z : Enum { ENTRY init = TODO("IrEnumConstructorCall") - - - - - fun values(): Array /* Synthetic body for ENUM_VALUES */ fun valueOf(value: String): Z /* Synthetic body for ENUM_VALUEOF */ diff --git a/compiler/testData/ir/irText/singletons/object.kt.txt b/compiler/testData/ir/irText/singletons/object.kt.txt index 2f030b0034c..dd40a2ad61b 100644 --- a/compiler/testData/ir/irText/singletons/object.kt.txt +++ b/compiler/testData/ir/irText/singletons/object.kt.txt @@ -19,13 +19,7 @@ object Z { Z.test() } - - - } - - - } diff --git a/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m1.kt.txt b/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m1.kt.txt index 50383959c5f..ef2fdb8760d 100644 --- a/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m1.kt.txt +++ b/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m1.kt.txt @@ -18,8 +18,5 @@ abstract class Base { abstract get abstract set - - - } diff --git a/compiler/testData/ir/irText/stubs/javaInnerClass.kt.txt b/compiler/testData/ir/irText/stubs/javaInnerClass.kt.txt index b194aaedf0d..c0929319ab2 100644 --- a/compiler/testData/ir/irText/stubs/javaInnerClass.kt.txt +++ b/compiler/testData/ir/irText/stubs/javaInnerClass.kt.txt @@ -9,9 +9,5 @@ class Test1 : J { field = .JInner() get - - - - } diff --git a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt index 93f7ead5276..d35506ad777 100644 --- a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt +++ b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt @@ -81,9 +81,6 @@ class SafeCollector : FlowCollector { override suspend fun emit(value: T) { } - - - } @OptIn(markerClass = [ExperimentalTypeInference::class]) @@ -109,35 +106,24 @@ open class ChannelCoroutine { suspend fun sendFair(element: E) { } - - - } interface CoroutineScope { - - } interface Flow { abstract suspend fun collect(collector: FlowCollector) - - } interface FlowCollector { abstract suspend fun emit(value: T) - - } interface ReceiveChannel { - - } @OptIn(markerClass = [ExperimentalTypeInference::class]) @@ -149,16 +135,10 @@ interface ProducerScope : CoroutineScope, SendChannel { abstract val channel: SendChannel abstract get - - - - } interface SendChannel { abstract suspend fun send(e: E) - - } diff --git a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt index c09549b34e2..40374b472e6 100644 --- a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt +++ b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt @@ -14,30 +14,21 @@ class Value> { field = value2 get - - - } interface IDelegate1 { abstract operator fun getValue(t: T1, p: KProperty<*>): R1 - - } interface IDelegate2 { abstract operator fun getValue(t: T2, p: KProperty<*>): R2 - - } interface IR { abstract fun foo(): R - - } class CR : IR { @@ -55,9 +46,6 @@ class CR : IR { return .() } - - - } class P { @@ -75,9 +63,6 @@ class P { field = p2 get - - - } val Value>.additionalText: P /* by */ @@ -118,12 +103,8 @@ val Value>.additionalText: P /* by */ return t.foo() /*as Any? */ } - - - } - () } private get(): Any? { @@ -143,12 +124,8 @@ val Value>.additionalText: P /* by */ return t.().foo() /*as Any? */ } - - - } - () } private get(): Any? { @@ -159,12 +136,8 @@ val Value>.additionalText: P /* by */ return P(p1 = (, t).() /*as Any? */, p2 = (, t).() /*as Any? */) } - - - } - () } get(): P { diff --git a/compiler/testData/ir/irText/types/genericFunWithStar.kt.txt b/compiler/testData/ir/irText/types/genericFunWithStar.kt.txt index 4f25efa9c00..55c9fa2d75b 100644 --- a/compiler/testData/ir/irText/types/genericFunWithStar.kt.txt +++ b/compiler/testData/ir/irText/types/genericFunWithStar.kt.txt @@ -1,25 +1,17 @@ interface IBase { - - } interface IFoo : IBase { - - } interface IBar : IBase { - - } interface I where G : IFoo, G : IBar { - - } abstract class Box : IFoo, IBar where T : IFoo, T : IBar { @@ -34,8 +26,5 @@ abstract class Box : IFoo, IBar where T : IFoo, T : IBar { return .foo(tSerializer = serializers.get(index = 0)) } - - - } diff --git a/compiler/testData/ir/irText/types/genericPropertyReferenceType.kt.txt b/compiler/testData/ir/irText/types/genericPropertyReferenceType.kt.txt index efbea8dccb5..d1dc3ceac01 100644 --- a/compiler/testData/ir/irText/types/genericPropertyReferenceType.kt.txt +++ b/compiler/testData/ir/irText/types/genericPropertyReferenceType.kt.txt @@ -10,9 +10,6 @@ class C { get set - - - } var C.y: T diff --git a/compiler/testData/ir/irText/types/inStarProjectionInReceiverType.kt.txt b/compiler/testData/ir/irText/types/inStarProjectionInReceiverType.kt.txt index ff7854095ab..e2dfea3a07c 100644 --- a/compiler/testData/ir/irText/types/inStarProjectionInReceiverType.kt.txt +++ b/compiler/testData/ir/irText/types/inStarProjectionInReceiverType.kt.txt @@ -4,8 +4,6 @@ interface Foo { abstract fun foo(x: T) - - } fun Foo<*>.testReceiver(): Int { diff --git a/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt b/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt index 568deb3416b..c057dd0ddf2 100644 --- a/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt @@ -5,9 +5,6 @@ class In { } - - - } fun select(x: S, y: S): S { diff --git a/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt b/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt index b0234031d71..43d506d5c62 100644 --- a/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt @@ -5,9 +5,6 @@ class In { } - - - } fun select(x: S, y: S): S { diff --git a/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt b/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt index bb3cefa634b..574ca44d268 100644 --- a/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt @@ -1,13 +1,9 @@ interface A { - - } interface Foo { - - } open class B : Foo, A { @@ -17,9 +13,6 @@ open class B : Foo, A { } - - - } open class C : Foo, A { @@ -29,9 +22,6 @@ open class C : Foo, A { } - - - } fun run(fn: Function0): T { diff --git a/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt b/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt index bb3cefa634b..574ca44d268 100644 --- a/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt @@ -1,13 +1,9 @@ interface A { - - } interface Foo { - - } open class B : Foo, A { @@ -17,9 +13,6 @@ open class B : Foo, A { } - - - } open class C : Foo, A { @@ -29,9 +22,6 @@ open class C : Foo, A { } - - - } fun run(fn: Function0): T { diff --git a/compiler/testData/ir/irText/types/intersectionType3_NI.kt.txt b/compiler/testData/ir/irText/types/intersectionType3_NI.kt.txt index 73ba6697aad..cdf61cbb830 100644 --- a/compiler/testData/ir/irText/types/intersectionType3_NI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType3_NI.kt.txt @@ -1,7 +1,5 @@ interface In { - - } inline fun In.isT(): Boolean { @@ -18,38 +16,26 @@ fun sel(x: S, y: S): S { interface A { - - } interface B { - - } interface A1 : A { - - } interface A2 : A { - - } interface Z1 : A, B { - - } interface Z2 : A, B { - - } fun testInIs1(x: In, y: In): Boolean { diff --git a/compiler/testData/ir/irText/types/intersectionType3_OI.kt.txt b/compiler/testData/ir/irText/types/intersectionType3_OI.kt.txt index e1dc3be1f36..96efd3ff991 100644 --- a/compiler/testData/ir/irText/types/intersectionType3_OI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType3_OI.kt.txt @@ -1,7 +1,5 @@ interface In { - - } inline fun In.isT(): Boolean { @@ -18,38 +16,26 @@ fun sel(x: S, y: S): S { interface A { - - } interface B { - - } interface A1 : A { - - } interface A2 : A { - - } interface Z1 : A, B { - - } interface Z2 : A, B { - - } fun testInIs1(x: In, y: In): Boolean { diff --git a/compiler/testData/ir/irText/types/javaWildcardType.kt.txt b/compiler/testData/ir/irText/types/javaWildcardType.kt.txt index 901940a1b58..cbc7cd71d0d 100644 --- a/compiler/testData/ir/irText/types/javaWildcardType.kt.txt +++ b/compiler/testData/ir/irText/types/javaWildcardType.kt.txt @@ -4,8 +4,6 @@ interface K { abstract fun kg1(c: Collection) abstract fun kg2(c: Collection) - - } class C : J, K { @@ -49,8 +47,5 @@ class C : J, K { #$$delegate_1.kg2(c = c) } - - - } diff --git a/compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.kt.txt b/compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.kt.txt index 7c5f4680669..71bb74b8449 100644 --- a/compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.kt.txt +++ b/compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.kt.txt @@ -1,37 +1,26 @@ interface In { - - } interface Inv { abstract val t: T abstract get - - - } interface Z { abstract fun create(x: In, y: In): Inv - - } interface IA { abstract fun foo() - - } interface IB { abstract fun bar() - - } fun test(a: In, b: In, z: Z) { diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt index d8560ef46ae..f966819325d 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt @@ -24,9 +24,6 @@ class P { return .() } - - - } class Q { @@ -52,9 +49,6 @@ class Q { return .() } - - - } fun test1() { diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt index ffbc1791fe6..ce4f471c77a 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt @@ -72,8 +72,6 @@ fun testForInArrayUse(j: J) { interface K { abstract fun arrayOfNotNull(): Array

- - } data class P { diff --git a/compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.kt.txt b/compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.kt.txt index 7638e6b31c5..11d1be9d399 100644 --- a/compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.kt.txt @@ -29,9 +29,6 @@ class MySet : Set { TODO() } - - - } fun test() { diff --git a/compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.kt.txt index 41e674060ba..6cbaf6a8c40 100644 --- a/compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.kt.txt @@ -11,9 +11,6 @@ class C { fun String.memberExtension() { } - - - } fun testExt() { diff --git a/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt b/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt index d412047c67b..43651f519ba 100644 --- a/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt +++ b/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt @@ -5,9 +5,6 @@ class GenericInv { } - - - } class GenericIn { @@ -17,9 +14,6 @@ class GenericIn { } - - - } class GenericOut { @@ -29,9 +23,6 @@ class GenericOut { } - - - } fun testReturnsRawGenericInv(j: JRaw): @FlexibleNullability @RawType GenericInv? { @@ -86,8 +77,5 @@ class KRaw : JRaw { #$$delegate_0.takesRawList(list = list) } - - - } diff --git a/compiler/testData/ir/irText/types/receiverOfIntersectionType.kt.txt b/compiler/testData/ir/irText/types/receiverOfIntersectionType.kt.txt index 10f3b64dd6c..c076079c977 100644 --- a/compiler/testData/ir/irText/types/receiverOfIntersectionType.kt.txt +++ b/compiler/testData/ir/irText/types/receiverOfIntersectionType.kt.txt @@ -1,20 +1,14 @@ interface K { - - } interface I : K { abstract fun ff() - - } interface J : K { - - } class A : I, J { @@ -27,9 +21,6 @@ class A : I, J { override fun ff() { } - - - } class B : I, J { @@ -42,9 +33,6 @@ class B : I, J { override fun ff() { } - - - } fun testIntersection(a: A, b: B) { diff --git a/compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.kt.txt b/compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.kt.txt index 76086dc681c..ccb1069a61a 100644 --- a/compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.kt.txt +++ b/compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.kt.txt @@ -27,9 +27,6 @@ open class A { } } - - - } class B : A { @@ -53,12 +50,6 @@ class B : A { } } - - - - - - } open class GA { @@ -76,9 +67,6 @@ open class GA { field = 42 get - - - } class GB : GA { @@ -94,9 +82,5 @@ class GB : GA { a /*as GB<*, *> */.() /*~> Unit */ } - - - - } diff --git a/compiler/testData/ir/irText/types/smartCastOnReceiverOfGenericType.kt.txt b/compiler/testData/ir/irText/types/smartCastOnReceiverOfGenericType.kt.txt index 24b145f0ba0..8ee3aaef8ba 100644 --- a/compiler/testData/ir/irText/types/smartCastOnReceiverOfGenericType.kt.txt +++ b/compiler/testData/ir/irText/types/smartCastOnReceiverOfGenericType.kt.txt @@ -35,9 +35,6 @@ class Cell { get set - - - } class Outer { @@ -57,13 +54,7 @@ class Outer { fun use(x1: T1, x2: T2) { } - - - } - - - } diff --git a/compiler/testData/ir/irText/types/starProjection_OI.kt.txt b/compiler/testData/ir/irText/types/starProjection_OI.kt.txt index e112139fad3..37cb8a60b0c 100644 --- a/compiler/testData/ir/irText/types/starProjection_OI.kt.txt +++ b/compiler/testData/ir/irText/types/starProjection_OI.kt.txt @@ -1,7 +1,5 @@ interface Continuation { - - } abstract class C { @@ -13,7 +11,5 @@ abstract class C { abstract fun dispatchResumeWithException(exception: Throwable, continuation: Continuation<*>): Boolean - - } From 5500b014f533d76016f58e7338a02074ba227544 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Fri, 6 Nov 2020 03:23:26 +0300 Subject: [PATCH 142/698] [IR] update testdata: better support for IrEnumConstructorCall and IrEnumEntry --- .../testData/ir/irText/classes/classes.kt.txt | 2 +- .../testData/ir/irText/classes/enum.kt.txt | 85 ++++++++++++++++--- .../irText/classes/enumClassModality.kt.txt | 79 ++++++++++++++--- .../classes/enumWithMultipleCtors.kt.txt | 24 +++++- .../classes/enumWithSecondaryCtor.kt.txt | 46 ++++++++-- .../annotations/classesWithAnnotations.kt.txt | 2 +- .../enumEntriesWithAnnotations.kt.txt | 21 ++++- .../enumsInAnnotationArguments.kt.txt | 10 ++- .../multiplatform/expectedEnumClass.kt.txt | 9 +- .../expressions/enumEntryAsReceiver.kt.txt | 25 +++++- ...numEntryReferenceFromEnumEntryClass.kt.txt | 58 ++++++++++++- .../exhaustiveWhenElseBranch.kt.txt | 4 +- .../expressions/objectAsCallable.kt.txt | 4 +- .../temporaryInEnumEntryInitializer.kt.txt | 10 ++- .../ir/irText/expressions/values.kt.txt | 4 +- .../ir/irText/firProblems/FirBuilder.kt.txt | 8 -- .../ir/irText/singletons/enumEntry.kt.txt | 28 +++++- .../genericClassInDifferentModule_m2.kt.txt | 3 - 18 files changed, 352 insertions(+), 70 deletions(-) diff --git a/compiler/testData/ir/irText/classes/classes.kt.txt b/compiler/testData/ir/irText/classes/classes.kt.txt index e1e793454e9..e92e77ca60b 100644 --- a/compiler/testData/ir/irText/classes/classes.kt.txt +++ b/compiler/testData/ir/irText/classes/classes.kt.txt @@ -27,7 +27,7 @@ annotation class TestAnnotationClass : Annotation { enum class TestEnumClass : Enum { private constructor() /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/classes/enum.kt.txt b/compiler/testData/ir/irText/classes/enum.kt.txt index b8ac6ed26ab..37cbf03ac13 100644 --- a/compiler/testData/ir/irText/classes/enum.kt.txt +++ b/compiler/testData/ir/irText/classes/enum.kt.txt @@ -1,11 +1,13 @@ enum class TestEnum1 : Enum { private constructor() /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } - TEST1 init = TODO("IrEnumConstructorCall") TEST2 init = TODO("IrEnumConstructorCall") + TEST1 = TestEnum1() + + TEST2 = TestEnum1() fun values(): Array /* Synthetic body for ENUM_VALUES */ @@ -15,7 +17,7 @@ enum class TestEnum1 : Enum { enum class TestEnum2 : Enum { private constructor(x: Int) /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } @@ -24,7 +26,11 @@ enum class TestEnum2 : Enum { field = x get - TEST1 init = TODO("IrEnumConstructorCall") TEST2 init = TODO("IrEnumConstructorCall") TEST3 init = TODO("IrEnumConstructorCall") + TEST1 = TestEnum2(x = 1) + + TEST2 = TestEnum2(x = 2) + + TEST3 = TestEnum2(x = 3) fun values(): Array /* Synthetic body for ENUM_VALUES */ @@ -34,12 +40,26 @@ enum class TestEnum2 : Enum { abstract enum class TestEnum3 : Enum { private constructor() /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } - TEST init = TODO("IrEnumConstructorCall") abstract fun foo() + TEST = TEST() + private enum entry class TEST : TestEnum3 { + private constructor() /* primary */ { + super/*TestEnum3*/() /*~> Unit */ + /* InstanceInitializerCall */ + + } + + override fun foo() { + println(message = "Hello, world!") + } + + } + + abstract fun foo() fun values(): Array /* Synthetic body for ENUM_VALUES */ @@ -49,7 +69,7 @@ abstract enum class TestEnum3 : Enum { abstract enum class TestEnum4 : Enum { private constructor(x: Int) /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } @@ -58,7 +78,42 @@ abstract enum class TestEnum4 : Enum { field = x get - TEST1 init = TODO("IrEnumConstructorCall") TEST2 init = TODO("IrEnumConstructorCall") abstract fun foo() + TEST1 = TEST1() + private enum entry class TEST1 : TestEnum4 { + private constructor() /* primary */ { + super/*TestEnum4*/(x = 1) /*~> Unit */ + /* InstanceInitializerCall */ + + } + + override fun foo() { + println(message = TestEnum4) + } + + } + + TEST2 = TEST2() + private enum entry class TEST2 : TestEnum4 { + private constructor() /* primary */ { + super/*TestEnum4*/(x = 2) /*~> Unit */ + /* InstanceInitializerCall */ + + } + + val z: Int + get + + init { + #z = .() + } + + override fun foo() { + println(message = TestEnum4) + } + + } + + abstract fun foo() fun values(): Array /* Synthetic body for ENUM_VALUES */ @@ -68,7 +123,7 @@ abstract enum class TestEnum4 : Enum { enum class TestEnum5 : Enum { private constructor(x: Int = 0) /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } @@ -77,7 +132,11 @@ enum class TestEnum5 : Enum { field = x get - TEST1 init = TODO("IrEnumConstructorCall") TEST2 init = TODO("IrEnumConstructorCall") TEST3 init = TODO("IrEnumConstructorCall") + TEST1 = TestEnum5() + + TEST2 = TestEnum5() + + TEST3 = TestEnum5(x = 0) fun values(): Array /* Synthetic body for ENUM_VALUES */ @@ -91,7 +150,7 @@ fun f(): Int { enum class TestEnum6 : Enum { private constructor(x: Int, y: Int) /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } @@ -104,10 +163,10 @@ enum class TestEnum6 : Enum { field = y get - TEST init = { // BLOCK + TEST = { // BLOCK val tmp0_y: Int = f() val tmp1_x: Int = f() - TODO("IrEnumConstructorCall") + TestEnum6(x = tmp1_x, y = tmp0_y) } fun values(): Array /* Synthetic body for ENUM_VALUES */ diff --git a/compiler/testData/ir/irText/classes/enumClassModality.kt.txt b/compiler/testData/ir/irText/classes/enumClassModality.kt.txt index 4443fe2d8a7..df83a07a71b 100644 --- a/compiler/testData/ir/irText/classes/enumClassModality.kt.txt +++ b/compiler/testData/ir/irText/classes/enumClassModality.kt.txt @@ -1,11 +1,11 @@ enum class TestFinalEnum1 : Enum { private constructor() /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } - X1 init = TODO("IrEnumConstructorCall") + X1 = TestFinalEnum1() fun values(): Array /* Synthetic body for ENUM_VALUES */ @@ -15,7 +15,7 @@ enum class TestFinalEnum1 : Enum { enum class TestFinalEnum2 : Enum { private constructor(x: Int) /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } @@ -24,7 +24,7 @@ enum class TestFinalEnum2 : Enum { field = x get - X1 init = TODO("IrEnumConstructorCall") + X1 = TestFinalEnum2(x = 1) fun values(): Array /* Synthetic body for ENUM_VALUES */ @@ -34,12 +34,14 @@ enum class TestFinalEnum2 : Enum { enum class TestFinalEnum3 : Enum { private constructor() /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } - X1 init = TODO("IrEnumConstructorCall") fun doStuff() { + X1 = TestFinalEnum3() + + fun doStuff() { } fun values(): Array /* Synthetic body for ENUM_VALUES */ @@ -50,12 +52,24 @@ enum class TestFinalEnum3 : Enum { open enum class TestOpenEnum1 : Enum { private constructor() /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } - X1 init = TODO("IrEnumConstructorCall") + X1 = X1() + private enum entry class X1 : TestOpenEnum1 { + private constructor() /* primary */ { + super/*TestOpenEnum1*/() /*~> Unit */ + /* InstanceInitializerCall */ + + } + + override fun toString(): String { + return "X1" + } + + } fun values(): Array /* Synthetic body for ENUM_VALUES */ @@ -65,12 +79,25 @@ open enum class TestOpenEnum1 : Enum { open enum class TestOpenEnum2 : Enum { private constructor() /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } - X1 init = TODO("IrEnumConstructorCall") open fun foo() { + X1 = X1() + private enum entry class X1 : TestOpenEnum2 { + private constructor() /* primary */ { + super/*TestOpenEnum2*/() /*~> Unit */ + /* InstanceInitializerCall */ + + } + + override fun foo() { + } + + } + + open fun foo() { } fun values(): Array /* Synthetic body for ENUM_VALUES */ @@ -81,12 +108,25 @@ open enum class TestOpenEnum2 : Enum { abstract enum class TestAbstractEnum1 : Enum { private constructor() /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } - X1 init = TODO("IrEnumConstructorCall") abstract fun foo() + X1 = X1() + private enum entry class X1 : TestAbstractEnum1 { + private constructor() /* primary */ { + super/*TestAbstractEnum1*/() /*~> Unit */ + /* InstanceInitializerCall */ + + } + + override fun foo() { + } + + } + + abstract fun foo() fun values(): Array /* Synthetic body for ENUM_VALUES */ @@ -101,12 +141,23 @@ interface IFoo { abstract enum class TestAbstractEnum2 : Enum, IFoo { private constructor() /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } - X1 init = TODO("IrEnumConstructorCall") + X1 = X1() + private enum entry class X1 : TestAbstractEnum2 { + private constructor() /* primary */ { + super/*TestAbstractEnum2*/() /*~> Unit */ + /* InstanceInitializerCall */ + + } + + override fun foo() { + } + + } fun values(): Array /* Synthetic body for ENUM_VALUES */ diff --git a/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt b/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt index fc478384828..b32cb50bb3c 100644 --- a/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt +++ b/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt @@ -1,5 +1,23 @@ open enum class A : Enum { - X init = TODO("IrEnumConstructorCall") Y init = TODO("IrEnumConstructorCall") Z init = TODO("IrEnumConstructorCall") val prop1: String + X = A(arg = "asd") + + Y = Y() + private enum entry class Y : A { + private constructor() /* primary */ { + super/*A*/() /*~> Unit */ + /* InstanceInitializerCall */ + + } + + override fun f(): String { + return super.f().plus(other = "#Y") + } + + } + + Z = A(x = 5) + + val prop1: String get val prop2: String @@ -12,14 +30,14 @@ open enum class A : Enum { set private constructor(arg: String) { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ #prop1 = arg } private constructor() { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ #prop1 = "default" diff --git a/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt.txt b/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt.txt index 995c4521e02..263a8dd14b0 100644 --- a/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt.txt +++ b/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt.txt @@ -1,6 +1,6 @@ enum class Test0 : Enum { private constructor(x: Int) /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } @@ -9,7 +9,9 @@ enum class Test0 : Enum { field = x get - ZERO init = TODO("IrEnumConstructorCall") private constructor() { + ZERO = Test0() + + private constructor() { this/*Test0*/(x = 0) } @@ -21,7 +23,7 @@ enum class Test0 : Enum { enum class Test1 : Enum { private constructor(x: Int) /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } @@ -30,7 +32,11 @@ enum class Test1 : Enum { field = x get - ZERO init = TODO("IrEnumConstructorCall") ONE init = TODO("IrEnumConstructorCall") private constructor() { + ZERO = Test1() + + ONE = Test1(x = 1) + + private constructor() { this/*Test1*/(x = 0) } @@ -42,7 +48,7 @@ enum class Test1 : Enum { abstract enum class Test2 : Enum { private constructor(x: Int) /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } @@ -51,7 +57,35 @@ abstract enum class Test2 : Enum { field = x get - ZERO init = TODO("IrEnumConstructorCall") ONE init = TODO("IrEnumConstructorCall") private constructor() { + ZERO = ZERO() + private enum entry class ZERO : Test2 { + private constructor() /* primary */ { + super/*Test2*/() /*~> Unit */ + /* InstanceInitializerCall */ + + } + + override fun foo() { + println(message = "ZERO") + } + + } + + ONE = ONE() + private enum entry class ONE : Test2 { + private constructor() /* primary */ { + super/*Test2*/(x = 1) /*~> Unit */ + /* InstanceInitializerCall */ + + } + + override fun foo() { + println(message = "ONE") + } + + } + + private constructor() { this/*Test2*/(x = 0) } diff --git a/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt index 534e06beef1..d847caba86d 100644 --- a/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt @@ -53,7 +53,7 @@ class Host { @TestAnn(x = "enum") enum class TestEnum : Enum { private constructor() /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } diff --git a/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.kt.txt index 02edbb448d9..c75c1884183 100644 --- a/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.kt.txt @@ -8,14 +8,29 @@ annotation class TestAnn : Annotation { open enum class TestEnum : Enum { private constructor() /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } @TestAnn(x = "ENTRY1") - ENTRY1 init = TODO("IrEnumConstructorCall") @TestAnn(x = "ENTRY2") - ENTRY2 init = TODO("IrEnumConstructorCall") + ENTRY1 = TestEnum() + + @TestAnn(x = "ENTRY2") + ENTRY2 = ENTRY2() + @TestAnn(x = "ENTRY2") + private enum entry class ENTRY2 : TestEnum { + private constructor() /* primary */ { + super/*TestEnum*/() /*~> Unit */ + /* InstanceInitializerCall */ + + } + + val x: Int + field = 42 + get + + } fun values(): Array /* Synthetic body for ENUM_VALUES */ diff --git a/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt index d65b4df9e6d..d242b9165bf 100644 --- a/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt @@ -1,11 +1,17 @@ enum class En : Enum { private constructor() /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } - A init = TODO("IrEnumConstructorCall") B init = TODO("IrEnumConstructorCall") C init = TODO("IrEnumConstructorCall") D init = TODO("IrEnumConstructorCall") + A = En() + + B = En() + + C = En() + + D = En() fun values(): Array /* Synthetic body for ENUM_VALUES */ diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.kt.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.kt.txt index 8dc5853177d..c7f3b5d4ed7 100644 --- a/compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.kt.txt +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.kt.txt @@ -1,5 +1,6 @@ expect enum class MyEnum : Enum { FOO + BAR fun values(): Array /* Synthetic body for ENUM_VALUES */ @@ -10,12 +11,16 @@ expect enum class MyEnum : Enum { enum class MyEnum : Enum { private constructor() /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } - FOO init = TODO("IrEnumConstructorCall") BAR init = TODO("IrEnumConstructorCall") BAZ init = TODO("IrEnumConstructorCall") + FOO = MyEnum() + + BAR = MyEnum() + + BAZ = MyEnum() fun values(): Array /* Synthetic body for ENUM_VALUES */ diff --git a/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt b/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt index e28e71ff06a..34bf34fce0e 100644 --- a/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt +++ b/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt @@ -1,11 +1,32 @@ abstract enum class X : Enum { private constructor() /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } - B init = TODO("IrEnumConstructorCall") abstract val value: Function0 + B = B() + private enum entry class B : X { + private constructor() /* primary */ { + super/*X*/() /*~> Unit */ + /* InstanceInitializerCall */ + + } + + val value2: String + field = "OK" + get + + override val value: Function0 + field = local fun (): String { + return B.() + } + + override get + + } + + abstract val value: Function0 abstract get fun values(): Array /* Synthetic body for ENUM_VALUES */ diff --git a/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt index 054127a2884..7aa56b4715f 100644 --- a/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt +++ b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt @@ -1,11 +1,65 @@ open enum class MyEnum : Enum { private constructor() /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } - Z init = TODO("IrEnumConstructorCall") + Z = Z() + private enum entry class Z : MyEnum { + private constructor() /* primary */ { + super/*MyEnum*/() /*~> Unit */ + /* InstanceInitializerCall */ + + } + + var counter: Int + field = 0 + get + set + + fun foo() { + } + + fun bar() { + .( = 1) + .foo() + } + + val aLambda: Function0 + field = local fun () { + Z.( = 1) + Z.foo() + } + + get + + val anObject: Any + field = { // BLOCK + local class { + constructor() /* primary */ { + super/*Any*/() + /* InstanceInitializerCall */ + + } + + init { + Z.( = 1) + Z.foo() + } + + fun test() { + Z.( = 1) + Z.foo() + } + + } + + () + } + get + + } fun values(): Array /* Synthetic body for ENUM_VALUES */ diff --git a/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt b/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt index 7c80a404e92..0b8c3ca9914 100644 --- a/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt +++ b/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt @@ -1,11 +1,11 @@ enum class A : Enum { private constructor() /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } - V1 init = TODO("IrEnumConstructorCall") + V1 = A() fun values(): Array /* Synthetic body for ENUM_VALUES */ diff --git a/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt b/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt index 3d214de2022..4db230c91ce 100644 --- a/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt +++ b/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt @@ -9,12 +9,12 @@ object A { enum class En : Enum { private constructor() /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } - X init = TODO("IrEnumConstructorCall") + X = En() fun values(): Array /* Synthetic body for ENUM_VALUES */ diff --git a/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.kt.txt b/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.kt.txt index 54533111596..512cf347e1e 100644 --- a/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.kt.txt +++ b/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.kt.txt @@ -4,7 +4,7 @@ val n: Any? enum class En : Enum { private constructor(x: String?) /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } @@ -13,7 +13,13 @@ enum class En : Enum { field = x get - ENTRY init = TODO("IrEnumConstructorCall") + ENTRY = En(x = { // BLOCK + val tmp0_safe_receiver: Any? = () + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> tmp0_safe_receiver.toString() + } + }) fun values(): Array /* Synthetic body for ENUM_VALUES */ diff --git a/compiler/testData/ir/irText/expressions/values.kt.txt b/compiler/testData/ir/irText/expressions/values.kt.txt index 98c2fc9ffe1..67145c6a26c 100644 --- a/compiler/testData/ir/irText/expressions/values.kt.txt +++ b/compiler/testData/ir/irText/expressions/values.kt.txt @@ -1,11 +1,11 @@ enum class Enum : Enum { private constructor() /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } - A init = TODO("IrEnumConstructorCall") + A = Enum() fun values(): Array /* Synthetic body for ENUM_VALUES */ diff --git a/compiler/testData/ir/irText/firProblems/FirBuilder.kt.txt b/compiler/testData/ir/irText/firProblems/FirBuilder.kt.txt index ab83025d3a4..a8dfae53657 100644 --- a/compiler/testData/ir/irText/firProblems/FirBuilder.kt.txt +++ b/compiler/testData/ir/irText/firProblems/FirBuilder.kt.txt @@ -5,10 +5,6 @@ open class BaseConverter : BaseFirBuilder { } - - - - } class DeclarationsConverter : BaseConverter { @@ -18,9 +14,5 @@ class DeclarationsConverter : BaseConverter { } - - - - } diff --git a/compiler/testData/ir/irText/singletons/enumEntry.kt.txt b/compiler/testData/ir/irText/singletons/enumEntry.kt.txt index 6a61e578825..8aa4260c3f1 100644 --- a/compiler/testData/ir/irText/singletons/enumEntry.kt.txt +++ b/compiler/testData/ir/irText/singletons/enumEntry.kt.txt @@ -1,11 +1,35 @@ open enum class Z : Enum { private constructor() /* primary */ { - TODO("IrEnumConstructorCall") + super/*Enum*/() /* InstanceInitializerCall */ } - ENTRY init = TODO("IrEnumConstructorCall") + ENTRY = ENTRY() + private enum entry class ENTRY : Z { + private constructor() /* primary */ { + super/*Z*/() /*~> Unit */ + /* InstanceInitializerCall */ + + } + + fun test() { + } + + inner class A { + constructor() /* primary */ { + super/*Any*/() + /* InstanceInitializerCall */ + + } + + fun test2() { + ENTRY.test() + } + + } + + } fun values(): Array /* Synthetic body for ENUM_VALUES */ diff --git a/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m2.kt.txt b/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m2.kt.txt index 53407fa0166..76e949db83f 100644 --- a/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m2.kt.txt +++ b/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m2.kt.txt @@ -21,8 +21,5 @@ class Derived1 : Base { override set(value: T) { } - - - } From cf5ba8245396155451c60cf3796772ac33ee9116 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Fri, 6 Nov 2020 03:26:37 +0300 Subject: [PATCH 143/698] [IR] KotlinLikeDumper: don't indent function expressions --- .../src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index feb7ef12dd0..b8b9911c190 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -968,7 +968,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption // TODO Is name of function used somehere? How it's important? // TODO Use lambda syntax when possible // TODO don't print visibility? - // TODO don't insert indentations, including when there are annotations + p.withholdIndentOnce() expression.function.printSimpleFunction("fun ", expression.function.name.asString(), printTypeParametersAndExtensionReceiver = true, printSignatureAndBody = true) } From ab8188b032aeebd5f3c39b25c633b36bab963383 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Fri, 6 Nov 2020 03:26:51 +0300 Subject: [PATCH 144/698] [IR] update testdata: removed extra indentation for function expressions --- .../ir/irText/classes/initValInLambda.kt.txt | 2 +- .../lambdaInDataClassDefaultParameter.kt.txt | 2 +- .../delegateFieldWithAnnotations.kt.txt | 2 +- ...lDelegatedPropertiesWithAnnotations.kt.txt | 2 +- .../declarations/classLevelProperties.kt.txt | 2 +- .../declarations/delegatedProperties.kt.txt | 4 +-- .../localDelegatedProperties.kt.txt | 2 +- .../packageLevelProperties.kt.txt | 2 +- .../declarations/parameters/lambdas.kt.txt | 8 ++--- .../parameters/useNextParamInLambda.kt.txt | 4 +-- .../expressions/badBreakContinue.kt.txt | 2 +- .../expressions/breakContinueInWhen.kt.txt | 4 +-- .../adaptedExtensionFunctions.kt.txt | 6 ++-- .../adaptedWithCoercionToUnit.kt.txt | 8 ++--- .../caoWithAdaptationForSam.kt.txt | 4 +-- .../constructorWithAdaptedArguments.kt.txt | 2 +- .../callableReferences/kt37131.kt.txt | 4 +-- .../suspendConversion.kt.txt | 14 ++++---- ...MemberReferenceWithAdaptedArguments.kt.txt | 2 +- .../withAdaptationForSam.kt.txt | 2 +- .../withAdaptedArguments.kt.txt | 10 +++--- .../withVarargViewedAsArray.kt.txt | 6 ++-- .../irText/expressions/coercionToUnit.kt.txt | 2 +- .../expressions/enumEntryAsReceiver.kt.txt | 2 +- ...numEntryReferenceFromEnumEntryClass.kt.txt | 2 +- .../exhaustiveWhenElseBranch.kt.txt | 2 +- .../arrayAsVarargAfterSamArgument_fi.kt.txt | 20 ++++++------ .../basicFunInterfaceConversion.kt.txt | 2 +- .../funInterface/partialSam.kt.txt | 4 +-- .../samConversionInVarargs.kt.txt | 10 +++--- .../samConversionInVarargsMixed.kt.txt | 2 +- .../samConversionOnCallableReference.kt.txt | 4 +-- ...ricConstructorCallWithTypeArguments.kt.txt | 2 +- .../ir/irText/expressions/kt37570.kt.txt | 2 +- .../ir/irText/expressions/lambdaInCAO.kt.txt | 6 ++-- .../nullCheckOnGenericLambdaReturn.kt.txt | 8 ++--- .../nullCheckOnLambdaReturn.kt.txt | 12 +++---- .../irText/expressions/objectReference.kt.txt | 2 +- ...enceInClosureInSuperConstructorCall.kt.txt | 2 +- .../sam/arrayAsVarargAfterSamArgument.kt.txt | 32 +++++++++---------- .../sam/genericSamProjectedOut.kt.txt | 6 ++-- .../sam/genericSamSmartcast.kt.txt | 2 +- .../expressions/sam/samByProjectedType.kt.txt | 2 +- .../expressions/sam/samConstructors.kt.txt | 4 +-- .../sam/samConversionToGeneric.kt.txt | 6 ++-- .../expressions/sam/samConversions.kt.txt | 4 +-- ...pendConversionOnArbitraryExpression.kt.txt | 2 +- .../expressions/variableAsFunctionCall.kt.txt | 2 +- .../variableAsFunctionCallWithGenerics.kt.txt | 4 +-- .../irText/expressions/whenReturnUnit.kt.txt | 2 +- .../irText/firProblems/AllCandidates.kt.txt | 4 +-- .../irText/firProblems/DeepCopyIrTree.kt.txt | 6 ++-- .../coercionToUnitForNestedWhen.kt.txt | 4 +-- .../irText/lambdas/anonymousFunction.kt.txt | 2 +- .../lambdas/destructuringInLambda.kt.txt | 2 +- .../ir/irText/lambdas/extensionLambda.kt.txt | 2 +- .../ir/irText/lambdas/justLambda.kt.txt | 4 +-- .../lambdas/multipleImplicitReceivers.kt.txt | 6 ++-- .../ir/irText/lambdas/nonLocalReturn.kt.txt | 14 ++++---- .../ir/irText/lambdas/samAdapter.kt.txt | 2 +- .../typeParametersInImplicitCast.kt.txt | 2 +- .../ir/irText/stubs/builtinMap.kt.txt | 2 +- .../castsInsideCoroutineInference.kt.txt | 16 +++++----- .../coercionToUnitInLambdaReturnValue.kt.txt | 2 +- .../irText/types/intersectionType2_NI.kt.txt | 2 +- .../irText/types/intersectionType2_OI.kt.txt | 2 +- .../nnStringVsT.kt.txt | 2 +- .../nnStringVsTAny.kt.txt | 2 +- .../nnStringVsTConstrained.kt.txt | 2 +- .../nnStringVsTXArray.kt.txt | 2 +- .../nnStringVsTXString.kt.txt | 2 +- .../nullCheckOnLambdaResult/stringVsT.kt.txt | 2 +- .../stringVsTAny.kt.txt | 2 +- .../stringVsTConstrained.kt.txt | 2 +- .../stringVsTXArray.kt.txt | 2 +- .../stringVsTXString.kt.txt | 2 +- 76 files changed, 168 insertions(+), 168 deletions(-) diff --git a/compiler/testData/ir/irText/classes/initValInLambda.kt.txt b/compiler/testData/ir/irText/classes/initValInLambda.kt.txt index 204bcdda7aa..dda935da7a0 100644 --- a/compiler/testData/ir/irText/classes/initValInLambda.kt.txt +++ b/compiler/testData/ir/irText/classes/initValInLambda.kt.txt @@ -9,7 +9,7 @@ class TestInitValInLambdaCalledOnce { get init { - 1.run(block = local fun Int.() { + 1.run(block = local fun Int.() { #x = 0 } ) diff --git a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt index ab68f45edbd..3d89e877f4d 100644 --- a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt +++ b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt @@ -1,5 +1,5 @@ data class A { - constructor(runA: @ExtensionFunctionType Function2 = local fun A.(it: String) { + constructor(runA: @ExtensionFunctionType Function2 = local fun A.(it: String) { return Unit } ) /* primary */ { diff --git a/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.kt.txt index b7e8fcf366d..5ef1a5378a3 100644 --- a/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.kt.txt @@ -4,7 +4,7 @@ annotation class Ann : Annotation { } val test1: Int /* by */ - field = lazy(initializer = local fun (): Int { + field = lazy(initializer = local fun (): Int { return 42 } ) diff --git a/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.kt.txt index 8c127cd8d0b..9a32e4b7676 100644 --- a/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.kt.txt @@ -9,7 +9,7 @@ annotation class A : Annotation { fun foo(m: Map) { @A(x = "foo/test") val test: Int - val test$delegate: Lazy = lazy(initializer = local fun (): Int { + val test$delegate: Lazy = lazy(initializer = local fun (): Int { return 42 } ) diff --git a/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt b/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt index a1d5fd7b042..ae08381b7f1 100644 --- a/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt @@ -36,7 +36,7 @@ class C { get val test7: Int /* by */ - field = lazy(initializer = local fun (): Int { + field = lazy(initializer = local fun (): Int { return 42 } ) diff --git a/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt b/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt index 21581e024dc..205c61703d2 100644 --- a/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt @@ -1,5 +1,5 @@ val test1: Int /* by */ - field = lazy(initializer = local fun (): Int { + field = lazy(initializer = local fun (): Int { return 42 } ) @@ -19,7 +19,7 @@ class C { get val test2: Int /* by */ - field = lazy(initializer = local fun (): Int { + field = lazy(initializer = local fun (): Int { return 42 } ) diff --git a/compiler/testData/ir/irText/declarations/localDelegatedProperties.kt.txt b/compiler/testData/ir/irText/declarations/localDelegatedProperties.kt.txt index c7bcd592dd8..63410a39c3b 100644 --- a/compiler/testData/ir/irText/declarations/localDelegatedProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/localDelegatedProperties.kt.txt @@ -1,6 +1,6 @@ fun test1() { val x: Int - val x$delegate: Lazy = lazy(initializer = local fun (): Int { + val x$delegate: Lazy = lazy(initializer = local fun (): Int { return 42 } ) diff --git a/compiler/testData/ir/irText/declarations/packageLevelProperties.kt.txt b/compiler/testData/ir/irText/declarations/packageLevelProperties.kt.txt index e7cfcc6ca3b..5cbf2d613cc 100644 --- a/compiler/testData/ir/irText/declarations/packageLevelProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/packageLevelProperties.kt.txt @@ -29,7 +29,7 @@ val test6: Int get val test7: Int /* by */ - field = lazy(initializer = local fun (): Int { + field = lazy(initializer = local fun (): Int { return 42 } ) diff --git a/compiler/testData/ir/irText/declarations/parameters/lambdas.kt.txt b/compiler/testData/ir/irText/declarations/parameters/lambdas.kt.txt index 925e802a909..61a4f27e6d2 100644 --- a/compiler/testData/ir/irText/declarations/parameters/lambdas.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/lambdas.kt.txt @@ -1,26 +1,26 @@ val test1: Function1 - field = local fun (it: String): String { + field = local fun (it: String): String { return it } get val test2: @ExtensionFunctionType Function2 - field = local fun Any.(it: Any): Int { + field = local fun Any.(it: Any): Int { return it.hashCode() } get val test3: Function2 - field = local fun (i: Int, j: Int) { + field = local fun (i: Int, j: Int) { return Unit } get val test4: Function2 - field = local fun (i: Int, j: Int) { + field = local fun (i: Int, j: Int) { } get diff --git a/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.kt.txt b/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.kt.txt index 47a9dfdf77e..557f34ee614 100644 --- a/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.kt.txt @@ -17,10 +17,10 @@ fun box(): String { result = "OK" } - return f(, f2 = local fun (): String { + return f(, f2 = local fun (): String { return "O" } -).plus(other = f(f1 = local fun (): String { +).plus(other = f(f1 = local fun (): String { return "K" } )) diff --git a/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt b/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt index c05774f4d11..b056fc3aef9 100644 --- a/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt +++ b/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt @@ -12,7 +12,7 @@ fun test2() { fun test3() { while (true) { // BLOCK - val lambda: Function0 = local fun (): Nothing { + val lambda: Function0 = local fun (): Nothing { error("") /* ERROR EXPRESSION */ error("") /* ERROR EXPRESSION */ } diff --git a/compiler/testData/ir/irText/expressions/breakContinueInWhen.kt.txt b/compiler/testData/ir/irText/expressions/breakContinueInWhen.kt.txt index 9e07f1a3a99..7054d892edb 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInWhen.kt.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInWhen.kt.txt @@ -1,5 +1,5 @@ fun testBreakFor() { - val xs: IntArray = IntArray(size = 10, init = local fun (i: Int): Int { + val xs: IntArray = IntArray(size = 10, init = local fun (i: Int): Int { return i } ) @@ -38,7 +38,7 @@ fun testBreakDoWhile() { } fun testContinueFor() { - val xs: IntArray = IntArray(size = 10, init = local fun (i: Int): Int { + val xs: IntArray = IntArray(size = 10, init = local fun (i: Int): Int { return i } ) diff --git a/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt index d1d857ad4f7..ff78f303dc0 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt @@ -20,21 +20,21 @@ fun C.extensionBoth(i: Int, s: String = "", vararg t: String) { } fun testExtensionVararg() { - use(f = local fun extensionVararg(p0: C, p1: Int) { + use(f = local fun extensionVararg(p0: C, p1: Int) { p0.extensionVararg(i = p1) } ) } fun testExtensionDefault() { - use(f = local fun extensionDefault(p0: C, p1: Int) { + use(f = local fun extensionDefault(p0: C, p1: Int) { p0.extensionDefault(i = p1) } ) } fun testExtensionBoth() { - use(f = local fun extensionBoth(p0: C, p1: Int) { + use(f = local fun extensionBoth(p0: C, p1: Int) { p0.extensionBoth(i = p1) } ) diff --git a/compiler/testData/ir/irText/expressions/callableReferences/adaptedWithCoercionToUnit.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/adaptedWithCoercionToUnit.kt.txt index e8737a2c15d..856a06456a7 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/adaptedWithCoercionToUnit.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/adaptedWithCoercionToUnit.kt.txt @@ -17,28 +17,28 @@ fun fnv(vararg xs: Int): Int { } fun test0() { - return useUnit0(fn = local fun fn0() { + return useUnit0(fn = local fun fn0() { fn0() /*~> Unit */ } ) } fun test1() { - return useUnit1(fn = local fun fn1(p0: Int) { + return useUnit1(fn = local fun fn1(p0: Int) { fn1(x = p0) /*~> Unit */ } ) } fun testV0() { - return useUnit0(fn = local fun fnv() { + return useUnit0(fn = local fun fnv() { fnv() /*~> Unit */ } ) } fun testV1() { - return useUnit1(fn = local fun fnv(p0: Int) { + return useUnit1(fn = local fun fnv(p0: Int) { fnv(xs = [p0]) /*~> Unit */ } ) diff --git a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt index 24878a4d8b4..d45da24e38c 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt @@ -46,7 +46,7 @@ fun withVararg(vararg xs: Int): Int { fun test1() { { // BLOCK val tmp0_array: A = A - val tmp2_sam: IFoo = local fun withVararg(p0: Int) { + val tmp2_sam: IFoo = local fun withVararg(p0: Int) { withVararg(xs = [p0]) /*~> Unit */ } /*-> IFoo */ @@ -57,7 +57,7 @@ fun test1() { fun test2() { { // BLOCK val tmp0_array: B = B - val tmp2_sam: IFoo2 = local fun withVararg(p0: Int) { + val tmp2_sam: IFoo2 = local fun withVararg(p0: Int) { withVararg(xs = [p0]) /*~> Unit */ } /*-> IFoo2 */ diff --git a/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt index bfb7f9bba69..d259c3e1edd 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt @@ -30,7 +30,7 @@ class Outer { } fun testConstructor(): Any { - return use(fn = local fun (p0: Int): C { + return use(fn = local fun (p0: Int): C { return C(xs = [p0]) } ) diff --git a/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt index e0950390950..b71aa180da8 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt @@ -20,14 +20,14 @@ fun use(fn: Function0): Any { } fun testFn(): Any { - return use(fn = local fun foo(): String { + return use(fn = local fun foo(): String { return foo() } ) } fun testCtor(): Any { - return use(fn = local fun (): C { + return use(fn = local fun (): C { return C() } ) diff --git a/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt index 1036bd906ae..662743840da 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt @@ -36,7 +36,7 @@ class C { } fun testLambda() { - useSuspend(fn = local suspend fun () { + useSuspend(fn = local suspend fun () { foo1() } ) @@ -47,42 +47,42 @@ fun testNoCoversion() { } fun testSuspendPlain() { - useSuspend(fn = local suspend fun foo1() { + useSuspend(fn = local suspend fun foo1() { foo1() } ) } fun testSuspendWithArgs() { - useSuspendInt(fn = local suspend fun fooInt(p0: Int) { + useSuspendInt(fn = local suspend fun fooInt(p0: Int) { fooInt(x = p0) } ) } fun testWithVararg() { - useSuspend(fn = local suspend fun foo2() { + useSuspend(fn = local suspend fun foo2() { foo2() } ) } fun testWithVarargMapped() { - useSuspendInt(fn = local suspend fun foo2(p0: Int) { + useSuspendInt(fn = local suspend fun foo2(p0: Int) { foo2(xs = [p0]) } ) } fun testWithCoercionToUnit() { - useSuspend(fn = local suspend fun foo3() { + useSuspend(fn = local suspend fun foo3() { foo3() /*~> Unit */ } ) } fun testWithDefaults() { - useSuspend(fn = local suspend fun foo4() { + useSuspend(fn = local suspend fun foo4() { foo4() } ) diff --git a/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt index 9890992ceda..2c53f1d3be3 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt @@ -31,7 +31,7 @@ object Obj : A { } fun testUnbound() { - use1(fn = local fun foo(p0: A, p1: Int) { + use1(fn = local fun foo(p0: A, p1: Int) { p0.foo(xs = [p1]) /*~> Unit */ } ) diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withAdaptationForSam.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptationForSam.kt.txt index 9ac7eb2bc0c..968be6d330d 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/withAdaptationForSam.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptationForSam.kt.txt @@ -11,7 +11,7 @@ fun withVararg(vararg xs: Int): Int { } fun test() { - useFoo(foo = local fun withVararg(p0: Int) { + useFoo(foo = local fun withVararg(p0: Int) { withVararg(xs = [p0]) /*~> Unit */ } /*-> IFoo */) diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt index 3b81f93c538..9ef62ca6265 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt @@ -35,21 +35,21 @@ object Host { } fun testDefault(): String { - return use(fn = local fun fnWithDefault(p0: Int): String { + return use(fn = local fun fnWithDefault(p0: Int): String { return fnWithDefault(a = p0) } ) } fun testVararg(): String { - return use(fn = local fun fnWithVarargs(p0: Int): String { + return use(fn = local fun fnWithVarargs(p0: Int): String { return fnWithVarargs(xs = [p0]) } ) } fun testCoercionToUnit() { - return coerceToUnit(fn = local fun fnWithDefault(p0: Int) { + return coerceToUnit(fn = local fun fnWithDefault(p0: Int) { fnWithDefault(a = p0) /*~> Unit */ } ) @@ -66,14 +66,14 @@ fun testImportedObjectMember(): String { } fun testDefault0(): String { - return use0(fn = local fun fnWithDefaults(): String { + return use0(fn = local fun fnWithDefaults(): String { return fnWithDefaults() } ) } fun testVararg0(): String { - return use0(fn = local fun fnWithVarargs(): String { + return use0(fn = local fun fnWithVarargs(): String { return fnWithVarargs() } ) diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.kt.txt index be006419800..90a6f0853cd 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.kt.txt @@ -11,7 +11,7 @@ fun sum(vararg args: Int): Int { } fun nsum(vararg args: Number): Int { - return sum(args = [*IntArray(size = args.(), init = local fun (it: Int): Int { + return sum(args = [*IntArray(size = args.(), init = local fun (it: Int): Int { return args.get(index = it).toInt() } )]) @@ -33,7 +33,7 @@ fun useStringArray(fn: Function1, Unit>) { } fun testPlainArgs() { - usePlainArgs(fn = local fun sum(p0: Int, p1: Int): Int { + usePlainArgs(fn = local fun sum(p0: Int, p1: Int): Int { return sum(args = [p0, p1]) } ) @@ -48,7 +48,7 @@ fun testArrayAsVararg() { } fun testArrayAndDefaults() { - useStringArray(fn = local fun zap(p0: Array) { + useStringArray(fn = local fun zap(p0: Array) { zap(b = [*p0]) } ) diff --git a/compiler/testData/ir/irText/expressions/coercionToUnit.kt.txt b/compiler/testData/ir/irText/expressions/coercionToUnit.kt.txt index e29ccce9721..1113aec2de0 100644 --- a/compiler/testData/ir/irText/expressions/coercionToUnit.kt.txt +++ b/compiler/testData/ir/irText/expressions/coercionToUnit.kt.txt @@ -1,5 +1,5 @@ val test1: Function0 - field = local fun () { + field = local fun () { 42 /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt b/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt index 34bf34fce0e..bc4951b1792 100644 --- a/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt +++ b/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt @@ -18,7 +18,7 @@ abstract enum class X : Enum { get override val value: Function0 - field = local fun (): String { + field = local fun (): String { return B.() } diff --git a/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt index 7aa56b4715f..15079bfa843 100644 --- a/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt +++ b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt @@ -27,7 +27,7 @@ open enum class MyEnum : Enum { } val aLambda: Function0 - field = local fun () { + field = local fun () { Z.( = 1) Z.foo() } diff --git a/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt b/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt index 0b8c3ca9914..5c974d8b40f 100644 --- a/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt +++ b/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt @@ -104,7 +104,7 @@ fun testIfTheElseAnnotated_throwsJvm(a: A, flag: Boolean) { } fun testLambdaResultExpression_throws(a: A) { - local fun (): Int { + local fun (): Int { return { // BLOCK val tmp0_subject: A = a when { diff --git a/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt.txt index a88cc4b0f0a..6f90e6e597e 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt.txt @@ -10,11 +10,11 @@ fun foo2(r1: IRunnable, r2: IRunnable, vararg s: String) { } fun test(fn: Function0, r: IRunnable, s: String, arr: Array) { - foo1(r = local fun () { + foo1(r = local fun () { return Unit } /*-> IRunnable */, s = [s]) - foo1(r = local fun () { + foo1(r = local fun () { return Unit } /*-> IRunnable */, s = [*arr]) @@ -22,33 +22,33 @@ fun test(fn: Function0, r: IRunnable, s: String, arr: Array) { foo1(r = fn /*-> IRunnable */, s = [*arr]) foo1(r = r, s = [s]) foo1(r = r, s = [*arr]) - foo2(r1 = local fun () { + foo2(r1 = local fun () { return Unit } - /*-> IRunnable */, r2 = local fun () { + /*-> IRunnable */, r2 = local fun () { return Unit } /*-> IRunnable */, s = [s]) - foo2(r1 = local fun () { + foo2(r1 = local fun () { return Unit } - /*-> IRunnable */, r2 = local fun () { + /*-> IRunnable */, r2 = local fun () { return Unit } /*-> IRunnable */, s = [*arr]) - foo2(r1 = fn /*-> IRunnable */, r2 = local fun () { + foo2(r1 = fn /*-> IRunnable */, r2 = local fun () { return Unit } /*-> IRunnable */, s = [s]) - foo2(r1 = fn /*-> IRunnable */, r2 = local fun () { + foo2(r1 = fn /*-> IRunnable */, r2 = local fun () { return Unit } /*-> IRunnable */, s = [*arr]) - foo2(r1 = r, r2 = local fun () { + foo2(r1 = r, r2 = local fun () { return Unit } /*-> IRunnable */, s = [s]) - foo2(r1 = r, r2 = local fun () { + foo2(r1 = r, r2 = local fun () { return Unit } /*-> IRunnable */, s = [*arr]) diff --git a/compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.kt.txt index 9755c2389c3..42f264a46d5 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.kt.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.kt.txt @@ -8,7 +8,7 @@ fun foo(f: Foo): String { } fun test(): String { - return foo(f = local fun (): String { + return foo(f = local fun (): String { return "OK" } /*-> Foo */) diff --git a/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt index 1b6caa75643..d636473a6b8 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt @@ -55,11 +55,11 @@ val fis: Fn get fun test(j: J) { - j.runConversion(f1 = (), f2 = local fun (s: String, i: Int, ti: Int): String { + j.runConversion(f1 = (), f2 = local fun (s: String, i: Int, ti: Int): String { return "" } /*-> Fn */) /*~> Unit */ - j.runConversion(f1 = local fun (s: String, i: Int, ts: String): Int { + j.runConversion(f1 = local fun (s: String, i: Int, ts: String): Int { return 1 } /*-> Fn */, f2 = ()) /*~> Unit */ diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargs.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargs.kt.txt index b7d224afc3f..2374a0e3e50 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargs.kt.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargs.kt.txt @@ -7,20 +7,20 @@ fun useVararg(vararg foos: IFoo) { } fun testLambda() { - useVararg(foos = [ local fun (it: Int) { + useVararg(foos = [local fun (it: Int) { return Unit } /*-> IFoo */]) } fun testSeveralLambdas() { - useVararg(foos = [ local fun (it: Int) { + useVararg(foos = [local fun (it: Int) { return Unit } - /*-> IFoo */, local fun (it: Int) { + /*-> IFoo */, local fun (it: Int) { return Unit } - /*-> IFoo */, local fun (it: Int) { + /*-> IFoo */, local fun (it: Int) { return Unit } /*-> IFoo */]) @@ -31,7 +31,7 @@ fun withVarargOfInt(vararg xs: Int): String { } fun testAdaptedCR() { - useVararg(foos = [ local fun withVarargOfInt(p0: Int) { + useVararg(foos = [local fun withVarargOfInt(p0: Int) { withVarargOfInt(xs = [p0]) /*~> Unit */ } /*-> IFoo */]) diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.kt.txt index ca03e3fbd49..797fff5a4a1 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.kt.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.kt.txt @@ -6,7 +6,7 @@ fun interface MyRunnable { fun test(a: Any, r: MyRunnable) { when { a is MyRunnable -> { // BLOCK - foo(rs = [ local fun () { + foo(rs = [local fun () { return Unit } /*-> MyRunnable */, r, a /*as MyRunnable */]) diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.kt.txt index b217e5e1faa..4efa141094d 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.kt.txt @@ -18,7 +18,7 @@ fun testSamConstructor(): KRunnable { } fun testSamCosntructorOnAdapted(): KRunnable { - return local fun foo1() { + return local fun foo1() { foo1() /*~> Unit */ } /*-> KRunnable */ @@ -29,7 +29,7 @@ fun testSamConversion() { } fun testSamConversionOnAdapted() { - use(r = local fun foo1() { + use(r = local fun foo1() { foo1() /*~> Unit */ } /*-> KRunnable */) diff --git a/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt b/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt index 36b9c18af8d..9c9cac7e101 100644 --- a/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt @@ -3,7 +3,7 @@ fun testSimple(): Box { } inline fun testArray(n: Int, crossinline block: Function0): Array { - return Array(size = n, init = local fun (it: Int): T { + return Array(size = n, init = local fun (it: Int): T { return block.invoke() } ) diff --git a/compiler/testData/ir/irText/expressions/kt37570.kt.txt b/compiler/testData/ir/irText/expressions/kt37570.kt.txt index 1feada39ea7..063f44f05dc 100644 --- a/compiler/testData/ir/irText/expressions/kt37570.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt37570.kt.txt @@ -13,7 +13,7 @@ class A { get init { - a().apply(block = local fun String.() { + a().apply(block = local fun String.() { #b = } ) /*~> Unit */ diff --git a/compiler/testData/ir/irText/expressions/lambdaInCAO.kt.txt b/compiler/testData/ir/irText/expressions/lambdaInCAO.kt.txt index 843798b59bf..ef3c333d5bb 100644 --- a/compiler/testData/ir/irText/expressions/lambdaInCAO.kt.txt +++ b/compiler/testData/ir/irText/expressions/lambdaInCAO.kt.txt @@ -9,7 +9,7 @@ operator fun Any.set(index: Function0, value: Int) { } fun test1(a: Any) { - a.plusAssign(lambda = local fun () { + a.plusAssign(lambda = local fun () { return Unit } ) @@ -18,7 +18,7 @@ fun test1(a: Any) { fun test2(a: Any) { { // BLOCK val tmp0_array: Any = a - val tmp1_index0: Function0 = local fun () { + val tmp1_index0: Function0 = local fun () { return Unit } @@ -29,7 +29,7 @@ fun test2(a: Any) { fun test3(a: Any) { { // BLOCK val tmp0_array: Any = a - val tmp1_index0: Function0 = local fun () { + val tmp1_index0: Function0 = local fun () { return Unit } diff --git a/compiler/testData/ir/irText/expressions/nullCheckOnGenericLambdaReturn.kt.txt b/compiler/testData/ir/irText/expressions/nullCheckOnGenericLambdaReturn.kt.txt index d905244704e..82516e8032a 100644 --- a/compiler/testData/ir/irText/expressions/nullCheckOnGenericLambdaReturn.kt.txt +++ b/compiler/testData/ir/irText/expressions/nullCheckOnGenericLambdaReturn.kt.txt @@ -19,28 +19,28 @@ fun id(x: T): T { } fun test1(): @FlexibleNullability String? { - return checkT<@FlexibleNullability String?>(fn = local fun (): @FlexibleNullability String? { + return checkT<@FlexibleNullability String?>(fn = local fun (): @FlexibleNullability String? { return foo() } ) } fun test2(): String { - return checkT<@EnhancedNullability String>(fn = local fun (): @EnhancedNullability String { + return checkT<@EnhancedNullability String>(fn = local fun (): @EnhancedNullability String { return nnFoo() } ) /*!! String */ } fun test3(): @FlexibleNullability String? { - return checkTAny<@FlexibleNullability String?>(fn = local fun (): @FlexibleNullability String? { + return checkTAny<@FlexibleNullability String?>(fn = local fun (): @FlexibleNullability String? { return foo() } ) } fun test4(): String { - return checkTAny<@EnhancedNullability String>(fn = local fun (): @EnhancedNullability String { + return checkTAny<@EnhancedNullability String>(fn = local fun (): @EnhancedNullability String { return nnFoo() } ) /*!! String */ diff --git a/compiler/testData/ir/irText/expressions/nullCheckOnLambdaReturn.kt.txt b/compiler/testData/ir/irText/expressions/nullCheckOnLambdaReturn.kt.txt index d2fd6166b45..ea9036c9ccc 100644 --- a/compiler/testData/ir/irText/expressions/nullCheckOnLambdaReturn.kt.txt +++ b/compiler/testData/ir/irText/expressions/nullCheckOnLambdaReturn.kt.txt @@ -11,42 +11,42 @@ fun id(x: T): T { } fun test1(): Any { - return checkAny(fn = local fun (): Any { + return checkAny(fn = local fun (): Any { return foo() /*!! String */ } ) } val test2: Function0 - field = local fun (): @FlexibleNullability String? { + field = local fun (): @FlexibleNullability String? { return foo() /*!! String */ } get val test3: Function0 - field = local fun (): @FlexibleNullability String? { + field = local fun (): @FlexibleNullability String? { return foo() } as Function0 get val test4: Function0 - field = id>(x = local fun (): @FlexibleNullability String? { + field = id>(x = local fun (): @FlexibleNullability String? { return foo() } ) get fun test5(): Any? { - return checkAnyN(fn = local fun (): Any? { + return checkAnyN(fn = local fun (): Any? { return foo() } ) } fun test6(): Any? { - return checkAnyN(fn = local fun (): Any? { + return checkAnyN(fn = local fun (): Any? { return nnFoo() } ) diff --git a/compiler/testData/ir/irText/expressions/objectReference.kt.txt b/compiler/testData/ir/irText/expressions/objectReference.kt.txt index 14a7bdbe308..2e51824bd98 100644 --- a/compiler/testData/ir/irText/expressions/objectReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/objectReference.kt.txt @@ -44,7 +44,7 @@ object Z { } val aLambda: Function0 - field = local fun () { + field = local fun () { Z.( = 1) Z.foo() Z.( = 1) diff --git a/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.kt.txt b/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.kt.txt index 259f55f1e76..83e01d4ace8 100644 --- a/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.kt.txt @@ -13,7 +13,7 @@ abstract class Base { object Test : Base { private constructor() /* primary */ { - super/*Base*/(lambda = local fun (): Any { + super/*Base*/(lambda = local fun (): Any { return Test } ) diff --git a/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.kt.txt b/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.kt.txt index 71767b36eba..cdddbbbb84f 100644 --- a/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.kt.txt +++ b/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.kt.txt @@ -1,9 +1,9 @@ fun test(fn: Function0, r: Runnable, arr: Array) { - foo1(r = local fun () { + foo1(r = local fun () { return Unit } /*-> @FlexibleNullability Runnable? */, strs = arr) /*~> Unit */ - foo1(r = local fun () { + foo1(r = local fun () { return Unit } /*-> @FlexibleNullability Runnable? */, strs = [*arr]) /*~> Unit */ @@ -13,55 +13,55 @@ fun test(fn: Function0, r: Runnable, arr: Array) { foo1(r = fn /*-> @FlexibleNullability Runnable? */, strs = arr) /*~> Unit */ foo1(r = fn /*-> @FlexibleNullability Runnable? */, strs = [*arr]) /*~> Unit */ foo1(r = r, strs = [*arr]) /*~> Unit */ - val i1: Test = Test(r = local fun () { + val i1: Test = Test(r = local fun () { return Unit } /*-> @FlexibleNullability Runnable? */, strs = arr) - val i2: Test = Test(r = local fun () { + val i2: Test = Test(r = local fun () { return Unit } /*-> @FlexibleNullability Runnable? */, strs = [*arr]) - val i3: Test = Test(r1 = local fun () { + val i3: Test = Test(r1 = local fun () { return Unit } - /*-> @FlexibleNullability Runnable? */, r2 = local fun () { + /*-> @FlexibleNullability Runnable? */, r2 = local fun () { return Unit } /*-> @FlexibleNullability Runnable? */, strs = arr) - val i4: Test = Test(r1 = r, r2 = local fun () { + val i4: Test = Test(r1 = r, r2 = local fun () { return Unit } /*-> @FlexibleNullability Runnable? */, strs = [""]) - val i5: Test = Test(r1 = local fun () { + val i5: Test = Test(r1 = local fun () { return Unit } - /*-> @FlexibleNullability Runnable? */, r2 = local fun () { + /*-> @FlexibleNullability Runnable? */, r2 = local fun () { return Unit } /*-> @FlexibleNullability Runnable? */, strs = [*arr]) - val i6: Test = Test(r1 = r, r2 = local fun () { + val i6: Test = Test(r1 = r, r2 = local fun () { return Unit } /*-> @FlexibleNullability Runnable? */, strs = [*arr]) - i1.foo2(r1 = local fun () { + i1.foo2(r1 = local fun () { return Unit } - /*-> @FlexibleNullability Runnable? */, r2 = local fun () { + /*-> @FlexibleNullability Runnable? */, r2 = local fun () { return Unit } /*-> @FlexibleNullability Runnable? */, strs = arr) /*~> Unit */ - i1.foo2(r1 = r, r2 = local fun () { + i1.foo2(r1 = r, r2 = local fun () { return Unit } /*-> @FlexibleNullability Runnable? */, strs = [""]) /*~> Unit */ - i1.foo2(r1 = local fun () { + i1.foo2(r1 = local fun () { return Unit } - /*-> @FlexibleNullability Runnable? */, r2 = local fun () { + /*-> @FlexibleNullability Runnable? */, r2 = local fun () { return Unit } /*-> @FlexibleNullability Runnable? */, strs = [*arr]) /*~> Unit */ - i1.foo2(r1 = r, r2 = local fun () { + i1.foo2(r1 = r, r2 = local fun () { return Unit } /*-> @FlexibleNullability Runnable? */, strs = [*arr]) /*~> Unit */ diff --git a/compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.kt.txt b/compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.kt.txt index 86d7ed9b968..e65d238f5e2 100644 --- a/compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.kt.txt +++ b/compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.kt.txt @@ -1,13 +1,13 @@ fun test(a: SomeJavaClass) { - a.someFunction(hello = local fun (it: @FlexibleNullability String?) { + a.someFunction(hello = local fun (it: @FlexibleNullability String?) { return Unit } /*-> @FlexibleNullability Hello? */) - a.plus(hello = local fun (it: @FlexibleNullability String?) { + a.plus(hello = local fun (it: @FlexibleNullability String?) { return Unit } /*-> @FlexibleNullability Hello? */) - a.get(hello = local fun (it: @FlexibleNullability String?) { + a.get(hello = local fun (it: @FlexibleNullability String?) { return Unit } /*-> @FlexibleNullability Hello? */) diff --git a/compiler/testData/ir/irText/expressions/sam/genericSamSmartcast.kt.txt b/compiler/testData/ir/irText/expressions/sam/genericSamSmartcast.kt.txt index 39514e81528..4188588622b 100644 --- a/compiler/testData/ir/irText/expressions/sam/genericSamSmartcast.kt.txt +++ b/compiler/testData/ir/irText/expressions/sam/genericSamSmartcast.kt.txt @@ -1,7 +1,7 @@ fun f(x: Any): String { when { x is A<*> -> { // BLOCK - return x /*as A */.call(block = local fun (y: Any?): @FlexibleNullability String? { + return x /*as A */.call(block = local fun (y: Any?): @FlexibleNullability String? { return "OK" } /*-> @FlexibleNullability I<@FlexibleNullability T?>? */) /*!! String */ diff --git a/compiler/testData/ir/irText/expressions/sam/samByProjectedType.kt.txt b/compiler/testData/ir/irText/expressions/sam/samByProjectedType.kt.txt index ae78644935d..6a9e49a8d55 100644 --- a/compiler/testData/ir/irText/expressions/sam/samByProjectedType.kt.txt +++ b/compiler/testData/ir/irText/expressions/sam/samByProjectedType.kt.txt @@ -1,5 +1,5 @@ fun test1() { - bar(j = local fun (x: Any): @FlexibleNullability Any? { + bar(j = local fun (x: Any): @FlexibleNullability Any? { return x } /*-> @FlexibleNullability J<@FlexibleNullability Any?>? */) diff --git a/compiler/testData/ir/irText/expressions/sam/samConstructors.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConstructors.kt.txt index 100df56b438..fc8c8d38ed6 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConstructors.kt.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConstructors.kt.txt @@ -1,5 +1,5 @@ fun test1(): Runnable { - return local fun () { + return local fun () { return Unit } /*-> Runnable */ @@ -17,7 +17,7 @@ fun test3(): Runnable { } fun test4(): Comparator { - return local fun (a: @FlexibleNullability Int?, b: @FlexibleNullability Int?): Int { + return local fun (a: @FlexibleNullability Int?, b: @FlexibleNullability Int?): Int { return a /*!! Int */.minus(other = b /*!! Int */) } /*-> Comparator */ diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.kt.txt index 0b7296342a5..73b504c7621 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.kt.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.kt.txt @@ -1,19 +1,19 @@ fun test1(): J { - return local fun (x: @FlexibleNullability String?): @FlexibleNullability String? { + return local fun (x: @FlexibleNullability String?): @FlexibleNullability String? { return x } /*-> J */ } fun test2(): J<@FlexibleNullability String?> { - return local fun (x: String): @FlexibleNullability String? { + return local fun (x: String): @FlexibleNullability String? { return x } /*-> J<@FlexibleNullability String?> */ } fun test3() { - return bar<@FlexibleNullability String?>(j = local fun (x: String): @FlexibleNullability String? { + return bar<@FlexibleNullability String?>(j = local fun (x: String): @FlexibleNullability String? { return x } /*-> @FlexibleNullability J<@FlexibleNullability String?>? */) diff --git a/compiler/testData/ir/irText/expressions/sam/samConversions.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversions.kt.txt index c73f33c98a1..33f0a80faa8 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversions.kt.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConversions.kt.txt @@ -4,14 +4,14 @@ fun J.test0(a: Runnable) { } fun test1() { - runStatic(r = local fun () { + runStatic(r = local fun () { test1() } /*-> @FlexibleNullability Runnable? */) } fun J.test2() { - .runIt(r = local fun () { + .runIt(r = local fun () { test1() } /*-> @FlexibleNullability Runnable? */) diff --git a/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt b/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt index 7e2d3e48b05..4a09c5c254f 100644 --- a/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt +++ b/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt @@ -14,7 +14,7 @@ fun useSuspendExtT(sfn: @ExtensionFunctionType SuspendFunction1 { - return local fun () { + return local fun () { return Unit } diff --git a/compiler/testData/ir/irText/expressions/variableAsFunctionCall.kt.txt b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.kt.txt index 04eea7c4fe4..c9ad7813e14 100644 --- a/compiler/testData/ir/irText/expressions/variableAsFunctionCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.kt.txt @@ -1,5 +1,5 @@ fun String.k(): Function0 { - return local fun (): String { + return local fun (): String { return } diff --git a/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.kt.txt b/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.kt.txt index 21f5ee096a0..3b4191fd644 100644 --- a/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.kt.txt +++ b/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.kt.txt @@ -1,6 +1,6 @@ val T.gk: Function0 get(): Function0 { - return local fun (): T { + return local fun (): T { return } @@ -12,7 +12,7 @@ fun testGeneric1(x: String): String { val T.kt26531Val: Function0 get(): Function0 { - return local fun (): T { + return local fun (): T { return } diff --git a/compiler/testData/ir/irText/expressions/whenReturnUnit.kt.txt b/compiler/testData/ir/irText/expressions/whenReturnUnit.kt.txt index f4137c00118..1875ccf2e52 100644 --- a/compiler/testData/ir/irText/expressions/whenReturnUnit.kt.txt +++ b/compiler/testData/ir/irText/expressions/whenReturnUnit.kt.txt @@ -2,7 +2,7 @@ fun run(block: Function0) { } fun branch(x: Int) { - return run(block = local fun () { + return run(block = local fun () { { // BLOCK val tmp0_subject: Int = x when { diff --git a/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt b/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt index be3662a35fb..991d64e8f53 100644 --- a/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt +++ b/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt @@ -21,8 +21,8 @@ class MyCandidate { } private fun allCandidatesResult(allCandidates: Collection): @FlexibleNullability OverloadResolutionResultsImpl<@FlexibleNullability A?>? { - return nameNotFound<@FlexibleNullability A?>().apply<@FlexibleNullability OverloadResolutionResultsImpl<@FlexibleNullability A?>?>(block = local fun @FlexibleNullability OverloadResolutionResultsImpl<@FlexibleNullability A?>?.() { - /*!! OverloadResolutionResultsImpl<@FlexibleNullability A?> */.setAllCandidates<@FlexibleNullability A?>(allCandidates = allCandidates.map>(transform = local fun (it: MyCandidate): ResolvedCall { + return nameNotFound<@FlexibleNullability A?>().apply<@FlexibleNullability OverloadResolutionResultsImpl<@FlexibleNullability A?>?>(block = local fun @FlexibleNullability OverloadResolutionResultsImpl<@FlexibleNullability A?>?.() { + /*!! OverloadResolutionResultsImpl<@FlexibleNullability A?> */.setAllCandidates<@FlexibleNullability A?>(allCandidates = allCandidates.map>(transform = local fun (it: MyCandidate): ResolvedCall { return it.() as ResolvedCall } )) diff --git a/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt index 486ff7b24a4..c0afd6ad93a 100644 --- a/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt +++ b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt @@ -46,11 +46,11 @@ class DeepCopyIrTreeWithSymbols { } fun IrTypeParametersContainer.copyTypeParametersFrom(other: IrTypeParametersContainer) { - .( = other.().map(transform = local fun (it: IrTypeParameter): IrTypeParameter { + .( = other.().map(transform = local fun (it: IrTypeParameter): IrTypeParameter { return .copyTypeParameter(declaration = it) } )) - .().withinScope(irTypeParametersContainer = , fn = local fun () { + .().withinScope(irTypeParametersContainer = , fn = local fun () { { // BLOCK val tmp0_iterator: Iterator> = .().zip(other = other.()).iterator() while (tmp0_iterator.hasNext()) { // BLOCK @@ -58,7 +58,7 @@ class DeepCopyIrTreeWithSymbols { val thisTypeParameter: IrTypeParameter = tmp1_loop_parameter.component1() val otherTypeParameter: IrTypeParameter = tmp1_loop_parameter.component2() { // BLOCK - otherTypeParameter.().mapTo>(destination = thisTypeParameter.(), transform = local fun (it: IrType): IrType { + otherTypeParameter.().mapTo>(destination = thisTypeParameter.(), transform = local fun (it: IrType): IrType { return .().remapType(type = it) } ) /*~> Unit */ diff --git a/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt b/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt index 46bec19d53d..2fcb66f1e9a 100644 --- a/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt +++ b/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt @@ -4,7 +4,7 @@ private const val BACKSLASH: Char private fun Reader.nextChar(): Char? { return { // BLOCK - val tmp0_safe_receiver: Int? = .read().takeUnless(predicate = local fun (it: Int): Boolean { + val tmp0_safe_receiver: Int? = .read().takeUnless(predicate = local fun (it: Int): Boolean { return EQEQ(arg0 = it, arg1 = -1) } ) @@ -26,7 +26,7 @@ fun Reader.consumeRestOfQuotedSequence(sb: StringBuilder, quote: Char) { val tmp0_safe_receiver: Char? = .nextChar() when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> tmp0_safe_receiver.let(block = local fun (it: Char): @FlexibleNullability StringBuilder? { + true -> tmp0_safe_receiver.let(block = local fun (it: Char): @FlexibleNullability StringBuilder? { return sb.append(p0 = it) } ) diff --git a/compiler/testData/ir/irText/lambdas/anonymousFunction.kt.txt b/compiler/testData/ir/irText/lambdas/anonymousFunction.kt.txt index 14c11affbd6..4ffcd95ad58 100644 --- a/compiler/testData/ir/irText/lambdas/anonymousFunction.kt.txt +++ b/compiler/testData/ir/irText/lambdas/anonymousFunction.kt.txt @@ -1,5 +1,5 @@ val anonymous: Function0 - field = local fun () { + field = local fun () { println() } diff --git a/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt b/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt index ffea653d202..4a51be9273c 100644 --- a/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt +++ b/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt @@ -61,7 +61,7 @@ data class A { } var fn: Function1 - field = local fun (: A): Int { + field = local fun (: A): Int { val y: Int = .component2() return 42.plus(other = y) } diff --git a/compiler/testData/ir/irText/lambdas/extensionLambda.kt.txt b/compiler/testData/ir/irText/lambdas/extensionLambda.kt.txt index d57df6d9b46..28590b02683 100644 --- a/compiler/testData/ir/irText/lambdas/extensionLambda.kt.txt +++ b/compiler/testData/ir/irText/lambdas/extensionLambda.kt.txt @@ -1,5 +1,5 @@ fun test1(): Int { - return "42".run(block = local fun String.(): Int { + return "42".run(block = local fun String.(): Int { return .() } ) diff --git a/compiler/testData/ir/irText/lambdas/justLambda.kt.txt b/compiler/testData/ir/irText/lambdas/justLambda.kt.txt index a5e160af1e9..f63493e671f 100644 --- a/compiler/testData/ir/irText/lambdas/justLambda.kt.txt +++ b/compiler/testData/ir/irText/lambdas/justLambda.kt.txt @@ -1,12 +1,12 @@ val test1: Function0 - field = local fun (): Int { + field = local fun (): Int { return 42 } get val test2: Function0 - field = local fun () { + field = local fun () { return Unit } diff --git a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt index 174418edc75..b79e7d54da4 100644 --- a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt +++ b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt @@ -32,9 +32,9 @@ interface IInvoke { } fun test(fooImpl: IFoo, invokeImpl: IInvoke) { - with(receiver = A, block = local fun A.(): Int { - return with(receiver = fooImpl, block = local fun IFoo.(): Int { - return with(receiver = invokeImpl, block = local fun IInvoke.(): Int { + with(receiver = A, block = local fun A.(): Int { + return with(receiver = fooImpl, block = local fun IFoo.(): Int { + return with(receiver = invokeImpl, block = local fun IInvoke.(): Int { return (, (, ).()).invoke() } ) diff --git a/compiler/testData/ir/irText/lambdas/nonLocalReturn.kt.txt b/compiler/testData/ir/irText/lambdas/nonLocalReturn.kt.txt index fdd258643b5..d8da79eac95 100644 --- a/compiler/testData/ir/irText/lambdas/nonLocalReturn.kt.txt +++ b/compiler/testData/ir/irText/lambdas/nonLocalReturn.kt.txt @@ -1,27 +1,27 @@ fun test0() { - run(block = local fun (): Nothing { + run(block = local fun (): Nothing { return Unit } ) } fun test1() { - run(block = local fun () { + run(block = local fun () { return Unit } ) } fun test2() { - run(block = local fun () { + run(block = local fun () { return Unit } ) } fun test3() { - run(block = local fun () { - run(block = local fun (): Nothing { + run(block = local fun () { + run(block = local fun (): Nothing { return Unit } ) @@ -30,7 +30,7 @@ fun test3() { } fun testLrmFoo1(ints: List) { - ints.forEach(action = local fun (it: Int) { + ints.forEach(action = local fun (it: Int) { when { EQEQ(arg0 = it, arg1 = 0) -> return Unit } @@ -40,7 +40,7 @@ fun testLrmFoo1(ints: List) { } fun testLrmFoo2(ints: List) { - ints.forEach(action = local fun (it: Int) { + ints.forEach(action = local fun (it: Int) { when { EQEQ(arg0 = it, arg1 = 0) -> return Unit } diff --git a/compiler/testData/ir/irText/lambdas/samAdapter.kt.txt b/compiler/testData/ir/irText/lambdas/samAdapter.kt.txt index fa3fe129201..2b51cd1c355 100644 --- a/compiler/testData/ir/irText/lambdas/samAdapter.kt.txt +++ b/compiler/testData/ir/irText/lambdas/samAdapter.kt.txt @@ -1,5 +1,5 @@ fun test1() { - val hello: Runnable = local fun () { + val hello: Runnable = local fun () { println(message = "Hello, world!") } /*-> Runnable */ diff --git a/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.kt.txt b/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.kt.txt index 3c58f6cb39f..2efbc70e543 100644 --- a/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.kt.txt +++ b/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.kt.txt @@ -1,5 +1,5 @@ fun problematic(lss: List>): List { - return lss.flatMap, @FlexibleNullability T?>(transform = local fun (it: List): @EnhancedNullability MutableList<@FlexibleNullability T?> { + return lss.flatMap, @FlexibleNullability T?>(transform = local fun (it: List): @EnhancedNullability MutableList<@FlexibleNullability T?> { return id<@FlexibleNullability T?>(v = it) /*!! List<@FlexibleNullability T?> */ } ) diff --git a/compiler/testData/ir/irText/stubs/builtinMap.kt.txt b/compiler/testData/ir/irText/stubs/builtinMap.kt.txt index 8cef277aeac..d21232d237c 100644 --- a/compiler/testData/ir/irText/stubs/builtinMap.kt.txt +++ b/compiler/testData/ir/irText/stubs/builtinMap.kt.txt @@ -1,7 +1,7 @@ fun Map.plus(pair: Pair): Map { return when { .isEmpty() -> mapOf(pair = pair) - true -> LinkedHashMap<@FlexibleNullability K1?, @FlexibleNullability V1?>(p0 = ).apply>(block = local fun LinkedHashMap<@FlexibleNullability K1?, @FlexibleNullability V1?>.() { + true -> LinkedHashMap<@FlexibleNullability K1?, @FlexibleNullability V1?>(p0 = ).apply>(block = local fun LinkedHashMap<@FlexibleNullability K1?, @FlexibleNullability V1?>.() { .put(key = pair.(), value = pair.()) /*~> Unit */ } ) diff --git a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt index d35506ad777..f77bdd8a423 100644 --- a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt +++ b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt @@ -1,8 +1,8 @@ @OptIn(markerClass = [ExperimentalTypeInference::class]) fun scopedFlow(block: @ExtensionFunctionType SuspendFunction2, Unit>): Flow { - return flow(block = local suspend fun FlowCollector.() { + return flow(block = local suspend fun FlowCollector.() { val collector: FlowCollector = - flowScope(block = local suspend fun CoroutineScope.() { + flowScope(block = local suspend fun CoroutineScope.() { block.invoke(p1 = , p2 = collector) } ) @@ -11,7 +11,7 @@ fun scopedFlow(block: @ExtensionFunctionType SuspendFunction2 Flow.onCompletion(action: @ExtensionFunctionType SuspendFunction2, @ParameterName(name = "cause") Throwable?, Unit>): Flow { - return unsafeFlow(block = local suspend fun FlowCollector.() { + return unsafeFlow(block = local suspend fun FlowCollector.() { val safeCollector: SafeCollector = SafeCollector(collector = ) safeCollector.invokeSafely(action = action) } @@ -28,16 +28,16 @@ inline fun unsafeFlow(crossinline block: @ExtensionFunctionType Suspe @Deprecated(message = "binary compatibility with a version w/o FlowCollector receiver", level = DeprecationLevel) fun Flow.onCompletion(action: SuspendFunction1<@ParameterName(name = "cause") Throwable?, Unit>): Flow { - return .onCompletion(action = local suspend fun FlowCollector.(it: Throwable?) { + return .onCompletion(action = local suspend fun FlowCollector.(it: Throwable?) { action.invoke(p1 = it) } ) } private fun CoroutineScope.asFairChannel(flow: Flow<*>): ReceiveChannel { - return .produce(block = local suspend fun ProducerScope.() { + return .produce(block = local suspend fun ProducerScope.() { val channel: ChannelCoroutine = .() as ChannelCoroutine - flow.collect(action = local suspend fun (value: Any?) { + flow.collect(action = local suspend fun (value: Any?) { return channel.sendFair(element = { // BLOCK val tmp0_elvis_lhs: Any? = value when { @@ -52,8 +52,8 @@ private fun CoroutineScope.asFairChannel(flow: Flow<*>): ReceiveChannel { } private fun CoroutineScope.asChannel(flow: Flow<*>): ReceiveChannel { - return .produce(block = local suspend fun ProducerScope.() { - flow.collect(action = local suspend fun (value: Any?) { + return .produce(block = local suspend fun ProducerScope.() { + flow.collect(action = local suspend fun (value: Any?) { return .().send(e = { // BLOCK val tmp0_elvis_lhs: Any? = value when { diff --git a/compiler/testData/ir/irText/types/coercionToUnitInLambdaReturnValue.kt.txt b/compiler/testData/ir/irText/types/coercionToUnitInLambdaReturnValue.kt.txt index 54f08eb9099..e00e3c5c9d1 100644 --- a/compiler/testData/ir/irText/types/coercionToUnitInLambdaReturnValue.kt.txt +++ b/compiler/testData/ir/irText/types/coercionToUnitInLambdaReturnValue.kt.txt @@ -2,7 +2,7 @@ fun use(fn: Function0) { } fun test() { - use(fn = local fun () { + use(fn = local fun () { 42 /*~> Unit */ } ) diff --git a/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt b/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt index 574ca44d268..c5e707977d1 100644 --- a/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt @@ -29,7 +29,7 @@ fun run(fn: Function0): T { } fun foo(): Any { - return run(fn = local fun (): Any { + return run(fn = local fun (): Any { val mm: B = B() val nn: C = C() val c: Any = when { diff --git a/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt b/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt index 574ca44d268..c5e707977d1 100644 --- a/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt @@ -29,7 +29,7 @@ fun run(fn: Function0): T { } fun foo(): Any { - return run(fn = local fun (): Any { + return run(fn = local fun (): Any { val mm: B = B() val nn: C = C() val c: Any = when { diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsT.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsT.kt.txt index 88a2da6bc36..442115ec2e7 100644 --- a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsT.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsT.kt.txt @@ -3,7 +3,7 @@ fun useT(fn: Function0): T { } fun testNoNullCheck() { - useT<@EnhancedNullability String>(fn = local fun (): @EnhancedNullability String { + useT<@EnhancedNullability String>(fn = local fun (): @EnhancedNullability String { return notNullString() } ) /*~> Unit */ diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTAny.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTAny.kt.txt index 59069d0279c..935f1e0d2bf 100644 --- a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTAny.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTAny.kt.txt @@ -3,7 +3,7 @@ fun useTAny(fn: Function0): T { } fun testNoNullCheck() { - useTAny<@EnhancedNullability String>(fn = local fun (): @EnhancedNullability String { + useTAny<@EnhancedNullability String>(fn = local fun (): @EnhancedNullability String { return notNullString() } ) /*~> Unit */ diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTConstrained.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTConstrained.kt.txt index 7fdb4b1b7aa..4226b825bc4 100644 --- a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTConstrained.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTConstrained.kt.txt @@ -3,7 +3,7 @@ fun useTConstrained(xs: Array, fn: Function0): T { } fun testWithNullCheck(xs: Array) { - useTConstrained(xs = xs, fn = local fun (): String { + useTConstrained(xs = xs, fn = local fun (): String { return notNullString() /*!! String */ } ) /*~> Unit */ diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTXArray.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTXArray.kt.txt index acd032fcdb5..ad8ddd99515 100644 --- a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTXArray.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTXArray.kt.txt @@ -3,7 +3,7 @@ fun useTX(x: T, fn: Function0): T { } fun testWithNullCheck(xs: Array) { - useTX(x = xs, fn = local fun (): Serializable { + useTX(x = xs, fn = local fun (): Serializable { return notNullString() /*!! String */ } ) /*~> Unit */ diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTXString.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTXString.kt.txt index a4457625d58..ed0e42e15b0 100644 --- a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTXString.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/nnStringVsTXString.kt.txt @@ -3,7 +3,7 @@ fun useTX(x: T, fn: Function0): T { } fun testWithNullCheck() { - useTX(x = "", fn = local fun (): String { + useTX(x = "", fn = local fun (): String { return notNullString() /*!! String */ } ) /*~> Unit */ diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsT.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsT.kt.txt index 3fa5e00208b..e56495ebd7e 100644 --- a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsT.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsT.kt.txt @@ -3,7 +3,7 @@ fun useT(fn: Function0): T { } fun testNoNullCheck() { - useT<@FlexibleNullability String?>(fn = local fun (): @FlexibleNullability String? { + useT<@FlexibleNullability String?>(fn = local fun (): @FlexibleNullability String? { return string() } ) /*~> Unit */ diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTAny.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTAny.kt.txt index 9dadc44a84a..3c0afac7f14 100644 --- a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTAny.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTAny.kt.txt @@ -3,7 +3,7 @@ fun useTAny(fn: Function0): T { } fun testNoNullCheck() { - useTAny<@FlexibleNullability String?>(fn = local fun (): @FlexibleNullability String? { + useTAny<@FlexibleNullability String?>(fn = local fun (): @FlexibleNullability String? { return string() } ) /*~> Unit */ diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTConstrained.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTConstrained.kt.txt index 1eb947d9c69..5e620e15be3 100644 --- a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTConstrained.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTConstrained.kt.txt @@ -3,7 +3,7 @@ fun useTConstrained(xs: Array, fn: Function0): T { } fun testWithNullCheck(xs: Array) { - useTConstrained(xs = xs, fn = local fun (): String { + useTConstrained(xs = xs, fn = local fun (): String { return string() /*!! String */ } ) /*~> Unit */ diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXArray.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXArray.kt.txt index ffd23807511..9eb40b33ee2 100644 --- a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXArray.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXArray.kt.txt @@ -3,7 +3,7 @@ fun useTX(x: T, fn: Function0): T { } fun testNoNullCheck(xs: Array) { - useTX<@FlexibleNullability Serializable?>(x = xs, fn = local fun (): @FlexibleNullability Serializable? { + useTX<@FlexibleNullability Serializable?>(x = xs, fn = local fun (): @FlexibleNullability Serializable? { return string() } ) /*~> Unit */ diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXString.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXString.kt.txt index db333c23664..e5e76be9eb0 100644 --- a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXString.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXString.kt.txt @@ -3,7 +3,7 @@ fun useTX(x: T, fn: Function0): T { } fun testNoNullCheck() { - useTX<@FlexibleNullability String?>(x = "", fn = local fun (): @FlexibleNullability String? { + useTX<@FlexibleNullability String?>(x = "", fn = local fun (): @FlexibleNullability String? { return string() } ) /*~> Unit */ From 26dd00971367b07acaf67cf68094a81cfe827032 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Fri, 6 Nov 2020 03:41:00 +0300 Subject: [PATCH 145/698] [IR] KotlinLikeDumper: change rendering for IrInstanceInitializerCall --- .../org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index b8b9911c190..4df7782f507 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -961,6 +961,12 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printWithNoIndent(")") } + override fun visitInstanceInitializerCall(expression: IrInstanceInitializerCall, data: IrDeclaration?) { + // TODO assert that `expression.classSymbol.owner == data.parentAsClass + // TODO better rendering + p.printlnWithNoIndent("/* () */") + } + override fun visitFunctionExpression(expression: IrFunctionExpression, data: IrDeclaration?) { // TODO support // TODO omit the name when it's possible @@ -1078,10 +1084,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printWithNoIndent("::class") } - override fun visitInstanceInitializerCall(expression: IrInstanceInitializerCall, data: IrDeclaration?) { - p.println("/* InstanceInitializerCall */") - } - override fun visitTypeOperator(expression: IrTypeOperatorCall, data: IrDeclaration?) { val (operator, after) = when (expression.operator) { IrTypeOperator.CAST -> "as" to "" From e56787c0b0035ff7e7fbf0125215b46e609e67ae Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Fri, 6 Nov 2020 03:40:37 +0300 Subject: [PATCH 146/698] [IR] update testdata: IrInstanceInitializerCall --- .../ir/irText/classes/abstractMembers.kt.txt | 2 +- ...orderingInDelegatingConstructorCall.kt.txt | 6 ++--- .../ir/irText/classes/classMembers.kt.txt | 6 ++--- .../testData/ir/irText/classes/classes.kt.txt | 6 ++--- .../ir/irText/classes/cloneable.kt.txt | 6 ++--- .../ir/irText/classes/companionObject.kt.txt | 8 +++---- .../classes/dataClassWithArrayMembers.kt.txt | 6 ++--- .../ir/irText/classes/dataClasses.kt.txt | 6 ++--- .../irText/classes/dataClassesGeneric.kt.txt | 8 +++---- .../delegatedGenericImplementation.kt.txt | 4 ++-- .../classes/delegatedImplementation.kt.txt | 8 +++---- ...egatedImplementationOfJavaInterface.kt.txt | 2 +- ...dImplementationWithExplicitOverride.kt.txt | 4 ++-- ...nstructorCallToTypeAliasConstructor.kt.txt | 6 ++--- ...tructorCallsInSecondaryConstructors.kt.txt | 6 ++--- .../testData/ir/irText/classes/enum.kt.txt | 18 +++++++-------- .../irText/classes/enumClassModality.kt.txt | 22 +++++++++---------- .../classes/enumWithMultipleCtors.kt.txt | 6 ++--- .../classes/enumWithSecondaryCtor.kt.txt | 10 ++++----- .../fakeOverridesForJavaStaticMembers.kt.txt | 2 +- ...citNotNullOnDelegatedImplementation.kt.txt | 18 +++++++-------- .../ir/irText/classes/initBlock.kt.txt | 12 +++++----- .../testData/ir/irText/classes/initVal.kt.txt | 6 ++--- .../ir/irText/classes/initValInLambda.kt.txt | 2 +- .../testData/ir/irText/classes/initVar.kt.txt | 12 +++++----- .../ir/irText/classes/inlineClass.kt.txt | 2 +- .../inlineClassSyntheticMethods.kt.txt | 4 ++-- .../ir/irText/classes/innerClass.kt.txt | 6 ++--- ...innerClassWithDelegatingConstructor.kt.txt | 4 ++-- .../testData/ir/irText/classes/kt31649.kt.txt | 4 ++-- .../lambdaInDataClassDefaultParameter.kt.txt | 6 ++--- .../ir/irText/classes/localClasses.kt.txt | 2 +- .../classes/objectLiteralExpressions.kt.txt | 12 +++++----- .../classes/objectWithInitializers.kt.txt | 4 ++-- .../ir/irText/classes/outerClassAccess.kt.txt | 6 ++--- .../irText/classes/primaryConstructor.kt.txt | 6 ++--- ...ConstructorWithSuperConstructorCall.kt.txt | 8 +++---- .../irText/classes/qualifiedSuperCalls.kt.txt | 2 +- .../ir/irText/classes/sealedClasses.kt.txt | 8 +++---- ...ructorWithInitializersFromClassBody.kt.txt | 8 +++---- .../classes/secondaryConstructors.kt.txt | 2 +- .../ir/irText/classes/superCalls.kt.txt | 4 ++-- .../irText/classes/superCallsComposed.kt.txt | 4 ++-- .../annotationsOnDelegatedMembers.kt.txt | 2 +- .../classLiteralInAnnotation.kt.txt | 2 +- .../annotations/classesWithAnnotations.kt.txt | 10 ++++----- .../constructorsWithAnnotations.kt.txt | 2 +- ...tedPropertyAccessorsWithAnnotations.kt.txt | 2 +- .../enumEntriesWithAnnotations.kt.txt | 4 ++-- .../enumsInAnnotationArguments.kt.txt | 2 +- ...ConstructorParameterWithAnnotations.kt.txt | 2 +- ...ssorsFromClassHeaderWithAnnotations.kt.txt | 2 +- ...pertySetterParameterWithAnnotations.kt.txt | 2 +- .../receiverParameterWithAnnotations.kt.txt | 2 +- .../valueParametersWithAnnotations.kt.txt | 2 +- .../declarations/classLevelProperties.kt.txt | 2 +- .../declarations/delegatedProperties.kt.txt | 2 +- .../declarations/extensionProperties.kt.txt | 2 +- .../irText/declarations/fakeOverrides.kt.txt | 4 ++-- .../genericDelegatedProperty.kt.txt | 4 ++-- .../inlineCollectionOfInlineClass.kt.txt | 4 ++-- .../ir/irText/declarations/kt29833.kt.txt | 2 +- .../ir/irText/declarations/kt35550.kt.txt | 2 +- .../localClassWithOverrides.kt.txt | 4 ++-- .../multiplatform/expectClassInherited.kt.txt | 4 ++-- .../multiplatform/expectedEnumClass.kt.txt | 2 +- .../multiplatform/expectedSealedClass.kt.txt | 4 ++-- .../declarations/parameters/class.kt.txt | 6 ++--- .../parameters/constructor.kt.txt | 10 ++++----- .../parameters/dataClassMembers.kt.txt | 2 +- .../defaultPropertyAccessors.kt.txt | 4 ++-- .../parameters/delegatedMembers.kt.txt | 2 +- .../irText/declarations/parameters/fun.kt.txt | 2 +- .../parameters/genericInnerClass.kt.txt | 4 ++-- .../parameters/propertyAccessors.kt.txt | 2 +- .../typeParameterBeforeBound.kt.txt | 2 +- .../typeParameterBoundedBySubclass.kt.txt | 8 +++---- .../primaryCtorDefaultArguments.kt.txt | 2 +- .../declarations/primaryCtorProperties.kt.txt | 2 +- .../provideDelegate/differentReceivers.kt.txt | 2 +- .../declarations/provideDelegate/local.kt.txt | 4 ++-- .../localDifferentReceivers.kt.txt | 2 +- .../provideDelegate/member.kt.txt | 6 ++--- .../provideDelegate/memberExtension.kt.txt | 4 ++-- .../provideDelegate/topLevel.kt.txt | 4 ++-- .../ir/irText/declarations/typeAlias.kt.txt | 2 +- .../errors/suppressedNonPublicCall.kt.txt | 2 +- .../arrayAugmentedAssignment1.kt.txt | 2 +- .../ir/irText/expressions/assignments.kt.txt | 2 +- .../expressions/augmentedAssignment2.kt.txt | 2 +- .../augmentedAssignmentWithExpression.kt.txt | 2 +- .../boundCallableReferences.kt.txt | 2 +- .../adaptedExtensionFunctions.kt.txt | 2 +- .../boundInnerGenericConstructor.kt.txt | 4 ++-- .../caoWithAdaptationForSam.kt.txt | 4 ++-- .../constructorWithAdaptedArguments.kt.txt | 6 ++--- ...ithDefaultParametersAsKCallableStar.kt.txt | 2 +- .../callableReferences/genericMember.kt.txt | 2 +- .../importedFromObject.kt.txt | 2 +- .../callableReferences/kt37131.kt.txt | 2 +- .../suspendConversion.kt.txt | 2 +- .../callableReferences/typeArguments.kt.txt | 2 +- ...MemberReferenceWithAdaptedArguments.kt.txt | 4 ++-- .../withAdaptedArguments.kt.txt | 2 +- .../withArgumentAdaptationAndReceiver.kt.txt | 2 +- .../expressions/castToTypeParameter.kt.txt | 2 +- .../expressions/chainOfSafeCalls.kt.txt | 2 +- .../irText/expressions/classReference.kt.txt | 2 +- .../complexAugmentedAssignment.kt.txt | 10 ++++----- ...onstructorWithOwnTypeParametersCall.kt.txt | 4 ++-- .../irText/expressions/contructorCall.kt.txt | 2 +- .../irText/expressions/destructuring1.kt.txt | 4 ++-- .../destructuringWithUnderscore.kt.txt | 4 ++-- .../expressions/enumEntryAsReceiver.kt.txt | 4 ++-- ...numEntryReferenceFromEnumEntryClass.kt.txt | 6 ++--- .../exhaustiveWhenElseBranch.kt.txt | 2 +- ...ameterWithPrimitiveNumericSupertype.kt.txt | 2 +- .../forWithImplicitReceivers.kt.txt | 4 ++-- .../expressions/funImportedFromObject.kt.txt | 2 +- .../funInterface/partialSam.kt.txt | 6 ++--- ...ricConstructorCallWithTypeArguments.kt.txt | 2 +- .../expressions/genericPropertyRef.kt.txt | 4 ++-- ...implicitCastInReturnFromConstructor.kt.txt | 2 +- .../implicitCastToTypeParameter.kt.txt | 2 +- .../jvmFieldWithIntersectionTypes.kt.txt | 10 ++++----- .../jvmInstanceFieldReference.kt.txt | 2 +- .../jvmStaticFieldReference.kt.txt | 2 +- .../ir/irText/expressions/kt16904.kt.txt | 8 +++---- .../ir/irText/expressions/kt16905.kt.txt | 8 +++---- .../ir/irText/expressions/kt23030.kt.txt | 2 +- .../ir/irText/expressions/kt28456.kt.txt | 2 +- .../ir/irText/expressions/kt28456a.kt.txt | 2 +- .../ir/irText/expressions/kt28456b.kt.txt | 2 +- .../ir/irText/expressions/kt30020.kt.txt | 4 ++-- .../ir/irText/expressions/kt35730.kt.txt | 2 +- .../ir/irText/expressions/kt36956.kt.txt | 2 +- .../ir/irText/expressions/kt37570.kt.txt | 2 +- .../expressions/memberTypeArguments.kt.txt | 2 +- .../membersImportedFromObject.kt.txt | 2 +- .../expressions/multipleThisReferences.kt.txt | 8 +++---- .../expressions/objectAsCallable.kt.txt | 4 ++-- .../expressions/objectClassReference.kt.txt | 2 +- .../irText/expressions/objectReference.kt.txt | 6 ++--- ...enceInClosureInSuperConstructorCall.kt.txt | 4 ++-- .../objectReferenceInFieldInitializer.kt.txt | 2 +- .../outerClassInstanceReference.kt.txt | 4 ++-- .../primitivesImplicitConversions.kt.txt | 2 +- .../expressions/propertyReferences.kt.txt | 4 ++-- .../expressions/reflectionLiterals.kt.txt | 2 +- .../irText/expressions/safeAssignment.kt.txt | 2 +- .../safeCallWithIncrementDecrement.kt.txt | 2 +- .../ir/irText/expressions/safeCalls.kt.txt | 2 +- ...nversionInGenericConstructorCall_NI.kt.txt | 4 ++-- .../setFieldWithImplicitCast.kt.txt | 2 +- ...specializedTypeAliasConstructorCall.kt.txt | 2 +- .../temporaryInEnumEntryInitializer.kt.txt | 2 +- .../expressions/temporaryInInitBlock.kt.txt | 2 +- .../thisOfGenericOuterClass.kt.txt | 6 ++--- ...oObjectInNestedClassConstructorCall.kt.txt | 8 +++---- .../thisReferenceBeforeClassDeclared.kt.txt | 8 +++---- .../typeAliasConstructorReference.kt.txt | 6 ++--- .../typeParameterClassLiteral.kt.txt | 2 +- .../expressions/useImportedMember.kt.txt | 4 ++-- .../ir/irText/expressions/values.kt.txt | 8 +++---- .../ir/irText/expressions/when.kt.txt | 2 +- .../firProblems/AbstractMutableMap.kt.txt | 2 +- .../irText/firProblems/AllCandidates.kt.txt | 4 ++-- .../firProblems/AnnotationInAnnotation.kt.txt | 2 +- .../irText/firProblems/BaseFirBuilder.kt.txt | 2 +- .../ClashResolutionDescriptor.kt.txt | 4 ++-- .../irText/firProblems/DeepCopyIrTree.kt.txt | 2 +- .../DelegationAndInheritanceFromJava.kt.txt | 2 +- .../ir/irText/firProblems/FirBuilder.kt.txt | 4 ++-- .../firProblems/InnerClassInAnonymous.kt.txt | 6 ++--- .../ir/irText/firProblems/MultiList.kt.txt | 6 ++--- .../irText/firProblems/SignatureClash.kt.txt | 4 ++-- .../ir/irText/firProblems/VarInInit.kt.txt | 2 +- .../irText/firProblems/candidateSymbol.kt.txt | 4 ++-- .../ir/irText/firProblems/putIfAbsent.kt.txt | 2 +- .../irText/firProblems/v8arrayToList.kt.txt | 2 +- .../lambdas/destructuringInLambda.kt.txt | 2 +- .../lambdas/multipleImplicitReceivers.kt.txt | 4 ++-- .../regressions/integerCoercionToT.kt.txt | 4 ++-- .../typeAliasCtorForGenericClass.kt.txt | 2 +- .../ir/irText/singletons/companion.kt.txt | 4 ++-- .../ir/irText/singletons/enumEntry.kt.txt | 6 ++--- .../ir/irText/singletons/object.kt.txt | 4 ++-- .../genericClassInDifferentModule_m1.kt.txt | 2 +- .../genericClassInDifferentModule_m2.kt.txt | 2 +- .../ir/irText/stubs/javaInnerClass.kt.txt | 2 +- .../castsInsideCoroutineInference.kt.txt | 4 ++-- .../types/genericDelegatedDeepProperty.kt.txt | 12 +++++----- .../ir/irText/types/genericFunWithStar.kt.txt | 2 +- .../types/genericPropertyReferenceType.kt.txt | 2 +- .../irText/types/intersectionType1_NI.kt.txt | 2 +- .../irText/types/intersectionType1_OI.kt.txt | 2 +- .../irText/types/intersectionType2_NI.kt.txt | 4 ++-- .../irText/types/intersectionType2_OI.kt.txt | 4 ++-- .../ir/irText/types/javaWildcardType.kt.txt | 2 +- ...ullabilityInDestructuringAssignment.kt.txt | 4 ++-- .../enhancedNullabilityInForLoop.kt.txt | 2 +- .../implicitNotNullOnPlatformType.kt.txt | 2 +- ...abilityAssertionOnExtensionReceiver.kt.txt | 2 +- .../ir/irText/types/rawTypeInSignature.kt.txt | 8 +++---- .../types/receiverOfIntersectionType.kt.txt | 4 ++-- .../smartCastOnFakeOverrideReceiver.kt.txt | 8 +++---- .../smartCastOnReceiverOfGenericType.kt.txt | 6 ++--- .../ir/irText/types/starProjection_OI.kt.txt | 2 +- 208 files changed, 421 insertions(+), 421 deletions(-) diff --git a/compiler/testData/ir/irText/classes/abstractMembers.kt.txt b/compiler/testData/ir/irText/classes/abstractMembers.kt.txt index 27b5b6c4a34..3069a90f927 100644 --- a/compiler/testData/ir/irText/classes/abstractMembers.kt.txt +++ b/compiler/testData/ir/irText/classes/abstractMembers.kt.txt @@ -1,7 +1,7 @@ abstract class AbstractClass { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.kt.txt b/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.kt.txt index efcaa40dc09..9ab2b723751 100644 --- a/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.kt.txt +++ b/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.kt.txt @@ -1,7 +1,7 @@ open class Base { constructor(x: Int, y: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -20,7 +20,7 @@ class Test1 : Base { { // BLOCK super/*Base*/(x = xx, y = yy) } - /* InstanceInitializerCall */ + /* () */ } @@ -31,7 +31,7 @@ class Test2 : Base { { // BLOCK super/*Base*/(x = xx, y = yy) } - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/classMembers.kt.txt b/compiler/testData/ir/irText/classes/classMembers.kt.txt index d3b527f9bd1..2242eebf0c2 100644 --- a/compiler/testData/ir/irText/classes/classMembers.kt.txt +++ b/compiler/testData/ir/irText/classes/classMembers.kt.txt @@ -1,7 +1,7 @@ class C { constructor(x: Int, y: Int, z: Int = 1) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -46,7 +46,7 @@ class C { class NestedClass { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -71,7 +71,7 @@ class C { companion object Companion { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/classes.kt.txt b/compiler/testData/ir/irText/classes/classes.kt.txt index e92e77ca60b..1d635a53e2e 100644 --- a/compiler/testData/ir/irText/classes/classes.kt.txt +++ b/compiler/testData/ir/irText/classes/classes.kt.txt @@ -1,7 +1,7 @@ class TestClass { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -14,7 +14,7 @@ interface TestInterface { object TestObject { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -28,7 +28,7 @@ annotation class TestAnnotationClass : Annotation { enum class TestEnumClass : Enum { private constructor() /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/cloneable.kt.txt b/compiler/testData/ir/irText/classes/cloneable.kt.txt index 54414875278..3f3e225b76d 100644 --- a/compiler/testData/ir/irText/classes/cloneable.kt.txt +++ b/compiler/testData/ir/irText/classes/cloneable.kt.txt @@ -1,7 +1,7 @@ class A : Cloneable { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -14,7 +14,7 @@ interface I : Cloneable { class C : I { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -23,7 +23,7 @@ class C : I { class OC : I { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/companionObject.kt.txt b/compiler/testData/ir/irText/classes/companionObject.kt.txt index d98863848f0..c84b9b0b937 100644 --- a/compiler/testData/ir/irText/classes/companionObject.kt.txt +++ b/compiler/testData/ir/irText/classes/companionObject.kt.txt @@ -1,14 +1,14 @@ class Test1 { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } companion object Companion { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -19,14 +19,14 @@ class Test1 { class Test2 { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } companion object Named { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt index a6b96771542..83741801142 100644 --- a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt +++ b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt @@ -1,7 +1,7 @@ data class Test1 { constructor(stringArray: Array, charArray: CharArray, booleanArray: BooleanArray, byteArray: ByteArray, shortArray: ShortArray, intArray: IntArray, longArray: LongArray, floatArray: FloatArray, doubleArray: DoubleArray) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -168,7 +168,7 @@ dataClassArrayMemberToString(arg0 = #doubleArray) + data class Test2 { constructor(genericArray: Array) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -214,7 +214,7 @@ dataClassArrayMemberToString(arg0 = #genericArray) + data class Test3 { constructor(anyArrayN: Array?) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/dataClasses.kt.txt b/compiler/testData/ir/irText/classes/dataClasses.kt.txt index d1663fc90ff..98d1074bfa3 100644 --- a/compiler/testData/ir/irText/classes/dataClasses.kt.txt +++ b/compiler/testData/ir/irText/classes/dataClasses.kt.txt @@ -1,7 +1,7 @@ data class Test1 { constructor(x: Int, y: String, z: Any) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -78,7 +78,7 @@ data class Test1 { data class Test2 { constructor(x: Any?) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -127,7 +127,7 @@ data class Test2 { data class Test3 { constructor(d: Double, dn: Double?, f: Float, df: Float?) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt b/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt index 766c41c024e..c8c07bfc416 100644 --- a/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt +++ b/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt @@ -1,7 +1,7 @@ data class Test1 { constructor(x: T) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -50,7 +50,7 @@ data class Test1 { data class Test2 { constructor(x: T) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -96,7 +96,7 @@ data class Test2 { data class Test3 { constructor(x: List) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -142,7 +142,7 @@ data class Test3 { data class Test4 { constructor(x: List) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt b/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt index a69d0ad3620..1a80e772181 100644 --- a/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt @@ -12,7 +12,7 @@ interface IBase { class Test1 : IBase { constructor(i: IBase) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -39,7 +39,7 @@ class Test1 : IBase { class Test2 : IBase { constructor(j: IBase) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt index eb5f33ee9e0..94b2b17f666 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt @@ -8,7 +8,7 @@ interface IBase { object BaseImpl : IBase { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -46,7 +46,7 @@ fun otherImpl(x0: String, y0: Int): IOther { local class : IOther { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -80,7 +80,7 @@ fun otherImpl(x0: String, y0: Int): IOther { class Test1 : IBase { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -102,7 +102,7 @@ class Test1 : IBase { class Test2 : IBase, IOther { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt index e3903ec27f5..d4e4ee378be 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt @@ -1,7 +1,7 @@ class Test : J { constructor(j: J) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt index 8f49add819e..9ce32da6eaf 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt @@ -7,7 +7,7 @@ interface IFooBar { object FooBarImpl : IFooBar { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -22,7 +22,7 @@ object FooBarImpl : IFooBar { class C : IFooBar { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.kt.txt b/compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.kt.txt index e22727b3a35..84e7e981f0b 100644 --- a/compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.kt.txt @@ -1,7 +1,7 @@ open class Cell { constructor(value: T) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -16,7 +16,7 @@ typealias CStr = Cell class C1 : Cell { constructor() /* primary */ { super/*Cell*/(value = "O") - /* InstanceInitializerCall */ + /* () */ } @@ -25,7 +25,7 @@ class C1 : Cell { class C2 : Cell { constructor() /* primary */ { super/*Cell*/(value = "K") - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.kt.txt b/compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.kt.txt index 0283ae6dc8b..76909b1c2f5 100644 --- a/compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.kt.txt @@ -1,7 +1,7 @@ open class Base { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -10,13 +10,13 @@ open class Base { class Test : Base { constructor() { super/*Base*/() - /* InstanceInitializerCall */ + /* () */ } constructor(xx: Int) { super/*Base*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/enum.kt.txt b/compiler/testData/ir/irText/classes/enum.kt.txt index 37cbf03ac13..1b1f789592b 100644 --- a/compiler/testData/ir/irText/classes/enum.kt.txt +++ b/compiler/testData/ir/irText/classes/enum.kt.txt @@ -1,7 +1,7 @@ enum class TestEnum1 : Enum { private constructor() /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } @@ -18,7 +18,7 @@ enum class TestEnum1 : Enum { enum class TestEnum2 : Enum { private constructor(x: Int) /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } @@ -41,7 +41,7 @@ enum class TestEnum2 : Enum { abstract enum class TestEnum3 : Enum { private constructor() /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } @@ -49,7 +49,7 @@ abstract enum class TestEnum3 : Enum { private enum entry class TEST : TestEnum3 { private constructor() /* primary */ { super/*TestEnum3*/() /*~> Unit */ - /* InstanceInitializerCall */ + /* () */ } @@ -70,7 +70,7 @@ abstract enum class TestEnum3 : Enum { abstract enum class TestEnum4 : Enum { private constructor(x: Int) /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } @@ -82,7 +82,7 @@ abstract enum class TestEnum4 : Enum { private enum entry class TEST1 : TestEnum4 { private constructor() /* primary */ { super/*TestEnum4*/(x = 1) /*~> Unit */ - /* InstanceInitializerCall */ + /* () */ } @@ -96,7 +96,7 @@ abstract enum class TestEnum4 : Enum { private enum entry class TEST2 : TestEnum4 { private constructor() /* primary */ { super/*TestEnum4*/(x = 2) /*~> Unit */ - /* InstanceInitializerCall */ + /* () */ } @@ -124,7 +124,7 @@ abstract enum class TestEnum4 : Enum { enum class TestEnum5 : Enum { private constructor(x: Int = 0) /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } @@ -151,7 +151,7 @@ fun f(): Int { enum class TestEnum6 : Enum { private constructor(x: Int, y: Int) /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/enumClassModality.kt.txt b/compiler/testData/ir/irText/classes/enumClassModality.kt.txt index df83a07a71b..6f2597bcd93 100644 --- a/compiler/testData/ir/irText/classes/enumClassModality.kt.txt +++ b/compiler/testData/ir/irText/classes/enumClassModality.kt.txt @@ -1,7 +1,7 @@ enum class TestFinalEnum1 : Enum { private constructor() /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } @@ -16,7 +16,7 @@ enum class TestFinalEnum1 : Enum { enum class TestFinalEnum2 : Enum { private constructor(x: Int) /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } @@ -35,7 +35,7 @@ enum class TestFinalEnum2 : Enum { enum class TestFinalEnum3 : Enum { private constructor() /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } @@ -53,7 +53,7 @@ enum class TestFinalEnum3 : Enum { open enum class TestOpenEnum1 : Enum { private constructor() /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } @@ -61,7 +61,7 @@ open enum class TestOpenEnum1 : Enum { private enum entry class X1 : TestOpenEnum1 { private constructor() /* primary */ { super/*TestOpenEnum1*/() /*~> Unit */ - /* InstanceInitializerCall */ + /* () */ } @@ -80,7 +80,7 @@ open enum class TestOpenEnum1 : Enum { open enum class TestOpenEnum2 : Enum { private constructor() /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } @@ -88,7 +88,7 @@ open enum class TestOpenEnum2 : Enum { private enum entry class X1 : TestOpenEnum2 { private constructor() /* primary */ { super/*TestOpenEnum2*/() /*~> Unit */ - /* InstanceInitializerCall */ + /* () */ } @@ -109,7 +109,7 @@ open enum class TestOpenEnum2 : Enum { abstract enum class TestAbstractEnum1 : Enum { private constructor() /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } @@ -117,7 +117,7 @@ abstract enum class TestAbstractEnum1 : Enum { private enum entry class X1 : TestAbstractEnum1 { private constructor() /* primary */ { super/*TestAbstractEnum1*/() /*~> Unit */ - /* InstanceInitializerCall */ + /* () */ } @@ -142,7 +142,7 @@ interface IFoo { abstract enum class TestAbstractEnum2 : Enum, IFoo { private constructor() /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } @@ -150,7 +150,7 @@ abstract enum class TestAbstractEnum2 : Enum, IFoo { private enum entry class X1 : TestAbstractEnum2 { private constructor() /* primary */ { super/*TestAbstractEnum2*/() /*~> Unit */ - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt b/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt index b32cb50bb3c..1eb263c4044 100644 --- a/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt +++ b/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt @@ -5,7 +5,7 @@ open enum class A : Enum { private enum entry class Y : A { private constructor() /* primary */ { super/*A*/() /*~> Unit */ - /* InstanceInitializerCall */ + /* () */ } @@ -31,14 +31,14 @@ open enum class A : Enum { private constructor(arg: String) { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ #prop1 = arg } private constructor() { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ #prop1 = "default" .( = "empty") diff --git a/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt.txt b/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt.txt index 263a8dd14b0..0cece93f3bc 100644 --- a/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt.txt +++ b/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt.txt @@ -1,7 +1,7 @@ enum class Test0 : Enum { private constructor(x: Int) /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } @@ -24,7 +24,7 @@ enum class Test0 : Enum { enum class Test1 : Enum { private constructor(x: Int) /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } @@ -49,7 +49,7 @@ enum class Test1 : Enum { abstract enum class Test2 : Enum { private constructor(x: Int) /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } @@ -61,7 +61,7 @@ abstract enum class Test2 : Enum { private enum entry class ZERO : Test2 { private constructor() /* primary */ { super/*Test2*/() /*~> Unit */ - /* InstanceInitializerCall */ + /* () */ } @@ -75,7 +75,7 @@ abstract enum class Test2 : Enum { private enum entry class ONE : Test2 { private constructor() /* primary */ { super/*Test2*/(x = 1) /*~> Unit */ - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/fakeOverridesForJavaStaticMembers.kt.txt b/compiler/testData/ir/irText/classes/fakeOverridesForJavaStaticMembers.kt.txt index b25c8fe0aee..4d90026fcf6 100644 --- a/compiler/testData/ir/irText/classes/fakeOverridesForJavaStaticMembers.kt.txt +++ b/compiler/testData/ir/irText/classes/fakeOverridesForJavaStaticMembers.kt.txt @@ -1,7 +1,7 @@ class Test : Base { constructor() /* primary */ { super/*Base*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt index b006064a36c..d09ee5936bb 100644 --- a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt +++ b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt @@ -6,7 +6,7 @@ interface IFoo { class K1 : JFoo { constructor() /* primary */ { super/*JFoo*/() - /* InstanceInitializerCall */ + /* () */ } @@ -15,7 +15,7 @@ class K1 : JFoo { class K2 : JFoo { constructor() /* primary */ { super/*JFoo*/() - /* InstanceInitializerCall */ + /* () */ } @@ -28,7 +28,7 @@ class K2 : JFoo { class K3 : JUnrelatedFoo, IFoo { constructor() /* primary */ { super/*JUnrelatedFoo*/() - /* InstanceInitializerCall */ + /* () */ } @@ -37,7 +37,7 @@ class K3 : JUnrelatedFoo, IFoo { class K4 : JUnrelatedFoo, IFoo { constructor() /* primary */ { super/*JUnrelatedFoo*/() - /* InstanceInitializerCall */ + /* () */ } @@ -50,7 +50,7 @@ class K4 : JUnrelatedFoo, IFoo { class TestJFoo : IFoo { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -64,7 +64,7 @@ class TestJFoo : IFoo { class TestK1 : IFoo { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -78,7 +78,7 @@ class TestK1 : IFoo { class TestK2 : IFoo { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -92,7 +92,7 @@ class TestK2 : IFoo { class TestK3 : IFoo { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -106,7 +106,7 @@ class TestK3 : IFoo { class TestK4 : IFoo { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/initBlock.kt.txt b/compiler/testData/ir/irText/classes/initBlock.kt.txt index 6163ec91fff..7af4b2a85ee 100644 --- a/compiler/testData/ir/irText/classes/initBlock.kt.txt +++ b/compiler/testData/ir/irText/classes/initBlock.kt.txt @@ -1,7 +1,7 @@ class Test1 { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -14,7 +14,7 @@ class Test1 { class Test2 { constructor(x: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -35,7 +35,7 @@ class Test3 { constructor() { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -48,7 +48,7 @@ class Test4 { constructor() { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -61,7 +61,7 @@ class Test4 { class Test5 { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -72,7 +72,7 @@ class Test5 { inner class TestInner { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/initVal.kt.txt b/compiler/testData/ir/irText/classes/initVal.kt.txt index 4b3f935070a..8dc59032582 100644 --- a/compiler/testData/ir/irText/classes/initVal.kt.txt +++ b/compiler/testData/ir/irText/classes/initVal.kt.txt @@ -1,7 +1,7 @@ class TestInitValFromParameter { constructor(x: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -14,7 +14,7 @@ class TestInitValFromParameter { class TestInitValInClass { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -27,7 +27,7 @@ class TestInitValInClass { class TestInitValInInitBlock { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/initValInLambda.kt.txt b/compiler/testData/ir/irText/classes/initValInLambda.kt.txt index dda935da7a0..debd05f42f1 100644 --- a/compiler/testData/ir/irText/classes/initValInLambda.kt.txt +++ b/compiler/testData/ir/irText/classes/initValInLambda.kt.txt @@ -1,7 +1,7 @@ class TestInitValInLambdaCalledOnce { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/initVar.kt.txt b/compiler/testData/ir/irText/classes/initVar.kt.txt index 3233525aa99..a997b01012d 100644 --- a/compiler/testData/ir/irText/classes/initVar.kt.txt +++ b/compiler/testData/ir/irText/classes/initVar.kt.txt @@ -1,7 +1,7 @@ class TestInitVarFromParameter { constructor(x: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -15,7 +15,7 @@ class TestInitVarFromParameter { class TestInitVarInClass { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -29,7 +29,7 @@ class TestInitVarInClass { class TestInitVarInInitBlock { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -46,7 +46,7 @@ class TestInitVarInInitBlock { class TestInitVarWithCustomSetter { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -72,7 +72,7 @@ class TestInitVarWithCustomSetterWithExplicitCtor { constructor() { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -87,7 +87,7 @@ class TestInitVarWithCustomSetterInCtor { constructor() { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ .(value = 42) } diff --git a/compiler/testData/ir/irText/classes/inlineClass.kt.txt b/compiler/testData/ir/irText/classes/inlineClass.kt.txt index ec41ac4d6f0..2f0e8418990 100644 --- a/compiler/testData/ir/irText/classes/inlineClass.kt.txt +++ b/compiler/testData/ir/irText/classes/inlineClass.kt.txt @@ -1,7 +1,7 @@ inline class Test { constructor(x: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt b/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt index 2f95546e087..7b1babdc1c2 100644 --- a/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt +++ b/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt @@ -1,7 +1,7 @@ class C { constructor(t: T) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -18,7 +18,7 @@ class C { inline class IC { constructor(c: C) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/innerClass.kt.txt b/compiler/testData/ir/irText/classes/innerClass.kt.txt index e766ce646a8..39793360801 100644 --- a/compiler/testData/ir/irText/classes/innerClass.kt.txt +++ b/compiler/testData/ir/irText/classes/innerClass.kt.txt @@ -1,14 +1,14 @@ class Outer { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } open inner class TestInnerClass { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -17,7 +17,7 @@ class Outer { inner class DerivedInnerClass : TestInnerClass { constructor() /* primary */ { .super/*TestInnerClass*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.kt.txt b/compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.kt.txt index 49ca52b3f0a..5075b627062 100644 --- a/compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.kt.txt +++ b/compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.kt.txt @@ -1,14 +1,14 @@ class Outer { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } inner class Inner { constructor(x: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/kt31649.kt.txt b/compiler/testData/ir/irText/classes/kt31649.kt.txt index 84a85f99755..29275573344 100644 --- a/compiler/testData/ir/irText/classes/kt31649.kt.txt +++ b/compiler/testData/ir/irText/classes/kt31649.kt.txt @@ -1,7 +1,7 @@ data class TestData { constructor(nn: Nothing?) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -50,7 +50,7 @@ data class TestData { inline class TestInline { constructor(nn: Nothing?) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt index 3d89e877f4d..a26997bb63a 100644 --- a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt +++ b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt @@ -4,7 +4,7 @@ data class A { } ) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -52,7 +52,7 @@ data class B { local class { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -61,7 +61,7 @@ data class B { () }) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/localClasses.kt.txt b/compiler/testData/ir/irText/classes/localClasses.kt.txt index c1f5c521051..9d182803012 100644 --- a/compiler/testData/ir/irText/classes/localClasses.kt.txt +++ b/compiler/testData/ir/irText/classes/localClasses.kt.txt @@ -2,7 +2,7 @@ fun outer() { local class LocalClass { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt b/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt index 8a44e6a8ce3..cdc3e9b1841 100644 --- a/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt +++ b/compiler/testData/ir/irText/classes/objectLiteralExpressions.kt.txt @@ -8,7 +8,7 @@ val test1: Any local class { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -23,7 +23,7 @@ val test2: IFoo local class : IFoo { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -40,14 +40,14 @@ val test2: IFoo class Outer { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } abstract inner class Inner : IFoo { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -58,7 +58,7 @@ class Outer { local class : Inner { constructor() /* primary */ { .super/*Inner*/() - /* InstanceInitializerCall */ + /* () */ } @@ -79,7 +79,7 @@ fun Outer.test4(): Inner { local class : Inner { constructor() /* primary */ { .super/*Inner*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/objectWithInitializers.kt.txt b/compiler/testData/ir/irText/classes/objectWithInitializers.kt.txt index f17d0654ee9..2d07b4d6dd5 100644 --- a/compiler/testData/ir/irText/classes/objectWithInitializers.kt.txt +++ b/compiler/testData/ir/irText/classes/objectWithInitializers.kt.txt @@ -1,7 +1,7 @@ abstract class Base { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -10,7 +10,7 @@ abstract class Base { object Test : Base { private constructor() /* primary */ { super/*Base*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/outerClassAccess.kt.txt b/compiler/testData/ir/irText/classes/outerClassAccess.kt.txt index bcf17a607a9..3e14ce133d8 100644 --- a/compiler/testData/ir/irText/classes/outerClassAccess.kt.txt +++ b/compiler/testData/ir/irText/classes/outerClassAccess.kt.txt @@ -1,7 +1,7 @@ class Outer { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -11,7 +11,7 @@ class Outer { inner class Inner { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -22,7 +22,7 @@ class Outer { inner class Inner2 { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/primaryConstructor.kt.txt b/compiler/testData/ir/irText/classes/primaryConstructor.kt.txt index 17c007334ee..60c21475f3b 100644 --- a/compiler/testData/ir/irText/classes/primaryConstructor.kt.txt +++ b/compiler/testData/ir/irText/classes/primaryConstructor.kt.txt @@ -1,7 +1,7 @@ class Test1 { constructor(x: Int, y: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -18,7 +18,7 @@ class Test1 { class Test2 { constructor(x: Int, y: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -35,7 +35,7 @@ class Test2 { class Test3 { constructor(x: Int, y: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.kt.txt b/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.kt.txt index b2b8e87b6bf..52ff9edb877 100644 --- a/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.kt.txt +++ b/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.kt.txt @@ -1,7 +1,7 @@ open class Base { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -10,7 +10,7 @@ open class Base { class TestImplicitPrimaryConstructor : Base { constructor() /* primary */ { super/*Base*/() - /* InstanceInitializerCall */ + /* () */ } @@ -19,7 +19,7 @@ class TestImplicitPrimaryConstructor : Base { class TestExplicitPrimaryConstructor : Base { constructor() /* primary */ { super/*Base*/() - /* InstanceInitializerCall */ + /* () */ } @@ -28,7 +28,7 @@ class TestExplicitPrimaryConstructor : Base { class TestWithDelegatingConstructor : Base { constructor(x: Int, y: Int) /* primary */ { super/*Base*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/qualifiedSuperCalls.kt.txt b/compiler/testData/ir/irText/classes/qualifiedSuperCalls.kt.txt index 70c147ecab9..6f9d3519e5b 100644 --- a/compiler/testData/ir/irText/classes/qualifiedSuperCalls.kt.txt +++ b/compiler/testData/ir/irText/classes/qualifiedSuperCalls.kt.txt @@ -23,7 +23,7 @@ interface IRight { class CBoth : ILeft, IRight { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/sealedClasses.kt.txt b/compiler/testData/ir/irText/classes/sealedClasses.kt.txt index 118d203db34..6478ced9ad6 100644 --- a/compiler/testData/ir/irText/classes/sealedClasses.kt.txt +++ b/compiler/testData/ir/irText/classes/sealedClasses.kt.txt @@ -1,14 +1,14 @@ sealed class Expr { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } class Const : Expr { constructor(number: Double) /* primary */ { super/*Expr*/() - /* InstanceInitializerCall */ + /* () */ } @@ -21,7 +21,7 @@ sealed class Expr { class Sum : Expr { constructor(e1: Expr, e2: Expr) /* primary */ { super/*Expr*/() - /* InstanceInitializerCall */ + /* () */ } @@ -38,7 +38,7 @@ sealed class Expr { object NotANumber : Expr { private constructor() /* primary */ { super/*Expr*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt.txt b/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt.txt index b3b9e2c55da..a31ec922d9f 100644 --- a/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt.txt +++ b/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt.txt @@ -1,7 +1,7 @@ open class Base { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -14,7 +14,7 @@ class TestProperty : Base { constructor() { super/*Base*/() - /* InstanceInitializerCall */ + /* () */ } @@ -30,13 +30,13 @@ class TestInitBlock : Base { constructor() { super/*Base*/() - /* InstanceInitializerCall */ + /* () */ } constructor(z: Any) { super/*Base*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/secondaryConstructors.kt.txt b/compiler/testData/ir/irText/classes/secondaryConstructors.kt.txt index c267adaeb30..84a77059e81 100644 --- a/compiler/testData/ir/irText/classes/secondaryConstructors.kt.txt +++ b/compiler/testData/ir/irText/classes/secondaryConstructors.kt.txt @@ -5,7 +5,7 @@ class C { constructor(x: Int) { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/superCalls.kt.txt b/compiler/testData/ir/irText/classes/superCalls.kt.txt index 93cf125f348..687a71a5e3c 100644 --- a/compiler/testData/ir/irText/classes/superCalls.kt.txt +++ b/compiler/testData/ir/irText/classes/superCalls.kt.txt @@ -1,7 +1,7 @@ open class Base { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -21,7 +21,7 @@ open class Base { class Derived : Base { constructor() /* primary */ { super/*Base*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/classes/superCallsComposed.kt.txt b/compiler/testData/ir/irText/classes/superCallsComposed.kt.txt index 471013b28f6..bd02444c9cb 100644 --- a/compiler/testData/ir/irText/classes/superCallsComposed.kt.txt +++ b/compiler/testData/ir/irText/classes/superCallsComposed.kt.txt @@ -1,7 +1,7 @@ open class Base { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -24,7 +24,7 @@ interface BaseI { class Derived : Base, BaseI { constructor() /* primary */ { super/*Base*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt index 6a73fe8de59..dd685ea127e 100644 --- a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt @@ -22,7 +22,7 @@ interface IFoo { class DFoo : IFoo { constructor(d: IFoo) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.kt.txt b/compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.kt.txt index 7ff0acf5306..40b5ffcdbd6 100644 --- a/compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.kt.txt @@ -9,7 +9,7 @@ annotation class A : Annotation { class C { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt index d847caba86d..98dacab33e4 100644 --- a/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.kt.txt @@ -10,7 +10,7 @@ annotation class TestAnn : Annotation { class TestClass { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -25,7 +25,7 @@ interface TestInterface { object TestObject { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -34,7 +34,7 @@ object TestObject { class Host { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -42,7 +42,7 @@ class Host { companion object TestCompanion { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -54,7 +54,7 @@ class Host { enum class TestEnum : Enum { private constructor() /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.kt.txt index 506df0bf49d..8920ef5e3db 100644 --- a/compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.kt.txt @@ -10,7 +10,7 @@ class TestClass { @TestAnn(x = 1) constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt index 357f2ac0469..f41515d8c15 100644 --- a/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt @@ -9,7 +9,7 @@ annotation class A : Annotation { class Cell { constructor(value: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.kt.txt index c75c1884183..a409bf197a4 100644 --- a/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.kt.txt @@ -9,7 +9,7 @@ annotation class TestAnn : Annotation { open enum class TestEnum : Enum { private constructor() /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } @@ -22,7 +22,7 @@ open enum class TestEnum : Enum { private enum entry class ENTRY2 : TestEnum { private constructor() /* primary */ { super/*TestEnum*/() /*~> Unit */ - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt index d242b9165bf..5163a81efd1 100644 --- a/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt @@ -1,7 +1,7 @@ enum class En : Enum { private constructor() /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.kt.txt index 3151a9e8a65..05dc5755fca 100644 --- a/compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.kt.txt @@ -6,7 +6,7 @@ annotation class Ann : Annotation { class Test { constructor(x: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.kt.txt index 0235470af25..714ac0e7f4d 100644 --- a/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.kt.txt @@ -9,7 +9,7 @@ annotation class A : Annotation { class C { constructor(x: Int, y: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/annotations/propertySetterParameterWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/propertySetterParameterWithAnnotations.kt.txt index 454dd388aac..1db19eec87e 100644 --- a/compiler/testData/ir/irText/declarations/annotations/propertySetterParameterWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/propertySetterParameterWithAnnotations.kt.txt @@ -11,7 +11,7 @@ var p: Int class C { constructor(p: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/annotations/receiverParameterWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/receiverParameterWithAnnotations.kt.txt index 71c6e613a39..198a977fa67 100644 --- a/compiler/testData/ir/irText/declarations/annotations/receiverParameterWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/receiverParameterWithAnnotations.kt.txt @@ -6,7 +6,7 @@ annotation class Ann : Annotation { class A { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.kt.txt index b105f6e0f5d..13caad3c889 100644 --- a/compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.kt.txt @@ -12,7 +12,7 @@ fun testFun(x: Int) { class TestClassConstructor1 { constructor(x: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt b/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt index ae08381b7f1..cdc06bc23e6 100644 --- a/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt @@ -1,7 +1,7 @@ class C { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt b/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt index 205c61703d2..e64cbcacc1a 100644 --- a/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt @@ -10,7 +10,7 @@ val test1: Int /* by */ class C { constructor(map: MutableMap) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/extensionProperties.kt.txt b/compiler/testData/ir/irText/declarations/extensionProperties.kt.txt index 267b1e31f28..bec04c48d3a 100644 --- a/compiler/testData/ir/irText/declarations/extensionProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/extensionProperties.kt.txt @@ -13,7 +13,7 @@ var String.test2: Int class Host { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/fakeOverrides.kt.txt b/compiler/testData/ir/irText/declarations/fakeOverrides.kt.txt index 4110a02f158..f2f8577ba34 100644 --- a/compiler/testData/ir/irText/declarations/fakeOverrides.kt.txt +++ b/compiler/testData/ir/irText/declarations/fakeOverrides.kt.txt @@ -12,7 +12,7 @@ interface IBar { abstract class CFoo { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -24,7 +24,7 @@ abstract class CFoo { class Test1 : CFoo, IFooStr, IBar { constructor() /* primary */ { super/*CFoo*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt.txt b/compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt.txt index ca34745c9e5..ead82071077 100644 --- a/compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt.txt +++ b/compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt.txt @@ -1,7 +1,7 @@ class C { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -10,7 +10,7 @@ class C { object Delegate { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.kt.txt b/compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.kt.txt index 2e27521ce6f..87d5028821e 100644 --- a/compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.kt.txt +++ b/compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.kt.txt @@ -1,7 +1,7 @@ inline class IT { constructor(x: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -36,7 +36,7 @@ inline class IT { inline class InlineMutableSet : MutableSet { constructor(ms: MutableSet) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/kt29833.kt.txt b/compiler/testData/ir/irText/declarations/kt29833.kt.txt index 4f17ab6bb51..fff97c14f7e 100644 --- a/compiler/testData/ir/irText/declarations/kt29833.kt.txt +++ b/compiler/testData/ir/irText/declarations/kt29833.kt.txt @@ -3,7 +3,7 @@ package interop object Definitions { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/kt35550.kt.txt b/compiler/testData/ir/irText/declarations/kt35550.kt.txt index 3eefd726acd..66a1472b519 100644 --- a/compiler/testData/ir/irText/declarations/kt35550.kt.txt +++ b/compiler/testData/ir/irText/declarations/kt35550.kt.txt @@ -9,7 +9,7 @@ interface I { class A : I { constructor(i: I) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/localClassWithOverrides.kt.txt b/compiler/testData/ir/irText/declarations/localClassWithOverrides.kt.txt index be3fb0a6c6f..39087ba773a 100644 --- a/compiler/testData/ir/irText/declarations/localClassWithOverrides.kt.txt +++ b/compiler/testData/ir/irText/declarations/localClassWithOverrides.kt.txt @@ -2,7 +2,7 @@ fun outer() { local abstract class ALocal { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -19,7 +19,7 @@ fun outer() { local class Local : ALocal { constructor() /* primary */ { super/*ALocal*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectClassInherited.kt.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectClassInherited.kt.txt index 7702aaae39a..34fe84697c7 100644 --- a/compiler/testData/ir/irText/declarations/multiplatform/expectClassInherited.kt.txt +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectClassInherited.kt.txt @@ -14,7 +14,7 @@ expect open class B : A { abstract class A { protected constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -25,7 +25,7 @@ abstract class A { open class B : A { constructor(i: Int) /* primary */ { super/*A*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.kt.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.kt.txt index c7f3b5d4ed7..b18ea4a2487 100644 --- a/compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.kt.txt +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.kt.txt @@ -12,7 +12,7 @@ expect enum class MyEnum : Enum { enum class MyEnum : Enum { private constructor() /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.kt.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.kt.txt index ec28ed7f4c7..6f95f6af0b4 100644 --- a/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.kt.txt +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.kt.txt @@ -11,7 +11,7 @@ expect class Add : Ops { sealed class Ops { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -20,7 +20,7 @@ sealed class Ops { class Add : Ops { constructor() /* primary */ { super/*Ops*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/parameters/class.kt.txt b/compiler/testData/ir/irText/declarations/parameters/class.kt.txt index 414681de8f4..be10a108b61 100644 --- a/compiler/testData/ir/irText/declarations/parameters/class.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/class.kt.txt @@ -8,14 +8,14 @@ interface TestInterface { class Test { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } class TestNested { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -24,7 +24,7 @@ class Test { inner class TestInner { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/parameters/constructor.kt.txt b/compiler/testData/ir/irText/declarations/parameters/constructor.kt.txt index b0970a65095..e05d745e196 100644 --- a/compiler/testData/ir/irText/declarations/parameters/constructor.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/constructor.kt.txt @@ -1,7 +1,7 @@ class Test1 { constructor(x: T1, y: T2) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -18,7 +18,7 @@ class Test1 { class Test2 { constructor(x: Int, y: String) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -29,7 +29,7 @@ class Test2 { inner class TestInner { constructor(z: Z) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -48,7 +48,7 @@ class Test2 { class Test3 { constructor(x: Int, y: String = "") /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -65,7 +65,7 @@ class Test3 { class Test4 { constructor(x: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt index 74902ebe9b5..e2e22c91071 100644 --- a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt @@ -1,7 +1,7 @@ data class Test { constructor(x: T, y: String = "") /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.kt.txt b/compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.kt.txt index a94798f1eac..6e106cd3538 100644 --- a/compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.kt.txt @@ -10,7 +10,7 @@ var test2: Int class Host { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -28,7 +28,7 @@ class Host { class InPrimaryCtor { constructor(testInPrimaryCtor1: T, testInPrimaryCtor2: Int = 42) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt index a49deaf0140..f5b15febf27 100644 --- a/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt @@ -10,7 +10,7 @@ interface IBase { class Test : IBase { constructor(impl: IBase) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/parameters/fun.kt.txt b/compiler/testData/ir/irText/declarations/parameters/fun.kt.txt index f985b350851..3e20cb6f7e1 100644 --- a/compiler/testData/ir/irText/declarations/parameters/fun.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/fun.kt.txt @@ -13,7 +13,7 @@ fun String.textExt1(i: Int, j: String) { class Host { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/parameters/genericInnerClass.kt.txt b/compiler/testData/ir/irText/declarations/parameters/genericInnerClass.kt.txt index 503250dcd03..807626363fd 100644 --- a/compiler/testData/ir/irText/declarations/parameters/genericInnerClass.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/genericInnerClass.kt.txt @@ -1,14 +1,14 @@ class Outer { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } inner class Inner { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/parameters/propertyAccessors.kt.txt b/compiler/testData/ir/irText/declarations/parameters/propertyAccessors.kt.txt index 5165f6c13d8..c167871e1f3 100644 --- a/compiler/testData/ir/irText/declarations/parameters/propertyAccessors.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/propertyAccessors.kt.txt @@ -37,7 +37,7 @@ var T.testExt4: Int class Host { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/parameters/typeParameterBeforeBound.kt.txt b/compiler/testData/ir/irText/declarations/parameters/typeParameterBeforeBound.kt.txt index f7f88a64ada..0961a8e7862 100644 --- a/compiler/testData/ir/irText/declarations/parameters/typeParameterBeforeBound.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/typeParameterBeforeBound.kt.txt @@ -1,7 +1,7 @@ class Test1 { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/parameters/typeParameterBoundedBySubclass.kt.txt b/compiler/testData/ir/irText/declarations/parameters/typeParameterBoundedBySubclass.kt.txt index 0407f0fedf2..27b79cd61e2 100644 --- a/compiler/testData/ir/irText/declarations/parameters/typeParameterBoundedBySubclass.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/typeParameterBoundedBySubclass.kt.txt @@ -1,7 +1,7 @@ abstract class Base1 { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -10,7 +10,7 @@ abstract class Base1 { class Derived1 : Base1 { constructor() /* primary */ { super/*Base1*/() - /* InstanceInitializerCall */ + /* () */ } @@ -19,7 +19,7 @@ class Derived1 : Base1 { abstract class Base2 { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -31,7 +31,7 @@ abstract class Base2 { class Derived2 : Base2 { constructor() /* primary */ { super/*Base2*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.kt.txt b/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.kt.txt index d6e01b5c993..933cbd371df 100644 --- a/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.kt.txt +++ b/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.kt.txt @@ -1,7 +1,7 @@ class Test { constructor(x: Int = 0) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/primaryCtorProperties.kt.txt b/compiler/testData/ir/irText/declarations/primaryCtorProperties.kt.txt index 59230d68345..8ebd89a3b02 100644 --- a/compiler/testData/ir/irText/declarations/primaryCtorProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/primaryCtorProperties.kt.txt @@ -1,7 +1,7 @@ class C { constructor(test1: Int, test2: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt index 995dc1647e9..8efa4a30fda 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.kt.txt @@ -1,7 +1,7 @@ class MyClass { constructor(value: String) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/local.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/local.kt.txt index f59a769225a..85d9f427021 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/local.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/local.kt.txt @@ -1,7 +1,7 @@ class Delegate { constructor(value: String) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -18,7 +18,7 @@ class Delegate { class DelegateProvider { constructor(value: String) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt index 4cfecc03c66..56b89e59655 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt.txt @@ -1,7 +1,7 @@ class MyClass { constructor(value: String) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt index 881cb1e698e..8e117b1728e 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt @@ -1,7 +1,7 @@ class Delegate { constructor(value: String) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -18,7 +18,7 @@ class Delegate { class DelegateProvider { constructor(value: String) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -35,7 +35,7 @@ class DelegateProvider { class Host { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt index 2175f0337a6..65135b040d1 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt @@ -1,14 +1,14 @@ object Host { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } class StringDelegate { constructor(s: String) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.kt.txt index 3b97be38e4e..eee35c45df1 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.kt.txt @@ -1,7 +1,7 @@ class Delegate { constructor(value: String) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -18,7 +18,7 @@ class Delegate { class DelegateProvider { constructor(value: String) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/declarations/typeAlias.kt.txt b/compiler/testData/ir/irText/declarations/typeAlias.kt.txt index 80cf0757892..fd388f1a6f8 100644 --- a/compiler/testData/ir/irText/declarations/typeAlias.kt.txt +++ b/compiler/testData/ir/irText/declarations/typeAlias.kt.txt @@ -7,7 +7,7 @@ fun foo() { class C { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/errors/suppressedNonPublicCall.kt.txt b/compiler/testData/ir/irText/errors/suppressedNonPublicCall.kt.txt index be2ddfddf77..248707a1ec8 100644 --- a/compiler/testData/ir/irText/errors/suppressedNonPublicCall.kt.txt +++ b/compiler/testData/ir/irText/errors/suppressedNonPublicCall.kt.txt @@ -1,7 +1,7 @@ class C { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.kt.txt b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.kt.txt index dc6157aa590..9765c14f760 100644 --- a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.kt.txt +++ b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.kt.txt @@ -9,7 +9,7 @@ fun bar(): Int { class C { constructor(x: IntArray) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/assignments.kt.txt b/compiler/testData/ir/irText/expressions/assignments.kt.txt index 2bb0575af4a..c0d911db18c 100644 --- a/compiler/testData/ir/irText/expressions/assignments.kt.txt +++ b/compiler/testData/ir/irText/expressions/assignments.kt.txt @@ -1,7 +1,7 @@ class Ref { constructor(x: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt b/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt index 20f7ee9d601..1d20e1313c0 100644 --- a/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt +++ b/compiler/testData/ir/irText/expressions/augmentedAssignment2.kt.txt @@ -1,7 +1,7 @@ class A { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.kt.txt b/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.kt.txt index b68fc3d5dce..81ee66c9bc8 100644 --- a/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.kt.txt +++ b/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.kt.txt @@ -1,7 +1,7 @@ class Host { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/boundCallableReferences.kt.txt b/compiler/testData/ir/irText/expressions/boundCallableReferences.kt.txt index 42e41290c72..931ca56c3eb 100644 --- a/compiler/testData/ir/irText/expressions/boundCallableReferences.kt.txt +++ b/compiler/testData/ir/irText/expressions/boundCallableReferences.kt.txt @@ -1,7 +1,7 @@ class A { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt index ff78f303dc0..59c4b5eb534 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt.txt @@ -4,7 +4,7 @@ fun use(f: @ExtensionFunctionType Function2) { class C { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt index f283591c503..b033722a959 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt @@ -3,14 +3,14 @@ package test class Foo { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } inner class Inner

{ constructor(a: T, b: P) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt index d45da24e38c..2a8da60a737 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.kt.txt @@ -10,7 +10,7 @@ fun interface IFoo2 : IFoo { object A { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -19,7 +19,7 @@ object A { object B { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt index d259c3e1edd..71a408fd35b 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt @@ -5,7 +5,7 @@ fun use(fn: Function1): Any { class C { constructor(vararg xs: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -14,14 +14,14 @@ class C { class Outer { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } inner class Inner { constructor(vararg xs: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt.txt index bfaf53bbc2b..3171c63c6b8 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt.txt @@ -13,7 +13,7 @@ fun varargs(vararg xs: String): Int { class C { constructor(x: String = "") /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt.txt index fd79b49f155..bbd8f11082c 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt.txt @@ -1,7 +1,7 @@ class A { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/importedFromObject.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/importedFromObject.kt.txt index ebb869ef4ef..e35ff17d6df 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/importedFromObject.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/importedFromObject.kt.txt @@ -3,7 +3,7 @@ package test object Foo { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt index b71aa180da8..ae24664ea68 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/kt37131.kt.txt @@ -5,7 +5,7 @@ fun foo(x: String = ""): String { class C { constructor(x: String = "") /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt index 662743840da..0a20ee52a87 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt @@ -26,7 +26,7 @@ fun foo4(i: Int = 42) { class C { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/typeArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/typeArguments.kt.txt index 909ea6478f4..afbc5f32bc8 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/typeArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/typeArguments.kt.txt @@ -1,7 +1,7 @@ object Host { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt index 2c53f1d3be3..8d2b3fa8a14 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt @@ -7,7 +7,7 @@ fun use2(fn: Function1) { open class A { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -20,7 +20,7 @@ open class A { object Obj : A { private constructor() /* primary */ { super/*A*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt index 9ef62ca6265..de12596b249 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt @@ -24,7 +24,7 @@ fun fnWithVarargs(vararg xs: Int): String { object Host { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt index 778c1d5ef1f..90bbd40c144 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt @@ -5,7 +5,7 @@ fun use(fn: Function1) { class Host { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/castToTypeParameter.kt.txt b/compiler/testData/ir/irText/expressions/castToTypeParameter.kt.txt index d37018e51b7..5041b4ffcf2 100644 --- a/compiler/testData/ir/irText/expressions/castToTypeParameter.kt.txt +++ b/compiler/testData/ir/irText/expressions/castToTypeParameter.kt.txt @@ -14,7 +14,7 @@ val T.castExtVal: T class Host { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt b/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt index 44aa31dbb1f..343cf760287 100644 --- a/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt +++ b/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt @@ -1,7 +1,7 @@ class C { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/classReference.kt.txt b/compiler/testData/ir/irText/expressions/classReference.kt.txt index ee6e13d7e6f..7cd8b17a945 100644 --- a/compiler/testData/ir/irText/expressions/classReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/classReference.kt.txt @@ -1,7 +1,7 @@ class A { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt index 283189eb48b..8a903ad8b97 100644 --- a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt +++ b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt.txt @@ -1,7 +1,7 @@ object X1 { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -13,7 +13,7 @@ object X1 { object X2 { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -25,7 +25,7 @@ object X1 { object X3 { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -85,7 +85,7 @@ fun test2() { class B { constructor(s: Int = 0) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -99,7 +99,7 @@ class B { object Host { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.kt.txt b/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.kt.txt index 322337e59bc..a88b853cbb3 100644 --- a/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.kt.txt @@ -9,14 +9,14 @@ fun testJava(): J2 { class K1 { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } inner class K2 { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/contructorCall.kt.txt b/compiler/testData/ir/irText/expressions/contructorCall.kt.txt index 45f4be27318..639bef3c255 100644 --- a/compiler/testData/ir/irText/expressions/contructorCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/contructorCall.kt.txt @@ -1,7 +1,7 @@ class A { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/destructuring1.kt.txt b/compiler/testData/ir/irText/expressions/destructuring1.kt.txt index f4e556343c9..05c3716b9cc 100644 --- a/compiler/testData/ir/irText/expressions/destructuring1.kt.txt +++ b/compiler/testData/ir/irText/expressions/destructuring1.kt.txt @@ -1,7 +1,7 @@ object A { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -10,7 +10,7 @@ object A { object B { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.kt.txt b/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.kt.txt index 2d7aaf67116..e1f49ab335c 100644 --- a/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.kt.txt +++ b/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.kt.txt @@ -1,7 +1,7 @@ object A { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -10,7 +10,7 @@ object A { object B { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt b/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt index bc4951b1792..39513e1e4b9 100644 --- a/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt +++ b/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt @@ -1,7 +1,7 @@ abstract enum class X : Enum { private constructor() /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } @@ -9,7 +9,7 @@ abstract enum class X : Enum { private enum entry class B : X { private constructor() /* primary */ { super/*X*/() /*~> Unit */ - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt index 15079bfa843..222f0cb65e9 100644 --- a/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt +++ b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt @@ -1,7 +1,7 @@ open enum class MyEnum : Enum { private constructor() /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } @@ -9,7 +9,7 @@ open enum class MyEnum : Enum { private enum entry class Z : MyEnum { private constructor() /* primary */ { super/*MyEnum*/() /*~> Unit */ - /* InstanceInitializerCall */ + /* () */ } @@ -39,7 +39,7 @@ open enum class MyEnum : Enum { local class { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt b/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt index 5c974d8b40f..e38d74c6bc2 100644 --- a/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt +++ b/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt @@ -1,7 +1,7 @@ enum class A : Enum { private constructor() /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.kt.txt index 6dfe5b398c9..c657962dbf4 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.kt.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.kt.txt @@ -50,7 +50,7 @@ fun test6(x: Any, y: T): Boolean { class F { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt index d0cc3943588..7db77b47e50 100644 --- a/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt +++ b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt.txt @@ -1,7 +1,7 @@ object FiveTimes { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -10,7 +10,7 @@ object FiveTimes { class IntCell { constructor(value: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/funImportedFromObject.kt.txt b/compiler/testData/ir/irText/expressions/funImportedFromObject.kt.txt index 0c6c653fdd4..add7154f8a0 100644 --- a/compiler/testData/ir/irText/expressions/funImportedFromObject.kt.txt +++ b/compiler/testData/ir/irText/expressions/funImportedFromObject.kt.txt @@ -3,7 +3,7 @@ package test object Host { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt index d636473a6b8..1fcb4d77db5 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/partialSam.kt.txt @@ -6,7 +6,7 @@ fun interface Fn { class J { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -21,7 +21,7 @@ val fsi: Fn local class : Fn { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -40,7 +40,7 @@ val fis: Fn local class : Fn { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt b/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt index 9c9cac7e101..f3cbd3ccae7 100644 --- a/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.kt.txt @@ -12,7 +12,7 @@ inline fun testArray(n: Int, crossinline block: Function0) class Box { constructor(value: T) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt b/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt index d8fd56dbcd2..3bb8e604151 100644 --- a/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt +++ b/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt @@ -1,7 +1,7 @@ class Value { constructor(value: T = null as T, text: String? = null) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -32,7 +32,7 @@ val Value.additionalValue: Int /* by */ class DVal { constructor(kmember: Any) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.kt.txt b/compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.kt.txt index ea241dbb39c..14dad1853e8 100644 --- a/compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.kt.txt +++ b/compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.kt.txt @@ -1,7 +1,7 @@ class C { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.kt.txt b/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.kt.txt index 04559c16e41..f6ce5798ce0 100644 --- a/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.kt.txt +++ b/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.kt.txt @@ -20,7 +20,7 @@ val Foo.asT: T? class Bar { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt b/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt index 4325bd0132e..a69a9646d20 100644 --- a/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt +++ b/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt @@ -5,7 +5,7 @@ interface IFoo { class Derived1 : JFieldOwner, IFoo { constructor() /* primary */ { super/*JFieldOwner*/() - /* InstanceInitializerCall */ + /* () */ } @@ -14,7 +14,7 @@ class Derived1 : JFieldOwner, IFoo { class Derived2 : JFieldOwner, IFoo { constructor() /* primary */ { super/*JFieldOwner*/() - /* InstanceInitializerCall */ + /* () */ } @@ -23,7 +23,7 @@ class Derived2 : JFieldOwner, IFoo { open class Mid : JFieldOwner { constructor() /* primary */ { super/*JFieldOwner*/() - /* InstanceInitializerCall */ + /* () */ } @@ -32,7 +32,7 @@ open class Mid : JFieldOwner { class DerivedThroughMid1 : Mid, IFoo { constructor() /* primary */ { super/*Mid*/() - /* InstanceInitializerCall */ + /* () */ } @@ -41,7 +41,7 @@ class DerivedThroughMid1 : Mid, IFoo { class DerivedThroughMid2 : Mid, IFoo { constructor() /* primary */ { super/*Mid*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt.txt b/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt.txt index 8ead844afc8..9e774c01faf 100644 --- a/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt.txt @@ -1,7 +1,7 @@ class Derived : Base { constructor() /* primary */ { super/*Base*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt index 8061ef43ab6..8e2768d8ae4 100644 --- a/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt @@ -14,7 +14,7 @@ var testProp: Any class TestClass { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/kt16904.kt.txt b/compiler/testData/ir/irText/expressions/kt16904.kt.txt index f4e3c7039d5..a8c8a13cc4c 100644 --- a/compiler/testData/ir/irText/expressions/kt16904.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt16904.kt.txt @@ -1,7 +1,7 @@ abstract class A { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -19,7 +19,7 @@ abstract class A { class B { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -31,7 +31,7 @@ class B { class Test1 : A { constructor() { super/*A*/() - /* InstanceInitializerCall */ + /* () */ { // BLOCK val tmp0_this: Test1 = @@ -48,7 +48,7 @@ class Test1 : A { class Test2 : J { constructor() /* primary */ { super/*J*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/kt16905.kt.txt b/compiler/testData/ir/irText/expressions/kt16905.kt.txt index 64e44df3078..2ba4dedbf98 100644 --- a/compiler/testData/ir/irText/expressions/kt16905.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt16905.kt.txt @@ -1,14 +1,14 @@ class Outer { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } open inner class Inner { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -17,7 +17,7 @@ class Outer { inner class InnerDerived0 : Inner { constructor() /* primary */ { .super/*Inner*/() - /* InstanceInitializerCall */ + /* () */ } @@ -26,7 +26,7 @@ class Outer { inner class InnerDerived1 : Inner { constructor() /* primary */ { .super/*Inner*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/kt23030.kt.txt b/compiler/testData/ir/irText/expressions/kt23030.kt.txt index 3a5663bb02c..9ebfac5f270 100644 --- a/compiler/testData/ir/irText/expressions/kt23030.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt23030.kt.txt @@ -29,7 +29,7 @@ fun testEqualsWithSmartCast(x: Any, y: Any): Boolean { class C { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/kt28456.kt.txt b/compiler/testData/ir/irText/expressions/kt28456.kt.txt index 647b654b1c6..c008171be0a 100644 --- a/compiler/testData/ir/irText/expressions/kt28456.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt28456.kt.txt @@ -1,7 +1,7 @@ class A { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/kt28456a.kt.txt b/compiler/testData/ir/irText/expressions/kt28456a.kt.txt index e36f59d42a2..373081eb9e1 100644 --- a/compiler/testData/ir/irText/expressions/kt28456a.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt28456a.kt.txt @@ -1,7 +1,7 @@ class A { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/kt28456b.kt.txt b/compiler/testData/ir/irText/expressions/kt28456b.kt.txt index 2ff00d0d234..78ca854cb33 100644 --- a/compiler/testData/ir/irText/expressions/kt28456b.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt28456b.kt.txt @@ -1,7 +1,7 @@ class A { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/kt30020.kt.txt b/compiler/testData/ir/irText/expressions/kt30020.kt.txt index 72a23624845..19777dc7bad 100644 --- a/compiler/testData/ir/irText/expressions/kt30020.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt30020.kt.txt @@ -37,7 +37,7 @@ fun MutableList.testExtensionReceiver() { abstract class AML : MutableList { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -48,7 +48,7 @@ abstract class AML : MutableList { inner class Inner { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/kt35730.kt.txt b/compiler/testData/ir/irText/expressions/kt35730.kt.txt index 76ab247e155..c5f0a004967 100644 --- a/compiler/testData/ir/irText/expressions/kt35730.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt35730.kt.txt @@ -7,7 +7,7 @@ interface Base { object Derived : Base { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/kt36956.kt.txt b/compiler/testData/ir/irText/expressions/kt36956.kt.txt index fd7eb787089..c10a620d7f8 100644 --- a/compiler/testData/ir/irText/expressions/kt36956.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt36956.kt.txt @@ -1,7 +1,7 @@ class A { constructor(value: T) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/kt37570.kt.txt b/compiler/testData/ir/irText/expressions/kt37570.kt.txt index 063f44f05dc..68d8602f76f 100644 --- a/compiler/testData/ir/irText/expressions/kt37570.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt37570.kt.txt @@ -5,7 +5,7 @@ fun a(): String { class A { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/memberTypeArguments.kt.txt b/compiler/testData/ir/irText/expressions/memberTypeArguments.kt.txt index 117a06696a6..6f23eac262e 100644 --- a/compiler/testData/ir/irText/expressions/memberTypeArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/memberTypeArguments.kt.txt @@ -1,7 +1,7 @@ class GenericClass { constructor(value: T) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/membersImportedFromObject.kt.txt b/compiler/testData/ir/irText/expressions/membersImportedFromObject.kt.txt index 2eacbd959f6..57b326943ef 100644 --- a/compiler/testData/ir/irText/expressions/membersImportedFromObject.kt.txt +++ b/compiler/testData/ir/irText/expressions/membersImportedFromObject.kt.txt @@ -1,7 +1,7 @@ object A { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt b/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt index 67aaed18e2b..08f33b41402 100644 --- a/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt +++ b/compiler/testData/ir/irText/expressions/multipleThisReferences.kt.txt @@ -1,14 +1,14 @@ class Outer { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } open inner class Inner { constructor(x: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -23,7 +23,7 @@ class Outer { class Host { constructor(y: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -36,7 +36,7 @@ class Host { local class : Inner { constructor() /* primary */ { .super/*Inner*/(x = 42) - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt b/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt index 4db230c91ce..e7c546f9ec5 100644 --- a/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt +++ b/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt @@ -1,7 +1,7 @@ object A { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -10,7 +10,7 @@ object A { enum class En : Enum { private constructor() /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/objectClassReference.kt.txt b/compiler/testData/ir/irText/expressions/objectClassReference.kt.txt index e6eed1deb85..ea74ca8d175 100644 --- a/compiler/testData/ir/irText/expressions/objectClassReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/objectClassReference.kt.txt @@ -1,7 +1,7 @@ object A { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/objectReference.kt.txt b/compiler/testData/ir/irText/expressions/objectReference.kt.txt index 2e51824bd98..200b6e12164 100644 --- a/compiler/testData/ir/irText/expressions/objectReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/objectReference.kt.txt @@ -1,7 +1,7 @@ object Z { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -23,7 +23,7 @@ object Z { class Nested { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -58,7 +58,7 @@ object Z { local class { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.kt.txt b/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.kt.txt index 83e01d4ace8..9672d5107b9 100644 --- a/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.kt.txt @@ -1,7 +1,7 @@ abstract class Base { constructor(lambda: Function0) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -17,7 +17,7 @@ object Test : Base { return Test } ) - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.kt.txt b/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.kt.txt index 38519769ffc..a8a1607b643 100644 --- a/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.kt.txt +++ b/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.kt.txt @@ -1,7 +1,7 @@ object A { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt.txt b/compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt.txt index b9239e02aa2..09d035df815 100644 --- a/compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt.txt @@ -1,7 +1,7 @@ class Outer { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -11,7 +11,7 @@ class Outer { inner class Inner { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.kt.txt b/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.kt.txt index 00520217d00..529d112c01d 100644 --- a/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.kt.txt +++ b/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.kt.txt @@ -38,7 +38,7 @@ fun testImplicitArguments(x: Long = 1.unaryMinus().toLong()) { class TestImplicitArguments { constructor(x: Long = 1.unaryMinus().toLong()) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/propertyReferences.kt.txt b/compiler/testData/ir/irText/expressions/propertyReferences.kt.txt index 6753cc9a772..3b9b20bd3b9 100644 --- a/compiler/testData/ir/irText/expressions/propertyReferences.kt.txt +++ b/compiler/testData/ir/irText/expressions/propertyReferences.kt.txt @@ -1,7 +1,7 @@ object Delegate { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -17,7 +17,7 @@ object Delegate { open class C { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt b/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt index f05330c983a..6cd23bd7fbe 100644 --- a/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt +++ b/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt @@ -1,7 +1,7 @@ class A { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt b/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt index bbf4d5c2f5d..6b3d127ee76 100644 --- a/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt +++ b/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt @@ -1,7 +1,7 @@ class C { constructor(x: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt index 2e0d38619f9..59e8d49b038 100644 --- a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt +++ b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt @@ -3,7 +3,7 @@ package test class C { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/safeCalls.kt.txt b/compiler/testData/ir/irText/expressions/safeCalls.kt.txt index 1c691717344..e67d66ff909 100644 --- a/compiler/testData/ir/irText/expressions/safeCalls.kt.txt +++ b/compiler/testData/ir/irText/expressions/safeCalls.kt.txt @@ -1,7 +1,7 @@ class Ref { constructor(value: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt index dbb69d78f6c..179e9a35468 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.kt.txt @@ -5,7 +5,7 @@ fun test3(f1: Function1, f2: Function1): D<@Flexibl class Outer { constructor(j11: J) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -16,7 +16,7 @@ class Outer { inner class Inner { constructor(j12: J) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt index 6dacaaf3fd5..9bc7b6d8090 100644 --- a/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt +++ b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt @@ -1,7 +1,7 @@ class Derived : Base { constructor() /* primary */ { super/*Base*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.kt.txt b/compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.kt.txt index 3d5368d3e83..29a835a11f4 100644 --- a/compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.kt.txt @@ -1,7 +1,7 @@ class Cell { constructor(value: T) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.kt.txt b/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.kt.txt index 512cf347e1e..fabba3bae2c 100644 --- a/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.kt.txt +++ b/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.kt.txt @@ -5,7 +5,7 @@ val n: Any? enum class En : Enum { private constructor(x: String?) /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt b/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt index 55002ec2aea..893046067fa 100644 --- a/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt +++ b/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt @@ -1,7 +1,7 @@ class C { constructor(x: Any?) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt b/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt index 359f6dd82ef..73718400f8e 100644 --- a/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt +++ b/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt.txt @@ -1,7 +1,7 @@ class Outer { constructor(x: T) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -12,7 +12,7 @@ class Outer { open inner class Inner { constructor(y: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -29,7 +29,7 @@ fun Outer.test(): Inner { local class : Inner { constructor() /* primary */ { .super/*Inner*/(y = 42) - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.kt.txt b/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.kt.txt index b230231eedc..7591fb8ddf8 100644 --- a/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.kt.txt @@ -1,7 +1,7 @@ open class Base { constructor(x: Any) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -14,14 +14,14 @@ open class Base { object Host { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } class Derived1 : Base { constructor() /* primary */ { super/*Base*/(x = Host) - /* InstanceInitializerCall */ + /* () */ } @@ -30,7 +30,7 @@ object Host { class Derived2 : Base { constructor() /* primary */ { super/*Base*/(x = Host) - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt b/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt index d8bd16379d1..cdc21d497b3 100644 --- a/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt +++ b/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt.txt @@ -3,7 +3,7 @@ fun WithCompanion.test() { local class : WithCompanion { constructor() /* primary */ { super/*WithCompanion*/(a = Companion) - /* InstanceInitializerCall */ + /* () */ } @@ -15,7 +15,7 @@ fun WithCompanion.test() { local class : WithCompanion { constructor() /* primary */ { super/*WithCompanion*/(a = Companion.foo()) - /* InstanceInitializerCall */ + /* () */ } @@ -28,14 +28,14 @@ fun WithCompanion.test() { open class WithCompanion { constructor(a: Companion) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } companion object Companion { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/typeAliasConstructorReference.kt.txt b/compiler/testData/ir/irText/expressions/typeAliasConstructorReference.kt.txt index 2e197270852..bf53ca70dd7 100644 --- a/compiler/testData/ir/irText/expressions/typeAliasConstructorReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/typeAliasConstructorReference.kt.txt @@ -1,7 +1,7 @@ class C { constructor(x: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -11,14 +11,14 @@ typealias CA = C object Host { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } class Nested { constructor(x: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/typeParameterClassLiteral.kt.txt b/compiler/testData/ir/irText/expressions/typeParameterClassLiteral.kt.txt index 86ba0ec7ca5..b60a2348d72 100644 --- a/compiler/testData/ir/irText/expressions/typeParameterClassLiteral.kt.txt +++ b/compiler/testData/ir/irText/expressions/typeParameterClassLiteral.kt.txt @@ -14,7 +14,7 @@ val T.classRefExtVal: KClass class Host { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/useImportedMember.kt.txt b/compiler/testData/ir/irText/expressions/useImportedMember.kt.txt index 35532431123..cfa75e89d95 100644 --- a/compiler/testData/ir/irText/expressions/useImportedMember.kt.txt +++ b/compiler/testData/ir/irText/expressions/useImportedMember.kt.txt @@ -12,7 +12,7 @@ interface I { open class BaseClass { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -26,7 +26,7 @@ open class BaseClass { object C : BaseClass, I { private constructor() /* primary */ { super/*BaseClass*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/values.kt.txt b/compiler/testData/ir/irText/expressions/values.kt.txt index 67145c6a26c..3123fc82308 100644 --- a/compiler/testData/ir/irText/expressions/values.kt.txt +++ b/compiler/testData/ir/irText/expressions/values.kt.txt @@ -1,7 +1,7 @@ enum class Enum : Enum { private constructor() /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } @@ -16,7 +16,7 @@ enum class Enum : Enum { object A { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -29,14 +29,14 @@ val a: Int class Z { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } companion object Companion { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/expressions/when.kt.txt b/compiler/testData/ir/irText/expressions/when.kt.txt index e731e9caf78..7b15755d586 100644 --- a/compiler/testData/ir/irText/expressions/when.kt.txt +++ b/compiler/testData/ir/irText/expressions/when.kt.txt @@ -1,7 +1,7 @@ object A { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/firProblems/AbstractMutableMap.kt.txt b/compiler/testData/ir/irText/firProblems/AbstractMutableMap.kt.txt index 5d5198585c6..b9611c2e4d0 100644 --- a/compiler/testData/ir/irText/firProblems/AbstractMutableMap.kt.txt +++ b/compiler/testData/ir/irText/firProblems/AbstractMutableMap.kt.txt @@ -1,7 +1,7 @@ class MyMap : AbstractMutableMap { constructor() /* primary */ { super/*AbstractMutableMap*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt b/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt index 991d64e8f53..05f10d40798 100644 --- a/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt +++ b/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt @@ -1,7 +1,7 @@ class ResolvedCall { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -10,7 +10,7 @@ class ResolvedCall { class MyCandidate { constructor(resolvedCall: ResolvedCall<*>) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.kt.txt b/compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.kt.txt index 82d9bea15dc..e623affd366 100644 --- a/compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.kt.txt +++ b/compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.kt.txt @@ -22,7 +22,7 @@ annotation class State : Annotation { class Test { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/firProblems/BaseFirBuilder.kt.txt b/compiler/testData/ir/irText/firProblems/BaseFirBuilder.kt.txt index 4f244a4522c..4ef34d3ee53 100644 --- a/compiler/testData/ir/irText/firProblems/BaseFirBuilder.kt.txt +++ b/compiler/testData/ir/irText/firProblems/BaseFirBuilder.kt.txt @@ -1,7 +1,7 @@ abstract class BaseFirBuilder { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt index 73129fe08a1..4c527857596 100644 --- a/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt +++ b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt @@ -13,7 +13,7 @@ interface ComponentDescriptor { abstract class PlatformExtensionsClashResolver> { constructor(applicableTo: Class) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -26,7 +26,7 @@ abstract class PlatformExtensionsClashResolver> class ClashResolutionDescriptor> { constructor(container: ComponentContainer, resolver: PlatformExtensionsClashResolver, clashedComponents: List) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt index c0afd6ad93a..822b8bc7f0d 100644 --- a/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt +++ b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt.txt @@ -33,7 +33,7 @@ interface IrDeclarationParent { class DeepCopyIrTreeWithSymbols { constructor(typeRemapper: TypeRemapper) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt index 1628eec04df..7ba2c787799 100644 --- a/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt +++ b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt @@ -1,7 +1,7 @@ class Impl : A, B { constructor(b: B) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/firProblems/FirBuilder.kt.txt b/compiler/testData/ir/irText/firProblems/FirBuilder.kt.txt index a8dfae53657..bd90c729acd 100644 --- a/compiler/testData/ir/irText/firProblems/FirBuilder.kt.txt +++ b/compiler/testData/ir/irText/firProblems/FirBuilder.kt.txt @@ -1,7 +1,7 @@ open class BaseConverter : BaseFirBuilder { constructor() /* primary */ { super/*BaseFirBuilder*/() - /* InstanceInitializerCall */ + /* () */ } @@ -10,7 +10,7 @@ open class BaseConverter : BaseFirBuilder { class DeclarationsConverter : BaseConverter { constructor() /* primary */ { super/*BaseConverter*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt b/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt index dd2f50ea9eb..d5a94fbaf72 100644 --- a/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt +++ b/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt.txt @@ -3,7 +3,7 @@ fun box(): String { local class { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -18,7 +18,7 @@ fun box(): String { local inner class Some : Base { constructor(s: String) /* primary */ { .super/*Base*/(s = s) - /* InstanceInitializerCall */ + /* () */ } @@ -31,7 +31,7 @@ fun box(): String { local open inner class Base { constructor(s: String) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/firProblems/MultiList.kt.txt b/compiler/testData/ir/irText/firProblems/MultiList.kt.txt index a15efac40c9..36fbbfbde82 100644 --- a/compiler/testData/ir/irText/firProblems/MultiList.kt.txt +++ b/compiler/testData/ir/irText/firProblems/MultiList.kt.txt @@ -1,7 +1,7 @@ data class Some { constructor(value: T) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -54,7 +54,7 @@ interface MyList : List> { open class SomeList : MyList, ArrayList> { constructor() /* primary */ { super/*ArrayList*/<@FlexibleNullability Some?>() - /* InstanceInitializerCall */ + /* () */ } @@ -63,7 +63,7 @@ open class SomeList : MyList, ArrayList> { class FinalList : SomeList { constructor() /* primary */ { super/*SomeList*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt b/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt index 77b50e068a2..f26f3f28144 100644 --- a/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt +++ b/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt @@ -2,7 +2,7 @@ typealias Some = Function1 object Factory { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -32,7 +32,7 @@ interface Derived : Delegate { data class DataClass : Derived, Delegate { constructor(delegate: Delegate) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/firProblems/VarInInit.kt.txt b/compiler/testData/ir/irText/firProblems/VarInInit.kt.txt index d1ac0d01a32..9b0d6d8165d 100644 --- a/compiler/testData/ir/irText/firProblems/VarInInit.kt.txt +++ b/compiler/testData/ir/irText/firProblems/VarInInit.kt.txt @@ -1,7 +1,7 @@ class Some { constructor(foo: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt b/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt index d67903a698c..363ca14617e 100644 --- a/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt +++ b/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt @@ -1,7 +1,7 @@ class Candidate { constructor(symbol: AbstractFirBasedSymbol<*>) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -14,7 +14,7 @@ class Candidate { abstract class AbstractFirBasedSymbol where E : FirSymbolOwner, E : FirDeclaration { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/firProblems/putIfAbsent.kt.txt b/compiler/testData/ir/irText/firProblems/putIfAbsent.kt.txt index 8806823616d..bc8a01bb0d3 100644 --- a/compiler/testData/ir/irText/firProblems/putIfAbsent.kt.txt +++ b/compiler/testData/ir/irText/firProblems/putIfAbsent.kt.txt @@ -1,7 +1,7 @@ class Owner { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/firProblems/v8arrayToList.kt.txt b/compiler/testData/ir/irText/firProblems/v8arrayToList.kt.txt index c6342544da1..f2c8cc9b007 100644 --- a/compiler/testData/ir/irText/firProblems/v8arrayToList.kt.txt +++ b/compiler/testData/ir/irText/firProblems/v8arrayToList.kt.txt @@ -1,7 +1,7 @@ class V8Array { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt b/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt index 4a51be9273c..1acd651229a 100644 --- a/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt +++ b/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt @@ -1,7 +1,7 @@ data class A { constructor(x: Int, y: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt index b79e7d54da4..994146b75c1 100644 --- a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt +++ b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt @@ -1,7 +1,7 @@ object A { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -10,7 +10,7 @@ object A { object B { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/regressions/integerCoercionToT.kt.txt b/compiler/testData/ir/irText/regressions/integerCoercionToT.kt.txt index 1b6f4313f15..e0f3ad2ecf3 100644 --- a/compiler/testData/ir/irText/regressions/integerCoercionToT.kt.txt +++ b/compiler/testData/ir/irText/regressions/integerCoercionToT.kt.txt @@ -9,7 +9,7 @@ inline fun CPointed.reinterpret(): T { class CInt32VarX : CPointed { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -26,7 +26,7 @@ var CInt32VarX.value: T_INT class IdType : CPointed { constructor(value: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.kt.txt b/compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.kt.txt index 5d5f67df51b..b8442141b85 100644 --- a/compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.kt.txt +++ b/compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.kt.txt @@ -1,7 +1,7 @@ class A { constructor(q: Q) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/singletons/companion.kt.txt b/compiler/testData/ir/irText/singletons/companion.kt.txt index 4b5b9297218..cfc50d1f2e1 100644 --- a/compiler/testData/ir/irText/singletons/companion.kt.txt +++ b/compiler/testData/ir/irText/singletons/companion.kt.txt @@ -1,7 +1,7 @@ class Z { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -12,7 +12,7 @@ class Z { companion object Companion { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/singletons/enumEntry.kt.txt b/compiler/testData/ir/irText/singletons/enumEntry.kt.txt index 8aa4260c3f1..b789a60e6b7 100644 --- a/compiler/testData/ir/irText/singletons/enumEntry.kt.txt +++ b/compiler/testData/ir/irText/singletons/enumEntry.kt.txt @@ -1,7 +1,7 @@ open enum class Z : Enum { private constructor() /* primary */ { super/*Enum*/() - /* InstanceInitializerCall */ + /* () */ } @@ -9,7 +9,7 @@ open enum class Z : Enum { private enum entry class ENTRY : Z { private constructor() /* primary */ { super/*Z*/() /*~> Unit */ - /* InstanceInitializerCall */ + /* () */ } @@ -19,7 +19,7 @@ open enum class Z : Enum { inner class A { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/singletons/object.kt.txt b/compiler/testData/ir/irText/singletons/object.kt.txt index dd40a2ad61b..00acb4be5c1 100644 --- a/compiler/testData/ir/irText/singletons/object.kt.txt +++ b/compiler/testData/ir/irText/singletons/object.kt.txt @@ -1,7 +1,7 @@ object Z { private constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -11,7 +11,7 @@ object Z { class A { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m1.kt.txt b/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m1.kt.txt index ef2fdb8760d..fefa1a2c832 100644 --- a/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m1.kt.txt +++ b/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m1.kt.txt @@ -1,7 +1,7 @@ abstract class Base { constructor(x: T) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m2.kt.txt b/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m2.kt.txt index 76e949db83f..1143ff25dd0 100644 --- a/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m2.kt.txt +++ b/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m2.kt.txt @@ -1,7 +1,7 @@ class Derived1 : Base { constructor(x: T) /* primary */ { super/*Base*/(x = x) - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/stubs/javaInnerClass.kt.txt b/compiler/testData/ir/irText/stubs/javaInnerClass.kt.txt index c0929319ab2..e81bef77787 100644 --- a/compiler/testData/ir/irText/stubs/javaInnerClass.kt.txt +++ b/compiler/testData/ir/irText/stubs/javaInnerClass.kt.txt @@ -1,7 +1,7 @@ class Test1 : J { constructor() /* primary */ { super/*J*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt index f77bdd8a423..bdbd716716f 100644 --- a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt +++ b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt @@ -70,7 +70,7 @@ private fun CoroutineScope.asChannel(flow: Flow<*>): ReceiveChannel { class SafeCollector : FlowCollector { constructor(collector: FlowCollector) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -99,7 +99,7 @@ suspend inline fun Flow.collect(crossinline action: SuspendFunctio open class ChannelCoroutine { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt index 40374b472e6..9d12539159c 100644 --- a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt +++ b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt @@ -1,7 +1,7 @@ class Value> { constructor(value1: T, value2: IT) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -34,7 +34,7 @@ interface IR { class CR : IR { constructor(r: R) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -51,7 +51,7 @@ class CR : IR { class P { constructor(p1: P1, p2: P2) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -70,7 +70,7 @@ val Value>.additionalText: P /* by */ local class : IDelegate1>, P> { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -87,7 +87,7 @@ val Value>.additionalText: P /* by */ local class : IDelegate1>, Any?> { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -116,7 +116,7 @@ val Value>.additionalText: P /* by */ local class : IDelegate1>, Any?> { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/types/genericFunWithStar.kt.txt b/compiler/testData/ir/irText/types/genericFunWithStar.kt.txt index 55c9fa2d75b..40711fc6140 100644 --- a/compiler/testData/ir/irText/types/genericFunWithStar.kt.txt +++ b/compiler/testData/ir/irText/types/genericFunWithStar.kt.txt @@ -17,7 +17,7 @@ interface I where G : IFoo, G : IBar { abstract class Box : IFoo, IBar where T : IFoo, T : IBar { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/types/genericPropertyReferenceType.kt.txt b/compiler/testData/ir/irText/types/genericPropertyReferenceType.kt.txt index d1dc3ceac01..6a041492c78 100644 --- a/compiler/testData/ir/irText/types/genericPropertyReferenceType.kt.txt +++ b/compiler/testData/ir/irText/types/genericPropertyReferenceType.kt.txt @@ -1,7 +1,7 @@ class C { constructor(x: T) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt b/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt index c057dd0ddf2..00b80c7c3ab 100644 --- a/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType1_NI.kt.txt @@ -1,7 +1,7 @@ class In { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt b/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt index 43d506d5c62..c37fb6f6ba6 100644 --- a/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType1_OI.kt.txt @@ -1,7 +1,7 @@ class In { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt b/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt index c5e707977d1..e44bd275323 100644 --- a/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt @@ -9,7 +9,7 @@ interface Foo { open class B : Foo, A { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -18,7 +18,7 @@ open class B : Foo, A { open class C : Foo, A { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt b/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt index c5e707977d1..e44bd275323 100644 --- a/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt @@ -9,7 +9,7 @@ interface Foo { open class B : Foo, A { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -18,7 +18,7 @@ open class B : Foo, A { open class C : Foo, A { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/types/javaWildcardType.kt.txt b/compiler/testData/ir/irText/types/javaWildcardType.kt.txt index cbc7cd71d0d..4425a5dfca8 100644 --- a/compiler/testData/ir/irText/types/javaWildcardType.kt.txt +++ b/compiler/testData/ir/irText/types/javaWildcardType.kt.txt @@ -9,7 +9,7 @@ interface K { class C : J, K { constructor(j: J, k: K) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt index f966819325d..fb8cf05894b 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt @@ -4,7 +4,7 @@ fun use(x: Any, y: Any) { class P { constructor(x: Int, y: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -29,7 +29,7 @@ class P { class Q { constructor(x: T1, y: T2) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt index ce4f471c77a..b3b2bb27bdf 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt @@ -77,7 +77,7 @@ interface K { data class P { constructor(x: Int, y: Int) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.kt.txt b/compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.kt.txt index 11d1be9d399..7b1904b8b20 100644 --- a/compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.kt.txt @@ -4,7 +4,7 @@ fun f(s: String) { class MySet : Set { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.kt.txt index 6cbaf6a8c40..b2d96694b51 100644 --- a/compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.kt.txt @@ -4,7 +4,7 @@ fun String.extension() { class C { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt b/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt index 43651f519ba..22ae84768b0 100644 --- a/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt +++ b/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt @@ -1,7 +1,7 @@ class GenericInv { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -10,7 +10,7 @@ class GenericInv { class GenericIn { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -19,7 +19,7 @@ class GenericIn { class GenericOut { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -40,7 +40,7 @@ fun testReturnsRawGenericOut(j: JRaw): @FlexibleNullability @RawType GenericOut< class KRaw : JRaw { constructor(j: JRaw) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/types/receiverOfIntersectionType.kt.txt b/compiler/testData/ir/irText/types/receiverOfIntersectionType.kt.txt index c076079c977..708f55b2d71 100644 --- a/compiler/testData/ir/irText/types/receiverOfIntersectionType.kt.txt +++ b/compiler/testData/ir/irText/types/receiverOfIntersectionType.kt.txt @@ -14,7 +14,7 @@ interface J : K { class A : I, J { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -26,7 +26,7 @@ class A : I, J { class B : I, J { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.kt.txt b/compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.kt.txt index ccb1069a61a..a0a86581088 100644 --- a/compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.kt.txt +++ b/compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.kt.txt @@ -1,7 +1,7 @@ open class A { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -32,7 +32,7 @@ open class A { class B : A { constructor() /* primary */ { super/*A*/() - /* InstanceInitializerCall */ + /* () */ } @@ -55,7 +55,7 @@ class B : A { open class GA { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -72,7 +72,7 @@ open class GA { class GB : GA { constructor() /* primary */ { super/*GA*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/types/smartCastOnReceiverOfGenericType.kt.txt b/compiler/testData/ir/irText/types/smartCastOnReceiverOfGenericType.kt.txt index 8ee3aaef8ba..52be2fb85c6 100644 --- a/compiler/testData/ir/irText/types/smartCastOnReceiverOfGenericType.kt.txt +++ b/compiler/testData/ir/irText/types/smartCastOnReceiverOfGenericType.kt.txt @@ -26,7 +26,7 @@ fun testNonSubstitutedTypeParameter(a: Any, b: Any) { class Cell { constructor(value: T) /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } @@ -40,14 +40,14 @@ class Cell { class Outer { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } inner class Inner { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } diff --git a/compiler/testData/ir/irText/types/starProjection_OI.kt.txt b/compiler/testData/ir/irText/types/starProjection_OI.kt.txt index 37cb8a60b0c..12b387c3b32 100644 --- a/compiler/testData/ir/irText/types/starProjection_OI.kt.txt +++ b/compiler/testData/ir/irText/types/starProjection_OI.kt.txt @@ -5,7 +5,7 @@ interface Continuation { abstract class C { constructor() /* primary */ { super/*Any*/() - /* InstanceInitializerCall */ + /* () */ } From 0bf587ad4b56186fd2d1affcb2a2be80c5485de8 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Fri, 6 Nov 2020 03:51:08 +0300 Subject: [PATCH 147/698] [IR] KotlinLikeDumper: deduplicate code between IrDelegatingConstructorCall and IrEnumConstructorCall --- .../kotlin/ir/util/KotlinLikeDumper.kt | 51 +++++++++---------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index 4df7782f507..6d193058366 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -826,7 +826,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption override fun visitCall(expression: IrCall, data: IrDeclaration?) { // TODO process specially builtin symbols - expression.printIrFunctionAccessExpressionWithNoIndent( + expression.printFunctionAccessExpressionWithNoIndent( expression.symbol.owner.name.asString(), superQualifierSymbol = expression.superQualifierSymbol, omitBracesIfNoArguments = false, @@ -837,7 +837,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption override fun visitConstructorCall(expression: IrConstructorCall, data: IrDeclaration?) { // TODO could constructors have receiver? val clazz = expression.symbol.owner.parentAsClass - expression.printIrFunctionAccessExpressionWithNoIndent( + expression.printFunctionAccessExpressionWithNoIndent( clazz.name.asString(), superQualifierSymbol = null, omitBracesIfNoArguments = clazz.isAnnotationClass, @@ -846,35 +846,34 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } override fun visitDelegatingConstructorCall(expression: IrDelegatingConstructorCall, data: IrDeclaration?) { - // TODO skip Any? - // TODO flag to omit comment block? - val delegatingClass = expression.symbol.owner.parentAsClass - val currentClass = data?.parentAsClass - val delegatingClassName = delegatingClass.name.asString() - val name = when (currentClass) { - null -> "delegating/*$delegatingClassName*/" - delegatingClass -> "this/*$delegatingClassName*/" - else -> "super/*$delegatingClassName*/" - } - expression.printIrFunctionAccessExpressionWithNoIndent( - name, - superQualifierSymbol = null, - omitBracesIfNoArguments = false, - data - ) + // TODO skip call to Any? + expression.printConstructorCallWithNoIndent(data) } override fun visitEnumConstructorCall(expression: IrEnumConstructorCall, data: IrDeclaration?) { - val delegatingClass = expression.symbol.owner.parentAsClass + // TODO skip call to Enum? + expression.printConstructorCallWithNoIndent(data) + } + + private fun IrFunctionAccessExpression.printConstructorCallWithNoIndent( + data: IrDeclaration? + ) { + // TODO flag to omit comment block? + val delegatingClass = symbol.owner.parentAsClass val currentClass = data?.parentAsClass val delegatingClassName = delegatingClass.name.asString() - val name = when { - data !is IrConstructor -> delegatingClassName - currentClass == null -> "delegating/*$delegatingClassName*/" - currentClass == delegatingClass -> "this/*$delegatingClassName*/" - else -> "super/*$delegatingClassName*/" + + val name = if (data is IrConstructor) { + when (currentClass) { + null -> "delegating/*$delegatingClassName*/" + delegatingClass -> "this/*$delegatingClassName*/" + else -> "super/*$delegatingClassName*/" + } + } else { + delegatingClassName // required only for IrEnumConstructorCall } - expression.printIrFunctionAccessExpressionWithNoIndent( + + printFunctionAccessExpressionWithNoIndent( name, superQualifierSymbol = null, omitBracesIfNoArguments = false, @@ -882,7 +881,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption ) } - private fun IrFunctionAccessExpression.printIrFunctionAccessExpressionWithNoIndent( + private fun IrFunctionAccessExpression.printFunctionAccessExpressionWithNoIndent( name: String, superQualifierSymbol: IrClassSymbol?, omitBracesIfNoArguments: Boolean, From 029ee6f2e79b15f83130cc91489a61147cfe2722 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 10 Nov 2020 03:11:00 +0300 Subject: [PATCH 148/698] [IR] KotlinLikeDumper: super and receiver on field accesses --- .../kotlin/ir/util/KotlinLikeDumper.kt | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index 6d193058366..211c1463702 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -978,18 +978,31 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } override fun visitGetField(expression: IrGetField, data: IrDeclaration?) { - expression.printFieldAccess() + expression.printFieldAccess(data) } override fun visitSetField(expression: IrSetField, data: IrDeclaration?) { - expression.printFieldAccess() + expression.printFieldAccess(data) p.printWithNoIndent(" = ") expression.value.accept(this, data) } - private fun IrFieldAccessExpression.printFieldAccess() { - // TODO receiver, superQualifierSymbol? + private fun IrFieldAccessExpression.printFieldAccess(data: IrDeclaration?) { + // TODO type // TODO is not valid kotlin + receiver?.accept(this@KotlinLikeDumper, data) + superQualifierSymbol?.let { + // TODO should we print super classifier somehow? + // TODO which supper? smart mode? + // TODO super and receiver at the same time: + // compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.kt + p.printWithNoIndent("super") + } + + if (receiver != null || superQualifierSymbol != null) { + p.printWithNoIndent(".") + } + p.printWithNoIndent("#" + symbol.owner.name.asString()) } From a6b408978f5b8cdc3aa5b7a7448363777321f9f8 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 10 Nov 2020 03:10:13 +0300 Subject: [PATCH 149/698] [IR] update testdata: super and receiver for field accesses --- .../classes/dataClassWithArrayMembers.kt.txt | 96 +++++++++---------- .../ir/irText/classes/dataClasses.kt.txt | 76 +++++++-------- .../irText/classes/dataClassesGeneric.kt.txt | 42 ++++---- .../delegatedGenericImplementation.kt.txt | 16 ++-- .../classes/delegatedImplementation.kt.txt | 24 ++--- ...egatedImplementationOfJavaInterface.kt.txt | 12 +-- ...dImplementationWithExplicitOverride.kt.txt | 2 +- .../testData/ir/irText/classes/enum.kt.txt | 2 +- .../classes/enumWithMultipleCtors.kt.txt | 4 +- ...citNotNullOnDelegatedImplementation.kt.txt | 10 +- .../testData/ir/irText/classes/initVal.kt.txt | 2 +- .../ir/irText/classes/initValInLambda.kt.txt | 2 +- .../testData/ir/irText/classes/initVar.kt.txt | 6 +- .../ir/irText/classes/inlineClass.kt.txt | 6 +- .../inlineClassSyntheticMethods.kt.txt | 6 +- .../testData/ir/irText/classes/kt31649.kt.txt | 20 ++-- .../lambdaInDataClassDefaultParameter.kt.txt | 20 ++-- .../classes/objectWithInitializers.kt.txt | 2 +- .../irText/classes/primaryConstructor.kt.txt | 2 +- ...ructorWithInitializersFromClassBody.kt.txt | 2 +- .../annotationsOnDelegatedMembers.kt.txt | 8 +- .../declarations/classLevelProperties.kt.txt | 8 +- .../declarations/delegatedProperties.kt.txt | 6 +- .../inlineCollectionOfInlineClass.kt.txt | 12 +-- .../ir/irText/declarations/kt29833.kt.txt | 2 +- .../ir/irText/declarations/kt35550.kt.txt | 2 +- .../parameters/dataClassMembers.kt.txt | 20 ++-- .../parameters/delegatedMembers.kt.txt | 6 +- .../provideDelegate/member.kt.txt | 2 +- .../provideDelegate/memberExtension.kt.txt | 2 +- .../irText/expressions/coercionToUnit.kt.txt | 4 +- .../ir/irText/expressions/equals.kt.txt | 4 +- .../jvmFieldWithIntersectionTypes.kt.txt | 8 +- .../jvmInstanceFieldReference.kt.txt | 6 +- .../jvmStaticFieldReference.kt.txt | 10 +- .../ir/irText/expressions/kt16904.kt.txt | 2 +- .../ir/irText/expressions/kt37570.kt.txt | 2 +- .../setFieldWithImplicitCast.kt.txt | 2 +- .../expressions/temporaryInInitBlock.kt.txt | 2 +- .../DelegationAndInheritanceFromJava.kt.txt | 22 ++--- .../ir/irText/firProblems/MultiList.kt.txt | 12 +-- .../irText/firProblems/SignatureClash.kt.txt | 12 +-- .../lambdas/destructuringInLambda.kt.txt | 18 ++-- .../types/genericDelegatedDeepProperty.kt.txt | 4 +- .../ir/irText/types/javaWildcardType.kt.txt | 16 ++-- .../enhancedNullabilityInForLoop.kt.txt | 18 ++-- .../implicitNotNullOnPlatformType.kt.txt | 4 +- .../nullChecks/platformTypeReceiver.kt.txt | 2 +- .../ir/irText/types/rawTypeInSignature.kt.txt | 16 ++-- ...artCastOnFieldReceiverOfGenericType.kt.txt | 4 +- 50 files changed, 294 insertions(+), 294 deletions(-) diff --git a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt index 83741801142..48ed0c62440 100644 --- a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt +++ b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt @@ -42,86 +42,86 @@ data class Test1 { get operator fun component1(): Array { - return #stringArray + return .#stringArray } operator fun component2(): CharArray { - return #charArray + return .#charArray } operator fun component3(): BooleanArray { - return #booleanArray + return .#booleanArray } operator fun component4(): ByteArray { - return #byteArray + return .#byteArray } operator fun component5(): ShortArray { - return #shortArray + return .#shortArray } operator fun component6(): IntArray { - return #intArray + return .#intArray } operator fun component7(): LongArray { - return #longArray + return .#longArray } operator fun component8(): FloatArray { - return #floatArray + return .#floatArray } operator fun component9(): DoubleArray { - return #doubleArray + return .#doubleArray } - fun copy(stringArray: Array = #stringArray, charArray: CharArray = #charArray, booleanArray: BooleanArray = #booleanArray, byteArray: ByteArray = #byteArray, shortArray: ShortArray = #shortArray, intArray: IntArray = #intArray, longArray: LongArray = #longArray, floatArray: FloatArray = #floatArray, doubleArray: DoubleArray = #doubleArray): Test1 { + fun copy(stringArray: Array = .#stringArray, charArray: CharArray = .#charArray, booleanArray: BooleanArray = .#booleanArray, byteArray: ByteArray = .#byteArray, shortArray: ShortArray = .#shortArray, intArray: IntArray = .#intArray, longArray: LongArray = .#longArray, floatArray: FloatArray = .#floatArray, doubleArray: DoubleArray = .#doubleArray): Test1 { return Test1(stringArray = stringArray, charArray = charArray, booleanArray = booleanArray, byteArray = byteArray, shortArray = shortArray, intArray = intArray, longArray = longArray, floatArray = floatArray, doubleArray = doubleArray) } override fun toString(): String { return "Test1(" + "stringArray=" + -dataClassArrayMemberToString(arg0 = #stringArray) + +dataClassArrayMemberToString(arg0 = .#stringArray) + ", " + "charArray=" + -dataClassArrayMemberToString(arg0 = #charArray) + +dataClassArrayMemberToString(arg0 = .#charArray) + ", " + "booleanArray=" + -dataClassArrayMemberToString(arg0 = #booleanArray) + +dataClassArrayMemberToString(arg0 = .#booleanArray) + ", " + "byteArray=" + -dataClassArrayMemberToString(arg0 = #byteArray) + +dataClassArrayMemberToString(arg0 = .#byteArray) + ", " + "shortArray=" + -dataClassArrayMemberToString(arg0 = #shortArray) + +dataClassArrayMemberToString(arg0 = .#shortArray) + ", " + "intArray=" + -dataClassArrayMemberToString(arg0 = #intArray) + +dataClassArrayMemberToString(arg0 = .#intArray) + ", " + "longArray=" + -dataClassArrayMemberToString(arg0 = #longArray) + +dataClassArrayMemberToString(arg0 = .#longArray) + ", " + "floatArray=" + -dataClassArrayMemberToString(arg0 = #floatArray) + +dataClassArrayMemberToString(arg0 = .#floatArray) + ", " + "doubleArray=" + -dataClassArrayMemberToString(arg0 = #doubleArray) + +dataClassArrayMemberToString(arg0 = .#doubleArray) + ")" } override fun hashCode(): Int { - var result: Int = dataClassArrayMemberHashCode(arg0 = #stringArray) - result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #charArray)) - result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #booleanArray)) - result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #byteArray)) - result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #shortArray)) - result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #intArray)) - result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #longArray)) - result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #floatArray)) - result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = #doubleArray)) + var result: Int = dataClassArrayMemberHashCode(arg0 = .#stringArray) + result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = .#charArray)) + result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = .#booleanArray)) + result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = .#byteArray)) + result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = .#shortArray)) + result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = .#intArray)) + result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = .#longArray)) + result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = .#floatArray)) + result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = .#doubleArray)) return result } @@ -134,31 +134,31 @@ dataClassArrayMemberToString(arg0 = #doubleArray) + } val tmp0_other_with_cast: Test1 = other as Test1 when { - EQEQ(arg0 = #stringArray, arg1 = #stringArray).not() -> return false + EQEQ(arg0 = .#stringArray, arg1 = tmp0_other_with_cast.#stringArray).not() -> return false } when { - EQEQ(arg0 = #charArray, arg1 = #charArray).not() -> return false + EQEQ(arg0 = .#charArray, arg1 = tmp0_other_with_cast.#charArray).not() -> return false } when { - EQEQ(arg0 = #booleanArray, arg1 = #booleanArray).not() -> return false + EQEQ(arg0 = .#booleanArray, arg1 = tmp0_other_with_cast.#booleanArray).not() -> return false } when { - EQEQ(arg0 = #byteArray, arg1 = #byteArray).not() -> return false + EQEQ(arg0 = .#byteArray, arg1 = tmp0_other_with_cast.#byteArray).not() -> return false } when { - EQEQ(arg0 = #shortArray, arg1 = #shortArray).not() -> return false + EQEQ(arg0 = .#shortArray, arg1 = tmp0_other_with_cast.#shortArray).not() -> return false } when { - EQEQ(arg0 = #intArray, arg1 = #intArray).not() -> return false + EQEQ(arg0 = .#intArray, arg1 = tmp0_other_with_cast.#intArray).not() -> return false } when { - EQEQ(arg0 = #longArray, arg1 = #longArray).not() -> return false + EQEQ(arg0 = .#longArray, arg1 = tmp0_other_with_cast.#longArray).not() -> return false } when { - EQEQ(arg0 = #floatArray, arg1 = #floatArray).not() -> return false + EQEQ(arg0 = .#floatArray, arg1 = tmp0_other_with_cast.#floatArray).not() -> return false } when { - EQEQ(arg0 = #doubleArray, arg1 = #doubleArray).not() -> return false + EQEQ(arg0 = .#doubleArray, arg1 = tmp0_other_with_cast.#doubleArray).not() -> return false } return true } @@ -177,22 +177,22 @@ data class Test2 { get operator fun component1(): Array { - return #genericArray + return .#genericArray } - fun copy(genericArray: Array = #genericArray): Test2 { + fun copy(genericArray: Array = .#genericArray): Test2 { return Test2(genericArray = genericArray) } override fun toString(): String { return "Test2(" + "genericArray=" + -dataClassArrayMemberToString(arg0 = #genericArray) + +dataClassArrayMemberToString(arg0 = .#genericArray) + ")" } override fun hashCode(): Int { - return dataClassArrayMemberHashCode(arg0 = #genericArray) + return dataClassArrayMemberHashCode(arg0 = .#genericArray) } override operator fun equals(other: Any?): Boolean { @@ -204,7 +204,7 @@ dataClassArrayMemberToString(arg0 = #genericArray) + } val tmp0_other_with_cast: Test2 = other as Test2 when { - EQEQ(arg0 = #genericArray, arg1 = #genericArray).not() -> return false + EQEQ(arg0 = .#genericArray, arg1 = tmp0_other_with_cast.#genericArray).not() -> return false } return true } @@ -223,24 +223,24 @@ data class Test3 { get operator fun component1(): Array? { - return #anyArrayN + return .#anyArrayN } - fun copy(anyArrayN: Array? = #anyArrayN): Test3 { + fun copy(anyArrayN: Array? = .#anyArrayN): Test3 { return Test3(anyArrayN = anyArrayN) } override fun toString(): String { return "Test3(" + "anyArrayN=" + -dataClassArrayMemberToString(arg0 = #anyArrayN) + +dataClassArrayMemberToString(arg0 = .#anyArrayN) + ")" } override fun hashCode(): Int { return when { - EQEQ(arg0 = #anyArrayN, arg1 = null) -> 0 - true -> dataClassArrayMemberHashCode(arg0 = #anyArrayN) + EQEQ(arg0 = .#anyArrayN, arg1 = null) -> 0 + true -> dataClassArrayMemberHashCode(arg0 = .#anyArrayN) } } @@ -253,7 +253,7 @@ dataClassArrayMemberToString(arg0 = #anyArrayN) + } val tmp0_other_with_cast: Test3 = other as Test3 when { - EQEQ(arg0 = #anyArrayN, arg1 = #anyArrayN).not() -> return false + EQEQ(arg0 = .#anyArrayN, arg1 = tmp0_other_with_cast.#anyArrayN).not() -> return false } return true } diff --git a/compiler/testData/ir/irText/classes/dataClasses.kt.txt b/compiler/testData/ir/irText/classes/dataClasses.kt.txt index 98d1074bfa3..4a714577279 100644 --- a/compiler/testData/ir/irText/classes/dataClasses.kt.txt +++ b/compiler/testData/ir/irText/classes/dataClasses.kt.txt @@ -18,38 +18,38 @@ data class Test1 { get operator fun component1(): Int { - return #x + return .#x } operator fun component2(): String { - return #y + return .#y } operator fun component3(): Any { - return #z + return .#z } - fun copy(x: Int = #x, y: String = #y, z: Any = #z): Test1 { + fun copy(x: Int = .#x, y: String = .#y, z: Any = .#z): Test1 { return Test1(x = x, y = y, z = z) } override fun toString(): String { return "Test1(" + "x=" + -#x + +.#x + ", " + "y=" + -#y + +.#y + ", " + "z=" + -#z + +.#z + ")" } override fun hashCode(): Int { - var result: Int = #x.hashCode() - result = result.times(other = 31).plus(other = #y.hashCode()) - result = result.times(other = 31).plus(other = #z.hashCode()) + var result: Int = .#x.hashCode() + result = result.times(other = 31).plus(other = .#y.hashCode()) + result = result.times(other = 31).plus(other = .#z.hashCode()) return result } @@ -62,13 +62,13 @@ data class Test1 { } val tmp0_other_with_cast: Test1 = other as Test1 when { - EQEQ(arg0 = #x, arg1 = #x).not() -> return false + EQEQ(arg0 = .#x, arg1 = tmp0_other_with_cast.#x).not() -> return false } when { - EQEQ(arg0 = #y, arg1 = #y).not() -> return false + EQEQ(arg0 = .#y, arg1 = tmp0_other_with_cast.#y).not() -> return false } when { - EQEQ(arg0 = #z, arg1 = #z).not() -> return false + EQEQ(arg0 = .#z, arg1 = tmp0_other_with_cast.#z).not() -> return false } return true } @@ -87,24 +87,24 @@ data class Test2 { get operator fun component1(): Any? { - return #x + return .#x } - fun copy(x: Any? = #x): Test2 { + fun copy(x: Any? = .#x): Test2 { return Test2(x = x) } override fun toString(): String { return "Test2(" + "x=" + -#x + +.#x + ")" } override fun hashCode(): Int { return when { - EQEQ(arg0 = #x, arg1 = null) -> 0 - true -> #x.hashCode() + EQEQ(arg0 = .#x, arg1 = null) -> 0 + true -> .#x.hashCode() } } @@ -117,7 +117,7 @@ data class Test2 { } val tmp0_other_with_cast: Test2 = other as Test2 when { - EQEQ(arg0 = #x, arg1 = #x).not() -> return false + EQEQ(arg0 = .#x, arg1 = tmp0_other_with_cast.#x).not() -> return false } return true } @@ -148,51 +148,51 @@ data class Test3 { get operator fun component1(): Double { - return #d + return .#d } operator fun component2(): Double? { - return #dn + return .#dn } operator fun component3(): Float { - return #f + return .#f } operator fun component4(): Float? { - return #df + return .#df } - fun copy(d: Double = #d, dn: Double? = #dn, f: Float = #f, df: Float? = #df): Test3 { + fun copy(d: Double = .#d, dn: Double? = .#dn, f: Float = .#f, df: Float? = .#df): Test3 { return Test3(d = d, dn = dn, f = f, df = df) } override fun toString(): String { return "Test3(" + "d=" + -#d + +.#d + ", " + "dn=" + -#dn + +.#dn + ", " + "f=" + -#f + +.#f + ", " + "df=" + -#df + +.#df + ")" } override fun hashCode(): Int { - var result: Int = #d.hashCode() + var result: Int = .#d.hashCode() result = result.times(other = 31).plus(other = when { - EQEQ(arg0 = #dn, arg1 = null) -> 0 - true -> #dn.hashCode() + EQEQ(arg0 = .#dn, arg1 = null) -> 0 + true -> .#dn.hashCode() }) - result = result.times(other = 31).plus(other = #f.hashCode()) + result = result.times(other = 31).plus(other = .#f.hashCode()) result = result.times(other = 31).plus(other = when { - EQEQ(arg0 = #df, arg1 = null) -> 0 - true -> #df.hashCode() + EQEQ(arg0 = .#df, arg1 = null) -> 0 + true -> .#df.hashCode() }) return result } @@ -206,16 +206,16 @@ data class Test3 { } val tmp0_other_with_cast: Test3 = other as Test3 when { - EQEQ(arg0 = #d, arg1 = #d).not() -> return false + EQEQ(arg0 = .#d, arg1 = tmp0_other_with_cast.#d).not() -> return false } when { - EQEQ(arg0 = #dn, arg1 = #dn).not() -> return false + EQEQ(arg0 = .#dn, arg1 = tmp0_other_with_cast.#dn).not() -> return false } when { - EQEQ(arg0 = #f, arg1 = #f).not() -> return false + EQEQ(arg0 = .#f, arg1 = tmp0_other_with_cast.#f).not() -> return false } when { - EQEQ(arg0 = #df, arg1 = #df).not() -> return false + EQEQ(arg0 = .#df, arg1 = tmp0_other_with_cast.#df).not() -> return false } return true } diff --git a/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt b/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt index c8c07bfc416..10bc1d47fcf 100644 --- a/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt +++ b/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt @@ -10,24 +10,24 @@ data class Test1 { get operator fun component1(): T { - return #x + return .#x } - fun copy(x: T = #x): Test1 { + fun copy(x: T = .#x): Test1 { return Test1(x = x) } override fun toString(): String { return "Test1(" + "x=" + -#x + +.#x + ")" } override fun hashCode(): Int { return when { - EQEQ(arg0 = #x, arg1 = null) -> 0 - true -> #x.hashCode() + EQEQ(arg0 = .#x, arg1 = null) -> 0 + true -> .#x.hashCode() } } @@ -40,7 +40,7 @@ data class Test1 { } val tmp0_other_with_cast: Test1 = other as Test1 when { - EQEQ(arg0 = #x, arg1 = #x).not() -> return false + EQEQ(arg0 = .#x, arg1 = tmp0_other_with_cast.#x).not() -> return false } return true } @@ -59,22 +59,22 @@ data class Test2 { get operator fun component1(): T { - return #x + return .#x } - fun copy(x: T = #x): Test2 { + fun copy(x: T = .#x): Test2 { return Test2(x = x) } override fun toString(): String { return "Test2(" + "x=" + -#x + +.#x + ")" } override fun hashCode(): Int { - return #x.hashCode() + return .#x.hashCode() } override operator fun equals(other: Any?): Boolean { @@ -86,7 +86,7 @@ data class Test2 { } val tmp0_other_with_cast: Test2 = other as Test2 when { - EQEQ(arg0 = #x, arg1 = #x).not() -> return false + EQEQ(arg0 = .#x, arg1 = tmp0_other_with_cast.#x).not() -> return false } return true } @@ -105,22 +105,22 @@ data class Test3 { get operator fun component1(): List { - return #x + return .#x } - fun copy(x: List = #x): Test3 { + fun copy(x: List = .#x): Test3 { return Test3(x = x) } override fun toString(): String { return "Test3(" + "x=" + -#x + +.#x + ")" } override fun hashCode(): Int { - return #x.hashCode() + return .#x.hashCode() } override operator fun equals(other: Any?): Boolean { @@ -132,7 +132,7 @@ data class Test3 { } val tmp0_other_with_cast: Test3 = other as Test3 when { - EQEQ(arg0 = #x, arg1 = #x).not() -> return false + EQEQ(arg0 = .#x, arg1 = tmp0_other_with_cast.#x).not() -> return false } return true } @@ -151,22 +151,22 @@ data class Test4 { get operator fun component1(): List { - return #x + return .#x } - fun copy(x: List = #x): Test4 { + fun copy(x: List = .#x): Test4 { return Test4(x = x) } override fun toString(): String { return "Test4(" + "x=" + -#x + +.#x + ")" } override fun hashCode(): Int { - return #x.hashCode() + return .#x.hashCode() } override operator fun equals(other: Any?): Boolean { @@ -178,7 +178,7 @@ data class Test4 { } val tmp0_other_with_cast: Test4 = other as Test4 when { - EQEQ(arg0 = #x, arg1 = #x).not() -> return false + EQEQ(arg0 = .#x, arg1 = tmp0_other_with_cast.#x).not() -> return false } return true } diff --git a/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt b/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt index 1a80e772181..ff81bef42ff 100644 --- a/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt @@ -18,20 +18,20 @@ class Test1 : IBase { private /*final field*/ val $$delegate_0: IBase = i override fun foo(a: E, b: B) { - #$$delegate_0.foo(a = a, b = b) + .#$$delegate_0.foo(a = a, b = b) } override val C.id: Map? override get(): Map? { - return (#$$delegate_0, ).() + return (.#$$delegate_0, ).() } override var List.x: D? override get(): D? { - return (#$$delegate_0, ).() + return (.#$$delegate_0, ).() } override set(: D?) { - (#$$delegate_0, ).( = ) + (.#$$delegate_0, ).( = ) } } @@ -50,20 +50,20 @@ class Test2 : IBase { private /*final field*/ val $$delegate_0: IBase = j override fun foo(a: String, b: B) { - #$$delegate_0.foo(a = a, b = b) + .#$$delegate_0.foo(a = a, b = b) } override val C.id: Map? override get(): Map? { - return (#$$delegate_0, ).() + return (.#$$delegate_0, ).() } override var List.x: D? override get(): D? { - return (#$$delegate_0, ).() + return (.#$$delegate_0, ).() } override set(: D?) { - (#$$delegate_0, ).( = ) + (.#$$delegate_0, ).( = ) } } diff --git a/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt index 94b2b17f666..04bc27d486e 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt @@ -86,15 +86,15 @@ class Test1 : IBase { private /*final field*/ val $$delegate_0: BaseImpl = BaseImpl override fun bar(): Int { - return #$$delegate_0.bar() + return .#$$delegate_0.bar() } override fun foo(x: Int, s: String) { - #$$delegate_0.foo(x = x, s = s) + .#$$delegate_0.foo(x = x, s = s) } override fun String.qux() { - (#$$delegate_0, ).qux() + (.#$$delegate_0, ).qux() } } @@ -108,42 +108,42 @@ class Test2 : IBase, IOther { private /*final field*/ val $$delegate_0: BaseImpl = BaseImpl override fun bar(): Int { - return #$$delegate_0.bar() + return .#$$delegate_0.bar() } override fun foo(x: Int, s: String) { - #$$delegate_0.foo(x = x, s = s) + .#$$delegate_0.foo(x = x, s = s) } override fun String.qux() { - (#$$delegate_0, ).qux() + (.#$$delegate_0, ).qux() } private /*final field*/ val $$delegate_1: IOther = otherImpl(x0 = "", y0 = 42) override val Byte.z1: Int override get(): Int { - return (#$$delegate_1, ).() + return (.#$$delegate_1, ).() } override val x: String override get(): String { - return #$$delegate_1.() + return .#$$delegate_1.() } override var Byte.z2: Int override get(): Int { - return (#$$delegate_1, ).() + return (.#$$delegate_1, ).() } override set(: Int) { - (#$$delegate_1, ).( = ) + (.#$$delegate_1, ).( = ) } override var y: Int override get(): Int { - return #$$delegate_1.() + return .#$$delegate_1.() } override set(: Int) { - #$$delegate_1.( = ) + .#$$delegate_1.( = ) } } diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt index d4e4ee378be..8a6c8b57f54 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt @@ -11,28 +11,28 @@ class Test : J { @NotNull() override fun returnNotNull(): @EnhancedNullability String { - return #j.returnNotNull() + return .#j.returnNotNull() } @Nullable() override fun returnNullable(): @EnhancedNullability String? { - return #j.returnNullable() + return .#j.returnNullable() } override fun returnsFlexible(): @FlexibleNullability String? { - return #j.returnsFlexible() + return .#j.returnsFlexible() } override fun takeFlexible(x: @FlexibleNullability String?) { - #j.takeFlexible(x = x) + .#j.takeFlexible(x = x) } override fun takeNotNull(x: @EnhancedNullability String) { - #j.takeNotNull(x = x) + .#j.takeNotNull(x = x) } override fun takeNullable(x: @EnhancedNullability String?) { - #j.takeNullable(x = x) + .#j.takeNullable(x = x) } } diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt index 9ce32da6eaf..5cab352d2a5 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt @@ -28,7 +28,7 @@ class C : IFooBar { private /*final field*/ val $$delegate_0: FooBarImpl = FooBarImpl override fun foo() { - #$$delegate_0.foo() + .#$$delegate_0.foo() } override fun bar() { diff --git a/compiler/testData/ir/irText/classes/enum.kt.txt b/compiler/testData/ir/irText/classes/enum.kt.txt index 1b1f789592b..c2ab0c121b2 100644 --- a/compiler/testData/ir/irText/classes/enum.kt.txt +++ b/compiler/testData/ir/irText/classes/enum.kt.txt @@ -104,7 +104,7 @@ abstract enum class TestEnum4 : Enum { get init { - #z = .() + .#z = .() } override fun foo() { diff --git a/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt b/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt index 1eb263c4044..2e75794e4fd 100644 --- a/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt +++ b/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt @@ -33,14 +33,14 @@ open enum class A : Enum { super/*Enum*/() /* () */ - #prop1 = arg + .#prop1 = arg } private constructor() { super/*Enum*/() /* () */ - #prop1 = "default" + .#prop1 = "default" .( = "empty") } diff --git a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt index d09ee5936bb..380453eb62e 100644 --- a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt +++ b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt @@ -56,7 +56,7 @@ class TestJFoo : IFoo { private /*final field*/ val $$delegate_0: JFoo = JFoo() override fun foo(): String { - return #$$delegate_0.foo() /*!! String */ + return .#$$delegate_0.foo() /*!! String */ } } @@ -70,7 +70,7 @@ class TestK1 : IFoo { private /*final field*/ val $$delegate_0: K1 = K1() override fun foo(): String { - return #$$delegate_0.foo() /*!! String */ + return .#$$delegate_0.foo() /*!! String */ } } @@ -84,7 +84,7 @@ class TestK2 : IFoo { private /*final field*/ val $$delegate_0: K2 = K2() override fun foo(): String { - return #$$delegate_0.foo() + return .#$$delegate_0.foo() } } @@ -98,7 +98,7 @@ class TestK3 : IFoo { private /*final field*/ val $$delegate_0: K3 = K3() override fun foo(): String { - return #$$delegate_0.foo() + return .#$$delegate_0.foo() } } @@ -112,7 +112,7 @@ class TestK4 : IFoo { private /*final field*/ val $$delegate_0: K4 = K4() override fun foo(): String { - return #$$delegate_0.foo() /*!! String */ + return .#$$delegate_0.foo() /*!! String */ } } diff --git a/compiler/testData/ir/irText/classes/initVal.kt.txt b/compiler/testData/ir/irText/classes/initVal.kt.txt index 8dc59032582..b421bbf410b 100644 --- a/compiler/testData/ir/irText/classes/initVal.kt.txt +++ b/compiler/testData/ir/irText/classes/initVal.kt.txt @@ -35,7 +35,7 @@ class TestInitValInInitBlock { get init { - #x = 0 + .#x = 0 } } diff --git a/compiler/testData/ir/irText/classes/initValInLambda.kt.txt b/compiler/testData/ir/irText/classes/initValInLambda.kt.txt index debd05f42f1..3d4f99039ad 100644 --- a/compiler/testData/ir/irText/classes/initValInLambda.kt.txt +++ b/compiler/testData/ir/irText/classes/initValInLambda.kt.txt @@ -10,7 +10,7 @@ class TestInitValInLambdaCalledOnce { init { 1.run(block = local fun Int.() { - #x = 0 + .#x = 0 } ) } diff --git a/compiler/testData/ir/irText/classes/initVar.kt.txt b/compiler/testData/ir/irText/classes/initVar.kt.txt index a997b01012d..0dfe1c66952 100644 --- a/compiler/testData/ir/irText/classes/initVar.kt.txt +++ b/compiler/testData/ir/irText/classes/initVar.kt.txt @@ -54,7 +54,7 @@ class TestInitVarWithCustomSetter { field = 0 get set(value: Int) { - #x = value + .#x = value } } @@ -63,7 +63,7 @@ class TestInitVarWithCustomSetterWithExplicitCtor { var x: Int get set(value: Int) { - #x = value + .#x = value } init { @@ -82,7 +82,7 @@ class TestInitVarWithCustomSetterInCtor { var x: Int get set(value: Int) { - #x = value + .#x = value } constructor() { diff --git a/compiler/testData/ir/irText/classes/inlineClass.kt.txt b/compiler/testData/ir/irText/classes/inlineClass.kt.txt index 2f0e8418990..fcaeb190100 100644 --- a/compiler/testData/ir/irText/classes/inlineClass.kt.txt +++ b/compiler/testData/ir/irText/classes/inlineClass.kt.txt @@ -12,12 +12,12 @@ inline class Test { override fun toString(): String { return "Test(" + "x=" + -#x + +.#x + ")" } override fun hashCode(): Int { - return #x.hashCode() + return .#x.hashCode() } override operator fun equals(other: Any?): Boolean { @@ -26,7 +26,7 @@ inline class Test { } val tmp0_other_with_cast: Test = other as Test when { - EQEQ(arg0 = #x, arg1 = #x).not() -> return false + EQEQ(arg0 = .#x, arg1 = tmp0_other_with_cast.#x).not() -> return false } return true } diff --git a/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt b/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt index 7b1babdc1c2..cc443e40114 100644 --- a/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt +++ b/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt @@ -33,12 +33,12 @@ inline class IC { override fun toString(): String { return "IC(" + "c=" + -#c + +.#c + ")" } override fun hashCode(): Int { - return #c.hashCode() + return .#c.hashCode() } override operator fun equals(other: Any?): Boolean { @@ -47,7 +47,7 @@ inline class IC { } val tmp0_other_with_cast: IC = other as IC when { - EQEQ(arg0 = #c, arg1 = #c).not() -> return false + EQEQ(arg0 = .#c, arg1 = tmp0_other_with_cast.#c).not() -> return false } return true } diff --git a/compiler/testData/ir/irText/classes/kt31649.kt.txt b/compiler/testData/ir/irText/classes/kt31649.kt.txt index 29275573344..09853e02070 100644 --- a/compiler/testData/ir/irText/classes/kt31649.kt.txt +++ b/compiler/testData/ir/irText/classes/kt31649.kt.txt @@ -10,24 +10,24 @@ data class TestData { get operator fun component1(): Nothing? { - return #nn + return .#nn } - fun copy(nn: Nothing? = #nn): TestData { + fun copy(nn: Nothing? = .#nn): TestData { return TestData(nn = nn) } override fun toString(): String { return "TestData(" + "nn=" + -#nn + +.#nn + ")" } override fun hashCode(): Int { return when { - EQEQ(arg0 = #nn, arg1 = null) -> 0 - true -> #nn.hashCode() + EQEQ(arg0 = .#nn, arg1 = null) -> 0 + true -> .#nn.hashCode() } } @@ -40,7 +40,7 @@ data class TestData { } val tmp0_other_with_cast: TestData = other as TestData when { - EQEQ(arg0 = #nn, arg1 = #nn).not() -> return false + EQEQ(arg0 = .#nn, arg1 = tmp0_other_with_cast.#nn).not() -> return false } return true } @@ -61,14 +61,14 @@ inline class TestInline { override fun toString(): String { return "TestInline(" + "nn=" + -#nn + +.#nn + ")" } override fun hashCode(): Int { return when { - EQEQ(arg0 = #nn, arg1 = null) -> 0 - true -> #nn.hashCode() + EQEQ(arg0 = .#nn, arg1 = null) -> 0 + true -> .#nn.hashCode() } } @@ -78,7 +78,7 @@ inline class TestInline { } val tmp0_other_with_cast: TestInline = other as TestInline when { - EQEQ(arg0 = #nn, arg1 = #nn).not() -> return false + EQEQ(arg0 = .#nn, arg1 = tmp0_other_with_cast.#nn).not() -> return false } return true } diff --git a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt index a26997bb63a..e890a37861a 100644 --- a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt +++ b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt @@ -13,22 +13,22 @@ data class A { get operator fun component1(): @ExtensionFunctionType Function2 { - return #runA + return .#runA } - fun copy(runA: @ExtensionFunctionType Function2 = #runA): A { + fun copy(runA: @ExtensionFunctionType Function2 = .#runA): A { return A(runA = runA) } override fun toString(): String { return "A(" + "runA=" + -#runA + +.#runA + ")" } override fun hashCode(): Int { - return #runA.hashCode() + return .#runA.hashCode() } override operator fun equals(other: Any?): Boolean { @@ -40,7 +40,7 @@ data class A { } val tmp0_other_with_cast: A = other as A when { - EQEQ(arg0 = #runA, arg1 = #runA).not() -> return false + EQEQ(arg0 = .#runA, arg1 = tmp0_other_with_cast.#runA).not() -> return false } return true } @@ -70,22 +70,22 @@ data class B { get operator fun component1(): Any { - return #x + return .#x } - fun copy(x: Any = #x): B { + fun copy(x: Any = .#x): B { return B(x = x) } override fun toString(): String { return "B(" + "x=" + -#x + +.#x + ")" } override fun hashCode(): Int { - return #x.hashCode() + return .#x.hashCode() } override operator fun equals(other: Any?): Boolean { @@ -97,7 +97,7 @@ data class B { } val tmp0_other_with_cast: B = other as B when { - EQEQ(arg0 = #x, arg1 = #x).not() -> return false + EQEQ(arg0 = .#x, arg1 = tmp0_other_with_cast.#x).not() -> return false } return true } diff --git a/compiler/testData/ir/irText/classes/objectWithInitializers.kt.txt b/compiler/testData/ir/irText/classes/objectWithInitializers.kt.txt index 2d07b4d6dd5..b70e9b78e52 100644 --- a/compiler/testData/ir/irText/classes/objectWithInitializers.kt.txt +++ b/compiler/testData/ir/irText/classes/objectWithInitializers.kt.txt @@ -22,7 +22,7 @@ object Test : Base { get init { - #y = .() + .#y = .() } } diff --git a/compiler/testData/ir/irText/classes/primaryConstructor.kt.txt b/compiler/testData/ir/irText/classes/primaryConstructor.kt.txt index 60c21475f3b..2e4cfbda380 100644 --- a/compiler/testData/ir/irText/classes/primaryConstructor.kt.txt +++ b/compiler/testData/ir/irText/classes/primaryConstructor.kt.txt @@ -47,7 +47,7 @@ class Test3 { get init { - #x = x + .#x = x } } diff --git a/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt.txt b/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt.txt index a31ec922d9f..48bdc9f3ebb 100644 --- a/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt.txt +++ b/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt.txt @@ -25,7 +25,7 @@ class TestInitBlock : Base { get init { - #x = 0 + .#x = 0 } constructor() { diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt index dd685ea127e..0cab97fc9e0 100644 --- a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt @@ -29,22 +29,22 @@ class DFoo : IFoo { private /*final field*/ val $$delegate_0: IFoo = d @Ann override fun String.testExtFun() { - (#$$delegate_0, ).testExtFun() + (.#$$delegate_0, ).testExtFun() } @Ann override fun testFun() { - #$$delegate_0.testFun() + .#$$delegate_0.testFun() } override val String.testExtVal: String override get(): String { - return (#$$delegate_0, ).() + return (.#$$delegate_0, ).() } override val testVal: String override get(): String { - return #$$delegate_0.() + return .#$$delegate_0.() } } diff --git a/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt b/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt index cdc06bc23e6..1b37f10bbab 100644 --- a/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt @@ -23,7 +23,7 @@ class C { field = 1 get set(value: Int) { - #test4 = value + .#test4 = value } var test5: Int @@ -41,16 +41,16 @@ class C { } ) get(): Int { - return #test7$delegate.getValue(thisRef = , property = ::test7) + return .#test7$delegate.getValue(thisRef = , property = ::test7) } var test8: Int /* by */ field = hashMapOf() get(): Int { - return #test8$delegate.getValue(thisRef = , property = ::test8) + return .#test8$delegate.getValue(thisRef = , property = ::test8) } set(: Int) { - return #test8$delegate.setValue(thisRef = , property = ::test8, value = ) + return .#test8$delegate.setValue(thisRef = , property = ::test8, value = ) } } diff --git a/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt b/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt index e64cbcacc1a..bc3e76d46a5 100644 --- a/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt @@ -24,16 +24,16 @@ class C { } ) get(): Int { - return #test2$delegate.getValue(thisRef = , property = ::test2) + return .#test2$delegate.getValue(thisRef = , property = ::test2) } var test3: Any /* by */ field = .() get(): Any { - return #test3$delegate.getValue(thisRef = , property = ::test3) + return .#test3$delegate.getValue(thisRef = , property = ::test3) } set(: Any) { - return #test3$delegate.setValue(thisRef = , property = ::test3, value = ) + return .#test3$delegate.setValue(thisRef = , property = ::test3, value = ) } } diff --git a/compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.kt.txt b/compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.kt.txt index 87d5028821e..499310e63d3 100644 --- a/compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.kt.txt +++ b/compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.kt.txt @@ -12,12 +12,12 @@ inline class IT { override fun toString(): String { return "IT(" + "x=" + -#x + +.#x + ")" } override fun hashCode(): Int { - return #x.hashCode() + return .#x.hashCode() } override operator fun equals(other: Any?): Boolean { @@ -26,7 +26,7 @@ inline class IT { } val tmp0_other_with_cast: IT = other as IT when { - EQEQ(arg0 = #x, arg1 = #x).not() -> return false + EQEQ(arg0 = .#x, arg1 = tmp0_other_with_cast.#x).not() -> return false } return true } @@ -92,12 +92,12 @@ inline class InlineMutableSet : MutableSet { override fun toString(): String { return "InlineMutableSet(" + "ms=" + -#ms + +.#ms + ")" } override fun hashCode(): Int { - return #ms.hashCode() + return .#ms.hashCode() } override operator fun equals(other: Any?): Boolean { @@ -106,7 +106,7 @@ inline class InlineMutableSet : MutableSet { } val tmp0_other_with_cast: InlineMutableSet = other as InlineMutableSet when { - EQEQ(arg0 = #ms, arg1 = #ms).not() -> return false + EQEQ(arg0 = .#ms, arg1 = tmp0_other_with_cast.#ms).not() -> return false } return true } diff --git a/compiler/testData/ir/irText/declarations/kt29833.kt.txt b/compiler/testData/ir/irText/declarations/kt29833.kt.txt index fff97c14f7e..2d7eaf44ddf 100644 --- a/compiler/testData/ir/irText/declarations/kt29833.kt.txt +++ b/compiler/testData/ir/irText/declarations/kt29833.kt.txt @@ -12,7 +12,7 @@ object Definitions { get val ktValue: String - field = #CONSTANT + field = super.#CONSTANT get } diff --git a/compiler/testData/ir/irText/declarations/kt35550.kt.txt b/compiler/testData/ir/irText/declarations/kt35550.kt.txt index 66a1472b519..2b8de3d0ff5 100644 --- a/compiler/testData/ir/irText/declarations/kt35550.kt.txt +++ b/compiler/testData/ir/irText/declarations/kt35550.kt.txt @@ -16,7 +16,7 @@ class A : I { private /*final field*/ val $$delegate_0: I = i override val T.id: T override get(): T { - return (#$$delegate_0, ).() + return (.#$$delegate_0, ).() } } diff --git a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt index e2e22c91071..5578254723f 100644 --- a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt @@ -14,33 +14,33 @@ data class Test { get operator fun component1(): T { - return #x + return .#x } operator fun component2(): String { - return #y + return .#y } - fun copy(x: T = #x, y: String = #y): Test { + fun copy(x: T = .#x, y: String = .#y): Test { return Test(x = x, y = y) } override fun toString(): String { return "Test(" + "x=" + -#x + +.#x + ", " + "y=" + -#y + +.#y + ")" } override fun hashCode(): Int { var result: Int = when { - EQEQ(arg0 = #x, arg1 = null) -> 0 - true -> #x.hashCode() + EQEQ(arg0 = .#x, arg1 = null) -> 0 + true -> .#x.hashCode() } - result = result.times(other = 31).plus(other = #y.hashCode()) + result = result.times(other = 31).plus(other = .#y.hashCode()) return result } @@ -53,10 +53,10 @@ data class Test { } val tmp0_other_with_cast: Test = other as Test when { - EQEQ(arg0 = #x, arg1 = #x).not() -> return false + EQEQ(arg0 = .#x, arg1 = tmp0_other_with_cast.#x).not() -> return false } when { - EQEQ(arg0 = #y, arg1 = #y).not() -> return false + EQEQ(arg0 = .#y, arg1 = tmp0_other_with_cast.#y).not() -> return false } return true } diff --git a/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt index f5b15febf27..df3fbee5830 100644 --- a/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt @@ -16,16 +16,16 @@ class Test : IBase { private /*final field*/ val $$delegate_0: IBase = impl override fun qux(t: TT, x: X) { - #$$delegate_0.qux(t = t, x = x) + .#$$delegate_0.qux(t = t, x = x) } override fun foo(x: Int) { - #$$delegate_0.foo(x = x) + .#$$delegate_0.foo(x = x) } override val bar: Int override get(): Int { - return #$$delegate_0.() + return .#$$delegate_0.() } } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt index 8e117b1728e..9815847b52c 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt @@ -42,7 +42,7 @@ class Host { val testMember: String /* by */ field = DelegateProvider(value = "OK").provideDelegate(thisRef = , property = ::testMember) get(): String { - return #testMember$delegate.getValue(thisRef = , property = ::testMember) + return .#testMember$delegate.getValue(thisRef = , property = ::testMember) } } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt index 65135b040d1..950932fcf81 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt @@ -29,7 +29,7 @@ object Host { val String.plusK: String /* by */ field = (, "K").provideDelegate(host = , p = ::plusK) get(): String { - return #plusK$delegate.getValue(receiver = , p = ::plusK) + return .#plusK$delegate.getValue(receiver = , p = ::plusK) } val ok: String diff --git a/compiler/testData/ir/irText/expressions/coercionToUnit.kt.txt b/compiler/testData/ir/irText/expressions/coercionToUnit.kt.txt index 1113aec2de0..bdfbeaadb66 100644 --- a/compiler/testData/ir/irText/expressions/coercionToUnit.kt.txt +++ b/compiler/testData/ir/irText/expressions/coercionToUnit.kt.txt @@ -11,14 +11,14 @@ fun test2(mc: MutableCollection) { fun test3() { { // BLOCK - val tmp0_safe_receiver: @FlexibleNullability PrintStream? = #out + val tmp0_safe_receiver: @FlexibleNullability PrintStream? = super.#out when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null true -> tmp0_safe_receiver /*!! PrintStream */.println(p0 = "Hello,") } } /*~> Unit */ { // BLOCK - val tmp1_safe_receiver: @FlexibleNullability PrintStream? = #out + val tmp1_safe_receiver: @FlexibleNullability PrintStream? = super.#out when { EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null true -> tmp1_safe_receiver /*!! PrintStream */.println(p0 = "world!") diff --git a/compiler/testData/ir/irText/expressions/equals.kt.txt b/compiler/testData/ir/irText/expressions/equals.kt.txt index ede412500df..cd4ce6f7a62 100644 --- a/compiler/testData/ir/irText/expressions/equals.kt.txt +++ b/compiler/testData/ir/irText/expressions/equals.kt.txt @@ -7,10 +7,10 @@ fun testEquals(a: Int, b: Int): Boolean { } fun testJEqeqNull(): Boolean { - return EQEQ(arg0 = #INT_NULL, arg1 = null) + return EQEQ(arg0 = super.#INT_NULL, arg1 = null) } fun testJEqualsNull(): Boolean { - return #INT_NULL /*!! Int */.equals(other = null) + return super.#INT_NULL /*!! Int */.equals(other = null) } diff --git a/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt b/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt index a69a9646d20..4a946701b51 100644 --- a/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt +++ b/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt @@ -54,15 +54,15 @@ fun test(b: Boolean) { b -> d1 true -> d2 } - #f = 42 - #f /*~> Unit */ + k /*as JFieldOwner */super.#f = 42 + k /*as JFieldOwner */super.#f /*~> Unit */ val md1: DerivedThroughMid1 = DerivedThroughMid1() val md2: DerivedThroughMid2 = DerivedThroughMid2() val mk: Any = when { b -> md1 true -> md2 } - #f = 44 - #f /*~> Unit */ + mk /*as Mid */super.#f = 44 + mk /*as Mid */super.#f /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt.txt b/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt.txt index 9e774c01faf..1be0f30bbeb 100644 --- a/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt.txt @@ -6,15 +6,15 @@ class Derived : Base { } init { - #value = 0 + super.#value = 0 } fun getValue(): Int { - return #value + return super.#value } fun setValue(value: Int) { - #value = value + super.#value = value } } diff --git a/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt index 8e2768d8ae4..81f61c1123d 100644 --- a/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt @@ -1,14 +1,14 @@ fun testFun() { - #out /*!! PrintStream */.println(p0 = "testFun") + super.#out /*!! PrintStream */.println(p0 = "testFun") } var testProp: Any get(): Any { - #out /*!! PrintStream */.println(p0 = "testProp/get") + super.#out /*!! PrintStream */.println(p0 = "testProp/get") return 42 } set(value: Any) { - #out /*!! PrintStream */.println(p0 = "testProp/set") + super.#out /*!! PrintStream */.println(p0 = "testProp/set") } class TestClass { @@ -21,14 +21,14 @@ class TestClass { val test: Int field = when { true -> { // BLOCK - #out /*!! PrintStream */.println(p0 = "TestClass/test") + super.#out /*!! PrintStream */.println(p0 = "TestClass/test") 42 } } get init { - #out /*!! PrintStream */.println(p0 = "TestClass/init") + super.#out /*!! PrintStream */.println(p0 = "TestClass/init") } } diff --git a/compiler/testData/ir/irText/expressions/kt16904.kt.txt b/compiler/testData/ir/irText/expressions/kt16904.kt.txt index a8c8a13cc4c..d58a73954f3 100644 --- a/compiler/testData/ir/irText/expressions/kt16904.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt16904.kt.txt @@ -53,7 +53,7 @@ class Test2 : J { } init { - #field = 42 + super.#field = 42 } } diff --git a/compiler/testData/ir/irText/expressions/kt37570.kt.txt b/compiler/testData/ir/irText/expressions/kt37570.kt.txt index 68d8602f76f..9aaad6bc15a 100644 --- a/compiler/testData/ir/irText/expressions/kt37570.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt37570.kt.txt @@ -14,7 +14,7 @@ class A { init { a().apply(block = local fun String.() { - #b = + .#b = } ) /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt index 9bc7b6d8090..f9323b93a52 100644 --- a/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt +++ b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.kt.txt @@ -8,7 +8,7 @@ class Derived : Base { fun setValue(v: Any) { when { v is String -> { // BLOCK - #value = v /*as String */ + super.#value = v /*as String */ } } } diff --git a/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt b/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt index 893046067fa..dd324538d32 100644 --- a/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt +++ b/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt @@ -9,7 +9,7 @@ class C { get init { - #s = { // BLOCK + .#s = { // BLOCK val tmp0_safe_receiver: Any? = x when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null diff --git a/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt index 7ba2c787799..e9bbd371094 100644 --- a/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt +++ b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt @@ -7,48 +7,48 @@ class Impl : A, B { private /*final field*/ val $$delegate_0: B = b override fun add(element: @FlexibleNullability String?): Boolean { - return #$$delegate_0.add(element = element) + return .#$$delegate_0.add(element = element) } override fun addAll(elements: Collection<@FlexibleNullability String?>): Boolean { - return #$$delegate_0.addAll(elements = elements) + return .#$$delegate_0.addAll(elements = elements) } override fun clear() { - #$$delegate_0.clear() + .#$$delegate_0.clear() } override operator fun contains(element: @FlexibleNullability String?): Boolean { - return #$$delegate_0.contains(element = element) + return .#$$delegate_0.contains(element = element) } override fun containsAll(elements: Collection<@FlexibleNullability String?>): Boolean { - return #$$delegate_0.containsAll(elements = elements) + return .#$$delegate_0.containsAll(elements = elements) } override fun isEmpty(): Boolean { - return #$$delegate_0.isEmpty() + return .#$$delegate_0.isEmpty() } override operator fun iterator(): MutableIterator<@FlexibleNullability String?> { - return #$$delegate_0.iterator() + return .#$$delegate_0.iterator() } override fun remove(element: @FlexibleNullability String?): Boolean { - return #$$delegate_0.remove(element = element) + return .#$$delegate_0.remove(element = element) } override fun removeAll(elements: Collection<@FlexibleNullability String?>): Boolean { - return #$$delegate_0.removeAll(elements = elements) + return .#$$delegate_0.removeAll(elements = elements) } override fun retainAll(elements: Collection<@FlexibleNullability String?>): Boolean { - return #$$delegate_0.retainAll(elements = elements) + return .#$$delegate_0.retainAll(elements = elements) } override val size: Int override get(): Int { - return #$$delegate_0.() + return .#$$delegate_0.() } } diff --git a/compiler/testData/ir/irText/firProblems/MultiList.kt.txt b/compiler/testData/ir/irText/firProblems/MultiList.kt.txt index 36fbbfbde82..594dc6801a4 100644 --- a/compiler/testData/ir/irText/firProblems/MultiList.kt.txt +++ b/compiler/testData/ir/irText/firProblems/MultiList.kt.txt @@ -10,24 +10,24 @@ data class Some { get operator fun component1(): T { - return #value + return .#value } - fun copy(value: T = #value): Some { + fun copy(value: T = .#value): Some { return Some(value = value) } override fun toString(): String { return "Some(" + "value=" + -#value + +.#value + ")" } override fun hashCode(): Int { return when { - EQEQ(arg0 = #value, arg1 = null) -> 0 - true -> #value.hashCode() + EQEQ(arg0 = .#value, arg1 = null) -> 0 + true -> .#value.hashCode() } } @@ -40,7 +40,7 @@ data class Some { } val tmp0_other_with_cast: Some = other as Some when { - EQEQ(arg0 = #value, arg1 = #value).not() -> return false + EQEQ(arg0 = .#value, arg1 = tmp0_other_with_cast.#value).not() -> return false } return true } diff --git a/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt b/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt index f26f3f28144..3382eec4c03 100644 --- a/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt +++ b/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt @@ -41,26 +41,26 @@ data class DataClass : Derived, Delegate { get override fun bar() { - #delegate.bar() + .#delegate.bar() } operator fun component1(): Delegate { - return #delegate + return .#delegate } - fun copy(delegate: Delegate = #delegate): DataClass { + fun copy(delegate: Delegate = .#delegate): DataClass { return DataClass(delegate = delegate) } override fun toString(): String { return "DataClass(" + "delegate=" + -#delegate + +.#delegate + ")" } override fun hashCode(): Int { - return #delegate.hashCode() + return .#delegate.hashCode() } override operator fun equals(other: Any?): Boolean { @@ -72,7 +72,7 @@ data class DataClass : Derived, Delegate { } val tmp0_other_with_cast: DataClass = other as DataClass when { - EQEQ(arg0 = #delegate, arg1 = #delegate).not() -> return false + EQEQ(arg0 = .#delegate, arg1 = tmp0_other_with_cast.#delegate).not() -> return false } return true } diff --git a/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt b/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt index 1acd651229a..492ab2f9cd2 100644 --- a/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt +++ b/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt @@ -14,30 +14,30 @@ data class A { get operator fun component1(): Int { - return #x + return .#x } operator fun component2(): Int { - return #y + return .#y } - fun copy(x: Int = #x, y: Int = #y): A { + fun copy(x: Int = .#x, y: Int = .#y): A { return A(x = x, y = y) } override fun toString(): String { return "A(" + "x=" + -#x + +.#x + ", " + "y=" + -#y + +.#y + ")" } override fun hashCode(): Int { - var result: Int = #x.hashCode() - result = result.times(other = 31).plus(other = #y.hashCode()) + var result: Int = .#x.hashCode() + result = result.times(other = 31).plus(other = .#y.hashCode()) return result } @@ -50,10 +50,10 @@ data class A { } val tmp0_other_with_cast: A = other as A when { - EQEQ(arg0 = #x, arg1 = #x).not() -> return false + EQEQ(arg0 = .#x, arg1 = tmp0_other_with_cast.#x).not() -> return false } when { - EQEQ(arg0 = #y, arg1 = #y).not() -> return false + EQEQ(arg0 = .#y, arg1 = tmp0_other_with_cast.#y).not() -> return false } return true } diff --git a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt index 9d12539159c..83c466f38bf 100644 --- a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt +++ b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt @@ -108,7 +108,7 @@ val Value>.additionalText: P /* by */ () } private get(): Any? { - return #deepO$delegate.getValue(t = , p = ::deepO) /*as Any? */ + return .#deepO$delegate.getValue(t = , p = ::deepO) /*as Any? */ } private val Value>.deepK: Any? /* by */ @@ -129,7 +129,7 @@ val Value>.additionalText: P /* by */ () } private get(): Any? { - return #deepK$delegate.getValue(t = , p = ::deepK) /*as Any? */ + return .#deepK$delegate.getValue(t = , p = ::deepK) /*as Any? */ } override operator fun getValue(t: Value>, p: KProperty<*>): P { diff --git a/compiler/testData/ir/irText/types/javaWildcardType.kt.txt b/compiler/testData/ir/irText/types/javaWildcardType.kt.txt index 4425a5dfca8..f4e9ce282a2 100644 --- a/compiler/testData/ir/irText/types/javaWildcardType.kt.txt +++ b/compiler/testData/ir/irText/types/javaWildcardType.kt.txt @@ -15,36 +15,36 @@ class C : J, K { private /*final field*/ val $$delegate_0: J = j override fun jf1(): @FlexibleNullability MutableCollection? { - return #$$delegate_0.jf1() + return .#$$delegate_0.jf1() } override fun jf2(): @FlexibleNullability MutableCollection<@FlexibleNullability CharSequence?>? { - return #$$delegate_0.jf2() + return .#$$delegate_0.jf2() } override fun jg1(c: @FlexibleNullability MutableCollection?) { - #$$delegate_0.jg1(c = c) + .#$$delegate_0.jg1(c = c) } override fun jg2(c: @FlexibleNullability MutableCollection<@FlexibleNullability CharSequence?>?) { - #$$delegate_0.jg2(c = c) + .#$$delegate_0.jg2(c = c) } private /*final field*/ val $$delegate_1: K = k override fun kf1(): Collection { - return #$$delegate_1.kf1() + return .#$$delegate_1.kf1() } override fun kf2(): Collection { - return #$$delegate_1.kf2() + return .#$$delegate_1.kf2() } override fun kg1(c: Collection) { - #$$delegate_1.kg1(c = c) + .#$$delegate_1.kg1(c = c) } override fun kg2(c: Collection) { - #$$delegate_1.kg2(c = c) + .#$$delegate_1.kg2(c = c) } } diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt index b3b2bb27bdf..5926f965acc 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt @@ -90,30 +90,30 @@ data class P { get operator fun component1(): Int { - return #x + return .#x } operator fun component2(): Int { - return #y + return .#y } - fun copy(x: Int = #x, y: Int = #y): P { + fun copy(x: Int = .#x, y: Int = .#y): P { return P(x = x, y = y) } override fun toString(): String { return "P(" + "x=" + -#x + +.#x + ", " + "y=" + -#y + +.#y + ")" } override fun hashCode(): Int { - var result: Int = #x.hashCode() - result = result.times(other = 31).plus(other = #y.hashCode()) + var result: Int = .#x.hashCode() + result = result.times(other = 31).plus(other = .#y.hashCode()) return result } @@ -126,10 +126,10 @@ data class P { } val tmp0_other_with_cast: P = other as P when { - EQEQ(arg0 = #x, arg1 = #x).not() -> return false + EQEQ(arg0 = .#x, arg1 = tmp0_other_with_cast.#x).not() -> return false } when { - EQEQ(arg0 = #y, arg1 = #y).not() -> return false + EQEQ(arg0 = .#y, arg1 = tmp0_other_with_cast.#y).not() -> return false } return true } diff --git a/compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.kt.txt b/compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.kt.txt index 7b1904b8b20..cc82a1c85f5 100644 --- a/compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.kt.txt @@ -33,11 +33,11 @@ class MySet : Set { fun test() { f(s = s() /*!! String */) - f(s = #STRING /*!! String */) + f(s = super.#STRING /*!! String */) } fun testContains(m: MySet) { - m.contains(element = #STRING /*!! String */) /*~> Unit */ + m.contains(element = super.#STRING /*!! String */) /*~> Unit */ m.contains(element = "abc") /*~> Unit */ } diff --git a/compiler/testData/ir/irText/types/nullChecks/platformTypeReceiver.kt.txt b/compiler/testData/ir/irText/types/nullChecks/platformTypeReceiver.kt.txt index f27bf404707..9d6f6c48a1d 100644 --- a/compiler/testData/ir/irText/types/nullChecks/platformTypeReceiver.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/platformTypeReceiver.kt.txt @@ -1,5 +1,5 @@ fun test1(): Boolean { - return #BOOL_NULL /*!! Boolean */.equals(other = null) + return super.#BOOL_NULL /*!! Boolean */.equals(other = null) } fun test2(): Boolean { diff --git a/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt b/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt index 22ae84768b0..b091d11a5c9 100644 --- a/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt +++ b/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt @@ -46,35 +46,35 @@ class KRaw : JRaw { private /*final field*/ val $$delegate_0: JRaw = j override fun returnsRawGenericIn(): @FlexibleNullability @RawType GenericIn? { - return #$$delegate_0.returnsRawGenericIn() + return .#$$delegate_0.returnsRawGenericIn() } override fun returnsRawGenericInv(): @FlexibleNullability @RawType GenericInv? { - return #$$delegate_0.returnsRawGenericInv() + return .#$$delegate_0.returnsRawGenericInv() } override fun returnsRawGenericOut(): @FlexibleNullability @RawType GenericOut? { - return #$$delegate_0.returnsRawGenericOut() + return .#$$delegate_0.returnsRawGenericOut() } override fun returnsRawList(): @FlexibleNullability @RawType MutableList? { - return #$$delegate_0.returnsRawList() + return .#$$delegate_0.returnsRawList() } override fun takesRawGenericIn(g: @FlexibleNullability @RawType GenericIn?) { - #$$delegate_0.takesRawGenericIn(g = g) + .#$$delegate_0.takesRawGenericIn(g = g) } override fun takesRawGenericInv(g: @FlexibleNullability @RawType GenericInv?) { - #$$delegate_0.takesRawGenericInv(g = g) + .#$$delegate_0.takesRawGenericInv(g = g) } override fun takesRawGenericOut(g: @FlexibleNullability @RawType GenericOut?) { - #$$delegate_0.takesRawGenericOut(g = g) + .#$$delegate_0.takesRawGenericOut(g = g) } override fun takesRawList(list: @FlexibleNullability @RawType MutableList?) { - #$$delegate_0.takesRawList(list = list) + .#$$delegate_0.takesRawList(list = list) } } diff --git a/compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.kt.txt b/compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.kt.txt index bffe9e72a4c..f7cca34304d 100644 --- a/compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.kt.txt +++ b/compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.kt.txt @@ -1,11 +1,11 @@ fun testSetField(a: Any, b: Any) { a as JCell /*~> Unit */ b as String /*~> Unit */ - #value = b /*as String */ + a /*as JCell */super.#value = b /*as String */ } fun testGetField(a: Any): String { a as JCell /*~> Unit */ - return #value /*!! String */ + return a /*as JCell */super.#value /*!! String */ } From 91c9d9d25c6096e9ef57bc43b930adafbc72cb7c Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 10 Nov 2020 03:16:00 +0300 Subject: [PATCH 150/698] [IR] KotlinLikeDumper: print whole string concatenation at one line --- .../src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index 211c1463702..9f4cbd7699d 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -1017,10 +1017,12 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } override fun visitStringConcatenation(expression: IrStringConcatenation, data: IrDeclaration?) { + // TODO type // TODO escape? see IrTextTestCaseGenerated.Expressions#testStringTemplates + // TODO optionally each argument at a separate line, another option add a wrapping expression.arguments.forEachIndexed { i, e -> if (i > 0) { - p.printlnWithNoIndent(" + ") + p.printWithNoIndent(" + ") } e.accept(this, data) } From 21da2b0350acc955a069c7e95db574372b626c40 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 10 Nov 2020 03:15:39 +0300 Subject: [PATCH 151/698] [IR] update testdata: print whole string concatenation at one line --- .../classes/dataClassWithArrayMembers.kt.txt | 39 ++----------------- .../ir/irText/classes/dataClasses.kt.txt | 30 ++------------ .../irText/classes/dataClassesGeneric.kt.txt | 20 ++-------- .../classes/enumWithMultipleCtors.kt.txt | 6 +-- .../ir/irText/classes/inlineClass.kt.txt | 5 +-- .../inlineClassSyntheticMethods.kt.txt | 5 +-- .../testData/ir/irText/classes/kt31649.kt.txt | 10 +---- .../lambdaInDataClassDefaultParameter.kt.txt | 10 +---- .../inlineCollectionOfInlineClass.kt.txt | 10 +---- .../parameters/dataClassMembers.kt.txt | 8 +--- .../expressions/breakContinueInWhen.kt.txt | 3 +- .../ir/irText/expressions/kt28006.kt.txt | 10 ++--- .../objectReferenceInFieldInitializer.kt.txt | 3 +- .../irText/expressions/stringTemplates.kt.txt | 4 +- .../ir/irText/firProblems/MultiList.kt.txt | 5 +-- .../irText/firProblems/SignatureClash.kt.txt | 5 +-- .../lambdas/destructuringInLambda.kt.txt | 8 +--- .../irText/regressions/coercionInLoop.kt.txt | 3 +- .../enhancedNullabilityInForLoop.kt.txt | 8 +--- 19 files changed, 31 insertions(+), 161 deletions(-) diff --git a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt index 48ed0c62440..522024adae4 100644 --- a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt +++ b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt @@ -82,34 +82,7 @@ data class Test1 { } override fun toString(): String { - return "Test1(" + -"stringArray=" + -dataClassArrayMemberToString(arg0 = .#stringArray) + -", " + -"charArray=" + -dataClassArrayMemberToString(arg0 = .#charArray) + -", " + -"booleanArray=" + -dataClassArrayMemberToString(arg0 = .#booleanArray) + -", " + -"byteArray=" + -dataClassArrayMemberToString(arg0 = .#byteArray) + -", " + -"shortArray=" + -dataClassArrayMemberToString(arg0 = .#shortArray) + -", " + -"intArray=" + -dataClassArrayMemberToString(arg0 = .#intArray) + -", " + -"longArray=" + -dataClassArrayMemberToString(arg0 = .#longArray) + -", " + -"floatArray=" + -dataClassArrayMemberToString(arg0 = .#floatArray) + -", " + -"doubleArray=" + -dataClassArrayMemberToString(arg0 = .#doubleArray) + -")" + return "Test1(" + "stringArray=" + dataClassArrayMemberToString(arg0 = .#stringArray) + ", " + "charArray=" + dataClassArrayMemberToString(arg0 = .#charArray) + ", " + "booleanArray=" + dataClassArrayMemberToString(arg0 = .#booleanArray) + ", " + "byteArray=" + dataClassArrayMemberToString(arg0 = .#byteArray) + ", " + "shortArray=" + dataClassArrayMemberToString(arg0 = .#shortArray) + ", " + "intArray=" + dataClassArrayMemberToString(arg0 = .#intArray) + ", " + "longArray=" + dataClassArrayMemberToString(arg0 = .#longArray) + ", " + "floatArray=" + dataClassArrayMemberToString(arg0 = .#floatArray) + ", " + "doubleArray=" + dataClassArrayMemberToString(arg0 = .#doubleArray) + ")" } override fun hashCode(): Int { @@ -185,10 +158,7 @@ data class Test2 { } override fun toString(): String { - return "Test2(" + -"genericArray=" + -dataClassArrayMemberToString(arg0 = .#genericArray) + -")" + return "Test2(" + "genericArray=" + dataClassArrayMemberToString(arg0 = .#genericArray) + ")" } override fun hashCode(): Int { @@ -231,10 +201,7 @@ data class Test3 { } override fun toString(): String { - return "Test3(" + -"anyArrayN=" + -dataClassArrayMemberToString(arg0 = .#anyArrayN) + -")" + return "Test3(" + "anyArrayN=" + dataClassArrayMemberToString(arg0 = .#anyArrayN) + ")" } override fun hashCode(): Int { diff --git a/compiler/testData/ir/irText/classes/dataClasses.kt.txt b/compiler/testData/ir/irText/classes/dataClasses.kt.txt index 4a714577279..623d2502672 100644 --- a/compiler/testData/ir/irText/classes/dataClasses.kt.txt +++ b/compiler/testData/ir/irText/classes/dataClasses.kt.txt @@ -34,16 +34,7 @@ data class Test1 { } override fun toString(): String { - return "Test1(" + -"x=" + -.#x + -", " + -"y=" + -.#y + -", " + -"z=" + -.#z + -")" + return "Test1(" + "x=" + .#x + ", " + "y=" + .#y + ", " + "z=" + .#z + ")" } override fun hashCode(): Int { @@ -95,10 +86,7 @@ data class Test2 { } override fun toString(): String { - return "Test2(" + -"x=" + -.#x + -")" + return "Test2(" + "x=" + .#x + ")" } override fun hashCode(): Int { @@ -168,19 +156,7 @@ data class Test3 { } override fun toString(): String { - return "Test3(" + -"d=" + -.#d + -", " + -"dn=" + -.#dn + -", " + -"f=" + -.#f + -", " + -"df=" + -.#df + -")" + return "Test3(" + "d=" + .#d + ", " + "dn=" + .#dn + ", " + "f=" + .#f + ", " + "df=" + .#df + ")" } override fun hashCode(): Int { diff --git a/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt b/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt index 10bc1d47fcf..d4f69ebfbc2 100644 --- a/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt +++ b/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt @@ -18,10 +18,7 @@ data class Test1 { } override fun toString(): String { - return "Test1(" + -"x=" + -.#x + -")" + return "Test1(" + "x=" + .#x + ")" } override fun hashCode(): Int { @@ -67,10 +64,7 @@ data class Test2 { } override fun toString(): String { - return "Test2(" + -"x=" + -.#x + -")" + return "Test2(" + "x=" + .#x + ")" } override fun hashCode(): Int { @@ -113,10 +107,7 @@ data class Test3 { } override fun toString(): String { - return "Test3(" + -"x=" + -.#x + -")" + return "Test3(" + "x=" + .#x + ")" } override fun hashCode(): Int { @@ -159,10 +150,7 @@ data class Test4 { } override fun toString(): String { - return "Test4(" + -"x=" + -.#x + -")" + return "Test4(" + "x=" + .#x + ")" } override fun hashCode(): Int { diff --git a/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt b/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt index 2e75794e4fd..56aac42189a 100644 --- a/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt +++ b/compiler/testData/ir/irText/classes/enumWithMultipleCtors.kt.txt @@ -50,11 +50,7 @@ open enum class A : Enum { } open fun f(): String { - return .() + -"#" + -.() + -"#" + -.() + return .() + "#" + .() + "#" + .() } fun values(): Array /* Synthetic body for ENUM_VALUES */ diff --git a/compiler/testData/ir/irText/classes/inlineClass.kt.txt b/compiler/testData/ir/irText/classes/inlineClass.kt.txt index fcaeb190100..5139d28a36d 100644 --- a/compiler/testData/ir/irText/classes/inlineClass.kt.txt +++ b/compiler/testData/ir/irText/classes/inlineClass.kt.txt @@ -10,10 +10,7 @@ inline class Test { get override fun toString(): String { - return "Test(" + -"x=" + -.#x + -")" + return "Test(" + "x=" + .#x + ")" } override fun hashCode(): Int { diff --git a/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt b/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt index cc443e40114..4977347848e 100644 --- a/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt +++ b/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.kt.txt @@ -31,10 +31,7 @@ inline class IC { } override fun toString(): String { - return "IC(" + -"c=" + -.#c + -")" + return "IC(" + "c=" + .#c + ")" } override fun hashCode(): Int { diff --git a/compiler/testData/ir/irText/classes/kt31649.kt.txt b/compiler/testData/ir/irText/classes/kt31649.kt.txt index 09853e02070..c29091547d3 100644 --- a/compiler/testData/ir/irText/classes/kt31649.kt.txt +++ b/compiler/testData/ir/irText/classes/kt31649.kt.txt @@ -18,10 +18,7 @@ data class TestData { } override fun toString(): String { - return "TestData(" + -"nn=" + -.#nn + -")" + return "TestData(" + "nn=" + .#nn + ")" } override fun hashCode(): Int { @@ -59,10 +56,7 @@ inline class TestInline { get override fun toString(): String { - return "TestInline(" + -"nn=" + -.#nn + -")" + return "TestInline(" + "nn=" + .#nn + ")" } override fun hashCode(): Int { diff --git a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt index e890a37861a..168e6397cee 100644 --- a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt +++ b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.kt.txt @@ -21,10 +21,7 @@ data class A { } override fun toString(): String { - return "A(" + -"runA=" + -.#runA + -")" + return "A(" + "runA=" + .#runA + ")" } override fun hashCode(): Int { @@ -78,10 +75,7 @@ data class B { } override fun toString(): String { - return "B(" + -"x=" + -.#x + -")" + return "B(" + "x=" + .#x + ")" } override fun hashCode(): Int { diff --git a/compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.kt.txt b/compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.kt.txt index 499310e63d3..f76e715945d 100644 --- a/compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.kt.txt +++ b/compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.kt.txt @@ -10,10 +10,7 @@ inline class IT { get override fun toString(): String { - return "IT(" + -"x=" + -.#x + -")" + return "IT(" + "x=" + .#x + ")" } override fun hashCode(): Int { @@ -90,10 +87,7 @@ inline class InlineMutableSet : MutableSet { } override fun toString(): String { - return "InlineMutableSet(" + -"ms=" + -.#ms + -")" + return "InlineMutableSet(" + "ms=" + .#ms + ")" } override fun hashCode(): Int { diff --git a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt index 5578254723f..48559daab2c 100644 --- a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt @@ -26,13 +26,7 @@ data class Test { } override fun toString(): String { - return "Test(" + -"x=" + -.#x + -", " + -"y=" + -.#y + -")" + return "Test(" + "x=" + .#x + ", " + "y=" + .#y + ")" } override fun hashCode(): Int { diff --git a/compiler/testData/ir/irText/expressions/breakContinueInWhen.kt.txt b/compiler/testData/ir/irText/expressions/breakContinueInWhen.kt.txt index 7054d892edb..850acd9f9d3 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInWhen.kt.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInWhen.kt.txt @@ -77,8 +77,7 @@ fun testContinueDoWhile() { when { greater(arg0 = k, arg1 = 2) -> continue } - s = s.plus(other = k + -";") + s = s.plus(other = k + ";") // } while (less(arg0 = k, arg1 = 10)) } when { diff --git a/compiler/testData/ir/irText/expressions/kt28006.kt.txt b/compiler/testData/ir/irText/expressions/kt28006.kt.txt index 9e923701440..c0301248356 100644 --- a/compiler/testData/ir/irText/expressions/kt28006.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt28006.kt.txt @@ -23,18 +23,14 @@ const val testConst4: String get fun test1(x: Int): String { - return "🤗" + -x + return "🤗" + x } fun test2(x: Int): String { - return x + -"🤗" + return x + "🤗" } fun test3(x: Int): String { - return x + -"🤗" + -x + return x + "🤗" + x } diff --git a/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.kt.txt b/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.kt.txt index a8a1607b643..9ce2a8abc1d 100644 --- a/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.kt.txt +++ b/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.kt.txt @@ -10,8 +10,7 @@ object A { private get private val b: String - field = "1234" + -.() + field = "1234" + .() private get private val c: Int diff --git a/compiler/testData/ir/irText/expressions/stringTemplates.kt.txt b/compiler/testData/ir/irText/expressions/stringTemplates.kt.txt index e8e47b4168a..7a8f1c46f28 100644 --- a/compiler/testData/ir/irText/expressions/stringTemplates.kt.txt +++ b/compiler/testData/ir/irText/expressions/stringTemplates.kt.txt @@ -29,9 +29,7 @@ abc get val test6: String - field = () + -" " + -foo() + field = () + " " + foo() get val test7: String diff --git a/compiler/testData/ir/irText/firProblems/MultiList.kt.txt b/compiler/testData/ir/irText/firProblems/MultiList.kt.txt index 594dc6801a4..8b9a49c5e4a 100644 --- a/compiler/testData/ir/irText/firProblems/MultiList.kt.txt +++ b/compiler/testData/ir/irText/firProblems/MultiList.kt.txt @@ -18,10 +18,7 @@ data class Some { } override fun toString(): String { - return "Some(" + -"value=" + -.#value + -")" + return "Some(" + "value=" + .#value + ")" } override fun hashCode(): Int { diff --git a/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt b/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt index 3382eec4c03..b33ad6bb48e 100644 --- a/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt +++ b/compiler/testData/ir/irText/firProblems/SignatureClash.kt.txt @@ -53,10 +53,7 @@ data class DataClass : Derived, Delegate { } override fun toString(): String { - return "DataClass(" + -"delegate=" + -.#delegate + -")" + return "DataClass(" + "delegate=" + .#delegate + ")" } override fun hashCode(): Int { diff --git a/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt b/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt index 492ab2f9cd2..b26f811287d 100644 --- a/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt +++ b/compiler/testData/ir/irText/lambdas/destructuringInLambda.kt.txt @@ -26,13 +26,7 @@ data class A { } override fun toString(): String { - return "A(" + -"x=" + -.#x + -", " + -"y=" + -.#y + -")" + return "A(" + "x=" + .#x + ", " + "y=" + .#y + ")" } override fun hashCode(): Int { diff --git a/compiler/testData/ir/irText/regressions/coercionInLoop.kt.txt b/compiler/testData/ir/irText/regressions/coercionInLoop.kt.txt index eeb31095210..08cf9e5251f 100644 --- a/compiler/testData/ir/irText/regressions/coercionInLoop.kt.txt +++ b/compiler/testData/ir/irText/regressions/coercionInLoop.kt.txt @@ -4,8 +4,7 @@ fun box(): String { var i: Int = 0 while (x.hasNext()) { // BLOCK when { - ieee754equals(arg0 = a.get(index = i), arg1 = x.next()).not() -> return "Fail " + -i + ieee754equals(arg0 = a.get(index = i), arg1 = x.next()).not() -> return "Fail " + i } { // BLOCK val tmp0: Int = i diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt index 5926f965acc..a43fd45e568 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt @@ -102,13 +102,7 @@ data class P { } override fun toString(): String { - return "P(" + -"x=" + -.#x + -", " + -"y=" + -.#y + -")" + return "P(" + "x=" + .#x + ", " + "y=" + .#y + ")" } override fun hashCode(): Int { From 9daa86c1a2c5b74c4e8ac2c3d420f830e24b01ab Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 10 Nov 2020 03:41:23 +0300 Subject: [PATCH 152/698] [IR] KotlinLikeDumper: support labels on loops, break & continue --- .../kotlin/ir/util/KotlinLikeDumper.kt | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index 9f4cbd7699d..8cbfd4bede7 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -1139,16 +1139,26 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.print("}") } + private fun IrLoop.printLabel() { + label?.let { + p.printWithNoIndent(it) + p.printWithNoIndent("@ ") + } + } + override fun visitWhileLoop(loop: IrWhileLoop, data: IrDeclaration?) { + loop.printLabel() + p.printWithNoIndent("while (") loop.condition.accept(this, data) - p.printWithNoIndent(") ") loop.body?.accept(this, data) } override fun visitDoWhileLoop(loop: IrDoWhileLoop, data: IrDeclaration?) { + loop.printLabel() + p.printWithNoIndent("do") loop.body?.accept(this, data) @@ -1178,14 +1188,21 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printlnWithNoIndent() } + private fun IrBreakContinue.printLabel() { + label?.let { + p.printWithNoIndent("@") + p.printWithNoIndent(it) + } + } + override fun visitBreak(jump: IrBreak, data: IrDeclaration?) { - // TODO label p.printWithNoIndent("break") + jump.printLabel() } override fun visitContinue(jump: IrContinue, data: IrDeclaration?) { - // TODO label p.printWithNoIndent("continue") + jump.printLabel() } override fun visitErrorDeclaration(declaration: IrErrorDeclaration, data: IrDeclaration?) { From 5c8a93c7ff5a245c94279674399b2bb522f47cf4 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 10 Nov 2020 03:40:36 +0300 Subject: [PATCH 153/698] [IR] update testdata: support labels on loops, break & continue --- .../expressions/badBreakContinue.kt.txt | 4 +-- .../irText/expressions/breakContinue.kt.txt | 36 +++++++++---------- .../breakContinueInLoopHeader.kt.txt | 20 +++++------ .../expressions/forWithBreakContinue.kt.txt | 20 +++++------ .../ir/irText/expressions/kt24804.kt.txt | 6 ++-- 5 files changed, 43 insertions(+), 43 deletions(-) diff --git a/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt b/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt index b056fc3aef9..4171a8d0714 100644 --- a/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt +++ b/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt @@ -4,14 +4,14 @@ fun test1() { } fun test2() { - while (true) { // BLOCK + L1@ while (true) { // BLOCK error("") /* ERROR EXPRESSION */ error("") /* ERROR EXPRESSION */ } } fun test3() { - while (true) { // BLOCK + L1@ while (true) { // BLOCK val lambda: Function0 = local fun (): Nothing { error("") /* ERROR EXPRESSION */ error("") /* ERROR EXPRESSION */ diff --git a/compiler/testData/ir/irText/expressions/breakContinue.kt.txt b/compiler/testData/ir/irText/expressions/breakContinue.kt.txt index 273c2cfe566..d7ebb7a1ef3 100644 --- a/compiler/testData/ir/irText/expressions/breakContinue.kt.txt +++ b/compiler/testData/ir/irText/expressions/breakContinue.kt.txt @@ -18,34 +18,34 @@ fun test1() { } fun test2() { - while (true) { // BLOCK - while (true) { // BLOCK - break - break + OUTER@ while (true) { // BLOCK + INNER@ while (true) { // BLOCK + break@INNER + break@OUTER } - break + break@OUTER } - while (true) { // BLOCK - while (true) { // BLOCK - continue - continue + OUTER@ while (true) { // BLOCK + INNER@ while (true) { // BLOCK + continue@INNER + continue@OUTER } - continue + continue@OUTER } } fun test3() { - while (true) { // BLOCK - while (true) { // BLOCK - break + L@ while (true) { // BLOCK + L@ while (true) { // BLOCK + break@L } - break + break@L } - while (true) { // BLOCK - while (true) { // BLOCK - continue + L@ while (true) { // BLOCK + L@ while (true) { // BLOCK + continue@L } - continue + continue@L } } diff --git a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.kt.txt b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.kt.txt index 1fc4fd54d33..9d029d555c8 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.kt.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.kt.txt @@ -1,6 +1,6 @@ fun test1(c: Boolean?) { - while (true) { // BLOCK - while ({ // BLOCK + L@ while (true) { // BLOCK + L2@ while ({ // BLOCK val tmp0_elvis_lhs: Boolean? = c when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> break @@ -11,8 +11,8 @@ fun test1(c: Boolean?) { } fun test2(c: Boolean?) { - while (true) { // BLOCK - while ({ // BLOCK + L@ while (true) { // BLOCK + L2@ while ({ // BLOCK val tmp0_elvis_lhs: Boolean? = c when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> continue @@ -23,7 +23,7 @@ fun test2(c: Boolean?) { } fun test3(ss: List?) { - while (true) { // BLOCK + L@ while (true) { // BLOCK { // BLOCK val tmp1_iterator: Iterator = { // BLOCK val tmp0_elvis_lhs: List? = ss @@ -32,7 +32,7 @@ fun test3(ss: List?) { true -> tmp0_elvis_lhs } }.iterator() - while (tmp1_iterator.hasNext()) { // BLOCK + L2@ while (tmp1_iterator.hasNext()) { // BLOCK val s: String = tmp1_iterator.next() } } @@ -40,7 +40,7 @@ fun test3(ss: List?) { } fun test4(ss: List?) { - while (true) { // BLOCK + L@ while (true) { // BLOCK { // BLOCK val tmp1_iterator: Iterator = { // BLOCK val tmp0_elvis_lhs: List? = ss @@ -49,7 +49,7 @@ fun test4(ss: List?) { true -> tmp0_elvis_lhs } }.iterator() - while (tmp1_iterator.hasNext()) { // BLOCK + L2@ while (tmp1_iterator.hasNext()) { // BLOCK val s: String = tmp1_iterator.next() } } @@ -58,14 +58,14 @@ fun test4(ss: List?) { fun test5() { var i: Int = 0 - while (true) { // BLOCK + Outer@ while (true) { // BLOCK { // BLOCK i = i.inc() i } /*~> Unit */ var j: Int = 0 { // BLOCK - do// COMPOSITE { + Inner@ do// COMPOSITE { { // BLOCK j = j.inc() j diff --git a/compiler/testData/ir/irText/expressions/forWithBreakContinue.kt.txt b/compiler/testData/ir/irText/expressions/forWithBreakContinue.kt.txt index 103f58c1e4d..2dbb6589b61 100644 --- a/compiler/testData/ir/irText/expressions/forWithBreakContinue.kt.txt +++ b/compiler/testData/ir/irText/expressions/forWithBreakContinue.kt.txt @@ -13,21 +13,21 @@ fun testForBreak1(ss: List) { fun testForBreak2(ss: List) { { // BLOCK val tmp0_iterator: Iterator = ss.iterator() - while (tmp0_iterator.hasNext()) { // BLOCK + OUTER@ while (tmp0_iterator.hasNext()) { // BLOCK val s1: String = tmp0_iterator.next() { // BLOCK { // BLOCK val tmp1_iterator: Iterator = ss.iterator() - while (tmp1_iterator.hasNext()) { // BLOCK + INNER@ while (tmp1_iterator.hasNext()) { // BLOCK val s2: String = tmp1_iterator.next() { // BLOCK - break - break + break@OUTER + break@INNER break } } } - break + break@OUTER } } } @@ -48,21 +48,21 @@ fun testForContinue1(ss: List) { fun testForContinue2(ss: List) { { // BLOCK val tmp0_iterator: Iterator = ss.iterator() - while (tmp0_iterator.hasNext()) { // BLOCK + OUTER@ while (tmp0_iterator.hasNext()) { // BLOCK val s1: String = tmp0_iterator.next() { // BLOCK { // BLOCK val tmp1_iterator: Iterator = ss.iterator() - while (tmp1_iterator.hasNext()) { // BLOCK + INNER@ while (tmp1_iterator.hasNext()) { // BLOCK val s2: String = tmp1_iterator.next() { // BLOCK - continue - continue + continue@OUTER + continue@INNER continue } } } - continue + continue@OUTER } } } diff --git a/compiler/testData/ir/irText/expressions/kt24804.kt.txt b/compiler/testData/ir/irText/expressions/kt24804.kt.txt index 4a437a80b86..ca84dff8a76 100644 --- a/compiler/testData/ir/irText/expressions/kt24804.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt24804.kt.txt @@ -5,16 +5,16 @@ inline fun foo(): Boolean { fun run(x: Boolean, y: Boolean): String { var z: Int = 10 { // BLOCK - do// COMPOSITE { + l2@ do// COMPOSITE { z = z.plus(other = 1) when { greater(arg0 = z, arg1 = 100) -> return "NOT_OK" } when { - x -> continue + x -> continue@l2 } when { - y -> continue + y -> continue@l2 } // } while (foo()) } From 2775c89ebb8fbbdf675db631def762055219e904 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 10 Nov 2020 03:53:38 +0300 Subject: [PATCH 154/698] [IR] KotlinLikeDumper: print a parameter in catch --- .../src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index 8cbfd4bede7..cfb0956b43e 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -1183,7 +1183,13 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } override fun visitCatch(aCatch: IrCatch, data: IrDeclaration?) { - p.print("catch (...) ") + p.print("catch (") + aCatch.catchParameter.run { + p.printWithNoIndent(name.asString()) + p.printWithNoIndent(": ") + type.printTypeWithNoIndent() + } + p.printWithNoIndent(")") aCatch.result.accept(this, data) p.printlnWithNoIndent() } From 64b42401a1d9a3867d3a877e70ebc509461dd143 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 10 Nov 2020 03:52:31 +0300 Subject: [PATCH 155/698] [IR] update testdata: print a parameter in catch --- .../declarations/catchParameterInTopLevelProperty.kt.txt | 2 +- .../declarations/parameters/useNextParamInLambda.kt.txt | 2 +- .../ir/irText/expressions/catchParameterAccess.kt.txt | 2 +- compiler/testData/ir/irText/expressions/tryCatch.kt.txt | 4 ++-- .../ir/irText/expressions/tryCatchWithImplicitCast.kt.txt | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/testData/ir/irText/declarations/catchParameterInTopLevelProperty.kt.txt b/compiler/testData/ir/irText/declarations/catchParameterInTopLevelProperty.kt.txt index 3ceb39a0453..1fab95d1d69 100644 --- a/compiler/testData/ir/irText/declarations/catchParameterInTopLevelProperty.kt.txt +++ b/compiler/testData/ir/irText/declarations/catchParameterInTopLevelProperty.kt.txt @@ -1,7 +1,7 @@ val test: Unit field = try { // BLOCK } - catch (...) { // BLOCK + catch (e: Throwable){ // BLOCK } get diff --git a/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.kt.txt b/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.kt.txt index 557f34ee614..5979d533669 100644 --- a/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.kt.txt @@ -13,7 +13,7 @@ fun box(): String { try { // BLOCK f() /*~> Unit */ } - catch (...) { // BLOCK + catch (e: Exception){ // BLOCK result = "OK" } diff --git a/compiler/testData/ir/irText/expressions/catchParameterAccess.kt.txt b/compiler/testData/ir/irText/expressions/catchParameterAccess.kt.txt index 6b8a18927e0..59bba22372c 100644 --- a/compiler/testData/ir/irText/expressions/catchParameterAccess.kt.txt +++ b/compiler/testData/ir/irText/expressions/catchParameterAccess.kt.txt @@ -2,7 +2,7 @@ fun test(f: Function0) { return try { // BLOCK f.invoke() } - catch (...) { // BLOCK + catch (e: Exception){ // BLOCK throw e } diff --git a/compiler/testData/ir/irText/expressions/tryCatch.kt.txt b/compiler/testData/ir/irText/expressions/tryCatch.kt.txt index 999a57277cc..f66eb6cccc3 100644 --- a/compiler/testData/ir/irText/expressions/tryCatch.kt.txt +++ b/compiler/testData/ir/irText/expressions/tryCatch.kt.txt @@ -2,7 +2,7 @@ fun test1() { try { // BLOCK println() } - catch (...) { // BLOCK + catch (e: Throwable){ // BLOCK println() } finally { // BLOCK @@ -15,7 +15,7 @@ fun test2(): Int { println() 42 } - catch (...) { // BLOCK + catch (e: Throwable){ // BLOCK println() 24 } diff --git a/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.kt.txt b/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.kt.txt index 9dd92f483db..23eba47d908 100644 --- a/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.kt.txt +++ b/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.kt.txt @@ -5,7 +5,7 @@ fun testImplicitCast(a: Any) { val t: String = try { // BLOCK a } /*as String */ - catch (...) { // BLOCK + catch (e: Throwable){ // BLOCK "" } From ad5df79e396516d6dbbc04da0fe0235e671cd236 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 10 Nov 2020 03:54:07 +0300 Subject: [PATCH 156/698] [IR] KotlinLikeDumper: merge Break & Continue --- .../jetbrains/kotlin/ir/util/KotlinLikeDumper.kt | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index cfb0956b43e..8d4ca4ee046 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -1194,23 +1194,15 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printlnWithNoIndent() } - private fun IrBreakContinue.printLabel() { - label?.let { + override fun visitBreakContinue(jump: IrBreakContinue, data: IrDeclaration?) { + // TODO render loop reference + p.printWithNoIndent(if (jump is IrContinue) "continue" else "break") + jump.label?.let { p.printWithNoIndent("@") p.printWithNoIndent(it) } } - override fun visitBreak(jump: IrBreak, data: IrDeclaration?) { - p.printWithNoIndent("break") - jump.printLabel() - } - - override fun visitContinue(jump: IrContinue, data: IrDeclaration?) { - p.printWithNoIndent("continue") - jump.printLabel() - } - override fun visitErrorDeclaration(declaration: IrErrorDeclaration, data: IrDeclaration?) { p.println("/* ERROR DECLARATION */") } From bf207205902cf775023e6c99d7597f22de1813cd Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 10 Nov 2020 03:55:41 +0300 Subject: [PATCH 157/698] [IR] KotlinLikeDumper: reformat --- .../src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index 8d4ca4ee046..8bf0c32f46a 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -300,7 +300,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption first = false } - when(it) { + when (it) { is IrStarProjection -> p.printWithNoIndent("*") is IrTypeProjection -> { @@ -974,7 +974,12 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption // TODO Use lambda syntax when possible // TODO don't print visibility? p.withholdIndentOnce() - expression.function.printSimpleFunction("fun ", expression.function.name.asString(), printTypeParametersAndExtensionReceiver = true, printSignatureAndBody = true) + expression.function.printSimpleFunction( + "fun ", + expression.function.name.asString(), + printTypeParametersAndExtensionReceiver = true, + printSignatureAndBody = true + ) } override fun visitGetField(expression: IrGetField, data: IrDeclaration?) { From a128cdc99c08c1cd022c566cfd2f123d940ea2ee Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 10 Nov 2020 03:56:01 +0300 Subject: [PATCH 158/698] [IR] KotlinLikeDumper: add more TODOs and remove some obsolete ones --- .../jetbrains/kotlin/ir/util/KotlinLikeDumper.kt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index 8bf0c32f46a..b983e9743c8 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -993,7 +993,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } private fun IrFieldAccessExpression.printFieldAccess(data: IrDeclaration?) { - // TODO type // TODO is not valid kotlin receiver?.accept(this@KotlinLikeDumper, data) superQualifierSymbol?.let { @@ -1012,6 +1011,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } override fun visitReturn(expression: IrReturn, data: IrDeclaration?) { + // TODO label p.printWithNoIndent("return ") expression.value.accept(this, data) } @@ -1022,7 +1022,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } override fun visitStringConcatenation(expression: IrStringConcatenation, data: IrDeclaration?) { - // TODO type // TODO escape? see IrTextTestCaseGenerated.Expressions#testStringTemplates // TODO optionally each argument at a separate line, another option add a wrapping expression.arguments.forEachIndexed { i, e -> @@ -1054,6 +1053,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption override fun visitVararg(expression: IrVararg, data: IrDeclaration?) { // TODO ??? + // TODO varargElementType p.printWithNoIndent("[") expression.elements.forEachIndexed { i, e -> if (i > 0) p.printWithNoIndent(", ") @@ -1068,6 +1068,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } override fun visitDeclarationReference(expression: IrDeclarationReference, data: IrDeclaration?) { + // TODO support super.visitDeclarationReference(expression, data) } @@ -1077,7 +1078,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } override fun visitGetValue(expression: IrGetValue, data: IrDeclaration?) { - // TODO support `this` and receiver p.printWithNoIndent(expression.symbol.owner.name.asString()) } @@ -1093,6 +1093,13 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption override fun visitCallableReference(expression: IrCallableReference<*>, data: IrDeclaration?) { // TODO check + /* + TODO + dispatchReceiver + extensionReceiver + getTypeArgument + getValueArgument + */ p.printWithNoIndent("::") p.printWithNoIndent(expression.referencedName.asString()) } @@ -1126,6 +1133,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } override fun visitWhen(expression: IrWhen, data: IrDeclaration?) { + // TODO print if when possible? p.printlnWithNoIndent("when {") p.pushIndent() From b129788823b456eedd45f67c8d9faa7f55641efc Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 10 Nov 2020 04:06:48 +0300 Subject: [PATCH 159/698] [IR] KotlinLikeDumper: minor updates for error nodes --- .../jetbrains/kotlin/ir/util/KotlinLikeDumper.kt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index b983e9743c8..9b43df06016 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -15,6 +15,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.types.Variance import org.jetbrains.kotlin.utils.Printer + // TODO look at // IrSourcePrinter.kt -- androidx-master-dev/frameworks/support/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/IrSourcePrinter.kt // DumpIrTree.kt -- compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DumpIrTree.kt @@ -1217,6 +1218,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } override fun visitErrorDeclaration(declaration: IrErrorDeclaration, data: IrDeclaration?) { + // TODO declaration.printlnAnnotations() p.println("/* ERROR DECLARATION */") } @@ -1226,8 +1228,17 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } override fun visitErrorCallExpression(expression: IrErrorCallExpression, data: IrDeclaration?) { - // TODO receiver, arguments + // TODO description + // TODO better rendering p.printWithNoIndent("error(\"\") /* ERROR CALL */") + expression.explicitReceiver?.let { + it.accept(this, data) + p.printWithNoIndent("; ") + } + expression.arguments.forEach { arg -> + arg.accept(this, data) + p.printWithNoIndent("; ") + } } private fun commentBlock(text: String) = "/* $text */" From 4fb762e019cbd78136cb376065c8275ef01d9366 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 10 Nov 2020 04:07:03 +0300 Subject: [PATCH 160/698] [IR] update testdata: minor updates for error nodes --- compiler/testData/ir/irText/errors/unresolvedReference.kt.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/testData/ir/irText/errors/unresolvedReference.kt.txt b/compiler/testData/ir/irText/errors/unresolvedReference.kt.txt index c72f3b8a302..f618965774b 100644 --- a/compiler/testData/ir/irText/errors/unresolvedReference.kt.txt +++ b/compiler/testData/ir/irText/errors/unresolvedReference.kt.txt @@ -7,7 +7,7 @@ val test2: ErrorType /* ERROR */ get val test3: ErrorType /* ERROR */ - field = error("") /* ERROR CALL */ + field = error("") /* ERROR CALL */42; 56; get val test4: ErrorType /* ERROR */ From 68b17fe55b0b9a69d7941622803a686ca1199ac8 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 10 Nov 2020 04:19:38 +0300 Subject: [PATCH 161/698] [IR] KotlinLikeDumper: add more visit* to implement --- .../kotlin/ir/util/KotlinLikeDumper.kt | 78 ++++++++++++++++++- 1 file changed, 77 insertions(+), 1 deletion(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index 9b43df06016..32d3e08bded 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -1073,6 +1073,13 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption super.visitDeclarationReference(expression, data) } + override fun visitRawFunctionReference(expression: IrRawFunctionReference, data: IrDeclaration?) { + // TODO support + // TODO no test + p.printWithNoIndent("&") + super.visitRawFunctionReference(expression, data) + } + override fun visitSingletonReference(expression: IrGetSingletonValue, data: IrDeclaration?) { // TODO check expression.type.printTypeWithNoIndent() @@ -1106,7 +1113,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } override fun visitClassReference(expression: IrClassReference, data: IrDeclaration?) { - // TODO use type + // TODO use classType p.printWithNoIndent((expression.symbol.owner as IrDeclarationWithName).name.asString()) p.printWithNoIndent("::class") } @@ -1217,6 +1224,21 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } } + override fun visitDynamicExpression(expression: IrDynamicExpression, data: IrDeclaration?) { + // TODO support + super.visitDynamicExpression(expression, data) + } + + override fun visitDynamicOperatorExpression(expression: IrDynamicOperatorExpression, data: IrDeclaration?) { + // TODO support + super.visitDynamicOperatorExpression(expression, data) + } + + override fun visitDynamicMemberExpression(expression: IrDynamicMemberExpression, data: IrDeclaration?) { + // TODO support + super.visitDynamicMemberExpression(expression, data) + } + override fun visitErrorDeclaration(declaration: IrErrorDeclaration, data: IrDeclaration?) { // TODO declaration.printlnAnnotations() p.println("/* ERROR DECLARATION */") @@ -1241,6 +1263,60 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } } + override fun visitExternalPackageFragment(declaration: IrExternalPackageFragment, data: IrDeclaration?) { + super.visitExternalPackageFragment(declaration, data) + } + + override fun visitScript(declaration: IrScript, data: IrDeclaration?) { + super.visitScript(declaration, data) + } + + override fun visitTypeParameter(declaration: IrTypeParameter, data: IrDeclaration?) { + super.visitTypeParameter(declaration, data) + } + + override fun visitValueParameter(declaration: IrValueParameter, data: IrDeclaration?) { + super.visitValueParameter(declaration, data) + } + + override fun visitSuspendableExpression(expression: IrSuspendableExpression, data: IrDeclaration?) { + super.visitSuspendableExpression(expression, data) + } + + override fun visitSuspensionPoint(expression: IrSuspensionPoint, data: IrDeclaration?) { + super.visitSuspensionPoint(expression, data) + } + + override fun visitGetObjectValue(expression: IrGetObjectValue, data: IrDeclaration?) { + // ??? + super.visitGetObjectValue(expression, data) + } + + override fun visitGetEnumValue(expression: IrGetEnumValue, data: IrDeclaration?) { + // ??? + super.visitGetEnumValue(expression, data) + } + + override fun visitFunctionReference(expression: IrFunctionReference, data: IrDeclaration?) { + super.visitFunctionReference(expression, data) + } + + override fun visitPropertyReference(expression: IrPropertyReference, data: IrDeclaration?) { + super.visitPropertyReference(expression, data) + } + + override fun visitLocalDelegatedPropertyReference(expression: IrLocalDelegatedPropertyReference, data: IrDeclaration?) { + super.visitLocalDelegatedPropertyReference(expression, data) + } + + override fun visitBranch(branch: IrBranch, data: IrDeclaration?) { + super.visitBranch(branch, data) + } + + override fun visitElseBranch(branch: IrElseBranch, data: IrDeclaration?) { + super.visitElseBranch(branch, data) + } + private fun commentBlock(text: String) = "/* $text */" private fun commentBlockH(text: String) = "/* $text */" From cdc74304c7ec88af2a3ceaa1159a8de34cbd1782 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 10 Nov 2020 15:50:58 +0300 Subject: [PATCH 162/698] [IR] add testdata for irJsText --- .../dynamic/dynamicAndMembersOfAny.kt.txt | 12 ++++ .../dynamic/dynamicArrayAccess.kt.txt | 15 +++++ .../dynamic/dynamicArrayAssignment.kt.txt | 10 ++++ .../dynamicArrayAugmentedAssignment.kt.txt | 13 +++++ .../dynamicArrayIncrementDecrement.kt.txt | 11 ++++ .../dynamicBinaryEqualityOperator.kt.txt | 20 +++++++ .../dynamicBinaryLogicalOperator.kt.txt | 10 ++++ .../dynamic/dynamicBinaryOperator.kt.txt | 25 +++++++++ .../dynamicBinaryRelationalOperator.kt.txt | 20 +++++++ .../ir/irJsText/dynamic/dynamicCall.kt.txt | 21 +++++++ .../dynamic/dynamicElvisOperator.kt.txt | 10 ++++ .../dynamic/dynamicExclExclOperator.kt.txt | 4 ++ .../irJsText/dynamic/dynamicInfixCall.kt.txt | 10 ++++ .../dynamic/dynamicMemberAccess.kt.txt | 16 ++++++ .../dynamic/dynamicMemberAssignment.kt.txt | 16 ++++++ .../dynamicMemberAugmentedAssignment.kt.txt | 56 +++++++++++++++++++ .../dynamicMemberIncrementDecrement.kt.txt | 46 +++++++++++++++ .../dynamic/dynamicUnaryOperator.kt.txt | 15 +++++ .../dynamic/dynamicWithSmartCast.kt.txt | 14 +++++ .../dynamic/implicitCastFromDynamic.kt.txt | 25 +++++++++ .../dynamic/implicitCastToDynamic.kt.txt | 42 ++++++++++++++ .../ir/irJsText/dynamic/invokeOperator.kt.txt | 37 ++++++++++++ .../ir/irJsText/external/kt38765.kt.txt | 37 ++++++++++++ .../irJsText/native/nativeNativeKotlin.kt.txt | 28 ++++++++++ .../irJsText/scripting/arrayAssignment.kt.txt | 1 + .../testData/ir/irJsText/scripting/fun.kt.txt | 1 + .../ir/irJsText/scripting/safeCalls.kt.txt | 1 + 27 files changed, 516 insertions(+) create mode 100644 compiler/testData/ir/irJsText/dynamic/dynamicAndMembersOfAny.kt.txt create mode 100644 compiler/testData/ir/irJsText/dynamic/dynamicArrayAccess.kt.txt create mode 100644 compiler/testData/ir/irJsText/dynamic/dynamicArrayAssignment.kt.txt create mode 100644 compiler/testData/ir/irJsText/dynamic/dynamicArrayAugmentedAssignment.kt.txt create mode 100644 compiler/testData/ir/irJsText/dynamic/dynamicArrayIncrementDecrement.kt.txt create mode 100644 compiler/testData/ir/irJsText/dynamic/dynamicBinaryEqualityOperator.kt.txt create mode 100644 compiler/testData/ir/irJsText/dynamic/dynamicBinaryLogicalOperator.kt.txt create mode 100644 compiler/testData/ir/irJsText/dynamic/dynamicBinaryOperator.kt.txt create mode 100644 compiler/testData/ir/irJsText/dynamic/dynamicBinaryRelationalOperator.kt.txt create mode 100644 compiler/testData/ir/irJsText/dynamic/dynamicCall.kt.txt create mode 100644 compiler/testData/ir/irJsText/dynamic/dynamicElvisOperator.kt.txt create mode 100644 compiler/testData/ir/irJsText/dynamic/dynamicExclExclOperator.kt.txt create mode 100644 compiler/testData/ir/irJsText/dynamic/dynamicInfixCall.kt.txt create mode 100644 compiler/testData/ir/irJsText/dynamic/dynamicMemberAccess.kt.txt create mode 100644 compiler/testData/ir/irJsText/dynamic/dynamicMemberAssignment.kt.txt create mode 100644 compiler/testData/ir/irJsText/dynamic/dynamicMemberAugmentedAssignment.kt.txt create mode 100644 compiler/testData/ir/irJsText/dynamic/dynamicMemberIncrementDecrement.kt.txt create mode 100644 compiler/testData/ir/irJsText/dynamic/dynamicUnaryOperator.kt.txt create mode 100644 compiler/testData/ir/irJsText/dynamic/dynamicWithSmartCast.kt.txt create mode 100644 compiler/testData/ir/irJsText/dynamic/implicitCastFromDynamic.kt.txt create mode 100644 compiler/testData/ir/irJsText/dynamic/implicitCastToDynamic.kt.txt create mode 100644 compiler/testData/ir/irJsText/dynamic/invokeOperator.kt.txt create mode 100644 compiler/testData/ir/irJsText/external/kt38765.kt.txt create mode 100644 compiler/testData/ir/irJsText/native/nativeNativeKotlin.kt.txt create mode 100644 compiler/testData/ir/irJsText/scripting/arrayAssignment.kt.txt create mode 100644 compiler/testData/ir/irJsText/scripting/fun.kt.txt create mode 100644 compiler/testData/ir/irJsText/scripting/safeCalls.kt.txt diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicAndMembersOfAny.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicAndMembersOfAny.kt.txt new file mode 100644 index 00000000000..3c4a6ed5876 --- /dev/null +++ b/compiler/testData/ir/irJsText/dynamic/dynamicAndMembersOfAny.kt.txt @@ -0,0 +1,12 @@ +fun test1(d: dynamic): String { + return d /*~> Any */.toString() +} + +fun test2(d: dynamic): Int { + return d /*~> Any */.hashCode() +} + +fun test3(d: dynamic): Boolean { + return d /*~> Any */.equals(other = 42) +} + diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicArrayAccess.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicArrayAccess.kt.txt new file mode 100644 index 00000000000..83d22993e48 --- /dev/null +++ b/compiler/testData/ir/irJsText/dynamic/dynamicArrayAccess.kt.txt @@ -0,0 +1,15 @@ +fun testArrayAccess1(d: dynamic): dynamic { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun testArrayAccess2(d: dynamic): dynamic { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun testArrayAccess3(d: dynamic): dynamic { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicArrayAssignment.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicArrayAssignment.kt.txt new file mode 100644 index 00000000000..ef9dbb7c795 --- /dev/null +++ b/compiler/testData/ir/irJsText/dynamic/dynamicArrayAssignment.kt.txt @@ -0,0 +1,10 @@ +fun testArrayAssignment(d: dynamic) { + error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun testArrayAssignmentFake(d: dynamic) { + error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicArrayAugmentedAssignment.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicArrayAugmentedAssignment.kt.txt new file mode 100644 index 00000000000..5a15a128130 --- /dev/null +++ b/compiler/testData/ir/irJsText/dynamic/dynamicArrayAugmentedAssignment.kt.txt @@ -0,0 +1,13 @@ +fun testArrayAugmentedAssignment(d: dynamic) { + error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + + error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + + error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + + error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + + error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicArrayIncrementDecrement.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicArrayIncrementDecrement.kt.txt new file mode 100644 index 00000000000..30237b4f279 --- /dev/null +++ b/compiler/testData/ir/irJsText/dynamic/dynamicArrayIncrementDecrement.kt.txt @@ -0,0 +1,11 @@ +fun testArrayIncrementDecrement(d: dynamic) { + val t1: dynamic = error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + + val t2: dynamic = error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + + val t3: dynamic = error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + + val t4: dynamic = error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicBinaryEqualityOperator.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicBinaryEqualityOperator.kt.txt new file mode 100644 index 00000000000..3c8a61dcb7b --- /dev/null +++ b/compiler/testData/ir/irJsText/dynamic/dynamicBinaryEqualityOperator.kt.txt @@ -0,0 +1,20 @@ +fun testEqeq(d: dynamic): Boolean { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun testExclEq(d: dynamic): Boolean { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun testEqeqeq(d: dynamic): Boolean { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun testExclEqeq(d: dynamic): Boolean { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicBinaryLogicalOperator.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicBinaryLogicalOperator.kt.txt new file mode 100644 index 00000000000..6bec0a27226 --- /dev/null +++ b/compiler/testData/ir/irJsText/dynamic/dynamicBinaryLogicalOperator.kt.txt @@ -0,0 +1,10 @@ +fun testAndAnd(d: dynamic): Boolean { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun testOrOr(d: dynamic): Boolean { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicBinaryOperator.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicBinaryOperator.kt.txt new file mode 100644 index 00000000000..4b824741a9b --- /dev/null +++ b/compiler/testData/ir/irJsText/dynamic/dynamicBinaryOperator.kt.txt @@ -0,0 +1,25 @@ +fun testBinaryPlus(d: dynamic): dynamic { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun testBinaryMinus(d: dynamic): dynamic { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun testMul(d: dynamic): dynamic { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun testDiv(d: dynamic): dynamic { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun testMod(d: dynamic): dynamic { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicBinaryRelationalOperator.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicBinaryRelationalOperator.kt.txt new file mode 100644 index 00000000000..5b338fd196a --- /dev/null +++ b/compiler/testData/ir/irJsText/dynamic/dynamicBinaryRelationalOperator.kt.txt @@ -0,0 +1,20 @@ +fun testLess(d: dynamic): Boolean { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun testLessOrEqual(d: dynamic): Boolean { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun testGreater(d: dynamic): Boolean { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun testGreaterOrEqual(d: dynamic): Boolean { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicCall.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicCall.kt.txt new file mode 100644 index 00000000000..fba47c8579f --- /dev/null +++ b/compiler/testData/ir/irJsText/dynamic/dynamicCall.kt.txt @@ -0,0 +1,21 @@ +fun test1(d: dynamic): dynamic { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun test2(d: dynamic): dynamic { + return { // BLOCK + val tmp0_safe_receiver: dynamic = d + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + + } + } +} + +fun test3(d: dynamic): dynamic { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicElvisOperator.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicElvisOperator.kt.txt new file mode 100644 index 00000000000..9be59ac622e --- /dev/null +++ b/compiler/testData/ir/irJsText/dynamic/dynamicElvisOperator.kt.txt @@ -0,0 +1,10 @@ +fun test(d: dynamic): dynamic { + return { // BLOCK + val tmp0_elvis_lhs: dynamic = d + when { + EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> "other" + true -> tmp0_elvis_lhs + } + } +} + diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicExclExclOperator.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicExclExclOperator.kt.txt new file mode 100644 index 00000000000..07531bfeec8 --- /dev/null +++ b/compiler/testData/ir/irJsText/dynamic/dynamicExclExclOperator.kt.txt @@ -0,0 +1,4 @@ +fun test(d: dynamic): dynamic { + return CHECK_NOT_NULL(arg0 = d) +} + diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicInfixCall.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicInfixCall.kt.txt new file mode 100644 index 00000000000..4da39341115 --- /dev/null +++ b/compiler/testData/ir/irJsText/dynamic/dynamicInfixCall.kt.txt @@ -0,0 +1,10 @@ +fun test1(d: dynamic): dynamic { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun test2(d: dynamic): dynamic { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicMemberAccess.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicMemberAccess.kt.txt new file mode 100644 index 00000000000..75ac901be06 --- /dev/null +++ b/compiler/testData/ir/irJsText/dynamic/dynamicMemberAccess.kt.txt @@ -0,0 +1,16 @@ +fun test1(d: dynamic): dynamic { + return error("") /* ERROR: unsupported element type: IrDynamicMemberExpressionImpl */ + +} + +fun test2(d: dynamic): dynamic { + return { // BLOCK + val tmp0_safe_receiver: dynamic = d + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> error("") /* ERROR: unsupported element type: IrDynamicMemberExpressionImpl */ + + } + } +} + diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicMemberAssignment.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicMemberAssignment.kt.txt new file mode 100644 index 00000000000..f2c842dd4b2 --- /dev/null +++ b/compiler/testData/ir/irJsText/dynamic/dynamicMemberAssignment.kt.txt @@ -0,0 +1,16 @@ +fun testMemberAssignment(d: dynamic) { + error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun testSafeMemberAssignment(d: dynamic) { + { // BLOCK + val tmp0_safe_receiver: dynamic = d + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null /*~> Unit */ + true -> error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + + } + } +} + diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicMemberAugmentedAssignment.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicMemberAugmentedAssignment.kt.txt new file mode 100644 index 00000000000..dfb1d73067c --- /dev/null +++ b/compiler/testData/ir/irJsText/dynamic/dynamicMemberAugmentedAssignment.kt.txt @@ -0,0 +1,56 @@ +fun testAugmentedMemberAssignment(d: dynamic) { + error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + + error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + + error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + + error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + + error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun testSafeAugmentedMemberAssignment(d: dynamic) { + { // BLOCK + val tmp0_safe_receiver: dynamic = d + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null /*~> Unit */ + true -> error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + + } + } + { // BLOCK + val tmp1_safe_receiver: dynamic = d + when { + EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null /*~> Unit */ + true -> error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + + } + } + { // BLOCK + val tmp2_safe_receiver: dynamic = d + when { + EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null /*~> Unit */ + true -> error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + + } + } + { // BLOCK + val tmp3_safe_receiver: dynamic = d + when { + EQEQ(arg0 = tmp3_safe_receiver, arg1 = null) -> null /*~> Unit */ + true -> error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + + } + } + { // BLOCK + val tmp4_safe_receiver: dynamic = d + when { + EQEQ(arg0 = tmp4_safe_receiver, arg1 = null) -> null /*~> Unit */ + true -> error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + + } + } +} + diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicMemberIncrementDecrement.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicMemberIncrementDecrement.kt.txt new file mode 100644 index 00000000000..0c46c1b89dc --- /dev/null +++ b/compiler/testData/ir/irJsText/dynamic/dynamicMemberIncrementDecrement.kt.txt @@ -0,0 +1,46 @@ +fun testMemberIncrementDecrement(d: dynamic) { + val t1: dynamic = error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + + val t2: dynamic = error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + + val t3: dynamic = error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + + val t4: dynamic = error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun testSafeMemberIncrementDecrement(d: dynamic) { + val t1: dynamic = { // BLOCK + val tmp0_safe_receiver: dynamic = d + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + true -> error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + + } + } + val t2: dynamic = { // BLOCK + val tmp1_safe_receiver: dynamic = d + when { + EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null + true -> error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + + } + } + val t3: dynamic = { // BLOCK + val tmp2_safe_receiver: dynamic = d + when { + EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null + true -> error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + + } + } + val t4: dynamic = { // BLOCK + val tmp3_safe_receiver: dynamic = d + when { + EQEQ(arg0 = tmp3_safe_receiver, arg1 = null) -> null + true -> error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + + } + } +} + diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicUnaryOperator.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicUnaryOperator.kt.txt new file mode 100644 index 00000000000..24ec92f5615 --- /dev/null +++ b/compiler/testData/ir/irJsText/dynamic/dynamicUnaryOperator.kt.txt @@ -0,0 +1,15 @@ +fun testUnaryMinus(d: dynamic): dynamic { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun testUnaryPlus(d: dynamic): dynamic { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun testExcl(d: dynamic): dynamic { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicWithSmartCast.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicWithSmartCast.kt.txt new file mode 100644 index 00000000000..c815813af50 --- /dev/null +++ b/compiler/testData/ir/irJsText/dynamic/dynamicWithSmartCast.kt.txt @@ -0,0 +1,14 @@ +fun test1(d: dynamic): Int { + return when { + d is String -> d /*~> String */.() + true -> -1 + } +} + +fun test2(d: dynamic): Int { + return when { + d is Array<*> -> d /*~> Array */.() + true -> -1 + } +} + diff --git a/compiler/testData/ir/irJsText/dynamic/implicitCastFromDynamic.kt.txt b/compiler/testData/ir/irJsText/dynamic/implicitCastFromDynamic.kt.txt new file mode 100644 index 00000000000..716d7da407d --- /dev/null +++ b/compiler/testData/ir/irJsText/dynamic/implicitCastFromDynamic.kt.txt @@ -0,0 +1,25 @@ +val d: dynamic + field = 1 + get + +val p: Int + field = () /*~> Int */ + get + +fun test1(d: dynamic): Int { + return d /*~> Int */ +} + +fun test2(d: dynamic): Any { + return d /*~> Any */ +} + +fun test3(d: dynamic): Any? { + return d +} + +fun test4(d: dynamic): String { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + /*~> String */ +} + diff --git a/compiler/testData/ir/irJsText/dynamic/implicitCastToDynamic.kt.txt b/compiler/testData/ir/irJsText/dynamic/implicitCastToDynamic.kt.txt new file mode 100644 index 00000000000..1a0c49f7640 --- /dev/null +++ b/compiler/testData/ir/irJsText/dynamic/implicitCastToDynamic.kt.txt @@ -0,0 +1,42 @@ +val d1: dynamic + field = 1 + get + +val p: Int + field = 1 + get + +var d2: dynamic + field = () + get + set + +fun withDynamic(d: dynamic): dynamic { + return d +} + +fun test1(s: String) { + withDynamic(d = s) +} + +fun test2(a: Any) { + val d: dynamic = a +} + +fun test3(a: Any?) { + val d: dynamic = a +} + +fun test4(a: Any, s: String, na: Any?) { + var d: dynamic = () + d = a + d = na + d = s +} + +fun test5(a: Any, s: String, na: Any?) { + ( = a) + ( = na) + ( = s) +} + diff --git a/compiler/testData/ir/irJsText/dynamic/invokeOperator.kt.txt b/compiler/testData/ir/irJsText/dynamic/invokeOperator.kt.txt new file mode 100644 index 00000000000..191b3b23437 --- /dev/null +++ b/compiler/testData/ir/irJsText/dynamic/invokeOperator.kt.txt @@ -0,0 +1,37 @@ +fun invoke() { +} + +fun test1(a: dynamic): dynamic { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun test2(a: dynamic): dynamic { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun test3(a: dynamic, b: dynamic): dynamic { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun test4(a: dynamic, b: dynamic): dynamic { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun test5(a: dynamic, b: dynamic): dynamic { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun test6(a: dynamic, b: dynamic): dynamic { + return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ + +} + +fun test7(a: dynamic) { + return invoke() +} + diff --git a/compiler/testData/ir/irJsText/external/kt38765.kt.txt b/compiler/testData/ir/irJsText/external/kt38765.kt.txt new file mode 100644 index 00000000000..8546539e363 --- /dev/null +++ b/compiler/testData/ir/irJsText/external/kt38765.kt.txt @@ -0,0 +1,37 @@ +package events + +open external class internal { + external constructor() /* primary */ + open external class EventEmitterP : internal { + external constructor() /* primary */ + + } + + open external class EventEmitterS : internal { + external constructor(a: Any) + + } + + external object NestedExternalObject : internal { + private external constructor() /* primary */ + + } + + external enum class NestedExternalEnum : Enum { + private external constructor() /* primary */ + A = NestedExternalEnum() + + B = NestedExternalEnum() + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): NestedExternalEnum /* Synthetic body for ENUM_VALUEOF */ + + } + + external interface NestedExternalInterface { + + } + +} + diff --git a/compiler/testData/ir/irJsText/native/nativeNativeKotlin.kt.txt b/compiler/testData/ir/irJsText/native/nativeNativeKotlin.kt.txt new file mode 100644 index 00000000000..291105d07d4 --- /dev/null +++ b/compiler/testData/ir/irJsText/native/nativeNativeKotlin.kt.txt @@ -0,0 +1,28 @@ +package foo + +open external class A { + external constructor() /* primary */ + fun foo(): String + +} + +open external class B : A { + external constructor() /* primary */ + fun bar(): String + +} + +class C : B { + constructor() /* primary */ { + super/*B*/() + /* () */ + + } + +} + +fun box(): String { + val c: C = C() + return "OK" +} + diff --git a/compiler/testData/ir/irJsText/scripting/arrayAssignment.kt.txt b/compiler/testData/ir/irJsText/scripting/arrayAssignment.kt.txt new file mode 100644 index 00000000000..fc8509d5628 --- /dev/null +++ b/compiler/testData/ir/irJsText/scripting/arrayAssignment.kt.txt @@ -0,0 +1 @@ +/* ERROR: unsupported element type: IrScriptImpl */ diff --git a/compiler/testData/ir/irJsText/scripting/fun.kt.txt b/compiler/testData/ir/irJsText/scripting/fun.kt.txt new file mode 100644 index 00000000000..fc8509d5628 --- /dev/null +++ b/compiler/testData/ir/irJsText/scripting/fun.kt.txt @@ -0,0 +1 @@ +/* ERROR: unsupported element type: IrScriptImpl */ diff --git a/compiler/testData/ir/irJsText/scripting/safeCalls.kt.txt b/compiler/testData/ir/irJsText/scripting/safeCalls.kt.txt new file mode 100644 index 00000000000..fc8509d5628 --- /dev/null +++ b/compiler/testData/ir/irJsText/scripting/safeCalls.kt.txt @@ -0,0 +1 @@ +/* ERROR: unsupported element type: IrScriptImpl */ From 82839e6a671193a52e575bb4fb14876b0f9b2e59 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 10 Nov 2020 19:12:02 +0300 Subject: [PATCH 163/698] [IR] KotlinLikeDumper: support IrDynamic* nodes --- .../kotlin/ir/util/KotlinLikeDumper.kt | 44 +++++++++++++++---- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index 32d3e08bded..6b4a5953f33 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -1224,19 +1224,45 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } } - override fun visitDynamicExpression(expression: IrDynamicExpression, data: IrDeclaration?) { - // TODO support - super.visitDynamicExpression(expression, data) - } - override fun visitDynamicOperatorExpression(expression: IrDynamicOperatorExpression, data: IrDeclaration?) { - // TODO support - super.visitDynamicOperatorExpression(expression, data) + // TODO marker to show that it's dynamic call + val s = when (val op = expression.operator) { + IrDynamicOperator.ARRAY_ACCESS -> "[" to "]" + IrDynamicOperator.INVOKE -> "(" to ")" + + // assert that arguments size is 0 + IrDynamicOperator.UNARY_PLUS, + IrDynamicOperator.UNARY_MINUS, + IrDynamicOperator.EXCL, + IrDynamicOperator.PREFIX_INCREMENT, + IrDynamicOperator.PREFIX_DECREMENT -> { + p.printWithNoIndent(op.image) + "" to "" + } + + // assert that arguments size is 0 + IrDynamicOperator.POSTFIX_INCREMENT, + IrDynamicOperator.POSTFIX_DECREMENT -> { + op.image to "" + } + + // assert that arguments size is 1 + else -> " ${op.image} " to "" + } + + expression.receiver.accept(this, data) + p.printWithNoIndent(s.first) + expression.arguments.forEachIndexed { i, e -> + if (i > 0) p.printWithNoIndent(", ") + e.accept(this, data) + } + p.printWithNoIndent(s.second) } override fun visitDynamicMemberExpression(expression: IrDynamicMemberExpression, data: IrDeclaration?) { - // TODO support - super.visitDynamicMemberExpression(expression, data) + expression.receiver.accept(this, data) + p.printWithNoIndent(".") + p.printWithNoIndent(expression.memberName) } override fun visitErrorDeclaration(declaration: IrErrorDeclaration, data: IrDeclaration?) { From 635cb44bf37efac9b977d6fec9547f8c35aca9e1 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 10 Nov 2020 19:10:49 +0300 Subject: [PATCH 164/698] [IR] update testdata: support IrDynamic* nodes --- .../dynamic/dynamicArrayAccess.kt.txt | 9 ++---- .../dynamic/dynamicArrayAssignment.kt.txt | 6 ++-- .../dynamicArrayAugmentedAssignment.kt.txt | 15 ++++------ .../dynamicArrayIncrementDecrement.kt.txt | 12 +++----- .../dynamicBinaryEqualityOperator.kt.txt | 12 +++----- .../dynamicBinaryLogicalOperator.kt.txt | 6 ++-- .../dynamic/dynamicBinaryOperator.kt.txt | 15 ++++------ .../dynamicBinaryRelationalOperator.kt.txt | 12 +++----- .../ir/irJsText/dynamic/dynamicCall.kt.txt | 9 ++---- .../irJsText/dynamic/dynamicInfixCall.kt.txt | 6 ++-- .../dynamic/dynamicMemberAccess.kt.txt | 6 ++-- .../dynamic/dynamicMemberAssignment.kt.txt | 6 ++-- .../dynamicMemberAugmentedAssignment.kt.txt | 30 +++++++------------ .../dynamicMemberIncrementDecrement.kt.txt | 24 +++++---------- .../dynamic/dynamicUnaryOperator.kt.txt | 9 ++---- .../dynamic/implicitCastFromDynamic.kt.txt | 3 +- .../ir/irJsText/dynamic/invokeOperator.kt.txt | 18 ++++------- 17 files changed, 66 insertions(+), 132 deletions(-) diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicArrayAccess.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicArrayAccess.kt.txt index 83d22993e48..d1a6db4830c 100644 --- a/compiler/testData/ir/irJsText/dynamic/dynamicArrayAccess.kt.txt +++ b/compiler/testData/ir/irJsText/dynamic/dynamicArrayAccess.kt.txt @@ -1,15 +1,12 @@ fun testArrayAccess1(d: dynamic): dynamic { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return d["KEY"] } fun testArrayAccess2(d: dynamic): dynamic { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return d()["KEY"] } fun testArrayAccess3(d: dynamic): dynamic { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return d.get("KEY") } diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicArrayAssignment.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicArrayAssignment.kt.txt index ef9dbb7c795..acabdfa38a1 100644 --- a/compiler/testData/ir/irJsText/dynamic/dynamicArrayAssignment.kt.txt +++ b/compiler/testData/ir/irJsText/dynamic/dynamicArrayAssignment.kt.txt @@ -1,10 +1,8 @@ fun testArrayAssignment(d: dynamic) { - error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + d["KEY"] = 1 } fun testArrayAssignmentFake(d: dynamic) { - error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + d.set("KEY", 2) } diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicArrayAugmentedAssignment.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicArrayAugmentedAssignment.kt.txt index 5a15a128130..54e993c95c3 100644 --- a/compiler/testData/ir/irJsText/dynamic/dynamicArrayAugmentedAssignment.kt.txt +++ b/compiler/testData/ir/irJsText/dynamic/dynamicArrayAugmentedAssignment.kt.txt @@ -1,13 +1,8 @@ fun testArrayAugmentedAssignment(d: dynamic) { - error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - - error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - - error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - - error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - - error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + d["KEY"] += "+=" + d["KEY"] -= "-=" + d["KEY"] *= "*=" + d["KEY"] /= "/=" + d["KEY"] %= "%=" } diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicArrayIncrementDecrement.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicArrayIncrementDecrement.kt.txt index 30237b4f279..832586c406c 100644 --- a/compiler/testData/ir/irJsText/dynamic/dynamicArrayIncrementDecrement.kt.txt +++ b/compiler/testData/ir/irJsText/dynamic/dynamicArrayIncrementDecrement.kt.txt @@ -1,11 +1,7 @@ fun testArrayIncrementDecrement(d: dynamic) { - val t1: dynamic = error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - - val t2: dynamic = error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - - val t3: dynamic = error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - - val t4: dynamic = error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + val t1: dynamic = ++d["prefixIncr"] + val t2: dynamic = --d["prefixDecr"] + val t3: dynamic = d["postfixIncr"]++ + val t4: dynamic = d["postfixDecr"]-- } diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicBinaryEqualityOperator.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicBinaryEqualityOperator.kt.txt index 3c8a61dcb7b..cfec12a5b0b 100644 --- a/compiler/testData/ir/irJsText/dynamic/dynamicBinaryEqualityOperator.kt.txt +++ b/compiler/testData/ir/irJsText/dynamic/dynamicBinaryEqualityOperator.kt.txt @@ -1,20 +1,16 @@ fun testEqeq(d: dynamic): Boolean { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return d == 3 } fun testExclEq(d: dynamic): Boolean { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return d != 3 } fun testEqeqeq(d: dynamic): Boolean { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return d === 3 } fun testExclEqeq(d: dynamic): Boolean { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return d !== 3 } diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicBinaryLogicalOperator.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicBinaryLogicalOperator.kt.txt index 6bec0a27226..bb41eb23fd6 100644 --- a/compiler/testData/ir/irJsText/dynamic/dynamicBinaryLogicalOperator.kt.txt +++ b/compiler/testData/ir/irJsText/dynamic/dynamicBinaryLogicalOperator.kt.txt @@ -1,10 +1,8 @@ fun testAndAnd(d: dynamic): Boolean { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return d && d } fun testOrOr(d: dynamic): Boolean { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return d || d } diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicBinaryOperator.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicBinaryOperator.kt.txt index 4b824741a9b..a401a3f656a 100644 --- a/compiler/testData/ir/irJsText/dynamic/dynamicBinaryOperator.kt.txt +++ b/compiler/testData/ir/irJsText/dynamic/dynamicBinaryOperator.kt.txt @@ -1,25 +1,20 @@ fun testBinaryPlus(d: dynamic): dynamic { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return d + 1 } fun testBinaryMinus(d: dynamic): dynamic { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return d - 1 } fun testMul(d: dynamic): dynamic { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return d * 2 } fun testDiv(d: dynamic): dynamic { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return d / 2 } fun testMod(d: dynamic): dynamic { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return d % 2 } diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicBinaryRelationalOperator.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicBinaryRelationalOperator.kt.txt index 5b338fd196a..ae79535199e 100644 --- a/compiler/testData/ir/irJsText/dynamic/dynamicBinaryRelationalOperator.kt.txt +++ b/compiler/testData/ir/irJsText/dynamic/dynamicBinaryRelationalOperator.kt.txt @@ -1,20 +1,16 @@ fun testLess(d: dynamic): Boolean { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return d < 2 } fun testLessOrEqual(d: dynamic): Boolean { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return d <= 2 } fun testGreater(d: dynamic): Boolean { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return d > 2 } fun testGreaterOrEqual(d: dynamic): Boolean { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return d >= 2 } diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicCall.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicCall.kt.txt index fba47c8579f..af23e17284b 100644 --- a/compiler/testData/ir/irJsText/dynamic/dynamicCall.kt.txt +++ b/compiler/testData/ir/irJsText/dynamic/dynamicCall.kt.txt @@ -1,6 +1,5 @@ fun test1(d: dynamic): dynamic { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return d.member(1, 2, 3) } fun test2(d: dynamic): dynamic { @@ -8,14 +7,12 @@ fun test2(d: dynamic): dynamic { val tmp0_safe_receiver: dynamic = d when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + true -> tmp0_safe_receiver.member(1, 2, 3) } } } fun test3(d: dynamic): dynamic { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return d.member(1, 2, 3) } diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicInfixCall.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicInfixCall.kt.txt index 4da39341115..85730ce2f90 100644 --- a/compiler/testData/ir/irJsText/dynamic/dynamicInfixCall.kt.txt +++ b/compiler/testData/ir/irJsText/dynamic/dynamicInfixCall.kt.txt @@ -1,10 +1,8 @@ fun test1(d: dynamic): dynamic { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return d.foo(123) } fun test2(d: dynamic): dynamic { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return d.invoke(123) } diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicMemberAccess.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicMemberAccess.kt.txt index 75ac901be06..eb76f1c02b9 100644 --- a/compiler/testData/ir/irJsText/dynamic/dynamicMemberAccess.kt.txt +++ b/compiler/testData/ir/irJsText/dynamic/dynamicMemberAccess.kt.txt @@ -1,6 +1,5 @@ fun test1(d: dynamic): dynamic { - return error("") /* ERROR: unsupported element type: IrDynamicMemberExpressionImpl */ - + return d.member } fun test2(d: dynamic): dynamic { @@ -8,8 +7,7 @@ fun test2(d: dynamic): dynamic { val tmp0_safe_receiver: dynamic = d when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> error("") /* ERROR: unsupported element type: IrDynamicMemberExpressionImpl */ - + true -> tmp0_safe_receiver.member } } } diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicMemberAssignment.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicMemberAssignment.kt.txt index f2c842dd4b2..ff938434c56 100644 --- a/compiler/testData/ir/irJsText/dynamic/dynamicMemberAssignment.kt.txt +++ b/compiler/testData/ir/irJsText/dynamic/dynamicMemberAssignment.kt.txt @@ -1,6 +1,5 @@ fun testMemberAssignment(d: dynamic) { - error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + d.m = 1 } fun testSafeMemberAssignment(d: dynamic) { @@ -8,8 +7,7 @@ fun testSafeMemberAssignment(d: dynamic) { val tmp0_safe_receiver: dynamic = d when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null /*~> Unit */ - true -> error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + true -> tmp0_safe_receiver.m = 1 } } } diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicMemberAugmentedAssignment.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicMemberAugmentedAssignment.kt.txt index dfb1d73067c..cc8293f48f6 100644 --- a/compiler/testData/ir/irJsText/dynamic/dynamicMemberAugmentedAssignment.kt.txt +++ b/compiler/testData/ir/irJsText/dynamic/dynamicMemberAugmentedAssignment.kt.txt @@ -1,14 +1,9 @@ fun testAugmentedMemberAssignment(d: dynamic) { - error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - - error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - - error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - - error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - - error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + d.m += "+=" + d.m -= "-=" + d.m *= "*=" + d.m /= "/=" + d.m %= "%=" } fun testSafeAugmentedMemberAssignment(d: dynamic) { @@ -16,40 +11,35 @@ fun testSafeAugmentedMemberAssignment(d: dynamic) { val tmp0_safe_receiver: dynamic = d when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null /*~> Unit */ - true -> error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + true -> tmp0_safe_receiver.m += "+=" } } { // BLOCK val tmp1_safe_receiver: dynamic = d when { EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null /*~> Unit */ - true -> error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + true -> tmp1_safe_receiver.m -= "-=" } } { // BLOCK val tmp2_safe_receiver: dynamic = d when { EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null /*~> Unit */ - true -> error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + true -> tmp2_safe_receiver.m *= "*=" } } { // BLOCK val tmp3_safe_receiver: dynamic = d when { EQEQ(arg0 = tmp3_safe_receiver, arg1 = null) -> null /*~> Unit */ - true -> error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + true -> tmp3_safe_receiver.m /= "/=" } } { // BLOCK val tmp4_safe_receiver: dynamic = d when { EQEQ(arg0 = tmp4_safe_receiver, arg1 = null) -> null /*~> Unit */ - true -> error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + true -> tmp4_safe_receiver.m %= "%=" } } } diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicMemberIncrementDecrement.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicMemberIncrementDecrement.kt.txt index 0c46c1b89dc..886013fdecd 100644 --- a/compiler/testData/ir/irJsText/dynamic/dynamicMemberIncrementDecrement.kt.txt +++ b/compiler/testData/ir/irJsText/dynamic/dynamicMemberIncrementDecrement.kt.txt @@ -1,12 +1,8 @@ fun testMemberIncrementDecrement(d: dynamic) { - val t1: dynamic = error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - - val t2: dynamic = error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - - val t3: dynamic = error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - - val t4: dynamic = error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + val t1: dynamic = ++d.prefixIncr + val t2: dynamic = --d.prefixDecr + val t3: dynamic = d.postfixIncr++ + val t4: dynamic = d.postfixDecr-- } fun testSafeMemberIncrementDecrement(d: dynamic) { @@ -14,32 +10,28 @@ fun testSafeMemberIncrementDecrement(d: dynamic) { val tmp0_safe_receiver: dynamic = d when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + true -> ++tmp0_safe_receiver.prefixIncr } } val t2: dynamic = { // BLOCK val tmp1_safe_receiver: dynamic = d when { EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null - true -> error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + true -> --tmp1_safe_receiver.prefixDecr } } val t3: dynamic = { // BLOCK val tmp2_safe_receiver: dynamic = d when { EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null - true -> error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + true -> tmp2_safe_receiver.postfixIncr++ } } val t4: dynamic = { // BLOCK val tmp3_safe_receiver: dynamic = d when { EQEQ(arg0 = tmp3_safe_receiver, arg1 = null) -> null - true -> error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + true -> tmp3_safe_receiver.postfixDecr-- } } } diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicUnaryOperator.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicUnaryOperator.kt.txt index 24ec92f5615..9e62fa8c1d9 100644 --- a/compiler/testData/ir/irJsText/dynamic/dynamicUnaryOperator.kt.txt +++ b/compiler/testData/ir/irJsText/dynamic/dynamicUnaryOperator.kt.txt @@ -1,15 +1,12 @@ fun testUnaryMinus(d: dynamic): dynamic { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return -d } fun testUnaryPlus(d: dynamic): dynamic { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return +d } fun testExcl(d: dynamic): dynamic { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return !d } diff --git a/compiler/testData/ir/irJsText/dynamic/implicitCastFromDynamic.kt.txt b/compiler/testData/ir/irJsText/dynamic/implicitCastFromDynamic.kt.txt index 716d7da407d..2b176d650ef 100644 --- a/compiler/testData/ir/irJsText/dynamic/implicitCastFromDynamic.kt.txt +++ b/compiler/testData/ir/irJsText/dynamic/implicitCastFromDynamic.kt.txt @@ -19,7 +19,6 @@ fun test3(d: dynamic): Any? { } fun test4(d: dynamic): String { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - /*~> String */ + return d.member(1, 2, 3) /*~> String */ } diff --git a/compiler/testData/ir/irJsText/dynamic/invokeOperator.kt.txt b/compiler/testData/ir/irJsText/dynamic/invokeOperator.kt.txt index 191b3b23437..13b46d8c8cc 100644 --- a/compiler/testData/ir/irJsText/dynamic/invokeOperator.kt.txt +++ b/compiler/testData/ir/irJsText/dynamic/invokeOperator.kt.txt @@ -2,33 +2,27 @@ fun invoke() { } fun test1(a: dynamic): dynamic { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return a(1) } fun test2(a: dynamic): dynamic { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return a.invoke(1) } fun test3(a: dynamic, b: dynamic): dynamic { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return a(b) } fun test4(a: dynamic, b: dynamic): dynamic { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return a.invoke(b) } fun test5(a: dynamic, b: dynamic): dynamic { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return a(b)(b) } fun test6(a: dynamic, b: dynamic): dynamic { - return error("") /* ERROR: unsupported element type: IrDynamicOperatorExpressionImpl */ - + return a(b).invoke(b) } fun test7(a: dynamic) { From 1fd12b7b8a268a08436bdab5f14dafa2b5495ce1 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 10 Nov 2020 19:54:27 +0300 Subject: [PATCH 165/698] [IR] KotlinLikeDumper: better support for enum and object accesses --- .../kotlin/ir/util/KotlinLikeDumper.kt | 28 +++++++------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index 6b4a5953f33..344421edf98 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -1068,9 +1068,16 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption spread.expression.accept(this, data) } - override fun visitDeclarationReference(expression: IrDeclarationReference, data: IrDeclaration?) { - // TODO support - super.visitDeclarationReference(expression, data) + override fun visitGetObjectValue(expression: IrGetObjectValue, data: IrDeclaration?) { + // TODO what if symbol is unbound? + expression.symbol.defaultType.printTypeWithNoIndent() + } + + override fun visitGetEnumValue(expression: IrGetEnumValue, data: IrDeclaration?) { + val enumEntry = expression.symbol.owner + p.printWithNoIndent(enumEntry.parentAsClass.name.asString()) + p.printWithNoIndent(".") + p.printWithNoIndent(enumEntry.name.asString()) } override fun visitRawFunctionReference(expression: IrRawFunctionReference, data: IrDeclaration?) { @@ -1080,11 +1087,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption super.visitRawFunctionReference(expression, data) } - override fun visitSingletonReference(expression: IrGetSingletonValue, data: IrDeclaration?) { - // TODO check - expression.type.printTypeWithNoIndent() - } - override fun visitGetValue(expression: IrGetValue, data: IrDeclaration?) { p.printWithNoIndent(expression.symbol.owner.name.asString()) } @@ -1313,16 +1315,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption super.visitSuspensionPoint(expression, data) } - override fun visitGetObjectValue(expression: IrGetObjectValue, data: IrDeclaration?) { - // ??? - super.visitGetObjectValue(expression, data) - } - - override fun visitGetEnumValue(expression: IrGetEnumValue, data: IrDeclaration?) { - // ??? - super.visitGetEnumValue(expression, data) - } - override fun visitFunctionReference(expression: IrFunctionReference, data: IrDeclaration?) { super.visitFunctionReference(expression, data) } From 5cb2572c60d005aa04a47d417ae75e694288db72 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 10 Nov 2020 19:54:38 +0300 Subject: [PATCH 166/698] [IR] update testdata: better support for enum and object accesses --- .../testData/ir/irText/classes/enum.kt.txt | 4 ++-- .../enumsInAnnotationArguments.kt.txt | 2 +- .../annotations/fileAnnotations.kt.txt | 2 +- .../typeAliasesWithAnnotations.kt.txt | 2 +- .../typeParametersWithAnnotations.kt.txt | 2 +- .../expressions/enumEntryAsReceiver.kt.txt | 4 ++-- ...enumEntryReferenceFromEnumEntryClass.kt.txt | 12 ++++++------ .../exhaustiveWhenElseBranch.kt.txt | 18 +++++++++--------- .../irText/expressions/objectAsCallable.kt.txt | 2 +- .../ir/irText/expressions/values.kt.txt | 2 +- .../ir/irText/singletons/enumEntry.kt.txt | 2 +- .../testData/ir/irText/stubs/javaEnum.kt.txt | 2 +- .../types/castsInsideCoroutineInference.kt.txt | 2 +- 13 files changed, 28 insertions(+), 28 deletions(-) diff --git a/compiler/testData/ir/irText/classes/enum.kt.txt b/compiler/testData/ir/irText/classes/enum.kt.txt index c2ab0c121b2..f0eeba98d9f 100644 --- a/compiler/testData/ir/irText/classes/enum.kt.txt +++ b/compiler/testData/ir/irText/classes/enum.kt.txt @@ -87,7 +87,7 @@ abstract enum class TestEnum4 : Enum { } override fun foo() { - println(message = TestEnum4) + println(message = TestEnum4.TEST1) } } @@ -108,7 +108,7 @@ abstract enum class TestEnum4 : Enum { } override fun foo() { - println(message = TestEnum4) + println(message = TestEnum4.TEST2) } } diff --git a/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt b/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt index 5163a81efd1..07e4e7ed651 100644 --- a/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.kt.txt @@ -27,7 +27,7 @@ annotation class TestAnn : Annotation { } -@TestAnn(x = En) +@TestAnn(x = En.A) fun test1() { } diff --git a/compiler/testData/ir/irText/declarations/annotations/fileAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/fileAnnotations.kt.txt index 5e2e386d819..0bd670b91cc 100644 --- a/compiler/testData/ir/irText/declarations/annotations/fileAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/fileAnnotations.kt.txt @@ -1,7 +1,7 @@ @file:A(x = "File annotation") package test -@Target(allowedTargets = [AnnotationTarget]) +@Target(allowedTargets = [AnnotationTarget.FILE]) annotation class A : Annotation { constructor(x: String) /* primary */ val x: String diff --git a/compiler/testData/ir/irText/declarations/annotations/typeAliasesWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/typeAliasesWithAnnotations.kt.txt index 166490a4b6d..efd5dd8a31b 100644 --- a/compiler/testData/ir/irText/declarations/annotations/typeAliasesWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/typeAliasesWithAnnotations.kt.txt @@ -1,4 +1,4 @@ -@Target(allowedTargets = [AnnotationTarget]) +@Target(allowedTargets = [AnnotationTarget.TYPEALIAS]) annotation class TestAnn : Annotation { constructor(x: String) /* primary */ val x: String diff --git a/compiler/testData/ir/irText/declarations/annotations/typeParametersWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/typeParametersWithAnnotations.kt.txt index e69304f97f9..fbe44f28b87 100644 --- a/compiler/testData/ir/irText/declarations/annotations/typeParametersWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/typeParametersWithAnnotations.kt.txt @@ -1,4 +1,4 @@ -@Target(allowedTargets = [AnnotationTarget]) +@Target(allowedTargets = [AnnotationTarget.TYPE_PARAMETER]) annotation class Anno : Annotation { constructor() /* primary */ diff --git a/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt b/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt index 39513e1e4b9..830931d45ef 100644 --- a/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt +++ b/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt.txt @@ -19,7 +19,7 @@ abstract enum class X : Enum { override val value: Function0 field = local fun (): String { - return B.() + return X.B.() } override get @@ -36,6 +36,6 @@ abstract enum class X : Enum { } fun box(): String { - return X.().invoke() + return X.B.().invoke() } diff --git a/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt index 222f0cb65e9..8f9e0cc800f 100644 --- a/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt +++ b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt.txt @@ -28,8 +28,8 @@ open enum class MyEnum : Enum { val aLambda: Function0 field = local fun () { - Z.( = 1) - Z.foo() + MyEnum.Z.( = 1) + MyEnum.Z.foo() } get @@ -44,13 +44,13 @@ open enum class MyEnum : Enum { } init { - Z.( = 1) - Z.foo() + MyEnum.Z.( = 1) + MyEnum.Z.foo() } fun test() { - Z.( = 1) - Z.foo() + MyEnum.Z.( = 1) + MyEnum.Z.foo() } } diff --git a/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt b/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt index e38d74c6bc2..68b58c83c87 100644 --- a/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt +++ b/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt @@ -18,7 +18,7 @@ fun testVariableAssignment_throws(a: A) { { // BLOCK val tmp0_subject: A = a when { - EQEQ(arg0 = tmp0_subject, arg1 = A) -> x = 11 + EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> x = 11 true -> noWhenBranchMatchedException() } } @@ -28,7 +28,7 @@ fun testStatement_empty(a: A) { { // BLOCK val tmp0_subject: A = a when { - EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */ + EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1 /*~> Unit */ } } } @@ -37,7 +37,7 @@ fun testParenthesized_throwsJvm(a: A) { { // BLOCK val tmp0_subject: A = a when { - EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */ + EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1 /*~> Unit */ } } } @@ -46,7 +46,7 @@ fun testAnnotated_throwsJvm(a: A) { { // BLOCK val tmp0_subject: A = a when { - EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */ + EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1 /*~> Unit */ } } } @@ -55,7 +55,7 @@ fun testExpression_throws(a: A): Int { return { // BLOCK val tmp0_subject: A = a when { - EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 + EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1 true -> noWhenBranchMatchedException() } } @@ -68,7 +68,7 @@ fun testIfTheElseStatement_empty(a: A, flag: Boolean) { { // BLOCK val tmp0_subject: A = a when { - EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */ + EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1 /*~> Unit */ } } } @@ -82,7 +82,7 @@ fun testIfTheElseParenthesized_throwsJvm(a: A, flag: Boolean) { { // BLOCK val tmp0_subject: A = a when { - EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */ + EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1 /*~> Unit */ } } } @@ -96,7 +96,7 @@ fun testIfTheElseAnnotated_throwsJvm(a: A, flag: Boolean) { { // BLOCK val tmp0_subject: A = a when { - EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */ + EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1 /*~> Unit */ } } } @@ -108,7 +108,7 @@ fun testLambdaResultExpression_throws(a: A) { return { // BLOCK val tmp0_subject: A = a when { - EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 + EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1 true -> noWhenBranchMatchedException() } } diff --git a/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt b/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt index e7c546f9ec5..93d2702896f 100644 --- a/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt +++ b/compiler/testData/ir/irText/expressions/objectAsCallable.kt.txt @@ -35,6 +35,6 @@ val test1: Int get val test2: Int - field = En.invoke(i = 42) + field = En.X.invoke(i = 42) get diff --git a/compiler/testData/ir/irText/expressions/values.kt.txt b/compiler/testData/ir/irText/expressions/values.kt.txt index 3123fc82308..6eb9e198069 100644 --- a/compiler/testData/ir/irText/expressions/values.kt.txt +++ b/compiler/testData/ir/irText/expressions/values.kt.txt @@ -45,7 +45,7 @@ class Z { } fun test1(): Enum { - return Enum + return Enum.A } fun test2(): A { diff --git a/compiler/testData/ir/irText/singletons/enumEntry.kt.txt b/compiler/testData/ir/irText/singletons/enumEntry.kt.txt index b789a60e6b7..cf845162a34 100644 --- a/compiler/testData/ir/irText/singletons/enumEntry.kt.txt +++ b/compiler/testData/ir/irText/singletons/enumEntry.kt.txt @@ -24,7 +24,7 @@ open enum class Z : Enum { } fun test2() { - ENTRY.test() + Z.ENTRY.test() } } diff --git a/compiler/testData/ir/irText/stubs/javaEnum.kt.txt b/compiler/testData/ir/irText/stubs/javaEnum.kt.txt index b208fba4cc9..c54b4e80132 100644 --- a/compiler/testData/ir/irText/stubs/javaEnum.kt.txt +++ b/compiler/testData/ir/irText/stubs/javaEnum.kt.txt @@ -1,4 +1,4 @@ val test: JEnum - field = JEnum + field = JEnum.ONE get diff --git a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt index bdbd716716f..e52daf75512 100644 --- a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt +++ b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt @@ -26,7 +26,7 @@ inline fun unsafeFlow(crossinline block: @ExtensionFunctionType Suspe TODO() } -@Deprecated(message = "binary compatibility with a version w/o FlowCollector receiver", level = DeprecationLevel) +@Deprecated(message = "binary compatibility with a version w/o FlowCollector receiver", level = DeprecationLevel.HIDDEN) fun Flow.onCompletion(action: SuspendFunction1<@ParameterName(name = "cause") Throwable?, Unit>): Flow { return .onCompletion(action = local suspend fun FlowCollector.(it: Throwable?) { action.invoke(p1 = it) From 182cb52bdba2e29a248edf9ee66b3cafa8302b24 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Wed, 11 Nov 2020 14:22:54 +0300 Subject: [PATCH 167/698] [IR] KotlinLikeDumper: various changes for value and type params * support annotations on value parameters * support new value parameter flags -- hidden, assignable * extract and reuse logic for value and type parameters --- .../kotlin/ir/util/KotlinLikeDumper.kt | 136 ++++++++++++------ 1 file changed, 89 insertions(+), 47 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index 344421edf98..8a1b727e7a6 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -185,25 +185,35 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption first = false } - printParameterModifiersWithNoIndent( - isVararg = it.varargElementType != null, - it.isCrossinline, - it.isNoinline, - ) - - p.printWithNoIndent(it.name.asString()) - p.printWithNoIndent(": ") - (it.varargElementType ?: it.type).printTypeWithNoIndent() - // TODO print it.type too for varargs? - - it.defaultValue?.let { v -> - p.printWithNoIndent(" = ") - v.accept(this@KotlinLikeDumper, this) - } + it.printAValueParameterWithNoIndent(this) } p.printWithNoIndent(")") } + private fun IrValueParameter.printAValueParameterWithNoIndent(data: IrDeclaration?) { + printAnnotationsWithNoIndent() + + printParameterModifiersWithNoIndent( + isVararg = varargElementType != null, + isCrossinline, + isNoinline, + // TODO no test + isHidden, + // TODO no test + isAssignable + ) + + p.printWithNoIndent(name.asString()) + p.printWithNoIndent(": ") + (varargElementType ?: type).printTypeWithNoIndent() + // TODO print it.type too for varargs? + + defaultValue?.let { v -> + p.printWithNoIndent(" = ") + v.accept(this@KotlinLikeDumper, data) + } + } + private fun IrTypeParametersContainer.printWhereClauseIfNeededWithNoIndent() { if (typeParameters.none { it.superTypes.size > 1 }) return @@ -212,21 +222,29 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption var first = true typeParameters.forEach { if (it.superTypes.size > 1) { - it.superTypes.forEach { superType -> - if (!first) { - p.printWithNoIndent(", ") - } else { - first = false - } - - p.printWithNoIndent(it.name.asString()) - p.printWithNoIndent(" : ") - superType.printTypeWithNoIndent() - } + // TODO no test with more than one generic parameter with more supertypes + first = it.printWhereClauseTypesWithNoIndent(first) } } } + private fun IrTypeParameter.printWhereClauseTypesWithNoIndent(first: Boolean): Boolean { + var myFirst = first + superTypes.forEachIndexed { i, superType -> + if (!myFirst) { + p.printWithNoIndent(", ") + } else { + myFirst = false + } + + p.printWithNoIndent(name.asString()) + p.printWithNoIndent(" : ") + superType.printTypeWithNoIndent() + } + + return myFirst + } + private fun IrTypeParametersContainer.printTypeParametersWithNoIndent(postfix: String = "") { if (typeParameters.isEmpty()) return @@ -240,22 +258,26 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption first = false } - it.variance.printVarianceWithNoIndent() - if (it.isReified) p.printWithNoIndent("reified ") - - it.printAnnotationsWithNoIndent() - - p.printWithNoIndent(it.name.asString()) - - if (it.superTypes.size == 1) { - p.printWithNoIndent(" : ") - it.superTypes.single().printTypeWithNoIndent() - } + it.printATypeParameterWithNoIndent() } p.printWithNoIndent(">") p.printWithNoIndent(postfix) } + private fun IrTypeParameter.printATypeParameterWithNoIndent() { + variance.printVarianceWithNoIndent() + if (isReified) p.printWithNoIndent("reified ") + + printAnnotationsWithNoIndent() + + p.printWithNoIndent(name.asString()) + + if (superTypes.size == 1) { + p.printWithNoIndent(" : ") + superTypes.single().printTypeWithNoIndent() + } + } + private fun Variance.printVarianceWithNoIndent() { if (this != Variance.INVARIANT) { p.printWithNoIndent("$label ") @@ -393,7 +415,9 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption printParameterModifiersWithNoIndent( isVararg, isCrossinline = INAPPLICABLE, - isNoinline = INAPPLICABLE + isNoinline = INAPPLICABLE, + isHidden = INAPPLICABLE, + isAssignable = INAPPLICABLE ) p(isSuspend, "suspend") p(isInner, "inner") @@ -415,10 +439,14 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption isVararg: Boolean, isCrossinline: Boolean, isNoinline: Boolean, + isHidden: Boolean, + isAssignable: Boolean, ) { p(isVararg, "vararg") p(isCrossinline, "crossinline") p(isNoinline, "noinline") + p(isHidden, "hidden") + p(isAssignable, "var") } private fun IrValueParameter.printExtensionReceiverParameter() { @@ -551,6 +579,16 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printlnWithNoIndent() } + override fun visitTypeParameter(declaration: IrTypeParameter, data: IrDeclaration?) { + declaration.printATypeParameterWithNoIndent() + if (declaration.superTypes.size > 1) declaration.printWhereClauseTypesWithNoIndent(true) + } + + override fun visitValueParameter(declaration: IrValueParameter, data: IrDeclaration?) { + // TODO index? + declaration.printAValueParameterWithNoIndent(data) + } + override fun visitProperty(declaration: IrProperty, data: IrDeclaration?) { if (options.printFakeOverridesStrategy == FakeOverridesStrategy.NONE && declaration.isFakeOverride) return @@ -937,7 +975,14 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printWithNoIndent(">") } - if (omitBracesIfNoArguments && valueArgumentsCount == 0 && typeArgumentsCount == 0) return + fun allValueArgumentsAreNull(): Boolean { + for (i in 0 until valueArgumentsCount) { + if (getValueArgument(i) != null) return false + } + return true + } + + if (omitBracesIfNoArguments && typeArgumentsCount == 0 && (valueArgumentsCount == 0 || allValueArgumentsAreNull())) return p.printWithNoIndent("(") @@ -950,6 +995,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption // } repeat(valueArgumentsCount) { i -> + // TODO should we print something for omitted arguments (== null)? getValueArgument(i)?.let { if (i > 0) p.printWithNoIndent(", ") // TODO flag to print param name @@ -1292,26 +1338,22 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } override fun visitExternalPackageFragment(declaration: IrExternalPackageFragment, data: IrDeclaration?) { + // TODO support super.visitExternalPackageFragment(declaration, data) } override fun visitScript(declaration: IrScript, data: IrDeclaration?) { + // TODO support super.visitScript(declaration, data) } - override fun visitTypeParameter(declaration: IrTypeParameter, data: IrDeclaration?) { - super.visitTypeParameter(declaration, data) - } - - override fun visitValueParameter(declaration: IrValueParameter, data: IrDeclaration?) { - super.visitValueParameter(declaration, data) - } - override fun visitSuspendableExpression(expression: IrSuspendableExpression, data: IrDeclaration?) { + // TODO support super.visitSuspendableExpression(expression, data) } override fun visitSuspensionPoint(expression: IrSuspensionPoint, data: IrDeclaration?) { + // TODO support super.visitSuspensionPoint(expression, data) } From a34a311e86b84d2815174e3994740ddcc64a8968 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Wed, 11 Nov 2020 14:18:51 +0300 Subject: [PATCH 168/698] [IR] update testdata: support annotations on parameters --- .../delegatedImplementationOfJavaInterface.kt.txt | 8 ++++---- .../delegatedPropertyAccessorsWithAnnotations.kt.txt | 2 +- ...primaryConstructorParameterWithAnnotations.kt.txt | 2 +- .../valueParametersWithAnnotations.kt.txt | 4 ++-- .../signedToUnsignedConversions_test.kt.txt | 12 ++++++------ .../types/castsInsideCoroutineInference.kt.txt | 10 +++++----- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt index 8a6c8b57f54..020745b2374 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.kt.txt @@ -9,12 +9,12 @@ class Test : J { field = j private get - @NotNull() + @NotNull override fun returnNotNull(): @EnhancedNullability String { return .#j.returnNotNull() } - @Nullable() + @Nullable override fun returnNullable(): @EnhancedNullability String? { return .#j.returnNullable() } @@ -27,11 +27,11 @@ class Test : J { .#j.takeFlexible(x = x) } - override fun takeNotNull(x: @EnhancedNullability String) { + override fun takeNotNull(@NotNull x: @EnhancedNullability String) { .#j.takeNotNull(x = x) } - override fun takeNullable(x: @EnhancedNullability String?) { + override fun takeNullable(@Nullable x: @EnhancedNullability String?) { .#j.takeNullable(x = x) } diff --git a/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt index f41515d8c15..003b6d66c2c 100644 --- a/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.kt.txt @@ -42,7 +42,7 @@ var test2: Int /* by */ return #test2$delegate.getValue(thisRef = null, kProp = ::test2) } @A(x = "test2.set") - set(: Int) { + set(@A(x = "test2.set.param") : Int) { return #test2$delegate.setValue(thisRef = null, kProp = ::test2, newValue = ) } diff --git a/compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.kt.txt index 05dc5755fca..314dca9738d 100644 --- a/compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.kt.txt @@ -4,7 +4,7 @@ annotation class Ann : Annotation { } class Test { - constructor(x: Int) /* primary */ { + constructor(@Ann x: Int) /* primary */ { super/*Any*/() /* () */ diff --git a/compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.kt.txt b/compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.kt.txt index 13caad3c889..14e455635e8 100644 --- a/compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.kt.txt @@ -6,11 +6,11 @@ annotation class TestAnn : Annotation { } -fun testFun(x: Int) { +fun testFun(@TestAnn(x = "testFun.x") x: Int) { } class TestClassConstructor1 { - constructor(x: Int) /* primary */ { + constructor(@TestAnn(x = "TestClassConstructor1.x") x: Int) /* primary */ { super/*Any*/() /* () */ diff --git a/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.kt.txt b/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.kt.txt index ed290218075..5f4f54b6c20 100644 --- a/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.kt.txt +++ b/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.kt.txt @@ -28,22 +28,22 @@ const val UINT_CONST: UInt field = 42 get -fun takeUByte(u: UByte) { +fun takeUByte(@ImplicitIntegerCoercion u: UByte) { } -fun takeUShort(u: UShort) { +fun takeUShort(@ImplicitIntegerCoercion u: UShort) { } -fun takeUInt(u: UInt) { +fun takeUInt(@ImplicitIntegerCoercion u: UInt) { } -fun takeULong(u: ULong) { +fun takeULong(@ImplicitIntegerCoercion u: ULong) { } -fun takeUBytes(vararg u: UByte) { +fun takeUBytes(@ImplicitIntegerCoercion vararg u: UByte) { } -fun takeLong(l: Long) { +fun takeLong(@ImplicitIntegerCoercion l: Long) { } fun test() { diff --git a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt index e52daf75512..2b7ad916436 100644 --- a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt +++ b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt @@ -1,5 +1,5 @@ @OptIn(markerClass = [ExperimentalTypeInference::class]) -fun scopedFlow(block: @ExtensionFunctionType SuspendFunction2, Unit>): Flow { +fun scopedFlow(@BuilderInference block: @ExtensionFunctionType SuspendFunction2, Unit>): Flow { return flow(block = local suspend fun FlowCollector.() { val collector: FlowCollector = flowScope(block = local suspend fun CoroutineScope.() { @@ -22,7 +22,7 @@ suspend fun FlowCollector.invokeSafely(action: @ExtensionFunctionT } @OptIn(markerClass = [ExperimentalTypeInference::class]) -inline fun unsafeFlow(crossinline block: @ExtensionFunctionType SuspendFunction1, Unit>): Flow { +inline fun unsafeFlow(@BuilderInference crossinline block: @ExtensionFunctionType SuspendFunction1, Unit>): Flow { TODO() } @@ -84,12 +84,12 @@ class SafeCollector : FlowCollector { } @OptIn(markerClass = [ExperimentalTypeInference::class]) -fun flow(block: @ExtensionFunctionType SuspendFunction1, Unit>): Flow { +fun flow(@BuilderInference block: @ExtensionFunctionType SuspendFunction1, Unit>): Flow { TODO() } @OptIn(markerClass = [ExperimentalTypeInference::class]) -suspend fun flowScope(block: @ExtensionFunctionType SuspendFunction1): R { +suspend fun flowScope(@BuilderInference block: @ExtensionFunctionType SuspendFunction1): R { TODO() } @@ -127,7 +127,7 @@ interface ReceiveChannel { } @OptIn(markerClass = [ExperimentalTypeInference::class]) -fun CoroutineScope.produce(block: @ExtensionFunctionType SuspendFunction1, Unit>): ReceiveChannel { +fun CoroutineScope.produce(@BuilderInference block: @ExtensionFunctionType SuspendFunction1, Unit>): ReceiveChannel { TODO() } From 87eb06a21f1a46c594ba63f68d8503185591dbf1 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Wed, 11 Nov 2020 14:47:06 +0300 Subject: [PATCH 169/698] [IR] update testdata: improve annotations rendering in case when argument was not provided and there is default value --- ...notationsWithDefaultParameterValues.kt.txt | 2 +- .../annotations/javaAnnotation.kt.txt | 2 +- ...ullabilityInDestructuringAssignment.kt.txt | 28 +++++++++---------- .../enhancedNullabilityInForLoop.kt.txt | 22 +++++++-------- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.kt.txt index 01f26c9f37c..7b8970af9b7 100644 --- a/compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.kt.txt @@ -26,7 +26,7 @@ fun test3() { fun test4() { } -@A() +@A fun test5() { } diff --git a/compiler/testData/ir/irText/declarations/annotations/javaAnnotation.kt.txt b/compiler/testData/ir/irText/declarations/annotations/javaAnnotation.kt.txt index 7ab3c0d2ffc..051fa58cdc8 100644 --- a/compiler/testData/ir/irText/declarations/annotations/javaAnnotation.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/javaAnnotation.kt.txt @@ -1,4 +1,4 @@ -@JavaAnn() +@JavaAnn fun test1() { } diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt index fb8cf05894b..636b607a86b 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.kt.txt @@ -62,35 +62,35 @@ fun test1() { fun test2() { // COMPOSITE { - val tmp0_container: @FlexibleNullability Q<@NotNull() @EnhancedNullability String, @NotNull() @EnhancedNullability String>? = notNullComponents() - val x: @NotNull() @EnhancedNullability String = tmp0_container /*!! Q<@NotNull() @EnhancedNullability String, @NotNull() @EnhancedNullability String> */.component1() - val y: @NotNull() @EnhancedNullability String = tmp0_container /*!! Q<@NotNull() @EnhancedNullability String, @NotNull() @EnhancedNullability String> */.component2() + val tmp0_container: @FlexibleNullability Q<@NotNull @EnhancedNullability String, @NotNull @EnhancedNullability String>? = notNullComponents() + val x: @NotNull @EnhancedNullability String = tmp0_container /*!! Q<@NotNull @EnhancedNullability String, @NotNull @EnhancedNullability String> */.component1() + val y: @NotNull @EnhancedNullability String = tmp0_container /*!! Q<@NotNull @EnhancedNullability String, @NotNull @EnhancedNullability String> */.component2() // } - use(x = x /*!! @NotNull() String */, y = y /*!! @NotNull() String */) + use(x = x /*!! @NotNull String */, y = y /*!! @NotNull String */) } fun test2Desugared() { - val tmp: @FlexibleNullability Q<@NotNull() @EnhancedNullability String, @NotNull() @EnhancedNullability String>? = notNullComponents() - val x: @NotNull() String = tmp /*!! Q<@NotNull() @EnhancedNullability String, @NotNull() @EnhancedNullability String> */.component1() /*!! @NotNull() String */ - val y: @NotNull() String = tmp /*!! Q<@NotNull() @EnhancedNullability String, @NotNull() @EnhancedNullability String> */.component2() /*!! @NotNull() String */ + val tmp: @FlexibleNullability Q<@NotNull @EnhancedNullability String, @NotNull @EnhancedNullability String>? = notNullComponents() + val x: @NotNull String = tmp /*!! Q<@NotNull @EnhancedNullability String, @NotNull @EnhancedNullability String> */.component1() /*!! @NotNull String */ + val y: @NotNull String = tmp /*!! Q<@NotNull @EnhancedNullability String, @NotNull @EnhancedNullability String> */.component2() /*!! @NotNull String */ use(x = x, y = y) } fun test3() { // COMPOSITE { - val tmp0_container: @EnhancedNullability Q<@NotNull() @EnhancedNullability String, @NotNull() @EnhancedNullability String> = notNullQAndComponents() - val x: @NotNull() @EnhancedNullability String = tmp0_container /*!! Q<@NotNull() @EnhancedNullability String, @NotNull() @EnhancedNullability String> */.component1() - val y: @NotNull() @EnhancedNullability String = tmp0_container /*!! Q<@NotNull() @EnhancedNullability String, @NotNull() @EnhancedNullability String> */.component2() + val tmp0_container: @EnhancedNullability Q<@NotNull @EnhancedNullability String, @NotNull @EnhancedNullability String> = notNullQAndComponents() + val x: @NotNull @EnhancedNullability String = tmp0_container /*!! Q<@NotNull @EnhancedNullability String, @NotNull @EnhancedNullability String> */.component1() + val y: @NotNull @EnhancedNullability String = tmp0_container /*!! Q<@NotNull @EnhancedNullability String, @NotNull @EnhancedNullability String> */.component2() // } - use(x = x /*!! @NotNull() String */, y = y /*!! @NotNull() String */) + use(x = x /*!! @NotNull String */, y = y /*!! @NotNull String */) } fun test4() { // COMPOSITE { - val tmp0_container: IndexedValue<@NotNull() @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull() @EnhancedNullability P> */.withIndex<@NotNull() @EnhancedNullability P>().first>() + val tmp0_container: IndexedValue<@NotNull @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull @EnhancedNullability P> */.withIndex<@NotNull @EnhancedNullability P>().first>() val x: Int = tmp0_container.component1() - val y: @NotNull() @EnhancedNullability P = tmp0_container.component2() + val y: @NotNull @EnhancedNullability P = tmp0_container.component2() // } - use(x = x, y = y /*!! @NotNull() P */) + use(x = x, y = y /*!! @NotNull P */) } diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt index a43fd45e568..bf023d4f2c2 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.kt.txt @@ -3,9 +3,9 @@ fun use(s: P) { fun testForInListUnused() { { // BLOCK - val tmp0_iterator: MutableIterator<@NotNull() @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull() @EnhancedNullability P> */ /*as MutableList<*> */.iterator() + val tmp0_iterator: MutableIterator<@NotNull @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull @EnhancedNullability P> */ /*as MutableList<*> */.iterator() while (tmp0_iterator.hasNext()) { // BLOCK - val x: @NotNull() @EnhancedNullability P = tmp0_iterator.next() + val x: @NotNull @EnhancedNullability P = tmp0_iterator.next() { // BLOCK } } @@ -14,11 +14,11 @@ fun testForInListUnused() { fun testForInListDestructured() { { // BLOCK - val tmp0_iterator: MutableIterator<@NotNull() @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull() @EnhancedNullability P> */ /*as MutableList<*> */.iterator() + val tmp0_iterator: MutableIterator<@NotNull @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull @EnhancedNullability P> */ /*as MutableList<*> */.iterator() while (tmp0_iterator.hasNext()) { // BLOCK - val tmp1_loop_parameter: @NotNull() @EnhancedNullability P = tmp0_iterator.next() - val x: Int = tmp1_loop_parameter /*!! @NotNull() P */.component1() - val y: Int = tmp1_loop_parameter /*!! @NotNull() P */.component2() + val tmp1_loop_parameter: @NotNull @EnhancedNullability P = tmp0_iterator.next() + val x: Int = tmp1_loop_parameter /*!! @NotNull P */.component1() + val y: Int = tmp1_loop_parameter /*!! @NotNull P */.component2() { // BLOCK } } @@ -26,9 +26,9 @@ fun testForInListDestructured() { } fun testDesugaredForInList() { - val iterator: MutableIterator<@NotNull() @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull() @EnhancedNullability P> */ /*as MutableList<*> */.iterator() + val iterator: MutableIterator<@NotNull @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull @EnhancedNullability P> */ /*as MutableList<*> */.iterator() while (iterator.hasNext()) { // BLOCK - val x: @NotNull() P = iterator.next() /*!! @NotNull() P */ + val x: @NotNull P = iterator.next() /*!! @NotNull P */ } } @@ -45,11 +45,11 @@ fun testForInArrayUnused(j: J) { fun testForInListUse() { { // BLOCK - val tmp0_iterator: MutableIterator<@NotNull() @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull() @EnhancedNullability P> */ /*as MutableList<*> */.iterator() + val tmp0_iterator: MutableIterator<@NotNull @EnhancedNullability P> = listOfNotNull() /*!! List<@NotNull @EnhancedNullability P> */ /*as MutableList<*> */.iterator() while (tmp0_iterator.hasNext()) { // BLOCK - val x: @NotNull() @EnhancedNullability P = tmp0_iterator.next() + val x: @NotNull @EnhancedNullability P = tmp0_iterator.next() { // BLOCK - use(s = x /*!! @NotNull() P */) + use(s = x /*!! @NotNull P */) use(s = x) } } From 0d3d61862ba417668fabff30360f2838fcacb961 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Wed, 11 Nov 2020 16:10:32 +0300 Subject: [PATCH 170/698] [IR] KotlinLikeDumper: better support for callable references --- .../kotlin/ir/util/KotlinLikeDumper.kt | 100 ++++++++++-------- 1 file changed, 56 insertions(+), 44 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index 8a1b727e7a6..8ca0a1b8734 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -865,22 +865,24 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption override fun visitCall(expression: IrCall, data: IrDeclaration?) { // TODO process specially builtin symbols - expression.printFunctionAccessExpressionWithNoIndent( + expression.printMemberAccessExpressionWithNoIndent( expression.symbol.owner.name.asString(), - superQualifierSymbol = expression.superQualifierSymbol, - omitBracesIfNoArguments = false, - data + expression.symbol.owner.valueParameters, + expression.superQualifierSymbol, + omitAllBracketsIfNoArguments = false, + data = data, ) } override fun visitConstructorCall(expression: IrConstructorCall, data: IrDeclaration?) { // TODO could constructors have receiver? val clazz = expression.symbol.owner.parentAsClass - expression.printFunctionAccessExpressionWithNoIndent( + expression.printMemberAccessExpressionWithNoIndent( clazz.name.asString(), + expression.symbol.owner.valueParameters, superQualifierSymbol = null, - omitBracesIfNoArguments = clazz.isAnnotationClass, - data + omitAllBracketsIfNoArguments = clazz.isAnnotationClass, + data = data, ) } @@ -912,19 +914,24 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption delegatingClassName // required only for IrEnumConstructorCall } - printFunctionAccessExpressionWithNoIndent( + printMemberAccessExpressionWithNoIndent( name, + symbol.owner.valueParameters, superQualifierSymbol = null, - omitBracesIfNoArguments = false, - data + omitAllBracketsIfNoArguments = false, + data = data, ) } - private fun IrFunctionAccessExpression.printFunctionAccessExpressionWithNoIndent( + private fun IrMemberAccessExpression<*>.printMemberAccessExpressionWithNoIndent( name: String, + valueParameters: List, superQualifierSymbol: IrClassSymbol?, - omitBracesIfNoArguments: Boolean, - data: IrDeclaration? + omitAllBracketsIfNoArguments: Boolean, + data: IrDeclaration?, + accessOperator: String = ".", + omitAccessOperatorIfNoReceivers: Boolean = true, + wrapArguments: Boolean = false ) { // TODO origin @@ -954,15 +961,25 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } - if (dispatchReceiver != null || extensionReceiver != null || superQualifierSymbol != null) { - p.printWithNoIndent(".") + if (!omitAccessOperatorIfNoReceivers || + (dispatchReceiver != null || extensionReceiver != null || superQualifierSymbol != null) + ) { + p.printWithNoIndent(accessOperator) } - // what if it's unbound - val declaration = symbol.owner - p.printWithNoIndent(name) + fun allValueArgumentsAreNull(): Boolean { + for (i in 0 until valueArgumentsCount) { + if (getValueArgument(i) != null) return false + } + return true + } + + if (omitAllBracketsIfNoArguments && typeArgumentsCount == 0 && (valueArgumentsCount == 0 || allValueArgumentsAreNull())) return + + if (wrapArguments) p.printWithNoIndent("/*") + if (typeArgumentsCount > 0) { p.printWithNoIndent("<") repeat(typeArgumentsCount) { @@ -975,15 +992,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printWithNoIndent(">") } - fun allValueArgumentsAreNull(): Boolean { - for (i in 0 until valueArgumentsCount) { - if (getValueArgument(i) != null) return false - } - return true - } - - if (omitBracesIfNoArguments && typeArgumentsCount == 0 && (valueArgumentsCount == 0 || allValueArgumentsAreNull())) return - p.printWithNoIndent("(") // TODO introduce a flag to print receiver this way? @@ -999,12 +1007,13 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption getValueArgument(i)?.let { if (i > 0) p.printWithNoIndent(", ") // TODO flag to print param name - p.printWithNoIndent(declaration.valueParameters[i].name.asString() + " = ") + p.printWithNoIndent(valueParameters[i].name.asString() + " = ") it.accept(this@KotlinLikeDumper, data) } } p.printWithNoIndent(")") + if (wrapArguments) p.printWithNoIndent("*/") } override fun visitInstanceInitializerCall(expression: IrInstanceInitializerCall, data: IrDeclaration?) { @@ -1147,19 +1156,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printWithNoIndent("::class") } - override fun visitCallableReference(expression: IrCallableReference<*>, data: IrDeclaration?) { - // TODO check - /* - TODO - dispatchReceiver - extensionReceiver - getTypeArgument - getValueArgument - */ - p.printWithNoIndent("::") - p.printWithNoIndent(expression.referencedName.asString()) - } - override fun visitClassReference(expression: IrClassReference, data: IrDeclaration?) { // TODO use classType p.printWithNoIndent((expression.symbol.owner as IrDeclarationWithName).name.asString()) @@ -1358,15 +1354,31 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } override fun visitFunctionReference(expression: IrFunctionReference, data: IrDeclaration?) { - super.visitFunctionReference(expression, data) + // TODO reflectionTarget + expression.printCallableReferenceWithNoIndent(expression.symbol.owner.valueParameters, data) } override fun visitPropertyReference(expression: IrPropertyReference, data: IrDeclaration?) { - super.visitPropertyReference(expression, data) + // TODO do we need additional fields (field, getter, setter)? + expression.printCallableReferenceWithNoIndent(emptyList(), data) } override fun visitLocalDelegatedPropertyReference(expression: IrLocalDelegatedPropertyReference, data: IrDeclaration?) { - super.visitLocalDelegatedPropertyReference(expression, data) + // TODO do we need additional fields (delegate, getter, setter)? + expression.printCallableReferenceWithNoIndent(emptyList(), data) + } + + private fun IrCallableReference<*>.printCallableReferenceWithNoIndent(valueParameters: List, data: IrDeclaration?) { + printMemberAccessExpressionWithNoIndent( + referencedName.asString(), // effectively it's same as `symbol.owner.name.asString()` + valueParameters, + superQualifierSymbol = null, + omitAllBracketsIfNoArguments = true, + data = data, + accessOperator = "::", + omitAccessOperatorIfNoReceivers = false, + wrapArguments = true + ) } override fun visitBranch(branch: IrBranch, data: IrDeclaration?) { From 8f155c23a0cc42731bd0c1c7d7d4ac7bfd1a8870 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Wed, 11 Nov 2020 16:10:20 +0300 Subject: [PATCH 171/698] [IR] update testdata: better support for callable references --- .../genericDelegatedProperty.kt.txt | 4 +-- .../boundCallableReferences.kt.txt | 6 ++-- .../boundInlineAdaptedReference.kt.txt | 2 +- .../boundInnerGenericConstructor.kt.txt | 2 +- .../constructorWithAdaptedArguments.kt.txt | 4 +-- .../importedFromObject.kt.txt | 8 ++--- .../suspendConversion.kt.txt | 2 +- .../callableReferences/typeArguments.kt.txt | 6 ++-- ...MemberReferenceWithAdaptedArguments.kt.txt | 4 +-- .../withAdaptedArguments.kt.txt | 2 +- .../withArgumentAdaptationAndReceiver.kt.txt | 10 +++---- .../expressions/genericPropertyRef.kt.txt | 6 ++-- .../expressions/reflectionLiterals.kt.txt | 2 +- ...pendConversionOnArbitraryExpression.kt.txt | 30 +++++++++---------- .../types/genericDelegatedDeepProperty.kt.txt | 2 +- .../types/genericPropertyReferenceType.kt.txt | 4 +-- 16 files changed, 47 insertions(+), 47 deletions(-) diff --git a/compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt.txt b/compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt.txt index ead82071077..66f2526be19 100644 --- a/compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt.txt +++ b/compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt.txt @@ -26,9 +26,9 @@ object Delegate { var C.genericDelegatedProperty: Int /* by */ field = Delegate get(): Int { - return #genericDelegatedProperty$delegate.getValue(thisRef = , kProp = ::genericDelegatedProperty) + return #genericDelegatedProperty$delegate.getValue(thisRef = , kProp = ::genericDelegatedProperty/*()*/) } set(: Int) { - return #genericDelegatedProperty$delegate.setValue(thisRef = , kProp = ::genericDelegatedProperty, newValue = ) + return #genericDelegatedProperty$delegate.setValue(thisRef = , kProp = ::genericDelegatedProperty/*()*/, newValue = ) } diff --git a/compiler/testData/ir/irText/expressions/boundCallableReferences.kt.txt b/compiler/testData/ir/irText/expressions/boundCallableReferences.kt.txt index 931ca56c3eb..ca4f8527672 100644 --- a/compiler/testData/ir/irText/expressions/boundCallableReferences.kt.txt +++ b/compiler/testData/ir/irText/expressions/boundCallableReferences.kt.txt @@ -18,14 +18,14 @@ fun A.qux() { } val test1: KFunction0 - field = ::foo + field = A()::foo get val test2: KProperty0 - field = ::bar + field = A()::bar get val test3: KFunction0 - field = ::qux + field = A()::qux get diff --git a/compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.kt.txt index 1a6e2eb66ea..d60b4845702 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.kt.txt @@ -13,7 +13,7 @@ fun test() { receiver.id() /*~> Unit */ } - ::id + "Fail"::id }) } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt index b033722a959..5702311cbf9 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt.txt @@ -32,7 +32,7 @@ inline fun foo(a: A, b: B, x: Function2>) fun box(): String { val z: Foo = Foo() - val foo: Inner = foo(a = "O", b = "K", x = ::) + val foo: Inner = foo(a = "O", b = "K", x = z::/*()*/) return foo.().plus(other = foo.()) } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt index 71a408fd35b..f0d6fc7435b 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt @@ -42,7 +42,7 @@ fun testInnerClassConstructor(outer: Outer): Any { return receiver.Inner(xs = [p0]) } - :: + outer:: }) } @@ -52,7 +52,7 @@ fun testInnerClassConstructorCapturingOuter(): Any { return receiver.Inner(xs = [p0]) } - :: + Outer():: }) } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/importedFromObject.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/importedFromObject.kt.txt index e35ff17d6df..1f53fc9698f 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/importedFromObject.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/importedFromObject.kt.txt @@ -18,18 +18,18 @@ object Foo { } val test1: KProperty0 - field = ::a + field = Foo::a get val test1a: KProperty0 - field = ::a + field = Foo::a get val test2: KFunction0 - field = ::foo + field = Foo::foo get val test2a: KFunction0 - field = ::foo + field = Foo::foo get diff --git a/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt index 0a20ee52a87..819654386de 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.kt.txt @@ -94,7 +94,7 @@ fun testWithBoundReceiver() { receiver.bar() } - ::bar + C()::bar }) } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/typeArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/typeArguments.kt.txt index afbc5f32bc8..982d2de6972 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/typeArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/typeArguments.kt.txt @@ -17,14 +17,14 @@ inline fun topLevel2(x: List) { } val test1: Function1 - field = ::topLevel1 + field = ::topLevel1/*()*/ get val test2: Function1, Unit> - field = ::topLevel2 + field = ::topLevel2/*()*/ get val test3: Function1 - field = ::objectMember + field = Host::objectMember/*()*/ get diff --git a/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt index 8d2b3fa8a14..0c62925f2bd 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.kt.txt @@ -43,7 +43,7 @@ fun testBound(a: A) { receiver.foo(xs = [p0]) /*~> Unit */ } - ::foo + a::foo }) } @@ -53,7 +53,7 @@ fun testObject() { receiver.foo(xs = [p0]) /*~> Unit */ } - ::foo + Obj::foo }) } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt index de12596b249..da3f88aa6d4 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt.txt @@ -61,7 +61,7 @@ fun testImportedObjectMember(): String { return importedObjectMemberWithVarargs(xs = [p0]) } - ::importedObjectMemberWithVarargs + Host::importedObjectMemberWithVarargs }) } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt index 90bbd40c144..b8daf8174d7 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt.txt @@ -19,7 +19,7 @@ class Host { receiver.withVararg(xs = [p0]) /*~> Unit */ } - ::withVararg + ::withVararg }) } @@ -30,7 +30,7 @@ class Host { receiver.withVararg(xs = [p0]) /*~> Unit */ } - ::withVararg + h::withVararg }) } @@ -41,7 +41,7 @@ class Host { receiver.withVararg(xs = [p0]) /*~> Unit */ } - ::withVararg + h::withVararg }) } @@ -51,7 +51,7 @@ class Host { receiver.withVararg(xs = [p0]) /*~> Unit */ } - ::withVararg + h::withVararg }) } @@ -61,7 +61,7 @@ class Host { receiver.withVararg(xs = [p0]) /*~> Unit */ } - ::withVararg + Host()::withVararg }) } diff --git a/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt b/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt index 3bb8e604151..8deb5e001da 100644 --- a/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt +++ b/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt @@ -20,13 +20,13 @@ class Value { val Value.additionalText: Int /* by */ field = DVal(kmember = ::text) get(): Int { - return #additionalText$delegate.getValue(t = , p = ::additionalText) + return #additionalText$delegate.getValue(t = , p = ::additionalText/*()*/) } val Value.additionalValue: Int /* by */ field = DVal(kmember = ::value) get(): Int { - return #additionalValue$delegate.getValue(t = , p = ::additionalValue) + return #additionalValue$delegate.getValue(t = , p = ::additionalValue/*()*/) } class DVal { @@ -66,6 +66,6 @@ var T.bar: T } val barRef: KMutableProperty1 - field = ::bar + field = ::bar/*()*/ get diff --git a/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt b/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt index 6cd23bd7fbe..632a4085e5c 100644 --- a/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt +++ b/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt @@ -34,7 +34,7 @@ val test4: KFunction0 get val test5: KFunction0 - field = ::foo + field = A()::foo get val test6: KFunction0 diff --git a/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt b/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt index 4a09c5c254f..b56406a3173 100644 --- a/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt +++ b/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.kt.txt @@ -26,7 +26,7 @@ fun testSimple(fn: Function0) { callee.invoke() } - ::suspendConversion0 + fn::suspendConversion0 }) } @@ -36,7 +36,7 @@ fun testSimpleNonVal() { callee.invoke() } - ::suspendConversion0 + produceFun()::suspendConversion0 }) } @@ -46,7 +46,7 @@ fun testExtAsExt(fn: @ExtensionFunctionType Function1) { callee.invoke(p1 = p0) } - ::suspendConversion0 + fn::suspendConversion0 }) } @@ -56,7 +56,7 @@ fun testExtAsSimple(fn: @ExtensionFunctionType Function1) { callee.invoke(p1 = p0) } - ::suspendConversion0 + fn::suspendConversion0 }) } @@ -66,7 +66,7 @@ fun testSimpleAsExt(fn: Function1) { callee.invoke(p1 = p0) } - ::suspendConversion0 + fn::suspendConversion0 }) } @@ -76,7 +76,7 @@ fun testSimpleAsSimpleT(fn: Function1) { callee.invoke(p1 = p0) } - ::suspendConversion0 + fn::suspendConversion0 }) } @@ -86,7 +86,7 @@ fun testSimpleAsExtT(fn: Function1) { callee.invoke(p1 = p0) } - ::suspendConversion0 + fn::suspendConversion0 }) } @@ -96,7 +96,7 @@ fun testExtAsSimpleT(fn: @ExtensionFunctionType Function1) { callee.invoke(p1 = p0) } - ::suspendConversion0 + fn::suspendConversion0 }) } @@ -106,7 +106,7 @@ fun testExtAsExtT(fn: @ExtensionFunctionType Function1) { callee.invoke(p1 = p0) } - ::suspendConversion0 + fn::suspendConversion0 }) } @@ -116,7 +116,7 @@ fun testSimpleSAsSimpleT(fn: Function1) { callee.invoke(p1 = p0) } - ::suspendConversion0 + fn::suspendConversion0 }) } @@ -126,7 +126,7 @@ fun testSimpleSAsExtT(fn: Function1) { callee.invoke(p1 = p0) } - ::suspendConversion0 + fn::suspendConversion0 }) } @@ -136,7 +136,7 @@ fun testExtSAsSimpleT(fn: @ExtensionFunctionType Function1) callee.invoke(p1 = p0) } - ::suspendConversion0 + fn::suspendConversion0 }) } @@ -146,7 +146,7 @@ fun testExtSAsExtT(fn: @ExtensionFunctionType Function1) { callee.invoke(p1 = p0) } - ::suspendConversion0 + fn::suspendConversion0 }) } @@ -157,7 +157,7 @@ fun testSmartCastWithSuspendConversion(a: Any) { callee.invoke() } - ::suspendConversion0 + a::suspendConversion0 }) } @@ -169,7 +169,7 @@ fun testSmartCastOnVarWithSuspendConversion(a: Any) { callee.invoke() } - ::suspendConversion0 + b::suspendConversion0 }) } diff --git a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt index 83c466f38bf..9d12588f811 100644 --- a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt +++ b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt @@ -141,6 +141,6 @@ val Value>.additionalText: P /* by */ () } get(): P { - return #additionalText$delegate.getValue(t = , p = ::additionalText) + return #additionalText$delegate.getValue(t = , p = ::additionalText/*()*/) } diff --git a/compiler/testData/ir/irText/types/genericPropertyReferenceType.kt.txt b/compiler/testData/ir/irText/types/genericPropertyReferenceType.kt.txt index 6a041492c78..19607410ad6 100644 --- a/compiler/testData/ir/irText/types/genericPropertyReferenceType.kt.txt +++ b/compiler/testData/ir/irText/types/genericPropertyReferenceType.kt.txt @@ -24,11 +24,11 @@ fun use(p: KMutableProperty) { } fun test1() { - use(p = ::y) + use(p = C(x = "abc")::y/*()*/) } fun test2(a: Any) { a as C /*~> Unit */ - use(p = ::y) + use(p = a /*as C */::y/*()*/) } From 14dabed85a5a8bd260b494c21788b3b3ba426f68 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Wed, 11 Nov 2020 16:32:57 +0300 Subject: [PATCH 172/698] [IR] KotlinLikeDumper.kt: move branch support to corresponding visit* methods --- .../kotlin/ir/util/KotlinLikeDumper.kt | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index 8ca0a1b8734..670b6cb3fd2 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -1189,16 +1189,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printlnWithNoIndent("when {") p.pushIndent() - for (b in expression.branches) { - p.printIndent() - b.condition.accept(this, data) - - p.printWithNoIndent(" -> ") - - b.result.accept(this, data) - - p.println() - } + expression.branches.forEach { it.accept(this, data) } p.popIndent() p.print("}") @@ -1382,11 +1373,19 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } override fun visitBranch(branch: IrBranch, data: IrDeclaration?) { - super.visitBranch(branch, data) + p.printIndent() + branch.condition.accept(this, data) + p.printWithNoIndent(" -> ") + branch.result.accept(this, data) + p.println() } override fun visitElseBranch(branch: IrElseBranch, data: IrDeclaration?) { - super.visitElseBranch(branch, data) + p.printIndent() + // TODO assert that condition is `true` + p.printWithNoIndent("else -> ") + branch.result.accept(this, data) + p.println() } private fun commentBlock(text: String) = "/* $text */" From 2dbd784a6a849ca32a190cc19e0f358cc07d7674 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Wed, 11 Nov 2020 16:31:49 +0300 Subject: [PATCH 173/698] [IR] update testdata: print `else -> ...` --- .../ir/irJsText/dynamic/dynamicCall.kt.txt | 2 +- .../dynamic/dynamicElvisOperator.kt.txt | 2 +- .../dynamic/dynamicMemberAccess.kt.txt | 2 +- .../dynamic/dynamicMemberAssignment.kt.txt | 2 +- .../dynamicMemberAugmentedAssignment.kt.txt | 10 ++++---- .../dynamicMemberIncrementDecrement.kt.txt | 8 +++---- .../dynamic/dynamicWithSmartCast.kt.txt | 4 ++-- .../classes/dataClassWithArrayMembers.kt.txt | 2 +- .../ir/irText/classes/dataClasses.kt.txt | 6 ++--- .../irText/classes/dataClassesGeneric.kt.txt | 2 +- .../testData/ir/irText/classes/kt31649.kt.txt | 4 ++-- .../parameters/dataClassMembers.kt.txt | 2 +- .../ir/irText/expressions/bangbang.kt.txt | 2 +- .../booleanConstsInAndAndOrOr.kt.txt | 4 ++-- .../expressions/booleanOperators.kt.txt | 4 ++-- .../breakContinueInLoopHeader.kt.txt | 10 ++++---- .../expressions/chainOfSafeCalls.kt.txt | 8 +++---- .../irText/expressions/coercionToUnit.kt.txt | 4 ++-- .../ir/irText/expressions/dotQualified.kt.txt | 2 +- .../ir/irText/expressions/elvis.kt.txt | 10 ++++---- .../exhaustiveWhenElseBranch.kt.txt | 12 +++++----- .../expressions/extFunSafeInvoke.kt.txt | 2 +- .../comparableWithDoubleOrFloat.kt.txt | 8 +++---- ...qeqRhsConditionPossiblyAffectingLhs.kt.txt | 2 +- .../floatingPointCompareTo.kt.txt | 24 +++++++++---------- .../floatingPointEqeq.kt.txt | 20 ++++++++-------- .../floatingPointEquals.kt.txt | 24 +++++++++---------- .../floatingPointExcleq.kt.txt | 20 ++++++++-------- .../floatingPointLess.kt.txt | 20 ++++++++-------- .../nullableAnyAsIntToDouble.kt.txt | 4 ++-- .../nullableFloatingPointEqeq.kt.txt | 14 +++++------ ...ameterWithPrimitiveNumericSupertype.kt.txt | 16 ++++++------- .../whenByFloatingPoint.kt.txt | 14 +++++------ .../ir/irText/expressions/ifElseIf.kt.txt | 10 ++++---- .../expressions/implicitCastToNonNull.kt.txt | 8 +++---- .../implicitCastToTypeParameter.kt.txt | 4 ++-- .../jvmFieldWithIntersectionTypes.kt.txt | 4 ++-- .../jvmStaticFieldReference.kt.txt | 2 +- .../ir/irText/expressions/kt23030.kt.txt | 12 +++++----- .../ir/irText/expressions/kt27933.kt.txt | 2 +- .../ir/irText/expressions/kt30020.kt.txt | 4 ++-- .../ir/irText/expressions/kt30796.kt.txt | 24 +++++++++---------- .../irText/expressions/safeAssignment.kt.txt | 2 +- .../safeCallWithIncrementDecrement.kt.txt | 6 ++--- .../ir/irText/expressions/safeCalls.kt.txt | 12 +++++----- .../expressions/sam/samConversions.kt.txt | 2 +- .../temporaryInEnumEntryInitializer.kt.txt | 2 +- .../expressions/temporaryInInitBlock.kt.txt | 2 +- .../irText/expressions/typeArguments.kt.txt | 2 +- .../expressions/variableAsFunctionCall.kt.txt | 4 ++-- .../ir/irText/expressions/when.kt.txt | 18 +++++++------- .../ir/irText/expressions/whenElse.kt.txt | 2 +- .../ir/irText/expressions/whenReturn.kt.txt | 2 +- .../expressions/whenUnusedExpression.kt.txt | 4 ++-- .../whenWithSubjectVariable.kt.txt | 2 +- .../ClashResolutionDescriptor.kt.txt | 2 +- .../ir/irText/firProblems/MultiList.kt.txt | 2 +- .../irText/firProblems/candidateSymbol.kt.txt | 2 +- .../coercionToUnitForNestedWhen.kt.txt | 8 +++---- .../ir/irText/regressions/kt24114.kt.txt | 4 ++-- .../ir/irText/stubs/builtinMap.kt.txt | 2 +- .../castsInsideCoroutineInference.kt.txt | 4 ++-- .../irText/types/intersectionType2_NI.kt.txt | 2 +- .../irText/types/intersectionType2_OI.kt.txt | 2 +- .../types/receiverOfIntersectionType.kt.txt | 6 ++--- .../smartCastOnFakeOverrideReceiver.kt.txt | 8 +++---- 66 files changed, 221 insertions(+), 221 deletions(-) diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicCall.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicCall.kt.txt index af23e17284b..c938a630c8e 100644 --- a/compiler/testData/ir/irJsText/dynamic/dynamicCall.kt.txt +++ b/compiler/testData/ir/irJsText/dynamic/dynamicCall.kt.txt @@ -7,7 +7,7 @@ fun test2(d: dynamic): dynamic { val tmp0_safe_receiver: dynamic = d when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> tmp0_safe_receiver.member(1, 2, 3) + else -> tmp0_safe_receiver.member(1, 2, 3) } } } diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicElvisOperator.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicElvisOperator.kt.txt index 9be59ac622e..25b1689fa36 100644 --- a/compiler/testData/ir/irJsText/dynamic/dynamicElvisOperator.kt.txt +++ b/compiler/testData/ir/irJsText/dynamic/dynamicElvisOperator.kt.txt @@ -3,7 +3,7 @@ fun test(d: dynamic): dynamic { val tmp0_elvis_lhs: dynamic = d when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> "other" - true -> tmp0_elvis_lhs + else -> tmp0_elvis_lhs } } } diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicMemberAccess.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicMemberAccess.kt.txt index eb76f1c02b9..61b0fd458b7 100644 --- a/compiler/testData/ir/irJsText/dynamic/dynamicMemberAccess.kt.txt +++ b/compiler/testData/ir/irJsText/dynamic/dynamicMemberAccess.kt.txt @@ -7,7 +7,7 @@ fun test2(d: dynamic): dynamic { val tmp0_safe_receiver: dynamic = d when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> tmp0_safe_receiver.member + else -> tmp0_safe_receiver.member } } } diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicMemberAssignment.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicMemberAssignment.kt.txt index ff938434c56..2a1cbe408a3 100644 --- a/compiler/testData/ir/irJsText/dynamic/dynamicMemberAssignment.kt.txt +++ b/compiler/testData/ir/irJsText/dynamic/dynamicMemberAssignment.kt.txt @@ -7,7 +7,7 @@ fun testSafeMemberAssignment(d: dynamic) { val tmp0_safe_receiver: dynamic = d when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null /*~> Unit */ - true -> tmp0_safe_receiver.m = 1 + else -> tmp0_safe_receiver.m = 1 } } } diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicMemberAugmentedAssignment.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicMemberAugmentedAssignment.kt.txt index cc8293f48f6..8fffb5a3160 100644 --- a/compiler/testData/ir/irJsText/dynamic/dynamicMemberAugmentedAssignment.kt.txt +++ b/compiler/testData/ir/irJsText/dynamic/dynamicMemberAugmentedAssignment.kt.txt @@ -11,35 +11,35 @@ fun testSafeAugmentedMemberAssignment(d: dynamic) { val tmp0_safe_receiver: dynamic = d when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null /*~> Unit */ - true -> tmp0_safe_receiver.m += "+=" + else -> tmp0_safe_receiver.m += "+=" } } { // BLOCK val tmp1_safe_receiver: dynamic = d when { EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null /*~> Unit */ - true -> tmp1_safe_receiver.m -= "-=" + else -> tmp1_safe_receiver.m -= "-=" } } { // BLOCK val tmp2_safe_receiver: dynamic = d when { EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null /*~> Unit */ - true -> tmp2_safe_receiver.m *= "*=" + else -> tmp2_safe_receiver.m *= "*=" } } { // BLOCK val tmp3_safe_receiver: dynamic = d when { EQEQ(arg0 = tmp3_safe_receiver, arg1 = null) -> null /*~> Unit */ - true -> tmp3_safe_receiver.m /= "/=" + else -> tmp3_safe_receiver.m /= "/=" } } { // BLOCK val tmp4_safe_receiver: dynamic = d when { EQEQ(arg0 = tmp4_safe_receiver, arg1 = null) -> null /*~> Unit */ - true -> tmp4_safe_receiver.m %= "%=" + else -> tmp4_safe_receiver.m %= "%=" } } } diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicMemberIncrementDecrement.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicMemberIncrementDecrement.kt.txt index 886013fdecd..97815c0b0de 100644 --- a/compiler/testData/ir/irJsText/dynamic/dynamicMemberIncrementDecrement.kt.txt +++ b/compiler/testData/ir/irJsText/dynamic/dynamicMemberIncrementDecrement.kt.txt @@ -10,28 +10,28 @@ fun testSafeMemberIncrementDecrement(d: dynamic) { val tmp0_safe_receiver: dynamic = d when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> ++tmp0_safe_receiver.prefixIncr + else -> ++tmp0_safe_receiver.prefixIncr } } val t2: dynamic = { // BLOCK val tmp1_safe_receiver: dynamic = d when { EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null - true -> --tmp1_safe_receiver.prefixDecr + else -> --tmp1_safe_receiver.prefixDecr } } val t3: dynamic = { // BLOCK val tmp2_safe_receiver: dynamic = d when { EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null - true -> tmp2_safe_receiver.postfixIncr++ + else -> tmp2_safe_receiver.postfixIncr++ } } val t4: dynamic = { // BLOCK val tmp3_safe_receiver: dynamic = d when { EQEQ(arg0 = tmp3_safe_receiver, arg1 = null) -> null - true -> tmp3_safe_receiver.postfixDecr-- + else -> tmp3_safe_receiver.postfixDecr-- } } } diff --git a/compiler/testData/ir/irJsText/dynamic/dynamicWithSmartCast.kt.txt b/compiler/testData/ir/irJsText/dynamic/dynamicWithSmartCast.kt.txt index c815813af50..411f0fb7793 100644 --- a/compiler/testData/ir/irJsText/dynamic/dynamicWithSmartCast.kt.txt +++ b/compiler/testData/ir/irJsText/dynamic/dynamicWithSmartCast.kt.txt @@ -1,14 +1,14 @@ fun test1(d: dynamic): Int { return when { d is String -> d /*~> String */.() - true -> -1 + else -> -1 } } fun test2(d: dynamic): Int { return when { d is Array<*> -> d /*~> Array */.() - true -> -1 + else -> -1 } } diff --git a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt index 522024adae4..a9cdad2b3e5 100644 --- a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt +++ b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.kt.txt @@ -207,7 +207,7 @@ data class Test3 { override fun hashCode(): Int { return when { EQEQ(arg0 = .#anyArrayN, arg1 = null) -> 0 - true -> dataClassArrayMemberHashCode(arg0 = .#anyArrayN) + else -> dataClassArrayMemberHashCode(arg0 = .#anyArrayN) } } diff --git a/compiler/testData/ir/irText/classes/dataClasses.kt.txt b/compiler/testData/ir/irText/classes/dataClasses.kt.txt index 623d2502672..8633b01ed34 100644 --- a/compiler/testData/ir/irText/classes/dataClasses.kt.txt +++ b/compiler/testData/ir/irText/classes/dataClasses.kt.txt @@ -92,7 +92,7 @@ data class Test2 { override fun hashCode(): Int { return when { EQEQ(arg0 = .#x, arg1 = null) -> 0 - true -> .#x.hashCode() + else -> .#x.hashCode() } } @@ -163,12 +163,12 @@ data class Test3 { var result: Int = .#d.hashCode() result = result.times(other = 31).plus(other = when { EQEQ(arg0 = .#dn, arg1 = null) -> 0 - true -> .#dn.hashCode() + else -> .#dn.hashCode() }) result = result.times(other = 31).plus(other = .#f.hashCode()) result = result.times(other = 31).plus(other = when { EQEQ(arg0 = .#df, arg1 = null) -> 0 - true -> .#df.hashCode() + else -> .#df.hashCode() }) return result } diff --git a/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt b/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt index d4f69ebfbc2..97eb2fcc943 100644 --- a/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt +++ b/compiler/testData/ir/irText/classes/dataClassesGeneric.kt.txt @@ -24,7 +24,7 @@ data class Test1 { override fun hashCode(): Int { return when { EQEQ(arg0 = .#x, arg1 = null) -> 0 - true -> .#x.hashCode() + else -> .#x.hashCode() } } diff --git a/compiler/testData/ir/irText/classes/kt31649.kt.txt b/compiler/testData/ir/irText/classes/kt31649.kt.txt index c29091547d3..29ce0bca107 100644 --- a/compiler/testData/ir/irText/classes/kt31649.kt.txt +++ b/compiler/testData/ir/irText/classes/kt31649.kt.txt @@ -24,7 +24,7 @@ data class TestData { override fun hashCode(): Int { return when { EQEQ(arg0 = .#nn, arg1 = null) -> 0 - true -> .#nn.hashCode() + else -> .#nn.hashCode() } } @@ -62,7 +62,7 @@ inline class TestInline { override fun hashCode(): Int { return when { EQEQ(arg0 = .#nn, arg1 = null) -> 0 - true -> .#nn.hashCode() + else -> .#nn.hashCode() } } diff --git a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt index 48559daab2c..64730bd7ad4 100644 --- a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt.txt @@ -32,7 +32,7 @@ data class Test { override fun hashCode(): Int { var result: Int = when { EQEQ(arg0 = .#x, arg1 = null) -> 0 - true -> .#x.hashCode() + else -> .#x.hashCode() } result = result.times(other = 31).plus(other = .#y.hashCode()) return result diff --git a/compiler/testData/ir/irText/expressions/bangbang.kt.txt b/compiler/testData/ir/irText/expressions/bangbang.kt.txt index f23cea9dc98..8b1abe30418 100644 --- a/compiler/testData/ir/irText/expressions/bangbang.kt.txt +++ b/compiler/testData/ir/irText/expressions/bangbang.kt.txt @@ -7,7 +7,7 @@ fun test2(a: Any?): Int { val tmp0_safe_receiver: Any? = a when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> tmp0_safe_receiver.hashCode() + else -> tmp0_safe_receiver.hashCode() } }) } diff --git a/compiler/testData/ir/irText/expressions/booleanConstsInAndAndOrOr.kt.txt b/compiler/testData/ir/irText/expressions/booleanConstsInAndAndOrOr.kt.txt index 4b1c944a331..864cc27474d 100644 --- a/compiler/testData/ir/irText/expressions/booleanConstsInAndAndOrOr.kt.txt +++ b/compiler/testData/ir/irText/expressions/booleanConstsInAndAndOrOr.kt.txt @@ -1,14 +1,14 @@ fun test1(b: Boolean) { when { b -> return Unit - true -> false + else -> false } /*~> Unit */ } fun test2(b: Boolean) { when { b -> true - true -> return Unit + else -> return Unit } /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/booleanOperators.kt.txt b/compiler/testData/ir/irText/expressions/booleanOperators.kt.txt index ea168900519..527f5067a88 100644 --- a/compiler/testData/ir/irText/expressions/booleanOperators.kt.txt +++ b/compiler/testData/ir/irText/expressions/booleanOperators.kt.txt @@ -1,14 +1,14 @@ fun test1(a: Boolean, b: Boolean): Boolean { return when { a -> b - true -> false + else -> false } } fun test2(a: Boolean, b: Boolean): Boolean { return when { a -> true - true -> b + else -> b } } diff --git a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.kt.txt b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.kt.txt index 9d029d555c8..7b8cf112add 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.kt.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.kt.txt @@ -4,7 +4,7 @@ fun test1(c: Boolean?) { val tmp0_elvis_lhs: Boolean? = c when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> break - true -> tmp0_elvis_lhs + else -> tmp0_elvis_lhs } }) } @@ -16,7 +16,7 @@ fun test2(c: Boolean?) { val tmp0_elvis_lhs: Boolean? = c when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> continue - true -> tmp0_elvis_lhs + else -> tmp0_elvis_lhs } }) } @@ -29,7 +29,7 @@ fun test3(ss: List?) { val tmp0_elvis_lhs: List? = ss when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> continue - true -> tmp0_elvis_lhs + else -> tmp0_elvis_lhs } }.iterator() L2@ while (tmp1_iterator.hasNext()) { // BLOCK @@ -46,7 +46,7 @@ fun test4(ss: List?) { val tmp0_elvis_lhs: List? = ss when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> break - true -> tmp0_elvis_lhs + else -> tmp0_elvis_lhs } }.iterator() L2@ while (tmp1_iterator.hasNext()) { // BLOCK @@ -72,7 +72,7 @@ fun test5() { } /*~> Unit */ // } while (when { greaterOrEqual(arg0 = j, arg1 = 3) -> false - true -> break + else -> break }) } when { diff --git a/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt b/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt index 343cf760287..7a94b51e0c0 100644 --- a/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt +++ b/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt @@ -23,22 +23,22 @@ fun test(nc: C?): C? { val tmp0_safe_receiver: C? = nc when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> tmp0_safe_receiver.foo() + else -> tmp0_safe_receiver.foo() } } when { EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null - true -> tmp1_safe_receiver.bar() + else -> tmp1_safe_receiver.bar() } } when { EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null - true -> tmp2_safe_receiver.foo() + else -> tmp2_safe_receiver.foo() } } when { EQEQ(arg0 = tmp3_safe_receiver, arg1 = null) -> null - true -> tmp3_safe_receiver.foo() + else -> tmp3_safe_receiver.foo() } } } diff --git a/compiler/testData/ir/irText/expressions/coercionToUnit.kt.txt b/compiler/testData/ir/irText/expressions/coercionToUnit.kt.txt index bdfbeaadb66..503b0636f2a 100644 --- a/compiler/testData/ir/irText/expressions/coercionToUnit.kt.txt +++ b/compiler/testData/ir/irText/expressions/coercionToUnit.kt.txt @@ -14,14 +14,14 @@ fun test3() { val tmp0_safe_receiver: @FlexibleNullability PrintStream? = super.#out when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> tmp0_safe_receiver /*!! PrintStream */.println(p0 = "Hello,") + else -> tmp0_safe_receiver /*!! PrintStream */.println(p0 = "Hello,") } } /*~> Unit */ { // BLOCK val tmp1_safe_receiver: @FlexibleNullability PrintStream? = super.#out when { EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null - true -> tmp1_safe_receiver /*!! PrintStream */.println(p0 = "world!") + else -> tmp1_safe_receiver /*!! PrintStream */.println(p0 = "world!") } } /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/dotQualified.kt.txt b/compiler/testData/ir/irText/expressions/dotQualified.kt.txt index a42eda1db63..e155ea3c2ee 100644 --- a/compiler/testData/ir/irText/expressions/dotQualified.kt.txt +++ b/compiler/testData/ir/irText/expressions/dotQualified.kt.txt @@ -7,7 +7,7 @@ fun lengthN(s: String?): Int? { val tmp0_safe_receiver: String? = s when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> tmp0_safe_receiver.() + else -> tmp0_safe_receiver.() } } } diff --git a/compiler/testData/ir/irText/expressions/elvis.kt.txt b/compiler/testData/ir/irText/expressions/elvis.kt.txt index 394c9f17880..1906fcd3efa 100644 --- a/compiler/testData/ir/irText/expressions/elvis.kt.txt +++ b/compiler/testData/ir/irText/expressions/elvis.kt.txt @@ -11,7 +11,7 @@ fun test1(a: Any?, b: Any): Any { val tmp0_elvis_lhs: Any? = a when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> b - true -> tmp0_elvis_lhs + else -> tmp0_elvis_lhs } } } @@ -21,7 +21,7 @@ fun test2(a: String?, b: Any): Any { val tmp0_elvis_lhs: String? = a when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> b - true -> tmp0_elvis_lhs + else -> tmp0_elvis_lhs } } } @@ -37,7 +37,7 @@ fun test3(a: Any?, b: Any?): String { val tmp0_elvis_lhs: Any? = a when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> b /*as String */ - true -> tmp0_elvis_lhs /*as String */ + else -> tmp0_elvis_lhs /*as String */ } } } @@ -47,7 +47,7 @@ fun test4(x: Any): Any { val tmp0_elvis_lhs: Any? = () when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> x - true -> tmp0_elvis_lhs + else -> tmp0_elvis_lhs } } } @@ -57,7 +57,7 @@ fun test5(x: Any): Any { val tmp0_elvis_lhs: Any? = foo() when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> x - true -> tmp0_elvis_lhs + else -> tmp0_elvis_lhs } } } diff --git a/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt b/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt index 68b58c83c87..9d82af00296 100644 --- a/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt +++ b/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.kt.txt @@ -19,7 +19,7 @@ fun testVariableAssignment_throws(a: A) { val tmp0_subject: A = a when { EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> x = 11 - true -> noWhenBranchMatchedException() + else -> noWhenBranchMatchedException() } } } @@ -56,7 +56,7 @@ fun testExpression_throws(a: A): Int { val tmp0_subject: A = a when { EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1 - true -> noWhenBranchMatchedException() + else -> noWhenBranchMatchedException() } } } @@ -64,7 +64,7 @@ fun testExpression_throws(a: A): Int { fun testIfTheElseStatement_empty(a: A, flag: Boolean) { when { flag -> 0 /*~> Unit */ - true -> { // BLOCK + else -> { // BLOCK { // BLOCK val tmp0_subject: A = a when { @@ -78,7 +78,7 @@ fun testIfTheElseStatement_empty(a: A, flag: Boolean) { fun testIfTheElseParenthesized_throwsJvm(a: A, flag: Boolean) { when { flag -> 0 /*~> Unit */ - true -> { // BLOCK + else -> { // BLOCK { // BLOCK val tmp0_subject: A = a when { @@ -92,7 +92,7 @@ fun testIfTheElseParenthesized_throwsJvm(a: A, flag: Boolean) { fun testIfTheElseAnnotated_throwsJvm(a: A, flag: Boolean) { when { flag -> 0 /*~> Unit */ - true -> { // BLOCK + else -> { // BLOCK { // BLOCK val tmp0_subject: A = a when { @@ -109,7 +109,7 @@ fun testLambdaResultExpression_throws(a: A) { val tmp0_subject: A = a when { EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1 - true -> noWhenBranchMatchedException() + else -> noWhenBranchMatchedException() } } } diff --git a/compiler/testData/ir/irText/expressions/extFunSafeInvoke.kt.txt b/compiler/testData/ir/irText/expressions/extFunSafeInvoke.kt.txt index cde2bea701e..755362b03b3 100644 --- a/compiler/testData/ir/irText/expressions/extFunSafeInvoke.kt.txt +++ b/compiler/testData/ir/irText/expressions/extFunSafeInvoke.kt.txt @@ -3,7 +3,7 @@ fun test(receiver: Any?, fn: @ExtensionFunctionType Function3 null - true -> fn.invoke(p1 = tmp0_safe_receiver, p2 = 42, p3 = "Hello") + else -> fn.invoke(p1 = tmp0_safe_receiver, p2 = 42, p3 = "Hello") } } } diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/comparableWithDoubleOrFloat.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/comparableWithDoubleOrFloat.kt.txt index 8fa59fd4c0e..5c4d4068b75 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/comparableWithDoubleOrFloat.kt.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/comparableWithDoubleOrFloat.kt.txt @@ -2,9 +2,9 @@ fun testD(x: Comparable, y: Comparable): Boolean { return when { when { x is Double -> y is Double - true -> false + else -> false } -> less(arg0 = x /*as Double */, arg1 = y /*as Double */) - true -> false + else -> false } } @@ -12,9 +12,9 @@ fun testF(x: Comparable, y: Comparable): Boolean { return when { when { x is Float -> y is Float - true -> false + else -> false } -> less(arg0 = x /*as Float */, arg1 = y /*as Float */) - true -> false + else -> false } } diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/eqeqRhsConditionPossiblyAffectingLhs.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/eqeqRhsConditionPossiblyAffectingLhs.kt.txt index f137776502b..2a7b8ae5df7 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/eqeqRhsConditionPossiblyAffectingLhs.kt.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/eqeqRhsConditionPossiblyAffectingLhs.kt.txt @@ -1,7 +1,7 @@ fun test(x: Any): Boolean { return EQEQ(arg0 = x, arg1 = when { x !is Double -> CHECK_NOT_NULL(arg0 = null) - true -> x /*as Double */ + else -> x /*as Double */ }) } diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointCompareTo.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointCompareTo.kt.txt index 7ae48f901bc..044f844c46b 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointCompareTo.kt.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointCompareTo.kt.txt @@ -5,7 +5,7 @@ fun test1d(x: Double, y: Double): Int { fun test2d(x: Double, y: Any): Boolean { return when { y is Double -> EQEQ(arg0 = x.compareTo(other = y /*as Double */), arg1 = 0) - true -> false + else -> false } } @@ -13,9 +13,9 @@ fun test3d(x: Any, y: Any): Boolean { return when { when { x is Double -> y is Double - true -> false + else -> false } -> EQEQ(arg0 = x /*as Double */.compareTo(other = y /*as Double */), arg1 = 0) - true -> false + else -> false } } @@ -26,7 +26,7 @@ fun test1f(x: Float, y: Float): Int { fun test2f(x: Float, y: Any): Boolean { return when { y is Float -> EQEQ(arg0 = x.compareTo(other = y /*as Float */), arg1 = 0) - true -> false + else -> false } } @@ -34,9 +34,9 @@ fun test3f(x: Any, y: Any): Boolean { return when { when { x is Float -> y is Float - true -> false + else -> false } -> EQEQ(arg0 = x /*as Float */.compareTo(other = y /*as Float */), arg1 = 0) - true -> false + else -> false } } @@ -44,9 +44,9 @@ fun testFD(x: Any, y: Any): Boolean { return when { when { x is Float -> y is Double - true -> false + else -> false } -> EQEQ(arg0 = x /*as Float */.compareTo(other = y /*as Double */), arg1 = 0) - true -> false + else -> false } } @@ -54,9 +54,9 @@ fun testDF(x: Any, y: Any): Boolean { return when { when { x is Double -> y is Float - true -> false + else -> false } -> EQEQ(arg0 = x /*as Double */.compareTo(other = y /*as Float */), arg1 = 0) - true -> false + else -> false } } @@ -67,14 +67,14 @@ fun Float.test1fr(x: Float): Int { fun Float.test2fr(x: Any): Boolean { return when { x is Float -> EQEQ(arg0 = .compareTo(other = x /*as Float */), arg1 = 0) - true -> false + else -> false } } fun Float.test3fr(x: Any): Boolean { return when { x is Double -> EQEQ(arg0 = .compareTo(other = x /*as Double */), arg1 = 0) - true -> false + else -> false } } diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEqeq.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEqeq.kt.txt index 492e74a474b..25a1dad4a61 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEqeq.kt.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEqeq.kt.txt @@ -17,7 +17,7 @@ fun test4d(x: Double, y: Number): Boolean { fun test5d(x: Double, y: Any): Boolean { return when { y is Double -> ieee754equals(arg0 = x, arg1 = y /*as Double */) - true -> false + else -> false } } @@ -25,9 +25,9 @@ fun test6d(x: Any, y: Any): Boolean { return when { when { x is Double -> y is Double - true -> false + else -> false } -> ieee754equals(arg0 = x /*as Double */, arg1 = y /*as Double */) - true -> false + else -> false } } @@ -50,7 +50,7 @@ fun test4f(x: Float, y: Number): Boolean { fun test5f(x: Float, y: Any): Boolean { return when { y is Float -> ieee754equals(arg0 = x, arg1 = y /*as Float */) - true -> false + else -> false } } @@ -58,9 +58,9 @@ fun test6f(x: Any, y: Any): Boolean { return when { when { x is Float -> y is Float - true -> false + else -> false } -> ieee754equals(arg0 = x /*as Float */, arg1 = y /*as Float */) - true -> false + else -> false } } @@ -68,9 +68,9 @@ fun testFD(x: Any, y: Any): Boolean { return when { when { x is Float -> y is Double - true -> false + else -> false } -> ieee754equals(arg0 = x /*as Float */.toDouble(), arg1 = y /*as Double */) - true -> false + else -> false } } @@ -78,9 +78,9 @@ fun testDF(x: Any, y: Any): Boolean { return when { when { x is Double -> y is Float - true -> false + else -> false } -> ieee754equals(arg0 = x /*as Double */, arg1 = y /*as Float */.toDouble()) - true -> false + else -> false } } diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEquals.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEquals.kt.txt index 9564dd41ed4..0368f516c43 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEquals.kt.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEquals.kt.txt @@ -17,7 +17,7 @@ fun test4d(x: Double, y: Number): Boolean { fun test5d(x: Double, y: Any): Boolean { return when { y is Double -> x.equals(other = y) - true -> false + else -> false } } @@ -25,9 +25,9 @@ fun test6d(x: Any, y: Any): Boolean { return when { when { x is Double -> y is Double - true -> false + else -> false } -> x.equals(other = y) - true -> false + else -> false } } @@ -50,7 +50,7 @@ fun test4f(x: Float, y: Number): Boolean { fun test5f(x: Float, y: Any): Boolean { return when { y is Float -> x.equals(other = y) - true -> false + else -> false } } @@ -58,9 +58,9 @@ fun test6f(x: Any, y: Any): Boolean { return when { when { x is Float -> y is Float - true -> false + else -> false } -> x.equals(other = y) - true -> false + else -> false } } @@ -68,9 +68,9 @@ fun testFD(x: Any, y: Any): Boolean { return when { when { x is Float -> y is Double - true -> false + else -> false } -> x.equals(other = y) - true -> false + else -> false } } @@ -78,9 +78,9 @@ fun testDF(x: Any, y: Any): Boolean { return when { when { x is Double -> y is Float - true -> false + else -> false } -> x.equals(other = y) - true -> false + else -> false } } @@ -103,14 +103,14 @@ fun Float.test4fr(x: Number): Boolean { fun Float.test5fr(x: Any): Boolean { return when { x is Float -> .equals(other = x) - true -> false + else -> false } } fun Float.test6fr(x: Any): Boolean { return when { x is Double -> .equals(other = x) - true -> false + else -> false } } diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointExcleq.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointExcleq.kt.txt index 6cda9b7081f..b83dc17a88c 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointExcleq.kt.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointExcleq.kt.txt @@ -17,7 +17,7 @@ fun test4d(x: Double, y: Number): Boolean { fun test5d(x: Double, y: Any): Boolean { return when { y is Double -> ieee754equals(arg0 = x, arg1 = y /*as Double */).not() - true -> false + else -> false } } @@ -25,9 +25,9 @@ fun test6d(x: Any, y: Any): Boolean { return when { when { x is Double -> y is Double - true -> false + else -> false } -> ieee754equals(arg0 = x /*as Double */, arg1 = y /*as Double */).not() - true -> false + else -> false } } @@ -50,7 +50,7 @@ fun test4f(x: Float, y: Number): Boolean { fun test5f(x: Float, y: Any): Boolean { return when { y is Float -> ieee754equals(arg0 = x, arg1 = y /*as Float */).not() - true -> false + else -> false } } @@ -58,9 +58,9 @@ fun test6f(x: Any, y: Any): Boolean { return when { when { x is Float -> y is Float - true -> false + else -> false } -> ieee754equals(arg0 = x /*as Float */, arg1 = y /*as Float */).not() - true -> false + else -> false } } @@ -68,9 +68,9 @@ fun testFD(x: Any, y: Any): Boolean { return when { when { x is Float -> y is Double - true -> false + else -> false } -> ieee754equals(arg0 = x /*as Float */.toDouble(), arg1 = y /*as Double */).not() - true -> false + else -> false } } @@ -78,9 +78,9 @@ fun testDF(x: Any, y: Any): Boolean { return when { when { x is Double -> y is Float - true -> false + else -> false } -> ieee754equals(arg0 = x /*as Double */, arg1 = y /*as Float */.toDouble()).not() - true -> false + else -> false } } diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointLess.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointLess.kt.txt index b070fa875d4..6601494a81c 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointLess.kt.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointLess.kt.txt @@ -5,7 +5,7 @@ fun test1d(x: Double, y: Double): Boolean { fun test2d(x: Double, y: Any): Boolean { return when { y is Double -> less(arg0 = x, arg1 = y /*as Double */) - true -> false + else -> false } } @@ -13,9 +13,9 @@ fun test3d(x: Any, y: Any): Boolean { return when { when { x is Double -> y is Double - true -> false + else -> false } -> less(arg0 = x /*as Double */, arg1 = y /*as Double */) - true -> false + else -> false } } @@ -26,7 +26,7 @@ fun test1f(x: Float, y: Float): Boolean { fun test2f(x: Float, y: Any): Boolean { return when { y is Float -> less(arg0 = x, arg1 = y /*as Float */) - true -> false + else -> false } } @@ -34,9 +34,9 @@ fun test3f(x: Any, y: Any): Boolean { return when { when { x is Float -> y is Float - true -> false + else -> false } -> less(arg0 = x /*as Float */, arg1 = y /*as Float */) - true -> false + else -> false } } @@ -44,9 +44,9 @@ fun testFD(x: Any, y: Any): Boolean { return when { when { x is Float -> y is Double - true -> false + else -> false } -> less(arg0 = x /*as Float */.toDouble(), arg1 = y /*as Double */) - true -> false + else -> false } } @@ -54,9 +54,9 @@ fun testDF(x: Any, y: Any): Boolean { return when { when { x is Double -> y is Float - true -> false + else -> false } -> less(arg0 = x /*as Double */, arg1 = y /*as Float */.toDouble()) - true -> false + else -> false } } diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.kt.txt index 38196c6f7df..30e1040f2a5 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.kt.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.kt.txt @@ -4,10 +4,10 @@ fun test(x: Any?, y: Double): Boolean { val tmp0_safe_receiver: Any? = x when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> tmp0_safe_receiver /*as Int */.toDouble() + else -> tmp0_safe_receiver /*as Int */.toDouble() } }, arg1 = y) - true -> false + else -> false } } diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.kt.txt index 0fc7eaf8fb0..bf159474337 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.kt.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.kt.txt @@ -8,10 +8,10 @@ fun testDF(x: Double?, y: Any?): Boolean { val tmp0_safe_receiver: Any? = y when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> tmp0_safe_receiver /*as Float */.toDouble() + else -> tmp0_safe_receiver /*as Float */.toDouble() } }) - true -> false + else -> false } } @@ -21,10 +21,10 @@ fun testDI(x: Double?, y: Any?): Boolean { val tmp0_safe_receiver: Any? = y when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> tmp0_safe_receiver /*as Int */.toDouble() + else -> tmp0_safe_receiver /*as Int */.toDouble() } }) - true -> false + else -> false } } @@ -32,15 +32,15 @@ fun testDI2(x: Any?, y: Any?): Boolean { return when { when { x is Int? -> y is Double - true -> false + else -> false } -> ieee754equals(arg0 = { // BLOCK val tmp0_safe_receiver: Any? = x when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> tmp0_safe_receiver /*as Int */.toDouble() + else -> tmp0_safe_receiver /*as Int */.toDouble() } }, arg1 = y /*as Double? */) - true -> false + else -> false } } diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.kt.txt index c657962dbf4..ddc7d35451a 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.kt.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.kt.txt @@ -1,49 +1,49 @@ fun test0(x: Any, y: T): Boolean { return when { x is Int -> EQEQ(arg0 = x, arg1 = y) - true -> false + else -> false } } fun test1(x: Any, y: T): Boolean { return when { x is Float -> ieee754equals(arg0 = x /*as Float */, arg1 = y) - true -> false + else -> false } } fun test2(x: Any, y: T): Boolean { return when { x is Float -> ieee754equals(arg0 = x /*as Float */.toDouble(), arg1 = y) - true -> false + else -> false } } fun test3(x: Any, y: T): Boolean { return when { x is Int -> ieee754equals(arg0 = x /*as Int */.toFloat(), arg1 = y) - true -> false + else -> false } } fun test4(x: Any, y: T): Boolean { return when { x is Int -> ieee754equals(arg0 = x /*as Int */.toFloat(), arg1 = y) - true -> false + else -> false } } fun test5(x: Any, y: R): Boolean { return when { x is Int -> ieee754equals(arg0 = x /*as Int */.toFloat(), arg1 = y) - true -> false + else -> false } } fun test6(x: Any, y: T): Boolean { return when { x is Int -> EQEQ(arg0 = x, arg1 = y) - true -> false + else -> false } } @@ -57,7 +57,7 @@ class F { fun testCapturedType(x: T, y: Any): Boolean { return when { y is Double -> ieee754equals(arg0 = x.toDouble(), arg1 = y /*as Double */) - true -> false + else -> false } } diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.kt.txt index 9d6bff99c73..841c8610186 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.kt.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.kt.txt @@ -3,7 +3,7 @@ fun testSimple(x: Double): Int { val tmp0_subject: Double = x when { ieee754equals(arg0 = tmp0_subject, arg1 = 0.0D) -> 0 - true -> 1 + else -> 1 } } } @@ -16,7 +16,7 @@ fun testSmartCastInWhenSubject(x: Any): Int { val tmp0_subject: Any = x when { ieee754equals(arg0 = tmp0_subject /*as Double */, arg1 = 0.0D) -> 0 - true -> 1 + else -> 1 } } } @@ -29,7 +29,7 @@ fun testSmartCastInWhenCondition(x: Double, y: Any): Int { val tmp0_subject: Double = x when { ieee754equals(arg0 = tmp0_subject, arg1 = y /*as Double */) -> 0 - true -> 1 + else -> 1 } } } @@ -40,7 +40,7 @@ fun testSmartCastInWhenConditionInBranch(x: Any): Int { when { tmp0_subject is Double.not() -> -1 ieee754equals(arg0 = tmp0_subject /*as Double */, arg1 = 0.0D) -> 0 - true -> 1 + else -> 1 } } } @@ -56,7 +56,7 @@ fun testSmartCastToDifferentTypes(x: Any, y: Any): Int { val tmp0_subject: Any = x when { ieee754equals(arg0 = tmp0_subject /*as Double */, arg1 = y /*as Float */.toDouble()) -> 0 - true -> 1 + else -> 1 } } } @@ -71,9 +71,9 @@ fun testWithPrematureExitInConditionSubexpression(x: Any): Int { when { EQEQ(arg0 = tmp0_subject, arg1 = foo(x = when { x !is Double -> return 42 - true -> x /*as Double */ + else -> x /*as Double */ })) -> 0 - true -> 1 + else -> 1 } } } diff --git a/compiler/testData/ir/irText/expressions/ifElseIf.kt.txt b/compiler/testData/ir/irText/expressions/ifElseIf.kt.txt index 158a5e08ddc..d150b966d3b 100644 --- a/compiler/testData/ir/irText/expressions/ifElseIf.kt.txt +++ b/compiler/testData/ir/irText/expressions/ifElseIf.kt.txt @@ -2,7 +2,7 @@ fun test(i: Int): Int { return when { greater(arg0 = i, arg1 = 0) -> 1 less(arg0 = i, arg1 = 0) -> -1 - true -> 0 + else -> 0 } } @@ -10,7 +10,7 @@ fun testEmptyBranches1(flag: Boolean) { when { flag -> { // BLOCK } - true -> true /*~> Unit */ + else -> true /*~> Unit */ } when { flag -> true /*~> Unit */ @@ -21,11 +21,11 @@ fun testEmptyBranches2(flag: Boolean) { when { flag -> { // BLOCK } - true -> true /*~> Unit */ + else -> true /*~> Unit */ } when { flag -> true /*~> Unit */ - true -> { // BLOCK + else -> { // BLOCK } } } @@ -34,7 +34,7 @@ fun testEmptyBranches3(flag: Boolean) { when { flag -> { // BLOCK } - true -> true /*~> Unit */ + else -> true /*~> Unit */ } } diff --git a/compiler/testData/ir/irText/expressions/implicitCastToNonNull.kt.txt b/compiler/testData/ir/irText/expressions/implicitCastToNonNull.kt.txt index 157fc95f689..4b880aec3fc 100644 --- a/compiler/testData/ir/irText/expressions/implicitCastToNonNull.kt.txt +++ b/compiler/testData/ir/irText/expressions/implicitCastToNonNull.kt.txt @@ -1,28 +1,28 @@ fun test1(x: String?): Int { return when { EQEQ(arg0 = x, arg1 = null) -> 0 - true -> x.() + else -> x.() } } fun test2(x: T): Int { return when { EQEQ(arg0 = x, arg1 = null) -> 0 - true -> x.() + else -> x.() } } inline fun test3(x: Any): Int { return when { x !is T -> 0 - true -> x /*as CharSequence */.() + else -> x /*as CharSequence */.() } } inline fun test4(x: Any?): Int { return when { x !is T -> 0 - true -> x /*as CharSequence */.() + else -> x /*as CharSequence */.() } } diff --git a/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.kt.txt b/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.kt.txt index f6ce5798ce0..f8967c192e4 100644 --- a/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.kt.txt +++ b/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.kt.txt @@ -1,7 +1,7 @@ inline fun Any.test1(): T? { return when { is T -> /*as T */ - true -> null + else -> null } } @@ -13,7 +13,7 @@ val Foo.asT: T? inline get(): T? { return when { is T -> /*as T */ - true -> null + else -> null } } diff --git a/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt b/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt index 4a946701b51..24a50cea1e7 100644 --- a/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt +++ b/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.kt.txt @@ -52,7 +52,7 @@ fun test(b: Boolean) { val d2: Derived2 = Derived2() val k: Any = when { b -> d1 - true -> d2 + else -> d2 } k /*as JFieldOwner */super.#f = 42 k /*as JFieldOwner */super.#f /*~> Unit */ @@ -60,7 +60,7 @@ fun test(b: Boolean) { val md2: DerivedThroughMid2 = DerivedThroughMid2() val mk: Any = when { b -> md1 - true -> md2 + else -> md2 } mk /*as Mid */super.#f = 44 mk /*as Mid */super.#f /*~> Unit */ diff --git a/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt index 81f61c1123d..f628101e5c1 100644 --- a/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.kt.txt @@ -20,7 +20,7 @@ class TestClass { val test: Int field = when { - true -> { // BLOCK + else -> { // BLOCK super.#out /*!! PrintStream */.println(p0 = "TestClass/test") 42 } diff --git a/compiler/testData/ir/irText/expressions/kt23030.kt.txt b/compiler/testData/ir/irText/expressions/kt23030.kt.txt index 9ebfac5f270..29bf0a1e8db 100644 --- a/compiler/testData/ir/irText/expressions/kt23030.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt23030.kt.txt @@ -10,9 +10,9 @@ fun testOverloadedCompareToCallWithSmartCast(x: Any, y: Any): Boolean { return when { when { x is Int -> y is Char - true -> false + else -> false } -> less(arg0 = x /*as Int */.compareTo(c = y /*as Char */), arg1 = 0) - true -> false + else -> false } } @@ -20,9 +20,9 @@ fun testEqualsWithSmartCast(x: Any, y: Any): Boolean { return when { when { x is Int -> y is Char - true -> false + else -> false } -> EQEQ(arg0 = x, arg1 = y) - true -> false + else -> false } } @@ -45,9 +45,9 @@ class C { return when { when { x is Int -> y is Char - true -> false + else -> false } -> less(arg0 = (, x /*as Int */).compareTo(c = y /*as Char */), arg1 = 0) - true -> false + else -> false } } diff --git a/compiler/testData/ir/irText/expressions/kt27933.kt.txt b/compiler/testData/ir/irText/expressions/kt27933.kt.txt index 204ef061ef7..c18fd59f564 100644 --- a/compiler/testData/ir/irText/expressions/kt27933.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt27933.kt.txt @@ -3,7 +3,7 @@ fun box(): String { when { EQEQ(arg0 = r, arg1 = "").not() -> { // BLOCK } - true -> r = r.plus(other = "O") + else -> r = r.plus(other = "O") } when { EQEQ(arg0 = r, arg1 = "O") -> r = r.plus(other = "K") diff --git a/compiler/testData/ir/irText/expressions/kt30020.kt.txt b/compiler/testData/ir/irText/expressions/kt30020.kt.txt index 19777dc7bad..45b5022d227 100644 --- a/compiler/testData/ir/irText/expressions/kt30020.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt30020.kt.txt @@ -18,14 +18,14 @@ fun test(x: X, nx: X?) { val tmp1_safe_receiver: X? = nx when { EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null - true -> tmp1_safe_receiver.() + else -> tmp1_safe_receiver.() } }).plusAssign(element = 5) CHECK_NOT_NULL>(arg0 = { // BLOCK val tmp2_safe_receiver: X? = nx when { EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null - true -> tmp2_safe_receiver.f() + else -> tmp2_safe_receiver.f() } }).plusAssign(element = 6) } diff --git a/compiler/testData/ir/irText/expressions/kt30796.kt.txt b/compiler/testData/ir/irText/expressions/kt30796.kt.txt index 6e9bd7a3268..e809961e7fc 100644 --- a/compiler/testData/ir/irText/expressions/kt30796.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt30796.kt.txt @@ -7,7 +7,7 @@ fun test(value: T, value2: T) { val tmp0_elvis_lhs: T = value when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> 42 - true -> tmp0_elvis_lhs + else -> tmp0_elvis_lhs } } val x2: Any = { // BLOCK @@ -17,10 +17,10 @@ fun test(value: T, value2: T) { val tmp1_elvis_lhs: T = value2 when { EQEQ(arg0 = tmp1_elvis_lhs, arg1 = null) -> 42 - true -> tmp1_elvis_lhs + else -> tmp1_elvis_lhs } } - true -> tmp2_elvis_lhs + else -> tmp2_elvis_lhs } } val x3: Any = { // BLOCK @@ -28,12 +28,12 @@ fun test(value: T, value2: T) { val tmp3_elvis_lhs: T = value when { EQEQ(arg0 = tmp3_elvis_lhs, arg1 = null) -> value2 - true -> tmp3_elvis_lhs + else -> tmp3_elvis_lhs } } when { EQEQ(arg0 = tmp4_elvis_lhs, arg1 = null) -> 42 - true -> tmp4_elvis_lhs + else -> tmp4_elvis_lhs } } val x4: Any = { // BLOCK @@ -41,19 +41,19 @@ fun test(value: T, value2: T) { val tmp5_elvis_lhs: T = value when { EQEQ(arg0 = tmp5_elvis_lhs, arg1 = null) -> value2 - true -> tmp5_elvis_lhs + else -> tmp5_elvis_lhs } } when { EQEQ(arg0 = tmp6_elvis_lhs, arg1 = null) -> 42 - true -> tmp6_elvis_lhs + else -> tmp6_elvis_lhs } } val x5: Any = { // BLOCK val tmp7_elvis_lhs: Any? = magic() when { EQEQ(arg0 = tmp7_elvis_lhs, arg1 = null) -> 42 - true -> tmp7_elvis_lhs + else -> tmp7_elvis_lhs } } val x6: Any = { // BLOCK @@ -61,12 +61,12 @@ fun test(value: T, value2: T) { val tmp8_elvis_lhs: T = value when { EQEQ(arg0 = tmp8_elvis_lhs, arg1 = null) -> magic() - true -> tmp8_elvis_lhs + else -> tmp8_elvis_lhs } } when { EQEQ(arg0 = tmp9_elvis_lhs, arg1 = null) -> 42 - true -> tmp9_elvis_lhs + else -> tmp9_elvis_lhs } } val x7: Any = { // BLOCK @@ -74,12 +74,12 @@ fun test(value: T, value2: T) { val tmp10_elvis_lhs: Any? = magic() when { EQEQ(arg0 = tmp10_elvis_lhs, arg1 = null) -> value - true -> tmp10_elvis_lhs + else -> tmp10_elvis_lhs } } when { EQEQ(arg0 = tmp11_elvis_lhs, arg1 = null) -> 42 - true -> tmp11_elvis_lhs + else -> tmp11_elvis_lhs } } } diff --git a/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt b/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt index 6b3d127ee76..977e01d3e95 100644 --- a/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt +++ b/compiler/testData/ir/irText/expressions/safeAssignment.kt.txt @@ -17,7 +17,7 @@ fun test(nc: C?) { val tmp0_safe_receiver: C? = nc when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null /*~> Unit */ - true -> tmp0_safe_receiver.( = 42) + else -> tmp0_safe_receiver.( = 42) } } } diff --git a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt index 59e8d49b038..f81fdecee93 100644 --- a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt +++ b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt @@ -21,7 +21,7 @@ operator fun Int?.inc(): Int? { val tmp0_safe_receiver: Int? = when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> tmp0_safe_receiver.inc() + else -> tmp0_safe_receiver.inc() } } } @@ -38,7 +38,7 @@ fun testProperty(nc: C?) { val tmp0_safe_receiver: C? = nc when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> { // BLOCK + else -> { // BLOCK val tmp1_receiver: C? = tmp0_safe_receiver { // BLOCK val tmp2: Int = tmp1_receiver.() @@ -56,7 +56,7 @@ fun testArrayAccess(nc: C?) { val tmp0_safe_receiver: C? = nc when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> tmp0_safe_receiver.() + else -> tmp0_safe_receiver.() } } val tmp2_index0: Int = 0 diff --git a/compiler/testData/ir/irText/expressions/safeCalls.kt.txt b/compiler/testData/ir/irText/expressions/safeCalls.kt.txt index e67d66ff909..86f5c5056a4 100644 --- a/compiler/testData/ir/irText/expressions/safeCalls.kt.txt +++ b/compiler/testData/ir/irText/expressions/safeCalls.kt.txt @@ -24,7 +24,7 @@ fun test1(x: String?): Int? { val tmp0_safe_receiver: String? = x when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> tmp0_safe_receiver.() + else -> tmp0_safe_receiver.() } } } @@ -34,7 +34,7 @@ fun test2(x: String?): Int? { val tmp0_safe_receiver: String? = x when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> tmp0_safe_receiver.hashCode() + else -> tmp0_safe_receiver.hashCode() } } } @@ -44,7 +44,7 @@ fun test3(x: String?, y: Any?): Boolean? { val tmp0_safe_receiver: String? = x when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> tmp0_safe_receiver.equals(other = y) + else -> tmp0_safe_receiver.equals(other = y) } } } @@ -54,7 +54,7 @@ fun test4(x: Ref?) { val tmp0_safe_receiver: Ref? = x when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null /*~> Unit */ - true -> tmp0_safe_receiver.( = 0) + else -> tmp0_safe_receiver.( = 0) } } } @@ -64,7 +64,7 @@ fun IHost.test5(s: String?): Int? { val tmp0_safe_receiver: String? = s when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> (, tmp0_safe_receiver).extLength() + else -> (, tmp0_safe_receiver).extLength() } } } @@ -78,7 +78,7 @@ fun box() { val tmp0_safe_receiver: Int = 42 when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> tmp0_safe_receiver.foo() + else -> tmp0_safe_receiver.foo() } } /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/sam/samConversions.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversions.kt.txt index 33f0a80faa8..6cb66288544 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversions.kt.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConversions.kt.txt @@ -24,7 +24,7 @@ fun J.test3(a: Function0) { fun J.test4(a: Function0, b: Function0, flag: Boolean) { .runIt(r = when { flag -> a - true -> b + else -> b } /*-> @FlexibleNullability Runnable? */) } diff --git a/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.kt.txt b/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.kt.txt index fabba3bae2c..42dcdab5985 100644 --- a/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.kt.txt +++ b/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.kt.txt @@ -17,7 +17,7 @@ enum class En : Enum { val tmp0_safe_receiver: Any? = () when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> tmp0_safe_receiver.toString() + else -> tmp0_safe_receiver.toString() } }) diff --git a/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt b/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt index dd324538d32..47ad087b450 100644 --- a/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt +++ b/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt @@ -13,7 +13,7 @@ class C { val tmp0_safe_receiver: Any? = x when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> tmp0_safe_receiver.toString() + else -> tmp0_safe_receiver.toString() } } } diff --git a/compiler/testData/ir/irText/expressions/typeArguments.kt.txt b/compiler/testData/ir/irText/expressions/typeArguments.kt.txt index 511e07ec7d5..7f0ca45762e 100644 --- a/compiler/testData/ir/irText/expressions/typeArguments.kt.txt +++ b/compiler/testData/ir/irText/expressions/typeArguments.kt.txt @@ -1,7 +1,7 @@ fun test1(x: Any): Boolean { return when { x is Array<*> -> x /*as Array<*> */.isArrayOf() - true -> false + else -> false } } diff --git a/compiler/testData/ir/irText/expressions/variableAsFunctionCall.kt.txt b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.kt.txt index c9ad7813e14..84796b744e3 100644 --- a/compiler/testData/ir/irText/expressions/variableAsFunctionCall.kt.txt +++ b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.kt.txt @@ -23,12 +23,12 @@ fun test4(ns: String?): String? { val tmp0_safe_receiver: String? = ns when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> tmp0_safe_receiver.k() + else -> tmp0_safe_receiver.k() } } when { EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null - true -> tmp1_safe_receiver.invoke() + else -> tmp1_safe_receiver.invoke() } } } diff --git a/compiler/testData/ir/irText/expressions/when.kt.txt b/compiler/testData/ir/irText/expressions/when.kt.txt index 7b15755d586..d3392b1d9a7 100644 --- a/compiler/testData/ir/irText/expressions/when.kt.txt +++ b/compiler/testData/ir/irText/expressions/when.kt.txt @@ -16,7 +16,7 @@ fun testWithSubject(x: Any?): String { tmp0_subject is String -> "String" tmp0_subject is Number.not() -> "!Number" setOf().contains(element = tmp0_subject /*as Number */) -> "nothingness?" - true -> "something" + else -> "something" } } } @@ -28,7 +28,7 @@ fun test(x: Any?): String { x is String -> "String" x !is Number -> "!Number" setOf().contains(element = x /*as Number */) -> "nothingness?" - true -> "something" + else -> "something" } } @@ -40,24 +40,24 @@ fun testComma(x: Int): String { when { when { EQEQ(arg0 = tmp0_subject, arg1 = 1) -> true - true -> EQEQ(arg0 = tmp0_subject, arg1 = 2) + else -> EQEQ(arg0 = tmp0_subject, arg1 = 2) } -> true - true -> EQEQ(arg0 = tmp0_subject, arg1 = 3) + else -> EQEQ(arg0 = tmp0_subject, arg1 = 3) } -> true - true -> EQEQ(arg0 = tmp0_subject, arg1 = 4) + else -> EQEQ(arg0 = tmp0_subject, arg1 = 4) } -> "1234" when { when { EQEQ(arg0 = tmp0_subject, arg1 = 5) -> true - true -> EQEQ(arg0 = tmp0_subject, arg1 = 6) + else -> EQEQ(arg0 = tmp0_subject, arg1 = 6) } -> true - true -> EQEQ(arg0 = tmp0_subject, arg1 = 7) + else -> EQEQ(arg0 = tmp0_subject, arg1 = 7) } -> "567" when { EQEQ(arg0 = tmp0_subject, arg1 = 8) -> true - true -> EQEQ(arg0 = tmp0_subject, arg1 = 9) + else -> EQEQ(arg0 = tmp0_subject, arg1 = 9) } -> "89" - true -> "?" + else -> "?" } } } diff --git a/compiler/testData/ir/irText/expressions/whenElse.kt.txt b/compiler/testData/ir/irText/expressions/whenElse.kt.txt index 75b6657e3a1..2d37664c6e7 100644 --- a/compiler/testData/ir/irText/expressions/whenElse.kt.txt +++ b/compiler/testData/ir/irText/expressions/whenElse.kt.txt @@ -1,6 +1,6 @@ fun test(): Int { return when { - true -> 42 + else -> 42 } } diff --git a/compiler/testData/ir/irText/expressions/whenReturn.kt.txt b/compiler/testData/ir/irText/expressions/whenReturn.kt.txt index aeb3926d9f1..f3bd619b616 100644 --- a/compiler/testData/ir/irText/expressions/whenReturn.kt.txt +++ b/compiler/testData/ir/irText/expressions/whenReturn.kt.txt @@ -6,7 +6,7 @@ fun toString(grade: String): String { EQEQ(arg0 = tmp0_subject, arg1 = "B") -> return "Good" EQEQ(arg0 = tmp0_subject, arg1 = "C") -> return "Mediocre" EQEQ(arg0 = tmp0_subject, arg1 = "D") -> return "Fair" - true -> return "Failure" + else -> return "Failure" } } return "???" diff --git a/compiler/testData/ir/irText/expressions/whenUnusedExpression.kt.txt b/compiler/testData/ir/irText/expressions/whenUnusedExpression.kt.txt index baed6e41583..99c28cbe7b8 100644 --- a/compiler/testData/ir/irText/expressions/whenUnusedExpression.kt.txt +++ b/compiler/testData/ir/irText/expressions/whenUnusedExpression.kt.txt @@ -5,11 +5,11 @@ fun test(b: Boolean, i: Int) { val tmp0_subject: Int = i when { EQEQ(arg0 = tmp0_subject, arg1 = 0) -> 1 /*~> Unit */ - true -> null /*~> Unit */ + else -> null /*~> Unit */ } } } - true -> null /*~> Unit */ + else -> null /*~> Unit */ } } diff --git a/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.kt.txt b/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.kt.txt index 5fe9c6b4c04..e90762d567f 100644 --- a/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.kt.txt +++ b/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.kt.txt @@ -11,7 +11,7 @@ fun test(): Int { y is Int.not() -> 2 0.rangeTo(other = 10).contains(value = y /*as Int */) -> 3 10.rangeTo(other = 20).contains(value = y /*as Int */).not() -> 4 - true -> -1 + else -> -1 } } } diff --git a/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt index 4c527857596..e2ca1094cfc 100644 --- a/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt +++ b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.kt.txt @@ -54,7 +54,7 @@ fun resolveClashesIfAny(container: ComponentContainer, clashResolvers: List? = ().get(key = resolver.()) as? Collection when { EQEQ(arg0 = tmp1_elvis_lhs, arg1 = null) -> continue - true -> tmp1_elvis_lhs + else -> tmp1_elvis_lhs } } val substituteDescriptor: ClashResolutionDescriptor>>>>> = ClashResolutionDescriptor>>>>>(container = container, resolver = resolver, clashedComponents = clashedComponents.toList()) diff --git a/compiler/testData/ir/irText/firProblems/MultiList.kt.txt b/compiler/testData/ir/irText/firProblems/MultiList.kt.txt index 8b9a49c5e4a..0995fcd89eb 100644 --- a/compiler/testData/ir/irText/firProblems/MultiList.kt.txt +++ b/compiler/testData/ir/irText/firProblems/MultiList.kt.txt @@ -24,7 +24,7 @@ data class Some { override fun hashCode(): Int { return when { EQEQ(arg0 = .#value, arg1 = null) -> 0 - true -> .#value.hashCode() + else -> .#value.hashCode() } } diff --git a/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt b/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt index 363ca14617e..ac8ba29aefe 100644 --- a/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt +++ b/compiler/testData/ir/irText/firProblems/candidateSymbol.kt.txt @@ -45,7 +45,7 @@ fun foo(candidate: Candidate) { when { when { me is FirCallableMemberDeclaration<*> -> EQEQ(arg0 = me /*as FirCallableMemberDeclaration> */.(), arg1 = null).not() - true -> false + else -> false } -> { // BLOCK } } diff --git a/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt b/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt index 2fcb66f1e9a..c43634f4f08 100644 --- a/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt +++ b/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt @@ -10,7 +10,7 @@ private fun Reader.nextChar(): Char? { ) when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> tmp0_safe_receiver.toChar() + else -> tmp0_safe_receiver.toChar() } } } @@ -19,20 +19,20 @@ fun Reader.consumeRestOfQuotedSequence(sb: StringBuilder, quote: Char) { var ch: Char? = .nextChar() while (when { EQEQ(arg0 = ch, arg1 = null).not() -> EQEQ(arg0 = ch, arg1 = quote).not() - true -> false + else -> false }) { // BLOCK when { EQEQ(arg0 = ch, arg1 = ()) -> { // BLOCK val tmp0_safe_receiver: Char? = .nextChar() when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - true -> tmp0_safe_receiver.let(block = local fun (it: Char): @FlexibleNullability StringBuilder? { + else -> tmp0_safe_receiver.let(block = local fun (it: Char): @FlexibleNullability StringBuilder? { return sb.append(p0 = it) } ) } } /*~> Unit */ - true -> sb.append(p0 = ch) /*~> Unit */ + else -> sb.append(p0 = ch) /*~> Unit */ } ch = .nextChar() } diff --git a/compiler/testData/ir/irText/regressions/kt24114.kt.txt b/compiler/testData/ir/irText/regressions/kt24114.kt.txt index 7215c3bba53..5635fdb1e83 100644 --- a/compiler/testData/ir/irText/regressions/kt24114.kt.txt +++ b/compiler/testData/ir/irText/regressions/kt24114.kt.txt @@ -19,7 +19,7 @@ fun test1(): Int { } } } - true -> return 3 + else -> return 3 } } } @@ -36,7 +36,7 @@ fun test2(): Int { EQEQ(arg0 = tmp1_subject, arg1 = 2) -> return 2 } } - true -> return 3 + else -> return 3 } } } diff --git a/compiler/testData/ir/irText/stubs/builtinMap.kt.txt b/compiler/testData/ir/irText/stubs/builtinMap.kt.txt index d21232d237c..1d81be4db90 100644 --- a/compiler/testData/ir/irText/stubs/builtinMap.kt.txt +++ b/compiler/testData/ir/irText/stubs/builtinMap.kt.txt @@ -1,7 +1,7 @@ fun Map.plus(pair: Pair): Map { return when { .isEmpty() -> mapOf(pair = pair) - true -> LinkedHashMap<@FlexibleNullability K1?, @FlexibleNullability V1?>(p0 = ).apply>(block = local fun LinkedHashMap<@FlexibleNullability K1?, @FlexibleNullability V1?>.() { + else -> LinkedHashMap<@FlexibleNullability K1?, @FlexibleNullability V1?>(p0 = ).apply>(block = local fun LinkedHashMap<@FlexibleNullability K1?, @FlexibleNullability V1?>.() { .put(key = pair.(), value = pair.()) /*~> Unit */ } ) diff --git a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt index 2b7ad916436..c48ec96ef9d 100644 --- a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt +++ b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt @@ -42,7 +42,7 @@ private fun CoroutineScope.asFairChannel(flow: Flow<*>): ReceiveChannel { val tmp0_elvis_lhs: Any? = value when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> Any() - true -> tmp0_elvis_lhs + else -> tmp0_elvis_lhs } }) } @@ -58,7 +58,7 @@ private fun CoroutineScope.asChannel(flow: Flow<*>): ReceiveChannel { val tmp0_elvis_lhs: Any? = value when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> Any() - true -> tmp0_elvis_lhs + else -> tmp0_elvis_lhs } }) } diff --git a/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt b/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt index e44bd275323..ef0b70b239e 100644 --- a/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType2_NI.kt.txt @@ -34,7 +34,7 @@ fun foo(): Any { val nn: C = C() val c: Any = when { true -> mm - true -> nn + else -> nn } return c } diff --git a/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt b/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt index e44bd275323..ef0b70b239e 100644 --- a/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt +++ b/compiler/testData/ir/irText/types/intersectionType2_OI.kt.txt @@ -34,7 +34,7 @@ fun foo(): Any { val nn: C = C() val c: Any = when { true -> mm - true -> nn + else -> nn } return c } diff --git a/compiler/testData/ir/irText/types/receiverOfIntersectionType.kt.txt b/compiler/testData/ir/irText/types/receiverOfIntersectionType.kt.txt index 708f55b2d71..b06d2f8d4d4 100644 --- a/compiler/testData/ir/irText/types/receiverOfIntersectionType.kt.txt +++ b/compiler/testData/ir/irText/types/receiverOfIntersectionType.kt.txt @@ -38,7 +38,7 @@ class B : I, J { fun testIntersection(a: A, b: B) { val v: K = when { true -> a - true -> b + else -> b } v /*as I */.ff() } @@ -46,7 +46,7 @@ fun testIntersection(a: A, b: B) { fun testFlexible1() { val v: @FlexibleNullability K? = when { true -> a() - true -> b() + else -> b() } v /*!! K */ /*as I */.ff() } @@ -54,7 +54,7 @@ fun testFlexible1() { fun testFlexible2(a: A, b: B) { val v: @FlexibleNullability K? = when { true -> id<@FlexibleNullability A?>(x = a) - true -> id<@FlexibleNullability B?>(x = b) + else -> id<@FlexibleNullability B?>(x = b) } v /*!! K */ /*as I */.ff() } diff --git a/compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.kt.txt b/compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.kt.txt index a0a86581088..2d41ef13f73 100644 --- a/compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.kt.txt +++ b/compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.kt.txt @@ -16,14 +16,14 @@ open class A { fun testA1(x: Any): Int? { return when { x is B -> x /*as B */.f() - true -> null + else -> null } } fun testA2(x: Any): Int? { return when { x is B -> x /*as B */.() - true -> null + else -> null } } @@ -39,14 +39,14 @@ class B : A { fun testB1(x: Any): Int? { return when { x is B -> x /*as B */.f() - true -> null + else -> null } } fun testB2(x: Any): Int? { return when { x is B -> x /*as B */.() - true -> null + else -> null } } From b6e37c1f89deb01a25d17935ec8f2648e9f250bd Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Wed, 11 Nov 2020 17:02:16 +0300 Subject: [PATCH 174/698] [IR] KotlinLikeDumper: print class name for callable references without receivers --- .../src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index 670b6cb3fd2..096cd10c276 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -1360,6 +1360,14 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } private fun IrCallableReference<*>.printCallableReferenceWithNoIndent(valueParameters: List, data: IrDeclaration?) { + // TODO where from to get type arguments for a class? + // TODO rendering for references to constructors + if (dispatchReceiver == null && extensionReceiver == null) { + (symbol.owner as IrDeclaration).parentClassOrNull?.let { + p.printWithNoIndent(it.name.asString()) + } + } + printMemberAccessExpressionWithNoIndent( referencedName.asString(), // effectively it's same as `symbol.owner.name.asString()` valueParameters, From e94528fe0d65d32ecaed8401e4d93e16104a7948 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Wed, 11 Nov 2020 17:02:39 +0300 Subject: [PATCH 175/698] [IR] update testdata: print class name for callable references without receivers --- .../ir/irText/declarations/classLevelProperties.kt.txt | 6 +++--- .../ir/irText/declarations/delegatedProperties.kt.txt | 6 +++--- .../ir/irText/declarations/provideDelegate/member.kt.txt | 4 ++-- .../declarations/provideDelegate/memberExtension.kt.txt | 4 ++-- .../funWithDefaultParametersAsKCallableStar.kt.txt | 2 +- .../expressions/callableReferences/genericMember.kt.txt | 4 ++-- .../ir/irText/expressions/genericPropertyRef.kt.txt | 4 ++-- .../ir/irText/expressions/propertyReferences.kt.txt | 8 ++++---- .../ir/irText/expressions/reflectionLiterals.kt.txt | 4 ++-- .../expressions/typeAliasConstructorReference.kt.txt | 4 ++-- .../ir/irText/firProblems/SameJavaFieldReferences.kt.txt | 4 ++-- .../ir/irText/types/genericDelegatedDeepProperty.kt.txt | 4 ++-- 12 files changed, 27 insertions(+), 27 deletions(-) diff --git a/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt b/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt index 1b37f10bbab..72813a4de72 100644 --- a/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/classLevelProperties.kt.txt @@ -41,16 +41,16 @@ class C { } ) get(): Int { - return .#test7$delegate.getValue(thisRef = , property = ::test7) + return .#test7$delegate.getValue(thisRef = , property = C::test7) } var test8: Int /* by */ field = hashMapOf() get(): Int { - return .#test8$delegate.getValue(thisRef = , property = ::test8) + return .#test8$delegate.getValue(thisRef = , property = C::test8) } set(: Int) { - return .#test8$delegate.setValue(thisRef = , property = ::test8, value = ) + return .#test8$delegate.setValue(thisRef = , property = C::test8, value = ) } } diff --git a/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt b/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt index bc3e76d46a5..1e8247fcfcb 100644 --- a/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt +++ b/compiler/testData/ir/irText/declarations/delegatedProperties.kt.txt @@ -24,16 +24,16 @@ class C { } ) get(): Int { - return .#test2$delegate.getValue(thisRef = , property = ::test2) + return .#test2$delegate.getValue(thisRef = , property = C::test2) } var test3: Any /* by */ field = .() get(): Any { - return .#test3$delegate.getValue(thisRef = , property = ::test3) + return .#test3$delegate.getValue(thisRef = , property = C::test3) } set(: Any) { - return .#test3$delegate.setValue(thisRef = , property = ::test3, value = ) + return .#test3$delegate.setValue(thisRef = , property = C::test3, value = ) } } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt index 9815847b52c..8125f7a3a47 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/member.kt.txt @@ -40,9 +40,9 @@ class Host { } val testMember: String /* by */ - field = DelegateProvider(value = "OK").provideDelegate(thisRef = , property = ::testMember) + field = DelegateProvider(value = "OK").provideDelegate(thisRef = , property = Host::testMember) get(): String { - return .#testMember$delegate.getValue(thisRef = , property = ::testMember) + return .#testMember$delegate.getValue(thisRef = , property = Host::testMember) } } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt index 950932fcf81..51163a7580b 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.kt.txt @@ -27,9 +27,9 @@ object Host { } val String.plusK: String /* by */ - field = (, "K").provideDelegate(host = , p = ::plusK) + field = (, "K").provideDelegate(host = , p = Host::plusK) get(): String { - return .#plusK$delegate.getValue(receiver = , p = ::plusK) + return .#plusK$delegate.getValue(receiver = , p = Host::plusK) } val ok: String diff --git a/compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt.txt index 3171c63c6b8..94b02515bf6 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt.txt @@ -39,6 +39,6 @@ fun testVarargsStar() { } fun testCtorStar() { - useKCallableStar(fn = ::) + useKCallableStar(fn = C::) } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt.txt index bbd8f11082c..b07bc90d0af 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt.txt @@ -15,10 +15,10 @@ class A { } val test1: KFunction1, Unit> - field = ::foo + field = A::foo get val test2: KProperty1, Int> - field = ::bar + field = A::bar get diff --git a/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt b/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt index 8deb5e001da..59be516abff 100644 --- a/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt +++ b/compiler/testData/ir/irText/expressions/genericPropertyRef.kt.txt @@ -18,13 +18,13 @@ class Value { } val Value.additionalText: Int /* by */ - field = DVal(kmember = ::text) + field = DVal(kmember = Value::text) get(): Int { return #additionalText$delegate.getValue(t = , p = ::additionalText/*()*/) } val Value.additionalValue: Int /* by */ - field = DVal(kmember = ::value) + field = DVal(kmember = Value::value) get(): Int { return #additionalValue$delegate.getValue(t = , p = ::additionalValue/*()*/) } diff --git a/compiler/testData/ir/irText/expressions/propertyReferences.kt.txt b/compiler/testData/ir/irText/expressions/propertyReferences.kt.txt index 3b9b20bd3b9..4c871c3fd13 100644 --- a/compiler/testData/ir/irText/expressions/propertyReferences.kt.txt +++ b/compiler/testData/ir/irText/expressions/propertyReferences.kt.txt @@ -115,18 +115,18 @@ val test_constVal: KProperty0 get val test_J_CONST: KProperty0 - field = ::CONST + field = J::CONST get val test_J_nonConst: KMutableProperty0 - field = ::nonConst + field = J::nonConst get val test_varWithPrivateSet: KProperty1 - field = ::varWithPrivateSet + field = C::varWithPrivateSet get val test_varWithProtectedSet: KProperty1 - field = ::varWithProtectedSet + field = C::varWithProtectedSet get diff --git a/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt b/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt index 632a4085e5c..90ff95c3e64 100644 --- a/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt +++ b/compiler/testData/ir/irText/expressions/reflectionLiterals.kt.txt @@ -26,11 +26,11 @@ val test2: KClass get val test3: KFunction1 - field = ::foo + field = A::foo get val test4: KFunction0 - field = :: + field = A:: get val test5: KFunction0 diff --git a/compiler/testData/ir/irText/expressions/typeAliasConstructorReference.kt.txt b/compiler/testData/ir/irText/expressions/typeAliasConstructorReference.kt.txt index bf53ca70dd7..8612cdef373 100644 --- a/compiler/testData/ir/irText/expressions/typeAliasConstructorReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/typeAliasConstructorReference.kt.txt @@ -28,10 +28,10 @@ object Host { typealias NA = Nested val test1: Function1 - field = :: + field = C:: get val test2: Function1 - field = :: + field = Nested:: get diff --git a/compiler/testData/ir/irText/firProblems/SameJavaFieldReferences.kt.txt b/compiler/testData/ir/irText/firProblems/SameJavaFieldReferences.kt.txt index 28599c3a714..d3c8ba95f60 100644 --- a/compiler/testData/ir/irText/firProblems/SameJavaFieldReferences.kt.txt +++ b/compiler/testData/ir/irText/firProblems/SameJavaFieldReferences.kt.txt @@ -1,5 +1,5 @@ fun foo() { - val ref1: KProperty0 = ::someJavaField - val ref2: KProperty0 = ::someJavaField + val ref1: KProperty0 = SomeJavaClass::someJavaField + val ref2: KProperty0 = SomeJavaClass::someJavaField } diff --git a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt index 9d12588f811..b100f0c31d3 100644 --- a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt +++ b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt.txt @@ -108,7 +108,7 @@ val Value>.additionalText: P /* by */ () } private get(): Any? { - return .#deepO$delegate.getValue(t = , p = ::deepO) /*as Any? */ + return .#deepO$delegate.getValue(t = , p = ::deepO) /*as Any? */ } private val Value>.deepK: Any? /* by */ @@ -129,7 +129,7 @@ val Value>.additionalText: P /* by */ () } private get(): Any? { - return .#deepK$delegate.getValue(t = , p = ::deepK) /*as Any? */ + return .#deepK$delegate.getValue(t = , p = ::deepK) /*as Any? */ } override operator fun getValue(t: Value>, p: KProperty<*>): P { From 76e959ef8c6640b4dfaf456fc343d6c0452868f5 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Wed, 11 Nov 2020 17:03:56 +0300 Subject: [PATCH 176/698] [IR] KotlinLikeDumper: minor, update some comments --- .../src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index 096cd10c276..a867bc74967 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -115,6 +115,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption // TODO omit Companion name for companion objects? // TODO thisReceiver // TODO primary constructor? + // TODO special support for objects declaration.printlnAnnotations() p.print("") @@ -1023,10 +1024,9 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } override fun visitFunctionExpression(expression: IrFunctionExpression, data: IrDeclaration?) { - // TODO support // TODO omit the name when it's possible // TODO Is there a difference between `` and ``? - // TODO Is name of function used somehere? How it's important? + // TODO Is name of function used somewhere? How it's important? // TODO Use lambda syntax when possible // TODO don't print visibility? p.withholdIndentOnce() @@ -1336,11 +1336,13 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption override fun visitSuspendableExpression(expression: IrSuspendableExpression, data: IrDeclaration?) { // TODO support + // TODO no test super.visitSuspendableExpression(expression, data) } override fun visitSuspensionPoint(expression: IrSuspensionPoint, data: IrDeclaration?) { // TODO support + // TODO no test super.visitSuspensionPoint(expression, data) } From c7d9b7adbe98d857094c497f26566212cdc53673 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Thu, 12 Nov 2020 14:38:25 +0300 Subject: [PATCH 177/698] [IR] KotlinLikeDumper: rearrange methods --- .../kotlin/ir/util/KotlinLikeDumper.kt | 312 +++++++++--------- 1 file changed, 156 insertions(+), 156 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index a867bc74967..37953a624a1 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -110,6 +110,16 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption if (options.printRegionsPerFile) p.println("//endregion") } + override fun visitExternalPackageFragment(declaration: IrExternalPackageFragment, data: IrDeclaration?) { + // TODO support + super.visitExternalPackageFragment(declaration, data) + } + + override fun visitScript(declaration: IrScript, data: IrDeclaration?) { + // TODO support + super.visitScript(declaration, data) + } + override fun visitClass(declaration: IrClass, data: IrDeclaration?) { // TODO omit super class for enums, annotations? // TODO omit Companion name for companion objects? @@ -526,6 +536,55 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } } + override fun visitTypeAlias(declaration: IrTypeAlias, data: IrDeclaration?) { + declaration.printlnAnnotations() + p.print("") + + printVisibility(declaration.visibility) + p(declaration.isActual, "actual") + + p.printWithNoIndent("typealias ") + p.printWithNoIndent(declaration.name.asString()) + // TODO IrDump doesn't have typeparameters + declaration.printTypeParametersWithNoIndent() + p.printWithNoIndent(" = ") + declaration.expandedType.printTypeWithNoIndent() + + p.printlnWithNoIndent() + } + + override fun visitEnumEntry(declaration: IrEnumEntry, data: IrDeclaration?) { + // TODO better rendering for enum entries + + declaration.correspondingClass?.let { p.println() } + + declaration.printlnAnnotations() + p.print("") + p.printWithNoIndent(declaration.name) + declaration.initializerExpression?.let { + p.printWithNoIndent(" = ") + it.accept(this, declaration) + } + p.println() + + declaration.correspondingClass?.accept(this, declaration) + + p.println() + } + + override fun visitAnonymousInitializer(declaration: IrAnonymousInitializer, data: IrDeclaration?) { + // Looks like IrAnonymousInitializer has annotations accidentally. No tests. + declaration.printlnAnnotations() + p.print("") + + // TODO looks like there are no irText tests for isStatic flag + p(declaration.isStatic, commentBlockH("static")) + p.printWithNoIndent("init ") + declaration.body.accept(this, declaration) + + p.printlnWithNoIndent() + } + override fun visitSimpleFunction(declaration: IrSimpleFunction, data: IrDeclaration?) { declaration.printSimpleFunction( "fun ", @@ -727,23 +786,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printlnWithNoIndent() } - override fun visitTypeAlias(declaration: IrTypeAlias, data: IrDeclaration?) { - declaration.printlnAnnotations() - p.print("") - - printVisibility(declaration.visibility) - p(declaration.isActual, "actual") - - p.printWithNoIndent("typealias ") - p.printWithNoIndent(declaration.name.asString()) - // TODO IrDump doesn't have typeparameters - declaration.printTypeParametersWithNoIndent() - p.printWithNoIndent(" = ") - declaration.expandedType.printTypeWithNoIndent() - - p.printlnWithNoIndent() - } - override fun visitVariable(declaration: IrVariable, data: IrDeclaration?) { declaration.printlnAnnotations() p.print("") @@ -766,38 +808,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption type.printTypeWithNoIndent() } - override fun visitEnumEntry(declaration: IrEnumEntry, data: IrDeclaration?) { - // TODO better rendering for enum entries - - declaration.correspondingClass?.let { p.println() } - - declaration.printlnAnnotations() - p.print("") - p.printWithNoIndent(declaration.name) - declaration.initializerExpression?.let { - p.printWithNoIndent(" = ") - it.accept(this, declaration) - } - p.println() - - declaration.correspondingClass?.accept(this, declaration) - - p.println() - } - - override fun visitAnonymousInitializer(declaration: IrAnonymousInitializer, data: IrDeclaration?) { - // Looks like IrAnonymousInitializer has annotations accidentally. No tests. - declaration.printlnAnnotations() - p.print("") - - // TODO looks like there are no irText tests for isStatic flag - p(declaration.isStatic, commentBlockH("static")) - p.printWithNoIndent("init ") - declaration.body.accept(this, declaration) - - p.printlnWithNoIndent() - } - override fun visitLocalDelegatedProperty(declaration: IrLocalDelegatedProperty, data: IrDeclaration?) { declaration.printlnAnnotations() p.print("") @@ -1066,6 +1076,34 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printWithNoIndent("#" + symbol.owner.name.asString()) } + override fun visitGetValue(expression: IrGetValue, data: IrDeclaration?) { + p.printWithNoIndent(expression.symbol.owner.name.asString()) + } + + override fun visitSetValue(expression: IrSetValue, data: IrDeclaration?) { + p.printWithNoIndent(expression.symbol.owner.name.asString() + " = ") + expression.value.accept(this, data) + } + + override fun visitGetObjectValue(expression: IrGetObjectValue, data: IrDeclaration?) { + // TODO what if symbol is unbound? + expression.symbol.defaultType.printTypeWithNoIndent() + } + + override fun visitGetEnumValue(expression: IrGetEnumValue, data: IrDeclaration?) { + val enumEntry = expression.symbol.owner + p.printWithNoIndent(enumEntry.parentAsClass.name.asString()) + p.printWithNoIndent(".") + p.printWithNoIndent(enumEntry.name.asString()) + } + + override fun visitRawFunctionReference(expression: IrRawFunctionReference, data: IrDeclaration?) { + // TODO support + // TODO no test + p.printWithNoIndent("&") + super.visitRawFunctionReference(expression, data) + } + override fun visitReturn(expression: IrReturn, data: IrDeclaration?) { // TODO label p.printWithNoIndent("return ") @@ -1123,45 +1161,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption spread.expression.accept(this, data) } - override fun visitGetObjectValue(expression: IrGetObjectValue, data: IrDeclaration?) { - // TODO what if symbol is unbound? - expression.symbol.defaultType.printTypeWithNoIndent() - } - - override fun visitGetEnumValue(expression: IrGetEnumValue, data: IrDeclaration?) { - val enumEntry = expression.symbol.owner - p.printWithNoIndent(enumEntry.parentAsClass.name.asString()) - p.printWithNoIndent(".") - p.printWithNoIndent(enumEntry.name.asString()) - } - - override fun visitRawFunctionReference(expression: IrRawFunctionReference, data: IrDeclaration?) { - // TODO support - // TODO no test - p.printWithNoIndent("&") - super.visitRawFunctionReference(expression, data) - } - - override fun visitGetValue(expression: IrGetValue, data: IrDeclaration?) { - p.printWithNoIndent(expression.symbol.owner.name.asString()) - } - - override fun visitSetValue(expression: IrSetValue, data: IrDeclaration?) { - p.printWithNoIndent(expression.symbol.owner.name.asString() + " = ") - expression.value.accept(this, data) - } - - override fun visitGetClass(expression: IrGetClass, data: IrDeclaration?) { - expression.argument.accept(this, data) - p.printWithNoIndent("::class") - } - - override fun visitClassReference(expression: IrClassReference, data: IrDeclaration?) { - // TODO use classType - p.printWithNoIndent((expression.symbol.owner as IrDeclarationWithName).name.asString()) - p.printWithNoIndent("::class") - } - override fun visitTypeOperator(expression: IrTypeOperatorCall, data: IrDeclaration?) { val (operator, after) = when (expression.operator) { IrTypeOperator.CAST -> "as" to "" @@ -1195,6 +1194,22 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.print("}") } + override fun visitBranch(branch: IrBranch, data: IrDeclaration?) { + p.printIndent() + branch.condition.accept(this, data) + p.printWithNoIndent(" -> ") + branch.result.accept(this, data) + p.println() + } + + override fun visitElseBranch(branch: IrElseBranch, data: IrDeclaration?) { + p.printIndent() + // TODO assert that condition is `true` + p.printWithNoIndent("else -> ") + branch.result.accept(this, data) + p.println() + } + private fun IrLoop.printLabel() { label?.let { p.printWithNoIndent(it) @@ -1225,6 +1240,15 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } + override fun visitBreakContinue(jump: IrBreakContinue, data: IrDeclaration?) { + // TODO render loop reference + p.printWithNoIndent(if (jump is IrContinue) "continue" else "break") + jump.label?.let { + p.printWithNoIndent("@") + p.printWithNoIndent(it) + } + } + override fun visitTry(aTry: IrTry, data: IrDeclaration?) { p.printWithNoIndent("try ") aTry.tryResult.accept(this, data) @@ -1250,13 +1274,51 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printlnWithNoIndent() } - override fun visitBreakContinue(jump: IrBreakContinue, data: IrDeclaration?) { - // TODO render loop reference - p.printWithNoIndent(if (jump is IrContinue) "continue" else "break") - jump.label?.let { - p.printWithNoIndent("@") - p.printWithNoIndent(it) + override fun visitGetClass(expression: IrGetClass, data: IrDeclaration?) { + expression.argument.accept(this, data) + p.printWithNoIndent("::class") + } + + override fun visitClassReference(expression: IrClassReference, data: IrDeclaration?) { + // TODO use classType + p.printWithNoIndent((expression.symbol.owner as IrDeclarationWithName).name.asString()) + p.printWithNoIndent("::class") + } + + override fun visitFunctionReference(expression: IrFunctionReference, data: IrDeclaration?) { + // TODO reflectionTarget + expression.printCallableReferenceWithNoIndent(expression.symbol.owner.valueParameters, data) + } + + override fun visitPropertyReference(expression: IrPropertyReference, data: IrDeclaration?) { + // TODO do we need additional fields (field, getter, setter)? + expression.printCallableReferenceWithNoIndent(emptyList(), data) + } + + override fun visitLocalDelegatedPropertyReference(expression: IrLocalDelegatedPropertyReference, data: IrDeclaration?) { + // TODO do we need additional fields (delegate, getter, setter)? + expression.printCallableReferenceWithNoIndent(emptyList(), data) + } + + private fun IrCallableReference<*>.printCallableReferenceWithNoIndent(valueParameters: List, data: IrDeclaration?) { + // TODO where from to get type arguments for a class? + // TODO rendering for references to constructors + if (dispatchReceiver == null && extensionReceiver == null) { + (symbol.owner as IrDeclaration).parentClassOrNull?.let { + p.printWithNoIndent(it.name.asString()) + } } + + printMemberAccessExpressionWithNoIndent( + referencedName.asString(), // effectively it's same as `symbol.owner.name.asString()` + valueParameters, + superQualifierSymbol = null, + omitAllBracketsIfNoArguments = true, + data = data, + accessOperator = "::", + omitAccessOperatorIfNoReceivers = false, + wrapArguments = true + ) } override fun visitDynamicOperatorExpression(expression: IrDynamicOperatorExpression, data: IrDeclaration?) { @@ -1324,16 +1386,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } } - override fun visitExternalPackageFragment(declaration: IrExternalPackageFragment, data: IrDeclaration?) { - // TODO support - super.visitExternalPackageFragment(declaration, data) - } - - override fun visitScript(declaration: IrScript, data: IrDeclaration?) { - // TODO support - super.visitScript(declaration, data) - } - override fun visitSuspendableExpression(expression: IrSuspendableExpression, data: IrDeclaration?) { // TODO support // TODO no test @@ -1346,58 +1398,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption super.visitSuspensionPoint(expression, data) } - override fun visitFunctionReference(expression: IrFunctionReference, data: IrDeclaration?) { - // TODO reflectionTarget - expression.printCallableReferenceWithNoIndent(expression.symbol.owner.valueParameters, data) - } - - override fun visitPropertyReference(expression: IrPropertyReference, data: IrDeclaration?) { - // TODO do we need additional fields (field, getter, setter)? - expression.printCallableReferenceWithNoIndent(emptyList(), data) - } - - override fun visitLocalDelegatedPropertyReference(expression: IrLocalDelegatedPropertyReference, data: IrDeclaration?) { - // TODO do we need additional fields (delegate, getter, setter)? - expression.printCallableReferenceWithNoIndent(emptyList(), data) - } - - private fun IrCallableReference<*>.printCallableReferenceWithNoIndent(valueParameters: List, data: IrDeclaration?) { - // TODO where from to get type arguments for a class? - // TODO rendering for references to constructors - if (dispatchReceiver == null && extensionReceiver == null) { - (symbol.owner as IrDeclaration).parentClassOrNull?.let { - p.printWithNoIndent(it.name.asString()) - } - } - - printMemberAccessExpressionWithNoIndent( - referencedName.asString(), // effectively it's same as `symbol.owner.name.asString()` - valueParameters, - superQualifierSymbol = null, - omitAllBracketsIfNoArguments = true, - data = data, - accessOperator = "::", - omitAccessOperatorIfNoReceivers = false, - wrapArguments = true - ) - } - - override fun visitBranch(branch: IrBranch, data: IrDeclaration?) { - p.printIndent() - branch.condition.accept(this, data) - p.printWithNoIndent(" -> ") - branch.result.accept(this, data) - p.println() - } - - override fun visitElseBranch(branch: IrElseBranch, data: IrDeclaration?) { - p.printIndent() - // TODO assert that condition is `true` - p.printWithNoIndent("else -> ") - branch.result.accept(this, data) - p.println() - } - private fun commentBlock(text: String) = "/* $text */" private fun commentBlockH(text: String) = "/* $text */" From d9dbc01c3ec58c4b7206b358c42a7316302b89b0 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Thu, 12 Nov 2020 15:19:10 +0300 Subject: [PATCH 178/698] [IR] KotlinLikeDumper: `p.print("")` -> `p.printIndent()` --- .../kotlin/ir/util/KotlinLikeDumper.kt | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index 37953a624a1..534f3896911 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -128,7 +128,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption // TODO special support for objects declaration.printlnAnnotations() - p.print("") + p.printIndent() declaration.run { printModifiersWithNoIndent( @@ -302,7 +302,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption private fun IrAnnotationContainer.printlnAnnotations(prefix: String = "") { annotations.forEach { - p.print("") + p.printIndent() it.printAnAnnotationWithNoIndent(prefix) p.printlnWithNoIndent() } @@ -538,7 +538,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption override fun visitTypeAlias(declaration: IrTypeAlias, data: IrDeclaration?) { declaration.printlnAnnotations() - p.print("") + p.printIndent() printVisibility(declaration.visibility) p(declaration.isActual, "actual") @@ -559,7 +559,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption declaration.correspondingClass?.let { p.println() } declaration.printlnAnnotations() - p.print("") + p.printIndent() p.printWithNoIndent(declaration.name) declaration.initializerExpression?.let { p.printWithNoIndent(" = ") @@ -575,7 +575,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption override fun visitAnonymousInitializer(declaration: IrAnonymousInitializer, data: IrDeclaration?) { // Looks like IrAnonymousInitializer has annotations accidentally. No tests. declaration.printlnAnnotations() - p.print("") + p.printIndent() // TODO looks like there are no irText tests for isStatic flag p(declaration.isStatic, commentBlockH("static")) @@ -603,7 +603,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption // TODO return type? declaration.printlnAnnotations() - p.print("") + p.printIndent() declaration.run { printModifiersWithNoIndent( @@ -653,7 +653,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption if (options.printFakeOverridesStrategy == FakeOverridesStrategy.NONE && declaration.isFakeOverride) return declaration.printlnAnnotations() - p.print("") + p.printIndent() // TODO better rendering for modifiers on property and accessors // modifiers that could be different between accessors and property have a comment @@ -739,7 +739,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption override fun visitField(declaration: IrField, data: IrDeclaration?) { declaration.printlnAnnotations() - p.print("") + p.printIndent() declaration.run { printModifiersWithNoIndent( @@ -788,7 +788,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption override fun visitVariable(declaration: IrVariable, data: IrDeclaration?) { declaration.printlnAnnotations() - p.print("") + p.printIndent() p(declaration.isLateinit, "lateinit") p(declaration.isConst, "const") @@ -810,7 +810,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption override fun visitLocalDelegatedProperty(declaration: IrLocalDelegatedProperty, data: IrDeclaration?) { declaration.printlnAnnotations() - p.print("") + p.printIndent() // TODO think about better rendering declaration.run { printVariable(isVar, name, type) } From 5b0efe2b64cbb625233d12d805ed6eec497d5531 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Thu, 12 Nov 2020 15:44:41 +0300 Subject: [PATCH 179/698] [IR] KotlinLikeDumper: rearrange methods --- .../kotlin/ir/util/KotlinLikeDumper.kt | 577 +++++++++--------- 1 file changed, 289 insertions(+), 288 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index 534f3896911..fb84b39ac59 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -186,186 +186,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printlnWithNoIndent() } - private fun IrFunction.printValueParametersWithNoIndent() { - p.printWithNoIndent("(") - var first = true - valueParameters.forEach { - if (!first) { - p.printWithNoIndent(", ") - } else { - first = false - } - - it.printAValueParameterWithNoIndent(this) - } - p.printWithNoIndent(")") - } - - private fun IrValueParameter.printAValueParameterWithNoIndent(data: IrDeclaration?) { - printAnnotationsWithNoIndent() - - printParameterModifiersWithNoIndent( - isVararg = varargElementType != null, - isCrossinline, - isNoinline, - // TODO no test - isHidden, - // TODO no test - isAssignable - ) - - p.printWithNoIndent(name.asString()) - p.printWithNoIndent(": ") - (varargElementType ?: type).printTypeWithNoIndent() - // TODO print it.type too for varargs? - - defaultValue?.let { v -> - p.printWithNoIndent(" = ") - v.accept(this@KotlinLikeDumper, data) - } - } - - private fun IrTypeParametersContainer.printWhereClauseIfNeededWithNoIndent() { - if (typeParameters.none { it.superTypes.size > 1 }) return - - p.printWithNoIndent(" where ") - - var first = true - typeParameters.forEach { - if (it.superTypes.size > 1) { - // TODO no test with more than one generic parameter with more supertypes - first = it.printWhereClauseTypesWithNoIndent(first) - } - } - } - - private fun IrTypeParameter.printWhereClauseTypesWithNoIndent(first: Boolean): Boolean { - var myFirst = first - superTypes.forEachIndexed { i, superType -> - if (!myFirst) { - p.printWithNoIndent(", ") - } else { - myFirst = false - } - - p.printWithNoIndent(name.asString()) - p.printWithNoIndent(" : ") - superType.printTypeWithNoIndent() - } - - return myFirst - } - - private fun IrTypeParametersContainer.printTypeParametersWithNoIndent(postfix: String = "") { - if (typeParameters.isEmpty()) return - - p.printWithNoIndent("<") - var first = true - // TODO no commas in some types - typeParameters.forEach { - if (!first) { - p.printWithNoIndent(", ") - } else { - first = false - } - - it.printATypeParameterWithNoIndent() - } - p.printWithNoIndent(">") - p.printWithNoIndent(postfix) - } - - private fun IrTypeParameter.printATypeParameterWithNoIndent() { - variance.printVarianceWithNoIndent() - if (isReified) p.printWithNoIndent("reified ") - - printAnnotationsWithNoIndent() - - p.printWithNoIndent(name.asString()) - - if (superTypes.size == 1) { - p.printWithNoIndent(" : ") - superTypes.single().printTypeWithNoIndent() - } - } - - private fun Variance.printVarianceWithNoIndent() { - if (this != Variance.INVARIANT) { - p.printWithNoIndent("$label ") - } - } - - private fun IrConstructorCall.printAnAnnotationWithNoIndent(prefix: String = "") { - p.printWithNoIndent("@" + (if (prefix.isEmpty()) "" else "$prefix:")) - visitConstructorCall(this, null) - } - - private fun IrAnnotationContainer.printlnAnnotations(prefix: String = "") { - annotations.forEach { - p.printIndent() - it.printAnAnnotationWithNoIndent(prefix) - p.printlnWithNoIndent() - } - } - - private fun IrAnnotationContainer.printAnnotationsWithNoIndent() { - annotations.forEach { - it.printAnAnnotationWithNoIndent() - p.printWithNoIndent(" ") - } - } - - private fun IrType.printTypeWithNoIndent() { - // TODO don't print `Any?` upper bound? - printAnnotationsWithNoIndent() - when (this) { - is IrSimpleType -> { - // TODO abbreviation - - p.printWithNoIndent((classifier.owner as IrDeclarationWithName).name.asString()) - - if (arguments.isNotEmpty()) { - p.printWithNoIndent("<") - var first = true - arguments.forEach { - if (!first) { - p.printWithNoIndent(", ") - } else { - first = false - } - - when (it) { - is IrStarProjection -> - p.printWithNoIndent("*") - is IrTypeProjection -> { - it.variance.printVarianceWithNoIndent() - it.type.printTypeWithNoIndent() - } - } - } - p.printWithNoIndent(">") - } - - if (hasQuestionMark) p.printWithNoIndent("?") - } - is IrDynamicType -> - p.printWithNoIndent("dynamic") - is IrErrorType -> - p.printWithNoIndent("ErrorType /* ERROR */") - else -> - p.printWithNoIndent("??? /* ERROR: unknown type: ${this.javaClass.simpleName} */") - } - } - - private fun p(condition: Boolean, s: String) { - if (condition) p.printWithNoIndent("$s ") - } - - private fun p(value: T?, defaultValue: T? = null, getString: T.() -> String) { - if (value == null) return - p(value != defaultValue, value.getString()) - } - /* https://kotlinlang.org/docs/reference/coding-conventions.html#modifiers Modifiers order: @@ -460,82 +280,138 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p(isAssignable, "var") } - private fun IrValueParameter.printExtensionReceiverParameter() { - type.printTypeWithNoIndent() - p.printWithNoIndent(".") + private fun IrTypeParametersContainer.printTypeParametersWithNoIndent(postfix: String = "") { + if (typeParameters.isEmpty()) return + + p.printWithNoIndent("<") + var first = true + // TODO no commas in some types + typeParameters.forEach { + if (!first) { + p.printWithNoIndent(", ") + } else { + first = false + } + + it.printATypeParameterWithNoIndent() + } + p.printWithNoIndent(">") + p.printWithNoIndent(postfix) } - private fun IrSimpleFunction.printSimpleFunction( - keyword: String, - name: String, - printTypeParametersAndExtensionReceiver: Boolean, - printSignatureAndBody: Boolean - ) { - /* TODO - correspondingProperty - overridden - dispatchReceiverParameter - */ + private fun IrTypeParameter.printATypeParameterWithNoIndent() { + variance.printVarianceWithNoIndent() + if (isReified) p.printWithNoIndent("reified ") - if (options.printFakeOverridesStrategy == FakeOverridesStrategy.NONE && isFakeOverride || - options.printFakeOverridesStrategy == FakeOverridesStrategy.ALL_EXCEPT_ANY && isFakeOverriddenFromAny() - ) { - return + printAnnotationsWithNoIndent() + + p.printWithNoIndent(name.asString()) + + if (superTypes.size == 1) { + p.printWithNoIndent(" : ") + superTypes.single().printTypeWithNoIndent() } + } - printlnAnnotations() - p.print("") - - run { - printModifiersWithNoIndent( - visibility, - isExpect, - modality, - isExternal, - isOverride = overriddenSymbols.isNotEmpty(), // TODO override - isFakeOverride, - isLateinit = INAPPLICABLE, - isTailrec, - isVararg = INAPPLICABLE, - isSuspend, - isInner = INAPPLICABLE, - isInline, - isData = INAPPLICABLE, - isCompanion = INAPPLICABLE, - isFunInterface = INAPPLICABLE, - classKind = INAPPLICABLE_N, - isInfix, - isOperator, - isInterfaceMember = (this@printSimpleFunction.parent as? IrClass)?.isInterface == true - ) + private fun Variance.printVarianceWithNoIndent() { + if (this != Variance.INVARIANT) { + p.printWithNoIndent("$label ") } + } - p.printWithNoIndent(keyword) - - if (printTypeParametersAndExtensionReceiver) printTypeParametersWithNoIndent(postfix = " ") - - if (printTypeParametersAndExtensionReceiver) { - extensionReceiverParameter?.printExtensionReceiverParameter() - } - - p.printWithNoIndent(name) - - if (printSignatureAndBody) { - printValueParametersWithNoIndent() - - if (!returnType.isUnit()) { - p.printWithNoIndent(": ") - returnType.printTypeWithNoIndent() - } - printWhereClauseIfNeededWithNoIndent() + private fun IrAnnotationContainer.printAnnotationsWithNoIndent() { + annotations.forEach { + it.printAnAnnotationWithNoIndent() p.printWithNoIndent(" ") + } + } - body?.accept(this@KotlinLikeDumper, null) - } else { + private fun IrAnnotationContainer.printlnAnnotations(prefix: String = "") { + annotations.forEach { + p.printIndent() + it.printAnAnnotationWithNoIndent(prefix) p.printlnWithNoIndent() } } + private fun IrConstructorCall.printAnAnnotationWithNoIndent(prefix: String = "") { + p.printWithNoIndent("@" + (if (prefix.isEmpty()) "" else "$prefix:")) + visitConstructorCall(this, null) + } + + private fun IrTypeParametersContainer.printWhereClauseIfNeededWithNoIndent() { + if (typeParameters.none { it.superTypes.size > 1 }) return + + p.printWithNoIndent(" where ") + + var first = true + typeParameters.forEach { + if (it.superTypes.size > 1) { + // TODO no test with more than one generic parameter with more supertypes + first = it.printWhereClauseTypesWithNoIndent(first) + } + } + } + + private fun IrTypeParameter.printWhereClauseTypesWithNoIndent(first: Boolean): Boolean { + var myFirst = first + superTypes.forEachIndexed { i, superType -> + if (!myFirst) { + p.printWithNoIndent(", ") + } else { + myFirst = false + } + + p.printWithNoIndent(name.asString()) + p.printWithNoIndent(" : ") + superType.printTypeWithNoIndent() + } + + return myFirst + } + + private fun IrType.printTypeWithNoIndent() { + // TODO don't print `Any?` upper bound? + printAnnotationsWithNoIndent() + when (this) { + is IrSimpleType -> { + // TODO abbreviation + + p.printWithNoIndent((classifier.owner as IrDeclarationWithName).name.asString()) + + if (arguments.isNotEmpty()) { + p.printWithNoIndent("<") + var first = true + arguments.forEach { + if (!first) { + p.printWithNoIndent(", ") + } else { + first = false + } + + when (it) { + is IrStarProjection -> + p.printWithNoIndent("*") + is IrTypeProjection -> { + it.variance.printVarianceWithNoIndent() + it.type.printTypeWithNoIndent() + } + } + } + p.printWithNoIndent(">") + } + + if (hasQuestionMark) p.printWithNoIndent("?") + } + is IrDynamicType -> + p.printWithNoIndent("dynamic") + is IrErrorType -> + p.printWithNoIndent("ErrorType /* ERROR */") + else -> + p.printWithNoIndent("??? /* ERROR: unknown type: ${this.javaClass.simpleName} */") + } + } + override fun visitTypeAlias(declaration: IrTypeAlias, data: IrDeclaration?) { declaration.printlnAnnotations() p.printIndent() @@ -639,6 +515,121 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printlnWithNoIndent() } + private fun IrSimpleFunction.printSimpleFunction( + keyword: String, + name: String, + printTypeParametersAndExtensionReceiver: Boolean, + printSignatureAndBody: Boolean + ) { + /* TODO + correspondingProperty + overridden + dispatchReceiverParameter + */ + + if (options.printFakeOverridesStrategy == FakeOverridesStrategy.NONE && isFakeOverride || + options.printFakeOverridesStrategy == FakeOverridesStrategy.ALL_EXCEPT_ANY && isFakeOverriddenFromAny() + ) { + return + } + + printlnAnnotations() + p.print("") + + run { + printModifiersWithNoIndent( + visibility, + isExpect, + modality, + isExternal, + isOverride = overriddenSymbols.isNotEmpty(), // TODO override + isFakeOverride, + isLateinit = INAPPLICABLE, + isTailrec, + isVararg = INAPPLICABLE, + isSuspend, + isInner = INAPPLICABLE, + isInline, + isData = INAPPLICABLE, + isCompanion = INAPPLICABLE, + isFunInterface = INAPPLICABLE, + classKind = INAPPLICABLE_N, + isInfix, + isOperator, + isInterfaceMember = (this@printSimpleFunction.parent as? IrClass)?.isInterface == true + ) + } + + p.printWithNoIndent(keyword) + + if (printTypeParametersAndExtensionReceiver) printTypeParametersWithNoIndent(postfix = " ") + + if (printTypeParametersAndExtensionReceiver) { + extensionReceiverParameter?.printExtensionReceiverParameter() + } + + p.printWithNoIndent(name) + + if (printSignatureAndBody) { + printValueParametersWithNoIndent() + + if (!returnType.isUnit()) { + p.printWithNoIndent(": ") + returnType.printTypeWithNoIndent() + } + printWhereClauseIfNeededWithNoIndent() + p.printWithNoIndent(" ") + + body?.accept(this@KotlinLikeDumper, null) + } else { + p.printlnWithNoIndent() + } + } + + private fun IrValueParameter.printExtensionReceiverParameter() { + type.printTypeWithNoIndent() + p.printWithNoIndent(".") + } + + private fun IrFunction.printValueParametersWithNoIndent() { + p.printWithNoIndent("(") + var first = true + valueParameters.forEach { + if (!first) { + p.printWithNoIndent(", ") + } else { + first = false + } + + it.printAValueParameterWithNoIndent(this) + } + p.printWithNoIndent(")") + } + + private fun IrValueParameter.printAValueParameterWithNoIndent(data: IrDeclaration?) { + printAnnotationsWithNoIndent() + + printParameterModifiersWithNoIndent( + isVararg = varargElementType != null, + isCrossinline, + isNoinline, + // TODO no test + isHidden, + // TODO no test + isAssignable + ) + + p.printWithNoIndent(name.asString()) + p.printWithNoIndent(": ") + (varargElementType ?: type).printTypeWithNoIndent() + // TODO print it.type too for varargs? + + defaultValue?.let { v -> + p.printWithNoIndent(" = ") + v.accept(this@KotlinLikeDumper, data) + } + } + override fun visitTypeParameter(declaration: IrTypeParameter, data: IrDeclaration?) { declaration.printATypeParameterWithNoIndent() if (declaration.superTypes.size > 1) declaration.printWhereClauseTypesWithNoIndent(true) @@ -800,14 +791,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } } - private fun printVariable(isVar: Boolean, name: Name, type: IrType) { - p.printWithNoIndent(if (isVar) "var" else "val") - p.printWithNoIndent(" ") - p.printWithNoIndent(name.asString()) - p.printWithNoIndent(": ") - type.printTypeWithNoIndent() - } - override fun visitLocalDelegatedProperty(declaration: IrLocalDelegatedProperty, data: IrDeclaration?) { declaration.printlnAnnotations() p.printIndent() @@ -828,6 +811,14 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printlnWithNoIndent() } + private fun printVariable(isVar: Boolean, name: Name, type: IrType) { + p.printWithNoIndent(if (isVar) "var" else "val") + p.printWithNoIndent(" ") + p.printWithNoIndent(name.asString()) + p.printWithNoIndent(": ") + type.printTypeWithNoIndent() + } + override fun visitExpressionBody(body: IrExpressionBody, data: IrDeclaration?) { // TODO should we print something here? body.expression.accept(this, data) @@ -897,43 +888,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption ) } - override fun visitDelegatingConstructorCall(expression: IrDelegatingConstructorCall, data: IrDeclaration?) { - // TODO skip call to Any? - expression.printConstructorCallWithNoIndent(data) - } - - override fun visitEnumConstructorCall(expression: IrEnumConstructorCall, data: IrDeclaration?) { - // TODO skip call to Enum? - expression.printConstructorCallWithNoIndent(data) - } - - private fun IrFunctionAccessExpression.printConstructorCallWithNoIndent( - data: IrDeclaration? - ) { - // TODO flag to omit comment block? - val delegatingClass = symbol.owner.parentAsClass - val currentClass = data?.parentAsClass - val delegatingClassName = delegatingClass.name.asString() - - val name = if (data is IrConstructor) { - when (currentClass) { - null -> "delegating/*$delegatingClassName*/" - delegatingClass -> "this/*$delegatingClassName*/" - else -> "super/*$delegatingClassName*/" - } - } else { - delegatingClassName // required only for IrEnumConstructorCall - } - - printMemberAccessExpressionWithNoIndent( - name, - symbol.owner.valueParameters, - superQualifierSymbol = null, - omitAllBracketsIfNoArguments = false, - data = data, - ) - } - private fun IrMemberAccessExpression<*>.printMemberAccessExpressionWithNoIndent( name: String, valueParameters: List, @@ -1027,6 +981,43 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption if (wrapArguments) p.printWithNoIndent("*/") } + override fun visitDelegatingConstructorCall(expression: IrDelegatingConstructorCall, data: IrDeclaration?) { + // TODO skip call to Any? + expression.printConstructorCallWithNoIndent(data) + } + + override fun visitEnumConstructorCall(expression: IrEnumConstructorCall, data: IrDeclaration?) { + // TODO skip call to Enum? + expression.printConstructorCallWithNoIndent(data) + } + + private fun IrFunctionAccessExpression.printConstructorCallWithNoIndent( + data: IrDeclaration? + ) { + // TODO flag to omit comment block? + val delegatingClass = symbol.owner.parentAsClass + val currentClass = data?.parentAsClass + val delegatingClassName = delegatingClass.name.asString() + + val name = if (data is IrConstructor) { + when (currentClass) { + null -> "delegating/*$delegatingClassName*/" + delegatingClass -> "this/*$delegatingClassName*/" + else -> "super/*$delegatingClassName*/" + } + } else { + delegatingClassName // required only for IrEnumConstructorCall + } + + printMemberAccessExpressionWithNoIndent( + name, + symbol.owner.valueParameters, + superQualifierSymbol = null, + omitAllBracketsIfNoArguments = false, + data = data, + ) + } + override fun visitInstanceInitializerCall(expression: IrInstanceInitializerCall, data: IrDeclaration?) { // TODO assert that `expression.classSymbol.owner == data.parentAsClass // TODO better rendering @@ -1398,7 +1389,17 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption super.visitSuspensionPoint(expression, data) } + private fun p(condition: Boolean, s: String) { + if (condition) p.printWithNoIndent("$s ") + } + + private fun p(value: T?, defaultValue: T? = null, getString: T.() -> String) { + if (value == null) return + p(value != defaultValue, value.getString()) + } + private fun commentBlock(text: String) = "/* $text */" + private fun commentBlockH(text: String) = "/* $text */" private companion object { From 92dda5cd92e58b65013f8bf1c87e32f7fc34881c Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Fri, 13 Nov 2020 18:22:22 +0300 Subject: [PATCH 180/698] [IR] KotlinLikeDumper.kt: cleanup --- .../kotlin/ir/util/KotlinLikeDumper.kt | 155 +++++++----------- 1 file changed, 62 insertions(+), 93 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index fb84b39ac59..92d0b4adf0d 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -16,28 +16,6 @@ import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.types.Variance import org.jetbrains.kotlin.utils.Printer -// TODO look at -// IrSourcePrinter.kt -- androidx-master-dev/frameworks/support/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/IrSourcePrinter.kt -// DumpIrTree.kt -- compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DumpIrTree.kt -// RenderIrElement.kt -- - -/* TODO - * origin : class, function, property, ... - * don't print any members in interfaces? // or just print something like /* Any members */ - * @(...) Function2 // (...) -> ... - * IrEnumEntryImpl - * replace `if (cond) p.printWithNoIndent(something)` with `p(cond, something)` - * use FQNs? - * don't print coercion to Unit on top level? blocks? - * name & ordinal in enums - * special render for accessors? - * FlexibleNullability - * ExtensionFunctionType - * don't crash on unbound symbols - * unique ids for symbols, or SignatureID? - * "normalize" names for tmps? - */ - fun IrElement.dumpKotlinLike(options: KotlinLikeDumpOptions = KotlinLikeDumpOptions()): String { val sb = StringBuilder() accept(KotlinLikeDumper(Printer(sb, 1, " "), options), null) @@ -49,14 +27,14 @@ class KotlinLikeDumpOptions( val printFileName: Boolean = true, val printFilePath: Boolean = true, val useNamedArguments: Boolean = false, - val labelStrategy: LabelPrintingStrategy = LabelPrintingStrategy.NEVER, + val labelPrintingStrategy: LabelPrintingStrategy = LabelPrintingStrategy.NEVER, val printFakeOverridesStrategy: FakeOverridesStrategy = FakeOverridesStrategy.ALL, /* - visibility? - modality - special names? - print fake overrides + TODO add more options: + always print visibility? omit local visibility? + always print modality + print special names as is, and other strategies? print body for default accessors print get/set for default accessors print type of expressions @@ -77,11 +55,33 @@ enum class FakeOverridesStrategy { NONE } +/* TODO: + * don't crash on unbound symbols + * origin : class, function, property, ... + * option? + * don't print members of kotlin.Any in interfaces? // or just print something like /* Any members */ + * option? + * use lambda syntax for FunctionN, including extension lambdas (@ExtensionFunctionType) + * option? + * use FQNs? + * option? + * don't print coercion to Unit on top level? and inside blocks? + * option? + * special render for call site of accessors? + * option? + * FlexibleNullability is it about `T!`? + * option? + * unique ids for symbols, or SignatureID? + * option? + * "normalize" names for tmps? ^^ Could unique ids help? + * wrap/escape invalid identifiers with "`", like "$$delegate" + */ + private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOptions) : IrElementVisitor { override fun visitElement(element: IrElement, data: IrDeclaration?) { val e = "/* ERROR: unsupported element type: " + element.javaClass.simpleName + " */" if (element is IrExpression) { - // TODO message? + // TODO move text to the message? // TODO better process expressions and statements p.printlnWithNoIndent("error(\"\") $e") } else { @@ -123,9 +123,8 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption override fun visitClass(declaration: IrClass, data: IrDeclaration?) { // TODO omit super class for enums, annotations? // TODO omit Companion name for companion objects? - // TODO thisReceiver - // TODO primary constructor? - // TODO special support for objects + // TODO do we need to print info about `thisReceiver`? + // TODO special support for objects? declaration.printlnAnnotations() p.printIndent() @@ -158,16 +157,10 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption declaration.printTypeParametersWithNoIndent() if (declaration.superTypes.isNotEmpty()) { - var first = true - for (type in declaration.superTypes) { + for ((i, type) in declaration.superTypes.withIndex()) { if (type.isAny()) continue - if (!first) { - p.printWithNoIndent(", ") - } else { - p.printWithNoIndent(" : ") - first = false - } + p.printWithNoIndent(if (i > 0) ", " else " : ") type.printTypeWithNoIndent() } @@ -239,7 +232,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } p(modality, defaultModality) { name.toLowerCase() } p(isExternal, "external") - p(isFakeOverride, "fake") // TODO + p(isFakeOverride, "fake") p(isOverride, "override") p(isLateinit, "lateinit") p(isTailrec, "tailrec") @@ -284,16 +277,10 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption if (typeParameters.isEmpty()) return p.printWithNoIndent("<") - var first = true - // TODO no commas in some types - typeParameters.forEach { - if (!first) { - p.printWithNoIndent(", ") - } else { - first = false - } + typeParameters.forEachIndexed { i, typeParam -> + p(i > 0, ",") - it.printATypeParameterWithNoIndent() + typeParam.printATypeParameterWithNoIndent() } p.printWithNoIndent(">") p.printWithNoIndent(postfix) @@ -301,7 +288,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption private fun IrTypeParameter.printATypeParameterWithNoIndent() { variance.printVarianceWithNoIndent() - if (isReified) p.printWithNoIndent("reified ") + p(isReified, "reified") printAnnotationsWithNoIndent() @@ -355,7 +342,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption private fun IrTypeParameter.printWhereClauseTypesWithNoIndent(first: Boolean): Boolean { var myFirst = first - superTypes.forEachIndexed { i, superType -> + superTypes.forEach { type -> if (!myFirst) { p.printWithNoIndent(", ") } else { @@ -364,14 +351,14 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printWithNoIndent(name.asString()) p.printWithNoIndent(" : ") - superType.printTypeWithNoIndent() + type.printTypeWithNoIndent() } return myFirst } private fun IrType.printTypeWithNoIndent() { - // TODO don't print `Any?` upper bound? + // TODO don't print `Any?` as upper bound? printAnnotationsWithNoIndent() when (this) { is IrSimpleType -> { @@ -381,20 +368,15 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption if (arguments.isNotEmpty()) { p.printWithNoIndent("<") - var first = true - arguments.forEach { - if (!first) { - p.printWithNoIndent(", ") - } else { - first = false - } + arguments.forEachIndexed { i, typeArg -> + p(i > 0, ",") - when (it) { + when (typeArg) { is IrStarProjection -> p.printWithNoIndent("*") is IrTypeProjection -> { - it.variance.printVarianceWithNoIndent() - it.type.printTypeWithNoIndent() + typeArg.variance.printVarianceWithNoIndent() + typeArg.type.printTypeWithNoIndent() } } } @@ -421,7 +403,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printWithNoIndent("typealias ") p.printWithNoIndent(declaration.name.asString()) - // TODO IrDump doesn't have typeparameters declaration.printTypeParametersWithNoIndent() p.printWithNoIndent(" = ") declaration.expandedType.printTypeWithNoIndent() @@ -449,11 +430,11 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } override fun visitAnonymousInitializer(declaration: IrAnonymousInitializer, data: IrDeclaration?) { - // Looks like IrAnonymousInitializer has annotations accidentally. No tests. + // TODO no tests, looks like IrAnonymousInitializer has annotations accidentally. declaration.printlnAnnotations() p.printIndent() - // TODO looks like there are no irText tests for isStatic flag + // TODO no tests, looks like there are no irText tests for isStatic flag p(declaration.isStatic, commentBlockH("static")) p.printWithNoIndent("init ") declaration.body.accept(this, declaration) @@ -472,7 +453,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } override fun visitConstructor(declaration: IrConstructor, data: IrDeclaration?) { - // TODO primary!!! // TODO name? // TODO is it worth to merge code for IrConstructor and IrSimpleFunction? // TODO dispatchReceiverParameter -- outer `this` for inner classes @@ -542,7 +522,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption isExpect, modality, isExternal, - isOverride = overriddenSymbols.isNotEmpty(), // TODO override + isOverride = overriddenSymbols.isNotEmpty(), isFakeOverride, isLateinit = INAPPLICABLE, isTailrec, @@ -593,15 +573,10 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption private fun IrFunction.printValueParametersWithNoIndent() { p.printWithNoIndent("(") - var first = true - valueParameters.forEach { - if (!first) { - p.printWithNoIndent(", ") - } else { - first = false - } + valueParameters.forEachIndexed { i, param -> + p(i > 0, ",") - it.printAValueParameterWithNoIndent(this) + param.printAValueParameterWithNoIndent(this) } p.printWithNoIndent(")") } @@ -647,7 +622,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printIndent() // TODO better rendering for modifiers on property and accessors - // modifiers that could be different between accessors and property have a comment + // modifiers that could be different between accessors and property have a comment declaration.run { printModifiersWithNoIndent( // accessors by default have same visibility, but the can define own value @@ -675,7 +650,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption ) } - // TODO don't print borrowed flags and assert that they are same with setter(???) or don't borrow? + // TODO don't print borrowed flags and assert that they are same with a setter or don't borrow? // TODO we can omit type for set parameter p(declaration.isConst, "const") @@ -877,7 +852,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } override fun visitConstructorCall(expression: IrConstructorCall, data: IrDeclaration?) { - // TODO could constructors have receiver? val clazz = expression.symbol.owner.parentAsClass expression.printMemberAccessExpressionWithNoIndent( clazz.name.asString(), @@ -917,9 +891,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption if (superQualifierSymbol == null) it.accept(this@KotlinLikeDumper, data) // else assert dispatchReceiver === this } - if (twoReceivers) { - p.printWithNoIndent(", ") - } + p(twoReceivers, ",") extensionReceiver?.accept(this@KotlinLikeDumper, data) if (twoReceivers) { p.printWithNoIndent(")") @@ -948,9 +920,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption if (typeArgumentsCount > 0) { p.printWithNoIndent("<") repeat(typeArgumentsCount) { - if (it > 0) { - p.printWithNoIndent(", ") - } + p(it > 0, ",") // TODO flag to print type param name? getTypeArgument(it)!!.printTypeWithNoIndent() } @@ -970,7 +940,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption repeat(valueArgumentsCount) { i -> // TODO should we print something for omitted arguments (== null)? getValueArgument(i)?.let { - if (i > 0) p.printWithNoIndent(", ") + p(i > 0, ",") // TODO flag to print param name p.printWithNoIndent(valueParameters[i].name.asString() + " = ") it.accept(this@KotlinLikeDumper, data) @@ -1097,6 +1067,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption override fun visitReturn(expression: IrReturn, data: IrDeclaration?) { // TODO label + // TODO optionally don't print Unit when return type of returnTargetSymbol is Unit p.printWithNoIndent("return ") expression.value.accept(this, data) } @@ -1107,12 +1078,10 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } override fun visitStringConcatenation(expression: IrStringConcatenation, data: IrDeclaration?) { - // TODO escape? see IrTextTestCaseGenerated.Expressions#testStringTemplates + // TODO escape char symbols, use triple quotes when possible, see IrTextTestCaseGenerated.Expressions#testStringTemplates // TODO optionally each argument at a separate line, another option add a wrapping expression.arguments.forEachIndexed { i, e -> - if (i > 0) { - p.printWithNoIndent(" + ") - } + p(i > 0, " +") e.accept(this, data) } } @@ -1137,11 +1106,11 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } override fun visitVararg(expression: IrVararg, data: IrDeclaration?) { - // TODO ??? + // TODO better rendering? // TODO varargElementType p.printWithNoIndent("[") expression.elements.forEachIndexed { i, e -> - if (i > 0) p.printWithNoIndent(", ") + p(i > 0, ",") e.accept(this, data) } p.printWithNoIndent("]") @@ -1341,7 +1310,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption expression.receiver.accept(this, data) p.printWithNoIndent(s.first) expression.arguments.forEachIndexed { i, e -> - if (i > 0) p.printWithNoIndent(", ") + p(i > 0, ",") e.accept(this, data) } p.printWithNoIndent(s.second) From 0f10b5eb9e415ca1d7a70b590153efba98009e62 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 17 Nov 2020 02:17:01 +0300 Subject: [PATCH 181/698] [IR] KotlinLikeDumper: escape special symbols in Char and String constant values --- .../jetbrains/kotlin/ir/util/KotlinLikeDumper.kt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index 92d0b4adf0d..208844f60da 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.ir.util +import com.intellij.openapi.util.text.StringUtil import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.declarations.* @@ -1078,7 +1079,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } override fun visitStringConcatenation(expression: IrStringConcatenation, data: IrDeclaration?) { - // TODO escape char symbols, use triple quotes when possible, see IrTextTestCaseGenerated.Expressions#testStringTemplates + // TODO use triple quotes when possible? // TODO optionally each argument at a separate line, another option add a wrapping expression.arguments.forEachIndexed { i, e -> p(i > 0, " +") @@ -1102,7 +1103,15 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption is IrConstKind.Double -> "" to "D" } - p.printWithNoIndent(prefix, expression.value ?: "null", postfix) + val value = expression.value.toString() + val safeValue = when (kind) { + // TODO no tests for escaping quotes (',") + is IrConstKind.Char -> StringUtil.escapeCharCharacters(value) + is IrConstKind.String -> StringUtil.escapeStringCharacters(value) + else -> value + } + + p.printWithNoIndent(prefix, safeValue, postfix) } override fun visitVararg(expression: IrVararg, data: IrDeclaration?) { From 503370c9c2f18e9c60f527e4279e744f6ba37342 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 17 Nov 2020 02:17:25 +0300 Subject: [PATCH 182/698] [IR] update testdata: escape special symbols in Char and String constant values --- .../ir/irText/expressions/kt28006.kt.txt | 18 +++++++++--------- .../irText/expressions/stringTemplates.kt.txt | 4 +--- .../coercionToUnitForNestedWhen.kt.txt | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/compiler/testData/ir/irText/expressions/kt28006.kt.txt b/compiler/testData/ir/irText/expressions/kt28006.kt.txt index c0301248356..487c63c15b7 100644 --- a/compiler/testData/ir/irText/expressions/kt28006.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt28006.kt.txt @@ -1,36 +1,36 @@ val test1: String - field = "🤗" + field = "\uD83E\uDD17" get val test2: String - field = "🤗🤗" + field = "\uD83E\uDD17\uD83E\uDD17" get const val testConst1: String - field = "🤗" + field = "\uD83E\uDD17" get const val testConst2: String - field = "🤗🤗" + field = "\uD83E\uDD17\uD83E\uDD17" get const val testConst3: String - field = "🤗🤗🤗" + field = "\uD83E\uDD17\uD83E\uDD17\uD83E\uDD17" get const val testConst4: String - field = "🤗🤗🤗🤗" + field = "\uD83E\uDD17\uD83E\uDD17\uD83E\uDD17\uD83E\uDD17" get fun test1(x: Int): String { - return "🤗" + x + return "\uD83E\uDD17" + x } fun test2(x: Int): String { - return x + "🤗" + return x + "\uD83E\uDD17" } fun test3(x: Int): String { - return x + "🤗" + x + return x + "\uD83E\uDD17" + x } diff --git a/compiler/testData/ir/irText/expressions/stringTemplates.kt.txt b/compiler/testData/ir/irText/expressions/stringTemplates.kt.txt index 7a8f1c46f28..a33e42997c2 100644 --- a/compiler/testData/ir/irText/expressions/stringTemplates.kt.txt +++ b/compiler/testData/ir/irText/expressions/stringTemplates.kt.txt @@ -23,9 +23,7 @@ val test4: String get val test5: String - field = " -abc -" + field = "\nabc\n" get val test6: String diff --git a/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt b/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt index c43634f4f08..b6145c87e15 100644 --- a/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt +++ b/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt.txt @@ -1,5 +1,5 @@ private const val BACKSLASH: Char - field = '\' + field = '\\' private get private fun Reader.nextChar(): Char? { From f9fe82e735d1778a882f477fff40f24e9daaba95 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 17 Nov 2020 02:18:50 +0300 Subject: [PATCH 183/698] [IR] KotlinLikeDumper: process specially when IrElseBranch's condition is not `true` constant --- .../src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index 208844f60da..cfce8015a99 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -1173,8 +1173,13 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption override fun visitElseBranch(branch: IrElseBranch, data: IrDeclaration?) { p.printIndent() - // TODO assert that condition is `true` - p.printWithNoIndent("else -> ") + if ((branch.condition as? IrConst<*>)?.value == true) { + p.printWithNoIndent("else") + } else { + p.printWithNoIndent("/* else */ ") + branch.condition.accept(this, data) + } + p.printWithNoIndent(" -> ") branch.result.accept(this, data) p.println() } From ad0f154ed1f9ef88eee54a890bd83ccff066b217 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 17 Nov 2020 02:40:32 +0300 Subject: [PATCH 184/698] [IR] add new testdata after rebase --- .../testData/ir/irText/classes/kt43217.kt.txt | 41 +++++++++++++++++++ ...siveCapturedTypeInPropertyReference.kt.txt | 23 +++++++++++ 2 files changed, 64 insertions(+) create mode 100644 compiler/testData/ir/irText/classes/kt43217.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/recursiveCapturedTypeInPropertyReference.kt.txt diff --git a/compiler/testData/ir/irText/classes/kt43217.kt.txt b/compiler/testData/ir/irText/classes/kt43217.kt.txt new file mode 100644 index 00000000000..a094ba43c2d --- /dev/null +++ b/compiler/testData/ir/irText/classes/kt43217.kt.txt @@ -0,0 +1,41 @@ +class A { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + private val b: + field = { // BLOCK + local class : DoubleExpression { + constructor() /* primary */ { + super/*DoubleExpression*/() + /* () */ + + } + + override fun get(): Double { + return 0.0D + } + + } + + () + } + private get + +} + +class C : DoubleExpression { + constructor() /* primary */ { + super/*DoubleExpression*/() + /* () */ + + } + + override fun get(): Double { + return 0.0D + } + +} + diff --git a/compiler/testData/ir/irText/firProblems/recursiveCapturedTypeInPropertyReference.kt.txt b/compiler/testData/ir/irText/firProblems/recursiveCapturedTypeInPropertyReference.kt.txt new file mode 100644 index 00000000000..f8dbe9e5048 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/recursiveCapturedTypeInPropertyReference.kt.txt @@ -0,0 +1,23 @@ +interface Something { + +} + +interface Recursive where R : Recursive, R : Something { + abstract val symbol: AbstractSymbol + abstract get + +} + +abstract class AbstractSymbol where E : Recursive, E : Something { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + fun foo(list: List) { + val result: List>> = list.filterIsInstance>().map, AbstractSymbol>>(transform = Recursive::symbol) + } + +} + From 36591ba5f73365ff30eef2a914c41a3a6dd8f3ac Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 17 Nov 2020 02:59:37 +0300 Subject: [PATCH 185/698] [IR] KotlinLikeDumper: replace all usages of commentBlockH with commentBlock --- .../src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt index cfce8015a99..12f0d3fe34a 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt @@ -436,7 +436,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printIndent() // TODO no tests, looks like there are no irText tests for isStatic flag - p(declaration.isStatic, commentBlockH("static")) + p(declaration.isStatic, commentBlock("static")) p.printWithNoIndent("init ") declaration.body.accept(this, declaration) @@ -491,7 +491,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption declaration.printValueParametersWithNoIndent() declaration.printWhereClauseIfNeededWithNoIndent() p.printWithNoIndent(" ") - p(declaration.isPrimary, commentBlockH("primary")) + p(declaration.isPrimary, commentBlock("primary")) declaration.body?.accept(this, declaration) p.printlnWithNoIndent() } @@ -1383,8 +1383,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption private fun commentBlock(text: String) = "/* $text */" - private fun commentBlockH(text: String) = "/* $text */" - private companion object { private const val INAPPLICABLE = false private val INAPPLICABLE_N = null From 2773e4baca01ec3e0cced7b3cf6b9d0e6f33a59b Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Fri, 20 Nov 2020 16:47:49 +0300 Subject: [PATCH 186/698] [IR] KotlinLikeDumper.kt -> dumpKotlinLike.kt --- .../kotlin/ir/util/{KotlinLikeDumper.kt => dumpKotlinLike.kt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/{KotlinLikeDumper.kt => dumpKotlinLike.kt} (100%) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt similarity index 100% rename from compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinLikeDumper.kt rename to compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt From 43ee50b91d481c0c625d1a650424acb26e19ae43 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Fri, 20 Nov 2020 17:00:48 +0300 Subject: [PATCH 187/698] [IR] update testdata after rebase --- .../annotations/inheritingDeprecation.kt.txt | 63 +++++++++++++++++++ .../ir/irText/expressions/kt37570.kt.txt | 2 +- .../objectByNameInsideObject.kt.txt | 33 ++++++++++ .../irText/firProblems/AllCandidates.kt.txt | 2 +- .../firProblems/throwableStackTrace.kt.txt | 4 ++ .../ir/irText/lambdas/extensionLambda.kt.txt | 2 +- .../lambdas/multipleImplicitReceivers.kt.txt | 2 +- .../ir/irText/stubs/builtinMap.kt.txt | 2 +- .../castsInsideCoroutineInference.kt.txt | 10 +-- 9 files changed, 110 insertions(+), 10 deletions(-) create mode 100644 compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/objectByNameInsideObject.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/throwableStackTrace.kt.txt diff --git a/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.kt.txt b/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.kt.txt new file mode 100644 index 00000000000..e8c7b83bd78 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.kt.txt @@ -0,0 +1,63 @@ +interface IFoo { + @Deprecated(message = "") + val prop: String + get(): String { + return "" + } + + @Deprecated(message = "") + val String.extProp: String + get(): String { + return "" + } + +} + +class Delegated : IFoo { + constructor(foo: IFoo) /* primary */ { + super/*Any*/() + /* () */ + + } + + private /*final field*/ val $$delegate_0: IFoo = foo + override val String.extProp: String + override get(): String { + return (.#$$delegate_0, ).() + } + + override val prop: String + override get(): String { + return .#$$delegate_0.() + } + +} + +class DefaultImpl : IFoo { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +class ExplicitOverride : IFoo { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + override val prop: String + override get(): String { + return "" + } + + override val String.extProp: String + override get(): String { + return "" + } + +} + diff --git a/compiler/testData/ir/irText/expressions/kt37570.kt.txt b/compiler/testData/ir/irText/expressions/kt37570.kt.txt index 9aaad6bc15a..ed1901631b0 100644 --- a/compiler/testData/ir/irText/expressions/kt37570.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt37570.kt.txt @@ -14,7 +14,7 @@ class A { init { a().apply(block = local fun String.() { - .#b = + .#b = $this$apply } ) /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/objectByNameInsideObject.kt.txt b/compiler/testData/ir/irText/expressions/objectByNameInsideObject.kt.txt new file mode 100644 index 00000000000..a0a73d61825 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/objectByNameInsideObject.kt.txt @@ -0,0 +1,33 @@ +open class Base { + constructor(f1: Function0) /* primary */ { + super/*Any*/() + /* () */ + + } + + val f1: Function0 + field = f1 + get + +} + +object Thing : Base { + private constructor() /* primary */ { + super/*Base*/(f1 = local fun (): Any { + return Thing + } +) + /* () */ + + } + + fun test1(): Thing { + return Thing + } + + fun test2(): Thing { + return + } + +} + diff --git a/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt b/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt index 05f10d40798..0ace4e94f32 100644 --- a/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt +++ b/compiler/testData/ir/irText/firProblems/AllCandidates.kt.txt @@ -22,7 +22,7 @@ class MyCandidate { private fun allCandidatesResult(allCandidates: Collection): @FlexibleNullability OverloadResolutionResultsImpl<@FlexibleNullability A?>? { return nameNotFound<@FlexibleNullability A?>().apply<@FlexibleNullability OverloadResolutionResultsImpl<@FlexibleNullability A?>?>(block = local fun @FlexibleNullability OverloadResolutionResultsImpl<@FlexibleNullability A?>?.() { - /*!! OverloadResolutionResultsImpl<@FlexibleNullability A?> */.setAllCandidates<@FlexibleNullability A?>(allCandidates = allCandidates.map>(transform = local fun (it: MyCandidate): ResolvedCall { + $this$apply /*!! OverloadResolutionResultsImpl<@FlexibleNullability A?> */.setAllCandidates<@FlexibleNullability A?>(allCandidates = allCandidates.map>(transform = local fun (it: MyCandidate): ResolvedCall { return it.() as ResolvedCall } )) diff --git a/compiler/testData/ir/irText/firProblems/throwableStackTrace.kt.txt b/compiler/testData/ir/irText/firProblems/throwableStackTrace.kt.txt new file mode 100644 index 00000000000..d1a6dd83c81 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/throwableStackTrace.kt.txt @@ -0,0 +1,4 @@ +fun foo(t: Throwable) { + t.setStackTrace(p0 = t.getStackTrace()) +} + diff --git a/compiler/testData/ir/irText/lambdas/extensionLambda.kt.txt b/compiler/testData/ir/irText/lambdas/extensionLambda.kt.txt index 28590b02683..b353ca3f2b1 100644 --- a/compiler/testData/ir/irText/lambdas/extensionLambda.kt.txt +++ b/compiler/testData/ir/irText/lambdas/extensionLambda.kt.txt @@ -1,6 +1,6 @@ fun test1(): Int { return "42".run(block = local fun String.(): Int { - return .() + return $this$run.() } ) } diff --git a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt index 994146b75c1..c44b81ee74d 100644 --- a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt +++ b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.kt.txt @@ -35,7 +35,7 @@ fun test(fooImpl: IFoo, invokeImpl: IInvoke) { with(receiver = A, block = local fun A.(): Int { return with(receiver = fooImpl, block = local fun IFoo.(): Int { return with(receiver = invokeImpl, block = local fun IInvoke.(): Int { - return (, (, ).()).invoke() + return ($this$with, ($this$with, $this$with).()).invoke() } ) } diff --git a/compiler/testData/ir/irText/stubs/builtinMap.kt.txt b/compiler/testData/ir/irText/stubs/builtinMap.kt.txt index 1d81be4db90..ab00f71891f 100644 --- a/compiler/testData/ir/irText/stubs/builtinMap.kt.txt +++ b/compiler/testData/ir/irText/stubs/builtinMap.kt.txt @@ -2,7 +2,7 @@ fun Map.plus(pair: Pair): Map return when { .isEmpty() -> mapOf(pair = pair) else -> LinkedHashMap<@FlexibleNullability K1?, @FlexibleNullability V1?>(p0 = ).apply>(block = local fun LinkedHashMap<@FlexibleNullability K1?, @FlexibleNullability V1?>.() { - .put(key = pair.(), value = pair.()) /*~> Unit */ + $this$apply.put(key = pair.(), value = pair.()) /*~> Unit */ } ) } diff --git a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt index c48ec96ef9d..149e016f412 100644 --- a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt +++ b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.kt.txt @@ -1,9 +1,9 @@ @OptIn(markerClass = [ExperimentalTypeInference::class]) fun scopedFlow(@BuilderInference block: @ExtensionFunctionType SuspendFunction2, Unit>): Flow { return flow(block = local suspend fun FlowCollector.() { - val collector: FlowCollector = + val collector: FlowCollector = $this$flow flowScope(block = local suspend fun CoroutineScope.() { - block.invoke(p1 = , p2 = collector) + block.invoke(p1 = $this$flowScope, p2 = collector) } ) } @@ -12,7 +12,7 @@ fun scopedFlow(@BuilderInference block: @ExtensionFunctionType Suspen fun Flow.onCompletion(action: @ExtensionFunctionType SuspendFunction2, @ParameterName(name = "cause") Throwable?, Unit>): Flow { return unsafeFlow(block = local suspend fun FlowCollector.() { - val safeCollector: SafeCollector = SafeCollector(collector = ) + val safeCollector: SafeCollector = SafeCollector(collector = $this$unsafeFlow) safeCollector.invokeSafely(action = action) } ) @@ -36,7 +36,7 @@ fun Flow.onCompletion(action: SuspendFunction1<@ParameterName(name private fun CoroutineScope.asFairChannel(flow: Flow<*>): ReceiveChannel { return .produce(block = local suspend fun ProducerScope.() { - val channel: ChannelCoroutine = .() as ChannelCoroutine + val channel: ChannelCoroutine = $this$produce.() as ChannelCoroutine flow.collect(action = local suspend fun (value: Any?) { return channel.sendFair(element = { // BLOCK val tmp0_elvis_lhs: Any? = value @@ -54,7 +54,7 @@ private fun CoroutineScope.asFairChannel(flow: Flow<*>): ReceiveChannel { private fun CoroutineScope.asChannel(flow: Flow<*>): ReceiveChannel { return .produce(block = local suspend fun ProducerScope.() { flow.collect(action = local suspend fun (value: Any?) { - return .().send(e = { // BLOCK + return $this$produce.().send(e = { // BLOCK val tmp0_elvis_lhs: Any? = value when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> Any() From dec067af8cb85d7f0eba601800e73f5b404f1126 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Fri, 20 Nov 2020 17:31:15 +0300 Subject: [PATCH 188/698] [IR] stop overwriting testdata for dumpKotlinLike and use assertEqualsToFile --- .../kotlin/ir/AbstractIrTextTestCase.kt | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt index 343146a7b2e..f163f172535 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt @@ -113,6 +113,12 @@ abstract class AbstractIrTextTestCase : AbstractIrGeneratorTestCase() { KotlinTestUtils.assertEqualsToFile(irTreeFileLabel.expectedTextFile, actualTrees) verify(irFile) + // Check that deep copy produces an equivalent result + val irFileCopy = irFile.deepCopyWithSymbols() + val copiedTrees = irFileCopy.dumpTreesFromLineNumber(irTreeFileLabel.lineNumber, normalizeNames = true) + TestCase.assertEquals("IR dump mismatch after deep copy with symbols", actualTrees, copiedTrees) + verify(irFileCopy) + val kotlinLikeDump = irFile.dumpKotlinLike( KotlinLikeDumpOptions( printFileName = false, @@ -121,17 +127,7 @@ abstract class AbstractIrTextTestCase : AbstractIrGeneratorTestCase() { ) ) val kotlinLikeDumpExpectedFile = irTreeFileLabel.expectedTextFile.withReplacedExtensionOrNull(".txt", ".kt.txt")!! -// KotlinTestUtils.assertEqualsToFile(kotlinLikeDumpExpectedFile, kotlinLikeDump) - - val kotlinLikeDumpExpectedText = if (kotlinLikeDumpExpectedFile.exists()) kotlinLikeDumpExpectedFile.readText() else "" - kotlinLikeDumpExpectedFile.writeText(kotlinLikeDump) - assertEquals(kotlinLikeDumpExpectedText, kotlinLikeDump) - - // Check that deep copy produces an equivalent result - val irFileCopy = irFile.deepCopyWithSymbols() - val copiedTrees = irFileCopy.dumpTreesFromLineNumber(irTreeFileLabel.lineNumber, normalizeNames = true) - TestCase.assertEquals("IR dump mismatch after deep copy with symbols", actualTrees, copiedTrees) - verify(irFileCopy) + KotlinTestUtils.assertEqualsToFile(kotlinLikeDumpExpectedFile, kotlinLikeDump) } try { From d7bd4240e1a2b4b0e91d42be804ea6f176d44c11 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Fri, 20 Nov 2020 22:17:27 +0300 Subject: [PATCH 189/698] [IR] dumpKotlinLike: don't crash when type argument is null --- .../ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt index 12f0d3fe34a..c7ab1d2fc6d 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt @@ -923,7 +923,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption repeat(typeArgumentsCount) { p(it > 0, ",") // TODO flag to print type param name? - getTypeArgument(it)!!.printTypeWithNoIndent() + getTypeArgument(it)?.printTypeWithNoIndent() ?: p.printWithNoIndent(commentBlock("null")) } p.printWithNoIndent(">") } From c68040753d93740591680de958eef0ef41b5f179 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Fri, 20 Nov 2020 18:18:14 +0300 Subject: [PATCH 190/698] [IR] dumpKotlinLike: add testdata for FIR tests --- .../classes/annotationClasses.fir.kt.txt | 31 +++ ...ringInDelegatingConstructorCall.fir.kt.txt | 44 ++++ .../ir/irText/classes/classes.fir.kt.txt | 39 +++ .../ir/irText/classes/cloneable.fir.kt.txt | 34 +++ .../dataClassWithArrayMembers.fir.kt.txt | 228 ++++++++++++++++++ .../ir/irText/classes/dataClasses.fir.kt.txt | 199 +++++++++++++++ .../classes/dataClassesGeneric.fir.kt.txt | 174 +++++++++++++ .../delegatedGenericImplementation.fir.kt.txt | 73 ++++++ .../delegatedImplementation.fir.kt.txt | 154 ++++++++++++ ...edImplementationOfJavaInterface.fir.kt.txt | 39 +++ ...lementationWithExplicitOverride.fir.kt.txt | 39 +++ ...uctorCallToTypeAliasConstructor.fir.kt.txt | 32 +++ ...torCallsInSecondaryConstructors.fir.kt.txt | 27 +++ .../ir/irText/classes/enum.fir.kt.txt | 174 +++++++++++++ .../classes/enumClassModality.fir.kt.txt | 165 +++++++++++++ .../classes/enumWithMultipleCtors.fir.kt.txt | 60 +++++ .../classes/enumWithSecondaryCtor.fir.kt.txt | 97 ++++++++ ...keOverridesForJavaStaticMembers.fir.kt.txt | 8 + ...otNullOnDelegatedImplementation.fir.kt.txt | 128 ++++++++++ .../irText/classes/initValInLambda.fir.kt.txt | 18 ++ .../ir/irText/classes/inlineClass.fir.kt.txt | 31 +++ .../inlineClassSyntheticMethods.fir.kt.txt | 60 +++++ .../ir/irText/classes/innerClass.fir.kt.txt | 26 ++ ...rClassWithDelegatingConstructor.fir.kt.txt | 25 ++ .../ir/irText/classes/kt31649.fir.kt.txt | 80 ++++++ .../ir/irText/classes/kt43217.fir.kt.txt | 40 +++ ...mbdaInDataClassDefaultParameter.fir.kt.txt | 99 ++++++++ .../objectLiteralExpressions.fir.kt.txt | 94 ++++++++ .../classes/objectWithInitializers.fir.kt.txt | 28 +++ ...tructorWithSuperConstructorCall.fir.kt.txt | 47 ++++ .../classes/qualifiedSuperCalls.fir.kt.txt | 40 +++ .../irText/classes/sealedClasses.fir.kt.txt | 47 ++++ ...orWithInitializersFromClassBody.fir.kt.txt | 47 ++++ .../ir/irText/classes/superCalls.fir.kt.txt | 37 +++ .../classes/superCallsComposed.fir.kt.txt | 40 +++ ...nnotationsInAnnotationArguments.fir.kt.txt | 28 +++ .../annotationsOnDelegatedMembers.fir.kt.txt | 50 ++++ ...tionsWithDefaultParameterValues.fir.kt.txt | 31 +++ ...annotationsWithVarargParameters.fir.kt.txt | 19 ++ .../arrayInAnnotationArguments.fir.kt.txt | 25 ++ .../classLiteralInAnnotation.fir.kt.txt | 20 ++ .../classesWithAnnotations.fir.kt.txt | 71 ++++++ ...xpressionsInAnnotationArguments.fir.kt.txt | 19 ++ .../constructorsWithAnnotations.fir.kt.txt | 22 ++ .../delegateFieldWithAnnotations.fir.kt.txt | 13 + ...ropertyAccessorsWithAnnotations.fir.kt.txt | 47 ++++ .../enumEntriesWithAnnotations.fir.kt.txt | 39 +++ .../enumsInAnnotationArguments.fir.kt.txt | 32 +++ .../fieldsWithAnnotations.fir.kt.txt | 16 ++ .../annotations/fileAnnotations.fir.kt.txt | 11 + .../functionsWithAnnotations.fir.kt.txt | 11 + .../inheritingDeprecation.fir.kt.txt | 64 +++++ ...egatedPropertiesWithAnnotations.fir.kt.txt | 19 ++ ...ipleAnnotationsInSquareBrackets.fir.kt.txt | 20 ++ ...tructorParameterWithAnnotations.fir.kt.txt | 17 ++ .../propertiesWithAnnotations.fir.kt.txt | 12 + ...sFromClassHeaderWithAnnotations.fir.kt.txt | 28 +++ ...ropertyAccessorsWithAnnotations.fir.kt.txt | 34 +++ ...ySetterParameterWithAnnotations.fir.kt.txt | 23 ++ ...eceiverParameterWithAnnotations.fir.kt.txt | 31 +++ ...adOperatorInAnnotationArguments.fir.kt.txt | 11 + .../typeAliasesWithAnnotations.fir.kt.txt | 10 + .../typeParametersWithAnnotations.fir.kt.txt | 8 + .../valueParametersWithAnnotations.fir.kt.txt | 23 ++ .../varargsInAnnotationArguments.fir.kt.txt | 35 +++ .../variablesWithAnnotations.fir.kt.txt | 12 + ...atchParameterInTopLevelProperty.fir.kt.txt | 7 + .../classLevelProperties.fir.kt.txt | 56 +++++ .../delegatedProperties.fir.kt.txt | 48 ++++ .../declarations/fakeOverrides.fir.kt.txt | 35 +++ .../genericDelegatedProperty.fir.kt.txt | 33 +++ .../inlineCollectionOfInlineClass.fir.kt.txt | 108 +++++++++ .../ir/irText/declarations/kt29833.fir.kt.txt | 18 ++ .../ir/irText/declarations/kt35550.fir.kt.txt | 24 ++ .../localClassWithOverrides.fir.kt.txt | 40 +++ .../localDelegatedProperties.fir.kt.txt | 29 +++ .../declarations/localVarInDoWhile.fir.kt.txt | 5 + .../expectClassInherited.fir.kt.txt | 38 +++ .../expectedEnumClass.fir.kt.txt | 29 +++ .../expectedSealedClass.fir.kt.txt | 27 +++ .../packageLevelProperties.fir.kt.txt | 47 ++++ .../parameters/constructor.fir.kt.txt | 80 ++++++ .../parameters/dataClassMembers.fir.kt.txt | 58 +++++ .../parameters/delegatedMembers.fir.kt.txt | 33 +++ .../parameters/lambdas.fir.kt.txt | 26 ++ .../typeParameterBeforeBound.fir.kt.txt | 17 ++ .../typeParameterBoundedBySubclass.fir.kt.txt | 38 +++ .../useNextParamInLambda.fir.kt.txt | 25 ++ .../memberExtension.fir.kt.txt | 39 +++ .../irText/declarations/typeAlias.fir.kt.txt | 14 ++ .../errors/unresolvedReference.fir.kt.txt | 15 ++ .../argumentMappedWithError.fir.kt.txt | 11 + .../irText/expressions/arrayAccess.fir.kt.txt | 11 + .../expressions/arrayAssignment.fir.kt.txt | 12 + .../arrayAugmentedAssignment1.fir.kt.txt | 45 ++++ .../arrayAugmentedAssignment2.fir.kt.txt | 17 ++ .../augmentedAssignment1.fir.kt.txt | 21 ++ .../augmentedAssignment2.fir.kt.txt | 44 ++++ ...gmentedAssignmentWithExpression.fir.kt.txt | 31 +++ .../expressions/badBreakContinue.fir.kt.txt | 28 +++ .../ir/irText/expressions/bangbang.fir.kt.txt | 29 +++ .../expressions/breakContinue.fir.kt.txt | 34 +++ .../breakContinueInLoopHeader.fir.kt.txt | 78 ++++++ .../breakContinueInWhen.fir.kt.txt | 70 ++++++ .../adaptedExtensionFunctions.fir.kt.txt | 32 +++ .../adaptedWithCoercionToUnit.fir.kt.txt | 45 ++++ .../boundInlineAdaptedReference.fir.kt.txt | 18 ++ .../caoWithAdaptationForSam.fir.kt.txt | 97 ++++++++ ...constructorWithAdaptedArguments.fir.kt.txt | 42 ++++ .../callableReferences/kt37131.fir.kt.txt | 28 +++ .../suspendConversion.fir.kt.txt | 99 ++++++++ .../typeArguments.fir.kt.txt | 29 +++ ...erReferenceWithAdaptedArguments.fir.kt.txt | 58 +++++ .../withAdaptationForSam.fir.kt.txt | 18 ++ .../withAdaptedArguments.fir.kt.txt | 71 ++++++ ...thArgumentAdaptationAndReceiver.fir.kt.txt | 68 ++++++ .../withVarargViewedAsArray.fir.kt.txt | 52 ++++ .../catchParameterAccess.fir.kt.txt | 5 + .../expressions/classReference.fir.kt.txt | 15 ++ .../expressions/coercionToUnit.fir.kt.txt | 27 +++ .../complexAugmentedAssignment.fir.kt.txt | 100 ++++++++ ...ructorWithOwnTypeParametersCall.fir.kt.txt | 25 ++ .../conventionComparisons.fir.kt.txt | 24 ++ .../expressions/destructuring1.fir.kt.txt | 31 +++ .../destructuringWithUnderscore.fir.kt.txt | 36 +++ .../ir/irText/expressions/elvis.fir.kt.txt | 63 +++++ .../enumEntryAsReceiver.fir.kt.txt | 40 +++ ...ntryReferenceFromEnumEntryClass.fir.kt.txt | 68 ++++++ .../ir/irText/expressions/equals.fir.kt.txt | 15 ++ .../exhaustiveWhenElseBranch.fir.kt.txt | 119 +++++++++ .../expressions/extFunInvokeAsFun.fir.kt.txt | 7 + .../expressions/extFunSafeInvoke.fir.kt.txt | 9 + .../ir/irText/expressions/field.fir.kt.txt | 13 + .../floatingPointEquals.fir.kt.txt | 115 +++++++++ .../nullableAnyAsIntToDouble.fir.kt.txt | 6 + .../nullableFloatingPointEqeq.fir.kt.txt | 45 ++++ ...erWithPrimitiveNumericSupertype.fir.kt.txt | 64 +++++ .../whenByFloatingPoint.fir.kt.txt | 79 ++++++ .../ir/irText/expressions/for.fir.kt.txt | 40 +++ .../forWithBreakContinue.fir.kt.txt | 57 +++++ .../forWithImplicitReceivers.fir.kt.txt | 51 ++++ .../funInterface/partialSam.fir.kt.txt | 66 +++++ .../samConversionInVarargs.fir.kt.txt | 38 +++ .../samConversionInVarargsMixed.fir.kt.txt | 16 ++ ...amConversionOnCallableReference.fir.kt.txt | 36 +++ .../samConversionsWithSmartCasts.fir.kt.txt | 69 ++++++ ...onstructorCallWithTypeArguments.fir.kt.txt | 23 ++ .../expressions/genericPropertyRef.fir.kt.txt | 70 ++++++ .../ir/irText/expressions/ifElseIf.fir.kt.txt | 39 +++ ...icitCastInReturnFromConstructor.fir.kt.txt | 15 ++ .../implicitCastOnPlatformType.fir.kt.txt | 3 + .../implicitCastToNonNull.fir.kt.txt | 33 +++ .../implicitCastToTypeParameter.fir.kt.txt | 35 +++ ...otNullInDestructuringAssignment.fir.kt.txt | 13 + .../ir/irText/expressions/in.fir.kt.txt | 15 ++ .../expressions/incrementDecrement.fir.kt.txt | 91 +++++++ ...aSyntheticGenericPropertyAccess.fir.kt.txt | 9 + .../javaSyntheticPropertyAccess.fir.kt.txt | 9 + .../jvmFieldWithIntersectionTypes.fir.kt.txt | 67 +++++ .../jvmInstanceFieldReference.fir.kt.txt | 20 ++ .../jvmStaticFieldReference.fir.kt.txt | 34 +++ .../ir/irText/expressions/kt16904.fir.kt.txt | 53 ++++ .../ir/irText/expressions/kt16905.fir.kt.txt | 40 +++ .../ir/irText/expressions/kt23030.fir.kt.txt | 54 +++++ .../ir/irText/expressions/kt24804.fir.kt.txt | 24 ++ .../ir/irText/expressions/kt27933.fir.kt.txt | 16 ++ .../ir/irText/expressions/kt28006.fir.kt.txt | 36 +++ .../ir/irText/expressions/kt28456.fir.kt.txt | 39 +++ .../ir/irText/expressions/kt28456a.fir.kt.txt | 15 ++ .../ir/irText/expressions/kt28456b.fir.kt.txt | 37 +++ .../ir/irText/expressions/kt30020.fir.kt.txt | 58 +++++ .../ir/irText/expressions/kt30796.fir.kt.txt | 85 +++++++ .../ir/irText/expressions/kt35730.fir.kt.txt | 19 ++ .../ir/irText/expressions/kt36956.fir.kt.txt | 33 +++ .../ir/irText/expressions/kt36963.fir.kt.txt | 6 + .../ir/irText/expressions/kt37570.fir.kt.txt | 22 ++ .../irText/expressions/lambdaInCAO.fir.kt.txt | 31 +++ .../ir/irText/expressions/literals.fir.kt.txt | 67 +++++ .../multipleThisReferences.fir.kt.txt | 53 ++++ .../nullCheckOnGenericLambdaReturn.fir.kt.txt | 47 ++++ .../nullCheckOnLambdaReturn.fir.kt.txt | 53 ++++ .../expressions/objectAsCallable.fir.kt.txt | 39 +++ .../objectByNameInsideObject.fir.kt.txt | 32 +++ .../expressions/objectReference.fir.kt.txt | 92 +++++++ ...InClosureInSuperConstructorCall.fir.kt.txt | 24 ++ ...jectReferenceInFieldInitializer.fir.kt.txt | 20 ++ .../primitivesImplicitConversions.fir.kt.txt | 49 ++++ .../expressions/propertyReferences.fir.kt.txt | 131 ++++++++++ .../expressions/reflectionLiterals.fir.kt.txt | 42 ++++ .../expressions/safeAssignment.fir.kt.txt | 23 ++ .../safeCallWithIncrementDecrement.fir.kt.txt | 66 +++++ .../irText/expressions/safeCalls.fir.kt.txt | 84 +++++++ .../arrayAsVarargAfterSamArgument.fir.kt.txt | 68 ++++++ .../sam/genericSamProjectedOut.fir.kt.txt | 14 ++ .../sam/genericSamSmartcast.fir.kt.txt | 9 + .../sam/samByProjectedType.fir.kt.txt | 6 + .../sam/samConstructors.fir.kt.txt | 24 ++ ...versionInGenericConstructorCall.fir.kt.txt | 8 + ...sionInGenericConstructorCall_NI.fir.kt.txt | 42 ++++ .../sam/samConversionToGeneric.fir.kt.txt | 51 ++++ .../expressions/sam/samConversions.fir.kt.txt | 29 +++ .../samConversionsWithSmartCasts.fir.kt.txt | 56 +++++ .../expressions/sam/samOperators.fir.kt.txt | 17 ++ .../setFieldWithImplicitCast.fir.kt.txt | 16 ++ ...oUnsignedConversions_annotation.fir.kt.txt | 6 + ...ignedToUnsignedConversions_test.fir.kt.txt | 57 +++++ .../simpleUnaryOperators.fir.kt.txt | 23 ++ .../smartCastsWithDestructuring.fir.kt.txt | 24 ++ ...ializedTypeAliasConstructorCall.fir.kt.txt | 17 ++ .../expressions/stringComparisons.fir.kt.txt | 15 ++ .../expressions/stringTemplates.fir.kt.txt | 43 ++++ ...ConversionOnArbitraryExpression.fir.kt.txt | 189 +++++++++++++++ ...temporaryInEnumEntryInitializer.fir.kt.txt | 28 +++ .../thisOfGenericOuterClass.fir.kt.txt | 44 ++++ ...ectInNestedClassConstructorCall.fir.kt.txt | 39 +++ ...hisReferenceBeforeClassDeclared.fir.kt.txt | 48 ++++ .../ir/irText/expressions/throw.fir.kt.txt | 9 + .../ir/irText/expressions/tryCatch.fir.kt.txt | 20 ++ .../tryCatchWithImplicitCast.fir.kt.txt | 8 + .../typeAliasConstructorReference.fir.kt.txt | 36 +++ .../expressions/useImportedMember.fir.kt.txt | 102 ++++++++ .../ir/irText/expressions/values.fir.kt.txt | 61 +++++ .../variableAsFunctionCall.fir.kt.txt | 34 +++ ...iableAsFunctionCallWithGenerics.fir.kt.txt | 23 ++ .../ir/irText/expressions/when.fir.kt.txt | 63 +++++ .../irText/expressions/whenReturn.fir.kt.txt | 13 + .../whenUnusedExpression.fir.kt.txt | 12 + .../whenWithSubjectVariable.fir.kt.txt | 17 ++ .../expressions/whileDoWhile.fir.kt.txt | 39 +++ .../firProblems/AbstractMutableMap.fir.kt.txt | 17 ++ .../firProblems/AllCandidates.fir.kt.txt | 31 +++ .../AnnotationInAnnotation.fir.kt.txt | 29 +++ .../firProblems/BaseFirBuilder.fir.kt.txt | 12 + .../ClashResolutionDescriptor.fir.kt.txt | 62 +++++ .../firProblems/DeepCopyIrTree.fir.kt.txt | 77 ++++++ ...elegationAndInheritanceFromJava.fir.kt.txt | 60 +++++ .../irText/firProblems/FirBuilder.fir.kt.txt | 17 ++ .../InnerClassInAnonymous.fir.kt.txt | 49 ++++ .../irText/firProblems/MultiList.fir.kt.txt | 67 +++++ .../SameJavaFieldReferences.fir.kt.txt | 4 + .../firProblems/SignatureClash.fir.kt.txt | 79 ++++++ .../firProblems/candidateSymbol.fir.kt.txt | 52 ++++ .../coercionToUnitForNestedWhen.fir.kt.txt | 39 +++ .../irText/firProblems/putIfAbsent.fir.kt.txt | 13 + ...CapturedTypeInPropertyReference.fir.kt.txt | 22 ++ .../throwableStackTrace.fir.kt.txt | 3 + .../firProblems/v8arrayToList.fir.kt.txt | 14 ++ .../lambdas/anonymousFunction.fir.kt.txt | 6 + .../lambdas/destructuringInLambda.fir.kt.txt | 65 +++++ .../irText/lambdas/extensionLambda.fir.kt.txt | 6 + .../irText/lambdas/localFunction.fir.kt.txt | 10 + .../multipleImplicitReceivers.fir.kt.txt | 45 ++++ .../irText/lambdas/nonLocalReturn.fir.kt.txt | 50 ++++ .../regressions/coercionInLoop.fir.kt.txt | 14 ++ .../regressions/integerCoercionToT.fir.kt.txt | 41 ++++ .../ir/irText/regressions/kt24114.fir.kt.txt | 37 +++ .../newInference/fixationOrder1.fir.kt.txt | 20 ++ .../typeAliasCtorForGenericClass.fir.kt.txt | 19 ++ .../typeParametersInImplicitCast.fir.kt.txt | 6 + .../ir/irText/singletons/enumEntry.fir.kt.txt | 38 +++ .../ir/irText/stubs/builtinMap.fir.kt.txt | 9 + ...enericClassInDifferentModule_m1.fir.kt.txt | 21 ++ ...enericClassInDifferentModule_m2.fir.kt.txt | 24 ++ ...vaConstructorWithTypeParameters.fir.kt.txt | 15 ++ .../ir/irText/stubs/javaEnum.fir.kt.txt | 3 + .../ir/irText/stubs/javaInnerClass.fir.kt.txt | 12 + .../stubs/javaSyntheticProperty.fir.kt.txt | 3 + .../jdkClassSyntheticProperty.fir.kt.txt | 4 + .../irText/types/abbreviatedTypes.fir.kt.txt | 17 ++ .../irText/types/asOnPlatformType.fir.kt.txt | 16 ++ .../castsInsideCoroutineInference.fir.kt.txt | 143 +++++++++++ .../genericDelegatedDeepProperty.fir.kt.txt | 145 +++++++++++ .../types/genericFunWithStar.fir.kt.txt | 29 +++ .../genericPropertyReferenceType.fir.kt.txt | 33 +++ .../types/intersectionType1_NI.fir.kt.txt | 26 ++ .../types/intersectionType1_OI.fir.kt.txt | 26 ++ .../types/intersectionType2_NI.fir.kt.txt | 42 ++++ .../types/intersectionType2_OI.fir.kt.txt | 42 ++++ .../types/intersectionType3_NI.fir.kt.txt | 63 +++++ .../types/intersectionType3_OI.fir.kt.txt | 63 +++++ .../irText/types/javaWildcardType.fir.kt.txt | 53 ++++ ...alVariableOfIntersectionType_NI.fir.kt.txt | 32 +++ .../nullChecks/enhancedNullability.fir.kt.txt | 35 +++ ...bilityInDestructuringAssignment.fir.kt.txt | 87 +++++++ .../enhancedNullabilityInForLoop.fir.kt.txt | 121 ++++++++++ ...reToCallsOnPlatformTypeReceiver.fir.kt.txt | 23 ++ .../implicitNotNullOnPlatformType.fir.kt.txt | 42 ++++ .../stringVsT.fir.kt.txt | 10 + .../stringVsTAny.fir.kt.txt | 10 + .../stringVsTConstrained.fir.kt.txt | 10 + .../stringVsTXArray.fir.kt.txt | 10 + .../stringVsTXString.fir.kt.txt | 10 + ...ityAssertionOnExtensionReceiver.fir.kt.txt | 22 ++ .../platformTypeReceiver.fir.kt.txt | 7 + .../types/rawTypeInSignature.fir.kt.txt | 82 +++++++ .../receiverOfIntersectionType.fir.kt.txt | 60 +++++ ...smartCastOnFakeOverrideReceiver.fir.kt.txt | 85 +++++++ ...astOnFieldReceiverOfGenericType.fir.kt.txt | 10 + 298 files changed, 12186 insertions(+) create mode 100644 compiler/testData/ir/irText/classes/annotationClasses.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/classes.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/cloneable.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/dataClassWithArrayMembers.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/dataClasses.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/dataClassesGeneric.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/delegatedGenericImplementation.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/delegatedImplementation.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/enum.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/enumClassModality.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/enumWithMultipleCtors.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/enumWithSecondaryCtor.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/fakeOverridesForJavaStaticMembers.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/initValInLambda.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/inlineClass.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/innerClass.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/kt31649.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/kt43217.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/objectLiteralExpressions.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/objectWithInitializers.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/qualifiedSuperCalls.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/sealedClasses.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/superCalls.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/superCallsComposed.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/annotationsInAnnotationArguments.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/annotationsWithVarargParameters.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/arrayInAnnotationArguments.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/constExpressionsInAnnotationArguments.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/fieldsWithAnnotations.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/fileAnnotations.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/functionsWithAnnotations.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/multipleAnnotationsInSquareBrackets.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/propertiesWithAnnotations.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/propertyAccessorsWithAnnotations.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/propertySetterParameterWithAnnotations.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/receiverParameterWithAnnotations.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/spreadOperatorInAnnotationArguments.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/typeAliasesWithAnnotations.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/typeParametersWithAnnotations.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/varargsInAnnotationArguments.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/annotations/variablesWithAnnotations.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/catchParameterInTopLevelProperty.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/classLevelProperties.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/delegatedProperties.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/fakeOverrides.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/genericDelegatedProperty.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/kt29833.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/kt35550.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/localClassWithOverrides.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/localVarInDoWhile.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/multiplatform/expectClassInherited.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/packageLevelProperties.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/constructor.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/dataClassMembers.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/delegatedMembers.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/lambdas.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/typeParameterBeforeBound.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/typeParameterBoundedBySubclass.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.fir.kt.txt create mode 100644 compiler/testData/ir/irText/declarations/typeAlias.fir.kt.txt create mode 100644 compiler/testData/ir/irText/errors/unresolvedReference.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/argumentMappedWithError.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/arrayAccess.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/arrayAssignment.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/augmentedAssignment1.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/augmentedAssignment2.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/badBreakContinue.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/bangbang.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/breakContinue.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/adaptedWithCoercionToUnit.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/kt37131.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/typeArguments.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/withAdaptationForSam.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/catchParameterAccess.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/classReference.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/coercionToUnit.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/complexAugmentedAssignment.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/conventionComparisons.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/destructuring1.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/destructuringWithUnderscore.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/elvis.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/enumEntryAsReceiver.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/equals.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/extFunInvokeAsFun.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/extFunSafeInvoke.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/field.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEquals.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/for.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/forWithBreakContinue.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/forWithImplicitReceivers.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/funInterface/partialSam.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargs.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/genericPropertyRef.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/ifElseIf.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/implicitCastOnPlatformType.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/implicitCastToNonNull.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/implicitNotNullInDestructuringAssignment.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/in.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/incrementDecrement.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/javaSyntheticGenericPropertyAccess.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/javaSyntheticPropertyAccess.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/jvmStaticFieldReference.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt16904.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt16905.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt23030.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt24804.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt27933.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt28006.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt28456.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt28456a.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt28456b.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt30020.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt30796.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt35730.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt36956.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt36963.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/kt37570.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/lambdaInCAO.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/literals.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/multipleThisReferences.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/nullCheckOnGenericLambdaReturn.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/nullCheckOnLambdaReturn.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/objectAsCallable.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/objectByNameInsideObject.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/objectReference.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/primitivesImplicitConversions.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/propertyReferences.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/reflectionLiterals.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/safeAssignment.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/safeCalls.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/genericSamSmartcast.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/samByProjectedType.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/samConstructors.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/samConversions.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/samOperators.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/signedToUnsignedConversions_annotation.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/simpleUnaryOperators.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/stringComparisons.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/stringTemplates.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/throw.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/tryCatch.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/typeAliasConstructorReference.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/useImportedMember.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/values.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/variableAsFunctionCall.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/when.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/whenReturn.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/whenUnusedExpression.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/whenWithSubjectVariable.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/whileDoWhile.fir.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/AbstractMutableMap.fir.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/AllCandidates.fir.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.fir.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/BaseFirBuilder.fir.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.fir.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/DeepCopyIrTree.fir.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.fir.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/FirBuilder.fir.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.fir.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/MultiList.fir.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/SameJavaFieldReferences.fir.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/SignatureClash.fir.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/candidateSymbol.fir.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.fir.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/putIfAbsent.fir.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/recursiveCapturedTypeInPropertyReference.fir.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/throwableStackTrace.fir.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/v8arrayToList.fir.kt.txt create mode 100644 compiler/testData/ir/irText/lambdas/anonymousFunction.fir.kt.txt create mode 100644 compiler/testData/ir/irText/lambdas/destructuringInLambda.fir.kt.txt create mode 100644 compiler/testData/ir/irText/lambdas/extensionLambda.fir.kt.txt create mode 100644 compiler/testData/ir/irText/lambdas/localFunction.fir.kt.txt create mode 100644 compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.fir.kt.txt create mode 100644 compiler/testData/ir/irText/lambdas/nonLocalReturn.fir.kt.txt create mode 100644 compiler/testData/ir/irText/regressions/coercionInLoop.fir.kt.txt create mode 100644 compiler/testData/ir/irText/regressions/integerCoercionToT.fir.kt.txt create mode 100644 compiler/testData/ir/irText/regressions/kt24114.fir.kt.txt create mode 100644 compiler/testData/ir/irText/regressions/newInference/fixationOrder1.fir.kt.txt create mode 100644 compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.fir.kt.txt create mode 100644 compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.fir.kt.txt create mode 100644 compiler/testData/ir/irText/singletons/enumEntry.fir.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/builtinMap.fir.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m1.fir.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m2.fir.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/javaConstructorWithTypeParameters.fir.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/javaEnum.fir.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/javaInnerClass.fir.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/javaSyntheticProperty.fir.kt.txt create mode 100644 compiler/testData/ir/irText/stubs/jdkClassSyntheticProperty.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/abbreviatedTypes.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/asOnPlatformType.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/genericDelegatedDeepProperty.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/genericFunWithStar.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/genericPropertyReferenceType.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/intersectionType1_NI.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/intersectionType1_OI.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/intersectionType2_NI.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/intersectionType2_OI.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/intersectionType3_NI.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/intersectionType3_OI.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/javaWildcardType.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/enhancedNullability.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsT.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTAny.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTConstrained.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXArray.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXString.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/nullChecks/platformTypeReceiver.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/rawTypeInSignature.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/receiverOfIntersectionType.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.fir.kt.txt create mode 100644 compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.fir.kt.txt diff --git a/compiler/testData/ir/irText/classes/annotationClasses.fir.kt.txt b/compiler/testData/ir/irText/classes/annotationClasses.fir.kt.txt new file mode 100644 index 00000000000..d6e3ed1c3ef --- /dev/null +++ b/compiler/testData/ir/irText/classes/annotationClasses.fir.kt.txt @@ -0,0 +1,31 @@ +annotation class Test1 : Annotation { + constructor(x: Int) /* primary */ + val x: Int + field = x + get + +} + +annotation class Test2 : Annotation { + constructor(x: Int = 0) /* primary */ + val x: Int + field = x + get + +} + +annotation class Test3 : Annotation { + constructor(x: Test1) /* primary */ + val x: Test1 + field = x + get + +} + +annotation class Test4 : Annotation { + constructor(vararg xs: Int) /* primary */ + val xs: IntArray + field = xs + get + +} diff --git a/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.fir.kt.txt b/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.fir.kt.txt new file mode 100644 index 00000000000..feb8a4114e0 --- /dev/null +++ b/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.fir.kt.txt @@ -0,0 +1,44 @@ +open class Base { + constructor(x: Int, y: Int) /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: Int + field = x + get + + val y: Int + field = y + get + +} + +class Test1 : Base { + constructor(xx: Int, yy: Int) /* primary */ { + { // BLOCK + super/*Base*/(x = xx, y = yy) + } + /* () */ + + } + +} + +class Test2 : Base { + constructor(xx: Int, yy: Int) { + { // BLOCK + super/*Base*/(x = xx, y = yy) + } + /* () */ + + } + + constructor(xxx: Int, yyy: Int, a: Any) { + { // BLOCK + this/*Test2*/(xx = xxx, yy = yyy) + } + } + +} diff --git a/compiler/testData/ir/irText/classes/classes.fir.kt.txt b/compiler/testData/ir/irText/classes/classes.fir.kt.txt new file mode 100644 index 00000000000..f414e52079e --- /dev/null +++ b/compiler/testData/ir/irText/classes/classes.fir.kt.txt @@ -0,0 +1,39 @@ +class TestClass { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +interface TestInterface { + +} + +object TestObject { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +annotation class TestAnnotationClass : Annotation { + constructor() /* primary */ + +} + +enum class TestEnumClass : Enum { + private constructor() /* primary */ { + super/*Enum*/() + /* () */ + + } + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnumClass /* Synthetic body for ENUM_VALUEOF */ + +} diff --git a/compiler/testData/ir/irText/classes/cloneable.fir.kt.txt b/compiler/testData/ir/irText/classes/cloneable.fir.kt.txt new file mode 100644 index 00000000000..d5d61aabac7 --- /dev/null +++ b/compiler/testData/ir/irText/classes/cloneable.fir.kt.txt @@ -0,0 +1,34 @@ +class A : Cloneable { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +interface I : Cloneable { + +} + +class C : I { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +class OC : I { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + protected override fun clone(): OC { + return OC() + } + +} diff --git a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.fir.kt.txt b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.fir.kt.txt new file mode 100644 index 00000000000..065d0ceeae6 --- /dev/null +++ b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.fir.kt.txt @@ -0,0 +1,228 @@ +data class Test1 { + constructor(stringArray: Array, charArray: CharArray, booleanArray: BooleanArray, byteArray: ByteArray, shortArray: ShortArray, intArray: IntArray, longArray: LongArray, floatArray: FloatArray, doubleArray: DoubleArray) /* primary */ { + super/*Any*/() + /* () */ + + } + + val stringArray: Array + field = stringArray + get + + val charArray: CharArray + field = charArray + get + + val booleanArray: BooleanArray + field = booleanArray + get + + val byteArray: ByteArray + field = byteArray + get + + val shortArray: ShortArray + field = shortArray + get + + val intArray: IntArray + field = intArray + get + + val longArray: LongArray + field = longArray + get + + val floatArray: FloatArray + field = floatArray + get + + val doubleArray: DoubleArray + field = doubleArray + get + + fun component1(): Array { + return .#stringArray + } + + fun component2(): CharArray { + return .#charArray + } + + fun component3(): BooleanArray { + return .#booleanArray + } + + fun component4(): ByteArray { + return .#byteArray + } + + fun component5(): ShortArray { + return .#shortArray + } + + fun component6(): IntArray { + return .#intArray + } + + fun component7(): LongArray { + return .#longArray + } + + fun component8(): FloatArray { + return .#floatArray + } + + fun component9(): DoubleArray { + return .#doubleArray + } + + fun copy(stringArray: Array = .#stringArray, charArray: CharArray = .#charArray, booleanArray: BooleanArray = .#booleanArray, byteArray: ByteArray = .#byteArray, shortArray: ShortArray = .#shortArray, intArray: IntArray = .#intArray, longArray: LongArray = .#longArray, floatArray: FloatArray = .#floatArray, doubleArray: DoubleArray = .#doubleArray): Test1 { + return Test1(stringArray = stringArray, charArray = charArray, booleanArray = booleanArray, byteArray = byteArray, shortArray = shortArray, intArray = intArray, longArray = longArray, floatArray = floatArray, doubleArray = doubleArray) + } + + override fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test1 -> return false + } + val tmp0_other_with_cast: Test1 = other as Test1 + when { + EQEQ(arg0 = .#stringArray, arg1 = tmp0_other_with_cast.#stringArray).not() -> return false + } + when { + EQEQ(arg0 = .#charArray, arg1 = tmp0_other_with_cast.#charArray).not() -> return false + } + when { + EQEQ(arg0 = .#booleanArray, arg1 = tmp0_other_with_cast.#booleanArray).not() -> return false + } + when { + EQEQ(arg0 = .#byteArray, arg1 = tmp0_other_with_cast.#byteArray).not() -> return false + } + when { + EQEQ(arg0 = .#shortArray, arg1 = tmp0_other_with_cast.#shortArray).not() -> return false + } + when { + EQEQ(arg0 = .#intArray, arg1 = tmp0_other_with_cast.#intArray).not() -> return false + } + when { + EQEQ(arg0 = .#longArray, arg1 = tmp0_other_with_cast.#longArray).not() -> return false + } + when { + EQEQ(arg0 = .#floatArray, arg1 = tmp0_other_with_cast.#floatArray).not() -> return false + } + when { + EQEQ(arg0 = .#doubleArray, arg1 = tmp0_other_with_cast.#doubleArray).not() -> return false + } + return true + } + + override fun hashCode(): Int { + var result: Int = dataClassArrayMemberHashCode(arg0 = .#stringArray) + result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = .#charArray)) + result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = .#booleanArray)) + result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = .#byteArray)) + result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = .#shortArray)) + result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = .#intArray)) + result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = .#longArray)) + result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = .#floatArray)) + result = result.times(other = 31).plus(other = dataClassArrayMemberHashCode(arg0 = .#doubleArray)) + return result + } + + override fun toString(): String { + return "Test1(" + "stringArray=" + dataClassArrayMemberToString(arg0 = .#stringArray) + ", " + "charArray=" + dataClassArrayMemberToString(arg0 = .#charArray) + ", " + "booleanArray=" + dataClassArrayMemberToString(arg0 = .#booleanArray) + ", " + "byteArray=" + dataClassArrayMemberToString(arg0 = .#byteArray) + ", " + "shortArray=" + dataClassArrayMemberToString(arg0 = .#shortArray) + ", " + "intArray=" + dataClassArrayMemberToString(arg0 = .#intArray) + ", " + "longArray=" + dataClassArrayMemberToString(arg0 = .#longArray) + ", " + "floatArray=" + dataClassArrayMemberToString(arg0 = .#floatArray) + ", " + "doubleArray=" + dataClassArrayMemberToString(arg0 = .#doubleArray) + ")" + } + +} + +data class Test2 { + constructor(genericArray: Array) /* primary */ { + super/*Any*/() + /* () */ + + } + + val genericArray: Array + field = genericArray + get + + fun component1(): Array { + return .#genericArray + } + + fun copy(genericArray: Array = .#genericArray): Test2 { + return Test2(genericArray = genericArray) + } + + override fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test2 -> return false + } + val tmp0_other_with_cast: Test2 = other as Test2 + when { + EQEQ(arg0 = .#genericArray, arg1 = tmp0_other_with_cast.#genericArray).not() -> return false + } + return true + } + + override fun hashCode(): Int { + return dataClassArrayMemberHashCode(arg0 = .#genericArray) + } + + override fun toString(): String { + return "Test2(" + "genericArray=" + dataClassArrayMemberToString(arg0 = .#genericArray) + ")" + } + +} + +data class Test3 { + constructor(anyArrayN: Array?) /* primary */ { + super/*Any*/() + /* () */ + + } + + val anyArrayN: Array? + field = anyArrayN + get + + fun component1(): Array? { + return .#anyArrayN + } + + fun copy(anyArrayN: Array? = .#anyArrayN): Test3 { + return Test3(anyArrayN = anyArrayN) + } + + override fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test3 -> return false + } + val tmp0_other_with_cast: Test3 = other as Test3 + when { + EQEQ(arg0 = .#anyArrayN, arg1 = tmp0_other_with_cast.#anyArrayN).not() -> return false + } + return true + } + + override fun hashCode(): Int { + return when { + EQEQ(arg0 = .#anyArrayN, arg1 = null) -> 0 + else -> dataClassArrayMemberHashCode(arg0 = .#anyArrayN) + } + } + + override fun toString(): String { + return "Test3(" + "anyArrayN=" + dataClassArrayMemberToString(arg0 = .#anyArrayN) + ")" + } + +} diff --git a/compiler/testData/ir/irText/classes/dataClasses.fir.kt.txt b/compiler/testData/ir/irText/classes/dataClasses.fir.kt.txt new file mode 100644 index 00000000000..9203bc4657f --- /dev/null +++ b/compiler/testData/ir/irText/classes/dataClasses.fir.kt.txt @@ -0,0 +1,199 @@ +data class Test1 { + constructor(x: Int, y: String, z: Any) /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: Int + field = x + get + + val y: String + field = y + get + + val z: Any + field = z + get + + fun component1(): Int { + return .#x + } + + fun component2(): String { + return .#y + } + + fun component3(): Any { + return .#z + } + + fun copy(x: Int = .#x, y: String = .#y, z: Any = .#z): Test1 { + return Test1(x = x, y = y, z = z) + } + + override fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test1 -> return false + } + val tmp0_other_with_cast: Test1 = other as Test1 + when { + EQEQ(arg0 = .#x, arg1 = tmp0_other_with_cast.#x).not() -> return false + } + when { + EQEQ(arg0 = .#y, arg1 = tmp0_other_with_cast.#y).not() -> return false + } + when { + EQEQ(arg0 = .#z, arg1 = tmp0_other_with_cast.#z).not() -> return false + } + return true + } + + override fun hashCode(): Int { + var result: Int = .#x.hashCode() + result = result.times(other = 31).plus(other = .#y.hashCode()) + result = result.times(other = 31).plus(other = .#z.hashCode()) + return result + } + + override fun toString(): String { + return "Test1(" + "x=" + .#x + ", " + "y=" + .#y + ", " + "z=" + .#z + ")" + } + +} + +data class Test2 { + constructor(x: Any?) /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: Any? + field = x + get + + fun component1(): Any? { + return .#x + } + + fun copy(x: Any? = .#x): Test2 { + return Test2(x = x) + } + + override fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test2 -> return false + } + val tmp0_other_with_cast: Test2 = other as Test2 + when { + EQEQ(arg0 = .#x, arg1 = tmp0_other_with_cast.#x).not() -> return false + } + return true + } + + override fun hashCode(): Int { + return when { + EQEQ(arg0 = .#x, arg1 = null) -> 0 + else -> .#x.hashCode() + } + } + + override fun toString(): String { + return "Test2(" + "x=" + .#x + ")" + } + +} + +data class Test3 { + constructor(d: Double, dn: Double?, f: Float, df: Float?) /* primary */ { + super/*Any*/() + /* () */ + + } + + val d: Double + field = d + get + + val dn: Double? + field = dn + get + + val f: Float + field = f + get + + val df: Float? + field = df + get + + fun component1(): Double { + return .#d + } + + fun component2(): Double? { + return .#dn + } + + fun component3(): Float { + return .#f + } + + fun component4(): Float? { + return .#df + } + + fun copy(d: Double = .#d, dn: Double? = .#dn, f: Float = .#f, df: Float? = .#df): Test3 { + return Test3(d = d, dn = dn, f = f, df = df) + } + + override fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test3 -> return false + } + val tmp0_other_with_cast: Test3 = other as Test3 + when { + EQEQ(arg0 = .#d, arg1 = tmp0_other_with_cast.#d).not() -> return false + } + when { + EQEQ(arg0 = .#dn, arg1 = tmp0_other_with_cast.#dn).not() -> return false + } + when { + EQEQ(arg0 = .#f, arg1 = tmp0_other_with_cast.#f).not() -> return false + } + when { + EQEQ(arg0 = .#df, arg1 = tmp0_other_with_cast.#df).not() -> return false + } + return true + } + + override fun hashCode(): Int { + var result: Int = .#d.hashCode() + result = result.times(other = 31).plus(other = when { + EQEQ(arg0 = .#dn, arg1 = null) -> 0 + else -> .#dn.hashCode() + }) + result = result.times(other = 31).plus(other = .#f.hashCode()) + result = result.times(other = 31).plus(other = when { + EQEQ(arg0 = .#df, arg1 = null) -> 0 + else -> .#df.hashCode() + }) + return result + } + + override fun toString(): String { + return "Test3(" + "d=" + .#d + ", " + "dn=" + .#dn + ", " + "f=" + .#f + ", " + "df=" + .#df + ")" + } + +} diff --git a/compiler/testData/ir/irText/classes/dataClassesGeneric.fir.kt.txt b/compiler/testData/ir/irText/classes/dataClassesGeneric.fir.kt.txt new file mode 100644 index 00000000000..d932e4fc785 --- /dev/null +++ b/compiler/testData/ir/irText/classes/dataClassesGeneric.fir.kt.txt @@ -0,0 +1,174 @@ +data class Test1 { + constructor(x: T) /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: T + field = x + get + + fun component1(): T { + return .#x + } + + fun copy(x: T = .#x): Test1 { + return Test1(x = x) + } + + override fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test1 -> return false + } + val tmp0_other_with_cast: Test1 = other as Test1 + when { + EQEQ(arg0 = .#x, arg1 = tmp0_other_with_cast.#x).not() -> return false + } + return true + } + + override fun hashCode(): Int { + return when { + EQEQ(arg0 = .#x, arg1 = null) -> 0 + else -> .#x.hashCode() + } + } + + override fun toString(): String { + return "Test1(" + "x=" + .#x + ")" + } + +} + +data class Test2 { + constructor(x: T) /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: T + field = x + get + + fun component1(): T { + return .#x + } + + fun copy(x: T = .#x): Test2 { + return Test2(x = x) + } + + override fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test2 -> return false + } + val tmp0_other_with_cast: Test2 = other as Test2 + when { + EQEQ(arg0 = .#x, arg1 = tmp0_other_with_cast.#x).not() -> return false + } + return true + } + + override fun hashCode(): Int { + return .#x.hashCode() + } + + override fun toString(): String { + return "Test2(" + "x=" + .#x + ")" + } + +} + +data class Test3 { + constructor(x: List) /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: List + field = x + get + + fun component1(): List { + return .#x + } + + fun copy(x: List = .#x): Test3 { + return Test3(x = x) + } + + override fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test3 -> return false + } + val tmp0_other_with_cast: Test3 = other as Test3 + when { + EQEQ(arg0 = .#x, arg1 = tmp0_other_with_cast.#x).not() -> return false + } + return true + } + + override fun hashCode(): Int { + return .#x.hashCode() + } + + override fun toString(): String { + return "Test3(" + "x=" + .#x + ")" + } + +} + +data class Test4 { + constructor(x: List) /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: List + field = x + get + + fun component1(): List { + return .#x + } + + fun copy(x: List = .#x): Test4 { + return Test4(x = x) + } + + override fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test4 -> return false + } + val tmp0_other_with_cast: Test4 = other as Test4 + when { + EQEQ(arg0 = .#x, arg1 = tmp0_other_with_cast.#x).not() -> return false + } + return true + } + + override fun hashCode(): Int { + return .#x.hashCode() + } + + override fun toString(): String { + return "Test4(" + "x=" + .#x + ")" + } + +} diff --git a/compiler/testData/ir/irText/classes/delegatedGenericImplementation.fir.kt.txt b/compiler/testData/ir/irText/classes/delegatedGenericImplementation.fir.kt.txt new file mode 100644 index 00000000000..12ed623bf64 --- /dev/null +++ b/compiler/testData/ir/irText/classes/delegatedGenericImplementation.fir.kt.txt @@ -0,0 +1,73 @@ +interface IBase { + abstract fun foo(a: A, b: B) + abstract val C.id: Map? + abstract get + + abstract var List.x: D? + abstract get + abstract set + +} + +class Test1 : IBase { + constructor(i: IBase) /* primary */ { + super/*Any*/() + /* () */ + + .#<$$delegate_0> = i + } + + override fun foo(a: E, b: B) { + .#<$$delegate_0>.foo(a = a, b = b) + } + + override val C.id: Map? + override get(): Map? { + return (.#<$$delegate_0>, ).() + } + + override var List.x: D? + override get(): D? { + return (.#<$$delegate_0>, ).() + } + override set(: D?) { + (.#<$$delegate_0>, ).( = ) + } + + local /*final field*/ val <$$delegate_0>: IBase + +} + +class Test2 : IBase { + constructor(j: IBase) /* primary */ { + super/*Any*/() + /* () */ + + .#<$$delegate_0> = j + } + + var j: IBase + field = j + get + set + + override fun foo(a: String, b: B) { + .#<$$delegate_0>.foo(a = a, b = b) + } + + override val C.id: Map? + override get(): Map? { + return (.#<$$delegate_0>, ).() + } + + override var List.x: D? + override get(): D? { + return (.#<$$delegate_0>, ).() + } + override set(: D?) { + (.#<$$delegate_0>, ).( = ) + } + + local /*final field*/ val <$$delegate_0>: IBase + +} diff --git a/compiler/testData/ir/irText/classes/delegatedImplementation.fir.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementation.fir.kt.txt new file mode 100644 index 00000000000..ef0e829ad86 --- /dev/null +++ b/compiler/testData/ir/irText/classes/delegatedImplementation.fir.kt.txt @@ -0,0 +1,154 @@ +interface IBase { + abstract fun foo(x: Int, s: String) + abstract fun bar(): Int + abstract fun String.qux() + +} + +object BaseImpl : IBase { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + override fun foo(x: Int, s: String) { + } + + override fun bar(): Int { + return 42 + } + + override fun String.qux() { + } + +} + +interface IOther { + abstract val x: String + abstract get + + abstract var y: Int + abstract get + abstract set + + abstract val Byte.z1: Int + abstract get + + abstract var Byte.z2: Int + abstract get + abstract set + +} + +fun otherImpl(x0: String, y0: Int): IOther { + return { // BLOCK + local class : IOther { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + override val x: String + field = x0 + override get + + override var y: Int + field = y0 + override get + override set + + override val Byte.z1: Int + override get(): Int { + return 1 + } + + override var Byte.z2: Int + override get(): Int { + return 2 + } + override set(value: Int) { + } + + } + + () + } +} + +class Test1 : IBase { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + .#<$$delegate_0> = BaseImpl + } + + override fun foo(x: Int, s: String) { + .#<$$delegate_0>.foo(x = x, s = s) + } + + override fun bar(): Int { + return .#<$$delegate_0>.bar() + } + + override fun String.qux() { + (.#<$$delegate_0>, ).qux() + } + + local /*final field*/ val <$$delegate_0>: IBase + +} + +class Test2 : IBase, IOther { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + .#<$$delegate_0> = BaseImpl + .#<$$delegate_1> = otherImpl(x0 = "", y0 = 42) + } + + override fun foo(x: Int, s: String) { + .#<$$delegate_0>.foo(x = x, s = s) + } + + override fun bar(): Int { + return .#<$$delegate_0>.bar() + } + + override fun String.qux() { + (.#<$$delegate_0>, ).qux() + } + + local /*final field*/ val <$$delegate_0>: IBase + override val x: String + override get(): String { + return .#<$$delegate_1>.() + } + + override var y: Int + override get(): Int { + return .#<$$delegate_1>.() + } + override set(: Int) { + .#<$$delegate_1>.( = ) + } + + override val Byte.z1: Int + override get(): Int { + return (.#<$$delegate_1>, ).() + } + + override var Byte.z2: Int + override get(): Int { + return (.#<$$delegate_1>, ).() + } + override set(: Int) { + (.#<$$delegate_1>, ).( = ) + } + + local /*final field*/ val <$$delegate_1>: IOther + +} diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.fir.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.fir.kt.txt new file mode 100644 index 00000000000..8bf95831780 --- /dev/null +++ b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.fir.kt.txt @@ -0,0 +1,39 @@ +class Test : J { + constructor(j: J) /* primary */ { + super/*Any*/() + /* () */ + + .#<$$delegate_0> = j + } + + private val j: J + field = j + private get + + override fun takeNotNull(x: @EnhancedNullability String) { + .#<$$delegate_0>.takeNotNull(x = x) + } + + override fun takeNullable(x: @FlexibleNullability String?) { + .#<$$delegate_0>.takeNullable(x = x) + } + + override fun takeFlexible(x: String?) { + .#<$$delegate_0>.takeFlexible(x = x) + } + + override fun returnNotNull(): @EnhancedNullability String { + return .#<$$delegate_0>.returnNotNull() + } + + override fun returnNullable(): @FlexibleNullability String? { + return .#<$$delegate_0>.returnNullable() + } + + override fun returnsFlexible(): String? { + return .#<$$delegate_0>.returnsFlexible() + } + + local /*final field*/ val <$$delegate_0>: J + +} diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.fir.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.fir.kt.txt new file mode 100644 index 00000000000..fba073af5c8 --- /dev/null +++ b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.fir.kt.txt @@ -0,0 +1,39 @@ +interface IFooBar { + abstract fun foo() + abstract fun bar() + +} + +object FooBarImpl : IFooBar { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + override fun foo() { + } + + override fun bar() { + } + +} + +class C : IFooBar { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + .#<$$delegate_0> = FooBarImpl + } + + override fun bar() { + } + + override fun foo() { + .#<$$delegate_0>.foo() + } + + local /*final field*/ val <$$delegate_0>: IFooBar + +} diff --git a/compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.fir.kt.txt b/compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.fir.kt.txt new file mode 100644 index 00000000000..3fce7ec5c13 --- /dev/null +++ b/compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.fir.kt.txt @@ -0,0 +1,32 @@ +typealias CT = Cell +typealias CStr = Cell +open class Cell { + constructor(value: T) /* primary */ { + super/*Any*/() + /* () */ + + } + + val value: T + field = value + get + +} + +class C1 : Cell { + constructor() /* primary */ { + super/*Cell*/(value = "O") + /* () */ + + } + +} + +class C2 : Cell { + constructor() /* primary */ { + super/*Cell*/(value = "K") + /* () */ + + } + +} diff --git a/compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.fir.kt.txt b/compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.fir.kt.txt new file mode 100644 index 00000000000..4aa34fe4a53 --- /dev/null +++ b/compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.fir.kt.txt @@ -0,0 +1,27 @@ +open class Base { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +class Test : Base { + constructor() { + super/*Base*/() + /* () */ + + } + + constructor(xx: Int) { + super/*Base*/() + /* () */ + + } + + constructor(xx: Short) { + this/*Test*/() + } + +} diff --git a/compiler/testData/ir/irText/classes/enum.fir.kt.txt b/compiler/testData/ir/irText/classes/enum.fir.kt.txt new file mode 100644 index 00000000000..f162b559184 --- /dev/null +++ b/compiler/testData/ir/irText/classes/enum.fir.kt.txt @@ -0,0 +1,174 @@ +enum class TestEnum1 : Enum { + private constructor() /* primary */ { + super/*Enum*/() + /* () */ + + } + + TEST1 = TestEnum1() + + TEST2 = TestEnum1() + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnum1 /* Synthetic body for ENUM_VALUEOF */ + +} + +open enum class TestEnum2 : Enum { + private constructor(x: Int) /* primary */ { + super/*Enum*/() + /* () */ + + } + + val x: Int + field = x + get + + TEST1 = TestEnum2(x = 1) + + TEST2 = TestEnum2(x = 2) + + TEST3 = TestEnum2(x = 3) + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnum2 /* Synthetic body for ENUM_VALUEOF */ + +} + +abstract enum class TestEnum3 : Enum { + private constructor() /* primary */ { + super/*Enum*/() + /* () */ + + } + + TEST = TEST() + private enum entry class TEST : TestEnum3 { + private constructor() /* primary */ { + super/*TestEnum3*/() + /* () */ + + } + + override fun foo() { + println(message = "Hello, world!") + } + + } + + abstract fun foo() + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnum3 /* Synthetic body for ENUM_VALUEOF */ + +} + +abstract enum class TestEnum4 : Enum { + private constructor(x: Int) /* primary */ { + super/*Enum*/() + /* () */ + + } + + val x: Int + field = x + get + + TEST1 = TEST1() + private enum entry class TEST1 : TestEnum4 { + private constructor() /* primary */ { + super/*TestEnum4*/(x = 1) + /* () */ + + } + + override fun foo() { + println(message = TestEnum4.TEST1) + } + + } + + TEST2 = TEST2() + private enum entry class TEST2 : TestEnum4 { + private constructor() /* primary */ { + super/*TestEnum4*/(x = 2) + /* () */ + + } + + val z: Int + get + + init { + .#z = .() + } + + override fun foo() { + println(message = TestEnum4.TEST2) + } + + } + + abstract fun foo() + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnum4 /* Synthetic body for ENUM_VALUEOF */ + +} + +open enum class TestEnum5 : Enum { + private constructor(x: Int = 0) /* primary */ { + super/*Enum*/() + /* () */ + + } + + val x: Int + field = x + get + + TEST1 = TestEnum5() + + TEST2 = TestEnum5() + + TEST3 = TestEnum5(x = 0) + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnum5 /* Synthetic body for ENUM_VALUEOF */ + +} + +fun f(): Int { + return 1 +} + +open enum class TestEnum6 : Enum { + private constructor(x: Int, y: Int) /* primary */ { + super/*Enum*/() + /* () */ + + } + + val x: Int + field = x + get + + val y: Int + field = y + get + + TEST = { // BLOCK + val tmp0_y: Int = f() + val tmp1_x: Int = f() + TestEnum6(x = tmp1_x, y = tmp0_y) + } + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnum6 /* Synthetic body for ENUM_VALUEOF */ + +} diff --git a/compiler/testData/ir/irText/classes/enumClassModality.fir.kt.txt b/compiler/testData/ir/irText/classes/enumClassModality.fir.kt.txt new file mode 100644 index 00000000000..d8342c49ad4 --- /dev/null +++ b/compiler/testData/ir/irText/classes/enumClassModality.fir.kt.txt @@ -0,0 +1,165 @@ +enum class TestFinalEnum1 : Enum { + private constructor() /* primary */ { + super/*Enum*/() + /* () */ + + } + + X1 = TestFinalEnum1() + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestFinalEnum1 /* Synthetic body for ENUM_VALUEOF */ + +} + +open enum class TestFinalEnum2 : Enum { + private constructor(x: Int) /* primary */ { + super/*Enum*/() + /* () */ + + } + + val x: Int + field = x + get + + X1 = TestFinalEnum2(x = 1) + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestFinalEnum2 /* Synthetic body for ENUM_VALUEOF */ + +} + +enum class TestFinalEnum3 : Enum { + private constructor() /* primary */ { + super/*Enum*/() + /* () */ + + } + + X1 = TestFinalEnum3() + + fun doStuff() { + } + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestFinalEnum3 /* Synthetic body for ENUM_VALUEOF */ + +} + +open enum class TestOpenEnum1 : Enum { + private constructor() /* primary */ { + super/*Enum*/() + /* () */ + + } + + X1 = X1() + private enum entry class X1 : TestOpenEnum1 { + private constructor() /* primary */ { + super/*TestOpenEnum1*/() + /* () */ + + } + + override fun toString(): String { + return "X1" + } + + } + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestOpenEnum1 /* Synthetic body for ENUM_VALUEOF */ + +} + +open enum class TestOpenEnum2 : Enum { + private constructor() /* primary */ { + super/*Enum*/() + /* () */ + + } + + X1 = X1() + private enum entry class X1 : TestOpenEnum2 { + private constructor() /* primary */ { + super/*TestOpenEnum2*/() + /* () */ + + } + + override fun foo() { + } + + } + + open fun foo() { + } + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestOpenEnum2 /* Synthetic body for ENUM_VALUEOF */ + +} + +abstract enum class TestAbstractEnum1 : Enum { + private constructor() /* primary */ { + super/*Enum*/() + /* () */ + + } + + X1 = X1() + private enum entry class X1 : TestAbstractEnum1 { + private constructor() /* primary */ { + super/*TestAbstractEnum1*/() + /* () */ + + } + + override fun foo() { + } + + } + + abstract fun foo() + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestAbstractEnum1 /* Synthetic body for ENUM_VALUEOF */ + +} + +interface IFoo { + abstract fun foo() + +} + +open enum class TestAbstractEnum2 : IFoo, Enum { + private constructor() /* primary */ { + super/*Enum*/() + /* () */ + + } + + X1 = X1() + private enum entry class X1 : TestAbstractEnum2 { + private constructor() /* primary */ { + super/*TestAbstractEnum2*/() + /* () */ + + } + + override fun foo() { + } + + } + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestAbstractEnum2 /* Synthetic body for ENUM_VALUEOF */ + +} diff --git a/compiler/testData/ir/irText/classes/enumWithMultipleCtors.fir.kt.txt b/compiler/testData/ir/irText/classes/enumWithMultipleCtors.fir.kt.txt new file mode 100644 index 00000000000..461e99bf1b0 --- /dev/null +++ b/compiler/testData/ir/irText/classes/enumWithMultipleCtors.fir.kt.txt @@ -0,0 +1,60 @@ +open enum class A : Enum { + X = A(arg = "asd") + + Y = Y() + private enum entry class Y : A { + private constructor() /* primary */ { + super/*A*/() + /* () */ + + } + + override fun f(): String { + return super.f().plus(other = "#Y") + } + + } + + Z = A(x = 5) + + val prop1: String + get + + val prop2: String + field = "const2" + get + + var prop3: String + field = "" + get + set + + private constructor(arg: String) { + super/*Enum*/() + /* () */ + + .#prop1 = arg + } + + private constructor() { + super/*Enum*/() + /* () */ + + .#prop1 = "default" + .( = "empty") + } + + private constructor(x: Int) { + this/*A*/(arg = x.toString()) + .( = "int") + } + + open fun f(): String { + return .().toString() + "#" + .().toString() + "#" + .().toString() + } + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): A /* Synthetic body for ENUM_VALUEOF */ + +} diff --git a/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.fir.kt.txt b/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.fir.kt.txt new file mode 100644 index 00000000000..e9f1098f803 --- /dev/null +++ b/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.fir.kt.txt @@ -0,0 +1,97 @@ +open enum class Test0 : Enum { + private constructor(x: Int) /* primary */ { + super/*Enum*/() + /* () */ + + } + + val x: Int + field = x + get + + ZERO = Test0() + + private constructor() { + this/*Test0*/(x = 0) + } + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): Test0 /* Synthetic body for ENUM_VALUEOF */ + +} + +open enum class Test1 : Enum { + private constructor(x: Int) /* primary */ { + super/*Enum*/() + /* () */ + + } + + val x: Int + field = x + get + + ZERO = Test1() + + ONE = Test1(x = 1) + + private constructor() { + this/*Test1*/(x = 0) + } + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): Test1 /* Synthetic body for ENUM_VALUEOF */ + +} + +abstract enum class Test2 : Enum { + private constructor(x: Int) /* primary */ { + super/*Enum*/() + /* () */ + + } + + val x: Int + field = x + get + + ZERO = ZERO() + private enum entry class ZERO : Test2 { + private constructor() /* primary */ { + super/*Test2*/() + /* () */ + + } + + override fun foo() { + println(message = "ZERO") + } + + } + + ONE = ONE() + private enum entry class ONE : Test2 { + private constructor() /* primary */ { + super/*Test2*/(x = 1) + /* () */ + + } + + override fun foo() { + println(message = "ONE") + } + + } + + private constructor() { + this/*Test2*/(x = 0) + } + + abstract fun foo() + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): Test2 /* Synthetic body for ENUM_VALUEOF */ + +} diff --git a/compiler/testData/ir/irText/classes/fakeOverridesForJavaStaticMembers.fir.kt.txt b/compiler/testData/ir/irText/classes/fakeOverridesForJavaStaticMembers.fir.kt.txt new file mode 100644 index 00000000000..f4f44ae84e1 --- /dev/null +++ b/compiler/testData/ir/irText/classes/fakeOverridesForJavaStaticMembers.fir.kt.txt @@ -0,0 +1,8 @@ +class Test : Base { + constructor() /* primary */ { + super/*Base*/() + /* () */ + + } + +} diff --git a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.fir.kt.txt b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.fir.kt.txt new file mode 100644 index 00000000000..8ae6aea8d38 --- /dev/null +++ b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.fir.kt.txt @@ -0,0 +1,128 @@ +interface IFoo { + abstract fun foo(): String + +} + +class K1 : JFoo { + constructor() /* primary */ { + super/*JFoo*/() + /* () */ + + } + +} + +class K2 : JFoo { + constructor() /* primary */ { + super/*JFoo*/() + /* () */ + + } + + override fun foo(): @FlexibleNullability String { + return super.foo() + } + +} + +class K3 : JUnrelatedFoo, IFoo { + constructor() /* primary */ { + super/*JUnrelatedFoo*/() + /* () */ + + } + +} + +class K4 : JUnrelatedFoo, IFoo { + constructor() /* primary */ { + super/*JUnrelatedFoo*/() + /* () */ + + } + + override fun foo(): String? { + return super.foo() + } + +} + +class TestJFoo : IFoo { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + .#<$$delegate_0> = JFoo() + } + + override fun foo(): String { + return .#<$$delegate_0>.foo() + } + + local /*final field*/ val <$$delegate_0>: IFoo + +} + +class TestK1 : IFoo { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + .#<$$delegate_0> = K1() + } + + override fun foo(): String { + return .#<$$delegate_0>.foo() + } + + local /*final field*/ val <$$delegate_0>: IFoo + +} + +class TestK2 : IFoo { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + .#<$$delegate_0> = K2() + } + + override fun foo(): String { + return .#<$$delegate_0>.foo() + } + + local /*final field*/ val <$$delegate_0>: IFoo + +} + +class TestK3 : IFoo { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + .#<$$delegate_0> = K3() + } + + override fun foo(): String { + return .#<$$delegate_0>.foo() + } + + local /*final field*/ val <$$delegate_0>: IFoo + +} + +class TestK4 : IFoo { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + .#<$$delegate_0> = K4() + } + + override fun foo(): String { + return .#<$$delegate_0>.foo() + } + + local /*final field*/ val <$$delegate_0>: IFoo + +} diff --git a/compiler/testData/ir/irText/classes/initValInLambda.fir.kt.txt b/compiler/testData/ir/irText/classes/initValInLambda.fir.kt.txt new file mode 100644 index 00000000000..727822427ed --- /dev/null +++ b/compiler/testData/ir/irText/classes/initValInLambda.fir.kt.txt @@ -0,0 +1,18 @@ +class TestInitValInLambdaCalledOnce { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: Int + get + + init { + 1.run(block = local fun Int.() { + .#x = 0 + } +) + } + +} diff --git a/compiler/testData/ir/irText/classes/inlineClass.fir.kt.txt b/compiler/testData/ir/irText/classes/inlineClass.fir.kt.txt new file mode 100644 index 00000000000..f606fd6ab9f --- /dev/null +++ b/compiler/testData/ir/irText/classes/inlineClass.fir.kt.txt @@ -0,0 +1,31 @@ +inline class Test { + constructor(x: Int) /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: Int + field = x + get + + override fun equals(other: Any?): Boolean { + when { + other !is Test -> return false + } + val tmp0_other_with_cast: Test = other as Test + when { + EQEQ(arg0 = .#x, arg1 = tmp0_other_with_cast.#x).not() -> return false + } + return true + } + + override fun hashCode(): Int { + return .#x.hashCode() + } + + override fun toString(): String { + return "Test(" + "x=" + .#x + ")" + } + +} diff --git a/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.fir.kt.txt b/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.fir.kt.txt new file mode 100644 index 00000000000..9e57b45e94a --- /dev/null +++ b/compiler/testData/ir/irText/classes/inlineClassSyntheticMethods.fir.kt.txt @@ -0,0 +1,60 @@ +class C { + constructor(t: T) /* primary */ { + super/*Any*/() + /* () */ + + } + + val t: T + field = t + get + + override fun hashCode(): Int { + return .() as Int + } + +} + +inline class IC { + constructor(c: C) /* primary */ { + super/*Any*/() + /* () */ + + } + + val c: C + field = c + get + + fun foo(): Int { + return .().hashCode() + } + + override fun equals(other: Any?): Boolean { + when { + other !is IC -> return false + } + val tmp0_other_with_cast: IC = other as IC + when { + EQEQ(arg0 = .#c, arg1 = tmp0_other_with_cast.#c).not() -> return false + } + return true + } + + override fun hashCode(): Int { + return .#c.hashCode() + } + + override fun toString(): String { + return "IC(" + "c=" + .#c + ")" + } + +} + +fun box(): String { + val ic: IC = IC(c = C(t = 42)) + when { + EQEQ(arg0 = ic.foo(), arg1 = 42).not() -> return "FAIL" + } + return "OK" +} diff --git a/compiler/testData/ir/irText/classes/innerClass.fir.kt.txt b/compiler/testData/ir/irText/classes/innerClass.fir.kt.txt new file mode 100644 index 00000000000..70489fb8082 --- /dev/null +++ b/compiler/testData/ir/irText/classes/innerClass.fir.kt.txt @@ -0,0 +1,26 @@ +class Outer { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + open inner class TestInnerClass { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + } + + inner class DerivedInnerClass : TestInnerClass { + constructor() /* primary */ { + .super/*TestInnerClass*/() + /* () */ + + } + + } + +} diff --git a/compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.fir.kt.txt b/compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.fir.kt.txt new file mode 100644 index 00000000000..67d9bb6242f --- /dev/null +++ b/compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.fir.kt.txt @@ -0,0 +1,25 @@ +class Outer { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + inner class Inner { + constructor(x: Int) /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: Int + field = x + get + + constructor() { + .this/*Inner*/(x = 0) + } + + } + +} diff --git a/compiler/testData/ir/irText/classes/kt31649.fir.kt.txt b/compiler/testData/ir/irText/classes/kt31649.fir.kt.txt new file mode 100644 index 00000000000..0947f7f3e7e --- /dev/null +++ b/compiler/testData/ir/irText/classes/kt31649.fir.kt.txt @@ -0,0 +1,80 @@ +data class TestData { + constructor(nn: Nothing?) /* primary */ { + super/*Any*/() + /* () */ + + } + + val nn: Nothing? + field = nn + get + + fun component1(): Nothing? { + return .#nn + } + + fun copy(nn: Nothing? = .#nn): TestData { + return TestData(nn = nn) + } + + override fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is TestData -> return false + } + val tmp0_other_with_cast: TestData = other as TestData + when { + EQEQ(arg0 = .#nn, arg1 = tmp0_other_with_cast.#nn).not() -> return false + } + return true + } + + override fun hashCode(): Int { + return when { + EQEQ(arg0 = .#nn, arg1 = null) -> 0 + else -> .#nn.hashCode() + } + } + + override fun toString(): String { + return "TestData(" + "nn=" + .#nn + ")" + } + +} + +inline class TestInline { + constructor(nn: Nothing?) /* primary */ { + super/*Any*/() + /* () */ + + } + + val nn: Nothing? + field = nn + get + + override fun equals(other: Any?): Boolean { + when { + other !is TestInline -> return false + } + val tmp0_other_with_cast: TestInline = other as TestInline + when { + EQEQ(arg0 = .#nn, arg1 = tmp0_other_with_cast.#nn).not() -> return false + } + return true + } + + override fun hashCode(): Int { + return when { + EQEQ(arg0 = .#nn, arg1 = null) -> 0 + else -> .#nn.hashCode() + } + } + + override fun toString(): String { + return "TestInline(" + "nn=" + .#nn + ")" + } + +} diff --git a/compiler/testData/ir/irText/classes/kt43217.fir.kt.txt b/compiler/testData/ir/irText/classes/kt43217.fir.kt.txt new file mode 100644 index 00000000000..bd07aa4c60f --- /dev/null +++ b/compiler/testData/ir/irText/classes/kt43217.fir.kt.txt @@ -0,0 +1,40 @@ +class A { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + private val b: + field = { // BLOCK + local class : DoubleExpression { + private constructor() /* primary */ { + super/*DoubleExpression*/() + /* () */ + + } + + override operator fun get(): Double { + return 0.0D + } + + } + + () + } + private get + +} + +class C : DoubleExpression { + constructor() /* primary */ { + super/*DoubleExpression*/() + /* () */ + + } + + override operator fun get(): Double { + return 0.0D + } + +} diff --git a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.fir.kt.txt b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.fir.kt.txt new file mode 100644 index 00000000000..726406607bb --- /dev/null +++ b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.fir.kt.txt @@ -0,0 +1,99 @@ +data class A { + constructor(runA: @ExtensionFunctionType @ExtensionFunctionType Function2 = local fun A.(it: String) { + return Unit + } +) /* primary */ { + super/*Any*/() + /* () */ + + } + + val runA: @ExtensionFunctionType @ExtensionFunctionType Function2 + field = runA + get + + fun component1(): @ExtensionFunctionType @ExtensionFunctionType Function2 { + return .#runA + } + + fun copy(runA: @ExtensionFunctionType @ExtensionFunctionType Function2 = .#runA): A { + return A(runA = runA) + } + + override fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is A -> return false + } + val tmp0_other_with_cast: A = other as A + when { + EQEQ(arg0 = .#runA, arg1 = tmp0_other_with_cast.#runA).not() -> return false + } + return true + } + + override fun hashCode(): Int { + return .#runA.hashCode() + } + + override fun toString(): String { + return "A(" + "runA=" + .#runA + ")" + } + +} + +data class B { + constructor(x: Any = { // BLOCK + local class { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + } + + () + }) /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: Any + field = x + get + + fun component1(): Any { + return .#x + } + + fun copy(x: Any = .#x): B { + return B(x = x) + } + + override fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is B -> return false + } + val tmp0_other_with_cast: B = other as B + when { + EQEQ(arg0 = .#x, arg1 = tmp0_other_with_cast.#x).not() -> return false + } + return true + } + + override fun hashCode(): Int { + return .#x.hashCode() + } + + override fun toString(): String { + return "B(" + "x=" + .#x + ")" + } + +} diff --git a/compiler/testData/ir/irText/classes/objectLiteralExpressions.fir.kt.txt b/compiler/testData/ir/irText/classes/objectLiteralExpressions.fir.kt.txt new file mode 100644 index 00000000000..b9886d37fce --- /dev/null +++ b/compiler/testData/ir/irText/classes/objectLiteralExpressions.fir.kt.txt @@ -0,0 +1,94 @@ +interface IFoo { + abstract fun foo() + +} + +val test1: + field = { // BLOCK + local class { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + } + + () + } + get + +val test2: IFoo + field = { // BLOCK + local class : IFoo { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + override fun foo() { + println(message = "foo") + } + + } + + () + } + get + +class Outer { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + abstract inner class Inner : IFoo { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + } + + fun test3(): Inner { + return { // BLOCK + local class : Inner { + private constructor() /* primary */ { + .super/*Inner*/() + /* () */ + + } + + override fun foo() { + println(message = "foo") + } + + } + + () + } + } + +} + +fun Outer.test4(): Inner { + return { // BLOCK + local class : Inner { + private constructor() /* primary */ { + .super/*Inner*/() + /* () */ + + } + + override fun foo() { + println(message = "foo") + } + + } + + () + } +} diff --git a/compiler/testData/ir/irText/classes/objectWithInitializers.fir.kt.txt b/compiler/testData/ir/irText/classes/objectWithInitializers.fir.kt.txt new file mode 100644 index 00000000000..2ea6b369681 --- /dev/null +++ b/compiler/testData/ir/irText/classes/objectWithInitializers.fir.kt.txt @@ -0,0 +1,28 @@ +abstract class Base { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +object Test : Base { + private constructor() /* primary */ { + super/*Base*/() + /* () */ + + } + + val x: Int + field = 1 + get + + val y: Int + get + + init { + .#y = .() + } + +} diff --git a/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.fir.kt.txt b/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.fir.kt.txt new file mode 100644 index 00000000000..ad72db20377 --- /dev/null +++ b/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.fir.kt.txt @@ -0,0 +1,47 @@ +open class Base { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +class TestImplicitPrimaryConstructor : Base { + constructor() /* primary */ { + super/*Base*/() + /* () */ + + } + +} + +class TestExplicitPrimaryConstructor : Base { + constructor() /* primary */ { + super/*Base*/() + /* () */ + + } + +} + +class TestWithDelegatingConstructor : Base { + constructor(x: Int, y: Int) /* primary */ { + super/*Base*/() + /* () */ + + } + + val x: Int + field = x + get + + val y: Int + field = y + get + + constructor(x: Int) { + this/*TestWithDelegatingConstructor*/(x = x, y = 0) + } + +} diff --git a/compiler/testData/ir/irText/classes/qualifiedSuperCalls.fir.kt.txt b/compiler/testData/ir/irText/classes/qualifiedSuperCalls.fir.kt.txt new file mode 100644 index 00000000000..b6675975ff3 --- /dev/null +++ b/compiler/testData/ir/irText/classes/qualifiedSuperCalls.fir.kt.txt @@ -0,0 +1,40 @@ +interface ILeft { + fun foo() { + } + + val bar: Int + get(): Int { + return 1 + } + +} + +interface IRight { + fun foo() { + } + + val bar: Int + get(): Int { + return 2 + } + +} + +class CBoth : ILeft, IRight { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + override fun foo() { + super.foo() + super.foo() + } + + override val bar: Int + override get(): Int { + return super.().plus(other = super.()) + } + +} diff --git a/compiler/testData/ir/irText/classes/sealedClasses.fir.kt.txt b/compiler/testData/ir/irText/classes/sealedClasses.fir.kt.txt new file mode 100644 index 00000000000..2c148f51ccb --- /dev/null +++ b/compiler/testData/ir/irText/classes/sealedClasses.fir.kt.txt @@ -0,0 +1,47 @@ +sealed class Expr { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + class Const : Expr { + constructor(number: Double) /* primary */ { + super/*Expr*/() + /* () */ + + } + + val number: Double + field = number + get + + } + + class Sum : Expr { + constructor(e1: Expr, e2: Expr) /* primary */ { + super/*Expr*/() + /* () */ + + } + + val e1: Expr + field = e1 + get + + val e2: Expr + field = e2 + get + + } + + object NotANumber : Expr { + private constructor() /* primary */ { + super/*Expr*/() + /* () */ + + } + + } + +} diff --git a/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.fir.kt.txt b/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.fir.kt.txt new file mode 100644 index 00000000000..997168e114f --- /dev/null +++ b/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.fir.kt.txt @@ -0,0 +1,47 @@ +open class Base { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +class TestProperty : Base { + val x: Int + field = 0 + get + + constructor() { + super/*Base*/() + /* () */ + + } + +} + +class TestInitBlock : Base { + val x: Int + get + + init { + .#x = 0 + } + + constructor() { + super/*Base*/() + /* () */ + + } + + constructor(z: Any) { + super/*Base*/() + /* () */ + + } + + constructor(y: Int) { + this/*TestInitBlock*/() + } + +} diff --git a/compiler/testData/ir/irText/classes/superCalls.fir.kt.txt b/compiler/testData/ir/irText/classes/superCalls.fir.kt.txt new file mode 100644 index 00000000000..abea417af69 --- /dev/null +++ b/compiler/testData/ir/irText/classes/superCalls.fir.kt.txt @@ -0,0 +1,37 @@ +open class Base { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + open fun foo() { + } + + open val bar: String + field = "" + open get + + override fun hashCode(): Int { + return super.hashCode() + } + +} + +class Derived : Base { + constructor() /* primary */ { + super/*Base*/() + /* () */ + + } + + override fun foo() { + super.foo() + } + + override val bar: String + override get(): String { + return super.() + } + +} diff --git a/compiler/testData/ir/irText/classes/superCallsComposed.fir.kt.txt b/compiler/testData/ir/irText/classes/superCallsComposed.fir.kt.txt new file mode 100644 index 00000000000..6eb02e0dfe5 --- /dev/null +++ b/compiler/testData/ir/irText/classes/superCallsComposed.fir.kt.txt @@ -0,0 +1,40 @@ +open class Base { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + open fun foo() { + } + + open val bar: String + field = "" + open get + +} + +interface BaseI { + abstract fun foo() + abstract val bar: String + abstract get + +} + +class Derived : Base, BaseI { + constructor() /* primary */ { + super/*Base*/() + /* () */ + + } + + override fun foo() { + super.foo() + } + + override val bar: String + override get(): String { + return super.() + } + +} diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsInAnnotationArguments.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsInAnnotationArguments.fir.kt.txt new file mode 100644 index 00000000000..ac5cb764f23 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsInAnnotationArguments.fir.kt.txt @@ -0,0 +1,28 @@ +annotation class A1 : Annotation { + constructor(x: Int) /* primary */ + val x: Int + field = x + get + +} + +annotation class A2 : Annotation { + constructor(a: A1) /* primary */ + val a: A1 + field = a + get + +} + +annotation class AA : Annotation { + constructor(xs: Array) /* primary */ + val xs: Array + field = xs + get + +} + +@A2(a = A1(x = 42)) +@AA(xs = [A1(x = 1), A1(x = 2)]) +fun test() { +} diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.kt.txt new file mode 100644 index 00000000000..5d627c4940a --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.kt.txt @@ -0,0 +1,50 @@ +annotation class Ann : Annotation { + constructor() /* primary */ + +} + +interface IFoo { + @Ann + abstract val testVal: String + abstract get + + @Ann + abstract fun testFun() + @Ann + abstract val String.testExtVal: String + abstract get + + @Ann + abstract fun String.testExtFun() + +} + +class DFoo : IFoo { + constructor(d: IFoo) /* primary */ { + super/*Any*/() + /* () */ + + .#<$$delegate_0> = d + } + + override fun testFun() { + .#<$$delegate_0>.testFun() + } + + override fun String.testExtFun() { + (.#<$$delegate_0>, ).testExtFun() + } + + override val testVal: String + override get(): String { + return .#<$$delegate_0>.() + } + + override val String.testExtVal: String + override get(): String { + return (.#<$$delegate_0>, ).() + } + + local /*final field*/ val <$$delegate_0>: IFoo + +} diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.fir.kt.txt new file mode 100644 index 00000000000..3e2c5ad151c --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.fir.kt.txt @@ -0,0 +1,31 @@ +annotation class A : Annotation { + constructor(x: String = "", y: Int = 42) /* primary */ + val x: String + field = x + get + + val y: Int + field = y + get + +} + +@A(x = "abc", y = 123) +fun test1() { +} + +@A(x = "def") +fun test2() { +} + +@A(x = "ghi") +fun test3() { +} + +@A(, y = 456) +fun test4() { +} + +@A +fun test5() { +} diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsWithVarargParameters.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsWithVarargParameters.fir.kt.txt new file mode 100644 index 00000000000..0d5ed9fb16e --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsWithVarargParameters.fir.kt.txt @@ -0,0 +1,19 @@ +annotation class A : Annotation { + constructor(vararg xs: String) /* primary */ + val xs: Array + field = xs + get + +} + +@A(xs = ["abc", "def"]) +fun test1() { +} + +@A(xs = ["abc"]) +fun test2() { +} + +@A(xs = []) +fun test3() { +} diff --git a/compiler/testData/ir/irText/declarations/annotations/arrayInAnnotationArguments.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/arrayInAnnotationArguments.fir.kt.txt new file mode 100644 index 00000000000..d03a05dbf1f --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/arrayInAnnotationArguments.fir.kt.txt @@ -0,0 +1,25 @@ +annotation class TestAnnWithIntArray : Annotation { + constructor(x: IntArray) /* primary */ + val x: IntArray + field = x + get + +} + +annotation class TestAnnWithStringArray : Annotation { + constructor(x: Array) /* primary */ + val x: Array + field = x + get + +} + +@TestAnnWithIntArray(x = [1, 2, 3]) +@TestAnnWithStringArray(x = ["a", "b", "c"]) +fun test1() { +} + +@TestAnnWithIntArray(x = [4, 5, 6]) +@TestAnnWithStringArray(x = ["d", "e", "f"]) +fun test2() { +} diff --git a/compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.fir.kt.txt new file mode 100644 index 00000000000..5244da04b7a --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/classLiteralInAnnotation.fir.kt.txt @@ -0,0 +1,20 @@ +annotation class A : Annotation { + constructor(klass: KClass<*>) /* primary */ + val klass: KClass<*> + field = klass + get + +} + +class C { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +@A(klass = C::class) +fun test1() { +} diff --git a/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.fir.kt.txt new file mode 100644 index 00000000000..4bdfa727a8f --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/classesWithAnnotations.fir.kt.txt @@ -0,0 +1,71 @@ +annotation class TestAnn : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + +} + +@TestAnn(x = "class") +class TestClass { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +@TestAnn(x = "interface") +interface TestInterface { + +} + +@TestAnn(x = "object") +object TestObject { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +class Host { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + @TestAnn(x = "companion") + companion object TestCompanion { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + } + +} + +@TestAnn(x = "enum") +enum class TestEnum : Enum { + private constructor() /* primary */ { + super/*Enum*/() + /* () */ + + } + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnum /* Synthetic body for ENUM_VALUEOF */ + +} + +@TestAnn(x = "annotation") +annotation class TestAnnotation : Annotation { + constructor() /* primary */ + +} diff --git a/compiler/testData/ir/irText/declarations/annotations/constExpressionsInAnnotationArguments.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/constExpressionsInAnnotationArguments.fir.kt.txt new file mode 100644 index 00000000000..d1e9b133d95 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/constExpressionsInAnnotationArguments.fir.kt.txt @@ -0,0 +1,19 @@ +const val ONE: Int + field = 1 + get + +annotation class A : Annotation { + constructor(x: Int) /* primary */ + val x: Int + field = x + get + +} + +@A(x = 1) +fun test1() { +} + +@A(x = 2) +fun test2() { +} diff --git a/compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.fir.kt.txt new file mode 100644 index 00000000000..d73410ec5ad --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/constructorsWithAnnotations.fir.kt.txt @@ -0,0 +1,22 @@ +annotation class TestAnn : Annotation { + constructor(x: Int) /* primary */ + val x: Int + field = x + get + +} + +class TestClass { + @TestAnn(x = 1) + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + @TestAnn(x = 2) + constructor(x: Int) { + this/*TestClass*/() + } + +} diff --git a/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.fir.kt.txt new file mode 100644 index 00000000000..50f94ade6b1 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.fir.kt.txt @@ -0,0 +1,13 @@ +annotation class Ann : Annotation { + constructor() /* primary */ + +} + +val test1: Int /* by */ + field = lazy(initializer = local fun (): Int { + return 42 + } +) + get(): Int { + return #test1$delegate.getValue(thisRef = null, property = ::test1) + } diff --git a/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.fir.kt.txt new file mode 100644 index 00000000000..88ae26ae9aa --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.fir.kt.txt @@ -0,0 +1,47 @@ +annotation class A : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + +} + +class Cell { + constructor(value: Int) /* primary */ { + super/*Any*/() + /* () */ + + } + + var value: Int + field = value + get + set + + operator fun getValue(thisRef: Any?, kProp: Any?): Int { + return .() + } + + operator fun setValue(thisRef: Any?, kProp: Any?, newValue: Int) { + .( = newValue) + } + +} + +val test1: Int /* by */ + field = Cell(value = 1) + @A(x = "test1.get") + get(): Int { + return #test1$delegate.getValue(thisRef = null, kProp = ::test1) + } + +var test2: Int /* by */ + field = Cell(value = 2) + @A(x = "test2.get") + get(): Int { + return #test2$delegate.getValue(thisRef = null, kProp = ::test2) + } + @A(x = "test2.set") + set(@A(x = "test2.set.param") : Int) { + #test2$delegate.setValue(thisRef = null, kProp = ::test2, newValue = ) + } diff --git a/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.fir.kt.txt new file mode 100644 index 00000000000..cc33301670a --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.fir.kt.txt @@ -0,0 +1,39 @@ +annotation class TestAnn : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + +} + +open enum class TestEnum : Enum { + private constructor() /* primary */ { + super/*Enum*/() + /* () */ + + } + + @TestAnn(x = "ENTRY1") + ENTRY1 = TestEnum() + + @TestAnn(x = "ENTRY2") + ENTRY2 = ENTRY2() + @TestAnn(x = "ENTRY2") + private enum entry class ENTRY2 : TestEnum { + private constructor() /* primary */ { + super/*TestEnum*/() + /* () */ + + } + + val x: Int + field = 42 + get + + } + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): TestEnum /* Synthetic body for ENUM_VALUEOF */ + +} diff --git a/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.fir.kt.txt new file mode 100644 index 00000000000..8b8fb80eb7d --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.fir.kt.txt @@ -0,0 +1,32 @@ +enum class En : Enum { + private constructor() /* primary */ { + super/*Enum*/() + /* () */ + + } + + A = En() + + B = En() + + C = En() + + D = En() + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): En /* Synthetic body for ENUM_VALUEOF */ + +} + +annotation class TestAnn : Annotation { + constructor(x: En) /* primary */ + val x: En + field = x + get + +} + +@TestAnn(x = En.A) +fun test1() { +} diff --git a/compiler/testData/ir/irText/declarations/annotations/fieldsWithAnnotations.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/fieldsWithAnnotations.fir.kt.txt new file mode 100644 index 00000000000..65cf9cc5679 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/fieldsWithAnnotations.fir.kt.txt @@ -0,0 +1,16 @@ +annotation class TestAnn : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + +} + +val testVal: String + field = "a val" + get + +var testVar: String + field = "a var" + get + set diff --git a/compiler/testData/ir/irText/declarations/annotations/fileAnnotations.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/fileAnnotations.fir.kt.txt new file mode 100644 index 00000000000..2c6453f4a48 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/fileAnnotations.fir.kt.txt @@ -0,0 +1,11 @@ +@file:A(x = "File annotation") +package test + +@Target(allowedTargets = [AnnotationTarget.FILE]) +annotation class A : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + +} diff --git a/compiler/testData/ir/irText/declarations/annotations/functionsWithAnnotations.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/functionsWithAnnotations.fir.kt.txt new file mode 100644 index 00000000000..fb9f4d773c6 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/functionsWithAnnotations.fir.kt.txt @@ -0,0 +1,11 @@ +annotation class TestAnn : Annotation { + constructor(x: Int) /* primary */ + val x: Int + field = x + get + +} + +@TestAnn(x = 42) +fun testSimpleFunction() { +} diff --git a/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.fir.kt.txt new file mode 100644 index 00000000000..f2c20e552fc --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.fir.kt.txt @@ -0,0 +1,64 @@ +interface IFoo { + @Deprecated(message = "") + val prop: String + get(): String { + return "" + } + + @Deprecated(message = "") + val String.extProp: String + get(): String { + return "" + } + +} + +class Delegated : IFoo { + constructor(foo: IFoo) /* primary */ { + super/*Any*/() + /* () */ + + .#<$$delegate_0> = foo + } + + override val prop: String + override get(): String { + return .#<$$delegate_0>.() + } + + override val String.extProp: String + override get(): String { + return (.#<$$delegate_0>, ).() + } + + local /*final field*/ val <$$delegate_0>: IFoo + +} + +class DefaultImpl : IFoo { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +class ExplicitOverride : IFoo { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + override val prop: String + override get(): String { + return "" + } + + override val String.extProp: String + override get(): String { + return "" + } + +} diff --git a/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.fir.kt.txt new file mode 100644 index 00000000000..996e6c558a6 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.fir.kt.txt @@ -0,0 +1,19 @@ +annotation class A : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + +} + +fun foo(m: Map) { + val test: Int + val test$delegate: Lazy = lazy(initializer = local fun (): Int { + return 42 + } +) + local get(): Int { + return test$delegate.getValue(thisRef = null, property = ::test) + } + +} diff --git a/compiler/testData/ir/irText/declarations/annotations/multipleAnnotationsInSquareBrackets.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/multipleAnnotationsInSquareBrackets.fir.kt.txt new file mode 100644 index 00000000000..583d890bf3e --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/multipleAnnotationsInSquareBrackets.fir.kt.txt @@ -0,0 +1,20 @@ +annotation class A1 : Annotation { + constructor() /* primary */ + +} + +annotation class A2 : Annotation { + constructor() /* primary */ + +} + +annotation class A3 : Annotation { + constructor() /* primary */ + +} + +@A1 +@A2 +@A3 +fun test() { +} diff --git a/compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.fir.kt.txt new file mode 100644 index 00000000000..d5cc5c32c3a --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/primaryConstructorParameterWithAnnotations.fir.kt.txt @@ -0,0 +1,17 @@ +annotation class Ann : Annotation { + constructor() /* primary */ + +} + +class Test { + constructor(@Ann x: Int) /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: Int + field = x + get + +} diff --git a/compiler/testData/ir/irText/declarations/annotations/propertiesWithAnnotations.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/propertiesWithAnnotations.fir.kt.txt new file mode 100644 index 00000000000..3006aada3f3 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/propertiesWithAnnotations.fir.kt.txt @@ -0,0 +1,12 @@ +annotation class TestAnn : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + +} + +@TestAnn(x = "testVal.property") +val testVal: String + field = "" + get diff --git a/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.fir.kt.txt new file mode 100644 index 00000000000..3340c0f3884 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsFromClassHeaderWithAnnotations.fir.kt.txt @@ -0,0 +1,28 @@ +annotation class A : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + +} + +class C { + constructor(x: Int, y: Int) /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: Int + field = x + @A(x = "C.x.get") + get + + var y: Int + field = y + @A(x = "C.y.get") + get + @A(x = "C.y.set") + set + +} diff --git a/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsWithAnnotations.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsWithAnnotations.fir.kt.txt new file mode 100644 index 00000000000..441a53b5564 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/propertyAccessorsWithAnnotations.fir.kt.txt @@ -0,0 +1,34 @@ +annotation class TestAnn : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + +} + +val test1: String + @TestAnn(x = "test1.get") + get(): String { + return "" + } + +var test2: String + @TestAnn(x = "test2.get") + get(): String { + return "" + } + @TestAnn(x = "test2.set") + set(value: String) { + } + +val test3: String + field = "" + @TestAnn(x = "test3.get") + get + +var test4: String + field = "" + @TestAnn(x = "test4.get") + get + @TestAnn(x = "test4.set") + set diff --git a/compiler/testData/ir/irText/declarations/annotations/propertySetterParameterWithAnnotations.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/propertySetterParameterWithAnnotations.fir.kt.txt new file mode 100644 index 00000000000..e64e83fcde1 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/propertySetterParameterWithAnnotations.fir.kt.txt @@ -0,0 +1,23 @@ +annotation class AnnParam : Annotation { + constructor() /* primary */ + +} + +var p: Int + field = 0 + get + set + +class C { + constructor(p: Int) /* primary */ { + super/*Any*/() + /* () */ + + } + + var p: Int + field = p + get + set + +} diff --git a/compiler/testData/ir/irText/declarations/annotations/receiverParameterWithAnnotations.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/receiverParameterWithAnnotations.fir.kt.txt new file mode 100644 index 00000000000..a3fb025d70e --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/receiverParameterWithAnnotations.fir.kt.txt @@ -0,0 +1,31 @@ +annotation class Ann : Annotation { + constructor() /* primary */ + +} + +class A { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + fun @Ann String.f(): String { + return "" + } + + val @Ann String?.p: String + get(): String { + return "" + } + +} + +fun @Ann String?.topLevelF(): String { + return "" +} + +val @Ann String.topLevelP: String + get(): String { + return "" + } diff --git a/compiler/testData/ir/irText/declarations/annotations/spreadOperatorInAnnotationArguments.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/spreadOperatorInAnnotationArguments.fir.kt.txt new file mode 100644 index 00000000000..72a0ed3bd66 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/spreadOperatorInAnnotationArguments.fir.kt.txt @@ -0,0 +1,11 @@ +annotation class A : Annotation { + constructor(vararg xs: String) /* primary */ + val xs: Array + field = xs + get + +} + +@A(xs = ["a", "b"]) +fun test() { +} diff --git a/compiler/testData/ir/irText/declarations/annotations/typeAliasesWithAnnotations.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/typeAliasesWithAnnotations.fir.kt.txt new file mode 100644 index 00000000000..fca88dbbc9c --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/typeAliasesWithAnnotations.fir.kt.txt @@ -0,0 +1,10 @@ +@TestAnn(x = "TestTypeAlias") +typealias TestTypeAlias = String +@Target(allowedTargets = [AnnotationTarget.TYPEALIAS]) +annotation class TestAnn : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + +} diff --git a/compiler/testData/ir/irText/declarations/annotations/typeParametersWithAnnotations.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/typeParametersWithAnnotations.fir.kt.txt new file mode 100644 index 00000000000..a7f3c43c166 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/typeParametersWithAnnotations.fir.kt.txt @@ -0,0 +1,8 @@ +@Target(allowedTargets = [AnnotationTarget.TYPE_PARAMETER]) +annotation class Anno : Annotation { + constructor() /* primary */ + +} + +fun foo() { +} diff --git a/compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.fir.kt.txt new file mode 100644 index 00000000000..15710f9363f --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/valueParametersWithAnnotations.fir.kt.txt @@ -0,0 +1,23 @@ +annotation class TestAnn : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + +} + +fun testFun(@TestAnn(x = "testFun.x") x: Int) { +} + +class TestClassConstructor1 { + constructor(@TestAnn(x = "TestClassConstructor1.x") x: Int) /* primary */ { + super/*Any*/() + /* () */ + + } + + val xx: Int + field = x + get + +} diff --git a/compiler/testData/ir/irText/declarations/annotations/varargsInAnnotationArguments.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/varargsInAnnotationArguments.fir.kt.txt new file mode 100644 index 00000000000..42a3957deb9 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/varargsInAnnotationArguments.fir.kt.txt @@ -0,0 +1,35 @@ +annotation class A1 : Annotation { + constructor(vararg xs: Int) /* primary */ + val xs: IntArray + field = xs + get + +} + +annotation class A2 : Annotation { + constructor(vararg xs: String) /* primary */ + val xs: Array + field = xs + get + +} + +annotation class AA : Annotation { + constructor(vararg xs: A1) /* primary */ + val xs: Array + field = xs + get + +} + +@A1(xs = [1, 2, 3]) +@A2(xs = ["a", "b", "c"]) +@AA(xs = [A1(xs = [4]), A1(xs = [5]), A1(xs = [6])]) +fun test1() { +} + +@A1(xs = []) +@A2(xs = []) +@AA(xs = []) +fun test2() { +} diff --git a/compiler/testData/ir/irText/declarations/annotations/variablesWithAnnotations.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/variablesWithAnnotations.fir.kt.txt new file mode 100644 index 00000000000..a9c7989fc4d --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/variablesWithAnnotations.fir.kt.txt @@ -0,0 +1,12 @@ +annotation class TestAnn : Annotation { + constructor(x: String) /* primary */ + val x: String + field = x + get + +} + +fun foo() { + val testVal: String = "testVal" + var testVar: String = "testVar" +} diff --git a/compiler/testData/ir/irText/declarations/catchParameterInTopLevelProperty.fir.kt.txt b/compiler/testData/ir/irText/declarations/catchParameterInTopLevelProperty.fir.kt.txt new file mode 100644 index 00000000000..1be53a5cc95 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/catchParameterInTopLevelProperty.fir.kt.txt @@ -0,0 +1,7 @@ +val test: Unit + field = try { // BLOCK + } + catch (e: Throwable){ // BLOCK + } + + get diff --git a/compiler/testData/ir/irText/declarations/classLevelProperties.fir.kt.txt b/compiler/testData/ir/irText/declarations/classLevelProperties.fir.kt.txt new file mode 100644 index 00000000000..acb53720654 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/classLevelProperties.fir.kt.txt @@ -0,0 +1,56 @@ +class C { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + val test1: Int + field = 0 + get + + val test2: Int + get(): Int { + return 0 + } + + var test3: Int + field = 0 + get + set + + var test4: Int + field = 1 + get + set(value: Int) { + .#test4 = value + } + + var test5: Int + field = 1 + get + private set + + val test6: Int + field = 1 + get + + val test7: Int /* by */ + field = lazy(initializer = local fun (): Int { + return 42 + } +) + get(): Int { + return .#test7$delegate.getValue(thisRef = , property = C::test7) + } + + var test8: Int? /* by */ + field = hashMapOf() + get(): Int? { + return .#test8$delegate.getValue(thisRef = , property = C::test8) + } + set(: Int?) { + .#test8$delegate.setValue(thisRef = , property = C::test8, value = ) + } + +} diff --git a/compiler/testData/ir/irText/declarations/delegatedProperties.fir.kt.txt b/compiler/testData/ir/irText/declarations/delegatedProperties.fir.kt.txt new file mode 100644 index 00000000000..67b7211da25 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/delegatedProperties.fir.kt.txt @@ -0,0 +1,48 @@ +val test1: Int /* by */ + field = lazy(initializer = local fun (): Int { + return 42 + } +) + get(): Int { + return #test1$delegate.getValue(thisRef = null, property = ::test1) + } + +class C { + constructor(map: MutableMap) /* primary */ { + super/*Any*/() + /* () */ + + } + + val map: MutableMap + field = map + get + + val test2: Int /* by */ + field = lazy(initializer = local fun (): Int { + return 42 + } +) + get(): Int { + return .#test2$delegate.getValue(thisRef = , property = C::test2) + } + + var test3: Any /* by */ + field = .() + get(): Any { + return .#test3$delegate.getValue(thisRef = , property = C::test3) + } + set(: Any) { + .#test3$delegate.setValue(thisRef = , property = C::test3, value = ) + } + +} + +var test4: Any? /* by */ + field = hashMapOf() + get(): Any? { + return #test4$delegate.getValue(thisRef = null, property = ::test4) + } + set(: Any?) { + #test4$delegate.setValue(thisRef = null, property = ::test4, value = ) + } diff --git a/compiler/testData/ir/irText/declarations/fakeOverrides.fir.kt.txt b/compiler/testData/ir/irText/declarations/fakeOverrides.fir.kt.txt new file mode 100644 index 00000000000..35a49aaa6e7 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/fakeOverrides.fir.kt.txt @@ -0,0 +1,35 @@ +interface IFooStr { + abstract fun foo(x: String) + +} + +interface IBar { + abstract val bar: Int + abstract get + +} + +abstract class CFoo { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + fun foo(x: T) { + } + +} + +class Test1 : CFoo, IFooStr, IBar { + constructor() /* primary */ { + super/*CFoo*/() + /* () */ + + } + + override val bar: Int + field = 42 + override get + +} diff --git a/compiler/testData/ir/irText/declarations/genericDelegatedProperty.fir.kt.txt b/compiler/testData/ir/irText/declarations/genericDelegatedProperty.fir.kt.txt new file mode 100644 index 00000000000..23037eff964 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/genericDelegatedProperty.fir.kt.txt @@ -0,0 +1,33 @@ +class C { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +object Delegate { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + operator fun getValue(thisRef: Any?, kProp: Any?): Int { + return 42 + } + + operator fun setValue(thisRef: Any?, kProp: Any?, newValue: Int) { + } + +} + +var C.genericDelegatedProperty: Int /* by */ + field = Delegate + get(): Int { + return #genericDelegatedProperty$delegate.getValue(thisRef = , kProp = ::genericDelegatedProperty/*()*/) + } + set(: Int) { + #genericDelegatedProperty$delegate.setValue(thisRef = , kProp = ::genericDelegatedProperty/*()*/, newValue = ) + } diff --git a/compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.fir.kt.txt b/compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.fir.kt.txt new file mode 100644 index 00000000000..b2da2bf4441 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/inlineCollectionOfInlineClass.fir.kt.txt @@ -0,0 +1,108 @@ +inline class IT { + constructor(x: Int) /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: Int + field = x + get + + override fun equals(other: Any?): Boolean { + when { + other !is IT -> return false + } + val tmp0_other_with_cast: IT = other as IT + when { + EQEQ(arg0 = .#x, arg1 = tmp0_other_with_cast.#x).not() -> return false + } + return true + } + + override fun hashCode(): Int { + return .#x.hashCode() + } + + override fun toString(): String { + return "IT(" + "x=" + .#x + ")" + } + +} + +inline class InlineMutableSet : MutableSet { + constructor(ms: MutableSet) /* primary */ { + super/*Any*/() + /* () */ + + } + + private val ms: MutableSet + field = ms + private get + + override val size: Int + override get(): Int { + return .().() + } + + override operator fun contains(element: IT): Boolean { + return .().contains(element = element) + } + + override fun containsAll(elements: Collection): Boolean { + return .().containsAll(elements = elements) + } + + override fun isEmpty(): Boolean { + return .().isEmpty() + } + + override fun add(element: IT): Boolean { + return .().add(element = element) + } + + override fun addAll(elements: Collection): Boolean { + return .().addAll(elements = elements) + } + + override fun clear() { + .().clear() + } + + override operator fun iterator(): MutableIterator { + return .().iterator() + } + + override fun remove(element: IT): Boolean { + return .().remove(element = element) + } + + override fun removeAll(elements: Collection): Boolean { + return .().removeAll(elements = elements) + } + + override fun retainAll(elements: Collection): Boolean { + return .().retainAll(elements = elements) + } + + override fun equals(other: Any?): Boolean { + when { + other !is InlineMutableSet -> return false + } + val tmp0_other_with_cast: InlineMutableSet = other as InlineMutableSet + when { + EQEQ(arg0 = .#ms, arg1 = tmp0_other_with_cast.#ms).not() -> return false + } + return true + } + + override fun hashCode(): Int { + return .#ms.hashCode() + } + + override fun toString(): String { + return "InlineMutableSet(" + "ms=" + .#ms + ")" + } + +} diff --git a/compiler/testData/ir/irText/declarations/kt29833.fir.kt.txt b/compiler/testData/ir/irText/declarations/kt29833.fir.kt.txt new file mode 100644 index 00000000000..793d73e0144 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/kt29833.fir.kt.txt @@ -0,0 +1,18 @@ +package interop + +object Definitions { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + const val KT_CONSTANT: String? + field = "constant" + get + + val ktValue: String? + field = #CONSTANT + get + +} diff --git a/compiler/testData/ir/irText/declarations/kt35550.fir.kt.txt b/compiler/testData/ir/irText/declarations/kt35550.fir.kt.txt new file mode 100644 index 00000000000..7ed89add857 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/kt35550.fir.kt.txt @@ -0,0 +1,24 @@ +interface I { + val T.id: T + get(): T { + return + } + +} + +class A : I { + constructor(i: I) /* primary */ { + super/*Any*/() + /* () */ + + .#<$$delegate_0> = i + } + + override val T.id: T + override get(): T { + return (.#<$$delegate_0>, ).() + } + + local /*final field*/ val <$$delegate_0>: I + +} diff --git a/compiler/testData/ir/irText/declarations/localClassWithOverrides.fir.kt.txt b/compiler/testData/ir/irText/declarations/localClassWithOverrides.fir.kt.txt new file mode 100644 index 00000000000..c346b56d7d4 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/localClassWithOverrides.fir.kt.txt @@ -0,0 +1,40 @@ +fun outer() { + local abstract class ALocal { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + abstract fun afun() + abstract val aval: Int + abstract get + + abstract var avar: Int + abstract get + abstract set + + } + + local class Local : ALocal { + constructor() /* primary */ { + super/*ALocal*/() + /* () */ + + } + + override fun afun() { + } + + override val aval: Int + field = 1 + override get + + override var avar: Int + field = 2 + override get + override set + + } + +} diff --git a/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.kt.txt b/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.kt.txt new file mode 100644 index 00000000000..bb38bedafe8 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.kt.txt @@ -0,0 +1,29 @@ +fun test1() { + val x: Int + val x$delegate: Lazy = lazy(initializer = local fun (): Int { + return 42 + } +) + local get(): Int { + return x$delegate.getValue(thisRef = null, property = ::x) + } + + println(message = ()) +} + +fun test2() { + var x: Int? + val x$delegate: HashMap = hashMapOf() + local get(): Int? { + return x$delegate.getValue(thisRef = null, property = ::x) + } + local set(: Int?) { + x$delegate.setValue(thisRef = null, property = ::x, value = ) + } + + ( = 0) + val : Int = () /*as Int */ + ( = .inc()) + /*~> Unit */ + ( = () /*as Int */.plus(other = 1)) +} diff --git a/compiler/testData/ir/irText/declarations/localVarInDoWhile.fir.kt.txt b/compiler/testData/ir/irText/declarations/localVarInDoWhile.fir.kt.txt new file mode 100644 index 00000000000..dec2c330262 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/localVarInDoWhile.fir.kt.txt @@ -0,0 +1,5 @@ +fun foo() { + do// COMPOSITE { + val x: Int = 42 + // } while (EQEQ(arg0 = x, arg1 = 42).not()) +} diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectClassInherited.fir.kt.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectClassInherited.fir.kt.txt new file mode 100644 index 00000000000..c377c786972 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectClassInherited.fir.kt.txt @@ -0,0 +1,38 @@ +expect abstract class A { + protected expect constructor() /* primary */ + expect abstract fun foo() + +} + +expect open class B : A { + expect constructor(i: Int) /* primary */ + expect override fun foo() + expect open fun bar(s: String) + +} + +abstract class A { + protected constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + abstract fun foo() + +} + +open class B : A { + constructor(i: Int) /* primary */ { + super/*A*/() + /* () */ + + } + + override fun foo() { + } + + open fun bar(s: String) { + } + +} diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.fir.kt.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.fir.kt.txt new file mode 100644 index 00000000000..28d099e85bd --- /dev/null +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.fir.kt.txt @@ -0,0 +1,29 @@ +expect enum class MyEnum : Enum { + private expect constructor() /* primary */ + FOO = MyEnum() + + BAR = MyEnum() + + expect fun values(): Array + expect fun valueOf(value: String): MyEnum + +} + +enum class MyEnum : Enum { + private constructor() /* primary */ { + super/*Enum*/() + /* () */ + + } + + FOO = MyEnum() + + BAR = MyEnum() + + BAZ = MyEnum() + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): MyEnum /* Synthetic body for ENUM_VALUEOF */ + +} diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.fir.kt.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.fir.kt.txt new file mode 100644 index 00000000000..c409b307440 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.fir.kt.txt @@ -0,0 +1,27 @@ +expect sealed class Ops { + private expect constructor() /* primary */ + +} + +expect class Add : Ops { + expect constructor() /* primary */ + +} + +sealed class Ops { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +class Add : Ops { + constructor() /* primary */ { + super/*Ops*/() + /* () */ + + } + +} diff --git a/compiler/testData/ir/irText/declarations/packageLevelProperties.fir.kt.txt b/compiler/testData/ir/irText/declarations/packageLevelProperties.fir.kt.txt new file mode 100644 index 00000000000..da79cbe2ac8 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/packageLevelProperties.fir.kt.txt @@ -0,0 +1,47 @@ +val test1: Int + field = 0 + get + +val test2: Int + get(): Int { + return 0 + } + +var test3: Int + field = 0 + get + set + +var test4: Int + field = 1 + get + set(value: Int) { + #test4 = value + } + +var test5: Int + field = 1 + get + private set + +val test6: Int + field = 1 + get + +val test7: Int /* by */ + field = lazy(initializer = local fun (): Int { + return 42 + } +) + get(): Int { + return #test7$delegate.getValue(thisRef = null, property = ::test7) + } + +var test8: Int? /* by */ + field = hashMapOf() + get(): Int? { + return #test8$delegate.getValue(thisRef = null, property = ::test8) + } + set(: Int?) { + #test8$delegate.setValue(thisRef = null, property = ::test8, value = ) + } diff --git a/compiler/testData/ir/irText/declarations/parameters/constructor.fir.kt.txt b/compiler/testData/ir/irText/declarations/parameters/constructor.fir.kt.txt new file mode 100644 index 00000000000..31503aa07fc --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/constructor.fir.kt.txt @@ -0,0 +1,80 @@ +class Test1 { + constructor(x: T1, y: T2) /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: T1 + field = x + get + + val y: T2 + field = y + get + +} + +class Test2 { + constructor(x: Int, y: String) /* primary */ { + super/*Any*/() + /* () */ + + } + + val y: String + field = y + get + + inner class TestInner { + constructor(z: Z) /* primary */ { + super/*Any*/() + /* () */ + + } + + val z: Z + field = z + get + + constructor(z: Z, i: Int) { + .this/*TestInner*/(z = z) + } + + } + +} + +class Test3 { + constructor(x: Int, y: String = "") /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: Int + field = x + get + + val y: String + field = y + get + +} + +class Test4 { + constructor(x: Int) /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: Int + field = x + get + + constructor(x: Int, y: Int = 42) { + this/*Test4*/(x = x.plus(other = y)) + } + +} diff --git a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.fir.kt.txt b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.fir.kt.txt new file mode 100644 index 00000000000..c60bd70017d --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.fir.kt.txt @@ -0,0 +1,58 @@ +data class Test { + constructor(x: T, y: String = "") /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: T + field = x + get + + val y: String + field = y + get + + fun component1(): T { + return .#x + } + + fun component2(): String { + return .#y + } + + fun copy(x: T = .#x, y: String = .#y): Test { + return Test(x = x, y = y) + } + + override fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Test -> return false + } + val tmp0_other_with_cast: Test = other as Test + when { + EQEQ(arg0 = .#x, arg1 = tmp0_other_with_cast.#x).not() -> return false + } + when { + EQEQ(arg0 = .#y, arg1 = tmp0_other_with_cast.#y).not() -> return false + } + return true + } + + override fun hashCode(): Int { + var result: Int = when { + EQEQ(arg0 = .#x, arg1 = null) -> 0 + else -> .#x.hashCode() + } + result = result.times(other = 31).plus(other = .#y.hashCode()) + return result + } + + override fun toString(): String { + return "Test(" + "x=" + .#x + ", " + "y=" + .#y + ")" + } + +} diff --git a/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.fir.kt.txt b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.fir.kt.txt new file mode 100644 index 00000000000..f8509a6c22c --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.fir.kt.txt @@ -0,0 +1,33 @@ +interface IBase { + abstract fun foo(x: Int) + abstract val bar: Int + abstract get + + abstract fun qux(t: T, x: X) + +} + +class Test : IBase { + constructor(impl: IBase) /* primary */ { + super/*Any*/() + /* () */ + + .#<$$delegate_0> = impl + } + + override fun foo(x: Int) { + .#<$$delegate_0>.foo(x = x) + } + + override fun qux(t: TT, x: X) { + .#<$$delegate_0>.qux(t = t, x = x) + } + + override val bar: Int + override get(): Int { + return .#<$$delegate_0>.() + } + + local /*final field*/ val <$$delegate_0>: IBase + +} diff --git a/compiler/testData/ir/irText/declarations/parameters/lambdas.fir.kt.txt b/compiler/testData/ir/irText/declarations/parameters/lambdas.fir.kt.txt new file mode 100644 index 00000000000..e097d10a472 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/lambdas.fir.kt.txt @@ -0,0 +1,26 @@ +val test1: Function1 + field = local fun (it: String): String { + return it + } + + get + +val test2: @ExtensionFunctionType @ExtensionFunctionType Function2 + field = local fun Any.(it: Any): Int { + return it.hashCode() + } + + get + +val test3: Function2 + field = local fun (i: Int, j: Int) { + return Unit + } + + get + +val test4: Function2 + field = local fun (i: Int, j: Int) { + } + + get diff --git a/compiler/testData/ir/irText/declarations/parameters/typeParameterBeforeBound.fir.kt.txt b/compiler/testData/ir/irText/declarations/parameters/typeParameterBeforeBound.fir.kt.txt new file mode 100644 index 00000000000..7fb49758dad --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/typeParameterBeforeBound.fir.kt.txt @@ -0,0 +1,17 @@ +class Test1 { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +fun test2() { +} + +var Test1.test3: Unit + get() { + } + set(value: Unit) { + } diff --git a/compiler/testData/ir/irText/declarations/parameters/typeParameterBoundedBySubclass.fir.kt.txt b/compiler/testData/ir/irText/declarations/parameters/typeParameterBoundedBySubclass.fir.kt.txt new file mode 100644 index 00000000000..b070d0dcb67 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/typeParameterBoundedBySubclass.fir.kt.txt @@ -0,0 +1,38 @@ +abstract class Base1 { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +class Derived1 : Base1 { + constructor() /* primary */ { + super/*Base1*/() + /* () */ + + } + +} + +abstract class Base2 { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + fun foo(x: T) { + } + +} + +class Derived2 : Base2 { + constructor() /* primary */ { + super/*Base2*/() + /* () */ + + } + +} diff --git a/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.fir.kt.txt b/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.fir.kt.txt new file mode 100644 index 00000000000..ff26f4f0234 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.fir.kt.txt @@ -0,0 +1,25 @@ +fun f(f1: Function0 = local fun (): ErrorType /* ERROR */ { + return error("") /* ERROR CALL */ +} +, f2: Function0 = local fun (): String { + return "FAIL" +} +): String { + return f1.invoke() +} + +fun box(): String { + var result: String = "fail" + try f() + catch (e: Exception){ // BLOCK + result = "OK" + } + /*~> Unit */ + return f(, f2 = local fun (): String { + return "O" + } +).plus(other = f(f1 = local fun (): String { + return "K" + } +)) +} diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.fir.kt.txt b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.fir.kt.txt new file mode 100644 index 00000000000..175e23fdae8 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.fir.kt.txt @@ -0,0 +1,39 @@ +object Host { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + class StringDelegate { + constructor(s: String) /* primary */ { + super/*Any*/() + /* () */ + + } + + val s: String + field = s + get + + operator fun getValue(receiver: String, p: Any): String { + return receiver.plus(other = .()) + } + + } + + operator fun String.provideDelegate(host: Any?, p: Any): StringDelegate { + return StringDelegate(s = ) + } + + val String.plusK: String /* by */ + field = (, "K").provideDelegate(host = , p = Host::plusK) + get(): String { + return .#plusK$delegate.getValue(receiver = , p = Host::plusK) + } + + val ok: String + field = (, "O").() + get + +} diff --git a/compiler/testData/ir/irText/declarations/typeAlias.fir.kt.txt b/compiler/testData/ir/irText/declarations/typeAlias.fir.kt.txt new file mode 100644 index 00000000000..f10bbf8eb16 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/typeAlias.fir.kt.txt @@ -0,0 +1,14 @@ +typealias Test1 = String +fun foo() { + { // BLOCK + } +} + +class C { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} diff --git a/compiler/testData/ir/irText/errors/unresolvedReference.fir.kt.txt b/compiler/testData/ir/irText/errors/unresolvedReference.fir.kt.txt new file mode 100644 index 00000000000..6194e780b11 --- /dev/null +++ b/compiler/testData/ir/irText/errors/unresolvedReference.fir.kt.txt @@ -0,0 +1,15 @@ +val test1: ErrorType /* ERROR */ + field = error("") /* ERROR CALL */ + get + +val test2: ErrorType /* ERROR */ + field = error("") /* ERROR CALL */ + get + +val test3: ErrorType /* ERROR */ + field = error("") /* ERROR CALL */56; + get + +val test4: ErrorType /* ERROR */ + field = error("") /* ERROR CALL */error("") /* ERROR EXPRESSION */; + get diff --git a/compiler/testData/ir/irText/expressions/argumentMappedWithError.fir.kt.txt b/compiler/testData/ir/irText/expressions/argumentMappedWithError.fir.kt.txt new file mode 100644 index 00000000000..f74e529006e --- /dev/null +++ b/compiler/testData/ir/irText/expressions/argumentMappedWithError.fir.kt.txt @@ -0,0 +1,11 @@ +fun Number.convert(): R { + return TODO() +} + +fun foo(arg: Number) { +} + +fun main(args: Array) { + val x: Int = 0 + foo(arg = x.convert()) +} diff --git a/compiler/testData/ir/irText/expressions/arrayAccess.fir.kt.txt b/compiler/testData/ir/irText/expressions/arrayAccess.fir.kt.txt new file mode 100644 index 00000000000..e33ba09ae54 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/arrayAccess.fir.kt.txt @@ -0,0 +1,11 @@ +val p: Int + field = 0 + get + +fun foo(): Int { + return 1 +} + +fun test(a: IntArray): Int { + return a.get(index = 0).plus(other = a.get(index = ())).plus(other = a.get(index = foo())) +} diff --git a/compiler/testData/ir/irText/expressions/arrayAssignment.fir.kt.txt b/compiler/testData/ir/irText/expressions/arrayAssignment.fir.kt.txt new file mode 100644 index 00000000000..b3e3170c83c --- /dev/null +++ b/compiler/testData/ir/irText/expressions/arrayAssignment.fir.kt.txt @@ -0,0 +1,12 @@ +fun test() { + val x: IntArray = intArrayOf(elements = [1, 2, 3]) + x.set(index = 1, value = 0) +} + +fun foo(): Int { + return 1 +} + +fun test2() { + intArrayOf(elements = [1, 2, 3]).set(index = foo(), value = 1) +} diff --git a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.fir.kt.txt b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.fir.kt.txt new file mode 100644 index 00000000000..7b081b2502e --- /dev/null +++ b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.fir.kt.txt @@ -0,0 +1,45 @@ +fun foo(): IntArray { + return intArrayOf(elements = [1, 2, 3]) +} + +fun bar(): Int { + return 42 +} + +class C { + constructor(x: IntArray) /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: IntArray + field = x + get + +} + +fun testVariable() { + var x: IntArray = foo() + { // BLOCK + val <>: IntArray = x + val <>: Int = 0 + <>.set(index = <>, value = <>.get(index = <>).plus(other = 1)) + } +} + +fun testCall() { + { // BLOCK + val <>: IntArray = foo() + val <>: Int = bar() + <>.set(index = <>, value = <>.get(index = <>).times(other = 2)) + } +} + +fun testMember(c: C) { + val : IntArray = c.() + val : Int = 0 + val : Int = .get(index = ) + .set(index = , value = .inc()) + /*~> Unit */ +} diff --git a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.fir.kt.txt b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.fir.kt.txt new file mode 100644 index 00000000000..4c7242bb03b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.fir.kt.txt @@ -0,0 +1,17 @@ +interface IA { + abstract operator fun get(index: String): Int + +} + +interface IB { + abstract operator fun IA.set(index: String, value: Int) + +} + +fun IB.test(a: IA) { + { // BLOCK + val <>: IA = a + val <>: String = "" + (, <>).set(index = <>, value = <>.get(index = <>).plus(other = 42)) + } +} diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignment1.fir.kt.txt b/compiler/testData/ir/irText/expressions/augmentedAssignment1.fir.kt.txt new file mode 100644 index 00000000000..245950f4c16 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/augmentedAssignment1.fir.kt.txt @@ -0,0 +1,21 @@ +var p: Int + field = 0 + get + set + +fun testVariable() { + var x: Int = 0 + x = x.plus(other = 1) + x = x.minus(other = 2) + x = x.times(other = 3) + x = x.div(other = 4) + x = x.rem(other = 5) +} + +fun testProperty() { + ( = ().plus(other = 1)) + ( = ().minus(other = 2)) + ( = ().times(other = 3)) + ( = ().div(other = 4)) + ( = ().rem(other = 5)) +} diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignment2.fir.kt.txt b/compiler/testData/ir/irText/expressions/augmentedAssignment2.fir.kt.txt new file mode 100644 index 00000000000..553f4cec3e5 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/augmentedAssignment2.fir.kt.txt @@ -0,0 +1,44 @@ +class A { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +operator fun A.plusAssign(s: String) { +} + +operator fun A.minusAssign(s: String) { +} + +operator fun A.timesAssign(s: String) { +} + +operator fun A.divAssign(s: String) { +} + +operator fun A.remAssign(s: String) { +} + +val p: A + field = A() + get + +fun testVariable() { + val a: A = A() + a.plusAssign(s = "+=") + a.minusAssign(s = "-=") + a.timesAssign(s = "*=") + a.divAssign(s = "/=") + a.remAssign(s = "*=") +} + +fun testProperty() { + ().plusAssign(s = "+=") + ().minusAssign(s = "-=") + ().timesAssign(s = "*=") + ().divAssign(s = "/=") + ().remAssign(s = "%=") +} diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.fir.kt.txt b/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.fir.kt.txt new file mode 100644 index 00000000000..c4ee2156298 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.fir.kt.txt @@ -0,0 +1,31 @@ +class Host { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + operator fun plusAssign(x: Int) { + } + + fun test1() { + .plusAssign(x = 1) + } + +} + +fun foo(): Host { + return Host() +} + +fun Host.test2() { + .plusAssign(x = 1) +} + +fun test3() { + foo().plusAssign(x = 1) +} + +fun test4(a: Function0) { + a.invoke().plusAssign(x = 1) +} diff --git a/compiler/testData/ir/irText/expressions/badBreakContinue.fir.kt.txt b/compiler/testData/ir/irText/expressions/badBreakContinue.fir.kt.txt new file mode 100644 index 00000000000..64d184dc86f --- /dev/null +++ b/compiler/testData/ir/irText/expressions/badBreakContinue.fir.kt.txt @@ -0,0 +1,28 @@ +fun test1() { + error("") /* ERROR EXPRESSION */ + error("") /* ERROR EXPRESSION */ +} + +fun test2() { + L1@ while (true) { // BLOCK + error("") /* ERROR EXPRESSION */ + error("") /* ERROR EXPRESSION */ + } +} + +fun test3() { + L1@ while (true) { // BLOCK + val lambda: Function0 = local fun (): Nothing { + break@L1 + continue@L1 + } + + } +} + +fun test4() { + while (error("") /* ERROR EXPRESSION */) { // BLOCK + } + while (error("") /* ERROR EXPRESSION */) { // BLOCK + } +} diff --git a/compiler/testData/ir/irText/expressions/bangbang.fir.kt.txt b/compiler/testData/ir/irText/expressions/bangbang.fir.kt.txt new file mode 100644 index 00000000000..dd8140cc05f --- /dev/null +++ b/compiler/testData/ir/irText/expressions/bangbang.fir.kt.txt @@ -0,0 +1,29 @@ +fun test1(a: Any?): Any { + return CHECK_NOT_NULL(arg0 = a) +} + +fun test2(a: Any?): Int { + return CHECK_NOT_NULL(arg0 = { // BLOCK + val tmp0_safe_receiver: Any? = a + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + else -> tmp0_safe_receiver.hashCode() + } + }) +} + +fun test3(a: X): X { + return CHECK_NOT_NULL(arg0 = a) +} + +fun useString(s: String) { +} + +fun test4(a: X) { + when { + a is String? -> CHECK_NOT_NULL(arg0 = a /*as String? */) /*~> Unit */ + } + when { + a is String? -> useString(s = CHECK_NOT_NULL(arg0 = a /*as String? */)) + } +} diff --git a/compiler/testData/ir/irText/expressions/breakContinue.fir.kt.txt b/compiler/testData/ir/irText/expressions/breakContinue.fir.kt.txt new file mode 100644 index 00000000000..df1be4e5fc9 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/breakContinue.fir.kt.txt @@ -0,0 +1,34 @@ +fun test1() { + while (true) break + dobreak while (true) + while (true) continue + docontinue while (true) +} + +fun test2() { + OUTER@ while (true) { // BLOCK + INNER@ while (true) { // BLOCK + break@INNER + break@OUTER + } + break@OUTER + } + OUTER@ while (true) { // BLOCK + INNER@ while (true) { // BLOCK + continue@INNER + continue@OUTER + } + continue@OUTER + } +} + +fun test3() { + L@ while (true) { // BLOCK + L@ while (true) break@L + break@L + } + L@ while (true) { // BLOCK + L@ while (true) continue@L + continue@L + } +} diff --git a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.kt.txt b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.kt.txt new file mode 100644 index 00000000000..88576c0eed8 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.kt.txt @@ -0,0 +1,78 @@ +fun test1(c: Boolean?) { + L@ while (true) { // BLOCK + L2@ while ({ // BLOCK + val : Boolean? = c + when { + EQEQ(arg0 = , arg1 = null) -> break@L + else -> /*as Boolean */ + } + }) { // BLOCK + } + } +} + +fun test2(c: Boolean?) { + L@ while (true) { // BLOCK + L2@ while ({ // BLOCK + val : Boolean? = c + when { + EQEQ(arg0 = , arg1 = null) -> continue@L + else -> /*as Boolean */ + } + }) { // BLOCK + } + } +} + +fun test3(ss: List?) { + L@ while (true) { // BLOCK + { // BLOCK + val : Iterator = { // BLOCK + val : List? = ss + when { + EQEQ(arg0 = , arg1 = null) -> continue@L + else -> /*as List */ + } + }.iterator() + L2@ while (.hasNext()) { // BLOCK + val s: String = .next() + } + } + } +} + +fun test4(ss: List?) { + L@ while (true) { // BLOCK + { // BLOCK + val : Iterator = { // BLOCK + val : List? = ss + when { + EQEQ(arg0 = , arg1 = null) -> break@L + else -> /*as List */ + } + }.iterator() + L2@ while (.hasNext()) { // BLOCK + val s: String = .next() + } + } + } +} + +fun test5() { + var i: Int = 0 + Outer@ while (true) { // BLOCK + i = i.inc() + i /*~> Unit */ + var j: Int = 0 + Inner@ do// COMPOSITE { + j = j.inc() + j + // } while (when { + greaterOrEqual(arg0 = j, arg1 = 3) -> false + else -> break@Outer + }) + when { + EQEQ(arg0 = i, arg1 = 3) -> break@Outer + } + } +} diff --git a/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.kt.txt b/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.kt.txt new file mode 100644 index 00000000000..9e334cc43e2 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.kt.txt @@ -0,0 +1,70 @@ +fun testBreakFor() { + val xs: IntArray = IntArray(size = 10, init = local fun (i: Int): Int { + return i + } +) + var k: Int = 0 + { // BLOCK + val : IntIterator = xs.iterator() + while (.hasNext()) { // BLOCK + val x: Int = .next() + when { + greater(arg0 = k, arg1 = 2) -> break + } + } + } +} + +fun testBreakWhile() { + var k: Int = 0 + while (less(arg0 = k, arg1 = 10)) when { + greater(arg0 = k, arg1 = 2) -> break + } +} + +fun testBreakDoWhile() { + var k: Int = 0 + dowhen { + greater(arg0 = k, arg1 = 2) -> break + } while (less(arg0 = k, arg1 = 10)) +} + +fun testContinueFor() { + val xs: IntArray = IntArray(size = 10, init = local fun (i: Int): Int { + return i + } +) + var k: Int = 0 + { // BLOCK + val : IntIterator = xs.iterator() + while (.hasNext()) { // BLOCK + val x: Int = .next() + when { + greater(arg0 = k, arg1 = 2) -> continue + } + } + } +} + +fun testContinueWhile() { + var k: Int = 0 + while (less(arg0 = k, arg1 = 10)) when { + greater(arg0 = k, arg1 = 2) -> continue + } +} + +fun testContinueDoWhile() { + var k: Int = 0 + var s: String = "" + do// COMPOSITE { + k = k.inc() + k /*~> Unit */ + when { + greater(arg0 = k, arg1 = 2) -> continue + } + s = s.plus(other = k.toString() + ";") + // } while (less(arg0 = k, arg1 = 10)) + when { + EQEQ(arg0 = s, arg1 = "1;2;").not() -> throw AssertionError(p0 = s) + } +} diff --git a/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.fir.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.fir.kt.txt new file mode 100644 index 00000000000..801dd51fa50 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.fir.kt.txt @@ -0,0 +1,32 @@ +fun use(f: @ExtensionFunctionType @ExtensionFunctionType Function2) { +} + +class C { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +fun C.extensionVararg(i: Int, vararg s: String) { +} + +fun C.extensionDefault(i: Int, s: String = "") { +} + +fun C.extensionBoth(i: Int, s: String = "", vararg t: String) { +} + +fun testExtensionVararg() { + use(f = ::extensionVararg) +} + +fun testExtensionDefault() { + use(f = ::extensionDefault) +} + +fun testExtensionBoth() { + use(f = ::extensionBoth) +} diff --git a/compiler/testData/ir/irText/expressions/callableReferences/adaptedWithCoercionToUnit.fir.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/adaptedWithCoercionToUnit.fir.kt.txt new file mode 100644 index 00000000000..5786451f5dd --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/adaptedWithCoercionToUnit.fir.kt.txt @@ -0,0 +1,45 @@ +fun useUnit0(fn: Function0) { +} + +fun useUnit1(fn: Function1) { +} + +fun fn0(): Int { + return 1 +} + +fun fn1(x: Int): Int { + return 1 +} + +fun fnv(vararg xs: Int): Int { + return 1 +} + +fun test0() { + return useUnit0(fn = local fun fn0() { + fn0() + } +) +} + +fun test1() { + return useUnit1(fn = local fun fn1(p0: Int) { + fn1(x = p0) + } +) +} + +fun testV0() { + return useUnit0(fn = local fun fnv() { + fnv() + } +) +} + +fun testV1() { + return useUnit1(fn = local fun fnv(p0: Int) { + fnv(xs = [p0]) + } +) +} diff --git a/compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.fir.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.fir.kt.txt new file mode 100644 index 00000000000..78394c432fc --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/boundInlineAdaptedReference.fir.kt.txt @@ -0,0 +1,18 @@ +package test + +inline fun foo(x: Function0) { +} + +fun String.id(s: String = , vararg xs: Int): String { + return s +} + +fun test() { + foo(x = { // BLOCK + local fun String.id() { + receiver.id() + } + + "Fail"::id + }) +} diff --git a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.fir.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.fir.kt.txt new file mode 100644 index 00000000000..21a1418b094 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.fir.kt.txt @@ -0,0 +1,97 @@ +fun interface IFoo { + abstract fun foo(i: Int) + +} + +fun interface IFoo2 : IFoo { + +} + +object A { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +object B { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +operator fun A.get(i: IFoo): Int { + return 1 +} + +operator fun A.set(i: IFoo, newValue: Int) { +} + +operator fun B.get(i: IFoo): Int { + return 1 +} + +operator fun B.set(i: IFoo2, newValue: Int) { +} + +fun withVararg(vararg xs: Int): Int { + return 42 +} + +fun test1() { + { // BLOCK + val <>: A = A + val <>: KFunction1 = ::withVararg + error("") /* ERROR CALL */<>; error("") /* ERROR CALL */<>; .plus(other = 1); + } +} + +fun test2() { + { // BLOCK + val <>: B = B + val <>: KFunction1 = ::withVararg + error("") /* ERROR CALL */<>; error("") /* ERROR CALL */<>; .plus(other = 1); + } +} + +fun test3(fn: Function1) { + { // BLOCK + val <>: A = A + val <>: Function1 = fn + <>.set(i = <> /*-> IFoo */, newValue = <>.get(i = <> /*-> IFoo */).plus(other = 1)) + } +} + +fun test4(fn: Function1) { + when { + fn is IFoo -> { // BLOCK + val <>: A = A + val <>: IFoo = fn /*as IFoo */ + <>.set(i = <>, newValue = <>.get(i = <>).plus(other = 1)) + } + } +} + +fun test5(a: Any) { + a as Function1 /*~> Unit */ + { // BLOCK + val <>: A = A + val <>: Function1 = a /*as Function1 */ + <>.set(i = <> /*-> IFoo */, newValue = <>.get(i = <> /*-> IFoo */).plus(other = 1)) + } +} + +fun test6(a: Any) { + a as Function1 /*~> Unit */ + a /*as Function1 */ as IFoo /*~> Unit */ + { // BLOCK + val <>: A = A + val <>: Function1 = a /*as Function1 */ + <>.set(i = <>, newValue = <>.get(i = <>).plus(other = 1)) + } +} diff --git a/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.fir.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.fir.kt.txt new file mode 100644 index 00000000000..d4ac82252f5 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.fir.kt.txt @@ -0,0 +1,42 @@ +fun use(fn: Function1): Any { + return fn.invoke(p1 = 42) +} + +class C { + constructor(vararg xs: Int) /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +class Outer { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + inner class Inner { + constructor(vararg xs: Int) /* primary */ { + super/*Any*/() + /* () */ + + } + + } + +} + +fun testConstructor(): Any { + return use(fn = C::) +} + +fun testInnerClassConstructor(outer: Outer): Any { + return use(fn = outer::) +} + +fun testInnerClassConstructorCapturingOuter(): Any { + return use(fn = Outer()::) +} diff --git a/compiler/testData/ir/irText/expressions/callableReferences/kt37131.fir.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/kt37131.fir.kt.txt new file mode 100644 index 00000000000..f4cd26c31b7 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/kt37131.fir.kt.txt @@ -0,0 +1,28 @@ +fun foo(x: String = ""): String { + return x +} + +class C { + constructor(x: String = "") /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: String + field = x + get + +} + +fun use(fn: Function0): Any { + return fn.invoke() +} + +fun testFn(): Any { + return use(fn = ::foo) +} + +fun testCtor(): Any { + return use(fn = C::) +} diff --git a/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.fir.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.fir.kt.txt new file mode 100644 index 00000000000..43399532177 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/suspendConversion.fir.kt.txt @@ -0,0 +1,99 @@ +fun useSuspend(fn: SuspendFunction0) { +} + +fun useSuspendInt(fn: SuspendFunction1) { +} + +suspend fun foo0() { +} + +fun foo1() { +} + +fun fooInt(x: Int) { +} + +fun foo2(vararg xs: Int) { +} + +fun foo3(): Int { + return 42 +} + +fun foo4(i: Int = 42) { +} + +class C { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + fun bar() { + } + +} + +fun testLambda() { + useSuspend(fn = local suspend fun () { + foo1() + } +) +} + +fun testNoCoversion() { + useSuspend(fn = ::foo0) +} + +fun testSuspendPlain() { + useSuspend(fn = local suspend fun foo1() { + foo1() + } +) +} + +fun testSuspendWithArgs() { + useSuspendInt(fn = local suspend fun fooInt(p0: Int) { + fooInt(x = p0) + } +) +} + +fun testWithVararg() { + useSuspend(fn = local suspend fun foo2() { + foo2() + } +) +} + +fun testWithVarargMapped() { + useSuspendInt(fn = local suspend fun foo2(p0: Int) { + foo2(xs = [p0]) + } +) +} + +fun testWithCoercionToUnit() { + useSuspend(fn = local suspend fun foo3() { + foo3() + } +) +} + +fun testWithDefaults() { + useSuspend(fn = local suspend fun foo4() { + foo4() + } +) +} + +fun testWithBoundReceiver() { + useSuspend(fn = { // BLOCK + local suspend fun C.bar() { + receiver.bar() + } + + C()::bar + }) +} diff --git a/compiler/testData/ir/irText/expressions/callableReferences/typeArguments.fir.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/typeArguments.fir.kt.txt new file mode 100644 index 00000000000..b77a45000ec --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/typeArguments.fir.kt.txt @@ -0,0 +1,29 @@ +object Host { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + inline fun objectMember(x: T) { + } + +} + +inline fun topLevel1(x: T) { +} + +inline fun topLevel2(x: List) { +} + +val test1: Function1 + field = ::topLevel1/*()*/ + get + +val test2: Function1, Unit> + field = ::topLevel2/*()*/ + get + +val test3: Function1 + field = Host::objectMember/*()*/ + get diff --git a/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.fir.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.fir.kt.txt new file mode 100644 index 00000000000..3f60c4c9a20 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.fir.kt.txt @@ -0,0 +1,58 @@ +fun use1(fn: Function2) { +} + +fun use2(fn: Function1) { +} + +open class A { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + open fun foo(vararg xs: Int): Int { + return 1 + } + +} + +object Obj : A { + private constructor() /* primary */ { + super/*A*/() + /* () */ + + } + + override fun foo(vararg xs: Int): Int { + return 1 + } + +} + +fun testUnbound() { + use1(fn = local fun foo(p0: A, p1: Int) { + p0.foo() + } +) +} + +fun testBound(a: A) { + use2(fn = { // BLOCK + local fun A.foo(p0: Int) { + receiver.foo(xs = [p0]) + } + + a::foo + }) +} + +fun testObject() { + use2(fn = { // BLOCK + local fun Obj.foo(p0: Int) { + receiver.foo(xs = [p0]) + } + + Obj::foo + }) +} diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withAdaptationForSam.fir.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptationForSam.fir.kt.txt new file mode 100644 index 00000000000..66a0dce09b3 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptationForSam.fir.kt.txt @@ -0,0 +1,18 @@ +fun interface IFoo { + abstract fun foo(i: Int) + +} + +fun useFoo(foo: IFoo) { +} + +fun withVararg(vararg xs: Int): Int { + return 42 +} + +fun test() { + useFoo(foo = local fun withVararg(p0: Int) { + withVararg(xs = [p0]) + } + /*-> IFoo */) +} diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.fir.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.fir.kt.txt new file mode 100644 index 00000000000..8063416bc28 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.fir.kt.txt @@ -0,0 +1,71 @@ +fun use(fn: Function1): String { + return fn.invoke(p1 = 1) +} + +fun use0(fn: Function0): String { + return fn.invoke() +} + +fun coerceToUnit(fn: Function1) { +} + +fun fnWithDefault(a: Int, b: Int = 42): String { + return "abc" +} + +fun fnWithDefaults(a: Int = 1, b: Int = 2): String { + return "" +} + +fun fnWithVarargs(vararg xs: Int): String { + return "abc" +} + +object Host { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + fun importedObjectMemberWithVarargs(vararg xs: Int): String { + return "abc" + } + +} + +fun testDefault(): String { + return use(fn = ::fnWithDefault) +} + +fun testVararg(): String { + return use(fn = local fun fnWithVarargs(p0: Int): String { + return fnWithVarargs(xs = [p0]) + } +) +} + +fun testCoercionToUnit() { + return coerceToUnit(fn = local fun fnWithDefault(p0: Int) { + fnWithDefault(a = p0) + } +) +} + +fun testImportedObjectMember(): String { + return use(fn = { // BLOCK + local fun Host.importedObjectMemberWithVarargs(p0: Int): String { + return receiver.importedObjectMemberWithVarargs(xs = [p0]) + } + + ::importedObjectMemberWithVarargs + }) +} + +fun testDefault0(): String { + return use0(fn = ::fnWithDefaults) +} + +fun testVararg0(): String { + return use0(fn = ::fnWithVarargs) +} diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.fir.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.fir.kt.txt new file mode 100644 index 00000000000..706b2504009 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.fir.kt.txt @@ -0,0 +1,68 @@ +fun use(fn: Function1) { + fn.invoke(p1 = 1) +} + +class Host { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + fun withVararg(vararg xs: Int): String { + return "" + } + + fun testImplicitThis() { + use(fn = { // BLOCK + local fun Host.withVararg(p0: Int) { + receiver.withVararg(xs = [p0]) + } + + Host::withVararg + }) + } + + fun testBoundReceiverLocalVal() { + val h: Host = Host() + use(fn = { // BLOCK + local fun Host.withVararg(p0: Int) { + receiver.withVararg(xs = [p0]) + } + + h::withVararg + }) + } + + fun testBoundReceiverLocalVar() { + var h: Host = Host() + use(fn = { // BLOCK + local fun Host.withVararg(p0: Int) { + receiver.withVararg(xs = [p0]) + } + + h::withVararg + }) + } + + fun testBoundReceiverParameter(h: Host) { + use(fn = { // BLOCK + local fun Host.withVararg(p0: Int) { + receiver.withVararg(xs = [p0]) + } + + h::withVararg + }) + } + + fun testBoundReceiverExpression() { + use(fn = { // BLOCK + local fun Host.withVararg(p0: Int) { + receiver.withVararg(xs = [p0]) + } + + Host()::withVararg + }) + } + +} diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.fir.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.fir.kt.txt new file mode 100644 index 00000000000..b124b6438db --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.fir.kt.txt @@ -0,0 +1,52 @@ +fun sum(vararg args: Int): Int { + var result: Int = 0 + { // BLOCK + val : IntIterator = args.iterator() + while (.hasNext()) { // BLOCK + val arg: Int = .next() + result = result.plus(other = arg) + } + } + return result +} + +fun nsum(vararg args: Number): Int { + return sum(args = [*IntArray(size = args.(), init = local fun (it: Int): Int { + return args.get(index = it).toInt() + } +)]) +} + +fun zap(vararg b: String, k: Int = 42) { +} + +fun usePlainArgs(fn: Function2) { +} + +fun usePrimitiveArray(fn: Function1) { +} + +fun useArray(fn: Function1, Int>) { +} + +fun useStringArray(fn: Function1, Unit>) { +} + +fun testPlainArgs() { + usePlainArgs(fn = local fun sum(p0: Int, p1: Int): Int { + return sum(args = [p0, p1]) + } +) +} + +fun testPrimitiveArrayAsVararg() { + usePrimitiveArray(fn = ::sum) +} + +fun testArrayAsVararg() { + useArray(fn = ::nsum) +} + +fun testArrayAndDefaults() { + useStringArray(fn = ::zap) +} diff --git a/compiler/testData/ir/irText/expressions/catchParameterAccess.fir.kt.txt b/compiler/testData/ir/irText/expressions/catchParameterAccess.fir.kt.txt new file mode 100644 index 00000000000..ccb59492ec7 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/catchParameterAccess.fir.kt.txt @@ -0,0 +1,5 @@ +fun test(f: Function0) { + return try f.invoke() + catch (e: Exception)throw e + +} diff --git a/compiler/testData/ir/irText/expressions/classReference.fir.kt.txt b/compiler/testData/ir/irText/expressions/classReference.fir.kt.txt new file mode 100644 index 00000000000..e03a82adcb7 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/classReference.fir.kt.txt @@ -0,0 +1,15 @@ +class A { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +fun test() { + A::class /*~> Unit */ + A()::class /*~> Unit */ + A::class.() /*~> Unit */ + A()::class.() /*~> Unit */ +} diff --git a/compiler/testData/ir/irText/expressions/coercionToUnit.fir.kt.txt b/compiler/testData/ir/irText/expressions/coercionToUnit.fir.kt.txt new file mode 100644 index 00000000000..ab06fa52ba3 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/coercionToUnit.fir.kt.txt @@ -0,0 +1,27 @@ +val test1: Function0 + field = local fun (): Int { + return 42 + } + + get + +fun test2(mc: MutableCollection) { + mc.add(element = "") /*~> Unit */ +} + +fun test3() { + { // BLOCK + val tmp0_safe_receiver: PrintStream? = #out + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + else -> tmp0_safe_receiver.println(p0 = "Hello,") + } + } /*~> Unit */ + { // BLOCK + val tmp1_safe_receiver: PrintStream? = #out + when { + EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null + else -> tmp1_safe_receiver.println(p0 = "world!") + } + } /*~> Unit */ +} diff --git a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.fir.kt.txt b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.fir.kt.txt new file mode 100644 index 00000000000..e0c7037a1d5 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.fir.kt.txt @@ -0,0 +1,100 @@ +object X1 { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + var x1: Int + field = 0 + get + set + + object X2 { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + var x2: Int + field = 0 + get + set + + object X3 { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + var x3: Int + field = 0 + get + set + + } + + } + +} + +fun test1(a: IntArray) { + var i: Int = 0 + val : IntArray = a + val : Int = { // BLOCK + val : Int = i + i = .inc() + + } + val : Int = .get(index = ) + .set(index = , value = .inc()) + /*~> Unit */ +} + +fun test2() { + val : X1 = X1 + val : Int = .() + .( = .inc()) + /*~> Unit */ + val : X2 = X2 + val : Int = .() + .( = .inc()) + /*~> Unit */ + val : X3 = X3 + val : Int = .() + .( = .inc()) + /*~> Unit */ +} + +class B { + constructor(s: Int = 0) /* primary */ { + super/*Any*/() + /* () */ + + } + + var s: Int + field = s + get + set + +} + +object Host { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + operator fun B.plusAssign(b: B) { + .( = .().plus(other = b.())) + } + +} + +fun Host.test3(v: B) { + (, v).plusAssign(b = B(s = 1000)) +} diff --git a/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.fir.kt.txt b/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.fir.kt.txt new file mode 100644 index 00000000000..9ab58236aa5 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.fir.kt.txt @@ -0,0 +1,25 @@ +fun testKotlin(): K2 { + return K1().K2() +} + +fun testJava(): J2 { + return J1().J2() +} + +class K1 { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + inner class K2 { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + } + +} diff --git a/compiler/testData/ir/irText/expressions/conventionComparisons.fir.kt.txt b/compiler/testData/ir/irText/expressions/conventionComparisons.fir.kt.txt new file mode 100644 index 00000000000..8759cf24cc9 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/conventionComparisons.fir.kt.txt @@ -0,0 +1,24 @@ +interface IA { + +} + +interface IB { + abstract operator fun IA.compareTo(other: IA): Int + +} + +fun IB.test1(a1: IA, a2: IA): Boolean { + return greater(arg0 = (, a1).compareTo(other = a2), arg1 = 0) +} + +fun IB.test2(a1: IA, a2: IA): Boolean { + return greaterOrEqual(arg0 = (, a1).compareTo(other = a2), arg1 = 0) +} + +fun IB.test3(a1: IA, a2: IA): Boolean { + return less(arg0 = (, a1).compareTo(other = a2), arg1 = 0) +} + +fun IB.test4(a1: IA, a2: IA): Boolean { + return lessOrEqual(arg0 = (, a1).compareTo(other = a2), arg1 = 0) +} diff --git a/compiler/testData/ir/irText/expressions/destructuring1.fir.kt.txt b/compiler/testData/ir/irText/expressions/destructuring1.fir.kt.txt new file mode 100644 index 00000000000..a5f746ddfba --- /dev/null +++ b/compiler/testData/ir/irText/expressions/destructuring1.fir.kt.txt @@ -0,0 +1,31 @@ +object A { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +object B { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + operator fun A.component1(): Int { + return 1 + } + + operator fun A.component2(): Int { + return 2 + } + +} + +fun B.test() { + val : A = A + val x: Int = (, ).component1() + val y: Int = (, ).component2() +} diff --git a/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.fir.kt.txt b/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.fir.kt.txt new file mode 100644 index 00000000000..dff11a75023 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.fir.kt.txt @@ -0,0 +1,36 @@ +object A { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +object B { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + operator fun A.component1(): Int { + return 1 + } + + operator fun A.component2(): Int { + return 2 + } + + operator fun A.component3(): Int { + return 3 + } + +} + +fun B.test() { + val : A = A + val x: Int = (, ).component1() + val _: Int = (, ).component2() + val z: Int = (, ).component3() +} diff --git a/compiler/testData/ir/irText/expressions/elvis.fir.kt.txt b/compiler/testData/ir/irText/expressions/elvis.fir.kt.txt new file mode 100644 index 00000000000..0ec550b8a10 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/elvis.fir.kt.txt @@ -0,0 +1,63 @@ +val p: Any? + field = null + get + +fun foo(): Any? { + return null +} + +fun test1(a: Any?, b: Any): Any { + return { // BLOCK + val : Any? = a + when { + EQEQ(arg0 = , arg1 = null) -> b + else -> /*as Any */ + } + } +} + +fun test2(a: String?, b: Any): Any { + return { // BLOCK + val : String? = a + when { + EQEQ(arg0 = , arg1 = null) -> b + else -> /*as String */ + } + } +} + +fun test3(a: Any?, b: Any?): String { + when { + b !is String -> return "" + } + when { + a !is String? -> return "" + } + return { // BLOCK + val : String? = a /*as String? */ + when { + EQEQ(arg0 = , arg1 = null) -> b /*as String */ + else -> /*as String */ + } + } +} + +fun test4(x: Any): Any { + return { // BLOCK + val : Any? = () + when { + EQEQ(arg0 = , arg1 = null) -> x + else -> /*as Any */ + } + } +} + +fun test5(x: Any): Any { + return { // BLOCK + val : Any? = foo() + when { + EQEQ(arg0 = , arg1 = null) -> x + else -> /*as Any */ + } + } +} diff --git a/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.fir.kt.txt b/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.fir.kt.txt new file mode 100644 index 00000000000..898af00a36b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.fir.kt.txt @@ -0,0 +1,40 @@ +abstract enum class X : Enum { + private constructor() /* primary */ { + super/*Enum*/() + /* () */ + + } + + B = B() + private enum entry class B : X { + private constructor() /* primary */ { + super/*X*/() + /* () */ + + } + + val value2: String + field = "OK" + get + + override val value: Function0 + field = local fun (): String { + return .() + } + + override get + + } + + abstract val value: Function0 + abstract get + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): X /* Synthetic body for ENUM_VALUEOF */ + +} + +fun box(): String { + return X.B.().invoke() +} diff --git a/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.fir.kt.txt b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.fir.kt.txt new file mode 100644 index 00000000000..48ca5fef585 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.fir.kt.txt @@ -0,0 +1,68 @@ +open enum class MyEnum : Enum { + private constructor() /* primary */ { + super/*Enum*/() + /* () */ + + } + + Z = Z() + private enum entry class Z : MyEnum { + private constructor() /* primary */ { + super/*MyEnum*/() + /* () */ + + } + + var counter: Int + field = 0 + get + set + + fun foo() { + } + + fun bar() { + .( = 1) + .foo() + } + + val aLambda: Function0 + field = local fun () { + .( = 1) + .foo() + } + + get + + val anObject: + field = { // BLOCK + local class { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + init { + .( = 1) + .foo() + } + + fun test() { + .( = 1) + .foo() + } + + } + + () + } + get + + } + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): MyEnum /* Synthetic body for ENUM_VALUEOF */ + +} diff --git a/compiler/testData/ir/irText/expressions/equals.fir.kt.txt b/compiler/testData/ir/irText/expressions/equals.fir.kt.txt new file mode 100644 index 00000000000..bfc8d01fbe4 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/equals.fir.kt.txt @@ -0,0 +1,15 @@ +fun testEqeq(a: Int, b: Int): Boolean { + return EQEQ(arg0 = a, arg1 = b) +} + +fun testEquals(a: Int, b: Int): Boolean { + return a.equals(other = b) +} + +fun testJEqeqNull(): Boolean { + return EQEQ(arg0 = #INT_NULL, arg1 = null) +} + +fun testJEqualsNull(): Boolean { + return #INT_NULL.equals(other = null) +} diff --git a/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.fir.kt.txt b/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.fir.kt.txt new file mode 100644 index 00000000000..057c233f5a0 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.fir.kt.txt @@ -0,0 +1,119 @@ +enum class A : Enum { + private constructor() /* primary */ { + super/*Enum*/() + /* () */ + + } + + V1 = A() + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): A /* Synthetic body for ENUM_VALUEOF */ + +} + +fun testVariableAssignment_throws(a: A) { + val x: Int + { // BLOCK + val tmp0_subject: A = a + when { + EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> { // BLOCK + x = 11 + } + else -> noWhenBranchMatchedException() + } + } +} + +fun testStatement_empty(a: A) { + { // BLOCK + val tmp1_subject: A = a + when { + EQEQ(arg0 = tmp1_subject, arg1 = A.V1) -> 1 + else -> noWhenBranchMatchedException() + } + } /*~> Unit */ +} + +fun testParenthesized_throwsJvm(a: A) { + { // BLOCK + val tmp2_subject: A = a + when { + EQEQ(arg0 = tmp2_subject, arg1 = A.V1) -> 1 + else -> noWhenBranchMatchedException() + } + } /*~> Unit */ +} + +fun testAnnotated_throwsJvm(a: A) { + { // BLOCK + val tmp3_subject: A = a + when { + EQEQ(arg0 = tmp3_subject, arg1 = A.V1) -> 1 + else -> noWhenBranchMatchedException() + } + } /*~> Unit */ +} + +fun testExpression_throws(a: A): Int { + return { // BLOCK + val tmp4_subject: A = a + when { + EQEQ(arg0 = tmp4_subject, arg1 = A.V1) -> 1 + else -> noWhenBranchMatchedException() + } + } +} + +fun testIfTheElseStatement_empty(a: A, flag: Boolean) { + when { + flag -> 0 + else -> { // BLOCK + val tmp5_subject: A = a + when { + EQEQ(arg0 = tmp5_subject, arg1 = A.V1) -> 1 + else -> noWhenBranchMatchedException() + } + } + } /*~> Unit */ +} + +fun testIfTheElseParenthesized_throwsJvm(a: A, flag: Boolean) { + when { + flag -> 0 + else -> { // BLOCK + val tmp6_subject: A = a + when { + EQEQ(arg0 = tmp6_subject, arg1 = A.V1) -> 1 + else -> noWhenBranchMatchedException() + } + } + } /*~> Unit */ +} + +fun testIfTheElseAnnotated_throwsJvm(a: A, flag: Boolean) { + when { + flag -> 0 + else -> { // BLOCK + val tmp7_subject: A = a + when { + EQEQ(arg0 = tmp7_subject, arg1 = A.V1) -> 1 + else -> noWhenBranchMatchedException() + } + } + } /*~> Unit */ +} + +fun testLambdaResultExpression_throws(a: A) { + local fun (): Int { + return { // BLOCK + val tmp8_subject: A = a + when { + EQEQ(arg0 = tmp8_subject, arg1 = A.V1) -> 1 + else -> noWhenBranchMatchedException() + } + } + } +.invoke() /*~> Unit */ +} diff --git a/compiler/testData/ir/irText/expressions/extFunInvokeAsFun.fir.kt.txt b/compiler/testData/ir/irText/expressions/extFunInvokeAsFun.fir.kt.txt new file mode 100644 index 00000000000..de1341623b5 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/extFunInvokeAsFun.fir.kt.txt @@ -0,0 +1,7 @@ +fun with1(receiver: Any?, block: @ExtensionFunctionType @ExtensionFunctionType Function1) { + return block.invoke(p1 = receiver) +} + +fun with2(receiver: Any?, block: @ExtensionFunctionType @ExtensionFunctionType Function1) { + return block.invoke(p1 = receiver) +} diff --git a/compiler/testData/ir/irText/expressions/extFunSafeInvoke.fir.kt.txt b/compiler/testData/ir/irText/expressions/extFunSafeInvoke.fir.kt.txt new file mode 100644 index 00000000000..dff7557aa76 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/extFunSafeInvoke.fir.kt.txt @@ -0,0 +1,9 @@ +fun test(receiver: Any?, fn: @ExtensionFunctionType @ExtensionFunctionType Function3): Unit? { + return { // BLOCK + val tmp0_safe_receiver: Any? = receiver + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + else -> fn.invoke(p1 = tmp0_safe_receiver, p2 = 42, p3 = "Hello") + } + } +} diff --git a/compiler/testData/ir/irText/expressions/field.fir.kt.txt b/compiler/testData/ir/irText/expressions/field.fir.kt.txt new file mode 100644 index 00000000000..810d860b9b1 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/field.fir.kt.txt @@ -0,0 +1,13 @@ +var testSimple: Int + field = 0 + get + set(value: Int) { + #testSimple = value + } + +var testAugmented: Int + field = 0 + get + set(value: Int) { + #testAugmented = #testAugmented.plus(other = value) + } diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEquals.fir.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEquals.fir.kt.txt new file mode 100644 index 00000000000..a1ed83271ac --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEquals.fir.kt.txt @@ -0,0 +1,115 @@ +fun test1d(x: Double, y: Double): Boolean { + return x.equals(other = y) +} + +fun test2d(x: Double, y: Double?): Boolean { + return x.equals(other = y) +} + +fun test3d(x: Double, y: Any): Boolean { + return x.equals(other = y) +} + +fun test4d(x: Double, y: Number): Boolean { + return x.equals(other = y) +} + +fun test5d(x: Double, y: Any): Boolean { + return when { + y is Double -> x.equals(other = y /*as Double */) + else -> false + } +} + +fun test6d(x: Any, y: Any): Boolean { + return when { + when { + x is Double -> y is Double + else -> false + } -> x /*as Double */.equals(other = y /*as Double */) + else -> false + } +} + +fun test1f(x: Float, y: Float): Boolean { + return x.equals(other = y) +} + +fun test2f(x: Float, y: Float?): Boolean { + return x.equals(other = y) +} + +fun test3f(x: Float, y: Any): Boolean { + return x.equals(other = y) +} + +fun test4f(x: Float, y: Number): Boolean { + return x.equals(other = y) +} + +fun test5f(x: Float, y: Any): Boolean { + return when { + y is Float -> x.equals(other = y /*as Float */) + else -> false + } +} + +fun test6f(x: Any, y: Any): Boolean { + return when { + when { + x is Float -> y is Float + else -> false + } -> x /*as Float */.equals(other = y /*as Float */) + else -> false + } +} + +fun testFD(x: Any, y: Any): Boolean { + return when { + when { + x is Float -> y is Double + else -> false + } -> x /*as Float */.equals(other = y /*as Double */) + else -> false + } +} + +fun testDF(x: Any, y: Any): Boolean { + return when { + when { + x is Double -> y is Float + else -> false + } -> x /*as Double */.equals(other = y /*as Float */) + else -> false + } +} + +fun Float.test1fr(x: Float): Boolean { + return .equals(other = x) +} + +fun Float.test2fr(x: Float?): Boolean { + return .equals(other = x) +} + +fun Float.test3fr(x: Any): Boolean { + return .equals(other = x) +} + +fun Float.test4fr(x: Number): Boolean { + return .equals(other = x) +} + +fun Float.test5fr(x: Any): Boolean { + return when { + x is Float -> .equals(other = x /*as Float */) + else -> false + } +} + +fun Float.test6fr(x: Any): Boolean { + return when { + x is Double -> .equals(other = x /*as Double */) + else -> false + } +} diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.fir.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.fir.kt.txt new file mode 100644 index 00000000000..88e971888fe --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.fir.kt.txt @@ -0,0 +1,6 @@ +fun test(x: Any?, y: Double): Boolean { + return when { + x is Int -> less(arg0 = x /*as Int */.toDouble(), arg1 = y) + else -> false + } +} diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.fir.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.fir.kt.txt new file mode 100644 index 00000000000..e9599a84b7d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.fir.kt.txt @@ -0,0 +1,45 @@ +fun testDD(x: Double?, y: Double?): Boolean { + return ieee754equals(arg0 = x, arg1 = y) +} + +fun testDF(x: Double?, y: Any?): Boolean { + return when { + y is Float? -> ieee754equals(arg0 = x, arg1 = { // BLOCK + val tmp0_safe_receiver: Float? = y /*as Float? */ + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + else -> tmp0_safe_receiver.toDouble() + } + }) + else -> false + } +} + +fun testDI(x: Double?, y: Any?): Boolean { + return when { + y is Int? -> ieee754equals(arg0 = x, arg1 = { // BLOCK + val tmp1_safe_receiver: Int? = y /*as Int? */ + when { + EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null + else -> tmp1_safe_receiver.toDouble() + } + }) + else -> false + } +} + +fun testDI2(x: Any?, y: Any?): Boolean { + return when { + when { + x is Int? -> y is Double + else -> false + } -> ieee754equals(arg0 = { // BLOCK + val tmp2_safe_receiver: Int? = x /*as Int? */ + when { + EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null + else -> tmp2_safe_receiver.toDouble() + } + }, arg1 = y /*as Double */) + else -> false + } +} diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.fir.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.fir.kt.txt new file mode 100644 index 00000000000..879bb4ba492 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.fir.kt.txt @@ -0,0 +1,64 @@ +fun test0(x: Any, y: T): Boolean { + return when { + x is Int -> EQEQ(arg0 = x /*as Int */, arg1 = y) + else -> false + } +} + +fun test1(x: Any, y: T): Boolean { + return when { + x is Float -> ieee754equals(arg0 = x /*as Float */, arg1 = y) + else -> false + } +} + +fun test2(x: Any, y: T): Boolean { + return when { + x is Float -> ieee754equals(arg0 = x /*as Float */.toDouble(), arg1 = y) + else -> false + } +} + +fun test3(x: Any, y: T): Boolean { + return when { + x is Int -> ieee754equals(arg0 = x /*as Int */.toFloat(), arg1 = y) + else -> false + } +} + +fun test4(x: Any, y: T): Boolean { + return when { + x is Int -> ieee754equals(arg0 = x /*as Int */.toFloat(), arg1 = y) + else -> false + } +} + +fun test5(x: Any, y: R): Boolean { + return when { + x is Int -> ieee754equals(arg0 = x /*as Int */.toFloat(), arg1 = y) + else -> false + } +} + +fun test6(x: Any, y: T): Boolean { + return when { + x is Int -> EQEQ(arg0 = x /*as Int */, arg1 = y) + else -> false + } +} + +class F { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + fun testCapturedType(x: T, y: Any): Boolean { + return when { + y is Double -> ieee754equals(arg0 = x.toDouble(), arg1 = y /*as Double */) + else -> false + } + } + +} diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.fir.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.fir.kt.txt new file mode 100644 index 00000000000..da3ff7b2233 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.fir.kt.txt @@ -0,0 +1,79 @@ +fun testSimple(x: Double): Int { + return { // BLOCK + val tmp0_subject: Double = x + when { + ieee754equals(arg0 = tmp0_subject, arg1 = 0.0D) -> 0 + else -> 1 + } + } +} + +fun testSmartCastInWhenSubject(x: Any): Int { + when { + x !is Double -> return -1 + } + return { // BLOCK + val tmp1_subject: Double = x /*as Double */ + when { + ieee754equals(arg0 = tmp1_subject, arg1 = 0.0D) -> 0 + else -> 1 + } + } +} + +fun testSmartCastInWhenCondition(x: Double, y: Any): Int { + when { + y !is Double -> return -1 + } + return { // BLOCK + val tmp2_subject: Double = x + when { + ieee754equals(arg0 = tmp2_subject, arg1 = y /*as Double */) -> 0 + else -> 1 + } + } +} + +fun testSmartCastInWhenConditionInBranch(x: Any): Int { + return { // BLOCK + val tmp3_subject: Any = x + when { + tmp3_subject !is Double -> -1 + EQEQ(arg0 = tmp3_subject, arg1 = 0.0D) -> 0 + else -> 1 + } + } +} + +fun testSmartCastToDifferentTypes(x: Any, y: Any): Int { + when { + x !is Double -> return -1 + } + when { + y !is Float -> return -1 + } + return { // BLOCK + val tmp4_subject: Double = x /*as Double */ + when { + ieee754equals(arg0 = tmp4_subject, arg1 = y /*as Float */.toDouble()) -> 0 + else -> 1 + } + } +} + +fun foo(x: Double): Double { + return x +} + +fun testWithPrematureExitInConditionSubexpression(x: Any): Int { + return { // BLOCK + val tmp5_subject: Any = x + when { + EQEQ(arg0 = tmp5_subject, arg1 = foo(x = when { + x !is Double -> return 42 + else -> x /*as Double */ + })) -> 0 + else -> 1 + } + } +} diff --git a/compiler/testData/ir/irText/expressions/for.fir.kt.txt b/compiler/testData/ir/irText/expressions/for.fir.kt.txt new file mode 100644 index 00000000000..d24d3e0c666 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/for.fir.kt.txt @@ -0,0 +1,40 @@ +fun testEmpty(ss: List) { + { // BLOCK + val : Iterator = ss.iterator() + while (.hasNext()) { // BLOCK + val s: String = .next() + } + } +} + +fun testIterable(ss: List) { + { // BLOCK + val : Iterator = ss.iterator() + while (.hasNext()) { // BLOCK + val s: String = .next() + println(message = s) + } + } +} + +fun testDestructuring(pp: List>) { + { // BLOCK + val : Iterator> = pp.iterator() + while (.hasNext()) { // BLOCK + val : Pair = .next() + val i: Int = .component1() + val s: String = .component2() + println(message = i) + println(message = s) + } + } +} + +fun testRange() { + { // BLOCK + val : IntIterator = 1.rangeTo(other = 10).iterator() + while (.hasNext()) { // BLOCK + val i: Int = .next() + } + } +} diff --git a/compiler/testData/ir/irText/expressions/forWithBreakContinue.fir.kt.txt b/compiler/testData/ir/irText/expressions/forWithBreakContinue.fir.kt.txt new file mode 100644 index 00000000000..2a96bfab610 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/forWithBreakContinue.fir.kt.txt @@ -0,0 +1,57 @@ +fun testForBreak1(ss: List) { + { // BLOCK + val : Iterator = ss.iterator() + while (.hasNext()) { // BLOCK + val s: String = .next() + break + } + } +} + +fun testForBreak2(ss: List) { + { // BLOCK + val : Iterator = ss.iterator() + OUTER@ while (.hasNext()) { // BLOCK + val s1: String = .next() + { // BLOCK + val : Iterator = ss.iterator() + INNER@ while (.hasNext()) { // BLOCK + val s2: String = .next() + break@OUTER + break@INNER + break@INNER + } + } + break@OUTER + } + } +} + +fun testForContinue1(ss: List) { + { // BLOCK + val : Iterator = ss.iterator() + while (.hasNext()) { // BLOCK + val s: String = .next() + continue + } + } +} + +fun testForContinue2(ss: List) { + { // BLOCK + val : Iterator = ss.iterator() + OUTER@ while (.hasNext()) { // BLOCK + val s1: String = .next() + { // BLOCK + val : Iterator = ss.iterator() + INNER@ while (.hasNext()) { // BLOCK + val s2: String = .next() + continue@OUTER + continue@INNER + continue@INNER + } + } + continue@OUTER + } + } +} diff --git a/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.fir.kt.txt b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.fir.kt.txt new file mode 100644 index 00000000000..713711ed6f5 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.fir.kt.txt @@ -0,0 +1,51 @@ +object FiveTimes { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +class IntCell { + constructor(value: Int) /* primary */ { + super/*Any*/() + /* () */ + + } + + var value: Int + field = value + get + set + +} + +interface IReceiver { + operator fun FiveTimes.iterator(): IntCell { + return IntCell(value = 5) + } + + operator fun IntCell.hasNext(): Boolean { + return greater(arg0 = .(), arg1 = 0) + } + + operator fun IntCell.next(): Int { + return { // BLOCK + val : Int = .() + .( = .dec()) + + } + } + +} + +fun IReceiver.test() { + { // BLOCK + val : IntCell = (, FiveTimes).iterator() + while ((, ).hasNext()) { // BLOCK + val i: Int = (, ).next() + println(message = i) + } + } +} diff --git a/compiler/testData/ir/irText/expressions/funInterface/partialSam.fir.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/partialSam.fir.kt.txt new file mode 100644 index 00000000000..cd1a19710b7 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funInterface/partialSam.fir.kt.txt @@ -0,0 +1,66 @@ +fun interface Fn { + abstract fun run(s: String, i: Int, t: T): R + +} + +class J { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + fun runConversion(f1: Fn, f2: Fn): Int { + return f1.run(s = "Bar", i = 1, t = f2.run(s = "Foo", i = 42, t = 239)) + } + +} + +val fsi: Fn + field = { // BLOCK + local class : Fn { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + override fun run(s: String, i: Int, t: String): Int { + return 1 + } + + } + + () + } + get + +val fis: Fn + field = { // BLOCK + local class : Fn { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + override fun run(s: String, i: Int, t: Int): String { + return "" + } + + } + + () + } + get + +fun test(j: J) { + j.runConversion(f1 = (), f2 = local fun (s: String, i: Int, ti: Int): String { + return "" + } + /*-> Fn */) /*~> Unit */ + j.runConversion(f1 = local fun (s: String, i: Int, ts: String): Int { + return 1 + } + /*-> Fn */, f2 = ()) /*~> Unit */ +} diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargs.fir.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargs.fir.kt.txt new file mode 100644 index 00000000000..d37014897d3 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargs.fir.kt.txt @@ -0,0 +1,38 @@ +fun interface IFoo { + abstract fun foo(i: Int) + +} + +fun useVararg(vararg foos: IFoo) { +} + +fun testLambda() { + useVararg(foos = [local fun (it: Int) { + return Unit + } + /*-> IFoo */]) +} + +fun testSeveralLambdas() { + useVararg(foos = [local fun (it: Int) { + return Unit + } + /*-> IFoo */, local fun (it: Int) { + return Unit + } + /*-> IFoo */, local fun (it: Int) { + return Unit + } + /*-> IFoo */]) +} + +fun withVarargOfInt(vararg xs: Int): String { + return "" +} + +fun testAdaptedCR() { + useVararg(foos = [local fun withVarargOfInt(p0: Int) { + withVarargOfInt(xs = [p0]) + } + /*-> IFoo */]) +} diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.fir.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.fir.kt.txt new file mode 100644 index 00000000000..4e96e4a9a78 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.fir.kt.txt @@ -0,0 +1,16 @@ +fun interface MyRunnable { + abstract fun run() + +} + +fun test(a: Any, r: MyRunnable) { + when { + a is MyRunnable -> foo(rs = [local fun () { + return Unit + } + /*-> MyRunnable */, r, a /*as MyRunnable */]) + } +} + +fun foo(vararg rs: MyRunnable) { +} diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.fir.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.fir.kt.txt new file mode 100644 index 00000000000..38484efcba1 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.fir.kt.txt @@ -0,0 +1,36 @@ +fun interface KRunnable { + abstract fun run() + +} + +fun foo0() { +} + +fun foo1(vararg xs: Int): Int { + return 1 +} + +fun use(r: KRunnable) { +} + +fun testSamConstructor(): KRunnable { + return ::foo0 /*-> KRunnable */ +} + +fun testSamCosntructorOnAdapted(): KRunnable { + return local fun foo1() { + foo1() + } + /*-> KRunnable */ +} + +fun testSamConversion() { + use(r = ::foo0 /*-> KRunnable */) +} + +fun testSamConversionOnAdapted() { + use(r = local fun foo1() { + foo1() + } + /*-> KRunnable */) +} diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.fir.kt.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.fir.kt.txt new file mode 100644 index 00000000000..b769f5e4a61 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.fir.kt.txt @@ -0,0 +1,69 @@ +fun interface KRunnable { + abstract fun run() + +} + +fun id(x: T): T { + return x +} + +fun run1(r: KRunnable) { +} + +fun run2(r1: KRunnable, r2: KRunnable) { +} + +fun test0(a: T) where T : KRunnable, T : Function0 { + run1(r = a) +} + +fun test1(a: Function0) { + when { + a is KRunnable -> run1(r = a /*as KRunnable */) + } +} + +fun test2(a: KRunnable) { + a as Function0 /*~> Unit */ + run1(r = a /*as Function0 */) +} + +fun test3(a: Function0) { + when { + a is KRunnable -> run2(r1 = a /*as KRunnable */, r2 = a /*as KRunnable */) + } +} + +fun test4(a: Function0, b: Function0) { + when { + a is KRunnable -> run2(r1 = a /*as KRunnable */, r2 = b /*-> KRunnable */) + } +} + +fun test5(a: Any) { + when { + a is KRunnable -> run1(r = a /*as KRunnable */) + } +} + +fun test5x(a: Any) { + when { + a is KRunnable -> { // BLOCK + a /*as KRunnable */ as Function0 /*~> Unit */ + run1(r = a /*as KRunnable */) + } + } +} + +fun test6(a: Any) { + a as Function0 /*~> Unit */ + run1(r = a /*as Function0 */ /*-> KRunnable */) +} + +fun test8(a: Function0) { + run1(r = id>(x = a) /*-> KRunnable */) +} + +fun test9() { + run1(r = ::test9 /*-> KRunnable */) +} diff --git a/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.fir.kt.txt b/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.fir.kt.txt new file mode 100644 index 00000000000..a313764ee48 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.fir.kt.txt @@ -0,0 +1,23 @@ +fun testSimple(): Box { + return Box(value = 6L) +} + +inline fun testArray(n: Int, crossinline block: Function0): Array { + return Array(size = n, init = local fun (it: Int): T { + return block.invoke() + } +) +} + +class Box { + constructor(value: T) /* primary */ { + super/*Any*/() + /* () */ + + } + + val value: T + field = value + get + +} diff --git a/compiler/testData/ir/irText/expressions/genericPropertyRef.fir.kt.txt b/compiler/testData/ir/irText/expressions/genericPropertyRef.fir.kt.txt new file mode 100644 index 00000000000..92837ccb850 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/genericPropertyRef.fir.kt.txt @@ -0,0 +1,70 @@ +class Value { + constructor(value: T = null as T, text: String? = null) /* primary */ { + super/*Any*/() + /* () */ + + } + + var value: T + field = value + get + set + + var text: String? + field = text + get + set + +} + +val Value.additionalText: Int /* by */ + field = DVal(kmember = Value::text) + get(): Int { + return #additionalText$delegate.getValue(t = , p = ::additionalText/*()*/) + } + +val Value.additionalValue: Int /* by */ + field = DVal(kmember = Value::value) + get(): Int { + return #additionalValue$delegate.getValue(t = , p = ::additionalValue/*()*/) + } + +class DVal { + constructor(kmember: Any) /* primary */ { + super/*Any*/() + /* () */ + + } + + val kmember: Any + field = kmember + get + + operator fun getValue(t: Any?, p: Any): Int { + return 42 + } + +} + +var recivier: Any? + field = "fail" + get + set + +var value2: Any? + field = "fail2" + get + set + +var T.bar: T + get(): T { + return + } + set(value: T) { + ( = ) + ( = value) + } + +val barRef: KMutableProperty1 + field = ::bar/*()*/ + get diff --git a/compiler/testData/ir/irText/expressions/ifElseIf.fir.kt.txt b/compiler/testData/ir/irText/expressions/ifElseIf.fir.kt.txt new file mode 100644 index 00000000000..dc7d00ebb86 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/ifElseIf.fir.kt.txt @@ -0,0 +1,39 @@ +fun test(i: Int): Int { + return when { + greater(arg0 = i, arg1 = 0) -> 1 + else -> when { + less(arg0 = i, arg1 = 0) -> -1 + else -> 0 + } + } +} + +fun testEmptyBranches1(flag: Boolean) { + when { + flag -> { // BLOCK + } + else -> true + } /*~> Unit */ + when { + flag -> true + } +} + +fun testEmptyBranches2(flag: Boolean) { + when { + flag -> { // BLOCK + } + else -> true + } /*~> Unit */ + when { + flag -> true + } +} + +fun testEmptyBranches3(flag: Boolean) { + when { + flag -> { // BLOCK + } + else -> true + } /*~> Unit */ +} diff --git a/compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.fir.kt.txt b/compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.fir.kt.txt new file mode 100644 index 00000000000..23546a6f1f1 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.fir.kt.txt @@ -0,0 +1,15 @@ +class C { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + constructor(x: Any?) { + this/*C*/() + when { + x is Unit -> return x /*as Unit */ + } + } + +} diff --git a/compiler/testData/ir/irText/expressions/implicitCastOnPlatformType.fir.kt.txt b/compiler/testData/ir/irText/expressions/implicitCastOnPlatformType.fir.kt.txt new file mode 100644 index 00000000000..174fb1c518b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/implicitCastOnPlatformType.fir.kt.txt @@ -0,0 +1,3 @@ +fun test(): String { + return getProperty(p0 = "test") /*!! String */ +} diff --git a/compiler/testData/ir/irText/expressions/implicitCastToNonNull.fir.kt.txt b/compiler/testData/ir/irText/expressions/implicitCastToNonNull.fir.kt.txt new file mode 100644 index 00000000000..f1ea7098be2 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/implicitCastToNonNull.fir.kt.txt @@ -0,0 +1,33 @@ +fun test1(x: String?): Int { + return when { + EQEQ(arg0 = x, arg1 = null) -> 0 + else -> x /*as String */.() + } +} + +fun test2(x: T): Int { + return when { + EQEQ(arg0 = x, arg1 = null) -> 0 + else -> x.() + } +} + +inline fun test3(x: Any): Int { + return when { + x !is T -> 0 + else -> x /*as T */.() + } +} + +inline fun test4(x: Any?): Int { + return when { + x !is T -> 0 + else -> x /*as T */.() + } +} + +fun test5(x: T, fn: Function1) { + when { + EQEQ(arg0 = x, arg1 = null).not() -> fn.invoke(p1 = x) + } +} diff --git a/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.fir.kt.txt b/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.fir.kt.txt new file mode 100644 index 00000000000..8afcaf303af --- /dev/null +++ b/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.fir.kt.txt @@ -0,0 +1,35 @@ +inline fun Any.test1(): T? { + return when { + is T -> + else -> null + } +} + +interface Foo { + +} + +val Foo.asT: T? + inline get(): T? { + return when { + is T -> /*as T */ + else -> null + } + } + +class Bar { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + fun test(arg: Any) { + arg as T /*~> Unit */ + .useT(t = arg /*as T */) + } + + fun useT(t: T) { + } + +} diff --git a/compiler/testData/ir/irText/expressions/implicitNotNullInDestructuringAssignment.fir.kt.txt b/compiler/testData/ir/irText/expressions/implicitNotNullInDestructuringAssignment.fir.kt.txt new file mode 100644 index 00000000000..e4947d8c8b7 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/implicitNotNullInDestructuringAssignment.fir.kt.txt @@ -0,0 +1,13 @@ +operator fun J?.component1(): Int { + return 1 +} + +private operator fun J.component2(): Int { + return 2 +} + +fun test() { + val : J? = j() + val a: Int = .component1() + val b: Int = .component2() +} diff --git a/compiler/testData/ir/irText/expressions/in.fir.kt.txt b/compiler/testData/ir/irText/expressions/in.fir.kt.txt new file mode 100644 index 00000000000..e582eb28918 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/in.fir.kt.txt @@ -0,0 +1,15 @@ +fun test1(a: Any, x: Collection): Boolean { + return x.contains(element = a) +} + +fun test2(a: Any, x: Collection): Boolean { + return x.contains(element = a).not() +} + +fun test3(a: T, x: Collection): Boolean { + return x.contains(element = a) +} + +fun test4(a: T, x: Collection): Boolean { + return x.contains(element = a).not() +} diff --git a/compiler/testData/ir/irText/expressions/incrementDecrement.fir.kt.txt b/compiler/testData/ir/irText/expressions/incrementDecrement.fir.kt.txt new file mode 100644 index 00000000000..ae5e74d0547 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/incrementDecrement.fir.kt.txt @@ -0,0 +1,91 @@ +var p: Int + field = 0 + get + set + +val arr: IntArray + field = intArrayOf(elements = [1, 2, 3]) + get + +fun testVarPrefix() { + var x: Int = 0 + val x1: Int = { // BLOCK + x = x.inc() + x + } + val x2: Int = { // BLOCK + x = x.dec() + x + } +} + +fun testVarPostfix() { + var x: Int = 0 + val x1: Int = { // BLOCK + val : Int = x + x = .inc() + + } + val x2: Int = { // BLOCK + val : Int = x + x = .dec() + + } +} + +fun testPropPrefix() { + val p1: Int = { // BLOCK + ( = ().inc()) + () + } + val p2: Int = { // BLOCK + ( = ().dec()) + () + } +} + +fun testPropPostfix() { + val p1: Int = { // BLOCK + val : Int = () + ( = .inc()) + + } + val p2: Int = { // BLOCK + ( = ().dec()) + () + } +} + +fun testArrayPrefix() { + val a1: Int = { // BLOCK + val : IntArray = () + val : Int = 0 + val : Int = .get(index = ).inc() + .set(index = , value = ) + + } + val a2: Int = { // BLOCK + val : IntArray = () + val : Int = 0 + val : Int = .get(index = ).dec() + .set(index = , value = ) + + } +} + +fun testArrayPostfix() { + val a1: Int = { // BLOCK + val : IntArray = () + val : Int = 0 + val : Int = .get(index = ) + .set(index = , value = .inc()) + + } + val a2: Int = { // BLOCK + val : IntArray = () + val : Int = 0 + val : Int = .get(index = ) + .set(index = , value = .dec()) + + } +} diff --git a/compiler/testData/ir/irText/expressions/javaSyntheticGenericPropertyAccess.fir.kt.txt b/compiler/testData/ir/irText/expressions/javaSyntheticGenericPropertyAccess.fir.kt.txt new file mode 100644 index 00000000000..bc01ad1333c --- /dev/null +++ b/compiler/testData/ir/irText/expressions/javaSyntheticGenericPropertyAccess.fir.kt.txt @@ -0,0 +1,9 @@ +fun test(j: J) { + j.getFoo() /*~> Unit */ + j.setFoo(x = 1) + val : J = j + val : Int = .getFoo() + .setFoo(x = .inc()) + /*~> Unit */ + j.setFoo(x = j.getFoo().plus(other = 1)) +} diff --git a/compiler/testData/ir/irText/expressions/javaSyntheticPropertyAccess.fir.kt.txt b/compiler/testData/ir/irText/expressions/javaSyntheticPropertyAccess.fir.kt.txt new file mode 100644 index 00000000000..fce2040c4c7 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/javaSyntheticPropertyAccess.fir.kt.txt @@ -0,0 +1,9 @@ +fun test(j: J) { + j.getFoo() /*~> Unit */ + j.setFoo(x = 1) + val : J = j + val : Int = .getFoo() + .setFoo(x = .inc()) + /*~> Unit */ + j.setFoo(x = j.getFoo().plus(other = 1)) +} diff --git a/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.fir.kt.txt b/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.fir.kt.txt new file mode 100644 index 00000000000..19a6f58cbab --- /dev/null +++ b/compiler/testData/ir/irText/expressions/jvmFieldWithIntersectionTypes.fir.kt.txt @@ -0,0 +1,67 @@ +interface IFoo { + +} + +class Derived1 : JFieldOwner, IFoo { + constructor() /* primary */ { + super/*JFieldOwner*/() + /* () */ + + } + +} + +class Derived2 : JFieldOwner, IFoo { + constructor() /* primary */ { + super/*JFieldOwner*/() + /* () */ + + } + +} + +open class Mid : JFieldOwner { + constructor() /* primary */ { + super/*JFieldOwner*/() + /* () */ + + } + +} + +class DerivedThroughMid1 : Mid, IFoo { + constructor() /* primary */ { + super/*Mid*/() + /* () */ + + } + +} + +class DerivedThroughMid2 : Mid, IFoo { + constructor() /* primary */ { + super/*Mid*/() + /* () */ + + } + +} + +fun test(b: Boolean) { + val d1: Derived1 = Derived1() + val d2: Derived2 = Derived2() + val k: JFieldOwner = when { + b -> d1 + else -> d2 + } + k.#f = 42 + k.#f /*~> Unit */ + val md1: DerivedThroughMid1 = DerivedThroughMid1() + val md2: DerivedThroughMid2 = DerivedThroughMid2() + val mk: Mid = when { + b -> md1 + else -> md2 + } + mk.#f = 44 + mk.#f /*~> Unit */ +} diff --git a/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.fir.kt.txt b/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.fir.kt.txt new file mode 100644 index 00000000000..242c7bc48aa --- /dev/null +++ b/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.fir.kt.txt @@ -0,0 +1,20 @@ +class Derived : Base { + constructor() /* primary */ { + super/*Base*/() + /* () */ + + } + + init { + .#value = 0 + } + + fun getValue(): Int { + return .#value + } + + fun setValue(value: Int) { + .#value = value + } + +} diff --git a/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.fir.kt.txt b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.fir.kt.txt new file mode 100644 index 00000000000..30bafebac69 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.fir.kt.txt @@ -0,0 +1,34 @@ +fun testFun() { + #out.println(p0 = "testFun") +} + +var testProp: Any + get(): Any { + #out.println(p0 = "testProp/get") + return 42 + } + set(value: Any) { + #out.println(p0 = "testProp/set") + } + +class TestClass { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + val test: Int + field = when { + else -> { // BLOCK + #out.println(p0 = "TestClass/test") + 42 + } + } + get + + init { + #out.println(p0 = "TestClass/init") + } + +} diff --git a/compiler/testData/ir/irText/expressions/kt16904.fir.kt.txt b/compiler/testData/ir/irText/expressions/kt16904.fir.kt.txt new file mode 100644 index 00000000000..8505dcfe34f --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt16904.fir.kt.txt @@ -0,0 +1,53 @@ +abstract class A { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: B + field = B() + get + + var y: Int + field = 0 + get + set + +} + +class B { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + operator fun plusAssign(x: Int) { + } + +} + +class Test1 : A { + constructor() { + super/*A*/() + /* () */ + + .().plusAssign(x = 42) + .( = .().plus(other = 42)) + } + +} + +class Test2 : J { + constructor() /* primary */ { + super/*J*/() + /* () */ + + } + + init { + .#field = 42 + } + +} diff --git a/compiler/testData/ir/irText/expressions/kt16905.fir.kt.txt b/compiler/testData/ir/irText/expressions/kt16905.fir.kt.txt new file mode 100644 index 00000000000..a183fef06e5 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt16905.fir.kt.txt @@ -0,0 +1,40 @@ +typealias OI = Inner +class Outer { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + open inner class Inner { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + } + + inner class InnerDerived0 : Inner { + constructor() /* primary */ { + .super/*Inner*/() + /* () */ + + } + + } + + inner class InnerDerived1 : Inner { + constructor() /* primary */ { + .super/*Inner*/() + /* () */ + + } + + } + +} + +fun test(): Inner { + return Outer().Inner() +} diff --git a/compiler/testData/ir/irText/expressions/kt23030.fir.kt.txt b/compiler/testData/ir/irText/expressions/kt23030.fir.kt.txt new file mode 100644 index 00000000000..72c686100ce --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt23030.fir.kt.txt @@ -0,0 +1,54 @@ +operator fun Int.compareTo(c: Char): Int { + return 0 +} + +fun testOverloadedCompareToCall(x: Int, y: Char): Boolean { + return less(arg0 = x.compareTo(c = y), arg1 = 0) +} + +fun testOverloadedCompareToCallWithSmartCast(x: Any, y: Any): Boolean { + return when { + when { + x is Int -> y is Char + else -> false + } -> less(arg0 = x /*as Int */.compareTo(c = y /*as Char */), arg1 = 0) + else -> false + } +} + +fun testEqualsWithSmartCast(x: Any, y: Any): Boolean { + return when { + when { + x is Int -> y is Char + else -> false + } -> EQEQ(arg0 = x /*as Int */, arg1 = y /*as Char */) + else -> false + } +} + +class C { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + operator fun Int.compareTo(c: Char): Int { + return 0 + } + + fun testMemberExtensionCompareToCall(x: Int, y: Char): Boolean { + return less(arg0 = (, x).compareTo(c = y), arg1 = 0) + } + + fun testMemberExtensionCompareToCallWithSmartCast(x: Any, y: Any): Boolean { + return when { + when { + x is Int -> y is Char + else -> false + } -> less(arg0 = (, x /*as Int */).compareTo(c = y /*as Char */), arg1 = 0) + else -> false + } + } + +} diff --git a/compiler/testData/ir/irText/expressions/kt24804.fir.kt.txt b/compiler/testData/ir/irText/expressions/kt24804.fir.kt.txt new file mode 100644 index 00000000000..509317c8937 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt24804.fir.kt.txt @@ -0,0 +1,24 @@ +inline fun foo(): Boolean { + return false +} + +fun run(x: Boolean, y: Boolean): String { + var z: Int = 10 + l2@ do// COMPOSITE { + z = z.plus(other = 1) + when { + greater(arg0 = z, arg1 = 100) -> return "NOT_OK" + } + when { + x -> error("") /* ERROR EXPRESSION */ + } + when { + y -> continue@l2 + } + // } while (foo()) + return "OK" +} + +fun box(): String { + return run(x = true, y = true) +} diff --git a/compiler/testData/ir/irText/expressions/kt27933.fir.kt.txt b/compiler/testData/ir/irText/expressions/kt27933.fir.kt.txt new file mode 100644 index 00000000000..d1e3e1b00d5 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt27933.fir.kt.txt @@ -0,0 +1,16 @@ +fun box(): String { + var r: String = "" + when { + EQEQ(arg0 = r, arg1 = "").not() -> { // BLOCK + } + else -> { // BLOCK + r = r.plus(other = "O") + } + } + when { + EQEQ(arg0 = r, arg1 = "O") -> { // BLOCK + r = r.plus(other = "K") + } + } + return r +} diff --git a/compiler/testData/ir/irText/expressions/kt28006.fir.kt.txt b/compiler/testData/ir/irText/expressions/kt28006.fir.kt.txt new file mode 100644 index 00000000000..930972b7920 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt28006.fir.kt.txt @@ -0,0 +1,36 @@ +val test1: String + field = "\uD83E\uDD17" + get + +val test2: String + field = "\uD83E\uDD17\uD83E\uDD17" + get + +const val testConst1: String + field = "\uD83E\uDD17" + get + +const val testConst2: String + field = "\uD83E\uDD17\uD83E\uDD17" + get + +const val testConst3: String + field = "\uD83E\uDD17\uD83E\uDD17\uD83E\uDD17" + get + +const val testConst4: String + field = "\uD83E\uDD17\uD83E\uDD17\uD83E\uDD17\uD83E\uDD17" + get + +fun test1(x: Int): String { + return "\uD83E" + "\uDD17" + x.toString() +} + +fun test2(x: Int): String { + return x.toString() + "\uD83E" + "\uDD17" +} + +fun test3(x: Int): String { + return x.toString() + "\uD83E" + "\uDD17" + x.toString() +} + diff --git a/compiler/testData/ir/irText/expressions/kt28456.fir.kt.txt b/compiler/testData/ir/irText/expressions/kt28456.fir.kt.txt new file mode 100644 index 00000000000..bea687736e0 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt28456.fir.kt.txt @@ -0,0 +1,39 @@ +class A { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +operator fun A.get(vararg xs: Int): Int { + return 0 +} + +operator fun A.set(i: Int, j: Int, v: Int) { +} + +fun testSimpleAssignment(a: A) { + a.set(i = 1, j = 2, v = 0) +} + +fun testPostfixIncrement(a: A): Int { + return { // BLOCK + val : A = a + val : Int = 1 + val : Int = 2 + val : Int = .get(xs = [, ]) + .set(i = , j = , v = .inc()) + + } +} + +fun testCompoundAssignment(a: A) { + { // BLOCK + val <>: A = a + val <>: Int = 1 + val <>: Int = 2 + <>.set(i = <>, j = <>, v = <>.get(xs = [<>, <>]).plus(other = 10)) + } +} diff --git a/compiler/testData/ir/irText/expressions/kt28456a.fir.kt.txt b/compiler/testData/ir/irText/expressions/kt28456a.fir.kt.txt new file mode 100644 index 00000000000..e336daf21c7 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt28456a.fir.kt.txt @@ -0,0 +1,15 @@ +class A { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +operator fun A.set(vararg i: Int, v: Int) { +} + +fun testSimpleAssignment(a: A) { + a.set(i = [1, 2, 3], v = 0) +} diff --git a/compiler/testData/ir/irText/expressions/kt28456b.fir.kt.txt b/compiler/testData/ir/irText/expressions/kt28456b.fir.kt.txt new file mode 100644 index 00000000000..4261eb2d798 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt28456b.fir.kt.txt @@ -0,0 +1,37 @@ +class A { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +operator fun A.get(i: Int, a: Int = 1, b: Int = 2, c: Int = 3, d: Int = 4): Int { + return 0 +} + +operator fun A.set(i: Int, j: Int = 42, v: Int) { +} + +fun testSimpleAssignment(a: A) { + a.set(i = 1, v = 0) +} + +fun testPostfixIncrement(a: A): Int { + return { // BLOCK + val : A = a + val : Int = 1 + val : Int = .get(i = ) + .set(i = , v = .inc()) + + } +} + +fun testCompoundAssignment(a: A) { + { // BLOCK + val <>: A = a + val <>: Int = 1 + <>.set(i = <>, v = <>.get(i = <>).plus(other = 10)) + } +} diff --git a/compiler/testData/ir/irText/expressions/kt30020.fir.kt.txt b/compiler/testData/ir/irText/expressions/kt30020.fir.kt.txt new file mode 100644 index 00000000000..fd3b77edb9d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt30020.fir.kt.txt @@ -0,0 +1,58 @@ +interface X { + abstract val xs: MutableList + abstract get + + abstract fun f(): MutableList + +} + +fun test(x: X, nx: X?) { + x.().plusAssign(element = 1) + x.f().plusAssign(element = 2) + x.() as MutableList.plusAssign(element = 3) + x.f() as MutableList.plusAssign(element = 4) + CHECK_NOT_NULL>(arg0 = { // BLOCK + val tmp0_safe_receiver: X? = nx + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + else -> tmp0_safe_receiver.() + } + }).plusAssign(element = 5) + CHECK_NOT_NULL>(arg0 = { // BLOCK + val tmp1_safe_receiver: X? = nx + when { + EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null + else -> tmp1_safe_receiver.f() + } + }).plusAssign(element = 6) +} + +fun MutableList.testExtensionReceiver() { + .plusAssign(element = 100) +} + +abstract class AML : MutableList { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + fun testExplicitThis() { + .plusAssign(element = 200) + } + + inner class Inner { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + fun testOuterThis() { + .plusAssign(element = 300) + } + + } + +} diff --git a/compiler/testData/ir/irText/expressions/kt30796.fir.kt.txt b/compiler/testData/ir/irText/expressions/kt30796.fir.kt.txt new file mode 100644 index 00000000000..f45cf10a60b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt30796.fir.kt.txt @@ -0,0 +1,85 @@ +fun magic(): T { + return throw Exception() +} + +fun test(value: T, value2: T) { + val x1: Any = { // BLOCK + val : T = value + when { + EQEQ(arg0 = , arg1 = null) -> 42 + else -> + } + } + val x2: Any = { // BLOCK + val : T = value + when { + EQEQ(arg0 = , arg1 = null) -> { // BLOCK + val : T = value2 + when { + EQEQ(arg0 = , arg1 = null) -> 42 + else -> + } + } + else -> + } + } + val x3: Any = { // BLOCK + val : T = { // BLOCK + val : T = value + when { + EQEQ(arg0 = , arg1 = null) -> value2 + else -> + } + } + when { + EQEQ(arg0 = , arg1 = null) -> 42 + else -> + } + } + val x4: Any = { // BLOCK + val : T = { // BLOCK + val : T = value + when { + EQEQ(arg0 = , arg1 = null) -> value2 + else -> + } + } + when { + EQEQ(arg0 = , arg1 = null) -> 42 + else -> + } + } + val x5: Any = { // BLOCK + val : Int? = magic() + when { + EQEQ(arg0 = , arg1 = null) -> 42 + else -> /*as Int */ + } + } + val x6: Any = { // BLOCK + val : T = { // BLOCK + val : T = value + when { + EQEQ(arg0 = , arg1 = null) -> magic() + else -> + } + } + when { + EQEQ(arg0 = , arg1 = null) -> 42 + else -> + } + } + val x7: Any = { // BLOCK + val : T? = { // BLOCK + val : T? = magic() + when { + EQEQ(arg0 = , arg1 = null) -> value + else -> /*as T */ + } + } + when { + EQEQ(arg0 = , arg1 = null) -> 42 + else -> /*as T */ + } + } +} diff --git a/compiler/testData/ir/irText/expressions/kt35730.fir.kt.txt b/compiler/testData/ir/irText/expressions/kt35730.fir.kt.txt new file mode 100644 index 00000000000..44446d56be0 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt35730.fir.kt.txt @@ -0,0 +1,19 @@ +interface Base { + fun foo() { + } + +} + +object Derived : Base { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +fun test() { + Derived.foo() + Derived.foo() +} diff --git a/compiler/testData/ir/irText/expressions/kt36956.fir.kt.txt b/compiler/testData/ir/irText/expressions/kt36956.fir.kt.txt new file mode 100644 index 00000000000..d5b48c07d6c --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt36956.fir.kt.txt @@ -0,0 +1,33 @@ +class A { + constructor(value: T) /* primary */ { + super/*Any*/() + /* () */ + + } + + private val value: T + field = value + private get + + operator fun get(i: Int): T { + return .() + } + + operator fun set(i: Int, v: T) { + } + +} + +val aFloat: A + field = A(value = 0.0F) + get + +val aInt: Float + field = { // BLOCK + val : A = () + val : Int = 1 + val : Float = .get(i = ) + .set(i = , v = .dec()) + + } + get diff --git a/compiler/testData/ir/irText/expressions/kt36963.fir.kt.txt b/compiler/testData/ir/irText/expressions/kt36963.fir.kt.txt new file mode 100644 index 00000000000..1121fbdab3a --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt36963.fir.kt.txt @@ -0,0 +1,6 @@ +fun foo() { +} + +fun test(): KFunction0 { + return CHECK_NOT_NULL>(arg0 = ::foo) +} diff --git a/compiler/testData/ir/irText/expressions/kt37570.fir.kt.txt b/compiler/testData/ir/irText/expressions/kt37570.fir.kt.txt new file mode 100644 index 00000000000..76ba6c9c5c6 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt37570.fir.kt.txt @@ -0,0 +1,22 @@ +fun a(): String { + return "string" +} + +class A { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + val b: String + get + + init { + a().apply(block = local fun String.() { + .#b = + } +) /*~> Unit */ + } + +} diff --git a/compiler/testData/ir/irText/expressions/lambdaInCAO.fir.kt.txt b/compiler/testData/ir/irText/expressions/lambdaInCAO.fir.kt.txt new file mode 100644 index 00000000000..f6c877506fb --- /dev/null +++ b/compiler/testData/ir/irText/expressions/lambdaInCAO.fir.kt.txt @@ -0,0 +1,31 @@ +operator fun Any.plusAssign(lambda: Function0) { +} + +operator fun Any.get(index: Function0): Int { + return 42 +} + +operator fun Any.set(index: Function0, value: Int) { +} + +fun test1(a: Any) { + a.plusAssign(lambda = local fun () { + return Unit + } +) +} + +fun test2(a: Any) { + error("") /* ERROR CALL */ +} + +fun test3(a: Any) { + val : Any = a + val : Function0 = local fun () { + return Unit + } + + val : Int = .get(index = ) + .set(index = , value = .inc()) + /*~> Unit */ +} diff --git a/compiler/testData/ir/irText/expressions/literals.fir.kt.txt b/compiler/testData/ir/irText/expressions/literals.fir.kt.txt new file mode 100644 index 00000000000..253306edf33 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/literals.fir.kt.txt @@ -0,0 +1,67 @@ +val test1: Int + field = 1 + get + +val test2: Int + field = -1 + get + +val test3: Boolean + field = true + get + +val test4: Boolean + field = false + get + +val test5: String + field = "abc" + get + +val test6: Nothing? + field = null + get + +val test7: Long + field = 1L + get + +val test8: Long + field = 1L.unaryMinus() + get + +val test9: Double + field = 1.0D + get + +val test10: Double + field = 1.0D.unaryMinus() + get + +val test11: Float + field = 1.0F + get + +val test12: Float + field = 1.0F.unaryMinus() + get + +val test13: Char + field = 'a' + get + +val testB: Byte + field = 1B + get + +val testS: Short + field = 1S + get + +val testI: Int + field = 1 + get + +val testL: Long + field = 1L + get diff --git a/compiler/testData/ir/irText/expressions/multipleThisReferences.fir.kt.txt b/compiler/testData/ir/irText/expressions/multipleThisReferences.fir.kt.txt new file mode 100644 index 00000000000..64218022524 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/multipleThisReferences.fir.kt.txt @@ -0,0 +1,53 @@ +class Outer { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + open inner class Inner { + constructor(x: Int) /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: Int + field = x + get + + } + +} + +class Host { + constructor(y: Int) /* primary */ { + super/*Any*/() + /* () */ + + } + + val y: Int + field = y + get + + fun Outer.test(): Inner { + return { // BLOCK + local class : Inner { + private constructor() /* primary */ { + .super/*Inner*/(x = 42) + /* () */ + + } + + val xx: Int + field = .().plus(other = .()) + get + + } + + () + } + } + +} diff --git a/compiler/testData/ir/irText/expressions/nullCheckOnGenericLambdaReturn.fir.kt.txt b/compiler/testData/ir/irText/expressions/nullCheckOnGenericLambdaReturn.fir.kt.txt new file mode 100644 index 00000000000..2aeea6b4888 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/nullCheckOnGenericLambdaReturn.fir.kt.txt @@ -0,0 +1,47 @@ +fun checkAny(fn: Function0): Any { + return fn.invoke() +} + +fun checkAnyN(fn: Function0): Any? { + return fn.invoke() +} + +fun checkT(fn: Function0): T { + return fn.invoke() +} + +fun checkTAny(fn: Function0): T { + return fn.invoke() +} + +fun id(x: T): T { + return x +} + +fun test1(): String? { + return checkT(fn = local fun (): String? { + return foo() + } +) +} + +fun test2(): String { + return checkT<@EnhancedNullability String>(fn = local fun (): @EnhancedNullability String { + return nnFoo() + } +) /*!! String */ +} + +fun test3(): String? { + return checkTAny(fn = local fun (): String? { + return foo() + } +) +} + +fun test4(): String { + return checkTAny<@EnhancedNullability String>(fn = local fun (): @EnhancedNullability String { + return nnFoo() + } +) /*!! String */ +} diff --git a/compiler/testData/ir/irText/expressions/nullCheckOnLambdaReturn.fir.kt.txt b/compiler/testData/ir/irText/expressions/nullCheckOnLambdaReturn.fir.kt.txt new file mode 100644 index 00000000000..a4286acb737 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/nullCheckOnLambdaReturn.fir.kt.txt @@ -0,0 +1,53 @@ +fun checkAny(fn: Function0): Any { + return fn.invoke() +} + +fun checkAnyN(fn: Function0): Any? { + return fn.invoke() +} + +fun id(x: T): T { + return x +} + +fun test1(): Any { + return checkAny(fn = local fun (): Any { + return foo() /*!! String */ + } +) +} + +val test2: Function0 + field = local fun (): String? { + return foo() + } + + get + +val test3: Function0 + field = local fun (): String? { + return foo() + } + as Function0 + get + +val test4: Function0 + field = id>(x = local fun (): String? { + return foo() + } +) + get + +fun test5(): Any? { + return checkAnyN(fn = local fun (): Any? { + return foo() + } +) +} + +fun test6(): Any? { + return checkAnyN(fn = local fun (): Any? { + return nnFoo() + } +) +} diff --git a/compiler/testData/ir/irText/expressions/objectAsCallable.fir.kt.txt b/compiler/testData/ir/irText/expressions/objectAsCallable.fir.kt.txt new file mode 100644 index 00000000000..11639efa551 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/objectAsCallable.fir.kt.txt @@ -0,0 +1,39 @@ +object A { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +enum class En : Enum { + private constructor() /* primary */ { + super/*Enum*/() + /* () */ + + } + + X = En() + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): En /* Synthetic body for ENUM_VALUEOF */ + +} + +operator fun A.invoke(i: Int): Int { + return i +} + +operator fun En.invoke(i: Int): Int { + return i +} + +val test1: Int + field = A.invoke(i = 42) + get + +val test2: Int + field = En.X.invoke(i = 42) + get diff --git a/compiler/testData/ir/irText/expressions/objectByNameInsideObject.fir.kt.txt b/compiler/testData/ir/irText/expressions/objectByNameInsideObject.fir.kt.txt new file mode 100644 index 00000000000..48a45ae537a --- /dev/null +++ b/compiler/testData/ir/irText/expressions/objectByNameInsideObject.fir.kt.txt @@ -0,0 +1,32 @@ +open class Base { + constructor(f1: Function0) /* primary */ { + super/*Any*/() + /* () */ + + } + + val f1: Function0 + field = f1 + get + +} + +object Thing : Base { + private constructor() /* primary */ { + super/*Base*/(f1 = local fun (): Any { + return Thing + } +) + /* () */ + + } + + fun test1(): Thing { + return Thing + } + + fun test2(): Thing { + return + } + +} diff --git a/compiler/testData/ir/irText/expressions/objectReference.fir.kt.txt b/compiler/testData/ir/irText/expressions/objectReference.fir.kt.txt new file mode 100644 index 00000000000..a079149616d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/objectReference.fir.kt.txt @@ -0,0 +1,92 @@ +object Z { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + var counter: Int + field = 0 + get + set + + fun foo() { + } + + fun bar() { + .( = 1) + .foo() + Z.( = 1) + Z.foo() + } + + class Nested { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + init { + Z.( = 1) + Z.foo() + Z.( = 1) + Z.foo() + } + + fun test() { + Z.( = 1) + Z.foo() + Z.( = 1) + Z.foo() + } + + } + + val aLambda: Function0 + field = local fun () { + .( = 1) + .foo() + Z.( = 1) + Z.foo() + } + + get + + val anObject: + field = { // BLOCK + local class { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + init { + Z.( = 1) + Z.foo() + Z.( = 1) + Z.foo() + } + + fun test() { + Z.( = 1) + Z.foo() + Z.( = 1) + Z.foo() + } + + } + + () + } + get + +} + +fun Z.test() { + .( = 1) + .foo() + Z.( = 1) + Z.foo() +} diff --git a/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.fir.kt.txt b/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.fir.kt.txt new file mode 100644 index 00000000000..b2e99c61e65 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.fir.kt.txt @@ -0,0 +1,24 @@ +abstract class Base { + constructor(lambda: Function0) /* primary */ { + super/*Any*/() + /* () */ + + } + + val lambda: Function0 + field = lambda + get + +} + +object Test : Base { + private constructor() /* primary */ { + super/*Base*/(lambda = local fun (): Any { + return Test + } +) + /* () */ + + } + +} diff --git a/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.fir.kt.txt b/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.fir.kt.txt new file mode 100644 index 00000000000..c6c1947e457 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.fir.kt.txt @@ -0,0 +1,20 @@ +object A { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + private val a: String + field = "$" + private get + + private val b: String + field = "1234" + .().toString() + private get + + private val c: Int + field = 10000 + private get + +} diff --git a/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.fir.kt.txt b/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.fir.kt.txt new file mode 100644 index 00000000000..0462a5c1fc5 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.fir.kt.txt @@ -0,0 +1,49 @@ +val test1: Long + field = 42L + get + +val test2: Short + field = 42S + get + +val test3: Byte + field = 42B + get + +val test4: Long + field = 42.unaryMinus() + get + +val test5: Short + field = 42.unaryMinus() + get + +val test6: Byte + field = 42.unaryMinus() + get + +fun test() { + val test1: Int? = 42 + val test2: Long = 42L + val test3: Long? = 42L + val test4: Long? = -1L + val test5: Long? = -1 + val test6: Short? = -1 + val test7: Byte? = -1 +} + +fun testImplicitArguments(x: Long = -1) { +} + +class TestImplicitArguments { + constructor(x: Long = -1) /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: Long + field = x + get + +} diff --git a/compiler/testData/ir/irText/expressions/propertyReferences.fir.kt.txt b/compiler/testData/ir/irText/expressions/propertyReferences.fir.kt.txt new file mode 100644 index 00000000000..7e089c78274 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/propertyReferences.fir.kt.txt @@ -0,0 +1,131 @@ +object Delegate { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + operator fun getValue(thisRef: Any?, kProp: Any): Int { + return 1 + } + + operator fun setValue(thisRef: Any?, kProp: Any, value: Int) { + } + +} + +open class C { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + var varWithPrivateSet: Int + field = 1 + get + private set + + var varWithProtectedSet: Int + field = 1 + get + protected set + +} + +val valWithBackingField: Int + field = 1 + get + +val test_valWithBackingField: KProperty0 + field = ::valWithBackingField + get + +var varWithBackingField: Int + field = 1 + get + set + +val test_varWithBackingField: KMutableProperty0 + field = ::varWithBackingField + get + +var varWithBackingFieldAndAccessors: Int + field = 1 + get(): Int { + return #varWithBackingFieldAndAccessors + } + set(value: Int) { + #varWithBackingFieldAndAccessors = value + } + +val test_varWithBackingFieldAndAccessors: KMutableProperty0 + field = ::varWithBackingFieldAndAccessors + get + +val valWithAccessors: Int + get(): Int { + return 1 + } + +val test_valWithAccessors: KProperty0 + field = ::valWithAccessors + get + +var varWithAccessors: Int + get(): Int { + return 1 + } + set(value: Int) { + } + +val test_varWithAccessors: KMutableProperty0 + field = ::varWithAccessors + get + +val delegatedVal: Int /* by */ + field = Delegate + get(): Int { + return #delegatedVal$delegate.getValue(thisRef = null, kProp = ::delegatedVal) + } + +val test_delegatedVal: KProperty0 + field = ::delegatedVal + get + +var delegatedVar: Int /* by */ + field = Delegate + get(): Int { + return #delegatedVar$delegate.getValue(thisRef = null, kProp = ::delegatedVar) + } + set(: Int) { + #delegatedVar$delegate.setValue(thisRef = null, kProp = ::delegatedVar, value = ) + } + +val test_delegatedVar: KMutableProperty0 + field = ::delegatedVar + get + +val constVal: Int + field = 1 + get + +val test_constVal: KProperty0 + field = ::constVal + get + +val test_J_CONST: KProperty0 + field = J::CONST/*()*/ + get + +val test_J_nonConst: KMutableProperty0 + field = J::nonConst/*()*/ + get + +val test_varWithPrivateSet: KProperty1 + field = C::varWithPrivateSet + get + +val test_varWithProtectedSet: KProperty1 + field = C::varWithProtectedSet + get diff --git a/compiler/testData/ir/irText/expressions/reflectionLiterals.fir.kt.txt b/compiler/testData/ir/irText/expressions/reflectionLiterals.fir.kt.txt new file mode 100644 index 00000000000..13152677fbc --- /dev/null +++ b/compiler/testData/ir/irText/expressions/reflectionLiterals.fir.kt.txt @@ -0,0 +1,42 @@ +class A { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + fun foo() { + } + +} + +fun bar() { +} + +val qux: Int + field = 1 + get + +val test1: KClass + field = A::class + get + +val test2: KClass + field = ()::class + get + +val test3: KFunction1 + field = A::foo + get + +val test4: KFunction0 + field = A:: + get + +val test5: KFunction0 + field = A()::foo + get + +val test6: KFunction0 + field = ::bar + get diff --git a/compiler/testData/ir/irText/expressions/safeAssignment.fir.kt.txt b/compiler/testData/ir/irText/expressions/safeAssignment.fir.kt.txt new file mode 100644 index 00000000000..a44b20dfee8 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/safeAssignment.fir.kt.txt @@ -0,0 +1,23 @@ +class C { + constructor(x: Int) /* primary */ { + super/*Any*/() + /* () */ + + } + + var x: Int + field = x + get + set + +} + +fun test(nc: C?) { + { // BLOCK + val tmp0_safe_receiver: C? = nc + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + else -> tmp0_safe_receiver.( = 42) + } + } /*~> Unit */ +} diff --git a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.fir.kt.txt b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.fir.kt.txt new file mode 100644 index 00000000000..ea0d8518045 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.fir.kt.txt @@ -0,0 +1,66 @@ +package test + +class C { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +var C?.p: Int + get(): Int { + return 42 + } + set(value: Int) { + } + +operator fun Int?.inc(): Int? { + return { // BLOCK + val tmp0_safe_receiver: Int? = + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + else -> tmp0_safe_receiver.inc() + } + } +} + +operator fun Int?.get(index: Int): Int { + return 42 +} + +operator fun Int?.set(index: Int, value: Int) { +} + +fun testProperty(nc: C?) { + val : Int? = { // BLOCK + val tmp1_safe_receiver: C? = nc + when { + EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null + else -> tmp1_safe_receiver.() + } + } + { // BLOCK + val tmp2_safe_receiver: C? = nc + when { + EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null + else -> tmp2_safe_receiver.(value = .inc()) + } + } /*~> Unit */ + /*~> Unit */ +} + +fun testArrayAccess(nc: C?) { + val : Int? = { // BLOCK + val tmp3_safe_receiver: C? = nc + when { + EQEQ(arg0 = tmp3_safe_receiver, arg1 = null) -> null + else -> tmp3_safe_receiver.() + } + } + val : Int = 0 + val : Int = .get(index = ) + .set(index = , value = .inc()) + /*~> Unit */ +} diff --git a/compiler/testData/ir/irText/expressions/safeCalls.fir.kt.txt b/compiler/testData/ir/irText/expressions/safeCalls.fir.kt.txt new file mode 100644 index 00000000000..9805859fa15 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/safeCalls.fir.kt.txt @@ -0,0 +1,84 @@ +class Ref { + constructor(value: Int) /* primary */ { + super/*Any*/() + /* () */ + + } + + var value: Int + field = value + get + set + +} + +interface IHost { + fun String.extLength(): Int { + return .() + } + +} + +fun test1(x: String?): Int? { + return { // BLOCK + val tmp0_safe_receiver: String? = x + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + else -> tmp0_safe_receiver.() + } + } +} + +fun test2(x: String?): Int? { + return { // BLOCK + val tmp1_safe_receiver: String? = x + when { + EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null + else -> tmp1_safe_receiver.hashCode() + } + } +} + +fun test3(x: String?, y: Any?): Boolean? { + return { // BLOCK + val tmp2_safe_receiver: String? = x + when { + EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null + else -> tmp2_safe_receiver.equals(other = y) + } + } +} + +fun test4(x: Ref?) { + { // BLOCK + val tmp3_safe_receiver: Ref? = x + when { + EQEQ(arg0 = tmp3_safe_receiver, arg1 = null) -> null + else -> tmp3_safe_receiver.( = 0) + } + } /*~> Unit */ +} + +fun IHost.test5(s: String?): Int? { + return { // BLOCK + val tmp4_safe_receiver: String? = s + when { + EQEQ(arg0 = tmp4_safe_receiver, arg1 = null) -> null + else -> (, tmp4_safe_receiver).extLength() + } + } +} + +fun Int.foo(): Int { + return 239 +} + +fun box() { + { // BLOCK + val tmp5_safe_receiver: Int = 42 + when { + EQEQ(arg0 = tmp5_safe_receiver, arg1 = null) -> null + else -> tmp5_safe_receiver.foo() + } + } /*~> Unit */ +} diff --git a/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.fir.kt.txt b/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.fir.kt.txt new file mode 100644 index 00000000000..77f1971f85c --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.fir.kt.txt @@ -0,0 +1,68 @@ +fun test(fn: Function0, r: Runnable, arr: Array) { + error("") /* ERROR CALL */local fun () { + return Unit + } +; arr; + foo1(r = local fun () { + return Unit + } + /*-> Runnable? */, strs = [*arr]) /*~> Unit */ + error("") /* ERROR CALL */fn; arr; + foo1(r = fn /*-> Runnable? */, strs = [*arr]) /*~> Unit */ + foo1(r = r, strs = [""]) /*~> Unit */ + error("") /* ERROR CALL */fn; arr; + foo1(r = fn /*-> Runnable? */, strs = [*arr]) /*~> Unit */ + foo1(r = r, strs = [*arr]) /*~> Unit */ + val i1: ErrorType /* ERROR */ = error("") /* ERROR CALL */local fun () { + return Unit + } +; arr; + val i2: Test = Test(r = local fun () { + return Unit + } + /*-> Runnable? */, strs = [*arr]) + val i3: ErrorType /* ERROR */ = error("") /* ERROR CALL */local fun () { + return Unit + } +; local fun () { + return Unit + } +; arr; + val i4: Test = Test(r1 = r, r2 = local fun () { + return Unit + } + /*-> Runnable? */, strs = [""]) + val i5: Test = Test(r1 = local fun () { + return Unit + } + /*-> Runnable? */, r2 = local fun () { + return Unit + } + /*-> Runnable? */, strs = [*arr]) + val i6: Test = Test(r1 = r, r2 = local fun () { + return Unit + } + /*-> Runnable? */, strs = [*arr]) + error("") /* ERROR CALL */local fun () { + return Unit + } +; local fun () { + return Unit + } +; arr; + error("") /* ERROR CALL */r; local fun () { + return Unit + } +; ""; + error("") /* ERROR CALL */local fun () { + return Unit + } +; local fun () { + return Unit + } +; arr; + error("") /* ERROR CALL */r; local fun () { + return Unit + } +; arr; +} diff --git a/compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.fir.kt.txt b/compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.fir.kt.txt new file mode 100644 index 00000000000..dbc03ed47f0 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.fir.kt.txt @@ -0,0 +1,14 @@ +fun test(a: SomeJavaClass) { + a.someFunction(hello = local fun (it: String?) { + return Unit + } + /*-> Hello? */) + a.plus(hello = local fun (it: String?) { + return Unit + } + /*-> Hello? */) + a.get(hello = local fun (it: String?) { + return Unit + } + /*-> Hello? */) +} diff --git a/compiler/testData/ir/irText/expressions/sam/genericSamSmartcast.fir.kt.txt b/compiler/testData/ir/irText/expressions/sam/genericSamSmartcast.fir.kt.txt new file mode 100644 index 00000000000..869b1c4a1ec --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/genericSamSmartcast.fir.kt.txt @@ -0,0 +1,9 @@ +fun f(x: Any): String { + when { + x is A<*> -> return x /*as A<*> */.call(block = local fun (y: Any?): String? { + return "OK" + } + /*-> I? */) /*!! String */ + } + return "Fail" +} diff --git a/compiler/testData/ir/irText/expressions/sam/samByProjectedType.fir.kt.txt b/compiler/testData/ir/irText/expressions/sam/samByProjectedType.fir.kt.txt new file mode 100644 index 00000000000..1aeceb64953 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/samByProjectedType.fir.kt.txt @@ -0,0 +1,6 @@ +fun test1() { + bar(j = local fun (x: Any): Any? { + return x + } + /*-> J<*>? */) +} diff --git a/compiler/testData/ir/irText/expressions/sam/samConstructors.fir.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConstructors.fir.kt.txt new file mode 100644 index 00000000000..0248a8a9153 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/samConstructors.fir.kt.txt @@ -0,0 +1,24 @@ +fun test1(): Runnable { + return local fun () { + return Unit + } + /*-> Runnable */ +} + +fun test2(a: Function0): Runnable { + return a /*-> Runnable */ +} + +fun foo() { +} + +fun test3(): Runnable { + return ::foo /*-> Runnable */ +} + +fun test4(): Comparator { + return local fun (a: Int?, b: Int?): Int { + return a.minus(other = b /*!! Int */) + } + /*-> Comparator */ +} diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall.fir.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall.fir.kt.txt new file mode 100644 index 00000000000..53195465e1f --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall.fir.kt.txt @@ -0,0 +1,8 @@ +fun test1(f: Function1): C { + return C(jxx = f /*-> J? */) +} + +fun test2(x: Any) { + x as Function1 /*~> Unit */ + C(jxx = x /*as Function1 */ /*-> J? */) /*~> Unit */ +} diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.fir.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.fir.kt.txt new file mode 100644 index 00000000000..fcde5506071 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.fir.kt.txt @@ -0,0 +1,42 @@ +fun test3(f1: Function1, f2: Function1): D { + return C(jxx = f1 /*-> J? */).D(jxy = f2 /*-> J? */) +} + +class Outer { + constructor(j11: J) /* primary */ { + super/*Any*/() + /* () */ + + } + + val j11: J + field = j11 + get + + inner class Inner { + constructor(j12: J) /* primary */ { + super/*Any*/() + /* () */ + + } + + val j12: J + field = j12 + get + + } + +} + +fun test4(f: Function1, g: Function1): Inner { + return Outer(j11 = f /*-> J */).Inner(j12 = g /*-> J */) +} + +fun testGenericJavaCtor1(f: Function1): G { + return G(x = f /*-> J? */) +} + +fun testGenericJavaCtor2(x: Any) { + x as Function1 /*~> Unit */ + G(x = x /*as Function1 */ /*-> J? */) /*~> Unit */ +} diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.fir.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.fir.kt.txt new file mode 100644 index 00000000000..d0245f2b431 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.fir.kt.txt @@ -0,0 +1,51 @@ +fun test1(): J { + return local fun (x: String?): String? { + return x + } + /*-> J */ +} + +fun test2(): J { + return local fun (x: String): String { + return x + } + /*-> J */ +} + +fun test3() { + return bar(j = local fun (x: String): String { + return x + } + /*-> J? */) +} + +fun test4(a: Any) { + a as J /*~> Unit */ + bar(j = a /*as J */) +} + +fun test5(a: Any) { + a as Function1 /*~> Unit */ + bar(j = a /*as Function1 */ /*-> J? */) +} + +fun test6(a: Function1) { + bar(j = a /*-> J? */) +} + +fun test7(a: Any) { + a as Function1 /*~> Unit */ + bar(j = a /*as Function1 */ /*-> J? */) +} + +fun test8(efn: @ExtensionFunctionType @ExtensionFunctionType Function1): J { + return efn /*-> J */ +} + +fun test9(efn: @ExtensionFunctionType @ExtensionFunctionType Function1) { + bar(j = efn /*-> J? */) +} + +fun test10(fn: Function1) { + bar2x(j2x = fn /*-> J2X? */) +} diff --git a/compiler/testData/ir/irText/expressions/sam/samConversions.fir.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversions.fir.kt.txt new file mode 100644 index 00000000000..0c781d0237f --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/samConversions.fir.kt.txt @@ -0,0 +1,29 @@ +fun J.test0(a: Runnable) { + runStatic(r = a) + .runIt(r = a) +} + +fun test1() { + runStatic(r = local fun () { + test1() + } + /*-> Runnable? */) +} + +fun J.test2() { + .runIt(r = local fun () { + test1() + } + /*-> Runnable? */) +} + +fun J.test3(a: Function0) { + .run2(r1 = a /*-> Runnable? */, r2 = a /*-> Runnable? */) +} + +fun J.test4(a: Function0, b: Function0, flag: Boolean) { + .runIt(r = when { + flag -> a + else -> b + } /*-> Runnable? */) +} diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.fir.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.fir.kt.txt new file mode 100644 index 00000000000..cf210020075 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.fir.kt.txt @@ -0,0 +1,56 @@ +fun test1(a: Function0) { + when { + a is Runnable -> runStatic(r = a /*as Runnable */) + } +} + +fun test2(a: Function0) { + when { + a is Runnable -> J().run1(r = a /*as Runnable */) + } +} + +fun test3(a: Function0) { + when { + a is Runnable -> J().run2(r1 = a /*as Runnable */, r2 = a /*as Runnable */) + } +} + +fun test4(a: Function0, b: Function0) { + when { + a is Runnable -> J().run2(r1 = a /*as Runnable */, r2 = b /*-> Runnable? */) + } +} + +fun test5(a: Any) { + when { + a is Runnable -> J().run1(r = a /*as Runnable */) + } +} + +fun test5x(a: Any) { + when { + a is Runnable -> { // BLOCK + a /*as Runnable */ as Function0 /*~> Unit */ + J().run1(r = a /*as Runnable */) + } + } +} + +fun test6(a: Any) { + a as Function0 /*~> Unit */ + J().run1(r = a /*as Function0 */ /*-> Runnable? */) +} + +fun test7(a: Function1) { + a as Function0 /*~> Unit */ + error("") /* ERROR CALL */a /*as Function0 */; +} + +fun test8(a: Function0) { + error("") /* ERROR CALL */id?>(x = a); +} + +fun test9() { + J().run1(r = ::test9 /*-> Runnable? */) +} diff --git a/compiler/testData/ir/irText/expressions/sam/samOperators.fir.kt.txt b/compiler/testData/ir/irText/expressions/sam/samOperators.fir.kt.txt new file mode 100644 index 00000000000..3ec22f65775 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/samOperators.fir.kt.txt @@ -0,0 +1,17 @@ +fun f() { +} + +fun J.test1() { + .get(k = ::f /*-> Runnable? */) + .get(k = ::f /*-> Runnable? */, m = ::f /*-> Runnable? */) +} + +fun J.test2() { + .set(k = ::f /*-> Runnable? */, v = ::f /*-> Runnable? */) + .set(k = ::f /*-> Runnable? */, m = ::f /*-> Runnable? */, v = ::f /*-> Runnable? */) +} + +fun J.test3() { + .plusAssign(i = ::f /*-> Runnable? */) + .minusAssign(i = ::f /*-> Runnable? */) +} diff --git a/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.fir.kt.txt b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.fir.kt.txt new file mode 100644 index 00000000000..6d79a354a8d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.fir.kt.txt @@ -0,0 +1,16 @@ +class Derived : Base { + constructor() /* primary */ { + super/*Base*/() + /* () */ + + } + + fun setValue(v: Any) { + when { + v is String -> { // BLOCK + .#value = v /*as String */ + } + } + } + +} diff --git a/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_annotation.fir.kt.txt b/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_annotation.fir.kt.txt new file mode 100644 index 00000000000..9acc6bebb01 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_annotation.fir.kt.txt @@ -0,0 +1,6 @@ +package kotlin.internal + +annotation class ImplicitIntegerCoercion : Annotation { + constructor() /* primary */ + +} diff --git a/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.fir.kt.txt b/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.fir.kt.txt new file mode 100644 index 00000000000..04c0939354d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.fir.kt.txt @@ -0,0 +1,57 @@ +@ImplicitIntegerCoercion +const val IMPLICIT_INT: Int + field = 255 + get + +@ImplicitIntegerCoercion +const val EXPLICIT_INT: Int + field = 255 + get + +@ImplicitIntegerCoercion +const val LONG_CONST: Long + field = 255L + get + +@ImplicitIntegerCoercion +val NON_CONST: Int + field = 255 + get + +@ImplicitIntegerCoercion +const val BIGGER_THAN_UBYTE: Int + field = 256 + get + +@ImplicitIntegerCoercion +const val UINT_CONST: UInt + field = 42 + get + +fun takeUByte(@ImplicitIntegerCoercion u: UByte) { +} + +fun takeUShort(@ImplicitIntegerCoercion u: UShort) { +} + +fun takeUInt(@ImplicitIntegerCoercion u: UInt) { +} + +fun takeULong(@ImplicitIntegerCoercion u: ULong) { +} + +fun takeUBytes(@ImplicitIntegerCoercion vararg u: UByte) { +} + +fun takeLong(@ImplicitIntegerCoercion l: Long) { +} + +fun test() { + error("") /* ERROR CALL */255; + error("") /* ERROR CALL */255; + error("") /* ERROR CALL */255; + error("") /* ERROR CALL */256; + error("") /* ERROR CALL */255; + error("") /* ERROR CALL */255; + error("") /* ERROR CALL */255; 255; 42; +} diff --git a/compiler/testData/ir/irText/expressions/simpleUnaryOperators.fir.kt.txt b/compiler/testData/ir/irText/expressions/simpleUnaryOperators.fir.kt.txt new file mode 100644 index 00000000000..dd9a2cdcd72 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/simpleUnaryOperators.fir.kt.txt @@ -0,0 +1,23 @@ +fun test1(x: Int): Int { + return x.unaryMinus() +} + +fun test2(): Int { + return -42 +} + +fun test3(x: Int): Int { + return x.unaryPlus() +} + +fun test4(): Int { + return 42 +} + +fun test5(x: Boolean): Boolean { + return x.not() +} + +fun test6(): Boolean { + return false +} diff --git a/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.fir.kt.txt b/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.fir.kt.txt new file mode 100644 index 00000000000..077e7fa05d0 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.fir.kt.txt @@ -0,0 +1,24 @@ +interface I1 { + +} + +interface I2 { + +} + +operator fun I1.component1(): Int { + return 1 +} + +operator fun I2.component2(): String { + return "" +} + +fun test(x: I1) { + when { + x !is I2 -> return Unit + } + val : I2 = x /*as I2 */ + val c1: Int = .component1() + val c2: String = .component2() +} diff --git a/compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.fir.kt.txt b/compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.fir.kt.txt new file mode 100644 index 00000000000..1fea8c4a1aa --- /dev/null +++ b/compiler/testData/ir/irText/expressions/specializedTypeAliasConstructorCall.fir.kt.txt @@ -0,0 +1,17 @@ +typealias IntAlias = Cell +class Cell { + constructor(value: T) /* primary */ { + super/*Any*/() + /* () */ + + } + + val value: T + field = value + get + +} + +fun test(): Cell { + return Cell(value = 42) +} diff --git a/compiler/testData/ir/irText/expressions/stringComparisons.fir.kt.txt b/compiler/testData/ir/irText/expressions/stringComparisons.fir.kt.txt new file mode 100644 index 00000000000..b0e6c856350 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/stringComparisons.fir.kt.txt @@ -0,0 +1,15 @@ +fun test1(a: String, b: String): Boolean { + return greater(arg0 = a.compareTo(other = b), arg1 = 0) +} + +fun test2(a: String, b: String): Boolean { + return less(arg0 = a.compareTo(other = b), arg1 = 0) +} + +fun test3(a: String, b: String): Boolean { + return greaterOrEqual(arg0 = a.compareTo(other = b), arg1 = 0) +} + +fun test4(a: String, b: String): Boolean { + return lessOrEqual(arg0 = a.compareTo(other = b), arg1 = 0) +} diff --git a/compiler/testData/ir/irText/expressions/stringTemplates.fir.kt.txt b/compiler/testData/ir/irText/expressions/stringTemplates.fir.kt.txt new file mode 100644 index 00000000000..25daa4ce302 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/stringTemplates.fir.kt.txt @@ -0,0 +1,43 @@ +fun foo(): String { + return "" +} + +val x: Int + field = 42 + get + +val test1: String + field = "" + get + +val test2: String + field = "abc" + get + +val test3: String + field = "" + get + +val test4: String + field = "abc" + get + +val test5: String + field = "\nabc\n" + get + +val test6: String + field = ().toString() + " " + foo().toString() + get + +val test7: String + field = ().toString() + get + +val test8: String + field = foo().toString() + get + +val test9: String + field = ().toString() + get diff --git a/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.fir.kt.txt b/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.fir.kt.txt new file mode 100644 index 00000000000..58f8cee23af --- /dev/null +++ b/compiler/testData/ir/irText/expressions/suspendConversionOnArbitraryExpression.fir.kt.txt @@ -0,0 +1,189 @@ +fun useSuspend(sfn: SuspendFunction0) { +} + +fun useSuspendExt(sfn: @ExtensionFunctionType @ExtensionFunctionType SuspendFunction1) { +} + +fun useSuspendArg(sfn: SuspendFunction1) { +} + +fun useSuspendArgT(sfn: SuspendFunction1) { +} + +fun useSuspendExtT(sfn: @ExtensionFunctionType @ExtensionFunctionType SuspendFunction1) { +} + +fun produceFun(): Function0 { + return local fun () { + return Unit + } + +} + +fun testSimple(fn: Function0) { + useSuspend(sfn = { // BLOCK + local suspend fun Function0.suspendConversion() { + callee.invoke() + } + + fn::suspendConversion + }) +} + +fun testSimpleNonVal() { + useSuspend(sfn = { // BLOCK + local suspend fun Function0.suspendConversion() { + callee.invoke() + } + + produceFun()::suspendConversion + }) +} + +fun testExtAsExt(fn: @ExtensionFunctionType @ExtensionFunctionType Function1) { + useSuspendExt(sfn = { // BLOCK + local suspend fun @ExtensionFunctionType @ExtensionFunctionType Function1.suspendConversion(p0: Int) { + callee.invoke(p1 = p0) + } + + fn::suspendConversion + }) +} + +fun testExtAsSimple(fn: @ExtensionFunctionType @ExtensionFunctionType Function1) { + useSuspendArg(sfn = { // BLOCK + local suspend fun @ExtensionFunctionType @ExtensionFunctionType Function1.suspendConversion(p0: Int) { + callee.invoke(p1 = p0) + } + + fn::suspendConversion + }) +} + +fun testSimpleAsExt(fn: Function1) { + useSuspendExt(sfn = { // BLOCK + local suspend fun Function1.suspendConversion(p0: Int) { + callee.invoke(p1 = p0) + } + + fn::suspendConversion + }) +} + +fun testSimpleAsSimpleT(fn: Function1) { + useSuspendArgT(sfn = { // BLOCK + local suspend fun Function1.suspendConversion(p0: T) { + callee.invoke(p1 = p0) + } + + fn::suspendConversion + }) +} + +fun testSimpleAsExtT(fn: Function1) { + useSuspendExtT(sfn = { // BLOCK + local suspend fun Function1.suspendConversion(p0: T) { + callee.invoke(p1 = p0) + } + + fn::suspendConversion + }) +} + +fun testExtAsSimpleT(fn: @ExtensionFunctionType @ExtensionFunctionType Function1) { + useSuspendArgT(sfn = { // BLOCK + local suspend fun @ExtensionFunctionType @ExtensionFunctionType Function1.suspendConversion(p0: T) { + callee.invoke(p1 = p0) + } + + fn::suspendConversion + }) +} + +fun testExtAsExtT(fn: @ExtensionFunctionType @ExtensionFunctionType Function1) { + useSuspendExtT(sfn = { // BLOCK + local suspend fun @ExtensionFunctionType @ExtensionFunctionType Function1.suspendConversion(p0: T) { + callee.invoke(p1 = p0) + } + + fn::suspendConversion + }) +} + +fun testSimpleSAsSimpleT(fn: Function1) { + useSuspendArgT(sfn = { // BLOCK + local suspend fun Function1.suspendConversion(p0: T) { + callee.invoke(p1 = p0) + } + + fn::suspendConversion + }) +} + +fun testSimpleSAsExtT(fn: Function1) { + useSuspendExtT(sfn = { // BLOCK + local suspend fun Function1.suspendConversion(p0: T) { + callee.invoke(p1 = p0) + } + + fn::suspendConversion + }) +} + +fun testExtSAsSimpleT(fn: @ExtensionFunctionType @ExtensionFunctionType Function1) { + useSuspendArgT(sfn = { // BLOCK + local suspend fun @ExtensionFunctionType @ExtensionFunctionType Function1.suspendConversion(p0: T) { + callee.invoke(p1 = p0) + } + + fn::suspendConversion + }) +} + +fun testExtSAsExtT(fn: @ExtensionFunctionType @ExtensionFunctionType Function1) { + useSuspendExtT(sfn = { // BLOCK + local suspend fun @ExtensionFunctionType @ExtensionFunctionType Function1.suspendConversion(p0: T) { + callee.invoke(p1 = p0) + } + + fn::suspendConversion + }) +} + +fun testSmartCastWithSuspendConversion(a: Any) { + a as Function0 /*~> Unit */ + useSuspend(sfn = { // BLOCK + local suspend fun Function0.suspendConversion() { + callee.invoke() + } + + a /*as Function0 */::suspendConversion + }) +} + +fun testSmartCastOnVarWithSuspendConversion(a: Any) { + var b: Any = a + b as Function0 /*~> Unit */ + useSuspend(sfn = { // BLOCK + local suspend fun Function0.suspendConversion() { + callee.invoke() + } + + b /*as Function0 */::suspendConversion + }) +} + +fun testSmartCastVsSuspendConversion(a: Function0) { + a as SuspendFunction0 /*~> Unit */ + useSuspend(sfn = a /*as SuspendFunction0 */) +} + +fun testSmartCastOnVarVsSuspendConversion(a: Function0) { + var b: Function0 = a + b as SuspendFunction0 /*~> Unit */ + useSuspend(sfn = b) +} + +fun testIntersectionVsSuspendConversion(x: T) where T : Function0, T : SuspendFunction0 { + useSuspend(sfn = x) +} diff --git a/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.fir.kt.txt b/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.fir.kt.txt new file mode 100644 index 00000000000..8019c9ab30b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.fir.kt.txt @@ -0,0 +1,28 @@ +val n: Any? + field = null + get + +open enum class En : Enum { + private constructor(x: String?) /* primary */ { + super/*Enum*/() + /* () */ + + } + + val x: String? + field = x + get + + ENTRY = En(x = { // BLOCK + val tmp0_safe_receiver: Any? = () + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + else -> tmp0_safe_receiver.toString() + } + }) + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): En /* Synthetic body for ENUM_VALUEOF */ + +} diff --git a/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.fir.kt.txt b/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.fir.kt.txt new file mode 100644 index 00000000000..1f36002c48d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.fir.kt.txt @@ -0,0 +1,44 @@ +class Outer { + constructor(x: T) /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: T + field = x + get + + open inner class Inner { + constructor(y: Int) /* primary */ { + super/*Any*/() + /* () */ + + } + + val y: Int + field = y + get + + } + +} + +fun Outer.test(): Inner { + return { // BLOCK + local class : Inner { + private constructor() /* primary */ { + .super/*Inner*/(y = 42) + /* () */ + + } + + val xx: Int + field = .().plus(other = .()) + get + + } + + () + } +} diff --git a/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.fir.kt.txt b/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.fir.kt.txt new file mode 100644 index 00000000000..17c69ed7c75 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.fir.kt.txt @@ -0,0 +1,39 @@ +open class Base { + constructor(x: Any) /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: Any + field = x + get + +} + +object Host { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + class Derived1 : Base { + constructor() /* primary */ { + super/*Base*/(x = Host) + /* () */ + + } + + } + + class Derived2 : Base { + constructor() /* primary */ { + super/*Base*/(x = Host) + /* () */ + + } + + } + +} diff --git a/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.fir.kt.txt b/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.fir.kt.txt new file mode 100644 index 00000000000..9231a19a63d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.fir.kt.txt @@ -0,0 +1,48 @@ +fun WithCompanion.test() { + val test1: = { // BLOCK + local class : WithCompanion { + private constructor() /* primary */ { + super/*WithCompanion*/(a = Companion) + /* () */ + + } + + } + + () + } + val test2: = { // BLOCK + local class : WithCompanion { + private constructor() /* primary */ { + super/*WithCompanion*/(a = Companion.foo()) + /* () */ + + } + + } + + () + } +} + +open class WithCompanion { + constructor(a: Companion) /* primary */ { + super/*Any*/() + /* () */ + + } + + companion object Companion { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + fun foo(): Companion { + return + } + + } + +} diff --git a/compiler/testData/ir/irText/expressions/throw.fir.kt.txt b/compiler/testData/ir/irText/expressions/throw.fir.kt.txt new file mode 100644 index 00000000000..76bd6339f87 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/throw.fir.kt.txt @@ -0,0 +1,9 @@ +fun test1() { + throw Throwable() +} + +fun testImplicitCast(a: Any) { + when { + a is Throwable -> throw a /*as Throwable */ + } +} diff --git a/compiler/testData/ir/irText/expressions/tryCatch.fir.kt.txt b/compiler/testData/ir/irText/expressions/tryCatch.fir.kt.txt new file mode 100644 index 00000000000..c8bd8877a5a --- /dev/null +++ b/compiler/testData/ir/irText/expressions/tryCatch.fir.kt.txt @@ -0,0 +1,20 @@ +fun test1() { + try println() + catch (e: Throwable)println() + finally println() +} + +fun test2(): Int { + return try { // BLOCK + println() + 42 + } + catch (e: Throwable){ // BLOCK + println() + 24 + } + finally { // BLOCK + println() + 555 + } +} diff --git a/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.fir.kt.txt b/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.fir.kt.txt new file mode 100644 index 00000000000..c5b32397587 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.fir.kt.txt @@ -0,0 +1,8 @@ +fun testImplicitCast(a: Any) { + when { + a !is String -> return Unit + } + val t: String = try a /*as String */ + catch (e: Throwable)"" + +} diff --git a/compiler/testData/ir/irText/expressions/typeAliasConstructorReference.fir.kt.txt b/compiler/testData/ir/irText/expressions/typeAliasConstructorReference.fir.kt.txt new file mode 100644 index 00000000000..9dec7e45903 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/typeAliasConstructorReference.fir.kt.txt @@ -0,0 +1,36 @@ +typealias CA = C +typealias NA = Nested +class C { + constructor(x: Int) /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +object Host { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + class Nested { + constructor(x: Int) /* primary */ { + super/*Any*/() + /* () */ + + } + + } + +} + +val test1: Function1 + field = C:: + get + +val test2: Function1 + field = Nested:: + get diff --git a/compiler/testData/ir/irText/expressions/useImportedMember.fir.kt.txt b/compiler/testData/ir/irText/expressions/useImportedMember.fir.kt.txt new file mode 100644 index 00000000000..987ce65d2a2 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/useImportedMember.fir.kt.txt @@ -0,0 +1,102 @@ +interface I { + fun T.fromInterface(): T { + return + } + + fun genericFromSuper(g: G): G { + return g + } + +} + +open class BaseClass { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + val T.fromClass: T + get(): T { + return + } + +} + +object C : BaseClass, I { + private constructor() /* primary */ { + super/*BaseClass*/() + /* () */ + + } + + fun f(s: Int): Int { + return 1 + } + + fun f(s: String): Int { + return 2 + } + + fun Boolean.f(): Int { + return 3 + } + + var p: Int + field = 4 + get + set + + val Int.ext: Int + get(): Int { + return 6 + } + + fun g1(t: T): T { + return t + } + + val T.g2: T + get(): T { + return + } + +} + +fun box(): String { + when { + EQEQ(arg0 = C.f(s = 1), arg1 = 1).not() -> return "1" + } + when { + EQEQ(arg0 = C.f(s = "s"), arg1 = 2).not() -> return "2" + } + when { + EQEQ(arg0 = (C, true).f(), arg1 = 3).not() -> return "3" + } + when { + EQEQ(arg0 = C.(), arg1 = 4).not() -> return "4" + } + C.( = 5) + when { + EQEQ(arg0 = C.(), arg1 = 5).not() -> return "5" + } + when { + EQEQ(arg0 = (C, 5).(), arg1 = 6).not() -> return "6" + } + when { + EQEQ(arg0 = C.g1(t = "7"), arg1 = "7").not() -> return "7" + } + when { + EQEQ(arg0 = (C, "8").(), arg1 = "8").not() -> return "8" + } + when { + EQEQ(arg0 = (C, 9).fromInterface(), arg1 = 9).not() -> return "9" + } + when { + EQEQ(arg0 = (C, "10").(), arg1 = "10").not() -> return "10" + } + when { + EQEQ(arg0 = C.genericFromSuper(g = "11"), arg1 = "11").not() -> return "11" + } + return "OK" +} diff --git a/compiler/testData/ir/irText/expressions/values.fir.kt.txt b/compiler/testData/ir/irText/expressions/values.fir.kt.txt new file mode 100644 index 00000000000..0466612fce3 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/values.fir.kt.txt @@ -0,0 +1,61 @@ +enum class Enum : Enum { + private constructor() /* primary */ { + super/*Enum*/() + /* () */ + + } + + A = Enum() + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): Enum /* Synthetic body for ENUM_VALUEOF */ + +} + +object A { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +val a: Int + field = 0 + get + +class Z { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + companion object Companion { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + } + +} + +fun test1(): Enum { + return Enum.A +} + +fun test2(): A { + return A +} + +fun test3(): Int { + return () +} + +fun test4(): Companion { + return Companion +} diff --git a/compiler/testData/ir/irText/expressions/variableAsFunctionCall.fir.kt.txt b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.fir.kt.txt new file mode 100644 index 00000000000..ec434a2a7e0 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.fir.kt.txt @@ -0,0 +1,34 @@ +fun String.k(): Function0 { + return local fun (): String { + return + } + +} + +fun test1(f: Function0) { + return f.invoke() +} + +fun test2(f: @ExtensionFunctionType @ExtensionFunctionType Function1) { + return f.invoke(p1 = "hello") +} + +fun test3(): String { + return "hello".k().invoke() +} + +fun test4(ns: String?): String? { + return { // BLOCK + val tmp1_safe_receiver: Function0? = { // BLOCK + val tmp0_safe_receiver: String? = ns + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + else -> tmp0_safe_receiver.k() + } + } + when { + EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null + else -> tmp1_safe_receiver.invoke() + } + } +} diff --git a/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.fir.kt.txt b/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.fir.kt.txt new file mode 100644 index 00000000000..7e5a7758482 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.fir.kt.txt @@ -0,0 +1,23 @@ +val T.gk: Function0 + get(): Function0 { + return local fun (): T { + return + } + + } + +fun testGeneric1(x: String): T { + return x.().invoke() +} + +val T.kt26531Val: Function0 + get(): Function0 { + return local fun (): T { + return + } + + } + +fun kt26531(): T { + return 7.().invoke() +} diff --git a/compiler/testData/ir/irText/expressions/when.fir.kt.txt b/compiler/testData/ir/irText/expressions/when.fir.kt.txt new file mode 100644 index 00000000000..b29edd7691a --- /dev/null +++ b/compiler/testData/ir/irText/expressions/when.fir.kt.txt @@ -0,0 +1,63 @@ +object A { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +fun testWithSubject(x: Any?): String { + return { // BLOCK + val tmp0_subject: Any? = x + when { + EQEQ(arg0 = tmp0_subject, arg1 = null) -> "null" + EQEQ(arg0 = tmp0_subject, arg1 = A) -> "A" + tmp0_subject is String -> "String" + tmp0_subject !is Number -> "!Number" + setOf().contains(element = tmp0_subject) -> "nothingness?" + else -> "something" + } + } +} + +fun test(x: Any?): String { + return when { + EQEQ(arg0 = x, arg1 = null) -> "null" + EQEQ(arg0 = x /*as Any */, arg1 = A) -> "A" + x /*as Any */ is String -> "String" + x /*as Any */ !is Number -> "!Number" + setOf().contains(element = x /*as Number */) -> "nothingness?" + else -> "something" + } +} + +fun testComma(x: Int): String { + return { // BLOCK + val tmp1_subject: Int = x + when { + when { + when { + when { + EQEQ(arg0 = tmp1_subject, arg1 = 1) -> true + else -> EQEQ(arg0 = tmp1_subject, arg1 = 2) + } -> true + else -> EQEQ(arg0 = tmp1_subject, arg1 = 3) + } -> true + else -> EQEQ(arg0 = tmp1_subject, arg1 = 4) + } -> "1234" + when { + when { + EQEQ(arg0 = tmp1_subject, arg1 = 5) -> true + else -> EQEQ(arg0 = tmp1_subject, arg1 = 6) + } -> true + else -> EQEQ(arg0 = tmp1_subject, arg1 = 7) + } -> "567" + when { + EQEQ(arg0 = tmp1_subject, arg1 = 8) -> true + else -> EQEQ(arg0 = tmp1_subject, arg1 = 9) + } -> "89" + else -> "?" + } + } +} diff --git a/compiler/testData/ir/irText/expressions/whenReturn.fir.kt.txt b/compiler/testData/ir/irText/expressions/whenReturn.fir.kt.txt new file mode 100644 index 00000000000..bd39afe8f55 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/whenReturn.fir.kt.txt @@ -0,0 +1,13 @@ +fun toString(grade: String): String { + { // BLOCK + val tmp0_subject: String = grade + when { + EQEQ(arg0 = tmp0_subject, arg1 = "A") -> return "Excellent" + EQEQ(arg0 = tmp0_subject, arg1 = "B") -> return "Good" + EQEQ(arg0 = tmp0_subject, arg1 = "C") -> return "Mediocre" + EQEQ(arg0 = tmp0_subject, arg1 = "D") -> return "Fair" + else -> return "Failure" + } + } + return "???" +} diff --git a/compiler/testData/ir/irText/expressions/whenUnusedExpression.fir.kt.txt b/compiler/testData/ir/irText/expressions/whenUnusedExpression.fir.kt.txt new file mode 100644 index 00000000000..30614dd0e9f --- /dev/null +++ b/compiler/testData/ir/irText/expressions/whenUnusedExpression.fir.kt.txt @@ -0,0 +1,12 @@ +fun test(b: Boolean, i: Int) { + when { + b -> { // BLOCK + val tmp0_subject: Int = i + when { + EQEQ(arg0 = tmp0_subject, arg1 = 0) -> 1 + else -> null + } + } + else -> null + } /*~> Unit */ +} diff --git a/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.fir.kt.txt b/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.fir.kt.txt new file mode 100644 index 00000000000..8a108d7366d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.fir.kt.txt @@ -0,0 +1,17 @@ +fun foo(): Any { + return 1 +} + +fun test(): Int { + return { // BLOCK + val y: Any = foo() + when { + EQEQ(arg0 = y, arg1 = 42) -> 1 + y is String -> y /*as String */.() + y !is Int -> 2 + error("") /* ERROR CALL */y; -> 3 + error("") /* ERROR CALL */y; .not() -> 4 + else -> -1 + } + } +} diff --git a/compiler/testData/ir/irText/expressions/whileDoWhile.fir.kt.txt b/compiler/testData/ir/irText/expressions/whileDoWhile.fir.kt.txt new file mode 100644 index 00000000000..89dd728143d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/whileDoWhile.fir.kt.txt @@ -0,0 +1,39 @@ +fun test() { + var x: Int = 0 + while (less(arg0 = x, arg1 = 0)) { // BLOCK + } + while (less(arg0 = x, arg1 = 5)) { // BLOCK + val : Int = x + x = .inc() + + } + while (less(arg0 = x, arg1 = 10)) { // BLOCK + val : Int = x + x = .inc() + + } + do// COMPOSITE { + // } while (less(arg0 = x, arg1 = 0)) + do{ // BLOCK + val : Int = x + x = .inc() + + } while (less(arg0 = x, arg1 = 15)) + do// COMPOSITE { + val : Int = x + x = .inc() + + // } while (less(arg0 = x, arg1 = 20)) +} + +fun testSmartcastInCondition() { + val a: Any? = null + when { + a is Boolean -> { // BLOCK + while (a /*as Boolean */) { // BLOCK + } + do// COMPOSITE { + // } while (a /*as Boolean */) + } + } +} diff --git a/compiler/testData/ir/irText/firProblems/AbstractMutableMap.fir.kt.txt b/compiler/testData/ir/irText/firProblems/AbstractMutableMap.fir.kt.txt new file mode 100644 index 00000000000..f4df9b24968 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/AbstractMutableMap.fir.kt.txt @@ -0,0 +1,17 @@ +class MyMap : AbstractMutableMap { + constructor() /* primary */ { + super/*AbstractMutableMap*/() + /* () */ + + } + + override fun put(key: K, value: V): V? { + return null + } + + override val entries: MutableSet> + override get(): MutableSet> { + return mutableSetOf>() + } + +} diff --git a/compiler/testData/ir/irText/firProblems/AllCandidates.fir.kt.txt b/compiler/testData/ir/irText/firProblems/AllCandidates.fir.kt.txt new file mode 100644 index 00000000000..7b048f664b7 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/AllCandidates.fir.kt.txt @@ -0,0 +1,31 @@ +class ResolvedCall { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +class MyCandidate { + constructor(resolvedCall: ResolvedCall<*>) /* primary */ { + super/*Any*/() + /* () */ + + } + + val resolvedCall: ResolvedCall<*> + field = resolvedCall + get + +} + +private fun allCandidatesResult(allCandidates: Collection): OverloadResolutionResultsImpl? { + return nameNotFound().apply?>(block = local fun OverloadResolutionResultsImpl?.() { + .setAllCandidates(allCandidates = allCandidates.map>(transform = local fun (it: MyCandidate): ResolvedCall { + return it.() as ResolvedCall + } +)) + } +) +} diff --git a/compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.fir.kt.txt b/compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.fir.kt.txt new file mode 100644 index 00000000000..e5d0f36e470 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/AnnotationInAnnotation.fir.kt.txt @@ -0,0 +1,29 @@ +annotation class Storage : Annotation { + constructor(value: String) /* primary */ + val value: String + field = value + get + +} + +annotation class State : Annotation { + constructor(name: String, storages: Array) /* primary */ + val name: String + field = name + get + + val storages: Array + field = storages + get + +} + +@State(name = "1", storages = [Storage(value = "HELLO")]) +class Test { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} diff --git a/compiler/testData/ir/irText/firProblems/BaseFirBuilder.fir.kt.txt b/compiler/testData/ir/irText/firProblems/BaseFirBuilder.fir.kt.txt new file mode 100644 index 00000000000..e40fd82c215 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/BaseFirBuilder.fir.kt.txt @@ -0,0 +1,12 @@ +abstract class BaseFirBuilder { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + inline fun withCapturedTypeParameters(block: Function0): T { + return block.invoke() + } + +} diff --git a/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.fir.kt.txt b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.fir.kt.txt new file mode 100644 index 00000000000..fa763a44d20 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.fir.kt.txt @@ -0,0 +1,62 @@ +interface ComponentContainer { + +} + +interface PlatformSpecificExtension> { + +} + +interface ComponentDescriptor { + +} + +abstract class PlatformExtensionsClashResolver> { + constructor(applicableTo: Class) /* primary */ { + super/*Any*/() + /* () */ + + } + + val applicableTo: Class + field = applicableTo + get + +} + +class ClashResolutionDescriptor> { + constructor(container: ComponentContainer, resolver: PlatformExtensionsClashResolver, clashedComponents: List) /* primary */ { + super/*Any*/() + /* () */ + + } + + private val resolver: PlatformExtensionsClashResolver + field = resolver + private get + + private val clashedComponents: List + field = clashedComponents + private get + +} + +private val registrationMap: HashMap + field = hashMapOf() + private get + +fun resolveClashesIfAny(container: ComponentContainer, clashResolvers: List>) { + { // BLOCK + val : Iterator> = clashResolvers.iterator() + while (.hasNext()) { // BLOCK + val resolver: PlatformExtensionsClashResolver<*> = .next() + val clashedComponents: Collection = { // BLOCK + val : Collection? = ().get(p0 = resolver.()) as? Collection + when { + EQEQ(arg0 = , arg1 = null) -> continue + else -> /*as Collection */ + } + } + val substituteDescriptor: ClashResolutionDescriptor>>>>> = ClashResolutionDescriptor>>>>>(container = container, resolver = resolver, clashedComponents = clashedComponents.toList()) + } + } +} diff --git a/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.fir.kt.txt b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.fir.kt.txt new file mode 100644 index 00000000000..fcf25423542 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.fir.kt.txt @@ -0,0 +1,77 @@ +interface IrType { + +} + +interface TypeRemapper { + abstract fun enterScope(irTypeParametersContainer: IrTypeParametersContainer) + abstract fun remapType(type: IrType): IrType + abstract fun leaveScope() + +} + +interface IrTypeParametersContainer : IrDeclaration, IrDeclarationParent { + abstract var typeParameters: List + abstract get + abstract set + +} + +interface IrDeclaration { + +} + +interface IrTypeParameter : IrDeclaration { + abstract val superTypes: MutableList + abstract get + +} + +interface IrDeclarationParent { + +} + +class DeepCopyIrTreeWithSymbols { + constructor(typeRemapper: TypeRemapper) /* primary */ { + super/*Any*/() + /* () */ + + } + + private val typeRemapper: TypeRemapper + field = typeRemapper + private get + + private fun copyTypeParameter(declaration: IrTypeParameter): IrTypeParameter { + return declaration + } + + fun IrTypeParametersContainer.copyTypeParametersFrom(other: IrTypeParametersContainer) { + .( = other.().map(transform = local fun (it: IrTypeParameter): IrTypeParameter { + return .copyTypeParameter(declaration = it) + } +)) + .().withinScope(irTypeParametersContainer = , fn = local fun () { + { // BLOCK + val : Iterator> = .().zip(other = other.()).iterator() + while (.hasNext()) { // BLOCK + val : Pair = .next() + val thisTypeParameter: IrTypeParameter = .component1() + val otherTypeParameter: IrTypeParameter = .component2() + otherTypeParameter.().mapTo>(destination = thisTypeParameter.(), transform = local fun (it: IrType): IrType { + return .().remapType(type = it) + } +) + } + } + } +) + } + +} + +inline fun TypeRemapper.withinScope(irTypeParametersContainer: IrTypeParametersContainer, fn: Function0): T { + .enterScope(irTypeParametersContainer = irTypeParametersContainer) + val result: T = fn.invoke() + .leaveScope() + return result +} diff --git a/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.fir.kt.txt b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.fir.kt.txt new file mode 100644 index 00000000000..fca16e0cd8d --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.fir.kt.txt @@ -0,0 +1,60 @@ +class Impl : A, B { + constructor(b: B) /* primary */ { + super/*Any*/() + /* () */ + + .#<$$delegate_0> = b + } + + override fun add(element: String?): Boolean { + return .#<$$delegate_0>.add(element = element) + } + + override fun addAll(elements: Collection): Boolean { + return .#<$$delegate_0>.addAll(elements = elements) + } + + override fun clear() { + .#<$$delegate_0>.clear() + } + + override operator fun iterator(): MutableIterator { + return .#<$$delegate_0>.iterator() + } + + override fun remove(element: String?): Boolean { + return .#<$$delegate_0>.remove(element = element) + } + + override fun removeAll(elements: Collection): Boolean { + return .#<$$delegate_0>.removeAll(elements = elements) + } + + override fun retainAll(elements: Collection): Boolean { + return .#<$$delegate_0>.retainAll(elements = elements) + } + + override operator fun contains(element: String?): Boolean { + return .#<$$delegate_0>.contains(element = element) + } + + override fun containsAll(elements: Collection): Boolean { + return .#<$$delegate_0>.containsAll(elements = elements) + } + + override fun isEmpty(): Boolean { + return .#<$$delegate_0>.isEmpty() + } + + override val size: Int + override get(): Int { + return .#<$$delegate_0>.() + } + + local /*final field*/ val <$$delegate_0>: B + +} + +fun box(): String { + return "OK" +} diff --git a/compiler/testData/ir/irText/firProblems/FirBuilder.fir.kt.txt b/compiler/testData/ir/irText/firProblems/FirBuilder.fir.kt.txt new file mode 100644 index 00000000000..62fa200f594 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/FirBuilder.fir.kt.txt @@ -0,0 +1,17 @@ +open class BaseConverter : BaseFirBuilder { + constructor() /* primary */ { + super/*BaseFirBuilder*/() + /* () */ + + } + +} + +class DeclarationsConverter : BaseConverter { + constructor() /* primary */ { + super/*BaseConverter*/() + /* () */ + + } + +} diff --git a/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.fir.kt.txt b/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.fir.kt.txt new file mode 100644 index 00000000000..ed7485eda9e --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.fir.kt.txt @@ -0,0 +1,49 @@ +fun box(): String { + val obj: = { // BLOCK + local class { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + val end: String + field = "K" + get + + fun foo(): String { + return .Some(s = "O").bar() + } + + local inner class Some : Base { + constructor(s: String) /* primary */ { + .super/*Base*/(s = s) + /* () */ + + } + + fun bar(): String { + return .().plus(other = .()) + } + + } + + local open inner class Base { + constructor(s: String) /* primary */ { + super/*Any*/() + /* () */ + + } + + val s: String + field = s + get + + } + + } + + () + } + return obj.foo() +} diff --git a/compiler/testData/ir/irText/firProblems/MultiList.fir.kt.txt b/compiler/testData/ir/irText/firProblems/MultiList.fir.kt.txt new file mode 100644 index 00000000000..7a96913bc62 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/MultiList.fir.kt.txt @@ -0,0 +1,67 @@ +data class Some { + constructor(value: T) /* primary */ { + super/*Any*/() + /* () */ + + } + + val value: T + field = value + get + + fun component1(): T { + return .#value + } + + fun copy(value: T = .#value): Some { + return Some(value = value) + } + + override fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Some -> return false + } + val tmp0_other_with_cast: Some = other as Some + when { + EQEQ(arg0 = .#value, arg1 = tmp0_other_with_cast.#value).not() -> return false + } + return true + } + + override fun hashCode(): Int { + return when { + EQEQ(arg0 = .#value, arg1 = null) -> 0 + else -> .#value.hashCode() + } + } + + override fun toString(): String { + return "Some(" + "value=" + .#value + ")" + } + +} + +interface MyList : List> { + +} + +open class SomeList : MyList, ArrayList> { + constructor() /* primary */ { + super/*ArrayList*/>() + /* () */ + + } + +} + +class FinalList : SomeList { + constructor() /* primary */ { + super/*SomeList*/() + /* () */ + + } + +} diff --git a/compiler/testData/ir/irText/firProblems/SameJavaFieldReferences.fir.kt.txt b/compiler/testData/ir/irText/firProblems/SameJavaFieldReferences.fir.kt.txt new file mode 100644 index 00000000000..c4bde9f59c7 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/SameJavaFieldReferences.fir.kt.txt @@ -0,0 +1,4 @@ +fun foo() { + val ref1: KProperty0 = SomeJavaClass::someJavaField/*()*/ + val ref2: KProperty0 = SomeJavaClass::someJavaField/*()*/ +} diff --git a/compiler/testData/ir/irText/firProblems/SignatureClash.fir.kt.txt b/compiler/testData/ir/irText/firProblems/SignatureClash.fir.kt.txt new file mode 100644 index 00000000000..30ecc73057c --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/SignatureClash.fir.kt.txt @@ -0,0 +1,79 @@ +typealias Some = Function1 +object Factory { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + fun foo(a: String): String { + return "Alpha" + } + + fun foo(a: String, f: Function1): String { + return "Omega" + } + +} + +interface Base { + +} + +interface Delegate : Base { + abstract fun bar() + +} + +interface Derived : Delegate { + +} + +data class DataClass : Derived, Delegate { + constructor(delegate: Delegate) /* primary */ { + super/*Any*/() + /* () */ + + .#<$$delegate_0> = delegate + } + + val delegate: Delegate + field = delegate + get + + fun component1(): Delegate { + return .#delegate + } + + fun copy(delegate: Delegate = .#delegate): DataClass { + return DataClass(delegate = delegate) + } + + override fun bar() { + .#<$$delegate_0>.bar() + } + + local /*final field*/ val <$$delegate_0>: Delegate + override fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is DataClass -> return false + } + val tmp0_other_with_cast: DataClass = other as DataClass + when { + EQEQ(arg0 = .#delegate, arg1 = tmp0_other_with_cast.#delegate).not() -> return false + } + return true + } + + override fun hashCode(): Int { + return .#delegate.hashCode() + } + + override fun toString(): String { + return "DataClass(" + "delegate=" + .#delegate + ")" + } + +} diff --git a/compiler/testData/ir/irText/firProblems/candidateSymbol.fir.kt.txt b/compiler/testData/ir/irText/firProblems/candidateSymbol.fir.kt.txt new file mode 100644 index 00000000000..1214db912fa --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/candidateSymbol.fir.kt.txt @@ -0,0 +1,52 @@ +class Candidate { + constructor(symbol: AbstractFirBasedSymbol<*>) /* primary */ { + super/*Any*/() + /* () */ + + } + + val symbol: AbstractFirBasedSymbol<*> + field = symbol + get + +} + +abstract class AbstractFirBasedSymbol where E : FirSymbolOwner, E : FirDeclaration { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + lateinit var fir: E + get + set + +} + +interface FirDeclaration { + +} + +interface FirSymbolOwner where E : FirSymbolOwner, E : FirDeclaration { + abstract val symbol: AbstractFirBasedSymbol + abstract get + +} + +interface FirCallableMemberDeclaration> : FirSymbolOwner, FirDeclaration { + abstract override val symbol: AbstractFirBasedSymbol + abstract override get + +} + +fun foo(candidate: Candidate) { + val me: FirSymbolOwner>>>> = candidate.().() + when { + when { + me is FirCallableMemberDeclaration<*> -> EQEQ(arg0 = me /*as FirCallableMemberDeclaration<*> */.(), arg1 = null).not() + else -> false + } -> { // BLOCK + } + } +} diff --git a/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.fir.kt.txt b/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.fir.kt.txt new file mode 100644 index 00000000000..4cf9c1fb9dc --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.fir.kt.txt @@ -0,0 +1,39 @@ +private const val BACKSLASH: Char + field = '\\' + private get + +private fun Reader.nextChar(): Char? { + return { // BLOCK + val tmp0_safe_receiver: Int? = .read().takeUnless(predicate = local fun (it: Int): Boolean { + return EQEQ(arg0 = it, arg1 = -1) + } +) + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + else -> tmp0_safe_receiver.toChar() + } + } +} + +fun Reader.consumeRestOfQuotedSequence(sb: StringBuilder, quote: Char) { + var ch: Char? = .nextChar() + while (when { + EQEQ(arg0 = ch, arg1 = null).not() -> EQEQ(arg0 = ch /*as Char */, arg1 = quote).not() + else -> false + }) { // BLOCK + when { + EQEQ(arg0 = ch /*as Char */, arg1 = ()) -> { // BLOCK + val tmp1_safe_receiver: Char? = .nextChar() + when { + EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null + else -> tmp1_safe_receiver.let(block = local fun (it: Char): StringBuilder? { + return sb.append(p0 = it) + } +) + } + } + else -> sb.append(p0 = ch /*as Char */) + } /*~> Unit */ + ch = .nextChar() + } +} diff --git a/compiler/testData/ir/irText/firProblems/putIfAbsent.fir.kt.txt b/compiler/testData/ir/irText/firProblems/putIfAbsent.fir.kt.txt new file mode 100644 index 00000000000..5e4cdba83e1 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/putIfAbsent.fir.kt.txt @@ -0,0 +1,13 @@ +class Owner { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + fun foo(x: T, y: T) { + val map: MutableMap = mutableMapOf() + map.putIfAbsent(p0 = x, p1 = y) /*~> Unit */ + } + +} diff --git a/compiler/testData/ir/irText/firProblems/recursiveCapturedTypeInPropertyReference.fir.kt.txt b/compiler/testData/ir/irText/firProblems/recursiveCapturedTypeInPropertyReference.fir.kt.txt new file mode 100644 index 00000000000..54c5833bc51 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/recursiveCapturedTypeInPropertyReference.fir.kt.txt @@ -0,0 +1,22 @@ +interface Something { + +} + +interface Recursive where R : Recursive, R : Something { + abstract val symbol: AbstractSymbol + abstract get + +} + +abstract class AbstractSymbol where E : Recursive, E : Something { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + fun foo(list: List) { + val result: List>> = list.filterIsInstance>().map, AbstractSymbol>>(transform = Recursive::symbol) + } + +} diff --git a/compiler/testData/ir/irText/firProblems/throwableStackTrace.fir.kt.txt b/compiler/testData/ir/irText/firProblems/throwableStackTrace.fir.kt.txt new file mode 100644 index 00000000000..33e6667ac65 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/throwableStackTrace.fir.kt.txt @@ -0,0 +1,3 @@ +fun foo(t: Throwable) { + t.setStackTrace(p0 = t.getStackTrace()) +} diff --git a/compiler/testData/ir/irText/firProblems/v8arrayToList.fir.kt.txt b/compiler/testData/ir/irText/firProblems/v8arrayToList.fir.kt.txt new file mode 100644 index 00000000000..4ce9775b538 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/v8arrayToList.fir.kt.txt @@ -0,0 +1,14 @@ +class V8Array { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +fun box(): String { + val array: V8Array = V8Array() + val list: List = toList(array = array) as List + return list.get(index = 0) +} diff --git a/compiler/testData/ir/irText/lambdas/anonymousFunction.fir.kt.txt b/compiler/testData/ir/irText/lambdas/anonymousFunction.fir.kt.txt new file mode 100644 index 00000000000..ef19f0f61aa --- /dev/null +++ b/compiler/testData/ir/irText/lambdas/anonymousFunction.fir.kt.txt @@ -0,0 +1,6 @@ +val anonymous: Function0 + field = local fun () { + println() + } + + get diff --git a/compiler/testData/ir/irText/lambdas/destructuringInLambda.fir.kt.txt b/compiler/testData/ir/irText/lambdas/destructuringInLambda.fir.kt.txt new file mode 100644 index 00000000000..801757a9b58 --- /dev/null +++ b/compiler/testData/ir/irText/lambdas/destructuringInLambda.fir.kt.txt @@ -0,0 +1,65 @@ +data class A { + constructor(x: Int, y: Int) /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: Int + field = x + get + + val y: Int + field = y + get + + fun component1(): Int { + return .#x + } + + fun component2(): Int { + return .#y + } + + fun copy(x: Int = .#x, y: Int = .#y): A { + return A(x = x, y = y) + } + + override fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is A -> return false + } + val tmp0_other_with_cast: A = other as A + when { + EQEQ(arg0 = .#x, arg1 = tmp0_other_with_cast.#x).not() -> return false + } + when { + EQEQ(arg0 = .#y, arg1 = tmp0_other_with_cast.#y).not() -> return false + } + return true + } + + override fun hashCode(): Int { + var result: Int = .#x.hashCode() + result = result.times(other = 31).plus(other = .#y.hashCode()) + return result + } + + override fun toString(): String { + return "A(" + "x=" + .#x + ", " + "y=" + .#y + ")" + } + +} + +var fn: Function1 + field = local fun (: A): Int { + val _: Int = .component1() + val y: Int = .component2() + return 42.plus(other = y) + } + + get + set diff --git a/compiler/testData/ir/irText/lambdas/extensionLambda.fir.kt.txt b/compiler/testData/ir/irText/lambdas/extensionLambda.fir.kt.txt new file mode 100644 index 00000000000..46b75238fa5 --- /dev/null +++ b/compiler/testData/ir/irText/lambdas/extensionLambda.fir.kt.txt @@ -0,0 +1,6 @@ +fun test1(): Int { + return "42".run(block = local fun String.(): Int { + return .() + } +) +} diff --git a/compiler/testData/ir/irText/lambdas/localFunction.fir.kt.txt b/compiler/testData/ir/irText/lambdas/localFunction.fir.kt.txt new file mode 100644 index 00000000000..051571a5ade --- /dev/null +++ b/compiler/testData/ir/irText/lambdas/localFunction.fir.kt.txt @@ -0,0 +1,10 @@ +fun outer() { + var x: Int = 0 + local fun local() { + val : Int = x + x = .inc() + /*~> Unit */ + } + + local() +} diff --git a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.fir.kt.txt b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.fir.kt.txt new file mode 100644 index 00000000000..ebb433fa9a2 --- /dev/null +++ b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.fir.kt.txt @@ -0,0 +1,45 @@ +object A { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +object B { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +interface IFoo { + val A.foo: B + get(): B { + return B + } + +} + +interface IInvoke { + operator fun B.invoke(): Int { + return 42 + } + +} + +fun test(fooImpl: IFoo, invokeImpl: IInvoke) { + with(receiver = A, block = local fun A.(): Int { + return with(receiver = fooImpl, block = local fun IFoo.(): Int { + return with(receiver = invokeImpl, block = local fun IInvoke.(): Int { + return (, (, ).()).invoke() + } +) + } +) + } +) /*~> Unit */ +} diff --git a/compiler/testData/ir/irText/lambdas/nonLocalReturn.fir.kt.txt b/compiler/testData/ir/irText/lambdas/nonLocalReturn.fir.kt.txt new file mode 100644 index 00000000000..8792fe14792 --- /dev/null +++ b/compiler/testData/ir/irText/lambdas/nonLocalReturn.fir.kt.txt @@ -0,0 +1,50 @@ +fun test0() { + run(block = local fun (): Nothing { + return Unit + } +) +} + +fun test1() { + run(block = local fun () { + return Unit + } +) +} + +fun test2() { + run(block = local fun () { + return Unit + } +) +} + +fun test3() { + run(block = local fun () { + return run(block = local fun (): Nothing { + return Unit + } +) + } +) +} + +fun testLrmFoo1(ints: List) { + ints.forEach(action = local fun (it: Int) { + when { + EQEQ(arg0 = it, arg1 = 0) -> return Unit + } + print(message = it) + } +) +} + +fun testLrmFoo2(ints: List) { + ints.forEach(action = local fun (it: Int) { + when { + EQEQ(arg0 = it, arg1 = 0) -> return Unit + } + print(message = it) + } +) +} diff --git a/compiler/testData/ir/irText/regressions/coercionInLoop.fir.kt.txt b/compiler/testData/ir/irText/regressions/coercionInLoop.fir.kt.txt new file mode 100644 index 00000000000..01ec6ae4577 --- /dev/null +++ b/compiler/testData/ir/irText/regressions/coercionInLoop.fir.kt.txt @@ -0,0 +1,14 @@ +fun box(): String { + val a: DoubleArray = DoubleArray(size = 5) + val x: DoubleIterator = a.iterator() + var i: Int = 0 + while (x.hasNext()) { // BLOCK + when { + ieee754equals(arg0 = a.get(index = i), arg1 = x.next()).not() -> return "Fail " + i.toString() + } + val : Int = i + i = .inc() + + } + return "OK" +} diff --git a/compiler/testData/ir/irText/regressions/integerCoercionToT.fir.kt.txt b/compiler/testData/ir/irText/regressions/integerCoercionToT.fir.kt.txt new file mode 100644 index 00000000000..f07bb0463ca --- /dev/null +++ b/compiler/testData/ir/irText/regressions/integerCoercionToT.fir.kt.txt @@ -0,0 +1,41 @@ +typealias CInt32Var = CInt32VarX +interface CPointed { + +} + +inline fun CPointed.reinterpret(): T { + return TODO() +} + +class CInt32VarX : CPointed { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +var CInt32VarX.value: T_INT + get(): T_INT { + return TODO() + } + set(value: T_INT) { + } + +class IdType : CPointed { + constructor(value: Int) /* primary */ { + super/*Any*/() + /* () */ + + } + + val value: Int + field = value + get + +} + +fun foo(value: IdType, cv: CInt32VarX) { + cv.(value = value.()) +} diff --git a/compiler/testData/ir/irText/regressions/kt24114.fir.kt.txt b/compiler/testData/ir/irText/regressions/kt24114.fir.kt.txt new file mode 100644 index 00000000000..ea17afbee5a --- /dev/null +++ b/compiler/testData/ir/irText/regressions/kt24114.fir.kt.txt @@ -0,0 +1,37 @@ +fun one(): Int { + return 1 +} + +fun two(): Int { + return 2 +} + +fun test1(): Int { + while (true) { // BLOCK + val tmp0_subject: Int = one() + when { + EQEQ(arg0 = tmp0_subject, arg1 = 1) -> { // BLOCK + val tmp1_subject: Int = two() + when { + EQEQ(arg0 = tmp1_subject, arg1 = 2) -> return 2 + } + } + else -> return 3 + } + } +} + +fun test2(): Int { + while (true) { // BLOCK + val tmp2_subject: Int = one() + when { + EQEQ(arg0 = tmp2_subject, arg1 = 1) -> { // BLOCK + val tmp3_subject: Int = two() + when { + EQEQ(arg0 = tmp3_subject, arg1 = 2) -> return 2 + } + } + else -> return 3 + } + } +} diff --git a/compiler/testData/ir/irText/regressions/newInference/fixationOrder1.fir.kt.txt b/compiler/testData/ir/irText/regressions/newInference/fixationOrder1.fir.kt.txt new file mode 100644 index 00000000000..6ae5f6007b2 --- /dev/null +++ b/compiler/testData/ir/irText/regressions/newInference/fixationOrder1.fir.kt.txt @@ -0,0 +1,20 @@ +fun foo(): Function1 { + return TODO() +} + +interface Inv2 { + +} + +fun check(x: T, y: R, f: Function1): Inv2 { + return TODO() +} + +fun test(): Inv2 { + return check(x = "", y = 1, f = foo()) +} + +fun box(): String { + val x: Inv2 = test() + return "OK" +} diff --git a/compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.fir.kt.txt b/compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.fir.kt.txt new file mode 100644 index 00000000000..4a917e950bc --- /dev/null +++ b/compiler/testData/ir/irText/regressions/typeAliasCtorForGenericClass.fir.kt.txt @@ -0,0 +1,19 @@ +typealias B = A +typealias B2 = A> +class A { + constructor(q: Q) /* primary */ { + super/*Any*/() + /* () */ + + } + + val q: Q + field = q + get + +} + +fun bar() { + val b: A = A(q = 2) + val b2: A> = A(q = b) +} diff --git a/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.fir.kt.txt b/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.fir.kt.txt new file mode 100644 index 00000000000..df40c6ff4e0 --- /dev/null +++ b/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.fir.kt.txt @@ -0,0 +1,6 @@ +fun problematic(lss: List>): List { + return lss.flatMap, T>(transform = local fun (it: List): Iterable { + return id(v = it) /*!! List */ + } +) +} diff --git a/compiler/testData/ir/irText/singletons/enumEntry.fir.kt.txt b/compiler/testData/ir/irText/singletons/enumEntry.fir.kt.txt new file mode 100644 index 00000000000..29498bc733d --- /dev/null +++ b/compiler/testData/ir/irText/singletons/enumEntry.fir.kt.txt @@ -0,0 +1,38 @@ +open enum class Z : Enum { + private constructor() /* primary */ { + super/*Enum*/() + /* () */ + + } + + ENTRY = ENTRY() + private enum entry class ENTRY : Z { + private constructor() /* primary */ { + super/*Z*/() + /* () */ + + } + + fun test() { + } + + inner class A { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + fun test2() { + .test() + } + + } + + } + + fun values(): Array /* Synthetic body for ENUM_VALUES */ + + fun valueOf(value: String): Z /* Synthetic body for ENUM_VALUEOF */ + +} diff --git a/compiler/testData/ir/irText/stubs/builtinMap.fir.kt.txt b/compiler/testData/ir/irText/stubs/builtinMap.fir.kt.txt new file mode 100644 index 00000000000..98510fbd27f --- /dev/null +++ b/compiler/testData/ir/irText/stubs/builtinMap.fir.kt.txt @@ -0,0 +1,9 @@ +fun Map.plus(pair: Pair): Map { + return when { + .isEmpty() -> mapOf(pair = pair) + else -> LinkedHashMap(p0 = ).apply>(block = local fun LinkedHashMap.() { + return .put(p0 = pair.(), p1 = pair.()) /*~> Unit */ + } +) + } +} diff --git a/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m1.fir.kt.txt b/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m1.fir.kt.txt new file mode 100644 index 00000000000..75c23ef42be --- /dev/null +++ b/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m1.fir.kt.txt @@ -0,0 +1,21 @@ +abstract class Base { + constructor(x: T) /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: T + field = x + get + + abstract fun foo(y: Y): T + abstract var bar: T + abstract get + abstract set + + abstract var Z.exn: T + abstract get + abstract set + +} diff --git a/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m2.fir.kt.txt b/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m2.fir.kt.txt new file mode 100644 index 00000000000..09a09d03532 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/genericClassInDifferentModule_m2.fir.kt.txt @@ -0,0 +1,24 @@ +class Derived1 : Base { + constructor(x: T) /* primary */ { + super/*Base*/(x = x) + /* () */ + + } + + override fun foo(y: Y): T { + return .() + } + + override var bar: T + field = x + override get + override set + + override var Z.exn: T + override get(): T { + return .() + } + override set(value: T) { + } + +} diff --git a/compiler/testData/ir/irText/stubs/javaConstructorWithTypeParameters.fir.kt.txt b/compiler/testData/ir/irText/stubs/javaConstructorWithTypeParameters.fir.kt.txt new file mode 100644 index 00000000000..cc8b41cd181 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/javaConstructorWithTypeParameters.fir.kt.txt @@ -0,0 +1,15 @@ +fun test1(): J1 { + return J1() +} + +fun test2(): J1 { + return J1(x1 = 1) +} + +fun test3(j1: J1): J2 { + return j1.J2() +} + +fun test4(j1: J1): J2 { + return j1.J2(x2 = 1) +} diff --git a/compiler/testData/ir/irText/stubs/javaEnum.fir.kt.txt b/compiler/testData/ir/irText/stubs/javaEnum.fir.kt.txt new file mode 100644 index 00000000000..1bd552f2499 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/javaEnum.fir.kt.txt @@ -0,0 +1,3 @@ +val test: @FlexibleNullability JEnum + field = JEnum.ONE + get diff --git a/compiler/testData/ir/irText/stubs/javaInnerClass.fir.kt.txt b/compiler/testData/ir/irText/stubs/javaInnerClass.fir.kt.txt new file mode 100644 index 00000000000..e2eb3738043 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/javaInnerClass.fir.kt.txt @@ -0,0 +1,12 @@ +class Test1 : J { + constructor() /* primary */ { + super/*J*/() + /* () */ + + } + + val test: JInner + field = .JInner() + get + +} diff --git a/compiler/testData/ir/irText/stubs/javaSyntheticProperty.fir.kt.txt b/compiler/testData/ir/irText/stubs/javaSyntheticProperty.fir.kt.txt new file mode 100644 index 00000000000..51f64ae6b60 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/javaSyntheticProperty.fir.kt.txt @@ -0,0 +1,3 @@ +val test: String? + field = J().getFoo() + get diff --git a/compiler/testData/ir/irText/stubs/jdkClassSyntheticProperty.fir.kt.txt b/compiler/testData/ir/irText/stubs/jdkClassSyntheticProperty.fir.kt.txt new file mode 100644 index 00000000000..7b992fe5683 --- /dev/null +++ b/compiler/testData/ir/irText/stubs/jdkClassSyntheticProperty.fir.kt.txt @@ -0,0 +1,4 @@ +val Class<*>.test: Array? + get(): Array? { + return .getDeclaredFields() + } diff --git a/compiler/testData/ir/irText/types/abbreviatedTypes.fir.kt.txt b/compiler/testData/ir/irText/types/abbreviatedTypes.fir.kt.txt new file mode 100644 index 00000000000..4a01af01494 --- /dev/null +++ b/compiler/testData/ir/irText/types/abbreviatedTypes.fir.kt.txt @@ -0,0 +1,17 @@ +typealias I = Int +typealias L = List +fun test1(x: List): List { + return x +} + +fun test2(x: List>): List> { + return x +} + +fun test3(x: List>): List> { + return x +} + +fun test4(x: List>): List> { + return x +} diff --git a/compiler/testData/ir/irText/types/asOnPlatformType.fir.kt.txt b/compiler/testData/ir/irText/types/asOnPlatformType.fir.kt.txt new file mode 100644 index 00000000000..d79d5a6bf74 --- /dev/null +++ b/compiler/testData/ir/irText/types/asOnPlatformType.fir.kt.txt @@ -0,0 +1,16 @@ +fun test() { + val nullStr: String? = nullString() + val nonnullStr: String? = nonnullString() + nullStr.foo() /*~> Unit */ + nonnullStr.foo() /*~> Unit */ + nullStr.fooN() /*~> Unit */ + nonnullStr.fooN() /*~> Unit */ +} + +inline fun T.foo(): T { + return as T +} + +inline fun T.fooN(): T? { + return as T? +} diff --git a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.kt.txt b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.kt.txt new file mode 100644 index 00000000000..7613c9da99e --- /dev/null +++ b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.kt.txt @@ -0,0 +1,143 @@ +@OptIn(markerClass = [ExperimentalTypeInference::class]) +fun scopedFlow(@BuilderInference block: @ExtensionFunctionType @ExtensionFunctionType SuspendFunction2, Unit>): Flow { + return flow(block = local suspend fun FlowCollector.() { + val collector: FlowCollector = + flowScope(block = local suspend fun CoroutineScope.() { + block.invoke(p1 = , p2 = collector) + } +) + } +) +} + +fun Flow.onCompletion(action: @ExtensionFunctionType @ExtensionFunctionType SuspendFunction2, Throwable?, Unit>): Flow { + return unsafeFlow(block = local suspend fun FlowCollector.() { + val safeCollector: SafeCollector = SafeCollector(collector = ) + safeCollector.invokeSafely(action = action) + } +) +} + +suspend fun FlowCollector.invokeSafely(action: @ExtensionFunctionType @ExtensionFunctionType SuspendFunction2, Throwable?, Unit>) { +} + +@OptIn(markerClass = [ExperimentalTypeInference::class]) +inline fun unsafeFlow(@BuilderInference crossinline block: @ExtensionFunctionType @ExtensionFunctionType SuspendFunction1, Unit>): Flow { + return TODO() +} + +@Deprecated(message = "binary compatibility with a version w/o FlowCollector receiver", level = DeprecationLevel.HIDDEN) +fun Flow.onCompletion(action: SuspendFunction1): ErrorType /* ERROR */ { + return error("") /* ERROR CALL */local fun () { + action.invoke(p1 = error("") /* ERROR CALL */) + } +; +} + +private fun CoroutineScope.asFairChannel(flow: Flow<*>): ReceiveChannel { + return .produce(block = local suspend fun ProducerScope.() { + val channel: ChannelCoroutine = .() as ChannelCoroutine + flow.collect(action = local suspend fun (value: Any?) { + return channel.sendFair(element = { // BLOCK + val : Any? = value + when { + EQEQ(arg0 = , arg1 = null) -> Any() + else -> /*as Any */ + } + }) + } +) + } +) +} + +private fun CoroutineScope.asChannel(flow: Flow<*>): ReceiveChannel { + return .produce(block = local suspend fun ProducerScope.() { + flow.collect(action = local suspend fun (value: Any?) { + return .().send(e = { // BLOCK + val : Any? = value + when { + EQEQ(arg0 = , arg1 = null) -> Any() + else -> /*as Any */ + } + }) + } +) + } +) +} + +class SafeCollector : FlowCollector { + constructor(collector: FlowCollector) /* primary */ { + super/*Any*/() + /* () */ + + } + + internal val collector: FlowCollector + field = collector + internal get + + override suspend fun emit(value: T) { + } + +} + +@OptIn(markerClass = [ExperimentalTypeInference::class]) +fun flow(@BuilderInference block: @ExtensionFunctionType @ExtensionFunctionType SuspendFunction1, Unit>): Flow { + return TODO() +} + +@OptIn(markerClass = [ExperimentalTypeInference::class]) +suspend fun flowScope(@BuilderInference block: @ExtensionFunctionType @ExtensionFunctionType SuspendFunction1): R { + return TODO() +} + +suspend inline fun Flow.collect(crossinline action: SuspendFunction1) { +} + +open class ChannelCoroutine { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + suspend fun sendFair(element: E) { + } + +} + +interface CoroutineScope { + +} + +interface Flow { + abstract suspend fun collect(collector: FlowCollector) + +} + +interface FlowCollector { + abstract suspend fun emit(value: T) + +} + +interface ReceiveChannel { + +} + +@OptIn(markerClass = [ExperimentalTypeInference::class]) +fun CoroutineScope.produce(@BuilderInference block: @ExtensionFunctionType @ExtensionFunctionType SuspendFunction1, Unit>): ReceiveChannel { + return TODO() +} + +interface ProducerScope : CoroutineScope, SendChannel { + abstract val channel: SendChannel + abstract get + +} + +interface SendChannel { + abstract suspend fun send(e: E) + +} diff --git a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.fir.kt.txt b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.fir.kt.txt new file mode 100644 index 00000000000..f7ebf840dfd --- /dev/null +++ b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.fir.kt.txt @@ -0,0 +1,145 @@ +class Value> { + constructor(value1: T, value2: IT) /* primary */ { + super/*Any*/() + /* () */ + + } + + var value1: T + field = value1 + get + set + + val value2: IT + field = value2 + get + +} + +interface IDelegate1 { + abstract operator fun getValue(t: T1, p: KProperty<*>): R1 + +} + +interface IDelegate2 { + abstract operator fun getValue(t: T2, p: KProperty<*>): R2 + +} + +interface IR { + abstract fun foo(): R + +} + +class CR : IR { + constructor(r: R) /* primary */ { + super/*Any*/() + /* () */ + + } + + val r: R + field = r + get + + override fun foo(): R { + return .() + } + +} + +class P { + constructor(p1: P1, p2: P2) /* primary */ { + super/*Any*/() + /* () */ + + } + + val p1: P1 + field = p1 + get + + val p2: P2 + field = p2 + get + +} + +val Value>.additionalText: P /* by */ + field = { // BLOCK + local class : IDelegate1>, P> { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + fun qux11(t: F11T): F11T { + return t + } + + fun > qux12(t: F12T): T { + return t.foo() + } + + private val Value>.deepO: T /* by */ + field = { // BLOCK + local class : IDelegate1>, T> { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + override operator fun getValue(t: Value>, p: KProperty<*>): T { + return t.() + } + + fun qux21(t: F21T): F21T { + return t + } + + fun > qux22(t: F22T): T { + return t.foo() + } + + } + + () + } + get(): T { + return .#deepO$delegate.getValue(t = , p = ::deepO) + } + + private val Value>.deepK: T /* by */ + field = { // BLOCK + local class : IDelegate1>, T> { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + override operator fun getValue(t: Value>, p: KProperty<*>): T { + return t.().foo() + } + + } + + () + } + get(): T { + return .#deepK$delegate.getValue(t = , p = ::deepK) + } + + override operator fun getValue(t: Value>, p: KProperty<*>): P { + return P(p1 = (, t).(), p2 = (, t).()) + } + + } + + () + } + get(): P { + return #additionalText$delegate.getValue(t = , p = ::additionalText/*()*/) + } diff --git a/compiler/testData/ir/irText/types/genericFunWithStar.fir.kt.txt b/compiler/testData/ir/irText/types/genericFunWithStar.fir.kt.txt new file mode 100644 index 00000000000..71bcaecd4ee --- /dev/null +++ b/compiler/testData/ir/irText/types/genericFunWithStar.fir.kt.txt @@ -0,0 +1,29 @@ +interface IBase { + +} + +interface IFoo : IBase { + +} + +interface IBar : IBase { + +} + +interface I where G : IFoo, G : IBar { + +} + +abstract class Box : IFoo, IBar where T : IFoo, T : IBar { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + abstract fun foo(tSerializer: I): I> where F : IFoo, F : IBar + fun bar(vararg serializers: I<*>): I<*> { + return .foo(tSerializer = serializers.get(index = 0)) + } + +} diff --git a/compiler/testData/ir/irText/types/genericPropertyReferenceType.fir.kt.txt b/compiler/testData/ir/irText/types/genericPropertyReferenceType.fir.kt.txt new file mode 100644 index 00000000000..4a847278e99 --- /dev/null +++ b/compiler/testData/ir/irText/types/genericPropertyReferenceType.fir.kt.txt @@ -0,0 +1,33 @@ +class C { + constructor(x: T) /* primary */ { + super/*Any*/() + /* () */ + + } + + var x: T + field = x + get + set + +} + +var C.y: T + get(): T { + return .() + } + set(v: T) { + .( = v) + } + +fun use(p: KMutableProperty) { +} + +fun test1() { + use(p = C(x = "abc")::y/*()*/) +} + +fun test2(a: Any) { + a as C /*~> Unit */ + use(p = a /*as C */::y/*()*/) +} diff --git a/compiler/testData/ir/irText/types/intersectionType1_NI.fir.kt.txt b/compiler/testData/ir/irText/types/intersectionType1_NI.fir.kt.txt new file mode 100644 index 00000000000..654a8722f94 --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType1_NI.fir.kt.txt @@ -0,0 +1,26 @@ +class In { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +fun select(x: S, y: S): S { + return x +} + +fun foo(a: Array>, b: Array>): Boolean { + return select>>(x = a, y = b).get(index = 0).ofType(y = true) +} + +inline fun In.ofType(y: Any?): Boolean { + return y is K +} + +fun test() { + val a1: Array> = arrayOf>(elements = [In()]) + val a2: Array> = arrayOf>(elements = [In()]) + foo(a = a1, b = a2) /*~> Unit */ +} diff --git a/compiler/testData/ir/irText/types/intersectionType1_OI.fir.kt.txt b/compiler/testData/ir/irText/types/intersectionType1_OI.fir.kt.txt new file mode 100644 index 00000000000..654a8722f94 --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType1_OI.fir.kt.txt @@ -0,0 +1,26 @@ +class In { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +fun select(x: S, y: S): S { + return x +} + +fun foo(a: Array>, b: Array>): Boolean { + return select>>(x = a, y = b).get(index = 0).ofType(y = true) +} + +inline fun In.ofType(y: Any?): Boolean { + return y is K +} + +fun test() { + val a1: Array> = arrayOf>(elements = [In()]) + val a2: Array> = arrayOf>(elements = [In()]) + foo(a = a1, b = a2) /*~> Unit */ +} diff --git a/compiler/testData/ir/irText/types/intersectionType2_NI.fir.kt.txt b/compiler/testData/ir/irText/types/intersectionType2_NI.fir.kt.txt new file mode 100644 index 00000000000..5c3a035fec9 --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType2_NI.fir.kt.txt @@ -0,0 +1,42 @@ +interface A { + +} + +interface Foo { + +} + +open class B : Foo, A { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +open class C : Foo, A { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +fun run(fn: Function0): T { + return fn.invoke() +} + +fun foo(): Any { + return run(fn = local fun (): Foo { + val mm: B = B() + val nn: C = C() + val c: Foo = when { + true -> mm + else -> nn + } + return c + } +) +} diff --git a/compiler/testData/ir/irText/types/intersectionType2_OI.fir.kt.txt b/compiler/testData/ir/irText/types/intersectionType2_OI.fir.kt.txt new file mode 100644 index 00000000000..5c3a035fec9 --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType2_OI.fir.kt.txt @@ -0,0 +1,42 @@ +interface A { + +} + +interface Foo { + +} + +open class B : Foo, A { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +open class C : Foo, A { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +fun run(fn: Function0): T { + return fn.invoke() +} + +fun foo(): Any { + return run(fn = local fun (): Foo { + val mm: B = B() + val nn: C = C() + val c: Foo = when { + true -> mm + else -> nn + } + return c + } +) +} diff --git a/compiler/testData/ir/irText/types/intersectionType3_NI.fir.kt.txt b/compiler/testData/ir/irText/types/intersectionType3_NI.fir.kt.txt new file mode 100644 index 00000000000..92532b9cf0f --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType3_NI.fir.kt.txt @@ -0,0 +1,63 @@ +interface In { + +} + +inline fun In.isT(): Boolean { + return is T +} + +inline fun In.asT() { + as T /*~> Unit */ +} + +fun sel(x: S, y: S): S { + return x +} + +interface A { + +} + +interface B { + +} + +interface A1 : A { + +} + +interface A2 : A { + +} + +interface Z1 : A, B { + +} + +interface Z2 : A, B { + +} + +fun testInIs1(x: In, y: In): Boolean { + return sel>(x = x, y = y).isT() +} + +fun testInIs2(x: In, y: In): Boolean { + return sel>(x = x, y = y).isT() +} + +fun testInIs3(x: In, y: In): Boolean { + return sel>(x = x, y = y).isT() +} + +fun testInAs1(x: In, y: In) { + return sel>(x = x, y = y).asT() +} + +fun testInAs2(x: In, y: In) { + return sel>(x = x, y = y).asT() +} + +fun testInAs3(x: In, y: In) { + return sel>(x = x, y = y).asT() +} diff --git a/compiler/testData/ir/irText/types/intersectionType3_OI.fir.kt.txt b/compiler/testData/ir/irText/types/intersectionType3_OI.fir.kt.txt new file mode 100644 index 00000000000..92532b9cf0f --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType3_OI.fir.kt.txt @@ -0,0 +1,63 @@ +interface In { + +} + +inline fun In.isT(): Boolean { + return is T +} + +inline fun In.asT() { + as T /*~> Unit */ +} + +fun sel(x: S, y: S): S { + return x +} + +interface A { + +} + +interface B { + +} + +interface A1 : A { + +} + +interface A2 : A { + +} + +interface Z1 : A, B { + +} + +interface Z2 : A, B { + +} + +fun testInIs1(x: In, y: In): Boolean { + return sel>(x = x, y = y).isT() +} + +fun testInIs2(x: In, y: In): Boolean { + return sel>(x = x, y = y).isT() +} + +fun testInIs3(x: In, y: In): Boolean { + return sel>(x = x, y = y).isT() +} + +fun testInAs1(x: In, y: In) { + return sel>(x = x, y = y).asT() +} + +fun testInAs2(x: In, y: In) { + return sel>(x = x, y = y).asT() +} + +fun testInAs3(x: In, y: In) { + return sel>(x = x, y = y).asT() +} diff --git a/compiler/testData/ir/irText/types/javaWildcardType.fir.kt.txt b/compiler/testData/ir/irText/types/javaWildcardType.fir.kt.txt new file mode 100644 index 00000000000..cf408d1cdea --- /dev/null +++ b/compiler/testData/ir/irText/types/javaWildcardType.fir.kt.txt @@ -0,0 +1,53 @@ +interface K { + abstract fun kf1(): Collection + abstract fun kf2(): Collection + abstract fun kg1(c: Collection) + abstract fun kg2(c: Collection) + +} + +class C : J, K { + constructor(j: J, k: K) /* primary */ { + super/*Any*/() + /* () */ + + .#<$$delegate_0> = j + .#<$$delegate_1> = k + } + + override fun jf1(): Collection? { + return .#<$$delegate_0>.jf1() + } + + override fun jf2(): Collection? { + return .#<$$delegate_0>.jf2() + } + + override fun jg1(c: Collection?) { + .#<$$delegate_0>.jg1(c = c) + } + + override fun jg2(c: Collection?) { + .#<$$delegate_0>.jg2(c = c) + } + + local /*final field*/ val <$$delegate_0>: J + override fun kf1(): Collection { + return .#<$$delegate_1>.kf1() + } + + override fun kf2(): Collection { + return .#<$$delegate_1>.kf2() + } + + override fun kg1(c: Collection) { + .#<$$delegate_1>.kg1(c = c) + } + + override fun kg2(c: Collection) { + .#<$$delegate_1>.kg2(c = c) + } + + local /*final field*/ val <$$delegate_1>: K + +} diff --git a/compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.fir.kt.txt b/compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.fir.kt.txt new file mode 100644 index 00000000000..b1cd9cd8e15 --- /dev/null +++ b/compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.fir.kt.txt @@ -0,0 +1,32 @@ +interface In { + +} + +interface Inv { + abstract val t: T + abstract get + +} + +interface Z { + abstract fun create(x: In, y: In): Inv + +} + +interface IA { + abstract fun foo() + +} + +interface IB { + abstract fun bar() + +} + +fun test(a: In, b: In, z: Z) { + z.create(x = a, y = b).().foo() + z.create(x = a, y = b).().bar() + val t: IA = z.create(x = a, y = b).() + t.foo() + t.bar() +} diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullability.fir.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullability.fir.kt.txt new file mode 100644 index 00000000000..a7dcb33a84d --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullability.fir.kt.txt @@ -0,0 +1,35 @@ +fun use(s: String) { +} + +fun testUse() { + use(s = notNullString() /*!! String */) +} + +fun testLocalVal() { + val local: String = notNullString() /*!! String */ +} + +fun testReturnValue(): String { + return notNullString() /*!! String */ +} + +val testGlobalVal: String + field = notNullString() /*!! String */ + get + +val testGlobalValGetter: String + get(): String { + return notNullString() /*!! String */ + } + +fun testJUse() { + use(s = nullString()) + use(s = notNullString()) +} + +fun testLocalVarUse() { + val ns: String? = nullString() + use(s = ns) + val nns: String = notNullString() /*!! String */ + use(s = nns) +} diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.fir.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.fir.kt.txt new file mode 100644 index 00000000000..e9c15dc1d1e --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.fir.kt.txt @@ -0,0 +1,87 @@ +fun use(x: Any, y: Any) { +} + +class P { + constructor(x: Int, y: Int) /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: Int + field = x + get + + val y: Int + field = y + get + + operator fun component1(): Int { + return .() + } + + operator fun component2(): Int { + return .() + } + +} + +class Q { + constructor(x: T1, y: T2) /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: T1 + field = x + get + + val y: T2 + field = y + get + + operator fun component1(): T1 { + return .() + } + + operator fun component2(): T2 { + return .() + } + +} + +fun test1() { + val : P = notNullP() /*!! P */ + val x: Int = .component1() + val y: Int = .component2() + use(x = x, y = y) +} + +fun test2() { + val : Q<@FlexibleNullability String, String?>? = notNullComponents() + val x: @FlexibleNullability String = .component1() + val y: String? = .component2() + use(x = x, y = y /*!! String */) +} + +fun test2Desugared() { + val tmp: Q<@FlexibleNullability String, String?>? = notNullComponents() + val x: @FlexibleNullability String = tmp.component1() + val y: String? = tmp.component2() + use(x = x, y = y /*!! String */) +} + +fun test3() { + val : Q<@FlexibleNullability String, String?> = notNullQAndComponents() /*!! Q<@FlexibleNullability String, String?> */ + val x: @FlexibleNullability String = .component1() + val y: String? = .component2() + use(x = x, y = y /*!! String */) +} + +fun test4() { + val : IndexedValue = listOfNotNull().withIndex().first>() + val x: Int = .component1() + val y: P? = .component2() + use(x = x, y = y /*!! P */) +} diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.kt.txt new file mode 100644 index 00000000000..d450046e42d --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.kt.txt @@ -0,0 +1,121 @@ +fun use(s: P) { +} + +fun testForInListUnused() { + { // BLOCK + val : MutableIterator = listOfNotNull().iterator() + while (.hasNext()) { // BLOCK + val x: P? = .next() + } + } +} + +fun testForInListDestructured() { + { // BLOCK + val : MutableIterator = listOfNotNull().iterator() + while (.hasNext()) { // BLOCK + val : P? = .next() + val x: Int = .component1() + val y: Int = .component2() + } + } +} + +fun testDesugaredForInList() { + val iterator: MutableIterator = listOfNotNull().iterator() + while (iterator.hasNext()) { // BLOCK + val x: P? = iterator.next() + } +} + +fun testForInArrayUnused(j: J) { + { // BLOCK + val : Iterator = j.arrayOfNotNull().iterator() + while (.hasNext()) { // BLOCK + val x: P? = .next() + } + } +} + +fun testForInListUse() { + { // BLOCK + val : MutableIterator = listOfNotNull().iterator() + while (.hasNext()) { // BLOCK + val x: P? = .next() + use(s = x /*!! P */) + use(s = x) + } + } +} + +fun testForInArrayUse(j: J) { + { // BLOCK + val : Iterator = j.arrayOfNotNull().iterator() + while (.hasNext()) { // BLOCK + val x: P? = .next() + use(s = x /*!! P */) + use(s = x) + } + } +} + +interface K { + abstract fun arrayOfNotNull(): Array

+ +} + +data class P { + constructor(x: Int, y: Int) /* primary */ { + super/*Any*/() + /* () */ + + } + + val x: Int + field = x + get + + val y: Int + field = y + get + + fun component1(): Int { + return .#x + } + + fun component2(): Int { + return .#y + } + + fun copy(x: Int = .#x, y: Int = .#y): P { + return P(x = x, y = y) + } + + override fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is P -> return false + } + val tmp0_other_with_cast: P = other as P + when { + EQEQ(arg0 = .#x, arg1 = tmp0_other_with_cast.#x).not() -> return false + } + when { + EQEQ(arg0 = .#y, arg1 = tmp0_other_with_cast.#y).not() -> return false + } + return true + } + + override fun hashCode(): Int { + var result: Int = .#x.hashCode() + result = result.times(other = 31).plus(other = .#y.hashCode()) + return result + } + + override fun toString(): String { + return "P(" + "x=" + .#x + ", " + "y=" + .#y + ")" + } + +} diff --git a/compiler/testData/ir/irText/types/nullChecks/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.fir.kt.txt b/compiler/testData/ir/irText/types/nullChecks/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.fir.kt.txt new file mode 100644 index 00000000000..32b0c63114c --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.fir.kt.txt @@ -0,0 +1,23 @@ +fun JavaClass.testPlatformEqualsPlatform(): Boolean { + return .null0().equals(other = .null0()) +} + +fun JavaClass.testPlatformEqualsKotlin(): Boolean { + return .null0().equals(other = 0.0D) +} + +fun JavaClass.testKotlinEqualsPlatform(): Boolean { + return 0.0D.equals(other = .null0()) +} + +fun JavaClass.testPlatformCompareToPlatform(): Int { + return .null0().compareTo(other = .null0() /*!! Double */) +} + +fun JavaClass.testPlatformCompareToKotlin(): Int { + return .null0().compareTo(other = 0.0D) +} + +fun JavaClass.testKotlinCompareToPlatform(): Int { + return 0.0D.compareTo(other = .null0() /*!! Double */) +} diff --git a/compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.fir.kt.txt b/compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.fir.kt.txt new file mode 100644 index 00000000000..cb7cf8d81b9 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/implicitNotNullOnPlatformType.fir.kt.txt @@ -0,0 +1,42 @@ +fun f(s: String) { +} + +class MySet : Set { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + override val size: Int + override get(): Int { + return TODO() + } + + override operator fun contains(element: String): Boolean { + return TODO() + } + + override fun containsAll(elements: Collection): Boolean { + return TODO() + } + + override fun isEmpty(): Boolean { + return TODO() + } + + override operator fun iterator(): Iterator { + return TODO() + } + +} + +fun test() { + f(s = s() /*!! String */) + f(s = #STRING /*!! String */) +} + +fun testContains(m: MySet) { + m.contains(element = #STRING /*!! String */) /*~> Unit */ + m.contains(element = "abc") /*~> Unit */ +} diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsT.fir.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsT.fir.kt.txt new file mode 100644 index 00000000000..98dece364c2 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsT.fir.kt.txt @@ -0,0 +1,10 @@ +fun useT(fn: Function0): T { + return fn.invoke() +} + +fun testNoNullCheck() { + useT(fn = local fun (): String? { + return string() + } +) /*~> Unit */ +} diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTAny.fir.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTAny.fir.kt.txt new file mode 100644 index 00000000000..c0ce810e64c --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTAny.fir.kt.txt @@ -0,0 +1,10 @@ +fun useTAny(fn: Function0): T { + return fn.invoke() +} + +fun testNoNullCheck() { + useTAny(fn = local fun (): String? { + return string() + } +) /*~> Unit */ +} diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTConstrained.fir.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTConstrained.fir.kt.txt new file mode 100644 index 00000000000..f32e62d9a75 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTConstrained.fir.kt.txt @@ -0,0 +1,10 @@ +fun useTConstrained(xs: Array, fn: Function0): T { + return fn.invoke() +} + +fun testWithNullCheck(xs: Array) { + useTConstrained(xs = xs, fn = local fun (): String { + return string() /*!! String */ + } +) /*~> Unit */ +} diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXArray.fir.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXArray.fir.kt.txt new file mode 100644 index 00000000000..ab0c1e2394d --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXArray.fir.kt.txt @@ -0,0 +1,10 @@ +fun useTX(x: T, fn: Function0): T { + return fn.invoke() +} + +fun testNoNullCheck(xs: Array) { + useTX(x = xs, fn = local fun (): String? { + return string() + } +) /*~> Unit */ +} diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXString.fir.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXString.fir.kt.txt new file mode 100644 index 00000000000..29ddc0f90e3 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnLambdaResult/stringVsTXString.fir.kt.txt @@ -0,0 +1,10 @@ +fun useTX(x: T, fn: Function0): T { + return fn.invoke() +} + +fun testNoNullCheck() { + useTX(x = "", fn = local fun (): String? { + return string() + } +) /*~> Unit */ +} diff --git a/compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.fir.kt.txt b/compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.fir.kt.txt new file mode 100644 index 00000000000..df7c948dfc6 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/nullabilityAssertionOnExtensionReceiver.fir.kt.txt @@ -0,0 +1,22 @@ +fun String.extension() { +} + +class C { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + fun String.memberExtension() { + } + +} + +fun testExt() { + s().extension() +} + +fun C.testMemberExt() { + (, s()).memberExtension() +} diff --git a/compiler/testData/ir/irText/types/nullChecks/platformTypeReceiver.fir.kt.txt b/compiler/testData/ir/irText/types/nullChecks/platformTypeReceiver.fir.kt.txt new file mode 100644 index 00000000000..69a464ef835 --- /dev/null +++ b/compiler/testData/ir/irText/types/nullChecks/platformTypeReceiver.fir.kt.txt @@ -0,0 +1,7 @@ +fun test1(): Boolean { + return #BOOL_NULL.equals(other = null) +} + +fun test2(): Boolean { + return boolNull().equals(other = null) +} diff --git a/compiler/testData/ir/irText/types/rawTypeInSignature.fir.kt.txt b/compiler/testData/ir/irText/types/rawTypeInSignature.fir.kt.txt new file mode 100644 index 00000000000..3494329f26d --- /dev/null +++ b/compiler/testData/ir/irText/types/rawTypeInSignature.fir.kt.txt @@ -0,0 +1,82 @@ +class GenericInv { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +class GenericIn { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +class GenericOut { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +fun testReturnsRawGenericInv(j: JRaw): GenericInv<*>? { + return j.returnsRawGenericInv() +} + +fun testReturnsRawGenericIn(j: JRaw): GenericIn? { + return j.returnsRawGenericIn() +} + +fun testReturnsRawGenericOut(j: JRaw): GenericOut<*>? { + return j.returnsRawGenericOut() +} + +class KRaw : JRaw { + constructor(j: JRaw) /* primary */ { + super/*Any*/() + /* () */ + + .#<$$delegate_0> = j + } + + override fun takesRawList(list: List<*>?) { + .#<$$delegate_0>.takesRawList(list = list) + } + + override fun returnsRawList(): List<*>? { + return .#<$$delegate_0>.returnsRawList() + } + + override fun takesRawGenericInv(g: GenericInv<*>?) { + .#<$$delegate_0>.takesRawGenericInv(g = g) + } + + override fun returnsRawGenericInv(): GenericInv<*>? { + return .#<$$delegate_0>.returnsRawGenericInv() + } + + override fun takesRawGenericIn(g: GenericIn?) { + .#<$$delegate_0>.takesRawGenericIn(g = g) + } + + override fun returnsRawGenericIn(): GenericIn? { + return .#<$$delegate_0>.returnsRawGenericIn() + } + + override fun takesRawGenericOut(g: GenericOut<*>?) { + .#<$$delegate_0>.takesRawGenericOut(g = g) + } + + override fun returnsRawGenericOut(): GenericOut<*>? { + return .#<$$delegate_0>.returnsRawGenericOut() + } + + local /*final field*/ val <$$delegate_0>: JRaw + +} diff --git a/compiler/testData/ir/irText/types/receiverOfIntersectionType.fir.kt.txt b/compiler/testData/ir/irText/types/receiverOfIntersectionType.fir.kt.txt new file mode 100644 index 00000000000..b646192135e --- /dev/null +++ b/compiler/testData/ir/irText/types/receiverOfIntersectionType.fir.kt.txt @@ -0,0 +1,60 @@ +interface K { + +} + +interface I : K { + abstract fun ff() + +} + +interface J : K { + +} + +class A : I, J { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + override fun ff() { + } + +} + +class B : I, J { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + override fun ff() { + } + +} + +fun testIntersection(a: A, b: B) { + val v: I = when { + true -> a + else -> b + } + v.ff() +} + +fun testFlexible1() { + val v: I? = when { + true -> a() + else -> b() + } + v.ff() +} + +fun testFlexible2(a: A, b: B) { + val v: I? = when { + true -> id(x = a) + else -> id(x = b) + } + v.ff() +} diff --git a/compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.fir.kt.txt b/compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.fir.kt.txt new file mode 100644 index 00000000000..afc88bcfc37 --- /dev/null +++ b/compiler/testData/ir/irText/types/smartCastOnFakeOverrideReceiver.fir.kt.txt @@ -0,0 +1,85 @@ +open class A { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + fun f(): Int { + return 1 + } + + val aVal: Int + field = 42 + get + + fun testA1(x: Any): Int? { + return when { + x is B -> x /*as B */.f() + else -> null + } + } + + fun testA2(x: Any): Int? { + return when { + x is B -> x /*as B */.() + else -> null + } + } + +} + +class B : A { + constructor() /* primary */ { + super/*A*/() + /* () */ + + } + + fun testB1(x: Any): Int? { + return when { + x is B -> x /*as B */.f() + else -> null + } + } + + fun testB2(x: Any): Int? { + return when { + x is B -> x /*as B */.() + else -> null + } + } + +} + +open class GA { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + fun f(): Int { + return 1 + } + + val aVal: Int + field = 42 + get + +} + +class GB : GA { + constructor() /* primary */ { + super/*GA*/() + /* () */ + + } + + fun testGB1(a: Any) { + a as GB /*~> Unit */ + a /*as GB */.f() /*~> Unit */ + a /*as GB */.() /*~> Unit */ + } + +} diff --git a/compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.fir.kt.txt b/compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.fir.kt.txt new file mode 100644 index 00000000000..9f4b5251168 --- /dev/null +++ b/compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.fir.kt.txt @@ -0,0 +1,10 @@ +fun testSetField(a: Any, b: Any) { + a as JCell /*~> Unit */ + b as String /*~> Unit */ + a /*as JCell */.#value = b /*as String */ +} + +fun testGetField(a: Any): String { + a as JCell /*~> Unit */ + return a /*as JCell */.#value /*!! String */ +} From f8690d0395c95c6a75f5d6ff42c7a054e23fbea8 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Mon, 23 Nov 2020 16:19:08 +0300 Subject: [PATCH 191/698] [IR] KotlinLikeDumper: minor, collapse an `if` to helper function and add few more todos --- .../src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt index c7ab1d2fc6d..afe83958e2e 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt @@ -27,7 +27,9 @@ class KotlinLikeDumpOptions( val printRegionsPerFile: Boolean = false, val printFileName: Boolean = true, val printFilePath: Boolean = true, + // TODO support val useNamedArguments: Boolean = false, + // TODO support val labelPrintingStrategy: LabelPrintingStrategy = LabelPrintingStrategy.NEVER, val printFakeOverridesStrategy: FakeOverridesStrategy = FakeOverridesStrategy.ALL, /* @@ -302,9 +304,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } private fun Variance.printVarianceWithNoIndent() { - if (this != Variance.INVARIANT) { - p.printWithNoIndent("$label ") - } + p(this, Variance.INVARIANT) { label } } private fun IrAnnotationContainer.printAnnotationsWithNoIndent() { @@ -967,6 +967,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption ) { // TODO flag to omit comment block? val delegatingClass = symbol.owner.parentAsClass + // TODO don't crash when parent isn't class val currentClass = data?.parentAsClass val delegatingClassName = delegatingClass.name.asString() From ef9a90163555793351f1bff2430a121e1d9d556d Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Mon, 23 Nov 2020 20:38:32 +0300 Subject: [PATCH 192/698] [IR] KotlinLikeDumper: unify representation for error nodes --- .../src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt index afe83958e2e..14a28212170 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt @@ -389,7 +389,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption is IrDynamicType -> p.printWithNoIndent("dynamic") is IrErrorType -> - p.printWithNoIndent("ErrorType /* ERROR */") + p.printWithNoIndent("ErrorType") else -> p.printWithNoIndent("??? /* ERROR: unknown type: ${this.javaClass.simpleName} */") } @@ -1339,18 +1339,18 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption override fun visitErrorDeclaration(declaration: IrErrorDeclaration, data: IrDeclaration?) { // TODO declaration.printlnAnnotations() - p.println("/* ERROR DECLARATION */") + p.println("/* ErrorDeclaration */") } override fun visitErrorExpression(expression: IrErrorExpression, data: IrDeclaration?) { // TODO description - p.printWithNoIndent("error(\"\") /* ERROR EXPRESSION */") + p.printWithNoIndent("error(\"\") /* ErrorExpression */") } override fun visitErrorCallExpression(expression: IrErrorCallExpression, data: IrDeclaration?) { // TODO description // TODO better rendering - p.printWithNoIndent("error(\"\") /* ERROR CALL */") + p.printWithNoIndent("error(\"\") /* ErrorCallExpression */") expression.explicitReceiver?.let { it.accept(this, data) p.printWithNoIndent("; ") From 7df6575a183a78a8211071212bcec87fdf5c8a58 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Mon, 23 Nov 2020 20:45:10 +0300 Subject: [PATCH 193/698] [IR] update testdata: unify representation for error nodes --- .../useNextParamInLambda.fir.kt.txt | 5 +++-- .../errors/unresolvedReference.fir.kt.txt | 17 +++++++++-------- .../irText/errors/unresolvedReference.kt.txt | 16 ++++++++-------- .../expressions/badBreakContinue.fir.kt.txt | 13 +++++++------ .../expressions/badBreakContinue.kt.txt | 16 ++++++++-------- .../caoWithAdaptationForSam.fir.kt.txt | 5 +++-- .../ir/irText/expressions/kt24804.fir.kt.txt | 3 ++- .../ir/irText/expressions/kt36963.kt.txt | 2 +- .../irText/expressions/lambdaInCAO.fir.kt.txt | 3 ++- .../arrayAsVarargAfterSamArgument.fir.kt.txt | 19 ++++++++++--------- .../samConversionsWithSmartCasts.fir.kt.txt | 5 +++-- ...ignedToUnsignedConversions_test.fir.kt.txt | 15 ++++++++------- .../whenWithSubjectVariable.fir.kt.txt | 5 +++-- .../castsInsideCoroutineInference.fir.kt.txt | 11 ++++++----- 14 files changed, 73 insertions(+), 62 deletions(-) diff --git a/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.fir.kt.txt b/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.fir.kt.txt index ff26f4f0234..08edbffa382 100644 --- a/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.fir.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.fir.kt.txt @@ -1,5 +1,5 @@ -fun f(f1: Function0 = local fun (): ErrorType /* ERROR */ { - return error("") /* ERROR CALL */ +fun f(f1: Function0 = local fun (): ErrorType { + return error("") /* ErrorCallExpression */ } , f2: Function0 = local fun (): String { return "FAIL" @@ -23,3 +23,4 @@ fun box(): String { } )) } + diff --git a/compiler/testData/ir/irText/errors/unresolvedReference.fir.kt.txt b/compiler/testData/ir/irText/errors/unresolvedReference.fir.kt.txt index 6194e780b11..9f1140cad40 100644 --- a/compiler/testData/ir/irText/errors/unresolvedReference.fir.kt.txt +++ b/compiler/testData/ir/irText/errors/unresolvedReference.fir.kt.txt @@ -1,15 +1,16 @@ -val test1: ErrorType /* ERROR */ - field = error("") /* ERROR CALL */ +val test1: ErrorType + field = error("") /* ErrorCallExpression */ get -val test2: ErrorType /* ERROR */ - field = error("") /* ERROR CALL */ +val test2: ErrorType + field = error("") /* ErrorCallExpression */ get -val test3: ErrorType /* ERROR */ - field = error("") /* ERROR CALL */56; +val test3: ErrorType + field = error("") /* ErrorCallExpression */56; get -val test4: ErrorType /* ERROR */ - field = error("") /* ERROR CALL */error("") /* ERROR EXPRESSION */; +val test4: ErrorType + field = error("") /* ErrorCallExpression */error("") /* ErrorExpression */; get + diff --git a/compiler/testData/ir/irText/errors/unresolvedReference.kt.txt b/compiler/testData/ir/irText/errors/unresolvedReference.kt.txt index f618965774b..08b6fef48b5 100644 --- a/compiler/testData/ir/irText/errors/unresolvedReference.kt.txt +++ b/compiler/testData/ir/irText/errors/unresolvedReference.kt.txt @@ -1,16 +1,16 @@ -val test1: ErrorType /* ERROR */ - field = error("") /* ERROR CALL */ +val test1: ErrorType + field = error("") /* ErrorCallExpression */ get -val test2: ErrorType /* ERROR */ - field = error("") /* ERROR CALL */ +val test2: ErrorType + field = error("") /* ErrorCallExpression */ get -val test3: ErrorType /* ERROR */ - field = error("") /* ERROR CALL */42; 56; +val test3: ErrorType + field = error("") /* ErrorCallExpression */42; 56; get -val test4: ErrorType /* ERROR */ - field = error("") /* ERROR EXPRESSION */ +val test4: ErrorType + field = error("") /* ErrorExpression */ get diff --git a/compiler/testData/ir/irText/expressions/badBreakContinue.fir.kt.txt b/compiler/testData/ir/irText/expressions/badBreakContinue.fir.kt.txt index 64d184dc86f..68b59c5774b 100644 --- a/compiler/testData/ir/irText/expressions/badBreakContinue.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/badBreakContinue.fir.kt.txt @@ -1,12 +1,12 @@ fun test1() { - error("") /* ERROR EXPRESSION */ - error("") /* ERROR EXPRESSION */ + error("") /* ErrorExpression */ + error("") /* ErrorExpression */ } fun test2() { L1@ while (true) { // BLOCK - error("") /* ERROR EXPRESSION */ - error("") /* ERROR EXPRESSION */ + error("") /* ErrorExpression */ + error("") /* ErrorExpression */ } } @@ -21,8 +21,9 @@ fun test3() { } fun test4() { - while (error("") /* ERROR EXPRESSION */) { // BLOCK + while (error("") /* ErrorExpression */) { // BLOCK } - while (error("") /* ERROR EXPRESSION */) { // BLOCK + while (error("") /* ErrorExpression */) { // BLOCK } } + diff --git a/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt b/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt index 4171a8d0714..61259595601 100644 --- a/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt +++ b/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt @@ -1,29 +1,29 @@ fun test1() { - error("") /* ERROR EXPRESSION */ - error("") /* ERROR EXPRESSION */ + error("") /* ErrorExpression */ + error("") /* ErrorExpression */ } fun test2() { L1@ while (true) { // BLOCK - error("") /* ERROR EXPRESSION */ - error("") /* ERROR EXPRESSION */ + error("") /* ErrorExpression */ + error("") /* ErrorExpression */ } } fun test3() { L1@ while (true) { // BLOCK val lambda: Function0 = local fun (): Nothing { - error("") /* ERROR EXPRESSION */ - error("") /* ERROR EXPRESSION */ + error("") /* ErrorExpression */ + error("") /* ErrorExpression */ } } } fun test4() { - while (error("") /* ERROR EXPRESSION */) { // BLOCK + while (error("") /* ErrorExpression */) { // BLOCK } - while (error("") /* ERROR EXPRESSION */) { // BLOCK + while (error("") /* ErrorExpression */) { // BLOCK } } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.fir.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.fir.kt.txt index 21a1418b094..e5e4428a590 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.fir.kt.txt @@ -47,7 +47,7 @@ fun test1() { { // BLOCK val <>: A = A val <>: KFunction1 = ::withVararg - error("") /* ERROR CALL */<>; error("") /* ERROR CALL */<>; .plus(other = 1); + error("") /* ErrorCallExpression */<>; error("") /* ErrorCallExpression */<>; .plus(other = 1); } } @@ -55,7 +55,7 @@ fun test2() { { // BLOCK val <>: B = B val <>: KFunction1 = ::withVararg - error("") /* ERROR CALL */<>; error("") /* ERROR CALL */<>; .plus(other = 1); + error("") /* ErrorCallExpression */<>; error("") /* ErrorCallExpression */<>; .plus(other = 1); } } @@ -95,3 +95,4 @@ fun test6(a: Any) { <>.set(i = <>, newValue = <>.get(i = <>).plus(other = 1)) } } + diff --git a/compiler/testData/ir/irText/expressions/kt24804.fir.kt.txt b/compiler/testData/ir/irText/expressions/kt24804.fir.kt.txt index 509317c8937..c2d80af741b 100644 --- a/compiler/testData/ir/irText/expressions/kt24804.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt24804.fir.kt.txt @@ -10,7 +10,7 @@ fun run(x: Boolean, y: Boolean): String { greater(arg0 = z, arg1 = 100) -> return "NOT_OK" } when { - x -> error("") /* ERROR EXPRESSION */ + x -> error("") /* ErrorExpression */ } when { y -> continue@l2 @@ -22,3 +22,4 @@ fun run(x: Boolean, y: Boolean): String { fun box(): String { return run(x = true, y = true) } + diff --git a/compiler/testData/ir/irText/expressions/kt36963.kt.txt b/compiler/testData/ir/irText/expressions/kt36963.kt.txt index 3e01d5be37d..ffb3b8a04d3 100644 --- a/compiler/testData/ir/irText/expressions/kt36963.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt36963.kt.txt @@ -1,7 +1,7 @@ fun foo() { } -fun test(): ErrorType /* ERROR */ { +fun test(): ErrorType { return CHECK_NOT_NULL>(arg0 = ::foo) } diff --git a/compiler/testData/ir/irText/expressions/lambdaInCAO.fir.kt.txt b/compiler/testData/ir/irText/expressions/lambdaInCAO.fir.kt.txt index f6c877506fb..d1f0b5ede72 100644 --- a/compiler/testData/ir/irText/expressions/lambdaInCAO.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/lambdaInCAO.fir.kt.txt @@ -16,7 +16,7 @@ fun test1(a: Any) { } fun test2(a: Any) { - error("") /* ERROR CALL */ + error("") /* ErrorCallExpression */ } fun test3(a: Any) { @@ -29,3 +29,4 @@ fun test3(a: Any) { .set(index = , value = .inc()) /*~> Unit */ } + diff --git a/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.fir.kt.txt b/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.fir.kt.txt index 77f1971f85c..a5a20b12083 100644 --- a/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.fir.kt.txt @@ -1,5 +1,5 @@ fun test(fn: Function0, r: Runnable, arr: Array) { - error("") /* ERROR CALL */local fun () { + error("") /* ErrorCallExpression */local fun () { return Unit } ; arr; @@ -7,13 +7,13 @@ fun test(fn: Function0, r: Runnable, arr: Array) { return Unit } /*-> Runnable? */, strs = [*arr]) /*~> Unit */ - error("") /* ERROR CALL */fn; arr; + error("") /* ErrorCallExpression */fn; arr; foo1(r = fn /*-> Runnable? */, strs = [*arr]) /*~> Unit */ foo1(r = r, strs = [""]) /*~> Unit */ - error("") /* ERROR CALL */fn; arr; + error("") /* ErrorCallExpression */fn; arr; foo1(r = fn /*-> Runnable? */, strs = [*arr]) /*~> Unit */ foo1(r = r, strs = [*arr]) /*~> Unit */ - val i1: ErrorType /* ERROR */ = error("") /* ERROR CALL */local fun () { + val i1: ErrorType = error("") /* ErrorCallExpression */local fun () { return Unit } ; arr; @@ -21,7 +21,7 @@ fun test(fn: Function0, r: Runnable, arr: Array) { return Unit } /*-> Runnable? */, strs = [*arr]) - val i3: ErrorType /* ERROR */ = error("") /* ERROR CALL */local fun () { + val i3: ErrorType = error("") /* ErrorCallExpression */local fun () { return Unit } ; local fun () { @@ -43,26 +43,27 @@ fun test(fn: Function0, r: Runnable, arr: Array) { return Unit } /*-> Runnable? */, strs = [*arr]) - error("") /* ERROR CALL */local fun () { + error("") /* ErrorCallExpression */local fun () { return Unit } ; local fun () { return Unit } ; arr; - error("") /* ERROR CALL */r; local fun () { + error("") /* ErrorCallExpression */r; local fun () { return Unit } ; ""; - error("") /* ERROR CALL */local fun () { + error("") /* ErrorCallExpression */local fun () { return Unit } ; local fun () { return Unit } ; arr; - error("") /* ERROR CALL */r; local fun () { + error("") /* ErrorCallExpression */r; local fun () { return Unit } ; arr; } + diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.fir.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.fir.kt.txt index cf210020075..ee1b3d61c77 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.fir.kt.txt @@ -44,13 +44,14 @@ fun test6(a: Any) { fun test7(a: Function1) { a as Function0 /*~> Unit */ - error("") /* ERROR CALL */a /*as Function0 */; + error("") /* ErrorCallExpression */a /*as Function0 */; } fun test8(a: Function0) { - error("") /* ERROR CALL */id?>(x = a); + error("") /* ErrorCallExpression */id?>(x = a); } fun test9() { J().run1(r = ::test9 /*-> Runnable? */) } + diff --git a/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.fir.kt.txt b/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.fir.kt.txt index 04c0939354d..49dbb8c9740 100644 --- a/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.fir.kt.txt @@ -47,11 +47,12 @@ fun takeLong(@ImplicitIntegerCoercion l: Long) { } fun test() { - error("") /* ERROR CALL */255; - error("") /* ERROR CALL */255; - error("") /* ERROR CALL */255; - error("") /* ERROR CALL */256; - error("") /* ERROR CALL */255; - error("") /* ERROR CALL */255; - error("") /* ERROR CALL */255; 255; 42; + error("") /* ErrorCallExpression */255; + error("") /* ErrorCallExpression */255; + error("") /* ErrorCallExpression */255; + error("") /* ErrorCallExpression */256; + error("") /* ErrorCallExpression */255; + error("") /* ErrorCallExpression */255; + error("") /* ErrorCallExpression */255; 255; 42; } + diff --git a/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.fir.kt.txt b/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.fir.kt.txt index 8a108d7366d..039a6f4f044 100644 --- a/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.fir.kt.txt @@ -9,9 +9,10 @@ fun test(): Int { EQEQ(arg0 = y, arg1 = 42) -> 1 y is String -> y /*as String */.() y !is Int -> 2 - error("") /* ERROR CALL */y; -> 3 - error("") /* ERROR CALL */y; .not() -> 4 + error("") /* ErrorCallExpression */y; -> 3 + error("") /* ErrorCallExpression */y; .not() -> 4 else -> -1 } } } + diff --git a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.kt.txt b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.kt.txt index 7613c9da99e..5d56f89742b 100644 --- a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.kt.txt +++ b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.kt.txt @@ -1,7 +1,7 @@ @OptIn(markerClass = [ExperimentalTypeInference::class]) fun scopedFlow(@BuilderInference block: @ExtensionFunctionType @ExtensionFunctionType SuspendFunction2, Unit>): Flow { return flow(block = local suspend fun FlowCollector.() { - val collector: FlowCollector = + val collector: FlowCollector = flowScope(block = local suspend fun CoroutineScope.() { block.invoke(p1 = , p2 = collector) } @@ -12,7 +12,7 @@ fun scopedFlow(@BuilderInference block: @ExtensionFunctionType @Exten fun Flow.onCompletion(action: @ExtensionFunctionType @ExtensionFunctionType SuspendFunction2, Throwable?, Unit>): Flow { return unsafeFlow(block = local suspend fun FlowCollector.() { - val safeCollector: SafeCollector = SafeCollector(collector = ) + val safeCollector: SafeCollector = SafeCollector(collector = ) safeCollector.invokeSafely(action = action) } ) @@ -27,9 +27,9 @@ inline fun unsafeFlow(@BuilderInference crossinline block: @Extension } @Deprecated(message = "binary compatibility with a version w/o FlowCollector receiver", level = DeprecationLevel.HIDDEN) -fun Flow.onCompletion(action: SuspendFunction1): ErrorType /* ERROR */ { - return error("") /* ERROR CALL */local fun () { - action.invoke(p1 = error("") /* ERROR CALL */) +fun Flow.onCompletion(action: SuspendFunction1): ErrorType { + return error("") /* ErrorCallExpression */local fun () { + action.invoke(p1 = error("") /* ErrorCallExpression */) } ; } @@ -141,3 +141,4 @@ interface SendChannel { abstract suspend fun send(e: E) } + From 73771a35134274279a1263f6701138a4b151e8fe Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Mon, 23 Nov 2020 20:46:05 +0300 Subject: [PATCH 194/698] [IR] KotlinLikeDumper: don't use "D" suffix on double constants --- .../ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt index 14a28212170..5eaf51ba059 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt @@ -1101,7 +1101,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption is IrConstKind.Long -> "" to "L" is IrConstKind.String -> "\"" to "\"" is IrConstKind.Float -> "" to "F" - is IrConstKind.Double -> "" to "D" + is IrConstKind.Double -> "" to "" } val value = expression.value.toString() From 57cb8f97e9968b3b9fd94ce4c2dee07e4aa27318 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Mon, 23 Nov 2020 20:46:19 +0300 Subject: [PATCH 195/698] [IR] update testdata: don't use "D" suffix on double constants --- compiler/testData/ir/irText/classes/kt43217.fir.kt.txt | 5 +++-- compiler/testData/ir/irText/classes/kt43217.kt.txt | 4 ++-- .../whenByFloatingPoint.fir.kt.txt | 7 ++++--- .../floatingPointComparisons/whenByFloatingPoint.kt.txt | 6 +++--- .../testData/ir/irText/expressions/literals.fir.kt.txt | 5 +++-- compiler/testData/ir/irText/expressions/literals.kt.txt | 4 ++-- ...alsAndCompareToCallsOnPlatformTypeReceiver.fir.kt.txt | 9 +++++---- ...tEqualsAndCompareToCallsOnPlatformTypeReceiver.kt.txt | 8 ++++---- 8 files changed, 26 insertions(+), 22 deletions(-) diff --git a/compiler/testData/ir/irText/classes/kt43217.fir.kt.txt b/compiler/testData/ir/irText/classes/kt43217.fir.kt.txt index bd07aa4c60f..867a43b41d9 100644 --- a/compiler/testData/ir/irText/classes/kt43217.fir.kt.txt +++ b/compiler/testData/ir/irText/classes/kt43217.fir.kt.txt @@ -15,7 +15,7 @@ class A { } override operator fun get(): Double { - return 0.0D + return 0.0 } } @@ -34,7 +34,8 @@ class C : DoubleExpression { } override operator fun get(): Double { - return 0.0D + return 0.0 } } + diff --git a/compiler/testData/ir/irText/classes/kt43217.kt.txt b/compiler/testData/ir/irText/classes/kt43217.kt.txt index a094ba43c2d..9c1b3171d8e 100644 --- a/compiler/testData/ir/irText/classes/kt43217.kt.txt +++ b/compiler/testData/ir/irText/classes/kt43217.kt.txt @@ -15,7 +15,7 @@ class A { } override fun get(): Double { - return 0.0D + return 0.0 } } @@ -34,7 +34,7 @@ class C : DoubleExpression { } override fun get(): Double { - return 0.0D + return 0.0 } } diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.fir.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.fir.kt.txt index da3ff7b2233..a9f40419156 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.fir.kt.txt @@ -2,7 +2,7 @@ fun testSimple(x: Double): Int { return { // BLOCK val tmp0_subject: Double = x when { - ieee754equals(arg0 = tmp0_subject, arg1 = 0.0D) -> 0 + ieee754equals(arg0 = tmp0_subject, arg1 = 0.0) -> 0 else -> 1 } } @@ -15,7 +15,7 @@ fun testSmartCastInWhenSubject(x: Any): Int { return { // BLOCK val tmp1_subject: Double = x /*as Double */ when { - ieee754equals(arg0 = tmp1_subject, arg1 = 0.0D) -> 0 + ieee754equals(arg0 = tmp1_subject, arg1 = 0.0) -> 0 else -> 1 } } @@ -39,7 +39,7 @@ fun testSmartCastInWhenConditionInBranch(x: Any): Int { val tmp3_subject: Any = x when { tmp3_subject !is Double -> -1 - EQEQ(arg0 = tmp3_subject, arg1 = 0.0D) -> 0 + EQEQ(arg0 = tmp3_subject, arg1 = 0.0) -> 0 else -> 1 } } @@ -77,3 +77,4 @@ fun testWithPrematureExitInConditionSubexpression(x: Any): Int { } } } + diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.kt.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.kt.txt index 841c8610186..61db3d39f9f 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.kt.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.kt.txt @@ -2,7 +2,7 @@ fun testSimple(x: Double): Int { return { // BLOCK val tmp0_subject: Double = x when { - ieee754equals(arg0 = tmp0_subject, arg1 = 0.0D) -> 0 + ieee754equals(arg0 = tmp0_subject, arg1 = 0.0) -> 0 else -> 1 } } @@ -15,7 +15,7 @@ fun testSmartCastInWhenSubject(x: Any): Int { return { // BLOCK val tmp0_subject: Any = x when { - ieee754equals(arg0 = tmp0_subject /*as Double */, arg1 = 0.0D) -> 0 + ieee754equals(arg0 = tmp0_subject /*as Double */, arg1 = 0.0) -> 0 else -> 1 } } @@ -39,7 +39,7 @@ fun testSmartCastInWhenConditionInBranch(x: Any): Int { val tmp0_subject: Any = x when { tmp0_subject is Double.not() -> -1 - ieee754equals(arg0 = tmp0_subject /*as Double */, arg1 = 0.0D) -> 0 + ieee754equals(arg0 = tmp0_subject /*as Double */, arg1 = 0.0) -> 0 else -> 1 } } diff --git a/compiler/testData/ir/irText/expressions/literals.fir.kt.txt b/compiler/testData/ir/irText/expressions/literals.fir.kt.txt index 253306edf33..a9c139c87af 100644 --- a/compiler/testData/ir/irText/expressions/literals.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/literals.fir.kt.txt @@ -31,11 +31,11 @@ val test8: Long get val test9: Double - field = 1.0D + field = 1.0 get val test10: Double - field = 1.0D.unaryMinus() + field = 1.0.unaryMinus() get val test11: Float @@ -65,3 +65,4 @@ val testI: Int val testL: Long field = 1L get + diff --git a/compiler/testData/ir/irText/expressions/literals.kt.txt b/compiler/testData/ir/irText/expressions/literals.kt.txt index 45e61a98908..db5b57cdd43 100644 --- a/compiler/testData/ir/irText/expressions/literals.kt.txt +++ b/compiler/testData/ir/irText/expressions/literals.kt.txt @@ -31,11 +31,11 @@ val test8: Long get val test9: Double - field = 1.0D + field = 1.0 get val test10: Double - field = -1.0D + field = -1.0 get val test11: Float diff --git a/compiler/testData/ir/irText/types/nullChecks/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.fir.kt.txt b/compiler/testData/ir/irText/types/nullChecks/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.fir.kt.txt index 32b0c63114c..4985c2b163c 100644 --- a/compiler/testData/ir/irText/types/nullChecks/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.fir.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.fir.kt.txt @@ -3,11 +3,11 @@ fun JavaClass.testPlatformEqualsPlatform(): Boolean { } fun JavaClass.testPlatformEqualsKotlin(): Boolean { - return .null0().equals(other = 0.0D) + return .null0().equals(other = 0.0) } fun JavaClass.testKotlinEqualsPlatform(): Boolean { - return 0.0D.equals(other = .null0()) + return 0.0.equals(other = .null0()) } fun JavaClass.testPlatformCompareToPlatform(): Int { @@ -15,9 +15,10 @@ fun JavaClass.testPlatformCompareToPlatform(): Int { } fun JavaClass.testPlatformCompareToKotlin(): Int { - return .null0().compareTo(other = 0.0D) + return .null0().compareTo(other = 0.0) } fun JavaClass.testKotlinCompareToPlatform(): Int { - return 0.0D.compareTo(other = .null0() /*!! Double */) + return 0.0.compareTo(other = .null0() /*!! Double */) } + diff --git a/compiler/testData/ir/irText/types/nullChecks/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.kt.txt b/compiler/testData/ir/irText/types/nullChecks/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.kt.txt index a81b1bde5ee..2abfe883553 100644 --- a/compiler/testData/ir/irText/types/nullChecks/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.kt.txt @@ -3,11 +3,11 @@ fun JavaClass.testPlatformEqualsPlatform(): Boolean { } fun JavaClass.testPlatformEqualsKotlin(): Boolean { - return .null0() /*!! Double */.equals(other = 0.0D) + return .null0() /*!! Double */.equals(other = 0.0) } fun JavaClass.testKotlinEqualsPlatform(): Boolean { - return 0.0D.equals(other = .null0()) + return 0.0.equals(other = .null0()) } fun JavaClass.testPlatformCompareToPlatform(): Int { @@ -15,10 +15,10 @@ fun JavaClass.testPlatformCompareToPlatform(): Int { } fun JavaClass.testPlatformCompareToKotlin(): Int { - return .null0() /*!! Double */.compareTo(other = 0.0D) + return .null0() /*!! Double */.compareTo(other = 0.0) } fun JavaClass.testKotlinCompareToPlatform(): Int { - return 0.0D.compareTo(other = .null0() /*!! Double */) + return 0.0.compareTo(other = .null0() /*!! Double */) } From 90fdfbde68d8fdf103f2e5e0720b71bc504bc837 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Mon, 23 Nov 2020 21:41:14 +0300 Subject: [PATCH 196/698] [IR] KotlinLikeDumper: unify printing custom/non-standard modifiers --- .../kotlin/ir/util/dumpKotlinLike.kt | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt index 5eaf51ba059..11acec88d76 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt @@ -235,7 +235,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } p(modality, defaultModality) { name.toLowerCase() } p(isExternal, "external") - p(isFakeOverride, "fake") + p(isFakeOverride, customModifier("fake")) p(isOverride, "override") p(isLateinit, "lateinit") p(isTailrec, "tailrec") @@ -272,8 +272,8 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p(isVararg, "vararg") p(isCrossinline, "crossinline") p(isNoinline, "noinline") - p(isHidden, "hidden") - p(isAssignable, "var") + p(isHidden, customModifier("hidden")) + p(isAssignable, customModifier("var")) } private fun IrTypeParametersContainer.printTypeParametersWithNoIndent(postfix: String = "") { @@ -436,7 +436,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printIndent() // TODO no tests, looks like there are no irText tests for isStatic flag - p(declaration.isStatic, commentBlock("static")) + p(declaration.isStatic, customModifier("static")) p.printWithNoIndent("init ") declaration.body.accept(this, declaration) @@ -491,7 +491,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption declaration.printValueParametersWithNoIndent() declaration.printWhereClauseIfNeededWithNoIndent() p.printWithNoIndent(" ") - p(declaration.isPrimary, commentBlock("primary")) + p(declaration.isPrimary, customModifier("primary")) declaration.body?.accept(this, declaration) p.printlnWithNoIndent() } @@ -733,10 +733,12 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } if (declaration.isStatic || declaration.isFinal) { - p.printWithNoIndent("/*") + p.printWithNoIndent(CUSTOM_MODIFIER_START) p(declaration.isStatic, "static") p(declaration.isFinal, "final") - p.printWithNoIndent("field*/ ") + p.printWithNoIndent("field") + p.printWithNoIndent(CUSTOM_MODIFIER_END) + p.printWithNoIndent(" ") } p.printWithNoIndent(if (declaration.isFinal) "val " else "var ") @@ -1384,8 +1386,16 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption private fun commentBlock(text: String) = "/* $text */" + // TODO it's not valid kotlin unless it's commented + // ^^^ it's applied to all usages of this function + private fun customModifier(text: String): String { + return CUSTOM_MODIFIER_START + text + CUSTOM_MODIFIER_END + } + private companion object { private const val INAPPLICABLE = false private val INAPPLICABLE_N = null + private const val CUSTOM_MODIFIER_START = "/* " + private const val CUSTOM_MODIFIER_END = " */" } } From 69f0f4ef190634a21f1c305feb611e70fc84805e Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Mon, 23 Nov 2020 23:46:22 +0300 Subject: [PATCH 197/698] [IR] update testdata: unify printing custom/non-standard modifiers --- .../classes/delegatedGenericImplementation.fir.kt.txt | 5 +++-- .../classes/delegatedGenericImplementation.kt.txt | 4 ++-- .../irText/classes/delegatedImplementation.fir.kt.txt | 7 ++++--- .../ir/irText/classes/delegatedImplementation.kt.txt | 6 +++--- .../delegatedImplementationOfJavaInterface.fir.kt.txt | 3 ++- ...gatedImplementationWithExplicitOverride.fir.kt.txt | 3 ++- ...delegatedImplementationWithExplicitOverride.kt.txt | 2 +- ...mplicitNotNullOnDelegatedImplementation.fir.kt.txt | 11 ++++++----- .../implicitNotNullOnDelegatedImplementation.kt.txt | 10 +++++----- .../annotationsOnDelegatedMembers.fir.kt.txt | 3 ++- .../annotations/annotationsOnDelegatedMembers.kt.txt | 2 +- .../annotations/inheritingDeprecation.fir.kt.txt | 3 ++- .../annotations/inheritingDeprecation.kt.txt | 2 +- .../ir/irText/declarations/kt35550.fir.kt.txt | 3 ++- .../testData/ir/irText/declarations/kt35550.kt.txt | 2 +- .../parameters/delegatedMembers.fir.kt.txt | 3 ++- .../declarations/parameters/delegatedMembers.kt.txt | 2 +- .../DelegationAndInheritanceFromJava.fir.kt.txt | 3 ++- .../DelegationAndInheritanceFromJava.kt.txt | 2 +- .../ir/irText/firProblems/SignatureClash.fir.kt.txt | 3 ++- .../ir/irText/types/javaWildcardType.fir.kt.txt | 5 +++-- .../testData/ir/irText/types/javaWildcardType.kt.txt | 4 ++-- .../ir/irText/types/rawTypeInSignature.fir.kt.txt | 3 ++- .../ir/irText/types/rawTypeInSignature.kt.txt | 2 +- 24 files changed, 53 insertions(+), 40 deletions(-) diff --git a/compiler/testData/ir/irText/classes/delegatedGenericImplementation.fir.kt.txt b/compiler/testData/ir/irText/classes/delegatedGenericImplementation.fir.kt.txt index 12ed623bf64..4861e83dbf8 100644 --- a/compiler/testData/ir/irText/classes/delegatedGenericImplementation.fir.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedGenericImplementation.fir.kt.txt @@ -34,7 +34,7 @@ class Test1 : IBase { (.#<$$delegate_0>, ).( = ) } - local /*final field*/ val <$$delegate_0>: IBase + local /* final field */ val <$$delegate_0>: IBase } @@ -68,6 +68,7 @@ class Test2 : IBase { (.#<$$delegate_0>, ).( = ) } - local /*final field*/ val <$$delegate_0>: IBase + local /* final field */ val <$$delegate_0>: IBase } + diff --git a/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt b/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt index ff81bef42ff..6b1ef416e02 100644 --- a/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt.txt @@ -16,7 +16,7 @@ class Test1 : IBase { } - private /*final field*/ val $$delegate_0: IBase = i + private /* final field */ val $$delegate_0: IBase = i override fun foo(a: E, b: B) { .#$$delegate_0.foo(a = a, b = b) } @@ -48,7 +48,7 @@ class Test2 : IBase { get set - private /*final field*/ val $$delegate_0: IBase = j + private /* final field */ val $$delegate_0: IBase = j override fun foo(a: String, b: B) { .#$$delegate_0.foo(a = a, b = b) } diff --git a/compiler/testData/ir/irText/classes/delegatedImplementation.fir.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementation.fir.kt.txt index ef0e829ad86..7d3062bf224 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementation.fir.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementation.fir.kt.txt @@ -97,7 +97,7 @@ class Test1 : IBase { (.#<$$delegate_0>, ).qux() } - local /*final field*/ val <$$delegate_0>: IBase + local /* final field */ val <$$delegate_0>: IBase } @@ -122,7 +122,7 @@ class Test2 : IBase, IOther { (.#<$$delegate_0>, ).qux() } - local /*final field*/ val <$$delegate_0>: IBase + local /* final field */ val <$$delegate_0>: IBase override val x: String override get(): String { return .#<$$delegate_1>.() @@ -149,6 +149,7 @@ class Test2 : IBase, IOther { (.#<$$delegate_1>, ).( = ) } - local /*final field*/ val <$$delegate_1>: IOther + local /* final field */ val <$$delegate_1>: IOther } + diff --git a/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt index 04bc27d486e..835c6190117 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementation.kt.txt @@ -84,7 +84,7 @@ class Test1 : IBase { } - private /*final field*/ val $$delegate_0: BaseImpl = BaseImpl + private /* final field */ val $$delegate_0: BaseImpl = BaseImpl override fun bar(): Int { return .#$$delegate_0.bar() } @@ -106,7 +106,7 @@ class Test2 : IBase, IOther { } - private /*final field*/ val $$delegate_0: BaseImpl = BaseImpl + private /* final field */ val $$delegate_0: BaseImpl = BaseImpl override fun bar(): Int { return .#$$delegate_0.bar() } @@ -119,7 +119,7 @@ class Test2 : IBase, IOther { (.#$$delegate_0, ).qux() } - private /*final field*/ val $$delegate_1: IOther = otherImpl(x0 = "", y0 = 42) + private /* final field */ val $$delegate_1: IOther = otherImpl(x0 = "", y0 = 42) override val Byte.z1: Int override get(): Int { return (.#$$delegate_1, ).() diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.fir.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.fir.kt.txt index 8bf95831780..99901f3782f 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.fir.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.fir.kt.txt @@ -34,6 +34,7 @@ class Test : J { return .#<$$delegate_0>.returnsFlexible() } - local /*final field*/ val <$$delegate_0>: J + local /* final field */ val <$$delegate_0>: J } + diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.fir.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.fir.kt.txt index fba073af5c8..103c62d6993 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.fir.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.fir.kt.txt @@ -34,6 +34,7 @@ class C : IFooBar { .#<$$delegate_0>.foo() } - local /*final field*/ val <$$delegate_0>: IFooBar + local /* final field */ val <$$delegate_0>: IFooBar } + diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt index 5cab352d2a5..97d4259efde 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.kt.txt @@ -26,7 +26,7 @@ class C : IFooBar { } - private /*final field*/ val $$delegate_0: FooBarImpl = FooBarImpl + private /* final field */ val $$delegate_0: FooBarImpl = FooBarImpl override fun foo() { .#$$delegate_0.foo() } diff --git a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.fir.kt.txt b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.fir.kt.txt index 8ae6aea8d38..154bbcaad18 100644 --- a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.fir.kt.txt +++ b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.fir.kt.txt @@ -59,7 +59,7 @@ class TestJFoo : IFoo { return .#<$$delegate_0>.foo() } - local /*final field*/ val <$$delegate_0>: IFoo + local /* final field */ val <$$delegate_0>: IFoo } @@ -75,7 +75,7 @@ class TestK1 : IFoo { return .#<$$delegate_0>.foo() } - local /*final field*/ val <$$delegate_0>: IFoo + local /* final field */ val <$$delegate_0>: IFoo } @@ -91,7 +91,7 @@ class TestK2 : IFoo { return .#<$$delegate_0>.foo() } - local /*final field*/ val <$$delegate_0>: IFoo + local /* final field */ val <$$delegate_0>: IFoo } @@ -107,7 +107,7 @@ class TestK3 : IFoo { return .#<$$delegate_0>.foo() } - local /*final field*/ val <$$delegate_0>: IFoo + local /* final field */ val <$$delegate_0>: IFoo } @@ -123,6 +123,7 @@ class TestK4 : IFoo { return .#<$$delegate_0>.foo() } - local /*final field*/ val <$$delegate_0>: IFoo + local /* final field */ val <$$delegate_0>: IFoo } + diff --git a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt index 380453eb62e..0d4907bc0c2 100644 --- a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt +++ b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt.txt @@ -54,7 +54,7 @@ class TestJFoo : IFoo { } - private /*final field*/ val $$delegate_0: JFoo = JFoo() + private /* final field */ val $$delegate_0: JFoo = JFoo() override fun foo(): String { return .#$$delegate_0.foo() /*!! String */ } @@ -68,7 +68,7 @@ class TestK1 : IFoo { } - private /*final field*/ val $$delegate_0: K1 = K1() + private /* final field */ val $$delegate_0: K1 = K1() override fun foo(): String { return .#$$delegate_0.foo() /*!! String */ } @@ -82,7 +82,7 @@ class TestK2 : IFoo { } - private /*final field*/ val $$delegate_0: K2 = K2() + private /* final field */ val $$delegate_0: K2 = K2() override fun foo(): String { return .#$$delegate_0.foo() } @@ -96,7 +96,7 @@ class TestK3 : IFoo { } - private /*final field*/ val $$delegate_0: K3 = K3() + private /* final field */ val $$delegate_0: K3 = K3() override fun foo(): String { return .#$$delegate_0.foo() } @@ -110,7 +110,7 @@ class TestK4 : IFoo { } - private /*final field*/ val $$delegate_0: K4 = K4() + private /* final field */ val $$delegate_0: K4 = K4() override fun foo(): String { return .#$$delegate_0.foo() /*!! String */ } diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.kt.txt index 5d627c4940a..45bfc22d9b2 100644 --- a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.kt.txt @@ -45,6 +45,7 @@ class DFoo : IFoo { return (.#<$$delegate_0>, ).() } - local /*final field*/ val <$$delegate_0>: IFoo + local /* final field */ val <$$delegate_0>: IFoo } + diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt index 0cab97fc9e0..02c4a0f9c9d 100644 --- a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt.txt @@ -26,7 +26,7 @@ class DFoo : IFoo { } - private /*final field*/ val $$delegate_0: IFoo = d + private /* final field */ val $$delegate_0: IFoo = d @Ann override fun String.testExtFun() { (.#$$delegate_0, ).testExtFun() diff --git a/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.fir.kt.txt index f2c20e552fc..af0e0ee01ba 100644 --- a/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.fir.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.fir.kt.txt @@ -31,7 +31,7 @@ class Delegated : IFoo { return (.#<$$delegate_0>, ).() } - local /*final field*/ val <$$delegate_0>: IFoo + local /* final field */ val <$$delegate_0>: IFoo } @@ -62,3 +62,4 @@ class ExplicitOverride : IFoo { } } + diff --git a/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.kt.txt b/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.kt.txt index e8c7b83bd78..d6384c5dbde 100644 --- a/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.kt.txt @@ -20,7 +20,7 @@ class Delegated : IFoo { } - private /*final field*/ val $$delegate_0: IFoo = foo + private /* final field */ val $$delegate_0: IFoo = foo override val String.extProp: String override get(): String { return (.#$$delegate_0, ).() diff --git a/compiler/testData/ir/irText/declarations/kt35550.fir.kt.txt b/compiler/testData/ir/irText/declarations/kt35550.fir.kt.txt index 7ed89add857..ec35a44d722 100644 --- a/compiler/testData/ir/irText/declarations/kt35550.fir.kt.txt +++ b/compiler/testData/ir/irText/declarations/kt35550.fir.kt.txt @@ -19,6 +19,7 @@ class A : I { return (.#<$$delegate_0>, ).() } - local /*final field*/ val <$$delegate_0>: I + local /* final field */ val <$$delegate_0>: I } + diff --git a/compiler/testData/ir/irText/declarations/kt35550.kt.txt b/compiler/testData/ir/irText/declarations/kt35550.kt.txt index 2b8de3d0ff5..1b3af7b5e9e 100644 --- a/compiler/testData/ir/irText/declarations/kt35550.kt.txt +++ b/compiler/testData/ir/irText/declarations/kt35550.kt.txt @@ -13,7 +13,7 @@ class A : I { } - private /*final field*/ val $$delegate_0: I = i + private /* final field */ val $$delegate_0: I = i override val T.id: T override get(): T { return (.#$$delegate_0, ).() diff --git a/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.fir.kt.txt b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.fir.kt.txt index f8509a6c22c..2ea28d408b8 100644 --- a/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.fir.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.fir.kt.txt @@ -28,6 +28,7 @@ class Test : IBase { return .#<$$delegate_0>.() } - local /*final field*/ val <$$delegate_0>: IBase + local /* final field */ val <$$delegate_0>: IBase } + diff --git a/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt index df3fbee5830..b6e22e18e72 100644 --- a/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt.txt @@ -14,7 +14,7 @@ class Test : IBase { } - private /*final field*/ val $$delegate_0: IBase = impl + private /* final field */ val $$delegate_0: IBase = impl override fun qux(t: TT, x: X) { .#$$delegate_0.qux(t = t, x = x) } diff --git a/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.fir.kt.txt b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.fir.kt.txt index fca16e0cd8d..cf7ebc19190 100644 --- a/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.fir.kt.txt +++ b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.fir.kt.txt @@ -51,10 +51,11 @@ class Impl : A, B { return .#<$$delegate_0>.() } - local /*final field*/ val <$$delegate_0>: B + local /* final field */ val <$$delegate_0>: B } fun box(): String { return "OK" } + diff --git a/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt index e9bbd371094..1831c10784a 100644 --- a/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt +++ b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.kt.txt @@ -5,7 +5,7 @@ class Impl : A, B { } - private /*final field*/ val $$delegate_0: B = b + private /* final field */ val $$delegate_0: B = b override fun add(element: @FlexibleNullability String?): Boolean { return .#$$delegate_0.add(element = element) } diff --git a/compiler/testData/ir/irText/firProblems/SignatureClash.fir.kt.txt b/compiler/testData/ir/irText/firProblems/SignatureClash.fir.kt.txt index 30ecc73057c..cf0380f32ae 100644 --- a/compiler/testData/ir/irText/firProblems/SignatureClash.fir.kt.txt +++ b/compiler/testData/ir/irText/firProblems/SignatureClash.fir.kt.txt @@ -53,7 +53,7 @@ data class DataClass : Derived, Delegate { .#<$$delegate_0>.bar() } - local /*final field*/ val <$$delegate_0>: Delegate + local /* final field */ val <$$delegate_0>: Delegate override fun equals(other: Any?): Boolean { when { EQEQEQ(arg0 = , arg1 = other) -> return true @@ -77,3 +77,4 @@ data class DataClass : Derived, Delegate { } } + diff --git a/compiler/testData/ir/irText/types/javaWildcardType.fir.kt.txt b/compiler/testData/ir/irText/types/javaWildcardType.fir.kt.txt index cf408d1cdea..f497b74edb0 100644 --- a/compiler/testData/ir/irText/types/javaWildcardType.fir.kt.txt +++ b/compiler/testData/ir/irText/types/javaWildcardType.fir.kt.txt @@ -31,7 +31,7 @@ class C : J, K { .#<$$delegate_0>.jg2(c = c) } - local /*final field*/ val <$$delegate_0>: J + local /* final field */ val <$$delegate_0>: J override fun kf1(): Collection { return .#<$$delegate_1>.kf1() } @@ -48,6 +48,7 @@ class C : J, K { .#<$$delegate_1>.kg2(c = c) } - local /*final field*/ val <$$delegate_1>: K + local /* final field */ val <$$delegate_1>: K } + diff --git a/compiler/testData/ir/irText/types/javaWildcardType.kt.txt b/compiler/testData/ir/irText/types/javaWildcardType.kt.txt index f4e9ce282a2..e5ad5568f40 100644 --- a/compiler/testData/ir/irText/types/javaWildcardType.kt.txt +++ b/compiler/testData/ir/irText/types/javaWildcardType.kt.txt @@ -13,7 +13,7 @@ class C : J, K { } - private /*final field*/ val $$delegate_0: J = j + private /* final field */ val $$delegate_0: J = j override fun jf1(): @FlexibleNullability MutableCollection? { return .#$$delegate_0.jf1() } @@ -30,7 +30,7 @@ class C : J, K { .#$$delegate_0.jg2(c = c) } - private /*final field*/ val $$delegate_1: K = k + private /* final field */ val $$delegate_1: K = k override fun kf1(): Collection { return .#$$delegate_1.kf1() } diff --git a/compiler/testData/ir/irText/types/rawTypeInSignature.fir.kt.txt b/compiler/testData/ir/irText/types/rawTypeInSignature.fir.kt.txt index 3494329f26d..0c810163b36 100644 --- a/compiler/testData/ir/irText/types/rawTypeInSignature.fir.kt.txt +++ b/compiler/testData/ir/irText/types/rawTypeInSignature.fir.kt.txt @@ -77,6 +77,7 @@ class KRaw : JRaw { return .#<$$delegate_0>.returnsRawGenericOut() } - local /*final field*/ val <$$delegate_0>: JRaw + local /* final field */ val <$$delegate_0>: JRaw } + diff --git a/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt b/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt index b091d11a5c9..d39267cfd70 100644 --- a/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt +++ b/compiler/testData/ir/irText/types/rawTypeInSignature.kt.txt @@ -44,7 +44,7 @@ class KRaw : JRaw { } - private /*final field*/ val $$delegate_0: JRaw = j + private /* final field */ val $$delegate_0: JRaw = j override fun returnsRawGenericIn(): @FlexibleNullability @RawType GenericIn? { return .#$$delegate_0.returnsRawGenericIn() } From 5a755054f8d204b73fd886900823edf7c4a8ecb4 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Mon, 23 Nov 2020 23:06:15 +0300 Subject: [PATCH 198/698] [IR] dumpKotlinLike: add a comment about some conventions which could be unclear --- .../org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt index 11acec88d76..d5e44eb821f 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt @@ -17,6 +17,18 @@ import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.types.Variance import org.jetbrains.kotlin.utils.Printer +/** + * Conventions: + * * For unsupported cases (node, type) it prints a block comment which starts with "/* ERROR:" (*/<- hack for parser) + * * Conventions for some operators: + * * IMPLICIT_CAST -- expr /*as Type */ + * * IMPLICIT_NOTNULL -- expr /*!! Type */ + * * IMPLICIT_COERCION_TO_UNIT -- expr /*~> Unit */ + * * IMPLICIT_INTEGER_COERCION -- expr /*~> IntType */ + * * SAM_CONVERSION -- expr /*-> SamType */ + * * IMPLICIT_DYNAMIC_CAST -- expr /*~> dynamic */ + * * REINTERPRET_CAST -- expr /*=> Type */ + */ fun IrElement.dumpKotlinLike(options: KotlinLikeDumpOptions = KotlinLikeDumpOptions()): String { val sb = StringBuilder() accept(KotlinLikeDumper(Printer(sb, 1, " "), options), null) From c0042695473b19bd8fe131870fc5d021870f95ea Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Mon, 23 Nov 2020 23:47:36 +0300 Subject: [PATCH 199/698] [IR] KotlinLikeDumper: unify and add more comments for the cases when used a syntax which is invalid in Kotlin --- .../kotlin/ir/util/dumpKotlinLike.kt | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt index d5e44eb821f..3b5c2827c44 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt @@ -432,6 +432,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printIndent() p.printWithNoIndent(declaration.name) declaration.initializerExpression?.let { + // it's not valid kotlin p.printWithNoIndent(" = ") it.accept(this, declaration) } @@ -696,7 +697,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.pushIndent() // TODO share code with visitField? - // TODO it's not valid kotlin + // it's not valid kotlin declaration.backingField?.initializer?.let { p.print("field = ") it.accept(this, declaration) @@ -745,6 +746,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } if (declaration.isStatic || declaration.isFinal) { + // it's not valid kotlin unless it's commented p.printWithNoIndent(CUSTOM_MODIFIER_START) p(declaration.isStatic, "static") p(declaration.isFinal, "final") @@ -828,6 +830,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption // TODO inlineFunctionSymbol for IrReturnableBlock // TODO no tests for IrReturnableBlock? val kind = if (expression is IrReturnableBlock) "RETURNABLE BLOCK" else "BLOCK" + // it's not valid kotlin expression.printStatementContainer("{ // $kind", "}", data) } @@ -852,6 +855,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } override fun visitSyntheticBody(body: IrSyntheticBody, data: IrDeclaration?) { + // it's not valid kotlin p.printlnWithNoIndent("/* Synthetic body for ${body.kind} */") } @@ -906,6 +910,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption if (superQualifierSymbol == null) it.accept(this@KotlinLikeDumper, data) // else assert dispatchReceiver === this } + // it's not valid kotlin p(twoReceivers, ",") extensionReceiver?.accept(this@KotlinLikeDumper, data) if (twoReceivers) { @@ -945,7 +950,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printWithNoIndent("(") // TODO introduce a flag to print receiver this way? -// +// // it's not valid kotlin // expression.extensionReceiver?.let { // p.printWithNoIndent("\$receiver = ") // it.acceptVoid(this) @@ -987,6 +992,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption val name = if (data is IrConstructor) { when (currentClass) { + // it's not valid kotlin, it's fallback for the case when data wasn't provided null -> "delegating/*$delegatingClassName*/" delegatingClass -> "this/*$delegatingClassName*/" else -> "super/*$delegatingClassName*/" @@ -1036,13 +1042,14 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption } private fun IrFieldAccessExpression.printFieldAccess(data: IrDeclaration?) { - // TODO is not valid kotlin + // it's not valid kotlin receiver?.accept(this@KotlinLikeDumper, data) superQualifierSymbol?.let { // TODO should we print super classifier somehow? // TODO which supper? smart mode? // TODO super and receiver at the same time: // compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.kt + // it's not valid kotlin p.printWithNoIndent("super") } @@ -1050,6 +1057,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption p.printWithNoIndent(".") } + // it's not valid kotlin p.printWithNoIndent("#" + symbol.owner.name.asString()) } @@ -1077,6 +1085,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption override fun visitRawFunctionReference(expression: IrRawFunctionReference, data: IrDeclaration?) { // TODO support // TODO no test + // it's not valid kotlin p.printWithNoIndent("&") super.visitRawFunctionReference(expression, data) } @@ -1109,7 +1118,9 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption is IrConstKind.Null -> "" to "" is IrConstKind.Boolean -> "" to "" is IrConstKind.Char -> "'" to "'" + // it's not valid kotlin is IrConstKind.Byte -> "" to "B" + // it's not valid kotlin is IrConstKind.Short -> "" to "S" is IrConstKind.Int -> "" to "" is IrConstKind.Long -> "" to "L" @@ -1132,6 +1143,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption override fun visitVararg(expression: IrVararg, data: IrDeclaration?) { // TODO better rendering? // TODO varargElementType + // it's not valid kotlin p.printWithNoIndent("[") expression.elements.forEachIndexed { i, e -> p(i > 0, ",") @@ -1398,7 +1410,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption private fun commentBlock(text: String) = "/* $text */" - // TODO it's not valid kotlin unless it's commented + // it's not valid kotlin unless it's commented // ^^^ it's applied to all usages of this function private fun customModifier(text: String): String { return CUSTOM_MODIFIER_START + text + CUSTOM_MODIFIER_END From 0d5a0b207e1cf0ee82f99fd4f386c65245a9f4f4 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Mon, 23 Nov 2020 23:48:29 +0300 Subject: [PATCH 200/698] [IR] KotlinLikeDumper: add a note about some conventions used for TODO comments --- .../src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt index 3b5c2827c44..496aa6f74bb 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt @@ -70,6 +70,11 @@ enum class FakeOverridesStrategy { NONE } +// TODO_ conventions: +// TODO support -- for unsupported nodes +// TODO no test -- for the cases with no test(s) +// it's not valid kotlin -- for the cases when used some syntax which is invalid in Kotlin, maybe they are worth to reconsider + /* TODO: * don't crash on unbound symbols * origin : class, function, property, ... From 6abd6561168ad83fbed9c21aae23f7fd8c08052e Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Wed, 25 Nov 2020 22:17:32 +0300 Subject: [PATCH 201/698] [IR] dumpKotlinLike: update testdata after rebase --- ...edImplementationOfJavaInterface.fir.kt.txt | 2 + .../annotationsOnDelegatedMembers.fir.kt.txt | 4 + .../inheritingDeprecation.fir.kt.txt | 2 + .../typeVariableAfterBuildMap.fir.kt.txt | 175 ++++++++++++++++++ .../typeVariableAfterBuildMap.kt.txt | 175 ++++++++++++++++++ .../castsInsideCoroutineInference.fir.kt.txt | 4 +- 6 files changed, 360 insertions(+), 2 deletions(-) create mode 100644 compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.fir.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.kt.txt diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.fir.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.fir.kt.txt index 99901f3782f..f8ae385e192 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.fir.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.fir.kt.txt @@ -22,10 +22,12 @@ class Test : J { .#<$$delegate_0>.takeFlexible(x = x) } + @NotNull override fun returnNotNull(): @EnhancedNullability String { return .#<$$delegate_0>.returnNotNull() } + @Nullable override fun returnNullable(): @FlexibleNullability String? { return .#<$$delegate_0>.returnNullable() } diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.kt.txt index 45bfc22d9b2..d2fd97a09fd 100644 --- a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.kt.txt @@ -27,19 +27,23 @@ class DFoo : IFoo { .#<$$delegate_0> = d } + @Ann override fun testFun() { .#<$$delegate_0>.testFun() } + @Ann override fun String.testExtFun() { (.#<$$delegate_0>, ).testExtFun() } + @Ann override val testVal: String override get(): String { return .#<$$delegate_0>.() } + @Ann override val String.testExtVal: String override get(): String { return (.#<$$delegate_0>, ).() diff --git a/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.fir.kt.txt index af0e0ee01ba..2c3ee7d7203 100644 --- a/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.fir.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.fir.kt.txt @@ -21,11 +21,13 @@ class Delegated : IFoo { .#<$$delegate_0> = foo } + @Deprecated(message = "") override val prop: String override get(): String { return .#<$$delegate_0>.() } + @Deprecated(message = "") override val String.extProp: String override get(): String { return (.#<$$delegate_0>, ).() diff --git a/compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.fir.kt.txt b/compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.fir.kt.txt new file mode 100644 index 00000000000..cecf37e0998 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.fir.kt.txt @@ -0,0 +1,175 @@ +abstract class Visibility { + constructor(name: String, isPublicAPI: Boolean) /* primary */ { + super/*Any*/() + /* () */ + + } + + val name: String + field = name + get + + val isPublicAPI: Boolean + field = isPublicAPI + get + + open val internalDisplayName: String + open get(): String { + return .() + } + + open val externalDisplayName: String + open get(): String { + return .() + } + + abstract fun mustCheckInImports(): Boolean + +} + +object Visibilities { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + object Private : Visibility { + private constructor() /* primary */ { + super/*Visibility*/(name = "private", isPublicAPI = false) + /* () */ + + } + + override fun mustCheckInImports(): Boolean { + return true + } + + } + + object PrivateToThis : Visibility { + private constructor() /* primary */ { + super/*Visibility*/(name = "private_to_this", isPublicAPI = false) + /* () */ + + } + + override val internalDisplayName: String + override get(): String { + return "private/*private to this*/" + } + + override fun mustCheckInImports(): Boolean { + return true + } + + } + + object Protected : Visibility { + private constructor() /* primary */ { + super/*Visibility*/(name = "protected", isPublicAPI = true) + /* () */ + + } + + override fun mustCheckInImports(): Boolean { + return false + } + + } + + object Internal : Visibility { + private constructor() /* primary */ { + super/*Visibility*/(name = "internal", isPublicAPI = false) + /* () */ + + } + + override fun mustCheckInImports(): Boolean { + return true + } + + } + + object Public : Visibility { + private constructor() /* primary */ { + super/*Visibility*/(name = "public", isPublicAPI = true) + /* () */ + + } + + override fun mustCheckInImports(): Boolean { + return false + } + + } + + object Local : Visibility { + private constructor() /* primary */ { + super/*Visibility*/(name = "local", isPublicAPI = false) + /* () */ + + } + + override fun mustCheckInImports(): Boolean { + return true + } + + } + + object Inherited : Visibility { + private constructor() /* primary */ { + super/*Visibility*/(name = "inherited", isPublicAPI = false) + /* () */ + + } + + override fun mustCheckInImports(): Boolean { + throw IllegalStateException(p0 = "This method shouldn't be invoked for INHERITED visibility") + } + + } + + object InvisibleFake : Visibility { + private constructor() /* primary */ { + super/*Visibility*/(name = "invisible_fake", isPublicAPI = false) + /* () */ + + } + + override fun mustCheckInImports(): Boolean { + return true + } + + override val externalDisplayName: String + override get(): String { + return "invisible (private in a supertype)" + } + + } + + object Unknown : Visibility { + private constructor() /* primary */ { + super/*Visibility*/(name = "unknown", isPublicAPI = false) + /* () */ + + } + + override fun mustCheckInImports(): Boolean { + throw IllegalStateException(p0 = "This method shouldn't be invoked for UNKNOWN visibility") + } + + } + + private val ORDERED_VISIBILITIES: Map + field = buildMap(builderAction = local fun MutableMap.() { + .put(key = PrivateToThis, value = 0) /*~> Unit */ + .put(key = Private, value = 0) /*~> Unit */ + .put(key = Internal, value = 1) /*~> Unit */ + .put(key = Protected, value = 1) /*~> Unit */ + return .put(key = Public, value = 2) /*~> Unit */ + } +) + private get + +} diff --git a/compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.kt.txt b/compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.kt.txt new file mode 100644 index 00000000000..bf26d2c54dd --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.kt.txt @@ -0,0 +1,175 @@ +abstract class Visibility { + constructor(name: String, isPublicAPI: Boolean) /* primary */ { + super/*Any*/() + /* () */ + + } + + val name: String + field = name + get + + val isPublicAPI: Boolean + field = isPublicAPI + get + + open val internalDisplayName: String + open get(): String { + return .() + } + + open val externalDisplayName: String + open get(): String { + return .() + } + + abstract fun mustCheckInImports(): Boolean + +} + +object Visibilities { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + object Private : Visibility { + private constructor() /* primary */ { + super/*Visibility*/(name = "private", isPublicAPI = false) + /* () */ + + } + + override fun mustCheckInImports(): Boolean { + return true + } + + } + + object PrivateToThis : Visibility { + private constructor() /* primary */ { + super/*Visibility*/(name = "private_to_this", isPublicAPI = false) + /* () */ + + } + + override val internalDisplayName: String + override get(): String { + return "private/*private to this*/" + } + + override fun mustCheckInImports(): Boolean { + return true + } + + } + + object Protected : Visibility { + private constructor() /* primary */ { + super/*Visibility*/(name = "protected", isPublicAPI = true) + /* () */ + + } + + override fun mustCheckInImports(): Boolean { + return false + } + + } + + object Internal : Visibility { + private constructor() /* primary */ { + super/*Visibility*/(name = "internal", isPublicAPI = false) + /* () */ + + } + + override fun mustCheckInImports(): Boolean { + return true + } + + } + + object Public : Visibility { + private constructor() /* primary */ { + super/*Visibility*/(name = "public", isPublicAPI = true) + /* () */ + + } + + override fun mustCheckInImports(): Boolean { + return false + } + + } + + object Local : Visibility { + private constructor() /* primary */ { + super/*Visibility*/(name = "local", isPublicAPI = false) + /* () */ + + } + + override fun mustCheckInImports(): Boolean { + return true + } + + } + + object Inherited : Visibility { + private constructor() /* primary */ { + super/*Visibility*/(name = "inherited", isPublicAPI = false) + /* () */ + + } + + override fun mustCheckInImports(): Boolean { + throw IllegalStateException(p0 = "This method shouldn't be invoked for INHERITED visibility") + } + + } + + object InvisibleFake : Visibility { + private constructor() /* primary */ { + super/*Visibility*/(name = "invisible_fake", isPublicAPI = false) + /* () */ + + } + + override fun mustCheckInImports(): Boolean { + return true + } + + override val externalDisplayName: String + override get(): String { + return "invisible (private in a supertype)" + } + + } + + object Unknown : Visibility { + private constructor() /* primary */ { + super/*Visibility*/(name = "unknown", isPublicAPI = false) + /* () */ + + } + + override fun mustCheckInImports(): Boolean { + throw IllegalStateException(p0 = "This method shouldn't be invoked for UNKNOWN visibility") + } + + } + + private val ORDERED_VISIBILITIES: Map + field = buildMap(builderAction = local fun MutableMap.() { + $this$buildMap.put(key = PrivateToThis, value = 0) /*~> Unit */ + $this$buildMap.put(key = Private, value = 0) /*~> Unit */ + $this$buildMap.put(key = Internal, value = 1) /*~> Unit */ + $this$buildMap.put(key = Protected, value = 1) /*~> Unit */ + $this$buildMap.put(key = Public, value = 2) /*~> Unit */ + } +) + private get + +} diff --git a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.kt.txt b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.kt.txt index 5d56f89742b..6c921d41b55 100644 --- a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.kt.txt +++ b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.kt.txt @@ -3,7 +3,7 @@ fun scopedFlow(@BuilderInference block: @ExtensionFunctionType @Exten return flow(block = local suspend fun FlowCollector.() { val collector: FlowCollector = flowScope(block = local suspend fun CoroutineScope.() { - block.invoke(p1 = , p2 = collector) + block.invoke(p1 = , p2 = collector /*as FlowCollector */) } ) } @@ -12,7 +12,7 @@ fun scopedFlow(@BuilderInference block: @ExtensionFunctionType @Exten fun Flow.onCompletion(action: @ExtensionFunctionType @ExtensionFunctionType SuspendFunction2, Throwable?, Unit>): Flow { return unsafeFlow(block = local suspend fun FlowCollector.() { - val safeCollector: SafeCollector = SafeCollector(collector = ) + val safeCollector: SafeCollector = SafeCollector(collector = ) safeCollector.invokeSafely(action = action) } ) From 3a2b15521b979d22b61fc3ea66f363011faa1a65 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 16 Nov 2020 15:16:38 +0300 Subject: [PATCH 202/698] FirSourceElement: introduce common 'lighterASTNode' property --- .../kotlin/fir/analysis/FirSourceChildren.kt | 2 +- .../fir/analysis/checkers/FirModifierList.kt | 2 +- .../declaration/FirAnnotationArgumentChecker.kt | 3 +-- .../FirAnnotationClassDeclarationChecker.kt | 2 +- .../FirConstructorInInterfaceChecker.kt | 5 ++--- .../FirDelegationInInterfaceChecker.kt | 5 ++--- .../FirExposedVisibilityDeclarationChecker.kt | 2 +- .../FirSupertypeInitializedInInterfaceChecker.kt | 5 ++--- ...pertypeInitializedWithoutPrimaryConstructor.kt | 5 ++--- ...FirTypeArgumentsNotAllowedExpressionChecker.kt | 5 ++--- .../CanBeReplacedWithOperatorAssignmentChecker.kt | 4 ++-- .../analysis/checkers/extended/CanBeValChecker.kt | 2 +- .../extended/RedundantExplicitTypeChecker.kt | 2 +- ...undantSingleExpressionStringTemplateChecker.kt | 7 +++---- .../lightTree/converter/DeclarationsConverter.kt | 2 +- .../kotlin/fir/lightTree/fir/ValueParameter.kt | 2 +- .../org/jetbrains/kotlin/fir/FirSourceElement.kt | 15 +++++++++------ 17 files changed, 33 insertions(+), 37 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/FirSourceChildren.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/FirSourceChildren.kt index 83f5a334e48..40d8c8f5d2f 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/FirSourceChildren.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/FirSourceChildren.kt @@ -37,5 +37,5 @@ private fun FirPsiSourceElement<*>.getChild(types: Set, index: Int private fun FirLightSourceElement.getChild(types: Set, index: Int, depth: Int): FirSourceElement? { val visitor = LighterTreeElementFinderByType(tree, types, index, depth) - return visitor.find(lightNode)?.let { it.toFirLightSourceElement(it.startOffset, it.endOffset, tree) } + return visitor.find(lighterASTNode)?.let { it.toFirLightSourceElement(it.startOffset, it.endOffset, tree) } } \ No newline at end of file diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirModifierList.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirModifierList.kt index 56b49588641..dba6f998b87 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirModifierList.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirModifierList.kt @@ -28,7 +28,7 @@ fun FirSourceElement?.getModifierList(): FirModifierList? { is FirPsiSourceElement<*> -> (psi as? KtModifierListOwner)?.modifierList?.let { FirPsiModifierList(it) } is FirLightSourceElement -> { val kidsRef = Ref>() - tree.getChildren(element, kidsRef) + tree.getChildren(lighterASTNode, kidsRef) val modifierListNode = kidsRef.get().find { it?.tokenType == KtNodeTypes.MODIFIER_LIST } ?: return null FirLightModifierList(modifierListNode, tree) } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationArgumentChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationArgumentChecker.kt index e1b46b82732..0d2a46e10b9 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationArgumentChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationArgumentChecker.kt @@ -241,8 +241,7 @@ object FirAnnotationArgumentChecker : FirBasicDeclarationChecker() { is FirPsiSourceElement<*> -> source.psi.parent.toFirPsiSourceElement() is FirLightSourceElement -> { - val elementOfParent = source.tree.getParent(source.element) - ?: source.element + val elementOfParent = source.tree.getParent(source.lighterASTNode) ?: source.lighterASTNode elementOfParent.toFirLightSourceElement(elementOfParent.startOffset, elementOfParent.endOffset, source.tree) } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationClassDeclarationChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationClassDeclarationChecker.kt index ab2cb3a7e2e..83c75be6085 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationClassDeclarationChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationClassDeclarationChecker.kt @@ -53,7 +53,7 @@ object FirAnnotationClassDeclarationChecker : FirBasicDeclarationChecker() { } is FirLightSourceElement -> { val kidsRef = Ref>() - parameterSourceElement.tree.getChildren(parameterSourceElement.element, kidsRef) + parameterSourceElement.tree.getChildren(parameterSourceElement.lighterASTNode, kidsRef) if (kidsRef.get().any { it?.tokenType == VAR_KEYWORD }) reporter.report(parameterSourceElement, FirErrors.VAR_ANNOTATION_PARAMETER) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirConstructorInInterfaceChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirConstructorInInterfaceChecker.kt index 3bd5ec7dbd1..7ada834666c 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirConstructorInInterfaceChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirConstructorInInterfaceChecker.kt @@ -19,7 +19,6 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.declarations.FirClass import org.jetbrains.kotlin.fir.declarations.FirDeclaration -import org.jetbrains.kotlin.fir.lightNode import org.jetbrains.kotlin.fir.psi import org.jetbrains.kotlin.psi.KtPrimaryConstructor @@ -36,11 +35,11 @@ object FirConstructorInInterfaceChecker : FirBasicDeclarationChecker() { private fun FirSourceElement.hasPrimaryConstructor(): Boolean { val localPsi = psi - val localLightNode = lightNode + val localLightNode = lighterASTNode if (localPsi != null && localPsi !is PsiErrorElement) { return localPsi.hasPrimaryConstructor() - } else if (localLightNode != null && this is FirLightSourceElement) { + } else if (this is FirLightSourceElement) { return localLightNode.hasPrimaryConstructor(tree) } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDelegationInInterfaceChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDelegationInInterfaceChecker.kt index a230304c1fe..c98213ba7fd 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDelegationInInterfaceChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDelegationInInterfaceChecker.kt @@ -19,7 +19,6 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.declarations.FirClass import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration -import org.jetbrains.kotlin.fir.lightNode import org.jetbrains.kotlin.fir.psi import org.jetbrains.kotlin.psi.KtDelegatedSuperTypeEntry @@ -36,11 +35,11 @@ object FirDelegationInInterfaceChecker : FirMemberDeclarationChecker() { private fun FirSourceElement.findSuperTypeDelegation(): Int { val localPsi = psi - val localLightNode = lightNode + val localLightNode = lighterASTNode if (localPsi != null && localPsi !is PsiErrorElement) { return localPsi.findSuperTypeDelegation() - } else if (localLightNode != null && this is FirLightSourceElement) { + } else if (this is FirLightSourceElement) { return localLightNode.findSuperTypeDelegation(tree) } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirExposedVisibilityDeclarationChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirExposedVisibilityDeclarationChecker.kt index 0962c47492f..46b8c798cbb 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirExposedVisibilityDeclarationChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirExposedVisibilityDeclarationChecker.kt @@ -234,7 +234,7 @@ object FirExposedVisibilityDeclarationChecker : FirMemberDeclarationChecker() { is FirPsiSourceElement<*> -> (this.psi as? PsiNameIdentifierOwner)?.nameIdentifier?.toFirPsiSourceElement() is FirLightSourceElement -> { val kidsRef = Ref>() - this.tree.getChildren(this.element, kidsRef) + this.tree.getChildren(lighterASTNode, kidsRef) val identifier = kidsRef.get().find { it?.tokenType == KtTokens.IDENTIFIER } identifier?.toFirLightSourceElement(this.tree.getStartOffset(identifier), this.tree.getEndOffset(identifier), this.tree) } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedInInterfaceChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedInInterfaceChecker.kt index c8a748f5f6d..b69a4575cdc 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedInInterfaceChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedInInterfaceChecker.kt @@ -19,7 +19,6 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.declarations.FirClass import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration -import org.jetbrains.kotlin.fir.lightNode import org.jetbrains.kotlin.fir.psi import org.jetbrains.kotlin.psi.KtSuperTypeCallEntry @@ -36,11 +35,11 @@ object FirSupertypeInitializedInInterfaceChecker : FirMemberDeclarationChecker() private fun FirSourceElement.findSuperTypeCall(): Int { val localPsi = psi - val localLightNode = lightNode + val localLightNode = lighterASTNode if (localPsi != null && localPsi !is PsiErrorElement) { return localPsi.findSuperTypeCall() - } else if (localLightNode != null && this is FirLightSourceElement) { + } else if (this is FirLightSourceElement) { return localLightNode.findSuperTypeCall(tree) } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedWithoutPrimaryConstructor.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedWithoutPrimaryConstructor.kt index cab6c21648c..898935b1019 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedWithoutPrimaryConstructor.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedWithoutPrimaryConstructor.kt @@ -20,7 +20,6 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.declarations.FirConstructor import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration import org.jetbrains.kotlin.fir.declarations.FirRegularClass -import org.jetbrains.kotlin.fir.lightNode import org.jetbrains.kotlin.fir.psi import org.jetbrains.kotlin.psi.KtSuperTypeCallEntry @@ -40,11 +39,11 @@ object FirSupertypeInitializedWithoutPrimaryConstructor : FirMemberDeclarationCh private fun FirSourceElement.anySupertypeHasConstructorParentheses(): Boolean { val localPsi = psi - val localLightNode = lightNode + val localLightNode = lighterASTNode if (localPsi != null && localPsi !is PsiErrorElement) { return localPsi.anySupertypeHasConstructorParentheses() - } else if (localLightNode != null && this is FirLightSourceElement) { + } else if (this is FirLightSourceElement) { return localLightNode.anySupertypeHasConstructorParentheses(tree) } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirTypeArgumentsNotAllowedExpressionChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirTypeArgumentsNotAllowedExpressionChecker.kt index 7f6a529f7cc..b902ba825ef 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirTypeArgumentsNotAllowedExpressionChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirTypeArgumentsNotAllowedExpressionChecker.kt @@ -18,7 +18,6 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression import org.jetbrains.kotlin.fir.expressions.FirResolvedQualifier -import org.jetbrains.kotlin.fir.lightNode import org.jetbrains.kotlin.fir.psi import org.jetbrains.kotlin.psi.KtTypeArgumentList @@ -38,11 +37,11 @@ object FirTypeArgumentsNotAllowedExpressionChecker : FirQualifiedAccessChecker() private fun FirSourceElement.hasAnyArguments(): Boolean { val localPsi = this.psi - val localLight = this.lightNode + val localLight = this.lighterASTNode if (localPsi != null && localPsi !is PsiErrorElement) { return localPsi.hasAnyArguments() - } else if (localLight != null && this is FirLightSourceElement) { + } else if (this is FirLightSourceElement) { return localLight.hasAnyArguments(this.tree) } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeReplacedWithOperatorAssignmentChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeReplacedWithOperatorAssignmentChecker.kt index 0f28f5e2d70..873695acb44 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeReplacedWithOperatorAssignmentChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeReplacedWithOperatorAssignmentChecker.kt @@ -51,8 +51,8 @@ object CanBeReplacedWithOperatorAssignmentChecker : FirExpressionChecker>() - tree.getChildren(source.element, children) + tree.getChildren(source.lighterASTNode, children) children.get().filterNotNull().filter { it.tokenType == KtNodeTypes.DESTRUCTURING_DECLARATION_ENTRY }.size } else -> null diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantExplicitTypeChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantExplicitTypeChecker.kt index 582d9a1cc4c..023416a2536 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantExplicitTypeChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantExplicitTypeChecker.kt @@ -98,7 +98,7 @@ object RedundantExplicitTypeChecker : FirMemberDeclarationChecker() { source.psi?.text } is FirLightSourceElement -> { - (source as FirLightSourceElement).element.toString() + source?.lighterASTNode?.toString() } else -> null } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantSingleExpressionStringTemplateChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantSingleExpressionStringTemplateChecker.kt index d57265081dc..301e9f554fe 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantSingleExpressionStringTemplateChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantSingleExpressionStringTemplateChecker.kt @@ -19,7 +19,6 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.REDUNDANT_SINGLE_EXPRESSION_STRING_TEMPLATE import org.jetbrains.kotlin.fir.expressions.FirFunctionCall import org.jetbrains.kotlin.fir.expressions.FirStatement -import org.jetbrains.kotlin.fir.psi import org.jetbrains.kotlin.fir.symbols.StandardClassIds import org.jetbrains.kotlin.fir.types.classId import org.jetbrains.kotlin.fir.types.coneType @@ -38,12 +37,12 @@ object RedundantSingleExpressionStringTemplateChecker : FirBasicExpressionChecke } private fun FirStatement.stringParentChildrenCount(): Int? { - return when (source) { + return when (val source = source) { is FirPsiSourceElement<*> -> { - source.psi?.stringParentChildrenCount() + source.psi.stringParentChildrenCount() } is FirLightSourceElement -> { - (source as FirLightSourceElement).element.stringParentChildrenCount(source as FirLightSourceElement) + source.lighterASTNode.stringParentChildrenCount(source) } else -> null } diff --git a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt index 1d8c066ead6..ba619ce96b0 100644 --- a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt +++ b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt @@ -486,7 +486,7 @@ class DeclarationsConverter( //parse data class if (modifiers.isDataClass() && firPrimaryConstructor != null) { - val zippedParameters = properties.map { it.source?.lightNode!! to it } + val zippedParameters = properties.map { it.source!!.lighterASTNode to it } DataClassMembersGenerator( baseSession, classNode, diff --git a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/ValueParameter.kt b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/ValueParameter.kt index b0e4b430539..a579dbd9a7c 100644 --- a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/ValueParameter.kt +++ b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/ValueParameter.kt @@ -44,7 +44,7 @@ class ValueParameter( return buildProperty { val parameterSource = firValueParameter.source as? FirLightSourceElement - val parameterNode = parameterSource?.lightNode + val parameterNode = parameterSource?.lighterASTNode source = parameterNode?.toFirLightSourceElement( parameterSource.startOffset, parameterSource.endOffset, parameterSource.tree, FirFakeSourceElementKind.PropertyFromParameter diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt index 82914a9709a..4ab52409b97 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.fir import com.intellij.lang.LighterASTNode +import com.intellij.lang.TreeBackedLighterAST import com.intellij.psi.PsiElement import com.intellij.psi.tree.IElementType import com.intellij.util.diff.FlyweightCapableTreeStructure @@ -152,9 +153,11 @@ sealed class FirSourceElement { abstract val startOffset: Int abstract val endOffset: Int abstract val kind: FirSourceElementKind + abstract val lighterASTNode: LighterASTNode } - +// NB: in certain situations, psi.node could be null +// Potentially exceptions can be provoked by elementType / lighterASTNode sealed class FirPsiSourceElement(val psi: P) : FirSourceElement() { override val elementType: IElementType get() = psi.node.elementType @@ -164,6 +167,8 @@ sealed class FirPsiSourceElement(val psi: P) : FirSourceElem override val endOffset: Int get() = psi.textRange.endOffset + + override val lighterASTNode by lazy { TreeBackedLighterAST.wrap(psi.node) } } class FirRealPsiSourceElement(psi: P) : FirPsiSourceElement

(psi) { @@ -174,20 +179,20 @@ class FirFakeSourceElement(psi: P, override val kind: FirFak fun FirSourceElement.fakeElement(newKind: FirFakeSourceElementKind): FirSourceElement { return when (this) { - is FirLightSourceElement -> FirLightSourceElement(element, startOffset, endOffset, tree, newKind) + is FirLightSourceElement -> FirLightSourceElement(lighterASTNode, startOffset, endOffset, tree, newKind) is FirPsiSourceElement<*> -> FirFakeSourceElement(psi, newKind) } } class FirLightSourceElement( - val element: LighterASTNode, + override val lighterASTNode: LighterASTNode, override val startOffset: Int, override val endOffset: Int, val tree: FlyweightCapableTreeStructure, override val kind: FirSourceElementKind = FirRealSourceElementKind, ) : FirSourceElement() { override val elementType: IElementType - get() = element.tokenType + get() = lighterASTNode.tokenType } val FirSourceElement?.psi: PsiElement? get() = (this as? FirPsiSourceElement<*>)?.psi @@ -207,5 +212,3 @@ inline fun LighterASTNode.toFirLightSourceElement( tree: FlyweightCapableTreeStructure, kind: FirSourceElementKind = FirRealSourceElementKind ): FirLightSourceElement = FirLightSourceElement(this, startOffset, endOffset, tree, kind) - -val FirSourceElement?.lightNode: LighterASTNode? get() = (this as? FirLightSourceElement)?.element From 1cb2aeaeff10a83769ce00d71c7045bbc1d38e33 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 16 Nov 2020 17:03:49 +0300 Subject: [PATCH 203/698] FirSourceElement: introduce common 'treeStructure' property --- .../kotlin/fir/analysis/FirSourceChildren.kt | 4 +- .../fir/analysis/checkers/FirModifierList.kt | 4 +- .../FirAnnotationArgumentChecker.kt | 4 +- .../FirAnnotationClassDeclarationChecker.kt | 2 +- .../FirConstructorInInterfaceChecker.kt | 2 +- .../FirDelegationInInterfaceChecker.kt | 2 +- .../FirExposedVisibilityDeclarationChecker.kt | 4 +- ...rSupertypeInitializedInInterfaceChecker.kt | 2 +- ...ypeInitializedWithoutPrimaryConstructor.kt | 2 +- ...ypeArgumentsNotAllowedExpressionChecker.kt | 2 +- ...BeReplacedWithOperatorAssignmentChecker.kt | 2 +- .../checkers/extended/CanBeValChecker.kt | 2 +- ...ntSingleExpressionStringTemplateChecker.kt | 4 +- .../fir/lightTree/fir/ValueParameter.kt | 2 +- .../jetbrains/kotlin/fir/FirSourceElement.kt | 38 ++++++++++++++++++- 15 files changed, 55 insertions(+), 21 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/FirSourceChildren.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/FirSourceChildren.kt index 40d8c8f5d2f..b698d7cfff1 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/FirSourceChildren.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/FirSourceChildren.kt @@ -35,7 +35,7 @@ private fun FirPsiSourceElement<*>.getChild(types: Set, index: Int } private fun FirLightSourceElement.getChild(types: Set, index: Int, depth: Int): FirSourceElement? { - val visitor = LighterTreeElementFinderByType(tree, types, index, depth) + val visitor = LighterTreeElementFinderByType(treeStructure, types, index, depth) - return visitor.find(lighterASTNode)?.let { it.toFirLightSourceElement(it.startOffset, it.endOffset, tree) } + return visitor.find(lighterASTNode)?.let { it.toFirLightSourceElement(it.startOffset, it.endOffset, treeStructure) } } \ No newline at end of file diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirModifierList.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirModifierList.kt index dba6f998b87..ec7b5f02374 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirModifierList.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirModifierList.kt @@ -28,9 +28,9 @@ fun FirSourceElement?.getModifierList(): FirModifierList? { is FirPsiSourceElement<*> -> (psi as? KtModifierListOwner)?.modifierList?.let { FirPsiModifierList(it) } is FirLightSourceElement -> { val kidsRef = Ref>() - tree.getChildren(lighterASTNode, kidsRef) + treeStructure.getChildren(lighterASTNode, kidsRef) val modifierListNode = kidsRef.get().find { it?.tokenType == KtNodeTypes.MODIFIER_LIST } ?: return null - FirLightModifierList(modifierListNode, tree) + FirLightModifierList(modifierListNode, treeStructure) } } } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationArgumentChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationArgumentChecker.kt index 0d2a46e10b9..6ec8f2a054c 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationArgumentChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationArgumentChecker.kt @@ -241,9 +241,9 @@ object FirAnnotationArgumentChecker : FirBasicDeclarationChecker() { is FirPsiSourceElement<*> -> source.psi.parent.toFirPsiSourceElement() is FirLightSourceElement -> { - val elementOfParent = source.tree.getParent(source.lighterASTNode) ?: source.lighterASTNode + val elementOfParent = source.treeStructure.getParent(source.lighterASTNode) ?: source.lighterASTNode - elementOfParent.toFirLightSourceElement(elementOfParent.startOffset, elementOfParent.endOffset, source.tree) + elementOfParent.toFirLightSourceElement(elementOfParent.startOffset, elementOfParent.endOffset, source.treeStructure) } else -> source diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationClassDeclarationChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationClassDeclarationChecker.kt index 83c75be6085..124933ff5ed 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationClassDeclarationChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationClassDeclarationChecker.kt @@ -53,7 +53,7 @@ object FirAnnotationClassDeclarationChecker : FirBasicDeclarationChecker() { } is FirLightSourceElement -> { val kidsRef = Ref>() - parameterSourceElement.tree.getChildren(parameterSourceElement.lighterASTNode, kidsRef) + parameterSourceElement.treeStructure.getChildren(parameterSourceElement.lighterASTNode, kidsRef) if (kidsRef.get().any { it?.tokenType == VAR_KEYWORD }) reporter.report(parameterSourceElement, FirErrors.VAR_ANNOTATION_PARAMETER) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirConstructorInInterfaceChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirConstructorInInterfaceChecker.kt index 7ada834666c..36caea305fe 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirConstructorInInterfaceChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirConstructorInInterfaceChecker.kt @@ -40,7 +40,7 @@ object FirConstructorInInterfaceChecker : FirBasicDeclarationChecker() { if (localPsi != null && localPsi !is PsiErrorElement) { return localPsi.hasPrimaryConstructor() } else if (this is FirLightSourceElement) { - return localLightNode.hasPrimaryConstructor(tree) + return localLightNode.hasPrimaryConstructor(treeStructure) } return false diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDelegationInInterfaceChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDelegationInInterfaceChecker.kt index c98213ba7fd..476966fbe53 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDelegationInInterfaceChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDelegationInInterfaceChecker.kt @@ -40,7 +40,7 @@ object FirDelegationInInterfaceChecker : FirMemberDeclarationChecker() { if (localPsi != null && localPsi !is PsiErrorElement) { return localPsi.findSuperTypeDelegation() } else if (this is FirLightSourceElement) { - return localLightNode.findSuperTypeDelegation(tree) + return localLightNode.findSuperTypeDelegation(treeStructure) } return -1 diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirExposedVisibilityDeclarationChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirExposedVisibilityDeclarationChecker.kt index 46b8c798cbb..ea7ad8510fa 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirExposedVisibilityDeclarationChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirExposedVisibilityDeclarationChecker.kt @@ -234,9 +234,9 @@ object FirExposedVisibilityDeclarationChecker : FirMemberDeclarationChecker() { is FirPsiSourceElement<*> -> (this.psi as? PsiNameIdentifierOwner)?.nameIdentifier?.toFirPsiSourceElement() is FirLightSourceElement -> { val kidsRef = Ref>() - this.tree.getChildren(lighterASTNode, kidsRef) + this.treeStructure.getChildren(lighterASTNode, kidsRef) val identifier = kidsRef.get().find { it?.tokenType == KtTokens.IDENTIFIER } - identifier?.toFirLightSourceElement(this.tree.getStartOffset(identifier), this.tree.getEndOffset(identifier), this.tree) + identifier?.toFirLightSourceElement(this.treeStructure.getStartOffset(identifier), this.treeStructure.getEndOffset(identifier), this.treeStructure) } } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedInInterfaceChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedInInterfaceChecker.kt index b69a4575cdc..6a1a4deb5d6 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedInInterfaceChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedInInterfaceChecker.kt @@ -40,7 +40,7 @@ object FirSupertypeInitializedInInterfaceChecker : FirMemberDeclarationChecker() if (localPsi != null && localPsi !is PsiErrorElement) { return localPsi.findSuperTypeCall() } else if (this is FirLightSourceElement) { - return localLightNode.findSuperTypeCall(tree) + return localLightNode.findSuperTypeCall(treeStructure) } return -1 diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedWithoutPrimaryConstructor.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedWithoutPrimaryConstructor.kt index 898935b1019..b3f44874443 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedWithoutPrimaryConstructor.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedWithoutPrimaryConstructor.kt @@ -44,7 +44,7 @@ object FirSupertypeInitializedWithoutPrimaryConstructor : FirMemberDeclarationCh if (localPsi != null && localPsi !is PsiErrorElement) { return localPsi.anySupertypeHasConstructorParentheses() } else if (this is FirLightSourceElement) { - return localLightNode.anySupertypeHasConstructorParentheses(tree) + return localLightNode.anySupertypeHasConstructorParentheses(treeStructure) } return false diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirTypeArgumentsNotAllowedExpressionChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirTypeArgumentsNotAllowedExpressionChecker.kt index b902ba825ef..0e3f306a8ba 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirTypeArgumentsNotAllowedExpressionChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirTypeArgumentsNotAllowedExpressionChecker.kt @@ -42,7 +42,7 @@ object FirTypeArgumentsNotAllowedExpressionChecker : FirQualifiedAccessChecker() if (localPsi != null && localPsi !is PsiErrorElement) { return localPsi.hasAnyArguments() } else if (this is FirLightSourceElement) { - return localLight.hasAnyArguments(this.tree) + return localLight.hasAnyArguments(this.treeStructure) } return false diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeReplacedWithOperatorAssignmentChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeReplacedWithOperatorAssignmentChecker.kt index 873695acb44..0486053f2f3 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeReplacedWithOperatorAssignmentChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeReplacedWithOperatorAssignmentChecker.kt @@ -71,7 +71,7 @@ object CanBeReplacedWithOperatorAssignmentChecker : FirExpressionChecker>() tree.getChildren(expression, childrenNullable) val children = childrenNullable.get().filterNotNull() diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeValChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeValChecker.kt index c746feb47e7..1ed0369812b 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeValChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeValChecker.kt @@ -102,7 +102,7 @@ object CanBeValChecker : AbstractFirPropertyInitializationChecker() { is FirPsiSourceElement<*> -> fir.psi?.children?.size?.minus(1) // -1 cuz we don't need expression node after equals operator is FirLightSourceElement -> { val source = fir.source as FirLightSourceElement - val tree = (fir.source as FirLightSourceElement).tree + val tree = (fir.source as FirLightSourceElement).treeStructure val children = Ref>() tree.getChildren(source.lighterASTNode, children) children.get().filterNotNull().filter { it.tokenType == KtNodeTypes.DESTRUCTURING_DECLARATION_ENTRY }.size diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantSingleExpressionStringTemplateChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantSingleExpressionStringTemplateChecker.kt index 301e9f554fe..be4b8c50a43 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantSingleExpressionStringTemplateChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantSingleExpressionStringTemplateChecker.kt @@ -54,10 +54,10 @@ object RedundantSingleExpressionStringTemplateChecker : FirBasicExpressionChecke } private fun LighterASTNode.stringParentChildrenCount(source: FirLightSourceElement): Int? { - val parent = source.tree.getParent(this) + val parent = source.treeStructure.getParent(this) return if (parent?.tokenType == KtNodeTypes.STRING_TEMPLATE) { val childrenOfParent = Ref>() - source.tree.getChildren(parent!!, childrenOfParent) + source.treeStructure.getChildren(parent!!, childrenOfParent) childrenOfParent.get().filter { it is PsiBuilder.Marker }.size } else { parent?.stringParentChildrenCount(source) diff --git a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/ValueParameter.kt b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/ValueParameter.kt index a579dbd9a7c..9573f985fba 100644 --- a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/ValueParameter.kt +++ b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/ValueParameter.kt @@ -46,7 +46,7 @@ class ValueParameter( val parameterSource = firValueParameter.source as? FirLightSourceElement val parameterNode = parameterSource?.lighterASTNode source = parameterNode?.toFirLightSourceElement( - parameterSource.startOffset, parameterSource.endOffset, parameterSource.tree, + parameterSource.startOffset, parameterSource.endOffset, parameterSource.treeStructure, FirFakeSourceElementKind.PropertyFromParameter ) this.session = session diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt index 4ab52409b97..b4ac9b28b32 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt @@ -7,7 +7,9 @@ package org.jetbrains.kotlin.fir import com.intellij.lang.LighterASTNode import com.intellij.lang.TreeBackedLighterAST +import com.intellij.openapi.util.Ref import com.intellij.psi.PsiElement +import com.intellij.psi.PsiFile import com.intellij.psi.tree.IElementType import com.intellij.util.diff.FlyweightCapableTreeStructure @@ -154,6 +156,7 @@ sealed class FirSourceElement { abstract val endOffset: Int abstract val kind: FirSourceElementKind abstract val lighterASTNode: LighterASTNode + abstract val treeStructure: FlyweightCapableTreeStructure } // NB: in certain situations, psi.node could be null @@ -169,6 +172,37 @@ sealed class FirPsiSourceElement(val psi: P) : FirSourceElem get() = psi.textRange.endOffset override val lighterASTNode by lazy { TreeBackedLighterAST.wrap(psi.node) } + + override val treeStructure: FlyweightCapableTreeStructure by lazy { WrappedTreeStructure(psi.containingFile) } + + private class WrappedTreeStructure(file: PsiFile) : FlyweightCapableTreeStructure { + private val lighterAST = TreeBackedLighterAST(file.node) + + private fun LighterASTNode.unwrap() = lighterAST.unwrap(this) + + override fun toString(node: LighterASTNode): CharSequence = node.unwrap().text + + override fun getRoot(): LighterASTNode = lighterAST.root + + override fun getParent(node: LighterASTNode): LighterASTNode? = node.unwrap().psi.parent?.node?.let { TreeBackedLighterAST.wrap(it) } + + override fun getChildren(node: LighterASTNode, nodesRef: Ref>): Int { + val children = node.unwrap().psi.children + if (children.isEmpty()) { + nodesRef.set(LighterASTNode.EMPTY_ARRAY) + } else { + nodesRef.set(children.map { TreeBackedLighterAST.wrap(it.node) }.toTypedArray()) + } + return children.size + } + + override fun disposeChildren(p0: Array?, p1: Int) { + } + + override fun getStartOffset(node: LighterASTNode): Int = node.unwrap().startOffset + + override fun getEndOffset(node: LighterASTNode): Int = node.unwrap().let { it.startOffset + it.textLength - 1 } + } } class FirRealPsiSourceElement(psi: P) : FirPsiSourceElement

(psi) { @@ -179,7 +213,7 @@ class FirFakeSourceElement(psi: P, override val kind: FirFak fun FirSourceElement.fakeElement(newKind: FirFakeSourceElementKind): FirSourceElement { return when (this) { - is FirLightSourceElement -> FirLightSourceElement(lighterASTNode, startOffset, endOffset, tree, newKind) + is FirLightSourceElement -> FirLightSourceElement(lighterASTNode, startOffset, endOffset, treeStructure, newKind) is FirPsiSourceElement<*> -> FirFakeSourceElement(psi, newKind) } } @@ -188,7 +222,7 @@ class FirLightSourceElement( override val lighterASTNode: LighterASTNode, override val startOffset: Int, override val endOffset: Int, - val tree: FlyweightCapableTreeStructure, + override val treeStructure: FlyweightCapableTreeStructure, override val kind: FirSourceElementKind = FirRealSourceElementKind, ) : FirSourceElement() { override val elementType: IElementType From d942780c14faa3ad5f85c8f9dc84179849954bac Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 17 Nov 2020 10:40:13 +0300 Subject: [PATCH 204/698] [FIR] Introduce LightTreePositioningStrategy --- .../diagnostics/FirDiagnosticFactory.kt | 33 ++++++++++++++----- .../LightTreePositioningStrategy.kt | 29 ++++++++++++++++ 2 files changed, 54 insertions(+), 8 deletions(-) create mode 100644 compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategy.kt diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactory.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactory.kt index 9cfdda9721c..22eeb664358 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactory.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactory.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir.analysis.diagnostics +import com.intellij.openapi.util.TextRange import com.intellij.psi.PsiElement import org.jetbrains.kotlin.diagnostics.* import org.jetbrains.kotlin.fir.FirLightSourceElement @@ -16,19 +17,26 @@ import org.jetbrains.kotlin.fir.FirSourceElement sealed class AbstractFirDiagnosticFactory>( val name: String, val severity: Severity, + val positioningStrategy: LightTreePositioningStrategy, ) { abstract val psiDiagnosticFactory: DiagnosticFactoryWithPsiElement<*, *> abstract val defaultRenderer: FirDiagnosticRenderer<*> + fun getTextRanges(diagnostic: FirDiagnostic<*>): List = + positioningStrategy.markDiagnostic(diagnostic) + override fun toString(): String { return name } } class FirDiagnosticFactory0( - name: String, severity: Severity, override val psiDiagnosticFactory: DiagnosticFactory0

-) : AbstractFirDiagnosticFactory>(name, severity) { + name: String, + severity: Severity, + override val psiDiagnosticFactory: DiagnosticFactory0

, + positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT, +) : AbstractFirDiagnosticFactory>(name, severity, positioningStrategy) { companion object { private val DefaultRenderer = SimpleFirDiagnosticRenderer("") } @@ -48,8 +56,11 @@ class FirDiagnosticFactory0( } class FirDiagnosticFactory1( - name: String, severity: Severity, override val psiDiagnosticFactory: DiagnosticFactory1 -) : AbstractFirDiagnosticFactory>(name, severity) { + name: String, + severity: Severity, + override val psiDiagnosticFactory: DiagnosticFactory1, + positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT, +) : AbstractFirDiagnosticFactory>(name, severity, positioningStrategy) { companion object { private val DefaultRenderer = FirDiagnosticWithParameters1Renderer( "{0}", @@ -72,8 +83,11 @@ class FirDiagnosticFactory1( } class FirDiagnosticFactory2( - name: String, severity: Severity, override val psiDiagnosticFactory: DiagnosticFactory2 -) : AbstractFirDiagnosticFactory>(name, severity) { + name: String, + severity: Severity, + override val psiDiagnosticFactory: DiagnosticFactory2, + positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT, +) : AbstractFirDiagnosticFactory>(name, severity, positioningStrategy) { companion object { private val DefaultRenderer = FirDiagnosticWithParameters2Renderer( "{0}, {1}", @@ -97,8 +111,11 @@ class FirDiagnosticFactory2( - name: String, severity: Severity, override val psiDiagnosticFactory: DiagnosticFactory3 -) : AbstractFirDiagnosticFactory>(name, severity) { + name: String, + severity: Severity, + override val psiDiagnosticFactory: DiagnosticFactory3, + positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT, +) : AbstractFirDiagnosticFactory>(name, severity, positioningStrategy) { companion object { private val DefaultRenderer = FirDiagnosticWithParameters3Renderer( "{0}, {1}, {2}", diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategy.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategy.kt new file mode 100644 index 00000000000..9c3206c5c24 --- /dev/null +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategy.kt @@ -0,0 +1,29 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.fir.analysis.diagnostics + +import com.intellij.lang.LighterASTNode +import com.intellij.openapi.util.TextRange +import com.intellij.util.diff.FlyweightCapableTreeStructure + +open class LightTreePositioningStrategy { + open fun markDiagnostic(diagnostic: FirDiagnostic<*>): List { + val element = diagnostic.element + return mark(element.lighterASTNode, element.treeStructure) + } + + open fun mark(node: LighterASTNode, tree: FlyweightCapableTreeStructure): List { + return markElement(node, tree) + } + + companion object { + val DEFAULT = LightTreePositioningStrategy() + } +} + +fun markElement(node: LighterASTNode, tree: FlyweightCapableTreeStructure): List { + return listOf(TextRange(tree.getStartOffset(node), tree.getEndOffset(node))) +} From b6cfcc6cadac3daa9bfbfc1a5c33ed8abf4f6b83 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 17 Nov 2020 10:45:35 +0300 Subject: [PATCH 205/698] Rename Diagnostic.java to Diagnostic.kt --- .../kotlin/diagnostics/{Diagnostic.java => Diagnostic.kt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename compiler/frontend/src/org/jetbrains/kotlin/diagnostics/{Diagnostic.java => Diagnostic.kt} (100%) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Diagnostic.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Diagnostic.kt similarity index 100% rename from compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Diagnostic.java rename to compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Diagnostic.kt From 9040999b55ad4f5873518c23ae97b2801a3c1085 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 17 Nov 2020 10:45:36 +0300 Subject: [PATCH 206/698] Convert Diagnostic.java to Kotlin --- .../kotlin/diagnostics/Diagnostic.kt | 39 ++++++------------- 1 file changed, 12 insertions(+), 27 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Diagnostic.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Diagnostic.kt index 248c60d2e57..0a832d10a7b 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Diagnostic.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Diagnostic.kt @@ -13,32 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +package org.jetbrains.kotlin.diagnostics -package org.jetbrains.kotlin.diagnostics; +import com.intellij.openapi.util.TextRange +import com.intellij.psi.PsiElement +import com.intellij.psi.PsiFile -import com.intellij.openapi.util.TextRange; -import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiFile; -import org.jetbrains.annotations.NotNull; - -import java.util.List; - -public interface Diagnostic { - - @NotNull - DiagnosticFactory getFactory(); - - @NotNull - Severity getSeverity(); - - @NotNull - PsiElement getPsiElement(); - - @NotNull - List getTextRanges(); - - @NotNull - PsiFile getPsiFile(); - - boolean isValid(); -} +interface Diagnostic { + val factory: DiagnosticFactory<*> + val severity: Severity + val psiElement: PsiElement + val textRanges: List + val psiFile: PsiFile + val isValid: Boolean +} \ No newline at end of file From 84f3a4ba9d7aadfbaab1718c1ac608bee6e6bb39 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 17 Nov 2020 10:57:28 +0300 Subject: [PATCH 207/698] Rename DiagnosticFactory.java to DiagnosticFactory.kt --- .../diagnostics/{DiagnosticFactory.java => DiagnosticFactory.kt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename compiler/frontend/src/org/jetbrains/kotlin/diagnostics/{DiagnosticFactory.java => DiagnosticFactory.kt} (100%) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/DiagnosticFactory.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/DiagnosticFactory.kt similarity index 100% rename from compiler/frontend/src/org/jetbrains/kotlin/diagnostics/DiagnosticFactory.java rename to compiler/frontend/src/org/jetbrains/kotlin/diagnostics/DiagnosticFactory.kt From d47e16331c16747f79b6513dfbc9eaa8788c84dd Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 17 Nov 2020 10:57:29 +0300 Subject: [PATCH 208/698] Convert DiagnosticFactory.java to Kotlin --- .../kotlin/diagnostics/DiagnosticFactory.kt | 92 ++++++------------- 1 file changed, 26 insertions(+), 66 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/DiagnosticFactory.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/DiagnosticFactory.kt index cf727e2830f..9ed41ca5589 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/DiagnosticFactory.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/DiagnosticFactory.kt @@ -13,82 +13,42 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +package org.jetbrains.kotlin.diagnostics -package org.jetbrains.kotlin.diagnostics; +import org.jetbrains.kotlin.diagnostics.rendering.DiagnosticRenderer +import java.lang.IllegalArgumentException +import java.lang.SafeVarargs -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.diagnostics.rendering.DiagnosticRenderer; +abstract class DiagnosticFactory protected constructor( + open var name: String?, + open val severity: Severity +) { -import java.util.Arrays; -import java.util.Collection; + open var defaultRenderer: DiagnosticRenderer? = null -public abstract class DiagnosticFactory { + protected constructor(severity: Severity) : this(null, severity) - private String name = null; - private final Severity severity; - - private DiagnosticRenderer defaultRenderer; - - protected DiagnosticFactory(@NotNull Severity severity) { - this.severity = severity; + fun cast(diagnostic: Diagnostic): D { + require(!(diagnostic.factory !== this)) { "Factory mismatch: expected " + this + " but was " + diagnostic.factory } + @Suppress("UNCHECKED_CAST") + return diagnostic as D } - protected DiagnosticFactory(@NotNull String name, @NotNull Severity severity) { - this.name = name; - this.severity = severity; + override fun toString(): String { + return name ?: "" } - /*package*/ void setName(@NotNull String name) { - this.name = name; - } - - @NotNull - public String getName() { - return name; - } - - @NotNull - public Severity getSeverity() { - return severity; - } - - @Nullable - public DiagnosticRenderer getDefaultRenderer() { - return defaultRenderer; - } - - void setDefaultRenderer(@Nullable DiagnosticRenderer defaultRenderer) { - this.defaultRenderer = defaultRenderer; - } - - @NotNull - @SuppressWarnings("unchecked") - public D cast(@NotNull Diagnostic diagnostic) { - if (diagnostic.getFactory() != this) { - throw new IllegalArgumentException("Factory mismatch: expected " + this + " but was " + diagnostic.getFactory()); + companion object { + @SafeVarargs + fun cast(diagnostic: Diagnostic, vararg factories: DiagnosticFactory): D { + return cast(diagnostic, listOf(*factories)) } - return (D) diagnostic; - } - - @NotNull - @SafeVarargs - public static D cast(@NotNull Diagnostic diagnostic, @NotNull DiagnosticFactory... factories) { - return cast(diagnostic, Arrays.asList(factories)); - } - - @NotNull - public static D cast(@NotNull Diagnostic diagnostic, @NotNull Collection> factories) { - for (DiagnosticFactory factory : factories) { - if (diagnostic.getFactory() == factory) return factory.cast(diagnostic); + fun cast(diagnostic: Diagnostic, factories: Collection>): D { + for (factory in factories) { + if (diagnostic.factory === factory) return factory.cast(diagnostic) + } + throw IllegalArgumentException("Factory mismatch: expected one of " + factories + " but was " + diagnostic.factory) } - - throw new IllegalArgumentException("Factory mismatch: expected one of " + factories + " but was " + diagnostic.getFactory()); } - - @Override - public String toString() { - return getName(); - } -} +} \ No newline at end of file From 1795c4f3e57b3cdd2eca1ad29de8fc52be03a65d Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 17 Nov 2020 12:22:13 +0300 Subject: [PATCH 209/698] Implement common Diagnostic(Factory/Renderer) in related FIR classes --- .../messages/AnalyzerWithCompilerReport.kt | 2 +- .../messages/DefaultDiagnosticReporter.kt | 4 +- .../messages/DefaultDiagnosticReporter.kt.202 | 4 +- .../messages/DiagnosticMessageReporter.kt | 2 +- .../compiler/KotlinToJVMBytecodeCompiler.kt | 28 +------ .../diagnostics/FirDefaultErrorMessages.kt | 2 +- .../fir/analysis/diagnostics/FirDiagnostic.kt | 57 +++++++------- .../diagnostics/FirDiagnosticFactory.kt | 78 +++++++------------ .../diagnostics/FirDiagnosticFactoryDsl.kt | 72 ++++++----------- .../FirDiagnosticFactoryToRendererMap.kt | 30 ++++--- .../diagnostics/FirDiagnosticRenderer.kt | 47 ++++------- .../fir/analysis/diagnostics/FirErrors.kt | 35 ++++----- .../jetbrains/kotlin/fir/FirSourceElement.kt | 5 +- .../checkers/diagnostics/ActualDiagnostic.kt | 4 +- .../diagnostics/DiagnosticForTests.kt | 30 +++---- .../factories/DebugInfoDiagnosticFactory0.kt | 27 ++----- .../factories/DebugInfoDiagnosticFactory1.kt | 22 +++--- .../factories/SyntaxErrorDiagnosticFactory.kt | 6 +- .../kotlin/diagnostics/Diagnostic.kt | 2 +- .../kotlin/diagnostics/DiagnosticUtils.java | 17 +++- .../diagnostics/KotlinSuppressCache.kt | 2 +- .../asJava/duplicateJvmSignatureUtil.kt | 33 ++++---- .../fir/AbstractFirBaseDiagnosticsTest.kt | 4 +- .../kotlin/fir/AbstractFirDiagnosticTest.kt | 26 +++---- ...AbstractFirDiagnosticsWithLightTreeTest.kt | 2 +- .../validators/DiagnosticTestTypeValidator.kt | 4 +- .../kotlin/resolve/MutableDiagnosticsTest.kt | 19 +++-- .../highlighter/AnnotationPresentationInfo.kt | 2 +- .../KotlinSuppressableWarningProblemGroup.kt | 2 +- .../AbstractFirIdeDiagnosticsCollector.kt | 2 +- .../idea/internal/KotlinBytecodeToolWindow.kt | 2 +- .../MigrateDiagnosticSuppressionInspection.kt | 2 +- .../quickfix/AddFunctionToSupertypeFix.kt | 2 +- .../quickfix/AddPropertyToSupertypeFix.kt | 2 +- ...AbstractCodeMetaInfoRenderConfiguration.kt | 2 +- .../messages/IdeDiagnosticMessageHolder.kt | 2 +- 36 files changed, 232 insertions(+), 350 deletions(-) diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/AnalyzerWithCompilerReport.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/AnalyzerWithCompilerReport.kt index 99cc012be97..a84d6d49975 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/AnalyzerWithCompilerReport.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/AnalyzerWithCompilerReport.kt @@ -128,7 +128,7 @@ class AnalyzerWithCompilerReport( psiElement: E, factory: DiagnosticFactory0, val message: String ) : SimpleDiagnostic(psiElement, factory, Severity.ERROR) { - override fun isValid(): Boolean = true + override val isValid: Boolean = true } companion object { diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt index 2d82644bf95..f7b8e272c98 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt @@ -28,9 +28,9 @@ class DefaultDiagnosticReporter(override val messageCollector: MessageCollector) interface MessageCollectorBasedReporter : DiagnosticMessageReporter { val messageCollector: MessageCollector - override fun report(diagnostic: Diagnostic, file: PsiFile, render: String) = messageCollector.report( + override fun report(diagnostic: Diagnostic, file: PsiFile?, render: String) = messageCollector.report( AnalyzerWithCompilerReport.convertSeverity(diagnostic.severity), render, - MessageUtil.psiFileToMessageLocation(file, file.name, DiagnosticUtils.getLineAndColumnRange(diagnostic)) + MessageUtil.psiFileToMessageLocation(file!!, file.name, DiagnosticUtils.getLineAndColumnRange(diagnostic)) ) } diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt.202 b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt.202 index f560fc945f3..73085c2317f 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt.202 +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt.202 @@ -28,9 +28,9 @@ class DefaultDiagnosticReporter(override val messageCollector: MessageCollector) interface MessageCollectorBasedReporter : DiagnosticMessageReporter { val messageCollector: MessageCollector - override fun report(diagnostic: Diagnostic, file: PsiFile, render: String) = messageCollector.report( + override fun report(diagnostic: Diagnostic, file: PsiFile?, render: String) = messageCollector.report( AnalyzerWithCompilerReport.convertSeverity(diagnostic.severity), render, - MessageUtil.psiFileToMessageLocation(file, file.name, DiagnosticUtils.getLineAndColumn(diagnostic)) + MessageUtil.psiFileToMessageLocation(file!!, file.name, DiagnosticUtils.getLineAndColumn(diagnostic)) ) } diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DiagnosticMessageReporter.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DiagnosticMessageReporter.kt index 246781e6187..4b6be982707 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DiagnosticMessageReporter.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DiagnosticMessageReporter.kt @@ -20,5 +20,5 @@ import com.intellij.psi.PsiFile import org.jetbrains.kotlin.diagnostics.Diagnostic interface DiagnosticMessageReporter { - fun report(diagnostic: Diagnostic, file: PsiFile, render: String) + fun report(diagnostic: Diagnostic, file: PsiFile?, render: String) } diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt index a5a872f861a..2bd41eda42c 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt @@ -343,9 +343,7 @@ object KotlinToJVMBytecodeCompiler { firAnalyzerFacade.runResolution() val firDiagnostics = firAnalyzerFacade.runCheckers().values.flatten() AnalyzerWithCompilerReport.reportDiagnostics( - SimpleDiagnostics( - firDiagnostics.map { it.toRegularDiagnostic() } - ), + SimpleDiagnostics(firDiagnostics), environment.messageCollector ) performanceManager?.notifyAnalysisFinished() @@ -429,30 +427,6 @@ object KotlinToJVMBytecodeCompiler { return writeOutputs(environment, projectConfiguration, chunk, outputs, mainClassFqName) } - private fun FirDiagnostic<*>.toRegularDiagnostic(): Diagnostic { - val psiSource = element as FirPsiSourceElement<*> - @Suppress("UNCHECKED_CAST") - when (this) { - is FirSimpleDiagnostic -> - return SimpleDiagnostic( - psiSource.psi, factory.psiDiagnosticFactory as DiagnosticFactory0, severity - ) - is FirDiagnosticWithParameters1<*, *> -> - return DiagnosticWithParameters1( - psiSource.psi, this.a, factory.psiDiagnosticFactory as DiagnosticFactory1, severity - ) - is FirDiagnosticWithParameters2<*, *, *> -> - return DiagnosticWithParameters2( - psiSource.psi, this.a, this.b, factory.psiDiagnosticFactory as DiagnosticFactory2, severity - ) - is FirDiagnosticWithParameters3<*, *, *, *> -> - return DiagnosticWithParameters3( - psiSource.psi, this.a, this.b, this.c, - factory.psiDiagnosticFactory as DiagnosticFactory3, severity - ) - } - } - private fun getBuildFilePaths(buildFile: File?, sourceFilePaths: List): List = if (buildFile == null) sourceFilePaths else sourceFilePaths.map { path -> diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDefaultErrorMessages.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDefaultErrorMessages.kt index 3a32d8fd51e..cf74faad14e 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDefaultErrorMessages.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDefaultErrorMessages.kt @@ -129,7 +129,7 @@ class FirDefaultErrorMessages : DefaultErrorMessages.Extension { companion object { fun getRendererForDiagnostic(diagnostic: FirDiagnostic<*>): FirDiagnosticRenderer<*> { val factory = diagnostic.factory - return MAP[factory] ?: factory.defaultRenderer + return MAP[factory] ?: factory.firRenderer } // * - The old FE reports these diagnostics with additional parameters diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnostic.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnostic.kt index 72836096b24..96cb228f5ba 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnostic.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnostic.kt @@ -5,7 +5,9 @@ package org.jetbrains.kotlin.fir.analysis.diagnostics +import com.intellij.openapi.util.TextRange import com.intellij.psi.PsiElement +import com.intellij.psi.PsiFile import org.jetbrains.kotlin.diagnostics.Diagnostic import org.jetbrains.kotlin.diagnostics.Severity import org.jetbrains.kotlin.fir.FirLightSourceElement @@ -14,10 +16,16 @@ import org.jetbrains.kotlin.fir.FirSourceElement // ------------------------------ diagnostics ------------------------------ -sealed class FirDiagnostic { +sealed class FirDiagnostic : Diagnostic { abstract val element: E - abstract val severity: Severity - abstract val factory: AbstractFirDiagnosticFactory<*, *> + abstract override val severity: Severity + abstract override val factory: AbstractFirDiagnosticFactory<*, *> + + override val textRanges: List + get() = factory.getTextRanges(this) + + override val isValid: Boolean + get() = true } sealed class FirSimpleDiagnostic : FirDiagnostic() { @@ -44,31 +52,28 @@ sealed class FirDiagnosticWithParameters3 { - fun asPsiBasedDiagnostic(): Diagnostic +interface FirPsiDiagnostic

: Diagnostic { val element: FirPsiSourceElement

+ + override val psiElement: PsiElement + get() = element.psi + + override val psiFile: PsiFile + get() = psiElement.containingFile } data class FirPsiSimpleDiagnostic

( override val element: FirPsiSourceElement

, override val severity: Severity, override val factory: FirDiagnosticFactory0, P> -) : FirSimpleDiagnostic>(), FirPsiDiagnostic

{ - override fun asPsiBasedDiagnostic(): Diagnostic { - return factory.psiDiagnosticFactory.on(element.psi) - } -} +) : FirSimpleDiagnostic>(), FirPsiDiagnostic

data class FirPsiDiagnosticWithParameters1

( override val element: FirPsiSourceElement

, override val a: A, override val severity: Severity, override val factory: FirDiagnosticFactory1, P, A> -) : FirDiagnosticWithParameters1, A>(), FirPsiDiagnostic

{ - override fun asPsiBasedDiagnostic(): Diagnostic { - return factory.psiDiagnosticFactory.on(element.psi, a) - } -} +) : FirDiagnosticWithParameters1, A>(), FirPsiDiagnostic

data class FirPsiDiagnosticWithParameters2

( override val element: FirPsiSourceElement

, @@ -76,11 +81,7 @@ data class FirPsiDiagnosticWithParameters2

( override val b: B, override val severity: Severity, override val factory: FirDiagnosticFactory2, P, A, B> -) : FirDiagnosticWithParameters2, A, B>(), FirPsiDiagnostic

{ - override fun asPsiBasedDiagnostic(): Diagnostic { - return factory.psiDiagnosticFactory.on(element.psi, a, b) - } -} +) : FirDiagnosticWithParameters2, A, B>(), FirPsiDiagnostic

data class FirPsiDiagnosticWithParameters3

( override val element: FirPsiSourceElement

, @@ -89,16 +90,20 @@ data class FirPsiDiagnosticWithParameters3

, P, A, B, C> -) : FirDiagnosticWithParameters3, A, B, C>(), FirPsiDiagnostic

{ - override fun asPsiBasedDiagnostic(): Diagnostic { - return factory.psiDiagnosticFactory.on(element.psi, a, b, c) - } -} +) : FirDiagnosticWithParameters3, A, B, C>(), FirPsiDiagnostic

// ------------------------------ light tree diagnostics ------------------------------ -interface FirLightDiagnostic { +interface FirLightDiagnostic : Diagnostic { val element: FirLightSourceElement + + override val psiElement: PsiElement + get() { + throw UnsupportedOperationException("Light diagnostic does not hold PSI element") + } + + override val psiFile: PsiFile? + get() = null } data class FirLightSimpleDiagnostic( diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactory.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactory.kt index 22eeb664358..e8dae007b45 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactory.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactory.kt @@ -10,39 +10,33 @@ package org.jetbrains.kotlin.fir.analysis.diagnostics import com.intellij.openapi.util.TextRange import com.intellij.psi.PsiElement import org.jetbrains.kotlin.diagnostics.* +import org.jetbrains.kotlin.diagnostics.rendering.DiagnosticRenderer import org.jetbrains.kotlin.fir.FirLightSourceElement import org.jetbrains.kotlin.fir.FirPsiSourceElement import org.jetbrains.kotlin.fir.FirSourceElement sealed class AbstractFirDiagnosticFactory>( - val name: String, - val severity: Severity, + override var name: String?, + override val severity: Severity, val positioningStrategy: LightTreePositioningStrategy, -) { - abstract val psiDiagnosticFactory: DiagnosticFactoryWithPsiElement<*, *> +) : DiagnosticFactory(name, severity) { + abstract val firRenderer: FirDiagnosticRenderer - abstract val defaultRenderer: FirDiagnosticRenderer<*> + override var defaultRenderer: DiagnosticRenderer? + get() = firRenderer + set(_) { + } fun getTextRanges(diagnostic: FirDiagnostic<*>): List = positioningStrategy.markDiagnostic(diagnostic) - - override fun toString(): String { - return name - } } class FirDiagnosticFactory0( name: String, severity: Severity, - override val psiDiagnosticFactory: DiagnosticFactory0

, positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT, ) : AbstractFirDiagnosticFactory>(name, severity, positioningStrategy) { - companion object { - private val DefaultRenderer = SimpleFirDiagnosticRenderer("") - } - - override val defaultRenderer: FirDiagnosticRenderer<*> - get() = DefaultRenderer + override val firRenderer: FirDiagnosticRenderer> = SimpleFirDiagnosticRenderer("") fun on(element: E): FirSimpleDiagnostic { return when (element) { @@ -58,18 +52,12 @@ class FirDiagnosticFactory0( class FirDiagnosticFactory1( name: String, severity: Severity, - override val psiDiagnosticFactory: DiagnosticFactory1, positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT, ) : AbstractFirDiagnosticFactory>(name, severity, positioningStrategy) { - companion object { - private val DefaultRenderer = FirDiagnosticWithParameters1Renderer( - "{0}", - FirDiagnosticRenderers.TO_STRING - ) - } - - override val defaultRenderer: FirDiagnosticRenderer<*> - get() = DefaultRenderer + override val firRenderer: FirDiagnosticRenderer> = FirDiagnosticWithParameters1Renderer( + "{0}", + FirDiagnosticRenderers.TO_STRING + ) fun on(element: E, a: A): FirDiagnosticWithParameters1 { return when (element) { @@ -85,19 +73,13 @@ class FirDiagnosticFactory1( class FirDiagnosticFactory2( name: String, severity: Severity, - override val psiDiagnosticFactory: DiagnosticFactory2, positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT, ) : AbstractFirDiagnosticFactory>(name, severity, positioningStrategy) { - companion object { - private val DefaultRenderer = FirDiagnosticWithParameters2Renderer( - "{0}, {1}", - FirDiagnosticRenderers.TO_STRING, - FirDiagnosticRenderers.TO_STRING - ) - } - - override val defaultRenderer: FirDiagnosticRenderer<*> - get() = DefaultRenderer + override val firRenderer: FirDiagnosticRenderer> = FirDiagnosticWithParameters2Renderer( + "{0}, {1}", + FirDiagnosticRenderers.TO_STRING, + FirDiagnosticRenderers.TO_STRING + ) fun on(element: E, a: A, b: B): FirDiagnosticWithParameters2 { return when (element) { @@ -113,20 +95,14 @@ class FirDiagnosticFactory2( name: String, severity: Severity, - override val psiDiagnosticFactory: DiagnosticFactory3, positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT, ) : AbstractFirDiagnosticFactory>(name, severity, positioningStrategy) { - companion object { - private val DefaultRenderer = FirDiagnosticWithParameters3Renderer( - "{0}, {1}, {2}", - FirDiagnosticRenderers.TO_STRING, - FirDiagnosticRenderers.TO_STRING, - FirDiagnosticRenderers.TO_STRING - ) - } - - override val defaultRenderer: FirDiagnosticRenderer<*> - get() = DefaultRenderer + override val firRenderer: FirDiagnosticRenderer> = FirDiagnosticWithParameters3Renderer( + "{0}, {1}, {2}", + FirDiagnosticRenderers.TO_STRING, + FirDiagnosticRenderers.TO_STRING, + FirDiagnosticRenderers.TO_STRING + ) fun on(element: E, a: A, b: B, c: C): FirDiagnosticWithParameters3 { return when (element) { @@ -147,7 +123,9 @@ fun FirDiagnosticFactory0.on(elemen return element?.let { on(it) } } -fun FirDiagnosticFactory1.on(element: E?, a: A): FirDiagnosticWithParameters1? { +fun FirDiagnosticFactory1.on( + element: E?, a: A +): FirDiagnosticWithParameters1? { return element?.let { on(it, a) } } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactoryDsl.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactoryDsl.kt index 9188355e41c..5b2fdfd39a6 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactoryDsl.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactoryDsl.kt @@ -12,112 +12,88 @@ import kotlin.properties.ReadOnlyProperty import kotlin.reflect.KProperty fun warning0(): DiagnosticFactory0DelegateProvider { - return DiagnosticFactory0DelegateProvider(Severity.WARNING, null) + return DiagnosticFactory0DelegateProvider(Severity.WARNING) } fun warning1(): DiagnosticFactory1DelegateProvider { - return DiagnosticFactory1DelegateProvider(Severity.WARNING, null) + return DiagnosticFactory1DelegateProvider(Severity.WARNING) } fun warning2(): DiagnosticFactory2DelegateProvider { - return DiagnosticFactory2DelegateProvider(Severity.WARNING, null) + return DiagnosticFactory2DelegateProvider(Severity.WARNING) } fun warning3(): DiagnosticFactory3DelegateProvider { - return DiagnosticFactory3DelegateProvider(Severity.WARNING, null) + return DiagnosticFactory3DelegateProvider(Severity.WARNING) } fun error0(): DiagnosticFactory0DelegateProvider { - return DiagnosticFactory0DelegateProvider(Severity.ERROR, null) + return DiagnosticFactory0DelegateProvider(Severity.ERROR) } fun error1(): DiagnosticFactory1DelegateProvider { - return DiagnosticFactory1DelegateProvider(Severity.ERROR, null) + return DiagnosticFactory1DelegateProvider(Severity.ERROR) } fun error2(): DiagnosticFactory2DelegateProvider { - return DiagnosticFactory2DelegateProvider(Severity.ERROR, null) + return DiagnosticFactory2DelegateProvider(Severity.ERROR) } fun error3(): DiagnosticFactory3DelegateProvider { - return DiagnosticFactory3DelegateProvider(Severity.ERROR, null) + return DiagnosticFactory3DelegateProvider(Severity.ERROR) } /** * Note that those functions can be applicable only for factories * that takes `PsiElement` as first type parameter */ -fun existing( - psiDiagnosticFactory: DiagnosticFactory0

-): DiagnosticFactory0DelegateProvider { - return DiagnosticFactory0DelegateProvider(Severity.ERROR, psiDiagnosticFactory) +fun existing0(): DiagnosticFactory0DelegateProvider { + return DiagnosticFactory0DelegateProvider(Severity.ERROR) } -fun existing( - psiDiagnosticFactory: DiagnosticFactory1 -): DiagnosticFactory1DelegateProvider { - return DiagnosticFactory1DelegateProvider(Severity.ERROR, psiDiagnosticFactory) +fun existing1(): DiagnosticFactory1DelegateProvider { + return DiagnosticFactory1DelegateProvider(Severity.ERROR) } -fun existing( - psiDiagnosticFactory: DiagnosticFactory2 -): DiagnosticFactory2DelegateProvider { - return DiagnosticFactory2DelegateProvider(Severity.ERROR, psiDiagnosticFactory) +fun existing2(): DiagnosticFactory2DelegateProvider { + return DiagnosticFactory2DelegateProvider(Severity.ERROR) } -fun existing( - psiDiagnosticFactory: DiagnosticFactory3 -): DiagnosticFactory3DelegateProvider { - return DiagnosticFactory3DelegateProvider(Severity.ERROR, psiDiagnosticFactory) +fun existing3(): DiagnosticFactory3DelegateProvider { + return DiagnosticFactory3DelegateProvider(Severity.ERROR) } // ------------------------------ Providers ------------------------------ class DiagnosticFactory0DelegateProvider( - private val severity: Severity, - private val psiDiagnosticFactory: DiagnosticFactory0

? + private val severity: Severity ) { operator fun provideDelegate(thisRef: Any?, prop: KProperty<*>): ReadOnlyProperty> { - val psiFactory = psiDiagnosticFactory ?: DiagnosticFactory0.create

(severity).apply { - initializeName(prop.name) - } - return DummyDelegate(FirDiagnosticFactory0(prop.name, severity, psiFactory)) + return DummyDelegate(FirDiagnosticFactory0(prop.name, severity)) } } class DiagnosticFactory1DelegateProvider( - private val severity: Severity, - private val psiDiagnosticFactory: DiagnosticFactory1? + private val severity: Severity ) { operator fun provideDelegate(thisRef: Any?, prop: KProperty<*>): ReadOnlyProperty> { - val psiFactory = psiDiagnosticFactory ?: DiagnosticFactory1.create(severity).apply { - initializeName(prop.name) - } - return DummyDelegate(FirDiagnosticFactory1(prop.name, severity, psiFactory)) + return DummyDelegate(FirDiagnosticFactory1(prop.name, severity)) } } class DiagnosticFactory2DelegateProvider( - private val severity: Severity, - private val psiDiagnosticFactory: DiagnosticFactory2? + private val severity: Severity ) { operator fun provideDelegate(thisRef: Any?, prop: KProperty<*>): ReadOnlyProperty> { - val psiFactory = psiDiagnosticFactory ?: DiagnosticFactory2.create(severity).apply { - initializeName(prop.name) - } - return DummyDelegate(FirDiagnosticFactory2(prop.name, severity, psiFactory)) + return DummyDelegate(FirDiagnosticFactory2(prop.name, severity)) } } class DiagnosticFactory3DelegateProvider( - private val severity: Severity, - private val psiDiagnosticFactory: DiagnosticFactory3? + private val severity: Severity ) { operator fun provideDelegate(thisRef: Any?, prop: KProperty<*>): ReadOnlyProperty> { - val psiFactory = psiDiagnosticFactory ?: DiagnosticFactory3.create(severity).apply { - initializeName(prop.name) - } - return DummyDelegate(FirDiagnosticFactory3(prop.name, severity, psiFactory)) + return DummyDelegate(FirDiagnosticFactory3(prop.name, severity)) } } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactoryToRendererMap.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactoryToRendererMap.kt index 4a845598888..362a11fd8f2 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactoryToRendererMap.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactoryToRendererMap.kt @@ -7,51 +7,47 @@ package org.jetbrains.kotlin.fir.analysis.diagnostics import org.jetbrains.kotlin.diagnostics.rendering.DiagnosticFactoryToRendererMap import org.jetbrains.kotlin.diagnostics.rendering.DiagnosticParameterRenderer -import org.jetbrains.kotlin.diagnostics.rendering.DiagnosticRenderer +import org.jetbrains.kotlin.fir.FirSourceElement class FirDiagnosticFactoryToRendererMap(val name: String) { - private val classicRenderersMap: MutableMap, DiagnosticRenderer<*>> = mutableMapOf() private val renderersMap: MutableMap, FirDiagnosticRenderer<*>> = mutableMapOf() val psiDiagnosticMap: DiagnosticFactoryToRendererMap = DiagnosticFactoryToRendererMap() operator fun get(factory: AbstractFirDiagnosticFactory<*, *>): FirDiagnosticRenderer<*>? = renderersMap[factory] - fun getClassicRenderer(factory: AbstractFirDiagnosticFactory<*, *>): DiagnosticRenderer<*>? = classicRenderersMap[factory] - fun put(factory: FirDiagnosticFactory0<*, *>, message: String) { - put(factory, SimpleFirDiagnosticRenderer(message)) + fun put(factory: FirDiagnosticFactory0, message: String) { + put(factory, SimpleFirDiagnosticRenderer(message)) } - fun put( - factory: FirDiagnosticFactory1<*, *, A>, + fun put( + factory: FirDiagnosticFactory1, message: String, rendererA: DiagnosticParameterRenderer? ) { - put(factory, FirDiagnosticWithParameters1Renderer(message, rendererA)) + put(factory, FirDiagnosticWithParameters1Renderer(message, rendererA)) } - fun put( - factory: FirDiagnosticFactory2<*, *, A, B>, + fun put( + factory: FirDiagnosticFactory2, message: String, rendererA: DiagnosticParameterRenderer?, rendererB: DiagnosticParameterRenderer? ) { - put(factory, FirDiagnosticWithParameters2Renderer(message, rendererA, rendererB)) + put(factory, FirDiagnosticWithParameters2Renderer(message, rendererA, rendererB)) } - fun put( - factory: FirDiagnosticFactory3<*, *, A, B, C>, + fun put( + factory: FirDiagnosticFactory3, message: String, rendererA: DiagnosticParameterRenderer?, rendererB: DiagnosticParameterRenderer?, rendererC: DiagnosticParameterRenderer? ) { - put(factory, FirDiagnosticWithParameters3Renderer(message, rendererA, rendererB, rendererC)) + put(factory, FirDiagnosticWithParameters3Renderer(message, rendererA, rendererB, rendererC)) } private fun put(factory: AbstractFirDiagnosticFactory<*, *>, renderer: FirDiagnosticRenderer<*>) { - val classicRenderer = renderer.toClassicDiagnosticRenderer() renderersMap[factory] = renderer - classicRenderersMap[factory] = classicRenderer - psiDiagnosticMap.put(factory.psiDiagnosticFactory, classicRenderer) + psiDiagnosticMap.put(factory, renderer) } } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticRenderer.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticRenderer.kt index 50e16067e3f..a440598e486 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticRenderer.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticRenderer.kt @@ -6,22 +6,17 @@ package org.jetbrains.kotlin.fir.analysis.diagnostics import org.jetbrains.kotlin.diagnostics.rendering.* +import org.jetbrains.kotlin.fir.FirSourceElement import java.text.MessageFormat -sealed class FirDiagnosticRenderer> { - abstract fun render(diagnostic: D): String - - abstract fun toClassicDiagnosticRenderer(): DiagnosticRenderer<*> +sealed class FirDiagnosticRenderer> : DiagnosticRenderer { + abstract override fun render(diagnostic: D): String } -class SimpleFirDiagnosticRenderer(private val message: String) : FirDiagnosticRenderer>() { - override fun render(diagnostic: FirSimpleDiagnostic<*>): String { +class SimpleFirDiagnosticRenderer(private val message: String) : FirDiagnosticRenderer>() { + override fun render(diagnostic: FirSimpleDiagnostic): String { return message } - - override fun toClassicDiagnosticRenderer(): DiagnosticRenderer<*> { - return SimpleDiagnosticRenderer(message) - } } sealed class AbstractFirDiagnosticWithParametersRenderer>( @@ -36,45 +31,37 @@ sealed class AbstractFirDiagnosticWithParametersRenderer>( abstract fun renderParameters(diagnostic: D): Array } -class FirDiagnosticWithParameters1Renderer( +class FirDiagnosticWithParameters1Renderer( message: String, private val rendererForA: DiagnosticParameterRenderer?, -) : AbstractFirDiagnosticWithParametersRenderer>(message) { - override fun renderParameters(diagnostic: FirDiagnosticWithParameters1<*, A>): Array { +) : AbstractFirDiagnosticWithParametersRenderer>(message) { + override fun renderParameters(diagnostic: FirDiagnosticWithParameters1): Array { val context = RenderingContext.of(diagnostic.a) - return arrayOf(renderParameter(diagnostic.a, rendererForA, context),) - } - - override fun toClassicDiagnosticRenderer(): DiagnosticRenderer<*> { - return DiagnosticWithParameters1Renderer(message, rendererForA) + return arrayOf(renderParameter(diagnostic.a, rendererForA, context)) } } -class FirDiagnosticWithParameters2Renderer( +class FirDiagnosticWithParameters2Renderer( message: String, private val rendererForA: DiagnosticParameterRenderer?, private val rendererForB: DiagnosticParameterRenderer?, -) : AbstractFirDiagnosticWithParametersRenderer>(message) { - override fun renderParameters(diagnostic: FirDiagnosticWithParameters2<*, A, B>): Array { +) : AbstractFirDiagnosticWithParametersRenderer>(message) { + override fun renderParameters(diagnostic: FirDiagnosticWithParameters2): Array { val context = RenderingContext.of(diagnostic.a, diagnostic.b) return arrayOf( renderParameter(diagnostic.a, rendererForA, context), renderParameter(diagnostic.b, rendererForB, context), ) } - - override fun toClassicDiagnosticRenderer(): DiagnosticRenderer<*> { - return DiagnosticWithParameters2Renderer(message, rendererForA, rendererForB) - } } -class FirDiagnosticWithParameters3Renderer( +class FirDiagnosticWithParameters3Renderer( message: String, private val rendererForA: DiagnosticParameterRenderer?, private val rendererForB: DiagnosticParameterRenderer?, private val rendererForC: DiagnosticParameterRenderer?, -) : AbstractFirDiagnosticWithParametersRenderer>(message) { - override fun renderParameters(diagnostic: FirDiagnosticWithParameters3<*, A, B, C>): Array { +) : AbstractFirDiagnosticWithParametersRenderer>(message) { + override fun renderParameters(diagnostic: FirDiagnosticWithParameters3): Array { val context = RenderingContext.of(diagnostic.a, diagnostic.b, diagnostic.c) return arrayOf( renderParameter(diagnostic.a, rendererForA, context), @@ -82,8 +69,4 @@ class FirDiagnosticWithParameters3Renderer( renderParameter(diagnostic.c, rendererForC, context), ) } - - override fun toClassicDiagnosticRenderer(): DiagnosticRenderer<*> { - return DiagnosticWithParameters3Renderer(message, rendererForA, rendererForB, rendererForC) - } } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt index 982c1e4608c..fe86388ba59 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt @@ -8,7 +8,6 @@ package org.jetbrains.kotlin.fir.analysis.diagnostics import com.intellij.psi.PsiElement import com.intellij.psi.PsiTypeElement import org.jetbrains.kotlin.contracts.description.EventOccurrencesRange -import org.jetbrains.kotlin.diagnostics.Errors import org.jetbrains.kotlin.fir.FirEffectiveVisibility import org.jetbrains.kotlin.fir.FirSourceElement import org.jetbrains.kotlin.fir.declarations.FirClass @@ -67,10 +66,10 @@ object FirErrors { val SEALED_SUPERTYPE_IN_LOCAL_CLASS by error0() // Constructor problems - val CONSTRUCTOR_IN_OBJECT by existing(Errors.CONSTRUCTOR_IN_OBJECT) - val CONSTRUCTOR_IN_INTERFACE by existing(Errors.CONSTRUCTOR_IN_INTERFACE) - val NON_PRIVATE_CONSTRUCTOR_IN_ENUM by existing(Errors.NON_PRIVATE_CONSTRUCTOR_IN_ENUM) - val NON_PRIVATE_CONSTRUCTOR_IN_SEALED by existing(Errors.NON_PRIVATE_CONSTRUCTOR_IN_SEALED) + val CONSTRUCTOR_IN_OBJECT by existing0() + val CONSTRUCTOR_IN_INTERFACE by existing0() + val NON_PRIVATE_CONSTRUCTOR_IN_ENUM by existing0() + val NON_PRIVATE_CONSTRUCTOR_IN_SEALED by existing0() val CYCLIC_CONSTRUCTOR_DELEGATION_CALL by warning0() val PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED by warning0() val SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR by warning0() @@ -80,19 +79,19 @@ object FirErrors { val SEALED_CLASS_CONSTRUCTOR_CALL by error0() // Annotations - val ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER_ERROR by existing(Errors.ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER_ERROR) - val ANNOTATION_ARGUMENT_MUST_BE_CONST by existing(Errors.ANNOTATION_ARGUMENT_MUST_BE_CONST) - val ANNOTATION_ARGUMENT_MUST_BE_ENUM_CONST by existing(Errors.ANNOTATION_ARGUMENT_MUST_BE_ENUM_CONST) - val ANNOTATION_ARGUMENT_MUST_BE_KCLASS_LITERAL by existing(Errors.ANNOTATION_ARGUMENT_MUST_BE_KCLASS_LITERAL) - val ANNOTATION_CLASS_MEMBER by existing(Errors.ANNOTATION_CLASS_MEMBER) - val ANNOTATION_PARAMETER_DEFAULT_VALUE_MUST_BE_CONSTANT by existing(Errors.ANNOTATION_PARAMETER_DEFAULT_VALUE_MUST_BE_CONSTANT) - val INVALID_TYPE_OF_ANNOTATION_MEMBER by existing(Errors.INVALID_TYPE_OF_ANNOTATION_MEMBER) - val LOCAL_ANNOTATION_CLASS_ERROR by existing(Errors.LOCAL_ANNOTATION_CLASS_ERROR) - val MISSING_VAL_ON_ANNOTATION_PARAMETER by existing(Errors.MISSING_VAL_ON_ANNOTATION_PARAMETER) - val NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION by existing(Errors.NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION) + val ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER_ERROR by existing0() + val ANNOTATION_ARGUMENT_MUST_BE_CONST by existing0() + val ANNOTATION_ARGUMENT_MUST_BE_ENUM_CONST by existing0() + val ANNOTATION_ARGUMENT_MUST_BE_KCLASS_LITERAL by existing0() + val ANNOTATION_CLASS_MEMBER by existing0() + val ANNOTATION_PARAMETER_DEFAULT_VALUE_MUST_BE_CONSTANT by existing0() + val INVALID_TYPE_OF_ANNOTATION_MEMBER by existing0() + val LOCAL_ANNOTATION_CLASS_ERROR by existing0() + val MISSING_VAL_ON_ANNOTATION_PARAMETER by existing0() + val NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION by existing0() val NOT_AN_ANNOTATION_CLASS by error1() - val NULLABLE_TYPE_OF_ANNOTATION_MEMBER by existing(Errors.NULLABLE_TYPE_OF_ANNOTATION_MEMBER) - val VAR_ANNOTATION_PARAMETER by existing(Errors.VAR_ANNOTATION_PARAMETER) + val NULLABLE_TYPE_OF_ANNOTATION_MEMBER by existing0() + val VAR_ANNOTATION_PARAMETER by existing0() // Exposed visibility group val EXPOSED_TYPEALIAS_EXPANDED_TYPE by error3() @@ -105,7 +104,7 @@ object FirErrors { val EXPOSED_TYPE_PARAMETER_BOUND by error3() // Modifiers - val INAPPLICABLE_INFIX_MODIFIER by existing(Errors.INAPPLICABLE_INFIX_MODIFIER) + val INAPPLICABLE_INFIX_MODIFIER by existing1() val REPEATED_MODIFIER by error1() val REDUNDANT_MODIFIER by error2() val DEPRECATED_MODIFIER_PAIR by error2() diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt index b4ac9b28b32..63a8fd8b640 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt @@ -184,7 +184,8 @@ sealed class FirPsiSourceElement(val psi: P) : FirSourceElem override fun getRoot(): LighterASTNode = lighterAST.root - override fun getParent(node: LighterASTNode): LighterASTNode? = node.unwrap().psi.parent?.node?.let { TreeBackedLighterAST.wrap(it) } + override fun getParent(node: LighterASTNode): LighterASTNode? = + node.unwrap().psi.parent?.node?.let { TreeBackedLighterAST.wrap(it) } override fun getChildren(node: LighterASTNode, nodesRef: Ref>): Int { val children = node.unwrap().psi.children @@ -201,7 +202,7 @@ sealed class FirPsiSourceElement(val psi: P) : FirSourceElem override fun getStartOffset(node: LighterASTNode): Int = node.unwrap().startOffset - override fun getEndOffset(node: LighterASTNode): Int = node.unwrap().let { it.startOffset + it.textLength - 1 } + override fun getEndOffset(node: LighterASTNode): Int = node.unwrap().let { it.startOffset + it.textLength } } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/ActualDiagnostic.kt b/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/ActualDiagnostic.kt index ec5cf4413d2..aed9a06ca23 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/ActualDiagnostic.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/ActualDiagnostic.kt @@ -17,10 +17,10 @@ class ActualDiagnostic constructor(val diagnostic: Diagnostic, override val plat TextDiagnostic.InferenceCompatibility.OLD override val name: String - get() = diagnostic.factory.name + get() = diagnostic.factory.name!! val file: PsiFile - get() = diagnostic.psiFile + get() = diagnostic.psiFile!! override fun compareTo(other: AbstractTestDiagnostic): Int { return if (this.diagnostic is DiagnosticWithParameters1<*, *> && other is ActualDiagnostic && other.diagnostic is DiagnosticWithParameters1<*, *>) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/DiagnosticForTests.kt b/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/DiagnosticForTests.kt index bb4ace74143..c01a46c702c 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/DiagnosticForTests.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/DiagnosticForTests.kt @@ -21,28 +21,16 @@ class SyntaxErrorDiagnostic(errorElement: PsiErrorElement) : AbstractDiagnosticF SyntaxErrorDiagnosticFactory.INSTANCE ) -open class AbstractDiagnosticForTests(private val element: PsiElement, private val factory: DiagnosticFactory<*>) : Diagnostic { - override fun getFactory(): DiagnosticFactory<*> { - return factory - } +open class AbstractDiagnosticForTests(override val psiElement: PsiElement, override val factory: DiagnosticFactory<*>) : Diagnostic { + override val severity: Severity + get() = Severity.ERROR - override fun getSeverity(): Severity { - return Severity.ERROR - } + override val textRanges: List + get() = listOf(psiElement.textRange) - override fun getPsiElement(): PsiElement { - return element - } + override val psiFile: PsiFile + get() = psiElement.containingFile - override fun getTextRanges(): List { - return listOf(element.textRange) - } - - override fun getPsiFile(): PsiFile { - return element.containingFile - } - - override fun isValid(): Boolean { - return true - } + override val isValid: Boolean + get() = true } \ No newline at end of file diff --git a/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/factories/DebugInfoDiagnosticFactory0.kt b/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/factories/DebugInfoDiagnosticFactory0.kt index f38c8ac706d..6bb1e03a087 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/factories/DebugInfoDiagnosticFactory0.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/factories/DebugInfoDiagnosticFactory0.kt @@ -17,10 +17,12 @@ import org.jetbrains.kotlin.psi.KtExpression import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory -class DebugInfoDiagnosticFactory0 : DiagnosticFactory0, +class DebugInfoDiagnosticFactory0 private constructor( + private val privateName: String, + severity: Severity = Severity.ERROR +) : DiagnosticFactory0(severity, PositioningStrategies.DEFAULT), DebugInfoDiagnosticFactory { - private val name: String - override val withExplicitDefinitionOnly: Boolean + override val withExplicitDefinitionOnly: Boolean = false override fun createDiagnostic( expression: KtExpression, @@ -32,22 +34,9 @@ class DebugInfoDiagnosticFactory0 : DiagnosticFactory0, return DebugInfoDiagnostic(expression, this) } - private constructor(name: String, severity: Severity = Severity.ERROR) : super(severity, PositioningStrategies.DEFAULT) { - this.name = name - this.withExplicitDefinitionOnly = false - } - - private constructor(name: String, severity: Severity, withExplicitDefinitionOnly: Boolean) : super( - severity, - PositioningStrategies.DEFAULT - ) { - this.name = name - this.withExplicitDefinitionOnly = withExplicitDefinitionOnly - } - - override fun getName(): String { - return "DEBUG_INFO_$name" - } + override var name: String? + get() = "DEBUG_INFO_$privateName" + set(_) {} companion object { val SMARTCAST = DebugInfoDiagnosticFactory0("SMARTCAST", Severity.INFO) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/factories/DebugInfoDiagnosticFactory1.kt b/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/factories/DebugInfoDiagnosticFactory1.kt index 64e8e4b6278..cc043207e38 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/factories/DebugInfoDiagnosticFactory1.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/factories/DebugInfoDiagnosticFactory1.kt @@ -19,11 +19,11 @@ import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory class DebugInfoDiagnosticFactory1 : DiagnosticFactory1, DebugInfoDiagnosticFactory { - private val name: String + private val privateName: String - override fun getName(): String { - return "DEBUG_INFO_$name" - } + override var name: String? + get() = "DEBUG_INFO_$privateName" + set(_) {} override val withExplicitDefinitionOnly: Boolean @@ -33,8 +33,8 @@ class DebugInfoDiagnosticFactory1 : DiagnosticFactory1, dataFlowValueFactory: DataFlowValueFactory?, languageVersionSettings: LanguageVersionSettings?, moduleDescriptor: ModuleDescriptorImpl? - ) = when (name) { - EXPRESSION_TYPE.name -> { + ) = when (privateName) { + EXPRESSION_TYPE.privateName -> { val (type, dataFlowTypes) = CheckerTestUtil.getTypeInfo( expression, bindingContext, @@ -45,23 +45,23 @@ class DebugInfoDiagnosticFactory1 : DiagnosticFactory1, this.on(expression, Renderers.renderExpressionType(type, dataFlowTypes)) } - CALL.name -> { + CALL.privateName -> { val (fqName, typeCall) = CheckerTestUtil.getCallDebugInfo(expression, bindingContext) this.on(expression, Renderers.renderCallInfo(fqName, typeCall)) } else -> throw NotImplementedError("Creation diagnostic '$name' isn't supported.") } - protected constructor(name: String, severity: Severity) : super(severity, PositioningStrategies.DEFAULT) { - this.name = name + private constructor(name: String, severity: Severity) : super(severity, PositioningStrategies.DEFAULT) { + this.privateName = name this.withExplicitDefinitionOnly = false } - protected constructor(name: String, severity: Severity, withExplicitDefinitionOnly: Boolean) : super( + private constructor(name: String, severity: Severity, withExplicitDefinitionOnly: Boolean) : super( severity, PositioningStrategies.DEFAULT ) { - this.name = name + this.privateName = name this.withExplicitDefinitionOnly = withExplicitDefinitionOnly } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/factories/SyntaxErrorDiagnosticFactory.kt b/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/factories/SyntaxErrorDiagnosticFactory.kt index f553b388e51..e547fd0ba12 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/factories/SyntaxErrorDiagnosticFactory.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/factories/SyntaxErrorDiagnosticFactory.kt @@ -10,9 +10,9 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticFactory import org.jetbrains.kotlin.diagnostics.Severity class SyntaxErrorDiagnosticFactory private constructor() : DiagnosticFactory(Severity.ERROR) { - override fun getName(): String { - return "SYNTAX" - } + override var name: String? + get() = "SYNTAX" + set(_) {} companion object { val INSTANCE = SyntaxErrorDiagnosticFactory() diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Diagnostic.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Diagnostic.kt index 0a832d10a7b..be763ca2c0a 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Diagnostic.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Diagnostic.kt @@ -24,6 +24,6 @@ interface Diagnostic { val severity: Severity val psiElement: PsiElement val textRanges: List - val psiFile: PsiFile + val psiFile: PsiFile? val isValid: Boolean } \ No newline at end of file diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/DiagnosticUtils.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/DiagnosticUtils.java index 84669020945..dabac77cfee 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/DiagnosticUtils.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/DiagnosticUtils.java @@ -24,7 +24,6 @@ import com.intellij.openapi.util.TextRange; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.descriptors.DeclarationDescriptor; import org.jetbrains.kotlin.psi.psiUtil.PsiUtilsKt; import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils; @@ -75,6 +74,9 @@ public class DiagnosticUtils { List textRanges = diagnostic.getTextRanges(); if (textRanges.isEmpty()) return PsiDiagnosticUtils.LineAndColumn.NONE; TextRange firstRange = firstRange(textRanges); + if (file == null) { + return PsiDiagnosticUtils.LineAndColumn.NONE; + } return getLineAndColumnInPsiFile(file, firstRange); } @@ -90,6 +92,9 @@ public class DiagnosticUtils { List textRanges = diagnostic.getTextRanges(); if (textRanges.isEmpty()) return PsiDiagnosticUtils.LineAndColumnRange.NONE; TextRange firstRange = firstRange(textRanges); + if (file == null) { + return PsiDiagnosticUtils.LineAndColumnRange.NONE; + } return getLineAndColumnRangeInPsiFile(file, firstRange); } @@ -124,9 +129,13 @@ public class DiagnosticUtils { public static List sortedDiagnostics(@NotNull Collection diagnostics) { List result = Lists.newArrayList(diagnostics); result.sort((d1, d2) -> { - String path1 = d1.getPsiFile().getViewProvider().getVirtualFile().getPath(); - String path2 = d2.getPsiFile().getViewProvider().getVirtualFile().getPath(); - if (!path1.equals(path2)) return path1.compareTo(path2); + PsiFile file1 = d1.getPsiFile(); + PsiFile file2 = d2.getPsiFile(); + if (file1 != null && file2 != null) { + String path1 = file1.getViewProvider().getVirtualFile().getPath(); + String path2 = file2.getViewProvider().getVirtualFile().getPath(); + if (!path1.equals(path2)) return path1.compareTo(path2); + } TextRange range1 = firstRange(d1.getTextRanges()); TextRange range2 = firstRange(d2.getTextRanges()); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/KotlinSuppressCache.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/KotlinSuppressCache.kt index d870fc079c3..f0b46fcba4e 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/KotlinSuppressCache.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/KotlinSuppressCache.kt @@ -164,7 +164,7 @@ abstract class KotlinSuppressCache { companion object { private fun getDiagnosticSuppressKey(diagnostic: Diagnostic): String = - diagnostic.factory.name.toLowerCase() + diagnostic.factory.name!!.toLowerCase() private fun isSuppressedByStrings(key: String, strings: Set, severity: Severity): Boolean = severity == Severity.WARNING && "warnings" in strings || key in strings diff --git a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/duplicateJvmSignatureUtil.kt b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/duplicateJvmSignatureUtil.kt index 7b99d638eb3..f2780c4ef19 100644 --- a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/duplicateJvmSignatureUtil.kt +++ b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/duplicateJvmSignatureUtil.kt @@ -24,13 +24,12 @@ import org.jetbrains.kotlin.asJava.classes.KtLightClassForSourceDeclaration import org.jetbrains.kotlin.asJava.classes.getOutermostClassOrObject import org.jetbrains.kotlin.asJava.classes.safeIsScript import org.jetbrains.kotlin.diagnostics.Diagnostic -import org.jetbrains.kotlin.diagnostics.DiagnosticFactory.cast +import org.jetbrains.kotlin.diagnostics.DiagnosticFactory import org.jetbrains.kotlin.diagnostics.Errors.* import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.resolve.diagnostics.Diagnostics import org.jetbrains.kotlin.resolve.jvm.diagnostics.ConflictingJvmDeclarationsData -import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm.* import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKind.* @@ -90,8 +89,7 @@ fun getJvmSignatureDiagnostics(element: PsiElement, otherDiagnostics: Diagnostic return null } - val result = doGetDiagnostics() - if (result == null) return null + val result = doGetDiagnostics() ?: return null return FilteredJvmDiagnostics(result, otherDiagnostics) } @@ -111,7 +109,7 @@ class FilteredJvmDiagnostics(val jvmDiagnostics: Diagnostics, val otherDiagnosti } override fun forElement(psiElement: PsiElement): Collection { - fun Diagnostic.data() = cast(this, jvmDiagnosticFactories).a + fun Diagnostic.data() = DiagnosticFactory.cast(this, jvmDiagnosticFactories).a val (conflicting, other) = jvmDiagnostics.forElement(psiElement).partition { it.factory in jvmDiagnosticFactories } if (alreadyReported(psiElement)) { // CONFLICTING_OVERLOADS already reported, no need to duplicate it @@ -125,22 +123,19 @@ class FilteredJvmDiagnostics(val jvmDiagnostics: Diagnostics, val otherDiagnosti val diagnostics = it.value if (diagnostics.size <= 1) { filtered.addAll(diagnostics) - } - else { + } else { filtered.addAll( - diagnostics.filter { - me -> - diagnostics.none { - other -> - me != other && ( - // in case of implementation copied from a super trait there will be both diagnostics on the same signature - other.factory == ErrorsJvm.CONFLICTING_JVM_DECLARATIONS && (me.factory == ACCIDENTAL_OVERRIDE || - me.factory == CONFLICTING_INHERITED_JVM_DECLARATIONS) - // there are paris of corresponding signatures that frequently clash simultaneously: multifile class & part, trait and trait-impl - || other.data().higherThan(me.data()) - ) - } + diagnostics.filter { me -> + diagnostics.none { other -> + me != other && ( + // in case of implementation copied from a super trait there will be both diagnostics on the same signature + other.factory == CONFLICTING_JVM_DECLARATIONS && (me.factory == ACCIDENTAL_OVERRIDE || + me.factory == CONFLICTING_INHERITED_JVM_DECLARATIONS) + // there are paris of corresponding signatures that frequently clash simultaneously: multifile class & part, trait and trait-impl + || other.data().higherThan(me.data()) + ) } + } ) } } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirBaseDiagnosticsTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirBaseDiagnosticsTest.kt index df4ee22d134..ee7f6b0241d 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirBaseDiagnosticsTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirBaseDiagnosticsTest.kt @@ -22,7 +22,6 @@ import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment import org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM import org.jetbrains.kotlin.diagnostics.PsiDiagnosticUtils import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnostic -import org.jetbrains.kotlin.fir.analysis.diagnostics.FirPsiDiagnostic import org.jetbrains.kotlin.fir.builder.RawFirBuilder import org.jetbrains.kotlin.fir.builder.RawFirBuilderMode import org.jetbrains.kotlin.fir.declarations.FirFile @@ -326,8 +325,7 @@ abstract class AbstractFirBaseDiagnosticsTest : BaseDiagnosticsTest() { private fun Iterable>.toActualDiagnostic(root: PsiElement): List { val result = mutableListOf() mapTo(result) { - val oldDiagnostic = (it as FirPsiDiagnostic<*>).asPsiBasedDiagnostic() - ActualDiagnostic(oldDiagnostic, null, true) + ActualDiagnostic(it, null, true) } for (errorElement in AnalyzingUtils.getSyntaxErrorRanges(root)) { result.add(ActualDiagnostic(SyntaxErrorDiagnostic(errorElement), null, true)) diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt index 40ab827bdf2..5ee614c7114 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt @@ -40,7 +40,6 @@ import org.jetbrains.kotlin.fir.visitors.FirDefaultVisitorVoid import org.jetbrains.kotlin.fir.visitors.FirVisitorVoid import org.jetbrains.kotlin.name.FqNameUnsafe import org.jetbrains.kotlin.test.KotlinTestUtils -import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase import org.jetbrains.kotlin.util.OperatorNameConventions import org.jetbrains.kotlin.utils.addIfNotNull import java.io.File @@ -63,8 +62,8 @@ import java.io.File */ abstract class AbstractFirDiagnosticsTest : AbstractFirBaseDiagnosticsTest() { companion object { - val DUMP_CFG_DIRECTIVE = "DUMP_CFG" - val COMMON_COROUTINES_DIRECTIVE ="COMMON_COROUTINES_TEST" + const val DUMP_CFG_DIRECTIVE = "DUMP_CFG" + const val COMMON_COROUTINES_DIRECTIVE = "COMMON_COROUTINES_TEST" val TestFile.withDumpCfgDirective: Boolean get() = DUMP_CFG_DIRECTIVE in directives @@ -204,7 +203,8 @@ abstract class AbstractFirDiagnosticsTest : AbstractFirBaseDiagnosticsTest() { argument: () -> String, ): FirDiagnosticWithParameters1? { val sourceElement = element.source ?: return null - if (diagnosedRangesToDiagnosticNames[sourceElement.startOffset..sourceElement.endOffset]?.contains(this.name) != true) return null + val name = name ?: return null + if (diagnosedRangesToDiagnosticNames[sourceElement.startOffset..sourceElement.endOffset]?.contains(name) != true) return null val argumentText = argument() return when (sourceElement) { @@ -212,21 +212,13 @@ abstract class AbstractFirDiagnosticsTest : AbstractFirBaseDiagnosticsTest() { sourceElement, argumentText, severity, - FirDiagnosticFactory1( - name, - severity, - this - ) + FirDiagnosticFactory1(name, severity) ) is FirLightSourceElement -> FirLightDiagnosticWithParameters1( sourceElement, argumentText, severity, - FirDiagnosticFactory1( - name, - severity, - this - ) + FirDiagnosticFactory1(name, severity) ) } } @@ -324,13 +316,13 @@ abstract class AbstractFirDiagnosticsTest : AbstractFirBaseDiagnosticsTest() { private val cfgKinds = listOf(EdgeKind.DeadForward, EdgeKind.CfgForward, EdgeKind.DeadBackward, EdgeKind.CfgBackward) private fun checkEdge(from: CFGNode<*>, to: CFGNode<*>) { - KtUsefulTestCase.assertContainsElements(from.followingNodes, to) - KtUsefulTestCase.assertContainsElements(to.previousNodes, from) + assertContainsElements(from.followingNodes, to) + assertContainsElements(to.previousNodes, from) val fromKind = from.outgoingEdges.getValue(to).kind val toKind = to.incomingEdges.getValue(from).kind TestCase.assertEquals(fromKind, toKind) if (from.isDead && to.isDead) { - KtUsefulTestCase.assertContainsElements(cfgKinds, toKind) + assertContainsElements(cfgKinds, toKind) } } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticsWithLightTreeTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticsWithLightTreeTest.kt index 03a40c793f9..05169864ad2 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticsWithLightTreeTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticsWithLightTreeTest.kt @@ -57,7 +57,7 @@ abstract class AbstractFirDiagnosticsWithLightTreeTest : AbstractFirDiagnosticsT val expected = existingDiagnostics[startOffset] ?: emptyMap() val actual = actualDiagnostics[startOffset] ?: emptyMap() for (name in expected.keys + actual.keys) { - if (name == "SYNTAX") continue + if (name == null || name == "SYNTAX") continue val expectedCount = expected[name] ?: 0 val actualCount = actual[name] ?: 0 if (expectedCount != actualCount) { diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/utils/validators/DiagnosticTestTypeValidator.kt b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/utils/validators/DiagnosticTestTypeValidator.kt index 390c4492f83..405d6ea865b 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/utils/validators/DiagnosticTestTypeValidator.kt +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/utils/validators/DiagnosticTestTypeValidator.kt @@ -28,7 +28,7 @@ class DiagnosticTestTypeValidator( private fun findTestCases(diagnostic: Diagnostic): TestCasesByNumbers { val ranges = diagnostic.textRanges - val filename = diagnostic.psiFile.name + val filename = diagnostic.psiFile!!.name val foundTestCases = testInfo.cases.byRanges[filename]!!.floorEntry(ranges[0].startOffset) if (foundTestCases != null) @@ -52,7 +52,7 @@ class DiagnosticTestTypeValidator( private fun collectDiagnostics(files: List) { files.forEach { file -> file.actualDiagnostics.forEach { - val diagnosticName = it.diagnostic.factory.name + val diagnosticName = it.diagnostic.factory.name!! diagnosticStats.run { put(diagnosticName, getOrDefault(diagnosticName, 0) + 1) } diagnostics.add(it.diagnostic) } diff --git a/compiler/tests/org/jetbrains/kotlin/resolve/MutableDiagnosticsTest.kt b/compiler/tests/org/jetbrains/kotlin/resolve/MutableDiagnosticsTest.kt index 77c44a487ef..b2bc719a7f7 100644 --- a/compiler/tests/org/jetbrains/kotlin/resolve/MutableDiagnosticsTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/resolve/MutableDiagnosticsTest.kt @@ -30,9 +30,9 @@ import org.jetbrains.kotlin.test.KotlinTestWithEnvironment import org.junit.Assert class MutableDiagnosticsTest : KotlinTestWithEnvironment() { - override fun createEnvironment(): KotlinCoreEnvironment? { + override fun createEnvironment(): KotlinCoreEnvironment { return KotlinCoreEnvironment.createForTests( - testRootDisposable, KotlinTestUtils.newConfiguration(), EnvironmentConfigFiles.JVM_CONFIG_FILES + testRootDisposable, KotlinTestUtils.newConfiguration(), EnvironmentConfigFiles.JVM_CONFIG_FILES ) } @@ -137,19 +137,18 @@ class MutableDiagnosticsTest : KotlinTestWithEnvironment() { private class DummyDiagnosticFactory : DiagnosticFactory("DUMMY", Severity.ERROR) private inner class DummyDiagnostic : Diagnostic { - private val factory = DummyDiagnosticFactory() + override val factory = DummyDiagnosticFactory() private val dummyElement = KtPsiFactory(environment.project).createType("Int") init { - dummyElement.getContainingKtFile().doNotAnalyze = null + dummyElement.containingKtFile.doNotAnalyze = null } - override fun getFactory() = factory - override fun getSeverity() = factory.severity - override fun getPsiElement() = dummyElement - override fun getTextRanges() = unimplemented() - override fun getPsiFile() = unimplemented() - override fun isValid() = unimplemented() + override val severity get() = factory.severity + override val psiElement get() = dummyElement + override val textRanges get() = unimplemented() + override val psiFile get() = unimplemented() + override val isValid get() = unimplemented() private fun unimplemented(): Nothing = throw UnsupportedOperationException() } diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/AnnotationPresentationInfo.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/AnnotationPresentationInfo.kt index cfb3997b2c1..cd8bd2cb27a 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/AnnotationPresentationInfo.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/AnnotationPresentationInfo.kt @@ -45,7 +45,7 @@ class AnnotationPresentationInfo( if (fixes.isEmpty()) { // if there are no quick fixes we need to register an EmptyIntentionAction to enable 'suppress' actions - annotation.newFix(EmptyIntentionAction(diagnostic.factory.name)).registerFix() + annotation.newFix(EmptyIntentionAction(diagnostic.factory.name!!)).registerFix() } } } diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/KotlinSuppressableWarningProblemGroup.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/KotlinSuppressableWarningProblemGroup.kt index 87b9da94409..39da8b8247b 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/KotlinSuppressableWarningProblemGroup.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/KotlinSuppressableWarningProblemGroup.kt @@ -37,7 +37,7 @@ class KotlinSuppressableWarningProblemGroup( } fun createSuppressWarningActions(element: PsiElement, diagnosticFactory: DiagnosticFactory<*>): List = - createSuppressWarningActions(element, diagnosticFactory.severity, diagnosticFactory.name) + createSuppressWarningActions(element, diagnosticFactory.severity, diagnosticFactory.name!!) fun createSuppressWarningActions(element: PsiElement, severity: Severity, suppressionKey: String): List { diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostics/AbstractFirIdeDiagnosticsCollector.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostics/AbstractFirIdeDiagnosticsCollector.kt index 91f22f69474..f05922086ee 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostics/AbstractFirIdeDiagnosticsCollector.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostics/AbstractFirIdeDiagnosticsCollector.kt @@ -42,7 +42,7 @@ internal abstract class AbstractFirIdeDiagnosticsCollector( override fun report(diagnostic: FirDiagnostic<*>?) { if (diagnostic !is FirPsiDiagnostic<*>) return if (diagnostic.element.psi !is KtElement) return - onDiagnostic(diagnostic.asPsiBasedDiagnostic()) + onDiagnostic(diagnostic) } } diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/internal/KotlinBytecodeToolWindow.kt b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/internal/KotlinBytecodeToolWindow.kt index dcfd2cdc5a6..8629747baa1 100644 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/internal/KotlinBytecodeToolWindow.kt +++ b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/internal/KotlinBytecodeToolWindow.kt @@ -261,7 +261,7 @@ class KotlinBytecodeToolWindow(private val myProject: Project, private val toolW answer.append("// ================\n") for (diagnostic in diagnostics) { answer.append("// Error at ") - .append(diagnostic.psiFile.name) + .append(diagnostic.psiFile?.name) .append(join(diagnostic.textRanges, ",")) .append(": ") .append(DefaultErrorMessages.render(diagnostic)) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/MigrateDiagnosticSuppressionInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/MigrateDiagnosticSuppressionInspection.kt index d2bbd64e584..001814d5fb5 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/MigrateDiagnosticSuppressionInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/MigrateDiagnosticSuppressionInspection.kt @@ -46,7 +46,7 @@ class MigrateDiagnosticSuppressionInspection : AbstractKotlinInspection(), Clean } class ReplaceDiagnosticNameFix(private val diagnosticFactory: DiagnosticFactory<*>) : LocalQuickFix { - override fun getName() = KotlinBundle.message("replace.diagnostic.name.fix.text", familyName, diagnosticFactory.name) + override fun getName() = KotlinBundle.message("replace.diagnostic.name.fix.text", familyName, diagnosticFactory.name!!) override fun getFamilyName() = KotlinBundle.message("replace.diagnostic.name.fix.family.name") diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/AddFunctionToSupertypeFix.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/AddFunctionToSupertypeFix.kt index 5d7b8c8e32a..f4820cd9897 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/AddFunctionToSupertypeFix.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/AddFunctionToSupertypeFix.kt @@ -128,7 +128,7 @@ class AddFunctionToSupertypeFix private constructor( val descriptors = generateFunctionsToAdd(function) if (descriptors.isEmpty()) return null - val project = diagnostic.psiFile.project + val project = diagnostic.psiFile!!.project val functionData = descriptors.mapNotNull { createFunctionData(it, project) } if (functionData.isEmpty()) return null diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/AddPropertyToSupertypeFix.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/AddPropertyToSupertypeFix.kt index 45aa2d1e5e6..a3458b50925 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/AddPropertyToSupertypeFix.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/AddPropertyToSupertypeFix.kt @@ -102,7 +102,7 @@ class AddPropertyToSupertypeFix private constructor( val descriptors = generatePropertiesToAdd(property) if (descriptors.isEmpty()) return null - val project = diagnostic.psiFile.project + val project = diagnostic.psiFile!!.project val propertyData = descriptors.mapNotNull { createPropertyData(it, property.initializer, project) } if (propertyData.isEmpty()) return null diff --git a/idea/tests/org/jetbrains/kotlin/idea/codeMetaInfo/renderConfigurations/AbstractCodeMetaInfoRenderConfiguration.kt b/idea/tests/org/jetbrains/kotlin/idea/codeMetaInfo/renderConfigurations/AbstractCodeMetaInfoRenderConfiguration.kt index 6fff12d11d6..4500557b0e0 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/codeMetaInfo/renderConfigurations/AbstractCodeMetaInfoRenderConfiguration.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/codeMetaInfo/renderConfigurations/AbstractCodeMetaInfoRenderConfiguration.kt @@ -82,7 +82,7 @@ open class DiagnosticCodeMetaInfoRenderConfiguration( } fun getTag(codeMetaInfo: DiagnosticCodeMetaInfo): String { - return codeMetaInfo.diagnostic.factory.name + return codeMetaInfo.diagnostic.factory.name!! } } diff --git a/plugins/scripting/scripting-compiler/src/org/jetbrains/kotlin/scripting/compiler/plugin/repl/messages/IdeDiagnosticMessageHolder.kt b/plugins/scripting/scripting-compiler/src/org/jetbrains/kotlin/scripting/compiler/plugin/repl/messages/IdeDiagnosticMessageHolder.kt index 472c178879b..bd6d3e0a8f3 100644 --- a/plugins/scripting/scripting-compiler/src/org/jetbrains/kotlin/scripting/compiler/plugin/repl/messages/IdeDiagnosticMessageHolder.kt +++ b/plugins/scripting/scripting-compiler/src/org/jetbrains/kotlin/scripting/compiler/plugin/repl/messages/IdeDiagnosticMessageHolder.kt @@ -15,7 +15,7 @@ import javax.xml.parsers.DocumentBuilderFactory class IdeDiagnosticMessageHolder : DiagnosticMessageHolder { private val diagnostics = arrayListOf>() - override fun report(diagnostic: Diagnostic, file: PsiFile, render: String) { + override fun report(diagnostic: Diagnostic, file: PsiFile?, render: String) { diagnostics.add(Pair(diagnostic, render)) } From 8320a2966ac85748775107a219b204a110297347 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 17 Nov 2020 13:13:07 +0300 Subject: [PATCH 210/698] [FIR] Implement light tree VAL_VAR strategy as an example --- .../diagnostics/FirDiagnosticFactoryDsl.kt | 76 ++++++++++++------- .../fir/analysis/diagnostics/FirErrors.kt | 2 +- .../LightTreePositioningStrategies.kt | 35 +++++++++ .../jetbrains/kotlin/fir/FirSourceElement.kt | 8 +- .../org/jetbrains/kotlin/psi/KtParameter.java | 2 +- 5 files changed, 92 insertions(+), 31 deletions(-) create mode 100644 compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactoryDsl.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactoryDsl.kt index 5b2fdfd39a6..37a46ae40bc 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactoryDsl.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactoryDsl.kt @@ -11,36 +11,52 @@ import org.jetbrains.kotlin.fir.FirSourceElement import kotlin.properties.ReadOnlyProperty import kotlin.reflect.KProperty -fun warning0(): DiagnosticFactory0DelegateProvider { - return DiagnosticFactory0DelegateProvider(Severity.WARNING) +fun warning0( + positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT +): DiagnosticFactory0DelegateProvider { + return DiagnosticFactory0DelegateProvider(Severity.WARNING, positioningStrategy) } -fun warning1(): DiagnosticFactory1DelegateProvider { - return DiagnosticFactory1DelegateProvider(Severity.WARNING) +fun warning1( + positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT +): DiagnosticFactory1DelegateProvider { + return DiagnosticFactory1DelegateProvider(Severity.WARNING, positioningStrategy) } -fun warning2(): DiagnosticFactory2DelegateProvider { - return DiagnosticFactory2DelegateProvider(Severity.WARNING) +fun warning2( + positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT +): DiagnosticFactory2DelegateProvider { + return DiagnosticFactory2DelegateProvider(Severity.WARNING, positioningStrategy) } -fun warning3(): DiagnosticFactory3DelegateProvider { - return DiagnosticFactory3DelegateProvider(Severity.WARNING) +fun warning3( + positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT +): DiagnosticFactory3DelegateProvider { + return DiagnosticFactory3DelegateProvider(Severity.WARNING, positioningStrategy) } -fun error0(): DiagnosticFactory0DelegateProvider { - return DiagnosticFactory0DelegateProvider(Severity.ERROR) +fun error0( + positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT +): DiagnosticFactory0DelegateProvider { + return DiagnosticFactory0DelegateProvider(Severity.ERROR, positioningStrategy) } -fun error1(): DiagnosticFactory1DelegateProvider { - return DiagnosticFactory1DelegateProvider(Severity.ERROR) +fun error1( + positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT +): DiagnosticFactory1DelegateProvider { + return DiagnosticFactory1DelegateProvider(Severity.ERROR, positioningStrategy) } -fun error2(): DiagnosticFactory2DelegateProvider { - return DiagnosticFactory2DelegateProvider(Severity.ERROR) +fun error2( + positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT +): DiagnosticFactory2DelegateProvider { + return DiagnosticFactory2DelegateProvider(Severity.ERROR, positioningStrategy) } -fun error3(): DiagnosticFactory3DelegateProvider { - return DiagnosticFactory3DelegateProvider(Severity.ERROR) +fun error3( + positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT +): DiagnosticFactory3DelegateProvider { + return DiagnosticFactory3DelegateProvider(Severity.ERROR, positioningStrategy) } /** @@ -48,52 +64,56 @@ fun error3(): * that takes `PsiElement` as first type parameter */ fun existing0(): DiagnosticFactory0DelegateProvider { - return DiagnosticFactory0DelegateProvider(Severity.ERROR) + return DiagnosticFactory0DelegateProvider(Severity.ERROR, LightTreePositioningStrategy.DEFAULT) } fun existing1(): DiagnosticFactory1DelegateProvider { - return DiagnosticFactory1DelegateProvider(Severity.ERROR) + return DiagnosticFactory1DelegateProvider(Severity.ERROR, LightTreePositioningStrategy.DEFAULT) } fun existing2(): DiagnosticFactory2DelegateProvider { - return DiagnosticFactory2DelegateProvider(Severity.ERROR) + return DiagnosticFactory2DelegateProvider(Severity.ERROR, LightTreePositioningStrategy.DEFAULT) } fun existing3(): DiagnosticFactory3DelegateProvider { - return DiagnosticFactory3DelegateProvider(Severity.ERROR) + return DiagnosticFactory3DelegateProvider(Severity.ERROR, LightTreePositioningStrategy.DEFAULT) } // ------------------------------ Providers ------------------------------ class DiagnosticFactory0DelegateProvider( - private val severity: Severity + private val severity: Severity, + private val positioningStrategy: LightTreePositioningStrategy ) { operator fun provideDelegate(thisRef: Any?, prop: KProperty<*>): ReadOnlyProperty> { - return DummyDelegate(FirDiagnosticFactory0(prop.name, severity)) + return DummyDelegate(FirDiagnosticFactory0(prop.name, severity, positioningStrategy)) } } class DiagnosticFactory1DelegateProvider( - private val severity: Severity + private val severity: Severity, + private val positioningStrategy: LightTreePositioningStrategy ) { operator fun provideDelegate(thisRef: Any?, prop: KProperty<*>): ReadOnlyProperty> { - return DummyDelegate(FirDiagnosticFactory1(prop.name, severity)) + return DummyDelegate(FirDiagnosticFactory1(prop.name, severity, positioningStrategy)) } } class DiagnosticFactory2DelegateProvider( - private val severity: Severity + private val severity: Severity, + private val positioningStrategy: LightTreePositioningStrategy ) { operator fun provideDelegate(thisRef: Any?, prop: KProperty<*>): ReadOnlyProperty> { - return DummyDelegate(FirDiagnosticFactory2(prop.name, severity)) + return DummyDelegate(FirDiagnosticFactory2(prop.name, severity, positioningStrategy)) } } class DiagnosticFactory3DelegateProvider( - private val severity: Severity + private val severity: Severity, + private val positioningStrategy: LightTreePositioningStrategy ) { operator fun provideDelegate(thisRef: Any?, prop: KProperty<*>): ReadOnlyProperty> { - return DummyDelegate(FirDiagnosticFactory3(prop.name, severity)) + return DummyDelegate(FirDiagnosticFactory3(prop.name, severity, positioningStrategy)) } } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt index fe86388ba59..f2756bf2506 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt @@ -91,7 +91,7 @@ object FirErrors { val NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION by existing0() val NOT_AN_ANNOTATION_CLASS by error1() val NULLABLE_TYPE_OF_ANNOTATION_MEMBER by existing0() - val VAR_ANNOTATION_PARAMETER by existing0() + val VAR_ANNOTATION_PARAMETER by error0(LightTreePositioningStrategies.VAL_OR_VAR_NODE) // Exposed visibility group val EXPOSED_TYPEALIAS_EXPANDED_TYPE by error3() diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt new file mode 100644 index 00000000000..fe159417118 --- /dev/null +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt @@ -0,0 +1,35 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.fir.analysis.diagnostics + +import com.intellij.lang.LighterASTNode +import com.intellij.openapi.util.Ref +import com.intellij.openapi.util.TextRange +import com.intellij.psi.tree.IElementType +import com.intellij.psi.tree.TokenSet +import com.intellij.util.diff.FlyweightCapableTreeStructure +import org.jetbrains.kotlin.psi.KtParameter.VAL_VAR_TOKEN_SET + +object LightTreePositioningStrategies { + val VAL_OR_VAR_NODE: LightTreePositioningStrategy = object : LightTreePositioningStrategy() { + override fun mark(node: LighterASTNode, tree: FlyweightCapableTreeStructure): List { + val target = tree.findChildByType(node, VAL_VAR_TOKEN_SET) ?: node + return markElement(target, tree) + } + } +} + +fun FlyweightCapableTreeStructure.findChildByType(node: LighterASTNode, type: IElementType): LighterASTNode? { + val childrenRef = Ref>() + getChildren(node, childrenRef) + return childrenRef.get()?.firstOrNull { it.tokenType == type } +} + +fun FlyweightCapableTreeStructure.findChildByType(node: LighterASTNode, type: TokenSet): LighterASTNode? { + val childrenRef = Ref>() + getChildren(node, childrenRef) + return childrenRef.get()?.firstOrNull { it.tokenType in type } +} \ No newline at end of file diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt index 63a8fd8b640..39f672433b3 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt @@ -188,7 +188,13 @@ sealed class FirPsiSourceElement(val psi: P) : FirSourceElem node.unwrap().psi.parent?.node?.let { TreeBackedLighterAST.wrap(it) } override fun getChildren(node: LighterASTNode, nodesRef: Ref>): Int { - val children = node.unwrap().psi.children + val psi = node.unwrap().psi + val children = mutableListOf() + var child = psi.firstChild + while (child != null) { + children += child + child = child.nextSibling + } if (children.isEmpty()) { nodesRef.set(LighterASTNode.EMPTY_ARRAY) } else { diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtParameter.java b/compiler/psi/src/org/jetbrains/kotlin/psi/KtParameter.java index d7f191b7e1a..bd49aceb1eb 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtParameter.java +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtParameter.java @@ -129,7 +129,7 @@ public class KtParameter extends KtNamedDeclarationStub imp return findChildByType(KtNodeTypes.DESTRUCTURING_DECLARATION); } - private static final TokenSet VAL_VAR_TOKEN_SET = TokenSet.create(KtTokens.VAL_KEYWORD, KtTokens.VAR_KEYWORD); + public static final TokenSet VAL_VAR_TOKEN_SET = TokenSet.create(KtTokens.VAL_KEYWORD, KtTokens.VAR_KEYWORD); @Override public ItemPresentation getPresentation() { From d844b33b1c561d4ebe013d0d6c5b590c7ec83836 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 17 Nov 2020 15:06:01 +0300 Subject: [PATCH 211/698] [FIR] Implement light tree CONSTRUCTOR_DELEGATION_CALL strategy Default strategy sometimes delegates to the CONSTRUCTOR_DELEGATION_CALL strategy, so we add it in this commit to process some related cases properly. --- .../fir/analysis/diagnostics/FirErrors.kt | 4 +- .../LightTreePositioningStrategies.kt | 57 ++++++++++++++++++- .../LightTreePositioningStrategy.kt | 16 +++++- .../jetbrains/kotlin/fir/FirSourceElement.kt | 36 +++++++++++- 4 files changed, 105 insertions(+), 8 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt index f2756bf2506..4303a48e8eb 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt @@ -71,11 +71,11 @@ object FirErrors { val NON_PRIVATE_CONSTRUCTOR_IN_ENUM by existing0() val NON_PRIVATE_CONSTRUCTOR_IN_SEALED by existing0() val CYCLIC_CONSTRUCTOR_DELEGATION_CALL by warning0() - val PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED by warning0() + val PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED by warning0(LightTreePositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL) val SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR by warning0() val DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR by warning0() val PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS by warning0() - val EXPLICIT_DELEGATION_CALL_REQUIRED by warning0() + val EXPLICIT_DELEGATION_CALL_REQUIRED by warning0(LightTreePositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL) val SEALED_CLASS_CONSTRUCTOR_CALL by error0() // Annotations diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt index fe159417118..63353c5d268 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt @@ -11,6 +11,8 @@ import com.intellij.openapi.util.TextRange import com.intellij.psi.tree.IElementType import com.intellij.psi.tree.TokenSet import com.intellij.util.diff.FlyweightCapableTreeStructure +import org.jetbrains.kotlin.KtNodeTypes +import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.KtParameter.VAL_VAR_TOKEN_SET object LightTreePositioningStrategies { @@ -20,16 +22,65 @@ object LightTreePositioningStrategies { return markElement(target, tree) } } + + val SECONDARY_CONSTRUCTOR_DELEGATION_CALL: LightTreePositioningStrategy = object : LightTreePositioningStrategy() { + override fun mark(node: LighterASTNode, tree: FlyweightCapableTreeStructure): List { + when (node.tokenType) { + KtNodeTypes.SECONDARY_CONSTRUCTOR -> { + val valueParameterList = tree.findChildByType(node, KtNodeTypes.VALUE_PARAMETER_LIST) ?: return markElement(node, tree) + return markRange( + tree.findChildByType(node, KtTokens.CONSTRUCTOR_KEYWORD)!!, + tree.lastChild(valueParameterList)!!, tree + ) + } + KtNodeTypes.CONSTRUCTOR_DELEGATION_CALL -> { + val delegationReference = tree.findChildByType(node, KtNodeTypes.CONSTRUCTOR_DELEGATION_REFERENCE) + if (delegationReference != null && tree.firstChild(delegationReference) == null) { + val constructor = tree.findParentOfType(node, KtNodeTypes.SECONDARY_CONSTRUCTOR)!! + val valueParameterList = tree.findChildByType(constructor, KtNodeTypes.VALUE_PARAMETER_LIST) + ?: return markElement(constructor, tree) + return markRange( + tree.findChildByType(constructor, KtTokens.CONSTRUCTOR_KEYWORD)!!, + tree.lastChild(valueParameterList)!!, tree + ) + } + return markElement(delegationReference ?: node, tree) + } + else -> error("unexpected element $node") + } + } + } } -fun FlyweightCapableTreeStructure.findChildByType(node: LighterASTNode, type: IElementType): LighterASTNode? { +private fun FlyweightCapableTreeStructure.findChildByType(node: LighterASTNode, type: IElementType): LighterASTNode? { val childrenRef = Ref>() getChildren(node, childrenRef) return childrenRef.get()?.firstOrNull { it.tokenType == type } } -fun FlyweightCapableTreeStructure.findChildByType(node: LighterASTNode, type: TokenSet): LighterASTNode? { +private fun FlyweightCapableTreeStructure.findChildByType(node: LighterASTNode, type: TokenSet): LighterASTNode? { val childrenRef = Ref>() getChildren(node, childrenRef) return childrenRef.get()?.firstOrNull { it.tokenType in type } -} \ No newline at end of file +} + +private fun FlyweightCapableTreeStructure.findParentOfType(node: LighterASTNode, type: IElementType): LighterASTNode? { + var parent = getParent(node) + while (parent != null) { + if (parent.tokenType == type) return parent + parent = getParent(parent) + } + return null +} + +private fun FlyweightCapableTreeStructure.firstChild(node: LighterASTNode): LighterASTNode? { + val childrenRef = Ref>() + getChildren(node, childrenRef) + return childrenRef.get()?.firstOrNull() +} + +private fun FlyweightCapableTreeStructure.lastChild(node: LighterASTNode): LighterASTNode? { + val childrenRef = Ref>() + getChildren(node, childrenRef) + return childrenRef.get()?.lastOrNull() +} diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategy.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategy.kt index 9c3206c5c24..1b11a5051cd 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategy.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategy.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.fir.analysis.diagnostics import com.intellij.lang.LighterASTNode import com.intellij.openapi.util.TextRange import com.intellij.util.diff.FlyweightCapableTreeStructure +import org.jetbrains.kotlin.KtNodeTypes open class LightTreePositioningStrategy { open fun markDiagnostic(diagnostic: FirDiagnostic<*>): List { @@ -20,10 +21,23 @@ open class LightTreePositioningStrategy { } companion object { - val DEFAULT = LightTreePositioningStrategy() + val DEFAULT = object : LightTreePositioningStrategy() { + override fun mark(node: LighterASTNode, tree: FlyweightCapableTreeStructure): List { + when (node.tokenType) { + KtNodeTypes.CONSTRUCTOR_DELEGATION_CALL -> { + return LightTreePositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL.mark(node, tree) + } + } + return super.mark(node, tree) + } + } } } fun markElement(node: LighterASTNode, tree: FlyweightCapableTreeStructure): List { return listOf(TextRange(tree.getStartOffset(node), tree.getEndOffset(node))) } + +fun markRange(from: LighterASTNode, to: LighterASTNode, tree: FlyweightCapableTreeStructure): List { + return listOf(TextRange(tree.getStartOffset(from), tree.getEndOffset(to))) +} diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt index 39f672433b3..64951b8468d 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt @@ -8,8 +8,10 @@ package org.jetbrains.kotlin.fir import com.intellij.lang.LighterASTNode import com.intellij.lang.TreeBackedLighterAST import com.intellij.openapi.util.Ref +import com.intellij.psi.PsiComment import com.intellij.psi.PsiElement import com.intellij.psi.PsiFile +import com.intellij.psi.PsiWhiteSpace import com.intellij.psi.tree.IElementType import com.intellij.util.diff.FlyweightCapableTreeStructure @@ -206,9 +208,39 @@ sealed class FirPsiSourceElement(val psi: P) : FirSourceElem override fun disposeChildren(p0: Array?, p1: Int) { } - override fun getStartOffset(node: LighterASTNode): Int = node.unwrap().startOffset + override fun getStartOffset(node: LighterASTNode): Int { + return getStartOffset(node.unwrap().psi) + } - override fun getEndOffset(node: LighterASTNode): Int = node.unwrap().let { it.startOffset + it.textLength } + private fun getStartOffset(element: PsiElement): Int { + var child = element.firstChild + if (child != null) { + while (child is PsiComment || child is PsiWhiteSpace) { + child = child.nextSibling + } + if (child != null) { + return getStartOffset(child) + } + } + return element.textRange.startOffset + } + + override fun getEndOffset(node: LighterASTNode): Int { + return getEndOffset(node.unwrap().psi) + } + + private fun getEndOffset(element: PsiElement): Int { + var child = element.lastChild + if (child != null) { + while (child is PsiComment || child is PsiWhiteSpace) { + child = child.prevSibling + } + if (child != null) { + return getEndOffset(child) + } + } + return element.textRange.endOffset + } } } From 42c59f7383ce3eaee9d40bc82931fb4fc869910d Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 17 Nov 2020 15:15:11 +0300 Subject: [PATCH 212/698] [FIR] Enhance light tree DEFAULT strategy for objects to cover header only --- .../LightTreePositioningStrategies.kt | 19 +++++++++++++++++++ .../LightTreePositioningStrategy.kt | 11 +---------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt index 63353c5d268..c2c9a105958 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt @@ -16,6 +16,25 @@ import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.KtParameter.VAL_VAR_TOKEN_SET object LightTreePositioningStrategies { + internal val DEFAULT = object : LightTreePositioningStrategy() { + override fun mark(node: LighterASTNode, tree: FlyweightCapableTreeStructure): List { + when (node.tokenType) { + KtNodeTypes.OBJECT_DECLARATION -> { + val objectKeyword = tree.findChildByType(node, KtTokens.OBJECT_KEYWORD)!! + return markRange( + from = objectKeyword, + to = tree.findChildByType(node, KtTokens.IDENTIFIER) ?: objectKeyword, + tree + ) + } + KtNodeTypes.CONSTRUCTOR_DELEGATION_CALL -> { + return SECONDARY_CONSTRUCTOR_DELEGATION_CALL.mark(node, tree) + } + } + return super.mark(node, tree) + } + } + val VAL_OR_VAR_NODE: LightTreePositioningStrategy = object : LightTreePositioningStrategy() { override fun mark(node: LighterASTNode, tree: FlyweightCapableTreeStructure): List { val target = tree.findChildByType(node, VAL_VAR_TOKEN_SET) ?: node diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategy.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategy.kt index 1b11a5051cd..6e6bdf7bbe2 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategy.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategy.kt @@ -21,16 +21,7 @@ open class LightTreePositioningStrategy { } companion object { - val DEFAULT = object : LightTreePositioningStrategy() { - override fun mark(node: LighterASTNode, tree: FlyweightCapableTreeStructure): List { - when (node.tokenType) { - KtNodeTypes.CONSTRUCTOR_DELEGATION_CALL -> { - return LightTreePositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL.mark(node, tree) - } - } - return super.mark(node, tree) - } - } + val DEFAULT = LightTreePositioningStrategies.DEFAULT } } From 3dec848c0377086fd9534d37a87c02948619b1d9 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 17 Nov 2020 16:17:01 +0300 Subject: [PATCH 213/698] [FIR] Implement light tree DECLARATION_NAME & SIGNATURE strategies --- .../fir/analysis/diagnostics/FirErrors.kt | 10 +- .../LightTreePositioningStrategies.kt | 126 +++++++++++++++++- .../funInterfaceDeclarationCheck.fir.kt | 4 +- .../diagnostics/tests/localInterfaces.fir.kt | 8 +- .../unqualifiedSuperWithLocalClass.fir.kt | 21 --- .../unqualifiedSuperWithLocalClass.kt | 1 + 6 files changed, 132 insertions(+), 38 deletions(-) delete mode 100644 compiler/testData/diagnostics/tests/thisAndSuper/unqualifiedSuper/unqualifiedSuperWithLocalClass.fir.kt diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt index 4303a48e8eb..be48b7a8102 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt @@ -66,8 +66,8 @@ object FirErrors { val SEALED_SUPERTYPE_IN_LOCAL_CLASS by error0() // Constructor problems - val CONSTRUCTOR_IN_OBJECT by existing0() - val CONSTRUCTOR_IN_INTERFACE by existing0() + val CONSTRUCTOR_IN_OBJECT by error0(LightTreePositioningStrategies.DECLARATION_SIGNATURE) + val CONSTRUCTOR_IN_INTERFACE by error0(LightTreePositioningStrategies.DECLARATION_SIGNATURE) val NON_PRIVATE_CONSTRUCTOR_IN_ENUM by existing0() val NON_PRIVATE_CONSTRUCTOR_IN_SEALED by existing0() val CYCLIC_CONSTRUCTOR_DELEGATION_CALL by warning0() @@ -144,11 +144,11 @@ object FirErrors { val ANY_METHOD_IMPLEMENTED_IN_INTERFACE by error0() // Invalid local declarations - val LOCAL_OBJECT_NOT_ALLOWED by error1() - val LOCAL_INTERFACE_NOT_ALLOWED by error1() + val LOCAL_OBJECT_NOT_ALLOWED by error1(LightTreePositioningStrategies.DECLARATION_NAME) + val LOCAL_INTERFACE_NOT_ALLOWED by error1(LightTreePositioningStrategies.DECLARATION_NAME) // Control flow diagnostics - val UNINITIALIZED_VARIABLE by error1() + val UNINITIALIZED_VARIABLE by error1(LightTreePositioningStrategies.DECLARATION_SIGNATURE) val WRONG_INVOCATION_KIND by warning3, EventOccurrencesRange, EventOccurrencesRange>() val LEAKED_IN_PLACE_LAMBDA by error1>() val WRONG_IMPLIES_CONDITION by error0() diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt index c2c9a105958..6e15910de74 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt @@ -20,10 +20,10 @@ object LightTreePositioningStrategies { override fun mark(node: LighterASTNode, tree: FlyweightCapableTreeStructure): List { when (node.tokenType) { KtNodeTypes.OBJECT_DECLARATION -> { - val objectKeyword = tree.findChildByType(node, KtTokens.OBJECT_KEYWORD)!! + val objectKeyword = tree.objectKeyword(node)!! return markRange( from = objectKeyword, - to = tree.findChildByType(node, KtTokens.IDENTIFIER) ?: objectKeyword, + to = tree.nameIdentifier(node) ?: objectKeyword, tree ) } @@ -46,9 +46,9 @@ object LightTreePositioningStrategies { override fun mark(node: LighterASTNode, tree: FlyweightCapableTreeStructure): List { when (node.tokenType) { KtNodeTypes.SECONDARY_CONSTRUCTOR -> { - val valueParameterList = tree.findChildByType(node, KtNodeTypes.VALUE_PARAMETER_LIST) ?: return markElement(node, tree) + val valueParameterList = tree.valueParameterList(node) ?: return markElement(node, tree) return markRange( - tree.findChildByType(node, KtTokens.CONSTRUCTOR_KEYWORD)!!, + tree.constructorKeyword(node)!!, tree.lastChild(valueParameterList)!!, tree ) } @@ -56,10 +56,10 @@ object LightTreePositioningStrategies { val delegationReference = tree.findChildByType(node, KtNodeTypes.CONSTRUCTOR_DELEGATION_REFERENCE) if (delegationReference != null && tree.firstChild(delegationReference) == null) { val constructor = tree.findParentOfType(node, KtNodeTypes.SECONDARY_CONSTRUCTOR)!! - val valueParameterList = tree.findChildByType(constructor, KtNodeTypes.VALUE_PARAMETER_LIST) + val valueParameterList = tree.valueParameterList(constructor) ?: return markElement(constructor, tree) return markRange( - tree.findChildByType(constructor, KtTokens.CONSTRUCTOR_KEYWORD)!!, + tree.constructorKeyword(constructor)!!, tree.lastChild(valueParameterList)!!, tree ) } @@ -69,6 +69,120 @@ object LightTreePositioningStrategies { } } } + + val DECLARATION_NAME: LightTreePositioningStrategy = object : LightTreePositioningStrategy() { + override fun mark(node: LighterASTNode, tree: FlyweightCapableTreeStructure): List { + val nameIdentifier = tree.nameIdentifier(node) + if (nameIdentifier != null) { + if (node.tokenType == KtNodeTypes.CLASS || node.tokenType == KtNodeTypes.OBJECT_DECLARATION) { + val startElement = + tree.modifierList(node)?.let { modifierList -> tree.findChildByType(modifierList, KtTokens.ENUM_KEYWORD) } + ?: tree.findChildByType(node, TokenSet.create(KtTokens.CLASS_KEYWORD, KtTokens.OBJECT_KEYWORD)) + ?: node + + return markRange(startElement, nameIdentifier, tree) + } + return markElement(nameIdentifier, tree) + } + if (node.tokenType == KtNodeTypes.FUN) { + return DECLARATION_SIGNATURE.mark(node, tree) + } + return DEFAULT.mark(node, tree) + } + } + + val DECLARATION_SIGNATURE: LightTreePositioningStrategy = object : LightTreePositioningStrategy() { + override fun mark(node: LighterASTNode, tree: FlyweightCapableTreeStructure): List { + when (node.tokenType) { + KtNodeTypes.PRIMARY_CONSTRUCTOR, KtNodeTypes.SECONDARY_CONSTRUCTOR -> { + val begin = tree.constructorKeyword(node) ?: tree.valueParameterList(node) ?: return markElement(node, tree) + val end = tree.valueParameterList(node) ?: tree.constructorKeyword(node) ?: return markElement(node, tree) + return markRange(begin, end, tree) + } + KtNodeTypes.FUN, KtNodeTypes.FUNCTION_LITERAL -> { + val endOfSignatureElement = + tree.typeReference(node) + ?: tree.valueParameterList(node) + ?: tree.nameIdentifier(node) + ?: node + val startElement = if (node.tokenType == KtNodeTypes.FUNCTION_LITERAL) { + tree.receiverTypeReference(node) + ?: tree.valueParameterList(node) + ?: node + } else node + return markRange(startElement, endOfSignatureElement, tree) + } + KtNodeTypes.PROPERTY -> { + val endOfSignatureElement = tree.typeReference(node) ?: tree.nameIdentifier(node) ?: node + return markRange(node, endOfSignatureElement, tree) + } + KtNodeTypes.PROPERTY_ACCESSOR -> { + val endOfSignatureElement = + tree.typeReference(node) + ?: tree.rightParenthesis(node) + ?: tree.accessorNamePlaceholder(node) + + return markRange(node, endOfSignatureElement, tree) + } + KtNodeTypes.CLASS -> { + val nameAsDeclaration = tree.nameIdentifier(node) ?: return markElement(node, tree) + val primaryConstructorParameterList = tree.primaryConstructor(node)?.let { constructor -> + tree.valueParameterList(constructor) + } ?: return markElement(nameAsDeclaration, tree) + return markRange(nameAsDeclaration, primaryConstructorParameterList, tree) + } + KtNodeTypes.OBJECT_DECLARATION -> { + return DECLARATION_NAME.mark(node, tree) + } + KtNodeTypes.CLASS_INITIALIZER -> { + return markElement(tree.initKeyword(node)!!, tree) + } + } + return super.mark(node, tree) + } + } +} + +private fun FlyweightCapableTreeStructure.constructorKeyword(node: LighterASTNode): LighterASTNode? = + findChildByType(node, KtTokens.CONSTRUCTOR_KEYWORD) + +private fun FlyweightCapableTreeStructure.initKeyword(node: LighterASTNode): LighterASTNode? = + findChildByType(node, KtTokens.INIT_KEYWORD) + +private fun FlyweightCapableTreeStructure.nameIdentifier(node: LighterASTNode): LighterASTNode? = + findChildByType(node, KtTokens.IDENTIFIER) + +private fun FlyweightCapableTreeStructure.rightParenthesis(node: LighterASTNode): LighterASTNode? = + findChildByType(node, KtTokens.RPAR) + +private fun FlyweightCapableTreeStructure.objectKeyword(node: LighterASTNode): LighterASTNode? = + findChildByType(node, KtTokens.OBJECT_KEYWORD) + +private fun FlyweightCapableTreeStructure.accessorNamePlaceholder(node: LighterASTNode): LighterASTNode = + findChildByType(node, KtTokens.GET_KEYWORD) ?: findChildByType(node, KtTokens.SET_KEYWORD)!! + +private fun FlyweightCapableTreeStructure.modifierList(node: LighterASTNode): LighterASTNode? = + findChildByType(node, KtNodeTypes.MODIFIER_LIST) + +private fun FlyweightCapableTreeStructure.primaryConstructor(node: LighterASTNode): LighterASTNode? = + findChildByType(node, KtNodeTypes.PRIMARY_CONSTRUCTOR) + +private fun FlyweightCapableTreeStructure.valueParameterList(node: LighterASTNode): LighterASTNode? = + findChildByType(node, KtNodeTypes.VALUE_PARAMETER_LIST) + +private fun FlyweightCapableTreeStructure.typeReference(node: LighterASTNode): LighterASTNode? { + val childrenRef = Ref>() + getChildren(node, childrenRef) + return childrenRef.get()?.dropWhile { it.tokenType != KtTokens.COLON }?.firstOrNull { it.tokenType == KtNodeTypes.TYPE_REFERENCE } +} + +private fun FlyweightCapableTreeStructure.receiverTypeReference(node: LighterASTNode): LighterASTNode? { + val childrenRef = Ref>() + getChildren(node, childrenRef) + return childrenRef.get()?.firstOrNull { + if (it.tokenType == KtTokens.COLON || it.tokenType == KtTokens.LPAR) return null + it.tokenType == KtNodeTypes.TYPE_REFERENCE + } } private fun FlyweightCapableTreeStructure.findChildByType(node: LighterASTNode, type: IElementType): LighterASTNode? { diff --git a/compiler/testData/diagnostics/tests/funInterface/funInterfaceDeclarationCheck.fir.kt b/compiler/testData/diagnostics/tests/funInterface/funInterfaceDeclarationCheck.fir.kt index ae051437cf0..ea025258bfd 100644 --- a/compiler/testData/diagnostics/tests/funInterface/funInterfaceDeclarationCheck.fir.kt +++ b/compiler/testData/diagnostics/tests/funInterface/funInterfaceDeclarationCheck.fir.kt @@ -87,9 +87,9 @@ class WithNestedFun { } fun local() { - fun interface LocalFun { + fun interface LocalFun { fun invoke(element: T) - } + } } fun interface WithDefaultValue { diff --git a/compiler/testData/diagnostics/tests/localInterfaces.fir.kt b/compiler/testData/diagnostics/tests/localInterfaces.fir.kt index 85615bc8335..d02f565bcfb 100644 --- a/compiler/testData/diagnostics/tests/localInterfaces.fir.kt +++ b/compiler/testData/diagnostics/tests/localInterfaces.fir.kt @@ -1,14 +1,14 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE fun foo() { - interface a {} + interface a {} val b = object { - interface c {} + interface c {} } class A { - interface d {} + interface d {} } val f = { - interface e {} + interface e {} } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/thisAndSuper/unqualifiedSuper/unqualifiedSuperWithLocalClass.fir.kt b/compiler/testData/diagnostics/tests/thisAndSuper/unqualifiedSuper/unqualifiedSuperWithLocalClass.fir.kt deleted file mode 100644 index 7045253537b..00000000000 --- a/compiler/testData/diagnostics/tests/thisAndSuper/unqualifiedSuper/unqualifiedSuperWithLocalClass.fir.kt +++ /dev/null @@ -1,21 +0,0 @@ -interface Interface { - fun foo(x: Int): Int -} - -fun withLocalClasses(param: Int): Interface { - open class LocalBase { - open val param: Int - get() = 100 - } - - interface LocalInterface : Interface { - override fun foo(x: Int): Int = - x + param - } - - return object : LocalBase(), LocalInterface { - override fun foo(x: Int): Int = - x + super.param - } - -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/thisAndSuper/unqualifiedSuper/unqualifiedSuperWithLocalClass.kt b/compiler/testData/diagnostics/tests/thisAndSuper/unqualifiedSuper/unqualifiedSuperWithLocalClass.kt index 1fa5cf4008c..ceb904b403e 100644 --- a/compiler/testData/diagnostics/tests/thisAndSuper/unqualifiedSuper/unqualifiedSuperWithLocalClass.kt +++ b/compiler/testData/diagnostics/tests/thisAndSuper/unqualifiedSuper/unqualifiedSuperWithLocalClass.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL interface Interface { fun foo(x: Int): Int } From c7ae176ae438648ba998a4bddb729a111747d0db Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 17 Nov 2020 17:16:43 +0300 Subject: [PATCH 214/698] [FIR] Inherit FIR with parameter renderer from the old parameter renderer --- .../diagnostics/FirDiagnosticRenderer.kt | 17 ++++------------- .../diagnosticsWithParameterRenderers.kt | 4 ++-- .../kotlin/fir/AbstractFirDiagnosticTest.kt | 1 + 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticRenderer.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticRenderer.kt index a440598e486..0a1869d27d6 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticRenderer.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticRenderer.kt @@ -7,13 +7,12 @@ package org.jetbrains.kotlin.fir.analysis.diagnostics import org.jetbrains.kotlin.diagnostics.rendering.* import org.jetbrains.kotlin.fir.FirSourceElement -import java.text.MessageFormat -sealed class FirDiagnosticRenderer> : DiagnosticRenderer { - abstract override fun render(diagnostic: D): String +interface FirDiagnosticRenderer> : DiagnosticRenderer { + override fun render(diagnostic: D): String } -class SimpleFirDiagnosticRenderer(private val message: String) : FirDiagnosticRenderer>() { +class SimpleFirDiagnosticRenderer(private val message: String) : FirDiagnosticRenderer> { override fun render(diagnostic: FirSimpleDiagnostic): String { return message } @@ -21,15 +20,7 @@ class SimpleFirDiagnosticRenderer(private val message: Str sealed class AbstractFirDiagnosticWithParametersRenderer>( protected val message: String -) : FirDiagnosticRenderer() { - private val messageFormat = MessageFormat(message) - - override fun render(diagnostic: D): String { - return messageFormat.format(renderParameters(diagnostic)) - } - - abstract fun renderParameters(diagnostic: D): Array -} +) : FirDiagnosticRenderer, AbstractDiagnosticWithParametersRenderer(message) class FirDiagnosticWithParameters1Renderer( message: String, diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/diagnosticsWithParameterRenderers.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/diagnosticsWithParameterRenderers.kt index 3dcac178b75..163207c7b84 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/diagnosticsWithParameterRenderers.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/diagnosticsWithParameterRenderers.kt @@ -23,8 +23,8 @@ import java.text.MessageFormat abstract class AbstractDiagnosticWithParametersRenderer protected constructor(message: String) : DiagnosticRenderer { private val messageFormat = MessageFormat(message) - override fun render(obj: D): String { - return messageFormat.format(renderParameters(obj)) + override fun render(diagnostic: D): String { + return messageFormat.format(renderParameters(diagnostic)) } abstract fun renderParameters(diagnostic: D): Array diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt index 5ee614c7114..9d71824715d 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt @@ -203,6 +203,7 @@ abstract class AbstractFirDiagnosticsTest : AbstractFirBaseDiagnosticsTest() { argument: () -> String, ): FirDiagnosticWithParameters1? { val sourceElement = element.source ?: return null + if (sourceElement.kind != FirRealSourceElementKind) return null val name = name ?: return null if (diagnosedRangesToDiagnosticNames[sourceElement.startOffset..sourceElement.endOffset]?.contains(name) != true) return null From fa3f8055738f9b112cad36cf1d721e7434c1694e Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 17 Nov 2020 18:05:30 +0300 Subject: [PATCH 215/698] Support FirDiagnostic.isValid properly Diagnostic is considered valid in this commit if it's reported on a syntactically non-erroneous element without erroneous last child --- .../fir/analysis/diagnostics/FirDiagnostic.kt | 2 +- .../diagnostics/FirDiagnosticFactory.kt | 5 ++++ .../LightTreePositioningStrategy.kt | 28 ++++++++++++++++++- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnostic.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnostic.kt index 96cb228f5ba..d319a2d32c1 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnostic.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnostic.kt @@ -25,7 +25,7 @@ sealed class FirDiagnostic : Diagnostic { get() = factory.getTextRanges(this) override val isValid: Boolean - get() = true + get() = factory.isValid(this) } sealed class FirSimpleDiagnostic : FirDiagnostic() { diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactory.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactory.kt index e8dae007b45..d8428c7053a 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactory.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactory.kt @@ -29,6 +29,11 @@ sealed class AbstractFirDiagnosticFactory): List = positioningStrategy.markDiagnostic(diagnostic) + + fun isValid(diagnostic: FirDiagnostic<*>): Boolean { + val element = diagnostic.element + return positioningStrategy.isValid(element.lighterASTNode, element.treeStructure) + } } class FirDiagnosticFactory0( diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategy.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategy.kt index 6e6bdf7bbe2..a234035a711 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategy.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategy.kt @@ -6,9 +6,13 @@ package org.jetbrains.kotlin.fir.analysis.diagnostics import com.intellij.lang.LighterASTNode +import com.intellij.openapi.util.Ref import com.intellij.openapi.util.TextRange +import com.intellij.psi.TokenType import com.intellij.util.diff.FlyweightCapableTreeStructure -import org.jetbrains.kotlin.KtNodeTypes +import org.jetbrains.kotlin.lexer.KtSingleValueToken +import org.jetbrains.kotlin.lexer.KtTokens +import org.jetbrains.kotlin.lexer.KtTokens.WHITE_SPACE open class LightTreePositioningStrategy { open fun markDiagnostic(diagnostic: FirDiagnostic<*>): List { @@ -20,6 +24,10 @@ open class LightTreePositioningStrategy { return markElement(node, tree) } + open fun isValid(node: LighterASTNode, tree: FlyweightCapableTreeStructure): Boolean { + return !hasSyntaxErrors(node, tree) + } + companion object { val DEFAULT = LightTreePositioningStrategies.DEFAULT } @@ -32,3 +40,21 @@ fun markElement(node: LighterASTNode, tree: FlyweightCapableTreeStructure): List { return listOf(TextRange(tree.getStartOffset(from), tree.getEndOffset(to))) } + +private val DOC_AND_COMMENT_TOKENS = setOf( + WHITE_SPACE, KtTokens.IDENTIFIER, + KtTokens.EOL_COMMENT, KtTokens.BLOCK_COMMENT, KtTokens.SHEBANG_COMMENT, KtTokens.DOC_COMMENT +) + +private fun hasSyntaxErrors(node: LighterASTNode, tree: FlyweightCapableTreeStructure): Boolean { + if (node.tokenType == TokenType.ERROR_ELEMENT) return true + + val childrenRef = Ref>() + tree.getChildren(node, childrenRef) + val children = childrenRef.get() + return children.lastOrNull { + val tokenType = it.tokenType + tokenType !is KtSingleValueToken && tokenType !in DOC_AND_COMMENT_TOKENS + }?.let { hasSyntaxErrors(it, tree) } == true +} + From c602ccb33ef3b9febe4dbc4a47f58de4a261cfc3 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 17 Nov 2020 18:40:33 +0300 Subject: [PATCH 216/698] Create FIR fake source element for vararg argument expression --- .../fir/resolve/transformers/body/resolve/BodyResolveUtils.kt | 2 +- .../fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/BodyResolveUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/BodyResolveUtils.kt index 1ea0276fd73..3d1c7d0aff2 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/BodyResolveUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/BodyResolveUtils.kt @@ -58,7 +58,7 @@ internal fun remapArgumentsWithVararg( ) { arguments += arg if (this.source == null) { - this.source = arg.source + this.source = arg.source?.fakeElement(FirFakeSourceElementKind.VarargArgument) } } else if (arguments.isEmpty()) { // `arg` is BEFORE the vararg arguments. diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt index 64951b8468d..b546acbe5c4 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt @@ -150,6 +150,10 @@ sealed class FirFakeSourceElementKind : FirSourceElementKind() { // super.foo() --> super.foo() // where `Supertype` has a fake source object SuperCallImplicitType : FirFakeSourceElementKind() + + // fun foo(vararg args: Int) {} + // fun bar(1, 2, 3) --> [resolved] fun bar(VarargArgument(1, 2, 3)) + object VarargArgument : FirFakeSourceElementKind() } sealed class FirSourceElement { From e7e162c7eb6a78b8451a0888f73066495f1e2963 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 17 Nov 2020 18:52:28 +0300 Subject: [PATCH 217/698] [FIR TEST] Filter some particular tokens during createDebugInfo --- .../postponedArgumentsAnalysis/basic.fir.kt | 20 +++++++++---------- .../testsWithStdLib/coroutines/kt41430.fir.kt | 2 +- .../callableReferences.fir.kt | 2 +- .../kotlin/fir/AbstractFirDiagnosticTest.kt | 4 ++++ 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.fir.kt b/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.fir.kt index a8516c5a43e..06588262147 100644 --- a/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.fir.kt @@ -142,13 +142,13 @@ fun main() { val x18: (C) -> Unit = select(id { it }, { it }, id<(B) -> Unit> { x -> x }) // Resolution of extension/non-extension functions combination - val x19: String.() -> Unit = select(")!>id { this }, ")!>id(fun(x: String) {})) - val x20: String.() -> Unit = select(")!>{ this }, (fun(x: String) {})) + val x19: String.() -> Unit = select(")!>id { this }, ")!>id(fun(x: String) {})) + val x20: String.() -> Unit = select(")!>{ this }, (fun(x: String) {})) val x21: String.() -> Unit = select(")!>id(fun(x: String) {}), ")!>id(fun(x: String) {})) select(id Unit>(fun(x: String) {}), ")!>id(fun(x: String) {})) select(")!>id(fun String.(x: String) {}), ")!>id(fun(x: String, y: String) {})) - select(id(fun String.(x: String) {}), id(fun(x: String, y: String) { }), { x: String -> this }) - select(id(fun String.(x: String) {}), id(fun(x: String, y: String) { }), { x -> this }) + select(id(fun String.(x: String) {}), id(fun(x: String, y: String) { }), { x: String -> this }) + select(id(fun String.(x: String) {}), id(fun(x: String, y: String) { }), { x -> this }) select(id(fun String.(x: String) {}), id(fun(x: String, y: String) { }), { x: String, y: String -> x }) // Convert to extension lambda is impossible because the lambda parameter types aren't specified explicitly select(id(fun String.(x: String) {}), id(fun(x: String, y: String) { }), { x, y -> x }) @@ -180,16 +180,16 @@ fun main() { takeLambdasWithInverselyDependentTypeParameters({ it }, { x: Number -> x }, { x: Int -> x }) // Inferring lambda parameter types by subtypes of functional type - ")!>select(A2(), { a, b, c -> a; b; c }) + ")!>select(A2(), { a, b, c -> a; b; c }) ")!>select(A3(), { it }, { a -> a }) ")!>select(A3(), ")!>A3::foo1) // Should be error as `A3::foo1` is `KFunction2`, but the remaining arguments are `KFuncion1` or `Function1` ")!>select(A3(), ")!>A3::foo1, { a -> a }, { it -> it }) // It's OK because `A3::foo2` is from companion of `A3` - ")!>select(A3(), ")!>A3::foo2, { a -> a }, { it -> it }) + ")!>select(A3(), ")!>A3::foo2, { a -> a }, { it -> it }) & java.io.Serializable>")!>select(A4(), { x: Number -> "" }) & java.io.Serializable>")!>select(A5(), { x: Number, y: Int -> "" }) - ")!>select(A2(), id { a, b, c -> a; b; c }) + ")!>select(A2(), id { a, b, c -> a; b; c }) ")!>select(id(A3()), { it }, { a -> a }) ")!>select(A3(), id(")!>A3::foo1)) ")!>select(A3(), ")!>A3::foo1, id { a -> a }, { it -> it }) @@ -201,7 +201,7 @@ fun main() { ")!>select(id(A3()), id(")!>A3::foo1), id { a: Number -> a }) ")!>select(A4(), id { x: Number -> x }) >")!>select(id(A5()), id { x: Number, y: Int -> x;y }) - >")!>select(id(A5()), id { x, y -> x;y }) + >")!>select(id(A5()), id { x, y -> x;y }) >")!>select(id(")!>A5()), id { x: Number, y: Int -> x;y }) val x55: Function2 = select(id(A5()), id { x, y -> x;y; 1f }) @@ -228,8 +228,8 @@ fun main() { val x70: (Int) -> Unit = selectNumber(id(fun (it) { }), id {}, id {}) val x71: String.() -> Unit = select(")!>id(fun String.() { }), ")!>id(fun(x: String) {})) val x72: String.() -> Unit = select(fun String.() { }, fun(x: String) {}) // must be error - select(id(fun String.(x: String) {}), id(fun(x: String, y: String) { }), fun (x, y) { x;y }) + select(id(fun String.(x: String) {}), id(fun(x: String, y: String) { }), fun (x, y) { x;y }) select(id Unit>(fun (x, y) {}), { x: Int, y: String -> x }) // receiver of anonymous function must be specified explicitly select(id Unit>(fun Int.(y) {}), { x: Int, y: String -> x }) - ")!>select(A3(), fun (x) = "", { a -> a }) + ")!>select(A3(), fun (x) = "", { a -> a }) } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt41430.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt41430.fir.kt index a0cf6c2b5e9..30277dd24e7 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt41430.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt41430.fir.kt @@ -8,7 +8,7 @@ fun test_1(list: List>) { fun test_2(list: List>) { sequence { - ")!>list.flatMapTo(mutableSetOf()) { it } + list.flatMapTo(mutableSetOf()) { it } } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/callableReferences.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/callableReferences.fir.kt index 621c01262cd..9edfb2eded2 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/callableReferences.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/callableReferences.fir.kt @@ -53,5 +53,5 @@ fun main() { select(id(::foo5), id { x: A -> }, id { x: B -> }, id { it }) - val x2: (Int) -> Unit = selectNumber(id(")!>::foo6), id { x -> x }, id { ")!>it }) + val x2: (Int) -> Unit = selectNumber(id(")!>::foo6), id { x -> ")!>x }, id { ")!>it }) } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt index 9d71824715d..f3de6c66efe 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir import com.intellij.psi.PsiElement import junit.framework.TestCase +import org.jetbrains.kotlin.KtNodeTypes import org.jetbrains.kotlin.checkers.diagnostics.factories.DebugInfoDiagnosticFactory1 import org.jetbrains.kotlin.checkers.utils.TypeOfCall import org.jetbrains.kotlin.diagnostics.rendering.Renderers @@ -204,6 +205,9 @@ abstract class AbstractFirDiagnosticsTest : AbstractFirBaseDiagnosticsTest() { ): FirDiagnosticWithParameters1? { val sourceElement = element.source ?: return null if (sourceElement.kind != FirRealSourceElementKind) return null + // Lambda argument is always (?) duplicated by function literal + // Block expression is always (?) duplicated by single block expression + if (sourceElement.elementType == KtNodeTypes.LAMBDA_ARGUMENT || sourceElement.elementType == KtNodeTypes.BLOCK) return null val name = name ?: return null if (diagnosedRangesToDiagnosticNames[sourceElement.startOffset..sourceElement.endOffset]?.contains(name) != true) return null From 82c5cefba904fbfce3e1dca193162d083d1eeabe Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 18 Nov 2020 13:12:31 +0300 Subject: [PATCH 218/698] Update test data in FIR diagnostic spec tests --- .../diagnostics/notLinked/dfa/pos/1.fir.kt | 121 ++++++++++-------- .../diagnostics/notLinked/dfa/pos/37.fir.kt | 2 +- .../diagnostics/notLinked/dfa/pos/9.fir.kt | 2 +- 3 files changed, 67 insertions(+), 58 deletions(-) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/1.fir.kt index bbd90fc5197..cf64e0234b7 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/1.fir.kt @@ -2,6 +2,15 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 1 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, functions, typealiases, properties, enumClasses + */ + // FILE: other_package.kt package otherpackage @@ -129,7 +138,7 @@ fun case_7() { // TESTCASE NUMBER: 8 fun case_8(x: TypealiasNullableString) { - if (x !== null && x != null) x + if (x !== null && x != null) x if (x !== null && x != null) x.equals(null) if (x !== null && x != null) x.propT if (x !== null && x != null) x.propAny @@ -208,7 +217,7 @@ fun case_11(x: TypealiasNullableStringIndirect?, y: TypealiasNullableStringIndir // TESTCASE NUMBER: 12 fun case_12(x: TypealiasNullableStringIndirect, y: TypealiasNullableStringIndirect) = if (x == null) "1" - else if (y === null) x + else if (y === null) x else if (y === null) x.equals(null) else if (y === null) x.propT else if (y === null) x.propAny @@ -604,7 +613,7 @@ open class Case29(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (this.b != null) this.b.funAny() if (this.b != null) this.b.funNullableT() if (this.b != null) this.b.funNullableAny() - if (this.b != null) b + if (this.b != null) b if (this.b != null) b.equals(null) if (this.b != null) b.propT if (this.b != null) b.propAny @@ -633,7 +642,7 @@ open class Case29(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (b != null || this.b != null) b.funAny() if (b != null || this.b != null) b.funNullableT() if (b != null || this.b != null) b.funNullableAny() - if (b != null || this.b != null) b + if (b != null || this.b != null) b if (b != null || this.b != null) this.b.equals(null) if (b != null || this.b != null) this.b.propT if (b != null || this.b != null) this.b.propAny @@ -692,7 +701,7 @@ open class Case29(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (this.c != null) c.funAny() if (this.c != null) c.funNullableT() if (this.c != null) c.funNullableAny() - if (this.c != null) c + if (this.c != null) c if (c != null || this.c != null) c.equals(null) if (c != null || this.c != null) c.propT if (c != null || this.c != null) c.propAny @@ -702,7 +711,7 @@ open class Case29(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (c != null || this.c != null) c.funAny() if (c != null || this.c != null) c.funNullableT() if (c != null || this.c != null) c.funNullableAny() - if (c != null || this.c != null) c + if (c != null || this.c != null) c if (c != null || this.c != null) this.c.equals(null) if (c != null || this.c != null) this.c.propT if (c != null || this.c != null) this.c.propAny @@ -761,7 +770,7 @@ open class Case29(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (this.d != null) d.funAny() if (this.d != null) d.funNullableT() if (this.d != null) d.funNullableAny() - if (this.d != null) d + if (this.d != null) d if (d != null || this.d != null) d.equals(null) if (d != null || this.d != null) d.propT if (d != null || this.d != null) d.propAny @@ -771,7 +780,7 @@ open class Case29(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (d != null || this.d != null) d.funAny() if (d != null || this.d != null) d.funNullableT() if (d != null || this.d != null) d.funNullableAny() - if (d != null || this.d != null) d + if (d != null || this.d != null) d if (d != null || this.d != null) this.d.equals(null) if (d != null || this.d != null) this.d.propT if (d != null || this.d != null) this.d.propAny @@ -820,7 +829,7 @@ open class Case29(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (this.e != null) e.funAny() if (this.e != null) e.funNullableT() if (this.e != null) e.funNullableAny() - if (this.e != null) e + if (this.e != null) e if (e != null) this.e.equals(null) if (e != null) this.e.propT if (e != null) this.e.propAny @@ -840,7 +849,7 @@ open class Case29(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (e != null || this.e != null) e.funAny() if (e != null || this.e != null) e.funNullableT() if (e != null || this.e != null) e.funNullableAny() - if (e != null || this.e != null) e + if (e != null || this.e != null) e if (e != null || this.e != null) this.e.equals(null) if (e != null || this.e != null) this.e.propT if (e != null || this.e != null) this.e.propAny @@ -889,7 +898,7 @@ open class Case29(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (this.f != null) f.funAny() if (this.f != null) f.funNullableT() if (this.f != null) f.funNullableAny() - if (this.f != null) f + if (this.f != null) f if (f != null) this.f.equals(null) if (f != null) this.f.propT if (f != null) this.f.propAny @@ -909,7 +918,7 @@ open class Case29(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (f != null || this.f != null) f.funAny() if (f != null || this.f != null) f.funNullableT() if (f != null || this.f != null) f.funNullableAny() - if (f != null || this.f != null) f + if (f != null || this.f != null) f if (f != null || this.f != null) this.f.equals(null) if (f != null || this.f != null) this.f.propT if (f != null || this.f != null) this.f.propAny @@ -1260,7 +1269,7 @@ open class Case29(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (w != null) w.funAny() if (w != null) w.funNullableT() if (w != null) w.funNullableAny() - if (w != null) w + if (w != null) w if (this.w != null) w.equals(null) if (this.w != null) w.propT if (this.w != null) w.propAny @@ -1270,7 +1279,7 @@ open class Case29(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (this.w != null) w.funAny() if (this.w != null) w.funNullableT() if (this.w != null) w.funNullableAny() - if (this.w != null) w + if (this.w != null) w if (w != null || this.w != null) w.equals(null) if (w != null || this.w != null) w.propT if (w != null || this.w != null) w.propAny @@ -1280,7 +1289,7 @@ open class Case29(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (w != null || this.w != null) w.funAny() if (w != null || this.w != null) w.funNullableT() if (w != null || this.w != null) w.funNullableAny() - if (w != null || this.w != null) w + if (w != null || this.w != null) w if (w != null || this.w != null) this.w.equals(null) if (w != null || this.w != null) this.w.propT if (w != null || this.w != null) this.w.propAny @@ -1295,9 +1304,9 @@ open class Case29(a: Int?, val b: Float?, private val c: Unit?, protected val d: s = null s.hashCode() s - if (s != null) s - if (this.s != null) s - if (s != null || this.s != null) s + if (s != null) s + if (this.s != null) s + if (s != null || this.s != null) s if (s != null || this.s != null) this.s } @@ -1657,7 +1666,7 @@ sealed class Case30(a: Int?, val b: Float?, private val c: Unit?, protected val if (this.b != null) b.funAny() if (this.b != null) b.funNullableT() if (this.b != null) b.funNullableAny() - if (this.b != null) b + if (this.b != null) b if (b != null) this.b.equals(null) if (b != null) this.b.propT if (b != null) this.b.propAny @@ -1677,7 +1686,7 @@ sealed class Case30(a: Int?, val b: Float?, private val c: Unit?, protected val if (b != null || this.b != null) b.funAny() if (b != null || this.b != null) b.funNullableT() if (b != null || this.b != null) b.funNullableAny() - if (b != null || this.b != null) b + if (b != null || this.b != null) b if (b != null || this.b != null) this.b.equals(null) if (b != null || this.b != null) this.b.propT if (b != null || this.b != null) this.b.propAny @@ -1736,7 +1745,7 @@ sealed class Case30(a: Int?, val b: Float?, private val c: Unit?, protected val if (this.c != null) c.funAny() if (this.c != null) c.funNullableT() if (this.c != null) c.funNullableAny() - if (this.c != null) c + if (this.c != null) c if (c != null || this.c != null) c.equals(null) if (c != null || this.c != null) c.propT if (c != null || this.c != null) c.propAny @@ -1746,7 +1755,7 @@ sealed class Case30(a: Int?, val b: Float?, private val c: Unit?, protected val if (c != null || this.c != null) c.funAny() if (c != null || this.c != null) c.funNullableT() if (c != null || this.c != null) c.funNullableAny() - if (c != null || this.c != null) c + if (c != null || this.c != null) c if (c != null || this.c != null) this.c.equals(null) if (c != null || this.c != null) this.c.propT if (c != null || this.c != null) this.c.propAny @@ -1805,7 +1814,7 @@ sealed class Case30(a: Int?, val b: Float?, private val c: Unit?, protected val if (this.d != null) d.funAny() if (this.d != null) d.funNullableT() if (this.d != null) d.funNullableAny() - if (this.d != null) d + if (this.d != null) d if (d != null || this.d != null) d.equals(null) if (d != null || this.d != null) d.propT if (d != null || this.d != null) d.propAny @@ -1815,7 +1824,7 @@ sealed class Case30(a: Int?, val b: Float?, private val c: Unit?, protected val if (d != null || this.d != null) d.funAny() if (d != null || this.d != null) d.funNullableT() if (d != null || this.d != null) d.funNullableAny() - if (d != null || this.d != null) d + if (d != null || this.d != null) d if (d != null || this.d != null) this.d.equals(null) if (d != null || this.d != null) this.d.propT if (d != null || this.d != null) this.d.propAny @@ -1864,7 +1873,7 @@ sealed class Case30(a: Int?, val b: Float?, private val c: Unit?, protected val if (this.e != null) e.funAny() if (this.e != null) e.funNullableT() if (this.e != null) e.funNullableAny() - if (this.e != null) e + if (this.e != null) e if (e != null) this.e.equals(null) if (e != null) this.e.propT if (e != null) this.e.propAny @@ -1884,7 +1893,7 @@ sealed class Case30(a: Int?, val b: Float?, private val c: Unit?, protected val if (e != null || this.e != null) e.funAny() if (e != null || this.e != null) e.funNullableT() if (e != null || this.e != null) e.funNullableAny() - if (e != null || this.e != null) e + if (e != null || this.e != null) e if (e != null || this.e != null) this.e.equals(null) if (e != null || this.e != null) this.e.propT if (e != null || this.e != null) this.e.propAny @@ -1933,7 +1942,7 @@ sealed class Case30(a: Int?, val b: Float?, private val c: Unit?, protected val if (this.f != null) f.funAny() if (this.f != null) f.funNullableT() if (this.f != null) f.funNullableAny() - if (this.f != null) f + if (this.f != null) f if (f != null) this.f.equals(null) if (f != null) this.f.propT if (f != null) this.f.propAny @@ -1953,7 +1962,7 @@ sealed class Case30(a: Int?, val b: Float?, private val c: Unit?, protected val if (f != null || this.f != null) f.funAny() if (f != null || this.f != null) f.funNullableT() if (f != null || this.f != null) f.funNullableAny() - if (f != null || this.f != null) f + if (f != null || this.f != null) f if (f != null || this.f != null) this.f.equals(null) if (f != null || this.f != null) this.f.propT if (f != null || this.f != null) this.f.propAny @@ -2304,7 +2313,7 @@ sealed class Case30(a: Int?, val b: Float?, private val c: Unit?, protected val if (w != null) w.funAny() if (w != null) w.funNullableT() if (w != null) w.funNullableAny() - if (w != null) w + if (w != null) w if (this.w != null) w.equals(null) if (this.w != null) w.propT if (this.w != null) w.propAny @@ -2314,7 +2323,7 @@ sealed class Case30(a: Int?, val b: Float?, private val c: Unit?, protected val if (this.w != null) w.funAny() if (this.w != null) w.funNullableT() if (this.w != null) w.funNullableAny() - if (this.w != null) w + if (this.w != null) w if (w != null || this.w != null) w.equals(null) if (w != null || this.w != null) w.propT if (w != null || this.w != null) w.propAny @@ -2324,7 +2333,7 @@ sealed class Case30(a: Int?, val b: Float?, private val c: Unit?, protected val if (w != null || this.w != null) w.funAny() if (w != null || this.w != null) w.funNullableT() if (w != null || this.w != null) w.funNullableAny() - if (w != null || this.w != null) w + if (w != null || this.w != null) w if (w != null || this.w != null) this.w.equals(null) if (w != null || this.w != null) this.w.propT if (w != null || this.w != null) this.w.propAny @@ -2339,9 +2348,9 @@ sealed class Case30(a: Int?, val b: Float?, private val c: Unit?, protected val s = null s.hashCode() s - if (s != null) s - if (this.s != null) s - if (s != null || this.s != null) s + if (s != null) s + if (this.s != null) s + if (s != null || this.s != null) s if (s != null || this.s != null) this.s } @@ -2703,7 +2712,7 @@ enum class Case31(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (this.b != null) b.funAny() if (this.b != null) b.funNullableT() if (this.b != null) b.funNullableAny() - if (this.b != null) b + if (this.b != null) b if (b != null) this.b.equals(null) if (b != null) this.b.propT if (b != null) this.b.propAny @@ -2723,7 +2732,7 @@ enum class Case31(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (b != null || this.b != null) b.funAny() if (b != null || this.b != null) b.funNullableT() if (b != null || this.b != null) b.funNullableAny() - if (b != null || this.b != null) b + if (b != null || this.b != null) b if (b != null || this.b != null) this.b.equals(null) if (b != null || this.b != null) this.b.propT if (b != null || this.b != null) this.b.propAny @@ -2782,7 +2791,7 @@ enum class Case31(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (this.c != null) c.funAny() if (this.c != null) c.funNullableT() if (this.c != null) c.funNullableAny() - if (this.c != null) c + if (this.c != null) c if (c != null || this.c != null) c.equals(null) if (c != null || this.c != null) c.propT if (c != null || this.c != null) c.propAny @@ -2792,7 +2801,7 @@ enum class Case31(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (c != null || this.c != null) c.funAny() if (c != null || this.c != null) c.funNullableT() if (c != null || this.c != null) c.funNullableAny() - if (c != null || this.c != null) c + if (c != null || this.c != null) c if (c != null || this.c != null) this.c.equals(null) if (c != null || this.c != null) this.c.propT if (c != null || this.c != null) this.c.propAny @@ -2851,7 +2860,7 @@ enum class Case31(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (this.d != null) d.funAny() if (this.d != null) d.funNullableT() if (this.d != null) d.funNullableAny() - if (this.d != null) d + if (this.d != null) d if (d != null || this.d != null) d.equals(null) if (d != null || this.d != null) d.propT if (d != null || this.d != null) d.propAny @@ -2861,7 +2870,7 @@ enum class Case31(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (d != null || this.d != null) d.funAny() if (d != null || this.d != null) d.funNullableT() if (d != null || this.d != null) d.funNullableAny() - if (d != null || this.d != null) d + if (d != null || this.d != null) d if (d != null || this.d != null) this.d.equals(null) if (d != null || this.d != null) this.d.propT if (d != null || this.d != null) this.d.propAny @@ -2910,7 +2919,7 @@ enum class Case31(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (this.e != null) e.funAny() if (this.e != null) e.funNullableT() if (this.e != null) e.funNullableAny() - if (this.e != null) e + if (this.e != null) e if (e != null) this.e.equals(null) if (e != null) this.e.propT if (e != null) this.e.propAny @@ -2930,7 +2939,7 @@ enum class Case31(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (e != null || this.e != null) e.funAny() if (e != null || this.e != null) e.funNullableT() if (e != null || this.e != null) e.funNullableAny() - if (e != null || this.e != null) e + if (e != null || this.e != null) e if (e != null || this.e != null) this.e.equals(null) if (e != null || this.e != null) this.e.propT if (e != null || this.e != null) this.e.propAny @@ -2979,7 +2988,7 @@ enum class Case31(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (this.f != null) f.funAny() if (this.f != null) f.funNullableT() if (this.f != null) f.funNullableAny() - if (this.f != null) f + if (this.f != null) f if (f != null) this.f.equals(null) if (f != null) this.f.propT if (f != null) this.f.propAny @@ -2999,7 +3008,7 @@ enum class Case31(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (f != null || this.f != null) f.funAny() if (f != null || this.f != null) f.funNullableT() if (f != null || this.f != null) f.funNullableAny() - if (f != null || this.f != null) f + if (f != null || this.f != null) f if (f != null || this.f != null) this.f.equals(null) if (f != null || this.f != null) this.f.propT if (f != null || this.f != null) this.f.propAny @@ -3349,7 +3358,7 @@ enum class Case31(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (w != null) w.funAny() if (w != null) w.funNullableT() if (w != null) w.funNullableAny() - if (w != null) w + if (w != null) w if (this.w != null) w.equals(null) if (this.w != null) w.propT if (this.w != null) w.propAny @@ -3359,7 +3368,7 @@ enum class Case31(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (this.w != null) w.funAny() if (this.w != null) w.funNullableT() if (this.w != null) w.funNullableAny() - if (this.w != null) w + if (this.w != null) w if (w != null || this.w != null) w.equals(null) if (w != null || this.w != null) w.propT if (w != null || this.w != null) w.propAny @@ -3369,7 +3378,7 @@ enum class Case31(a: Int?, val b: Float?, private val c: Unit?, protected val d: if (w != null || this.w != null) w.funAny() if (w != null || this.w != null) w.funNullableT() if (w != null || this.w != null) w.funNullableAny() - if (w != null || this.w != null) w + if (w != null || this.w != null) w if (w != null || this.w != null) this.w.equals(null) if (w != null || this.w != null) this.w.propT if (w != null || this.w != null) this.w.propAny @@ -3384,9 +3393,9 @@ enum class Case31(a: Int?, val b: Float?, private val c: Unit?, protected val d: s = null s.hashCode() s - if (s != null) s - if (this.s != null) s - if (s != null || this.s != null) s + if (s != null) s + if (this.s != null) s + if (s != null || this.s != null) s if (s != null || this.s != null) this.s } @@ -3997,7 +4006,7 @@ object Case32 { if (w != null) w.funAny() if (w != null) w.funNullableT() if (w != null) w.funNullableAny() - if (w != null) w + if (w != null) w if (this.w != null) w.equals(null) if (this.w != null) w.propT if (this.w != null) w.propAny @@ -4007,7 +4016,7 @@ object Case32 { if (this.w != null) w.funAny() if (this.w != null) w.funNullableT() if (this.w != null) w.funNullableAny() - if (this.w != null) w + if (this.w != null) w if (w != null || this.w != null) w.equals(null) if (w != null || this.w != null) w.propT if (w != null || this.w != null) w.propAny @@ -4017,7 +4026,7 @@ object Case32 { if (w != null || this.w != null) w.funAny() if (w != null || this.w != null) w.funNullableT() if (w != null || this.w != null) w.funNullableAny() - if (w != null || this.w != null) w + if (w != null || this.w != null) w if (w != null || this.w != null) this.w.equals(null) if (w != null || this.w != null) this.w.propT if (w != null || this.w != null) this.w.propAny @@ -4032,9 +4041,9 @@ object Case32 { s = null s.hashCode() s - if (s != null) s - if (this.s != null) s - if (s != null || this.s != null) s + if (s != null) s + if (this.s != null) s + if (s != null || this.s != null) s if (s != null || this.s != null) this.s } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/37.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/37.fir.kt index a7e6951f4f6..dc3d3d23c97 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/37.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/37.fir.kt @@ -98,7 +98,7 @@ fun case_9(x: Boolean?) { while (x ?: return) while (x == null) - x + x x.equals(10) } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/9.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/9.fir.kt index 7b5c51d6683..56172b08e81 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/9.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/9.fir.kt @@ -61,7 +61,7 @@ fun case_3(a: Inv?) { if (a != null) { val b = a if (a == null) - ")!>b + & Inv")!>b & Inv")!>b.equals(null) & Inv")!>b.propT & Inv")!>b.propAny From 2592eed0e7ffc3a625ea2d395ec7e695d9eb383f Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 18 Nov 2020 13:30:44 +0300 Subject: [PATCH 219/698] [FIR TEST] More precise control of source kind in createDebugInfo --- .../kotlin/fir/AbstractFirDiagnosticTest.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt index f3de6c66efe..8328b43d17c 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt @@ -66,6 +66,11 @@ abstract class AbstractFirDiagnosticsTest : AbstractFirBaseDiagnosticsTest() { const val DUMP_CFG_DIRECTIVE = "DUMP_CFG" const val COMMON_COROUTINES_DIRECTIVE = "COMMON_COROUTINES_TEST" + private val allowedKindsForDebugInfo = setOf( + FirRealSourceElementKind, + FirFakeSourceElementKind.DesugaredCompoundAssignment, + ) + val TestFile.withDumpCfgDirective: Boolean get() = DUMP_CFG_DIRECTIVE in directives @@ -204,7 +209,12 @@ abstract class AbstractFirDiagnosticsTest : AbstractFirBaseDiagnosticsTest() { argument: () -> String, ): FirDiagnosticWithParameters1? { val sourceElement = element.source ?: return null - if (sourceElement.kind != FirRealSourceElementKind) return null + val sourceKind = sourceElement.kind + if (sourceKind !in allowedKindsForDebugInfo) { + if (sourceKind != FirFakeSourceElementKind.ImplicitReturn || sourceElement.elementType != KtNodeTypes.RETURN) { + return null + } + } // Lambda argument is always (?) duplicated by function literal // Block expression is always (?) duplicated by single block expression if (sourceElement.elementType == KtNodeTypes.LAMBDA_ARGUMENT || sourceElement.elementType == KtNodeTypes.BLOCK) return null From 558ac1678ec9b680502db1924c207eeb59cb9611 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 18 Nov 2020 13:58:06 +0300 Subject: [PATCH 220/698] Create FIR fake source element for checked safe call subject --- .../src/org/jetbrains/kotlin/fir/builder/ConversionUtils.kt | 2 +- .../fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/ConversionUtils.kt b/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/ConversionUtils.kt index ea464e31fd5..e99b1c79f28 100644 --- a/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/ConversionUtils.kt +++ b/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/ConversionUtils.kt @@ -499,7 +499,7 @@ fun FirQualifiedAccess.wrapWithSafeCall(receiver: FirExpression): FirSafeCallExp this.originalReceiverRef = FirExpressionRef().apply { bind(receiver) } - this.source = receiver.source + this.source = receiver.source?.fakeElement(FirFakeSourceElementKind.CheckedSafeCallSubject) } replaceExplicitReceiver(checkedSafeCallSubject) diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt index b546acbe5c4..fde7bee3463 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt @@ -154,6 +154,9 @@ sealed class FirFakeSourceElementKind : FirSourceElementKind() { // fun foo(vararg args: Int) {} // fun bar(1, 2, 3) --> [resolved] fun bar(VarargArgument(1, 2, 3)) object VarargArgument : FirFakeSourceElementKind() + + // Part of desugared x?.y + object CheckedSafeCallSubject : FirFakeSourceElementKind() } sealed class FirSourceElement { From 52a07e31c7e78cf1b5b0e39c14f12bd8ae776655 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 18 Nov 2020 16:24:08 +0300 Subject: [PATCH 221/698] [FIR] Remove D_I_EXPRESSION_TYPE from qualified calls in spec test data In FIR, the source of FirFunctionCall is set to call's selector. In practice, sometimes (e.g. for DEBUG_INFO_CALL) we expect the selector as the source, and sometimes (e.g. for DEBUG_INFO_EXPRESSION_TYPE) we expect the whole qualified call as the source. Also, some diagnostics, like REDUNDANT_CALL_OF_CONVERSION_METHOD, are expected to be reported on a selector, not on a whole call. At this moment we ignore the problem & just don't support DEBUG_INFO_EXPRESSION_TYPE for qualified calls. --- .../algorithm-of-msc-selection/p-11/pos/4.2.fir.kt | 8 ++++---- .../algorithm-of-msc-selection/p-12/pos/2.2.fir.kt | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.2.fir.kt index 2f8419a07c8..b01c02024a4 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.2.fir.kt @@ -64,16 +64,16 @@ fun case2(case: Case2) { case.boo.boo(x = 1, y = 2) case.apply { 1.boo(1, 1) } - case.apply { 1.boo(1, 1) } + case.apply { 1.boo(1, 1) } case.let { 1.boo(1, 1) } - case.let { 1.boo(1, 1) } + case.let { 1.boo(1, 1) } case.also { 1.boo(1, 1) } - case.also { 1.boo(1, 1) } + case.also { 1.boo(1, 1) } case.run { 1.boo(1, 1) } - case.run { 1.boo(1, 1) } + case.run { 1.boo(1, 1) } } // FILE: TestCase1.kt diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.2.fir.kt index 6b0541d5f9d..bcafafd5692 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.2.fir.kt @@ -56,16 +56,16 @@ fun case2(case: Case2) { case.boo.boo(x = 1, y = 2) case.apply { 1.boo(1, 1) } - case.apply { 1.boo(1, 1) } + case.apply { 1.boo(1, 1) } case.let { 1.boo(1, 1) } - case.let { 1.boo(1, 1) } + case.let { 1.boo(1, 1) } case.also { 1.boo(1, 1) } - case.also { 1.boo(1, 1) } + case.also { 1.boo(1, 1) } case.run { 1.boo(1, 1) } - case.run { 1.boo(1, 1) } + case.run { 1.boo(1, 1) } } // FILE: TestCase1.kt From 6f8947dd048aaca246310746c8fecd00c2dc2e64 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 19 Nov 2020 10:23:02 +0300 Subject: [PATCH 222/698] Extract UnboundDiagnostic, DiagnosticFactory/Renderer to frontend-common --- .../kotlin/diagnostics/DiagnosticFactory.kt | 30 ++++++++----------- .../jetbrains/kotlin/diagnostics/Severity.kt | 12 ++++++++ .../kotlin/diagnostics/UnboundDiagnostic.kt | 15 ++++++++++ .../rendering/DiagnosticRenderer.kt | 12 ++++++++ .../kotlin/diagnostics/Diagnostic.kt | 7 +---- .../kotlin/diagnostics/Severity.java | 23 -------------- .../rendering/DiagnosticRenderer.java | 25 ---------------- .../diagnosticsWithParameterRenderers.kt | 2 +- 8 files changed, 53 insertions(+), 73 deletions(-) rename compiler/{frontend => frontend.common}/src/org/jetbrains/kotlin/diagnostics/DiagnosticFactory.kt (52%) create mode 100644 compiler/frontend.common/src/org/jetbrains/kotlin/diagnostics/Severity.kt create mode 100644 compiler/frontend.common/src/org/jetbrains/kotlin/diagnostics/UnboundDiagnostic.kt create mode 100644 compiler/frontend.common/src/org/jetbrains/kotlin/diagnostics/rendering/DiagnosticRenderer.kt delete mode 100644 compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Severity.java delete mode 100644 compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DiagnosticRenderer.java diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/DiagnosticFactory.kt b/compiler/frontend.common/src/org/jetbrains/kotlin/diagnostics/DiagnosticFactory.kt similarity index 52% rename from compiler/frontend/src/org/jetbrains/kotlin/diagnostics/DiagnosticFactory.kt rename to compiler/frontend.common/src/org/jetbrains/kotlin/diagnostics/DiagnosticFactory.kt index 9ed41ca5589..7891448b8c9 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/DiagnosticFactory.kt +++ b/compiler/frontend.common/src/org/jetbrains/kotlin/diagnostics/DiagnosticFactory.kt @@ -1,25 +1,14 @@ /* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ + package org.jetbrains.kotlin.diagnostics import org.jetbrains.kotlin.diagnostics.rendering.DiagnosticRenderer import java.lang.IllegalArgumentException -import java.lang.SafeVarargs -abstract class DiagnosticFactory protected constructor( +abstract class DiagnosticFactory protected constructor( open var name: String?, open val severity: Severity ) { @@ -28,7 +17,12 @@ abstract class DiagnosticFactory protected constructor( protected constructor(severity: Severity) : this(null, severity) - fun cast(diagnostic: Diagnostic): D { + @Suppress("UNCHECKED_CAST") + fun initDefaultRenderer(defaultRenderer: DiagnosticRenderer<*>?) { + this.defaultRenderer = defaultRenderer as DiagnosticRenderer? + } + + fun cast(diagnostic: UnboundDiagnostic): D { require(!(diagnostic.factory !== this)) { "Factory mismatch: expected " + this + " but was " + diagnostic.factory } @Suppress("UNCHECKED_CAST") return diagnostic as D @@ -40,11 +34,11 @@ abstract class DiagnosticFactory protected constructor( companion object { @SafeVarargs - fun cast(diagnostic: Diagnostic, vararg factories: DiagnosticFactory): D { + fun cast(diagnostic: UnboundDiagnostic, vararg factories: DiagnosticFactory): D { return cast(diagnostic, listOf(*factories)) } - fun cast(diagnostic: Diagnostic, factories: Collection>): D { + fun cast(diagnostic: UnboundDiagnostic, factories: Collection>): D { for (factory in factories) { if (diagnostic.factory === factory) return factory.cast(diagnostic) } diff --git a/compiler/frontend.common/src/org/jetbrains/kotlin/diagnostics/Severity.kt b/compiler/frontend.common/src/org/jetbrains/kotlin/diagnostics/Severity.kt new file mode 100644 index 00000000000..96f3c3e0f12 --- /dev/null +++ b/compiler/frontend.common/src/org/jetbrains/kotlin/diagnostics/Severity.kt @@ -0,0 +1,12 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.diagnostics + +enum class Severity { + INFO, + ERROR, + WARNING +} \ No newline at end of file diff --git a/compiler/frontend.common/src/org/jetbrains/kotlin/diagnostics/UnboundDiagnostic.kt b/compiler/frontend.common/src/org/jetbrains/kotlin/diagnostics/UnboundDiagnostic.kt new file mode 100644 index 00000000000..4b2c70a274d --- /dev/null +++ b/compiler/frontend.common/src/org/jetbrains/kotlin/diagnostics/UnboundDiagnostic.kt @@ -0,0 +1,15 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.diagnostics + +import com.intellij.openapi.util.TextRange + +interface UnboundDiagnostic { + val factory: DiagnosticFactory<*> + val severity: Severity + val textRanges: List + val isValid: Boolean +} \ No newline at end of file diff --git a/compiler/frontend.common/src/org/jetbrains/kotlin/diagnostics/rendering/DiagnosticRenderer.kt b/compiler/frontend.common/src/org/jetbrains/kotlin/diagnostics/rendering/DiagnosticRenderer.kt new file mode 100644 index 00000000000..5e5fba8ff15 --- /dev/null +++ b/compiler/frontend.common/src/org/jetbrains/kotlin/diagnostics/rendering/DiagnosticRenderer.kt @@ -0,0 +1,12 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.diagnostics.rendering + +import org.jetbrains.kotlin.diagnostics.UnboundDiagnostic + +interface DiagnosticRenderer { + fun render(diagnostic: D): String +} diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Diagnostic.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Diagnostic.kt index be763ca2c0a..ff1dc5ee0a1 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Diagnostic.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Diagnostic.kt @@ -15,15 +15,10 @@ */ package org.jetbrains.kotlin.diagnostics -import com.intellij.openapi.util.TextRange import com.intellij.psi.PsiElement import com.intellij.psi.PsiFile -interface Diagnostic { - val factory: DiagnosticFactory<*> - val severity: Severity +interface Diagnostic : UnboundDiagnostic { val psiElement: PsiElement - val textRanges: List val psiFile: PsiFile? - val isValid: Boolean } \ No newline at end of file diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Severity.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Severity.java deleted file mode 100644 index d4ec5534c1a..00000000000 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Severity.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.diagnostics; - -public enum Severity { - INFO, - ERROR, - WARNING -} diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DiagnosticRenderer.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DiagnosticRenderer.java deleted file mode 100644 index 5471c87dae6..00000000000 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DiagnosticRenderer.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.diagnostics.rendering; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.kotlin.diagnostics.Diagnostic; - -public interface DiagnosticRenderer { - @NotNull - String render(@NotNull D diagnostic); -} diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/diagnosticsWithParameterRenderers.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/diagnosticsWithParameterRenderers.kt index 163207c7b84..bf000d0765a 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/diagnosticsWithParameterRenderers.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/diagnosticsWithParameterRenderers.kt @@ -20,7 +20,7 @@ import org.jetbrains.kotlin.diagnostics.* import java.text.MessageFormat -abstract class AbstractDiagnosticWithParametersRenderer protected constructor(message: String) : DiagnosticRenderer { +abstract class AbstractDiagnosticWithParametersRenderer protected constructor(message: String) : DiagnosticRenderer { private val messageFormat = MessageFormat(message) override fun render(diagnostic: D): String { From 68b748e1645479a333e8a8497a55cfbc918e2916 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 19 Nov 2020 11:45:30 +0300 Subject: [PATCH 223/698] Rename DebugInfoUtil.java to DebugInfoUtil.kt, same with AnalyzingUtils --- .../checkers/utils/{DebugInfoUtil.java => DebugInfoUtil.kt} | 0 .../kotlin/resolve/{AnalyzingUtils.java => AnalyzingUtils.kt} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename compiler/frontend/src/org/jetbrains/kotlin/checkers/utils/{DebugInfoUtil.java => DebugInfoUtil.kt} (100%) rename compiler/frontend/src/org/jetbrains/kotlin/resolve/{AnalyzingUtils.java => AnalyzingUtils.kt} (100%) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/checkers/utils/DebugInfoUtil.java b/compiler/frontend/src/org/jetbrains/kotlin/checkers/utils/DebugInfoUtil.kt similarity index 100% rename from compiler/frontend/src/org/jetbrains/kotlin/checkers/utils/DebugInfoUtil.java rename to compiler/frontend/src/org/jetbrains/kotlin/checkers/utils/DebugInfoUtil.kt diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnalyzingUtils.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnalyzingUtils.kt similarity index 100% rename from compiler/frontend/src/org/jetbrains/kotlin/resolve/AnalyzingUtils.java rename to compiler/frontend/src/org/jetbrains/kotlin/resolve/AnalyzingUtils.kt From 037c5050695573ff865dbab8a488ec066988e557 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 19 Nov 2020 11:45:34 +0300 Subject: [PATCH 224/698] Unbind general FirDiagnostic from PsiFile & PsiElement --- .../messages/AnalyzerWithCompilerReport.kt | 7 +- .../messages/DefaultDiagnosticReporter.kt | 4 +- .../messages/DefaultDiagnosticReporter.kt.202 | 4 +- .../messages/DiagnosticMessageReporter.kt | 2 +- .../compiler/KotlinToJVMBytecodeCompiler.kt | 7 +- .../fir/analysis/diagnostics/FirDiagnostic.kt | 13 +- .../kotlin/diagnostics/GenericDiagnostics.kt | 14 + .../checkers/diagnostics/ActualDiagnostic.kt | 2 +- .../kotlin/checkers/utils/DebugInfoUtil.kt | 322 +++++++++--------- .../kotlin/diagnostics/Diagnostic.kt | 2 +- .../kotlin/diagnostics/DiagnosticUtils.java | 14 +- .../rendering/DefaultErrorMessages.java | 5 +- .../diagnosticsWithParameterRenderers.kt | 2 +- .../kotlin/resolve/AnalyzingUtils.kt | 114 +++---- .../kotlin/resolve/diagnostics/Diagnostics.kt | 15 +- .../resolve/diagnostics/SimpleDiagnostics.kt | 7 +- .../diagnostics/SimpleGenericDiagnostics.kt | 17 + .../fir/AbstractFirBaseDiagnosticsTest.kt | 3 +- .../validators/DiagnosticTestTypeValidator.kt | 2 +- .../idea/highlighter/IdeErrorMessages.java | 5 +- .../idea/internal/KotlinBytecodeToolWindow.kt | 2 +- .../quickfix/AddFunctionToSupertypeFix.kt | 2 +- .../quickfix/AddPropertyToSupertypeFix.kt | 2 +- .../messages/IdeDiagnosticMessageHolder.kt | 2 +- 24 files changed, 287 insertions(+), 282 deletions(-) create mode 100644 compiler/frontend.common/src/org/jetbrains/kotlin/diagnostics/GenericDiagnostics.kt create mode 100644 compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/SimpleGenericDiagnostics.kt diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/AnalyzerWithCompilerReport.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/AnalyzerWithCompilerReport.kt index a84d6d49975..0c749ba5708 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/AnalyzerWithCompilerReport.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/AnalyzerWithCompilerReport.kt @@ -39,7 +39,6 @@ import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.checkers.ExperimentalUsageChecker -import org.jetbrains.kotlin.resolve.diagnostics.Diagnostics import org.jetbrains.kotlin.resolve.jvm.JvmBindingContextSlices import org.jetbrains.kotlin.resolve.jvm.JvmClassName import org.jetbrains.kotlin.serialization.deserialization.IncompatibleVersionErrorData @@ -154,16 +153,16 @@ class AnalyzerWithCompilerReport( return diagnostic.severity == Severity.ERROR } - fun reportDiagnostics(unsortedDiagnostics: Diagnostics, reporter: DiagnosticMessageReporter): Boolean { + fun reportDiagnostics(unsortedDiagnostics: GenericDiagnostics<*>, reporter: DiagnosticMessageReporter): Boolean { var hasErrors = false - val diagnostics = sortedDiagnostics(unsortedDiagnostics.all()) + val diagnostics = sortedDiagnostics(unsortedDiagnostics.all().filterIsInstance()) for (diagnostic in diagnostics) { hasErrors = hasErrors or reportDiagnostic(diagnostic, reporter) } return hasErrors } - fun reportDiagnostics(diagnostics: Diagnostics, messageCollector: MessageCollector): Boolean { + fun reportDiagnostics(diagnostics: GenericDiagnostics<*>, messageCollector: MessageCollector): Boolean { val hasErrors = reportDiagnostics(diagnostics, DefaultDiagnosticReporter(messageCollector)) if (diagnostics.any { it.factory == Errors.INCOMPATIBLE_CLASS }) { diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt index f7b8e272c98..2d82644bf95 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt @@ -28,9 +28,9 @@ class DefaultDiagnosticReporter(override val messageCollector: MessageCollector) interface MessageCollectorBasedReporter : DiagnosticMessageReporter { val messageCollector: MessageCollector - override fun report(diagnostic: Diagnostic, file: PsiFile?, render: String) = messageCollector.report( + override fun report(diagnostic: Diagnostic, file: PsiFile, render: String) = messageCollector.report( AnalyzerWithCompilerReport.convertSeverity(diagnostic.severity), render, - MessageUtil.psiFileToMessageLocation(file!!, file.name, DiagnosticUtils.getLineAndColumnRange(diagnostic)) + MessageUtil.psiFileToMessageLocation(file, file.name, DiagnosticUtils.getLineAndColumnRange(diagnostic)) ) } diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt.202 b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt.202 index 73085c2317f..f560fc945f3 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt.202 +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt.202 @@ -28,9 +28,9 @@ class DefaultDiagnosticReporter(override val messageCollector: MessageCollector) interface MessageCollectorBasedReporter : DiagnosticMessageReporter { val messageCollector: MessageCollector - override fun report(diagnostic: Diagnostic, file: PsiFile?, render: String) = messageCollector.report( + override fun report(diagnostic: Diagnostic, file: PsiFile, render: String) = messageCollector.report( AnalyzerWithCompilerReport.convertSeverity(diagnostic.severity), render, - MessageUtil.psiFileToMessageLocation(file!!, file.name, DiagnosticUtils.getLineAndColumn(diagnostic)) + MessageUtil.psiFileToMessageLocation(file, file.name, DiagnosticUtils.getLineAndColumn(diagnostic)) ) } diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DiagnosticMessageReporter.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DiagnosticMessageReporter.kt index 4b6be982707..246781e6187 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DiagnosticMessageReporter.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DiagnosticMessageReporter.kt @@ -20,5 +20,5 @@ import com.intellij.psi.PsiFile import org.jetbrains.kotlin.diagnostics.Diagnostic interface DiagnosticMessageReporter { - fun report(diagnostic: Diagnostic, file: PsiFile?, render: String) + fun report(diagnostic: Diagnostic, file: PsiFile, render: String) } diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt index 2bd41eda42c..80b91b123e3 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt @@ -18,7 +18,6 @@ package org.jetbrains.kotlin.cli.jvm.compiler import com.intellij.openapi.project.Project import com.intellij.openapi.vfs.* -import com.intellij.psi.PsiElement import com.intellij.psi.PsiElementFinder import com.intellij.psi.PsiJavaModule import com.intellij.psi.search.DelegatingGlobalSearchScope @@ -54,9 +53,7 @@ import org.jetbrains.kotlin.config.* import org.jetbrains.kotlin.container.get import org.jetbrains.kotlin.descriptors.ModuleDescriptor import org.jetbrains.kotlin.diagnostics.* -import org.jetbrains.kotlin.fir.FirPsiSourceElement import org.jetbrains.kotlin.fir.analysis.FirAnalyzerFacade -import org.jetbrains.kotlin.fir.analysis.diagnostics.* import org.jetbrains.kotlin.fir.backend.jvm.FirJvmBackendClassResolver import org.jetbrains.kotlin.fir.backend.jvm.FirMetadataSerializer import org.jetbrains.kotlin.fir.checkers.registerExtendedCommonCheckers @@ -72,7 +69,7 @@ import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.resolve.CompilerEnvironment -import org.jetbrains.kotlin.resolve.diagnostics.SimpleDiagnostics +import org.jetbrains.kotlin.resolve.diagnostics.SimpleGenericDiagnostics import org.jetbrains.kotlin.resolve.jvm.KotlinJavaPsiFacade import org.jetbrains.kotlin.resolve.lazy.declarations.FileBasedDeclarationProviderFactory import org.jetbrains.kotlin.utils.newLinkedHashMapWithExpectedSize @@ -343,7 +340,7 @@ object KotlinToJVMBytecodeCompiler { firAnalyzerFacade.runResolution() val firDiagnostics = firAnalyzerFacade.runCheckers().values.flatten() AnalyzerWithCompilerReport.reportDiagnostics( - SimpleDiagnostics(firDiagnostics), + SimpleGenericDiagnostics(firDiagnostics), environment.messageCollector ) performanceManager?.notifyAnalysisFinished() diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnostic.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnostic.kt index d319a2d32c1..2307c8220e6 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnostic.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnostic.kt @@ -10,13 +10,14 @@ import com.intellij.psi.PsiElement import com.intellij.psi.PsiFile import org.jetbrains.kotlin.diagnostics.Diagnostic import org.jetbrains.kotlin.diagnostics.Severity +import org.jetbrains.kotlin.diagnostics.UnboundDiagnostic import org.jetbrains.kotlin.fir.FirLightSourceElement import org.jetbrains.kotlin.fir.FirPsiSourceElement import org.jetbrains.kotlin.fir.FirSourceElement // ------------------------------ diagnostics ------------------------------ -sealed class FirDiagnostic : Diagnostic { +sealed class FirDiagnostic : UnboundDiagnostic { abstract val element: E abstract override val severity: Severity abstract override val factory: AbstractFirDiagnosticFactory<*, *> @@ -94,16 +95,8 @@ data class FirPsiDiagnosticWithParameters3

: Iterable { + fun all(): Collection + + fun isEmpty(): Boolean = all().isEmpty() + + override fun iterator(): Iterator = all().iterator() +} \ No newline at end of file diff --git a/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/ActualDiagnostic.kt b/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/ActualDiagnostic.kt index aed9a06ca23..435c4b065db 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/ActualDiagnostic.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/ActualDiagnostic.kt @@ -20,7 +20,7 @@ class ActualDiagnostic constructor(val diagnostic: Diagnostic, override val plat get() = diagnostic.factory.name!! val file: PsiFile - get() = diagnostic.psiFile!! + get() = diagnostic.psiFile override fun compareTo(other: AbstractTestDiagnostic): Int { return if (this.diagnostic is DiagnosticWithParameters1<*, *> && other is ActualDiagnostic && other.diagnostic is DiagnosticWithParameters1<*, *>) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/checkers/utils/DebugInfoUtil.kt b/compiler/frontend/src/org/jetbrains/kotlin/checkers/utils/DebugInfoUtil.kt index 1b5d6cec07a..6744946a635 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/checkers/utils/DebugInfoUtil.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/checkers/utils/DebugInfoUtil.kt @@ -2,222 +2,216 @@ * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ +package org.jetbrains.kotlin.checkers.utils -package org.jetbrains.kotlin.checkers.utils; +import com.intellij.psi.PsiElement +import com.intellij.psi.tree.IElementType +import com.intellij.psi.tree.TokenSet +import com.intellij.psi.util.PsiTreeUtil +import org.jetbrains.kotlin.KtNodeTypes +import org.jetbrains.kotlin.descriptors.CallableDescriptor +import org.jetbrains.kotlin.descriptors.DeclarationDescriptor +import org.jetbrains.kotlin.descriptors.PropertyDescriptor +import org.jetbrains.kotlin.diagnostics.DiagnosticFactory +import org.jetbrains.kotlin.diagnostics.Errors +import org.jetbrains.kotlin.lexer.KtTokens +import org.jetbrains.kotlin.psi.* +import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall +import org.jetbrains.kotlin.resolve.BindingContext +import org.jetbrains.kotlin.resolve.BindingContextUtils +import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall +import org.jetbrains.kotlin.resolve.calls.tasks.isDynamic +import org.jetbrains.kotlin.types.ErrorUtils +import org.jetbrains.kotlin.util.slicedMap.WritableSlice +import java.util.HashMap -import com.intellij.psi.PsiElement; -import com.intellij.psi.tree.IElementType; -import com.intellij.psi.tree.TokenSet; -import com.intellij.psi.util.PsiTreeUtil; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.kotlin.KtNodeTypes; -import org.jetbrains.kotlin.descriptors.CallableDescriptor; -import org.jetbrains.kotlin.descriptors.DeclarationDescriptor; -import org.jetbrains.kotlin.descriptors.PropertyDescriptor; -import org.jetbrains.kotlin.descriptors.VariableDescriptor; -import org.jetbrains.kotlin.diagnostics.Diagnostic; -import org.jetbrains.kotlin.diagnostics.DiagnosticFactory; -import org.jetbrains.kotlin.diagnostics.Errors; -import org.jetbrains.kotlin.lexer.KtTokens; -import org.jetbrains.kotlin.psi.*; -import org.jetbrains.kotlin.resolve.BindingContext; -import org.jetbrains.kotlin.resolve.BindingContextUtils; -import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt; -import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall; -import org.jetbrains.kotlin.resolve.calls.tasks.DynamicCallsKt; -import org.jetbrains.kotlin.types.ErrorUtils; -import org.jetbrains.kotlin.types.KotlinType; -import org.jetbrains.kotlin.util.slicedMap.WritableSlice; +object DebugInfoUtil { + private val MAY_BE_UNRESOLVED = TokenSet.create(KtTokens.IN_KEYWORD, KtTokens.NOT_IN) + private val EXCLUDED = TokenSet.create( + KtTokens.COLON, + KtTokens.AS_KEYWORD, + KtTokens.`AS_SAFE`, + KtTokens.IS_KEYWORD, + KtTokens.NOT_IS, + KtTokens.OROR, + KtTokens.ANDAND, + KtTokens.EQ, + KtTokens.EQEQEQ, + KtTokens.EXCLEQEQEQ, + KtTokens.ELVIS, + KtTokens.EXCLEXCL + ) -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -import static org.jetbrains.kotlin.lexer.KtTokens.*; -import static org.jetbrains.kotlin.resolve.BindingContext.*; - -public class DebugInfoUtil { - private static final TokenSet MAY_BE_UNRESOLVED = TokenSet.create(IN_KEYWORD, NOT_IN); - private static final TokenSet EXCLUDED = TokenSet.create( - COLON, AS_KEYWORD, AS_SAFE, IS_KEYWORD, NOT_IS, OROR, ANDAND, EQ, EQEQEQ, EXCLEQEQEQ, ELVIS, EXCLEXCL); - - public abstract static class DebugInfoReporter { - - public void preProcessReference(@NotNull KtReferenceExpression expression) { - // do nothing - } - - public abstract void reportElementWithErrorType(@NotNull KtReferenceExpression expression); - - public abstract void reportMissingUnresolved(@NotNull KtReferenceExpression expression); - - public abstract void reportUnresolvedWithTarget(@NotNull KtReferenceExpression expression, @NotNull String target); - - public void reportDynamicCall(@NotNull KtElement element, DeclarationDescriptor declarationDescriptor) { } - } - - public static void markDebugAnnotations( - @NotNull PsiElement root, - @NotNull BindingContext bindingContext, - @NotNull DebugInfoReporter debugInfoReporter + fun markDebugAnnotations( + root: PsiElement, + bindingContext: BindingContext, + debugInfoReporter: DebugInfoReporter ) { - Map> markedWithErrorElements = new HashMap<>(); - for (Diagnostic diagnostic : bindingContext.getDiagnostics()) { - DiagnosticFactory factory = diagnostic.getFactory(); - if (Errors.UNRESOLVED_REFERENCE_DIAGNOSTICS.contains(diagnostic.getFactory())) { - markedWithErrorElements.put((KtReferenceExpression) diagnostic.getPsiElement(), factory); - } - else if (factory == Errors.SUPER_IS_NOT_AN_EXPRESSION - || factory == Errors.SUPER_NOT_AVAILABLE) { - KtSuperExpression superExpression = (KtSuperExpression) diagnostic.getPsiElement(); - markedWithErrorElements.put(superExpression.getInstanceReference(), factory); - } - else if (factory == Errors.EXPRESSION_EXPECTED_PACKAGE_FOUND) { - markedWithErrorElements.put((KtSimpleNameExpression) diagnostic.getPsiElement(), factory); - } - else if (factory == Errors.UNSUPPORTED) { - for (KtReferenceExpression reference : PsiTreeUtil.findChildrenOfType(diagnostic.getPsiElement(), - KtReferenceExpression.class)) { - markedWithErrorElements.put(reference, factory); + val markedWithErrorElements: MutableMap?> = HashMap() + for (diagnostic in bindingContext.diagnostics) { + val factory = diagnostic.factory + if (Errors.UNRESOLVED_REFERENCE_DIAGNOSTICS.contains(diagnostic.factory)) { + markedWithErrorElements[diagnostic.psiElement as KtReferenceExpression] = factory + } else if (factory === Errors.SUPER_IS_NOT_AN_EXPRESSION + || factory === Errors.SUPER_NOT_AVAILABLE + ) { + val superExpression = diagnostic.psiElement as KtSuperExpression + markedWithErrorElements[superExpression.instanceReference] = factory + } else if (factory === Errors.EXPRESSION_EXPECTED_PACKAGE_FOUND) { + markedWithErrorElements[diagnostic.psiElement as KtSimpleNameExpression] = factory + } else if (factory === Errors.UNSUPPORTED) { + for (reference in PsiTreeUtil.findChildrenOfType( + diagnostic.psiElement, + KtReferenceExpression::class.java + )) { + markedWithErrorElements[reference] = factory } } } - - root.acceptChildren(new KtTreeVisitorVoid() { - - @Override - public void visitForExpression(@NotNull KtForExpression expression) { - KtExpression range = expression.getLoopRange(); - reportIfDynamicCall(range, range, LOOP_RANGE_ITERATOR_RESOLVED_CALL); - reportIfDynamicCall(range, range, LOOP_RANGE_HAS_NEXT_RESOLVED_CALL); - reportIfDynamicCall(range, range, LOOP_RANGE_NEXT_RESOLVED_CALL); - super.visitForExpression(expression); - } - - @Override - public void visitDestructuringDeclaration(@NotNull KtDestructuringDeclaration destructuringDeclaration) { - for (KtDestructuringDeclarationEntry entry : destructuringDeclaration.getEntries()) { - reportIfDynamicCall(entry, entry, COMPONENT_RESOLVED_CALL); + root.acceptChildren(object : KtTreeVisitorVoid() { + override fun visitForExpression(expression: KtForExpression) { + val range = expression.loopRange + if (range != null) { + reportIfDynamicCall(range, range, BindingContext.LOOP_RANGE_ITERATOR_RESOLVED_CALL) + reportIfDynamicCall(range, range, BindingContext.LOOP_RANGE_HAS_NEXT_RESOLVED_CALL) + reportIfDynamicCall(range, range, BindingContext.LOOP_RANGE_NEXT_RESOLVED_CALL) } - super.visitDestructuringDeclaration(destructuringDeclaration); + super.visitForExpression(expression) } - @Override - public void visitProperty(@NotNull KtProperty property) { - VariableDescriptor descriptor = bindingContext.get(VARIABLE, property); - if (descriptor instanceof PropertyDescriptor && property.getDelegate() != null) { - PropertyDescriptor propertyDescriptor = (PropertyDescriptor) descriptor; - reportIfDynamicCall(property.getDelegate(), propertyDescriptor, PROVIDE_DELEGATE_RESOLVED_CALL); - reportIfDynamicCall(property.getDelegate(), propertyDescriptor.getGetter(), DELEGATED_PROPERTY_RESOLVED_CALL); - reportIfDynamicCall(property.getDelegate(), propertyDescriptor.getSetter(), DELEGATED_PROPERTY_RESOLVED_CALL); + override fun visitDestructuringDeclaration(destructuringDeclaration: KtDestructuringDeclaration) { + for (entry in destructuringDeclaration.entries) { + reportIfDynamicCall(entry, entry, BindingContext.COMPONENT_RESOLVED_CALL) } - super.visitProperty(property); + super.visitDestructuringDeclaration(destructuringDeclaration) } - @Override - public void visitThisExpression(@NotNull KtThisExpression expression) { - ResolvedCall resolvedCall = CallUtilKt.getResolvedCall(expression, bindingContext); + override fun visitProperty(property: KtProperty) { + val descriptor = bindingContext.get(BindingContext.VARIABLE, property) + val delegate = property.delegate + if (descriptor is PropertyDescriptor && delegate != null) { + reportIfDynamicCall(delegate, descriptor, BindingContext.PROVIDE_DELEGATE_RESOLVED_CALL) + reportIfDynamicCall(delegate, descriptor.getter, BindingContext.DELEGATED_PROPERTY_RESOLVED_CALL) + reportIfDynamicCall(delegate, descriptor.setter, BindingContext.DELEGATED_PROPERTY_RESOLVED_CALL) + } + super.visitProperty(property) + } + + override fun visitThisExpression(expression: KtThisExpression) { + val resolvedCall = expression.getResolvedCall(bindingContext) if (resolvedCall != null) { - reportIfDynamic(expression, resolvedCall.getResultingDescriptor(), debugInfoReporter); + reportIfDynamic(expression, resolvedCall.resultingDescriptor, debugInfoReporter) } - super.visitThisExpression(expression); + super.visitThisExpression(expression) } - @Override - public void visitReferenceExpression(@NotNull KtReferenceExpression expression) { - super.visitReferenceExpression(expression); - if (!BindingContextUtils.isExpressionWithValidReference(expression, bindingContext)){ - return; + override fun visitReferenceExpression(expression: KtReferenceExpression) { + super.visitReferenceExpression(expression) + if (!BindingContextUtils.isExpressionWithValidReference(expression, bindingContext)) { + return } - IElementType referencedNameElementType = null; - if (expression instanceof KtSimpleNameExpression) { - KtSimpleNameExpression nameExpression = (KtSimpleNameExpression) expression; - IElementType elementType = expression.getNode().getElementType(); - if (elementType == KtNodeTypes.OPERATION_REFERENCE) { - referencedNameElementType = nameExpression.getReferencedNameElementType(); + var referencedNameElementType: IElementType? = null + if (expression is KtSimpleNameExpression) { + val elementType = expression.getNode().elementType + if (elementType === KtNodeTypes.OPERATION_REFERENCE) { + referencedNameElementType = expression.getReferencedNameElementType() if (EXCLUDED.contains(referencedNameElementType)) { - return; + return } } - if (elementType == KtNodeTypes.LABEL || - nameExpression.getReferencedNameElementType() == KtTokens.THIS_KEYWORD) { - return; + if (elementType === KtNodeTypes.LABEL || + expression.getReferencedNameElementType() === KtTokens.THIS_KEYWORD + ) { + return } } - - debugInfoReporter.preProcessReference(expression); - - String target = null; - DeclarationDescriptor declarationDescriptor = bindingContext.get(REFERENCE_TARGET, expression); + debugInfoReporter.preProcessReference(expression) + var target: String? = null + val declarationDescriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, expression) if (declarationDescriptor != null) { - target = declarationDescriptor.toString(); - - reportIfDynamic(expression, declarationDescriptor, debugInfoReporter); + target = declarationDescriptor.toString() + reportIfDynamic(expression, declarationDescriptor, debugInfoReporter) } if (target == null) { - PsiElement labelTarget = bindingContext.get(LABEL_TARGET, expression); + val labelTarget = bindingContext.get(BindingContext.LABEL_TARGET, expression) if (labelTarget != null) { - target = labelTarget.getText(); + target = labelTarget.text } } if (target == null) { - Collection declarationDescriptors = - bindingContext.get(AMBIGUOUS_REFERENCE_TARGET, expression); + val declarationDescriptors = bindingContext.get(BindingContext.AMBIGUOUS_REFERENCE_TARGET, expression) if (declarationDescriptors != null) { - target = "[" + declarationDescriptors.size() + " descriptors]"; + target = "[" + declarationDescriptors.size + " descriptors]" } } if (target == null) { - Collection labelTargets = bindingContext.get(AMBIGUOUS_LABEL_TARGET, expression); + val labelTargets = bindingContext.get(BindingContext.AMBIGUOUS_LABEL_TARGET, expression) if (labelTargets != null) { - target = "[" + labelTargets.size() + " elements]"; + target = "[" + labelTargets.size + " elements]" } } - if (MAY_BE_UNRESOLVED.contains(referencedNameElementType)) { - return; + return } - - boolean resolved = target != null; - boolean markedWithError = markedWithErrorElements.containsKey(expression); - if (expression instanceof KtArrayAccessExpression && - markedWithErrorElements.containsKey(((KtArrayAccessExpression) expression).getArrayExpression())) { + val resolved = target != null + var markedWithError = markedWithErrorElements.containsKey(expression) + if (expression is KtArrayAccessExpression && + markedWithErrorElements.containsKey(expression.arrayExpression) + ) { // if 'foo' in 'foo[i]' is unresolved it means 'foo[i]' is unresolved (otherwise 'foo[i]' is marked as 'missing unresolved') - markedWithError = true; + markedWithError = true } - KotlinType expressionType = bindingContext.getType(expression); - DiagnosticFactory factory = markedWithErrorElements.get(expression); + val expressionType = bindingContext.getType(expression) + val factory = markedWithErrorElements[expression] if (declarationDescriptor != null && - (ErrorUtils.isError(declarationDescriptor) || ErrorUtils.containsErrorType(expressionType))) { - if (factory != Errors.EXPRESSION_EXPECTED_PACKAGE_FOUND) { - debugInfoReporter.reportElementWithErrorType(expression); + (ErrorUtils.isError(declarationDescriptor) || ErrorUtils.containsErrorType(expressionType)) + ) { + if (factory !== Errors.EXPRESSION_EXPECTED_PACKAGE_FOUND) { + debugInfoReporter.reportElementWithErrorType(expression) } } if (resolved && markedWithError) { if (Errors.UNRESOLVED_REFERENCE_DIAGNOSTICS.contains(factory)) { - debugInfoReporter.reportUnresolvedWithTarget(expression, target); + debugInfoReporter.reportUnresolvedWithTarget(expression, target!!) } - } - else if (!resolved && !markedWithError) { - debugInfoReporter.reportMissingUnresolved(expression); + } else if (!resolved && !markedWithError) { + debugInfoReporter.reportMissingUnresolved(expression) } } - private boolean reportIfDynamicCall(E element, K key, WritableSlice> slice) { - ResolvedCall resolvedCall = bindingContext.get(slice, key); - if (resolvedCall != null) { - return reportIfDynamic(element, resolvedCall.getResultingDescriptor(), debugInfoReporter); - } - return false; + private fun reportIfDynamicCall( + element: E, + key: K, + slice: WritableSlice> + ): Boolean { + val resolvedCall = bindingContext[slice, key] + return if (resolvedCall != null) { + reportIfDynamic(element, resolvedCall.resultingDescriptor, debugInfoReporter) + } else false } - }); + }) } - private static boolean reportIfDynamic(KtElement element, DeclarationDescriptor declarationDescriptor, DebugInfoReporter debugInfoReporter) { - if (declarationDescriptor != null && DynamicCallsKt.isDynamic(declarationDescriptor)) { - debugInfoReporter.reportDynamicCall(element, declarationDescriptor); - return true; + private fun reportIfDynamic( + element: KtElement, + declarationDescriptor: DeclarationDescriptor?, + debugInfoReporter: DebugInfoReporter + ): Boolean { + if (declarationDescriptor != null && declarationDescriptor.isDynamic()) { + debugInfoReporter.reportDynamicCall(element, declarationDescriptor) + return true } - return false; + return false } -} + + abstract class DebugInfoReporter { + fun preProcessReference(expression: KtReferenceExpression) { + // do nothing + } + + abstract fun reportElementWithErrorType(expression: KtReferenceExpression) + abstract fun reportMissingUnresolved(expression: KtReferenceExpression) + abstract fun reportUnresolvedWithTarget(expression: KtReferenceExpression, target: String) + open fun reportDynamicCall(element: KtElement, declarationDescriptor: DeclarationDescriptor) {} + } +} \ No newline at end of file diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Diagnostic.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Diagnostic.kt index ff1dc5ee0a1..59de0365151 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Diagnostic.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Diagnostic.kt @@ -20,5 +20,5 @@ import com.intellij.psi.PsiFile interface Diagnostic : UnboundDiagnostic { val psiElement: PsiElement - val psiFile: PsiFile? + val psiFile: PsiFile } \ No newline at end of file diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/DiagnosticUtils.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/DiagnosticUtils.java index dabac77cfee..fcbb7dd2eb4 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/DiagnosticUtils.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/DiagnosticUtils.java @@ -74,9 +74,6 @@ public class DiagnosticUtils { List textRanges = diagnostic.getTextRanges(); if (textRanges.isEmpty()) return PsiDiagnosticUtils.LineAndColumn.NONE; TextRange firstRange = firstRange(textRanges); - if (file == null) { - return PsiDiagnosticUtils.LineAndColumn.NONE; - } return getLineAndColumnInPsiFile(file, firstRange); } @@ -92,9 +89,6 @@ public class DiagnosticUtils { List textRanges = diagnostic.getTextRanges(); if (textRanges.isEmpty()) return PsiDiagnosticUtils.LineAndColumnRange.NONE; TextRange firstRange = firstRange(textRanges); - if (file == null) { - return PsiDiagnosticUtils.LineAndColumnRange.NONE; - } return getLineAndColumnRangeInPsiFile(file, firstRange); } @@ -131,11 +125,9 @@ public class DiagnosticUtils { result.sort((d1, d2) -> { PsiFile file1 = d1.getPsiFile(); PsiFile file2 = d2.getPsiFile(); - if (file1 != null && file2 != null) { - String path1 = file1.getViewProvider().getVirtualFile().getPath(); - String path2 = file2.getViewProvider().getVirtualFile().getPath(); - if (!path1.equals(path2)) return path1.compareTo(path2); - } + String path1 = file1.getViewProvider().getVirtualFile().getPath(); + String path2 = file2.getViewProvider().getVirtualFile().getPath(); + if (!path1.equals(path2)) return path1.compareTo(path2); TextRange range1 = firstRange(d1.getTextRanges()); TextRange range2 = firstRange(d2.getTextRanges()); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index 67dcbee7f88..b67d915a45d 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -14,6 +14,7 @@ import org.jetbrains.kotlin.config.LanguageVersion; import org.jetbrains.kotlin.diagnostics.Diagnostic; import org.jetbrains.kotlin.diagnostics.DiagnosticFactory; import org.jetbrains.kotlin.diagnostics.Errors; +import org.jetbrains.kotlin.diagnostics.UnboundDiagnostic; import org.jetbrains.kotlin.metadata.deserialization.VersionRequirement; import org.jetbrains.kotlin.resolve.VarianceConflictDiagnosticData; import org.jetbrains.kotlin.types.KotlinTypeKt; @@ -46,7 +47,7 @@ public class DefaultErrorMessages { @NotNull @SuppressWarnings("unchecked") - public static String render(@NotNull Diagnostic diagnostic) { + public static String render(@NotNull UnboundDiagnostic diagnostic) { DiagnosticRenderer renderer = getRendererForDiagnostic(diagnostic); if (renderer != null) { return renderer.render(diagnostic); @@ -55,7 +56,7 @@ public class DefaultErrorMessages { } @Nullable - public static DiagnosticRenderer getRendererForDiagnostic(@NotNull Diagnostic diagnostic) { + public static DiagnosticRenderer getRendererForDiagnostic(@NotNull UnboundDiagnostic diagnostic) { DiagnosticRenderer renderer = AddToStdlibKt.firstNotNullResult(RENDERER_MAPS, map -> map.get(diagnostic.getFactory())); if (renderer != null) return renderer; diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/diagnosticsWithParameterRenderers.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/diagnosticsWithParameterRenderers.kt index bf000d0765a..df5f3da0de0 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/diagnosticsWithParameterRenderers.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/diagnosticsWithParameterRenderers.kt @@ -20,7 +20,7 @@ import org.jetbrains.kotlin.diagnostics.* import java.text.MessageFormat -abstract class AbstractDiagnosticWithParametersRenderer protected constructor(message: String) : DiagnosticRenderer { +abstract class AbstractDiagnosticWithParametersRenderer protected constructor(message: String) : DiagnosticRenderer { private val messageFormat = MessageFormat(message) override fun render(diagnostic: D): String { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnalyzingUtils.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnalyzingUtils.kt index 949d0894fc7..b5b2055772b 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnalyzingUtils.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnalyzingUtils.kt @@ -13,81 +13,77 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +package org.jetbrains.kotlin.resolve -package org.jetbrains.kotlin.resolve; +import com.intellij.psi.PsiElement +import com.intellij.psi.PsiErrorElement +import org.jetbrains.kotlin.diagnostics.DiagnosticSink +import org.jetbrains.kotlin.diagnostics.PsiDiagnosticUtils +import org.jetbrains.kotlin.psi.debugText.getDebugText +import org.jetbrains.kotlin.psi.KtElement +import org.jetbrains.kotlin.psi.KtTreeVisitorVoid +import org.jetbrains.kotlin.resolve.diagnostics.Diagnostics +import java.lang.IllegalArgumentException +import java.lang.StringBuilder +import java.util.ArrayList -import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiErrorElement; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.diagnostics.Diagnostic; -import org.jetbrains.kotlin.diagnostics.DiagnosticSink; -import org.jetbrains.kotlin.diagnostics.PsiDiagnosticUtils; -import org.jetbrains.kotlin.psi.KtElement; -import org.jetbrains.kotlin.psi.KtTreeVisitorVoid; -import org.jetbrains.kotlin.psi.debugText.DebugTextUtilKt; -import org.jetbrains.kotlin.resolve.diagnostics.Diagnostics; +object AnalyzingUtils { + private const val WRITE_DEBUG_TRACE_NAMES = false -import java.util.ArrayList; -import java.util.List; - -public class AnalyzingUtils { - private static final boolean WRITE_DEBUG_TRACE_NAMES = false; - - public abstract static class PsiErrorElementVisitor extends KtTreeVisitorVoid { - @Override - public abstract void visitErrorElement(@NotNull PsiErrorElement element); - } - - public static void checkForSyntacticErrors(@NotNull PsiElement root) { - root.acceptChildren(new PsiErrorElementVisitor() { - @Override - public void visitErrorElement(@NotNull PsiErrorElement element) { - throw new IllegalArgumentException(element.getErrorDescription() + "; looking at " + - element.getNode().getElementType() + " '" + - element.getText() + PsiDiagnosticUtils.atLocation(element)); + @JvmStatic + fun checkForSyntacticErrors(root: PsiElement) { + root.acceptChildren(object : PsiErrorElementVisitor() { + override fun visitErrorElement(element: PsiErrorElement) { + throw IllegalArgumentException( + element.errorDescription + "; looking at " + + element.node.elementType + " '" + + element.text + PsiDiagnosticUtils.atLocation(element) + ) } - }); + }) } - - public static List getSyntaxErrorRanges(@NotNull PsiElement root) { - List r = new ArrayList<>(); - root.acceptChildren(new PsiErrorElementVisitor() { - @Override - public void visitErrorElement(@NotNull PsiErrorElement element) { - r.add(element); + + @JvmStatic + fun getSyntaxErrorRanges(root: PsiElement): List { + val r: MutableList = ArrayList() + root.acceptChildren(object : PsiErrorElementVisitor() { + override fun visitErrorElement(element: PsiErrorElement) { + r.add(element) } - }); - return r; + }) + return r } - public static void throwExceptionOnErrors(BindingContext bindingContext) { - throwExceptionOnErrors(bindingContext.getDiagnostics()); + fun throwExceptionOnErrors(bindingContext: BindingContext) { + throwExceptionOnErrors(bindingContext.diagnostics) } - public static void throwExceptionOnErrors(Diagnostics diagnostics) { - for (Diagnostic diagnostic : diagnostics) { - DiagnosticSink.THROW_EXCEPTION.report(diagnostic); + fun throwExceptionOnErrors(diagnostics: Diagnostics) { + for (diagnostic in diagnostics) { + DiagnosticSink.THROW_EXCEPTION.report(diagnostic) } } // -------------------------------------------------------------------------------------------------------------------------- - public static String formDebugNameForBindingTrace(@NotNull String debugName, @Nullable Object resolutionSubjectForMessage) { + @JvmStatic + fun formDebugNameForBindingTrace(debugName: String, resolutionSubjectForMessage: Any?): String { if (WRITE_DEBUG_TRACE_NAMES) { - StringBuilder debugInfo = new StringBuilder(debugName); - if (resolutionSubjectForMessage instanceof KtElement) { - KtElement element = (KtElement) resolutionSubjectForMessage; - debugInfo.append(" ").append(DebugTextUtilKt.getDebugText(element)); + val debugInfo = StringBuilder(debugName) + if (resolutionSubjectForMessage is KtElement) { + debugInfo.append(" ").append(resolutionSubjectForMessage.getDebugText()) //debugInfo.append(" in ").append(element.getContainingFile().getName()); - debugInfo.append(" in ").append(element.getContainingKtFile().getName()).append(" ").append(element.getTextOffset()); + debugInfo.append(" in ").append(resolutionSubjectForMessage.containingKtFile.name).append(" ").append( + resolutionSubjectForMessage.textOffset + ) + } else if (resolutionSubjectForMessage != null) { + debugInfo.append(" ").append(resolutionSubjectForMessage) } - else if (resolutionSubjectForMessage != null) { - debugInfo.append(" ").append(resolutionSubjectForMessage); - } - - return debugInfo.toString(); + return debugInfo.toString() } - - return ""; + return "" } -} + + abstract class PsiErrorElementVisitor : KtTreeVisitorVoid() { + abstract override fun visitErrorElement(element: PsiErrorElement) + } +} \ No newline at end of file diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/Diagnostics.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/Diagnostics.kt index da83ac5b40c..80e4c0f0c03 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/Diagnostics.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/Diagnostics.kt @@ -17,25 +17,26 @@ package org.jetbrains.kotlin.resolve.diagnostics import com.intellij.psi.PsiElement -import org.jetbrains.kotlin.diagnostics.Diagnostic import com.intellij.openapi.util.ModificationTracker +import org.jetbrains.kotlin.diagnostics.Diagnostic +import org.jetbrains.kotlin.diagnostics.GenericDiagnostics -interface Diagnostics : Iterable { +interface Diagnostics : GenericDiagnostics { //should not be called on readonly views //any Diagnostics object returned by BindingContext#getDiagnostics() should implement this property val modificationTracker: ModificationTracker get() = throw IllegalStateException("Trying to obtain modification tracker for Diagnostics object of class ${this::class.java}") - fun all(): Collection + override fun all(): Collection + + override fun isEmpty(): Boolean = all().isEmpty() + + override fun iterator(): Iterator = all().iterator() fun forElement(psiElement: PsiElement): Collection - fun isEmpty(): Boolean = all().isEmpty() - fun noSuppression(): Diagnostics - override fun iterator() = all().iterator() - companion object { val EMPTY: Diagnostics = object : Diagnostics { override fun noSuppression(): Diagnostics = this diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/SimpleDiagnostics.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/SimpleDiagnostics.kt index 6c4af145141..47b3858c3c2 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/SimpleDiagnostics.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/SimpleDiagnostics.kt @@ -16,21 +16,20 @@ package org.jetbrains.kotlin.resolve.diagnostics -import com.intellij.openapi.util.Condition import com.intellij.psi.PsiElement import org.jetbrains.kotlin.diagnostics.Diagnostic import java.util.ArrayList -class SimpleDiagnostics(diagnostics: Collection) : Diagnostics { +class SimpleDiagnostics(diagnostics: Collection) : SimpleGenericDiagnostics(diagnostics), Diagnostics { //copy to prevent external change private val diagnostics = ArrayList(diagnostics) @Suppress("UNCHECKED_CAST") - private val elementsCache = DiagnosticsElementsCache(this, { true }) + private val elementsCache = DiagnosticsElementsCache(this) { true } override fun all() = diagnostics - override fun forElement(psiElement: PsiElement) = elementsCache.getDiagnostics(psiElement) + override fun forElement(psiElement: PsiElement): MutableCollection = elementsCache.getDiagnostics(psiElement) override fun noSuppression() = this } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/SimpleGenericDiagnostics.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/SimpleGenericDiagnostics.kt new file mode 100644 index 00000000000..006c6d0e6d4 --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/SimpleGenericDiagnostics.kt @@ -0,0 +1,17 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.resolve.diagnostics + +import org.jetbrains.kotlin.diagnostics.UnboundDiagnostic +import org.jetbrains.kotlin.diagnostics.GenericDiagnostics +import java.util.ArrayList + +open class SimpleGenericDiagnostics(diagnostics: Collection) : GenericDiagnostics { + //copy to prevent external change + private val diagnostics = ArrayList(diagnostics) + + override fun all() = diagnostics +} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirBaseDiagnosticsTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirBaseDiagnosticsTest.kt index ee7f6b0241d..4cec75407c6 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirBaseDiagnosticsTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirBaseDiagnosticsTest.kt @@ -20,6 +20,7 @@ import org.jetbrains.kotlin.checkers.diagnostics.TextDiagnostic import org.jetbrains.kotlin.checkers.utils.CheckerTestUtil import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment import org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM +import org.jetbrains.kotlin.diagnostics.Diagnostic import org.jetbrains.kotlin.diagnostics.PsiDiagnosticUtils import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnostic import org.jetbrains.kotlin.fir.builder.RawFirBuilder @@ -324,7 +325,7 @@ abstract class AbstractFirBaseDiagnosticsTest : BaseDiagnosticsTest() { private fun Iterable>.toActualDiagnostic(root: PsiElement): List { val result = mutableListOf() - mapTo(result) { + filterIsInstance().mapTo(result) { ActualDiagnostic(it, null, true) } for (errorElement in AnalyzingUtils.getSyntaxErrorRanges(root)) { diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/utils/validators/DiagnosticTestTypeValidator.kt b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/utils/validators/DiagnosticTestTypeValidator.kt index 405d6ea865b..f095bf9461a 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/utils/validators/DiagnosticTestTypeValidator.kt +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/utils/validators/DiagnosticTestTypeValidator.kt @@ -28,7 +28,7 @@ class DiagnosticTestTypeValidator( private fun findTestCases(diagnostic: Diagnostic): TestCasesByNumbers { val ranges = diagnostic.textRanges - val filename = diagnostic.psiFile!!.name + val filename = diagnostic.psiFile.name val foundTestCases = testInfo.cases.byRanges[filename]!!.floorEntry(ranges[0].startOffset) if (foundTestCases != null) diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/IdeErrorMessages.java b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/IdeErrorMessages.java index 62e2fb6dcff..2b4709a8044 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/IdeErrorMessages.java +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/IdeErrorMessages.java @@ -20,6 +20,7 @@ import com.intellij.icons.AllIcons; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.TestOnly; import org.jetbrains.kotlin.diagnostics.Diagnostic; +import org.jetbrains.kotlin.diagnostics.UnboundDiagnostic; import org.jetbrains.kotlin.diagnostics.rendering.*; import org.jetbrains.kotlin.idea.KotlinIdeaAnalysisBundle; import org.jetbrains.kotlin.js.resolve.diagnostics.ErrorsJs; @@ -42,7 +43,7 @@ public class IdeErrorMessages { private static final DiagnosticFactoryToRendererMap MAP = new DiagnosticFactoryToRendererMap("IDE"); @NotNull - public static String render(@NotNull Diagnostic diagnostic) { + public static String render(@NotNull UnboundDiagnostic diagnostic) { DiagnosticRenderer renderer = MAP.get(diagnostic.getFactory()); if (renderer != null) { @@ -54,7 +55,7 @@ public class IdeErrorMessages { } @TestOnly - public static boolean hasIdeSpecificMessage(@NotNull Diagnostic diagnostic) { + public static boolean hasIdeSpecificMessage(@NotNull UnboundDiagnostic diagnostic) { return MAP.get(diagnostic.getFactory()) != null; } diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/internal/KotlinBytecodeToolWindow.kt b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/internal/KotlinBytecodeToolWindow.kt index 8629747baa1..dcfd2cdc5a6 100644 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/internal/KotlinBytecodeToolWindow.kt +++ b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/internal/KotlinBytecodeToolWindow.kt @@ -261,7 +261,7 @@ class KotlinBytecodeToolWindow(private val myProject: Project, private val toolW answer.append("// ================\n") for (diagnostic in diagnostics) { answer.append("// Error at ") - .append(diagnostic.psiFile?.name) + .append(diagnostic.psiFile.name) .append(join(diagnostic.textRanges, ",")) .append(": ") .append(DefaultErrorMessages.render(diagnostic)) diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/AddFunctionToSupertypeFix.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/AddFunctionToSupertypeFix.kt index f4820cd9897..5d7b8c8e32a 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/AddFunctionToSupertypeFix.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/AddFunctionToSupertypeFix.kt @@ -128,7 +128,7 @@ class AddFunctionToSupertypeFix private constructor( val descriptors = generateFunctionsToAdd(function) if (descriptors.isEmpty()) return null - val project = diagnostic.psiFile!!.project + val project = diagnostic.psiFile.project val functionData = descriptors.mapNotNull { createFunctionData(it, project) } if (functionData.isEmpty()) return null diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/AddPropertyToSupertypeFix.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/AddPropertyToSupertypeFix.kt index a3458b50925..45aa2d1e5e6 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/AddPropertyToSupertypeFix.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/AddPropertyToSupertypeFix.kt @@ -102,7 +102,7 @@ class AddPropertyToSupertypeFix private constructor( val descriptors = generatePropertiesToAdd(property) if (descriptors.isEmpty()) return null - val project = diagnostic.psiFile!!.project + val project = diagnostic.psiFile.project val propertyData = descriptors.mapNotNull { createPropertyData(it, property.initializer, project) } if (propertyData.isEmpty()) return null diff --git a/plugins/scripting/scripting-compiler/src/org/jetbrains/kotlin/scripting/compiler/plugin/repl/messages/IdeDiagnosticMessageHolder.kt b/plugins/scripting/scripting-compiler/src/org/jetbrains/kotlin/scripting/compiler/plugin/repl/messages/IdeDiagnosticMessageHolder.kt index bd6d3e0a8f3..472c178879b 100644 --- a/plugins/scripting/scripting-compiler/src/org/jetbrains/kotlin/scripting/compiler/plugin/repl/messages/IdeDiagnosticMessageHolder.kt +++ b/plugins/scripting/scripting-compiler/src/org/jetbrains/kotlin/scripting/compiler/plugin/repl/messages/IdeDiagnosticMessageHolder.kt @@ -15,7 +15,7 @@ import javax.xml.parsers.DocumentBuilderFactory class IdeDiagnosticMessageHolder : DiagnosticMessageHolder { private val diagnostics = arrayListOf>() - override fun report(diagnostic: Diagnostic, file: PsiFile?, render: String) { + override fun report(diagnostic: Diagnostic, file: PsiFile, render: String) { diagnostics.add(Pair(diagnostic, render)) } From c6b703b5985e2ce9eb2bf2c763055d0a97012d39 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 19 Nov 2020 15:08:43 +0300 Subject: [PATCH 225/698] Simplify LighterASTNode.toFirLightSourceElement --- .../jetbrains/kotlin/fir/analysis/FirSourceChildren.kt | 2 +- .../kotlin/fir/analysis/checkers/FirModifierList.kt | 9 ++------- .../checkers/declaration/FirAnnotationArgumentChecker.kt | 2 +- .../FirExposedVisibilityDeclarationChecker.kt | 2 +- .../kotlin/fir/lightTree/converter/BaseConverter.kt | 2 +- .../jetbrains/kotlin/fir/lightTree/fir/ValueParameter.kt | 3 +-- .../src/org/jetbrains/kotlin/fir/FirSourceElement.kt | 5 +++-- 7 files changed, 10 insertions(+), 15 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/FirSourceChildren.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/FirSourceChildren.kt index b698d7cfff1..e12db21f4b4 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/FirSourceChildren.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/FirSourceChildren.kt @@ -37,5 +37,5 @@ private fun FirPsiSourceElement<*>.getChild(types: Set, index: Int private fun FirLightSourceElement.getChild(types: Set, index: Int, depth: Int): FirSourceElement? { val visitor = LighterTreeElementFinderByType(treeStructure, types, index, depth) - return visitor.find(lighterASTNode)?.let { it.toFirLightSourceElement(it.startOffset, it.endOffset, treeStructure) } + return visitor.find(lighterASTNode)?.toFirLightSourceElement(treeStructure) } \ No newline at end of file diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirModifierList.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirModifierList.kt index ec7b5f02374..b88e1d13139 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirModifierList.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirModifierList.kt @@ -76,11 +76,6 @@ val FirModifier<*>.lightNode: LighterASTNode? get() = (this as? FirLightModifier val FirModifier<*>.source: FirSourceElement? get() = when (this) { - is FirPsiModifier -> this.psi?.toFirPsiSourceElement() - is FirLightModifier -> { - // TODO pretty sure I got offsets wrong here - val startOffset = tree.getStartOffset(node) - val endOffset = tree.getEndOffset(node) - node.toFirLightSourceElement(startOffset, endOffset, tree) - } + is FirPsiModifier -> psi?.toFirPsiSourceElement() + is FirLightModifier -> node.toFirLightSourceElement(tree) } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationArgumentChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationArgumentChecker.kt index 6ec8f2a054c..f30abc5408c 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationArgumentChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationArgumentChecker.kt @@ -243,7 +243,7 @@ object FirAnnotationArgumentChecker : FirBasicDeclarationChecker() { is FirLightSourceElement -> { val elementOfParent = source.treeStructure.getParent(source.lighterASTNode) ?: source.lighterASTNode - elementOfParent.toFirLightSourceElement(elementOfParent.startOffset, elementOfParent.endOffset, source.treeStructure) + elementOfParent.toFirLightSourceElement(source.treeStructure) } else -> source diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirExposedVisibilityDeclarationChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirExposedVisibilityDeclarationChecker.kt index ea7ad8510fa..4b7bebfdca6 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirExposedVisibilityDeclarationChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirExposedVisibilityDeclarationChecker.kt @@ -236,7 +236,7 @@ object FirExposedVisibilityDeclarationChecker : FirMemberDeclarationChecker() { val kidsRef = Ref>() this.treeStructure.getChildren(lighterASTNode, kidsRef) val identifier = kidsRef.get().find { it?.tokenType == KtTokens.IDENTIFIER } - identifier?.toFirLightSourceElement(this.treeStructure.getStartOffset(identifier), this.treeStructure.getEndOffset(identifier), this.treeStructure) + identifier?.toFirLightSourceElement(this.treeStructure) } } diff --git a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/BaseConverter.kt b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/BaseConverter.kt index f4d4edf9b3d..d383fb15399 100644 --- a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/BaseConverter.kt +++ b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/BaseConverter.kt @@ -32,7 +32,7 @@ open class BaseConverter( override fun LighterASTNode.toFirSourceElement(kind: FirFakeSourceElementKind?): FirLightSourceElement { val startOffset = offset + tree.getStartOffset(this) val endOffset = offset + tree.getEndOffset(this) - return toFirLightSourceElement(startOffset, endOffset, tree, kind ?: FirRealSourceElementKind) + return toFirLightSourceElement(tree, kind ?: FirRealSourceElementKind, startOffset, endOffset) } override val LighterASTNode.elementType: IElementType diff --git a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/ValueParameter.kt b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/ValueParameter.kt index 9573f985fba..bfbca1c97d9 100644 --- a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/ValueParameter.kt +++ b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/ValueParameter.kt @@ -46,8 +46,7 @@ class ValueParameter( val parameterSource = firValueParameter.source as? FirLightSourceElement val parameterNode = parameterSource?.lighterASTNode source = parameterNode?.toFirLightSourceElement( - parameterSource.startOffset, parameterSource.endOffset, parameterSource.treeStructure, - FirFakeSourceElementKind.PropertyFromParameter + parameterSource.treeStructure, FirFakeSourceElementKind.PropertyFromParameter ) this.session = session origin = FirDeclarationOrigin.Source diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt index fde7bee3463..d0907c15124 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt @@ -288,7 +288,8 @@ inline fun PsiElement.toFirPsiSourceElement(kind: FirSourceElementKind = FirReal @Suppress("NOTHING_TO_INLINE") inline fun LighterASTNode.toFirLightSourceElement( - startOffset: Int, endOffset: Int, tree: FlyweightCapableTreeStructure, - kind: FirSourceElementKind = FirRealSourceElementKind + kind: FirSourceElementKind = FirRealSourceElementKind, + startOffset: Int = this.startOffset, + endOffset: Int = this.endOffset ): FirLightSourceElement = FirLightSourceElement(this, startOffset, endOffset, tree, kind) From 0838ab7fe721e27c7b530e8d03758b4105d8868b Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 19 Nov 2020 15:29:29 +0300 Subject: [PATCH 226/698] FIR checkers: simplify hasVal / hasVar source element checks --- .../FirAnnotationClassDeclarationChecker.kt | 34 ++++--------------- .../LightTreePositioningStrategies.kt | 20 ++++++++--- 2 files changed, 21 insertions(+), 33 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationClassDeclarationChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationClassDeclarationChecker.kt index 124933ff5ed..e4c02cbe2ce 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationClassDeclarationChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationClassDeclarationChecker.kt @@ -5,18 +5,11 @@ package org.jetbrains.kotlin.fir.analysis.checkers.declaration -import com.intellij.lang.LighterASTNode -import com.intellij.openapi.util.Ref import com.intellij.psi.PsiElement import org.jetbrains.kotlin.descriptors.ClassKind.ANNOTATION_CLASS import org.jetbrains.kotlin.descriptors.ClassKind.ENUM_CLASS import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext -import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter -import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticFactory0 -import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.declarations.* -import org.jetbrains.kotlin.fir.FirLightSourceElement -import org.jetbrains.kotlin.fir.FirPsiSourceElement import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.FirSourceElement import org.jetbrains.kotlin.fir.resolve.toSymbol @@ -27,10 +20,8 @@ import org.jetbrains.kotlin.fir.symbols.StandardClassIds.unsignedTypes import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.KtNodeTypes.FUN import org.jetbrains.kotlin.KtNodeTypes.VALUE_PARAMETER -import org.jetbrains.kotlin.lexer.KtTokens.VAL_KEYWORD -import org.jetbrains.kotlin.lexer.KtTokens.VAR_KEYWORD +import org.jetbrains.kotlin.fir.analysis.diagnostics.* import org.jetbrains.kotlin.name.ClassId -import org.jetbrains.kotlin.psi.KtParameter object FirAnnotationClassDeclarationChecker : FirBasicDeclarationChecker() { override fun check(declaration: FirDeclaration, context: CheckerContext, reporter: DiagnosticReporter) { @@ -42,24 +33,11 @@ object FirAnnotationClassDeclarationChecker : FirBasicDeclarationChecker() { when { it is FirConstructor && it.isPrimary -> { for (parameter in it.valueParameters) { - when (val parameterSourceElement = parameter.source) { - is FirPsiSourceElement<*> -> { - val parameterPsiElement = parameterSourceElement.psi as KtParameter - - if (!parameterPsiElement.hasValOrVar()) - reporter.report(parameterSourceElement, FirErrors.MISSING_VAL_ON_ANNOTATION_PARAMETER) - else if (parameterPsiElement.isMutable) - reporter.report(parameterSourceElement, FirErrors.VAR_ANNOTATION_PARAMETER) - } - is FirLightSourceElement -> { - val kidsRef = Ref>() - parameterSourceElement.treeStructure.getChildren(parameterSourceElement.lighterASTNode, kidsRef) - - if (kidsRef.get().any { it?.tokenType == VAR_KEYWORD }) - reporter.report(parameterSourceElement, FirErrors.VAR_ANNOTATION_PARAMETER) - else if (kidsRef.get().all { it?.tokenType != VAL_KEYWORD }) - reporter.report(parameterSourceElement, FirErrors.MISSING_VAL_ON_ANNOTATION_PARAMETER) - } + val source = parameter.source ?: continue + if (!source.hasValOrVar()) { + reporter.report(source, FirErrors.MISSING_VAL_ON_ANNOTATION_PARAMETER) + } else if (source.hasVar()) { + reporter.report(source, FirErrors.VAR_ANNOTATION_PARAMETER) } val typeRef = parameter.returnTypeRef diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt index 6e15910de74..48083e57f21 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt @@ -12,6 +12,7 @@ import com.intellij.psi.tree.IElementType import com.intellij.psi.tree.TokenSet import com.intellij.util.diff.FlyweightCapableTreeStructure import org.jetbrains.kotlin.KtNodeTypes +import org.jetbrains.kotlin.fir.FirSourceElement import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.KtParameter.VAL_VAR_TOKEN_SET @@ -37,7 +38,7 @@ object LightTreePositioningStrategies { val VAL_OR_VAR_NODE: LightTreePositioningStrategy = object : LightTreePositioningStrategy() { override fun mark(node: LighterASTNode, tree: FlyweightCapableTreeStructure): List { - val target = tree.findChildByType(node, VAL_VAR_TOKEN_SET) ?: node + val target = tree.valOrVarKeyword(node) ?: node return markElement(target, tree) } } @@ -143,6 +144,12 @@ object LightTreePositioningStrategies { } } +fun FirSourceElement.hasValOrVar(): Boolean = + treeStructure.valOrVarKeyword(lighterASTNode) != null + +fun FirSourceElement.hasVar(): Boolean = + treeStructure.findChildByType(lighterASTNode, KtTokens.VAR_KEYWORD) != null + private fun FlyweightCapableTreeStructure.constructorKeyword(node: LighterASTNode): LighterASTNode? = findChildByType(node, KtTokens.CONSTRUCTOR_KEYWORD) @@ -158,6 +165,9 @@ private fun FlyweightCapableTreeStructure.rightParenthesis(node: private fun FlyweightCapableTreeStructure.objectKeyword(node: LighterASTNode): LighterASTNode? = findChildByType(node, KtTokens.OBJECT_KEYWORD) +private fun FlyweightCapableTreeStructure.valOrVarKeyword(node: LighterASTNode): LighterASTNode? = + findChildByType(node, VAL_VAR_TOKEN_SET) + private fun FlyweightCapableTreeStructure.accessorNamePlaceholder(node: LighterASTNode): LighterASTNode = findChildByType(node, KtTokens.GET_KEYWORD) ?: findChildByType(node, KtTokens.SET_KEYWORD)!! @@ -186,15 +196,15 @@ private fun FlyweightCapableTreeStructure.receiverTypeReference( } private fun FlyweightCapableTreeStructure.findChildByType(node: LighterASTNode, type: IElementType): LighterASTNode? { - val childrenRef = Ref>() + val childrenRef = Ref>() getChildren(node, childrenRef) - return childrenRef.get()?.firstOrNull { it.tokenType == type } + return childrenRef.get()?.firstOrNull { it?.tokenType == type } } private fun FlyweightCapableTreeStructure.findChildByType(node: LighterASTNode, type: TokenSet): LighterASTNode? { - val childrenRef = Ref>() + val childrenRef = Ref>() getChildren(node, childrenRef) - return childrenRef.get()?.firstOrNull { it.tokenType in type } + return childrenRef.get()?.firstOrNull { it?.tokenType in type } } private fun FlyweightCapableTreeStructure.findParentOfType(node: LighterASTNode, type: IElementType): LighterASTNode? { From 1e3621a896b37526ab62f0558e98a74b97bfb27c Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 19 Nov 2020 15:38:47 +0300 Subject: [PATCH 227/698] FIR checkers: simplify hasPrimaryConstructor by source element check --- .../resolve/typeAliasWithTypeArguments.kt | 2 +- .../FirConstructorInInterfaceChecker.kt | 38 +------------------ .../LightTreePositioningStrategies.kt | 3 ++ .../tests/SupertypeListChecks.fir.kt | 2 +- .../tests/TraitWithConstructor.fir.kt | 10 ++--- .../traitSupertypeList.fir.kt | 2 +- 6 files changed, 12 insertions(+), 45 deletions(-) diff --git a/compiler/fir/analysis-tests/testData/resolve/typeAliasWithTypeArguments.kt b/compiler/fir/analysis-tests/testData/resolve/typeAliasWithTypeArguments.kt index 6ab505ccc78..baaee1fb118 100644 --- a/compiler/fir/analysis-tests/testData/resolve/typeAliasWithTypeArguments.kt +++ b/compiler/fir/analysis-tests/testData/resolve/typeAliasWithTypeArguments.kt @@ -10,7 +10,7 @@ interface C { fun baz() } -interface Inv() { +interface Inv() { fun k(): K fun t(): T } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirConstructorInInterfaceChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirConstructorInInterfaceChecker.kt index 36caea305fe..87a397feedf 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirConstructorInInterfaceChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirConstructorInInterfaceChecker.kt @@ -5,22 +5,14 @@ package org.jetbrains.kotlin.fir.analysis.checkers.declaration -import com.intellij.lang.LighterASTNode -import com.intellij.openapi.util.Ref -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiErrorElement -import com.intellij.util.diff.FlyweightCapableTreeStructure -import org.jetbrains.kotlin.KtNodeTypes.PRIMARY_CONSTRUCTOR import org.jetbrains.kotlin.descriptors.ClassKind -import org.jetbrains.kotlin.fir.FirLightSourceElement import org.jetbrains.kotlin.fir.FirSourceElement import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors +import org.jetbrains.kotlin.fir.analysis.diagnostics.hasPrimaryConstructor import org.jetbrains.kotlin.fir.declarations.FirClass import org.jetbrains.kotlin.fir.declarations.FirDeclaration -import org.jetbrains.kotlin.fir.psi -import org.jetbrains.kotlin.psi.KtPrimaryConstructor object FirConstructorInInterfaceChecker : FirBasicDeclarationChecker() { override fun check(declaration: FirDeclaration, context: CheckerContext, reporter: DiagnosticReporter) { @@ -33,34 +25,6 @@ object FirConstructorInInterfaceChecker : FirBasicDeclarationChecker() { } } - private fun FirSourceElement.hasPrimaryConstructor(): Boolean { - val localPsi = psi - val localLightNode = lighterASTNode - - if (localPsi != null && localPsi !is PsiErrorElement) { - return localPsi.hasPrimaryConstructor() - } else if (this is FirLightSourceElement) { - return localLightNode.hasPrimaryConstructor(treeStructure) - } - - return false - } - - private fun PsiElement.hasPrimaryConstructor(): Boolean { - return lastChild !is PsiErrorElement && lastChild is KtPrimaryConstructor - } - - private fun LighterASTNode.hasPrimaryConstructor(tree: FlyweightCapableTreeStructure): Boolean { - val children = getChildren(tree) - return children.lastOrNull()?.tokenType == PRIMARY_CONSTRUCTOR - } - - private fun LighterASTNode.getChildren(tree: FlyweightCapableTreeStructure): List { - val children = Ref>() - val count = tree.getChildren(this, children) - return if (count > 0) children.get().filterNotNull() else emptyList() - } - private fun DiagnosticReporter.report(source: FirSourceElement?) { source?.let { report(FirErrors.CONSTRUCTOR_IN_INTERFACE.on(it)) } } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt index 48083e57f21..4644b7cebd0 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt @@ -150,6 +150,9 @@ fun FirSourceElement.hasValOrVar(): Boolean = fun FirSourceElement.hasVar(): Boolean = treeStructure.findChildByType(lighterASTNode, KtTokens.VAR_KEYWORD) != null +fun FirSourceElement.hasPrimaryConstructor(): Boolean = + treeStructure.primaryConstructor(lighterASTNode) != null + private fun FlyweightCapableTreeStructure.constructorKeyword(node: LighterASTNode): LighterASTNode? = findChildByType(node, KtTokens.CONSTRUCTOR_KEYWORD) diff --git a/compiler/testData/diagnostics/tests/SupertypeListChecks.fir.kt b/compiler/testData/diagnostics/tests/SupertypeListChecks.fir.kt index ff937931bf4..637e06a5411 100644 --- a/compiler/testData/diagnostics/tests/SupertypeListChecks.fir.kt +++ b/compiler/testData/diagnostics/tests/SupertypeListChecks.fir.kt @@ -21,7 +21,7 @@ interface T1 {} interface T2 {} -interface Test() { +interface Test() { } interface Test1 : C2() {} diff --git a/compiler/testData/diagnostics/tests/TraitWithConstructor.fir.kt b/compiler/testData/diagnostics/tests/TraitWithConstructor.fir.kt index 6d9d6109a25..fc2b752110b 100644 --- a/compiler/testData/diagnostics/tests/TraitWithConstructor.fir.kt +++ b/compiler/testData/diagnostics/tests/TraitWithConstructor.fir.kt @@ -2,11 +2,11 @@ class C(val a: String) {} -interface T1(val x: String) {} +interface T1(val x: String) {} -interface T2 constructor() {} +interface T2 constructor() {} -interface T3 private constructor(a: Int) {} +interface T3 private constructor(a: Int) {} interface T4 { constructor(a: Int) { @@ -14,5 +14,5 @@ interface T4 { } } -interface T5 private () : T4 {} -interface T6 private : T5 {} \ No newline at end of file +interface T5 private () : T4 {} +interface T6 private : T5 {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/traitWithRequired/traitSupertypeList.fir.kt b/compiler/testData/diagnostics/tests/traitWithRequired/traitSupertypeList.fir.kt index 2b3afe2bd13..d1a66fcaece 100644 --- a/compiler/testData/diagnostics/tests/traitWithRequired/traitSupertypeList.fir.kt +++ b/compiler/testData/diagnostics/tests/traitWithRequired/traitSupertypeList.fir.kt @@ -1,6 +1,6 @@ open class bar() -interface Foo() : bar(), bar, bar { +interface Foo() : bar(), bar, bar { } interface Foo2 : bar, Foo { From f095a33970a866a933dd65ab48d186e0791e746f Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 19 Nov 2020 15:59:25 +0300 Subject: [PATCH 228/698] FIR checkers: extract getChildren(), simplify findSuperTypeDelegation() --- .../fir/analysis/checkers/FirModifierList.kt | 10 ++--- .../fir/analysis/checkers/SourceHelpers.kt | 17 ++++++++ .../FirDelegationInInterfaceChecker.kt | 40 +++---------------- .../FirExposedVisibilityDeclarationChecker.kt | 9 ++--- ...rSupertypeInitializedInInterfaceChecker.kt | 12 ++---- ...ypeInitializedWithoutPrimaryConstructor.kt | 12 ++---- ...ypeArgumentsNotAllowedExpressionChecker.kt | 7 +--- ...BeReplacedWithOperatorAssignmentChecker.kt | 6 +-- .../checkers/extended/CanBeValChecker.kt | 8 ++-- ...ntSingleExpressionStringTemplateChecker.kt | 9 ++--- 10 files changed, 44 insertions(+), 86 deletions(-) create mode 100644 compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/SourceHelpers.kt diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirModifierList.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirModifierList.kt index b88e1d13139..750b2aaa930 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirModifierList.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirModifierList.kt @@ -7,7 +7,6 @@ package org.jetbrains.kotlin.fir.analysis.checkers import com.intellij.lang.ASTNode import com.intellij.lang.LighterASTNode -import com.intellij.openapi.util.Ref import com.intellij.psi.PsiElement import com.intellij.psi.tree.TokenSet import com.intellij.util.diff.FlyweightCapableTreeStructure @@ -27,9 +26,8 @@ fun FirSourceElement?.getModifierList(): FirModifierList? { null -> null is FirPsiSourceElement<*> -> (psi as? KtModifierListOwner)?.modifierList?.let { FirPsiModifierList(it) } is FirLightSourceElement -> { - val kidsRef = Ref>() - treeStructure.getChildren(lighterASTNode, kidsRef) - val modifierListNode = kidsRef.get().find { it?.tokenType == KtNodeTypes.MODIFIER_LIST } ?: return null + val modifierListNode = lighterASTNode.getChildren(treeStructure).find { it?.tokenType == KtNodeTypes.MODIFIER_LIST } + ?: return null FirLightModifierList(modifierListNode, treeStructure) } } @@ -48,9 +46,7 @@ class FirPsiModifierList(val modifierList: KtModifierList) : FirModifierList() { class FirLightModifierList(val modifierList: LighterASTNode, val tree: FlyweightCapableTreeStructure) : FirModifierList() { override val modifiers: List get() { - val kidsRef = Ref>() - tree.getChildren(modifierList, kidsRef) - val modifierNodes = kidsRef.get() + val modifierNodes = modifierList.getChildren(tree) return modifierNodes.filterNotNull() .filter { it.tokenType is KtModifierKeywordToken } .map { FirLightModifier(it, it.tokenType as KtModifierKeywordToken, tree) } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/SourceHelpers.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/SourceHelpers.kt new file mode 100644 index 00000000000..eeddac06ddc --- /dev/null +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/SourceHelpers.kt @@ -0,0 +1,17 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.fir.analysis.checkers + +import com.intellij.lang.LighterASTNode +import com.intellij.openapi.util.Ref +import com.intellij.util.diff.FlyweightCapableTreeStructure + +internal fun LighterASTNode.getChildren(tree: FlyweightCapableTreeStructure): List { + val children = Ref>() + val count = tree.getChildren(this, children) + return if (count > 0) children.get().filterNotNull() else emptyList() +} + diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDelegationInInterfaceChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDelegationInInterfaceChecker.kt index 476966fbe53..a6a9fd3fbfd 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDelegationInInterfaceChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDelegationInInterfaceChecker.kt @@ -6,21 +6,16 @@ package org.jetbrains.kotlin.fir.analysis.checkers.declaration import com.intellij.lang.LighterASTNode -import com.intellij.openapi.util.Ref -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiErrorElement import com.intellij.util.diff.FlyweightCapableTreeStructure import org.jetbrains.kotlin.KtNodeTypes import org.jetbrains.kotlin.descriptors.ClassKind -import org.jetbrains.kotlin.fir.FirLightSourceElement import org.jetbrains.kotlin.fir.FirSourceElement import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext +import org.jetbrains.kotlin.fir.analysis.checkers.getChildren import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.declarations.FirClass import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration -import org.jetbrains.kotlin.fir.psi -import org.jetbrains.kotlin.psi.KtDelegatedSuperTypeEntry object FirDelegationInInterfaceChecker : FirMemberDeclarationChecker() { override fun check(declaration: FirMemberDeclaration, context: CheckerContext, reporter: DiagnosticReporter) { @@ -33,46 +28,21 @@ object FirDelegationInInterfaceChecker : FirMemberDeclarationChecker() { } } - private fun FirSourceElement.findSuperTypeDelegation(): Int { - val localPsi = psi - val localLightNode = lighterASTNode - - if (localPsi != null && localPsi !is PsiErrorElement) { - return localPsi.findSuperTypeDelegation() - } else if (this is FirLightSourceElement) { - return localLightNode.findSuperTypeDelegation(treeStructure) - } - - return -1 - } - - private fun PsiElement.findSuperTypeDelegation(): Int { - val children = this.children // this is a method call and it collects children - return if (children.isNotEmpty() && children[0] !is PsiErrorElement) { - children[0].children.indexOfFirst { it is KtDelegatedSuperTypeEntry } - } else { - -1 - } - } + private fun FirSourceElement.findSuperTypeDelegation(): Int = + lighterASTNode.findSuperTypeDelegation(treeStructure) private fun LighterASTNode.findSuperTypeDelegation(tree: FlyweightCapableTreeStructure): Int { val children = getChildren(tree) return if (children.isNotEmpty()) { - children.find { it.tokenType == KtNodeTypes.SUPER_TYPE_LIST } + children.find { it?.tokenType == KtNodeTypes.SUPER_TYPE_LIST } ?.getChildren(tree) - ?.indexOfFirst { it.tokenType == KtNodeTypes.DELEGATED_SUPER_TYPE_ENTRY } + ?.indexOfFirst { it?.tokenType == KtNodeTypes.DELEGATED_SUPER_TYPE_ENTRY } ?: -1 } else { -1 } } - private fun LighterASTNode.getChildren(tree: FlyweightCapableTreeStructure): List { - val children = Ref>() - val count = tree.getChildren(this, children) - return if (count > 0) children.get().filterNotNull() else emptyList() - } - private fun DiagnosticReporter.report(source: FirSourceElement?) { source?.let { report(FirErrors.DELEGATION_IN_INTERFACE.on(it)) } } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirExposedVisibilityDeclarationChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirExposedVisibilityDeclarationChecker.kt index 4b7bebfdca6..06e138f8c3f 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirExposedVisibilityDeclarationChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirExposedVisibilityDeclarationChecker.kt @@ -5,13 +5,12 @@ package org.jetbrains.kotlin.fir.analysis.checkers.declaration -import com.intellij.lang.LighterASTNode -import com.intellij.openapi.util.Ref import com.intellij.psi.PsiElement import com.intellij.psi.PsiNameIdentifierOwner import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.fir.* import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext +import org.jetbrains.kotlin.fir.analysis.checkers.getChildren import org.jetbrains.kotlin.fir.analysis.checkers.toRegularClass import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticFactory3 @@ -233,10 +232,8 @@ object FirExposedVisibilityDeclarationChecker : FirMemberDeclarationChecker() { private fun FirSourceElement.getIdentifierSource() = when (this) { is FirPsiSourceElement<*> -> (this.psi as? PsiNameIdentifierOwner)?.nameIdentifier?.toFirPsiSourceElement() is FirLightSourceElement -> { - val kidsRef = Ref>() - this.treeStructure.getChildren(lighterASTNode, kidsRef) - val identifier = kidsRef.get().find { it?.tokenType == KtTokens.IDENTIFIER } - identifier?.toFirLightSourceElement(this.treeStructure) + val identifier = lighterASTNode.getChildren(treeStructure).find { it?.tokenType == KtTokens.IDENTIFIER } + identifier?.toFirLightSourceElement(treeStructure) } } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedInInterfaceChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedInInterfaceChecker.kt index 6a1a4deb5d6..276bc3f1a36 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedInInterfaceChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedInInterfaceChecker.kt @@ -6,7 +6,6 @@ package org.jetbrains.kotlin.fir.analysis.checkers.declaration import com.intellij.lang.LighterASTNode -import com.intellij.openapi.util.Ref import com.intellij.psi.PsiElement import com.intellij.psi.PsiErrorElement import com.intellij.util.diff.FlyweightCapableTreeStructure @@ -15,6 +14,7 @@ import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.fir.FirLightSourceElement import org.jetbrains.kotlin.fir.FirSourceElement import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext +import org.jetbrains.kotlin.fir.analysis.checkers.getChildren import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.declarations.FirClass @@ -58,21 +58,15 @@ object FirSupertypeInitializedInInterfaceChecker : FirMemberDeclarationChecker() private fun LighterASTNode.findSuperTypeCall(tree: FlyweightCapableTreeStructure): Int { val children = getChildren(tree) return if (children.isNotEmpty()) { - children.find { it.tokenType == KtNodeTypes.SUPER_TYPE_LIST } + children.find { it?.tokenType == KtNodeTypes.SUPER_TYPE_LIST } ?.getChildren(tree) - ?.indexOfFirst { it.tokenType == KtNodeTypes.SUPER_TYPE_CALL_ENTRY } + ?.indexOfFirst { it?.tokenType == KtNodeTypes.SUPER_TYPE_CALL_ENTRY } ?: -1 } else { -1 } } - private fun LighterASTNode.getChildren(tree: FlyweightCapableTreeStructure): List { - val children = Ref>() - val count = tree.getChildren(this, children) - return if (count > 0) children.get().filterNotNull() else emptyList() - } - private fun DiagnosticReporter.report(source: FirSourceElement?) { source?.let { report(FirErrors.SUPERTYPE_INITIALIZED_IN_INTERFACE.on(it)) } } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedWithoutPrimaryConstructor.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedWithoutPrimaryConstructor.kt index b3f44874443..a5c84a5b127 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedWithoutPrimaryConstructor.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedWithoutPrimaryConstructor.kt @@ -6,7 +6,6 @@ package org.jetbrains.kotlin.fir.analysis.checkers.declaration import com.intellij.lang.LighterASTNode -import com.intellij.openapi.util.Ref import com.intellij.psi.PsiElement import com.intellij.psi.PsiErrorElement import com.intellij.util.diff.FlyweightCapableTreeStructure @@ -15,6 +14,7 @@ import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.fir.FirLightSourceElement import org.jetbrains.kotlin.fir.FirSourceElement import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext +import org.jetbrains.kotlin.fir.analysis.checkers.getChildren import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.declarations.FirConstructor @@ -56,16 +56,10 @@ object FirSupertypeInitializedWithoutPrimaryConstructor : FirMemberDeclarationCh } private fun LighterASTNode.anySupertypeHasConstructorParentheses(tree: FlyweightCapableTreeStructure): Boolean { - val superTypes = getChildren(tree).find { it.tokenType == KtNodeTypes.SUPER_TYPE_LIST } + val superTypes = getChildren(tree).find { it?.tokenType == KtNodeTypes.SUPER_TYPE_LIST } ?: return false - return superTypes.getChildren(tree).any { it.tokenType == KtNodeTypes.SUPER_TYPE_CALL_ENTRY } - } - - private fun LighterASTNode.getChildren(tree: FlyweightCapableTreeStructure): List { - val children = Ref>() - val count = tree.getChildren(this, children) - return if (count > 0) children.get().filterNotNull() else emptyList() + return superTypes.getChildren(tree).any { it?.tokenType == KtNodeTypes.SUPER_TYPE_CALL_ENTRY } } private fun DiagnosticReporter.report(source: FirSourceElement?) { diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirTypeArgumentsNotAllowedExpressionChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirTypeArgumentsNotAllowedExpressionChecker.kt index 0e3f306a8ba..7362bb279bd 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirTypeArgumentsNotAllowedExpressionChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirTypeArgumentsNotAllowedExpressionChecker.kt @@ -14,6 +14,7 @@ import org.jetbrains.kotlin.KtNodeTypes.TYPE_ARGUMENT_LIST import org.jetbrains.kotlin.fir.FirLightSourceElement import org.jetbrains.kotlin.fir.FirSourceElement import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext +import org.jetbrains.kotlin.fir.analysis.checkers.getChildren import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression @@ -58,12 +59,6 @@ object FirTypeArgumentsNotAllowedExpressionChecker : FirQualifiedAccessChecker() return children.count { it != null } > 1 && children[1]?.tokenType == TYPE_ARGUMENT_LIST } - private fun LighterASTNode.getChildren(tree: FlyweightCapableTreeStructure): Array { - val childrenRef = Ref>() - val childCount = tree.getChildren(this, childrenRef) - return if (childCount > 0) childrenRef.get() else emptyArray() - } - private fun DiagnosticReporter.report(source: FirSourceElement?) { source?.let { report(FirErrors.TYPE_ARGUMENTS_NOT_ALLOWED.on(it)) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeReplacedWithOperatorAssignmentChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeReplacedWithOperatorAssignmentChecker.kt index 0486053f2f3..23ae31cc624 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeReplacedWithOperatorAssignmentChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeReplacedWithOperatorAssignmentChecker.kt @@ -6,12 +6,12 @@ package org.jetbrains.kotlin.fir.analysis.checkers.extended import com.intellij.lang.LighterASTNode -import com.intellij.openapi.util.Ref import com.intellij.psi.tree.IElementType import org.jetbrains.kotlin.KtNodeTypes import org.jetbrains.kotlin.fir.* import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.expression.FirExpressionChecker +import org.jetbrains.kotlin.fir.analysis.checkers.getChildren import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.analysis.getChild @@ -72,9 +72,7 @@ object CanBeReplacedWithOperatorAssignmentChecker : FirExpressionChecker>() - tree.getChildren(expression, childrenNullable) - val children = childrenNullable.get().filterNotNull() + val children = expression.getChildren(tree).filterNotNull() val operator = children.firstOrNull { it.tokenType == KtNodeTypes.OPERATION_REFERENCE } if (prevOperator != null && !isLightNodesHierarchicallyTrue(prevOperator, operator)) return false diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeValChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeValChecker.kt index 1ed0369812b..0525e53a240 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeValChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeValChecker.kt @@ -5,12 +5,11 @@ package org.jetbrains.kotlin.fir.analysis.checkers.extended -import com.intellij.lang.LighterASTNode -import com.intellij.openapi.util.Ref import org.jetbrains.kotlin.KtNodeTypes import org.jetbrains.kotlin.contracts.description.EventOccurrencesRange import org.jetbrains.kotlin.fir.* import org.jetbrains.kotlin.fir.analysis.cfa.* +import org.jetbrains.kotlin.fir.analysis.checkers.getChildren import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.analysis.getChild @@ -103,9 +102,8 @@ object CanBeValChecker : AbstractFirPropertyInitializationChecker() { is FirLightSourceElement -> { val source = fir.source as FirLightSourceElement val tree = (fir.source as FirLightSourceElement).treeStructure - val children = Ref>() - tree.getChildren(source.lighterASTNode, children) - children.get().filterNotNull().filter { it.tokenType == KtNodeTypes.DESTRUCTURING_DECLARATION_ENTRY }.size + val children = source.lighterASTNode.getChildren(tree) + children.filter { it?.tokenType == KtNodeTypes.DESTRUCTURING_DECLARATION_ENTRY }.size } else -> null } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantSingleExpressionStringTemplateChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantSingleExpressionStringTemplateChecker.kt index be4b8c50a43..a2282d4b3e9 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantSingleExpressionStringTemplateChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantSingleExpressionStringTemplateChecker.kt @@ -7,7 +7,6 @@ package org.jetbrains.kotlin.fir.analysis.checkers.extended import com.intellij.lang.LighterASTNode import com.intellij.lang.PsiBuilder -import com.intellij.openapi.util.Ref import com.intellij.psi.PsiElement import org.jetbrains.kotlin.KtNodeTypes import org.jetbrains.kotlin.fir.FirFakeSourceElementKind @@ -15,6 +14,7 @@ import org.jetbrains.kotlin.fir.FirLightSourceElement import org.jetbrains.kotlin.fir.FirPsiSourceElement import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.expression.FirBasicExpressionChecker +import org.jetbrains.kotlin.fir.analysis.checkers.getChildren import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.REDUNDANT_SINGLE_EXPRESSION_STRING_TEMPLATE import org.jetbrains.kotlin.fir.expressions.FirFunctionCall @@ -55,10 +55,9 @@ object RedundantSingleExpressionStringTemplateChecker : FirBasicExpressionChecke private fun LighterASTNode.stringParentChildrenCount(source: FirLightSourceElement): Int? { val parent = source.treeStructure.getParent(this) - return if (parent?.tokenType == KtNodeTypes.STRING_TEMPLATE) { - val childrenOfParent = Ref>() - source.treeStructure.getChildren(parent!!, childrenOfParent) - childrenOfParent.get().filter { it is PsiBuilder.Marker }.size + return if (parent != null && parent.tokenType == KtNodeTypes.STRING_TEMPLATE) { + val childrenOfParent = parent.getChildren(source.treeStructure) + childrenOfParent.filter { it is PsiBuilder.Marker }.size } else { parent?.stringParentChildrenCount(source) } From 58301d8820f485e070263a29bc990956ba4f740b Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 19 Nov 2020 16:13:53 +0300 Subject: [PATCH 229/698] FIR exposed visibility checkers: use positioning strategy --- .../FirExposedVisibilityDeclarationChecker.kt | 17 +++-------------- .../fir/analysis/diagnostics/FirErrors.kt | 16 ++++++++-------- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirExposedVisibilityDeclarationChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirExposedVisibilityDeclarationChecker.kt index 06e138f8c3f..f30329addc2 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirExposedVisibilityDeclarationChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirExposedVisibilityDeclarationChecker.kt @@ -6,11 +6,9 @@ package org.jetbrains.kotlin.fir.analysis.checkers.declaration import com.intellij.psi.PsiElement -import com.intellij.psi.PsiNameIdentifierOwner import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.fir.* import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext -import org.jetbrains.kotlin.fir.analysis.checkers.getChildren import org.jetbrains.kotlin.fir.analysis.checkers.toRegularClass import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticFactory3 @@ -20,7 +18,6 @@ import org.jetbrains.kotlin.fir.resolve.fullyExpandedType import org.jetbrains.kotlin.fir.resolve.toSymbol import org.jetbrains.kotlin.fir.resolve.transformers.ensureResolved import org.jetbrains.kotlin.fir.types.* -import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.utils.addToStdlib.safeAs // TODO: check why coneTypeSafe is necessary at some points inside @@ -97,7 +94,7 @@ object FirExposedVisibilityDeclarationChecker : FirMemberDeclarationChecker() { restricting, typeAliasVisibility, restricting.getEffectiveVisibility(context), - declaration.source?.getIdentifierSource() ?: declaration.source + declaration.source ) } } @@ -115,7 +112,7 @@ object FirExposedVisibilityDeclarationChecker : FirMemberDeclarationChecker() { restricting, functionVisibility, restricting.getEffectiveVisibility(context), - declaration.source?.getIdentifierSource() ?: declaration.source + declaration.source ) } } @@ -151,7 +148,7 @@ object FirExposedVisibilityDeclarationChecker : FirMemberDeclarationChecker() { restricting, propertyVisibility, restricting.getEffectiveVisibility(context), - declaration.source?.getIdentifierSource() ?: declaration.source + declaration.source ) } checkMemberReceiver(declaration.receiverTypeRef, declaration, reporter, context) @@ -229,14 +226,6 @@ object FirExposedVisibilityDeclarationChecker : FirMemberDeclarationChecker() { } } - private fun FirSourceElement.getIdentifierSource() = when (this) { - is FirPsiSourceElement<*> -> (this.psi as? PsiNameIdentifierOwner)?.nameIdentifier?.toFirPsiSourceElement() - is FirLightSourceElement -> { - val identifier = lighterASTNode.getChildren(treeStructure).find { it?.tokenType == KtTokens.IDENTIFIER } - identifier?.toFirLightSourceElement(treeStructure) - } - } - private fun FirMemberDeclaration.getEffectiveVisibility(context: CheckerContext) = getEffectiveVisibility(context.session, context.containingDeclarations, context.sessionHolder.scopeSession) } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt index be48b7a8102..fefec26e9d0 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt @@ -94,14 +94,14 @@ object FirErrors { val VAR_ANNOTATION_PARAMETER by error0(LightTreePositioningStrategies.VAL_OR_VAR_NODE) // Exposed visibility group - val EXPOSED_TYPEALIAS_EXPANDED_TYPE by error3() - val EXPOSED_FUNCTION_RETURN_TYPE by error3() - val EXPOSED_RECEIVER_TYPE by error3() - val EXPOSED_PROPERTY_TYPE by error3() - val EXPOSED_PARAMETER_TYPE by error3() - val EXPOSED_SUPER_INTERFACE by error3() - val EXPOSED_SUPER_CLASS by error3() - val EXPOSED_TYPE_PARAMETER_BOUND by error3() + val EXPOSED_TYPEALIAS_EXPANDED_TYPE by error3(LightTreePositioningStrategies.DECLARATION_NAME) + val EXPOSED_FUNCTION_RETURN_TYPE by error3(LightTreePositioningStrategies.DECLARATION_NAME) + val EXPOSED_RECEIVER_TYPE by error3(LightTreePositioningStrategies.DECLARATION_NAME) + val EXPOSED_PROPERTY_TYPE by error3(LightTreePositioningStrategies.DECLARATION_NAME) + val EXPOSED_PARAMETER_TYPE by error3(/* // NB: for parameter FE 1.0 reports not on a name for some reason */) + val EXPOSED_SUPER_INTERFACE by error3(LightTreePositioningStrategies.DECLARATION_NAME) + val EXPOSED_SUPER_CLASS by error3(LightTreePositioningStrategies.DECLARATION_NAME) + val EXPOSED_TYPE_PARAMETER_BOUND by error3(LightTreePositioningStrategies.DECLARATION_NAME) // Modifiers val INAPPLICABLE_INFIX_MODIFIER by existing1() From f3334b03c4f9feb3d494f092dffcf9f22371a982 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 19 Nov 2020 16:27:53 +0300 Subject: [PATCH 230/698] FIR checkers: simplify FirSupertypeInitializedWithoutPrimaryConstructor --- ...ypeInitializedWithoutPrimaryConstructor.kt | 29 +++---------------- .../LightTreePositioningStrategies.kt | 2 +- 2 files changed, 5 insertions(+), 26 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedWithoutPrimaryConstructor.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedWithoutPrimaryConstructor.kt index a5c84a5b127..02b6a2dcf89 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedWithoutPrimaryConstructor.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedWithoutPrimaryConstructor.kt @@ -6,22 +6,17 @@ package org.jetbrains.kotlin.fir.analysis.checkers.declaration import com.intellij.lang.LighterASTNode -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiErrorElement import com.intellij.util.diff.FlyweightCapableTreeStructure import org.jetbrains.kotlin.KtNodeTypes import org.jetbrains.kotlin.descriptors.ClassKind -import org.jetbrains.kotlin.fir.FirLightSourceElement import org.jetbrains.kotlin.fir.FirSourceElement import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext -import org.jetbrains.kotlin.fir.analysis.checkers.getChildren import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors +import org.jetbrains.kotlin.fir.analysis.diagnostics.findChildByType import org.jetbrains.kotlin.fir.declarations.FirConstructor import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration import org.jetbrains.kotlin.fir.declarations.FirRegularClass -import org.jetbrains.kotlin.fir.psi -import org.jetbrains.kotlin.psi.KtSuperTypeCallEntry object FirSupertypeInitializedWithoutPrimaryConstructor : FirMemberDeclarationChecker() { override fun check(declaration: FirMemberDeclaration, context: CheckerContext, reporter: DiagnosticReporter) { @@ -38,28 +33,12 @@ object FirSupertypeInitializedWithoutPrimaryConstructor : FirMemberDeclarationCh } private fun FirSourceElement.anySupertypeHasConstructorParentheses(): Boolean { - val localPsi = psi - val localLightNode = lighterASTNode - - if (localPsi != null && localPsi !is PsiErrorElement) { - return localPsi.anySupertypeHasConstructorParentheses() - } else if (this is FirLightSourceElement) { - return localLightNode.anySupertypeHasConstructorParentheses(treeStructure) - } - - return false - } - - private fun PsiElement.anySupertypeHasConstructorParentheses(): Boolean { - val children = this.children // this is a method call and it collects children - return children.isNotEmpty() && children[0] !is PsiErrorElement && children[0].children.any { it is KtSuperTypeCallEntry } + return lighterASTNode.anySupertypeHasConstructorParentheses(treeStructure) } private fun LighterASTNode.anySupertypeHasConstructorParentheses(tree: FlyweightCapableTreeStructure): Boolean { - val superTypes = getChildren(tree).find { it?.tokenType == KtNodeTypes.SUPER_TYPE_LIST } - ?: return false - - return superTypes.getChildren(tree).any { it?.tokenType == KtNodeTypes.SUPER_TYPE_CALL_ENTRY } + val superTypes = tree.findChildByType(this, KtNodeTypes.SUPER_TYPE_LIST) ?: return false + return tree.findChildByType(superTypes, KtNodeTypes.SUPER_TYPE_CALL_ENTRY) != null } private fun DiagnosticReporter.report(source: FirSourceElement?) { diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt index 4644b7cebd0..765bb010136 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt @@ -198,7 +198,7 @@ private fun FlyweightCapableTreeStructure.receiverTypeReference( } } -private fun FlyweightCapableTreeStructure.findChildByType(node: LighterASTNode, type: IElementType): LighterASTNode? { +fun FlyweightCapableTreeStructure.findChildByType(node: LighterASTNode, type: IElementType): LighterASTNode? { val childrenRef = Ref>() getChildren(node, childrenRef) return childrenRef.get()?.firstOrNull { it?.tokenType == type } From 915a66f4fa44f8e5d9d6f2093edeb45d737ebe3d Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 23 Nov 2020 19:37:07 +0300 Subject: [PATCH 231/698] [FIR] Introduce & use "multiplexing" SourceElementPositioningStrategy --- .../fir/analysis/diagnostics/FirDiagnostic.kt | 2 +- .../diagnostics/FirDiagnosticFactory.kt | 22 ++++++------ .../diagnostics/FirDiagnosticFactoryDsl.kt | 32 ++++++++--------- .../FirDiagnosticFactoryToRendererMap.kt | 6 ++-- .../fir/analysis/diagnostics/FirErrors.kt | 30 ++++++++-------- .../SourceElementPositioningStrategies.kt | 35 ++++++++++++++++++ .../SourceElementPositioningStrategy.kt | 36 +++++++++++++++++++ 7 files changed, 117 insertions(+), 46 deletions(-) create mode 100644 compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt create mode 100644 compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategy.kt diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnostic.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnostic.kt index 2307c8220e6..ac9747f0b07 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnostic.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnostic.kt @@ -20,7 +20,7 @@ import org.jetbrains.kotlin.fir.FirSourceElement sealed class FirDiagnostic : UnboundDiagnostic { abstract val element: E abstract override val severity: Severity - abstract override val factory: AbstractFirDiagnosticFactory<*, *> + abstract override val factory: AbstractFirDiagnosticFactory<*, *, *> override val textRanges: List get() = factory.getTextRanges(this) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactory.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactory.kt index d8428c7053a..78b5e8ebacd 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactory.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactory.kt @@ -15,10 +15,10 @@ import org.jetbrains.kotlin.fir.FirLightSourceElement import org.jetbrains.kotlin.fir.FirPsiSourceElement import org.jetbrains.kotlin.fir.FirSourceElement -sealed class AbstractFirDiagnosticFactory>( +sealed class AbstractFirDiagnosticFactory, P : PsiElement>( override var name: String?, override val severity: Severity, - val positioningStrategy: LightTreePositioningStrategy, + val positioningStrategy: SourceElementPositioningStrategy

, ) : DiagnosticFactory(name, severity) { abstract val firRenderer: FirDiagnosticRenderer @@ -32,15 +32,15 @@ sealed class AbstractFirDiagnosticFactory): Boolean { val element = diagnostic.element - return positioningStrategy.isValid(element.lighterASTNode, element.treeStructure) + return positioningStrategy.isValid(element) } } class FirDiagnosticFactory0( name: String, severity: Severity, - positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT, -) : AbstractFirDiagnosticFactory>(name, severity, positioningStrategy) { + positioningStrategy: SourceElementPositioningStrategy

= SourceElementPositioningStrategy.DEFAULT, +) : AbstractFirDiagnosticFactory, P>(name, severity, positioningStrategy) { override val firRenderer: FirDiagnosticRenderer> = SimpleFirDiagnosticRenderer("") fun on(element: E): FirSimpleDiagnostic { @@ -57,8 +57,8 @@ class FirDiagnosticFactory0( class FirDiagnosticFactory1( name: String, severity: Severity, - positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT, -) : AbstractFirDiagnosticFactory>(name, severity, positioningStrategy) { + positioningStrategy: SourceElementPositioningStrategy

= SourceElementPositioningStrategy.DEFAULT, +) : AbstractFirDiagnosticFactory, P>(name, severity, positioningStrategy) { override val firRenderer: FirDiagnosticRenderer> = FirDiagnosticWithParameters1Renderer( "{0}", FirDiagnosticRenderers.TO_STRING @@ -78,8 +78,8 @@ class FirDiagnosticFactory1( class FirDiagnosticFactory2( name: String, severity: Severity, - positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT, -) : AbstractFirDiagnosticFactory>(name, severity, positioningStrategy) { + positioningStrategy: SourceElementPositioningStrategy

= SourceElementPositioningStrategy.DEFAULT, +) : AbstractFirDiagnosticFactory, P>(name, severity, positioningStrategy) { override val firRenderer: FirDiagnosticRenderer> = FirDiagnosticWithParameters2Renderer( "{0}, {1}", FirDiagnosticRenderers.TO_STRING, @@ -100,8 +100,8 @@ class FirDiagnosticFactory2( name: String, severity: Severity, - positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT, -) : AbstractFirDiagnosticFactory>(name, severity, positioningStrategy) { + positioningStrategy: SourceElementPositioningStrategy

= SourceElementPositioningStrategy.DEFAULT, +) : AbstractFirDiagnosticFactory, P>(name, severity, positioningStrategy) { override val firRenderer: FirDiagnosticRenderer> = FirDiagnosticWithParameters3Renderer( "{0}, {1}, {2}", FirDiagnosticRenderers.TO_STRING, diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactoryDsl.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactoryDsl.kt index 37a46ae40bc..21fdf5540c6 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactoryDsl.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactoryDsl.kt @@ -12,49 +12,49 @@ import kotlin.properties.ReadOnlyProperty import kotlin.reflect.KProperty fun warning0( - positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT + positioningStrategy: SourceElementPositioningStrategy

= SourceElementPositioningStrategy.DEFAULT ): DiagnosticFactory0DelegateProvider { return DiagnosticFactory0DelegateProvider(Severity.WARNING, positioningStrategy) } fun warning1( - positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT + positioningStrategy: SourceElementPositioningStrategy

= SourceElementPositioningStrategy.DEFAULT ): DiagnosticFactory1DelegateProvider { return DiagnosticFactory1DelegateProvider(Severity.WARNING, positioningStrategy) } fun warning2( - positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT + positioningStrategy: SourceElementPositioningStrategy

= SourceElementPositioningStrategy.DEFAULT ): DiagnosticFactory2DelegateProvider { return DiagnosticFactory2DelegateProvider(Severity.WARNING, positioningStrategy) } fun warning3( - positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT + positioningStrategy: SourceElementPositioningStrategy

= SourceElementPositioningStrategy.DEFAULT ): DiagnosticFactory3DelegateProvider { return DiagnosticFactory3DelegateProvider(Severity.WARNING, positioningStrategy) } fun error0( - positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT + positioningStrategy: SourceElementPositioningStrategy

= SourceElementPositioningStrategy.DEFAULT ): DiagnosticFactory0DelegateProvider { return DiagnosticFactory0DelegateProvider(Severity.ERROR, positioningStrategy) } fun error1( - positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT + positioningStrategy: SourceElementPositioningStrategy

= SourceElementPositioningStrategy.DEFAULT ): DiagnosticFactory1DelegateProvider { return DiagnosticFactory1DelegateProvider(Severity.ERROR, positioningStrategy) } fun error2( - positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT + positioningStrategy: SourceElementPositioningStrategy

= SourceElementPositioningStrategy.DEFAULT ): DiagnosticFactory2DelegateProvider { return DiagnosticFactory2DelegateProvider(Severity.ERROR, positioningStrategy) } fun error3( - positioningStrategy: LightTreePositioningStrategy = LightTreePositioningStrategy.DEFAULT + positioningStrategy: SourceElementPositioningStrategy

= SourceElementPositioningStrategy.DEFAULT ): DiagnosticFactory3DelegateProvider { return DiagnosticFactory3DelegateProvider(Severity.ERROR, positioningStrategy) } @@ -64,26 +64,26 @@ fun error3( * that takes `PsiElement` as first type parameter */ fun existing0(): DiagnosticFactory0DelegateProvider { - return DiagnosticFactory0DelegateProvider(Severity.ERROR, LightTreePositioningStrategy.DEFAULT) + return DiagnosticFactory0DelegateProvider(Severity.ERROR, SourceElementPositioningStrategy.DEFAULT) } fun existing1(): DiagnosticFactory1DelegateProvider { - return DiagnosticFactory1DelegateProvider(Severity.ERROR, LightTreePositioningStrategy.DEFAULT) + return DiagnosticFactory1DelegateProvider(Severity.ERROR, SourceElementPositioningStrategy.DEFAULT) } fun existing2(): DiagnosticFactory2DelegateProvider { - return DiagnosticFactory2DelegateProvider(Severity.ERROR, LightTreePositioningStrategy.DEFAULT) + return DiagnosticFactory2DelegateProvider(Severity.ERROR, SourceElementPositioningStrategy.DEFAULT) } fun existing3(): DiagnosticFactory3DelegateProvider { - return DiagnosticFactory3DelegateProvider(Severity.ERROR, LightTreePositioningStrategy.DEFAULT) + return DiagnosticFactory3DelegateProvider(Severity.ERROR, SourceElementPositioningStrategy.DEFAULT) } // ------------------------------ Providers ------------------------------ class DiagnosticFactory0DelegateProvider( private val severity: Severity, - private val positioningStrategy: LightTreePositioningStrategy + private val positioningStrategy: SourceElementPositioningStrategy

) { operator fun provideDelegate(thisRef: Any?, prop: KProperty<*>): ReadOnlyProperty> { return DummyDelegate(FirDiagnosticFactory0(prop.name, severity, positioningStrategy)) @@ -92,7 +92,7 @@ class DiagnosticFactory0DelegateProvider( class DiagnosticFactory1DelegateProvider( private val severity: Severity, - private val positioningStrategy: LightTreePositioningStrategy + private val positioningStrategy: SourceElementPositioningStrategy

) { operator fun provideDelegate(thisRef: Any?, prop: KProperty<*>): ReadOnlyProperty> { return DummyDelegate(FirDiagnosticFactory1(prop.name, severity, positioningStrategy)) @@ -101,7 +101,7 @@ class DiagnosticFactory1DelegateProvider( private val severity: Severity, - private val positioningStrategy: LightTreePositioningStrategy + private val positioningStrategy: SourceElementPositioningStrategy

) { operator fun provideDelegate(thisRef: Any?, prop: KProperty<*>): ReadOnlyProperty> { return DummyDelegate(FirDiagnosticFactory2(prop.name, severity, positioningStrategy)) @@ -110,7 +110,7 @@ class DiagnosticFactory2DelegateProvider( private val severity: Severity, - private val positioningStrategy: LightTreePositioningStrategy + private val positioningStrategy: SourceElementPositioningStrategy

) { operator fun provideDelegate(thisRef: Any?, prop: KProperty<*>): ReadOnlyProperty> { return DummyDelegate(FirDiagnosticFactory3(prop.name, severity, positioningStrategy)) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactoryToRendererMap.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactoryToRendererMap.kt index 362a11fd8f2..910e196d50c 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactoryToRendererMap.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactoryToRendererMap.kt @@ -10,10 +10,10 @@ import org.jetbrains.kotlin.diagnostics.rendering.DiagnosticParameterRenderer import org.jetbrains.kotlin.fir.FirSourceElement class FirDiagnosticFactoryToRendererMap(val name: String) { - private val renderersMap: MutableMap, FirDiagnosticRenderer<*>> = mutableMapOf() + private val renderersMap: MutableMap, FirDiagnosticRenderer<*>> = mutableMapOf() val psiDiagnosticMap: DiagnosticFactoryToRendererMap = DiagnosticFactoryToRendererMap() - operator fun get(factory: AbstractFirDiagnosticFactory<*, *>): FirDiagnosticRenderer<*>? = renderersMap[factory] + operator fun get(factory: AbstractFirDiagnosticFactory<*, *, *>): FirDiagnosticRenderer<*>? = renderersMap[factory] fun put(factory: FirDiagnosticFactory0, message: String) { put(factory, SimpleFirDiagnosticRenderer(message)) @@ -46,7 +46,7 @@ class FirDiagnosticFactoryToRendererMap(val name: String) { put(factory, FirDiagnosticWithParameters3Renderer(message, rendererA, rendererB, rendererC)) } - private fun put(factory: AbstractFirDiagnosticFactory<*, *>, renderer: FirDiagnosticRenderer<*>) { + private fun put(factory: AbstractFirDiagnosticFactory<*, *, *>, renderer: FirDiagnosticRenderer<*>) { renderersMap[factory] = renderer psiDiagnosticMap.put(factory, renderer) } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt index fefec26e9d0..02e8527602e 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt @@ -66,16 +66,16 @@ object FirErrors { val SEALED_SUPERTYPE_IN_LOCAL_CLASS by error0() // Constructor problems - val CONSTRUCTOR_IN_OBJECT by error0(LightTreePositioningStrategies.DECLARATION_SIGNATURE) - val CONSTRUCTOR_IN_INTERFACE by error0(LightTreePositioningStrategies.DECLARATION_SIGNATURE) + val CONSTRUCTOR_IN_OBJECT by error0(SourceElementPositioningStrategies.DECLARATION_SIGNATURE) + val CONSTRUCTOR_IN_INTERFACE by error0(SourceElementPositioningStrategies.DECLARATION_SIGNATURE) val NON_PRIVATE_CONSTRUCTOR_IN_ENUM by existing0() val NON_PRIVATE_CONSTRUCTOR_IN_SEALED by existing0() val CYCLIC_CONSTRUCTOR_DELEGATION_CALL by warning0() - val PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED by warning0(LightTreePositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL) + val PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED by warning0(SourceElementPositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL) val SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR by warning0() val DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR by warning0() val PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS by warning0() - val EXPLICIT_DELEGATION_CALL_REQUIRED by warning0(LightTreePositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL) + val EXPLICIT_DELEGATION_CALL_REQUIRED by warning0(SourceElementPositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL) val SEALED_CLASS_CONSTRUCTOR_CALL by error0() // Annotations @@ -91,17 +91,17 @@ object FirErrors { val NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION by existing0() val NOT_AN_ANNOTATION_CLASS by error1() val NULLABLE_TYPE_OF_ANNOTATION_MEMBER by existing0() - val VAR_ANNOTATION_PARAMETER by error0(LightTreePositioningStrategies.VAL_OR_VAR_NODE) + val VAR_ANNOTATION_PARAMETER by error0(SourceElementPositioningStrategies.VAL_OR_VAR_NODE) // Exposed visibility group - val EXPOSED_TYPEALIAS_EXPANDED_TYPE by error3(LightTreePositioningStrategies.DECLARATION_NAME) - val EXPOSED_FUNCTION_RETURN_TYPE by error3(LightTreePositioningStrategies.DECLARATION_NAME) - val EXPOSED_RECEIVER_TYPE by error3(LightTreePositioningStrategies.DECLARATION_NAME) - val EXPOSED_PROPERTY_TYPE by error3(LightTreePositioningStrategies.DECLARATION_NAME) + val EXPOSED_TYPEALIAS_EXPANDED_TYPE by error3(SourceElementPositioningStrategies.DECLARATION_NAME) + val EXPOSED_FUNCTION_RETURN_TYPE by error3(SourceElementPositioningStrategies.DECLARATION_NAME) + val EXPOSED_RECEIVER_TYPE by error3() + val EXPOSED_PROPERTY_TYPE by error3(SourceElementPositioningStrategies.DECLARATION_NAME) val EXPOSED_PARAMETER_TYPE by error3(/* // NB: for parameter FE 1.0 reports not on a name for some reason */) - val EXPOSED_SUPER_INTERFACE by error3(LightTreePositioningStrategies.DECLARATION_NAME) - val EXPOSED_SUPER_CLASS by error3(LightTreePositioningStrategies.DECLARATION_NAME) - val EXPOSED_TYPE_PARAMETER_BOUND by error3(LightTreePositioningStrategies.DECLARATION_NAME) + val EXPOSED_SUPER_INTERFACE by error3() + val EXPOSED_SUPER_CLASS by error3() + val EXPOSED_TYPE_PARAMETER_BOUND by error3() // Modifiers val INAPPLICABLE_INFIX_MODIFIER by existing1() @@ -144,11 +144,11 @@ object FirErrors { val ANY_METHOD_IMPLEMENTED_IN_INTERFACE by error0() // Invalid local declarations - val LOCAL_OBJECT_NOT_ALLOWED by error1(LightTreePositioningStrategies.DECLARATION_NAME) - val LOCAL_INTERFACE_NOT_ALLOWED by error1(LightTreePositioningStrategies.DECLARATION_NAME) + val LOCAL_OBJECT_NOT_ALLOWED by error1(SourceElementPositioningStrategies.DECLARATION_NAME) + val LOCAL_INTERFACE_NOT_ALLOWED by error1(SourceElementPositioningStrategies.DECLARATION_NAME) // Control flow diagnostics - val UNINITIALIZED_VARIABLE by error1(LightTreePositioningStrategies.DECLARATION_SIGNATURE) + val UNINITIALIZED_VARIABLE by error1() val WRONG_INVOCATION_KIND by warning3, EventOccurrencesRange, EventOccurrencesRange>() val LEAKED_IN_PLACE_LAMBDA by error1>() val WRONG_IMPLIES_CONDITION by error0() diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt new file mode 100644 index 00000000000..f27903dfcc5 --- /dev/null +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt @@ -0,0 +1,35 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.fir.analysis.diagnostics + +import org.jetbrains.kotlin.diagnostics.PositioningStrategies + +object SourceElementPositioningStrategies { + internal val DEFAULT = SourceElementPositioningStrategy( + LightTreePositioningStrategies.DEFAULT, + PositioningStrategies.DEFAULT + ) + + val VAL_OR_VAR_NODE = SourceElementPositioningStrategy( + LightTreePositioningStrategies.VAL_OR_VAR_NODE, + PositioningStrategies.VAL_OR_VAR_NODE + ) + + val SECONDARY_CONSTRUCTOR_DELEGATION_CALL = SourceElementPositioningStrategy( + LightTreePositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL, + PositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL + ) + + val DECLARATION_NAME = SourceElementPositioningStrategy( + LightTreePositioningStrategies.DECLARATION_NAME, + PositioningStrategies.DECLARATION_NAME + ) + + val DECLARATION_SIGNATURE = SourceElementPositioningStrategy( + LightTreePositioningStrategies.DECLARATION_SIGNATURE, + PositioningStrategies.DECLARATION_SIGNATURE + ) +} \ No newline at end of file diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategy.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategy.kt new file mode 100644 index 00000000000..f4b47aeea25 --- /dev/null +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategy.kt @@ -0,0 +1,36 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.fir.analysis.diagnostics + +import com.intellij.openapi.util.TextRange +import com.intellij.psi.PsiElement +import org.jetbrains.kotlin.diagnostics.PositioningStrategy +import org.jetbrains.kotlin.fir.FirPsiSourceElement +import org.jetbrains.kotlin.fir.FirSourceElement + +open class SourceElementPositioningStrategy( + val lightTreeStrategy: LightTreePositioningStrategy, + val psiStrategy: PositioningStrategy +) { + fun markDiagnostic(diagnostic: FirDiagnostic<*>): List { + val element = diagnostic.element + if (element is FirPsiSourceElement<*>) { + return psiStrategy.mark(element.psi as E) + } + return lightTreeStrategy.mark(element.lighterASTNode, element.treeStructure) + } + + fun isValid(element: FirSourceElement): Boolean { + if (element is FirPsiSourceElement<*>) { + return psiStrategy.isValid(element.psi as E) + } + return lightTreeStrategy.isValid(element.lighterASTNode, element.treeStructure) + } + + companion object { + val DEFAULT: SourceElementPositioningStrategy = SourceElementPositioningStrategies.DEFAULT + } +} \ No newline at end of file From 1c71e64f58a616b87c52ad481660725d3ecc306c Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 24 Nov 2020 09:58:35 +0300 Subject: [PATCH 232/698] [FIR] Create string interpolating call even for single argument Before this commit, questionable optimization existed which unwrapped string interpolating call with single argument to this argument. However, this led to source element loss and the necessity of sub-hacks. In this commit we dropped this optimization (anyway user can remove this single-expression string template in code if needed) to keep source elements intact. --- ...ndantSingleExpressionStringTemplateChecker.txt | 4 ++-- .../NotNullTypeChain.txt | 2 +- .../resolve/arguments/stringTemplates.txt | 2 +- .../kotlin/fir/builder/BaseFirBuilder.kt | 1 - .../codegen/box/strings/stringFromJavaPlus.kt | 1 - .../inlineClasses/inlineClassInStringTemplate.kt | 1 - .../bytecodeText/stringOperations/kt42457_old.kt | 1 - .../bytecodeText/stringOperations/singleConcat.kt | 1 - .../ir/irText/expressions/stringTemplates.fir.txt | 15 +++++++++------ 9 files changed, 13 insertions(+), 15 deletions(-) diff --git a/compiler/fir/analysis-tests/testData/extendedCheckers/RedundantSingleExpressionStringTemplateChecker.txt b/compiler/fir/analysis-tests/testData/extendedCheckers/RedundantSingleExpressionStringTemplateChecker.txt index 33f8dbee0aa..9c66c0fa4b3 100644 --- a/compiler/fir/analysis-tests/testData/extendedCheckers/RedundantSingleExpressionStringTemplateChecker.txt +++ b/compiler/fir/analysis-tests/testData/extendedCheckers/RedundantSingleExpressionStringTemplateChecker.txt @@ -1,9 +1,9 @@ FILE: RedundantSingleExpressionStringTemplateChecker.kt public final val x: R|kotlin/String| = String(Hello) public get(): R|kotlin/String| - public final val y: R|kotlin/String| = R|/x|.R|kotlin/Any.toString|() + public final val y: R|kotlin/String| = (R|/x|.R|kotlin/Any.toString|()) public get(): R|kotlin/String| - public final val z: R|kotlin/String| = R|/y|.R|kotlin/Any.hashCode|().R|kotlin/Any.toString|() + public final val z: R|kotlin/String| = (R|/y|.R|kotlin/Any.hashCode|().R|kotlin/Any.toString|()) public get(): R|kotlin/String| public final fun toString(x: R|kotlin/String|): R|kotlin/String| { ^toString (String(IC), R|/x|.R|kotlin/Any.toString|()) diff --git a/compiler/fir/analysis-tests/testData/extendedCheckers/UselessCallOnNotNullChecker/NotNullTypeChain.txt b/compiler/fir/analysis-tests/testData/extendedCheckers/UselessCallOnNotNullChecker/NotNullTypeChain.txt index ba45e862468..8e2385f983a 100644 --- a/compiler/fir/analysis-tests/testData/extendedCheckers/UselessCallOnNotNullChecker/NotNullTypeChain.txt +++ b/compiler/fir/analysis-tests/testData/extendedCheckers/UselessCallOnNotNullChecker/NotNullTypeChain.txt @@ -2,7 +2,7 @@ FILE: NotNullTypeChain.kt public final val list1: R|kotlin/collections/List| = R|kotlin/collections/listOf|(Int(1)) public get(): R|kotlin/collections/List| public final val list: R|kotlin/collections/List| = R|/list1|.R|kotlin/collections/orEmpty|().R|kotlin/collections/map|( = map@fun (it: R|kotlin/Int|): R|kotlin/String| { - ^ R|/it|.R|kotlin/Any.toString|() + ^ (R|/it|.R|kotlin/Any.toString|()) } ) public get(): R|kotlin/collections/List| diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/stringTemplates.txt b/compiler/fir/analysis-tests/testData/resolve/arguments/stringTemplates.txt index c4fd97009c8..9e3baf7a4c5 100644 --- a/compiler/fir/analysis-tests/testData/resolve/arguments/stringTemplates.txt +++ b/compiler/fir/analysis-tests/testData/resolve/arguments/stringTemplates.txt @@ -8,5 +8,5 @@ FILE: stringTemplates.kt public final fun foo(s: R|kotlin/String|): R|kotlin/Unit| { } public final fun test(a: R|A|): R|kotlin/Unit| { - R|/foo|(R|/a|.R|kotlin/Any.toString|()) + R|/foo|((R|/a|.R|kotlin/Any.toString|())) } diff --git a/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/BaseFirBuilder.kt b/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/BaseFirBuilder.kt index 5f6d441a0b8..be9bec961f1 100644 --- a/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/BaseFirBuilder.kt +++ b/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/BaseFirBuilder.kt @@ -386,7 +386,6 @@ abstract class BaseFirBuilder(val baseSession: FirSession, val context: Conte source = base?.toFirSourceElement() // Fast-pass if there is no non-const string expressions if (!hasExpressions) return buildConstExpression(source, FirConstKind.String, sb.toString()) - argumentList.arguments.singleOrNull()?.let { return it } } } diff --git a/compiler/testData/codegen/box/strings/stringFromJavaPlus.kt b/compiler/testData/codegen/box/strings/stringFromJavaPlus.kt index 94a6a0a5051..ce2912e851d 100644 --- a/compiler/testData/codegen/box/strings/stringFromJavaPlus.kt +++ b/compiler/testData/codegen/box/strings/stringFromJavaPlus.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_RUNTIME diff --git a/compiler/testData/codegen/bytecodeText/inlineClasses/inlineClassInStringTemplate.kt b/compiler/testData/codegen/bytecodeText/inlineClasses/inlineClassInStringTemplate.kt index 40ab8cce869..baf0e9511ca 100644 --- a/compiler/testData/codegen/bytecodeText/inlineClasses/inlineClassInStringTemplate.kt +++ b/compiler/testData/codegen/bytecodeText/inlineClasses/inlineClassInStringTemplate.kt @@ -1,5 +1,4 @@ // !LANGUAGE: +InlineClasses -// IGNORE_BACKEND_FIR: JVM_IR // FILE: Z.kt inline class Z(val value: Int) diff --git a/compiler/testData/codegen/bytecodeText/stringOperations/kt42457_old.kt b/compiler/testData/codegen/bytecodeText/stringOperations/kt42457_old.kt index e68d1e1070a..2f94fa9c7b3 100644 --- a/compiler/testData/codegen/bytecodeText/stringOperations/kt42457_old.kt +++ b/compiler/testData/codegen/bytecodeText/stringOperations/kt42457_old.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // KOTLIN_CONFIGURATION_FLAGS: STRING_CONCAT=indy-with-constants // JVM_TARGET: 9 // FILE: JavaClass.java diff --git a/compiler/testData/codegen/bytecodeText/stringOperations/singleConcat.kt b/compiler/testData/codegen/bytecodeText/stringOperations/singleConcat.kt index 25b0928e01a..e39f97ba536 100644 --- a/compiler/testData/codegen/bytecodeText/stringOperations/singleConcat.kt +++ b/compiler/testData/codegen/bytecodeText/stringOperations/singleConcat.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR fun f(s: String) = "$s" fun g(s: String?) = "$s" diff --git a/compiler/testData/ir/irText/expressions/stringTemplates.fir.txt b/compiler/testData/ir/irText/expressions/stringTemplates.fir.txt index d8b414ae277..6101d3b3acc 100644 --- a/compiler/testData/ir/irText/expressions/stringTemplates.fir.txt +++ b/compiler/testData/ir/irText/expressions/stringTemplates.fir.txt @@ -74,8 +74,9 @@ FILE fqName: fileName:/stringTemplates.kt PROPERTY name:test7 visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:test7 type:kotlin.String visibility:private [final,static] EXPRESSION_BODY - CALL 'public open fun toString (): kotlin.String [fake_override] declared in kotlin.String' type=kotlin.String origin=null - $this: CALL 'public final fun (): kotlin.String declared in ' type=kotlin.String origin=GET_PROPERTY + STRING_CONCATENATION type=kotlin.String + CALL 'public open fun toString (): kotlin.String [fake_override] declared in kotlin.String' type=kotlin.String origin=null + $this: CALL 'public final fun (): kotlin.String declared in ' type=kotlin.String origin=GET_PROPERTY FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.String correspondingProperty: PROPERTY name:test7 visibility:public modality:FINAL [val] BLOCK_BODY @@ -84,8 +85,9 @@ FILE fqName: fileName:/stringTemplates.kt PROPERTY name:test8 visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:test8 type:kotlin.String visibility:private [final,static] EXPRESSION_BODY - CALL 'public open fun toString (): kotlin.String [fake_override] declared in kotlin.String' type=kotlin.String origin=null - $this: CALL 'public final fun foo (): kotlin.String declared in ' type=kotlin.String origin=null + STRING_CONCATENATION type=kotlin.String + CALL 'public open fun toString (): kotlin.String [fake_override] declared in kotlin.String' type=kotlin.String origin=null + $this: CALL 'public final fun foo (): kotlin.String declared in ' type=kotlin.String origin=null FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.String correspondingProperty: PROPERTY name:test8 visibility:public modality:FINAL [val] BLOCK_BODY @@ -94,8 +96,9 @@ FILE fqName: fileName:/stringTemplates.kt PROPERTY name:test9 visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:test9 type:kotlin.String visibility:private [final,static] EXPRESSION_BODY - CALL 'public open fun toString (): kotlin.String [fake_override] declared in kotlin.Int' type=kotlin.String origin=null - $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=GET_PROPERTY + STRING_CONCATENATION type=kotlin.String + CALL 'public open fun toString (): kotlin.String [fake_override] declared in kotlin.Int' type=kotlin.String origin=null + $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=GET_PROPERTY FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.String correspondingProperty: PROPERTY name:test9 visibility:public modality:FINAL [val] BLOCK_BODY From b673996586a0db823eb987f86a6b3b6a845ae4d8 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 24 Nov 2020 10:04:57 +0300 Subject: [PATCH 233/698] Simplify source operations in FirAnnotationArgumentChecker --- .../FirAnnotationArgumentChecker.kt | 31 ++----------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationArgumentChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationArgumentChecker.kt index f30abc5408c..3c0f14fea44 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationArgumentChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationArgumentChecker.kt @@ -37,7 +37,7 @@ object FirAnnotationArgumentChecker : FirBasicDeclarationChecker() { val expression = (arg as? FirNamedArgumentExpression)?.expression ?: arg checkAnnotationArgumentWithSubElements(expression, context.session, reporter) - ?.let { reporter.report(getFirSourceElement(expression), it) } + ?.let { reporter.report(expression.source, it) } } } } @@ -52,7 +52,7 @@ object FirAnnotationArgumentChecker : FirBasicDeclarationChecker() { var usedNonConst = false for (arg in expression.argumentList.arguments) { - val sourceForReport = getFirSourceElement(arg) + val sourceForReport = arg.source when (val err = checkAnnotationArgumentWithSubElements(arg, session, reporter)) { null -> { @@ -70,7 +70,7 @@ object FirAnnotationArgumentChecker : FirBasicDeclarationChecker() { is FirVarargArgumentsExpression -> { for (arg in expression.arguments) checkAnnotationArgumentWithSubElements(arg, session, reporter) - ?.let { reporter.report(getFirSourceElement(arg), it) } + ?.let { reporter.report(arg.source, it) } } else -> return checkAnnotationArgument(expression, session) @@ -224,31 +224,6 @@ object FirAnnotationArgumentChecker : FirBasicDeclarationChecker() { ?.toSymbol(session) ?.fir - private fun getFirSourceElement(expression: FirExpression): FirSourceElement? = - when { - expression is FirFunctionCall && expression.calleeReference.name == TO_STRING -> - getParentOfFirSourceElement(getParentOfFirSourceElement(expression.source)) - expression is FirFunctionCall -> - expression.source - (expression as? FirQualifiedAccess)?.explicitReceiver != null -> - getParentOfFirSourceElement(expression.source) - else -> - expression.source - } - - private fun getParentOfFirSourceElement(source: FirSourceElement?): FirSourceElement? = - when (source) { - is FirPsiSourceElement<*> -> - source.psi.parent.toFirPsiSourceElement() - is FirLightSourceElement -> { - val elementOfParent = source.treeStructure.getParent(source.lighterASTNode) ?: source.lighterASTNode - - elementOfParent.toFirLightSourceElement(source.treeStructure) - } - else -> - source - } - private inline fun DiagnosticReporter.report( source: T?, factory: FirDiagnosticFactory0 From d5f17ea41c2bec6174d54cad92a9a652b2072c47 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 24 Nov 2020 10:40:21 +0300 Subject: [PATCH 234/698] Simplify FirDelegationInInterfaceChecker --- .../FirDelegationInInterfaceChecker.kt | 25 ++++--------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDelegationInInterfaceChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDelegationInInterfaceChecker.kt index a6a9fd3fbfd..62830ce0160 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDelegationInInterfaceChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDelegationInInterfaceChecker.kt @@ -5,13 +5,10 @@ package org.jetbrains.kotlin.fir.analysis.checkers.declaration -import com.intellij.lang.LighterASTNode -import com.intellij.util.diff.FlyweightCapableTreeStructure import org.jetbrains.kotlin.KtNodeTypes import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.fir.FirSourceElement import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext -import org.jetbrains.kotlin.fir.analysis.checkers.getChildren import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.declarations.FirClass @@ -23,23 +20,11 @@ object FirDelegationInInterfaceChecker : FirMemberDeclarationChecker() { return } - declaration.source?.findSuperTypeDelegation()?.let { - reporter.report(declaration.superTypeRefs.getOrNull(it)?.source) - } - } - - private fun FirSourceElement.findSuperTypeDelegation(): Int = - lighterASTNode.findSuperTypeDelegation(treeStructure) - - private fun LighterASTNode.findSuperTypeDelegation(tree: FlyweightCapableTreeStructure): Int { - val children = getChildren(tree) - return if (children.isNotEmpty()) { - children.find { it?.tokenType == KtNodeTypes.SUPER_TYPE_LIST } - ?.getChildren(tree) - ?.indexOfFirst { it?.tokenType == KtNodeTypes.DELEGATED_SUPER_TYPE_ENTRY } - ?: -1 - } else { - -1 + for (superTypeRef in declaration.superTypeRefs) { + val source = superTypeRef.source ?: continue + if (source.treeStructure.getParent(source.lighterASTNode)?.tokenType == KtNodeTypes.DELEGATED_SUPER_TYPE_ENTRY) { + reporter.report(source) + } } } From 12726cd366d37deaf3395867d4c7fffdc22d0822 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 24 Nov 2020 10:52:16 +0300 Subject: [PATCH 235/698] FIR light builder: use type reference node as FirTypeRef source --- .../kotlin/fir/lightTree/converter/DeclarationsConverter.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt index ba619ce96b0..dedd0d5d0e7 100644 --- a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt +++ b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt @@ -1712,7 +1712,8 @@ class DeclarationsConverter( if (identifier == null) return buildErrorTypeRef { diagnostic = ConeSimpleDiagnostic("Incomplete user type", DiagnosticKind.Syntax) } - val theSource = userType.toFirSourceElement() + // Note: we take TYPE_REFERENCE, not USER_TYPE, as the source (to be consistent with RawFirBuilder) + val theSource = tree.getParent(userType)!!.toFirSourceElement() val qualifierPart = FirQualifierPartImpl( identifier.nameAsSafeName(), FirTypeArgumentListImpl(theSource).apply { From bf2b318beecf6b7182f5c7fdefadd5187b36c072 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 24 Nov 2020 11:03:11 +0300 Subject: [PATCH 236/698] Simplify FirSupertypeInitializedInInterfaceChecker --- .../diagnostics/interfaceWithSuperclass.kt | 2 +- .../supertypeInitializedInInterface.kt | 2 +- ...rSupertypeInitializedInInterfaceChecker.kt | 49 ++----------------- .../traitSupertypeList.fir.kt | 2 +- 4 files changed, 8 insertions(+), 47 deletions(-) diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/interfaceWithSuperclass.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/interfaceWithSuperclass.kt index 1498cc8462e..718ea6c5312 100644 --- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/interfaceWithSuperclass.kt +++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/interfaceWithSuperclass.kt @@ -5,4 +5,4 @@ interface B : A interface C class D -interface E : A(), C, D() \ No newline at end of file +interface E : A(), C, D() \ No newline at end of file diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/supertypeInitializedInInterface.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/supertypeInitializedInInterface.kt index 645d98e6754..c0c3ad4c722 100644 --- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/supertypeInitializedInInterface.kt +++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/supertypeInitializedInInterface.kt @@ -8,6 +8,6 @@ interface D : C interface E : Any() -interface F : A, B(), C, D(), Any() { +interface F : A, B(), C, D(), Any() { } \ No newline at end of file diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedInInterfaceChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedInInterfaceChecker.kt index 276bc3f1a36..d81a167bab4 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedInInterfaceChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedInInterfaceChecker.kt @@ -5,22 +5,14 @@ package org.jetbrains.kotlin.fir.analysis.checkers.declaration -import com.intellij.lang.LighterASTNode -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiErrorElement -import com.intellij.util.diff.FlyweightCapableTreeStructure import org.jetbrains.kotlin.KtNodeTypes import org.jetbrains.kotlin.descriptors.ClassKind -import org.jetbrains.kotlin.fir.FirLightSourceElement import org.jetbrains.kotlin.fir.FirSourceElement import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext -import org.jetbrains.kotlin.fir.analysis.checkers.getChildren import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.declarations.FirClass import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration -import org.jetbrains.kotlin.fir.psi -import org.jetbrains.kotlin.psi.KtSuperTypeCallEntry object FirSupertypeInitializedInInterfaceChecker : FirMemberDeclarationChecker() { override fun check(declaration: FirMemberDeclaration, context: CheckerContext, reporter: DiagnosticReporter) { @@ -28,42 +20,11 @@ object FirSupertypeInitializedInInterfaceChecker : FirMemberDeclarationChecker() return } - declaration.source?.findSuperTypeCall()?.let { - reporter.report(declaration.superTypeRefs.getOrNull(it)?.source) - } - } - - private fun FirSourceElement.findSuperTypeCall(): Int { - val localPsi = psi - val localLightNode = lighterASTNode - - if (localPsi != null && localPsi !is PsiErrorElement) { - return localPsi.findSuperTypeCall() - } else if (this is FirLightSourceElement) { - return localLightNode.findSuperTypeCall(treeStructure) - } - - return -1 - } - - private fun PsiElement.findSuperTypeCall(): Int { - val children = this.children // this is a method call and it collects children - return if (children.isNotEmpty() && children[0] !is PsiErrorElement) { - children[0].children.indexOfFirst { it is KtSuperTypeCallEntry } - } else { - -1 - } - } - - private fun LighterASTNode.findSuperTypeCall(tree: FlyweightCapableTreeStructure): Int { - val children = getChildren(tree) - return if (children.isNotEmpty()) { - children.find { it?.tokenType == KtNodeTypes.SUPER_TYPE_LIST } - ?.getChildren(tree) - ?.indexOfFirst { it?.tokenType == KtNodeTypes.SUPER_TYPE_CALL_ENTRY } - ?: -1 - } else { - -1 + for (superTypeRef in declaration.superTypeRefs) { + val source = superTypeRef.source ?: continue + if (source.treeStructure.getParent(source.lighterASTNode)?.tokenType == KtNodeTypes.CONSTRUCTOR_CALLEE) { + reporter.report(source) + } } } diff --git a/compiler/testData/diagnostics/tests/traitWithRequired/traitSupertypeList.fir.kt b/compiler/testData/diagnostics/tests/traitWithRequired/traitSupertypeList.fir.kt index d1a66fcaece..abca9fd22b6 100644 --- a/compiler/testData/diagnostics/tests/traitWithRequired/traitSupertypeList.fir.kt +++ b/compiler/testData/diagnostics/tests/traitWithRequired/traitSupertypeList.fir.kt @@ -1,6 +1,6 @@ open class bar() -interface Foo() : bar(), bar, bar { +interface Foo() : bar(), bar, bar { } interface Foo2 : bar, Foo { From 97c1a3f270db39449d613fa2241cc3db58eee2f5 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 24 Nov 2020 11:41:32 +0300 Subject: [PATCH 237/698] Simplify FirSupertypeInitializedWithoutPrimaryConstructor checker --- ...ypeInitializedWithoutPrimaryConstructor.kt | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedWithoutPrimaryConstructor.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedWithoutPrimaryConstructor.kt index 02b6a2dcf89..54b1878d004 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedWithoutPrimaryConstructor.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypeInitializedWithoutPrimaryConstructor.kt @@ -5,15 +5,12 @@ package org.jetbrains.kotlin.fir.analysis.checkers.declaration -import com.intellij.lang.LighterASTNode -import com.intellij.util.diff.FlyweightCapableTreeStructure import org.jetbrains.kotlin.KtNodeTypes import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.fir.FirSourceElement import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors -import org.jetbrains.kotlin.fir.analysis.diagnostics.findChildByType import org.jetbrains.kotlin.fir.declarations.FirConstructor import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration import org.jetbrains.kotlin.fir.declarations.FirRegularClass @@ -24,21 +21,16 @@ object FirSupertypeInitializedWithoutPrimaryConstructor : FirMemberDeclarationCh return } - val hasSupertypeWithConstructor = declaration.source?.anySupertypeHasConstructorParentheses() == true - val hasPrimaryConstructor = declaration.declarations.any { it is FirConstructor && it.isPrimary } - - if (hasSupertypeWithConstructor && !hasPrimaryConstructor) { - reporter.report(declaration.source) + if (declaration.declarations.any { it is FirConstructor && it.isPrimary }) { + return } - } - private fun FirSourceElement.anySupertypeHasConstructorParentheses(): Boolean { - return lighterASTNode.anySupertypeHasConstructorParentheses(treeStructure) - } - - private fun LighterASTNode.anySupertypeHasConstructorParentheses(tree: FlyweightCapableTreeStructure): Boolean { - val superTypes = tree.findChildByType(this, KtNodeTypes.SUPER_TYPE_LIST) ?: return false - return tree.findChildByType(superTypes, KtNodeTypes.SUPER_TYPE_CALL_ENTRY) != null + for (superTypeRef in declaration.superTypeRefs) { + val source = superTypeRef.source ?: continue + if (source.treeStructure.getParent(source.lighterASTNode)?.tokenType == KtNodeTypes.CONSTRUCTOR_CALLEE) { + reporter.report(declaration.source) + } + } } private fun DiagnosticReporter.report(source: FirSourceElement?) { From d4b0bf4ad8912e7e255c610aac984aa1e44a9188 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 25 Nov 2020 15:42:24 +0300 Subject: [PATCH 238/698] [FIR] Make DEFAULT positioning strategy public, drop duplicated one --- .../analysis/diagnostics/LightTreePositioningStrategies.kt | 2 +- .../fir/analysis/diagnostics/LightTreePositioningStrategy.kt | 4 ---- .../diagnostics/SourceElementPositioningStrategies.kt | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt index 765bb010136..b06f912bbda 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt @@ -17,7 +17,7 @@ import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.KtParameter.VAL_VAR_TOKEN_SET object LightTreePositioningStrategies { - internal val DEFAULT = object : LightTreePositioningStrategy() { + val DEFAULT = object : LightTreePositioningStrategy() { override fun mark(node: LighterASTNode, tree: FlyweightCapableTreeStructure): List { when (node.tokenType) { KtNodeTypes.OBJECT_DECLARATION -> { diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategy.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategy.kt index a234035a711..1f496c79d03 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategy.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategy.kt @@ -27,10 +27,6 @@ open class LightTreePositioningStrategy { open fun isValid(node: LighterASTNode, tree: FlyweightCapableTreeStructure): Boolean { return !hasSyntaxErrors(node, tree) } - - companion object { - val DEFAULT = LightTreePositioningStrategies.DEFAULT - } } fun markElement(node: LighterASTNode, tree: FlyweightCapableTreeStructure): List { diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt index f27903dfcc5..ddeef166db0 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt @@ -8,7 +8,7 @@ package org.jetbrains.kotlin.fir.analysis.diagnostics import org.jetbrains.kotlin.diagnostics.PositioningStrategies object SourceElementPositioningStrategies { - internal val DEFAULT = SourceElementPositioningStrategy( + val DEFAULT = SourceElementPositioningStrategy( LightTreePositioningStrategies.DEFAULT, PositioningStrategies.DEFAULT ) From 8d9abed3dcc8a2b8a8a04d4fa2d37f44a915d423 Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov Date: Mon, 23 Nov 2020 16:37:01 +0300 Subject: [PATCH 239/698] [Commonizer] Minor. More specific upper bounds for CirNodeWithClassId --- .../descriptors/commonizer/mergedtree/CirNodeWithClassId.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirNodeWithClassId.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirNodeWithClassId.kt index 6a4d3ef469a..997d0cbe48c 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirNodeWithClassId.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirNodeWithClassId.kt @@ -5,9 +5,9 @@ package org.jetbrains.kotlin.descriptors.commonizer.mergedtree -import org.jetbrains.kotlin.descriptors.commonizer.cir.CirDeclaration +import org.jetbrains.kotlin.descriptors.commonizer.cir.CirClassifier import org.jetbrains.kotlin.name.ClassId -interface CirNodeWithClassId : CirNode { +interface CirNodeWithClassId : CirNode { val classId: ClassId } From eca231a01d56375c179ec5c8f71cefa5cffb8445 Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov Date: Mon, 23 Nov 2020 15:59:36 +0300 Subject: [PATCH 240/698] [Commonizer] Extract CIR classifiers cache from the root node --- .../commonizer/core/CommonizationVisitor.kt | 7 +++-- .../commonizer/core/TypeCommonizer.kt | 10 +++---- .../kotlin/descriptors/commonizer/facade.kt | 6 ++-- .../mergedtree/CirClassifiersCache.kt | 26 +++++++++++++++-- .../commonizer/mergedtree/CirRootNode.kt | 7 ----- .../commonizer/mergedtree/CirTreeMerger.kt | 14 ++++------ .../commonizer/mergedtree/nodeBuilders.kt | 17 ++++++----- .../commonizer/core/TypeCommonizerTest.kt | 28 +++++++++++-------- .../descriptors/commonizer/utils/mocks.kt | 6 ++-- 9 files changed, 71 insertions(+), 50 deletions(-) diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/CommonizationVisitor.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/CommonizationVisitor.kt index 4e963e8699c..ba95c068dd1 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/CommonizationVisitor.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/CommonizationVisitor.kt @@ -14,6 +14,7 @@ import org.jetbrains.kotlin.descriptors.commonizer.utils.internedClassId import org.jetbrains.kotlin.descriptors.commonizer.utils.isUnderStandardKotlinPackages internal class CommonizationVisitor( + private val cache: CirClassifiersCache, private val root: CirRootNode ) : CirNodeVisitor { override fun visitRootNode(node: CirRootNode, data: Unit) { @@ -87,7 +88,7 @@ internal class CommonizationVisitor( val companionObjectName = node.targetDeclarations.mapTo(HashSet()) { it!!.companion }.singleOrNull() if (companionObjectName != null) { val companionObjectClassId = internedClassId(node.classId, companionObjectName) - val companionObjectNode = root.cache.classes[companionObjectClassId] + val companionObjectNode = cache.classNode(companionObjectClassId) ?: error("Can't find companion object with class ID $companionObjectClassId") if (companionObjectNode.commonDeclaration() != null) { @@ -131,7 +132,7 @@ internal class CommonizationVisitor( if (expandedClassId.packageFqName.isUnderStandardKotlinPackages) return null // this case is not supported - val expandedClassNode = root.cache.classes[expandedClassId] ?: return null + val expandedClassNode = cache.classNode(expandedClassId) ?: return null val expandedClass = expandedClassNode.targetDeclarations[index] ?: error("Can't find expanded class with class ID $expandedClassId and index $index for type alias $classId") @@ -147,7 +148,7 @@ internal class CommonizationVisitor( if (supertypesMap.isNullOrEmpty()) emptyList() else - supertypesMap.values.compactMapNotNull { supertypesGroup -> commonize(supertypesGroup, TypeCommonizer(root.cache)) } + supertypesMap.values.compactMapNotNull { supertypesGroup -> commonize(supertypesGroup, TypeCommonizer(cache)) } ) } } diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeCommonizer.kt index ee123b61882..ec2732e0c8a 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeCommonizer.kt @@ -9,7 +9,7 @@ import org.jetbrains.kotlin.descriptors.DescriptorVisibility import org.jetbrains.kotlin.descriptors.commonizer.cir.* import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirTypeFactory import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirClassifiersCache -import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirNode +import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirNodeWithClassId import org.jetbrains.kotlin.descriptors.commonizer.utils.isUnderStandardKotlinPackages import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.types.Variance @@ -66,7 +66,7 @@ private class ClassTypeCommonizer(private val cache: CirClassifiersCache) : Abst isMarkedNullable == next.isMarkedNullable && classId == next.classifierId && outerType.commonizeWith(next.outerType) - && commonizeClassifier(classId, cache.classes).first + && commonizeClassifier(classId) { cache.classNode(classId) }.first && arguments.commonizeWith(next.arguments) } @@ -102,7 +102,7 @@ private class TypeAliasTypeCommonizer(private val cache: CirClassifiersCache) : return false if (commonizedTypeBuilder == null) { - val (commonized, commonClassifier) = commonizeClassifier(typeAliasId, cache.typeAliases) + val (commonized, commonClassifier) = commonizeClassifier(typeAliasId) { cache.typeAliasNode(typeAliasId) } if (!commonized) return false @@ -218,7 +218,7 @@ private class TypeArgumentListCommonizer(cache: CirClassifiersCache) : AbstractL private inline fun commonizeClassifier( classifierId: ClassId, - classifierNodes: Map>, + classifierNode: (classifierId: ClassId) -> CirNodeWithClassId<*, T>? ): Pair { if (classifierId.packageFqName.isUnderStandardKotlinPackages) { /* either class or type alias from Kotlin stdlib */ @@ -226,7 +226,7 @@ private inline fun commonizeClassifier( } /* or descriptors themselves can be commonized */ - return when (val node = classifierNodes[classifierId]) { + return when (val node = classifierNode(classifierId)) { null -> { // No node means that the class or type alias was not subject for commonization at all, probably it lays // not in commonized module descriptors but somewhere in their dependencies. diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/facade.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/facade.kt index 56d50dc0347..55ae51748da 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/facade.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/facade.kt @@ -10,6 +10,7 @@ import org.jetbrains.kotlin.descriptors.commonizer.builder.DeclarationsBuilderVi import org.jetbrains.kotlin.descriptors.commonizer.builder.createGlobalBuilderComponents import org.jetbrains.kotlin.descriptors.commonizer.core.CommonizationVisitor import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirTreeMerger +import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.DefaultCirClassifiersCache import org.jetbrains.kotlin.storage.LockBasedStorageManager fun runCommonization(parameters: Parameters): Result { @@ -19,11 +20,12 @@ fun runCommonization(parameters: Parameters): Result { val storageManager = LockBasedStorageManager("Declaration descriptors commonization") // build merged tree: - val mergeResult = CirTreeMerger(storageManager, parameters).merge() + val cache = DefaultCirClassifiersCache() + val mergeResult = CirTreeMerger(storageManager, cache, parameters).merge() // commonize: val mergedTree = mergeResult.root - mergedTree.accept(CommonizationVisitor(mergedTree), Unit) + mergedTree.accept(CommonizationVisitor(cache, mergedTree), Unit) parameters.progressLogger?.invoke("Commonized declarations") // build resulting descriptors: diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirClassifiersCache.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirClassifiersCache.kt index e45d454a794..bded9891edc 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirClassifiersCache.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirClassifiersCache.kt @@ -5,9 +5,31 @@ package org.jetbrains.kotlin.descriptors.commonizer.mergedtree +import gnu.trove.THashMap import org.jetbrains.kotlin.name.ClassId interface CirClassifiersCache { - val classes: Map - val typeAliases: Map + fun classNode(classId: ClassId): CirClassNode? + fun typeAliasNode(typeAliasId: ClassId): CirTypeAliasNode? + + fun addClassNode(classId: ClassId, node: CirClassNode) + fun addTypeAliasNode(typeAliasId: ClassId, node: CirTypeAliasNode) +} + +class DefaultCirClassifiersCache : CirClassifiersCache { + private val classNodes = THashMap() + private val typeAliases = THashMap() + + override fun classNode(classId: ClassId): CirClassNode? = classNodes[classId] + override fun typeAliasNode(typeAliasId: ClassId): CirTypeAliasNode? = typeAliases[typeAliasId] + + override fun addClassNode(classId: ClassId, node: CirClassNode) { + val oldNode = classNodes.put(classId, node) + check(oldNode == null) { "Rewriting class node $classId" } + } + + override fun addTypeAliasNode(typeAliasId: ClassId, node: CirTypeAliasNode) { + val oldNode = typeAliases.put(typeAliasId, node) + check(oldNode == null) { "Rewriting type alias node $typeAliasId" } + } } diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirRootNode.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirRootNode.kt index 046f0031fda..44bcba6293a 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirRootNode.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirRootNode.kt @@ -8,7 +8,6 @@ package org.jetbrains.kotlin.descriptors.commonizer.mergedtree import gnu.trove.THashMap import org.jetbrains.kotlin.descriptors.commonizer.cir.CirRoot import org.jetbrains.kotlin.descriptors.commonizer.utils.CommonizedGroup -import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.storage.NullableLazyValue @@ -16,13 +15,7 @@ class CirRootNode( override val targetDeclarations: CommonizedGroup, override val commonDeclaration: NullableLazyValue ) : CirNode { - class CirClassifiersCacheImpl : CirClassifiersCache { - override val classes = THashMap() - override val typeAliases = THashMap() - } - val modules: MutableMap = THashMap() - val cache = CirClassifiersCacheImpl() override fun accept(visitor: CirNodeVisitor, data: T): R = visitor.visitRootNode(this, data) diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirTreeMerger.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirTreeMerger.kt index af36ab5b7be..0fbe40831a9 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirTreeMerger.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirTreeMerger.kt @@ -12,7 +12,6 @@ import org.jetbrains.kotlin.descriptors.commonizer.Parameters import org.jetbrains.kotlin.descriptors.commonizer.TargetProvider import org.jetbrains.kotlin.descriptors.commonizer.cir.CirClass import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.* -import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirRootNode.CirClassifiersCacheImpl import org.jetbrains.kotlin.descriptors.commonizer.utils.intern import org.jetbrains.kotlin.descriptors.commonizer.utils.internedClassId import org.jetbrains.kotlin.name.ClassId @@ -24,6 +23,7 @@ import org.jetbrains.kotlin.storage.StorageManager class CirTreeMerger( private val storageManager: StorageManager, + private val cache: CirClassifiersCache, private val parameters: Parameters ) { class CirTreeMergeResult( @@ -32,11 +32,9 @@ class CirTreeMerger( ) private val size = parameters.targetProviders.size - private lateinit var cacheRW: CirClassifiersCacheImpl fun merge(): CirTreeMergeResult { val rootNode: CirRootNode = buildRootNode(storageManager, size) - cacheRW = rootNode.cache val allModuleInfos: List> = parameters.targetProviders.map { it.modulesProvider.loadModuleInfos() } val commonModuleNames = allModuleInfos.map { it.keys }.reduce { a, b -> a intersect b } @@ -140,7 +138,7 @@ class CirTreeMerger( parentCommonDeclaration: NullableLazyValue<*>? ) { val propertyNode: CirPropertyNode = properties.getOrPut(PropertyApproximationKey(propertyDescriptor)) { - buildPropertyNode(storageManager, size, cacheRW, parentCommonDeclaration) + buildPropertyNode(storageManager, size, cache, parentCommonDeclaration) } propertyNode.targetDeclarations[targetIndex] = CirPropertyFactory.create(propertyDescriptor) } @@ -152,7 +150,7 @@ class CirTreeMerger( parentCommonDeclaration: NullableLazyValue<*>? ) { val functionNode: CirFunctionNode = functions.getOrPut(FunctionApproximationKey(functionDescriptor)) { - buildFunctionNode(storageManager, size, cacheRW, parentCommonDeclaration) + buildFunctionNode(storageManager, size, cache, parentCommonDeclaration) } functionNode.targetDeclarations[targetIndex] = CirFunctionFactory.create(functionDescriptor) } @@ -168,7 +166,7 @@ class CirTreeMerger( val classId = classIdFunction(className) val classNode: CirClassNode = classes.getOrPut(className) { - buildClassNode(storageManager, size, cacheRW, parentCommonDeclaration, classId) + buildClassNode(storageManager, size, cache, parentCommonDeclaration, classId) } classNode.targetDeclarations[targetIndex] = CirClassFactory.create(classDescriptor) @@ -203,7 +201,7 @@ class CirTreeMerger( parentCommonDeclaration: NullableLazyValue<*>? ) { val constructorNode: CirClassConstructorNode = constructors.getOrPut(ConstructorApproximationKey(constructorDescriptor)) { - buildClassConstructorNode(storageManager, size, cacheRW, parentCommonDeclaration) + buildClassConstructorNode(storageManager, size, cache, parentCommonDeclaration) } constructorNode.targetDeclarations[targetIndex] = CirClassConstructorFactory.create(constructorDescriptor) } @@ -218,7 +216,7 @@ class CirTreeMerger( val typeAliasClassId = internedClassId(packageFqName, typeAliasName) val typeAliasNode: CirTypeAliasNode = typeAliases.getOrPut(typeAliasName) { - buildTypeAliasNode(storageManager, size, cacheRW, typeAliasClassId) + buildTypeAliasNode(storageManager, size, cache, typeAliasClassId) } typeAliasNode.targetDeclarations[targetIndex] = CirTypeAliasFactory.create(typeAliasDescriptor) } diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/nodeBuilders.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/nodeBuilders.kt index 41f60d87bea..bf96eba7df6 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/nodeBuilders.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/nodeBuilders.kt @@ -9,7 +9,6 @@ import org.jetbrains.kotlin.descriptors.commonizer.cir.* import org.jetbrains.kotlin.descriptors.commonizer.cir.impl.CirClassRecursionMarker import org.jetbrains.kotlin.descriptors.commonizer.cir.impl.CirClassifierRecursionMarker import org.jetbrains.kotlin.descriptors.commonizer.core.* -import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirRootNode.CirClassifiersCacheImpl import org.jetbrains.kotlin.descriptors.commonizer.utils.CommonizedGroup import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName @@ -80,18 +79,18 @@ internal fun buildFunctionNode( internal fun buildClassNode( storageManager: StorageManager, size: Int, - cacheRW: CirClassifiersCacheImpl, + cache: CirClassifiersCache, parentCommonDeclaration: NullableLazyValue<*>?, classId: ClassId ): CirClassNode = buildNode( storageManager = storageManager, size = size, parentCommonDeclaration = parentCommonDeclaration, - commonizerProducer = { ClassCommonizer(cacheRW) }, + commonizerProducer = { ClassCommonizer(cache) }, recursionMarker = CirClassRecursionMarker, nodeProducer = { targetDeclarations, commonDeclaration -> CirClassNode(targetDeclarations, commonDeclaration, classId).also { - cacheRW.classes[classId] = it + cache.addClassNode(classId, it) } } ) @@ -112,16 +111,16 @@ internal fun buildClassConstructorNode( internal fun buildTypeAliasNode( storageManager: StorageManager, size: Int, - cacheRW: CirClassifiersCacheImpl, - classId: ClassId + cache: CirClassifiersCache, + typeAliasId: ClassId ): CirTypeAliasNode = buildNode( storageManager = storageManager, size = size, - commonizerProducer = { TypeAliasCommonizer(cacheRW) }, + commonizerProducer = { TypeAliasCommonizer(cache) }, recursionMarker = CirClassifierRecursionMarker, nodeProducer = { targetDeclarations, commonDeclaration -> - CirTypeAliasNode(targetDeclarations, commonDeclaration, classId).also { - cacheRW.typeAliases[classId] = it + CirTypeAliasNode(targetDeclarations, commonDeclaration, typeAliasId).also { + cache.addTypeAliasNode(typeAliasId, it) } } ) diff --git a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/TypeCommonizerTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/TypeCommonizerTest.kt index fea71c5466c..caaa9c5ae50 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/TypeCommonizerTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/TypeCommonizerTest.kt @@ -11,12 +11,10 @@ import org.jetbrains.kotlin.descriptors.commonizer.cir.CirType import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirClassFactory import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirTypeAliasFactory import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirTypeFactory -import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirClassifiersCache -import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirRootNode.CirClassifiersCacheImpl -import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.buildClassNode -import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.buildTypeAliasNode +import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.* import org.jetbrains.kotlin.descriptors.commonizer.utils.mockClassType import org.jetbrains.kotlin.descriptors.commonizer.utils.mockTAType +import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.resolve.descriptorUtil.classId import org.jetbrains.kotlin.storage.LockBasedStorageManager import org.jetbrains.kotlin.types.KotlinType @@ -26,11 +24,11 @@ import org.junit.Test class TypeCommonizerTest : AbstractCommonizerTest() { - private lateinit var cache: CirClassifiersCacheImpl + private lateinit var cache: CirClassifiersCache @Before fun initialize() { - cache = CirClassifiersCacheImpl() // reset cache + cache = DefaultCirClassifiersCache() // reset cache } @Test @@ -467,11 +465,11 @@ class TypeCommonizerTest : AbstractCommonizerTest() { when (descriptor) { is ClassDescriptor -> { val classId = descriptor.classId ?: error("No class ID for ${descriptor::class.java}, $descriptor") - val node = cache.classes.getOrPut(classId) { + val node = cache.classNode(classId) { buildClassNode( storageManager = LockBasedStorageManager.NO_LOCKS, size = variants.size, - cacheRW = cache, + cache = cache, parentCommonDeclaration = null, classId = classId ) @@ -479,13 +477,13 @@ class TypeCommonizerTest : AbstractCommonizerTest() { node.targetDeclarations[index] = CirClassFactory.create(descriptor) } is TypeAliasDescriptor -> { - val classId = descriptor.classId ?: error("No class ID for ${descriptor::class.java}, $descriptor") - val node = cache.typeAliases.getOrPut(classId) { + val typeAliasId = descriptor.classId ?: error("No class ID for ${descriptor::class.java}, $descriptor") + val node = cache.typeAliasNode(typeAliasId) { buildTypeAliasNode( storageManager = LockBasedStorageManager.NO_LOCKS, size = variants.size, - cacheRW = cache, - classId = classId + cache = cache, + typeAliasId = typeAliasId ) } node.targetDeclarations[index] = CirTypeAliasFactory.create(descriptor) @@ -526,5 +524,11 @@ class TypeCommonizerTest : AbstractCommonizerTest() { companion object { fun areEqual(cache: CirClassifiersCache, a: CirType, b: CirType): Boolean = TypeCommonizer(cache).run { commonizeWith(a) && commonizeWith(b) } + + private fun CirClassifiersCache.classNode(classId: ClassId, computation: () -> CirClassNode) = + classNode(classId) ?: computation() + + private fun CirClassifiersCache.typeAliasNode(typeAliasId: ClassId, computation: () -> CirTypeAliasNode) = + typeAliasNode(typeAliasId) ?: computation() } } diff --git a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/utils/mocks.kt b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/utils/mocks.kt index 544294c8297..c2d437394d7 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/utils/mocks.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/utils/mocks.kt @@ -122,8 +122,10 @@ private fun createPackageFragmentForClassifier(classifierFqName: FqName): Packag } internal val EMPTY_CLASSIFIERS_CACHE = object : CirClassifiersCache { - override val classes: Map get() = emptyMap() - override val typeAliases: Map get() = emptyMap() + override fun classNode(classId: ClassId): CirClassNode? = null + override fun typeAliasNode(typeAliasId: ClassId): CirTypeAliasNode? = null + override fun addClassNode(classId: ClassId, node: CirClassNode) = error("This method should not be called") + override fun addTypeAliasNode(typeAliasId: ClassId, node: CirTypeAliasNode) = error("This method should not be called") } internal class MockBuiltInsProvider(private val builtIns: KotlinBuiltIns) : BuiltInsProvider { From c7412844583c8f4cfe6ba56f1a79fe42228276b0 Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov Date: Wed, 25 Nov 2020 14:36:18 +0300 Subject: [PATCH 241/698] [Commonizer] Stricter processing of forward declarations --- .../descriptors/commonizer/TargetProvider.kt | 11 ++- .../commonizer/core/TypeCommonizer.kt | 75 ++++++++++++++----- .../NativeDistributionModulesProvider.kt | 15 +++- .../konan/NativeSensitiveManifestData.kt | 15 +++- .../mergedtree/CirClassifiersCache.kt | 17 ++++- .../commonizer/mergedtree/CirTreeMerger.kt | 46 +++++++++++- .../descriptors/commonizer/utils/fqName.kt | 3 +- .../core/ExtensionReceiverCommonizerTest.kt | 4 +- .../core/TypeParameterCommonizerTest.kt | 4 +- .../core/TypeParameterListCommonizerTest.kt | 4 +- .../core/ValueParameterCommonizerTest.kt | 6 +- .../core/ValueParameterListCommonizerTest.kt | 6 +- .../descriptors/commonizer/utils/mocks.kt | 33 +++++++- 13 files changed, 189 insertions(+), 50 deletions(-) diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/TargetProvider.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/TargetProvider.kt index 5b87fac3811..b3abce353fd 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/TargetProvider.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/TargetProvider.kt @@ -28,7 +28,16 @@ interface BuiltInsProvider { } interface ModulesProvider { - class ModuleInfo(val name: String, val originalLocation: File) + class ModuleInfo( + val name: String, + val originalLocation: File, + val cInteropAttributes: CInteropModuleAttributes? + ) + + class CInteropModuleAttributes( + val mainPackageFqName: String, + val exportForwardDeclarations: Collection + ) fun loadModuleInfos(): Map fun loadModules(): Map diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeCommonizer.kt index ec2732e0c8a..003a5b38663 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeCommonizer.kt @@ -8,8 +8,10 @@ package org.jetbrains.kotlin.descriptors.commonizer.core import org.jetbrains.kotlin.descriptors.DescriptorVisibility import org.jetbrains.kotlin.descriptors.commonizer.cir.* import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirTypeFactory +import org.jetbrains.kotlin.descriptors.commonizer.core.CommonizedTypeAliasAnswer.Companion.FAILURE_MISSING_IN_SOME_TARGET +import org.jetbrains.kotlin.descriptors.commonizer.core.CommonizedTypeAliasAnswer.Companion.SUCCESS_FROM_DEPENDEE_LIBRARY import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirClassifiersCache -import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirNodeWithClassId +import org.jetbrains.kotlin.descriptors.commonizer.utils.isUnderKotlinNativeSyntheticPackages import org.jetbrains.kotlin.descriptors.commonizer.utils.isUnderStandardKotlinPackages import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.types.Variance @@ -66,7 +68,7 @@ private class ClassTypeCommonizer(private val cache: CirClassifiersCache) : Abst isMarkedNullable == next.isMarkedNullable && classId == next.classifierId && outerType.commonizeWith(next.outerType) - && commonizeClassifier(classId) { cache.classNode(classId) }.first + && commonizeClass(classId, cache) && arguments.commonizeWith(next.arguments) } @@ -102,11 +104,11 @@ private class TypeAliasTypeCommonizer(private val cache: CirClassifiersCache) : return false if (commonizedTypeBuilder == null) { - val (commonized, commonClassifier) = commonizeClassifier(typeAliasId) { cache.typeAliasNode(typeAliasId) } - if (!commonized) + val answer = commonizeTypeAlias(typeAliasId, cache) + if (!answer.commonized) return false - commonizedTypeBuilder = when (commonClassifier) { + commonizedTypeBuilder = when (val commonClassifier = answer.commonClassifier) { is CirClass -> CommonizedTypeAliasTypeBuilder.forClass(commonClassifier) is CirTypeAlias -> CommonizedTypeAliasTypeBuilder.forTypeAlias(commonClassifier) null -> CommonizedTypeAliasTypeBuilder.forKnownUnderlyingType(next.underlyingType) @@ -216,26 +218,59 @@ private class TypeArgumentListCommonizer(cache: CirClassifiersCache) : AbstractL singleElementCommonizerFactory = { TypeArgumentCommonizer(cache) } ) -private inline fun commonizeClassifier( - classifierId: ClassId, - classifierNode: (classifierId: ClassId) -> CirNodeWithClassId<*, T>? -): Pair { - if (classifierId.packageFqName.isUnderStandardKotlinPackages) { - /* either class or type alias from Kotlin stdlib */ - return true to null +private fun commonizeClass(classId: ClassId, cache: CirClassifiersCache): Boolean { + val packageFqName = classId.packageFqName + if (packageFqName.isUnderStandardKotlinPackages) { + // The class is from Kotlin stdlib. Already commonized. + return true + } else if (packageFqName.isUnderKotlinNativeSyntheticPackages) { + // C/Obj-C forward declarations are: + // - Either resolved to real classes/interfaces from other interop libraries (which are generated by C-interop tool and + // are known to have modality/visibility/other attributes to successfully pass commonization). + // - Or resolved to the same synthetic classes/interfaces. + // ... and therefore are considered as successfully commonized. + return true } - /* or descriptors themselves can be commonized */ - return when (val node = classifierNode(classifierId)) { + return when (val node = cache.classNode(classId)) { null -> { - // No node means that the class or type alias was not subject for commonization at all, probably it lays - // not in commonized module descriptors but somewhere in their dependencies. - true to null + // No node means that the class was not subject for commonization. + // - Either it is missing in certain targets at all => not commonized. + // - Or it is a known forward declaration => consider it as commonized. + cache.isExportedForwardDeclaration(classId) } else -> { - // If entry is present, then contents (common declaration) should not be null. - val commonClassifier = node.commonDeclaration() - (commonClassifier != null) to commonClassifier + // Common declaration in node is not null -> successfully commonized. + (node.commonDeclaration() != null) } } } + +private fun commonizeTypeAlias(typeAliasId: ClassId, cache: CirClassifiersCache): CommonizedTypeAliasAnswer { + val packageFqName = typeAliasId.packageFqName + if (packageFqName.isUnderStandardKotlinPackages) { + // The type alias is from Kotlin stdlib. Already commonized. + return SUCCESS_FROM_DEPENDEE_LIBRARY + } + + return when (val node = cache.typeAliasNode(typeAliasId)) { + null -> { + // No node means that the type alias was not subject for commonization. It is missing in some target(s) => not commonized. + FAILURE_MISSING_IN_SOME_TARGET + } + else -> { + // Common declaration in node is not null -> successfully commonized. + CommonizedTypeAliasAnswer.create(node.commonDeclaration()) + } + } +} + +private class CommonizedTypeAliasAnswer(val commonized: Boolean, val commonClassifier: CirClassifier?) { + companion object { + val SUCCESS_FROM_DEPENDEE_LIBRARY = CommonizedTypeAliasAnswer(true, null) + val FAILURE_MISSING_IN_SOME_TARGET = CommonizedTypeAliasAnswer(false, null) + + fun create(commonClassifier: CirClassifier?) = + if (commonClassifier != null) CommonizedTypeAliasAnswer(true, commonClassifier) else FAILURE_MISSING_IN_SOME_TARGET + } +} diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionModulesProvider.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionModulesProvider.kt index 7104fdd93eb..b2929503f72 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionModulesProvider.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionModulesProvider.kt @@ -10,6 +10,7 @@ import org.jetbrains.kotlin.config.LanguageVersionSettingsImpl import org.jetbrains.kotlin.descriptors.ModuleDescriptor import org.jetbrains.kotlin.descriptors.commonizer.BuiltInsProvider import org.jetbrains.kotlin.descriptors.commonizer.ModulesProvider +import org.jetbrains.kotlin.descriptors.commonizer.ModulesProvider.CInteropModuleAttributes import org.jetbrains.kotlin.descriptors.commonizer.ModulesProvider.ModuleInfo import org.jetbrains.kotlin.descriptors.commonizer.utils.NativeFactories import org.jetbrains.kotlin.descriptors.commonizer.utils.createKotlinNativeForwardDeclarationsModule @@ -36,10 +37,20 @@ internal class NativeDistributionModulesProvider( override fun loadModuleInfos(): Map { return libraries.platformLibs.associate { library -> - val name = library.manifestData.uniqueName + val manifestData = library.manifestData + + val name = manifestData.uniqueName val location = File(library.library.libraryFile.path) - name to ModuleInfo(name, location) + val cInteropAttributes = if (manifestData.isInterop) { + val packageFqName = manifestData.packageFqName + ?: manifestData.shortName?.let { "platform.$it" } + ?: manifestData.uniqueName.substringAfter("platform.").let { "platform.$it" } + + CInteropModuleAttributes(packageFqName, manifestData.exportForwardDeclarations) + } else null + + name to ModuleInfo(name, location, cInteropAttributes) } } diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeSensitiveManifestData.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeSensitiveManifestData.kt index a9bdb2d776c..3d3ee40a5ef 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeSensitiveManifestData.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeSensitiveManifestData.kt @@ -37,7 +37,7 @@ internal data class NativeSensitiveManifestData( addOptionalProperty(KLIB_PROPERTY_DEPENDS, dependencies.isNotEmpty()) { dependencies.joinToString(separator = " ") } addOptionalProperty(KLIB_PROPERTY_INTEROP, isInterop) { "true" } addOptionalProperty(KLIB_PROPERTY_PACKAGE, packageFqName != null) { packageFqName!! } - addOptionalProperty(KLIB_PROPERTY_EXPORT_FORWARD_DECLARATIONS, exportForwardDeclarations.isNotEmpty()) { + addOptionalProperty(KLIB_PROPERTY_EXPORT_FORWARD_DECLARATIONS, exportForwardDeclarations.isNotEmpty() || isInterop) { exportForwardDeclarations.joinToString(" ") } addOptionalProperty(KLIB_PROPERTY_NATIVE_TARGETS, nativeTargets.isNotEmpty()) { @@ -51,15 +51,22 @@ internal data class NativeSensitiveManifestData( check(uniqueName == other.uniqueName) - // Assumption: It's enough to merge native targets list, other properties can be taken from 'this' manifest. + // Merge algorithm: + // - Unite native target lists. + // - Intersect dependency lists. + // - Boolean and 'isInterop'. + // - If both libs are 'isInterop' then intersect exported forward declaration lists. + // - Other properties can be taken from 'this' manifest. + + val bothAreInterop = isInterop && other.isInterop return NativeSensitiveManifestData( uniqueName = uniqueName, versions = versions, dependencies = (dependencies intersect other.dependencies).toList(), - isInterop = isInterop, + isInterop = bothAreInterop, packageFqName = packageFqName, - exportForwardDeclarations = exportForwardDeclarations, + exportForwardDeclarations = if (bothAreInterop) (exportForwardDeclarations intersect other.exportForwardDeclarations).toList() else emptyList(), nativeTargets = HashSet().apply { addAll(nativeTargets) addAll(other.nativeTargets) diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirClassifiersCache.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirClassifiersCache.kt index bded9891edc..4b22c5d310c 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirClassifiersCache.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirClassifiersCache.kt @@ -6,22 +6,35 @@ package org.jetbrains.kotlin.descriptors.commonizer.mergedtree import gnu.trove.THashMap +import gnu.trove.THashSet +import org.jetbrains.kotlin.descriptors.commonizer.utils.isUnderKotlinNativeSyntheticPackages import org.jetbrains.kotlin.name.ClassId interface CirClassifiersCache { + fun isExportedForwardDeclaration(classId: ClassId): Boolean + fun classNode(classId: ClassId): CirClassNode? fun typeAliasNode(typeAliasId: ClassId): CirTypeAliasNode? + fun addExportedForwardDeclaration(classId: ClassId) + fun addClassNode(classId: ClassId, node: CirClassNode) fun addTypeAliasNode(typeAliasId: ClassId, node: CirTypeAliasNode) } class DefaultCirClassifiersCache : CirClassifiersCache { + private val exportedForwardDeclarations = THashSet() private val classNodes = THashMap() private val typeAliases = THashMap() - override fun classNode(classId: ClassId): CirClassNode? = classNodes[classId] - override fun typeAliasNode(typeAliasId: ClassId): CirTypeAliasNode? = typeAliases[typeAliasId] + override fun isExportedForwardDeclaration(classId: ClassId) = classId in exportedForwardDeclarations + override fun classNode(classId: ClassId) = classNodes[classId] + override fun typeAliasNode(typeAliasId: ClassId) = typeAliases[typeAliasId] + + override fun addExportedForwardDeclaration(classId: ClassId) { + check(!classId.packageFqName.isUnderKotlinNativeSyntheticPackages) + exportedForwardDeclarations += classId + } override fun addClassNode(classId: ClassId, node: CirClassNode) { val oldNode = classNodes.put(classId, node) diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirTreeMerger.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirTreeMerger.kt index 0fbe40831a9..2164fd37540 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirTreeMerger.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirTreeMerger.kt @@ -21,6 +21,31 @@ import org.jetbrains.kotlin.resolve.scopes.MemberScope import org.jetbrains.kotlin.storage.NullableLazyValue import org.jetbrains.kotlin.storage.StorageManager +/** + * N.B. Limitations on C/Obj-C interop. + * + * [Case 1]: An interop library with two fragments for two targets. The first fragment has a forward declaration of classifier A. + * The second one has a definition of class A. Both fragments have a top-level callable (ex: function) + * with the same signature that refers to type "A" as its return type. + * + * What will happen: Forward declarations will be ignored during building CIR merged tree. So the node for class A + * will contain CirClass "A" for the second target only. This node will not succeed in commonization, and no common class + * declaration will be produced. As a result the top-level callable will not be commonized, as it refers to the type "A" + * that is not formally commonized. + * + * This is not strictly correct: The classifier "A" exists in both targets though in different form. So if the user + * would write shared source code that uses "A" and the callable, then this code would successfully compile against both targets. + * + * The reason why commonization of such classifiers is not supported yet is that this is quite a rare case that requires + * a complex implementation with potential performance penalty. + * + * [Case 2]: A library with two fragments for two targets. The first fragment is interop. The second one is not. + * Similarly to case 1, the 1st fragment has a forward declaration of a classifier, and the 2nd has a real classifier. + * + * At the moment, this is an exotic case. It could happen if someone tries to commonize an MPP library for Native and non-Native + * targets (which is not supported yet), or a Native library where one fragment is produced via C-interop tool and the other one + * is compiled from Kotlin/Native source code (not sure this should be supported at all). + */ class CirTreeMerger( private val storageManager: StorageManager, private val cache: CirClassifiersCache, @@ -40,7 +65,8 @@ class CirTreeMerger( val commonModuleNames = allModuleInfos.map { it.keys }.reduce { a, b -> a intersect b } parameters.targetProviders.forEachIndexed { targetIndex, targetProvider -> - processTarget(rootNode, targetIndex, targetProvider, commonModuleNames) + val commonModuleInfos = allModuleInfos[targetIndex].filterKeys { it in commonModuleNames } + processTarget(rootNode, targetIndex, targetProvider, commonModuleInfos) parameters.progressLogger?.invoke("Loaded declarations for [${targetProvider.target.name}]") System.gc() } @@ -61,7 +87,7 @@ class CirTreeMerger( rootNode: CirRootNode, targetIndex: Int, targetProvider: TargetProvider, - commonModuleNames: Set + commonModuleInfos: Map ) { rootNode.targetDeclarations[targetIndex] = CirRootFactory.create( targetProvider.target, @@ -73,16 +99,28 @@ class CirTreeMerger( val modules: MutableMap = rootNode.modules moduleDescriptors.forEach { (name, moduleDescriptor) -> - if (name in commonModuleNames) - processModule(modules, targetIndex, moduleDescriptor) + val moduleInfo = commonModuleInfos[name] ?: return@forEach + processModule(modules, targetIndex, moduleInfo, moduleDescriptor) } } private fun processModule( modules: MutableMap, targetIndex: Int, + moduleInfo: ModuleInfo, moduleDescriptor: ModuleDescriptor ) { + moduleInfo.cInteropAttributes?.let { cInteropAttributes -> + val exportForwardDeclarations = cInteropAttributes.exportForwardDeclarations.takeIf { it.isNotEmpty() } ?: return@let + val mainPackageFqName = FqName(cInteropAttributes.mainPackageFqName).intern() + + exportForwardDeclarations.forEach { classFqName -> + // Class has synthetic package FQ name (cnames/objcnames). Need to transfer it to the main package. + val className = Name.identifier(classFqName.substringAfterLast('.')).intern() + cache.addExportedForwardDeclaration(internedClassId(mainPackageFqName, className)) + } + } + val moduleName: Name = moduleDescriptor.name.intern() val moduleNode: CirModuleNode = modules.getOrPut(moduleName) { buildModuleNode(storageManager, size) diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/fqName.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/fqName.kt index 297df4f80ed..0bb6100c64a 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/fqName.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/fqName.kt @@ -46,7 +46,8 @@ internal val FqName.isUnderKotlinNativeSyntheticPackages: Boolean internal val FqName.isUnderDarwinPackage: Boolean get() = asString().hasPrefix(DARWIN_PACKAGE) -private fun FqName.hasAnyPrefix(prefixes: List): Boolean = +@Suppress("NOTHING_TO_INLINE") +private inline fun FqName.hasAnyPrefix(prefixes: List): Boolean = asString().let { fqName -> prefixes.any(fqName::hasPrefix) } private fun String.hasPrefix(prefix: String): Boolean { diff --git a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/ExtensionReceiverCommonizerTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/ExtensionReceiverCommonizerTest.kt index 8e5b7222ba9..430383627cf 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/ExtensionReceiverCommonizerTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/ExtensionReceiverCommonizerTest.kt @@ -8,7 +8,7 @@ package org.jetbrains.kotlin.descriptors.commonizer.core import org.jetbrains.kotlin.descriptors.commonizer.cir.CirExtensionReceiver import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirExtensionReceiverFactory import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirTypeFactory -import org.jetbrains.kotlin.descriptors.commonizer.utils.EMPTY_CLASSIFIERS_CACHE +import org.jetbrains.kotlin.descriptors.commonizer.utils.MOCK_CLASSIFIERS_CACHE import org.jetbrains.kotlin.descriptors.commonizer.utils.mockClassType import org.junit.Test @@ -49,7 +49,7 @@ class ExtensionReceiverCommonizerTest : AbstractCommonizerTest() { - override fun createCommonizer() = TypeParameterCommonizer(EMPTY_CLASSIFIERS_CACHE) + override fun createCommonizer() = TypeParameterCommonizer(MOCK_CLASSIFIERS_CACHE) @Test fun allAreReified() = doTestSuccess( diff --git a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/TypeParameterListCommonizerTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/TypeParameterListCommonizerTest.kt index e8efd055a95..6e6bf48f5b4 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/TypeParameterListCommonizerTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/TypeParameterListCommonizerTest.kt @@ -6,7 +6,7 @@ package org.jetbrains.kotlin.descriptors.commonizer.core import org.jetbrains.kotlin.descriptors.commonizer.cir.CirTypeParameter -import org.jetbrains.kotlin.descriptors.commonizer.utils.EMPTY_CLASSIFIERS_CACHE +import org.jetbrains.kotlin.descriptors.commonizer.utils.MOCK_CLASSIFIERS_CACHE import org.junit.Test class TypeParameterListCommonizerTest : AbstractCommonizerTest, List>() { @@ -108,7 +108,7 @@ class TypeParameterListCommonizerTest : AbstractCommonizerTest): List { diff --git a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/ValueParameterCommonizerTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/ValueParameterCommonizerTest.kt index bedd1c0dabf..18cebf335d0 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/ValueParameterCommonizerTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/ValueParameterCommonizerTest.kt @@ -12,7 +12,7 @@ import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirTypeFactory import org.jetbrains.kotlin.descriptors.commonizer.core.CirTestValueParameter.Companion.areEqual import org.jetbrains.kotlin.descriptors.commonizer.core.TypeCommonizerTest.Companion.areEqual import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirClassifiersCache -import org.jetbrains.kotlin.descriptors.commonizer.utils.EMPTY_CLASSIFIERS_CACHE +import org.jetbrains.kotlin.descriptors.commonizer.utils.MOCK_CLASSIFIERS_CACHE import org.jetbrains.kotlin.descriptors.commonizer.utils.mockClassType import org.jetbrains.kotlin.name.Name import org.junit.Test @@ -141,10 +141,10 @@ class ValueParameterCommonizerTest : AbstractCommonizerTest, List>() { @@ -150,7 +150,7 @@ class ValueParameterListCommonizerTest : AbstractCommonizerTest?, b: List?): Boolean { if (a === b) @@ -159,7 +159,7 @@ class ValueParameterListCommonizerTest : AbstractCommonizerTest Date: Wed, 25 Nov 2020 16:14:13 +0300 Subject: [PATCH 242/698] Minor. Add words to project dictionary --- .idea/dictionaries/dmitriy_dolovov.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/.idea/dictionaries/dmitriy_dolovov.xml b/.idea/dictionaries/dmitriy_dolovov.xml index 78f1fd1adb5..ded41539829 100644 --- a/.idea/dictionaries/dmitriy_dolovov.xml +++ b/.idea/dictionaries/dmitriy_dolovov.xml @@ -10,6 +10,7 @@ commonizers commonizes commonizing + interop jetbrains konan kotlinx From db9f301eed90c493b9eadb5aef46c73999279e40 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Thu, 26 Nov 2020 11:53:07 +0300 Subject: [PATCH 243/698] [FE] Make DiagnosticFactory.name not null --- .../FirDiagnosticFactoriesInitializer.kt | 16 ---------------- .../analysis/diagnostics/FirDiagnosticFactory.kt | 2 +- .../kotlin/diagnostics/DiagnosticFactory.kt | 12 +++++++++--- .../factories/DebugInfoDiagnosticFactory0.kt | 5 ++--- .../factories/DebugInfoDiagnosticFactory1.kt | 5 ++--- .../factories/SyntaxErrorDiagnosticFactory.kt | 3 +-- .../org/jetbrains/kotlin/diagnostics/Errors.java | 2 +- 7 files changed, 16 insertions(+), 29 deletions(-) delete mode 100644 compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactoriesInitializer.kt diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactoriesInitializer.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactoriesInitializer.kt deleted file mode 100644 index 6938aa3f098..00000000000 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactoriesInitializer.kt +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -@file:Suppress("PackageDirectoryMismatch") - -package org.jetbrains.kotlin.diagnostics - -/** - * This methods should me in `org.jetbrains.kotlin.diagnostics` package - * because of `DiagnosticFactory.setName` is package private - */ -fun DiagnosticFactory<*>.initializeName(name: String) { - this.name = name -} \ No newline at end of file diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactory.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactory.kt index 78b5e8ebacd..ed3b1332193 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactory.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticFactory.kt @@ -16,7 +16,7 @@ import org.jetbrains.kotlin.fir.FirPsiSourceElement import org.jetbrains.kotlin.fir.FirSourceElement sealed class AbstractFirDiagnosticFactory, P : PsiElement>( - override var name: String?, + override val name: String, override val severity: Severity, val positioningStrategy: SourceElementPositioningStrategy

, ) : DiagnosticFactory(name, severity) { diff --git a/compiler/frontend.common/src/org/jetbrains/kotlin/diagnostics/DiagnosticFactory.kt b/compiler/frontend.common/src/org/jetbrains/kotlin/diagnostics/DiagnosticFactory.kt index 7891448b8c9..67812d8c334 100644 --- a/compiler/frontend.common/src/org/jetbrains/kotlin/diagnostics/DiagnosticFactory.kt +++ b/compiler/frontend.common/src/org/jetbrains/kotlin/diagnostics/DiagnosticFactory.kt @@ -9,9 +9,15 @@ import org.jetbrains.kotlin.diagnostics.rendering.DiagnosticRenderer import java.lang.IllegalArgumentException abstract class DiagnosticFactory protected constructor( - open var name: String?, + private var _name: String?, open val severity: Severity ) { + open val name: String + get() = _name!! + + fun initializeName(name: String) { + _name = name + } open var defaultRenderer: DiagnosticRenderer? = null @@ -29,7 +35,7 @@ abstract class DiagnosticFactory protected constructor( } override fun toString(): String { - return name ?: "" + return _name ?: "" } companion object { @@ -45,4 +51,4 @@ abstract class DiagnosticFactory protected constructor( throw IllegalArgumentException("Factory mismatch: expected one of " + factories + " but was " + diagnostic.factory) } } -} \ No newline at end of file +} diff --git a/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/factories/DebugInfoDiagnosticFactory0.kt b/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/factories/DebugInfoDiagnosticFactory0.kt index 6bb1e03a087..bf25bf84035 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/factories/DebugInfoDiagnosticFactory0.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/factories/DebugInfoDiagnosticFactory0.kt @@ -34,9 +34,8 @@ class DebugInfoDiagnosticFactory0 private constructor( return DebugInfoDiagnostic(expression, this) } - override var name: String? + override val name: String get() = "DEBUG_INFO_$privateName" - set(_) {} companion object { val SMARTCAST = DebugInfoDiagnosticFactory0("SMARTCAST", Severity.INFO) @@ -51,4 +50,4 @@ class DebugInfoDiagnosticFactory0 private constructor( val MISSING_UNRESOLVED = DebugInfoDiagnosticFactory0("MISSING_UNRESOLVED") val DYNAMIC = DebugInfoDiagnosticFactory0("DYNAMIC", Severity.INFO) } -} \ No newline at end of file +} diff --git a/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/factories/DebugInfoDiagnosticFactory1.kt b/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/factories/DebugInfoDiagnosticFactory1.kt index cc043207e38..fd12864470e 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/factories/DebugInfoDiagnosticFactory1.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/factories/DebugInfoDiagnosticFactory1.kt @@ -21,9 +21,8 @@ class DebugInfoDiagnosticFactory1 : DiagnosticFactory1, DebugInfoDiagnosticFactory { private val privateName: String - override var name: String? + override val name: String get() = "DEBUG_INFO_$privateName" - set(_) {} override val withExplicitDefinitionOnly: Boolean @@ -85,4 +84,4 @@ class DebugInfoDiagnosticFactory1 : DiagnosticFactory1, return DebugInfoDiagnosticFactory1(name, severity, withExplicitDefinitionOnly) } } -} \ No newline at end of file +} diff --git a/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/factories/SyntaxErrorDiagnosticFactory.kt b/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/factories/SyntaxErrorDiagnosticFactory.kt index e547fd0ba12..b3db44beea7 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/factories/SyntaxErrorDiagnosticFactory.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/factories/SyntaxErrorDiagnosticFactory.kt @@ -10,9 +10,8 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticFactory import org.jetbrains.kotlin.diagnostics.Severity class SyntaxErrorDiagnosticFactory private constructor() : DiagnosticFactory(Severity.ERROR) { - override var name: String? + override val name: String get() = "SYNTAX" - set(_) {} companion object { val INSTANCE = SyntaxErrorDiagnosticFactory() diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index 592ac5f4f16..821a05c031e 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -1199,7 +1199,7 @@ public interface Errors { Object value = field.get(null); if (value instanceof DiagnosticFactory) { DiagnosticFactory factory = (DiagnosticFactory)value; - factory.setName(field.getName()); + factory.initializeName(field.getName()); factory.setDefaultRenderer((DiagnosticRenderer) diagnosticToRendererMap.get(factory)); } From 7fd96f5773ef9645447953bed301fa6b856fcd5d Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Thu, 26 Nov 2020 04:23:58 +0300 Subject: [PATCH 244/698] Fix annotation spelling in docs KT-43586 --- .../stdlib/jdk7/src/kotlin/io/path/ExperimentalPathApi.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/stdlib/jdk7/src/kotlin/io/path/ExperimentalPathApi.kt b/libraries/stdlib/jdk7/src/kotlin/io/path/ExperimentalPathApi.kt index 8425718e384..352a8409154 100644 --- a/libraries/stdlib/jdk7/src/kotlin/io/path/ExperimentalPathApi.kt +++ b/libraries/stdlib/jdk7/src/kotlin/io/path/ExperimentalPathApi.kt @@ -13,9 +13,9 @@ import kotlin.annotation.AnnotationTarget.* * > Beware using the annotated API especially if you're developing a library, since your library might become binary incompatible * with the future versions of the standard library. * - * Any usage of a declaration annotated with `@ExperimentalPathAPI` must be accepted either by - * annotating that usage with the [OptIn] annotation, e.g. `@OptIn(ExperimentalPathAPI::class)`, - * or by using the compiler argument `-Xopt-in=kotlin.io.path.ExperimentalPathAPI`. + * Any usage of a declaration annotated with `@ExperimentalPathApi` must be accepted either by + * annotating that usage with the [OptIn] annotation, e.g. `@OptIn(ExperimentalPathApi::class)`, + * or by using the compiler argument `-Xopt-in=kotlin.io.path.ExperimentalPathApi`. */ @RequiresOptIn(level = RequiresOptIn.Level.ERROR) @Retention(AnnotationRetention.BINARY) From 1dc897346ca86b078d39d5d12ad3b600ae8a2656 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 26 Nov 2020 11:39:09 +0300 Subject: [PATCH 245/698] [FIR] Fix WRONG_IMPLIES_CONDITION problem in DFA model --- .../resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/model.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/model.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/model.kt index 33167fad3e8..46c99d2abc9 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/model.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/model.kt @@ -261,7 +261,6 @@ infix fun RealVariable.typeNotEq(type: ConeKotlinType): TypeStatement = fun DataFlowVariable.isSynthetic(): Boolean { contract { returns(true) implies (this@isSynthetic is SyntheticVariable) - returns(false) implies (this@isSynthetic is RealVariable) } return this is SyntheticVariable } @@ -270,7 +269,6 @@ fun DataFlowVariable.isSynthetic(): Boolean { fun DataFlowVariable.isReal(): Boolean { contract { returns(true) implies (this@isReal is RealVariable) - returns(false) implies (this@isReal is SyntheticVariable) } return this is RealVariable } From 0a0b5b5d2be6cc9cd8a7fb348d499197b23b4930 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 26 Nov 2020 12:54:56 +0300 Subject: [PATCH 246/698] [FIR DFA] Don't consider anonymous object as stable initializer to bind #KT-43332 Fixed --- .../resolve/problems/questionableSmartCast.kt | 14 ++++++++++ .../problems/questionableSmartCast.txt | 26 +++++++++++++++++++ .../fir/FirDiagnosticsTestGenerated.java | 5 ++++ ...DiagnosticsWithLightTreeTestGenerated.java | 5 ++++ ...TouchedTilContractsPhaseTestGenerated.java | 5 ++++ .../kotlin/fir/resolve/dfa/VariableStorage.kt | 1 + .../reflection/typeOf/typeOfCapturedStar.kt | 1 - .../stateMachine/objectInsideLambdas.kt | 1 - 8 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 compiler/fir/analysis-tests/testData/resolve/problems/questionableSmartCast.kt create mode 100644 compiler/fir/analysis-tests/testData/resolve/problems/questionableSmartCast.txt diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/questionableSmartCast.kt b/compiler/fir/analysis-tests/testData/resolve/problems/questionableSmartCast.kt new file mode 100644 index 00000000000..86a490f3cb7 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolve/problems/questionableSmartCast.kt @@ -0,0 +1,14 @@ +interface A +interface B + +fun foo(x: A) {} +fun foo(x: B) {} + +open class C : A, B + +fun main(a: A) { + foo(a) + + val anonymousA: A = object : C() {} + foo(anonymousA) +} diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/questionableSmartCast.txt b/compiler/fir/analysis-tests/testData/resolve/problems/questionableSmartCast.txt new file mode 100644 index 00000000000..2cf6c0b9e47 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolve/problems/questionableSmartCast.txt @@ -0,0 +1,26 @@ +FILE: questionableSmartCast.kt + public abstract interface A : R|kotlin/Any| { + } + public abstract interface B : R|kotlin/Any| { + } + public final fun foo(x: R|A|): R|kotlin/Unit| { + } + public final fun foo(x: R|B|): R|kotlin/Unit| { + } + public open class C : R|A|, R|B| { + public constructor(): R|C| { + super() + } + + } + public final fun main(a: R|A|): R|kotlin/Unit| { + R|/foo|(R|/a|) + lval anonymousA: R|A| = object : R|C| { + private constructor(): R|| { + super() + } + + } + + R|/foo|(R|/anonymousA|) + } diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java index 87b998865de..23c8183147d 100644 --- a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java @@ -2074,6 +2074,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest { runTest("compiler/fir/analysis-tests/testData/resolve/problems/objectDerivedFromInnerClass.kt"); } + @TestMetadata("questionableSmartCast.kt") + public void testQuestionableSmartCast() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/problems/questionableSmartCast.kt"); + } + @TestMetadata("safeCallInvoke.kt") public void testSafeCallInvoke() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolve/problems/safeCallInvoke.kt"); diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java index c974f775714..59c78f4a0d2 100644 --- a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java @@ -2074,6 +2074,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos runTest("compiler/fir/analysis-tests/testData/resolve/problems/objectDerivedFromInnerClass.kt"); } + @TestMetadata("questionableSmartCast.kt") + public void testQuestionableSmartCast() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/problems/questionableSmartCast.kt"); + } + @TestMetadata("safeCallInvoke.kt") public void testSafeCallInvoke() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolve/problems/safeCallInvoke.kt"); diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java index 0e32f18e276..a3bc2533eec 100644 --- a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java +++ b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java @@ -2074,6 +2074,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract runTest("compiler/fir/analysis-tests/testData/resolve/problems/objectDerivedFromInnerClass.kt"); } + @TestMetadata("questionableSmartCast.kt") + public void testQuestionableSmartCast() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/problems/questionableSmartCast.kt"); + } + @TestMetadata("safeCallInvoke.kt") public void testSafeCallInvoke() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolve/problems/safeCallInvoke.kt"); diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/VariableStorage.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/VariableStorage.kt index ad3bb7a7adf..be162b7cc8a 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/VariableStorage.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/VariableStorage.kt @@ -145,6 +145,7 @@ class VariableStorage(private val session: FirSession) { returns(true) implies(this@isStable != null) } when (this) { + is FirAnonymousObjectSymbol -> return false is FirFunctionSymbol<*>, is FirClassSymbol<*>, is FirBackingFieldSymbol -> return true diff --git a/compiler/testData/codegen/box/reflection/typeOf/typeOfCapturedStar.kt b/compiler/testData/codegen/box/reflection/typeOf/typeOfCapturedStar.kt index 3213ed18905..ea4e80adbe9 100644 --- a/compiler/testData/codegen/box/reflection/typeOf/typeOfCapturedStar.kt +++ b/compiler/testData/codegen/box/reflection/typeOf/typeOfCapturedStar.kt @@ -1,6 +1,5 @@ // !USE_EXPERIMENTAL: kotlin.ExperimentalStdlibApi // !LANGUAGE: +NewInference -// IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JS, JS_IR // IGNORE_BACKEND: JS_IR_ES6 // WITH_REFLECT diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt index 642c5ccc0a9..7f7855a0873 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES From eba260f681316a834f51b8c103442dc2ff83e20c Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Wed, 25 Nov 2020 22:26:51 +0100 Subject: [PATCH 247/698] IC & Coroutines: Unbox inline classes of suspend lambdas inside 'invoke' if 'create' does not override 'create' from BaseContinuationImpl. In other words, when suspend lambda accepts more than one parameter (including receiver). Do that only if we do not generate bridge 'invoke' method, since inline classes are unboxed in the bridge. Use mangled name for 'create' function in this case inside 'invoke'. #KT-43249 In progress #KT-39847 Fixed #KT-38937 Fixed --- .../codegen/coroutines/CoroutineCodegen.kt | 20 +++++++++--- .../ir/FirBlackBoxCodegenTestGenerated.java | 15 +++++++++ .../inlineClasses/direct/createMangling.kt | 22 +++++++++++++ .../inlineClasses/resume/createMangling.kt | 29 +++++++++++++++++ .../resumeWithException/createMangling.kt | 31 +++++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 15 +++++++++ .../LightAnalysisModeTestGenerated.java | 15 +++++++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 15 +++++++++ .../IrJsCodegenBoxES6TestGenerated.java | 15 +++++++++ .../IrJsCodegenBoxTestGenerated.java | 15 +++++++++ .../semantics/JsCodegenBoxTestGenerated.java | 15 +++++++++ 11 files changed, 202 insertions(+), 5 deletions(-) create mode 100644 compiler/testData/codegen/box/coroutines/inlineClasses/direct/createMangling.kt create mode 100644 compiler/testData/codegen/box/coroutines/inlineClasses/resume/createMangling.kt create mode 100644 compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createMangling.kt diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineCodegen.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineCodegen.kt index d243e5a0cd6..2ea608b1525 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineCodegen.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineCodegen.kt @@ -294,7 +294,7 @@ class CoroutineCodegenForLambda private constructor( functionCodegen.generateMethod(JvmDeclarationOrigin.NO_ORIGIN, funDescriptor, object : FunctionGenerationStrategy.CodegenBased(state) { override fun doGenerateBody(codegen: ExpressionCodegen, signature: JvmMethodSignature) { - codegen.v.generateInvokeMethod(signature) + codegen.v.generateInvokeMethod(signature, funDescriptor) } }) } @@ -316,13 +316,13 @@ class CoroutineCodegenForLambda private constructor( ) mv.visitCode() with(InstructionAdapter(mv)) { - generateInvokeMethod(jvmMethodSignature) + generateInvokeMethod(jvmMethodSignature, untypedDescriptor) } FunctionCodegen.endVisit(mv, "invoke", element) } - private fun InstructionAdapter.generateInvokeMethod(signature: JvmMethodSignature) { + private fun InstructionAdapter.generateInvokeMethod(signature: JvmMethodSignature, descriptor: FunctionDescriptor) { // this load(0, AsmTypes.OBJECT_TYPE) val parameterTypes = signature.valueParameters.map { it.asmType } @@ -348,16 +348,23 @@ class CoroutineCodegenForLambda private constructor( load(arraySlot, AsmTypes.OBJECT_TYPE) } else { var index = 0 + val fromKotlinTypes = + if (!generateErasedCreate && doNotGenerateInvokeBridge) funDescriptor.allValueParameterTypes() + else funDescriptor.allValueParameterTypes().map { funDescriptor.module.builtIns.nullableAnyType } + val toKotlinTypes = + if (!generateErasedCreate && doNotGenerateInvokeBridge) createCoroutineDescriptor.allValueParameterTypes() + else descriptor.allValueParameterTypes() parameterTypes.withVariableIndices().forEach { (varIndex, type) -> load(varIndex + 1, type) - StackValue.coerce(type, createArgumentTypes[index++], this) + StackValue.coerce(type, fromKotlinTypes[index], createArgumentTypes[index], toKotlinTypes[index], this) + index++ } } // this.create(..) invokevirtual( v.thisName, - createCoroutineDescriptor.name.identifier, + typeMapper.mapFunctionName(createCoroutineDescriptor, null), Type.getMethodDescriptor( languageVersionSettings.continuationAsmType(), *createArgumentTypes.toTypedArray() @@ -831,3 +838,6 @@ private object FailingFunctionGenerationStrategy : FunctionGenerationStrategy() fun reportSuspensionPointInsideMonitor(element: KtElement, state: GenerationState, stackTraceElement: String) { state.diagnostics.report(ErrorsJvm.SUSPENSION_POINT_INSIDE_MONITOR.on(element, stackTraceElement)) } + +private fun FunctionDescriptor.allValueParameterTypes(): List = + (listOfNotNull(extensionReceiverParameter?.type)) + valueParameters.map { it.type } \ No newline at end of file diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 3336d040de2..b0a14b9487b 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -7743,6 +7743,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/covariantOverrideSuspendFun_Int.kt"); } + @TestMetadata("createMangling.kt") + public void testCreateMangling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/createMangling.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/genericOverrideSuspendFun.kt"); @@ -7960,6 +7965,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/covariantOverrideSuspendFun_Int.kt"); } + @TestMetadata("createMangling.kt") + public void testCreateMangling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/createMangling.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/genericOverrideSuspendFun.kt"); @@ -8172,6 +8182,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/covariantOverrideSuspendFun_Int.kt"); } + @TestMetadata("createMangling.kt") + public void testCreateMangling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createMangling.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/genericOverrideSuspendFun.kt"); diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/createMangling.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/createMangling.kt new file mode 100644 index 00000000000..8cea27daae1 --- /dev/null +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/createMangling.kt @@ -0,0 +1,22 @@ +// WITH_RUNTIME + +import kotlin.coroutines.* + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(Continuation(EmptyCoroutineContext) { + it.getOrThrow() + }) +} + +inline class IC(val s: String) + +fun box(): String { + var res = "FAIL" + val lambda: suspend (IC, IC) -> String = { a, b -> + a.s + b.s + } + builder { + res = lambda(IC("O"), IC("K")) + } + return res +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/createMangling.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/createMangling.kt new file mode 100644 index 00000000000..6f834f1428d --- /dev/null +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/createMangling.kt @@ -0,0 +1,29 @@ +// WITH_RUNTIME + +import kotlin.coroutines.* + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(Continuation(EmptyCoroutineContext) { + it.getOrThrow() + }) +} + +inline class IC(val s: String) + +var c: Continuation? = null + +var res = "FAIL" + +fun box(): String { + val lambda: suspend (IC, IC) -> String = { _, _ -> + suspendCoroutine { + @Suppress("UNCHECKED_CAST") + c = it as Continuation + } + } + builder { + res = lambda(IC("_"), IC("_")) + } + c?.resume("OK") + return res +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createMangling.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createMangling.kt new file mode 100644 index 00000000000..c0bffeb261a --- /dev/null +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createMangling.kt @@ -0,0 +1,31 @@ +// WITH_RUNTIME +// WITH_COROUTINES + +import kotlin.coroutines.* +import helpers.* + +var result = "FAIL" + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(handleExceptionContinuation { + result = it.message!! + }) +} + +inline class IC(val s: String) + +var c: Continuation? = null + +fun box(): String { + val lambda: suspend (IC, IC) -> String = { _, _ -> + suspendCoroutine { + @Suppress("UNCHECKED_CAST") + c = it as Continuation + } + } + builder { + lambda(IC("O"), IC("K")) + } + c?.resumeWithException(IllegalStateException("OK")) + return result +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 0b527485966..98d23a45728 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -8513,6 +8513,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/covariantOverrideSuspendFun_Int.kt"); } + @TestMetadata("createMangling.kt") + public void testCreateMangling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/createMangling.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/genericOverrideSuspendFun.kt"); @@ -8815,6 +8820,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/covariantOverrideSuspendFun_Int.kt"); } + @TestMetadata("createMangling.kt") + public void testCreateMangling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/createMangling.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/genericOverrideSuspendFun.kt"); @@ -9112,6 +9122,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/covariantOverrideSuspendFun_Int.kt"); } + @TestMetadata("createMangling.kt") + public void testCreateMangling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createMangling.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/genericOverrideSuspendFun.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index a3e551d817e..6b21bfce8cb 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -8513,6 +8513,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/covariantOverrideSuspendFun_Int.kt"); } + @TestMetadata("createMangling.kt") + public void testCreateMangling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/createMangling.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/genericOverrideSuspendFun.kt"); @@ -8815,6 +8820,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/covariantOverrideSuspendFun_Int.kt"); } + @TestMetadata("createMangling.kt") + public void testCreateMangling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/createMangling.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/genericOverrideSuspendFun.kt"); @@ -9112,6 +9122,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/covariantOverrideSuspendFun_Int.kt"); } + @TestMetadata("createMangling.kt") + public void testCreateMangling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createMangling.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/genericOverrideSuspendFun.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 01c6f247826..2b6a06cdfb6 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -7743,6 +7743,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/covariantOverrideSuspendFun_Int.kt"); } + @TestMetadata("createMangling.kt") + public void testCreateMangling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/createMangling.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/genericOverrideSuspendFun.kt"); @@ -7960,6 +7965,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/covariantOverrideSuspendFun_Int.kt"); } + @TestMetadata("createMangling.kt") + public void testCreateMangling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/createMangling.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/genericOverrideSuspendFun.kt"); @@ -8172,6 +8182,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/covariantOverrideSuspendFun_Int.kt"); } + @TestMetadata("createMangling.kt") + public void testCreateMangling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createMangling.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/genericOverrideSuspendFun.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index 29c99181d5e..9dffe31c97b 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -6498,6 +6498,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/covariantOverrideSuspendFun_Int.kt"); } + @TestMetadata("createMangling.kt") + public void testCreateMangling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/createMangling.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/genericOverrideSuspendFun.kt"); @@ -6715,6 +6720,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/covariantOverrideSuspendFun_Int.kt"); } + @TestMetadata("createMangling.kt") + public void testCreateMangling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/createMangling.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/genericOverrideSuspendFun.kt"); @@ -6927,6 +6937,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/covariantOverrideSuspendFun_Int.kt"); } + @TestMetadata("createMangling.kt") + public void testCreateMangling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createMangling.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/genericOverrideSuspendFun.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 3be1ff3e341..ee289d24964 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -6498,6 +6498,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/covariantOverrideSuspendFun_Int.kt"); } + @TestMetadata("createMangling.kt") + public void testCreateMangling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/createMangling.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/genericOverrideSuspendFun.kt"); @@ -6715,6 +6720,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/covariantOverrideSuspendFun_Int.kt"); } + @TestMetadata("createMangling.kt") + public void testCreateMangling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/createMangling.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/genericOverrideSuspendFun.kt"); @@ -6927,6 +6937,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/covariantOverrideSuspendFun_Int.kt"); } + @TestMetadata("createMangling.kt") + public void testCreateMangling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createMangling.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/genericOverrideSuspendFun.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index fef08948512..ca2776cef37 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -6498,6 +6498,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/covariantOverrideSuspendFun_Int.kt"); } + @TestMetadata("createMangling.kt") + public void testCreateMangling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/createMangling.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/genericOverrideSuspendFun.kt"); @@ -6715,6 +6720,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/covariantOverrideSuspendFun_Int.kt"); } + @TestMetadata("createMangling.kt") + public void testCreateMangling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/createMangling.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/genericOverrideSuspendFun.kt"); @@ -6927,6 +6937,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/covariantOverrideSuspendFun_Int.kt"); } + @TestMetadata("createMangling.kt") + public void testCreateMangling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createMangling.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/genericOverrideSuspendFun.kt"); From 4e334217a8eeaf5215b7f0cc4695895d87aaf71e Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Thu, 26 Nov 2020 03:48:44 +0100 Subject: [PATCH 248/698] IC & Coroutines: Unbox inline class parameter of suspend lambda inside 'create' if 'create' overrides 'create' from BaseContinuationImpl. In other words, unbox the parameter if 'create' accepts only one parameter. #KT-43249 Fixed #KT-43533 Fixed --- .../codegen/coroutines/CoroutineCodegen.kt | 25 +++++++++---- .../ir/FirBlackBoxCodegenTestGenerated.java | 15 ++++++++ .../inlineClasses/direct/createOverride.kt | 26 ++++++++++++++ .../inlineClasses/resume/createOverride.kt | 33 +++++++++++++++++ .../resumeWithException/createOverride.kt | 35 +++++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 15 ++++++++ .../LightAnalysisModeTestGenerated.java | 15 ++++++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 15 ++++++++ .../IrJsCodegenBoxES6TestGenerated.java | 15 ++++++++ .../IrJsCodegenBoxTestGenerated.java | 15 ++++++++ .../semantics/JsCodegenBoxTestGenerated.java | 15 ++++++++ 11 files changed, 218 insertions(+), 6 deletions(-) create mode 100644 compiler/testData/codegen/box/coroutines/inlineClasses/direct/createOverride.kt create mode 100644 compiler/testData/codegen/box/coroutines/inlineClasses/resume/createOverride.kt create mode 100644 compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createOverride.kt diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineCodegen.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineCodegen.kt index 2ea608b1525..800d3542bdd 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineCodegen.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineCodegen.kt @@ -35,6 +35,7 @@ import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns import org.jetbrains.kotlin.resolve.descriptorUtil.module +import org.jetbrains.kotlin.resolve.isInlineClassType import org.jetbrains.kotlin.resolve.jvm.AsmTypes import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin @@ -446,12 +447,24 @@ class CoroutineCodegenForLambda private constructor( ) } else { if (generateErasedCreate) { - load(index, AsmTypes.OBJECT_TYPE) - StackValue.coerce( - AsmTypes.OBJECT_TYPE, builtIns.nullableAnyType, - fieldInfoForCoroutineLambdaParameter.fieldType, fieldInfoForCoroutineLambdaParameter.fieldKotlinType, - this - ) + if (parameter.type.isInlineClassType()) { + load(cloneIndex, fieldInfoForCoroutineLambdaParameter.ownerType) + load(index, AsmTypes.OBJECT_TYPE) + StackValue.unboxInlineClass(AsmTypes.OBJECT_TYPE, parameter.type, this) + putfield( + fieldInfoForCoroutineLambdaParameter.ownerInternalName, + fieldInfoForCoroutineLambdaParameter.fieldName, + fieldInfoForCoroutineLambdaParameter.fieldType.descriptor + ) + continue + } else { + load(index, AsmTypes.OBJECT_TYPE) + StackValue.coerce( + AsmTypes.OBJECT_TYPE, builtIns.nullableAnyType, + fieldInfoForCoroutineLambdaParameter.fieldType, fieldInfoForCoroutineLambdaParameter.fieldKotlinType, + this + ) + } } else { load(index, fieldInfoForCoroutineLambdaParameter.fieldType) } diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index b0a14b9487b..377bd3a01ad 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -7748,6 +7748,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/createMangling.kt"); } + @TestMetadata("createOverride.kt") + public void testCreateOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/createOverride.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/genericOverrideSuspendFun.kt"); @@ -7970,6 +7975,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/createMangling.kt"); } + @TestMetadata("createOverride.kt") + public void testCreateOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/createOverride.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/genericOverrideSuspendFun.kt"); @@ -8187,6 +8197,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createMangling.kt"); } + @TestMetadata("createOverride.kt") + public void testCreateOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createOverride.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/genericOverrideSuspendFun.kt"); diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/createOverride.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/createOverride.kt new file mode 100644 index 00000000000..07a3d26b358 --- /dev/null +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/createOverride.kt @@ -0,0 +1,26 @@ +// WITH_RUNTIME +// KJS_WITH_FULL_RUNTIME + +import kotlin.coroutines.* + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(Continuation(EmptyCoroutineContext) { + it.getOrThrow() + }) +} + +inline class IC(val s: String) + +suspend fun List.onEach(c: suspend (T) -> Unit) { + for (e in this) { + c(e) + } +} + +fun box(): String { + var res = "" + builder { + listOf(IC("O"), IC("K")).onEach { res += it.s } + } + return res +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/createOverride.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/createOverride.kt new file mode 100644 index 00000000000..7324325a643 --- /dev/null +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/createOverride.kt @@ -0,0 +1,33 @@ +// WITH_RUNTIME +// KJS_WITH_FULL_RUNTIME + +import kotlin.coroutines.* + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(Continuation(EmptyCoroutineContext) { + it.getOrThrow() + }) +} + +inline class IC(val s: String) + +suspend fun List.onEach(c: suspend (T) -> Unit) { + for (e in this) { + c(e) + } +} + +var c: Continuation? = null + +fun box(): String { + var res = "" + builder { + listOf(IC("O"), IC("K")).onEach { res += suspendCoroutine { cont -> + @Suppress("UNCHECKED_CAST") + c = cont as Continuation + }} + } + c?.resume("O") + c?.resume("K") + return res +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createOverride.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createOverride.kt new file mode 100644 index 00000000000..268f26ea710 --- /dev/null +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createOverride.kt @@ -0,0 +1,35 @@ +// WITH_RUNTIME +// WITH_COROUTINES +// KJS_WITH_FULL_RUNTIME + +import kotlin.coroutines.* +import helpers.* + +var result = "FAIL" + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(handleExceptionContinuation { + result = it.message!! + }) +} + +inline class IC(val s: String) + +suspend fun List.onEach(c: suspend (T) -> Unit) { + for (e in this) { + c(e) + } +} + +var c: Continuation? = null + +fun box(): String { + builder { + listOf(IC("O"), IC("K")).onEach { suspendCoroutine { cont -> + @Suppress("UNCHECKED_CAST") + c = cont as Continuation + }} + } + c?.resumeWithException(IllegalStateException("OK")) + return result +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 98d23a45728..e2a78f11cdd 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -8518,6 +8518,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/createMangling.kt"); } + @TestMetadata("createOverride.kt") + public void testCreateOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/createOverride.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/genericOverrideSuspendFun.kt"); @@ -8825,6 +8830,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/createMangling.kt"); } + @TestMetadata("createOverride.kt") + public void testCreateOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/createOverride.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/genericOverrideSuspendFun.kt"); @@ -9127,6 +9137,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createMangling.kt"); } + @TestMetadata("createOverride.kt") + public void testCreateOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createOverride.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/genericOverrideSuspendFun.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 6b21bfce8cb..ac3160b8849 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -8518,6 +8518,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/createMangling.kt"); } + @TestMetadata("createOverride.kt") + public void testCreateOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/createOverride.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/genericOverrideSuspendFun.kt"); @@ -8825,6 +8830,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/createMangling.kt"); } + @TestMetadata("createOverride.kt") + public void testCreateOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/createOverride.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/genericOverrideSuspendFun.kt"); @@ -9127,6 +9137,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createMangling.kt"); } + @TestMetadata("createOverride.kt") + public void testCreateOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createOverride.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/genericOverrideSuspendFun.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 2b6a06cdfb6..ac46df24efa 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -7748,6 +7748,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/createMangling.kt"); } + @TestMetadata("createOverride.kt") + public void testCreateOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/createOverride.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/genericOverrideSuspendFun.kt"); @@ -7970,6 +7975,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/createMangling.kt"); } + @TestMetadata("createOverride.kt") + public void testCreateOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/createOverride.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/genericOverrideSuspendFun.kt"); @@ -8187,6 +8197,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createMangling.kt"); } + @TestMetadata("createOverride.kt") + public void testCreateOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createOverride.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/genericOverrideSuspendFun.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index 9dffe31c97b..23e823f35f0 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -6503,6 +6503,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/createMangling.kt"); } + @TestMetadata("createOverride.kt") + public void testCreateOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/createOverride.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/genericOverrideSuspendFun.kt"); @@ -6725,6 +6730,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/createMangling.kt"); } + @TestMetadata("createOverride.kt") + public void testCreateOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/createOverride.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/genericOverrideSuspendFun.kt"); @@ -6942,6 +6952,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createMangling.kt"); } + @TestMetadata("createOverride.kt") + public void testCreateOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createOverride.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/genericOverrideSuspendFun.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index ee289d24964..9b5a4e5cfd8 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -6503,6 +6503,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/createMangling.kt"); } + @TestMetadata("createOverride.kt") + public void testCreateOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/createOverride.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/genericOverrideSuspendFun.kt"); @@ -6725,6 +6730,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/createMangling.kt"); } + @TestMetadata("createOverride.kt") + public void testCreateOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/createOverride.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/genericOverrideSuspendFun.kt"); @@ -6942,6 +6952,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createMangling.kt"); } + @TestMetadata("createOverride.kt") + public void testCreateOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createOverride.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/genericOverrideSuspendFun.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index ca2776cef37..05d23e91356 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -6503,6 +6503,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/createMangling.kt"); } + @TestMetadata("createOverride.kt") + public void testCreateOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/createOverride.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/genericOverrideSuspendFun.kt"); @@ -6725,6 +6730,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/createMangling.kt"); } + @TestMetadata("createOverride.kt") + public void testCreateOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/createOverride.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/genericOverrideSuspendFun.kt"); @@ -6942,6 +6952,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createMangling.kt"); } + @TestMetadata("createOverride.kt") + public void testCreateOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/createOverride.kt"); + } + @TestMetadata("genericOverrideSuspendFun.kt") public void testGenericOverrideSuspendFun() throws Exception { runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/genericOverrideSuspendFun.kt"); From 9ed5b8f870e8c326d5312ed67f90681604b83420 Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Thu, 26 Nov 2020 06:38:31 +0100 Subject: [PATCH 249/698] IC & Coroutines: Do not box suspend operator fun invoke receiver if it is called using parens and not by calling 'invoke' method. Use underlying type when calling continuation constructor if suspend function is method inside inline class. #KT-43505 Fixed #KT-39437 Fixed --- .../kotlin/codegen/ExpressionCodegen.java | 19 ++--- .../SuspendFunctionGenerationStrategy.kt | 5 +- .../ir/FirBlackBoxCodegenTestGenerated.java | 15 ++++ .../inlineClasses/direct/invokeOperator.kt | 62 +++++++++++++++ .../inlineClasses/resume/invokeOperator.kt | 75 ++++++++++++++++++ .../resumeWithException/invokeOperator.kt | 78 +++++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 15 ++++ .../LightAnalysisModeTestGenerated.java | 15 ++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 15 ++++ .../IrJsCodegenBoxES6TestGenerated.java | 15 ++++ .../IrJsCodegenBoxTestGenerated.java | 15 ++++ .../semantics/JsCodegenBoxTestGenerated.java | 15 ++++ 12 files changed, 331 insertions(+), 13 deletions(-) create mode 100644 compiler/testData/codegen/box/coroutines/inlineClasses/direct/invokeOperator.kt create mode 100644 compiler/testData/codegen/box/coroutines/inlineClasses/resume/invokeOperator.kt create mode 100644 compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/invokeOperator.kt diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java index fc6b458a0ad..67323b5949b 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java @@ -375,22 +375,17 @@ public class ExpressionCodegen extends KtVisitor impleme FunctionDescriptor functionDescriptor = (FunctionDescriptor) descriptor; if (!functionDescriptor.isSuspend()) return stackValue; + // When we call suspend operator fun invoke using parens, we cannot box receiver as return type inline class + if (resolvedCall instanceof VariableAsFunctionResolvedCall && + functionDescriptor.isOperator() && functionDescriptor.getName().getIdentifier().equals("invoke") + ) return stackValue; + KotlinType unboxedInlineClass = CoroutineCodegenUtilKt .originalReturnTypeOfSuspendFunctionReturningUnboxedInlineClass(functionDescriptor, typeMapper); StackValue stackValueToWrap = stackValue; - KotlinType originalKotlinType; - if (unboxedInlineClass != null) { - originalKotlinType = unboxedInlineClass; - } else { - originalKotlinType = stackValueToWrap.kotlinType; - } - Type originalType; - if (unboxedInlineClass != null) { - originalType = typeMapper.mapType(unboxedInlineClass); - } else { - originalType = stackValueToWrap.type; - } + KotlinType originalKotlinType = unboxedInlineClass != null ? unboxedInlineClass : stackValueToWrap.kotlinType; + Type originalType = unboxedInlineClass != null ? typeMapper.mapType(unboxedInlineClass) : stackValueToWrap.type; stackValue = new StackValue(originalType, originalKotlinType) { @Override diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/SuspendFunctionGenerationStrategy.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/SuspendFunctionGenerationStrategy.kt index e3cc008b3ec..e1976f8ecfd 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/SuspendFunctionGenerationStrategy.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/SuspendFunctionGenerationStrategy.kt @@ -21,6 +21,7 @@ import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.psi.KtFunction import org.jetbrains.kotlin.psi.psiUtil.getElementTextWithContext import org.jetbrains.kotlin.resolve.inline.isEffectivelyInlineOnly +import org.jetbrains.kotlin.resolve.isInlineClass import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin import org.jetbrains.kotlin.resolve.jvm.diagnostics.OtherOrigin import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature @@ -92,7 +93,9 @@ class SuspendFunctionGenerationStrategy( sourceFile = declaration.containingKtFile.name, shouldPreserveClassInitialization = constructorCallNormalizationMode.shouldPreserveClassInitialization, needDispatchReceiver = originalSuspendDescriptor.dispatchReceiverParameter != null, - internalNameForDispatchReceiver = containingClassInternalNameOrNull(), + internalNameForDispatchReceiver = (originalSuspendDescriptor.containingDeclaration as? ClassDescriptor)?.let { + if (it.isInlineClass()) state.typeMapper.mapType(it).internalName else null + } ?: containingClassInternalNameOrNull(), languageVersionSettings = languageVersionSettings, disableTailCallOptimizationForFunctionReturningUnit = originalSuspendDescriptor.returnType?.isUnit() == true && originalSuspendDescriptor.overriddenDescriptors.isNotEmpty() && diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 377bd3a01ad..56275f3e074 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -7798,6 +7798,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); } + @TestMetadata("invokeOperator.kt") + public void testInvokeOperator() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/invokeOperator.kt"); + } + @TestMetadata("overrideSuspendFun.kt") public void testOverrideSuspendFun_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt", "kotlin.coroutines"); @@ -8025,6 +8030,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); } + @TestMetadata("invokeOperator.kt") + public void testInvokeOperator() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/invokeOperator.kt"); + } + @TestMetadata("overrideSuspendFun.kt") public void testOverrideSuspendFun_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt", "kotlin.coroutines"); @@ -8237,6 +8247,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); } + @TestMetadata("invokeOperator.kt") + public void testInvokeOperator() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/invokeOperator.kt"); + } + @TestMetadata("overrideSuspendFun.kt") public void testOverrideSuspendFun_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt", "kotlin.coroutines"); diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/invokeOperator.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/invokeOperator.kt new file mode 100644 index 00000000000..a46c4de0ff6 --- /dev/null +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/invokeOperator.kt @@ -0,0 +1,62 @@ +// WITH_RUNTIME + +import kotlin.coroutines.* + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(Continuation(EmptyCoroutineContext) { + it.getOrThrow() + }) +} + +inline class IC(val a: Any?) + +class GetResult { + suspend operator fun invoke() = IC("OK") +} + +inline class IC1(val a: String) { + suspend operator fun invoke() = IC(a) +} + +fun box(): String { + var res = "FAIL 1" + builder { + val getResult = GetResult() + res = getResult().a as String + } + if (res != "OK") return "FAIL 1 $res" + + res = "FAIL 2" + builder { + val getResult = GetResult() + res = getResult.invoke().a as String + } + if (res != "OK") return "FAIL 2 $res" + + res = "FAIL 3" + builder { + res = GetResult()().a as String + } + if (res != "OK") return "FAIL 3 $res" + + res = "FAIL 4" + builder { + val getResult = IC1("OK") + res = getResult().a as String + } + if (res != "OK") return "FAIL 4 $res" + + res = "FAIL 5" + builder { + val getResult = IC1("OK") + res = getResult.invoke().a as String + } + if (res != "OK") return "FAIL 5 $res" + + res = "FAIL 6" + builder { + res = IC1("OK")().a as String + } + if (res != "OK") return "FAIL 6 $res" + return res +} diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/invokeOperator.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/invokeOperator.kt new file mode 100644 index 00000000000..4bc91db863b --- /dev/null +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/invokeOperator.kt @@ -0,0 +1,75 @@ +// WITH_RUNTIME + +import kotlin.coroutines.* + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(Continuation(EmptyCoroutineContext) { + it.getOrThrow() + }) +} + +inline class IC(val a: Any?) + +var c: Continuation? = null + +suspend fun suspendMe(): T = suspendCoroutine { + @Suppress("UNCHECKED_CAST") + c = it as Continuation +} + +class GetResult { + suspend operator fun invoke(): IC = suspendMe() +} + +inline class IC1(val a: String) { + suspend operator fun invoke(): IC = suspendMe() +} + +fun box(): String { + var res = "FAIL 1" + builder { + val getResult = GetResult() + res = getResult().a as String + } + c?.resume(IC("OK")) + if (res != "OK") return "FAIL 1 $res" + + res = "FAIL 2" + builder { + val getResult = GetResult() + res = getResult.invoke().a as String + } + c?.resume(IC("OK")) + if (res != "OK") return "FAIL 2 $res" + + res = "FAIL 3" + builder { + res = GetResult()().a as String + } + c?.resume(IC("OK")) + if (res != "OK") return "FAIL 3 $res" + + res = "FAIL 4" + builder { + val getResult = IC1("OK") + res = getResult().a as String + } + c?.resume(IC("OK")) + if (res != "OK") return "FAIL 4 $res" + + res = "FAIL 5" + builder { + val getResult = IC1("OK") + res = getResult.invoke().a as String + } + c?.resume(IC("OK")) + if (res != "OK") return "FAIL 5 $res" + + res = "FAIL 6" + builder { + res = IC1("OK")().a as String + } + c?.resume(IC("OK")) + if (res != "OK") return "FAIL 6 $res" + return res +} diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/invokeOperator.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/invokeOperator.kt new file mode 100644 index 00000000000..85c933eacb1 --- /dev/null +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/invokeOperator.kt @@ -0,0 +1,78 @@ +// WITH_RUNTIME +// WITH_COROUTINES + +import kotlin.coroutines.* +import helpers.* + +var result = "FAIL" + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(handleExceptionContinuation { + result = it.message!! + }) +} + +inline class IC(val a: Any?) + +var c: Continuation? = null + +suspend fun suspendMe(): T = suspendCoroutine { + @Suppress("UNCHECKED_CAST") + c = it as Continuation +} + +class GetResult { + suspend operator fun invoke(): IC = suspendMe() +} + +inline class IC1(val a: String) { + suspend operator fun invoke(): IC = suspendMe() +} + +fun box(): String { + builder { + val getResult = GetResult() + getResult() + } + c?.resumeWithException(IllegalStateException("OK")) + if (result != "OK") return "FAIL 1 $result" + + result = "FAIL 2" + builder { + val getResult = GetResult() + getResult.invoke() + } + c?.resumeWithException(IllegalStateException("OK")) + if (result != "OK") return "FAIL 2 $result" + + result = "FAIL 3" + builder { + GetResult()() + } + c?.resumeWithException(IllegalStateException("OK")) + if (result != "OK") return "FAIL 3 $result" + + result = "FAIL 4" + builder { + val getResult = IC1("OK") + getResult() + } + c?.resumeWithException(IllegalStateException("OK")) + if (result != "OK") return "FAIL 4 $result" + + result = "FAIL 5" + builder { + val getResult = IC1("OK") + getResult.invoke() + } + c?.resumeWithException(IllegalStateException("OK")) + if (result != "OK") return "FAIL 5 $result" + + result = "FAIL 6" + builder { + IC1("OK")() + } + c?.resumeWithException(IllegalStateException("OK")) + if (result != "OK") return "FAIL 6 $result" + return result +} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index e2a78f11cdd..42f25c74327 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -8573,6 +8573,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); } + @TestMetadata("invokeOperator.kt") + public void testInvokeOperator() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/invokeOperator.kt"); + } + @TestMetadata("overrideSuspendFun.kt") public void testOverrideSuspendFun_1_2() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt", "kotlin.coroutines.experimental"); @@ -8885,6 +8890,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); } + @TestMetadata("invokeOperator.kt") + public void testInvokeOperator() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/invokeOperator.kt"); + } + @TestMetadata("overrideSuspendFun.kt") public void testOverrideSuspendFun_1_2() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt", "kotlin.coroutines.experimental"); @@ -9182,6 +9192,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); } + @TestMetadata("invokeOperator.kt") + public void testInvokeOperator() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/invokeOperator.kt"); + } + @TestMetadata("overrideSuspendFun.kt") public void testOverrideSuspendFun_1_2() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt", "kotlin.coroutines.experimental"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index ac3160b8849..4444e915f13 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -8573,6 +8573,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); } + @TestMetadata("invokeOperator.kt") + public void testInvokeOperator() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/invokeOperator.kt"); + } + @TestMetadata("overrideSuspendFun.kt") public void testOverrideSuspendFun_1_2() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt", "kotlin.coroutines.experimental"); @@ -8885,6 +8890,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); } + @TestMetadata("invokeOperator.kt") + public void testInvokeOperator() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/invokeOperator.kt"); + } + @TestMetadata("overrideSuspendFun.kt") public void testOverrideSuspendFun_1_2() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt", "kotlin.coroutines.experimental"); @@ -9182,6 +9192,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); } + @TestMetadata("invokeOperator.kt") + public void testInvokeOperator() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/invokeOperator.kt"); + } + @TestMetadata("overrideSuspendFun.kt") public void testOverrideSuspendFun_1_2() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt", "kotlin.coroutines.experimental"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index ac46df24efa..1e77305d909 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -7798,6 +7798,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); } + @TestMetadata("invokeOperator.kt") + public void testInvokeOperator() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/invokeOperator.kt"); + } + @TestMetadata("overrideSuspendFun.kt") public void testOverrideSuspendFun_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt", "kotlin.coroutines"); @@ -8025,6 +8030,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); } + @TestMetadata("invokeOperator.kt") + public void testInvokeOperator() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/invokeOperator.kt"); + } + @TestMetadata("overrideSuspendFun.kt") public void testOverrideSuspendFun_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt", "kotlin.coroutines"); @@ -8237,6 +8247,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); } + @TestMetadata("invokeOperator.kt") + public void testInvokeOperator() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/invokeOperator.kt"); + } + @TestMetadata("overrideSuspendFun.kt") public void testOverrideSuspendFun_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt", "kotlin.coroutines"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index 23e823f35f0..fc7bc2148a2 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -6553,6 +6553,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); } + @TestMetadata("invokeOperator.kt") + public void testInvokeOperator() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/invokeOperator.kt"); + } + @TestMetadata("overrideSuspendFun.kt") public void testOverrideSuspendFun_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt", "kotlin.coroutines"); @@ -6780,6 +6785,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); } + @TestMetadata("invokeOperator.kt") + public void testInvokeOperator() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/invokeOperator.kt"); + } + @TestMetadata("overrideSuspendFun.kt") public void testOverrideSuspendFun_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt", "kotlin.coroutines"); @@ -6992,6 +7002,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); } + @TestMetadata("invokeOperator.kt") + public void testInvokeOperator() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/invokeOperator.kt"); + } + @TestMetadata("overrideSuspendFun.kt") public void testOverrideSuspendFun_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt", "kotlin.coroutines"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 9b5a4e5cfd8..e5d615e4de6 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -6553,6 +6553,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); } + @TestMetadata("invokeOperator.kt") + public void testInvokeOperator() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/invokeOperator.kt"); + } + @TestMetadata("overrideSuspendFun.kt") public void testOverrideSuspendFun_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt", "kotlin.coroutines"); @@ -6780,6 +6785,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); } + @TestMetadata("invokeOperator.kt") + public void testInvokeOperator() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/invokeOperator.kt"); + } + @TestMetadata("overrideSuspendFun.kt") public void testOverrideSuspendFun_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt", "kotlin.coroutines"); @@ -6992,6 +7002,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); } + @TestMetadata("invokeOperator.kt") + public void testInvokeOperator() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/invokeOperator.kt"); + } + @TestMetadata("overrideSuspendFun.kt") public void testOverrideSuspendFun_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt", "kotlin.coroutines"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 05d23e91356..d9c97517bb6 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -6553,6 +6553,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); } + @TestMetadata("invokeOperator.kt") + public void testInvokeOperator() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/invokeOperator.kt"); + } + @TestMetadata("overrideSuspendFun.kt") public void testOverrideSuspendFun_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt", "kotlin.coroutines"); @@ -6780,6 +6785,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); } + @TestMetadata("invokeOperator.kt") + public void testInvokeOperator() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/invokeOperator.kt"); + } + @TestMetadata("overrideSuspendFun.kt") public void testOverrideSuspendFun_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt", "kotlin.coroutines"); @@ -6992,6 +7002,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); } + @TestMetadata("invokeOperator.kt") + public void testInvokeOperator() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/invokeOperator.kt"); + } + @TestMetadata("overrideSuspendFun.kt") public void testOverrideSuspendFun_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt", "kotlin.coroutines"); From b2b8562f9238d4356e92b62507ce812006dbbdf5 Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Wed, 25 Nov 2020 19:22:20 +0100 Subject: [PATCH 250/698] Properly extract JVM version in kapt #KT-41788 --- .../jetbrains/kotlin/kapt3/base/util/java9Utils.kt | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/util/java9Utils.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/util/java9Utils.kt index dd92a0caa57..cae184709e7 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/util/java9Utils.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/util/java9Utils.kt @@ -23,17 +23,11 @@ import com.sun.tools.javac.util.Options import com.sun.tools.javac.util.List as JavacList import org.jetbrains.kotlin.kapt3.base.plus -fun isJava9OrLater(): Boolean = !System.getProperty("java.version").startsWith("1.") -fun isJava11OrLater(): Boolean { - val majorVersion = System.getProperty("java.version").substringBefore(".") - if (majorVersion.isEmpty()) return false +private fun getJavaVersion(): Int = + System.getProperty("java.specification.version")?.substringAfter('.')?.toIntOrNull() ?: 6 - return try { - majorVersion.toInt() >= 11 - } catch (ignored: Throwable) { - false - } -} +fun isJava9OrLater() = getJavaVersion() >= 9 +fun isJava11OrLater() = getJavaVersion() >= 11 fun Options.putJavacOption(jdk8Name: String, jdk9Name: String, value: String) { val option = if (isJava9OrLater()) { From ee1e05fedd9b80a4524ae0d4117148012d40a41a Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Thu, 26 Nov 2020 15:05:41 +0300 Subject: [PATCH 251/698] KT-42151 fix type arguments in local class constructor reference types --- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 + .../kotlin/fir/Fir2IrTextTestGenerated.java | 5 + .../jvm/lower/FunctionReferenceLowering.kt | 7 +- .../ReflectionReferencesGenerator.kt | 6 +- .../ir/descriptors/IrBasedDescriptors.kt | 44 ++-- .../kotlin/ir/types/IrTypeSystemContext.kt | 12 +- .../org/jetbrains/kotlin/ir/types/irTypes.kt | 31 ++- .../org/jetbrains/kotlin/ir/util/IrUtils.kt | 11 +- .../genericConstructorReference.kt | 1 - .../genericLocalClassConstructorReference.kt | 25 +++ ...cLocalClassConstructorReference.fir.kt.txt | 64 ++++++ ...ericLocalClassConstructorReference.fir.txt | 192 ++++++++++++++++++ .../genericLocalClassConstructorReference.kt | 16 ++ ...nericLocalClassConstructorReference.kt.txt | 64 ++++++ .../genericLocalClassConstructorReference.txt | 192 ++++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 5 + .../LightAnalysisModeTestGenerated.java | 5 + .../ir/IrBlackBoxCodegenTestGenerated.java | 5 + .../kotlin/ir/IrTextTestCaseGenerated.java | 5 + .../IrJsCodegenBoxES6TestGenerated.java | 5 + .../IrJsCodegenBoxTestGenerated.java | 5 + .../semantics/JsCodegenBoxTestGenerated.java | 5 + 22 files changed, 678 insertions(+), 32 deletions(-) create mode 100644 compiler/testData/codegen/box/callableReference/genericLocalClassConstructorReference.kt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/genericLocalClassConstructorReference.fir.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/genericLocalClassConstructorReference.fir.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/genericLocalClassConstructorReference.kt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/genericLocalClassConstructorReference.kt.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/genericLocalClassConstructorReference.txt diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 56275f3e074..15c672656f4 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -2038,6 +2038,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/callableReference/genericConstructorReference.kt"); } + @TestMetadata("genericLocalClassConstructorReference.kt") + public void testGenericLocalClassConstructorReference() throws Exception { + runTest("compiler/testData/codegen/box/callableReference/genericLocalClassConstructorReference.kt"); + } + @TestMetadata("javaField.kt") public void testJavaField() throws Exception { runTest("compiler/testData/codegen/box/callableReference/javaField.kt"); diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java index a1714ba5c82..57d3bf7dd27 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java @@ -1499,6 +1499,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { runTest("compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt"); } + @TestMetadata("genericLocalClassConstructorReference.kt") + public void testGenericLocalClassConstructorReference() throws Exception { + runTest("compiler/testData/ir/irText/expressions/callableReferences/genericLocalClassConstructorReference.kt"); + } + @TestMetadata("genericMember.kt") public void testGenericMember() throws Exception { runTest("compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt"); diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionReferenceLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionReferenceLowering.kt index f955b4e0137..63a4d1bf247 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionReferenceLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionReferenceLowering.kt @@ -14,8 +14,8 @@ import org.jetbrains.kotlin.backend.jvm.JvmBackendContext import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin import org.jetbrains.kotlin.backend.jvm.ir.* import org.jetbrains.kotlin.backend.jvm.lower.inlineclasses.InlineClassAbi -import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.descriptors.DescriptorVisibilities +import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.builders.* import org.jetbrains.kotlin.ir.builders.declarations.* @@ -74,7 +74,10 @@ internal class FunctionReferenceLowering(private val context: JvmBackendContext) override fun visitFunctionReference(expression: IrFunctionReference): IrExpression { expression.transformChildrenVoid(this) - return if (expression.isIgnored) expression else FunctionReferenceBuilder(expression).build() + return if (expression.isIgnored) + expression + else + FunctionReferenceBuilder(expression).build() } // Handle SAM conversions which wrap a function reference: diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ReflectionReferencesGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ReflectionReferencesGenerator.kt index 0d23ea2183c..afb24766516 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ReflectionReferencesGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ReflectionReferencesGenerator.kt @@ -21,7 +21,6 @@ import org.jetbrains.kotlin.builtins.createFunctionType import org.jetbrains.kotlin.builtins.isKFunctionType import org.jetbrains.kotlin.builtins.isKSuspendFunctionType import org.jetbrains.kotlin.descriptors.* -import org.jetbrains.kotlin.ir.IrStatement import org.jetbrains.kotlin.ir.declarations.DescriptorMetadataSource import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction @@ -34,7 +33,9 @@ import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol import org.jetbrains.kotlin.ir.symbols.IrVariableSymbol -import org.jetbrains.kotlin.ir.util.* +import org.jetbrains.kotlin.ir.util.referenceClassifier +import org.jetbrains.kotlin.ir.util.referenceFunction +import org.jetbrains.kotlin.ir.util.withScope import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.endOffset @@ -46,7 +47,6 @@ import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue import org.jetbrains.kotlin.resolve.scopes.receivers.TransientReceiver import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.expressions.DoubleColonLHS -import org.jetbrains.kotlin.utils.SmartList class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : StatementGeneratorExtension(statementGenerator) { diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrBasedDescriptors.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrBasedDescriptors.kt index d2309d11fcf..c70f623de37 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrBasedDescriptors.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrBasedDescriptors.kt @@ -18,7 +18,6 @@ import org.jetbrains.kotlin.ir.declarations.lazy.IrLazyProperty import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol -import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol import org.jetbrains.kotlin.ir.types.* import org.jetbrains.kotlin.ir.util.* @@ -1078,18 +1077,37 @@ private fun makeKotlinType( classifier: IrClassifierSymbol, arguments: List, hasQuestionMark: Boolean -): SimpleType = when (classifier) { - is IrTypeParameterSymbol -> classifier.owner.toIrBasedDescriptor().defaultType - is IrClassSymbol -> { - val classDescriptor = classifier.owner.toIrBasedDescriptor() - val kotlinTypeArguments = arguments.mapIndexed { index, it -> - when (it) { - is IrTypeProjection -> TypeProjectionImpl(it.variance, it.type.toIrBasedKotlinType()) - is IrStarProjection -> StarProjectionImpl(classDescriptor.typeConstructor.parameters[index]) - else -> error(it) +): SimpleType = + when (classifier) { + is IrTypeParameterSymbol -> classifier.owner.toIrBasedDescriptor().defaultType + is IrClassSymbol -> { + val classDescriptor = classifier.owner.toIrBasedDescriptor() + val kotlinTypeArguments = arguments.mapIndexed { index, it -> + when (it) { + is IrTypeProjection -> TypeProjectionImpl(it.variance, it.type.toIrBasedKotlinType()) + is IrStarProjection -> StarProjectionImpl(classDescriptor.typeConstructor.parameters[index]) + else -> error(it) + } + } + + try { + classDescriptor.defaultType.replace(newArguments = kotlinTypeArguments).makeNullableAsSpecified(hasQuestionMark) + } catch (e: Throwable) { + throw RuntimeException( + "Classifier: $classDescriptor\n" + + "Type parameters:\n" + + classDescriptor.defaultType.constructor.parameters.withIndex() + .joinToString(separator = "\n") { + "${it.index}: ${(it.value as IrBasedTypeParameterDescriptor).owner.render()}" + } + + "\nType arguments:\n" + + arguments.withIndex() + .joinToString(separator = "\n") { + "${it.index}: ${it.value.render()}" + }, + e + ) } } - classDescriptor.defaultType.replace(newArguments = kotlinTypeArguments).makeNullableAsSpecified(hasQuestionMark) + else -> error("unknown classifier kind $classifier") } - else -> error("unknown classifier kind $classifier") -} diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/IrTypeSystemContext.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/IrTypeSystemContext.kt index 195dc7b234f..e9dd29d08ac 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/IrTypeSystemContext.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/IrTypeSystemContext.kt @@ -390,9 +390,9 @@ interface IrTypeSystemContext : TypeSystemContext, TypeSystemCommonSuperTypesCon } } -fun extractTypeParameters(klass: IrDeclarationParent): List { +fun extractTypeParameters(parent: IrDeclarationParent): List { val result = mutableListOf() - var current: IrDeclarationParent? = klass + var current: IrDeclarationParent? = parent while (current != null) { (current as? IrTypeParametersContainer)?.let { result += it.typeParameters } current = @@ -404,9 +404,11 @@ fun extractTypeParameters(klass: IrDeclarationParent): List { else -> null } is IrConstructor -> current.parent as IrClass - is IrFunction -> if (current.visibility == DescriptorVisibilities.LOCAL || current.dispatchReceiverParameter != null) { - current.parent - } else null + is IrFunction -> + if (current.visibility == DescriptorVisibilities.LOCAL || current.dispatchReceiverParameter != null) + current.parent + else + null else -> null } } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/irTypes.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/irTypes.kt index f7f14c8288d..148e8ad430b 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/irTypes.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/irTypes.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.ir.types import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI import org.jetbrains.kotlin.ir.declarations.IrClass +import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction import org.jetbrains.kotlin.ir.declarations.IrTypeParameter import org.jetbrains.kotlin.ir.declarations.IrTypeParametersContainer import org.jetbrains.kotlin.ir.expressions.IrConstructorCall @@ -16,6 +17,7 @@ import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol import org.jetbrains.kotlin.ir.types.impl.* import org.jetbrains.kotlin.ir.util.defaultType +import org.jetbrains.kotlin.ir.util.isPropertyAccessor import org.jetbrains.kotlin.types.* import org.jetbrains.kotlin.types.typeUtil.makeNotNullable import org.jetbrains.kotlin.types.typeUtil.makeNullable @@ -155,13 +157,28 @@ val IrClassSymbol.starProjectedType: IrSimpleType ) val IrClass.typeConstructorParameters: Sequence - get() = generateSequence(this as IrTypeParametersContainer, - { current -> - val parent = current.parent as? IrTypeParametersContainer - if (parent is IrClass && current is IrClass && !current.isInner) null - else parent - }) - .flatMap { it.typeParameters } + get() = + generateSequence( + this as IrTypeParametersContainer, + { current -> + val parent = current.parent as? IrTypeParametersContainer + when { + parent is IrSimpleFunction && parent.isPropertyAccessor -> { + // KT-42151 + // Property type parameters for local classes declared inside property accessors are not captured in FE descriptors. + // In order to match type parameters against type arguments in IR types translated from KotlinTypes, + // we should stop on property accessor here. + // NB this can potentially cause problems with inline properties with reified type parameters. + // Ideally this should be fixed in FE. + null + } + parent is IrClass && current is IrClass && !current.isInner -> + null + else -> + parent + } + } + ).flatMap { it.typeParameters } fun IrClassifierSymbol.typeWithParameters(parameters: List): IrSimpleType = typeWith(parameters.map { it.defaultType }) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/IrUtils.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/IrUtils.kt index 2f8ba09729c..2d65573733f 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/IrUtils.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/IrUtils.kt @@ -526,7 +526,16 @@ fun IrMemberAccessExpression<*>.getTypeSubstitutionMap(irFunction: IrFunction): val result = mutableMapOf() if (dispatchReceiverTypeArguments.isNotEmpty()) { - val parentTypeParameters = extractTypeParameters(irFunction.parentClassOrNull!!) + val parentTypeParameters = + if (irFunction is IrConstructor) { + val constructedClass = irFunction.parentAsClass + if (!constructedClass.isInner && dispatchReceiver != null) { + throw AssertionError("Non-inner class constructor reference with dispatch receiver:\n${this.dump()}") + } + extractTypeParameters(constructedClass.parent as IrClass) + } else { + extractTypeParameters(irFunction.parentClassOrNull!!) + } parentTypeParameters.withIndex().forEach { (index, typeParam) -> dispatchReceiverTypeArguments[index].typeOrNull?.let { result[typeParam.symbol] = it diff --git a/compiler/testData/codegen/box/callableReference/genericConstructorReference.kt b/compiler/testData/codegen/box/callableReference/genericConstructorReference.kt index 982b28b4c68..3b3b633a62e 100644 --- a/compiler/testData/codegen/box/callableReference/genericConstructorReference.kt +++ b/compiler/testData/codegen/box/callableReference/genericConstructorReference.kt @@ -1,7 +1,6 @@ // DONT_TARGET_EXACT_BACKEND: WASM // WASM_MUTE_REASON: BINDING_RECEIVERS -// IGNORE_BACKEND: JVM_IR // IGNORE_BACKEND_FIR: JVM_IR // KT-42025 diff --git a/compiler/testData/codegen/box/callableReference/genericLocalClassConstructorReference.kt b/compiler/testData/codegen/box/callableReference/genericLocalClassConstructorReference.kt new file mode 100644 index 00000000000..0311bf04fca --- /dev/null +++ b/compiler/testData/codegen/box/callableReference/genericLocalClassConstructorReference.kt @@ -0,0 +1,25 @@ +// DONT_TARGET_EXACT_BACKEND: WASM +// WASM_MUTE_REASON: BINDING_RECEIVERS + +// IGNORE_BACKEND_FIR: JVM_IR +// KT-42025 + +open class L(val ll: LL) + +class Rec(val rt: T) + +fun Rec.fn(): L { + class FLocal(lt: LT, val pt: FT): L(lt) + return foo2(rt, rt, ::FLocal) +} + +val Rec.p: L + get() { + class PLocal(lt: LT, val pt: PT): L(lt) + return foo2(rt, rt, ::PLocal) + } + +fun foo2(t1: T1, t2: T2, bb: (T1, T2) -> R): R = bb(t1, t2) + +fun box(): String = + Rec("O").fn().ll + Rec("K").p.ll \ No newline at end of file diff --git a/compiler/testData/ir/irText/expressions/callableReferences/genericLocalClassConstructorReference.fir.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/genericLocalClassConstructorReference.fir.kt.txt new file mode 100644 index 00000000000..d454c6a0216 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/genericLocalClassConstructorReference.fir.kt.txt @@ -0,0 +1,64 @@ +open class L { + constructor(ll: LL) /* primary */ { + super/*Any*/() + /* () */ + + } + + val ll: LL + field = ll + get + +} + +class Rec { + constructor(rt: T) /* primary */ { + super/*Any*/() + /* () */ + + } + + val rt: T + field = rt + get + +} + +val Rec.p: L + get(): L { + local class PLocal : L { + constructor(lt: LT, pt: PT) /* primary */ { + super/*L*/(ll = lt) + /* () */ + + } + + val pt: PT + field = pt + get + + } + + return foo2>(t1 = .(), t2 = .(), bb = PLocal::/*()*/) + } + +fun Rec.fn(): L { + local class FLocal : L { + constructor(lt: LT, pt: FT) /* primary */ { + super/*L*/(ll = lt) + /* () */ + + } + + val pt: FT + field = pt + get + + } + + return foo2>(t1 = .(), t2 = .(), bb = FLocal::/*()*/) +} + +fun foo2(t1: T1, t2: T2, bb: Function2): R { + return bb.invoke(p1 = t1, p2 = t2) +} diff --git a/compiler/testData/ir/irText/expressions/callableReferences/genericLocalClassConstructorReference.fir.txt b/compiler/testData/ir/irText/expressions/callableReferences/genericLocalClassConstructorReference.fir.txt new file mode 100644 index 00000000000..446c9cdb584 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/genericLocalClassConstructorReference.fir.txt @@ -0,0 +1,192 @@ +FILE fqName: fileName:/genericLocalClassConstructorReference.kt + CLASS CLASS name:L modality:OPEN visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.L.L> + TYPE_PARAMETER name:LL index:0 variance: superTypes:[kotlin.Any?] + CONSTRUCTOR visibility:public <> (ll:LL of .L) returnType:.L.L> [primary] + VALUE_PARAMETER name:ll index:0 type:LL of .L + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:L modality:OPEN visibility:public superTypes:[kotlin.Any]' + PROPERTY name:ll visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:ll type:LL of .L visibility:private [final] + EXPRESSION_BODY + GET_VAR 'll: LL of .L declared in .L.' type=LL of .L origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.L.L>) returnType:LL of .L + correspondingProperty: PROPERTY name:ll visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.L.L> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): LL of .L declared in .L' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:ll type:LL of .L visibility:private [final]' type=LL of .L origin=null + receiver: GET_VAR ': .L.L> declared in .L.' type=.L.L> origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:Rec modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Rec.Rec> + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] + CONSTRUCTOR visibility:public <> (rt:T of .Rec) returnType:.Rec.Rec> [primary] + VALUE_PARAMETER name:rt index:0 type:T of .Rec + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Rec modality:FINAL visibility:public superTypes:[kotlin.Any]' + PROPERTY name:rt visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:rt type:T of .Rec visibility:private [final] + EXPRESSION_BODY + GET_VAR 'rt: T of .Rec declared in .Rec.' type=T of .Rec origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Rec.Rec>) returnType:T of .Rec + correspondingProperty: PROPERTY name:rt visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Rec.Rec> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): T of .Rec declared in .Rec' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:rt type:T of .Rec visibility:private [final]' type=T of .Rec origin=null + receiver: GET_VAR ': .Rec.Rec> declared in .Rec.' type=.Rec.Rec> origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + PROPERTY name:p visibility:public modality:FINAL [val] + FUN name: visibility:public modality:FINAL ($receiver:.Rec.>) returnType:.L.> + correspondingProperty: PROPERTY name:p visibility:public modality:FINAL [val] + TYPE_PARAMETER name:PT index:0 variance: superTypes:[kotlin.Any?] + $receiver: VALUE_PARAMETER name: type:.Rec.> + BLOCK_BODY + CLASS CLASS name:PLocal modality:FINAL visibility:local superTypes:[.L..PLocal>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:..PLocal..PLocal> + TYPE_PARAMETER name:LT index:0 variance: superTypes:[kotlin.Any?] + CONSTRUCTOR visibility:public <> (lt:LT of ..PLocal, pt:PT of .) returnType:..PLocal..PLocal> [primary] + VALUE_PARAMETER name:lt index:0 type:LT of ..PLocal + VALUE_PARAMETER name:pt index:1 type:PT of . + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (ll: LL of .L) [primary] declared in .L' + : LT of ..PLocal + ll: GET_VAR 'lt: LT of ..PLocal declared in ..PLocal.' type=LT of ..PLocal origin=null + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:PLocal modality:FINAL visibility:local superTypes:[.L..PLocal>]' + PROPERTY name:pt visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:pt type:PT of . visibility:private [final] + EXPRESSION_BODY + GET_VAR 'pt: PT of . declared in ..PLocal.' type=PT of . origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:..PLocal..PLocal>) returnType:PT of . + correspondingProperty: PROPERTY name:pt visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:..PLocal..PLocal> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): PT of . declared in ..PLocal' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:pt type:PT of . visibility:private [final]' type=PT of . origin=null + receiver: GET_VAR ': ..PLocal..PLocal> declared in ..PLocal.' type=..PLocal..PLocal> origin=null + PROPERTY FAKE_OVERRIDE name:ll visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.L.L>) returnType:LT of ..PLocal [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:ll visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): LL of .L declared in .L + $this: VALUE_PARAMETER name: type:.L.L> + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + RETURN type=kotlin.Nothing from='public final fun (): .L.> declared in ' + CALL 'public final fun foo2 (t1: T1 of .foo2, t2: T2 of .foo2, bb: kotlin.Function2.foo2, T2 of .foo2, R of .foo2>): R of .foo2 declared in ' type=..PLocal.> origin=null + : PT of . + : PT of . + : ..PLocal.> + t1: CALL 'public final fun (): T of .Rec declared in .Rec' type=PT of . origin=GET_PROPERTY + $this: GET_VAR ': .Rec.> declared in .' type=.Rec.> origin=null + t2: CALL 'public final fun (): T of .Rec declared in .Rec' type=PT of . origin=GET_PROPERTY + $this: GET_VAR ': .Rec.> declared in .' type=.Rec.> origin=null + bb: FUNCTION_REFERENCE 'public constructor (lt: LT of ..PLocal, pt: PT of .) [primary] declared in ..PLocal' type=kotlin.reflect.KFunction2., PT of ., ..PLocal.>> origin=null reflectionTarget= + : PT of . + FUN name:fn visibility:public modality:FINAL ($receiver:.Rec.fn>) returnType:.L.fn> + TYPE_PARAMETER name:FT index:0 variance: superTypes:[kotlin.Any?] + $receiver: VALUE_PARAMETER name: type:.Rec.fn> + BLOCK_BODY + CLASS CLASS name:FLocal modality:FINAL visibility:local superTypes:[.L.fn.FLocal>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.fn.FLocal.fn.FLocal> + TYPE_PARAMETER name:LT index:0 variance: superTypes:[kotlin.Any?] + CONSTRUCTOR visibility:public <> (lt:LT of .fn.FLocal, pt:FT of .fn) returnType:.fn.FLocal.fn.FLocal> [primary] + VALUE_PARAMETER name:lt index:0 type:LT of .fn.FLocal + VALUE_PARAMETER name:pt index:1 type:FT of .fn + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (ll: LL of .L) [primary] declared in .L' + : LT of .fn.FLocal + ll: GET_VAR 'lt: LT of .fn.FLocal declared in .fn.FLocal.' type=LT of .fn.FLocal origin=null + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FLocal modality:FINAL visibility:local superTypes:[.L.fn.FLocal>]' + PROPERTY name:pt visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:pt type:FT of .fn visibility:private [final] + EXPRESSION_BODY + GET_VAR 'pt: FT of .fn declared in .fn.FLocal.' type=FT of .fn origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.fn.FLocal.fn.FLocal>) returnType:FT of .fn + correspondingProperty: PROPERTY name:pt visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.fn.FLocal.fn.FLocal> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): FT of .fn declared in .fn.FLocal' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:pt type:FT of .fn visibility:private [final]' type=FT of .fn origin=null + receiver: GET_VAR ': .fn.FLocal.fn.FLocal> declared in .fn.FLocal.' type=.fn.FLocal.fn.FLocal> origin=null + PROPERTY FAKE_OVERRIDE name:ll visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.L.L>) returnType:LT of .fn.FLocal [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:ll visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): LL of .L declared in .L + $this: VALUE_PARAMETER name: type:.L.L> + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + RETURN type=kotlin.Nothing from='public final fun fn (): .L.fn> declared in ' + CALL 'public final fun foo2 (t1: T1 of .foo2, t2: T2 of .foo2, bb: kotlin.Function2.foo2, T2 of .foo2, R of .foo2>): R of .foo2 declared in ' type=.fn.FLocal.fn> origin=null + : FT of .fn + : FT of .fn + : .fn.FLocal.fn> + t1: CALL 'public final fun (): T of .Rec declared in .Rec' type=FT of .fn origin=GET_PROPERTY + $this: GET_VAR ': .Rec.fn> declared in .fn' type=.Rec.fn> origin=null + t2: CALL 'public final fun (): T of .Rec declared in .Rec' type=FT of .fn origin=GET_PROPERTY + $this: GET_VAR ': .Rec.fn> declared in .fn' type=.Rec.fn> origin=null + bb: FUNCTION_REFERENCE 'public constructor (lt: LT of .fn.FLocal, pt: FT of .fn) [primary] declared in .fn.FLocal' type=kotlin.reflect.KFunction2.fn, FT of .fn, .fn.FLocal.fn>> origin=null reflectionTarget= + : FT of .fn + FUN name:foo2 visibility:public modality:FINAL (t1:T1 of .foo2, t2:T2 of .foo2, bb:kotlin.Function2.foo2, T2 of .foo2, R of .foo2>) returnType:R of .foo2 + TYPE_PARAMETER name:T1 index:0 variance: superTypes:[kotlin.Any?] + TYPE_PARAMETER name:T2 index:1 variance: superTypes:[kotlin.Any?] + TYPE_PARAMETER name:R index:2 variance: superTypes:[kotlin.Any?] + VALUE_PARAMETER name:t1 index:0 type:T1 of .foo2 + VALUE_PARAMETER name:t2 index:1 type:T2 of .foo2 + VALUE_PARAMETER name:bb index:2 type:kotlin.Function2.foo2, T2 of .foo2, R of .foo2> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun foo2 (t1: T1 of .foo2, t2: T2 of .foo2, bb: kotlin.Function2.foo2, T2 of .foo2, R of .foo2>): R of .foo2 declared in ' + CALL 'public abstract fun invoke (p1: P1 of kotlin.Function2, p2: P2 of kotlin.Function2): R of kotlin.Function2 [operator] declared in kotlin.Function2' type=R of .foo2 origin=INVOKE + $this: GET_VAR 'bb: kotlin.Function2.foo2, T2 of .foo2, R of .foo2> declared in .foo2' type=kotlin.Function2.foo2, T2 of .foo2, R of .foo2> origin=VARIABLE_AS_FUNCTION + p1: GET_VAR 't1: T1 of .foo2 declared in .foo2' type=T1 of .foo2 origin=null + p2: GET_VAR 't2: T2 of .foo2 declared in .foo2' type=T2 of .foo2 origin=null diff --git a/compiler/testData/ir/irText/expressions/callableReferences/genericLocalClassConstructorReference.kt b/compiler/testData/ir/irText/expressions/callableReferences/genericLocalClassConstructorReference.kt new file mode 100644 index 00000000000..d76e23d033a --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/genericLocalClassConstructorReference.kt @@ -0,0 +1,16 @@ +open class L(val ll: LL) + +class Rec(val rt: T) + +val Rec.p: L + get() { + class PLocal(lt: LT, val pt: PT): L(lt) + return foo2(rt, rt, ::PLocal) + } + +fun Rec.fn(): L { + class FLocal(lt: LT, val pt: FT) : L(lt) + return foo2(rt, rt, ::FLocal) +} + +fun foo2(t1: T1, t2: T2, bb: (T1, T2) -> R): R = bb(t1, t2) \ No newline at end of file diff --git a/compiler/testData/ir/irText/expressions/callableReferences/genericLocalClassConstructorReference.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/genericLocalClassConstructorReference.kt.txt new file mode 100644 index 00000000000..1411fda426f --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/genericLocalClassConstructorReference.kt.txt @@ -0,0 +1,64 @@ +open class L { + constructor(ll: LL) /* primary */ { + super/*Any*/() + /* () */ + + } + + val ll: LL + field = ll + get + +} + +class Rec { + constructor(rt: T) /* primary */ { + super/*Any*/() + /* () */ + + } + + val rt: T + field = rt + get + +} + +val Rec.p: L + get(): L { + local class PLocal : L { + constructor(lt: LT, pt: PT) /* primary */ { + super/*L*/(ll = lt) + /* () */ + + } + + val pt: PT + field = pt + get + + } + + return foo2>(t1 = .(), t2 = .(), bb = PLocal::/*()*/) + } + +fun Rec.fn(): L { + local class FLocal : L { + constructor(lt: LT, pt: FT) /* primary */ { + super/*L*/(ll = lt) + /* () */ + + } + + val pt: FT + field = pt + get + + } + + return foo2>(t1 = .(), t2 = .(), bb = FLocal::/*()*/) +} + +fun foo2(t1: T1, t2: T2, bb: Function2): R { + return bb.invoke(p1 = t1, p2 = t2) +} diff --git a/compiler/testData/ir/irText/expressions/callableReferences/genericLocalClassConstructorReference.txt b/compiler/testData/ir/irText/expressions/callableReferences/genericLocalClassConstructorReference.txt new file mode 100644 index 00000000000..0a22b28a06f --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/genericLocalClassConstructorReference.txt @@ -0,0 +1,192 @@ +FILE fqName: fileName:/genericLocalClassConstructorReference.kt + CLASS CLASS name:L modality:OPEN visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.L.L> + TYPE_PARAMETER name:LL index:0 variance: superTypes:[kotlin.Any?] + CONSTRUCTOR visibility:public <> (ll:LL of .L) returnType:.L.L> [primary] + VALUE_PARAMETER name:ll index:0 type:LL of .L + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:L modality:OPEN visibility:public superTypes:[kotlin.Any]' + PROPERTY name:ll visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:ll type:LL of .L visibility:private [final] + EXPRESSION_BODY + GET_VAR 'll: LL of .L declared in .L.' type=LL of .L origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.L.L>) returnType:LL of .L + correspondingProperty: PROPERTY name:ll visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.L.L> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): LL of .L declared in .L' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:ll type:LL of .L visibility:private [final]' type=LL of .L origin=null + receiver: GET_VAR ': .L.L> declared in .L.' type=.L.L> origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:Rec modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Rec.Rec> + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] + CONSTRUCTOR visibility:public <> (rt:T of .Rec) returnType:.Rec.Rec> [primary] + VALUE_PARAMETER name:rt index:0 type:T of .Rec + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Rec modality:FINAL visibility:public superTypes:[kotlin.Any]' + PROPERTY name:rt visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:rt type:T of .Rec visibility:private [final] + EXPRESSION_BODY + GET_VAR 'rt: T of .Rec declared in .Rec.' type=T of .Rec origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Rec.Rec>) returnType:T of .Rec + correspondingProperty: PROPERTY name:rt visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Rec.Rec> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): T of .Rec declared in .Rec' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:rt type:T of .Rec visibility:private [final]' type=T of .Rec origin=null + receiver: GET_VAR ': .Rec.Rec> declared in .Rec.' type=.Rec.Rec> origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + PROPERTY name:p visibility:public modality:FINAL [val] + FUN name: visibility:public modality:FINAL ($receiver:.Rec.>) returnType:.L.> + correspondingProperty: PROPERTY name:p visibility:public modality:FINAL [val] + TYPE_PARAMETER name:PT index:0 variance: superTypes:[kotlin.Any?] + $receiver: VALUE_PARAMETER name: type:.Rec.> + BLOCK_BODY + CLASS CLASS name:PLocal modality:FINAL visibility:local superTypes:[.L..PLocal>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:..PLocal..PLocal> + TYPE_PARAMETER name:LT index:0 variance: superTypes:[kotlin.Any?] + CONSTRUCTOR visibility:public <> (lt:LT of ..PLocal, pt:PT of .) returnType:..PLocal..PLocal> [primary] + VALUE_PARAMETER name:lt index:0 type:LT of ..PLocal + VALUE_PARAMETER name:pt index:1 type:PT of . + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (ll: LL of .L) [primary] declared in .L' + : LT of ..PLocal + ll: GET_VAR 'lt: LT of ..PLocal declared in ..PLocal.' type=LT of ..PLocal origin=null + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:PLocal modality:FINAL visibility:local superTypes:[.L..PLocal>]' + PROPERTY name:pt visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:pt type:PT of . visibility:private [final] + EXPRESSION_BODY + GET_VAR 'pt: PT of . declared in ..PLocal.' type=PT of . origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:..PLocal..PLocal>) returnType:PT of . + correspondingProperty: PROPERTY name:pt visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:..PLocal..PLocal> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): PT of . declared in ..PLocal' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:pt type:PT of . visibility:private [final]' type=PT of . origin=null + receiver: GET_VAR ': ..PLocal..PLocal> declared in ..PLocal.' type=..PLocal..PLocal> origin=null + PROPERTY FAKE_OVERRIDE name:ll visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.L..PLocal>) returnType:LT of ..PLocal [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:ll visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): LL of .L declared in .L + $this: VALUE_PARAMETER name: type:.L..PLocal> + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .L + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in .L + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in .L + $this: VALUE_PARAMETER name: type:kotlin.Any + RETURN type=kotlin.Nothing from='public final fun (): .L.> declared in ' + CALL 'public final fun foo2 (t1: T1 of .foo2, t2: T2 of .foo2, bb: kotlin.Function2.foo2, T2 of .foo2, R of .foo2>): R of .foo2 declared in ' type=..PLocal.> origin=null + : PT of . + : PT of . + : ..PLocal.> + t1: CALL 'public final fun (): T of .Rec declared in .Rec' type=PT of . origin=GET_PROPERTY + $this: GET_VAR ': .Rec.> declared in .' type=.Rec.> origin=null + t2: CALL 'public final fun (): T of .Rec declared in .Rec' type=PT of . origin=GET_PROPERTY + $this: GET_VAR ': .Rec.> declared in .' type=.Rec.> origin=null + bb: FUNCTION_REFERENCE 'public constructor (lt: LT of ..PLocal, pt: PT of .) [primary] declared in ..PLocal' type=kotlin.reflect.KFunction2., PT of ., ..PLocal.>> origin=null reflectionTarget= + : PT of . + FUN name:fn visibility:public modality:FINAL ($receiver:.Rec.fn>) returnType:.L.fn> + TYPE_PARAMETER name:FT index:0 variance: superTypes:[kotlin.Any?] + $receiver: VALUE_PARAMETER name: type:.Rec.fn> + BLOCK_BODY + CLASS CLASS name:FLocal modality:FINAL visibility:local superTypes:[.L.fn.FLocal>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.fn.FLocal.fn.FLocal, FT of .fn> + TYPE_PARAMETER name:LT index:0 variance: superTypes:[kotlin.Any?] + CONSTRUCTOR visibility:public <> (lt:LT of .fn.FLocal, pt:FT of .fn) returnType:.fn.FLocal.fn.FLocal, FT of .fn> [primary] + VALUE_PARAMETER name:lt index:0 type:LT of .fn.FLocal + VALUE_PARAMETER name:pt index:1 type:FT of .fn + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (ll: LL of .L) [primary] declared in .L' + : LT of .fn.FLocal + ll: GET_VAR 'lt: LT of .fn.FLocal declared in .fn.FLocal.' type=LT of .fn.FLocal origin=null + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FLocal modality:FINAL visibility:local superTypes:[.L.fn.FLocal>]' + PROPERTY name:pt visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:pt type:FT of .fn visibility:private [final] + EXPRESSION_BODY + GET_VAR 'pt: FT of .fn declared in .fn.FLocal.' type=FT of .fn origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.fn.FLocal.fn.FLocal, FT of .fn>) returnType:FT of .fn + correspondingProperty: PROPERTY name:pt visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.fn.FLocal.fn.FLocal, FT of .fn> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): FT of .fn declared in .fn.FLocal' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:pt type:FT of .fn visibility:private [final]' type=FT of .fn origin=null + receiver: GET_VAR ': .fn.FLocal.fn.FLocal, FT of .fn> declared in .fn.FLocal.' type=.fn.FLocal.fn.FLocal, FT of .fn> origin=null + PROPERTY FAKE_OVERRIDE name:ll visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.L.fn.FLocal>) returnType:LT of .fn.FLocal [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:ll visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): LL of .L declared in .L + $this: VALUE_PARAMETER name: type:.L.fn.FLocal> + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .L + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in .L + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in .L + $this: VALUE_PARAMETER name: type:kotlin.Any + RETURN type=kotlin.Nothing from='public final fun fn (): .L.fn> declared in ' + CALL 'public final fun foo2 (t1: T1 of .foo2, t2: T2 of .foo2, bb: kotlin.Function2.foo2, T2 of .foo2, R of .foo2>): R of .foo2 declared in ' type=.fn.FLocal.fn, FT of .fn> origin=null + : FT of .fn + : FT of .fn + : .fn.FLocal.fn, FT of .fn> + t1: CALL 'public final fun (): T of .Rec declared in .Rec' type=FT of .fn origin=GET_PROPERTY + $this: GET_VAR ': .Rec.fn> declared in .fn' type=.Rec.fn> origin=null + t2: CALL 'public final fun (): T of .Rec declared in .Rec' type=FT of .fn origin=GET_PROPERTY + $this: GET_VAR ': .Rec.fn> declared in .fn' type=.Rec.fn> origin=null + bb: FUNCTION_REFERENCE 'public constructor (lt: LT of .fn.FLocal, pt: FT of .fn) [primary] declared in .fn.FLocal' type=kotlin.reflect.KFunction2.fn, FT of .fn, .fn.FLocal.fn, FT of .fn>> origin=null reflectionTarget= + : FT of .fn + FUN name:foo2 visibility:public modality:FINAL (t1:T1 of .foo2, t2:T2 of .foo2, bb:kotlin.Function2.foo2, T2 of .foo2, R of .foo2>) returnType:R of .foo2 + TYPE_PARAMETER name:T1 index:0 variance: superTypes:[kotlin.Any?] + TYPE_PARAMETER name:T2 index:1 variance: superTypes:[kotlin.Any?] + TYPE_PARAMETER name:R index:2 variance: superTypes:[kotlin.Any?] + VALUE_PARAMETER name:t1 index:0 type:T1 of .foo2 + VALUE_PARAMETER name:t2 index:1 type:T2 of .foo2 + VALUE_PARAMETER name:bb index:2 type:kotlin.Function2.foo2, T2 of .foo2, R of .foo2> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun foo2 (t1: T1 of .foo2, t2: T2 of .foo2, bb: kotlin.Function2.foo2, T2 of .foo2, R of .foo2>): R of .foo2 declared in ' + CALL 'public abstract fun invoke (p1: P1 of kotlin.Function2, p2: P2 of kotlin.Function2): R of kotlin.Function2 [operator] declared in kotlin.Function2' type=R of .foo2 origin=INVOKE + $this: GET_VAR 'bb: kotlin.Function2.foo2, T2 of .foo2, R of .foo2> declared in .foo2' type=kotlin.Function2.foo2, T2 of .foo2, R of .foo2> origin=VARIABLE_AS_FUNCTION + p1: GET_VAR 't1: T1 of .foo2 declared in .foo2' type=T1 of .foo2 origin=null + p2: GET_VAR 't2: T2 of .foo2 declared in .foo2' type=T2 of .foo2 origin=null diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 42f25c74327..7efe75445da 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -2058,6 +2058,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/callableReference/genericConstructorReference.kt"); } + @TestMetadata("genericLocalClassConstructorReference.kt") + public void testGenericLocalClassConstructorReference() throws Exception { + runTest("compiler/testData/codegen/box/callableReference/genericLocalClassConstructorReference.kt"); + } + @TestMetadata("javaField.kt") public void testJavaField() throws Exception { runTest("compiler/testData/codegen/box/callableReference/javaField.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 4444e915f13..c2f808a05e0 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -2058,6 +2058,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/callableReference/genericConstructorReference.kt"); } + @TestMetadata("genericLocalClassConstructorReference.kt") + public void testGenericLocalClassConstructorReference() throws Exception { + runTest("compiler/testData/codegen/box/callableReference/genericLocalClassConstructorReference.kt"); + } + @TestMetadata("javaField.kt") public void testJavaField() throws Exception { runTest("compiler/testData/codegen/box/callableReference/javaField.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 1e77305d909..f0d1879aff3 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -2038,6 +2038,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/callableReference/genericConstructorReference.kt"); } + @TestMetadata("genericLocalClassConstructorReference.kt") + public void testGenericLocalClassConstructorReference() throws Exception { + runTest("compiler/testData/codegen/box/callableReference/genericLocalClassConstructorReference.kt"); + } + @TestMetadata("javaField.kt") public void testJavaField() throws Exception { runTest("compiler/testData/codegen/box/callableReference/javaField.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index 3a4d521ad53..637604c5043 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -1498,6 +1498,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { runTest("compiler/testData/ir/irText/expressions/callableReferences/funWithDefaultParametersAsKCallableStar.kt"); } + @TestMetadata("genericLocalClassConstructorReference.kt") + public void testGenericLocalClassConstructorReference() throws Exception { + runTest("compiler/testData/ir/irText/expressions/callableReferences/genericLocalClassConstructorReference.kt"); + } + @TestMetadata("genericMember.kt") public void testGenericMember() throws Exception { runTest("compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index fc7bc2148a2..07e72051ebe 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -1468,6 +1468,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/callableReference/genericConstructorReference.kt"); } + @TestMetadata("genericLocalClassConstructorReference.kt") + public void testGenericLocalClassConstructorReference() throws Exception { + runTest("compiler/testData/codegen/box/callableReference/genericLocalClassConstructorReference.kt"); + } + @TestMetadata("kt37604.kt") public void testKt37604() throws Exception { runTest("compiler/testData/codegen/box/callableReference/kt37604.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index e5d615e4de6..96c6229aec8 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -1468,6 +1468,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/callableReference/genericConstructorReference.kt"); } + @TestMetadata("genericLocalClassConstructorReference.kt") + public void testGenericLocalClassConstructorReference() throws Exception { + runTest("compiler/testData/codegen/box/callableReference/genericLocalClassConstructorReference.kt"); + } + @TestMetadata("kt37604.kt") public void testKt37604() throws Exception { runTest("compiler/testData/codegen/box/callableReference/kt37604.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index d9c97517bb6..77ac1fe9313 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -1468,6 +1468,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/callableReference/genericConstructorReference.kt"); } + @TestMetadata("genericLocalClassConstructorReference.kt") + public void testGenericLocalClassConstructorReference() throws Exception { + runTest("compiler/testData/codegen/box/callableReference/genericLocalClassConstructorReference.kt"); + } + @TestMetadata("kt37604.kt") public void testKt37604() throws Exception { runTest("compiler/testData/codegen/box/callableReference/kt37604.kt"); From 6381d97aabd30e989e8f9bce450e9bd6e4070eee Mon Sep 17 00:00:00 2001 From: Georgy Bronnikov Date: Thu, 26 Nov 2020 13:32:50 +0300 Subject: [PATCH 252/698] JVM_IR: compute classId on IR structures --- .../codegen/inlineClassesCodegenUtil.kt | 4 ++++ .../backend/jvm/codegen/irCodegenUtils.kt | 19 +++++++++++++------ .../hiddenConstructor/kt28855.kt | 1 - .../codegen/box/ranges/forInUntil/kt42533.kt | 1 - .../ranges/unsigned/inMixedUnsignedRange.kt | 1 - .../codegen/box/ranges/unsigned/kt35004.kt | 1 - .../progressionExpression.kt | 1 - .../nullableLoopParameter/rangeExpression.kt | 1 - .../nullableLoopParameter/rangeLiteral.kt | 1 - .../unsigned/outOfBoundsInMixedContains.kt | 1 - .../checkBasicUnsignedLiterals.kt | 1 - .../box/unsignedTypes/forInUnsignedDownTo.kt | 1 - .../unsignedTypes/forInUnsignedProgression.kt | 1 - .../box/unsignedTypes/forInUnsignedRange.kt | 1 - .../forInUnsignedRangeLiteral.kt | 1 - .../forInUnsignedRangeWithCoercion.kt | 1 - .../box/unsignedTypes/forInUnsignedUntil.kt | 1 - .../box/unsignedTypes/inUnsignedDownTo.kt | 1 - .../box/unsignedTypes/inUnsignedRange.kt | 1 - .../unsignedTypes/inUnsignedRangeLiteral.kt | 1 - .../box/unsignedTypes/inUnsignedUntil.kt | 1 - .../iterateOverArrayOfUnsignedValues.kt | 1 - .../iterateOverListOfBoxedUnsignedValues.kt | 1 - .../codegen/box/unsignedTypes/kt25784.kt | 1 - .../codegen/box/unsignedTypes/kt43286a.kt | 1 - .../box/unsignedTypes/unsignedIntDivide.kt | 1 - .../box/unsignedTypes/unsignedIntRemainder.kt | 1 - .../box/unsignedTypes/unsignedLongDivide.kt | 1 - .../unsignedTypes/unsignedLongRemainder.kt | 1 - ...unsignedTypeValuesInsideStringTemplates.kt | 1 - .../unsignedTypes/varargsOfUnsignedTypes.kt | 1 - .../unsignedTypes/unsignedIntDivide_jvm18.kt | 1 - .../unsignedIntRemainder_jvm18.kt | 1 - .../unsignedTypes/unsignedLongDivide_jvm18.kt | 1 - .../unsignedLongRemainder_jvm18.kt | 1 - .../inlineClassesOldMangling.kt | 1 - 36 files changed, 17 insertions(+), 40 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/inlineClassesCodegenUtil.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/inlineClassesCodegenUtil.kt index bb3a5ddb850..64945f6bdb5 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/inlineClassesCodegenUtil.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/inlineClassesCodegenUtil.kt @@ -56,6 +56,10 @@ fun classFileContainsMethod(descriptor: FunctionDescriptor, state: GenerationSta } } + return classFileContainsMethod(classId, state, method) +} + +fun classFileContainsMethod(classId: ClassId, state: GenerationState, method: Method): Boolean? { val bytes = VirtualFileFinder.getInstance(state.project, state.module).findVirtualFileWithHeader(classId) ?.contentsToByteArray() ?: return null var found = false diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt index 7ce12403cc1..bda2089bc5c 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt @@ -21,10 +21,7 @@ import org.jetbrains.kotlin.codegen.SourceInfo import org.jetbrains.kotlin.codegen.classFileContainsMethod import org.jetbrains.kotlin.codegen.inline.SourceMapper import org.jetbrains.kotlin.codegen.signature.BothSignatureWriter -import org.jetbrains.kotlin.descriptors.ClassKind -import org.jetbrains.kotlin.descriptors.DeclarationDescriptorWithSource -import org.jetbrains.kotlin.descriptors.DescriptorVisibilities -import org.jetbrains.kotlin.descriptors.Modality +import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression @@ -36,6 +33,8 @@ import org.jetbrains.kotlin.ir.types.getClass import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.load.java.JavaDescriptorVisibilities import org.jetbrains.kotlin.load.java.JvmAbi +import org.jetbrains.kotlin.load.kotlin.JvmPackagePartSource +import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.resolve.checkers.ExpectedActualDeclarationChecker import org.jetbrains.kotlin.resolve.inline.INLINE_ONLY_ANNOTATION_FQ_NAME @@ -379,12 +378,20 @@ val IrMemberAccessExpression<*>.psiElement: PsiElement? fun IrSimpleType.isRawType(): Boolean = hasAnnotation(JvmGeneratorExtensions.RAW_TYPE_ANNOTATION_FQ_NAME) -@OptIn(ObsoleteDescriptorBasedAPI::class) internal fun classFileContainsMethod(function: IrFunction, context: JvmBackendContext, name: String): Boolean? { + val classId = (function.parent as? IrClass)?.classId ?: (function.containerSource as? JvmPackagePartSource)?.classId ?: return null val originalDescriptor = context.methodSignatureMapper.mapSignatureWithGeneric(function).asmMethod.descriptor val descriptor = if (function.isSuspend) listOf(*Type.getArgumentTypes(originalDescriptor), Type.getObjectType("kotlin/coroutines/Continuation")) .joinToString(prefix = "(", postfix = ")", separator = "") + AsmTypes.OBJECT_TYPE else originalDescriptor - return classFileContainsMethod(function.descriptor, context.state, Method(name, descriptor)) + return classFileContainsMethod(classId, context.state, Method(name, descriptor)) } + +// Translated into IR-based terms from classifierDescriptor?.classId +val IrClass.classId: ClassId? + get() = when (val parent = parent) { + is IrExternalPackageFragment -> ClassId(parent.fqName, name) + is IrClass -> parent.classId?.createNestedClassId(name) + else -> null + } diff --git a/compiler/testData/codegen/box/inlineClasses/hiddenConstructor/kt28855.kt b/compiler/testData/codegen/box/inlineClasses/hiddenConstructor/kt28855.kt index e4a455fc25f..fcb0e09e436 100644 --- a/compiler/testData/codegen/box/inlineClasses/hiddenConstructor/kt28855.kt +++ b/compiler/testData/codegen/box/inlineClasses/hiddenConstructor/kt28855.kt @@ -3,7 +3,6 @@ // !LANGUAGE: +InlineClasses // WITH_RUNTIME // KJS_WITH_FULL_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR class C(val x: T, vararg ys: UInt) { val y0 = ys[0] diff --git a/compiler/testData/codegen/box/ranges/forInUntil/kt42533.kt b/compiler/testData/codegen/box/ranges/forInUntil/kt42533.kt index a30811ac523..dd0029787d2 100644 --- a/compiler/testData/codegen/box/ranges/forInUntil/kt42533.kt +++ b/compiler/testData/codegen/box/ranges/forInUntil/kt42533.kt @@ -1,7 +1,6 @@ // IGNORE_BACKEND: JVM // WITH_RUNTIME // KJS_WITH_FULL_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR fun box(): String { // These should all be empty progressions diff --git a/compiler/testData/codegen/box/ranges/unsigned/inMixedUnsignedRange.kt b/compiler/testData/codegen/box/ranges/unsigned/inMixedUnsignedRange.kt index b23d54112ce..132819b96ae 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/inMixedUnsignedRange.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/inMixedUnsignedRange.kt @@ -1,6 +1,5 @@ // WITH_RUNTIME // KJS_WITH_FULL_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR fun ub_ub(x: UByte, a: UByte, b: UByte) = x in a..b fun ub_us(x: UByte, a: UShort, b: UShort) = x in a..b diff --git a/compiler/testData/codegen/box/ranges/unsigned/kt35004.kt b/compiler/testData/codegen/box/ranges/unsigned/kt35004.kt index ecee127b474..d8e6459244d 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/kt35004.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/kt35004.kt @@ -1,6 +1,5 @@ // WITH_RUNTIME // KJS_WITH_FULL_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR fun ULong.foobar() = when (this) { diff --git a/compiler/testData/codegen/box/ranges/unsigned/nullableLoopParameter/progressionExpression.kt b/compiler/testData/codegen/box/ranges/unsigned/nullableLoopParameter/progressionExpression.kt index 4a9d45bb045..e6be182814b 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/nullableLoopParameter/progressionExpression.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/nullableLoopParameter/progressionExpression.kt @@ -3,7 +3,6 @@ // IGNORE_LIGHT_ANALYSIS // WITH_RUNTIME // KJS_WITH_FULL_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR fun box(): String { var result = 0u diff --git a/compiler/testData/codegen/box/ranges/unsigned/nullableLoopParameter/rangeExpression.kt b/compiler/testData/codegen/box/ranges/unsigned/nullableLoopParameter/rangeExpression.kt index 720130b8084..bef0270964f 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/nullableLoopParameter/rangeExpression.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/nullableLoopParameter/rangeExpression.kt @@ -3,7 +3,6 @@ // IGNORE_LIGHT_ANALYSIS // WITH_RUNTIME // KJS_WITH_FULL_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR fun box(): String { var result = 0u diff --git a/compiler/testData/codegen/box/ranges/unsigned/nullableLoopParameter/rangeLiteral.kt b/compiler/testData/codegen/box/ranges/unsigned/nullableLoopParameter/rangeLiteral.kt index 850050f8e40..f1646d783e0 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/nullableLoopParameter/rangeLiteral.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/nullableLoopParameter/rangeLiteral.kt @@ -3,7 +3,6 @@ // IGNORE_LIGHT_ANALYSIS // WITH_RUNTIME // KJS_WITH_FULL_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR fun box(): String { var result = 0u diff --git a/compiler/testData/codegen/box/ranges/unsigned/outOfBoundsInMixedContains.kt b/compiler/testData/codegen/box/ranges/unsigned/outOfBoundsInMixedContains.kt index ef200ef7e00..99830393053 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/outOfBoundsInMixedContains.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/outOfBoundsInMixedContains.kt @@ -1,6 +1,5 @@ // WITH_RUNTIME // KJS_WITH_FULL_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR fun testIn(x: ULong) = x in UInt.MIN_VALUE..UInt.MAX_VALUE diff --git a/compiler/testData/codegen/box/unsignedTypes/checkBasicUnsignedLiterals.kt b/compiler/testData/codegen/box/unsignedTypes/checkBasicUnsignedLiterals.kt index b6f577af500..0950cc04632 100644 --- a/compiler/testData/codegen/box/unsignedTypes/checkBasicUnsignedLiterals.kt +++ b/compiler/testData/codegen/box/unsignedTypes/checkBasicUnsignedLiterals.kt @@ -1,6 +1,5 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR fun box(): String { val good = 42.toUInt() diff --git a/compiler/testData/codegen/box/unsignedTypes/forInUnsignedDownTo.kt b/compiler/testData/codegen/box/unsignedTypes/forInUnsignedDownTo.kt index 9bfd25fba24..3ecb162d576 100644 --- a/compiler/testData/codegen/box/unsignedTypes/forInUnsignedDownTo.kt +++ b/compiler/testData/codegen/box/unsignedTypes/forInUnsignedDownTo.kt @@ -2,7 +2,6 @@ // WASM_MUTE_REASON: STDLIB_COLLECTIONS // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR const val MaxUI = UInt.MAX_VALUE const val MinUI = UInt.MIN_VALUE diff --git a/compiler/testData/codegen/box/unsignedTypes/forInUnsignedProgression.kt b/compiler/testData/codegen/box/unsignedTypes/forInUnsignedProgression.kt index 7e19fe5610b..92035351c45 100644 --- a/compiler/testData/codegen/box/unsignedTypes/forInUnsignedProgression.kt +++ b/compiler/testData/codegen/box/unsignedTypes/forInUnsignedProgression.kt @@ -2,7 +2,6 @@ // WASM_MUTE_REASON: STDLIB_COLLECTIONS // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR const val MaxUI = UInt.MAX_VALUE const val MinUI = UInt.MIN_VALUE diff --git a/compiler/testData/codegen/box/unsignedTypes/forInUnsignedRange.kt b/compiler/testData/codegen/box/unsignedTypes/forInUnsignedRange.kt index 7884c066cce..7a88f58a014 100644 --- a/compiler/testData/codegen/box/unsignedTypes/forInUnsignedRange.kt +++ b/compiler/testData/codegen/box/unsignedTypes/forInUnsignedRange.kt @@ -2,7 +2,6 @@ // WASM_MUTE_REASON: STDLIB_COLLECTIONS // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR const val MaxUI = UInt.MAX_VALUE const val MinUI = UInt.MIN_VALUE diff --git a/compiler/testData/codegen/box/unsignedTypes/forInUnsignedRangeLiteral.kt b/compiler/testData/codegen/box/unsignedTypes/forInUnsignedRangeLiteral.kt index 828605c752d..aaefd703764 100644 --- a/compiler/testData/codegen/box/unsignedTypes/forInUnsignedRangeLiteral.kt +++ b/compiler/testData/codegen/box/unsignedTypes/forInUnsignedRangeLiteral.kt @@ -2,7 +2,6 @@ // WASM_MUTE_REASON: STDLIB_COLLECTIONS // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR const val MaxUI = UInt.MAX_VALUE const val MinUI = UInt.MIN_VALUE diff --git a/compiler/testData/codegen/box/unsignedTypes/forInUnsignedRangeWithCoercion.kt b/compiler/testData/codegen/box/unsignedTypes/forInUnsignedRangeWithCoercion.kt index d18f1b00de4..86ef6034e61 100644 --- a/compiler/testData/codegen/box/unsignedTypes/forInUnsignedRangeWithCoercion.kt +++ b/compiler/testData/codegen/box/unsignedTypes/forInUnsignedRangeWithCoercion.kt @@ -1,6 +1,5 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR val UB_MAX = UByte.MAX_VALUE val UB_START = (UB_MAX - 10u).toUByte() diff --git a/compiler/testData/codegen/box/unsignedTypes/forInUnsignedUntil.kt b/compiler/testData/codegen/box/unsignedTypes/forInUnsignedUntil.kt index 10c81177a1a..8468e31d528 100644 --- a/compiler/testData/codegen/box/unsignedTypes/forInUnsignedUntil.kt +++ b/compiler/testData/codegen/box/unsignedTypes/forInUnsignedUntil.kt @@ -2,7 +2,6 @@ // WASM_MUTE_REASON: STDLIB_COLLECTIONS // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR const val MaxUI = UInt.MAX_VALUE const val MinUI = UInt.MIN_VALUE diff --git a/compiler/testData/codegen/box/unsignedTypes/inUnsignedDownTo.kt b/compiler/testData/codegen/box/unsignedTypes/inUnsignedDownTo.kt index 8d3a75a8a1b..c87972db022 100644 --- a/compiler/testData/codegen/box/unsignedTypes/inUnsignedDownTo.kt +++ b/compiler/testData/codegen/box/unsignedTypes/inUnsignedDownTo.kt @@ -2,7 +2,6 @@ // WASM_MUTE_REASON: STDLIB_COLLECTIONS // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR const val MaxUI = UInt.MAX_VALUE const val MinUI = UInt.MIN_VALUE diff --git a/compiler/testData/codegen/box/unsignedTypes/inUnsignedRange.kt b/compiler/testData/codegen/box/unsignedTypes/inUnsignedRange.kt index 9ebf6e83f73..f87d766e4fa 100644 --- a/compiler/testData/codegen/box/unsignedTypes/inUnsignedRange.kt +++ b/compiler/testData/codegen/box/unsignedTypes/inUnsignedRange.kt @@ -1,6 +1,5 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR const val MaxUI = UInt.MAX_VALUE const val MinUI = UInt.MIN_VALUE diff --git a/compiler/testData/codegen/box/unsignedTypes/inUnsignedRangeLiteral.kt b/compiler/testData/codegen/box/unsignedTypes/inUnsignedRangeLiteral.kt index 47cdcd81f87..5b0cc5eab28 100644 --- a/compiler/testData/codegen/box/unsignedTypes/inUnsignedRangeLiteral.kt +++ b/compiler/testData/codegen/box/unsignedTypes/inUnsignedRangeLiteral.kt @@ -1,6 +1,5 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR const val MaxUI = UInt.MAX_VALUE const val MinUI = UInt.MIN_VALUE diff --git a/compiler/testData/codegen/box/unsignedTypes/inUnsignedUntil.kt b/compiler/testData/codegen/box/unsignedTypes/inUnsignedUntil.kt index c1eda749a21..df040cb2512 100644 --- a/compiler/testData/codegen/box/unsignedTypes/inUnsignedUntil.kt +++ b/compiler/testData/codegen/box/unsignedTypes/inUnsignedUntil.kt @@ -1,6 +1,5 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR const val MaxUI = UInt.MAX_VALUE const val MinUI = UInt.MIN_VALUE diff --git a/compiler/testData/codegen/box/unsignedTypes/iterateOverArrayOfUnsignedValues.kt b/compiler/testData/codegen/box/unsignedTypes/iterateOverArrayOfUnsignedValues.kt index 52aa896b8a3..75c87d38f30 100644 --- a/compiler/testData/codegen/box/unsignedTypes/iterateOverArrayOfUnsignedValues.kt +++ b/compiler/testData/codegen/box/unsignedTypes/iterateOverArrayOfUnsignedValues.kt @@ -2,7 +2,6 @@ // WASM_MUTE_REASON: UNSIGNED_ARRAYS // WITH_RUNTIME // KJS_WITH_FULL_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR fun box(): String { var sum = 0u diff --git a/compiler/testData/codegen/box/unsignedTypes/iterateOverListOfBoxedUnsignedValues.kt b/compiler/testData/codegen/box/unsignedTypes/iterateOverListOfBoxedUnsignedValues.kt index 0aaf9aa8006..fdd7ee8188a 100644 --- a/compiler/testData/codegen/box/unsignedTypes/iterateOverListOfBoxedUnsignedValues.kt +++ b/compiler/testData/codegen/box/unsignedTypes/iterateOverListOfBoxedUnsignedValues.kt @@ -1,6 +1,5 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR fun box(): String { var sum = 0u diff --git a/compiler/testData/codegen/box/unsignedTypes/kt25784.kt b/compiler/testData/codegen/box/unsignedTypes/kt25784.kt index 2fd166341e2..e7dc0265f04 100644 --- a/compiler/testData/codegen/box/unsignedTypes/kt25784.kt +++ b/compiler/testData/codegen/box/unsignedTypes/kt25784.kt @@ -2,7 +2,6 @@ // WASM_MUTE_REASON: PROPERTY_REFERENCES // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR import kotlin.reflect.KProperty import kotlin.reflect.KProperty0 diff --git a/compiler/testData/codegen/box/unsignedTypes/kt43286a.kt b/compiler/testData/codegen/box/unsignedTypes/kt43286a.kt index b0677e0fb69..917ec50c25e 100644 --- a/compiler/testData/codegen/box/unsignedTypes/kt43286a.kt +++ b/compiler/testData/codegen/box/unsignedTypes/kt43286a.kt @@ -1,7 +1,6 @@ // JVM_TARGET: 1.8 // WITH_RUNTIME // KJS_WITH_FULL_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR fun box(): String { val x = 3UL % 2U diff --git a/compiler/testData/codegen/box/unsignedTypes/unsignedIntDivide.kt b/compiler/testData/codegen/box/unsignedTypes/unsignedIntDivide.kt index 8ff522f2cc0..0f2412922a2 100644 --- a/compiler/testData/codegen/box/unsignedTypes/unsignedIntDivide.kt +++ b/compiler/testData/codegen/box/unsignedTypes/unsignedIntDivide.kt @@ -1,6 +1,5 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR val ua = 1234U val ub = 5678U diff --git a/compiler/testData/codegen/box/unsignedTypes/unsignedIntRemainder.kt b/compiler/testData/codegen/box/unsignedTypes/unsignedIntRemainder.kt index f94a54880c2..5052b82ebea 100644 --- a/compiler/testData/codegen/box/unsignedTypes/unsignedIntRemainder.kt +++ b/compiler/testData/codegen/box/unsignedTypes/unsignedIntRemainder.kt @@ -1,6 +1,5 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR val ua = 1234U val ub = 5678U diff --git a/compiler/testData/codegen/box/unsignedTypes/unsignedLongDivide.kt b/compiler/testData/codegen/box/unsignedTypes/unsignedLongDivide.kt index 5fb5226ab2b..c9436d97084 100644 --- a/compiler/testData/codegen/box/unsignedTypes/unsignedLongDivide.kt +++ b/compiler/testData/codegen/box/unsignedTypes/unsignedLongDivide.kt @@ -1,6 +1,5 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR val ua = 1234UL val ub = 5678UL diff --git a/compiler/testData/codegen/box/unsignedTypes/unsignedLongRemainder.kt b/compiler/testData/codegen/box/unsignedTypes/unsignedLongRemainder.kt index 254e71c600a..09ca73b544d 100644 --- a/compiler/testData/codegen/box/unsignedTypes/unsignedLongRemainder.kt +++ b/compiler/testData/codegen/box/unsignedTypes/unsignedLongRemainder.kt @@ -1,6 +1,5 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR val ua = 1234UL val ub = 5678UL diff --git a/compiler/testData/codegen/box/unsignedTypes/unsignedTypeValuesInsideStringTemplates.kt b/compiler/testData/codegen/box/unsignedTypes/unsignedTypeValuesInsideStringTemplates.kt index a59aec5f3ad..32b0ffc28d2 100644 --- a/compiler/testData/codegen/box/unsignedTypes/unsignedTypeValuesInsideStringTemplates.kt +++ b/compiler/testData/codegen/box/unsignedTypes/unsignedTypeValuesInsideStringTemplates.kt @@ -2,7 +2,6 @@ // WASM_MUTE_REASON: STDLIB_TEXT // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR const val MAX_BYTE: UByte = 0xFFu const val HUNDRED: UByte = 100u diff --git a/compiler/testData/codegen/box/unsignedTypes/varargsOfUnsignedTypes.kt b/compiler/testData/codegen/box/unsignedTypes/varargsOfUnsignedTypes.kt index bf1ebbbace5..b37a7918758 100644 --- a/compiler/testData/codegen/box/unsignedTypes/varargsOfUnsignedTypes.kt +++ b/compiler/testData/codegen/box/unsignedTypes/varargsOfUnsignedTypes.kt @@ -2,7 +2,6 @@ // WASM_MUTE_REASON: SPREAD_OPERATOR // WITH_RUNTIME // KJS_WITH_FULL_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR fun uint(vararg us: UInt): UIntArray = us diff --git a/compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedIntDivide_jvm18.kt b/compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedIntDivide_jvm18.kt index ac0308002e3..6765deea354 100644 --- a/compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedIntDivide_jvm18.kt +++ b/compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedIntDivide_jvm18.kt @@ -1,6 +1,5 @@ // JVM_TARGET: 1.8 // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR val ua = 1234U val ub = 5678U diff --git a/compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedIntRemainder_jvm18.kt b/compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedIntRemainder_jvm18.kt index ea97267b2a9..cd5135f232b 100644 --- a/compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedIntRemainder_jvm18.kt +++ b/compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedIntRemainder_jvm18.kt @@ -1,6 +1,5 @@ // JVM_TARGET: 1.8 // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR val ua = 1234U val ub = 5678U diff --git a/compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedLongDivide_jvm18.kt b/compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedLongDivide_jvm18.kt index bf85cd0126c..795efb5e002 100644 --- a/compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedLongDivide_jvm18.kt +++ b/compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedLongDivide_jvm18.kt @@ -1,6 +1,5 @@ // JVM_TARGET: 1.8 // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR val ua = 1234UL val ub = 5678UL diff --git a/compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedLongRemainder_jvm18.kt b/compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedLongRemainder_jvm18.kt index 15a7aba6f8a..de7b81bb0ed 100644 --- a/compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedLongRemainder_jvm18.kt +++ b/compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedLongRemainder_jvm18.kt @@ -1,6 +1,5 @@ // JVM_TARGET: 1.8 // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR val ua = 1234UL val ub = 5678UL diff --git a/compiler/testData/compileKotlinAgainstKotlin/inlineClassesOldMangling.kt b/compiler/testData/compileKotlinAgainstKotlin/inlineClassesOldMangling.kt index 4a5860fed44..32b07378d6e 100644 --- a/compiler/testData/compileKotlinAgainstKotlin/inlineClassesOldMangling.kt +++ b/compiler/testData/compileKotlinAgainstKotlin/inlineClassesOldMangling.kt @@ -1,5 +1,4 @@ // !LANGUAGE: +InlineClasses -// IGNORE_BACKEND_FIR: JVM_IR // FILE: 1.kt // KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME package test From 524419a2fe4956b398b8d9c967125101abd28b5c Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Thu, 26 Nov 2020 21:17:09 +0100 Subject: [PATCH 253/698] IC Mangling: Use new mangling scheme for range tests --- .../expression/downTo/emptyProgression.kt | 1 - .../expression/downTo/illegalStepNegative.kt | 1 - .../expression/downTo/illegalStepNonConst.kt | 1 - .../downTo/illegalStepThenLegalStep.kt | 1 - .../expression/downTo/illegalStepZero.kt | 1 - .../downTo/legalStepThenIllegalStep.kt | 1 - .../downTo/maxValueToMinValueStepMaxValue.kt | 1 - .../downTo/maxValueToOneStepMaxValue.kt | 1 - .../downTo/maxValueToZeroStepMaxValue.kt | 1 - .../expression/downTo/mixedTypeStep.kt | 1 - .../downTo/nestedStep/stepOneThenStepOne.kt | 1 - .../downTo/nestedStep/stepThenSameStep.kt | 1 - .../nestedStep/stepToSameLastThenStepOne.kt | 1 - .../stepToSameLastThenStepToSameLast.kt | 1 - .../stepToSameLastThenStepToSmallerLast.kt | 1 - .../stepToSmallerLastThenStepOne.kt | 1 - .../stepToSmallerLastThenStepToSameLast.kt | 1 - .../stepToSmallerLastThenStepToSmallerLast.kt | 1 - .../downTo/reversed/reversedThenStep.kt | 1 - .../reversed/reversedThenStepThenReversed.kt | 1 - .../reversedThenStepThenReversedThenStep.kt | 1 - .../downTo/reversed/stepThenReversed.kt | 1 - .../reversed/stepThenReversedThenStep.kt | 1 - .../stepThenReversedThenStepThenReversed.kt | 1 - .../expression/downTo/singleElementStepTwo.kt | 1 - .../expression/downTo/stepNonConst.kt | 1 - .../unsigned/expression/downTo/stepOne.kt | 1 - .../expression/downTo/stepToOutsideRange.kt | 1 - .../expression/downTo/stepToSameLast.kt | 1 - .../expression/downTo/stepToSmallerLast.kt | 1 - .../expression/rangeTo/emptyProgression.kt | 1 - .../expression/rangeTo/illegalStepNegative.kt | 1 - .../expression/rangeTo/illegalStepNonConst.kt | 1 - .../rangeTo/illegalStepThenLegalStep.kt | 1 - .../expression/rangeTo/illegalStepZero.kt | 1 - .../rangeTo/legalStepThenIllegalStep.kt | 1 - .../rangeTo/minValueToMaxValueStepMaxValue.kt | 1 - .../expression/rangeTo/mixedTypeStep.kt | 1 - .../rangeTo/nestedStep/stepOneThenStepOne.kt | 1 - .../rangeTo/nestedStep/stepThenSameStep.kt | 1 - .../nestedStep/stepToSameLastThenStepOne.kt | 1 - .../stepToSameLastThenStepToSameLast.kt | 1 - .../stepToSameLastThenStepToSmallerLast.kt | 1 - .../stepToSmallerLastThenStepOne.kt | 1 - .../stepToSmallerLastThenStepToSameLast.kt | 1 - .../stepToSmallerLastThenStepToSmallerLast.kt | 1 - .../rangeTo/reversed/reversedThenStep.kt | 1 - .../reversed/reversedThenStepThenReversed.kt | 1 - .../reversedThenStepThenReversedThenStep.kt | 1 - .../rangeTo/reversed/stepThenReversed.kt | 1 - .../reversed/stepThenReversedThenStep.kt | 1 - .../stepThenReversedThenStepThenReversed.kt | 1 - .../rangeTo/singleElementStepTwo.kt | 1 - .../expression/rangeTo/stepNonConst.kt | 1 - .../unsigned/expression/rangeTo/stepOne.kt | 1 - .../expression/rangeTo/stepToOutsideRange.kt | 1 - .../expression/rangeTo/stepToSameLast.kt | 1 - .../expression/rangeTo/stepToSmallerLast.kt | 1 - .../rangeTo/zeroToMaxValueStepMaxValue.kt | 1 - .../expression/until/emptyProgression.kt | 1 - .../until/emptyProgressionToMinValue.kt | 1 - .../expression/until/illegalStepNegative.kt | 1 - .../expression/until/illegalStepNonConst.kt | 1 - .../until/illegalStepThenLegalStep.kt | 1 - .../expression/until/illegalStepZero.kt | 1 - .../until/legalStepThenIllegalStep.kt | 1 - .../until/minValueToMaxValueStepMaxValue.kt | 1 - .../expression/until/mixedTypeStep.kt | 1 - .../until/nestedStep/stepOneThenStepOne.kt | 1 - .../until/nestedStep/stepThenSameStep.kt | 1 - .../nestedStep/stepToSameLastThenStepOne.kt | 1 - .../stepToSameLastThenStepToSameLast.kt | 1 - .../stepToSameLastThenStepToSmallerLast.kt | 1 - .../stepToSmallerLastThenStepOne.kt | 1 - .../stepToSmallerLastThenStepToSameLast.kt | 1 - .../stepToSmallerLastThenStepToSmallerLast.kt | 1 - .../expression/until/progressionToNonConst.kt | 1 - .../until/reversed/reversedThenStep.kt | 1 - .../reversed/reversedThenStepThenReversed.kt | 1 - .../reversedThenStepThenReversedThenStep.kt | 1 - .../until/reversed/stepThenReversed.kt | 1 - .../reversed/stepThenReversedThenStep.kt | 1 - .../stepThenReversedThenStepThenReversed.kt | 1 - .../expression/until/singleElementStepTwo.kt | 1 - .../unsigned/expression/until/stepNonConst.kt | 1 - .../unsigned/expression/until/stepOne.kt | 1 - .../expression/until/stepToOutsideRange.kt | 1 - .../expression/until/stepToSameLast.kt | 1 - .../expression/until/stepToSmallerLast.kt | 1 - .../until/zeroToMaxValueStepMaxValue.kt | 1 - .../literal/downTo/emptyProgression.kt | 1 - .../literal/downTo/illegalStepNegative.kt | 1 - .../literal/downTo/illegalStepNonConst.kt | 1 - .../downTo/illegalStepThenLegalStep.kt | 1 - .../literal/downTo/illegalStepZero.kt | 1 - .../downTo/legalStepThenIllegalStep.kt | 1 - .../downTo/maxValueToMinValueStepMaxValue.kt | 1 - .../downTo/maxValueToOneStepMaxValue.kt | 1 - .../downTo/maxValueToZeroStepMaxValue.kt | 1 - .../unsigned/literal/downTo/mixedTypeStep.kt | 1 - .../downTo/nestedStep/stepOneThenStepOne.kt | 1 - .../downTo/nestedStep/stepThenSameStep.kt | 1 - .../nestedStep/stepToSameLastThenStepOne.kt | 1 - .../stepToSameLastThenStepToSameLast.kt | 1 - .../stepToSameLastThenStepToSmallerLast.kt | 1 - .../stepToSmallerLastThenStepOne.kt | 1 - .../stepToSmallerLastThenStepToSameLast.kt | 1 - .../stepToSmallerLastThenStepToSmallerLast.kt | 1 - .../downTo/reversed/reversedThenStep.kt | 1 - .../reversed/reversedThenStepThenReversed.kt | 1 - .../reversedThenStepThenReversedThenStep.kt | 1 - .../downTo/reversed/stepThenReversed.kt | 1 - .../reversed/stepThenReversedThenStep.kt | 1 - .../stepThenReversedThenStepThenReversed.kt | 1 - .../literal/downTo/singleElementStepTwo.kt | 1 - .../unsigned/literal/downTo/stepNonConst.kt | 1 - .../unsigned/literal/downTo/stepOne.kt | 1 - .../literal/downTo/stepToOutsideRange.kt | 1 - .../unsigned/literal/downTo/stepToSameLast.kt | 1 - .../literal/downTo/stepToSmallerLast.kt | 1 - .../literal/rangeTo/emptyProgression.kt | 1 - .../literal/rangeTo/illegalStepNegative.kt | 1 - .../literal/rangeTo/illegalStepNonConst.kt | 1 - .../rangeTo/illegalStepThenLegalStep.kt | 1 - .../literal/rangeTo/illegalStepZero.kt | 1 - .../rangeTo/legalStepThenIllegalStep.kt | 1 - .../rangeTo/minValueToMaxValueStepMaxValue.kt | 1 - .../unsigned/literal/rangeTo/mixedTypeStep.kt | 1 - .../rangeTo/nestedStep/stepOneThenStepOne.kt | 1 - .../rangeTo/nestedStep/stepThenSameStep.kt | 1 - .../nestedStep/stepToSameLastThenStepOne.kt | 1 - .../stepToSameLastThenStepToSameLast.kt | 1 - .../stepToSameLastThenStepToSmallerLast.kt | 1 - .../stepToSmallerLastThenStepOne.kt | 1 - .../stepToSmallerLastThenStepToSameLast.kt | 1 - .../stepToSmallerLastThenStepToSmallerLast.kt | 1 - .../rangeTo/reversed/reversedThenStep.kt | 1 - .../reversed/reversedThenStepThenReversed.kt | 1 - .../reversedThenStepThenReversedThenStep.kt | 1 - .../rangeTo/reversed/stepThenReversed.kt | 1 - .../reversed/stepThenReversedThenStep.kt | 1 - .../stepThenReversedThenStepThenReversed.kt | 1 - .../literal/rangeTo/singleElementStepTwo.kt | 1 - .../unsigned/literal/rangeTo/stepNonConst.kt | 1 - .../unsigned/literal/rangeTo/stepOne.kt | 1 - .../literal/rangeTo/stepToOutsideRange.kt | 1 - .../literal/rangeTo/stepToSameLast.kt | 1 - .../literal/rangeTo/stepToSmallerLast.kt | 1 - .../rangeTo/zeroToMaxValueStepMaxValue.kt | 1 - .../literal/until/emptyProgression.kt | 1 - .../until/emptyProgressionToMinValue.kt | 1 - .../literal/until/illegalStepNegative.kt | 1 - .../literal/until/illegalStepNonConst.kt | 1 - .../literal/until/illegalStepThenLegalStep.kt | 1 - .../unsigned/literal/until/illegalStepZero.kt | 1 - .../literal/until/legalStepThenIllegalStep.kt | 1 - .../until/minValueToMaxValueStepMaxValue.kt | 1 - .../unsigned/literal/until/mixedTypeStep.kt | 1 - .../until/nestedStep/stepOneThenStepOne.kt | 1 - .../until/nestedStep/stepThenSameStep.kt | 1 - .../nestedStep/stepToSameLastThenStepOne.kt | 1 - .../stepToSameLastThenStepToSameLast.kt | 1 - .../stepToSameLastThenStepToSmallerLast.kt | 1 - .../stepToSmallerLastThenStepOne.kt | 1 - .../stepToSmallerLastThenStepToSameLast.kt | 1 - .../stepToSmallerLastThenStepToSmallerLast.kt | 1 - .../literal/until/progressionToNonConst.kt | 1 - .../until/reversed/reversedThenStep.kt | 1 - .../reversed/reversedThenStepThenReversed.kt | 1 - .../reversedThenStepThenReversedThenStep.kt | 1 - .../until/reversed/stepThenReversed.kt | 1 - .../reversed/stepThenReversedThenStep.kt | 1 - .../stepThenReversedThenStepThenReversed.kt | 1 - .../literal/until/singleElementStepTwo.kt | 1 - .../unsigned/literal/until/stepNonConst.kt | 1 - .../stepped/unsigned/literal/until/stepOne.kt | 1 - .../literal/until/stepToOutsideRange.kt | 1 - .../unsigned/literal/until/stepToSameLast.kt | 1 - .../literal/until/stepToSmallerLast.kt | 1 - .../until/zeroToMaxValueStepMaxValue.kt | 1 - .../ranges/unsigned/expression/emptyDownto.kt | 1 - .../expression/inexactDownToMinValue.kt | 1 - .../expression/inexactSteppedDownTo.kt | 1 - .../unsigned/expression/inexactToMaxValue.kt | 1 - .../expression/maxValueMinusTwoToMaxValue.kt | 1 - .../unsigned/expression/oneElementDownTo.kt | 1 - .../ranges/unsigned/expression/openRange.kt | 1 - .../expression/overflowZeroDownToMaxValue.kt | 1 - .../expression/overflowZeroToMinValue.kt | 1 - .../expression/progressionDownToMinValue.kt | 1 - .../progressionMaxValueMinusTwoToMaxValue.kt | 1 - .../expression/reversedBackSequence.kt | 1 - .../expression/reversedEmptyBackSequence.kt | 1 - .../reversedInexactSteppedDownTo.kt | 1 - .../unsigned/expression/simpleDownTo.kt | 1 - .../simpleRangeWithNonConstantEnds.kt | 1 - .../expression/simpleSteppedDownTo.kt | 1 - .../unsigned/literal/inexactDownToMinValue.kt | 1 - .../unsigned/literal/inexactToMaxValue.kt | 1 - .../literal/maxValueMinusTwoToMaxValue.kt | 1 - .../literal/overflowZeroToMinValue.kt | 1 - .../literal/progressionDownToMinValue.kt | 1 - .../progressionMaxValueMinusTwoToMaxValue.kt | 1 - .../literal/simpleRangeWithNonConstantEnds.kt | 1 - .../tests/GenerateRangesCodegenTestData.java | 30 +----------- .../GenerateSteppedRangesCodegenTestData.kt | 49 +------------------ 206 files changed, 3 insertions(+), 280 deletions(-) diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/emptyProgression.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/emptyProgression.kt index d2595be0ecd..87fb2ebcc6e 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/emptyProgression.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/emptyProgression.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/illegalStepNegative.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/illegalStepNegative.kt index f2ca380839c..8f1d5c80619 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/illegalStepNegative.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/illegalStepNegative.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/illegalStepNonConst.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/illegalStepNonConst.kt index 58aa88d6ea6..b64149ec44b 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/illegalStepNonConst.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/illegalStepNonConst.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/illegalStepThenLegalStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/illegalStepThenLegalStep.kt index eca9416108b..9786044f6ba 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/illegalStepThenLegalStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/illegalStepThenLegalStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/illegalStepZero.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/illegalStepZero.kt index 9c921fdfdc8..85da3721ae1 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/illegalStepZero.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/illegalStepZero.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/legalStepThenIllegalStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/legalStepThenIllegalStep.kt index df1a8f297dc..1d7f5d58eba 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/legalStepThenIllegalStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/legalStepThenIllegalStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/maxValueToMinValueStepMaxValue.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/maxValueToMinValueStepMaxValue.kt index 114dc408d2e..fa411a1d048 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/maxValueToMinValueStepMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/maxValueToMinValueStepMaxValue.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/maxValueToOneStepMaxValue.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/maxValueToOneStepMaxValue.kt index 835e060801b..04a45fbfd11 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/maxValueToOneStepMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/maxValueToOneStepMaxValue.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/maxValueToZeroStepMaxValue.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/maxValueToZeroStepMaxValue.kt index 1821b205590..264d52b032b 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/maxValueToZeroStepMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/maxValueToZeroStepMaxValue.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/mixedTypeStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/mixedTypeStep.kt index 0a4b5f0bafe..4010c3bed60 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/mixedTypeStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/mixedTypeStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepOneThenStepOne.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepOneThenStepOne.kt index d0ca8a305e2..e461d51ae8c 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepOneThenStepOne.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepOneThenStepOne.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepThenSameStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepThenSameStep.kt index e1021430af5..be8294e6430 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepThenSameStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepThenSameStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepToSameLastThenStepOne.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepToSameLastThenStepOne.kt index da288d320fe..f1530486807 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepToSameLastThenStepOne.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepToSameLastThenStepOne.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepToSameLastThenStepToSameLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepToSameLastThenStepToSameLast.kt index 5a9e289ad83..19ef1d05c02 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepToSameLastThenStepToSameLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepToSameLastThenStepToSameLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepToSameLastThenStepToSmallerLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepToSameLastThenStepToSmallerLast.kt index fa2c1c3df12..dc20edc0a30 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepToSameLastThenStepToSmallerLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepToSameLastThenStepToSmallerLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepToSmallerLastThenStepOne.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepToSmallerLastThenStepOne.kt index 7bb9608b6f4..f214b33066d 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepToSmallerLastThenStepOne.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepToSmallerLastThenStepOne.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepToSmallerLastThenStepToSameLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepToSmallerLastThenStepToSameLast.kt index 6f95fd391fb..97ffc9894a5 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepToSmallerLastThenStepToSameLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepToSmallerLastThenStepToSameLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepToSmallerLastThenStepToSmallerLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepToSmallerLastThenStepToSmallerLast.kt index dbe3618a1be..b5d8acf7bab 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepToSmallerLastThenStepToSmallerLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/nestedStep/stepToSmallerLastThenStepToSmallerLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/reversed/reversedThenStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/reversed/reversedThenStep.kt index 86db9205d8f..ec5b1393536 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/reversed/reversedThenStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/reversed/reversedThenStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/reversed/reversedThenStepThenReversed.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/reversed/reversedThenStepThenReversed.kt index 1e3bddb2750..fa51c32c8d7 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/reversed/reversedThenStepThenReversed.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/reversed/reversedThenStepThenReversed.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/reversed/reversedThenStepThenReversedThenStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/reversed/reversedThenStepThenReversedThenStep.kt index 3a5d16b7d40..8455eb762f4 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/reversed/reversedThenStepThenReversedThenStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/reversed/reversedThenStepThenReversedThenStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/reversed/stepThenReversed.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/reversed/stepThenReversed.kt index 85b6bad91ac..82bc89042df 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/reversed/stepThenReversed.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/reversed/stepThenReversed.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/reversed/stepThenReversedThenStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/reversed/stepThenReversedThenStep.kt index 55cc777f867..479845f7ef6 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/reversed/stepThenReversedThenStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/reversed/stepThenReversedThenStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/reversed/stepThenReversedThenStepThenReversed.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/reversed/stepThenReversedThenStepThenReversed.kt index 7fe0049a3d8..c5deccfb5da 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/reversed/stepThenReversedThenStepThenReversed.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/reversed/stepThenReversedThenStepThenReversed.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/singleElementStepTwo.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/singleElementStepTwo.kt index d765861bec9..99e282b1ae4 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/singleElementStepTwo.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/singleElementStepTwo.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/stepNonConst.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/stepNonConst.kt index d23cc7dcaab..f1e8751f756 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/stepNonConst.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/stepNonConst.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/stepOne.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/stepOne.kt index 641d41321f5..c550917834c 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/stepOne.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/stepOne.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/stepToOutsideRange.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/stepToOutsideRange.kt index 1ee43a1ca5c..c90bff86794 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/stepToOutsideRange.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/stepToOutsideRange.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/stepToSameLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/stepToSameLast.kt index e3711a3cd7f..0c592c27f4f 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/stepToSameLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/stepToSameLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/stepToSmallerLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/stepToSmallerLast.kt index 5a96da65752..b1493e8f885 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/stepToSmallerLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/downTo/stepToSmallerLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/emptyProgression.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/emptyProgression.kt index d378730a38b..b364c192304 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/emptyProgression.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/emptyProgression.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/illegalStepNegative.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/illegalStepNegative.kt index 3b37575c22a..f530d9a0078 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/illegalStepNegative.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/illegalStepNegative.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/illegalStepNonConst.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/illegalStepNonConst.kt index f42246da113..bdfca888492 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/illegalStepNonConst.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/illegalStepNonConst.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/illegalStepThenLegalStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/illegalStepThenLegalStep.kt index d4fced8bee6..9e8912819df 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/illegalStepThenLegalStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/illegalStepThenLegalStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/illegalStepZero.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/illegalStepZero.kt index 7205370683f..c4bf136937e 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/illegalStepZero.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/illegalStepZero.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/legalStepThenIllegalStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/legalStepThenIllegalStep.kt index c35a20983d7..1e6ceb88a45 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/legalStepThenIllegalStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/legalStepThenIllegalStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/minValueToMaxValueStepMaxValue.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/minValueToMaxValueStepMaxValue.kt index 325208ff524..7caf0799450 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/minValueToMaxValueStepMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/minValueToMaxValueStepMaxValue.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/mixedTypeStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/mixedTypeStep.kt index efdd645e1cd..78743550a0f 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/mixedTypeStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/mixedTypeStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepOneThenStepOne.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepOneThenStepOne.kt index f7264661e75..bbae91fc44d 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepOneThenStepOne.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepOneThenStepOne.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepThenSameStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepThenSameStep.kt index ce4b6288cd7..5cc3b75a669 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepThenSameStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepThenSameStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepToSameLastThenStepOne.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepToSameLastThenStepOne.kt index 4cdbec4305e..9578ebb8e8a 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepToSameLastThenStepOne.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepToSameLastThenStepOne.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepToSameLastThenStepToSameLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepToSameLastThenStepToSameLast.kt index 54126aa86a2..62b18addc6c 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepToSameLastThenStepToSameLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepToSameLastThenStepToSameLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepToSameLastThenStepToSmallerLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepToSameLastThenStepToSmallerLast.kt index d5e021e2bde..bfe09f8e4c2 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepToSameLastThenStepToSmallerLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepToSameLastThenStepToSmallerLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepToSmallerLastThenStepOne.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepToSmallerLastThenStepOne.kt index 1312be13ad5..cbe78af5f12 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepToSmallerLastThenStepOne.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepToSmallerLastThenStepOne.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepToSmallerLastThenStepToSameLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepToSmallerLastThenStepToSameLast.kt index d237778c1a7..3b8a15fa258 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepToSmallerLastThenStepToSameLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepToSmallerLastThenStepToSameLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepToSmallerLastThenStepToSmallerLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepToSmallerLastThenStepToSmallerLast.kt index 21d4951e333..1e4c5b0e501 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepToSmallerLastThenStepToSmallerLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/nestedStep/stepToSmallerLastThenStepToSmallerLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/reversed/reversedThenStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/reversed/reversedThenStep.kt index a174eefb703..f529c3b2742 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/reversed/reversedThenStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/reversed/reversedThenStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/reversed/reversedThenStepThenReversed.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/reversed/reversedThenStepThenReversed.kt index 7de6094551f..1d096b924dc 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/reversed/reversedThenStepThenReversed.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/reversed/reversedThenStepThenReversed.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/reversed/reversedThenStepThenReversedThenStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/reversed/reversedThenStepThenReversedThenStep.kt index 57508ba6f8e..0cdfbc1fbc3 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/reversed/reversedThenStepThenReversedThenStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/reversed/reversedThenStepThenReversedThenStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/reversed/stepThenReversed.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/reversed/stepThenReversed.kt index a14a82905ad..cf09e5270d6 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/reversed/stepThenReversed.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/reversed/stepThenReversed.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/reversed/stepThenReversedThenStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/reversed/stepThenReversedThenStep.kt index 31f3574dc56..66357b75771 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/reversed/stepThenReversedThenStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/reversed/stepThenReversedThenStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/reversed/stepThenReversedThenStepThenReversed.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/reversed/stepThenReversedThenStepThenReversed.kt index 229745047e2..a0bb27aba29 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/reversed/stepThenReversedThenStepThenReversed.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/reversed/stepThenReversedThenStepThenReversed.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/singleElementStepTwo.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/singleElementStepTwo.kt index 8b157c37c5d..8fb574e1b61 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/singleElementStepTwo.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/singleElementStepTwo.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/stepNonConst.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/stepNonConst.kt index e59c04804ba..4e2e87b0c97 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/stepNonConst.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/stepNonConst.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/stepOne.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/stepOne.kt index f316ef0676c..3c6d9179900 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/stepOne.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/stepOne.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/stepToOutsideRange.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/stepToOutsideRange.kt index 59083a8a4f8..61ec5789a99 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/stepToOutsideRange.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/stepToOutsideRange.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/stepToSameLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/stepToSameLast.kt index 4b43cd2a3d9..4f4f2ff96b7 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/stepToSameLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/stepToSameLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/stepToSmallerLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/stepToSmallerLast.kt index 7e33173e563..82ad3ad4aeb 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/stepToSmallerLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/stepToSmallerLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/zeroToMaxValueStepMaxValue.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/zeroToMaxValueStepMaxValue.kt index ef8310d6036..70570b7635e 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/zeroToMaxValueStepMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/rangeTo/zeroToMaxValueStepMaxValue.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/emptyProgression.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/emptyProgression.kt index 22d5bc8ad7c..7f35c887652 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/emptyProgression.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/emptyProgression.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/emptyProgressionToMinValue.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/emptyProgressionToMinValue.kt index 9ff3dabbc97..aee17b0c921 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/emptyProgressionToMinValue.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/emptyProgressionToMinValue.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/illegalStepNegative.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/illegalStepNegative.kt index 017dda50c53..58b4023639d 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/illegalStepNegative.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/illegalStepNegative.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/illegalStepNonConst.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/illegalStepNonConst.kt index 0b240543f17..41b87a0b274 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/illegalStepNonConst.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/illegalStepNonConst.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/illegalStepThenLegalStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/illegalStepThenLegalStep.kt index 544f56facbc..42c46b67751 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/illegalStepThenLegalStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/illegalStepThenLegalStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/illegalStepZero.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/illegalStepZero.kt index ec5238be3cb..e9465d51195 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/illegalStepZero.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/illegalStepZero.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/legalStepThenIllegalStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/legalStepThenIllegalStep.kt index 124737e3191..cbb9dd83e98 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/legalStepThenIllegalStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/legalStepThenIllegalStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/minValueToMaxValueStepMaxValue.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/minValueToMaxValueStepMaxValue.kt index ac0ed0e00fb..47c8b668b7c 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/minValueToMaxValueStepMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/minValueToMaxValueStepMaxValue.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/mixedTypeStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/mixedTypeStep.kt index 658b2ea69c4..c4529b8f024 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/mixedTypeStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/mixedTypeStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepOneThenStepOne.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepOneThenStepOne.kt index 4c052f4e66d..1f4c7bc6b63 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepOneThenStepOne.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepOneThenStepOne.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepThenSameStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepThenSameStep.kt index 3347b85b82e..1bb81d68908 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepThenSameStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepThenSameStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepToSameLastThenStepOne.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepToSameLastThenStepOne.kt index 442b67ddf6c..1577d2fd1ac 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepToSameLastThenStepOne.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepToSameLastThenStepOne.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepToSameLastThenStepToSameLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepToSameLastThenStepToSameLast.kt index 8599aef2281..5a7ecaf2d9e 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepToSameLastThenStepToSameLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepToSameLastThenStepToSameLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepToSameLastThenStepToSmallerLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepToSameLastThenStepToSmallerLast.kt index fd62bdbec7f..5b7592a0178 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepToSameLastThenStepToSmallerLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepToSameLastThenStepToSmallerLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepToSmallerLastThenStepOne.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepToSmallerLastThenStepOne.kt index b8548f7a4dd..48204f0edb0 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepToSmallerLastThenStepOne.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepToSmallerLastThenStepOne.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepToSmallerLastThenStepToSameLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepToSmallerLastThenStepToSameLast.kt index 97244dd3f88..d76d013742b 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepToSmallerLastThenStepToSameLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepToSmallerLastThenStepToSameLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepToSmallerLastThenStepToSmallerLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepToSmallerLastThenStepToSmallerLast.kt index 57b9c6b975e..2d66854102e 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepToSmallerLastThenStepToSmallerLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/nestedStep/stepToSmallerLastThenStepToSmallerLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/progressionToNonConst.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/progressionToNonConst.kt index a164e0df489..f5bed14627e 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/progressionToNonConst.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/progressionToNonConst.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/reversed/reversedThenStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/reversed/reversedThenStep.kt index 6a2be56dd6c..7e17d53e6b9 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/reversed/reversedThenStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/reversed/reversedThenStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/reversed/reversedThenStepThenReversed.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/reversed/reversedThenStepThenReversed.kt index 9aaf7b44d16..39a259a6083 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/reversed/reversedThenStepThenReversed.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/reversed/reversedThenStepThenReversed.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/reversed/reversedThenStepThenReversedThenStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/reversed/reversedThenStepThenReversedThenStep.kt index 5f5d450af42..55d71b4714c 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/reversed/reversedThenStepThenReversedThenStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/reversed/reversedThenStepThenReversedThenStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/reversed/stepThenReversed.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/reversed/stepThenReversed.kt index b42933009d3..614a1035d76 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/reversed/stepThenReversed.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/reversed/stepThenReversed.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/reversed/stepThenReversedThenStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/reversed/stepThenReversedThenStep.kt index 84510e3a912..65d12eda56d 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/reversed/stepThenReversedThenStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/reversed/stepThenReversedThenStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/reversed/stepThenReversedThenStepThenReversed.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/reversed/stepThenReversedThenStepThenReversed.kt index 9865c876ba1..90988c051ec 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/reversed/stepThenReversedThenStepThenReversed.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/reversed/stepThenReversedThenStepThenReversed.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/singleElementStepTwo.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/singleElementStepTwo.kt index 29f4368b2ac..2e4995d2850 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/singleElementStepTwo.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/singleElementStepTwo.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/stepNonConst.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/stepNonConst.kt index caf7d2147bb..be68fc497f9 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/stepNonConst.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/stepNonConst.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/stepOne.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/stepOne.kt index d92e95ace88..d04826ca615 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/stepOne.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/stepOne.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/stepToOutsideRange.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/stepToOutsideRange.kt index 5d18bd5c81b..21c305f9358 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/stepToOutsideRange.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/stepToOutsideRange.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/stepToSameLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/stepToSameLast.kt index c9a9cc94ee9..ab24a97c06f 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/stepToSameLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/stepToSameLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/stepToSmallerLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/stepToSmallerLast.kt index ce1aa3aa207..ac26047c424 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/stepToSmallerLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/stepToSmallerLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/zeroToMaxValueStepMaxValue.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/zeroToMaxValueStepMaxValue.kt index f36aec2b92b..77d8af8ac20 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/zeroToMaxValueStepMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/expression/until/zeroToMaxValueStepMaxValue.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/emptyProgression.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/emptyProgression.kt index 4f65d12b173..6cf5cdc5ada 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/emptyProgression.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/emptyProgression.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/illegalStepNegative.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/illegalStepNegative.kt index c3f136182ed..b10e4fe679b 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/illegalStepNegative.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/illegalStepNegative.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/illegalStepNonConst.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/illegalStepNonConst.kt index 498a3375f5c..ffdfe85d414 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/illegalStepNonConst.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/illegalStepNonConst.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/illegalStepThenLegalStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/illegalStepThenLegalStep.kt index e1abc71728c..8f924fbba21 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/illegalStepThenLegalStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/illegalStepThenLegalStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/illegalStepZero.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/illegalStepZero.kt index e3f6cbc8843..29fb3ba2ebb 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/illegalStepZero.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/illegalStepZero.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/legalStepThenIllegalStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/legalStepThenIllegalStep.kt index 0e9611cf2e3..b489b2a1174 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/legalStepThenIllegalStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/legalStepThenIllegalStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/maxValueToMinValueStepMaxValue.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/maxValueToMinValueStepMaxValue.kt index e843680781c..19b964ec592 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/maxValueToMinValueStepMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/maxValueToMinValueStepMaxValue.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/maxValueToOneStepMaxValue.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/maxValueToOneStepMaxValue.kt index eeabe5d3c38..5ab8a83460a 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/maxValueToOneStepMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/maxValueToOneStepMaxValue.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/maxValueToZeroStepMaxValue.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/maxValueToZeroStepMaxValue.kt index 1c4707bc3f0..18040c9c51e 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/maxValueToZeroStepMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/maxValueToZeroStepMaxValue.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/mixedTypeStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/mixedTypeStep.kt index 2799e6711b1..79b22a4238d 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/mixedTypeStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/mixedTypeStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepOneThenStepOne.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepOneThenStepOne.kt index 1468248e843..9f5f9cf9dca 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepOneThenStepOne.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepOneThenStepOne.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepThenSameStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepThenSameStep.kt index 1eb34dbf358..07659b2bf22 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepThenSameStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepThenSameStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepToSameLastThenStepOne.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepToSameLastThenStepOne.kt index 6b6ed4215a6..5998cceccb5 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepToSameLastThenStepOne.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepToSameLastThenStepOne.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepToSameLastThenStepToSameLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepToSameLastThenStepToSameLast.kt index 857929ffc7c..cc8c9ae2734 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepToSameLastThenStepToSameLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepToSameLastThenStepToSameLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepToSameLastThenStepToSmallerLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepToSameLastThenStepToSmallerLast.kt index 74f6be3090f..558f3ac6bc0 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepToSameLastThenStepToSmallerLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepToSameLastThenStepToSmallerLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepToSmallerLastThenStepOne.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepToSmallerLastThenStepOne.kt index a2e3f3df35b..8b26c84dd8f 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepToSmallerLastThenStepOne.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepToSmallerLastThenStepOne.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepToSmallerLastThenStepToSameLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepToSmallerLastThenStepToSameLast.kt index f82e939ec57..d8bc3fa789e 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepToSmallerLastThenStepToSameLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepToSmallerLastThenStepToSameLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepToSmallerLastThenStepToSmallerLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepToSmallerLastThenStepToSmallerLast.kt index aaffba50e5d..12b4bbabd0b 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepToSmallerLastThenStepToSmallerLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/nestedStep/stepToSmallerLastThenStepToSmallerLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/reversed/reversedThenStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/reversed/reversedThenStep.kt index b11e92bf82f..bb00bf0033c 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/reversed/reversedThenStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/reversed/reversedThenStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/reversed/reversedThenStepThenReversed.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/reversed/reversedThenStepThenReversed.kt index 922c46f59e9..53aef732711 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/reversed/reversedThenStepThenReversed.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/reversed/reversedThenStepThenReversed.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/reversed/reversedThenStepThenReversedThenStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/reversed/reversedThenStepThenReversedThenStep.kt index c870405d1b9..a9606973cbb 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/reversed/reversedThenStepThenReversedThenStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/reversed/reversedThenStepThenReversedThenStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/reversed/stepThenReversed.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/reversed/stepThenReversed.kt index e7ee0b4c7ec..9916e004f03 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/reversed/stepThenReversed.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/reversed/stepThenReversed.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/reversed/stepThenReversedThenStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/reversed/stepThenReversedThenStep.kt index 7ed9094d28b..bd3afc4a03a 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/reversed/stepThenReversedThenStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/reversed/stepThenReversedThenStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/reversed/stepThenReversedThenStepThenReversed.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/reversed/stepThenReversedThenStepThenReversed.kt index 2d588b0fffc..d845e026da7 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/reversed/stepThenReversedThenStepThenReversed.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/reversed/stepThenReversedThenStepThenReversed.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/singleElementStepTwo.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/singleElementStepTwo.kt index 8c109a11d6a..fb387c41cb4 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/singleElementStepTwo.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/singleElementStepTwo.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/stepNonConst.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/stepNonConst.kt index fe3321a97ad..d247301c3a8 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/stepNonConst.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/stepNonConst.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/stepOne.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/stepOne.kt index d8a4fb780a3..80f08f163d0 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/stepOne.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/stepOne.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/stepToOutsideRange.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/stepToOutsideRange.kt index 92375dd2f69..708c6fd7ce1 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/stepToOutsideRange.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/stepToOutsideRange.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/stepToSameLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/stepToSameLast.kt index 9a284206af6..f3ed0909644 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/stepToSameLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/stepToSameLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/stepToSmallerLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/stepToSmallerLast.kt index 101204de0b4..dcdda95c90e 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/stepToSmallerLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/downTo/stepToSmallerLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/emptyProgression.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/emptyProgression.kt index c5d95f4fb0f..b243aba2318 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/emptyProgression.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/emptyProgression.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/illegalStepNegative.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/illegalStepNegative.kt index dd2a035fcee..9a904c80f5f 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/illegalStepNegative.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/illegalStepNegative.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/illegalStepNonConst.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/illegalStepNonConst.kt index 3ebe4136885..a351ea801f1 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/illegalStepNonConst.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/illegalStepNonConst.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/illegalStepThenLegalStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/illegalStepThenLegalStep.kt index cdae926995a..d97acf7c1cf 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/illegalStepThenLegalStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/illegalStepThenLegalStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/illegalStepZero.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/illegalStepZero.kt index b1a3a51cd00..b4b185a2387 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/illegalStepZero.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/illegalStepZero.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/legalStepThenIllegalStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/legalStepThenIllegalStep.kt index 64fd3a3e750..02497a24f6f 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/legalStepThenIllegalStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/legalStepThenIllegalStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/minValueToMaxValueStepMaxValue.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/minValueToMaxValueStepMaxValue.kt index ec8cece3c51..4057dfb2d0f 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/minValueToMaxValueStepMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/minValueToMaxValueStepMaxValue.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/mixedTypeStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/mixedTypeStep.kt index f562f4c0283..e4ba49a610a 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/mixedTypeStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/mixedTypeStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepOneThenStepOne.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepOneThenStepOne.kt index 540c6195377..590608c318b 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepOneThenStepOne.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepOneThenStepOne.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepThenSameStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepThenSameStep.kt index 9f5515c0006..de6866084b3 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepThenSameStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepThenSameStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepToSameLastThenStepOne.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepToSameLastThenStepOne.kt index 79957acda44..2f739ed2c0e 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepToSameLastThenStepOne.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepToSameLastThenStepOne.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepToSameLastThenStepToSameLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepToSameLastThenStepToSameLast.kt index 3b3e83c206a..395532e6926 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepToSameLastThenStepToSameLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepToSameLastThenStepToSameLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepToSameLastThenStepToSmallerLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepToSameLastThenStepToSmallerLast.kt index 4ce6ed051f5..7c75507f76f 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepToSameLastThenStepToSmallerLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepToSameLastThenStepToSmallerLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepToSmallerLastThenStepOne.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepToSmallerLastThenStepOne.kt index 6b70c542b5e..b510d9bebde 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepToSmallerLastThenStepOne.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepToSmallerLastThenStepOne.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepToSmallerLastThenStepToSameLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepToSmallerLastThenStepToSameLast.kt index ab2e1e43cfc..16a5bb7e98e 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepToSmallerLastThenStepToSameLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepToSmallerLastThenStepToSameLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepToSmallerLastThenStepToSmallerLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepToSmallerLastThenStepToSmallerLast.kt index 8b0d50a2361..871cb01ed44 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepToSmallerLastThenStepToSmallerLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/nestedStep/stepToSmallerLastThenStepToSmallerLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/reversed/reversedThenStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/reversed/reversedThenStep.kt index 3aea419716e..ed3de14055c 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/reversed/reversedThenStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/reversed/reversedThenStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/reversed/reversedThenStepThenReversed.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/reversed/reversedThenStepThenReversed.kt index cbba0412e2b..a09c3cac28a 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/reversed/reversedThenStepThenReversed.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/reversed/reversedThenStepThenReversed.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/reversed/reversedThenStepThenReversedThenStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/reversed/reversedThenStepThenReversedThenStep.kt index 85059994291..6071d5ac4f9 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/reversed/reversedThenStepThenReversedThenStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/reversed/reversedThenStepThenReversedThenStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/reversed/stepThenReversed.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/reversed/stepThenReversed.kt index d78ed307185..2d6ad9ef2af 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/reversed/stepThenReversed.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/reversed/stepThenReversed.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/reversed/stepThenReversedThenStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/reversed/stepThenReversedThenStep.kt index 8fd34c7a7aa..cb9741f4bf4 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/reversed/stepThenReversedThenStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/reversed/stepThenReversedThenStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/reversed/stepThenReversedThenStepThenReversed.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/reversed/stepThenReversedThenStepThenReversed.kt index 8516bf1adef..5bb868adc4b 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/reversed/stepThenReversedThenStepThenReversed.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/reversed/stepThenReversedThenStepThenReversed.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/singleElementStepTwo.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/singleElementStepTwo.kt index c0946571062..a6d8582117e 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/singleElementStepTwo.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/singleElementStepTwo.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/stepNonConst.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/stepNonConst.kt index a5855936985..561c5f2c719 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/stepNonConst.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/stepNonConst.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/stepOne.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/stepOne.kt index 08fe2774e12..cf5dcb02724 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/stepOne.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/stepOne.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/stepToOutsideRange.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/stepToOutsideRange.kt index 769d68a975c..8cc7892324e 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/stepToOutsideRange.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/stepToOutsideRange.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/stepToSameLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/stepToSameLast.kt index 0bb8d7b21cf..dbbd62edd41 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/stepToSameLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/stepToSameLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/stepToSmallerLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/stepToSmallerLast.kt index 942bbfded75..aee5c487f02 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/stepToSmallerLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/stepToSmallerLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/zeroToMaxValueStepMaxValue.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/zeroToMaxValueStepMaxValue.kt index 44441eae4fb..364c2a26286 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/zeroToMaxValueStepMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/rangeTo/zeroToMaxValueStepMaxValue.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/emptyProgression.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/emptyProgression.kt index 67203d73f82..f2bafb2a17f 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/emptyProgression.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/emptyProgression.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/emptyProgressionToMinValue.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/emptyProgressionToMinValue.kt index 6cb39d7524b..1c55cf614dc 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/emptyProgressionToMinValue.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/emptyProgressionToMinValue.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/illegalStepNegative.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/illegalStepNegative.kt index aef17bd08f9..87a0bf20b9e 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/illegalStepNegative.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/illegalStepNegative.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/illegalStepNonConst.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/illegalStepNonConst.kt index f0ab9644d18..1feb4e9889a 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/illegalStepNonConst.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/illegalStepNonConst.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/illegalStepThenLegalStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/illegalStepThenLegalStep.kt index 3d1b077381e..708afa0718e 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/illegalStepThenLegalStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/illegalStepThenLegalStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/illegalStepZero.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/illegalStepZero.kt index e15a40bac39..2db5dc54e07 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/illegalStepZero.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/illegalStepZero.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/legalStepThenIllegalStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/legalStepThenIllegalStep.kt index 64806cd1eeb..74c6b7868a4 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/legalStepThenIllegalStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/legalStepThenIllegalStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/minValueToMaxValueStepMaxValue.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/minValueToMaxValueStepMaxValue.kt index 78c38c2255a..e7dd4bea0a9 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/minValueToMaxValueStepMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/minValueToMaxValueStepMaxValue.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/mixedTypeStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/mixedTypeStep.kt index 01b2ed890e6..49f79f5dc63 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/mixedTypeStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/mixedTypeStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepOneThenStepOne.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepOneThenStepOne.kt index 0a1bb990372..10fad960dd7 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepOneThenStepOne.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepOneThenStepOne.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepThenSameStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepThenSameStep.kt index 0c31791a626..4b7f95329fa 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepThenSameStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepThenSameStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepToSameLastThenStepOne.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepToSameLastThenStepOne.kt index 635ebf4ef2b..37dab718f52 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepToSameLastThenStepOne.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepToSameLastThenStepOne.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepToSameLastThenStepToSameLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepToSameLastThenStepToSameLast.kt index b8de4834c31..aa070a307fb 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepToSameLastThenStepToSameLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepToSameLastThenStepToSameLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepToSameLastThenStepToSmallerLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepToSameLastThenStepToSmallerLast.kt index 1e234e86ae7..979cca4757b 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepToSameLastThenStepToSmallerLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepToSameLastThenStepToSmallerLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepToSmallerLastThenStepOne.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepToSmallerLastThenStepOne.kt index 6ade5afc300..1f0d65d9f57 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepToSmallerLastThenStepOne.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepToSmallerLastThenStepOne.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepToSmallerLastThenStepToSameLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepToSmallerLastThenStepToSameLast.kt index aee2ac4ff5d..25748b59399 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepToSmallerLastThenStepToSameLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepToSmallerLastThenStepToSameLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepToSmallerLastThenStepToSmallerLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepToSmallerLastThenStepToSmallerLast.kt index dc5493312a7..cc79b7a5d56 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepToSmallerLastThenStepToSmallerLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/nestedStep/stepToSmallerLastThenStepToSmallerLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/progressionToNonConst.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/progressionToNonConst.kt index 7118ad31171..b184fea9bff 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/progressionToNonConst.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/progressionToNonConst.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/reversed/reversedThenStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/reversed/reversedThenStep.kt index b4284849d34..d10fa976de6 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/reversed/reversedThenStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/reversed/reversedThenStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/reversed/reversedThenStepThenReversed.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/reversed/reversedThenStepThenReversed.kt index d0b950f7cf2..cbbfc31d455 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/reversed/reversedThenStepThenReversed.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/reversed/reversedThenStepThenReversed.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/reversed/reversedThenStepThenReversedThenStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/reversed/reversedThenStepThenReversedThenStep.kt index fb93f7be63b..c19b7c20619 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/reversed/reversedThenStepThenReversedThenStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/reversed/reversedThenStepThenReversedThenStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/reversed/stepThenReversed.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/reversed/stepThenReversed.kt index 3f001847fa7..bea791e49f9 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/reversed/stepThenReversed.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/reversed/stepThenReversed.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/reversed/stepThenReversedThenStep.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/reversed/stepThenReversedThenStep.kt index 52fc4961ac3..4255b48f6d1 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/reversed/stepThenReversedThenStep.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/reversed/stepThenReversedThenStep.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/reversed/stepThenReversedThenStepThenReversed.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/reversed/stepThenReversedThenStepThenReversed.kt index f4645352b0f..d633687904d 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/reversed/stepThenReversedThenStepThenReversed.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/reversed/stepThenReversedThenStepThenReversed.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/singleElementStepTwo.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/singleElementStepTwo.kt index 65f9e8c470f..1fefdf6f659 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/singleElementStepTwo.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/singleElementStepTwo.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/stepNonConst.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/stepNonConst.kt index 9cd1bd57ef5..c676073a41c 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/stepNonConst.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/stepNonConst.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/stepOne.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/stepOne.kt index b190baf2ece..56da45a89fd 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/stepOne.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/stepOne.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/stepToOutsideRange.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/stepToOutsideRange.kt index a7e3ed2fb4d..ca343a471ea 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/stepToOutsideRange.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/stepToOutsideRange.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/stepToSameLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/stepToSameLast.kt index 208b42282c4..9fa28fa3316 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/stepToSameLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/stepToSameLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/stepToSmallerLast.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/stepToSmallerLast.kt index 47df12a9f6d..58edec1f152 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/stepToSmallerLast.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/stepToSmallerLast.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/zeroToMaxValueStepMaxValue.kt b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/zeroToMaxValueStepMaxValue.kt index b5588df8204..71a852c16fe 100644 --- a/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/zeroToMaxValueStepMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/stepped/unsigned/literal/until/zeroToMaxValueStepMaxValue.kt @@ -1,5 +1,4 @@ // Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME // DONT_TARGET_EXACT_BACKEND: WASM // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/unsigned/expression/emptyDownto.kt b/compiler/testData/codegen/box/ranges/unsigned/expression/emptyDownto.kt index 1ff9e282c4f..72c639a788e 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/expression/emptyDownto.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/expression/emptyDownto.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME diff --git a/compiler/testData/codegen/box/ranges/unsigned/expression/inexactDownToMinValue.kt b/compiler/testData/codegen/box/ranges/unsigned/expression/inexactDownToMinValue.kt index 8bbb74d69e5..174c6ac583f 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/expression/inexactDownToMinValue.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/expression/inexactDownToMinValue.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME val MinUI = UInt.MIN_VALUE diff --git a/compiler/testData/codegen/box/ranges/unsigned/expression/inexactSteppedDownTo.kt b/compiler/testData/codegen/box/ranges/unsigned/expression/inexactSteppedDownTo.kt index 1d5bff89e9a..27e13195878 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/expression/inexactSteppedDownTo.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/expression/inexactSteppedDownTo.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME diff --git a/compiler/testData/codegen/box/ranges/unsigned/expression/inexactToMaxValue.kt b/compiler/testData/codegen/box/ranges/unsigned/expression/inexactToMaxValue.kt index 439c294a09a..67d3c78628c 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/expression/inexactToMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/expression/inexactToMaxValue.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME val MaxUI = UInt.MAX_VALUE diff --git a/compiler/testData/codegen/box/ranges/unsigned/expression/maxValueMinusTwoToMaxValue.kt b/compiler/testData/codegen/box/ranges/unsigned/expression/maxValueMinusTwoToMaxValue.kt index c4fb4602186..1afbcf9d366 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/expression/maxValueMinusTwoToMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/expression/maxValueMinusTwoToMaxValue.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME val MaxUI = UInt.MAX_VALUE diff --git a/compiler/testData/codegen/box/ranges/unsigned/expression/oneElementDownTo.kt b/compiler/testData/codegen/box/ranges/unsigned/expression/oneElementDownTo.kt index f4fe1419e50..d30a088fed9 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/expression/oneElementDownTo.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/expression/oneElementDownTo.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME diff --git a/compiler/testData/codegen/box/ranges/unsigned/expression/openRange.kt b/compiler/testData/codegen/box/ranges/unsigned/expression/openRange.kt index c5e1e00da67..633650bc000 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/expression/openRange.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/expression/openRange.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME diff --git a/compiler/testData/codegen/box/ranges/unsigned/expression/overflowZeroDownToMaxValue.kt b/compiler/testData/codegen/box/ranges/unsigned/expression/overflowZeroDownToMaxValue.kt index feb4e3f0896..e7ad04c973d 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/expression/overflowZeroDownToMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/expression/overflowZeroDownToMaxValue.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME val MaxUI = UInt.MAX_VALUE diff --git a/compiler/testData/codegen/box/ranges/unsigned/expression/overflowZeroToMinValue.kt b/compiler/testData/codegen/box/ranges/unsigned/expression/overflowZeroToMinValue.kt index 888397e8db4..e711519081f 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/expression/overflowZeroToMinValue.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/expression/overflowZeroToMinValue.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME val MinUI = UInt.MIN_VALUE diff --git a/compiler/testData/codegen/box/ranges/unsigned/expression/progressionDownToMinValue.kt b/compiler/testData/codegen/box/ranges/unsigned/expression/progressionDownToMinValue.kt index 5827077a824..44a451225e6 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/expression/progressionDownToMinValue.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/expression/progressionDownToMinValue.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME val MinUI = UInt.MIN_VALUE diff --git a/compiler/testData/codegen/box/ranges/unsigned/expression/progressionMaxValueMinusTwoToMaxValue.kt b/compiler/testData/codegen/box/ranges/unsigned/expression/progressionMaxValueMinusTwoToMaxValue.kt index 7bdd1a3b648..fe5b3c8cb68 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/expression/progressionMaxValueMinusTwoToMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/expression/progressionMaxValueMinusTwoToMaxValue.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME val MaxUI = UInt.MAX_VALUE diff --git a/compiler/testData/codegen/box/ranges/unsigned/expression/reversedBackSequence.kt b/compiler/testData/codegen/box/ranges/unsigned/expression/reversedBackSequence.kt index f2e2e7a908b..bb830c82d17 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/expression/reversedBackSequence.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/expression/reversedBackSequence.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME diff --git a/compiler/testData/codegen/box/ranges/unsigned/expression/reversedEmptyBackSequence.kt b/compiler/testData/codegen/box/ranges/unsigned/expression/reversedEmptyBackSequence.kt index 8b8b436009a..72081398d6c 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/expression/reversedEmptyBackSequence.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/expression/reversedEmptyBackSequence.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME diff --git a/compiler/testData/codegen/box/ranges/unsigned/expression/reversedInexactSteppedDownTo.kt b/compiler/testData/codegen/box/ranges/unsigned/expression/reversedInexactSteppedDownTo.kt index 2cfaa03b3af..b7d9e13fba1 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/expression/reversedInexactSteppedDownTo.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/expression/reversedInexactSteppedDownTo.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME diff --git a/compiler/testData/codegen/box/ranges/unsigned/expression/simpleDownTo.kt b/compiler/testData/codegen/box/ranges/unsigned/expression/simpleDownTo.kt index 47aad514755..cb6fa9aeab2 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/expression/simpleDownTo.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/expression/simpleDownTo.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME diff --git a/compiler/testData/codegen/box/ranges/unsigned/expression/simpleRangeWithNonConstantEnds.kt b/compiler/testData/codegen/box/ranges/unsigned/expression/simpleRangeWithNonConstantEnds.kt index 9ef611a0595..d744d23e068 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/expression/simpleRangeWithNonConstantEnds.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/expression/simpleRangeWithNonConstantEnds.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME diff --git a/compiler/testData/codegen/box/ranges/unsigned/expression/simpleSteppedDownTo.kt b/compiler/testData/codegen/box/ranges/unsigned/expression/simpleSteppedDownTo.kt index d82af91cad8..d6af23230a7 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/expression/simpleSteppedDownTo.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/expression/simpleSteppedDownTo.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME diff --git a/compiler/testData/codegen/box/ranges/unsigned/literal/inexactDownToMinValue.kt b/compiler/testData/codegen/box/ranges/unsigned/literal/inexactDownToMinValue.kt index 9bef579e85c..59f538569ed 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/literal/inexactDownToMinValue.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/literal/inexactDownToMinValue.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME val MinUI = UInt.MIN_VALUE diff --git a/compiler/testData/codegen/box/ranges/unsigned/literal/inexactToMaxValue.kt b/compiler/testData/codegen/box/ranges/unsigned/literal/inexactToMaxValue.kt index 6804272a2fc..7ea406af627 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/literal/inexactToMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/literal/inexactToMaxValue.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME val MaxUI = UInt.MAX_VALUE diff --git a/compiler/testData/codegen/box/ranges/unsigned/literal/maxValueMinusTwoToMaxValue.kt b/compiler/testData/codegen/box/ranges/unsigned/literal/maxValueMinusTwoToMaxValue.kt index e1dc3314485..7bdadad10be 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/literal/maxValueMinusTwoToMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/literal/maxValueMinusTwoToMaxValue.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME val MaxUI = UInt.MAX_VALUE diff --git a/compiler/testData/codegen/box/ranges/unsigned/literal/overflowZeroToMinValue.kt b/compiler/testData/codegen/box/ranges/unsigned/literal/overflowZeroToMinValue.kt index b5ce15e0eb9..d8240386829 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/literal/overflowZeroToMinValue.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/literal/overflowZeroToMinValue.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME val MinUI = UInt.MIN_VALUE diff --git a/compiler/testData/codegen/box/ranges/unsigned/literal/progressionDownToMinValue.kt b/compiler/testData/codegen/box/ranges/unsigned/literal/progressionDownToMinValue.kt index 72b09f093f1..171cf47fa8f 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/literal/progressionDownToMinValue.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/literal/progressionDownToMinValue.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME val MinUI = UInt.MIN_VALUE diff --git a/compiler/testData/codegen/box/ranges/unsigned/literal/progressionMaxValueMinusTwoToMaxValue.kt b/compiler/testData/codegen/box/ranges/unsigned/literal/progressionMaxValueMinusTwoToMaxValue.kt index a929162283a..1325586e0a0 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/literal/progressionMaxValueMinusTwoToMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/literal/progressionMaxValueMinusTwoToMaxValue.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME val MaxUI = UInt.MAX_VALUE diff --git a/compiler/testData/codegen/box/ranges/unsigned/literal/simpleRangeWithNonConstantEnds.kt b/compiler/testData/codegen/box/ranges/unsigned/literal/simpleRangeWithNonConstantEnds.kt index 23dd06b15f4..2ec1bfab108 100644 --- a/compiler/testData/codegen/box/ranges/unsigned/literal/simpleRangeWithNonConstantEnds.kt +++ b/compiler/testData/codegen/box/ranges/unsigned/literal/simpleRangeWithNonConstantEnds.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME diff --git a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateRangesCodegenTestData.java b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateRangesCodegenTestData.java index 8c536678c22..47706a4669a 100644 --- a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateRangesCodegenTestData.java +++ b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateRangesCodegenTestData.java @@ -74,35 +74,9 @@ public class GenerateRangesCodegenTestData { private static final List JVM_IR_FAILING_UNSIGNED_EXPRESSION_TESTS = Collections.emptyList(); - private static final List USE_OLD_MANGLING_IN_UNSIGNED_LITERAL_TESTS = new ArrayList() {{ - add("inexactDownToMinValue"); - add("progressionMaxValueMinusTwoToMaxValue"); - add("inexactToMaxValue"); - add("simpleRangeWithNonConstantEnds"); - add("maxValueMinusTwoToMaxValue"); - add("progressionDownToMinValue"); - add("overflowZeroToMinValue"); - }}; + private static final List USE_OLD_MANGLING_IN_UNSIGNED_LITERAL_TESTS = Collections.emptyList(); - private static final List USE_OLD_MANGLING_IN_UNSIGNED_EXPRESSION_TESTS = new ArrayList() {{ - add("inexactDownToMinValue"); - add("progressionMaxValueMinusTwoToMaxValue"); - add("inexactToMaxValue"); - add("simpleRangeWithNonConstantEnds"); - add("maxValueMinusTwoToMaxValue"); - add("progressionDownToMinValue"); - add("openRange"); - add("overflowZeroDownToMaxValue"); - add("reversedBackSequence"); - add("overflowZeroToMinValue"); - add("simpleDownTo"); - add("emptyDownto"); - add("reversedInexactSteppedDownTo"); - add("simpleSteppedDownTo"); - add("oneElementDownTo"); - add("reversedEmptyBackSequence"); - add("inexactSteppedDownTo"); - }}; + private static final List USE_OLD_MANGLING_IN_UNSIGNED_EXPRESSION_TESTS = Collections.emptyList(); static { for (String integerType : INTEGER_PRIMITIVES) { diff --git a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateSteppedRangesCodegenTestData.kt b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateSteppedRangesCodegenTestData.kt index ddd4132d684..d5642a3fe96 100644 --- a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateSteppedRangesCodegenTestData.kt +++ b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateSteppedRangesCodegenTestData.kt @@ -19,54 +19,7 @@ object GenerateSteppedRangesCodegenTestData { private val KT_34166_AFFECTED_FILENAMES = setOf("illegalStepZero.kt", "illegalStepNegative.kt", "illegalStepNonConst.kt") private val JVM_IR_FAILING_FOR_UNSIGNED_FILENAMES = setOf() - private val USE_OLD_MANGLING_SCHEME = setOf( - "minValueToMaxValueStepMaxValue.kt", - "zeroToMaxValueStepMaxValue.kt", - "emptyDownto.kt", - "emptyProgression.kt", - "emptyProgressionToMinValue.kt", - "illegalStepNegative.kt", - "illegalStepNonConst.kt", - "illegalStepThenLegalStep.kt", - "illegalStepZero.kt", - "inexactSteppedDownTo.kt", - "legalStepThenIllegalStep.kt", - "maxValueToMinValueStepMaxValue.kt", - "maxValueToOneStepMaxValue.kt", - "maxValueToZeroStepMaxValue.kt", - "mixedTypeStep.kt", - "oneElementDownTo.kt", - "openRange.kt", - "overflowZeroDownToMaxValue.kt", - "overflowZeroToMinValue.kt", - "progressionToNonConst.kt", - "reversedBackSequence.kt", - "reversedEmptyBackSequence.kt", - "reversedInexactSteppedDownTo.kt", - "reversedThenStep.kt", - "reversedThenStepThenReversed.kt", - "reversedThenStepThenReversedThenStep.kt", - "simpleDownTo.kt", - "simpleSteppedDownTo.kt", - "singleElementStepTwo.kt", - "stepNonConst.kt", - "stepOne.kt", - "stepOneThenStepOne.kt", - "stepThenReversed.kt", - "stepThenReversedThenStep.kt", - "stepThenReversedThenStepThenReversed.kt", - "stepThenSameStep.kt", - "stepToOutsideRange.kt", - "stepToSameLast.kt", - "stepToSameLastThenStepOne.kt", - "stepToSameLastThenStepToSameLast.kt", - "stepToSameLastThenStepToSmallerLast.kt", - "stepToSmallerLast.kt", - "stepToSmallerLastThenStepOne.kt", - "stepToSmallerLastThenStepToSameLast.kt", - "stepToSmallerLastThenStepToSmallerLast.kt", - "unsignedRangeIterator.kt", - ) + private val USE_OLD_MANGLING_SCHEME = emptySet() private enum class Type(val type: String, val isLong: Boolean = false, val isUnsigned: Boolean = false) { INT("Int"), From 1ee38286a8539985fded10f6aabacda868494bb6 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Fri, 27 Nov 2020 12:38:10 +0300 Subject: [PATCH 254/698] [TEST] Move generated compiler tests to `test-gen` directory --- compiler/build.gradle.kts | 11 +++++++++++ .../asJava/CompilerLightClassTestGenerated.java | 0 .../kotlin/cfg/ControlFlowTestGenerated.java | 0 .../jetbrains/kotlin/cfg/DataFlowTestGenerated.java | 0 .../DiagnosticsWithModifiedMockJdkTestGenerated.java | 0 .../kotlin/cfg/PseudoValueTestGenerated.java | 0 .../checkers/DiagnosticsNativeTestGenerated.java | 0 .../kotlin/checkers/DiagnosticsTestGenerated.java | 0 ...estWithJsStdLibAndBackendCompilationGenerated.java | 0 .../DiagnosticsTestWithJsStdLibGenerated.java | 0 .../DiagnosticsTestWithJvmIrBackendGenerated.java | 0 .../DiagnosticsTestWithOldJvmBackendGenerated.java | 0 .../checkers/DiagnosticsTestWithStdLibGenerated.java | 0 .../checkers/DiagnosticsWithExplicitApiGenerated.java | 0 .../checkers/DiagnosticsWithJdk9TestGenerated.java | 0 .../DiagnosticsWithUnsignedTypesGenerated.java | 0 ...notationsNoAnnotationInClasspathTestGenerated.java | 0 ...onInClasspathWithPsiClassReadingTestGenerated.java | 0 .../checkers/ForeignAnnotationsTestGenerated.java | 0 .../DiagnosticsTestWithStdLibUsingJavacGenerated.java | 0 .../javac/DiagnosticsUsingJavacTestGenerated.java | 0 .../checkers/javac/JavacDiagnosticsTestGenerated.java | 0 .../javac/JavacFieldResolutionTestGenerated.java | 0 .../javac/JavacForeignAnnotationsTestGenerated.java | 0 .../org/jetbrains/kotlin/cli/CliTestGenerated.java | 0 .../AsmLikeInstructionListingTestGenerated.java | 0 .../BlackBoxAgainstJavaCodegenTestGenerated.java | 0 .../kotlin/codegen/BlackBoxCodegenTestGenerated.java | 0 .../codegen/BlackBoxInlineCodegenTestGenerated.java | 0 .../kotlin/codegen/BytecodeListingTestGenerated.java | 0 .../kotlin/codegen/BytecodeTextTestGenerated.java | 0 .../CheckLocalVariablesTableTestGenerated.java | 0 ...CompileKotlinAgainstInlineKotlinTestGenerated.java | 0 .../CompileKotlinAgainstKotlinTestGenerated.java | 0 .../codegen/CustomScriptCodegenTestGenerated.java | 0 .../kotlin/codegen/DumpDeclarationsTestGenerated.java | 0 .../Kapt3BuilderModeBytecodeShapeTestGenerated.java | 0 .../codegen/LightAnalysisModeTestGenerated.java | 0 .../kotlin/codegen/ScriptCodegenTestGenerated.java | 0 .../TopLevelMembersInvocationTestGenerated.java | 0 .../IrLocalVariableTestGenerated.java | 0 .../debugInformation/IrSteppingTestGenerated.java | 0 .../debugInformation/LocalVariableTestGenerated.java | 0 .../debugInformation/SteppingTestGenerated.java | 0 .../DefaultArgumentsReflectionTestGenerated.java | 0 .../kotlin/codegen/flags/WriteFlagsTestGenerated.java | 0 .../ir/IrAsmLikeInstructionListingTestGenerated.java | 0 .../ir/IrBlackBoxAgainstJavaCodegenTestGenerated.java | 0 .../codegen/ir/IrBlackBoxCodegenTestGenerated.java | 0 .../ir/IrBlackBoxInlineCodegenTestGenerated.java | 0 .../codegen/ir/IrBytecodeListingTestGenerated.java | 0 .../codegen/ir/IrBytecodeTextTestGenerated.java | 0 .../ir/IrCheckLocalVariablesTableTestGenerated.java | 0 ...CompileKotlinAgainstInlineKotlinTestGenerated.java | 0 .../ir/IrCompileKotlinAgainstKotlinTestGenerated.java | 0 .../codegen/ir/IrScriptCodegenTestGenerated.java | 0 .../kotlin/codegen/ir/IrWriteFlagsTestGenerated.java | 0 .../codegen/ir/IrWriteSignatureTestGenerated.java | 0 .../ir/JvmIrAgainstOldBoxInlineTestGenerated.java | 0 .../codegen/ir/JvmIrAgainstOldBoxTestGenerated.java | 0 .../ir/JvmOldAgainstIrBoxInlineTestGenerated.java | 0 .../codegen/ir/JvmOldAgainstIrBoxTestGenerated.java | 0 .../kotlin/integration/AntTaskTestGenerated.java | 0 .../jetbrains/kotlin/ir/IrCfgTestCaseGenerated.java | 0 .../kotlin/ir/IrJsTextTestCaseGenerated.java | 0 .../kotlin/ir/IrSourceRangesTestCaseGenerated.java | 0 .../jetbrains/kotlin/ir/IrTextTestCaseGenerated.java | 0 .../CompileJavaAgainstKotlinTestGenerated.java | 0 .../CompileKotlinAgainstJavaTestGenerated.java | 0 .../kotlin/jvm/compiler/LoadJavaTestGenerated.java | 0 .../LoadJavaWithPsiClassReadingTestGenerated.java | 0 .../LoadKotlinWithTypeTableTestGenerated.java | 0 .../jvm/compiler/WriteSignatureTestGenerated.java | 0 .../ir/IrCompileJavaAgainstKotlinTestGenerated.java | 0 .../ir/IrCompileKotlinAgainstJavaTestGenerated.java | 0 .../jvm/compiler/ir/IrLoadJavaTestGenerated.java | 0 .../javac/LoadJavaUsingJavacTestGenerated.java | 0 .../kotlin/lexer/kdoc/KDocLexerTestGenerated.java | 0 .../kotlin/lexer/kotlin/KotlinLexerTestGenerated.java | 0 .../modules/xml/ModuleXmlParserTestGenerated.java | 0 .../MultiPlatformIntegrationTestGenerated.java | 0 .../kotlin/parsing/ParsingTestGenerated.java | 0 .../renderer/DescriptorRendererTestGenerated.java | 0 ...onDescriptorInExpressionRendererTestGenerated.java | 0 .../kotlin/repl/ReplInterpreterTestGenerated.java | 0 .../kotlin/resolve/ResolveTestGenerated.java | 0 .../annotation/AnnotationParameterTestGenerated.java | 0 .../resolve/calls/ResolvedCallsTestGenerated.java | 0 ...olvedConstructorDelegationCallsTestsGenerated.java | 0 .../CompileTimeConstantEvaluatorTestGenerated.java | 0 .../ConstraintSystemTestGenerated.java | 0 .../serialization/LocalClassProtoTestGenerated.java | 0 .../kotlin/types/TypeBindingTestGenerated.java | 0 .../kotlin/generators/tests/GenerateCompilerTests.kt | 4 ++-- 94 files changed, 13 insertions(+), 2 deletions(-) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/asJava/CompilerLightClassTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/cfg/ControlFlowTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/cfg/DataFlowTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/cfg/DiagnosticsWithModifiedMockJdkTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/cfg/PseudoValueTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/checkers/DiagnosticsNativeTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJsStdLibAndBackendCompilationGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJsStdLibGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJvmIrBackendGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/checkers/DiagnosticsTestWithOldJvmBackendGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/checkers/DiagnosticsWithExplicitApiGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk9TestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/checkers/DiagnosticsWithUnsignedTypesGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/checkers/ForeignAnnotationsNoAnnotationInClasspathTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/checkers/ForeignAnnotationsNoAnnotationInClasspathWithPsiClassReadingTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/checkers/ForeignAnnotationsTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/checkers/javac/JavacDiagnosticsTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/checkers/javac/JavacFieldResolutionTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/checkers/javac/JavacForeignAnnotationsTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/cli/CliTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/AsmLikeInstructionListingTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/BlackBoxAgainstJavaCodegenTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/CheckLocalVariablesTableTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/CustomScriptCodegenTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/DumpDeclarationsTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/Kapt3BuilderModeBytecodeShapeTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/ScriptCodegenTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/TopLevelMembersInvocationTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/debugInformation/IrLocalVariableTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/debugInformation/IrSteppingTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/debugInformation/LocalVariableTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/debugInformation/SteppingTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/defaultConstructor/DefaultArgumentsReflectionTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/flags/WriteFlagsTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/ir/IrAsmLikeInstructionListingTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/ir/IrBlackBoxAgainstJavaCodegenTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/ir/IrCheckLocalVariablesTableTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/ir/IrScriptCodegenTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/ir/IrWriteFlagsTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/ir/IrWriteSignatureTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxInlineTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxInlineTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/integration/AntTaskTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/ir/IrCfgTestCaseGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/ir/IrJsTextTestCaseGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/ir/IrSourceRangesTestCaseGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/jvm/compiler/CompileJavaAgainstKotlinTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstJavaTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/jvm/compiler/LoadJavaTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/jvm/compiler/LoadJavaWithPsiClassReadingTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/jvm/compiler/LoadKotlinWithTypeTableTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/jvm/compiler/WriteSignatureTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/jvm/compiler/ir/IrCompileJavaAgainstKotlinTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/jvm/compiler/ir/IrCompileKotlinAgainstJavaTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/jvm/compiler/ir/IrLoadJavaTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/jvm/compiler/javac/LoadJavaUsingJavacTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/lexer/kdoc/KDocLexerTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/lexer/kotlin/KotlinLexerTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/modules/xml/ModuleXmlParserTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/multiplatform/MultiPlatformIntegrationTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/renderer/DescriptorRendererTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/renderer/FunctionDescriptorInExpressionRendererTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/repl/ReplInterpreterTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/resolve/ResolveTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/resolve/annotation/AnnotationParameterTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/resolve/calls/ResolvedCallsTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/resolve/calls/ResolvedConstructorDelegationCallsTestsGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/resolve/constants/evaluate/CompileTimeConstantEvaluatorTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/resolve/constraintSystem/ConstraintSystemTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/serialization/LocalClassProtoTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/types/TypeBindingTestGenerated.java (100%) diff --git a/compiler/build.gradle.kts b/compiler/build.gradle.kts index 117a754fa41..f2dc5e8c8bc 100644 --- a/compiler/build.gradle.kts +++ b/compiler/build.gradle.kts @@ -1,4 +1,5 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinCompile +import org.jetbrains.kotlin.ideaExt.idea import java.io.File plugins { @@ -69,10 +70,20 @@ dependencies { antLauncherJar(toolsJar()) } +val generationRoot = projectDir.resolve("tests-gen") + sourceSets { "main" {} "test" { projectDefault() + this.java.srcDir(generationRoot.name) + } +} + +if (kotlinBuildProperties.isInJpsBuildIdeaSync) { + apply(plugin = "idea") + idea { + this.module.generatedSourceDirs.add(generationRoot) } } diff --git a/compiler/tests/org/jetbrains/kotlin/asJava/CompilerLightClassTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/asJava/CompilerLightClassTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/asJava/CompilerLightClassTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/asJava/CompilerLightClassTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/cfg/ControlFlowTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/cfg/ControlFlowTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/cfg/ControlFlowTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/cfg/ControlFlowTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/cfg/DataFlowTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/cfg/DataFlowTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/cfg/DataFlowTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/cfg/DataFlowTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/cfg/DiagnosticsWithModifiedMockJdkTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/cfg/DiagnosticsWithModifiedMockJdkTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/cfg/DiagnosticsWithModifiedMockJdkTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/cfg/DiagnosticsWithModifiedMockJdkTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/cfg/PseudoValueTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/cfg/PseudoValueTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/cfg/PseudoValueTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/cfg/PseudoValueTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsNativeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsNativeTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsNativeTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsNativeTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJsStdLibAndBackendCompilationGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJsStdLibAndBackendCompilationGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJsStdLibAndBackendCompilationGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJsStdLibAndBackendCompilationGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJsStdLibGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJsStdLibGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJsStdLibGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJsStdLibGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJvmIrBackendGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJvmIrBackendGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJvmIrBackendGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJvmIrBackendGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithOldJvmBackendGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithOldJvmBackendGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithOldJvmBackendGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithOldJvmBackendGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithExplicitApiGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsWithExplicitApiGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithExplicitApiGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsWithExplicitApiGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk9TestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk9TestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk9TestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk9TestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithUnsignedTypesGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsWithUnsignedTypesGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithUnsignedTypesGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsWithUnsignedTypesGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/ForeignAnnotationsNoAnnotationInClasspathTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/ForeignAnnotationsNoAnnotationInClasspathTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/checkers/ForeignAnnotationsNoAnnotationInClasspathTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/checkers/ForeignAnnotationsNoAnnotationInClasspathTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/ForeignAnnotationsNoAnnotationInClasspathWithPsiClassReadingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/ForeignAnnotationsNoAnnotationInClasspathWithPsiClassReadingTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/checkers/ForeignAnnotationsNoAnnotationInClasspathWithPsiClassReadingTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/checkers/ForeignAnnotationsNoAnnotationInClasspathWithPsiClassReadingTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/ForeignAnnotationsTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/ForeignAnnotationsTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/checkers/ForeignAnnotationsTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/checkers/ForeignAnnotationsTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/JavacDiagnosticsTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/JavacDiagnosticsTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/checkers/javac/JavacDiagnosticsTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/JavacDiagnosticsTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/JavacFieldResolutionTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/JavacFieldResolutionTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/checkers/javac/JavacFieldResolutionTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/JavacFieldResolutionTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/JavacForeignAnnotationsTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/JavacForeignAnnotationsTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/checkers/javac/JavacForeignAnnotationsTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/JavacForeignAnnotationsTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/AsmLikeInstructionListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/AsmLikeInstructionListingTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/AsmLikeInstructionListingTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/AsmLikeInstructionListingTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxAgainstJavaCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxAgainstJavaCodegenTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxAgainstJavaCodegenTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxAgainstJavaCodegenTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/CheckLocalVariablesTableTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/CheckLocalVariablesTableTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/CheckLocalVariablesTableTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/CheckLocalVariablesTableTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/CustomScriptCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/CustomScriptCodegenTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/CustomScriptCodegenTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/CustomScriptCodegenTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/DumpDeclarationsTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/DumpDeclarationsTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/DumpDeclarationsTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/DumpDeclarationsTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/Kapt3BuilderModeBytecodeShapeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/Kapt3BuilderModeBytecodeShapeTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/Kapt3BuilderModeBytecodeShapeTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/Kapt3BuilderModeBytecodeShapeTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ScriptCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ScriptCodegenTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/ScriptCodegenTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/ScriptCodegenTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/TopLevelMembersInvocationTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/TopLevelMembersInvocationTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/TopLevelMembersInvocationTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/TopLevelMembersInvocationTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/debugInformation/IrLocalVariableTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/IrLocalVariableTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/debugInformation/IrLocalVariableTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/IrLocalVariableTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/debugInformation/IrSteppingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/IrSteppingTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/debugInformation/IrSteppingTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/IrSteppingTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/debugInformation/LocalVariableTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/LocalVariableTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/debugInformation/LocalVariableTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/LocalVariableTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/debugInformation/SteppingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/SteppingTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/debugInformation/SteppingTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/SteppingTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/defaultConstructor/DefaultArgumentsReflectionTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/defaultConstructor/DefaultArgumentsReflectionTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/defaultConstructor/DefaultArgumentsReflectionTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/defaultConstructor/DefaultArgumentsReflectionTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/flags/WriteFlagsTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/flags/WriteFlagsTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/flags/WriteFlagsTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/flags/WriteFlagsTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrAsmLikeInstructionListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrAsmLikeInstructionListingTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/ir/IrAsmLikeInstructionListingTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrAsmLikeInstructionListingTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxAgainstJavaCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxAgainstJavaCodegenTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxAgainstJavaCodegenTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxAgainstJavaCodegenTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCheckLocalVariablesTableTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCheckLocalVariablesTableTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCheckLocalVariablesTableTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCheckLocalVariablesTableTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrScriptCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrScriptCodegenTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/ir/IrScriptCodegenTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrScriptCodegenTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrWriteFlagsTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrWriteFlagsTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/ir/IrWriteFlagsTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrWriteFlagsTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrWriteSignatureTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrWriteSignatureTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/ir/IrWriteSignatureTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrWriteSignatureTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxInlineTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxInlineTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxInlineTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxInlineTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxInlineTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxInlineTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxInlineTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxInlineTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/integration/AntTaskTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/integration/AntTaskTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/integration/AntTaskTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/integration/AntTaskTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrCfgTestCaseGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/ir/IrCfgTestCaseGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/ir/IrCfgTestCaseGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/ir/IrCfgTestCaseGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrJsTextTestCaseGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/ir/IrJsTextTestCaseGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/ir/IrJsTextTestCaseGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/ir/IrJsTextTestCaseGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrSourceRangesTestCaseGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/ir/IrSourceRangesTestCaseGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/ir/IrSourceRangesTestCaseGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/ir/IrSourceRangesTestCaseGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileJavaAgainstKotlinTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/CompileJavaAgainstKotlinTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileJavaAgainstKotlinTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/CompileJavaAgainstKotlinTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstJavaTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstJavaTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstJavaTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstJavaTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJavaTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/LoadJavaTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJavaTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/LoadJavaTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJavaWithPsiClassReadingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/LoadJavaWithPsiClassReadingTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJavaWithPsiClassReadingTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/LoadJavaWithPsiClassReadingTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadKotlinWithTypeTableTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/LoadKotlinWithTypeTableTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadKotlinWithTypeTableTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/LoadKotlinWithTypeTableTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/WriteSignatureTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/WriteSignatureTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/jvm/compiler/WriteSignatureTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/WriteSignatureTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/ir/IrCompileJavaAgainstKotlinTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/ir/IrCompileJavaAgainstKotlinTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/jvm/compiler/ir/IrCompileJavaAgainstKotlinTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/ir/IrCompileJavaAgainstKotlinTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/ir/IrCompileKotlinAgainstJavaTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/ir/IrCompileKotlinAgainstJavaTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/jvm/compiler/ir/IrCompileKotlinAgainstJavaTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/ir/IrCompileKotlinAgainstJavaTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/ir/IrLoadJavaTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/ir/IrLoadJavaTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/jvm/compiler/ir/IrLoadJavaTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/ir/IrLoadJavaTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/javac/LoadJavaUsingJavacTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/javac/LoadJavaUsingJavacTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/jvm/compiler/javac/LoadJavaUsingJavacTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/javac/LoadJavaUsingJavacTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/lexer/kdoc/KDocLexerTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/lexer/kdoc/KDocLexerTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/lexer/kdoc/KDocLexerTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/lexer/kdoc/KDocLexerTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/lexer/kotlin/KotlinLexerTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/lexer/kotlin/KotlinLexerTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/lexer/kotlin/KotlinLexerTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/lexer/kotlin/KotlinLexerTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/modules/xml/ModuleXmlParserTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/modules/xml/ModuleXmlParserTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/modules/xml/ModuleXmlParserTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/modules/xml/ModuleXmlParserTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/multiplatform/MultiPlatformIntegrationTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/multiplatform/MultiPlatformIntegrationTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/multiplatform/MultiPlatformIntegrationTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/multiplatform/MultiPlatformIntegrationTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/renderer/DescriptorRendererTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/renderer/DescriptorRendererTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/renderer/DescriptorRendererTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/renderer/DescriptorRendererTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/renderer/FunctionDescriptorInExpressionRendererTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/renderer/FunctionDescriptorInExpressionRendererTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/renderer/FunctionDescriptorInExpressionRendererTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/renderer/FunctionDescriptorInExpressionRendererTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/repl/ReplInterpreterTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/repl/ReplInterpreterTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/repl/ReplInterpreterTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/repl/ReplInterpreterTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/resolve/ResolveTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/resolve/ResolveTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/resolve/ResolveTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/resolve/ResolveTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/resolve/annotation/AnnotationParameterTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/resolve/annotation/AnnotationParameterTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/resolve/annotation/AnnotationParameterTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/resolve/annotation/AnnotationParameterTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/resolve/calls/ResolvedCallsTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/resolve/calls/ResolvedCallsTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/resolve/calls/ResolvedCallsTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/resolve/calls/ResolvedCallsTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/resolve/calls/ResolvedConstructorDelegationCallsTestsGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/resolve/calls/ResolvedConstructorDelegationCallsTestsGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/resolve/calls/ResolvedConstructorDelegationCallsTestsGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/resolve/calls/ResolvedConstructorDelegationCallsTestsGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/resolve/constants/evaluate/CompileTimeConstantEvaluatorTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/resolve/constants/evaluate/CompileTimeConstantEvaluatorTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/resolve/constants/evaluate/CompileTimeConstantEvaluatorTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/resolve/constants/evaluate/CompileTimeConstantEvaluatorTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/resolve/constraintSystem/ConstraintSystemTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/resolve/constraintSystem/ConstraintSystemTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/resolve/constraintSystem/ConstraintSystemTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/resolve/constraintSystem/ConstraintSystemTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/serialization/LocalClassProtoTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/serialization/LocalClassProtoTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/serialization/LocalClassProtoTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/serialization/LocalClassProtoTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/types/TypeBindingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/types/TypeBindingTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/types/TypeBindingTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/types/TypeBindingTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt index baa0aa3778c..c47cb5326af 100644 --- a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt +++ b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt @@ -69,7 +69,7 @@ fun main(args: Array) { val excludedFirTestdataPattern = "^(.+)\\.fir\\.kts?\$" testGroupSuite(args) { - testGroup("compiler/tests", "compiler/testData") { + testGroup("compiler/tests-gen", "compiler/testData") { testClass(suiteTestClassName = "DiagnosticsTestGenerated") { model("diagnostics/tests", pattern = "^(.*)\\.kts?$", excludedPattern = excludedFirTestdataPattern) model("codegen/box/diagnostics") @@ -590,7 +590,7 @@ fun main(args: Array) { } testGroup( - "compiler/tests", "compiler/testData", + "compiler/tests-gen", "compiler/testData", testRunnerMethodName = "runTestWithCustomIgnoreDirective", additionalRunnerArguments = listOf("\"// IGNORE_BACKEND_MULTI_MODULE: \"") ) { From eca769f8e442967c494f9150dec2cb35f8911bbf Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Fri, 27 Nov 2020 12:46:47 +0300 Subject: [PATCH 255/698] [TEST] Move generated fir tests to `test-gen` directories --- compiler/fir/analysis-tests/build.gradle.kts | 16 ++++++++++- .../ExtendedFirDiagnosticsTestGenerated.java | 0 ...WithLightTreeDiagnosticsTestGenerated.java | 0 .../fir/FirDiagnosticsTestGenerated.java | 0 ...DiagnosticsWithLightTreeTestGenerated.java | 0 ...FirDiagnosticsWithStdlibTestGenerated.java | 0 .../fir/FirLoadCompiledKotlinGenerated.java | 0 ...irOldFrontendDiagnosticsTestGenerated.java | 0 ...endDiagnosticsTestWithStdlibGenerated.java | 0 ...TouchedTilContractsPhaseTestGenerated.java | 0 ...rOldFrontendLightClassesTestGenerated.java | 0 .../java/FirTypeEnhancementTestGenerated.java | 0 .../OwnFirTypeEnhancementTestGenerated.java | 0 compiler/fir/fir2ir/build.gradle.kts | 16 ++++++++++- ...mpileKotlinAgainstKotlinTestGenerated.java | 0 ...ackBoxAgainstJavaCodegenTestGenerated.java | 0 .../ir/FirBlackBoxCodegenTestGenerated.java | 0 ...FirBlackBoxInlineCodegenTestGenerated.java | 0 .../ir/FirBytecodeTextTestGenerated.java | 0 .../kotlin/fir/Fir2IrTextTestGenerated.java | 0 .../raw-fir/light-tree2fir/build.gradle.kts | 16 ++++++++++- ...ghtTree2FirConverterTestCaseGenerated.java | 0 compiler/fir/raw-fir/psi2fir/build.gradle.kts | 16 ++++++++++- ...PartialRawFirBuilderTestCaseGenerated.java | 0 ...FirBuilderLazyBodiesTestCaseGenerated.java | 0 ...SourceElementMappingTestCaseGenerated.java | 0 .../RawFirBuilderTestCaseGenerated.java | 0 ...rceElementUniquenessTestCaseGenerated.java | 0 .../generators/tests/GenerateCompilerTests.kt | 28 +++++++++---------- 29 files changed, 74 insertions(+), 18 deletions(-) rename compiler/fir/analysis-tests/{tests => tests-gen}/org/jetbrains/kotlin/fir/ExtendedFirDiagnosticsTestGenerated.java (100%) rename compiler/fir/analysis-tests/{tests => tests-gen}/org/jetbrains/kotlin/fir/ExtendedFirWithLightTreeDiagnosticsTestGenerated.java (100%) rename compiler/fir/analysis-tests/{tests => tests-gen}/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java (100%) rename compiler/fir/analysis-tests/{tests => tests-gen}/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java (100%) rename compiler/fir/analysis-tests/{tests => tests-gen}/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java (100%) rename compiler/fir/analysis-tests/{tests => tests-gen}/org/jetbrains/kotlin/fir/FirLoadCompiledKotlinGenerated.java (100%) rename compiler/fir/analysis-tests/{tests => tests-gen}/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java (100%) rename compiler/fir/analysis-tests/{tests => tests-gen}/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java (100%) rename compiler/fir/analysis-tests/{tests => tests-gen}/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java (100%) rename compiler/fir/analysis-tests/{tests => tests-gen}/org/jetbrains/kotlin/fir/java/FirOldFrontendLightClassesTestGenerated.java (100%) rename compiler/fir/analysis-tests/{tests => tests-gen}/org/jetbrains/kotlin/fir/java/FirTypeEnhancementTestGenerated.java (100%) rename compiler/fir/analysis-tests/{tests => tests-gen}/org/jetbrains/kotlin/fir/java/OwnFirTypeEnhancementTestGenerated.java (100%) rename compiler/fir/fir2ir/{tests => tests-gen}/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java (100%) rename compiler/fir/fir2ir/{tests => tests-gen}/org/jetbrains/kotlin/codegen/ir/FirBlackBoxAgainstJavaCodegenTestGenerated.java (100%) rename compiler/fir/fir2ir/{tests => tests-gen}/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java (100%) rename compiler/fir/fir2ir/{tests => tests-gen}/org/jetbrains/kotlin/codegen/ir/FirBlackBoxInlineCodegenTestGenerated.java (100%) rename compiler/fir/fir2ir/{tests => tests-gen}/org/jetbrains/kotlin/codegen/ir/FirBytecodeTextTestGenerated.java (100%) rename compiler/fir/fir2ir/{tests => tests-gen}/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java (100%) rename compiler/fir/raw-fir/light-tree2fir/{tests => tests-gen}/org/jetbrains/kotlin/fir/lightTree/LightTree2FirConverterTestCaseGenerated.java (100%) rename compiler/fir/raw-fir/psi2fir/{tests => tests-gen}/org/jetbrains/kotlin/fir/builder/PartialRawFirBuilderTestCaseGenerated.java (100%) rename compiler/fir/raw-fir/psi2fir/{tests => tests-gen}/org/jetbrains/kotlin/fir/builder/RawFirBuilderLazyBodiesTestCaseGenerated.java (100%) rename compiler/fir/raw-fir/psi2fir/{tests => tests-gen}/org/jetbrains/kotlin/fir/builder/RawFirBuilderSourceElementMappingTestCaseGenerated.java (100%) rename compiler/fir/raw-fir/psi2fir/{tests => tests-gen}/org/jetbrains/kotlin/fir/builder/RawFirBuilderTestCaseGenerated.java (100%) delete mode 100644 compiler/fir/raw-fir/psi2fir/tests/org/jetbrains/kotlin/fir/builder/RawFirBuilderSourceElementUniquenessTestCaseGenerated.java diff --git a/compiler/fir/analysis-tests/build.gradle.kts b/compiler/fir/analysis-tests/build.gradle.kts index 1dfff8ea7b3..f615e816581 100644 --- a/compiler/fir/analysis-tests/build.gradle.kts +++ b/compiler/fir/analysis-tests/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.ideaExt.idea + /* * Copyright 2000-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. @@ -29,9 +31,21 @@ dependencies { testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") } } +val generationRoot = projectDir.resolve("tests-gen") + sourceSets { "main" { none() } - "test" { projectDefault() } + "test" { + projectDefault() + this.java.srcDir(generationRoot.name) + } +} + +if (kotlinBuildProperties.isInJpsBuildIdeaSync) { + apply(plugin = "idea") + idea { + this.module.generatedSourceDirs.add(generationRoot) + } } projectTest(parallel = true) { diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/ExtendedFirDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/ExtendedFirDiagnosticsTestGenerated.java similarity index 100% rename from compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/ExtendedFirDiagnosticsTestGenerated.java rename to compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/ExtendedFirDiagnosticsTestGenerated.java diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/ExtendedFirWithLightTreeDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/ExtendedFirWithLightTreeDiagnosticsTestGenerated.java similarity index 100% rename from compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/ExtendedFirWithLightTreeDiagnosticsTestGenerated.java rename to compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/ExtendedFirWithLightTreeDiagnosticsTestGenerated.java diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java similarity index 100% rename from compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java rename to compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java similarity index 100% rename from compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java rename to compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java similarity index 100% rename from compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java rename to compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirLoadCompiledKotlinGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirLoadCompiledKotlinGenerated.java similarity index 100% rename from compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirLoadCompiledKotlinGenerated.java rename to compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirLoadCompiledKotlinGenerated.java diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java similarity index 100% rename from compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java rename to compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java similarity index 100% rename from compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java rename to compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java similarity index 100% rename from compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java rename to compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/java/FirOldFrontendLightClassesTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/java/FirOldFrontendLightClassesTestGenerated.java similarity index 100% rename from compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/java/FirOldFrontendLightClassesTestGenerated.java rename to compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/java/FirOldFrontendLightClassesTestGenerated.java diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/java/FirTypeEnhancementTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/java/FirTypeEnhancementTestGenerated.java similarity index 100% rename from compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/java/FirTypeEnhancementTestGenerated.java rename to compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/java/FirTypeEnhancementTestGenerated.java diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/java/OwnFirTypeEnhancementTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/java/OwnFirTypeEnhancementTestGenerated.java similarity index 100% rename from compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/java/OwnFirTypeEnhancementTestGenerated.java rename to compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/java/OwnFirTypeEnhancementTestGenerated.java diff --git a/compiler/fir/fir2ir/build.gradle.kts b/compiler/fir/fir2ir/build.gradle.kts index 95b0cd77661..78323a18eb1 100644 --- a/compiler/fir/fir2ir/build.gradle.kts +++ b/compiler/fir/fir2ir/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.ideaExt.idea + plugins { kotlin("jvm") id("jps-compatible") @@ -34,9 +36,21 @@ dependencies { testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") } } +val generationRoot = projectDir.resolve("tests-gen") + sourceSets { "main" { projectDefault() } - "test" { projectDefault() } + "test" { + projectDefault() + this.java.srcDir(generationRoot.name) + } +} + +if (kotlinBuildProperties.isInJpsBuildIdeaSync) { + apply(plugin = "idea") + idea { + this.module.generatedSourceDirs.add(generationRoot) + } } projectTest(parallel = true) { diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java similarity index 100% rename from compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java rename to compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxAgainstJavaCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxAgainstJavaCodegenTestGenerated.java similarity index 100% rename from compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxAgainstJavaCodegenTestGenerated.java rename to compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxAgainstJavaCodegenTestGenerated.java diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java similarity index 100% rename from compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java rename to compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxInlineCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxInlineCodegenTestGenerated.java similarity index 100% rename from compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxInlineCodegenTestGenerated.java rename to compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxInlineCodegenTestGenerated.java diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBytecodeTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBytecodeTextTestGenerated.java similarity index 100% rename from compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBytecodeTextTestGenerated.java rename to compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBytecodeTextTestGenerated.java diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java similarity index 100% rename from compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java rename to compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java diff --git a/compiler/fir/raw-fir/light-tree2fir/build.gradle.kts b/compiler/fir/raw-fir/light-tree2fir/build.gradle.kts index bcc7084e362..59f66027527 100644 --- a/compiler/fir/raw-fir/light-tree2fir/build.gradle.kts +++ b/compiler/fir/raw-fir/light-tree2fir/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.ideaExt.idea + plugins { kotlin("jvm") id("jps-compatible") @@ -41,9 +43,21 @@ dependencies { testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") } } +val generationRoot = projectDir.resolve("tests-gen") + sourceSets { "main" { projectDefault() } - "test" { projectDefault() } + "test" { + projectDefault() + this.java.srcDir(generationRoot.name) + } +} + +if (kotlinBuildProperties.isInJpsBuildIdeaSync) { + apply(plugin = "idea") + idea { + this.module.generatedSourceDirs.add(generationRoot) + } } projectTest { diff --git a/compiler/fir/raw-fir/light-tree2fir/tests/org/jetbrains/kotlin/fir/lightTree/LightTree2FirConverterTestCaseGenerated.java b/compiler/fir/raw-fir/light-tree2fir/tests-gen/org/jetbrains/kotlin/fir/lightTree/LightTree2FirConverterTestCaseGenerated.java similarity index 100% rename from compiler/fir/raw-fir/light-tree2fir/tests/org/jetbrains/kotlin/fir/lightTree/LightTree2FirConverterTestCaseGenerated.java rename to compiler/fir/raw-fir/light-tree2fir/tests-gen/org/jetbrains/kotlin/fir/lightTree/LightTree2FirConverterTestCaseGenerated.java diff --git a/compiler/fir/raw-fir/psi2fir/build.gradle.kts b/compiler/fir/raw-fir/psi2fir/build.gradle.kts index 11ff63bdef9..881ec8a0643 100644 --- a/compiler/fir/raw-fir/psi2fir/build.gradle.kts +++ b/compiler/fir/raw-fir/psi2fir/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.ideaExt.idea + /* * Copyright 2000-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. @@ -31,9 +33,21 @@ dependencies { testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") } } +val generationRoot = projectDir.resolve("tests-gen") + sourceSets { "main" { projectDefault() } - "test" { projectDefault() } + "test" { + projectDefault() + this.java.srcDir(generationRoot.name) + } +} + +if (kotlinBuildProperties.isInJpsBuildIdeaSync) { + apply(plugin = "idea") + idea { + this.module.generatedSourceDirs.add(generationRoot) + } } projectTest(parallel = true) { diff --git a/compiler/fir/raw-fir/psi2fir/tests/org/jetbrains/kotlin/fir/builder/PartialRawFirBuilderTestCaseGenerated.java b/compiler/fir/raw-fir/psi2fir/tests-gen/org/jetbrains/kotlin/fir/builder/PartialRawFirBuilderTestCaseGenerated.java similarity index 100% rename from compiler/fir/raw-fir/psi2fir/tests/org/jetbrains/kotlin/fir/builder/PartialRawFirBuilderTestCaseGenerated.java rename to compiler/fir/raw-fir/psi2fir/tests-gen/org/jetbrains/kotlin/fir/builder/PartialRawFirBuilderTestCaseGenerated.java diff --git a/compiler/fir/raw-fir/psi2fir/tests/org/jetbrains/kotlin/fir/builder/RawFirBuilderLazyBodiesTestCaseGenerated.java b/compiler/fir/raw-fir/psi2fir/tests-gen/org/jetbrains/kotlin/fir/builder/RawFirBuilderLazyBodiesTestCaseGenerated.java similarity index 100% rename from compiler/fir/raw-fir/psi2fir/tests/org/jetbrains/kotlin/fir/builder/RawFirBuilderLazyBodiesTestCaseGenerated.java rename to compiler/fir/raw-fir/psi2fir/tests-gen/org/jetbrains/kotlin/fir/builder/RawFirBuilderLazyBodiesTestCaseGenerated.java diff --git a/compiler/fir/raw-fir/psi2fir/tests/org/jetbrains/kotlin/fir/builder/RawFirBuilderSourceElementMappingTestCaseGenerated.java b/compiler/fir/raw-fir/psi2fir/tests-gen/org/jetbrains/kotlin/fir/builder/RawFirBuilderSourceElementMappingTestCaseGenerated.java similarity index 100% rename from compiler/fir/raw-fir/psi2fir/tests/org/jetbrains/kotlin/fir/builder/RawFirBuilderSourceElementMappingTestCaseGenerated.java rename to compiler/fir/raw-fir/psi2fir/tests-gen/org/jetbrains/kotlin/fir/builder/RawFirBuilderSourceElementMappingTestCaseGenerated.java diff --git a/compiler/fir/raw-fir/psi2fir/tests/org/jetbrains/kotlin/fir/builder/RawFirBuilderTestCaseGenerated.java b/compiler/fir/raw-fir/psi2fir/tests-gen/org/jetbrains/kotlin/fir/builder/RawFirBuilderTestCaseGenerated.java similarity index 100% rename from compiler/fir/raw-fir/psi2fir/tests/org/jetbrains/kotlin/fir/builder/RawFirBuilderTestCaseGenerated.java rename to compiler/fir/raw-fir/psi2fir/tests-gen/org/jetbrains/kotlin/fir/builder/RawFirBuilderTestCaseGenerated.java diff --git a/compiler/fir/raw-fir/psi2fir/tests/org/jetbrains/kotlin/fir/builder/RawFirBuilderSourceElementUniquenessTestCaseGenerated.java b/compiler/fir/raw-fir/psi2fir/tests/org/jetbrains/kotlin/fir/builder/RawFirBuilderSourceElementUniquenessTestCaseGenerated.java deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt index c47cb5326af..d1c7d71d462 100644 --- a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt +++ b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt @@ -564,7 +564,7 @@ fun main(args: Array) { } testGroup( - "compiler/fir/fir2ir/tests", "compiler/testData", + "compiler/fir/fir2ir/tests-gen", "compiler/testData", testRunnerMethodName = "runTestWithCustomIgnoreDirective", additionalRunnerArguments = listOf("\"// IGNORE_BACKEND_FIR: \"") ) { @@ -612,7 +612,7 @@ fun main(args: Array) { } } - testGroup("compiler/fir/raw-fir/psi2fir/tests", "compiler/fir/raw-fir/psi2fir/testData") { + testGroup("compiler/fir/raw-fir/psi2fir/tests-gen", "compiler/fir/raw-fir/psi2fir/testData") { testClass { model("rawBuilder", testMethod = "doRawFirTest") } @@ -626,19 +626,19 @@ fun main(args: Array) { } } - testGroup("compiler/fir/raw-fir/psi2fir/tests", "compiler/fir/raw-fir/psi2fir/testData") { + testGroup("compiler/fir/raw-fir/psi2fir/tests-gen", "compiler/fir/raw-fir/psi2fir/testData") { testClass { model("partialRawBuilder", testMethod = "doRawFirTest") } } - testGroup("compiler/fir/raw-fir/light-tree2fir/tests", "compiler/fir/raw-fir/psi2fir/testData") { + testGroup("compiler/fir/raw-fir/light-tree2fir/tests-gen", "compiler/fir/raw-fir/psi2fir/testData") { testClass { model("rawBuilder") } } - testGroup("compiler/fir/analysis-tests/tests", "compiler/fir/analysis-tests/testData") { + testGroup("compiler/fir/analysis-tests/tests-gen", "compiler/fir/analysis-tests/testData") { testClass { model("resolve", pattern = KT_WITHOUT_DOTS_IN_NAME) } @@ -653,31 +653,31 @@ fun main(args: Array) { } - testGroup("compiler/fir/analysis-tests/tests", "compiler/fir/analysis-tests/testData") { + testGroup("compiler/fir/analysis-tests/tests-gen", "compiler/fir/analysis-tests/testData") { testClass { model("resolveWithStdlib", pattern = KT_WITHOUT_DOTS_IN_NAME) } } - testGroup("compiler/fir/analysis-tests/tests", "compiler/testData") { + testGroup("compiler/fir/analysis-tests/tests-gen", "compiler/testData") { testClass { model("loadJava/compiledKotlin", extension = "kt") } } - testGroup("compiler/fir/analysis-tests/tests", "compiler/testData") { + testGroup("compiler/fir/analysis-tests/tests-gen", "compiler/testData") { testClass { model("loadJava/compiledJava", extension = "java") } } - testGroup("compiler/fir/analysis-tests/tests", "compiler/fir/analysis-tests/testData") { + testGroup("compiler/fir/analysis-tests/tests-gen", "compiler/fir/analysis-tests/testData") { testClass { model("enhancement", extension = "java") } } - testGroup("compiler/fir/analysis-tests/tests", "compiler/testData") { + testGroup("compiler/fir/analysis-tests/tests-gen", "compiler/testData") { testClass { model("diagnostics/tests", excludedPattern = excludedFirTestdataPattern) } @@ -691,14 +691,14 @@ fun main(args: Array) { } } - testGroup("compiler/fir/analysis-tests/tests", "compiler/fir/analysis-tests/testData") { + testGroup("compiler/fir/analysis-tests/tests-gen", "compiler/fir/analysis-tests/testData") { testClass { model("lightClasses") } } testGroup( - "compiler/fir/fir2ir/tests", "compiler/testData", + "compiler/fir/fir2ir/tests-gen", "compiler/testData", testRunnerMethodName = "runTestWithCustomIgnoreDirective", additionalRunnerArguments = listOf("\"// IGNORE_BACKEND_FIR: \"") ) { @@ -727,13 +727,13 @@ fun main(args: Array) { } } - testGroup("compiler/fir/analysis-tests/tests", "compiler/fir/analysis-tests/testData") { + testGroup("compiler/fir/analysis-tests/tests-gen", "compiler/fir/analysis-tests/testData") { testClass { model("extendedCheckers", pattern = KT_WITHOUT_DOTS_IN_NAME) } } - testGroup("compiler/fir/analysis-tests/tests", "compiler/fir/analysis-tests/testData") { + testGroup("compiler/fir/analysis-tests/tests-gen", "compiler/fir/analysis-tests/testData") { testClass { model("extendedCheckers", pattern = KT_WITHOUT_DOTS_IN_NAME) } From 908732b3c1e181487e520cf2ac82c8b30129c745 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Fri, 27 Nov 2020 12:48:43 +0300 Subject: [PATCH 256/698] [TEST] Move generated visualizer tests to `test-gen` directories --- .../generators/tests/GenerateCompilerTests.kt | 4 ++-- compiler/visualizer/build.gradle.kts | 20 ++++++++++++++++--- .../FirVisualizerForRawFirDataGenerated.java | 0 ...irVisualizerForUncommonCasesGenerated.java | 0 .../PsiVisualizerForRawFirDataGenerated.java | 0 ...siVisualizerForUncommonCasesGenerated.java | 0 6 files changed, 19 insertions(+), 5 deletions(-) rename compiler/visualizer/{tests => tests-gen}/org/jetbrains/kotlin/visualizer/fir/FirVisualizerForRawFirDataGenerated.java (100%) rename compiler/visualizer/{tests => tests-gen}/org/jetbrains/kotlin/visualizer/fir/FirVisualizerForUncommonCasesGenerated.java (100%) rename compiler/visualizer/{tests => tests-gen}/org/jetbrains/kotlin/visualizer/psi/PsiVisualizerForRawFirDataGenerated.java (100%) rename compiler/visualizer/{tests => tests-gen}/org/jetbrains/kotlin/visualizer/psi/PsiVisualizerForUncommonCasesGenerated.java (100%) diff --git a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt index d1c7d71d462..1001e93c592 100644 --- a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt +++ b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt @@ -707,7 +707,7 @@ fun main(args: Array) { } } - testGroup("compiler/visualizer/tests", "compiler/fir/raw-fir/psi2fir/testData") { + testGroup("compiler/visualizer/tests-gen", "compiler/fir/raw-fir/psi2fir/testData") { testClass("PsiVisualizerForRawFirDataGenerated") { model("rawBuilder", testMethod = "doFirBuilderDataTest") } @@ -717,7 +717,7 @@ fun main(args: Array) { } } - testGroup("compiler/visualizer/tests", "compiler/visualizer/testData") { + testGroup("compiler/visualizer/tests-gen", "compiler/visualizer/testData") { testClass("PsiVisualizerForUncommonCasesGenerated") { model("uncommonCases/testFiles", testMethod = "doUncommonCasesTest") } diff --git a/compiler/visualizer/build.gradle.kts b/compiler/visualizer/build.gradle.kts index 8cc0b7898b1..d3c477e48af 100644 --- a/compiler/visualizer/build.gradle.kts +++ b/compiler/visualizer/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.ideaExt.idea + plugins { kotlin("jvm") id("jps-compatible") @@ -17,13 +19,25 @@ dependencies { testCompile(projectTests(":compiler:fir:analysis-tests")) } +val generationRoot = projectDir.resolve("tests-gen") + sourceSets { - "main" {} - "test" { projectDefault() } + "main" { projectDefault() } + "test" { + projectDefault() + this.java.srcDir(generationRoot.name) + } +} + +if (kotlinBuildProperties.isInJpsBuildIdeaSync) { + apply(plugin = "idea") + idea { + this.module.generatedSourceDirs.add(generationRoot) + } } projectTest { workingDir = rootDir } -testsJar() \ No newline at end of file +testsJar() diff --git a/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/fir/FirVisualizerForRawFirDataGenerated.java b/compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/fir/FirVisualizerForRawFirDataGenerated.java similarity index 100% rename from compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/fir/FirVisualizerForRawFirDataGenerated.java rename to compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/fir/FirVisualizerForRawFirDataGenerated.java diff --git a/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/fir/FirVisualizerForUncommonCasesGenerated.java b/compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/fir/FirVisualizerForUncommonCasesGenerated.java similarity index 100% rename from compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/fir/FirVisualizerForUncommonCasesGenerated.java rename to compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/fir/FirVisualizerForUncommonCasesGenerated.java diff --git a/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/psi/PsiVisualizerForRawFirDataGenerated.java b/compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/psi/PsiVisualizerForRawFirDataGenerated.java similarity index 100% rename from compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/psi/PsiVisualizerForRawFirDataGenerated.java rename to compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/psi/PsiVisualizerForRawFirDataGenerated.java diff --git a/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/psi/PsiVisualizerForUncommonCasesGenerated.java b/compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/psi/PsiVisualizerForUncommonCasesGenerated.java similarity index 100% rename from compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/psi/PsiVisualizerForUncommonCasesGenerated.java rename to compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/psi/PsiVisualizerForUncommonCasesGenerated.java From 77ed51b3ab7d255528f887f68dc600cc074c45cd Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Thu, 26 Nov 2020 16:23:29 +0300 Subject: [PATCH 257/698] [JS IR] Add message for for enabling option for overwriting reachable nodes [JS IR] Disable rewriting of EXPECTED_REACHABLE_NODES by default, add system property to enable this behaviour --- .../jetbrains/kotlin/js/test/BasicBoxTest.kt | 73 +++++++++++++------ 1 file changed, 52 insertions(+), 21 deletions(-) diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt index 6f889fa8d6f..58ca1e812ac 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt @@ -63,6 +63,7 @@ import java.io.File import java.io.PrintStream import java.lang.Boolean.getBoolean import java.nio.charset.Charset +import java.util.regex.Matcher import java.util.regex.Pattern abstract class BasicBoxTest( @@ -85,6 +86,7 @@ abstract class BasicBoxTest( protected open val runMinifierByDefault: Boolean = false protected open val skipMinification = getBoolean("kotlin.js.skipMinificationTest") + protected open val overwriteReachableNodes = getBoolean(overwriteReachableNodesProperty) protected open val skipRegularMode: Boolean = false protected open val runIrDce: Boolean = false @@ -297,27 +299,12 @@ abstract class BasicBoxTest( (runMinifierByDefault || expectedReachableNodesFound) && !SKIP_MINIFICATION.matcher(fileContent).find() ) { - val thresholdChecker: (Int) -> Unit = { reachableNodesCount -> - val replacement = "// $EXPECTED_REACHABLE_NODES_DIRECTIVE: $reachableNodesCount" - if (!expectedReachableNodesFound) { - file.writeText("$replacement\n$fileContent") - fail("The number of expected reachable nodes was not set. Actual reachable nodes: $reachableNodesCount") - } - else { - val expectedReachableNodes = expectedReachableNodesMatcher.group(1).toInt() - val minThreshold = expectedReachableNodes * 9 / 10 - val maxThreshold = expectedReachableNodes * 11 / 10 - if (reachableNodesCount < minThreshold || reachableNodesCount > maxThreshold) { - - val newText = fileContent.substring(0, expectedReachableNodesMatcher.start()) + - replacement + - fileContent.substring(expectedReachableNodesMatcher.end()) - file.writeText(newText) - fail("Number of reachable nodes ($reachableNodesCount) does not fit into expected range " + - "[$minThreshold; $maxThreshold]") - } - } - } + val thresholdChecker: (Int) -> Unit = reachableNodesThresholdChecker( + expectedReachableNodesFound, + expectedReachableNodesMatcher, + fileContent, + file + ) val outputDirForMinification = getOutputDir(file, testGroupOutputDirForMinification) @@ -337,6 +324,48 @@ abstract class BasicBoxTest( } } + private fun reachableNodesThresholdChecker( + expectedReachableNodesFound: Boolean, + expectedReachableNodesMatcher: Matcher, + fileContent: String, + file: File + ) = { reachableNodesCount: Int -> + val replacement = "// $EXPECTED_REACHABLE_NODES_DIRECTIVE: $reachableNodesCount" + val enablingMessage = "To set expected reachable nodes use '$replacement'\n" + + "To enable automatic overwriting reachable nodes use property '-Pfd.$overwriteReachableNodesProperty=true'" + if (expectedReachableNodesFound) { + val expectedReachableNodes = expectedReachableNodesMatcher.group(1).toInt() + val minThreshold = expectedReachableNodes * 9 / 10 + val maxThreshold = expectedReachableNodes * 11 / 10 + if (reachableNodesCount < minThreshold || reachableNodesCount > maxThreshold) { + + val message = "Number of reachable nodes ($reachableNodesCount) does not fit into expected range " + + "[$minThreshold; $maxThreshold]" + val additionalMessage: String = + if (overwriteReachableNodes) { + val newText = fileContent.substring(0, expectedReachableNodesMatcher.start()) + + replacement + + fileContent.substring(expectedReachableNodesMatcher.end()) + file.writeText(newText) + "" + } else { + "\n$enablingMessage" + } + + fail("$message$additionalMessage") + } + } else { + val baseMessage = "The number of expected reachable nodes was not set. Actual reachable nodes: $reachableNodesCount." + + if (overwriteReachableNodes) { + file.writeText("$replacement\n$fileContent") + fail(baseMessage) + } else { + println("$baseMessage\n$enablingMessage") + } + } + } + protected open fun runGeneratedCode( jsFiles: List, testModuleName: String?, @@ -1041,6 +1070,8 @@ abstract class BasicBoxTest( private val engineForMinifier = if (runTestInNashorn) ScriptEngineNashorn() else ScriptEngineV8Lazy(KotlinTestUtils.tmpDirForReusableFolder("j2v8_library_path").path) + + const val overwriteReachableNodesProperty = "kotlin.js.overwriteReachableNodes" } } From fd935b7c54d3b4aec4e137475139a10e3d1a6989 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Fri, 27 Nov 2020 14:39:23 +0300 Subject: [PATCH 258/698] [TEST] Move generated js compiler tests to `test-gen` directories --- js/js.tests/build.gradle.kts | 16 ++++++++++++++-- .../kotlin/js/test/DceTestGenerated.java | 0 .../js/test/JsLineNumberTestGenerated.java | 0 .../es6/semantics/IrBoxJsES6TestGenerated.java | 0 .../IrJsCodegenBoxES6TestGenerated.java | 0 .../IrJsCodegenInlineES6TestGenerated.java | 0 .../IrJsTypeScriptExportES6TestGenerated.java | 0 .../test/ir/semantics/IrBoxJsTestGenerated.java | 0 .../IrJsCodegenBoxErrorTestGenerated.java | 0 .../semantics/IrJsCodegenBoxTestGenerated.java | 0 .../IrJsCodegenInlineTestGenerated.java | 0 .../IrJsTypeScriptExportTestGenerated.java | 0 .../js/test/semantics/BoxJsTestGenerated.java | 0 .../semantics/JsCodegenBoxTestGenerated.java | 0 .../semantics/JsCodegenInlineTestGenerated.java | 0 .../JsLegacyPrimitiveArraysBoxTestGenerated.java | 0 .../LegacyJsTypeScriptExportTestGenerated.java | 0 .../OutputPrefixPostfixTestGenerated.java | 0 .../SourceMapGenerationSmokeTestGenerated.java | 0 .../semantics/IrCodegenBoxWasmTestGenerated.java | 0 .../kotlin/generators/tests/GenerateJsTests.kt | 4 ++-- 21 files changed, 16 insertions(+), 4 deletions(-) rename js/js.tests/{test => test-gen}/org/jetbrains/kotlin/js/test/DceTestGenerated.java (100%) rename js/js.tests/{test => test-gen}/org/jetbrains/kotlin/js/test/JsLineNumberTestGenerated.java (100%) rename js/js.tests/{test => test-gen}/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java (100%) rename js/js.tests/{test => test-gen}/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java (100%) rename js/js.tests/{test => test-gen}/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java (100%) rename js/js.tests/{test => test-gen}/org/jetbrains/kotlin/js/test/es6/semantics/IrJsTypeScriptExportES6TestGenerated.java (100%) rename js/js.tests/{test => test-gen}/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java (100%) rename js/js.tests/{test => test-gen}/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxErrorTestGenerated.java (100%) rename js/js.tests/{test => test-gen}/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java (100%) rename js/js.tests/{test => test-gen}/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java (100%) rename js/js.tests/{test => test-gen}/org/jetbrains/kotlin/js/test/ir/semantics/IrJsTypeScriptExportTestGenerated.java (100%) rename js/js.tests/{test => test-gen}/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java (100%) rename js/js.tests/{test => test-gen}/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java (100%) rename js/js.tests/{test => test-gen}/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java (100%) rename js/js.tests/{test => test-gen}/org/jetbrains/kotlin/js/test/semantics/JsLegacyPrimitiveArraysBoxTestGenerated.java (100%) rename js/js.tests/{test => test-gen}/org/jetbrains/kotlin/js/test/semantics/LegacyJsTypeScriptExportTestGenerated.java (100%) rename js/js.tests/{test => test-gen}/org/jetbrains/kotlin/js/test/semantics/OutputPrefixPostfixTestGenerated.java (100%) rename js/js.tests/{test => test-gen}/org/jetbrains/kotlin/js/test/semantics/SourceMapGenerationSmokeTestGenerated.java (100%) rename js/js.tests/{test => test-gen}/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java (100%) diff --git a/js/js.tests/build.gradle.kts b/js/js.tests/build.gradle.kts index 1c859531e88..6cb4a4e19a1 100644 --- a/js/js.tests/build.gradle.kts +++ b/js/js.tests/build.gradle.kts @@ -4,6 +4,7 @@ import de.undercouch.gradle.tasks.download.Download import org.gradle.internal.os.OperatingSystem import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinUsages +import org.jetbrains.kotlin.ideaExt.idea plugins { kotlin("jvm") @@ -96,11 +97,22 @@ dependencies { antLauncherJar(toolsJar()) } +val generationRoot = projectDir.resolve("tests-gen") + sourceSets { - "main" {} - "test" { projectDefault() } + "main" { } + "test" { + projectDefault() + this.java.srcDir(generationRoot.name) + } } +if (kotlinBuildProperties.isInJpsBuildIdeaSync) { + apply(plugin = "idea") + idea { + this.module.generatedSourceDirs.add(generationRoot) + } +} fun Test.setUpJsBoxTests(jsEnabled: Boolean, jsIrEnabled: Boolean) { dependsOn(":dist") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/DceTestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/DceTestGenerated.java similarity index 100% rename from js/js.tests/test/org/jetbrains/kotlin/js/test/DceTestGenerated.java rename to js/js.tests/test-gen/org/jetbrains/kotlin/js/test/DceTestGenerated.java diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/JsLineNumberTestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/JsLineNumberTestGenerated.java similarity index 100% rename from js/js.tests/test/org/jetbrains/kotlin/js/test/JsLineNumberTestGenerated.java rename to js/js.tests/test-gen/org/jetbrains/kotlin/js/test/JsLineNumberTestGenerated.java diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java similarity index 100% rename from js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java rename to js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java similarity index 100% rename from js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java rename to js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java similarity index 100% rename from js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java rename to js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsTypeScriptExportES6TestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsTypeScriptExportES6TestGenerated.java similarity index 100% rename from js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsTypeScriptExportES6TestGenerated.java rename to js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsTypeScriptExportES6TestGenerated.java diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java similarity index 100% rename from js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java rename to js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxErrorTestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxErrorTestGenerated.java similarity index 100% rename from js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxErrorTestGenerated.java rename to js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxErrorTestGenerated.java diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java similarity index 100% rename from js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java rename to js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java similarity index 100% rename from js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java rename to js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsTypeScriptExportTestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsTypeScriptExportTestGenerated.java similarity index 100% rename from js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsTypeScriptExportTestGenerated.java rename to js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsTypeScriptExportTestGenerated.java diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java similarity index 100% rename from js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java rename to js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java similarity index 100% rename from js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java rename to js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java similarity index 100% rename from js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java rename to js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsLegacyPrimitiveArraysBoxTestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/JsLegacyPrimitiveArraysBoxTestGenerated.java similarity index 100% rename from js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsLegacyPrimitiveArraysBoxTestGenerated.java rename to js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/JsLegacyPrimitiveArraysBoxTestGenerated.java diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/LegacyJsTypeScriptExportTestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/LegacyJsTypeScriptExportTestGenerated.java similarity index 100% rename from js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/LegacyJsTypeScriptExportTestGenerated.java rename to js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/LegacyJsTypeScriptExportTestGenerated.java diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/OutputPrefixPostfixTestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/OutputPrefixPostfixTestGenerated.java similarity index 100% rename from js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/OutputPrefixPostfixTestGenerated.java rename to js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/OutputPrefixPostfixTestGenerated.java diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/SourceMapGenerationSmokeTestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/SourceMapGenerationSmokeTestGenerated.java similarity index 100% rename from js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/SourceMapGenerationSmokeTestGenerated.java rename to js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/SourceMapGenerationSmokeTestGenerated.java diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java similarity index 100% rename from js/js.tests/test/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java rename to js/js.tests/test-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java diff --git a/js/js.tests/test/org/jetbrains/kotlin/generators/tests/GenerateJsTests.kt b/js/js.tests/test/org/jetbrains/kotlin/generators/tests/GenerateJsTests.kt index ce1ee679fbe..b4cdfcb891d 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/generators/tests/GenerateJsTests.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/generators/tests/GenerateJsTests.kt @@ -21,7 +21,7 @@ fun main(args: Array) { //generateTestDataForReservedWords() testGroupSuite(args) { - testGroup("js/js.tests/test", "js/js.translator/testData", testRunnerMethodName = "runTest0") { + testGroup("js/js.tests/test-gen", "js/js.translator/testData", testRunnerMethodName = "runTest0") { testClass { model("box/", pattern = "^([^_](.+))\\.kt$", targetBackend = TargetBackend.JS) } @@ -64,7 +64,7 @@ fun main(args: Array) { } } - testGroup("js/js.tests/test", "compiler/testData", testRunnerMethodName = "runTest0") { + testGroup("js/js.tests/test-gen", "compiler/testData", testRunnerMethodName = "runTest0") { testClass { model("codegen/box", targetBackend = TargetBackend.JS) } From a206eca164259930d8d1545b7eb9cfbfbb9f5fc3 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Fri, 27 Nov 2020 12:31:47 +0300 Subject: [PATCH 259/698] JVM_IR KT-43611 report signature clash on private interface members --- .../jvm/codegen/JvmSignatureClashDetector.kt | 48 +++++++++++-------- .../traitImpl/kt43611.kt | 6 +++ .../traitImpl/kt43611.txt | 18 +++++++ ...gnosticsTestWithJvmIrBackendGenerated.java | 5 ++ ...nosticsTestWithOldJvmBackendGenerated.java | 5 ++ 5 files changed, 62 insertions(+), 20 deletions(-) create mode 100644 compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/kt43611.kt create mode 100644 compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/kt43611.txt diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/JvmSignatureClashDetector.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/JvmSignatureClashDetector.kt index a4373fbed86..2369b94b941 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/JvmSignatureClashDetector.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/JvmSignatureClashDetector.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.backend.jvm.codegen import com.intellij.psi.PsiElement import org.jetbrains.kotlin.backend.jvm.JvmBackendContext import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin +import org.jetbrains.kotlin.descriptors.DescriptorVisibilities import org.jetbrains.kotlin.diagnostics.DiagnosticFactory1 import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.descriptors.toIrBasedDescriptor @@ -68,10 +69,6 @@ class JvmSignatureClashDetector( origin in SPECIAL_BRIDGES_AND_OVERRIDES fun reportErrors(classOrigin: JvmDeclarationOrigin) { - // Class IFoo$DefaultImpls has conflicting signatures if and only if corresponding interface IFoo has conflicting signatures. - // Do not report these diagnostics twice. - if (irClass.origin == JvmLoweredDeclarationOrigin.DEFAULT_IMPLS) return - reportMethodSignatureConflicts(classOrigin) reportPredefinedMethodSignatureConflicts(classOrigin) reportFieldSignatureConflicts(classOrigin) @@ -89,25 +86,36 @@ class JvmSignatureClashDetector( when { realMethodsCount == 0 && (fakeOverridesCount > 1 || specialOverridesCount > 1) -> - reportJvmSignatureClash( - ErrorsJvm.CONFLICTING_INHERITED_JVM_DECLARATIONS, - listOf(irClass), - conflictingJvmDeclarationsData - ) + if (irClass.origin != JvmLoweredDeclarationOrigin.DEFAULT_IMPLS) { + reportJvmSignatureClash( + ErrorsJvm.CONFLICTING_INHERITED_JVM_DECLARATIONS, + listOf(irClass), + conflictingJvmDeclarationsData + ) + } - fakeOverridesCount == 0 && specialOverridesCount == 0 -> - reportJvmSignatureClash( - ErrorsJvm.CONFLICTING_JVM_DECLARATIONS, - methods, - conflictingJvmDeclarationsData - ) + fakeOverridesCount == 0 && specialOverridesCount == 0 -> { + // In IFoo$DefaultImpls we should report errors only if there are private methods among conflicting ones + // (otherwise such errors would be reported twice: once for IFoo and once for IFoo$DefaultImpls). + if (irClass.origin != JvmLoweredDeclarationOrigin.DEFAULT_IMPLS || + methods.any { DescriptorVisibilities.isPrivate(it.visibility) } + ) { + reportJvmSignatureClash( + ErrorsJvm.CONFLICTING_JVM_DECLARATIONS, + methods, + conflictingJvmDeclarationsData + ) + } + } else -> - reportJvmSignatureClash( - ErrorsJvm.ACCIDENTAL_OVERRIDE, - methods.filter { !it.isFakeOverride && !it.isSpecialOverride() }, - conflictingJvmDeclarationsData - ) + if (irClass.origin != JvmLoweredDeclarationOrigin.DEFAULT_IMPLS) { + reportJvmSignatureClash( + ErrorsJvm.ACCIDENTAL_OVERRIDE, + methods.filter { !it.isFakeOverride && !it.isSpecialOverride() }, + conflictingJvmDeclarationsData + ) + } } } } diff --git a/compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/kt43611.kt b/compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/kt43611.kt new file mode 100644 index 00000000000..228ab02f029 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/kt43611.kt @@ -0,0 +1,6 @@ +interface A { + fun f(a: List): String = TODO() + private fun f(a: List): String = TODO() +} + +class B : A \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/kt43611.txt b/compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/kt43611.txt new file mode 100644 index 00000000000..e1d7e4b419e --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/kt43611.txt @@ -0,0 +1,18 @@ +package + +public interface A { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun f(/*0*/ a: kotlin.collections.List): kotlin.String + private final fun f(/*0*/ a: kotlin.collections.List): kotlin.String + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class B : A { + public constructor B() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun f(/*0*/ a: kotlin.collections.List): kotlin.String + invisible_fake final override /*1*/ /*fake_override*/ fun f(/*0*/ a: kotlin.collections.List): kotlin.String + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJvmIrBackendGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJvmIrBackendGenerated.java index 865e2a9417a..0e71ce26617 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJvmIrBackendGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJvmIrBackendGenerated.java @@ -552,6 +552,11 @@ public class DiagnosticsTestWithJvmIrBackendGenerated extends AbstractDiagnostic runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/defaultVsNonDefault_ir.kt"); } + @TestMetadata("kt43611.kt") + public void testKt43611() throws Exception { + runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/kt43611.kt"); + } + @TestMetadata("oneTrait_ir.kt") public void testOneTrait_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/oneTrait_ir.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithOldJvmBackendGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithOldJvmBackendGenerated.java index 7caddc4167e..66044c1c3b7 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithOldJvmBackendGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithOldJvmBackendGenerated.java @@ -542,6 +542,11 @@ public class DiagnosticsTestWithOldJvmBackendGenerated extends AbstractDiagnosti runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/defaultVsNonDefault_old.kt"); } + @TestMetadata("kt43611.kt") + public void testKt43611() throws Exception { + runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/kt43611.kt"); + } + @TestMetadata("oneTrait_old.kt") public void testOneTrait_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/oneTrait_old.kt"); From 3141fead0d7fd4185fd4ef95c9a6bc64fccf639f Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 26 Nov 2020 10:52:39 +0100 Subject: [PATCH 260/698] FIR IDE: get rid of LowLevelFirApiFacade object --- .../api/FirModuleResolveStateForCompletion.kt | 5 + .../level/api/FirModuleResolveStateImpl.kt | 4 + .../low/level/api/annotations/annotations.kt | 6 +- .../level/api/api/FirModuleResolveState.kt | 5 + .../low/level/api/api/LowLevelFirApiFacade.kt | 139 ++++++++---------- .../fir/low/level/api/api/WeakFirByPsiRef.kt | 69 --------- .../idea/fir/low/level/api/api/WeakFirRef.kt | 28 ---- .../AbstractFirLazyDeclarationResolveTest.kt | 5 +- .../level/api/AbstractFirLazyResolveTest.kt | 7 +- .../AbstractFirMultiModuleLazyResolveTest.kt | 7 +- .../fir/low/level/api/FirResolveStateTest.kt | 4 +- ...BlockModificationTrackerConsistencyTest.kt | 4 +- .../structure/AbstractFileStructureTest.kt | 4 +- .../idea/fir/low/level/api/firTestUtils.kt | 2 - .../asJava/class/FirLightClassForFacade.kt | 1 - .../frontend/api/fir/KtFirAnalysisSession.kt | 4 +- .../KtFirCompletionCandidateChecker.kt | 4 +- .../fir/components/KtFirDiagnosticProvider.kt | 7 +- .../api/fir/components/KtFirScopeProvider.kt | 4 +- .../api/fir/symbols/KtFirSymbolProvider.kt | 24 +-- .../api/fir/utils/FirRefWithValidityCheck.kt | 6 +- ...arationAndFirDeclarationEqualityChecker.kt | 7 +- 22 files changed, 122 insertions(+), 224 deletions(-) delete mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/WeakFirByPsiRef.kt delete mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/WeakFirRef.kt diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/FirModuleResolveStateForCompletion.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/FirModuleResolveStateForCompletion.kt index 5fe56061d2e..673445ef24f 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/FirModuleResolveStateForCompletion.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/FirModuleResolveStateForCompletion.kt @@ -15,6 +15,8 @@ import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.fir.psi import org.jetbrains.kotlin.fir.resolve.providers.FirProvider import org.jetbrains.kotlin.idea.caches.project.IdeaModuleInfo +import org.jetbrains.kotlin.idea.fir.low.level.api.annotations.InternalForInline +import org.jetbrains.kotlin.idea.fir.low.level.api.annotations.PrivateForInline import org.jetbrains.kotlin.idea.fir.low.level.api.api.FirModuleResolveState import org.jetbrains.kotlin.idea.fir.low.level.api.element.builder.FirTowerDataContextCollector import org.jetbrains.kotlin.idea.fir.low.level.api.file.builder.ModuleFileCache @@ -92,14 +94,17 @@ internal class FirModuleResolveStateForCompletion( error("Diagnostics should not be retrieved in completion") } + @OptIn(InternalForInline::class) override fun findNonLocalSourceFirDeclaration(ktDeclaration: KtDeclaration): FirDeclaration { error("Should not be used in completion") } + @OptIn(InternalForInline::class) override fun findSourceFirDeclaration(ktDeclaration: KtDeclaration): FirDeclaration { error("Should not be used in completion") } + @OptIn(InternalForInline::class) override fun findSourceFirDeclaration(ktDeclaration: KtLambdaExpression): FirDeclaration { error("Should not be used in completion") } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/FirModuleResolveStateImpl.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/FirModuleResolveStateImpl.kt index 9ff93bb26a1..0fe9d4fda11 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/FirModuleResolveStateImpl.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/FirModuleResolveStateImpl.kt @@ -17,6 +17,7 @@ import org.jetbrains.kotlin.fir.resolve.providers.FirProvider import org.jetbrains.kotlin.idea.caches.project.IdeaModuleInfo import org.jetbrains.kotlin.idea.caches.project.ModuleSourceInfo import org.jetbrains.kotlin.idea.caches.project.getModuleInfo +import org.jetbrains.kotlin.idea.fir.low.level.api.annotations.InternalForInline import org.jetbrains.kotlin.idea.fir.low.level.api.api.FirModuleResolveState import org.jetbrains.kotlin.idea.fir.low.level.api.diagnostics.DiagnosticsCollector import org.jetbrains.kotlin.idea.fir.low.level.api.element.builder.FirElementBuilder @@ -71,6 +72,7 @@ internal class FirModuleResolveStateImpl( error("Should be called only from FirModuleResolveStateForCompletion") } + @OptIn(InternalForInline::class) override fun findNonLocalSourceFirDeclaration( ktDeclaration: KtDeclaration, ): FirDeclaration = ktDeclaration.findSourceNonLocalFirDeclaration( @@ -79,9 +81,11 @@ internal class FirModuleResolveStateImpl( sessionProvider.getModuleCache(ktDeclaration.getModuleInfo() as ModuleSourceInfo) ) + @OptIn(InternalForInline::class) override fun findSourceFirDeclaration(ktDeclaration: KtDeclaration): FirDeclaration = findSourceFirDeclarationByExpression(ktDeclaration) + @OptIn(InternalForInline::class) override fun findSourceFirDeclaration(ktDeclaration: KtLambdaExpression): FirDeclaration = findSourceFirDeclarationByExpression(ktDeclaration) diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/annotations/annotations.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/annotations/annotations.kt index 1ed083947d0..4c4180bc40d 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/annotations/annotations.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/annotations/annotations.kt @@ -5,6 +5,8 @@ package org.jetbrains.kotlin.idea.fir.low.level.api.annotations -@Target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.CLASS) @RequiresOptIn -annotation class PrivateForInline \ No newline at end of file +annotation class PrivateForInline + +@RequiresOptIn +annotation class InternalForInline \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/FirModuleResolveState.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/FirModuleResolveState.kt index 1b0f083335a..a9c668e3623 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/FirModuleResolveState.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/FirModuleResolveState.kt @@ -17,6 +17,8 @@ import org.jetbrains.kotlin.idea.caches.project.IdeaModuleInfo import org.jetbrains.kotlin.idea.caches.project.getModuleInfo import org.jetbrains.kotlin.idea.fir.low.level.api.FirIdeResolveStateService import org.jetbrains.kotlin.idea.fir.low.level.api.FirTransformerProvider +import org.jetbrains.kotlin.idea.fir.low.level.api.annotations.InternalForInline +import org.jetbrains.kotlin.idea.fir.low.level.api.annotations.PrivateForInline import org.jetbrains.kotlin.idea.fir.low.level.api.element.builder.FirTowerDataContextCollector import org.jetbrains.kotlin.idea.fir.low.level.api.file.builder.FirFileBuilder import org.jetbrains.kotlin.idea.fir.low.level.api.file.builder.ModuleFileCache @@ -52,14 +54,17 @@ abstract class FirModuleResolveState { @TestOnly internal abstract fun getBuiltFirFileOrNull(ktFile: KtFile): FirFile? + @InternalForInline abstract fun findNonLocalSourceFirDeclaration( ktDeclaration: KtDeclaration, ): FirDeclaration + @InternalForInline abstract fun findSourceFirDeclaration( ktDeclaration: KtDeclaration, ): FirDeclaration + @InternalForInline abstract fun findSourceFirDeclaration( ktDeclaration: KtLambdaExpression, ): FirDeclaration diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/LowLevelFirApiFacade.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/LowLevelFirApiFacade.kt index ec84ddd9dcc..a7330a6c1e0 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/LowLevelFirApiFacade.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/LowLevelFirApiFacade.kt @@ -7,113 +7,92 @@ package org.jetbrains.kotlin.idea.fir.low.level.api.api import org.jetbrains.kotlin.diagnostics.Diagnostic import org.jetbrains.kotlin.fir.FirElement -import org.jetbrains.kotlin.fir.FirSession -import org.jetbrains.kotlin.fir.FirSymbolOwner import org.jetbrains.kotlin.fir.declarations.FirDeclaration -import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin -import org.jetbrains.kotlin.fir.declarations.FirFile import org.jetbrains.kotlin.fir.declarations.FirResolvePhase -import org.jetbrains.kotlin.fir.psi -import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol import org.jetbrains.kotlin.idea.caches.project.IdeaModuleInfo import org.jetbrains.kotlin.idea.caches.project.getModuleInfo import org.jetbrains.kotlin.idea.fir.low.level.api.FirIdeResolveStateService -import org.jetbrains.kotlin.idea.fir.low.level.api.sessions.FirIdeSourcesSession +import org.jetbrains.kotlin.idea.fir.low.level.api.annotations.InternalForInline import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.KtLambdaExpression import kotlin.reflect.KClass -object LowLevelFirApiFacade { - fun getResolveStateFor(element: KtElement): FirModuleResolveState = - getResolveStateFor(element.getModuleInfo()) +fun KtElement.getResolveState(): FirModuleResolveState = + getModuleInfo().getResolveState() - fun getResolveStateFor(moduleInfo: IdeaModuleInfo): FirModuleResolveState = - FirIdeResolveStateService.getInstance(moduleInfo.project!!).getResolveState(moduleInfo) +fun IdeaModuleInfo.getResolveState(): FirModuleResolveState = + FirIdeResolveStateService.getInstance(project!!).getResolveState(this) - fun getSessionFor(element: KtElement): FirSession = - getResolveStateFor(element).getSessionFor(element.getModuleInfo()) +fun KtFile.getFirFile(resolveState: FirModuleResolveState) = + resolveState.getFirFile(this) - fun getOrBuildFirFor(element: KtElement, resolveState: FirModuleResolveState): FirElement = - resolveState.getOrBuildFirFor(element) - - fun getFirFile(ktFile: KtFile, resolveState: FirModuleResolveState) = - resolveState.getFirFile(ktFile) - - /** - * Creates [FirDeclaration] by [KtDeclaration] and runs an [action] with it - * [ktDeclaration] - * [FirDeclaration] passed to [action] should not be leaked outside [action] lambda - * [FirDeclaration] passed to [action] will be resolved at least to [phase] - * Otherwise, some threading problems may arise, - * - * [ktDeclaration] should be non-local declaration (should have fully qualified name) - */ - inline fun withFirDeclaration( - ktDeclaration: KtDeclaration, - resolveState: FirModuleResolveState, - phase: FirResolvePhase = FirResolvePhase.RAW_FIR, - action: (FirDeclaration) -> R - ): R { - val firDeclaration = resolveState.findSourceFirDeclaration(ktDeclaration) - resolvedFirToPhase(firDeclaration, phase, resolveState) - return action(firDeclaration) - } - - inline fun withFirDeclarationOfType( - ktDeclaration: KtDeclaration, - resolveState: FirModuleResolveState, - action: (F) -> R - ): R { - val firDeclaration = resolveState.findSourceFirDeclaration(ktDeclaration) - if (firDeclaration !is F) throw InvalidFirElementTypeException(ktDeclaration, F::class, firDeclaration::class) - return action(firDeclaration) - } - - inline fun withFirDeclarationOfType( - ktDeclaration: KtLambdaExpression, - resolveState: FirModuleResolveState, - action: (F) -> R - ): R { - val firDeclaration = resolveState.findSourceFirDeclaration(ktDeclaration) - if (firDeclaration !is F) throw InvalidFirElementTypeException(ktDeclaration, F::class, firDeclaration::class) - return action(firDeclaration) - } - - inline fun withFir(fir: F, action: (F) -> R): R { - // TODO locking - return action(fir) - } - - fun getDiagnosticsFor(element: KtElement, resolveState: FirModuleResolveState): Collection = - resolveState.getDiagnostics(element) - - fun collectDiagnosticsForFile(ktFile: KtFile, resolveState: FirModuleResolveState): Collection = - resolveState.collectDiagnosticsForFile(ktFile) - - fun resolvedFirToPhase( - firDeclaration: D, - phase: FirResolvePhase, - resolveState: FirModuleResolveState - ): D = - resolveState.resolvedFirToPhase(firDeclaration, phase) +/** + * Creates [FirDeclaration] by [KtDeclaration] and runs an [action] with it + * [this@withFirDeclaration] + * [FirDeclaration] passed to [action] should not be leaked outside [action] lambda + * [FirDeclaration] passed to [action] will be resolved at least to [phase] + * Otherwise, some threading problems may arise, + * + * [this@withFirDeclaration] should be non-local declaration (should have fully qualified name) + */ +@OptIn(InternalForInline::class) +inline fun KtDeclaration.withFirDeclaration( + resolveState: FirModuleResolveState, + phase: FirResolvePhase = FirResolvePhase.RAW_FIR, + action: (FirDeclaration) -> R +): R { + val firDeclaration = resolveState.findSourceFirDeclaration(this) + firDeclaration.resolvedFirToPhase(phase, resolveState) + return action(firDeclaration) } +@OptIn(InternalForInline::class) +inline fun KtDeclaration.withFirDeclarationOfType( + resolveState: FirModuleResolveState, + action: (F) -> R +): R { + val firDeclaration = resolveState.findSourceFirDeclaration(this) + if (firDeclaration !is F) throw InvalidFirElementTypeException(this, F::class, firDeclaration::class) + return action(firDeclaration) +} + +@OptIn(InternalForInline::class) +inline fun KtLambdaExpression.withFirDeclarationOfType( + resolveState: FirModuleResolveState, + action: (F) -> R +): R { + val firDeclaration = resolveState.findSourceFirDeclaration(this) + if (firDeclaration !is F) throw InvalidFirElementTypeException(this, F::class, firDeclaration::class) + return action(firDeclaration) +} + +fun getDiagnosticsFor(element: KtElement, resolveState: FirModuleResolveState): Collection = + resolveState.getDiagnostics(element) + +fun KtFile.collectDiagnosticsForFile(resolveState: FirModuleResolveState): Collection = + resolveState.collectDiagnosticsForFile(this) + +fun D.resolvedFirToPhase( + phase: FirResolvePhase, + resolveState: FirModuleResolveState +): D = + resolveState.resolvedFirToPhase(this, phase) fun KtElement.getOrBuildFir( resolveState: FirModuleResolveState, -) = LowLevelFirApiFacade.getOrBuildFirFor(this, resolveState) +) = resolveState.getOrBuildFirFor(this) inline fun KtElement.getOrBuildFirSafe( resolveState: FirModuleResolveState, -) = LowLevelFirApiFacade.getOrBuildFirFor(this, resolveState) as? E +) = getOrBuildFir(resolveState) as? E inline fun KtElement.getOrBuildFirOfType( resolveState: FirModuleResolveState, ): E { - val fir = LowLevelFirApiFacade.getOrBuildFirFor(this, resolveState) + val fir = this.getOrBuildFir(resolveState) if (fir is E) return fir throw InvalidFirElementTypeException(this, E::class, fir::class) } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/WeakFirByPsiRef.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/WeakFirByPsiRef.kt deleted file mode 100644 index 7a2a43be8e4..00000000000 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/WeakFirByPsiRef.kt +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.fir.low.level.api.api - -import org.jetbrains.kotlin.fir.declarations.FirDeclaration -import org.jetbrains.kotlin.fir.declarations.FirResolvePhase -import org.jetbrains.kotlin.idea.fir.low.level.api.annotations.PrivateForInline -import org.jetbrains.kotlin.psi.KtDeclaration -import java.lang.ref.WeakReference -import kotlin.reflect.KClass - - -/** - * Lazy [FirDeclaration] reference which allows to find corresponding non-local [FirDeclaration] by [KtDeclaration] - * Builds declaration only when [withFir] is called or some other entity already built it - * Allows approximately to check if we already have corresponding [FirDeclaration] built by [isFirDeclarationAlreadyBuilt] - * - * To create one consider using [weakByPsiRef] - */ -class WeakFirByPsiRef @PrivateForInline constructor( - val ktDeclaration: KT, - @PrivateForInline val firClass: KClass, - resolveState: FirModuleResolveState, -) { - @PrivateForInline - val resolveStateWeakRef = WeakReference(resolveState) - - /** - * Checks if corresponding [FirDeclaration] is available now - * If return true consequent call to [withFir] will not build new RAW_FIR as it is already built - * If return false consequent call to [withFir] will build new [FirDeclaration] - * if it was not build between [isFirDeclarationAlreadyBuilt] & [withFir] calls - * - * Should be used with caution as this is only approximation and may return inaccurate results - */ - @OptIn(PrivateForInline::class) - fun isFirDeclarationAlreadyBuilt(): Boolean { - val resolveState = resolveStateWeakRef.get() - ?: error("FirModuleResolveState was garbage collected") - return resolveState.isFirFileBuilt(ktDeclaration.containingKtFile) - } - - /** - * Creates [FirDeclaration] by [KtDeclaration] if it is not created previously and runs an [action] with it - * [FirDeclaration] passed to [action] should not be leaked outside [action] lambda - * Otherwise, some threading problems may arise.` - * - * [FirDeclaration] passed to [action] will be resolved at least to [phase] - **/ - @OptIn(PrivateForInline::class) - inline fun withFir(phase: FirResolvePhase = FirResolvePhase.RAW_FIR, action: (fir: FIR) -> R): R { - val resolveState = resolveStateWeakRef.get() - ?: error("FirModuleResolveState was garbage collected") - return LowLevelFirApiFacade.withFirDeclaration(ktDeclaration, resolveState, phase) { fir -> - if (!firClass.isInstance(fir)) throw InvalidFirElementTypeException(ktDeclaration, firClass, fir::class) - @Suppress("UNCHECKED_CAST") - action(fir as FIR) - } - } -} - -@OptIn(PrivateForInline::class) -inline fun weakByPsiRef( - ktDeclaration: KT, - resolveState: FirModuleResolveState, -) = WeakFirByPsiRef(ktDeclaration, FIR::class, resolveState) \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/WeakFirRef.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/WeakFirRef.kt deleted file mode 100644 index 6ecdd380ddc..00000000000 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/WeakFirRef.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.fir.low.level.api.api - -import org.jetbrains.kotlin.fir.declarations.FirDeclaration -import org.jetbrains.kotlin.fir.declarations.FirResolvePhase -import org.jetbrains.kotlin.idea.fir.low.level.api.annotations.PrivateForInline -import java.lang.ref.WeakReference - -class WeakFirRef(fir: D, resolveState: FirModuleResolveState) { - @PrivateForInline - val firWeakRef = WeakReference(fir) - - @PrivateForInline - val resolveStateWeakRef = WeakReference(resolveState) - - @OptIn(PrivateForInline::class) - inline fun withFir(phase: FirResolvePhase = FirResolvePhase.RAW_FIR, action: (fir: D) -> R): R { - val fir = firWeakRef.get() - ?: error("FirElement was garbage collected") - val resolveState = resolveStateWeakRef.get() - ?: error("FirModuleResolveState was garbage collected") - return action(LowLevelFirApiFacade.resolvedFirToPhase(fir, phase, resolveState)) - } -} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/AbstractFirLazyDeclarationResolveTest.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/AbstractFirLazyDeclarationResolveTest.kt index 8afdc6e18a2..6749d2f177b 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/AbstractFirLazyDeclarationResolveTest.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/AbstractFirLazyDeclarationResolveTest.kt @@ -10,7 +10,7 @@ import com.intellij.testFramework.LightProjectDescriptor import org.jetbrains.kotlin.fir.FirRenderer import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.fir.render -import org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacade +import org.jetbrains.kotlin.idea.fir.low.level.api.api.withFirDeclaration import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor import org.jetbrains.kotlin.psi.KtDeclaration @@ -34,8 +34,7 @@ abstract class AbstractFirLazyDeclarationResolveTest : KotlinLightCodeInsightFix val declarationToResolve = lazyDeclarations.firstOrNull { it.name?.toLowerCase() == "resolveme" } ?: error("declaration with name `resolveMe` was not found") resolveWithClearCaches(ktFile) { firModuleResolveState -> - val rendered = LowLevelFirApiFacade.withFirDeclaration( - declarationToResolve, + val rendered = declarationToResolve.withFirDeclaration( firModuleResolveState, FirResolvePhase.BODY_RESOLVE ) @Suppress("UNUSED_ANONYMOUS_PARAMETER") { firDeclaration -> diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/AbstractFirLazyResolveTest.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/AbstractFirLazyResolveTest.kt index 008c84e0f30..4a987939931 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/AbstractFirLazyResolveTest.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/AbstractFirLazyResolveTest.kt @@ -20,7 +20,8 @@ import org.jetbrains.kotlin.fir.render import org.jetbrains.kotlin.idea.KotlinFileType import org.jetbrains.kotlin.idea.caches.project.IdeaModuleInfo import org.jetbrains.kotlin.idea.caches.project.productionSourceInfo -import org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacade +import org.jetbrains.kotlin.idea.fir.low.level.api.api.getOrBuildFir +import org.jetbrains.kotlin.idea.fir.low.level.api.api.getResolveState import org.jetbrains.kotlin.idea.fir.low.level.api.providers.firIdeProvider import org.jetbrains.kotlin.idea.jsonUtils.getString import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase @@ -67,8 +68,8 @@ abstract class AbstractFirLazyResolveTest : KotlinLightCodeInsightFixtureTestCas else -> elementToResolve } as KtExpression - val resolveState = LowLevelFirApiFacade.getResolveStateFor(expressionToResolve) - val resultsDump = when (val firElement = resolveState.getOrBuildFirFor(expressionToResolve)) { + val resolveState = expressionToResolve.getResolveState() + val resultsDump = when (val firElement = expressionToResolve.getOrBuildFir(resolveState)) { is FirResolvedImport -> buildString { append("import ") append(firElement.packageFqName) diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/AbstractFirMultiModuleLazyResolveTest.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/AbstractFirMultiModuleLazyResolveTest.kt index 4b21fddece5..f74a7821b5e 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/AbstractFirMultiModuleLazyResolveTest.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/AbstractFirMultiModuleLazyResolveTest.kt @@ -9,7 +9,8 @@ import com.intellij.openapi.vfs.VirtualFileManager import com.intellij.psi.PsiManager import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.fir.render -import org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacade +import org.jetbrains.kotlin.idea.fir.low.level.api.api.getOrBuildFir +import org.jetbrains.kotlin.idea.fir.low.level.api.api.getResolveState import org.jetbrains.kotlin.idea.stubs.AbstractMultiModuleTest import org.jetbrains.kotlin.idea.util.sourceRoots import org.jetbrains.kotlin.psi.KtFile @@ -38,12 +39,12 @@ abstract class AbstractFirMultiModuleLazyResolveTest : AbstractMultiModuleTest() val virtualFileToAnalyse = VirtualFileManager.getInstance().findFileByUrl(fileToAnalysePath) ?: error("File ${testStructure.fileToResolve.filePath} not found") val ktFileToAnalyse = PsiManager.getInstance(project).findFile(virtualFileToAnalyse) as KtFile - val resolveState = LowLevelFirApiFacade.getResolveStateFor(ktFileToAnalyse) + val resolveState = ktFileToAnalyse.getResolveState() val fails = testStructure.fails try { - val fir = LowLevelFirApiFacade.getOrBuildFirFor(ktFileToAnalyse, resolveState) + val fir = ktFileToAnalyse.getOrBuildFir(resolveState) KotlinTestUtils.assertEqualsToFile(File("$path/expected.txt"), fir.render()) } catch (e: Throwable) { if (!fails) throw e diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/FirResolveStateTest.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/FirResolveStateTest.kt index 3c8cb22df37..002c6199172 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/FirResolveStateTest.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/FirResolveStateTest.kt @@ -6,7 +6,7 @@ package org.jetbrains.kotlin.idea.fir.low.level.api import org.jetbrains.kotlin.idea.AbstractResolveElementCacheTest -import org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacade +import org.jetbrains.kotlin.idea.fir.low.level.api.api.getResolveState class FirResolveStateTest : AbstractResolveElementCacheTest() { override fun isFirPlugin(): Boolean = true @@ -15,7 +15,7 @@ class FirResolveStateTest : AbstractResolveElementCacheTest() { doTest { val firstStatement = statements[0] val secondStatement = statements[1] - assertSame(LowLevelFirApiFacade.getResolveStateFor(firstStatement), LowLevelFirApiFacade.getResolveStateFor(secondStatement)) + assertSame(firstStatement.getResolveState(), secondStatement.getResolveState()) } } } \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureAndOutOfBlockModificationTrackerConsistencyTest.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureAndOutOfBlockModificationTrackerConsistencyTest.kt index 9e76b38dbc2..e0c900d83f4 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureAndOutOfBlockModificationTrackerConsistencyTest.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureAndOutOfBlockModificationTrackerConsistencyTest.kt @@ -11,7 +11,7 @@ import com.intellij.psi.util.parentOfType import junit.framework.Assert import org.jetbrains.kotlin.idea.fir.low.level.api.FirModuleResolveStateImpl import org.jetbrains.kotlin.idea.fir.low.level.api.api.FirModuleResolveState -import org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacade +import org.jetbrains.kotlin.idea.fir.low.level.api.api.getResolveState import org.jetbrains.kotlin.idea.fir.low.level.api.trackers.AbstractProjectWideOutOfBlockKotlinModificationTrackerTest import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase import org.jetbrains.kotlin.psi.KtElement @@ -57,7 +57,7 @@ abstract class AbstractFileStructureAndOutOfBlockModificationTrackerConsistencyT findElementAt(myFixture.caretOffset)!!.parentOfType()!! private fun getStructureElementForKtElement(element: KtElement): Triple { - val moduleResolveState = LowLevelFirApiFacade.getResolveStateFor(element) as FirModuleResolveStateImpl + val moduleResolveState = element.getResolveState() as FirModuleResolveStateImpl val fileStructure = moduleResolveState.fileStructureCache.getFileStructure(element.containingKtFile, moduleResolveState.rootModuleSession.cache) val fileStructureElement = fileStructure.getStructureElementFor(element) diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureTest.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureTest.kt index 254ab3ad4af..5c2d246e575 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureTest.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureTest.kt @@ -15,7 +15,7 @@ import com.intellij.psi.util.parentOfType import junit.framework.Assert import org.jetbrains.kotlin.fir.render import org.jetbrains.kotlin.idea.fir.low.level.api.FirModuleResolveStateImpl -import org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacade +import org.jetbrains.kotlin.idea.fir.low.level.api.api.getResolveState import org.jetbrains.kotlin.idea.search.getKotlinFqName import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase import org.jetbrains.kotlin.idea.util.getElementTextInContext @@ -70,7 +70,7 @@ abstract class AbstractFileStructureTest : KotlinLightCodeInsightFixtureTestCase } private fun KtFile.getFileStructure(): FileStructure { - val moduleResolveState = LowLevelFirApiFacade.getResolveStateFor(this) as FirModuleResolveStateImpl + val moduleResolveState = getResolveState() as FirModuleResolveStateImpl return moduleResolveState.fileStructureCache.getFileStructure( ktFile = this, moduleFileCache = moduleResolveState.rootModuleSession.cache diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/firTestUtils.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/firTestUtils.kt index 21f910ebab6..32066cdbbed 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/firTestUtils.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/firTestUtils.kt @@ -9,8 +9,6 @@ import com.intellij.openapi.module.ModuleManager import com.intellij.openapi.project.Project import org.jetbrains.kotlin.idea.caches.project.getModuleInfo import org.jetbrains.kotlin.idea.fir.low.level.api.api.FirModuleResolveState -import org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacade -import org.jetbrains.kotlin.idea.fir.low.level.api.sessions.FirIdeSessionProviderStorage import org.jetbrains.kotlin.psi.KtElement internal fun Project.allModules() = ModuleManager.getInstance(this).modules.toList() diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/class/FirLightClassForFacade.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/class/FirLightClassForFacade.kt index ffdd9561bbf..2a1db0cb593 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/class/FirLightClassForFacade.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/class/FirLightClassForFacade.kt @@ -20,7 +20,6 @@ import org.jetbrains.kotlin.fileClasses.javaFileFacadeFqName import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.types.ConeNullability import org.jetbrains.kotlin.idea.KotlinLanguage -import org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacade import org.jetbrains.kotlin.idea.frontend.api.analyze import org.jetbrains.kotlin.idea.frontend.api.symbols.KtCallableSymbol import org.jetbrains.kotlin.load.java.structure.LightClassOriginKind diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSession.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSession.kt index 944ebc0a145..52f1dbd0bf7 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSession.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSession.kt @@ -8,8 +8,8 @@ package org.jetbrains.kotlin.idea.frontend.api.fir import com.intellij.openapi.project.Project import org.jetbrains.kotlin.fir.resolve.firSymbolProvider import org.jetbrains.kotlin.idea.fir.low.level.api.api.FirModuleResolveState -import org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacade import org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacadeForCompletion +import org.jetbrains.kotlin.idea.fir.low.level.api.api.getResolveState import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession import org.jetbrains.kotlin.idea.frontend.api.ReadActionConfinementValidityToken import org.jetbrains.kotlin.idea.frontend.api.ValidityToken @@ -60,7 +60,7 @@ private constructor( companion object { @Deprecated("Please use org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSessionProviderKt.analyze") internal fun createForElement(element: KtElement): KtFirAnalysisSession { - val firResolveState = LowLevelFirApiFacade.getResolveStateFor(element) + val firResolveState = element.getResolveState() return createAnalysisSessionByResolveState(firResolveState) } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCompletionCandidateChecker.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCompletionCandidateChecker.kt index 96800e3d662..4fe03329dfd 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCompletionCandidateChecker.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCompletionCandidateChecker.kt @@ -9,8 +9,8 @@ import com.jetbrains.rd.util.getOrCreate import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.expressions.FirExpression import org.jetbrains.kotlin.fir.resolve.calls.ImplicitReceiverValue -import org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacade import org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacadeForCompletion +import org.jetbrains.kotlin.idea.fir.low.level.api.api.getFirFile import org.jetbrains.kotlin.idea.fir.low.level.api.api.getOrBuildFirOfType import org.jetbrains.kotlin.idea.fir.low.level.api.resolver.ResolutionParameters import org.jetbrains.kotlin.idea.fir.low.level.api.resolver.SingleCandidateResolutionMode @@ -69,7 +69,7 @@ internal class KtFirCompletionCandidateChecker( nameExpression: KtSimpleNameExpression, possibleExplicitReceiver: KtExpression?, ): Boolean { - val file = LowLevelFirApiFacade.getFirFile(originalFile, firResolveState) + val file = originalFile.getFirFile(firResolveState) val explicitReceiverExpression = possibleExplicitReceiver?.getOrBuildFirOfType(firResolveState) val resolver = SingleCandidateResolver(firResolveState.rootModuleSession, file) val implicitReceivers = getImplicitReceivers(originalFile, file, nameExpression) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirDiagnosticProvider.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirDiagnosticProvider.kt index b25dd86e08a..89a4f2e4944 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirDiagnosticProvider.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirDiagnosticProvider.kt @@ -6,7 +6,8 @@ package org.jetbrains.kotlin.idea.frontend.api.fir.components import org.jetbrains.kotlin.diagnostics.Diagnostic -import org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacade +import org.jetbrains.kotlin.idea.fir.low.level.api.api.collectDiagnosticsForFile +import org.jetbrains.kotlin.idea.fir.low.level.api.api.getDiagnosticsFor import org.jetbrains.kotlin.idea.frontend.api.ValidityToken import org.jetbrains.kotlin.idea.frontend.api.components.KtDiagnosticProvider import org.jetbrains.kotlin.idea.frontend.api.fir.KtFirAnalysisSession @@ -19,9 +20,9 @@ internal class KtFirDiagnosticProvider( override val token: ValidityToken, ) : KtDiagnosticProvider(), KtFirAnalysisSessionComponent { override fun getDiagnosticsForElement(element: KtElement): Collection = withValidityAssertion { - LowLevelFirApiFacade.getDiagnosticsFor(element, firResolveState) + getDiagnosticsFor(element, firResolveState) } override fun collectDiagnosticsForFile(ktFile: KtFile): Collection = - LowLevelFirApiFacade.collectDiagnosticsForFile(ktFile, firResolveState) + ktFile.collectDiagnosticsForFile(firResolveState) } \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt index b7ad2c5af22..7f7a74ce11b 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt @@ -14,8 +14,8 @@ import org.jetbrains.kotlin.fir.scopes.FirScope import org.jetbrains.kotlin.fir.scopes.impl.* import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope import org.jetbrains.kotlin.idea.fir.low.level.api.api.FirModuleResolveState -import org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacade import org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacadeForCompletion +import org.jetbrains.kotlin.idea.fir.low.level.api.api.getFirFile import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession import org.jetbrains.kotlin.idea.frontend.api.ValidityToken import org.jetbrains.kotlin.idea.frontend.api.ValidityTokenOwner @@ -137,7 +137,7 @@ internal class KtFirScopeProvider( ktFile: KtFile, positionInFakeFile: KtElement ): LowLevelFirApiFacadeForCompletion.FirCompletionContext { - val firFile = LowLevelFirApiFacade.getFirFile(ktFile, firResolveState) + val firFile = ktFile.getFirFile(firResolveState) val declarationContext = EnclosingDeclarationContext.detect(ktFile, positionInFakeFile) return declarationContext.buildCompletionContext(firFile, firResolveState) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirSymbolProvider.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirSymbolProvider.kt index 5695ee6b838..e368febdaf2 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirSymbolProvider.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirSymbolProvider.kt @@ -9,8 +9,8 @@ import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.resolve.providers.FirSymbolProvider import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol import org.jetbrains.kotlin.idea.fir.low.level.api.api.FirModuleResolveState -import org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacade import org.jetbrains.kotlin.idea.fir.low.level.api.api.getOrBuildFirOfType +import org.jetbrains.kotlin.idea.fir.low.level.api.api.withFirDeclarationOfType import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession import org.jetbrains.kotlin.idea.frontend.api.ValidityTokenOwner import org.jetbrains.kotlin.idea.frontend.api.ValidityToken @@ -33,68 +33,68 @@ internal class KtFirSymbolProvider( private val firSymbolProvider by weakRef(firSymbolProvider) override fun getParameterSymbol(psi: KtParameter): KtParameterSymbol = withValidityAssertion { - LowLevelFirApiFacade.withFirDeclarationOfType(psi, resolveState) { + psi.withFirDeclarationOfType(resolveState) { firSymbolBuilder.buildParameterSymbol(it) } } override fun getFunctionSymbol(psi: KtNamedFunction): KtFunctionSymbol = withValidityAssertion { - LowLevelFirApiFacade.withFirDeclarationOfType(psi, resolveState) { + psi.withFirDeclarationOfType(resolveState) { firSymbolBuilder.buildFunctionSymbol(it) } } override fun getConstructorSymbol(psi: KtConstructor<*>): KtConstructorSymbol = withValidityAssertion { - LowLevelFirApiFacade.withFirDeclarationOfType(psi, resolveState) { + psi.withFirDeclarationOfType(resolveState) { firSymbolBuilder.buildConstructorSymbol(it) } } override fun getTypeParameterSymbol(psi: KtTypeParameter): KtTypeParameterSymbol = withValidityAssertion { - LowLevelFirApiFacade.withFirDeclarationOfType(psi, resolveState) { + psi.withFirDeclarationOfType(resolveState) { firSymbolBuilder.buildTypeParameterSymbol(it) } } override fun getTypeAliasSymbol(psi: KtTypeAlias): KtTypeAliasSymbol = withValidityAssertion { - LowLevelFirApiFacade.withFirDeclarationOfType(psi, resolveState) { + psi.withFirDeclarationOfType(resolveState) { firSymbolBuilder.buildTypeAliasSymbol(it) } } override fun getEnumEntrySymbol(psi: KtEnumEntry): KtEnumEntrySymbol = withValidityAssertion { - LowLevelFirApiFacade.withFirDeclarationOfType(psi, resolveState) { + psi.withFirDeclarationOfType(resolveState) { firSymbolBuilder.buildEnumEntrySymbol(it) } } override fun getAnonymousFunctionSymbol(psi: KtNamedFunction): KtAnonymousFunctionSymbol = withValidityAssertion { - LowLevelFirApiFacade.withFirDeclarationOfType(psi, resolveState) { + psi.withFirDeclarationOfType(resolveState) { firSymbolBuilder.buildFunctionSymbol(it) } firSymbolBuilder.buildAnonymousFunctionSymbol(psi.getOrBuildFirOfType(resolveState)) } override fun getAnonymousFunctionSymbol(psi: KtLambdaExpression): KtAnonymousFunctionSymbol = withValidityAssertion { - LowLevelFirApiFacade.withFirDeclarationOfType(psi, resolveState) { + psi.withFirDeclarationOfType(resolveState) { firSymbolBuilder.buildAnonymousFunctionSymbol(it) } } override fun getVariableSymbol(psi: KtProperty): KtVariableSymbol = withValidityAssertion { - LowLevelFirApiFacade.withFirDeclarationOfType(psi, resolveState) { + psi.withFirDeclarationOfType(resolveState) { firSymbolBuilder.buildVariableSymbol(it) } } override fun getClassOrObjectSymbol(psi: KtClassOrObject): KtClassOrObjectSymbol = withValidityAssertion { - LowLevelFirApiFacade.withFirDeclarationOfType(psi, resolveState) { + psi.withFirDeclarationOfType(resolveState) { firSymbolBuilder.buildClassSymbol(it) } } override fun getPropertyAccessorSymbol(psi: KtPropertyAccessor): KtPropertyAccessorSymbol = withValidityAssertion { - LowLevelFirApiFacade.withFirDeclarationOfType(psi, resolveState) { + psi.withFirDeclarationOfType(resolveState) { firSymbolBuilder.buildPropertyAccessorSymbol(it) } } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/FirRefWithValidityCheck.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/FirRefWithValidityCheck.kt index da29a8264ea..bf646649ee7 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/FirRefWithValidityCheck.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/FirRefWithValidityCheck.kt @@ -8,7 +8,7 @@ package org.jetbrains.kotlin.idea.frontend.api.fir.utils import org.jetbrains.kotlin.fir.declarations.FirDeclaration import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.idea.fir.low.level.api.api.FirModuleResolveState -import org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacade +import org.jetbrains.kotlin.idea.fir.low.level.api.api.resolvedFirToPhase import org.jetbrains.kotlin.idea.frontend.api.ValidityToken import org.jetbrains.kotlin.idea.frontend.api.ValidityTokenOwner import org.jetbrains.kotlin.idea.frontend.api.assertIsValid @@ -24,7 +24,7 @@ internal class FirRefWithValidityCheck(fir: D, resolveState: ?: throw EntityWasGarbageCollectedException("FirElement") val resolveState = resolveStateWeakRef.get() ?: throw EntityWasGarbageCollectedException("FirModuleResolveState") - LowLevelFirApiFacade.resolvedFirToPhase(fir, phase, resolveState) + fir.resolvedFirToPhase(phase, resolveState) return resolveState.withFirDeclaration(fir) { action(it) } } @@ -34,7 +34,7 @@ internal class FirRefWithValidityCheck(fir: D, resolveState: ?: throw EntityWasGarbageCollectedException("FirElement") val resolveState = resolveStateWeakRef.get() ?: throw EntityWasGarbageCollectedException("FirModuleResolveState") - LowLevelFirApiFacade.resolvedFirToPhase(fir, FirResolvePhase.BODY_RESOLVE, resolveState) + fir.resolvedFirToPhase(FirResolvePhase.BODY_RESOLVE, resolveState) return action(resolveState.withFirDeclaration(fir) { it }) } diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/AbstractKtDeclarationAndFirDeclarationEqualityChecker.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/AbstractKtDeclarationAndFirDeclarationEqualityChecker.kt index ed32098fb60..1272b8243f4 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/AbstractKtDeclarationAndFirDeclarationEqualityChecker.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/AbstractKtDeclarationAndFirDeclarationEqualityChecker.kt @@ -8,7 +8,8 @@ package org.jetbrains.kotlin.idea.fir import com.intellij.openapi.util.io.FileUtil import com.intellij.rt.execution.junit.FileComparisonFailure import org.jetbrains.kotlin.fir.declarations.FirFunction -import org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacade +import org.jetbrains.kotlin.idea.fir.low.level.api.api.getOrBuildFirOfType +import org.jetbrains.kotlin.idea.fir.low.level.api.api.getResolveState import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.KtFunction @@ -19,9 +20,9 @@ abstract class AbstractKtDeclarationAndFirDeclarationEqualityChecker : KotlinLig protected fun doTest(path: String) { val file = File(path) val ktFile = myFixture.configureByText(file.name, FileUtil.loadFile(file)) as KtFile - val resolveState = LowLevelFirApiFacade.getResolveStateFor(ktFile) + val resolveState = ktFile.getResolveState() ktFile.forEachDescendantOfType { ktFunction -> - val firFunction = LowLevelFirApiFacade.getOrBuildFirFor(ktFunction, resolveState) as FirFunction<*> + val firFunction = ktFunction.getOrBuildFirOfType>(resolveState) if (!KtDeclarationAndFirDeclarationEqualityChecker.representsTheSameDeclaration(ktFunction, firFunction)) { throw FileComparisonFailure( /* message= */ null, From 65a7ee501248959e7f6cbb63ddf9b27ad2062417 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 26 Nov 2020 10:57:33 +0100 Subject: [PATCH 261/698] FIR IDE: remove duplicating withFirResolvedToBodyResolve --- .../KtFirCompletionCandidateChecker.kt | 2 +- .../api/fir/utils/FirRefWithValidityCheck.kt | 21 +++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCompletionCandidateChecker.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCompletionCandidateChecker.kt index 4fe03329dfd..8767bd0a20b 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCompletionCandidateChecker.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCompletionCandidateChecker.kt @@ -61,7 +61,7 @@ internal class KtFirCompletionCandidateChecker( private inline fun , F : FirDeclaration, R> KtCallableSymbol.withResolvedFirOfType( noinline action: (F) -> R, - ): R? = this.safeAs()?.firRef?.withFirResolvedToBodyResolve(action) + ): R? = this.safeAs()?.firRef?.withFir(phase = FirResolvePhase.BODY_RESOLVE, action) private fun checkExtension( candidateSymbol: FirCallableDeclaration<*>, diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/FirRefWithValidityCheck.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/FirRefWithValidityCheck.kt index bf646649ee7..dbb13f8cba5 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/FirRefWithValidityCheck.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/FirRefWithValidityCheck.kt @@ -25,17 +25,16 @@ internal class FirRefWithValidityCheck(fir: D, resolveState: val resolveState = resolveStateWeakRef.get() ?: throw EntityWasGarbageCollectedException("FirModuleResolveState") fir.resolvedFirToPhase(phase, resolveState) - return resolveState.withFirDeclaration(fir) { action(it) } - } - - inline fun withFirResolvedToBodyResolve(action: (fir: D) -> R): R { - token.assertIsValid() - val fir = firWeakRef.get() - ?: throw EntityWasGarbageCollectedException("FirElement") - val resolveState = resolveStateWeakRef.get() - ?: throw EntityWasGarbageCollectedException("FirModuleResolveState") - fir.resolvedFirToPhase(FirResolvePhase.BODY_RESOLVE, resolveState) - return action(resolveState.withFirDeclaration(fir) { it }) + return when (phase) { + FirResolvePhase.BODY_RESOLVE -> { + /* + The BODY_RESOLVE phase is the maximum possible phase we can resolve our declaration to + So there is not need to run whole `action` under read lock + */ + action(resolveState.withFirDeclaration(fir) { it }) + } + else -> resolveState.withFirDeclaration(fir) { action(it) } + } } val resolveState From 93648e6cd3ddf34399d0b925a1fc7d89e019f466 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 26 Nov 2020 10:58:47 +0100 Subject: [PATCH 262/698] FIR IDE: use mor specific exception in EntityWasGarbageCollectedException --- .../idea/frontend/api/fir/utils/FirRefWithValidityCheck.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/FirRefWithValidityCheck.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/FirRefWithValidityCheck.kt index dbb13f8cba5..708fd7a25ee 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/FirRefWithValidityCheck.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/FirRefWithValidityCheck.kt @@ -38,7 +38,7 @@ internal class FirRefWithValidityCheck(fir: D, resolveState: } val resolveState - get() = resolveStateWeakRef.get() ?: error("FirModuleResolveState was garbage collected while analysis session is still valid") + get() = resolveStateWeakRef.get() ?: throw EntityWasGarbageCollectedException("FirModuleResolveState") inline fun withFirAndCache(phase: FirResolvePhase = FirResolvePhase.RAW_FIR, crossinline createValue: (fir: D) -> R) = ValidityAwareCachedValue(token) { From b4d63b9b139d21f21b9a55f744581a1960825f03 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 26 Nov 2020 11:26:05 +0100 Subject: [PATCH 263/698] FIR IDE: add docs for LowLevelFirApiFacade functions --- .../low/level/api/api/LowLevelFirApiFacade.kt | 78 +++++++++++++++---- .../fir/components/KtFirDiagnosticProvider.kt | 4 +- 2 files changed, 66 insertions(+), 16 deletions(-) diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/LowLevelFirApiFacade.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/LowLevelFirApiFacade.kt index a7330a6c1e0..21f456f7b1e 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/LowLevelFirApiFacade.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/LowLevelFirApiFacade.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.idea.fir.low.level.api.api import org.jetbrains.kotlin.diagnostics.Diagnostic import org.jetbrains.kotlin.fir.FirElement import org.jetbrains.kotlin.fir.declarations.FirDeclaration +import org.jetbrains.kotlin.fir.declarations.FirFile import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.idea.caches.project.IdeaModuleInfo import org.jetbrains.kotlin.idea.caches.project.getModuleInfo @@ -19,23 +20,25 @@ import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.KtLambdaExpression import kotlin.reflect.KClass +/** + * Returns [FirModuleResolveState] which corresponds to containing module + */ fun KtElement.getResolveState(): FirModuleResolveState = getModuleInfo().getResolveState() +/** + * Returns [FirModuleResolveState] which corresponds to containing module + */ fun IdeaModuleInfo.getResolveState(): FirModuleResolveState = FirIdeResolveStateService.getInstance(project!!).getResolveState(this) -fun KtFile.getFirFile(resolveState: FirModuleResolveState) = - resolveState.getFirFile(this) /** - * Creates [FirDeclaration] by [KtDeclaration] and runs an [action] with it - * [this@withFirDeclaration] - * [FirDeclaration] passed to [action] should not be leaked outside [action] lambda - * [FirDeclaration] passed to [action] will be resolved at least to [phase] - * Otherwise, some threading problems may arise, + * Creates [FirDeclaration] by [KtDeclaration] and executes an [action] on it + * [FirDeclaration] passed to [action] will be resolved at least to [phase] when executing [action] on it * - * [this@withFirDeclaration] should be non-local declaration (should have fully qualified name) + * [FirDeclaration] passed to [action] should not be leaked outside [action] lambda + * Otherwise, some threading problems may arise, */ @OptIn(InternalForInline::class) inline fun KtDeclaration.withFirDeclaration( @@ -48,16 +51,33 @@ inline fun KtDeclaration.withFirDeclaration( return action(firDeclaration) } +/** + * Creates [FirDeclaration] by [KtDeclaration] and executes an [action] on it + * [FirDeclaration] passed to [action] will be resolved at least to [phase] when executing [action] on it + * + * If resulted [FirDeclaration] is not [F] throws [InvalidFirElementTypeException] + * + * [FirDeclaration] passed to [action] should not be leaked outside [action] lambda + * Otherwise, some threading problems may arise, + */ @OptIn(InternalForInline::class) inline fun KtDeclaration.withFirDeclarationOfType( resolveState: FirModuleResolveState, + phase: FirResolvePhase = FirResolvePhase.RAW_FIR, action: (F) -> R -): R { - val firDeclaration = resolveState.findSourceFirDeclaration(this) +): R = withFirDeclaration(resolveState, phase) { firDeclaration -> if (firDeclaration !is F) throw InvalidFirElementTypeException(this, F::class, firDeclaration::class) - return action(firDeclaration) + action(firDeclaration) } +/** +* Creates [FirDeclaration] by [KtLambdaExpression] and executes an [action] on it +* +* If resulted [FirDeclaration] is not [F] throws [InvalidFirElementTypeException] +* +* [FirDeclaration] passed to [action] should not be leaked outside [action] lambda +* Otherwise, some threading problems may arise, +*/ @OptIn(InternalForInline::class) inline fun KtLambdaExpression.withFirDeclarationOfType( resolveState: FirModuleResolveState, @@ -68,12 +88,23 @@ inline fun KtLambdaExpression.withFirDeclaration return action(firDeclaration) } -fun getDiagnosticsFor(element: KtElement, resolveState: FirModuleResolveState): Collection = - resolveState.getDiagnostics(element) +/** + * Returns a list of Diagnostics compiler finds for given [KtElement] + */ +fun KtElement.getDiagnostics(resolveState: FirModuleResolveState): Collection = + resolveState.getDiagnostics(this) +/** + * Returns a list of Diagnostics compiler finds for given [KtFile] + */ fun KtFile.collectDiagnosticsForFile(resolveState: FirModuleResolveState): Collection = resolveState.collectDiagnosticsForFile(this) +/** + * Resolves a given [FirDeclaration] to [phase] and returns resolved declaration + * + * Should not be called form [withFirDeclaration], [withFirDeclarationOfType] functions, as it it may cause deadlock + */ fun D.resolvedFirToPhase( phase: FirResolvePhase, resolveState: FirModuleResolveState @@ -81,14 +112,26 @@ fun D.resolvedFirToPhase( resolveState.resolvedFirToPhase(this, phase) +/** + * Get a [FirElement] which was created by [KtElement] + * Returned [FirElement] is guaranteed to be resolved to [FirResolvePhase.BODY_RESOLVE] phase + */ fun KtElement.getOrBuildFir( resolveState: FirModuleResolveState, -) = resolveState.getOrBuildFirFor(this) +): FirElement = resolveState.getOrBuildFirFor(this) +/** + * Get a [FirElement] which was created by [KtElement], but only if it is subtype of [E], `null` otherwise + * Returned [FirElement] is guaranteed to be resolved to [FirResolvePhase.BODY_RESOLVE] phase + */ inline fun KtElement.getOrBuildFirSafe( resolveState: FirModuleResolveState, ) = getOrBuildFir(resolveState) as? E +/** + * Get a [FirElement] which was created by [KtElement], but only if it is subtype of [E], throws [InvalidFirElementTypeException] otherwise + * Returned [FirElement] is guaranteed to be resolved to [FirResolvePhase.BODY_RESOLVE] phase + */ inline fun KtElement.getOrBuildFirOfType( resolveState: FirModuleResolveState, ): E { @@ -97,6 +140,13 @@ inline fun KtElement.getOrBuildFirOfType( throw InvalidFirElementTypeException(this, E::class, fir::class) } +/** + * Get a [FirFile] which was created by [KtElement] + * Returned [FirFile] can be resolved to any phase from [FirResolvePhase.RAW_FIR] to [FirResolvePhase.BODY_RESOLVE] + */ +fun KtFile.getFirFile(resolveState: FirModuleResolveState): FirFile = + resolveState.getFirFile(this) + class InvalidFirElementTypeException( ktElement: KtElement, expectedFirClass: KClass, diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirDiagnosticProvider.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirDiagnosticProvider.kt index 89a4f2e4944..281849f1682 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirDiagnosticProvider.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirDiagnosticProvider.kt @@ -7,7 +7,7 @@ package org.jetbrains.kotlin.idea.frontend.api.fir.components import org.jetbrains.kotlin.diagnostics.Diagnostic import org.jetbrains.kotlin.idea.fir.low.level.api.api.collectDiagnosticsForFile -import org.jetbrains.kotlin.idea.fir.low.level.api.api.getDiagnosticsFor +import org.jetbrains.kotlin.idea.fir.low.level.api.api.getDiagnostics import org.jetbrains.kotlin.idea.frontend.api.ValidityToken import org.jetbrains.kotlin.idea.frontend.api.components.KtDiagnosticProvider import org.jetbrains.kotlin.idea.frontend.api.fir.KtFirAnalysisSession @@ -20,7 +20,7 @@ internal class KtFirDiagnosticProvider( override val token: ValidityToken, ) : KtDiagnosticProvider(), KtFirAnalysisSessionComponent { override fun getDiagnosticsForElement(element: KtElement): Collection = withValidityAssertion { - getDiagnosticsFor(element, firResolveState) + element.getDiagnostics(firResolveState) } override fun collectDiagnosticsForFile(ktFile: KtFile): Collection = From 953dba808b748d09c7d4b47dff2e829de263cdc3 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 26 Nov 2020 11:34:23 +0100 Subject: [PATCH 264/698] FIR IDE: move withFirDeclaration to LowLevelFirApiFacade --- .../level/api/api/FirModuleResolveState.kt | 16 --------- .../low/level/api/api/LowLevelFirApiFacade.kt | 34 +++++++++++++++++-- .../api/fir/utils/FirRefWithValidityCheck.kt | 6 ++-- 3 files changed, 34 insertions(+), 22 deletions(-) diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/FirModuleResolveState.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/FirModuleResolveState.kt index a9c668e3623..2399012538a 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/FirModuleResolveState.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/FirModuleResolveState.kt @@ -85,20 +85,4 @@ abstract class FirModuleResolveState { ) internal abstract fun getFirFile(declaration: FirDeclaration, cache: ModuleFileCache): FirFile? - - fun withFirDeclaration(declaration: D, action: (D) -> R): R { - val originalDeclaration = (declaration as? FirCallableDeclaration<*>)?.unwrapFakeOverrides() ?: declaration - val session = originalDeclaration.session - return when { - originalDeclaration.origin == FirDeclarationOrigin.Source - && session is FirIdeSourcesSession - -> { - val cache = session.cache - val file = getFirFile(declaration, cache) - ?: error("Fir file was not found for\n${declaration.render()}\n${declaration.ktDeclaration.getElementTextInContext()}") - cache.firFileLockProvider.withReadLock(file) { action(declaration) } - } - else -> action(declaration) - } - } } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/LowLevelFirApiFacade.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/LowLevelFirApiFacade.kt index 21f456f7b1e..e51d168ec1f 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/LowLevelFirApiFacade.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/LowLevelFirApiFacade.kt @@ -7,13 +7,16 @@ package org.jetbrains.kotlin.idea.fir.low.level.api.api import org.jetbrains.kotlin.diagnostics.Diagnostic import org.jetbrains.kotlin.fir.FirElement -import org.jetbrains.kotlin.fir.declarations.FirDeclaration -import org.jetbrains.kotlin.fir.declarations.FirFile -import org.jetbrains.kotlin.fir.declarations.FirResolvePhase +import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.fir.render +import org.jetbrains.kotlin.fir.unwrapFakeOverrides import org.jetbrains.kotlin.idea.caches.project.IdeaModuleInfo import org.jetbrains.kotlin.idea.caches.project.getModuleInfo import org.jetbrains.kotlin.idea.fir.low.level.api.FirIdeResolveStateService import org.jetbrains.kotlin.idea.fir.low.level.api.annotations.InternalForInline +import org.jetbrains.kotlin.idea.fir.low.level.api.sessions.FirIdeSourcesSession +import org.jetbrains.kotlin.idea.fir.low.level.api.util.ktDeclaration +import org.jetbrains.kotlin.idea.util.getElementTextInContext import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.psi.KtFile @@ -88,6 +91,31 @@ inline fun KtLambdaExpression.withFirDeclaration return action(firDeclaration) } +/** + * Executes [action] with given [FirDeclaration] + * [FirDeclaration] passed to [action] will be resolved at least to [phase] when executing [action] on it + */ +fun D.withFirDeclaration( + resolveState: FirModuleResolveState, + phase: FirResolvePhase = FirResolvePhase.RAW_FIR, + action: (D) -> R, +): R { + resolvedFirToPhase(phase, resolveState) + val originalDeclaration = (this as? FirCallableDeclaration<*>)?.unwrapFakeOverrides() ?: this + val session = originalDeclaration.session + return when { + originalDeclaration.origin == FirDeclarationOrigin.Source + && session is FirIdeSourcesSession + -> { + val cache = session.cache + val file = resolveState.getFirFile(this, cache) + ?: error("Fir file was not found for\n${render()}\n${ktDeclaration.getElementTextInContext()}") + cache.firFileLockProvider.withReadLock(file) { action(this) } + } + else -> action(this) + } +} + /** * Returns a list of Diagnostics compiler finds for given [KtElement] */ diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/FirRefWithValidityCheck.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/FirRefWithValidityCheck.kt index 708fd7a25ee..d143492571c 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/FirRefWithValidityCheck.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/FirRefWithValidityCheck.kt @@ -9,6 +9,7 @@ import org.jetbrains.kotlin.fir.declarations.FirDeclaration import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.idea.fir.low.level.api.api.FirModuleResolveState import org.jetbrains.kotlin.idea.fir.low.level.api.api.resolvedFirToPhase +import org.jetbrains.kotlin.idea.fir.low.level.api.api.withFirDeclaration import org.jetbrains.kotlin.idea.frontend.api.ValidityToken import org.jetbrains.kotlin.idea.frontend.api.ValidityTokenOwner import org.jetbrains.kotlin.idea.frontend.api.assertIsValid @@ -24,16 +25,15 @@ internal class FirRefWithValidityCheck(fir: D, resolveState: ?: throw EntityWasGarbageCollectedException("FirElement") val resolveState = resolveStateWeakRef.get() ?: throw EntityWasGarbageCollectedException("FirModuleResolveState") - fir.resolvedFirToPhase(phase, resolveState) return when (phase) { FirResolvePhase.BODY_RESOLVE -> { /* The BODY_RESOLVE phase is the maximum possible phase we can resolve our declaration to So there is not need to run whole `action` under read lock */ - action(resolveState.withFirDeclaration(fir) { it }) + action(fir.withFirDeclaration(resolveState, phase) { it }) } - else -> resolveState.withFirDeclaration(fir) { action(it) } + else -> fir.withFirDeclaration(resolveState, phase) { action(it) } } } From 76c0dc7dba68e5c787f21a253b7d87dc17a6e0c1 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 26 Nov 2020 13:46:58 +0100 Subject: [PATCH 265/698] FIR IDE: add property support for incremental analysis --- .../level/api/api/FirModuleResolveState.kt | 1 - .../api/element/builder/FirElementBuilder.kt | 6 +- .../api/file/structure/FileElementFactory.kt | 33 ++++++--- .../level/api/file/structure/FileStructure.kt | 5 +- .../file/structure/FileStructureElement.kt | 70 ++++++++++++------- .../api/file/structure/FileStructureUtil.kt | 36 ++++++++++ .../fileStructure/classMemberProperty.kt | 11 +++ .../testdata/fileStructure/localProperty.kt | 15 ++++ .../fileStructure/topLevelProperty.kt | 9 +++ .../topPropertyWithTypeInGetter.kt | 3 + .../topPropertyWithTypeInGetterOnNextLine.kt | 4 ++ .../topPropertyWithTypeInInititalzer.kt | 3 + .../topPropertyWithTypeInSetter.kt | 4 ++ .../topPropertyWithoutTypeInGetter.kt | 3 + .../topPropertyWithoutTypeInInititalzer.kt | 3 + .../topPropertyWithoutTypeInSetter.kt | 8 +++ ...BlockModificationTrackerConsistencyTest.kt | 10 ++- .../structure/AbstractFileStructureTest.kt | 50 ++++++------- ...cationTrackerConsistencyTestGenerated.java | 35 ++++++++++ .../structure/FileStructureTestGenerated.java | 15 ++++ ...otlinModificationTrackerTestGenerated.java | 35 ++++++++++ 21 files changed, 290 insertions(+), 69 deletions(-) create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/classMemberProperty.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localProperty.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelProperty.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithTypeInGetter.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithTypeInGetterOnNextLine.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithTypeInInititalzer.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithTypeInSetter.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithoutTypeInGetter.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithoutTypeInInititalzer.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithoutTypeInSetter.kt diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/FirModuleResolveState.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/FirModuleResolveState.kt index 2399012538a..7b2d1585c34 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/FirModuleResolveState.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/FirModuleResolveState.kt @@ -23,7 +23,6 @@ import org.jetbrains.kotlin.idea.fir.low.level.api.element.builder.FirTowerDataC import org.jetbrains.kotlin.idea.fir.low.level.api.file.builder.FirFileBuilder import org.jetbrains.kotlin.idea.fir.low.level.api.file.builder.ModuleFileCache import org.jetbrains.kotlin.idea.fir.low.level.api.sessions.FirIdeSourcesSession -import org.jetbrains.kotlin.idea.fir.low.level.api.util.ktDeclaration import org.jetbrains.kotlin.idea.util.getElementTextInContext import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.psi.KtElement diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/element/builder/FirElementBuilder.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/element/builder/FirElementBuilder.kt index 9e0d633e5b7..fdbc9b84ee3 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/element/builder/FirElementBuilder.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/element/builder/FirElementBuilder.kt @@ -8,10 +8,7 @@ package org.jetbrains.kotlin.idea.fir.low.level.api.element.builder import com.intellij.psi.PsiElement import org.jetbrains.annotations.TestOnly import org.jetbrains.kotlin.fir.FirElement -import org.jetbrains.kotlin.fir.declarations.FirResolvePhase -import org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver import org.jetbrains.kotlin.idea.fir.low.level.api.annotations.ThreadSafe -import org.jetbrains.kotlin.idea.fir.low.level.api.file.builder.FirFileBuilder import org.jetbrains.kotlin.idea.fir.low.level.api.file.builder.ModuleFileCache import org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructureCache import org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructureElement @@ -104,6 +101,9 @@ internal fun PsiElement.getNonLocalContainingInBodyDeclarationWith(): KtNamedDec getNonLocalContainingOrThisDeclaration { declaration -> when (declaration) { is KtNamedFunction -> declaration.bodyExpression?.isAncestor(this) == true + is KtProperty -> declaration.initializer?.isAncestor(this) == true || + declaration.getter?.isAncestor(this) == true || + declaration.setter?.isAncestor(this) == true else -> false } } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileElementFactory.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileElementFactory.kt index d06478a7833..c47f74f7572 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileElementFactory.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileElementFactory.kt @@ -7,9 +7,11 @@ package org.jetbrains.kotlin.idea.fir.low.level.api.file.structure import org.jetbrains.kotlin.fir.declarations.FirDeclaration import org.jetbrains.kotlin.fir.declarations.FirFile +import org.jetbrains.kotlin.fir.declarations.FirProperty import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.psi.KtNamedFunction +import org.jetbrains.kotlin.psi.KtProperty internal object FileElementFactory { /** @@ -20,13 +22,19 @@ internal object FileElementFactory { ktDeclaration: KtDeclaration, firFile: FirFile, ): FileStructureElement = when { - ktDeclaration is KtNamedFunction && ktDeclaration.name != null && ktDeclaration.hasExplicitTypeOrUnit -> - ReanalyzableFunctionStructureElement( - firFile, - ktDeclaration, - (firDeclaration as FirSimpleFunction).symbol, - ktDeclaration.modificationStamp - ) + ktDeclaration is KtNamedFunction && ktDeclaration.isReanalyzableContainer() -> ReanalyzableFunctionStructureElement( + firFile, + ktDeclaration, + (firDeclaration as FirSimpleFunction).symbol, + ktDeclaration.modificationStamp + ) + + ktDeclaration is KtProperty && ktDeclaration.isReanalyzableContainer() -> ReanalyzablePropertyStructureElement( + firFile, + ktDeclaration, + (firDeclaration as FirProperty).symbol, + ktDeclaration.modificationStamp + ) else -> NonReanalyzableDeclarationStructureElement( firFile, @@ -40,11 +48,18 @@ internal object FileElementFactory { */ fun isReanalyzableContainer( ktDeclaration: KtDeclaration, - ): Boolean = when { - ktDeclaration is KtNamedFunction && ktDeclaration.name != null && ktDeclaration.hasExplicitTypeOrUnit -> true + ): Boolean = when (ktDeclaration) { + is KtNamedFunction -> ktDeclaration.isReanalyzableContainer() + is KtProperty -> ktDeclaration.isReanalyzableContainer() else -> false } + private fun KtNamedFunction.isReanalyzableContainer() = + name != null && hasExplicitTypeOrUnit + + private fun KtProperty.isReanalyzableContainer() = + name != null && typeReference != null + private val KtNamedFunction.hasExplicitTypeOrUnit get() = hasBlockBody() || typeReference != null } \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructure.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructure.kt index 586b1e8fe9e..078179f7d62 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructure.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructure.kt @@ -36,11 +36,12 @@ internal class FileStructure( } private fun getStructureElementForDeclaration(declaration: KtAnnotated): FileStructureElement { + @Suppress("CANNOT_CHECK_FOR_ERASED") val structureElement = structureElements.compute(declaration) { _, structureElement -> when { structureElement == null -> createStructureElement(declaration) - structureElement is ReanalyzableStructureElement<*> && !structureElement.isUpToDate() -> { - structureElement.reanalyze(declaration as KtNamedFunction, moduleFileCache, firLazyDeclarationResolver, firIdeProvider) + structureElement is ReanalyzableStructureElement && !structureElement.isUpToDate() -> { + structureElement.reanalyze(declaration as KtDeclaration, moduleFileCache, firLazyDeclarationResolver, firIdeProvider) } else -> structureElement } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureElement.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureElement.kt index be61b9deecd..dbe74c5d806 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureElement.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureElement.kt @@ -11,10 +11,10 @@ import org.jetbrains.kotlin.fir.analysis.collectors.DiagnosticCollectorDeclarati import org.jetbrains.kotlin.fir.containingClass import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.psi -import org.jetbrains.kotlin.fir.realPsi import org.jetbrains.kotlin.fir.resolve.toSymbol import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol +import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol import org.jetbrains.kotlin.idea.fir.low.level.api.diagnostics.FirIdeStructureElementDiagnosticsCollector import org.jetbrains.kotlin.idea.fir.low.level.api.file.builder.ModuleFileCache import org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver @@ -40,16 +40,16 @@ internal sealed class FileStructureElement { } internal sealed class ReanalyzableStructureElement : FileStructureElement() { - abstract override val psi: KT + abstract override val psi: KtDeclaration abstract val firSymbol: AbstractFirBasedSymbol<*> abstract val timestamp: Long /** * Creates new declaration by [newKtDeclaration] which will serve as replacement of [firSymbol] - * Also, modify [firFile] & replace old version of declaration to a new one + * Also, modify [firFile] & replace old version of declaration with a new one */ abstract fun reanalyze( - newKtDeclaration: KtNamedFunction, + newKtDeclaration: KT, cache: ModuleFileCache, firLazyDeclarationResolver: FirLazyDeclarationResolver, firIdeProvider: FirIdeProvider, @@ -75,18 +75,6 @@ internal class ReanalyzableFunctionStructureElement( override val mappings: Map = FirElementsRecorder.recordElementsFrom(firSymbol.fir, recorder) - private fun replaceFunction(from: FirSimpleFunction, to: FirSimpleFunction) { - val declarations = if (from.symbol.callableId.className == null) { - firFile.declarations as MutableList - } else { - val classLikeLookupTag = from.containingClass() - ?: error("Class name should not be null for non-top-level & non-local declarations") - val containingClass = classLikeLookupTag.toSymbol(firFile.session)?.fir as FirRegularClass - containingClass.declarations as MutableList - } - declarations.replaceFirst(from, to) - } - override fun reanalyze( newKtDeclaration: KtNamedFunction, cache: ModuleFileCache, @@ -96,12 +84,7 @@ internal class ReanalyzableFunctionStructureElement( val newFunction = firIdeProvider.buildFunctionWithBody(newKtDeclaration) as FirSimpleFunction val originalFunction = firSymbol.fir as FirSimpleFunction - cache.firFileLockProvider.withWriteLock(firFile) { - replaceFunction(originalFunction, newFunction) - } - - //todo remap symbol under firFile write lock - try { + return FileStructureUtil.withDeclarationReplaced(firFile, cache, originalFunction, newFunction) { firLazyDeclarationResolver.lazyResolveDeclaration( newFunction, cache, @@ -109,7 +92,7 @@ internal class ReanalyzableFunctionStructureElement( checkPCE = true, reresolveFile = true, ) - return cache.firFileLockProvider.withReadLock(firFile) { + cache.firFileLockProvider.withReadLock(firFile) { ReanalyzableFunctionStructureElement( firFile, newKtDeclaration, @@ -117,11 +100,44 @@ internal class ReanalyzableFunctionStructureElement( newKtDeclaration.modificationStamp, ) } - } catch (e: Throwable) { - cache.firFileLockProvider.withWriteLock(firFile) { - replaceFunction(newFunction, originalFunction) + } + } +} + +internal class ReanalyzablePropertyStructureElement( + override val firFile: FirFile, + override val psi: KtProperty, + override val firSymbol: FirPropertySymbol, + override val timestamp: Long +) : ReanalyzableStructureElement() { + override val mappings: Map = + FirElementsRecorder.recordElementsFrom(firSymbol.fir, recorder) + + override fun reanalyze( + newKtDeclaration: KtProperty, + cache: ModuleFileCache, + firLazyDeclarationResolver: FirLazyDeclarationResolver, + firIdeProvider: FirIdeProvider, + ): ReanalyzablePropertyStructureElement { + val newProperty = firIdeProvider.buildPropertyWithBody(newKtDeclaration) + val originalProperty = firSymbol.fir + + return FileStructureUtil.withDeclarationReplaced(firFile, cache, originalProperty, newProperty) { + firLazyDeclarationResolver.lazyResolveDeclaration( + newProperty, + cache, + FirResolvePhase.BODY_RESOLVE, + checkPCE = true, + reresolveFile = true, + ) + cache.firFileLockProvider.withReadLock(firFile) { + ReanalyzablePropertyStructureElement( + firFile, + newKtDeclaration, + newProperty.symbol, + newKtDeclaration.modificationStamp, + ) } - throw e } } } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureUtil.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureUtil.kt index d3f7b1bd765..b3ff3c5aadb 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureUtil.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureUtil.kt @@ -5,6 +5,14 @@ package org.jetbrains.kotlin.idea.fir.low.level.api.file.structure +import org.jetbrains.kotlin.fir.containingClass +import org.jetbrains.kotlin.fir.declarations.FirCallableDeclaration +import org.jetbrains.kotlin.fir.declarations.FirDeclaration +import org.jetbrains.kotlin.fir.declarations.FirFile +import org.jetbrains.kotlin.fir.declarations.FirRegularClass +import org.jetbrains.kotlin.fir.resolve.toSymbol +import org.jetbrains.kotlin.idea.fir.low.level.api.file.builder.ModuleFileCache +import org.jetbrains.kotlin.idea.fir.low.level.api.util.replaceFirst import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject @@ -15,4 +23,32 @@ internal object FileStructureUtil { ktDeclaration.containingClassOrObject is KtEnumEntry -> false else -> !KtPsiUtil.isLocal(ktDeclaration) } + + fun replaceDeclaration(firFile: FirFile, from: FirCallableDeclaration<*>, to: FirCallableDeclaration<*>) { + val declarations = if (from.symbol.callableId.className == null) { + firFile.declarations as MutableList + } else { + val classLikeLookupTag = from.containingClass() + ?: error("Class name should not be null for non-top-level & non-local declarations") + val containingClass = classLikeLookupTag.toSymbol(firFile.session)?.fir as FirRegularClass + containingClass.declarations as MutableList + } + declarations.replaceFirst(from, to) + } + + inline fun withDeclarationReplaced( + firFile: FirFile, + cache: ModuleFileCache, + from: FirCallableDeclaration<*>, + to: FirCallableDeclaration<*>, + action: () -> R, + ): R { + cache.firFileLockProvider.withWriteLock(firFile) { replaceDeclaration(firFile, from, to) } + return try { + action() + } catch (e: Throwable) { + cache.firFileLockProvider.withWriteLock(firFile) { replaceDeclaration(firFile, to, from) } + throw e + } + } } \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/classMemberProperty.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/classMemberProperty.kt new file mode 100644 index 00000000000..81221eecbae --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/classMemberProperty.kt @@ -0,0 +1,11 @@ +class X {/* NonReanalyzableDeclarationStructureElement */ + var x: Int/* ReanalyzablePropertyStructureElement */ + get() = field + set(value) { + field = value + } + + val y = 42/* NonReanalyzableDeclarationStructureElement */ + + var z: Int = 15/* ReanalyzablePropertyStructureElement */ +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localProperty.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localProperty.kt new file mode 100644 index 00000000000..654d56f3ac9 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localProperty.kt @@ -0,0 +1,15 @@ +fun foo() {/* ReanalyzableFunctionStructureElement */ + var x: Int +} +class A {/* NonReanalyzableDeclarationStructureElement */ + fun q() {/* ReanalyzableFunctionStructureElement */ + val y = 42 + } +} +class B {/* NonReanalyzableDeclarationStructureElement */ + class C {/* NonReanalyzableDeclarationStructureElement */ + fun u() {/* ReanalyzableFunctionStructureElement */ + var z: Int = 15 + } + } +} diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelProperty.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelProperty.kt new file mode 100644 index 00000000000..120de847eef --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelProperty.kt @@ -0,0 +1,9 @@ +var x: Int/* ReanalyzablePropertyStructureElement */ + get() = field + set(value) { + field = value + } + +val y = 42/* NonReanalyzableDeclarationStructureElement */ + +var z: Int = 15/* ReanalyzablePropertyStructureElement */ \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithTypeInGetter.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithTypeInGetter.kt new file mode 100644 index 00000000000..5a5dc8777a1 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithTypeInGetter.kt @@ -0,0 +1,3 @@ +val x: Int get() = y + +// OUT_OF_BLOCK: false diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithTypeInGetterOnNextLine.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithTypeInGetterOnNextLine.kt new file mode 100644 index 00000000000..5db82bd97b7 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithTypeInGetterOnNextLine.kt @@ -0,0 +1,4 @@ +val x: Int + get() = y + +// OUT_OF_BLOCK: false diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithTypeInInititalzer.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithTypeInInititalzer.kt new file mode 100644 index 00000000000..f5d54824464 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithTypeInInititalzer.kt @@ -0,0 +1,3 @@ +val x: Int = y + +// OUT_OF_BLOCK: false diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithTypeInSetter.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithTypeInSetter.kt new file mode 100644 index 00000000000..4c8e7b42452 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithTypeInSetter.kt @@ -0,0 +1,4 @@ +val x: Int + set(value) = y + +// OUT_OF_BLOCK: false diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithoutTypeInGetter.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithoutTypeInGetter.kt new file mode 100644 index 00000000000..e4d46a5e98c --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithoutTypeInGetter.kt @@ -0,0 +1,3 @@ +val x get() = y + +// OUT_OF_BLOCK: true diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithoutTypeInInititalzer.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithoutTypeInInititalzer.kt new file mode 100644 index 00000000000..5b5cce7d867 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithoutTypeInInititalzer.kt @@ -0,0 +1,3 @@ +val x = y + +// OUT_OF_BLOCK: true diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithoutTypeInSetter.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithoutTypeInSetter.kt new file mode 100644 index 00000000000..2723c109c1c --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithoutTypeInSetter.kt @@ -0,0 +1,8 @@ +val x + get() = 1 + set(value) { + + } + +// OUT_OF_BLOCK: true +// TODO should not be out of block diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureAndOutOfBlockModificationTrackerConsistencyTest.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureAndOutOfBlockModificationTrackerConsistencyTest.kt index e0c900d83f4..4b06426a9f1 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureAndOutOfBlockModificationTrackerConsistencyTest.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureAndOutOfBlockModificationTrackerConsistencyTest.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.idea.fir.low.level.api.file.structure import com.intellij.openapi.util.io.FileUtil import com.intellij.psi.PsiDocumentManager +import com.intellij.psi.PsiWhiteSpace import com.intellij.psi.util.parentOfType import junit.framework.Assert import org.jetbrains.kotlin.idea.fir.low.level.api.FirModuleResolveStateImpl @@ -53,8 +54,13 @@ abstract class AbstractFileStructureAndOutOfBlockModificationTrackerConsistencyT ) } - private fun KtFile.findElementAtCaret(): KtElement = - findElementAt(myFixture.caretOffset)!!.parentOfType()!! + private fun KtFile.findElementAtCaret(): KtElement { + val element = when (val elementAtOffset = findElementAt(myFixture.caretOffset)) { + is PsiWhiteSpace -> findElementAt((myFixture.caretOffset - 1).coerceAtLeast(0)) + else -> elementAtOffset + } + return element!!.parentOfType()!! + } private fun getStructureElementForKtElement(element: KtElement): Triple { val moduleResolveState = element.getResolveState() as FirModuleResolveStateImpl diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureTest.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureTest.kt index 5c2d246e575..c130c2980fd 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureTest.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureTest.kt @@ -8,20 +8,12 @@ package org.jetbrains.kotlin.idea.fir.low.level.api.file.structure import com.intellij.openapi.application.runUndoTransparentWriteAction import com.intellij.openapi.util.io.FileUtil import com.intellij.psi.PsiComment -import com.intellij.psi.PsiDocumentManager import com.intellij.psi.util.collectDescendantsOfType import com.intellij.psi.util.forEachDescendantOfType -import com.intellij.psi.util.parentOfType -import junit.framework.Assert -import org.jetbrains.kotlin.fir.render import org.jetbrains.kotlin.idea.fir.low.level.api.FirModuleResolveStateImpl import org.jetbrains.kotlin.idea.fir.low.level.api.api.getResolveState -import org.jetbrains.kotlin.idea.search.getKotlinFqName import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase -import org.jetbrains.kotlin.idea.util.getElementTextInContext import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.resolve.calls.callUtil.isFakeElement -import org.jetbrains.kotlin.test.InTextDirectivesUtils import org.jetbrains.kotlin.test.KotlinTestUtils import java.io.File @@ -40,23 +32,31 @@ abstract class AbstractFileStructureTest : KotlinLightCodeInsightFixtureTestCase ktFile.forEachDescendantOfType { ktDeclaration -> val structureElement = declarationToStructureElement[ktDeclaration] ?: return@forEachDescendantOfType val comment = structureElement.createComment() - when (ktDeclaration) { - is KtClassOrObject -> { - val lBrace = ktDeclaration.body?.lBrace - if (lBrace != null) { - ktDeclaration.body!!.addAfter(comment, lBrace) - } else { - ktDeclaration.parent.addAfter(comment, ktDeclaration) - } - } - is KtFunction -> { - val lBrace = ktDeclaration.bodyBlockExpression?.lBrace - if (lBrace != null) { - ktDeclaration.bodyBlockExpression!!.addAfter(comment, lBrace) - } else { - ktDeclaration.parent.addAfter(comment, ktDeclaration) - } - } + when (ktDeclaration) { + is KtClassOrObject -> { + val lBrace = ktDeclaration.body?.lBrace + if (lBrace != null) { + ktDeclaration.body!!.addAfter(comment, lBrace) + } else { + ktDeclaration.parent.addAfter(comment, ktDeclaration) + } + } + is KtFunction -> { + val lBrace = ktDeclaration.bodyBlockExpression?.lBrace + if (lBrace != null) { + ktDeclaration.bodyBlockExpression!!.addAfter(comment, lBrace) + } else { + ktDeclaration.parent.addAfter(comment, ktDeclaration) + } + } + is KtProperty -> { + val initializerOrTypeReference = ktDeclaration.initializer ?: ktDeclaration.typeReference + if (initializerOrTypeReference != null) { + ktDeclaration.addAfter(comment, initializerOrTypeReference) + } else { + ktDeclaration.parent.addAfter(comment, ktDeclaration) + } + } else -> error("Unsupported declaration $ktDeclaration") } } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureAndOutOfBlockModificationTrackerConsistencyTestGenerated.java b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureAndOutOfBlockModificationTrackerConsistencyTestGenerated.java index 82efa737118..5f2d976ca41 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureAndOutOfBlockModificationTrackerConsistencyTestGenerated.java +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureAndOutOfBlockModificationTrackerConsistencyTestGenerated.java @@ -53,6 +53,41 @@ public class FileStructureAndOutOfBlockModificationTrackerConsistencyTestGenerat runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelUnitFun.kt"); } + @TestMetadata("topPropertyWithTypeInGetter.kt") + public void testTopPropertyWithTypeInGetter() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithTypeInGetter.kt"); + } + + @TestMetadata("topPropertyWithTypeInGetterOnNextLine.kt") + public void testTopPropertyWithTypeInGetterOnNextLine() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithTypeInGetterOnNextLine.kt"); + } + + @TestMetadata("topPropertyWithTypeInInititalzer.kt") + public void testTopPropertyWithTypeInInititalzer() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithTypeInInititalzer.kt"); + } + + @TestMetadata("topPropertyWithTypeInSetter.kt") + public void testTopPropertyWithTypeInSetter() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithTypeInSetter.kt"); + } + + @TestMetadata("topPropertyWithoutTypeInGetter.kt") + public void testTopPropertyWithoutTypeInGetter() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithoutTypeInGetter.kt"); + } + + @TestMetadata("topPropertyWithoutTypeInInititalzer.kt") + public void testTopPropertyWithoutTypeInInititalzer() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithoutTypeInInititalzer.kt"); + } + + @TestMetadata("topPropertyWithoutTypeInSetter.kt") + public void testTopPropertyWithoutTypeInSetter() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithoutTypeInSetter.kt"); + } + @TestMetadata("typeInFunctionAnnotation.kt") public void testTypeInFunctionAnnotation() throws Exception { runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionAnnotation.kt"); diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureTestGenerated.java b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureTestGenerated.java index 597f3bde44c..5bf5f17f1ed 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureTestGenerated.java +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureTestGenerated.java @@ -33,6 +33,11 @@ public class FileStructureTestGenerated extends AbstractFileStructureTest { runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/class.kt"); } + @TestMetadata("classMemberProperty.kt") + public void testClassMemberProperty() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/classMemberProperty.kt"); + } + @TestMetadata("localClass.kt") public void testLocalClass() throws Exception { runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localClass.kt"); @@ -43,6 +48,11 @@ public class FileStructureTestGenerated extends AbstractFileStructureTest { runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localFun.kt"); } + @TestMetadata("localProperty.kt") + public void testLocalProperty() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localProperty.kt"); + } + @TestMetadata("nestedClasses.kt") public void testNestedClasses() throws Exception { runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/nestedClasses.kt"); @@ -63,6 +73,11 @@ public class FileStructureTestGenerated extends AbstractFileStructureTest { runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelFunWithType.kt"); } + @TestMetadata("topLevelProperty.kt") + public void testTopLevelProperty() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelProperty.kt"); + } + @TestMetadata("topLevelUnitFun.kt") public void testTopLevelUnitFun() throws Exception { runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelUnitFun.kt"); diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/ProjectWideOutOfBlockKotlinModificationTrackerTestGenerated.java b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/ProjectWideOutOfBlockKotlinModificationTrackerTestGenerated.java index ae77d2477b6..fb8abeebde0 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/ProjectWideOutOfBlockKotlinModificationTrackerTestGenerated.java +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/ProjectWideOutOfBlockKotlinModificationTrackerTestGenerated.java @@ -53,6 +53,41 @@ public class ProjectWideOutOfBlockKotlinModificationTrackerTestGenerated extends runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topLevelUnitFun.kt"); } + @TestMetadata("topPropertyWithTypeInGetter.kt") + public void testTopPropertyWithTypeInGetter() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithTypeInGetter.kt"); + } + + @TestMetadata("topPropertyWithTypeInGetterOnNextLine.kt") + public void testTopPropertyWithTypeInGetterOnNextLine() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithTypeInGetterOnNextLine.kt"); + } + + @TestMetadata("topPropertyWithTypeInInititalzer.kt") + public void testTopPropertyWithTypeInInititalzer() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithTypeInInititalzer.kt"); + } + + @TestMetadata("topPropertyWithTypeInSetter.kt") + public void testTopPropertyWithTypeInSetter() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithTypeInSetter.kt"); + } + + @TestMetadata("topPropertyWithoutTypeInGetter.kt") + public void testTopPropertyWithoutTypeInGetter() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithoutTypeInGetter.kt"); + } + + @TestMetadata("topPropertyWithoutTypeInInititalzer.kt") + public void testTopPropertyWithoutTypeInInititalzer() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithoutTypeInInititalzer.kt"); + } + + @TestMetadata("topPropertyWithoutTypeInSetter.kt") + public void testTopPropertyWithoutTypeInSetter() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/topPropertyWithoutTypeInSetter.kt"); + } + @TestMetadata("typeInFunctionAnnotation.kt") public void testTypeInFunctionAnnotation() throws Exception { runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/outOfBlockProjectWide/typeInFunctionAnnotation.kt"); From 3515cd546d44a3b406aa61f8bcfa96d19c5b3a99 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Fri, 27 Nov 2020 14:15:44 +0100 Subject: [PATCH 266/698] FIR IDE: use PersistentMap to store FromModuleViewSessionCache mappings Needed to ensure safe pub of map --- .../low/level/api/sessions/FirIdeSessionProviderStorage.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/FirIdeSessionProviderStorage.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/FirIdeSessionProviderStorage.kt index 1c11d3e546c..e72bf246b58 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/FirIdeSessionProviderStorage.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/FirIdeSessionProviderStorage.kt @@ -7,6 +7,9 @@ package org.jetbrains.kotlin.idea.fir.low.level.api.sessions import com.intellij.openapi.components.service import com.intellij.openapi.project.Project +import kotlinx.collections.immutable.PersistentMap +import kotlinx.collections.immutable.persistentMapOf +import kotlinx.collections.immutable.toPersistentMap import org.jetbrains.kotlin.fir.BuiltinTypes import org.jetbrains.kotlin.idea.caches.project.ModuleSourceInfo import org.jetbrains.kotlin.idea.fir.low.level.api.FirPhaseRunner @@ -50,7 +53,7 @@ private class FromModuleViewSessionCache( val root: ModuleSourceInfo, ) { @Volatile - private var mappings: Map = emptyMap() + private var mappings: PersistentMap = persistentMapOf() val sessionInvalidator: FirSessionInvalidator = FirSessionInvalidator { session -> mappings[session.moduleInfo]?.invalidate() @@ -61,7 +64,7 @@ private class FromModuleViewSessionCache( action: (Map) -> Pair, R> ): Pair, R> { val (newMappings, result) = action(getSessions().mapValues { it.value }) - mappings = newMappings.mapValues { FirSessionWithModificationTracker(it.value) } + mappings = newMappings.mapValues { FirSessionWithModificationTracker(it.value) }.toPersistentMap() return newMappings to result } From 519f1549f0ab8e4d51559cef26ea41559568159c Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Fri, 27 Nov 2020 14:53:37 +0100 Subject: [PATCH 267/698] FIR IDE: separate logic of TestProjectStructure from AbstractFirMultiModuleLazyResolveTest --- .../AbstractFirMultiModuleLazyResolveTest.kt | 43 ++++++++++++++++++- .../fir/low/level/api/TestProjectStructure.kt | 40 ++++------------- 2 files changed, 49 insertions(+), 34 deletions(-) diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/AbstractFirMultiModuleLazyResolveTest.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/AbstractFirMultiModuleLazyResolveTest.kt index f74a7821b5e..20fcb2778c2 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/AbstractFirMultiModuleLazyResolveTest.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/AbstractFirMultiModuleLazyResolveTest.kt @@ -5,12 +5,14 @@ package org.jetbrains.kotlin.idea.fir.low.level.api +import com.google.gson.JsonElement +import com.google.gson.JsonObject import com.intellij.openapi.vfs.VirtualFileManager import com.intellij.psi.PsiManager -import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.fir.render import org.jetbrains.kotlin.idea.fir.low.level.api.api.getOrBuildFir import org.jetbrains.kotlin.idea.fir.low.level.api.api.getResolveState +import org.jetbrains.kotlin.idea.jsonUtils.getString import org.jetbrains.kotlin.idea.stubs.AbstractMultiModuleTest import org.jetbrains.kotlin.idea.util.sourceRoots import org.jetbrains.kotlin.psi.KtFile @@ -23,7 +25,7 @@ abstract class AbstractFirMultiModuleLazyResolveTest : AbstractMultiModuleTest() "${KotlinTestUtils.getHomeDirectory()}/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/multiModuleLazyResolve/" fun doTest(path: String) { - val testStructure = TestProjectStructureReader.read(Paths.get(path)) + val testStructure = MultiModuleTestProjectStructure.fromTestProjectStructure(TestProjectStructureReader.read(Paths.get(path))) val modulesByNames = testStructure.modules.associate { moduleData -> moduleData.name to module(moduleData.name) } @@ -55,3 +57,40 @@ abstract class AbstractFirMultiModuleLazyResolveTest : AbstractMultiModuleTest() } } } + +private data class FileToResolve(val moduleName: String, val relativeFilePath: String) { + val filePath get() = "$moduleName/$relativeFilePath" + + companion object { + fun parse(json: JsonElement): FileToResolve { + require(json is JsonObject) + return FileToResolve( + moduleName = json.getString("module"), + relativeFilePath = json.getString("file") + ) + } + } +} + +private data class MultiModuleTestProjectStructure( + val modules: List, + val fileToResolve: FileToResolve, + val fails: Boolean +) { + companion object { + fun fromTestProjectStructure(testProjectStructure: TestProjectStructure): MultiModuleTestProjectStructure { + val json = testProjectStructure.json + + val fails = if (json.has(FAILS_FIELD)) json.get(FAILS_FIELD).asBoolean else false + val fileToResolve = FileToResolve.parse(json.getAsJsonObject("fileToResolve")) + + return MultiModuleTestProjectStructure( + testProjectStructure.modules, + fileToResolve, + fails + ) + } + + private const val FAILS_FIELD = "fails" + } +} diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/TestProjectStructure.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/TestProjectStructure.kt index a40c1bb153b..0cdb8141b1e 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/TestProjectStructure.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/TestProjectStructure.kt @@ -13,46 +13,22 @@ import com.intellij.openapi.util.io.FileUtil import org.jetbrains.kotlin.idea.jsonUtils.getString import java.nio.file.Path -sealed class TestProjectStructure { - abstract val modules: List - abstract val fileToResolve: FileToResolve - abstract val fails: Boolean - +internal data class TestProjectStructure( + val modules: List, + val json: JsonObject, +) { companion object { fun parse(json: JsonElement): TestProjectStructure { require(json is JsonObject) - val fails = if (json.has(FAILS_FIELD)) json.get(FAILS_FIELD).asBoolean else false - return MultiModuleTestProjectStructure( - json.getAsJsonArray("modules").map { TestProjectModule.parse(it) }, - FileToResolve.parse(json.getAsJsonObject("fileToResolve")), - fails - ) - } - - private const val FAILS_FIELD = "fails" - } -} - -data class FileToResolve(val moduleName: String, val relativeFilePath: String) { - val filePath get() = "$moduleName/$relativeFilePath" - - companion object { - fun parse(json: JsonElement): FileToResolve { - require(json is JsonObject) - return FileToResolve( - moduleName = json.getString("module"), - relativeFilePath = json.getString("file") + return TestProjectStructure( + json.getAsJsonArray("modules").map(TestProjectModule::parse), + json, ) } } } -data class MultiModuleTestProjectStructure( - override val modules: List, - override val fileToResolve: FileToResolve, - override val fails: Boolean -) : TestProjectStructure() data class TestProjectModule(val name: String, val dependsOnModules: List) { companion object { @@ -71,7 +47,7 @@ data class TestProjectModule(val name: String, val dependsOnModules: List Date: Fri, 27 Nov 2020 20:24:44 +0100 Subject: [PATCH 268/698] FIR IDE: fix module invalidation algorithm --- .../sessions/FirIdeSessionProviderStorage.kt | 45 +++++++++++-------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/FirIdeSessionProviderStorage.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/FirIdeSessionProviderStorage.kt index e72bf246b58..bd6454f6234 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/FirIdeSessionProviderStorage.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/FirIdeSessionProviderStorage.kt @@ -15,6 +15,7 @@ import org.jetbrains.kotlin.idea.caches.project.ModuleSourceInfo import org.jetbrains.kotlin.idea.fir.low.level.api.FirPhaseRunner import org.jetbrains.kotlin.idea.fir.low.level.api.FirTransformerProvider import org.jetbrains.kotlin.idea.fir.low.level.api.trackers.KotlinFirOutOfBlockModificationTrackerFactory +import org.jetbrains.kotlin.idea.fir.low.level.api.util.addValueFor import org.jetbrains.kotlin.idea.fir.low.level.api.util.executeWithoutPCE import java.util.concurrent.ConcurrentHashMap @@ -71,36 +72,42 @@ private class FromModuleViewSessionCache( @OptIn(ExperimentalStdlibApi::class) private fun getSessions(): Map = buildMap { val sessions = mappings.values - val sessionToValidity = hashMapOf() + val wasSessionInvalidated = sessions.associateWithTo(hashMapOf()) { false } - var isValid = true - fun dfs(session: FirSessionWithModificationTracker) { - sessionToValidity[session]?.let { valid -> - if (!valid) isValid = false + val reversedDependencies = sessions.reversedDependencies { session -> + session.firSession.dependencies.mapNotNull { mappings[it] } + } + + fun markAsInvalidWithDfs(session: FirSessionWithModificationTracker) { + if (wasSessionInvalidated.getValue(session)) { + // we already was in that branch return } - sessionToValidity[session] = session.isValid - session.firSession.dependencies.forEach { dependency -> - mappings[dependency]?.let(::dfs) - } - if (!session.isValid) { - isValid = false - } - if (!isValid) { - sessionToValidity[session] = false + wasSessionInvalidated[session] = true + reversedDependencies[session]?.forEach { dependsOn -> + markAsInvalidWithDfs(dependsOn) } } for (session in sessions) { - if (session !in sessionToValidity) { - isValid = true - dfs(session) + if (!session.isValid) { + markAsInvalidWithDfs(session) } } - return sessionToValidity.entries - .mapNotNull { (session, valid) -> session.takeIf { valid } } + return wasSessionInvalidated.entries + .mapNotNull { (session, wasInvalidated) -> session.takeUnless { wasInvalidated } } .associate { session -> session.firSession.moduleInfo to session.firSession } } + + private fun Collection.reversedDependencies(getDependencies: (T) -> List): Map> { + val result = hashMapOf>() + forEach { from -> + getDependencies(from).forEach { to -> + result.addValueFor(to, from) + } + } + return result + } } private class FirSessionWithModificationTracker( From d5979ffdedb3c9f8330c15350f1916d8e0949e37 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Fri, 27 Nov 2020 20:25:16 +0100 Subject: [PATCH 269/698] FIR IDE: add tests for checking module invalidation --- .../kotlin/generators/tests/GenerateTests.kt | 4 + .../KotlinFirOutOfBlockModificationTracker.kt | 7 ++ .../binaryTree/structure.json | 14 +++ .../binaryTreeNoInvalidated/structure.json | 14 +++ .../structure.json | 14 +++ .../structure.json | 14 +++ .../sessionInvalidation/linear/structure.json | 12 ++ .../rhombus/structure.json | 11 ++ .../rhombusWithTwoInvalid/structure.json | 11 ++ .../fir/low/level/api/TestProjectStructure.kt | 6 + .../idea/fir/low/level/api/firTestUtils.kt | 7 ++ .../AbstractSessionsInvalidationTest.kt | 107 ++++++++++++++++++ .../SessionsInvalidationTestGenerated.java | 65 +++++++++++ 13 files changed, 286 insertions(+) create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/binaryTree/structure.json create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/binaryTreeNoInvalidated/structure.json create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/binaryTreeWithAdditionalEdge/structure.json create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/binaryTreeWithInvalidInRoot/structure.json create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/linear/structure.json create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/rhombus/structure.json create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/rhombusWithTwoInvalid/structure.json create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/AbstractSessionsInvalidationTest.kt create mode 100644 idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/SessionsInvalidationTestGenerated.java diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index f2c688a2d36..6534ab2f8e4 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -85,6 +85,7 @@ import org.jetbrains.kotlin.idea.fir.low.level.api.AbstractFirLazyDeclarationRes import org.jetbrains.kotlin.idea.fir.low.level.api.AbstractFirMultiModuleLazyResolveTest import org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.AbstractFileStructureTest import org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.AbstractFileStructureAndOutOfBlockModificationTrackerConsistencyTest +import org.jetbrains.kotlin.idea.fir.low.level.api.sessions.AbstractSessionsInvalidationTest import org.jetbrains.kotlin.idea.folding.AbstractKotlinFoldingTest import org.jetbrains.kotlin.idea.frontend.api.fir.AbstractResolveCallTest import org.jetbrains.kotlin.idea.fir.low.level.api.trackers.AbstractProjectWideOutOfBlockKotlinModificationTrackerTest @@ -1049,6 +1050,9 @@ fun main(args: Array) { testClass { model("fileStructure") } + testClass { + model("sessionInvalidation", recursive = false, extension = null) + } } testGroup("idea/idea-fir/tests", "idea") { diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTracker.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTracker.kt index 0c47acf9818..7a3ddd10fd3 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTracker.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/trackers/KotlinFirOutOfBlockModificationTracker.kt @@ -18,6 +18,7 @@ import com.intellij.pom.event.PomModelEvent import com.intellij.pom.event.PomModelListener import com.intellij.pom.tree.TreeAspect import com.intellij.pom.tree.events.TreeChangeEvent +import org.jetbrains.annotations.TestOnly import org.jetbrains.kotlin.idea.KotlinLanguage import org.jetbrains.kotlin.idea.fir.low.level.api.element.builder.getNonLocalContainingInBodyDeclarationWith import org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileElementFactory @@ -45,6 +46,12 @@ internal class KotlinFirModificationTrackerService(project: Project) : Disposabl moduleModificationsState.increaseModificationCountForAllModules() } + @TestOnly + fun increaseModificationCountForModule(module: Module) { + moduleModificationsState.increaseModificationCountForModule(module) + } + + private fun subscribeForRootChanges(project: Project) { project.messageBus.connect(this).subscribe( ProjectTopics.PROJECT_ROOTS, diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/binaryTree/structure.json b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/binaryTree/structure.json new file mode 100644 index 00000000000..19e8f739669 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/binaryTree/structure.json @@ -0,0 +1,14 @@ +{ + "modules" : [ + { "name": "A", "dependsOn": ["B", "C"] }, + { "name": "B", "dependsOn": ["D", "E"] }, + { "name": "C", "dependsOn": ["F", "G"] }, + { "name": "D", "dependsOn": [] }, + { "name": "E", "dependsOn": [] }, + { "name": "F", "dependsOn": [] }, + { "name": "G", "dependsOn": [] } + ], + "rootModule": "A", + "modulesToMakeOOBM": ["F"], + "expectedInvalidatedModules": ["A", "C", "F"] +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/binaryTreeNoInvalidated/structure.json b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/binaryTreeNoInvalidated/structure.json new file mode 100644 index 00000000000..ef47e4c728e --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/binaryTreeNoInvalidated/structure.json @@ -0,0 +1,14 @@ +{ + "modules" : [ + { "name": "A", "dependsOn": ["B", "C"] }, + { "name": "B", "dependsOn": ["D", "E"] }, + { "name": "C", "dependsOn": ["F", "G"] }, + { "name": "D", "dependsOn": [] }, + { "name": "E", "dependsOn": [] }, + { "name": "F", "dependsOn": [] }, + { "name": "G", "dependsOn": [] } + ], + "rootModule": "A", + "modulesToMakeOOBM": [], + "expectedInvalidatedModules": [] +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/binaryTreeWithAdditionalEdge/structure.json b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/binaryTreeWithAdditionalEdge/structure.json new file mode 100644 index 00000000000..3f37c42fa75 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/binaryTreeWithAdditionalEdge/structure.json @@ -0,0 +1,14 @@ +{ + "modules" : [ + { "name": "A", "dependsOn": ["B", "C"] }, + { "name": "B", "dependsOn": ["D", "E"] }, + { "name": "C", "dependsOn": ["F", "G"] }, + { "name": "D", "dependsOn": [] }, + { "name": "E", "dependsOn": [] }, + { "name": "F", "dependsOn": ["B"] }, + { "name": "G", "dependsOn": [] } + ], + "rootModule": "A", + "modulesToMakeOOBM": ["E"], + "expectedInvalidatedModules": ["A", "B", "C", "E", "F"] +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/binaryTreeWithInvalidInRoot/structure.json b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/binaryTreeWithInvalidInRoot/structure.json new file mode 100644 index 00000000000..c85989c8dd2 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/binaryTreeWithInvalidInRoot/structure.json @@ -0,0 +1,14 @@ +{ + "modules" : [ + { "name": "A", "dependsOn": ["B", "C"] }, + { "name": "B", "dependsOn": ["D", "E"] }, + { "name": "C", "dependsOn": ["F", "G"] }, + { "name": "D", "dependsOn": [] }, + { "name": "E", "dependsOn": [] }, + { "name": "F", "dependsOn": [] }, + { "name": "G", "dependsOn": [] } + ], + "rootModule": "A", + "modulesToMakeOOBM": ["A"], + "expectedInvalidatedModules": ["A"] +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/linear/structure.json b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/linear/structure.json new file mode 100644 index 00000000000..a5a7b0ec05a --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/linear/structure.json @@ -0,0 +1,12 @@ +{ + "modules" : [ + { "name": "A", "dependsOn": ["B"] }, + { "name": "B", "dependsOn": ["C"] }, + { "name": "C", "dependsOn": ["D"] }, + { "name": "D", "dependsOn": ["E"] }, + { "name": "E", "dependsOn": [] } + ], + "rootModule": "A", + "modulesToMakeOOBM": ["C"], + "expectedInvalidatedModules": ["A", "B", "C"] +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/rhombus/structure.json b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/rhombus/structure.json new file mode 100644 index 00000000000..0a76c3f8d05 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/rhombus/structure.json @@ -0,0 +1,11 @@ +{ + "modules" : [ + { "name": "A", "dependsOn": ["B", "C"] }, + { "name": "B", "dependsOn": ["D"] }, + { "name": "C", "dependsOn": ["D"] }, + { "name": "D", "dependsOn": [] } + ], + "rootModule": "A", + "modulesToMakeOOBM": ["D"], + "expectedInvalidatedModules": ["A", "B", "C", "D"] +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/rhombusWithTwoInvalid/structure.json b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/rhombusWithTwoInvalid/structure.json new file mode 100644 index 00000000000..9ce45934178 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/rhombusWithTwoInvalid/structure.json @@ -0,0 +1,11 @@ +{ + "modules" : [ + { "name": "A", "dependsOn": ["B", "C"] }, + { "name": "B", "dependsOn": ["D"] }, + { "name": "C", "dependsOn": ["D"] }, + { "name": "D", "dependsOn": [] } + ], + "rootModule": "A", + "modulesToMakeOOBM": ["C", "D"], + "expectedInvalidatedModules": ["A", "B", "C", "D"] +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/TestProjectStructure.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/TestProjectStructure.kt index 0cdb8141b1e..a8e7834c69f 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/TestProjectStructure.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/TestProjectStructure.kt @@ -55,4 +55,10 @@ internal object TestProjectStructureReader { val json = JsonParser().parse(FileUtil.loadFile(jsonFile.toFile(), /*convertLineSeparators=*/true)) return TestProjectStructure.parse(json) } + + fun readToTestStructure( + testDirectory: Path, + jsonFileName: String = "structure.json", + toTestStructure: (TestProjectStructure) -> T, + ): T = read(testDirectory, jsonFileName).let(toTestStructure) } \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/firTestUtils.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/firTestUtils.kt index 32066cdbbed..25cf2103fcc 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/firTestUtils.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/firTestUtils.kt @@ -5,10 +5,13 @@ package org.jetbrains.kotlin.idea.fir.low.level.api +import com.intellij.openapi.components.service +import com.intellij.openapi.module.Module import com.intellij.openapi.module.ModuleManager import com.intellij.openapi.project.Project import org.jetbrains.kotlin.idea.caches.project.getModuleInfo import org.jetbrains.kotlin.idea.fir.low.level.api.api.FirModuleResolveState +import org.jetbrains.kotlin.idea.fir.low.level.api.trackers.KotlinFirModificationTrackerService import org.jetbrains.kotlin.psi.KtElement internal fun Project.allModules() = ModuleManager.getInstance(this).modules.toList() @@ -16,4 +19,8 @@ internal fun Project.allModules() = ModuleManager.getInstance(this).modules.toLi inline fun resolveWithClearCaches(context: KtElement, action: (FirModuleResolveState) -> Unit) { val resolveState = createResolveStateForNoCaching(context.getModuleInfo()) action(resolveState) +} + +internal fun Module.incModificationTracker() { + project.service().increaseModificationCountForModule(this) } \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/AbstractSessionsInvalidationTest.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/AbstractSessionsInvalidationTest.kt new file mode 100644 index 00000000000..7b7045dfb6c --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/AbstractSessionsInvalidationTest.kt @@ -0,0 +1,107 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.fir.low.level.api.sessions + +import com.google.common.collect.Sets +import com.intellij.openapi.command.WriteCommandAction +import com.intellij.openapi.module.Module +import com.intellij.openapi.vfs.LocalFileSystem +import com.intellij.testFramework.PsiTestUtil +import junit.framework.Assert +import org.jetbrains.kotlin.idea.caches.project.ModuleSourceInfo +import org.jetbrains.kotlin.idea.caches.project.productionSourceInfo +import org.jetbrains.kotlin.idea.fir.low.level.api.TestProjectModule +import org.jetbrains.kotlin.idea.fir.low.level.api.TestProjectStructure +import org.jetbrains.kotlin.idea.fir.low.level.api.TestProjectStructureReader +import org.jetbrains.kotlin.idea.fir.low.level.api.incModificationTracker +import org.jetbrains.kotlin.idea.jsonUtils.getString +import org.jetbrains.kotlin.idea.stubs.AbstractMultiModuleTest +import org.jetbrains.kotlin.test.KotlinTestUtils +import java.nio.file.Files +import java.nio.file.Paths +import kotlin.io.path.writeText + +abstract class AbstractSessionsInvalidationTest : AbstractMultiModuleTest() { + override fun getTestDataPath(): String = + "${KotlinTestUtils.getHomeDirectory()}/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/" + + protected fun doTest(path: String) { + val testStructure = TestProjectStructureReader.readToTestStructure( + Paths.get(path), + toTestStructure = MultiModuleTestProjectStructure.Companion::fromTestProjectStructure + ) + val modulesByNames = testStructure.modules.associate { moduleData -> + moduleData.name to createEmptyModule(moduleData.name) + } + testStructure.modules.forEach { moduleData -> + val module = modulesByNames.getValue(moduleData.name) + moduleData.dependsOnModules.forEach { dependencyName -> + module.addDependency(modulesByNames.getValue(dependencyName)) + } + } + + val rootModule = modulesByNames[testStructure.rootModule] + ?: error("${testStructure.rootModule} is not present in the list of modules") + val modulesToMakeOOBM = testStructure.modulesToMakeOOBM.map { + modulesByNames[it] + ?: error("$it is not present in the list of modules") + } + + val rootModuleSourceInfo = rootModule.productionSourceInfo()!! + + val storage = FirIdeSessionProviderStorage(project) + + val initialSessions = storage.getFirSessions(rootModuleSourceInfo) + modulesToMakeOOBM.forEach { it.incModificationTracker() } + val sessionsAfterOOBM = storage.getFirSessions(rootModuleSourceInfo) + + val changedSessions = Sets.symmetricDifference(initialSessions, sessionsAfterOOBM) + val changedSessionsModulesNamesSorted = changedSessions.map { (it.moduleInfo as ModuleSourceInfo).module.name }.distinct().sorted() + + Assert.assertEquals(testStructure.expectedInvalidatedModules, changedSessionsModulesNamesSorted) + } + + private fun FirIdeSessionProviderStorage.getFirSessions(rootModuleInfo: ModuleSourceInfo): Set { + val sessionProvider = getSessionProvider(rootModuleInfo) + return sessionProvider.sessions.values.toSet() + } + + private fun createEmptyModule(name: String): Module { + val tmpDir = createTempDirectory().toPath() + val module: Module = createModule("$tmpDir/$name", moduleType) + val root = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(tmpDir.toFile())!! + WriteCommandAction.writeCommandAction(module.project).run { + root.refresh(false, true) + } + + PsiTestUtil.addSourceContentToRoots(module, root) + return module + } +} + +private data class MultiModuleTestProjectStructure( + val modules: List, + val rootModule: String, + val modulesToMakeOOBM: List, + val expectedInvalidatedModules: List, +) { + companion object { + fun fromTestProjectStructure(testProjectStructure: TestProjectStructure): MultiModuleTestProjectStructure { + val json = testProjectStructure.json + + return MultiModuleTestProjectStructure( + testProjectStructure.modules, + json.getString(ROOT_MODULE_FIELD), + json.getAsJsonArray(MODULES_TO_MAKE_OOBM_IN_FIELD).map { it.asString }.sorted(), + json.getAsJsonArray(EXPECTED_INVALIDATED_MODULES_FIELD).map { it.asString }.sorted(), + ) + } + + private const val ROOT_MODULE_FIELD = "rootModule" + private const val MODULES_TO_MAKE_OOBM_IN_FIELD = "modulesToMakeOOBM" + private const val EXPECTED_INVALIDATED_MODULES_FIELD = "expectedInvalidatedModules" + } +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/SessionsInvalidationTestGenerated.java b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/SessionsInvalidationTestGenerated.java new file mode 100644 index 00000000000..eabea64952c --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/SessionsInvalidationTestGenerated.java @@ -0,0 +1,65 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.fir.low.level.api.sessions; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class SessionsInvalidationTestGenerated extends AbstractSessionsInvalidationTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInSessionInvalidation() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation"), Pattern.compile("^([^\\.]+)$"), null, false); + } + + @TestMetadata("binaryTree") + public void testBinaryTree() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/binaryTree/"); + } + + @TestMetadata("binaryTreeNoInvalidated") + public void testBinaryTreeNoInvalidated() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/binaryTreeNoInvalidated/"); + } + + @TestMetadata("binaryTreeWithAdditionalEdge") + public void testBinaryTreeWithAdditionalEdge() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/binaryTreeWithAdditionalEdge/"); + } + + @TestMetadata("binaryTreeWithInvalidInRoot") + public void testBinaryTreeWithInvalidInRoot() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/binaryTreeWithInvalidInRoot/"); + } + + @TestMetadata("linear") + public void testLinear() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/linear/"); + } + + @TestMetadata("rhombus") + public void testRhombus() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/rhombus/"); + } + + @TestMetadata("rhombusWithTwoInvalid") + public void testRhombusWithTwoInvalid() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/sessionInvalidation/rhombusWithTwoInvalid/"); + } +} From 11b2a07a5974f1febf6e4fedfe2e91ab03bb57ba Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Tue, 17 Nov 2020 01:39:02 +0100 Subject: [PATCH 270/698] Value classes: Support 'value' modifier in parser --- .../org/jetbrains/kotlin/lexer/KtTokens.java | 6 +- compiler/testData/psi/valueClass.kt | 35 ++++ compiler/testData/psi/valueClass.txt | 189 ++++++++++++++++++ .../kotlin/parsing/ParsingTestGenerated.java | 5 + 4 files changed, 233 insertions(+), 2 deletions(-) create mode 100644 compiler/testData/psi/valueClass.kt create mode 100644 compiler/testData/psi/valueClass.txt diff --git a/compiler/psi/src/org/jetbrains/kotlin/lexer/KtTokens.java b/compiler/psi/src/org/jetbrains/kotlin/lexer/KtTokens.java index 13652d92fcf..8d991122be8 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/lexer/KtTokens.java +++ b/compiler/psi/src/org/jetbrains/kotlin/lexer/KtTokens.java @@ -176,6 +176,7 @@ public interface KtTokens { KtModifierKeywordToken LATEINIT_KEYWORD = KtModifierKeywordToken.softKeywordModifier("lateinit"); KtModifierKeywordToken DATA_KEYWORD = KtModifierKeywordToken.softKeywordModifier("data"); + KtModifierKeywordToken VALUE_KEYWORD = KtModifierKeywordToken.softKeywordModifier("value"); KtModifierKeywordToken INLINE_KEYWORD = KtModifierKeywordToken.softKeywordModifier("inline"); KtModifierKeywordToken NOINLINE_KEYWORD = KtModifierKeywordToken.softKeywordModifier("noinline"); KtModifierKeywordToken TAILREC_KEYWORD = KtModifierKeywordToken.softKeywordModifier("tailrec"); @@ -215,7 +216,8 @@ public interface KtTokens { LATEINIT_KEYWORD, DATA_KEYWORD, INLINE_KEYWORD, NOINLINE_KEYWORD, TAILREC_KEYWORD, EXTERNAL_KEYWORD, ANNOTATION_KEYWORD, CROSSINLINE_KEYWORD, CONST_KEYWORD, OPERATOR_KEYWORD, INFIX_KEYWORD, - SUSPEND_KEYWORD, HEADER_KEYWORD, IMPL_KEYWORD, EXPECT_KEYWORD, ACTUAL_KEYWORD + SUSPEND_KEYWORD, HEADER_KEYWORD, IMPL_KEYWORD, EXPECT_KEYWORD, ACTUAL_KEYWORD, + VALUE_KEYWORD ); /* @@ -230,7 +232,7 @@ public interface KtTokens { REIFIED_KEYWORD, COMPANION_KEYWORD, SEALED_KEYWORD, LATEINIT_KEYWORD, DATA_KEYWORD, INLINE_KEYWORD, NOINLINE_KEYWORD, TAILREC_KEYWORD, EXTERNAL_KEYWORD, ANNOTATION_KEYWORD, CROSSINLINE_KEYWORD, CONST_KEYWORD, OPERATOR_KEYWORD, INFIX_KEYWORD, SUSPEND_KEYWORD, - HEADER_KEYWORD, IMPL_KEYWORD, EXPECT_KEYWORD, ACTUAL_KEYWORD, FUN_KEYWORD + HEADER_KEYWORD, IMPL_KEYWORD, EXPECT_KEYWORD, ACTUAL_KEYWORD, FUN_KEYWORD, VALUE_KEYWORD }; TokenSet MODIFIER_KEYWORDS = TokenSet.create(MODIFIER_KEYWORDS_ARRAY); diff --git a/compiler/testData/psi/valueClass.kt b/compiler/testData/psi/valueClass.kt new file mode 100644 index 00000000000..3410e74b454 --- /dev/null +++ b/compiler/testData/psi/valueClass.kt @@ -0,0 +1,35 @@ +class value Foo + +value private class Foo + +value @Bar class Foo + +value interface Foo + +value abstract class Foo + +value object Foo + +value fun foo(){} + +value class Foo + +value class Foo { + val l = 1 + fun invoke() +} + +private value class Foo + +expect value class Foo + +actual value class Foo + +@Bar value class Foo + +class TopLevel { + value class Foo +} + +value +class Foo \ No newline at end of file diff --git a/compiler/testData/psi/valueClass.txt b/compiler/testData/psi/valueClass.txt new file mode 100644 index 00000000000..1084fd2c039 --- /dev/null +++ b/compiler/testData/psi/valueClass.txt @@ -0,0 +1,189 @@ +KtFile: valueClass.kt + PACKAGE_DIRECTIVE + + IMPORT_LIST + + CLASS + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('value') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('Foo') + PsiWhiteSpace('\n\n') + CLASS + MODIFIER_LIST + PsiElement(value)('value') + PsiWhiteSpace(' ') + PsiElement(private)('private') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Foo') + PsiWhiteSpace('\n\n') + CLASS + MODIFIER_LIST + PsiElement(value)('value') + PsiWhiteSpace(' ') + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Bar') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Foo') + PsiWhiteSpace('\n\n') + CLASS + MODIFIER_LIST + PsiElement(value)('value') + PsiWhiteSpace(' ') + PsiElement(interface)('interface') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Foo') + PsiWhiteSpace('\n\n') + CLASS + MODIFIER_LIST + PsiElement(value)('value') + PsiWhiteSpace(' ') + PsiElement(abstract)('abstract') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Foo') + PsiWhiteSpace('\n\n') + OBJECT_DECLARATION + MODIFIER_LIST + PsiElement(value)('value') + PsiWhiteSpace(' ') + PsiElement(object)('object') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Foo') + PsiWhiteSpace('\n\n') + FUN + MODIFIER_LIST + PsiElement(value)('value') + PsiWhiteSpace(' ') + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n') + CLASS + MODIFIER_LIST + PsiElement(value)('value') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Foo') + PsiWhiteSpace('\n\n') + CLASS + MODIFIER_LIST + PsiElement(value)('value') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Foo') + PsiWhiteSpace(' ') + CLASS_BODY + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('l') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiWhiteSpace('\n ') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('invoke') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n') + CLASS + MODIFIER_LIST + PsiElement(private)('private') + PsiWhiteSpace(' ') + PsiElement(value)('value') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Foo') + PsiWhiteSpace('\n\n') + CLASS + MODIFIER_LIST + PsiElement(expect)('expect') + PsiWhiteSpace(' ') + PsiElement(value)('value') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Foo') + PsiWhiteSpace('\n\n') + CLASS + MODIFIER_LIST + PsiElement(actual)('actual') + PsiWhiteSpace(' ') + PsiElement(value)('value') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Foo') + PsiWhiteSpace('\n\n') + CLASS + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Bar') + PsiWhiteSpace(' ') + PsiElement(value)('value') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Foo') + PsiWhiteSpace('\n\n') + CLASS + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('TopLevel') + PsiWhiteSpace(' ') + CLASS_BODY + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + CLASS + MODIFIER_LIST + PsiElement(value)('value') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Foo') + PsiWhiteSpace('\n') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n') + CLASS + MODIFIER_LIST + PsiElement(value)('value') + PsiWhiteSpace('\n') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Foo') \ No newline at end of file diff --git a/compiler/tests-gen/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java index 6a44d5f73e1..fa2e42f6ba6 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java @@ -725,6 +725,11 @@ public class ParsingTestGenerated extends AbstractParsingTest { runTest("compiler/testData/psi/validKotlinFunInterface.kt"); } + @TestMetadata("valueClass.kt") + public void testValueClass() throws Exception { + runTest("compiler/testData/psi/valueClass.kt"); + } + @TestMetadata("When.kt") public void testWhen() throws Exception { runTest("compiler/testData/psi/When.kt"); From 8eff3a6bb33fc8950f165f7c37c94d959c7409bb Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Fri, 6 Nov 2020 03:42:58 +0100 Subject: [PATCH 271/698] Value classes: Increase stub version due to changes in the parser --- .../src/org/jetbrains/kotlin/psi/stubs/KotlinStubVersions.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/KotlinStubVersions.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/KotlinStubVersions.kt index 2bf4819091f..05c624d04b7 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/KotlinStubVersions.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/KotlinStubVersions.kt @@ -23,7 +23,7 @@ object KotlinStubVersions { // Though only kotlin declarations (no code in the bodies) are stubbed, please do increase this version // if you are not 100% sure it can be avoided. // Increasing this version will lead to reindexing of all kotlin source files on the first IDE startup with the new version. - const val SOURCE_STUB_VERSION = 138 + const val SOURCE_STUB_VERSION = 139 // Binary stub version should be increased if stub format (org.jetbrains.kotlin.psi.stubs.impl) is changed // or changes are made to the core stub building code (org.jetbrains.kotlin.idea.decompiler.stubBuilder). From 361ed117bb499267c18e7276007553dd66b335e6 Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Tue, 17 Nov 2020 03:25:04 +0100 Subject: [PATCH 272/698] Value classes: Add isValue property to class descriptors Reuse isInline flag in proto and IR. Check metadata version on deserialization. --- .../synthetics/SyntheticClassOrObjectDescriptor.kt | 1 + .../lazy/descriptors/LazyClassDescriptor.java | 7 +++++++ .../kotlin/ir/descriptors/IrBasedDescriptors.kt | 5 +++++ .../kotlin/ir/descriptors/WrappedDescriptors.kt | 6 ++++++ .../org/jetbrains/kotlin/psi/psiUtil/psiUtils.kt | 2 ++ .../lazy/descriptors/LazyJavaClassDescriptor.kt | 1 + .../builtins/functions/FunctionClassDescriptor.kt | 1 + .../kotlin/descriptors/ClassDescriptor.java | 2 ++ .../jetbrains/kotlin/descriptors/NotFoundClasses.kt | 1 + .../descriptors/impl/ClassDescriptorImpl.java | 5 +++++ .../impl/EnumEntrySyntheticClassDescriptor.java | 5 +++++ .../impl/LazySubstitutingClassDescriptor.java | 5 +++++ .../descriptors/impl/MutableClassDescriptor.java | 5 +++++ .../descriptors/DeserializedClassDescriptor.kt | 4 +++- .../metadata/deserialization/BinaryVersion.kt | 13 +++++++++++++ .../commonizer/builder/CommonizedClassDescriptor.kt | 1 + 16 files changed, 63 insertions(+), 1 deletion(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/synthetics/SyntheticClassOrObjectDescriptor.kt b/compiler/frontend/src/org/jetbrains/kotlin/psi/synthetics/SyntheticClassOrObjectDescriptor.kt index 1e7da298e68..5d4e71fc46a 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/synthetics/SyntheticClassOrObjectDescriptor.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/synthetics/SyntheticClassOrObjectDescriptor.kt @@ -83,6 +83,7 @@ class SyntheticClassOrObjectDescriptor( override fun isExpect() = false override fun isActual() = false override fun isFun() = false + override fun isValue() = false override fun getCompanionObjectDescriptor(): ClassDescriptorWithResolutionScopes? = null override fun getTypeConstructor(): TypeConstructor = typeConstructor diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java index e254e8f4f6b..e0de663ae1d 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java @@ -87,6 +87,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes private final boolean isExpect; private final boolean isActual; private final boolean isFun; + private final boolean isValue; private final Annotations annotations; private final Annotations danglingAnnotations; @@ -160,6 +161,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes containingDeclaration instanceof ClassDescriptor && ((ClassDescriptor) containingDeclaration).isExpect(); this.isFun = modifierList != null && PsiUtilsKt.hasFunModifier(modifierList); + this.isValue = modifierList != null && PsiUtilsKt.hasValueModifier(modifierList); // Annotation entries are taken from both own annotations (if any) and object literal annotations (if any) List annotationEntries = new ArrayList<>(); @@ -552,6 +554,11 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes return isFun; } + @Override + public boolean isValue() { + return isValue; + } + @NotNull @Override public Annotations getAnnotations() { diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrBasedDescriptors.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrBasedDescriptors.kt index c70f623de37..4946c8a249d 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrBasedDescriptors.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrBasedDescriptors.kt @@ -604,6 +604,9 @@ open class IrBasedClassDescriptor(owner: IrClass) : ClassDescriptor, IrBasedDecl override fun isFun() = owner.isFun + // In IR, inline and value are synonyms + override fun isValue() = owner.isInline + override fun getThisAsReceiverParameter() = owner.thisReceiver?.toIrBasedDescriptor() as ReceiverParameterDescriptor override fun getUnsubstitutedPrimaryConstructor() = @@ -704,6 +707,8 @@ open class IrBasedEnumEntryDescriptor(owner: IrEnumEntry) : ClassDescriptor, IrB override fun isFun() = false + override fun isValue() = false + override fun getThisAsReceiverParameter() = (owner.parent as IrClass).toIrBasedDescriptor().thisAsReceiverParameter override fun getUnsubstitutedPrimaryConstructor(): ClassConstructorDescriptor? { diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/WrappedDescriptors.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/WrappedDescriptors.kt index 56c6d5ed28a..83de1535e70 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/WrappedDescriptors.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/WrappedDescriptors.kt @@ -583,6 +583,8 @@ open class WrappedClassDescriptor : ClassDescriptor, WrappedDeclarationDescripto override fun isFun() = owner.isFun + override fun isValue() = owner.isInline + override fun getThisAsReceiverParameter() = owner.thisReceiver?.descriptor as ReceiverParameterDescriptor override fun getUnsubstitutedPrimaryConstructor() = @@ -682,6 +684,8 @@ open class WrappedScriptDescriptor : ScriptDescriptor, WrappedDeclarationDescrip override fun isFun() = false + override fun isValue() = false + override fun getThisAsReceiverParameter() = owner.thisReceiver.descriptor as ReceiverParameterDescriptor override fun getUnsubstitutedPrimaryConstructor() = TODO() @@ -822,6 +826,8 @@ open class WrappedEnumEntryDescriptor : ClassDescriptor, WrappedDeclarationDescr override fun isFun() = false + override fun isValue() = false + override fun getThisAsReceiverParameter() = (owner.parent as IrClass).descriptor.thisAsReceiverParameter override fun getUnsubstitutedPrimaryConstructor(): ClassConstructorDescriptor? { diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/psiUtil/psiUtils.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/psiUtil/psiUtils.kt index 0c60c6088b2..dec4596cacc 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/psiUtil/psiUtils.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/psiUtil/psiUtils.kt @@ -452,6 +452,8 @@ fun KtModifierList.hasSuspendModifier() = hasModifier(KtTokens.SUSPEND_KEYWORD) fun KtModifierList.hasFunModifier() = hasModifier(KtTokens.FUN_KEYWORD) +fun KtModifierList.hasValueModifier() = hasModifier(KtTokens.VALUE_KEYWORD) + fun ASTNode.children() = generateSequence(firstChildNode) { node -> node.treeNext } fun ASTNode.parents() = generateSequence(treeParent) { node -> node.treeParent } diff --git a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt index 6f989521869..5a5c60b822d 100644 --- a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt +++ b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt @@ -105,6 +105,7 @@ class LazyJavaClassDescriptor( override fun isExpect() = false override fun isActual() = false override fun isFun() = false + override fun isValue() = false private val typeConstructor = LazyJavaClassTypeConstructor() override fun getTypeConstructor(): TypeConstructor = typeConstructor diff --git a/core/descriptors/src/org/jetbrains/kotlin/builtins/functions/FunctionClassDescriptor.kt b/core/descriptors/src/org/jetbrains/kotlin/builtins/functions/FunctionClassDescriptor.kt index 8c1c498dbd6..6260b799b20 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/builtins/functions/FunctionClassDescriptor.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/builtins/functions/FunctionClassDescriptor.kt @@ -81,6 +81,7 @@ class FunctionClassDescriptor( override fun isData() = false override fun isInline() = false override fun isFun() = false + override fun isValue() = false override fun isExpect() = false override fun isActual() = false override fun isExternal() = false diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/ClassDescriptor.java b/core/descriptors/src/org/jetbrains/kotlin/descriptors/ClassDescriptor.java index 32a28a37868..1dc500cd374 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/ClassDescriptor.java +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/ClassDescriptor.java @@ -72,6 +72,8 @@ public interface ClassDescriptor extends ClassifierDescriptorWithTypeParameters, boolean isFun(); + boolean isValue(); + @NotNull ReceiverParameterDescriptor getThisAsReceiverParameter(); diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/NotFoundClasses.kt b/core/descriptors/src/org/jetbrains/kotlin/descriptors/NotFoundClasses.kt index a170029b278..13aae6577c1 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/NotFoundClasses.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/NotFoundClasses.kt @@ -71,6 +71,7 @@ class NotFoundClasses(private val storageManager: StorageManager, private val mo override fun isData() = false override fun isInline() = false override fun isFun() = false + override fun isValue() = false override fun isExpect() = false override fun isActual() = false override fun isExternal() = false diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/ClassDescriptorImpl.java b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/ClassDescriptorImpl.java index d0ea87359bd..b6ff4a1a21f 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/ClassDescriptorImpl.java +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/ClassDescriptorImpl.java @@ -148,6 +148,11 @@ public class ClassDescriptorImpl extends ClassDescriptorBase { return false; } + @Override + public boolean isValue() { + return false; + } + @Override public boolean isInner() { return false; diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/EnumEntrySyntheticClassDescriptor.java b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/EnumEntrySyntheticClassDescriptor.java index 31dc3ecbbed..32340869521 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/EnumEntrySyntheticClassDescriptor.java +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/EnumEntrySyntheticClassDescriptor.java @@ -138,6 +138,11 @@ public class EnumEntrySyntheticClassDescriptor extends ClassDescriptorBase { return false; } + @Override + public boolean isValue() { + return false; + } + @Override public boolean isFun() { return false; diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/LazySubstitutingClassDescriptor.java b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/LazySubstitutingClassDescriptor.java index 0e1e3f556d5..b16b085e013 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/LazySubstitutingClassDescriptor.java +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/LazySubstitutingClassDescriptor.java @@ -248,6 +248,11 @@ public class LazySubstitutingClassDescriptor extends ModuleAwareClassDescriptor return original.isFun(); } + @Override + public boolean isValue() { + return original.isValue(); + } + @Override public boolean isExternal() { return original.isExternal(); diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/MutableClassDescriptor.java b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/MutableClassDescriptor.java index 1b525c6b471..de5fbac9c3a 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/MutableClassDescriptor.java +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/MutableClassDescriptor.java @@ -104,6 +104,11 @@ public class MutableClassDescriptor extends ClassDescriptorBase { return false; } + @Override + public boolean isValue() { + return false; + } + @Override public boolean isCompanionObject() { return false; diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedClassDescriptor.kt b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedClassDescriptor.kt index 69efe153489..f74ab63e0b8 100644 --- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedClassDescriptor.kt +++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedClassDescriptor.kt @@ -98,7 +98,7 @@ class DeserializedClassDescriptor( override fun isData() = Flags.IS_DATA.get(classProto.flags) - override fun isInline() = Flags.IS_INLINE_CLASS.get(classProto.flags) + override fun isInline() = Flags.IS_INLINE_CLASS.get(classProto.flags) && metadataVersion.isAtMost(1, 4, 1) override fun isExpect() = Flags.IS_EXPECT_CLASS.get(classProto.flags) @@ -108,6 +108,8 @@ class DeserializedClassDescriptor( override fun isFun() = Flags.IS_FUN_INTERFACE.get(classProto.flags) + override fun isValue() = Flags.IS_INLINE_CLASS.get(classProto.flags) && metadataVersion.isAtLeast(1, 4, 2) + override fun getUnsubstitutedMemberScope(kotlinTypeRefiner: KotlinTypeRefiner): MemberScope = memberScopeHolder.getScope(kotlinTypeRefiner) diff --git a/core/metadata/src/org/jetbrains/kotlin/metadata/deserialization/BinaryVersion.kt b/core/metadata/src/org/jetbrains/kotlin/metadata/deserialization/BinaryVersion.kt index 5463c8c8434..10163e9a308 100644 --- a/core/metadata/src/org/jetbrains/kotlin/metadata/deserialization/BinaryVersion.kt +++ b/core/metadata/src/org/jetbrains/kotlin/metadata/deserialization/BinaryVersion.kt @@ -48,6 +48,19 @@ abstract class BinaryVersion(private vararg val numbers: Int) { return this.patch >= patch } + fun isAtMost(version: BinaryVersion): Boolean = + isAtMost(version.major, version.minor, version.patch) + + fun isAtMost(major: Int, minor: Int, patch: Int): Boolean { + if (this.major < major) return true + if (this.major > major) return false + + if (this.minor < minor) return true + if (this.minor > minor) return false + + return this.patch <= patch + } + override fun toString(): String { val versions = toArray().takeWhile { it != UNKNOWN } return if (versions.isEmpty()) "unknown" else versions.joinToString(".") diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/builder/CommonizedClassDescriptor.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/builder/CommonizedClassDescriptor.kt index 8261964c993..3f67f514d36 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/builder/CommonizedClassDescriptor.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/builder/CommonizedClassDescriptor.kt @@ -80,6 +80,7 @@ class CommonizedClassDescriptor( override fun isExpect() = isExpect override fun isActual() = isActual override fun isFun() = false // TODO: modifier "fun" should be accessible from here too + override fun isValue() = false // TODO: modifier "value" should be accessible from here too override fun getUnsubstitutedMemberScope(kotlinTypeRefiner: KotlinTypeRefiner): CommonizedMemberScope { check(kotlinTypeRefiner == KotlinTypeRefiner.Default) { From f158411f9a2081f0567e2e8891e6585bcb3497ac Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Tue, 17 Nov 2020 04:57:52 +0100 Subject: [PATCH 273/698] Value classes: Increase JVM metadata version to distinguish between inline and value classes. --- .../kotlin/metadata/jvm/deserialization/JvmMetadataVersion.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/metadata.jvm/src/org/jetbrains/kotlin/metadata/jvm/deserialization/JvmMetadataVersion.kt b/core/metadata.jvm/src/org/jetbrains/kotlin/metadata/jvm/deserialization/JvmMetadataVersion.kt index 56630dc464d..43e17e0ccdf 100644 --- a/core/metadata.jvm/src/org/jetbrains/kotlin/metadata/jvm/deserialization/JvmMetadataVersion.kt +++ b/core/metadata.jvm/src/org/jetbrains/kotlin/metadata/jvm/deserialization/JvmMetadataVersion.kt @@ -26,7 +26,7 @@ class JvmMetadataVersion(versionArray: IntArray, val isStrictSemantics: Boolean) companion object { @JvmField - val INSTANCE = JvmMetadataVersion(1, 4, 1) + val INSTANCE = JvmMetadataVersion(1, 4, 2) @JvmField val INVALID_VERSION = JvmMetadataVersion() From 6c68660ffd176e877f40c9e4d640d997a030bbcf Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Wed, 18 Nov 2020 23:41:36 +0100 Subject: [PATCH 274/698] Value classes: Render 'value' before class --- .../src/org/jetbrains/kotlin/renderer/DescriptorRenderer.kt | 3 ++- .../org/jetbrains/kotlin/renderer/DescriptorRendererImpl.kt | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRenderer.kt b/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRenderer.kt index 3d5e1ceb257..15e490f790a 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRenderer.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRenderer.kt @@ -303,7 +303,8 @@ enum class DescriptorRendererModifier(val includeByDefault: Boolean) { ACTUAL(true), CONST(true), LATEINIT(true), - FUN(true) + FUN(true), + VALUE(true) ; companion object { diff --git a/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererImpl.kt b/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererImpl.kt index 9c5e61f688f..a37436911e8 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererImpl.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererImpl.kt @@ -982,6 +982,7 @@ internal class DescriptorRendererImpl( renderModifier(builder, DescriptorRendererModifier.INNER in modifiers && klass.isInner, "inner") renderModifier(builder, DescriptorRendererModifier.DATA in modifiers && klass.isData, "data") renderModifier(builder, DescriptorRendererModifier.INLINE in modifiers && klass.isInline, "inline") + renderModifier(builder, DescriptorRendererModifier.VALUE in modifiers && klass.isValue, "value") renderModifier(builder, DescriptorRendererModifier.FUN in modifiers && klass.isFun, "fun") renderClassKindPrefix(klass, builder) } From 92f1681de0e26a3cb177e2330cc0e187763d7153 Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Thu, 19 Nov 2020 02:20:37 +0100 Subject: [PATCH 275/698] Value classes: treat @JvmInline value classes as inline classes Report error on value classes without @JvmInline annotation. Do not check for @JvmInline annotation in value classes since it breaks reflection. --- .../DefaultParameterValueSubstitutor.kt | 2 +- .../kotlin/codegen/DescriptorAsmUtil.java | 4 +- .../kotlin/codegen/ExpressionCodegen.java | 4 +- .../kotlin/codegen/FunctionCodegen.java | 4 +- .../FunctionsFromAnyGeneratorImpl.java | 6 +- .../codegen/ImplementationBodyCodegen.java | 8 +- .../jetbrains/kotlin/codegen/StackValue.java | 3 +- .../codegen/context/ConstructorContext.java | 3 +- .../optimization/boxing/BoxedBasicValue.kt | 3 +- .../kotlin/codegen/state/KotlinTypeMapper.kt | 2 +- .../codegen/state/inlineClassManglingUtils.kt | 3 +- .../kotlin/codegen/state/typeMapperUtils.kt | 3 +- ...irOldFrontendDiagnosticsTestGenerated.java | 123 ++++++++++++ .../jetbrains/kotlin/diagnostics/Errors.java | 1 + .../rendering/DefaultErrorMessages.java | 1 + .../kotlin/resolve/DeclarationsChecker.kt | 2 +- .../kotlin/resolve/ModifiersChecker.kt | 9 +- .../checkers/InlineClassDeclarationChecker.kt | 17 +- .../lazy/descriptors/LazyClassMemberScope.kt | 2 +- .../ir/util/DeclarationStubGenerator.kt | 3 +- .../kotlin/ir/util/DescriptorToIrUtil.kt | 3 +- .../src/org/jetbrains/kotlin/psi/KtClass.kt | 1 + .../serialization/DescriptorSerializer.kt | 9 +- .../basicValueClassDeclaration.fir.kt | 13 ++ .../basicValueClassDeclaration.kt | 13 ++ .../basicValueClassDeclaration.txt | 56 ++++++ .../basicValueClassDeclarationDisabled.fir.kt | 15 ++ .../basicValueClassDeclarationDisabled.kt | 15 ++ .../basicValueClassDeclarationDisabled.txt | 57 ++++++ .../constructorsJvmSignaturesClash.fir.kt | 24 +++ .../constructorsJvmSignaturesClash.kt | 24 +++ .../constructorsJvmSignaturesClash.txt | 57 ++++++ .../delegatedPropertyInValueClass.fir.kt | 33 ++++ .../delegatedPropertyInValueClass.kt | 33 ++++ .../delegatedPropertyInValueClass.txt | 57 ++++++ .../functionsJvmSignaturesClash.fir.kt | 46 +++++ .../functionsJvmSignaturesClash.kt | 46 +++++ .../functionsJvmSignaturesClash.txt | 77 ++++++++ ...tionsJvmSignaturesConflictOnInheritance.kt | 21 +++ ...ionsJvmSignaturesConflictOnInheritance.txt | 49 +++++ .../identityComparisonWithValueClasses.fir.kt | 21 +++ .../identityComparisonWithValueClasses.kt | 21 +++ .../identityComparisonWithValueClasses.txt | 28 +++ .../valueClasses/lateinitValueClasses.fir.kt | 15 ++ .../valueClasses/lateinitValueClasses.kt | 15 ++ .../valueClasses/lateinitValueClasses.txt | 21 +++ ...senceOfInitializerBlockInsideValueClass.kt | 16 ++ ...enceOfInitializerBlockInsideValueClass.txt | 19 ++ ...OfPublicPrimaryConstructorForValueClass.kt | 17 ++ ...fPublicPrimaryConstructorForValueClass.txt | 51 +++++ ...esWithBackingFieldsInsideValueClass.fir.kt | 39 ++++ ...ertiesWithBackingFieldsInsideValueClass.kt | 39 ++++ ...rtiesWithBackingFieldsInsideValueClass.txt | 40 ++++ .../valueClasses/recursiveValueClasses.fir.kt | 37 ++++ .../valueClasses/recursiveValueClasses.kt | 37 ++++ .../valueClasses/recursiveValueClasses.txt | 107 +++++++++++ ...embersAndConstructsInsideValueClass.fir.kt | 54 ++++++ ...vedMembersAndConstructsInsideValueClass.kt | 54 ++++++ ...edMembersAndConstructsInsideValueClass.txt | 73 ++++++++ ...dLiteralsWithoutArtifactOnClasspath.fir.kt | 3 + ...ignedLiteralsWithoutArtifactOnClasspath.kt | 3 + ...gnedLiteralsWithoutArtifactOnClasspath.txt | 5 + ...alueClassCanOnlyImplementInterfaces.fir.kt | 20 ++ .../valueClassCanOnlyImplementInterfaces.kt | 20 ++ .../valueClassCanOnlyImplementInterfaces.txt | 55 ++++++ ...annotImplementInterfaceByDelegation.fir.kt | 15 ++ ...assCannotImplementInterfaceByDelegation.kt | 15 ++ ...ssCannotImplementInterfaceByDelegation.txt | 40 ++++ ...assConstructorParameterWithDefaultValue.kt | 9 + ...ssConstructorParameterWithDefaultValue.txt | 19 ++ .../valueClassDeclarationCheck.fir.kt | 51 +++++ .../valueClassDeclarationCheck.kt | 51 +++++ .../valueClassDeclarationCheck.txt | 176 ++++++++++++++++++ .../valueClassImplementsCollection.kt | 19 ++ .../valueClassImplementsCollection.txt | 32 ++++ ...lueClassWithForbiddenUnderlyingType.fir.kt | 30 +++ .../valueClassWithForbiddenUnderlyingType.kt | 30 +++ .../valueClassWithForbiddenUnderlyingType.txt | 91 +++++++++ .../valueClassesInsideAnnotations.fir.kt | 18 ++ .../valueClassesInsideAnnotations.kt | 18 ++ .../valueClassesInsideAnnotations.txt | 59 ++++++ ...varargsOnParametersOfValueClassType.fir.kt | 26 +++ .../varargsOnParametersOfValueClassType.kt | 26 +++ .../varargsOnParametersOfValueClassType.txt | 46 +++++ .../checkers/DiagnosticsTestGenerated.java | 123 ++++++++++++ .../DiagnosticsUsingJavacTestGenerated.java | 123 ++++++++++++ .../descriptorBasedTypeSignatureMapping.kt | 3 +- .../resolve/jvm/inlineClassManglingRules.kt | 2 +- .../kotlin/resolve/DescriptorUtils.kt | 3 +- .../kotlin/resolve/inlineClassesUtils.kt | 9 +- .../types/checker/ClassicTypeSystemContext.kt | 3 +- .../internal/calls/InlineClassAwareCaller.kt | 4 +- .../quickfix/TypeAccessibilityCheckerImpl.kt | 3 +- .../OverrideMemberChooserObject.kt | 2 +- .../inspections/UnusedSymbolInspection.kt | 3 +- .../resolve/diagnostics/JsExternalChecker.kt | 1 + .../translate/declaration/ClassTranslator.kt | 2 +- .../commonizer/cir/factory/CirClassFactory.kt | 3 +- .../utils/ComparingDeclarationsVisitor.kt | 1 + .../SerializationPluginDeclarationChecker.kt | 3 +- 100 files changed, 2668 insertions(+), 53 deletions(-) create mode 100644 compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.fir.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.txt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.fir.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.txt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.fir.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.txt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.fir.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.txt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.fir.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.txt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesConflictOnInheritance.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesConflictOnInheritance.txt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.fir.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.txt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.fir.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.txt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.txt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/presenceOfPublicPrimaryConstructorForValueClass.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/presenceOfPublicPrimaryConstructorForValueClass.txt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.fir.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.txt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.fir.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.txt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.fir.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.txt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/unsignedLiteralsWithoutArtifactOnClasspath.fir.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/unsignedLiteralsWithoutArtifactOnClasspath.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/unsignedLiteralsWithoutArtifactOnClasspath.txt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.fir.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.txt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.fir.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.txt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/valueClassConstructorParameterWithDefaultValue.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/valueClassConstructorParameterWithDefaultValue.txt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.fir.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.txt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/valueClassImplementsCollection.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/valueClassImplementsCollection.txt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.fir.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.txt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.fir.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.txt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.fir.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.txt diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/DefaultParameterValueSubstitutor.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/DefaultParameterValueSubstitutor.kt index 2e646cde807..8185851399f 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/DefaultParameterValueSubstitutor.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/DefaultParameterValueSubstitutor.kt @@ -267,7 +267,7 @@ class DefaultParameterValueSubstitutor(val state: GenerationState) { if (classDescriptor.kind != ClassKind.CLASS) return false if (classOrObject.isLocal) return false - if (classDescriptor.isInline) return false + if (classDescriptor.isInlineClass()) return false if (shouldHideConstructorDueToInlineClassTypeValueParameters(constructorDescriptor)) return false if (CodegenBinding.canHaveOuter(state.bindingContext, classDescriptor)) return false diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/DescriptorAsmUtil.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/DescriptorAsmUtil.java index c1e84140240..2ab32eba3b0 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/DescriptorAsmUtil.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/DescriptorAsmUtil.java @@ -216,7 +216,7 @@ public class DescriptorAsmUtil { private static boolean isInlineClassWrapperConstructor(@NotNull FunctionDescriptor functionDescriptor, @Nullable OwnerKind kind) { if (!(functionDescriptor instanceof ConstructorDescriptor)) return false; ClassDescriptor classDescriptor = ((ConstructorDescriptor) functionDescriptor).getConstructedClass(); - return classDescriptor.isInline() && kind == OwnerKind.IMPLEMENTATION; + return InlineClassesUtilsKt.isInlineClass(classDescriptor) && kind == OwnerKind.IMPLEMENTATION; } public static int getCommonCallableFlags(FunctionDescriptor functionDescriptor, @NotNull GenerationState state) { @@ -559,7 +559,7 @@ public class DescriptorAsmUtil { if (receiverKotlinType.isMarkedNullable()) return null; DeclarationDescriptor receiverTypeDescriptor = receiverKotlinType.getConstructor().getDeclarationDescriptor(); - assert receiverTypeDescriptor instanceof ClassDescriptor && ((ClassDescriptor) receiverTypeDescriptor).isInline() : + assert receiverTypeDescriptor != null && InlineClassesUtilsKt.isInlineClass(receiverTypeDescriptor) : "Inline class type expected: " + receiverKotlinType; ClassDescriptor receiverClassDescriptor = (ClassDescriptor) receiverTypeDescriptor; FunctionDescriptor toStringDescriptor = receiverClassDescriptor.getUnsubstitutedMemberScope() diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java index 67323b5949b..f2c109bf80d 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java @@ -1190,7 +1190,7 @@ public class ExpressionCodegen extends KtVisitor impleme ClassDescriptor captureThis = closure.getCapturedOuterClassDescriptor(); if (captureThis != null) { StackValue thisOrOuter = generateThisOrOuter(captureThis, false); - assert !isPrimitive(thisOrOuter.type) || captureThis.isInline() : + assert !isPrimitive(thisOrOuter.type) || InlineClassesUtilsKt.isInlineClass(captureThis) : "This or outer for " + captureThis + " should be non-primitive: " + thisOrOuter.type; callGenerator.putCapturedValueOnStack(thisOrOuter, thisOrOuter.type, paramIndex++); } @@ -4830,7 +4830,7 @@ public class ExpressionCodegen extends KtVisitor impleme ReceiverParameterDescriptor dispatchReceiver = constructor.getDispatchReceiverParameter(); ClassDescriptor containingDeclaration = constructor.getContainingDeclaration(); - if (!containingDeclaration.isInline()) { + if (!InlineClassesUtilsKt.isInlineClass(containingDeclaration)) { v.anew(objectType); v.dup(); } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java index 3bc84e5c944..70e2d6844cf 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java @@ -1589,7 +1589,7 @@ public class FunctionCodegen { // When delegating to inline class, we invoke static implementation method // that takes inline class underlying value as 1st argument. - int toArgsShift = toClass.isInline() ? 1 : 0; + int toArgsShift = InlineClassesUtilsKt.isInlineClass(toClass) ? 1 : 0; int reg = 1; for (int i = 0; i < argTypes.length; ++i) { @@ -1609,7 +1609,7 @@ public class FunctionCodegen { if (toClass.getKind() == ClassKind.INTERFACE) { iv.invokeinterface(internalName, delegateToMethod.getName(), delegateToMethod.getDescriptor()); } - else if (toClass.isInline()) { + else if (InlineClassesUtilsKt.isInlineClass(toClass)) { iv.invokestatic(internalName, delegateToMethod.getName(), delegateToMethod.getDescriptor(), false); } else { diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionsFromAnyGeneratorImpl.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionsFromAnyGeneratorImpl.java index b53fa912717..0d7dc837228 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionsFromAnyGeneratorImpl.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionsFromAnyGeneratorImpl.java @@ -84,7 +84,7 @@ public class FunctionsFromAnyGeneratorImpl extends FunctionsFromAnyGenerator { String toStringMethodDesc = getToStringDesc(); MethodVisitor mv = v.newMethod(methodOrigin, getAccess(), toStringMethodName, toStringMethodDesc, null, null); - if (!isInErasedInlineClass && classDescriptor.isInline()) { + if (!isInErasedInlineClass && InlineClassesUtilsKt.isInlineClass(classDescriptor)) { FunctionCodegen.generateMethodInsideInlineClassWrapper(methodOrigin, function, classDescriptor, mv, typeMapper); return; } @@ -161,7 +161,7 @@ public class FunctionsFromAnyGeneratorImpl extends FunctionsFromAnyGenerator { String hashCodeMethodDesc = getHashCodeDesc(); MethodVisitor mv = v.newMethod(methodOrigin, getAccess(), hashCodeMethodName, hashCodeMethodDesc, null, null); - if (!isInErasedInlineClass && classDescriptor.isInline()) { + if (!isInErasedInlineClass && InlineClassesUtilsKt.isInlineClass(classDescriptor)) { FunctionCodegen.generateMethodInsideInlineClassWrapper(methodOrigin, function, classDescriptor, mv, typeMapper); return; } @@ -233,7 +233,7 @@ public class FunctionsFromAnyGeneratorImpl extends FunctionsFromAnyGenerator { String equalsMethodDesc = getEqualsDesc(); MethodVisitor mv = v.newMethod(methodOrigin, getAccess(), equalsMethodName, equalsMethodDesc, null, null); - if (!isInErasedInlineClass && classDescriptor.isInline()) { + if (!isInErasedInlineClass && InlineClassesUtilsKt.isInlineClass(classDescriptor)) { FunctionCodegen.generateMethodInsideInlineClassWrapper(methodOrigin, function, classDescriptor, mv, typeMapper); return; } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java index 2f0cf3eef55..c9c28a57deb 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java @@ -260,7 +260,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { @Override protected void generateErasedInlineClassIfNeeded() { if (!(myClass instanceof KtClass)) return; - if (!descriptor.isInline()) return; + if (!InlineClassesUtilsKt.isInlineClass(descriptor)) return; ClassContext erasedInlineClassContext = context.intoWrapperForErasedInlineClass(descriptor, state); new ErasedInlineClassBodyCodegen((KtClass) myClass, erasedInlineClassContext, v, state, this).generate(); @@ -269,7 +269,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { @Override protected void generateUnboxMethodForInlineClass() { if (!(myClass instanceof KtClass)) return; - if (!descriptor.isInline()) return; + if (!InlineClassesUtilsKt.isInlineClass(descriptor)) return; Type ownerType = typeMapper.mapClass(descriptor); ValueParameterDescriptor inlinedValue = InlineClassesUtilsKt.underlyingRepresentation(this.descriptor); @@ -450,7 +450,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { try { lookupConstructorExpressionsInClosureIfPresent(); constructorCodegen.generatePrimaryConstructor(delegationFieldsInfo, superClassAsmType); - if (!descriptor.isInline() && !(descriptor instanceof SyntheticClassOrObjectDescriptor)) { + if (!InlineClassesUtilsKt.isInlineClass(descriptor) && !(descriptor instanceof SyntheticClassOrObjectDescriptor)) { // Synthetic classes does not have declarations for secondary constructors for (ClassConstructorDescriptor secondaryConstructor : DescriptorUtilsKt.getSecondaryConstructors(descriptor)) { constructorCodegen.generateSecondaryConstructor(secondaryConstructor, superClassAsmType); @@ -552,7 +552,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { } private void generateFunctionsFromAnyForInlineClasses() { - if (!descriptor.isInline()) return; + if (!InlineClassesUtilsKt.isInlineClass(descriptor)) return; if (!(myClass instanceof KtClassOrObject)) return; new FunctionsFromAnyGeneratorImpl( (KtClassOrObject) myClass, bindingContext, descriptor, classAsmType, context, v, state diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java index d72d53dc740..496f8940956 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java @@ -775,7 +775,8 @@ public abstract class StackValue { ) { // Coerce 'this' for the case when it is smart cast. // Do not coerce for other cases due to the 'protected' access issues (JVMS 7, 4.9.2 Structural Constraints). - boolean coerceType = descriptor.getKind() == ClassKind.INTERFACE || descriptor.isInline() || (castReceiver && !isSuper); + boolean coerceType = descriptor.getKind() == ClassKind.INTERFACE || InlineClassesUtilsKt.isInlineClass(descriptor) || + (castReceiver && !isSuper); return new ThisOuter(codegen, descriptor, isSuper, coerceType); } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/context/ConstructorContext.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/context/ConstructorContext.java index e5ee4c4bc61..ecd6e4b3211 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/context/ConstructorContext.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/context/ConstructorContext.java @@ -24,6 +24,7 @@ import org.jetbrains.kotlin.codegen.binding.MutableClosure; import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper; import org.jetbrains.kotlin.descriptors.ClassDescriptor; import org.jetbrains.kotlin.descriptors.ConstructorDescriptor; +import org.jetbrains.kotlin.resolve.InlineClassesUtilsKt; import org.jetbrains.kotlin.resolve.jvm.AsmTypes; import org.jetbrains.kotlin.types.SimpleType; import org.jetbrains.org.objectweb.asm.Type; @@ -48,7 +49,7 @@ public class ConstructorContext extends MethodContext { ClassDescriptor capturedOuterClassDescriptor = closure != null ? closure.getCapturedOuterClassDescriptor() : null; StackValue stackValue; if (capturedOuterClassDescriptor != null) { - if (capturedOuterClassDescriptor.isInline()) { + if (InlineClassesUtilsKt.isInlineClass(capturedOuterClassDescriptor)) { SimpleType outerClassKotlinType = capturedOuterClassDescriptor.getDefaultType(); Type outerClassType = kotlinTypeMapper.mapType(capturedOuterClassDescriptor); stackValue = StackValue.local(1, outerClassType, outerClassKotlinType); diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/boxing/BoxedBasicValue.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/boxing/BoxedBasicValue.kt index f4cd6573685..3224938157a 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/boxing/BoxedBasicValue.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/boxing/BoxedBasicValue.kt @@ -20,6 +20,7 @@ import com.intellij.openapi.util.Pair import org.jetbrains.kotlin.codegen.AsmUtil import org.jetbrains.kotlin.codegen.optimization.common.StrictBasicValue import org.jetbrains.kotlin.codegen.state.GenerationState +import org.jetbrains.kotlin.resolve.isInlineClass import org.jetbrains.kotlin.resolve.jvm.AsmTypes import org.jetbrains.org.objectweb.asm.Type import org.jetbrains.org.objectweb.asm.tree.AbstractInsnNode @@ -119,7 +120,7 @@ fun getUnboxedType(boxedType: Type, state: GenerationState): Type { fun unboxedTypeOfInlineClass(boxedType: Type, state: GenerationState): Type? { val descriptor = - state.jvmBackendClassResolver.resolveToClassDescriptors(boxedType).singleOrNull()?.takeIf { it.isInline } ?: return null + state.jvmBackendClassResolver.resolveToClassDescriptors(boxedType).singleOrNull()?.takeIf { it.isInlineClass() } ?: return null return state.mapInlineClass(descriptor) } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt index f02057dcf4d..d490572bc3c 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt @@ -445,7 +445,7 @@ class KotlinTypeMapper @JvmOverloads constructor( } } } else { - val toInlinedErasedClass = functionParent.isInline && + val toInlinedErasedClass = functionParent.isInlineClass() && (!isAccessor(functionDescriptor) || isInlineClassConstructorAccessor(functionDescriptor)) if (toInlinedErasedClass) { diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/inlineClassManglingUtils.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/inlineClassManglingUtils.kt index 0e787796758..7d8e309f1d0 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/inlineClassManglingUtils.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/inlineClassManglingUtils.kt @@ -13,6 +13,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.InlineClassDescriptorResolver import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe +import org.jetbrains.kotlin.resolve.isInlineClass import org.jetbrains.kotlin.resolve.jvm.requiresFunctionNameManglingForParameterTypes import org.jetbrains.kotlin.resolve.jvm.requiresFunctionNameManglingForReturnType import org.jetbrains.kotlin.types.KotlinType @@ -111,7 +112,7 @@ fun getManglingSuffixBasedOnKotlinSignature( private fun getInfoForMangling(type: KotlinType): InfoForMangling? { val descriptor = type.constructor.declarationDescriptor ?: return null return when (descriptor) { - is ClassDescriptor -> InfoForMangling(descriptor.fqNameUnsafe, descriptor.isInline, type.isMarkedNullable) + is ClassDescriptor -> InfoForMangling(descriptor.fqNameUnsafe, descriptor.isInlineClass(), type.isMarkedNullable) is TypeParameterDescriptor -> { getInfoForMangling(descriptor.representativeUpperBound) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/typeMapperUtils.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/typeMapperUtils.kt index f48cf6e9e26..1be180c7b03 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/typeMapperUtils.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/typeMapperUtils.kt @@ -23,6 +23,7 @@ import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor import org.jetbrains.kotlin.descriptors.impl.TypeParameterDescriptorImpl import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.resolve.isInlineClass import org.jetbrains.kotlin.types.* import org.jetbrains.kotlin.types.typeUtil.asTypeProjection @@ -93,4 +94,4 @@ fun KotlinType.removeExternalProjections(): KotlinType { fun isInlineClassConstructorAccessor(descriptor: FunctionDescriptor): Boolean = descriptor is AccessorForConstructorDescriptor && - descriptor.calleeDescriptor.constructedClass.isInline + descriptor.calleeDescriptor.constructedClass.isInlineClass() diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java index d1f3e3f6c53..7f464477a92 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java @@ -24968,6 +24968,129 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte } } + @TestMetadata("compiler/testData/diagnostics/tests/valueClasses") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ValueClasses extends AbstractFirOldFrontendDiagnosticsTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInValueClasses() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/valueClasses"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("basicValueClassDeclaration.kt") + public void testBasicValueClassDeclaration() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.kt"); + } + + @TestMetadata("basicValueClassDeclarationDisabled.kt") + public void testBasicValueClassDeclarationDisabled() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.kt"); + } + + @TestMetadata("constructorsJvmSignaturesClash.kt") + public void testConstructorsJvmSignaturesClash() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.kt"); + } + + @TestMetadata("delegatedPropertyInValueClass.kt") + public void testDelegatedPropertyInValueClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.kt"); + } + + @TestMetadata("functionsJvmSignaturesClash.kt") + public void testFunctionsJvmSignaturesClash() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.kt"); + } + + @TestMetadata("functionsJvmSignaturesConflictOnInheritance.kt") + public void testFunctionsJvmSignaturesConflictOnInheritance() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesConflictOnInheritance.kt"); + } + + @TestMetadata("identityComparisonWithValueClasses.kt") + public void testIdentityComparisonWithValueClasses() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.kt"); + } + + @TestMetadata("lateinitValueClasses.kt") + public void testLateinitValueClasses() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.kt"); + } + + @TestMetadata("presenceOfInitializerBlockInsideValueClass.kt") + public void testPresenceOfInitializerBlockInsideValueClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.kt"); + } + + @TestMetadata("presenceOfPublicPrimaryConstructorForValueClass.kt") + public void testPresenceOfPublicPrimaryConstructorForValueClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/presenceOfPublicPrimaryConstructorForValueClass.kt"); + } + + @TestMetadata("propertiesWithBackingFieldsInsideValueClass.kt") + public void testPropertiesWithBackingFieldsInsideValueClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.kt"); + } + + @TestMetadata("recursiveValueClasses.kt") + public void testRecursiveValueClasses() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.kt"); + } + + @TestMetadata("reservedMembersAndConstructsInsideValueClass.kt") + public void testReservedMembersAndConstructsInsideValueClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.kt"); + } + + @TestMetadata("unsignedLiteralsWithoutArtifactOnClasspath.kt") + public void testUnsignedLiteralsWithoutArtifactOnClasspath() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/unsignedLiteralsWithoutArtifactOnClasspath.kt"); + } + + @TestMetadata("valueClassCanOnlyImplementInterfaces.kt") + public void testValueClassCanOnlyImplementInterfaces() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.kt"); + } + + @TestMetadata("valueClassCannotImplementInterfaceByDelegation.kt") + public void testValueClassCannotImplementInterfaceByDelegation() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.kt"); + } + + @TestMetadata("valueClassConstructorParameterWithDefaultValue.kt") + public void testValueClassConstructorParameterWithDefaultValue() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassConstructorParameterWithDefaultValue.kt"); + } + + @TestMetadata("valueClassDeclarationCheck.kt") + public void testValueClassDeclarationCheck() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt"); + } + + @TestMetadata("valueClassImplementsCollection.kt") + public void testValueClassImplementsCollection() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassImplementsCollection.kt"); + } + + @TestMetadata("valueClassWithForbiddenUnderlyingType.kt") + public void testValueClassWithForbiddenUnderlyingType() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.kt"); + } + + @TestMetadata("valueClassesInsideAnnotations.kt") + public void testValueClassesInsideAnnotations() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.kt"); + } + + @TestMetadata("varargsOnParametersOfValueClassType.kt") + public void testVarargsOnParametersOfValueClassType() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.kt"); + } + } + @TestMetadata("compiler/testData/diagnostics/tests/varargs") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index 821a05c031e..61b37a840b8 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -362,6 +362,7 @@ public interface Errors { DiagnosticFactory0 INLINE_CLASS_CANNOT_BE_RECURSIVE = DiagnosticFactory0.create(ERROR); DiagnosticFactory1 RESERVED_MEMBER_INSIDE_INLINE_CLASS = DiagnosticFactory1.create(ERROR); DiagnosticFactory0 SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 VALUE_CLASS_WITHOUT_JVM_INLINE_ANNOTATION = DiagnosticFactory0.create(ERROR); // Result class diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index b67d915a45d..deb9aa147dd 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -717,6 +717,7 @@ public class DefaultErrorMessages { MAP.put(INLINE_CLASS_CANNOT_BE_RECURSIVE, "Inline class cannot be recursive"); MAP.put(RESERVED_MEMBER_INSIDE_INLINE_CLASS, "Member with the name ''{0}'' is reserved for future releases", STRING); MAP.put(SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS, "Secondary constructors with bodies are reserved for for future releases"); + MAP.put(VALUE_CLASS_WITHOUT_JVM_INLINE_ANNOTATION, "Value classes without @JvmInline annotation are not supported yet"); MAP.put(RESULT_CLASS_IN_RETURN_TYPE, "'kotlin.Result' cannot be used as a return type"); MAP.put(RESULT_CLASS_WITH_NULLABLE_OPERATOR, "Expression of type 'kotlin.Result' cannot be used as a left operand of ''{0}''", STRING); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.kt index 42fea2834eb..f7220cd0efe 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.kt @@ -270,7 +270,7 @@ class DeclarationsChecker( if (declaration is KtPrimaryConstructor && !DescriptorUtils.isAnnotationClass(constructorDescriptor.constructedClass) && - !constructorDescriptor.constructedClass.isInline + !constructorDescriptor.constructedClass.isInlineClass() ) { for (parameter in declaration.valueParameters) { if (parameter.hasValOrVar()) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.kt index 33fda2c6791..cd212c74625 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.kt @@ -107,7 +107,8 @@ object ModifierCheckerCore { ANNOTATION_CLASS, TYPEALIAS ), - FUN_KEYWORD to EnumSet.of(INTERFACE) + FUN_KEYWORD to EnumSet.of(INTERFACE), + VALUE_KEYWORD to EnumSet.of(CLASS_ONLY) ) private val featureDependencies = mapOf( @@ -118,7 +119,8 @@ object ModifierCheckerCore { EXPECT_KEYWORD to listOf(LanguageFeature.MultiPlatformProjects), ACTUAL_KEYWORD to listOf(LanguageFeature.MultiPlatformProjects), LATEINIT_KEYWORD to listOf(LanguageFeature.LateinitTopLevelProperties, LanguageFeature.LateinitLocalVariables), - FUN_KEYWORD to listOf(LanguageFeature.FunctionalInterfaceConversion) + FUN_KEYWORD to listOf(LanguageFeature.FunctionalInterfaceConversion), + VALUE_KEYWORD to listOf(LanguageFeature.InlineClasses) ) private val featureDependenciesTargets = mapOf( @@ -185,12 +187,13 @@ object ModifierCheckerCore { result += incompatibilityRegister(PRIVATE_KEYWORD, PROTECTED_KEYWORD, PUBLIC_KEYWORD, INTERNAL_KEYWORD) // Abstract + open + final + sealed: incompatible result += incompatibilityRegister(ABSTRACT_KEYWORD, OPEN_KEYWORD, FINAL_KEYWORD, SEALED_KEYWORD) - // data + open, data + inner, data + abstract, data + sealed, data + inline + // data + open, data + inner, data + abstract, data + sealed, data + inline, data + value result += incompatibilityRegister(DATA_KEYWORD, OPEN_KEYWORD) result += incompatibilityRegister(DATA_KEYWORD, INNER_KEYWORD) result += incompatibilityRegister(DATA_KEYWORD, ABSTRACT_KEYWORD) result += incompatibilityRegister(DATA_KEYWORD, SEALED_KEYWORD) result += incompatibilityRegister(DATA_KEYWORD, INLINE_KEYWORD) + result += incompatibilityRegister(DATA_KEYWORD, VALUE_KEYWORD) // open is redundant to abstract & override result += redundantRegister(ABSTRACT_KEYWORD, OPEN_KEYWORD) // abstract is redundant to sealed diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt index b5f3decc39d..4d8bc1f6060 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt @@ -9,9 +9,9 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.diagnostics.Errors import org.jetbrains.kotlin.lexer.KtTokens +import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.modalityModifier -import org.jetbrains.kotlin.psi.psiUtil.visibilityModifier import org.jetbrains.kotlin.resolve.* import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.typeUtil.isNothing @@ -22,15 +22,16 @@ import org.jetbrains.kotlin.utils.addToStdlib.safeAs object InlineClassDeclarationChecker : DeclarationChecker { override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) { if (declaration !is KtClass) return - if (descriptor !is ClassDescriptor || !descriptor.isInline) return + if (descriptor !is ClassDescriptor || !descriptor.isInline && !descriptor.isValue) return if (descriptor.kind != ClassKind.CLASS) return - val inlineKeyword = declaration.modifierList?.getModifier(KtTokens.INLINE_KEYWORD) - require(inlineKeyword != null) { "Declaration of inline class must have 'inline' keyword" } + val inlineOrValueKeyword = declaration.modifierList?.getModifier(KtTokens.INLINE_KEYWORD) + ?: declaration.modifierList?.getModifier(KtTokens.VALUE_KEYWORD) + require(inlineOrValueKeyword != null) { "Declaration of inline class must have 'inline' keyword" } val trace = context.trace if (!DescriptorUtils.isTopLevelDeclaration(descriptor)) { - trace.report(Errors.INLINE_CLASS_NOT_TOP_LEVEL.on(inlineKeyword)) + trace.report(Errors.INLINE_CLASS_NOT_TOP_LEVEL.on(inlineOrValueKeyword)) return } @@ -42,7 +43,7 @@ object InlineClassDeclarationChecker : DeclarationChecker { val primaryConstructor = declaration.primaryConstructor if (primaryConstructor == null) { - trace.report(Errors.ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_INLINE_CLASS.on(inlineKeyword)) + trace.report(Errors.ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_INLINE_CLASS.on(inlineOrValueKeyword)) return } @@ -87,6 +88,10 @@ object InlineClassDeclarationChecker : DeclarationChecker { } } } + + if (descriptor.isValue && !descriptor.annotations.hasAnnotation(JVM_INLINE_ANNOTATION)) { + trace.report(Errors.VALUE_CLASS_WITHOUT_JVM_INLINE_ANNOTATION.on(inlineOrValueKeyword)) + } } private fun KotlinType.isInapplicableParameterType() = diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassMemberScope.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassMemberScope.kt index c1b429f25d0..089a712515c 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassMemberScope.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassMemberScope.kt @@ -258,7 +258,7 @@ open class LazyClassMemberScope( name: Name, fromSupertypes: List ) { - if (!thisDescriptor.isInline) return + if (!thisDescriptor.isInlineClass()) return addFunctionFromAnyIfNeeded(result, name, fromSupertypes) } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeclarationStubGenerator.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeclarationStubGenerator.kt index 2ee83228ff0..0ffed6b9f03 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeclarationStubGenerator.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeclarationStubGenerator.kt @@ -32,6 +32,7 @@ import org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.descriptorUtil.isEffectivelyExternal +import org.jetbrains.kotlin.resolve.isInlineClass import org.jetbrains.kotlin.resolve.scopes.getDescriptorsFiltered import org.jetbrains.kotlin.serialization.deserialization.descriptors.DescriptorWithContainerSource import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource @@ -274,7 +275,7 @@ class DeclarationStubGenerator( isInner = descriptor.isInner, isData = descriptor.isData, isExternal = descriptor.isEffectivelyExternal(), - isInline = descriptor.isInline, + isInline = descriptor.isInlineClass(), isExpect = descriptor.isExpect, isFun = descriptor.isFun, stubGenerator = this, diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DescriptorToIrUtil.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DescriptorToIrUtil.kt index bfd6370d3d6..006dfcbdd5a 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DescriptorToIrUtil.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DescriptorToIrUtil.kt @@ -12,6 +12,7 @@ import org.jetbrains.kotlin.ir.declarations.IrFactory import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.descriptorUtil.isEffectivelyExternal +import org.jetbrains.kotlin.resolve.isInlineClass import org.jetbrains.kotlin.types.KotlinType val ParameterDescriptor.indexOrMinusOne: Int @@ -38,5 +39,5 @@ fun IrFactory.createIrClassFromDescriptor( ): IrClass = createClass( startOffset, endOffset, origin, symbol, name, descriptor.kind, visibility, modality, descriptor.isCompanionObject, descriptor.isInner, descriptor.isData, descriptor.isEffectivelyExternal(), - descriptor.isInline, descriptor.isExpect, descriptor.isFun, descriptor.source + descriptor.isInlineClass(), descriptor.isExpect, descriptor.isFun, descriptor.source ) diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtClass.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/KtClass.kt index 7769c36d28d..9c88e1c59df 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtClass.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtClass.kt @@ -33,6 +33,7 @@ open class KtClass : KtClassOrObject { fun isSealed(): Boolean = hasModifier(KtTokens.SEALED_KEYWORD) fun isInner(): Boolean = hasModifier(KtTokens.INNER_KEYWORD) fun isInline(): Boolean = hasModifier(KtTokens.INLINE_KEYWORD) + fun isValue(): Boolean = hasModifier(KtTokens.VALUE_KEYWORD) override fun getCompanionObjects(): List = body?.allCompanionObjects.orEmpty() diff --git a/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.kt b/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.kt index e9bb36cf332..6ead2068679 100644 --- a/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.kt +++ b/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.kt @@ -23,10 +23,8 @@ import org.jetbrains.kotlin.metadata.serialization.MutableTypeTable import org.jetbrains.kotlin.metadata.serialization.MutableVersionRequirementTable import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.resolve.DescriptorUtils +import org.jetbrains.kotlin.resolve.* import org.jetbrains.kotlin.resolve.DescriptorUtils.isEnumEntry -import org.jetbrains.kotlin.resolve.MemberComparator -import org.jetbrains.kotlin.resolve.RequireKotlinConstants import org.jetbrains.kotlin.resolve.calls.components.isActualParameterWithAnyExpectedDefault import org.jetbrains.kotlin.resolve.constants.EnumValue import org.jetbrains.kotlin.resolve.constants.IntValue @@ -34,7 +32,6 @@ import org.jetbrains.kotlin.resolve.constants.NullValue import org.jetbrains.kotlin.resolve.constants.StringValue import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe import org.jetbrains.kotlin.resolve.descriptorUtil.nonSourceAnnotations -import org.jetbrains.kotlin.resolve.isInlineClassType import org.jetbrains.kotlin.serialization.deserialization.ProtoEnumFlags import org.jetbrains.kotlin.serialization.deserialization.descriptorVisibility import org.jetbrains.kotlin.serialization.deserialization.memberKind @@ -74,7 +71,7 @@ class DescriptorSerializer private constructor( ProtoEnumFlags.modality(classDescriptor.modality), ProtoEnumFlags.classKind(classDescriptor.kind, classDescriptor.isCompanionObject), classDescriptor.isInner, classDescriptor.isData, classDescriptor.isExternal, classDescriptor.isExpect, - classDescriptor.isInline, classDescriptor.isFun + classDescriptor.isInlineClass(), classDescriptor.isFun ) if (flags != builder.flags) { builder.flags = flags @@ -173,7 +170,7 @@ class DescriptorSerializer private constructor( builder: ProtoBuf.Class.Builder, versionRequirementTable: MutableVersionRequirementTable ) { - if (!classDescriptor.isInline && !classDescriptor.hasInlineClassTypesInSignature()) return + if (!classDescriptor.isInlineClass() && !classDescriptor.hasInlineClassTypesInSignature()) return builder.addVersionRequirement( writeLanguageVersionRequirement(LanguageFeature.InlineClasses, versionRequirementTable) diff --git a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.fir.kt new file mode 100644 index 00000000000..2dee1eb7ee7 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.fir.kt @@ -0,0 +1,13 @@ +// !LANGUAGE: +InlineClasses + +package kotlin + +annotation class JvmInline + +@JvmInline +value class Foo(val x: Int) + +value interface InlineInterface +value annotation class InlineAnn +value object InlineObject +value enum class InlineEnum diff --git a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.kt b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.kt new file mode 100644 index 00000000000..3bdc892c700 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.kt @@ -0,0 +1,13 @@ +// !LANGUAGE: +InlineClasses + +package kotlin + +annotation class JvmInline + +@JvmInline +value class Foo(val x: Int) + +value interface InlineInterface +value annotation class InlineAnn +value object InlineObject +value enum class InlineEnum diff --git a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.txt b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.txt new file mode 100644 index 00000000000..c98b37739ef --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.txt @@ -0,0 +1,56 @@ +package + +package kotlin { + + @kotlin.JvmInline public final value class Foo { + public constructor Foo(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final value annotation class InlineAnn : kotlin.Annotation { + public constructor InlineAnn() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final value enum class InlineEnum : kotlin.Enum { + private constructor InlineEnum() + public final override /*1*/ /*fake_override*/ val name: kotlin.String + public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int + protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any + public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: kotlin.InlineEnum): kotlin.Int + public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit + public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class! + public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + // Static members + public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): kotlin.InlineEnum + public final /*synthesized*/ fun values(): kotlin.Array + } + + public value interface InlineInterface { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public value object InlineObject { + private constructor InlineObject() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.fir.kt new file mode 100644 index 00000000000..161e5275090 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.fir.kt @@ -0,0 +1,15 @@ +// !LANGUAGE: -InlineClasses +// !DIAGNOSTICS: -UNUSED_PARAMETER + +package kotlin + +annotation class JvmInline + +value class Foo(val x: Int) + +value annotation class InlineAnn +value object InlineObject +value enum class InlineEnum + +@JvmInline +value class NotVal(x: Int) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.kt b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.kt new file mode 100644 index 00000000000..e018281ab16 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.kt @@ -0,0 +1,15 @@ +// !LANGUAGE: -InlineClasses +// !DIAGNOSTICS: -UNUSED_PARAMETER + +package kotlin + +annotation class JvmInline + +value class Foo(val x: Int) + +value annotation class InlineAnn +value object InlineObject +value enum class InlineEnum + +@JvmInline +value class NotVal(x: Int) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.txt b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.txt new file mode 100644 index 00000000000..3a25001d966 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.txt @@ -0,0 +1,57 @@ +package + +package kotlin { + + public final value class Foo { + public constructor Foo(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final value annotation class InlineAnn : kotlin.Annotation { + public constructor InlineAnn() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final value enum class InlineEnum : kotlin.Enum { + private constructor InlineEnum() + public final override /*1*/ /*fake_override*/ val name: kotlin.String + public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int + protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any + public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: kotlin.InlineEnum): kotlin.Int + public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit + public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class! + public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + // Static members + public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): kotlin.InlineEnum + public final /*synthesized*/ fun values(): kotlin.Array + } + + public value object InlineObject { + private constructor InlineObject() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class NotVal { + public constructor NotVal(/*0*/ x: kotlin.Int) + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.fir.kt new file mode 100644 index 00000000000..fbef2363032 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.fir.kt @@ -0,0 +1,24 @@ +// !LANGUAGE: +InlineClasses +// !DIAGNOSTICS: -UNUSED_PARAMETER + +package kotlin + +annotation class JvmInline + +@JvmInline +value class X(val x: Int) +@JvmInline +value class Z(val x: Int) + +class TestOk1(val a: Int, val b: Int) { + constructor(x: X) : this(x.x, 1) +} + +class TestErr1(val a: Int) { + constructor(x: X) : this(x.x) +} + +class TestErr2(val a: Int, val b: Int) { + constructor(x: X) : this(x.x, 1) + constructor(z: Z) : this(z.x, 2) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.kt b/compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.kt new file mode 100644 index 00000000000..96577da92e1 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.kt @@ -0,0 +1,24 @@ +// !LANGUAGE: +InlineClasses +// !DIAGNOSTICS: -UNUSED_PARAMETER + +package kotlin + +annotation class JvmInline + +@JvmInline +value class X(val x: Int) +@JvmInline +value class Z(val x: Int) + +class TestOk1(val a: Int, val b: Int) { + constructor(x: X) : this(x.x, 1) +} + +class TestErr1(val a: Int) { + constructor(x: X) : this(x.x) +} + +class TestErr2(val a: Int, val b: Int) { + constructor(x: X) : this(x.x, 1) + constructor(z: Z) : this(z.x, 2) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.txt b/compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.txt new file mode 100644 index 00000000000..6fc4c16ec8a --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.txt @@ -0,0 +1,57 @@ +package + +package kotlin { + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final class TestErr1 { + public constructor TestErr1(/*0*/ a: kotlin.Int) + public constructor TestErr1(/*0*/ x: kotlin.X) + public final val a: kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final class TestErr2 { + public constructor TestErr2(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int) + public constructor TestErr2(/*0*/ x: kotlin.X) + public constructor TestErr2(/*0*/ z: kotlin.Z) + public final val a: kotlin.Int + public final val b: kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final class TestOk1 { + public constructor TestOk1(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int) + public constructor TestOk1(/*0*/ x: kotlin.X) + public final val a: kotlin.Int + public final val b: kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class X { + public constructor X(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class Z { + public constructor Z(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.fir.kt new file mode 100644 index 00000000000..c1e7abba11b --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.fir.kt @@ -0,0 +1,33 @@ +// !LANGUAGE: +InlineClasses + +package kotlin + +annotation class JvmInline + +class Val { + operator fun getValue(thisRef: Any?, kProp: Any?) = 1 +} + +class Var { + operator fun getValue(thisRef: Any?, kProp: Any?) = 2 + operator fun setValue(thisRef: Any?, kProp: Any?, value: Int) {} +} + + +object ValObject { + operator fun getValue(thisRef: Any?, kProp: Any?) = 1 +} + +object VarObject { + operator fun getValue(thisRef: Any?, kProp: Any?) = 2 + operator fun setValue(thisRef: Any?, kProp: Any?, value: Int) {} +} + +@JvmInline +value class Z(val data: Int) { + val testVal by Val() + var testVar by Var() + + val testValBySingleton by ValObject + var testVarBySingleton by VarObject +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.kt b/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.kt new file mode 100644 index 00000000000..5b9079fa89f --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.kt @@ -0,0 +1,33 @@ +// !LANGUAGE: +InlineClasses + +package kotlin + +annotation class JvmInline + +class Val { + operator fun getValue(thisRef: Any?, kProp: Any?) = 1 +} + +class Var { + operator fun getValue(thisRef: Any?, kProp: Any?) = 2 + operator fun setValue(thisRef: Any?, kProp: Any?, value: Int) {} +} + + +object ValObject { + operator fun getValue(thisRef: Any?, kProp: Any?) = 1 +} + +object VarObject { + operator fun getValue(thisRef: Any?, kProp: Any?) = 2 + operator fun setValue(thisRef: Any?, kProp: Any?, value: Int) {} +} + +@JvmInline +value class Z(val data: Int) { + val testVal by Val() + var testVar by Var() + + val testValBySingleton by ValObject + var testVarBySingleton by VarObject +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.txt b/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.txt new file mode 100644 index 00000000000..ebb31a9479f --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.txt @@ -0,0 +1,57 @@ +package + +package kotlin { + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final class Val { + public constructor Val() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kProp: kotlin.Any?): kotlin.Int + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public object ValObject { + private constructor ValObject() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kProp: kotlin.Any?): kotlin.Int + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final class Var { + public constructor Var() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kProp: kotlin.Any?): kotlin.Int + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kProp: kotlin.Any?, /*2*/ value: kotlin.Int): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public object VarObject { + private constructor VarObject() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kProp: kotlin.Any?): kotlin.Int + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kProp: kotlin.Any?, /*2*/ value: kotlin.Int): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class Z { + public constructor Z(/*0*/ data: kotlin.Int) + public final val data: kotlin.Int + public final val testVal: kotlin.Int + public final val testValBySingleton: kotlin.Int + public final var testVar: kotlin.Int + public final var testVarBySingleton: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.fir.kt new file mode 100644 index 00000000000..dff6941bf0d --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.fir.kt @@ -0,0 +1,46 @@ +// !LANGUAGE: +InlineClasses +// !DIAGNOSTICS: -UNUSED_PARAMETER + +package kotlin + +annotation class JvmInline + +@JvmInline +value class X(val x: Int) +@JvmInline +value class Z(val x: Int) +@JvmInline +value class Str(val str: String) +@JvmInline +value class Name(val name: String) +@JvmInline +value class NStr(val str: String?) + +fun testSimple(x: X) {} +fun testSimple(z: Z) {} + +fun testMixed(x: Int, y: Int) {} +fun testMixed(x: X, y: Int) {} +fun testMixed(x: Int, y: X) {} +fun testMixed(x: X, y: X) {} + +fun testNewType(s: Str) {} +fun testNewType(name: Name) {} + +fun testNullableVsNonNull1(s: Str) {} +fun testNullableVsNonNull1(s: Str?) {} + +fun testNullableVsNonNull2(ns: NStr) {} +fun testNullableVsNonNull2(ns: NStr?) {} + +fun testFunVsExt(x: X) {} +fun X.testFunVsExt() {} + +fun testNonGenericVsGeneric(x: X, y: Number) {} +fun testNonGenericVsGeneric(x: X, y: T) {} + +class C { + fun testNonGenericVsGeneric(x: X, y: Number) {} + fun testNonGenericVsGeneric(x: X, y: T) {} + fun testNonGenericVsGeneric(x: X, y: TC) {} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.kt b/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.kt new file mode 100644 index 00000000000..1222ff952f8 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.kt @@ -0,0 +1,46 @@ +// !LANGUAGE: +InlineClasses +// !DIAGNOSTICS: -UNUSED_PARAMETER + +package kotlin + +annotation class JvmInline + +@JvmInline +value class X(val x: Int) +@JvmInline +value class Z(val x: Int) +@JvmInline +value class Str(val str: String) +@JvmInline +value class Name(val name: String) +@JvmInline +value class NStr(val str: String?) + +fun testSimple(x: X) {} +fun testSimple(z: Z) {} + +fun testMixed(x: Int, y: Int) {} +fun testMixed(x: X, y: Int) {} +fun testMixed(x: Int, y: X) {} +fun testMixed(x: X, y: X) {} + +fun testNewType(s: Str) {} +fun testNewType(name: Name) {} + +fun testNullableVsNonNull1(s: Str) {} +fun testNullableVsNonNull1(s: Str?) {} + +fun testNullableVsNonNull2(ns: NStr) {} +fun testNullableVsNonNull2(ns: NStr?) {} + +fun testFunVsExt(x: X) {} +fun X.testFunVsExt() {} + +fun testNonGenericVsGeneric(x: X, y: Number) {} +fun testNonGenericVsGeneric(x: X, y: T) {} + +class C { + fun testNonGenericVsGeneric(x: X, y: Number) {} + fun testNonGenericVsGeneric(x: X, y: T) {} + fun testNonGenericVsGeneric(x: X, y: TC) {} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.txt b/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.txt new file mode 100644 index 00000000000..d33a5eded5f --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.txt @@ -0,0 +1,77 @@ +package + +package kotlin { + public fun testFunVsExt(/*0*/ x: kotlin.X): kotlin.Unit + public fun testMixed(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int): kotlin.Unit + public fun testMixed(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.X): kotlin.Unit + public fun testMixed(/*0*/ x: kotlin.X, /*1*/ y: kotlin.Int): kotlin.Unit + public fun testMixed(/*0*/ x: kotlin.X, /*1*/ y: kotlin.X): kotlin.Unit + public fun testNewType(/*0*/ name: kotlin.Name): kotlin.Unit + public fun testNewType(/*0*/ s: kotlin.Str): kotlin.Unit + public fun testNonGenericVsGeneric(/*0*/ x: kotlin.X, /*1*/ y: T): kotlin.Unit + public fun testNonGenericVsGeneric(/*0*/ x: kotlin.X, /*1*/ y: kotlin.Number): kotlin.Unit + public fun testNullableVsNonNull1(/*0*/ s: kotlin.Str): kotlin.Unit + public fun testNullableVsNonNull1(/*0*/ s: kotlin.Str?): kotlin.Unit + public fun testNullableVsNonNull2(/*0*/ ns: kotlin.NStr): kotlin.Unit + public fun testNullableVsNonNull2(/*0*/ ns: kotlin.NStr?): kotlin.Unit + public fun testSimple(/*0*/ x: kotlin.X): kotlin.Unit + public fun testSimple(/*0*/ z: kotlin.Z): kotlin.Unit + public fun kotlin.X.testFunVsExt(): kotlin.Unit + + public final class C { + public constructor C() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun testNonGenericVsGeneric(/*0*/ x: kotlin.X, /*1*/ y: T): kotlin.Unit + public final fun testNonGenericVsGeneric(/*0*/ x: kotlin.X, /*1*/ y: TC): kotlin.Unit + public final fun testNonGenericVsGeneric(/*0*/ x: kotlin.X, /*1*/ y: kotlin.Number): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class NStr { + public constructor NStr(/*0*/ str: kotlin.String?) + public final val str: kotlin.String? + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class Name { + public constructor Name(/*0*/ name: kotlin.String) + public final val name: kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class Str { + public constructor Str(/*0*/ str: kotlin.String) + public final val str: kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class X { + public constructor X(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class Z { + public constructor Z(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesConflictOnInheritance.kt b/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesConflictOnInheritance.kt new file mode 100644 index 00000000000..d261567326b --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesConflictOnInheritance.kt @@ -0,0 +1,21 @@ +// FIR_IDENTICAL +// !LANGUAGE: +InlineClasses + +package kotlin + +annotation class JvmInline + +@JvmInline +value class Name(val name: String) +@JvmInline +value class Password(val password: String) + +interface NameVerifier { + fun verify(name: Name) +} + +interface PasswordVerifier { + fun verify(password: Password) +} + +interface NameAndPasswordVerifier : NameVerifier, PasswordVerifier diff --git a/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesConflictOnInheritance.txt b/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesConflictOnInheritance.txt new file mode 100644 index 00000000000..cc538ec3809 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesConflictOnInheritance.txt @@ -0,0 +1,49 @@ +package + +package kotlin { + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class Name { + public constructor Name(/*0*/ name: kotlin.String) + public final val name: kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public interface NameAndPasswordVerifier : kotlin.NameVerifier, kotlin.PasswordVerifier { + public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String + public abstract override /*1*/ /*fake_override*/ fun verify(/*0*/ name: kotlin.Name): kotlin.Unit + public abstract override /*1*/ /*fake_override*/ fun verify(/*0*/ password: kotlin.Password): kotlin.Unit + } + + public interface NameVerifier { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + public abstract fun verify(/*0*/ name: kotlin.Name): kotlin.Unit + } + + @kotlin.JvmInline public final value class Password { + public constructor Password(/*0*/ password: kotlin.String) + public final val password: kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public interface PasswordVerifier { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + public abstract fun verify(/*0*/ password: kotlin.Password): kotlin.Unit + } +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.fir.kt new file mode 100644 index 00000000000..a5f2b180bc4 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.fir.kt @@ -0,0 +1,21 @@ +// !LANGUAGE: +InlineClasses +// !DIAGNOSTICS: -UNUSED_VARIABLE + +package kotlin + +annotation class JvmInline + +@JvmInline +value class Foo(val x: Int) +@JvmInline +value class Bar(val y: String) + +fun test(f1: Foo, f2: Foo, b1: Bar, fn1: Foo?, fn2: Foo?) { + val a1 = f1 === f2 || f1 !== f2 + val a2 = f1 === f1 + val a3 = f1 === b1 || f1 !== b1 + + val c1 = fn1 === fn2 || fn1 !== fn2 + val c2 = f1 === fn1 || f1 !== fn1 + val c3 = b1 === fn1 || b1 !== fn1 +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.kt b/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.kt new file mode 100644 index 00000000000..d9f52a94153 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.kt @@ -0,0 +1,21 @@ +// !LANGUAGE: +InlineClasses +// !DIAGNOSTICS: -UNUSED_VARIABLE + +package kotlin + +annotation class JvmInline + +@JvmInline +value class Foo(val x: Int) +@JvmInline +value class Bar(val y: String) + +fun test(f1: Foo, f2: Foo, b1: Bar, fn1: Foo?, fn2: Foo?) { + val a1 = f1 === f2 || f1 !== f2 + val a2 = f1 === f1 + val a3 = f1 === b1 || f1 !== b1 + + val c1 = fn1 === fn2 || fn1 !== fn2 + val c2 = f1 === fn1 || f1 !== fn1 + val c3 = b1 === fn1 || b1 !== fn1 +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.txt b/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.txt new file mode 100644 index 00000000000..545009b9063 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.txt @@ -0,0 +1,28 @@ +package + +package kotlin { + public fun test(/*0*/ f1: kotlin.Foo, /*1*/ f2: kotlin.Foo, /*2*/ b1: kotlin.Bar, /*3*/ fn1: kotlin.Foo?, /*4*/ fn2: kotlin.Foo?): kotlin.Unit + + @kotlin.JvmInline public final value class Bar { + public constructor Bar(/*0*/ y: kotlin.String) + public final val y: kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class Foo { + public constructor Foo(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.fir.kt new file mode 100644 index 00000000000..87423ad5b0c --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.fir.kt @@ -0,0 +1,15 @@ +// !LANGUAGE: +InlineClasses +// !DIAGNOSTICS: -UNUSED_VARIABLE + +package kotlin + +annotation class JvmInline + +@JvmInline +value class Foo(val x: Int) + +lateinit var a: Foo + +fun foo() { + lateinit var b: Foo +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.kt b/compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.kt new file mode 100644 index 00000000000..ccf4cc8d6b8 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.kt @@ -0,0 +1,15 @@ +// !LANGUAGE: +InlineClasses +// !DIAGNOSTICS: -UNUSED_VARIABLE + +package kotlin + +annotation class JvmInline + +@JvmInline +value class Foo(val x: Int) + +lateinit var a: Foo + +fun foo() { + lateinit var b: Foo +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.txt b/compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.txt new file mode 100644 index 00000000000..dc071c62ae3 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.txt @@ -0,0 +1,21 @@ +package + +package kotlin { + public lateinit var a: kotlin.Foo + public fun foo(): kotlin.Unit + + @kotlin.JvmInline public final value class Foo { + public constructor Foo(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.kt b/compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.kt new file mode 100644 index 00000000000..f85a8c6367b --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.kt @@ -0,0 +1,16 @@ +// !LANGUAGE: +InlineClasses +// !DIAGNOSTICS: -UNUSED_VARIABLE +// FIR_IDENTICAL + +package kotlin + +annotation class JvmInline + +@JvmInline +value class Foo(val x: Int) { + init {} + + init { + val f = 1 + } +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.txt b/compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.txt new file mode 100644 index 00000000000..d8feb9201fe --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.txt @@ -0,0 +1,19 @@ +package + +package kotlin { + + @kotlin.JvmInline public final value class Foo { + public constructor Foo(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/presenceOfPublicPrimaryConstructorForValueClass.kt b/compiler/testData/diagnostics/tests/valueClasses/presenceOfPublicPrimaryConstructorForValueClass.kt new file mode 100644 index 00000000000..f03ff14c317 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/presenceOfPublicPrimaryConstructorForValueClass.kt @@ -0,0 +1,17 @@ +// !LANGUAGE: +InlineClasses +// FIR_IDENTICAL + +package kotlin + +annotation class JvmInline + +@JvmInline +value class ConstructorWithDefaultVisibility(val x: Int) +@JvmInline +value class PublicConstructor public constructor(val x: Int) +@JvmInline +value class InternalConstructor internal constructor(val x: Int) +@JvmInline +value class ProtectedConstructor protected constructor(val x: Int) +@JvmInline +value class PrivateConstructor private constructor(val x: Int) diff --git a/compiler/testData/diagnostics/tests/valueClasses/presenceOfPublicPrimaryConstructorForValueClass.txt b/compiler/testData/diagnostics/tests/valueClasses/presenceOfPublicPrimaryConstructorForValueClass.txt new file mode 100644 index 00000000000..b7859ca179b --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/presenceOfPublicPrimaryConstructorForValueClass.txt @@ -0,0 +1,51 @@ +package + +package kotlin { + + @kotlin.JvmInline public final value class ConstructorWithDefaultVisibility { + public constructor ConstructorWithDefaultVisibility(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class InternalConstructor { + internal constructor InternalConstructor(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class PrivateConstructor { + private constructor PrivateConstructor(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class ProtectedConstructor { + protected constructor ProtectedConstructor(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class PublicConstructor { + public constructor PublicConstructor(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.fir.kt new file mode 100644 index 00000000000..8e53c287b85 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.fir.kt @@ -0,0 +1,39 @@ +// !LANGUAGE: +InlineClasses +// !DIAGNOSTICS: -UNUSED_PARAMETER + +package kotlin + +annotation class JvmInline + +interface A { + val goodSize: Int +} + +interface B { + val badSize: Int +} + +@JvmInline +value class Foo(val x: Int) : A, B { + val a0 + get() = 0 + + val a1 = 0 + + var a2: Int + get() = 1 + set(value) {} + + var a3: Int = 0 + get() = 1 + set(value) { + field = value + } + + override val goodSize: Int + get() = 0 + + override val badSize: Int = 0 + + lateinit var lateinitProperty: String +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.kt b/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.kt new file mode 100644 index 00000000000..721bbd69342 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.kt @@ -0,0 +1,39 @@ +// !LANGUAGE: +InlineClasses +// !DIAGNOSTICS: -UNUSED_PARAMETER + +package kotlin + +annotation class JvmInline + +interface A { + val goodSize: Int +} + +interface B { + val badSize: Int +} + +@JvmInline +value class Foo(val x: Int) : A, B { + val a0 + get() = 0 + + val a1 = 0 + + var a2: Int + get() = 1 + set(value) {} + + var a3: Int = 0 + get() = 1 + set(value) { + field = value + } + + override val goodSize: Int + get() = 0 + + override val badSize: Int = 0 + + lateinit var lateinitProperty: String +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.txt b/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.txt new file mode 100644 index 00000000000..9540353f79b --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.txt @@ -0,0 +1,40 @@ +package + +package kotlin { + + public interface A { + public abstract val goodSize: kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public interface B { + public abstract val badSize: kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class Foo : kotlin.A, kotlin.B { + public constructor Foo(/*0*/ x: kotlin.Int) + public final val a0: kotlin.Int + public final val a1: kotlin.Int = 0 + public final var a2: kotlin.Int + public final var a3: kotlin.Int + public open override /*1*/ val badSize: kotlin.Int = 0 + public open override /*1*/ val goodSize: kotlin.Int + public final lateinit var lateinitProperty: kotlin.String + public final val x: kotlin.Int + public open override /*2*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*2*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*2*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.fir.kt new file mode 100644 index 00000000000..c06db3a2dca --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.fir.kt @@ -0,0 +1,37 @@ +// !LANGUAGE: +InlineClasses + +package kotlin + +annotation class JvmInline + +@JvmInline +value class Test1(val x: Test1) + +@JvmInline +value class Test2A(val x: Test2B) +@JvmInline +value class Test2B(val x: Test2A) + +@JvmInline +value class Test3A(val x: Test3B) +@JvmInline +value class Test3B(val x: Test3C) +@JvmInline +value class Test3C(val x: Test3A) + +@JvmInline +value class TestNullable(val x: TestNullable?) + +@JvmInline +value class TestRecursionInTypeArguments(val x: List) + +@JvmInline +value class TestRecursionInArray(val x: Array) + +@JvmInline +value class TestRecursionInUpperBounds>(val x: T) + +@JvmInline +value class Id(val x: T) +@JvmInline +value class TestRecursionThroughId(val x: Id) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.kt b/compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.kt new file mode 100644 index 00000000000..e4c385fb711 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.kt @@ -0,0 +1,37 @@ +// !LANGUAGE: +InlineClasses + +package kotlin + +annotation class JvmInline + +@JvmInline +value class Test1(val x: Test1) + +@JvmInline +value class Test2A(val x: Test2B) +@JvmInline +value class Test2B(val x: Test2A) + +@JvmInline +value class Test3A(val x: Test3B) +@JvmInline +value class Test3B(val x: Test3C) +@JvmInline +value class Test3C(val x: Test3A) + +@JvmInline +value class TestNullable(val x: TestNullable?) + +@JvmInline +value class TestRecursionInTypeArguments(val x: List) + +@JvmInline +value class TestRecursionInArray(val x: Array) + +@JvmInline +value class TestRecursionInUpperBounds>(val x: T) + +@JvmInline +value class Id(val x: T) +@JvmInline +value class TestRecursionThroughId(val x: Id) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.txt b/compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.txt new file mode 100644 index 00000000000..93f9a69949d --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.txt @@ -0,0 +1,107 @@ +package + +package kotlin { + + @kotlin.JvmInline public final value class Id { + public constructor Id(/*0*/ x: T) + public final val x: T + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class Test1 { + public constructor Test1(/*0*/ x: kotlin.Test1) + public final val x: kotlin.Test1 + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class Test2A { + public constructor Test2A(/*0*/ x: kotlin.Test2B) + public final val x: kotlin.Test2B + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class Test2B { + public constructor Test2B(/*0*/ x: kotlin.Test2A) + public final val x: kotlin.Test2A + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class Test3A { + public constructor Test3A(/*0*/ x: kotlin.Test3B) + public final val x: kotlin.Test3B + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class Test3B { + public constructor Test3B(/*0*/ x: kotlin.Test3C) + public final val x: kotlin.Test3C + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class Test3C { + public constructor Test3C(/*0*/ x: kotlin.Test3A) + public final val x: kotlin.Test3A + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class TestNullable { + public constructor TestNullable(/*0*/ x: kotlin.TestNullable?) + public final val x: kotlin.TestNullable? + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class TestRecursionInArray { + public constructor TestRecursionInArray(/*0*/ x: kotlin.Array) + public final val x: kotlin.Array + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class TestRecursionInTypeArguments { + public constructor TestRecursionInTypeArguments(/*0*/ x: kotlin.collections.List) + public final val x: kotlin.collections.List + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class TestRecursionInUpperBounds> { + public constructor TestRecursionInUpperBounds>(/*0*/ x: T) + public final val x: T + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class TestRecursionThroughId { + public constructor TestRecursionThroughId(/*0*/ x: kotlin.Id) + public final val x: kotlin.Id + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.fir.kt new file mode 100644 index 00000000000..c11e22f5d74 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.fir.kt @@ -0,0 +1,54 @@ +// !LANGUAGE: +InlineClasses +// !DIAGNOSTICS: -UNUSED_PARAMETER + +package kotlin + +annotation class JvmInline + +@JvmInline +value class IC1(val x: Any) { + fun box() {} + fun box(x: Any) {} + + fun unbox() {} + fun unbox(x: Any) {} + + override fun equals(other: Any?): Boolean = true + override fun hashCode(): Int = 0 +} + +@JvmInline +value class IC2(val x: Any) { + fun box(x: Any) {} + fun box(): Any = TODO() + + fun unbox(x: Any) {} + fun unbox(): Any = TODO() + + fun equals(my: Any, other: Any): Boolean = true + fun hashCode(a: Any): Int = 0 +} + +@JvmInline +value class IC3(val x: Any) { + fun box(x: Any): Any = TODO() + fun unbox(x: Any): Any = TODO() + + fun equals(): Boolean = true +} + +interface WithBox { + fun box(): String +} + +@JvmInline +value class IC4(val s: String) : WithBox { + override fun box(): String = "" +} + +@JvmInline +value class IC5(val a: String) { + constructor(i: Int) : this(i.toString()) { + TODO("something") + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.kt b/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.kt new file mode 100644 index 00000000000..2ed4dabb480 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.kt @@ -0,0 +1,54 @@ +// !LANGUAGE: +InlineClasses +// !DIAGNOSTICS: -UNUSED_PARAMETER + +package kotlin + +annotation class JvmInline + +@JvmInline +value class IC1(val x: Any) { + fun box() {} + fun box(x: Any) {} + + fun unbox() {} + fun unbox(x: Any) {} + + override fun equals(other: Any?): Boolean = true + override fun hashCode(): Int = 0 +} + +@JvmInline +value class IC2(val x: Any) { + fun box(x: Any) {} + fun box(): Any = TODO() + + fun unbox(x: Any) {} + fun unbox(): Any = TODO() + + fun equals(my: Any, other: Any): Boolean = true + fun hashCode(a: Any): Int = 0 +} + +@JvmInline +value class IC3(val x: Any) { + fun box(x: Any): Any = TODO() + fun unbox(x: Any): Any = TODO() + + fun equals(): Boolean = true +} + +interface WithBox { + fun box(): String +} + +@JvmInline +value class IC4(val s: String) : WithBox { + override fun box(): String = "" +} + +@JvmInline +value class IC5(val a: String) { + constructor(i: Int) : this(i.toString()) { + TODO("something") + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.txt b/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.txt new file mode 100644 index 00000000000..98b1db49c3e --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.txt @@ -0,0 +1,73 @@ +package + +package kotlin { + + @kotlin.JvmInline public final value class IC1 { + public constructor IC1(/*0*/ x: kotlin.Any) + public final val x: kotlin.Any + public final fun box(): kotlin.Unit + public final fun box(/*0*/ x: kotlin.Any): kotlin.Unit + public open override /*1*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + public final fun unbox(): kotlin.Unit + public final fun unbox(/*0*/ x: kotlin.Any): kotlin.Unit + } + + @kotlin.JvmInline public final value class IC2 { + public constructor IC2(/*0*/ x: kotlin.Any) + public final val x: kotlin.Any + public final fun box(): kotlin.Any + public final fun box(/*0*/ x: kotlin.Any): kotlin.Unit + public final fun equals(/*0*/ my: kotlin.Any, /*1*/ other: kotlin.Any): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public final fun hashCode(/*0*/ a: kotlin.Any): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + public final fun unbox(): kotlin.Any + public final fun unbox(/*0*/ x: kotlin.Any): kotlin.Unit + } + + @kotlin.JvmInline public final value class IC3 { + public constructor IC3(/*0*/ x: kotlin.Any) + public final val x: kotlin.Any + public final fun box(/*0*/ x: kotlin.Any): kotlin.Any + public final fun equals(): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + public final fun unbox(/*0*/ x: kotlin.Any): kotlin.Any + } + + @kotlin.JvmInline public final value class IC4 : kotlin.WithBox { + public constructor IC4(/*0*/ s: kotlin.String) + public final val s: kotlin.String + public open override /*1*/ fun box(): kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class IC5 { + public constructor IC5(/*0*/ i: kotlin.Int) + public constructor IC5(/*0*/ a: kotlin.String) + public final val a: kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public interface WithBox { + public abstract fun box(): kotlin.String + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/unsignedLiteralsWithoutArtifactOnClasspath.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/unsignedLiteralsWithoutArtifactOnClasspath.fir.kt new file mode 100644 index 00000000000..7fa08d2d9a9 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/unsignedLiteralsWithoutArtifactOnClasspath.fir.kt @@ -0,0 +1,3 @@ +val u1 = 1u +val u2 = 0xFu +val u3 = 0b1u \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/unsignedLiteralsWithoutArtifactOnClasspath.kt b/compiler/testData/diagnostics/tests/valueClasses/unsignedLiteralsWithoutArtifactOnClasspath.kt new file mode 100644 index 00000000000..6cf80093333 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/unsignedLiteralsWithoutArtifactOnClasspath.kt @@ -0,0 +1,3 @@ +val u1 = 1u +val u2 = 0xFu +val u3 = 0b1u \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/unsignedLiteralsWithoutArtifactOnClasspath.txt b/compiler/testData/diagnostics/tests/valueClasses/unsignedLiteralsWithoutArtifactOnClasspath.txt new file mode 100644 index 00000000000..1fd389d53fc --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/unsignedLiteralsWithoutArtifactOnClasspath.txt @@ -0,0 +1,5 @@ +package + +public val u1: [ERROR : Type cannot be resolved. Please make sure you have the required dependencies for unsigned types in the classpath] +public val u2: [ERROR : Type cannot be resolved. Please make sure you have the required dependencies for unsigned types in the classpath] +public val u3: [ERROR : Type cannot be resolved. Please make sure you have the required dependencies for unsigned types in the classpath] diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.fir.kt new file mode 100644 index 00000000000..ff6b14e35cc --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.fir.kt @@ -0,0 +1,20 @@ +// !LANGUAGE: +InlineClasses + +package kotlin + +annotation class JvmInline + +abstract class AbstractBaseClass + +open class OpenBaseClass + +interface BaseInterface + +@JvmInline +value class TestExtendsAbstractClass(val x: Int) : AbstractBaseClass() + +@JvmInline +value class TestExtendsOpenClass(val x: Int) : OpenBaseClass() + +@JvmInline +value class TestImplementsInterface(val x: Int) : BaseInterface \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.kt new file mode 100644 index 00000000000..13ed4fd19ef --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.kt @@ -0,0 +1,20 @@ +// !LANGUAGE: +InlineClasses + +package kotlin + +annotation class JvmInline + +abstract class AbstractBaseClass + +open class OpenBaseClass + +interface BaseInterface + +@JvmInline +value class TestExtendsAbstractClass(val x: Int) : AbstractBaseClass() + +@JvmInline +value class TestExtendsOpenClass(val x: Int) : OpenBaseClass() + +@JvmInline +value class TestImplementsInterface(val x: Int) : BaseInterface \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.txt b/compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.txt new file mode 100644 index 00000000000..3181cf577a7 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.txt @@ -0,0 +1,55 @@ +package + +package kotlin { + + public abstract class AbstractBaseClass { + public constructor AbstractBaseClass() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public interface BaseInterface { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public open class OpenBaseClass { + public constructor OpenBaseClass() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class TestExtendsAbstractClass : kotlin.AbstractBaseClass { + public constructor TestExtendsAbstractClass(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class TestExtendsOpenClass : kotlin.OpenBaseClass { + public constructor TestExtendsOpenClass(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class TestImplementsInterface : kotlin.BaseInterface { + public constructor TestImplementsInterface(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.fir.kt new file mode 100644 index 00000000000..d9de10fe6a5 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.fir.kt @@ -0,0 +1,15 @@ +// !LANGUAGE: +InlineClasses + +package kotlin + +annotation class JvmInline + +interface IFoo + +object FooImpl : IFoo + +@JvmInline +value class Test1(val x: Any) : IFoo by FooImpl + +@JvmInline +value class Test2(val x: IFoo) : IFoo by x \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.kt new file mode 100644 index 00000000000..83112d8e629 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.kt @@ -0,0 +1,15 @@ +// !LANGUAGE: +InlineClasses + +package kotlin + +annotation class JvmInline + +interface IFoo + +object FooImpl : IFoo + +@JvmInline +value class Test1(val x: Any) : IFoo by FooImpl + +@JvmInline +value class Test2(val x: IFoo) : IFoo by x \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.txt b/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.txt new file mode 100644 index 00000000000..5fae056825c --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.txt @@ -0,0 +1,40 @@ +package + +package kotlin { + + public object FooImpl : kotlin.IFoo { + private constructor FooImpl() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public interface IFoo { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class Test1 : kotlin.IFoo { + public constructor Test1(/*0*/ x: kotlin.Any) + public final val x: kotlin.Any + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class Test2 : kotlin.IFoo { + public constructor Test2(/*0*/ x: kotlin.IFoo) + public final val x: kotlin.IFoo + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassConstructorParameterWithDefaultValue.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassConstructorParameterWithDefaultValue.kt new file mode 100644 index 00000000000..7e47e5845c1 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassConstructorParameterWithDefaultValue.kt @@ -0,0 +1,9 @@ +// FIR_IDENTICAL +// !LANGUAGE: +InlineClasses + +package kotlin + +annotation class JvmInline + +@JvmInline +value class Test(val x: Int = 42) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassConstructorParameterWithDefaultValue.txt b/compiler/testData/diagnostics/tests/valueClasses/valueClassConstructorParameterWithDefaultValue.txt new file mode 100644 index 00000000000..53b09dfce5f --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassConstructorParameterWithDefaultValue.txt @@ -0,0 +1,19 @@ +package + +package kotlin { + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class Test { + public constructor Test(/*0*/ x: kotlin.Int = ...) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.fir.kt new file mode 100644 index 00000000000..9586d4bb74b --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.fir.kt @@ -0,0 +1,51 @@ +// !LANGUAGE: +InlineClasses +// !DIAGNOSTICS: -UNUSED_PARAMETER + +package kotlin + +annotation class JvmInline + +@JvmInline +value class A0(val x: Int) + +@JvmInline +value class A1 +@JvmInline +value class A2() +@JvmInline +value class A3(x: Int) +@JvmInline +value class A4(var x: Int) +@JvmInline +value class A5(val x: Int, val y: Int) +@JvmInline +value class A6(x: Int, val y: Int) +@JvmInline +value class A7(vararg val x: Int) +@JvmInline +value class A8(open val x: Int) +@JvmInline +value class A9(final val x: Int) + +class B1 { + companion object { + @JvmInline + value class C1(val x: Int) + } + + @JvmInline + value class C2(val x: Int) +} + +object B2 { + @JvmInline + value class C3(val x: Int) +} + +@JvmInline +final value class D0(val x: Int) +open value class D1(val x: Int) +abstract value class D2(val x: Int) +sealed value class D3(val x: Int) + +value data class D4(val x: String) diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt new file mode 100644 index 00000000000..8a46844bd79 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt @@ -0,0 +1,51 @@ +// !LANGUAGE: +InlineClasses +// !DIAGNOSTICS: -UNUSED_PARAMETER + +package kotlin + +annotation class JvmInline + +@JvmInline +value class A0(val x: Int) + +@JvmInline +value class A1 +@JvmInline +value class A2() +@JvmInline +value class A3(x: Int) +@JvmInline +value class A4(var x: Int) +@JvmInline +value class A5(val x: Int, val y: Int) +@JvmInline +value class A6(x: Int, val y: Int) +@JvmInline +value class A7(vararg val x: Int) +@JvmInline +value class A8(open val x: Int) +@JvmInline +value class A9(final val x: Int) + +class B1 { + companion object { + @JvmInline + value class C1(val x: Int) + } + + @JvmInline + value class C2(val x: Int) +} + +object B2 { + @JvmInline + value class C3(val x: Int) +} + +@JvmInline +final value class D0(val x: Int) +open value class D1(val x: Int) +abstract value class D2(val x: Int) +sealed value class D3(val x: Int) + +value data class D4(val x: String) diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.txt b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.txt new file mode 100644 index 00000000000..f0504130aaf --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.txt @@ -0,0 +1,176 @@ +package + +package kotlin { + + @kotlin.JvmInline public final value class A0 { + public constructor A0(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class A1 { + public constructor A1() + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class A2 { + public constructor A2() + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class A3 { + public constructor A3(/*0*/ x: kotlin.Int) + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class A4 { + public constructor A4(/*0*/ x: kotlin.Int) + public final var x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class A5 { + public constructor A5(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int) + public final val x: kotlin.Int + public final val y: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class A6 { + public constructor A6(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int) + public final val y: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class A7 { + public constructor A7(/*0*/ vararg x: kotlin.Int /*kotlin.IntArray*/) + public final val x: kotlin.IntArray + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class A8 { + public constructor A8(/*0*/ x: kotlin.Int) + public open val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class A9 { + public constructor A9(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final class B1 { + public constructor B1() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + @kotlin.JvmInline public final value class C2 { + public constructor C2(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public companion object Companion { + private constructor Companion() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + @kotlin.JvmInline public final value class C1 { + public constructor C1(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + } + } + + public object B2 { + private constructor B2() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + @kotlin.JvmInline public final value class C3 { + public constructor C3(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + } + + @kotlin.JvmInline public final value class D0 { + public constructor D0(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public open value class D1 { + public constructor D1(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public abstract value class D2 { + public constructor D2(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public sealed value class D3 { + private constructor D3(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final data value class D4 { + public constructor D4(/*0*/ x: kotlin.String) + public final val x: kotlin.String + public final operator /*synthesized*/ fun component1(): kotlin.String + public final /*synthesized*/ fun copy(/*0*/ x: kotlin.String = ...): kotlin.D4 + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassImplementsCollection.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassImplementsCollection.kt new file mode 100644 index 00000000000..3b6e1a34a79 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassImplementsCollection.kt @@ -0,0 +1,19 @@ +// FIR_IDENTICAL +// !LANGUAGE: +InlineClasses + +package kotlin + +annotation class JvmInline + +@JvmInline +value class UInt(val x: Int) + +@JvmInline +value class UIntArray(private val storage: IntArray) : Collection { + public override val size: Int get() = storage.size + + override operator fun iterator() = TODO() + override fun contains(element: UInt): Boolean = TODO() + override fun containsAll(elements: Collection): Boolean = TODO() + override fun isEmpty(): Boolean = TODO() +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassImplementsCollection.txt b/compiler/testData/diagnostics/tests/valueClasses/valueClassImplementsCollection.txt new file mode 100644 index 00000000000..c5054c4d4f1 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassImplementsCollection.txt @@ -0,0 +1,32 @@ +package + +package kotlin { + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class UInt { + public constructor UInt(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class UIntArray : kotlin.collections.Collection { + public constructor UIntArray(/*0*/ storage: kotlin.IntArray) + public open override /*1*/ val size: kotlin.Int + private final val storage: kotlin.IntArray + public open override /*1*/ fun contains(/*0*/ element: kotlin.UInt): kotlin.Boolean + public open override /*1*/ fun containsAll(/*0*/ elements: kotlin.collections.Collection): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ fun isEmpty(): kotlin.Boolean + public open override /*1*/ fun iterator(): kotlin.Nothing + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.fir.kt new file mode 100644 index 00000000000..8b21a794cb7 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.fir.kt @@ -0,0 +1,30 @@ +// !LANGUAGE: +InlineClasses + +package kotlin + +annotation class JvmInline + +@JvmInline +value class Foo(val x: T) +@JvmInline +value class FooNullable(val x: T?) + +@JvmInline +value class FooGenericArray(val x: Array) +@JvmInline +value class FooGenericArray2(val x: Array>) + +@JvmInline +value class FooStarProjectedArray(val x: Array<*>) +@JvmInline +value class FooStarProjectedArray2(val x: Array>) + +@JvmInline +value class Bar(val u: Unit) +@JvmInline +value class BarNullable(val u: Unit?) + +@JvmInline +value class Baz(val u: Nothing) +@JvmInline +value class BazNullable(val u: Nothing?) diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.kt new file mode 100644 index 00000000000..c29a59d547f --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.kt @@ -0,0 +1,30 @@ +// !LANGUAGE: +InlineClasses + +package kotlin + +annotation class JvmInline + +@JvmInline +value class Foo(val x: T) +@JvmInline +value class FooNullable(val x: T?) + +@JvmInline +value class FooGenericArray(val x: Array) +@JvmInline +value class FooGenericArray2(val x: Array>) + +@JvmInline +value class FooStarProjectedArray(val x: Array<*>) +@JvmInline +value class FooStarProjectedArray2(val x: Array>) + +@JvmInline +value class Bar(val u: Unit) +@JvmInline +value class BarNullable(val u: Unit?) + +@JvmInline +value class Baz(val u: Nothing) +@JvmInline +value class BazNullable(val u: Nothing?) diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.txt b/compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.txt new file mode 100644 index 00000000000..22b80d4b1e2 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.txt @@ -0,0 +1,91 @@ +package + +package kotlin { + + @kotlin.JvmInline public final value class Bar { + public constructor Bar(/*0*/ u: kotlin.Unit) + public final val u: kotlin.Unit + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class BarNullable { + public constructor BarNullable(/*0*/ u: kotlin.Unit?) + public final val u: kotlin.Unit? + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class Baz { + public constructor Baz(/*0*/ u: kotlin.Nothing) + public final val u: kotlin.Nothing + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class BazNullable { + public constructor BazNullable(/*0*/ u: kotlin.Nothing?) + public final val u: kotlin.Nothing? + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class Foo { + public constructor Foo(/*0*/ x: T) + public final val x: T + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class FooGenericArray { + public constructor FooGenericArray(/*0*/ x: kotlin.Array) + public final val x: kotlin.Array + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class FooGenericArray2 { + public constructor FooGenericArray2(/*0*/ x: kotlin.Array>) + public final val x: kotlin.Array> + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class FooNullable { + public constructor FooNullable(/*0*/ x: T?) + public final val x: T? + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class FooStarProjectedArray { + public constructor FooStarProjectedArray(/*0*/ x: kotlin.Array<*>) + public final val x: kotlin.Array<*> + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class FooStarProjectedArray2 { + public constructor FooStarProjectedArray2(/*0*/ x: kotlin.Array>) + public final val x: kotlin.Array> + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.fir.kt new file mode 100644 index 00000000000..29a43c81ef1 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.fir.kt @@ -0,0 +1,18 @@ +// !LANGUAGE: +InlineClasses + +package kotlin + +import kotlin.reflect.KClass + +annotation class JvmInline + +@JvmInline +value class MyInt(val x: Int) +@JvmInline +value class MyString(val x: String) + +annotation class Ann1(val a: MyInt) +annotation class Ann2(val a: Array) +annotation class Ann3(vararg val a: MyInt) + +annotation class Ann4(val a: KClass) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.kt new file mode 100644 index 00000000000..efcd653369d --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.kt @@ -0,0 +1,18 @@ +// !LANGUAGE: +InlineClasses + +package kotlin + +import kotlin.reflect.KClass + +annotation class JvmInline + +@JvmInline +value class MyInt(val x: Int) +@JvmInline +value class MyString(val x: String) + +annotation class Ann1(val a: MyInt) +annotation class Ann2(val a: Array) +annotation class Ann3(vararg val a: MyInt) + +annotation class Ann4(val a: KClass) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.txt b/compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.txt new file mode 100644 index 00000000000..3cf8b5549cb --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.txt @@ -0,0 +1,59 @@ +package + +package kotlin { + + public final annotation class Ann1 : kotlin.Annotation { + public constructor Ann1(/*0*/ a: kotlin.MyInt) + public final val a: kotlin.MyInt + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final annotation class Ann2 : kotlin.Annotation { + public constructor Ann2(/*0*/ a: kotlin.Array) + public final val a: kotlin.Array + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final annotation class Ann3 : kotlin.Annotation { + public constructor Ann3(/*0*/ vararg a: kotlin.MyInt /*kotlin.Array*/) + public final val a: kotlin.Array + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final annotation class Ann4 : kotlin.Annotation { + public constructor Ann4(/*0*/ a: kotlin.reflect.KClass) + public final val a: kotlin.reflect.KClass + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class MyInt { + public constructor MyInt(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class MyString { + public constructor MyString(/*0*/ x: kotlin.String) + public final val x: kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.fir.kt new file mode 100644 index 00000000000..8347b2f9779 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.fir.kt @@ -0,0 +1,26 @@ +// !LANGUAGE: +InlineClasses +// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE, -UNUSED_ANONYMOUS_PARAMETER + +package kotlin + +annotation class JvmInline + +@JvmInline +value class Foo(val x: Int) + +fun f1(vararg a: Foo) {} +fun f2(vararg a: Foo?) {} + +class A { + fun f3(a0: Int, vararg a1: Foo) { + fun f4(vararg a: Foo) {} + + val g = fun (vararg v: Foo) {} + } +} + +class B(vararg val s: Foo) { + constructor(a: Int, vararg s: Foo) : this(*s) +} + +annotation class Ann(vararg val f: Foo) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.kt b/compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.kt new file mode 100644 index 00000000000..56af413cbbd --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.kt @@ -0,0 +1,26 @@ +// !LANGUAGE: +InlineClasses +// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE, -UNUSED_ANONYMOUS_PARAMETER + +package kotlin + +annotation class JvmInline + +@JvmInline +value class Foo(val x: Int) + +fun f1(vararg a: Foo) {} +fun f2(vararg a: Foo?) {} + +class A { + fun f3(a0: Int, vararg a1: Foo) { + fun f4(vararg a: Foo) {} + + val g = fun (vararg v: Foo) {} + } +} + +class B(vararg val s: Foo) { + constructor(a: Int, vararg s: Foo) : this(*s) +} + +annotation class Ann(vararg val f: Foo) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.txt b/compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.txt new file mode 100644 index 00000000000..3577155821f --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.txt @@ -0,0 +1,46 @@ +package + +package kotlin { + public fun f1(/*0*/ vararg a: kotlin.Foo /*kotlin.Array*/): kotlin.Unit + public fun f2(/*0*/ vararg a: kotlin.Foo? /*kotlin.Array*/): kotlin.Unit + + public final class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final fun f3(/*0*/ a0: kotlin.Int, /*1*/ vararg a1: kotlin.Foo /*kotlin.Array*/): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final annotation class Ann : kotlin.Annotation { + public constructor Ann(/*0*/ vararg f: kotlin.Foo /*kotlin.Array*/) + public final val f: kotlin.Array + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final class B { + public constructor B(/*0*/ vararg s: kotlin.Foo /*kotlin.Array*/) + public constructor B(/*0*/ a: kotlin.Int, /*1*/ vararg s: kotlin.Foo /*kotlin.Array*/) + public final val s: kotlin.Array + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class Foo { + public constructor Foo(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 1da5d58a8a7..6123ea0f4dd 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -25050,6 +25050,129 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali } } + @TestMetadata("compiler/testData/diagnostics/tests/valueClasses") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ValueClasses extends AbstractDiagnosticsTestWithFirValidation { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInValueClasses() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/valueClasses"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("basicValueClassDeclaration.kt") + public void testBasicValueClassDeclaration() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.kt"); + } + + @TestMetadata("basicValueClassDeclarationDisabled.kt") + public void testBasicValueClassDeclarationDisabled() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.kt"); + } + + @TestMetadata("constructorsJvmSignaturesClash.kt") + public void testConstructorsJvmSignaturesClash() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.kt"); + } + + @TestMetadata("delegatedPropertyInValueClass.kt") + public void testDelegatedPropertyInValueClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.kt"); + } + + @TestMetadata("functionsJvmSignaturesClash.kt") + public void testFunctionsJvmSignaturesClash() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.kt"); + } + + @TestMetadata("functionsJvmSignaturesConflictOnInheritance.kt") + public void testFunctionsJvmSignaturesConflictOnInheritance() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesConflictOnInheritance.kt"); + } + + @TestMetadata("identityComparisonWithValueClasses.kt") + public void testIdentityComparisonWithValueClasses() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.kt"); + } + + @TestMetadata("lateinitValueClasses.kt") + public void testLateinitValueClasses() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.kt"); + } + + @TestMetadata("presenceOfInitializerBlockInsideValueClass.kt") + public void testPresenceOfInitializerBlockInsideValueClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.kt"); + } + + @TestMetadata("presenceOfPublicPrimaryConstructorForValueClass.kt") + public void testPresenceOfPublicPrimaryConstructorForValueClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/presenceOfPublicPrimaryConstructorForValueClass.kt"); + } + + @TestMetadata("propertiesWithBackingFieldsInsideValueClass.kt") + public void testPropertiesWithBackingFieldsInsideValueClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.kt"); + } + + @TestMetadata("recursiveValueClasses.kt") + public void testRecursiveValueClasses() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.kt"); + } + + @TestMetadata("reservedMembersAndConstructsInsideValueClass.kt") + public void testReservedMembersAndConstructsInsideValueClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.kt"); + } + + @TestMetadata("unsignedLiteralsWithoutArtifactOnClasspath.kt") + public void testUnsignedLiteralsWithoutArtifactOnClasspath() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/unsignedLiteralsWithoutArtifactOnClasspath.kt"); + } + + @TestMetadata("valueClassCanOnlyImplementInterfaces.kt") + public void testValueClassCanOnlyImplementInterfaces() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.kt"); + } + + @TestMetadata("valueClassCannotImplementInterfaceByDelegation.kt") + public void testValueClassCannotImplementInterfaceByDelegation() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.kt"); + } + + @TestMetadata("valueClassConstructorParameterWithDefaultValue.kt") + public void testValueClassConstructorParameterWithDefaultValue() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassConstructorParameterWithDefaultValue.kt"); + } + + @TestMetadata("valueClassDeclarationCheck.kt") + public void testValueClassDeclarationCheck() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt"); + } + + @TestMetadata("valueClassImplementsCollection.kt") + public void testValueClassImplementsCollection() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassImplementsCollection.kt"); + } + + @TestMetadata("valueClassWithForbiddenUnderlyingType.kt") + public void testValueClassWithForbiddenUnderlyingType() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.kt"); + } + + @TestMetadata("valueClassesInsideAnnotations.kt") + public void testValueClassesInsideAnnotations() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.kt"); + } + + @TestMetadata("varargsOnParametersOfValueClassType.kt") + public void testVarargsOnParametersOfValueClassType() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.kt"); + } + } + @TestMetadata("compiler/testData/diagnostics/tests/varargs") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java index 2268109725c..31bdfd1493b 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java @@ -24970,6 +24970,129 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing } } + @TestMetadata("compiler/testData/diagnostics/tests/valueClasses") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ValueClasses extends AbstractDiagnosticsUsingJavacTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInValueClasses() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/valueClasses"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("basicValueClassDeclaration.kt") + public void testBasicValueClassDeclaration() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.kt"); + } + + @TestMetadata("basicValueClassDeclarationDisabled.kt") + public void testBasicValueClassDeclarationDisabled() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.kt"); + } + + @TestMetadata("constructorsJvmSignaturesClash.kt") + public void testConstructorsJvmSignaturesClash() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.kt"); + } + + @TestMetadata("delegatedPropertyInValueClass.kt") + public void testDelegatedPropertyInValueClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.kt"); + } + + @TestMetadata("functionsJvmSignaturesClash.kt") + public void testFunctionsJvmSignaturesClash() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.kt"); + } + + @TestMetadata("functionsJvmSignaturesConflictOnInheritance.kt") + public void testFunctionsJvmSignaturesConflictOnInheritance() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesConflictOnInheritance.kt"); + } + + @TestMetadata("identityComparisonWithValueClasses.kt") + public void testIdentityComparisonWithValueClasses() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.kt"); + } + + @TestMetadata("lateinitValueClasses.kt") + public void testLateinitValueClasses() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.kt"); + } + + @TestMetadata("presenceOfInitializerBlockInsideValueClass.kt") + public void testPresenceOfInitializerBlockInsideValueClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.kt"); + } + + @TestMetadata("presenceOfPublicPrimaryConstructorForValueClass.kt") + public void testPresenceOfPublicPrimaryConstructorForValueClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/presenceOfPublicPrimaryConstructorForValueClass.kt"); + } + + @TestMetadata("propertiesWithBackingFieldsInsideValueClass.kt") + public void testPropertiesWithBackingFieldsInsideValueClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.kt"); + } + + @TestMetadata("recursiveValueClasses.kt") + public void testRecursiveValueClasses() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.kt"); + } + + @TestMetadata("reservedMembersAndConstructsInsideValueClass.kt") + public void testReservedMembersAndConstructsInsideValueClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.kt"); + } + + @TestMetadata("unsignedLiteralsWithoutArtifactOnClasspath.kt") + public void testUnsignedLiteralsWithoutArtifactOnClasspath() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/unsignedLiteralsWithoutArtifactOnClasspath.kt"); + } + + @TestMetadata("valueClassCanOnlyImplementInterfaces.kt") + public void testValueClassCanOnlyImplementInterfaces() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.kt"); + } + + @TestMetadata("valueClassCannotImplementInterfaceByDelegation.kt") + public void testValueClassCannotImplementInterfaceByDelegation() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.kt"); + } + + @TestMetadata("valueClassConstructorParameterWithDefaultValue.kt") + public void testValueClassConstructorParameterWithDefaultValue() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassConstructorParameterWithDefaultValue.kt"); + } + + @TestMetadata("valueClassDeclarationCheck.kt") + public void testValueClassDeclarationCheck() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt"); + } + + @TestMetadata("valueClassImplementsCollection.kt") + public void testValueClassImplementsCollection() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassImplementsCollection.kt"); + } + + @TestMetadata("valueClassWithForbiddenUnderlyingType.kt") + public void testValueClassWithForbiddenUnderlyingType() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.kt"); + } + + @TestMetadata("valueClassesInsideAnnotations.kt") + public void testValueClassesInsideAnnotations() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.kt"); + } + + @TestMetadata("varargsOnParametersOfValueClassType.kt") + public void testVarargsOnParametersOfValueClassType() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.kt"); + } + } + @TestMetadata("compiler/testData/diagnostics/tests/varargs") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/kotlin/descriptorBasedTypeSignatureMapping.kt b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/kotlin/descriptorBasedTypeSignatureMapping.kt index fbb9379f43d..20ccce78da1 100644 --- a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/kotlin/descriptorBasedTypeSignatureMapping.kt +++ b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/kotlin/descriptorBasedTypeSignatureMapping.kt @@ -10,6 +10,7 @@ import org.jetbrains.kotlin.builtins.isSuspendFunctionType import org.jetbrains.kotlin.builtins.transformSuspendFunctionToRuntimeFunctionType import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.name.SpecialNames +import org.jetbrains.kotlin.resolve.isInlineClass import org.jetbrains.kotlin.types.* import org.jetbrains.kotlin.types.checker.SimpleClassicTypeSystemContext import org.jetbrains.kotlin.types.typeUtil.replaceArgumentsWithStarProjections @@ -115,7 +116,7 @@ fun mapType( descriptor is ClassDescriptor -> { // NB if inline class is recursive, it's ok to map it as wrapped - if (descriptor.isInline && !mode.needInlineClassWrapping) { + if (descriptor.isInlineClass() && !mode.needInlineClassWrapping) { val expandedType = SimpleClassicTypeSystemContext.computeExpandedTypeForInlineClass(kotlinType) as KotlinType? if (expandedType != null) { return mapType( diff --git a/core/descriptors.jvm/src/org/jetbrains/kotlin/resolve/jvm/inlineClassManglingRules.kt b/core/descriptors.jvm/src/org/jetbrains/kotlin/resolve/jvm/inlineClassManglingRules.kt index 5bcb0f201c7..eaa3b5c795f 100644 --- a/core/descriptors.jvm/src/org/jetbrains/kotlin/resolve/jvm/inlineClassManglingRules.kt +++ b/core/descriptors.jvm/src/org/jetbrains/kotlin/resolve/jvm/inlineClassManglingRules.kt @@ -17,7 +17,7 @@ import org.jetbrains.kotlin.types.typeUtil.representativeUpperBound fun shouldHideConstructorDueToInlineClassTypeValueParameters(descriptor: CallableMemberDescriptor): Boolean { val constructorDescriptor = descriptor as? ClassConstructorDescriptor ?: return false if (DescriptorVisibilities.isPrivate(constructorDescriptor.visibility)) return false - if (constructorDescriptor.constructedClass.isInline) return false + if (constructorDescriptor.constructedClass.isInlineClass()) return false if (DescriptorUtils.isSealedClass(constructorDescriptor.constructedClass)) return false // TODO inner class in inline class diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.kt index 8aa1898dd6b..d88800d8032 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.kt @@ -24,6 +24,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.DescriptorUtils.getContainingClass import org.jetbrains.kotlin.resolve.constants.ConstantValue import org.jetbrains.kotlin.resolve.constants.EnumValue +import org.jetbrains.kotlin.resolve.isInlineClass import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter import org.jetbrains.kotlin.resolve.scopes.MemberScope import org.jetbrains.kotlin.types.KotlinType @@ -445,7 +446,7 @@ fun DeclarationDescriptor.isAnnotationConstructor(): Boolean = this is ConstructorDescriptor && DescriptorUtils.isAnnotationClass(this.constructedClass) fun DeclarationDescriptor.isPrimaryConstructorOfInlineClass(): Boolean = - this is ConstructorDescriptor && this.isPrimary && this.constructedClass.isInline + this is ConstructorDescriptor && this.isPrimary && this.constructedClass.isInlineClass() @TypeRefinement fun ModuleDescriptor.getKotlinTypeRefiner(): KotlinTypeRefiner = getCapability(REFINER_CAPABILITY)?.value ?: KotlinTypeRefiner.Default diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/inlineClassesUtils.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/inlineClassesUtils.kt index 2c3a5bf9ea6..fb2622039a3 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/inlineClassesUtils.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/inlineClassesUtils.kt @@ -6,18 +6,23 @@ package org.jetbrains.kotlin.resolve import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.TypeSubstitutor import org.jetbrains.kotlin.types.TypeUtils import org.jetbrains.kotlin.types.Variance import org.jetbrains.kotlin.utils.addToStdlib.safeAs +val JVM_INLINE_ANNOTATION = FqName("kotlin.JvmInline") + fun ClassDescriptor.underlyingRepresentation(): ValueParameterDescriptor? { - if (!isInline) return null + if (!isInlineClass()) return null return unsubstitutedPrimaryConstructor?.valueParameters?.singleOrNull() } -fun DeclarationDescriptor.isInlineClass() = this is ClassDescriptor && this.isInline +// FIXME: DeserializedClassDescriptor in reflection do not have @JvmInline annotation, that we +// FIXME: would like to check as well. +fun DeclarationDescriptor.isInlineClass() = this is ClassDescriptor && (isInline || isValue) fun KotlinType.unsubstitutedUnderlyingParameter(): ValueParameterDescriptor? { return constructor.declarationDescriptor.safeAs()?.underlyingRepresentation() diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/checker/ClassicTypeSystemContext.kt b/core/descriptors/src/org/jetbrains/kotlin/types/checker/ClassicTypeSystemContext.kt index 3c213927a07..d424fe9d778 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/checker/ClassicTypeSystemContext.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/types/checker/ClassicTypeSystemContext.kt @@ -20,6 +20,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe import org.jetbrains.kotlin.resolve.descriptorUtil.hasExactAnnotation import org.jetbrains.kotlin.resolve.descriptorUtil.hasNoInferAnnotation import org.jetbrains.kotlin.resolve.descriptorUtil.isExactAnnotation +import org.jetbrains.kotlin.resolve.isInlineClass import org.jetbrains.kotlin.resolve.substitutedUnderlyingType import org.jetbrains.kotlin.types.* import org.jetbrains.kotlin.types.model.* @@ -599,7 +600,7 @@ interface ClassicTypeSystemContext : TypeSystemInferenceExtensionContext, TypeSy override fun TypeConstructorMarker.isInlineClass(): Boolean { require(this is TypeConstructor, this::errorMessage) - return (declarationDescriptor as? ClassDescriptor)?.isInline == true + return (declarationDescriptor as? ClassDescriptor)?.isInlineClass() == true } override fun TypeConstructorMarker.isInnerClass(): Boolean { diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/calls/InlineClassAwareCaller.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/calls/InlineClassAwareCaller.kt index 6e3187ec6fa..b31061c7e97 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/calls/InlineClassAwareCaller.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/calls/InlineClassAwareCaller.kt @@ -90,7 +90,7 @@ internal class InlineClassAwareCaller( } } else { val containingDeclaration = descriptor.containingDeclaration - if (containingDeclaration is ClassDescriptor && containingDeclaration.isInline) { + if (containingDeclaration is ClassDescriptor && containingDeclaration.isInlineClass()) { kotlinParameterTypes.add(containingDeclaration.defaultType) } } @@ -180,7 +180,7 @@ internal fun KotlinType.toInlineClass(): Class<*>? = constructor.declarationDescriptor.toInlineClass() internal fun DeclarationDescriptor?.toInlineClass(): Class<*>? = - if (this is ClassDescriptor && isInline) + if (this is ClassDescriptor && isInlineClass()) toJavaClass() ?: throw KotlinReflectionInternalError("Class object for the class $name cannot be found (classId=$classId)") else null diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/quickfix/TypeAccessibilityCheckerImpl.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/quickfix/TypeAccessibilityCheckerImpl.kt index 41ef465cefd..c4289813b0a 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/quickfix/TypeAccessibilityCheckerImpl.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/quickfix/TypeAccessibilityCheckerImpl.kt @@ -20,6 +20,7 @@ import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.psi.KtNamedDeclaration import org.jetbrains.kotlin.psi.KtTypeParameter import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameOrNull +import org.jetbrains.kotlin.resolve.isInlineClass import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.TypeProjection import org.jetbrains.kotlin.types.isError @@ -101,7 +102,7 @@ private fun DeclarationDescriptor.collectAllTypes(): Sequence { return when (this) { is ClassConstructorDescriptor -> valueParameters.asSequence().map(ValueParameterDescriptor::getType) .flatMap(KotlinType::collectAllTypes) - is ClassDescriptor -> if (isInline) unsubstitutedPrimaryConstructor?.collectAllTypes().orEmpty() else { + is ClassDescriptor -> if (isInlineClass()) unsubstitutedPrimaryConstructor?.collectAllTypes().orEmpty() else { emptySequence() } + declaredTypeParameters.asSequence().flatMap(DeclarationDescriptor::collectAllTypes) + sequenceOf(fqNameOrNull()) is CallableDescriptor -> { diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/overrideImplement/OverrideMemberChooserObject.kt b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/overrideImplement/OverrideMemberChooserObject.kt index 50e487937e1..fa616c801f3 100644 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/overrideImplement/OverrideMemberChooserObject.kt +++ b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/overrideImplement/OverrideMemberChooserObject.kt @@ -144,7 +144,7 @@ fun OverrideMemberChooserObject.generateMember( val renderer = baseRenderer.withOptions { if (descriptor is ClassConstructorDescriptor && descriptor.isPrimary) { val containingClass = descriptor.containingDeclaration - if (containingClass.kind == ClassKind.ANNOTATION_CLASS || containingClass.isInline) { + if (containingClass.kind == ClassKind.ANNOTATION_CLASS || containingClass.isInline || containingClass.isValue) { renderPrimaryConstructorParametersAsProperties = true } } diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedSymbolInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedSymbolInspection.kt index 0729e666794..72bef5a1d29 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedSymbolInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedSymbolInspection.kt @@ -76,6 +76,7 @@ import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.bindingContextUtil.isUsedAsExpression import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe +import org.jetbrains.kotlin.resolve.isInlineClass import org.jetbrains.kotlin.resolve.isInlineClassType import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode import org.jetbrains.kotlin.util.findCallableMemberBySignature @@ -513,7 +514,7 @@ class UnusedSymbolInspection : AbstractKotlinInspection() { return when { descriptor is ConstructorDescriptor -> { val classDescriptor = descriptor.constructedClass - !classDescriptor.isInline && classDescriptor.visibility != DescriptorVisibilities.LOCAL + !classDescriptor.isInlineClass() && classDescriptor.visibility != DescriptorVisibilities.LOCAL } hasModifier(KtTokens.INTERNAL_KEYWORD) -> false descriptor !is FunctionDescriptor -> true diff --git a/js/js.frontend/src/org/jetbrains/kotlin/js/resolve/diagnostics/JsExternalChecker.kt b/js/js.frontend/src/org/jetbrains/kotlin/js/resolve/diagnostics/JsExternalChecker.kt index fa85d32bb04..837a7de21b6 100644 --- a/js/js.frontend/src/org/jetbrains/kotlin/js/resolve/diagnostics/JsExternalChecker.kt +++ b/js/js.frontend/src/org/jetbrains/kotlin/js/resolve/diagnostics/JsExternalChecker.kt @@ -44,6 +44,7 @@ object JsExternalChecker : DeclarationChecker { descriptor.isData -> "data class" descriptor.isInner -> "inner class" descriptor.isInline -> "inline class" + descriptor.isValue -> "value class" descriptor.isFun -> "fun interface" DescriptorUtils.isAnnotationClass(descriptor) -> "annotation class" else -> null diff --git a/js/js.translator/src/org/jetbrains/kotlin/js/translate/declaration/ClassTranslator.kt b/js/js.translator/src/org/jetbrains/kotlin/js/translate/declaration/ClassTranslator.kt index de0c9a7484b..8f3a1dfd252 100644 --- a/js/js.translator/src/org/jetbrains/kotlin/js/translate/declaration/ClassTranslator.kt +++ b/js/js.translator/src/org/jetbrains/kotlin/js/translate/declaration/ClassTranslator.kt @@ -131,7 +131,7 @@ class ClassTranslator private constructor( if (classDeclaration is KtClassOrObject) { when { descriptor.isData -> JsDataClassGenerator(classDeclaration, context).generate() - descriptor.isInline -> JsInlineClassGenerator(classDeclaration, context).generate() + descriptor.isInline || descriptor.isValue -> JsInlineClassGenerator(classDeclaration, context).generate() } } diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirClassFactory.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirClassFactory.kt index 51757cf2e5f..29fb91d6889 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirClassFactory.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirClassFactory.kt @@ -16,6 +16,7 @@ import org.jetbrains.kotlin.descriptors.commonizer.cir.impl.CirClassImpl import org.jetbrains.kotlin.descriptors.commonizer.utils.compactMap import org.jetbrains.kotlin.descriptors.commonizer.utils.intern import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.resolve.isInlineClass object CirClassFactory { fun create(source: ClassDescriptor): CirClass = create( @@ -28,7 +29,7 @@ object CirClassFactory { companion = source.companionObjectDescriptor?.name?.intern(), isCompanion = source.isCompanionObject, isData = source.isData, - isInline = source.isInline, + isInline = source.isInlineClass(), isInner = source.isInner, isExternal = source.isExternal ).apply { diff --git a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/utils/ComparingDeclarationsVisitor.kt b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/utils/ComparingDeclarationsVisitor.kt index ea06101a207..f3777515570 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/utils/ComparingDeclarationsVisitor.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/utils/ComparingDeclarationsVisitor.kt @@ -229,6 +229,7 @@ internal class ComparingDeclarationsVisitor( context.assertFieldsEqual(expected::isCompanionObject, actual::isCompanionObject) context.assertFieldsEqual(expected::isData, actual::isData) context.assertFieldsEqual(expected::isInline, actual::isInline) + context.assertFieldsEqual(expected::isValue, actual::isValue) context.assertFieldsEqual(expected::isInner, actual::isInner) context.assertFieldsEqual(expected::isExternal, actual::isExternal) context.assertFieldsEqual(expected::isExpect, actual::isExpect) diff --git a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/diagnostic/SerializationPluginDeclarationChecker.kt b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/diagnostic/SerializationPluginDeclarationChecker.kt index 40a2b4b9d33..378d047e290 100644 --- a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/diagnostic/SerializationPluginDeclarationChecker.kt +++ b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/diagnostic/SerializationPluginDeclarationChecker.kt @@ -21,6 +21,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperClassOrAny import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperInterfaces import org.jetbrains.kotlin.resolve.descriptorUtil.module import org.jetbrains.kotlin.resolve.hasBackingField +import org.jetbrains.kotlin.resolve.isInlineClass import org.jetbrains.kotlin.resolve.isInlineClassType import org.jetbrains.kotlin.resolve.jvm.annotations.TRANSIENT_ANNOTATION_FQ_NAME import org.jetbrains.kotlin.resolve.lazy.descriptors.LazyAnnotationDescriptor @@ -122,7 +123,7 @@ open class SerializationPluginDeclarationChecker : DeclarationChecker { return false } - if (descriptor.isInline) { + if (descriptor.isInlineClass()) { trace.reportOnSerializableAnnotation(descriptor, SerializationErrors.INLINE_CLASSES_NOT_SUPPORTED) return false } From ca3e7cf1a7280a417e88ae1fc44c638e72b9f8d8 Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Thu, 19 Nov 2020 02:57:55 +0100 Subject: [PATCH 276/698] Value classes: Report lacking @JvmInline only on JVM backend Report when @JvmInline is applied on non-value class. --- .../codegen/state/inlineClassManglingUtils.kt | 2 - ...irOldFrontendDiagnosticsTestGenerated.java | 5 ++ .../checkers/JvmInlineApplicabilityChecker.kt | 43 ++++++++++++++ .../diagnostics/DefaultErrorMessagesJvm.java | 3 + .../resolve/jvm/diagnostics/ErrorsJvm.java | 3 + .../jvm/platform/JvmPlatformConfigurator.kt | 1 + .../jetbrains/kotlin/diagnostics/Errors.java | 1 - .../rendering/DefaultErrorMessages.java | 1 - .../checkers/InlineClassDeclarationChecker.kt | 5 -- .../InlineIntOverridesObject.txt | 2 +- .../basicValueClassDeclaration.kt | 8 +-- .../basicValueClassDeclaration.txt | 20 +++---- .../basicValueClassDeclarationDisabled.kt | 6 +- .../basicValueClassDeclarationDisabled.txt | 20 +++---- .../jvmInlineApplicability.fir.kt | 23 ++++++++ .../valueClasses/jvmInlineApplicability.kt | 23 ++++++++ .../valueClasses/jvmInlineApplicability.txt | 57 +++++++++++++++++++ .../valueClassDeclarationCheck.kt | 8 +-- .../valueClassDeclarationCheck.txt | 18 +++--- ...denConstructorWithInlineClassParameters.kt | 1 + ...enConstructorWithInlineClassParameters.txt | 2 +- ...edApiAnnotationOnInlineClassCosntructor.kt | 1 + ...tationOnInlineClassCosntructor.runtime.txt | 2 +- ...dApiAnnotationOnInlineClassCosntructor.txt | 2 +- .../checkers/DiagnosticsTestGenerated.java | 5 ++ .../DiagnosticsUsingJavacTestGenerated.java | 5 ++ .../kotlin/resolve/inlineClassesUtils.kt | 2 +- 27 files changed, 215 insertions(+), 54 deletions(-) create mode 100644 compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmInlineApplicabilityChecker.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.fir.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.kt create mode 100644 compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.txt diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/inlineClassManglingUtils.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/inlineClassManglingUtils.kt index 7d8e309f1d0..e6fd417edf9 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/inlineClassManglingUtils.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/inlineClassManglingUtils.kt @@ -8,10 +8,8 @@ package org.jetbrains.kotlin.codegen.state import org.jetbrains.kotlin.codegen.coroutines.unwrapInitialDescriptorForSuspendFunction import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.name.FqNameUnsafe -import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.InlineClassDescriptorResolver -import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe import org.jetbrains.kotlin.resolve.isInlineClass import org.jetbrains.kotlin.resolve.jvm.requiresFunctionNameManglingForParameterTypes diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java index 7f464477a92..6659b194ca6 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java @@ -25015,6 +25015,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte runTest("compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.kt"); } + @TestMetadata("jvmInlineApplicability.kt") + public void testJvmInlineApplicability() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.kt"); + } + @TestMetadata("lateinitValueClasses.kt") public void testLateinitValueClasses() throws Exception { runTest("compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.kt"); diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmInlineApplicabilityChecker.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmInlineApplicabilityChecker.kt new file mode 100644 index 00000000000..d765f695232 --- /dev/null +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmInlineApplicabilityChecker.kt @@ -0,0 +1,43 @@ +/* + * Copyright 2010-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.resolve.jvm.checkers + +import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.descriptors.DeclarationDescriptor +import org.jetbrains.kotlin.lexer.KtTokens +import org.jetbrains.kotlin.psi.KtDeclaration +import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils +import org.jetbrains.kotlin.resolve.JVM_INLINE_ANNOTATION_FQ_NAME +import org.jetbrains.kotlin.resolve.checkers.DeclarationChecker +import org.jetbrains.kotlin.resolve.checkers.DeclarationCheckerContext +import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm + +class JvmInlineApplicabilityChecker : DeclarationChecker { + override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) { + if (descriptor !is ClassDescriptor) return + val annotation = descriptor.annotations.findAnnotation(JVM_INLINE_ANNOTATION_FQ_NAME) + if (annotation != null && !descriptor.isValue) { + val annotationEntry = DescriptorToSourceUtils.getSourceFromAnnotation(annotation) ?: return + context.trace.report(ErrorsJvm.JVM_INLINE_WITHOUT_VALUE_CLASS.on(annotationEntry)) + } + + if (descriptor.isValue && annotation == null) { + val valueKeyword = declaration.modifierList?.getModifier(KtTokens.VALUE_KEYWORD) ?: return + context.trace.report(ErrorsJvm.VALUE_CLASS_WITHOUT_JVM_INLINE_ANNOTATION.on(valueKeyword)) + } + } +} diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java index e4532c94ac3..206dc2d47fd 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java @@ -180,6 +180,9 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension { SHORT_NAMES_IN_TYPES, SHORT_NAMES_IN_TYPES, TO_STRING); MAP.put(DANGEROUS_CHARACTERS, "Name contains characters which can cause problems on Windows: {0}", STRING); + + MAP.put(VALUE_CLASS_WITHOUT_JVM_INLINE_ANNOTATION, "Value classes without @JvmInline annotation are not supported yet"); + MAP.put(JVM_INLINE_WITHOUT_VALUE_CLASS, "@JvmInline annotation is only applicable to value classes"); } @NotNull diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java index 09134f13e33..d83fb0af60f 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java @@ -148,6 +148,9 @@ public interface ErrorsJvm { DiagnosticFactory1 DANGEROUS_CHARACTERS = DiagnosticFactory1.create(WARNING); + DiagnosticFactory0 VALUE_CLASS_WITHOUT_JVM_INLINE_ANNOTATION = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 JVM_INLINE_WITHOUT_VALUE_CLASS = DiagnosticFactory0.create(ERROR); + @SuppressWarnings("UnusedDeclaration") Object _initializer = new Object() { { diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/platform/JvmPlatformConfigurator.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/platform/JvmPlatformConfigurator.kt index b480c13f288..0193fe88314 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/platform/JvmPlatformConfigurator.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/platform/JvmPlatformConfigurator.kt @@ -34,6 +34,7 @@ object JvmPlatformConfigurator : PlatformConfiguratorBase( JvmFieldApplicabilityChecker(), TypeParameterBoundIsNotArrayChecker(), JvmSyntheticApplicabilityChecker(), + JvmInlineApplicabilityChecker(), StrictfpApplicabilityChecker(), JvmAnnotationsTargetNonExistentAccessorChecker(), BadInheritedJavaSignaturesChecker, diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index 61b37a840b8..821a05c031e 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -362,7 +362,6 @@ public interface Errors { DiagnosticFactory0 INLINE_CLASS_CANNOT_BE_RECURSIVE = DiagnosticFactory0.create(ERROR); DiagnosticFactory1 RESERVED_MEMBER_INSIDE_INLINE_CLASS = DiagnosticFactory1.create(ERROR); DiagnosticFactory0 SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 VALUE_CLASS_WITHOUT_JVM_INLINE_ANNOTATION = DiagnosticFactory0.create(ERROR); // Result class diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index deb9aa147dd..b67d915a45d 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -717,7 +717,6 @@ public class DefaultErrorMessages { MAP.put(INLINE_CLASS_CANNOT_BE_RECURSIVE, "Inline class cannot be recursive"); MAP.put(RESERVED_MEMBER_INSIDE_INLINE_CLASS, "Member with the name ''{0}'' is reserved for future releases", STRING); MAP.put(SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS, "Secondary constructors with bodies are reserved for for future releases"); - MAP.put(VALUE_CLASS_WITHOUT_JVM_INLINE_ANNOTATION, "Value classes without @JvmInline annotation are not supported yet"); MAP.put(RESULT_CLASS_IN_RETURN_TYPE, "'kotlin.Result' cannot be used as a return type"); MAP.put(RESULT_CLASS_WITH_NULLABLE_OPERATOR, "Expression of type 'kotlin.Result' cannot be used as a left operand of ''{0}''", STRING); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt index 4d8bc1f6060..64f026ace36 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt @@ -9,7 +9,6 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.diagnostics.Errors import org.jetbrains.kotlin.lexer.KtTokens -import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.modalityModifier import org.jetbrains.kotlin.resolve.* @@ -88,10 +87,6 @@ object InlineClassDeclarationChecker : DeclarationChecker { } } } - - if (descriptor.isValue && !descriptor.annotations.hasAnnotation(JVM_INLINE_ANNOTATION)) { - trace.report(Errors.VALUE_CLASS_WITHOUT_JVM_INLINE_ANNOTATION.on(inlineOrValueKeyword)) - } } private fun KotlinType.isInapplicableParameterType() = diff --git a/compiler/testData/compileJavaAgainstKotlin/method/primitiveOverrideWithInlineClass/InlineIntOverridesObject.txt b/compiler/testData/compileJavaAgainstKotlin/method/primitiveOverrideWithInlineClass/InlineIntOverridesObject.txt index 3bedb4fb13f..e030987629f 100644 --- a/compiler/testData/compileJavaAgainstKotlin/method/primitiveOverrideWithInlineClass/InlineIntOverridesObject.txt +++ b/compiler/testData/compileJavaAgainstKotlin/method/primitiveOverrideWithInlineClass/InlineIntOverridesObject.txt @@ -14,7 +14,7 @@ public open class KFooZ : test.IFoo { public open fun foo(): test.Z } -public final inline class Z { +public final value class Z { public constructor Z(/*0*/ kotlin.Int) public final val value: kotlin.Int } diff --git a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.kt b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.kt index 3bdc892c700..95e721c23ae 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.kt @@ -7,7 +7,7 @@ annotation class JvmInline @JvmInline value class Foo(val x: Int) -value interface InlineInterface -value annotation class InlineAnn -value object InlineObject -value enum class InlineEnum +value interface InlineInterface +value annotation class InlineAnn +value object InlineObject +value enum class InlineEnum diff --git a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.txt b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.txt index c98b37739ef..e73947de324 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.txt @@ -12,9 +12,9 @@ package kotlin { public final value annotation class InlineAnn : kotlin.Annotation { public constructor InlineAnn() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String } public final value enum class InlineEnum : kotlin.Enum { @@ -27,7 +27,7 @@ package kotlin { protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class! public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String // Static members public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): kotlin.InlineEnum @@ -35,16 +35,16 @@ package kotlin { } public value interface InlineInterface { - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String } public value object InlineObject { private constructor InlineObject() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String } public final annotation class JvmInline : kotlin.Annotation { diff --git a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.kt b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.kt index e018281ab16..5411729d17f 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.kt @@ -7,9 +7,9 @@ annotation class JvmInline value class Foo(val x: Int) -value annotation class InlineAnn -value object InlineObject -value enum class InlineEnum +value annotation class InlineAnn +value object InlineObject +value enum class InlineEnum @JvmInline value class NotVal(x: Int) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.txt b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.txt index 3a25001d966..4d045c56d64 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.txt @@ -5,16 +5,16 @@ package kotlin { public final value class Foo { public constructor Foo(/*0*/ x: kotlin.Int) public final val x: kotlin.Int - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String } public final value annotation class InlineAnn : kotlin.Annotation { public constructor InlineAnn() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String } public final value enum class InlineEnum : kotlin.Enum { @@ -27,7 +27,7 @@ package kotlin { protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class! public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String // Static members public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): kotlin.InlineEnum @@ -36,9 +36,9 @@ package kotlin { public value object InlineObject { private constructor InlineObject() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String } public final annotation class JvmInline : kotlin.Annotation { diff --git a/compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.fir.kt new file mode 100644 index 00000000000..b1083cad466 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.fir.kt @@ -0,0 +1,23 @@ +// !LANGUAGE: +InlineClasses + +package kotlin + +annotation class JvmInline + +@JvmInline +inline class IC(val a: Any) + +@JvmInline +value class VC(val a: Any) + +@JvmInline +class C + +@JvmInline +interface I + +@JvmInline +object O + +@JvmInline +data class DC(val a: Any) diff --git a/compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.kt b/compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.kt new file mode 100644 index 00000000000..820263b497b --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.kt @@ -0,0 +1,23 @@ +// !LANGUAGE: +InlineClasses + +package kotlin + +annotation class JvmInline + +@JvmInline +inline class IC(val a: Any) + +@JvmInline +value class VC(val a: Any) + +@JvmInline +class C + +@JvmInline +interface I + +@JvmInline +object O + +@JvmInline +data class DC(val a: Any) diff --git a/compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.txt b/compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.txt new file mode 100644 index 00000000000..b41121095b1 --- /dev/null +++ b/compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.txt @@ -0,0 +1,57 @@ +package + +package kotlin { + + @kotlin.JvmInline public final class C { + public constructor C() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final data class DC { + public constructor DC(/*0*/ a: kotlin.Any) + public final val a: kotlin.Any + public final operator /*synthesized*/ fun component1(): kotlin.Any + public final /*synthesized*/ fun copy(/*0*/ a: kotlin.Any = ...): kotlin.DC + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public interface I { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final inline class IC { + public constructor IC(/*0*/ a: kotlin.Any) + public final val a: kotlin.Any + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public object O { + private constructor O() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + @kotlin.JvmInline public final value class VC { + public constructor VC(/*0*/ a: kotlin.Any) + public final val a: kotlin.Any + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt index 8a46844bd79..3b5c978717e 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt @@ -44,8 +44,8 @@ object B2 { @JvmInline final value class D0(val x: Int) -open value class D1(val x: Int) -abstract value class D2(val x: Int) -sealed value class D3(val x: Int) +open value class D1(val x: Int) +abstract value class D2(val x: Int) +sealed value class D3(val x: Int) -value data class D4(val x: String) +value data class D4(val x: String) diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.txt b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.txt index f0504130aaf..0dffe83ffd7 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.txt @@ -136,25 +136,25 @@ package kotlin { public open value class D1 { public constructor D1(/*0*/ x: kotlin.Int) public final val x: kotlin.Int - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String } public abstract value class D2 { public constructor D2(/*0*/ x: kotlin.Int) public final val x: kotlin.Int - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String } public sealed value class D3 { private constructor D3(/*0*/ x: kotlin.Int) public final val x: kotlin.Int - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String } public final data value class D4 { diff --git a/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/HiddenConstructorWithInlineClassParameters.kt b/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/HiddenConstructorWithInlineClassParameters.kt index db45c36cb4a..3f8d4d98b1e 100644 --- a/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/HiddenConstructorWithInlineClassParameters.kt +++ b/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/HiddenConstructorWithInlineClassParameters.kt @@ -1,4 +1,5 @@ // !LANGUAGE: +InlineClasses +// NO_CHECK_SOURCE_VS_BINARY package test annotation class Ann diff --git a/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/HiddenConstructorWithInlineClassParameters.txt b/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/HiddenConstructorWithInlineClassParameters.txt index eafbed2da12..5a96613bc75 100644 --- a/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/HiddenConstructorWithInlineClassParameters.txt +++ b/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/HiddenConstructorWithInlineClassParameters.txt @@ -24,7 +24,7 @@ public final class Test { public final fun (): test.Z } -public final inline class Z { +public final value class Z { /*primary*/ public constructor Z(/*0*/ x: kotlin.Int) public final val x: kotlin.Int public final fun (): kotlin.Int diff --git a/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.kt b/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.kt index f3c6057c88a..a3fa3ee3b84 100644 --- a/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.kt +++ b/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.kt @@ -1,4 +1,5 @@ // !LANGUAGE: +InlineClasses +// NO_CHECK_SOURCE_VS_BINARY @file:Suppress("NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS") package test diff --git a/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.runtime.txt b/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.runtime.txt index f0b85fba570..92185af7855 100644 --- a/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.runtime.txt +++ b/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.runtime.txt @@ -1,6 +1,6 @@ package test -public final inline class Z { +public final value class Z { /*primary*/ internal constructor Z(/*0*/ kotlin.Int) public final val value: kotlin.Int public final fun (): kotlin.Int diff --git a/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.txt b/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.txt index 8dc619b255d..4b2803557ad 100644 --- a/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.txt +++ b/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.txt @@ -1,6 +1,6 @@ package test -public final inline class Z { +public final value class Z { /*primary*/ @kotlin.PublishedApi internal constructor Z(/*0*/ value: kotlin.Int) public final val value: kotlin.Int public final fun (): kotlin.Int diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 6123ea0f4dd..da36d1cfb30 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -25097,6 +25097,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali runTest("compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.kt"); } + @TestMetadata("jvmInlineApplicability.kt") + public void testJvmInlineApplicability() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.kt"); + } + @TestMetadata("lateinitValueClasses.kt") public void testLateinitValueClasses() throws Exception { runTest("compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java index 31bdfd1493b..3b0c389a813 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java @@ -25017,6 +25017,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing runTest("compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.kt"); } + @TestMetadata("jvmInlineApplicability.kt") + public void testJvmInlineApplicability() throws Exception { + runTest("compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.kt"); + } + @TestMetadata("lateinitValueClasses.kt") public void testLateinitValueClasses() throws Exception { runTest("compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.kt"); diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/inlineClassesUtils.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/inlineClassesUtils.kt index fb2622039a3..b3804f4d0d2 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/inlineClassesUtils.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/inlineClassesUtils.kt @@ -13,7 +13,7 @@ import org.jetbrains.kotlin.types.TypeUtils import org.jetbrains.kotlin.types.Variance import org.jetbrains.kotlin.utils.addToStdlib.safeAs -val JVM_INLINE_ANNOTATION = FqName("kotlin.JvmInline") +val JVM_INLINE_ANNOTATION_FQ_NAME = FqName("kotlin.JvmInline") fun ClassDescriptor.underlyingRepresentation(): ValueParameterDescriptor? { if (!isInlineClass()) return null From 9b9c43b7028d7c7d44d835f9ad330681f0288db9 Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Mon, 23 Nov 2020 22:29:38 +0100 Subject: [PATCH 277/698] Value classes: Change relevant diagnostic to say 'value class' instead of 'inline class' --- .../kotlin/diagnostics/rendering/DefaultErrorMessages.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index b67d915a45d..42bf6d53016 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -708,7 +708,7 @@ public class DefaultErrorMessages { MAP.put(INLINE_CLASS_NOT_FINAL, "Inline classes can be only final"); MAP.put(ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_INLINE_CLASS, "Primary constructor is required for inline class"); MAP.put(INLINE_CLASS_CONSTRUCTOR_WRONG_PARAMETERS_SIZE, "Inline class must have exactly one primary constructor parameter"); - MAP.put(INLINE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER, "Inline class primary constructor must have only final read-only (val) property parameter"); + MAP.put(INLINE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER, "Value class primary constructor must have only final read-only (val) property parameter"); MAP.put(PROPERTY_WITH_BACKING_FIELD_INSIDE_INLINE_CLASS, "Inline class cannot have properties with backing fields"); MAP.put(DELEGATED_PROPERTY_INSIDE_INLINE_CLASS, "Inline class cannot have delegated properties"); MAP.put(INLINE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE, "Inline class cannot have value parameter of type ''{0}''", RENDER_TYPE); From 05c4dfef3d0ef954a802921455612daf8c85da9d Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Wed, 25 Nov 2020 06:19:23 +0100 Subject: [PATCH 278/698] Value classes: Use 'value' keyword instead of 'inline' in stub dumps --- .../tests/valueClasses/valueClassDeclarationCheck.fir.kt | 2 +- .../kotlin/idea/decompiler/stubBuilder/ClassClsStubBuilder.kt | 2 +- .../jetbrains/kotlin/idea/decompiler/stubBuilder/flags/flags.kt | 2 +- idea/idea-completion/testData/keywords/AfterClassProperty.kt | 1 + idea/idea-completion/testData/keywords/AfterClasses.kt | 1 + .../testData/keywords/AfterClasses_LangLevel10.kt | 1 + .../testData/keywords/AfterClasses_LangLevel11.kt | 1 + idea/idea-completion/testData/keywords/AfterFuns.kt | 1 + .../testData/keywords/GlobalPropertyAccessors.kt | 1 + .../idea-completion/testData/keywords/InAnnotationClassScope.kt | 1 + idea/idea-completion/testData/keywords/InClassBeforeFun.kt | 1 + idea/idea-completion/testData/keywords/InClassScope.kt | 1 + idea/idea-completion/testData/keywords/InEnumScope2.kt | 1 + idea/idea-completion/testData/keywords/InInterfaceScope.kt | 1 + idea/idea-completion/testData/keywords/InObjectScope.kt | 1 + .../idea-completion/testData/keywords/InTopScopeAfterPackage.kt | 1 + idea/idea-completion/testData/keywords/PropertyAccessors.kt | 1 + idea/idea-completion/testData/keywords/PropertyAccessors2.kt | 1 + idea/idea-completion/testData/keywords/PropertySetter.kt | 1 + idea/idea-completion/testData/keywords/TopScope.kt | 1 + idea/idea-completion/testData/keywords/TopScope3-.kt | 1 + idea/idea-completion/testData/keywords/topScope2.kt | 1 + 22 files changed, 22 insertions(+), 3 deletions(-) diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.fir.kt index 9586d4bb74b..b61487f664a 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.fir.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.fir.kt @@ -48,4 +48,4 @@ open value class D1(val x: Int) abstract value class D2(val x: Int) sealed value class D3(val x: Int) -value data class D4(val x: String) +value data class D4(val x: String) diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/ClassClsStubBuilder.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/ClassClsStubBuilder.kt index 608a6b77610..ccfc22cd209 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/ClassClsStubBuilder.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/ClassClsStubBuilder.kt @@ -102,7 +102,7 @@ private class ClassClsStubBuilder( relevantFlags.add(INNER) relevantFlags.add(DATA) relevantFlags.add(MODALITY) - relevantFlags.add(INLINE_CLASS) + relevantFlags.add(VALUE_CLASS) } if (isInterface()) { relevantFlags.add(FUN_INTERFACE) diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/flags/flags.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/flags/flags.kt index 5ee50593629..ff8f71d8cb7 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/flags/flags.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/flags/flags.kt @@ -51,7 +51,7 @@ val EXTERNAL_FUN = createBooleanFlagToModifier(Flags.IS_EXTERNAL_FUNCTION, KtTok val EXTERNAL_PROPERTY = createBooleanFlagToModifier(Flags.IS_EXTERNAL_PROPERTY, KtTokens.EXTERNAL_KEYWORD) val EXTERNAL_CLASS = createBooleanFlagToModifier(Flags.IS_EXTERNAL_CLASS, KtTokens.EXTERNAL_KEYWORD) val INLINE = createBooleanFlagToModifier(Flags.IS_INLINE, KtTokens.INLINE_KEYWORD) -val INLINE_CLASS = createBooleanFlagToModifier(Flags.IS_INLINE_CLASS, KtTokens.INLINE_KEYWORD) +val VALUE_CLASS = createBooleanFlagToModifier(Flags.IS_INLINE_CLASS, KtTokens.VALUE_KEYWORD) val FUN_INTERFACE = createBooleanFlagToModifier(Flags.IS_FUN_INTERFACE, KtTokens.FUN_KEYWORD) val TAILREC = createBooleanFlagToModifier(Flags.IS_TAILREC, KtTokens.TAILREC_KEYWORD) val SUSPEND = createBooleanFlagToModifier(Flags.IS_SUSPEND, KtTokens.SUSPEND_KEYWORD) diff --git a/idea/idea-completion/testData/keywords/AfterClassProperty.kt b/idea/idea-completion/testData/keywords/AfterClassProperty.kt index 7644cd67087..eda4112e774 100644 --- a/idea/idea-completion/testData/keywords/AfterClassProperty.kt +++ b/idea/idea-completion/testData/keywords/AfterClassProperty.kt @@ -36,6 +36,7 @@ class MouseMovedEventArgs // EXIST: lateinit var // EXIST: data class // EXIST: inline +// EXIST: value // EXIST: tailrec // EXIST: external // EXIST: annotation class diff --git a/idea/idea-completion/testData/keywords/AfterClasses.kt b/idea/idea-completion/testData/keywords/AfterClasses.kt index beb33d27e9c..2aaaaf6a926 100644 --- a/idea/idea-completion/testData/keywords/AfterClasses.kt +++ b/idea/idea-completion/testData/keywords/AfterClasses.kt @@ -33,6 +33,7 @@ class AfterClasses { // EXIST: sealed class // EXIST: data class // EXIST: inline +// EXIST: value // EXIST: tailrec // EXIST: external // EXIST: annotation class diff --git a/idea/idea-completion/testData/keywords/AfterClasses_LangLevel10.kt b/idea/idea-completion/testData/keywords/AfterClasses_LangLevel10.kt index 0ff92d5bf34..17727796838 100644 --- a/idea/idea-completion/testData/keywords/AfterClasses_LangLevel10.kt +++ b/idea/idea-completion/testData/keywords/AfterClasses_LangLevel10.kt @@ -36,6 +36,7 @@ class B { // EXIST: data class // EXIST: { "lookupString":"data class", "itemText":"data class", "tailText":" AfterClasses_LangLevel10(...)", "attributes":"bold" } // EXIST: inline +// EXIST: value // EXIST: tailrec // EXIST: external // EXIST: annotation class diff --git a/idea/idea-completion/testData/keywords/AfterClasses_LangLevel11.kt b/idea/idea-completion/testData/keywords/AfterClasses_LangLevel11.kt index 1ac3c9a9e14..24bbfe25aad 100644 --- a/idea/idea-completion/testData/keywords/AfterClasses_LangLevel11.kt +++ b/idea/idea-completion/testData/keywords/AfterClasses_LangLevel11.kt @@ -36,6 +36,7 @@ class B { // EXIST: data class // EXIST: { "lookupString":"data class", "itemText":"data class", "tailText":" AfterClasses_LangLevel11(...)", "attributes":"bold" } // EXIST: inline +// EXIST: value // EXIST: tailrec // EXIST: external // EXIST: annotation class diff --git a/idea/idea-completion/testData/keywords/AfterFuns.kt b/idea/idea-completion/testData/keywords/AfterFuns.kt index 6726ee10002..54966f4890a 100644 --- a/idea/idea-completion/testData/keywords/AfterFuns.kt +++ b/idea/idea-completion/testData/keywords/AfterFuns.kt @@ -35,6 +35,7 @@ class A { // EXIST: lateinit var // EXIST: data class // EXIST: inline +// EXIST: value // EXIST: tailrec // EXIST: external // EXIST: annotation class diff --git a/idea/idea-completion/testData/keywords/GlobalPropertyAccessors.kt b/idea/idea-completion/testData/keywords/GlobalPropertyAccessors.kt index 99e42ebf056..8220a22f884 100644 --- a/idea/idea-completion/testData/keywords/GlobalPropertyAccessors.kt +++ b/idea/idea-completion/testData/keywords/GlobalPropertyAccessors.kt @@ -40,6 +40,7 @@ var a : Int // EXIST: data class // EXIST: { "lookupString":"data class", "itemText":"data class", "tailText":" GlobalPropertyAccessors(...)", "attributes":"bold" } // EXIST: inline +// EXIST: value // EXIST: tailrec // EXIST: external // EXIST: annotation class diff --git a/idea/idea-completion/testData/keywords/InAnnotationClassScope.kt b/idea/idea-completion/testData/keywords/InAnnotationClassScope.kt index b63c3f91e94..834ffb8f046 100644 --- a/idea/idea-completion/testData/keywords/InAnnotationClassScope.kt +++ b/idea/idea-completion/testData/keywords/InAnnotationClassScope.kt @@ -21,6 +21,7 @@ annotation class Test { // EXIST: lateinit var // EXIST: data class // EXIST: inline +// EXIST: value // EXIST: tailrec // EXIST: external // EXIST: annotation class diff --git a/idea/idea-completion/testData/keywords/InClassBeforeFun.kt b/idea/idea-completion/testData/keywords/InClassBeforeFun.kt index 6c494477170..44b688bde61 100644 --- a/idea/idea-completion/testData/keywords/InClassBeforeFun.kt +++ b/idea/idea-completion/testData/keywords/InClassBeforeFun.kt @@ -33,6 +33,7 @@ public class Test { // EXIST: lateinit var // EXIST: data class // EXIST: inline +// EXIST: value // EXIST: tailrec // EXIST: external // EXIST: annotation class diff --git a/idea/idea-completion/testData/keywords/InClassScope.kt b/idea/idea-completion/testData/keywords/InClassScope.kt index fbc2301e4a7..a8f87a62b64 100644 --- a/idea/idea-completion/testData/keywords/InClassScope.kt +++ b/idea/idea-completion/testData/keywords/InClassScope.kt @@ -27,6 +27,7 @@ class TestClass { // EXIST: lateinit var // EXIST: data class // EXIST: inline +// EXIST: value // EXIST: tailrec // EXIST: external // EXIST: annotation class diff --git a/idea/idea-completion/testData/keywords/InEnumScope2.kt b/idea/idea-completion/testData/keywords/InEnumScope2.kt index 1ad80a9a6e5..f8e87c232c5 100644 --- a/idea/idea-completion/testData/keywords/InEnumScope2.kt +++ b/idea/idea-completion/testData/keywords/InEnumScope2.kt @@ -21,6 +21,7 @@ enum class Test { // EXIST: lateinit var // EXIST: data class // EXIST: inline +// EXIST: value // EXIST: tailrec // EXIST: external // EXIST: annotation class diff --git a/idea/idea-completion/testData/keywords/InInterfaceScope.kt b/idea/idea-completion/testData/keywords/InInterfaceScope.kt index 2acdaf89a42..230e1573307 100644 --- a/idea/idea-completion/testData/keywords/InInterfaceScope.kt +++ b/idea/idea-completion/testData/keywords/InInterfaceScope.kt @@ -23,6 +23,7 @@ interface Test { // EXIST: lateinit var // EXIST: data class // EXIST: inline +// EXIST: value // EXIST: tailrec // EXIST: external // EXIST: annotation class diff --git a/idea/idea-completion/testData/keywords/InObjectScope.kt b/idea/idea-completion/testData/keywords/InObjectScope.kt index 638fd7fca00..b2c7f817171 100644 --- a/idea/idea-completion/testData/keywords/InObjectScope.kt +++ b/idea/idea-completion/testData/keywords/InObjectScope.kt @@ -24,6 +24,7 @@ object Test { // EXIST: lateinit var // EXIST: data class // EXIST: inline +// EXIST: value // EXIST: tailrec // EXIST: external // EXIST: annotation class diff --git a/idea/idea-completion/testData/keywords/InTopScopeAfterPackage.kt b/idea/idea-completion/testData/keywords/InTopScopeAfterPackage.kt index a3f0f55e980..f6eb462e225 100644 --- a/idea/idea-completion/testData/keywords/InTopScopeAfterPackage.kt +++ b/idea/idea-completion/testData/keywords/InTopScopeAfterPackage.kt @@ -27,6 +27,7 @@ package Test // EXIST: data class // EXIST: { "lookupString":"data class", "itemText":"data class", "tailText":" InTopScopeAfterPackage(...)", "attributes":"bold" } // EXIST: inline +// EXIST: value // EXIST: tailrec // EXIST: external // EXIST: annotation class diff --git a/idea/idea-completion/testData/keywords/PropertyAccessors.kt b/idea/idea-completion/testData/keywords/PropertyAccessors.kt index 2482a1af6d4..b662fdf7444 100644 --- a/idea/idea-completion/testData/keywords/PropertyAccessors.kt +++ b/idea/idea-completion/testData/keywords/PropertyAccessors.kt @@ -35,6 +35,7 @@ class Some { // EXIST: lateinit var // EXIST: data class // EXIST: inline +// EXIST: value // EXIST: tailrec // EXIST: external // EXIST: annotation class diff --git a/idea/idea-completion/testData/keywords/PropertyAccessors2.kt b/idea/idea-completion/testData/keywords/PropertyAccessors2.kt index 7aae2bcfaf5..f4326fbd54b 100644 --- a/idea/idea-completion/testData/keywords/PropertyAccessors2.kt +++ b/idea/idea-completion/testData/keywords/PropertyAccessors2.kt @@ -35,6 +35,7 @@ class Some { // EXIST: lateinit var // EXIST: data class // EXIST: inline +// EXIST: value // EXIST: tailrec // EXIST: external // EXIST: annotation class diff --git a/idea/idea-completion/testData/keywords/PropertySetter.kt b/idea/idea-completion/testData/keywords/PropertySetter.kt index df6a2cf7b40..491c24fe4c1 100644 --- a/idea/idea-completion/testData/keywords/PropertySetter.kt +++ b/idea/idea-completion/testData/keywords/PropertySetter.kt @@ -33,6 +33,7 @@ class Some { // EXIST: lateinit var // EXIST: data class // EXIST: inline +// EXIST: value // EXIST: tailrec // EXIST: external // EXIST: annotation class diff --git a/idea/idea-completion/testData/keywords/TopScope.kt b/idea/idea-completion/testData/keywords/TopScope.kt index 87f0717137f..a0047259892 100644 --- a/idea/idea-completion/testData/keywords/TopScope.kt +++ b/idea/idea-completion/testData/keywords/TopScope.kt @@ -26,6 +26,7 @@ // EXIST: data class // EXIST: { "lookupString":"data class", "itemText":"data class", "tailText":" TopScope(...)", "attributes":"bold" } // EXIST: inline +// EXIST: value // EXIST: tailrec // EXIST: external // EXIST: annotation class diff --git a/idea/idea-completion/testData/keywords/TopScope3-.kt b/idea/idea-completion/testData/keywords/TopScope3-.kt index 9993b2e4c12..dda4333afe5 100644 --- a/idea/idea-completion/testData/keywords/TopScope3-.kt +++ b/idea/idea-completion/testData/keywords/TopScope3-.kt @@ -20,6 +20,7 @@ // EXIST: sealed class // EXIST: data class // EXIST: inline +// EXIST: value // EXIST: tailrec // EXIST: external // EXIST: annotation class diff --git a/idea/idea-completion/testData/keywords/topScope2.kt b/idea/idea-completion/testData/keywords/topScope2.kt index 9993b2e4c12..dda4333afe5 100644 --- a/idea/idea-completion/testData/keywords/topScope2.kt +++ b/idea/idea-completion/testData/keywords/topScope2.kt @@ -20,6 +20,7 @@ // EXIST: sealed class // EXIST: data class // EXIST: inline +// EXIST: value // EXIST: tailrec // EXIST: external // EXIST: annotation class From 871912f257dc37ed6640c302b0dc4d2a5306ce6f Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Fri, 27 Nov 2020 20:46:49 +0100 Subject: [PATCH 279/698] Value Classes: Increase BINARY_STUB_VERSION after decompiler changes --- .../src/org/jetbrains/kotlin/psi/stubs/KotlinStubVersions.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/KotlinStubVersions.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/KotlinStubVersions.kt index 05c624d04b7..fe167b8e8d3 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/KotlinStubVersions.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/KotlinStubVersions.kt @@ -28,7 +28,7 @@ object KotlinStubVersions { // Binary stub version should be increased if stub format (org.jetbrains.kotlin.psi.stubs.impl) is changed // or changes are made to the core stub building code (org.jetbrains.kotlin.idea.decompiler.stubBuilder). // Increasing this version will lead to reindexing of all binary files that are potentially kotlin binaries (including all class files). - private const val BINARY_STUB_VERSION = 73 + private const val BINARY_STUB_VERSION = 74 // Classfile stub version should be increased if changes are made to classfile stub building subsystem (org.jetbrains.kotlin.idea.decompiler.classFile) // Increasing this version will lead to reindexing of all classfiles. From 78e607c6b0d906457f3f0cd2d6a1123adb7f523f Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Mon, 23 Nov 2020 23:44:41 +0100 Subject: [PATCH 280/698] Value classes: Support @JvmName annotation on functions with inline classes in signatures, but not on methods of inline classes. --- .../jvm/checkers/declarationCheckers.kt | 5 +-- .../bytecodeListing/inlineClasses/jvmName.kt | 29 +++++++++++++++ .../bytecodeListing/inlineClasses/jvmName.txt | 35 +++++++++++++++++++ .../jvmNameOnMangledNames.kt | 8 ++--- .../codegen/BytecodeListingTestGenerated.java | 5 +++ .../ir/IrBytecodeListingTestGenerated.java | 5 +++ 6 files changed, 79 insertions(+), 8 deletions(-) create mode 100644 compiler/testData/codegen/bytecodeListing/inlineClasses/jvmName.kt create mode 100644 compiler/testData/codegen/bytecodeListing/inlineClasses/jvmName.txt diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/declarationCheckers.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/declarationCheckers.kt index 2060f6f40a8..7041075f017 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/declarationCheckers.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/declarationCheckers.kt @@ -152,10 +152,7 @@ class JvmNameAnnotationChecker : DeclarationChecker { if (descriptor is CallableMemberDescriptor) { if (DescriptorUtils.isOverride(descriptor) || descriptor.isOverridable) { diagnosticHolder.report(ErrorsJvm.INAPPLICABLE_JVM_NAME.on(annotationEntry)) - } else if (descriptor.containingDeclaration.isInlineClassThatRequiresMangling() || - requiresFunctionNameManglingForParameterTypes(descriptor) || - requiresFunctionNameManglingForReturnType(descriptor) - ) { + } else if (descriptor.containingDeclaration.isInlineClassThatRequiresMangling()) { diagnosticHolder.report(ErrorsJvm.INAPPLICABLE_JVM_NAME.on(annotationEntry)) } } diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/jvmName.kt b/compiler/testData/codegen/bytecodeListing/inlineClasses/jvmName.kt new file mode 100644 index 00000000000..fa631b19278 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/jvmName.kt @@ -0,0 +1,29 @@ +// !LANGUAGE: +InlineClasses +// WITH_RUNTIME + +inline class Foo(val a: Any) + +@JvmName("bar") +fun bar(f: Foo) {} + +@JvmName("baz") +fun baz(r: Result) {} + +@JvmName("test") +fun returnsInlineClass() = Foo(1) + +@JvmName("test") +@Suppress("RESULT_CLASS_IN_RETURN_TYPE") +fun returnsKotlinResult(a: Result): Result = a + +class C { + @JvmName("test") + fun returnsInlineClass() = Foo(1) + + @JvmName("test") + @Suppress("RESULT_CLASS_IN_RETURN_TYPE") + fun returnsKotlinResult(a: Result): Result = a +} + +@JvmName("extensionFun") +fun Foo.extensionFun() {} diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/jvmName.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/jvmName.txt new file mode 100644 index 00000000000..6f47578950e --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/jvmName.txt @@ -0,0 +1,35 @@ +@kotlin.Metadata +public final class C { + // source: 'jvmName.kt' + public method (): void + public final @kotlin.jvm.JvmName @org.jetbrains.annotations.NotNull method test(): java.lang.Object + public final @kotlin.jvm.JvmName @org.jetbrains.annotations.NotNull method test(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object +} + +@kotlin.Metadata +public final class Foo { + // source: 'jvmName.kt' + private final @org.jetbrains.annotations.NotNull field a: java.lang.Object + private synthetic method (p0: java.lang.Object): void + public synthetic final static method box-impl(p0: java.lang.Object): Foo + public static @org.jetbrains.annotations.NotNull method constructor-impl(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: java.lang.Object, p1: java.lang.Object): boolean + public final static method equals-impl0(p0: java.lang.Object, p1: java.lang.Object): boolean + public final @org.jetbrains.annotations.NotNull method getA(): java.lang.Object + public method hashCode(): int + public static method hashCode-impl(p0: java.lang.Object): int + public method toString(): java.lang.String + public static method toString-impl(p0: java.lang.Object): java.lang.String + public synthetic final method unbox-impl(): java.lang.Object +} + +@kotlin.Metadata +public final class JvmNameKt { + // source: 'jvmName.kt' + public final static @kotlin.jvm.JvmName method bar(@org.jetbrains.annotations.NotNull p0: java.lang.Object): void + public final static @kotlin.jvm.JvmName method baz(@org.jetbrains.annotations.NotNull p0: java.lang.Object): void + public final static @kotlin.jvm.JvmName method extensionFun(@org.jetbrains.annotations.NotNull p0: java.lang.Object): void + public final static @kotlin.jvm.JvmName @org.jetbrains.annotations.NotNull method test(): java.lang.Object + public final static @kotlin.jvm.JvmName @org.jetbrains.annotations.NotNull method test(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationApplicability/jvmNameOnMangledNames.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationApplicability/jvmNameOnMangledNames.kt index 2422426f648..6842cfb2732 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationApplicability/jvmNameOnMangledNames.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationApplicability/jvmNameOnMangledNames.kt @@ -6,7 +6,7 @@ inline class Foo(val x: Int) { fun simple() {} } -@JvmName("bad") +@JvmName("bad") fun bar(f: Foo) {} @JvmName("good") @@ -19,12 +19,12 @@ fun returnsInlineClass() = Foo(1) fun returnsKotlinResult(a: Result): Result = a class C { - @JvmName("test") + @JvmName("test") fun returnsInlineClass() = Foo(1) - @JvmName("test") + @JvmName("test") fun returnsKotlinResult(a: Result): Result = a } -@JvmName("extensionFun") +@JvmName("extensionFun") fun Foo.extensionFun() {} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index 3819622fa50..50083f9262c 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -982,6 +982,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassWithManyKindsOfMembers.kt"); } + @TestMetadata("jvmName.kt") + public void testJvmName() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/jvmName.kt"); + } + @TestMetadata("jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt") public void testJvmOverloadsOnTopLevelFunctionReturningInlineClassValue() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index cd94d0bd371..16284c09f95 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -952,6 +952,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassWithManyKindsOfMembers.kt"); } + @TestMetadata("jvmName.kt") + public void testJvmName() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/jvmName.kt"); + } + @TestMetadata("jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt") public void testJvmOverloadsOnTopLevelFunctionReturningInlineClassValue() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt"); From 65ce7cd0c2076aa645c1ce275a4bc5e7d9d59b19 Mon Sep 17 00:00:00 2001 From: Ilya Muradyan Date: Fri, 27 Nov 2020 13:52:55 +0300 Subject: [PATCH 281/698] Fix path for Windows in Fibonacci test --- .../kotlin/scripting/compiler/test/CompileTimeFibonacciTest.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/scripting/scripting-compiler/tests/org/jetbrains/kotlin/scripting/compiler/test/CompileTimeFibonacciTest.kt b/plugins/scripting/scripting-compiler/tests/org/jetbrains/kotlin/scripting/compiler/test/CompileTimeFibonacciTest.kt index 54c70fba595..e1e91cac27e 100644 --- a/plugins/scripting/scripting-compiler/tests/org/jetbrains/kotlin/scripting/compiler/test/CompileTimeFibonacciTest.kt +++ b/plugins/scripting/scripting-compiler/tests/org/jetbrains/kotlin/scripting/compiler/test/CompileTimeFibonacciTest.kt @@ -62,8 +62,9 @@ class CompileTimeFibonacciTest : TestCase() { is ResultWithDiagnostics.Failure -> { val error = result.reports.first() + val expectedFile = File("plugins/scripting/scripting-compiler/testData/compiler/compileTimeFibonacci/unsupported.fib.kts") val expectedErrorMessage = """ - (plugins/scripting/scripting-compiler/testData/compiler/compileTimeFibonacci/unsupported.fib.kts:3:1) Fibonacci of non-positive numbers like 0 are not supported + ($expectedFile:3:1) Fibonacci of non-positive numbers like 0 are not supported """.trimIndent() Assert.assertEquals(expectedErrorMessage, error.message) // TODO: the location is not in the diagnostics because the `MessageCollector` defined in KotlinTestUtils, From 89bba9361567e09397b4a0686a54d418019ee6cc Mon Sep 17 00:00:00 2001 From: Ilya Muradyan Date: Fri, 27 Nov 2020 13:55:24 +0300 Subject: [PATCH 282/698] Introduce GetScriptingClassByClassLoader interface It is needed to override default JVM behaviour --- .../test/ImplicitsFromScriptResultTest.kt | 148 ++++++++++++++++++ .../jvm/jvmScriptingHostConfiguration.kt | 12 +- .../resolve/refineCompilationConfiguration.kt | 4 +- 3 files changed, 160 insertions(+), 4 deletions(-) create mode 100644 libraries/scripting/jvm-host-test/test/kotlin/script/experimental/jvmhost/test/ImplicitsFromScriptResultTest.kt diff --git a/libraries/scripting/jvm-host-test/test/kotlin/script/experimental/jvmhost/test/ImplicitsFromScriptResultTest.kt b/libraries/scripting/jvm-host-test/test/kotlin/script/experimental/jvmhost/test/ImplicitsFromScriptResultTest.kt new file mode 100644 index 00000000000..5c26519e9cf --- /dev/null +++ b/libraries/scripting/jvm-host-test/test/kotlin/script/experimental/jvmhost/test/ImplicitsFromScriptResultTest.kt @@ -0,0 +1,148 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package kotlin.script.experimental.jvmhost.test + +import junit.framework.TestCase +import kotlinx.coroutines.runBlocking +import java.io.BufferedOutputStream +import java.io.FileOutputStream +import java.nio.file.Files +import java.nio.file.Path +import kotlin.reflect.KClass +import kotlin.script.experimental.api.* +import kotlin.script.experimental.host.ScriptingHostConfiguration +import kotlin.script.experimental.host.getScriptingClass +import kotlin.script.experimental.host.with +import kotlin.script.experimental.jvm.* +import kotlin.script.experimental.jvm.impl.KJvmCompiledModuleInMemory +import kotlin.script.experimental.jvm.impl.KJvmCompiledScript +import kotlin.script.experimental.jvmhost.JvmScriptCompiler + +/** + * This test shows an ability of using KClasses loaded with classloaders + * other than default one, in the role of implicit receivers. For this reason, + * specific [GetScriptingClassByClassLoader] was implemented. Actually, + * as we use previously compiled snippets as implicits, we could achieve the same + * thing if we change the used compiler to one of the REPL ones. But if we are limited + * in our choice of compiler and only can tune the configuration, this is the only way. + * + * This test may be deleted or at least simplified when the option + * in [ScriptCompilationConfiguration] for saving previous classes in + * underlying module will be introduced. + */ +class ImplicitsFromScriptResultTest : TestCase() { + fun testImplicits() { + val host = CompilerHost() + + val snippets = listOf( + "val xyz0 = 42", + "fun f() = xyz0", + "val finalRes = xyz0 + f()", + ) + for (snippet in snippets) { + val res = host.compile(snippet) + assertTrue(res is ResultWithDiagnostics.Success) + } + } +} + +fun interface PreviousScriptClassesProvider { + fun get(): List> +} + +class GetScriptClassForImplicits( + private val previousScriptClassesProvider: PreviousScriptClassesProvider +) : GetScriptingClassByClassLoader { + private val getScriptingClass = JvmGetScriptingClass() + + private val lastClassLoader + get() = previousScriptClassesProvider.get().lastOrNull()?.java?.classLoader + + override fun invoke( + classType: KotlinType, + contextClass: KClass<*>, + hostConfiguration: ScriptingHostConfiguration + ): KClass<*> { + return getScriptingClass(classType, lastClassLoader ?: contextClass.java.classLoader, hostConfiguration) + } + + override fun invoke( + classType: KotlinType, + contextClassLoader: ClassLoader?, + hostConfiguration: ScriptingHostConfiguration + ): KClass<*> { + return getScriptingClass(classType, lastClassLoader ?: contextClassLoader, hostConfiguration) + } +} + +class CompilerHost { + private var counter = 0 + private val implicits = mutableListOf>() + private val outputDir: Path = Files.createTempDirectory("kotlin-scripting-jvm") + private val classWriter = ClassWriter(outputDir) + + init { + outputDir.toFile().deleteOnExit() + } + + private val myHostConfiguration = defaultJvmScriptingHostConfiguration.with { + getScriptingClass(GetScriptClassForImplicits(::getImplicitsClasses)) + } + + private val compileConfiguration = ScriptCompilationConfiguration { + hostConfiguration(myHostConfiguration) + + jvm { + dependencies(JvmDependency(outputDir.toFile())) + } + } + + private val evaluationConfiguration = ScriptEvaluationConfiguration() + + private val compiler = JvmScriptCompiler(myHostConfiguration) + + private fun getImplicitsClasses(): List> = implicits + + fun compile(code: String): ResultWithDiagnostics { + val source = SourceCodeTestImpl(counter++, code) + val refinedConfig = compileConfiguration.with { + implicitReceivers(*implicits.toTypedArray()) + } + val result = runBlocking { compiler.invoke(source, refinedConfig) } + val compiledScript = result.valueOrThrow() as KJvmCompiledScript + + classWriter.writeCompiledSnippet(compiledScript) + + val kClass = runBlocking { compiledScript.getClass(evaluationConfiguration) }.valueOrThrow() + implicits.add(kClass) + return result + } + + private class SourceCodeTestImpl(number: Int, override val text: String) : SourceCode { + override val name: String = "Line_$number" + override val locationId: String = "location_$number" + } +} + +class ClassWriter(private val outputDir: Path) { + fun writeCompiledSnippet(snippet: KJvmCompiledScript) { + val moduleInMemory = snippet.getCompiledModule() as KJvmCompiledModuleInMemory + moduleInMemory.compilerOutputFiles.forEach { (name, bytes) -> + if (name.endsWith(".class")) { + writeClass(bytes, outputDir.resolve(name)) + } + } + } + + private fun writeClass(classBytes: ByteArray, path: Path) { + FileOutputStream(path.toAbsolutePath().toString()).use { fos -> + BufferedOutputStream(fos).use { out -> + out.write(classBytes) + out.flush() + } + } + } +} diff --git a/libraries/scripting/jvm/src/kotlin/script/experimental/jvm/jvmScriptingHostConfiguration.kt b/libraries/scripting/jvm/src/kotlin/script/experimental/jvm/jvmScriptingHostConfiguration.kt index f51f812abed..ee998d0acb8 100644 --- a/libraries/scripting/jvm/src/kotlin/script/experimental/jvm/jvmScriptingHostConfiguration.kt +++ b/libraries/scripting/jvm/src/kotlin/script/experimental/jvm/jvmScriptingHostConfiguration.kt @@ -45,7 +45,11 @@ val defaultJvmScriptingHostConfiguration getScriptingClass(JvmGetScriptingClass()) } -class JvmGetScriptingClass : GetScriptingClass, Serializable { +interface GetScriptingClassByClassLoader : GetScriptingClass { + operator fun invoke(classType: KotlinType, contextClassLoader: ClassLoader?, hostConfiguration: ScriptingHostConfiguration): KClass<*> +} + +class JvmGetScriptingClass : GetScriptingClassByClassLoader, Serializable { @Transient private var dependencies: List? = null @@ -64,7 +68,11 @@ class JvmGetScriptingClass : GetScriptingClass, Serializable { invoke(classType, contextClass.java.classLoader, hostConfiguration) @Synchronized - operator fun invoke(classType: KotlinType, contextClassLoader: ClassLoader?, hostConfiguration: ScriptingHostConfiguration): KClass<*> { + override operator fun invoke( + classType: KotlinType, + contextClassLoader: ClassLoader?, + hostConfiguration: ScriptingHostConfiguration + ): KClass<*> { // checking if class already loaded in the same context val fromClass = classType.fromClass diff --git a/plugins/scripting/scripting-compiler-impl/src/org/jetbrains/kotlin/scripting/resolve/refineCompilationConfiguration.kt b/plugins/scripting/scripting-compiler-impl/src/org/jetbrains/kotlin/scripting/resolve/refineCompilationConfiguration.kt index 8e09af1a06a..6d2ea8ca635 100644 --- a/plugins/scripting/scripting-compiler-impl/src/org/jetbrains/kotlin/scripting/resolve/refineCompilationConfiguration.kt +++ b/plugins/scripting/scripting-compiler-impl/src/org/jetbrains/kotlin/scripting/resolve/refineCompilationConfiguration.kt @@ -352,8 +352,8 @@ fun getScriptCollectedData( val hostConfiguration = compilationConfiguration[ScriptCompilationConfiguration.hostConfiguration] ?: defaultJvmScriptingHostConfiguration val getScriptingClass = hostConfiguration[ScriptingHostConfiguration.getScriptingClass] - val jvmGetScriptingClass = (getScriptingClass as? JvmGetScriptingClass) - ?: throw IllegalArgumentException("Expecting JvmGetScriptingClass in the hostConfiguration[getScriptingClass], got $getScriptingClass") + val jvmGetScriptingClass = (getScriptingClass as? GetScriptingClassByClassLoader) + ?: throw IllegalArgumentException("Expecting class implementing GetScriptingClassByClassLoader in the hostConfiguration[getScriptingClass], got $getScriptingClass") val acceptedAnnotations = compilationConfiguration[ScriptCompilationConfiguration.refineConfigurationOnAnnotations]?.flatMap { it.annotations.mapNotNull { ann -> From eeb9b3214c27d189bf4534c6d651a788c829e8ff Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Sat, 28 Nov 2020 14:25:19 +0300 Subject: [PATCH 283/698] Switch to 202 platform --- .bunch | 11 ++--- .../common/TypeAnnotatedFrames.kt | 2 +- ...ames.kt.202 => TypeAnnotatedFrames.kt.201} | 2 +- .../codegen/state/JvmMethodExceptionTypes.kt | 2 +- ....kt.202 => JvmMethodExceptionTypes.kt.201} | 2 +- .../messages/DefaultDiagnosticReporter.kt | 2 +- ...t.202 => DefaultDiagnosticReporter.kt.201} | 2 +- .../cli/common/messages/MessageUtil.java | 20 +++----- ...sageUtil.java.202 => MessageUtil.java.201} | 20 +++++--- .../kotlin/cli/jvm/compiler/compat.kt | 2 + .../compiler/{compat.kt.202 => compat.kt.201} | 2 - .../regressions/kt28385/output.txt | 6 +-- .../{output.txt.202 => output.txt.201} | 6 +-- .../test/testFramework/KtParsingTestCase.java | 1 - ...se.java.202 => KtParsingTestCase.java.201} | 1 + .../test/testFramework/KtUsefulTestCase.java | 8 ++-- ...ase.java.202 => KtUsefulTestCase.java.201} | 8 ++-- gradle/versions.properties | 8 ++-- ...properties.202 => versions.properties.201} | 8 ++-- .../PropertyKeysEmptyString.kt | 8 ++-- ....kt.202 => PropertyKeysEmptyString.kt.201} | 8 ++-- .../PropertyKeysNoPrefix.kt | 8 ++-- ...fix.kt.202 => PropertyKeysNoPrefix.kt.201} | 8 ++-- .../PropertyKeysWithPrefix.kt | 6 +-- ...x.kt.202 => PropertyKeysWithPrefix.kt.201} | 6 +-- .../idea/DaemonCodeAnalyzerStatusService.kt | 4 +- ...=> DaemonCodeAnalyzerStatusService.kt.201} | 4 +- .../idea/actions/ShowKotlinGradleDslLogs.kt | 2 +- ....kt.202 => ShowKotlinGradleDslLogs.kt.201} | 2 +- .../kotlin/idea/test/PluginTestCaseBase.java | 3 +- ...e.java.202 => PluginTestCaseBase.java.201} | 3 +- .../org/jetbrains/kotlin/idea/test/compat.kt | 6 +-- .../test/{compat.kt.202 => compat.kt.201} | 6 ++- ...otlinClassWithDelegatedPropertyRenderer.kt | 7 +-- ...ClassWithDelegatedPropertyRenderer.kt.201} | 7 ++- .../idea/testFramework/gradleRoutines.kt | 7 +-- ...eRoutines.kt.202 => gradleRoutines.kt.201} | 7 ++- .../idea/testFramework/projectRoutines.kt | 11 ++--- ...Routines.kt.202 => projectRoutines.kt.201} | 11 +++-- .../resources-descriptors/META-INF/plugin.xml | 15 +++--- .../{plugin.xml.202 => plugin.xml.201} | 15 +++--- .../idea/scratch/ScratchLineMarkersTest.kt | 4 +- ...t.kt.202 => ScratchLineMarkersTest.kt.201} | 4 +- ...KotlinHighlightExitPointsHandlerFactory.kt | 4 +- ...nHighlightExitPointsHandlerFactory.kt.201} | 4 +- ...KotlinHighlightImplicitItHandlerFactory.kt | 6 +-- ...nHighlightImplicitItHandlerFactory.kt.201} | 6 +-- .../KotlinRecursiveCallLineMarkerProvider.kt | 2 +- ...linRecursiveCallLineMarkerProvider.kt.201} | 2 +- .../KotlinSuspendCallLineMarkerProvider.kt | 2 +- ...otlinSuspendCallLineMarkerProvider.kt.201} | 2 +- .../highlighter/markers/LineMarkerInfos.kt | 2 +- ...kerInfos.kt.202 => LineMarkerInfos.kt.201} | 2 +- .../inspections/TrailingCommaInspection.kt | 4 +- ....kt.202 => TrailingCommaInspection.kt.201} | 4 +- ...2 => KotlinMutableMethodDescriptor.kt.201} | 0 .../KotlinTargetElementEvaluator.kt | 2 +- ...02 => KotlinTargetElementEvaluator.kt.201} | 2 +- .../kotlin/idea/slicer/KotlinSliceProvider.kt | 2 +- ...ider.kt.202 => KotlinSliceProvider.kt.201} | 2 +- .../codeInsight/AbstractLineMarkersTest.kt | 15 +++--- ....kt.202 => AbstractLineMarkersTest.kt.201} | 15 +++--- ...AbstractLineMarkersTestInLibrarySources.kt | 6 +-- ...actLineMarkersTestInLibrarySources.kt.201} | 6 ++- .../AbstractUsageHighlightingTest.kt | 4 +- ...2 => AbstractUsageHighlightingTest.kt.201} | 4 +- .../inspections/InspectionDescriptionTest.kt | 2 +- ...t.202 => InspectionDescriptionTest.kt.201} | 2 +- .../intentions/IntentionDescriptionTest.kt | 3 +- ...kt.202 => IntentionDescriptionTest.kt.201} | 3 +- .../kotlin/idea/navigation/GotoCheck.kt | 4 +- .../{GotoCheck.kt.202 => GotoCheck.kt.201} | 4 +- ...AdditionalResolveDescriptorRendererTest.kt | 8 ++-- ...ionalResolveDescriptorRendererTest.kt.201} | 8 ++-- .../kotlin/idea/slicer/SlicerTestUtil.kt | 3 +- ...rTestUtil.kt.202 => SlicerTestUtil.kt.201} | 3 +- .../stubs/AbstractMultiHighlightingTest.kt | 4 +- ...2 => AbstractMultiHighlightingTest.kt.201} | 4 +- .../jps/build/AbstractIncrementalJpsTest.kt | 1 - ....202 => AbstractIncrementalJpsTest.kt.201} | 1 + .../kotlin/jps/build/KotlinJpsBuildTest.kt | 2 +- ...dTest.kt.202 => KotlinJpsBuildTest.kt.201} | 2 +- .../KotlinUastCodeGenerationPlugin.kt | 46 +++++++++---------- ... => KotlinUastCodeGenerationPlugin.kt.201} | 46 +++++++++---------- tests/mute-platform.csv | 3 +- ...platform.csv.202 => mute-platform.csv.201} | 3 +- 86 files changed, 262 insertions(+), 263 deletions(-) rename compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/common/{TypeAnnotatedFrames.kt.202 => TypeAnnotatedFrames.kt.201} (87%) rename compiler/backend/src/org/jetbrains/kotlin/codegen/state/{JvmMethodExceptionTypes.kt.202 => JvmMethodExceptionTypes.kt.201} (82%) rename compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/{DefaultDiagnosticReporter.kt.202 => DefaultDiagnosticReporter.kt.201} (96%) rename compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/{MessageUtil.java.202 => MessageUtil.java.201} (61%) rename compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/{compat.kt.202 => compat.kt.201} (81%) rename compiler/testData/multiplatform/regressions/kt28385/{output.txt.202 => output.txt.201} (100%) rename compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/{KtParsingTestCase.java.202 => KtParsingTestCase.java.201} (99%) rename compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/{KtUsefulTestCase.java.202 => KtUsefulTestCase.java.201} (99%) rename gradle/{versions.properties.202 => versions.properties.201} (75%) rename idea/idea-completion/testData/basic/multifile/PropertyKeysEmptyString/{PropertyKeysEmptyString.kt.202 => PropertyKeysEmptyString.kt.201} (68%) rename idea/idea-completion/testData/basic/multifile/PropertyKeysNoPrefix/{PropertyKeysNoPrefix.kt.202 => PropertyKeysNoPrefix.kt.201} (70%) rename idea/idea-completion/testData/basic/multifile/PropertyKeysWithPrefix/{PropertyKeysWithPrefix.kt.202 => PropertyKeysWithPrefix.kt.201} (71%) rename idea/idea-core/src/org/jetbrains/kotlin/idea/{DaemonCodeAnalyzerStatusService.kt.202 => DaemonCodeAnalyzerStatusService.kt.201} (96%) rename idea/idea-gradle/src/org/jetbrains/kotlin/idea/actions/{ShowKotlinGradleDslLogs.kt.202 => ShowKotlinGradleDslLogs.kt.201} (99%) rename idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/{PluginTestCaseBase.java.202 => PluginTestCaseBase.java.201} (97%) rename idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/{compat.kt.202 => compat.kt.201} (57%) rename idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/render/{KotlinClassWithDelegatedPropertyRenderer.kt.202 => KotlinClassWithDelegatedPropertyRenderer.kt.201} (94%) rename idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/{gradleRoutines.kt.202 => gradleRoutines.kt.201} (92%) rename idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/{projectRoutines.kt.202 => projectRoutines.kt.201} (93%) rename idea/resources-descriptors/META-INF/{plugin.xml.202 => plugin.xml.201} (94%) rename idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/{ScratchLineMarkersTest.kt.202 => ScratchLineMarkersTest.kt.201} (96%) rename idea/src/org/jetbrains/kotlin/idea/highlighter/{KotlinHighlightExitPointsHandlerFactory.kt.202 => KotlinHighlightExitPointsHandlerFactory.kt.201} (96%) rename idea/src/org/jetbrains/kotlin/idea/highlighter/{KotlinHighlightImplicitItHandlerFactory.kt.202 => KotlinHighlightImplicitItHandlerFactory.kt.201} (90%) rename idea/src/org/jetbrains/kotlin/idea/highlighter/{KotlinRecursiveCallLineMarkerProvider.kt.202 => KotlinRecursiveCallLineMarkerProvider.kt.201} (98%) rename idea/src/org/jetbrains/kotlin/idea/highlighter/{KotlinSuspendCallLineMarkerProvider.kt.202 => KotlinSuspendCallLineMarkerProvider.kt.201} (99%) rename idea/src/org/jetbrains/kotlin/idea/highlighter/markers/{LineMarkerInfos.kt.202 => LineMarkerInfos.kt.201} (82%) rename idea/src/org/jetbrains/kotlin/idea/inspections/{TrailingCommaInspection.kt.202 => TrailingCommaInspection.kt.201} (99%) rename idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/{KotlinMutableMethodDescriptor.kt.202 => KotlinMutableMethodDescriptor.kt.201} (100%) rename idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/{KotlinTargetElementEvaluator.kt.202 => KotlinTargetElementEvaluator.kt.201} (99%) rename idea/src/org/jetbrains/kotlin/idea/slicer/{KotlinSliceProvider.kt.202 => KotlinSliceProvider.kt.201} (97%) rename idea/tests/org/jetbrains/kotlin/idea/codeInsight/{AbstractLineMarkersTest.kt.202 => AbstractLineMarkersTest.kt.201} (95%) rename idea/tests/org/jetbrains/kotlin/idea/codeInsight/{AbstractLineMarkersTestInLibrarySources.kt.202 => AbstractLineMarkersTestInLibrarySources.kt.201} (94%) rename idea/tests/org/jetbrains/kotlin/idea/highlighter/{AbstractUsageHighlightingTest.kt.202 => AbstractUsageHighlightingTest.kt.201} (95%) rename idea/tests/org/jetbrains/kotlin/idea/inspections/{InspectionDescriptionTest.kt.202 => InspectionDescriptionTest.kt.201} (98%) rename idea/tests/org/jetbrains/kotlin/idea/intentions/{IntentionDescriptionTest.kt.202 => IntentionDescriptionTest.kt.201} (95%) rename idea/tests/org/jetbrains/kotlin/idea/navigation/{GotoCheck.kt.202 => GotoCheck.kt.201} (97%) rename idea/tests/org/jetbrains/kotlin/idea/resolve/{AbstractAdditionalResolveDescriptorRendererTest.kt.202 => AbstractAdditionalResolveDescriptorRendererTest.kt.201} (88%) rename idea/tests/org/jetbrains/kotlin/idea/slicer/{SlicerTestUtil.kt.202 => SlicerTestUtil.kt.201} (97%) rename idea/tests/org/jetbrains/kotlin/idea/stubs/{AbstractMultiHighlightingTest.kt.202 => AbstractMultiHighlightingTest.kt.201} (91%) rename jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/{AbstractIncrementalJpsTest.kt.202 => AbstractIncrementalJpsTest.kt.201} (99%) rename jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/{KotlinJpsBuildTest.kt.202 => KotlinJpsBuildTest.kt.201} (99%) rename plugins/uast-kotlin-idea/src/org/jetbrains/uast/kotlin/generate/{KotlinUastCodeGenerationPlugin.kt.202 => KotlinUastCodeGenerationPlugin.kt.201} (91%) rename tests/{mute-platform.csv.202 => mute-platform.csv.201} (98%) diff --git a/.bunch b/.bunch index f5620837a2a..951ad47e8be 100644 --- a/.bunch +++ b/.bunch @@ -1,7 +1,6 @@ -201 202 -203_202 -193 -as40_193 -as41 -as42_202 \ No newline at end of file +201 +193_201 +as40_193_201 +as41_201 +as42 \ No newline at end of file diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/common/TypeAnnotatedFrames.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/common/TypeAnnotatedFrames.kt index 774af1054df..06673d28376 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/common/TypeAnnotatedFrames.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/common/TypeAnnotatedFrames.kt @@ -8,4 +8,4 @@ package org.jetbrains.kotlin.codegen.optimization.common import org.jetbrains.org.objectweb.asm.tree.analysis.BasicValue import org.jetbrains.org.objectweb.asm.tree.analysis.Frame -typealias TypeAnnotatedFrames = Array?> \ No newline at end of file +typealias TypeAnnotatedFrames = Array> \ No newline at end of file diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/common/TypeAnnotatedFrames.kt.202 b/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/common/TypeAnnotatedFrames.kt.201 similarity index 87% rename from compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/common/TypeAnnotatedFrames.kt.202 rename to compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/common/TypeAnnotatedFrames.kt.201 index 06673d28376..774af1054df 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/common/TypeAnnotatedFrames.kt.202 +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/common/TypeAnnotatedFrames.kt.201 @@ -8,4 +8,4 @@ package org.jetbrains.kotlin.codegen.optimization.common import org.jetbrains.org.objectweb.asm.tree.analysis.BasicValue import org.jetbrains.org.objectweb.asm.tree.analysis.Frame -typealias TypeAnnotatedFrames = Array> \ No newline at end of file +typealias TypeAnnotatedFrames = Array?> \ No newline at end of file diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/JvmMethodExceptionTypes.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/JvmMethodExceptionTypes.kt index ebab87ad525..ee6e1762506 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/JvmMethodExceptionTypes.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/JvmMethodExceptionTypes.kt @@ -5,4 +5,4 @@ package org.jetbrains.kotlin.codegen.state -typealias JvmMethodExceptionTypes = Array? \ No newline at end of file +typealias JvmMethodExceptionTypes = Array? \ No newline at end of file diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/JvmMethodExceptionTypes.kt.202 b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/JvmMethodExceptionTypes.kt.201 similarity index 82% rename from compiler/backend/src/org/jetbrains/kotlin/codegen/state/JvmMethodExceptionTypes.kt.202 rename to compiler/backend/src/org/jetbrains/kotlin/codegen/state/JvmMethodExceptionTypes.kt.201 index ee6e1762506..ebab87ad525 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/JvmMethodExceptionTypes.kt.202 +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/JvmMethodExceptionTypes.kt.201 @@ -5,4 +5,4 @@ package org.jetbrains.kotlin.codegen.state -typealias JvmMethodExceptionTypes = Array? \ No newline at end of file +typealias JvmMethodExceptionTypes = Array? \ No newline at end of file diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt index 2d82644bf95..f560fc945f3 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt @@ -31,6 +31,6 @@ interface MessageCollectorBasedReporter : DiagnosticMessageReporter { override fun report(diagnostic: Diagnostic, file: PsiFile, render: String) = messageCollector.report( AnalyzerWithCompilerReport.convertSeverity(diagnostic.severity), render, - MessageUtil.psiFileToMessageLocation(file, file.name, DiagnosticUtils.getLineAndColumnRange(diagnostic)) + MessageUtil.psiFileToMessageLocation(file, file.name, DiagnosticUtils.getLineAndColumn(diagnostic)) ) } diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt.202 b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt.201 similarity index 96% rename from compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt.202 rename to compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt.201 index f560fc945f3..2d82644bf95 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt.202 +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt.201 @@ -31,6 +31,6 @@ interface MessageCollectorBasedReporter : DiagnosticMessageReporter { override fun report(diagnostic: Diagnostic, file: PsiFile, render: String) = messageCollector.report( AnalyzerWithCompilerReport.convertSeverity(diagnostic.severity), render, - MessageUtil.psiFileToMessageLocation(file, file.name, DiagnosticUtils.getLineAndColumn(diagnostic)) + MessageUtil.psiFileToMessageLocation(file, file.name, DiagnosticUtils.getLineAndColumnRange(diagnostic)) ) } diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/MessageUtil.java b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/MessageUtil.java index 03f291ec68f..2ac1c17091e 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/MessageUtil.java +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/MessageUtil.java @@ -17,8 +17,6 @@ package org.jetbrains.kotlin.cli.common.messages; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.openapi.vfs.impl.jar.CoreJarVirtualFile; -import com.intellij.openapi.vfs.local.CoreLocalVirtualFile; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import org.jetbrains.annotations.NotNull; @@ -32,31 +30,25 @@ public class MessageUtil { private MessageUtil() {} @Nullable - public static CompilerMessageSourceLocation psiElementToMessageLocation(@Nullable PsiElement element) { + public static CompilerMessageLocation psiElementToMessageLocation(@Nullable PsiElement element) { if (element == null) return null; PsiFile file = element.getContainingFile(); - return psiFileToMessageLocation(file, "", DiagnosticUtils.getLineAndColumnRangeInPsiFile(file, element.getTextRange())); + return psiFileToMessageLocation(file, "", DiagnosticUtils.getLineAndColumnInPsiFile(file, element.getTextRange())); } @Nullable - public static CompilerMessageSourceLocation psiFileToMessageLocation( + public static CompilerMessageLocation psiFileToMessageLocation( @NotNull PsiFile file, @Nullable String defaultValue, - @NotNull PsiDiagnosticUtils.LineAndColumnRange range + @NotNull PsiDiagnosticUtils.LineAndColumn lineAndColumn ) { VirtualFile virtualFile = file.getVirtualFile(); String path = virtualFile != null ? virtualFileToPath(virtualFile) : defaultValue; - PsiDiagnosticUtils.LineAndColumn start = range.getStart(); - PsiDiagnosticUtils.LineAndColumn end = range.getEnd(); - return CompilerMessageLocationWithRange.create(path, start.getLine(), start.getColumn(), end.getLine(), end.getColumn(), start.getLineContent()); + return CompilerMessageLocation.create(path, lineAndColumn.getLine(), lineAndColumn.getColumn(), lineAndColumn.getLineContent()); } @NotNull public static String virtualFileToPath(@NotNull VirtualFile virtualFile) { - // Convert path to platform-dependent format when virtualFile is local file. - if (virtualFile instanceof CoreLocalVirtualFile || virtualFile instanceof CoreJarVirtualFile) { - return toSystemDependentName(virtualFile.getPath()); - } - return virtualFile.getPath(); + return toSystemDependentName(virtualFile.getPath()); } } diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/MessageUtil.java.202 b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/MessageUtil.java.201 similarity index 61% rename from compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/MessageUtil.java.202 rename to compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/MessageUtil.java.201 index 2ac1c17091e..03f291ec68f 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/MessageUtil.java.202 +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/MessageUtil.java.201 @@ -17,6 +17,8 @@ package org.jetbrains.kotlin.cli.common.messages; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.openapi.vfs.impl.jar.CoreJarVirtualFile; +import com.intellij.openapi.vfs.local.CoreLocalVirtualFile; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import org.jetbrains.annotations.NotNull; @@ -30,25 +32,31 @@ public class MessageUtil { private MessageUtil() {} @Nullable - public static CompilerMessageLocation psiElementToMessageLocation(@Nullable PsiElement element) { + public static CompilerMessageSourceLocation psiElementToMessageLocation(@Nullable PsiElement element) { if (element == null) return null; PsiFile file = element.getContainingFile(); - return psiFileToMessageLocation(file, "", DiagnosticUtils.getLineAndColumnInPsiFile(file, element.getTextRange())); + return psiFileToMessageLocation(file, "", DiagnosticUtils.getLineAndColumnRangeInPsiFile(file, element.getTextRange())); } @Nullable - public static CompilerMessageLocation psiFileToMessageLocation( + public static CompilerMessageSourceLocation psiFileToMessageLocation( @NotNull PsiFile file, @Nullable String defaultValue, - @NotNull PsiDiagnosticUtils.LineAndColumn lineAndColumn + @NotNull PsiDiagnosticUtils.LineAndColumnRange range ) { VirtualFile virtualFile = file.getVirtualFile(); String path = virtualFile != null ? virtualFileToPath(virtualFile) : defaultValue; - return CompilerMessageLocation.create(path, lineAndColumn.getLine(), lineAndColumn.getColumn(), lineAndColumn.getLineContent()); + PsiDiagnosticUtils.LineAndColumn start = range.getStart(); + PsiDiagnosticUtils.LineAndColumn end = range.getEnd(); + return CompilerMessageLocationWithRange.create(path, start.getLine(), start.getColumn(), end.getLine(), end.getColumn(), start.getLineContent()); } @NotNull public static String virtualFileToPath(@NotNull VirtualFile virtualFile) { - return toSystemDependentName(virtualFile.getPath()); + // Convert path to platform-dependent format when virtualFile is local file. + if (virtualFile instanceof CoreLocalVirtualFile || virtualFile instanceof CoreJarVirtualFile) { + return toSystemDependentName(virtualFile.getPath()); + } + return virtualFile.getPath(); } } diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/compat.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/compat.kt index 1a12369aa17..0fac43918da 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/compat.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/compat.kt @@ -12,4 +12,6 @@ fun setupIdeaStandaloneExecution() { System.getProperties().setProperty("psi.incremental.reparse.depth.limit", "1000") System.getProperties().setProperty("ide.hide.excluded.files", "false") System.getProperties().setProperty("ast.loading.filter", "false") + System.getProperties().setProperty("idea.ignore.disabled.plugins", "true") + System.getProperties().setProperty("idea.home.path", System.getProperty("java.io.tmpdir")) } \ No newline at end of file diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/compat.kt.202 b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/compat.kt.201 similarity index 81% rename from compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/compat.kt.202 rename to compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/compat.kt.201 index 0fac43918da..1a12369aa17 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/compat.kt.202 +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/compat.kt.201 @@ -12,6 +12,4 @@ fun setupIdeaStandaloneExecution() { System.getProperties().setProperty("psi.incremental.reparse.depth.limit", "1000") System.getProperties().setProperty("ide.hide.excluded.files", "false") System.getProperties().setProperty("ast.loading.filter", "false") - System.getProperties().setProperty("idea.ignore.disabled.plugins", "true") - System.getProperties().setProperty("idea.home.path", System.getProperty("java.io.tmpdir")) } \ No newline at end of file diff --git a/compiler/testData/multiplatform/regressions/kt28385/output.txt b/compiler/testData/multiplatform/regressions/kt28385/output.txt index 6d9721f5fde..426962dee24 100644 --- a/compiler/testData/multiplatform/regressions/kt28385/output.txt +++ b/compiler/testData/multiplatform/regressions/kt28385/output.txt @@ -14,9 +14,9 @@ sdax = { compiler/testData/multiplatform/regressions/kt28385/jvm.kt:5:8: error: expecting a top level declaration sdax = { ^ -compiler/testData/multiplatform/regressions/kt28385/jvm.kt:3:1: error: property must be initialized -val dasda -^ compiler/testData/multiplatform/regressions/kt28385/jvm.kt:5:8: error: function declaration must have a name sdax = { ^ +compiler/testData/multiplatform/regressions/kt28385/jvm.kt:3:1: error: property must be initialized +val dasda +^ diff --git a/compiler/testData/multiplatform/regressions/kt28385/output.txt.202 b/compiler/testData/multiplatform/regressions/kt28385/output.txt.201 similarity index 100% rename from compiler/testData/multiplatform/regressions/kt28385/output.txt.202 rename to compiler/testData/multiplatform/regressions/kt28385/output.txt.201 index 426962dee24..6d9721f5fde 100644 --- a/compiler/testData/multiplatform/regressions/kt28385/output.txt.202 +++ b/compiler/testData/multiplatform/regressions/kt28385/output.txt.201 @@ -12,11 +12,11 @@ compiler/testData/multiplatform/regressions/kt28385/jvm.kt:5:6: error: expecting sdax = { ^ compiler/testData/multiplatform/regressions/kt28385/jvm.kt:5:8: error: expecting a top level declaration -sdax = { - ^ -compiler/testData/multiplatform/regressions/kt28385/jvm.kt:5:8: error: function declaration must have a name sdax = { ^ compiler/testData/multiplatform/regressions/kt28385/jvm.kt:3:1: error: property must be initialized val dasda ^ +compiler/testData/multiplatform/regressions/kt28385/jvm.kt:5:8: error: function declaration must have a name +sdax = { + ^ diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtParsingTestCase.java b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtParsingTestCase.java index 2e42e3a75b2..912863a2f55 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtParsingTestCase.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtParsingTestCase.java @@ -140,7 +140,6 @@ public abstract class KtParsingTestCase extends KtPlatformLiteFixture { // That's for reparse routines final PomModelImpl pomModel = new PomModelImpl(myProject); myProject.registerService(PomModel.class, pomModel); - new TreeAspect(pomModel); } public void configureFromParserDefinition(ParserDefinition definition, String extension) { diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtParsingTestCase.java.202 b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtParsingTestCase.java.201 similarity index 99% rename from compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtParsingTestCase.java.202 rename to compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtParsingTestCase.java.201 index 912863a2f55..2e42e3a75b2 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtParsingTestCase.java.202 +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtParsingTestCase.java.201 @@ -140,6 +140,7 @@ public abstract class KtParsingTestCase extends KtPlatformLiteFixture { // That's for reparse routines final PomModelImpl pomModel = new PomModelImpl(myProject); myProject.registerService(PomModel.class, pomModel); + new TreeAspect(pomModel); } public void configureFromParserDefinition(ParserDefinition definition, String extension) { diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java index e651e41048b..21f6510293e 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java @@ -82,6 +82,9 @@ import java.util.*; import java.util.concurrent.TimeUnit; import java.util.function.Supplier; +/** + * @author peter + */ @SuppressWarnings("ALL") public abstract class KtUsefulTestCase extends TestCase { public static final boolean IS_UNDER_TEAMCITY = System.getenv("TEAMCITY_VERSION") != null; @@ -1081,8 +1084,7 @@ public abstract class KtUsefulTestCase extends TestCase { if (shouldOccur) { wasThrown = true; - final String errorMessage = exceptionCase.getAssertionErrorMessage(); - assertEquals(errorMessage, exceptionCase.getExpectedExceptionClass(), cause.getClass()); + assertInstanceOf(cause, exceptionCase.getExpectedExceptionClass()); if (expectedErrorMsgPart != null) { assertTrue(cause.getMessage(), cause.getMessage().contains(expectedErrorMsgPart)); } @@ -1103,7 +1105,7 @@ public abstract class KtUsefulTestCase extends TestCase { } finally { if (shouldOccur && !wasThrown) { - fail(exceptionCase.getAssertionErrorMessage()); + fail(exceptionCase.getExpectedExceptionClass().getName() + " must be thrown."); } } } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.202 b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.201 similarity index 99% rename from compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.202 rename to compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.201 index 21f6510293e..e651e41048b 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.202 +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.201 @@ -82,9 +82,6 @@ import java.util.*; import java.util.concurrent.TimeUnit; import java.util.function.Supplier; -/** - * @author peter - */ @SuppressWarnings("ALL") public abstract class KtUsefulTestCase extends TestCase { public static final boolean IS_UNDER_TEAMCITY = System.getenv("TEAMCITY_VERSION") != null; @@ -1084,7 +1081,8 @@ public abstract class KtUsefulTestCase extends TestCase { if (shouldOccur) { wasThrown = true; - assertInstanceOf(cause, exceptionCase.getExpectedExceptionClass()); + final String errorMessage = exceptionCase.getAssertionErrorMessage(); + assertEquals(errorMessage, exceptionCase.getExpectedExceptionClass(), cause.getClass()); if (expectedErrorMsgPart != null) { assertTrue(cause.getMessage(), cause.getMessage().contains(expectedErrorMsgPart)); } @@ -1105,7 +1103,7 @@ public abstract class KtUsefulTestCase extends TestCase { } finally { if (shouldOccur && !wasThrown) { - fail(exceptionCase.getExpectedExceptionClass().getName() + " must be thrown."); + fail(exceptionCase.getAssertionErrorMessage()); } } } diff --git a/gradle/versions.properties b/gradle/versions.properties index bd6471bb797..7b464ab8092 100644 --- a/gradle/versions.properties +++ b/gradle/versions.properties @@ -1,9 +1,9 @@ -versions.intellijSdk=201.7223.91 +versions.intellijSdk=202.5103-EAP-CANDIDATE-SNAPSHOT versions.androidBuildTools=r23.0.1 versions.idea.NodeJS=193.6494.7 -versions.jar.asm-all=7.0.1 -versions.jar.guava=28.2-jre -versions.jar.groovy-all=2.4.17 +versions.jar.asm-all=8.0.1 +versions.jar.guava=29.0-jre +versions.jar.groovy=2.5.11 versions.jar.lombok-ast=0.2.3 versions.jar.swingx-core=1.6.2-2 versions.jar.kxml2=2.3.0 diff --git a/gradle/versions.properties.202 b/gradle/versions.properties.201 similarity index 75% rename from gradle/versions.properties.202 rename to gradle/versions.properties.201 index 7b464ab8092..bd6471bb797 100644 --- a/gradle/versions.properties.202 +++ b/gradle/versions.properties.201 @@ -1,9 +1,9 @@ -versions.intellijSdk=202.5103-EAP-CANDIDATE-SNAPSHOT +versions.intellijSdk=201.7223.91 versions.androidBuildTools=r23.0.1 versions.idea.NodeJS=193.6494.7 -versions.jar.asm-all=8.0.1 -versions.jar.guava=29.0-jre -versions.jar.groovy=2.5.11 +versions.jar.asm-all=7.0.1 +versions.jar.guava=28.2-jre +versions.jar.groovy-all=2.4.17 versions.jar.lombok-ast=0.2.3 versions.jar.swingx-core=1.6.2-2 versions.jar.kxml2=2.3.0 diff --git a/idea/idea-completion/testData/basic/multifile/PropertyKeysEmptyString/PropertyKeysEmptyString.kt b/idea/idea-completion/testData/basic/multifile/PropertyKeysEmptyString/PropertyKeysEmptyString.kt index 40cb12de4ac..c4ad17de026 100644 --- a/idea/idea-completion/testData/basic/multifile/PropertyKeysEmptyString/PropertyKeysEmptyString.kt +++ b/idea/idea-completion/testData/basic/multifile/PropertyKeysEmptyString/PropertyKeysEmptyString.kt @@ -6,8 +6,8 @@ fun test() { message("") } -// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "1", typeText: "PropertyKeysEmptyString" } -// EXIST: { lookupString: "bar.baz", itemText: "bar.baz", tailText: "2", typeText: "PropertyKeysEmptyString" } -// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "3", typeText: "PropertyKeysEmptyString" } -// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "4", typeText: "PropertyKeysEmptyString" } +// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "=1", typeText: "PropertyKeysEmptyString" } +// EXIST: { lookupString: "bar.baz", itemText: "bar.baz", tailText: "=2", typeText: "PropertyKeysEmptyString" } +// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "=3", typeText: "PropertyKeysEmptyString" } +// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "=4", typeText: "PropertyKeysEmptyString" } // NOTHING_ELSE \ No newline at end of file diff --git a/idea/idea-completion/testData/basic/multifile/PropertyKeysEmptyString/PropertyKeysEmptyString.kt.202 b/idea/idea-completion/testData/basic/multifile/PropertyKeysEmptyString/PropertyKeysEmptyString.kt.201 similarity index 68% rename from idea/idea-completion/testData/basic/multifile/PropertyKeysEmptyString/PropertyKeysEmptyString.kt.202 rename to idea/idea-completion/testData/basic/multifile/PropertyKeysEmptyString/PropertyKeysEmptyString.kt.201 index c4ad17de026..40cb12de4ac 100644 --- a/idea/idea-completion/testData/basic/multifile/PropertyKeysEmptyString/PropertyKeysEmptyString.kt.202 +++ b/idea/idea-completion/testData/basic/multifile/PropertyKeysEmptyString/PropertyKeysEmptyString.kt.201 @@ -6,8 +6,8 @@ fun test() { message("") } -// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "=1", typeText: "PropertyKeysEmptyString" } -// EXIST: { lookupString: "bar.baz", itemText: "bar.baz", tailText: "=2", typeText: "PropertyKeysEmptyString" } -// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "=3", typeText: "PropertyKeysEmptyString" } -// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "=4", typeText: "PropertyKeysEmptyString" } +// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "1", typeText: "PropertyKeysEmptyString" } +// EXIST: { lookupString: "bar.baz", itemText: "bar.baz", tailText: "2", typeText: "PropertyKeysEmptyString" } +// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "3", typeText: "PropertyKeysEmptyString" } +// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "4", typeText: "PropertyKeysEmptyString" } // NOTHING_ELSE \ No newline at end of file diff --git a/idea/idea-completion/testData/basic/multifile/PropertyKeysNoPrefix/PropertyKeysNoPrefix.kt b/idea/idea-completion/testData/basic/multifile/PropertyKeysNoPrefix/PropertyKeysNoPrefix.kt index e3412202680..516f3384684 100644 --- a/idea/idea-completion/testData/basic/multifile/PropertyKeysNoPrefix/PropertyKeysNoPrefix.kt +++ b/idea/idea-completion/testData/basic/multifile/PropertyKeysNoPrefix/PropertyKeysNoPrefix.kt @@ -6,8 +6,8 @@ fun test() { message("foo") } -// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "1", typeText: "PropertyKeysNoPrefix" } -// EXIST: { lookupString: "bar.baz", itemText: "bar.baz", tailText: "2", typeText: "PropertyKeysNoPrefix" } -// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "3", typeText: "PropertyKeysNoPrefix" } -// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "4", typeText: "PropertyKeysNoPrefix" } +// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "=1", typeText: "PropertyKeysNoPrefix" } +// EXIST: { lookupString: "bar.baz", itemText: "bar.baz", tailText: "=2", typeText: "PropertyKeysNoPrefix" } +// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "=3", typeText: "PropertyKeysNoPrefix" } +// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "=4", typeText: "PropertyKeysNoPrefix" } // NOTHING_ELSE \ No newline at end of file diff --git a/idea/idea-completion/testData/basic/multifile/PropertyKeysNoPrefix/PropertyKeysNoPrefix.kt.202 b/idea/idea-completion/testData/basic/multifile/PropertyKeysNoPrefix/PropertyKeysNoPrefix.kt.201 similarity index 70% rename from idea/idea-completion/testData/basic/multifile/PropertyKeysNoPrefix/PropertyKeysNoPrefix.kt.202 rename to idea/idea-completion/testData/basic/multifile/PropertyKeysNoPrefix/PropertyKeysNoPrefix.kt.201 index 516f3384684..e3412202680 100644 --- a/idea/idea-completion/testData/basic/multifile/PropertyKeysNoPrefix/PropertyKeysNoPrefix.kt.202 +++ b/idea/idea-completion/testData/basic/multifile/PropertyKeysNoPrefix/PropertyKeysNoPrefix.kt.201 @@ -6,8 +6,8 @@ fun test() { message("foo") } -// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "=1", typeText: "PropertyKeysNoPrefix" } -// EXIST: { lookupString: "bar.baz", itemText: "bar.baz", tailText: "=2", typeText: "PropertyKeysNoPrefix" } -// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "=3", typeText: "PropertyKeysNoPrefix" } -// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "=4", typeText: "PropertyKeysNoPrefix" } +// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "1", typeText: "PropertyKeysNoPrefix" } +// EXIST: { lookupString: "bar.baz", itemText: "bar.baz", tailText: "2", typeText: "PropertyKeysNoPrefix" } +// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "3", typeText: "PropertyKeysNoPrefix" } +// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "4", typeText: "PropertyKeysNoPrefix" } // NOTHING_ELSE \ No newline at end of file diff --git a/idea/idea-completion/testData/basic/multifile/PropertyKeysWithPrefix/PropertyKeysWithPrefix.kt b/idea/idea-completion/testData/basic/multifile/PropertyKeysWithPrefix/PropertyKeysWithPrefix.kt index c6459771214..bded1a4af88 100644 --- a/idea/idea-completion/testData/basic/multifile/PropertyKeysWithPrefix/PropertyKeysWithPrefix.kt +++ b/idea/idea-completion/testData/basic/multifile/PropertyKeysWithPrefix/PropertyKeysWithPrefix.kt @@ -6,7 +6,7 @@ fun test() { message("foo.") } -// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "1", typeText: "PropertyKeysWithPrefix" } -// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "3", typeText: "PropertyKeysWithPrefix" } -// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "4", typeText: "PropertyKeysWithPrefix" } +// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "=1", typeText: "PropertyKeysWithPrefix" } +// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "=3", typeText: "PropertyKeysWithPrefix" } +// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "=4", typeText: "PropertyKeysWithPrefix" } // NOTHING_ELSE \ No newline at end of file diff --git a/idea/idea-completion/testData/basic/multifile/PropertyKeysWithPrefix/PropertyKeysWithPrefix.kt.202 b/idea/idea-completion/testData/basic/multifile/PropertyKeysWithPrefix/PropertyKeysWithPrefix.kt.201 similarity index 71% rename from idea/idea-completion/testData/basic/multifile/PropertyKeysWithPrefix/PropertyKeysWithPrefix.kt.202 rename to idea/idea-completion/testData/basic/multifile/PropertyKeysWithPrefix/PropertyKeysWithPrefix.kt.201 index bded1a4af88..c6459771214 100644 --- a/idea/idea-completion/testData/basic/multifile/PropertyKeysWithPrefix/PropertyKeysWithPrefix.kt.202 +++ b/idea/idea-completion/testData/basic/multifile/PropertyKeysWithPrefix/PropertyKeysWithPrefix.kt.201 @@ -6,7 +6,7 @@ fun test() { message("foo.") } -// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "=1", typeText: "PropertyKeysWithPrefix" } -// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "=3", typeText: "PropertyKeysWithPrefix" } -// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "=4", typeText: "PropertyKeysWithPrefix" } +// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "1", typeText: "PropertyKeysWithPrefix" } +// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "3", typeText: "PropertyKeysWithPrefix" } +// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "4", typeText: "PropertyKeysWithPrefix" } // NOTHING_ELSE \ No newline at end of file diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/DaemonCodeAnalyzerStatusService.kt b/idea/idea-core/src/org/jetbrains/kotlin/idea/DaemonCodeAnalyzerStatusService.kt index 526a762cab2..0eaadbe3162 100644 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/DaemonCodeAnalyzerStatusService.kt +++ b/idea/idea-core/src/org/jetbrains/kotlin/idea/DaemonCodeAnalyzerStatusService.kt @@ -23,11 +23,11 @@ class DaemonCodeAnalyzerStatusService(project: Project) : Disposable { init { val messageBusConnection = project.messageBus.connect(this) messageBusConnection.subscribe(DaemonCodeAnalyzer.DAEMON_EVENT_TOPIC, object : DaemonCodeAnalyzer.DaemonListener { - override fun daemonStarting(fileEditors: MutableCollection) { + override fun daemonStarting(fileEditors: MutableCollection) { daemonRunning = true } - override fun daemonFinished(fileEditors: MutableCollection) { + override fun daemonFinished(fileEditors: MutableCollection) { daemonRunning = false } diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/DaemonCodeAnalyzerStatusService.kt.202 b/idea/idea-core/src/org/jetbrains/kotlin/idea/DaemonCodeAnalyzerStatusService.kt.201 similarity index 96% rename from idea/idea-core/src/org/jetbrains/kotlin/idea/DaemonCodeAnalyzerStatusService.kt.202 rename to idea/idea-core/src/org/jetbrains/kotlin/idea/DaemonCodeAnalyzerStatusService.kt.201 index 0eaadbe3162..526a762cab2 100644 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/DaemonCodeAnalyzerStatusService.kt.202 +++ b/idea/idea-core/src/org/jetbrains/kotlin/idea/DaemonCodeAnalyzerStatusService.kt.201 @@ -23,11 +23,11 @@ class DaemonCodeAnalyzerStatusService(project: Project) : Disposable { init { val messageBusConnection = project.messageBus.connect(this) messageBusConnection.subscribe(DaemonCodeAnalyzer.DAEMON_EVENT_TOPIC, object : DaemonCodeAnalyzer.DaemonListener { - override fun daemonStarting(fileEditors: MutableCollection) { + override fun daemonStarting(fileEditors: MutableCollection) { daemonRunning = true } - override fun daemonFinished(fileEditors: MutableCollection) { + override fun daemonFinished(fileEditors: MutableCollection) { daemonRunning = false } diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/actions/ShowKotlinGradleDslLogs.kt b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/actions/ShowKotlinGradleDslLogs.kt index b103d5e48be..1451b364eb8 100644 --- a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/actions/ShowKotlinGradleDslLogs.kt +++ b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/actions/ShowKotlinGradleDslLogs.kt @@ -45,7 +45,7 @@ class ShowKotlinGradleDslLogs : IntentionAction, AnAction(), DumbAware { RevealFileAction.openDirectory(logsDir) } else { val parent = WindowManager.getInstance().getStatusBar(project)?.component - ?: WindowManager.getInstance().findVisibleFrame().rootPane + ?: WindowManager.getInstance().findVisibleFrame()?.rootPane JBPopupFactory.getInstance() .createHtmlTextBalloonBuilder( KotlinIdeaGradleBundle.message( diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/actions/ShowKotlinGradleDslLogs.kt.202 b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/actions/ShowKotlinGradleDslLogs.kt.201 similarity index 99% rename from idea/idea-gradle/src/org/jetbrains/kotlin/idea/actions/ShowKotlinGradleDslLogs.kt.202 rename to idea/idea-gradle/src/org/jetbrains/kotlin/idea/actions/ShowKotlinGradleDslLogs.kt.201 index 1451b364eb8..b103d5e48be 100644 --- a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/actions/ShowKotlinGradleDslLogs.kt.202 +++ b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/actions/ShowKotlinGradleDslLogs.kt.201 @@ -45,7 +45,7 @@ class ShowKotlinGradleDslLogs : IntentionAction, AnAction(), DumbAware { RevealFileAction.openDirectory(logsDir) } else { val parent = WindowManager.getInstance().getStatusBar(project)?.component - ?: WindowManager.getInstance().findVisibleFrame()?.rootPane + ?: WindowManager.getInstance().findVisibleFrame().rootPane JBPopupFactory.getInstance() .createHtmlTextBalloonBuilder( KotlinIdeaGradleBundle.message( diff --git a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/PluginTestCaseBase.java b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/PluginTestCaseBase.java index 7f060044289..16a8d2e0235 100644 --- a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/PluginTestCaseBase.java +++ b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/PluginTestCaseBase.java @@ -25,6 +25,7 @@ import com.intellij.openapi.projectRoots.impl.JavaSdkImpl; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; +import com.intellij.testFramework.IdeaTestUtil; import kotlin.jvm.functions.Function0; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.TestOnly; @@ -49,7 +50,7 @@ public class PluginTestCaseBase { @NotNull @TestOnly private static Sdk createMockJdk(@NotNull String name, String path) { - return ((JavaSdkImpl)JavaSdk.getInstance()).createMockJdk(name, path, false); + return IdeaTestUtil.createMockJdk(name, path, false); } @NotNull diff --git a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/PluginTestCaseBase.java.202 b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/PluginTestCaseBase.java.201 similarity index 97% rename from idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/PluginTestCaseBase.java.202 rename to idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/PluginTestCaseBase.java.201 index 16a8d2e0235..7f060044289 100644 --- a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/PluginTestCaseBase.java.202 +++ b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/PluginTestCaseBase.java.201 @@ -25,7 +25,6 @@ import com.intellij.openapi.projectRoots.impl.JavaSdkImpl; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; -import com.intellij.testFramework.IdeaTestUtil; import kotlin.jvm.functions.Function0; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.TestOnly; @@ -50,7 +49,7 @@ public class PluginTestCaseBase { @NotNull @TestOnly private static Sdk createMockJdk(@NotNull String name, String path) { - return IdeaTestUtil.createMockJdk(name, path, false); + return ((JavaSdkImpl)JavaSdk.getInstance()).createMockJdk(name, path, false); } @NotNull diff --git a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compat.kt b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compat.kt index 7a30408b6e9..546cf746145 100644 --- a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compat.kt +++ b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compat.kt @@ -5,11 +5,7 @@ package org.jetbrains.kotlin.idea.test -import com.intellij.ide.startup.impl.StartupManagerImpl import com.intellij.openapi.project.Project -import com.intellij.openapi.startup.StartupManager -// FIX ME WHEN BUNCH 201 REMOVED fun runPostStartupActivitiesOnce(project: Project) { - (StartupManager.getInstance(project) as StartupManagerImpl).runPostStartupActivitiesRegisteredDynamically() -} \ No newline at end of file +} diff --git a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compat.kt.202 b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compat.kt.201 similarity index 57% rename from idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compat.kt.202 rename to idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compat.kt.201 index 546cf746145..7a30408b6e9 100644 --- a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compat.kt.202 +++ b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compat.kt.201 @@ -5,7 +5,11 @@ package org.jetbrains.kotlin.idea.test +import com.intellij.ide.startup.impl.StartupManagerImpl import com.intellij.openapi.project.Project +import com.intellij.openapi.startup.StartupManager +// FIX ME WHEN BUNCH 201 REMOVED fun runPostStartupActivitiesOnce(project: Project) { -} + (StartupManager.getInstance(project) as StartupManagerImpl).runPostStartupActivitiesRegisteredDynamically() +} \ No newline at end of file diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/render/KotlinClassWithDelegatedPropertyRenderer.kt b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/render/KotlinClassWithDelegatedPropertyRenderer.kt index 45902d36701..274a6d11141 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/render/KotlinClassWithDelegatedPropertyRenderer.kt +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/render/KotlinClassWithDelegatedPropertyRenderer.kt @@ -63,9 +63,10 @@ class KotlinClassWithDelegatedPropertyRenderer : ClassRenderer() { ): String? { val toStringRenderer = rendererSettings.toStringRenderer if (toStringRenderer.isEnabled && DebuggerManagerEx.getInstanceEx(evaluationContext.project).context.canRunEvaluation) { - if (toStringRenderer.isApplicable(descriptor.type)) { - return toStringRenderer.calcLabel(descriptor, evaluationContext, listener) - } + val label = toStringRenderer.isApplicableAsync(descriptor.type).thenApply { applicable: Boolean -> + if (applicable) toStringRenderer.calcLabel(descriptor, evaluationContext, listener) else null + }.get() + return label } return null } diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/render/KotlinClassWithDelegatedPropertyRenderer.kt.202 b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/render/KotlinClassWithDelegatedPropertyRenderer.kt.201 similarity index 94% rename from idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/render/KotlinClassWithDelegatedPropertyRenderer.kt.202 rename to idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/render/KotlinClassWithDelegatedPropertyRenderer.kt.201 index 274a6d11141..45902d36701 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/render/KotlinClassWithDelegatedPropertyRenderer.kt.202 +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/render/KotlinClassWithDelegatedPropertyRenderer.kt.201 @@ -63,10 +63,9 @@ class KotlinClassWithDelegatedPropertyRenderer : ClassRenderer() { ): String? { val toStringRenderer = rendererSettings.toStringRenderer if (toStringRenderer.isEnabled && DebuggerManagerEx.getInstanceEx(evaluationContext.project).context.canRunEvaluation) { - val label = toStringRenderer.isApplicableAsync(descriptor.type).thenApply { applicable: Boolean -> - if (applicable) toStringRenderer.calcLabel(descriptor, evaluationContext, listener) else null - }.get() - return label + if (toStringRenderer.isApplicable(descriptor.type)) { + return toStringRenderer.calcLabel(descriptor, evaluationContext, listener) + } } return null } diff --git a/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/gradleRoutines.kt b/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/gradleRoutines.kt index 65ef655c68d..da3836f7aff 100644 --- a/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/gradleRoutines.kt +++ b/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/gradleRoutines.kt @@ -13,11 +13,13 @@ import com.intellij.openapi.externalSystem.util.ExternalSystemUtil import com.intellij.openapi.project.DumbService import com.intellij.openapi.project.Project import com.intellij.openapi.roots.ProjectRootManager +import org.gradle.util.GradleVersion import org.jetbrains.plugins.gradle.service.project.open.setupGradleSettings import org.jetbrains.plugins.gradle.settings.GradleProjectSettings import org.jetbrains.plugins.gradle.settings.GradleSettings import org.jetbrains.plugins.gradle.util.GradleConstants import org.jetbrains.plugins.gradle.util.GradleLog +import org.jetbrains.plugins.gradle.util.suggestGradleVersion import java.io.File import kotlin.test.assertNotNull @@ -34,14 +36,13 @@ const val GRADLE_JDK_NAME = "Gradle JDK" */ private fun _importProject(projectPath: String, project: Project) { GradleLog.LOG.info("Import project at $projectPath") - val projectSdk = ProjectRootManager.getInstance(project).projectSdk - assertNotNull(projectSdk, "project SDK not found for ${project.name} at $projectPath") val gradleProjectSettings = GradleProjectSettings() + val gradleVersion = suggestGradleVersion(project) ?: GradleVersion.current() GradleSettings.getInstance(project).gradleVmOptions = "-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${System.getProperty("user.dir")}" - setupGradleSettings(gradleProjectSettings, projectPath, project, projectSdk) + setupGradleSettings(project, gradleProjectSettings, projectPath, gradleVersion) gradleProjectSettings.gradleJvm = GRADLE_JDK_NAME GradleSettings.getInstance(project).getLinkedProjectSettings(projectPath)?.let { linkedProjectSettings -> diff --git a/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/gradleRoutines.kt.202 b/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/gradleRoutines.kt.201 similarity index 92% rename from idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/gradleRoutines.kt.202 rename to idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/gradleRoutines.kt.201 index da3836f7aff..65ef655c68d 100644 --- a/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/gradleRoutines.kt.202 +++ b/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/gradleRoutines.kt.201 @@ -13,13 +13,11 @@ import com.intellij.openapi.externalSystem.util.ExternalSystemUtil import com.intellij.openapi.project.DumbService import com.intellij.openapi.project.Project import com.intellij.openapi.roots.ProjectRootManager -import org.gradle.util.GradleVersion import org.jetbrains.plugins.gradle.service.project.open.setupGradleSettings import org.jetbrains.plugins.gradle.settings.GradleProjectSettings import org.jetbrains.plugins.gradle.settings.GradleSettings import org.jetbrains.plugins.gradle.util.GradleConstants import org.jetbrains.plugins.gradle.util.GradleLog -import org.jetbrains.plugins.gradle.util.suggestGradleVersion import java.io.File import kotlin.test.assertNotNull @@ -36,13 +34,14 @@ const val GRADLE_JDK_NAME = "Gradle JDK" */ private fun _importProject(projectPath: String, project: Project) { GradleLog.LOG.info("Import project at $projectPath") + val projectSdk = ProjectRootManager.getInstance(project).projectSdk + assertNotNull(projectSdk, "project SDK not found for ${project.name} at $projectPath") val gradleProjectSettings = GradleProjectSettings() - val gradleVersion = suggestGradleVersion(project) ?: GradleVersion.current() GradleSettings.getInstance(project).gradleVmOptions = "-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${System.getProperty("user.dir")}" - setupGradleSettings(project, gradleProjectSettings, projectPath, gradleVersion) + setupGradleSettings(gradleProjectSettings, projectPath, project, projectSdk) gradleProjectSettings.gradleJvm = GRADLE_JDK_NAME GradleSettings.getInstance(project).getLinkedProjectSettings(projectPath)?.let { linkedProjectSettings -> diff --git a/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt b/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt index 185f5d5167c..756f62ec7f0 100644 --- a/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt +++ b/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.idea.testFramework import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer import com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl +import com.intellij.ide.impl.OpenProjectTask import com.intellij.ide.startup.impl.StartupManagerImpl import com.intellij.lang.LanguageAnnotators import com.intellij.lang.LanguageExtensionPoint @@ -20,6 +21,7 @@ import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.openapi.project.Project import com.intellij.openapi.project.ex.ProjectManagerEx import com.intellij.openapi.startup.StartupManager +import com.intellij.platform.PlatformProjectOpenProcessor import com.intellij.psi.PsiDocumentManager import com.intellij.psi.impl.PsiDocumentManagerBase import com.intellij.testFramework.ExtensionTestUtil @@ -27,7 +29,6 @@ import com.intellij.testFramework.TestApplicationManager import com.intellij.testFramework.runInEdtAndWait import com.intellij.util.ui.UIUtil import org.jetbrains.kotlin.idea.perf.util.logMessage -import org.jetbrains.kotlin.idea.test.runPostStartupActivitiesOnce import java.nio.file.Paths fun commitAllDocuments() { @@ -69,7 +70,7 @@ fun dispatchAllInvocationEvents() { } fun loadProjectWithName(path: String, name: String): Project? = - ProjectManagerEx.getInstanceEx().loadProject(Paths.get(path), name) + PlatformProjectOpenProcessor.openExistingProject(Paths.get(path), Paths.get(path), OpenProjectTask(projectName = name)) fun TestApplicationManager.closeProject(project: Project) { val name = project.name @@ -90,11 +91,7 @@ fun TestApplicationManager.closeProject(project: Project) { } fun runStartupActivities(project: Project) { - with(StartupManager.getInstance(project) as StartupManagerImpl) { - //scheduleInitialVfsRefresh() - runStartupActivities() - } - runPostStartupActivitiesOnce(project) + // obsolete } fun waitForAllEditorsFinallyLoaded(project: Project) { diff --git a/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt.202 b/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt.201 similarity index 93% rename from idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt.202 rename to idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt.201 index 756f62ec7f0..185f5d5167c 100644 --- a/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt.202 +++ b/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt.201 @@ -8,7 +8,6 @@ package org.jetbrains.kotlin.idea.testFramework import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer import com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl -import com.intellij.ide.impl.OpenProjectTask import com.intellij.ide.startup.impl.StartupManagerImpl import com.intellij.lang.LanguageAnnotators import com.intellij.lang.LanguageExtensionPoint @@ -21,7 +20,6 @@ import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.openapi.project.Project import com.intellij.openapi.project.ex.ProjectManagerEx import com.intellij.openapi.startup.StartupManager -import com.intellij.platform.PlatformProjectOpenProcessor import com.intellij.psi.PsiDocumentManager import com.intellij.psi.impl.PsiDocumentManagerBase import com.intellij.testFramework.ExtensionTestUtil @@ -29,6 +27,7 @@ import com.intellij.testFramework.TestApplicationManager import com.intellij.testFramework.runInEdtAndWait import com.intellij.util.ui.UIUtil import org.jetbrains.kotlin.idea.perf.util.logMessage +import org.jetbrains.kotlin.idea.test.runPostStartupActivitiesOnce import java.nio.file.Paths fun commitAllDocuments() { @@ -70,7 +69,7 @@ fun dispatchAllInvocationEvents() { } fun loadProjectWithName(path: String, name: String): Project? = - PlatformProjectOpenProcessor.openExistingProject(Paths.get(path), Paths.get(path), OpenProjectTask(projectName = name)) + ProjectManagerEx.getInstanceEx().loadProject(Paths.get(path), name) fun TestApplicationManager.closeProject(project: Project) { val name = project.name @@ -91,7 +90,11 @@ fun TestApplicationManager.closeProject(project: Project) { } fun runStartupActivities(project: Project) { - // obsolete + with(StartupManager.getInstance(project) as StartupManagerImpl) { + //scheduleInitialVfsRefresh() + runStartupActivities() + } + runPostStartupActivitiesOnce(project) } fun waitForAllEditorsFinallyLoaded(project: Project) { diff --git a/idea/resources-descriptors/META-INF/plugin.xml b/idea/resources-descriptors/META-INF/plugin.xml index 8f5c88df3b5..7eb10ab8e9c 100644 --- a/idea/resources-descriptors/META-INF/plugin.xml +++ b/idea/resources-descriptors/META-INF/plugin.xml @@ -13,7 +13,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. @snapshot@ JetBrains - + 1.4.20 @@ -69,7 +69,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. - com.intellij.modules.idea + com.intellij.modules.androidstudio com.intellij.modules.java JavaScriptDebugger com.intellij.copyright @@ -110,7 +110,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. - + @@ -145,14 +145,11 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. - + - - + + diff --git a/idea/resources-descriptors/META-INF/plugin.xml.202 b/idea/resources-descriptors/META-INF/plugin.xml.201 similarity index 94% rename from idea/resources-descriptors/META-INF/plugin.xml.202 rename to idea/resources-descriptors/META-INF/plugin.xml.201 index 7eb10ab8e9c..8f5c88df3b5 100644 --- a/idea/resources-descriptors/META-INF/plugin.xml.202 +++ b/idea/resources-descriptors/META-INF/plugin.xml.201 @@ -13,7 +13,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. @snapshot@ JetBrains - + 1.4.20 @@ -69,7 +69,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. - com.intellij.modules.androidstudio + com.intellij.modules.idea com.intellij.modules.java JavaScriptDebugger com.intellij.copyright @@ -110,7 +110,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. - + @@ -145,11 +145,14 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. - + - - + + diff --git a/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/ScratchLineMarkersTest.kt b/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/ScratchLineMarkersTest.kt index ccc27114fbe..96dc27720a9 100644 --- a/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/ScratchLineMarkersTest.kt +++ b/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/ScratchLineMarkersTest.kt @@ -46,7 +46,7 @@ abstract class AbstractScratchLineMarkersTest : FileEditorManagerTestCase() { val project = myFixture.project val document = myFixture.editor.document - val data = ExpectedHighlightingData(document, false, false, false, myFixture.file) + val data = ExpectedHighlightingData(document, false, false, false) data.init() PsiDocumentManager.getInstance(project).commitAllDocuments() @@ -69,7 +69,7 @@ abstract class AbstractScratchLineMarkersTest : FileEditorManagerTestCase() { ): List> { myFixture.doHighlighting() - return AbstractLineMarkersTest.checkHighlighting(myFixture.project, documentToAnalyze, expectedHighlighting, expectedFile) + return AbstractLineMarkersTest.checkHighlighting(myFixture.file, documentToAnalyze, expectedHighlighting, expectedFile) } } \ No newline at end of file diff --git a/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/ScratchLineMarkersTest.kt.202 b/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/ScratchLineMarkersTest.kt.201 similarity index 96% rename from idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/ScratchLineMarkersTest.kt.202 rename to idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/ScratchLineMarkersTest.kt.201 index 96dc27720a9..ccc27114fbe 100644 --- a/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/ScratchLineMarkersTest.kt.202 +++ b/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/ScratchLineMarkersTest.kt.201 @@ -46,7 +46,7 @@ abstract class AbstractScratchLineMarkersTest : FileEditorManagerTestCase() { val project = myFixture.project val document = myFixture.editor.document - val data = ExpectedHighlightingData(document, false, false, false) + val data = ExpectedHighlightingData(document, false, false, false, myFixture.file) data.init() PsiDocumentManager.getInstance(project).commitAllDocuments() @@ -69,7 +69,7 @@ abstract class AbstractScratchLineMarkersTest : FileEditorManagerTestCase() { ): List> { myFixture.doHighlighting() - return AbstractLineMarkersTest.checkHighlighting(myFixture.file, documentToAnalyze, expectedHighlighting, expectedFile) + return AbstractLineMarkersTest.checkHighlighting(myFixture.project, documentToAnalyze, expectedHighlighting, expectedFile) } } \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightExitPointsHandlerFactory.kt b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightExitPointsHandlerFactory.kt index 6e32fa682c0..85feef012f7 100644 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightExitPointsHandlerFactory.kt +++ b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightExitPointsHandlerFactory.kt @@ -78,11 +78,11 @@ class KotlinHighlightExitPointsHandlerFactory : HighlightUsagesHandlerFactoryBas override fun getTargets() = listOf(target) - override fun selectTargets(targets: MutableList, selectionConsumer: Consumer>) { + override fun selectTargets(targets: MutableList, selectionConsumer: Consumer>) { selectionConsumer.consume(targets) } - override fun computeUsages(targets: MutableList?) { + override fun computeUsages(targets: MutableList) { val relevantFunction: KtDeclarationWithBody? = if (target is KtFunctionLiteral) { target diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightExitPointsHandlerFactory.kt.202 b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightExitPointsHandlerFactory.kt.201 similarity index 96% rename from idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightExitPointsHandlerFactory.kt.202 rename to idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightExitPointsHandlerFactory.kt.201 index 85feef012f7..6e32fa682c0 100644 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightExitPointsHandlerFactory.kt.202 +++ b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightExitPointsHandlerFactory.kt.201 @@ -78,11 +78,11 @@ class KotlinHighlightExitPointsHandlerFactory : HighlightUsagesHandlerFactoryBas override fun getTargets() = listOf(target) - override fun selectTargets(targets: MutableList, selectionConsumer: Consumer>) { + override fun selectTargets(targets: MutableList, selectionConsumer: Consumer>) { selectionConsumer.consume(targets) } - override fun computeUsages(targets: MutableList) { + override fun computeUsages(targets: MutableList?) { val relevantFunction: KtDeclarationWithBody? = if (target is KtFunctionLiteral) { target diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightImplicitItHandlerFactory.kt b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightImplicitItHandlerFactory.kt index 8ba248cd6ce..896d4c34918 100644 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightImplicitItHandlerFactory.kt +++ b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightImplicitItHandlerFactory.kt @@ -38,11 +38,11 @@ class KotlinHighlightImplicitItHandlerFactory : HighlightUsagesHandlerFactoryBas override fun getTargets() = listOf(refExpr) override fun selectTargets( - targets: MutableList, - selectionConsumer: Consumer> + targets: MutableList, + selectionConsumer: Consumer> ) = selectionConsumer.consume(targets) - override fun computeUsages(targets: MutableList?) { + override fun computeUsages(targets: MutableList) { lambda.accept( object : KtTreeVisitorVoid() { override fun visitSimpleNameExpression(expression: KtSimpleNameExpression) { diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightImplicitItHandlerFactory.kt.202 b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightImplicitItHandlerFactory.kt.201 similarity index 90% rename from idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightImplicitItHandlerFactory.kt.202 rename to idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightImplicitItHandlerFactory.kt.201 index 896d4c34918..8ba248cd6ce 100644 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightImplicitItHandlerFactory.kt.202 +++ b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightImplicitItHandlerFactory.kt.201 @@ -38,11 +38,11 @@ class KotlinHighlightImplicitItHandlerFactory : HighlightUsagesHandlerFactoryBas override fun getTargets() = listOf(refExpr) override fun selectTargets( - targets: MutableList, - selectionConsumer: Consumer> + targets: MutableList, + selectionConsumer: Consumer> ) = selectionConsumer.consume(targets) - override fun computeUsages(targets: MutableList) { + override fun computeUsages(targets: MutableList?) { lambda.accept( object : KtTreeVisitorVoid() { override fun visitSimpleNameExpression(expression: KtSimpleNameExpression) { diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinRecursiveCallLineMarkerProvider.kt b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinRecursiveCallLineMarkerProvider.kt index 0d5b0b629d2..f8e64f9b4b8 100644 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinRecursiveCallLineMarkerProvider.kt +++ b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinRecursiveCallLineMarkerProvider.kt @@ -46,7 +46,7 @@ import java.util.* class KotlinRecursiveCallLineMarkerProvider : LineMarkerProvider { override fun getLineMarkerInfo(element: PsiElement) = null - override fun collectSlowLineMarkers(elements: MutableList, result: LineMarkerInfos) { + override fun collectSlowLineMarkers(elements: MutableList, result: LineMarkerInfos) { val markedLineNumbers = HashSet() for (element in elements) { diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinRecursiveCallLineMarkerProvider.kt.202 b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinRecursiveCallLineMarkerProvider.kt.201 similarity index 98% rename from idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinRecursiveCallLineMarkerProvider.kt.202 rename to idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinRecursiveCallLineMarkerProvider.kt.201 index f8e64f9b4b8..0d5b0b629d2 100644 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinRecursiveCallLineMarkerProvider.kt.202 +++ b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinRecursiveCallLineMarkerProvider.kt.201 @@ -46,7 +46,7 @@ import java.util.* class KotlinRecursiveCallLineMarkerProvider : LineMarkerProvider { override fun getLineMarkerInfo(element: PsiElement) = null - override fun collectSlowLineMarkers(elements: MutableList, result: LineMarkerInfos) { + override fun collectSlowLineMarkers(elements: MutableList, result: LineMarkerInfos) { val markedLineNumbers = HashSet() for (element in elements) { diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinSuspendCallLineMarkerProvider.kt b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinSuspendCallLineMarkerProvider.kt index 0b31d4eeffb..c121b4199cd 100644 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinSuspendCallLineMarkerProvider.kt +++ b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinSuspendCallLineMarkerProvider.kt @@ -48,7 +48,7 @@ class KotlinSuspendCallLineMarkerProvider : LineMarkerProvider { override fun getLineMarkerInfo(element: PsiElement): LineMarkerInfo<*>? = null override fun collectSlowLineMarkers( - elements: MutableList, + elements: MutableList, result: LineMarkerInfos ) { val markedLineNumbers = HashSet() diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinSuspendCallLineMarkerProvider.kt.202 b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinSuspendCallLineMarkerProvider.kt.201 similarity index 99% rename from idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinSuspendCallLineMarkerProvider.kt.202 rename to idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinSuspendCallLineMarkerProvider.kt.201 index c121b4199cd..0b31d4eeffb 100644 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinSuspendCallLineMarkerProvider.kt.202 +++ b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinSuspendCallLineMarkerProvider.kt.201 @@ -48,7 +48,7 @@ class KotlinSuspendCallLineMarkerProvider : LineMarkerProvider { override fun getLineMarkerInfo(element: PsiElement): LineMarkerInfo<*>? = null override fun collectSlowLineMarkers( - elements: MutableList, + elements: MutableList, result: LineMarkerInfos ) { val markedLineNumbers = HashSet() diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/LineMarkerInfos.kt b/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/LineMarkerInfos.kt index 48f3ff2c06b..062f90e5892 100644 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/LineMarkerInfos.kt +++ b/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/LineMarkerInfos.kt @@ -7,4 +7,4 @@ package org.jetbrains.kotlin.idea.highlighter.markers import com.intellij.codeInsight.daemon.LineMarkerInfo -typealias LineMarkerInfos = MutableCollection> \ No newline at end of file +typealias LineMarkerInfos = MutableCollection> \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/LineMarkerInfos.kt.202 b/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/LineMarkerInfos.kt.201 similarity index 82% rename from idea/src/org/jetbrains/kotlin/idea/highlighter/markers/LineMarkerInfos.kt.202 rename to idea/src/org/jetbrains/kotlin/idea/highlighter/markers/LineMarkerInfos.kt.201 index 062f90e5892..48f3ff2c06b 100644 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/LineMarkerInfos.kt.202 +++ b/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/LineMarkerInfos.kt.201 @@ -7,4 +7,4 @@ package org.jetbrains.kotlin.idea.highlighter.markers import com.intellij.codeInsight.daemon.LineMarkerInfo -typealias LineMarkerInfos = MutableCollection> \ No newline at end of file +typealias LineMarkerInfos = MutableCollection> \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/TrailingCommaInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/TrailingCommaInspection.kt index 956127dd23d..4a5bbce11e2 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/TrailingCommaInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/TrailingCommaInspection.kt @@ -161,9 +161,9 @@ class TrailingCommaInspection( val settings = CodeStyle.getSettings(project).clone() settings.kotlinCustomSettings.ALLOW_TRAILING_COMMA = true settings.kotlinCustomSettings.ALLOW_TRAILING_COMMA_ON_CALL_SITE = true - CodeStyle.doWithTemporarySettings(project, settings) { + CodeStyle.doWithTemporarySettings(project, settings, Runnable { CodeStyleManager.getInstance(project).reformatRange(element, range.startOffset, range.endOffset) - } + }) } } diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/TrailingCommaInspection.kt.202 b/idea/src/org/jetbrains/kotlin/idea/inspections/TrailingCommaInspection.kt.201 similarity index 99% rename from idea/src/org/jetbrains/kotlin/idea/inspections/TrailingCommaInspection.kt.202 rename to idea/src/org/jetbrains/kotlin/idea/inspections/TrailingCommaInspection.kt.201 index 4a5bbce11e2..956127dd23d 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/TrailingCommaInspection.kt.202 +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/TrailingCommaInspection.kt.201 @@ -161,9 +161,9 @@ class TrailingCommaInspection( val settings = CodeStyle.getSettings(project).clone() settings.kotlinCustomSettings.ALLOW_TRAILING_COMMA = true settings.kotlinCustomSettings.ALLOW_TRAILING_COMMA_ON_CALL_SITE = true - CodeStyle.doWithTemporarySettings(project, settings, Runnable { + CodeStyle.doWithTemporarySettings(project, settings) { CodeStyleManager.getInstance(project).reformatRange(element, range.startOffset, range.endOffset) - }) + } } } diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/KotlinMutableMethodDescriptor.kt.202 b/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/KotlinMutableMethodDescriptor.kt.201 similarity index 100% rename from idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/KotlinMutableMethodDescriptor.kt.202 rename to idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/KotlinMutableMethodDescriptor.kt.201 diff --git a/idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinTargetElementEvaluator.kt b/idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinTargetElementEvaluator.kt index c93f6ab7474..75b404ccc77 100644 --- a/idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinTargetElementEvaluator.kt +++ b/idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinTargetElementEvaluator.kt @@ -101,7 +101,7 @@ class KotlinTargetElementEvaluator : TargetElementEvaluatorEx, TargetElementUtil return null } - override fun isIdentifierPart(file: PsiFile, text: CharSequence?, offset: Int): Boolean { + override fun isIdentifierPart(file: PsiFile, text: CharSequence, offset: Int): Boolean { val elementAtCaret = file.findElementAt(offset) if (elementAtCaret?.node?.elementType == KtTokens.IDENTIFIER) return true diff --git a/idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinTargetElementEvaluator.kt.202 b/idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinTargetElementEvaluator.kt.201 similarity index 99% rename from idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinTargetElementEvaluator.kt.202 rename to idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinTargetElementEvaluator.kt.201 index 75b404ccc77..c93f6ab7474 100644 --- a/idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinTargetElementEvaluator.kt.202 +++ b/idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinTargetElementEvaluator.kt.201 @@ -101,7 +101,7 @@ class KotlinTargetElementEvaluator : TargetElementEvaluatorEx, TargetElementUtil return null } - override fun isIdentifierPart(file: PsiFile, text: CharSequence, offset: Int): Boolean { + override fun isIdentifierPart(file: PsiFile, text: CharSequence?, offset: Int): Boolean { val elementAtCaret = file.findElementAt(offset) if (elementAtCaret?.node?.elementType == KtTokens.IDENTIFIER) return true diff --git a/idea/src/org/jetbrains/kotlin/idea/slicer/KotlinSliceProvider.kt b/idea/src/org/jetbrains/kotlin/idea/slicer/KotlinSliceProvider.kt index e4fcf5ffe4a..e4a87c4691d 100644 --- a/idea/src/org/jetbrains/kotlin/idea/slicer/KotlinSliceProvider.kt +++ b/idea/src/org/jetbrains/kotlin/idea/slicer/KotlinSliceProvider.kt @@ -73,7 +73,7 @@ class KotlinSliceProvider : SliceLanguageSupportProvider, SliceUsageTransformer override fun transform(usage: SliceUsage): Collection? { if (usage is KotlinSliceUsage) return null - return listOf(KotlinSliceUsage(usage.element, usage.parent, KotlinSliceAnalysisMode.Default, false)) + return listOf(KotlinSliceUsage(usage.element ?: return null, usage.parent, KotlinSliceAnalysisMode.Default, false)) } override fun getExpressionAtCaret(atCaret: PsiElement, dataFlowToThis: Boolean): KtElement? { diff --git a/idea/src/org/jetbrains/kotlin/idea/slicer/KotlinSliceProvider.kt.202 b/idea/src/org/jetbrains/kotlin/idea/slicer/KotlinSliceProvider.kt.201 similarity index 97% rename from idea/src/org/jetbrains/kotlin/idea/slicer/KotlinSliceProvider.kt.202 rename to idea/src/org/jetbrains/kotlin/idea/slicer/KotlinSliceProvider.kt.201 index e4a87c4691d..e4fcf5ffe4a 100644 --- a/idea/src/org/jetbrains/kotlin/idea/slicer/KotlinSliceProvider.kt.202 +++ b/idea/src/org/jetbrains/kotlin/idea/slicer/KotlinSliceProvider.kt.201 @@ -73,7 +73,7 @@ class KotlinSliceProvider : SliceLanguageSupportProvider, SliceUsageTransformer override fun transform(usage: SliceUsage): Collection? { if (usage is KotlinSliceUsage) return null - return listOf(KotlinSliceUsage(usage.element ?: return null, usage.parent, KotlinSliceAnalysisMode.Default, false)) + return listOf(KotlinSliceUsage(usage.element, usage.parent, KotlinSliceAnalysisMode.Default, false)) } override fun getExpressionAtCaret(atCaret: PsiElement, dataFlowToThis: Boolean): KtElement? { diff --git a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTest.kt b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTest.kt index 658aedc5efd..e766ab1bfea 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTest.kt @@ -12,6 +12,7 @@ import com.intellij.openapi.editor.Document import com.intellij.openapi.project.Project import com.intellij.openapi.util.io.FileUtil import com.intellij.psi.PsiDocumentManager +import com.intellij.psi.PsiFile import com.intellij.rt.execution.junit.FileComparisonFailure import com.intellij.testFramework.ExpectedHighlightingData import com.intellij.testFramework.LightProjectDescriptor @@ -40,14 +41,14 @@ abstract class AbstractLineMarkersTest : KotlinLightCodeInsightFixtureTestCase() fun doTest(path: String) = doTest(path) {} protected fun doAndCheckHighlighting( - project: Project, + psiFile: PsiFile, documentToAnalyze: Document, expectedHighlighting: ExpectedHighlightingData, expectedFile: File ): List> { myFixture.doHighlighting() - return checkHighlighting(project, documentToAnalyze, expectedHighlighting, expectedFile) + return checkHighlighting(psiFile, documentToAnalyze, expectedHighlighting, expectedFile) } fun doTest(path: String, additionalCheck: () -> Unit) { @@ -62,12 +63,12 @@ abstract class AbstractLineMarkersTest : KotlinLightCodeInsightFixtureTestCase() val project = myFixture.project val document = myFixture.editor.document - val data = ExpectedHighlightingData(document, false, false, false, myFixture.file) + val data = ExpectedHighlightingData(document, false, false, false) data.init() PsiDocumentManager.getInstance(project).commitAllDocuments() - val markers = doAndCheckHighlighting(myFixture.project, document, data, testDataFile()) + val markers = doAndCheckHighlighting(myFixture.file, document, data, testDataFile()) assertNavigationElements(myFixture.project, myFixture.file as KtFile, markers) additionalCheck() @@ -150,15 +151,15 @@ abstract class AbstractLineMarkersTest : KotlinLightCodeInsightFixtureTestCase() } fun checkHighlighting( - project: Project, + psiFile: PsiFile, documentToAnalyze: Document, expectedHighlighting: ExpectedHighlightingData, expectedFile: File ): MutableList> { - val markers = DaemonCodeAnalyzerImpl.getLineMarkers(documentToAnalyze, project) + val markers = DaemonCodeAnalyzerImpl.getLineMarkers(documentToAnalyze, psiFile.project) try { - expectedHighlighting.checkLineMarkers(markers, documentToAnalyze.text) + expectedHighlighting.checkLineMarkers(psiFile, markers, documentToAnalyze.text) // This is a workaround for sad bug in ExpectedHighlightingData: // the latter doesn't throw assertion error when some line markers are expected, but none are present. diff --git a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTest.kt.202 b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTest.kt.201 similarity index 95% rename from idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTest.kt.202 rename to idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTest.kt.201 index e766ab1bfea..658aedc5efd 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTest.kt.202 +++ b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTest.kt.201 @@ -12,7 +12,6 @@ import com.intellij.openapi.editor.Document import com.intellij.openapi.project.Project import com.intellij.openapi.util.io.FileUtil import com.intellij.psi.PsiDocumentManager -import com.intellij.psi.PsiFile import com.intellij.rt.execution.junit.FileComparisonFailure import com.intellij.testFramework.ExpectedHighlightingData import com.intellij.testFramework.LightProjectDescriptor @@ -41,14 +40,14 @@ abstract class AbstractLineMarkersTest : KotlinLightCodeInsightFixtureTestCase() fun doTest(path: String) = doTest(path) {} protected fun doAndCheckHighlighting( - psiFile: PsiFile, + project: Project, documentToAnalyze: Document, expectedHighlighting: ExpectedHighlightingData, expectedFile: File ): List> { myFixture.doHighlighting() - return checkHighlighting(psiFile, documentToAnalyze, expectedHighlighting, expectedFile) + return checkHighlighting(project, documentToAnalyze, expectedHighlighting, expectedFile) } fun doTest(path: String, additionalCheck: () -> Unit) { @@ -63,12 +62,12 @@ abstract class AbstractLineMarkersTest : KotlinLightCodeInsightFixtureTestCase() val project = myFixture.project val document = myFixture.editor.document - val data = ExpectedHighlightingData(document, false, false, false) + val data = ExpectedHighlightingData(document, false, false, false, myFixture.file) data.init() PsiDocumentManager.getInstance(project).commitAllDocuments() - val markers = doAndCheckHighlighting(myFixture.file, document, data, testDataFile()) + val markers = doAndCheckHighlighting(myFixture.project, document, data, testDataFile()) assertNavigationElements(myFixture.project, myFixture.file as KtFile, markers) additionalCheck() @@ -151,15 +150,15 @@ abstract class AbstractLineMarkersTest : KotlinLightCodeInsightFixtureTestCase() } fun checkHighlighting( - psiFile: PsiFile, + project: Project, documentToAnalyze: Document, expectedHighlighting: ExpectedHighlightingData, expectedFile: File ): MutableList> { - val markers = DaemonCodeAnalyzerImpl.getLineMarkers(documentToAnalyze, psiFile.project) + val markers = DaemonCodeAnalyzerImpl.getLineMarkers(documentToAnalyze, project) try { - expectedHighlighting.checkLineMarkers(psiFile, markers, documentToAnalyze.text) + expectedHighlighting.checkLineMarkers(markers, documentToAnalyze.text) // This is a workaround for sad bug in ExpectedHighlightingData: // the latter doesn't throw assertion error when some line markers are expected, but none are present. diff --git a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTestInLibrarySources.kt b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTestInLibrarySources.kt index d6c95ea8008..c0e0a2ede53 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTestInLibrarySources.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTestInLibrarySources.kt @@ -65,9 +65,7 @@ abstract class AbstractLineMarkersTestInLibrarySources : AbstractLineMarkersTest val project = myFixture.project for (file in libraryOriginal.walkTopDown().filter { !it.isDirectory }) { myFixture.openFileInEditor(fileSystem.findFileByPath(file.absolutePath)!!) - val data = ExpectedHighlightingData( - myFixture.editor.document, false, false, false, myFixture.file - ) + val data = ExpectedHighlightingData(myFixture.editor.document, false, false, false) data.init() val librarySourceFile = libraryClean!!.resolve(file.relativeTo(libraryOriginal).path) @@ -79,7 +77,7 @@ abstract class AbstractLineMarkersTestInLibrarySources : AbstractLineMarkersTest throw AssertionError("File ${myFixture.file.virtualFile.path} should be in library sources!") } - doAndCheckHighlighting(myFixture.project, document, data, file) + doAndCheckHighlighting(myFixture.file, document, data, file) } } } diff --git a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTestInLibrarySources.kt.202 b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTestInLibrarySources.kt.201 similarity index 94% rename from idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTestInLibrarySources.kt.202 rename to idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTestInLibrarySources.kt.201 index c0e0a2ede53..d6c95ea8008 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTestInLibrarySources.kt.202 +++ b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTestInLibrarySources.kt.201 @@ -65,7 +65,9 @@ abstract class AbstractLineMarkersTestInLibrarySources : AbstractLineMarkersTest val project = myFixture.project for (file in libraryOriginal.walkTopDown().filter { !it.isDirectory }) { myFixture.openFileInEditor(fileSystem.findFileByPath(file.absolutePath)!!) - val data = ExpectedHighlightingData(myFixture.editor.document, false, false, false) + val data = ExpectedHighlightingData( + myFixture.editor.document, false, false, false, myFixture.file + ) data.init() val librarySourceFile = libraryClean!!.resolve(file.relativeTo(libraryOriginal).path) @@ -77,7 +79,7 @@ abstract class AbstractLineMarkersTestInLibrarySources : AbstractLineMarkersTest throw AssertionError("File ${myFixture.file.virtualFile.path} should be in library sources!") } - doAndCheckHighlighting(myFixture.file, document, data, file) + doAndCheckHighlighting(myFixture.project, document, data, file) } } } diff --git a/idea/tests/org/jetbrains/kotlin/idea/highlighter/AbstractUsageHighlightingTest.kt b/idea/tests/org/jetbrains/kotlin/idea/highlighter/AbstractUsageHighlightingTest.kt index af60955cc81..bebbeeb9fa9 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/highlighter/AbstractUsageHighlightingTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/highlighter/AbstractUsageHighlightingTest.kt @@ -24,7 +24,7 @@ abstract class AbstractUsageHighlightingTest : KotlinLightCodeInsightFixtureTest protected fun doTest(unused: String) { myFixture.configureByFile(fileName()) val document = myFixture.editor.document - val data = ExpectedHighlightingData(document, false, false, true, false, myFixture.file) + val data = ExpectedHighlightingData(document, false, false, true, false) data.init() val caret = document.extractMarkerOffset(project, CARET_TAG) @@ -48,7 +48,7 @@ abstract class AbstractUsageHighlightingTest : KotlinLightCodeInsightFixtureTest .create() } - data.checkResult(infos, StringBuilder(document.text).insert(caret, CARET_TAG).toString()) + data.checkResult(myFixture.file, infos, StringBuilder(document.text).insert(caret, CARET_TAG).toString()) } private fun isUsageHighlighting(info: RangeHighlighter): Boolean { diff --git a/idea/tests/org/jetbrains/kotlin/idea/highlighter/AbstractUsageHighlightingTest.kt.202 b/idea/tests/org/jetbrains/kotlin/idea/highlighter/AbstractUsageHighlightingTest.kt.201 similarity index 95% rename from idea/tests/org/jetbrains/kotlin/idea/highlighter/AbstractUsageHighlightingTest.kt.202 rename to idea/tests/org/jetbrains/kotlin/idea/highlighter/AbstractUsageHighlightingTest.kt.201 index bebbeeb9fa9..af60955cc81 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/highlighter/AbstractUsageHighlightingTest.kt.202 +++ b/idea/tests/org/jetbrains/kotlin/idea/highlighter/AbstractUsageHighlightingTest.kt.201 @@ -24,7 +24,7 @@ abstract class AbstractUsageHighlightingTest : KotlinLightCodeInsightFixtureTest protected fun doTest(unused: String) { myFixture.configureByFile(fileName()) val document = myFixture.editor.document - val data = ExpectedHighlightingData(document, false, false, true, false) + val data = ExpectedHighlightingData(document, false, false, true, false, myFixture.file) data.init() val caret = document.extractMarkerOffset(project, CARET_TAG) @@ -48,7 +48,7 @@ abstract class AbstractUsageHighlightingTest : KotlinLightCodeInsightFixtureTest .create() } - data.checkResult(myFixture.file, infos, StringBuilder(document.text).insert(caret, CARET_TAG).toString()) + data.checkResult(infos, StringBuilder(document.text).insert(caret, CARET_TAG).toString()) } private fun isUsageHighlighting(info: RangeHighlighter): Boolean { diff --git a/idea/tests/org/jetbrains/kotlin/idea/inspections/InspectionDescriptionTest.kt b/idea/tests/org/jetbrains/kotlin/idea/inspections/InspectionDescriptionTest.kt index 27f4b2a6db9..9b854a3bbbc 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/inspections/InspectionDescriptionTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/inspections/InspectionDescriptionTest.kt @@ -53,7 +53,7 @@ class InspectionDescriptionTest : LightPlatformTestCase() { private fun loadKotlinInspections(): List> { return InspectionToolRegistrar.getInstance().createTools().filter { it.extension.pluginDescriptor.pluginId == KotlinPluginUtil.KOTLIN_PLUGIN_ID - } + } as List> } private fun loadKotlinInspectionExtensions() = diff --git a/idea/tests/org/jetbrains/kotlin/idea/inspections/InspectionDescriptionTest.kt.202 b/idea/tests/org/jetbrains/kotlin/idea/inspections/InspectionDescriptionTest.kt.201 similarity index 98% rename from idea/tests/org/jetbrains/kotlin/idea/inspections/InspectionDescriptionTest.kt.202 rename to idea/tests/org/jetbrains/kotlin/idea/inspections/InspectionDescriptionTest.kt.201 index 9b854a3bbbc..27f4b2a6db9 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/inspections/InspectionDescriptionTest.kt.202 +++ b/idea/tests/org/jetbrains/kotlin/idea/inspections/InspectionDescriptionTest.kt.201 @@ -53,7 +53,7 @@ class InspectionDescriptionTest : LightPlatformTestCase() { private fun loadKotlinInspections(): List> { return InspectionToolRegistrar.getInstance().createTools().filter { it.extension.pluginDescriptor.pluginId == KotlinPluginUtil.KOTLIN_PLUGIN_ID - } as List> + } } private fun loadKotlinInspectionExtensions() = diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionDescriptionTest.kt b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionDescriptionTest.kt index 2d8d8c3cbbc..38b04d39767 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionDescriptionTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionDescriptionTest.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.idea.intentions import com.intellij.codeInsight.intention.IntentionActionBean import com.intellij.codeInsight.intention.IntentionManager +import com.intellij.codeInsight.intention.impl.config.IntentionManagerImpl import com.intellij.openapi.extensions.Extensions import com.intellij.testFramework.LightPlatformTestCase import com.intellij.testFramework.UsefulTestCase @@ -56,7 +57,7 @@ class IntentionDescriptionTest : LightPlatformTestCase() { private fun String.isXmlIntentionName() = startsWith("Add") && endsWith("ToManifest") private fun loadKotlinIntentions(): List { - val extensionPoint = Extensions.getRootArea().getExtensionPoint(IntentionManager.EP_INTENTION_ACTIONS) + val extensionPoint = Extensions.getRootArea().getExtensionPoint(IntentionManagerImpl.EP_INTENTION_ACTIONS) return extensionPoint.extensions.toList().filter { it.pluginDescriptor.pluginId == KotlinPluginUtil.KOTLIN_PLUGIN_ID } diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionDescriptionTest.kt.202 b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionDescriptionTest.kt.201 similarity index 95% rename from idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionDescriptionTest.kt.202 rename to idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionDescriptionTest.kt.201 index 38b04d39767..2d8d8c3cbbc 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionDescriptionTest.kt.202 +++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionDescriptionTest.kt.201 @@ -7,7 +7,6 @@ package org.jetbrains.kotlin.idea.intentions import com.intellij.codeInsight.intention.IntentionActionBean import com.intellij.codeInsight.intention.IntentionManager -import com.intellij.codeInsight.intention.impl.config.IntentionManagerImpl import com.intellij.openapi.extensions.Extensions import com.intellij.testFramework.LightPlatformTestCase import com.intellij.testFramework.UsefulTestCase @@ -57,7 +56,7 @@ class IntentionDescriptionTest : LightPlatformTestCase() { private fun String.isXmlIntentionName() = startsWith("Add") && endsWith("ToManifest") private fun loadKotlinIntentions(): List { - val extensionPoint = Extensions.getRootArea().getExtensionPoint(IntentionManagerImpl.EP_INTENTION_ACTIONS) + val extensionPoint = Extensions.getRootArea().getExtensionPoint(IntentionManager.EP_INTENTION_ACTIONS) return extensionPoint.extensions.toList().filter { it.pluginDescriptor.pluginId == KotlinPluginUtil.KOTLIN_PLUGIN_ID } diff --git a/idea/tests/org/jetbrains/kotlin/idea/navigation/GotoCheck.kt b/idea/tests/org/jetbrains/kotlin/idea/navigation/GotoCheck.kt index a4d3b083838..ec02a18b6ae 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/navigation/GotoCheck.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/navigation/GotoCheck.kt @@ -6,7 +6,7 @@ package org.jetbrains.kotlin.idea.navigation import com.intellij.ide.util.gotoByName.FilteringGotoByModel -import com.intellij.lang.Language +import com.intellij.ide.util.gotoByName.LanguageRef import com.intellij.openapi.editor.Editor import com.intellij.psi.PsiElement import com.intellij.testFramework.UsefulTestCase @@ -20,7 +20,7 @@ object GotoCheck { @JvmStatic @JvmOverloads fun checkGotoDirectives( - model: FilteringGotoByModel, + model: FilteringGotoByModel, editor: Editor, nonProjectSymbols: Boolean = false, checkNavigation: Boolean = false diff --git a/idea/tests/org/jetbrains/kotlin/idea/navigation/GotoCheck.kt.202 b/idea/tests/org/jetbrains/kotlin/idea/navigation/GotoCheck.kt.201 similarity index 97% rename from idea/tests/org/jetbrains/kotlin/idea/navigation/GotoCheck.kt.202 rename to idea/tests/org/jetbrains/kotlin/idea/navigation/GotoCheck.kt.201 index ec02a18b6ae..a4d3b083838 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/navigation/GotoCheck.kt.202 +++ b/idea/tests/org/jetbrains/kotlin/idea/navigation/GotoCheck.kt.201 @@ -6,7 +6,7 @@ package org.jetbrains.kotlin.idea.navigation import com.intellij.ide.util.gotoByName.FilteringGotoByModel -import com.intellij.ide.util.gotoByName.LanguageRef +import com.intellij.lang.Language import com.intellij.openapi.editor.Editor import com.intellij.psi.PsiElement import com.intellij.testFramework.UsefulTestCase @@ -20,7 +20,7 @@ object GotoCheck { @JvmStatic @JvmOverloads fun checkGotoDirectives( - model: FilteringGotoByModel, + model: FilteringGotoByModel, editor: Editor, nonProjectSymbols: Boolean = false, checkNavigation: Boolean = false diff --git a/idea/tests/org/jetbrains/kotlin/idea/resolve/AbstractAdditionalResolveDescriptorRendererTest.kt b/idea/tests/org/jetbrains/kotlin/idea/resolve/AbstractAdditionalResolveDescriptorRendererTest.kt index 94a1868b5d8..ac3f90b104c 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/resolve/AbstractAdditionalResolveDescriptorRendererTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/resolve/AbstractAdditionalResolveDescriptorRendererTest.kt @@ -23,17 +23,15 @@ import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.TargetEnvironment import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode import org.jetbrains.kotlin.resolve.lazy.ResolveSession -import org.picocontainer.MutablePicoContainer abstract class AbstractAdditionalResolveDescriptorRendererTest : AbstractDescriptorRendererTest() { override fun setUp() { super.setUp() - val pomModelImpl = PomModelImpl(project) - val treeAspect = TreeAspect(pomModelImpl) - val mockProject = project as MockProject - createAndRegisterKotlinCodeBlockModificationListener(mockProject, pomModelImpl, treeAspect) + mockProject.registerService(TreeAspect::class.java, TreeAspect()) + mockProject.registerService(PomModel::class.java, PomModelImpl(project)) + mockProject.registerService(KotlinCodeBlockModificationListener::class.java, KotlinCodeBlockModificationListener(mockProject)) } override fun tearDown() { diff --git a/idea/tests/org/jetbrains/kotlin/idea/resolve/AbstractAdditionalResolveDescriptorRendererTest.kt.202 b/idea/tests/org/jetbrains/kotlin/idea/resolve/AbstractAdditionalResolveDescriptorRendererTest.kt.201 similarity index 88% rename from idea/tests/org/jetbrains/kotlin/idea/resolve/AbstractAdditionalResolveDescriptorRendererTest.kt.202 rename to idea/tests/org/jetbrains/kotlin/idea/resolve/AbstractAdditionalResolveDescriptorRendererTest.kt.201 index ac3f90b104c..94a1868b5d8 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/resolve/AbstractAdditionalResolveDescriptorRendererTest.kt.202 +++ b/idea/tests/org/jetbrains/kotlin/idea/resolve/AbstractAdditionalResolveDescriptorRendererTest.kt.201 @@ -23,15 +23,17 @@ import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.TargetEnvironment import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode import org.jetbrains.kotlin.resolve.lazy.ResolveSession +import org.picocontainer.MutablePicoContainer abstract class AbstractAdditionalResolveDescriptorRendererTest : AbstractDescriptorRendererTest() { override fun setUp() { super.setUp() + val pomModelImpl = PomModelImpl(project) + val treeAspect = TreeAspect(pomModelImpl) + val mockProject = project as MockProject - mockProject.registerService(TreeAspect::class.java, TreeAspect()) - mockProject.registerService(PomModel::class.java, PomModelImpl(project)) - mockProject.registerService(KotlinCodeBlockModificationListener::class.java, KotlinCodeBlockModificationListener(mockProject)) + createAndRegisterKotlinCodeBlockModificationListener(mockProject, pomModelImpl, treeAspect) } override fun tearDown() { diff --git a/idea/tests/org/jetbrains/kotlin/idea/slicer/SlicerTestUtil.kt b/idea/tests/org/jetbrains/kotlin/idea/slicer/SlicerTestUtil.kt index c579bd25f57..5ab9362ec62 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/slicer/SlicerTestUtil.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/slicer/SlicerTestUtil.kt @@ -9,6 +9,7 @@ import com.intellij.analysis.AnalysisScope import com.intellij.ide.projectView.TreeStructureProvider import com.intellij.ide.util.treeView.AbstractTreeStructureBase import com.intellij.psi.search.GlobalSearchScope +import com.intellij.psi.search.PsiSearchScopeUtil import com.intellij.slicer.DuplicateMap import com.intellij.slicer.SliceAnalysisParams import com.intellij.slicer.SliceNode @@ -63,7 +64,7 @@ internal fun buildTreeRepresentation(rootNode: SliceNode): String { else -> { val chunks = usage.text - if (!projectScope.contains(usage.element)) { + if (!PsiSearchScopeUtil.isInScope(projectScope, usage.element!!)) { append("LIB ") } else { append(chunks.first().render() + " ") diff --git a/idea/tests/org/jetbrains/kotlin/idea/slicer/SlicerTestUtil.kt.202 b/idea/tests/org/jetbrains/kotlin/idea/slicer/SlicerTestUtil.kt.201 similarity index 97% rename from idea/tests/org/jetbrains/kotlin/idea/slicer/SlicerTestUtil.kt.202 rename to idea/tests/org/jetbrains/kotlin/idea/slicer/SlicerTestUtil.kt.201 index 5ab9362ec62..c579bd25f57 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/slicer/SlicerTestUtil.kt.202 +++ b/idea/tests/org/jetbrains/kotlin/idea/slicer/SlicerTestUtil.kt.201 @@ -9,7 +9,6 @@ import com.intellij.analysis.AnalysisScope import com.intellij.ide.projectView.TreeStructureProvider import com.intellij.ide.util.treeView.AbstractTreeStructureBase import com.intellij.psi.search.GlobalSearchScope -import com.intellij.psi.search.PsiSearchScopeUtil import com.intellij.slicer.DuplicateMap import com.intellij.slicer.SliceAnalysisParams import com.intellij.slicer.SliceNode @@ -64,7 +63,7 @@ internal fun buildTreeRepresentation(rootNode: SliceNode): String { else -> { val chunks = usage.text - if (!PsiSearchScopeUtil.isInScope(projectScope, usage.element!!)) { + if (!projectScope.contains(usage.element)) { append("LIB ") } else { append(chunks.first().render() + " ") diff --git a/idea/tests/org/jetbrains/kotlin/idea/stubs/AbstractMultiHighlightingTest.kt b/idea/tests/org/jetbrains/kotlin/idea/stubs/AbstractMultiHighlightingTest.kt index 5948b82f5fb..aa06dd5799b 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/stubs/AbstractMultiHighlightingTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/stubs/AbstractMultiHighlightingTest.kt @@ -40,10 +40,10 @@ abstract class AbstractMultiHighlightingTest : AbstractMultiModuleTest() { val text = myEditor.document.text if (shouldCheckLineMarkers) { - data.checkLineMarkers(DaemonCodeAnalyzerImpl.getLineMarkers(getDocument(file), project), text) + data.checkLineMarkers(myFile, DaemonCodeAnalyzerImpl.getLineMarkers(getDocument(file), project), text) } if (shouldCheckResult) { - data.checkResult(infos, text) + data.checkResult(myFile, infos, text) } return infos } diff --git a/idea/tests/org/jetbrains/kotlin/idea/stubs/AbstractMultiHighlightingTest.kt.202 b/idea/tests/org/jetbrains/kotlin/idea/stubs/AbstractMultiHighlightingTest.kt.201 similarity index 91% rename from idea/tests/org/jetbrains/kotlin/idea/stubs/AbstractMultiHighlightingTest.kt.202 rename to idea/tests/org/jetbrains/kotlin/idea/stubs/AbstractMultiHighlightingTest.kt.201 index aa06dd5799b..5948b82f5fb 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/stubs/AbstractMultiHighlightingTest.kt.202 +++ b/idea/tests/org/jetbrains/kotlin/idea/stubs/AbstractMultiHighlightingTest.kt.201 @@ -40,10 +40,10 @@ abstract class AbstractMultiHighlightingTest : AbstractMultiModuleTest() { val text = myEditor.document.text if (shouldCheckLineMarkers) { - data.checkLineMarkers(myFile, DaemonCodeAnalyzerImpl.getLineMarkers(getDocument(file), project), text) + data.checkLineMarkers(DaemonCodeAnalyzerImpl.getLineMarkers(getDocument(file), project), text) } if (shouldCheckResult) { - data.checkResult(myFile, infos, text) + data.checkResult(infos, text) } return infos } diff --git a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt index 7da9b6c9102..ae59ed0dab8 100644 --- a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt +++ b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt @@ -172,7 +172,6 @@ abstract class AbstractIncrementalJpsTest( BuilderRegistry.getInstance(), myBuildParams, CanceledStatus.NULL, - mockConstantSearch, true ) val buildResult = BuildResult() diff --git a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt.202 b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt.201 similarity index 99% rename from jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt.202 rename to jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt.201 index ae59ed0dab8..7da9b6c9102 100644 --- a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt.202 +++ b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt.201 @@ -172,6 +172,7 @@ abstract class AbstractIncrementalJpsTest( BuilderRegistry.getInstance(), myBuildParams, CanceledStatus.NULL, + mockConstantSearch, true ) val buildResult = BuildResult() diff --git a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt index e78ecb115c4..3e158535610 100644 --- a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt +++ b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt @@ -1009,7 +1009,7 @@ open class KotlinJpsBuildTest : KotlinJpsBuildTestBase() { descriptor.setupProject() try { - val builder = IncProjectBuilder(descriptor, BuilderRegistry.getInstance(), this.myBuildParams, canceledStatus, null, true) + val builder = IncProjectBuilder(descriptor, BuilderRegistry.getInstance(), this.myBuildParams, canceledStatus, true) builder.addMessageHandler(buildResult) builder.build(scopeBuilder.build(), false) } diff --git a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt.202 b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt.201 similarity index 99% rename from jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt.202 rename to jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt.201 index 3e158535610..e78ecb115c4 100644 --- a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt.202 +++ b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt.201 @@ -1009,7 +1009,7 @@ open class KotlinJpsBuildTest : KotlinJpsBuildTestBase() { descriptor.setupProject() try { - val builder = IncProjectBuilder(descriptor, BuilderRegistry.getInstance(), this.myBuildParams, canceledStatus, true) + val builder = IncProjectBuilder(descriptor, BuilderRegistry.getInstance(), this.myBuildParams, canceledStatus, null, true) builder.addMessageHandler(buildResult) builder.build(scopeBuilder.build(), false) } diff --git a/plugins/uast-kotlin-idea/src/org/jetbrains/uast/kotlin/generate/KotlinUastCodeGenerationPlugin.kt b/plugins/uast-kotlin-idea/src/org/jetbrains/uast/kotlin/generate/KotlinUastCodeGenerationPlugin.kt index 58b2c58d163..9a3dbe575cb 100644 --- a/plugins/uast-kotlin-idea/src/org/jetbrains/uast/kotlin/generate/KotlinUastCodeGenerationPlugin.kt +++ b/plugins/uast-kotlin-idea/src/org/jetbrains/uast/kotlin/generate/KotlinUastCodeGenerationPlugin.kt @@ -149,7 +149,7 @@ class KotlinUastElementFactory(project: Project) : UastElementFactory { return KotlinStringULiteralExpression(psiFactory.createExpression(StringUtil.wrapWithDoubleQuote(text)), null) } - /*override*/ fun createNullLiteral(context: PsiElement?): ULiteralExpression { + override fun createNullLiteral(context: PsiElement?): ULiteralExpression { return psiFactory.createExpression("null").toUElementOfType()!! } @@ -167,12 +167,12 @@ class KotlinUastElementFactory(project: Project) : UastElementFactory { } @Deprecated("use version with context parameter") - override fun createIfExpression(condition: UExpression, thenBranch: UExpression, elseBranch: UExpression?): UIfExpression? { + fun createIfExpression(condition: UExpression, thenBranch: UExpression, elseBranch: UExpression?): UIfExpression? { logger().error("Please switch caller to the version with a context parameter") return createIfExpression(condition, thenBranch, elseBranch, null) } - /*override*/ fun createIfExpression( + override fun createIfExpression( condition: UExpression, thenBranch: UExpression, elseBranch: UExpression?, @@ -186,44 +186,44 @@ class KotlinUastElementFactory(project: Project) : UastElementFactory { } @Deprecated("use version with context parameter") - override fun createParenthesizedExpression(expression: UExpression): UParenthesizedExpression? { + fun createParenthesizedExpression(expression: UExpression): UParenthesizedExpression? { logger().error("Please switch caller to the version with a context parameter") return createParenthesizedExpression(expression, null) } - /*override*/ fun createParenthesizedExpression(expression: UExpression, context: PsiElement?): UParenthesizedExpression? { + override fun createParenthesizedExpression(expression: UExpression, context: PsiElement?): UParenthesizedExpression? { val source = expression.sourcePsi ?: return null val parenthesized = psiFactory.createExpression("(${source.text})") as? KtParenthesizedExpression ?: return null return KotlinUParenthesizedExpression(parenthesized, null) } @Deprecated("use version with context parameter") - override fun createSimpleReference(name: String): USimpleNameReferenceExpression? { + fun createSimpleReference(name: String): USimpleNameReferenceExpression? { logger().error("Please switch caller to the version with a context parameter") return createSimpleReference(name, null) } - /*override*/ fun createSimpleReference(name: String, context: PsiElement?): USimpleNameReferenceExpression? { + override fun createSimpleReference(name: String, context: PsiElement?): USimpleNameReferenceExpression? { return KotlinUSimpleReferenceExpression(psiFactory.createSimpleName(name), null) } @Deprecated("use version with context parameter") - override fun createSimpleReference(variable: UVariable): USimpleNameReferenceExpression? { + fun createSimpleReference(variable: UVariable): USimpleNameReferenceExpression? { logger().error("Please switch caller to the version with a context parameter") return createSimpleReference(variable, null) } - /*override*/ fun createSimpleReference(variable: UVariable, context: PsiElement?): USimpleNameReferenceExpression? { + override fun createSimpleReference(variable: UVariable, context: PsiElement?): USimpleNameReferenceExpression? { return createSimpleReference(variable.name ?: return null, context) } @Deprecated("use version with context parameter") - override fun createReturnExpresion(expression: UExpression?, inLambda: Boolean): UReturnExpression? { + fun createReturnExpresion(expression: UExpression?, inLambda: Boolean): UReturnExpression? { logger().error("Please switch caller to the version with a context parameter") return createReturnExpresion(expression, inLambda, null) } - /*override*/ fun createReturnExpresion(expression: UExpression?, inLambda: Boolean, context: PsiElement?): UReturnExpression? { + override fun createReturnExpresion(expression: UExpression?, inLambda: Boolean, context: PsiElement?): UReturnExpression? { val label = if (inLambda && context != null) getParentLambdaLabelName(context)?.let { "@$it" } ?: "" else "" val returnExpression = psiFactory.createExpression("return$label 1") as KtReturnExpression val sourcePsi = expression?.sourcePsi @@ -246,7 +246,7 @@ class KotlinUastElementFactory(project: Project) : UastElementFactory { } @Deprecated("use version with context parameter") - override fun createBinaryExpression( + fun createBinaryExpression( leftOperand: UExpression, rightOperand: UExpression, operator: UastBinaryOperator @@ -255,7 +255,7 @@ class KotlinUastElementFactory(project: Project) : UastElementFactory { return createBinaryExpression(leftOperand, rightOperand, operator, null) } - /*override*/ fun createBinaryExpression( + override fun createBinaryExpression( leftOperand: UExpression, rightOperand: UExpression, operator: UastBinaryOperator, @@ -280,7 +280,7 @@ class KotlinUastElementFactory(project: Project) : UastElementFactory { } @Deprecated("use version with context parameter") - override fun createFlatBinaryExpression( + fun createFlatBinaryExpression( leftOperand: UExpression, rightOperand: UExpression, operator: UastBinaryOperator @@ -289,7 +289,7 @@ class KotlinUastElementFactory(project: Project) : UastElementFactory { return createFlatBinaryExpression(leftOperand, rightOperand, operator, null) } - /*override*/ fun createFlatBinaryExpression( + override fun createFlatBinaryExpression( leftOperand: UExpression, rightOperand: UExpression, operator: UastBinaryOperator, @@ -310,12 +310,12 @@ class KotlinUastElementFactory(project: Project) : UastElementFactory { } @Deprecated("use version with context parameter") - override fun createBlockExpression(expressions: List): UBlockExpression? { + fun createBlockExpression(expressions: List): UBlockExpression? { logger().error("Please switch caller to the version with a context parameter") return createBlockExpression(expressions, null) } - /*override*/ fun createBlockExpression(expressions: List, context: PsiElement?): UBlockExpression? { + override fun createBlockExpression(expressions: List, context: PsiElement?): UBlockExpression? { val sourceExpressions = expressions.flatMap { it.toSourcePsiFakeAware() } val block = psiFactory.createBlock( sourceExpressions.joinToString(separator = "\n") { "println()" } @@ -327,19 +327,19 @@ class KotlinUastElementFactory(project: Project) : UastElementFactory { } @Deprecated("use version with context parameter") - override fun createDeclarationExpression(declarations: List): UDeclarationsExpression? { + fun createDeclarationExpression(declarations: List): UDeclarationsExpression? { logger().error("Please switch caller to the version with a context parameter") return createDeclarationExpression(declarations, null) } - /*override*/ fun createDeclarationExpression(declarations: List, context: PsiElement?): UDeclarationsExpression? { + override fun createDeclarationExpression(declarations: List, context: PsiElement?): UDeclarationsExpression? { return object : KotlinUDeclarationsExpression(null), KotlinFakeUElement { override var declarations: List = declarations override fun unwrapToSourcePsi(): List = declarations.flatMap { it.toSourcePsiFakeAware() } } } - /*override*/ fun createLambdaExpression( + override fun createLambdaExpression( parameters: List, body: UExpression, context: PsiElement? @@ -377,12 +377,12 @@ class KotlinUastElementFactory(project: Project) : UastElementFactory { } @Deprecated("use version with context parameter") - override fun createLambdaExpression(parameters: List, body: UExpression): ULambdaExpression? { + fun createLambdaExpression(parameters: List, body: UExpression): ULambdaExpression? { logger().error("Please switch caller to the version with a context parameter") return createLambdaExpression(parameters, body, null) } - /*override*/ fun createLocalVariable( + override fun createLocalVariable( suggestedName: String?, type: PsiType?, initializer: UExpression, @@ -412,7 +412,7 @@ class KotlinUastElementFactory(project: Project) : UastElementFactory { } @Deprecated("use version with context parameter") - override fun createLocalVariable( + fun createLocalVariable( suggestedName: String?, type: PsiType?, initializer: UExpression, diff --git a/plugins/uast-kotlin-idea/src/org/jetbrains/uast/kotlin/generate/KotlinUastCodeGenerationPlugin.kt.202 b/plugins/uast-kotlin-idea/src/org/jetbrains/uast/kotlin/generate/KotlinUastCodeGenerationPlugin.kt.201 similarity index 91% rename from plugins/uast-kotlin-idea/src/org/jetbrains/uast/kotlin/generate/KotlinUastCodeGenerationPlugin.kt.202 rename to plugins/uast-kotlin-idea/src/org/jetbrains/uast/kotlin/generate/KotlinUastCodeGenerationPlugin.kt.201 index 9a3dbe575cb..58b2c58d163 100644 --- a/plugins/uast-kotlin-idea/src/org/jetbrains/uast/kotlin/generate/KotlinUastCodeGenerationPlugin.kt.202 +++ b/plugins/uast-kotlin-idea/src/org/jetbrains/uast/kotlin/generate/KotlinUastCodeGenerationPlugin.kt.201 @@ -149,7 +149,7 @@ class KotlinUastElementFactory(project: Project) : UastElementFactory { return KotlinStringULiteralExpression(psiFactory.createExpression(StringUtil.wrapWithDoubleQuote(text)), null) } - override fun createNullLiteral(context: PsiElement?): ULiteralExpression { + /*override*/ fun createNullLiteral(context: PsiElement?): ULiteralExpression { return psiFactory.createExpression("null").toUElementOfType()!! } @@ -167,12 +167,12 @@ class KotlinUastElementFactory(project: Project) : UastElementFactory { } @Deprecated("use version with context parameter") - fun createIfExpression(condition: UExpression, thenBranch: UExpression, elseBranch: UExpression?): UIfExpression? { + override fun createIfExpression(condition: UExpression, thenBranch: UExpression, elseBranch: UExpression?): UIfExpression? { logger().error("Please switch caller to the version with a context parameter") return createIfExpression(condition, thenBranch, elseBranch, null) } - override fun createIfExpression( + /*override*/ fun createIfExpression( condition: UExpression, thenBranch: UExpression, elseBranch: UExpression?, @@ -186,44 +186,44 @@ class KotlinUastElementFactory(project: Project) : UastElementFactory { } @Deprecated("use version with context parameter") - fun createParenthesizedExpression(expression: UExpression): UParenthesizedExpression? { + override fun createParenthesizedExpression(expression: UExpression): UParenthesizedExpression? { logger().error("Please switch caller to the version with a context parameter") return createParenthesizedExpression(expression, null) } - override fun createParenthesizedExpression(expression: UExpression, context: PsiElement?): UParenthesizedExpression? { + /*override*/ fun createParenthesizedExpression(expression: UExpression, context: PsiElement?): UParenthesizedExpression? { val source = expression.sourcePsi ?: return null val parenthesized = psiFactory.createExpression("(${source.text})") as? KtParenthesizedExpression ?: return null return KotlinUParenthesizedExpression(parenthesized, null) } @Deprecated("use version with context parameter") - fun createSimpleReference(name: String): USimpleNameReferenceExpression? { + override fun createSimpleReference(name: String): USimpleNameReferenceExpression? { logger().error("Please switch caller to the version with a context parameter") return createSimpleReference(name, null) } - override fun createSimpleReference(name: String, context: PsiElement?): USimpleNameReferenceExpression? { + /*override*/ fun createSimpleReference(name: String, context: PsiElement?): USimpleNameReferenceExpression? { return KotlinUSimpleReferenceExpression(psiFactory.createSimpleName(name), null) } @Deprecated("use version with context parameter") - fun createSimpleReference(variable: UVariable): USimpleNameReferenceExpression? { + override fun createSimpleReference(variable: UVariable): USimpleNameReferenceExpression? { logger().error("Please switch caller to the version with a context parameter") return createSimpleReference(variable, null) } - override fun createSimpleReference(variable: UVariable, context: PsiElement?): USimpleNameReferenceExpression? { + /*override*/ fun createSimpleReference(variable: UVariable, context: PsiElement?): USimpleNameReferenceExpression? { return createSimpleReference(variable.name ?: return null, context) } @Deprecated("use version with context parameter") - fun createReturnExpresion(expression: UExpression?, inLambda: Boolean): UReturnExpression? { + override fun createReturnExpresion(expression: UExpression?, inLambda: Boolean): UReturnExpression? { logger().error("Please switch caller to the version with a context parameter") return createReturnExpresion(expression, inLambda, null) } - override fun createReturnExpresion(expression: UExpression?, inLambda: Boolean, context: PsiElement?): UReturnExpression? { + /*override*/ fun createReturnExpresion(expression: UExpression?, inLambda: Boolean, context: PsiElement?): UReturnExpression? { val label = if (inLambda && context != null) getParentLambdaLabelName(context)?.let { "@$it" } ?: "" else "" val returnExpression = psiFactory.createExpression("return$label 1") as KtReturnExpression val sourcePsi = expression?.sourcePsi @@ -246,7 +246,7 @@ class KotlinUastElementFactory(project: Project) : UastElementFactory { } @Deprecated("use version with context parameter") - fun createBinaryExpression( + override fun createBinaryExpression( leftOperand: UExpression, rightOperand: UExpression, operator: UastBinaryOperator @@ -255,7 +255,7 @@ class KotlinUastElementFactory(project: Project) : UastElementFactory { return createBinaryExpression(leftOperand, rightOperand, operator, null) } - override fun createBinaryExpression( + /*override*/ fun createBinaryExpression( leftOperand: UExpression, rightOperand: UExpression, operator: UastBinaryOperator, @@ -280,7 +280,7 @@ class KotlinUastElementFactory(project: Project) : UastElementFactory { } @Deprecated("use version with context parameter") - fun createFlatBinaryExpression( + override fun createFlatBinaryExpression( leftOperand: UExpression, rightOperand: UExpression, operator: UastBinaryOperator @@ -289,7 +289,7 @@ class KotlinUastElementFactory(project: Project) : UastElementFactory { return createFlatBinaryExpression(leftOperand, rightOperand, operator, null) } - override fun createFlatBinaryExpression( + /*override*/ fun createFlatBinaryExpression( leftOperand: UExpression, rightOperand: UExpression, operator: UastBinaryOperator, @@ -310,12 +310,12 @@ class KotlinUastElementFactory(project: Project) : UastElementFactory { } @Deprecated("use version with context parameter") - fun createBlockExpression(expressions: List): UBlockExpression? { + override fun createBlockExpression(expressions: List): UBlockExpression? { logger().error("Please switch caller to the version with a context parameter") return createBlockExpression(expressions, null) } - override fun createBlockExpression(expressions: List, context: PsiElement?): UBlockExpression? { + /*override*/ fun createBlockExpression(expressions: List, context: PsiElement?): UBlockExpression? { val sourceExpressions = expressions.flatMap { it.toSourcePsiFakeAware() } val block = psiFactory.createBlock( sourceExpressions.joinToString(separator = "\n") { "println()" } @@ -327,19 +327,19 @@ class KotlinUastElementFactory(project: Project) : UastElementFactory { } @Deprecated("use version with context parameter") - fun createDeclarationExpression(declarations: List): UDeclarationsExpression? { + override fun createDeclarationExpression(declarations: List): UDeclarationsExpression? { logger().error("Please switch caller to the version with a context parameter") return createDeclarationExpression(declarations, null) } - override fun createDeclarationExpression(declarations: List, context: PsiElement?): UDeclarationsExpression? { + /*override*/ fun createDeclarationExpression(declarations: List, context: PsiElement?): UDeclarationsExpression? { return object : KotlinUDeclarationsExpression(null), KotlinFakeUElement { override var declarations: List = declarations override fun unwrapToSourcePsi(): List = declarations.flatMap { it.toSourcePsiFakeAware() } } } - override fun createLambdaExpression( + /*override*/ fun createLambdaExpression( parameters: List, body: UExpression, context: PsiElement? @@ -377,12 +377,12 @@ class KotlinUastElementFactory(project: Project) : UastElementFactory { } @Deprecated("use version with context parameter") - fun createLambdaExpression(parameters: List, body: UExpression): ULambdaExpression? { + override fun createLambdaExpression(parameters: List, body: UExpression): ULambdaExpression? { logger().error("Please switch caller to the version with a context parameter") return createLambdaExpression(parameters, body, null) } - override fun createLocalVariable( + /*override*/ fun createLocalVariable( suggestedName: String?, type: PsiType?, initializer: UExpression, @@ -412,7 +412,7 @@ class KotlinUastElementFactory(project: Project) : UastElementFactory { } @Deprecated("use version with context parameter") - fun createLocalVariable( + override fun createLocalVariable( suggestedName: String?, type: PsiType?, initializer: UExpression, diff --git a/tests/mute-platform.csv b/tests/mute-platform.csv index 2fcdef022f7..8035744fae0 100644 --- a/tests/mute-platform.csv +++ b/tests/mute-platform.csv @@ -6,7 +6,6 @@ org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testJsTestOutputFi org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testTransitiveImplementWithAndroid, KT-35225,, org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testTransitiveImplementWithNonDefaultConfig, Gradle Tests in 201,, org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testTransitiveImplement, Gradle Tests in 201,, -"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testDetectAndroidSources", Gradle Import Tests,, "org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testAndroidDependencyOnMPP", Gradle Import Tests,, "org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testDependencyOnRoot", Gradle Tests in 201,, "org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testImportBeforeBuild", Gradle Tests in 201,, @@ -16,7 +15,6 @@ org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testTransitiveImpl "org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testProjectDependency", Gradle Tests in 201,, org.jetbrains.kotlin.idea.caches.resolve.MultiModuleLineMarkerTestGenerated.testKotlinTestAnnotations, No line markers for test run,, org.jetbrains.kotlin.idea.codeInsight.InspectionTestGenerated.Inspections.testAndroidIllegalIdentifiers_inspectionData_Inspections_test, Unprocessed,, -org.jetbrains.kotlin.idea.codeInsight.gradle.GradleFacetImportTest.testAndroidGradleJsDetection, NPE during import,, org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Order.testTwoClasses,,, FLAKY org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Order.testValAndClass,,, FLAKY org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Order.testValOrder,,, FLAKY @@ -115,6 +113,7 @@ org.jetbrains.kotlin.idea.refactoring.pullUp.PullUpTestGenerated.K2K.testAcciden org.jetbrains.kotlin.idea.refactoring.move.MoveTestGenerated.testKotlin_moveTopLevelDeclarations_moveFunctionToPackage_MoveFunctionToPackage, fail on TeamCity but works well locally,, FLAKY org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertSealedClassToEnum.testInstancesOnly, Generated entries reordered,, FLAKY org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertSealedClassToEnum.testInstancesAndMembers, Enum reorder,, FLAKY +org.jetbrains.kotlin.idea.navigation.GotoDeclarationTestGenerated.testImportAliasMultiDeclarations, showInBestPositionFor doesn't work in headless in 202,, org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testChangeInsideNonKtsFileInvalidatesOtherFiles, Unprocessed,, org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testTwoFilesChanged, Unprocessed,, org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testLoadedConfigurationWhenExternalFileChanged, Unprocessed,, \ No newline at end of file diff --git a/tests/mute-platform.csv.202 b/tests/mute-platform.csv.201 similarity index 98% rename from tests/mute-platform.csv.202 rename to tests/mute-platform.csv.201 index 8035744fae0..2fcdef022f7 100644 --- a/tests/mute-platform.csv.202 +++ b/tests/mute-platform.csv.201 @@ -6,6 +6,7 @@ org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testJsTestOutputFi org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testTransitiveImplementWithAndroid, KT-35225,, org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testTransitiveImplementWithNonDefaultConfig, Gradle Tests in 201,, org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testTransitiveImplement, Gradle Tests in 201,, +"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testDetectAndroidSources", Gradle Import Tests,, "org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testAndroidDependencyOnMPP", Gradle Import Tests,, "org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testDependencyOnRoot", Gradle Tests in 201,, "org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testImportBeforeBuild", Gradle Tests in 201,, @@ -15,6 +16,7 @@ org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testTransitiveImpl "org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testProjectDependency", Gradle Tests in 201,, org.jetbrains.kotlin.idea.caches.resolve.MultiModuleLineMarkerTestGenerated.testKotlinTestAnnotations, No line markers for test run,, org.jetbrains.kotlin.idea.codeInsight.InspectionTestGenerated.Inspections.testAndroidIllegalIdentifiers_inspectionData_Inspections_test, Unprocessed,, +org.jetbrains.kotlin.idea.codeInsight.gradle.GradleFacetImportTest.testAndroidGradleJsDetection, NPE during import,, org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Order.testTwoClasses,,, FLAKY org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Order.testValAndClass,,, FLAKY org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Order.testValOrder,,, FLAKY @@ -113,7 +115,6 @@ org.jetbrains.kotlin.idea.refactoring.pullUp.PullUpTestGenerated.K2K.testAcciden org.jetbrains.kotlin.idea.refactoring.move.MoveTestGenerated.testKotlin_moveTopLevelDeclarations_moveFunctionToPackage_MoveFunctionToPackage, fail on TeamCity but works well locally,, FLAKY org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertSealedClassToEnum.testInstancesOnly, Generated entries reordered,, FLAKY org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertSealedClassToEnum.testInstancesAndMembers, Enum reorder,, FLAKY -org.jetbrains.kotlin.idea.navigation.GotoDeclarationTestGenerated.testImportAliasMultiDeclarations, showInBestPositionFor doesn't work in headless in 202,, org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testChangeInsideNonKtsFileInvalidatesOtherFiles, Unprocessed,, org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testTwoFilesChanged, Unprocessed,, org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testLoadedConfigurationWhenExternalFileChanged, Unprocessed,, \ No newline at end of file From 07dd9179e8ce6b43f1a81dcde869118f05c648d8 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Tue, 17 Nov 2020 15:11:49 +0300 Subject: [PATCH 284/698] Build: change 202 platform version --- gradle/versions.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/versions.properties b/gradle/versions.properties index 7b464ab8092..ae53f6528dc 100644 --- a/gradle/versions.properties +++ b/gradle/versions.properties @@ -1,4 +1,4 @@ -versions.intellijSdk=202.5103-EAP-CANDIDATE-SNAPSHOT +versions.intellijSdk=202.7660.26 versions.androidBuildTools=r23.0.1 versions.idea.NodeJS=193.6494.7 versions.jar.asm-all=8.0.1 @@ -15,4 +15,4 @@ versions.jar.serviceMessages=2019.1.4 versions.jar.lz4-java=1.7.1 ignore.jar.snappy-in-java=true versions.gradle-api=4.5.1 -versions.shadow=5.2.0 \ No newline at end of file +versions.shadow=5.2.0 From e4e28a54953eb031aed8a7a5ce63d34cb56c08d7 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Tue, 17 Nov 2020 15:32:25 +0300 Subject: [PATCH 285/698] Build: update grovy dependencies in :compiler:tests-spec --- compiler/tests-spec/build.gradle.kts | 2 +- gradle/versions.properties | 1 + gradle/versions.properties.203 | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/tests-spec/build.gradle.kts b/compiler/tests-spec/build.gradle.kts index f56f635f789..74bad7b98bc 100644 --- a/compiler/tests-spec/build.gradle.kts +++ b/compiler/tests-spec/build.gradle.kts @@ -6,7 +6,7 @@ plugins { dependencies { testCompile(projectTests(":compiler")) testCompileOnly(intellijDep()) { - includeJars("groovy-all", rootProject = rootProject) + includeJars("groovy", "groovy-xml", rootProject = rootProject) } testCompile(intellijDep()) { includeJars("gson", rootProject = rootProject) diff --git a/gradle/versions.properties b/gradle/versions.properties index ae53f6528dc..ca6dc95ec97 100644 --- a/gradle/versions.properties +++ b/gradle/versions.properties @@ -4,6 +4,7 @@ versions.idea.NodeJS=193.6494.7 versions.jar.asm-all=8.0.1 versions.jar.guava=29.0-jre versions.jar.groovy=2.5.11 +versions.jar.groovy-xml=2.5.11 versions.jar.lombok-ast=0.2.3 versions.jar.swingx-core=1.6.2-2 versions.jar.kxml2=2.3.0 diff --git a/gradle/versions.properties.203 b/gradle/versions.properties.203 index 98ed02b7735..42e072d2d78 100644 --- a/gradle/versions.properties.203 +++ b/gradle/versions.properties.203 @@ -4,6 +4,7 @@ versions.idea.NodeJS=193.6494.7 versions.jar.asm-all=8.0.1 versions.jar.guava=29.0-jre versions.jar.groovy=2.5.11 +versions.jar.groovy-xml=2.5.11 versions.jar.lombok-ast=0.2.3 versions.jar.swingx-core=1.6.2-2 versions.jar.kxml2=2.3.0 @@ -15,4 +16,4 @@ versions.jar.serviceMessages=2019.1.4 versions.jar.lz4-java=1.7.1 ignore.jar.snappy-in-java=true versions.gradle-api=4.5.1 -versions.shadow=5.2.0 \ No newline at end of file +versions.shadow=5.2.0 From d50d56f68c3b3a8b243d1112b89e1aa3944dd2f6 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Tue, 17 Nov 2020 16:13:33 +0300 Subject: [PATCH 286/698] Build: fix API differences between 201 and 202 in NewKotlinFileAction --- ...inLightCodeInsightFixtureTestCaseBase.java | 5 +- ...htCodeInsightFixtureTestCaseBase.java.201} | 5 +- .../idea/actions/NewKotlinFileAction.kt | 4 +- .../idea/actions/NewKotlinFileAction.kt.201 | 263 ++++++++++++++++++ .../AbstractConfigureKotlinInTempDirTest.kt | 4 +- ...stractConfigureKotlinInTempDirTest.kt.201} | 2 +- .../AbstractConfigureKotlinTest.kt | 4 +- ...s42 => AbstractConfigureKotlinTest.kt.201} | 4 +- .../quickDoc/QuickDocInHierarchyTest.kt | 4 +- ...kt.as42 => QuickDocInHierarchyTest.kt.201} | 2 +- .../tests/AbstractKotlinIdentifiersTest.kt | 4 +- ...2 => AbstractKotlinIdentifiersTest.kt.201} | 2 +- 12 files changed, 283 insertions(+), 20 deletions(-) rename idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/{KotlinLightCodeInsightFixtureTestCaseBase.java.as42 => KotlinLightCodeInsightFixtureTestCaseBase.java.201} (95%) create mode 100644 idea/src/org/jetbrains/kotlin/idea/actions/NewKotlinFileAction.kt.201 rename idea/tests/org/jetbrains/kotlin/idea/configuration/{AbstractConfigureKotlinInTempDirTest.kt.as42 => AbstractConfigureKotlinInTempDirTest.kt.201} (96%) rename idea/tests/org/jetbrains/kotlin/idea/configuration/{AbstractConfigureKotlinTest.kt.as42 => AbstractConfigureKotlinTest.kt.201} (99%) rename idea/tests/org/jetbrains/kotlin/idea/editor/quickDoc/{QuickDocInHierarchyTest.kt.as42 => QuickDocInHierarchyTest.kt.201} (97%) rename plugins/uast-kotlin/tests/{AbstractKotlinIdentifiersTest.kt.as42 => AbstractKotlinIdentifiersTest.kt.201} (96%) diff --git a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCaseBase.java b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCaseBase.java index 0b25e4f48ce..6b6258f9828 100644 --- a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCaseBase.java +++ b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCaseBase.java @@ -25,6 +25,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.nio.charset.Charset; +import java.nio.file.Path; import java.util.Collection; @WithMutedInDatabaseRunTest @@ -46,7 +47,7 @@ public abstract class KotlinLightCodeInsightFixtureTestCaseBase extends LightCod return super.getFile(); } - protected final Collection myFilesToDelete = new THashSet<>(); + protected final Collection myFilesToDelete = new THashSet<>(); private final TempFiles myTempFiles = new TempFiles(myFilesToDelete); @Override @@ -65,7 +66,7 @@ public abstract class KotlinLightCodeInsightFixtureTestCaseBase extends LightCod File temp = FileUtil.createTempFile("copy", "." + ext); setContentOnDisk(temp, bom, content, charset); - myFilesToDelete.add(temp); + myFilesToDelete.add(temp.toPath()); final VirtualFile file = getVirtualFile(temp); assert file != null : temp; return file; diff --git a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCaseBase.java.as42 b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCaseBase.java.201 similarity index 95% rename from idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCaseBase.java.as42 rename to idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCaseBase.java.201 index 6b6258f9828..0b25e4f48ce 100644 --- a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCaseBase.java.as42 +++ b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCaseBase.java.201 @@ -25,7 +25,6 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.nio.charset.Charset; -import java.nio.file.Path; import java.util.Collection; @WithMutedInDatabaseRunTest @@ -47,7 +46,7 @@ public abstract class KotlinLightCodeInsightFixtureTestCaseBase extends LightCod return super.getFile(); } - protected final Collection myFilesToDelete = new THashSet<>(); + protected final Collection myFilesToDelete = new THashSet<>(); private final TempFiles myTempFiles = new TempFiles(myFilesToDelete); @Override @@ -66,7 +65,7 @@ public abstract class KotlinLightCodeInsightFixtureTestCaseBase extends LightCod File temp = FileUtil.createTempFile("copy", "." + ext); setContentOnDisk(temp, bom, content, charset); - myFilesToDelete.add(temp.toPath()); + myFilesToDelete.add(temp); final VirtualFile file = getVirtualFile(temp); assert file != null : temp; return file; diff --git a/idea/src/org/jetbrains/kotlin/idea/actions/NewKotlinFileAction.kt b/idea/src/org/jetbrains/kotlin/idea/actions/NewKotlinFileAction.kt index e366c6c2127..48ec0ce9c98 100644 --- a/idea/src/org/jetbrains/kotlin/idea/actions/NewKotlinFileAction.kt +++ b/idea/src/org/jetbrains/kotlin/idea/actions/NewKotlinFileAction.kt @@ -47,10 +47,10 @@ class NewKotlinFileAction : CreateFileFromTemplateAction( KotlinBundle.message("action.new.file.description"), KotlinFileType.INSTANCE.icon ), DumbAware { - override fun postProcess(createdElement: PsiFile?, templateName: String?, customProperties: Map?) { + override fun postProcess(createdElement: PsiFile, templateName: String?, customProperties: Map?) { super.postProcess(createdElement, templateName, customProperties) - val module = ModuleUtilCore.findModuleForPsiElement(createdElement!!) + val module = ModuleUtilCore.findModuleForPsiElement(createdElement) if (createdElement is KtFile) { if (module != null) { diff --git a/idea/src/org/jetbrains/kotlin/idea/actions/NewKotlinFileAction.kt.201 b/idea/src/org/jetbrains/kotlin/idea/actions/NewKotlinFileAction.kt.201 new file mode 100644 index 00000000000..e366c6c2127 --- /dev/null +++ b/idea/src/org/jetbrains/kotlin/idea/actions/NewKotlinFileAction.kt.201 @@ -0,0 +1,263 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.actions + +import com.intellij.ide.actions.CreateFileFromTemplateAction +import com.intellij.ide.actions.CreateFileFromTemplateDialog +import com.intellij.ide.actions.CreateFromTemplateAction +import com.intellij.ide.fileTemplates.FileTemplate +import com.intellij.ide.fileTemplates.FileTemplateManager +import com.intellij.ide.fileTemplates.actions.AttributesDefaults +import com.intellij.ide.fileTemplates.ui.CreateFromTemplateDialog +import com.intellij.openapi.actionSystem.DataContext +import com.intellij.openapi.actionSystem.LangDataKeys +import com.intellij.openapi.actionSystem.PlatformDataKeys +import com.intellij.openapi.editor.LogicalPosition +import com.intellij.openapi.extensions.ExtensionPointName +import com.intellij.openapi.fileEditor.FileEditorManager +import com.intellij.openapi.module.Module +import com.intellij.openapi.module.ModuleUtilCore +import com.intellij.openapi.project.DumbAware +import com.intellij.openapi.project.DumbService +import com.intellij.openapi.project.Project +import com.intellij.openapi.roots.ProjectRootManager +import com.intellij.openapi.ui.InputValidatorEx +import com.intellij.psi.PsiDirectory +import com.intellij.psi.PsiFile +import com.intellij.util.IncorrectOperationException +import org.jetbrains.annotations.TestOnly +import org.jetbrains.kotlin.idea.KotlinBundle +import org.jetbrains.kotlin.idea.KotlinFileType +import org.jetbrains.kotlin.idea.KotlinIcons +import org.jetbrains.kotlin.idea.statistics.FUSEventGroups +import org.jetbrains.kotlin.idea.statistics.KotlinFUSLogger +import org.jetbrains.kotlin.idea.util.application.runWriteAction +import org.jetbrains.kotlin.lexer.KtTokens +import org.jetbrains.kotlin.parsing.KotlinParserDefinition.Companion.STD_SCRIPT_SUFFIX +import org.jetbrains.kotlin.psi.KtClass +import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.psi.KtNamedDeclaration +import java.util.* + +class NewKotlinFileAction : CreateFileFromTemplateAction( + KotlinBundle.message("action.new.file.text"), + KotlinBundle.message("action.new.file.description"), + KotlinFileType.INSTANCE.icon +), DumbAware { + override fun postProcess(createdElement: PsiFile?, templateName: String?, customProperties: Map?) { + super.postProcess(createdElement, templateName, customProperties) + + val module = ModuleUtilCore.findModuleForPsiElement(createdElement!!) + + if (createdElement is KtFile) { + if (module != null) { + for (hook in NewKotlinFileHook.EP_NAME.extensions) { + hook.postProcess(createdElement, module) + } + } + + val ktClass = createdElement.declarations.singleOrNull() as? KtNamedDeclaration + if (ktClass != null) { + CreateFromTemplateAction.moveCaretAfterNameIdentifier(ktClass) + } else { + val editor = FileEditorManager.getInstance(createdElement.project).selectedTextEditor ?: return + if (editor.document == createdElement.viewProvider.document) { + val lineCount = editor.document.lineCount + if (lineCount > 0) { + editor.caretModel.moveToLogicalPosition(LogicalPosition(lineCount - 1, 0)) + } + } + } + } + } + + override fun buildDialog(project: Project, directory: PsiDirectory, builder: CreateFileFromTemplateDialog.Builder) { + builder.setTitle(KotlinBundle.message("action.new.file.dialog.title")) + .addKind( + KotlinBundle.message("action.new.file.dialog.class.title"), + KotlinIcons.CLASS, + "Kotlin Class" + ) + .addKind( + KotlinBundle.message("action.new.file.dialog.file.title"), + KotlinFileType.INSTANCE.icon, + "Kotlin File" + ) + .addKind( + KotlinBundle.message("action.new.file.dialog.interface.title"), + KotlinIcons.INTERFACE, + "Kotlin Interface" + ) + .addKind( + KotlinBundle.message("action.new.file.dialog.data.class.title"), + KotlinIcons.CLASS, + "Kotlin Data Class" + ) + .addKind( + KotlinBundle.message("action.new.file.dialog.enum.title"), + KotlinIcons.ENUM, + "Kotlin Enum" + ) + .addKind( + KotlinBundle.message("action.new.file.dialog.sealed.class.title"), + KotlinIcons.CLASS, + "Kotlin Sealed Class" + ) + .addKind( + KotlinBundle.message("action.new.file.dialog.annotation.title"), + KotlinIcons.ANNOTATION, + "Kotlin Annotation" + ) + .addKind( + KotlinBundle.message("action.new.file.dialog.object.title"), + KotlinIcons.OBJECT, + "Kotlin Object" + ) + + builder.setValidator(NameValidator) + } + + override fun getActionName(directory: PsiDirectory, newName: String, templateName: String): String = + KotlinBundle.message("action.new.file.text") + + override fun isAvailable(dataContext: DataContext): Boolean { + if (super.isAvailable(dataContext)) { + val ideView = LangDataKeys.IDE_VIEW.getData(dataContext)!! + val project = PlatformDataKeys.PROJECT.getData(dataContext)!! + val projectFileIndex = ProjectRootManager.getInstance(project).fileIndex + return ideView.directories.any { projectFileIndex.isInSourceContent(it.virtualFile) } + } + + return false + } + + override fun hashCode(): Int = 0 + + override fun equals(other: Any?): Boolean = other is NewKotlinFileAction + + override fun startInWriteAction() = false + + override fun createFileFromTemplate(name: String, template: FileTemplate, dir: PsiDirectory) = + createFileFromTemplateWithStat(name, template, dir) + + companion object { + private object NameValidator : InputValidatorEx { + override fun getErrorText(inputString: String): String? { + if (inputString.trim().isEmpty()) { + return KotlinBundle.message("action.new.file.error.empty.name") + } + + val parts: List = inputString.split(*FQNAME_SEPARATORS) + if (parts.any { it.trim().isEmpty() }) { + return KotlinBundle.message("action.new.file.error.empty.name.part") + } + + return null + } + + override fun checkInput(inputString: String): Boolean = true + + override fun canClose(inputString: String): Boolean = getErrorText(inputString) == null + } + + @get:TestOnly + val nameValidator: InputValidatorEx + get() = NameValidator + + private fun findOrCreateTarget(dir: PsiDirectory, name: String, directorySeparators: CharArray): Pair { + var className = removeKotlinExtensionIfPresent(name) + var targetDir = dir + + for (splitChar in directorySeparators) { + if (splitChar in className) { + val names = className.trim().split(splitChar) + + for (dirName in names.dropLast(1)) { + targetDir = targetDir.findSubdirectory(dirName) ?: runWriteAction { + targetDir.createSubdirectory(dirName) + } + } + + className = names.last() + break + } + } + return Pair(className, targetDir) + } + + private fun removeKotlinExtensionIfPresent(name: String): String = when { + name.endsWith(".$KOTLIN_WORKSHEET_EXTENSION") -> name.removeSuffix(".$KOTLIN_WORKSHEET_EXTENSION") + name.endsWith(".$STD_SCRIPT_SUFFIX") -> name.removeSuffix(".$STD_SCRIPT_SUFFIX") + name.endsWith(".${KotlinFileType.EXTENSION}") -> name.removeSuffix(".${KotlinFileType.EXTENSION}") + else -> name + } + + private fun createFromTemplate(dir: PsiDirectory, className: String, template: FileTemplate): PsiFile? { + val project = dir.project + val defaultProperties = FileTemplateManager.getInstance(project).defaultProperties + + val properties = Properties(defaultProperties) + + val element = try { + CreateFromTemplateDialog( + project, dir, template, + AttributesDefaults(className).withFixedName(true), + properties + ).create() + } catch (e: IncorrectOperationException) { + throw e + } catch (e: Exception) { + LOG.error(e) + return null + } + + return element?.containingFile + } + + private val FILE_SEPARATORS = charArrayOf('/', '\\') + private val FQNAME_SEPARATORS = charArrayOf('/', '\\', '.') + + fun createFileFromTemplateWithStat(name: String, template: FileTemplate, dir: PsiDirectory): PsiFile? { + KotlinFUSLogger.log(FUSEventGroups.NewFileTemplate, template.name) + return createFileFromTemplate(name, template, dir) + } + + + fun createFileFromTemplate(name: String, template: FileTemplate, dir: PsiDirectory): PsiFile? { + val directorySeparators = when (template.name) { + "Kotlin File" -> FILE_SEPARATORS + else -> FQNAME_SEPARATORS + } + val (className, targetDir) = findOrCreateTarget(dir, name, directorySeparators) + + val service = DumbService.getInstance(dir.project) + service.isAlternativeResolveEnabled = true + try { + val psiFile = createFromTemplate(targetDir, className, template) + if (psiFile is KtFile) { + val singleClass = psiFile.declarations.singleOrNull() as? KtClass + if (singleClass != null && !singleClass.isEnum() && !singleClass.isInterface() && name.contains("Abstract")) { + runWriteAction { + singleClass.addModifier(KtTokens.ABSTRACT_KEYWORD) + } + } + } + return psiFile + } finally { + service.isAlternativeResolveEnabled = false + } + } + } +} + +abstract class NewKotlinFileHook { + companion object { + val EP_NAME: ExtensionPointName = + ExtensionPointName.create("org.jetbrains.kotlin.newFileHook") + } + + abstract fun postProcess(createdElement: KtFile, module: Module) +} diff --git a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinInTempDirTest.kt b/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinInTempDirTest.kt index 7c2314647a2..033162dce47 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinInTempDirTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinInTempDirTest.kt @@ -15,7 +15,7 @@ abstract class AbstractConfigureKotlinInTempDirTest : AbstractConfigureKotlinTes override fun getProjectDirOrFile(): Path { val tempDir = FileUtil.generateRandomTemporaryPath() FileUtil.createTempDirectory("temp", null) - myFilesToDelete.add(tempDir) + myFilesToDelete.add(tempDir.toPath()) FileUtil.copyDir(File(projectRoot), tempDir) @@ -35,4 +35,4 @@ abstract class AbstractConfigureKotlinInTempDirTest : AbstractConfigureKotlinTes return File(projectFilePath).toPath() } -} \ No newline at end of file +} diff --git a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinInTempDirTest.kt.as42 b/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinInTempDirTest.kt.201 similarity index 96% rename from idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinInTempDirTest.kt.as42 rename to idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinInTempDirTest.kt.201 index f294dc05192..7c2314647a2 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinInTempDirTest.kt.as42 +++ b/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinInTempDirTest.kt.201 @@ -15,7 +15,7 @@ abstract class AbstractConfigureKotlinInTempDirTest : AbstractConfigureKotlinTes override fun getProjectDirOrFile(): Path { val tempDir = FileUtil.generateRandomTemporaryPath() FileUtil.createTempDirectory("temp", null) - myFilesToDelete.add(tempDir.toPath()) + myFilesToDelete.add(tempDir) FileUtil.copyDir(File(projectRoot), tempDir) diff --git a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt b/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt index a5fc2e68565..ca559548588 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt @@ -237,14 +237,14 @@ abstract class AbstractConfigureKotlinTest : PlatformTestCase() { private val pathToNonexistentRuntimeJar: String get() { val pathToTempKotlinRuntimeJar = FileUtil.getTempDirectory() + "/" + PathUtil.KOTLIN_JAVA_STDLIB_JAR - myFilesToDelete.add(File(pathToTempKotlinRuntimeJar)) + myFilesToDelete.add(File(pathToTempKotlinRuntimeJar).toPath()) return pathToTempKotlinRuntimeJar } private val pathToNonexistentJsJar: String get() { val pathToTempKotlinRuntimeJar = FileUtil.getTempDirectory() + "/" + PathUtil.JS_LIB_JAR_NAME - myFilesToDelete.add(File(pathToTempKotlinRuntimeJar)) + myFilesToDelete.add(File(pathToTempKotlinRuntimeJar).toPath()) return pathToTempKotlinRuntimeJar } diff --git a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt.as42 b/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt.201 similarity index 99% rename from idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt.as42 rename to idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt.201 index ca559548588..a5fc2e68565 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt.as42 +++ b/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt.201 @@ -237,14 +237,14 @@ abstract class AbstractConfigureKotlinTest : PlatformTestCase() { private val pathToNonexistentRuntimeJar: String get() { val pathToTempKotlinRuntimeJar = FileUtil.getTempDirectory() + "/" + PathUtil.KOTLIN_JAVA_STDLIB_JAR - myFilesToDelete.add(File(pathToTempKotlinRuntimeJar).toPath()) + myFilesToDelete.add(File(pathToTempKotlinRuntimeJar)) return pathToTempKotlinRuntimeJar } private val pathToNonexistentJsJar: String get() { val pathToTempKotlinRuntimeJar = FileUtil.getTempDirectory() + "/" + PathUtil.JS_LIB_JAR_NAME - myFilesToDelete.add(File(pathToTempKotlinRuntimeJar).toPath()) + myFilesToDelete.add(File(pathToTempKotlinRuntimeJar)) return pathToTempKotlinRuntimeJar } diff --git a/idea/tests/org/jetbrains/kotlin/idea/editor/quickDoc/QuickDocInHierarchyTest.kt b/idea/tests/org/jetbrains/kotlin/idea/editor/quickDoc/QuickDocInHierarchyTest.kt index a7baabe6813..991f8eedde0 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/editor/quickDoc/QuickDocInHierarchyTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/editor/quickDoc/QuickDocInHierarchyTest.kt @@ -39,7 +39,7 @@ class QuickDocInHierarchyTest() : CodeInsightTestCase() { val provider = BrowseHierarchyActionBase.findProvider(LanguageTypeHierarchy.INSTANCE, file, file, context)!! val hierarchyTreeStructure = TypeHierarchyTreeStructure( project, - provider.getTarget(context) as PsiClass?, + provider.getTarget(context) as PsiClass, HierarchyBrowserBaseEx.SCOPE_PROJECT ) val hierarchyNodeDescriptor = hierarchyTreeStructure.baseDescriptor as TypeHierarchyNodeDescriptor @@ -47,4 +47,4 @@ class QuickDocInHierarchyTest() : CodeInsightTestCase() { TestCase.assertTrue("Invalid doc\n: $doc", doc.contains("Very special class")) } -} \ No newline at end of file +} diff --git a/idea/tests/org/jetbrains/kotlin/idea/editor/quickDoc/QuickDocInHierarchyTest.kt.as42 b/idea/tests/org/jetbrains/kotlin/idea/editor/quickDoc/QuickDocInHierarchyTest.kt.201 similarity index 97% rename from idea/tests/org/jetbrains/kotlin/idea/editor/quickDoc/QuickDocInHierarchyTest.kt.as42 rename to idea/tests/org/jetbrains/kotlin/idea/editor/quickDoc/QuickDocInHierarchyTest.kt.201 index b72366c2c05..a7baabe6813 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/editor/quickDoc/QuickDocInHierarchyTest.kt.as42 +++ b/idea/tests/org/jetbrains/kotlin/idea/editor/quickDoc/QuickDocInHierarchyTest.kt.201 @@ -39,7 +39,7 @@ class QuickDocInHierarchyTest() : CodeInsightTestCase() { val provider = BrowseHierarchyActionBase.findProvider(LanguageTypeHierarchy.INSTANCE, file, file, context)!! val hierarchyTreeStructure = TypeHierarchyTreeStructure( project, - provider.getTarget(context) as PsiClass, + provider.getTarget(context) as PsiClass?, HierarchyBrowserBaseEx.SCOPE_PROJECT ) val hierarchyNodeDescriptor = hierarchyTreeStructure.baseDescriptor as TypeHierarchyNodeDescriptor diff --git a/plugins/uast-kotlin/tests/AbstractKotlinIdentifiersTest.kt b/plugins/uast-kotlin/tests/AbstractKotlinIdentifiersTest.kt index dddfe20241f..7c34fe83fac 100644 --- a/plugins/uast-kotlin/tests/AbstractKotlinIdentifiersTest.kt +++ b/plugins/uast-kotlin/tests/AbstractKotlinIdentifiersTest.kt @@ -5,7 +5,7 @@ import org.jetbrains.uast.* import org.jetbrains.uast.test.common.UElementToParentMap import org.jetbrains.uast.test.common.kotlin.IdentifiersTestBase import org.jetbrains.uast.test.common.visitUFileAndGetResult -import org.jetbrains.uast.test.env.assertEqualsToFile +import org.jetbrains.uast.test.env.kotlin.assertEqualsToFile import java.io.File import kotlin.test.assertNotNull @@ -34,4 +34,4 @@ private fun refNameRetriever(psiElement: PsiElement): UElement? = fun UFile.asRefNames() = object : UElementToParentMap(::refNameRetriever) { override fun renderSource(element: PsiElement): String = element.javaClass.simpleName -}.visitUFileAndGetResult(this) \ No newline at end of file +}.visitUFileAndGetResult(this) diff --git a/plugins/uast-kotlin/tests/AbstractKotlinIdentifiersTest.kt.as42 b/plugins/uast-kotlin/tests/AbstractKotlinIdentifiersTest.kt.201 similarity index 96% rename from plugins/uast-kotlin/tests/AbstractKotlinIdentifiersTest.kt.as42 rename to plugins/uast-kotlin/tests/AbstractKotlinIdentifiersTest.kt.201 index 85df068ee10..dddfe20241f 100644 --- a/plugins/uast-kotlin/tests/AbstractKotlinIdentifiersTest.kt.as42 +++ b/plugins/uast-kotlin/tests/AbstractKotlinIdentifiersTest.kt.201 @@ -1,11 +1,11 @@ package org.jetbrains.uast.test.kotlin import com.intellij.psi.PsiElement -import com.intellij.testFramework.assertEqualsToFile import org.jetbrains.uast.* import org.jetbrains.uast.test.common.UElementToParentMap import org.jetbrains.uast.test.common.kotlin.IdentifiersTestBase import org.jetbrains.uast.test.common.visitUFileAndGetResult +import org.jetbrains.uast.test.env.assertEqualsToFile import java.io.File import kotlin.test.assertNotNull From 2a053c214d7f1c21e44813093da376e7b694af4c Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Tue, 17 Nov 2020 16:13:55 +0300 Subject: [PATCH 287/698] Build: fix API differences between 201 and 202 in scratch tests --- .../scratch/AbstractScratchRunActionTest.kt | 13 ++-- ...42 => AbstractScratchRunActionTest.kt.201} | 9 +-- .../idea/scratch/ScratchLineMarkersTest.kt | 12 +-- .../scratch/ScratchLineMarkersTest.kt.as42 | 74 ------------------- 4 files changed, 16 insertions(+), 92 deletions(-) rename idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/{AbstractScratchRunActionTest.kt.as42 => AbstractScratchRunActionTest.kt.201} (98%) delete mode 100644 idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/ScratchLineMarkersTest.kt.as42 diff --git a/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/AbstractScratchRunActionTest.kt b/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/AbstractScratchRunActionTest.kt index 5a6f7addea6..ce1bd8963cb 100644 --- a/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/AbstractScratchRunActionTest.kt +++ b/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/AbstractScratchRunActionTest.kt @@ -318,13 +318,16 @@ abstract class AbstractScratchRunActionTest : FileEditorManagerTestCase() { } override fun tearDown() { +// myFixture?.file?.virtualFile?.let { +// runWriteAction { +// if (it.isValid) { +// it.delete(this) +// } +// } +// } super.tearDown() VfsRootAccess.disallowRootAccess(KotlinTestUtils.getHomeDirectory()) - - ScratchFileService.getInstance().scratchesMapping.mappings.forEach { file, _ -> - runWriteAction { file.delete(this) } - } } companion object { @@ -376,4 +379,4 @@ abstract class AbstractScratchRunActionTest : FileEditorManagerTestCase() { } } -} \ No newline at end of file +} diff --git a/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/AbstractScratchRunActionTest.kt.as42 b/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/AbstractScratchRunActionTest.kt.201 similarity index 98% rename from idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/AbstractScratchRunActionTest.kt.as42 rename to idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/AbstractScratchRunActionTest.kt.201 index a1a09edca3b..5a6f7addea6 100644 --- a/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/AbstractScratchRunActionTest.kt.as42 +++ b/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/AbstractScratchRunActionTest.kt.201 @@ -7,8 +7,6 @@ package org.jetbrains.kotlin.idea.scratch import com.intellij.ide.scratch.ScratchFileService import com.intellij.ide.scratch.ScratchRootType -import com.intellij.lang.Language -import com.intellij.lang.PerFileMappingsEx import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.CommonDataKeys import com.intellij.openapi.module.Module @@ -26,6 +24,7 @@ import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime import org.jetbrains.kotlin.idea.KotlinLanguage import org.jetbrains.kotlin.idea.actions.KOTLIN_WORKSHEET_EXTENSION import org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager +import org.jetbrains.kotlin.idea.debugger.coroutine.util.logger import org.jetbrains.kotlin.idea.highlighter.KotlinHighlightingUtil import org.jetbrains.kotlin.idea.scratch.actions.ClearScratchAction import org.jetbrains.kotlin.idea.scratch.actions.RunScratchAction @@ -323,9 +322,9 @@ abstract class AbstractScratchRunActionTest : FileEditorManagerTestCase() { VfsRootAccess.disallowRootAccess(KotlinTestUtils.getHomeDirectory()) -// (ScratchFileService.getInstance().scratchesMapping as PerFileMappingsEx).mappings.forEach { (file, _) -> -// runWriteAction { file.delete(this) } -// } + ScratchFileService.getInstance().scratchesMapping.mappings.forEach { file, _ -> + runWriteAction { file.delete(this) } + } } companion object { diff --git a/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/ScratchLineMarkersTest.kt b/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/ScratchLineMarkersTest.kt index 96dc27720a9..bf8c57890bc 100644 --- a/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/ScratchLineMarkersTest.kt +++ b/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/ScratchLineMarkersTest.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.idea.scratch import com.intellij.codeInsight.daemon.LineMarkerInfo import com.intellij.ide.scratch.ScratchFileService import com.intellij.ide.scratch.ScratchRootType +import com.intellij.openapi.application.Application import com.intellij.openapi.editor.Document import com.intellij.openapi.fileEditor.FileEditorManager import com.intellij.openapi.util.io.FileUtil @@ -54,13 +55,8 @@ abstract class AbstractScratchLineMarkersTest : FileEditorManagerTestCase() { val markers = doAndCheckHighlighting(document, data, File(path)) AbstractLineMarkersTest.assertNavigationElements(myFixture.project, myFixture.file as KtFile, markers) - } - - override fun tearDown() { - super.tearDown() - - ScratchFileService.getInstance().scratchesMapping.mappings.forEach { file, _ -> - runWriteAction { file.delete(this) } + runWriteAction { + scratchVirtualFile.delete(this) } } @@ -72,4 +68,4 @@ abstract class AbstractScratchLineMarkersTest : FileEditorManagerTestCase() { return AbstractLineMarkersTest.checkHighlighting(myFixture.file, documentToAnalyze, expectedHighlighting, expectedFile) } -} \ No newline at end of file +} diff --git a/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/ScratchLineMarkersTest.kt.as42 b/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/ScratchLineMarkersTest.kt.as42 deleted file mode 100644 index b08291d98dd..00000000000 --- a/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/ScratchLineMarkersTest.kt.as42 +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.scratch - -import com.intellij.codeInsight.daemon.LineMarkerInfo -import com.intellij.ide.scratch.ScratchFileService -import com.intellij.ide.scratch.ScratchRootType -import com.intellij.openapi.editor.Document -import com.intellij.openapi.fileEditor.FileEditorManager -import com.intellij.openapi.util.io.FileUtil -import com.intellij.psi.PsiDocumentManager -import com.intellij.testFramework.ExpectedHighlightingData -import com.intellij.testFramework.FileEditorManagerTestCase -import org.jetbrains.kotlin.idea.KotlinLanguage -import org.jetbrains.kotlin.idea.codeInsight.AbstractLineMarkersTest -import org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager -import org.jetbrains.kotlin.idea.scratch.AbstractScratchRunActionTest.Companion.configureOptions -import org.jetbrains.kotlin.psi.KtFile -import java.io.File - -abstract class AbstractScratchLineMarkersTest : FileEditorManagerTestCase() { - fun doScratchTest(path: String) { - val fileText = FileUtil.loadFile(File(path)) - - val scratchVirtualFile = ScratchRootType.getInstance().createScratchFile( - project, - "scratch.kts", - KotlinLanguage.INSTANCE, - fileText, - ScratchFileService.Option.create_if_missing - ) ?: error("Couldn't create scratch file") - - myFixture.openFileInEditor(scratchVirtualFile) - - ScriptConfigurationManager.updateScriptDependenciesSynchronously(myFixture.file) - - val scratchFileEditor = getScratchEditorForSelectedFile(FileEditorManager.getInstance(project), myFixture.file.virtualFile) - ?: error("Couldn't find scratch panel") - - configureOptions(scratchFileEditor, fileText, null) - - val project = myFixture.project - val document = myFixture.editor.document - - val data = ExpectedHighlightingData(document, false, false, false) - data.init() - - PsiDocumentManager.getInstance(project).commitAllDocuments() - - val markers = doAndCheckHighlighting(document, data, File(path)) - - AbstractLineMarkersTest.assertNavigationElements(myFixture.project, myFixture.file as KtFile, markers) - } - - override fun tearDown() { - super.tearDown() - -// (ScratchFileService.getInstance().scratchesMapping as PerFileMappingsEx).mappings.forEach { file, _ -> -// runWriteAction { file.delete(this) } -// } - } - - private fun doAndCheckHighlighting( - documentToAnalyze: Document, expectedHighlighting: ExpectedHighlightingData, expectedFile: File - ): List> { - myFixture.doHighlighting() - - return AbstractLineMarkersTest.checkHighlighting(myFixture.file, documentToAnalyze, expectedHighlighting, expectedFile) - } - -} \ No newline at end of file From 4779092ba5ddb68b38707df9f780b5be4e01121c Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Tue, 17 Nov 2020 16:14:05 +0300 Subject: [PATCH 288/698] Build: fix API differences between 201 and 202 in idea performance tests --- .../jetbrains/kotlin/idea/testFramework/gradleRoutines.kt | 7 +++---- .../jetbrains/kotlin/idea/testFramework/projectRoutines.kt | 5 ++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/gradleRoutines.kt b/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/gradleRoutines.kt index da3836f7aff..c5a1f8336cd 100644 --- a/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/gradleRoutines.kt +++ b/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/gradleRoutines.kt @@ -12,16 +12,15 @@ import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil import com.intellij.openapi.externalSystem.util.ExternalSystemUtil import com.intellij.openapi.project.DumbService import com.intellij.openapi.project.Project -import com.intellij.openapi.roots.ProjectRootManager import org.gradle.util.GradleVersion -import org.jetbrains.plugins.gradle.service.project.open.setupGradleSettings +import org.jetbrains.plugins.gradle.service.project.open.setupGradleProjectSettings import org.jetbrains.plugins.gradle.settings.GradleProjectSettings import org.jetbrains.plugins.gradle.settings.GradleSettings import org.jetbrains.plugins.gradle.util.GradleConstants import org.jetbrains.plugins.gradle.util.GradleLog import org.jetbrains.plugins.gradle.util.suggestGradleVersion import java.io.File -import kotlin.test.assertNotNull +import java.nio.file.Paths fun refreshGradleProject(projectPath: String, project: Project) { _importProject(File(projectPath).absolutePath, project) @@ -42,7 +41,7 @@ private fun _importProject(projectPath: String, project: Project) { GradleSettings.getInstance(project).gradleVmOptions = "-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${System.getProperty("user.dir")}" - setupGradleSettings(project, gradleProjectSettings, projectPath, gradleVersion) + gradleProjectSettings.setupGradleProjectSettings(Paths.get(projectPath)) gradleProjectSettings.gradleJvm = GRADLE_JDK_NAME GradleSettings.getInstance(project).getLinkedProjectSettings(projectPath)?.let { linkedProjectSettings -> diff --git a/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt b/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt index 756f62ec7f0..9064f7ebce9 100644 --- a/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt +++ b/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt @@ -21,7 +21,6 @@ import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.openapi.project.Project import com.intellij.openapi.project.ex.ProjectManagerEx import com.intellij.openapi.startup.StartupManager -import com.intellij.platform.PlatformProjectOpenProcessor import com.intellij.psi.PsiDocumentManager import com.intellij.psi.impl.PsiDocumentManagerBase import com.intellij.testFramework.ExtensionTestUtil @@ -70,7 +69,7 @@ fun dispatchAllInvocationEvents() { } fun loadProjectWithName(path: String, name: String): Project? = - PlatformProjectOpenProcessor.openExistingProject(Paths.get(path), Paths.get(path), OpenProjectTask(projectName = name)) + ProjectManagerEx.getInstanceEx().openProject(Paths.get(path), OpenProjectTask(projectName = name)) fun TestApplicationManager.closeProject(project: Project) { val name = project.name @@ -114,4 +113,4 @@ fun replaceWithCustomHighlighter(parentDisposable: Disposable, fromImplementatio if (filteredExtensions.size < extensions.size) { ExtensionTestUtil.maskExtensions(pointName, filteredExtensions + listOf(point), parentDisposable) } -} \ No newline at end of file +} From d887814cc52f7a83112e57366709a77f8f6e2b3c Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Tue, 17 Nov 2020 17:10:31 +0300 Subject: [PATCH 289/698] Build: fix compilation of :libraries:tools:kotlin-maven-plugin-test --- .../java/org.jetbrains.kotlin.maven/MavenExecutionResult.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/tools/kotlin-maven-plugin-test/src/test/java/org.jetbrains.kotlin.maven/MavenExecutionResult.java b/libraries/tools/kotlin-maven-plugin-test/src/test/java/org.jetbrains.kotlin.maven/MavenExecutionResult.java index af3231127f2..5c473c43254 100644 --- a/libraries/tools/kotlin-maven-plugin-test/src/test/java/org.jetbrains.kotlin.maven/MavenExecutionResult.java +++ b/libraries/tools/kotlin-maven-plugin-test/src/test/java/org.jetbrains.kotlin.maven/MavenExecutionResult.java @@ -107,8 +107,8 @@ class MavenExecutionResult { } Arrays.sort(expectedPaths); - String expected = StringUtil.join(expectedPaths, "\n"); - String actual = StringUtil.join(actualPaths, "\n"); + String expected = StringUtil.join(Arrays.asList(expectedPaths), "\n"); + String actual = StringUtil.join(Arrays.asList(actualPaths), "\n"); Assert.assertEquals("Compiled files differ", expected, actual); } }); From 48cbb74a01790429f3e91b4d860c1f64ce89e194 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Tue, 17 Nov 2020 17:59:29 +0300 Subject: [PATCH 290/698] Build: drop deprecated extension point used in test of old j2k --- ...ractJavaToKotlinConverterForWebDemoTest.kt | 3 +- ...JavaToKotlinConverterForWebDemoTest.kt.201 | 134 ++++++++++++++++++ 2 files changed, 135 insertions(+), 2 deletions(-) create mode 100644 j2k/tests/org/jetbrains/kotlin/j2k/AbstractJavaToKotlinConverterForWebDemoTest.kt.201 diff --git a/j2k/tests/org/jetbrains/kotlin/j2k/AbstractJavaToKotlinConverterForWebDemoTest.kt b/j2k/tests/org/jetbrains/kotlin/j2k/AbstractJavaToKotlinConverterForWebDemoTest.kt index 9a897743bbe..cd5a8b9e9a7 100644 --- a/j2k/tests/org/jetbrains/kotlin/j2k/AbstractJavaToKotlinConverterForWebDemoTest.kt +++ b/j2k/tests/org/jetbrains/kotlin/j2k/AbstractJavaToKotlinConverterForWebDemoTest.kt @@ -109,9 +109,8 @@ abstract class AbstractJavaToKotlinConverterForWebDemoTest : TestCase() { CoreApplicationEnvironment.registerExtensionPoint(area, JavaMainMethodProvider.EP_NAME, JavaMainMethodProvider::class.java) CoreApplicationEnvironment.registerExtensionPoint(area, ContainerProvider.EP_NAME, ContainerProvider::class.java) - CoreApplicationEnvironment.registerExtensionPoint(area, ClassFileDecompilers.EP_NAME, ClassFileDecompilers.Decompiler::class.java) + CoreApplicationEnvironment.registerExtensionPoint(area, ClassFileDecompilers.getInstance().EP_NAME, ClassFileDecompilers.Decompiler::class.java) - CoreApplicationEnvironment.registerExtensionPoint(area, TypeAnnotationModifier.EP_NAME, TypeAnnotationModifier::class.java) CoreApplicationEnvironment.registerExtensionPoint(area, MetaLanguage.EP_NAME, MetaLanguage::class.java) CoreApplicationEnvironment.registerExtensionPoint(area, JavaModuleSystem.EP_NAME, JavaModuleSystem::class.java) } diff --git a/j2k/tests/org/jetbrains/kotlin/j2k/AbstractJavaToKotlinConverterForWebDemoTest.kt.201 b/j2k/tests/org/jetbrains/kotlin/j2k/AbstractJavaToKotlinConverterForWebDemoTest.kt.201 new file mode 100644 index 00000000000..9a897743bbe --- /dev/null +++ b/j2k/tests/org/jetbrains/kotlin/j2k/AbstractJavaToKotlinConverterForWebDemoTest.kt.201 @@ -0,0 +1,134 @@ +/* + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.j2k + +import com.intellij.codeInsight.ContainerProvider +import com.intellij.codeInsight.NullableNotNullManager +import com.intellij.codeInsight.NullableNotNullManagerImpl +import com.intellij.codeInsight.runner.JavaMainMethodProvider +import com.intellij.core.CoreApplicationEnvironment +import com.intellij.core.JavaCoreApplicationEnvironment +import com.intellij.core.JavaCoreProjectEnvironment +import com.intellij.lang.MetaLanguage +import com.intellij.lang.jvm.facade.JvmElementProvider +import com.intellij.openapi.extensions.Extensions +import com.intellij.openapi.extensions.ExtensionsArea +import com.intellij.openapi.util.Disposer +import com.intellij.openapi.util.io.FileUtil +import com.intellij.psi.* +import com.intellij.psi.augment.PsiAugmentProvider +import com.intellij.psi.augment.TypeAnnotationModifier +import com.intellij.psi.compiled.ClassFileDecompilers +import com.intellij.psi.impl.JavaClassSupersImpl +import com.intellij.psi.impl.PsiTreeChangePreprocessor +import com.intellij.psi.meta.MetaDataContributor +import com.intellij.psi.util.JavaClassSupers +import junit.framework.TestCase +import org.jetbrains.kotlin.utils.PathUtil +import java.io.File +import java.net.URLClassLoader + +abstract class AbstractJavaToKotlinConverterForWebDemoTest : TestCase() { + val DISPOSABLE = Disposer.newDisposable() + + fun doTest(javaPath: String) { + try { + val fileContents = FileUtil.loadFile(File(javaPath), true) + val javaCoreEnvironment: JavaCoreProjectEnvironment = setUpJavaCoreEnvironment() + translateToKotlin(fileContents, javaCoreEnvironment.project) + } + finally { + Disposer.dispose(DISPOSABLE) + } + } + + fun setUpJavaCoreEnvironment(): JavaCoreProjectEnvironment { + // FIXME: There is no `Extensions.cleanRootArea` in 193 platform + // Extensions.cleanRootArea(DISPOSABLE) + val area = Extensions.getRootArea() + + registerExtensionPoints(area) + + val applicationEnvironment = JavaCoreApplicationEnvironment(DISPOSABLE) + val javaCoreEnvironment = object : JavaCoreProjectEnvironment(DISPOSABLE, applicationEnvironment) { + override fun preregisterServices() { + val projectArea = Extensions.getArea(project) + CoreApplicationEnvironment.registerExtensionPoint(projectArea, PsiTreeChangePreprocessor.EP_NAME, PsiTreeChangePreprocessor::class.java) + CoreApplicationEnvironment.registerExtensionPoint(projectArea, PsiElementFinder.EP_NAME, PsiElementFinder::class.java) + CoreApplicationEnvironment.registerExtensionPoint(projectArea, JvmElementProvider.EP_NAME, JvmElementProvider::class.java) + } + } + + javaCoreEnvironment.project.registerService(NullableNotNullManager::class.java, object : NullableNotNullManagerImpl(javaCoreEnvironment.project) { + override fun isNullable(owner: PsiModifierListOwner, checkBases: Boolean) = !isNotNull(owner, checkBases) + override fun isNotNull(owner: PsiModifierListOwner, checkBases: Boolean) = true + override fun hasHardcodedContracts(element: PsiElement): Boolean = false + override fun getNullables() = emptyList() + override fun setNullables(vararg p0: String) = Unit + override fun getNotNulls() = emptyList() + override fun setNotNulls(vararg p0: String) = Unit + override fun getDefaultNullable() = "" + override fun setDefaultNullable(defaultNullable: String) = Unit + override fun getDefaultNotNull() = "" + override fun setDefaultNotNull(p0: String) = Unit + override fun setInstrumentedNotNulls(p0: List) = Unit + override fun getInstrumentedNotNulls() = emptyList() + }) + + applicationEnvironment.application.registerService(JavaClassSupers::class.java, JavaClassSupersImpl::class.java) + + for (root in PathUtil.getJdkClassesRootsFromCurrentJre()) { + javaCoreEnvironment.addJarToClassPath(root) + } + val annotations: File? = findAnnotations() + if (annotations != null && annotations.exists()) { + javaCoreEnvironment.addJarToClassPath(annotations) + } + return javaCoreEnvironment + } + + private fun registerExtensionPoints(area: ExtensionsArea) { + CoreApplicationEnvironment.registerExtensionPoint(area, FileContextProvider.EP_NAME, FileContextProvider::class.java) + + CoreApplicationEnvironment.registerExtensionPoint(area, MetaDataContributor.EP_NAME, MetaDataContributor::class.java) + CoreApplicationEnvironment.registerExtensionPoint(area, PsiAugmentProvider.EP_NAME, PsiAugmentProvider::class.java) + CoreApplicationEnvironment.registerExtensionPoint(area, JavaMainMethodProvider.EP_NAME, JavaMainMethodProvider::class.java) + + CoreApplicationEnvironment.registerExtensionPoint(area, ContainerProvider.EP_NAME, ContainerProvider::class.java) + CoreApplicationEnvironment.registerExtensionPoint(area, ClassFileDecompilers.EP_NAME, ClassFileDecompilers.Decompiler::class.java) + + CoreApplicationEnvironment.registerExtensionPoint(area, TypeAnnotationModifier.EP_NAME, TypeAnnotationModifier::class.java) + CoreApplicationEnvironment.registerExtensionPoint(area, MetaLanguage.EP_NAME, MetaLanguage::class.java) + CoreApplicationEnvironment.registerExtensionPoint(area, JavaModuleSystem.EP_NAME, JavaModuleSystem::class.java) + } + + fun findAnnotations(): File? { + var classLoader = JavaToKotlinTranslator::class.java.classLoader + while (classLoader != null) { + val loader = classLoader + if (loader is URLClassLoader) { + for (url in loader.urLs) { + if ("file" == url.protocol && url.file!!.endsWith("/annotations.jar")) { + return File(url.file!!) + } + } + } + classLoader = classLoader.parent + } + return null + } +} From 46fcc7d59df0fcafe4eb9339c23f33694ec61fe6 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Tue, 17 Nov 2020 17:59:57 +0300 Subject: [PATCH 291/698] Build: fix registration of `ClassFileDecompilers` extension --- .../resources/META-INF/extensions/core.xml | 10 ++++++++++ .../KotlinCoreApplicationEnvironment.java | 3 +-- .../cli/jvm/compiler/KotlinCoreEnvironment.kt | 3 ++- .../kotlin/test/JUnit3RunnerWithInnersForJPS.java | 15 ++++++++++----- 4 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 compiler/cli/cli-common/resources/META-INF/extensions/core.xml diff --git a/compiler/cli/cli-common/resources/META-INF/extensions/core.xml b/compiler/cli/cli-common/resources/META-INF/extensions/core.xml new file mode 100644 index 00000000000..da66522edb3 --- /dev/null +++ b/compiler/cli/cli-common/resources/META-INF/extensions/core.xml @@ -0,0 +1,10 @@ + + org.jetbrains.kotlin + 1.2 + + + + + diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreApplicationEnvironment.java b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreApplicationEnvironment.java index 26562e4a6be..447e2acd62e 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreApplicationEnvironment.java +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreApplicationEnvironment.java @@ -40,7 +40,6 @@ public class KotlinCoreApplicationEnvironment extends JavaCoreApplicationEnviron registerApplicationExtensionPoint(JavaMainMethodProvider.EP_NAME, JavaMainMethodProvider.class); registerApplicationExtensionPoint(ContainerProvider.EP_NAME, ContainerProvider.class); - registerApplicationExtensionPoint(ClassFileDecompilers.EP_NAME, ClassFileDecompilers.Decompiler.class); registerApplicationExtensionPoint(MetaLanguage.EP_NAME, MetaLanguage.class); @@ -52,4 +51,4 @@ public class KotlinCoreApplicationEnvironment extends JavaCoreApplicationEnviron protected VirtualFileSystem createJrtFileSystem() { return new CoreJrtFileSystem(); } -} \ No newline at end of file +} diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt index c9c2c34e730..5c1cda1d7cc 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt @@ -509,6 +509,7 @@ class KotlinCoreEnvironment private constructor( val applicationEnvironment = KotlinCoreApplicationEnvironment.create(parentDisposable, unitTestMode) registerApplicationExtensionPointsAndExtensionsFrom(configuration, "extensions/compiler.xml") + registerApplicationExtensionPointsAndExtensionsFrom(configuration, "extensions/core.xml") registerApplicationServicesForCLI(applicationEnvironment) registerApplicationServices(applicationEnvironment) @@ -692,4 +693,4 @@ class KotlinCoreEnvironment private constructor( } } } -} \ No newline at end of file +} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/JUnit3RunnerWithInnersForJPS.java b/compiler/tests-common/tests/org/jetbrains/kotlin/test/JUnit3RunnerWithInnersForJPS.java index 99db44b9178..af956918e57 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/JUnit3RunnerWithInnersForJPS.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/JUnit3RunnerWithInnersForJPS.java @@ -50,7 +50,7 @@ public class JUnit3RunnerWithInnersForJPS extends Runner implements Filterable, public JUnit3RunnerWithInnersForJPS(Class klass) { this.klass = klass; requestedRunners.add(klass); - ensureCompilerXmlExists(); + ensureCompilerExtensionFilesExists(); } @Override @@ -86,14 +86,19 @@ public class JUnit3RunnerWithInnersForJPS extends Runner implements Filterable, * compiler.xml needs to be in both compiler & ide module for tests execution. * To avoid file duplication copy it to the out dir idea module before test execution. */ - private static void ensureCompilerXmlExists() { - String compilerXmlSourcePath = "compiler/cli/cli-common/resources/META-INF/extensions/compiler.xml"; + private static void ensureCompilerExtensionFilesExists() { + copyCompilerResourceFile("compiler.xml"); + copyCompilerResourceFile("core.xml"); + } + + private static void copyCompilerResourceFile(String fileName) { + String compilerXmlSourcePath = "compiler/cli/cli-common/resources/META-INF/extensions/" + fileName; String jpsTargetDirectory = "out/production/kotlin.idea.main"; String pillTargetDirectory = "out/production/idea.main"; String baseDir = Files.exists(Paths.get(jpsTargetDirectory)) ? jpsTargetDirectory : pillTargetDirectory; - String compilerXmlTargetPath = baseDir + "/META-INF/extensions/compiler.xml"; + String compilerXmlTargetPath = baseDir + "/META-INF/extensions/" + fileName; try { Path targetPath = Paths.get(compilerXmlTargetPath); @@ -176,4 +181,4 @@ public class JUnit3RunnerWithInnersForJPS extends Runner implements Filterable, return false; } -} \ No newline at end of file +} From dc35a130086c85fa0543ac8de9664d2886d070d7 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Wed, 18 Nov 2020 13:00:39 +0300 Subject: [PATCH 292/698] Build: remove useless bunch files --- .../KotlinCoreApplicationEnvironment.java.203 | 55 ------------------- ...KotlinCoreApplicationEnvironment.java.as42 | 53 ------------------ 2 files changed, 108 deletions(-) delete mode 100644 compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreApplicationEnvironment.java.203 delete mode 100644 compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreApplicationEnvironment.java.as42 diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreApplicationEnvironment.java.203 b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreApplicationEnvironment.java.203 deleted file mode 100644 index 692e0995d7a..00000000000 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreApplicationEnvironment.java.203 +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ -package org.jetbrains.kotlin.cli.jvm.compiler; - -import com.intellij.DynamicBundle; -import com.intellij.codeInsight.ContainerProvider; -import com.intellij.codeInsight.runner.JavaMainMethodProvider; -import com.intellij.core.JavaCoreApplicationEnvironment; -import com.intellij.lang.MetaLanguage; -import com.intellij.openapi.Disposable; -import com.intellij.openapi.extensions.Extensions; -import com.intellij.openapi.vfs.VirtualFileSystem; -import com.intellij.psi.FileContextProvider; -import com.intellij.psi.augment.PsiAugmentProvider; -import com.intellij.psi.compiled.ClassFileDecompilers; -import com.intellij.psi.meta.MetaDataContributor; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.cli.jvm.modules.CoreJrtFileSystem; - -public class KotlinCoreApplicationEnvironment extends JavaCoreApplicationEnvironment { - public static KotlinCoreApplicationEnvironment create(@NotNull Disposable parentDisposable, boolean unitTestMode) { - KotlinCoreApplicationEnvironment environment = new KotlinCoreApplicationEnvironment(parentDisposable, unitTestMode); - registerExtensionPoints(); - return environment; - } - - private KotlinCoreApplicationEnvironment(@NotNull Disposable parentDisposable, boolean unitTestMode) { - super(parentDisposable, unitTestMode); - } - - private static void registerExtensionPoints() { - registerApplicationExtensionPoint(DynamicBundle.LanguageBundleEP.EP_NAME, DynamicBundle.LanguageBundleEP.class); - registerApplicationExtensionPoint(FileContextProvider.EP_NAME, FileContextProvider.class); - - registerApplicationExtensionPoint(MetaDataContributor.EP_NAME, MetaDataContributor.class); - registerApplicationExtensionPoint(PsiAugmentProvider.EP_NAME, PsiAugmentProvider.class); - registerApplicationExtensionPoint(JavaMainMethodProvider.EP_NAME, JavaMainMethodProvider.class); - - registerApplicationExtensionPoint(ContainerProvider.EP_NAME, ContainerProvider.class); - registerApplicationExtensionPoint(ClassFileDecompilers.getInstance().EP_NAME, ClassFileDecompilers.Decompiler.class); - - registerApplicationExtensionPoint(MetaLanguage.EP_NAME, MetaLanguage.class); - - IdeaExtensionPoints.INSTANCE.registerVersionSpecificAppExtensionPoints(Extensions.getRootArea()); - } - - @Nullable - @Override - protected VirtualFileSystem createJrtFileSystem() { - return new CoreJrtFileSystem(); - } -} \ No newline at end of file diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreApplicationEnvironment.java.as42 b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreApplicationEnvironment.java.as42 deleted file mode 100644 index a6174901ed9..00000000000 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreApplicationEnvironment.java.as42 +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ -package org.jetbrains.kotlin.cli.jvm.compiler; - -import com.intellij.DynamicBundle; -import com.intellij.codeInsight.ContainerProvider; -import com.intellij.codeInsight.runner.JavaMainMethodProvider; -import com.intellij.core.JavaCoreApplicationEnvironment; -import com.intellij.lang.MetaLanguage; -import com.intellij.openapi.Disposable; -import com.intellij.openapi.extensions.Extensions; -import com.intellij.openapi.vfs.VirtualFileSystem; -import com.intellij.psi.FileContextProvider; -import com.intellij.psi.augment.PsiAugmentProvider; -import com.intellij.psi.meta.MetaDataContributor; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.cli.jvm.modules.CoreJrtFileSystem; - -public class KotlinCoreApplicationEnvironment extends JavaCoreApplicationEnvironment { - public static KotlinCoreApplicationEnvironment create(@NotNull Disposable parentDisposable, boolean unitTestMode) { - KotlinCoreApplicationEnvironment environment = new KotlinCoreApplicationEnvironment(parentDisposable, unitTestMode); - registerExtensionPoints(); - return environment; - } - - private KotlinCoreApplicationEnvironment(@NotNull Disposable parentDisposable, boolean unitTestMode) { - super(parentDisposable, unitTestMode); - } - - private static void registerExtensionPoints() { - registerApplicationExtensionPoint(DynamicBundle.LanguageBundleEP.EP_NAME, DynamicBundle.LanguageBundleEP.class); - registerApplicationExtensionPoint(FileContextProvider.EP_NAME, FileContextProvider.class); - - registerApplicationExtensionPoint(MetaDataContributor.EP_NAME, MetaDataContributor.class); - registerApplicationExtensionPoint(PsiAugmentProvider.EP_NAME, PsiAugmentProvider.class); - registerApplicationExtensionPoint(JavaMainMethodProvider.EP_NAME, JavaMainMethodProvider.class); - - registerApplicationExtensionPoint(ContainerProvider.EP_NAME, ContainerProvider.class); - - registerApplicationExtensionPoint(MetaLanguage.EP_NAME, MetaLanguage.class); - - IdeaExtensionPoints.INSTANCE.registerVersionSpecificAppExtensionPoints(Extensions.getRootArea()); - } - - @Nullable - @Override - protected VirtualFileSystem createJrtFileSystem() { - return new CoreJrtFileSystem(); - } -} \ No newline at end of file From 68719831ee1d5d6953bc6079916884d854620331 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Wed, 18 Nov 2020 14:01:18 +0300 Subject: [PATCH 293/698] Build: update asm version in kotlinp --- libraries/tools/kotlinp/build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/tools/kotlinp/build.gradle.kts b/libraries/tools/kotlinp/build.gradle.kts index 6cf0f54bf85..96a77bc4918 100644 --- a/libraries/tools/kotlinp/build.gradle.kts +++ b/libraries/tools/kotlinp/build.gradle.kts @@ -7,7 +7,7 @@ plugins { kotlin("jvm") } -val kotlinpAsmVersion = "7.0.1" +val kotlinpAsmVersion = "8.0.1" val shadows by configurations.creating @@ -70,4 +70,4 @@ tasks.withType { kotlinOptions { freeCompilerArgs += listOf("-Xopt-in=kotlin.RequiresOptIn") } -} \ No newline at end of file +} From d3ef0eb5193246e15b466eaaf4cf73fcda9a644a Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Wed, 18 Nov 2020 15:32:00 +0300 Subject: [PATCH 294/698] Build: register missing TreeAspect service in KtParsingTestCase --- .../jetbrains/kotlin/test/testFramework/KtParsingTestCase.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtParsingTestCase.java b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtParsingTestCase.java index 912863a2f55..de45cf23f77 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtParsingTestCase.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtParsingTestCase.java @@ -126,6 +126,7 @@ public abstract class KtParsingTestCase extends KtPlatformLiteFixture { myProject.registerService(CachedValuesManager.class, new CachedValuesManagerImpl(myProject, new PsiCachedValuesFactory(myPsiManager))); myProject.registerService(PsiManager.class, myPsiManager); + myProject.registerService(TreeAspect.class, new TreeAspect()); this.registerExtensionPoint(FileTypeFactory.FILE_TYPE_FACTORY_EP, FileTypeFactory.class); registerExtensionPoint(MetaLanguage.EP_NAME, MetaLanguage.class); @@ -342,4 +343,4 @@ public abstract class KtParsingTestCase extends KtPlatformLiteFixture { TestCase.assertEquals(psiToStringDefault, DebugUtil.psiToString(file, false, false)); } -} \ No newline at end of file +} From 5ab9710cc5aba0f23f7e0499745f611c757397f3 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Wed, 18 Nov 2020 17:20:43 +0300 Subject: [PATCH 295/698] Remove `./local` directory from CodeConformanceTest --- compiler/tests/org/jetbrains/kotlin/code/CodeConformanceTest.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/tests/org/jetbrains/kotlin/code/CodeConformanceTest.kt b/compiler/tests/org/jetbrains/kotlin/code/CodeConformanceTest.kt index 6a51e1418e7..bc0e9fec769 100644 --- a/compiler/tests/org/jetbrains/kotlin/code/CodeConformanceTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/code/CodeConformanceTest.kt @@ -38,6 +38,7 @@ class CodeConformanceTest : TestCase() { "js/js.tests/.gradle", "js/js.translator/qunit/qunit.js", "js/js.translator/testData/node_modules", + "local", "libraries/kotlin.test/js/it/.gradle", "libraries/kotlin.test/js/it/node_modules", "libraries/reflect/api/src/java9/java/kotlin/reflect/jvm/internal/impl", From 7396abf5a4b94c62b295ccd3aad220e9ecb413eb Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Wed, 18 Nov 2020 17:28:21 +0300 Subject: [PATCH 296/698] Build: add fastutil dependency to scripting tests --- libraries/scripting/js-test/build.gradle.kts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libraries/scripting/js-test/build.gradle.kts b/libraries/scripting/js-test/build.gradle.kts index 976ef030509..39a0d966966 100644 --- a/libraries/scripting/js-test/build.gradle.kts +++ b/libraries/scripting/js-test/build.gradle.kts @@ -23,6 +23,12 @@ dependencies { includeJars("idea", "idea_rt", "log4j", "guava", "jdom", rootProject = rootProject) } testRuntimeOnly(commonDep("org.jetbrains.intellij.deps", "trove4j")) + Platform[202] { + testRuntimeOnly(intellijDep()) { includeJars("intellij-deps-fastutil-8.3.1-1") } + } + Platform[203].orHigher { + testRuntimeOnly(intellijDep()) { includeJars("intellij-deps-fastutil-8.3.1-3") } + } } sourceSets { From 1b559fe676103331ec00ad1a482f276ce6d60e03 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Thu, 19 Nov 2020 17:50:56 +0300 Subject: [PATCH 297/698] Don't set KOTLIN_BUNDLED in unit tests --- idea/src/org/jetbrains/kotlin/idea/KotlinPluginMacros.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/KotlinPluginMacros.kt b/idea/src/org/jetbrains/kotlin/idea/KotlinPluginMacros.kt index 189bbfc873e..c52fd71b3ce 100644 --- a/idea/src/org/jetbrains/kotlin/idea/KotlinPluginMacros.kt +++ b/idea/src/org/jetbrains/kotlin/idea/KotlinPluginMacros.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.idea import com.intellij.openapi.application.PathMacroContributor +import org.jetbrains.kotlin.idea.util.application.isUnitTestMode import org.jetbrains.kotlin.utils.PathUtil /** @@ -15,11 +16,13 @@ import org.jetbrains.kotlin.utils.PathUtil */ class KotlinPluginMacros : PathMacroContributor { override fun registerPathMacros(macros: MutableMap, legacyMacros: MutableMap) { - macros[KOTLIN_BUNDLED_PATH_VARIABLE] = PathUtil.kotlinPathsForIdeaPlugin.homePath.path + if (!isUnitTestMode()) { + macros[KOTLIN_BUNDLED_PATH_VARIABLE] = PathUtil.kotlinPathsForIdeaPlugin.homePath.path + } } companion object { const val KOTLIN_BUNDLED_PATH_VARIABLE = "KOTLIN_BUNDLED" } -} \ No newline at end of file +} From 986ab9cb54834dba400e7de9530a6a6517f5279b Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Fri, 20 Nov 2020 11:16:20 +0300 Subject: [PATCH 298/698] Build: remove useless .as40 files --- .../tests/AndroidJpsBuildTestCase.java.as40 | 0 .../android/tests/AndroidRunner.java.as40 | 0 .../generators/tests/GenerateTests.kt.as40 | 1300 ----------------- gradle/versions.properties.as40 | 22 - .../modules/ModuleHighlightUtil2.java.as40 | 114 -- .../confidence/KotlinConfidenceTest.java.as40 | 184 --- .../idea/statistics/KotlinFUSLogger.kt.as40 | 18 - .../ProjectConfigurationCollector.kt.as40 | 3 - .../kotlin/idea/util/ApplicationUtils.kt.as40 | 75 - ...lMultiplatformProjectImportingTest.kt.as40 | 0 .../MultiplatformProjectImportingTest.kt.as40 | 0 ...ltiplatformTestCompatibilityMatrix.kt.as40 | 8 - ...wMultiplatformProjectImportingTest.kt.as40 | 0 .../gradle/PackagePrefixImportingTest.kt.as40 | 0 .../gradle/AbstractModelBuilderTest.java.as40 | 251 ---- ...leConfiguratorPlatformSpecificTest.kt.as40 | 0 .../gradle/GradleFacetImportTest.kt.as40 | 0 ...eInspectionTestCompatibilityMatrix.kt.as40 | 8 - .../service/MavenProjectImporter.kt.as40 | 15 - .../KotlinPsiChainBuilderTestCase.kt.as40 | 73 - .../META-INF/plugin.xml.as40 | 173 --- idea/resources/META-INF/android-lint.xml.as40 | 5 - .../idea/IDESettingsFUSCollector.kt.as40 | 3 - .../MLCompletionForKotlin.kt.as40 | 16 - .../KotlinFormatterUsageCollector.kt.as40 | 136 -- .../highlighter/markers/dslStyleIcon.kt.as40 | 15 - .../idea/reporter/ITNReporterCompat.kt.as40 | 33 - .../kotlin/idea/testResourceBundle.kt.as40 | 38 - .../update/GooglePluginUpdateVerifier.kt.as40 | 157 -- .../kotlin/idea/update/verify.kt.as40 | 35 - .../src/test/kotlin/MyKotlinTest.kt.as40 | 7 - .../src/test/kotlin/MyKotlinTest.kt.as40 | 11 - .../refactoring/InplaceRenameTest.kt.as40 | 258 ---- .../kotlin/jps/build/ideaPlatform.kt.as40 | 13 - .../AllOpenMavenProjectImportHandler.kt.as40 | 0 .../src/AbstractMavenImportHandler.kt.as40 | 0 ...linSerializationMavenImportHandler.kt.as40 | 0 .../NoArgMavenProjectImportHandler.kt.as40 | 0 ...hReceiverMavenProjectImportHandler.kt.as40 | 0 tests/mute-platform.csv.as40 | 81 - 40 files changed, 3052 deletions(-) delete mode 100644 compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidJpsBuildTestCase.java.as40 delete mode 100644 compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidRunner.java.as40 delete mode 100644 generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as40 delete mode 100644 gradle/versions.properties.as40 delete mode 100644 idea/idea-analysis/src/org/jetbrains/kotlin/idea/modules/ModuleHighlightUtil2.java.as40 delete mode 100644 idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/confidence/KotlinConfidenceTest.java.as40 delete mode 100644 idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/KotlinFUSLogger.kt.as40 delete mode 100644 idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/ProjectConfigurationCollector.kt.as40 delete mode 100644 idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/util/ApplicationUtils.kt.as40 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/HierarchicalMultiplatformProjectImportingTest.kt.as40 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformProjectImportingTest.kt.as40 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformTestCompatibilityMatrix.kt.as40 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt.as40 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/PackagePrefixImportingTest.kt.as40 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/AbstractModelBuilderTest.java.as40 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleConfiguratorPlatformSpecificTest.kt.as40 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt.as40 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleInspectionTestCompatibilityMatrix.kt.as40 delete mode 100644 idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/service/MavenProjectImporter.kt.as40 delete mode 100644 idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/sequence/KotlinPsiChainBuilderTestCase.kt.as40 delete mode 100644 idea/resources-descriptors/META-INF/plugin.xml.as40 delete mode 100644 idea/resources/META-INF/android-lint.xml.as40 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/IDESettingsFUSCollector.kt.as40 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/configuration/MLCompletionForKotlin.kt.as40 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/formatter/KotlinFormatterUsageCollector.kt.as40 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt.as40 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/reporter/ITNReporterCompat.kt.as40 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt.as40 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/update/GooglePluginUpdateVerifier.kt.as40 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/update/verify.kt.as40 delete mode 100755 idea/testData/gradle/testRunConfigurations/kotlinJUnitSettings/src/test/kotlin/MyKotlinTest.kt.as40 delete mode 100755 idea/testData/gradle/testRunConfigurations/preferredConfigurations/src/test/kotlin/MyKotlinTest.kt.as40 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/refactoring/InplaceRenameTest.kt.as40 delete mode 100644 jps-plugin/src/org/jetbrains/kotlin/jps/build/ideaPlatform.kt.as40 delete mode 100644 plugins/allopen/allopen-ide/src/AllOpenMavenProjectImportHandler.kt.as40 delete mode 100644 plugins/annotation-based-compiler-plugins-ide-support/src/AbstractMavenImportHandler.kt.as40 delete mode 100644 plugins/kotlin-serialization/kotlin-serialization-ide/src/org/jetbrains/kotlinx/serialization/idea/KotlinSerializationMavenImportHandler.kt.as40 delete mode 100644 plugins/noarg/noarg-ide/src/NoArgMavenProjectImportHandler.kt.as40 delete mode 100644 plugins/sam-with-receiver/sam-with-receiver-ide/src/SamWithReceiverMavenProjectImportHandler.kt.as40 delete mode 100644 tests/mute-platform.csv.as40 diff --git a/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidJpsBuildTestCase.java.as40 b/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidJpsBuildTestCase.java.as40 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidRunner.java.as40 b/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidRunner.java.as40 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as40 b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as40 deleted file mode 100644 index 94e55acbead..00000000000 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as40 +++ /dev/null @@ -1,1300 +0,0 @@ -/* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.generators.tests - -import org.jetbrains.kotlin.AbstractDataFlowValueRenderingTest -import org.jetbrains.kotlin.addImport.AbstractAddImportTest -import org.jetbrains.kotlin.allopen.AbstractBytecodeListingTestForAllOpen -import org.jetbrains.kotlin.android.parcel.AbstractParcelBytecodeListingTest -import org.jetbrains.kotlin.android.synthetic.test.AbstractAndroidBoxTest -import org.jetbrains.kotlin.android.synthetic.test.AbstractAndroidBytecodeShapeTest -import org.jetbrains.kotlin.android.synthetic.test.AbstractAndroidSyntheticPropertyDescriptorTest -import org.jetbrains.kotlin.checkers.* -import org.jetbrains.kotlin.copyright.AbstractUpdateKotlinCopyrightTest -import org.jetbrains.kotlin.findUsages.AbstractFindUsagesTest -import org.jetbrains.kotlin.findUsages.AbstractKotlinFindUsagesWithLibraryTest -import org.jetbrains.kotlin.formatter.AbstractFormatterTest -import org.jetbrains.kotlin.formatter.AbstractTypingIndentationTestBase -import org.jetbrains.kotlin.generators.tests.generator.TestGroup -import org.jetbrains.kotlin.generators.tests.generator.muteExtraSuffix -import org.jetbrains.kotlin.generators.tests.generator.testGroupSuite -import org.jetbrains.kotlin.generators.util.KT_OR_KTS -import org.jetbrains.kotlin.generators.util.KT_OR_KTS_WITHOUT_DOTS_IN_NAME -import org.jetbrains.kotlin.generators.util.KT_WITHOUT_DOTS_IN_NAME -import org.jetbrains.kotlin.idea.AbstractExpressionSelectionTest -import org.jetbrains.kotlin.idea.index.AbstractKotlinTypeAliasByExpansionShortNameIndexTest -import org.jetbrains.kotlin.idea.AbstractSmartSelectionTest -import org.jetbrains.kotlin.idea.actions.AbstractGotoTestOrCodeActionTest -import org.jetbrains.kotlin.idea.caches.resolve.* -import org.jetbrains.kotlin.idea.codeInsight.* -import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractCodeInsightActionTest -import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateHashCodeAndEqualsActionTest -import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateTestSupportMethodActionTest -import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateToStringActionTest -import org.jetbrains.kotlin.idea.codeInsight.moveUpDown.AbstractMoveLeftRightTest -import org.jetbrains.kotlin.idea.codeInsight.moveUpDown.AbstractMoveStatementTest -import org.jetbrains.kotlin.idea.codeInsight.postfix.AbstractPostfixTemplateProviderTest -import org.jetbrains.kotlin.idea.codeInsight.surroundWith.AbstractSurroundWithTest -import org.jetbrains.kotlin.idea.codeInsight.unwrap.AbstractUnwrapRemoveTest -import org.jetbrains.kotlin.idea.completion.test.* -import org.jetbrains.kotlin.idea.completion.test.handlers.AbstractBasicCompletionHandlerTest -import org.jetbrains.kotlin.idea.completion.test.handlers.AbstractCompletionCharFilterTest -import org.jetbrains.kotlin.idea.completion.test.handlers.AbstractKeywordCompletionHandlerTest -import org.jetbrains.kotlin.idea.completion.test.handlers.AbstractSmartCompletionHandlerTest -import org.jetbrains.kotlin.idea.completion.test.weighers.AbstractBasicCompletionWeigherTest -import org.jetbrains.kotlin.idea.completion.test.weighers.AbstractSmartCompletionWeigherTest -import org.jetbrains.kotlin.idea.configuration.AbstractGradleConfigureProjectByChangingFileTest -import org.jetbrains.kotlin.idea.conversion.copy.AbstractJavaToKotlinCopyPasteConversionTest -import org.jetbrains.kotlin.idea.conversion.copy.AbstractLiteralKotlinToKotlinCopyPasteTest -import org.jetbrains.kotlin.idea.conversion.copy.AbstractLiteralTextToKotlinCopyPasteTest -import org.jetbrains.kotlin.idea.conversion.copy.AbstractTextJavaToKotlinCopyPasteConversionTest -import org.jetbrains.kotlin.idea.coverage.AbstractKotlinCoverageOutputFilesTest -import org.jetbrains.kotlin.idea.debugger.evaluate.* -import org.jetbrains.kotlin.idea.debugger.test.sequence.exec.AbstractSequenceTraceTestCase -import org.jetbrains.kotlin.idea.debugger.test.* -import org.jetbrains.kotlin.idea.debugger.test.AbstractFileRankingTest -import org.jetbrains.kotlin.idea.decompiler.navigation.AbstractNavigateToDecompiledLibraryTest -import org.jetbrains.kotlin.idea.decompiler.navigation.AbstractNavigateToLibrarySourceTest -import org.jetbrains.kotlin.idea.decompiler.navigation.AbstractNavigateToLibrarySourceTestWithJS -import org.jetbrains.kotlin.idea.decompiler.navigation.AbstractNavigateJavaToLibrarySourceTest -import org.jetbrains.kotlin.idea.decompiler.stubBuilder.AbstractClsStubBuilderTest -import org.jetbrains.kotlin.idea.decompiler.stubBuilder.AbstractLoadJavaClsStubTest -import org.jetbrains.kotlin.idea.decompiler.textBuilder.AbstractCommonDecompiledTextFromJsMetadataTest -import org.jetbrains.kotlin.idea.decompiler.textBuilder.AbstractCommonDecompiledTextTest -import org.jetbrains.kotlin.idea.decompiler.textBuilder.AbstractJsDecompiledTextFromJsMetadataTest -import org.jetbrains.kotlin.idea.decompiler.textBuilder.AbstractJvmDecompiledTextTest -import org.jetbrains.kotlin.idea.editor.AbstractMultiLineStringIndentTest -import org.jetbrains.kotlin.idea.editor.backspaceHandler.AbstractBackspaceHandlerTest -import org.jetbrains.kotlin.idea.editor.quickDoc.AbstractQuickDocProviderTest -import org.jetbrains.kotlin.idea.filters.AbstractKotlinExceptionFilterTest -import org.jetbrains.kotlin.idea.folding.AbstractKotlinFoldingTest -import org.jetbrains.kotlin.idea.hierarchy.AbstractHierarchyTest -import org.jetbrains.kotlin.idea.hierarchy.AbstractHierarchyWithLibTest -import org.jetbrains.kotlin.idea.highlighter.* -import org.jetbrains.kotlin.idea.imports.AbstractJsOptimizeImportsTest -import org.jetbrains.kotlin.idea.imports.AbstractJvmOptimizeImportsTest -import org.jetbrains.kotlin.idea.inspections.AbstractLocalInspectionTest -import org.jetbrains.kotlin.idea.inspections.AbstractMultiFileLocalInspectionTest -import org.jetbrains.kotlin.idea.intentions.AbstractConcatenatedStringGeneratorTest -import org.jetbrains.kotlin.idea.intentions.AbstractIntentionTest -import org.jetbrains.kotlin.idea.intentions.AbstractIntentionTest2 -import org.jetbrains.kotlin.idea.intentions.AbstractMultiFileIntentionTest -import org.jetbrains.kotlin.idea.intentions.declarations.AbstractJoinLinesTest -import org.jetbrains.kotlin.idea.internal.AbstractBytecodeToolWindowTest -import org.jetbrains.kotlin.idea.kdoc.AbstractKDocHighlightingTest -import org.jetbrains.kotlin.idea.kdoc.AbstractKDocTypingTest -import org.jetbrains.kotlin.idea.navigation.* -import org.jetbrains.kotlin.idea.parameterInfo.AbstractParameterInfoTest -import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixMultiFileTest -import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixMultiModuleTest -import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest -import org.jetbrains.kotlin.idea.refactoring.AbstractNameSuggestionProviderTest -import org.jetbrains.kotlin.idea.refactoring.copy.AbstractCopyTest -import org.jetbrains.kotlin.idea.refactoring.copy.AbstractMultiModuleCopyTest -import org.jetbrains.kotlin.idea.refactoring.inline.AbstractInlineTest -import org.jetbrains.kotlin.idea.refactoring.introduce.AbstractExtractionTest -import org.jetbrains.kotlin.idea.refactoring.move.AbstractMoveTest -import org.jetbrains.kotlin.idea.refactoring.move.AbstractMultiModuleMoveTest -import org.jetbrains.kotlin.idea.refactoring.pullUp.AbstractPullUpTest -import org.jetbrains.kotlin.idea.refactoring.pushDown.AbstractPushDownTest -import org.jetbrains.kotlin.idea.refactoring.rename.AbstractMultiModuleRenameTest -import org.jetbrains.kotlin.idea.refactoring.rename.AbstractRenameTest -import org.jetbrains.kotlin.idea.refactoring.safeDelete.AbstractMultiModuleSafeDeleteTest -import org.jetbrains.kotlin.idea.refactoring.safeDelete.AbstractSafeDeleteTest -import org.jetbrains.kotlin.idea.repl.AbstractIdeReplCompletionTest -import org.jetbrains.kotlin.idea.resolve.* -import org.jetbrains.kotlin.idea.scratch.AbstractScratchLineMarkersTest -import org.jetbrains.kotlin.idea.scratch.AbstractScratchRunActionTest -import org.jetbrains.kotlin.idea.script.* -import org.jetbrains.kotlin.idea.slicer.AbstractSlicerLeafGroupingTest -import org.jetbrains.kotlin.idea.slicer.AbstractSlicerNullnessGroupingTest -import org.jetbrains.kotlin.idea.slicer.AbstractSlicerTreeTest -import org.jetbrains.kotlin.idea.slicer.AbstractSlicerMultiplatformTest -import org.jetbrains.kotlin.idea.structureView.AbstractKotlinFileStructureTest -import org.jetbrains.kotlin.idea.stubs.AbstractMultiFileHighlightingTest -import org.jetbrains.kotlin.idea.stubs.AbstractResolveByStubTest -import org.jetbrains.kotlin.idea.stubs.AbstractStubBuilderTest -import org.jetbrains.kotlin.incremental.* -import org.jetbrains.kotlin.j2k.AbstractJavaToKotlinConverterForWebDemoTest -import org.jetbrains.kotlin.j2k.AbstractJavaToKotlinConverterMultiFileTest -import org.jetbrains.kotlin.j2k.AbstractJavaToKotlinConverterSingleFileTest -//import org.jetbrains.kotlin.jps.build.* -//import org.jetbrains.kotlin.jps.incremental.AbstractJsProtoComparisonTest -//import org.jetbrains.kotlin.jps.incremental.AbstractJvmProtoComparisonTest -import org.jetbrains.kotlin.kapt.cli.test.AbstractArgumentParsingTest -import org.jetbrains.kotlin.kapt.cli.test.AbstractKaptToolIntegrationTest -import org.jetbrains.kotlin.kapt3.test.AbstractClassFileToSourceStubConverterTest -import org.jetbrains.kotlin.kapt3.test.AbstractKotlinKaptContextTest -import org.jetbrains.kotlin.nj2k.AbstractNewJavaToKotlinConverterMultiFileTest -import org.jetbrains.kotlin.nj2k.AbstractNewJavaToKotlinConverterSingleFileTest -import org.jetbrains.kotlin.nj2k.AbstractNewJavaToKotlinCopyPasteConversionTest -import org.jetbrains.kotlin.nj2k.AbstractTextNewJavaToKotlinCopyPasteConversionTest -import org.jetbrains.kotlin.nj2k.inference.common.AbstractCommonConstraintCollectorTest -import org.jetbrains.kotlin.nj2k.inference.mutability.AbstractMutabilityInferenceTest -import org.jetbrains.kotlin.nj2k.inference.nullability.AbstractNullabilityInferenceTest -import org.jetbrains.kotlin.noarg.AbstractBlackBoxCodegenTestForNoArg -import org.jetbrains.kotlin.noarg.AbstractBytecodeListingTestForNoArg -import org.jetbrains.kotlin.parcelize.test.AbstractParcelizeBoxTest -import org.jetbrains.kotlin.parcelize.test.AbstractParcelizeBytecodeListingTest -import org.jetbrains.kotlin.parcelize.test.AbstractParcelizeIrBoxTest -import org.jetbrains.kotlin.parcelize.test.AbstractParcelizeIrBytecodeListingTest -import org.jetbrains.kotlin.pacelize.ide.test.AbstractParcelizeCheckerTest -import org.jetbrains.kotlin.pacelize.ide.test.AbstractParcelizeQuickFixTest -import org.jetbrains.kotlin.psi.patternMatching.AbstractPsiUnifierTest -import org.jetbrains.kotlin.samWithReceiver.AbstractSamWithReceiverScriptTest -import org.jetbrains.kotlin.samWithReceiver.AbstractSamWithReceiverTest -import org.jetbrains.kotlin.search.AbstractAnnotatedMembersSearchTest -import org.jetbrains.kotlin.search.AbstractInheritorsSearchTest -import org.jetbrains.kotlin.shortenRefs.AbstractShortenRefsTest -import org.jetbrains.kotlin.test.TargetBackend -import org.jetbrains.kotlinx.serialization.AbstractSerializationPluginBytecodeListingTest -import org.jetbrains.kotlinx.serialization.AbstractSerializationPluginDiagnosticTest -import org.jetbrains.kotlinx.serialization.AbstractSerializationIrBytecodeListingTest - -fun main(args: Array) { - System.setProperty("java.awt.headless", "true") - - testGroupSuite(args) { - testGroup("idea/jvm-debugger/jvm-debugger-test/test", "idea/jvm-debugger/jvm-debugger-test/testData") { - testClass { - model( - "stepping/stepIntoAndSmartStepInto", - pattern = KT_WITHOUT_DOTS_IN_NAME, - testMethod = "doStepIntoTest", - testClassName = "StepInto" - ) - model( - "stepping/stepIntoAndSmartStepInto", - pattern = KT_WITHOUT_DOTS_IN_NAME, - testMethod = "doSmartStepIntoTest", - testClassName = "SmartStepInto" - ) - model( - "stepping/stepInto", - pattern = KT_WITHOUT_DOTS_IN_NAME, - testMethod = "doStepIntoTest", - testClassName = "StepIntoOnly" - ) - model("stepping/stepOut", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doStepOutTest") - model("stepping/stepOver", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doStepOverTest") - model("stepping/filters", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doStepIntoTest") - model("stepping/custom", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doCustomTest") - } - - testClass { - model("evaluation/singleBreakpoint", testMethod = "doSingleBreakpointTest") - model("evaluation/multipleBreakpoints", testMethod = "doMultipleBreakpointsTest") - } - - testClass { - model("selectExpression", recursive = false) - model("selectExpression/disallowMethodCalls", testMethod = "doTestWoMethodCalls") - } - - testClass { - model("positionManager", recursive = false, extension = "kt", testClassName = "SingleFile") - model("positionManager", recursive = false, extension = null, testClassName = "MultiFile") - } - - testClass { - model("smartStepInto") - } - - testClass { - model("breakpointApplicability") - } - - testClass { - model("fileRanking") - } - - testClass { - model("asyncStackTrace") - } - - testClass { - // TODO: implement mapping logic for terminal operations - model("sequence/streams/sequence", excludeDirs = listOf("terminal")) - } - } - - testGroup("idea/tests", "idea/testData") { - testClass { - model("resolve/additionalLazyResolve") - } - - testClass { - model("resolve/partialBodyResolve") - } - - testClass { - model("checker", recursive = false) - model("checker/regression") - model("checker/recovery") - model("checker/rendering") - model("checker/scripts", extension = "kts") - model("checker/duplicateJvmSignature") - model("checker/infos", testMethod = "doTestWithInfos") - model("checker/diagnosticsMessage") - } - - testClass { - model("kotlinAndJavaChecker/javaAgainstKotlin") - model("kotlinAndJavaChecker/javaWithKotlin") - } - - testClass { - model("kotlinAndJavaChecker/javaAgainstKotlin") - } - - testClass { - model("unifier") - } - - testClass { - model("checker/codeFragments", extension = "kt", recursive = false) - model("checker/codeFragments/imports", testMethod = "doTestWithImport", extension = "kt") - } - - testClass { - model("quickfix.special/codeFragmentAutoImport", extension = "kt", recursive = false) - } - - testClass { - model("checker/js") - } - - testClass { - model("quickfix", pattern = "^([\\w\\-_]+)\\.kt$", filenameStartsLowerCase = true) - } - - testClass { - model("navigation/gotoSuper", extension = "test", recursive = false) - } - - testClass { - model("navigation/gotoTypeDeclaration", extension = "test") - } - - testClass { - model("navigation/gotoDeclaration", extension = "test") - } - - testClass { - model( - "parameterInfo", - pattern = "^([\\w\\-_]+)\\.kt$", recursive = true, - excludeDirs = listOf("withLib1/sharedLib", "withLib2/sharedLib", "withLib3/sharedLib") - ) - } - - testClass { - model("navigation/gotoClass", testMethod = "doClassTest") - model("navigation/gotoSymbol", testMethod = "doSymbolTest") - } - - testClass(annotations = listOf(muteExtraSuffix(".libsrc"))) { - model("decompiler/navigation/usercode") - } - - testClass(annotations = listOf(muteExtraSuffix(".libsrc"))) { - model("decompiler/navigation/userJavaCode", pattern = "^(.+)\\.java$") - } - - testClass(annotations = listOf(muteExtraSuffix(".libsrcjs"))) { - model("decompiler/navigation/usercode", testClassName ="UsercodeWithJSModule") - } - - testClass { - model("decompiler/navigation/usercode") - } - - testClass { - model("navigation/implementations", recursive = false) - } - - testClass { - model("navigation/gotoTestOrCode", pattern = "^(.+)\\.main\\..+\$") - } - - testClass { - model("search/inheritance") - } - - testClass { - model("search/annotations") - } - - testClass { - model("quickfix", pattern = """^(\w+)\.((before\.Main\.\w+)|(test))$""", testMethod = "doTestWithExtraFile") - } - - testClass { - model("typealiasExpansionIndex") - } - - testClass { - model("highlighter") - } - - testClass { - model("dslHighlighter") - } - - testClass { - model("usageHighlighter") - } - - testClass { - model("folding/noCollapse") - model("folding/checkCollapse", testMethod = "doSettingsFoldingTest") - } - - testClass { - model("codeInsight/surroundWith/if", testMethod = "doTestWithIfSurrounder") - model("codeInsight/surroundWith/ifElse", testMethod = "doTestWithIfElseSurrounder") - model("codeInsight/surroundWith/ifElseExpression", testMethod = "doTestWithIfElseExpressionSurrounder") - model("codeInsight/surroundWith/ifElseExpressionBraces", testMethod = "doTestWithIfElseExpressionBracesSurrounder") - model("codeInsight/surroundWith/not", testMethod = "doTestWithNotSurrounder") - model("codeInsight/surroundWith/parentheses", testMethod = "doTestWithParenthesesSurrounder") - model("codeInsight/surroundWith/stringTemplate", testMethod = "doTestWithStringTemplateSurrounder") - model("codeInsight/surroundWith/when", testMethod = "doTestWithWhenSurrounder") - model("codeInsight/surroundWith/tryCatch", testMethod = "doTestWithTryCatchSurrounder") - model("codeInsight/surroundWith/tryCatchExpression", testMethod = "doTestWithTryCatchExpressionSurrounder") - model("codeInsight/surroundWith/tryCatchFinally", testMethod = "doTestWithTryCatchFinallySurrounder") - model("codeInsight/surroundWith/tryCatchFinallyExpression", testMethod = "doTestWithTryCatchFinallyExpressionSurrounder") - model("codeInsight/surroundWith/tryFinally", testMethod = "doTestWithTryFinallySurrounder") - model("codeInsight/surroundWith/functionLiteral", testMethod = "doTestWithFunctionLiteralSurrounder") - model("codeInsight/surroundWith/withIfExpression", testMethod = "doTestWithSurroundWithIfExpression") - model("codeInsight/surroundWith/withIfElseExpression", testMethod = "doTestWithSurroundWithIfElseExpression") - } - - testClass { - model("joinLines") - } - - testClass { - model("codeInsight/breadcrumbs") - } - - testClass { - model("intentions", pattern = "^([\\w\\-_]+)\\.(kt|kts)$") - } - - testClass { - model("intentions/loopToCallChain", pattern = "^([\\w\\-_]+)\\.kt$") - } - - testClass { - model("concatenatedStringGenerator", pattern = "^([\\w\\-_]+)\\.kt$") - } - - testClass { - model("intentions", pattern = "^(inspections\\.test)$", singleClass = true) - model("inspections", pattern = "^(inspections\\.test)$", singleClass = true) - model("inspectionsLocal", pattern = "^(inspections\\.test)$", singleClass = true) - } - - testClass { - model("inspectionsLocal", pattern = "^([\\w\\-_]+)\\.(kt|kts)$") - } - - testClass { - model("hierarchy/class/type", extension = null, recursive = false, testMethod = "doTypeClassHierarchyTest") - model("hierarchy/class/super", extension = null, recursive = false, testMethod = "doSuperClassHierarchyTest") - model("hierarchy/class/sub", extension = null, recursive = false, testMethod = "doSubClassHierarchyTest") - model("hierarchy/calls/callers", extension = null, recursive = false, testMethod = "doCallerHierarchyTest") - model("hierarchy/calls/callersJava", extension = null, recursive = false, testMethod = "doCallerJavaHierarchyTest") - model("hierarchy/calls/callees", extension = null, recursive = false, testMethod = "doCalleeHierarchyTest") - model("hierarchy/overrides", extension = null, recursive = false, testMethod = "doOverrideHierarchyTest") - } - - testClass { - model("hierarchy/withLib", extension = null, recursive = false) - } - - testClass { - model("codeInsight/moveUpDown/classBodyDeclarations", pattern = KT_OR_KTS, testMethod = "doTestClassBodyDeclaration") - model("codeInsight/moveUpDown/closingBraces", testMethod = "doTestExpression") - model("codeInsight/moveUpDown/expressions", pattern = KT_OR_KTS, testMethod = "doTestExpression") - model("codeInsight/moveUpDown/parametersAndArguments", testMethod = "doTestExpression") - model("codeInsight/moveUpDown/trailingComma", testMethod = "doTestExpressionWithTrailingComma") - } - - testClass { - model("codeInsight/moveLeftRight") - } - - testClass { - model("refactoring/inline", pattern = "^(\\w+)\\.kt$") - } - - testClass { - model("codeInsight/unwrapAndRemove/removeExpression", testMethod = "doTestExpressionRemover") - model("codeInsight/unwrapAndRemove/unwrapThen", testMethod = "doTestThenUnwrapper") - model("codeInsight/unwrapAndRemove/unwrapElse", testMethod = "doTestElseUnwrapper") - model("codeInsight/unwrapAndRemove/removeElse", testMethod = "doTestElseRemover") - model("codeInsight/unwrapAndRemove/unwrapLoop", testMethod = "doTestLoopUnwrapper") - model("codeInsight/unwrapAndRemove/unwrapTry", testMethod = "doTestTryUnwrapper") - model("codeInsight/unwrapAndRemove/unwrapCatch", testMethod = "doTestCatchUnwrapper") - model("codeInsight/unwrapAndRemove/removeCatch", testMethod = "doTestCatchRemover") - model("codeInsight/unwrapAndRemove/unwrapFinally", testMethod = "doTestFinallyUnwrapper") - model("codeInsight/unwrapAndRemove/removeFinally", testMethod = "doTestFinallyRemover") - model("codeInsight/unwrapAndRemove/unwrapLambda", testMethod = "doTestLambdaUnwrapper") - model("codeInsight/unwrapAndRemove/unwrapFunctionParameter", testMethod = "doTestFunctionParameterUnwrapper") - } - - testClass { - model("codeInsight/expressionType") - } - - testClass { - model("editor/backspaceHandler") - } - - testClass { - model("editor/enterHandler/multilineString") - } - - testClass { - model("editor/quickDoc", pattern = """^([^_]+)\.(kt|java)$""") - } - - testClass { - model("refactoring/safeDelete/deleteClass/kotlinClass", testMethod = "doClassTest") - model("refactoring/safeDelete/deleteClass/kotlinClassWithJava", testMethod = "doClassTestWithJava") - model("refactoring/safeDelete/deleteClass/javaClassWithKotlin", extension = "java", testMethod = "doJavaClassTest") - model("refactoring/safeDelete/deleteObject/kotlinObject", testMethod = "doObjectTest") - model("refactoring/safeDelete/deleteFunction/kotlinFunction", testMethod = "doFunctionTest") - model("refactoring/safeDelete/deleteFunction/kotlinFunctionWithJava", testMethod = "doFunctionTestWithJava") - model("refactoring/safeDelete/deleteFunction/javaFunctionWithKotlin", testMethod = "doJavaMethodTest") - model("refactoring/safeDelete/deleteProperty/kotlinProperty", testMethod = "doPropertyTest") - model("refactoring/safeDelete/deleteProperty/kotlinPropertyWithJava", testMethod = "doPropertyTestWithJava") - model("refactoring/safeDelete/deleteProperty/javaPropertyWithKotlin", testMethod = "doJavaPropertyTest") - model("refactoring/safeDelete/deleteTypeAlias/kotlinTypeAlias", testMethod = "doTypeAliasTest") - model("refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameter", testMethod = "doTypeParameterTest") - model("refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameterWithJava", testMethod = "doTypeParameterTestWithJava") - model("refactoring/safeDelete/deleteValueParameter/kotlinValueParameter", testMethod = "doValueParameterTest") - model("refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava", testMethod = "doValueParameterTestWithJava") - } - - testClass { - model("resolve/references", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("resolve/referenceInJava/binaryAndSource", extension = "java") - model("resolve/referenceInJava/sourceOnly", extension = "java") - } - - testClass { - model("resolve/referenceInJava/binaryAndSource", extension = "java") - } - - testClass { - model("resolve/referenceWithLib", recursive = false) - } - - testClass { - model("resolve/referenceInLib", recursive = false) - } - - testClass { - model("resolve/referenceToJavaWithWrongFileStructure", recursive = false) - } - - testClass { - model("findUsages/kotlin", pattern = """^(.+)\.0\.(kt|kts)$""") - model("findUsages/java", pattern = """^(.+)\.0\.java$""") - model("findUsages/propertyFiles", pattern = """^(.+)\.0\.properties$""") - } - - testClass { - model("findUsages/libraryUsages", pattern = """^(.+)\.0\.kt$""") - } - - testClass { - model("refactoring/move", extension = "test", singleClass = true) - } - - testClass { - model("refactoring/copy", extension = "test", singleClass = true) - } - - testClass { - model("refactoring/moveMultiModule", extension = "test", singleClass = true) - } - - testClass { - model("refactoring/copyMultiModule", extension = "test", singleClass = true) - } - - testClass { - model("refactoring/safeDeleteMultiModule", extension = "test", singleClass = true) - } - - testClass { - model("multiFileIntentions", extension = "test", singleClass = true, filenameStartsLowerCase = true) - } - - testClass { - model("multiFileLocalInspections", extension = "test", singleClass = true, filenameStartsLowerCase = true) - } - - testClass { - model("multiFileInspections", extension = "test", singleClass = true) - } - - testClass { - model("formatter", pattern = """^([^\.]+)\.after\.kt.*$""") - model( - "formatter/trailingComma", pattern = """^([^\.]+)\.call\.after\.kt.*$""", - testMethod = "doTestCallSite", testClassName = "FormatterCallSite" - ) - model( - "formatter", pattern = """^([^\.]+)\.after\.inv\.kt.*$""", - testMethod = "doTestInverted", testClassName = "FormatterInverted" - ) - model( - "formatter/trailingComma", pattern = """^([^\.]+)\.call\.after\.inv\.kt.*$""", - testMethod = "doTestInvertedCallSite", testClassName = "FormatterInvertedCallSite" - ) - } - - testClass { - model("indentationOnNewline", pattern = """^([^\.]+)\.after\.kt.*$""", testMethod = "doNewlineTest", - testClassName = "DirectSettings") - model("indentationOnNewline", pattern = """^([^\.]+)\.after\.inv\.kt.*$""", testMethod = "doNewlineTestWithInvert", - testClassName = "InvertedSettings") - } - - testClass { - model("diagnosticMessage", recursive = false) - } - - testClass { - model("diagnosticMessage/js", recursive = false, targetBackend = TargetBackend.JS) - } - - testClass { - model("refactoring/rename", extension = "test", singleClass = true) - } - - testClass { - model("refactoring/renameMultiModule", extension = "test", singleClass = true) - } - - testClass { - model("codeInsight/outOfBlock", pattern = KT_OR_KTS) - } - - testClass { - model("dataFlowValueRendering") - } - - testClass { - model("copyPaste/conversion", pattern = """^([^\.]+)\.java$""") - } - - testClass { - model("copyPaste/plainTextConversion", pattern = """^([^\.]+)\.txt$""") - } - - testClass { - model("copyPaste/plainTextLiteral", pattern = """^([^\.]+)\.txt$""") - } - - testClass { - model("copyPaste/literal", pattern = """^([^\.]+)\.kt$""") - } - - testClass { - model("copyPaste/imports", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doTestCopy", testClassName = "Copy", recursive = false) - model("copyPaste/imports", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doTestCut", testClassName = "Cut", recursive = false) - } - - testClass { - model("copyPaste/moveDeclarations", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doTest") - } - - testClass { - model("copyright", pattern = KT_OR_KTS, testMethod = "doTest") - } - - testClass { - model("exitPoints") - } - - testClass { - model("codeInsight/lineMarker") - } - - testClass { - model("codeInsightInLibrary/lineMarker", testMethod = "doTestWithLibrary") - } - - testClass { - model("multiModuleLineMarker", extension = null, recursive = false) - } - - testClass { - model("shortenRefs", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - testClass { - model("addImport", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("smartSelection", testMethod = "doTestSmartSelection", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("structureView/fileStructure", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("expressionSelection", testMethod = "doTestExpressionSelection", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("decompiler/decompiledText", pattern = """^([^\.]+)$""") - } - - testClass { - model("decompiler/decompiledTextJvm", pattern = """^([^\.]+)$""") - } - - testClass { - model("decompiler/decompiledText", pattern = """^([^\.]+)$""", targetBackend = TargetBackend.JS) - } - - testClass { - model("decompiler/decompiledTextJs", pattern = """^([^\.]+)$""", targetBackend = TargetBackend.JS) - } - - testClass { - model("decompiler/stubBuilder", extension = null, recursive = false) - } - - testClass { - model("editor/optimizeImports/jvm", pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME) - model("editor/optimizeImports/common", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - testClass { - model("editor/optimizeImports/js", pattern = KT_WITHOUT_DOTS_IN_NAME) - model("editor/optimizeImports/common", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("debugger/exceptionFilter", pattern = """^([^\.]+)$""", recursive = false) - } - - testClass { - model("stubs", extension = "kt") - } - - testClass { - model("multiFileHighlighting", recursive = false) - } - - testClass { - model("multiModuleHighlighting/multiplatform/", recursive = false, extension = null) - } - - testClass { - model("multiModuleHighlighting/hierarchicalExpectActualMatching/", recursive = false, extension = null) - } - - testClass { - model("multiModuleQuickFix", extension = null, deep = 1) - } - - testClass { - model("navigation/implementations/multiModule", recursive = false, extension = null) - } - - testClass { - model("navigation/relatedSymbols/multiModule", recursive = false, extension = null) - } - - testClass { - model("navigation/gotoSuper/multiModule", recursive = false, extension = null) - } - - testClass { - model("refactoring/introduceVariable", pattern = KT_OR_KTS, testMethod = "doIntroduceVariableTest") - model("refactoring/extractFunction", pattern = KT_OR_KTS, testMethod = "doExtractFunctionTest") - model("refactoring/introduceProperty", pattern = KT_OR_KTS, testMethod = "doIntroducePropertyTest") - model("refactoring/introduceParameter", pattern = KT_OR_KTS, testMethod = "doIntroduceSimpleParameterTest") - model("refactoring/introduceLambdaParameter", pattern = KT_OR_KTS, testMethod = "doIntroduceLambdaParameterTest") - model("refactoring/introduceJavaParameter", extension = "java", testMethod = "doIntroduceJavaParameterTest") - model("refactoring/introduceTypeParameter", pattern = KT_OR_KTS, testMethod = "doIntroduceTypeParameterTest") - model("refactoring/introduceTypeAlias", pattern = KT_OR_KTS, testMethod = "doIntroduceTypeAliasTest") - model("refactoring/extractSuperclass", pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME, testMethod = "doExtractSuperclassTest") - model("refactoring/extractInterface", pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME, testMethod = "doExtractInterfaceTest") - } - - testClass { - model("refactoring/pullUp/k2k", extension = "kt", singleClass = true, testClassName = "K2K", testMethod = "doKotlinTest") - model("refactoring/pullUp/k2j", extension = "kt", singleClass = true, testClassName = "K2J", testMethod = "doKotlinTest") - model("refactoring/pullUp/j2k", extension = "java", singleClass = true, testClassName = "J2K", testMethod = "doJavaTest") - } - - testClass { - model("refactoring/pushDown/k2k", extension = "kt", singleClass = true, testClassName = "K2K", testMethod = "doKotlinTest") - model("refactoring/pushDown/k2j", extension = "kt", singleClass = true, testClassName = "K2J", testMethod = "doKotlinTest") - model("refactoring/pushDown/j2k", extension = "java", singleClass = true, testClassName = "J2K", testMethod = "doJavaTest") - } - - testClass { - model("coverage/outputFiles") - } - - testClass { - model("internal/toolWindow", recursive = false, extension = null) - } - - testClass("org.jetbrains.kotlin.idea.kdoc.KdocResolveTestGenerated") { - model("kdoc/resolve") - } - - testClass { - model("kdoc/highlighting") - } - - testClass { - model("kdoc/typing") - } - - testClass { - model("codeInsight/generate/testFrameworkSupport") - } - - testClass { - model("codeInsight/generate/equalsWithHashCode") - } - - testClass { - model("codeInsight/generate/secondaryConstructors") - } - - testClass { - model("codeInsight/generate/toString") - } - - testClass { - model("repl/completion") - } - - testClass { - model("codeInsight/postfix") - } - - testClass { - model("script/definition/highlighting", extension = null, recursive = false) - model("script/definition/complex", extension = null, recursive = false, testMethod = "doComplexTest") - } - - testClass { - model("script/definition/navigation", extension = null, recursive = false) - } - - testClass { - model("script/definition/completion", extension = null, recursive = false) - } - - testClass { - model("script/definition/order", extension = null, recursive = false) - } - - testClass { - model("refactoring/nameSuggestionProvider") - } - - testClass { - model("slicer", excludeDirs = listOf("mpp")) - } - - testClass { - model("slicer/inflow", singleClass = true) - } - - testClass { - model("slicer/inflow", singleClass = true) - } - - testClass { - model("slicer/mpp", recursive = false, extension = null) - } - } - - testGroup("idea/scripting-support/test", "idea/scripting-support/testData") { - testClass { - model( - "scratch", - extension = "kts", - testMethod = "doScratchCompilingTest", - testClassName = "ScratchCompiling", - recursive = false - ) - model("scratch", extension = "kts", testMethod = "doScratchReplTest", testClassName = "ScratchRepl", recursive = false) - model( - "scratch/multiFile", - extension = null, - testMethod = "doScratchMultiFileTest", - testClassName = "ScratchMultiFile", - recursive = false - ) - - model( - "worksheet", - extension = "ws.kts", - testMethod = "doWorksheetCompilingTest", - testClassName = "WorksheetCompiling", - recursive = false - ) - model( - "worksheet", - extension = "ws.kts", - testMethod = "doWorksheetReplTest", - testClassName = "WorksheetRepl", - recursive = false - ) - model( - "worksheet/multiFile", - extension = null, - testMethod = "doWorksheetMultiFileTest", - testClassName = "WorksheetMultiFile", - recursive = false - ) - - model( - "scratch/rightPanelOutput", - extension = "kts", - testMethod = "doRightPreviewPanelOutputTest", - testClassName = "ScratchRightPanelOutput", - recursive = false - ) - } - - testClass { - model("scratch/lineMarker", testMethod = "doScratchTest", pattern = KT_OR_KTS) - } - - testClass { - model("script/templatesFromDependencies", extension = null, recursive = false) - } - } - - /* - // Maven and Gradle are not relevant for AS branch - - testGroup("idea/idea-maven/test", "idea/idea-maven/testData") { - testClass { - model("configurator/jvm", extension = null, recursive = false, testMethod = "doTestWithMaven") - model("configurator/js", extension = null, recursive = false, testMethod = "doTestWithJSMaven") - } - - testClass { - model("maven-inspections", pattern = "^([\\w\\-]+).xml$", singleClass = true) - } - } - - testGroup("idea/idea-gradle/tests", "idea/testData") { - testClass { - model("configuration/gradle", extension = null, recursive = false, testMethod = "doTestGradle") - model("configuration/gsk", extension = null, recursive = false, testMethod = "doTestGradle") - } - } - - */ - - testGroup("idea/tests", "compiler/testData") { - testClass { - model("loadJava/compiledKotlin") - } - - testClass { - model("loadJava/compiledKotlin", testMethod = "doTestCompiledKotlin") - } - - testClass { - model("asJava/lightClasses", excludeDirs = listOf("delegation", "script"), pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("asJava/script/ide", pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("asJava/lightClasses", excludeDirs = listOf("local", "compilationErrors", "ideRegression"), pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME) - } - } - - testGroup("idea/idea-completion/tests", "idea/idea-completion/testData") { - testClass { - model("injava", extension = "java", recursive = false) - } - - testClass { - model("injava", extension = "java", recursive = false) - } - - testClass { - model("injava/stdlib", extension = "java", recursive = false) - } - - testClass { - model("weighers/basic", pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("weighers/smart", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("basic/common") - model("basic/js") - } - - testClass { - model("basic/common") - model("basic/java") - } - - testClass { - model("smart") - } - - testClass { - model("keywords", recursive = false) - } - - testClass { - model("basic/withLib", recursive = false) - } - - testClass { - model("handlers/basic", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("handlers/smart") - } - - testClass { - model("handlers/keywords") - } - - testClass { - model("handlers/charFilter") - } - - testClass { - model("basic/multifile", extension = null, recursive = false) - } - - testClass("MultiFilePrimitiveJvmBasicCompletionTestGenerated") { - model("basic/multifilePrimitive", extension = null, recursive = false) - } - - testClass { - model("smartMultiFile", extension = null, recursive = false) - } - - testClass("KDocCompletionTestGenerated") { - model("kdoc") - } - - testClass { - model("basic/java8") - } - - testClass { - model("incrementalResolve") - } - - testClass { - model("multiPlatform", recursive = false, extension = null) - } - } - - //TODO: move these tests into idea-completion module - testGroup("idea/tests", "idea/idea-completion/testData") { - testClass { - model("handlers/runtimeCast") - } - - testClass { - model("basic/codeFragments", extension = "kt") - } - } - - testGroup("j2k/tests", "j2k/testData") { - testClass { - model("fileOrElement", extension = "java") - } - } - testGroup("j2k/tests", "j2k/testData") { - testClass { - model("multiFile", extension = null, recursive = false) - } - } - testGroup("j2k/tests", "j2k/testData") { - testClass { - model("fileOrElement", extension = "java") - } - } - - testGroup("nj2k/tests", "nj2k/testData") { - testClass { - model("newJ2k", pattern = """^([^\.]+)\.java$""") - } - testClass { - model("inference/common") - } - testClass { - model("inference/nullability") - } - testClass { - model("inference/mutability") - } - testClass { - model("copyPaste", pattern = """^([^\.]+)\.java$""") - } - testClass { - model("copyPastePlainText", pattern = """^([^\.]+)\.txt$""") - } - testClass { - model("multiFile", extension = null, recursive = false) - } - } - - /* There is no jps in AS - .... - */ - testGroup("compiler/incremental-compilation-impl/test", "jps-plugin/testData") { - testClass { - model("incremental/pureKotlin", extension = null, recursive = false) - model("incremental/classHierarchyAffected", extension = null, recursive = false) - model("incremental/inlineFunCallSite", extension = null, excludeParentDirs = true) - model("incremental/withJava", extension = null, excludeParentDirs = true) - model("incremental/incrementalJvmCompilerOnly", extension = null, excludeParentDirs = true) - } - - testClass { - model("incremental/pureKotlin", extension = null, recursive = false) - model("incremental/classHierarchyAffected", extension = null, recursive = false) - model("incremental/js", extension = null, excludeParentDirs = true) - } - - testClass { - model("incremental/js/friendsModuleDisabled", extension = null, recursive = false) - } - - testClass { - model("incremental/multiplatform/singleModule", extension = null, excludeParentDirs = true) - } - testClass { - model("incremental/multiplatform/singleModule", extension = null, excludeParentDirs = true) - } - } - - testGroup("plugins/android-extensions/android-extensions-compiler/test", "plugins/android-extensions/android-extensions-compiler/testData") { - testClass { - model("descriptors", recursive = false, extension = null) - } - - testClass { - model("codegen/android", recursive = false, extension = null, testMethod = "doCompileAgainstAndroidSdkTest") - model("codegen/android", recursive = false, extension = null, testMethod = "doFakeInvocationTest", testClassName = "Invoke") - } - - testClass { - model("codegen/bytecodeShape", recursive = false, extension = null) - } - - testClass { - model("parcel/codegen") - } - } - - testGroup("plugins/parcelize/parcelize-compiler/tests", "plugins/parcelize/parcelize-compiler/testData") { - testClass { - model("box", targetBackend = TargetBackend.JVM) - } - - testClass { - model("box", targetBackend = TargetBackend.JVM_IR) - } - - testClass { - model("codegen", targetBackend = TargetBackend.JVM) - } - - testClass { - model("codegen", targetBackend = TargetBackend.JVM_IR) - } - } - - testGroup("plugins/parcelize/parcelize-ide/tests", "plugins/parcelize/parcelize-ide/testData") { - testClass { - model("quickfix", pattern = "^([\\w\\-_]+)\\.kt$", filenameStartsLowerCase = true) - } - - testClass { - model("checker", extension = "kt") - } - } - - testGroup("plugins/kapt3/kapt3-compiler/test", "plugins/kapt3/kapt3-compiler/testData") { - testClass { - model("converter") - } - - testClass { - model("kotlinRunner") - } - } - - testGroup("plugins/kapt3/kapt3-cli/test", "plugins/kapt3/kapt3-cli/testData") { - testClass { - model("argumentParsing", extension = "txt") - } - - testClass { - model("integration", recursive = false, extension = null) - } - } - - testGroup("plugins/allopen/allopen-cli/test", "plugins/allopen/allopen-cli/testData") { - testClass { - model("bytecodeListing", extension = "kt") - } - } - - testGroup("plugins/noarg/noarg-cli/test", "plugins/noarg/noarg-cli/testData") { - testClass { - model("bytecodeListing", extension = "kt") - } - - testClass { - model("box", targetBackend = TargetBackend.JVM) - } - } - - testGroup("plugins/sam-with-receiver/sam-with-receiver-cli/test", "plugins/sam-with-receiver/sam-with-receiver-cli/testData") { - testClass { - model("diagnostics") - } - testClass { - model("script", extension = "kts") - } - } - - testGroup( - "plugins/kotlin-serialization/kotlin-serialization-compiler/test", - "plugins/kotlin-serialization/kotlin-serialization-compiler/testData" - ) { - testClass { - model("diagnostics") - } - - testClass { - model("codegen") - } - - testClass { - model("codegen") - } - } - /* - testGroup("plugins/android-extensions/android-extensions-idea/tests", "plugins/android-extensions/android-extensions-idea/testData") { - testClass { - model("android/completion", recursive = false, extension = null) - } - - testClass { - model("android/goto", recursive = false, extension = null) - } - - testClass { - model("android/rename", recursive = false, extension = null) - } - - testClass { - model("android/renameLayout", recursive = false, extension = null) - } - - testClass { - model("android/findUsages", recursive = false, extension = null) - } - - testClass { - model("android/usageHighlighting", recursive = false, extension = null) - } - - testClass { - model("android/extraction", recursive = false, extension = null) - } - - testClass { - model("android/parcel/checker", excludeParentDirs = true) - } - - testClass { - model("android/parcel/quickfix", pattern = """^(\w+)\.((before\.Main\.\w+)|(test))$""", testMethod = "doTestWithExtraFile") - } - } - - testGroup("idea/idea-android/tests", "idea/testData") { - testClass { - model("configuration/android-gradle", pattern = """(\w+)_before\.gradle$""", testMethod = "doTestAndroidGradle") - model("configuration/android-gsk", pattern = """(\w+)_before\.gradle.kts$""", testMethod = "doTestAndroidGradle") - } - - testClass { - model("android/intention", pattern = "^([\\w\\-_]+)\\.kt$") - } - - testClass { - model("android/resourceIntention", extension = "test", singleClass = true) - } - - testClass { - model("android/quickfix", pattern = """^(\w+)\.((before\.Main\.\w+)|(test))$""", testMethod = "doTestWithExtraFile") - } - - testClass { - model("android/lint", excludeParentDirs = true) - } - - testClass { - model("android/lintQuickfix", pattern = "^([\\w\\-_]+)\\.kt$") - } - - testClass { - model("android/folding") - } - - testClass { - model("android/gutterIcon") - } - } - */ - } -} diff --git a/gradle/versions.properties.as40 b/gradle/versions.properties.as40 deleted file mode 100644 index fb1045df6ac..00000000000 --- a/gradle/versions.properties.as40 +++ /dev/null @@ -1,22 +0,0 @@ -versions.intellijSdk=193.6494.35 -versions.androidBuildTools=r23.0.1 -versions.idea.NodeJS=181.3494.12 -versions.androidStudioRelease=4.0.1.0 -versions.androidStudioBuild=193.6626763 -versions.jar.asm-all=7.0.1 -versions.jar.guava=27.1-jre -versions.jar.groovy-all=2.4.17 -versions.jar.lombok-ast=0.2.3 -versions.jar.swingx-core=1.6.2-2 -versions.jar.kxml2=2.3.0 -versions.jar.streamex=0.6.8 -versions.jar.gson=2.8.5 -versions.jar.oro=2.0.8 -versions.jar.picocontainer=1.2 -versions.jar.serviceMessages=2019.1.4 -versions.jar.lz4-java=1.6.0 -ignore.jar.snappy-in-java=true -versions.gradle-api=4.5.1 -versions.shadow=5.2.0 -ignore.jar.common=true -ignore.jar.lombok-ast=true \ No newline at end of file diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/modules/ModuleHighlightUtil2.java.as40 b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/modules/ModuleHighlightUtil2.java.as40 deleted file mode 100644 index 053f070e51d..00000000000 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/modules/ModuleHighlightUtil2.java.as40 +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.modules; - -import com.intellij.openapi.module.Module; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.roots.ModuleRootManager; -import com.intellij.openapi.roots.ProjectFileIndex; -import com.intellij.openapi.vfs.JarFileSystem; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.psi.PsiFile; -import com.intellij.psi.PsiJavaFile; -import com.intellij.psi.PsiJavaModule; -import com.intellij.psi.PsiManager; -import com.intellij.psi.impl.light.LightJavaModule; -import kotlin.collections.ArraysKt; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.idea.core.FileIndexUtilsKt; - -import java.io.IOException; -import java.io.InputStream; -import java.util.jar.Attributes; -import java.util.jar.JarFile; -import java.util.jar.Manifest; - -import static com.intellij.psi.PsiJavaModule.MODULE_INFO_FILE; - -// Copied from com.intellij.codeInsight.daemon.impl.analysis.ModuleHighlightUtil -public class ModuleHighlightUtil2 { - private static final Attributes.Name MULTI_RELEASE = new Attributes.Name("Multi-Release"); - - @Nullable - static PsiJavaModule getModuleDescriptor(@NotNull VirtualFile file, @NotNull Project project) { - ProjectFileIndex index = ProjectFileIndex.SERVICE.getInstance(project); - if (index.isInLibrary(file)) { - VirtualFile root; - if ((root = index.getClassRootForFile(file)) != null) { - VirtualFile descriptorFile = root.findChild(PsiJavaModule.MODULE_INFO_CLS_FILE); - if (descriptorFile == null) { - VirtualFile alt = root.findFileByRelativePath("META-INF/versions/9/" + PsiJavaModule.MODULE_INFO_CLS_FILE); - if (alt != null && isMultiReleaseJar(root)) { - descriptorFile = alt; - } - } - if (descriptorFile != null) { - PsiFile psiFile = PsiManager.getInstance(project).findFile(descriptorFile); - if (psiFile instanceof PsiJavaFile) { - return ((PsiJavaFile) psiFile).getModuleDeclaration(); - } - } - else if (root.getFileSystem() instanceof JarFileSystem && "jar".equalsIgnoreCase(root.getExtension())) { - return LightJavaModule.getModule(PsiManager.getInstance(project), root); - } - } - else if ((root = index.getSourceRootForFile(file)) != null) { - VirtualFile descriptorFile = root.findChild(MODULE_INFO_FILE); - if (descriptorFile != null) { - PsiFile psiFile = PsiManager.getInstance(project).findFile(descriptorFile); - if (psiFile instanceof PsiJavaFile) { - return ((PsiJavaFile) psiFile).getModuleDeclaration(); - } - } - } - } - else { - Module module = index.getModuleForFile(file); - if (module != null) { - boolean isTest = FileIndexUtilsKt.isInTestSourceContentKotlinAware(index, file); - VirtualFile modularRoot = ArraysKt.singleOrNull(ModuleRootManager.getInstance(module).getSourceRoots(isTest), - root -> root.findChild(MODULE_INFO_FILE) != null); - if (modularRoot != null) { - VirtualFile moduleInfo = modularRoot.findChild(MODULE_INFO_FILE); - assert moduleInfo != null : modularRoot; - PsiFile psiFile = PsiManager.getInstance(project).findFile(moduleInfo); - if (psiFile instanceof PsiJavaFile) { - return ((PsiJavaFile) psiFile).getModuleDeclaration(); - } - } - } - } - - return null; - } - - private static boolean isMultiReleaseJar(VirtualFile root) { - if (root.getFileSystem() instanceof JarFileSystem) { - VirtualFile manifest = root.findFileByRelativePath(JarFile.MANIFEST_NAME); - if (manifest != null) { - try (InputStream stream = manifest.getInputStream()) { - return Boolean.valueOf(new Manifest(stream).getMainAttributes().getValue(MULTI_RELEASE)); - } - catch (IOException ignored) { - } - } - } - - return false; - } -} diff --git a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/confidence/KotlinConfidenceTest.java.as40 b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/confidence/KotlinConfidenceTest.java.as40 deleted file mode 100644 index 1d2a7c781e9..00000000000 --- a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/confidence/KotlinConfidenceTest.java.as40 +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.completion.test.confidence; - -import com.intellij.codeInsight.CodeInsightSettings; -import com.intellij.codeInsight.completion.*; -import com.intellij.codeInsight.lookup.LookupElement; -import com.intellij.codeInsight.lookup.LookupManager; -import com.intellij.codeInsight.lookup.impl.LookupImpl; -import com.intellij.lang.Language; -import com.intellij.lang.injection.InjectedLanguageManager; -import com.intellij.openapi.editor.Editor; -import com.intellij.openapi.projectRoots.JavaSdk; -import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiFile; -import com.intellij.psi.util.PsiUtilCore; -import com.intellij.util.ArrayUtil; -import com.intellij.util.ThreeState; -import org.apache.commons.lang.SystemUtils; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.kotlin.idea.completion.test.CompletionTestUtilKt; -import org.jetbrains.kotlin.idea.test.TestUtilsKt; -import org.jetbrains.kotlin.test.InTextDirectivesUtils; -import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner; -import org.junit.runner.RunWith; - -import java.io.File; -import java.util.List; - -@RunWith(JUnit3WithIdeaConfigurationRunner.class) -public class KotlinConfidenceTest extends LightCompletionTestCase { - private static final String TYPE_DIRECTIVE_PREFIX = "// TYPE:"; - private final ThreadLocal skipComplete = ThreadLocal.withInitial(() -> false); - - public void testCompleteOnDotOutOfRanges() { - doTest(); - } - - public void testImportAsConfidence() { - doTest(); - } - - public void testInBlockOfFunctionLiteral() { - doTest(); - } - - public void testInModifierList() { - doTest(); - } - - public void testNoAutoCompletionForRangeOperator() { - doTest(); - } - - public void testNoAutoPopupInString() { - doTest(); - } - - public void testAutoPopupInStringTemplate() { - doTest(); - } - - public void testAutoPopupInStringTemplateAfterDollar() { - doTest(); - } - - public void testNoAutoPopupInStringTemplateAfterSpace() { - doTest(); - } - - public void testNoAutoPopupInRawStringTemplateAfterNewLine() { - doTest(); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - TestUtilsKt.invalidateLibraryCache(getProject()); - } - - protected void doTest() { - boolean completeByChars = CodeInsightSettings.getInstance().SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS; - - CodeInsightSettings.getInstance().SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS = true; - - try { - skipComplete.set(true); - try { - configureByFile(getBeforeFileName()); - } finally { - skipComplete.set(false); - } - - String text = getEditor().getDocument().getText(); - boolean noLookup = InTextDirectivesUtils.isDirectiveDefined(text, "// NO_LOOKUP"); - if (!noLookup) complete(); //This will cause NPE in case of absence of autopopup completion - - List expectedElements = InTextDirectivesUtils.findLinesWithPrefixesRemoved(text, "// ELEMENT:"); - assertFalse("Can't both expect lookup elements and no lookup", !expectedElements.isEmpty() && noLookup); - - if (noLookup) { - assertTrue("Should skip autopopup completion", shouldSkipAutoPopup(getEditor(), getFile())); - return; - } - - String typeText = getTypeText(text); - if (!expectedElements.isEmpty()) { - assertContainsItems(ArrayUtil.toStringArray(expectedElements)); - return; - } - assertNotNull("You must type something, use // TYPE:", typeText); - type(typeText); - checkResultByFile(getAfterFileName()); - } - finally { - CodeInsightSettings.getInstance().SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS = completeByChars; - } - } - - private static String getTypeText(String text) { - String[] directives = InTextDirectivesUtils.findArrayWithPrefixes(text, TYPE_DIRECTIVE_PREFIX); - if (directives.length == 0) return null; - assertEquals("One directive with \"" + TYPE_DIRECTIVE_PREFIX +"\" expected", 1, directives.length); - - return StringUtil.unquoteString(directives[0]); - } - - private String getBeforeFileName() { - return getTestName(false) + ".kt"; - } - - private String getAfterFileName() { - return getTestName(false) + ".kt.after"; - } - - @NotNull - @Override - protected String getTestDataPath() { - return new File(CompletionTestUtilKt.getCOMPLETION_TEST_DATA_BASE_PATH(), "/confidence/").getPath() + File.separator; - } - - @Override - protected Sdk getProjectJDK() { - return JavaSdk.getInstance().createJdk("JDK", SystemUtils.getJavaHome().getAbsolutePath()); - } - - @Override - protected void complete() { - if (skipComplete.get()) return; - new CodeCompletionHandlerBase(CompletionType.BASIC, false, true, true).invokeCompletion( - getProject(), getEditor(), 0, false); - - LookupImpl lookup = (LookupImpl) LookupManager.getActiveLookup(getEditor()); - myItems = lookup == null ? null : lookup.getItems().toArray(LookupElement.EMPTY_ARRAY); - myPrefix = lookup == null ? null : lookup.itemPattern(lookup.getItems().get(0)); - } - - private static boolean shouldSkipAutoPopup(Editor editor, PsiFile psiFile) { - int offset = editor.getCaretModel().getOffset(); - int psiOffset = Math.max(0, offset - 1); - - PsiElement elementAt = InjectedLanguageManager.getInstance(psiFile.getProject()).findInjectedElementAt(psiFile, psiOffset); - if (elementAt == null) { - elementAt = psiFile.findElementAt(psiOffset); - } - if (elementAt == null) return true; - - Language language = PsiUtilCore.findLanguageFromElement(elementAt); - - for (CompletionConfidence confidence : CompletionConfidenceEP.forLanguage(language)) { - ThreeState result = confidence.shouldSkipAutopopup(elementAt, psiFile, offset); - if (result != ThreeState.UNSURE) { - return result == ThreeState.YES; - } - } - - return false; - } -} diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/KotlinFUSLogger.kt.as40 b/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/KotlinFUSLogger.kt.as40 deleted file mode 100644 index 0e1adf9ff46..00000000000 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/KotlinFUSLogger.kt.as40 +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.statistics - -open class KotlinFUSLogger { - companion object { - fun log(group: FUSEventGroups, event: String) { - // Not whitelisted for AS - } - - fun log(group: FUSEventGroups, event: String, eventData: Map) { - // Not whitelisted for AS - } - } -} \ No newline at end of file diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/ProjectConfigurationCollector.kt.as40 b/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/ProjectConfigurationCollector.kt.as40 deleted file mode 100644 index 3fe75589e1c..00000000000 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/ProjectConfigurationCollector.kt.as40 +++ /dev/null @@ -1,3 +0,0 @@ -class ProjectConfigurationCollector { - // Not whitelisted -} \ No newline at end of file diff --git a/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/util/ApplicationUtils.kt.as40 b/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/util/ApplicationUtils.kt.as40 deleted file mode 100644 index af352d76fa1..00000000000 --- a/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/util/ApplicationUtils.kt.as40 +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.util.application - -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.command.CommandProcessor -import com.intellij.openapi.components.ServiceManager -import com.intellij.openapi.components.ComponentManager -import com.intellij.openapi.progress.ProgressIndicator -import com.intellij.openapi.progress.ProgressIndicatorProvider -import com.intellij.openapi.progress.ProgressManager -import com.intellij.openapi.project.Project -import com.intellij.openapi.project.DumbService -import com.intellij.openapi.util.Condition - -fun runReadAction(action: () -> T): T { - return ApplicationManager.getApplication().runReadAction(action) -} - -fun runWriteAction(action: () -> T): T { - return ApplicationManager.getApplication().runWriteAction(action) -} - -fun Project.executeWriteCommand(name: String, command: () -> Unit) { - CommandProcessor.getInstance().executeCommand(this, { runWriteAction(command) }, name, null) -} - -fun Project.executeWriteCommand(name: String, groupId: Any? = null, command: () -> T): T { - return executeCommand(name, groupId) { runWriteAction(command) } -} - -fun Project.executeCommand(name: String, groupId: Any? = null, command: () -> T): T { - @Suppress("UNCHECKED_CAST") var result: T = null as T - CommandProcessor.getInstance().executeCommand(this, { result = command() }, name, groupId) - @Suppress("USELESS_CAST") - return result as T -} - -fun runWithCancellationCheck(block: () -> T): T = block() - -inline fun executeOnPooledThread(crossinline action: () -> Unit) = - ApplicationManager.getApplication().executeOnPooledThread { action() } - -inline fun invokeLater(crossinline action: () -> Unit) = - ApplicationManager.getApplication().invokeLater { action() } - -inline fun invokeLater(expired: Condition<*>, crossinline action: () -> Unit) = - ApplicationManager.getApplication().invokeLater({ action() }, expired) - -inline fun isUnitTestMode(): Boolean = ApplicationManager.getApplication().isUnitTestMode - -inline fun ComponentManager.getServiceSafe(): T = - this.getService(T::class.java) ?: error("Unable to locate service ${T::class.java.name}") - -fun Project.getServiceIfCreated(serviceClass: Class): T? = - ServiceManager.getServiceIfCreated(this, serviceClass) - -fun Project.runReadActionInSmartMode(action: () -> T): T { - if (ApplicationManager.getApplication().isReadAccessAllowed) return action() - return DumbService.getInstance(this).runReadActionInSmartMode(action) -} \ No newline at end of file diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/HierarchicalMultiplatformProjectImportingTest.kt.as40 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/HierarchicalMultiplatformProjectImportingTest.kt.as40 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformProjectImportingTest.kt.as40 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformProjectImportingTest.kt.as40 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformTestCompatibilityMatrix.kt.as40 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformTestCompatibilityMatrix.kt.as40 deleted file mode 100644 index 6bbb8c73dc3..00000000000 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformTestCompatibilityMatrix.kt.as40 +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.gradle - -fun KaptImportingTest.isAndroidStudio() = true diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt.as40 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt.as40 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/PackagePrefixImportingTest.kt.as40 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/PackagePrefixImportingTest.kt.as40 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/AbstractModelBuilderTest.java.as40 b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/AbstractModelBuilderTest.java.as40 deleted file mode 100644 index 12845078cdd..00000000000 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/AbstractModelBuilderTest.java.as40 +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ -package org.jetbrains.kotlin.idea.codeInsight.gradle; - -import com.google.common.collect.Multimap; -import com.intellij.openapi.util.Pair; -import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.util.io.StreamUtil; -import com.intellij.testFramework.IdeaTestUtil; -import com.intellij.util.Function; -import com.intellij.util.containers.ContainerUtil; -import org.codehaus.groovy.runtime.typehandling.ShortTypeHandling; -import org.gradle.tooling.BuildActionExecuter; -import org.gradle.tooling.GradleConnector; -import org.gradle.tooling.ProjectConnection; -import org.gradle.tooling.internal.consumer.DefaultGradleConnector; -import org.gradle.tooling.model.DomainObjectSet; -import org.gradle.tooling.model.idea.IdeaModule; -import org.gradle.util.GradleVersion; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.plugins.gradle.model.ClassSetProjectImportModelProvider; -import org.jetbrains.plugins.gradle.model.ExternalProject; -import org.jetbrains.plugins.gradle.model.ProjectImportAction; -import org.jetbrains.plugins.gradle.service.execution.GradleExecutionHelper; -import org.jetbrains.plugins.gradle.tooling.builder.ModelBuildScriptClasspathBuilderImpl; -import org.jetbrains.plugins.gradle.util.GradleConstants; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.rules.TestName; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.*; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assume.assumeThat; - -// part of org.jetbrains.plugins.gradle.tooling.builder.AbstractModelBuilderTest -@RunWith(value = Parameterized.class) -public abstract class AbstractModelBuilderTest { - - public static final Object[][] SUPPORTED_GRADLE_VERSIONS = {{"4.9"}, {"5.6.4"}, {"6.5.1"}}; - - private static final Pattern TEST_METHOD_NAME_PATTERN = Pattern.compile("(.*)\\[(\\d*: with Gradle-.*)\\]"); - - private static File ourTempDir; - - @NotNull - private final String gradleVersion; - private File testDir; - private ProjectImportAction.AllModels allModels; - - @Rule public TestName name = new TestName(); - @Rule public VersionMatcherRule versionMatcherRule = new VersionMatcherRule(); - - public AbstractModelBuilderTest(@NotNull String gradleVersion) { - this.gradleVersion = gradleVersion; - } - - @Parameterized.Parameters(name = "{index}: with Gradle-{0}") - public static Collection data() { - return Arrays.asList(SUPPORTED_GRADLE_VERSIONS); - } - - - @Before - public void setUp() throws Exception { - assumeThat(gradleVersion, versionMatcherRule.getMatcher()); - - ensureTempDirCreated(); - - String methodName = name.getMethodName(); - Matcher m = TEST_METHOD_NAME_PATTERN.matcher(methodName); - if (m.matches()) { - methodName = m.group(1); - } - - testDir = new File(ourTempDir, methodName); - FileUtil.ensureExists(testDir); - - InputStream buildScriptStream = getClass().getResourceAsStream("/" + methodName + "/" + GradleConstants.DEFAULT_SCRIPT_NAME); - try { - FileUtil.writeToFile( - new File(testDir, GradleConstants.DEFAULT_SCRIPT_NAME), - FileUtil.loadTextAndClose(buildScriptStream) - ); - } - finally { - StreamUtil.closeStream(buildScriptStream); - } - - InputStream settingsStream = getClass().getResourceAsStream("/" + methodName + "/" + GradleConstants.SETTINGS_FILE_NAME); - try { - if (settingsStream != null) { - FileUtil.writeToFile( - new File(testDir, GradleConstants.SETTINGS_FILE_NAME), - FileUtil.loadTextAndClose(settingsStream) - ); - } - } - finally { - StreamUtil.closeStream(settingsStream); - } - - GradleConnector connector = GradleConnector.newConnector(); - - URI distributionUri = new DistributionLocator().getDistributionFor(GradleVersion.version(gradleVersion)); - connector.useDistribution(distributionUri); - connector.forProjectDirectory(testDir); - int daemonMaxIdleTime = 10; - try { - daemonMaxIdleTime = Integer.parseInt(System.getProperty("gradleDaemonMaxIdleTime", "10")); - } - catch (NumberFormatException ignore) { - } - - ((DefaultGradleConnector) connector).daemonMaxIdleTime(daemonMaxIdleTime, TimeUnit.SECONDS); - ProjectConnection connection = connector.connect(); - - try { - ProjectImportAction projectImportAction = new ProjectImportAction(false); - projectImportAction.addProjectImportModelProvider(new ClassSetProjectImportModelProvider(getModels())); - BuildActionExecuter buildActionExecutor = connection.action(projectImportAction); - File initScript = GradleExecutionHelper.generateInitScript(false, getToolingExtensionClasses()); - assertNotNull(initScript); - String jdkHome = IdeaTestUtil.requireRealJdkHome(); - buildActionExecutor.setJavaHome(new File(jdkHome)); - buildActionExecutor.setJvmArguments("-Xmx128m", "-XX:MaxPermSize=64m"); - buildActionExecutor - .withArguments("--info", "--recompile-scripts", GradleConstants.INIT_SCRIPT_CMD_OPTION, initScript.getAbsolutePath()); - allModels = buildActionExecutor.run(); - assertNotNull(allModels); - } - finally { - connection.close(); - } - } - - @NotNull - private static Set getToolingExtensionClasses() { - Set classes = ContainerUtil.set( - ExternalProject.class, - // gradle-tooling-extension-api jar - ProjectImportAction.class, - // gradle-tooling-extension-impl jar - ModelBuildScriptClasspathBuilderImpl.class, - Multimap.class, - ShortTypeHandling.class - ); - - ContainerUtil.addAllNotNull(classes, doGetToolingExtensionClasses()); - return classes; - } - - @NotNull - private static Set doGetToolingExtensionClasses() { - return Collections.emptySet(); - } - - @After - public void tearDown() throws Exception { - if (testDir != null) { - FileUtil.delete(testDir); - } - } - - protected abstract Set getModels(); - - - private Map getModulesMap(final Class aClass) { - DomainObjectSet ideaModules = allModels.getIdeaProject().getModules(); - - final String filterKey = "to_filter"; - Map map = ContainerUtil.map2Map(ideaModules, new Function>() { - @Override - public Pair fun(IdeaModule module) { - T value = allModels.getModel(module, aClass); - String key = value != null ? module.getGradleProject().getPath() : filterKey; - return Pair.create(key, value); - } - }); - - map.remove(filterKey); - return map; - } - - private static void ensureTempDirCreated() throws IOException { - if (ourTempDir != null) return; - - ourTempDir = new File(FileUtil.getTempDirectory(), "gradleTests"); - FileUtil.delete(ourTempDir); - FileUtil.ensureExists(ourTempDir); - } - - public static class DistributionLocator { - private static final String RELEASE_REPOSITORY_ENV = "GRADLE_RELEASE_REPOSITORY"; - private static final String SNAPSHOT_REPOSITORY_ENV = "GRADLE_SNAPSHOT_REPOSITORY"; - private static final String GRADLE_RELEASE_REPO = "https://services.gradle.org/distributions"; - private static final String GRADLE_SNAPSHOT_REPO = "https://services.gradle.org/distributions-snapshots"; - - @NotNull private final String myReleaseRepoUrl; - @NotNull private final String mySnapshotRepoUrl; - - public DistributionLocator() { - this(DistributionLocator.getRepoUrl(false), DistributionLocator.getRepoUrl(true)); - } - - public DistributionLocator(@NotNull String releaseRepoUrl, @NotNull String snapshotRepoUrl) { - myReleaseRepoUrl = releaseRepoUrl; - mySnapshotRepoUrl = snapshotRepoUrl; - } - - @NotNull - public URI getDistributionFor(@NotNull GradleVersion version) throws URISyntaxException { - return getDistribution(getDistributionRepository(version), version, "gradle", "bin"); - } - - @NotNull - private String getDistributionRepository(@NotNull GradleVersion version) { - return version.isSnapshot() ? mySnapshotRepoUrl : myReleaseRepoUrl; - } - - private static URI getDistribution( - @NotNull String repositoryUrl, - @NotNull GradleVersion version, - @NotNull String archiveName, - @NotNull String archiveClassifier - ) throws URISyntaxException { - return new URI(String.format("%s/%s-%s-%s.zip", repositoryUrl, archiveName, version.getVersion(), archiveClassifier)); - } - - @NotNull - public static String getRepoUrl(boolean isSnapshotUrl) { - String envRepoUrl = System.getenv(isSnapshotUrl ? SNAPSHOT_REPOSITORY_ENV : RELEASE_REPOSITORY_ENV); - if (envRepoUrl != null) return envRepoUrl; - - return isSnapshotUrl ? GRADLE_SNAPSHOT_REPO : GRADLE_RELEASE_REPO; - } - } -} diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleConfiguratorPlatformSpecificTest.kt.as40 b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleConfiguratorPlatformSpecificTest.kt.as40 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt.as40 b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt.as40 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleInspectionTestCompatibilityMatrix.kt.as40 b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleInspectionTestCompatibilityMatrix.kt.as40 deleted file mode 100644 index bd96057db50..00000000000 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleInspectionTestCompatibilityMatrix.kt.as40 +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.codeInsight.gradle - -fun isGradleInspectionTestApplicable() = false \ No newline at end of file diff --git a/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/service/MavenProjectImporter.kt.as40 b/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/service/MavenProjectImporter.kt.as40 deleted file mode 100644 index 47feb237c39..00000000000 --- a/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/service/MavenProjectImporter.kt.as40 +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.tools.projectWizard.wizard.service - -import com.intellij.openapi.project.Project -import java.nio.file.Path - -class MavenProjectImporter(private val project: Project) { - fun importProject(path: Path) { - // AS does not support Maven - } -} \ No newline at end of file diff --git a/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/sequence/KotlinPsiChainBuilderTestCase.kt.as40 b/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/sequence/KotlinPsiChainBuilderTestCase.kt.as40 deleted file mode 100644 index 418a1681e4f..00000000000 --- a/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/sequence/KotlinPsiChainBuilderTestCase.kt.as40 +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ -package org.jetbrains.kotlin.idea.debugger.test.sequence - -import com.intellij.debugger.streams.test.StreamChainBuilderTestCase -import com.intellij.debugger.streams.wrapper.StreamChain -import com.intellij.debugger.streams.wrapper.StreamChainBuilder -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.projectRoots.Sdk -import com.intellij.openapi.roots.impl.libraries.ProjectLibraryTable -import com.intellij.testFramework.PsiTestUtil -import junit.framework.TestCase -import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime -import org.jetbrains.kotlin.idea.caches.project.LibraryModificationTracker -import org.jetbrains.kotlin.idea.debugger.test.DEBUGGER_TESTDATA_PATH_BASE -import org.jetbrains.kotlin.idea.test.PluginTestCaseBase - -abstract class KotlinPsiChainBuilderTestCase(private val relativePath: String) : StreamChainBuilderTestCase() { - override fun getTestDataPath(): String = "$DEBUGGER_TESTDATA_PATH_BASE/sequence/psi/$relativeTestPath" - - override fun getFileExtension(): String = ".kt" - abstract val kotlinChainBuilder: StreamChainBuilder - override fun getChainBuilder(): StreamChainBuilder = kotlinChainBuilder - private val stdLibName = "kotlin-stdlib" - - protected abstract fun doTest() - - final override fun getRelativeTestPath(): String = relativePath - - override fun setUp() { - super.setUp() - ApplicationManager.getApplication().runWriteAction { - @Suppress("UnstableApiUsage") - if (ProjectLibraryTable.getInstance(project).getLibraryByName(stdLibName) == null) { - val stdLibPath = ForTestCompileRuntime.runtimeJarForTests() - PsiTestUtil.addLibrary( - testRootDisposable, - module, - stdLibName, - stdLibPath.parent, - stdLibPath.name - ) - } - } - LibraryModificationTracker.getInstance(project).incModificationCount() - } - - - override fun getProjectJDK(): Sdk { - return PluginTestCaseBase.mockJdk9() - } - - abstract class Positive(relativePath: String) : KotlinPsiChainBuilderTestCase(relativePath) { - override fun doTest() { - val chains = buildChains() - checkChains(chains) - } - - private fun checkChains(chains: MutableList) { - TestCase.assertFalse(chains.isEmpty()) - } - } - - abstract class Negative(relativePath: String) : KotlinPsiChainBuilderTestCase(relativePath) { - override fun doTest() { - val elementAtCaret = configureAndGetElementAtCaret() - TestCase.assertFalse(chainBuilder.isChainExists(elementAtCaret)) - TestCase.assertTrue(chainBuilder.build(elementAtCaret).isEmpty()) - } - } -} diff --git a/idea/resources-descriptors/META-INF/plugin.xml.as40 b/idea/resources-descriptors/META-INF/plugin.xml.as40 deleted file mode 100644 index 2588cca74d4..00000000000 --- a/idea/resources-descriptors/META-INF/plugin.xml.as40 +++ /dev/null @@ -1,173 +0,0 @@ - - org.jetbrains.kotlin - - Kotlin - -Getting Started in IntelliJ IDEA
-Getting Started in Android Studio
-Public Slack
-Issue tracker
-]]> - @snapshot@ - JetBrains - - - - 1.4.20 -

    -
  • Kotlin/JS: New project templates, improved Gradle plugin, experimental compilation with errors mode in the IR compiler.
  • -
  • Kotlin/Native: New escape analysis mechanism, wrapping of Objective-C exceptions, various functional and performance improvements.
  • -
  • IDE: Experimental support for Code Vision, the Redirect input from option in Kotlin run configurations, and more.
  • -
  • JEP 280 (invokedynamic) string concatenation is available on the JVM.
  • -
  • Changes to the layout of multiplatform projects.
  • -
  • Improved CocoaPods support.
  • -
  • Standard library improvements: Extensions for java.nio.file.Path and performance optimizations.
  • -
  • Deprecation of the kotlin-android-extensions compiler plugin. Parcelable implementation generator has moved to the new kotlin-parcelize plugin.
  • -
- For more details, see What’s New in Kotlin 1.4.20 and this blog post. -

-

1.4.0

- Released: August 17, 2020 -
    -
  • New compiler with better type inference.
  • -
  • IR backends for JVM and JS in Alpha mode (requires opt-in).
  • -
  • A new flexible Kotlin Project Wizard for easy creation and configuration of different types of projects.
  • -
  • New IDE functionality to debug coroutines.
  • -
  • IDE performance improvements: many actions, such as project opening and autocomplete suggestions now complete up to 4 times faster.
  • -
  • New language features such as SAM conversions, trailing comma, and other.
  • -
  • Type annotations in the JVM bytecode and new modes for generating default interfaces in Kotlin/JVM.
  • -
  • New Gradle DSL for Kotlin/JS.
  • -
  • Improved performance and interop with Swift and Objective-C in Kotlin/Native.
  • -
  • Support for sharing code in several targets thanks to the hierarchical structure in multiplatform projects.
  • -
  • New collection operators, delegated properties improvements, the double-ended queue implementation ArrayDeque, and much more new things in the standard library.
  • -
- For more details, see What’s New in Kotlin 1.4.0 and this blog post. -

- To get the most out of the changes and improvements introduced in Kotlin 1.4, join our Online Event where you will be able to enjoy four days of Kotlin talks, Q&As with the Kotlin team, and more. - ]]> - - - com.intellij.modules.platform - com.intellij.modules.androidstudio - - JUnit - com.intellij.gradle - org.jetbrains.plugins.gradle - org.jetbrains.plugins.gradle - org.intellij.groovy - org.jetbrains.idea.maven - TestNG-J - Coverage - com.intellij.java-i18n - org.jetbrains.java.decompiler - Git4Idea - org.jetbrains.debugger.streams - - - - - com.intellij.modules.java - JavaScriptDebugger - com.intellij.copyright - org.intellij.intelliLang - - - - - - - - - - - - - - - - - - - - - - - - org.jetbrains.kotlin.idea.caches.trackers.KotlinCodeBlockModificationListener - - - - - - org.jetbrains.kotlin.idea.PluginStartupComponent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/idea/resources/META-INF/android-lint.xml.as40 b/idea/resources/META-INF/android-lint.xml.as40 deleted file mode 100644 index 5a029687008..00000000000 --- a/idea/resources/META-INF/android-lint.xml.as40 +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/IDESettingsFUSCollector.kt.as40 b/idea/src/org/jetbrains/kotlin/idea/IDESettingsFUSCollector.kt.as40 deleted file mode 100644 index 939c6c53fe5..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/IDESettingsFUSCollector.kt.as40 +++ /dev/null @@ -1,3 +0,0 @@ -class IDESettingsFUSCollector { - // Not whitelisted -} diff --git a/idea/src/org/jetbrains/kotlin/idea/configuration/MLCompletionForKotlin.kt.as40 b/idea/src/org/jetbrains/kotlin/idea/configuration/MLCompletionForKotlin.kt.as40 deleted file mode 100644 index d1d25c9b8bd..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/configuration/MLCompletionForKotlin.kt.as40 +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.configuration - -internal object MLCompletionForKotlin { - const val isAvailable: Boolean = false - - var isEnabled: Boolean - get() = false - set(value) { - throw UnsupportedOperationException() - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/formatter/KotlinFormatterUsageCollector.kt.as40 b/idea/src/org/jetbrains/kotlin/idea/formatter/KotlinFormatterUsageCollector.kt.as40 deleted file mode 100644 index 435ed2bbdbc..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/formatter/KotlinFormatterUsageCollector.kt.as40 +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright 2000-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.formatter - -import com.intellij.application.options.CodeStyle -import com.intellij.internal.statistic.beans.UsageDescriptor -import com.intellij.internal.statistic.utils.getEnumUsage -import com.intellij.openapi.project.Project -import com.intellij.psi.codeStyle.CodeStyleSettingsManager -import org.jetbrains.kotlin.idea.core.formatter.KotlinCodeStyleSettings -import org.jetbrains.kotlin.idea.formatter.KotlinFormatterUsageCollector.KotlinFormatterKind.* -import org.jetbrains.kotlin.idea.util.isDefaultOfficialCodeStyle - -//todo: convert to FUS? -class KotlinFormatterUsageCollector { - fun getProjectUsages(project: Project): Set { - val usedFormatter = getKotlinFormatterKind(project) - - val settings = CodeStyle.getSettings(project) - val kotlinCommonSettings = settings.kotlinCommonSettings - val kotlinCustomSettings = settings.kotlinCustomSettings - - return setOf( - getEnumUsage("kotlin.formatter.kind", usedFormatter), - getEnumStringPropertyUsage( - "kotlin.formatter.defaults", - kotlinCustomSettings.CODE_STYLE_DEFAULTS ?: kotlinCommonSettings.CODE_STYLE_DEFAULTS - ) - ) - } - - private fun getEnumStringPropertyUsage(key: String, value: String?): UsageDescriptor { - return UsageDescriptor(key + "." + value.toString().toLowerCase(java.util.Locale.ENGLISH), 1) - } - - companion object { - private const val GROUP_ID = "kotlin.formatter" - - private val KOTLIN_DEFAULT_COMMON = KotlinLanguageCodeStyleSettingsProvider().defaultCommonSettings - .also { KotlinStyleGuideCodeStyle.applyToCommonSettings(it) } - - private val KOTLIN_DEFAULT_CUSTOM by lazy { - KotlinCodeStyleSettings.defaultSettings().cloneSettings() - .also { KotlinStyleGuideCodeStyle.applyToKotlinCustomSettings(it) } - } - - private val KOTLIN_OBSOLETE_DEFAULT_COMMON = KotlinLanguageCodeStyleSettingsProvider().defaultCommonSettings - .also { KotlinObsoleteCodeStyle.applyToCommonSettings(it) } - - private val KOTLIN_OBSOLETE_DEFAULT_CUSTOM by lazy { - KotlinCodeStyleSettings.defaultSettings().cloneSettings() - .also { KotlinObsoleteCodeStyle.applyToKotlinCustomSettings(it) } - } - - fun getKotlinFormatterKind(project: Project): KotlinFormatterKind { - val isProject = CodeStyleSettingsManager.getInstance(project).USE_PER_PROJECT_SETTINGS - val isDefaultOfficialCodeStyle = isDefaultOfficialCodeStyle - - val settings = CodeStyle.getSettings(project) - val kotlinCommonSettings = settings.kotlinCommonSettings - val kotlinCustomSettings = settings.kotlinCustomSettings - - val isDefaultKotlinCommonSettings = kotlinCommonSettings == KotlinLanguageCodeStyleSettingsProvider().defaultCommonSettings - val isDefaultKotlinCustomSettings = kotlinCustomSettings == KotlinCodeStyleSettings.defaultSettings() - - if (isDefaultKotlinCommonSettings && isDefaultKotlinCustomSettings) { - return if (isDefaultOfficialCodeStyle) { - paired(IDEA_OFFICIAL_DEFAULT, isProject) - } else { - paired(IDEA_DEFAULT, isProject) - } - } - - if (kotlinCommonSettings == KOTLIN_OBSOLETE_DEFAULT_COMMON && kotlinCustomSettings == KOTLIN_OBSOLETE_DEFAULT_CUSTOM) { - return paired(IDEA_OBSOLETE_KOTLIN, isProject) - } - - if (kotlinCommonSettings == KOTLIN_DEFAULT_COMMON && kotlinCustomSettings == KOTLIN_DEFAULT_CUSTOM) { - return paired(IDEA_KOTLIN, isProject) - } - - val isKotlinOfficialLikeSettings = settings == settings.clone().also { - KotlinStyleGuideCodeStyle.apply(it) - } - if (isKotlinOfficialLikeSettings) { - return paired(IDEA_OFFICIAL_KOTLIN_WITH_CUSTOM, isProject) - } - - val isKotlinObsoleteLikeSettings = settings == settings.clone().also { - KotlinObsoleteCodeStyle.apply(it) - } - if (isKotlinObsoleteLikeSettings) { - return paired(IDEA_KOTLIN_WITH_CUSTOM, isProject) - } - - return paired(IDEA_CUSTOM, isProject) - } - - private fun paired(kind: KotlinFormatterKind, isProject: Boolean): KotlinFormatterKind { - if (!isProject) return kind - - return when (kind) { - IDEA_DEFAULT -> PROJECT_DEFAULT - IDEA_OFFICIAL_DEFAULT -> PROJECT_OFFICIAL_DEFAULT - IDEA_CUSTOM -> PROJECT_CUSTOM - IDEA_KOTLIN_WITH_CUSTOM -> PROJECT_KOTLIN_WITH_CUSTOM - IDEA_KOTLIN -> PROJECT_KOTLIN - IDEA_OBSOLETE_KOTLIN -> PROJECT_OBSOLETE_KOTLIN - IDEA_OFFICIAL_KOTLIN_WITH_CUSTOM -> PROJECT_OBSOLETE_KOTLIN_WITH_CUSTOM - else -> kind - } - } - } - - enum class KotlinFormatterKind { - IDEA_DEFAULT, - IDEA_CUSTOM, - IDEA_KOTLIN_WITH_CUSTOM, - IDEA_KOTLIN, - - PROJECT_DEFAULT, - PROJECT_CUSTOM, - PROJECT_KOTLIN_WITH_CUSTOM, - PROJECT_KOTLIN, - - IDEA_OFFICIAL_DEFAULT, - IDEA_OBSOLETE_KOTLIN, - IDEA_OFFICIAL_KOTLIN_WITH_CUSTOM, - PROJECT_OFFICIAL_DEFAULT, - PROJECT_OBSOLETE_KOTLIN, - PROJECT_OBSOLETE_KOTLIN_WITH_CUSTOM - } -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt.as40 b/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt.as40 deleted file mode 100644 index 4b7930ccf65..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt.as40 +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.highlighter.markers - -import com.intellij.icons.AllIcons -import javax.swing.Icon - -// FIX ME WHEN BUNCH as40 REMOVED -// FIX ME WHEN BUNCH as41 REMOVED -internal fun createDslStyleIcon(styleId: Int): Icon { - return AllIcons.Gutter.Colors -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/reporter/ITNReporterCompat.kt.as40 b/idea/src/org/jetbrains/kotlin/idea/reporter/ITNReporterCompat.kt.as40 deleted file mode 100644 index f6dcd38c87e..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/reporter/ITNReporterCompat.kt.as40 +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.reporter - -import com.intellij.diagnostic.ITNReporter -import com.intellij.openapi.diagnostic.IdeaLoggingEvent -import com.intellij.openapi.diagnostic.SubmittedReportInfo -import com.intellij.util.Consumer -import java.awt.Component - -abstract class ITNReporterCompat : ITNReporter() { - final override fun submit( - events: Array, - additionalInfo: String?, - parentComponent: Component?, - consumer: Consumer - ): Boolean { - return submitCompat(events, additionalInfo, parentComponent, consumer) - } - - open fun submitCompat( - events: Array, - additionalInfo: String?, - parentComponent: Component?, - consumer: Consumer - ): Boolean { - @Suppress("IncompatibleAPI") - return super.submit(events, additionalInfo, parentComponent, consumer) - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt.as40 b/idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt.as40 deleted file mode 100644 index dace666ba76..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt.as40 +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -@file:Suppress("DEPRECATION") - -package org.jetbrains.kotlin.idea - -import com.intellij.featureStatistics.FeatureStatisticsBundleProvider -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.extensions.Extensions - -private const val CIDR_FEATURE_STATISTICS_PROVIDER_FQNAME = "com.jetbrains.cidr.lang.OCFeatureStatisticsBundleProvider" - -// Remove the function, when there's no dependency to cidr during running Kotlin tests. -fun registerAdditionalResourceBundleInTests() { - if (!ApplicationManager.getApplication().isUnitTestMode) { - return - } - - val isAlreadyRegistered = FeatureStatisticsBundleProvider.EP_NAME.extensions.any { provider -> - provider.javaClass.name == CIDR_FEATURE_STATISTICS_PROVIDER_FQNAME - } - if (isAlreadyRegistered) { - return - } - - val cidrFSBundleProviderClass = try { - Class.forName(CIDR_FEATURE_STATISTICS_PROVIDER_FQNAME) - } catch (_: ClassNotFoundException) { - return - } - - val cidrFSBundleProvider = cidrFSBundleProviderClass.newInstance() as FeatureStatisticsBundleProvider - - Extensions.getRootArea().getExtensionPoint(FeatureStatisticsBundleProvider.EP_NAME).registerExtension(cidrFSBundleProvider) -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/update/GooglePluginUpdateVerifier.kt.as40 b/idea/src/org/jetbrains/kotlin/idea/update/GooglePluginUpdateVerifier.kt.as40 deleted file mode 100644 index dc9c96c6175..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/update/GooglePluginUpdateVerifier.kt.as40 +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.update - -import com.intellij.ide.plugins.IdeaPluginDescriptor -import com.intellij.ide.plugins.PluginManagerCore -import com.intellij.ide.plugins.PluginNode -import com.intellij.openapi.diagnostic.Logger -import org.jetbrains.kotlin.idea.KotlinBundle -import org.jetbrains.kotlin.idea.util.isDev -import org.jetbrains.kotlin.idea.util.isEap -import java.io.IOException -import java.net.URL -import java.util.* -import javax.xml.bind.JAXBContext -import javax.xml.bind.JAXBException -import javax.xml.bind.annotation.* - -class GooglePluginUpdateVerifier : PluginUpdateVerifier() { - override val verifierName: String - get() = KotlinBundle.message("update.name.android.studio") - - // Verifies if a plugin can be installed in Android Studio 3.2+. - // Currently used only by KotlinPluginUpdater. - override fun verify(pluginDescriptor: IdeaPluginDescriptor): PluginVerifyResult? { - if (pluginDescriptor.pluginId.idString != KOTLIN_PLUGIN_ID) { - return null - } - - val version = pluginDescriptor.version - if (isEap(version) || isDev(version)) { - return PluginVerifyResult.accept() - } - - try { - val url = URL(METADATA_FILE_URL) - val stream = url.openStream() - val context = JAXBContext.newInstance(PluginCompatibility::class.java) - val unmarshaller = context.createUnmarshaller() - val pluginCompatibility = unmarshaller.unmarshal(stream) as PluginCompatibility - - val release = getRelease(pluginCompatibility) - ?: return PluginVerifyResult.decline(KotlinBundle.message("update.reason.text.no.verified.versions.for.this.build")) - - return if (release.plugins().any { KOTLIN_PLUGIN_ID == it.id && version == it.version }) - PluginVerifyResult.accept() - else - PluginVerifyResult.decline(KotlinBundle.message("update.reason.text.version.to.be.verified")) - } catch (e: Exception) { - LOG.info("Exception when verifying plugin ${pluginDescriptor.pluginId.idString} version $version", e) - return when (e) { - is IOException -> - PluginVerifyResult.decline(KotlinBundle.message("update.reason.text.unable.to.connect.to.compatibility.verification.repository")) - is JAXBException -> PluginVerifyResult.decline(KotlinBundle.message("update.reason.text.unable.to.parse.compatibility.verification.metadata")) - else -> PluginVerifyResult.decline( - KotlinBundle.message("update.reason.text.exception.during.verification", - e.message.toString() - ) - ) - } - } - } - - private fun getRelease(pluginCompatibility: PluginCompatibility): StudioRelease? { - for (studioRelease in pluginCompatibility.releases()) { - if (buildInRange(studioRelease.name, studioRelease.sinceBuild, studioRelease.untilBuild)) { - return studioRelease - } - } - return null - } - - private fun buildInRange(name: String?, sinceBuild: String?, untilBuild: String?): Boolean { - val descriptor = PluginNode() - descriptor.name = name - descriptor.sinceBuild = sinceBuild - descriptor.untilBuild = untilBuild - return PluginManagerCore.isCompatible(descriptor) - } - - companion object { - private const val KOTLIN_PLUGIN_ID = "org.jetbrains.kotlin" - private const val METADATA_FILE_URL = "https://dl.google.com/android/studio/plugins/compatibility.xml" - - private val LOG = Logger.getInstance(GooglePluginUpdateVerifier::class.java) - - private fun PluginCompatibility.releases() = studioRelease ?: emptyArray() - private fun StudioRelease.plugins() = ideaPlugin ?: emptyArray() - - @XmlRootElement(name = "plugin-compatibility") - @XmlAccessorType(XmlAccessType.FIELD) - class PluginCompatibility { - @XmlElement(name = "studio-release") - var studioRelease: Array? = null - - override fun toString(): String { - return "PluginCompatibility(studioRelease=${Arrays.toString(studioRelease)})" - } - } - - @XmlAccessorType(XmlAccessType.FIELD) - class StudioRelease { - @XmlAttribute(name = "until-build") - var untilBuild: String? = null - @XmlAttribute(name = "since-build") - var sinceBuild: String? = null - @XmlAttribute - var name: String? = null - @XmlAttribute - var channel: String? = null - - @XmlElement(name = "idea-plugin") - var ideaPlugin: Array? = null - - override fun toString(): String { - return "StudioRelease(" + - "untilBuild=$untilBuild, name=$name, ideaPlugin=${Arrays.toString(ideaPlugin)}, " + - "sinceBuild=$sinceBuild, channel=$channel" + - ")" - } - } - - @XmlAccessorType(XmlAccessType.FIELD) - class IdeaPlugin { - @XmlAttribute - var id: String? = null - @XmlAttribute - var sha256: String? = null - @XmlAttribute - var channel: String? = null - @XmlAttribute - var version: String? = null - - @XmlElement(name = "idea-version") - var ideaVersion: IdeaVersion? = null - - override fun toString(): String { - return "IdeaPlugin(id=$id, sha256=$sha256, ideaVersion=$ideaVersion, channel=$channel, version=$version)" - } - } - - @XmlAccessorType(XmlAccessType.FIELD) - class IdeaVersion { - @XmlAttribute(name = "until-build") - var untilBuild: String? = null - @XmlAttribute(name = "since-build") - var sinceBuild: String? = null - - override fun toString(): String { - return "IdeaVersion(untilBuild=$untilBuild, sinceBuild=$sinceBuild)" - } - } - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/update/verify.kt.as40 b/idea/src/org/jetbrains/kotlin/idea/update/verify.kt.as40 deleted file mode 100644 index 8ee62b0a17c..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/update/verify.kt.as40 +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.update - -import com.intellij.ide.plugins.IdeaPluginDescriptor -import com.intellij.openapi.util.registry.Registry -import org.jetbrains.kotlin.idea.PluginUpdateStatus - -// Do an additional verification with PluginUpdateVerifier. Enabled only in AS 3.2+ -fun verify(updateStatus: PluginUpdateStatus.Update): PluginUpdateStatus { - @Suppress("InvalidBundleOrProperty") - val pluginVerifierEnabled = Registry.`is`("kotlin.plugin.update.verifier.enabled", true) - if (!pluginVerifierEnabled) { - return updateStatus - } - - val pluginDescriptor: IdeaPluginDescriptor = updateStatus.pluginDescriptor - val pluginVerifiers = PluginUpdateVerifier.EP_NAME.extensions - - for (pluginVerifier in pluginVerifiers) { - val verifyResult = pluginVerifier.verify(pluginDescriptor) ?: continue - if (!verifyResult.verified) { - return PluginUpdateStatus.Unverified( - pluginVerifier.verifierName, - verifyResult.declineMessage, - updateStatus - ) - } - } - - return updateStatus -} \ No newline at end of file diff --git a/idea/testData/gradle/testRunConfigurations/kotlinJUnitSettings/src/test/kotlin/MyKotlinTest.kt.as40 b/idea/testData/gradle/testRunConfigurations/kotlinJUnitSettings/src/test/kotlin/MyKotlinTest.kt.as40 deleted file mode 100755 index 916ff6fe794..00000000000 --- a/idea/testData/gradle/testRunConfigurations/kotlinJUnitSettings/src/test/kotlin/MyKotlinTest.kt.as40 +++ /dev/null @@ -1,7 +0,0 @@ -import org.junit.Test - -class MyKotlinTest { - @Test - fun testA() { - } -} \ No newline at end of file diff --git a/idea/testData/gradle/testRunConfigurations/preferredConfigurations/src/test/kotlin/MyKotlinTest.kt.as40 b/idea/testData/gradle/testRunConfigurations/preferredConfigurations/src/test/kotlin/MyKotlinTest.kt.as40 deleted file mode 100755 index e5ec5c75062..00000000000 --- a/idea/testData/gradle/testRunConfigurations/preferredConfigurations/src/test/kotlin/MyKotlinTest.kt.as40 +++ /dev/null @@ -1,11 +0,0 @@ -import org.junit.Test - -class MyKotlinTest { - @Test - fun testA() { - } - - @Test - fun testB() { - } -} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/refactoring/InplaceRenameTest.kt.as40 b/idea/tests/org/jetbrains/kotlin/idea/refactoring/InplaceRenameTest.kt.as40 deleted file mode 100644 index e5c06e8f70e..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/refactoring/InplaceRenameTest.kt.as40 +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.refactoring - -import com.intellij.codeInsight.TargetElementUtil -import com.intellij.codeInsight.template.impl.TemplateManagerImpl -import com.intellij.openapi.actionSystem.CommonDataKeys -import com.intellij.openapi.actionSystem.impl.SimpleDataContext -import com.intellij.openapi.command.WriteCommandAction -import com.intellij.refactoring.BaseRefactoringProcessor -import com.intellij.refactoring.rename.inplace.VariableInplaceRenameHandler -import com.intellij.testFramework.LightPlatformCodeInsightTestCase -import com.intellij.testFramework.fixtures.CodeInsightTestUtil -import junit.framework.TestCase -import org.jetbrains.kotlin.idea.liveTemplates.setTemplateTestingCompat -import org.jetbrains.kotlin.idea.refactoring.rename.KotlinMemberInplaceRenameHandler -import org.jetbrains.kotlin.idea.refactoring.rename.KotlinVariableInplaceRenameHandler -import org.jetbrains.kotlin.idea.refactoring.rename.RenameKotlinImplicitLambdaParameter -import org.jetbrains.kotlin.idea.refactoring.rename.findElementForRename -import org.jetbrains.kotlin.idea.test.PluginTestCaseBase -import org.jetbrains.kotlin.psi.KtNameReferenceExpression -import org.jetbrains.kotlin.test.InTextDirectivesUtils -import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner -import org.junit.runner.RunWith -import kotlin.test.assertFalse -import kotlin.test.assertTrue - -@RunWith(JUnit3WithIdeaConfigurationRunner::class) -class InplaceRenameTest : LightPlatformCodeInsightTestCase() { - override fun isRunInWriteAction(): Boolean = false - override fun getTestDataPath(): String = PluginTestCaseBase.getTestDataPathBase() + "/refactoring/rename/inplace/" - - fun testLocalVal() { - doTestMemberInplaceRename("y") - } - - fun testForLoop() { - doTestInplaceRename("j") - } - - fun testTryCatch() { - doTestInplaceRename("e1") - } - - fun testFunctionLiteral() { - doTestInplaceRename("y") - } - - fun testFunctionLiteralIt() { - doTestImplicitLambdaParameter("y") - } - - fun testFunctionLiteralItEndCaret() { - doTestImplicitLambdaParameter("y") - } - - fun testFunctionLiteralParenthesis() { - doTestInplaceRename("y") - } - - fun testLocalFunction() { - doTestMemberInplaceRename("bar") - } - - fun testFunctionParameterNotInplace() { - doTestInplaceRename(null) - } - - fun testGlobalFunctionNotInplace() { - doTestInplaceRename(null) - } - - fun testTopLevelValNotInplace() { - doTestInplaceRename(null) - } - - fun testLabelFromFunction() { - doTestMemberInplaceRename("foo") - } - - fun testMultiDeclaration() { - doTestInplaceRename("foo") - } - - fun testLocalVarShadowingMemberProperty() { - doTestMemberInplaceRename("name1") - } - - fun testNoReformat() { - doTestMemberInplaceRename("subject2") - } - - fun testInvokeToFoo() { - doTestMemberInplaceRename("foo") - } - - fun testInvokeToGet() { - doTestMemberInplaceRename("get") - } - - fun testInvokeToGetWithQualifiedExpr() { - doTestMemberInplaceRename("get") - } - - fun testInvokeToGetWithSafeQualifiedExpr() { - doTestMemberInplaceRename("get") - } - - fun testInvokeToPlus() { - doTestMemberInplaceRename("plus") - } - - fun testGetToFoo() { - doTestMemberInplaceRename("foo") - } - - fun testGetToInvoke() { - doTestMemberInplaceRename("invoke") - } - - fun testGetToInvokeWithQualifiedExpr() { - doTestMemberInplaceRename("invoke") - } - - fun testGetToInvokeWithSafeQualifiedExpr() { - doTestMemberInplaceRename("invoke") - } - - fun testGetToPlus() { - doTestMemberInplaceRename("plus") - } - - fun testAddQuotes() { - doTestMemberInplaceRename("is") - } - - fun testAddThis() { - doTestMemberInplaceRename("foo") - } - - fun testExtensionAndNoReceiver() { - doTestMemberInplaceRename("b") - } - - fun testTwoExtensions() { - doTestMemberInplaceRename("example") - } - - fun testQuotedLocalVar() { - doTestMemberInplaceRename("x") - } - - fun testQuotedParameter() { - doTestMemberInplaceRename("x") - } - - fun testEraseCompanionName() { - doTestMemberInplaceRename("") - } - - fun testLocalVarRedeclaration() { - doTestMemberInplaceRename("localValB") - } - - fun testLocalFunRedeclaration() { - doTestMemberInplaceRename("localFunB") - } - - fun testLocalClassRedeclaration() { - doTestMemberInplaceRename("LocalClassB") - } - - fun testBacktickedWithAccessors() { - doTestMemberInplaceRename("`object`") - } - - fun testNoTextUsagesForLocalVar() { - doTestMemberInplaceRename("w") - } - - private fun doTestImplicitLambdaParameter(newName: String) { - configureByFile(getTestName(false) + ".kt") - - // This code is copy-pasted from CodeInsightTestUtil.doInlineRename() and slightly modified. - // Original method was not suitable because it expects renamed element to be reference to other or referrable - - val file = getFile()!! - val editor = getEditor()!! - val element = file.findElementForRename(editor.caretModel.offset)!! - assertNotNull(element) - - val dataContext = SimpleDataContext.getSimpleContext( - CommonDataKeys.PSI_ELEMENT.name, element, - getCurrentEditorDataContext() - ) - val handler = RenameKotlinImplicitLambdaParameter() - - assertTrue(handler.isRenaming(dataContext), "In-place rename not allowed for " + element) - - val project = editor.project!! - - setTemplateTestingCompat(project, testRootDisposable) - - object : WriteCommandAction.Simple(project) { - override fun run() { - handler.invoke(project, editor, file, dataContext) - } - }.execute() - - var state = TemplateManagerImpl.getTemplateState(editor) - assert(state != null) - val range = state!!.currentVariableRange - assert(range != null) - object : WriteCommandAction.Simple(project) { - override fun run() { - editor.document.replaceString(range!!.startOffset, range.endOffset, newName) - } - }.execute().throwException() - - state = TemplateManagerImpl.getTemplateState(editor) - assert(state != null) - state!!.gotoEnd(false) - - checkResultByFile(getTestName(false) + ".kt.after") - } - - private fun doTestMemberInplaceRename(newName: String?) { - doTestInplaceRename(newName, KotlinMemberInplaceRenameHandler()) - } - - private fun doTestInplaceRename(newName: String?, handler: VariableInplaceRenameHandler = KotlinVariableInplaceRenameHandler()) { - configureByFile(getTestName(false) + ".kt") - val element = TargetElementUtil.findTargetElement( - editor, - TargetElementUtil.ELEMENT_NAME_ACCEPTED or TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED - ) - - assertNotNull(element) - - val dataContext = SimpleDataContext.getSimpleContext(CommonDataKeys.PSI_ELEMENT.name, element!!, currentEditorDataContext) - - if (newName == null) { - assertFalse(handler.isRenaming(dataContext), "In-place rename is allowed for " + element) - } else { - try { - assertTrue(handler.isRenaming(dataContext), "In-place rename not allowed for " + element) - CodeInsightTestUtil.doInlineRename(handler, newName, getEditor(), element) - checkResultByFile(getTestName(false) + ".kt.after") - } catch (e: BaseRefactoringProcessor.ConflictsInTestsException) { - val expectedMessage = InTextDirectivesUtils.findStringWithPrefixes(file.text, "// SHOULD_FAIL_WITH: ") - TestCase.assertEquals(expectedMessage, e.messages.joinToString()) - } - } - } -} diff --git a/jps-plugin/src/org/jetbrains/kotlin/jps/build/ideaPlatform.kt.as40 b/jps-plugin/src/org/jetbrains/kotlin/jps/build/ideaPlatform.kt.as40 deleted file mode 100644 index 6546b2059d2..00000000000 --- a/jps-plugin/src/org/jetbrains/kotlin/jps/build/ideaPlatform.kt.as40 +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.jps.build - -import org.jetbrains.jps.incremental.CompileContext -import org.jetbrains.jps.incremental.messages.CompilerMessage - -fun jpsReportInternalBuilderError(context: CompileContext, error: Throwable) { - KotlinBuilder.LOG.info(error) -} \ No newline at end of file diff --git a/plugins/allopen/allopen-ide/src/AllOpenMavenProjectImportHandler.kt.as40 b/plugins/allopen/allopen-ide/src/AllOpenMavenProjectImportHandler.kt.as40 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/annotation-based-compiler-plugins-ide-support/src/AbstractMavenImportHandler.kt.as40 b/plugins/annotation-based-compiler-plugins-ide-support/src/AbstractMavenImportHandler.kt.as40 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/kotlin-serialization/kotlin-serialization-ide/src/org/jetbrains/kotlinx/serialization/idea/KotlinSerializationMavenImportHandler.kt.as40 b/plugins/kotlin-serialization/kotlin-serialization-ide/src/org/jetbrains/kotlinx/serialization/idea/KotlinSerializationMavenImportHandler.kt.as40 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/noarg/noarg-ide/src/NoArgMavenProjectImportHandler.kt.as40 b/plugins/noarg/noarg-ide/src/NoArgMavenProjectImportHandler.kt.as40 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/sam-with-receiver/sam-with-receiver-ide/src/SamWithReceiverMavenProjectImportHandler.kt.as40 b/plugins/sam-with-receiver/sam-with-receiver-ide/src/SamWithReceiverMavenProjectImportHandler.kt.as40 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/mute-platform.csv.as40 b/tests/mute-platform.csv.as40 deleted file mode 100644 index cd62f7dc2d5..00000000000 --- a/tests/mute-platform.csv.as40 +++ /dev/null @@ -1,81 +0,0 @@ -Test key, Issue, State (optional: MUTE or FAIL), Status (optional: FLAKY) -org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.simpleAndroidAppWithCommonModule, KT-35225,, -org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testTransitiveImplementWithAndroid, KT-35225,, -org.jetbrains.kotlin.idea.caches.resolve.MultiModuleLineMarkerTestGenerated.testKotlinTestAnnotations, No line markers for test run,, -org.jetbrains.kotlin.idea.codeInsight.InspectionTestGenerated.Inspections.testAndroidIllegalIdentifiers_inspectionData_Inspections_test, Unprocessed,, -org.jetbrains.kotlin.idea.codeInsight.gradle.GradleFacetImportTest.testAndroidGradleJsDetection, NPE during import,, -org.jetbrains.kotlin.idea.codeInsight.gradle.GradleFacetImportTest.testKotlinAndroidPluginDetection, NPE during import,, -org.jetbrains.kotlin.idea.codeInsight.gradle.GradleKtsImportTest.testCompositeBuild[0: with Gradle-6.0.1], flaky on windows,, FLAKY -org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Order.testTwoClasses,,, FLAKY -org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Order.testValAndClass,,, FLAKY -org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Order.testValOrder,,, FLAKY -org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Val.testValWithTypeWoInitializer,,, FLAKY -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Common.StaticMembers.testJavaStaticMethodsFromImports, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.BoldOrGrayed.testNonPredictableSmartCast1, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.BoldOrGrayed.testNonPredictableSmartCast2, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.BoldOrGrayed.testSyntheticJavaProperties1, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.BoldOrGrayed.testSyntheticJavaProperties2, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.SyntheticExtensions.testNullableReceiver, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.SyntheticExtensions.testSafeCall, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.SyntheticExtensions.testSmartCast, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.SyntheticExtensions.testSmartCast2, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.SyntheticExtensions.testSyntheticExtensions1, KT-32919,, -org.jetbrains.kotlin.idea.filters.KotlinExceptionFilterTestGenerated.testInlineFunCallInLibrary, Unprocessed,, -org.jetbrains.kotlin.idea.filters.KotlinExceptionFilterTestGenerated.testInlineFunInnerClassFromLibrary, Unprocessed,, -org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testCoroutineContextCheck, KT-34659,, -org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testDispatchersTypeDetection, KT-34659,, -org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testLambdaReceiverType, KT-34659,, -org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testNestedFunctionsInsideSuspendLambda, KT-34659,, -org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testSimpleCoroutineScope, KT-34659,, -org.jetbrains.kotlin.idea.inspections.LocalInspectionTestGenerated.RedundantRequireNotNullCall.testUsedAsExpression, KT-34672, FAIL, -org.jetbrains.kotlin.idea.inspections.LocalInspectionTestGenerated.RedundantRequireNotNullCall.testUsedAsExpression2, KT-34672, FAIL, -org.jetbrains.kotlin.idea.inspections.LocalInspectionTestGenerated.RedundantRequireNotNullCall.testUsedAsExpression3, KT-34672, FAIL, -org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertFunctionTypeParameterToReceiver.testNonFirstParameterPrimaryConstructor, flaky failure on ConvertFunctionTypeParameterToReceiver rerun,, FLAKY -org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertFunctionTypeParameterToReceiver.testNonFirstParameterSecondaryConstructor, flaky failure on ConvertFunctionTypeParameterToReceiver rerun,, FLAKY -org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertSealedClassToEnum.testInstancesOnly, Generated entries reordered,, FLAKY -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testBlankLineBetween, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testLongInit, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testLongInit2, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testPropertyWithAnnotation, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInit, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInit2, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithBackticks, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithBackticks2, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithBackticks3, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithComments, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithComments2, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithSemicolons, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithSemicolons2, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithSemicolons3, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithType, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithType2, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.NestedIfs.testBlockBody, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveBraces.testFunctionWithOneLineReturn, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveBraces.testIf, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveBraces.testNotSingleLineStatement, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveBraces.testWhenEntry, KT-34408,, -org.jetbrains.kotlin.idea.navigation.KotlinGotoImplementationMultiModuleTestGenerated.testExpectClassSuperclassFun,,, FLAKY -org.jetbrains.kotlin.idea.parameterInfo.ParameterInfoTestGenerated.WithLib1.testUseJavaFromLib, KT-34542, FAIL, -org.jetbrains.kotlin.idea.parameterInfo.ParameterInfoTestGenerated.WithLib2.testUseJavaSAMFromLib, KT-34542, FAIL, -org.jetbrains.kotlin.idea.parameterInfo.ParameterInfoTestGenerated.WithLib3.testUseJavaSAMFromLib, KT-34542, FAIL, -org.jetbrains.kotlin.idea.quickfix.QuickFixMultiFileTestGenerated.ChangeSignature.Jk.testJkKeepValOnParameterTypeChange, Unprocessed,, -org.jetbrains.kotlin.idea.quickfix.QuickFixMultiModuleTestGenerated.Other.testConvertActualSealedClassToEnum, Enum reorder,, -org.jetbrains.kotlin.idea.quickfix.QuickFixMultiModuleTestGenerated.Other.testConvertExpectSealedClassToEnum, Enum reorder,, -org.jetbrains.kotlin.idea.refactoring.inline.InlineTestGenerated.Function.ExpressionBody.testMultipleInExpression, Unstable order of usages,,FLAKY -org.jetbrains.kotlin.idea.refactoring.introduce.ExtractionTestGenerated.IntroduceJavaParameter.testJavaMethodOverridingKotlinFunctionWithUsages, Unprocessed,, FLAKY -org.jetbrains.kotlin.idea.refactoring.move.MoveTestGenerated.testJava_moveClass_moveInnerToTop_moveNestedClassToTopLevelInTheSamePackageAndAddOuterInstanceWithLambda_MoveNestedClassToTopLevelInTheSamePackageAndAddOuterInstanceWithLambda, final modifier added,, -org.jetbrains.kotlin.idea.refactoring.move.MoveTestGenerated.testJava_moveClass_moveInnerToTop_moveNestedClassToTopLevelInTheSamePackageAndAddOuterInstance_MoveNestedClassToTopLevelInTheSamePackageAndAddOuterInstance, final modifier added,, -org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertSealedClassToEnum.testWithNonObjectInheritors, Enum reorder,, FLAKY -org.jetbrains.kotlin.idea.refactoring.pullUp.PullUpTestGenerated.K2K.testAccidentalOverrides, Unprocessed,, FLAKY -org.jetbrains.kotlin.idea.refactoring.rename.RenameTestGenerated.testOverloadsWithSameOrigin_OverloadsWithSameOrigin, Bad imports after rename,, FLAKY -org.jetbrains.uast.test.kotlin.KotlinUastReferencesTest.`test original getter is visible when reference is under renaming`, Extensions API changed,, -org.jetbrains.kotlin.idea.codeInsight.gradle.GradleKtsImportTest.testError[0: with Gradle-6.0.1], KT-37864,, -org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Var.testVarWithTypeWoInitializer, Unprocessed,, FLAKY -org.jetbrains.kotlin.idea.refactoring.move.MoveTestGenerated.testKotlin_moveTopLevelDeclarations_moveFunctionToPackage_MoveFunctionToPackage, fail on TeamCity but works well locally,, FLAKY -org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertSealedClassToEnum.testInstancesAndMembers, Enum reorder,, FLAKY -org.jetbrains.kotlin.idea.debugger.test.KotlinSteppingTestGenerated.Custom.testFunctionBreakpointInStdlib, Unprocessed,, -"org.jetbrains.kotlin.ide.konan.gradle.GradleNativeLibrariesInIDENamingTest.testLibrariesNaming[0: with Gradle-4.10.2]", Old IDE with new plugin problem,, -org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testChangeInsideNonKtsFileInvalidatesOtherFiles, Unprocessed,, -org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testTwoFilesChanged, Unprocessed,, -org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testLoadedConfigurationWhenExternalFileChanged, Unprocessed,, -org.jetbrains.kotlin.idea.debugger.test.IrKotlinSteppingTestGenerated.Custom.testFunctionBreakpointInStdlib,,, \ No newline at end of file From ad953b6285a04ef7bab8f5e7f7c8b3d3f668ff64 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Fri, 20 Nov 2020 11:37:32 +0300 Subject: [PATCH 299/698] Build: remove redundant bunch TODO's --- .../jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt | 3 +-- .../kotlin/idea/highlighter/markers/dslStyleIcon.kt.as41 | 3 +-- idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt b/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt index 324c8d2ad84..0dbc4cae3bb 100644 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt +++ b/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt @@ -14,7 +14,6 @@ import org.jetbrains.kotlin.idea.KotlinIcons import org.jetbrains.kotlin.idea.highlighter.dsl.DslHighlighterExtension import javax.swing.Icon -// FIX ME WHEN BUNCH as40 REMOVED // FIX ME WHEN BUNCH as41 REMOVED internal fun createDslStyleIcon(styleId: Int): Icon { val globalScheme = EditorColorsManager.getInstance().globalScheme @@ -29,4 +28,4 @@ internal fun createDslStyleIcon(styleId: Int): Icon { defaultIcon.iconWidth / 2 ) return icon -} \ No newline at end of file +} diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt.as41 b/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt.as41 index 4b7930ccf65..f337f4c472a 100644 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt.as41 +++ b/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt.as41 @@ -8,8 +8,7 @@ package org.jetbrains.kotlin.idea.highlighter.markers import com.intellij.icons.AllIcons import javax.swing.Icon -// FIX ME WHEN BUNCH as40 REMOVED // FIX ME WHEN BUNCH as41 REMOVED internal fun createDslStyleIcon(styleId: Int): Icon { return AllIcons.Gutter.Colors -} \ No newline at end of file +} diff --git a/idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt b/idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt index f5cc9057ee3..0a8095a4e69 100644 --- a/idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt +++ b/idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt @@ -6,7 +6,6 @@ package org.jetbrains.kotlin.idea // Remove the function, when there's no dependency to cidr during running Kotlin tests. -// FIX ME WHEN BUNCH as40 REMOVED // FIX ME WHEN BUNCH as41 REMOVED fun registerAdditionalResourceBundleInTests() { -} \ No newline at end of file +} From bf1abed246758cd14086d4431f69606761bc274e Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Fri, 20 Nov 2020 15:46:34 +0300 Subject: [PATCH 300/698] Build: add shadowing processor for core.xml in embeddable compiler --- .../compiler/KotlinCoreEnvironment.kt.as42 | 2 +- prepare/compiler-embeddable/build.gradle.kts | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt.as42 b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt.as42 index b1fc1f6e4c3..b41f8d46e03 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt.as42 +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt.as42 @@ -686,4 +686,4 @@ class KotlinCoreEnvironment private constructor( } } } -} \ No newline at end of file +} diff --git a/prepare/compiler-embeddable/build.gradle.kts b/prepare/compiler-embeddable/build.gradle.kts index 496cc24eea3..4b1fb351605 100644 --- a/prepare/compiler-embeddable/build.gradle.kts +++ b/prepare/compiler-embeddable/build.gradle.kts @@ -1,3 +1,8 @@ +import java.util.stream.Collectors +import com.github.jengelman.gradle.plugins.shadow.transformers.Transformer +import com.github.jengelman.gradle.plugins.shadow.transformers.TransformerContext +import shadow.org.apache.tools.zip.ZipEntry +import shadow.org.apache.tools.zip.ZipOutputStream description = "Kotlin Compiler (embeddable)" @@ -40,10 +45,42 @@ compilerDummyJar(compilerDummyForDependenciesRewriting("compilerDummy") { classifier = "dummy" }) +class CoreXmlShadingTransformer : Transformer { + companion object { + private const val XML_NAME = "META-INF/extensions/core.xml" + } + + private val content = StringBuilder() + + override fun canTransformResource(element: FileTreeElement): Boolean { + return (element.name == XML_NAME) + } + + override fun transform(context: TransformerContext) { + val text = context.`is`.bufferedReader().lines() + .map { it.replace("com.intellij.psi", "org.jetbrains.kotlin.com.intellij.psi") } + .collect(Collectors.joining("\n")) + content.appendln(text) + context.`is`.close() + } + + override fun hasTransformedResource(): Boolean { + return content.isNotEmpty() + } + + override fun modifyOutputStream(outputStream: ZipOutputStream, preserveFileTimestamps: Boolean) { + val entry = ZipEntry(XML_NAME) + outputStream.putNextEntry(entry) + outputStream.write(content.toString().toByteArray()) + } +} + val runtimeJar = runtimeJar(embeddableCompiler()) { exclude("com/sun/jna/**") exclude("org/jetbrains/annotations/**") mergeServiceFiles() + + transform(CoreXmlShadingTransformer::class.java) } sourcesJar() From 02f71a63b8f7a16636076e09557161137de562e2 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Mon, 23 Nov 2020 10:46:38 +0300 Subject: [PATCH 301/698] [FE] Disable `SKIP_DEBUG` flag when building java model from binaries This is needed to avoid skipping jvm annotations with names of function parameters --- .../load/java/structure/impl/classFiles/BinaryJavaClass.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/BinaryJavaClass.kt b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/BinaryJavaClass.kt index 243a4b4fa94..dba70a0a5bc 100644 --- a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/BinaryJavaClass.kt +++ b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/BinaryJavaClass.kt @@ -77,7 +77,7 @@ class BinaryJavaClass( try { ClassReader(classContent ?: virtualFile.contentsToByteArray()).accept( this, - ClassReader.SKIP_CODE or ClassReader.SKIP_DEBUG or ClassReader.SKIP_FRAMES + ClassReader.SKIP_CODE or ClassReader.SKIP_FRAMES ) } catch (e: Throwable) { throw IllegalStateException("Could not read class: $virtualFile", e) From 95e5ea484061c2d342aac517630042d761a77b50 Mon Sep 17 00:00:00 2001 From: Vladimir Dolzhenko Date: Tue, 24 Nov 2020 13:13:30 +0100 Subject: [PATCH 302/698] temporary ignore/disable tests --- .../idea/configuration/AbstractConfigureKotlinTest.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt b/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt index ca559548588..46c7584068c 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt @@ -19,6 +19,7 @@ import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess import com.intellij.testFramework.PlatformTestCase import com.intellij.testFramework.UsefulTestCase import junit.framework.TestCase +import junit.framework.TestResult import org.jetbrains.kotlin.idea.configuration.KotlinWithLibraryConfigurator.FileState import org.jetbrains.kotlin.idea.framework.KotlinSdkType import org.jetbrains.kotlin.idea.test.PluginTestCaseBase.* @@ -37,6 +38,11 @@ abstract class AbstractConfigureKotlinTest : PlatformTestCase() { VfsRootAccess.allowRootAccess(KotlinTestUtils.getHomeDirectory()) } + override fun run(result: TestResult?) { + // TODO: [VD] temporary ignore/disable these tests + // super.run(result) + } + @Throws(Exception::class) override fun tearDown() { VfsRootAccess.disallowRootAccess(KotlinTestUtils.getHomeDirectory()) From dc364b8be487622dc0cd351fa2eac333decbd257 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Tue, 24 Nov 2020 16:58:27 +0300 Subject: [PATCH 303/698] Remove useless @author comment --- .../kotlin/test/testFramework/KtUsefulTestCase.java | 5 +---- .../kotlin/test/testFramework/KtUsefulTestCase.java.203 | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java index 21f6510293e..ced8e97be6d 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java @@ -82,9 +82,6 @@ import java.util.*; import java.util.concurrent.TimeUnit; import java.util.function.Supplier; -/** - * @author peter - */ @SuppressWarnings("ALL") public abstract class KtUsefulTestCase extends TestCase { public static final boolean IS_UNDER_TEAMCITY = System.getenv("TEAMCITY_VERSION") != null; @@ -1186,4 +1183,4 @@ public abstract class KtUsefulTestCase extends TestCase { return KtUsefulTestCase.this.getClass() + (StringUtil.isEmpty(testName) ? "" : ".test" + testName); } } -} \ No newline at end of file +} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.203 b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.203 index 500d4165d8b..4d51c3383b7 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.203 +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.203 @@ -71,9 +71,6 @@ import java.util.*; import java.util.concurrent.TimeUnit; import java.util.function.Supplier; -/** - * @author peter - */ @SuppressWarnings("ALL") public abstract class KtUsefulTestCase extends TestCase { public static final boolean IS_UNDER_TEAMCITY = System.getenv("TEAMCITY_VERSION") != null; @@ -1175,4 +1172,4 @@ public abstract class KtUsefulTestCase extends TestCase { return KtUsefulTestCase.this.getClass() + (StringUtil.isEmpty(testName) ? "" : ".test" + testName); } } -} \ No newline at end of file +} From 406e863a73e7dc626f88358b7e6d89cf6ff2fbd0 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Tue, 24 Nov 2020 17:25:36 +0300 Subject: [PATCH 304/698] [FE] Fix creating location of compiler errors in CLI --- .../messages/DefaultDiagnosticReporter.kt | 2 +- .../messages/DefaultDiagnosticReporter.kt.201 | 36 ----------- .../cli/common/messages/MessageUtil.java | 12 ++-- .../cli/common/messages/MessageUtil.java.201 | 62 ------------------- 4 files changed, 8 insertions(+), 104 deletions(-) delete mode 100644 compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt.201 delete mode 100644 compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/MessageUtil.java.201 diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt index f560fc945f3..2d82644bf95 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt @@ -31,6 +31,6 @@ interface MessageCollectorBasedReporter : DiagnosticMessageReporter { override fun report(diagnostic: Diagnostic, file: PsiFile, render: String) = messageCollector.report( AnalyzerWithCompilerReport.convertSeverity(diagnostic.severity), render, - MessageUtil.psiFileToMessageLocation(file, file.name, DiagnosticUtils.getLineAndColumn(diagnostic)) + MessageUtil.psiFileToMessageLocation(file, file.name, DiagnosticUtils.getLineAndColumnRange(diagnostic)) ) } diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt.201 b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt.201 deleted file mode 100644 index 2d82644bf95..00000000000 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/DefaultDiagnosticReporter.kt.201 +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.cli.common.messages - -import com.intellij.psi.PsiFile -import org.jetbrains.kotlin.diagnostics.Diagnostic -import org.jetbrains.kotlin.diagnostics.DiagnosticUtils - -/** - * This class behaviour is the same as [MessageCollector.report] in [AnalyzerWithCompilerReport.reportDiagnostic]. - */ -class DefaultDiagnosticReporter(override val messageCollector: MessageCollector) : MessageCollectorBasedReporter - -interface MessageCollectorBasedReporter : DiagnosticMessageReporter { - val messageCollector: MessageCollector - - override fun report(diagnostic: Diagnostic, file: PsiFile, render: String) = messageCollector.report( - AnalyzerWithCompilerReport.convertSeverity(diagnostic.severity), - render, - MessageUtil.psiFileToMessageLocation(file, file.name, DiagnosticUtils.getLineAndColumnRange(diagnostic)) - ) -} diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/MessageUtil.java b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/MessageUtil.java index 2ac1c17091e..7fc813fab34 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/MessageUtil.java +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/MessageUtil.java @@ -30,21 +30,23 @@ public class MessageUtil { private MessageUtil() {} @Nullable - public static CompilerMessageLocation psiElementToMessageLocation(@Nullable PsiElement element) { + public static CompilerMessageSourceLocation psiElementToMessageLocation(@Nullable PsiElement element) { if (element == null) return null; PsiFile file = element.getContainingFile(); - return psiFileToMessageLocation(file, "", DiagnosticUtils.getLineAndColumnInPsiFile(file, element.getTextRange())); + return psiFileToMessageLocation(file, "", DiagnosticUtils.getLineAndColumnRangeInPsiFile(file, element.getTextRange())); } @Nullable - public static CompilerMessageLocation psiFileToMessageLocation( + public static CompilerMessageSourceLocation psiFileToMessageLocation( @NotNull PsiFile file, @Nullable String defaultValue, - @NotNull PsiDiagnosticUtils.LineAndColumn lineAndColumn + @NotNull PsiDiagnosticUtils.LineAndColumnRange range ) { VirtualFile virtualFile = file.getVirtualFile(); String path = virtualFile != null ? virtualFileToPath(virtualFile) : defaultValue; - return CompilerMessageLocation.create(path, lineAndColumn.getLine(), lineAndColumn.getColumn(), lineAndColumn.getLineContent()); + PsiDiagnosticUtils.LineAndColumn start = range.getStart(); + PsiDiagnosticUtils.LineAndColumn end = range.getEnd(); + return CompilerMessageLocationWithRange.create(path, start.getLine(), start.getColumn(), end.getLine(), end.getColumn(), start.getLineContent()); } @NotNull diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/MessageUtil.java.201 b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/MessageUtil.java.201 deleted file mode 100644 index 03f291ec68f..00000000000 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/MessageUtil.java.201 +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.cli.common.messages; - -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.openapi.vfs.impl.jar.CoreJarVirtualFile; -import com.intellij.openapi.vfs.local.CoreLocalVirtualFile; -import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiFile; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.diagnostics.DiagnosticUtils; -import org.jetbrains.kotlin.diagnostics.PsiDiagnosticUtils; - -import static com.intellij.openapi.util.io.FileUtil.toSystemDependentName; - -public class MessageUtil { - private MessageUtil() {} - - @Nullable - public static CompilerMessageSourceLocation psiElementToMessageLocation(@Nullable PsiElement element) { - if (element == null) return null; - PsiFile file = element.getContainingFile(); - return psiFileToMessageLocation(file, "", DiagnosticUtils.getLineAndColumnRangeInPsiFile(file, element.getTextRange())); - } - - @Nullable - public static CompilerMessageSourceLocation psiFileToMessageLocation( - @NotNull PsiFile file, - @Nullable String defaultValue, - @NotNull PsiDiagnosticUtils.LineAndColumnRange range - ) { - VirtualFile virtualFile = file.getVirtualFile(); - String path = virtualFile != null ? virtualFileToPath(virtualFile) : defaultValue; - PsiDiagnosticUtils.LineAndColumn start = range.getStart(); - PsiDiagnosticUtils.LineAndColumn end = range.getEnd(); - return CompilerMessageLocationWithRange.create(path, start.getLine(), start.getColumn(), end.getLine(), end.getColumn(), start.getLineContent()); - } - - @NotNull - public static String virtualFileToPath(@NotNull VirtualFile virtualFile) { - // Convert path to platform-dependent format when virtualFile is local file. - if (virtualFile instanceof CoreLocalVirtualFile || virtualFile instanceof CoreJarVirtualFile) { - return toSystemDependentName(virtualFile.getPath()); - } - return virtualFile.getPath(); - } -} From 17e6e88176cc04b98477766be5418a9c78021537 Mon Sep 17 00:00:00 2001 From: Vladimir Dolzhenko Date: Tue, 24 Nov 2020 16:07:12 +0100 Subject: [PATCH 305/698] Fixed AddFunctionParametersFix test data output --- .../jk/jkAddImplicitPrimaryConstructorParameter.after.java | 2 +- .../jkAddImplicitPrimaryConstructorParameter.before.Main.java | 2 +- .../jk/jkAddPrimaryConstructorParameter.after.java | 2 +- .../jk/jkAddPrimaryConstructorParameter.before.Main.java | 2 +- .../jk/jkAddSecondaryConstructorParameter.after.java | 2 +- .../jk/jkAddSecondaryConstructorParameter.before.Main.java | 2 +- .../jk/jkChangePrimaryConstructorParameter.after.java | 2 +- .../jk/jkChangePrimaryConstructorParameter.before.Main.java | 2 +- .../jk/jkChangeSecondaryConstructorParameter.after.java | 2 +- .../jk/jkChangeSecondaryConstructorParameter.before.Main.java | 2 +- .../changeSignature/jk/jkKeepValOnAddingParameter1.after.java | 2 +- .../jk/jkKeepValOnAddingParameter1.before.Main.java | 2 +- .../changeSignature/jk/jkKeepValOnAddingParameter2.after.java | 2 +- .../jk/jkKeepValOnAddingParameter2.before.Main.java | 2 +- .../jk/jkRemovePrimaryConstructorParameter.after.java | 2 +- .../jk/jkRemovePrimaryConstructorParameter.before.Main.java | 2 +- .../jk/jkRemoveSecondaryConstructorParameter.after.java | 2 +- .../jk/jkRemoveSecondaryConstructorParameter.before.Main.java | 2 +- .../kotlin/idea/quickfix/CommonIntentionActionsTest.kt | 4 ++-- 19 files changed, 20 insertions(+), 20 deletions(-) diff --git a/idea/testData/quickfix/changeSignature/jk/jkAddImplicitPrimaryConstructorParameter.after.java b/idea/testData/quickfix/changeSignature/jk/jkAddImplicitPrimaryConstructorParameter.after.java index 7d4eed9812d..0df04f1468e 100644 --- a/idea/testData/quickfix/changeSignature/jk/jkAddImplicitPrimaryConstructorParameter.after.java +++ b/idea/testData/quickfix/changeSignature/jk/jkAddImplicitPrimaryConstructorParameter.after.java @@ -1,4 +1,4 @@ -// "Add 'int' as 1st parameter to method 'K'" "true" +// "Add 'int' as 1st parameter to constructor 'K'" "true" public class J { void foo() { diff --git a/idea/testData/quickfix/changeSignature/jk/jkAddImplicitPrimaryConstructorParameter.before.Main.java b/idea/testData/quickfix/changeSignature/jk/jkAddImplicitPrimaryConstructorParameter.before.Main.java index bf76052dcb8..f8104ee0596 100644 --- a/idea/testData/quickfix/changeSignature/jk/jkAddImplicitPrimaryConstructorParameter.before.Main.java +++ b/idea/testData/quickfix/changeSignature/jk/jkAddImplicitPrimaryConstructorParameter.before.Main.java @@ -1,4 +1,4 @@ -// "Add 'int' as 1st parameter to method 'K'" "true" +// "Add 'int' as 1st parameter to constructor 'K'" "true" public class J { void foo() { diff --git a/idea/testData/quickfix/changeSignature/jk/jkAddPrimaryConstructorParameter.after.java b/idea/testData/quickfix/changeSignature/jk/jkAddPrimaryConstructorParameter.after.java index 7d4eed9812d..0df04f1468e 100644 --- a/idea/testData/quickfix/changeSignature/jk/jkAddPrimaryConstructorParameter.after.java +++ b/idea/testData/quickfix/changeSignature/jk/jkAddPrimaryConstructorParameter.after.java @@ -1,4 +1,4 @@ -// "Add 'int' as 1st parameter to method 'K'" "true" +// "Add 'int' as 1st parameter to constructor 'K'" "true" public class J { void foo() { diff --git a/idea/testData/quickfix/changeSignature/jk/jkAddPrimaryConstructorParameter.before.Main.java b/idea/testData/quickfix/changeSignature/jk/jkAddPrimaryConstructorParameter.before.Main.java index bf76052dcb8..f8104ee0596 100644 --- a/idea/testData/quickfix/changeSignature/jk/jkAddPrimaryConstructorParameter.before.Main.java +++ b/idea/testData/quickfix/changeSignature/jk/jkAddPrimaryConstructorParameter.before.Main.java @@ -1,4 +1,4 @@ -// "Add 'int' as 1st parameter to method 'K'" "true" +// "Add 'int' as 1st parameter to constructor 'K'" "true" public class J { void foo() { diff --git a/idea/testData/quickfix/changeSignature/jk/jkAddSecondaryConstructorParameter.after.java b/idea/testData/quickfix/changeSignature/jk/jkAddSecondaryConstructorParameter.after.java index 7d4eed9812d..0df04f1468e 100644 --- a/idea/testData/quickfix/changeSignature/jk/jkAddSecondaryConstructorParameter.after.java +++ b/idea/testData/quickfix/changeSignature/jk/jkAddSecondaryConstructorParameter.after.java @@ -1,4 +1,4 @@ -// "Add 'int' as 1st parameter to method 'K'" "true" +// "Add 'int' as 1st parameter to constructor 'K'" "true" public class J { void foo() { diff --git a/idea/testData/quickfix/changeSignature/jk/jkAddSecondaryConstructorParameter.before.Main.java b/idea/testData/quickfix/changeSignature/jk/jkAddSecondaryConstructorParameter.before.Main.java index bf76052dcb8..f8104ee0596 100644 --- a/idea/testData/quickfix/changeSignature/jk/jkAddSecondaryConstructorParameter.before.Main.java +++ b/idea/testData/quickfix/changeSignature/jk/jkAddSecondaryConstructorParameter.before.Main.java @@ -1,4 +1,4 @@ -// "Add 'int' as 1st parameter to method 'K'" "true" +// "Add 'int' as 1st parameter to constructor 'K'" "true" public class J { void foo() { diff --git a/idea/testData/quickfix/changeSignature/jk/jkChangePrimaryConstructorParameter.after.java b/idea/testData/quickfix/changeSignature/jk/jkChangePrimaryConstructorParameter.after.java index 5ce3da92778..d516a24e14d 100644 --- a/idea/testData/quickfix/changeSignature/jk/jkChangePrimaryConstructorParameter.after.java +++ b/idea/testData/quickfix/changeSignature/jk/jkChangePrimaryConstructorParameter.after.java @@ -1,4 +1,4 @@ -// "Change 2nd parameter of method 'K' from 'boolean' to 'String'" "true" +// "Change 2nd parameter of constructor 'K' from 'boolean' to 'String'" "true" public class J { void foo() { diff --git a/idea/testData/quickfix/changeSignature/jk/jkChangePrimaryConstructorParameter.before.Main.java b/idea/testData/quickfix/changeSignature/jk/jkChangePrimaryConstructorParameter.before.Main.java index 5ce3da92778..d516a24e14d 100644 --- a/idea/testData/quickfix/changeSignature/jk/jkChangePrimaryConstructorParameter.before.Main.java +++ b/idea/testData/quickfix/changeSignature/jk/jkChangePrimaryConstructorParameter.before.Main.java @@ -1,4 +1,4 @@ -// "Change 2nd parameter of method 'K' from 'boolean' to 'String'" "true" +// "Change 2nd parameter of constructor 'K' from 'boolean' to 'String'" "true" public class J { void foo() { diff --git a/idea/testData/quickfix/changeSignature/jk/jkChangeSecondaryConstructorParameter.after.java b/idea/testData/quickfix/changeSignature/jk/jkChangeSecondaryConstructorParameter.after.java index 5ce3da92778..d516a24e14d 100644 --- a/idea/testData/quickfix/changeSignature/jk/jkChangeSecondaryConstructorParameter.after.java +++ b/idea/testData/quickfix/changeSignature/jk/jkChangeSecondaryConstructorParameter.after.java @@ -1,4 +1,4 @@ -// "Change 2nd parameter of method 'K' from 'boolean' to 'String'" "true" +// "Change 2nd parameter of constructor 'K' from 'boolean' to 'String'" "true" public class J { void foo() { diff --git a/idea/testData/quickfix/changeSignature/jk/jkChangeSecondaryConstructorParameter.before.Main.java b/idea/testData/quickfix/changeSignature/jk/jkChangeSecondaryConstructorParameter.before.Main.java index 5ce3da92778..d516a24e14d 100644 --- a/idea/testData/quickfix/changeSignature/jk/jkChangeSecondaryConstructorParameter.before.Main.java +++ b/idea/testData/quickfix/changeSignature/jk/jkChangeSecondaryConstructorParameter.before.Main.java @@ -1,4 +1,4 @@ -// "Change 2nd parameter of method 'K' from 'boolean' to 'String'" "true" +// "Change 2nd parameter of constructor 'K' from 'boolean' to 'String'" "true" public class J { void foo() { diff --git a/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter1.after.java b/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter1.after.java index aeb5b60e0c7..1f965f8ae73 100644 --- a/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter1.after.java +++ b/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter1.after.java @@ -1,4 +1,4 @@ -// "Add 'int' as 1st parameter to method 'Foo'" "true" +// "Add 'int' as 1st parameter to constructor 'Foo'" "true" public class J { void test() { diff --git a/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter1.before.Main.java b/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter1.before.Main.java index aeb5b60e0c7..1f965f8ae73 100644 --- a/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter1.before.Main.java +++ b/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter1.before.Main.java @@ -1,4 +1,4 @@ -// "Add 'int' as 1st parameter to method 'Foo'" "true" +// "Add 'int' as 1st parameter to constructor 'Foo'" "true" public class J { void test() { diff --git a/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter2.after.java b/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter2.after.java index 74eb5b27f38..75e0c9e297b 100644 --- a/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter2.after.java +++ b/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter2.after.java @@ -1,4 +1,4 @@ -// "Add 'int' as 2nd parameter to method 'Foo'" "true" +// "Add 'int' as 2nd parameter to constructor 'Foo'" "true" public class J { void test() { diff --git a/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter2.before.Main.java b/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter2.before.Main.java index 74eb5b27f38..75e0c9e297b 100644 --- a/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter2.before.Main.java +++ b/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter2.before.Main.java @@ -1,4 +1,4 @@ -// "Add 'int' as 2nd parameter to method 'Foo'" "true" +// "Add 'int' as 2nd parameter to constructor 'Foo'" "true" public class J { void test() { diff --git a/idea/testData/quickfix/changeSignature/jk/jkRemovePrimaryConstructorParameter.after.java b/idea/testData/quickfix/changeSignature/jk/jkRemovePrimaryConstructorParameter.after.java index da2e824b7dd..97ef3fb8c11 100644 --- a/idea/testData/quickfix/changeSignature/jk/jkRemovePrimaryConstructorParameter.after.java +++ b/idea/testData/quickfix/changeSignature/jk/jkRemovePrimaryConstructorParameter.after.java @@ -1,4 +1,4 @@ -// "Remove 1st parameter from method 'K'" "true" +// "Remove 1st parameter from constructor 'K'" "true" public class J { void foo() { diff --git a/idea/testData/quickfix/changeSignature/jk/jkRemovePrimaryConstructorParameter.before.Main.java b/idea/testData/quickfix/changeSignature/jk/jkRemovePrimaryConstructorParameter.before.Main.java index da2e824b7dd..97ef3fb8c11 100644 --- a/idea/testData/quickfix/changeSignature/jk/jkRemovePrimaryConstructorParameter.before.Main.java +++ b/idea/testData/quickfix/changeSignature/jk/jkRemovePrimaryConstructorParameter.before.Main.java @@ -1,4 +1,4 @@ -// "Remove 1st parameter from method 'K'" "true" +// "Remove 1st parameter from constructor 'K'" "true" public class J { void foo() { diff --git a/idea/testData/quickfix/changeSignature/jk/jkRemoveSecondaryConstructorParameter.after.java b/idea/testData/quickfix/changeSignature/jk/jkRemoveSecondaryConstructorParameter.after.java index da2e824b7dd..97ef3fb8c11 100644 --- a/idea/testData/quickfix/changeSignature/jk/jkRemoveSecondaryConstructorParameter.after.java +++ b/idea/testData/quickfix/changeSignature/jk/jkRemoveSecondaryConstructorParameter.after.java @@ -1,4 +1,4 @@ -// "Remove 1st parameter from method 'K'" "true" +// "Remove 1st parameter from constructor 'K'" "true" public class J { void foo() { diff --git a/idea/testData/quickfix/changeSignature/jk/jkRemoveSecondaryConstructorParameter.before.Main.java b/idea/testData/quickfix/changeSignature/jk/jkRemoveSecondaryConstructorParameter.before.Main.java index da2e824b7dd..97ef3fb8c11 100644 --- a/idea/testData/quickfix/changeSignature/jk/jkRemoveSecondaryConstructorParameter.before.Main.java +++ b/idea/testData/quickfix/changeSignature/jk/jkRemoveSecondaryConstructorParameter.before.Main.java @@ -1,4 +1,4 @@ -// "Remove 1st parameter from method 'K'" "true" +// "Remove 1st parameter from constructor 'K'" "true" public class J { void foo() { diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/CommonIntentionActionsTest.kt b/idea/tests/org/jetbrains/kotlin/idea/quickfix/CommonIntentionActionsTest.kt index d27ea625de0..5dc3f1100de 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/CommonIntentionActionsTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/CommonIntentionActionsTest.kt @@ -497,7 +497,7 @@ class CommonIntentionActionsTest : LightPlatformCodeInsightFixtureTestCase() { createConstructorActions( myFixture.atCaret(), constructorRequest(project, listOf(pair("param0", PsiType.INT as PsiType))) - ).findWithText("Add 'int' as 1st parameter to method 'Foo'") + ).findWithText("Add 'int' as 1st parameter to constructor 'Foo'") ) myFixture.checkResult( """ @@ -519,7 +519,7 @@ class CommonIntentionActionsTest : LightPlatformCodeInsightFixtureTestCase() { createConstructorActions( myFixture.atCaret(), constructorRequest(project, emptyList()) - ).findWithText("Remove 1st parameter from method 'Foo'") + ).findWithText("Remove 1st parameter from constructor 'Foo'") ) myFixture.checkResult( """ From cc1a0bf6d7532798820c255e47175784f869624d Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Wed, 25 Nov 2020 12:29:50 +0300 Subject: [PATCH 306/698] [FE] Update testdata --- .../regressions/kt28385/output.txt | 6 ++--- .../regressions/kt28385/output.txt.201 | 22 ------------------- 2 files changed, 3 insertions(+), 25 deletions(-) delete mode 100644 compiler/testData/multiplatform/regressions/kt28385/output.txt.201 diff --git a/compiler/testData/multiplatform/regressions/kt28385/output.txt b/compiler/testData/multiplatform/regressions/kt28385/output.txt index 426962dee24..6d9721f5fde 100644 --- a/compiler/testData/multiplatform/regressions/kt28385/output.txt +++ b/compiler/testData/multiplatform/regressions/kt28385/output.txt @@ -12,11 +12,11 @@ compiler/testData/multiplatform/regressions/kt28385/jvm.kt:5:6: error: expecting sdax = { ^ compiler/testData/multiplatform/regressions/kt28385/jvm.kt:5:8: error: expecting a top level declaration -sdax = { - ^ -compiler/testData/multiplatform/regressions/kt28385/jvm.kt:5:8: error: function declaration must have a name sdax = { ^ compiler/testData/multiplatform/regressions/kt28385/jvm.kt:3:1: error: property must be initialized val dasda ^ +compiler/testData/multiplatform/regressions/kt28385/jvm.kt:5:8: error: function declaration must have a name +sdax = { + ^ diff --git a/compiler/testData/multiplatform/regressions/kt28385/output.txt.201 b/compiler/testData/multiplatform/regressions/kt28385/output.txt.201 deleted file mode 100644 index 6d9721f5fde..00000000000 --- a/compiler/testData/multiplatform/regressions/kt28385/output.txt.201 +++ /dev/null @@ -1,22 +0,0 @@ --- Common -- -Exit code: OK -Output: - --- JVM -- -Exit code: COMPILATION_ERROR -Output: -compiler/testData/multiplatform/regressions/kt28385/jvm.kt:5:1: error: expecting a top level declaration -sdax = { -^ -compiler/testData/multiplatform/regressions/kt28385/jvm.kt:5:6: error: expecting a top level declaration -sdax = { - ^ -compiler/testData/multiplatform/regressions/kt28385/jvm.kt:5:8: error: expecting a top level declaration -sdax = { - ^ -compiler/testData/multiplatform/regressions/kt28385/jvm.kt:3:1: error: property must be initialized -val dasda -^ -compiler/testData/multiplatform/regressions/kt28385/jvm.kt:5:8: error: function declaration must have a name -sdax = { - ^ From e251a9be14a91ff595f50f495e9c9c337c022ab0 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Wed, 25 Nov 2020 14:29:41 +0300 Subject: [PATCH 307/698] Build: fix finding layout-api jar in parcelize box test due to platform change --- .../kotlin/android/parcel/AbstractParcelBoxTest.kt | 8 ++++++-- .../kotlin/parcelize/test/AbstractParcelizeBoxTest.kt | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/android-extensions/android-extensions-compiler/test/org/jetbrains/kotlin/android/parcel/AbstractParcelBoxTest.kt b/plugins/android-extensions/android-extensions-compiler/test/org/jetbrains/kotlin/android/parcel/AbstractParcelBoxTest.kt index be080254098..3c0b124947c 100644 --- a/plugins/android-extensions/android-extensions-compiler/test/org/jetbrains/kotlin/android/parcel/AbstractParcelBoxTest.kt +++ b/plugins/android-extensions/android-extensions-compiler/test/org/jetbrains/kotlin/android/parcel/AbstractParcelBoxTest.kt @@ -28,20 +28,24 @@ abstract class AbstractParcelBoxTest : CodegenTestCase() { companion object { val LIBRARY_KT = File("plugins/android-extensions/android-extensions-compiler/testData/parcel/boxLib.kt") + private fun String.withoutAndroidPrefix(): String = removePrefix("studio.android.sdktools.") + private val androidPluginPath: String by lazy { System.getProperty("ideaSdk.androidPlugin.path")?.takeIf { File(it).isDirectory } ?: throw RuntimeException("Unable to get a valid path from 'ideaSdk.androidPlugin.path' property, please point it to the Idea android plugin location") } val layoutlibJar: File by lazy { - File(androidPluginPath).listFiles { _, name -> + File(androidPluginPath).listFiles { _, rawName -> + val name = rawName.withoutAndroidPrefix() name.startsWith("layoutlib-") && name.endsWith(".jar") && !name.startsWith("layoutlib-api-") && !name.startsWith("layoutlib-loader") }?.firstOrNull() ?: error("Unable to locate layoutlib jar in '$androidPluginPath'") } val layoutlibApiJar: File by lazy { - File(androidPluginPath).listFiles { _, name -> + File(androidPluginPath).listFiles { _, rawName -> + val name = rawName.withoutAndroidPrefix() name.startsWith("layoutlib-api-") && name.endsWith(".jar") }?.firstOrNull() ?: error("Unable to locate layoutlib-api jar in '$androidPluginPath'") } diff --git a/plugins/parcelize/parcelize-compiler/tests/org/jetbrains/kotlin/parcelize/test/AbstractParcelizeBoxTest.kt b/plugins/parcelize/parcelize-compiler/tests/org/jetbrains/kotlin/parcelize/test/AbstractParcelizeBoxTest.kt index de9cbee93aa..7df13884b2b 100644 --- a/plugins/parcelize/parcelize-compiler/tests/org/jetbrains/kotlin/parcelize/test/AbstractParcelizeBoxTest.kt +++ b/plugins/parcelize/parcelize-compiler/tests/org/jetbrains/kotlin/parcelize/test/AbstractParcelizeBoxTest.kt @@ -32,6 +32,7 @@ abstract class AbstractParcelizeIrBoxTest : AbstractParcelizeBoxTest() { abstract class AbstractParcelizeBoxTest : CodegenTestCase() { companion object { val LIBRARY_KT = File("plugins/parcelize/parcelize-compiler/testData/boxLib.kt") + private const val ANDROID_TOOLS_PREFIX = "studio.android.sdktools." private val androidPluginPath: String by lazy { System.getProperty("ideaSdk.androidPlugin.path")?.takeIf { File(it).isDirectory } @@ -39,7 +40,7 @@ abstract class AbstractParcelizeBoxTest : CodegenTestCase() { } private fun getLayoutLibFile(pattern: String): File { - val nameRegex = "^$pattern-[0-9\\.]+\\.jar$".toRegex() + val nameRegex = "^($ANDROID_TOOLS_PREFIX)?$pattern-[0-9\\.]+\\.jar$".toRegex() return File(androidPluginPath).listFiles().orEmpty().singleOrNull { it.name.matches(nameRegex) } ?: error("Can't find file for pattern $nameRegex in $androidPluginPath. " + "Available files: \n${File(androidPluginPath).list().orEmpty().asList()}") From 124888eb438e1a3d38214c400384222e15d3919d Mon Sep 17 00:00:00 2001 From: Vladimir Dolzhenko Date: Wed, 25 Nov 2020 15:41:56 +0100 Subject: [PATCH 308/698] Revert back AddFunctionParametersFix test data output for 201- --- ...PrimaryConstructorParameter.after.java.201 | 7 + ...yConstructorParameter.before.Main.java.201 | 7 + ...PrimaryConstructorParameter.after.java.201 | 7 + ...yConstructorParameter.before.Main.java.201 | 7 + ...condaryConstructorParameter.after.java.201 | 7 + ...yConstructorParameter.before.Main.java.201 | 7 + ...PrimaryConstructorParameter.after.java.201 | 7 + ...yConstructorParameter.before.Main.java.201 | 7 + ...condaryConstructorParameter.after.java.201 | 7 + ...yConstructorParameter.before.Main.java.201 | 7 + ...jkKeepValOnAddingParameter1.after.java.201 | 7 + ...ValOnAddingParameter1.before.Main.java.201 | 7 + ...jkKeepValOnAddingParameter2.after.java.201 | 7 + ...ValOnAddingParameter2.before.Main.java.201 | 7 + ...PrimaryConstructorParameter.after.java.201 | 7 + ...yConstructorParameter.before.Main.java.201 | 7 + ...condaryConstructorParameter.after.java.201 | 7 + ...yConstructorParameter.before.Main.java.201 | 7 + .../CommonIntentionActionsTest.kt.201 | 729 ++++++++++++++++++ 19 files changed, 855 insertions(+) create mode 100644 idea/testData/quickfix/changeSignature/jk/jkAddImplicitPrimaryConstructorParameter.after.java.201 create mode 100644 idea/testData/quickfix/changeSignature/jk/jkAddImplicitPrimaryConstructorParameter.before.Main.java.201 create mode 100644 idea/testData/quickfix/changeSignature/jk/jkAddPrimaryConstructorParameter.after.java.201 create mode 100644 idea/testData/quickfix/changeSignature/jk/jkAddPrimaryConstructorParameter.before.Main.java.201 create mode 100644 idea/testData/quickfix/changeSignature/jk/jkAddSecondaryConstructorParameter.after.java.201 create mode 100644 idea/testData/quickfix/changeSignature/jk/jkAddSecondaryConstructorParameter.before.Main.java.201 create mode 100644 idea/testData/quickfix/changeSignature/jk/jkChangePrimaryConstructorParameter.after.java.201 create mode 100644 idea/testData/quickfix/changeSignature/jk/jkChangePrimaryConstructorParameter.before.Main.java.201 create mode 100644 idea/testData/quickfix/changeSignature/jk/jkChangeSecondaryConstructorParameter.after.java.201 create mode 100644 idea/testData/quickfix/changeSignature/jk/jkChangeSecondaryConstructorParameter.before.Main.java.201 create mode 100644 idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter1.after.java.201 create mode 100644 idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter1.before.Main.java.201 create mode 100644 idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter2.after.java.201 create mode 100644 idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter2.before.Main.java.201 create mode 100644 idea/testData/quickfix/changeSignature/jk/jkRemovePrimaryConstructorParameter.after.java.201 create mode 100644 idea/testData/quickfix/changeSignature/jk/jkRemovePrimaryConstructorParameter.before.Main.java.201 create mode 100644 idea/testData/quickfix/changeSignature/jk/jkRemoveSecondaryConstructorParameter.after.java.201 create mode 100644 idea/testData/quickfix/changeSignature/jk/jkRemoveSecondaryConstructorParameter.before.Main.java.201 create mode 100644 idea/tests/org/jetbrains/kotlin/idea/quickfix/CommonIntentionActionsTest.kt.201 diff --git a/idea/testData/quickfix/changeSignature/jk/jkAddImplicitPrimaryConstructorParameter.after.java.201 b/idea/testData/quickfix/changeSignature/jk/jkAddImplicitPrimaryConstructorParameter.after.java.201 new file mode 100644 index 00000000000..7d4eed9812d --- /dev/null +++ b/idea/testData/quickfix/changeSignature/jk/jkAddImplicitPrimaryConstructorParameter.after.java.201 @@ -0,0 +1,7 @@ +// "Add 'int' as 1st parameter to method 'K'" "true" + +public class J { + void foo() { + new K(1); + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkAddImplicitPrimaryConstructorParameter.before.Main.java.201 b/idea/testData/quickfix/changeSignature/jk/jkAddImplicitPrimaryConstructorParameter.before.Main.java.201 new file mode 100644 index 00000000000..bf76052dcb8 --- /dev/null +++ b/idea/testData/quickfix/changeSignature/jk/jkAddImplicitPrimaryConstructorParameter.before.Main.java.201 @@ -0,0 +1,7 @@ +// "Add 'int' as 1st parameter to method 'K'" "true" + +public class J { + void foo() { + new K(1); + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkAddPrimaryConstructorParameter.after.java.201 b/idea/testData/quickfix/changeSignature/jk/jkAddPrimaryConstructorParameter.after.java.201 new file mode 100644 index 00000000000..7d4eed9812d --- /dev/null +++ b/idea/testData/quickfix/changeSignature/jk/jkAddPrimaryConstructorParameter.after.java.201 @@ -0,0 +1,7 @@ +// "Add 'int' as 1st parameter to method 'K'" "true" + +public class J { + void foo() { + new K(1); + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkAddPrimaryConstructorParameter.before.Main.java.201 b/idea/testData/quickfix/changeSignature/jk/jkAddPrimaryConstructorParameter.before.Main.java.201 new file mode 100644 index 00000000000..bf76052dcb8 --- /dev/null +++ b/idea/testData/quickfix/changeSignature/jk/jkAddPrimaryConstructorParameter.before.Main.java.201 @@ -0,0 +1,7 @@ +// "Add 'int' as 1st parameter to method 'K'" "true" + +public class J { + void foo() { + new K(1); + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkAddSecondaryConstructorParameter.after.java.201 b/idea/testData/quickfix/changeSignature/jk/jkAddSecondaryConstructorParameter.after.java.201 new file mode 100644 index 00000000000..7d4eed9812d --- /dev/null +++ b/idea/testData/quickfix/changeSignature/jk/jkAddSecondaryConstructorParameter.after.java.201 @@ -0,0 +1,7 @@ +// "Add 'int' as 1st parameter to method 'K'" "true" + +public class J { + void foo() { + new K(1); + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkAddSecondaryConstructorParameter.before.Main.java.201 b/idea/testData/quickfix/changeSignature/jk/jkAddSecondaryConstructorParameter.before.Main.java.201 new file mode 100644 index 00000000000..bf76052dcb8 --- /dev/null +++ b/idea/testData/quickfix/changeSignature/jk/jkAddSecondaryConstructorParameter.before.Main.java.201 @@ -0,0 +1,7 @@ +// "Add 'int' as 1st parameter to method 'K'" "true" + +public class J { + void foo() { + new K(1); + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkChangePrimaryConstructorParameter.after.java.201 b/idea/testData/quickfix/changeSignature/jk/jkChangePrimaryConstructorParameter.after.java.201 new file mode 100644 index 00000000000..5ce3da92778 --- /dev/null +++ b/idea/testData/quickfix/changeSignature/jk/jkChangePrimaryConstructorParameter.after.java.201 @@ -0,0 +1,7 @@ +// "Change 2nd parameter of method 'K' from 'boolean' to 'String'" "true" + +public class J { + void foo() { + new K(1, "2"); + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkChangePrimaryConstructorParameter.before.Main.java.201 b/idea/testData/quickfix/changeSignature/jk/jkChangePrimaryConstructorParameter.before.Main.java.201 new file mode 100644 index 00000000000..5ce3da92778 --- /dev/null +++ b/idea/testData/quickfix/changeSignature/jk/jkChangePrimaryConstructorParameter.before.Main.java.201 @@ -0,0 +1,7 @@ +// "Change 2nd parameter of method 'K' from 'boolean' to 'String'" "true" + +public class J { + void foo() { + new K(1, "2"); + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkChangeSecondaryConstructorParameter.after.java.201 b/idea/testData/quickfix/changeSignature/jk/jkChangeSecondaryConstructorParameter.after.java.201 new file mode 100644 index 00000000000..5ce3da92778 --- /dev/null +++ b/idea/testData/quickfix/changeSignature/jk/jkChangeSecondaryConstructorParameter.after.java.201 @@ -0,0 +1,7 @@ +// "Change 2nd parameter of method 'K' from 'boolean' to 'String'" "true" + +public class J { + void foo() { + new K(1, "2"); + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkChangeSecondaryConstructorParameter.before.Main.java.201 b/idea/testData/quickfix/changeSignature/jk/jkChangeSecondaryConstructorParameter.before.Main.java.201 new file mode 100644 index 00000000000..5ce3da92778 --- /dev/null +++ b/idea/testData/quickfix/changeSignature/jk/jkChangeSecondaryConstructorParameter.before.Main.java.201 @@ -0,0 +1,7 @@ +// "Change 2nd parameter of method 'K' from 'boolean' to 'String'" "true" + +public class J { + void foo() { + new K(1, "2"); + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter1.after.java.201 b/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter1.after.java.201 new file mode 100644 index 00000000000..aeb5b60e0c7 --- /dev/null +++ b/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter1.after.java.201 @@ -0,0 +1,7 @@ +// "Add 'int' as 1st parameter to method 'Foo'" "true" + +public class J { + void test() { + new Foo(1, 2); + } +} diff --git a/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter1.before.Main.java.201 b/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter1.before.Main.java.201 new file mode 100644 index 00000000000..aeb5b60e0c7 --- /dev/null +++ b/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter1.before.Main.java.201 @@ -0,0 +1,7 @@ +// "Add 'int' as 1st parameter to method 'Foo'" "true" + +public class J { + void test() { + new Foo(1, 2); + } +} diff --git a/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter2.after.java.201 b/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter2.after.java.201 new file mode 100644 index 00000000000..74eb5b27f38 --- /dev/null +++ b/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter2.after.java.201 @@ -0,0 +1,7 @@ +// "Add 'int' as 2nd parameter to method 'Foo'" "true" + +public class J { + void test() { + new Foo(1, 2); + } +} diff --git a/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter2.before.Main.java.201 b/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter2.before.Main.java.201 new file mode 100644 index 00000000000..74eb5b27f38 --- /dev/null +++ b/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter2.before.Main.java.201 @@ -0,0 +1,7 @@ +// "Add 'int' as 2nd parameter to method 'Foo'" "true" + +public class J { + void test() { + new Foo(1, 2); + } +} diff --git a/idea/testData/quickfix/changeSignature/jk/jkRemovePrimaryConstructorParameter.after.java.201 b/idea/testData/quickfix/changeSignature/jk/jkRemovePrimaryConstructorParameter.after.java.201 new file mode 100644 index 00000000000..da2e824b7dd --- /dev/null +++ b/idea/testData/quickfix/changeSignature/jk/jkRemovePrimaryConstructorParameter.after.java.201 @@ -0,0 +1,7 @@ +// "Remove 1st parameter from method 'K'" "true" + +public class J { + void foo() { + new K(); + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkRemovePrimaryConstructorParameter.before.Main.java.201 b/idea/testData/quickfix/changeSignature/jk/jkRemovePrimaryConstructorParameter.before.Main.java.201 new file mode 100644 index 00000000000..da2e824b7dd --- /dev/null +++ b/idea/testData/quickfix/changeSignature/jk/jkRemovePrimaryConstructorParameter.before.Main.java.201 @@ -0,0 +1,7 @@ +// "Remove 1st parameter from method 'K'" "true" + +public class J { + void foo() { + new K(); + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkRemoveSecondaryConstructorParameter.after.java.201 b/idea/testData/quickfix/changeSignature/jk/jkRemoveSecondaryConstructorParameter.after.java.201 new file mode 100644 index 00000000000..da2e824b7dd --- /dev/null +++ b/idea/testData/quickfix/changeSignature/jk/jkRemoveSecondaryConstructorParameter.after.java.201 @@ -0,0 +1,7 @@ +// "Remove 1st parameter from method 'K'" "true" + +public class J { + void foo() { + new K(); + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkRemoveSecondaryConstructorParameter.before.Main.java.201 b/idea/testData/quickfix/changeSignature/jk/jkRemoveSecondaryConstructorParameter.before.Main.java.201 new file mode 100644 index 00000000000..da2e824b7dd --- /dev/null +++ b/idea/testData/quickfix/changeSignature/jk/jkRemoveSecondaryConstructorParameter.before.Main.java.201 @@ -0,0 +1,7 @@ +// "Remove 1st parameter from method 'K'" "true" + +public class J { + void foo() { + new K(); + } +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/CommonIntentionActionsTest.kt.201 b/idea/tests/org/jetbrains/kotlin/idea/quickfix/CommonIntentionActionsTest.kt.201 new file mode 100644 index 00000000000..d27ea625de0 --- /dev/null +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/CommonIntentionActionsTest.kt.201 @@ -0,0 +1,729 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.quickfix + +import com.intellij.codeInsight.intention.IntentionAction +import com.intellij.lang.jvm.JvmClass +import com.intellij.lang.jvm.JvmElement +import com.intellij.lang.jvm.JvmModifier +import com.intellij.lang.jvm.actions.* +import com.intellij.lang.jvm.types.JvmSubstitutor +import com.intellij.openapi.project.Project +import com.intellij.openapi.util.Pair.pair +import com.intellij.psi.* +import com.intellij.testFramework.fixtures.CodeInsightTestFixture +import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase +import junit.framework.TestCase +import org.jetbrains.kotlin.asJava.toLightElements +import org.jetbrains.kotlin.idea.search.allScope +import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor +import org.jetbrains.kotlin.psi.KtModifierListOwner +import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner +import org.jetbrains.uast.toUElement +import org.junit.Assert +import org.junit.runner.RunWith + +@RunWith(JUnit3WithIdeaConfigurationRunner::class) +class CommonIntentionActionsTest : LightPlatformCodeInsightFixtureTestCase() { + private class SimpleMethodRequest( + project: Project, + private val methodName: String, + private val modifiers: Collection = emptyList(), + private val returnType: ExpectedTypes = emptyList(), + private val annotations: Collection = emptyList(), + @Suppress("MissingRecentApi") parameters: List = emptyList(), + private val targetSubstitutor: JvmSubstitutor = PsiJvmSubstitutor(project, PsiSubstitutor.EMPTY) + ) : CreateMethodRequest { + private val expectedParameters = parameters + + override fun getTargetSubstitutor(): JvmSubstitutor = targetSubstitutor + + override fun getModifiers() = modifiers + + override fun getMethodName() = methodName + + override fun getAnnotations() = annotations + + @Suppress("MissingRecentApi") + override fun getExpectedParameters(): List = expectedParameters + + override fun getReturnType() = returnType + + override fun isValid(): Boolean = true + + } + + override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE_FULL_JDK + + fun testMakeNotFinal() { + myFixture.configureByText( + "foo.kt", """ + class Foo { + fun bar(){} + } + """ + ) + + myFixture.launchAction( + createModifierActions( + myFixture.atCaret(), TestModifierRequest(JvmModifier.FINAL, false) + ).findWithText("Make 'bar' 'open'") + ) + myFixture.checkResult( + """ + class Foo { + open fun bar(){} + } + """ + ) + } + + fun testMakePrivate() { + myFixture.configureByText( + "foo.kt", """ + class Foo { + fun bar(){} + } + """ + ) + + myFixture.launchAction( + createModifierActions( + myFixture.atCaret(), TestModifierRequest(JvmModifier.PRIVATE, true) + ).findWithText("Make 'Foo' 'private'") + ) + myFixture.checkResult( + """ + private class Foo { + fun bar(){} + } + """ + ) + } + + fun testMakeNotPrivate() { + myFixture.configureByText( + "foo.kt", """ + private class Foo { + fun bar(){} + } + """.trim() + ) + + myFixture.launchAction( + createModifierActions( + myFixture.atCaret(), TestModifierRequest(JvmModifier.PRIVATE, false) + ).findWithText("Remove 'private' modifier") + ) + myFixture.checkResult( + """ + class Foo { + fun bar(){} + } + """.trim(), true + ) + } + + fun testMakePrivatePublic() { + myFixture.configureByText( + "foo.kt", """class Foo { + | private fun bar(){} + |}""".trim().trimMargin() + ) + + myFixture.launchAction( + createModifierActions( + myFixture.atCaret(), TestModifierRequest(JvmModifier.PUBLIC, true) + ).findWithText("Remove 'private' modifier") + ) + myFixture.checkResult( + """class Foo { + | fun bar(){} + |}""".trim().trimMargin(), true + ) + } + + fun testMakeProtectedPublic() { + myFixture.configureByText( + "foo.kt", """open class Foo { + | protected fun bar(){} + |}""".trim().trimMargin() + ) + + myFixture.launchAction( + createModifierActions( + myFixture.atCaret(), TestModifierRequest(JvmModifier.PUBLIC, true) + ).findWithText("Remove 'protected' modifier") + ) + myFixture.checkResult( + """open class Foo { + | fun bar(){} + |}""".trim().trimMargin(), true + ) + } + + fun testMakeInternalPublic() { + myFixture.configureByText( + "foo.kt", """class Foo { + | internal fun bar(){} + |}""".trim().trimMargin() + ) + + myFixture.launchAction( + createModifierActions( + myFixture.atCaret(), TestModifierRequest(JvmModifier.PUBLIC, true) + ).findWithText("Remove 'internal' modifier") + ) + myFixture.checkResult( + """class Foo { + | fun bar(){} + |}""".trim().trimMargin(), true + ) + } + + fun testAddAnnotation() { + myFixture.configureByText( + "foo.kt", """class Foo { + | fun bar(){} + |}""".trim().trimMargin() + ) + + myFixture.launchAction( + createAddAnnotationActions( + myFixture.findElementByText("bar", KtModifierListOwner::class.java).toLightElements().single() as PsiMethod, + annotationRequest("kotlin.jvm.JvmName", stringAttribute("name", "foo")) + ).single() + ) + myFixture.checkResult( + """class Foo { + | @JvmName(name = "foo") + | fun bar(){} + |}""".trim().trimMargin(), true + ) + } + + fun testAddJavaAnnotationValue() { + + myFixture.addFileToProject( + "pkg/myannotation/JavaAnnotation.java", """ + package pkg.myannotation + + public @interface JavaAnnotation { + String value(); + int param() default 0; + } + """.trimIndent() + ) + + myFixture.configureByText( + "foo.kt", """class Foo { + | fun bar(){} + | fun baz(){} + |}""".trim().trimMargin() + ) + + myFixture.launchAction( + createAddAnnotationActions( + myFixture.findElementByText("bar", KtModifierListOwner::class.java).toLightElements().single() as PsiMethod, + annotationRequest("pkg.myannotation.JavaAnnotation", stringAttribute("value", "foo"), intAttribute("param", 2)) + ).single() + ) + myFixture.launchAction( + createAddAnnotationActions( + myFixture.findElementByText("baz", KtModifierListOwner::class.java).toLightElements().single() as PsiMethod, + annotationRequest("pkg.myannotation.JavaAnnotation", intAttribute("param", 2), stringAttribute("value", "foo")) + ).single() + ) + myFixture.checkResult( + """import pkg.myannotation.JavaAnnotation + | + |class Foo { + | @JavaAnnotation("foo", param = 2) + | fun bar(){} + | @JavaAnnotation(param = 2, value = "foo") + | fun baz(){} + |}""".trim().trimMargin(), true + ) + } + + + fun testAddJavaAnnotationOnFieldWithoutTarget() { + + myFixture.addFileToProject( + "pkg/myannotation/JavaAnnotation.java", """ + package pkg.myannotation + + import java.lang.annotation.ElementType; + import java.lang.annotation.Retention; + import java.lang.annotation.RetentionPolicy; + import java.lang.annotation.Target; + + //no @Target + @Retention(RetentionPolicy.RUNTIME) + public @interface JavaAnnotation { + String value(); + int param() default 0; + } + """.trimIndent() + ) + + myFixture.configureByText( + "foo.kt", """class Foo { + | val bar: String = null + |}""".trim().trimMargin() + ) + + myFixture.launchAction( + createAddAnnotationActions( + myFixture.findElementByText("bar", KtModifierListOwner::class.java).toLightElements().single { it is PsiField } as PsiField, + annotationRequest("pkg.myannotation.JavaAnnotation") + ).single() + ) + + myFixture.checkResult( + """ + import pkg.myannotation.JavaAnnotation + + class Foo { + @field:JavaAnnotation + val bar: String = null + } + """.trimIndent(), true + ) + + TestCase.assertEquals( + "KtUltraLightMethodForSourceDeclaration -> org.jetbrains.annotations.NotNull," + + " KtUltraLightFieldForSourceDeclaration -> pkg.myannotation.JavaAnnotation, org.jetbrains.annotations.NotNull", + annotationsString(myFixture.findElementByText("bar", KtModifierListOwner::class.java)) + ) + } + + + fun testAddJavaAnnotationOnField() { + + myFixture.addFileToProject( + "pkg/myannotation/JavaAnnotation.java", """ + package pkg.myannotation + + import java.lang.annotation.ElementType; + import java.lang.annotation.Retention; + import java.lang.annotation.RetentionPolicy; + import java.lang.annotation.Target; + + @Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE, ElementType.ANNOTATION_TYPE}) + @Retention(RetentionPolicy.RUNTIME) + public @interface JavaAnnotation { + String value(); + int param() default 0; + } + """.trimIndent() + ) + + myFixture.configureByText( + "foo.kt", """class Foo { + | val bar: String = null + |}""".trim().trimMargin() + ) + + myFixture.launchAction( + createAddAnnotationActions( + myFixture.findElementByText("bar", KtModifierListOwner::class.java).toLightElements().single { it is PsiField } as PsiField, + annotationRequest("pkg.myannotation.JavaAnnotation") + ).single() + ) + + myFixture.checkResult( + """ + import pkg.myannotation.JavaAnnotation + + class Foo { + @JavaAnnotation + val bar: String = null + } + """.trimIndent(), true + ) + + TestCase.assertEquals( + "KtUltraLightMethodForSourceDeclaration -> org.jetbrains.annotations.NotNull," + + " KtUltraLightFieldForSourceDeclaration -> pkg.myannotation.JavaAnnotation, org.jetbrains.annotations.NotNull", + annotationsString(myFixture.findElementByText("bar", KtModifierListOwner::class.java)) + ) + } + + private fun annotationsString(findElementByText: KtModifierListOwner) = findElementByText.toLightElements() + .joinToString { elem -> + "${elem.javaClass.simpleName} -> ${(elem as PsiModifierListOwner).annotations.mapNotNull { it.qualifiedName }.joinToString()}" + } + + fun testDontMakePublicPublic() { + myFixture.configureByText( + "foo.kt", """class Foo { + | fun bar(){} + |}""".trim().trimMargin() + ) + + assertEmpty(createModifierActions(myFixture.atCaret(), TestModifierRequest(JvmModifier.PUBLIC, true))) + } + + fun testDontMakeFunInObjectsOpen() { + myFixture.configureByText( + "foo.kt", """ + object Foo { + fun bar(){} + } + """.trim() + ) + assertEmpty(createModifierActions(myFixture.atCaret(), TestModifierRequest(JvmModifier.FINAL, false))) + } + + fun testAddVoidVoidMethod() { + myFixture.configureByText( + "foo.kt", """ + |class Foo { + | fun bar() {} + |} + """.trim().trimMargin() + ) + + myFixture.launchAction( + createMethodActions( + myFixture.atCaret(), + methodRequest(project, "baz", JvmModifier.PRIVATE, PsiType.VOID) + ).findWithText("Add method 'baz' to 'Foo'") + ) + myFixture.checkResult( + """ + |class Foo { + | fun bar() {} + | private fun baz() { + | + | } + |} + """.trim().trimMargin(), true + ) + } + + fun testAddIntIntMethod() { + myFixture.configureByText( + "foo.kt", """ + |class Foo { + | fun bar() {} + |} + """.trim().trimMargin() + ) + + myFixture.launchAction( + createMethodActions( + myFixture.atCaret(), + SimpleMethodRequest( + project, + methodName = "baz", + modifiers = listOf(JvmModifier.PUBLIC), + returnType = expectedTypes(PsiType.INT), + parameters = expectedParams(PsiType.INT) + ) + ).findWithText("Add method 'baz' to 'Foo'") + ) + myFixture.checkResult( + """ + |class Foo { + | fun bar() {} + | fun baz(param0: Int): Int { + | TODO("Not yet implemented") + | } + |} + """.trim().trimMargin(), true + ) + } + + fun testAddIntPrimaryConstructor() { + myFixture.configureByText( + "foo.kt", """ + |class Foo { + |} + """.trim().trimMargin() + ) + + myFixture.launchAction( + createConstructorActions( + myFixture.atCaret(), constructorRequest(project, listOf(pair("param0", PsiType.INT as PsiType))) + ).findWithText("Add primary constructor to 'Foo'") + ) + myFixture.checkResult( + """ + |class Foo(param0: Int) { + |} + """.trim().trimMargin(), true + ) + } + + fun testAddIntSecondaryConstructor() { + myFixture.configureByText( + "foo.kt", """ + |class Foo() { + |} + """.trim().trimMargin() + ) + + myFixture.launchAction( + createConstructorActions( + myFixture.atCaret(), + constructorRequest(project, listOf(pair("param0", PsiType.INT as PsiType))) + ).findWithText("Add secondary constructor to 'Foo'") + ) + myFixture.checkResult( + """ + |class Foo() { + | constructor(param0: Int) { + | + | } + |} + """.trim().trimMargin(), true + ) + } + + fun testChangePrimaryConstructorInt() { + myFixture.configureByText( + "foo.kt", """ + |class Foo() { + |} + """.trim().trimMargin() + ) + + myFixture.launchAction( + createConstructorActions( + myFixture.atCaret(), + constructorRequest(project, listOf(pair("param0", PsiType.INT as PsiType))) + ).findWithText("Add 'int' as 1st parameter to method 'Foo'") + ) + myFixture.checkResult( + """ + |class Foo(param0: Int) { + |} + """.trim().trimMargin(), true + ) + } + + fun testRemoveConstructorParameters() { + myFixture.configureByText( + "foo.kt", """ + |class Foo(i: Int) { + |} + """.trim().trimMargin() + ) + + myFixture.launchAction( + createConstructorActions( + myFixture.atCaret(), + constructorRequest(project, emptyList()) + ).findWithText("Remove 1st parameter from method 'Foo'") + ) + myFixture.checkResult( + """ + |class Foo() { + |} + """.trim().trimMargin(), true + ) + } + + fun testAddStringVarProperty() { + myFixture.configureByText( + "foo.kt", """ + |class Foo { + | fun bar() {} + |} + """.trim().trimMargin() + ) + + myFixture.launchAction( + createMethodActions( + myFixture.atCaret(), + SimpleMethodRequest( + project, + methodName = "setBaz", + modifiers = listOf(JvmModifier.PUBLIC), + returnType = expectedTypes(), + parameters = expectedParams(PsiType.getTypeByName("java.lang.String", project, project.allScope())) + ) + ).findWithText("Add 'var' property 'baz' to 'Foo'") + ) + myFixture.checkResult( + """ + |class Foo { + | var baz: String = TODO("initialize me") + | + | fun bar() {} + |} + """.trim().trimMargin(), true + ) + } + + fun testAddLateInitStringVarProperty() { + myFixture.configureByText( + "foo.kt", """ + |class Foo { + | fun bar() {} + |} + """.trim().trimMargin() + ) + + myFixture.launchAction( + createMethodActions( + myFixture.atCaret(), + SimpleMethodRequest( + project, + methodName = "setBaz", + modifiers = listOf(JvmModifier.PUBLIC), + returnType = expectedTypes(), + parameters = expectedParams(PsiType.getTypeByName("java.lang.String", project, project.allScope())) + ) + ).findWithText("Add 'lateinit var' property 'baz' to 'Foo'") + ) + myFixture.checkResult( + """ + |class Foo { + | lateinit var baz: String + | + | fun bar() {} + |} + """.trim().trimMargin(), true + ) + } + + fun testAddStringVarField() { + myFixture.configureByText( + "foo.kt", """ + |class Foo { + | fun bar() {} + |} + """.trim().trimMargin() + ) + myFixture.launchAction( + createFieldActions( + myFixture.atCaret(), + FieldRequest(project, emptyList(), "java.util.Date", "baz") + ).findWithText("Add 'var' property 'baz' to 'Foo'") + ) + myFixture.checkResult( + """ + |import java.util.Date + | + |class Foo { + | @JvmField + | var baz: Date = TODO("initialize me") + | + | fun bar() {} + |} + """.trim().trimMargin(), true + ) + } + + fun testAddLateInitStringVarField() { + myFixture.configureByText( + "foo.kt", """ + |class Foo { + | fun bar() {} + |} + """.trim().trimMargin() + ) + + myFixture.launchAction( + createFieldActions( + myFixture.atCaret(), + FieldRequest(project, listOf(JvmModifier.PRIVATE), "java.lang.String", "baz") + ).findWithText("Add 'lateinit var' property 'baz' to 'Foo'") + ) + myFixture.checkResult( + """ + |class Foo { + | private lateinit var baz: String + | + | fun bar() {} + |} + """.trim().trimMargin(), true + ) + } + + + private fun createFieldActions(atCaret: JvmClass, fieldRequest: CreateFieldRequest): List = + EP_NAME.extensions.flatMap { it.createAddFieldActions(atCaret, fieldRequest) } + + fun testAddStringValProperty() { + myFixture.configureByText( + "foo.kt", """ + |class Foo { + | fun bar() {} + |} + """.trim().trimMargin() + ) + + myFixture.launchAction( + createMethodActions( + myFixture.atCaret(), + SimpleMethodRequest( + project, + methodName = "getBaz", + modifiers = listOf(JvmModifier.PUBLIC), + returnType = expectedTypes(PsiType.getTypeByName("java.lang.String", project, project.allScope())), + parameters = expectedParams() + ) + ).findWithText("Add 'val' property 'baz' to 'Foo'") + ) + myFixture.checkResult( + """ + |class Foo { + | val baz: String = TODO("initialize me") + | + | fun bar() {} + |} + """.trim().trimMargin(), true + ) + } + + + private fun expectedTypes(vararg psiTypes: PsiType) = psiTypes.map { expectedType(it) } + + private fun expectedParams(vararg psyTypes: PsiType) = + psyTypes.mapIndexed { index, psiType -> expectedParameter(expectedTypes(psiType), "param$index") } + + class FieldRequest( + private val project: Project, + val modifiers: List, + val type: String, + val name: String + ) : CreateFieldRequest { + override fun getTargetSubstitutor(): JvmSubstitutor = PsiJvmSubstitutor(project, PsiSubstitutor.EMPTY) + + override fun getModifiers(): Collection = modifiers + + override fun isConstant(): Boolean = false + + override fun getFieldType(): List = + expectedTypes(PsiType.getTypeByName(type, project, project.allScope())) + + override fun getFieldName(): String = name + + override fun isValid(): Boolean = true + } + +} + +internal inline fun CodeInsightTestFixture.atCaret() = elementAtCaret.toUElement() as T + +@Suppress("MissingRecentApi") +private class TestModifierRequest(private val _modifier: JvmModifier, private val shouldBePresent: Boolean) : ChangeModifierRequest { + override fun shouldBePresent(): Boolean = shouldBePresent + override fun isValid(): Boolean = true + override fun getModifier(): JvmModifier = _modifier +} + +@Suppress("CAST_NEVER_SUCCEEDS") +internal fun List.findWithText(text: String): IntentionAction = + this.firstOrNull { it.text == text } + ?: Assert.fail("intention with text '$text' was not found, only ${this.joinToString { "\"${it.text}\"" }} available") as Nothing + + + From 3d33ea7da8edeb422dc7a8c4d64823176022cef8 Mon Sep 17 00:00:00 2001 From: Vladimir Dolzhenko Date: Wed, 25 Nov 2020 16:50:04 +0100 Subject: [PATCH 309/698] Use absolute paths to locate existed projects to open in AbstractConfigureKotlinTest --- .../configuration/AbstractConfigureKotlinTest.kt | 13 ++++--------- .../AbstractConfigureKotlinTest.kt.201 | 7 ++++--- .../AbstractConfigureKotlinTest.kt.203 | 7 ++++--- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt b/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt index 46c7584068c..7b4f64b7cd9 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt @@ -19,7 +19,6 @@ import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess import com.intellij.testFramework.PlatformTestCase import com.intellij.testFramework.UsefulTestCase import junit.framework.TestCase -import junit.framework.TestResult import org.jetbrains.kotlin.idea.configuration.KotlinWithLibraryConfigurator.FileState import org.jetbrains.kotlin.idea.framework.KotlinSdkType import org.jetbrains.kotlin.idea.test.PluginTestCaseBase.* @@ -38,11 +37,6 @@ abstract class AbstractConfigureKotlinTest : PlatformTestCase() { VfsRootAccess.allowRootAccess(KotlinTestUtils.getHomeDirectory()) } - override fun run(result: TestResult?) { - // TODO: [VD] temporary ignore/disable these tests - // super.run(result) - } - @Throws(Exception::class) override fun tearDown() { VfsRootAccess.disallowRootAccess(KotlinTestUtils.getHomeDirectory()) @@ -111,9 +105,10 @@ abstract class AbstractConfigureKotlinTest : PlatformTestCase() { get() = ModuleManager.getInstance(myProject).modules override fun getProjectDirOrFile(): Path { - val projectFilePath = projectRoot + "/projectFile.ipr" - TestCase.assertTrue("Project file should exists " + projectFilePath, File(projectFilePath).exists()) - return File(projectFilePath).toPath() + val projectFilePath = "$projectRoot/projectFile.ipr" + val file = File(projectFilePath).absoluteFile + TestCase.assertTrue("Project file should exists $projectFilePath", file.exists()) + return file.toPath() } override fun doCreateProject(projectFile: Path): Project { diff --git a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt.201 b/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt.201 index a5fc2e68565..41cd2d4a754 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt.201 +++ b/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt.201 @@ -105,9 +105,10 @@ abstract class AbstractConfigureKotlinTest : PlatformTestCase() { get() = ModuleManager.getInstance(myProject).modules override fun getProjectDirOrFile(): Path { - val projectFilePath = projectRoot + "/projectFile.ipr" - TestCase.assertTrue("Project file should exists " + projectFilePath, File(projectFilePath).exists()) - return File(projectFilePath).toPath() + val projectFilePath = "$projectRoot/projectFile.ipr" + val file = File(projectFilePath).absoluteFile + TestCase.assertTrue("Project file should exists $projectFilePath", file.exists()) + return file.toPath() } override fun doCreateProject(projectFile: Path): Project { diff --git a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt.203 b/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt.203 index ab9a09d4dfa..1a020148c6f 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt.203 +++ b/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt.203 @@ -106,9 +106,10 @@ abstract class AbstractConfigureKotlinTest : PlatformTestCase() { get() = ModuleManager.getInstance(myProject).modules override fun getProjectDirOrFile(isDirectoryBasedProject: Boolean): Path { - val projectFilePath = projectRoot + "/projectFile.ipr" - TestCase.assertTrue("Project file should exists " + projectFilePath, File(projectFilePath).exists()) - return File(projectFilePath).toPath() + val projectFilePath = "$projectRoot/projectFile.ipr" + val file = File(projectFilePath).absoluteFile + TestCase.assertTrue("Project file should exists $projectFilePath", file.exists()) + return file.toPath() } override fun doCreateAndOpenProject(): Project { From 85c59328c7edad30488ebff028812321b7f0a071 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Wed, 25 Nov 2020 19:08:56 +0300 Subject: [PATCH 310/698] [DEBUGGER] Temporary mute AbstractKotlinEvaluateExpressionTest --- .../debugger/test/AbstractKotlinEvaluateExpressionTest.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/AbstractKotlinEvaluateExpressionTest.kt b/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/AbstractKotlinEvaluateExpressionTest.kt index 7bc49a4a51e..dfca48230fa 100644 --- a/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/AbstractKotlinEvaluateExpressionTest.kt +++ b/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/AbstractKotlinEvaluateExpressionTest.kt @@ -62,6 +62,10 @@ abstract class AbstractKotlinEvaluateExpressionTest : KotlinDescriptorTestCaseWi private val exceptions = ConcurrentHashMap() + override fun runBare() { + // DO NOTHING + } + fun doSingleBreakpointTest(path: String) { isMultipleBreakpointsTest = false doTest(path) @@ -296,4 +300,4 @@ abstract class AbstractKotlinEvaluateExpressionTest : KotlinDescriptorTestCaseWi markupMap[localVariableValue] = ValueMarkup(name, null, name) } } -} \ No newline at end of file +} From 33b545aea7811991c1c591e984d30d5229fc6c6c Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Thu, 26 Nov 2020 11:40:55 +0300 Subject: [PATCH 311/698] Build: Mute failing gradle import with android tests --- tests/mute-platform.csv | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/mute-platform.csv b/tests/mute-platform.csv index 8035744fae0..2f00a14f7ea 100644 --- a/tests/mute-platform.csv +++ b/tests/mute-platform.csv @@ -7,6 +7,7 @@ org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testTransitiveImpl org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testTransitiveImplementWithNonDefaultConfig, Gradle Tests in 201,, org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testTransitiveImplement, Gradle Tests in 201,, "org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testAndroidDependencyOnMPP", Gradle Import Tests,, +"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testDetectAndroidSources", Gradle Import Tests,, "org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testDependencyOnRoot", Gradle Tests in 201,, "org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testImportBeforeBuild", Gradle Tests in 201,, "org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testJavaTransitiveOnMPP", Gradle Tests in 201,, @@ -19,6 +20,7 @@ org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If. org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Order.testValAndClass,,, FLAKY org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Order.testValOrder,,, FLAKY org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Val.testValWithTypeWoInitializer,,, FLAKY +org.jetbrains.kotlin.idea.codeInsight.gradle.GradleFacetImportTest.testAndroidGradleJsDetection, Gradle import Tests,, org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Common.StaticMembers.testJavaStaticMethodsFromImports, KT-32919,, org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.BoldOrGrayed.testNonPredictableSmartCast1, KT-32919,, org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.BoldOrGrayed.testNonPredictableSmartCast2, KT-32919,, @@ -116,4 +118,4 @@ org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertSealedClassTo org.jetbrains.kotlin.idea.navigation.GotoDeclarationTestGenerated.testImportAliasMultiDeclarations, showInBestPositionFor doesn't work in headless in 202,, org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testChangeInsideNonKtsFileInvalidatesOtherFiles, Unprocessed,, org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testTwoFilesChanged, Unprocessed,, -org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testLoadedConfigurationWhenExternalFileChanged, Unprocessed,, \ No newline at end of file +org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testLoadedConfigurationWhenExternalFileChanged, Unprocessed,, From 78c786de46ee024361aa2a5600e9f2a88a927a08 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Thu, 26 Nov 2020 13:25:14 +0300 Subject: [PATCH 312/698] Build: Mute failing goto declaration tests --- tests/mute-platform.csv | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/mute-platform.csv b/tests/mute-platform.csv index 2f00a14f7ea..903e77b60d9 100644 --- a/tests/mute-platform.csv +++ b/tests/mute-platform.csv @@ -116,6 +116,17 @@ org.jetbrains.kotlin.idea.refactoring.move.MoveTestGenerated.testKotlin_moveTopL org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertSealedClassToEnum.testInstancesOnly, Generated entries reordered,, FLAKY org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertSealedClassToEnum.testInstancesAndMembers, Enum reorder,, FLAKY org.jetbrains.kotlin.idea.navigation.GotoDeclarationTestGenerated.testImportAliasMultiDeclarations, showInBestPositionFor doesn't work in headless in 202,, +org.jetbrains.kotlin.idea.navigation.GotoDeclarationTestGenerated.testItParameterInLambda,Broken in 202,, +org.jetbrains.kotlin.idea.navigation.GotoDeclarationTestGenerated.testThisExtensionFunction,Broken in 202,, +org.jetbrains.kotlin.idea.navigation.GotoDeclarationTestGenerated.testItExtensionLambda,Broken in 202,, +org.jetbrains.kotlin.idea.navigation.GotoDeclarationTestGenerated.testLabeledThisToMemberExtension,Broken in 202,, +org.jetbrains.kotlin.idea.navigation.GotoDeclarationTestGenerated.testThisInExtensionPropertyAccessor,Broken in 202,, +org.jetbrains.kotlin.idea.navigation.GotoDeclarationTestGenerated.testLabeledThisToClass,Broken in 202,, +org.jetbrains.kotlin.idea.navigation.GotoDeclarationTestGenerated.testItExtensionLambdaInBrackets,Broken in 202,, +org.jetbrains.kotlin.idea.navigation.GotoDeclarationTestGenerated.testThisExtensionLambda,Broken in 202,, +org.jetbrains.kotlin.idea.navigation.GotoDeclarationTestGenerated.testItInLambdaAsDefaultArgument,Broken in 202,, +org.jetbrains.kotlin.idea.navigation.GotoDeclarationTestGenerated.testImportAlias,Broken in 202,, +org.jetbrains.kotlin.idea.navigation.GotoDeclarationTestGenerated.testItInLambdaWithoutCall,Broken in 202,, org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testChangeInsideNonKtsFileInvalidatesOtherFiles, Unprocessed,, org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testTwoFilesChanged, Unprocessed,, org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testLoadedConfigurationWhenExternalFileChanged, Unprocessed,, From e7d305b97ab838fa0564372481dde86f923aa741 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Thu, 26 Nov 2020 16:00:43 +0300 Subject: [PATCH 313/698] Build: mute failing stepping tests --- tests/mute-platform.csv | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/mute-platform.csv b/tests/mute-platform.csv index 903e77b60d9..9b6d1536581 100644 --- a/tests/mute-platform.csv +++ b/tests/mute-platform.csv @@ -130,3 +130,5 @@ org.jetbrains.kotlin.idea.navigation.GotoDeclarationTestGenerated.testItInLambda org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testChangeInsideNonKtsFileInvalidatesOtherFiles, Unprocessed,, org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testTwoFilesChanged, Unprocessed,, org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testLoadedConfigurationWhenExternalFileChanged, Unprocessed,, +org.jetbrains.kotlin.idea.debugger.test.IrKotlinSteppingTestGenerated.Custom.testFunctionBreakpointInStdlib,Unprocessed,, +org.jetbrains.kotlin.idea.debugger.test.KotlinSteppingTestGenerated.Custom.testFunctionBreakpointInStdlib,Unprocessed,, From f668e906cc2a8b0e215f5753ffa0d2afae1a36e3 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Thu, 26 Nov 2020 16:01:37 +0300 Subject: [PATCH 314/698] Build: unmute passed tests --- tests/mute-platform.csv | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/mute-platform.csv b/tests/mute-platform.csv index 9b6d1536581..222fd589495 100644 --- a/tests/mute-platform.csv +++ b/tests/mute-platform.csv @@ -31,8 +31,6 @@ org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.S org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.SyntheticExtensions.testSmartCast, KT-32919,, org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.SyntheticExtensions.testSmartCast2, KT-32919,, org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.SyntheticExtensions.testSyntheticExtensions1, KT-32919,, -org.jetbrains.kotlin.idea.filters.KotlinExceptionFilterTestGenerated.testInlineFunCallInLibrary, Unprocessed,, -org.jetbrains.kotlin.idea.filters.KotlinExceptionFilterTestGenerated.testInlineFunInnerClassFromLibrary, Unprocessed,, org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testCoroutineContextCheck, KT-34659,, org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testDispatchersTypeDetection, KT-34659,, org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testLambdaReceiverType, KT-34659,, From 2ee8bf7dde13c98683b1addc5603f8cb9a393e9d Mon Sep 17 00:00:00 2001 From: Pavel Punegov Date: Fri, 27 Nov 2020 15:52:15 +0300 Subject: [PATCH 315/698] Add fastutil dependency for 202 and higher platforms --- include/kotlin-compiler/build.gradle.kts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/kotlin-compiler/build.gradle.kts b/include/kotlin-compiler/build.gradle.kts index c688b2b5118..51574b9c79f 100644 --- a/include/kotlin-compiler/build.gradle.kts +++ b/include/kotlin-compiler/build.gradle.kts @@ -34,6 +34,12 @@ dependencies { fatJarContents(intellijDep()) { includeJars("jna-platform") } fatJarContentsStripServices(jpsStandalone()) { includeJars("jps-model") } fatJarContentsStripMetadata(intellijDep()) { includeJars("oro", "jdom", "log4j", rootProject = rootProject) } + + if (Platform.P202()) { + fatJarContents(intellijDep()) { includeJars("intellij-deps-fastutil-8.3.1-1") } + } else if (Platform.P203.orHigher()) { + fatJarContents(intellijDep()) { includeJars("intellij-deps-fastutil-8.3.1-3") } + } } val jar: Jar by tasks From 64d85f259c072408e342647df05294c3c3f02235 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Fri, 20 Nov 2020 04:55:56 +0300 Subject: [PATCH 316/698] Relax writeText/appendText parameter type to CharSequence KT-19192 --- libraries/stdlib/jdk7/src/kotlin/io/path/PathReadWrite.kt | 8 ++++---- libraries/stdlib/jdk7/test/PathReadWriteTest.kt | 4 ++-- .../reference-public-api/kotlin-stdlib-jdk7.txt | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libraries/stdlib/jdk7/src/kotlin/io/path/PathReadWrite.kt b/libraries/stdlib/jdk7/src/kotlin/io/path/PathReadWrite.kt index 4692f8618ae..d88c000fd77 100644 --- a/libraries/stdlib/jdk7/src/kotlin/io/path/PathReadWrite.kt +++ b/libraries/stdlib/jdk7/src/kotlin/io/path/PathReadWrite.kt @@ -157,8 +157,8 @@ public fun Path.readText(charset: Charset = Charsets.UTF_8): String = */ @SinceKotlin("1.4") @ExperimentalPathApi -public fun Path.writeText(text: String, charset: Charset = Charsets.UTF_8, vararg options: OpenOption) { - Files.newOutputStream(this, *options).writer(charset).use { it.write(text) } +public fun Path.writeText(text: CharSequence, charset: Charset = Charsets.UTF_8, vararg options: OpenOption) { + Files.newOutputStream(this, *options).writer(charset).use { it.append(text) } } /** @@ -169,8 +169,8 @@ public fun Path.writeText(text: String, charset: Charset = Charsets.UTF_8, varar */ @SinceKotlin("1.4") @ExperimentalPathApi -public fun Path.appendText(text: String, charset: Charset = Charsets.UTF_8) { - Files.newOutputStream(this, StandardOpenOption.APPEND).writer(charset).use { it.write(text) } +public fun Path.appendText(text: CharSequence, charset: Charset = Charsets.UTF_8) { + Files.newOutputStream(this, StandardOpenOption.APPEND).writer(charset).use { it.append(text) } } /** diff --git a/libraries/stdlib/jdk7/test/PathReadWriteTest.kt b/libraries/stdlib/jdk7/test/PathReadWriteTest.kt index d014c86c15d..8b23086fd13 100644 --- a/libraries/stdlib/jdk7/test/PathReadWriteTest.kt +++ b/libraries/stdlib/jdk7/test/PathReadWriteTest.kt @@ -15,8 +15,8 @@ class PathReadWriteTest : AbstractPathTest() { fun appendText() { val file = createTempFile().cleanup() file.writeText("Hello\n") - file.appendText("World\n") - file.writeText("Again", Charsets.US_ASCII, StandardOpenOption.APPEND) + file.appendText("World\n" as CharSequence) + file.writeText(StringBuilder("Again"), Charsets.US_ASCII, StandardOpenOption.APPEND) assertEquals("Hello\nWorld\nAgain", file.readText()) assertEquals(listOf("Hello", "World", "Again"), file.readLines(Charsets.UTF_8)) diff --git a/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-jdk7.txt b/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-jdk7.txt index 1ce2284c03b..059f0aad4f3 100644 --- a/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-jdk7.txt +++ b/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-jdk7.txt @@ -2,8 +2,8 @@ public abstract interface annotation class kotlin/io/path/ExperimentalPathApi : } public final class kotlin/io/path/PathsKt { - public static final fun appendText (Ljava/nio/file/Path;Ljava/lang/String;Ljava/nio/charset/Charset;)V - public static synthetic fun appendText$default (Ljava/nio/file/Path;Ljava/lang/String;Ljava/nio/charset/Charset;ILjava/lang/Object;)V + public static final fun appendText (Ljava/nio/file/Path;Ljava/lang/CharSequence;Ljava/nio/charset/Charset;)V + public static synthetic fun appendText$default (Ljava/nio/file/Path;Ljava/lang/CharSequence;Ljava/nio/charset/Charset;ILjava/lang/Object;)V public static final fun fileAttributeViewNotAvailable (Ljava/nio/file/Path;Ljava/lang/Class;)Ljava/lang/Void; public static final fun getExtension (Ljava/nio/file/Path;)Ljava/lang/String; public static final fun getInvariantSeparatorsPath (Ljava/nio/file/Path;)Ljava/lang/String; @@ -16,8 +16,8 @@ public final class kotlin/io/path/PathsKt { public static final fun relativeTo (Ljava/nio/file/Path;Ljava/nio/file/Path;)Ljava/nio/file/Path; public static final fun relativeToOrNull (Ljava/nio/file/Path;Ljava/nio/file/Path;)Ljava/nio/file/Path; public static final fun relativeToOrSelf (Ljava/nio/file/Path;Ljava/nio/file/Path;)Ljava/nio/file/Path; - public static final fun writeText (Ljava/nio/file/Path;Ljava/lang/String;Ljava/nio/charset/Charset;[Ljava/nio/file/OpenOption;)V - public static synthetic fun writeText$default (Ljava/nio/file/Path;Ljava/lang/String;Ljava/nio/charset/Charset;[Ljava/nio/file/OpenOption;ILjava/lang/Object;)V + public static final fun writeText (Ljava/nio/file/Path;Ljava/lang/CharSequence;Ljava/nio/charset/Charset;[Ljava/nio/file/OpenOption;)V + public static synthetic fun writeText$default (Ljava/nio/file/Path;Ljava/lang/CharSequence;Ljava/nio/charset/Charset;[Ljava/nio/file/OpenOption;ILjava/lang/Object;)V } public final class kotlin/jdk7/AutoCloseableKt { From 84f5a294f770b9332b7aa860b961867dd30bf45d Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Fri, 20 Nov 2020 05:29:04 +0300 Subject: [PATCH 317/698] Allow passing null parent directory to createTempFile/Directory null signifies the default temp directory. KT-19192 --- .../jdk7/src/kotlin/io/path/PathUtils.kt | 28 ++++++++++++------- .../stdlib/jdk7/test/PathExtensionsTest.kt | 18 ++++++++++++ .../kotlin-stdlib-jdk7.txt | 4 +++ 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/libraries/stdlib/jdk7/src/kotlin/io/path/PathUtils.kt b/libraries/stdlib/jdk7/src/kotlin/io/path/PathUtils.kt index 4316fb8ee1b..17536f48ebc 100644 --- a/libraries/stdlib/jdk7/src/kotlin/io/path/PathUtils.kt +++ b/libraries/stdlib/jdk7/src/kotlin/io/path/PathUtils.kt @@ -785,7 +785,7 @@ public inline fun Path.createFile(vararg attributes: FileAttribute<*>): Path = * @param attributes an optional list of file attributes to set atomically when creating the file. * @return the path to the newly created file that did not exist before. * - * @throws UnsupportedOperationException if the array contains an attribute that cannot be set atomically + * @throws UnsupportedOperationException if the array contains an attribute that cannot be set atomically * when creating the file. * * @see Files.createTempFile @@ -800,19 +800,23 @@ public inline fun createTempFile(prefix: String? = null, suffix: String? = null, * Creates an empty file in the specified [directory], using * the given [prefix] and [suffix] to generate its name. * + * @param directory the parent directory in which to create a new file. + * It can be `null`, in that case the new file is created in the default temp directory. * @param attributes an optional list of file attributes to set atomically when creating the file. * @return the path to the newly created file that did not exist before. * - * @throws UnsupportedOperationException if the array contains an attribute that cannot be set atomically + * @throws UnsupportedOperationException if the array contains an attribute that cannot be set atomically * when creating the file. * * @see Files.createTempFile */ @SinceKotlin("1.4") @ExperimentalPathApi -@kotlin.internal.InlineOnly -public inline fun createTempFile(directory: Path, prefix: String? = null, suffix: String? = null, vararg attributes: FileAttribute<*>): Path = - Files.createTempFile(directory, prefix, suffix, *attributes) +public fun createTempFile(directory: Path?, prefix: String? = null, suffix: String? = null, vararg attributes: FileAttribute<*>): Path = + if (directory != null) + Files.createTempFile(directory, prefix, suffix, *attributes) + else + Files.createTempFile(prefix, suffix, *attributes) /** * Creates a new directory in the default temp directory, using the given [prefix] to generate its name. @@ -820,7 +824,7 @@ public inline fun createTempFile(directory: Path, prefix: String? = null, suffix * @param attributes an optional list of file attributes to set atomically when creating the directory. * @return the path to the newly created directory that did not exist before. * - * @throws UnsupportedOperationException if the array contains an attribute that cannot be set atomically + * @throws UnsupportedOperationException if the array contains an attribute that cannot be set atomically * when creating the directory. * * @see Files.createTempDirectory @@ -834,19 +838,23 @@ public inline fun createTempDirectory(prefix: String? = null, vararg attributes: /** * Creates a new directory in the specified [directory], using the given [prefix] to generate its name. * + * @param directory the parent directory in which to create a new directory. + * It can be `null`, in that case the new directory is created in the default temp directory. * @param attributes an optional list of file attributes to set atomically when creating the directory. * @return the path to the newly created directory that did not exist before. * - * @throws UnsupportedOperationException if the array contains an attribute that cannot be set atomically + * @throws UnsupportedOperationException if the array contains an attribute that cannot be set atomically * when creating the directory. * * @see Files.createTempDirectory */ @SinceKotlin("1.4") @ExperimentalPathApi -@kotlin.internal.InlineOnly -public inline fun createTempDirectory(directory: Path, prefix: String? = null, vararg attributes: FileAttribute<*>): Path = - Files.createTempDirectory(directory, prefix, *attributes) +public fun createTempDirectory(directory: Path?, prefix: String? = null, vararg attributes: FileAttribute<*>): Path = + if (directory != null) + Files.createTempDirectory(directory, prefix, *attributes) + else + Files.createTempDirectory(prefix, *attributes) /** * Resolves the given [other] path against this path. diff --git a/libraries/stdlib/jdk7/test/PathExtensionsTest.kt b/libraries/stdlib/jdk7/test/PathExtensionsTest.kt index e7fda78b02b..7c14e214b03 100644 --- a/libraries/stdlib/jdk7/test/PathExtensionsTest.kt +++ b/libraries/stdlib/jdk7/test/PathExtensionsTest.kt @@ -59,6 +59,24 @@ class PathExtensionsTest : AbstractPathTest() { assertFailsWith { file.createFile() } } + @Test + fun createTempFileDefaultDir() { + val file1 = createTempFile().cleanup() + val file2 = createTempFile(directory = null).cleanup() + + assertEquals(file1.parent, file2.parent) + } + + @Test + fun createTempDirectoryDefaultDir() { + val dir1 = createTempDirectory().cleanup() + val dir2 = createTempDirectory(directory = null).cleanupRecursively() + val dir3 = createTempDirectory(dir2) + + assertEquals(dir1.parent, dir2.parent) + assertNotEquals(dir2.parent, dir3.parent) + } + @Test fun copyTo() { val root = createTempDirectory("copyTo-root").cleanupRecursively() diff --git a/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-jdk7.txt b/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-jdk7.txt index 059f0aad4f3..e05528a7486 100644 --- a/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-jdk7.txt +++ b/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-jdk7.txt @@ -4,6 +4,10 @@ public abstract interface annotation class kotlin/io/path/ExperimentalPathApi : public final class kotlin/io/path/PathsKt { public static final fun appendText (Ljava/nio/file/Path;Ljava/lang/CharSequence;Ljava/nio/charset/Charset;)V public static synthetic fun appendText$default (Ljava/nio/file/Path;Ljava/lang/CharSequence;Ljava/nio/charset/Charset;ILjava/lang/Object;)V + public static final fun createTempDirectory (Ljava/nio/file/Path;Ljava/lang/String;[Ljava/nio/file/attribute/FileAttribute;)Ljava/nio/file/Path; + public static synthetic fun createTempDirectory$default (Ljava/nio/file/Path;Ljava/lang/String;[Ljava/nio/file/attribute/FileAttribute;ILjava/lang/Object;)Ljava/nio/file/Path; + public static final fun createTempFile (Ljava/nio/file/Path;Ljava/lang/String;Ljava/lang/String;[Ljava/nio/file/attribute/FileAttribute;)Ljava/nio/file/Path; + public static synthetic fun createTempFile$default (Ljava/nio/file/Path;Ljava/lang/String;Ljava/lang/String;[Ljava/nio/file/attribute/FileAttribute;ILjava/lang/Object;)Ljava/nio/file/Path; public static final fun fileAttributeViewNotAvailable (Ljava/nio/file/Path;Ljava/lang/Class;)Ljava/lang/Void; public static final fun getExtension (Ljava/nio/file/Path;)Ljava/lang/String; public static final fun getInvariantSeparatorsPath (Ljava/nio/file/Path;)Ljava/lang/String; From 0634351fbcb93b238a0a37569adff309107fcd23 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Fri, 20 Nov 2020 05:54:36 +0300 Subject: [PATCH 318/698] Introduce pathString/absolute/absolutePathString Rename invariantSeparatorsPath to invariantSeparatorsPathString to have more consistent names of methods returning path strings. KT-19192 --- .../jdk7/src/kotlin/io/path/PathUtils.kt | 55 ++++++++++++++++++- .../stdlib/jdk7/test/PathExtensionsTest.kt | 15 +++-- .../kotlin-stdlib-jdk7.txt | 1 + 3 files changed, 64 insertions(+), 7 deletions(-) diff --git a/libraries/stdlib/jdk7/src/kotlin/io/path/PathUtils.kt b/libraries/stdlib/jdk7/src/kotlin/io/path/PathUtils.kt index 17536f48ebc..1ee2f7c19fb 100644 --- a/libraries/stdlib/jdk7/src/kotlin/io/path/PathUtils.kt +++ b/libraries/stdlib/jdk7/src/kotlin/io/path/PathUtils.kt @@ -44,17 +44,66 @@ public val Path.extension: String get() = fileName?.toString()?.substringAfterLast('.', "") ?: "" /** - * Returns this path as a [String] using the invariant separator '/' to - * separate the names in the name sequence. + * Returns the string representation of this path. + * + * The returned path string uses the default name [separator][FileSystem.getSeparator] + * to separate names in the path. + * + * This property is a synonym to [Path.toString] function. */ @SinceKotlin("1.4") @ExperimentalPathApi -public val Path.invariantSeparatorsPath: String +@kotlin.internal.InlineOnly +public inline val Path.pathString: String + get() = toString() + +/** + * Returns the string representation of this path using the invariant separator '/' + * to separate names in the path. + */ +@SinceKotlin("1.4") +@ExperimentalPathApi +public val Path.invariantSeparatorsPathString: String get() { val separator = fileSystem.separator return if (separator != "/") toString().replace(separator, "/") else toString() } +// TODO: raise deprecation level and make inline-only +@SinceKotlin("1.4") +@ExperimentalPathApi +@Deprecated("Use invariantSeparatorsPathString property instead.", ReplaceWith("invariantSeparatorsPathString")) +public inline val Path.invariantSeparatorsPath: String + get() = invariantSeparatorsPathString + +/** + * Converts this possibly relative path to an absolute path. + * + * If this path is already [absolute][Path.isAbsolute], returns this path unchanged. + * Otherwise, resolves this path, usually against the default directory of the file system. + * + * May throw an exception if the file system is inaccessible or getting the default directory path is prohibited. + * + * See [Path.toAbsolutePath] for further details about the function contract and possible exceptions. + */ +@SinceKotlin("1.4") +@ExperimentalPathApi +@kotlin.internal.InlineOnly +public inline fun Path.absolute(): Path = toAbsolutePath() + +/** + * Converts this possibly relative path to an absolute path and returns its string representation. + * + * Basically, this method is a combination of calling [absolute] and [pathString]. + * + * May throw an exception if the file system is inaccessible or getting the default directory path is prohibited. + * + * See [Path.toAbsolutePath] for further details about the function contract and possible exceptions. + */ +@SinceKotlin("1.4") +@ExperimentalPathApi +@kotlin.internal.InlineOnly +public inline fun Path.absolutePathString(): String = toAbsolutePath().toString() /** * Calculates the relative path for this path from a [base] path. diff --git a/libraries/stdlib/jdk7/test/PathExtensionsTest.kt b/libraries/stdlib/jdk7/test/PathExtensionsTest.kt index 7c14e214b03..c4d875c2da1 100644 --- a/libraries/stdlib/jdk7/test/PathExtensionsTest.kt +++ b/libraries/stdlib/jdk7/test/PathExtensionsTest.kt @@ -38,10 +38,10 @@ class PathExtensionsTest : AbstractPathTest() { @Test fun invariantSeparators() { val path = Path("base") / "nested" / "leaf" - assertEquals("base/nested/leaf", path.invariantSeparatorsPath) + assertEquals("base/nested/leaf", path.invariantSeparatorsPathString) - val path2 = Path("base", "nested", "leaf") - assertEquals("base/nested/leaf", path2.invariantSeparatorsPath) + val path2 = Path("base", "nested", "terminal") + assertEquals("base/nested/terminal", path2.invariantSeparatorsPathString) } @Test @@ -149,7 +149,7 @@ class PathExtensionsTest : AbstractPathTest() { @Test fun copyToNameWithoutParent() { - val currentDir = Path("").toAbsolutePath() + val currentDir = Path("").absolute() val srcFile = createTempFile().cleanup() val dstFile = createTempFile(directory = currentDir).cleanup() @@ -580,4 +580,11 @@ class PathExtensionsTest : AbstractPathTest() { testRelativeTo("foo/bar", "../../foo/bar", "../../sub/../.") testRelativeTo(null, "../../foo/bar", "../../sub/../..") } + + @Test + fun absolutePaths() { + val relative = Path("./example") + assertTrue(relative.absolute().isAbsolute) + assertEquals(relative.absolute().pathString, relative.absolutePathString()) + } } diff --git a/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-jdk7.txt b/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-jdk7.txt index e05528a7486..024e3f41c31 100644 --- a/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-jdk7.txt +++ b/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-jdk7.txt @@ -11,6 +11,7 @@ public final class kotlin/io/path/PathsKt { public static final fun fileAttributeViewNotAvailable (Ljava/nio/file/Path;Ljava/lang/Class;)Ljava/lang/Void; public static final fun getExtension (Ljava/nio/file/Path;)Ljava/lang/String; public static final fun getInvariantSeparatorsPath (Ljava/nio/file/Path;)Ljava/lang/String; + public static final fun getInvariantSeparatorsPathString (Ljava/nio/file/Path;)Ljava/lang/String; public static final fun getName (Ljava/nio/file/Path;)Ljava/lang/String; public static final fun getNameWithoutExtension (Ljava/nio/file/Path;)Ljava/lang/String; public static final fun listDirectoryEntries (Ljava/nio/file/Path;Ljava/lang/String;)Ljava/util/List; From e39560b1345bb6211986ee6d8f85214f43bc6b4c Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Wed, 18 Nov 2020 15:23:45 +0700 Subject: [PATCH 319/698] [KT-43276] Add watchos_x64 target --- .../KotlinMPPGradleProjectResolver.kt | 2 +- .../generators/gradle/dsl/presetEntries.kt | 5 +- ...otlinTargetContainerWithPresetFunctions.kt | 189 ++++++++++-------- .../plugin/mpp/KotlinMultiplatformPlugin.kt | 4 +- .../native/KotlinNativeTargetConfigurator.kt | 1 + .../targets/native/tasks/CocoapodsTasks.kt | 2 +- 6 files changed, 112 insertions(+), 91 deletions(-) diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/configuration/KotlinMPPGradleProjectResolver.kt b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/configuration/KotlinMPPGradleProjectResolver.kt index 353332918fe..8118c9e688e 100644 --- a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/configuration/KotlinMPPGradleProjectResolver.kt +++ b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/configuration/KotlinMPPGradleProjectResolver.kt @@ -729,7 +729,7 @@ open class KotlinMPPGradleProjectResolver : AbstractProjectResolverExtensionComp val copyFrom = when { compilations.all { it.isAppleCompilation } -> compilations.selectFirstAvailableTarget( - "watchos_arm64", "watchos_arm32", "watchos_x86", + "watchos_arm64", "watchos_arm32", "watchos_x64", "watchos_x86", "ios_arm64", "ios_arm32", "ios_x64", "tvos_arm64", "tvos_x64" ) diff --git a/libraries/tools/kotlin-gradle-plugin-dsl-codegen/src/main/kotlin/org/jetbrains/kotlin/generators/gradle/dsl/presetEntries.kt b/libraries/tools/kotlin-gradle-plugin-dsl-codegen/src/main/kotlin/org/jetbrains/kotlin/generators/gradle/dsl/presetEntries.kt index 4c399d9ad4a..db34ca4e9b3 100644 --- a/libraries/tools/kotlin-gradle-plugin-dsl-codegen/src/main/kotlin/org/jetbrains/kotlin/generators/gradle/dsl/presetEntries.kt +++ b/libraries/tools/kotlin-gradle-plugin-dsl-codegen/src/main/kotlin/org/jetbrains/kotlin/generators/gradle/dsl/presetEntries.kt @@ -49,11 +49,10 @@ internal val androidPresetEntry = KotlinPresetEntry( // Note: modifying these sets should also be reflected in the MPP plugin code, see 'setupDefaultPresets' private val nativeTargetsWithHostTests = setOf(KonanTarget.LINUX_X64, KonanTarget.MACOS_X64, KonanTarget.MINGW_X64) -private val nativeTargetsWithSimulatorTests = setOf(KonanTarget.IOS_X64, KonanTarget.WATCHOS_X86, KonanTarget.TVOS_X64) -private val disabledNativeTargets = setOf(KonanTarget.WATCHOS_X64) +private val nativeTargetsWithSimulatorTests = + setOf(KonanTarget.IOS_X64, KonanTarget.WATCHOS_X86, KonanTarget.WATCHOS_X64, KonanTarget.TVOS_X64) internal val nativePresetEntries = HostManager().targets - .filter { (_, target) -> target !in disabledNativeTargets } .map { (_, target) -> val (presetType, targetType) = when (target) { diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinTargetContainerWithPresetFunctions.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinTargetContainerWithPresetFunctions.kt index c80d377663e..1760e84213d 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinTargetContainerWithPresetFunctions.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinTargetContainerWithPresetFunctions.kt @@ -3,7 +3,15 @@ package org.jetbrains.kotlin.gradle.dsl import groovy.lang.Closure import org.gradle.util.ConfigureUtil import org.jetbrains.kotlin.gradle.plugin.KotlinTargetsContainerWithPresets -import org.jetbrains.kotlin.gradle.plugin.mpp.* +import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinAndroidTarget +import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinAndroidTargetPreset +import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJvmTargetPreset +import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget +import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetPreset +import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetWithHostTests +import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetWithHostTestsPreset +import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetWithSimulatorTests +import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetWithSimulatorTestsPreset import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget // DO NOT EDIT MANUALLY! Generated by org.jetbrains.kotlin.generators.gradle.dsl.MppPresetFunctionsCodegenKt @@ -40,6 +48,36 @@ interface KotlinTargetContainerWithPresetFunctions : KotlinTargetsContainerWithP fun android(name: String, configure: Closure<*>) = android(name) { ConfigureUtil.configure(configure, this) } fun android(configure: Closure<*>) = android { ConfigureUtil.configure(configure, this) } + fun androidNativeX64( + name: String = "androidNativeX64", + configure: KotlinNativeTarget.() -> Unit = { } + ): KotlinNativeTarget = + configureOrCreate( + name, + presets.getByName("androidNativeX64") as KotlinNativeTargetPreset, + configure + ) + + fun androidNativeX64() = androidNativeX64("androidNativeX64") { } + fun androidNativeX64(name: String) = androidNativeX64(name) { } + fun androidNativeX64(name: String, configure: Closure<*>) = androidNativeX64(name) { ConfigureUtil.configure(configure, this) } + fun androidNativeX64(configure: Closure<*>) = androidNativeX64 { ConfigureUtil.configure(configure, this) } + + fun androidNativeX86( + name: String = "androidNativeX86", + configure: KotlinNativeTarget.() -> Unit = { } + ): KotlinNativeTarget = + configureOrCreate( + name, + presets.getByName("androidNativeX86") as KotlinNativeTargetPreset, + configure + ) + + fun androidNativeX86() = androidNativeX86("androidNativeX86") { } + fun androidNativeX86(name: String) = androidNativeX86(name) { } + fun androidNativeX86(name: String, configure: Closure<*>) = androidNativeX86(name) { ConfigureUtil.configure(configure, this) } + fun androidNativeX86(configure: Closure<*>) = androidNativeX86 { ConfigureUtil.configure(configure, this) } + fun androidNativeArm32( name: String = "androidNativeArm32", configure: KotlinNativeTarget.() -> Unit = { } @@ -70,36 +108,6 @@ interface KotlinTargetContainerWithPresetFunctions : KotlinTargetsContainerWithP fun androidNativeArm64(name: String, configure: Closure<*>) = androidNativeArm64(name) { ConfigureUtil.configure(configure, this) } fun androidNativeArm64(configure: Closure<*>) = androidNativeArm64 { ConfigureUtil.configure(configure, this) } - fun androidNativeX86( - name: String = "androidNativeX86", - configure: KotlinNativeTarget.() -> Unit = { } - ): KotlinNativeTarget = - configureOrCreate( - name, - presets.getByName("androidNativeX86") as KotlinNativeTargetPreset, - configure - ) - - fun androidNativeX86() = androidNativeX86("androidNativeX86") { } - fun androidNativeX86(name: String) = androidNativeX86(name) { } - fun androidNativeX86(name: String, configure: Closure<*>) = androidNativeX86(name) { ConfigureUtil.configure(configure, this) } - fun androidNativeX86(configure: Closure<*>) = androidNativeX86 { ConfigureUtil.configure(configure, this) } - - fun androidNativeX64( - name: String = "androidNativeX64", - configure: KotlinNativeTarget.() -> Unit = { } - ): KotlinNativeTarget = - configureOrCreate( - name, - presets.getByName("androidNativeX64") as KotlinNativeTargetPreset, - configure - ) - - fun androidNativeX64() = androidNativeX64("androidNativeX64") { } - fun androidNativeX64(name: String) = androidNativeX64(name) { } - fun androidNativeX64(name: String, configure: Closure<*>) = androidNativeX64(name) { ConfigureUtil.configure(configure, this) } - fun androidNativeX64(configure: Closure<*>) = androidNativeX64 { ConfigureUtil.configure(configure, this) } - fun iosArm32( name: String = "iosArm32", configure: KotlinNativeTarget.() -> Unit = { } @@ -190,6 +198,21 @@ interface KotlinTargetContainerWithPresetFunctions : KotlinTargetsContainerWithP fun watchosX86(name: String, configure: Closure<*>) = watchosX86(name) { ConfigureUtil.configure(configure, this) } fun watchosX86(configure: Closure<*>) = watchosX86 { ConfigureUtil.configure(configure, this) } + fun watchosX64( + name: String = "watchosX64", + configure: KotlinNativeTargetWithSimulatorTests.() -> Unit = { } + ): KotlinNativeTargetWithSimulatorTests = + configureOrCreate( + name, + presets.getByName("watchosX64") as KotlinNativeTargetWithSimulatorTestsPreset, + configure + ) + + fun watchosX64() = watchosX64("watchosX64") { } + fun watchosX64(name: String) = watchosX64(name) { } + fun watchosX64(name: String, configure: Closure<*>) = watchosX64(name) { ConfigureUtil.configure(configure, this) } + fun watchosX64(configure: Closure<*>) = watchosX64 { ConfigureUtil.configure(configure, this) } + fun tvosArm64( name: String = "tvosArm64", configure: KotlinNativeTarget.() -> Unit = { } @@ -235,20 +258,50 @@ interface KotlinTargetContainerWithPresetFunctions : KotlinTargetsContainerWithP fun linuxX64(name: String, configure: Closure<*>) = linuxX64(name) { ConfigureUtil.configure(configure, this) } fun linuxX64(configure: Closure<*>) = linuxX64 { ConfigureUtil.configure(configure, this) } - fun linuxArm32Hfp( - name: String = "linuxArm32Hfp", + fun mingwX86( + name: String = "mingwX86", configure: KotlinNativeTarget.() -> Unit = { } ): KotlinNativeTarget = configureOrCreate( name, - presets.getByName("linuxArm32Hfp") as KotlinNativeTargetPreset, + presets.getByName("mingwX86") as KotlinNativeTargetPreset, configure ) - fun linuxArm32Hfp() = linuxArm32Hfp("linuxArm32Hfp") { } - fun linuxArm32Hfp(name: String) = linuxArm32Hfp(name) { } - fun linuxArm32Hfp(name: String, configure: Closure<*>) = linuxArm32Hfp(name) { ConfigureUtil.configure(configure, this) } - fun linuxArm32Hfp(configure: Closure<*>) = linuxArm32Hfp { ConfigureUtil.configure(configure, this) } + fun mingwX86() = mingwX86("mingwX86") { } + fun mingwX86(name: String) = mingwX86(name) { } + fun mingwX86(name: String, configure: Closure<*>) = mingwX86(name) { ConfigureUtil.configure(configure, this) } + fun mingwX86(configure: Closure<*>) = mingwX86 { ConfigureUtil.configure(configure, this) } + + fun mingwX64( + name: String = "mingwX64", + configure: KotlinNativeTargetWithHostTests.() -> Unit = { } + ): KotlinNativeTargetWithHostTests = + configureOrCreate( + name, + presets.getByName("mingwX64") as KotlinNativeTargetWithHostTestsPreset, + configure + ) + + fun mingwX64() = mingwX64("mingwX64") { } + fun mingwX64(name: String) = mingwX64(name) { } + fun mingwX64(name: String, configure: Closure<*>) = mingwX64(name) { ConfigureUtil.configure(configure, this) } + fun mingwX64(configure: Closure<*>) = mingwX64 { ConfigureUtil.configure(configure, this) } + + fun macosX64( + name: String = "macosX64", + configure: KotlinNativeTargetWithHostTests.() -> Unit = { } + ): KotlinNativeTargetWithHostTests = + configureOrCreate( + name, + presets.getByName("macosX64") as KotlinNativeTargetWithHostTestsPreset, + configure + ) + + fun macosX64() = macosX64("macosX64") { } + fun macosX64(name: String) = macosX64(name) { } + fun macosX64(name: String, configure: Closure<*>) = macosX64(name) { ConfigureUtil.configure(configure, this) } + fun macosX64(configure: Closure<*>) = macosX64 { ConfigureUtil.configure(configure, this) } fun linuxArm64( name: String = "linuxArm64", @@ -265,6 +318,21 @@ interface KotlinTargetContainerWithPresetFunctions : KotlinTargetsContainerWithP fun linuxArm64(name: String, configure: Closure<*>) = linuxArm64(name) { ConfigureUtil.configure(configure, this) } fun linuxArm64(configure: Closure<*>) = linuxArm64 { ConfigureUtil.configure(configure, this) } + fun linuxArm32Hfp( + name: String = "linuxArm32Hfp", + configure: KotlinNativeTarget.() -> Unit = { } + ): KotlinNativeTarget = + configureOrCreate( + name, + presets.getByName("linuxArm32Hfp") as KotlinNativeTargetPreset, + configure + ) + + fun linuxArm32Hfp() = linuxArm32Hfp("linuxArm32Hfp") { } + fun linuxArm32Hfp(name: String) = linuxArm32Hfp(name) { } + fun linuxArm32Hfp(name: String, configure: Closure<*>) = linuxArm32Hfp(name) { ConfigureUtil.configure(configure, this) } + fun linuxArm32Hfp(configure: Closure<*>) = linuxArm32Hfp { ConfigureUtil.configure(configure, this) } + fun linuxMips32( name: String = "linuxMips32", configure: KotlinNativeTarget.() -> Unit = { } @@ -295,51 +363,6 @@ interface KotlinTargetContainerWithPresetFunctions : KotlinTargetsContainerWithP fun linuxMipsel32(name: String, configure: Closure<*>) = linuxMipsel32(name) { ConfigureUtil.configure(configure, this) } fun linuxMipsel32(configure: Closure<*>) = linuxMipsel32 { ConfigureUtil.configure(configure, this) } - fun mingwX64( - name: String = "mingwX64", - configure: KotlinNativeTargetWithHostTests.() -> Unit = { } - ): KotlinNativeTargetWithHostTests = - configureOrCreate( - name, - presets.getByName("mingwX64") as KotlinNativeTargetWithHostTestsPreset, - configure - ) - - fun mingwX64() = mingwX64("mingwX64") { } - fun mingwX64(name: String) = mingwX64(name) { } - fun mingwX64(name: String, configure: Closure<*>) = mingwX64(name) { ConfigureUtil.configure(configure, this) } - fun mingwX64(configure: Closure<*>) = mingwX64 { ConfigureUtil.configure(configure, this) } - - fun mingwX86( - name: String = "mingwX86", - configure: KotlinNativeTarget.() -> Unit = { } - ): KotlinNativeTarget = - configureOrCreate( - name, - presets.getByName("mingwX86") as KotlinNativeTargetPreset, - configure - ) - - fun mingwX86() = mingwX86("mingwX86") { } - fun mingwX86(name: String) = mingwX86(name) { } - fun mingwX86(name: String, configure: Closure<*>) = mingwX86(name) { ConfigureUtil.configure(configure, this) } - fun mingwX86(configure: Closure<*>) = mingwX86 { ConfigureUtil.configure(configure, this) } - - fun macosX64( - name: String = "macosX64", - configure: KotlinNativeTargetWithHostTests.() -> Unit = { } - ): KotlinNativeTargetWithHostTests = - configureOrCreate( - name, - presets.getByName("macosX64") as KotlinNativeTargetWithHostTestsPreset, - configure - ) - - fun macosX64() = macosX64("macosX64") { } - fun macosX64(name: String) = macosX64(name) { } - fun macosX64(name: String, configure: Closure<*>) = macosX64(name) { ConfigureUtil.configure(configure, this) } - fun macosX64(configure: Closure<*>) = macosX64 { ConfigureUtil.configure(configure, this) } - fun wasm32( name: String = "wasm32", configure: KotlinNativeTarget.() -> Unit = { } diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/KotlinMultiplatformPlugin.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/KotlinMultiplatformPlugin.kt index 8fc0ace3c2a..3be776ad08e 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/KotlinMultiplatformPlugin.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/KotlinMultiplatformPlugin.kt @@ -183,11 +183,9 @@ class KotlinMultiplatformPlugin( // Note: modifying these sets should also be reflected in the DSL code generator, see 'presetEntries.kt' val nativeTargetsWithHostTests = setOf(LINUX_X64, MACOS_X64, MINGW_X64) - val nativeTargetsWithSimulatorTests = setOf(IOS_X64, WATCHOS_X86, TVOS_X64) - val disabledNativeTargets = setOf(WATCHOS_X64) + val nativeTargetsWithSimulatorTests = setOf(IOS_X64, WATCHOS_X86, WATCHOS_X64, TVOS_X64) HostManager().targets - .filter { (_, konanTarget) -> konanTarget !in disabledNativeTargets } .forEach { (_, konanTarget) -> val targetToAdd = when (konanTarget) { in nativeTargetsWithHostTests -> diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/KotlinNativeTargetConfigurator.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/KotlinNativeTargetConfigurator.kt index 5a593a75b37..2c9c5d79472 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/KotlinNativeTargetConfigurator.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/KotlinNativeTargetConfigurator.kt @@ -514,6 +514,7 @@ class KotlinNativeTargetWithSimulatorTestsConfigurator(kotlinPluginVersion: Stri testTask.deviceId = when (target.konanTarget) { KonanTarget.IOS_X64 -> "iPhone 8" KonanTarget.WATCHOS_X86 -> "Apple Watch Series 5 - 44mm" + KonanTarget.WATCHOS_X64 -> "Apple Watch Series 5 - 44mm" KonanTarget.TVOS_X64 -> "Apple TV" else -> error("Simulator tests are not supported for platform ${target.konanTarget.name}") } diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/tasks/CocoapodsTasks.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/tasks/CocoapodsTasks.kt index 0bb529d7438..0c95b11bf8e 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/tasks/CocoapodsTasks.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/tasks/CocoapodsTasks.kt @@ -136,7 +136,7 @@ open class PodspecTask : DefaultTask() { | spec.pod_target_xcconfig = { | 'KOTLIN_TARGET[sdk=iphonesimulator*]' => 'ios_x64', | 'KOTLIN_TARGET[sdk=iphoneos*]' => '$KOTLIN_TARGET_FOR_IOS_DEVICE', - | 'KOTLIN_TARGET[sdk=watchsimulator*]' => 'watchos_x86', + | 'KOTLIN_TARGET[sdk=watchsimulator*]' => 'watchos_x64', | 'KOTLIN_TARGET[sdk=watchos*]' => '$KOTLIN_TARGET_FOR_WATCHOS_DEVICE', | 'KOTLIN_TARGET[sdk=appletvsimulator*]' => 'tvos_x64', | 'KOTLIN_TARGET[sdk=appletvos*]' => 'tvos_arm64', From f3424a98b7bfdc591d5e40163d0953a2d842a160 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Thu, 19 Nov 2020 14:40:11 +0700 Subject: [PATCH 320/698] generateMppTargetContainerWithPresets: remove unneeded hack --- .../tools/kotlin-gradle-plugin-dsl-codegen/build.gradle.kts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin-dsl-codegen/build.gradle.kts b/libraries/tools/kotlin-gradle-plugin-dsl-codegen/build.gradle.kts index ec4cfa47341..0095c218ffc 100644 --- a/libraries/tools/kotlin-gradle-plugin-dsl-codegen/build.gradle.kts +++ b/libraries/tools/kotlin-gradle-plugin-dsl-codegen/build.gradle.kts @@ -27,7 +27,3 @@ listOf(generateMppTargetContainerWithPresets, generateAbstractBinaryContainer).f ) } -// Workaround: 'java -jar' refuses to read the original dotted filename on Windows, 'Unable to access jarFile org.jetbrains.kotlin....jar' -tasks.named(generateMppTargetContainerWithPresets.name + "WriteClassPath").configure { - archiveName = generateMppTargetContainerWithPresets.name -} From d6f54a773076ae566de180581f5fa73e569daf59 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Fri, 27 Nov 2020 19:10:11 +0700 Subject: [PATCH 321/698] [KT-43276] Fix `watchos` target shortcut. --- .../dsl/KotlinTargetContainerWithNativeShortcuts.kt | 2 +- .../native/internal/KotlinNativePlatformDependencies.kt | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinTargetContainerWithNativeShortcuts.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinTargetContainerWithNativeShortcuts.kt index 82064e0a74f..dd529b732c8 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinTargetContainerWithNativeShortcuts.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinTargetContainerWithNativeShortcuts.kt @@ -94,7 +94,7 @@ interface KotlinTargetContainerWithNativeShortcuts : KotlinTargetContainerWithPr ) { val device32 = watchosArm32("${namePrefix}Arm32") val device64 = watchosArm64("${namePrefix}Arm64") - val simulator = watchosX86("${namePrefix}X86") + val simulator = watchosX64("${namePrefix}X64") val deviceTargets = listOf(device32, device64) val deviceSourceSets = createIntermediateSourceSets( diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/internal/KotlinNativePlatformDependencies.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/internal/KotlinNativePlatformDependencies.kt index 3040e9c184b..e066a9ba6dd 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/internal/KotlinNativePlatformDependencies.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/internal/KotlinNativePlatformDependencies.kt @@ -285,16 +285,16 @@ private fun Project.findSourceSetsToAddCommonizedPlatformDependencies(): Map two commonized targets: watchosArm32 and watchosArm64. * @@ -302,7 +302,7 @@ private fun Project.findSourceSetsToAddCommonizedPlatformDependencies(): Map Date: Fri, 27 Nov 2020 19:32:28 +0700 Subject: [PATCH 322/698] [KT-43276] Update tests to support watchos_x64 --- .../org/jetbrains/kotlin/gradle/native/CocoaPodsIT.kt | 4 ++-- .../org/jetbrains/kotlin/gradle/native/CommonNativeIT.kt | 4 ++-- .../org/jetbrains/kotlin/gradle/native/FatFrameworkIT.kt | 6 +++--- .../{watchosX86Main => watchosX64Main}/kotlin/simulator.kt | 0 .../kotlin/simulator.kt | 0 5 files changed, 7 insertions(+), 7 deletions(-) rename libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/native-apple-devices-common/common-watchos/app/src/{watchosX86Main => watchosX64Main}/kotlin/simulator.kt (100%) rename libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/native-apple-devices-common/common-watchos/lib/src/{watchosLibX86Main => watchosLibX64Main}/kotlin/simulator.kt (100%) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/CocoaPodsIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/CocoaPodsIT.kt index 7d50d6b448d..22eb9cf3fea 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/CocoaPodsIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/CocoaPodsIT.kt @@ -1270,7 +1270,7 @@ class CocoaPodsIT : BaseGradleIT() { spec.pod_target_xcconfig = { 'KOTLIN_TARGET[sdk=iphonesimulator*]' => 'ios_x64', 'KOTLIN_TARGET[sdk=iphoneos*]' => 'ios_arm', - 'KOTLIN_TARGET[sdk=watchsimulator*]' => 'watchos_x86', + 'KOTLIN_TARGET[sdk=watchsimulator*]' => 'watchos_x64', 'KOTLIN_TARGET[sdk=watchos*]' => 'watchos_arm', 'KOTLIN_TARGET[sdk=appletvsimulator*]' => 'tvos_x64', 'KOTLIN_TARGET[sdk=appletvos*]' => 'tvos_arm64', @@ -1312,7 +1312,7 @@ class CocoaPodsIT : BaseGradleIT() { spec.pod_target_xcconfig = { 'KOTLIN_TARGET[sdk=iphonesimulator*]' => 'ios_x64', 'KOTLIN_TARGET[sdk=iphoneos*]' => 'ios_arm', - 'KOTLIN_TARGET[sdk=watchsimulator*]' => 'watchos_x86', + 'KOTLIN_TARGET[sdk=watchsimulator*]' => 'watchos_x64', 'KOTLIN_TARGET[sdk=watchos*]' => 'watchos_arm', 'KOTLIN_TARGET[sdk=appletvsimulator*]' => 'tvos_x64', 'KOTLIN_TARGET[sdk=appletvos*]' => 'tvos_arm64', diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/CommonNativeIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/CommonNativeIT.kt index f7d50c756a2..00eb012ee2c 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/CommonNativeIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/CommonNativeIT.kt @@ -66,8 +66,8 @@ class CommonNativeIT : BaseGradleIT() { fun testCommonWatchos() { doCommonNativeTest( "common-watchos", - libTargets = listOf("watchosLibArm32", "watchosLibArm64", "watchosLibX86"), - appTargets = listOf("watchosArm32", "watchosArm64", "watchosX86") + libTargets = listOf("watchosLibArm32", "watchosLibArm64", "watchosLibX64"), + appTargets = listOf("watchosArm32", "watchosArm64", "watchosX64") ) } diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/FatFrameworkIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/FatFrameworkIT.kt index d53e2d903a5..7693d52c788 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/FatFrameworkIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/FatFrameworkIT.kt @@ -51,12 +51,12 @@ class FatFrameworkIT : BaseGradleIT() { gradleBuildScript().modify { it.checkedReplace("iosArm32()", "watchosArm32()") .checkedReplace("iosArm64()", "watchosArm64()") - .checkedReplace("iosX64()", "watchosX86()") + .checkedReplace("iosX64()", "watchosX64()") } build("fat") { checkSmokeBuild( - archs = listOf("x86", "arm64", "arm32"), + archs = listOf("x64", "arm64", "arm32"), targetPrefix = "watchos", expectedPlistPlatform = "WatchOS" ) @@ -64,7 +64,7 @@ class FatFrameworkIT : BaseGradleIT() { val binary = fileInWorkingDir("build/fat-framework/smoke.framework/smoke") with(runProcess(listOf("file", binary.absolutePath), projectDir)) { assertTrue(isSuccessful) - assertTrue(output.contains("\\(for architecture i386\\):\\s+Mach-O dynamically linked shared library i386".toRegex())) + assertTrue(output.contains("\\(for architecture x86_64\\):\\s+Mach-O 64-bit dynamically linked shared library x86_64".toRegex())) assertTrue(output.contains("\\(for architecture armv7k\\):\\s+Mach-O dynamically linked shared library arm_v7k".toRegex())) assertTrue(output.contains("\\(for architecture arm64_32\\):\\s+Mach-O dynamically linked shared library arm64_32_v8".toRegex())) } diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/native-apple-devices-common/common-watchos/app/src/watchosX86Main/kotlin/simulator.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/native-apple-devices-common/common-watchos/app/src/watchosX64Main/kotlin/simulator.kt similarity index 100% rename from libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/native-apple-devices-common/common-watchos/app/src/watchosX86Main/kotlin/simulator.kt rename to libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/native-apple-devices-common/common-watchos/app/src/watchosX64Main/kotlin/simulator.kt diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/native-apple-devices-common/common-watchos/lib/src/watchosLibX86Main/kotlin/simulator.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/native-apple-devices-common/common-watchos/lib/src/watchosLibX64Main/kotlin/simulator.kt similarity index 100% rename from libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/native-apple-devices-common/common-watchos/lib/src/watchosLibX86Main/kotlin/simulator.kt rename to libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/native-apple-devices-common/common-watchos/lib/src/watchosLibX64Main/kotlin/simulator.kt From 29bed39a54c756f18cf1a18f759e5e2b1153997c Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Fri, 27 Nov 2020 19:39:58 +0700 Subject: [PATCH 323/698] Bump to native version version with watchos_x64 enabled --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 5c1fa82d816..cbaab956952 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -188,7 +188,7 @@ extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion extra["versions.ktor-network"] = "1.0.1" if (!project.hasProperty("versions.kotlin-native")) { - extra["versions.kotlin-native"] = "1.4.30-dev-17200" + extra["versions.kotlin-native"] = "1.4.30-dev-17395" } val intellijUltimateEnabled by extra(project.kotlinBuildProperties.intellijUltimateEnabled) From 8a00470b40bd859a05e9064a3e8cd80e1ee793e0 Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Sun, 29 Nov 2020 20:41:34 +0100 Subject: [PATCH 324/698] Enable kotlin-annotation-processing-base tests on TC --- build.gradle.kts | 1 + plugins/kapt3/kapt3-base/build.gradle.kts | 3 +++ 2 files changed, 4 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index cbaab956952..4e41f4ea3b7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -854,6 +854,7 @@ tasks { register("kaptIdeTest") { dependsOn(":kotlin-annotation-processing:test") + dependsOn(":kotlin-annotation-processing-base:test") } register("gradleIdeTest") { diff --git a/plugins/kapt3/kapt3-base/build.gradle.kts b/plugins/kapt3/kapt3-base/build.gradle.kts index 74eac71849c..202296c7b47 100644 --- a/plugins/kapt3/kapt3-base/build.gradle.kts +++ b/plugins/kapt3/kapt3-base/build.gradle.kts @@ -9,6 +9,9 @@ dependencies { testCompile(commonDep("junit:junit")) testCompileOnly(toolsJarApi()) + testRuntimeOnly(toolsJar()) + + testCompileOnly(toolsJarApi()) } sourceSets { From e127ea3dadd54dda622115af8899649489f62d3e Mon Sep 17 00:00:00 2001 From: Roman Golyshev Date: Fri, 27 Nov 2020 18:08:40 +0300 Subject: [PATCH 325/698] FIR IDE: Add tests for resolving from nested types references Some of those tests are failing in the FIR IDE --- .../FirReferenceResolveTestGenerated.java | 58 +++++++++++++++++++ .../ResolveCompanionInCompanionType.kt | 11 ++++ .../nestedTypes/ResolveEndOfPackageInType.kt | 11 ++++ .../ResolveMiddleOfPackageInType.kt | 11 ++++ .../ResolveStartOfPackageInType.kt | 11 ++++ .../nestedTypes/ResolveTypeInTheEndOfType.kt | 11 ++++ .../ResolveTypeInTheMiddleOfCompanionType.kt | 11 ++++ .../ResolveTypeInTheMiddleOfType.kt | 11 ++++ .../ResolveTypeInTheStartOfCompanionType.kt | 11 ++++ .../ResolveTypeInTheStartOfType.kt | 11 ++++ .../ReferenceResolveTestGenerated.java | 58 +++++++++++++++++++ 11 files changed, 215 insertions(+) create mode 100644 idea/testData/resolve/references/nestedTypes/ResolveCompanionInCompanionType.kt create mode 100644 idea/testData/resolve/references/nestedTypes/ResolveEndOfPackageInType.kt create mode 100644 idea/testData/resolve/references/nestedTypes/ResolveMiddleOfPackageInType.kt create mode 100644 idea/testData/resolve/references/nestedTypes/ResolveStartOfPackageInType.kt create mode 100644 idea/testData/resolve/references/nestedTypes/ResolveTypeInTheEndOfType.kt create mode 100644 idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfCompanionType.kt create mode 100644 idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfType.kt create mode 100644 idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfCompanionType.kt create mode 100644 idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfType.kt diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/resolve/FirReferenceResolveTestGenerated.java b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/resolve/FirReferenceResolveTestGenerated.java index c7b1ae98e91..0a7e14a1134 100644 --- a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/resolve/FirReferenceResolveTestGenerated.java +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/resolve/FirReferenceResolveTestGenerated.java @@ -707,4 +707,62 @@ public class FirReferenceResolveTestGenerated extends AbstractFirReferenceResolv runTest("idea/testData/resolve/references/invoke/oneParamRPar.kt"); } } + + @TestMetadata("idea/testData/resolve/references/nestedTypes") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class NestedTypes extends AbstractFirReferenceResolveTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInNestedTypes() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/resolve/references/nestedTypes"), Pattern.compile("^([^.]+)\\.kt$"), null, true); + } + + @TestMetadata("ResolveCompanionInCompanionType.kt") + public void testResolveCompanionInCompanionType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveCompanionInCompanionType.kt"); + } + + @TestMetadata("ResolveEndOfPackageInType.kt") + public void testResolveEndOfPackageInType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveEndOfPackageInType.kt"); + } + + @TestMetadata("ResolveMiddleOfPackageInType.kt") + public void testResolveMiddleOfPackageInType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveMiddleOfPackageInType.kt"); + } + + @TestMetadata("ResolveStartOfPackageInType.kt") + public void testResolveStartOfPackageInType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveStartOfPackageInType.kt"); + } + + @TestMetadata("ResolveTypeInTheEndOfType.kt") + public void testResolveTypeInTheEndOfType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheEndOfType.kt"); + } + + @TestMetadata("ResolveTypeInTheMiddleOfCompanionType.kt") + public void testResolveTypeInTheMiddleOfCompanionType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfCompanionType.kt"); + } + + @TestMetadata("ResolveTypeInTheMiddleOfType.kt") + public void testResolveTypeInTheMiddleOfType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfType.kt"); + } + + @TestMetadata("ResolveTypeInTheStartOfCompanionType.kt") + public void testResolveTypeInTheStartOfCompanionType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfCompanionType.kt"); + } + + @TestMetadata("ResolveTypeInTheStartOfType.kt") + public void testResolveTypeInTheStartOfType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfType.kt"); + } + } } diff --git a/idea/testData/resolve/references/nestedTypes/ResolveCompanionInCompanionType.kt b/idea/testData/resolve/references/nestedTypes/ResolveCompanionInCompanionType.kt new file mode 100644 index 00000000000..1ecc8f1bb2c --- /dev/null +++ b/idea/testData/resolve/references/nestedTypes/ResolveCompanionInCompanionType.kt @@ -0,0 +1,11 @@ +package foo.bar.baz + +class AA { + class BB { + companion object + } +} + +fun test(param: foo.bar.baz.AA.BB.Companion) {} + +// REF: companion object of (in foo.bar.baz.AA).BB diff --git a/idea/testData/resolve/references/nestedTypes/ResolveEndOfPackageInType.kt b/idea/testData/resolve/references/nestedTypes/ResolveEndOfPackageInType.kt new file mode 100644 index 00000000000..25e22c34f2e --- /dev/null +++ b/idea/testData/resolve/references/nestedTypes/ResolveEndOfPackageInType.kt @@ -0,0 +1,11 @@ +package foo.bar.baz + +class AA { + class BB { + class CC + } +} + +fun test(param: foo.bar.baz.AA.BB.CC) {} + +// REF: baz diff --git a/idea/testData/resolve/references/nestedTypes/ResolveMiddleOfPackageInType.kt b/idea/testData/resolve/references/nestedTypes/ResolveMiddleOfPackageInType.kt new file mode 100644 index 00000000000..9edddf26708 --- /dev/null +++ b/idea/testData/resolve/references/nestedTypes/ResolveMiddleOfPackageInType.kt @@ -0,0 +1,11 @@ +package foo.bar.baz + +class AA { + class BB { + class CC + } +} + +fun test(param: foo.bar.baz.AA.BB.CC) {} + +// REF: bar diff --git a/idea/testData/resolve/references/nestedTypes/ResolveStartOfPackageInType.kt b/idea/testData/resolve/references/nestedTypes/ResolveStartOfPackageInType.kt new file mode 100644 index 00000000000..ae9e8f72537 --- /dev/null +++ b/idea/testData/resolve/references/nestedTypes/ResolveStartOfPackageInType.kt @@ -0,0 +1,11 @@ +package foo.bar.baz + +class AA { + class BB { + class CC + } +} + +fun test(param: foo.bar.baz.AA.BB.CC) {} + +// REF: foo diff --git a/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheEndOfType.kt b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheEndOfType.kt new file mode 100644 index 00000000000..bea01a7ff4f --- /dev/null +++ b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheEndOfType.kt @@ -0,0 +1,11 @@ +package foo.bar.baz + +class AA { + class BB { + class CC + } +} + +fun test(param: foo.bar.baz.AA.BB.CC) {} + +// REF: (in foo.bar.baz.AA.BB).CC diff --git a/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfCompanionType.kt b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfCompanionType.kt new file mode 100644 index 00000000000..949027b0929 --- /dev/null +++ b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfCompanionType.kt @@ -0,0 +1,11 @@ +package foo.bar.baz + +class AA { + class BB { + companion object + } +} + +fun test(param: foo.bar.baz.AA.BB.Companion) {} + +// REF: (in foo.bar.baz.AA).BB diff --git a/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfType.kt b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfType.kt new file mode 100644 index 00000000000..7ca35182527 --- /dev/null +++ b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfType.kt @@ -0,0 +1,11 @@ +package foo.bar.baz + +class AA { + class BB { + class CC + } +} + +fun test(param: foo.bar.baz.AA.BB.CC) {} + +// REF: (in foo.bar.baz.AA).BB diff --git a/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfCompanionType.kt b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfCompanionType.kt new file mode 100644 index 00000000000..3880d38de40 --- /dev/null +++ b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfCompanionType.kt @@ -0,0 +1,11 @@ +package foo.bar.baz + +class AA { + class BB { + companion object + } +} + +fun test(param: foo.bar.baz.AA.BB.Companion) {} + +// REF: (foo.bar.baz).AA diff --git a/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfType.kt b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfType.kt new file mode 100644 index 00000000000..893a7422c6f --- /dev/null +++ b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfType.kt @@ -0,0 +1,11 @@ +package foo.bar.baz + +class AA { + class BB { + class CC + } +} + +fun test(param: foo.bar.baz.AA.BB.CC) {} + +// REF: (foo.bar.baz).AA diff --git a/idea/tests/org/jetbrains/kotlin/idea/resolve/ReferenceResolveTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/resolve/ReferenceResolveTestGenerated.java index d927be17c0d..e4aa13781e5 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/resolve/ReferenceResolveTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/resolve/ReferenceResolveTestGenerated.java @@ -707,4 +707,62 @@ public class ReferenceResolveTestGenerated extends AbstractReferenceResolveTest runTest("idea/testData/resolve/references/invoke/oneParamRPar.kt"); } } + + @TestMetadata("idea/testData/resolve/references/nestedTypes") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class NestedTypes extends AbstractReferenceResolveTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInNestedTypes() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/resolve/references/nestedTypes"), Pattern.compile("^([^.]+)\\.kt$"), null, true); + } + + @TestMetadata("ResolveCompanionInCompanionType.kt") + public void testResolveCompanionInCompanionType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveCompanionInCompanionType.kt"); + } + + @TestMetadata("ResolveEndOfPackageInType.kt") + public void testResolveEndOfPackageInType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveEndOfPackageInType.kt"); + } + + @TestMetadata("ResolveMiddleOfPackageInType.kt") + public void testResolveMiddleOfPackageInType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveMiddleOfPackageInType.kt"); + } + + @TestMetadata("ResolveStartOfPackageInType.kt") + public void testResolveStartOfPackageInType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveStartOfPackageInType.kt"); + } + + @TestMetadata("ResolveTypeInTheEndOfType.kt") + public void testResolveTypeInTheEndOfType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheEndOfType.kt"); + } + + @TestMetadata("ResolveTypeInTheMiddleOfCompanionType.kt") + public void testResolveTypeInTheMiddleOfCompanionType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfCompanionType.kt"); + } + + @TestMetadata("ResolveTypeInTheMiddleOfType.kt") + public void testResolveTypeInTheMiddleOfType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfType.kt"); + } + + @TestMetadata("ResolveTypeInTheStartOfCompanionType.kt") + public void testResolveTypeInTheStartOfCompanionType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfCompanionType.kt"); + } + + @TestMetadata("ResolveTypeInTheStartOfType.kt") + public void testResolveTypeInTheStartOfType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfType.kt"); + } + } } From dba14ba99558f5fa3ddc60f7ca90056aacfc40ff Mon Sep 17 00:00:00 2001 From: Roman Golyshev Date: Fri, 27 Nov 2020 18:09:49 +0300 Subject: [PATCH 326/698] FIR IDE: Fix resolving of nested types in type references --- .../references/FirReferenceResolveHelper.kt | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/FirReferenceResolveHelper.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/FirReferenceResolveHelper.kt index c59c8027f6e..f168a8a2906 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/FirReferenceResolveHelper.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/FirReferenceResolveHelper.kt @@ -9,6 +9,7 @@ import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticProperty import org.jetbrains.kotlin.fir.expressions.* +import org.jetbrains.kotlin.fir.psi import org.jetbrains.kotlin.fir.references.* import org.jetbrains.kotlin.fir.resolve.calls.SyntheticPropertySymbol import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeAmbiguityError @@ -20,6 +21,7 @@ import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol import org.jetbrains.kotlin.fir.symbols.impl.ConeClassLikeLookupTagImpl import org.jetbrains.kotlin.fir.types.ConeLookupTagBasedType import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef +import org.jetbrains.kotlin.fir.types.classId import org.jetbrains.kotlin.idea.fir.* import org.jetbrains.kotlin.idea.fir.low.level.api.api.getOrBuildFir import org.jetbrains.kotlin.idea.frontend.api.fir.KtFirAnalysisSession @@ -141,7 +143,10 @@ internal object FirReferenceResolveHelper { when (fir) { is FirResolvedTypeRef -> { if (expression.isPartOfUserTypeRefQualifier()) { - return listOfNotNull(getPackageSymbolFor(expression, symbolBuilder, forQualifiedType = true)) + val typeQualifier = findPossibleTypeQualifier(expression, fir)?.toTargetPsi(session, symbolBuilder) + val typeOrPackageQualifier = typeQualifier ?: getPackageSymbolFor(expression, symbolBuilder, forQualifiedType = true) + + return listOfNotNull(typeOrPackageQualifier) } return listOfNotNull(fir.toTargetSymbol(session, symbolBuilder)) } @@ -274,4 +279,33 @@ internal object FirReferenceResolveHelper { } } } + + private fun findPossibleTypeQualifier(qualifier: KtSimpleNameExpression, wholeTypeFir: FirResolvedTypeRef): ClassId? { + val qualifierToResolve = qualifier.parent as? KtUserType + ?: error("$qualifier should be a part of KtUserType") + + val wholeType = (wholeTypeFir.psi as? KtTypeReference)?.typeElement as? KtUserType + ?: error("$wholeTypeFir psi should point to KtTypeReference") + + val qualifiersToDrop = countQualifiersToDrop(wholeType, qualifierToResolve) + return wholeTypeFir.type.classId?.dropLastNestedClasses(qualifiersToDrop) + } + + /** + * @return class id without [classesToDrop] last nested classes, or `null` if [classesToDrop] is too big. + * + * Example: `foo.bar.Baz.Inner` with 1 dropped class is `foo.bar.Baz`, and with 2 dropped class is `null`. + */ + private fun ClassId.dropLastNestedClasses(classesToDrop: Int) = generateSequence(this) { it.outerClassId }.drop(classesToDrop).firstOrNull() + + /** + * @return How many qualifiers needs to be dropped from [wholeType] to get [nestedType]. + * + * Example: to get `foo.bar` from `foo.bar.Baz.Inner`, you need to drop 2 qualifiers (`Inner` and `Baz`). + */ + private fun countQualifiersToDrop(wholeType: KtUserType, nestedType: KtUserType): Int { + val qualifierIndex = generateSequence(wholeType) { it.qualifier }.indexOf(nestedType) + require(qualifierIndex != -1) { "Whole type $wholeType should contain $nestedType, but it didn't" } + return qualifierIndex + } } From f8b6559b6a45206f1055ea21d090d2e5ebbbe4d1 Mon Sep 17 00:00:00 2001 From: Roman Golyshev Date: Mon, 30 Nov 2020 12:37:26 +0300 Subject: [PATCH 327/698] Revert "FIR IDE: Fix resolving of nested types in type references" This reverts commit dba14ba9 --- .../references/FirReferenceResolveHelper.kt | 36 +------------------ 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/FirReferenceResolveHelper.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/FirReferenceResolveHelper.kt index f168a8a2906..c59c8027f6e 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/FirReferenceResolveHelper.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/FirReferenceResolveHelper.kt @@ -9,7 +9,6 @@ import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticProperty import org.jetbrains.kotlin.fir.expressions.* -import org.jetbrains.kotlin.fir.psi import org.jetbrains.kotlin.fir.references.* import org.jetbrains.kotlin.fir.resolve.calls.SyntheticPropertySymbol import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeAmbiguityError @@ -21,7 +20,6 @@ import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol import org.jetbrains.kotlin.fir.symbols.impl.ConeClassLikeLookupTagImpl import org.jetbrains.kotlin.fir.types.ConeLookupTagBasedType import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef -import org.jetbrains.kotlin.fir.types.classId import org.jetbrains.kotlin.idea.fir.* import org.jetbrains.kotlin.idea.fir.low.level.api.api.getOrBuildFir import org.jetbrains.kotlin.idea.frontend.api.fir.KtFirAnalysisSession @@ -143,10 +141,7 @@ internal object FirReferenceResolveHelper { when (fir) { is FirResolvedTypeRef -> { if (expression.isPartOfUserTypeRefQualifier()) { - val typeQualifier = findPossibleTypeQualifier(expression, fir)?.toTargetPsi(session, symbolBuilder) - val typeOrPackageQualifier = typeQualifier ?: getPackageSymbolFor(expression, symbolBuilder, forQualifiedType = true) - - return listOfNotNull(typeOrPackageQualifier) + return listOfNotNull(getPackageSymbolFor(expression, symbolBuilder, forQualifiedType = true)) } return listOfNotNull(fir.toTargetSymbol(session, symbolBuilder)) } @@ -279,33 +274,4 @@ internal object FirReferenceResolveHelper { } } } - - private fun findPossibleTypeQualifier(qualifier: KtSimpleNameExpression, wholeTypeFir: FirResolvedTypeRef): ClassId? { - val qualifierToResolve = qualifier.parent as? KtUserType - ?: error("$qualifier should be a part of KtUserType") - - val wholeType = (wholeTypeFir.psi as? KtTypeReference)?.typeElement as? KtUserType - ?: error("$wholeTypeFir psi should point to KtTypeReference") - - val qualifiersToDrop = countQualifiersToDrop(wholeType, qualifierToResolve) - return wholeTypeFir.type.classId?.dropLastNestedClasses(qualifiersToDrop) - } - - /** - * @return class id without [classesToDrop] last nested classes, or `null` if [classesToDrop] is too big. - * - * Example: `foo.bar.Baz.Inner` with 1 dropped class is `foo.bar.Baz`, and with 2 dropped class is `null`. - */ - private fun ClassId.dropLastNestedClasses(classesToDrop: Int) = generateSequence(this) { it.outerClassId }.drop(classesToDrop).firstOrNull() - - /** - * @return How many qualifiers needs to be dropped from [wholeType] to get [nestedType]. - * - * Example: to get `foo.bar` from `foo.bar.Baz.Inner`, you need to drop 2 qualifiers (`Inner` and `Baz`). - */ - private fun countQualifiersToDrop(wholeType: KtUserType, nestedType: KtUserType): Int { - val qualifierIndex = generateSequence(wholeType) { it.qualifier }.indexOf(nestedType) - require(qualifierIndex != -1) { "Whole type $wholeType should contain $nestedType, but it didn't" } - return qualifierIndex - } } From e6f380182a6ca5a973c4760aaf24af916c0a8548 Mon Sep 17 00:00:00 2001 From: Roman Golyshev Date: Mon, 30 Nov 2020 12:37:40 +0300 Subject: [PATCH 328/698] Revert "FIR IDE: Add tests for resolving from nested types references" This reverts commit e127ea3d --- .../FirReferenceResolveTestGenerated.java | 58 ------------------- .../ResolveCompanionInCompanionType.kt | 11 ---- .../nestedTypes/ResolveEndOfPackageInType.kt | 11 ---- .../ResolveMiddleOfPackageInType.kt | 11 ---- .../ResolveStartOfPackageInType.kt | 11 ---- .../nestedTypes/ResolveTypeInTheEndOfType.kt | 11 ---- .../ResolveTypeInTheMiddleOfCompanionType.kt | 11 ---- .../ResolveTypeInTheMiddleOfType.kt | 11 ---- .../ResolveTypeInTheStartOfCompanionType.kt | 11 ---- .../ResolveTypeInTheStartOfType.kt | 11 ---- .../ReferenceResolveTestGenerated.java | 58 ------------------- 11 files changed, 215 deletions(-) delete mode 100644 idea/testData/resolve/references/nestedTypes/ResolveCompanionInCompanionType.kt delete mode 100644 idea/testData/resolve/references/nestedTypes/ResolveEndOfPackageInType.kt delete mode 100644 idea/testData/resolve/references/nestedTypes/ResolveMiddleOfPackageInType.kt delete mode 100644 idea/testData/resolve/references/nestedTypes/ResolveStartOfPackageInType.kt delete mode 100644 idea/testData/resolve/references/nestedTypes/ResolveTypeInTheEndOfType.kt delete mode 100644 idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfCompanionType.kt delete mode 100644 idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfType.kt delete mode 100644 idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfCompanionType.kt delete mode 100644 idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfType.kt diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/resolve/FirReferenceResolveTestGenerated.java b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/resolve/FirReferenceResolveTestGenerated.java index 0a7e14a1134..c7b1ae98e91 100644 --- a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/resolve/FirReferenceResolveTestGenerated.java +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/resolve/FirReferenceResolveTestGenerated.java @@ -707,62 +707,4 @@ public class FirReferenceResolveTestGenerated extends AbstractFirReferenceResolv runTest("idea/testData/resolve/references/invoke/oneParamRPar.kt"); } } - - @TestMetadata("idea/testData/resolve/references/nestedTypes") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class NestedTypes extends AbstractFirReferenceResolveTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInNestedTypes() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/resolve/references/nestedTypes"), Pattern.compile("^([^.]+)\\.kt$"), null, true); - } - - @TestMetadata("ResolveCompanionInCompanionType.kt") - public void testResolveCompanionInCompanionType() throws Exception { - runTest("idea/testData/resolve/references/nestedTypes/ResolveCompanionInCompanionType.kt"); - } - - @TestMetadata("ResolveEndOfPackageInType.kt") - public void testResolveEndOfPackageInType() throws Exception { - runTest("idea/testData/resolve/references/nestedTypes/ResolveEndOfPackageInType.kt"); - } - - @TestMetadata("ResolveMiddleOfPackageInType.kt") - public void testResolveMiddleOfPackageInType() throws Exception { - runTest("idea/testData/resolve/references/nestedTypes/ResolveMiddleOfPackageInType.kt"); - } - - @TestMetadata("ResolveStartOfPackageInType.kt") - public void testResolveStartOfPackageInType() throws Exception { - runTest("idea/testData/resolve/references/nestedTypes/ResolveStartOfPackageInType.kt"); - } - - @TestMetadata("ResolveTypeInTheEndOfType.kt") - public void testResolveTypeInTheEndOfType() throws Exception { - runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheEndOfType.kt"); - } - - @TestMetadata("ResolveTypeInTheMiddleOfCompanionType.kt") - public void testResolveTypeInTheMiddleOfCompanionType() throws Exception { - runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfCompanionType.kt"); - } - - @TestMetadata("ResolveTypeInTheMiddleOfType.kt") - public void testResolveTypeInTheMiddleOfType() throws Exception { - runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfType.kt"); - } - - @TestMetadata("ResolveTypeInTheStartOfCompanionType.kt") - public void testResolveTypeInTheStartOfCompanionType() throws Exception { - runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfCompanionType.kt"); - } - - @TestMetadata("ResolveTypeInTheStartOfType.kt") - public void testResolveTypeInTheStartOfType() throws Exception { - runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfType.kt"); - } - } } diff --git a/idea/testData/resolve/references/nestedTypes/ResolveCompanionInCompanionType.kt b/idea/testData/resolve/references/nestedTypes/ResolveCompanionInCompanionType.kt deleted file mode 100644 index 1ecc8f1bb2c..00000000000 --- a/idea/testData/resolve/references/nestedTypes/ResolveCompanionInCompanionType.kt +++ /dev/null @@ -1,11 +0,0 @@ -package foo.bar.baz - -class AA { - class BB { - companion object - } -} - -fun test(param: foo.bar.baz.AA.BB.Companion) {} - -// REF: companion object of (in foo.bar.baz.AA).BB diff --git a/idea/testData/resolve/references/nestedTypes/ResolveEndOfPackageInType.kt b/idea/testData/resolve/references/nestedTypes/ResolveEndOfPackageInType.kt deleted file mode 100644 index 25e22c34f2e..00000000000 --- a/idea/testData/resolve/references/nestedTypes/ResolveEndOfPackageInType.kt +++ /dev/null @@ -1,11 +0,0 @@ -package foo.bar.baz - -class AA { - class BB { - class CC - } -} - -fun test(param: foo.bar.baz.AA.BB.CC) {} - -// REF: baz diff --git a/idea/testData/resolve/references/nestedTypes/ResolveMiddleOfPackageInType.kt b/idea/testData/resolve/references/nestedTypes/ResolveMiddleOfPackageInType.kt deleted file mode 100644 index 9edddf26708..00000000000 --- a/idea/testData/resolve/references/nestedTypes/ResolveMiddleOfPackageInType.kt +++ /dev/null @@ -1,11 +0,0 @@ -package foo.bar.baz - -class AA { - class BB { - class CC - } -} - -fun test(param: foo.bar.baz.AA.BB.CC) {} - -// REF: bar diff --git a/idea/testData/resolve/references/nestedTypes/ResolveStartOfPackageInType.kt b/idea/testData/resolve/references/nestedTypes/ResolveStartOfPackageInType.kt deleted file mode 100644 index ae9e8f72537..00000000000 --- a/idea/testData/resolve/references/nestedTypes/ResolveStartOfPackageInType.kt +++ /dev/null @@ -1,11 +0,0 @@ -package foo.bar.baz - -class AA { - class BB { - class CC - } -} - -fun test(param: foo.bar.baz.AA.BB.CC) {} - -// REF: foo diff --git a/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheEndOfType.kt b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheEndOfType.kt deleted file mode 100644 index bea01a7ff4f..00000000000 --- a/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheEndOfType.kt +++ /dev/null @@ -1,11 +0,0 @@ -package foo.bar.baz - -class AA { - class BB { - class CC - } -} - -fun test(param: foo.bar.baz.AA.BB.CC) {} - -// REF: (in foo.bar.baz.AA.BB).CC diff --git a/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfCompanionType.kt b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfCompanionType.kt deleted file mode 100644 index 949027b0929..00000000000 --- a/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfCompanionType.kt +++ /dev/null @@ -1,11 +0,0 @@ -package foo.bar.baz - -class AA { - class BB { - companion object - } -} - -fun test(param: foo.bar.baz.AA.BB.Companion) {} - -// REF: (in foo.bar.baz.AA).BB diff --git a/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfType.kt b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfType.kt deleted file mode 100644 index 7ca35182527..00000000000 --- a/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfType.kt +++ /dev/null @@ -1,11 +0,0 @@ -package foo.bar.baz - -class AA { - class BB { - class CC - } -} - -fun test(param: foo.bar.baz.AA.BB.CC) {} - -// REF: (in foo.bar.baz.AA).BB diff --git a/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfCompanionType.kt b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfCompanionType.kt deleted file mode 100644 index 3880d38de40..00000000000 --- a/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfCompanionType.kt +++ /dev/null @@ -1,11 +0,0 @@ -package foo.bar.baz - -class AA { - class BB { - companion object - } -} - -fun test(param: foo.bar.baz.AA.BB.Companion) {} - -// REF: (foo.bar.baz).AA diff --git a/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfType.kt b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfType.kt deleted file mode 100644 index 893a7422c6f..00000000000 --- a/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfType.kt +++ /dev/null @@ -1,11 +0,0 @@ -package foo.bar.baz - -class AA { - class BB { - class CC - } -} - -fun test(param: foo.bar.baz.AA.BB.CC) {} - -// REF: (foo.bar.baz).AA diff --git a/idea/tests/org/jetbrains/kotlin/idea/resolve/ReferenceResolveTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/resolve/ReferenceResolveTestGenerated.java index e4aa13781e5..d927be17c0d 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/resolve/ReferenceResolveTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/resolve/ReferenceResolveTestGenerated.java @@ -707,62 +707,4 @@ public class ReferenceResolveTestGenerated extends AbstractReferenceResolveTest runTest("idea/testData/resolve/references/invoke/oneParamRPar.kt"); } } - - @TestMetadata("idea/testData/resolve/references/nestedTypes") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class NestedTypes extends AbstractReferenceResolveTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInNestedTypes() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/resolve/references/nestedTypes"), Pattern.compile("^([^.]+)\\.kt$"), null, true); - } - - @TestMetadata("ResolveCompanionInCompanionType.kt") - public void testResolveCompanionInCompanionType() throws Exception { - runTest("idea/testData/resolve/references/nestedTypes/ResolveCompanionInCompanionType.kt"); - } - - @TestMetadata("ResolveEndOfPackageInType.kt") - public void testResolveEndOfPackageInType() throws Exception { - runTest("idea/testData/resolve/references/nestedTypes/ResolveEndOfPackageInType.kt"); - } - - @TestMetadata("ResolveMiddleOfPackageInType.kt") - public void testResolveMiddleOfPackageInType() throws Exception { - runTest("idea/testData/resolve/references/nestedTypes/ResolveMiddleOfPackageInType.kt"); - } - - @TestMetadata("ResolveStartOfPackageInType.kt") - public void testResolveStartOfPackageInType() throws Exception { - runTest("idea/testData/resolve/references/nestedTypes/ResolveStartOfPackageInType.kt"); - } - - @TestMetadata("ResolveTypeInTheEndOfType.kt") - public void testResolveTypeInTheEndOfType() throws Exception { - runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheEndOfType.kt"); - } - - @TestMetadata("ResolveTypeInTheMiddleOfCompanionType.kt") - public void testResolveTypeInTheMiddleOfCompanionType() throws Exception { - runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfCompanionType.kt"); - } - - @TestMetadata("ResolveTypeInTheMiddleOfType.kt") - public void testResolveTypeInTheMiddleOfType() throws Exception { - runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfType.kt"); - } - - @TestMetadata("ResolveTypeInTheStartOfCompanionType.kt") - public void testResolveTypeInTheStartOfCompanionType() throws Exception { - runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfCompanionType.kt"); - } - - @TestMetadata("ResolveTypeInTheStartOfType.kt") - public void testResolveTypeInTheStartOfType() throws Exception { - runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfType.kt"); - } - } } From 9b30655d664ba9ec684883975d133d3e14dc4563 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 25 Nov 2020 15:35:01 +0300 Subject: [PATCH 329/698] [FIR] Load Java annotations named arguments properly (see KT-43584) --- .../kotlin/fir/java/JavaSymbolProvider.kt | 2 +- .../jetbrains/kotlin/fir/java/JavaUtils.kt | 45 ++++++++++++++++--- .../fir/expressions/FirExpressionUtil.kt | 1 + ...gleArrayElementAsVarargInAnnotation.fir.kt | 8 ++-- ...rayElementAsVarargInAnnotationError.fir.kt | 8 ++-- 5 files changed, 49 insertions(+), 15 deletions(-) diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaSymbolProvider.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaSymbolProvider.kt index 16f8fd00103..d93fa5c690c 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaSymbolProvider.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaSymbolProvider.kt @@ -50,7 +50,7 @@ class JavaSymbolProvider( private val searchScope: GlobalSearchScope, ) : FirSymbolProvider(session) { companion object { - private val VALUE_METHOD_NAME = Name.identifier("value") + internal val VALUE_METHOD_NAME = Name.identifier("value") } private val classCache = SymbolProviderCache() diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt index fca29119535..cdb274589ed 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt @@ -21,6 +21,7 @@ import org.jetbrains.kotlin.fir.java.enhancement.readOnlyToMutable import org.jetbrains.kotlin.fir.references.builder.buildErrorNamedReference import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference import org.jetbrains.kotlin.fir.references.impl.FirReferencePlaceholderForResolvedAnnotations +import org.jetbrains.kotlin.fir.resolve.bindSymbolToLookupTag import org.jetbrains.kotlin.fir.resolve.defaultType import org.jetbrains.kotlin.fir.resolve.firSymbolProvider import org.jetbrains.kotlin.fir.resolve.providers.getClassDeclaredCallableSymbols @@ -418,16 +419,48 @@ private fun FirRegularClass.createRawArguments( computeRawProjection(session, typeParameter, position, erasedUpperBound) } +private fun FirAnnotationCallBuilder.buildArgumentMapping( + session: FirSession, + javaTypeParameterStack: JavaTypeParameterStack, + classId: ClassId, + annotationArguments: Collection +): LinkedHashMap? { + val lookupTag = ConeClassLikeLookupTagImpl(classId) + annotationTypeRef = buildResolvedTypeRef { + type = ConeClassLikeTypeImpl(lookupTag, emptyArray(), isNullable = false) + } + if (annotationArguments.any { it.name != null }) { + val mapping = linkedMapOf() + val annotationClassSymbol = session.firSymbolProvider.getClassLikeSymbolByFqName(classId).also { + lookupTag.bindSymbolToLookupTag(session, it) + } + if (annotationClassSymbol != null) { + val annotationConstructor = + (annotationClassSymbol.fir as FirRegularClass).declarations.filterIsInstance().first() + for (argument in annotationArguments) { + mapping[argument.toFirExpression(session, javaTypeParameterStack)] = + annotationConstructor.valueParameters.find { it.name == (argument.name ?: JavaSymbolProvider.VALUE_METHOD_NAME) } + ?: return null + } + return mapping + } + } + return null +} + internal fun JavaAnnotation.toFirAnnotationCall( session: FirSession, javaTypeParameterStack: JavaTypeParameterStack ): FirAnnotationCall { return buildAnnotationCall { - annotationTypeRef = buildResolvedTypeRef { - type = ConeClassLikeTypeImpl(FirRegularClassSymbol(classId!!).toLookupTag(), emptyArray(), isNullable = false) - } - argumentList = buildArgumentList { - for (argument in this@toFirAnnotationCall.arguments) { - arguments += argument.toFirExpression(session, javaTypeParameterStack) + val classId = classId!! + val mapping = buildArgumentMapping(session, javaTypeParameterStack, classId, arguments) + argumentList = if (mapping != null) { + buildResolvedArgumentList(mapping) + } else { + buildArgumentList { + for (argument in this@toFirAnnotationCall.arguments) { + arguments += argument.toFirExpression(session, javaTypeParameterStack) + } } } calleeReference = FirReferencePlaceholderForResolvedAnnotations diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirExpressionUtil.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirExpressionUtil.kt index 06956fb6e64..15cd05afed7 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirExpressionUtil.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirExpressionUtil.kt @@ -44,6 +44,7 @@ inline val FirCall.argumentMapping: LinkedHashMapvalue = nonConstArray) fun foo1() {} -@Anno(value = nonConstFun()) +@Anno(value = nonConstFun()) fun foo2() {} @Anno(value = longArrayOf(nonConstLong())) @@ -19,8 +19,8 @@ fun foo3() {} @Anno(value = [nonConstLong()]) fun foo4() {} -@Anno(value = *nonConstArray) +@Anno(value = *nonConstArray) fun bar1() {} -@Anno(*nonConstArray) +@Anno(*nonConstArray) fun bar2() {} diff --git a/compiler/testData/diagnostics/tests/varargs/assignNonConstSingleArrayElementAsVarargInAnnotationError.fir.kt b/compiler/testData/diagnostics/tests/varargs/assignNonConstSingleArrayElementAsVarargInAnnotationError.fir.kt index 0fde992f5d8..2f9fa270f42 100644 --- a/compiler/testData/diagnostics/tests/varargs/assignNonConstSingleArrayElementAsVarargInAnnotationError.fir.kt +++ b/compiler/testData/diagnostics/tests/varargs/assignNonConstSingleArrayElementAsVarargInAnnotationError.fir.kt @@ -7,10 +7,10 @@ fun nonConstLong(): Long = TODO() annotation class Anno(vararg val value: Long) -@Anno(value = nonConstArray) +@Anno(value = nonConstArray) fun foo1() {} -@Anno(value = nonConstFun()) +@Anno(value = nonConstFun()) fun foo2() {} @Anno(value = longArrayOf(nonConstLong())) @@ -19,8 +19,8 @@ fun foo3() {} @Anno(value = [nonConstLong()]) fun foo4() {} -@Anno(value = *nonConstArray) +@Anno(value = *nonConstArray) fun bar1() {} -@Anno(*nonConstArray) +@Anno(*nonConstArray) fun bar2() {} From feb13f98c026ffd248e5b19d611947734dd7660c Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 26 Nov 2020 12:24:10 +0300 Subject: [PATCH 330/698] [FIR2IR] Handle Java annotation parameter mapping properly #KT-43584 Fixed --- .../generators/CallAndReferenceGenerator.kt | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt index 67f3a8d6c0e..4929f90abbd 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt @@ -16,6 +16,7 @@ import org.jetbrains.kotlin.fir.references.FirDelegateFieldReference import org.jetbrains.kotlin.fir.references.FirReference import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference import org.jetbrains.kotlin.fir.references.FirSuperReference +import org.jetbrains.kotlin.fir.references.impl.FirReferencePlaceholderForResolvedAnnotations import org.jetbrains.kotlin.fir.render import org.jetbrains.kotlin.fir.resolve.calls.getExpectedTypeForSAMConversion import org.jetbrains.kotlin.fir.resolve.calls.isFunctional @@ -445,8 +446,14 @@ class CallAndReferenceGenerator( is FirDelegatedConstructorCall -> call.calleeReference is FirAnnotationCall -> call.calleeReference else -> null - } as? FirResolvedNamedReference - val function = (calleeReference?.resolvedSymbol as? FirFunctionSymbol<*>)?.fir + } + val function = if (calleeReference == FirReferencePlaceholderForResolvedAnnotations) { + val coneClassLikeType = (call as FirAnnotationCall).annotationTypeRef.coneTypeSafe() + val firClass = (coneClassLikeType?.lookupTag?.toSymbol(session) as? FirRegularClassSymbol)?.fir + firClass?.declarations?.filterIsInstance()?.firstOrNull() + } else { + ((calleeReference as? FirResolvedNamedReference)?.resolvedSymbol as? FirFunctionSymbol<*>)?.fir + } val valueParameters = function?.valueParameters val argumentMapping = call.argumentMapping if (argumentMapping != null && (annotationMode || argumentMapping.isNotEmpty())) { @@ -559,11 +566,13 @@ class CallAndReferenceGenerator( } } with(adapterGenerator) { - irArgument = irArgument.applySuspendConversionIfNeeded(argument, parameter) + if (parameter?.returnTypeRef is FirResolvedTypeRef) { + // Java type case (from annotations) + irArgument = irArgument.applySuspendConversionIfNeeded(argument, parameter) + irArgument = irArgument.applySamConversionIfNeeded(argument, parameter) + } } - return irArgument - .applySamConversionIfNeeded(argument, parameter) - .applyAssigningArrayElementsToVarargInNamedForm(argument, parameter) + return irArgument.applyAssigningArrayElementsToVarargInNamedForm(argument, parameter) } private fun IrExpression.applySamConversionIfNeeded( From 04d9afe83e39387cf30de6dbe5a828081ccfca4f Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 30 Nov 2020 09:48:24 +0300 Subject: [PATCH 331/698] FIR Java: add workaround for classId = null in JavaAnnotation --- .../java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt index cdb274589ed..eceb8318ba9 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt @@ -23,6 +23,7 @@ import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference import org.jetbrains.kotlin.fir.references.impl.FirReferencePlaceholderForResolvedAnnotations import org.jetbrains.kotlin.fir.resolve.bindSymbolToLookupTag import org.jetbrains.kotlin.fir.resolve.defaultType +import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeUnresolvedReferenceError import org.jetbrains.kotlin.fir.resolve.firSymbolProvider import org.jetbrains.kotlin.fir.resolve.providers.getClassDeclaredCallableSymbols import org.jetbrains.kotlin.fir.resolve.toSymbol @@ -32,6 +33,7 @@ import org.jetbrains.kotlin.fir.symbols.StandardClassIds import org.jetbrains.kotlin.fir.symbols.impl.ConeClassLikeLookupTagImpl import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol import org.jetbrains.kotlin.fir.types.* +import org.jetbrains.kotlin.fir.types.builder.buildErrorTypeRef import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl import org.jetbrains.kotlin.fir.types.impl.ConeTypeParameterTypeImpl @@ -422,9 +424,13 @@ private fun FirRegularClass.createRawArguments( private fun FirAnnotationCallBuilder.buildArgumentMapping( session: FirSession, javaTypeParameterStack: JavaTypeParameterStack, - classId: ClassId, + classId: ClassId?, annotationArguments: Collection ): LinkedHashMap? { + if (classId == null) { + annotationTypeRef = buildErrorTypeRef { diagnostic = ConeUnresolvedReferenceError() } + return null + } val lookupTag = ConeClassLikeLookupTagImpl(classId) annotationTypeRef = buildResolvedTypeRef { type = ConeClassLikeTypeImpl(lookupTag, emptyArray(), isNullable = false) @@ -452,7 +458,6 @@ internal fun JavaAnnotation.toFirAnnotationCall( session: FirSession, javaTypeParameterStack: JavaTypeParameterStack ): FirAnnotationCall { return buildAnnotationCall { - val classId = classId!! val mapping = buildArgumentMapping(session, javaTypeParameterStack, classId, arguments) argumentList = if (mapping != null) { buildResolvedArgumentList(mapping) From 1cccf2645fac981c2483870dd52c933b3f322d9f Mon Sep 17 00:00:00 2001 From: pyos Date: Fri, 27 Nov 2020 11:38:21 +0100 Subject: [PATCH 332/698] FIR: serialize HAS_CONSTANT at least for const properties Non-const properties may need them too with if the 1.4 feature NoConstantValueAttributeForNonConstVals is disabled. --- .../loadCompiledKotlin/prop/Constants.txt | 2 +- .../deserialization/FirConstDeserializer.kt | 19 ++++++++----------- .../fir/serialization/FirElementSerializer.kt | 4 +--- .../KotlinDeserializedJvmSymbolsProvider.kt | 2 +- .../callsToMultifileClassFromOtherPackage.kt | 1 - ...onstPropertyReferenceFromMultifileClass.kt | 1 - .../inlinedConstants.kt | 1 - .../kotlinPropertyAsAnnotationParameter.kt | 1 - 8 files changed, 11 insertions(+), 20 deletions(-) diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/Constants.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/Constants.txt index cac7b3ea9cf..264aad18b4d 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/Constants.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/Constants.txt @@ -40,6 +40,6 @@ public final const val s: R|kotlin/Short| = Short(20000) public final const val s1: R|kotlin/Short| = Short(1) public get(): R|kotlin/Short| -public final const val str: R|kotlin/String| +public final const val str: R|kotlin/String| = String(:)) public get(): R|kotlin/String| diff --git a/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/FirConstDeserializer.kt b/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/FirConstDeserializer.kt index dc994ab8749..1e67995070e 100644 --- a/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/FirConstDeserializer.kt +++ b/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/FirConstDeserializer.kt @@ -20,24 +20,21 @@ import org.jetbrains.kotlin.serialization.deserialization.builtins.BuiltInSerial class FirConstDeserializer( val session: FirSession, - private val partSource: KotlinJvmBinaryClass? = null, - private val facadeSource: KotlinJvmBinaryClass? = null + private val binaryClass: KotlinJvmBinaryClass? = null ) { - companion object { - private val constantCache = mutableMapOf() - } + private val constantCache = mutableMapOf() fun loadConstant(propertyProto: ProtoBuf.Property, callableId: CallableId, nameResolver: NameResolver): FirExpression? { if (!Flags.HAS_CONSTANT.get(propertyProto.flags)) return null constantCache[callableId]?.let { return it } - if (facadeSource == null && partSource == null) { + if (binaryClass == null) { val value = propertyProto.getExtensionOrNull(BuiltInSerializerProtocol.compileTimeValue) ?: return null return buildFirConstant(value, null, value.type.name, nameResolver)?.apply { constantCache[callableId] = this } } - (facadeSource ?: partSource)!!.visitMembers(object : KotlinJvmBinaryClass.MemberVisitor { + binaryClass.visitMembers(object : KotlinJvmBinaryClass.MemberVisitor { override fun visitMethod(name: Name, desc: String): KotlinJvmBinaryClass.MethodAnnotationVisitor? = null override fun visitField(name: Name, desc: String, initializer: Any?): KotlinJvmBinaryClass.AnnotationVisitor? { @@ -60,11 +57,11 @@ class FirConstDeserializer( "CHAR", "C" -> buildConstExpression(null, FirConstKind.Char, ((protoValue?.intValue ?: sourceValue) as Number).toChar()) "SHORT", "S" -> buildConstExpression(null, FirConstKind.Short, ((protoValue?.intValue ?: sourceValue) as Number).toShort()) "INT", "I" -> buildConstExpression(null, FirConstKind.Int, protoValue?.intValue?.toInt() ?: sourceValue as Int) - "LONG", "J" -> buildConstExpression(null, FirConstKind.Long, (protoValue?.intValue ?: sourceValue) as Long) - "FLOAT", "F" -> buildConstExpression(null, FirConstKind.Float, (protoValue?.floatValue ?: sourceValue) as Float) - "DOUBLE", "D" -> buildConstExpression(null, FirConstKind.Double, (protoValue?.doubleValue ?: sourceValue) as Double) + "LONG", "J" -> buildConstExpression(null, FirConstKind.Long, protoValue?.intValue ?: sourceValue as Long) + "FLOAT", "F" -> buildConstExpression(null, FirConstKind.Float, protoValue?.floatValue ?: sourceValue as Float) + "DOUBLE", "D" -> buildConstExpression(null, FirConstKind.Double, protoValue?.doubleValue ?: sourceValue as Double) "BOOLEAN", "Z" -> buildConstExpression(null, FirConstKind.Boolean, (protoValue?.intValue?.toInt() ?: sourceValue) != 0) - "STRING", "Ljava/lang/String" -> buildConstExpression( + "STRING", "Ljava/lang/String;" -> buildConstExpression( null, FirConstKind.String, protoValue?.stringValue?.let { nameResolver.getString(it) } ?: sourceValue as String ) else -> null diff --git a/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementSerializer.kt b/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementSerializer.kt index 4262004f450..a39091afe37 100644 --- a/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementSerializer.kt +++ b/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementSerializer.kt @@ -205,9 +205,6 @@ class FirElementSerializer private constructor( var hasGetter = false var hasSetter = false - //val compileTimeConstant = property.compileTimeInitializer - val hasConstant = false // TODO: compileTimeConstant != null && compileTimeConstant !is NullValue - val hasAnnotations = property.nonSourceAnnotations(session).isNotEmpty() // TODO: hasAnnotations(descriptor) || hasAnnotations(descriptor.backingField) || hasAnnotations(descriptor.delegateField) @@ -247,6 +244,7 @@ class FirElementSerializer private constructor( } } + val hasConstant = property.isConst // TODO: this is only correct with LanguageFeature.NoConstantValueAttributeForNonConstVals val flags = Flags.getPropertyFlags( hasAnnotations, ProtoEnumFlags.visibility(normalizeVisibility(property)), diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/deserialization/KotlinDeserializedJvmSymbolsProvider.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/deserialization/KotlinDeserializedJvmSymbolsProvider.kt index eb799242de0..ae5fb02ad68 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/deserialization/KotlinDeserializedJvmSymbolsProvider.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/deserialization/KotlinDeserializedJvmSymbolsProvider.kt @@ -126,7 +126,7 @@ class KotlinDeserializedJvmSymbolsProvider( FirDeserializationContext.createForPackage( packageFqName, packageProto, nameResolver, session, JvmBinaryAnnotationDeserializer(session, kotlinJvmBinaryClass, byteContent), - FirConstDeserializer(session, kotlinJvmBinaryClass, facadeBinaryClass), + FirConstDeserializer(session, facadeBinaryClass ?: kotlinJvmBinaryClass), source ), source, diff --git a/compiler/testData/compileKotlinAgainstKotlin/callsToMultifileClassFromOtherPackage.kt b/compiler/testData/compileKotlinAgainstKotlin/callsToMultifileClassFromOtherPackage.kt index f90154a952e..3c6332d89bb 100644 --- a/compiler/testData/compileKotlinAgainstKotlin/callsToMultifileClassFromOtherPackage.kt +++ b/compiler/testData/compileKotlinAgainstKotlin/callsToMultifileClassFromOtherPackage.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // FILE: A.kt diff --git a/compiler/testData/compileKotlinAgainstKotlin/constPropertyReferenceFromMultifileClass.kt b/compiler/testData/compileKotlinAgainstKotlin/constPropertyReferenceFromMultifileClass.kt index daae4e93d3e..e72e0a12217 100644 --- a/compiler/testData/compileKotlinAgainstKotlin/constPropertyReferenceFromMultifileClass.kt +++ b/compiler/testData/compileKotlinAgainstKotlin/constPropertyReferenceFromMultifileClass.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // FILE: A.kt diff --git a/compiler/testData/compileKotlinAgainstKotlin/inlinedConstants.kt b/compiler/testData/compileKotlinAgainstKotlin/inlinedConstants.kt index 635a2b19e4b..51cb24fd65a 100644 --- a/compiler/testData/compileKotlinAgainstKotlin/inlinedConstants.kt +++ b/compiler/testData/compileKotlinAgainstKotlin/inlinedConstants.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // FILE: A.kt diff --git a/compiler/testData/compileKotlinAgainstKotlin/kotlinPropertyAsAnnotationParameter.kt b/compiler/testData/compileKotlinAgainstKotlin/kotlinPropertyAsAnnotationParameter.kt index a677160e645..a43165004f0 100644 --- a/compiler/testData/compileKotlinAgainstKotlin/kotlinPropertyAsAnnotationParameter.kt +++ b/compiler/testData/compileKotlinAgainstKotlin/kotlinPropertyAsAnnotationParameter.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // FILE: A.kt From d706a7ff74096969789eaec3328b757158c1e311 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Sun, 29 Nov 2020 13:52:21 +0300 Subject: [PATCH 333/698] Build: mute failing tests Those tests are failing only on windows agents after switch to 202 platform --- tests/mute-platform.csv | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/mute-platform.csv b/tests/mute-platform.csv index 222fd589495..1a93520f31a 100644 --- a/tests/mute-platform.csv +++ b/tests/mute-platform.csv @@ -130,3 +130,20 @@ org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testTwoFiles org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testLoadedConfigurationWhenExternalFileChanged, Unprocessed,, org.jetbrains.kotlin.idea.debugger.test.IrKotlinSteppingTestGenerated.Custom.testFunctionBreakpointInStdlib,Unprocessed,, org.jetbrains.kotlin.idea.debugger.test.KotlinSteppingTestGenerated.Custom.testFunctionBreakpointInStdlib,Unprocessed,, +org.jetbrains.kotlin.idea.externalAnnotations.ExternalAnnotationTest.testNotNullMethod,Unprocessed,, FLAKY +org.jetbrains.kotlin.idea.externalAnnotations.ExternalAnnotationTest.testNullableMethodParameter,Unprocessed,, FLAKY +org.jetbrains.kotlin.idea.externalAnnotations.ExternalAnnotationTest.testNullableField,Unprocessed,, FLAKY +org.jetbrains.kotlin.idea.externalAnnotations.ExternalAnnotationTest.testNullableMethod,Unprocessed,, FLAKY +org.jetbrains.kotlin.idea.quickfix.QuickFixMultiModuleTestGenerated$Other.testConvertActualSealedClassToEnum,Unprocessed,, FLAKY +org.jetbrains.kotlin.idea.quickfix.UpdateConfigurationQuickFixTest.testEnableCoroutinesFacet,Unprocessed,, FLAKY +org.jetbrains.kotlin.idea.quickfix.UpdateConfigurationQuickFixTest.testEnableInlineClasses,Unprocessed,, FLAKY +org.jetbrains.kotlin.idea.quickfix.UpdateConfigurationQuickFixTest.testIncreaseLangLevelFacet,Unprocessed,, FLAKY +org.jetbrains.kotlin.idea.quickfix.UpdateConfigurationQuickFixTest.testIncreaseLangAndApiLevel,Unprocessed,, FLAKY +org.jetbrains.kotlin.idea.quickfix.UpdateConfigurationQuickFixTest.testIncreaseLangLevel,Unprocessed,, FLAKY +org.jetbrains.kotlin.idea.quickfix.UpdateConfigurationQuickFixTest.testDisableCoroutines,Unprocessed,, FLAKY +org.jetbrains.kotlin.idea.quickfix.UpdateConfigurationQuickFixTest.testIncreaseLangLevelFacet_10,Unprocessed,, FLAKY +org.jetbrains.kotlin.idea.quickfix.UpdateConfigurationQuickFixTest.testEnableCoroutines_UpdateRuntime,Unprocessed,, FLAKY +org.jetbrains.kotlin.idea.quickfix.UpdateConfigurationQuickFixTest.testDisableInlineClasses,Unprocessed,, FLAKY +org.jetbrains.kotlin.idea.quickfix.UpdateConfigurationQuickFixTest.testAddKotlinReflect,Unprocessed,, FLAKY +org.jetbrains.kotlin.idea.quickfix.UpdateConfigurationQuickFixTest.testEnableCoroutines,Unprocessed,, FLAKY +org.jetbrains.kotlin.idea.quickfix.UpdateConfigurationQuickFixTest.testIncreaseLangAndApiLevel_10,Unprocessed,, FLAKY From ad579de32841c181112ce7d25b06fd95192e7bd2 Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Mon, 30 Nov 2020 11:50:56 +0100 Subject: [PATCH 334/698] Don't run KaptPathsTest.testSymbolicLinks test on Windows --- plugins/kapt3/kapt3-base/test/KaptPathsTest.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/kapt3/kapt3-base/test/KaptPathsTest.kt b/plugins/kapt3/kapt3-base/test/KaptPathsTest.kt index 28489019b05..29a3c7bbb29 100644 --- a/plugins/kapt3/kapt3-base/test/KaptPathsTest.kt +++ b/plugins/kapt3/kapt3-base/test/KaptPathsTest.kt @@ -15,6 +15,7 @@ import java.nio.file.Files class KaptPathsTest : TestCase() { @Test fun testSymbolicLinks() { + if (System.getProperty("os.name").toLowerCase().contains("win")) return val tempDir = Files.createTempDirectory("kapt-test").toFile() try { fun File.writeJavaClass() = apply { From e1d54bf99f855aaf79ea25c759f9b5ffcdf6ab5a Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Mon, 30 Nov 2020 12:37:27 +0100 Subject: [PATCH 335/698] Minor, add workaround for KT-43666 --- .../experimental/jvmhost/test/ImplicitsFromScriptResultTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/scripting/jvm-host-test/test/kotlin/script/experimental/jvmhost/test/ImplicitsFromScriptResultTest.kt b/libraries/scripting/jvm-host-test/test/kotlin/script/experimental/jvmhost/test/ImplicitsFromScriptResultTest.kt index 5c26519e9cf..5c0de0ad94c 100644 --- a/libraries/scripting/jvm-host-test/test/kotlin/script/experimental/jvmhost/test/ImplicitsFromScriptResultTest.kt +++ b/libraries/scripting/jvm-host-test/test/kotlin/script/experimental/jvmhost/test/ImplicitsFromScriptResultTest.kt @@ -89,7 +89,7 @@ class CompilerHost { } private val myHostConfiguration = defaultJvmScriptingHostConfiguration.with { - getScriptingClass(GetScriptClassForImplicits(::getImplicitsClasses)) + getScriptingClass(GetScriptClassForImplicits { getImplicitsClasses() }) } private val compileConfiguration = ScriptCompilationConfiguration { From 7d9eeb684759544576e3fae8956f3aed9c6fe9bb Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Wed, 11 Nov 2020 12:48:42 +0100 Subject: [PATCH 336/698] Minor, add workaround for KT-42137 --- .../org/jetbrains/kotlin/asJava/classes/ultraLightField.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/ultraLightField.kt b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/ultraLightField.kt index ba1479ff727..077c5b8efcc 100644 --- a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/ultraLightField.kt +++ b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/ultraLightField.kt @@ -76,6 +76,9 @@ internal class KtUltraLightFieldForSourceDeclaration( override fun getContainingFile(): PsiFile = parent.containingFile override fun getPresentation(): ItemPresentation? = kotlinOrigin.let { ItemPresentationProviders.getItemPresentation(it) } override fun findElementAt(offset: Int): PsiElement? = kotlinOrigin.findElementAt(offset) + + // Workaround for KT-42137 until we update the bootstrap compiler. + override val kotlinOrigin: KtNamedDeclaration get() = super.kotlinOrigin } internal open class KtUltraLightFieldImpl protected constructor( @@ -190,4 +193,4 @@ internal open class KtUltraLightFieldImpl protected constructor( } override fun setInitializer(initializer: PsiExpression?) = cannotModify() -} \ No newline at end of file +} From c43db2ee8de8e34d5d89ac99c837bc3e23a39eca Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Mon, 30 Nov 2020 13:47:07 +0300 Subject: [PATCH 337/698] [TEST] Inherit `UpdateConfigurationQuickFixTest` from `KotlinLightPlatformCodeInsightFixtureTestCase` This is needed for proper test muting --- .../test/KotlinLightPlatformCodeInsightFixtureTestCase.kt | 7 +++++++ .../idea/quickfix/UpdateConfigurationQuickFixTest.kt | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightPlatformCodeInsightFixtureTestCase.kt b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightPlatformCodeInsightFixtureTestCase.kt index ad5ec1296af..119ee43e460 100644 --- a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightPlatformCodeInsightFixtureTestCase.kt +++ b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightPlatformCodeInsightFixtureTestCase.kt @@ -10,10 +10,17 @@ import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCa import com.intellij.util.ThrowableRunnable import org.jetbrains.kotlin.test.KotlinTestUtils import org.jetbrains.kotlin.test.TestMetadata +import org.jetbrains.kotlin.test.WithMutedInDatabaseRunTest +import org.jetbrains.kotlin.test.runTest import java.io.File import kotlin.reflect.full.findAnnotation +@WithMutedInDatabaseRunTest abstract class KotlinLightPlatformCodeInsightFixtureTestCase : LightPlatformCodeInsightFixtureTestCase() { + override fun runTest() { + runTest { super.runTest() } + } + protected open fun isFirPlugin(): Boolean = false override fun setUp() { super.setUp() diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/UpdateConfigurationQuickFixTest.kt b/idea/tests/org/jetbrains/kotlin/idea/quickfix/UpdateConfigurationQuickFixTest.kt index 32be65abea7..7a8c4b44f08 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/UpdateConfigurationQuickFixTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/UpdateConfigurationQuickFixTest.kt @@ -27,6 +27,7 @@ import org.jetbrains.kotlin.idea.facet.getRuntimeLibraryVersion import org.jetbrains.kotlin.idea.project.getLanguageVersionSettings import org.jetbrains.kotlin.idea.project.languageVersionSettings import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil +import org.jetbrains.kotlin.idea.test.KotlinLightPlatformCodeInsightFixtureTestCase import org.jetbrains.kotlin.idea.test.configureKotlinFacet import org.jetbrains.kotlin.idea.versions.bundledRuntimeVersion import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner @@ -36,7 +37,7 @@ import org.junit.runner.RunWith import java.io.File @RunWith(JUnit3WithIdeaConfigurationRunner::class) -class UpdateConfigurationQuickFixTest : LightPlatformCodeInsightFixtureTestCase() { +class UpdateConfigurationQuickFixTest : KotlinLightPlatformCodeInsightFixtureTestCase() { fun testDisableInlineClasses() { configureRuntime("mockRuntime11") resetProjectSettings(LanguageVersion.KOTLIN_1_3) From a157b58c61f51043863d91e0348ddf05f23a8135 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Mon, 30 Nov 2020 11:27:11 +0300 Subject: [PATCH 338/698] JVM_IR KT-43610 keep track of "special bridges" for interface funs --- .../kotlin/backend/jvm/lower/BridgeLowering.kt | 12 ++++++++++-- .../specialBridges/signatures/kt43610.kt | 7 +++++++ .../specialBridges/signatures/kt43610.txt | 13 +++++++++++++ .../codegen/BytecodeListingTestGenerated.java | 5 +++++ .../codegen/ir/IrBytecodeListingTestGenerated.java | 5 +++++ 5 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 compiler/testData/codegen/bytecodeListing/specialBridges/signatures/kt43610.kt create mode 100644 compiler/testData/codegen/bytecodeListing/specialBridges/signatures/kt43610.txt diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/BridgeLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/BridgeLowering.kt index 32cedb790c0..b6231123816 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/BridgeLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/BridgeLowering.kt @@ -188,8 +188,16 @@ internal class BridgeLowering(val context: JvmBackendContext) : FileLoweringPass return false // We don't produce bridges for abstract functions in interfaces. - if (irFunction.isJvmAbstract(context.state.jvmDefaultMode)) - return !irFunction.parentAsClass.isJvmInterface + if (irFunction.isJvmAbstract(context.state.jvmDefaultMode)) { + if (irFunction.parentAsClass.isJvmInterface) { + // If function requires a special bridge, we should record it for generic signatures generation. + if (irFunction.specialBridgeOrNull != null) { + context.functionsWithSpecialBridges.add(irFunction) + } + return false + } + return true + } // Finally, the JVM backend also ignores concrete fake overrides whose implementation is directly inherited from an interface. // This is sound, since we do not generate type-specialized versions of fake overrides and if the method diff --git a/compiler/testData/codegen/bytecodeListing/specialBridges/signatures/kt43610.kt b/compiler/testData/codegen/bytecodeListing/specialBridges/signatures/kt43610.kt new file mode 100644 index 00000000000..d1177f0a7f5 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/specialBridges/signatures/kt43610.kt @@ -0,0 +1,7 @@ +// WITH_SIGNATURES + +class B(val a: T) + +interface IColl : Collection> { + override fun contains(element: B): kotlin.Boolean +} diff --git a/compiler/testData/codegen/bytecodeListing/specialBridges/signatures/kt43610.txt b/compiler/testData/codegen/bytecodeListing/specialBridges/signatures/kt43610.txt new file mode 100644 index 00000000000..f7cf234e401 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/specialBridges/signatures/kt43610.txt @@ -0,0 +1,13 @@ +@kotlin.Metadata +public final class<Ljava/lang/Object;> B { + // source: 'kt43610.kt' + public final <()TT;> method getA(): java.lang.Object + public <(TT;)V> method (p0: java.lang.Object): void + private final field a: java.lang.Object +} + +@kotlin.Metadata +public interface;>;Lkotlin/jvm/internal/markers/KMappedMarker;> IColl { + // source: 'kt43610.kt' + public abstract <(LB;)Z> method contains(@org.jetbrains.annotations.NotNull p0: B): boolean +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index 50083f9262c..1a8ec1ca579 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -1552,6 +1552,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/specialBridges/signatures/implementsSortedMap.kt"); } + @TestMetadata("kt43610.kt") + public void testKt43610() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/specialBridges/signatures/kt43610.kt"); + } + @TestMetadata("nonGenericClass.kt") public void testNonGenericClass() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/specialBridges/signatures/nonGenericClass.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index 16284c09f95..51cdf696c7d 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -1522,6 +1522,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/specialBridges/signatures/implementsSortedMap.kt"); } + @TestMetadata("kt43610.kt") + public void testKt43610() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/specialBridges/signatures/kt43610.kt"); + } + @TestMetadata("nonGenericClass.kt") public void testNonGenericClass() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/specialBridges/signatures/nonGenericClass.kt"); From 3b604cfa7f521943511b059b15e67ecf06395e47 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Mon, 30 Nov 2020 11:54:56 +0300 Subject: [PATCH 339/698] JVM_IR KT-32701 generate multiple big arity invokes, report error later --- .../lower/FunctionNVarargBridgeLowering.kt | 34 ++++++++----------- .../multipleBigArityFunsImplemented.kt | 20 +++++++++++ .../multipleBigArityFunsImplemented.txt | 10 ++++++ .../multipleBigArityFunsImplemented_ir.kt | 20 +++++++++++ .../multipleBigArityFunsImplemented_ir.txt | 10 ++++++ ...gnosticsTestWithJvmIrBackendGenerated.java | 5 +++ ...nosticsTestWithOldJvmBackendGenerated.java | 5 +++ 7 files changed, 85 insertions(+), 19 deletions(-) create mode 100644 compiler/testData/diagnostics/testsWithJvmBackend/multipleBigArityFunsImplemented.kt create mode 100644 compiler/testData/diagnostics/testsWithJvmBackend/multipleBigArityFunsImplemented.txt create mode 100644 compiler/testData/diagnostics/testsWithJvmBackend/multipleBigArityFunsImplemented_ir.kt create mode 100644 compiler/testData/diagnostics/testsWithJvmBackend/multipleBigArityFunsImplemented_ir.txt diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionNVarargBridgeLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionNVarargBridgeLowering.kt index 2ebf83b546f..d03fdd42e89 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionNVarargBridgeLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionNVarargBridgeLowering.kt @@ -76,26 +76,22 @@ private class FunctionNVarargBridgeLowering(val context: JvmBackendContext) : return super.visitClassNew(declaration) declaration.transformChildrenVoid(this) - // Note that we allow classes with multiple function supertypes, so long as only one - // of them has more than 22 arguments. - // TODO: Add a proper diagnostic message in the frontend - assert(bigArityFunctionSuperTypes.size == 1) { - "Class has multiple big-arity function super types: ${bigArityFunctionSuperTypes.joinToString { it.render() }}" - } + // Note that we allow classes with multiple function supertypes, so long as only one of them has more than 22 arguments. + // Code below will generate one 'invoke' for each function supertype, + // which will cause conflicting inherited JVM signatures error diagnostics in case of multiple big arity function supertypes. + for (superType in bigArityFunctionSuperTypes) { + declaration.superTypes -= superType + declaration.superTypes += context.ir.symbols.functionN.typeWith( + (superType.arguments.last() as IrTypeProjection).type + ) - // Fix super class - val superType = bigArityFunctionSuperTypes.single() - declaration.superTypes -= superType - declaration.superTypes += context.ir.symbols.functionN.typeWith( - (superType.arguments.last() as IrTypeProjection).type - ) - - // Add vararg invoke bridge - val invokeFunction = declaration.functions.single { - it.name.asString() == "invoke" && it.valueParameters.size == superType.arguments.size - if (it.isSuspend) 0 else 1 + // Add vararg invoke bridge + val invokeFunction = declaration.functions.single { + it.name.asString() == "invoke" && it.valueParameters.size == superType.arguments.size - if (it.isSuspend) 0 else 1 + } + invokeFunction.overriddenSymbols = emptyList() + declaration.addBridge(invokeFunction, functionNInvokeFun.owner) } - invokeFunction.overriddenSymbols = emptyList() - declaration.addBridge(invokeFunction, functionNInvokeFun.owner) return declaration } @@ -123,7 +119,7 @@ private class FunctionNVarargBridgeLowering(val context: JvmBackendContext) : irInt(argumentCount) ), irCall(context.irBuiltIns.illegalArgumentExceptionSymbol).apply { - putValueArgument(0, irString("Expected ${argumentCount} arguments")) + putValueArgument(0, irString("Expected $argumentCount arguments")) } ) diff --git a/compiler/testData/diagnostics/testsWithJvmBackend/multipleBigArityFunsImplemented.kt b/compiler/testData/diagnostics/testsWithJvmBackend/multipleBigArityFunsImplemented.kt new file mode 100644 index 00000000000..953510b6bc4 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJvmBackend/multipleBigArityFunsImplemented.kt @@ -0,0 +1,20 @@ +// TARGET_BACKEND: JVM_OLD +class Fun : + (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, + Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Int, + (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, + Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Int +{ + override fun invoke( + p00: Int, p01: Int, p02: Int, p03: Int, p04: Int, p05: Int, p06: Int, p07: Int, p08: Int, p09: Int, + p10: Int, p11: Int, p12: Int, p13: Int, p14: Int, p15: Int, p16: Int, p17: Int, p18: Int, p19: Int, + p20: Int, p21: Int, p22: Int, p23: Int, p24: Int, p25: Int, p26: Int, p27: Int, p28: Int, p29: Int + ): Int = 330 + + override fun invoke( + p00: Int, p01: Int, p02: Int, p03: Int, p04: Int, p05: Int, p06: Int, p07: Int, p08: Int, p09: Int, + p10: Int, p11: Int, p12: Int, p13: Int, p14: Int, p15: Int, p16: Int, p17: Int, p18: Int, p19: Int, + p20: Int, p21: Int, p22: Int, p23: Int, p24: Int, p25: Int, p26: Int, p27: Int, p28: Int, p29: Int, + p30: Int, p31: Int, p32: Int + ): Int = 333 +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJvmBackend/multipleBigArityFunsImplemented.txt b/compiler/testData/diagnostics/testsWithJvmBackend/multipleBigArityFunsImplemented.txt new file mode 100644 index 00000000000..6d94b0386fb --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJvmBackend/multipleBigArityFunsImplemented.txt @@ -0,0 +1,10 @@ +package + +public final class Fun : (kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int) -> kotlin.Int, (kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int) -> kotlin.Int { + public constructor Fun() + public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ fun invoke(/*0*/ p00: kotlin.Int, /*1*/ p01: kotlin.Int, /*2*/ p02: kotlin.Int, /*3*/ p03: kotlin.Int, /*4*/ p04: kotlin.Int, /*5*/ p05: kotlin.Int, /*6*/ p06: kotlin.Int, /*7*/ p07: kotlin.Int, /*8*/ p08: kotlin.Int, /*9*/ p09: kotlin.Int, /*10*/ p10: kotlin.Int, /*11*/ p11: kotlin.Int, /*12*/ p12: kotlin.Int, /*13*/ p13: kotlin.Int, /*14*/ p14: kotlin.Int, /*15*/ p15: kotlin.Int, /*16*/ p16: kotlin.Int, /*17*/ p17: kotlin.Int, /*18*/ p18: kotlin.Int, /*19*/ p19: kotlin.Int, /*20*/ p20: kotlin.Int, /*21*/ p21: kotlin.Int, /*22*/ p22: kotlin.Int, /*23*/ p23: kotlin.Int, /*24*/ p24: kotlin.Int, /*25*/ p25: kotlin.Int, /*26*/ p26: kotlin.Int, /*27*/ p27: kotlin.Int, /*28*/ p28: kotlin.Int, /*29*/ p29: kotlin.Int): kotlin.Int + public open override /*1*/ fun invoke(/*0*/ p00: kotlin.Int, /*1*/ p01: kotlin.Int, /*2*/ p02: kotlin.Int, /*3*/ p03: kotlin.Int, /*4*/ p04: kotlin.Int, /*5*/ p05: kotlin.Int, /*6*/ p06: kotlin.Int, /*7*/ p07: kotlin.Int, /*8*/ p08: kotlin.Int, /*9*/ p09: kotlin.Int, /*10*/ p10: kotlin.Int, /*11*/ p11: kotlin.Int, /*12*/ p12: kotlin.Int, /*13*/ p13: kotlin.Int, /*14*/ p14: kotlin.Int, /*15*/ p15: kotlin.Int, /*16*/ p16: kotlin.Int, /*17*/ p17: kotlin.Int, /*18*/ p18: kotlin.Int, /*19*/ p19: kotlin.Int, /*20*/ p20: kotlin.Int, /*21*/ p21: kotlin.Int, /*22*/ p22: kotlin.Int, /*23*/ p23: kotlin.Int, /*24*/ p24: kotlin.Int, /*25*/ p25: kotlin.Int, /*26*/ p26: kotlin.Int, /*27*/ p27: kotlin.Int, /*28*/ p28: kotlin.Int, /*29*/ p29: kotlin.Int, /*30*/ p30: kotlin.Int, /*31*/ p31: kotlin.Int, /*32*/ p32: kotlin.Int): kotlin.Int + public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/testsWithJvmBackend/multipleBigArityFunsImplemented_ir.kt b/compiler/testData/diagnostics/testsWithJvmBackend/multipleBigArityFunsImplemented_ir.kt new file mode 100644 index 00000000000..e5739aed82b --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJvmBackend/multipleBigArityFunsImplemented_ir.kt @@ -0,0 +1,20 @@ +// TARGET_BACKEND: JVM_IR +class Fun : + (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, + Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Int, + (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, + Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Int +{ + override fun invoke( + p00: Int, p01: Int, p02: Int, p03: Int, p04: Int, p05: Int, p06: Int, p07: Int, p08: Int, p09: Int, + p10: Int, p11: Int, p12: Int, p13: Int, p14: Int, p15: Int, p16: Int, p17: Int, p18: Int, p19: Int, + p20: Int, p21: Int, p22: Int, p23: Int, p24: Int, p25: Int, p26: Int, p27: Int, p28: Int, p29: Int + ): Int = 330 + + override fun invoke( + p00: Int, p01: Int, p02: Int, p03: Int, p04: Int, p05: Int, p06: Int, p07: Int, p08: Int, p09: Int, + p10: Int, p11: Int, p12: Int, p13: Int, p14: Int, p15: Int, p16: Int, p17: Int, p18: Int, p19: Int, + p20: Int, p21: Int, p22: Int, p23: Int, p24: Int, p25: Int, p26: Int, p27: Int, p28: Int, p29: Int, + p30: Int, p31: Int, p32: Int + ): Int = 333 +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJvmBackend/multipleBigArityFunsImplemented_ir.txt b/compiler/testData/diagnostics/testsWithJvmBackend/multipleBigArityFunsImplemented_ir.txt new file mode 100644 index 00000000000..6d94b0386fb --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJvmBackend/multipleBigArityFunsImplemented_ir.txt @@ -0,0 +1,10 @@ +package + +public final class Fun : (kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int) -> kotlin.Int, (kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int, kotlin.Int) -> kotlin.Int { + public constructor Fun() + public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ fun invoke(/*0*/ p00: kotlin.Int, /*1*/ p01: kotlin.Int, /*2*/ p02: kotlin.Int, /*3*/ p03: kotlin.Int, /*4*/ p04: kotlin.Int, /*5*/ p05: kotlin.Int, /*6*/ p06: kotlin.Int, /*7*/ p07: kotlin.Int, /*8*/ p08: kotlin.Int, /*9*/ p09: kotlin.Int, /*10*/ p10: kotlin.Int, /*11*/ p11: kotlin.Int, /*12*/ p12: kotlin.Int, /*13*/ p13: kotlin.Int, /*14*/ p14: kotlin.Int, /*15*/ p15: kotlin.Int, /*16*/ p16: kotlin.Int, /*17*/ p17: kotlin.Int, /*18*/ p18: kotlin.Int, /*19*/ p19: kotlin.Int, /*20*/ p20: kotlin.Int, /*21*/ p21: kotlin.Int, /*22*/ p22: kotlin.Int, /*23*/ p23: kotlin.Int, /*24*/ p24: kotlin.Int, /*25*/ p25: kotlin.Int, /*26*/ p26: kotlin.Int, /*27*/ p27: kotlin.Int, /*28*/ p28: kotlin.Int, /*29*/ p29: kotlin.Int): kotlin.Int + public open override /*1*/ fun invoke(/*0*/ p00: kotlin.Int, /*1*/ p01: kotlin.Int, /*2*/ p02: kotlin.Int, /*3*/ p03: kotlin.Int, /*4*/ p04: kotlin.Int, /*5*/ p05: kotlin.Int, /*6*/ p06: kotlin.Int, /*7*/ p07: kotlin.Int, /*8*/ p08: kotlin.Int, /*9*/ p09: kotlin.Int, /*10*/ p10: kotlin.Int, /*11*/ p11: kotlin.Int, /*12*/ p12: kotlin.Int, /*13*/ p13: kotlin.Int, /*14*/ p14: kotlin.Int, /*15*/ p15: kotlin.Int, /*16*/ p16: kotlin.Int, /*17*/ p17: kotlin.Int, /*18*/ p18: kotlin.Int, /*19*/ p19: kotlin.Int, /*20*/ p20: kotlin.Int, /*21*/ p21: kotlin.Int, /*22*/ p22: kotlin.Int, /*23*/ p23: kotlin.Int, /*24*/ p24: kotlin.Int, /*25*/ p25: kotlin.Int, /*26*/ p26: kotlin.Int, /*27*/ p27: kotlin.Int, /*28*/ p28: kotlin.Int, /*29*/ p29: kotlin.Int, /*30*/ p30: kotlin.Int, /*31*/ p31: kotlin.Int, /*32*/ p32: kotlin.Int): kotlin.Int + public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJvmIrBackendGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJvmIrBackendGenerated.java index 0e71ce26617..a2f5b30b304 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJvmIrBackendGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJvmIrBackendGenerated.java @@ -39,6 +39,11 @@ public class DiagnosticsTestWithJvmIrBackendGenerated extends AbstractDiagnostic runTest("compiler/testData/diagnostics/testsWithJvmBackend/inlineCycle_ir.kt"); } + @TestMetadata("multipleBigArityFunsImplemented_ir.kt") + public void testMultipleBigArityFunsImplemented_ir() throws Exception { + runTest("compiler/testData/diagnostics/testsWithJvmBackend/multipleBigArityFunsImplemented_ir.kt"); + } + @TestMetadata("suspendInlineCycle_ir.kt") public void testSuspendInlineCycle_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/suspendInlineCycle_ir.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithOldJvmBackendGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithOldJvmBackendGenerated.java index 66044c1c3b7..6b90997e0e1 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithOldJvmBackendGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithOldJvmBackendGenerated.java @@ -39,6 +39,11 @@ public class DiagnosticsTestWithOldJvmBackendGenerated extends AbstractDiagnosti runTest("compiler/testData/diagnostics/testsWithJvmBackend/inlineCycle.kt"); } + @TestMetadata("multipleBigArityFunsImplemented.kt") + public void testMultipleBigArityFunsImplemented() throws Exception { + runTest("compiler/testData/diagnostics/testsWithJvmBackend/multipleBigArityFunsImplemented.kt"); + } + @TestMetadata("suspendInlineCycle.kt") public void testSuspendInlineCycle() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/suspendInlineCycle.kt"); From b2aed536c99f6d425b935cef2eb3490bc150591d Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Mon, 30 Nov 2020 12:22:15 +0300 Subject: [PATCH 340/698] JVM_IR KT-39612 process subexpressions recursively in 'name' lowering --- .../codegen/ir/FirBytecodeTextTestGenerated.java | 5 +++++ .../common/lower/KCallableNamePropertyLowering.kt | 13 +++++++++---- .../bytecodeText/callableReference/kt39612.kt | 11 +++++++++++ .../kotlin/codegen/BytecodeTextTestGenerated.java | 5 +++++ .../codegen/ir/IrBytecodeTextTestGenerated.java | 5 +++++ 5 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 compiler/testData/codegen/bytecodeText/callableReference/kt39612.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBytecodeTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBytecodeTextTestGenerated.java index 319b6bd6eed..83b4453a87f 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBytecodeTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBytecodeTextTestGenerated.java @@ -774,6 +774,11 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest { runTest("compiler/testData/codegen/bytecodeText/callableReference/kt36975.kt"); } + @TestMetadata("kt39612.kt") + public void testKt39612() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/callableReference/kt39612.kt"); + } + @TestMetadata("nameIntrinsicWithImplicitThis.kt") public void testNameIntrinsicWithImplicitThis() throws Exception { runTest("compiler/testData/codegen/bytecodeText/callableReference/nameIntrinsicWithImplicitThis.kt"); diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/KCallableNamePropertyLowering.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/KCallableNamePropertyLowering.kt index 1e8a3834d02..a2ee86c70a5 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/KCallableNamePropertyLowering.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/KCallableNamePropertyLowering.kt @@ -55,14 +55,19 @@ private class KCallableNamePropertyTransformer(val lower: KCallableNamePropertyL } override fun visitCall(expression: IrCall): IrExpression { - val callableReference = expression.dispatchReceiver as? IrCallableReference<*> ?: return expression + val callableReference = expression.dispatchReceiver as? IrCallableReference<*> + ?: return super.visitCall(expression) - //TODO rewrite checking val directMember = expression.symbol.owner.let { (it as? IrSimpleFunction)?.correspondingPropertySymbol?.owner ?: it } - val irClass = directMember.parent as? IrClass ?: return expression - if (!irClass.isSubclassOf(lower.context.irBuiltIns.kCallableClass.owner)) return expression + + val irClass = directMember.parent as? IrClass + ?: return super.visitCall(expression) + if (!irClass.isSubclassOf(lower.context.irBuiltIns.kCallableClass.owner)) { + return super.visitCall(expression) + } + val name = when (directMember) { is IrSimpleFunction -> directMember.name is IrProperty -> directMember.name diff --git a/compiler/testData/codegen/bytecodeText/callableReference/kt39612.kt b/compiler/testData/codegen/bytecodeText/callableReference/kt39612.kt new file mode 100644 index 00000000000..f9da0cf410d --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/callableReference/kt39612.kt @@ -0,0 +1,11 @@ +// IGNORE_BACKEND_FIR: JVM_IR +fun foo() {} + +fun id(s: String) = s + +fun test1() = id(::foo.name) + +fun test2(name: String) = (if (name == ::foo.name) ::foo else ::id).annotations + +// 0 getName +// 3 LDC "foo" \ No newline at end of file diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java index 93a10805ec3..b4e160d8211 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java @@ -774,6 +774,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest { runTest("compiler/testData/codegen/bytecodeText/callableReference/kt36975.kt"); } + @TestMetadata("kt39612.kt") + public void testKt39612() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/callableReference/kt39612.kt"); + } + @TestMetadata("nameIntrinsicWithImplicitThis.kt") public void testNameIntrinsicWithImplicitThis() throws Exception { runTest("compiler/testData/codegen/bytecodeText/callableReference/nameIntrinsicWithImplicitThis.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java index 5c6213c0ca3..315f7cd4837 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java @@ -774,6 +774,11 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest { runTest("compiler/testData/codegen/bytecodeText/callableReference/kt36975.kt"); } + @TestMetadata("kt39612.kt") + public void testKt39612() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/callableReference/kt39612.kt"); + } + @TestMetadata("nameIntrinsicWithImplicitThis.kt") public void testNameIntrinsicWithImplicitThis() throws Exception { runTest("compiler/testData/codegen/bytecodeText/callableReference/nameIntrinsicWithImplicitThis.kt"); From 96ed99d62e13dfbcf58cc8612331c55385aac25c Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Mon, 30 Nov 2020 12:48:13 +0300 Subject: [PATCH 341/698] JVM_IR KT-40305 no nullability assertions on built-in stubs --- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 +++ .../backend/jvm/codegen/ExpressionCodegen.kt | 1 + .../codegen/box/collections/kt40305.kt | 35 +++++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 5 +++ .../LightAnalysisModeTestGenerated.java | 5 +++ .../ir/IrBlackBoxCodegenTestGenerated.java | 5 +++ 6 files changed, 56 insertions(+) create mode 100644 compiler/testData/codegen/box/collections/kt40305.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 15c672656f4..a3ad4829eab 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -5058,6 +5058,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/collections/javaCollectionWithRemovePrimitiveInt.kt"); } + @TestMetadata("kt40305.kt") + public void testKt40305() throws Exception { + runTest("compiler/testData/codegen/box/collections/kt40305.kt"); + } + @TestMetadata("kt41123.kt") public void testKt41123() throws Exception { runTest("compiler/testData/codegen/box/collections/kt41123.kt"); diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt index d525bb4b723..94f2f148fbf 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt @@ -295,6 +295,7 @@ class ExpressionCodegen( irFunction.origin == IrDeclarationOrigin.BRIDGE_SPECIAL || irFunction.origin == JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE || irFunction.origin == JvmLoweredDeclarationOrigin.JVM_STATIC_WRAPPER || + irFunction.origin == IrDeclarationOrigin.IR_BUILTINS_STUB || irFunction.parentAsClass.origin == JvmLoweredDeclarationOrigin.CONTINUATION_CLASS || irFunction.parentAsClass.origin == JvmLoweredDeclarationOrigin.SUSPEND_LAMBDA || irFunction.isMultifileBridge() diff --git a/compiler/testData/codegen/box/collections/kt40305.kt b/compiler/testData/codegen/box/collections/kt40305.kt new file mode 100644 index 00000000000..f932a3e3f97 --- /dev/null +++ b/compiler/testData/codegen/box/collections/kt40305.kt @@ -0,0 +1,35 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME +// FILE: kt40305.kt + +class ListImpl(private val list: List): List { + override val size: Int get() = list.size + override fun contains(element: A): Boolean = list.contains(element) + override fun containsAll(elements: Collection): Boolean = list.containsAll(elements) + override fun get(index: Int): A = list.get(index) + override fun indexOf(element: A): Int = list.indexOf(element) + override fun isEmpty(): Boolean = list.isEmpty() + override fun iterator(): Iterator = list.iterator() + override fun lastIndexOf(element: A): Int = list.lastIndexOf(element) + override fun listIterator(): ListIterator = list.listIterator() + override fun listIterator(index: Int): ListIterator = list.listIterator(index) + override fun subList(fromIndex: Int, toIndex: Int): List = list.subList(fromIndex, toIndex) +} + +fun box(): String { + try { + J.testAddAllNull(ListImpl(listOf())) + } catch (e: UnsupportedOperationException) { + return "OK" + } + return "J.testAddAllNull(ListImpl(...)) should throw UnsupportedOperationException" +} + +// FILE: J.java +import java.util.List; + +public class J { + public static void testAddAllNull(List list) { + list.addAll(null); + } +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 7efe75445da..b8f21d40e9c 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -5088,6 +5088,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/collections/javaCollectionWithRemovePrimitiveInt.kt"); } + @TestMetadata("kt40305.kt") + public void testKt40305() throws Exception { + runTest("compiler/testData/codegen/box/collections/kt40305.kt"); + } + @TestMetadata("kt41123.kt") public void testKt41123() throws Exception { runTest("compiler/testData/codegen/box/collections/kt41123.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index c2f808a05e0..9a01f7b60b2 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -5088,6 +5088,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/collections/javaCollectionWithRemovePrimitiveInt.kt"); } + @TestMetadata("kt40305.kt") + public void testKt40305() throws Exception { + runTest("compiler/testData/codegen/box/collections/kt40305.kt"); + } + @TestMetadata("kt41123.kt") public void testKt41123() throws Exception { runTest("compiler/testData/codegen/box/collections/kt41123.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index f0d1879aff3..b131d788a67 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -5058,6 +5058,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/collections/javaCollectionWithRemovePrimitiveInt.kt"); } + @TestMetadata("kt40305.kt") + public void testKt40305() throws Exception { + runTest("compiler/testData/codegen/box/collections/kt40305.kt"); + } + @TestMetadata("kt41123.kt") public void testKt41123() throws Exception { runTest("compiler/testData/codegen/box/collections/kt41123.kt"); From e7789d2e308c9670cdd4fcfb0efcb9697e9d73a4 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Mon, 30 Nov 2020 14:18:04 +0300 Subject: [PATCH 342/698] [Gradle, JS] Add filter on file on fileCollectionDependencies because Gradle can't hash directory ^KT-43668 fixed --- .../targets/js/npm/resolver/KotlinCompilationNpmResolver.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/npm/resolver/KotlinCompilationNpmResolver.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/npm/resolver/KotlinCompilationNpmResolver.kt index 1e301b770c9..713979eee81 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/npm/resolver/KotlinCompilationNpmResolver.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/npm/resolver/KotlinCompilationNpmResolver.kt @@ -339,7 +339,7 @@ internal class KotlinCompilationNpmResolver( resolver.gradleNodeModules.get(it.dependency.moduleName, it.dependency.moduleVersion, it.artifact.file) } + fileCollectionDependencies.flatMap { dependency -> dependency.files - .filter { it.exists() } + .filter { it.exists() && it.isFile } .map { file -> resolver.gradleNodeModules.get( file.name, From ac42dcd8dae8d4e953d55c349bb2d61b8c18eb1b Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Fri, 20 Nov 2020 15:04:09 +0300 Subject: [PATCH 343/698] [JS IR] Add test for external fun vararg [JS IR] Add tests with empty vararg and default arg before it [JS IR] Ignore backend in tests instead of target backend [JS IR] Add function with named spread operator [JS IR] Remove ignoring of current js backend in jsExternalVarargFun [JS IR] Add with arguments after vararg ^KT-42357 fixed --- .../semantics/IrBoxJsES6TestGenerated.java | 23 +++++++ .../ir/semantics/IrBoxJsTestGenerated.java | 23 +++++++ .../js/test/semantics/BoxJsTestGenerated.java | 23 +++++++ .../box/vararg/jsExternalVarargCtor.kt | 67 +++++++++++++++++++ .../box/vararg/jsExternalVarargFun.kt | 61 +++++++++++++++++ 5 files changed, 197 insertions(+) create mode 100644 js/js.translator/testData/box/vararg/jsExternalVarargCtor.kt create mode 100644 js/js.translator/testData/box/vararg/jsExternalVarargFun.kt diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java index 72847fb334f..4c043c4bc37 100644 --- a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java +++ b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java @@ -7840,4 +7840,27 @@ public class IrBoxJsES6TestGenerated extends AbstractIrBoxJsES6Test { runTest("js/js.translator/testData/box/trait/traitExtendsTwoTraits.kt"); } } + + @TestMetadata("js/js.translator/testData/box/vararg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Vararg extends AbstractIrBoxJsES6Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); + } + + public void testAllFilesPresentInVararg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/vararg"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + + @TestMetadata("jsExternalVarargCtor.kt") + public void testJsExternalVarargCtor() throws Exception { + runTest("js/js.translator/testData/box/vararg/jsExternalVarargCtor.kt"); + } + + @TestMetadata("jsExternalVarargFun.kt") + public void testJsExternalVarargFun() throws Exception { + runTest("js/js.translator/testData/box/vararg/jsExternalVarargFun.kt"); + } + } } diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java index 61cbddedf67..b11a56171c3 100644 --- a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java +++ b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java @@ -7840,4 +7840,27 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest { runTest("js/js.translator/testData/box/trait/traitExtendsTwoTraits.kt"); } } + + @TestMetadata("js/js.translator/testData/box/vararg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Vararg extends AbstractIrBoxJsTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInVararg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/vararg"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true); + } + + @TestMetadata("jsExternalVarargCtor.kt") + public void testJsExternalVarargCtor() throws Exception { + runTest("js/js.translator/testData/box/vararg/jsExternalVarargCtor.kt"); + } + + @TestMetadata("jsExternalVarargFun.kt") + public void testJsExternalVarargFun() throws Exception { + runTest("js/js.translator/testData/box/vararg/jsExternalVarargFun.kt"); + } + } } diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java index 6a78d1ee0e5..c70a9f1fb0c 100644 --- a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java +++ b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java @@ -7870,4 +7870,27 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest { runTest("js/js.translator/testData/box/trait/traitExtendsTwoTraits.kt"); } } + + @TestMetadata("js/js.translator/testData/box/vararg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Vararg extends AbstractBoxJsTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); + } + + public void testAllFilesPresentInVararg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/vararg"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS, true); + } + + @TestMetadata("jsExternalVarargCtor.kt") + public void testJsExternalVarargCtor() throws Exception { + runTest("js/js.translator/testData/box/vararg/jsExternalVarargCtor.kt"); + } + + @TestMetadata("jsExternalVarargFun.kt") + public void testJsExternalVarargFun() throws Exception { + runTest("js/js.translator/testData/box/vararg/jsExternalVarargFun.kt"); + } + } } diff --git a/js/js.translator/testData/box/vararg/jsExternalVarargCtor.kt b/js/js.translator/testData/box/vararg/jsExternalVarargCtor.kt new file mode 100644 index 00000000000..2c392729d0f --- /dev/null +++ b/js/js.translator/testData/box/vararg/jsExternalVarargCtor.kt @@ -0,0 +1,67 @@ +// IGNORE_BACKEND: JS + +//KT-42357 + +// FILE: main.kt +external class FieldPath { + constructor( + arg: Int = definedExternally, + vararg args: String + ) + + constructor( + arg: Int = definedExternally, + vararg args: String, + o: Long + ) +} + +external val ctorCallArgs: Array + +fun box(): String { + FieldPath() + if (ctorCallArgs.size != 0) return "fail: $ctorCallArgs arguments" + + FieldPath(1) + if (ctorCallArgs.size != 1 || js("typeof ctorCallArgs[0] !== 'number'")) return "fail1: $ctorCallArgs arguments" + + FieldPath(2, "p0", "p1", "p3") + if (ctorCallArgs.size != 4 || js("typeof ctorCallArgs[0] !== 'number'") || js("typeof ctorCallArgs[1] !== 'string'")) + return "fail2: $ctorCallArgs arguments" + + FieldPath(3, args = arrayOf("p0", "p1")) + if (ctorCallArgs.size != 3 || js("typeof ctorCallArgs[0] !== 'number'") || js("typeof ctorCallArgs[1] !== 'string'")) + return "fail3: $ctorCallArgs arguments" + + FieldPath(4, *arrayOf("p0", "p1")) + if (ctorCallArgs.size != 3 || js("typeof ctorCallArgs[0] !== 'number'") || js("typeof ctorCallArgs[1] !== 'string'")) + return "fail4: $ctorCallArgs arguments" + + FieldPath(5, args = *arrayOf("p0", "p1")) + if (ctorCallArgs.size != 3 || js("typeof ctorCallArgs[0] !== 'number'") || js("typeof ctorCallArgs[1] !== 'string'")) + return "fail5: $ctorCallArgs arguments" + + FieldPath(42, "a", "b", "c", o = 99L) + if (ctorCallArgs.size != 5 || js("typeof ctorCallArgs[0] !== 'number'") || js("typeof ctorCallArgs[1] !== 'string'")) + return "fail6: $ctorCallArgs arguments" + + FieldPath(5, args = *arrayOf("p0", "p1"), o = 87L) + if (ctorCallArgs.size != 4 || js("typeof ctorCallArgs[0] !== 'number'") || js("typeof ctorCallArgs[1] !== 'string'")) + return "fail6: $ctorCallArgs arguments" + + FieldPath(4, *arrayOf("p0", "p1"), o = 99L) + if (ctorCallArgs.size != 4 || js("typeof ctorCallArgs[0] !== 'number'") || js("typeof ctorCallArgs[1] !== 'string'")) + return "fail7: $ctorCallArgs arguments" + + FieldPath(11, *arrayOf(), o = 123456L) + if (ctorCallArgs.size != 2 || js("typeof ctorCallArgs[0] !== 'number'")) + return "fail9: $ctorCallArgs arguments" + + return "OK" +} + +// FILE: main.js +var ctorCallArgs; +function FieldPath() { + ctorCallArgs = arguments; +} \ No newline at end of file diff --git a/js/js.translator/testData/box/vararg/jsExternalVarargFun.kt b/js/js.translator/testData/box/vararg/jsExternalVarargFun.kt new file mode 100644 index 00000000000..ac5ab0cc284 --- /dev/null +++ b/js/js.translator/testData/box/vararg/jsExternalVarargFun.kt @@ -0,0 +1,61 @@ +//KT-42357 + +// FILE: main.kt +external fun create( + arg: Int = definedExternally, + vararg args: String +) : Array + +external fun create( + arg: Int = definedExternally, + vararg args: String, + o: Long +) : Array + +fun box(): String { + val zeroArgs = create() + if (zeroArgs.size != 0) return "fail: $zeroArgs arguments" + + val oneArg = create(1) + if (oneArg.size != 1 || js("typeof oneArg[0] !== 'number'")) + return "fail1: $oneArg arguments" + + val varArgs = create(2, "p0", "p1", "p3") + if (varArgs.size != 4 || js("typeof varArgs[0] !== 'number'") || js("typeof varArgs[1] !== 'string'")) + return "fail2: $varArgs arguments" + + val namedParameter = create(3, args = arrayOf("p0", "p1")) + if (namedParameter.size != 3 || js("typeof namedParameter[0] !== 'number'") || js("typeof namedParameter[1] !== 'string'")) + return "fail3: $namedParameter arguments" + + val spreadArgs = create(4, *arrayOf("p0", "p1")) + if (spreadArgs.size != 3 || js("typeof spreadArgs[0] !== 'number'") || js("typeof spreadArgs[1] !== 'string'")) + return "fail4: $spreadArgs arguments" + + val spreadNamedArgs = create(5, args = *arrayOf("p0", "p1")) + if (spreadNamedArgs.size != 3 || js("typeof spreadNamedArgs[0] !== 'number'") || js("typeof spreadNamedArgs[1] !== 'string'")) + return "fail5: $spreadNamedArgs arguments" + + val argAfterVararg = create(42, "a", "b", "c", o = 99L) + if (argAfterVararg.size != 5 || js("typeof argAfterVararg[0] !== 'number'") || js("typeof argAfterVararg[1] !== 'string'")) + return "fail6: $argAfterVararg arguments" + + val argAfterSpreadNamedVararg = create(5, args = *arrayOf("p0", "p1"), o = 87L) + if (argAfterSpreadNamedVararg.size != 4 || js("typeof argAfterSpreadNamedVararg[0] !== 'number'") || js("typeof argAfterSpreadNamedVararg[1] !== 'string'")) + return "fail7: $argAfterSpreadNamedVararg arguments" + + val argAfterSpreadVararg = create(4, *arrayOf("p0", "p1"), o = 99L) + if (argAfterSpreadVararg.size != 4 || js("typeof argAfterSpreadVararg[0] !== 'number'") || js("typeof argAfterSpreadVararg[1] !== 'string'")) + return "fail8: $argAfterSpreadVararg arguments" + + val argAfterSpreadEmptyVararg = create(11, *arrayOf(), o = 123456L) + if (argAfterSpreadEmptyVararg.size != 2 || js("typeof argAfterSpreadEmptyVararg[0] !== 'number'")) + return "fail9: $argAfterSpreadEmptyVararg arguments" + + return "OK" +} + +// FILE: main.js +function create() { + return arguments +} From 67e4b0948e7c2b84ec18846346912bf65d8158f4 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Fri, 20 Nov 2020 23:50:44 +0300 Subject: [PATCH 344/698] [JS IR] Constructor call with vararg invoking with apply [JS IR] Nullize external empty varargs [JS IR] Concat varargs with array of nonVarargs arguments ^KT-42357 fixed --- .../IrElementToJsExpressionTransformer.kt | 38 +++++--- .../js/transformers/irToJs/jsAstUtils.kt | 86 ++++++++++++++----- 2 files changed, 91 insertions(+), 33 deletions(-) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrElementToJsExpressionTransformer.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrElementToJsExpressionTransformer.kt index 6c2fcf9d4db..40ad1c3ee49 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrElementToJsExpressionTransformer.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrElementToJsExpressionTransformer.kt @@ -7,10 +7,7 @@ package org.jetbrains.kotlin.ir.backend.js.transformers.irToJs import org.jetbrains.kotlin.backend.common.ir.isElseBranch import org.jetbrains.kotlin.descriptors.ClassKind -import org.jetbrains.kotlin.ir.backend.js.utils.JsGenerationContext -import org.jetbrains.kotlin.ir.backend.js.utils.Namer -import org.jetbrains.kotlin.ir.backend.js.utils.emptyScope -import org.jetbrains.kotlin.ir.backend.js.utils.getJsNameOrKotlinName +import org.jetbrains.kotlin.ir.backend.js.utils.* import org.jetbrains.kotlin.ir.declarations.IrClass import org.jetbrains.kotlin.ir.declarations.IrConstructor import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction @@ -156,14 +153,33 @@ class IrElementToJsExpressionTransformer : BaseIrElementToJsNodeTransformer - context.getRefForExternalClass(klass) - - else -> - context.getNameForClass(klass).makeRef() + when { + klass.isEffectivelyExternal() -> { + val refForExternalClass = context.getRefForExternalClass(klass) + val varargParameterIndex = expression.symbol.owner.varargParameterIndex() + if (varargParameterIndex == -1) { + JsNew(refForExternalClass, arguments) + } else { + val argumentsAsSingleArray = argumentsAsSingleArray( + JsNullLiteral(), + arguments, + varargParameterIndex + ) + JsNew( + JsInvocation( + JsNameRef("apply", JsNameRef("bind", JsNameRef("Function"))), + refForExternalClass, + argumentsAsSingleArray + ), + emptyList() + ) + } + } + else -> { + val ref = context.getNameForClass(klass).makeRef() + JsNew(ref, arguments) + } } - JsNew(ref, arguments) } } diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/jsAstUtils.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/jsAstUtils.kt index 3499845db49..9fafdfecdd4 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/jsAstUtils.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/jsAstUtils.kt @@ -12,6 +12,7 @@ import org.jetbrains.kotlin.ir.backend.js.utils.* import org.jetbrains.kotlin.ir.declarations.IrFunction import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction import org.jetbrains.kotlin.ir.expressions.* +import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.js.backend.ast.* import org.jetbrains.kotlin.util.OperatorNameConventions @@ -120,7 +121,7 @@ fun translateCall( return JsInvocation(callRef, jsDispatchReceiver?.let { receiver -> listOf(receiver) + arguments } ?: arguments) } - val varargParameterIndex = function.valueParameters.indexOfFirst { it.varargElementType != null } + val varargParameterIndex = function.varargParameterIndex() val isExternalVararg = function.isEffectivelyExternal() && varargParameterIndex != -1 val symbolName = when (jsDispatchReceiver) { @@ -134,28 +135,12 @@ fun translateCall( } return if (isExternalVararg) { - - // External vararg arguments should be represented in JS as multiple "plain" arguments (opposed to arrays in Kotlin) - // We are using `Function.prototype.apply` function to pass all arguments as a single array. - // For this purpose are concatenating non-vararg arguments with vararg. // TODO: Don't use `Function.prototype.apply` when number of arguments is known at compile time (e.g. there are no spread operators) - val arrayConcat = JsNameRef("concat", JsArrayLiteral()) - val arraySliceCall = JsNameRef("call", JsNameRef("slice", JsArrayLiteral())) - val argumentsAsSingleArray = JsInvocation( - arrayConcat, - listOfNotNull(jsExtensionReceiver) + arguments.mapIndexed { index, argument -> - when (index) { - - // Call `Array.prototype.slice` on vararg arguments in order to convert array-like objects into proper arrays - // TODO: Optimize for proper arrays - varargParameterIndex -> JsInvocation(arraySliceCall, argument) - - // TODO: Don't wrap non-array-like arguments with array literal - // TODO: Wrap adjacent non-vararg arguments in a single array literal - else -> JsArrayLiteral(listOf(argument)) - } - } + val argumentsAsSingleArray = argumentsAsSingleArray( + jsExtensionReceiver, + arguments, + varargParameterIndex ) if (jsDispatchReceiver != null) { @@ -198,13 +183,60 @@ fun translateCall( } } +internal fun argumentsAsSingleArray( + additionalReceiver: JsExpression?, + arguments: List, + varargParameterIndex: Int? +): JsExpression { + // External vararg arguments should be represented in JS as multiple "plain" arguments (opposed to arrays in Kotlin) + // We are using `Function.prototype.apply` function to pass all arguments as a single array. + // For this purpose are concatenating non-vararg arguments with vararg. + var varargArgument: JsExpression? = null + val additionalSize = additionalReceiver?.let { 1 } ?: 0 + // size + 1 because arguments size + potential additionalReceiver + val nonVarArgs: MutableList = + ArrayList(arguments.size + additionalSize).apply { + additionalReceiver?.let { add(it) } + } + + arguments + .forEachIndexed { index, argument -> + when (index) { + + // Call `Array.prototype.slice` on vararg arguments in order to convert array-like objects into proper arrays + varargParameterIndex -> { + varargArgument = if (argument is JsArrayLiteral) { + argument + } else { + val arraySliceCall = JsNameRef("call", JsNameRef("slice", JsArrayLiteral())) + JsInvocation(arraySliceCall, argument) + } + } + + else -> nonVarArgs.add(argument) + } + } + + val nonVarArgArrayLiteral = JsArrayLiteral(nonVarArgs) + return varargArgument?.let { + JsInvocation( + JsNameRef("concat", nonVarArgArrayLiteral), + it + ) + } ?: nonVarArgArrayLiteral +} + +fun IrFunction.varargParameterIndex() = valueParameters.indexOfFirst { it.varargElementType != null } + fun translateCallArguments( - expression: IrMemberAccessExpression<*>, + expression: IrMemberAccessExpression, context: JsGenerationContext, transformer: IrElementToJsExpressionTransformer, ): List { val size = expression.valueArgumentsCount + val varargParameterIndex = expression.symbol.owner.realOverrideTarget.varargParameterIndex() + val validWithNullArgs = expression.validWithNullArgs() val arguments = (0 until size) .mapTo(ArrayList(size)) { index -> @@ -216,6 +248,16 @@ fun translateCallArguments( assert(validWithNullArgs) } } + .mapIndexed { index, result -> + val isEmptyExternalVararg = validWithNullArgs && + varargParameterIndex == index && + result is JsArrayLiteral && + result.expressions.isEmpty() + + if (isEmptyExternalVararg) { + null + } else result + } .dropLastWhile { it == null } .map { it ?: JsPrefixOperation(JsUnaryOperator.VOID, JsIntLiteral(1)) } From 995d96e5a37fc6dfa3e504a996b027a8ba060663 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Mon, 23 Nov 2020 15:21:06 +0300 Subject: [PATCH 345/698] [JS IR] Use one concat elements for non vararg and vararg arguments ^KT-42357 fixed --- .../IrElementToJsExpressionTransformer.kt | 2 +- .../js/transformers/irToJs/jsAstUtils.kt | 42 +++++++++++-------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrElementToJsExpressionTransformer.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrElementToJsExpressionTransformer.kt index 40ad1c3ee49..0c3334b390a 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrElementToJsExpressionTransformer.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrElementToJsExpressionTransformer.kt @@ -160,7 +160,7 @@ class IrElementToJsExpressionTransformer : BaseIrElementToJsNodeTransformer, - varargParameterIndex: Int? + varargParameterIndex: Int, ): JsExpression { // External vararg arguments should be represented in JS as multiple "plain" arguments (opposed to arrays in Kotlin) // We are using `Function.prototype.apply` function to pass all arguments as a single array. // For this purpose are concatenating non-vararg arguments with vararg. - var varargArgument: JsExpression? = null - val additionalSize = additionalReceiver?.let { 1 } ?: 0 - // size + 1 because arguments size + potential additionalReceiver - val nonVarArgs: MutableList = - ArrayList(arguments.size + additionalSize).apply { - additionalReceiver?.let { add(it) } - } + var arraysForConcat: MutableList = mutableListOf().apply { + additionalReceiver?.let { add(it) } + } + val concatElements: MutableList = mutableListOf() arguments .forEachIndexed { index, argument -> @@ -205,25 +202,34 @@ internal fun argumentsAsSingleArray( // Call `Array.prototype.slice` on vararg arguments in order to convert array-like objects into proper arrays varargParameterIndex -> { - varargArgument = if (argument is JsArrayLiteral) { + concatElements.add(JsArrayLiteral(arraysForConcat)) + arraysForConcat = mutableListOf() + + val varargArgument = if (argument is JsArrayLiteral) { argument } else { val arraySliceCall = JsNameRef("call", JsNameRef("slice", JsArrayLiteral())) JsInvocation(arraySliceCall, argument) } + + concatElements.add(varargArgument) } - else -> nonVarArgs.add(argument) + else -> { + arraysForConcat.add(argument) + } } } - val nonVarArgArrayLiteral = JsArrayLiteral(nonVarArgs) - return varargArgument?.let { - JsInvocation( - JsNameRef("concat", nonVarArgArrayLiteral), - it + if (arraysForConcat.isNotEmpty() || concatElements.isEmpty()) { + concatElements.add(JsArrayLiteral(arraysForConcat)) + } + + return concatElements.singleOrNull() + ?: JsInvocation( + JsNameRef("concat", concatElements.first()), + concatElements.drop(1) ) - } ?: nonVarArgArrayLiteral } fun IrFunction.varargParameterIndex() = valueParameters.indexOfFirst { it.varargElementType != null } From 4817d5e01d5484175b3b3c683b80771326bd7e2b Mon Sep 17 00:00:00 2001 From: Andrei Klunnyi Date: Mon, 30 Nov 2020 15:44:37 +0000 Subject: [PATCH 346/698] KTIJ-585 [Gradle Runner]: main() cannot be launched from AS 4.1 Android gradle-project model differs from what we have for pure Java and MPP. It's the reason why application classpath cannot be collected correctly. Until universal solution is provided delegation to gradle is put under the registry flag. If disable platform runner is used as before. --- .../idea/gradle/execution/KotlinGradleAppEnvProvider.kt | 6 +++++- idea/resources/META-INF/extensions/ide.xml | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/gradle/execution/KotlinGradleAppEnvProvider.kt b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/gradle/execution/KotlinGradleAppEnvProvider.kt index a4b6cbb3d22..8ab96c3aaa6 100644 --- a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/gradle/execution/KotlinGradleAppEnvProvider.kt +++ b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/gradle/execution/KotlinGradleAppEnvProvider.kt @@ -33,6 +33,7 @@ import com.intellij.openapi.projectRoots.ex.JavaSdkUtil import com.intellij.openapi.roots.ModuleRootManager import com.intellij.openapi.roots.ProjectFileIndex import com.intellij.openapi.util.io.FileUtil +import com.intellij.openapi.util.registry.Registry import com.intellij.openapi.util.text.StringUtil import com.intellij.psi.PsiClass import com.intellij.psi.PsiJavaModule @@ -50,7 +51,10 @@ import org.jetbrains.plugins.gradle.util.GradleConstants */ class KotlinGradleAppEnvProvider : GradleExecutionEnvironmentProvider { - override fun isApplicable(task: ExecuteRunConfigurationTask): Boolean = task.runProfile is KotlinRunConfiguration + override fun isApplicable(task: ExecuteRunConfigurationTask): Boolean { + val enabled = Registry.`is`("kotlin.gradle-run.enabled", false) + return enabled && task.runProfile is KotlinRunConfiguration + } override fun createExecutionEnvironment( project: Project, executeRunConfigurationTask: ExecuteRunConfigurationTask, executor: Executor? diff --git a/idea/resources/META-INF/extensions/ide.xml b/idea/resources/META-INF/extensions/ide.xml index c8bf0deb8fe..ef26c494b9a 100644 --- a/idea/resources/META-INF/extensions/ide.xml +++ b/idea/resources/META-INF/extensions/ide.xml @@ -135,6 +135,11 @@ defaultValue="false" restartRequired="false"/> + + From 50ae360ff93841ae6fe3ffd556255b36d4cd4c21 Mon Sep 17 00:00:00 2001 From: pyos Date: Fri, 27 Nov 2020 14:13:04 +0100 Subject: [PATCH 347/698] FIR2IR: fix the way annotations are moved to fields 1. When an annotation has multiple targets, the priority goes like this: constructor parameter (if applicable) -> property -> backing field. 2. The argument to `kotlin.annotation.Target` is a vararg, so that should be handled as well. 3. `AnnotationTarget.VALUE_PARAMETER` allows receivers, constructor parameters, and setter parameters, while `AnnotationTarget.FIELD` allows both backing fields and delegates. Known issue: java.lang.annotation.Target is not remapped to the Kotlin equivalent, so things are still broken for pure Java annotations. --- .../backend/generators/AnnotationGenerator.kt | 119 +++++++++--------- .../fir/declarations/FirAnnotationUtils.kt | 50 ++++---- .../annotationsOnLateinitFields.kt | 1 - 3 files changed, 81 insertions(+), 89 deletions(-) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/AnnotationGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/AnnotationGenerator.kt index 206b0c3680a..bf21601ff4d 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/AnnotationGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/AnnotationGenerator.kt @@ -7,14 +7,14 @@ package org.jetbrains.kotlin.fir.backend.generators import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget import org.jetbrains.kotlin.fir.FirAnnotationContainer +import org.jetbrains.kotlin.fir.FirFakeSourceElementKind import org.jetbrains.kotlin.fir.backend.Fir2IrComponents import org.jetbrains.kotlin.fir.declarations.FirProperty import org.jetbrains.kotlin.fir.declarations.FirValueParameter -import org.jetbrains.kotlin.fir.declarations.hasMetaAnnotationUseSiteTargets +import org.jetbrains.kotlin.fir.declarations.useSiteTargetsFromMetaAnnotation import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.IrConstructorCall -import org.jetbrains.kotlin.ir.util.isPropertyField import org.jetbrains.kotlin.ir.util.isSetter /** @@ -36,80 +36,73 @@ class AnnotationGenerator(private val components: Fir2IrComponents) : Fir2IrComp irContainer.annotations = firContainer.annotations.toIrAnnotations() } - fun generate(irValueParameter: IrValueParameter, firValueParameter: FirValueParameter, isInConstructor: Boolean) { - irValueParameter.annotations += - firValueParameter.annotations - .filter { - // TODO: for `null` use-site, refer to targets on the meta annotation - it.useSiteTarget == null || !isInConstructor || it.useSiteTarget == AnnotationUseSiteTarget.CONSTRUCTOR_PARAMETER - } - .toIrAnnotations() + private fun FirAnnotationCall.target(applicable: List): AnnotationUseSiteTarget? = + useSiteTarget ?: applicable.firstOrNull(useSiteTargetsFromMetaAnnotation(session)::contains) + + companion object { + // Priority order: constructor parameter (if applicable) -> property -> field. So, for example, if `A` + // can be attached to all three, then in a declaration like + // class C(@A val x: Int) { @A val y = 1 } + // the parameter `x` and the property `y` will have the annotation, while the property `x` and both backing fields will not. + private val propertyTargets = listOf(AnnotationUseSiteTarget.PROPERTY, AnnotationUseSiteTarget.FIELD) + private val constructorPropertyTargets = listOf(AnnotationUseSiteTarget.CONSTRUCTOR_PARAMETER) + propertyTargets + private val delegatedPropertyTargets = propertyTargets + listOf(AnnotationUseSiteTarget.PROPERTY_DELEGATE_FIELD) } - private fun FirAnnotationCall.targetsField(): Boolean = - // Check if the annotation has a field-targeting meta annotation, e.g., @Target(FIELD) - hasMetaAnnotationUseSiteTargets(session, AnnotationUseSiteTarget.FIELD, AnnotationUseSiteTarget.PROPERTY_DELEGATE_FIELD) + // TODO: third argument should be whether this parameter is a property declaration (though this probably makes no difference) + fun generate(irValueParameter: IrValueParameter, firValueParameter: FirValueParameter, isInConstructor: Boolean) { + if (isInConstructor) { + irValueParameter.annotations += firValueParameter.annotations + .filter { it.target(constructorPropertyTargets) == AnnotationUseSiteTarget.CONSTRUCTOR_PARAMETER } + .toIrAnnotations() + } else { + irValueParameter.annotations += firValueParameter.annotations.toIrAnnotations() + } + } fun generate(irProperty: IrProperty, property: FirProperty) { - irProperty.annotations += - property.annotations - .filter { - it.useSiteTarget == AnnotationUseSiteTarget.PROPERTY || - // NB: annotation with null use-site should be landed on the property (ahead of field), - // unless it has FIELD target on the meta annotation, like @Target(FIELD) - (it.useSiteTarget == null && !it.targetsField()) - } - .toIrAnnotations() + val applicableTargets = when { + property.source?.kind == FirFakeSourceElementKind.PropertyFromParameter -> constructorPropertyTargets + irProperty.isDelegated -> delegatedPropertyTargets + else -> propertyTargets + } + irProperty.annotations += property.annotations + .filter { it.target(applicableTargets) == AnnotationUseSiteTarget.PROPERTY } + .toIrAnnotations() } fun generate(irField: IrField, property: FirProperty) { - assert(irField.isPropertyField) { - "$irField is not a property field." + val irProperty = irField.correspondingPropertySymbol?.owner ?: throw AssertionError("$irField is not a property field") + val applicableTargets = when { + property.source?.kind == FirFakeSourceElementKind.PropertyFromParameter -> constructorPropertyTargets + irProperty.isDelegated -> delegatedPropertyTargets + else -> propertyTargets } - irField.annotations += - property.annotations - .filter { - it.useSiteTarget == AnnotationUseSiteTarget.FIELD || - it.useSiteTarget == AnnotationUseSiteTarget.PROPERTY_DELEGATE_FIELD || - (it.useSiteTarget == null && it.targetsField()) - } - .toIrAnnotations() + irField.annotations += property.annotations.filter { + val target = it.target(applicableTargets) + target == AnnotationUseSiteTarget.FIELD || target == AnnotationUseSiteTarget.PROPERTY_DELEGATE_FIELD + }.toIrAnnotations() } fun generate(propertyAccessor: IrFunction, property: FirProperty) { - assert(propertyAccessor.isPropertyAccessor) { - "$propertyAccessor is not a property accessor." - } + assert(propertyAccessor.isPropertyAccessor) { "$propertyAccessor is not a property accessor." } if (propertyAccessor.isSetter) { - propertyAccessor.annotations += - property.annotations - .filter { - it.useSiteTarget == AnnotationUseSiteTarget.PROPERTY_SETTER - } - .toIrAnnotations() - propertyAccessor.valueParameters.singleOrNull()?.annotations = - propertyAccessor.valueParameters.singleOrNull()?.annotations?.plus( - property.annotations - .filter { - it.useSiteTarget == AnnotationUseSiteTarget.SETTER_PARAMETER - } - .toIrAnnotations() - )!! + propertyAccessor.annotations += property.annotations + .filter { it.useSiteTarget == AnnotationUseSiteTarget.PROPERTY_SETTER } + .toIrAnnotations() + val parameter = propertyAccessor.valueParameters.single() + parameter.annotations += property.annotations + .filter { it.useSiteTarget == AnnotationUseSiteTarget.SETTER_PARAMETER } + .toIrAnnotations() } else { - propertyAccessor.annotations += - property.annotations - .filter { - it.useSiteTarget == AnnotationUseSiteTarget.PROPERTY_GETTER - } - .toIrAnnotations() + propertyAccessor.annotations += property.annotations + .filter { it.useSiteTarget == AnnotationUseSiteTarget.PROPERTY_GETTER } + .toIrAnnotations() + } + propertyAccessor.extensionReceiverParameter?.let { receiver -> + receiver.annotations += property.annotations + .filter { it.useSiteTarget == AnnotationUseSiteTarget.RECEIVER } + .toIrAnnotations() } - propertyAccessor.extensionReceiverParameter?.annotations = - propertyAccessor.extensionReceiverParameter?.annotations?.plus( - property.annotations - .filter { - it.useSiteTarget == AnnotationUseSiteTarget.RECEIVER - } - .toIrAnnotations() - )!! } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/declarations/FirAnnotationUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/declarations/FirAnnotationUtils.kt index 4a9303f3d65..2701eedf413 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/declarations/FirAnnotationUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/declarations/FirAnnotationUtils.kt @@ -54,36 +54,36 @@ inline val FirProperty.hasJvmFieldAnnotation: Boolean val FirAnnotationCall.isJvmFieldAnnotation: Boolean get() = toAnnotationClassId() == JVM_FIELD_CLASS_ID -private fun FirAnnotationCall.useSiteTargetsFromMetaAnnotation(session: FirSession): List { - val metaAnnotationAboutTarget = - toAnnotationClass(session)?.annotations?.find { it.toAnnotationClassId() == TARGET_CLASS_ID } - ?: return emptyList() - return metaAnnotationAboutTarget.argumentList.arguments.toAnnotationUseSiteTargets() -} +fun FirAnnotationCall.useSiteTargetsFromMetaAnnotation(session: FirSession): Set = + toAnnotationClass(session)?.annotations?.find { it.toAnnotationClassId() == TARGET_CLASS_ID }?.argumentList?.arguments + ?.toAnnotationUseSiteTargets() ?: DEFAULT_USE_SITE_TARGETS -private fun List.toAnnotationUseSiteTargets(): List = - flatMap { arg -> - val unwrappedArg = if (arg is FirNamedArgumentExpression) arg.expression else arg - if (unwrappedArg is FirArrayOfCall) { - unwrappedArg.argumentList.arguments.toAnnotationUseSiteTargets() - } else { - unwrappedArg.toAnnotationUseSiteTarget()?.let { listOf(it) } ?: emptyList() +private fun List.toAnnotationUseSiteTargets(): Set = + flatMapTo(mutableSetOf()) { arg -> + when (val unwrappedArg = if (arg is FirNamedArgumentExpression) arg.expression else arg) { + is FirArrayOfCall -> unwrappedArg.argumentList.arguments.toAnnotationUseSiteTargets() + is FirVarargArgumentsExpression -> unwrappedArg.arguments.toAnnotationUseSiteTargets() + else -> USE_SITE_TARGET_NAME_MAP[unwrappedArg.callableNameOfMetaAnnotationArgument?.identifier] ?: setOf() } } -private val USE_SITE_TARGET_NAME_MAP = - AnnotationUseSiteTarget.values().map { it.name to it }.toMap() +// See [org.jetbrains.kotlin.descriptors.annotations.KotlinTarget.USE_SITE_MAPPING] (it's in reverse) +private val USE_SITE_TARGET_NAME_MAP = mapOf( + "FIELD" to setOf(AnnotationUseSiteTarget.FIELD, AnnotationUseSiteTarget.PROPERTY_DELEGATE_FIELD), + "FILE" to setOf(AnnotationUseSiteTarget.FILE), + "PROPERTY" to setOf(AnnotationUseSiteTarget.PROPERTY), + "PROPERTY_GETTER" to setOf(AnnotationUseSiteTarget.PROPERTY_GETTER), + "PROPERTY_SETTER" to setOf(AnnotationUseSiteTarget.PROPERTY_SETTER), + "VALUE_PARAMETER" to setOf( + AnnotationUseSiteTarget.CONSTRUCTOR_PARAMETER, + AnnotationUseSiteTarget.RECEIVER, + AnnotationUseSiteTarget.SETTER_PARAMETER, + ), +) -private fun FirExpression.toAnnotationUseSiteTarget(): AnnotationUseSiteTarget? = - // TODO: depending on the context, "PARAMETER" can be mapped to either CONSTRUCTOR_PARAMETER or SETTER_PARAMETER ? - callableNameOfMetaAnnotationArgument?.identifier?.let { - USE_SITE_TARGET_NAME_MAP[it] - } - -fun FirAnnotationCall.hasMetaAnnotationUseSiteTargets(session: FirSession, vararg useSiteTargets: AnnotationUseSiteTarget): Boolean { - val meta = useSiteTargetsFromMetaAnnotation(session) - return useSiteTargets.any { meta.contains(it) } -} +// See [org.jetbrains.kotlin.descriptors.annotations.KotlinTarget] (the second argument of each entry) +private val DEFAULT_USE_SITE_TARGETS: Set = + USE_SITE_TARGET_NAME_MAP.values.fold(setOf()) { a, b -> a + b } - setOf(AnnotationUseSiteTarget.FILE) fun FirAnnotatedDeclaration.hasAnnotation(classId: ClassId): Boolean { return annotations.any { it.toAnnotationClassId() == classId } diff --git a/compiler/testData/codegen/box/annotations/annotationsOnLateinitFields.kt b/compiler/testData/codegen/box/annotations/annotationsOnLateinitFields.kt index 4beb41d12d2..8878e9d07ee 100644 --- a/compiler/testData/codegen/box/annotations/annotationsOnLateinitFields.kt +++ b/compiler/testData/codegen/box/annotations/annotationsOnLateinitFields.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // WITH_REFLECT // TARGET_BACKEND: JVM From 606de2664617e94e4645e59e8d0f5f09bb4dd446 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Mon, 30 Nov 2020 15:00:11 +0100 Subject: [PATCH 348/698] JVM IR: fix generation of equals/hashCode for fun interfaces over references ... in case `-Xno-optimized-callable-references` is enabled. Before this change, the generated abstract equals/hashCode methods were considered as accidental overrides because they did not have equals/hashCode from the supertype in the overriddenSymbols list. #KT-43666 Fixed --- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 +++++ .../backend/jvm/lower/FunctionReferenceLowering.kt | 14 ++++++++++++-- .../funInterface/noOptimizedCallableReferences.kt | 11 +++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 5 +++++ .../codegen/LightAnalysisModeTestGenerated.java | 5 +++++ .../codegen/ir/IrBlackBoxCodegenTestGenerated.java | 5 +++++ .../semantics/IrJsCodegenBoxES6TestGenerated.java | 5 +++++ .../ir/semantics/IrJsCodegenBoxTestGenerated.java | 5 +++++ .../test/semantics/JsCodegenBoxTestGenerated.java | 5 +++++ .../semantics/IrCodegenBoxWasmTestGenerated.java | 5 +++++ 10 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 compiler/testData/codegen/box/funInterface/noOptimizedCallableReferences.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index a3ad4829eab..e8e784a834f 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -12194,6 +12194,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/funInterface/multimodule.kt"); } + @TestMetadata("noOptimizedCallableReferences.kt") + public void testNoOptimizedCallableReferences() throws Exception { + runTest("compiler/testData/codegen/box/funInterface/noOptimizedCallableReferences.kt"); + } + @TestMetadata("nonAbstractMethod.kt") public void testNonAbstractMethod() throws Exception { runTest("compiler/testData/codegen/box/funInterface/nonAbstractMethod.kt"); diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionReferenceLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionReferenceLowering.kt index 63a4d1bf247..9ca3ff6074c 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionReferenceLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionReferenceLowering.kt @@ -245,7 +245,7 @@ internal class FunctionReferenceLowering(private val context: JvmBackendContext) if (!useOptimizedSuperClass) { // This is the case of a fun interface wrapper over a (maybe adapted) function reference, - // with `-Xno-optimized-callable-referenced` enabled. We can't use constructors of FunctionReferenceImpl, + // with `-Xno-optimized-callable-references` enabled. We can't use constructors of FunctionReferenceImpl, // so we'd need to basically generate a full class for a reference inheriting from FunctionReference, // effectively disabling the optimization of fun interface wrappers over references. // This scenario is probably not very popular because it involves using equals/hashCode on function references @@ -254,8 +254,11 @@ internal class FunctionReferenceLowering(private val context: JvmBackendContext) // TODO: generate getFunctionDelegate, equals and hashCode properly in this case functionReferenceClass.addFunction("equals", backendContext.irBuiltIns.booleanType, Modality.ABSTRACT).apply { addValueParameter("other", backendContext.irBuiltIns.anyNType) + overriddenSymbols = listOf(functionSuperClass.functions.single { isEqualsFromAny(it.owner) }) + } + functionReferenceClass.addFunction("hashCode", backendContext.irBuiltIns.intType, Modality.ABSTRACT).apply { + overriddenSymbols = listOf(functionSuperClass.functions.single { isHashCodeFromAny(it.owner) }) } - functionReferenceClass.addFunction("hashCode", backendContext.irBuiltIns.intType, Modality.ABSTRACT) return } @@ -274,6 +277,13 @@ internal class FunctionReferenceLowering(private val context: JvmBackendContext) }.generate() } + private fun isEqualsFromAny(f: IrSimpleFunction): Boolean = + f.name.asString() == "equals" && f.extensionReceiverParameter == null && + f.valueParameters.singleOrNull()?.type?.isNullableAny() == true + + private fun isHashCodeFromAny(f: IrSimpleFunction): Boolean = + f.name.asString() == "hashCode" && f.extensionReceiverParameter == null && f.valueParameters.isEmpty() + private fun createConstructor(): IrConstructor = functionReferenceClass.addConstructor { origin = JvmLoweredDeclarationOrigin.GENERATED_MEMBER_IN_CALLABLE_REFERENCE diff --git a/compiler/testData/codegen/box/funInterface/noOptimizedCallableReferences.kt b/compiler/testData/codegen/box/funInterface/noOptimizedCallableReferences.kt new file mode 100644 index 00000000000..e68d85f0124 --- /dev/null +++ b/compiler/testData/codegen/box/funInterface/noOptimizedCallableReferences.kt @@ -0,0 +1,11 @@ +// KOTLIN_CONFIGURATION_FLAGS: +JVM.NO_OPTIMIZED_CALLABLE_REFERENCES + +fun interface P { + fun get(): String +} + +class G(val p: P) + +fun f(): String = "OK" + +fun box(): String = G(::f).p.get() diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index b8f21d40e9c..badd8b6490c 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -13594,6 +13594,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/funInterface/multimodule.kt"); } + @TestMetadata("noOptimizedCallableReferences.kt") + public void testNoOptimizedCallableReferences() throws Exception { + runTest("compiler/testData/codegen/box/funInterface/noOptimizedCallableReferences.kt"); + } + @TestMetadata("nonAbstractMethod.kt") public void testNonAbstractMethod() throws Exception { runTest("compiler/testData/codegen/box/funInterface/nonAbstractMethod.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 9a01f7b60b2..1dd9aaaecad 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -13594,6 +13594,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/funInterface/multimodule.kt"); } + @TestMetadata("noOptimizedCallableReferences.kt") + public void testNoOptimizedCallableReferences() throws Exception { + runTest("compiler/testData/codegen/box/funInterface/noOptimizedCallableReferences.kt"); + } + @TestMetadata("nonAbstractMethod.kt") public void testNonAbstractMethod() throws Exception { runTest("compiler/testData/codegen/box/funInterface/nonAbstractMethod.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index b131d788a67..a0604634d0d 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -12194,6 +12194,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/funInterface/multimodule.kt"); } + @TestMetadata("noOptimizedCallableReferences.kt") + public void testNoOptimizedCallableReferences() throws Exception { + runTest("compiler/testData/codegen/box/funInterface/noOptimizedCallableReferences.kt"); + } + @TestMetadata("nonAbstractMethod.kt") public void testNonAbstractMethod() throws Exception { runTest("compiler/testData/codegen/box/funInterface/nonAbstractMethod.kt"); diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index 07e72051ebe..e506471fd8d 100644 --- a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -10434,6 +10434,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/funInterface/multimodule.kt"); } + @TestMetadata("noOptimizedCallableReferences.kt") + public void testNoOptimizedCallableReferences() throws Exception { + runTest("compiler/testData/codegen/box/funInterface/noOptimizedCallableReferences.kt"); + } + @TestMetadata("nonAbstractMethod.kt") public void testNonAbstractMethod() throws Exception { runTest("compiler/testData/codegen/box/funInterface/nonAbstractMethod.kt"); diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 96c6229aec8..769144f048c 100644 --- a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -10434,6 +10434,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/funInterface/multimodule.kt"); } + @TestMetadata("noOptimizedCallableReferences.kt") + public void testNoOptimizedCallableReferences() throws Exception { + runTest("compiler/testData/codegen/box/funInterface/noOptimizedCallableReferences.kt"); + } + @TestMetadata("nonAbstractMethod.kt") public void testNonAbstractMethod() throws Exception { runTest("compiler/testData/codegen/box/funInterface/nonAbstractMethod.kt"); diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 77ac1fe9313..1d5724cd6ad 100644 --- a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -10434,6 +10434,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/funInterface/multimodule.kt"); } + @TestMetadata("noOptimizedCallableReferences.kt") + public void testNoOptimizedCallableReferences() throws Exception { + runTest("compiler/testData/codegen/box/funInterface/noOptimizedCallableReferences.kt"); + } + @TestMetadata("nonAbstractMethod.kt") public void testNonAbstractMethod() throws Exception { runTest("compiler/testData/codegen/box/funInterface/nonAbstractMethod.kt"); diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index 86efc618ee6..c4bbcb442e3 100644 --- a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -5214,6 +5214,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/funInterface/funConversionInVararg.kt"); } + @TestMetadata("noOptimizedCallableReferences.kt") + public void testNoOptimizedCallableReferences() throws Exception { + runTest("compiler/testData/codegen/box/funInterface/noOptimizedCallableReferences.kt"); + } + @TestMetadata("partialSam.kt") public void testPartialSam() throws Exception { runTest("compiler/testData/codegen/box/funInterface/partialSam.kt"); From 19ca9c0fdeb1353313e5c0fcc157b1d5867d7a87 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Wed, 23 Sep 2020 20:45:15 +0200 Subject: [PATCH 349/698] Enable JVM IR for bootstrap in the project --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 60aa6b515ad..ae2c02db3ae 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ kotlin.compiler.effectSystemEnabled=true kotlin.compiler.newInferenceEnabled=true # Enable JVM IR backend for all modules except libraries such as kotlin-stdlib, kotlin-reflect, kotlin-test. -#kotlin.build.useIR=true +kotlin.build.useIR=true # Enable JVM IR backend for the libraries mentioned above. #kotlin.build.useIRForLibraries=true From 94a5379631be793d88b35de05b9de737bd264c3d Mon Sep 17 00:00:00 2001 From: Roman Golyshev Date: Fri, 27 Nov 2020 18:08:40 +0300 Subject: [PATCH 350/698] FIR IDE: Add tests for resolving from nested types references Some of those tests are failing in the FIR IDE --- .../FirReferenceResolveTestGenerated.java | 68 +++++++++++++++++++ .../ResolveCompanionInCompanionType.kt | 11 +++ .../nestedTypes/ResolveEndOfPackageInType.kt | 11 +++ .../ResolveMiddleOfPackageInType.kt | 11 +++ .../ResolveStartOfPackageInType.kt | 11 +++ .../nestedTypes/ResolveTypeInTheEndOfType.kt | 11 +++ .../ResolveTypeInTheMiddleOfCompanionType.kt | 11 +++ .../ResolveTypeInTheMiddleOfFunctionalType.kt | 11 +++ .../ResolveTypeInTheMiddleOfNullableType.kt | 11 +++ .../ResolveTypeInTheMiddleOfType.kt | 11 +++ .../ResolveTypeInTheStartOfCompanionType.kt | 11 +++ .../ResolveTypeInTheStartOfType.kt | 11 +++ .../ReferenceResolveTestGenerated.java | 68 +++++++++++++++++++ 13 files changed, 257 insertions(+) create mode 100644 idea/testData/resolve/references/nestedTypes/ResolveCompanionInCompanionType.kt create mode 100644 idea/testData/resolve/references/nestedTypes/ResolveEndOfPackageInType.kt create mode 100644 idea/testData/resolve/references/nestedTypes/ResolveMiddleOfPackageInType.kt create mode 100644 idea/testData/resolve/references/nestedTypes/ResolveStartOfPackageInType.kt create mode 100644 idea/testData/resolve/references/nestedTypes/ResolveTypeInTheEndOfType.kt create mode 100644 idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfCompanionType.kt create mode 100644 idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfFunctionalType.kt create mode 100644 idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfNullableType.kt create mode 100644 idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfType.kt create mode 100644 idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfCompanionType.kt create mode 100644 idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfType.kt diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/resolve/FirReferenceResolveTestGenerated.java b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/resolve/FirReferenceResolveTestGenerated.java index c7b1ae98e91..581090d26c6 100644 --- a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/resolve/FirReferenceResolveTestGenerated.java +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/resolve/FirReferenceResolveTestGenerated.java @@ -707,4 +707,72 @@ public class FirReferenceResolveTestGenerated extends AbstractFirReferenceResolv runTest("idea/testData/resolve/references/invoke/oneParamRPar.kt"); } } + + @TestMetadata("idea/testData/resolve/references/nestedTypes") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class NestedTypes extends AbstractFirReferenceResolveTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInNestedTypes() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/resolve/references/nestedTypes"), Pattern.compile("^([^.]+)\\.kt$"), null, true); + } + + @TestMetadata("ResolveCompanionInCompanionType.kt") + public void testResolveCompanionInCompanionType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveCompanionInCompanionType.kt"); + } + + @TestMetadata("ResolveEndOfPackageInType.kt") + public void testResolveEndOfPackageInType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveEndOfPackageInType.kt"); + } + + @TestMetadata("ResolveMiddleOfPackageInType.kt") + public void testResolveMiddleOfPackageInType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveMiddleOfPackageInType.kt"); + } + + @TestMetadata("ResolveStartOfPackageInType.kt") + public void testResolveStartOfPackageInType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveStartOfPackageInType.kt"); + } + + @TestMetadata("ResolveTypeInTheEndOfType.kt") + public void testResolveTypeInTheEndOfType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheEndOfType.kt"); + } + + @TestMetadata("ResolveTypeInTheMiddleOfCompanionType.kt") + public void testResolveTypeInTheMiddleOfCompanionType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfCompanionType.kt"); + } + + @TestMetadata("ResolveTypeInTheMiddleOfFunctionalType.kt") + public void testResolveTypeInTheMiddleOfFunctionalType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfFunctionalType.kt"); + } + + @TestMetadata("ResolveTypeInTheMiddleOfNullableType.kt") + public void testResolveTypeInTheMiddleOfNullableType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfNullableType.kt"); + } + + @TestMetadata("ResolveTypeInTheMiddleOfType.kt") + public void testResolveTypeInTheMiddleOfType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfType.kt"); + } + + @TestMetadata("ResolveTypeInTheStartOfCompanionType.kt") + public void testResolveTypeInTheStartOfCompanionType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfCompanionType.kt"); + } + + @TestMetadata("ResolveTypeInTheStartOfType.kt") + public void testResolveTypeInTheStartOfType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfType.kt"); + } + } } diff --git a/idea/testData/resolve/references/nestedTypes/ResolveCompanionInCompanionType.kt b/idea/testData/resolve/references/nestedTypes/ResolveCompanionInCompanionType.kt new file mode 100644 index 00000000000..1ecc8f1bb2c --- /dev/null +++ b/idea/testData/resolve/references/nestedTypes/ResolveCompanionInCompanionType.kt @@ -0,0 +1,11 @@ +package foo.bar.baz + +class AA { + class BB { + companion object + } +} + +fun test(param: foo.bar.baz.AA.BB.Companion) {} + +// REF: companion object of (in foo.bar.baz.AA).BB diff --git a/idea/testData/resolve/references/nestedTypes/ResolveEndOfPackageInType.kt b/idea/testData/resolve/references/nestedTypes/ResolveEndOfPackageInType.kt new file mode 100644 index 00000000000..25e22c34f2e --- /dev/null +++ b/idea/testData/resolve/references/nestedTypes/ResolveEndOfPackageInType.kt @@ -0,0 +1,11 @@ +package foo.bar.baz + +class AA { + class BB { + class CC + } +} + +fun test(param: foo.bar.baz.AA.BB.CC) {} + +// REF: baz diff --git a/idea/testData/resolve/references/nestedTypes/ResolveMiddleOfPackageInType.kt b/idea/testData/resolve/references/nestedTypes/ResolveMiddleOfPackageInType.kt new file mode 100644 index 00000000000..9edddf26708 --- /dev/null +++ b/idea/testData/resolve/references/nestedTypes/ResolveMiddleOfPackageInType.kt @@ -0,0 +1,11 @@ +package foo.bar.baz + +class AA { + class BB { + class CC + } +} + +fun test(param: foo.bar.baz.AA.BB.CC) {} + +// REF: bar diff --git a/idea/testData/resolve/references/nestedTypes/ResolveStartOfPackageInType.kt b/idea/testData/resolve/references/nestedTypes/ResolveStartOfPackageInType.kt new file mode 100644 index 00000000000..ae9e8f72537 --- /dev/null +++ b/idea/testData/resolve/references/nestedTypes/ResolveStartOfPackageInType.kt @@ -0,0 +1,11 @@ +package foo.bar.baz + +class AA { + class BB { + class CC + } +} + +fun test(param: foo.bar.baz.AA.BB.CC) {} + +// REF: foo diff --git a/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheEndOfType.kt b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheEndOfType.kt new file mode 100644 index 00000000000..bea01a7ff4f --- /dev/null +++ b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheEndOfType.kt @@ -0,0 +1,11 @@ +package foo.bar.baz + +class AA { + class BB { + class CC + } +} + +fun test(param: foo.bar.baz.AA.BB.CC) {} + +// REF: (in foo.bar.baz.AA.BB).CC diff --git a/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfCompanionType.kt b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfCompanionType.kt new file mode 100644 index 00000000000..949027b0929 --- /dev/null +++ b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfCompanionType.kt @@ -0,0 +1,11 @@ +package foo.bar.baz + +class AA { + class BB { + companion object + } +} + +fun test(param: foo.bar.baz.AA.BB.Companion) {} + +// REF: (in foo.bar.baz.AA).BB diff --git a/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfFunctionalType.kt b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfFunctionalType.kt new file mode 100644 index 00000000000..51370d92efb --- /dev/null +++ b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfFunctionalType.kt @@ -0,0 +1,11 @@ +package foo.bar.baz + +class AA { + class BB { + class CC + } +} + +fun test(param: () -> foo.bar.baz.AA.BB.CC) {} + +// REF: (in foo.bar.baz.AA).BB diff --git a/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfNullableType.kt b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfNullableType.kt new file mode 100644 index 00000000000..e57ab0d914e --- /dev/null +++ b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfNullableType.kt @@ -0,0 +1,11 @@ +package foo.bar.baz + +class AA { + class BB { + class CC + } +} + +fun test(param: foo.bar.baz.AA.BB.CC?) {} + +// REF: (in foo.bar.baz.AA).BB diff --git a/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfType.kt b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfType.kt new file mode 100644 index 00000000000..7ca35182527 --- /dev/null +++ b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfType.kt @@ -0,0 +1,11 @@ +package foo.bar.baz + +class AA { + class BB { + class CC + } +} + +fun test(param: foo.bar.baz.AA.BB.CC) {} + +// REF: (in foo.bar.baz.AA).BB diff --git a/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfCompanionType.kt b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfCompanionType.kt new file mode 100644 index 00000000000..3880d38de40 --- /dev/null +++ b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfCompanionType.kt @@ -0,0 +1,11 @@ +package foo.bar.baz + +class AA { + class BB { + companion object + } +} + +fun test(param: foo.bar.baz.AA.BB.Companion) {} + +// REF: (foo.bar.baz).AA diff --git a/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfType.kt b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfType.kt new file mode 100644 index 00000000000..893a7422c6f --- /dev/null +++ b/idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfType.kt @@ -0,0 +1,11 @@ +package foo.bar.baz + +class AA { + class BB { + class CC + } +} + +fun test(param: foo.bar.baz.AA.BB.CC) {} + +// REF: (foo.bar.baz).AA diff --git a/idea/tests/org/jetbrains/kotlin/idea/resolve/ReferenceResolveTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/resolve/ReferenceResolveTestGenerated.java index d927be17c0d..a9ca663b714 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/resolve/ReferenceResolveTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/resolve/ReferenceResolveTestGenerated.java @@ -707,4 +707,72 @@ public class ReferenceResolveTestGenerated extends AbstractReferenceResolveTest runTest("idea/testData/resolve/references/invoke/oneParamRPar.kt"); } } + + @TestMetadata("idea/testData/resolve/references/nestedTypes") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class NestedTypes extends AbstractReferenceResolveTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInNestedTypes() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/resolve/references/nestedTypes"), Pattern.compile("^([^.]+)\\.kt$"), null, true); + } + + @TestMetadata("ResolveCompanionInCompanionType.kt") + public void testResolveCompanionInCompanionType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveCompanionInCompanionType.kt"); + } + + @TestMetadata("ResolveEndOfPackageInType.kt") + public void testResolveEndOfPackageInType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveEndOfPackageInType.kt"); + } + + @TestMetadata("ResolveMiddleOfPackageInType.kt") + public void testResolveMiddleOfPackageInType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveMiddleOfPackageInType.kt"); + } + + @TestMetadata("ResolveStartOfPackageInType.kt") + public void testResolveStartOfPackageInType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveStartOfPackageInType.kt"); + } + + @TestMetadata("ResolveTypeInTheEndOfType.kt") + public void testResolveTypeInTheEndOfType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheEndOfType.kt"); + } + + @TestMetadata("ResolveTypeInTheMiddleOfCompanionType.kt") + public void testResolveTypeInTheMiddleOfCompanionType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfCompanionType.kt"); + } + + @TestMetadata("ResolveTypeInTheMiddleOfFunctionalType.kt") + public void testResolveTypeInTheMiddleOfFunctionalType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfFunctionalType.kt"); + } + + @TestMetadata("ResolveTypeInTheMiddleOfNullableType.kt") + public void testResolveTypeInTheMiddleOfNullableType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfNullableType.kt"); + } + + @TestMetadata("ResolveTypeInTheMiddleOfType.kt") + public void testResolveTypeInTheMiddleOfType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheMiddleOfType.kt"); + } + + @TestMetadata("ResolveTypeInTheStartOfCompanionType.kt") + public void testResolveTypeInTheStartOfCompanionType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfCompanionType.kt"); + } + + @TestMetadata("ResolveTypeInTheStartOfType.kt") + public void testResolveTypeInTheStartOfType() throws Exception { + runTest("idea/testData/resolve/references/nestedTypes/ResolveTypeInTheStartOfType.kt"); + } + } } From f50480d25884dabb62b6480a40b7646676b00f91 Mon Sep 17 00:00:00 2001 From: Roman Golyshev Date: Fri, 27 Nov 2020 18:09:49 +0300 Subject: [PATCH 351/698] FIR IDE: Fix resolving of nested types in type references --- .../references/FirReferenceResolveHelper.kt | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/FirReferenceResolveHelper.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/FirReferenceResolveHelper.kt index c59c8027f6e..0164b12d778 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/FirReferenceResolveHelper.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/FirReferenceResolveHelper.kt @@ -9,6 +9,7 @@ import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticProperty import org.jetbrains.kotlin.fir.expressions.* +import org.jetbrains.kotlin.fir.psi import org.jetbrains.kotlin.fir.references.* import org.jetbrains.kotlin.fir.resolve.calls.SyntheticPropertySymbol import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeAmbiguityError @@ -20,6 +21,7 @@ import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol import org.jetbrains.kotlin.fir.symbols.impl.ConeClassLikeLookupTagImpl import org.jetbrains.kotlin.fir.types.ConeLookupTagBasedType import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef +import org.jetbrains.kotlin.fir.types.classId import org.jetbrains.kotlin.idea.fir.* import org.jetbrains.kotlin.idea.fir.low.level.api.api.getOrBuildFir import org.jetbrains.kotlin.idea.frontend.api.fir.KtFirAnalysisSession @@ -141,7 +143,10 @@ internal object FirReferenceResolveHelper { when (fir) { is FirResolvedTypeRef -> { if (expression.isPartOfUserTypeRefQualifier()) { - return listOfNotNull(getPackageSymbolFor(expression, symbolBuilder, forQualifiedType = true)) + val typeQualifier = findPossibleTypeQualifier(expression, fir)?.toTargetPsi(session, symbolBuilder) + val typeOrPackageQualifier = typeQualifier ?: getPackageSymbolFor(expression, symbolBuilder, forQualifiedType = true) + + return listOfNotNull(typeOrPackageQualifier) } return listOfNotNull(fir.toTargetSymbol(session, symbolBuilder)) } @@ -274,4 +279,35 @@ internal object FirReferenceResolveHelper { } } } + + private fun findPossibleTypeQualifier(qualifier: KtSimpleNameExpression, wholeTypeFir: FirResolvedTypeRef): ClassId? { + val qualifierToResolve = qualifier.parent as KtUserType + // FIXME make it work with generics in functional types (like () -> AA.BB) + val wholeType = (wholeTypeFir.psi as KtTypeReference).typeElement?.unwrapNullable() as? KtUserType ?: return null + + val qualifiersToDrop = countQualifiersToDrop(wholeType, qualifierToResolve) + return wholeTypeFir.type.classId?.dropLastNestedClasses(qualifiersToDrop) + } + + /** + * @return class id without [classesToDrop] last nested classes, or `null` if [classesToDrop] is too big. + * + * Example: `foo.bar.Baz.Inner` with 1 dropped class is `foo.bar.Baz`, and with 2 dropped class is `null`. + */ + private fun ClassId.dropLastNestedClasses(classesToDrop: Int) = generateSequence(this) { it.outerClassId }.drop(classesToDrop).firstOrNull() + + /** + * @return How many qualifiers needs to be dropped from [wholeType] to get [nestedType]. + * + * Example: to get `foo.bar` from `foo.bar.Baz.Inner`, you need to drop 2 qualifiers (`Inner` and `Baz`). + */ + private fun countQualifiersToDrop(wholeType: KtUserType, nestedType: KtUserType): Int { + val qualifierIndex = generateSequence(wholeType) { it.qualifier }.indexOf(nestedType) + require(qualifierIndex != -1) { "Whole type $wholeType should contain $nestedType, but it didn't" } + return qualifierIndex + } + + private tailrec fun KtTypeElement.unwrapNullable(): KtTypeElement? { + return if (this is KtNullableType) innerType?.unwrapNullable() else this + } } From 4607eca987cb5993ee1a561b16a553100de00017 Mon Sep 17 00:00:00 2001 From: Georgy Bronnikov Date: Mon, 30 Nov 2020 18:53:31 +0300 Subject: [PATCH 352/698] JVM_IR: bug fix in classFileContainsMethod The old test sequence failed for toplevel functions because of file class wrappers, so that the second branch was never invoked. --- .../jetbrains/kotlin/codegen/inline/InlineCodegen.kt | 3 ++- .../codegen/ir/FirBlackBoxCodegenTestGenerated.java | 5 +++++ .../kotlin/backend/jvm/codegen/irCodegenUtils.kt | 2 +- .../codegen/box/inlineClasses/multifileClass.kt | 10 ++++++++++ .../kotlin/codegen/BlackBoxCodegenTestGenerated.java | 5 +++++ .../kotlin/codegen/LightAnalysisModeTestGenerated.java | 5 +++++ .../codegen/ir/IrBlackBoxCodegenTestGenerated.java | 5 +++++ .../es6/semantics/IrJsCodegenBoxES6TestGenerated.java | 5 +++++ .../test/ir/semantics/IrJsCodegenBoxTestGenerated.java | 5 +++++ .../js/test/semantics/JsCodegenBoxTestGenerated.java | 5 +++++ .../wasm/semantics/IrCodegenBoxWasmTestGenerated.java | 5 +++++ 11 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 compiler/testData/codegen/box/inlineClasses/multifileClass.kt diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InlineCodegen.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InlineCodegen.kt index efe2f0675d5..385a868fb98 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InlineCodegen.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InlineCodegen.kt @@ -577,7 +577,8 @@ abstract class InlineCodegen( doCreateMethodNodeFromCompiled(directMember, state, jvmSignature.asmMethod) else null - result ?: throw IllegalStateException("Couldn't obtain compiled function body for $functionDescriptor") + result ?: + throw IllegalStateException("Couldn't obtain compiled function body for $functionDescriptor") } return SMAPAndMethodNode(cloneMethodNode(resultInCache.node), resultInCache.classSMAP) diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index e8e784a834f..2ded3076b89 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -14137,6 +14137,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/inlineClasses/mappingOfBoxedFlexibleInlineClassType.kt"); } + @TestMetadata("multifileClass.kt") + public void testMultifileClass() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/multifileClass.kt"); + } + @TestMetadata("noAssertionsOnInlineClassBasedOnNullableType.kt") public void testNoAssertionsOnInlineClassBasedOnNullableType() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/noAssertionsOnInlineClassBasedOnNullableType.kt"); diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt index bda2089bc5c..6789e9a5fae 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt @@ -379,7 +379,7 @@ fun IrSimpleType.isRawType(): Boolean = hasAnnotation(JvmGeneratorExtensions.RAW_TYPE_ANNOTATION_FQ_NAME) internal fun classFileContainsMethod(function: IrFunction, context: JvmBackendContext, name: String): Boolean? { - val classId = (function.parent as? IrClass)?.classId ?: (function.containerSource as? JvmPackagePartSource)?.classId ?: return null + val classId = (function.containerSource as? JvmPackagePartSource)?.classId ?: (function.parent as? IrClass)?.classId ?: return null val originalDescriptor = context.methodSignatureMapper.mapSignatureWithGeneric(function).asmMethod.descriptor val descriptor = if (function.isSuspend) listOf(*Type.getArgumentTypes(originalDescriptor), Type.getObjectType("kotlin/coroutines/Continuation")) diff --git a/compiler/testData/codegen/box/inlineClasses/multifileClass.kt b/compiler/testData/codegen/box/inlineClasses/multifileClass.kt new file mode 100644 index 00000000000..64cbe4f1492 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/multifileClass.kt @@ -0,0 +1,10 @@ +// WITH_RUNTIME +// IGNORE_BACKEND: JVM + +fun box(): String { + val uia = uintArrayOf() + val uia2 = uintArrayOf() + // UIntArray is a multifile class, so we need to know where to search for extension method copyInto. + uia.copyInto(uia2) + return "OK" +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index badd8b6490c..f4f9bcc5faf 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -15537,6 +15537,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/inlineClasses/mappingOfBoxedFlexibleInlineClassType.kt"); } + @TestMetadata("multifileClass.kt") + public void testMultifileClass() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/multifileClass.kt"); + } + @TestMetadata("noAssertionsOnInlineClassBasedOnNullableType.kt") public void testNoAssertionsOnInlineClassBasedOnNullableType() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/noAssertionsOnInlineClassBasedOnNullableType.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 1dd9aaaecad..08def0da59b 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -15547,6 +15547,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/inlineClasses/mappingOfBoxedFlexibleInlineClassType.kt"); } + @TestMetadata("multifileClass.kt") + public void testMultifileClass() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/multifileClass.kt"); + } + @TestMetadata("noAssertionsOnInlineClassBasedOnNullableType.kt") public void testNoAssertionsOnInlineClassBasedOnNullableType() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/noAssertionsOnInlineClassBasedOnNullableType.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index a0604634d0d..c50562e5f82 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -14137,6 +14137,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/inlineClasses/mappingOfBoxedFlexibleInlineClassType.kt"); } + @TestMetadata("multifileClass.kt") + public void testMultifileClass() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/multifileClass.kt"); + } + @TestMetadata("noAssertionsOnInlineClassBasedOnNullableType.kt") public void testNoAssertionsOnInlineClassBasedOnNullableType() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/noAssertionsOnInlineClassBasedOnNullableType.kt"); diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index e506471fd8d..de260ede93e 100644 --- a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -12132,6 +12132,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/inlineClasses/mangledSuperCalls.kt"); } + @TestMetadata("multifileClass.kt") + public void testMultifileClass() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/multifileClass.kt"); + } + @TestMetadata("noAssertionsOnInlineClassBasedOnNullableType.kt") public void testNoAssertionsOnInlineClassBasedOnNullableType() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/noAssertionsOnInlineClassBasedOnNullableType.kt"); diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 769144f048c..479f513a644 100644 --- a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -12132,6 +12132,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/inlineClasses/mangledSuperCalls.kt"); } + @TestMetadata("multifileClass.kt") + public void testMultifileClass() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/multifileClass.kt"); + } + @TestMetadata("noAssertionsOnInlineClassBasedOnNullableType.kt") public void testNoAssertionsOnInlineClassBasedOnNullableType() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/noAssertionsOnInlineClassBasedOnNullableType.kt"); diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 1d5724cd6ad..6dbc6998acc 100644 --- a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -12197,6 +12197,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/inlineClasses/mangledSuperCalls.kt"); } + @TestMetadata("multifileClass.kt") + public void testMultifileClass() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/multifileClass.kt"); + } + @TestMetadata("noAssertionsOnInlineClassBasedOnNullableType.kt") public void testNoAssertionsOnInlineClassBasedOnNullableType() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/noAssertionsOnInlineClassBasedOnNullableType.kt"); diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index c4bbcb442e3..dfead9a57bf 100644 --- a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -6622,6 +6622,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/inlineClasses/mangledSuperCalls.kt"); } + @TestMetadata("multifileClass.kt") + public void testMultifileClass() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/multifileClass.kt"); + } + @TestMetadata("noAssertionsOnInlineClassBasedOnNullableType.kt") public void testNoAssertionsOnInlineClassBasedOnNullableType() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/noAssertionsOnInlineClassBasedOnNullableType.kt"); From 2fdc2dfaaf05f524a3246811c09e040f17dcd652 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Mon, 30 Nov 2020 19:11:43 +0100 Subject: [PATCH 353/698] JVM IR: fix regression in JvmStatic-in-object lowering for properties References to properties with JvmStatic getter were not handled in MakeCallsStatic (by overwriting dispatchReceiver with null) because the property itself was not considered static. #KT-43672 Fixed --- ...mpileKotlinAgainstKotlinTestGenerated.java | 5 ++ .../ir/FirBlackBoxCodegenTestGenerated.java | 5 ++ .../jvm/lower/JvmStaticAnnotationLowering.kt | 3 +- .../jvm/lower/PropertyReferenceLowering.kt | 31 ++++++---- .../box/jvmStatic/propertyReference.kt | 55 +++++++++++++++++ .../jvmStaticInObjectPropertyReference.kt | 59 +++++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 5 ++ ...mpileKotlinAgainstKotlinTestGenerated.java | 5 ++ .../LightAnalysisModeTestGenerated.java | 5 ++ .../ir/IrBlackBoxCodegenTestGenerated.java | 5 ++ ...mpileKotlinAgainstKotlinTestGenerated.java | 5 ++ .../ir/JvmIrAgainstOldBoxTestGenerated.java | 5 ++ .../ir/JvmOldAgainstIrBoxTestGenerated.java | 5 ++ 13 files changed, 180 insertions(+), 13 deletions(-) create mode 100644 compiler/testData/codegen/box/jvmStatic/propertyReference.kt create mode 100644 compiler/testData/compileKotlinAgainstKotlin/jvmStaticInObjectPropertyReference.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java index 12e6783ba30..d41ae7b1e56 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java @@ -243,6 +243,11 @@ public class FirCompileKotlinAgainstKotlinTestGenerated extends AbstractFirCompi runTest("compiler/testData/compileKotlinAgainstKotlin/jvmStaticInObject.kt"); } + @TestMetadata("jvmStaticInObjectPropertyReference.kt") + public void testJvmStaticInObjectPropertyReference() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/jvmStaticInObjectPropertyReference.kt"); + } + @TestMetadata("kotlinPropertyAsAnnotationParameter.kt") public void testKotlinPropertyAsAnnotationParameter() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/kotlinPropertyAsAnnotationParameter.kt"); diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 2ded3076b89..00c8cbf43b3 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -17974,6 +17974,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/jvmStatic/propertyGetterDelegatesToAnother.kt"); } + @TestMetadata("propertyReference.kt") + public void testPropertyReference() throws Exception { + runTest("compiler/testData/codegen/box/jvmStatic/propertyReference.kt"); + } + @TestMetadata("simple.kt") public void testSimple() throws Exception { runTest("compiler/testData/codegen/box/jvmStatic/simple.kt"); diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmStaticAnnotationLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmStaticAnnotationLowering.kt index 607ca0a75d3..6d4b0640da6 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmStaticAnnotationLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmStaticAnnotationLowering.kt @@ -171,4 +171,5 @@ private class MakeCallsStatic(val context: JvmBackendContext) : IrElementTransfo private fun IrDeclaration.isJvmStaticDeclaration(): Boolean = hasAnnotation(JVM_STATIC_ANNOTATION_FQ_NAME) || - (this as? IrSimpleFunction)?.correspondingPropertySymbol?.owner?.hasAnnotation(JVM_STATIC_ANNOTATION_FQ_NAME) == true + (this as? IrSimpleFunction)?.correspondingPropertySymbol?.owner?.hasAnnotation(JVM_STATIC_ANNOTATION_FQ_NAME) == true || + (this as? IrProperty)?.getter?.hasAnnotation(JVM_STATIC_ANNOTATION_FQ_NAME) == true diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/PropertyReferenceLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/PropertyReferenceLowering.kt index 899f330d48e..085d81cc9ff 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/PropertyReferenceLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/PropertyReferenceLowering.kt @@ -156,23 +156,29 @@ private class PropertyReferenceLowering(val context: JvmBackendContext) : IrElem val wrapper: IrFunction ) - private fun propertyReferenceKind(mutable: Boolean, i: Int) = PropertyReferenceKind( - context.ir.symbols.getPropertyReferenceClass(mutable, i, false), - context.ir.symbols.getPropertyReferenceClass(mutable, i, true), - context.ir.symbols.reflection.owner.functions.single { it.name.asString() == (if (mutable) "mutableProperty$i" else "property$i") } - ) + private fun propertyReferenceKind(expression: IrCallableReference<*>, mutable: Boolean, i: Int): PropertyReferenceKind { + check(i in 0..2) { "Incorrect number of receivers ($i) for property reference: ${expression.render()}" } + return PropertyReferenceKind( + context.ir.symbols.getPropertyReferenceClass(mutable, i, false), + context.ir.symbols.getPropertyReferenceClass(mutable, i, true), + context.ir.symbols.reflection.owner.functions.single { + it.name.asString() == (if (mutable) "mutableProperty$i" else "property$i") + } + ) + } - private fun propertyReferenceKindFor(expression: IrMemberAccessExpression<*>): PropertyReferenceKind = + private fun propertyReferenceKindFor(expression: IrCallableReference<*>): PropertyReferenceKind = expression.getter?.owner?.let { val boundReceivers = listOfNotNull(expression.dispatchReceiver, expression.extensionReceiver).size val needReceivers = listOfNotNull(it.dispatchReceiverParameter, it.extensionReceiverParameter).size // PropertyReference1 will swap the receivers if bound with the extension one, and PropertyReference0 // has no way to bind two receivers at once. - if (boundReceivers == 2 || (expression.extensionReceiver != null && needReceivers == 2)) - TODO("property reference with 2 receivers") - propertyReferenceKind(expression.setter != null, needReceivers - boundReceivers) + check(boundReceivers < 2 && (expression.extensionReceiver == null || needReceivers < 2)) { + "Property reference with two receivers is not supported: ${expression.render()}" + } + propertyReferenceKind(expression, expression.setter != null, needReceivers - boundReceivers) } ?: expression.field?.owner?.let { - propertyReferenceKind(!it.isFinal, if (it.isStatic || expression.dispatchReceiver != null) 0 else 1) + propertyReferenceKind(expression, !it.isFinal, if (it.isStatic || expression.dispatchReceiver != null) 0 else 1) } ?: throw AssertionError("property has no getter and no field: ${expression.dump()}") private data class PropertyInstance(val initializer: IrExpression, val index: Int) @@ -343,14 +349,15 @@ private class PropertyReferenceLowering(val context: JvmBackendContext) : IrElem fun IrBuilderWithScope.setCallArguments(call: IrCall, arguments: List) { var index = 1 call.copyTypeArgumentsFrom(expression) + val hasBoundReceiver = expression.getBoundReceiver() != null call.dispatchReceiver = call.symbol.owner.dispatchReceiverParameter?.let { - if (expression.dispatchReceiver != null) + if (hasBoundReceiver) irImplicitCast(irGetField(irGet(arguments[0]), backingField), it.type) else irImplicitCast(irGet(arguments[index++]), it.type) } call.extensionReceiver = call.symbol.owner.extensionReceiverParameter?.let { - if (expression.extensionReceiver != null) + if (hasBoundReceiver) irImplicitCast(irGetField(irGet(arguments[0]), backingField), it.type) else irImplicitCast(irGet(arguments[index++]), it.type) diff --git a/compiler/testData/codegen/box/jvmStatic/propertyReference.kt b/compiler/testData/codegen/box/jvmStatic/propertyReference.kt new file mode 100644 index 00000000000..ddbcadf0082 --- /dev/null +++ b/compiler/testData/codegen/box/jvmStatic/propertyReference.kt @@ -0,0 +1,55 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME + +import kotlin.reflect.* + +object Host { + var none: Int = 0 + get() = field + set(value) { field = value } + + var get: Int = 0 + @JvmStatic + get() = field + set(value) { field = value } + + var set: Int = 0 + get() = field + @JvmStatic + set(value) { field = value } + + var both: Int = 0 + @JvmStatic + get() = field + @JvmStatic + set(value) { field = value } + + @JvmStatic + var property: Int = 0 + get() = field + set(value) { field = value } +} + +fun box(): String { + val none = Host::none as KMutableProperty0 + none.set(1) + if (none.get() != 1) return "Fail none: ${none.get()}" + + val get = Host::get as KMutableProperty0 + get.set(1) + if (get.get() != 1) return "Fail get: ${get.get()}" + + val set = Host::set as KMutableProperty0 + set.set(1) + if (set.get() != 1) return "Fail set: ${set.get()}" + + val both = Host::both as KMutableProperty0 + both.set(1) + if (both.get() != 1) return "Fail both: ${both.get()}" + + val property = Host::property as KMutableProperty0 + property.set(1) + if (property.get() != 1) return "Fail property: ${property.get()}" + + return "OK" +} diff --git a/compiler/testData/compileKotlinAgainstKotlin/jvmStaticInObjectPropertyReference.kt b/compiler/testData/compileKotlinAgainstKotlin/jvmStaticInObjectPropertyReference.kt new file mode 100644 index 00000000000..e8734ec9544 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstKotlin/jvmStaticInObjectPropertyReference.kt @@ -0,0 +1,59 @@ +// TARGET_BACKEND: JVM +// IGNORE_BACKEND_FIR: JVM_IR +// WITH_RUNTIME +// FILE: A.kt + +object Host { + var none: Int = 0 + get() = field + set(value) { field = value } + + var get: Int = 0 + @JvmStatic + get() = field + set(value) { field = value } + + var set: Int = 0 + get() = field + @JvmStatic + set(value) { field = value } + + var both: Int = 0 + @JvmStatic + get() = field + @JvmStatic + set(value) { field = value } + + @JvmStatic + var property: Int = 0 + get() = field + set(value) { field = value } +} + +// FILE: B.kt + +import kotlin.reflect.* + +fun box(): String { + val none = Host::none as KMutableProperty0 + none.set(1) + if (none.get() != 1) return "Fail none: ${none.get()}" + + val get = Host::get as KMutableProperty0 + get.set(1) + if (get.get() != 1) return "Fail get: ${get.get()}" + + val set = Host::set as KMutableProperty0 + set.set(1) + if (set.get() != 1) return "Fail set: ${set.get()}" + + val both = Host::both as KMutableProperty0 + both.set(1) + if (both.get() != 1) return "Fail both: ${both.get()}" + + val property = Host::property as KMutableProperty0 + property.set(1) + if (property.get() != 1) return "Fail property: ${property.get()}" + + return "OK" +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index f4f9bcc5faf..888309c1ff4 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -19374,6 +19374,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/jvmStatic/propertyGetterDelegatesToAnother.kt"); } + @TestMetadata("propertyReference.kt") + public void testPropertyReference() throws Exception { + runTest("compiler/testData/codegen/box/jvmStatic/propertyReference.kt"); + } + @TestMetadata("simple.kt") public void testSimple() throws Exception { runTest("compiler/testData/codegen/box/jvmStatic/simple.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java index d3d28f6a96c..1f60f98cec2 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java @@ -248,6 +248,11 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl runTest("compiler/testData/compileKotlinAgainstKotlin/jvmStaticInObject.kt"); } + @TestMetadata("jvmStaticInObjectPropertyReference.kt") + public void testJvmStaticInObjectPropertyReference() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/jvmStaticInObjectPropertyReference.kt"); + } + @TestMetadata("kotlinPropertyAsAnnotationParameter.kt") public void testKotlinPropertyAsAnnotationParameter() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/kotlinPropertyAsAnnotationParameter.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 08def0da59b..ceaf5f2fc40 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -19374,6 +19374,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/jvmStatic/propertyGetterDelegatesToAnother.kt"); } + @TestMetadata("propertyReference.kt") + public void testPropertyReference() throws Exception { + runTest("compiler/testData/codegen/box/jvmStatic/propertyReference.kt"); + } + @TestMetadata("simple.kt") public void testSimple() throws Exception { runTest("compiler/testData/codegen/box/jvmStatic/simple.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index c50562e5f82..a3c67a07899 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -17974,6 +17974,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/jvmStatic/propertyGetterDelegatesToAnother.kt"); } + @TestMetadata("propertyReference.kt") + public void testPropertyReference() throws Exception { + runTest("compiler/testData/codegen/box/jvmStatic/propertyReference.kt"); + } + @TestMetadata("simple.kt") public void testSimple() throws Exception { runTest("compiler/testData/codegen/box/jvmStatic/simple.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java index 11946037910..84dae421148 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java @@ -243,6 +243,11 @@ public class IrCompileKotlinAgainstKotlinTestGenerated extends AbstractIrCompile runTest("compiler/testData/compileKotlinAgainstKotlin/jvmStaticInObject.kt"); } + @TestMetadata("jvmStaticInObjectPropertyReference.kt") + public void testJvmStaticInObjectPropertyReference() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/jvmStaticInObjectPropertyReference.kt"); + } + @TestMetadata("kotlinPropertyAsAnnotationParameter.kt") public void testKotlinPropertyAsAnnotationParameter() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/kotlinPropertyAsAnnotationParameter.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java index f97bdc77ab4..c7ce5ddf727 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java @@ -243,6 +243,11 @@ public class JvmIrAgainstOldBoxTestGenerated extends AbstractJvmIrAgainstOldBoxT runTest("compiler/testData/compileKotlinAgainstKotlin/jvmStaticInObject.kt"); } + @TestMetadata("jvmStaticInObjectPropertyReference.kt") + public void testJvmStaticInObjectPropertyReference() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/jvmStaticInObjectPropertyReference.kt"); + } + @TestMetadata("kotlinPropertyAsAnnotationParameter.kt") public void testKotlinPropertyAsAnnotationParameter() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/kotlinPropertyAsAnnotationParameter.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java index 55d67906415..5316aff8a28 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java @@ -243,6 +243,11 @@ public class JvmOldAgainstIrBoxTestGenerated extends AbstractJvmOldAgainstIrBoxT runTest("compiler/testData/compileKotlinAgainstKotlin/jvmStaticInObject.kt"); } + @TestMetadata("jvmStaticInObjectPropertyReference.kt") + public void testJvmStaticInObjectPropertyReference() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/jvmStaticInObjectPropertyReference.kt"); + } + @TestMetadata("kotlinPropertyAsAnnotationParameter.kt") public void testKotlinPropertyAsAnnotationParameter() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/kotlinPropertyAsAnnotationParameter.kt"); From b179b567a980ac215ec41334eb3114cd63c5c9e8 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Mon, 30 Nov 2020 19:12:57 +0300 Subject: [PATCH 354/698] [Gradle, JS] Add test on resolution of js project with directory dependency ^KT-43668 fixed --- .../kotlin/gradle/Kotlin2JsGradlePluginIT.kt | 24 +++++++++++++++++++ .../kotlin-js-nodejs-project/custom/main.txt | 0 .../resolver/KotlinCompilationNpmResolver.kt | 3 ++- 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin-js-nodejs-project/custom/main.txt diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kotlin2JsGradlePluginIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kotlin2JsGradlePluginIT.kt index d719b450e61..812957c1d70 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kotlin2JsGradlePluginIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kotlin2JsGradlePluginIT.kt @@ -799,4 +799,28 @@ abstract class AbstractKotlin2JsGradlePluginIT(private val irBackend: Boolean) : } } } + + @Test + fun testDirectoryDependencyNotFailProjectResolution() { + with(Project("kotlin-js-nodejs-project")) { + setupWorkingDir() + gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl) + gradleSettingsScript().modify(::transformBuildScriptWithPluginsDsl) + + gradleBuildScript().appendText( + """${"\n"} + dependencies { + implementation(files("${"$"}{projectDir}/custom")) + implementation(files("${"$"}{projectDir}/custom2")) + } + """.trimIndent() + ) + + build( + "packageJson" + ) { + assertSuccessful() + } + } + } } diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin-js-nodejs-project/custom/main.txt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin-js-nodejs-project/custom/main.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/npm/resolver/KotlinCompilationNpmResolver.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/npm/resolver/KotlinCompilationNpmResolver.kt index 713979eee81..6bde98e8725 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/npm/resolver/KotlinCompilationNpmResolver.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/npm/resolver/KotlinCompilationNpmResolver.kt @@ -339,7 +339,8 @@ internal class KotlinCompilationNpmResolver( resolver.gradleNodeModules.get(it.dependency.moduleName, it.dependency.moduleVersion, it.artifact.file) } + fileCollectionDependencies.flatMap { dependency -> dependency.files - .filter { it.exists() && it.isFile } + // Gradle can hash with FileHasher only files and only existed files + .filter { it.isFile } .map { file -> resolver.gradleNodeModules.get( file.name, From 7550a1870b967bd569396d685d79423a2377f7e3 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 30 Nov 2020 10:44:42 +0300 Subject: [PATCH 355/698] [FIR2IR] Make checks about f/o accessors necessity more precise #KT-43342 Fixed --- .../generators/FakeOverrideGenerator.kt | 7 +- .../kotlin/fir/Fir2IrTextTestGenerated.java | 5 + .../fir/declarations/FirDeclarationUtil.kt | 3 + .../ir/irText/firProblems/kt43342.fir.kt.txt | 71 ++++++ .../ir/irText/firProblems/kt43342.fir.txt | 228 ++++++++++++++++++ .../testData/ir/irText/firProblems/kt43342.kt | 10 + .../ir/irText/firProblems/kt43342.kt.txt | 62 +++++ .../ir/irText/firProblems/kt43342.txt | 202 ++++++++++++++++ .../kotlin/ir/IrTextTestCaseGenerated.java | 5 + 9 files changed, 590 insertions(+), 3 deletions(-) create mode 100644 compiler/testData/ir/irText/firProblems/kt43342.fir.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/kt43342.fir.txt create mode 100644 compiler/testData/ir/irText/firProblems/kt43342.kt create mode 100644 compiler/testData/ir/irText/firProblems/kt43342.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/kt43342.txt diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/FakeOverrideGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/FakeOverrideGenerator.kt index aeafa184aad..69dfb982391 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/FakeOverrideGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/FakeOverrideGenerator.kt @@ -232,13 +232,14 @@ class FakeOverrideGenerator( private fun IrProperty.discardAccessorsAccordingToBaseVisibility(baseSymbols: List) { for (baseSymbol in baseSymbols) { - val unwrapped = baseSymbol.unwrapFakeOverrides() + val unwrappedSymbol = baseSymbol.unwrapFakeOverrides() + val unwrappedProperty = unwrappedSymbol.fir // Do not create fake overrides for accessors if not allowed to do so, e.g., private lateinit var. - if (unwrapped.fir.getter?.allowsToHaveFakeOverride != true) { + if (!(unwrappedProperty.getter?.allowsToHaveFakeOverride ?: unwrappedProperty.allowsToHaveFakeOverride)) { getter = null } // or private setter - if (unwrapped.fir.setter?.allowsToHaveFakeOverride != true) { + if (!(unwrappedProperty.setter?.allowsToHaveFakeOverride ?: unwrappedProperty.allowsToHaveFakeOverride)) { setter = null } } diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java index 57d3bf7dd27..d90579d9d6e 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java @@ -1812,6 +1812,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { runTest("compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt"); } + @TestMetadata("kt43342.kt") + public void testKt43342() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/kt43342.kt"); + } + @TestMetadata("MultiList.kt") public void testMultiList() throws Exception { runTest("compiler/testData/ir/irText/firProblems/MultiList.kt"); diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/FirDeclarationUtil.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/FirDeclarationUtil.kt index 8b70b7bb7e3..ae0c30205a6 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/FirDeclarationUtil.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/FirDeclarationUtil.kt @@ -64,6 +64,9 @@ inline val FirPropertyAccessor.modality get() = status.modality inline val FirPropertyAccessor.visibility get() = status.visibility inline val FirPropertyAccessor.isInline get() = status.isInline inline val FirPropertyAccessor.isExternal get() = status.isExternal + +inline val FirProperty.allowsToHaveFakeOverride: Boolean + get() = !Visibilities.isPrivate(visibility) && visibility != Visibilities.InvisibleFake inline val FirPropertyAccessor.allowsToHaveFakeOverride: Boolean get() = !Visibilities.isPrivate(visibility) && visibility != Visibilities.InvisibleFake diff --git a/compiler/testData/ir/irText/firProblems/kt43342.fir.kt.txt b/compiler/testData/ir/irText/firProblems/kt43342.fir.kt.txt new file mode 100644 index 00000000000..c8ff8f1c5f3 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/kt43342.fir.kt.txt @@ -0,0 +1,71 @@ +open class ControlFlowInfo : Map { + constructor(map: Map) /* primary */ { + super/*Any*/() + /* () */ + + .#<$$delegate_0> = map + } + + val map: Map + field = map + get + + override fun containsKey(key: K): Boolean { + return .#<$$delegate_0>.containsKey(key = key) + } + + override fun containsValue(value: V): Boolean { + return .#<$$delegate_0>.containsValue(value = value) + } + + override operator fun get(key: K): V? { + return .#<$$delegate_0>.get(key = key) + } + + @SinceKotlin(version = "1.1") + @PlatformDependent + override fun getOrDefault(key: K, defaultValue: V): V { + return .#<$$delegate_0>.getOrDefault(key = key, defaultValue = defaultValue) + } + + override fun isEmpty(): Boolean { + return .#<$$delegate_0>.isEmpty() + } + + override val entries: Set> + override get(): Set> { + return .#<$$delegate_0>.() + } + + override val keys: Set + override get(): Set { + return .#<$$delegate_0>.() + } + + override val size: Int + override get(): Int { + return .#<$$delegate_0>.() + } + + override val values: Collection + override get(): Collection { + return .#<$$delegate_0>.() + } + + local /* final field */ val <$$delegate_0>: Map + +} + +class StringFlowInfo : ControlFlowInfo { + constructor(map: Map) /* primary */ { + super/*ControlFlowInfo*/(map = map) + /* () */ + + } + + fun foo(info: StringFlowInfo) { + .() /*~> Unit */ + info.() /*~> Unit */ + } + +} diff --git a/compiler/testData/ir/irText/firProblems/kt43342.fir.txt b/compiler/testData/ir/irText/firProblems/kt43342.fir.txt new file mode 100644 index 00000000000..cdd198c1fb4 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/kt43342.fir.txt @@ -0,0 +1,228 @@ +FILE fqName: fileName:/kt43342.kt + CLASS CLASS name:ControlFlowInfo modality:OPEN visibility:public superTypes:[kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + TYPE_PARAMETER name:K index:0 variance: superTypes:[kotlin.Any?] + TYPE_PARAMETER name:V index:1 variance: superTypes:[kotlin.Any?] + CONSTRUCTOR visibility:public <> (map:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo>) returnType:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> [primary] + VALUE_PARAMETER name:map index:0 type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:ControlFlowInfo modality:OPEN visibility:public superTypes:[kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo>]' + SET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:local [final]' type=kotlin.Unit origin=EQ + receiver: GET_VAR ': .ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo' type=.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> origin=null + value: GET_VAR 'map: kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=null + PROPERTY name:map visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:map type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:private [final] + EXPRESSION_BODY + GET_VAR 'map: kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>) returnType:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> + correspondingProperty: PROPERTY name:map visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:map type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:private [final]' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=null + receiver: GET_VAR ': .ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.' type=.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> origin=null + FUN DELEGATED_MEMBER name:containsKey visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>, key:K of .ControlFlowInfo) returnType:kotlin.Boolean + overridden: + public abstract fun containsKey (key: K of kotlin.collections.Map): kotlin.Boolean declared in kotlin.collections.Map + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + VALUE_PARAMETER name:key index:0 type:K of .ControlFlowInfo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun containsKey (key: K of .ControlFlowInfo): kotlin.Boolean declared in .ControlFlowInfo' + CALL 'public abstract fun containsKey (key: K of kotlin.collections.Map): kotlin.Boolean declared in kotlin.collections.Map' type=kotlin.Boolean origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:local [final]' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=null + receiver: GET_VAR ': .ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.containsKey' type=.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> origin=null + key: GET_VAR 'key: K of .ControlFlowInfo declared in .ControlFlowInfo.containsKey' type=K of .ControlFlowInfo origin=null + FUN DELEGATED_MEMBER name:containsValue visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>, value:V of .ControlFlowInfo) returnType:kotlin.Boolean + overridden: + public abstract fun containsValue (value: V of kotlin.collections.Map): kotlin.Boolean declared in kotlin.collections.Map + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + VALUE_PARAMETER name:value index:0 type:V of .ControlFlowInfo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun containsValue (value: V of .ControlFlowInfo): kotlin.Boolean declared in .ControlFlowInfo' + CALL 'public abstract fun containsValue (value: V of kotlin.collections.Map): kotlin.Boolean declared in kotlin.collections.Map' type=kotlin.Boolean origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:local [final]' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=null + receiver: GET_VAR ': .ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.containsValue' type=.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> origin=null + value: GET_VAR 'value: V of .ControlFlowInfo declared in .ControlFlowInfo.containsValue' type=V of .ControlFlowInfo origin=null + FUN DELEGATED_MEMBER name:get visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>, key:K of .ControlFlowInfo) returnType:V of .ControlFlowInfo? [operator] + overridden: + public abstract fun get (key: K of kotlin.collections.Map): V of kotlin.collections.Map? [operator] declared in kotlin.collections.Map + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + VALUE_PARAMETER name:key index:0 type:K of .ControlFlowInfo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun get (key: K of .ControlFlowInfo): V of .ControlFlowInfo? [operator] declared in .ControlFlowInfo' + CALL 'public abstract fun get (key: K of kotlin.collections.Map): V of kotlin.collections.Map? [operator] declared in kotlin.collections.Map' type=V of .ControlFlowInfo? origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:local [final]' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=null + receiver: GET_VAR ': .ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.get' type=.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> origin=null + key: GET_VAR 'key: K of .ControlFlowInfo declared in .ControlFlowInfo.get' type=K of .ControlFlowInfo origin=null + FUN DELEGATED_MEMBER name:getOrDefault visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>, key:K of .ControlFlowInfo, defaultValue:V of .ControlFlowInfo) returnType:V of .ControlFlowInfo + annotations: + SinceKotlin(version = '1.1') + PlatformDependent + overridden: + public open fun getOrDefault (key: K of kotlin.collections.Map, defaultValue: V of kotlin.collections.Map): V of kotlin.collections.Map declared in kotlin.collections.Map + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + VALUE_PARAMETER name:key index:0 type:K of .ControlFlowInfo + VALUE_PARAMETER name:defaultValue index:1 type:V of .ControlFlowInfo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun getOrDefault (key: K of .ControlFlowInfo, defaultValue: V of .ControlFlowInfo): V of .ControlFlowInfo declared in .ControlFlowInfo' + CALL 'public open fun getOrDefault (key: K of kotlin.collections.Map, defaultValue: V of kotlin.collections.Map): V of kotlin.collections.Map declared in kotlin.collections.Map' type=V of .ControlFlowInfo origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:local [final]' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=null + receiver: GET_VAR ': .ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.getOrDefault' type=.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> origin=null + key: GET_VAR 'key: K of .ControlFlowInfo declared in .ControlFlowInfo.getOrDefault' type=K of .ControlFlowInfo origin=null + defaultValue: GET_VAR 'defaultValue: V of .ControlFlowInfo declared in .ControlFlowInfo.getOrDefault' type=V of .ControlFlowInfo origin=null + FUN DELEGATED_MEMBER name:isEmpty visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>) returnType:kotlin.Boolean + overridden: + public abstract fun isEmpty (): kotlin.Boolean declared in kotlin.collections.Map + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun isEmpty (): kotlin.Boolean declared in .ControlFlowInfo' + CALL 'public abstract fun isEmpty (): kotlin.Boolean declared in kotlin.collections.Map' type=kotlin.Boolean origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:local [final]' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=null + receiver: GET_VAR ': .ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.isEmpty' type=.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> origin=null + PROPERTY DELEGATED_MEMBER name:entries visibility:public modality:OPEN [val] + FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>) returnType:kotlin.collections.Set.ControlFlowInfo, V of .ControlFlowInfo>> + correspondingProperty: PROPERTY DELEGATED_MEMBER name:entries visibility:public modality:OPEN [val] + overridden: + public abstract fun (): kotlin.collections.Set> declared in kotlin.collections.Map + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.collections.Set.ControlFlowInfo, V of .ControlFlowInfo>> declared in .ControlFlowInfo' + CALL 'public abstract fun (): kotlin.collections.Set> declared in kotlin.collections.Map' type=kotlin.collections.Set.ControlFlowInfo, V of .ControlFlowInfo>> origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:local [final]' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=null + receiver: GET_VAR ': .ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.' type=.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> origin=null + PROPERTY DELEGATED_MEMBER name:keys visibility:public modality:OPEN [val] + FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>) returnType:kotlin.collections.Set.ControlFlowInfo> + correspondingProperty: PROPERTY DELEGATED_MEMBER name:keys visibility:public modality:OPEN [val] + overridden: + public abstract fun (): kotlin.collections.Set declared in kotlin.collections.Map + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.collections.Set.ControlFlowInfo> declared in .ControlFlowInfo' + CALL 'public abstract fun (): kotlin.collections.Set declared in kotlin.collections.Map' type=kotlin.collections.Set.ControlFlowInfo> origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:local [final]' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=null + receiver: GET_VAR ': .ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.' type=.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> origin=null + PROPERTY DELEGATED_MEMBER name:size visibility:public modality:OPEN [val] + FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>) returnType:kotlin.Int + correspondingProperty: PROPERTY DELEGATED_MEMBER name:size visibility:public modality:OPEN [val] + overridden: + public abstract fun (): kotlin.Int declared in kotlin.collections.Map + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.Int declared in .ControlFlowInfo' + CALL 'public abstract fun (): kotlin.Int declared in kotlin.collections.Map' type=kotlin.Int origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:local [final]' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=null + receiver: GET_VAR ': .ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.' type=.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> origin=null + PROPERTY DELEGATED_MEMBER name:values visibility:public modality:OPEN [val] + FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>) returnType:kotlin.collections.Collection.ControlFlowInfo> + correspondingProperty: PROPERTY DELEGATED_MEMBER name:values visibility:public modality:OPEN [val] + overridden: + public abstract fun (): kotlin.collections.Collection declared in kotlin.collections.Map + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.collections.Collection.ControlFlowInfo> declared in .ControlFlowInfo' + CALL 'public abstract fun (): kotlin.collections.Collection declared in kotlin.collections.Map' type=kotlin.collections.Collection.ControlFlowInfo> origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:local [final]' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=null + receiver: GET_VAR ': .ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.' type=.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> origin=null + FIELD DELEGATE name:<$$delegate_0> type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:local [final] + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:StringFlowInfo modality:FINAL visibility:public superTypes:[.ControlFlowInfo] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.StringFlowInfo + CONSTRUCTOR visibility:public <> (map:kotlin.collections.Map) returnType:.StringFlowInfo [primary] + VALUE_PARAMETER name:map index:0 type:kotlin.collections.Map + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (map: kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo>) [primary] declared in .ControlFlowInfo' + : kotlin.String + : kotlin.String + map: GET_VAR 'map: kotlin.collections.Map declared in .StringFlowInfo.' type=kotlin.collections.Map origin=null + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:StringFlowInfo modality:FINAL visibility:public superTypes:[.ControlFlowInfo]' + FUN name:foo visibility:public modality:FINAL <> ($this:.StringFlowInfo, info:.StringFlowInfo) returnType:kotlin.Unit + $this: VALUE_PARAMETER name: type:.StringFlowInfo + VALUE_PARAMETER name:info index:0 type:.StringFlowInfo + BLOCK_BODY + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public open fun (): kotlin.collections.Set [fake_override] declared in .StringFlowInfo' type=kotlin.collections.Set origin=GET_PROPERTY + $this: GET_VAR ': .StringFlowInfo declared in .StringFlowInfo.foo' type=.StringFlowInfo origin=null + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public open fun (): kotlin.collections.Set [fake_override] declared in .StringFlowInfo' type=kotlin.collections.Set origin=GET_PROPERTY + $this: GET_VAR 'info: .StringFlowInfo declared in .StringFlowInfo.foo' type=.StringFlowInfo origin=null + PROPERTY FAKE_OVERRIDE name:map visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>) returnType:kotlin.collections.Map [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:map visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + FUN FAKE_OVERRIDE name:containsKey visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>, key:kotlin.String) returnType:kotlin.Boolean [fake_override] + overridden: + public open fun containsKey (key: K of .ControlFlowInfo): kotlin.Boolean declared in .ControlFlowInfo + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + VALUE_PARAMETER name:key index:0 type:kotlin.String + FUN FAKE_OVERRIDE name:containsValue visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>, value:kotlin.String) returnType:kotlin.Boolean [fake_override] + overridden: + public open fun containsValue (value: V of .ControlFlowInfo): kotlin.Boolean declared in .ControlFlowInfo + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + VALUE_PARAMETER name:value index:0 type:kotlin.String + FUN FAKE_OVERRIDE name:get visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>, key:kotlin.String) returnType:kotlin.String? [fake_override,operator] + overridden: + public open fun get (key: K of .ControlFlowInfo): V of .ControlFlowInfo? [operator] declared in .ControlFlowInfo + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + VALUE_PARAMETER name:key index:0 type:kotlin.String + FUN FAKE_OVERRIDE name:getOrDefault visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>, key:kotlin.String, defaultValue:kotlin.String) returnType:kotlin.String [fake_override] + overridden: + public open fun getOrDefault (key: K of .ControlFlowInfo, defaultValue: V of .ControlFlowInfo): V of .ControlFlowInfo declared in .ControlFlowInfo + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + VALUE_PARAMETER name:key index:0 type:kotlin.String + VALUE_PARAMETER name:defaultValue index:1 type:kotlin.String + FUN FAKE_OVERRIDE name:isEmpty visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>) returnType:kotlin.Boolean [fake_override] + overridden: + public open fun isEmpty (): kotlin.Boolean declared in .ControlFlowInfo + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + PROPERTY FAKE_OVERRIDE name:entries visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>) returnType:kotlin.collections.Set> [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:entries visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.collections.Set.ControlFlowInfo, V of .ControlFlowInfo>> declared in .ControlFlowInfo + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + PROPERTY FAKE_OVERRIDE name:keys visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>) returnType:kotlin.collections.Set [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:keys visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.collections.Set.ControlFlowInfo> declared in .ControlFlowInfo + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + PROPERTY FAKE_OVERRIDE name:size visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>) returnType:kotlin.Int [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:size visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.Int declared in .ControlFlowInfo + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + PROPERTY FAKE_OVERRIDE name:values visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>) returnType:kotlin.collections.Collection [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:values visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.collections.Collection.ControlFlowInfo> declared in .ControlFlowInfo + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/testData/ir/irText/firProblems/kt43342.kt b/compiler/testData/ir/irText/firProblems/kt43342.kt new file mode 100644 index 00000000000..03c4d2ed2b5 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/kt43342.kt @@ -0,0 +1,10 @@ +// WITH_RUNTIME + +open class ControlFlowInfo(val map: Map): Map by map + +class StringFlowInfo(map: Map): ControlFlowInfo(map) { + fun foo(info: StringFlowInfo) { + keys + info.keys + } +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/firProblems/kt43342.kt.txt b/compiler/testData/ir/irText/firProblems/kt43342.kt.txt new file mode 100644 index 00000000000..65a62c7531c --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/kt43342.kt.txt @@ -0,0 +1,62 @@ +open class ControlFlowInfo : Map { + constructor(map: Map) /* primary */ { + super/*Any*/() + /* () */ + + } + + val map: Map + field = map + get + + override fun containsKey(key: K): Boolean { + return .#map.containsKey(key = key) + } + + override fun containsValue(value: V): Boolean { + return .#map.containsValue(value = value) + } + + override operator fun get(key: K): V? { + return .#map.get(key = key) + } + + override fun isEmpty(): Boolean { + return .#map.isEmpty() + } + + override val entries: Set> + override get(): Set> { + return .#map.() + } + + override val keys: Set + override get(): Set { + return .#map.() + } + + override val size: Int + override get(): Int { + return .#map.() + } + + override val values: Collection + override get(): Collection { + return .#map.() + } + +} + +class StringFlowInfo : ControlFlowInfo { + constructor(map: Map) /* primary */ { + super/*ControlFlowInfo*/(map = map) + /* () */ + + } + + fun foo(info: StringFlowInfo) { + .() /*~> Unit */ + info.() /*~> Unit */ + } + +} diff --git a/compiler/testData/ir/irText/firProblems/kt43342.txt b/compiler/testData/ir/irText/firProblems/kt43342.txt new file mode 100644 index 00000000000..81d5b3009fc --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/kt43342.txt @@ -0,0 +1,202 @@ +FILE fqName: fileName:/kt43342.kt + CLASS CLASS name:ControlFlowInfo modality:OPEN visibility:public superTypes:[kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + TYPE_PARAMETER name:K index:0 variance: superTypes:[kotlin.Any?] + TYPE_PARAMETER name:V index:1 variance: superTypes:[kotlin.Any?] + CONSTRUCTOR visibility:public <> (map:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo>) returnType:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> [primary] + VALUE_PARAMETER name:map index:0 type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:ControlFlowInfo modality:OPEN visibility:public superTypes:[kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo>]' + PROPERTY name:map visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:map type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:private [final] + EXPRESSION_BODY + GET_VAR 'map: kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>) returnType:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> + correspondingProperty: PROPERTY name:map visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:map type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:private [final]' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=null + receiver: GET_VAR ': .ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.' type=.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> origin=null + FUN DELEGATED_MEMBER name:containsKey visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>, key:K of .ControlFlowInfo) returnType:kotlin.Boolean + overridden: + public abstract fun containsKey (key: K of kotlin.collections.Map): kotlin.Boolean declared in kotlin.collections.Map + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + VALUE_PARAMETER name:key index:0 type:K of .ControlFlowInfo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun containsKey (key: K of .ControlFlowInfo): kotlin.Boolean declared in .ControlFlowInfo' + CALL 'public abstract fun containsKey (key: K of kotlin.collections.Map): kotlin.Boolean declared in kotlin.collections.Map' type=kotlin.Boolean origin=null + $this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:map type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:private [final]' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=null + receiver: GET_VAR ': .ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.containsKey' type=.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> origin=null + key: GET_VAR 'key: K of .ControlFlowInfo declared in .ControlFlowInfo.containsKey' type=K of .ControlFlowInfo origin=null + FUN DELEGATED_MEMBER name:containsValue visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>, value:V of .ControlFlowInfo) returnType:kotlin.Boolean + overridden: + public abstract fun containsValue (value: V of kotlin.collections.Map): kotlin.Boolean declared in kotlin.collections.Map + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + VALUE_PARAMETER name:value index:0 type:V of .ControlFlowInfo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun containsValue (value: V of .ControlFlowInfo): kotlin.Boolean declared in .ControlFlowInfo' + CALL 'public abstract fun containsValue (value: V of kotlin.collections.Map): kotlin.Boolean declared in kotlin.collections.Map' type=kotlin.Boolean origin=null + $this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:map type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:private [final]' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=null + receiver: GET_VAR ': .ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.containsValue' type=.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> origin=null + value: GET_VAR 'value: V of .ControlFlowInfo declared in .ControlFlowInfo.containsValue' type=V of .ControlFlowInfo origin=null + FUN DELEGATED_MEMBER name:get visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>, key:K of .ControlFlowInfo) returnType:V of .ControlFlowInfo? [operator] + overridden: + public abstract fun get (key: K of kotlin.collections.Map): V of kotlin.collections.Map? [operator] declared in kotlin.collections.Map + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + VALUE_PARAMETER name:key index:0 type:K of .ControlFlowInfo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun get (key: K of .ControlFlowInfo): V of .ControlFlowInfo? [operator] declared in .ControlFlowInfo' + CALL 'public abstract fun get (key: K of kotlin.collections.Map): V of kotlin.collections.Map? [operator] declared in kotlin.collections.Map' type=V of .ControlFlowInfo? origin=null + $this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:map type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:private [final]' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=null + receiver: GET_VAR ': .ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.get' type=.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> origin=null + key: GET_VAR 'key: K of .ControlFlowInfo declared in .ControlFlowInfo.get' type=K of .ControlFlowInfo origin=null + FUN DELEGATED_MEMBER name:isEmpty visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>) returnType:kotlin.Boolean + overridden: + public abstract fun isEmpty (): kotlin.Boolean declared in kotlin.collections.Map + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun isEmpty (): kotlin.Boolean declared in .ControlFlowInfo' + CALL 'public abstract fun isEmpty (): kotlin.Boolean declared in kotlin.collections.Map' type=kotlin.Boolean origin=null + $this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:map type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:private [final]' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=null + receiver: GET_VAR ': .ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.isEmpty' type=.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> origin=null + PROPERTY DELEGATED_MEMBER name:entries visibility:public modality:OPEN [val] + FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>) returnType:kotlin.collections.Set.ControlFlowInfo, V of .ControlFlowInfo>> + correspondingProperty: PROPERTY DELEGATED_MEMBER name:entries visibility:public modality:OPEN [val] + overridden: + public abstract fun (): kotlin.collections.Set> declared in kotlin.collections.Map + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.collections.Set.ControlFlowInfo, V of .ControlFlowInfo>> declared in .ControlFlowInfo' + CALL 'public abstract fun (): kotlin.collections.Set> declared in kotlin.collections.Map' type=kotlin.collections.Set.ControlFlowInfo, V of .ControlFlowInfo>> origin=null + $this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:map type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:private [final]' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=null + receiver: GET_VAR ': .ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.' type=.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> origin=null + PROPERTY DELEGATED_MEMBER name:keys visibility:public modality:OPEN [val] + FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>) returnType:kotlin.collections.Set.ControlFlowInfo> + correspondingProperty: PROPERTY DELEGATED_MEMBER name:keys visibility:public modality:OPEN [val] + overridden: + public abstract fun (): kotlin.collections.Set declared in kotlin.collections.Map + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.collections.Set.ControlFlowInfo> declared in .ControlFlowInfo' + CALL 'public abstract fun (): kotlin.collections.Set declared in kotlin.collections.Map' type=kotlin.collections.Set.ControlFlowInfo> origin=null + $this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:map type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:private [final]' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=null + receiver: GET_VAR ': .ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.' type=.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> origin=null + PROPERTY DELEGATED_MEMBER name:size visibility:public modality:OPEN [val] + FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>) returnType:kotlin.Int + correspondingProperty: PROPERTY DELEGATED_MEMBER name:size visibility:public modality:OPEN [val] + overridden: + public abstract fun (): kotlin.Int declared in kotlin.collections.Map + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.Int declared in .ControlFlowInfo' + CALL 'public abstract fun (): kotlin.Int declared in kotlin.collections.Map' type=kotlin.Int origin=null + $this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:map type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:private [final]' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=null + receiver: GET_VAR ': .ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.' type=.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> origin=null + PROPERTY DELEGATED_MEMBER name:values visibility:public modality:OPEN [val] + FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>) returnType:kotlin.collections.Collection.ControlFlowInfo> + correspondingProperty: PROPERTY DELEGATED_MEMBER name:values visibility:public modality:OPEN [val] + overridden: + public abstract fun (): kotlin.collections.Collection declared in kotlin.collections.Map + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.collections.Collection.ControlFlowInfo> declared in .ControlFlowInfo' + CALL 'public abstract fun (): kotlin.collections.Collection declared in kotlin.collections.Map' type=kotlin.collections.Collection.ControlFlowInfo> origin=null + $this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:map type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:private [final]' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=null + receiver: GET_VAR ': .ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.' type=.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in kotlin.collections.Map + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.collections.Map + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in kotlin.collections.Map + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:StringFlowInfo modality:FINAL visibility:public superTypes:[.ControlFlowInfo] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.StringFlowInfo + CONSTRUCTOR visibility:public <> (map:kotlin.collections.Map) returnType:.StringFlowInfo [primary] + VALUE_PARAMETER name:map index:0 type:kotlin.collections.Map + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (map: kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo>) [primary] declared in .ControlFlowInfo' + : kotlin.String + : kotlin.String + map: GET_VAR 'map: kotlin.collections.Map declared in .StringFlowInfo.' type=kotlin.collections.Map origin=null + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:StringFlowInfo modality:FINAL visibility:public superTypes:[.ControlFlowInfo]' + FUN name:foo visibility:public modality:FINAL <> ($this:.StringFlowInfo, info:.StringFlowInfo) returnType:kotlin.Unit + $this: VALUE_PARAMETER name: type:.StringFlowInfo + VALUE_PARAMETER name:info index:0 type:.StringFlowInfo + BLOCK_BODY + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public open fun (): kotlin.collections.Set [fake_override] declared in .StringFlowInfo' type=kotlin.collections.Set origin=GET_PROPERTY + $this: GET_VAR ': .StringFlowInfo declared in .StringFlowInfo.foo' type=.StringFlowInfo origin=null + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public open fun (): kotlin.collections.Set [fake_override] declared in .StringFlowInfo' type=kotlin.collections.Set origin=GET_PROPERTY + $this: GET_VAR 'info: .StringFlowInfo declared in .StringFlowInfo.foo' type=.StringFlowInfo origin=null + PROPERTY FAKE_OVERRIDE name:map visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.ControlFlowInfo) returnType:kotlin.collections.Map [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:map visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo + $this: VALUE_PARAMETER name: type:.ControlFlowInfo + FUN FAKE_OVERRIDE name:containsKey visibility:public modality:OPEN <> ($this:.ControlFlowInfo, key:kotlin.String) returnType:kotlin.Boolean [fake_override] + overridden: + public open fun containsKey (key: K of .ControlFlowInfo): kotlin.Boolean declared in .ControlFlowInfo + $this: VALUE_PARAMETER name: type:.ControlFlowInfo + VALUE_PARAMETER name:key index:0 type:kotlin.String + FUN FAKE_OVERRIDE name:containsValue visibility:public modality:OPEN <> ($this:.ControlFlowInfo, value:kotlin.String) returnType:kotlin.Boolean [fake_override] + overridden: + public open fun containsValue (value: V of .ControlFlowInfo): kotlin.Boolean declared in .ControlFlowInfo + $this: VALUE_PARAMETER name: type:.ControlFlowInfo + VALUE_PARAMETER name:value index:0 type:kotlin.String + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .ControlFlowInfo + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:get visibility:public modality:OPEN <> ($this:.ControlFlowInfo, key:kotlin.String) returnType:kotlin.String? [fake_override,operator] + overridden: + public open fun get (key: K of .ControlFlowInfo): V of .ControlFlowInfo? [operator] declared in .ControlFlowInfo + $this: VALUE_PARAMETER name: type:.ControlFlowInfo + VALUE_PARAMETER name:key index:0 type:kotlin.String + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in .ControlFlowInfo + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:isEmpty visibility:public modality:OPEN <> ($this:.ControlFlowInfo) returnType:kotlin.Boolean [fake_override] + overridden: + public open fun isEmpty (): kotlin.Boolean declared in .ControlFlowInfo + $this: VALUE_PARAMETER name: type:.ControlFlowInfo + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in .ControlFlowInfo + $this: VALUE_PARAMETER name: type:kotlin.Any + PROPERTY FAKE_OVERRIDE name:entries visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.ControlFlowInfo) returnType:kotlin.collections.Set> [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:entries visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.collections.Set.ControlFlowInfo, V of .ControlFlowInfo>> declared in .ControlFlowInfo + $this: VALUE_PARAMETER name: type:.ControlFlowInfo + PROPERTY FAKE_OVERRIDE name:keys visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.ControlFlowInfo) returnType:kotlin.collections.Set [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:keys visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.collections.Set.ControlFlowInfo> declared in .ControlFlowInfo + $this: VALUE_PARAMETER name: type:.ControlFlowInfo + PROPERTY FAKE_OVERRIDE name:size visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.ControlFlowInfo) returnType:kotlin.Int [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:size visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.Int declared in .ControlFlowInfo + $this: VALUE_PARAMETER name: type:.ControlFlowInfo + PROPERTY FAKE_OVERRIDE name:values visibility:public modality:OPEN [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:.ControlFlowInfo) returnType:kotlin.collections.Collection [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:values visibility:public modality:OPEN [fake_override,val] + overridden: + public open fun (): kotlin.collections.Collection.ControlFlowInfo> declared in .ControlFlowInfo + $this: VALUE_PARAMETER name: type:.ControlFlowInfo diff --git a/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index 637604c5043..9e5ac0cf31b 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -1811,6 +1811,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { runTest("compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt"); } + @TestMetadata("kt43342.kt") + public void testKt43342() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/kt43342.kt"); + } + @TestMetadata("MultiList.kt") public void testMultiList() throws Exception { runTest("compiler/testData/ir/irText/firProblems/MultiList.kt"); From 91bccad72bd8c07aca046a190288a3ca10a49186 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Tue, 1 Dec 2020 13:06:38 +0300 Subject: [PATCH 356/698] [JS] Fix path of generated js tests --- .../org/jetbrains/kotlin/generators/tests/GenerateJsTests.kt | 4 ++-- .../org/jetbrains/kotlin/js/test/DceTestGenerated.java | 0 .../jetbrains/kotlin/js/test/JsLineNumberTestGenerated.java | 0 .../kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java | 0 .../js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java | 0 .../test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java | 0 .../es6/semantics/IrJsTypeScriptExportES6TestGenerated.java | 0 .../kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java | 0 .../test/ir/semantics/IrJsCodegenBoxErrorTestGenerated.java | 0 .../js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java | 0 .../js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java | 0 .../test/ir/semantics/IrJsTypeScriptExportTestGenerated.java | 0 .../kotlin/js/test/semantics/BoxJsTestGenerated.java | 0 .../kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java | 0 .../js/test/semantics/JsCodegenInlineTestGenerated.java | 0 .../semantics/JsLegacyPrimitiveArraysBoxTestGenerated.java | 0 .../test/semantics/LegacyJsTypeScriptExportTestGenerated.java | 0 .../js/test/semantics/OutputPrefixPostfixTestGenerated.java | 0 .../test/semantics/SourceMapGenerationSmokeTestGenerated.java | 0 .../js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java | 0 20 files changed, 2 insertions(+), 2 deletions(-) rename js/js.tests/{test-gen => tests-gen}/org/jetbrains/kotlin/js/test/DceTestGenerated.java (100%) rename js/js.tests/{test-gen => tests-gen}/org/jetbrains/kotlin/js/test/JsLineNumberTestGenerated.java (100%) rename js/js.tests/{test-gen => tests-gen}/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java (100%) rename js/js.tests/{test-gen => tests-gen}/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java (100%) rename js/js.tests/{test-gen => tests-gen}/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java (100%) rename js/js.tests/{test-gen => tests-gen}/org/jetbrains/kotlin/js/test/es6/semantics/IrJsTypeScriptExportES6TestGenerated.java (100%) rename js/js.tests/{test-gen => tests-gen}/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java (100%) rename js/js.tests/{test-gen => tests-gen}/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxErrorTestGenerated.java (100%) rename js/js.tests/{test-gen => tests-gen}/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java (100%) rename js/js.tests/{test-gen => tests-gen}/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java (100%) rename js/js.tests/{test-gen => tests-gen}/org/jetbrains/kotlin/js/test/ir/semantics/IrJsTypeScriptExportTestGenerated.java (100%) rename js/js.tests/{test-gen => tests-gen}/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java (100%) rename js/js.tests/{test-gen => tests-gen}/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java (100%) rename js/js.tests/{test-gen => tests-gen}/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java (100%) rename js/js.tests/{test-gen => tests-gen}/org/jetbrains/kotlin/js/test/semantics/JsLegacyPrimitiveArraysBoxTestGenerated.java (100%) rename js/js.tests/{test-gen => tests-gen}/org/jetbrains/kotlin/js/test/semantics/LegacyJsTypeScriptExportTestGenerated.java (100%) rename js/js.tests/{test-gen => tests-gen}/org/jetbrains/kotlin/js/test/semantics/OutputPrefixPostfixTestGenerated.java (100%) rename js/js.tests/{test-gen => tests-gen}/org/jetbrains/kotlin/js/test/semantics/SourceMapGenerationSmokeTestGenerated.java (100%) rename js/js.tests/{test-gen => tests-gen}/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java (100%) diff --git a/js/js.tests/test/org/jetbrains/kotlin/generators/tests/GenerateJsTests.kt b/js/js.tests/test/org/jetbrains/kotlin/generators/tests/GenerateJsTests.kt index b4cdfcb891d..e341e544492 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/generators/tests/GenerateJsTests.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/generators/tests/GenerateJsTests.kt @@ -21,7 +21,7 @@ fun main(args: Array) { //generateTestDataForReservedWords() testGroupSuite(args) { - testGroup("js/js.tests/test-gen", "js/js.translator/testData", testRunnerMethodName = "runTest0") { + testGroup("js/js.tests/tests-gen", "js/js.translator/testData", testRunnerMethodName = "runTest0") { testClass { model("box/", pattern = "^([^_](.+))\\.kt$", targetBackend = TargetBackend.JS) } @@ -64,7 +64,7 @@ fun main(args: Array) { } } - testGroup("js/js.tests/test-gen", "compiler/testData", testRunnerMethodName = "runTest0") { + testGroup("js/js.tests/tests-gen", "compiler/testData", testRunnerMethodName = "runTest0") { testClass { model("codegen/box", targetBackend = TargetBackend.JS) } diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/DceTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/DceTestGenerated.java similarity index 100% rename from js/js.tests/test-gen/org/jetbrains/kotlin/js/test/DceTestGenerated.java rename to js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/DceTestGenerated.java diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/JsLineNumberTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsLineNumberTestGenerated.java similarity index 100% rename from js/js.tests/test-gen/org/jetbrains/kotlin/js/test/JsLineNumberTestGenerated.java rename to js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsLineNumberTestGenerated.java diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java similarity index 100% rename from js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java rename to js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java similarity index 100% rename from js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java rename to js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java similarity index 100% rename from js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java rename to js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsTypeScriptExportES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsTypeScriptExportES6TestGenerated.java similarity index 100% rename from js/js.tests/test-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsTypeScriptExportES6TestGenerated.java rename to js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsTypeScriptExportES6TestGenerated.java diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java similarity index 100% rename from js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java rename to js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxErrorTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxErrorTestGenerated.java similarity index 100% rename from js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxErrorTestGenerated.java rename to js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxErrorTestGenerated.java diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java similarity index 100% rename from js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java rename to js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java similarity index 100% rename from js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java rename to js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsTypeScriptExportTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsTypeScriptExportTestGenerated.java similarity index 100% rename from js/js.tests/test-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsTypeScriptExportTestGenerated.java rename to js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsTypeScriptExportTestGenerated.java diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java similarity index 100% rename from js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java rename to js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java similarity index 100% rename from js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java rename to js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java similarity index 100% rename from js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java rename to js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/JsLegacyPrimitiveArraysBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsLegacyPrimitiveArraysBoxTestGenerated.java similarity index 100% rename from js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/JsLegacyPrimitiveArraysBoxTestGenerated.java rename to js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsLegacyPrimitiveArraysBoxTestGenerated.java diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/LegacyJsTypeScriptExportTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/LegacyJsTypeScriptExportTestGenerated.java similarity index 100% rename from js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/LegacyJsTypeScriptExportTestGenerated.java rename to js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/LegacyJsTypeScriptExportTestGenerated.java diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/OutputPrefixPostfixTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/OutputPrefixPostfixTestGenerated.java similarity index 100% rename from js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/OutputPrefixPostfixTestGenerated.java rename to js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/OutputPrefixPostfixTestGenerated.java diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/SourceMapGenerationSmokeTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/SourceMapGenerationSmokeTestGenerated.java similarity index 100% rename from js/js.tests/test-gen/org/jetbrains/kotlin/js/test/semantics/SourceMapGenerationSmokeTestGenerated.java rename to js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/SourceMapGenerationSmokeTestGenerated.java diff --git a/js/js.tests/test-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java similarity index 100% rename from js/js.tests/test-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java rename to js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java From bb4950a0215f5387cc1e64038ddcfe6047bcd461 Mon Sep 17 00:00:00 2001 From: Georgy Bronnikov Date: Tue, 1 Dec 2020 16:01:22 +0300 Subject: [PATCH 357/698] Regenerate LightAnalysis tests --- .../kotlin/codegen/LightAnalysisModeTestGenerated.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index ceaf5f2fc40..3039cd7b06c 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -14899,6 +14899,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/inlineClasses/inlineClassWithCustomEquals.kt"); } + @TestMetadata("multifileClass.kt") + public void ignoreMultifileClass() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/multifileClass.kt"); + } + @TestMetadata("simpleSecondaryConstructor.kt") public void ignoreSimpleSecondaryConstructor() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/simpleSecondaryConstructor.kt"); @@ -15547,11 +15552,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/inlineClasses/mappingOfBoxedFlexibleInlineClassType.kt"); } - @TestMetadata("multifileClass.kt") - public void testMultifileClass() throws Exception { - runTest("compiler/testData/codegen/box/inlineClasses/multifileClass.kt"); - } - @TestMetadata("noAssertionsOnInlineClassBasedOnNullableType.kt") public void testNoAssertionsOnInlineClassBasedOnNullableType() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/noAssertionsOnInlineClassBasedOnNullableType.kt"); From b0e2d5637d4f1f8f6212cef73a13c2524d86b78e Mon Sep 17 00:00:00 2001 From: Georgy Bronnikov Date: Tue, 1 Dec 2020 18:37:55 +0300 Subject: [PATCH 358/698] Mute a test for WASM --- .../testData/codegen/box/inlineClasses/multifileClass.kt | 1 + .../test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/compiler/testData/codegen/box/inlineClasses/multifileClass.kt b/compiler/testData/codegen/box/inlineClasses/multifileClass.kt index 64cbe4f1492..d3174796a36 100644 --- a/compiler/testData/codegen/box/inlineClasses/multifileClass.kt +++ b/compiler/testData/codegen/box/inlineClasses/multifileClass.kt @@ -1,5 +1,6 @@ // WITH_RUNTIME // IGNORE_BACKEND: JVM +// DONT_TARGET_EXACT_BACKEND: WASM fun box(): String { val uia = uintArrayOf() diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index dfead9a57bf..c4bbcb442e3 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -6622,11 +6622,6 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/inlineClasses/mangledSuperCalls.kt"); } - @TestMetadata("multifileClass.kt") - public void testMultifileClass() throws Exception { - runTest("compiler/testData/codegen/box/inlineClasses/multifileClass.kt"); - } - @TestMetadata("noAssertionsOnInlineClassBasedOnNullableType.kt") public void testNoAssertionsOnInlineClassBasedOnNullableType() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/noAssertionsOnInlineClassBasedOnNullableType.kt"); From 4c3ffc3451599c59bfc4bf3514758767622ef363 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Tue, 1 Dec 2020 09:00:46 +0300 Subject: [PATCH 359/698] JVM_IR KT-41911 process big arity 'invoke' arguments recursively --- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 +++++ .../jvm/lower/FunctionNVarargBridgeLowering.kt | 9 +++++++-- .../bigArity/nestedBigArityFunCalls.kt | 17 +++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 5 +++++ .../codegen/LightAnalysisModeTestGenerated.java | 5 +++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 5 +++++ .../IrJsCodegenBoxES6TestGenerated.java | 5 +++++ .../semantics/IrJsCodegenBoxTestGenerated.java | 5 +++++ .../semantics/JsCodegenBoxTestGenerated.java | 5 +++++ .../IrCodegenBoxWasmTestGenerated.java | 5 +++++ 10 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 compiler/testData/codegen/box/functions/bigArity/nestedBigArityFunCalls.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 00c8cbf43b3..3c42afe85b9 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -12572,6 +12572,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/functions/bigArity/javaLambda.kt"); } + @TestMetadata("nestedBigArityFunCalls.kt") + public void testNestedBigArityFunCalls() throws Exception { + runTest("compiler/testData/codegen/box/functions/bigArity/nestedBigArityFunCalls.kt"); + } + @TestMetadata("subclass.kt") public void testSubclass() throws Exception { runTest("compiler/testData/codegen/box/functions/bigArity/subclass.kt"); diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionNVarargBridgeLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionNVarargBridgeLowering.kt index d03fdd42e89..9c578f8d80b 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionNVarargBridgeLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionNVarargBridgeLowering.kt @@ -57,16 +57,21 @@ private class FunctionNVarargBridgeLowering(val context: JvmBackendContext) : at(expression) irCall(functionNInvokeFun).apply { dispatchReceiver = irImplicitCast( - expression.dispatchReceiver!!, + expression.dispatchReceiver!!.transformVoid(), this@FunctionNVarargBridgeLowering.context.ir.symbols.functionN.defaultType ) putValueArgument(0, irArray(irSymbols.array.typeWith(context.irBuiltIns.anyNType)) { - (0 until expression.valueArgumentsCount).forEach { +expression.getValueArgument(it)!! } + (0 until expression.valueArgumentsCount).forEach { + +expression.getValueArgument(it)!!.transformVoid() + } }) } } } + private fun IrExpression.transformVoid() = + transform(this@FunctionNVarargBridgeLowering, null) + override fun visitClassNew(declaration: IrClass): IrStatement { val bigArityFunctionSuperTypes = declaration.superTypes.filterIsInstance().filter { it.isFunctionType && it.arguments.size > BuiltInFunctionArity.BIG_ARITY diff --git a/compiler/testData/codegen/box/functions/bigArity/nestedBigArityFunCalls.kt b/compiler/testData/codegen/box/functions/bigArity/nestedBigArityFunCalls.kt new file mode 100644 index 00000000000..7a80c893d32 --- /dev/null +++ b/compiler/testData/codegen/box/functions/bigArity/nestedBigArityFunCalls.kt @@ -0,0 +1,17 @@ +interface A +object O : A + +typealias F = (A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, T) -> String + +fun test(f: F>): String = + f(O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O) { + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, s -> + s + } + +fun box(): String { + return test { + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, f -> + f(O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, "OK") + } +} \ No newline at end of file diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 888309c1ff4..42fc63227c8 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -13972,6 +13972,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/functions/bigArity/javaLambda.kt"); } + @TestMetadata("nestedBigArityFunCalls.kt") + public void testNestedBigArityFunCalls() throws Exception { + runTest("compiler/testData/codegen/box/functions/bigArity/nestedBigArityFunCalls.kt"); + } + @TestMetadata("subclass.kt") public void testSubclass() throws Exception { runTest("compiler/testData/codegen/box/functions/bigArity/subclass.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 3039cd7b06c..9ae4d250d51 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -13972,6 +13972,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/functions/bigArity/javaLambda.kt"); } + @TestMetadata("nestedBigArityFunCalls.kt") + public void testNestedBigArityFunCalls() throws Exception { + runTest("compiler/testData/codegen/box/functions/bigArity/nestedBigArityFunCalls.kt"); + } + @TestMetadata("subclass.kt") public void testSubclass() throws Exception { runTest("compiler/testData/codegen/box/functions/bigArity/subclass.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index a3c67a07899..0504e65b75f 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -12572,6 +12572,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/functions/bigArity/javaLambda.kt"); } + @TestMetadata("nestedBigArityFunCalls.kt") + public void testNestedBigArityFunCalls() throws Exception { + runTest("compiler/testData/codegen/box/functions/bigArity/nestedBigArityFunCalls.kt"); + } + @TestMetadata("subclass.kt") public void testSubclass() throws Exception { runTest("compiler/testData/codegen/box/functions/bigArity/subclass.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index de260ede93e..d59779ba6cb 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -10787,6 +10787,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/functions/bigArity/invokeMemberCallableReference.kt"); } + @TestMetadata("nestedBigArityFunCalls.kt") + public void testNestedBigArityFunCalls() throws Exception { + runTest("compiler/testData/codegen/box/functions/bigArity/nestedBigArityFunCalls.kt"); + } + @TestMetadata("subclass.kt") public void testSubclass() throws Exception { runTest("compiler/testData/codegen/box/functions/bigArity/subclass.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 479f513a644..13393d52079 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -10787,6 +10787,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/functions/bigArity/invokeMemberCallableReference.kt"); } + @TestMetadata("nestedBigArityFunCalls.kt") + public void testNestedBigArityFunCalls() throws Exception { + runTest("compiler/testData/codegen/box/functions/bigArity/nestedBigArityFunCalls.kt"); + } + @TestMetadata("subclass.kt") public void testSubclass() throws Exception { runTest("compiler/testData/codegen/box/functions/bigArity/subclass.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 6dbc6998acc..d2a6e694242 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -10787,6 +10787,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/functions/bigArity/invokeMemberCallableReference.kt"); } + @TestMetadata("nestedBigArityFunCalls.kt") + public void testNestedBigArityFunCalls() throws Exception { + runTest("compiler/testData/codegen/box/functions/bigArity/nestedBigArityFunCalls.kt"); + } + @TestMetadata("subclass.kt") public void testSubclass() throws Exception { runTest("compiler/testData/codegen/box/functions/bigArity/subclass.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index c4bbcb442e3..e95c41dfedd 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -5461,6 +5461,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest public void testAllFilesPresentInBigArity() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/functions/bigArity"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); } + + @TestMetadata("nestedBigArityFunCalls.kt") + public void testNestedBigArityFunCalls() throws Exception { + runTest("compiler/testData/codegen/box/functions/bigArity/nestedBigArityFunCalls.kt"); + } } @TestMetadata("compiler/testData/codegen/box/functions/functionExpression") From 85b59489319b753c09c5e728dd822e4c6b543e1c Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Tue, 1 Dec 2020 11:23:53 +0300 Subject: [PATCH 360/698] JVM_IR KT-43051 no static inline class members for default Java methods --- .../MemoizedInlineClassReplacements.kt | 15 +++- .../inlineCollection/UIntArrayWithFullJdk.kt | 12 +++ .../inlineCollection/UIntArrayWithFullJdk.txt | 57 +++++++++++++ .../UIntArrayWithFullJdk_ir.txt | 57 +++++++++++++ .../javaDefaultInterfaceMember.kt | 22 +++++ .../javaDefaultInterfaceMember.txt | 80 +++++++++++++++++++ .../codegen/BytecodeListingTestGenerated.java | 10 +++ .../ir/IrBytecodeListingTestGenerated.java | 10 +++ 8 files changed, 262 insertions(+), 1 deletion(-) create mode 100644 compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection/UIntArrayWithFullJdk.kt create mode 100644 compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection/UIntArrayWithFullJdk.txt create mode 100644 compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection/UIntArrayWithFullJdk_ir.txt create mode 100644 compiler/testData/codegen/bytecodeListing/inlineClasses/javaDefaultInterfaceMember.kt create mode 100644 compiler/testData/codegen/bytecodeListing/inlineClasses/javaDefaultInterfaceMember.txt diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/inlineclasses/MemoizedInlineClassReplacements.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/inlineclasses/MemoizedInlineClassReplacements.kt index 677b7260343..1407ef3875a 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/inlineclasses/MemoizedInlineClassReplacements.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/inlineclasses/MemoizedInlineClassReplacements.kt @@ -12,10 +12,11 @@ import org.jetbrains.kotlin.backend.common.ir.createDispatchReceiverParameter import org.jetbrains.kotlin.backend.jvm.JvmBackendContext import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin import org.jetbrains.kotlin.backend.jvm.codegen.classFileContainsMethod +import org.jetbrains.kotlin.backend.jvm.codegen.isJvmInterface +import org.jetbrains.kotlin.backend.jvm.ir.isFromJava import org.jetbrains.kotlin.backend.jvm.ir.isStaticInlineClassReplacement import org.jetbrains.kotlin.backend.jvm.lower.inlineclasses.InlineClassAbi.mangledNameFor import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper -import org.jetbrains.kotlin.config.JVMConfigurationKeys import org.jetbrains.kotlin.descriptors.DescriptorVisibilities import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.ir.builders.declarations.addValueParameter @@ -70,6 +71,8 @@ class MemoizedInlineClassReplacements( when { it.isRemoveAtSpecialBuiltinStub() -> null + it.isInlineClassMemberFakeOverriddenFromDefaultJavaInterfaceMethod() -> + null it.origin == IrDeclarationOrigin.IR_BUILTINS_STUB -> createMethodReplacement(it) else -> @@ -94,6 +97,16 @@ class MemoizedInlineClassReplacements( valueParameters.size == 1 && valueParameters[0].type.isInt() + private fun IrFunction.isInlineClassMemberFakeOverriddenFromDefaultJavaInterfaceMethod(): Boolean { + if (this !is IrSimpleFunction) return false + if (!this.isFakeOverride) return false + val parentClass = parentClassOrNull ?: return false + if (!parentClass.isInline) return false + + val overridden = resolveFakeOverride() ?: return false + return overridden.isFromJava() && overridden.modality != Modality.ABSTRACT && overridden.parentAsClass.isJvmInterface + } + /** * Get the box function for an inline class. Concretely, this is a synthetic * static function named "box-impl" which takes an unboxed value and returns diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection/UIntArrayWithFullJdk.kt b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection/UIntArrayWithFullJdk.kt new file mode 100644 index 00000000000..db0ce1f7989 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection/UIntArrayWithFullJdk.kt @@ -0,0 +1,12 @@ +// FULL_JDK + +inline class UInt(val x: Int) + +inline class UIntArray(private val storage: IntArray) : Collection { + public override val size: Int get() = storage.size + + override operator fun iterator() = TODO() + override fun contains(element: UInt): Boolean = TODO() + override fun containsAll(elements: Collection): Boolean = TODO() + override fun isEmpty(): Boolean = TODO() +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection/UIntArrayWithFullJdk.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection/UIntArrayWithFullJdk.txt new file mode 100644 index 00000000000..891268caf28 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection/UIntArrayWithFullJdk.txt @@ -0,0 +1,57 @@ +@kotlin.Metadata +public final class UInt { + // source: 'UIntArrayWithFullJdk.kt' + private final field x: int + private synthetic method (p0: int): void + public synthetic final static method box-impl(p0: int): UInt + public static method constructor-impl(p0: int): int + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: int, p1: java.lang.Object): boolean + public final static method equals-impl0(p0: int, p1: int): boolean + public final method getX(): int + public method hashCode(): int + public static method hashCode-impl(p0: int): int + public method toString(): java.lang.String + public static method toString-impl(p0: int): java.lang.String + public synthetic final method unbox-impl(): int +} + +@kotlin.Metadata +public final class UIntArray { + // source: 'UIntArrayWithFullJdk.kt' + private final field storage: int[] + private synthetic method (p0: int[]): void + public synthetic method add(p0: java.lang.Object): boolean + public method add-fLmw4x8(p0: int): boolean + public method addAll(p0: java.util.Collection): boolean + public synthetic final static method box-impl(p0: int[]): UIntArray + public method clear(): void + public static @org.jetbrains.annotations.NotNull method constructor-impl(@org.jetbrains.annotations.NotNull p0: int[]): int[] + public bridge final method contains(p0: java.lang.Object): boolean + public method contains-fLmw4x8(p0: int): boolean + public static method contains-fLmw4x8(p0: int[], p1: int): boolean + public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public static method containsAll-impl(p0: int[], @org.jetbrains.annotations.NotNull p1: java.util.Collection): boolean + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: int[], p1: java.lang.Object): boolean + public final static method equals-impl0(p0: int[], p1: int[]): boolean + public method getSize(): int + public static method getSize-impl(p0: int[]): int + public method hashCode(): int + public static method hashCode-impl(p0: int[]): int + public method isEmpty(): boolean + public static method isEmpty-impl(p0: int[]): boolean + public @org.jetbrains.annotations.NotNull method iterator(): java.lang.Void + public synthetic bridge method iterator(): java.util.Iterator + public static @org.jetbrains.annotations.NotNull method iterator-impl(p0: int[]): java.lang.Void + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method removeIf(p0: java.util.function.Predicate): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] + public method toString(): java.lang.String + public static method toString-impl(p0: int[]): java.lang.String + public synthetic final method unbox-impl(): int[] +} diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection/UIntArrayWithFullJdk_ir.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection/UIntArrayWithFullJdk_ir.txt new file mode 100644 index 00000000000..a455a1ff4a5 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection/UIntArrayWithFullJdk_ir.txt @@ -0,0 +1,57 @@ +@kotlin.Metadata +public final class UInt { + // source: 'UIntArrayWithFullJdk.kt' + private final field x: int + private synthetic method (p0: int): void + public synthetic final static method box-impl(p0: int): UInt + public static method constructor-impl(p0: int): int + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: int, p1: java.lang.Object): boolean + public final static method equals-impl0(p0: int, p1: int): boolean + public final method getX(): int + public method hashCode(): int + public static method hashCode-impl(p0: int): int + public method toString(): java.lang.String + public static method toString-impl(p0: int): java.lang.String + public synthetic final method unbox-impl(): int +} + +@kotlin.Metadata +public final class UIntArray { + // source: 'UIntArrayWithFullJdk.kt' + private final @org.jetbrains.annotations.NotNull field storage: int[] + private synthetic method (p0: int[]): void + public synthetic bridge method add(p0: java.lang.Object): boolean + public method add-fLmw4x8(p0: int): boolean + public method addAll(p0: java.util.Collection): boolean + public synthetic final static method box-impl(p0: int[]): UIntArray + public method clear(): void + public static @org.jetbrains.annotations.NotNull method constructor-impl(@org.jetbrains.annotations.NotNull p0: int[]): int[] + public synthetic bridge method contains(p0: java.lang.Object): boolean + public static method contains-fLmw4x8(@org.jetbrains.annotations.NotNull p0: int[], p1: int): boolean + public method contains-fLmw4x8(p0: int): boolean + public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public static method containsAll-impl(@org.jetbrains.annotations.NotNull p0: int[], @org.jetbrains.annotations.NotNull p1: java.util.Collection): boolean + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: int[], p1: java.lang.Object): boolean + public final static method equals-impl0(p0: int[], p1: int[]): boolean + public method getSize(): int + public static method getSize-impl(@org.jetbrains.annotations.NotNull p0: int[]): int + public method hashCode(): int + public static method hashCode-impl(p0: int[]): int + public method isEmpty(): boolean + public static method isEmpty-impl(@org.jetbrains.annotations.NotNull p0: int[]): boolean + public @org.jetbrains.annotations.NotNull method iterator(): java.lang.Void + public synthetic bridge method iterator(): java.util.Iterator + public static @org.jetbrains.annotations.NotNull method iterator-impl(@org.jetbrains.annotations.NotNull p0: int[]): java.lang.Void + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method removeIf(p0: java.util.function.Predicate): boolean + public method retainAll(p0: java.util.Collection): boolean + public synthetic bridge method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] + public method toString(): java.lang.String + public static method toString-impl(p0: int[]): java.lang.String + public synthetic final method unbox-impl(): int[] +} diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/javaDefaultInterfaceMember.kt b/compiler/testData/codegen/bytecodeListing/inlineClasses/javaDefaultInterfaceMember.kt new file mode 100644 index 00000000000..adf140afc0e --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/javaDefaultInterfaceMember.kt @@ -0,0 +1,22 @@ +// JVM_TARGET: 1.8 +// FILE: javaDefaultInterfaceMember.kt +interface KFoo2 : JIFoo + +interface KFooUnrelated { + fun foo() +} + +interface KFoo3 : KFoo2, KFooUnrelated { + override fun foo() {} +} + +inline class Test1(val x: Int) : JIFoo + +inline class Test2(val x: Int) : KFoo2 + +inline class Test3(val x: Int) : KFoo3 + +// FILE: JIFoo.java +public interface JIFoo { + default void foo() {} +} diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/javaDefaultInterfaceMember.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/javaDefaultInterfaceMember.txt new file mode 100644 index 00000000000..daacfa6762a --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/javaDefaultInterfaceMember.txt @@ -0,0 +1,80 @@ +@kotlin.Metadata +public interface KFoo2 { + // source: 'javaDefaultInterfaceMember.kt' +} + +@kotlin.Metadata +public final class KFoo3$DefaultImpls { + // source: 'javaDefaultInterfaceMember.kt' + public static method foo(@org.jetbrains.annotations.NotNull p0: KFoo3): void + public final inner class KFoo3$DefaultImpls +} + +@kotlin.Metadata +public interface KFoo3 { + // source: 'javaDefaultInterfaceMember.kt' + public abstract method foo(): void + public final inner class KFoo3$DefaultImpls +} + +@kotlin.Metadata +public interface KFooUnrelated { + // source: 'javaDefaultInterfaceMember.kt' + public abstract method foo(): void +} + +@kotlin.Metadata +public final class Test1 { + // source: 'javaDefaultInterfaceMember.kt' + private final field x: int + private synthetic method (p0: int): void + public synthetic final static method box-impl(p0: int): Test1 + public static method constructor-impl(p0: int): int + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: int, p1: java.lang.Object): boolean + public final static method equals-impl0(p0: int, p1: int): boolean + public final method getX(): int + public method hashCode(): int + public static method hashCode-impl(p0: int): int + public method toString(): java.lang.String + public static method toString-impl(p0: int): java.lang.String + public synthetic final method unbox-impl(): int +} + +@kotlin.Metadata +public final class Test2 { + // source: 'javaDefaultInterfaceMember.kt' + private final field x: int + private synthetic method (p0: int): void + public synthetic final static method box-impl(p0: int): Test2 + public static method constructor-impl(p0: int): int + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: int, p1: java.lang.Object): boolean + public final static method equals-impl0(p0: int, p1: int): boolean + public final method getX(): int + public method hashCode(): int + public static method hashCode-impl(p0: int): int + public method toString(): java.lang.String + public static method toString-impl(p0: int): java.lang.String + public synthetic final method unbox-impl(): int +} + +@kotlin.Metadata +public final class Test3 { + // source: 'javaDefaultInterfaceMember.kt' + private final field x: int + private synthetic method (p0: int): void + public synthetic final static method box-impl(p0: int): Test3 + public static method constructor-impl(p0: int): int + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: int, p1: java.lang.Object): boolean + public final static method equals-impl0(p0: int, p1: int): boolean + public method foo(): void + public static method foo-impl(p0: int): void + public final method getX(): int + public method hashCode(): int + public static method hashCode-impl(p0: int): int + public method toString(): java.lang.String + public static method toString-impl(p0: int): java.lang.String + public synthetic final method unbox-impl(): int +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index 1a8ec1ca579..420cb96aec1 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -982,6 +982,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassWithManyKindsOfMembers.kt"); } + @TestMetadata("javaDefaultInterfaceMember.kt") + public void testJavaDefaultInterfaceMember() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/javaDefaultInterfaceMember.kt"); + } + @TestMetadata("jvmName.kt") public void testJvmName() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/jvmName.kt"); @@ -1123,6 +1128,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { public void testSet() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection/set.kt"); } + + @TestMetadata("UIntArrayWithFullJdk.kt") + public void testUIntArrayWithFullJdk() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection/UIntArrayWithFullJdk.kt"); + } } @TestMetadata("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollectionOfInlineClass") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index 51cdf696c7d..fd3bfb6d9ca 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -952,6 +952,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassWithManyKindsOfMembers.kt"); } + @TestMetadata("javaDefaultInterfaceMember.kt") + public void testJavaDefaultInterfaceMember() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/javaDefaultInterfaceMember.kt"); + } + @TestMetadata("jvmName.kt") public void testJvmName() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/jvmName.kt"); @@ -1093,6 +1098,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes public void testSet() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection/set.kt"); } + + @TestMetadata("UIntArrayWithFullJdk.kt") + public void testUIntArrayWithFullJdk() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection/UIntArrayWithFullJdk.kt"); + } } @TestMetadata("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollectionOfInlineClass") From 2b4564059e0e6d8a7009f3ab3175dcdd071722ed Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Tue, 1 Dec 2020 12:03:39 +0300 Subject: [PATCH 361/698] JVM_IR KT-43459 fix $annotations method receiver type --- .../jvm/lower/JvmPropertiesLowering.kt | 9 ++++++-- .../bytecodeListing/annotations/kt43459.kt | 10 +++++++++ .../bytecodeListing/annotations/kt43459.txt | 21 +++++++++++++++++++ .../codegen/BytecodeListingTestGenerated.java | 5 +++++ .../ir/IrBytecodeListingTestGenerated.java | 5 +++++ 5 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 compiler/testData/codegen/bytecodeListing/annotations/kt43459.kt create mode 100644 compiler/testData/codegen/bytecodeListing/annotations/kt43459.txt diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmPropertiesLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmPropertiesLowering.kt index 9152e42547a..b5af34c168c 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmPropertiesLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmPropertiesLowering.kt @@ -152,8 +152,10 @@ class JvmPropertiesLowering(private val backendContext: JvmBackendContext) : IrE private fun IrType.erasePropertyAnnotationsExtensionReceiverType(): IrType { // Use raw type of extension receiver to avoid generic signature, // which should not be generated for '...$annotations' method. - val classifier = classifierOrFail - return if (this is IrSimpleType && isArray()) { + if (this !is IrSimpleType) { + throw AssertionError("Unexpected property receiver type: $this") + } + val erasedType = if (isArray()) { when (val arg0 = arguments[0]) { is IrStarProjection -> { // 'Array<*>' becomes 'Array<*>' @@ -171,6 +173,9 @@ class JvmPropertiesLowering(private val backendContext: JvmBackendContext) : IrE } else { classifier.typeWith() } + return erasedType + .withHasQuestionMark(this.hasQuestionMark) + .addAnnotations(this.annotations) } private fun computeSyntheticMethodName(property: IrProperty): String { diff --git a/compiler/testData/codegen/bytecodeListing/annotations/kt43459.kt b/compiler/testData/codegen/bytecodeListing/annotations/kt43459.kt new file mode 100644 index 00000000000..fe074a4e3ea --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/annotations/kt43459.kt @@ -0,0 +1,10 @@ +annotation class Anno + +@Target(AnnotationTarget.TYPE) +annotation class TypeAnno + +class A { + @Anno + val @TypeAnno Int?.a: String + get() = "" +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/annotations/kt43459.txt b/compiler/testData/codegen/bytecodeListing/annotations/kt43459.txt new file mode 100644 index 00000000000..74b6984e128 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/annotations/kt43459.txt @@ -0,0 +1,21 @@ +@kotlin.Metadata +public final class A { + // source: 'kt43459.kt' + public method (): void + public synthetic deprecated static @Anno method getA$annotations(p0: java.lang.Integer): void + public final @org.jetbrains.annotations.NotNull method getA(@org.jetbrains.annotations.Nullable p0: java.lang.Integer): java.lang.String +} + +@java.lang.annotation.Retention +@kotlin.Metadata +public annotation class Anno { + // source: 'kt43459.kt' +} + +@kotlin.annotation.Target +@java.lang.annotation.Retention +@java.lang.annotation.Target +@kotlin.Metadata +public annotation class TypeAnno { + // source: 'kt43459.kt' +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index 420cb96aec1..77db5a0f348 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -246,6 +246,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/annotations/kt43399.kt"); } + @TestMetadata("kt43459.kt") + public void testKt43459() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/annotations/kt43459.kt"); + } + @TestMetadata("kt9320.kt") public void testKt9320() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/annotations/kt9320.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index fd3bfb6d9ca..aacd9cf3344 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -246,6 +246,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/annotations/kt43399.kt"); } + @TestMetadata("kt43459.kt") + public void testKt43459() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/annotations/kt43459.kt"); + } + @TestMetadata("kt9320.kt") public void testKt9320() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/annotations/kt9320.kt"); From e96fc74ffa444eacf2347b66ed1a23f80f97b3bf Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Tue, 1 Dec 2020 12:40:03 +0300 Subject: [PATCH 362/698] JVM_IR KT-43519 no delegates for external funs in multifile facades Also add ABI tests for @JvmStatic/JvmOverloads + 'external'. --- .../jvm/lower/GenerateMultifileFacades.kt | 3 +++ .../bytecodeListing/jvmOverloadsExternal.kt | 4 +++ .../bytecodeListing/jvmOverloadsExternal.txt | 7 +++++ .../bytecodeListing/jvmStaticExternal.kt | 14 ++++++++++ .../bytecodeListing/jvmStaticExternal.txt | 27 +++++++++++++++++++ .../codegen/bytecodeListing/kt43519.kt | 5 ++++ .../codegen/bytecodeListing/kt43519.txt | 10 +++++++ .../codegen/BytecodeListingTestGenerated.java | 15 +++++++++++ .../ir/IrBytecodeListingTestGenerated.java | 15 +++++++++++ 9 files changed, 100 insertions(+) create mode 100644 compiler/testData/codegen/bytecodeListing/jvmOverloadsExternal.kt create mode 100644 compiler/testData/codegen/bytecodeListing/jvmOverloadsExternal.txt create mode 100644 compiler/testData/codegen/bytecodeListing/jvmStaticExternal.kt create mode 100644 compiler/testData/codegen/bytecodeListing/jvmStaticExternal.txt create mode 100644 compiler/testData/codegen/bytecodeListing/kt43519.kt create mode 100644 compiler/testData/codegen/bytecodeListing/kt43519.txt diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/GenerateMultifileFacades.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/GenerateMultifileFacades.kt index cab6684f634..70c09b607ae 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/GenerateMultifileFacades.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/GenerateMultifileFacades.kt @@ -145,6 +145,9 @@ private fun generateMultifileFacades( for (member in partClass.declarations) { if (member !is IrSimpleFunction) continue + // KT-43519 Don't generate delegates for external methods + if (member.isExternal) continue + val correspondingProperty = member.correspondingPropertySymbol?.owner if (member.hasAnnotation(INLINE_ONLY_ANNOTATION_FQ_NAME) || correspondingProperty?.hasAnnotation(INLINE_ONLY_ANNOTATION_FQ_NAME) == true diff --git a/compiler/testData/codegen/bytecodeListing/jvmOverloadsExternal.kt b/compiler/testData/codegen/bytecodeListing/jvmOverloadsExternal.kt new file mode 100644 index 00000000000..105182652f1 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/jvmOverloadsExternal.kt @@ -0,0 +1,4 @@ +// WITH_RUNTIME + +@JvmOverloads +external fun foo(x: Int = 42) \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/jvmOverloadsExternal.txt b/compiler/testData/codegen/bytecodeListing/jvmOverloadsExternal.txt new file mode 100644 index 00000000000..9e296bb4516 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/jvmOverloadsExternal.txt @@ -0,0 +1,7 @@ +@kotlin.Metadata +public final class JvmOverloadsExternalKt { + // source: 'jvmOverloadsExternal.kt' + public synthetic static method foo$default(p0: int, p1: int, p2: java.lang.Object): void + public final static @kotlin.jvm.JvmOverloads method foo(): void + public native final static @kotlin.jvm.JvmOverloads method foo(p0: int): void +} diff --git a/compiler/testData/codegen/bytecodeListing/jvmStaticExternal.kt b/compiler/testData/codegen/bytecodeListing/jvmStaticExternal.kt new file mode 100644 index 00000000000..298afa2de27 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/jvmStaticExternal.kt @@ -0,0 +1,14 @@ +// WITH_RUNTIME +// JVM_TARGET: 1.8 + +object TestObject { + @JvmStatic + external fun foo() +} + +class TestClassCompanion { + companion object { + @JvmStatic + external fun foo() + } +} diff --git a/compiler/testData/codegen/bytecodeListing/jvmStaticExternal.txt b/compiler/testData/codegen/bytecodeListing/jvmStaticExternal.txt new file mode 100644 index 00000000000..98fbff61b2e --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/jvmStaticExternal.txt @@ -0,0 +1,27 @@ +@kotlin.Metadata +public final class TestClassCompanion$Companion { + // source: 'jvmStaticExternal.kt' + private method (): void + public synthetic method (p0: kotlin.jvm.internal.DefaultConstructorMarker): void + public final @kotlin.jvm.JvmStatic method foo(): void + public final inner class TestClassCompanion$Companion +} + +@kotlin.Metadata +public final class TestClassCompanion { + // source: 'jvmStaticExternal.kt' + public final static @org.jetbrains.annotations.NotNull field Companion: TestClassCompanion$Companion + static method (): void + public method (): void + public native final static @kotlin.jvm.JvmStatic method foo(): void + public final inner class TestClassCompanion$Companion +} + +@kotlin.Metadata +public final class TestObject { + // source: 'jvmStaticExternal.kt' + public final static @org.jetbrains.annotations.NotNull field INSTANCE: TestObject + static method (): void + private method (): void + public native final static @kotlin.jvm.JvmStatic method foo(): void +} diff --git a/compiler/testData/codegen/bytecodeListing/kt43519.kt b/compiler/testData/codegen/bytecodeListing/kt43519.kt new file mode 100644 index 00000000000..ffe9d17f0c0 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/kt43519.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME +@file:JvmMultifileClass() +@file:JvmName("a") + +external fun externalFun(): Long \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/kt43519.txt b/compiler/testData/codegen/bytecodeListing/kt43519.txt new file mode 100644 index 00000000000..75df6902263 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/kt43519.txt @@ -0,0 +1,10 @@ +@kotlin.Metadata +public final class a { + // source: 'kt43519.kt' +} + +@kotlin.Metadata +synthetic final class a__Kt43519Kt { + // source: 'kt43519.kt' + public native final static method externalFun(): long +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index 77db5a0f348..c51b8439e0a 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -99,6 +99,16 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/jvmOverloadsAndParametersAnnotations.kt"); } + @TestMetadata("jvmOverloadsExternal.kt") + public void testJvmOverloadsExternal() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/jvmOverloadsExternal.kt"); + } + + @TestMetadata("jvmStaticExternal.kt") + public void testJvmStaticExternal() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/jvmStaticExternal.kt"); + } + @TestMetadata("jvmStaticWithDefaultParameters.kt") public void testJvmStaticWithDefaultParameters() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/jvmStaticWithDefaultParameters.kt"); @@ -124,6 +134,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/kt43440.kt"); } + @TestMetadata("kt43519.kt") + public void testKt43519() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/kt43519.kt"); + } + @TestMetadata("localFunctionInInitBlock.kt") public void testLocalFunctionInInitBlock() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/localFunctionInInitBlock.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index aacd9cf3344..e2bdfb7564b 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -99,6 +99,16 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/jvmOverloadsAndParametersAnnotations.kt"); } + @TestMetadata("jvmOverloadsExternal.kt") + public void testJvmOverloadsExternal() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/jvmOverloadsExternal.kt"); + } + + @TestMetadata("jvmStaticExternal.kt") + public void testJvmStaticExternal() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/jvmStaticExternal.kt"); + } + @TestMetadata("jvmStaticWithDefaultParameters.kt") public void testJvmStaticWithDefaultParameters() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/jvmStaticWithDefaultParameters.kt"); @@ -124,6 +134,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/kt43440.kt"); } + @TestMetadata("kt43519.kt") + public void testKt43519() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/kt43519.kt"); + } + @TestMetadata("localFunctionInInitBlock.kt") public void testLocalFunctionInInitBlock() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/localFunctionInInitBlock.kt"); From 1412ee96f89f3f3faaf7581d9eeca407d0885b46 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Tue, 1 Dec 2020 13:02:42 +0300 Subject: [PATCH 363/698] JVM_IR KT-43524 static wrappers for deprecated accessors are deprecated --- .../backend/jvm/codegen/irCodegenUtils.kt | 17 +++++- .../deprecated/jvmStaticDeprecatedProperty.kt | 24 +++++++++ .../jvmStaticDeprecatedProperty.txt | 53 +++++++++++++++++++ .../codegen/BytecodeListingTestGenerated.java | 5 ++ .../ir/IrBytecodeListingTestGenerated.java | 5 ++ 5 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 compiler/testData/codegen/bytecodeListing/deprecated/jvmStaticDeprecatedProperty.kt create mode 100644 compiler/testData/codegen/bytecodeListing/deprecated/jvmStaticDeprecatedProperty.txt diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt index 6789e9a5fae..31eca3332a6 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt @@ -24,6 +24,8 @@ import org.jetbrains.kotlin.codegen.signature.BothSignatureWriter import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI import org.jetbrains.kotlin.ir.declarations.* +import org.jetbrains.kotlin.ir.expressions.IrCall +import org.jetbrains.kotlin.ir.expressions.IrExpressionBody import org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.ir.symbols.IrSymbol @@ -356,7 +358,8 @@ val IrFunction.isSyntheticMethodForProperty: Boolean val IrFunction.isDeprecatedFunction: Boolean get() = isSyntheticMethodForProperty || isDeprecatedCallable || (this as? IrSimpleFunction)?.correspondingPropertySymbol?.owner?.isDeprecatedCallable == true || - isAccessorForDeprecatedPropertyImplementedByDelegation + isAccessorForDeprecatedPropertyImplementedByDelegation || + isAccessorForDeprecatedJvmStaticProperty private val IrFunction.isAccessorForDeprecatedPropertyImplementedByDelegation: Boolean get() = @@ -367,6 +370,18 @@ private val IrFunction.isAccessorForDeprecatedPropertyImplementedByDelegation: B it.owner.correspondingPropertySymbol?.owner?.isDeprecatedCallable == true } +private val IrFunction.isAccessorForDeprecatedJvmStaticProperty: Boolean + get() { + if (origin != JvmLoweredDeclarationOrigin.JVM_STATIC_WRAPPER) return false + val irExpressionBody = this.body as? IrExpressionBody + ?: throw AssertionError("IrExpressionBody expected for JvmStatic wrapper:\n${this.dump()}") + val irCall = irExpressionBody.expression as? IrCall + ?: throw AssertionError("IrCall expected inside JvmStatic wrapper:\n${this.dump()}") + val callee = irCall.symbol.owner + val property = callee.correspondingPropertySymbol?.owner ?: return false + return property.isDeprecatedCallable + } + @OptIn(ObsoleteDescriptorBasedAPI::class) val IrDeclaration.psiElement: PsiElement? get() = (descriptor as? DeclarationDescriptorWithSource)?.psiElement diff --git a/compiler/testData/codegen/bytecodeListing/deprecated/jvmStaticDeprecatedProperty.kt b/compiler/testData/codegen/bytecodeListing/deprecated/jvmStaticDeprecatedProperty.kt new file mode 100644 index 00000000000..cacca53f982 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/deprecated/jvmStaticDeprecatedProperty.kt @@ -0,0 +1,24 @@ +// WITH_RUNTIME +// JVM_TARGET: 1.8 + +class TestClass { + companion object { + @Deprecated("") + @JvmStatic + val a: Int = 1 + } +} + +object TestObject { + @Deprecated("") + @JvmStatic + val a: Int = 1 +} + +interface TestInterface { + companion object { + @Deprecated("") + @JvmStatic + val a: Int = 1 + } +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/deprecated/jvmStaticDeprecatedProperty.txt b/compiler/testData/codegen/bytecodeListing/deprecated/jvmStaticDeprecatedProperty.txt new file mode 100644 index 00000000000..81a84474400 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/deprecated/jvmStaticDeprecatedProperty.txt @@ -0,0 +1,53 @@ +@kotlin.Metadata +public final class TestClass$Companion { + // source: 'jvmStaticDeprecatedProperty.kt' + private method (): void + public synthetic method (p0: kotlin.jvm.internal.DefaultConstructorMarker): void + public synthetic deprecated static @kotlin.Deprecated @kotlin.jvm.JvmStatic method getA$annotations(): void + public deprecated final method getA(): int + public final inner class TestClass$Companion +} + +@kotlin.Metadata +public final class TestClass { + // source: 'jvmStaticDeprecatedProperty.kt' + public final static @org.jetbrains.annotations.NotNull field Companion: TestClass$Companion + private deprecated final static field a: int + static method (): void + public method (): void + public synthetic final static method access$getA$cp(): int + public deprecated final static method getA(): int + public final inner class TestClass$Companion +} + +@kotlin.Metadata +public final class TestInterface$Companion { + // source: 'jvmStaticDeprecatedProperty.kt' + synthetic final static field $$INSTANCE: TestInterface$Companion + private deprecated final static field a: int + static method (): void + private method (): void + public synthetic deprecated static @kotlin.Deprecated @kotlin.jvm.JvmStatic method getA$annotations(): void + public deprecated final method getA(): int + public final inner class TestInterface$Companion +} + +@kotlin.Metadata +public interface TestInterface { + // source: 'jvmStaticDeprecatedProperty.kt' + public final static @org.jetbrains.annotations.NotNull field Companion: TestInterface$Companion + static method (): void + public deprecated static method getA(): int + public final inner class TestInterface$Companion +} + +@kotlin.Metadata +public final class TestObject { + // source: 'jvmStaticDeprecatedProperty.kt' + public final static @org.jetbrains.annotations.NotNull field INSTANCE: TestObject + private deprecated final static field a: int + static method (): void + private method (): void + public synthetic deprecated static @kotlin.Deprecated @kotlin.jvm.JvmStatic method getA$annotations(): void + public deprecated final static method getA(): int +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index c51b8439e0a..5fb50b0a9bd 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -827,6 +827,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { public void testInlineClassTypesInSignature() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/deprecated/inlineClassTypesInSignature.kt"); } + + @TestMetadata("jvmStaticDeprecatedProperty.kt") + public void testJvmStaticDeprecatedProperty() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/deprecated/jvmStaticDeprecatedProperty.kt"); + } } @TestMetadata("compiler/testData/codegen/bytecodeListing/inline") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index e2bdfb7564b..aad039f8b44 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -797,6 +797,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes public void testInlineClassTypesInSignature() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/deprecated/inlineClassTypesInSignature.kt"); } + + @TestMetadata("jvmStaticDeprecatedProperty.kt") + public void testJvmStaticDeprecatedProperty() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/deprecated/jvmStaticDeprecatedProperty.kt"); + } } @TestMetadata("compiler/testData/codegen/bytecodeListing/inline") From ae8abd1832766656104cfd6228e278f77639854c Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Tue, 1 Dec 2020 18:12:32 +0300 Subject: [PATCH 364/698] Minor: ignore nestedBigArityFunCalls.kt in WASM --- .../codegen/box/functions/bigArity/nestedBigArityFunCalls.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/testData/codegen/box/functions/bigArity/nestedBigArityFunCalls.kt b/compiler/testData/codegen/box/functions/bigArity/nestedBigArityFunCalls.kt index 7a80c893d32..e0c8a1a8568 100644 --- a/compiler/testData/codegen/box/functions/bigArity/nestedBigArityFunCalls.kt +++ b/compiler/testData/codegen/box/functions/bigArity/nestedBigArityFunCalls.kt @@ -1,3 +1,5 @@ +// DONT_TARGET_EXACT_BACKEND: WASM +// WASM_MUTE_REASON: BIG_ARITY interface A object O : A From 129de76288fe31c0eafb71888077bd0250062ab0 Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Thu, 19 Nov 2020 22:00:27 +0100 Subject: [PATCH 365/698] Value classes: Generate @JvmInline annotation for inline classes but not for value classes. Since inline classes and value classes share the same flag, we use presence of the annotation to distinguish them. --- .../codegen/ErasedInlineClassBodyCodegen.kt | 8 + ...enConstructorWithInlineClassParameters.txt | 3 +- ...dApiAnnotationOnInlineClassCosntructor.txt | 3 +- .../kotlin/backend/jvm/JvmSymbols.kt | 9 + .../jvm/lower/JvmInlineClassLowering.kt | 16 +- .../serialization/DescriptorSerializer.kt | 4 +- ...PropertyWithInlineClassTypeInSignature.txt | 1 + .../annotationsOnHiddenConstructor.txt | 1 + .../companionObjectInsideInlineClass.txt | 1 + .../computablePropertiesInsideInlineClass.txt | 1 + .../inlineClasses/constructor.txt | 8 + ...constructorsWithDefaultParameterValues.txt | 1 + .../defaultInterfaceMethodsInInlineClass.txt | 1 + .../inlineClasses/inlineCharSequence.txt | 1 + .../inlineClasses/inlineCharSequence_ir.txt | 1 + .../inlineClassMembersVisibility.txt | 1 + ...inlineClassTypeParametersInConstructor.txt | 1 + ...lineClassWithInlineClassUnderlyingType.txt | 2 + .../inlineClassWithManyKindsOfMembers.txt | 1 + .../inlineCollection/UIntArrayWithFullJdk.txt | 2 + .../UIntArrayWithFullJdk_ir.txt | 2 + .../javaDefaultInterfaceMember.txt | 3 + .../bytecodeListing/inlineClasses/jvmName.txt | 1 + ...LevelFunctionReturningInlineClassValue.txt | 1 + .../inlineClasses/memberExtensionProperty.txt | 3 + ...oArgConstructorForInlineClassParameter.txt | 1 + .../noBridgesForErasedInlineClass.txt | 1 + .../inlineClasses/nullabilityInExpansion.txt | 14 + .../nullableAndNotNullPrimitive.txt | 1 + ...ericMethodWithInlineClassParameterType.txt | 2 + ...GenericMethodWithInlineClassReturnType.txt | 1 + .../primaryValsWithDifferentVisibilities.txt | 4 + ...dApiAnnotationOnInlineClassConstructor.txt | 1 + .../shapeOfInlineClassWithPrimitive.txt | 1 + .../stdlibManglingIn1430/new.txt | 1 + .../stdlibManglingIn1430/old.txt | 1 + .../codegen/bytecodeListing/kt42879.txt | 1 + .../InlineIntOverridesObject.txt | 2 +- .../basicValueClassDeclaration.fir.kt | 2 +- .../basicValueClassDeclaration.kt | 2 +- .../basicValueClassDeclaration.txt | 91 +++--- .../basicValueClassDeclarationDisabled.fir.kt | 2 +- .../basicValueClassDeclarationDisabled.kt | 2 +- .../basicValueClassDeclarationDisabled.txt | 93 +++--- .../constructorsJvmSignaturesClash.fir.kt | 2 +- .../constructorsJvmSignaturesClash.kt | 2 +- .../constructorsJvmSignaturesClash.txt | 95 +++--- .../delegatedPropertyInValueClass.fir.kt | 2 +- .../delegatedPropertyInValueClass.kt | 2 +- .../delegatedPropertyInValueClass.txt | 95 +++--- .../functionsJvmSignaturesClash.fir.kt | 2 +- .../functionsJvmSignaturesClash.kt | 2 +- .../functionsJvmSignaturesClash.txt | 133 ++++---- ...tionsJvmSignaturesConflictOnInheritance.kt | 2 +- ...ionsJvmSignaturesConflictOnInheritance.txt | 79 ++--- .../identityComparisonWithValueClasses.fir.kt | 2 +- .../identityComparisonWithValueClasses.kt | 2 +- .../identityComparisonWithValueClasses.txt | 43 +-- .../jvmInlineApplicability.fir.kt | 2 +- .../valueClasses/jvmInlineApplicability.kt | 2 +- .../valueClasses/jvmInlineApplicability.txt | 93 +++--- .../valueClasses/lateinitValueClasses.fir.kt | 2 +- .../valueClasses/lateinitValueClasses.kt | 2 +- .../valueClasses/lateinitValueClasses.txt | 31 +- ...senceOfInitializerBlockInsideValueClass.kt | 2 +- ...enceOfInitializerBlockInsideValueClass.txt | 27 +- ...OfPublicPrimaryConstructorForValueClass.kt | 2 +- ...fPublicPrimaryConstructorForValueClass.txt | 83 ++--- ...esWithBackingFieldsInsideValueClass.fir.kt | 2 +- ...ertiesWithBackingFieldsInsideValueClass.kt | 2 +- ...rtiesWithBackingFieldsInsideValueClass.txt | 65 ++-- .../valueClasses/recursiveValueClasses.fir.kt | 2 +- .../valueClasses/recursiveValueClasses.kt | 2 +- .../valueClasses/recursiveValueClasses.txt | 181 +++++------ ...embersAndConstructsInsideValueClass.fir.kt | 2 +- ...vedMembersAndConstructsInsideValueClass.kt | 2 +- ...edMembersAndConstructsInsideValueClass.txt | 125 ++++---- ...alueClassCanOnlyImplementInterfaces.fir.kt | 2 +- .../valueClassCanOnlyImplementInterfaces.kt | 2 +- .../valueClassCanOnlyImplementInterfaces.txt | 89 +++--- ...annotImplementInterfaceByDelegation.fir.kt | 2 +- ...assCannotImplementInterfaceByDelegation.kt | 2 +- ...ssCannotImplementInterfaceByDelegation.txt | 63 ++-- ...assConstructorParameterWithDefaultValue.kt | 2 +- ...ssConstructorParameterWithDefaultValue.txt | 27 +- .../valueClassDeclarationCheck.fir.kt | 2 +- .../valueClassDeclarationCheck.kt | 2 +- .../valueClassDeclarationCheck.txt | 287 +++++++++--------- .../valueClassImplementsCollection.kt | 2 +- .../valueClassImplementsCollection.txt | 51 ++-- ...lueClassWithForbiddenUnderlyingType.fir.kt | 2 +- .../valueClassWithForbiddenUnderlyingType.kt | 2 +- .../valueClassWithForbiddenUnderlyingType.txt | 153 +++++----- .../valueClassesInsideAnnotations.fir.kt | 2 +- .../valueClassesInsideAnnotations.kt | 2 +- .../valueClassesInsideAnnotations.txt | 97 +++--- ...varargsOnParametersOfValueClassType.fir.kt | 2 +- .../varargsOnParametersOfValueClassType.kt | 2 +- .../varargsOnParametersOfValueClassType.txt | 75 ++--- ...enConstructorWithInlineClassParameters.txt | 2 +- ...tationOnInlineClassCosntructor.runtime.txt | 2 +- ...dApiAnnotationOnInlineClassCosntructor.txt | 2 +- .../kotlin/resolve/inlineClassesUtils.kt | 2 +- 103 files changed, 1213 insertions(+), 1056 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ErasedInlineClassBodyCodegen.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/ErasedInlineClassBodyCodegen.kt index c006510716f..bad25a8b3de 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ErasedInlineClassBodyCodegen.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ErasedInlineClassBodyCodegen.kt @@ -13,6 +13,7 @@ import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.psi.KtClass import org.jetbrains.kotlin.psi.KtClassOrObject import org.jetbrains.kotlin.resolve.InlineClassDescriptorResolver +import org.jetbrains.kotlin.resolve.JVM_INLINE_ANNOTATION_FQ_NAME import org.jetbrains.kotlin.resolve.descriptorUtil.secondaryConstructors import org.jetbrains.kotlin.resolve.jvm.AsmTypes import org.jetbrains.kotlin.resolve.jvm.diagnostics.Synthetic @@ -55,6 +56,13 @@ class ErasedInlineClassBodyCodegen( generateUnboxMethod() generateFunctionsFromAny() generateSpecializedEqualsStub() + generateJvmInlineAnnotation() + } + + private fun generateJvmInlineAnnotation() { + if (descriptor.isInline) { + v.newAnnotation(JVM_INLINE_ANNOTATION_FQ_NAME.topLevelClassAsmType().descriptor, true).visitEnd() + } } private fun generateFunctionsFromAny() { diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/classMembers/HiddenConstructorWithInlineClassParameters.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/classMembers/HiddenConstructorWithInlineClassParameters.txt index 25e45af2ad6..0abf465764c 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/classMembers/HiddenConstructorWithInlineClassParameters.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/classMembers/HiddenConstructorWithInlineClassParameters.txt @@ -28,7 +28,7 @@ public final class Test : R|kotlin/Any| { } -public final inline class Z : R|kotlin/Any| { +@R|kotlin/jvm/JvmInline|() public final inline class Z : R|kotlin/Any| { public open operator fun equals(other: R|kotlin/Any?|): R|kotlin/Boolean| public open fun hashCode(): R|kotlin/Int| @@ -41,3 +41,4 @@ public final inline class Z : R|kotlin/Any| { public constructor(x: R|kotlin/Int|): R|test/Z| } + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.txt index 01998465158..7d5c07fbbe9 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.txt @@ -1,4 +1,4 @@ -public final inline class Z : R|kotlin/Any| { +@R|kotlin/jvm/JvmInline|() public final inline class Z : R|kotlin/Any| { public open operator fun equals(other: R|kotlin/Any?|): R|kotlin/Boolean| public open fun hashCode(): R|kotlin/Int| @@ -11,3 +11,4 @@ public final inline class Z : R|kotlin/Any| { @R|kotlin/PublishedApi|() internal constructor(value: R|kotlin/Int|): R|test/Z| } + diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmSymbols.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmSymbols.kt index 9124cc6d687..2e1c2c6131b 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmSymbols.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmSymbols.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.backend.jvm import org.jetbrains.kotlin.backend.common.ir.Symbols +import org.jetbrains.kotlin.backend.common.ir.addChild import org.jetbrains.kotlin.backend.common.ir.createImplicitParameterDeclarationWithWrappedDescriptor import org.jetbrains.kotlin.backend.jvm.intrinsics.IrIntrinsicMethods import org.jetbrains.kotlin.builtins.StandardNames @@ -29,6 +30,7 @@ import org.jetbrains.kotlin.ir.types.* import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.resolve.JVM_INLINE_ANNOTATION_FQ_NAME import org.jetbrains.kotlin.resolve.jvm.JvmClassName import org.jetbrains.kotlin.storage.LockBasedStorageManager import org.jetbrains.kotlin.types.Variance @@ -73,6 +75,7 @@ class JvmSymbols( "kotlin.coroutines.jvm.internal" -> kotlinCoroutinesJvmInternalPackage "kotlin.jvm.internal" -> kotlinJvmInternalPackage "kotlin.jvm.functions" -> kotlinJvmFunctionsPackage + "kotlin.jvm" -> kotlinJvmPackage "kotlin.reflect" -> kotlinReflectPackage "java.lang" -> javaLangPackage else -> error("Other packages are not supported yet: $fqName") @@ -392,6 +395,12 @@ class JvmSymbols( } } + val jvmInlineAnnotation: IrClassSymbol = createClass(JVM_INLINE_ANNOTATION_FQ_NAME, ClassKind.ANNOTATION_CLASS).apply { + owner.addConstructor { + isPrimary = true + } + } + private data class PropertyReferenceKey( val mutable: Boolean, val parameterCount: Int, diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmInlineClassLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmInlineClassLowering.kt index 4e95b29f535..d7ce8143340 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmInlineClassLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmInlineClassLowering.kt @@ -28,10 +28,7 @@ import org.jetbrains.kotlin.ir.builders.declarations.addConstructor import org.jetbrains.kotlin.ir.builders.declarations.buildFun import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.* -import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl -import org.jetbrains.kotlin.ir.expressions.impl.IrFunctionReferenceImpl -import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl -import org.jetbrains.kotlin.ir.expressions.impl.IrSetValueImpl +import org.jetbrains.kotlin.ir.expressions.impl.* import org.jetbrains.kotlin.ir.symbols.IrValueSymbol import org.jetbrains.kotlin.ir.transformStatement import org.jetbrains.kotlin.ir.types.IrType @@ -42,6 +39,7 @@ import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid import org.jetbrains.kotlin.load.java.JvmAbi import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.resolve.JVM_INLINE_ANNOTATION_FQ_NAME import org.jetbrains.kotlin.utils.addToStdlib.safeAs val jvmInlineClassPhase = makeIrFilePhase( @@ -98,11 +96,21 @@ private class JvmInlineClassLowering(private val context: JvmBackendContext) : F buildBoxFunction(declaration) buildUnboxFunction(declaration) buildSpecializedEqualsMethod(declaration) + addJvmInlineAnnotation(declaration) } return declaration } + private fun addJvmInlineAnnotation(declaration: IrClass) { + if (declaration.hasAnnotation(JVM_INLINE_ANNOTATION_FQ_NAME)) return + val constructor = context.ir.symbols.jvmInlineAnnotation.constructors.first() + declaration.annotations = declaration.annotations + IrConstructorCallImpl.fromSymbolOwner( + constructor.owner.returnType, + constructor + ) + } + private fun transformFunctionFlat(function: IrFunction): List? { if (function.isPrimaryInlineClassConstructor) return null diff --git a/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.kt b/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.kt index 6ead2068679..f6f0b075351 100644 --- a/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.kt +++ b/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.kt @@ -66,7 +66,9 @@ class DescriptorSerializer private constructor( val builder = ProtoBuf.Class.newBuilder() val flags = Flags.getClassFlags( - hasAnnotations(classDescriptor), + // Since 1.4.30 isInline & isValue are the same flag. To distinguish them we generate @JvmInline annotation. + // See ClassDescriptor.isInlineClass() function. + hasAnnotations(classDescriptor) || classDescriptor.isInline, ProtoEnumFlags.descriptorVisibility(normalizeVisibility(classDescriptor)), ProtoEnumFlags.modality(classDescriptor.modality), ProtoEnumFlags.classKind(classDescriptor.kind, classDescriptor.isCompanionObject), diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/annotatedPropertyWithInlineClassTypeInSignature.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/annotatedPropertyWithInlineClassTypeInSignature.txt index bd90808cf29..cb52f309e1e 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/annotatedPropertyWithInlineClassTypeInSignature.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/annotatedPropertyWithInlineClassTypeInSignature.txt @@ -25,6 +25,7 @@ public final class C { public final method getReturnType-a_XrcN0(): int } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Z { // source: 'annotatedPropertyWithInlineClassTypeInSignature.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/annotationsOnHiddenConstructor.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/annotationsOnHiddenConstructor.txt index 2bc0fd2dd0a..13e92ea3dc9 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/annotationsOnHiddenConstructor.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/annotationsOnHiddenConstructor.txt @@ -58,6 +58,7 @@ public final class Test { public final inner class Test$Inner } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Z { // source: 'annotationsOnHiddenConstructor.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/companionObjectInsideInlineClass.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/companionObjectInsideInlineClass.txt index ad5903e1bdd..2dba80fe2ba 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/companionObjectInsideInlineClass.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/companionObjectInsideInlineClass.txt @@ -7,6 +7,7 @@ public final class Foo$Companion { public final inner class Foo$Companion } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Foo { // source: 'companionObjectInsideInlineClass.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/computablePropertiesInsideInlineClass.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/computablePropertiesInsideInlineClass.txt index b87a0dac6d7..082cd496bb8 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/computablePropertiesInsideInlineClass.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/computablePropertiesInsideInlineClass.txt @@ -1,3 +1,4 @@ +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Foo { // source: 'computablePropertiesInsideInlineClass.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/constructor.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/constructor.txt index ee562d2bb17..c52416d106a 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/constructor.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/constructor.txt @@ -1,3 +1,4 @@ +@kotlin.jvm.JvmInline @kotlin.Metadata public final class IC1 { // source: 'constructor.kt' @@ -16,6 +17,7 @@ public final class IC1 { public synthetic final method unbox-impl(): int } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class IC11 { // source: 'constructor.kt' @@ -34,6 +36,7 @@ public final class IC11 { public synthetic final method unbox-impl(): int } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class IC2 { // source: 'constructor.kt' @@ -52,6 +55,7 @@ public final class IC2 { public synthetic final method unbox-impl(): int } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class IC4 { // source: 'constructor.kt' @@ -70,6 +74,7 @@ public final class IC4 { public synthetic final method unbox-impl(): int } +@kotlin.jvm.JvmInline @kotlin.Metadata final class PIC1 { // source: 'constructor.kt' @@ -88,6 +93,7 @@ final class PIC1 { public synthetic final method unbox-impl(): int } +@kotlin.jvm.JvmInline @kotlin.Metadata final class PIC11 { // source: 'constructor.kt' @@ -106,6 +112,7 @@ final class PIC11 { public synthetic final method unbox-impl(): int } +@kotlin.jvm.JvmInline @kotlin.Metadata final class PIC2 { // source: 'constructor.kt' @@ -124,6 +131,7 @@ final class PIC2 { public synthetic final method unbox-impl(): int } +@kotlin.jvm.JvmInline @kotlin.Metadata final class PIC4 { // source: 'constructor.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/constructorsWithDefaultParameterValues.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/constructorsWithDefaultParameterValues.txt index 73a96cd8ce4..497e3099495 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/constructorsWithDefaultParameterValues.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/constructorsWithDefaultParameterValues.txt @@ -1,3 +1,4 @@ +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Test { // source: 'constructorsWithDefaultParameterValues.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMethodsInInlineClass.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMethodsInInlineClass.txt index 3f64b2996c7..3b22c446f02 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMethodsInInlineClass.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMethodsInInlineClass.txt @@ -17,6 +17,7 @@ public interface IFoo { public final inner class IFoo$DefaultImpls } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class L { // source: 'defaultInterfaceMethodsInInlineClass.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCharSequence.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCharSequence.txt index e0177b96e6a..085c033d024 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCharSequence.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCharSequence.txt @@ -1,3 +1,4 @@ +@kotlin.jvm.JvmInline @kotlin.Metadata public final class InlineCharSequence { // source: 'inlineCharSequence.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCharSequence_ir.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCharSequence_ir.txt index ddfc96d48ae..1f3d6f5832a 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCharSequence_ir.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCharSequence_ir.txt @@ -1,3 +1,4 @@ +@kotlin.jvm.JvmInline @kotlin.Metadata public final class InlineCharSequence { // source: 'inlineCharSequence.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassMembersVisibility.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassMembersVisibility.txt index f67ce92cb03..bce676386de 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassMembersVisibility.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassMembersVisibility.txt @@ -1,3 +1,4 @@ +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Z { // source: 'inlineClassMembersVisibility.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassTypeParametersInConstructor.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassTypeParametersInConstructor.txt index 672f27ceb0d..1ece1222078 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassTypeParametersInConstructor.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassTypeParametersInConstructor.txt @@ -76,6 +76,7 @@ public abstract class TestSealed { public final inner class TestSealed$Case } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Z { // source: 'inlineClassTypeParametersInConstructor.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassWithInlineClassUnderlyingType.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassWithInlineClassUnderlyingType.txt index 069448e26da..0f0f69f1b49 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassWithInlineClassUnderlyingType.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassWithInlineClassUnderlyingType.txt @@ -1,3 +1,4 @@ +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Z1 { // source: 'inlineClassWithInlineClassUnderlyingType.kt' @@ -16,6 +17,7 @@ public final class Z1 { public synthetic final method unbox-impl(): int } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Z2 { // source: 'inlineClassWithInlineClassUnderlyingType.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassWithManyKindsOfMembers.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassWithManyKindsOfMembers.txt index f1240acc98a..cd375cb50d3 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassWithManyKindsOfMembers.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassWithManyKindsOfMembers.txt @@ -56,6 +56,7 @@ public interface IFoo { public abstract method setOverridingVar(p0: int): void } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Z { // source: 'inlineClassWithManyKindsOfMembers.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection/UIntArrayWithFullJdk.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection/UIntArrayWithFullJdk.txt index 891268caf28..61073eaa7e0 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection/UIntArrayWithFullJdk.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection/UIntArrayWithFullJdk.txt @@ -1,3 +1,4 @@ +@kotlin.jvm.JvmInline @kotlin.Metadata public final class UInt { // source: 'UIntArrayWithFullJdk.kt' @@ -16,6 +17,7 @@ public final class UInt { public synthetic final method unbox-impl(): int } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class UIntArray { // source: 'UIntArrayWithFullJdk.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection/UIntArrayWithFullJdk_ir.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection/UIntArrayWithFullJdk_ir.txt index a455a1ff4a5..8f0a0a75320 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection/UIntArrayWithFullJdk_ir.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection/UIntArrayWithFullJdk_ir.txt @@ -1,3 +1,4 @@ +@kotlin.jvm.JvmInline @kotlin.Metadata public final class UInt { // source: 'UIntArrayWithFullJdk.kt' @@ -16,6 +17,7 @@ public final class UInt { public synthetic final method unbox-impl(): int } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class UIntArray { // source: 'UIntArrayWithFullJdk.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/javaDefaultInterfaceMember.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/javaDefaultInterfaceMember.txt index daacfa6762a..2d69cc08b7b 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/javaDefaultInterfaceMember.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/javaDefaultInterfaceMember.txt @@ -23,6 +23,7 @@ public interface KFooUnrelated { public abstract method foo(): void } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Test1 { // source: 'javaDefaultInterfaceMember.kt' @@ -41,6 +42,7 @@ public final class Test1 { public synthetic final method unbox-impl(): int } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Test2 { // source: 'javaDefaultInterfaceMember.kt' @@ -59,6 +61,7 @@ public final class Test2 { public synthetic final method unbox-impl(): int } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Test3 { // source: 'javaDefaultInterfaceMember.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/jvmName.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/jvmName.txt index 6f47578950e..f1fe0d53a8a 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/jvmName.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/jvmName.txt @@ -6,6 +6,7 @@ public final class C { public final @kotlin.jvm.JvmName @org.jetbrains.annotations.NotNull method test(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Foo { // source: 'jvmName.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.txt index 9807d43a4c1..d6c34afc662 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.txt @@ -6,6 +6,7 @@ public final class JvmOverloadsOnTopLevelFunctionReturningInlineClassValueKt { public final static @kotlin.jvm.JvmOverloads method testTopLevelFunction(p0: int): int } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Z { // source: 'jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/memberExtensionProperty.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/memberExtensionProperty.txt index 586ae04b510..7b880bae9a0 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/memberExtensionProperty.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/memberExtensionProperty.txt @@ -4,6 +4,7 @@ public interface StrS { public abstract method getS(@org.jetbrains.annotations.NotNull p0: java.lang.String): int } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Z1 { // source: 'memberExtensionProperty.kt' @@ -23,6 +24,7 @@ public final class Z1 { public synthetic final method unbox-impl(): int } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Z2 { // source: 'memberExtensionProperty.kt' @@ -42,6 +44,7 @@ public final class Z2 { public synthetic final method unbox-impl(): int } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Z3 { // source: 'memberExtensionProperty.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/noArgConstructorForInlineClassParameter.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/noArgConstructorForInlineClassParameter.txt index acfba7c79ca..28bec796647 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/noArgConstructorForInlineClassParameter.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/noArgConstructorForInlineClassParameter.txt @@ -8,6 +8,7 @@ public final class Test { public final method getZ-a_XrcN0(): int } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Z { // source: 'noArgConstructorForInlineClassParameter.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/noBridgesForErasedInlineClass.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/noBridgesForErasedInlineClass.txt index 384d88d7cc8..fe82203478c 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/noBridgesForErasedInlineClass.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/noBridgesForErasedInlineClass.txt @@ -4,6 +4,7 @@ public interface A { public abstract method foo(p0: java.lang.Object): void } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Foo { // source: 'noBridgesForErasedInlineClass.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/nullabilityInExpansion.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/nullabilityInExpansion.txt index 2126870e9e3..ea3daa9de5e 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/nullabilityInExpansion.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/nullabilityInExpansion.txt @@ -19,6 +19,7 @@ public final class NullabilityInExpansionKt { public final static @org.jetbrains.annotations.NotNull method zwrapNbox(p0: int): Z1 } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Q1 { // source: 'nullabilityInExpansion.kt' @@ -37,6 +38,7 @@ public final class Q1 { public synthetic final method unbox-impl(): java.lang.Integer } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Q2 { // source: 'nullabilityInExpansion.kt' @@ -55,6 +57,7 @@ public final class Q2 { public synthetic final method unbox-impl(): java.lang.Integer } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class QN { // source: 'nullabilityInExpansion.kt' @@ -73,6 +76,7 @@ public final class QN { public synthetic final method unbox-impl(): Q1 } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class S1 { // source: 'nullabilityInExpansion.kt' @@ -91,6 +95,7 @@ public final class S1 { public synthetic final method unbox-impl(): java.lang.String } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class S2 { // source: 'nullabilityInExpansion.kt' @@ -109,6 +114,7 @@ public final class S2 { public synthetic final method unbox-impl(): java.lang.String } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class SN { // source: 'nullabilityInExpansion.kt' @@ -127,6 +133,7 @@ public final class SN { public synthetic final method unbox-impl(): java.lang.String } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class SN2 { // source: 'nullabilityInExpansion.kt' @@ -145,6 +152,7 @@ public final class SN2 { public synthetic final method unbox-impl(): java.lang.String } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class W1 { // source: 'nullabilityInExpansion.kt' @@ -163,6 +171,7 @@ public final class W1 { public synthetic final method unbox-impl(): java.lang.String } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class W2 { // source: 'nullabilityInExpansion.kt' @@ -181,6 +190,7 @@ public final class W2 { public synthetic final method unbox-impl(): java.lang.String } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class WN { // source: 'nullabilityInExpansion.kt' @@ -199,6 +209,7 @@ public final class WN { public synthetic final method unbox-impl(): W1 } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Z1 { // source: 'nullabilityInExpansion.kt' @@ -217,6 +228,7 @@ public final class Z1 { public synthetic final method unbox-impl(): int } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Z2 { // source: 'nullabilityInExpansion.kt' @@ -235,6 +247,7 @@ public final class Z2 { public synthetic final method unbox-impl(): int } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class ZN { // source: 'nullabilityInExpansion.kt' @@ -253,6 +266,7 @@ public final class ZN { public synthetic final method unbox-impl(): Z1 } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class ZN2 { // source: 'nullabilityInExpansion.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/nullableAndNotNullPrimitive.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/nullableAndNotNullPrimitive.txt index e05a34f7f14..58548bfb929 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/nullableAndNotNullPrimitive.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/nullableAndNotNullPrimitive.txt @@ -1,3 +1,4 @@ +@kotlin.jvm.JvmInline @kotlin.Metadata public final class IC { // source: 'nullableAndNotNullPrimitive.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/overridingGenericMethodWithInlineClassParameterType.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/overridingGenericMethodWithInlineClassParameterType.txt index 2070532a182..8d1c3a10a71 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/overridingGenericMethodWithInlineClassParameterType.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/overridingGenericMethodWithInlineClassParameterType.txt @@ -1,3 +1,4 @@ +@kotlin.jvm.JvmInline @kotlin.Metadata public final class CFoo { // source: 'overridingGenericMethodWithInlineClassParameterType.kt' @@ -25,6 +26,7 @@ public interface IFoo { public abstract method foo(p0: java.lang.Object): void } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Z { // source: 'overridingGenericMethodWithInlineClassParameterType.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/overridingGenericMethodWithInlineClassReturnType.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/overridingGenericMethodWithInlineClassReturnType.txt index 1b67705af80..bc7b2b2c4ae 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/overridingGenericMethodWithInlineClassReturnType.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/overridingGenericMethodWithInlineClassReturnType.txt @@ -4,6 +4,7 @@ public interface A { public abstract method foo(): java.lang.Object } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Foo { // source: 'overridingGenericMethodWithInlineClassReturnType.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/primaryValsWithDifferentVisibilities.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/primaryValsWithDifferentVisibilities.txt index 091dc3b61bf..4de64667772 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/primaryValsWithDifferentVisibilities.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/primaryValsWithDifferentVisibilities.txt @@ -4,6 +4,7 @@ public interface IValue { public abstract method getValue(): int } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class TestInternal { // source: 'primaryValsWithDifferentVisibilities.kt' @@ -21,6 +22,7 @@ public final class TestInternal { public synthetic final method unbox-impl(): int } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class TestOverriding { // source: 'primaryValsWithDifferentVisibilities.kt' @@ -39,6 +41,7 @@ public final class TestOverriding { public synthetic final method unbox-impl(): int } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class TestPrivate { // source: 'primaryValsWithDifferentVisibilities.kt' @@ -56,6 +59,7 @@ public final class TestPrivate { public synthetic final method unbox-impl(): int } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class TestPublic { // source: 'primaryValsWithDifferentVisibilities.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/publishedApiAnnotationOnInlineClassConstructor.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/publishedApiAnnotationOnInlineClassConstructor.txt index 27f95bd7816..b3dfa39d8ae 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/publishedApiAnnotationOnInlineClassConstructor.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/publishedApiAnnotationOnInlineClassConstructor.txt @@ -1,3 +1,4 @@ +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Z { // source: 'publishedApiAnnotationOnInlineClassConstructor.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/shapeOfInlineClassWithPrimitive.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/shapeOfInlineClassWithPrimitive.txt index 5898396bb93..8360c4dfd52 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/shapeOfInlineClassWithPrimitive.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/shapeOfInlineClassWithPrimitive.txt @@ -1,3 +1,4 @@ +@kotlin.jvm.JvmInline @kotlin.Metadata public final class Foo { // source: 'shapeOfInlineClassWithPrimitive.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/stdlibManglingIn1430/new.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/stdlibManglingIn1430/new.txt index cdb5f8ffbcf..bb54a217227 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/stdlibManglingIn1430/new.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/stdlibManglingIn1430/new.txt @@ -1,3 +1,4 @@ +@kotlin.jvm.JvmInline @kotlin.Metadata public final class test/IC { // source: 'new.kt' diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/stdlibManglingIn1430/old.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/stdlibManglingIn1430/old.txt index 51401bcadfe..086ba103a35 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/stdlibManglingIn1430/old.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/stdlibManglingIn1430/old.txt @@ -4,6 +4,7 @@ public final class kotlin/_2Kt { public final static method foo-wfSZ3cc(p0: int, p1: int): void } +@kotlin.jvm.JvmInline @kotlin.Metadata public final class test/IC { // source: '1.kt' diff --git a/compiler/testData/codegen/bytecodeListing/kt42879.txt b/compiler/testData/codegen/bytecodeListing/kt42879.txt index 4516c2dac3a..9d9d38194b9 100644 --- a/compiler/testData/codegen/bytecodeListing/kt42879.txt +++ b/compiler/testData/codegen/bytecodeListing/kt42879.txt @@ -1,3 +1,4 @@ +@kotlin.jvm.JvmInline @kotlin.Metadata public final class A { // source: 'kt42879.kt' diff --git a/compiler/testData/compileJavaAgainstKotlin/method/primitiveOverrideWithInlineClass/InlineIntOverridesObject.txt b/compiler/testData/compileJavaAgainstKotlin/method/primitiveOverrideWithInlineClass/InlineIntOverridesObject.txt index e030987629f..999b1a75885 100644 --- a/compiler/testData/compileJavaAgainstKotlin/method/primitiveOverrideWithInlineClass/InlineIntOverridesObject.txt +++ b/compiler/testData/compileJavaAgainstKotlin/method/primitiveOverrideWithInlineClass/InlineIntOverridesObject.txt @@ -14,7 +14,7 @@ public open class KFooZ : test.IFoo { public open fun foo(): test.Z } -public final value class Z { +@kotlin.jvm.JvmInline public final value class Z { public constructor Z(/*0*/ kotlin.Int) public final val value: kotlin.Int } diff --git a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.fir.kt index 2dee1eb7ee7..bf36fea2102 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.fir.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.fir.kt @@ -1,6 +1,6 @@ // !LANGUAGE: +InlineClasses -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.kt b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.kt index 95e721c23ae..b27c46ca10e 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.kt @@ -1,6 +1,6 @@ // !LANGUAGE: +InlineClasses -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.txt b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.txt index e73947de324..a7a6cefa46d 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.txt @@ -2,55 +2,58 @@ package package kotlin { - @kotlin.JvmInline public final value class Foo { - public constructor Foo(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + package kotlin.jvm { - public final value annotation class InlineAnn : kotlin.Annotation { - public constructor InlineAnn() - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class Foo { + public constructor Foo(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - public final value enum class InlineEnum : kotlin.Enum { - private constructor InlineEnum() - public final override /*1*/ /*fake_override*/ val name: kotlin.String - public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int - protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any - public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: kotlin.InlineEnum): kotlin.Int - public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit - public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class! - public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + public final value annotation class InlineAnn : kotlin.Annotation { + public constructor InlineAnn() + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - // Static members - public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): kotlin.InlineEnum - public final /*synthesized*/ fun values(): kotlin.Array - } + public final value enum class InlineEnum : kotlin.Enum { + private constructor InlineEnum() + public final override /*1*/ /*fake_override*/ val name: kotlin.String + public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int + protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any + public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: kotlin.jvm.InlineEnum): kotlin.Int + public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit + public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class! + public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - public value interface InlineInterface { - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + // Static members + public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): kotlin.jvm.InlineEnum + public final /*synthesized*/ fun values(): kotlin.Array + } - public value object InlineObject { - private constructor InlineObject() - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + public value interface InlineInterface { + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - public final annotation class JvmInline : kotlin.Annotation { - public constructor JvmInline() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + public value object InlineObject { + private constructor InlineObject() + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } } } diff --git a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.fir.kt index 161e5275090..cdb987b0673 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.fir.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.fir.kt @@ -1,7 +1,7 @@ // !LANGUAGE: -InlineClasses // !DIAGNOSTICS: -UNUSED_PARAMETER -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.kt b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.kt index 5411729d17f..129eec441aa 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.kt @@ -1,7 +1,7 @@ // !LANGUAGE: -InlineClasses // !DIAGNOSTICS: -UNUSED_PARAMETER -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.txt b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.txt index 4d045c56d64..9471b847505 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.txt @@ -2,56 +2,59 @@ package package kotlin { - public final value class Foo { - public constructor Foo(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + package kotlin.jvm { - public final value annotation class InlineAnn : kotlin.Annotation { - public constructor InlineAnn() - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + public final value class Foo { + public constructor Foo(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - public final value enum class InlineEnum : kotlin.Enum { - private constructor InlineEnum() - public final override /*1*/ /*fake_override*/ val name: kotlin.String - public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int - protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any - public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: kotlin.InlineEnum): kotlin.Int - public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit - public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class! - public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + public final value annotation class InlineAnn : kotlin.Annotation { + public constructor InlineAnn() + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - // Static members - public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): kotlin.InlineEnum - public final /*synthesized*/ fun values(): kotlin.Array - } + public final value enum class InlineEnum : kotlin.Enum { + private constructor InlineEnum() + public final override /*1*/ /*fake_override*/ val name: kotlin.String + public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int + protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any + public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: kotlin.jvm.InlineEnum): kotlin.Int + public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit + public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class! + public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - public value object InlineObject { - private constructor InlineObject() - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + // Static members + public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): kotlin.jvm.InlineEnum + public final /*synthesized*/ fun values(): kotlin.Array + } - public final annotation class JvmInline : kotlin.Annotation { - public constructor JvmInline() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + public value object InlineObject { + private constructor InlineObject() + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class NotVal { - public constructor NotVal(/*0*/ x: kotlin.Int) - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class NotVal { + public constructor NotVal(/*0*/ x: kotlin.Int) + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } } } diff --git a/compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.fir.kt index fbef2363032..f5e19726e2a 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.fir.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.fir.kt @@ -1,7 +1,7 @@ // !LANGUAGE: +InlineClasses // !DIAGNOSTICS: -UNUSED_PARAMETER -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.kt b/compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.kt index 96577da92e1..20f1bd2468d 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.kt @@ -1,7 +1,7 @@ // !LANGUAGE: +InlineClasses // !DIAGNOSTICS: -UNUSED_PARAMETER -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.txt b/compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.txt index 6fc4c16ec8a..a5ca3b1c84f 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.txt @@ -2,56 +2,59 @@ package package kotlin { - public final annotation class JvmInline : kotlin.Annotation { - public constructor JvmInline() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + package kotlin.jvm { - public final class TestErr1 { - public constructor TestErr1(/*0*/ a: kotlin.Int) - public constructor TestErr1(/*0*/ x: kotlin.X) - public final val a: kotlin.Int - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - public final class TestErr2 { - public constructor TestErr2(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int) - public constructor TestErr2(/*0*/ x: kotlin.X) - public constructor TestErr2(/*0*/ z: kotlin.Z) - public final val a: kotlin.Int - public final val b: kotlin.Int - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + public final class TestErr1 { + public constructor TestErr1(/*0*/ a: kotlin.Int) + public constructor TestErr1(/*0*/ x: kotlin.jvm.X) + public final val a: kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - public final class TestOk1 { - public constructor TestOk1(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int) - public constructor TestOk1(/*0*/ x: kotlin.X) - public final val a: kotlin.Int - public final val b: kotlin.Int - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + public final class TestErr2 { + public constructor TestErr2(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int) + public constructor TestErr2(/*0*/ x: kotlin.jvm.X) + public constructor TestErr2(/*0*/ z: kotlin.jvm.Z) + public final val a: kotlin.Int + public final val b: kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class X { - public constructor X(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + public final class TestOk1 { + public constructor TestOk1(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int) + public constructor TestOk1(/*0*/ x: kotlin.jvm.X) + public final val a: kotlin.Int + public final val b: kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class Z { - public constructor Z(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + @kotlin.jvm.JvmInline public final value class X { + public constructor X(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class Z { + public constructor Z(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } } } diff --git a/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.fir.kt index c1e7abba11b..78978f3ef38 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.fir.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.fir.kt @@ -1,6 +1,6 @@ // !LANGUAGE: +InlineClasses -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.kt b/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.kt index 5b9079fa89f..f000be7da44 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.kt @@ -1,6 +1,6 @@ // !LANGUAGE: +InlineClasses -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.txt b/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.txt index ebb31a9479f..88d564e2961 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.txt @@ -2,56 +2,59 @@ package package kotlin { - public final annotation class JvmInline : kotlin.Annotation { - public constructor JvmInline() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + package kotlin.jvm { - public final class Val { - public constructor Val() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kProp: kotlin.Any?): kotlin.Int - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - public object ValObject { - private constructor ValObject() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kProp: kotlin.Any?): kotlin.Int - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + public final class Val { + public constructor Val() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kProp: kotlin.Any?): kotlin.Int + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - public final class Var { - public constructor Var() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kProp: kotlin.Any?): kotlin.Int - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kProp: kotlin.Any?, /*2*/ value: kotlin.Int): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + public object ValObject { + private constructor ValObject() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kProp: kotlin.Any?): kotlin.Int + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - public object VarObject { - private constructor VarObject() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kProp: kotlin.Any?): kotlin.Int - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kProp: kotlin.Any?, /*2*/ value: kotlin.Int): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + public final class Var { + public constructor Var() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kProp: kotlin.Any?): kotlin.Int + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kProp: kotlin.Any?, /*2*/ value: kotlin.Int): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class Z { - public constructor Z(/*0*/ data: kotlin.Int) - public final val data: kotlin.Int - public final val testVal: kotlin.Int - public final val testValBySingleton: kotlin.Int - public final var testVar: kotlin.Int - public final var testVarBySingleton: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + public object VarObject { + private constructor VarObject() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kProp: kotlin.Any?): kotlin.Int + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kProp: kotlin.Any?, /*2*/ value: kotlin.Int): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class Z { + public constructor Z(/*0*/ data: kotlin.Int) + public final val data: kotlin.Int + public final val testVal: kotlin.Int + public final val testValBySingleton: kotlin.Int + public final var testVar: kotlin.Int + public final var testVarBySingleton: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } } } diff --git a/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.fir.kt index dff6941bf0d..6b778549a9a 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.fir.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.fir.kt @@ -1,7 +1,7 @@ // !LANGUAGE: +InlineClasses // !DIAGNOSTICS: -UNUSED_PARAMETER -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.kt b/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.kt index 1222ff952f8..6a1ce3eefc6 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.kt @@ -1,7 +1,7 @@ // !LANGUAGE: +InlineClasses // !DIAGNOSTICS: -UNUSED_PARAMETER -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.txt b/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.txt index d33a5eded5f..40dd2b88326 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.txt @@ -1,77 +1,80 @@ package package kotlin { - public fun testFunVsExt(/*0*/ x: kotlin.X): kotlin.Unit - public fun testMixed(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int): kotlin.Unit - public fun testMixed(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.X): kotlin.Unit - public fun testMixed(/*0*/ x: kotlin.X, /*1*/ y: kotlin.Int): kotlin.Unit - public fun testMixed(/*0*/ x: kotlin.X, /*1*/ y: kotlin.X): kotlin.Unit - public fun testNewType(/*0*/ name: kotlin.Name): kotlin.Unit - public fun testNewType(/*0*/ s: kotlin.Str): kotlin.Unit - public fun testNonGenericVsGeneric(/*0*/ x: kotlin.X, /*1*/ y: T): kotlin.Unit - public fun testNonGenericVsGeneric(/*0*/ x: kotlin.X, /*1*/ y: kotlin.Number): kotlin.Unit - public fun testNullableVsNonNull1(/*0*/ s: kotlin.Str): kotlin.Unit - public fun testNullableVsNonNull1(/*0*/ s: kotlin.Str?): kotlin.Unit - public fun testNullableVsNonNull2(/*0*/ ns: kotlin.NStr): kotlin.Unit - public fun testNullableVsNonNull2(/*0*/ ns: kotlin.NStr?): kotlin.Unit - public fun testSimple(/*0*/ x: kotlin.X): kotlin.Unit - public fun testSimple(/*0*/ z: kotlin.Z): kotlin.Unit - public fun kotlin.X.testFunVsExt(): kotlin.Unit - public final class C { - public constructor C() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun testNonGenericVsGeneric(/*0*/ x: kotlin.X, /*1*/ y: T): kotlin.Unit - public final fun testNonGenericVsGeneric(/*0*/ x: kotlin.X, /*1*/ y: TC): kotlin.Unit - public final fun testNonGenericVsGeneric(/*0*/ x: kotlin.X, /*1*/ y: kotlin.Number): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + package kotlin.jvm { + public fun testFunVsExt(/*0*/ x: kotlin.jvm.X): kotlin.Unit + public fun testMixed(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int): kotlin.Unit + public fun testMixed(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.jvm.X): kotlin.Unit + public fun testMixed(/*0*/ x: kotlin.jvm.X, /*1*/ y: kotlin.Int): kotlin.Unit + public fun testMixed(/*0*/ x: kotlin.jvm.X, /*1*/ y: kotlin.jvm.X): kotlin.Unit + public fun testNewType(/*0*/ name: kotlin.jvm.Name): kotlin.Unit + public fun testNewType(/*0*/ s: kotlin.jvm.Str): kotlin.Unit + public fun testNonGenericVsGeneric(/*0*/ x: kotlin.jvm.X, /*1*/ y: T): kotlin.Unit + public fun testNonGenericVsGeneric(/*0*/ x: kotlin.jvm.X, /*1*/ y: kotlin.Number): kotlin.Unit + public fun testNullableVsNonNull1(/*0*/ s: kotlin.jvm.Str): kotlin.Unit + public fun testNullableVsNonNull1(/*0*/ s: kotlin.jvm.Str?): kotlin.Unit + public fun testNullableVsNonNull2(/*0*/ ns: kotlin.jvm.NStr): kotlin.Unit + public fun testNullableVsNonNull2(/*0*/ ns: kotlin.jvm.NStr?): kotlin.Unit + public fun testSimple(/*0*/ x: kotlin.jvm.X): kotlin.Unit + public fun testSimple(/*0*/ z: kotlin.jvm.Z): kotlin.Unit + public fun kotlin.jvm.X.testFunVsExt(): kotlin.Unit - public final annotation class JvmInline : kotlin.Annotation { - public constructor JvmInline() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + public final class C { + public constructor C() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun testNonGenericVsGeneric(/*0*/ x: kotlin.jvm.X, /*1*/ y: T): kotlin.Unit + public final fun testNonGenericVsGeneric(/*0*/ x: kotlin.jvm.X, /*1*/ y: TC): kotlin.Unit + public final fun testNonGenericVsGeneric(/*0*/ x: kotlin.jvm.X, /*1*/ y: kotlin.Number): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class NStr { - public constructor NStr(/*0*/ str: kotlin.String?) - public final val str: kotlin.String? - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class Name { - public constructor Name(/*0*/ name: kotlin.String) - public final val name: kotlin.String - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class NStr { + public constructor NStr(/*0*/ str: kotlin.String?) + public final val str: kotlin.String? + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class Str { - public constructor Str(/*0*/ str: kotlin.String) - public final val str: kotlin.String - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class Name { + public constructor Name(/*0*/ name: kotlin.String) + public final val name: kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class X { - public constructor X(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class Str { + public constructor Str(/*0*/ str: kotlin.String) + public final val str: kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class Z { - public constructor Z(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + @kotlin.jvm.JvmInline public final value class X { + public constructor X(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class Z { + public constructor Z(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } } } diff --git a/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesConflictOnInheritance.kt b/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesConflictOnInheritance.kt index d261567326b..70b0554c770 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesConflictOnInheritance.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesConflictOnInheritance.kt @@ -1,7 +1,7 @@ // FIR_IDENTICAL // !LANGUAGE: +InlineClasses -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesConflictOnInheritance.txt b/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesConflictOnInheritance.txt index cc538ec3809..bb784cc51c8 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesConflictOnInheritance.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesConflictOnInheritance.txt @@ -2,48 +2,51 @@ package package kotlin { - public final annotation class JvmInline : kotlin.Annotation { - public constructor JvmInline() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + package kotlin.jvm { - @kotlin.JvmInline public final value class Name { - public constructor Name(/*0*/ name: kotlin.String) - public final val name: kotlin.String - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - public interface NameAndPasswordVerifier : kotlin.NameVerifier, kotlin.PasswordVerifier { - public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String - public abstract override /*1*/ /*fake_override*/ fun verify(/*0*/ name: kotlin.Name): kotlin.Unit - public abstract override /*1*/ /*fake_override*/ fun verify(/*0*/ password: kotlin.Password): kotlin.Unit - } + @kotlin.jvm.JvmInline public final value class Name { + public constructor Name(/*0*/ name: kotlin.String) + public final val name: kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - public interface NameVerifier { - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - public abstract fun verify(/*0*/ name: kotlin.Name): kotlin.Unit - } + public interface NameAndPasswordVerifier : kotlin.jvm.NameVerifier, kotlin.jvm.PasswordVerifier { + public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String + public abstract override /*1*/ /*fake_override*/ fun verify(/*0*/ name: kotlin.jvm.Name): kotlin.Unit + public abstract override /*1*/ /*fake_override*/ fun verify(/*0*/ password: kotlin.jvm.Password): kotlin.Unit + } - @kotlin.JvmInline public final value class Password { - public constructor Password(/*0*/ password: kotlin.String) - public final val password: kotlin.String - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + public interface NameVerifier { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + public abstract fun verify(/*0*/ name: kotlin.jvm.Name): kotlin.Unit + } - public interface PasswordVerifier { - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - public abstract fun verify(/*0*/ password: kotlin.Password): kotlin.Unit + @kotlin.jvm.JvmInline public final value class Password { + public constructor Password(/*0*/ password: kotlin.String) + public final val password: kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public interface PasswordVerifier { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + public abstract fun verify(/*0*/ password: kotlin.jvm.Password): kotlin.Unit + } } } diff --git a/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.fir.kt index a5f2b180bc4..7adb195d541 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.fir.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.fir.kt @@ -1,7 +1,7 @@ // !LANGUAGE: +InlineClasses // !DIAGNOSTICS: -UNUSED_VARIABLE -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.kt b/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.kt index d9f52a94153..dff2b4db257 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.kt @@ -1,7 +1,7 @@ // !LANGUAGE: +InlineClasses // !DIAGNOSTICS: -UNUSED_VARIABLE -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.txt b/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.txt index 545009b9063..631ccef544e 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.txt @@ -1,28 +1,31 @@ package package kotlin { - public fun test(/*0*/ f1: kotlin.Foo, /*1*/ f2: kotlin.Foo, /*2*/ b1: kotlin.Bar, /*3*/ fn1: kotlin.Foo?, /*4*/ fn2: kotlin.Foo?): kotlin.Unit - @kotlin.JvmInline public final value class Bar { - public constructor Bar(/*0*/ y: kotlin.String) - public final val y: kotlin.String - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + package kotlin.jvm { + public fun test(/*0*/ f1: kotlin.jvm.Foo, /*1*/ f2: kotlin.jvm.Foo, /*2*/ b1: kotlin.jvm.Bar, /*3*/ fn1: kotlin.jvm.Foo?, /*4*/ fn2: kotlin.jvm.Foo?): kotlin.Unit - @kotlin.JvmInline public final value class Foo { - public constructor Foo(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class Bar { + public constructor Bar(/*0*/ y: kotlin.String) + public final val y: kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - public final annotation class JvmInline : kotlin.Annotation { - public constructor JvmInline() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + @kotlin.jvm.JvmInline public final value class Foo { + public constructor Foo(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } } } diff --git a/compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.fir.kt index b1083cad466..3ad84f8a131 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.fir.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.fir.kt @@ -1,6 +1,6 @@ // !LANGUAGE: +InlineClasses -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.kt b/compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.kt index 820263b497b..6590b2eeb53 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.kt @@ -1,6 +1,6 @@ // !LANGUAGE: +InlineClasses -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.txt b/compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.txt index b41121095b1..3f13039d3f1 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/jvmInlineApplicability.txt @@ -2,56 +2,59 @@ package package kotlin { - @kotlin.JvmInline public final class C { - public constructor C() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + package kotlin.jvm { - @kotlin.JvmInline public final data class DC { - public constructor DC(/*0*/ a: kotlin.Any) - public final val a: kotlin.Any - public final operator /*synthesized*/ fun component1(): kotlin.Any - public final /*synthesized*/ fun copy(/*0*/ a: kotlin.Any = ...): kotlin.DC - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final class C { + public constructor C() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public interface I { - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final data class DC { + public constructor DC(/*0*/ a: kotlin.Any) + public final val a: kotlin.Any + public final operator /*synthesized*/ fun component1(): kotlin.Any + public final /*synthesized*/ fun copy(/*0*/ a: kotlin.Any = ...): kotlin.jvm.DC + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final inline class IC { - public constructor IC(/*0*/ a: kotlin.Any) - public final val a: kotlin.Any - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public interface I { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - public final annotation class JvmInline : kotlin.Annotation { - public constructor JvmInline() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final inline class IC { + public constructor IC(/*0*/ a: kotlin.Any) + public final val a: kotlin.Any + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public object O { - private constructor O() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class VC { - public constructor VC(/*0*/ a: kotlin.Any) - public final val a: kotlin.Any - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + @kotlin.jvm.JvmInline public object O { + private constructor O() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class VC { + public constructor VC(/*0*/ a: kotlin.Any) + public final val a: kotlin.Any + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } } } diff --git a/compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.fir.kt index 87423ad5b0c..ecd831251b1 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.fir.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.fir.kt @@ -1,7 +1,7 @@ // !LANGUAGE: +InlineClasses // !DIAGNOSTICS: -UNUSED_VARIABLE -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.kt b/compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.kt index ccf4cc8d6b8..c92f98de61c 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.kt @@ -1,7 +1,7 @@ // !LANGUAGE: +InlineClasses // !DIAGNOSTICS: -UNUSED_VARIABLE -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.txt b/compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.txt index dc071c62ae3..a7c9515670a 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.txt @@ -1,21 +1,24 @@ package package kotlin { - public lateinit var a: kotlin.Foo - public fun foo(): kotlin.Unit - @kotlin.JvmInline public final value class Foo { - public constructor Foo(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + package kotlin.jvm { + public lateinit var a: kotlin.jvm.Foo + public fun foo(): kotlin.Unit - public final annotation class JvmInline : kotlin.Annotation { - public constructor JvmInline() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + @kotlin.jvm.JvmInline public final value class Foo { + public constructor Foo(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } } } diff --git a/compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.kt b/compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.kt index f85a8c6367b..06e24914753 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.kt @@ -2,7 +2,7 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE // FIR_IDENTICAL -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.txt b/compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.txt index d8feb9201fe..51dd32c205b 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.txt @@ -2,18 +2,21 @@ package package kotlin { - @kotlin.JvmInline public final value class Foo { - public constructor Foo(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + package kotlin.jvm { - public final annotation class JvmInline : kotlin.Annotation { - public constructor JvmInline() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + @kotlin.jvm.JvmInline public final value class Foo { + public constructor Foo(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } } } diff --git a/compiler/testData/diagnostics/tests/valueClasses/presenceOfPublicPrimaryConstructorForValueClass.kt b/compiler/testData/diagnostics/tests/valueClasses/presenceOfPublicPrimaryConstructorForValueClass.kt index f03ff14c317..f5ffb217cda 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/presenceOfPublicPrimaryConstructorForValueClass.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/presenceOfPublicPrimaryConstructorForValueClass.kt @@ -1,7 +1,7 @@ // !LANGUAGE: +InlineClasses // FIR_IDENTICAL -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/presenceOfPublicPrimaryConstructorForValueClass.txt b/compiler/testData/diagnostics/tests/valueClasses/presenceOfPublicPrimaryConstructorForValueClass.txt index b7859ca179b..570932ed41c 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/presenceOfPublicPrimaryConstructorForValueClass.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/presenceOfPublicPrimaryConstructorForValueClass.txt @@ -2,50 +2,53 @@ package package kotlin { - @kotlin.JvmInline public final value class ConstructorWithDefaultVisibility { - public constructor ConstructorWithDefaultVisibility(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + package kotlin.jvm { - @kotlin.JvmInline public final value class InternalConstructor { - internal constructor InternalConstructor(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class ConstructorWithDefaultVisibility { + public constructor ConstructorWithDefaultVisibility(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - public final annotation class JvmInline : kotlin.Annotation { - public constructor JvmInline() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class InternalConstructor { + internal constructor InternalConstructor(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class PrivateConstructor { - private constructor PrivateConstructor(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class ProtectedConstructor { - protected constructor ProtectedConstructor(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class PrivateConstructor { + private constructor PrivateConstructor(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class PublicConstructor { - public constructor PublicConstructor(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + @kotlin.jvm.JvmInline public final value class ProtectedConstructor { + protected constructor ProtectedConstructor(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class PublicConstructor { + public constructor PublicConstructor(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } } } diff --git a/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.fir.kt index 8e53c287b85..600b744d3c8 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.fir.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.fir.kt @@ -1,7 +1,7 @@ // !LANGUAGE: +InlineClasses // !DIAGNOSTICS: -UNUSED_PARAMETER -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.kt b/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.kt index 721bbd69342..8267ab02d03 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.kt @@ -1,7 +1,7 @@ // !LANGUAGE: +InlineClasses // !DIAGNOSTICS: -UNUSED_PARAMETER -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.txt b/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.txt index 9540353f79b..bd08ecb9e5f 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.txt @@ -2,39 +2,42 @@ package package kotlin { - public interface A { - public abstract val goodSize: kotlin.Int - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + package kotlin.jvm { - public interface B { - public abstract val badSize: kotlin.Int - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + public interface A { + public abstract val goodSize: kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class Foo : kotlin.A, kotlin.B { - public constructor Foo(/*0*/ x: kotlin.Int) - public final val a0: kotlin.Int - public final val a1: kotlin.Int = 0 - public final var a2: kotlin.Int - public final var a3: kotlin.Int - public open override /*1*/ val badSize: kotlin.Int = 0 - public open override /*1*/ val goodSize: kotlin.Int - public final lateinit var lateinitProperty: kotlin.String - public final val x: kotlin.Int - public open override /*2*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*2*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*2*/ /*synthesized*/ fun toString(): kotlin.String - } + public interface B { + public abstract val badSize: kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - public final annotation class JvmInline : kotlin.Annotation { - public constructor JvmInline() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + @kotlin.jvm.JvmInline public final value class Foo : kotlin.jvm.A, kotlin.jvm.B { + public constructor Foo(/*0*/ x: kotlin.Int) + public final val a0: kotlin.Int + public final val a1: kotlin.Int = 0 + public final var a2: kotlin.Int + public final var a3: kotlin.Int + public open override /*1*/ val badSize: kotlin.Int = 0 + public open override /*1*/ val goodSize: kotlin.Int + public final lateinit var lateinitProperty: kotlin.String + public final val x: kotlin.Int + public open override /*2*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*2*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*2*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } } } diff --git a/compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.fir.kt index c06db3a2dca..aa805071da2 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.fir.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.fir.kt @@ -1,6 +1,6 @@ // !LANGUAGE: +InlineClasses -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.kt b/compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.kt index e4c385fb711..167a6b5dabc 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.kt @@ -1,6 +1,6 @@ // !LANGUAGE: +InlineClasses -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.txt b/compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.txt index 93f9a69949d..b2d885099a9 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.txt @@ -2,106 +2,109 @@ package package kotlin { - @kotlin.JvmInline public final value class Id { - public constructor Id(/*0*/ x: T) - public final val x: T - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + package kotlin.jvm { - public final annotation class JvmInline : kotlin.Annotation { - public constructor JvmInline() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class Id { + public constructor Id(/*0*/ x: T) + public final val x: T + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class Test1 { - public constructor Test1(/*0*/ x: kotlin.Test1) - public final val x: kotlin.Test1 - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class Test2A { - public constructor Test2A(/*0*/ x: kotlin.Test2B) - public final val x: kotlin.Test2B - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class Test1 { + public constructor Test1(/*0*/ x: kotlin.jvm.Test1) + public final val x: kotlin.jvm.Test1 + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class Test2B { - public constructor Test2B(/*0*/ x: kotlin.Test2A) - public final val x: kotlin.Test2A - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class Test2A { + public constructor Test2A(/*0*/ x: kotlin.jvm.Test2B) + public final val x: kotlin.jvm.Test2B + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class Test3A { - public constructor Test3A(/*0*/ x: kotlin.Test3B) - public final val x: kotlin.Test3B - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class Test2B { + public constructor Test2B(/*0*/ x: kotlin.jvm.Test2A) + public final val x: kotlin.jvm.Test2A + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class Test3B { - public constructor Test3B(/*0*/ x: kotlin.Test3C) - public final val x: kotlin.Test3C - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class Test3A { + public constructor Test3A(/*0*/ x: kotlin.jvm.Test3B) + public final val x: kotlin.jvm.Test3B + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class Test3C { - public constructor Test3C(/*0*/ x: kotlin.Test3A) - public final val x: kotlin.Test3A - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class Test3B { + public constructor Test3B(/*0*/ x: kotlin.jvm.Test3C) + public final val x: kotlin.jvm.Test3C + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class TestNullable { - public constructor TestNullable(/*0*/ x: kotlin.TestNullable?) - public final val x: kotlin.TestNullable? - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class Test3C { + public constructor Test3C(/*0*/ x: kotlin.jvm.Test3A) + public final val x: kotlin.jvm.Test3A + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class TestRecursionInArray { - public constructor TestRecursionInArray(/*0*/ x: kotlin.Array) - public final val x: kotlin.Array - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class TestNullable { + public constructor TestNullable(/*0*/ x: kotlin.jvm.TestNullable?) + public final val x: kotlin.jvm.TestNullable? + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class TestRecursionInTypeArguments { - public constructor TestRecursionInTypeArguments(/*0*/ x: kotlin.collections.List) - public final val x: kotlin.collections.List - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class TestRecursionInArray { + public constructor TestRecursionInArray(/*0*/ x: kotlin.Array) + public final val x: kotlin.Array + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class TestRecursionInUpperBounds> { - public constructor TestRecursionInUpperBounds>(/*0*/ x: T) - public final val x: T - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class TestRecursionInTypeArguments { + public constructor TestRecursionInTypeArguments(/*0*/ x: kotlin.collections.List) + public final val x: kotlin.collections.List + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class TestRecursionThroughId { - public constructor TestRecursionThroughId(/*0*/ x: kotlin.Id) - public final val x: kotlin.Id - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + @kotlin.jvm.JvmInline public final value class TestRecursionInUpperBounds> { + public constructor TestRecursionInUpperBounds>(/*0*/ x: T) + public final val x: T + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class TestRecursionThroughId { + public constructor TestRecursionThroughId(/*0*/ x: kotlin.jvm.Id) + public final val x: kotlin.jvm.Id + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } } } diff --git a/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.fir.kt index c11e22f5d74..1d889336879 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.fir.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.fir.kt @@ -1,7 +1,7 @@ // !LANGUAGE: +InlineClasses // !DIAGNOSTICS: -UNUSED_PARAMETER -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.kt b/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.kt index 2ed4dabb480..06debc64d17 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.kt @@ -1,7 +1,7 @@ // !LANGUAGE: +InlineClasses // !DIAGNOSTICS: -UNUSED_PARAMETER -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.txt b/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.txt index 98b1db49c3e..d56ed1ad11a 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.txt @@ -2,72 +2,75 @@ package package kotlin { - @kotlin.JvmInline public final value class IC1 { - public constructor IC1(/*0*/ x: kotlin.Any) - public final val x: kotlin.Any - public final fun box(): kotlin.Unit - public final fun box(/*0*/ x: kotlin.Any): kotlin.Unit - public open override /*1*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - public final fun unbox(): kotlin.Unit - public final fun unbox(/*0*/ x: kotlin.Any): kotlin.Unit - } + package kotlin.jvm { - @kotlin.JvmInline public final value class IC2 { - public constructor IC2(/*0*/ x: kotlin.Any) - public final val x: kotlin.Any - public final fun box(): kotlin.Any - public final fun box(/*0*/ x: kotlin.Any): kotlin.Unit - public final fun equals(/*0*/ my: kotlin.Any, /*1*/ other: kotlin.Any): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public final fun hashCode(/*0*/ a: kotlin.Any): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - public final fun unbox(): kotlin.Any - public final fun unbox(/*0*/ x: kotlin.Any): kotlin.Unit - } + @kotlin.jvm.JvmInline public final value class IC1 { + public constructor IC1(/*0*/ x: kotlin.Any) + public final val x: kotlin.Any + public final fun box(): kotlin.Unit + public final fun box(/*0*/ x: kotlin.Any): kotlin.Unit + public open override /*1*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + public final fun unbox(): kotlin.Unit + public final fun unbox(/*0*/ x: kotlin.Any): kotlin.Unit + } - @kotlin.JvmInline public final value class IC3 { - public constructor IC3(/*0*/ x: kotlin.Any) - public final val x: kotlin.Any - public final fun box(/*0*/ x: kotlin.Any): kotlin.Any - public final fun equals(): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - public final fun unbox(/*0*/ x: kotlin.Any): kotlin.Any - } + @kotlin.jvm.JvmInline public final value class IC2 { + public constructor IC2(/*0*/ x: kotlin.Any) + public final val x: kotlin.Any + public final fun box(): kotlin.Any + public final fun box(/*0*/ x: kotlin.Any): kotlin.Unit + public final fun equals(/*0*/ my: kotlin.Any, /*1*/ other: kotlin.Any): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public final fun hashCode(/*0*/ a: kotlin.Any): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + public final fun unbox(): kotlin.Any + public final fun unbox(/*0*/ x: kotlin.Any): kotlin.Unit + } - @kotlin.JvmInline public final value class IC4 : kotlin.WithBox { - public constructor IC4(/*0*/ s: kotlin.String) - public final val s: kotlin.String - public open override /*1*/ fun box(): kotlin.String - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class IC3 { + public constructor IC3(/*0*/ x: kotlin.Any) + public final val x: kotlin.Any + public final fun box(/*0*/ x: kotlin.Any): kotlin.Any + public final fun equals(): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + public final fun unbox(/*0*/ x: kotlin.Any): kotlin.Any + } - @kotlin.JvmInline public final value class IC5 { - public constructor IC5(/*0*/ i: kotlin.Int) - public constructor IC5(/*0*/ a: kotlin.String) - public final val a: kotlin.String - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class IC4 : kotlin.jvm.WithBox { + public constructor IC4(/*0*/ s: kotlin.String) + public final val s: kotlin.String + public open override /*1*/ fun box(): kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - public final annotation class JvmInline : kotlin.Annotation { - public constructor JvmInline() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class IC5 { + public constructor IC5(/*0*/ i: kotlin.Int) + public constructor IC5(/*0*/ a: kotlin.String) + public final val a: kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - public interface WithBox { - public abstract fun box(): kotlin.String - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public interface WithBox { + public abstract fun box(): kotlin.String + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } } } diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.fir.kt index ff6b14e35cc..25ea40e9ea2 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.fir.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.fir.kt @@ -1,6 +1,6 @@ // !LANGUAGE: +InlineClasses -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.kt index 13ed4fd19ef..9b2fdd735d9 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.kt @@ -1,6 +1,6 @@ // !LANGUAGE: +InlineClasses -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.txt b/compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.txt index 3181cf577a7..044e02cf606 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.txt @@ -2,54 +2,57 @@ package package kotlin { - public abstract class AbstractBaseClass { - public constructor AbstractBaseClass() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + package kotlin.jvm { - public interface BaseInterface { - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + public abstract class AbstractBaseClass { + public constructor AbstractBaseClass() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - public final annotation class JvmInline : kotlin.Annotation { - public constructor JvmInline() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + public interface BaseInterface { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - public open class OpenBaseClass { - public constructor OpenBaseClass() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class TestExtendsAbstractClass : kotlin.AbstractBaseClass { - public constructor TestExtendsAbstractClass(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + public open class OpenBaseClass { + public constructor OpenBaseClass() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class TestExtendsOpenClass : kotlin.OpenBaseClass { - public constructor TestExtendsOpenClass(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class TestExtendsAbstractClass : kotlin.jvm.AbstractBaseClass { + public constructor TestExtendsAbstractClass(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class TestImplementsInterface : kotlin.BaseInterface { - public constructor TestImplementsInterface(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + @kotlin.jvm.JvmInline public final value class TestExtendsOpenClass : kotlin.jvm.OpenBaseClass { + public constructor TestExtendsOpenClass(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class TestImplementsInterface : kotlin.jvm.BaseInterface { + public constructor TestImplementsInterface(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } } } diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.fir.kt index d9de10fe6a5..a59356430e0 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.fir.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.fir.kt @@ -1,6 +1,6 @@ // !LANGUAGE: +InlineClasses -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.kt index 83112d8e629..f9dbdd81d3e 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.kt @@ -1,6 +1,6 @@ // !LANGUAGE: +InlineClasses -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.txt b/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.txt index 5fae056825c..2d435d46433 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.txt @@ -2,39 +2,42 @@ package package kotlin { - public object FooImpl : kotlin.IFoo { - private constructor FooImpl() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + package kotlin.jvm { - public interface IFoo { - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + public object FooImpl : kotlin.jvm.IFoo { + private constructor FooImpl() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - public final annotation class JvmInline : kotlin.Annotation { - public constructor JvmInline() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + public interface IFoo { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class Test1 : kotlin.IFoo { - public constructor Test1(/*0*/ x: kotlin.Any) - public final val x: kotlin.Any - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class Test2 : kotlin.IFoo { - public constructor Test2(/*0*/ x: kotlin.IFoo) - public final val x: kotlin.IFoo - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + @kotlin.jvm.JvmInline public final value class Test1 : kotlin.jvm.IFoo { + public constructor Test1(/*0*/ x: kotlin.Any) + public final val x: kotlin.Any + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class Test2 : kotlin.jvm.IFoo { + public constructor Test2(/*0*/ x: kotlin.jvm.IFoo) + public final val x: kotlin.jvm.IFoo + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } } } diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassConstructorParameterWithDefaultValue.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassConstructorParameterWithDefaultValue.kt index 7e47e5845c1..393acf38100 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassConstructorParameterWithDefaultValue.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassConstructorParameterWithDefaultValue.kt @@ -1,7 +1,7 @@ // FIR_IDENTICAL // !LANGUAGE: +InlineClasses -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassConstructorParameterWithDefaultValue.txt b/compiler/testData/diagnostics/tests/valueClasses/valueClassConstructorParameterWithDefaultValue.txt index 53b09dfce5f..40b3e32d167 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassConstructorParameterWithDefaultValue.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassConstructorParameterWithDefaultValue.txt @@ -2,18 +2,21 @@ package package kotlin { - public final annotation class JvmInline : kotlin.Annotation { - public constructor JvmInline() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + package kotlin.jvm { - @kotlin.JvmInline public final value class Test { - public constructor Test(/*0*/ x: kotlin.Int = ...) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class Test { + public constructor Test(/*0*/ x: kotlin.Int = ...) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } } } diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.fir.kt index b61487f664a..0ca3684d5b3 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.fir.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.fir.kt @@ -1,7 +1,7 @@ // !LANGUAGE: +InlineClasses // !DIAGNOSTICS: -UNUSED_PARAMETER -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt index 3b5c978717e..a55cfb64cb4 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt @@ -1,7 +1,7 @@ // !LANGUAGE: +InlineClasses // !DIAGNOSTICS: -UNUSED_PARAMETER -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.txt b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.txt index 0dffe83ffd7..61739d5e67b 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.txt @@ -2,175 +2,178 @@ package package kotlin { - @kotlin.JvmInline public final value class A0 { - public constructor A0(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + package kotlin.jvm { - @kotlin.JvmInline public final value class A1 { - public constructor A1() - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } - - @kotlin.JvmInline public final value class A2 { - public constructor A2() - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } - - @kotlin.JvmInline public final value class A3 { - public constructor A3(/*0*/ x: kotlin.Int) - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } - - @kotlin.JvmInline public final value class A4 { - public constructor A4(/*0*/ x: kotlin.Int) - public final var x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } - - @kotlin.JvmInline public final value class A5 { - public constructor A5(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int) - public final val x: kotlin.Int - public final val y: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } - - @kotlin.JvmInline public final value class A6 { - public constructor A6(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int) - public final val y: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } - - @kotlin.JvmInline public final value class A7 { - public constructor A7(/*0*/ vararg x: kotlin.Int /*kotlin.IntArray*/) - public final val x: kotlin.IntArray - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } - - @kotlin.JvmInline public final value class A8 { - public constructor A8(/*0*/ x: kotlin.Int) - public open val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } - - @kotlin.JvmInline public final value class A9 { - public constructor A9(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } - - public final class B1 { - public constructor B1() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - - @kotlin.JvmInline public final value class C2 { - public constructor C2(/*0*/ x: kotlin.Int) + @kotlin.jvm.JvmInline public final value class A0 { + public constructor A0(/*0*/ x: kotlin.Int) public final val x: kotlin.Int public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String } - public companion object Companion { - private constructor Companion() + @kotlin.jvm.JvmInline public final value class A1 { + public constructor A1() + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class A2 { + public constructor A2() + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class A3 { + public constructor A3(/*0*/ x: kotlin.Int) + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class A4 { + public constructor A4(/*0*/ x: kotlin.Int) + public final var x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class A5 { + public constructor A5(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int) + public final val x: kotlin.Int + public final val y: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class A6 { + public constructor A6(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int) + public final val y: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class A7 { + public constructor A7(/*0*/ vararg x: kotlin.Int /*kotlin.IntArray*/) + public final val x: kotlin.IntArray + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class A8 { + public constructor A8(/*0*/ x: kotlin.Int) + public open val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class A9 { + public constructor A9(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final class B1 { + public constructor B1() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - @kotlin.JvmInline public final value class C1 { - public constructor C1(/*0*/ x: kotlin.Int) + @kotlin.jvm.JvmInline public final value class C2 { + public constructor C2(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public companion object Companion { + private constructor Companion() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + @kotlin.jvm.JvmInline public final value class C1 { + public constructor C1(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + } + } + + public object B2 { + private constructor B2() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + @kotlin.jvm.JvmInline public final value class C3 { + public constructor C3(/*0*/ x: kotlin.Int) public final val x: kotlin.Int public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String } } - } - public object B2 { - private constructor B2() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - - @kotlin.JvmInline public final value class C3 { - public constructor C3(/*0*/ x: kotlin.Int) + @kotlin.jvm.JvmInline public final value class D0 { + public constructor D0(/*0*/ x: kotlin.Int) public final val x: kotlin.Int public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String } - } - @kotlin.JvmInline public final value class D0 { - public constructor D0(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + public open value class D1 { + public constructor D1(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - public open value class D1 { - public constructor D1(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + public abstract value class D2 { + public constructor D2(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - public abstract value class D2 { - public constructor D2(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + public sealed value class D3 { + private constructor D3(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - public sealed value class D3 { - private constructor D3(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + public final data value class D4 { + public constructor D4(/*0*/ x: kotlin.String) + public final val x: kotlin.String + public final operator /*synthesized*/ fun component1(): kotlin.String + public final /*synthesized*/ fun copy(/*0*/ x: kotlin.String = ...): kotlin.jvm.D4 + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - public final data value class D4 { - public constructor D4(/*0*/ x: kotlin.String) - public final val x: kotlin.String - public final operator /*synthesized*/ fun component1(): kotlin.String - public final /*synthesized*/ fun copy(/*0*/ x: kotlin.String = ...): kotlin.D4 - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } - - public final annotation class JvmInline : kotlin.Annotation { - public constructor JvmInline() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } } } diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassImplementsCollection.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassImplementsCollection.kt index 3b6e1a34a79..8d24d41c91c 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassImplementsCollection.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassImplementsCollection.kt @@ -1,7 +1,7 @@ // FIR_IDENTICAL // !LANGUAGE: +InlineClasses -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassImplementsCollection.txt b/compiler/testData/diagnostics/tests/valueClasses/valueClassImplementsCollection.txt index c5054c4d4f1..74ff9df03e0 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassImplementsCollection.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassImplementsCollection.txt @@ -2,31 +2,34 @@ package package kotlin { - public final annotation class JvmInline : kotlin.Annotation { - public constructor JvmInline() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + package kotlin.jvm { - @kotlin.JvmInline public final value class UInt { - public constructor UInt(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class UIntArray : kotlin.collections.Collection { - public constructor UIntArray(/*0*/ storage: kotlin.IntArray) - public open override /*1*/ val size: kotlin.Int - private final val storage: kotlin.IntArray - public open override /*1*/ fun contains(/*0*/ element: kotlin.UInt): kotlin.Boolean - public open override /*1*/ fun containsAll(/*0*/ elements: kotlin.collections.Collection): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ fun isEmpty(): kotlin.Boolean - public open override /*1*/ fun iterator(): kotlin.Nothing - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + @kotlin.jvm.JvmInline public final value class UInt { + public constructor UInt(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class UIntArray : kotlin.collections.Collection { + public constructor UIntArray(/*0*/ storage: kotlin.IntArray) + public open override /*1*/ val size: kotlin.Int + private final val storage: kotlin.IntArray + public open override /*1*/ fun contains(/*0*/ element: kotlin.jvm.UInt): kotlin.Boolean + public open override /*1*/ fun containsAll(/*0*/ elements: kotlin.collections.Collection): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ fun isEmpty(): kotlin.Boolean + public open override /*1*/ fun iterator(): kotlin.Nothing + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } } } diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.fir.kt index 8b21a794cb7..7ed03f8cdd2 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.fir.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.fir.kt @@ -1,6 +1,6 @@ // !LANGUAGE: +InlineClasses -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.kt index c29a59d547f..3a680ba0dc4 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.kt @@ -1,6 +1,6 @@ // !LANGUAGE: +InlineClasses -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.txt b/compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.txt index 22b80d4b1e2..4b61d6575f6 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.txt @@ -2,90 +2,93 @@ package package kotlin { - @kotlin.JvmInline public final value class Bar { - public constructor Bar(/*0*/ u: kotlin.Unit) - public final val u: kotlin.Unit - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + package kotlin.jvm { - @kotlin.JvmInline public final value class BarNullable { - public constructor BarNullable(/*0*/ u: kotlin.Unit?) - public final val u: kotlin.Unit? - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class Bar { + public constructor Bar(/*0*/ u: kotlin.Unit) + public final val u: kotlin.Unit + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class Baz { - public constructor Baz(/*0*/ u: kotlin.Nothing) - public final val u: kotlin.Nothing - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class BarNullable { + public constructor BarNullable(/*0*/ u: kotlin.Unit?) + public final val u: kotlin.Unit? + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class BazNullable { - public constructor BazNullable(/*0*/ u: kotlin.Nothing?) - public final val u: kotlin.Nothing? - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class Baz { + public constructor Baz(/*0*/ u: kotlin.Nothing) + public final val u: kotlin.Nothing + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class Foo { - public constructor Foo(/*0*/ x: T) - public final val x: T - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class BazNullable { + public constructor BazNullable(/*0*/ u: kotlin.Nothing?) + public final val u: kotlin.Nothing? + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class FooGenericArray { - public constructor FooGenericArray(/*0*/ x: kotlin.Array) - public final val x: kotlin.Array - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class Foo { + public constructor Foo(/*0*/ x: T) + public final val x: T + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class FooGenericArray2 { - public constructor FooGenericArray2(/*0*/ x: kotlin.Array>) - public final val x: kotlin.Array> - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class FooGenericArray { + public constructor FooGenericArray(/*0*/ x: kotlin.Array) + public final val x: kotlin.Array + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class FooNullable { - public constructor FooNullable(/*0*/ x: T?) - public final val x: T? - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class FooGenericArray2 { + public constructor FooGenericArray2(/*0*/ x: kotlin.Array>) + public final val x: kotlin.Array> + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class FooStarProjectedArray { - public constructor FooStarProjectedArray(/*0*/ x: kotlin.Array<*>) - public final val x: kotlin.Array<*> - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class FooNullable { + public constructor FooNullable(/*0*/ x: T?) + public final val x: T? + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class FooStarProjectedArray2 { - public constructor FooStarProjectedArray2(/*0*/ x: kotlin.Array>) - public final val x: kotlin.Array> - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + @kotlin.jvm.JvmInline public final value class FooStarProjectedArray { + public constructor FooStarProjectedArray(/*0*/ x: kotlin.Array<*>) + public final val x: kotlin.Array<*> + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } - public final annotation class JvmInline : kotlin.Annotation { - public constructor JvmInline() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + @kotlin.jvm.JvmInline public final value class FooStarProjectedArray2 { + public constructor FooStarProjectedArray2(/*0*/ x: kotlin.Array>) + public final val x: kotlin.Array> + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } } } diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.fir.kt index 29a43c81ef1..2a99108dd6a 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.fir.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.fir.kt @@ -1,6 +1,6 @@ // !LANGUAGE: +InlineClasses -package kotlin +package kotlin.jvm import kotlin.reflect.KClass diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.kt index efcd653369d..6f583fff243 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.kt @@ -1,6 +1,6 @@ // !LANGUAGE: +InlineClasses -package kotlin +package kotlin.jvm import kotlin.reflect.KClass diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.txt b/compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.txt index 3cf8b5549cb..c1f5e47fe37 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.txt @@ -2,58 +2,61 @@ package package kotlin { - public final annotation class Ann1 : kotlin.Annotation { - public constructor Ann1(/*0*/ a: kotlin.MyInt) - public final val a: kotlin.MyInt - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + package kotlin.jvm { - public final annotation class Ann2 : kotlin.Annotation { - public constructor Ann2(/*0*/ a: kotlin.Array) - public final val a: kotlin.Array - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + public final annotation class Ann1 : kotlin.Annotation { + public constructor Ann1(/*0*/ a: kotlin.jvm.MyInt) + public final val a: kotlin.jvm.MyInt + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - public final annotation class Ann3 : kotlin.Annotation { - public constructor Ann3(/*0*/ vararg a: kotlin.MyInt /*kotlin.Array*/) - public final val a: kotlin.Array - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + public final annotation class Ann2 : kotlin.Annotation { + public constructor Ann2(/*0*/ a: kotlin.Array) + public final val a: kotlin.Array + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - public final annotation class Ann4 : kotlin.Annotation { - public constructor Ann4(/*0*/ a: kotlin.reflect.KClass) - public final val a: kotlin.reflect.KClass - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + public final annotation class Ann3 : kotlin.Annotation { + public constructor Ann3(/*0*/ vararg a: kotlin.jvm.MyInt /*kotlin.Array*/) + public final val a: kotlin.Array + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - public final annotation class JvmInline : kotlin.Annotation { - public constructor JvmInline() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + public final annotation class Ann4 : kotlin.Annotation { + public constructor Ann4(/*0*/ a: kotlin.reflect.KClass) + public final val a: kotlin.reflect.KClass + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class MyInt { - public constructor MyInt(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class MyString { - public constructor MyString(/*0*/ x: kotlin.String) - public final val x: kotlin.String - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + @kotlin.jvm.JvmInline public final value class MyInt { + public constructor MyInt(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class MyString { + public constructor MyString(/*0*/ x: kotlin.String) + public final val x: kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } } } diff --git a/compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.fir.kt index 8347b2f9779..3c5e49a25cc 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.fir.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.fir.kt @@ -1,7 +1,7 @@ // !LANGUAGE: +InlineClasses // !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE, -UNUSED_ANONYMOUS_PARAMETER -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.kt b/compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.kt index 56af413cbbd..b12960baf06 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.kt @@ -1,7 +1,7 @@ // !LANGUAGE: +InlineClasses // !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE, -UNUSED_ANONYMOUS_PARAMETER -package kotlin +package kotlin.jvm annotation class JvmInline diff --git a/compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.txt b/compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.txt index 3577155821f..486b3c1047f 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.txt @@ -1,46 +1,49 @@ package package kotlin { - public fun f1(/*0*/ vararg a: kotlin.Foo /*kotlin.Array*/): kotlin.Unit - public fun f2(/*0*/ vararg a: kotlin.Foo? /*kotlin.Array*/): kotlin.Unit - public final class A { - public constructor A() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun f3(/*0*/ a0: kotlin.Int, /*1*/ vararg a1: kotlin.Foo /*kotlin.Array*/): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + package kotlin.jvm { + public fun f1(/*0*/ vararg a: kotlin.jvm.Foo /*kotlin.Array*/): kotlin.Unit + public fun f2(/*0*/ vararg a: kotlin.jvm.Foo? /*kotlin.Array*/): kotlin.Unit - public final annotation class Ann : kotlin.Annotation { - public constructor Ann(/*0*/ vararg f: kotlin.Foo /*kotlin.Array*/) - public final val f: kotlin.Array - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + public final class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final fun f3(/*0*/ a0: kotlin.Int, /*1*/ vararg a1: kotlin.jvm.Foo /*kotlin.Array*/): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - public final class B { - public constructor B(/*0*/ vararg s: kotlin.Foo /*kotlin.Array*/) - public constructor B(/*0*/ a: kotlin.Int, /*1*/ vararg s: kotlin.Foo /*kotlin.Array*/) - public final val s: kotlin.Array - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } + public final annotation class Ann : kotlin.Annotation { + public constructor Ann(/*0*/ vararg f: kotlin.jvm.Foo /*kotlin.Array*/) + public final val f: kotlin.Array + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - @kotlin.JvmInline public final value class Foo { - public constructor Foo(/*0*/ x: kotlin.Int) - public final val x: kotlin.Int - public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String - } + public final class B { + public constructor B(/*0*/ vararg s: kotlin.jvm.Foo /*kotlin.Array*/) + public constructor B(/*0*/ a: kotlin.Int, /*1*/ vararg s: kotlin.jvm.Foo /*kotlin.Array*/) + public final val s: kotlin.Array + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } - public final annotation class JvmInline : kotlin.Annotation { - public constructor JvmInline() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + @kotlin.jvm.JvmInline public final value class Foo { + public constructor Foo(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } } } diff --git a/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/HiddenConstructorWithInlineClassParameters.txt b/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/HiddenConstructorWithInlineClassParameters.txt index 5a96613bc75..cbef850e2ac 100644 --- a/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/HiddenConstructorWithInlineClassParameters.txt +++ b/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/HiddenConstructorWithInlineClassParameters.txt @@ -24,7 +24,7 @@ public final class Test { public final fun (): test.Z } -public final value class Z { +@kotlin.jvm.JvmInline /* annotation class not found */ public final value class Z { /*primary*/ public constructor Z(/*0*/ x: kotlin.Int) public final val x: kotlin.Int public final fun (): kotlin.Int diff --git a/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.runtime.txt b/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.runtime.txt index 92185af7855..6f275e6fa55 100644 --- a/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.runtime.txt +++ b/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.runtime.txt @@ -1,6 +1,6 @@ package test -public final value class Z { +@kotlin.jvm.JvmInline public final value class Z { /*primary*/ internal constructor Z(/*0*/ kotlin.Int) public final val value: kotlin.Int public final fun (): kotlin.Int diff --git a/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.txt b/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.txt index 4b2803557ad..286d44d0736 100644 --- a/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.txt +++ b/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.txt @@ -1,6 +1,6 @@ package test -public final value class Z { +@kotlin.jvm.JvmInline /* annotation class not found */ public final value class Z { /*primary*/ @kotlin.PublishedApi internal constructor Z(/*0*/ value: kotlin.Int) public final val value: kotlin.Int public final fun (): kotlin.Int diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/inlineClassesUtils.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/inlineClassesUtils.kt index b3804f4d0d2..2e3652765b8 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/inlineClassesUtils.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/inlineClassesUtils.kt @@ -13,7 +13,7 @@ import org.jetbrains.kotlin.types.TypeUtils import org.jetbrains.kotlin.types.Variance import org.jetbrains.kotlin.utils.addToStdlib.safeAs -val JVM_INLINE_ANNOTATION_FQ_NAME = FqName("kotlin.JvmInline") +val JVM_INLINE_ANNOTATION_FQ_NAME = FqName("kotlin.jvm.JvmInline") fun ClassDescriptor.underlyingRepresentation(): ValueParameterDescriptor? { if (!isInlineClass()) return null From f0a787551a28a5dd7ceb5d0d3b1eba7a73e10d46 Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Tue, 1 Dec 2020 01:34:28 +0100 Subject: [PATCH 366/698] Value classes: Raise retention of @JvmInline to RUNTIME so it will be visible by reflection --- .../runtime/kotlin/jvm/annotations/JvmPlatformAnnotations.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/stdlib/jvm/runtime/kotlin/jvm/annotations/JvmPlatformAnnotations.kt b/libraries/stdlib/jvm/runtime/kotlin/jvm/annotations/JvmPlatformAnnotations.kt index a6b653496ab..92015204695 100644 --- a/libraries/stdlib/jvm/runtime/kotlin/jvm/annotations/JvmPlatformAnnotations.kt +++ b/libraries/stdlib/jvm/runtime/kotlin/jvm/annotations/JvmPlatformAnnotations.kt @@ -141,7 +141,7 @@ public actual annotation class JvmWildcard * in their signature are mangled. */ @Target(AnnotationTarget.CLASS) -@Retention(AnnotationRetention.BINARY) +@Retention(AnnotationRetention.RUNTIME) @MustBeDocumented @SinceKotlin("1.5") public actual annotation class JvmInline \ No newline at end of file From 14b773c1fd1e9c3967f1b5a206e53b2a1530d181 Mon Sep 17 00:00:00 2001 From: Georgy Bronnikov Date: Thu, 26 Nov 2020 23:03:38 +0300 Subject: [PATCH 367/698] JVM_IR: do not rely on DescriptorWithContainerSource in InlineCodegen --- .../kotlin/codegen/inline/InlineCodegen.kt | 61 +++++++++---------- .../inline/InlineCodegenForDefaultBody.kt | 8 +-- .../kotlin/codegen/inline/PsiInlineCodegen.kt | 5 ++ .../backend/jvm/codegen/IrInlineCodegen.kt | 10 +++ .../backend/jvm/codegen/irCodegenUtils.kt | 8 ++- 5 files changed, 54 insertions(+), 38 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InlineCodegen.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InlineCodegen.kt index 385a868fb98..7365e345fa9 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InlineCodegen.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InlineCodegen.kt @@ -136,9 +136,7 @@ abstract class InlineCodegen( ) { var nodeAndSmap: SMAPAndMethodNode? = null try { - nodeAndSmap = createInlineMethodNode( - functionDescriptor, methodOwner, jvmSignature, mapDefaultSignature, typeArguments, typeSystem, state, sourceCompiler - ) + nodeAndSmap = createInlineMethodNode(mapDefaultSignature, typeArguments, typeSystem) endCall(inlineCall(nodeAndSmap, inlineDefaultLambdas), registerLineNumberAfterwards) } catch (e: CompilationException) { throw e @@ -274,6 +272,8 @@ abstract class InlineCodegen( abstract fun extractDefaultLambdas(node: MethodNode): List + abstract fun isLoadedFromBytecode(memberDescriptor: CallableMemberDescriptor): Boolean + fun generateAndInsertFinallyBlocks( intoNode: MethodNode, insertPoints: List, @@ -512,38 +512,33 @@ abstract class InlineCodegen( } - companion object { - - internal fun createInlineMethodNode( - functionDescriptor: FunctionDescriptor, - methodOwner: Type, - jvmSignature: JvmMethodSignature, - callDefault: Boolean, - typeArguments: List?, - typeSystem: TypeSystemCommonBackendContext, - state: GenerationState, - sourceCompilerForInline: SourceCompilerForInline - ): SMAPAndMethodNode { - val intrinsic = generateInlineIntrinsic(state, functionDescriptor, typeArguments, typeSystem) - if (intrinsic != null) { - return SMAPAndMethodNode(intrinsic, createDefaultFakeSMAP()) - } - - val asmMethod = if (callDefault) - state.typeMapper.mapDefaultMethod(functionDescriptor, sourceCompilerForInline.contextKind) - else - mangleSuspendInlineFunctionAsmMethodIfNeeded(functionDescriptor, jvmSignature.asmMethod) - - val directMember = getDirectMemberAndCallableFromObject(functionDescriptor) - if (!isBuiltInArrayIntrinsic(functionDescriptor) && directMember !is DescriptorWithContainerSource) { - val node = sourceCompilerForInline.doCreateMethodNodeFromSource(functionDescriptor, jvmSignature, callDefault, asmMethod) - node.node.preprocessSuspendMarkers(forInline = true, keepFakeContinuation = false) - return node - } - - return getCompiledMethodNodeInner(functionDescriptor, directMember, asmMethod, methodOwner, state, jvmSignature) + internal fun createInlineMethodNode( + callDefault: Boolean, + typeArguments: List?, + typeSystem: TypeSystemCommonBackendContext + ): SMAPAndMethodNode { + val intrinsic = generateInlineIntrinsic(state, functionDescriptor, typeArguments, typeSystem) + if (intrinsic != null) { + return SMAPAndMethodNode(intrinsic, createDefaultFakeSMAP()) } + val asmMethod = if (callDefault) + state.typeMapper.mapDefaultMethod(functionDescriptor, sourceCompiler.contextKind) + else + mangleSuspendInlineFunctionAsmMethodIfNeeded(functionDescriptor, jvmSignature.asmMethod) + + val directMember = getDirectMemberAndCallableFromObject(functionDescriptor) + if (!isBuiltInArrayIntrinsic(functionDescriptor) && !isLoadedFromBytecode(directMember)) { + val node = sourceCompiler.doCreateMethodNodeFromSource(functionDescriptor, jvmSignature, callDefault, asmMethod) + node.node.preprocessSuspendMarkers(forInline = true, keepFakeContinuation = false) + return node + } + + return getCompiledMethodNodeInner(functionDescriptor, directMember, asmMethod, methodOwner, state, jvmSignature) + } + + companion object { + internal fun createSpecialInlineMethodNodeFromBinaries(functionDescriptor: FunctionDescriptor, state: GenerationState): MethodNode { val directMember = getDirectMemberAndCallableFromObject(functionDescriptor) assert(directMember is DescriptorWithContainerSource) { diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InlineCodegenForDefaultBody.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InlineCodegenForDefaultBody.kt index 777ce5dec7f..d0b343c16e0 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InlineCodegenForDefaultBody.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InlineCodegenForDefaultBody.kt @@ -6,7 +6,6 @@ package org.jetbrains.kotlin.codegen.inline import org.jetbrains.kotlin.codegen.* -import org.jetbrains.kotlin.codegen.linkWithLabel import org.jetbrains.kotlin.codegen.state.GenerationState import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor @@ -16,7 +15,6 @@ import org.jetbrains.kotlin.resolve.inline.InlineUtil import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature import org.jetbrains.org.objectweb.asm.Label import org.jetbrains.org.objectweb.asm.Type -import org.jetbrains.org.objectweb.asm.tree.LabelNode import org.jetbrains.org.objectweb.asm.tree.MethodNode class InlineCodegenForDefaultBody( @@ -41,8 +39,10 @@ class InlineCodegenForDefaultBody( } override fun genCallInner(callableMethod: Callable, resolvedCall: ResolvedCall<*>?, callDefault: Boolean, codegen: ExpressionCodegen) { - val nodeAndSmap = InlineCodegen.createInlineMethodNode( - function, methodOwner, jvmSignature, callDefault, null, codegen.typeSystem, state, sourceCompilerForInline + val nodeAndSmap = PsiInlineCodegen( + codegen, state, function, methodOwner, jvmSignature, TypeParameterMappings(), sourceCompilerForInline + ).createInlineMethodNode( + callDefault, null, codegen.typeSystem ) val childSourceMapper = SourceMapCopier(sourceMapper, nodeAndSmap.classSMAP) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/PsiInlineCodegen.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/PsiInlineCodegen.kt index 85781dd6a10..d50fd29e24b 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/PsiInlineCodegen.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/PsiInlineCodegen.kt @@ -10,6 +10,7 @@ import org.jetbrains.kotlin.codegen.* import org.jetbrains.kotlin.codegen.DescriptorAsmUtil.getMethodAsmFlags import org.jetbrains.kotlin.codegen.binding.CodegenBinding import org.jetbrains.kotlin.codegen.state.GenerationState +import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor import org.jetbrains.kotlin.psi.KtCallableReferenceExpression @@ -25,6 +26,7 @@ import org.jetbrains.kotlin.resolve.inline.InlineUtil.isInlinableParameterExpres import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue +import org.jetbrains.kotlin.serialization.deserialization.descriptors.DescriptorWithContainerSource import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.org.objectweb.asm.Opcodes import org.jetbrains.org.objectweb.asm.Type @@ -208,4 +210,7 @@ class PsiInlineCodegen( ::PsiDefaultLambda ) } + + override fun isLoadedFromBytecode(memberDescriptor: CallableMemberDescriptor): Boolean = + memberDescriptor is DescriptorWithContainerSource } diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineCodegen.kt index 8ec2f91e44e..405ae417c54 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineCodegen.kt @@ -13,9 +13,12 @@ import org.jetbrains.kotlin.codegen.StackValue import org.jetbrains.kotlin.codegen.ValueKind import org.jetbrains.kotlin.codegen.inline.* import org.jetbrains.kotlin.codegen.state.GenerationState +import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor import org.jetbrains.kotlin.ir.declarations.* +import org.jetbrains.kotlin.ir.descriptors.IrBasedPropertyDescriptor +import org.jetbrains.kotlin.ir.descriptors.IrBasedSimpleFunctionDescriptor import org.jetbrains.kotlin.ir.descriptors.toIrBasedDescriptor import org.jetbrains.kotlin.ir.descriptors.toIrBasedKotlinType import org.jetbrains.kotlin.ir.expressions.* @@ -161,6 +164,13 @@ class IrInlineCodegen( ::IrDefaultLambda ) } + + override fun isLoadedFromBytecode(memberDescriptor: CallableMemberDescriptor): Boolean = + when (memberDescriptor) { + is IrBasedSimpleFunctionDescriptor -> memberDescriptor.owner.classId != null + is IrBasedPropertyDescriptor -> memberDescriptor.owner.classId != null + else -> false + } } class IrExpressionLambdaImpl( diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt index 31eca3332a6..5cbc6252281 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt @@ -394,7 +394,7 @@ fun IrSimpleType.isRawType(): Boolean = hasAnnotation(JvmGeneratorExtensions.RAW_TYPE_ANNOTATION_FQ_NAME) internal fun classFileContainsMethod(function: IrFunction, context: JvmBackendContext, name: String): Boolean? { - val classId = (function.containerSource as? JvmPackagePartSource)?.classId ?: (function.parent as? IrClass)?.classId ?: return null + val classId = function.classId ?: return null val originalDescriptor = context.methodSignatureMapper.mapSignatureWithGeneric(function).asmMethod.descriptor val descriptor = if (function.isSuspend) listOf(*Type.getArgumentTypes(originalDescriptor), Type.getObjectType("kotlin/coroutines/Continuation")) @@ -403,6 +403,12 @@ internal fun classFileContainsMethod(function: IrFunction, context: JvmBackendCo return classFileContainsMethod(classId, context.state, Method(name, descriptor)) } +val IrFunction.classId: ClassId? + get() = (containerSource as? JvmPackagePartSource)?.classId ?: (parent as? IrClass)?.classId + +val IrProperty.classId: ClassId? + get() = (containerSource as? JvmPackagePartSource)?.classId ?: (parent as? IrClass)?.classId + // Translated into IR-based terms from classifierDescriptor?.classId val IrClass.classId: ClassId? get() = when (val parent = parent) { From c0cd9064d72740aaed9133cb1355eb1eadf911fe Mon Sep 17 00:00:00 2001 From: Georgy Bronnikov Date: Fri, 27 Nov 2020 11:29:02 +0300 Subject: [PATCH 368/698] IR: IrMemberWithContainerSource --- .../kotlin/codegen/inline/InlineCodegen.kt | 4 ++-- .../kotlin/codegen/inline/PsiInlineCodegen.kt | 2 +- .../kotlin/backend/jvm/codegen/IrInlineCodegen.kt | 13 +++---------- .../kotlin/backend/jvm/codegen/irCodegenUtils.kt | 7 ++----- .../kotlin/ir/declarations/IrDeclaration.kt | 5 +++++ .../jetbrains/kotlin/ir/declarations/IrFunction.kt | 3 +-- .../jetbrains/kotlin/ir/declarations/IrProperty.kt | 5 ++--- 7 files changed, 16 insertions(+), 23 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InlineCodegen.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InlineCodegen.kt index 7365e345fa9..c578ef0058d 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InlineCodegen.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InlineCodegen.kt @@ -272,7 +272,7 @@ abstract class InlineCodegen( abstract fun extractDefaultLambdas(node: MethodNode): List - abstract fun isLoadedFromBytecode(memberDescriptor: CallableMemberDescriptor): Boolean + abstract fun descriptorIsDeserialized(memberDescriptor: CallableMemberDescriptor): Boolean fun generateAndInsertFinallyBlocks( intoNode: MethodNode, @@ -528,7 +528,7 @@ abstract class InlineCodegen( mangleSuspendInlineFunctionAsmMethodIfNeeded(functionDescriptor, jvmSignature.asmMethod) val directMember = getDirectMemberAndCallableFromObject(functionDescriptor) - if (!isBuiltInArrayIntrinsic(functionDescriptor) && !isLoadedFromBytecode(directMember)) { + if (!isBuiltInArrayIntrinsic(functionDescriptor) && !descriptorIsDeserialized(directMember)) { val node = sourceCompiler.doCreateMethodNodeFromSource(functionDescriptor, jvmSignature, callDefault, asmMethod) node.node.preprocessSuspendMarkers(forInline = true, keepFakeContinuation = false) return node diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/PsiInlineCodegen.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/PsiInlineCodegen.kt index d50fd29e24b..1e6e2aaaa28 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/PsiInlineCodegen.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/PsiInlineCodegen.kt @@ -211,6 +211,6 @@ class PsiInlineCodegen( ) } - override fun isLoadedFromBytecode(memberDescriptor: CallableMemberDescriptor): Boolean = + override fun descriptorIsDeserialized(memberDescriptor: CallableMemberDescriptor): Boolean = memberDescriptor is DescriptorWithContainerSource } diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineCodegen.kt index 405ae417c54..7a3212d9e24 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineCodegen.kt @@ -17,10 +17,7 @@ import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor import org.jetbrains.kotlin.ir.declarations.* -import org.jetbrains.kotlin.ir.descriptors.IrBasedPropertyDescriptor -import org.jetbrains.kotlin.ir.descriptors.IrBasedSimpleFunctionDescriptor -import org.jetbrains.kotlin.ir.descriptors.toIrBasedDescriptor -import org.jetbrains.kotlin.ir.descriptors.toIrBasedKotlinType +import org.jetbrains.kotlin.ir.descriptors.* import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.types.classOrNull @@ -165,12 +162,8 @@ class IrInlineCodegen( ) } - override fun isLoadedFromBytecode(memberDescriptor: CallableMemberDescriptor): Boolean = - when (memberDescriptor) { - is IrBasedSimpleFunctionDescriptor -> memberDescriptor.owner.classId != null - is IrBasedPropertyDescriptor -> memberDescriptor.owner.classId != null - else -> false - } + override fun descriptorIsDeserialized(memberDescriptor: CallableMemberDescriptor): Boolean = + ((memberDescriptor as IrBasedDeclarationDescriptor<*>).owner as IrMemberWithContainerSource).parentClassId != null } class IrExpressionLambdaImpl( diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt index 5cbc6252281..42abe973335 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt @@ -394,7 +394,7 @@ fun IrSimpleType.isRawType(): Boolean = hasAnnotation(JvmGeneratorExtensions.RAW_TYPE_ANNOTATION_FQ_NAME) internal fun classFileContainsMethod(function: IrFunction, context: JvmBackendContext, name: String): Boolean? { - val classId = function.classId ?: return null + val classId = function.parentClassId ?: return null val originalDescriptor = context.methodSignatureMapper.mapSignatureWithGeneric(function).asmMethod.descriptor val descriptor = if (function.isSuspend) listOf(*Type.getArgumentTypes(originalDescriptor), Type.getObjectType("kotlin/coroutines/Continuation")) @@ -403,10 +403,7 @@ internal fun classFileContainsMethod(function: IrFunction, context: JvmBackendCo return classFileContainsMethod(classId, context.state, Method(name, descriptor)) } -val IrFunction.classId: ClassId? - get() = (containerSource as? JvmPackagePartSource)?.classId ?: (parent as? IrClass)?.classId - -val IrProperty.classId: ClassId? +val IrMemberWithContainerSource.parentClassId: ClassId? get() = (containerSource as? JvmPackagePartSource)?.classId ?: (parent as? IrClass)?.classId // Translated into IR-based terms from classifierDescriptor?.classId diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrDeclaration.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrDeclaration.kt index ae72784598d..83658d9b115 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrDeclaration.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrDeclaration.kt @@ -25,6 +25,7 @@ import org.jetbrains.kotlin.ir.IrStatement import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI import org.jetbrains.kotlin.ir.symbols.IrSymbol import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource interface IrSymbolOwner : IrElement { val symbol: IrSymbol @@ -66,3 +67,7 @@ interface IrDeclarationWithName : IrDeclaration { interface IrOverridableMember : IrDeclarationWithVisibility, IrDeclarationWithName, IrSymbolOwner { val modality: Modality } + +interface IrMemberWithContainerSource : IrDeclarationWithName { + val containerSource: DeserializedContainerSource? +} diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrFunction.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrFunction.kt index 83790155c5a..d00c6c18dc3 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrFunction.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrFunction.kt @@ -31,6 +31,7 @@ import org.jetbrains.kotlin.serialization.deserialization.descriptors.Deserializ abstract class IrFunction : IrDeclarationBase(), IrDeclarationWithName, IrDeclarationWithVisibility, IrTypeParametersContainer, IrSymbolOwner, IrDeclarationParent, IrReturnTarget, + IrMemberWithContainerSource, IrMetadataSourceOwner { @ObsoleteDescriptorBasedAPI @@ -49,8 +50,6 @@ abstract class IrFunction : abstract var body: IrBody? - abstract val containerSource: DeserializedContainerSource? - override fun acceptChildren(visitor: IrElementVisitor, data: D) { typeParameters.forEach { it.accept(visitor, data) } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrProperty.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrProperty.kt index eaaa52f6925..27435508549 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrProperty.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrProperty.kt @@ -23,7 +23,8 @@ import org.jetbrains.kotlin.ir.visitors.IrElementTransformer import org.jetbrains.kotlin.ir.visitors.IrElementVisitor import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource -abstract class IrProperty : IrDeclarationBase(), IrOverridableMember, IrMetadataSourceOwner, IrAttributeContainer { +abstract class IrProperty : + IrDeclarationBase(), IrOverridableMember, IrMetadataSourceOwner, IrAttributeContainer, IrMemberWithContainerSource { @ObsoleteDescriptorBasedAPI abstract override val descriptor: PropertyDescriptor abstract override val symbol: IrPropertySymbol @@ -40,8 +41,6 @@ abstract class IrProperty : IrDeclarationBase(), IrOverridableMember, IrMetadata abstract var getter: IrSimpleFunction? abstract var setter: IrSimpleFunction? - abstract val containerSource: DeserializedContainerSource? - override fun accept(visitor: IrElementVisitor, data: D): R = visitor.visitProperty(this, data) From b23d7a79b0e5efdcc3393b6dba5c58d8e9471815 Mon Sep 17 00:00:00 2001 From: Georgy Bronnikov Date: Fri, 27 Nov 2020 12:41:49 +0300 Subject: [PATCH 369/698] IR: get rid of WrappedDescriptorWithContainerSource --- .../fir/backend/Fir2IrDeclarationStorage.kt | 8 +--- .../fir/symbols/Fir2IrBindableSymbol.kt | 10 +--- .../kotlin/backend/common/ir/IrUtils.kt | 4 +- .../declarations/declarationBuilders.kt | 10 +--- .../ir/descriptors/IrBasedDescriptors.kt | 48 +++++-------------- .../ir/descriptors/WrappedDescriptors.kt | 25 +++++----- .../jetbrains/kotlin/ir/util/SymbolTable.kt | 12 ++--- 7 files changed, 36 insertions(+), 81 deletions(-) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt index 38b094436be..3f99bf128a7 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt @@ -404,9 +404,7 @@ class Fir2IrDeclarationStorage( factory: (IrSimpleFunctionSymbol) -> IrSimpleFunction ): IrSimpleFunction { if (signature == null) { - val descriptor = - if (containerSource != null) WrappedFunctionDescriptorWithContainerSource() - else WrappedSimpleFunctionDescriptor() + val descriptor = WrappedSimpleFunctionDescriptor() return symbolTable.declareSimpleFunction(descriptor, factory).apply { descriptor.bind(this) } } return symbolTable.declareSimpleFunction(signature, { Fir2IrSimpleFunctionSymbol(signature, containerSource) }, factory) @@ -687,9 +685,7 @@ class Fir2IrDeclarationStorage( factory: (IrPropertySymbol) -> IrProperty ): IrProperty { if (signature == null) { - val descriptor = - if (containerSource != null) WrappedPropertyDescriptorWithContainerSource() - else WrappedPropertyDescriptor() + val descriptor = WrappedPropertyDescriptor() return symbolTable.declareProperty(0, 0, IrDeclarationOrigin.DEFINED, descriptor, isDelegated = false, factory).apply { descriptor.bind(this) } diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/symbols/Fir2IrBindableSymbol.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/symbols/Fir2IrBindableSymbol.kt index 375fc95c964..0e9ea949dff 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/symbols/Fir2IrBindableSymbol.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/symbols/Fir2IrBindableSymbol.kt @@ -6,8 +6,6 @@ package org.jetbrains.kotlin.fir.symbols import org.jetbrains.kotlin.descriptors.DeclarationDescriptor -import org.jetbrains.kotlin.descriptors.SourceElement -import org.jetbrains.kotlin.descriptors.annotations.Annotations import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.descriptors.* @@ -42,8 +40,6 @@ abstract class Fir2IrBindableSymbol WrappedClassDescriptor().apply { bind(owner) } is IrConstructor -> WrappedClassConstructorDescriptor().apply { bind(owner) } is IrSimpleFunction -> when { - containerSource != null -> - WrappedFunctionDescriptorWithContainerSource() owner.name.isSpecial && owner.name.asString().startsWith(GETTER_PREFIX) -> WrappedPropertyGetterDescriptor() owner.name.isSpecial && owner.name.asString().startsWith(SETTER_PREFIX) -> @@ -54,11 +50,7 @@ abstract class Fir2IrBindableSymbol WrappedVariableDescriptor().apply { bind(owner) } is IrValueParameter -> WrappedValueParameterDescriptor().apply { bind(owner) } is IrTypeParameter -> WrappedTypeParameterDescriptor().apply { bind(owner) } - is IrProperty -> if (containerSource != null) { - WrappedPropertyDescriptorWithContainerSource() - } else { - WrappedPropertyDescriptor() - }.apply { bind(owner) } + is IrProperty -> WrappedPropertyDescriptor().apply { bind(owner) } is IrField -> WrappedFieldDescriptor().apply { bind(owner) } is IrTypeAlias -> WrappedTypeAliasDescriptor().apply { bind(owner) } else -> throw IllegalStateException("Unsupported owner in Fir2IrBindableSymbol: $owner") diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/IrUtils.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/IrUtils.kt index 01e5ac7cce1..11074dfd0b5 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/IrUtils.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/IrUtils.kt @@ -497,9 +497,7 @@ fun IrFactory.createStaticFunctionWithReceivers( copyMetadata: Boolean = true, typeParametersFromContext: List = listOf() ): IrSimpleFunction { - val descriptor = (oldFunction.descriptor as? DescriptorWithContainerSource)?.let { - WrappedFunctionDescriptorWithContainerSource() - } ?: WrappedSimpleFunctionDescriptor() + val descriptor = WrappedSimpleFunctionDescriptor() return createFunction( oldFunction.startOffset, oldFunction.endOffset, origin, diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/ir/builders/declarations/declarationBuilders.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/ir/builders/declarations/declarationBuilders.kt index eacfd3de7f5..82081ca4438 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/ir/builders/declarations/declarationBuilders.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/ir/builders/declarations/declarationBuilders.kt @@ -11,8 +11,6 @@ import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.declarations.impl.IrVariableImpl -import org.jetbrains.kotlin.ir.declarations.lazy.IrLazyFunction -import org.jetbrains.kotlin.ir.declarations.lazy.IrLazyProperty import org.jetbrains.kotlin.ir.descriptors.* import org.jetbrains.kotlin.ir.symbols.impl.* import org.jetbrains.kotlin.ir.types.IrType @@ -77,9 +75,7 @@ fun IrClass.addField(fieldName: String, fieldType: IrType, fieldVisibility: Desc @PublishedApi internal fun IrFactory.buildProperty(builder: IrPropertyBuilder): IrProperty = with(builder) { - val wrappedDescriptor = if (originalDeclaration is IrLazyProperty || containerSource != null) - WrappedPropertyDescriptorWithContainerSource() - else WrappedPropertyDescriptor() + val wrappedDescriptor = WrappedPropertyDescriptor() createProperty( startOffset, endOffset, origin, @@ -117,9 +113,7 @@ inline fun IrProperty.addGetter(builder: IrFunctionBuilder.() -> Unit = {}): IrS @PublishedApi internal fun IrFactory.buildFunction(builder: IrFunctionBuilder): IrSimpleFunction = with(builder) { - val wrappedDescriptor = if (originalDeclaration is IrLazyFunction || containerSource != null) - WrappedFunctionDescriptorWithContainerSource() - else WrappedSimpleFunctionDescriptor() + val wrappedDescriptor = WrappedSimpleFunctionDescriptor() createFunction( startOffset, endOffset, origin, IrSimpleFunctionSymbolImpl(wrappedDescriptor), diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrBasedDescriptors.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrBasedDescriptors.kt index 4946c8a249d..7eda3131c75 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrBasedDescriptors.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrBasedDescriptors.kt @@ -13,8 +13,6 @@ import org.jetbrains.kotlin.descriptors.impl.TypeAliasConstructorDescriptor import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI import org.jetbrains.kotlin.ir.declarations.* -import org.jetbrains.kotlin.ir.declarations.lazy.IrLazyFunction -import org.jetbrains.kotlin.ir.declarations.lazy.IrLazyProperty import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol @@ -371,7 +369,9 @@ open class IrBasedVariableDescriptorWithAccessor(owner: IrLocalDelegatedProperty fun IrLocalDelegatedProperty.toIrBasedDescriptor() = IrBasedVariableDescriptorWithAccessor(this) -open class IrBasedSimpleFunctionDescriptor(owner: IrSimpleFunction) : SimpleFunctionDescriptor, +// We make all IR-based function descriptors instances of DescriptorWithContainerSource, and use .parentClassId to +// check whether declaration is deserialized. See IrInlineCodegen.descriptorIsDeserialized +open class IrBasedSimpleFunctionDescriptor(owner: IrSimpleFunction) : SimpleFunctionDescriptor, DescriptorWithContainerSource, IrBasedCallableDescriptor(owner) { override fun getOverriddenDescriptors(): List = owner.overriddenSymbols.map { it.owner.toIrBasedDescriptor() } @@ -402,6 +402,9 @@ open class IrBasedSimpleFunctionDescriptor(owner: IrSimpleFunction) : SimpleFunc override fun isInfix() = false override fun isOperator() = false + override val containerSource: DeserializedContainerSource? + get() = owner.containerSource + override fun getOriginal() = this override fun substitute(substitutor: TypeSubstitutor): SimpleFunctionDescriptor { TODO("") @@ -444,19 +447,8 @@ open class IrBasedSimpleFunctionDescriptor(owner: IrSimpleFunction) : SimpleFunc } } -class IrBasedFunctionDescriptorWithContainerSource(owner: IrSimpleFunction) : IrBasedSimpleFunctionDescriptor(owner), - DescriptorWithContainerSource { - override val containerSource: DeserializedContainerSource? get() = owner.containerSource -} - fun IrSimpleFunction.toIrBasedDescriptor() = - if (originalFunction is IrLazyFunction || containerSource != null) - when { - isGetter -> IrBasedPropertyGetterDescriptorWithContainerSource(this) - isSetter -> IrBasedPropertySetterDescriptorWithContainerSource(this) - else -> IrBasedFunctionDescriptorWithContainerSource(this) - } - else when { + when { isGetter -> IrBasedPropertyGetterDescriptor(this) isSetter -> IrBasedPropertySetterDescriptor(this) else -> IrBasedSimpleFunctionDescriptor(this) @@ -759,7 +751,8 @@ open class IrBasedEnumEntryDescriptor(owner: IrEnumEntry) : ClassDescriptor, IrB fun IrEnumEntry.toIrBasedDescriptor() = IrBasedEnumEntryDescriptor(this) -open class IrBasedPropertyDescriptor(owner: IrProperty) : PropertyDescriptor, IrBasedDeclarationDescriptor(owner) { +open class IrBasedPropertyDescriptor(owner: IrProperty) : + PropertyDescriptor, DescriptorWithContainerSource, IrBasedDeclarationDescriptor(owner) { override fun getModality() = owner.modality override fun setOverriddenDescriptors(overriddenDescriptors: MutableCollection) { @@ -806,6 +799,8 @@ open class IrBasedPropertyDescriptor(owner: IrProperty) : PropertyDescriptor, Ir override val setter: PropertySetterDescriptor? get() = owner.setter?.toIrBasedDescriptor() as? PropertySetterDescriptor + override val containerSource: DeserializedContainerSource? = owner.containerSource + override fun getOriginal() = this override fun isExpect() = false @@ -861,16 +856,7 @@ open class IrBasedPropertyDescriptor(owner: IrProperty) : PropertyDescriptor, Ir override fun getUserData(key: CallableDescriptor.UserDataKey?): V? = null } -class IrBasedPropertyDescriptorWithContainerSource( - owner: IrProperty -) : IrBasedPropertyDescriptor(owner), DescriptorWithContainerSource { - override val containerSource: DeserializedContainerSource? = owner.containerSource -} - -fun IrProperty.toIrBasedDescriptor() = if (originalProperty is IrLazyProperty || containerSource != null) - IrBasedPropertyDescriptorWithContainerSource(this) -else - IrBasedPropertyDescriptor(this) +fun IrProperty.toIrBasedDescriptor() = IrBasedPropertyDescriptor(this) abstract class IrBasedPropertyAccessorDescriptor(owner: IrSimpleFunction) : IrBasedSimpleFunctionDescriptor(owner), PropertyAccessorDescriptor { @@ -891,22 +877,12 @@ open class IrBasedPropertyGetterDescriptor(owner: IrSimpleFunction) : IrBasedPro override fun getOriginal(): IrBasedPropertyGetterDescriptor = this } -class IrBasedPropertyGetterDescriptorWithContainerSource(owner: IrSimpleFunction) : IrBasedPropertyGetterDescriptor(owner), - DescriptorWithContainerSource { - override val containerSource: DeserializedContainerSource? get() = owner.containerSource -} - open class IrBasedPropertySetterDescriptor(owner: IrSimpleFunction) : IrBasedPropertyAccessorDescriptor(owner), PropertySetterDescriptor { override fun getOverriddenDescriptors() = super.getOverriddenDescriptors().map { it as PropertySetterDescriptor } override fun getOriginal(): IrBasedPropertySetterDescriptor = this } -class IrBasedPropertySetterDescriptorWithContainerSource(owner: IrSimpleFunction) : IrBasedPropertySetterDescriptor(owner), - DescriptorWithContainerSource { - override val containerSource: DeserializedContainerSource? get() = owner.containerSource -} - open class IrBasedTypeAliasDescriptor(owner: IrTypeAlias) : IrBasedDeclarationDescriptor(owner), TypeAliasDescriptor { override val underlyingType: SimpleType diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/WrappedDescriptors.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/WrappedDescriptors.kt index 83de1535e70..27be9b26ef3 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/WrappedDescriptors.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/WrappedDescriptors.kt @@ -365,8 +365,11 @@ open class WrappedVariableDescriptorWithAccessor : VariableDescriptorWithAccesso } +// We make all wrapped function descriptors instances of DescriptorWithContainerSource, and use .parentClassId to +// check whether declaration is deserialized. See IrInlineCodegen.descriptorIsDeserialized @OptIn(ObsoleteDescriptorBasedAPI::class) -open class WrappedSimpleFunctionDescriptor : SimpleFunctionDescriptor, WrappedCallableDescriptor() { +open class WrappedSimpleFunctionDescriptor : + SimpleFunctionDescriptor, DescriptorWithContainerSource, WrappedCallableDescriptor() { override fun getOverriddenDescriptors() = owner.overriddenSymbols.map { it.descriptor } @@ -402,6 +405,9 @@ open class WrappedSimpleFunctionDescriptor : SimpleFunctionDescriptor, WrappedCa override fun isInfix() = false override fun isOperator() = false + override val containerSource: DeserializedContainerSource? + get() = owner.containerSource + override fun getOriginal() = this override fun substitute(substitutor: TypeSubstitutor): SimpleFunctionDescriptor { TODO("") @@ -444,12 +450,6 @@ open class WrappedSimpleFunctionDescriptor : SimpleFunctionDescriptor, WrappedCa } } -@OptIn(ObsoleteDescriptorBasedAPI::class) -class WrappedFunctionDescriptorWithContainerSource : WrappedSimpleFunctionDescriptor(), DescriptorWithContainerSource { - override val containerSource - get() = owner.containerSource -} - @OptIn(ObsoleteDescriptorBasedAPI::class) open class WrappedClassConstructorDescriptor : ClassConstructorDescriptor, WrappedCallableDescriptor() { override fun getContainingDeclaration() = (owner.parent as IrClass).descriptor @@ -877,7 +877,8 @@ open class WrappedEnumEntryDescriptor : ClassDescriptor, WrappedDeclarationDescr } @OptIn(ObsoleteDescriptorBasedAPI::class) -open class WrappedPropertyDescriptor : PropertyDescriptor, WrappedDeclarationDescriptor() { +open class WrappedPropertyDescriptor : + PropertyDescriptor, DescriptorWithContainerSource, WrappedDeclarationDescriptor() { override fun getModality() = owner.modality override fun setOverriddenDescriptors(overriddenDescriptors: MutableCollection) { @@ -924,6 +925,9 @@ open class WrappedPropertyDescriptor : PropertyDescriptor, WrappedDeclarationDes override val setter: PropertySetterDescriptor? get() = owner.setter?.descriptor as? PropertySetterDescriptor + override val containerSource: DeserializedContainerSource? + get() = owner.containerSource + override fun getOriginal() = this override fun isExpect() = false @@ -979,11 +983,6 @@ open class WrappedPropertyDescriptor : PropertyDescriptor, WrappedDeclarationDes override fun getUserData(key: CallableDescriptor.UserDataKey?): V? = null } -class WrappedPropertyDescriptorWithContainerSource : WrappedPropertyDescriptor(), DescriptorWithContainerSource { - override val containerSource: DeserializedContainerSource? - get() = owner.containerSource -} - @OptIn(ObsoleteDescriptorBasedAPI::class) abstract class WrappedPropertyAccessorDescriptor : WrappedSimpleFunctionDescriptor(), PropertyAccessorDescriptor { override fun isDefault(): Boolean = false diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt index 3210fcee44e..6987446e2a8 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt @@ -13,8 +13,8 @@ import org.jetbrains.kotlin.ir.declarations.impl.IrScriptImpl import org.jetbrains.kotlin.ir.declarations.impl.IrVariableImpl import org.jetbrains.kotlin.ir.declarations.lazy.IrLazySymbolTable import org.jetbrains.kotlin.ir.descriptors.WrappedDeclarationDescriptor -import org.jetbrains.kotlin.ir.descriptors.WrappedFunctionDescriptorWithContainerSource -import org.jetbrains.kotlin.ir.descriptors.WrappedPropertyDescriptorWithContainerSource +import org.jetbrains.kotlin.ir.descriptors.WrappedPropertyDescriptor +import org.jetbrains.kotlin.ir.descriptors.WrappedSimpleFunctionDescriptor import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrExpressionBody import org.jetbrains.kotlin.ir.symbols.* @@ -1025,24 +1025,24 @@ class SymbolTable( fun wrappedTopLevelCallableDescriptors(): Set { val result = mutableSetOf() for (descriptor in simpleFunctionSymbolTable.descriptorToSymbol.keys) { - if (descriptor is WrappedFunctionDescriptorWithContainerSource && descriptor.owner.parent !is IrClass) { + if (descriptor is WrappedSimpleFunctionDescriptor && descriptor.owner.parent !is IrClass) { result.add(descriptor) } } for (symbol in simpleFunctionSymbolTable.idSigToSymbol.values) { val descriptor = symbol.descriptor - if (descriptor is WrappedFunctionDescriptorWithContainerSource && symbol.owner.parent !is IrClass) { + if (descriptor is WrappedSimpleFunctionDescriptor && symbol.owner.parent !is IrClass) { result.add(descriptor) } } for (descriptor in propertySymbolTable.descriptorToSymbol.keys) { - if (descriptor is WrappedPropertyDescriptorWithContainerSource && descriptor.owner.parent !is IrClass) { + if (descriptor is WrappedPropertyDescriptor && descriptor.owner.parent !is IrClass) { result.add(descriptor) } } for (symbol in propertySymbolTable.idSigToSymbol.values) { val descriptor = symbol.descriptor - if (descriptor is WrappedPropertyDescriptorWithContainerSource && symbol.owner.parent !is IrClass) { + if (descriptor is WrappedPropertyDescriptor && symbol.owner.parent !is IrClass) { result.add(descriptor) } } From 8a969dab7d0aa15f2e0cd5d1dd88e8cdce7f8565 Mon Sep 17 00:00:00 2001 From: Georgy Bronnikov Date: Fri, 27 Nov 2020 16:19:30 +0300 Subject: [PATCH 370/698] Bugfix for FIR --- .../src/org/jetbrains/kotlin/ir/util/SymbolTable.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt index 6987446e2a8..28a46025702 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt @@ -1025,24 +1025,24 @@ class SymbolTable( fun wrappedTopLevelCallableDescriptors(): Set { val result = mutableSetOf() for (descriptor in simpleFunctionSymbolTable.descriptorToSymbol.keys) { - if (descriptor is WrappedSimpleFunctionDescriptor && descriptor.owner.parent !is IrClass) { + if (descriptor is WrappedSimpleFunctionDescriptor && descriptor.owner.parent is IrPackageFragment) { result.add(descriptor) } } for (symbol in simpleFunctionSymbolTable.idSigToSymbol.values) { val descriptor = symbol.descriptor - if (descriptor is WrappedSimpleFunctionDescriptor && symbol.owner.parent !is IrClass) { + if (descriptor is WrappedSimpleFunctionDescriptor && symbol.owner.parent is IrPackageFragment) { result.add(descriptor) } } for (descriptor in propertySymbolTable.descriptorToSymbol.keys) { - if (descriptor is WrappedPropertyDescriptor && descriptor.owner.parent !is IrClass) { + if (descriptor is WrappedPropertyDescriptor && descriptor.owner.parent is IrPackageFragment) { result.add(descriptor) } } for (symbol in propertySymbolTable.idSigToSymbol.values) { val descriptor = symbol.descriptor - if (descriptor is WrappedPropertyDescriptor && symbol.owner.parent !is IrClass) { + if (descriptor is WrappedPropertyDescriptor && symbol.owner.parent is IrPackageFragment) { result.add(descriptor) } } From 2ffedd273112830d8863d4d60c125b8aa45bc539 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Tue, 1 Dec 2020 16:08:08 +0300 Subject: [PATCH 371/698] Fix Daemon compiler tests on Windows In 202 platform tearDown tries to remove temporary directory, but this fails on Windows, because while Daemon is active directory can't be deleted. --- .../build/KotlinJpsBuildTestIncremental.kt | 25 +++----------- .../jps/build/SimpleKotlinJpsBuildTest.kt | 16 ++++----- .../kotlin/jps/build/testingUtils.kt | 34 +++++++++++++++++++ .../compilerRunner/JpsKotlinCompilerRunner.kt | 10 ++++++ 4 files changed, 55 insertions(+), 30 deletions(-) diff --git a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestIncremental.kt b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestIncremental.kt index dba6e9a38d1..7ce1a6b3bd8 100644 --- a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestIncremental.kt +++ b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestIncremental.kt @@ -16,23 +16,16 @@ package org.jetbrains.kotlin.jps.build -import com.intellij.openapi.util.io.FileUtil -import org.jetbrains.jps.builders.CompileScopeTestBuilder -import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments import org.jetbrains.jps.builders.JpsBuildTestCase -import org.jetbrains.jps.builders.logging.BuildLoggingManager +import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments import org.jetbrains.kotlin.compilerRunner.JpsKotlinCompilerRunner import org.jetbrains.kotlin.config.LanguageVersion -import kotlin.reflect.KMutableProperty1 -import org.jetbrains.kotlin.daemon.common.COMPILE_DAEMON_CUSTOM_RUN_FILES_PATH_FOR_TESTS -import org.jetbrains.kotlin.daemon.common.COMPILE_DAEMON_ENABLED_PROPERTY import org.jetbrains.kotlin.daemon.common.isDaemonEnabled -import org.jetbrains.kotlin.incremental.LookupSymbol import org.jetbrains.kotlin.jps.build.fixtures.EnableICFixture import org.jetbrains.kotlin.jps.model.kotlinCommonCompilerArguments import org.jetbrains.kotlin.jps.model.kotlinCompilerArguments -import org.junit.Assert import java.io.File +import kotlin.reflect.KMutableProperty1 class KotlinJpsBuildTestIncremental : KotlinJpsBuildTest() { private val enableICFixture = EnableICFixture() @@ -77,19 +70,11 @@ class KotlinJpsBuildTestIncremental : KotlinJpsBuildTest() { assertCompiled(KotlinBuilder.KOTLIN_BUILDER_NAME, "src/main.kt", "src/Foo.kt") } - val daemonHome = FileUtil.createTempDirectory("daemon-home", "testJpsDaemonIC") - try { - withSystemProperty(COMPILE_DAEMON_CUSTOM_RUN_FILES_PATH_FOR_TESTS, daemonHome.absolutePath) { - withSystemProperty(COMPILE_DAEMON_ENABLED_PROPERTY, "true") { - withSystemProperty(JpsKotlinCompilerRunner.FAIL_ON_FALLBACK_PROPERTY, "true") { - testImpl() - } - } + withDaemon { + withSystemProperty(JpsKotlinCompilerRunner.FAIL_ON_FALLBACK_PROPERTY, "true") { + testImpl() } } - finally { - daemonHome.deleteRecursively() - } } fun testManyFiles() { diff --git a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/SimpleKotlinJpsBuildTest.kt b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/SimpleKotlinJpsBuildTest.kt index 8c915775fa6..7e98717ba8b 100644 --- a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/SimpleKotlinJpsBuildTest.kt +++ b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/SimpleKotlinJpsBuildTest.kt @@ -16,11 +16,11 @@ package org.jetbrains.kotlin.jps.build -import com.intellij.openapi.util.io.FileUtil import com.intellij.util.PathUtil import org.jetbrains.jps.model.java.JpsJavaExtensionService import org.jetbrains.kotlin.compilerRunner.JpsKotlinCompilerRunner -import org.jetbrains.kotlin.daemon.common.* +import org.jetbrains.kotlin.daemon.common.COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY +import org.jetbrains.kotlin.daemon.common.OSKind import org.jetbrains.kotlin.test.KotlinTestUtils import java.io.File @@ -68,14 +68,10 @@ class SimpleKotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() { // TODO: add JS tests fun testDaemon() { - val daemonHome = FileUtil.createTempDirectory("daemon-home", "testJpsDaemonIC") - - withSystemProperty(COMPILE_DAEMON_CUSTOM_RUN_FILES_PATH_FOR_TESTS, daemonHome.absolutePath) { - withSystemProperty(COMPILE_DAEMON_ENABLED_PROPERTY, "true") { - withSystemProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY, "true") { - withSystemProperty(JpsKotlinCompilerRunner.FAIL_ON_FALLBACK_PROPERTY, "true") { - testLoadingKotlinFromDifferentModules() - } + withDaemon { + withSystemProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY, "true") { + withSystemProperty(JpsKotlinCompilerRunner.FAIL_ON_FALLBACK_PROPERTY, "true") { + testLoadingKotlinFromDifferentModules() } } } diff --git a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/testingUtils.kt b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/testingUtils.kt index a5b77e06594..6b2feb62b5d 100644 --- a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/testingUtils.kt +++ b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/testingUtils.kt @@ -16,6 +16,11 @@ package org.jetbrains.kotlin.jps.build +import com.intellij.openapi.util.io.FileUtil +import org.jetbrains.kotlin.compilerRunner.JpsKotlinCompilerRunner +import org.jetbrains.kotlin.daemon.common.COMPILE_DAEMON_CUSTOM_RUN_FILES_PATH_FOR_TESTS +import org.jetbrains.kotlin.daemon.common.COMPILE_DAEMON_ENABLED_PROPERTY + inline fun withSystemProperty(property: String, newValue: String?, fn: ()->Unit) { val backup = System.getProperty(property) setOrClearSysProperty(property, newValue) @@ -37,4 +42,33 @@ inline fun setOrClearSysProperty(property: String, newValue: String?) { else { System.clearProperty(property) } +} + +fun withDaemon(fn: () -> Unit) { + val daemonHome = FileUtil.createTempDirectory("daemon-home", "testJpsDaemonIC") + + withSystemProperty(COMPILE_DAEMON_CUSTOM_RUN_FILES_PATH_FOR_TESTS, daemonHome.absolutePath) { + withSystemProperty(COMPILE_DAEMON_ENABLED_PROPERTY, "true") { + try { + fn() + } finally { + JpsKotlinCompilerRunner.shutdownDaemon() + + // Try to force directory deletion to prevent test failure later in tearDown(). + // Working Daemon can prevent folder deletion on Windows, because Daemon shutdown + // is asynchronous. + var attempts = 0 + daemonHome.deleteRecursively() + while (daemonHome.exists() && attempts < 100) { + daemonHome.deleteRecursively() + attempts++ + Thread.sleep(50) + } + + if (daemonHome.exists()) { + error("Couldn't delete Daemon home directory") + } + } + } + } } \ No newline at end of file diff --git a/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsKotlinCompilerRunner.kt b/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsKotlinCompilerRunner.kt index 5088cfe0fc3..e2d6d835f94 100644 --- a/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsKotlinCompilerRunner.kt +++ b/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsKotlinCompilerRunner.kt @@ -54,6 +54,16 @@ class JpsKotlinCompilerRunner { private var _jpsCompileServiceSession: CompileServiceSession? = null @TestOnly + fun shutdownDaemon() { + _jpsCompileServiceSession?.let { + try { + it.compileService.shutdown() + } catch (_: Throwable) { + } + } + _jpsCompileServiceSession = null + } + fun releaseCompileServiceSession() { _jpsCompileServiceSession?.let { try { From eae8821dec1f66585a61fadc418e068176133204 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 2 Dec 2020 09:27:14 +0300 Subject: [PATCH 372/698] FIR Java: unbind possible named annotation cycle --- .../problems/recursiveNamedAnnotation.kt | 20 +++++++++++++++++++ .../problems/recursiveNamedAnnotation.txt | 7 +++++++ .../fir/FirDiagnosticsTestGenerated.java | 5 +++++ ...DiagnosticsWithLightTreeTestGenerated.java | 5 +++++ ...TouchedTilContractsPhaseTestGenerated.java | 5 +++++ .../kotlin/fir/java/JavaSymbolProvider.kt | 10 ++++++++-- .../jetbrains/kotlin/fir/java/JavaUtils.kt | 2 +- .../IrCodegenBoxWasmTestGenerated.java | 5 ----- 8 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 compiler/fir/analysis-tests/testData/resolve/problems/recursiveNamedAnnotation.kt create mode 100644 compiler/fir/analysis-tests/testData/resolve/problems/recursiveNamedAnnotation.txt diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/recursiveNamedAnnotation.kt b/compiler/fir/analysis-tests/testData/resolve/problems/recursiveNamedAnnotation.kt new file mode 100644 index 00000000000..71fd5b93b63 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolve/problems/recursiveNamedAnnotation.kt @@ -0,0 +1,20 @@ +// FILE: AliasFor.java + +public @interface AliasFor { + @AliasFor(value = "attribute") + String value() default ""; + + @AliasFor(value = "value") + String attribute() default ""; +} + +// FILE: Service.java +public @interface Service { + @AliasFor(value = "component") + String value() default ""; +} + +// FILE: Annotated.kt + +@Service(value = "Your") +class My \ No newline at end of file diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/recursiveNamedAnnotation.txt b/compiler/fir/analysis-tests/testData/resolve/problems/recursiveNamedAnnotation.txt new file mode 100644 index 00000000000..46ecee2487f --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolve/problems/recursiveNamedAnnotation.txt @@ -0,0 +1,7 @@ +FILE: Annotated.kt + @R|Service|(value = String(Your)) public final class My : R|kotlin/Any| { + public constructor(): R|My| { + super() + } + + } diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java index 23c8183147d..39cc95f6058 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java @@ -2079,6 +2079,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest { runTest("compiler/fir/analysis-tests/testData/resolve/problems/questionableSmartCast.kt"); } + @TestMetadata("recursiveNamedAnnotation.kt") + public void testRecursiveNamedAnnotation() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/problems/recursiveNamedAnnotation.kt"); + } + @TestMetadata("safeCallInvoke.kt") public void testSafeCallInvoke() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolve/problems/safeCallInvoke.kt"); diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java index 59c78f4a0d2..ccb0b49c2ac 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java @@ -2079,6 +2079,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos runTest("compiler/fir/analysis-tests/testData/resolve/problems/questionableSmartCast.kt"); } + @TestMetadata("recursiveNamedAnnotation.kt") + public void testRecursiveNamedAnnotation() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/problems/recursiveNamedAnnotation.kt"); + } + @TestMetadata("safeCallInvoke.kt") public void testSafeCallInvoke() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolve/problems/safeCallInvoke.kt"); diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java index a3bc2533eec..71463b1001f 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java @@ -2079,6 +2079,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract runTest("compiler/fir/analysis-tests/testData/resolve/problems/questionableSmartCast.kt"); } + @TestMetadata("recursiveNamedAnnotation.kt") + public void testRecursiveNamedAnnotation() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/problems/recursiveNamedAnnotation.kt"); + } + @TestMetadata("safeCallInvoke.kt") public void testSafeCallInvoke() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolve/problems/safeCallInvoke.kt"); diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaSymbolProvider.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaSymbolProvider.kt index d93fa5c690c..9da1b4d0ca2 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaSymbolProvider.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaSymbolProvider.kt @@ -168,6 +168,7 @@ class JavaSymbolProvider( javaTypeParameterStack.addStack(parentStack) } } + val methodMap = mutableMapOf() val firJavaClass = buildJavaClass { source = (javaClass as? JavaElementImpl<*>)?.psi?.toFirPsiSourceElement() session = this@JavaSymbolProvider.session @@ -219,7 +220,9 @@ class JavaSymbolProvider( classIsAnnotation, valueParametersForAnnotationConstructor, dispatchReceiver - ) + ).apply { + methodMap[javaMethod] = this + } } val javaClassDeclaredConstructors = javaClass.constructors val constructorId = CallableId(classId.packageFqName, classId.relativeClassName, classId.shortClassName) @@ -270,6 +273,10 @@ class JavaSymbolProvider( } ) firJavaClass.addAnnotationsFrom(this@JavaSymbolProvider.session, javaClass, javaTypeParameterStack) + // NB: this is done here to unbind possible annotation cycle + for ((javaMethod, firJavaMethod) in methodMap) { + firJavaMethod.annotations.addAnnotationsFrom(session, javaMethod, javaTypeParameterStack) + } return firJavaClass } @@ -364,7 +371,6 @@ class JavaSymbolProvider( returnTypeRef = returnType.toFirJavaTypeRef(this@JavaSymbolProvider.session, javaTypeParameterStack) isStatic = javaMethod.isStatic typeParameters += javaMethod.typeParameters.convertTypeParameters(javaTypeParameterStack) - addAnnotationsFrom(this@JavaSymbolProvider.session, javaMethod, javaTypeParameterStack) for ((index, valueParameter) in javaMethod.valueParameters.withIndex()) { valueParameters += valueParameter.toFirValueParameter( this@JavaSymbolProvider.session, index, javaTypeParameterStack, diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt index eceb8318ba9..2d2d248a400 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt @@ -485,7 +485,7 @@ internal fun FirJavaClass.addAnnotationsFrom( annotations.addAnnotationsFrom(session, javaAnnotationOwner, javaTypeParameterStack) } -private fun MutableList.addAnnotationsFrom( +internal fun MutableList.addAnnotationsFrom( session: FirSession, javaAnnotationOwner: JavaAnnotationOwner, javaTypeParameterStack: JavaTypeParameterStack diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index e95c41dfedd..c4bbcb442e3 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -5461,11 +5461,6 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest public void testAllFilesPresentInBigArity() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/functions/bigArity"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); } - - @TestMetadata("nestedBigArityFunCalls.kt") - public void testNestedBigArityFunCalls() throws Exception { - runTest("compiler/testData/codegen/box/functions/bigArity/nestedBigArityFunCalls.kt"); - } } @TestMetadata("compiler/testData/codegen/box/functions/functionExpression") From 2429f429c5e2012499b3dcd33bf07139144d725e Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 26 Nov 2020 18:18:34 +0300 Subject: [PATCH 373/698] [FIR] Set isStubTypeEqualsToAnything = true for inference as in FE 1.0 #KT-43616 Fixed --- .../resolve/problems/compilerPhase.kt | 44 +++++++++++++++ .../resolve/problems/compilerPhase.txt | 55 +++++++++++++++++++ .../fir/FirDiagnosticsTestGenerated.java | 5 ++ ...DiagnosticsWithLightTreeTestGenerated.java | 5 ++ ...TouchedTilContractsPhaseTestGenerated.java | 5 ++ .../resolve/inference/InferenceComponents.kt | 2 +- .../kotlin/fir/types/ConeTypeContext.kt | 2 +- .../argumentAndReturnExpectedType.fir.kt | 4 +- .../ir/irText/expressions/kt30796.fir.kt.txt | 4 +- .../ir/irText/expressions/kt30796.fir.txt | 11 ++-- .../typeParametersInImplicitCast.fir.kt.txt | 2 +- .../typeParametersInImplicitCast.fir.txt | 10 ++-- 12 files changed, 131 insertions(+), 18 deletions(-) create mode 100644 compiler/fir/analysis-tests/testData/resolve/problems/compilerPhase.kt create mode 100644 compiler/fir/analysis-tests/testData/resolve/problems/compilerPhase.txt diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/compilerPhase.kt b/compiler/fir/analysis-tests/testData/resolve/problems/compilerPhase.kt new file mode 100644 index 00000000000..7a1446811da --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolve/problems/compilerPhase.kt @@ -0,0 +1,44 @@ +interface CommonBackendContext + +interface PhaserState { + var depth: Int +} + +interface PhaseConfig { + val needProfiling: Boolean +} + +inline fun PhaserState.downlevel(nlevels: Int, block: () -> R): R { + depth += nlevels + val result = block() + depth -= nlevels + return result +} + +interface CompilerPhase { + fun invoke(phaseConfig: PhaseConfig, phaserState: PhaserState, context: Context, input: Input): Output +} + +class NamedCompilerPhase( + private val lower: CompilerPhase +) : CompilerPhase { + override fun invoke(phaseConfig: PhaseConfig, phaserState: PhaserState, context: Context, input: Data): Data { + // Expected: output: Data, Actual: output: Data? + val output = if (phaseConfig.needProfiling) { + runAndProfile(phaseConfig, phaserState, context, input) + } else { + phaserState.downlevel(1) { + lower.invoke(phaseConfig, phaserState, context, input) + } + } + runAfter(phaseConfig, phaserState, context, output) + } + + private fun runAfter(phaseConfig: PhaseConfig, phaserState: PhaserState, context: Context, output: Data) { + + } + + private fun runAndProfile(phaseConfig: PhaseConfig, phaserState: PhaserState, context: Context, source: Data): Data { + + } +} \ No newline at end of file diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/compilerPhase.txt b/compiler/fir/analysis-tests/testData/resolve/problems/compilerPhase.txt new file mode 100644 index 00000000000..e574055d543 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolve/problems/compilerPhase.txt @@ -0,0 +1,55 @@ +FILE: compilerPhase.kt + public abstract interface CommonBackendContext : R|kotlin/Any| { + } + public abstract interface PhaserState : R|kotlin/Any| { + public abstract var depth: R|kotlin/Int| + public get(): R|kotlin/Int| + public set(value: R|kotlin/Int|): R|kotlin/Unit| + + } + public abstract interface PhaseConfig : R|kotlin/Any| { + public abstract val needProfiling: R|kotlin/Boolean| + public get(): R|kotlin/Boolean| + + } + public final inline fun R|PhaserState|.downlevel(nlevels: R|kotlin/Int|, block: R|() -> R|): R|R| { + this@R|/downlevel|.R|/PhaserState.depth| = this@R|/downlevel|.R|/PhaserState.depth|.R|kotlin/Int.plus|(R|/nlevels|) + lval result: R|R| = R|/block|.R|SubstitutionOverride|() + this@R|/downlevel|.R|/PhaserState.depth| = this@R|/downlevel|.R|/PhaserState.depth|.R|kotlin/Int.minus|(R|/nlevels|) + ^downlevel R|/result| + } + public abstract interface CompilerPhase : R|kotlin/Any| { + public abstract fun invoke(phaseConfig: R|PhaseConfig|, phaserState: R|PhaserState|, context: R|Context|, input: R|Input|): R|Output| + + } + public final class NamedCompilerPhase : R|CompilerPhase| { + public constructor(lower: R|CompilerPhase|): R|NamedCompilerPhase| { + super() + } + + private final val lower: R|CompilerPhase| = R|/lower| + private get(): R|CompilerPhase| + + public final override fun invoke(phaseConfig: R|PhaseConfig|, phaserState: R|PhaserState|, context: R|Context|, input: R|Data|): R|Data| { + lval output: R|Data| = when () { + R|/phaseConfig|.R|/PhaseConfig.needProfiling| -> { + this@R|/NamedCompilerPhase|.R|/NamedCompilerPhase.runAndProfile|(R|/phaseConfig|, R|/phaserState|, R|/context|, R|/input|) + } + else -> { + R|/phaserState|.R|/downlevel|(Int(1), = downlevel@fun (): R|Data| { + ^ this@R|/NamedCompilerPhase|.R|/NamedCompilerPhase.lower|.R|SubstitutionOverride|(R|/phaseConfig|, R|/phaserState|, R|/context|, R|/input|) + } + ) + } + } + + this@R|/NamedCompilerPhase|.R|/NamedCompilerPhase.runAfter|(R|/phaseConfig|, R|/phaserState|, R|/context|, R|/output|) + } + + private final fun runAfter(phaseConfig: R|PhaseConfig|, phaserState: R|PhaserState|, context: R|Context|, output: R|Data|): R|kotlin/Unit| { + } + + private final fun runAndProfile(phaseConfig: R|PhaseConfig|, phaserState: R|PhaserState|, context: R|Context|, source: R|Data|): R|Data| { + } + + } diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java index 39cc95f6058..9e8a81ab802 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java @@ -2024,6 +2024,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/problems"), Pattern.compile("^([^.]+)\\.kt$"), null, true); } + @TestMetadata("compilerPhase.kt") + public void testCompilerPhase() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/problems/compilerPhase.kt"); + } + @TestMetadata("complexLambdaWithTypeVariableAsExpectedType.kt") public void testComplexLambdaWithTypeVariableAsExpectedType() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolve/problems/complexLambdaWithTypeVariableAsExpectedType.kt"); diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java index ccb0b49c2ac..fb36942a569 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java @@ -2024,6 +2024,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/problems"), Pattern.compile("^([^.]+)\\.kt$"), null, true); } + @TestMetadata("compilerPhase.kt") + public void testCompilerPhase() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/problems/compilerPhase.kt"); + } + @TestMetadata("complexLambdaWithTypeVariableAsExpectedType.kt") public void testComplexLambdaWithTypeVariableAsExpectedType() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolve/problems/complexLambdaWithTypeVariableAsExpectedType.kt"); diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java index 71463b1001f..3cb1851cae2 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java @@ -2024,6 +2024,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/problems"), Pattern.compile("^([^.]+)\\.kt$"), null, true); } + @TestMetadata("compilerPhase.kt") + public void testCompilerPhase() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/problems/compilerPhase.kt"); + } + @TestMetadata("complexLambdaWithTypeVariableAsExpectedType.kt") public void testComplexLambdaWithTypeVariableAsExpectedType() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolve/problems/complexLambdaWithTypeVariableAsExpectedType.kt"); diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/InferenceComponents.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/InferenceComponents.kt index cb1df83b5c1..ec132d66375 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/InferenceComponents.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/InferenceComponents.kt @@ -14,7 +14,7 @@ import org.jetbrains.kotlin.types.AbstractTypeApproximator @NoMutableState class InferenceComponents(val session: FirSession) : FirSessionComponent { - val ctx: ConeTypeCheckerContext = ConeTypeCheckerContext(isErrorTypeEqualsToAnything = false, isStubTypeEqualsToAnything = false, session) + val ctx: ConeTypeCheckerContext = ConeTypeCheckerContext(isErrorTypeEqualsToAnything = false, isStubTypeEqualsToAnything = true, session) val approximator: AbstractTypeApproximator = object : AbstractTypeApproximator(ctx) {} val trivialConstraintTypeInferenceOracle = TrivialConstraintTypeInferenceOracle.create(ctx) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/ConeTypeContext.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/ConeTypeContext.kt index fdb35bc8da0..b6905baca37 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/ConeTypeContext.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/ConeTypeContext.kt @@ -584,7 +584,7 @@ class ConeTypeCheckerContext( errorTypesEqualToAnything: Boolean, stubTypesEqualToAnything: Boolean ): AbstractTypeCheckerContext = - if (this.isErrorTypeEqualsToAnything == errorTypesEqualToAnything) + if (this.isErrorTypeEqualsToAnything == errorTypesEqualToAnything && this.isStubTypeEqualsToAnything == stubTypesEqualToAnything) this else ConeTypeCheckerContext(errorTypesEqualToAnything, stubTypesEqualToAnything, session) diff --git a/compiler/testData/diagnostics/tests/callableReference/generic/argumentAndReturnExpectedType.fir.kt b/compiler/testData/diagnostics/tests/callableReference/generic/argumentAndReturnExpectedType.fir.kt index fc710a64a4f..c43049f5469 100644 --- a/compiler/testData/diagnostics/tests/callableReference/generic/argumentAndReturnExpectedType.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/generic/argumentAndReturnExpectedType.fir.kt @@ -27,9 +27,9 @@ fun listOf(): List = TODO() fun setOf(): Set = TODO() fun test2(x: T) { - bar(x, x, ::foo).checkType { _>() } + bar(x, x, ::foo).checkType { _>() } bar(x, 1, ::foo).checkType { _>() } - bar(1, x, ::foo).checkType { _>() } + bar(1, x, ::foo).checkType { _>() } bar(listOf(), setOf(), ::foo).checkType { _, Set>> () } bar(listOf(), 1, ::foo).checkType { _, Int>>() } diff --git a/compiler/testData/ir/irText/expressions/kt30796.fir.kt.txt b/compiler/testData/ir/irText/expressions/kt30796.fir.kt.txt index f45cf10a60b..92347743b7d 100644 --- a/compiler/testData/ir/irText/expressions/kt30796.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt30796.fir.kt.txt @@ -70,7 +70,7 @@ fun test(value: T, value2: T) { } } val x7: Any = { // BLOCK - val : T? = { // BLOCK + val : T = { // BLOCK val : T? = magic() when { EQEQ(arg0 = , arg1 = null) -> value @@ -79,7 +79,7 @@ fun test(value: T, value2: T) { } when { EQEQ(arg0 = , arg1 = null) -> 42 - else -> /*as T */ + else -> } } } diff --git a/compiler/testData/ir/irText/expressions/kt30796.fir.txt b/compiler/testData/ir/irText/expressions/kt30796.fir.txt index 0b70ed16ffd..344efa7f284 100644 --- a/compiler/testData/ir/irText/expressions/kt30796.fir.txt +++ b/compiler/testData/ir/irText/expressions/kt30796.fir.txt @@ -137,12 +137,12 @@ FILE fqName: fileName:/kt30796.kt then: GET_VAR 'val tmp_8: T of .test [val] declared in .test' type=T of .test origin=null VAR name:x7 type:kotlin.Any [val] BLOCK type=kotlin.Any origin=ELVIS - VAR IR_TEMPORARY_VARIABLE name:tmp_10 type:T of .test? [val] - BLOCK type=T of .test? origin=ELVIS + VAR IR_TEMPORARY_VARIABLE name:tmp_10 type:T of .test [val] + BLOCK type=T of .test origin=ELVIS VAR IR_TEMPORARY_VARIABLE name:tmp_11 type:T of .test? [val] CALL 'public final fun magic (): T of .magic declared in ' type=T of .test? origin=null : T of .test? - WHEN type=T of .test? origin=ELVIS + WHEN type=T of .test origin=ELVIS BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp_11: T of .test? [val] declared in .test' type=T of .test? origin=null @@ -155,10 +155,9 @@ FILE fqName: fileName:/kt30796.kt WHEN type=kotlin.Any origin=ELVIS BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ - arg0: GET_VAR 'val tmp_10: T of .test? [val] declared in .test' type=T of .test? origin=null + arg0: GET_VAR 'val tmp_10: T of .test [val] declared in .test' type=T of .test origin=null arg1: CONST Null type=kotlin.Nothing? value=null then: CONST Int type=kotlin.Int value=42 BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: TYPE_OP type=T of .test origin=IMPLICIT_CAST typeOperand=T of .test - GET_VAR 'val tmp_10: T of .test? [val] declared in .test' type=T of .test? origin=null + then: GET_VAR 'val tmp_10: T of .test [val] declared in .test' type=T of .test origin=null diff --git a/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.fir.kt.txt b/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.fir.kt.txt index df40c6ff4e0..35d4f744505 100644 --- a/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.fir.kt.txt +++ b/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.fir.kt.txt @@ -1,5 +1,5 @@ fun problematic(lss: List>): List { - return lss.flatMap, T>(transform = local fun (it: List): Iterable { + return lss.flatMap, T?>(transform = local fun (it: List): Iterable { return id(v = it) /*!! List */ } ) diff --git a/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.fir.txt b/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.fir.txt index a21eafe3e68..2b7343b61d9 100644 --- a/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.fir.txt +++ b/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.fir.txt @@ -4,15 +4,15 @@ FILE fqName: fileName:/typeParametersInImplicitCast.kt VALUE_PARAMETER name:lss index:0 type:kotlin.collections.List.problematic>> BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun problematic (lss: kotlin.collections.List.problematic>>): kotlin.collections.List.problematic> declared in ' - CALL 'public final fun flatMap (transform: kotlin.Function1>): kotlin.collections.List [inline] declared in kotlin.collections' type=kotlin.collections.List.problematic> origin=null + CALL 'public final fun flatMap (transform: kotlin.Function1>): kotlin.collections.List [inline] declared in kotlin.collections' type=kotlin.collections.List.problematic?> origin=null : kotlin.collections.List.problematic> - : T of .problematic + : T of .problematic? $receiver: GET_VAR 'lss: kotlin.collections.List.problematic>> declared in .problematic' type=kotlin.collections.List.problematic>> origin=null - transform: FUN_EXPR type=kotlin.Function1.problematic>, kotlin.collections.Iterable.problematic>> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:kotlin.collections.List.problematic>) returnType:kotlin.collections.Iterable.problematic> + transform: FUN_EXPR type=kotlin.Function1.problematic>, kotlin.collections.Iterable.problematic?>> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:kotlin.collections.List.problematic>) returnType:kotlin.collections.Iterable.problematic?> VALUE_PARAMETER name:it index:0 type:kotlin.collections.List.problematic> BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (it: kotlin.collections.List.problematic>): kotlin.collections.Iterable.problematic> declared in .problematic' + RETURN type=kotlin.Nothing from='local final fun (it: kotlin.collections.List.problematic>): kotlin.collections.Iterable.problematic?> declared in .problematic' TYPE_OP type=kotlin.collections.List.problematic?> origin=IMPLICIT_NOTNULL typeOperand=kotlin.collections.List.problematic?> CALL 'public/*package*/ open fun id (v: kotlin.collections.List.ListId.id?>?): @[EnhancedNullability] kotlin.collections.List.ListId.id?> declared in .ListId' type=@[EnhancedNullability] kotlin.collections.List.problematic?> origin=null : T of .problematic? From aae0081f3fd7d5be1e26a79f04eceafb6158c221 Mon Sep 17 00:00:00 2001 From: Igor Yakovlev Date: Tue, 17 Nov 2020 02:33:35 +0300 Subject: [PATCH 374/698] [FIR IDE] Fixed invalid HL API getters request --- .../kotlin/idea/frontend/api/fir/symbols/KtFirPropertySymbol.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySymbol.kt index 639b2cee62e..44f2392bfd6 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySymbol.kt @@ -75,7 +75,7 @@ internal class KtFirPropertySymbol( } override val setter: KtPropertySetterSymbol? by firRef.withFirAndCache(FirResolvePhase.RAW_FIR) { property -> - property.getter?.let { builder.buildPropertyAccessorSymbol(it) } as? KtPropertySetterSymbol + property.setter?.let { builder.buildPropertyAccessorSymbol(it) } as? KtPropertySetterSymbol } override val hasBackingField: Boolean get() = firRef.withFir { it.hasBackingField } From fdaf31dbf3f905e4459e6511c09c2f069899a010 Mon Sep 17 00:00:00 2001 From: Igor Yakovlev Date: Mon, 16 Nov 2020 14:21:04 +0300 Subject: [PATCH 375/698] [FIR IDE] Fix typemapping for FirTypeAliasSymbol --- .../kotlin/fir/backend/jvm/FirJvmTypeMapper.kt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmTypeMapper.kt b/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmTypeMapper.kt index 85bc7d30f02..689fcfc4309 100644 --- a/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmTypeMapper.kt +++ b/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmTypeMapper.kt @@ -14,14 +14,14 @@ import org.jetbrains.kotlin.fir.* import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.resolve.defaultType import org.jetbrains.kotlin.fir.resolve.firSymbolProvider +import org.jetbrains.kotlin.fir.resolve.fullyExpandedType import org.jetbrains.kotlin.fir.resolve.inference.* import org.jetbrains.kotlin.fir.resolve.toSymbol import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag import org.jetbrains.kotlin.fir.symbols.ConeClassifierLookupTag import org.jetbrains.kotlin.fir.symbols.ConeTypeParameterLookupTag import org.jetbrains.kotlin.fir.symbols.StandardClassIds -import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol +import org.jetbrains.kotlin.fir.symbols.impl.* import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.types.impl.ConeTypeParameterTypeImpl import org.jetbrains.kotlin.ir.util.* @@ -86,8 +86,17 @@ class FirJvmTypeMapper(val session: FirSession) : TypeMappingContext.toRegularClassSymbol(): FirRegularClassSymbol? = when (this) { + is FirRegularClassSymbol -> this + is FirTypeAliasSymbol -> { + val expandedType = fir.expandedTypeRef.coneType.fullyExpandedType(session) as? ConeClassLikeType + expandedType?.lookupTag?.toSymbol(session) as? FirRegularClassSymbol + } + else -> null + } + private fun ConeClassLikeType.buildPossiblyInnerType(): PossiblyInnerConeType? = - buildPossiblyInnerType(lookupTag.toSymbol(session) as? FirRegularClassSymbol?, 0) + buildPossiblyInnerType(lookupTag.toSymbol(session)?.toRegularClassSymbol(), 0) private fun ConeClassLikeType.parentClassOrNull(): FirRegularClassSymbol? { val parentClassId = classId?.outerClassId ?: return null From 3e3ec5fc69f172d0df655532f14e4f057cba7b63 Mon Sep 17 00:00:00 2001 From: Igor Yakovlev Date: Thu, 12 Nov 2020 18:07:26 +0300 Subject: [PATCH 376/698] [FIR IDE] Supporting member scopes in EnumEntries --- .../idea/frontend/api/KtAnalysisSession.kt | 5 +-- .../api/components/KtScopeProvider.kt | 7 ++-- .../idea/frontend/api/scopes/KtScope.kt | 6 ++-- .../frontend/api/symbols/KtClassLikeSymbol.kt | 3 +- .../api/symbols/KtVariableLikeSymbol.kt | 4 ++- .../api/symbols/markers/KtAnnotatedSymbol.kt | 4 --- .../api/symbols/markers/KtConstantValue.kt | 11 ++++++ .../markers/KtSymbolWithDeclarations.kt | 10 ++++++ .../symbols/markers/KtSymbolWithModality.kt | 1 + .../api/fir/components/KtFirScopeProvider.kt | 32 ++++++++++++----- .../fir/scopes/KtFirDeclaredMemberScope.kt | 3 +- .../api/fir/scopes/KtFirEmptyMemberScope.kt | 31 ++++++++++++++++ .../api/fir/scopes/KtFirMemberScope.kt | 3 +- .../api/fir/symbols/KtFirEnumEntrySymbol.kt | 5 +++ .../api/fir/symbols/firSymbolUtils.kt | 2 +- .../idea/frontend/api/fir/utils/firUtils.kt | 35 +++++++++---------- 16 files changed, 118 insertions(+), 44 deletions(-) create mode 100644 idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtConstantValue.kt create mode 100644 idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithDeclarations.kt create mode 100644 idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/scopes/KtFirEmptyMemberScope.kt diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt index fc3f520b03c..f1b28a246e1 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt @@ -9,6 +9,7 @@ import org.jetbrains.kotlin.diagnostics.Diagnostic import org.jetbrains.kotlin.idea.frontend.api.components.* import org.jetbrains.kotlin.idea.frontend.api.scopes.* import org.jetbrains.kotlin.idea.frontend.api.symbols.* +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithDeclarations import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithKind import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtSymbolPointer import org.jetbrains.kotlin.idea.frontend.api.types.KtType @@ -69,9 +70,9 @@ abstract class KtAnalysisSession(override val token: ValidityToken) : ValidityTo fun KtSymbolWithKind.getContainingSymbol(): KtSymbolWithKind? = containingDeclarationProvider.getContainingDeclaration(this) - fun KtClassOrObjectSymbol.getMemberScope(): KtMemberScope = scopeProvider.getMemberScope(this) + fun KtSymbolWithDeclarations.getMemberScope(): KtMemberScope = scopeProvider.getMemberScope(this) - fun KtClassOrObjectSymbol.getDeclaredMemberScope(): KtDeclaredMemberScope = scopeProvider.getDeclaredMemberScope(this) + fun KtSymbolWithDeclarations.getDeclaredMemberScope(): KtDeclaredMemberScope = scopeProvider.getDeclaredMemberScope(this) fun KtPackageSymbol.getPackageScope(): KtPackageScope = scopeProvider.getPackageScope(this) diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtScopeProvider.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtScopeProvider.kt index 683d78149a2..1a496ae71aa 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtScopeProvider.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtScopeProvider.kt @@ -5,17 +5,16 @@ package org.jetbrains.kotlin.idea.frontend.api.components -import com.intellij.psi.PsiElement import org.jetbrains.kotlin.idea.frontend.api.scopes.* -import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassOrObjectSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPackageSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithDeclarations import org.jetbrains.kotlin.idea.frontend.api.types.KtType import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.psi.KtFile abstract class KtScopeProvider : KtAnalysisSessionComponent() { - abstract fun getMemberScope(classSymbol: KtClassOrObjectSymbol): KtMemberScope - abstract fun getDeclaredMemberScope(classSymbol: KtClassOrObjectSymbol): KtDeclaredMemberScope + abstract fun getMemberScope(classSymbol: KtSymbolWithDeclarations): KtMemberScope + abstract fun getDeclaredMemberScope(classSymbol: KtSymbolWithDeclarations): KtDeclaredMemberScope abstract fun getPackageScope(packageSymbol: KtPackageSymbol): KtPackageScope abstract fun getCompositeScope(subScopes: List): KtCompositeScope diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/scopes/KtScope.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/scopes/KtScope.kt index f73e5b2267b..24c363c9026 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/scopes/KtScope.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/scopes/KtScope.kt @@ -5,8 +5,10 @@ package org.jetbrains.kotlin.idea.frontend.api.scopes +import org.jetbrains.kotlin.idea.frontend.api.ValidityToken import org.jetbrains.kotlin.idea.frontend.api.ValidityTokenOwner import org.jetbrains.kotlin.idea.frontend.api.symbols.* +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithDeclarations import org.jetbrains.kotlin.idea.frontend.api.withValidityAssertion import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name @@ -42,11 +44,11 @@ interface KtCompositeScope : KtScope { } interface KtMemberScope : KtScope { - val owner: KtClassOrObjectSymbol + val owner: KtSymbolWithDeclarations } interface KtDeclaredMemberScope : KtScope { - val owner: KtClassOrObjectSymbol + val owner: KtSymbolWithDeclarations } interface KtPackageScope : KtScope, KtSubstitutedScope { diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtClassLikeSymbol.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtClassLikeSymbol.kt index 6b047a67edc..3c5e645ff67 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtClassLikeSymbol.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtClassLikeSymbol.kt @@ -35,7 +35,8 @@ abstract class KtClassOrObjectSymbol : KtClassLikeSymbol(), KtSymbolWithTypeParameters, KtSymbolWithModality, KtSymbolWithVisibility, - KtAnnotatedSymbol { + KtAnnotatedSymbol, + KtSymbolWithDeclarations { abstract val classKind: KtClassKind abstract val isInner: Boolean diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtVariableLikeSymbol.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtVariableLikeSymbol.kt index bed3b085f86..92532113869 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtVariableLikeSymbol.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtVariableLikeSymbol.kt @@ -14,10 +14,12 @@ sealed class KtVariableLikeSymbol : KtCallableSymbol(), KtTypedSymbol, KtNamedSy abstract override fun createPointer(): KtSymbolPointer } -abstract class KtEnumEntrySymbol : KtVariableLikeSymbol(), KtSymbolWithKind { +abstract class KtEnumEntrySymbol : KtVariableLikeSymbol(), KtSymbolWithDeclarations, KtSymbolWithKind { final override val symbolKind: KtSymbolKind get() = KtSymbolKind.MEMBER abstract val containingEnumClassIdIfNonLocal: ClassId? + abstract val hasBody: Boolean + abstract override fun createPointer(): KtSymbolPointer } diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtAnnotatedSymbol.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtAnnotatedSymbol.kt index 91cf77a23e7..4b164db3e02 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtAnnotatedSymbol.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtAnnotatedSymbol.kt @@ -17,10 +17,6 @@ abstract class KtAnnotationCall { abstract val arguments: List } -sealed class KtConstantValue -object KtUnsupportedConstantValue : KtConstantValue() - -data class KtSimpleConstantValue(val constant: T) : KtConstantValue() data class KtNamedConstantValue(val name: String, val expression: KtConstantValue) interface KtAnnotatedSymbol : KtSymbol { diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtConstantValue.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtConstantValue.kt new file mode 100644 index 00000000000..6becde6440d --- /dev/null +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtConstantValue.kt @@ -0,0 +1,11 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.frontend.api.symbols.markers + +sealed class KtConstantValue +object KtUnsupportedConstantValue : KtConstantValue() + +data class KtSimpleConstantValue(val constant: T?) : KtConstantValue() \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithDeclarations.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithDeclarations.kt new file mode 100644 index 00000000000..6b9fc49461f --- /dev/null +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithDeclarations.kt @@ -0,0 +1,10 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.frontend.api.symbols.markers + +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSymbol + +interface KtSymbolWithDeclarations : KtSymbol \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithModality.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithModality.kt index abba9a00adc..9dfc6b699c6 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithModality.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithModality.kt @@ -17,4 +17,5 @@ sealed class KtCommonSymbolModality : KtSymbolModality() { object FINAL : KtCommonSymbolModality() object ABSTRACT : KtCommonSymbolModality() object OPEN : KtCommonSymbolModality() + object UNKNOWN : KtCommonSymbolModality() } \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt index 7f7a74ce11b..738e0e0fff3 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.idea.frontend.api.fir.components import com.intellij.openapi.project.Project +import org.jetbrains.kotlin.fir.declarations.FirClass import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.fir.resolve.scope import org.jetbrains.kotlin.fir.scopes.FakeOverrideTypeCalculator @@ -25,13 +26,15 @@ import org.jetbrains.kotlin.idea.frontend.api.fir.KtFirAnalysisSession import org.jetbrains.kotlin.idea.frontend.api.fir.KtSymbolByFirBuilder import org.jetbrains.kotlin.idea.frontend.api.fir.scopes.* import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirClassOrObjectSymbol +import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirEnumEntrySymbol import org.jetbrains.kotlin.idea.frontend.api.fir.types.KtFirType import org.jetbrains.kotlin.idea.frontend.api.fir.utils.EnclosingDeclarationContext +import org.jetbrains.kotlin.idea.frontend.api.fir.utils.FirRefWithValidityCheck import org.jetbrains.kotlin.idea.frontend.api.fir.utils.buildCompletionContext import org.jetbrains.kotlin.idea.frontend.api.fir.utils.weakRef import org.jetbrains.kotlin.idea.frontend.api.scopes.* -import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassOrObjectSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPackageSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithDeclarations import org.jetbrains.kotlin.idea.frontend.api.types.KtType import org.jetbrains.kotlin.idea.frontend.api.withValidityAssertion import org.jetbrains.kotlin.psi.KtElement @@ -50,15 +53,24 @@ internal class KtFirScopeProvider( private val firResolveState by weakRef(firResolveState) private val firScopeStorage = FirScopeRegistry() - private val memberScopeCache = IdentityHashMap() - private val declaredMemberScopeCache = IdentityHashMap() + private val memberScopeCache = IdentityHashMap() + private val declaredMemberScopeCache = IdentityHashMap() private val packageMemberScopeCache = IdentityHashMap() - override fun getMemberScope(classSymbol: KtClassOrObjectSymbol): KtMemberScope = withValidityAssertion { + private fun KtSymbolWithDeclarations.firRef(): FirRefWithValidityCheck>? = when (this) { + is KtFirClassOrObjectSymbol -> this.firRef + is KtFirEnumEntrySymbol -> this.initializerFirRef + else -> error { "Unknown KtSymbolWithDeclarations implementation ${this::class.qualifiedName}" } + } + + override fun getMemberScope(classSymbol: KtSymbolWithDeclarations): KtMemberScope = withValidityAssertion { memberScopeCache.getOrPut(classSymbol) { - check(classSymbol is KtFirClassOrObjectSymbol) + + val firRef = classSymbol.firRef() + ?: return@getOrPut KtFirEmptyMemberScope(classSymbol) + val firScope = - classSymbol.firRef.withFir(FirResolvePhase.SUPER_TYPES) { fir -> + firRef.withFir(FirResolvePhase.SUPER_TYPES) { fir -> val firSession = fir.session fir.unsubstitutedScope( firSession, @@ -70,10 +82,12 @@ internal class KtFirScopeProvider( } } - override fun getDeclaredMemberScope(classSymbol: KtClassOrObjectSymbol): KtDeclaredMemberScope = withValidityAssertion { + override fun getDeclaredMemberScope(classSymbol: KtSymbolWithDeclarations): KtDeclaredMemberScope = withValidityAssertion { declaredMemberScopeCache.getOrPut(classSymbol) { - check(classSymbol is KtFirClassOrObjectSymbol) - val firScope = classSymbol.firRef.withFir(FirResolvePhase.SUPER_TYPES) { declaredMemberScope(it) } + val firRef = classSymbol.firRef() + ?: return@getOrPut KtFirEmptyMemberScope(classSymbol) + + val firScope = firRef.withFir(FirResolvePhase.SUPER_TYPES) { declaredMemberScope(it) } .also(firScopeStorage::register) KtFirDeclaredMemberScope(classSymbol, firScope, token, builder) } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/scopes/KtFirDeclaredMemberScope.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/scopes/KtFirDeclaredMemberScope.kt index 9c216250f85..3455178df3e 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/scopes/KtFirDeclaredMemberScope.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/scopes/KtFirDeclaredMemberScope.kt @@ -13,9 +13,10 @@ import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirClassOrObjectSymb import org.jetbrains.kotlin.idea.frontend.api.fir.utils.weakRef import org.jetbrains.kotlin.idea.frontend.api.scopes.KtDeclaredMemberScope import org.jetbrains.kotlin.idea.frontend.api.scopes.KtUnsubstitutedScope +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithDeclarations internal class KtFirDeclaredMemberScope( - override val owner: KtFirClassOrObjectSymbol, + override val owner: KtSymbolWithDeclarations, firScope: FirClassDeclaredMemberScope, token: ValidityToken, builder: KtSymbolByFirBuilder diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/scopes/KtFirEmptyMemberScope.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/scopes/KtFirEmptyMemberScope.kt new file mode 100644 index 00000000000..b356db91188 --- /dev/null +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/scopes/KtFirEmptyMemberScope.kt @@ -0,0 +1,31 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.frontend.api.fir.scopes + +import org.jetbrains.kotlin.idea.frontend.api.ValidityToken +import org.jetbrains.kotlin.idea.frontend.api.ValidityTokenOwner +import org.jetbrains.kotlin.idea.frontend.api.scopes.KtDeclaredMemberScope +import org.jetbrains.kotlin.idea.frontend.api.scopes.KtMemberScope +import org.jetbrains.kotlin.idea.frontend.api.scopes.KtScopeNameFilter +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtCallableSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassifierSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithDeclarations +import org.jetbrains.kotlin.name.Name + +internal class KtFirEmptyMemberScope(override val owner: KtSymbolWithDeclarations) : KtMemberScope, KtDeclaredMemberScope, ValidityTokenOwner { + override fun getCallableNames(): Set = emptySet() + + override fun getClassifierNames(): Set = emptySet() + + override fun getCallableSymbols(nameFilter: KtScopeNameFilter): Sequence = + emptySequence() + + override fun getClassifierSymbols(nameFilter: KtScopeNameFilter): Sequence = + emptySequence() + + override val token: ValidityToken + get() = owner.token +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/scopes/KtFirMemberScope.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/scopes/KtFirMemberScope.kt index 2029d0c0ba7..20b9356aa25 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/scopes/KtFirMemberScope.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/scopes/KtFirMemberScope.kt @@ -13,9 +13,10 @@ import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirClassOrObjectSymb import org.jetbrains.kotlin.idea.frontend.api.fir.utils.weakRef import org.jetbrains.kotlin.idea.frontend.api.scopes.KtMemberScope import org.jetbrains.kotlin.idea.frontend.api.scopes.KtUnsubstitutedScope +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithDeclarations internal class KtFirMemberScope( - override val owner: KtFirClassOrObjectSymbol, + override val owner: KtSymbolWithDeclarations, firScope: FirTypeScope, token: ValidityToken, builder: KtSymbolByFirBuilder diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirEnumEntrySymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirEnumEntrySymbol.kt index c0ad5ffef65..11c83ac9298 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirEnumEntrySymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirEnumEntrySymbol.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.idea.frontend.api.fir.symbols import com.intellij.psi.PsiElement import org.jetbrains.kotlin.fir.containingClass +import org.jetbrains.kotlin.fir.declarations.FirAnonymousObject import org.jetbrains.kotlin.fir.declarations.FirEnumEntry import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.idea.fir.findPsi @@ -15,6 +16,7 @@ import org.jetbrains.kotlin.idea.frontend.api.ValidityToken import org.jetbrains.kotlin.idea.frontend.api.fir.KtSymbolByFirBuilder import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.pointers.KtFirEnumEntrySymbolPointer import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.pointers.createSignature +import org.jetbrains.kotlin.idea.frontend.api.fir.utils.FirRefWithValidityCheck import org.jetbrains.kotlin.idea.frontend.api.fir.utils.firRef import org.jetbrains.kotlin.idea.frontend.api.symbols.KtEnumEntrySymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtPsiBasedSymbolPointer @@ -30,6 +32,7 @@ internal class KtFirEnumEntrySymbol( private val builder: KtSymbolByFirBuilder ) : KtEnumEntrySymbol(), KtFirSymbol { override val firRef = firRef(fir, resolveState) + override val psi: PsiElement? by firRef.withFirAndCache { fir -> fir.findPsi(fir.session) } override val name: Name get() = firRef.withFir { it.name } @@ -38,6 +41,8 @@ internal class KtFirEnumEntrySymbol( override val containingEnumClassIdIfNonLocal: ClassId? get() = firRef.withFir { it.containingClass()?.classId?.takeUnless { it.isLocal } } + override val hasBody: Boolean get() = firRef.withFir { it.initializer != null } + override fun createPointer(): KtSymbolPointer { KtPsiBasedSymbolPointer.createForSymbolFromSource(this)?.let { return it } return KtFirEnumEntrySymbolPointer(containingEnumClassIdIfNonLocal!!, firRef.withFir { it.createSignature() }) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/firSymbolUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/firSymbolUtils.kt index 8d59e319cbd..53ea8f98684 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/firSymbolUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/firSymbolUtils.kt @@ -22,7 +22,7 @@ internal inline fun Modality?.getSymbolModality() Modality.OPEN -> KtCommonSymbolModality.OPEN Modality.ABSTRACT -> KtCommonSymbolModality.ABSTRACT Modality.SEALED -> KtSymbolModality.SEALED - null -> error("Symbol modality should not be null, looks like the fir symbol was not properly resolved") + null -> KtCommonSymbolModality.UNKNOWN } as? M ?: error("Sealed modality can only be applied to class") internal inline fun KtFirSymbol.getModality() = diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/firUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/firUtils.kt index f1b09d782fc..66eb41e600b 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/firUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/firUtils.kt @@ -5,23 +5,16 @@ package org.jetbrains.kotlin.idea.frontend.api.fir.utils import org.jetbrains.kotlin.fir.FirSession -import org.jetbrains.kotlin.fir.FirSymbolOwner -import org.jetbrains.kotlin.fir.declarations.FirAnnotatedDeclaration -import org.jetbrains.kotlin.fir.declarations.FirDeclaration -import org.jetbrains.kotlin.fir.declarations.FirRegularClass -import org.jetbrains.kotlin.fir.declarations.getPrimaryConstructorIfAny +import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.psi import org.jetbrains.kotlin.fir.resolve.toSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol import org.jetbrains.kotlin.fir.types.ConeClassLikeType import org.jetbrains.kotlin.fir.types.classId import org.jetbrains.kotlin.fir.types.coneType +import org.jetbrains.kotlin.idea.frontend.api.fir.KtSymbolByFirBuilder import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirAnnotationCall -import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtNamedConstantValue -import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSimpleConstantValue -import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtUnsupportedConstantValue -import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.* import org.jetbrains.kotlin.psi.KtCallElement internal fun mapAnnotationParameters(annotationCall: FirAnnotationCall, session: FirSession): Map { @@ -54,15 +47,20 @@ internal fun mapAnnotationParameters(annotationCall: FirAnnotationCall, session: return resultSet } -private fun convertAnnotation(annotationCall: FirAnnotationCall, session: FirSession): KtFirAnnotationCall? { +private fun FirExpression.convertConstantExpression(): KtConstantValue = + when (this) { + is FirConstExpression<*> -> KtSimpleConstantValue(value) + else -> KtUnsupportedConstantValue + } + +private fun convertAnnotation( + annotationCall: FirAnnotationCall, + session: FirSession +): KtFirAnnotationCall? { val annotationCone = annotationCall.annotationTypeRef.coneType as? ConeClassLikeType ?: return null val classId = annotationCone.classId ?: return null - fun FirExpression.convertConstantExpression() = - (this as? FirConstExpression<*>)?.value?.let { KtSimpleConstantValue(it) } - ?: KtUnsupportedConstantValue - val resultList = mapAnnotationParameters(annotationCall, session).map { KtNamedConstantValue(it.key, it.value.convertConstantExpression()) } @@ -75,6 +73,7 @@ private fun convertAnnotation(annotationCall: FirAnnotationCall, session: FirSes ) } -internal fun convertAnnotation(declaration: FirAnnotatedDeclaration) = declaration.annotations.mapNotNull { - convertAnnotation(it, declaration.session) -} \ No newline at end of file +internal fun convertAnnotation(declaration: FirAnnotatedDeclaration): List = + declaration.annotations.mapNotNull { + convertAnnotation(it, declaration.session) + } \ No newline at end of file From 4c69043a152b79d47827536cf4ada024eedfa5c1 Mon Sep 17 00:00:00 2001 From: Igor Yakovlev Date: Thu, 12 Nov 2020 18:07:47 +0300 Subject: [PATCH 377/698] [FIR IDE] Move refactoring and minor bugfixing for modality, jvmname, etc. --- .../caches/resolve/IDEKotlinAsJavaSupport.kt | 30 +- .../api/symbols/KtVariableLikeSymbol.kt | 2 - .../kotlin/idea/asJava/FirFakeFileImpl.kt | 3 +- .../asJava/annotations/annotationsUtils.kt | 3 + .../idea/asJava/class/FirLightClassBase.kt | 267 ------------- .../asJava/class/FirLightClassForSymbol.kt | 350 ------------------ .../classes/FirLightAnnotationClassSymbol.kt | 67 ++++ .../idea/asJava/classes/FirLightClassBase.kt | 156 ++++++++ .../FirLightClassForClassOrObjectSymbol.kt | 180 +++++++++ .../classes/FirLightClassForEnumEntry.kt | 139 +++++++ .../FirLightClassForFacade.kt | 19 +- .../asJava/classes/FirLightClassForSymbol.kt | 195 ++++++++++ .../classes/FirLightInterfaceClassSymbol.kt | 69 ++++ ...irLightInterfaceOrAnnotationClassSymbol.kt | 48 +++ .../idea/asJava/classes/firLightClassUtils.kt | 214 +++++++++++ ...siJavaCodeReferenceElementWithReference.kt | 3 - .../asJava/fields/FirLightFieldEnumEntry.kt | 79 ++++ .../fields/FirLightFieldForPropertySymbol.kt | 13 +- .../kotlin/idea/asJava/firLightUtils.kt | 37 +- .../FirLightAccessorMethodForSymbol.kt | 53 ++- .../idea/asJava/methods/FirLightMethod.kt | 21 ++ .../asJava/methods/FirLightMethodForSymbol.kt | 1 + .../methods/FirLightSimpleMethodForSymbol.kt | 37 +- .../api/fir/components/KtFirScopeProvider.kt | 42 ++- .../api/fir/scopes/KtFirDelegatingScope.kt | 11 + .../api/fir/symbols/KtFirEnumEntrySymbol.kt | 4 - .../api/fir/symbols/firSymbolUtils.kt | 2 +- 27 files changed, 1305 insertions(+), 740 deletions(-) delete mode 100644 idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/class/FirLightClassBase.kt delete mode 100644 idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/class/FirLightClassForSymbol.kt create mode 100644 idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightAnnotationClassSymbol.kt create mode 100644 idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassBase.kt create mode 100644 idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForClassOrObjectSymbol.kt create mode 100644 idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForEnumEntry.kt rename idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/{class => classes}/FirLightClassForFacade.kt (91%) create mode 100644 idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt create mode 100644 idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightInterfaceClassSymbol.kt create mode 100644 idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightInterfaceOrAnnotationClassSymbol.kt create mode 100644 idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt create mode 100644 idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldEnumEntry.kt diff --git a/idea/idea-fir/src/org/jetbrains/kotlin/idea/caches/resolve/IDEKotlinAsJavaSupport.kt b/idea/idea-fir/src/org/jetbrains/kotlin/idea/caches/resolve/IDEKotlinAsJavaSupport.kt index 3c741617e5d..32b6c3d11d9 100644 --- a/idea/idea-fir/src/org/jetbrains/kotlin/idea/caches/resolve/IDEKotlinAsJavaSupport.kt +++ b/idea/idea-fir/src/org/jetbrains/kotlin/idea/caches/resolve/IDEKotlinAsJavaSupport.kt @@ -8,24 +8,15 @@ package org.jetbrains.kotlin.idea.caches.resolve import com.intellij.openapi.project.Project import com.intellij.psi.PsiManager import com.intellij.psi.search.GlobalSearchScope -import com.intellij.psi.util.CachedValueProvider -import com.intellij.psi.util.CachedValuesManager -import org.jetbrains.kotlin.analyzer.KotlinModificationTrackerService import org.jetbrains.kotlin.asJava.classes.KtLightClass -import org.jetbrains.kotlin.asJava.classes.shouldNotBeVisibleAsLightClass import org.jetbrains.kotlin.idea.asJava.FirLightClassForFacade -import org.jetbrains.kotlin.idea.asJava.FirLightClassForSymbol -import org.jetbrains.kotlin.idea.frontend.api.analyze -import org.jetbrains.kotlin.idea.util.ifTrue +import org.jetbrains.kotlin.idea.asJava.classes.getOrCreateFirLightClass import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.psi.KtClassOrObject -import org.jetbrains.kotlin.psi.KtEnumEntry -import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.KtScript class IDEKotlinAsJavaFirSupport(project: Project) : IDEKotlinAsJavaSupport(project) { - //TODO Make caching override fun createLightClassForFacade(manager: PsiManager, facadeClassFqName: FqName, searchScope: GlobalSearchScope): KtLightClass? { val sources = findFilesForFacade(facadeClassFqName, searchScope) @@ -38,23 +29,6 @@ class IDEKotlinAsJavaFirSupport(project: Project) : IDEKotlinAsJavaSupport(proje override fun createLightClassForScript(script: KtScript): KtLightClass? = null - private fun KtClassOrObject.isSupportedByFitLightClasses() = - containingFile.let { it is KtFile && !it.isCompiled } && - !isLocal /*TODO*/ && - this !is KtEnumEntry /*TODO*/ && - !shouldNotBeVisibleAsLightClass() - override fun createLightClassForSourceDeclaration(classOrObject: KtClassOrObject): KtLightClass? = - classOrObject.isSupportedByFitLightClasses().ifTrue { - CachedValuesManager.getCachedValue(classOrObject) { - CachedValueProvider.Result - .create( - FirLightClassForSymbol( - analyze(classOrObject) { classOrObject.getClassOrObjectSymbol() }, - classOrObject.manager - ), - KotlinModificationTrackerService.getInstance(classOrObject.project).outOfBlockModificationTracker - ) - } - } + getOrCreateFirLightClass(classOrObject) } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtVariableLikeSymbol.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtVariableLikeSymbol.kt index 92532113869..929bd7fd476 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtVariableLikeSymbol.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtVariableLikeSymbol.kt @@ -18,8 +18,6 @@ abstract class KtEnumEntrySymbol : KtVariableLikeSymbol(), KtSymbolWithDeclarati final override val symbolKind: KtSymbolKind get() = KtSymbolKind.MEMBER abstract val containingEnumClassIdIfNonLocal: ClassId? - abstract val hasBody: Boolean - abstract override fun createPointer(): KtSymbolPointer } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/FirFakeFileImpl.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/FirFakeFileImpl.kt index 81714e44270..544278c910d 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/FirFakeFileImpl.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/FirFakeFileImpl.kt @@ -12,11 +12,12 @@ import com.intellij.psi.scope.PsiScopeProcessor import org.jetbrains.kotlin.asJava.classes.KtLightClass import org.jetbrains.kotlin.asJava.classes.getOutermostClassOrObject import org.jetbrains.kotlin.asJava.elements.FakeFileForLightClass +import org.jetbrains.kotlin.idea.asJava.classes.getOrCreateFirLightClass import org.jetbrains.kotlin.psi.KtClassOrObject class FirFakeFileImpl(private val classOrObject: KtClassOrObject, ktClass: KtLightClass) : FakeFileForLightClass( classOrObject.containingKtFile, - { if (classOrObject.isTopLevel()) ktClass else FirLightClassForSymbol.create(getOutermostClassOrObject(classOrObject))!! }, + { if (classOrObject.isTopLevel()) ktClass else getOrCreateFirLightClass(getOutermostClassOrObject(classOrObject))!! }, { null } ) { diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/annotationsUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/annotationsUtils.kt index c27bf26a7c5..74733d103d8 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/annotationsUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/annotationsUtils.kt @@ -66,6 +66,9 @@ internal fun KtAnnotatedSymbol.isHiddenByDeprecation(annotationUseSiteTarget: An internal fun KtAnnotatedSymbol.hasJvmFieldAnnotation(): Boolean = hasAnnotation("kotlin/jvm/JvmField", null) +internal fun KtAnnotatedSymbol.hasPublishedApiAnnotation(annotationUseSiteTarget: AnnotationUseSiteTarget? = null): Boolean = + hasAnnotation("kotlin/PublishedApi", annotationUseSiteTarget) + internal fun KtAnnotatedSymbol.hasJvmOverloadsAnnotation(): Boolean = hasAnnotation("kotlin/jvm/JvmOverloads", null) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/class/FirLightClassBase.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/class/FirLightClassBase.kt deleted file mode 100644 index a8aa43457fe..00000000000 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/class/FirLightClassBase.kt +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Copyright 2010-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.asJava - -import com.intellij.navigation.ItemPresentation -import com.intellij.navigation.ItemPresentationProviders -import com.intellij.openapi.util.Pair -import com.intellij.psi.* -import com.intellij.psi.impl.PsiClassImplUtil -import com.intellij.psi.impl.PsiImplUtil -import com.intellij.psi.impl.light.LightElement -import com.intellij.psi.impl.source.PsiExtensibleClass -import com.intellij.psi.javadoc.PsiDocComment -import com.intellij.psi.scope.PsiScopeProcessor -import com.intellij.psi.util.PsiUtil -import org.jetbrains.annotations.NonNls -import org.jetbrains.kotlin.analyzer.KotlinModificationTrackerService -import org.jetbrains.kotlin.asJava.classes.KotlinClassInnerStuffCache -import org.jetbrains.kotlin.asJava.classes.KotlinClassInnerStuffCache.Companion.processDeclarationsInEnum -import org.jetbrains.kotlin.asJava.classes.KtLightClass -import org.jetbrains.kotlin.asJava.classes.METHOD_INDEX_BASE -import org.jetbrains.kotlin.asJava.elements.KtLightField -import org.jetbrains.kotlin.asJava.elements.KtLightMethod -import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget -import org.jetbrains.kotlin.idea.KotlinLanguage - -import org.jetbrains.kotlin.idea.frontend.api.symbols.KtCallableSymbol -import org.jetbrains.kotlin.idea.frontend.api.symbols.KtConstructorSymbol -import org.jetbrains.kotlin.idea.frontend.api.symbols.KtFunctionSymbol -import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertySymbol -import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtAnnotatedSymbol -import java.util.* - -abstract class FirLightClassBase protected constructor(manager: PsiManager) : LightElement(manager, KotlinLanguage.INSTANCE), PsiClass, - KtLightClass, PsiExtensibleClass { - - override val clsDelegate: PsiClass - get() = invalidAccess() - - protected open val myInnersCache = KotlinClassInnerStuffCache( - myClass = this, - externalDependencies = listOf(KotlinModificationTrackerService.getInstance(manager.project).outOfBlockModificationTracker) - ) - - override fun getFields(): Array = myInnersCache.fields - - override fun getMethods(): Array = myInnersCache.methods - - override fun getConstructors(): Array = myInnersCache.constructors - - override fun getInnerClasses(): Array = myInnersCache.innerClasses - - override fun getAllFields(): Array = PsiClassImplUtil.getAllFields(this) - - override fun getAllMethods(): Array = PsiClassImplUtil.getAllMethods(this) - - override fun getAllInnerClasses(): Array = PsiClassImplUtil.getAllInnerClasses(this) - - override fun findFieldByName(name: String, checkBases: Boolean) = - myInnersCache.findFieldByName(name, checkBases) - - override fun findMethodsByName(name: String, checkBases: Boolean): Array = - myInnersCache.findMethodsByName(name, checkBases) - - override fun findInnerClassByName(name: String, checkBases: Boolean): PsiClass? = - myInnersCache.findInnerClassByName(name, checkBases) - - override fun processDeclarations( - processor: PsiScopeProcessor, state: ResolveState, lastParent: PsiElement?, place: PsiElement - ): Boolean { - - if (isEnum && !processDeclarationsInEnum(processor, state, myInnersCache)) return false - - return PsiClassImplUtil.processDeclarationsInClass( - this, - processor, - state, - null, - lastParent, - place, - PsiUtil.getLanguageLevel(place), - false - ) - } - - override fun getText(): String = kotlinOrigin?.text ?: "" - - override fun getLanguage(): KotlinLanguage = KotlinLanguage.INSTANCE - - override fun getPresentation(): ItemPresentation? = - ItemPresentationProviders.getItemPresentation(this) - - abstract override fun equals(other: Any?): Boolean - - abstract override fun hashCode(): Int - - override fun getContext(): PsiElement = parent - - override fun isEquivalentTo(another: PsiElement?): Boolean = - PsiClassImplUtil.isClassEquivalentTo(this, another) - - override fun getDocComment(): PsiDocComment? = null - - override fun hasTypeParameters(): Boolean = PsiImplUtil.hasTypeParameters(this) - - override fun getExtendsListTypes(): Array = - PsiClassImplUtil.getExtendsListTypes(this) - - override fun getImplementsListTypes(): Array = - PsiClassImplUtil.getImplementsListTypes(this) - - override fun findMethodBySignature(patternMethod: PsiMethod?, checkBases: Boolean): PsiMethod? = - patternMethod?.let { PsiClassImplUtil.findMethodBySignature(this, it, checkBases) } - - override fun findMethodsBySignature(patternMethod: PsiMethod?, checkBases: Boolean): Array = - patternMethod?.let { PsiClassImplUtil.findMethodsBySignature(this, it, checkBases) } ?: emptyArray() - - override fun findMethodsAndTheirSubstitutorsByName( - @NonNls name: String?, - checkBases: Boolean - ): List?> = - PsiClassImplUtil.findMethodsAndTheirSubstitutorsByName(this, name, checkBases) - - override fun getAllMethodsAndTheirSubstitutors(): List?> { - return PsiClassImplUtil.getAllWithSubstitutorsByMap(this, PsiClassImplUtil.MemberType.METHOD) - } - - abstract override fun copy(): PsiElement - - override fun accept(visitor: PsiElementVisitor) { - if (visitor is JavaElementVisitor) { - visitor.visitClass(this) - } else { - visitor.visitElement(this) - } - } - - protected fun createMethods(declarations: Sequence, isTopLevel: Boolean, result: MutableList) { - var methodIndex = METHOD_INDEX_BASE - for (declaration in declarations) { - - if (declaration is KtFunctionSymbol && declaration.isInline) continue - - if (declaration is KtAnnotatedSymbol && declaration.hasJvmSyntheticAnnotation(annotationUseSiteTarget = null)) continue - - if (declaration is KtAnnotatedSymbol && declaration.isHiddenByDeprecation(annotationUseSiteTarget = null)) continue - - when (declaration) { - is KtFunctionSymbol -> { - result.add( - FirLightSimpleMethodForSymbol( - functionSymbol = declaration, - lightMemberOrigin = null, - containingClass = this@FirLightClassBase, - isTopLevel = isTopLevel, - methodIndex = methodIndex++ - ) - ) - - if (declaration.hasJvmOverloadsAnnotation()) { - val skipMask = BitSet(declaration.valueParameters.size) - - for (i in declaration.valueParameters.size - 1 downTo 0) { - - if (!declaration.valueParameters[i].hasDefaultValue) continue - - skipMask.set(i) - - result.add( - FirLightSimpleMethodForSymbol( - functionSymbol = declaration, - lightMemberOrigin = null, - containingClass = this@FirLightClassBase, - isTopLevel = isTopLevel, - methodIndex = methodIndex++, - argumentsSkipMask = skipMask - ) - ) - } - } - } - is KtConstructorSymbol -> { - result.add( - FirLightConstructorForSymbol( - constructorSymbol = declaration, - lightMemberOrigin = null, - containingClass = this@FirLightClassBase, - methodIndex++ - ) - ) - } - is KtPropertySymbol -> { - - if (declaration.hasJvmFieldAnnotation()) continue - - val getter = declaration.getter?.takeIf { - !declaration.hasJvmSyntheticAnnotation(AnnotationUseSiteTarget.PROPERTY_GETTER) && - !it.isInline && - !declaration.isHiddenByDeprecation(AnnotationUseSiteTarget.PROPERTY_GETTER) - } - - if (getter != null) { - result.add( - FirLightAccessorMethodForSymbol( - propertyAccessorSymbol = getter, - containingPropertySymbol = declaration, - lightMemberOrigin = null, - containingClass = this@FirLightClassBase, - isTopLevel = isTopLevel - ) - ) - } - - val setter = declaration.setter?.takeIf { - !declaration.hasJvmSyntheticAnnotation(AnnotationUseSiteTarget.PROPERTY_SETTER) && - !it.isInline && - !declaration.isHiddenByDeprecation(AnnotationUseSiteTarget.PROPERTY_GETTER) - } - - if (setter != null) { - result.add( - FirLightAccessorMethodForSymbol( - propertyAccessorSymbol = setter, - containingPropertySymbol = declaration, - lightMemberOrigin = null, - containingClass = this@FirLightClassBase, - isTopLevel = isTopLevel - ) - ) - } - } - } - } - } - - protected fun createFields(declarations: Sequence, isTopLevel: Boolean, result: MutableList) { - //TODO isHiddenByDeprecation - for (declaration in declarations) { - if (declaration !is KtPropertySymbol) continue - - if (!declaration.hasBackingField) continue - if (declaration.hasJvmSyntheticAnnotation(AnnotationUseSiteTarget.FIELD)) continue - result.add( - FirLightFieldForPropertySymbol( - propertySymbol = declaration, - containingClass = this@FirLightClassBase, - lightMemberOrigin = null, - isTopLevel = isTopLevel - ) - ) - } - } -} \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/class/FirLightClassForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/class/FirLightClassForSymbol.kt deleted file mode 100644 index fbac14f7c11..00000000000 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/class/FirLightClassForSymbol.kt +++ /dev/null @@ -1,350 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.asJava - -import com.intellij.openapi.util.Comparing -import com.intellij.psi.* -import com.intellij.psi.impl.InheritanceImplUtil -import com.intellij.psi.impl.PsiClassImplUtil -import com.intellij.psi.impl.PsiSuperMethodImplUtil -import com.intellij.psi.search.SearchScope -import com.intellij.psi.stubs.IStubElementType -import com.intellij.psi.stubs.StubElement -import com.intellij.psi.util.CachedValueProvider -import com.intellij.psi.util.CachedValuesManager -import com.intellij.util.IncorrectOperationException -import org.jetbrains.annotations.NonNls -import org.jetbrains.kotlin.analyzer.KotlinModificationTrackerService -import org.jetbrains.kotlin.asJava.classes.* -import org.jetbrains.kotlin.asJava.elements.KtLightField -import org.jetbrains.kotlin.asJava.elements.KtLightIdentifier -import org.jetbrains.kotlin.asJava.elements.KtLightMethod -import org.jetbrains.kotlin.fir.symbols.StandardClassIds -import org.jetbrains.kotlin.idea.frontend.api.analyze -import org.jetbrains.kotlin.idea.frontend.api.fir.analyzeWithSymbolAsContext -import org.jetbrains.kotlin.idea.frontend.api.symbols.* -import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolKind -import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolVisibility -import org.jetbrains.kotlin.idea.frontend.api.types.KtClassType -import org.jetbrains.kotlin.idea.util.ifFalse -import org.jetbrains.kotlin.lexer.KtTokens -import org.jetbrains.kotlin.load.java.structure.LightClassOriginKind -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.debugText.getDebugText -import org.jetbrains.kotlin.psi.psiUtil.isObjectLiteral -import org.jetbrains.kotlin.psi.stubs.KotlinClassOrObjectStub -import javax.swing.Icon -import kotlin.collections.ArrayList - -class FirLightClassForSymbol( - private val classOrObjectSymbol: KtClassOrObjectSymbol, - manager: PsiManager -) : - FirLightClassBase(manager), - StubBasedPsiElement> { - - private val isTopLevel: Boolean = classOrObjectSymbol.symbolKind == KtSymbolKind.TOP_LEVEL - - private val _modifierList: PsiModifierList? by lazyPub { - - val modifiers = mutableSetOf(classOrObjectSymbol.computeVisibility(isTopLevel)) - classOrObjectSymbol.computeSimpleModality()?.run { - modifiers.add(this) - } - if (!isTopLevel && !classOrObjectSymbol.isInner) { - modifiers.add(PsiModifier.STATIC) - } - - val annotations = classOrObjectSymbol.computeAnnotations( - parent = this@FirLightClassForSymbol, - nullability = NullabilityType.Unknown, - annotationUseSiteTarget = null, - ) - - FirLightClassModifierList(this@FirLightClassForSymbol, modifiers, annotations) - } - - override fun getModifierList(): PsiModifierList? = _modifierList - override fun getOwnFields(): List = _ownFields - override fun getOwnMethods(): List = _ownMethods - override fun isDeprecated(): Boolean = false //TODO() - override fun getNameIdentifier(): KtLightIdentifier? = null //TODO() - override fun getExtendsList(): PsiReferenceList? = _extendsList - override fun getImplementsList(): PsiReferenceList? = _implementsList - override fun getTypeParameterList(): PsiTypeParameterList? = null //TODO() - override fun getTypeParameters(): Array = emptyArray() //TODO() - - override fun getOwnInnerClasses(): List { - val result = ArrayList() - - // workaround for ClassInnerStuffCache not supporting classes with null names, see KT-13927 - // inner classes with null names can't be searched for and can't be used from java anyway - // we can't prohibit creating light classes with null names either since they can contain members - - analyzeWithSymbolAsContext(classOrObjectSymbol) { - classOrObjectSymbol.getDeclaredMemberScope().getAllSymbols().filterIsInstance().mapTo(result) { - FirLightClassForSymbol(it, manager) - } - } - - //TODO - //if (classOrObject.hasInterfaceDefaultImpls) { - // result.add(KtLightClassForInterfaceDefaultImpls(classOrObject)) - //} - return result - } - - override fun getTextOffset(): Int = kotlinOrigin?.textOffset ?: 0 - override fun getStartOffsetInParent(): Int = kotlinOrigin?.startOffsetInParent ?: 0 - override fun isWritable() = kotlinOrigin?.isWritable ?: false - override val kotlinOrigin: KtClassOrObject? = classOrObjectSymbol.psi as? KtClassOrObject - - private val _extendsList by lazyPub { createInheritanceList(forExtendsList = true) } - private val _implementsList by lazyPub { createInheritanceList(forExtendsList = false) } - - private fun KtClassType.isTypeForInheritanceList(forExtendsList: Boolean): Boolean { - - // Do not add redundant "extends java.lang.Object" anywhere - if (classId == StandardClassIds.Any) return false - - // We don't have Enum among enums supertype in sources neither we do for decompiled class-files and light-classes - if (isEnum && classId == StandardClassIds.Enum) return false - - // Interfaces have only extends lists - if (isInterface) return forExtendsList - - val isInterface = (this.classSymbol as? KtClassOrObjectSymbol)?.classKind == KtClassKind.INTERFACE - - return forExtendsList == !isInterface - } - - private fun createInheritanceList(forExtendsList: Boolean): PsiReferenceList? { - - val role = if (forExtendsList) PsiReferenceList.Role.EXTENDS_LIST else PsiReferenceList.Role.IMPLEMENTS_LIST - - if (isAnnotationType) return KotlinLightReferenceListBuilder(manager, language, role) - - val listBuilder = KotlinSuperTypeListBuilder( - kotlinOrigin = kotlinOrigin?.getSuperTypeList(), - manager = manager, - language = language, - role = role - ) - - //TODO Add support for kotlin.collections. - classOrObjectSymbol.superTypes.map { type -> - if (type is KtClassType && type.isTypeForInheritanceList(forExtendsList)) { - type.mapSupertype(this, kotlinCollectionAsIs = true)?.run { - listBuilder.addReference(this) - } - } - } - - return listBuilder - } - - private val _ownMethods: List by lazyPub { - - val result = mutableListOf() - - analyzeWithSymbolAsContext(classOrObjectSymbol) { - //TODO filterNot { it.isHiddenByDeprecation(support) } - val callableSymbols = classOrObjectSymbol.getDeclaredMemberScope().getCallableSymbols() - val visibleDeclarations = callableSymbols.filterNot { - isInterface && it is KtFunctionSymbol && it.visibility == KtSymbolVisibility.PRIVATE - } - - createMethods(visibleDeclarations, isTopLevel = false, result) - } - - if (result.none { it.isConstructor }) { - classOrObjectSymbol.primaryConstructor?.let { - result.add( - FirLightConstructorForSymbol( - constructorSymbol = it, - lightMemberOrigin = null, - containingClass = this, - methodIndex = METHOD_INDEX_FOR_DEFAULT_CTOR - ) - ) - } - } - - result - } - - private val _ownFields: List by lazyPub { - - val result = mutableListOf() - - classOrObjectSymbol.companionObject?.run { - result.add(FirLightFieldForObjectSymbol(this, this@FirLightClassForSymbol, null)) - - if (!isInterface) { - analyzeWithSymbolAsContext(this) { - getDeclaredMemberScope().getCallableSymbols() - .filterIsInstance() - .filter { it.hasJvmFieldAnnotation() || it.isConst } - .mapTo(result) { - FirLightFieldForPropertySymbol( - propertySymbol = it, - containingClass = this@FirLightClassForSymbol, - lightMemberOrigin = null, - isTopLevel = false, - forceStatic = true - ) - } - } - } - } - - val isNamedObject = classOrObjectSymbol.classKind == KtClassKind.OBJECT - if (isNamedObject && classOrObjectSymbol.symbolKind != KtSymbolKind.LOCAL) { - result.add(FirLightFieldForObjectSymbol(classOrObjectSymbol, this@FirLightClassForSymbol, null)) - } - - analyzeWithSymbolAsContext(classOrObjectSymbol) { - val callableSymbols = classOrObjectSymbol.getDeclaredMemberScope().getCallableSymbols() - .filterIsInstance() - .applyIf(classOrObjectSymbol.classKind == KtClassKind.COMPANION_OBJECT) { - filter { it.hasJvmFieldAnnotation() || it.isConst } - } - createFields(callableSymbols, isTopLevel = false, result) - } - - result - } - - private val _containingFile: PsiFile? by lazyPub { - - val kotlinOrigin = kotlinOrigin ?: return@lazyPub null - - val containingClass = isTopLevel.ifFalse { create(getOutermostClassOrObject(kotlinOrigin)) } ?: this - - FirFakeFileImpl(kotlinOrigin, containingClass) - } - - override fun getContainingFile(): PsiFile? = _containingFile - - override fun getNavigationElement(): PsiElement = kotlinOrigin ?: this - - override fun isEquivalentTo(another: PsiElement?): Boolean = - basicIsEquivalentTo(this, another) || - another is PsiClass && qualifiedName != null && Comparing.equal(another.qualifiedName, qualifiedName) - - override fun getElementIcon(flags: Int): Icon? = - throw UnsupportedOperationException("This should be done by JetIconProvider") - - override fun equals(other: Any?): Boolean = - this === other || - (other is FirLightClassForSymbol && kotlinOrigin == other.kotlinOrigin && classOrObjectSymbol == other.classOrObjectSymbol) - - override fun hashCode(): Int = kotlinOrigin.hashCode() - - override fun getName(): String = classOrObjectSymbol.name.asString() - - override fun hasModifierProperty(@NonNls name: String): Boolean = modifierList?.hasModifierProperty(name) ?: false - - override fun isInterface(): Boolean = - classOrObjectSymbol.classKind == KtClassKind.INTERFACE || classOrObjectSymbol.classKind == KtClassKind.ANNOTATION_CLASS - - override fun isAnnotationType(): Boolean = - classOrObjectSymbol.classKind == KtClassKind.ANNOTATION_CLASS - - override fun isEnum(): Boolean = - classOrObjectSymbol.classKind == KtClassKind.ENUM_CLASS - - override fun hasTypeParameters(): Boolean = - classOrObjectSymbol is KtClass && classOrObjectSymbol.typeParameters.isNotEmpty() - - override fun isValid(): Boolean = kotlinOrigin?.isValid ?: true - - override fun isInheritor(baseClass: PsiClass, checkDeep: Boolean): Boolean = - InheritanceImplUtil.isInheritor(this, baseClass, checkDeep) - - @Throws(IncorrectOperationException::class) - override fun setName(@NonNls name: String): PsiElement = - throw IncorrectOperationException() - - override fun toString() = - "${this::class.java.simpleName}:${kotlinOrigin?.getDebugText()}" - - override fun getUseScope(): SearchScope = kotlinOrigin?.useScope ?: TODO() - override fun getElementType(): IStubElementType, *>? = kotlinOrigin?.elementType - override fun getStub(): KotlinClassOrObjectStub? = kotlinOrigin?.stub - - override val originKind: LightClassOriginKind - get() = LightClassOriginKind.SOURCE - - override fun getQualifiedName() = kotlinOrigin?.fqName?.asString() - - override fun getInterfaces(): Array = PsiClassImplUtil.getInterfaces(this) - override fun getSuperClass(): PsiClass? = PsiClassImplUtil.getSuperClass(this) - override fun getSupers(): Array = PsiClassImplUtil.getSupers(this) - override fun getSuperTypes(): Array = PsiClassImplUtil.getSuperTypes(this) - override fun getVisibleSignatures(): MutableCollection = PsiSuperMethodImplUtil.getVisibleSignatures(this) - - override fun getRBrace(): PsiElement? = null - override fun getLBrace(): PsiElement? = null - - override fun getInitializers(): Array = emptyArray() - - override fun getContainingClass(): PsiClass? { - - val containingBody = kotlinOrigin?.parent as? KtClassBody - val containingClass = containingBody?.parent as? KtClassOrObject - containingClass?.let { return create(it) } - - val containingBlock = kotlinOrigin?.parent as? KtBlockExpression -// val containingScript = containingBlock?.parent as? KtScript -// containingScript?.let { return KtLightClassForScript.create(it) } - - return null - } - - override fun getParent(): PsiElement? = containingClass ?: containingFile - - override fun getScope(): PsiElement? = parent - - override fun isInheritorDeep(baseClass: PsiClass?, classToByPass: PsiClass?): Boolean = - baseClass?.let { InheritanceImplUtil.isInheritorDeep(this, it, classToByPass) } ?: false - - override fun copy(): FirLightClassForSymbol = - FirLightClassForSymbol(classOrObjectSymbol, manager) - - companion object { - fun create(classOrObject: KtClassOrObject): FirLightClassForSymbol? = - CachedValuesManager.getCachedValue(classOrObject) { - CachedValueProvider.Result - .create( - createNoCache(classOrObject), - KotlinModificationTrackerService.getInstance(classOrObject.project).outOfBlockModificationTracker - ) - } - - fun createNoCache(classOrObject: KtClassOrObject): FirLightClassForSymbol? { - val containingFile = classOrObject.containingFile - if (containingFile is KtCodeFragment) { - // Avoid building light classes for code fragments - return null - } - - if (classOrObject.shouldNotBeVisibleAsLightClass()) { - return null - } - - return when { - classOrObject.isObjectLiteral() -> return null //TODO - classOrObject.safeIsLocal() -> return null //TODO - classOrObject.hasModifier(KtTokens.INLINE_KEYWORD) -> return null //TODO - else -> FirLightClassForSymbol( - analyze(classOrObject) { classOrObject.getClassOrObjectSymbol() }, - manager = classOrObject.manager - ) - } - } - } -} \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightAnnotationClassSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightAnnotationClassSymbol.kt new file mode 100644 index 00000000000..3e74e931ff1 --- /dev/null +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightAnnotationClassSymbol.kt @@ -0,0 +1,67 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.asJava.classes + +import com.intellij.psi.PsiManager +import com.intellij.psi.PsiMethod +import com.intellij.psi.PsiReferenceList +import org.jetbrains.kotlin.asJava.classes.lazyPub +import org.jetbrains.kotlin.asJava.elements.KtLightField +import org.jetbrains.kotlin.asJava.elements.KtLightMethod +import org.jetbrains.kotlin.idea.asJava.FirLightClassForClassOrObjectSymbol +import org.jetbrains.kotlin.idea.frontend.api.fir.analyzeWithSymbolAsContext +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassKind +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassOrObjectSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtConstructorSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtFunctionSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolVisibility + +internal class FirLightAnnotationClassSymbol( + private val classOrObjectSymbol: KtClassOrObjectSymbol, + manager: PsiManager +) : FirLightInterfaceOrAnnotationClassSymbol(classOrObjectSymbol, manager) { + + init { + require(classOrObjectSymbol.classKind == KtClassKind.ANNOTATION_CLASS) + } + + override fun isAnnotationType(): Boolean = true + + private val _ownFields: List by lazyPub { +//TODO + mutableListOf().also { + it.addCompanionObjectFieldIfNeeded() + } + } + + override fun getOwnFields(): List = _ownFields + + private val _ownMethods: List by lazyPub { +//TODO + val result = mutableListOf() + + analyzeWithSymbolAsContext(classOrObjectSymbol) { + val visibleDeclarations = classOrObjectSymbol.getDeclaredMemberScope().getCallableSymbols() + .filterNot { it is KtFunctionSymbol && it.visibility == KtSymbolVisibility.PRIVATE } + .filterNot { it is KtConstructorSymbol } + + createMethods(visibleDeclarations, isTopLevel = false, result) + } + + result + } + + override fun getOwnMethods(): List = _ownMethods + + override fun getExtendsList(): PsiReferenceList? = null + + override fun equals(other: Any?): Boolean = + other is FirLightAnnotationClassSymbol && classOrObjectSymbol == other.classOrObjectSymbol + + override fun hashCode(): Int = classOrObjectSymbol.hashCode() + + override fun copy(): FirLightClassForClassOrObjectSymbol = FirLightAnnotationClassSymbol(classOrObjectSymbol, manager) +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassBase.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassBase.kt new file mode 100644 index 00000000000..d33adf7bde9 --- /dev/null +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassBase.kt @@ -0,0 +1,156 @@ +/* + * Copyright 2010-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.idea.asJava + +import com.intellij.navigation.ItemPresentation +import com.intellij.navigation.ItemPresentationProviders +import com.intellij.openapi.util.Pair +import com.intellij.psi.* +import com.intellij.psi.impl.PsiClassImplUtil +import com.intellij.psi.impl.PsiImplUtil +import com.intellij.psi.impl.PsiSuperMethodImplUtil +import com.intellij.psi.impl.light.LightElement +import com.intellij.psi.impl.source.PsiExtensibleClass +import com.intellij.psi.javadoc.PsiDocComment +import com.intellij.psi.scope.PsiScopeProcessor +import com.intellij.psi.util.PsiUtil +import org.jetbrains.annotations.NonNls +import org.jetbrains.kotlin.analyzer.KotlinModificationTrackerService +import org.jetbrains.kotlin.asJava.classes.KotlinClassInnerStuffCache +import org.jetbrains.kotlin.asJava.classes.KotlinClassInnerStuffCache.Companion.processDeclarationsInEnum +import org.jetbrains.kotlin.asJava.classes.KtLightClass +import org.jetbrains.kotlin.asJava.classes.cannotModify +import org.jetbrains.kotlin.idea.KotlinLanguage +import javax.swing.Icon + +abstract class FirLightClassBase protected constructor(manager: PsiManager) : LightElement(manager, KotlinLanguage.INSTANCE), PsiClass, + KtLightClass, PsiExtensibleClass { + + override val clsDelegate: PsiClass + get() = invalidAccess() + + protected open val myInnersCache = KotlinClassInnerStuffCache( + myClass = this, + externalDependencies = listOf(KotlinModificationTrackerService.getInstance(manager.project).outOfBlockModificationTracker) + ) + + override fun getFields(): Array = myInnersCache.fields + + override fun getMethods(): Array = myInnersCache.methods + + override fun getConstructors(): Array = myInnersCache.constructors + + override fun getInnerClasses(): Array = myInnersCache.innerClasses + + override fun getAllFields(): Array = PsiClassImplUtil.getAllFields(this) + + override fun getAllMethods(): Array = PsiClassImplUtil.getAllMethods(this) + + override fun getAllInnerClasses(): Array = PsiClassImplUtil.getAllInnerClasses(this) + + override fun findFieldByName(name: String, checkBases: Boolean) = + myInnersCache.findFieldByName(name, checkBases) + + override fun findMethodsByName(name: String, checkBases: Boolean): Array = + myInnersCache.findMethodsByName(name, checkBases) + + override fun findInnerClassByName(name: String, checkBases: Boolean): PsiClass? = + myInnersCache.findInnerClassByName(name, checkBases) + + override fun processDeclarations( + processor: PsiScopeProcessor, state: ResolveState, lastParent: PsiElement?, place: PsiElement + ): Boolean { + + if (isEnum && !processDeclarationsInEnum(processor, state, myInnersCache)) return false + + return PsiClassImplUtil.processDeclarationsInClass( + this, + processor, + state, + null, + lastParent, + place, + PsiUtil.getLanguageLevel(place), + false + ) + } + + override fun getText(): String = kotlinOrigin?.text ?: "" + + override fun getLanguage(): KotlinLanguage = KotlinLanguage.INSTANCE + + override fun getPresentation(): ItemPresentation? = + ItemPresentationProviders.getItemPresentation(this) + + abstract override fun equals(other: Any?): Boolean + + abstract override fun hashCode(): Int + + override fun getContext(): PsiElement = parent + + override fun isEquivalentTo(another: PsiElement?): Boolean = + PsiClassImplUtil.isClassEquivalentTo(this, another) + + override fun getDocComment(): PsiDocComment? = null + + override fun hasTypeParameters(): Boolean = PsiImplUtil.hasTypeParameters(this) + + override fun getExtendsListTypes(): Array = + PsiClassImplUtil.getExtendsListTypes(this) + + override fun getImplementsListTypes(): Array = + PsiClassImplUtil.getImplementsListTypes(this) + + override fun findMethodBySignature(patternMethod: PsiMethod?, checkBases: Boolean): PsiMethod? = + patternMethod?.let { PsiClassImplUtil.findMethodBySignature(this, it, checkBases) } + + override fun findMethodsBySignature(patternMethod: PsiMethod?, checkBases: Boolean): Array = + patternMethod?.let { PsiClassImplUtil.findMethodsBySignature(this, it, checkBases) } ?: emptyArray() + + override fun findMethodsAndTheirSubstitutorsByName( + @NonNls name: String?, + checkBases: Boolean + ): List?> = + PsiClassImplUtil.findMethodsAndTheirSubstitutorsByName(this, name, checkBases) + + override fun getAllMethodsAndTheirSubstitutors(): List?> { + return PsiClassImplUtil.getAllWithSubstitutorsByMap(this, PsiClassImplUtil.MemberType.METHOD) + } + + override fun getRBrace(): PsiElement? = null + + override fun getLBrace(): PsiElement? = null + + override fun getInitializers(): Array = PsiClassInitializer.EMPTY_ARRAY + + override fun getElementIcon(flags: Int): Icon? = + throw UnsupportedOperationException("This should be done by KotlinFirIconProvider") + + override fun getVisibleSignatures(): MutableCollection = PsiSuperMethodImplUtil.getVisibleSignatures(this) + + override fun setName(name: String): PsiElement? = cannotModify() + + abstract override fun copy(): PsiElement + + override fun accept(visitor: PsiElementVisitor) { + if (visitor is JavaElementVisitor) { + visitor.visitClass(this) + } else { + visitor.visitElement(this) + } + } +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForClassOrObjectSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForClassOrObjectSymbol.kt new file mode 100644 index 00000000000..4634e076c21 --- /dev/null +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForClassOrObjectSymbol.kt @@ -0,0 +1,180 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.asJava + +import com.intellij.openapi.util.Comparing +import com.intellij.psi.* +import com.intellij.psi.impl.InheritanceImplUtil +import com.intellij.psi.impl.PsiClassImplUtil +import com.intellij.psi.search.SearchScope +import com.intellij.psi.stubs.IStubElementType +import com.intellij.psi.stubs.StubElement +import org.jetbrains.annotations.NonNls +import org.jetbrains.kotlin.asJava.classes.KotlinSuperTypeListBuilder +import org.jetbrains.kotlin.asJava.classes.getOutermostClassOrObject +import org.jetbrains.kotlin.asJava.classes.lazyPub +import org.jetbrains.kotlin.asJava.elements.KtLightField +import org.jetbrains.kotlin.asJava.elements.KtLightIdentifier +import org.jetbrains.kotlin.fir.symbols.StandardClassIds +import org.jetbrains.kotlin.idea.asJava.classes.getOrCreateFirLightClass +import org.jetbrains.kotlin.idea.frontend.api.symbols.* +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolKind +import org.jetbrains.kotlin.idea.frontend.api.types.KtClassType +import org.jetbrains.kotlin.idea.frontend.api.types.KtType +import org.jetbrains.kotlin.idea.util.ifFalse +import org.jetbrains.kotlin.load.java.structure.LightClassOriginKind +import org.jetbrains.kotlin.psi.KtBlockExpression +import org.jetbrains.kotlin.psi.KtClass +import org.jetbrains.kotlin.psi.KtClassBody +import org.jetbrains.kotlin.psi.KtClassOrObject +import org.jetbrains.kotlin.psi.debugText.getDebugText +import org.jetbrains.kotlin.psi.stubs.KotlinClassOrObjectStub + +internal abstract class FirLightClassForClassOrObjectSymbol( + private val classOrObjectSymbol: KtClassOrObjectSymbol, + manager: PsiManager +) : FirLightClassBase(manager), + StubBasedPsiElement> { + + private val isTopLevel: Boolean = classOrObjectSymbol.symbolKind == KtSymbolKind.TOP_LEVEL + + abstract override fun getModifierList(): PsiModifierList? + abstract override fun getOwnFields(): List + abstract override fun getOwnMethods(): List + override fun isDeprecated(): Boolean = false //TODO() + override fun getNameIdentifier(): KtLightIdentifier? = null //TODO() + abstract override fun getExtendsList(): PsiReferenceList? + abstract override fun getImplementsList(): PsiReferenceList? + override fun getTypeParameterList(): PsiTypeParameterList? = null //TODO() + override fun getTypeParameters(): Array = emptyArray() //TODO() + + abstract override fun getOwnInnerClasses(): List + + override fun getTextOffset(): Int = kotlinOrigin?.textOffset ?: 0 + override fun getStartOffsetInParent(): Int = kotlinOrigin?.startOffsetInParent ?: 0 + override fun isWritable() = kotlinOrigin?.isWritable ?: false + override val kotlinOrigin: KtClassOrObject? = classOrObjectSymbol.psi as? KtClassOrObject + + protected fun createInheritanceList(forExtendsList: Boolean): PsiReferenceList { + + val role = if (forExtendsList) PsiReferenceList.Role.EXTENDS_LIST else PsiReferenceList.Role.IMPLEMENTS_LIST + + val listBuilder = KotlinSuperTypeListBuilder( + kotlinOrigin = kotlinOrigin?.getSuperTypeList(), + manager = manager, + language = language, + role = role + ) + + fun KtType.needToAddTypeIntoList(): Boolean { + if (this !is KtClassType) return false + + // Do not add redundant "extends java.lang.Object" anywhere + if (this.classId == StandardClassIds.Any) return false + + // We don't have Enum among enums supertype in sources neither we do for decompiled class-files and light-classes + if (isEnum && this.classId == StandardClassIds.Enum) return false + + val isInterfaceType = + (this.classSymbol as? KtClassOrObjectSymbol)?.classKind == KtClassKind.INTERFACE + + return forExtendsList == !isInterfaceType + } + + //TODO Add support for kotlin.collections. + classOrObjectSymbol.superTypes + .filterIsInstance() + .filter { it.needToAddTypeIntoList() } + .mapNotNull { it.mapSupertype(this, kotlinCollectionAsIs = true) } + .forEach { listBuilder.addReference(it) } + + return listBuilder + } + + protected fun MutableList.addCompanionObjectFieldIfNeeded() { + classOrObjectSymbol.companionObject?.run { + add(FirLightFieldForObjectSymbol(this, this@FirLightClassForClassOrObjectSymbol, null)) + } + } + + private val _containingFile: PsiFile? by lazyPub { + + val kotlinOrigin = kotlinOrigin ?: return@lazyPub null + + val containingClass = isTopLevel.ifFalse { getOrCreateFirLightClass(getOutermostClassOrObject(kotlinOrigin)) } ?: this + + FirFakeFileImpl(kotlinOrigin, containingClass) + } + + override fun getContainingFile(): PsiFile? = _containingFile + + override fun getNavigationElement(): PsiElement = kotlinOrigin ?: this + + override fun isEquivalentTo(another: PsiElement?): Boolean = + basicIsEquivalentTo(this, another) || + another is PsiClass && qualifiedName != null && Comparing.equal(another.qualifiedName, qualifiedName) + + abstract override fun equals(other: Any?): Boolean + + abstract override fun hashCode(): Int + + override fun getName(): String = classOrObjectSymbol.name.asString() + + override fun hasModifierProperty(@NonNls name: String): Boolean = modifierList?.hasModifierProperty(name) ?: false + + abstract override fun isInterface(): Boolean + + abstract override fun isAnnotationType(): Boolean + + abstract override fun isEnum(): Boolean + + override fun hasTypeParameters(): Boolean = + classOrObjectSymbol is KtClass && classOrObjectSymbol.typeParameters.isNotEmpty() + + override fun isValid(): Boolean = kotlinOrigin?.isValid ?: true + + override fun isInheritor(baseClass: PsiClass, checkDeep: Boolean): Boolean = + InheritanceImplUtil.isInheritor(this, baseClass, checkDeep) + + override fun toString() = + "${this::class.java.simpleName}:${kotlinOrigin?.getDebugText()}" + + override fun getUseScope(): SearchScope = kotlinOrigin?.useScope ?: TODO() + override fun getElementType(): IStubElementType, *>? = kotlinOrigin?.elementType + override fun getStub(): KotlinClassOrObjectStub? = kotlinOrigin?.stub + + override val originKind: LightClassOriginKind + get() = LightClassOriginKind.SOURCE + + override fun getQualifiedName() = kotlinOrigin?.fqName?.asString() + + override fun getInterfaces(): Array = PsiClassImplUtil.getInterfaces(this) + override fun getSuperClass(): PsiClass? = PsiClassImplUtil.getSuperClass(this) + override fun getSupers(): Array = PsiClassImplUtil.getSupers(this) + override fun getSuperTypes(): Array = PsiClassImplUtil.getSuperTypes(this) + + override fun getContainingClass(): PsiClass? { + + val containingBody = kotlinOrigin?.parent as? KtClassBody + val containingClass = containingBody?.parent as? KtClassOrObject + containingClass?.let { return getOrCreateFirLightClass(it) } + + val containingBlock = kotlinOrigin?.parent as? KtBlockExpression +// val containingScript = containingBlock?.parent as? KtScript +// containingScript?.let { return KtLightClassForScript.create(it) } + + return null + } + + override fun getParent(): PsiElement? = containingClass ?: containingFile + + override fun getScope(): PsiElement? = parent + + override fun isInheritorDeep(baseClass: PsiClass?, classToByPass: PsiClass?): Boolean = + baseClass?.let { InheritanceImplUtil.isInheritorDeep(this, it, classToByPass) } ?: false + + abstract override fun copy(): FirLightClassForClassOrObjectSymbol +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForEnumEntry.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForEnumEntry.kt new file mode 100644 index 00000000000..3765c197186 --- /dev/null +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForEnumEntry.kt @@ -0,0 +1,139 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.asJava.classes + +import com.intellij.psi.* +import com.intellij.psi.impl.PsiClassImplUtil +import org.jetbrains.kotlin.asJava.elements.KtLightMethod +import org.jetbrains.kotlin.idea.asJava.* +import org.jetbrains.kotlin.idea.asJava.FirLightClassModifierList +import org.jetbrains.kotlin.idea.asJava.FirLightPsiJavaCodeReferenceElementWithNoReference +import org.jetbrains.kotlin.idea.asJava.classes.createMethods +import org.jetbrains.kotlin.idea.asJava.fields.FirLightFieldForEnumEntry +import org.jetbrains.kotlin.idea.frontend.api.fir.analyzeWithSymbolAsContext +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtEnumEntrySymbol +import org.jetbrains.kotlin.idea.frontend.api.types.KtClassType +import org.jetbrains.kotlin.load.java.structure.LightClassOriginKind +import org.jetbrains.kotlin.psi.KtClassOrObject + +internal class FirLightClassForEnumEntry( + private val enumEntrySymbol: KtEnumEntrySymbol, + private val enumConstant: FirLightFieldForEnumEntry, + private val enumClass: FirLightClassForSymbol, + manager: PsiManager +) : FirLightClassBase(manager), PsiEnumConstantInitializer { + + override fun getName(): String? = enumEntrySymbol.name.asString() + + override fun getBaseClassType(): PsiClassType = enumConstant.type as PsiClassType //???TODO + + override fun getBaseClassReference(): PsiJavaCodeReferenceElement = + FirLightPsiJavaCodeReferenceElementWithNoReference(enumConstant) //???TODO + + override fun getArgumentList(): PsiExpressionList? = null + + override fun getEnumConstant(): PsiEnumConstant = enumConstant + + override fun isInQualifiedNew(): Boolean = false + + override fun equals(other: Any?): Boolean = + other is FirLightClassForEnumEntry && + this.enumEntrySymbol == other.enumEntrySymbol + + override fun hashCode(): Int = + enumEntrySymbol.hashCode() + + override fun copy(): PsiElement = + FirLightClassForEnumEntry(enumEntrySymbol, enumConstant, enumClass, manager) + + override fun toString(): String = "FirLightClassForEnumEntry for $name" + + override fun getNameIdentifier(): PsiIdentifier? = null //TODO + + private val _modifierList: PsiModifierList by lazyPub { + FirLightClassModifierList( + containingDeclaration = this, + modifiers = setOf(PsiModifier.PUBLIC, PsiModifier.STATIC, PsiModifier.FINAL), + annotations = emptyList() + ) + } + + override fun getModifierList(): PsiModifierList? = _modifierList + + override fun hasModifierProperty(name: String): Boolean = + name == PsiModifier.PUBLIC || name == PsiModifier.STATIC || name == PsiModifier.FINAL + + override fun getContainingClass(): PsiClass? = enumClass + + override fun isDeprecated(): Boolean = false + + override fun getTypeParameters(): Array = emptyArray() + + override fun getTypeParameterList(): PsiTypeParameterList? = null + + override fun getQualifiedName(): String? = "${enumConstant.containingClass.qualifiedName}.${enumConstant.name}" + + override fun isInterface(): Boolean = false + + override fun isAnnotationType(): Boolean = false + + override fun isEnum(): Boolean = false + + private val _extendsList: PsiReferenceList? by lazyPub { + + val mappedType = (enumEntrySymbol.type as? KtClassType)?.let { + it.mapSupertype(this@FirLightClassForEnumEntry) + } ?: return@lazyPub null + + KotlinSuperTypeListBuilder( + kotlinOrigin = enumClass.kotlinOrigin?.getSuperTypeList(), + manager = manager, + language = language, + role = PsiReferenceList.Role.EXTENDS_LIST + ).also { + it.addReference(mappedType) + } + } + + override fun getExtendsList(): PsiReferenceList? = _extendsList + + override fun getImplementsList(): PsiReferenceList? = null + + override fun getSuperClass(): PsiClass? = enumClass + + override fun getInterfaces(): Array = PsiClass.EMPTY_ARRAY + + override fun getSupers(): Array = arrayOf(enumClass) + + override fun getSuperTypes(): Array = PsiClassImplUtil.getSuperTypes(this) + + override fun getParent(): PsiElement? = containingClass ?: containingFile + + override fun getScope(): PsiElement? = parent + + override fun isInheritor(baseClass: PsiClass, checkDeep: Boolean): Boolean = false //TODO + + override fun isInheritorDeep(baseClass: PsiClass?, classToByPass: PsiClass?): Boolean = false //TODO + + override val kotlinOrigin: KtClassOrObject? = enumConstant.kotlinOrigin + + override val originKind: LightClassOriginKind = LightClassOriginKind.SOURCE + + override fun getOwnFields(): MutableList = mutableListOf() + + override fun getOwnMethods(): MutableList { + val result = mutableListOf() + + analyzeWithSymbolAsContext(enumEntrySymbol) { + val callableSymbols = enumEntrySymbol.getDeclaredMemberScope().getCallableSymbols() + createMethods(callableSymbols, isTopLevel = false, result) + } + + return result + } + + override fun getOwnInnerClasses(): MutableList = mutableListOf() +} diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/class/FirLightClassForFacade.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt similarity index 91% rename from idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/class/FirLightClassForFacade.kt rename to idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt index 2a1db0cb593..7aad6cd5fdd 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/class/FirLightClassForFacade.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt @@ -8,26 +8,23 @@ package org.jetbrains.kotlin.idea.asJava import com.intellij.openapi.util.Comparing import com.intellij.openapi.util.TextRange import com.intellij.psi.* -import com.intellij.psi.impl.PsiSuperMethodImplUtil import com.intellij.psi.impl.light.LightEmptyImplementsList import com.intellij.psi.impl.light.LightModifierList import org.jetbrains.annotations.NonNls import org.jetbrains.kotlin.asJava.classes.* import org.jetbrains.kotlin.asJava.elements.* -import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil import org.jetbrains.kotlin.fileClasses.javaFileFacadeFqName import org.jetbrains.kotlin.fir.declarations.* -import org.jetbrains.kotlin.fir.types.ConeNullability import org.jetbrains.kotlin.idea.KotlinLanguage +import org.jetbrains.kotlin.idea.asJava.classes.createFields +import org.jetbrains.kotlin.idea.asJava.classes.createMethods import org.jetbrains.kotlin.idea.frontend.api.analyze import org.jetbrains.kotlin.idea.frontend.api.symbols.KtCallableSymbol import org.jetbrains.kotlin.load.java.structure.LightClassOriginKind import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.isPrivate -import org.jetbrains.kotlin.util.collectionUtils.filterIsInstanceAnd -import javax.swing.Icon class FirLightClassForFacade( manager: PsiManager, @@ -200,20 +197,12 @@ class FirLightClassForFacade( override fun getAllInnerClasses(): Array = PsiClass.EMPTY_ARRAY - override fun getInitializers(): Array = PsiClassInitializer.EMPTY_ARRAY - override fun findInnerClassByName(@NonNls name: String, checkBases: Boolean): PsiClass? = null override fun isInheritorDeep(baseClass: PsiClass?, classToByPass: PsiClass?): Boolean = false - override fun getLBrace(): PsiElement? = null - - override fun getRBrace(): PsiElement? = null - override fun getName(): String = facadeClassFqName.shortName().asString() - override fun setName(name: String): PsiElement? = cannotModify() - override fun getQualifiedName() = facadeClassFqName.asString() override fun getNameIdentifier(): PsiIdentifier? = null @@ -225,8 +214,6 @@ class FirLightClassForFacade( override fun isEquivalentTo(another: PsiElement?): Boolean = equals(another) || another is FirLightClassForFacade && Comparing.equal(another.qualifiedName, qualifiedName) - override fun getElementIcon(flags: Int): Icon? = throw UnsupportedOperationException("This should be done by JetIconProvider") - override fun isInheritor(baseClass: PsiClass, checkDeep: Boolean): Boolean { return baseClass.qualifiedName == CommonClassNames.JAVA_LANG_OBJECT } @@ -267,6 +254,4 @@ class FirLightClassForFacade( override fun getStartOffsetInParent() = firstFileInFacade.startOffsetInParent override fun isWritable() = files.all { it.isWritable } - - override fun getVisibleSignatures(): MutableCollection = PsiSuperMethodImplUtil.getVisibleSignatures(this) } \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt new file mode 100644 index 00000000000..1f211b4b10b --- /dev/null +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt @@ -0,0 +1,195 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.asJava + +import com.intellij.psi.* +import org.jetbrains.kotlin.asJava.classes.METHOD_INDEX_FOR_DEFAULT_CTOR +import org.jetbrains.kotlin.asJava.classes.lazyPub +import org.jetbrains.kotlin.asJava.elements.KtLightField +import org.jetbrains.kotlin.asJava.elements.KtLightMethod +import org.jetbrains.kotlin.idea.asJava.classes.createFields +import org.jetbrains.kotlin.idea.asJava.classes.createMethods +import org.jetbrains.kotlin.idea.asJava.fields.FirLightFieldForEnumEntry +import org.jetbrains.kotlin.idea.frontend.api.fir.analyzeWithSymbolAsContext +import org.jetbrains.kotlin.idea.frontend.api.symbols.* +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolKind +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolVisibility +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithVisibility + +internal class FirLightClassForSymbol( + private val classOrObjectSymbol: KtClassOrObjectSymbol, + manager: PsiManager +) : FirLightClassForClassOrObjectSymbol(classOrObjectSymbol, manager) { + + init { + require(classOrObjectSymbol.classKind != KtClassKind.INTERFACE && classOrObjectSymbol.classKind != KtClassKind.ANNOTATION_CLASS) + } + + internal fun tryGetEffectiveVisibility(symbol: KtCallableSymbol): KtSymbolVisibility? { + + if (symbol !is KtPropertySymbol && symbol !is KtFunctionSymbol) return null + + var visibility = (symbol as? KtSymbolWithVisibility)?.visibility + + analyzeWithSymbolAsContext(symbol) { + for (overriddenSymbol in symbol.getOverriddenSymbols(classOrObjectSymbol)) { + val newVisibility = (overriddenSymbol as? KtSymbolWithVisibility)?.visibility + if (newVisibility != null) { + visibility = newVisibility + } + } + } + + return visibility + } + + private val isTopLevel: Boolean = classOrObjectSymbol.symbolKind == KtSymbolKind.TOP_LEVEL + + private val _modifierList: PsiModifierList? by lazyPub { + + val modifiers = mutableSetOf(classOrObjectSymbol.computeVisibility(isTopLevel)) + classOrObjectSymbol.computeSimpleModality()?.run { + modifiers.add(this) + } + if (!isTopLevel && !classOrObjectSymbol.isInner) { + modifiers.add(PsiModifier.STATIC) + } + + val annotations = classOrObjectSymbol.computeAnnotations( + parent = this@FirLightClassForSymbol, + nullability = NullabilityType.Unknown, + annotationUseSiteTarget = null, + ) + + FirLightClassModifierList(this@FirLightClassForSymbol, modifiers, annotations) + } + + override fun getModifierList(): PsiModifierList? = _modifierList + override fun getOwnFields(): List = _ownFields + override fun getOwnMethods(): List = _ownMethods + override fun getExtendsList(): PsiReferenceList? = _extendsList + override fun getImplementsList(): PsiReferenceList? = _implementsList + + override fun getOwnInnerClasses(): List { + val result = ArrayList() + + // workaround for ClassInnerStuffCache not supporting classes with null names, see KT-13927 + // inner classes with null names can't be searched for and can't be used from java anyway + // we can't prohibit creating light classes with null names either since they can contain members + + analyzeWithSymbolAsContext(classOrObjectSymbol) { + classOrObjectSymbol.getDeclaredMemberScope().getAllSymbols().filterIsInstance().mapTo(result) { + FirLightClassForSymbol(it, manager) + } + } + + //TODO + //if (classOrObject.hasInterfaceDefaultImpls) { + // result.add(KtLightClassForInterfaceDefaultImpls(classOrObject)) + //} + return result + } + + override fun getTextOffset(): Int = kotlinOrigin?.textOffset ?: 0 + override fun getStartOffsetInParent(): Int = kotlinOrigin?.startOffsetInParent ?: 0 + override fun isWritable() = kotlinOrigin?.isWritable ?: false + + private val _extendsList by lazyPub { createInheritanceList(forExtendsList = true) } + private val _implementsList by lazyPub { createInheritanceList(forExtendsList = false) } + + private val _ownMethods: List by lazyPub { + + val result = mutableListOf() + + analyzeWithSymbolAsContext(classOrObjectSymbol) { + val callableSymbols = classOrObjectSymbol.getDeclaredMemberScope().getCallableSymbols() + val visibleDeclarations = callableSymbols.applyIf(isEnum) { + filterNot { function -> + function is KtFunctionSymbol && function.name.asString().let { it == "values" || it == "valueOf" } + } + } + + createMethods(visibleDeclarations, isTopLevel = false, result) + } + + if (result.none { it.isConstructor }) { + classOrObjectSymbol.primaryConstructor?.let { + result.add( + FirLightConstructorForSymbol( + constructorSymbol = it, + lightMemberOrigin = null, + containingClass = this, + methodIndex = METHOD_INDEX_FOR_DEFAULT_CTOR + ) + ) + } + } + + result + } + + private val _ownFields: List by lazyPub { + + val result = mutableListOf() + + result.addCompanionObjectFieldIfNeeded() + + classOrObjectSymbol.companionObject?.run { + analyzeWithSymbolAsContext(this) { + getDeclaredMemberScope().getCallableSymbols() + .filterIsInstance() + .filter { it.hasJvmFieldAnnotation() || it.isConst } + .mapTo(result) { + FirLightFieldForPropertySymbol( + propertySymbol = it, + containingClass = this@FirLightClassForSymbol, + lightMemberOrigin = null, + isTopLevel = false, + forceStatic = true + ) + } + } + } + + val isNamedObject = classOrObjectSymbol.classKind == KtClassKind.OBJECT + if (isNamedObject && classOrObjectSymbol.symbolKind != KtSymbolKind.LOCAL) { + result.add(FirLightFieldForObjectSymbol(classOrObjectSymbol, this@FirLightClassForSymbol, null)) + } + + analyzeWithSymbolAsContext(classOrObjectSymbol) { + val propertySymbols = classOrObjectSymbol.getDeclaredMemberScope().getCallableSymbols() + .filterIsInstance() + .applyIf(classOrObjectSymbol.classKind == KtClassKind.COMPANION_OBJECT) { + filter { it.hasJvmFieldAnnotation() || it.isConst } + } + createFields(propertySymbols, isTopLevel = false, result) + + if (isEnum) { + classOrObjectSymbol.getDeclaredMemberScope().getCallableSymbols() + .filterIsInstance() + .mapTo(result) { FirLightFieldForEnumEntry(it, this@FirLightClassForSymbol, null) } + } + + } + + result + } + + override fun hashCode(): Int = classOrObjectSymbol.hashCode() + + override fun equals(other: Any?): Boolean = + this === other || (other is FirLightClassForSymbol && classOrObjectSymbol == other.classOrObjectSymbol) + + override fun isInterface(): Boolean = false + + override fun isAnnotationType(): Boolean = false + + override fun isEnum(): Boolean = + classOrObjectSymbol.classKind == KtClassKind.ENUM_CLASS + + override fun copy(): FirLightClassForSymbol = + FirLightClassForSymbol(classOrObjectSymbol, manager) +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightInterfaceClassSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightInterfaceClassSymbol.kt new file mode 100644 index 00000000000..44a14f165de --- /dev/null +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightInterfaceClassSymbol.kt @@ -0,0 +1,69 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.asJava.classes + +import com.intellij.psi.PsiManager +import com.intellij.psi.PsiMethod +import com.intellij.psi.PsiReferenceList +import org.jetbrains.kotlin.asJava.classes.lazyPub +import org.jetbrains.kotlin.asJava.elements.KtLightField +import org.jetbrains.kotlin.asJava.elements.KtLightMethod +import org.jetbrains.kotlin.idea.asJava.FirLightClassForClassOrObjectSymbol +import org.jetbrains.kotlin.idea.frontend.api.fir.analyzeWithSymbolAsContext +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassKind +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassOrObjectSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtFunctionSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolVisibility + +internal class FirLightInterfaceClassSymbol( + private val classOrObjectSymbol: KtClassOrObjectSymbol, + manager: PsiManager +) : FirLightInterfaceOrAnnotationClassSymbol(classOrObjectSymbol, manager) { + + init { + require(classOrObjectSymbol.classKind == KtClassKind.INTERFACE) + } + + private val _ownFields: List by lazyPub { + mutableListOf().also { + it.addCompanionObjectFieldIfNeeded() + } + } + + override fun getOwnFields(): List = _ownFields + + private val _ownMethods: List by lazyPub { + + val result = mutableListOf() + + analyzeWithSymbolAsContext(classOrObjectSymbol) { + val visibleDeclarations = classOrObjectSymbol.getDeclaredMemberScope().getCallableSymbols() + .filterNot { it is KtFunctionSymbol && it.visibility == KtSymbolVisibility.PRIVATE } + + createMethods(visibleDeclarations, isTopLevel = false, result) + } + + result + } + + override fun getOwnMethods(): List = _ownMethods + + override fun equals(other: Any?): Boolean = + other === this || (other is FirLightInterfaceClassSymbol && classOrObjectSymbol == other.classOrObjectSymbol) + + override fun hashCode(): Int = classOrObjectSymbol.hashCode() + + override fun isAnnotationType(): Boolean = false + + override fun copy(): FirLightClassForClassOrObjectSymbol = + FirLightInterfaceClassSymbol(classOrObjectSymbol, manager) + + private val _extendsList: PsiReferenceList by lazyPub { + createInheritanceList(forExtendsList = false) + } + + override fun getExtendsList(): PsiReferenceList? = _extendsList +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightInterfaceOrAnnotationClassSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightInterfaceOrAnnotationClassSymbol.kt new file mode 100644 index 00000000000..77d9eafa9f1 --- /dev/null +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightInterfaceOrAnnotationClassSymbol.kt @@ -0,0 +1,48 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.asJava.classes + +import com.intellij.psi.* +import org.jetbrains.kotlin.asJava.classes.lazyPub +import org.jetbrains.kotlin.idea.asJava.* +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassKind +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassOrObjectSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolKind + +internal abstract class FirLightInterfaceOrAnnotationClassSymbol( + private val classOrObjectSymbol: KtClassOrObjectSymbol, + manager: PsiManager +) : FirLightClassForClassOrObjectSymbol(classOrObjectSymbol, manager) { + + init { + require(classOrObjectSymbol.classKind == KtClassKind.INTERFACE || classOrObjectSymbol.classKind == KtClassKind.ANNOTATION_CLASS) + } + + private val _modifierList: PsiModifierList? by lazyPub { + + val isTopLevel: Boolean = classOrObjectSymbol.symbolKind == KtSymbolKind.TOP_LEVEL + + val modifiers = mutableSetOf(classOrObjectSymbol.computeVisibility(isTopLevel), PsiModifier.ABSTRACT) + + val annotations = classOrObjectSymbol.computeAnnotations( + parent = this@FirLightInterfaceOrAnnotationClassSymbol, + nullability = NullabilityType.Unknown, + annotationUseSiteTarget = null, + ) + + FirLightClassModifierList(this@FirLightInterfaceOrAnnotationClassSymbol, modifiers, annotations) + } + + override fun getModifierList(): PsiModifierList? = _modifierList + + override fun getImplementsList(): PsiReferenceList? = null + + override fun getOwnInnerClasses(): List = emptyList() + + override fun isInterface(): Boolean = true + + override fun isEnum(): Boolean = false +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt new file mode 100644 index 00000000000..a3b4b5cc41d --- /dev/null +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt @@ -0,0 +1,214 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.asJava.classes + +import com.intellij.psi.util.CachedValueProvider +import com.intellij.psi.util.CachedValuesManager +import org.jetbrains.kotlin.analyzer.KotlinModificationTrackerService +import org.jetbrains.kotlin.asJava.classes.KtLightClass +import org.jetbrains.kotlin.asJava.classes.METHOD_INDEX_BASE +import org.jetbrains.kotlin.asJava.classes.safeIsLocal +import org.jetbrains.kotlin.asJava.classes.shouldNotBeVisibleAsLightClass +import org.jetbrains.kotlin.asJava.elements.KtLightField +import org.jetbrains.kotlin.asJava.elements.KtLightMethod +import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget +import org.jetbrains.kotlin.idea.asJava.* +import org.jetbrains.kotlin.idea.asJava.FirLightClassForSymbol +import org.jetbrains.kotlin.idea.asJava.fields.FirLightFieldForEnumEntry +import org.jetbrains.kotlin.idea.frontend.api.analyze +import org.jetbrains.kotlin.idea.frontend.api.symbols.* +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtAnnotatedSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtCommonSymbolModality +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithVisibility +import org.jetbrains.kotlin.lexer.KtTokens +import org.jetbrains.kotlin.psi.* +import org.jetbrains.kotlin.psi.psiUtil.containingClass +import org.jetbrains.kotlin.psi.psiUtil.isObjectLiteral +import java.util.* + +fun getOrCreateFirLightClass(classOrObject: KtClassOrObject): KtLightClass? = + CachedValuesManager.getCachedValue(classOrObject) { + CachedValueProvider.Result + .create( + createFirLightClassNoCache(classOrObject), + KotlinModificationTrackerService.getInstance(classOrObject.project).outOfBlockModificationTracker + ) + } + +fun createFirLightClassNoCache(classOrObject: KtClassOrObject): KtLightClass? { + + val containingFile = classOrObject.containingFile + if (containingFile is KtCodeFragment) { + // Avoid building light classes for code fragments + return null + } + + if (containingFile is KtFile && containingFile.isCompiled) return null + + if (classOrObject.shouldNotBeVisibleAsLightClass()) { + return null + } + + return when { + classOrObject is KtEnumEntry -> lightClassForEnumEntry(classOrObject) + classOrObject.isObjectLiteral() -> return null //TODO + classOrObject.safeIsLocal() -> return null //TODO + classOrObject.hasModifier(KtTokens.INLINE_KEYWORD) -> return null //TODO + else -> { + analyze(classOrObject) { + val symbol = classOrObject.getClassOrObjectSymbol() + when (symbol.classKind) { + KtClassKind.INTERFACE -> FirLightInterfaceClassSymbol(symbol, classOrObject.manager) + KtClassKind.ANNOTATION_CLASS -> FirLightAnnotationClassSymbol(symbol, classOrObject.manager) + else -> FirLightClassForSymbol(symbol, classOrObject.manager) + } + } + } + } +} + + +private fun lightClassForEnumEntry(ktEnumEntry: KtEnumEntry): KtLightClass? { + if (ktEnumEntry.body == null) return null + + val firClass = ktEnumEntry + .containingClass() + ?.let { getOrCreateFirLightClass(it) } as? FirLightClassForSymbol + ?: return null + + val targetField = firClass.ownFields + .firstOrNull { it is FirLightFieldForEnumEntry && it.kotlinOrigin == ktEnumEntry } + ?: return null + + return (targetField as? FirLightFieldForEnumEntry)?.initializingClass as? KtLightClass +} + +internal fun FirLightClassBase.createMethods( + declarations: Sequence, + isTopLevel: Boolean, + result: MutableList +) { + var methodIndex = METHOD_INDEX_BASE + for (declaration in declarations) { + + if (declaration is KtFunctionSymbol && declaration.isInline) continue + + if (declaration is KtAnnotatedSymbol && declaration.hasJvmSyntheticAnnotation(annotationUseSiteTarget = null)) continue + + if (declaration is KtAnnotatedSymbol && declaration.isHiddenByDeprecation(annotationUseSiteTarget = null)) continue + + when (declaration) { + is KtFunctionSymbol -> { + result.add( + FirLightSimpleMethodForSymbol( + functionSymbol = declaration, + lightMemberOrigin = null, + containingClass = this@createMethods, + isTopLevel = isTopLevel, + methodIndex = methodIndex++ + ) + ) + + if (declaration.hasJvmOverloadsAnnotation()) { + val skipMask = BitSet(declaration.valueParameters.size) + + for (i in declaration.valueParameters.size - 1 downTo 0) { + + if (!declaration.valueParameters[i].hasDefaultValue) continue + + skipMask.set(i) + + result.add( + FirLightSimpleMethodForSymbol( + functionSymbol = declaration, + lightMemberOrigin = null, + containingClass = this@createMethods, + isTopLevel = isTopLevel, + methodIndex = methodIndex++, + argumentsSkipMask = skipMask + ) + ) + } + } + } + is KtConstructorSymbol -> { + result.add( + FirLightConstructorForSymbol( + constructorSymbol = declaration, + lightMemberOrigin = null, + containingClass = this@createMethods, + methodIndex++ + ) + ) + } + is KtPropertySymbol -> { + + if (declaration.hasJvmFieldAnnotation()) continue + + val getter = declaration.getter?.takeIf { + !declaration.hasJvmSyntheticAnnotation(AnnotationUseSiteTarget.PROPERTY_GETTER) && + !it.isInline && + !declaration.isHiddenByDeprecation(AnnotationUseSiteTarget.PROPERTY_GETTER) + } + + if (getter != null) { + result.add( + FirLightAccessorMethodForSymbol( + propertyAccessorSymbol = getter, + containingPropertySymbol = declaration, + lightMemberOrigin = null, + containingClass = this@createMethods, + isTopLevel = isTopLevel + ) + ) + } + + val setter = declaration.setter?.takeIf { + !isAnnotationType && + !declaration.hasJvmSyntheticAnnotation(AnnotationUseSiteTarget.PROPERTY_SETTER) && + !it.isInline && + !declaration.isHiddenByDeprecation(AnnotationUseSiteTarget.PROPERTY_GETTER) + } + + if (setter != null) { + result.add( + FirLightAccessorMethodForSymbol( + propertyAccessorSymbol = setter, + containingPropertySymbol = declaration, + lightMemberOrigin = null, + containingClass = this@createMethods, + isTopLevel = isTopLevel + ) + ) + } + } + } + } +} + +internal fun FirLightClassBase.createFields( + declarations: Sequence, + isTopLevel: Boolean, + result: MutableList +) { + //TODO isHiddenByDeprecation + for (declaration in declarations) { + if (declaration !is KtPropertySymbol) continue + + if (!declaration.hasBackingField) continue + if (declaration.hasJvmSyntheticAnnotation(AnnotationUseSiteTarget.FIELD)) continue + if (declaration.modality == KtCommonSymbolModality.ABSTRACT) continue + + result.add( + FirLightFieldForPropertySymbol( + propertySymbol = declaration, + containingClass = this@createFields, + lightMemberOrigin = null, + isTopLevel = isTopLevel + ) + ) + } +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/codeReferences/FirLightPsiJavaCodeReferenceElementWithReference.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/codeReferences/FirLightPsiJavaCodeReferenceElementWithReference.kt index c04f5966860..848deb7bdc7 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/codeReferences/FirLightPsiJavaCodeReferenceElementWithReference.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/codeReferences/FirLightPsiJavaCodeReferenceElementWithReference.kt @@ -5,10 +5,7 @@ package org.jetbrains.kotlin.idea.asJava -import com.intellij.openapi.util.TextRange import com.intellij.psi.* -import com.intellij.psi.scope.PsiScopeProcessor -import com.intellij.util.IncorrectOperationException internal class FirLightPsiJavaCodeReferenceElementWithReference(private val ktElement: PsiElement, reference: PsiReference): FirLightPsiJavaCodeReferenceElementBase(ktElement), diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldEnumEntry.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldEnumEntry.kt new file mode 100644 index 00000000000..bef733f5b39 --- /dev/null +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldEnumEntry.kt @@ -0,0 +1,79 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.asJava.fields + +import com.intellij.psi.* +import org.jetbrains.kotlin.asJava.builder.LightMemberOrigin +import org.jetbrains.kotlin.asJava.classes.* +import org.jetbrains.kotlin.fir.declarations.FirResolvePhase +import org.jetbrains.kotlin.idea.asJava.FirLightClassForSymbol +import org.jetbrains.kotlin.idea.asJava.FirLightClassModifierList +import org.jetbrains.kotlin.idea.asJava.FirLightField +import org.jetbrains.kotlin.idea.asJava.asPsiType +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtEnumEntrySymbol +import org.jetbrains.kotlin.idea.util.ifTrue +import org.jetbrains.kotlin.psi.KtEnumEntry + +internal class FirLightFieldForEnumEntry( + private val enumEntrySymbol: KtEnumEntrySymbol, + containingClass: FirLightClassForSymbol, + override val lightMemberOrigin: LightMemberOrigin? +) : FirLightField(containingClass, lightMemberOrigin), PsiEnumConstant { + + private val _modifierList by lazyPub { + FirLightClassModifierList( + containingDeclaration = this@FirLightFieldForEnumEntry, + modifiers = setOf(PsiModifier.STATIC, PsiModifier.FINAL, PsiModifier.PUBLIC), + annotations = emptyList() + ) + } + + override fun getModifierList(): PsiModifierList? = _modifierList + + override val kotlinOrigin: KtEnumEntry? = enumEntrySymbol.psi as? KtEnumEntry + + //TODO Make with KtSymbols + private val hasBody: Boolean get() = kotlinOrigin?.let { it.body != null } ?: true + + private val _initializingClass: PsiEnumConstantInitializer? by lazyPub { + hasBody.ifTrue { + FirLightClassForEnumEntry( + enumEntrySymbol = enumEntrySymbol, + enumConstant = this@FirLightFieldForEnumEntry, + enumClass = containingClass, + manager = manager + ) + } + } + + override fun getInitializingClass(): PsiEnumConstantInitializer? = _initializingClass + override fun getOrCreateInitializingClass(): PsiEnumConstantInitializer = + _initializingClass ?: cannotModify() + + override fun getArgumentList(): PsiExpressionList? = null + override fun resolveMethod(): PsiMethod? = null + override fun resolveConstructor(): PsiMethod? = null + + override fun resolveMethodGenerics(): JavaResolveResult = JavaResolveResult.EMPTY + + override fun hasInitializer() = true + override fun computeConstantValue(visitedVars: MutableSet?) = this + + override fun getName(): String = enumEntrySymbol.name.asString() + + private val _type: PsiType by lazyPub { + enumEntrySymbol.type.asPsiType(enumEntrySymbol, this@FirLightFieldForEnumEntry, FirResolvePhase.TYPES) + } + + override fun getType(): PsiType = _type + override fun getInitializer(): PsiExpression? = null + + override fun hashCode(): Int = enumEntrySymbol.hashCode() + + override fun equals(other: Any?): Boolean = + other is FirLightFieldForEnumEntry && + enumEntrySymbol == other.enumEntrySymbol +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt index 10ca3eaac55..9ad155160d2 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt @@ -13,7 +13,6 @@ import org.jetbrains.kotlin.asJava.builder.LightMemberOrigin import org.jetbrains.kotlin.asJava.classes.lazyPub import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget import org.jetbrains.kotlin.fir.declarations.FirResolvePhase -import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertyGetterSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertySymbol import org.jetbrains.kotlin.psi.KtDeclaration @@ -42,15 +41,19 @@ internal class FirLightFieldForPropertySymbol( private val _modifierList: PsiModifierList by lazyPub { - val modifiersFromSymbol = propertySymbol.computeModalityForMethod(isTopLevel = isTopLevel, isOverride = false) + val isJvmField = propertySymbol.hasJvmFieldAnnotation() + val suppressFinal = !isJvmField && !propertySymbol.isVal + + val modifiersFromSymbol = propertySymbol.computeModalityForMethod( + isTopLevel = isTopLevel, + suppressFinal = suppressFinal + ) val basicModifiers = modifiersFromSymbol.add( what = PsiModifier.STATIC, `if` = forceStatic ) - val isJvmField = propertySymbol.hasJvmFieldAnnotation() - val visibility = if (isJvmField) propertySymbol.computeVisibility(isTopLevel = false) else PsiModifier.PRIVATE @@ -58,7 +61,7 @@ internal class FirLightFieldForPropertySymbol( val modifiers = modifiersWithVisibility.add( what = PsiModifier.FINAL, - `if` = !isJvmField || propertySymbol.isVal + `if` = !suppressFinal ) val annotations = propertySymbol.computeAnnotations( diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/firLightUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/firLightUtils.kt index 48cb918721f..f5288743966 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/firLightUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/firLightUtils.kt @@ -22,6 +22,7 @@ import org.jetbrains.kotlin.fir.backend.jvm.jvmTypeMapper import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.isPrimitiveNumberOrUnsignedNumberType import org.jetbrains.kotlin.fir.isPrimitiveType +import org.jetbrains.kotlin.fir.resolve.toSymbol import org.jetbrains.kotlin.fir.symbols.StandardClassIds import org.jetbrains.kotlin.fir.typeCheckerContext import org.jetbrains.kotlin.fir.types.* @@ -31,10 +32,7 @@ import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirClassOrObjectSymb import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirSymbol import org.jetbrains.kotlin.idea.frontend.api.fir.types.KtFirClassType import org.jetbrains.kotlin.idea.frontend.api.fir.types.KtFirType -import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassLikeSymbol -import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassOrObjectSymbol -import org.jetbrains.kotlin.idea.frontend.api.symbols.KtFunctionSymbol -import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.* import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.* import org.jetbrains.kotlin.idea.frontend.api.types.* import org.jetbrains.kotlin.load.kotlin.TypeMappingMode @@ -89,6 +87,7 @@ private fun ConeKotlinType.asPsiType( if (this.typeArguments.any { it is ConeClassErrorType }) return psiContext.nonExistentType() if (this is ConeClassLikeType) { val classId = classId + //TODO make anonymous type deriving if (classId != null && classId.shortClassName.asString() == SpecialNames.ANONYMOUS) return PsiType.NULL } @@ -98,8 +97,10 @@ private fun ConeKotlinType.asPsiType( val canonicalSignature = signatureWriter.toString() - if (canonicalSignature == "[L;") return psiContext.nonExistentType() - val signature = StringCharacterIterator(canonicalSignature) + if (canonicalSignature.contains("L")) return psiContext.nonExistentType() + //TODO Fix it in typemapper + val patchedCanonicalSignature = canonicalSignature.replace(SpecialNames.ANONYMOUS, "java.lang.Object") + val signature = StringCharacterIterator(patchedCanonicalSignature) val javaType = SignatureParsing.parseTypeString(signature, StubBuildingVisitor.GUESSING_MAPPER) val typeInfo = TypeInfo.fromString(javaType, false) val typeText = TypeInfo.createTypeText(typeInfo) ?: return psiContext.nonExistentType() @@ -178,13 +179,16 @@ internal fun FirMemberDeclaration.computeModalityForMethod(isTopLevel: Boolean): return withTopLevelStatic } -internal fun KtSymbolWithModality.computeModalityForMethod(isTopLevel: Boolean, isOverride: Boolean): Set { +internal fun KtSymbolWithModality.computeModalityForMethod( + isTopLevel: Boolean, + suppressFinal: Boolean +): Set { require(this !is KtClassLikeSymbol) val modality = mutableSetOf() computeSimpleModality()?.run { - if (this != PsiModifier.FINAL || !isOverride) { + if (this != PsiModifier.FINAL || !suppressFinal) { modality.add(this) } } @@ -209,14 +213,15 @@ internal fun FirMemberDeclaration.computeVisibility(isTopLevel: Boolean): String } } -internal fun KtSymbolWithVisibility.computeVisibility(isTopLevel: Boolean): String { - return when (this.visibility) { - // Top-level private class has PACKAGE_LOCAL visibility in Java - // Nested private class has PRIVATE visibility - KtSymbolVisibility.PRIVATE -> if (isTopLevel) PsiModifier.PACKAGE_LOCAL else PsiModifier.PRIVATE - KtSymbolVisibility.PROTECTED -> PsiModifier.PROTECTED - else -> PsiModifier.PUBLIC - } +internal fun KtSymbolWithVisibility.computeVisibility(isTopLevel: Boolean): String = + visibility.toPsiVisibility(isTopLevel) + +internal fun KtSymbolVisibility.toPsiVisibility(isTopLevel: Boolean): String = when (this) { + // Top-level private class has PACKAGE_LOCAL visibility in Java + // Nested private class has PRIVATE visibility + KtSymbolVisibility.PRIVATE -> if (isTopLevel) PsiModifier.PACKAGE_LOCAL else PsiModifier.PRIVATE + KtSymbolVisibility.PROTECTED -> PsiModifier.PROTECTED + else -> PsiModifier.PUBLIC } internal fun basicIsEquivalentTo(`this`: PsiElement?, that: PsiElement?): Boolean { diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightAccessorMethodForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightAccessorMethodForSymbol.kt index 696ca996303..d4519a771ea 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightAccessorMethodForSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightAccessorMethodForSymbol.kt @@ -11,12 +11,17 @@ import org.jetbrains.kotlin.asJava.builder.LightMemberOrigin import org.jetbrains.kotlin.asJava.classes.METHOD_INDEX_FOR_GETTER import org.jetbrains.kotlin.asJava.classes.METHOD_INDEX_FOR_SETTER import org.jetbrains.kotlin.asJava.classes.lazyPub +import org.jetbrains.kotlin.builtins.StandardNames +import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget import org.jetbrains.kotlin.fir.declarations.FirResolvePhase -import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertyAccessorSymbol -import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertyGetterSymbol -import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertySetterSymbol -import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertySymbol +import org.jetbrains.kotlin.idea.frontend.api.fir.analyzeWithSymbolAsContext +import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirPropertyGetterSymbol +import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.* +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.* +import org.jetbrains.kotlin.idea.util.ifTrue +import org.jetbrains.kotlin.idea.util.module import org.jetbrains.kotlin.load.java.JvmAbi.getterName import org.jetbrains.kotlin.load.java.JvmAbi.setterName import org.jetbrains.kotlin.psi.KtDeclaration @@ -26,7 +31,7 @@ internal class FirLightAccessorMethodForSymbol( containingPropertySymbol: KtPropertySymbol, lightMemberOrigin: LightMemberOrigin?, containingClass: FirLightClassBase, - isTopLevel: Boolean + isTopLevel: Boolean, ) : FirLightMethod( lightMemberOrigin, containingClass, @@ -36,10 +41,11 @@ internal class FirLightAccessorMethodForSymbol( if (firPropertyAccessor is KtPropertyGetterSymbol) getterName(this) else setterName(this) - //TODO add JvmName private val _name: String by lazyPub { - containingPropertySymbol.name.identifier - .abiName(propertyAccessorSymbol) + val defaultName = containingPropertySymbol.name.identifier.let { + if (containingClass.isAnnotationType) it else it.abiName(propertyAccessorSymbol) + } + containingPropertySymbol.computeJvmMethodName(defaultName, accessorSite) } override fun getName(): String = _name @@ -49,10 +55,12 @@ internal class FirLightAccessorMethodForSymbol( override val kotlinOrigin: KtDeclaration? = (propertyAccessorSymbol.psi ?: containingPropertySymbol.psi) as? KtDeclaration - private val _annotations: List by lazyPub { - val accessorSite = + private val accessorSite + get() = if (propertyAccessorSymbol is KtPropertyGetterSymbol) AnnotationUseSiteTarget.PROPERTY_GETTER else AnnotationUseSiteTarget.PROPERTY_SETTER + + private val _annotations: List by lazyPub { containingPropertySymbol.computeAnnotations( parent = this, nullability = NullabilityType.Unknown, @@ -61,17 +69,28 @@ internal class FirLightAccessorMethodForSymbol( } private val _modifiers: Set by lazyPub { + val isOverrideMethod = propertyAccessorSymbol.isOverride || containingPropertySymbol.isOverride + val isInterfaceMethod = containingClass.isInterface - val isOverride = propertyAccessorSymbol.isOverride || containingPropertySymbol.isOverride - val modifiers = propertyAccessorSymbol.computeModalityForMethod(isTopLevel, isOverride) + - propertyAccessorSymbol.computeVisibility(isTopLevel) + val visibility = isOverrideMethod.ifTrue { + (containingClass as? FirLightClassForSymbol) + ?.tryGetEffectiveVisibility(containingPropertySymbol) + ?.toPsiVisibility(isTopLevel) + } ?: propertyAccessorSymbol.computeVisibility(isTopLevel) - val isJvmStatic = - _annotations.any { it.qualifiedName == "kotlin.jvm.JvmStatic" } - - if (isJvmStatic) return@lazyPub modifiers + PsiModifier.STATIC + val modifiers = containingPropertySymbol.computeModalityForMethod( + isTopLevel = isTopLevel, + suppressFinal = isOverrideMethod || isInterfaceMethod + ) + visibility modifiers + .add( + what = PsiModifier.STATIC, + `if` = _annotations.any { it.qualifiedName == "kotlin.jvm.JvmStatic" } + ).add( + what = PsiModifier.ABSTRACT, + `if` = isInterfaceMethod + ) } private val _modifierList: PsiModifierList by lazyPub { diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightMethod.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightMethod.kt index a2ef3e0b305..d1a4b089bd6 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightMethod.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightMethod.kt @@ -15,6 +15,12 @@ import org.jetbrains.kotlin.asJava.classes.KotlinLightReferenceListBuilder import org.jetbrains.kotlin.asJava.classes.KtLightClass import org.jetbrains.kotlin.asJava.classes.cannotModify import org.jetbrains.kotlin.asJava.elements.KtLightMethod +import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper +import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtAnnotatedSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolVisibility +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithVisibility +import org.jetbrains.kotlin.idea.util.module internal abstract class FirLightMethod( lightMemberOrigin: LightMemberOrigin?, @@ -74,4 +80,19 @@ internal abstract class FirLightMethod( KotlinLightReferenceListBuilder(manager, language, PsiReferenceList.Role.THROWS_LIST) //TODO() override fun getDefaultValue(): PsiAnnotationMemberValue? = null //TODO() + + protected fun T.computeJvmMethodName( + defaultName: String, + annotationUseSiteTarget: AnnotationUseSiteTarget? = null + ): String where T : KtAnnotatedSymbol, T : KtSymbolWithVisibility { + getJvmNameFromAnnotation(annotationUseSiteTarget)?.let { return it } + + if (visibility != KtSymbolVisibility.INTERNAL) return defaultName + + val moduleName = module?.name ?: return defaultName + + if (hasPublishedApiAnnotation(annotationUseSiteTarget)) return defaultName + + return KotlinTypeMapper.InternalNameMapper.mangleInternalName(defaultName, moduleName) + } } \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightMethodForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightMethodForSymbol.kt index a47bbbc10a8..6b843d8662d 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightMethodForSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightMethodForSymbol.kt @@ -12,6 +12,7 @@ import org.jetbrains.kotlin.asJava.classes.KotlinLightReferenceListBuilder import org.jetbrains.kotlin.asJava.classes.lazyPub import org.jetbrains.kotlin.asJava.elements.KotlinLightTypeParameterListBuilder import org.jetbrains.kotlin.idea.frontend.api.symbols.KtFunctionLikeSymbol +import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.KtDeclaration import java.util.* diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightSimpleMethodForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightSimpleMethodForSymbol.kt index 99d6ab3a9a3..95a73dcafeb 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightSimpleMethodForSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightSimpleMethodForSymbol.kt @@ -14,6 +14,8 @@ import org.jetbrains.kotlin.asJava.classes.lazyPub import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.idea.frontend.api.symbols.KtFunctionSymbol import org.jetbrains.kotlin.idea.frontend.api.types.isUnit +import org.jetbrains.kotlin.idea.util.ifTrue +import org.jetbrains.kotlin.lexer.KtTokens import java.util.* internal class FirLightSimpleMethodForSymbol( @@ -32,7 +34,7 @@ internal class FirLightSimpleMethodForSymbol( ) { private val _name: String by lazyPub { - functionSymbol.getJvmNameFromAnnotation(null) ?: functionSymbol.name.asString() + functionSymbol.computeJvmMethodName(functionSymbol.name.asString()) } override fun getName(): String = _name @@ -51,16 +53,34 @@ internal class FirLightSimpleMethodForSymbol( ) } + open class X { + open val x: Int = 2 + open fun u() = 2 + } + private val _modifiers: Set by lazyPub { if (functionSymbol.hasInlineOnlyAnnotation()) return@lazyPub setOf(PsiModifier.FINAL, PsiModifier.PRIVATE) - val modifiers = functionSymbol.computeModalityForMethod(isTopLevel = isTopLevel, functionSymbol.isOverride) + - functionSymbol.computeVisibility(isTopLevel = isTopLevel) + val isOverrideMethod = functionSymbol.isOverride - if (functionSymbol.hasJvmStaticAnnotation()) return@lazyPub modifiers + PsiModifier.STATIC + val visibility = isOverrideMethod.ifTrue { + (containingClass as? FirLightClassForSymbol) + ?.tryGetEffectiveVisibility(functionSymbol) + ?.toPsiVisibility(isTopLevel) + } ?: functionSymbol.computeVisibility(isTopLevel = isTopLevel) - modifiers + val finalModifier = kotlinOrigin?.hasModifier(KtTokens.FINAL_KEYWORD) == true + + val modifiers = functionSymbol.computeModalityForMethod( + isTopLevel = isTopLevel, + suppressFinal = !finalModifier && isOverrideMethod + ) + visibility + + modifiers.add( + what = PsiModifier.STATIC, + `if` = functionSymbol.hasJvmStaticAnnotation() + ) } private val _modifierList: PsiModifierList by lazyPub { @@ -79,10 +99,7 @@ internal class FirLightSimpleMethodForSymbol( override fun getReturnType(): PsiType = _returnedType override fun equals(other: Any?): Boolean = - this === other || - (other is FirLightSimpleMethodForSymbol && - kotlinOrigin == other.kotlinOrigin && - functionSymbol == other.functionSymbol) + this === other || (other is FirLightSimpleMethodForSymbol && functionSymbol == other.functionSymbol) - override fun hashCode(): Int = kotlinOrigin.hashCode() + override fun hashCode(): Int = functionSymbol.hashCode() } \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt index 738e0e0fff3..abbc9132299 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.idea.frontend.api.fir.components import com.intellij.openapi.project.Project +import org.jetbrains.kotlin.fir.declarations.FirAnonymousObject import org.jetbrains.kotlin.fir.declarations.FirClass import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.fir.resolve.scope @@ -29,7 +30,6 @@ import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirClassOrObjectSymb import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirEnumEntrySymbol import org.jetbrains.kotlin.idea.frontend.api.fir.types.KtFirType import org.jetbrains.kotlin.idea.frontend.api.fir.utils.EnclosingDeclarationContext -import org.jetbrains.kotlin.idea.frontend.api.fir.utils.FirRefWithValidityCheck import org.jetbrains.kotlin.idea.frontend.api.fir.utils.buildCompletionContext import org.jetbrains.kotlin.idea.frontend.api.fir.utils.weakRef import org.jetbrains.kotlin.idea.frontend.api.scopes.* @@ -57,38 +57,42 @@ internal class KtFirScopeProvider( private val declaredMemberScopeCache = IdentityHashMap() private val packageMemberScopeCache = IdentityHashMap() - private fun KtSymbolWithDeclarations.firRef(): FirRefWithValidityCheck>? = when (this) { - is KtFirClassOrObjectSymbol -> this.firRef - is KtFirEnumEntrySymbol -> this.initializerFirRef + private inline fun KtSymbolWithDeclarations.withFirForScope(crossinline body: (FirClass<*>) -> T): T? = when (this) { + is KtFirClassOrObjectSymbol -> firRef.withFir(FirResolvePhase.SUPER_TYPES, body) + is KtFirEnumEntrySymbol -> firRef.withFir(FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE) { + val initializer = it.initializer + check(initializer is FirAnonymousObject) + body(initializer) + } else -> error { "Unknown KtSymbolWithDeclarations implementation ${this::class.qualifiedName}" } } override fun getMemberScope(classSymbol: KtSymbolWithDeclarations): KtMemberScope = withValidityAssertion { memberScopeCache.getOrPut(classSymbol) { - val firRef = classSymbol.firRef() - ?: return@getOrPut KtFirEmptyMemberScope(classSymbol) + val firScope = classSymbol.withFirForScope { fir -> + val firSession = fir.session + fir.unsubstitutedScope( + firSession, + firResolveState.firTransformerProvider.getScopeSession(firSession), + withForcedTypeCalculator = false + ) + } ?: return@getOrPut KtFirEmptyMemberScope(classSymbol) + + firScopeStorage.register(firScope) - val firScope = - firRef.withFir(FirResolvePhase.SUPER_TYPES) { fir -> - val firSession = fir.session - fir.unsubstitutedScope( - firSession, - firResolveState.firTransformerProvider.getScopeSession(firSession), - withForcedTypeCalculator = false - ) - }.also(firScopeStorage::register) KtFirMemberScope(classSymbol, firScope, token, builder) } } override fun getDeclaredMemberScope(classSymbol: KtSymbolWithDeclarations): KtDeclaredMemberScope = withValidityAssertion { declaredMemberScopeCache.getOrPut(classSymbol) { - val firRef = classSymbol.firRef() - ?: return@getOrPut KtFirEmptyMemberScope(classSymbol) + val firScope = classSymbol.withFirForScope { + declaredMemberScope(it) + } ?: return@getOrPut KtFirEmptyMemberScope(classSymbol) + + firScopeStorage.register(firScope) - val firScope = firRef.withFir(FirResolvePhase.SUPER_TYPES) { declaredMemberScope(it) } - .also(firScopeStorage::register) KtFirDeclaredMemberScope(classSymbol, firScope, token, builder) } } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/scopes/KtFirDelegatingScope.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/scopes/KtFirDelegatingScope.kt index 5d92572bd84..3c6ce6fc5d1 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/scopes/KtFirDelegatingScope.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/scopes/KtFirDelegatingScope.kt @@ -9,7 +9,9 @@ import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction import org.jetbrains.kotlin.fir.isSubstitutionOverride import org.jetbrains.kotlin.fir.scopes.FirContainingNamesAwareScope import org.jetbrains.kotlin.fir.scopes.FirScope +import org.jetbrains.kotlin.fir.scopes.getDeclaredConstructors import org.jetbrains.kotlin.fir.scopes.processClassifiersByName +import org.jetbrains.kotlin.fir.symbols.impl.FirConstructorSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol import org.jetbrains.kotlin.idea.frontend.api.ValidityToken import org.jetbrains.kotlin.idea.frontend.api.fir.KtSymbolByFirBuilder @@ -73,6 +75,15 @@ internal fun FirScope.getCallableSymbols(callableNames: Collection, builde } callables.add(symbol) } + + if (name.isSpecial && name.asString() == "") { + processDeclaredConstructors { firConstructor -> + firConstructor.fir.let { fir -> + callables.add(builder.buildConstructorSymbol(fir)) + } + } + } + yieldAll(callables) } } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirEnumEntrySymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirEnumEntrySymbol.kt index 11c83ac9298..31e28b8687f 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirEnumEntrySymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirEnumEntrySymbol.kt @@ -7,7 +7,6 @@ package org.jetbrains.kotlin.idea.frontend.api.fir.symbols import com.intellij.psi.PsiElement import org.jetbrains.kotlin.fir.containingClass -import org.jetbrains.kotlin.fir.declarations.FirAnonymousObject import org.jetbrains.kotlin.fir.declarations.FirEnumEntry import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.idea.fir.findPsi @@ -16,7 +15,6 @@ import org.jetbrains.kotlin.idea.frontend.api.ValidityToken import org.jetbrains.kotlin.idea.frontend.api.fir.KtSymbolByFirBuilder import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.pointers.KtFirEnumEntrySymbolPointer import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.pointers.createSignature -import org.jetbrains.kotlin.idea.frontend.api.fir.utils.FirRefWithValidityCheck import org.jetbrains.kotlin.idea.frontend.api.fir.utils.firRef import org.jetbrains.kotlin.idea.frontend.api.symbols.KtEnumEntrySymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtPsiBasedSymbolPointer @@ -41,8 +39,6 @@ internal class KtFirEnumEntrySymbol( override val containingEnumClassIdIfNonLocal: ClassId? get() = firRef.withFir { it.containingClass()?.classId?.takeUnless { it.isLocal } } - override val hasBody: Boolean get() = firRef.withFir { it.initializer != null } - override fun createPointer(): KtSymbolPointer { KtPsiBasedSymbolPointer.createForSymbolFromSource(this)?.let { return it } return KtFirEnumEntrySymbolPointer(containingEnumClassIdIfNonLocal!!, firRef.withFir { it.createSignature() }) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/firSymbolUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/firSymbolUtils.kt index 53ea8f98684..8d59e319cbd 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/firSymbolUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/firSymbolUtils.kt @@ -22,7 +22,7 @@ internal inline fun Modality?.getSymbolModality() Modality.OPEN -> KtCommonSymbolModality.OPEN Modality.ABSTRACT -> KtCommonSymbolModality.ABSTRACT Modality.SEALED -> KtSymbolModality.SEALED - null -> KtCommonSymbolModality.UNKNOWN + null -> error("Symbol modality should not be null, looks like the fir symbol was not properly resolved") } as? M ?: error("Sealed modality can only be applied to class") internal inline fun KtFirSymbol.getModality() = From 2a8f78339335b3a24be4c792bbb3464f6c314d03 Mon Sep 17 00:00:00 2001 From: Igor Yakovlev Date: Tue, 17 Nov 2020 15:00:02 +0300 Subject: [PATCH 378/698] [FIR IDE] HL API Better support of nullability and modality --- .../org/jetbrains/kotlin/fir/Primitives.kt | 2 +- .../lightClasses/DeprecatedEnumEntry.kt | 4 ++- .../compilationErrors/EnumNameOverride.kt | 2 ++ .../ImplementingCharSequenceAndNumber.kt | 4 ++- .../ideRegression/OverridingInternal.kt | 3 +- .../nullabilityAnnotations/Primitives.kt | 4 ++- .../asJava/ultraLightClasses/inheritance.kt | 2 ++ .../asJava/ultraLightFacades/jvmField.kt | 2 ++ .../api/symbols/KtPropertyAccessorSymbol.kt | 1 + .../api/symbols/KtVariableLikeSymbol.kt | 2 ++ .../asJava/annotations/annotationsUtils.kt | 8 +++-- .../asJava/classes/FirLightClassForFacade.kt | 12 +++++-- .../idea/asJava/classes/firLightClassUtils.kt | 32 ++++++++++++------- .../fields/FirLightFieldForPropertySymbol.kt | 8 +++-- .../FirLightAccessorMethodForSymbol.kt | 6 ++-- .../idea/asJava/methods/FirLightMethod.kt | 11 +++++-- .../methods/FirLightSimpleMethodForSymbol.kt | 27 +++++++--------- .../parameters/FirLightParameterForSymbol.kt | 14 +++++--- .../fir/symbols/KtFirPropertyGetterSymbol.kt | 1 + .../fir/symbols/KtFirPropertySetterSymbol.kt | 2 ++ .../api/fir/symbols/KtFirPropertySymbol.kt | 2 ++ .../resolve/AbstractIdeLightClassTest.kt | 22 ++++++------- 22 files changed, 115 insertions(+), 56 deletions(-) diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/Primitives.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/Primitives.kt index 0f32bf94638..50223d28e3e 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/Primitives.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/Primitives.kt @@ -34,7 +34,7 @@ fun ConeClassLikeType.isByte(): Boolean = lookupTag.classId == StandardClassIds. fun ConeClassLikeType.isBoolean(): Boolean = lookupTag.classId == StandardClassIds.Boolean fun ConeClassLikeType.isChar(): Boolean = lookupTag.classId == StandardClassIds.Char -fun ConeClassLikeType.isPrimitiveType(): Boolean = isPrimitiveNumberOrUnsignedNumberType() || isBoolean() || isByte() || isShort() +fun ConeClassLikeType.isPrimitiveType(): Boolean = isPrimitiveNumberOrUnsignedNumberType() || isBoolean() || isByte() || isShort() || isChar() fun ConeClassLikeType.isPrimitiveNumberType(): Boolean = lookupTag.classId in PRIMITIVE_NUMBER_CLASS_IDS fun ConeClassLikeType.isPrimitiveUnsignedNumberType(): Boolean = lookupTag.classId in PRIMITIVE_UNSIGNED_NUMBER_CLASS_IDS fun ConeClassLikeType.isPrimitiveNumberOrUnsignedNumberType(): Boolean = isPrimitiveNumberType() || isPrimitiveUnsignedNumberType() diff --git a/compiler/testData/asJava/lightClasses/DeprecatedEnumEntry.kt b/compiler/testData/asJava/lightClasses/DeprecatedEnumEntry.kt index 0accee6b2f8..66da0e415b5 100644 --- a/compiler/testData/asJava/lightClasses/DeprecatedEnumEntry.kt +++ b/compiler/testData/asJava/lightClasses/DeprecatedEnumEntry.kt @@ -9,4 +9,6 @@ enum class E { Entry2, @Deprecated("b") Entry3 -} \ No newline at end of file +} + +// FIR_COMPARISON \ No newline at end of file diff --git a/compiler/testData/asJava/lightClasses/compilationErrors/EnumNameOverride.kt b/compiler/testData/asJava/lightClasses/compilationErrors/EnumNameOverride.kt index 150fc7a0abe..ed136384d39 100644 --- a/compiler/testData/asJava/lightClasses/compilationErrors/EnumNameOverride.kt +++ b/compiler/testData/asJava/lightClasses/compilationErrors/EnumNameOverride.kt @@ -9,3 +9,5 @@ interface Bar : Foo { } enum class EnumNameOverride : Bar + +// FIR_COMPARISON \ No newline at end of file diff --git a/compiler/testData/asJava/lightClasses/ideRegression/ImplementingCharSequenceAndNumber.kt b/compiler/testData/asJava/lightClasses/ideRegression/ImplementingCharSequenceAndNumber.kt index d19fc5fda77..4598b3afbf0 100644 --- a/compiler/testData/asJava/lightClasses/ideRegression/ImplementingCharSequenceAndNumber.kt +++ b/compiler/testData/asJava/lightClasses/ideRegression/ImplementingCharSequenceAndNumber.kt @@ -44,4 +44,6 @@ class Container { TODO("not implemented") } } -} \ No newline at end of file +} + +// FIR_COMPARISON \ No newline at end of file diff --git a/compiler/testData/asJava/lightClasses/ideRegression/OverridingInternal.kt b/compiler/testData/asJava/lightClasses/ideRegression/OverridingInternal.kt index cea2a77e24a..cbd66f203b5 100644 --- a/compiler/testData/asJava/lightClasses/ideRegression/OverridingInternal.kt +++ b/compiler/testData/asJava/lightClasses/ideRegression/OverridingInternal.kt @@ -13,4 +13,5 @@ class C : A(), I { override fun if() = 5 } -// LAZINESS:NoLaziness \ No newline at end of file +// LAZINESS:NoLaziness +// FIR_COMPARISON \ No newline at end of file diff --git a/compiler/testData/asJava/lightClasses/nullabilityAnnotations/Primitives.kt b/compiler/testData/asJava/lightClasses/nullabilityAnnotations/Primitives.kt index b00fda10d7f..b9be700e09e 100644 --- a/compiler/testData/asJava/lightClasses/nullabilityAnnotations/Primitives.kt +++ b/compiler/testData/asJava/lightClasses/nullabilityAnnotations/Primitives.kt @@ -20,4 +20,6 @@ interface Primitives { val long: Long val float: Float val double: Double -} \ No newline at end of file +} + +// FIR_COMPARISON \ No newline at end of file diff --git a/compiler/testData/asJava/ultraLightClasses/inheritance.kt b/compiler/testData/asJava/ultraLightClasses/inheritance.kt index dba936c8021..3b71ba7d286 100644 --- a/compiler/testData/asJava/ultraLightClasses/inheritance.kt +++ b/compiler/testData/asJava/ultraLightClasses/inheritance.kt @@ -29,3 +29,5 @@ private class Private { override val overridesNothing: Boolean get() = false } + +// FIR_COMPARISON \ No newline at end of file diff --git a/compiler/testData/asJava/ultraLightFacades/jvmField.kt b/compiler/testData/asJava/ultraLightFacades/jvmField.kt index b9fdefe6a29..451977c84d7 100644 --- a/compiler/testData/asJava/ultraLightFacades/jvmField.kt +++ b/compiler/testData/asJava/ultraLightFacades/jvmField.kt @@ -2,3 +2,5 @@ val a: Collection<*> = emptyList() @JvmField var b: Int = 1 + +// FIR_COMPARISON \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtPropertyAccessorSymbol.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtPropertyAccessorSymbol.kt index e902aaf6b0b..f3c0dbfcf73 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtPropertyAccessorSymbol.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtPropertyAccessorSymbol.kt @@ -14,6 +14,7 @@ sealed class KtPropertyAccessorSymbol : KtCallableSymbol(), abstract val isDefault: Boolean abstract val isInline: Boolean abstract val isOverride: Boolean + abstract val hasBody: Boolean abstract val symbolKind: KtSymbolKind diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtVariableLikeSymbol.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtVariableLikeSymbol.kt index 929bd7fd476..894ec2ed04d 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtVariableLikeSymbol.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtVariableLikeSymbol.kt @@ -53,6 +53,8 @@ abstract class KtPropertySymbol : KtVariableSymbol(), abstract val hasBackingField: Boolean + abstract val isLateInit: Boolean + abstract val isConst: Boolean abstract val isOverride: Boolean diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/annotationsUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/annotationsUtils.kt index 74733d103d8..e2146d4acbe 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/annotationsUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/annotationsUtils.kt @@ -87,7 +87,8 @@ internal fun KtAnnotatedSymbol.hasAnnotation(classIdString: String, annotationUs internal fun KtAnnotatedSymbol.computeAnnotations( parent: PsiElement, nullability: NullabilityType, - annotationUseSiteTarget: AnnotationUseSiteTarget? + annotationUseSiteTarget: AnnotationUseSiteTarget?, + includeAnnotationsWithoutSite: Boolean = true ): List { if (nullability == NullabilityType.Unknown && annotations.isEmpty()) return emptyList() @@ -108,7 +109,10 @@ internal fun KtAnnotatedSymbol.computeAnnotations( for (annotation in annotations) { val siteTarget = annotation.useSiteTarget - if (siteTarget == null || siteTarget == annotationUseSiteTarget) { + + if ((includeAnnotationsWithoutSite && siteTarget == null) || + siteTarget == annotationUseSiteTarget + ) { result.add(FirLightAnnotationForAnnotationCall(annotation, parent)) } } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt index 7aad6cd5fdd..b5e01365a3d 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt @@ -13,9 +13,15 @@ import com.intellij.psi.impl.light.LightModifierList import org.jetbrains.annotations.NonNls import org.jetbrains.kotlin.asJava.classes.* import org.jetbrains.kotlin.asJava.elements.* -import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil import org.jetbrains.kotlin.fileClasses.javaFileFacadeFqName import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.asJava.classes.KtLightClassForFacade +import org.jetbrains.kotlin.asJava.classes.lazyPub +import org.jetbrains.kotlin.asJava.elements.FakeFileForLightClass +import org.jetbrains.kotlin.asJava.elements.KtLightField +import org.jetbrains.kotlin.asJava.elements.KtLightMethod +import org.jetbrains.kotlin.fir.declarations.FirProperty +import org.jetbrains.kotlin.fir.declarations.isConst import org.jetbrains.kotlin.idea.KotlinLanguage import org.jetbrains.kotlin.idea.asJava.classes.createFields import org.jetbrains.kotlin.idea.asJava.classes.createMethods @@ -23,7 +29,9 @@ import org.jetbrains.kotlin.idea.frontend.api.analyze import org.jetbrains.kotlin.idea.frontend.api.symbols.KtCallableSymbol import org.jetbrains.kotlin.load.java.structure.LightClassOriginKind import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.psi.* +import org.jetbrains.kotlin.psi.KtClassOrObject +import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.psi.KtNamedDeclaration import org.jetbrains.kotlin.psi.psiUtil.isPrivate class FirLightClassForFacade( diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt index a3b4b5cc41d..d691a59b138 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt @@ -22,6 +22,7 @@ import org.jetbrains.kotlin.idea.frontend.api.analyze import org.jetbrains.kotlin.idea.frontend.api.symbols.* import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtAnnotatedSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtCommonSymbolModality +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolVisibility import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithVisibility import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.* @@ -147,11 +148,17 @@ internal fun FirLightClassBase.createMethods( is KtPropertySymbol -> { if (declaration.hasJvmFieldAnnotation()) continue + if (declaration.visibility == KtSymbolVisibility.PRIVATE) continue + + fun KtPropertyAccessorSymbol.needToCreateAccessor(siteTarget: AnnotationUseSiteTarget): Boolean { + if (isInline) return false + if (!hasBody && visibility == KtSymbolVisibility.PRIVATE) return false + return !declaration.hasJvmSyntheticAnnotation(siteTarget) + && !declaration.isHiddenByDeprecation(siteTarget) + } val getter = declaration.getter?.takeIf { - !declaration.hasJvmSyntheticAnnotation(AnnotationUseSiteTarget.PROPERTY_GETTER) && - !it.isInline && - !declaration.isHiddenByDeprecation(AnnotationUseSiteTarget.PROPERTY_GETTER) + it.needToCreateAccessor(AnnotationUseSiteTarget.PROPERTY_GETTER) } if (getter != null) { @@ -167,10 +174,7 @@ internal fun FirLightClassBase.createMethods( } val setter = declaration.setter?.takeIf { - !isAnnotationType && - !declaration.hasJvmSyntheticAnnotation(AnnotationUseSiteTarget.PROPERTY_SETTER) && - !it.isInline && - !declaration.isHiddenByDeprecation(AnnotationUseSiteTarget.PROPERTY_GETTER) + !isAnnotationType && it.needToCreateAccessor(AnnotationUseSiteTarget.PROPERTY_SETTER) } if (setter != null) { @@ -194,13 +198,19 @@ internal fun FirLightClassBase.createFields( isTopLevel: Boolean, result: MutableList ) { + fun hasBackingField(property: KtPropertySymbol): Boolean { + if (property.modality == KtCommonSymbolModality.ABSTRACT) return false + if (property.isLateInit) return true + //IS PARAMETER -> true + if (property.getter == null && property.setter == null) return true + if (property.hasJvmSyntheticAnnotation(AnnotationUseSiteTarget.FIELD)) return false + return property.hasBackingField + } + //TODO isHiddenByDeprecation for (declaration in declarations) { if (declaration !is KtPropertySymbol) continue - - if (!declaration.hasBackingField) continue - if (declaration.hasJvmSyntheticAnnotation(AnnotationUseSiteTarget.FIELD)) continue - if (declaration.modality == KtCommonSymbolModality.ABSTRACT) continue + if (!hasBackingField(declaration)) continue result.add( FirLightFieldForPropertySymbol( diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt index 9ad155160d2..2c1ce5a15f3 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt @@ -42,7 +42,7 @@ internal class FirLightFieldForPropertySymbol( private val _modifierList: PsiModifierList by lazyPub { val isJvmField = propertySymbol.hasJvmFieldAnnotation() - val suppressFinal = !isJvmField && !propertySymbol.isVal + val suppressFinal = !propertySymbol.isVal val modifiersFromSymbol = propertySymbol.computeModalityForMethod( isTopLevel = isTopLevel, @@ -64,9 +64,13 @@ internal class FirLightFieldForPropertySymbol( `if` = !suppressFinal ) + val nullability = if (visibility != PsiModifier.PRIVATE) + propertySymbol.type.getTypeNullability(propertySymbol, FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE) + else NullabilityType.Unknown + val annotations = propertySymbol.computeAnnotations( parent = this, - nullability = propertySymbol.type.getTypeNullability(propertySymbol, FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE), + nullability = nullability, annotationUseSiteTarget = AnnotationUseSiteTarget.FIELD, ) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightAccessorMethodForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightAccessorMethodForSymbol.kt index d4519a771ea..93802abc726 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightAccessorMethodForSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightAccessorMethodForSymbol.kt @@ -45,7 +45,7 @@ internal class FirLightAccessorMethodForSymbol( val defaultName = containingPropertySymbol.name.identifier.let { if (containingClass.isAnnotationType) it else it.abiName(propertyAccessorSymbol) } - containingPropertySymbol.computeJvmMethodName(defaultName, accessorSite) + containingPropertySymbol.computeJvmMethodName(defaultName, containingClass, accessorSite) } override fun getName(): String = _name @@ -61,9 +61,11 @@ internal class FirLightAccessorMethodForSymbol( else AnnotationUseSiteTarget.PROPERTY_SETTER private val _annotations: List by lazyPub { + val nullabilityType = containingPropertySymbol.type + .getTypeNullability(containingPropertySymbol, FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE) containingPropertySymbol.computeAnnotations( parent = this, - nullability = NullabilityType.Unknown, + nullability = nullabilityType, annotationUseSiteTarget = accessorSite, ) } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightMethod.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightMethod.kt index d1a4b089bd6..2dc1e68bb3e 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightMethod.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightMethod.kt @@ -17,9 +17,11 @@ import org.jetbrains.kotlin.asJava.classes.cannotModify import org.jetbrains.kotlin.asJava.elements.KtLightMethod import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtCallableSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtAnnotatedSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolVisibility import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithVisibility +import org.jetbrains.kotlin.idea.util.ifTrue import org.jetbrains.kotlin.idea.util.module internal abstract class FirLightMethod( @@ -83,11 +85,16 @@ internal abstract class FirLightMethod( protected fun T.computeJvmMethodName( defaultName: String, + containingClass: FirLightClassBase, annotationUseSiteTarget: AnnotationUseSiteTarget? = null - ): String where T : KtAnnotatedSymbol, T : KtSymbolWithVisibility { + ): String where T : KtAnnotatedSymbol, T : KtSymbolWithVisibility, T : KtCallableSymbol { getJvmNameFromAnnotation(annotationUseSiteTarget)?.let { return it } - if (visibility != KtSymbolVisibility.INTERNAL) return defaultName + val effectiveVisibilityIfNotInternal = (visibility != KtSymbolVisibility.INTERNAL).ifTrue { + (containingClass as? FirLightClassForSymbol)?.tryGetEffectiveVisibility(this) + } ?: this.visibility + + if (effectiveVisibilityIfNotInternal != KtSymbolVisibility.INTERNAL) return defaultName val moduleName = module?.name ?: return defaultName diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightSimpleMethodForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightSimpleMethodForSymbol.kt index 95a73dcafeb..ae99fbe640d 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightSimpleMethodForSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightSimpleMethodForSymbol.kt @@ -34,14 +34,16 @@ internal class FirLightSimpleMethodForSymbol( ) { private val _name: String by lazyPub { - functionSymbol.computeJvmMethodName(functionSymbol.name.asString()) + functionSymbol.computeJvmMethodName(functionSymbol.name.asString(), containingClass) } override fun getName(): String = _name private val _annotations: List by lazyPub { - val nullability = if (functionSymbol.type.isUnit) NullabilityType.Unknown else functionSymbol.type.getTypeNullability( + val needUnknownNullability = functionSymbol.type.isUnit || (_visibility == PsiModifier.PRIVATE) + + val nullability = if (needUnknownNullability) NullabilityType.Unknown else functionSymbol.type.getTypeNullability( functionSymbol, FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE ) @@ -53,29 +55,24 @@ internal class FirLightSimpleMethodForSymbol( ) } - open class X { - open val x: Int = 2 - open fun u() = 2 + private val _visibility: String by lazyPub { + functionSymbol.isOverride.ifTrue { + (containingClass as? FirLightClassForSymbol) + ?.tryGetEffectiveVisibility(functionSymbol) + ?.toPsiVisibility(isTopLevel) + } ?: functionSymbol.computeVisibility(isTopLevel = isTopLevel) } private val _modifiers: Set by lazyPub { if (functionSymbol.hasInlineOnlyAnnotation()) return@lazyPub setOf(PsiModifier.FINAL, PsiModifier.PRIVATE) - val isOverrideMethod = functionSymbol.isOverride - - val visibility = isOverrideMethod.ifTrue { - (containingClass as? FirLightClassForSymbol) - ?.tryGetEffectiveVisibility(functionSymbol) - ?.toPsiVisibility(isTopLevel) - } ?: functionSymbol.computeVisibility(isTopLevel = isTopLevel) - val finalModifier = kotlinOrigin?.hasModifier(KtTokens.FINAL_KEYWORD) == true val modifiers = functionSymbol.computeModalityForMethod( isTopLevel = isTopLevel, - suppressFinal = !finalModifier && isOverrideMethod - ) + visibility + suppressFinal = !finalModifier && functionSymbol.isOverride + ) + _visibility modifiers.add( what = PsiModifier.STATIC, diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/parameters/FirLightParameterForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/parameters/FirLightParameterForSymbol.kt index b5924e94336..3962788a89b 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/parameters/FirLightParameterForSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/parameters/FirLightParameterForSymbol.kt @@ -7,8 +7,11 @@ package org.jetbrains.kotlin.idea.asJava import com.intellij.psi.* import org.jetbrains.kotlin.asJava.classes.lazyPub +import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.idea.frontend.api.symbols.KtParameterSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolKind +import org.jetbrains.kotlin.idea.util.ifTrue import org.jetbrains.kotlin.psi.KtParameter internal class FirLightParameterForSymbol( @@ -26,10 +29,15 @@ internal class FirLightParameterForSymbol( override val kotlinOrigin: KtParameter? = parameterSymbol.psi as? KtParameter private val _annotations: List by lazyPub { + val annotationSite = (containingMethod.isConstructor && parameterSymbol.symbolKind == KtSymbolKind.MEMBER).ifTrue { + AnnotationUseSiteTarget.CONSTRUCTOR_PARAMETER + } + parameterSymbol.computeAnnotations( parent = this, nullability = parameterSymbol.type.getTypeNullability(parameterSymbol, FirResolvePhase.TYPES), - annotationUseSiteTarget = null, + annotationUseSiteTarget = annotationSite, + includeAnnotationsWithoutSite = false ) } @@ -50,9 +58,7 @@ internal class FirLightParameterForSymbol( override fun equals(other: Any?): Boolean = this === other || - (other is FirLightParameterForSymbol && - kotlinOrigin == other.kotlinOrigin && - parameterSymbol == other.parameterSymbol) + (other is FirLightParameterForSymbol && parameterSymbol == other.parameterSymbol) override fun hashCode(): Int = kotlinOrigin.hashCode() } \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertyGetterSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertyGetterSymbol.kt index f414881c400..6e462353a26 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertyGetterSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertyGetterSymbol.kt @@ -39,6 +39,7 @@ internal class KtFirPropertyGetterSymbol( override val isDefault: Boolean get() = firRef.withFir { it is FirDefaultPropertyAccessor } override val isInline: Boolean get() = firRef.withFir { it.isInline } override val isOverride: Boolean get() = firRef.withFir { it.isOverride } + override val hasBody: Boolean get() = firRef.withFir { it.body != null } override val symbolKind: KtSymbolKind get() = firRef.withFir { fir -> diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySetterSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySetterSymbol.kt index b7bcc2894ad..067ccff9f76 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySetterSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySetterSymbol.kt @@ -39,6 +39,8 @@ internal class KtFirPropertySetterSymbol( override val isDefault: Boolean get() = firRef.withFir { it is FirDefaultPropertyAccessor } override val isInline: Boolean get() = firRef.withFir { it.isInline } override val isOverride: Boolean get() = firRef.withFir { it.isOverride } + override val hasBody: Boolean get() = firRef.withFir { it.body != null } + override val modality: KtCommonSymbolModality get() = firRef.withFir(FirResolvePhase.STATUS) { it.modality.getSymbolModality() } override val visibility: KtSymbolVisibility get() = firRef.withFir(FirResolvePhase.STATUS) { it.visibility.getSymbolVisibility() } override val parameter: KtSetterParameterSymbol by firRef.withFirAndCache { fir -> diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySymbol.kt index 44f2392bfd6..5e10089371b 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySymbol.kt @@ -80,6 +80,8 @@ internal class KtFirPropertySymbol( override val hasBackingField: Boolean get() = firRef.withFir { it.hasBackingField } + override val isLateInit: Boolean get() = firRef.withFir { it.isLateInit } + override val isConst: Boolean get() = firRef.withFir { it.isConst } override val isOverride: Boolean get() = firRef.withFir { it.isOverride } diff --git a/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/AbstractIdeLightClassTest.kt b/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/AbstractIdeLightClassTest.kt index 5eb3a847aaf..82e7d84cffe 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/AbstractIdeLightClassTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/AbstractIdeLightClassTest.kt @@ -151,12 +151,10 @@ fun findClass(fqName: String, ktFile: KtFile?, project: Project): PsiClass? { return it.toLightClass() } - return JavaPsiFacade.getInstance(project).findClass(fqName, GlobalSearchScope.allScope(project)) ?: PsiTreeUtil.findChildrenOfType( - ktFile, - KtClassOrObject::class.java - ) - .find { fqName.endsWith(it.nameAsName!!.asString()) } - ?.let { KtLightClassForSourceDeclaration.create(it) } + return JavaPsiFacade.getInstance(project).findClass(fqName, GlobalSearchScope.allScope(project)) + ?: PsiTreeUtil.findChildrenOfType(ktFile, KtClassOrObject::class.java) + .find { fqName.endsWith(it.nameAsName!!.asString()) } + ?.toLightClass() } object LightClassLazinessChecker { @@ -276,11 +274,13 @@ object LightClassLazinessChecker { // see KtLightNullabilityAnnotation assertTrue( lightAnnotations.isNotEmpty(), - "Missing $fqName annotation in '${modifierListOwner}' have only ${annotations?.joinToString( - ", ", - "[", - "]" - ) { it.toString() }}" + "Missing $fqName annotation in '${modifierListOwner}' have only ${ + annotations?.joinToString( + ", ", + "[", + "]" + ) { it.toString() } + }" ) } clsAnnotations.zip(lightAnnotations).forEach { (clsAnnotation, lightAnnotation) -> From 3fc424246bd02bf85d160ad97cffa70eb578a30b Mon Sep 17 00:00:00 2001 From: Igor Yakovlev Date: Fri, 20 Nov 2020 02:04:36 +0300 Subject: [PATCH 379/698] [FIR IDE] LC basic support for type arguments + small fixes for deprecation, etc. --- .../lightClasses/TypePararametersInClass.kt | 2 + .../NullableUnitReturn.kt | 4 +- .../publicField/CompanionObject.kt | 2 + .../ultraLightClasses/dollarsInNameLocal.kt | 4 +- .../frontend/api/symbols/KtClassLikeSymbol.kt | 2 + .../resolve/FirLazyDeclarationResolver.kt | 4 +- .../kotlin/idea/asJava/FirLightIdentifier.kt | 54 ++++++ .../kotlin/idea/asJava/FirLightMemberImpl.kt | 6 +- .../FirLightTypeParameterListForSymbol.kt | 74 ++++++++ .../asJava/annotations/annotationsUtils.kt | 3 + .../FirLightClassForClassOrObjectSymbol.kt | 49 ++++-- .../asJava/classes/FirLightClassForSymbol.kt | 6 +- .../idea/asJava/classes/firLightClassUtils.kt | 16 +- .../asJava/fields/FirLightFieldEnumEntry.kt | 11 ++ .../fields/FirLightFieldForObjectSymbol.kt | 20 ++- .../fields/FirLightFieldForPropertySymbol.kt | 18 +- .../FirLightAccessorMethodForSymbol.kt | 17 ++ .../methods/FirLightConstructorForSymbol.kt | 15 +- .../idea/asJava/methods/FirLightMethod.kt | 8 +- .../asJava/methods/FirLightMethodForSymbol.kt | 9 +- .../methods/FirLightSimpleMethodForSymbol.kt | 48 ++++-- .../asJava/parameters/FirLightParameter.kt | 3 +- .../FirLightParameterForReceiver.kt | 3 + .../parameters/FirLightParameterForSymbol.kt | 7 + .../parameters/FirLightTypeParameter.kt | 163 ++++++++++++++++++ .../frontend/api/fir/KtSymbolByFirBuilder.kt | 2 +- .../fir/symbols/KtFirTypeParameterSymbol.kt | 10 +- 27 files changed, 504 insertions(+), 56 deletions(-) create mode 100644 idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/FirLightIdentifier.kt create mode 100644 idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/FirLightTypeParameterListForSymbol.kt create mode 100644 idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/parameters/FirLightTypeParameter.kt diff --git a/compiler/testData/asJava/lightClasses/TypePararametersInClass.kt b/compiler/testData/asJava/lightClasses/TypePararametersInClass.kt index 12b084b92cd..bc3bc9728a6 100644 --- a/compiler/testData/asJava/lightClasses/TypePararametersInClass.kt +++ b/compiler/testData/asJava/lightClasses/TypePararametersInClass.kt @@ -7,3 +7,5 @@ abstract class A> : B>(), C { inner class Inner2 : Inner(), C } + +// FIR_COMPARISON \ No newline at end of file diff --git a/compiler/testData/asJava/lightClasses/nullabilityAnnotations/NullableUnitReturn.kt b/compiler/testData/asJava/lightClasses/nullabilityAnnotations/NullableUnitReturn.kt index a2b39a3b548..b548577f41c 100644 --- a/compiler/testData/asJava/lightClasses/nullabilityAnnotations/NullableUnitReturn.kt +++ b/compiler/testData/asJava/lightClasses/nullabilityAnnotations/NullableUnitReturn.kt @@ -1,3 +1,5 @@ // NullableUnitReturnKt -fun foo(): Unit? = null \ No newline at end of file +fun foo(): Unit? = null + +// FIR_COMPARISON \ No newline at end of file diff --git a/compiler/testData/asJava/lightClasses/publicField/CompanionObject.kt b/compiler/testData/asJava/lightClasses/publicField/CompanionObject.kt index ebd5849342a..a7df277c8b5 100644 --- a/compiler/testData/asJava/lightClasses/publicField/CompanionObject.kt +++ b/compiler/testData/asJava/lightClasses/publicField/CompanionObject.kt @@ -6,3 +6,5 @@ class C { @[kotlin.jvm.JvmField] public val foo: String = { "A" }() } } + +// FIR_COMPARISON \ No newline at end of file diff --git a/compiler/testData/asJava/ultraLightClasses/dollarsInNameLocal.kt b/compiler/testData/asJava/ultraLightClasses/dollarsInNameLocal.kt index 4422978ca20..b0babebf3f3 100644 --- a/compiler/testData/asJava/ultraLightClasses/dollarsInNameLocal.kt +++ b/compiler/testData/asJava/ultraLightClasses/dollarsInNameLocal.kt @@ -12,4 +12,6 @@ class Foo { } } } -} \ No newline at end of file +} + +// FIR_COMPARISON \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtClassLikeSymbol.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtClassLikeSymbol.kt index 3c5e645ff67..733de867ccd 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtClassLikeSymbol.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtClassLikeSymbol.kt @@ -15,6 +15,8 @@ sealed class KtClassifierSymbol : KtSymbol, KtNamedSymbol abstract class KtTypeParameterSymbol : KtClassifierSymbol(), KtNamedSymbol { abstract override fun createPointer(): KtSymbolPointer + + abstract val bounds: List } sealed class KtClassLikeSymbol : KtClassifierSymbol(), KtNamedSymbol, KtSymbolWithKind { diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/lazy/resolve/FirLazyDeclarationResolver.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/lazy/resolve/FirLazyDeclarationResolver.kt index 39c7826a514..50006eee41a 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/lazy/resolve/FirLazyDeclarationResolver.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/lazy/resolve/FirLazyDeclarationResolver.kt @@ -40,11 +40,11 @@ internal class FirLazyDeclarationResolver( ) { if (declaration.resolvePhase >= toPhase) return - if (declaration is FirPropertyAccessor) { + if (declaration is FirPropertyAccessor || declaration is FirTypeParameter) { val ktContainingProperty = when (val ktDeclaration = declaration.ktDeclaration) { is KtPropertyAccessor -> ktDeclaration.property is KtProperty -> ktDeclaration - is KtParameter -> ktDeclaration.getNonLocalContainingOrThisDeclaration() + is KtParameter, is KtTypeParameter -> ktDeclaration.getNonLocalContainingOrThisDeclaration() ?: error("Cannot find containing declaration for KtParameter") else -> error("Invalid source of property accessor ${ktDeclaration::class}") } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/FirLightIdentifier.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/FirLightIdentifier.kt new file mode 100644 index 00000000000..dae8b437e8a --- /dev/null +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/FirLightIdentifier.kt @@ -0,0 +1,54 @@ +/* + * Copyright 2010-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.asJava.elements + +import com.intellij.openapi.util.TextRange +import com.intellij.psi.PsiCompiledElement +import com.intellij.psi.PsiElement +import com.intellij.psi.PsiFile +import com.intellij.psi.PsiNameIdentifierOwner +import com.intellij.psi.impl.light.LightIdentifier +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassOrObjectSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtNamedSymbol +import org.jetbrains.kotlin.psi.* +import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject + +open class FirLightIdentifier( + private val lightOwner: PsiElement, + private val firSymbol: KtSymbol +) : LightIdentifier(lightOwner.manager, (firSymbol as? KtNamedSymbol)?.name?.identifier), PsiCompiledElement, + PsiElementWithOrigin { + + override val origin: PsiElement? + get() = when (val ktDeclaration = firSymbol.psi) { + is KtSecondaryConstructor -> ktDeclaration.getConstructorKeyword() + is KtPrimaryConstructor -> ktDeclaration.getConstructorKeyword() + ?: ktDeclaration.valueParameterList + ?: ktDeclaration.containingClassOrObject?.nameIdentifier + is KtPropertyAccessor -> ktDeclaration.namePlaceholder + is KtNamedDeclaration -> ktDeclaration.nameIdentifier + else -> null + } + + override fun getMirror(): PsiElement? = null + override fun isPhysical(): Boolean = true + override fun getParent(): PsiElement = lightOwner + override fun getContainingFile(): PsiFile = lightOwner.containingFile + override fun getTextRange(): TextRange = origin?.textRange ?: TextRange.EMPTY_RANGE + override fun getTextOffset(): Int = origin?.textOffset ?: -1 +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/FirLightMemberImpl.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/FirLightMemberImpl.kt index 310e6580d60..251cac267e5 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/FirLightMemberImpl.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/FirLightMemberImpl.kt @@ -27,21 +27,19 @@ internal abstract class FirLightMemberImpl( override val clsDelegate: T get() = invalidAccess() - private val lightIdentifier by lazyPub { KtLightIdentifier(this, kotlinOrigin as? KtNamedDeclaration) } - override fun hasModifierProperty(name: String): Boolean = modifierList?.hasModifierProperty(name) ?: false override fun toString(): String = "${this::class.java.simpleName}:$name" override fun getContainingClass() = containingClass - override fun getNameIdentifier(): PsiIdentifier = lightIdentifier + abstract override fun getNameIdentifier(): PsiIdentifier? override val kotlinOrigin: KtDeclaration? get() = lightMemberOrigin?.originalElement override fun getDocComment(): PsiDocComment? = null //TODO() - override fun isDeprecated(): Boolean = false //TODO() + abstract override fun isDeprecated(): Boolean abstract override fun getName(): String diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/FirLightTypeParameterListForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/FirLightTypeParameterListForSymbol.kt new file mode 100644 index 00000000000..da083aec2be --- /dev/null +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/FirLightTypeParameterListForSymbol.kt @@ -0,0 +1,74 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.asJava.elements + +import com.intellij.psi.* +import com.intellij.psi.impl.light.LightElement +import com.intellij.psi.scope.PsiScopeProcessor +import org.jetbrains.kotlin.asJava.classes.lazyPub +import org.jetbrains.kotlin.idea.KotlinLanguage +import org.jetbrains.kotlin.idea.asJava.basicIsEquivalentTo +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithTypeParameters + + +internal class FirLightTypeParameterListForSymbol( + internal val owner: PsiTypeParameterListOwner, + private val symbolWithTypeParameterList: KtSymbolWithTypeParameters, + private val innerShiftCount: Int +) : LightElement(owner.manager, KotlinLanguage.INSTANCE), PsiTypeParameterList { + + override fun accept(visitor: PsiElementVisitor) { + if (visitor is JavaElementVisitor) { + visitor.visitTypeParameterList(this) + } else { + visitor.visitElement(this) + } + } + + override fun processDeclarations( + processor: PsiScopeProcessor, + state: ResolveState, + lastParent: PsiElement?, + place: PsiElement + ): Boolean { + return typeParameters.all { processor.execute(it, state) } + } + + private val _typeParameters: Array by lazyPub { + symbolWithTypeParameterList.typeParameters.let { list -> + list.take(list.count() - innerShiftCount).mapIndexed { index, parameter -> + FirLightTypeParameter( + parent = this@FirLightTypeParameterListForSymbol, + index = index, + typeParameterSymbol = parameter + ) + }.toTypedArray() + + } + } + + override fun getTypeParameters(): Array = _typeParameters + + override fun getTypeParameterIndex(typeParameter: PsiTypeParameter?): Int = + _typeParameters.indexOf(typeParameter) + + override fun toString(): String = "FirLightTypeParameterList" + + override fun equals(other: Any?): Boolean = + this === other || + (other is FirLightTypeParameterListForSymbol && symbolWithTypeParameterList == other.symbolWithTypeParameterList) + + override fun hashCode(): Int = symbolWithTypeParameterList.hashCode() + + override fun isEquivalentTo(another: PsiElement?): Boolean = + basicIsEquivalentTo(this, another) + + override fun getParent(): PsiElement = owner + override fun getContainingFile(): PsiFile = parent.containingFile + override fun getText(): String? = "" + override fun getTextOffset(): Int = 0 + override fun getStartOffsetInParent(): Int = 0 +} diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/annotationsUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/annotationsUtils.kt index e2146d4acbe..d46cfe385b9 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/annotationsUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/annotationsUtils.kt @@ -69,6 +69,9 @@ internal fun KtAnnotatedSymbol.hasJvmFieldAnnotation(): Boolean = internal fun KtAnnotatedSymbol.hasPublishedApiAnnotation(annotationUseSiteTarget: AnnotationUseSiteTarget? = null): Boolean = hasAnnotation("kotlin/PublishedApi", annotationUseSiteTarget) +internal fun KtAnnotatedSymbol.hasDeprecatedAnnotation(annotationUseSiteTarget: AnnotationUseSiteTarget? = null): Boolean = + hasAnnotation("kotlin/Deprecated", annotationUseSiteTarget) + internal fun KtAnnotatedSymbol.hasJvmOverloadsAnnotation(): Boolean = hasAnnotation("kotlin/jvm/JvmOverloads", null) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForClassOrObjectSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForClassOrObjectSymbol.kt index 4634e076c21..dd0a31ffe6e 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForClassOrObjectSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForClassOrObjectSymbol.kt @@ -16,18 +16,19 @@ import org.jetbrains.annotations.NonNls import org.jetbrains.kotlin.asJava.classes.KotlinSuperTypeListBuilder import org.jetbrains.kotlin.asJava.classes.getOutermostClassOrObject import org.jetbrains.kotlin.asJava.classes.lazyPub +import org.jetbrains.kotlin.asJava.elements.FirLightIdentifier import org.jetbrains.kotlin.asJava.elements.KtLightField -import org.jetbrains.kotlin.asJava.elements.KtLightIdentifier import org.jetbrains.kotlin.fir.symbols.StandardClassIds import org.jetbrains.kotlin.idea.asJava.classes.getOrCreateFirLightClass +import org.jetbrains.kotlin.idea.asJava.elements.FirLightTypeParameterListForSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.* import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolKind import org.jetbrains.kotlin.idea.frontend.api.types.KtClassType import org.jetbrains.kotlin.idea.frontend.api.types.KtType import org.jetbrains.kotlin.idea.util.ifFalse +import org.jetbrains.kotlin.idea.util.ifTrue import org.jetbrains.kotlin.load.java.structure.LightClassOriginKind import org.jetbrains.kotlin.psi.KtBlockExpression -import org.jetbrains.kotlin.psi.KtClass import org.jetbrains.kotlin.psi.KtClassBody import org.jetbrains.kotlin.psi.KtClassOrObject import org.jetbrains.kotlin.psi.debugText.getDebugText @@ -41,21 +42,52 @@ internal abstract class FirLightClassForClassOrObjectSymbol( private val isTopLevel: Boolean = classOrObjectSymbol.symbolKind == KtSymbolKind.TOP_LEVEL + private val _isDeprecated: Boolean by lazyPub { + classOrObjectSymbol.hasDeprecatedAnnotation() + } + + override fun isDeprecated(): Boolean = _isDeprecated + abstract override fun getModifierList(): PsiModifierList? abstract override fun getOwnFields(): List abstract override fun getOwnMethods(): List - override fun isDeprecated(): Boolean = false //TODO() - override fun getNameIdentifier(): KtLightIdentifier? = null //TODO() + + private val _identifier: PsiIdentifier by lazyPub { + FirLightIdentifier(this, classOrObjectSymbol) + } + + override fun getNameIdentifier(): PsiIdentifier? = _identifier + abstract override fun getExtendsList(): PsiReferenceList? abstract override fun getImplementsList(): PsiReferenceList? - override fun getTypeParameterList(): PsiTypeParameterList? = null //TODO() - override fun getTypeParameters(): Array = emptyArray() //TODO() + + + private val _typeParameterList: PsiTypeParameterList? by lazyPub { + hasTypeParameters().ifTrue { + val shiftCount = classOrObjectSymbol.isInner.ifTrue { + (parent as? FirLightClassForClassOrObjectSymbol)?.classOrObjectSymbol?.typeParameters?.count() + } ?: 0 + + FirLightTypeParameterListForSymbol( + owner = this, + symbolWithTypeParameterList = classOrObjectSymbol, + innerShiftCount = shiftCount + ) + } + } + + override fun hasTypeParameters(): Boolean = + classOrObjectSymbol.typeParameters.isNotEmpty() + + override fun getTypeParameterList(): PsiTypeParameterList? = _typeParameterList + override fun getTypeParameters(): Array = + _typeParameterList?.typeParameters ?: PsiTypeParameter.EMPTY_ARRAY abstract override fun getOwnInnerClasses(): List override fun getTextOffset(): Int = kotlinOrigin?.textOffset ?: 0 override fun getStartOffsetInParent(): Int = kotlinOrigin?.startOffsetInParent ?: 0 - override fun isWritable() = kotlinOrigin?.isWritable ?: false + override fun isWritable() = false override val kotlinOrigin: KtClassOrObject? = classOrObjectSymbol.psi as? KtClassOrObject protected fun createInheritanceList(forExtendsList: Boolean): PsiReferenceList { @@ -131,9 +163,6 @@ internal abstract class FirLightClassForClassOrObjectSymbol( abstract override fun isEnum(): Boolean - override fun hasTypeParameters(): Boolean = - classOrObjectSymbol is KtClass && classOrObjectSymbol.typeParameters.isNotEmpty() - override fun isValid(): Boolean = kotlinOrigin?.isValid ?: true override fun isInheritor(baseClass: PsiClass, checkDeep: Boolean): Boolean = diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt index 1f211b4b10b..af968dd1d71 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt @@ -93,10 +93,6 @@ internal class FirLightClassForSymbol( return result } - override fun getTextOffset(): Int = kotlinOrigin?.textOffset ?: 0 - override fun getStartOffsetInParent(): Int = kotlinOrigin?.startOffsetInParent ?: 0 - override fun isWritable() = kotlinOrigin?.isWritable ?: false - private val _extendsList by lazyPub { createInheritanceList(forExtendsList = true) } private val _implementsList by lazyPub { createInheritanceList(forExtendsList = false) } @@ -163,7 +159,7 @@ internal class FirLightClassForSymbol( val propertySymbols = classOrObjectSymbol.getDeclaredMemberScope().getCallableSymbols() .filterIsInstance() .applyIf(classOrObjectSymbol.classKind == KtClassKind.COMPANION_OBJECT) { - filter { it.hasJvmFieldAnnotation() || it.isConst } + filterNot { it.hasJvmFieldAnnotation() || it.isConst } } createFields(propertySymbols, isTopLevel = false, result) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt index d691a59b138..16ce5849b0b 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt @@ -15,10 +15,13 @@ import org.jetbrains.kotlin.asJava.classes.shouldNotBeVisibleAsLightClass import org.jetbrains.kotlin.asJava.elements.KtLightField import org.jetbrains.kotlin.asJava.elements.KtLightMethod import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget +import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.idea.asJava.* import org.jetbrains.kotlin.idea.asJava.FirLightClassForSymbol import org.jetbrains.kotlin.idea.asJava.fields.FirLightFieldForEnumEntry import org.jetbrains.kotlin.idea.frontend.api.analyze +import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirSymbol +import org.jetbrains.kotlin.idea.frontend.api.fir.utils.firRef import org.jetbrains.kotlin.idea.frontend.api.symbols.* import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtAnnotatedSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtCommonSymbolModality @@ -27,7 +30,9 @@ import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithVisibi import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.containingClass +import org.jetbrains.kotlin.psi.psiUtil.isLambdaOutsideParentheses import org.jetbrains.kotlin.psi.psiUtil.isObjectLiteral +import org.jetbrains.kotlin.util.containingNonLocalDeclaration import java.util.* fun getOrCreateFirLightClass(classOrObject: KtClassOrObject): KtLightClass? = @@ -53,10 +58,19 @@ fun createFirLightClassNoCache(classOrObject: KtClassOrObject): KtLightClass? { return null } + if (classOrObject.isLocal) { + val nonLocalDeclaration = classOrObject.containingNonLocalDeclaration() ?: return null + analyze(nonLocalDeclaration) { + (nonLocalDeclaration.getSymbol() as? KtFirSymbol<*>)?.run { + this.firRef.withFir(FirResolvePhase.BODY_RESOLVE) { } + } + } ?: return null + } + return when { classOrObject is KtEnumEntry -> lightClassForEnumEntry(classOrObject) classOrObject.isObjectLiteral() -> return null //TODO - classOrObject.safeIsLocal() -> return null //TODO + //classOrObject.safeIsLocal() -> return null //TODO classOrObject.hasModifier(KtTokens.INLINE_KEYWORD) -> return null //TODO else -> { analyze(classOrObject) { diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldEnumEntry.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldEnumEntry.kt index bef733f5b39..1ca96cd99ed 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldEnumEntry.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldEnumEntry.kt @@ -8,7 +8,9 @@ package org.jetbrains.kotlin.idea.asJava.fields import com.intellij.psi.* import org.jetbrains.kotlin.asJava.builder.LightMemberOrigin import org.jetbrains.kotlin.asJava.classes.* +import org.jetbrains.kotlin.asJava.elements.FirLightIdentifier import org.jetbrains.kotlin.fir.declarations.FirResolvePhase +import org.jetbrains.kotlin.idea.asJava.* import org.jetbrains.kotlin.idea.asJava.FirLightClassForSymbol import org.jetbrains.kotlin.idea.asJava.FirLightClassModifierList import org.jetbrains.kotlin.idea.asJava.FirLightField @@ -35,6 +37,8 @@ internal class FirLightFieldForEnumEntry( override val kotlinOrigin: KtEnumEntry? = enumEntrySymbol.psi as? KtEnumEntry + override fun isDeprecated(): Boolean = false + //TODO Make with KtSymbols private val hasBody: Boolean get() = kotlinOrigin?.let { it.body != null } ?: true @@ -73,6 +77,13 @@ internal class FirLightFieldForEnumEntry( override fun hashCode(): Int = enumEntrySymbol.hashCode() + private val _identifier: PsiIdentifier by lazyPub { + FirLightIdentifier(this, enumEntrySymbol) + } + + override fun getNameIdentifier(): PsiIdentifier = _identifier + + override fun equals(other: Any?): Boolean = other is FirLightFieldForEnumEntry && enumEntrySymbol == other.enumEntrySymbol diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForObjectSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForObjectSymbol.kt index 34a54f7eb55..f62b988b103 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForObjectSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForObjectSymbol.kt @@ -5,13 +5,12 @@ package org.jetbrains.kotlin.idea.asJava -import com.intellij.psi.PsiExpression -import com.intellij.psi.PsiModifier -import com.intellij.psi.PsiModifierList -import com.intellij.psi.PsiType +import com.intellij.psi.* import org.jetbrains.kotlin.asJava.builder.LightMemberOrigin import org.jetbrains.kotlin.asJava.classes.KtLightClass import org.jetbrains.kotlin.asJava.classes.lazyPub +import org.jetbrains.kotlin.asJava.elements.FirLightIdentifier +import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassKind import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassOrObjectSymbol import org.jetbrains.kotlin.psi.KtDeclaration @@ -33,12 +32,25 @@ internal class FirLightFieldForObjectSymbol( FirLightClassModifierList(this, modifiers, listOf(notNullAnnotation)) } + private val _isDeprecated: Boolean by lazyPub { + objectSymbol.hasDeprecatedAnnotation() + } + + override fun isDeprecated(): Boolean = _isDeprecated + override fun getModifierList(): PsiModifierList? = _modifierList private val _type: PsiType by lazyPub { objectSymbol.typeForClassSymbol(this@FirLightFieldForObjectSymbol) } + private val _identifier: PsiIdentifier by lazyPub { + FirLightIdentifier(this, objectSymbol) + } + + override fun getNameIdentifier(): PsiIdentifier = _identifier + + override fun getType(): PsiType = _type override fun getInitializer(): PsiExpression? = null //TODO diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt index 2c1ce5a15f3..3adbccaf37d 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt @@ -5,12 +5,10 @@ package org.jetbrains.kotlin.idea.asJava -import com.intellij.psi.PsiExpression -import com.intellij.psi.PsiModifier -import com.intellij.psi.PsiModifierList -import com.intellij.psi.PsiType +import com.intellij.psi.* import org.jetbrains.kotlin.asJava.builder.LightMemberOrigin import org.jetbrains.kotlin.asJava.classes.lazyPub +import org.jetbrains.kotlin.asJava.elements.FirLightIdentifier import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertySymbol @@ -34,6 +32,18 @@ internal class FirLightFieldForPropertySymbol( ) } + private val _isDeprecated: Boolean by lazyPub { + propertySymbol.hasDeprecatedAnnotation(AnnotationUseSiteTarget.FIELD) + } + + override fun isDeprecated(): Boolean = _isDeprecated + + private val _identifier: PsiIdentifier by lazyPub { + FirLightIdentifier(this, propertySymbol) + } + + override fun getNameIdentifier(): PsiIdentifier = _identifier + override fun getType(): PsiType = _returnedType private val _name = propertySymbol.name.asString() diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightAccessorMethodForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightAccessorMethodForSymbol.kt index 93802abc726..ab9863e780f 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightAccessorMethodForSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightAccessorMethodForSymbol.kt @@ -11,6 +11,7 @@ import org.jetbrains.kotlin.asJava.builder.LightMemberOrigin import org.jetbrains.kotlin.asJava.classes.METHOD_INDEX_FOR_GETTER import org.jetbrains.kotlin.asJava.classes.METHOD_INDEX_FOR_SETTER import org.jetbrains.kotlin.asJava.classes.lazyPub +import org.jetbrains.kotlin.asJava.elements.FirLightIdentifier import org.jetbrains.kotlin.builtins.StandardNames import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget @@ -50,6 +51,10 @@ internal class FirLightAccessorMethodForSymbol( override fun getName(): String = _name + override fun hasTypeParameters(): Boolean = false + override fun getTypeParameterList(): PsiTypeParameterList? = null + override fun getTypeParameters(): Array = PsiTypeParameter.EMPTY_ARRAY + override fun isVarArgs(): Boolean = false override val kotlinOrigin: KtDeclaration? = @@ -103,6 +108,18 @@ internal class FirLightAccessorMethodForSymbol( override fun isConstructor(): Boolean = false + private val _isDeprecated: Boolean by lazyPub { + containingPropertySymbol.hasDeprecatedAnnotation(accessorSite) + } + + override fun isDeprecated(): Boolean = _isDeprecated + + private val _identifier: PsiIdentifier by lazyPub { + FirLightIdentifier(this, containingPropertySymbol) + } + + override fun getNameIdentifier(): PsiIdentifier = _identifier + private val _returnedType: PsiType? by lazyPub { if (propertyAccessorSymbol !is KtPropertyGetterSymbol) return@lazyPub PsiType.VOID return@lazyPub containingPropertySymbol.type.asPsiType( diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightConstructorForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightConstructorForSymbol.kt index 5a1eb452fe4..ccc75eb7f6f 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightConstructorForSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightConstructorForSymbol.kt @@ -5,12 +5,9 @@ package org.jetbrains.kotlin.idea.asJava -import com.intellij.psi.PsiAnnotation -import com.intellij.psi.PsiModifierList -import com.intellij.psi.PsiType +import com.intellij.psi.* import org.jetbrains.kotlin.asJava.builder.LightMemberOrigin import org.jetbrains.kotlin.asJava.classes.lazyPub -import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget import org.jetbrains.kotlin.idea.frontend.api.symbols.KtConstructorSymbol internal class FirLightConstructorForSymbol( @@ -26,6 +23,10 @@ internal class FirLightConstructorForSymbol( override fun isConstructor(): Boolean = true + override fun hasTypeParameters(): Boolean = false + override fun getTypeParameterList(): PsiTypeParameterList? = null + override fun getTypeParameters(): Array = PsiTypeParameter.EMPTY_ARRAY + private val _annotations: List by lazyPub { constructorSymbol.computeAnnotations( parent = this, @@ -34,6 +35,12 @@ internal class FirLightConstructorForSymbol( ) } + private val _isDeprecated: Boolean by lazyPub { + constructorSymbol.hasDeprecatedAnnotation() + } + + override fun isDeprecated(): Boolean = _isDeprecated + private val _modifiers: Set by lazyPub { setOf(constructorSymbol.computeVisibility(isTopLevel = false)) } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightMethod.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightMethod.kt index 2dc1e68bb3e..17391c0524a 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightMethod.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightMethod.kt @@ -72,11 +72,9 @@ internal abstract class FirLightMethod( override val isMangled: Boolean = false - override fun getTypeParameters(): Array = emptyArray() //TODO - - override fun hasTypeParameters(): Boolean = false //TODO - - override fun getTypeParameterList(): PsiTypeParameterList? = null //TODO + abstract override fun getTypeParameters(): Array + abstract override fun hasTypeParameters(): Boolean + abstract override fun getTypeParameterList(): PsiTypeParameterList? override fun getThrowsList(): PsiReferenceList = KotlinLightReferenceListBuilder(manager, language, PsiReferenceList.Role.THROWS_LIST) //TODO() diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightMethodForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightMethodForSymbol.kt index 6b843d8662d..ea893c97d2c 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightMethodForSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightMethodForSymbol.kt @@ -8,9 +8,8 @@ package org.jetbrains.kotlin.idea.asJava import com.intellij.psi.* import com.intellij.psi.impl.light.LightParameterListBuilder import org.jetbrains.kotlin.asJava.builder.LightMemberOrigin -import org.jetbrains.kotlin.asJava.classes.KotlinLightReferenceListBuilder import org.jetbrains.kotlin.asJava.classes.lazyPub -import org.jetbrains.kotlin.asJava.elements.KotlinLightTypeParameterListBuilder +import org.jetbrains.kotlin.asJava.elements.FirLightIdentifier import org.jetbrains.kotlin.idea.frontend.api.symbols.KtFunctionLikeSymbol import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.KtDeclaration @@ -53,6 +52,12 @@ internal abstract class FirLightMethodForSymbol( builder } + private val _identifier: PsiIdentifier by lazyPub { + FirLightIdentifier(this, functionSymbol) + } + + override fun getNameIdentifier(): PsiIdentifier = _identifier + override fun getParameterList(): PsiParameterList = _parametersList override val kotlinOrigin: KtDeclaration? = functionSymbol.psi as? KtDeclaration diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightSimpleMethodForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightSimpleMethodForSymbol.kt index ae99fbe640d..aac9fa25d19 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightSimpleMethodForSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightSimpleMethodForSymbol.kt @@ -5,13 +5,11 @@ package org.jetbrains.kotlin.idea.asJava -import com.intellij.psi.PsiAnnotation -import com.intellij.psi.PsiModifier -import com.intellij.psi.PsiModifierList -import com.intellij.psi.PsiType +import com.intellij.psi.* import org.jetbrains.kotlin.asJava.builder.LightMemberOrigin import org.jetbrains.kotlin.asJava.classes.lazyPub import org.jetbrains.kotlin.fir.declarations.FirResolvePhase +import org.jetbrains.kotlin.idea.asJava.elements.FirLightTypeParameterListForSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtFunctionSymbol import org.jetbrains.kotlin.idea.frontend.api.types.isUnit import org.jetbrains.kotlin.idea.util.ifTrue @@ -39,13 +37,32 @@ internal class FirLightSimpleMethodForSymbol( override fun getName(): String = _name + private val _typeParameterList: PsiTypeParameterList? by lazyPub { + hasTypeParameters().ifTrue { + FirLightTypeParameterListForSymbol( + owner = this, + symbolWithTypeParameterList = functionSymbol, + innerShiftCount = 0 + ) + } + } + + override fun hasTypeParameters(): Boolean = + functionSymbol.typeParameters.isNotEmpty() + + override fun getTypeParameterList(): PsiTypeParameterList? = _typeParameterList + override fun getTypeParameters(): Array = + _typeParameterList?.typeParameters ?: PsiTypeParameter.EMPTY_ARRAY + private val _annotations: List by lazyPub { + val needUnknownNullability = + isVoidReturnType || (_visibility == PsiModifier.PRIVATE) - val needUnknownNullability = functionSymbol.type.isUnit || (_visibility == PsiModifier.PRIVATE) - - val nullability = if (needUnknownNullability) NullabilityType.Unknown else functionSymbol.type.getTypeNullability( - functionSymbol, - FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE + val nullability = if (needUnknownNullability) + NullabilityType.Unknown + else functionSymbol.type.getTypeNullability( + context = functionSymbol, + phase = FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE ) functionSymbol.computeAnnotations( @@ -80,6 +97,12 @@ internal class FirLightSimpleMethodForSymbol( ) } + private val _isDeprecated: Boolean by lazyPub { + functionSymbol.hasDeprecatedAnnotation() + } + + override fun isDeprecated(): Boolean = _isDeprecated + private val _modifierList: PsiModifierList by lazyPub { FirLightClassModifierList(this, _modifiers, _annotations) } @@ -88,8 +111,13 @@ internal class FirLightSimpleMethodForSymbol( override fun isConstructor(): Boolean = false + private val isVoidReturnType: Boolean + get() = functionSymbol.type.run { + isUnit && nullabilityType != NullabilityType.Nullable + } + private val _returnedType: PsiType by lazyPub { - if (functionSymbol.type.isUnit) return@lazyPub PsiType.VOID + if (isVoidReturnType) return@lazyPub PsiType.VOID functionSymbol.asPsiType(this@FirLightSimpleMethodForSymbol, FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE) } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/parameters/FirLightParameter.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/parameters/FirLightParameter.kt index b674aea8b9b..7a9d2f05073 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/parameters/FirLightParameter.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/parameters/FirLightParameter.kt @@ -26,7 +26,8 @@ internal abstract class FirLightParameter(containingDeclaration: FirLightMethod) override fun getInitializer(): PsiExpression? = null override fun hasInitializer(): Boolean = false override fun computeConstantValue(): Any? = null - override fun getNameIdentifier(): PsiIdentifier? = null + + abstract override fun getNameIdentifier(): PsiIdentifier? abstract override fun getName(): String diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/parameters/FirLightParameterForReceiver.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/parameters/FirLightParameterForReceiver.kt index fbb96c86c34..3c4b006df35 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/parameters/FirLightParameterForReceiver.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/parameters/FirLightParameterForReceiver.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.idea.asJava import com.intellij.psi.PsiAnnotation +import com.intellij.psi.PsiIdentifier import com.intellij.psi.PsiModifierList import com.intellij.psi.PsiType import org.jetbrains.kotlin.asJava.classes.lazyPub @@ -53,6 +54,8 @@ internal class FirLightParameterForReceiver private constructor( AsmUtil.getLabeledThisName(methodName, AsmUtil.LABELED_THIS_PARAMETER, AsmUtil.RECEIVER_PARAMETER_NAME) } + override fun getNameIdentifier(): PsiIdentifier? = null + override fun getName(): String = _name override fun isVarArgs() = false diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/parameters/FirLightParameterForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/parameters/FirLightParameterForSymbol.kt index 3962788a89b..16fef101818 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/parameters/FirLightParameterForSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/parameters/FirLightParameterForSymbol.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.idea.asJava import com.intellij.psi.* import org.jetbrains.kotlin.asJava.classes.lazyPub +import org.jetbrains.kotlin.asJava.elements.FirLightIdentifier import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.idea.frontend.api.symbols.KtParameterSymbol @@ -46,6 +47,12 @@ internal class FirLightParameterForSymbol( FirLightClassModifierList(this, emptySet(), _annotations) } + private val _identifier: PsiIdentifier by lazyPub { + FirLightIdentifier(this, parameterSymbol) + } + + override fun getNameIdentifier(): PsiIdentifier = _identifier + private val _type by lazyPub { val convertedType = parameterSymbol.asPsiType(this, FirResolvePhase.TYPES) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/parameters/FirLightTypeParameter.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/parameters/FirLightTypeParameter.kt new file mode 100644 index 00000000000..3ca16019d9e --- /dev/null +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/parameters/FirLightTypeParameter.kt @@ -0,0 +1,163 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.asJava.elements + +import com.intellij.lang.Language +import com.intellij.openapi.util.Pair +import com.intellij.openapi.util.TextRange +import com.intellij.psi.* +import com.intellij.psi.impl.PsiClassImplUtil +import com.intellij.psi.impl.light.LightElement +import com.intellij.psi.impl.light.LightReferenceListBuilder +import com.intellij.psi.javadoc.PsiDocComment +import com.intellij.psi.search.SearchScope +import org.jetbrains.kotlin.asJava.classes.KotlinSuperTypeListBuilder +import org.jetbrains.kotlin.asJava.classes.cannotModify +import org.jetbrains.kotlin.asJava.classes.lazyPub +import org.jetbrains.kotlin.asJava.elements.KtLightAbstractAnnotation +import org.jetbrains.kotlin.asJava.elements.KtLightDeclaration +import org.jetbrains.kotlin.fir.symbols.StandardClassIds +import org.jetbrains.kotlin.idea.KotlinLanguage +import org.jetbrains.kotlin.idea.asJava.basicIsEquivalentTo +import org.jetbrains.kotlin.idea.asJava.invalidAccess +import org.jetbrains.kotlin.idea.asJava.mapSupertype +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassKind +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassOrObjectSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtTypeParameterSymbol +import org.jetbrains.kotlin.idea.frontend.api.types.KtClassType +import org.jetbrains.kotlin.idea.frontend.api.types.KtType +import org.jetbrains.kotlin.psi.KtTypeParameter +import org.jetbrains.kotlin.psi.psiUtil.startOffset + +internal class FirLightTypeParameter( + private val parent: FirLightTypeParameterListForSymbol, + private val index: Int, + private val typeParameterSymbol: KtTypeParameterSymbol +) : LightElement(parent.manager, KotlinLanguage.INSTANCE), PsiTypeParameter, + KtLightDeclaration { + + override val clsDelegate: PsiTypeParameter get() = invalidAccess() + + override val givenAnnotations: List? get() = invalidAccess() + + override val kotlinOrigin: KtTypeParameter? = typeParameterSymbol.psi as? KtTypeParameter + + override fun copy(): PsiElement = + FirLightTypeParameter(parent, index, typeParameterSymbol) + + override fun accept(visitor: PsiElementVisitor) { + if (visitor is JavaElementVisitor) { + visitor.visitTypeParameter(this) + } else { + super.accept(visitor) + } + } + + private val _extendsList: PsiReferenceList by lazyPub { + + val listBuilder = KotlinSuperTypeListBuilder( + kotlinOrigin = null, + manager = manager, + language = language, + role = PsiReferenceList.Role.EXTENDS_LIST + ) + + typeParameterSymbol.bounds + .filterIsInstance() + .filter { it.classId != StandardClassIds.Any } + .mapNotNull { it.mapSupertype(this, kotlinCollectionAsIs = true) } + .forEach { listBuilder.addReference(it) } + + listBuilder + } + + override fun getExtendsList(): PsiReferenceList = _extendsList + + override fun getExtendsListTypes(): Array = + PsiClassImplUtil.getExtendsListTypes(this) + + //PsiClass simple implementation + override fun getImplementsList(): PsiReferenceList? = null + override fun getImplementsListTypes(): Array = PsiClassType.EMPTY_ARRAY + override fun getSuperClass(): PsiClass? = null + override fun getInterfaces(): Array = PsiClass.EMPTY_ARRAY + override fun getSupers(): Array = PsiClass.EMPTY_ARRAY + override fun getSuperTypes(): Array = PsiClassType.EMPTY_ARRAY + override fun getConstructors(): Array = PsiMethod.EMPTY_ARRAY + override fun getInitializers(): Array = PsiClassInitializer.EMPTY_ARRAY + override fun getAllFields(): Array = PsiField.EMPTY_ARRAY + override fun getAllMethods(): Array = PsiMethod.EMPTY_ARRAY + override fun getAllInnerClasses(): Array = PsiClass.EMPTY_ARRAY + override fun findFieldByName(name: String?, checkBases: Boolean): PsiField? = null + override fun findMethodBySignature(patternMethod: PsiMethod?, checkBases: Boolean): PsiMethod? = null + override fun findMethodsBySignature(patternMethod: PsiMethod?, checkBases: Boolean): Array = PsiMethod.EMPTY_ARRAY + override fun findMethodsAndTheirSubstitutorsByName(name: String?, checkBases: Boolean) + : MutableList> = mutableListOf() + + override fun getAllMethodsAndTheirSubstitutors() + : MutableList> = mutableListOf() + + override fun findInnerClassByName(name: String?, checkBases: Boolean): PsiClass? = null + override fun getLBrace(): PsiElement? = null + override fun getRBrace(): PsiElement? = null + override fun getScope(): PsiElement = parent + override fun isInheritor(baseClass: PsiClass, checkDeep: Boolean): Boolean = false + override fun isInheritorDeep(baseClass: PsiClass?, classToByPass: PsiClass?): Boolean = false + override fun getVisibleSignatures(): MutableCollection = mutableListOf() + override fun setName(name: String): PsiElement = cannotModify() + override fun getNameIdentifier(): PsiIdentifier? = null + override fun getModifierList(): PsiModifierList? = null + override fun hasModifierProperty(name: String): Boolean = false + override fun getOwner(): PsiTypeParameterListOwner? = parent.owner + override fun getParent(): PsiElement = parent + override fun getAnnotations(): Array = PsiAnnotation.EMPTY_ARRAY + override fun getContainingClass(): PsiClass? = null + override fun getDocComment(): PsiDocComment? = null + override fun isDeprecated(): Boolean = false + override fun getTypeParameters(): Array = PsiTypeParameter.EMPTY_ARRAY + override fun hasTypeParameters(): Boolean = false + override fun getTypeParameterList(): PsiTypeParameterList? = null + override fun getQualifiedName(): String? = null + override fun getMethods(): Array = PsiMethod.EMPTY_ARRAY + override fun findMethodsByName(name: String?, checkBases: Boolean): Array = PsiMethod.EMPTY_ARRAY + override fun getFields(): Array = PsiField.EMPTY_ARRAY + override fun getInnerClasses(): Array = PsiClass.EMPTY_ARRAY + override fun isInterface(): Boolean = false + override fun isAnnotationType(): Boolean = false + override fun isEnum(): Boolean = false + override fun findAnnotation(qualifiedName: String): PsiAnnotation? = null + override fun addAnnotation(qualifiedName: String): PsiAnnotation = cannotModify() + //End of PsiClass simple implementation + + override fun getText(): String = kotlinOrigin?.text ?: "" + override fun getName(): String? = typeParameterSymbol.name.asString() + override fun getIndex(): Int = index + override fun getApplicableAnnotations(): Array = PsiAnnotation.EMPTY_ARRAY //TODO + + override fun toString(): String = "FirLightTypeParameter:$name" + + override fun getNavigationElement(): PsiElement = + kotlinOrigin ?: parent.navigationElement + + override fun getLanguage(): Language = KotlinLanguage.INSTANCE + + override fun getUseScope(): SearchScope = + kotlinOrigin?.useScope ?: parent.useScope + + override fun equals(other: Any?): Boolean = + this === other || + (other is FirLightTypeParameter && index == other.index && typeParameterSymbol == other.typeParameterSymbol) + + override fun hashCode(): Int = typeParameterSymbol.hashCode() + index + + override fun isEquivalentTo(another: PsiElement): Boolean = + basicIsEquivalentTo(this, another) + + override fun getTextRange(): TextRange? = kotlinOrigin?.textRange + override fun getContainingFile(): PsiFile = parent.containingFile + override fun getTextOffset(): Int = kotlinOrigin?.startOffset ?: super.getTextOffset() + override fun getStartOffsetInParent(): Int = kotlinOrigin?.startOffsetInParent ?: super.getStartOffsetInParent() +} diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtSymbolByFirBuilder.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtSymbolByFirBuilder.kt index d60723bac4c..6fbe6fdbb4a 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtSymbolByFirBuilder.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtSymbolByFirBuilder.kt @@ -127,7 +127,7 @@ internal class KtSymbolByFirBuilder private constructor( } fun buildConstructorSymbol(fir: FirConstructor) = symbolsCache.cache(fir) { KtFirConstructorSymbol(fir, resolveState, token, this) } - fun buildTypeParameterSymbol(fir: FirTypeParameter) = symbolsCache.cache(fir) { KtFirTypeParameterSymbol(fir, resolveState, token) } + fun buildTypeParameterSymbol(fir: FirTypeParameter) = symbolsCache.cache(fir) { KtFirTypeParameterSymbol(fir, resolveState, token, this) } fun buildTypeAliasSymbol(fir: FirTypeAlias) = symbolsCache.cache(fir) { KtFirTypeAliasSymbol(fir, resolveState, token) } fun buildEnumEntrySymbol(fir: FirEnumEntry) = symbolsCache.cache(fir) { KtFirEnumEntrySymbol(fir, resolveState, token, this) } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirTypeParameterSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirTypeParameterSymbol.kt index 297808241d2..76deeb816ee 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirTypeParameterSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirTypeParameterSymbol.kt @@ -6,26 +6,34 @@ package org.jetbrains.kotlin.idea.frontend.api.fir.symbols import com.intellij.psi.PsiElement +import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.fir.declarations.FirTypeParameter import org.jetbrains.kotlin.idea.fir.findPsi import org.jetbrains.kotlin.idea.fir.low.level.api.api.FirModuleResolveState import org.jetbrains.kotlin.idea.frontend.api.ValidityToken +import org.jetbrains.kotlin.idea.frontend.api.fir.KtSymbolByFirBuilder import org.jetbrains.kotlin.idea.frontend.api.fir.utils.firRef import org.jetbrains.kotlin.idea.frontend.api.symbols.KtTypeParameterSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtPsiBasedSymbolPointer import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtSymbolPointer +import org.jetbrains.kotlin.idea.frontend.api.types.KtType import org.jetbrains.kotlin.name.Name internal class KtFirTypeParameterSymbol( fir: FirTypeParameter, resolveState: FirModuleResolveState, - override val token: ValidityToken + override val token: ValidityToken, + private val builder: KtSymbolByFirBuilder ) : KtTypeParameterSymbol(), KtFirSymbol { override val firRef = firRef(fir, resolveState) override val psi: PsiElement? by firRef.withFirAndCache { it.findPsi(fir.session) } override val name: Name get() = firRef.withFir { it.name } + override val bounds: List by firRef.withFirAndCache(FirResolvePhase.TYPES) { fir -> + fir.bounds.map { type -> builder.buildKtType(type) } + } + override fun createPointer(): KtSymbolPointer { KtPsiBasedSymbolPointer.createForSymbolFromSource(this)?.let { return it } TODO("Creating symbols for library type parameters is not supported yet") From 6aff96a4018cc35221340e940a91b27438244426 Mon Sep 17 00:00:00 2001 From: Igor Yakovlev Date: Sat, 21 Nov 2020 12:35:30 +0300 Subject: [PATCH 380/698] [FIR IDE] Remove extra analyzing for local declarations --- .../api/lazy/resolve/FirLazyDeclarationResolver.kt | 5 ++--- .../kotlin/idea/asJava/classes/firLightClassUtils.kt | 10 ---------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/lazy/resolve/FirLazyDeclarationResolver.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/lazy/resolve/FirLazyDeclarationResolver.kt index 50006eee41a..733e9ab746b 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/lazy/resolve/FirLazyDeclarationResolver.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/lazy/resolve/FirLazyDeclarationResolver.kt @@ -25,7 +25,6 @@ import org.jetbrains.kotlin.idea.fir.low.level.api.util.checkCanceled import org.jetbrains.kotlin.idea.fir.low.level.api.util.executeWithoutPCE import org.jetbrains.kotlin.idea.fir.low.level.api.util.findSourceNonLocalFirDeclaration import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.getParentOfType internal class FirLazyDeclarationResolver( private val firFileBuilder: FirFileBuilder @@ -41,14 +40,14 @@ internal class FirLazyDeclarationResolver( if (declaration.resolvePhase >= toPhase) return if (declaration is FirPropertyAccessor || declaration is FirTypeParameter) { - val ktContainingProperty = when (val ktDeclaration = declaration.ktDeclaration) { + val ktContainingResolvableDeclaration = when (val ktDeclaration = declaration.ktDeclaration) { is KtPropertyAccessor -> ktDeclaration.property is KtProperty -> ktDeclaration is KtParameter, is KtTypeParameter -> ktDeclaration.getNonLocalContainingOrThisDeclaration() ?: error("Cannot find containing declaration for KtParameter") else -> error("Invalid source of property accessor ${ktDeclaration::class}") } - val containingProperty = ktContainingProperty + val containingProperty = ktContainingResolvableDeclaration .findSourceNonLocalFirDeclaration(firFileBuilder, declaration.session.firSymbolProvider, moduleFileCache) return lazyResolveDeclaration(containingProperty, moduleFileCache, toPhase, towerDataContextCollector) } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt index 16ce5849b0b..469a4f04c2c 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt @@ -58,19 +58,9 @@ fun createFirLightClassNoCache(classOrObject: KtClassOrObject): KtLightClass? { return null } - if (classOrObject.isLocal) { - val nonLocalDeclaration = classOrObject.containingNonLocalDeclaration() ?: return null - analyze(nonLocalDeclaration) { - (nonLocalDeclaration.getSymbol() as? KtFirSymbol<*>)?.run { - this.firRef.withFir(FirResolvePhase.BODY_RESOLVE) { } - } - } ?: return null - } - return when { classOrObject is KtEnumEntry -> lightClassForEnumEntry(classOrObject) classOrObject.isObjectLiteral() -> return null //TODO - //classOrObject.safeIsLocal() -> return null //TODO classOrObject.hasModifier(KtTokens.INLINE_KEYWORD) -> return null //TODO else -> { analyze(classOrObject) { From aff90b335caedc64a96034d04755dd716554734d Mon Sep 17 00:00:00 2001 From: Igor Yakovlev Date: Mon, 23 Nov 2020 22:26:21 +0300 Subject: [PATCH 381/698] [FIR IDE] LC Implement special keywords like transient, volatile, synchronized, strictfp --- .../idea/asJava/fields/FirLightFieldForPropertySymbol.kt | 6 ++++++ .../idea/asJava/methods/FirLightSimpleMethodForSymbol.kt | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt index 3adbccaf37d..57b4f436964 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt @@ -72,6 +72,12 @@ internal class FirLightFieldForPropertySymbol( val modifiers = modifiersWithVisibility.add( what = PsiModifier.FINAL, `if` = !suppressFinal + ).add( + what = PsiModifier.TRANSIENT, + `if` = propertySymbol.hasAnnotation("kotlin/jvm/Transient", null) + ).add( + what = PsiModifier.VOLATILE, + `if` = propertySymbol.hasAnnotation("kotlin/jvm/Volatile", null) ) val nullability = if (visibility != PsiModifier.PRIVATE) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightSimpleMethodForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightSimpleMethodForSymbol.kt index aac9fa25d19..0523d1b5a94 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightSimpleMethodForSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightSimpleMethodForSymbol.kt @@ -94,6 +94,12 @@ internal class FirLightSimpleMethodForSymbol( modifiers.add( what = PsiModifier.STATIC, `if` = functionSymbol.hasJvmStaticAnnotation() + ).add( + what = PsiModifier.STRICTFP, + `if` = functionSymbol.hasAnnotation("kotlin/jvm/Strictfp", null) + ).add( + what = PsiModifier.SYNCHRONIZED, + `if` = functionSymbol.hasAnnotation("kotlin/jvm/Synchronized", null) ) } From 229c6f97acccd9246cea82c576240253ad4ac17f Mon Sep 17 00:00:00 2001 From: Igor Yakovlev Date: Mon, 23 Nov 2020 22:32:05 +0300 Subject: [PATCH 382/698] [FIR IDE] LC Fixed nullability for getters --- .../FirLightAccessorMethodForSymbol.kt | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightAccessorMethodForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightAccessorMethodForSymbol.kt index ab9863e780f..d5970252ec4 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightAccessorMethodForSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightAccessorMethodForSymbol.kt @@ -12,17 +12,13 @@ import org.jetbrains.kotlin.asJava.classes.METHOD_INDEX_FOR_GETTER import org.jetbrains.kotlin.asJava.classes.METHOD_INDEX_FOR_SETTER import org.jetbrains.kotlin.asJava.classes.lazyPub import org.jetbrains.kotlin.asJava.elements.FirLightIdentifier -import org.jetbrains.kotlin.builtins.StandardNames -import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget import org.jetbrains.kotlin.fir.declarations.FirResolvePhase -import org.jetbrains.kotlin.idea.frontend.api.fir.analyzeWithSymbolAsContext -import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirPropertyGetterSymbol -import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirSymbol -import org.jetbrains.kotlin.idea.frontend.api.symbols.* -import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.* +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertyAccessorSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertyGetterSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertySetterSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertySymbol import org.jetbrains.kotlin.idea.util.ifTrue -import org.jetbrains.kotlin.idea.util.module import org.jetbrains.kotlin.load.java.JvmAbi.getterName import org.jetbrains.kotlin.load.java.JvmAbi.setterName import org.jetbrains.kotlin.psi.KtDeclaration @@ -38,13 +34,14 @@ internal class FirLightAccessorMethodForSymbol( containingClass, if (propertyAccessorSymbol is KtPropertyGetterSymbol) METHOD_INDEX_FOR_GETTER else METHOD_INDEX_FOR_SETTER ) { - private fun String.abiName(firPropertyAccessor: KtPropertyAccessorSymbol) = - if (firPropertyAccessor is KtPropertyGetterSymbol) getterName(this) - else setterName(this) + private val isGetter: Boolean get() = propertyAccessorSymbol is KtPropertyGetterSymbol + + private fun String.abiName() = + if (isGetter) getterName(this) else setterName(this) private val _name: String by lazyPub { val defaultName = containingPropertySymbol.name.identifier.let { - if (containingClass.isAnnotationType) it else it.abiName(propertyAccessorSymbol) + if (containingClass.isAnnotationType) it else it.abiName() } containingPropertySymbol.computeJvmMethodName(defaultName, containingClass, accessorSite) } @@ -66,8 +63,11 @@ internal class FirLightAccessorMethodForSymbol( else AnnotationUseSiteTarget.PROPERTY_SETTER private val _annotations: List by lazyPub { - val nullabilityType = containingPropertySymbol.type + + val nullabilityType = if (isGetter) containingPropertySymbol.type .getTypeNullability(containingPropertySymbol, FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE) + else NullabilityType.Unknown + containingPropertySymbol.computeAnnotations( parent = this, nullability = nullabilityType, @@ -121,7 +121,7 @@ internal class FirLightAccessorMethodForSymbol( override fun getNameIdentifier(): PsiIdentifier = _identifier private val _returnedType: PsiType? by lazyPub { - if (propertyAccessorSymbol !is KtPropertyGetterSymbol) return@lazyPub PsiType.VOID + if (!isGetter) return@lazyPub PsiType.VOID return@lazyPub containingPropertySymbol.type.asPsiType( context = containingPropertySymbol, parent = this@FirLightAccessorMethodForSymbol, From 535aa1e9e0dd50d6f58a2f483d7dd0ec510c4343 Mon Sep 17 00:00:00 2001 From: Igor Yakovlev Date: Mon, 23 Nov 2020 23:32:05 +0300 Subject: [PATCH 383/698] [FIR IDE] LC expand typealiases for applied annotations --- .../asJava/ultraLightClasses/typeAliases.kt | 2 ++ .../idea/frontend/api/fir/utils/firUtils.kt | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/compiler/testData/asJava/ultraLightClasses/typeAliases.kt b/compiler/testData/asJava/ultraLightClasses/typeAliases.kt index e4ce877d6de..ea215c1dcdb 100644 --- a/compiler/testData/asJava/ultraLightClasses/typeAliases.kt +++ b/compiler/testData/asJava/ultraLightClasses/typeAliases.kt @@ -3,3 +3,5 @@ typealias JO = JvmOverloads object O { @JO fun foo(a: Int = 1, b: String = "") {} } + +// FIR_COMPARISON \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/firUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/firUtils.kt index 66eb41e600b..b939bb0e58b 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/firUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/firUtils.kt @@ -8,7 +8,9 @@ import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.psi +import org.jetbrains.kotlin.fir.resolve.fullyExpandedType import org.jetbrains.kotlin.fir.resolve.toSymbol +import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol import org.jetbrains.kotlin.fir.types.ConeClassLikeType import org.jetbrains.kotlin.fir.types.classId import org.jetbrains.kotlin.fir.types.coneType @@ -16,6 +18,8 @@ import org.jetbrains.kotlin.idea.frontend.api.fir.KtSymbolByFirBuilder import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirAnnotationCall import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.* import org.jetbrains.kotlin.psi.KtCallElement +import org.jetbrains.kotlin.fir.resolve.toSymbol +import org.jetbrains.kotlin.fir.symbols.impl.FirTypeAliasSymbol internal fun mapAnnotationParameters(annotationCall: FirAnnotationCall, session: FirSession): Map { @@ -53,13 +57,21 @@ private fun FirExpression.convertConstantExpression(): KtConstantValue = else -> KtUnsupportedConstantValue } +private fun ConeClassLikeType.expandTypeAliasIfNeeded(session: FirSession): ConeClassLikeType { + val firTypeAlias = lookupTag.toSymbol(session) as? FirTypeAliasSymbol ?: return this + val expandedType = firTypeAlias.fir.expandedTypeRef.coneType + return expandedType.fullyExpandedType(session) as? ConeClassLikeType + ?: return this +} + private fun convertAnnotation( annotationCall: FirAnnotationCall, session: FirSession ): KtFirAnnotationCall? { - val annotationCone = annotationCall.annotationTypeRef.coneType as? ConeClassLikeType ?: return null - val classId = annotationCone.classId ?: return null + val declaredCone = annotationCall.annotationTypeRef.coneType as? ConeClassLikeType ?: return null + + val classId = declaredCone.expandTypeAliasIfNeeded(session).classId ?: return null val resultList = mapAnnotationParameters(annotationCall, session).map { KtNamedConstantValue(it.key, it.value.convertConstantExpression()) From 18e5af37ffe3f40c9fa3569ca50aaa08cbc23176 Mon Sep 17 00:00:00 2001 From: Igor Yakovlev Date: Mon, 23 Nov 2020 23:32:31 +0300 Subject: [PATCH 384/698] [FIR IDE] LC Fixed incorrect JvmOverloads --- .../lightClasses/nullabilityAnnotations/JvmOverloads.kt | 2 ++ .../asJava/lightClasses/nullabilityAnnotations/Trait.kt | 4 +++- .../kotlin/idea/asJava/classes/firLightClassUtils.kt | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/compiler/testData/asJava/lightClasses/nullabilityAnnotations/JvmOverloads.kt b/compiler/testData/asJava/lightClasses/nullabilityAnnotations/JvmOverloads.kt index f74f173c583..41047055587 100644 --- a/compiler/testData/asJava/lightClasses/nullabilityAnnotations/JvmOverloads.kt +++ b/compiler/testData/asJava/lightClasses/nullabilityAnnotations/JvmOverloads.kt @@ -6,3 +6,5 @@ class C { return "a" } } + +// FIR_COMPARISON \ No newline at end of file diff --git a/compiler/testData/asJava/lightClasses/nullabilityAnnotations/Trait.kt b/compiler/testData/asJava/lightClasses/nullabilityAnnotations/Trait.kt index b9d1c860a91..43561766384 100644 --- a/compiler/testData/asJava/lightClasses/nullabilityAnnotations/Trait.kt +++ b/compiler/testData/asJava/lightClasses/nullabilityAnnotations/Trait.kt @@ -17,4 +17,6 @@ interface Trait { var nullableVar: String? val notNullVal: String var notNullVar: String -} \ No newline at end of file +} + +// FIR_COMPARISON \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt index 469a4f04c2c..6d1820eaa56 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt @@ -133,7 +133,7 @@ internal fun FirLightClassBase.createMethods( containingClass = this@createMethods, isTopLevel = isTopLevel, methodIndex = methodIndex++, - argumentsSkipMask = skipMask + argumentsSkipMask = skipMask.clone() as BitSet ) ) } From 56c3faee00b5144fe0ee476fc79bda87118d3eab Mon Sep 17 00:00:00 2001 From: Igor Yakovlev Date: Tue, 24 Nov 2020 00:05:51 +0300 Subject: [PATCH 385/698] [FIR IDE] LC Fix generating unique field names --- .../lightClasses/compilationErrors/SameName.kt | 2 ++ .../asJava/classes/FirLightClassForFacade.kt | 6 ++++-- .../asJava/classes/FirLightClassForSymbol.kt | 5 ++++- .../idea/asJava/classes/firLightClassUtils.kt | 16 ++++++---------- .../fields/FirLightFieldForPropertySymbol.kt | 16 +++++++++++++++- 5 files changed, 31 insertions(+), 14 deletions(-) diff --git a/compiler/testData/asJava/lightClasses/compilationErrors/SameName.kt b/compiler/testData/asJava/lightClasses/compilationErrors/SameName.kt index 95c0dbf1bfe..9412ffcab6a 100644 --- a/compiler/testData/asJava/lightClasses/compilationErrors/SameName.kt +++ b/compiler/testData/asJava/lightClasses/compilationErrors/SameName.kt @@ -13,3 +13,5 @@ class A { private val j: String = { "a" }() private val j: String = { "b" }() } + +// FIR_COMPARISON \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt index b5e01365a3d..bc4ea6706e4 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt @@ -114,6 +114,7 @@ class FirLightClassForFacade( private fun loadFieldsFromFile( file: KtFile, + usedFieldNames: MutableSet, result: MutableList ) { @@ -130,13 +131,14 @@ class FirLightClassForFacade( } } - createFields(symbols.asSequence(), isTopLevel = true, result) + createFields(symbols.asSequence(), usedFieldNames, isTopLevel = true, result) } private val _ownFields: List by lazyPub { val result = mutableListOf() + val usedFieldNames = mutableSetOf() for (file in files) { - loadFieldsFromFile(file, result) + loadFieldsFromFile(file, usedFieldNames, result) } result } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt index af968dd1d71..0a1db55e788 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt @@ -133,6 +133,8 @@ internal class FirLightClassForSymbol( result.addCompanionObjectFieldIfNeeded() + val usedNames = mutableSetOf() + classOrObjectSymbol.companionObject?.run { analyzeWithSymbolAsContext(this) { getDeclaredMemberScope().getCallableSymbols() @@ -141,6 +143,7 @@ internal class FirLightClassForSymbol( .mapTo(result) { FirLightFieldForPropertySymbol( propertySymbol = it, + usedNames = usedNames, containingClass = this@FirLightClassForSymbol, lightMemberOrigin = null, isTopLevel = false, @@ -161,7 +164,7 @@ internal class FirLightClassForSymbol( .applyIf(classOrObjectSymbol.classKind == KtClassKind.COMPANION_OBJECT) { filterNot { it.hasJvmFieldAnnotation() || it.isConst } } - createFields(propertySymbols, isTopLevel = false, result) + createFields(propertySymbols, usedNames, isTopLevel = false, result) if (isEnum) { classOrObjectSymbol.getDeclaredMemberScope().getCallableSymbols() diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt index 6d1820eaa56..532f9f595dc 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt @@ -10,29 +10,24 @@ import com.intellij.psi.util.CachedValuesManager import org.jetbrains.kotlin.analyzer.KotlinModificationTrackerService import org.jetbrains.kotlin.asJava.classes.KtLightClass import org.jetbrains.kotlin.asJava.classes.METHOD_INDEX_BASE -import org.jetbrains.kotlin.asJava.classes.safeIsLocal import org.jetbrains.kotlin.asJava.classes.shouldNotBeVisibleAsLightClass import org.jetbrains.kotlin.asJava.elements.KtLightField import org.jetbrains.kotlin.asJava.elements.KtLightMethod import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget -import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.idea.asJava.* -import org.jetbrains.kotlin.idea.asJava.FirLightClassForSymbol import org.jetbrains.kotlin.idea.asJava.fields.FirLightFieldForEnumEntry import org.jetbrains.kotlin.idea.frontend.api.analyze -import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirSymbol -import org.jetbrains.kotlin.idea.frontend.api.fir.utils.firRef import org.jetbrains.kotlin.idea.frontend.api.symbols.* import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtAnnotatedSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtCommonSymbolModality import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolVisibility -import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithVisibility import org.jetbrains.kotlin.lexer.KtTokens -import org.jetbrains.kotlin.psi.* +import org.jetbrains.kotlin.psi.KtClassOrObject +import org.jetbrains.kotlin.psi.KtCodeFragment +import org.jetbrains.kotlin.psi.KtEnumEntry +import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.psiUtil.containingClass -import org.jetbrains.kotlin.psi.psiUtil.isLambdaOutsideParentheses import org.jetbrains.kotlin.psi.psiUtil.isObjectLiteral -import org.jetbrains.kotlin.util.containingNonLocalDeclaration import java.util.* fun getOrCreateFirLightClass(classOrObject: KtClassOrObject): KtLightClass? = @@ -199,6 +194,7 @@ internal fun FirLightClassBase.createMethods( internal fun FirLightClassBase.createFields( declarations: Sequence, + usedNames: MutableSet, isTopLevel: Boolean, result: MutableList ) { @@ -211,7 +207,6 @@ internal fun FirLightClassBase.createFields( return property.hasBackingField } - //TODO isHiddenByDeprecation for (declaration in declarations) { if (declaration !is KtPropertySymbol) continue if (!hasBackingField(declaration)) continue @@ -219,6 +214,7 @@ internal fun FirLightClassBase.createFields( result.add( FirLightFieldForPropertySymbol( propertySymbol = declaration, + usedNames = usedNames, containingClass = this@createFields, lightMemberOrigin = null, isTopLevel = isTopLevel diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt index 57b4f436964..7ff8c9546b7 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt @@ -16,12 +16,15 @@ import org.jetbrains.kotlin.psi.KtDeclaration internal class FirLightFieldForPropertySymbol( private val propertySymbol: KtPropertySymbol, + usedNames: MutableSet, containingClass: FirLightClassBase, lightMemberOrigin: LightMemberOrigin?, isTopLevel: Boolean, forceStatic: Boolean = false ) : FirLightField(containingClass, lightMemberOrigin) { + private val _name: String = generateUniqueFieldName(usedNames, propertySymbol.name.asString()) + override val kotlinOrigin: KtDeclaration? = propertySymbol.psi as? KtDeclaration private val _returnedType: PsiType by lazyPub { @@ -46,7 +49,6 @@ internal class FirLightFieldForPropertySymbol( override fun getType(): PsiType = _returnedType - private val _name = propertySymbol.name.asString() override fun getName(): String = _name private val _modifierList: PsiModifierList by lazyPub { @@ -105,4 +107,16 @@ internal class FirLightFieldForPropertySymbol( propertySymbol == other.propertySymbol) override fun hashCode(): Int = kotlinOrigin.hashCode() + + companion object { + private fun generateUniqueFieldName(usedNames: MutableSet, base: String): String { + if (usedNames.add(base)) return base + var i = 1 + while (true) { + val suggestion = "$base$$i" + if (usedNames.add(suggestion)) return suggestion + i++ + } + } + } } \ No newline at end of file From 563066732022136f2954b70f5399256856d55af5 Mon Sep 17 00:00:00 2001 From: Igor Yakovlev Date: Tue, 24 Nov 2020 00:56:50 +0300 Subject: [PATCH 386/698] [FIR IDE] LC better support for JvmMultiFileClass annotation --- .../asJava/lightClasses/facades/MultiFile.kt | 2 + .../asJava/annotations/annotationsUtils.kt | 11 +++- .../asJava/classes/FirLightClassForFacade.kt | 57 +++++++------------ 3 files changed, 31 insertions(+), 39 deletions(-) diff --git a/compiler/testData/asJava/lightClasses/facades/MultiFile.kt b/compiler/testData/asJava/lightClasses/facades/MultiFile.kt index a1b02f37ab1..3971075b6b4 100644 --- a/compiler/testData/asJava/lightClasses/facades/MultiFile.kt +++ b/compiler/testData/asJava/lightClasses/facades/MultiFile.kt @@ -8,3 +8,5 @@ package test val foo = 42 typealias A = String + +// FIR_COMPARISON \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/annotationsUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/annotationsUtils.kt index d46cfe385b9..2a48a8ec550 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/annotationsUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/annotationsUtils.kt @@ -23,6 +23,8 @@ import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirSymbol import org.jetbrains.kotlin.idea.frontend.api.fir.utils.mapAnnotationParameters import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtAnnotatedSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSimpleConstantValue +import org.jetbrains.kotlin.psi.KtAnnotationUseSiteTarget +import org.jetbrains.kotlin.psi.KtFile internal fun KtAnnotatedSymbol.hasJvmSyntheticAnnotation(annotationUseSiteTarget: AnnotationUseSiteTarget?): Boolean = hasAnnotation("kotlin/jvm/JvmSynthetic", annotationUseSiteTarget) @@ -125,4 +127,11 @@ internal fun KtAnnotatedSymbol.computeAnnotations( } return result -} \ No newline at end of file +} + +internal fun KtFile.hasJvmMultifileClassAnnotation(): Boolean = this.annotationEntries + .filter { + it.useSiteTarget?.getAnnotationUseSiteTarget() == AnnotationUseSiteTarget.FILE + }.any { + it.shortName?.asString() == "JvmMultifileClass" + } \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt index bc4ea6706e4..52ee3e692a2 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt @@ -20,18 +20,18 @@ import org.jetbrains.kotlin.asJava.classes.lazyPub import org.jetbrains.kotlin.asJava.elements.FakeFileForLightClass import org.jetbrains.kotlin.asJava.elements.KtLightField import org.jetbrains.kotlin.asJava.elements.KtLightMethod -import org.jetbrains.kotlin.fir.declarations.FirProperty -import org.jetbrains.kotlin.fir.declarations.isConst import org.jetbrains.kotlin.idea.KotlinLanguage import org.jetbrains.kotlin.idea.asJava.classes.createFields import org.jetbrains.kotlin.idea.asJava.classes.createMethods import org.jetbrains.kotlin.idea.frontend.api.analyze import org.jetbrains.kotlin.idea.frontend.api.symbols.KtCallableSymbol +import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.load.java.structure.LightClassOriginKind import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.psi.KtClassOrObject import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.KtNamedDeclaration +import org.jetbrains.kotlin.psi.KtProperty import org.jetbrains.kotlin.psi.psiUtil.isPrivate class FirLightClassForFacade( @@ -40,33 +40,22 @@ class FirLightClassForFacade( private val files: Collection ) : FirLightClassBase(manager) { - override val clsDelegate: PsiClass get() = invalidAccess() - - private val isMultiFileClass: Boolean by lazyPub { - files.size > 1 || files.any { - JvmFileClassUtil.findAnnotationEntryOnFileNoResolve( - file = it, - shortName = JvmFileClassUtil.JVM_MULTIFILE_CLASS_SHORT - ) != null - } + init { + require(files.isNotEmpty()) } + private val firstFileInFacade by lazyPub { files.first() } + + override val clsDelegate: PsiClass get() = invalidAccess() + private val _modifierList: PsiModifierList by lazyPub { - if (isMultiFileClass) + if (multiFileClass) return@lazyPub LightModifierList(manager, KotlinLanguage.INSTANCE, PsiModifier.PUBLIC, PsiModifier.FINAL) val modifiers = setOf(PsiModifier.PUBLIC, PsiModifier.FINAL) -// val annotations = files.flatMap { file -> -// file.withFir> { -// computeAnnotations( -// parent = this@FirLightClassForFacade, -// nullability = ConeNullability.UNKNOWN, -// annotationUseSiteTarget = AnnotationUseSiteTarget.FILE -// ) -// } -// } - val annotations = emptyList() //TODO + //TODO make annotations for file site + val annotations: List = emptyList() FirLightClassModifierList(this@FirLightClassForFacade, modifiers, annotations) } @@ -79,7 +68,6 @@ class FirLightClassForFacade( file: KtFile, result: MutableList ) { - //it.isHiddenByDeprecation(support) val declarations = file.declarations .filterIsInstance() .filterNot { multiFileClass && it.isPrivate() } @@ -104,12 +92,7 @@ class FirLightClassForFacade( } private val multiFileClass: Boolean by lazyPub { - false //TODO -// files.any { -// it.withFir { -// this.hasAnnotation(JvmFileClassUtil.JVM_MULTIFILE_CLASS.asString()) -// } -// } + files.size > 1 || files.any { it.hasJvmMultifileClassAnnotation() } } private fun loadFieldsFromFile( @@ -117,16 +100,16 @@ class FirLightClassForFacade( usedFieldNames: MutableSet, result: MutableList ) { + val properties = file.declarations + .filterIsInstance() + .applyIf(multiFileClass) { + filter { it.hasModifier(KtTokens.CONST_KEYWORD) } + } - //it.isHiddenByDeprecation(support) - val declarations = file.declarations - .filterIsInstance() - .filterNot { multiFileClass && it is FirProperty && it.isConst } - - if (declarations.isEmpty()) return + if (properties.isEmpty()) return val symbols = analyze(file) { - declarations.mapNotNull { + properties.mapNotNull { it.getSymbol() as? KtCallableSymbol } } @@ -150,8 +133,6 @@ class FirLightClassForFacade( override fun copy(): FirLightClassForFacade = FirLightClassForFacade(manager, facadeClassFqName, files) - private val firstFileInFacade by lazyPub { files.iterator().next() } - private val packageFqName: FqName = facadeClassFqName.parent() From a1603716ed72fe66678f799c3ef8b8148a680c06 Mon Sep 17 00:00:00 2001 From: Igor Yakovlev Date: Wed, 25 Nov 2020 12:47:48 +0300 Subject: [PATCH 387/698] [FIR IDE] LC Add anonymous objects support +minor fixes --- .../idea/frontend/api/KtAnalysisSession.kt | 2 + .../api/symbols/KtAnonymousObjectSymbol.kt | 18 +++ .../frontend/api/symbols/KtSymbolProvider.kt | 6 +- .../api/symbols/KtVariableLikeSymbol.kt | 2 + .../level/api/FirModuleResolveStateImpl.kt | 6 +- .../FirLightAnnotationForAnnotationCall.kt | 36 +---- .../asJava/annotations/annotationsUtils.kt | 8 - .../classes/FirLightAnnotationClassSymbol.kt | 5 +- .../FirLightAnonymousClassForSymbol.kt | 144 ++++++++++++++++++ .../FirLightClassForClassOrObjectSymbol.kt | 55 ++----- .../asJava/classes/FirLightClassForFacade.kt | 26 +++- .../asJava/classes/FirLightClassForSymbol.kt | 115 +++++++++----- .../classes/FirLightInterfaceClassSymbol.kt | 4 +- ...irLightInterfaceOrAnnotationClassSymbol.kt | 6 +- .../idea/asJava/classes/firLightClassUtils.kt | 108 ++++++++++--- .../idea/asJava/fields/FirLightField.kt | 14 ++ .../fields/FirLightFieldForObjectSymbol.kt | 8 +- .../fields/FirLightFieldForPropertySymbol.kt | 30 ++-- .../kotlin/idea/asJava/firLightUtils.kt | 99 +++++++++--- .../frontend/api/fir/KtSymbolByFirBuilder.kt | 7 +- .../api/fir/components/KtFirScopeProvider.kt | 2 + .../fir/symbols/KtFirAnonymousObjectSymbol.kt | 51 +++++++ .../api/fir/symbols/KtFirPropertySymbol.kt | 8 +- .../api/fir/symbols/KtFirSymbolProvider.kt | 7 + .../idea/frontend/api/fir/utils/firUtils.kt | 2 +- .../testData/symbolsByPsi/anonymousObject.kt | 91 +++++++++++ .../SymbolsByPsiBuildingTestGenerated.java | 5 + 27 files changed, 657 insertions(+), 208 deletions(-) create mode 100644 idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtAnonymousObjectSymbol.kt create mode 100644 idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightAnonymousClassForSymbol.kt create mode 100644 idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirAnonymousObjectSymbol.kt create mode 100644 idea/idea-frontend-fir/testData/symbolsByPsi/anonymousObject.kt diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt index f1b28a246e1..6c90bb22adb 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt @@ -103,6 +103,8 @@ abstract class KtAnalysisSession(override val token: ValidityToken) : ValidityTo fun KtProperty.getVariableSymbol(): KtVariableSymbol = symbolProvider.getVariableSymbol(this) + fun KtObjectLiteralExpression.getAnonymousObjectSymbol(): KtAnonymousObjectSymbol = symbolProvider.getAnonymousObjectSymbol(this) + fun KtClassOrObject.getClassOrObjectSymbol(): KtClassOrObjectSymbol = symbolProvider.getClassOrObjectSymbol(this) fun KtPropertyAccessor.getPropertyAccessorSymbol(): KtPropertyAccessorSymbol = symbolProvider.getPropertyAccessorSymbol(this) diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtAnonymousObjectSymbol.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtAnonymousObjectSymbol.kt new file mode 100644 index 00000000000..f2376418551 --- /dev/null +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtAnonymousObjectSymbol.kt @@ -0,0 +1,18 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.frontend.api.symbols + +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtAnnotatedSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithDeclarations +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithKind +import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtSymbolPointer +import org.jetbrains.kotlin.idea.frontend.api.types.KtType + +abstract class KtAnonymousObjectSymbol : KtSymbolWithKind, KtAnnotatedSymbol, KtSymbolWithDeclarations { + abstract val superTypes: List + + abstract override fun createPointer(): KtSymbolPointer +} \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtSymbolProvider.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtSymbolProvider.kt index 308f0ea0e87..cbb9955aeb7 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtSymbolProvider.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtSymbolProvider.kt @@ -21,7 +21,10 @@ abstract class KtSymbolProvider : KtAnalysisSessionComponent() { is KtEnumEntry -> getEnumEntrySymbol(psi) is KtLambdaExpression -> getAnonymousFunctionSymbol(psi) is KtProperty -> getVariableSymbol(psi) - is KtClassOrObject -> getClassOrObjectSymbol(psi) + is KtClassOrObject -> { + val literalExpression = (psi as? KtObjectDeclaration)?.parent as? KtObjectLiteralExpression + literalExpression?.let(::getAnonymousObjectSymbol) ?: getClassOrObjectSymbol(psi) + } is KtPropertyAccessor -> getPropertyAccessorSymbol(psi) else -> error("Cannot build symbol for ${psi::class}") } @@ -35,6 +38,7 @@ abstract class KtSymbolProvider : KtAnalysisSessionComponent() { abstract fun getAnonymousFunctionSymbol(psi: KtNamedFunction): KtAnonymousFunctionSymbol abstract fun getAnonymousFunctionSymbol(psi: KtLambdaExpression): KtAnonymousFunctionSymbol abstract fun getVariableSymbol(psi: KtProperty): KtVariableSymbol + abstract fun getAnonymousObjectSymbol(psi: KtObjectLiteralExpression): KtAnonymousObjectSymbol abstract fun getClassOrObjectSymbol(psi: KtClassOrObject): KtClassOrObjectSymbol abstract fun getPropertyAccessorSymbol(psi: KtPropertyAccessor): KtPropertyAccessorSymbol diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtVariableLikeSymbol.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtVariableLikeSymbol.kt index 894ec2ed04d..e3bb6fed783 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtVariableLikeSymbol.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtVariableLikeSymbol.kt @@ -59,6 +59,8 @@ abstract class KtPropertySymbol : KtVariableSymbol(), abstract val isOverride: Boolean + abstract val initializer: KtConstantValue? + abstract override fun createPointer(): KtSymbolPointer } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/FirModuleResolveStateImpl.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/FirModuleResolveStateImpl.kt index 0fe9d4fda11..6abf1c19627 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/FirModuleResolveStateImpl.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/FirModuleResolveStateImpl.kt @@ -13,6 +13,7 @@ import org.jetbrains.kotlin.fir.declarations.FirDeclaration import org.jetbrains.kotlin.fir.declarations.FirFile import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.fir.psi +import org.jetbrains.kotlin.fir.realPsi import org.jetbrains.kotlin.fir.resolve.providers.FirProvider import org.jetbrains.kotlin.idea.caches.project.IdeaModuleInfo import org.jetbrains.kotlin.idea.caches.project.ModuleSourceInfo @@ -106,7 +107,10 @@ internal class FirModuleResolveStateImpl( firLazyDeclarationResolver.lazyResolveDeclaration(container, cache, FirResolvePhase.BODY_RESOLVE, checkPCE = false /*TODO*/) } val firDeclaration = FirElementFinder.findElementIn(container) { firDeclaration -> - firDeclaration.psi == ktDeclaration + when (val realPsi = firDeclaration.realPsi) { + is KtObjectLiteralExpression -> realPsi.objectDeclaration == ktDeclaration + else -> realPsi == ktDeclaration + } } return firDeclaration ?: error("FirDeclaration was not found for\n${ktDeclaration.getElementTextInContext()}") diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/FirLightAnnotationForAnnotationCall.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/FirLightAnnotationForAnnotationCall.kt index 19e5d90a6f0..496a9dfa09f 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/FirLightAnnotationForAnnotationCall.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/FirLightAnnotationForAnnotationCall.kt @@ -7,10 +7,8 @@ package org.jetbrains.kotlin.idea.asJava import com.intellij.psi.* import com.intellij.psi.impl.PsiImplUtil -import com.intellij.util.IncorrectOperationException import org.jetbrains.kotlin.asJava.classes.* import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtAnnotationCall -import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSimpleConstantValue import org.jetbrains.kotlin.psi.KtCallElement internal class FirLightAnnotationForAnnotationCall( @@ -46,36 +44,4 @@ internal class FirLightAnnotationForAnnotationCall( override fun isEquivalentTo(another: PsiElement?): Boolean = basicIsEquivalentTo(this, another as? PsiAnnotation) -} - -private fun escapeString(str: String): String = buildString { - str.forEach { char -> - val escaped = when (char) { - '\n' -> "\\n" - '\r' -> "\\r" - '\t' -> "\\t" - '\"' -> "\\\"" - '\\' -> "\\\\" - else -> "$char" - } - append(escaped) - } -} - -private fun KtSimpleConstantValue<*>.asStringForPsiLiteral(parent: PsiElement): String = - when (val value = this.constant) { - is String -> "\"${escapeString(value)}\"" - is Long -> "${value}L" - is Float -> "${value}f" - else -> value?.toString() ?: "null" - } - -internal fun KtSimpleConstantValue<*>.createPsiLiteral(parent: PsiElement): PsiExpression? { - val asString = asStringForPsiLiteral(parent) - val instance = PsiElementFactory.getInstance(parent.project) - return try { - instance.createExpressionFromText(asString, parent) - } catch (_: IncorrectOperationException) { - null - } -} +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/annotationsUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/annotationsUtils.kt index 2a48a8ec550..a150a9ff1c2 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/annotationsUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/annotationsUtils.kt @@ -10,20 +10,14 @@ import com.intellij.psi.PsiElement import org.jetbrains.annotations.NotNull import org.jetbrains.annotations.Nullable import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget -import org.jetbrains.kotlin.fir.FirSymbolOwner import org.jetbrains.kotlin.fir.declarations.FirAnnotatedDeclaration import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.references.FirNamedReference -import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference -import org.jetbrains.kotlin.fir.references.impl.FirSimpleNamedReference -import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol -import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirAnnotationCall import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirSymbol import org.jetbrains.kotlin.idea.frontend.api.fir.utils.mapAnnotationParameters import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtAnnotatedSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSimpleConstantValue -import org.jetbrains.kotlin.psi.KtAnnotationUseSiteTarget import org.jetbrains.kotlin.psi.KtFile internal fun KtAnnotatedSymbol.hasJvmSyntheticAnnotation(annotationUseSiteTarget: AnnotationUseSiteTarget?): Boolean = @@ -42,8 +36,6 @@ internal fun KtAnnotatedSymbol.getJvmNameFromAnnotation(annotationUseSiteTarget: } internal fun KtAnnotatedSymbol.isHiddenByDeprecation(annotationUseSiteTarget: AnnotationUseSiteTarget?): Boolean { - - //TODO Move it to HL API require(this is KtFirSymbol<*>) return this.firRef.withFir(FirResolvePhase.TYPES) { diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightAnnotationClassSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightAnnotationClassSymbol.kt index 3e74e931ff1..9c21a75b77c 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightAnnotationClassSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightAnnotationClassSymbol.kt @@ -31,16 +31,15 @@ internal class FirLightAnnotationClassSymbol( override fun isAnnotationType(): Boolean = true private val _ownFields: List by lazyPub { -//TODO mutableListOf().also { - it.addCompanionObjectFieldIfNeeded() + addCompanionObjectFieldIfNeeded(it) } } override fun getOwnFields(): List = _ownFields private val _ownMethods: List by lazyPub { -//TODO + val result = mutableListOf() analyzeWithSymbolAsContext(classOrObjectSymbol) { diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightAnonymousClassForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightAnonymousClassForSymbol.kt new file mode 100644 index 00000000000..7144e063f74 --- /dev/null +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightAnonymousClassForSymbol.kt @@ -0,0 +1,144 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.asJava.classes + +import com.intellij.psi.* +import com.intellij.psi.impl.InheritanceImplUtil +import com.intellij.psi.impl.PsiClassImplUtil +import com.intellij.psi.search.SearchScope +import com.intellij.psi.stubs.IStubElementType +import com.intellij.psi.stubs.StubElement +import org.jetbrains.kotlin.asJava.classes.lazyPub +import org.jetbrains.kotlin.asJava.elements.KtLightField +import org.jetbrains.kotlin.asJava.elements.KtLightIdentifier +import org.jetbrains.kotlin.asJava.elements.KtLightMethod +import org.jetbrains.kotlin.idea.asJava.FirLightClassBase +import org.jetbrains.kotlin.idea.asJava.FirLightClassForSymbol +import org.jetbrains.kotlin.idea.asJava.FirLightField +import org.jetbrains.kotlin.idea.asJava.hasJvmFieldAnnotation +import org.jetbrains.kotlin.idea.frontend.api.fir.analyzeWithSymbolAsContext +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtAnonymousObjectSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertySymbol +import org.jetbrains.kotlin.load.java.structure.LightClassOriginKind +import org.jetbrains.kotlin.psi.KtClassOrObject +import org.jetbrains.kotlin.psi.debugText.getDebugText +import org.jetbrains.kotlin.psi.stubs.KotlinClassOrObjectStub + +internal class FirLightAnonymousClassForSymbol( + private val anonymousObjectSymbol: KtAnonymousObjectSymbol, + manager: PsiManager +) : FirLightClassBase(manager), + StubBasedPsiElement>, PsiAnonymousClass { + + private val _baseClassType: PsiClassType by lazyPub { + extendsListTypes.firstOrNull() + ?: implementsListTypes.firstOrNull() + ?: PsiType.getJavaLangObject(manager, resolveScope) + } + + override fun getBaseClassReference(): PsiJavaCodeReferenceElement = + JavaPsiFacade.getElementFactory(manager.project).createReferenceElementByType(baseClassType) + + override fun getBaseClassType(): PsiClassType = _baseClassType + + private val _extendsList by lazyPub { createInheritanceList(forExtendsList = true, anonymousObjectSymbol.superTypes) } + private val _implementsList by lazyPub { createInheritanceList(forExtendsList = false, anonymousObjectSymbol.superTypes) } + + override fun getExtendsList(): PsiReferenceList? = _extendsList + override fun getImplementsList(): PsiReferenceList? = _implementsList + + override fun getOwnFields(): List = _ownFields + override fun getOwnMethods(): List = _ownMethods + + + private val _ownMethods: List by lazyPub { + + val result = mutableListOf() + + analyzeWithSymbolAsContext(anonymousObjectSymbol) { + val callableSymbols = anonymousObjectSymbol.getDeclaredMemberScope().getCallableSymbols() + createMethods(callableSymbols, isTopLevel = false, result) + } + + result + } + + private val _ownFields: List by lazyPub { + val result = mutableListOf() + val nameGenerator = FirLightField.FieldNameGenerator() + + analyzeWithSymbolAsContext(anonymousObjectSymbol) { + anonymousObjectSymbol.getDeclaredMemberScope().getCallableSymbols() + .filterIsInstance() + .forEach { propertySymbol -> + createField( + propertySymbol, + nameGenerator, + isTopLevel = false, + forceStatic = false, + takePropertyVisibility = propertySymbol.hasJvmFieldAnnotation(), + result + ) + } + } + + result + } + + private val _ownInnerClasses: List by lazyPub { + anonymousObjectSymbol.createInnerClasses(manager) + } + + override fun getOwnInnerClasses(): List = _ownInnerClasses + + override fun getScope(): PsiElement? = parent + override fun getInterfaces(): Array = PsiClassImplUtil.getInterfaces(this) + override fun getSuperClass(): PsiClass? = PsiClassImplUtil.getSuperClass(this) + override fun getSupers(): Array = PsiClassImplUtil.getSupers(this) + override fun getSuperTypes(): Array = PsiClassImplUtil.getSuperTypes(this) + override fun isInheritor(baseClass: PsiClass, checkDeep: Boolean): Boolean = + InheritanceImplUtil.isInheritor(this, baseClass, checkDeep) + + override fun isInheritorDeep(baseClass: PsiClass?, classToByPass: PsiClass?): Boolean = + baseClass?.let { InheritanceImplUtil.isInheritorDeep(this, it, classToByPass) } ?: false + + override val kotlinOrigin: KtClassOrObject? = anonymousObjectSymbol.psi as? KtClassOrObject + + override val originKind: LightClassOriginKind + get() = LightClassOriginKind.SOURCE + + override fun getArgumentList(): PsiExpressionList? = null + override fun isInQualifiedNew(): Boolean = false + override fun getName(): String? = null + override fun getNameIdentifier(): KtLightIdentifier? = null + override fun getModifierList(): PsiModifierList? = null + override fun hasModifierProperty(name: String): Boolean = name == PsiModifier.FINAL + override fun getContainingClass(): PsiClass? = null + override fun isDeprecated(): Boolean = false //TODO + override fun getTypeParameters(): Array = PsiTypeParameter.EMPTY_ARRAY + override fun isInterface() = false + override fun isAnnotationType() = false + override fun getTypeParameterList(): PsiTypeParameterList? = null + override fun getQualifiedName(): String? = null + override fun isEnum() = false + override fun getUseScope(): SearchScope = kotlinOrigin?.useScope ?: TODO() + override fun getElementType(): IStubElementType, *>? = kotlinOrigin?.elementType + override fun getStub(): KotlinClassOrObjectStub? = kotlinOrigin?.stub + + override fun isEquivalentTo(another: PsiElement?): Boolean = equals(another) //TODO + + override fun equals(other: Any?): Boolean = + this === other || + (other is FirLightAnonymousClassForSymbol && anonymousObjectSymbol == other.anonymousObjectSymbol) + + override fun hashCode(): Int = anonymousObjectSymbol.hashCode() + + override fun copy() = + FirLightAnonymousClassForSymbol(anonymousObjectSymbol, manager) + + override fun toString() = + "${this::class.java.simpleName}:${kotlinOrigin?.getDebugText()}" +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForClassOrObjectSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForClassOrObjectSymbol.kt index dd0a31ffe6e..1bcd44dd548 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForClassOrObjectSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForClassOrObjectSymbol.kt @@ -13,18 +13,15 @@ import com.intellij.psi.search.SearchScope import com.intellij.psi.stubs.IStubElementType import com.intellij.psi.stubs.StubElement import org.jetbrains.annotations.NonNls -import org.jetbrains.kotlin.asJava.classes.KotlinSuperTypeListBuilder import org.jetbrains.kotlin.asJava.classes.getOutermostClassOrObject import org.jetbrains.kotlin.asJava.classes.lazyPub import org.jetbrains.kotlin.asJava.elements.FirLightIdentifier import org.jetbrains.kotlin.asJava.elements.KtLightField -import org.jetbrains.kotlin.fir.symbols.StandardClassIds import org.jetbrains.kotlin.idea.asJava.classes.getOrCreateFirLightClass import org.jetbrains.kotlin.idea.asJava.elements.FirLightTypeParameterListForSymbol +import org.jetbrains.kotlin.idea.frontend.api.fir.analyzeWithSymbolAsContext import org.jetbrains.kotlin.idea.frontend.api.symbols.* import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolKind -import org.jetbrains.kotlin.idea.frontend.api.types.KtClassType -import org.jetbrains.kotlin.idea.frontend.api.types.KtType import org.jetbrains.kotlin.idea.util.ifFalse import org.jetbrains.kotlin.idea.util.ifTrue import org.jetbrains.kotlin.load.java.structure.LightClassOriginKind @@ -61,7 +58,6 @@ internal abstract class FirLightClassForClassOrObjectSymbol( abstract override fun getExtendsList(): PsiReferenceList? abstract override fun getImplementsList(): PsiReferenceList? - private val _typeParameterList: PsiTypeParameterList? by lazyPub { hasTypeParameters().ifTrue { val shiftCount = classOrObjectSymbol.isInner.ifTrue { @@ -90,45 +86,16 @@ internal abstract class FirLightClassForClassOrObjectSymbol( override fun isWritable() = false override val kotlinOrigin: KtClassOrObject? = classOrObjectSymbol.psi as? KtClassOrObject - protected fun createInheritanceList(forExtendsList: Boolean): PsiReferenceList { - - val role = if (forExtendsList) PsiReferenceList.Role.EXTENDS_LIST else PsiReferenceList.Role.IMPLEMENTS_LIST - - val listBuilder = KotlinSuperTypeListBuilder( - kotlinOrigin = kotlinOrigin?.getSuperTypeList(), - manager = manager, - language = language, - role = role - ) - - fun KtType.needToAddTypeIntoList(): Boolean { - if (this !is KtClassType) return false - - // Do not add redundant "extends java.lang.Object" anywhere - if (this.classId == StandardClassIds.Any) return false - - // We don't have Enum among enums supertype in sources neither we do for decompiled class-files and light-classes - if (isEnum && this.classId == StandardClassIds.Enum) return false - - val isInterfaceType = - (this.classSymbol as? KtClassOrObjectSymbol)?.classKind == KtClassKind.INTERFACE - - return forExtendsList == !isInterfaceType - } - - //TODO Add support for kotlin.collections. - classOrObjectSymbol.superTypes - .filterIsInstance() - .filter { it.needToAddTypeIntoList() } - .mapNotNull { it.mapSupertype(this, kotlinCollectionAsIs = true) } - .forEach { listBuilder.addReference(it) } - - return listBuilder - } - - protected fun MutableList.addCompanionObjectFieldIfNeeded() { + protected fun addCompanionObjectFieldIfNeeded(result: MutableList) { classOrObjectSymbol.companionObject?.run { - add(FirLightFieldForObjectSymbol(this, this@FirLightClassForClassOrObjectSymbol, null)) + result.add( + FirLightFieldForObjectSymbol( + objectSymbol = this, + containingClass = this@FirLightClassForClassOrObjectSymbol, + name = name.asString(), + lightMemberOrigin = null + ) + ) } } @@ -153,7 +120,7 @@ internal abstract class FirLightClassForClassOrObjectSymbol( abstract override fun hashCode(): Int - override fun getName(): String = classOrObjectSymbol.name.asString() + override fun getName(): String? = classOrObjectSymbol.name.asString() override fun hasModifierProperty(@NonNls name: String): Boolean = modifierList?.hasModifierProperty(name) ?: false diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt index 52ee3e692a2..47bb64d8140 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt @@ -21,10 +21,11 @@ import org.jetbrains.kotlin.asJava.elements.FakeFileForLightClass import org.jetbrains.kotlin.asJava.elements.KtLightField import org.jetbrains.kotlin.asJava.elements.KtLightMethod import org.jetbrains.kotlin.idea.KotlinLanguage -import org.jetbrains.kotlin.idea.asJava.classes.createFields +import org.jetbrains.kotlin.idea.asJava.classes.createField import org.jetbrains.kotlin.idea.asJava.classes.createMethods import org.jetbrains.kotlin.idea.frontend.api.analyze import org.jetbrains.kotlin.idea.frontend.api.symbols.KtCallableSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertySymbol import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.load.java.structure.LightClassOriginKind import org.jetbrains.kotlin.name.FqName @@ -97,7 +98,7 @@ class FirLightClassForFacade( private fun loadFieldsFromFile( file: KtFile, - usedFieldNames: MutableSet, + nameGenerator: FirLightField.FieldNameGenerator, result: MutableList ) { val properties = file.declarations @@ -108,20 +109,31 @@ class FirLightClassForFacade( if (properties.isEmpty()) return - val symbols = analyze(file) { + val propertySymbols = analyze(file) { properties.mapNotNull { - it.getSymbol() as? KtCallableSymbol + it.getSymbol() as? KtPropertySymbol } } - createFields(symbols.asSequence(), usedFieldNames, isTopLevel = true, result) + for (propertySymbol in propertySymbols) { + val forceStaticAndPropertyVisibility = propertySymbol.hasJvmStaticAnnotation() + createField( + propertySymbol, + nameGenerator, + isTopLevel = true, + forceStatic = forceStaticAndPropertyVisibility, + takePropertyVisibility = forceStaticAndPropertyVisibility, + result + ) + } + } private val _ownFields: List by lazyPub { val result = mutableListOf() - val usedFieldNames = mutableSetOf() + val nameGenerator = FirLightField.FieldNameGenerator() for (file in files) { - loadFieldsFromFile(file, usedFieldNames, result) + loadFieldsFromFile(file, nameGenerator, result) } result } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt index 0a1db55e788..1388a8dcfee 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt @@ -10,7 +10,9 @@ import org.jetbrains.kotlin.asJava.classes.METHOD_INDEX_FOR_DEFAULT_CTOR import org.jetbrains.kotlin.asJava.classes.lazyPub import org.jetbrains.kotlin.asJava.elements.KtLightField import org.jetbrains.kotlin.asJava.elements.KtLightMethod -import org.jetbrains.kotlin.idea.asJava.classes.createFields +import org.jetbrains.kotlin.idea.asJava.classes.* +import org.jetbrains.kotlin.idea.asJava.classes.createInheritanceList +import org.jetbrains.kotlin.idea.asJava.classes.createInnerClasses import org.jetbrains.kotlin.idea.asJava.classes.createMethods import org.jetbrains.kotlin.idea.asJava.fields.FirLightFieldForEnumEntry import org.jetbrains.kotlin.idea.frontend.api.fir.analyzeWithSymbolAsContext @@ -19,7 +21,7 @@ import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolKind import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolVisibility import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithVisibility -internal class FirLightClassForSymbol( +internal open class FirLightClassForSymbol( private val classOrObjectSymbol: KtClassOrObjectSymbol, manager: PsiManager ) : FirLightClassForClassOrObjectSymbol(classOrObjectSymbol, manager) { @@ -73,28 +75,14 @@ internal class FirLightClassForSymbol( override fun getExtendsList(): PsiReferenceList? = _extendsList override fun getImplementsList(): PsiReferenceList? = _implementsList - override fun getOwnInnerClasses(): List { - val result = ArrayList() - - // workaround for ClassInnerStuffCache not supporting classes with null names, see KT-13927 - // inner classes with null names can't be searched for and can't be used from java anyway - // we can't prohibit creating light classes with null names either since they can contain members - - analyzeWithSymbolAsContext(classOrObjectSymbol) { - classOrObjectSymbol.getDeclaredMemberScope().getAllSymbols().filterIsInstance().mapTo(result) { - FirLightClassForSymbol(it, manager) - } - } - - //TODO - //if (classOrObject.hasInterfaceDefaultImpls) { - // result.add(KtLightClassForInterfaceDefaultImpls(classOrObject)) - //} - return result + private val _ownInnerClasses: List by lazyPub { + classOrObjectSymbol.createInnerClasses(manager) } - private val _extendsList by lazyPub { createInheritanceList(forExtendsList = true) } - private val _implementsList by lazyPub { createInheritanceList(forExtendsList = false) } + override fun getOwnInnerClasses(): List = _ownInnerClasses + + private val _extendsList by lazyPub { createInheritanceList(forExtendsList = true, classOrObjectSymbol.superTypes) } + private val _implementsList by lazyPub { createInheritanceList(forExtendsList = false, classOrObjectSymbol.superTypes) } private val _ownMethods: List by lazyPub { @@ -106,6 +94,10 @@ internal class FirLightClassForSymbol( filterNot { function -> function is KtFunctionSymbol && function.name.asString().let { it == "values" || it == "valueOf" } } + }.applyIf(classOrObjectSymbol.classKind == KtClassKind.OBJECT) { + filterNot { + it is KtPropertySymbol && it.isConst + } } createMethods(visibleDeclarations, isTopLevel = false, result) @@ -127,14 +119,7 @@ internal class FirLightClassForSymbol( result } - private val _ownFields: List by lazyPub { - - val result = mutableListOf() - - result.addCompanionObjectFieldIfNeeded() - - val usedNames = mutableSetOf() - + private fun addFieldsFromCompanionIfNeeded(result: MutableList, nameGenerator: FirLightField.FieldNameGenerator) { classOrObjectSymbol.companionObject?.run { analyzeWithSymbolAsContext(this) { getDeclaredMemberScope().getCallableSymbols() @@ -143,36 +128,96 @@ internal class FirLightClassForSymbol( .mapTo(result) { FirLightFieldForPropertySymbol( propertySymbol = it, - usedNames = usedNames, + nameGenerator = nameGenerator, containingClass = this@FirLightClassForSymbol, lightMemberOrigin = null, isTopLevel = false, - forceStatic = true + forceStatic = true, + takePropertyVisibility = true ) } } } + } + + private fun addObjectFields(result: MutableList, nameGenerator: FirLightField.FieldNameGenerator) { + analyzeWithSymbolAsContext(classOrObjectSymbol) { + classOrObjectSymbol.getDeclaredMemberScope().getAllSymbols() + .filterIsInstance() + .filter { it.classKind == KtClassKind.OBJECT } + .mapTo(result) { + FirLightFieldForObjectSymbol( + objectSymbol = it, + containingClass = this@FirLightClassForSymbol, + name = nameGenerator.generateUniqueFieldName(it.name.asString()), + lightMemberOrigin = null + ) + } + } + } + + private fun addInstanceFieldIfNeeded(result: MutableList) { val isNamedObject = classOrObjectSymbol.classKind == KtClassKind.OBJECT if (isNamedObject && classOrObjectSymbol.symbolKind != KtSymbolKind.LOCAL) { - result.add(FirLightFieldForObjectSymbol(classOrObjectSymbol, this@FirLightClassForSymbol, null)) + result.add( + FirLightFieldForObjectSymbol( + objectSymbol = classOrObjectSymbol, + containingClass = this@FirLightClassForSymbol, + name = "INSTANCE", + lightMemberOrigin = null + ) + ) } + } + private fun addPropertyBackingFields(result: MutableList, nameGenerator: FirLightField.FieldNameGenerator) { analyzeWithSymbolAsContext(classOrObjectSymbol) { val propertySymbols = classOrObjectSymbol.getDeclaredMemberScope().getCallableSymbols() .filterIsInstance() .applyIf(classOrObjectSymbol.classKind == KtClassKind.COMPANION_OBJECT) { filterNot { it.hasJvmFieldAnnotation() || it.isConst } } - createFields(propertySymbols, usedNames, isTopLevel = false, result) + + val isObject = classOrObjectSymbol.classKind == KtClassKind.OBJECT + + for (propertySymbol in propertySymbols) { + val isJvmStatic = propertySymbol.hasJvmStaticAnnotation() + val forceStatic = isObject || isJvmStatic + val takePropertyVisibility = (isObject && propertySymbol.isConst) || isJvmStatic + + createField( + declaration = propertySymbol, + nameGenerator = nameGenerator, + isTopLevel = false, + forceStatic = forceStatic, + takePropertyVisibility = takePropertyVisibility, + result = result + ) + } + + if (isEnum) { classOrObjectSymbol.getDeclaredMemberScope().getCallableSymbols() .filterIsInstance() .mapTo(result) { FirLightFieldForEnumEntry(it, this@FirLightClassForSymbol, null) } } - } + } + + private val _ownFields: List by lazyPub { + + val result = mutableListOf() + + addCompanionObjectFieldIfNeeded(result) + addInstanceFieldIfNeeded(result) + + val nameGenerator = FirLightField.FieldNameGenerator() + + addObjectFields(result, nameGenerator) + addFieldsFromCompanionIfNeeded(result, nameGenerator) + addPropertyBackingFields(result, nameGenerator) result } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightInterfaceClassSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightInterfaceClassSymbol.kt index 44a14f165de..34797721b82 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightInterfaceClassSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightInterfaceClassSymbol.kt @@ -29,7 +29,7 @@ internal class FirLightInterfaceClassSymbol( private val _ownFields: List by lazyPub { mutableListOf().also { - it.addCompanionObjectFieldIfNeeded() + addCompanionObjectFieldIfNeeded(it) } } @@ -62,7 +62,7 @@ internal class FirLightInterfaceClassSymbol( FirLightInterfaceClassSymbol(classOrObjectSymbol, manager) private val _extendsList: PsiReferenceList by lazyPub { - createInheritanceList(forExtendsList = false) + createInheritanceList(forExtendsList = false, classOrObjectSymbol.superTypes) } override fun getExtendsList(): PsiReferenceList? = _extendsList diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightInterfaceOrAnnotationClassSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightInterfaceOrAnnotationClassSymbol.kt index 77d9eafa9f1..400f73b6dc1 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightInterfaceOrAnnotationClassSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightInterfaceOrAnnotationClassSymbol.kt @@ -18,7 +18,11 @@ internal abstract class FirLightInterfaceOrAnnotationClassSymbol( ) : FirLightClassForClassOrObjectSymbol(classOrObjectSymbol, manager) { init { - require(classOrObjectSymbol.classKind == KtClassKind.INTERFACE || classOrObjectSymbol.classKind == KtClassKind.ANNOTATION_CLASS) + require( + classOrObjectSymbol.classKind == KtClassKind.OBJECT || + classOrObjectSymbol.classKind == KtClassKind.INTERFACE || + classOrObjectSymbol.classKind == KtClassKind.ANNOTATION_CLASS + ) } private val _modifierList: PsiModifierList? by lazyPub { diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt index 532f9f595dc..5ce844cb4f8 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt @@ -5,29 +5,33 @@ package org.jetbrains.kotlin.idea.asJava.classes +import com.intellij.psi.PsiManager +import com.intellij.psi.PsiReferenceList import com.intellij.psi.util.CachedValueProvider import com.intellij.psi.util.CachedValuesManager import org.jetbrains.kotlin.analyzer.KotlinModificationTrackerService +import org.jetbrains.kotlin.asJava.classes.KotlinSuperTypeListBuilder import org.jetbrains.kotlin.asJava.classes.KtLightClass import org.jetbrains.kotlin.asJava.classes.METHOD_INDEX_BASE import org.jetbrains.kotlin.asJava.classes.shouldNotBeVisibleAsLightClass import org.jetbrains.kotlin.asJava.elements.KtLightField import org.jetbrains.kotlin.asJava.elements.KtLightMethod import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget +import org.jetbrains.kotlin.fir.symbols.StandardClassIds import org.jetbrains.kotlin.idea.asJava.* import org.jetbrains.kotlin.idea.asJava.fields.FirLightFieldForEnumEntry import org.jetbrains.kotlin.idea.frontend.api.analyze +import org.jetbrains.kotlin.idea.frontend.api.fir.analyzeWithSymbolAsContext import org.jetbrains.kotlin.idea.frontend.api.symbols.* import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtAnnotatedSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtCommonSymbolModality import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolVisibility +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithDeclarations +import org.jetbrains.kotlin.idea.frontend.api.types.KtClassType +import org.jetbrains.kotlin.idea.frontend.api.types.KtType import org.jetbrains.kotlin.lexer.KtTokens -import org.jetbrains.kotlin.psi.KtClassOrObject -import org.jetbrains.kotlin.psi.KtCodeFragment -import org.jetbrains.kotlin.psi.KtEnumEntry -import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.containingClass -import org.jetbrains.kotlin.psi.psiUtil.isObjectLiteral import java.util.* fun getOrCreateFirLightClass(classOrObject: KtClassOrObject): KtLightClass? = @@ -53,10 +57,17 @@ fun createFirLightClassNoCache(classOrObject: KtClassOrObject): KtLightClass? { return null } + val anonymousObject = classOrObject.parent as? KtObjectLiteralExpression + if (anonymousObject != null) { + return analyze(anonymousObject) { + FirLightAnonymousClassForSymbol(anonymousObject.getAnonymousObjectSymbol(), anonymousObject.manager) + } + } + return when { classOrObject is KtEnumEntry -> lightClassForEnumEntry(classOrObject) - classOrObject.isObjectLiteral() -> return null //TODO classOrObject.hasModifier(KtTokens.INLINE_KEYWORD) -> return null //TODO + else -> { analyze(classOrObject) { val symbol = classOrObject.getClassOrObjectSymbol() @@ -192,10 +203,12 @@ internal fun FirLightClassBase.createMethods( } } -internal fun FirLightClassBase.createFields( - declarations: Sequence, - usedNames: MutableSet, +internal fun FirLightClassBase.createField( + declaration: KtPropertySymbol, + nameGenerator: FirLightField.FieldNameGenerator, isTopLevel: Boolean, + forceStatic: Boolean, + takePropertyVisibility: Boolean, result: MutableList ) { fun hasBackingField(property: KtPropertySymbol): Boolean { @@ -207,18 +220,73 @@ internal fun FirLightClassBase.createFields( return property.hasBackingField } - for (declaration in declarations) { - if (declaration !is KtPropertySymbol) continue - if (!hasBackingField(declaration)) continue + if (!hasBackingField(declaration)) return - result.add( - FirLightFieldForPropertySymbol( - propertySymbol = declaration, - usedNames = usedNames, - containingClass = this@createFields, - lightMemberOrigin = null, - isTopLevel = isTopLevel - ) + result.add( + FirLightFieldForPropertySymbol( + propertySymbol = declaration, + nameGenerator = nameGenerator, + containingClass = this, + lightMemberOrigin = null, + isTopLevel = isTopLevel, + forceStatic = forceStatic, + takePropertyVisibility = takePropertyVisibility ) + ) +} + +internal fun FirLightClassBase.createInheritanceList(forExtendsList: Boolean, superTypes: List): PsiReferenceList { + + val role = if (forExtendsList) PsiReferenceList.Role.EXTENDS_LIST else PsiReferenceList.Role.IMPLEMENTS_LIST + + val listBuilder = KotlinSuperTypeListBuilder( + kotlinOrigin = kotlinOrigin?.getSuperTypeList(), + manager = manager, + language = language, + role = role + ) + + fun KtType.needToAddTypeIntoList(): Boolean { + if (this !is KtClassType) return false + + // Do not add redundant "extends java.lang.Object" anywhere + if (this.classId == StandardClassIds.Any) return false + + // We don't have Enum among enums supertype in sources neither we do for decompiled class-files and light-classes + if (isEnum && this.classId == StandardClassIds.Enum) return false + + val isInterfaceType = + (this.classSymbol as? KtClassOrObjectSymbol)?.classKind == KtClassKind.INTERFACE + + return forExtendsList == !isInterfaceType } + + //TODO Add support for kotlin.collections. + superTypes + .filterIsInstance() + .filter { it.needToAddTypeIntoList() } + .mapNotNull { it.mapSupertype(this, kotlinCollectionAsIs = true) } + .forEach { listBuilder.addReference(it) } + + return listBuilder +} + +internal fun KtSymbolWithDeclarations.createInnerClasses(manager: PsiManager): List { + val result = ArrayList() + + // workaround for ClassInnerStuffCache not supporting classes with null names, see KT-13927 + // inner classes with null names can't be searched for and can't be used from java anyway + // we can't prohibit creating light classes with null names either since they can contain members + + analyzeWithSymbolAsContext(this) { + getDeclaredMemberScope().getAllSymbols().filterIsInstance().mapTo(result) { + FirLightClassForSymbol(it, manager) + } + } + + //TODO + //if (classOrObject.hasInterfaceDefaultImpls) { + // result.add(KtLightClassForInterfaceDefaultImpls(classOrObject)) + //} + return result } \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightField.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightField.kt index 8768cfcec55..bfd07121be4 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightField.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightField.kt @@ -80,4 +80,18 @@ internal abstract class FirLightField protected constructor( visitor.visitElement(this) } } + + internal class FieldNameGenerator { + private val usedNames: MutableSet = mutableSetOf() + + fun generateUniqueFieldName(base: String): String { + if (usedNames.add(base)) return base + var i = 1 + while (true) { + val suggestion = "$base$$i" + if (usedNames.add(suggestion)) return suggestion + i++ + } + } + } } \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForObjectSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForObjectSymbol.kt index f62b988b103..b78a4ea4f63 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForObjectSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForObjectSymbol.kt @@ -18,13 +18,13 @@ import org.jetbrains.kotlin.psi.KtDeclaration internal class FirLightFieldForObjectSymbol( private val objectSymbol: KtClassOrObjectSymbol, containingClass: KtLightClass, + private val name: String, lightMemberOrigin: LightMemberOrigin?, ) : FirLightField(containingClass, lightMemberOrigin) { override val kotlinOrigin: KtDeclaration? = objectSymbol.psi as? KtDeclaration - private val _name = if (objectSymbol.classKind == KtClassKind.COMPANION_OBJECT) objectSymbol.name.asString() else "INSTANCE" - override fun getName(): String = _name + override fun getName(): String = name private val _modifierList: PsiModifierList by lazyPub { val modifiers = setOf(objectSymbol.computeVisibility(isTopLevel = false), PsiModifier.STATIC, PsiModifier.FINAL) @@ -58,8 +58,8 @@ internal class FirLightFieldForObjectSymbol( override fun equals(other: Any?): Boolean = this === other || (other is FirLightFieldForObjectSymbol && - kotlinOrigin == other.kotlinOrigin && - objectSymbol == other.objectSymbol) + kotlinOrigin == other.kotlinOrigin && + objectSymbol == other.objectSymbol) override fun hashCode(): Int = kotlinOrigin.hashCode() } \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt index 7ff8c9546b7..d8f46e2827c 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt @@ -12,18 +12,20 @@ import org.jetbrains.kotlin.asJava.elements.FirLightIdentifier import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertySymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSimpleConstantValue import org.jetbrains.kotlin.psi.KtDeclaration internal class FirLightFieldForPropertySymbol( private val propertySymbol: KtPropertySymbol, - usedNames: MutableSet, + nameGenerator: FieldNameGenerator, containingClass: FirLightClassBase, lightMemberOrigin: LightMemberOrigin?, isTopLevel: Boolean, - forceStatic: Boolean = false + forceStatic: Boolean, + takePropertyVisibility: Boolean ) : FirLightField(containingClass, lightMemberOrigin) { - private val _name: String = generateUniqueFieldName(usedNames, propertySymbol.name.asString()) + private val _name: String = nameGenerator.generateUniqueFieldName(propertySymbol.name.asString()) override val kotlinOrigin: KtDeclaration? = propertySymbol.psi as? KtDeclaration @@ -53,7 +55,6 @@ internal class FirLightFieldForPropertySymbol( private val _modifierList: PsiModifierList by lazyPub { - val isJvmField = propertySymbol.hasJvmFieldAnnotation() val suppressFinal = !propertySymbol.isVal val modifiersFromSymbol = propertySymbol.computeModalityForMethod( @@ -67,7 +68,7 @@ internal class FirLightFieldForPropertySymbol( ) val visibility = - if (isJvmField) propertySymbol.computeVisibility(isTopLevel = false) else PsiModifier.PRIVATE + if (takePropertyVisibility) propertySymbol.computeVisibility(isTopLevel = false) else PsiModifier.PRIVATE val modifiersWithVisibility = basicModifiers + visibility @@ -95,10 +96,13 @@ internal class FirLightFieldForPropertySymbol( FirLightClassModifierList(this, modifiers, annotations) } - override fun getModifierList(): PsiModifierList? = _modifierList + override fun getModifierList(): PsiModifierList = _modifierList + private val _initializer by lazyPub { + (propertySymbol.initializer as? KtSimpleConstantValue<*>)?.createPsiLiteral(this) + } - override fun getInitializer(): PsiExpression? = null //TODO + override fun getInitializer(): PsiExpression? = _initializer override fun equals(other: Any?): Boolean = this === other || @@ -107,16 +111,4 @@ internal class FirLightFieldForPropertySymbol( propertySymbol == other.propertySymbol) override fun hashCode(): Int = kotlinOrigin.hashCode() - - companion object { - private fun generateUniqueFieldName(usedNames: MutableSet, base: String): String { - if (usedNames.add(base)) return base - var i = 1 - while (true) { - val suggestion = "$base$$i" - if (usedNames.add(suggestion)) return suggestion - i++ - } - } - } } \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/firLightUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/firLightUtils.kt index f5288743966..c340d92bee8 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/firLightUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/firLightUtils.kt @@ -10,24 +10,24 @@ import com.intellij.psi.impl.cache.TypeInfo import com.intellij.psi.impl.compiled.ClsTypeElementImpl import com.intellij.psi.impl.compiled.SignatureParsing import com.intellij.psi.impl.compiled.StubBuildingVisitor -import org.jetbrains.annotations.NotNull +import com.intellij.util.IncorrectOperationException import org.jetbrains.kotlin.asJava.elements.KtLightElement import org.jetbrains.kotlin.asJava.elements.KtLightMember import org.jetbrains.kotlin.codegen.signature.BothSignatureWriter import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.fir.FirSession -import org.jetbrains.kotlin.fir.analysis.cfa.FirReturnsImpliesAnalyzer.isSupertypeOf import org.jetbrains.kotlin.fir.backend.jvm.jvmTypeMapper import org.jetbrains.kotlin.fir.declarations.* -import org.jetbrains.kotlin.fir.isPrimitiveNumberOrUnsignedNumberType import org.jetbrains.kotlin.fir.isPrimitiveType +import org.jetbrains.kotlin.fir.resolve.substitution.AbstractConeSubstitutor import org.jetbrains.kotlin.fir.resolve.toSymbol -import org.jetbrains.kotlin.fir.symbols.StandardClassIds -import org.jetbrains.kotlin.fir.typeCheckerContext +import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl import org.jetbrains.kotlin.fir.types.impl.ConeTypeParameterTypeImpl +import org.jetbrains.kotlin.idea.fir.low.level.api.api.FirModuleResolveState +import org.jetbrains.kotlin.idea.fir.low.level.api.api.withFirDeclaration import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirClassOrObjectSymbol import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirSymbol import org.jetbrains.kotlin.idea.frontend.api.fir.types.KtFirClassType @@ -37,10 +37,7 @@ import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.* import org.jetbrains.kotlin.idea.frontend.api.types.* import org.jetbrains.kotlin.load.kotlin.TypeMappingMode import org.jetbrains.kotlin.name.SpecialNames -import org.jetbrains.kotlin.types.TypeUtils import org.jetbrains.kotlin.types.model.SimpleTypeMarker -import org.jetbrains.kotlin.types.model.typeConstructor -import org.jetbrains.kotlin.types.typeUtil.isTypeParameter import java.text.StringCharacterIterator internal fun L.invalidAccess(): Nothing = @@ -60,9 +57,8 @@ internal fun KtType.asPsiType( ): PsiType { require(this is KtFirType) require(context is KtFirSymbol<*>) - val session = context.firRef.withFir(phase) { it.session } - return coneType.asPsiType(session, TypeMappingMode.DEFAULT, parent) + return coneType.asPsiType(session, context.firRef.resolveState, TypeMappingMode.DEFAULT, parent) } internal fun KtClassOrObjectSymbol.typeForClassSymbol(psiElement: PsiElement): PsiType { @@ -74,33 +70,53 @@ internal fun KtClassOrObjectSymbol.typeForClassSymbol(psiElement: PsiElement): P isNullable = false ) } - return type.asPsiType(session, TypeMappingMode.DEFAULT, psiElement) + return type.asPsiType(session, this.firRef.resolveState, TypeMappingMode.DEFAULT, psiElement) } +private class AnonymousTypesSubstitutor(private val session: FirSession, private val state: FirModuleResolveState) : + AbstractConeSubstitutor() { + override fun substituteType(type: ConeKotlinType): ConeKotlinType? { + + if (type !is ConeClassLikeType) return null + + val isAnonymous = type.classId.let { it?.shortClassName?.asString() == SpecialNames.ANONYMOUS } + if (!isAnonymous) return null + + val firstSuperType = (type.lookupTag.toSymbol(session) as? FirClassSymbol)?.fir + ?.withFirDeclaration(state, FirResolvePhase.SUPER_TYPES) { + (it as? FirClass)?.superConeTypes?.firstOrNull() + } + + if (firstSuperType != null) return firstSuperType + + return if (type.nullability.isNullable) session.builtinTypes.nullableAnyType.type + else session.builtinTypes.anyType.type + } +} + + private fun ConeKotlinType.asPsiType( session: FirSession, + state: FirModuleResolveState, mode: TypeMappingMode, psiContext: PsiElement, ): PsiType { if (this is ConeClassErrorType || this !is SimpleTypeMarker) return psiContext.nonExistentType() if (this.typeArguments.any { it is ConeClassErrorType }) return psiContext.nonExistentType() - if (this is ConeClassLikeType) { - val classId = classId - //TODO make anonymous type deriving - if (classId != null && classId.shortClassName.asString() == SpecialNames.ANONYMOUS) return PsiType.NULL - } + + val correctedType = AnonymousTypesSubstitutor(session, state).substituteOrSelf(this) val signatureWriter = BothSignatureWriter(BothSignatureWriter.Mode.SKIP_CHECKS) //TODO Check thread safety - session.jvmTypeMapper.mapType(this, mode, signatureWriter) + session.jvmTypeMapper.mapType(correctedType, mode, signatureWriter) val canonicalSignature = signatureWriter.toString() if (canonicalSignature.contains("L")) return psiContext.nonExistentType() - //TODO Fix it in typemapper - val patchedCanonicalSignature = canonicalSignature.replace(SpecialNames.ANONYMOUS, "java.lang.Object") - val signature = StringCharacterIterator(patchedCanonicalSignature) + require(!canonicalSignature.contains(SpecialNames.ANONYMOUS)) + + val signature = StringCharacterIterator(canonicalSignature) val javaType = SignatureParsing.parseTypeString(signature, StubBuildingVisitor.GUESSING_MAPPER) val typeInfo = TypeInfo.fromString(javaType, false) val typeText = TypeInfo.createTypeText(typeInfo) ?: return psiContext.nonExistentType() @@ -109,9 +125,16 @@ private fun ConeKotlinType.asPsiType( return typeElement.type } -private fun mapSupertype(psiContext: PsiElement, session: FirSession, supertype: ConeKotlinType, kotlinCollectionAsIs: Boolean = false) = +private fun mapSupertype( + psiContext: PsiElement, + session: FirSession, + firResolvePhase: FirModuleResolveState, + supertype: ConeKotlinType, + kotlinCollectionAsIs: Boolean = false +) = supertype.asPsiType( session, + firResolvePhase, if (kotlinCollectionAsIs) TypeMappingMode.SUPER_TYPE_KOTLIN_COLLECTIONS_AS_IS else TypeMappingMode.SUPER_TYPE, psiContext ) as? PsiClassType @@ -129,6 +152,7 @@ internal fun KtClassType.mapSupertype( return mapSupertype( psiContext, session, + contextSymbol.firRef.resolveState, this.coneType, kotlinCollectionAsIs, ) @@ -280,6 +304,39 @@ internal fun KtType.getTypeNullability(context: KtSymbol, phase: FirResolvePhase return if (isNotPrimitiveType) NullabilityType.NotNull else NullabilityType.Unknown } + +private fun escapeString(str: String): String = buildString { + str.forEach { char -> + val escaped = when (char) { + '\n' -> "\\n" + '\r' -> "\\r" + '\t' -> "\\t" + '\"' -> "\\\"" + '\\' -> "\\\\" + else -> "$char" + } + append(escaped) + } +} + +private fun KtSimpleConstantValue<*>.asStringForPsiLiteral(): String = + when (val value = this.constant) { + is String -> "\"${escapeString(value)}\"" + is Long -> "${value}L" + is Float -> "${value}f" + else -> value?.toString() ?: "null" + } + +internal fun KtSimpleConstantValue<*>.createPsiLiteral(parent: PsiElement): PsiExpression? { + val asString = asStringForPsiLiteral() + val instance = PsiElementFactory.getInstance(parent.project) + return try { + instance.createExpressionFromText(asString, parent) + } catch (_: IncorrectOperationException) { + null + } +} + internal fun Set.add(what: T, `if`: Boolean): Set = applyIf(`if`) { this + what } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtSymbolByFirBuilder.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtSymbolByFirBuilder.kt index 6fbe6fdbb4a..4c04d4ff8d5 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtSymbolByFirBuilder.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtSymbolByFirBuilder.kt @@ -87,6 +87,7 @@ internal class KtSymbolByFirBuilder private constructor( is FirField -> buildFieldSymbol(fir) is FirAnonymousFunction -> buildAnonymousFunctionSymbol(fir) is FirPropertyAccessor -> buildPropertyAccessorSymbol(fir) + is FirAnonymousObject -> buildAnonymousObjectSymbol(fir) else -> TODO(fir::class.toString()) } @@ -111,6 +112,9 @@ internal class KtSymbolByFirBuilder private constructor( fun buildClassSymbol(fir: FirRegularClass) = symbolsCache.cache(fir) { KtFirClassOrObjectSymbol(fir, resolveState, token, this) } + fun buildAnonymousObjectSymbol(fir: FirAnonymousObject) = + symbolsCache.cache(fir) { KtFirAnonymousObjectSymbol(fir, resolveState, token, this) } + // TODO it can be a constructor parameter, which may be split into parameter & property // we should handle them both fun buildParameterSymbol(fir: FirValueParameter) = @@ -127,7 +131,8 @@ internal class KtSymbolByFirBuilder private constructor( } fun buildConstructorSymbol(fir: FirConstructor) = symbolsCache.cache(fir) { KtFirConstructorSymbol(fir, resolveState, token, this) } - fun buildTypeParameterSymbol(fir: FirTypeParameter) = symbolsCache.cache(fir) { KtFirTypeParameterSymbol(fir, resolveState, token, this) } + fun buildTypeParameterSymbol(fir: FirTypeParameter) = + symbolsCache.cache(fir) { KtFirTypeParameterSymbol(fir, resolveState, token, this) } fun buildTypeAliasSymbol(fir: FirTypeAlias) = symbolsCache.cache(fir) { KtFirTypeAliasSymbol(fir, resolveState, token) } fun buildEnumEntrySymbol(fir: FirEnumEntry) = symbolsCache.cache(fir) { KtFirEnumEntrySymbol(fir, resolveState, token, this) } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt index abbc9132299..6024798f860 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt @@ -26,6 +26,7 @@ import org.jetbrains.kotlin.idea.frontend.api.components.KtScopeProvider import org.jetbrains.kotlin.idea.frontend.api.fir.KtFirAnalysisSession import org.jetbrains.kotlin.idea.frontend.api.fir.KtSymbolByFirBuilder import org.jetbrains.kotlin.idea.frontend.api.fir.scopes.* +import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirAnonymousObjectSymbol import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirClassOrObjectSymbol import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirEnumEntrySymbol import org.jetbrains.kotlin.idea.frontend.api.fir.types.KtFirType @@ -59,6 +60,7 @@ internal class KtFirScopeProvider( private inline fun KtSymbolWithDeclarations.withFirForScope(crossinline body: (FirClass<*>) -> T): T? = when (this) { is KtFirClassOrObjectSymbol -> firRef.withFir(FirResolvePhase.SUPER_TYPES, body) + is KtFirAnonymousObjectSymbol -> firRef.withFir(FirResolvePhase.SUPER_TYPES, body) is KtFirEnumEntrySymbol -> firRef.withFir(FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE) { val initializer = it.initializer check(initializer is FirAnonymousObject) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirAnonymousObjectSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirAnonymousObjectSymbol.kt new file mode 100644 index 00000000000..f4de67d9eb3 --- /dev/null +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirAnonymousObjectSymbol.kt @@ -0,0 +1,51 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.frontend.api.fir.symbols + +import com.intellij.psi.PsiElement +import org.jetbrains.kotlin.fir.declarations.FirAnonymousObject +import org.jetbrains.kotlin.fir.declarations.FirResolvePhase +import org.jetbrains.kotlin.fir.declarations.superConeTypes +import org.jetbrains.kotlin.idea.fir.findPsi +import org.jetbrains.kotlin.idea.fir.low.level.api.api.FirModuleResolveState +import org.jetbrains.kotlin.idea.frontend.api.ValidityToken +import org.jetbrains.kotlin.idea.frontend.api.fir.KtSymbolByFirBuilder +import org.jetbrains.kotlin.idea.frontend.api.fir.utils.convertAnnotation +import org.jetbrains.kotlin.idea.frontend.api.fir.utils.firRef +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtAnonymousObjectSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtAnnotationCall +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolKind +import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.CanNotCreateSymbolPointerForLocalLibraryDeclarationException +import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtPsiBasedSymbolPointer +import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtSymbolPointer +import org.jetbrains.kotlin.idea.frontend.api.types.KtType + +internal class KtFirAnonymousObjectSymbol( + fir: FirAnonymousObject, + resolveState: FirModuleResolveState, + override val token: ValidityToken, + private val builder: KtSymbolByFirBuilder +) : KtAnonymousObjectSymbol(), KtFirSymbol { + + override val firRef = firRef(fir, resolveState) + override val symbolKind: KtSymbolKind = KtSymbolKind.LOCAL + override val psi: PsiElement? by firRef.withFirAndCache { fir -> fir.findPsi(fir.session) } + + override val annotations: List by firRef.withFirAndCache(FirResolvePhase.TYPES) { + convertAnnotation(it) + } + + override val superTypes: List by firRef.withFirAndCache(FirResolvePhase.SUPER_TYPES) { fir -> + fir.superConeTypes.map { + builder.buildKtType(it) + } + } + + override fun createPointer(): KtSymbolPointer = + KtPsiBasedSymbolPointer.createForSymbolFromSource(this) + ?: throw CanNotCreateSymbolPointerForLocalLibraryDeclarationException("Cannot create pointer for KtFirAnonymousObjectSymbol") +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySymbol.kt index 5e10089371b..ac2df6b9a41 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySymbol.kt @@ -15,14 +15,12 @@ import org.jetbrains.kotlin.idea.frontend.api.fir.KtSymbolByFirBuilder import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.pointers.KtFirMemberPropertySymbolPointer import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.pointers.createSignature import org.jetbrains.kotlin.idea.frontend.api.fir.utils.convertAnnotation +import org.jetbrains.kotlin.idea.frontend.api.fir.utils.convertConstantExpression import org.jetbrains.kotlin.idea.frontend.api.fir.utils.firRef import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertyGetterSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertySetterSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertySymbol -import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtAnnotationCall -import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtCommonSymbolModality -import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolKind -import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolVisibility +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.* import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.CanNotCreateSymbolPointerForLocalLibraryDeclarationException import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtPsiBasedSymbolPointer import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtSymbolPointer @@ -48,7 +46,7 @@ internal class KtFirPropertySymbol( override val type: KtType by firRef.withFirAndCache(FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE) { fir -> builder.buildKtType(fir.returnTypeRef) } override val receiverType: KtType? by firRef.withFirAndCache(FirResolvePhase.TYPES) { fir -> fir.receiverTypeRef?.let(builder::buildKtType) } override val isExtension: Boolean get() = firRef.withFir { it.receiverTypeRef != null } - + override val initializer: KtConstantValue? by firRef.withFirAndCache(FirResolvePhase.BODY_RESOLVE) { fir -> fir.initializer?.convertConstantExpression() } override val symbolKind: KtSymbolKind get() = firRef.withFir { fir -> when (fir.containingClass()?.classId) { diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirSymbolProvider.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirSymbolProvider.kt index e368febdaf2..027dbc18cd9 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirSymbolProvider.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirSymbolProvider.kt @@ -87,7 +87,14 @@ internal class KtFirSymbolProvider( } } + override fun getAnonymousObjectSymbol(psi: KtObjectLiteralExpression): KtAnonymousObjectSymbol = withValidityAssertion { + psi.objectDeclaration.withFirDeclarationOfType(resolveState) { + firSymbolBuilder.buildAnonymousObjectSymbol(it) + } + } + override fun getClassOrObjectSymbol(psi: KtClassOrObject): KtClassOrObjectSymbol = withValidityAssertion { + check(psi !is KtObjectDeclaration || psi.parent !is KtObjectLiteralExpression) psi.withFirDeclarationOfType(resolveState) { firSymbolBuilder.buildClassSymbol(it) } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/firUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/firUtils.kt index b939bb0e58b..b8c7c98cdf6 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/firUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/firUtils.kt @@ -51,7 +51,7 @@ internal fun mapAnnotationParameters(annotationCall: FirAnnotationCall, session: return resultSet } -private fun FirExpression.convertConstantExpression(): KtConstantValue = +internal fun FirExpression.convertConstantExpression(): KtConstantValue = when (this) { is FirConstExpression<*> -> KtSimpleConstantValue(value) else -> KtUnsupportedConstantValue diff --git a/idea/idea-frontend-fir/testData/symbolsByPsi/anonymousObject.kt b/idea/idea-frontend-fir/testData/symbolsByPsi/anonymousObject.kt new file mode 100644 index 00000000000..41f140b6433 --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbolsByPsi/anonymousObject.kt @@ -0,0 +1,91 @@ +class AnonymousContainer { + val anonymousObject = object : Runnable { + override fun run() { + + } + val data = 123 + } +} + +// SYMBOLS: +/* +KtFirFunctionSymbol: + annotations: [] + callableIdIfNonLocal: .run + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: true + isSuspend: false + modality: FINAL + name: run + origin: SOURCE + receiverType: null + symbolKind: MEMBER + type: kotlin/Unit + typeParameters: [] + valueParameters: [] + visibility: PUBLIC + +KtFirPropertySymbol: + annotations: [] + callableIdIfNonLocal: .data + getter: KtFirPropertyGetterSymbol() + hasBackingField: true + initializer: 123 + isConst: false + isExtension: false + isLateInit: false + isOverride: false + isVal: true + modality: FINAL + name: data + origin: SOURCE + receiverType: null + setter: null + symbolKind: MEMBER + type: kotlin/Int + visibility: PUBLIC + +KtFirAnonymousObjectSymbol: + annotations: [] + origin: SOURCE + superTypes: [java/lang/Runnable] + symbolKind: LOCAL + +KtFirPropertySymbol: + annotations: [] + callableIdIfNonLocal: AnonymousContainer.anonymousObject + getter: KtFirPropertyGetterSymbol() + hasBackingField: true + initializer: KtUnsupportedConstantValue + isConst: false + isExtension: false + isLateInit: false + isOverride: false + isVal: true + modality: FINAL + name: anonymousObject + origin: SOURCE + receiverType: null + setter: null + symbolKind: MEMBER + type: java/lang/Runnable + visibility: PUBLIC + +KtFirClassOrObjectSymbol: + annotations: [] + classIdIfNonLocal: AnonymousContainer + classKind: CLASS + companionObject: null + isInner: false + modality: FINAL + name: AnonymousContainer + origin: SOURCE + primaryConstructor: KtFirConstructorSymbol() + superTypes: [kotlin/Any] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: PUBLIC +*/ diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/SymbolsByPsiBuildingTestGenerated.java b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/SymbolsByPsiBuildingTestGenerated.java index fa7930de2e2..a3e8eee3c46 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/SymbolsByPsiBuildingTestGenerated.java +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/SymbolsByPsiBuildingTestGenerated.java @@ -33,6 +33,11 @@ public class SymbolsByPsiBuildingTestGenerated extends AbstractSymbolsByPsiBuild runTest("idea/idea-frontend-fir/testData/symbolsByPsi/annotations.kt"); } + @TestMetadata("anonymousObject.kt") + public void testAnonymousObject() throws Exception { + runTest("idea/idea-frontend-fir/testData/symbolsByPsi/anonymousObject.kt"); + } + @TestMetadata("class.kt") public void testClass() throws Exception { runTest("idea/idea-frontend-fir/testData/symbolsByPsi/class.kt"); From a7d7aa123efb05c3bf61cd3a5e1897c7932eb40b Mon Sep 17 00:00:00 2001 From: Igor Yakovlev Date: Tue, 1 Dec 2020 03:31:05 +0300 Subject: [PATCH 388/698] [FIR IDE] LC minor refactorings --- .../frontend/api/symbols/KtClassLikeSymbol.kt | 2 +- .../annotations/FirLightAbstractAnnotation.kt | 5 +-- .../annotations/FirLightSimpleAnnotation.kt | 1 - .../asJava/annotations/annotationsUtils.kt | 4 +- .../classes/FirLightClassForEnumEntry.kt | 1 - .../asJava/classes/FirLightClassForSymbol.kt | 3 +- .../idea/asJava/classes/firLightClassUtils.kt | 7 ++-- .../asJava/fields/FirLightFieldEnumEntry.kt | 8 +--- .../fields/FirLightFieldForObjectSymbol.kt | 2 - .../fields/FirLightFieldForPropertySymbol.kt | 42 +++++++++---------- .../kotlin/idea/asJava/firLightUtils.kt | 34 +++++---------- .../FirLightAccessorMethodForSymbol.kt | 27 +++++++----- .../asJava/methods/FirLightMethodForSymbol.kt | 1 - .../methods/FirLightSimpleMethodForSymbol.kt | 32 ++++++++------ .../parameters/FirLightTypeParameter.kt | 6 +-- .../fir/symbols/KtFirTypeParameterSymbol.kt | 2 +- 16 files changed, 78 insertions(+), 99 deletions(-) diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtClassLikeSymbol.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtClassLikeSymbol.kt index 733de867ccd..74de4964757 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtClassLikeSymbol.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtClassLikeSymbol.kt @@ -16,7 +16,7 @@ sealed class KtClassifierSymbol : KtSymbol, KtNamedSymbol abstract class KtTypeParameterSymbol : KtClassifierSymbol(), KtNamedSymbol { abstract override fun createPointer(): KtSymbolPointer - abstract val bounds: List + abstract val upperBounds: List } sealed class KtClassLikeSymbol : KtClassifierSymbol(), KtNamedSymbol, KtSymbolWithKind { diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/FirLightAbstractAnnotation.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/FirLightAbstractAnnotation.kt index 453bbb0ad72..8b72656f47e 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/FirLightAbstractAnnotation.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/FirLightAbstractAnnotation.kt @@ -6,11 +6,10 @@ package org.jetbrains.kotlin.idea.asJava import com.intellij.psi.* -import com.intellij.psi.impl.PsiImplUtil import org.jetbrains.kotlin.asJava.classes.cannotModify import org.jetbrains.kotlin.asJava.classes.lazyPub -import org.jetbrains.kotlin.asJava.elements.* -import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtAnnotationCall +import org.jetbrains.kotlin.asJava.elements.KtLightElement +import org.jetbrains.kotlin.asJava.elements.KtLightElementBase import org.jetbrains.kotlin.psi.* internal abstract class FirLightAbstractAnnotation(parent: PsiElement) : diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/FirLightSimpleAnnotation.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/FirLightSimpleAnnotation.kt index 2f3d757b098..2b63812e83e 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/FirLightSimpleAnnotation.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/FirLightSimpleAnnotation.kt @@ -7,7 +7,6 @@ package org.jetbrains.kotlin.idea.asJava import com.intellij.psi.PsiAnnotationMemberValue import com.intellij.psi.PsiElement -import com.intellij.psi.impl.PsiImplUtil import org.jetbrains.kotlin.psi.KtCallElement internal class FirLightSimpleAnnotation( diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/annotationsUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/annotationsUtils.kt index a150a9ff1c2..37407e233d7 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/annotationsUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/annotations/annotationsUtils.kt @@ -69,8 +69,8 @@ internal fun KtAnnotatedSymbol.hasDeprecatedAnnotation(annotationUseSiteTarget: internal fun KtAnnotatedSymbol.hasJvmOverloadsAnnotation(): Boolean = hasAnnotation("kotlin/jvm/JvmOverloads", null) -internal fun KtAnnotatedSymbol.hasJvmStaticAnnotation(): Boolean = - hasAnnotation("kotlin/jvm/JvmStatic", null) +internal fun KtAnnotatedSymbol.hasJvmStaticAnnotation(annotationUseSiteTarget: AnnotationUseSiteTarget? = null): Boolean = + hasAnnotation("kotlin/jvm/JvmStatic", annotationUseSiteTarget) internal fun KtAnnotatedSymbol.hasInlineOnlyAnnotation(): Boolean = hasAnnotation("kotlin/internal/InlineOnly", null) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForEnumEntry.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForEnumEntry.kt index 3765c197186..afe0fe15cf4 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForEnumEntry.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForEnumEntry.kt @@ -12,7 +12,6 @@ import org.jetbrains.kotlin.idea.asJava.* import org.jetbrains.kotlin.idea.asJava.FirLightClassModifierList import org.jetbrains.kotlin.idea.asJava.FirLightPsiJavaCodeReferenceElementWithNoReference import org.jetbrains.kotlin.idea.asJava.classes.createMethods -import org.jetbrains.kotlin.idea.asJava.fields.FirLightFieldForEnumEntry import org.jetbrains.kotlin.idea.frontend.api.fir.analyzeWithSymbolAsContext import org.jetbrains.kotlin.idea.frontend.api.symbols.KtEnumEntrySymbol import org.jetbrains.kotlin.idea.frontend.api.types.KtClassType diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt index 1388a8dcfee..b6a28ca9216 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt @@ -14,7 +14,6 @@ import org.jetbrains.kotlin.idea.asJava.classes.* import org.jetbrains.kotlin.idea.asJava.classes.createInheritanceList import org.jetbrains.kotlin.idea.asJava.classes.createInnerClasses import org.jetbrains.kotlin.idea.asJava.classes.createMethods -import org.jetbrains.kotlin.idea.asJava.fields.FirLightFieldForEnumEntry import org.jetbrains.kotlin.idea.frontend.api.fir.analyzeWithSymbolAsContext import org.jetbrains.kotlin.idea.frontend.api.symbols.* import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolKind @@ -128,7 +127,7 @@ internal open class FirLightClassForSymbol( .mapTo(result) { FirLightFieldForPropertySymbol( propertySymbol = it, - nameGenerator = nameGenerator, + fieldName = nameGenerator.generateUniqueFieldName(it.name.asString()), containingClass = this@FirLightClassForSymbol, lightMemberOrigin = null, isTopLevel = false, diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt index 5ce844cb4f8..eb6ff278dd1 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt @@ -19,7 +19,6 @@ import org.jetbrains.kotlin.asJava.elements.KtLightMethod import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget import org.jetbrains.kotlin.fir.symbols.StandardClassIds import org.jetbrains.kotlin.idea.asJava.* -import org.jetbrains.kotlin.idea.asJava.fields.FirLightFieldForEnumEntry import org.jetbrains.kotlin.idea.frontend.api.analyze import org.jetbrains.kotlin.idea.frontend.api.fir.analyzeWithSymbolAsContext import org.jetbrains.kotlin.idea.frontend.api.symbols.* @@ -139,7 +138,7 @@ internal fun FirLightClassBase.createMethods( containingClass = this@createMethods, isTopLevel = isTopLevel, methodIndex = methodIndex++, - argumentsSkipMask = skipMask.clone() as BitSet + argumentsSkipMask = skipMask.copy() ) ) } @@ -225,7 +224,7 @@ internal fun FirLightClassBase.createField( result.add( FirLightFieldForPropertySymbol( propertySymbol = declaration, - nameGenerator = nameGenerator, + fieldName = nameGenerator.generateUniqueFieldName(declaration.name.asString()), containingClass = this, lightMemberOrigin = null, isTopLevel = isTopLevel, @@ -262,7 +261,7 @@ internal fun FirLightClassBase.createInheritanceList(forExtendsList: Boolean, su } //TODO Add support for kotlin.collections. - superTypes + superTypes.asSequence() .filterIsInstance() .filter { it.needToAddTypeIntoList() } .mapNotNull { it.mapSupertype(this, kotlinCollectionAsIs = true) } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldEnumEntry.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldEnumEntry.kt index 1ca96cd99ed..038c88c87b2 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldEnumEntry.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldEnumEntry.kt @@ -3,7 +3,7 @@ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ -package org.jetbrains.kotlin.idea.asJava.fields +package org.jetbrains.kotlin.idea.asJava import com.intellij.psi.* import org.jetbrains.kotlin.asJava.builder.LightMemberOrigin @@ -11,10 +11,6 @@ import org.jetbrains.kotlin.asJava.classes.* import org.jetbrains.kotlin.asJava.elements.FirLightIdentifier import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.idea.asJava.* -import org.jetbrains.kotlin.idea.asJava.FirLightClassForSymbol -import org.jetbrains.kotlin.idea.asJava.FirLightClassModifierList -import org.jetbrains.kotlin.idea.asJava.FirLightField -import org.jetbrains.kotlin.idea.asJava.asPsiType import org.jetbrains.kotlin.idea.frontend.api.symbols.KtEnumEntrySymbol import org.jetbrains.kotlin.idea.util.ifTrue import org.jetbrains.kotlin.psi.KtEnumEntry @@ -33,7 +29,7 @@ internal class FirLightFieldForEnumEntry( ) } - override fun getModifierList(): PsiModifierList? = _modifierList + override fun getModifierList(): PsiModifierList = _modifierList override val kotlinOrigin: KtEnumEntry? = enumEntrySymbol.psi as? KtEnumEntry diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForObjectSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForObjectSymbol.kt index b78a4ea4f63..579ed610fef 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForObjectSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForObjectSymbol.kt @@ -10,8 +10,6 @@ import org.jetbrains.kotlin.asJava.builder.LightMemberOrigin import org.jetbrains.kotlin.asJava.classes.KtLightClass import org.jetbrains.kotlin.asJava.classes.lazyPub import org.jetbrains.kotlin.asJava.elements.FirLightIdentifier -import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget -import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassKind import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassOrObjectSymbol import org.jetbrains.kotlin.psi.KtDeclaration diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt index d8f46e2827c..152f606428a 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt @@ -17,7 +17,7 @@ import org.jetbrains.kotlin.psi.KtDeclaration internal class FirLightFieldForPropertySymbol( private val propertySymbol: KtPropertySymbol, - nameGenerator: FieldNameGenerator, + private val fieldName: String, containingClass: FirLightClassBase, lightMemberOrigin: LightMemberOrigin?, isTopLevel: Boolean, @@ -25,8 +25,6 @@ internal class FirLightFieldForPropertySymbol( takePropertyVisibility: Boolean ) : FirLightField(containingClass, lightMemberOrigin) { - private val _name: String = nameGenerator.generateUniqueFieldName(propertySymbol.name.asString()) - override val kotlinOrigin: KtDeclaration? = propertySymbol.psi as? KtDeclaration private val _returnedType: PsiType by lazyPub { @@ -51,37 +49,37 @@ internal class FirLightFieldForPropertySymbol( override fun getType(): PsiType = _returnedType - override fun getName(): String = _name + override fun getName(): String = fieldName private val _modifierList: PsiModifierList by lazyPub { + val modifiers = mutableSetOf() + val suppressFinal = !propertySymbol.isVal - val modifiersFromSymbol = propertySymbol.computeModalityForMethod( + propertySymbol.computeModalityForMethod( isTopLevel = isTopLevel, - suppressFinal = suppressFinal + suppressFinal = suppressFinal, + result = modifiers ) - val basicModifiers = modifiersFromSymbol.add( - what = PsiModifier.STATIC, - `if` = forceStatic - ) + if (forceStatic) { + modifiers.add(PsiModifier.STATIC) + } val visibility = if (takePropertyVisibility) propertySymbol.computeVisibility(isTopLevel = false) else PsiModifier.PRIVATE + modifiers.add(visibility) - val modifiersWithVisibility = basicModifiers + visibility - - val modifiers = modifiersWithVisibility.add( - what = PsiModifier.FINAL, - `if` = !suppressFinal - ).add( - what = PsiModifier.TRANSIENT, - `if` = propertySymbol.hasAnnotation("kotlin/jvm/Transient", null) - ).add( - what = PsiModifier.VOLATILE, - `if` = propertySymbol.hasAnnotation("kotlin/jvm/Volatile", null) - ) + if (!suppressFinal) { + modifiers.add(PsiModifier.FINAL) + } + if (propertySymbol.hasAnnotation("kotlin/jvm/Transient", null)) { + modifiers.add(PsiModifier.TRANSIENT) + } + if (propertySymbol.hasAnnotation("kotlin/jvm/Volatile", null)) { + modifiers.add(PsiModifier.VOLATILE) + } val nullability = if (visibility != PsiModifier.PRIVATE) propertySymbol.type.getTypeNullability(propertySymbol, FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/firLightUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/firLightUtils.kt index c340d92bee8..56036b35809 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/firLightUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/firLightUtils.kt @@ -39,6 +39,7 @@ import org.jetbrains.kotlin.load.kotlin.TypeMappingMode import org.jetbrains.kotlin.name.SpecialNames import org.jetbrains.kotlin.types.model.SimpleTypeMarker import java.text.StringCharacterIterator +import java.util.* internal fun L.invalidAccess(): Nothing = error("Cls delegate shouldn't be accessed for fir light classes! Qualified name: ${javaClass.name}") @@ -192,39 +193,25 @@ internal fun KtSymbolWithModality<*>.computeSimpleModality(): String? = when (mo else -> throw NotImplementedError() } -internal fun FirMemberDeclaration.computeModalityForMethod(isTopLevel: Boolean): Set { - require(this !is FirConstructor) - - val simpleModifier = computeSimpleModality() - - val withNative = if (isExternal) simpleModifier + PsiModifier.NATIVE else simpleModifier - val withTopLevelStatic = if (isTopLevel) withNative + PsiModifier.STATIC else withNative - - return withTopLevelStatic -} - internal fun KtSymbolWithModality.computeModalityForMethod( isTopLevel: Boolean, - suppressFinal: Boolean -): Set { + suppressFinal: Boolean, + result: MutableSet +) { require(this !is KtClassLikeSymbol) - val modality = mutableSetOf() - computeSimpleModality()?.run { if (this != PsiModifier.FINAL || !suppressFinal) { - modality.add(this) + result.add(this) } } if (this is KtFunctionSymbol && isExternal) { - modality.add(PsiModifier.NATIVE) + result.add(PsiModifier.NATIVE) } if (isTopLevel) { - modality.add(PsiModifier.STATIC) + result.add(PsiModifier.STATIC) } - - return modality } internal fun FirMemberDeclaration.computeVisibility(isTopLevel: Boolean): String { @@ -337,8 +324,7 @@ internal fun KtSimpleConstantValue<*>.createPsiLiteral(parent: PsiElement): PsiE } } -internal fun Set.add(what: T, `if`: Boolean): Set = - applyIf(`if`) { this + what } - internal inline fun T.applyIf(`if`: Boolean, body: T.() -> T): T = - if (`if`) body() else this \ No newline at end of file + if (`if`) body() else this + +internal fun BitSet.copy(): BitSet = clone() as BitSet \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightAccessorMethodForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightAccessorMethodForSymbol.kt index d5970252ec4..6b3caeeb277 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightAccessorMethodForSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightAccessorMethodForSymbol.kt @@ -79,25 +79,30 @@ internal class FirLightAccessorMethodForSymbol( val isOverrideMethod = propertyAccessorSymbol.isOverride || containingPropertySymbol.isOverride val isInterfaceMethod = containingClass.isInterface + val modifiers = mutableSetOf() + + containingPropertySymbol.computeModalityForMethod( + isTopLevel = isTopLevel, + suppressFinal = isOverrideMethod || isInterfaceMethod, + result = modifiers + ) + val visibility = isOverrideMethod.ifTrue { (containingClass as? FirLightClassForSymbol) ?.tryGetEffectiveVisibility(containingPropertySymbol) ?.toPsiVisibility(isTopLevel) } ?: propertyAccessorSymbol.computeVisibility(isTopLevel) + modifiers.add(visibility) - val modifiers = containingPropertySymbol.computeModalityForMethod( - isTopLevel = isTopLevel, - suppressFinal = isOverrideMethod || isInterfaceMethod - ) + visibility + if (containingPropertySymbol.hasJvmStaticAnnotation(accessorSite)) { + modifiers.add(PsiModifier.STATIC) + } + + if (isInterfaceMethod) { + modifiers.add(PsiModifier.ABSTRACT) + } modifiers - .add( - what = PsiModifier.STATIC, - `if` = _annotations.any { it.qualifiedName == "kotlin.jvm.JvmStatic" } - ).add( - what = PsiModifier.ABSTRACT, - `if` = isInterfaceMethod - ) } private val _modifierList: PsiModifierList by lazyPub { diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightMethodForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightMethodForSymbol.kt index ea893c97d2c..f3ff13fd4af 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightMethodForSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightMethodForSymbol.kt @@ -11,7 +11,6 @@ import org.jetbrains.kotlin.asJava.builder.LightMemberOrigin import org.jetbrains.kotlin.asJava.classes.lazyPub import org.jetbrains.kotlin.asJava.elements.FirLightIdentifier import org.jetbrains.kotlin.idea.frontend.api.symbols.KtFunctionLikeSymbol -import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.KtDeclaration import java.util.* diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightSimpleMethodForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightSimpleMethodForSymbol.kt index 0523d1b5a94..814a7c631a8 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightSimpleMethodForSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/methods/FirLightSimpleMethodForSymbol.kt @@ -86,21 +86,27 @@ internal class FirLightSimpleMethodForSymbol( val finalModifier = kotlinOrigin?.hasModifier(KtTokens.FINAL_KEYWORD) == true - val modifiers = functionSymbol.computeModalityForMethod( - isTopLevel = isTopLevel, - suppressFinal = !finalModifier && functionSymbol.isOverride - ) + _visibility + val modifiers = mutableSetOf() - modifiers.add( - what = PsiModifier.STATIC, - `if` = functionSymbol.hasJvmStaticAnnotation() - ).add( - what = PsiModifier.STRICTFP, - `if` = functionSymbol.hasAnnotation("kotlin/jvm/Strictfp", null) - ).add( - what = PsiModifier.SYNCHRONIZED, - `if` = functionSymbol.hasAnnotation("kotlin/jvm/Synchronized", null) + functionSymbol.computeModalityForMethod( + isTopLevel = isTopLevel, + suppressFinal = !finalModifier && functionSymbol.isOverride, + result = modifiers ) + + modifiers.add(_visibility) + + if (functionSymbol.hasJvmStaticAnnotation()) { + modifiers.add(PsiModifier.STATIC) + } + if (functionSymbol.hasAnnotation("kotlin/jvm/Strictfp", null)) { + modifiers.add(PsiModifier.STRICTFP) + } + if (functionSymbol.hasAnnotation("kotlin/jvm/Synchronized", null)) { + modifiers.add(PsiModifier.SYNCHRONIZED) + } + + modifiers } private val _isDeprecated: Boolean by lazyPub { diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/parameters/FirLightTypeParameter.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/parameters/FirLightTypeParameter.kt index 3ca16019d9e..25793088718 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/parameters/FirLightTypeParameter.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/parameters/FirLightTypeParameter.kt @@ -11,7 +11,6 @@ import com.intellij.openapi.util.TextRange import com.intellij.psi.* import com.intellij.psi.impl.PsiClassImplUtil import com.intellij.psi.impl.light.LightElement -import com.intellij.psi.impl.light.LightReferenceListBuilder import com.intellij.psi.javadoc.PsiDocComment import com.intellij.psi.search.SearchScope import org.jetbrains.kotlin.asJava.classes.KotlinSuperTypeListBuilder @@ -24,11 +23,8 @@ import org.jetbrains.kotlin.idea.KotlinLanguage import org.jetbrains.kotlin.idea.asJava.basicIsEquivalentTo import org.jetbrains.kotlin.idea.asJava.invalidAccess import org.jetbrains.kotlin.idea.asJava.mapSupertype -import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassKind -import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassOrObjectSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtTypeParameterSymbol import org.jetbrains.kotlin.idea.frontend.api.types.KtClassType -import org.jetbrains.kotlin.idea.frontend.api.types.KtType import org.jetbrains.kotlin.psi.KtTypeParameter import org.jetbrains.kotlin.psi.psiUtil.startOffset @@ -65,7 +61,7 @@ internal class FirLightTypeParameter( role = PsiReferenceList.Role.EXTENDS_LIST ) - typeParameterSymbol.bounds + typeParameterSymbol.upperBounds .filterIsInstance() .filter { it.classId != StandardClassIds.Any } .mapNotNull { it.mapSupertype(this, kotlinCollectionAsIs = true) } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirTypeParameterSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirTypeParameterSymbol.kt index 76deeb816ee..0727f759820 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirTypeParameterSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirTypeParameterSymbol.kt @@ -30,7 +30,7 @@ internal class KtFirTypeParameterSymbol( override val name: Name get() = firRef.withFir { it.name } - override val bounds: List by firRef.withFirAndCache(FirResolvePhase.TYPES) { fir -> + override val upperBounds: List by firRef.withFirAndCache(FirResolvePhase.TYPES) { fir -> fir.bounds.map { type -> builder.buildKtType(type) } } From 7cbcde77dd3759c0ca07c821313fa03f1af2af73 Mon Sep 17 00:00:00 2001 From: Igor Yakovlev Date: Tue, 1 Dec 2020 18:56:31 +0300 Subject: [PATCH 389/698] [FIR IDE] LC More accurate fields visibility and modality --- .../asJava/classes/FirLightClassForFacade.kt | 2 +- .../asJava/classes/FirLightClassForSymbol.kt | 46 ++++++------------- .../fields/FirLightFieldForPropertySymbol.kt | 2 + 3 files changed, 17 insertions(+), 33 deletions(-) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt index 47bb64d8140..97916af0e54 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt @@ -116,7 +116,7 @@ class FirLightClassForFacade( } for (propertySymbol in propertySymbols) { - val forceStaticAndPropertyVisibility = propertySymbol.hasJvmStaticAnnotation() + val forceStaticAndPropertyVisibility = propertySymbol.isConst || propertySymbol.hasJvmFieldAnnotation() createField( propertySymbol, nameGenerator, diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt index b6a28ca9216..4d364aa92e7 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt @@ -19,6 +19,7 @@ import org.jetbrains.kotlin.idea.frontend.api.symbols.* import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolKind import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolVisibility import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithVisibility +import org.jetbrains.kotlin.load.java.JvmAbi internal open class FirLightClassForSymbol( private val classOrObjectSymbol: KtClassOrObjectSymbol, @@ -118,20 +119,20 @@ internal open class FirLightClassForSymbol( result } - private fun addFieldsFromCompanionIfNeeded(result: MutableList, nameGenerator: FirLightField.FieldNameGenerator) { + private fun addFieldsFromCompanionIfNeeded(result: MutableList) { classOrObjectSymbol.companionObject?.run { analyzeWithSymbolAsContext(this) { getDeclaredMemberScope().getCallableSymbols() .filterIsInstance() - .filter { it.hasJvmFieldAnnotation() || it.isConst } + .filter { it.hasJvmFieldAnnotation() || it.hasJvmStaticAnnotation() || it.isConst } .mapTo(result) { FirLightFieldForPropertySymbol( propertySymbol = it, - fieldName = nameGenerator.generateUniqueFieldName(it.name.asString()), + fieldName = it.name.asString(), containingClass = this@FirLightClassForSymbol, lightMemberOrigin = null, isTopLevel = false, - forceStatic = true, + forceStatic = !it.hasJvmStaticAnnotation(), takePropertyVisibility = true ) } @@ -139,23 +140,6 @@ internal open class FirLightClassForSymbol( } } - - private fun addObjectFields(result: MutableList, nameGenerator: FirLightField.FieldNameGenerator) { - analyzeWithSymbolAsContext(classOrObjectSymbol) { - classOrObjectSymbol.getDeclaredMemberScope().getAllSymbols() - .filterIsInstance() - .filter { it.classKind == KtClassKind.OBJECT } - .mapTo(result) { - FirLightFieldForObjectSymbol( - objectSymbol = it, - containingClass = this@FirLightClassForSymbol, - name = nameGenerator.generateUniqueFieldName(it.name.asString()), - lightMemberOrigin = null - ) - } - } - } - private fun addInstanceFieldIfNeeded(result: MutableList) { val isNamedObject = classOrObjectSymbol.classKind == KtClassKind.OBJECT if (isNamedObject && classOrObjectSymbol.symbolKind != KtSymbolKind.LOCAL) { @@ -163,14 +147,14 @@ internal open class FirLightClassForSymbol( FirLightFieldForObjectSymbol( objectSymbol = classOrObjectSymbol, containingClass = this@FirLightClassForSymbol, - name = "INSTANCE", + name = JvmAbi.INSTANCE_FIELD, lightMemberOrigin = null ) ) } } - private fun addPropertyBackingFields(result: MutableList, nameGenerator: FirLightField.FieldNameGenerator) { + private fun addPropertyBackingFields(result: MutableList) { analyzeWithSymbolAsContext(classOrObjectSymbol) { val propertySymbols = classOrObjectSymbol.getDeclaredMemberScope().getCallableSymbols() .filterIsInstance() @@ -178,12 +162,15 @@ internal open class FirLightClassForSymbol( filterNot { it.hasJvmFieldAnnotation() || it.isConst } } + val nameGenerator = FirLightField.FieldNameGenerator() val isObject = classOrObjectSymbol.classKind == KtClassKind.OBJECT + val isCompanionObject = classOrObjectSymbol.classKind == KtClassKind.COMPANION_OBJECT for (propertySymbol in propertySymbols) { + val isJvmField = propertySymbol.hasJvmFieldAnnotation() val isJvmStatic = propertySymbol.hasJvmStaticAnnotation() - val forceStatic = isObject || isJvmStatic - val takePropertyVisibility = (isObject && propertySymbol.isConst) || isJvmStatic + val forceStatic = isObject && (propertySymbol.isConst || isJvmStatic || isJvmField) + val takePropertyVisibility = !isCompanionObject && (isJvmField || (isObject && isJvmStatic)) createField( declaration = propertySymbol, @@ -195,8 +182,6 @@ internal open class FirLightClassForSymbol( ) } - - if (isEnum) { classOrObjectSymbol.getDeclaredMemberScope().getCallableSymbols() .filterIsInstance() @@ -212,11 +197,8 @@ internal open class FirLightClassForSymbol( addCompanionObjectFieldIfNeeded(result) addInstanceFieldIfNeeded(result) - val nameGenerator = FirLightField.FieldNameGenerator() - - addObjectFields(result, nameGenerator) - addFieldsFromCompanionIfNeeded(result, nameGenerator) - addPropertyBackingFields(result, nameGenerator) + addFieldsFromCompanionIfNeeded(result) + addPropertyBackingFields(result) result } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt index 152f606428a..69b198ce4ab 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt @@ -97,6 +97,8 @@ internal class FirLightFieldForPropertySymbol( override fun getModifierList(): PsiModifierList = _modifierList private val _initializer by lazyPub { + if (!propertySymbol.isConst) return@lazyPub null + if (!propertySymbol.isVal) return@lazyPub null (propertySymbol.initializer as? KtSimpleConstantValue<*>)?.createPsiLiteral(this) } From 842d31d04ea6f80a8ad63468421bd8e497ba98f3 Mon Sep 17 00:00:00 2001 From: Igor Yakovlev Date: Wed, 25 Nov 2020 15:23:28 +0300 Subject: [PATCH 390/698] [FIR IDE] Fix HL API test data Ignore failed tests Set passing test to comparison mode Fix testdata for symbols Fix invalid LAZINESS parameter reading from testdata --- .../asJava/lightClasses/facades/AllPrivate.kt | 2 + .../testData/memberScopeByFqName/Int.txt | 10 + .../memberScopeByFqName/MutableList.txt | 2 + .../memberScopeByFqName/java.lang.String.txt | 172 ++++++++++++++++++ .../symbolPointer/memberProperties.kt | 5 + .../symbolPointer/topLevelProperties.kt | 5 + .../testData/symbolsByPsi/classMembes.kt | 2 + .../symbolsByPsi/classWithTypeParams.kt | 2 + .../symbolsByPsi/functionWithTypeParams.kt | 1 + ...ndaryConstructorByJavaNewExpression.0.java | 4 +- ...secondaryConstructorByJavaSuperCall.0.java | 4 +- .../findFunctionUsages/jvmOverloaded.0.kt | 4 +- .../kotlinNestedClassPropertyUsages.0.kt | 2 + .../kotlinTopLevelPropertyUsages.0.kt | 1 + .../resolve/AbstractIdeLightClassTest.kt | 7 +- 15 files changed, 218 insertions(+), 5 deletions(-) diff --git a/compiler/testData/asJava/lightClasses/facades/AllPrivate.kt b/compiler/testData/asJava/lightClasses/facades/AllPrivate.kt index 1ba5d242fbc..b1f65de093d 100644 --- a/compiler/testData/asJava/lightClasses/facades/AllPrivate.kt +++ b/compiler/testData/asJava/lightClasses/facades/AllPrivate.kt @@ -8,3 +8,5 @@ package p private fun f(): Int = 3 private fun g(p: String): String = "p" + +// FIR_COMPARISON \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/memberScopeByFqName/Int.txt b/idea/idea-frontend-fir/testData/memberScopeByFqName/Int.txt index e93df9254ae..c26dab95452 100644 --- a/idea/idea-frontend-fir/testData/memberScopeByFqName/Int.txt +++ b/idea/idea-frontend-fir/testData/memberScopeByFqName/Int.txt @@ -1103,6 +1103,16 @@ KtFirFunctionSymbol: valueParameters: [KtFirFunctionValueParameterSymbol(other)] visibility: PUBLIC +KtFirConstructorSymbol: + annotations: [] + containingClassIdIfNonLocal: kotlin/Int + isPrimary: true + origin: LIBRARY + symbolKind: MEMBER + type: kotlin/Int + valueParameters: [] + visibility: PRIVATE + KtFirFunctionSymbol: annotations: [] callableIdIfNonLocal: kotlin.Int.equals diff --git a/idea/idea-frontend-fir/testData/memberScopeByFqName/MutableList.txt b/idea/idea-frontend-fir/testData/memberScopeByFqName/MutableList.txt index 1b99e0525de..22c0521ea7e 100644 --- a/idea/idea-frontend-fir/testData/memberScopeByFqName/MutableList.txt +++ b/idea/idea-frontend-fir/testData/memberScopeByFqName/MutableList.txt @@ -386,8 +386,10 @@ KtFirPropertySymbol: callableIdIfNonLocal: kotlin.collections.List.size getter: null hasBackingField: false + initializer: null isConst: false isExtension: false + isLateInit: false isOverride: false isVal: true modality: ABSTRACT diff --git a/idea/idea-frontend-fir/testData/memberScopeByFqName/java.lang.String.txt b/idea/idea-frontend-fir/testData/memberScopeByFqName/java.lang.String.txt index 713d75f5d50..b40688f7b5d 100644 --- a/idea/idea-frontend-fir/testData/memberScopeByFqName/java.lang.String.txt +++ b/idea/idea-frontend-fir/testData/memberScopeByFqName/java.lang.String.txt @@ -74,8 +74,10 @@ KtFirPropertySymbol: callableIdIfNonLocal: kotlin.CharSequence.length getter: KtFirPropertyGetterSymbol() hasBackingField: true + initializer: null isConst: false isExtension: false + isLateInit: false isOverride: false isVal: true modality: ABSTRACT @@ -1113,6 +1115,176 @@ KtFirFunctionSymbol: valueParameters: [] visibility: PUBLIC +KtFirConstructorSymbol: + annotations: [] + containingClassIdIfNonLocal: java/lang/String + isPrimary: false + origin: JAVA + symbolKind: MEMBER + type: java/lang/String + valueParameters: [] + visibility: PUBLIC + +KtFirConstructorSymbol: + annotations: [] + containingClassIdIfNonLocal: java/lang/String + isPrimary: false + origin: JAVA + symbolKind: MEMBER + type: java/lang/String + valueParameters: [KtFirConstructorValueParameterSymbol(original)] + visibility: PUBLIC + +KtFirConstructorSymbol: + annotations: [] + containingClassIdIfNonLocal: java/lang/String + isPrimary: false + origin: JAVA + symbolKind: MEMBER + type: java/lang/String + valueParameters: [KtFirConstructorValueParameterSymbol(value)] + visibility: PUBLIC + +KtFirConstructorSymbol: + annotations: [] + containingClassIdIfNonLocal: java/lang/String + isPrimary: false + origin: JAVA + symbolKind: MEMBER + type: java/lang/String + valueParameters: [KtFirConstructorValueParameterSymbol(value), KtFirConstructorValueParameterSymbol(offset), KtFirConstructorValueParameterSymbol(count)] + visibility: PUBLIC + +KtFirConstructorSymbol: + annotations: [] + containingClassIdIfNonLocal: java/lang/String + isPrimary: false + origin: JAVA + symbolKind: MEMBER + type: java/lang/String + valueParameters: [KtFirConstructorValueParameterSymbol(codePoints), KtFirConstructorValueParameterSymbol(offset), KtFirConstructorValueParameterSymbol(count)] + visibility: PUBLIC + +KtFirConstructorSymbol: + annotations: [java/lang/Deprecated()] + containingClassIdIfNonLocal: java/lang/String + isPrimary: false + origin: JAVA + symbolKind: MEMBER + type: java/lang/String + valueParameters: [KtFirConstructorValueParameterSymbol(ascii), KtFirConstructorValueParameterSymbol(hibyte), KtFirConstructorValueParameterSymbol(offset), KtFirConstructorValueParameterSymbol(count)] + visibility: PUBLIC + +KtFirConstructorSymbol: + annotations: [java/lang/Deprecated()] + containingClassIdIfNonLocal: java/lang/String + isPrimary: false + origin: JAVA + symbolKind: MEMBER + type: java/lang/String + valueParameters: [KtFirConstructorValueParameterSymbol(ascii), KtFirConstructorValueParameterSymbol(hibyte)] + visibility: PUBLIC + +KtFirConstructorSymbol: + annotations: [] + containingClassIdIfNonLocal: java/lang/String + isPrimary: false + origin: JAVA + symbolKind: MEMBER + type: java/lang/String + valueParameters: [KtFirConstructorValueParameterSymbol(bytes), KtFirConstructorValueParameterSymbol(offset), KtFirConstructorValueParameterSymbol(length), KtFirConstructorValueParameterSymbol(charsetName)] + visibility: PUBLIC + +KtFirConstructorSymbol: + annotations: [] + containingClassIdIfNonLocal: java/lang/String + isPrimary: false + origin: JAVA + symbolKind: MEMBER + type: java/lang/String + valueParameters: [KtFirConstructorValueParameterSymbol(bytes), KtFirConstructorValueParameterSymbol(offset), KtFirConstructorValueParameterSymbol(length), KtFirConstructorValueParameterSymbol(charset)] + visibility: PUBLIC + +KtFirConstructorSymbol: + annotations: [] + containingClassIdIfNonLocal: java/lang/String + isPrimary: false + origin: JAVA + symbolKind: MEMBER + type: java/lang/String + valueParameters: [KtFirConstructorValueParameterSymbol(bytes), KtFirConstructorValueParameterSymbol(charsetName)] + visibility: PUBLIC + +KtFirConstructorSymbol: + annotations: [] + containingClassIdIfNonLocal: java/lang/String + isPrimary: false + origin: JAVA + symbolKind: MEMBER + type: java/lang/String + valueParameters: [KtFirConstructorValueParameterSymbol(bytes), KtFirConstructorValueParameterSymbol(charset)] + visibility: PUBLIC + +KtFirConstructorSymbol: + annotations: [] + containingClassIdIfNonLocal: java/lang/String + isPrimary: false + origin: JAVA + symbolKind: MEMBER + type: java/lang/String + valueParameters: [KtFirConstructorValueParameterSymbol(bytes), KtFirConstructorValueParameterSymbol(offset), KtFirConstructorValueParameterSymbol(length)] + visibility: PUBLIC + +KtFirConstructorSymbol: + annotations: [] + containingClassIdIfNonLocal: java/lang/String + isPrimary: false + origin: JAVA + symbolKind: MEMBER + type: java/lang/String + valueParameters: [KtFirConstructorValueParameterSymbol(bytes)] + visibility: PUBLIC + +KtFirConstructorSymbol: + annotations: [] + containingClassIdIfNonLocal: java/lang/String + isPrimary: false + origin: JAVA + symbolKind: MEMBER + type: java/lang/String + valueParameters: [KtFirConstructorValueParameterSymbol(buffer)] + visibility: PUBLIC + +KtFirConstructorSymbol: + annotations: [] + containingClassIdIfNonLocal: java/lang/String + isPrimary: false + origin: JAVA + symbolKind: MEMBER + type: java/lang/String + valueParameters: [KtFirConstructorValueParameterSymbol(builder)] + visibility: PUBLIC + +KtFirConstructorSymbol: + annotations: [] + containingClassIdIfNonLocal: java/lang/String + isPrimary: false + origin: JAVA + symbolKind: MEMBER + type: java/lang/String + valueParameters: [KtFirConstructorValueParameterSymbol(value), KtFirConstructorValueParameterSymbol(share)] + visibility: UNKNOWN + +KtFirConstructorSymbol: + annotations: [java/lang/Deprecated()] + containingClassIdIfNonLocal: java/lang/String + isPrimary: false + origin: JAVA + symbolKind: MEMBER + type: java/lang/String + valueParameters: [KtFirConstructorValueParameterSymbol(offset), KtFirConstructorValueParameterSymbol(count), KtFirConstructorValueParameterSymbol(value)] + visibility: UNKNOWN + KtFirFunctionSymbol: annotations: [] callableIdIfNonLocal: kotlin.CharSequence.get diff --git a/idea/idea-frontend-fir/testData/symbolPointer/memberProperties.kt b/idea/idea-frontend-fir/testData/symbolPointer/memberProperties.kt index bc9f218df98..6c22be81a06 100644 --- a/idea/idea-frontend-fir/testData/symbolPointer/memberProperties.kt +++ b/idea/idea-frontend-fir/testData/symbolPointer/memberProperties.kt @@ -9,8 +9,10 @@ KtFirPropertySymbol: callableIdIfNonLocal: A.x getter: KtFirPropertyGetterSymbol() hasBackingField: true + initializer: 10 isConst: false isExtension: false + isLateInit: false isOverride: false isVal: true modality: FINAL @@ -23,6 +25,7 @@ KtFirPropertySymbol: visibility: PUBLIC KtFirPropertyGetterSymbol: + hasBody: true isDefault: false isInline: false isOverride: false @@ -37,8 +40,10 @@ KtFirPropertySymbol: callableIdIfNonLocal: A.y getter: KtFirPropertyGetterSymbol() hasBackingField: false + initializer: null isConst: false isExtension: true + isLateInit: false isOverride: false isVal: true modality: FINAL diff --git a/idea/idea-frontend-fir/testData/symbolPointer/topLevelProperties.kt b/idea/idea-frontend-fir/testData/symbolPointer/topLevelProperties.kt index 20890553a12..7e1b5e97679 100644 --- a/idea/idea-frontend-fir/testData/symbolPointer/topLevelProperties.kt +++ b/idea/idea-frontend-fir/testData/symbolPointer/topLevelProperties.kt @@ -7,8 +7,10 @@ KtFirPropertySymbol: callableIdIfNonLocal: x getter: KtFirPropertyGetterSymbol() hasBackingField: true + initializer: 10 isConst: false isExtension: false + isLateInit: false isOverride: false isVal: true modality: FINAL @@ -21,6 +23,7 @@ KtFirPropertySymbol: visibility: PUBLIC KtFirPropertyGetterSymbol: + hasBody: true isDefault: false isInline: false isOverride: false @@ -35,8 +38,10 @@ KtFirPropertySymbol: callableIdIfNonLocal: y getter: KtFirPropertyGetterSymbol() hasBackingField: false + initializer: null isConst: false isExtension: true + isLateInit: false isOverride: false isVal: true modality: FINAL diff --git a/idea/idea-frontend-fir/testData/symbolsByPsi/classMembes.kt b/idea/idea-frontend-fir/testData/symbolsByPsi/classMembes.kt index 314f85d4084..34c2026ef92 100644 --- a/idea/idea-frontend-fir/testData/symbolsByPsi/classMembes.kt +++ b/idea/idea-frontend-fir/testData/symbolsByPsi/classMembes.kt @@ -10,8 +10,10 @@ KtFirPropertySymbol: callableIdIfNonLocal: A.a getter: KtFirPropertyGetterSymbol() hasBackingField: true + initializer: 10 isConst: false isExtension: false + isLateInit: false isOverride: false isVal: true modality: FINAL diff --git a/idea/idea-frontend-fir/testData/symbolsByPsi/classWithTypeParams.kt b/idea/idea-frontend-fir/testData/symbolsByPsi/classWithTypeParams.kt index eb3c1af18fd..faa01f04031 100644 --- a/idea/idea-frontend-fir/testData/symbolsByPsi/classWithTypeParams.kt +++ b/idea/idea-frontend-fir/testData/symbolsByPsi/classWithTypeParams.kt @@ -6,10 +6,12 @@ class A { KtFirTypeParameterSymbol: name: T origin: SOURCE + upperBounds: [kotlin/Any?] KtFirTypeParameterSymbol: name: R origin: SOURCE + upperBounds: [kotlin/Any?] KtFirClassOrObjectSymbol: annotations: [] diff --git a/idea/idea-frontend-fir/testData/symbolsByPsi/functionWithTypeParams.kt b/idea/idea-frontend-fir/testData/symbolsByPsi/functionWithTypeParams.kt index 356bdc81ee0..adbda64cf30 100644 --- a/idea/idea-frontend-fir/testData/symbolsByPsi/functionWithTypeParams.kt +++ b/idea/idea-frontend-fir/testData/symbolsByPsi/functionWithTypeParams.kt @@ -5,6 +5,7 @@ fun foo(x: X) {} KtFirTypeParameterSymbol: name: X origin: SOURCE + upperBounds: [kotlin/Any?] KtFirFunctionValueParameterSymbol: annotations: [] diff --git a/idea/testData/findUsages/java/findConstructorUsages/secondaryConstructorByJavaNewExpression.0.java b/idea/testData/findUsages/java/findConstructorUsages/secondaryConstructorByJavaNewExpression.0.java index 6a7f22cfaa4..168972fa99a 100644 --- a/idea/testData/findUsages/java/findConstructorUsages/secondaryConstructorByJavaNewExpression.0.java +++ b/idea/testData/findUsages/java/findConstructorUsages/secondaryConstructorByJavaNewExpression.0.java @@ -9,4 +9,6 @@ public class JJ extends B { void test() { new B(""); } -} \ No newline at end of file +} + +// FIR_IGNORE \ No newline at end of file diff --git a/idea/testData/findUsages/java/findConstructorUsages/secondaryConstructorByJavaSuperCall.0.java b/idea/testData/findUsages/java/findConstructorUsages/secondaryConstructorByJavaSuperCall.0.java index 708299eafb1..c6c97ba869f 100644 --- a/idea/testData/findUsages/java/findConstructorUsages/secondaryConstructorByJavaSuperCall.0.java +++ b/idea/testData/findUsages/java/findConstructorUsages/secondaryConstructorByJavaSuperCall.0.java @@ -9,4 +9,6 @@ public class JJ extends B { void test() { new B(""); } -} \ No newline at end of file +} + +// FIR_IGNORE \ No newline at end of file diff --git a/idea/testData/findUsages/kotlin/findFunctionUsages/jvmOverloaded.0.kt b/idea/testData/findUsages/kotlin/findFunctionUsages/jvmOverloaded.0.kt index c68f727fe5b..ccfc0e681da 100644 --- a/idea/testData/findUsages/kotlin/findFunctionUsages/jvmOverloaded.0.kt +++ b/idea/testData/findUsages/kotlin/findFunctionUsages/jvmOverloaded.0.kt @@ -9,4 +9,6 @@ fun foo( z: String = "0" ) { -} \ No newline at end of file +} + +// FIR_COMPARISON \ No newline at end of file diff --git a/idea/testData/findUsages/kotlin/findPropertyUsages/kotlinNestedClassPropertyUsages.0.kt b/idea/testData/findUsages/kotlin/findPropertyUsages/kotlinNestedClassPropertyUsages.0.kt index cfe3d95c4b6..3788ecb0261 100644 --- a/idea/testData/findUsages/kotlin/findPropertyUsages/kotlinNestedClassPropertyUsages.0.kt +++ b/idea/testData/findUsages/kotlin/findPropertyUsages/kotlinNestedClassPropertyUsages.0.kt @@ -7,3 +7,5 @@ public open class Outer() { var foo: Int = 1 } } + +// FIR_COMPARISON \ No newline at end of file diff --git a/idea/testData/findUsages/kotlin/findPropertyUsages/kotlinTopLevelPropertyUsages.0.kt b/idea/testData/findUsages/kotlin/findPropertyUsages/kotlinTopLevelPropertyUsages.0.kt index 16dfefe7ed2..39f58c7aecb 100644 --- a/idea/testData/findUsages/kotlin/findPropertyUsages/kotlinTopLevelPropertyUsages.0.kt +++ b/idea/testData/findUsages/kotlin/findPropertyUsages/kotlinTopLevelPropertyUsages.0.kt @@ -4,3 +4,4 @@ package server var foo: String = "foo" +// FIR_COMPARISON diff --git a/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/AbstractIdeLightClassTest.kt b/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/AbstractIdeLightClassTest.kt index 82e7d84cffe..efe05283eae 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/AbstractIdeLightClassTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/AbstractIdeLightClassTest.kt @@ -81,8 +81,11 @@ abstract class AbstractIdeLightClassTest : KotlinLightCodeInsightFixtureTestCase private fun lazinessModeByFileText(): LightClassLazinessChecker.Mode { return testDataFile().readText().run { - val argument = substringAfter("LAZINESS:", "").substringBefore(" ") - LightClassLazinessChecker.Mode.values().firstOrNull { it.name == argument } ?: LightClassLazinessChecker.Mode.AllChecks + val argument = substringAfter("LAZINESS:", "").substringBefore('\n').substringBefore(' ') + if (argument == "") LightClassLazinessChecker.Mode.AllChecks + else requireNotNull(LightClassLazinessChecker.Mode.values().firstOrNull { it.name == argument }) { + "Invalid LAZINESS testdata parameter $argument" + } } } From 4d7b6c022b2f45844550a42018b0508381e692e5 Mon Sep 17 00:00:00 2001 From: Igor Yakovlev Date: Tue, 1 Dec 2020 23:09:00 +0300 Subject: [PATCH 391/698] [FIR IDE] LC Anonymous to SuperClass type substitution --- .../kotlin/idea/asJava/firLightUtils.kt | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/firLightUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/firLightUtils.kt index 56036b35809..18f4a28617e 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/firLightUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/firLightUtils.kt @@ -14,6 +14,7 @@ import com.intellij.util.IncorrectOperationException import org.jetbrains.kotlin.asJava.elements.KtLightElement import org.jetbrains.kotlin.asJava.elements.KtLightMember import org.jetbrains.kotlin.codegen.signature.BothSignatureWriter +import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.fir.FirSession @@ -22,6 +23,7 @@ import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.isPrimitiveType import org.jetbrains.kotlin.fir.resolve.substitution.AbstractConeSubstitutor import org.jetbrains.kotlin.fir.resolve.toSymbol +import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl @@ -83,12 +85,21 @@ private class AnonymousTypesSubstitutor(private val session: FirSession, private val isAnonymous = type.classId.let { it?.shortClassName?.asString() == SpecialNames.ANONYMOUS } if (!isAnonymous) return null - val firstSuperType = (type.lookupTag.toSymbol(session) as? FirClassSymbol)?.fir - ?.withFirDeclaration(state, FirResolvePhase.SUPER_TYPES) { - (it as? FirClass)?.superConeTypes?.firstOrNull() + fun ConeClassLikeType.isNotInterface(): Boolean { + val firClassNode = lookupTag.toSymbol(session)?.fir as? FirClass ?: return false + return firClassNode.withFirDeclaration(state) { firSuperClass -> + firSuperClass.classKind != ClassKind.INTERFACE } + } - if (firstSuperType != null) return firstSuperType + val firClassNode = (type.lookupTag.toSymbol(session) as? FirClassSymbol)?.fir + if (firClassNode != null) { + val superTypesCones = firClassNode.withFirDeclaration(state, FirResolvePhase.SUPER_TYPES) { + (it as? FirClass)?.superConeTypes + } + val superClass = superTypesCones?.firstOrNull { it.isNotInterface() } + if (superClass != null) return superClass + } return if (type.nullability.isNullable) session.builtinTypes.nullableAnyType.type else session.builtinTypes.anyType.type From 6cb573cb45a3bc4f95ade51389490bf81af36a19 Mon Sep 17 00:00:00 2001 From: pyos Date: Wed, 25 Nov 2020 11:49:35 +0100 Subject: [PATCH 392/698] [FIR] Import parents of companion objects first Otherwise, information about members moved from companion objects to the parent class (e.g. on JVM, companion object fields -> static fields in parent class) will be incorrect. --- ...mpileKotlinAgainstKotlinTestGenerated.java | 5 ++ .../KotlinDeserializedJvmSymbolsProvider.kt | 73 ++++++++++--------- .../importCompanion.kt | 16 ++++ ...mpileKotlinAgainstKotlinTestGenerated.java | 5 ++ ...mpileKotlinAgainstKotlinTestGenerated.java | 5 ++ .../ir/JvmIrAgainstOldBoxTestGenerated.java | 5 ++ .../ir/JvmOldAgainstIrBoxTestGenerated.java | 5 ++ 7 files changed, 78 insertions(+), 36 deletions(-) create mode 100644 compiler/testData/compileKotlinAgainstKotlin/importCompanion.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java index d41ae7b1e56..1f28a59acc0 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java @@ -148,6 +148,11 @@ public class FirCompileKotlinAgainstKotlinTestGenerated extends AbstractFirCompi runTest("compiler/testData/compileKotlinAgainstKotlin/expectClassActualTypeAlias.kt"); } + @TestMetadata("importCompanion.kt") + public void testImportCompanion() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/importCompanion.kt"); + } + @TestMetadata("inlineClassFromBinaryDependencies.kt") public void testInlineClassFromBinaryDependencies() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/inlineClassFromBinaryDependencies.kt"); diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/deserialization/KotlinDeserializedJvmSymbolsProvider.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/deserialization/KotlinDeserializedJvmSymbolsProvider.kt index ae5fb02ad68..8ad7c4262dc 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/deserialization/KotlinDeserializedJvmSymbolsProvider.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/deserialization/KotlinDeserializedJvmSymbolsProvider.kt @@ -39,6 +39,7 @@ import org.jetbrains.kotlin.load.kotlin.* import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinaryClass.AnnotationArrayArgumentVisitor import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader import org.jetbrains.kotlin.metadata.ProtoBuf +import org.jetbrains.kotlin.metadata.deserialization.Flags import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmMetadataVersion import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmNameResolver import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil @@ -300,6 +301,12 @@ class KotlinDeserializedJvmSymbolsProvider( return loadAnnotation(annotationClassId, result) } + private fun findAndDeserializeClassViaParent(classId: ClassId): FirRegularClassSymbol? { + val outerClassId = classId.outerClassId ?: return null + findAndDeserializeClass(outerClassId) ?: return null + return classCache[classId] + } + private fun findAndDeserializeClass( classId: ClassId, parentContext: FirDeserializationContext? = null @@ -314,7 +321,7 @@ class KotlinDeserializedJvmSymbolsProvider( } catch (e: ProcessCanceledException) { return null } - val kotlinClassWithContent = when (result) { + val (kotlinJvmBinaryClass, byteContent) = when (result) { is KotlinClassFinder.Result.KotlinClass -> result is KotlinClassFinder.Result.ClassFileContent -> { handledByJava.add(classId) @@ -324,45 +331,39 @@ class KotlinDeserializedJvmSymbolsProvider( null } } - null -> null + null -> return findAndDeserializeClassViaParent(classId) } - if (kotlinClassWithContent == null) { - val outerClassId = classId.outerClassId ?: return null - findAndDeserializeClass(outerClassId) ?: return null - } else { - val (kotlinJvmBinaryClass, byteContent) = kotlinClassWithContent + if (kotlinJvmBinaryClass.classHeader.kind != KotlinClassHeader.Kind.CLASS) return null + val (nameResolver, classProto) = kotlinJvmBinaryClass.readClassDataFrom() ?: return null - if (kotlinJvmBinaryClass.classHeader.kind != KotlinClassHeader.Kind.CLASS) return null - val (nameResolver, classProto) = kotlinJvmBinaryClass.readClassDataFrom() ?: return null - - val symbol = FirRegularClassSymbol(classId) - deserializeClassToSymbol( - classId, classProto, symbol, nameResolver, session, - JvmBinaryAnnotationDeserializer(session, kotlinJvmBinaryClass, byteContent), - kotlinScopeProvider, - parentContext, KotlinJvmBinarySourceElement(kotlinJvmBinaryClass), - this::findAndDeserializeClass - ) - - classCache[classId] = symbol - val annotations = mutableListOf() - kotlinJvmBinaryClass.loadClassAnnotations( - object : KotlinJvmBinaryClass.AnnotationVisitor { - override fun visitAnnotation(classId: ClassId, source: SourceElement): KotlinJvmBinaryClass.AnnotationArgumentVisitor? { - return loadAnnotationIfNotSpecial(classId, annotations) - } - - override fun visitEnd() { - } - - - }, - byteContent, - ) - (symbol.fir.annotations as MutableList) += annotations + if (parentContext == null && Flags.CLASS_KIND.get(classProto.flags) == ProtoBuf.Class.Kind.COMPANION_OBJECT) { + return findAndDeserializeClassViaParent(classId) } - return classCache[classId] + val symbol = FirRegularClassSymbol(classId) + deserializeClassToSymbol( + classId, classProto, symbol, nameResolver, session, + JvmBinaryAnnotationDeserializer(session, kotlinJvmBinaryClass, byteContent), + kotlinScopeProvider, + parentContext, KotlinJvmBinarySourceElement(kotlinJvmBinaryClass), + this::findAndDeserializeClass + ) + + classCache[classId] = symbol + val annotations = mutableListOf() + kotlinJvmBinaryClass.loadClassAnnotations( + object : KotlinJvmBinaryClass.AnnotationVisitor { + override fun visitAnnotation(classId: ClassId, source: SourceElement): KotlinJvmBinaryClass.AnnotationArgumentVisitor? { + return loadAnnotationIfNotSpecial(classId, annotations) + } + + override fun visitEnd() { + } + }, + byteContent, + ) + (symbol.fir.annotations as MutableList) += annotations + return symbol } private fun loadFunctionsByName(part: PackagePartsCacheData, name: Name): List> { diff --git a/compiler/testData/compileKotlinAgainstKotlin/importCompanion.kt b/compiler/testData/compileKotlinAgainstKotlin/importCompanion.kt new file mode 100644 index 00000000000..4309b9a7fb8 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstKotlin/importCompanion.kt @@ -0,0 +1,16 @@ +// WITH_RUNTIME +// TARGET_BACKEND: JVM +// FILE: 1.kt +package test + +class C(val x: String) { + companion object { + @JvmField + val instance: C = C("OK") + } +} + +// FILE: 2.kt +import test.C.Companion.instance + +fun box() = instance.x diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java index 1f60f98cec2..334e1f82531 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java @@ -153,6 +153,11 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl runTest("compiler/testData/compileKotlinAgainstKotlin/expectClassActualTypeAlias.kt"); } + @TestMetadata("importCompanion.kt") + public void testImportCompanion() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/importCompanion.kt"); + } + @TestMetadata("inlineClassFromBinaryDependencies.kt") public void testInlineClassFromBinaryDependencies() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/inlineClassFromBinaryDependencies.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java index 84dae421148..a7fcd65d271 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java @@ -148,6 +148,11 @@ public class IrCompileKotlinAgainstKotlinTestGenerated extends AbstractIrCompile runTest("compiler/testData/compileKotlinAgainstKotlin/expectClassActualTypeAlias.kt"); } + @TestMetadata("importCompanion.kt") + public void testImportCompanion() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/importCompanion.kt"); + } + @TestMetadata("inlineClassFromBinaryDependencies.kt") public void testInlineClassFromBinaryDependencies() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/inlineClassFromBinaryDependencies.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java index c7ce5ddf727..b00353dd020 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java @@ -148,6 +148,11 @@ public class JvmIrAgainstOldBoxTestGenerated extends AbstractJvmIrAgainstOldBoxT runTest("compiler/testData/compileKotlinAgainstKotlin/expectClassActualTypeAlias.kt"); } + @TestMetadata("importCompanion.kt") + public void testImportCompanion() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/importCompanion.kt"); + } + @TestMetadata("inlineClassFromBinaryDependencies.kt") public void testInlineClassFromBinaryDependencies() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/inlineClassFromBinaryDependencies.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java index 5316aff8a28..0ac43e5c1dc 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java @@ -148,6 +148,11 @@ public class JvmOldAgainstIrBoxTestGenerated extends AbstractJvmOldAgainstIrBoxT runTest("compiler/testData/compileKotlinAgainstKotlin/expectClassActualTypeAlias.kt"); } + @TestMetadata("importCompanion.kt") + public void testImportCompanion() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/importCompanion.kt"); + } + @TestMetadata("inlineClassFromBinaryDependencies.kt") public void testInlineClassFromBinaryDependencies() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/inlineClassFromBinaryDependencies.kt"); From 697b2b02f15858281eaafe2993a941dde37eaf88 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Tue, 24 Nov 2020 17:19:15 +0300 Subject: [PATCH 393/698] [JS IR] Add properties lazy initialization with multiple modules [JS IR] Move tests into compiler/testData [JS IR] Add cyclic dependencies with lazy property initialization [JS IR] Add test on not initialization in case of call non properties (classed, objects, enum classes, const vals) [JS IR] Add initialization through top level [JS IR] Ignore enum getInstance function in property lazy initialization [JS IR] Use let function with useful result instead of pure apply and also [JS IR] Remove duplicated tests in js.translator --- .../ir/FirBlackBoxCodegenTestGenerated.java | 25 ++++++++++++ .../js/lower/PropertyLazyInitLowering.kt | 19 ++++++++- .../box/properties}/lazyInitialization.kt | 0 .../lazyInitializationCyclicImports.kt | 39 ++++++++++++++++++ .../lazyInitializationMultiModule.kt | 10 +++++ .../properties}/lazyInitializationOrder.kt | 0 .../box/properties}/lazyInitializationPure.kt | 14 ++++--- .../lazyInitializationSplitPerModule.kt | 0 .../lazyInitializationThroughTopFun.kt | 17 ++++++++ ...InitializationLazilyOnNonPropertiesCall.kt | 38 ++++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 25 ++++++++++++ .../LightAnalysisModeTestGenerated.java | 25 ++++++++++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 25 ++++++++++++ .../semantics/IrBoxJsES6TestGenerated.java | 20 ---------- .../IrJsCodegenBoxES6TestGenerated.java | 40 +++++++++++++++++++ .../ir/semantics/IrBoxJsTestGenerated.java | 20 ---------- .../IrJsCodegenBoxTestGenerated.java | 40 +++++++++++++++++++ .../js/test/semantics/BoxJsTestGenerated.java | 20 ---------- .../semantics/JsCodegenBoxTestGenerated.java | 25 ++++++++++++ 19 files changed, 335 insertions(+), 67 deletions(-) rename {js/js.translator/testData/box/propertyAccess => compiler/testData/codegen/box/properties}/lazyInitialization.kt (100%) create mode 100644 compiler/testData/codegen/box/properties/lazyInitializationCyclicImports.kt create mode 100644 compiler/testData/codegen/box/properties/lazyInitializationMultiModule.kt rename {js/js.translator/testData/box/propertyAccess => compiler/testData/codegen/box/properties}/lazyInitializationOrder.kt (100%) rename {js/js.translator/testData/box/propertyAccess => compiler/testData/codegen/box/properties}/lazyInitializationPure.kt (76%) rename {js/js.translator/testData/box/propertyAccess => compiler/testData/codegen/box/properties}/lazyInitializationSplitPerModule.kt (100%) create mode 100644 compiler/testData/codegen/box/properties/lazyInitializationThroughTopFun.kt create mode 100644 compiler/testData/codegen/box/properties/noInitializationLazilyOnNonPropertiesCall.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 3c42afe85b9..c3ecd508ed8 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -21468,6 +21468,31 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/properties/kt9603.kt"); } + @TestMetadata("lazyInitialization.kt") + public void testLazyInitialization() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitialization.kt"); + } + + @TestMetadata("lazyInitializationCyclicImports.kt") + public void testLazyInitializationCyclicImports() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationCyclicImports.kt"); + } + + @TestMetadata("lazyInitializationMultiModule.kt") + public void testLazyInitializationMultiModule() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationMultiModule.kt"); + } + + @TestMetadata("lazyInitializationOrder.kt") + public void testLazyInitializationOrder() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationOrder.kt"); + } + + @TestMetadata("lazyInitializationSplitPerModule.kt") + public void testLazyInitializationSplitPerModule() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationSplitPerModule.kt"); + } + @TestMetadata("primitiveOverrideDefaultAccessor.kt") public void testPrimitiveOverrideDefaultAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/primitiveOverrideDefaultAccessor.kt"); diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt index 55a9253af4e..3b186528117 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt @@ -47,9 +47,11 @@ class PropertyLazyInitLowering( return } - if (container !is IrSimpleFunction && container !is IrField && container !is IrProperty) + if (container !is IrField && container !is IrSimpleFunction && container !is IrProperty) return + if (container.origin !in compatibleOrigins) return + val file = container.parent as? IrFile ?: return @@ -224,6 +226,8 @@ class RemoveInitializersForLazyProperties( if (declaration !is IrField) return null + if (!declaration.isCompatibleDeclaration()) return null + val file = declaration.parent as? IrFile ?: return null if (fileToInitializerPureness[file] == true) return null @@ -257,6 +261,7 @@ class RemoveInitializersForLazyProperties( private fun calculateFieldToExpression(declarations: Collection): Map = declarations .asSequence() + .filter { it.isCompatibleDeclaration() } .map { it.correspondingProperty } .filterNotNull() .filter { it.isForLazyInit() } @@ -288,4 +293,14 @@ private val IrDeclaration.correspondingProperty: IrProperty? private fun IrDeclaration.propertyWithPersistentSafe(transform: IrDeclaration.() -> IrProperty?): IrProperty? = if (((this as? PersistentIrElementBase<*>)?.createdOn ?: 0) <= stageController.currentStage) { transform() - } else null \ No newline at end of file + } else null + +private fun IrDeclaration.isCompatibleDeclaration() = + origin in compatibleOrigins + +private val compatibleOrigins = listOf( + IrDeclarationOrigin.DEFINED, + IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR, + IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR, + IrDeclarationOrigin.PROPERTY_BACKING_FIELD, +) \ No newline at end of file diff --git a/js/js.translator/testData/box/propertyAccess/lazyInitialization.kt b/compiler/testData/codegen/box/properties/lazyInitialization.kt similarity index 100% rename from js/js.translator/testData/box/propertyAccess/lazyInitialization.kt rename to compiler/testData/codegen/box/properties/lazyInitialization.kt diff --git a/compiler/testData/codegen/box/properties/lazyInitializationCyclicImports.kt b/compiler/testData/codegen/box/properties/lazyInitializationCyclicImports.kt new file mode 100644 index 00000000000..6658d2a68b2 --- /dev/null +++ b/compiler/testData/codegen/box/properties/lazyInitializationCyclicImports.kt @@ -0,0 +1,39 @@ +// IGNORE_BACKEND: JS +// DONT_TARGET_EXACT_BACKEND: WASM +// PROPERTY_LAZY_INITIALIZATION + +// FILE: A.kt +var log = "" + +val a1 = "a".also { + log += "a1" +} +val b1 = a2.also { + log += "b1" +} +val c1 = a3.also { + log += "c1" +} + +// FILE: B.kt +val a2 = a1.also { + log += "a2" +} +val b2 = "b".also { + log += "b2" +} + +// FILE: C.kt +val a3 = b1.also { + log += "a3" +} +val b3 = b2.also { + log += "b3" +} +val c3 = "c".also { + log += "c3" +} + +// FILE: main.kt + +fun box(): String = if (log == "a1a2b2b1a3b3c3c1") "OK" else "fail: $log" \ No newline at end of file diff --git a/compiler/testData/codegen/box/properties/lazyInitializationMultiModule.kt b/compiler/testData/codegen/box/properties/lazyInitializationMultiModule.kt new file mode 100644 index 00000000000..760168d7f46 --- /dev/null +++ b/compiler/testData/codegen/box/properties/lazyInitializationMultiModule.kt @@ -0,0 +1,10 @@ +// DONT_TARGET_EXACT_BACKEND: WASM +// PROPERTY_LAZY_INITIALIZATION + +// MODULE: lib1 +var log = "" +val a = 1.also { log += "a" } +val b = 2.also { log += "b" } + +// MODULE: main(lib1) +fun box(): String = if (log + a == "ab1") "OK" else "fail" \ No newline at end of file diff --git a/js/js.translator/testData/box/propertyAccess/lazyInitializationOrder.kt b/compiler/testData/codegen/box/properties/lazyInitializationOrder.kt similarity index 100% rename from js/js.translator/testData/box/propertyAccess/lazyInitializationOrder.kt rename to compiler/testData/codegen/box/properties/lazyInitializationOrder.kt diff --git a/js/js.translator/testData/box/propertyAccess/lazyInitializationPure.kt b/compiler/testData/codegen/box/properties/lazyInitializationPure.kt similarity index 76% rename from js/js.translator/testData/box/propertyAccess/lazyInitializationPure.kt rename to compiler/testData/codegen/box/properties/lazyInitializationPure.kt index c0f377a5c91..2600f4e6483 100644 --- a/js/js.translator/testData/box/propertyAccess/lazyInitializationPure.kt +++ b/compiler/testData/codegen/box/properties/lazyInitializationPure.kt @@ -1,4 +1,4 @@ -// IGNORE_BACKEND: JS +// TARGET_BACKEND: JS_IR // PROPERTY_LAZY_INITIALIZATION // FILE: A.kt @@ -6,12 +6,16 @@ val a = "A" // FILE: B.kt -val b = "B".apply {} +val b = "B".let { + it + "B" +} val c = b // FILE: C.kt -val d = "D".apply {} +val d = "D".let { + it + "D" +} val e = d @@ -24,8 +28,8 @@ fun box(): String { js("a") === "A" && js("typeof b") == "undefined" && js("typeof c") == "undefined" && - js("d") === "D" && - js("e") === "D" + js("d") === "DD" && + js("e") === "DD" ) "OK" else "a = ${js("a")}; typeof b = ${js("typeof b")}; typeof c = ${js("typeof c")}; d = ${js("d")}; e = ${js("e")}" diff --git a/js/js.translator/testData/box/propertyAccess/lazyInitializationSplitPerModule.kt b/compiler/testData/codegen/box/properties/lazyInitializationSplitPerModule.kt similarity index 100% rename from js/js.translator/testData/box/propertyAccess/lazyInitializationSplitPerModule.kt rename to compiler/testData/codegen/box/properties/lazyInitializationSplitPerModule.kt diff --git a/compiler/testData/codegen/box/properties/lazyInitializationThroughTopFun.kt b/compiler/testData/codegen/box/properties/lazyInitializationThroughTopFun.kt new file mode 100644 index 00000000000..e3bf52a3cf9 --- /dev/null +++ b/compiler/testData/codegen/box/properties/lazyInitializationThroughTopFun.kt @@ -0,0 +1,17 @@ +// TARGET_BACKEND: JS_IR +// DONT_TARGET_EXACT_BACKEND: WASM +// PROPERTY_LAZY_INITIALIZATION + +// FILE: A.kt +val a = "a".let { + it + "a" +} + +fun foo() = + 2 + 2 + +// FILE: main.kt +fun box(): String { + val foo = foo() + return if (js("typeof a") == "string" && js("a") == "aa") "OK" else "fail" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/properties/noInitializationLazilyOnNonPropertiesCall.kt b/compiler/testData/codegen/box/properties/noInitializationLazilyOnNonPropertiesCall.kt new file mode 100644 index 00000000000..d0aceeec2e5 --- /dev/null +++ b/compiler/testData/codegen/box/properties/noInitializationLazilyOnNonPropertiesCall.kt @@ -0,0 +1,38 @@ +// TARGET_BACKEND: JS_IR +// DONT_TARGET_EXACT_BACKEND: WASM +// PROPERTY_LAZY_INITIALIZATION + +// FILE: A.kt +val a1 = "a".let { + it + "a" +} + +object A { + private val foo = "foo" + val foo2 = foo + val ok = "OK" +} + +class B(private val foo: String) { + val ok = foo + + constructor(arg: Int) : this(arg.toString()) +} + +enum class C { + OK +} + +const val b = "b" + +// FILE: main.kt +fun box(): String { + val foo = A.ok + val bar = B("foo").ok + val bay = B(1).ok + C.OK + C.values() + C.valueOf("OK") + val baz = b + return if (js("typeof a1") == "undefined") "OK" else "fail" +} \ No newline at end of file diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 42fc63227c8..621a623ddbe 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -23239,6 +23239,31 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/properties/kt9603.kt"); } + @TestMetadata("lazyInitialization.kt") + public void testLazyInitialization() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitialization.kt"); + } + + @TestMetadata("lazyInitializationCyclicImports.kt") + public void testLazyInitializationCyclicImports() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationCyclicImports.kt"); + } + + @TestMetadata("lazyInitializationMultiModule.kt") + public void testLazyInitializationMultiModule() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationMultiModule.kt"); + } + + @TestMetadata("lazyInitializationOrder.kt") + public void testLazyInitializationOrder() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationOrder.kt"); + } + + @TestMetadata("lazyInitializationSplitPerModule.kt") + public void testLazyInitializationSplitPerModule() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationSplitPerModule.kt"); + } + @TestMetadata("primitiveOverrideDefaultAccessor.kt") public void testPrimitiveOverrideDefaultAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/primitiveOverrideDefaultAccessor.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 9ae4d250d51..6f4a70523f5 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -23244,6 +23244,31 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/properties/kt9603.kt"); } + @TestMetadata("lazyInitialization.kt") + public void testLazyInitialization() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitialization.kt"); + } + + @TestMetadata("lazyInitializationCyclicImports.kt") + public void testLazyInitializationCyclicImports() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationCyclicImports.kt"); + } + + @TestMetadata("lazyInitializationMultiModule.kt") + public void testLazyInitializationMultiModule() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationMultiModule.kt"); + } + + @TestMetadata("lazyInitializationOrder.kt") + public void testLazyInitializationOrder() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationOrder.kt"); + } + + @TestMetadata("lazyInitializationSplitPerModule.kt") + public void testLazyInitializationSplitPerModule() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationSplitPerModule.kt"); + } + @TestMetadata("primitiveOverrideDefaultAccessor.kt") public void testPrimitiveOverrideDefaultAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/primitiveOverrideDefaultAccessor.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 0504e65b75f..9c988ade812 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -21468,6 +21468,31 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/properties/kt9603.kt"); } + @TestMetadata("lazyInitialization.kt") + public void testLazyInitialization() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitialization.kt"); + } + + @TestMetadata("lazyInitializationCyclicImports.kt") + public void testLazyInitializationCyclicImports() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationCyclicImports.kt"); + } + + @TestMetadata("lazyInitializationMultiModule.kt") + public void testLazyInitializationMultiModule() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationMultiModule.kt"); + } + + @TestMetadata("lazyInitializationOrder.kt") + public void testLazyInitializationOrder() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationOrder.kt"); + } + + @TestMetadata("lazyInitializationSplitPerModule.kt") + public void testLazyInitializationSplitPerModule() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationSplitPerModule.kt"); + } + @TestMetadata("primitiveOverrideDefaultAccessor.kt") public void testPrimitiveOverrideDefaultAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/primitiveOverrideDefaultAccessor.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java index 4c043c4bc37..f7cd3292d61 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java @@ -6786,26 +6786,6 @@ public class IrBoxJsES6TestGenerated extends AbstractIrBoxJsES6Test { runTest("js/js.translator/testData/box/propertyAccess/initValInConstructor.kt"); } - @TestMetadata("lazyInitialization.kt") - public void testLazyInitialization() throws Exception { - runTest("js/js.translator/testData/box/propertyAccess/lazyInitialization.kt"); - } - - @TestMetadata("lazyInitializationOrder.kt") - public void testLazyInitializationOrder() throws Exception { - runTest("js/js.translator/testData/box/propertyAccess/lazyInitializationOrder.kt"); - } - - @TestMetadata("lazyInitializationPure.kt") - public void testLazyInitializationPure() throws Exception { - runTest("js/js.translator/testData/box/propertyAccess/lazyInitializationPure.kt"); - } - - @TestMetadata("lazyInitializationSplitPerModule.kt") - public void testLazyInitializationSplitPerModule() throws Exception { - runTest("js/js.translator/testData/box/propertyAccess/lazyInitializationSplitPerModule.kt"); - } - @TestMetadata("overloadedOverriddenFunctionPropertyName.kt") public void testOverloadedOverriddenFunctionPropertyName() throws Exception { runTest("js/js.translator/testData/box/propertyAccess/overloadedOverriddenFunctionPropertyName.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index d59779ba6cb..dac3666dac3 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -17709,6 +17709,46 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/properties/kt9603.kt"); } + @TestMetadata("lazyInitialization.kt") + public void testLazyInitialization() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitialization.kt"); + } + + @TestMetadata("lazyInitializationCyclicImports.kt") + public void testLazyInitializationCyclicImports() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationCyclicImports.kt"); + } + + @TestMetadata("lazyInitializationMultiModule.kt") + public void testLazyInitializationMultiModule() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationMultiModule.kt"); + } + + @TestMetadata("lazyInitializationOrder.kt") + public void testLazyInitializationOrder() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationOrder.kt"); + } + + @TestMetadata("lazyInitializationPure.kt") + public void testLazyInitializationPure() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationPure.kt"); + } + + @TestMetadata("lazyInitializationSplitPerModule.kt") + public void testLazyInitializationSplitPerModule() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationSplitPerModule.kt"); + } + + @TestMetadata("lazyInitializationThroughTopFun.kt") + public void testLazyInitializationThroughTopFun() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationThroughTopFun.kt"); + } + + @TestMetadata("noInitializationLazilyOnNonPropertiesCall.kt") + public void testNoInitializationLazilyOnNonPropertiesCall() throws Exception { + runTest("compiler/testData/codegen/box/properties/noInitializationLazilyOnNonPropertiesCall.kt"); + } + @TestMetadata("primitiveOverrideDefaultAccessor.kt") public void testPrimitiveOverrideDefaultAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/primitiveOverrideDefaultAccessor.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java index b11a56171c3..b60b98a4a55 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java @@ -6786,26 +6786,6 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest { runTest("js/js.translator/testData/box/propertyAccess/initValInConstructor.kt"); } - @TestMetadata("lazyInitialization.kt") - public void testLazyInitialization() throws Exception { - runTest("js/js.translator/testData/box/propertyAccess/lazyInitialization.kt"); - } - - @TestMetadata("lazyInitializationOrder.kt") - public void testLazyInitializationOrder() throws Exception { - runTest("js/js.translator/testData/box/propertyAccess/lazyInitializationOrder.kt"); - } - - @TestMetadata("lazyInitializationPure.kt") - public void testLazyInitializationPure() throws Exception { - runTest("js/js.translator/testData/box/propertyAccess/lazyInitializationPure.kt"); - } - - @TestMetadata("lazyInitializationSplitPerModule.kt") - public void testLazyInitializationSplitPerModule() throws Exception { - runTest("js/js.translator/testData/box/propertyAccess/lazyInitializationSplitPerModule.kt"); - } - @TestMetadata("overloadedOverriddenFunctionPropertyName.kt") public void testOverloadedOverriddenFunctionPropertyName() throws Exception { runTest("js/js.translator/testData/box/propertyAccess/overloadedOverriddenFunctionPropertyName.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 13393d52079..3d82eb44618 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -17709,6 +17709,46 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/properties/kt9603.kt"); } + @TestMetadata("lazyInitialization.kt") + public void testLazyInitialization() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitialization.kt"); + } + + @TestMetadata("lazyInitializationCyclicImports.kt") + public void testLazyInitializationCyclicImports() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationCyclicImports.kt"); + } + + @TestMetadata("lazyInitializationMultiModule.kt") + public void testLazyInitializationMultiModule() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationMultiModule.kt"); + } + + @TestMetadata("lazyInitializationOrder.kt") + public void testLazyInitializationOrder() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationOrder.kt"); + } + + @TestMetadata("lazyInitializationPure.kt") + public void testLazyInitializationPure() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationPure.kt"); + } + + @TestMetadata("lazyInitializationSplitPerModule.kt") + public void testLazyInitializationSplitPerModule() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationSplitPerModule.kt"); + } + + @TestMetadata("lazyInitializationThroughTopFun.kt") + public void testLazyInitializationThroughTopFun() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationThroughTopFun.kt"); + } + + @TestMetadata("noInitializationLazilyOnNonPropertiesCall.kt") + public void testNoInitializationLazilyOnNonPropertiesCall() throws Exception { + runTest("compiler/testData/codegen/box/properties/noInitializationLazilyOnNonPropertiesCall.kt"); + } + @TestMetadata("primitiveOverrideDefaultAccessor.kt") public void testPrimitiveOverrideDefaultAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/primitiveOverrideDefaultAccessor.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java index c70a9f1fb0c..313c401b07b 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java @@ -6816,26 +6816,6 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest { runTest("js/js.translator/testData/box/propertyAccess/initValInConstructor.kt"); } - @TestMetadata("lazyInitialization.kt") - public void testLazyInitialization() throws Exception { - runTest("js/js.translator/testData/box/propertyAccess/lazyInitialization.kt"); - } - - @TestMetadata("lazyInitializationOrder.kt") - public void testLazyInitializationOrder() throws Exception { - runTest("js/js.translator/testData/box/propertyAccess/lazyInitializationOrder.kt"); - } - - @TestMetadata("lazyInitializationPure.kt") - public void testLazyInitializationPure() throws Exception { - runTest("js/js.translator/testData/box/propertyAccess/lazyInitializationPure.kt"); - } - - @TestMetadata("lazyInitializationSplitPerModule.kt") - public void testLazyInitializationSplitPerModule() throws Exception { - runTest("js/js.translator/testData/box/propertyAccess/lazyInitializationSplitPerModule.kt"); - } - @TestMetadata("overloadedOverriddenFunctionPropertyName.kt") public void testOverloadedOverriddenFunctionPropertyName() throws Exception { runTest("js/js.translator/testData/box/propertyAccess/overloadedOverriddenFunctionPropertyName.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index d2a6e694242..f61dfa989cc 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -17814,6 +17814,31 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/properties/kt9603.kt"); } + @TestMetadata("lazyInitialization.kt") + public void testLazyInitialization() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitialization.kt"); + } + + @TestMetadata("lazyInitializationCyclicImports.kt") + public void testLazyInitializationCyclicImports() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationCyclicImports.kt"); + } + + @TestMetadata("lazyInitializationMultiModule.kt") + public void testLazyInitializationMultiModule() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationMultiModule.kt"); + } + + @TestMetadata("lazyInitializationOrder.kt") + public void testLazyInitializationOrder() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationOrder.kt"); + } + + @TestMetadata("lazyInitializationSplitPerModule.kt") + public void testLazyInitializationSplitPerModule() throws Exception { + runTest("compiler/testData/codegen/box/properties/lazyInitializationSplitPerModule.kt"); + } + @TestMetadata("primitiveOverrideDefaultAccessor.kt") public void testPrimitiveOverrideDefaultAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/primitiveOverrideDefaultAccessor.kt"); From 988cc521741c87b8d4e2067ec479f626fa912cef Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Thu, 19 Nov 2020 21:42:46 +0100 Subject: [PATCH 394/698] JVM IR: do not use origin DEFAULT_IMPLS_BRIDGE_FOR_COMPATIBILITY(_SYNTHETIC) It was only used to generate deprecation in codegen, but it's annotated with `javaLangDeprecatedConstructorWithDeprecatedFlag`, and a similar annotation for IrField results in ACC_DEPRECATED. Adapt codegen to generate this flag for functions too. --- .../backend/jvm/JvmCachedDeclarations.kt | 20 ++++---- ...gins.kt => JvmLoweredDeclarationOrigin.kt} | 2 - .../backend/jvm/codegen/ClassCodegen.kt | 9 +--- .../backend/jvm/codegen/CoroutineCodegen.kt | 3 -- .../backend/jvm/codegen/FunctionCodegen.kt | 4 +- .../jvm/codegen/JvmSignatureClashDetector.kt | 2 - .../backend/jvm/codegen/irCodegenUtils.kt | 47 +++++++++---------- .../jvm/lower/AddContinuationLowering.kt | 2 - ...nheritedDefaultMethodsOnClassesLowering.kt | 4 +- 9 files changed, 36 insertions(+), 57 deletions(-) rename compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/{DeclarationOrigins.kt => JvmLoweredDeclarationOrigin.kt} (94%) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmCachedDeclarations.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmCachedDeclarations.kt index 0bf2f646eda..a040bf7c11a 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmCachedDeclarations.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmCachedDeclarations.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.backend.jvm import org.jetbrains.kotlin.backend.common.ir.copyParameterDeclarationsFrom import org.jetbrains.kotlin.backend.common.ir.createImplicitParameterDeclarationWithWrappedDescriptor import org.jetbrains.kotlin.backend.common.ir.createStaticFunctionWithReceivers +import org.jetbrains.kotlin.backend.jvm.codegen.AnnotationCodegen.Companion.annotationClass import org.jetbrains.kotlin.backend.jvm.codegen.isJvmInterface import org.jetbrains.kotlin.backend.jvm.ir.copyCorrespondingPropertyFrom import org.jetbrains.kotlin.backend.jvm.ir.createJvmIrBuilder @@ -167,15 +168,9 @@ class JvmCachedDeclarations( JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_WITH_MOVED_RECEIVERS } interfaceFun.resolveFakeOverride()!!.origin.isSynthetic -> - if (forCompatibilityMode) - JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_FOR_COMPATIBILITY_SYNTHETIC - else - JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_TO_SYNTHETIC + JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_TO_SYNTHETIC else -> - if (forCompatibilityMode) - JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_FOR_COMPATIBILITY - else - JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE + JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE } // Interface functions are public or private, with one exception: clone in Cloneable, which is protected. @@ -198,11 +193,12 @@ class JvmCachedDeclarations( typeParametersFromContext = parent.typeParameters ).also { it.copyCorrespondingPropertyFrom(interfaceFun) - if (it.origin == JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_FOR_COMPATIBILITY && - !it.annotations.hasAnnotation(DeprecationResolver.JAVA_DEPRECATED) - ) { + + if (forCompatibilityMode && !interfaceFun.resolveFakeOverride()!!.origin.isSynthetic) { context.createJvmIrBuilder(it.symbol).run { - it.annotations += irCall(irSymbols.javaLangDeprecatedConstructorWithDeprecatedFlag) + it.annotations = it.annotations + .filterNot { it.annotationClass.hasEqualFqName(DeprecationResolver.JAVA_DEPRECATED) } + .plus(irCall(irSymbols.javaLangDeprecatedConstructorWithDeprecatedFlag)) } } diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/DeclarationOrigins.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLoweredDeclarationOrigin.kt similarity index 94% rename from compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/DeclarationOrigins.kt rename to compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLoweredDeclarationOrigin.kt index df9079d9a83..b10889cdead 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/DeclarationOrigins.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLoweredDeclarationOrigin.kt @@ -15,9 +15,7 @@ interface JvmLoweredDeclarationOrigin : IrDeclarationOrigin { object DEFAULT_IMPLS_WITH_MOVED_RECEIVERS_SYNTHETIC : IrDeclarationOriginImpl("STATIC_WITH_MOVED_RECEIVERS_SYNTHETIC", isSynthetic = true) object DEFAULT_IMPLS_BRIDGE : IrDeclarationOriginImpl("DEFAULT_IMPLS_BRIDGE") - object DEFAULT_IMPLS_BRIDGE_FOR_COMPATIBILITY : IrDeclarationOriginImpl("DEFAULT_IMPLS_BRIDGE_FOR_COMPATIBILITY") object DEFAULT_IMPLS_BRIDGE_TO_SYNTHETIC : IrDeclarationOriginImpl("DEFAULT_IMPLS_BRIDGE_TO_SYNTHETIC", isSynthetic = true) - object DEFAULT_IMPLS_BRIDGE_FOR_COMPATIBILITY_SYNTHETIC : IrDeclarationOriginImpl("DEFAULT_IMPLS_BRIDGE_FOR_COMPATIBILITY_SYNTHETIC", isSynthetic = true) object FIELD_FOR_OUTER_THIS : IrDeclarationOriginImpl("FIELD_FOR_OUTER_THIS") object LAMBDA_IMPL : IrDeclarationOriginImpl("LAMBDA_IMPL") object FUNCTION_REFERENCE_IMPL : IrDeclarationOriginImpl("FUNCTION_REFERENCE_IMPL", isSynthetic = true) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ClassCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ClassCodegen.kt index 94096187b51..8b21ea6ce81 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ClassCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ClassCodegen.kt @@ -457,9 +457,8 @@ private val IrClass.flags: Int private fun IrField.computeFieldFlags(context: JvmBackendContext, languageVersionSettings: LanguageVersionSettings): Int = origin.flags or visibility.flags or - (if (isDeprecatedCallable || - correspondingPropertySymbol?.owner?.isDeprecatedCallable == true || - shouldHaveSpecialDeprecationFlag(context) + (if (isDeprecatedCallable(context) || + correspondingPropertySymbol?.owner?.isDeprecatedCallable(context) == true ) Opcodes.ACC_DEPRECATED else 0) or (if (isFinal) Opcodes.ACC_FINAL else 0) or (if (isStatic) Opcodes.ACC_STATIC else 0) or @@ -475,10 +474,6 @@ private fun IrField.isPrivateCompanionFieldInInterface(languageVersionSettings: parentAsClass.isJvmInterface && DescriptorVisibilities.isPrivate(parentAsClass.companionObject()!!.visibility) -fun IrField.shouldHaveSpecialDeprecationFlag(context: JvmBackendContext): Boolean { - return annotations.any { it.symbol == context.ir.symbols.javaLangDeprecatedConstructorWithDeprecatedFlag } -} - private val IrDeclarationOrigin.flags: Int get() = (if (isSynthetic) Opcodes.ACC_SYNTHETIC else 0) or (if (this == IrDeclarationOrigin.FIELD_FOR_ENUM_ENTRY) Opcodes.ACC_ENUM else 0) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/CoroutineCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/CoroutineCodegen.kt index 85851b064f8..c5cd5da6cb0 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/CoroutineCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/CoroutineCodegen.kt @@ -11,7 +11,6 @@ import org.jetbrains.kotlin.backend.common.lower.LocalDeclarationsLowering import org.jetbrains.kotlin.backend.jvm.JvmBackendContext import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin import org.jetbrains.kotlin.backend.jvm.ir.isStaticInlineClassReplacement -import org.jetbrains.kotlin.backend.jvm.lower.inlineclasses.InlineClassAbi import org.jetbrains.kotlin.backend.jvm.lower.inlineclasses.unboxInlineClass import org.jetbrains.kotlin.backend.jvm.lower.isMultifileBridge import org.jetbrains.kotlin.backend.jvm.lower.suspendFunctionOriginal @@ -147,9 +146,7 @@ internal fun IrFunction.shouldContainSuspendMarkers(): Boolean = !isInvokeSuspen origin != JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR && origin != JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR_FOR_HIDDEN_CONSTRUCTOR && origin != JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE && - origin != JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_FOR_COMPATIBILITY && origin != JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_TO_SYNTHETIC && - origin != JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_FOR_COMPATIBILITY_SYNTHETIC && origin != IrDeclarationOrigin.BRIDGE && origin != IrDeclarationOrigin.BRIDGE_SPECIAL && origin != IrDeclarationOrigin.DELEGATED_MEMBER && diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt index 4e8b58e86ae..9d49f97f540 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt @@ -146,7 +146,7 @@ class FunctionCodegen( private fun IrFunction.calculateMethodFlags(): Int { if (origin == IrDeclarationOrigin.FUNCTION_FOR_DEFAULT_PARAMETER) { return getVisibilityForDefaultArgumentStub() or Opcodes.ACC_SYNTHETIC or - (if (isDeprecatedFunction) Opcodes.ACC_DEPRECATED else 0) or + (if (isDeprecatedFunction(context)) Opcodes.ACC_DEPRECATED else 0) or (if (this is IrConstructor) 0 else Opcodes.ACC_STATIC) } @@ -173,7 +173,7 @@ class FunctionCodegen( val isSynchronized = hasAnnotation(SYNCHRONIZED_ANNOTATION_FQ_NAME) return getVisibilityAccessFlag() or modalityFlag or - (if (isDeprecatedFunction) Opcodes.ACC_DEPRECATED else 0) or + (if (isDeprecatedFunction(context)) Opcodes.ACC_DEPRECATED else 0) or (if (isStatic) Opcodes.ACC_STATIC else 0) or (if (isVararg) Opcodes.ACC_VARARGS else 0) or (if (isExternal) Opcodes.ACC_NATIVE else 0) or diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/JvmSignatureClashDetector.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/JvmSignatureClashDetector.kt index 2369b94b941..0d10f59b0bf 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/JvmSignatureClashDetector.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/JvmSignatureClashDetector.kt @@ -188,9 +188,7 @@ class JvmSignatureClashDetector( IrDeclarationOrigin.IR_BUILTINS_STUB, JvmLoweredDeclarationOrigin.TO_ARRAY, JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE, - JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_FOR_COMPATIBILITY, JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_TO_SYNTHETIC, - JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_FOR_COMPATIBILITY_SYNTHETIC ) val PREDEFINED_SIGNATURES = listOf( diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt index 42abe973335..da1885ac0f7 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt @@ -14,14 +14,13 @@ import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin import org.jetbrains.kotlin.backend.jvm.lower.MultifileFacadeFileEntry import org.jetbrains.kotlin.builtins.StandardNames.FqNames import org.jetbrains.kotlin.builtins.jvm.JavaToKotlinClassMap -import org.jetbrains.kotlin.codegen.AsmUtil -import org.jetbrains.kotlin.codegen.FrameMapBase -import org.jetbrains.kotlin.codegen.OwnerKind -import org.jetbrains.kotlin.codegen.SourceInfo -import org.jetbrains.kotlin.codegen.classFileContainsMethod +import org.jetbrains.kotlin.codegen.* import org.jetbrains.kotlin.codegen.inline.SourceMapper import org.jetbrains.kotlin.codegen.signature.BothSignatureWriter -import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.descriptors.ClassKind +import org.jetbrains.kotlin.descriptors.DeclarationDescriptorWithSource +import org.jetbrains.kotlin.descriptors.DescriptorVisibilities +import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.IrCall @@ -346,8 +345,9 @@ fun IrClass.isOptionalAnnotationClass(): Boolean = val IrDeclaration.isAnnotatedWithDeprecated: Boolean get() = annotations.hasAnnotation(FqNames.deprecated) -val IrDeclaration.isDeprecatedCallable: Boolean - get() = isAnnotatedWithDeprecated || origin == JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_FOR_COMPATIBILITY +internal fun IrDeclaration.isDeprecatedCallable(context: JvmBackendContext): Boolean = + isAnnotatedWithDeprecated || + annotations.any { it.symbol == context.ir.symbols.javaLangDeprecatedConstructorWithDeprecatedFlag } // We can't check for JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_ANNOTATIONS because for interface methods // moved to DefaultImpls, origin is changed to DEFAULT_IMPLS @@ -355,11 +355,11 @@ val IrDeclaration.isDeprecatedCallable: Boolean val IrFunction.isSyntheticMethodForProperty: Boolean get() = name.asString().endsWith(JvmAbi.ANNOTATED_PROPERTY_METHOD_NAME_SUFFIX) -val IrFunction.isDeprecatedFunction: Boolean - get() = isSyntheticMethodForProperty || isDeprecatedCallable || - (this as? IrSimpleFunction)?.correspondingPropertySymbol?.owner?.isDeprecatedCallable == true || +internal fun IrFunction.isDeprecatedFunction(context: JvmBackendContext): Boolean = + isSyntheticMethodForProperty || isDeprecatedCallable(context) || + (this as? IrSimpleFunction)?.correspondingPropertySymbol?.owner?.isDeprecatedCallable(context) == true || isAccessorForDeprecatedPropertyImplementedByDelegation || - isAccessorForDeprecatedJvmStaticProperty + isAccessorForDeprecatedJvmStaticProperty(context) private val IrFunction.isAccessorForDeprecatedPropertyImplementedByDelegation: Boolean get() = @@ -367,20 +367,19 @@ private val IrFunction.isAccessorForDeprecatedPropertyImplementedByDelegation: B this is IrSimpleFunction && correspondingPropertySymbol != null && overriddenSymbols.any { - it.owner.correspondingPropertySymbol?.owner?.isDeprecatedCallable == true + it.owner.correspondingPropertySymbol?.owner?.isAnnotatedWithDeprecated == true } -private val IrFunction.isAccessorForDeprecatedJvmStaticProperty: Boolean - get() { - if (origin != JvmLoweredDeclarationOrigin.JVM_STATIC_WRAPPER) return false - val irExpressionBody = this.body as? IrExpressionBody - ?: throw AssertionError("IrExpressionBody expected for JvmStatic wrapper:\n${this.dump()}") - val irCall = irExpressionBody.expression as? IrCall - ?: throw AssertionError("IrCall expected inside JvmStatic wrapper:\n${this.dump()}") - val callee = irCall.symbol.owner - val property = callee.correspondingPropertySymbol?.owner ?: return false - return property.isDeprecatedCallable - } +private fun IrFunction.isAccessorForDeprecatedJvmStaticProperty(context: JvmBackendContext): Boolean { + if (origin != JvmLoweredDeclarationOrigin.JVM_STATIC_WRAPPER) return false + val irExpressionBody = this.body as? IrExpressionBody + ?: throw AssertionError("IrExpressionBody expected for JvmStatic wrapper:\n${this.dump()}") + val irCall = irExpressionBody.expression as? IrCall + ?: throw AssertionError("IrCall expected inside JvmStatic wrapper:\n${this.dump()}") + val callee = irCall.symbol.owner + val property = callee.correspondingPropertySymbol?.owner ?: return false + return property.isDeprecatedCallable(context) +} @OptIn(ObsoleteDescriptorBasedAPI::class) val IrDeclaration.psiElement: PsiElement? diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt index 489d4131b10..656bc7c28c8 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt @@ -359,9 +359,7 @@ private val defaultImplsOrigins = setOf( JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_WITH_MOVED_RECEIVERS, JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_WITH_MOVED_RECEIVERS_SYNTHETIC, JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE, - JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_FOR_COMPATIBILITY, JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_TO_SYNTHETIC, - JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_FOR_COMPATIBILITY_SYNTHETIC ) private val IrSimpleFunction.isDefaultImplsFunction: Boolean diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InheritedDefaultMethodsOnClassesLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InheritedDefaultMethodsOnClassesLowering.kt index 795c0545088..bfab66ed21c 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InheritedDefaultMethodsOnClassesLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InheritedDefaultMethodsOnClassesLowering.kt @@ -262,9 +262,7 @@ private class InterfaceObjectCallsLowering(val context: JvmBackendContext) : IrE */ private fun isDefaultImplsBridge(f: IrSimpleFunction) = f.origin == JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE || - f.origin == JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_FOR_COMPATIBILITY || - f.origin == JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_TO_SYNTHETIC || - f.origin == JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_FOR_COMPATIBILITY_SYNTHETIC + f.origin == JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_TO_SYNTHETIC internal fun IrSimpleFunction.findInterfaceImplementation(jvmDefaultMode: JvmDefaultMode): IrSimpleFunction? { if (!isFakeOverride) return null From be03bc477dd764c8b134c7e99c708d96c9d9fd31 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Thu, 19 Nov 2020 22:03:59 +0100 Subject: [PATCH 395/698] JVM IR: do not use origin DEFAULT_IMPLS_WITH_MOVED_RECEIVERS(_SYNTHETIC) Instead, check that origin of the parent class is DEFAULT_IMPLS. --- .../kotlin/backend/jvm/JvmCachedDeclarations.kt | 16 +++------------- .../backend/jvm/JvmLoweredDeclarationOrigin.kt | 3 --- .../backend/jvm/lower/AddContinuationLowering.kt | 13 +------------ 3 files changed, 4 insertions(+), 28 deletions(-) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmCachedDeclarations.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmCachedDeclarations.kt index a040bf7c11a..a1488f59c28 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmCachedDeclarations.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmCachedDeclarations.kt @@ -158,19 +158,9 @@ class JvmCachedDeclarations( // is supposed to allow using `I2.DefaultImpls.f` as if it was inherited from `I1.DefaultImpls`. // The classes are not actually related and `I2.DefaultImpls.f` is not a fake override but a bridge. val defaultImplsOrigin = when { - !forCompatibilityMode && !interfaceFun.isFakeOverride -> - when { - interfaceFun.origin == IrDeclarationOrigin.FUNCTION_FOR_DEFAULT_PARAMETER -> - interfaceFun.origin - interfaceFun.origin.isSynthetic -> - JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_WITH_MOVED_RECEIVERS_SYNTHETIC - else -> - JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_WITH_MOVED_RECEIVERS - } - interfaceFun.resolveFakeOverride()!!.origin.isSynthetic -> - JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_TO_SYNTHETIC - else -> - JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE + !forCompatibilityMode && !interfaceFun.isFakeOverride -> interfaceFun.origin + interfaceFun.resolveFakeOverride()!!.origin.isSynthetic -> JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_TO_SYNTHETIC + else -> JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE } // Interface functions are public or private, with one exception: clone in Cloneable, which is protected. diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLoweredDeclarationOrigin.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLoweredDeclarationOrigin.kt index b10889cdead..22d7985a4b7 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLoweredDeclarationOrigin.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLoweredDeclarationOrigin.kt @@ -11,9 +11,6 @@ import org.jetbrains.kotlin.ir.declarations.IrDeclarationOriginImpl interface JvmLoweredDeclarationOrigin : IrDeclarationOrigin { object CLASS_STATIC_INITIALIZER : IrDeclarationOriginImpl("CLASS_STATIC_INITIALIZER") object DEFAULT_IMPLS : IrDeclarationOriginImpl("DEFAULT_IMPLS") - object DEFAULT_IMPLS_WITH_MOVED_RECEIVERS : IrDeclarationOriginImpl("STATIC_WITH_MOVED_RECEIVERS") - object DEFAULT_IMPLS_WITH_MOVED_RECEIVERS_SYNTHETIC : - IrDeclarationOriginImpl("STATIC_WITH_MOVED_RECEIVERS_SYNTHETIC", isSynthetic = true) object DEFAULT_IMPLS_BRIDGE : IrDeclarationOriginImpl("DEFAULT_IMPLS_BRIDGE") object DEFAULT_IMPLS_BRIDGE_TO_SYNTHETIC : IrDeclarationOriginImpl("DEFAULT_IMPLS_BRIDGE_TO_SYNTHETIC", isSynthetic = true) object FIELD_FOR_OUTER_THIS : IrDeclarationOriginImpl("FIELD_FOR_OUTER_THIS") diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt index 656bc7c28c8..391a83dd1d2 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt @@ -341,7 +341,7 @@ internal fun IrFunction.suspendFunctionOriginal(): IrFunction = if (this is IrSimpleFunction && isSuspend && !isStaticInlineClassReplacement && !isOrOverridesDefaultParameterStub() && - !isDefaultImplsFunction + parentAsClass.origin != JvmLoweredDeclarationOrigin.DEFAULT_IMPLS ) attributeOwnerId as IrFunction else this @@ -354,17 +354,6 @@ private fun IrSimpleFunction.isOrOverridesDefaultParameterStub(): Boolean = { it.origin == IrDeclarationOrigin.FUNCTION_FOR_DEFAULT_PARAMETER } ) -private val defaultImplsOrigins = setOf( - IrDeclarationOrigin.FUNCTION_FOR_DEFAULT_PARAMETER, - JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_WITH_MOVED_RECEIVERS, - JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_WITH_MOVED_RECEIVERS_SYNTHETIC, - JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE, - JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_TO_SYNTHETIC, -) - -private val IrSimpleFunction.isDefaultImplsFunction: Boolean - get() = origin in defaultImplsOrigins - private fun IrFunction.createSuspendFunctionStub(context: JvmBackendContext): IrFunction { require(this.isSuspend && this is IrSimpleFunction) return factory.buildFun { From d41d1bf64d094e0fabf4b15960b34360ce0f663a Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Thu, 19 Nov 2020 23:20:10 +0100 Subject: [PATCH 396/698] JVM IR: remove obsolete isDefaultImplsBridge in findInterfaceImplementation --- ...nheritedDefaultMethodsOnClassesLowering.kt | 9 ++--- .../kotlin/ir/util/IrFakeOverrideUtils.kt | 36 +++++++------------ 2 files changed, 15 insertions(+), 30 deletions(-) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InheritedDefaultMethodsOnClassesLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InheritedDefaultMethodsOnClassesLowering.kt index bfab66ed21c..ecf892ef780 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InheritedDefaultMethodsOnClassesLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InheritedDefaultMethodsOnClassesLowering.kt @@ -14,7 +14,6 @@ import org.jetbrains.kotlin.backend.common.ir.passTypeArgumentsFrom import org.jetbrains.kotlin.backend.common.lower.createIrBuilder import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase import org.jetbrains.kotlin.backend.jvm.JvmBackendContext -import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin import org.jetbrains.kotlin.backend.jvm.codegen.isJvmInterface import org.jetbrains.kotlin.backend.jvm.ir.* import org.jetbrains.kotlin.builtins.StandardNames @@ -260,22 +259,18 @@ private class InterfaceObjectCallsLowering(val context: JvmBackendContext) : IrE * interface implementation should be generated into the class containing the fake override; or null if the given function is not a fake * override of any interface implementation or such method was already generated into the superclass or is a method from Any. */ -private fun isDefaultImplsBridge(f: IrSimpleFunction) = - f.origin == JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE || - f.origin == JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_TO_SYNTHETIC - internal fun IrSimpleFunction.findInterfaceImplementation(jvmDefaultMode: JvmDefaultMode): IrSimpleFunction? { if (!isFakeOverride) return null parent.let { if (it is IrClass && it.isJvmInterface) return null } - val implementation = resolveFakeOverride(toSkip = ::isDefaultImplsBridge) ?: return null + val implementation = resolveFakeOverride() ?: return null // Only generate interface delegation for functions immediately inherited from an interface. // (Otherwise, delegation will be present in the parent class) if (overriddenSymbols.any { !it.owner.parentAsClass.isInterface && it.owner.modality != Modality.ABSTRACT && - it.owner.resolveFakeOverride(toSkip = ::isDefaultImplsBridge) == implementation + it.owner.resolveFakeOverride() == implementation }) { return null } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/IrFakeOverrideUtils.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/IrFakeOverrideUtils.kt index 5639181114c..20c456a4c2a 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/IrFakeOverrideUtils.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/IrFakeOverrideUtils.kt @@ -24,36 +24,26 @@ val IrSimpleFunction.target: IrSimpleFunction else resolveFakeOverride() ?: error("Could not resolveFakeOverride() for ${this.render()}") -val IrFunction.target: IrFunction get() = when (this) { - is IrSimpleFunction -> this.target - is IrConstructor -> this - else -> error(this) -} +val IrFunction.target: IrFunction + get() = when (this) { + is IrSimpleFunction -> this.target + is IrConstructor -> this + else -> error(this) + } -fun IrSimpleFunction.collectRealOverrides( - toSkip: (IrSimpleFunction) -> Boolean = { false }, - filter: (IrOverridableMember) -> Boolean = { false } -): Set { - if (isReal && !toSkip(this)) return setOf(this) +fun IrSimpleFunction.collectRealOverrides(filter: (IrOverridableMember) -> Boolean = { false }): Set { + if (isReal) return setOf(this) return this.overriddenSymbols .map { it.owner } - .collectAndFilterRealOverrides( - { - require(it is IrSimpleFunction) { "Expected IrSimpleFunction: ${it.render()}" } - toSkip(it) - }, - filter - ) + .collectAndFilterRealOverrides(filter) .map { it as IrSimpleFunction } .toSet() } fun Collection.collectAndFilterRealOverrides( - toSkip: (IrOverridableMember) -> Boolean = { false }, filter: (IrOverridableMember) -> Boolean = { false } ): Set { - val visited = mutableSetOf() val realOverrides = mutableSetOf() @@ -68,7 +58,7 @@ fun Collection.collectAndFilterRealOverrides( fun collectRealOverrides(member: IrOverridableMember) { if (!visited.add(member) || filter(member)) return - if (member.isReal && !toSkip(member)) { + if (member.isReal) { realOverrides += member } else { overriddenSymbols(member).forEach { collectRealOverrides(it.owner as IrOverridableMember) } @@ -93,13 +83,13 @@ fun Collection.collectAndFilterRealOverrides( } // TODO: use this implementation instead of any other -fun IrSimpleFunction.resolveFakeOverride(allowAbstract: Boolean = false, toSkip: (IrSimpleFunction) -> Boolean = { false }): IrSimpleFunction? { +fun IrSimpleFunction.resolveFakeOverride(allowAbstract: Boolean = false): IrSimpleFunction? { return if (allowAbstract) { - val reals = collectRealOverrides(toSkip) + val reals = collectRealOverrides() if (reals.isEmpty()) error("No real overrides for ${this.render()}") reals.first() } else { - collectRealOverrides(toSkip, { it.modality == Modality.ABSTRACT }) + collectRealOverrides { it.modality == Modality.ABSTRACT } .let { realOverrides -> // Kotlin forbids conflicts between overrides, but they may trickle down from Java. realOverrides.singleOrNull { it.parent.safeAs()?.isInterface != true } From c7c793c7245b79647af1ec0bd67c9bc98e23699b Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Thu, 19 Nov 2020 22:43:40 +0100 Subject: [PATCH 397/698] JVM IR: do not use origin DEFAULT_IMPLS_BRIDGE(_TO_SYNTHETIC) Instead, check that origin of the parent class is DEFAULT_IMPLS. Also, add a separate origin SUPER_INTERFACE_METHOD_BRIDGE for interface methods with bodies that are copied to classes. --- .../kotlin/backend/jvm/JvmCachedDeclarations.kt | 10 ++++------ .../kotlin/backend/jvm/JvmLoweredDeclarationOrigin.kt | 3 +-- .../kotlin/backend/jvm/codegen/CoroutineCodegen.kt | 3 +-- .../kotlin/backend/jvm/codegen/ExpressionCodegen.kt | 2 +- .../backend/jvm/codegen/JvmSignatureClashDetector.kt | 3 +-- .../backend/jvm/lower/AddContinuationLowering.kt | 2 +- .../allCompatibility/deprecationWithDefault.kt | 3 +-- 7 files changed, 10 insertions(+), 16 deletions(-) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmCachedDeclarations.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmCachedDeclarations.kt index a1488f59c28..5b6c9931e6f 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmCachedDeclarations.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmCachedDeclarations.kt @@ -157,11 +157,9 @@ class JvmCachedDeclarations( // // is supposed to allow using `I2.DefaultImpls.f` as if it was inherited from `I1.DefaultImpls`. // The classes are not actually related and `I2.DefaultImpls.f` is not a fake override but a bridge. - val defaultImplsOrigin = when { - !forCompatibilityMode && !interfaceFun.isFakeOverride -> interfaceFun.origin - interfaceFun.resolveFakeOverride()!!.origin.isSynthetic -> JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_TO_SYNTHETIC - else -> JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE - } + val defaultImplsOrigin = + if (!forCompatibilityMode && !interfaceFun.isFakeOverride) interfaceFun.origin + else interfaceFun.resolveFakeOverride()!!.origin // Interface functions are public or private, with one exception: clone in Cloneable, which is protected. // However, Cloneable has no DefaultImpls, so this merely replicates the incorrect behavior of the old backend. @@ -218,7 +216,7 @@ class JvmCachedDeclarations( assert(fakeOverride.isFakeOverride) val irClass = fakeOverride.parentAsClass context.irFactory.buildFun { - origin = JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE + origin = JvmLoweredDeclarationOrigin.SUPER_INTERFACE_METHOD_BRIDGE name = fakeOverride.name visibility = fakeOverride.visibility modality = fakeOverride.modality diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLoweredDeclarationOrigin.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLoweredDeclarationOrigin.kt index 22d7985a4b7..fd0e2a047e2 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLoweredDeclarationOrigin.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLoweredDeclarationOrigin.kt @@ -11,8 +11,7 @@ import org.jetbrains.kotlin.ir.declarations.IrDeclarationOriginImpl interface JvmLoweredDeclarationOrigin : IrDeclarationOrigin { object CLASS_STATIC_INITIALIZER : IrDeclarationOriginImpl("CLASS_STATIC_INITIALIZER") object DEFAULT_IMPLS : IrDeclarationOriginImpl("DEFAULT_IMPLS") - object DEFAULT_IMPLS_BRIDGE : IrDeclarationOriginImpl("DEFAULT_IMPLS_BRIDGE") - object DEFAULT_IMPLS_BRIDGE_TO_SYNTHETIC : IrDeclarationOriginImpl("DEFAULT_IMPLS_BRIDGE_TO_SYNTHETIC", isSynthetic = true) + object SUPER_INTERFACE_METHOD_BRIDGE : IrDeclarationOriginImpl("SUPER_INTERFACE_METHOD_BRIDGE") object FIELD_FOR_OUTER_THIS : IrDeclarationOriginImpl("FIELD_FOR_OUTER_THIS") object LAMBDA_IMPL : IrDeclarationOriginImpl("LAMBDA_IMPL") object FUNCTION_REFERENCE_IMPL : IrDeclarationOriginImpl("FUNCTION_REFERENCE_IMPL", isSynthetic = true) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/CoroutineCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/CoroutineCodegen.kt index c5cd5da6cb0..dcb505a6d3e 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/CoroutineCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/CoroutineCodegen.kt @@ -145,8 +145,7 @@ internal fun IrFunction.shouldContainSuspendMarkers(): Boolean = !isInvokeSuspen origin != JvmLoweredDeclarationOrigin.JVM_OVERLOADS_WRAPPER && origin != JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR && origin != JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR_FOR_HIDDEN_CONSTRUCTOR && - origin != JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE && - origin != JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_TO_SYNTHETIC && + origin != JvmLoweredDeclarationOrigin.SUPER_INTERFACE_METHOD_BRIDGE && origin != IrDeclarationOrigin.BRIDGE && origin != IrDeclarationOrigin.BRIDGE_SPECIAL && origin != IrDeclarationOrigin.DELEGATED_MEMBER && diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt index 94f2f148fbf..d874cbca46c 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt @@ -293,7 +293,7 @@ class ExpressionCodegen( irFunction.origin == JvmLoweredDeclarationOrigin.INLINE_CLASS_GENERATED_IMPL_METHOD || // Although these are accessible from Java, the functions they bridge to already have the assertions. irFunction.origin == IrDeclarationOrigin.BRIDGE_SPECIAL || - irFunction.origin == JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE || + irFunction.origin == JvmLoweredDeclarationOrigin.SUPER_INTERFACE_METHOD_BRIDGE || irFunction.origin == JvmLoweredDeclarationOrigin.JVM_STATIC_WRAPPER || irFunction.origin == IrDeclarationOrigin.IR_BUILTINS_STUB || irFunction.parentAsClass.origin == JvmLoweredDeclarationOrigin.CONTINUATION_CLASS || diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/JvmSignatureClashDetector.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/JvmSignatureClashDetector.kt index 0d10f59b0bf..7939eac6f85 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/JvmSignatureClashDetector.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/JvmSignatureClashDetector.kt @@ -187,8 +187,7 @@ class JvmSignatureClashDetector( IrDeclarationOrigin.BRIDGE_SPECIAL, IrDeclarationOrigin.IR_BUILTINS_STUB, JvmLoweredDeclarationOrigin.TO_ARRAY, - JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE, - JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_TO_SYNTHETIC, + JvmLoweredDeclarationOrigin.SUPER_INTERFACE_METHOD_BRIDGE, ) val PREDEFINED_SIGNATURES = listOf( diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt index 391a83dd1d2..3a307ce6802 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt @@ -372,7 +372,7 @@ private fun IrFunction.createSuspendFunctionStub(context: JvmBackendContext): Ir val substitutionMap = makeTypeParameterSubstitutionMap(this, function) function.copyReceiverParametersFrom(this, substitutionMap) - if (origin != JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE) { + if (origin != JvmLoweredDeclarationOrigin.SUPER_INTERFACE_METHOD_BRIDGE) { function.overriddenSymbols += overriddenSymbols.map { it.owner.suspendFunctionViewOrStub(context).symbol as IrSimpleFunctionSymbol } } diff --git a/compiler/testData/codegen/bytecodeListing/jvm8/defaults/allCompatibility/deprecationWithDefault.kt b/compiler/testData/codegen/bytecodeListing/jvm8/defaults/allCompatibility/deprecationWithDefault.kt index 56938143693..d543fbcf766 100644 --- a/compiler/testData/codegen/bytecodeListing/jvm8/defaults/allCompatibility/deprecationWithDefault.kt +++ b/compiler/testData/codegen/bytecodeListing/jvm8/defaults/allCompatibility/deprecationWithDefault.kt @@ -1,8 +1,7 @@ // !JVM_DEFAULT_MODE: all-compatibility // JVM_TARGET: 1.8 // WITH_RUNTIME -// IGNORE_BACKEND: JVM_IR -// IR copies annotations to default impls + interface Deprecated { @java.lang.Deprecated fun test() { From a917ebd11e664e31ee8f8dd837972e7ca4a0496b Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Fri, 20 Nov 2020 18:45:30 +0100 Subject: [PATCH 398/698] JVM IR: use origin to detect property/typealias $annotations methods Now that DEFAULT_IMPLS origins for methods do not exist after previous commits, the name heuristic is no longer needed. --- .../kotlin/backend/jvm/JvmLoweredDeclarationOrigin.kt | 6 ++---- .../kotlin/backend/jvm/codegen/ClassCodegen.kt | 2 +- .../kotlin/backend/jvm/codegen/FunctionCodegen.kt | 2 +- .../backend/jvm/codegen/MethodSignatureMapper.kt | 8 ++++---- .../kotlin/backend/jvm/codegen/irCodegenUtils.kt | 10 ++-------- .../backend/jvm/lower/GenerateMultifileFacades.kt | 4 ++-- .../kotlin/backend/jvm/lower/InterfaceLowering.kt | 4 ++-- .../kotlin/backend/jvm/lower/JvmPropertiesLowering.kt | 2 +- .../backend/jvm/lower/JvmStaticAnnotationLowering.kt | 2 +- .../jvm/lower/TypeAliasAnnotationMethodsLowering.kt | 2 +- ...rnalProperty.kt => internalPropertyOrTypealias.kt} | 4 ++++ ...alProperty.txt => internalPropertyOrTypealias.txt} | 11 +++++++---- .../kotlin/codegen/BytecodeListingTestGenerated.java | 6 +++--- .../codegen/ir/IrBytecodeListingTestGenerated.java | 6 +++--- 14 files changed, 34 insertions(+), 35 deletions(-) rename compiler/testData/codegen/bytecodeListing/annotations/{internalProperty.kt => internalPropertyOrTypealias.kt} (55%) rename compiler/testData/codegen/bytecodeListing/annotations/{internalProperty.txt => internalPropertyOrTypealias.txt} (58%) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLoweredDeclarationOrigin.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLoweredDeclarationOrigin.kt index fd0e2a047e2..2df04199b2f 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLoweredDeclarationOrigin.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLoweredDeclarationOrigin.kt @@ -22,10 +22,8 @@ interface JvmLoweredDeclarationOrigin : IrDeclarationOrigin { object TO_ARRAY : IrDeclarationOriginImpl("TO_ARRAY") object JVM_STATIC_WRAPPER : IrDeclarationOriginImpl("JVM_STATIC_WRAPPER") object JVM_OVERLOADS_WRAPPER : IrDeclarationOriginImpl("JVM_OVERLOADS_WRAPPER") - object SYNTHETIC_METHOD_FOR_PROPERTY_ANNOTATIONS : - IrDeclarationOriginImpl("SYNTHETIC_METHOD_FOR_PROPERTY_ANNOTATIONS", isSynthetic = true) - object SYNTHETIC_METHOD_FOR_TYPEALIAS_ANNOTATIONS : - IrDeclarationOriginImpl("SYNTHETIC_METHOD_FOR_TYPEALIAS_ANNOTATIONS", isSynthetic = true) + object SYNTHETIC_METHOD_FOR_PROPERTY_OR_TYPEALIAS_ANNOTATIONS : + IrDeclarationOriginImpl("SYNTHETIC_METHOD_FOR_PROPERTY_OR_TYPEALIAS_ANNOTATIONS", isSynthetic = true) object GENERATED_PROPERTY_REFERENCE : IrDeclarationOriginImpl("GENERATED_PROPERTY_REFERENCE", isSynthetic = true) object GENERATED_MEMBER_IN_CALLABLE_REFERENCE : IrDeclarationOriginImpl("GENERATED_MEMBER_IN_CALLABLE_REFERENCE", isSynthetic = false) object ENUM_MAPPINGS_FOR_WHEN : IrDeclarationOriginImpl("ENUM_MAPPINGS_FOR_WHEN", isSynthetic = true) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ClassCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ClassCodegen.kt index 8b21ea6ce81..c19804ada95 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ClassCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ClassCodegen.kt @@ -365,7 +365,7 @@ class ClassCodegen private constructor( when (val metadata = method.metadata) { is MetadataSource.Property -> { - assert(method.isSyntheticMethodForProperty) { + assert(method.origin == JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_OR_TYPEALIAS_ANNOTATIONS) { "MetadataSource.Property on IrFunction should only be used for synthetic \$annotations methods: ${method.render()}" } metadataSerializer.bindMethodMetadata(metadata, Method(node.name, node.desc)) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt index 9d49f97f540..24bfaf5740c 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt @@ -118,7 +118,7 @@ class FunctionCodegen( private fun shouldGenerateAnnotationsOnValueParameters(): Boolean = when { - irFunction.origin == JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_ANNOTATIONS -> + irFunction.origin == JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_OR_TYPEALIAS_ANNOTATIONS -> false irFunction is IrConstructor && irFunction.parentAsClass.shouldNotGenerateConstructorParameterAnnotations() -> // Not generating parameter annotations for default stubs fixes KT-7892, though diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt index 3a76c6f47ac..ee87513a15d 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt @@ -127,10 +127,10 @@ class MethodSignatureMapper(private val context: JvmBackendContext) { originalForDefaultAdapter?.isInvisibleInMultifilePart() == true) private fun IrSimpleFunction.getInternalFunctionForManglingIfNeeded(): IrSimpleFunction? { - if (origin != JvmLoweredDeclarationOrigin.STATIC_INLINE_CLASS_CONSTRUCTOR && - visibility == DescriptorVisibilities.INTERNAL && - !isPublishedApi() && - !isSyntheticMethodForProperty + if (visibility == DescriptorVisibilities.INTERNAL && + origin != JvmLoweredDeclarationOrigin.STATIC_INLINE_CLASS_CONSTRUCTOR && + origin != JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_OR_TYPEALIAS_ANNOTATIONS && + !isPublishedApi() ) { return this } diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt index da1885ac0f7..3ca296a9015 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt @@ -33,7 +33,6 @@ import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.types.getClass import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.load.java.JavaDescriptorVisibilities -import org.jetbrains.kotlin.load.java.JvmAbi import org.jetbrains.kotlin.load.kotlin.JvmPackagePartSource import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName @@ -349,14 +348,9 @@ internal fun IrDeclaration.isDeprecatedCallable(context: JvmBackendContext): Boo isAnnotatedWithDeprecated || annotations.any { it.symbol == context.ir.symbols.javaLangDeprecatedConstructorWithDeprecatedFlag } -// We can't check for JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_ANNOTATIONS because for interface methods -// moved to DefaultImpls, origin is changed to DEFAULT_IMPLS -// TODO: Fix origin somehow -val IrFunction.isSyntheticMethodForProperty: Boolean - get() = name.asString().endsWith(JvmAbi.ANNOTATED_PROPERTY_METHOD_NAME_SUFFIX) - internal fun IrFunction.isDeprecatedFunction(context: JvmBackendContext): Boolean = - isSyntheticMethodForProperty || isDeprecatedCallable(context) || + origin == JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_OR_TYPEALIAS_ANNOTATIONS || + isDeprecatedCallable(context) || (this as? IrSimpleFunction)?.correspondingPropertySymbol?.owner?.isDeprecatedCallable(context) == true || isAccessorForDeprecatedPropertyImplementedByDelegation || isAccessorForDeprecatedJvmStaticProperty(context) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/GenerateMultifileFacades.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/GenerateMultifileFacades.kt index 70c09b607ae..b2f51286227 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/GenerateMultifileFacades.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/GenerateMultifileFacades.kt @@ -17,7 +17,6 @@ import org.jetbrains.kotlin.backend.common.phaser.makeCustomPhase import org.jetbrains.kotlin.backend.jvm.JvmBackendContext import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin import org.jetbrains.kotlin.backend.jvm.codegen.fileParent -import org.jetbrains.kotlin.backend.jvm.codegen.isSyntheticMethodForProperty import org.jetbrains.kotlin.config.JvmAnalysisFlags import org.jetbrains.kotlin.descriptors.DescriptorVisibilities import org.jetbrains.kotlin.descriptors.Modality @@ -223,7 +222,8 @@ private fun IrSimpleFunction.createMultifileDelegateIfNeeded( name == StaticInitializersLowering.clinitName || origin == JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR || // $annotations methods in the facade are only needed for const properties. - (isSyntheticMethodForProperty && (metadata as? MetadataSource.Property)?.isConst != true) + (origin == JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_OR_TYPEALIAS_ANNOTATIONS && + (metadata as? MetadataSource.Property)?.isConst != true) ) return null val function = context.irFactory.buildFun { diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InterfaceLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InterfaceLowering.kt index 1331283d2b1..2b9345286ff 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InterfaceLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InterfaceLowering.kt @@ -125,7 +125,7 @@ internal class InterfaceLowering(val context: JvmBackendContext) : IrElementTran */ (DescriptorVisibilities.isPrivate(function.visibility) && !function.isCompiledToJvmDefault(jvmDefaultMode)) || (function.origin == IrDeclarationOrigin.FUNCTION_FOR_DEFAULT_PARAMETER && !function.isCompiledToJvmDefault(jvmDefaultMode)) - || function.origin == JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_ANNOTATIONS -> { + || function.origin == JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_OR_TYPEALIAS_ANNOTATIONS -> { val defaultImpl = createDefaultImpl(function) defaultImpl.body = function.moveBodyTo(defaultImpl) removedFunctions[function.symbol] = defaultImpl.symbol @@ -175,7 +175,7 @@ internal class InterfaceLowering(val context: JvmBackendContext) : IrElementTran private fun handleAnnotationClass(irClass: IrClass) { // We produce $DefaultImpls for annotation classes only to move $annotations methods (for property annotations) there. val annotationsMethods = - irClass.functions.filter { it.origin == JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_ANNOTATIONS } + irClass.functions.filter { it.origin == JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_OR_TYPEALIAS_ANNOTATIONS } if (annotationsMethods.none()) return for (function in annotationsMethods) { diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmPropertiesLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmPropertiesLowering.kt index b5af34c168c..c0b8141e2f7 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmPropertiesLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmPropertiesLowering.kt @@ -129,7 +129,7 @@ class JvmPropertiesLowering(private val backendContext: JvmBackendContext) : IrE private fun createSyntheticMethodForAnnotations(declaration: IrProperty): IrSimpleFunction = backendContext.irFactory.buildFun { - origin = JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_ANNOTATIONS + origin = JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_OR_TYPEALIAS_ANNOTATIONS name = Name.identifier(computeSyntheticMethodName(declaration)) visibility = declaration.visibility modality = Modality.OPEN diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmStaticAnnotationLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmStaticAnnotationLowering.kt index 6d4b0640da6..b293cf677dc 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmStaticAnnotationLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmStaticAnnotationLowering.kt @@ -63,7 +63,7 @@ private class JvmStaticInCompanionLowering(val context: JvmBackendContext) : IrE .filter { it.isJvmStaticDeclaration() && it.origin != IrDeclarationOrigin.FUNCTION_FOR_DEFAULT_PARAMETER && - it.origin != JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_ANNOTATIONS + it.origin != JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_OR_TYPEALIAS_ANNOTATIONS } .forEach { declaration -> val jvmStaticFunction = declaration as IrSimpleFunction diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/TypeAliasAnnotationMethodsLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/TypeAliasAnnotationMethodsLowering.kt index 64b54159ec0..8ae6fda55c5 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/TypeAliasAnnotationMethodsLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/TypeAliasAnnotationMethodsLowering.kt @@ -45,7 +45,7 @@ class TypeAliasAnnotationMethodsLowering(val context: CommonBackendContext) : visibility = alias.visibility returnType = context.irBuiltIns.unitType modality = Modality.OPEN - origin = JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_TYPEALIAS_ANNOTATIONS + origin = JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_OR_TYPEALIAS_ANNOTATIONS }.apply { body = IrBlockBodyImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET) annotations += alias.annotations diff --git a/compiler/testData/codegen/bytecodeListing/annotations/internalProperty.kt b/compiler/testData/codegen/bytecodeListing/annotations/internalPropertyOrTypealias.kt similarity index 55% rename from compiler/testData/codegen/bytecodeListing/annotations/internalProperty.kt rename to compiler/testData/codegen/bytecodeListing/annotations/internalPropertyOrTypealias.kt index 3e593258693..3a795abffe6 100644 --- a/compiler/testData/codegen/bytecodeListing/annotations/internalProperty.kt +++ b/compiler/testData/codegen/bytecodeListing/annotations/internalPropertyOrTypealias.kt @@ -1,3 +1,4 @@ +@Target(AnnotationTarget.PROPERTY, AnnotationTarget.TYPEALIAS) annotation class Anno class C { @@ -7,3 +8,6 @@ class C { @Anno internal val property: Int get() = 0 + +@Anno +internal typealias Typealias = Any diff --git a/compiler/testData/codegen/bytecodeListing/annotations/internalProperty.txt b/compiler/testData/codegen/bytecodeListing/annotations/internalPropertyOrTypealias.txt similarity index 58% rename from compiler/testData/codegen/bytecodeListing/annotations/internalProperty.txt rename to compiler/testData/codegen/bytecodeListing/annotations/internalPropertyOrTypealias.txt index 8eedfcd7a03..c88b79f5d76 100644 --- a/compiler/testData/codegen/bytecodeListing/annotations/internalProperty.txt +++ b/compiler/testData/codegen/bytecodeListing/annotations/internalPropertyOrTypealias.txt @@ -1,20 +1,23 @@ +@kotlin.annotation.Target @java.lang.annotation.Retention +@java.lang.annotation.Target @kotlin.Metadata public annotation class Anno { - // source: 'internalProperty.kt' + // source: 'internalPropertyOrTypealias.kt' } @kotlin.Metadata public final class C { - // source: 'internalProperty.kt' + // source: 'internalPropertyOrTypealias.kt' public method (): void public synthetic deprecated static @Anno method getProperty$test_module$annotations(): void public final method getProperty$test_module(): int } @kotlin.Metadata -public final class InternalPropertyKt { - // source: 'internalProperty.kt' +public final class InternalPropertyOrTypealiasKt { + // source: 'internalPropertyOrTypealias.kt' + public synthetic deprecated static @Anno method Typealias$annotations(): void public synthetic deprecated static @Anno method getProperty$annotations(): void public final static method getProperty(): int } diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index 5fb50b0a9bd..83948ecead1 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -241,9 +241,9 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/annotations/deprecatedJvmOverloads.kt"); } - @TestMetadata("internalProperty.kt") - public void testInternalProperty() throws Exception { - runTest("compiler/testData/codegen/bytecodeListing/annotations/internalProperty.kt"); + @TestMetadata("internalPropertyOrTypealias.kt") + public void testInternalPropertyOrTypealias() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/annotations/internalPropertyOrTypealias.kt"); } @TestMetadata("JvmSynthetic.kt") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index aad039f8b44..16f066ea6c2 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -241,9 +241,9 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/annotations/deprecatedJvmOverloads.kt"); } - @TestMetadata("internalProperty.kt") - public void testInternalProperty() throws Exception { - runTest("compiler/testData/codegen/bytecodeListing/annotations/internalProperty.kt"); + @TestMetadata("internalPropertyOrTypealias.kt") + public void testInternalPropertyOrTypealias() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/annotations/internalPropertyOrTypealias.kt"); } @TestMetadata("JvmSynthetic.kt") From d512158c2583d2ae60321a0e84afec2d447fec30 Mon Sep 17 00:00:00 2001 From: Shagen Ogandzhanian Date: Wed, 2 Dec 2020 16:45:12 +0100 Subject: [PATCH 399/698] [JS IR] Remove redundant guard assertion for extension funs with default params Introduce corresponding test See https://youtrack.jetbrains.com/issue/KT-41076 --- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 +++ .../lower/JsDefaultArgumentStubGenerator.kt | 7 ++-- .../classes/extensionFunWithDefaultParam.kt | 38 +++++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 5 +++ .../LightAnalysisModeTestGenerated.java | 5 +++ .../ir/IrBlackBoxCodegenTestGenerated.java | 5 +++ .../IrJsCodegenBoxES6TestGenerated.java | 5 +++ .../IrJsCodegenBoxTestGenerated.java | 5 +++ .../semantics/JsCodegenBoxTestGenerated.java | 5 +++ 9 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 compiler/testData/codegen/box/classes/extensionFunWithDefaultParam.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index c3ecd508ed8..4b71254f03d 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -3840,6 +3840,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/classes/exceptionConstructor.kt"); } + @TestMetadata("extensionFunWithDefaultParam.kt") + public void testExtensionFunWithDefaultParam() throws Exception { + runTest("compiler/testData/codegen/box/classes/extensionFunWithDefaultParam.kt"); + } + @TestMetadata("extensionOnNamedClassObject.kt") public void testExtensionOnNamedClassObject() throws Exception { runTest("compiler/testData/codegen/box/classes/extensionOnNamedClassObject.kt"); diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/JsDefaultArgumentStubGenerator.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/JsDefaultArgumentStubGenerator.kt index 982da3cc052..82623bd231c 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/JsDefaultArgumentStubGenerator.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/JsDefaultArgumentStubGenerator.kt @@ -37,11 +37,12 @@ class JsDefaultArgumentStubGenerator(override val context: JsIrBackendContext) : ): IrExpression { val paramCount = oldIrFunction.valueParameters.size val invokeFunctionN = resolveInvoke(paramCount) - // NOTE: currently we do not have a syntax to perform super extension call - // but in case we have such functionality in the future the logic bellow should be fixed + return irCall(invokeFunctionN, IrStatementOrigin.INVOKE).apply { dispatchReceiver = irImplicitCast(irGet(handlerDeclaration), invokeFunctionN.dispatchReceiverParameter!!.type) - assert(newIrFunction.extensionReceiverParameter == null) + // NOTE: currently we do not have a syntax to perform super extension call + // that's why we've used to just fail with an exception in case we have extension function in for JS IR compilation + // TODO: that was overkill, however, we still need to revisit this issue later on params.forEachIndexed { i, variable -> putValueArgument(i, irGet(variable)) } } } diff --git a/compiler/testData/codegen/box/classes/extensionFunWithDefaultParam.kt b/compiler/testData/codegen/box/classes/extensionFunWithDefaultParam.kt new file mode 100644 index 00000000000..34dfe24ed10 --- /dev/null +++ b/compiler/testData/codegen/box/classes/extensionFunWithDefaultParam.kt @@ -0,0 +1,38 @@ +// DONT_TARGET_EXACT_BACKEND: WASM +// WASM_MUTE_REASON: IGNORED_IN_JS +// IGNORE_BACKEND: NATIVE + +open class MyLogic { + protected open val postfix = "ZZZ" + open fun String.foo(prefix: String = "XXX"): String = transform(prefix + this + postfix) + protected fun transform(a: String) = "$a:$a" + fun result(): String { + return "YYY".foo() + } +} +open class MyLogicWithDifferentPostfix : MyLogic() { + override val postfix = "WWW" +} + +class MyLogicSpecified : MyLogic() { + override fun String.foo(prefix: String): String = "$prefix::$this::$postfix" +} + +fun box(): String { + val result1 = MyLogic().result() + if (result1 != "XXXYYYZZZ:XXXYYYZZZ") { + return "fail1: ${result1}" + } + + val result2 = MyLogicWithDifferentPostfix().result() + if (result2 != "XXXYYYWWW:XXXYYYWWW") { + return "fail2: ${result2}" + } + + val result3 = MyLogicSpecified().result() + if (result3 != "XXX::YYY::ZZZ") { + return "fail3: ${result3}" + } + + return "OK" +} \ No newline at end of file diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 621a623ddbe..b175f9f569d 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -3860,6 +3860,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/classes/exceptionConstructor.kt"); } + @TestMetadata("extensionFunWithDefaultParam.kt") + public void testExtensionFunWithDefaultParam() throws Exception { + runTest("compiler/testData/codegen/box/classes/extensionFunWithDefaultParam.kt"); + } + @TestMetadata("extensionOnNamedClassObject.kt") public void testExtensionOnNamedClassObject() throws Exception { runTest("compiler/testData/codegen/box/classes/extensionOnNamedClassObject.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 6f4a70523f5..2ee2e8e18c8 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -3865,6 +3865,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/classes/exceptionConstructor.kt"); } + @TestMetadata("extensionFunWithDefaultParam.kt") + public void testExtensionFunWithDefaultParam() throws Exception { + runTest("compiler/testData/codegen/box/classes/extensionFunWithDefaultParam.kt"); + } + @TestMetadata("extensionOnNamedClassObject.kt") public void testExtensionOnNamedClassObject() throws Exception { runTest("compiler/testData/codegen/box/classes/extensionOnNamedClassObject.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 9c988ade812..328025700e5 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -3840,6 +3840,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/classes/exceptionConstructor.kt"); } + @TestMetadata("extensionFunWithDefaultParam.kt") + public void testExtensionFunWithDefaultParam() throws Exception { + runTest("compiler/testData/codegen/box/classes/extensionFunWithDefaultParam.kt"); + } + @TestMetadata("extensionOnNamedClassObject.kt") public void testExtensionOnNamedClassObject() throws Exception { runTest("compiler/testData/codegen/box/classes/extensionOnNamedClassObject.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index dac3666dac3..e94581ca30c 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -3015,6 +3015,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/classes/exceptionConstructor.kt"); } + @TestMetadata("extensionFunWithDefaultParam.kt") + public void testExtensionFunWithDefaultParam() throws Exception { + runTest("compiler/testData/codegen/box/classes/extensionFunWithDefaultParam.kt"); + } + @TestMetadata("extensionOnNamedClassObject.kt") public void testExtensionOnNamedClassObject() throws Exception { runTest("compiler/testData/codegen/box/classes/extensionOnNamedClassObject.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 3d82eb44618..230765ea840 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -3015,6 +3015,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/classes/exceptionConstructor.kt"); } + @TestMetadata("extensionFunWithDefaultParam.kt") + public void testExtensionFunWithDefaultParam() throws Exception { + runTest("compiler/testData/codegen/box/classes/extensionFunWithDefaultParam.kt"); + } + @TestMetadata("extensionOnNamedClassObject.kt") public void testExtensionOnNamedClassObject() throws Exception { runTest("compiler/testData/codegen/box/classes/extensionOnNamedClassObject.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index f61dfa989cc..7892ef2e51c 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -3015,6 +3015,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/classes/exceptionConstructor.kt"); } + @TestMetadata("extensionFunWithDefaultParam.kt") + public void testExtensionFunWithDefaultParam() throws Exception { + runTest("compiler/testData/codegen/box/classes/extensionFunWithDefaultParam.kt"); + } + @TestMetadata("extensionOnNamedClassObject.kt") public void testExtensionOnNamedClassObject() throws Exception { runTest("compiler/testData/codegen/box/classes/extensionOnNamedClassObject.kt"); From c7e5beece524f0a9610b4270d06a5ddc447b9dc7 Mon Sep 17 00:00:00 2001 From: Ivan Gavrilovic Date: Thu, 26 Nov 2020 21:17:59 +0000 Subject: [PATCH 400/698] Use types are origins for incremental KAPT and track generated source This change introduces tracking of generated sources structure in order to e.g track classpath changes impacting generated sources. This fixes KT-42182. Also, origin tracking for isolating processors is now using types, allowing for origin elements from classpath. This fixes KT-34340. However, classpath origin is used only to invalidate generated files when the type changes and processing will not be requested for that type. This is in line with the incap spec. --- ...rementalProcessorReferencingClasspath.java | 58 +++++++ .../KaptIncrementalWithAggregatingApt.kt | 46 ++++-- .../gradle/KaptIncrementalWithIsolatingApt.kt | 57 +++++++ .../kotlin/kapt3/base/KaptContext.kt | 10 +- .../kotlin/kapt3/base/annotationProcessing.kt | 18 +- .../base/incremental/IncrementalAptCache.kt | 124 +++++++++----- .../kotlin/kapt3/base/incremental/cache.kt | 121 ++++++++++---- .../base/incremental/classStructureCache.kt | 154 ++++++++---------- .../base/incremental/incrementalProcessors.kt | 65 ++++---- .../kapt3/base/incremental/javacVisitors.kt | 24 --- .../DynamicIncrementalProcessorTest.kt | 4 +- .../IsolatingIncrementalProcessorTest.kt | 26 +-- .../incremental/JavaClassCacheManagerTest.kt | 36 +--- .../TestSimpleIncrementalAptCache.kt | 6 +- 14 files changed, 475 insertions(+), 274 deletions(-) create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/java/org/jetbrains/kotlin/gradle/incapt/IncrementalProcessorReferencingClasspath.java diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/java/org/jetbrains/kotlin/gradle/incapt/IncrementalProcessorReferencingClasspath.java b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/java/org/jetbrains/kotlin/gradle/incapt/IncrementalProcessorReferencingClasspath.java new file mode 100644 index 00000000000..4532035db46 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/java/org/jetbrains/kotlin/gradle/incapt/IncrementalProcessorReferencingClasspath.java @@ -0,0 +1,58 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.gradle.incapt; + +import javax.annotation.processing.AbstractProcessor; +import javax.annotation.processing.RoundEnvironment; +import javax.lang.model.element.Element; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.TypeElement; +import javax.lang.model.element.VariableElement; +import java.io.IOException; +import java.io.Writer; +import java.util.Collections; +import java.util.Set; + +/** Simple processor that generates a class for every annotated element (class, field, method). */ +public class IncrementalProcessorReferencingClasspath extends AbstractProcessor { + + // Type that all generated sources will extend. + public static final String CLASSPATH_TYPE = "com.example.FromClasspath"; + + @Override + public Set getSupportedAnnotationTypes() { + return Collections.singleton("example.ExampleAnnotation"); + } + + @Override + public boolean process(Set annotations, RoundEnvironment roundEnv) { + if (annotations.isEmpty()) return true; + + for (Element element : roundEnv.getElementsAnnotatedWith(annotations.iterator().next())) { + if (element instanceof TypeElement || element instanceof ExecutableElement || element instanceof VariableElement) { + String name = element.getSimpleName().toString(); + name = name.substring(0, 1).toUpperCase() + name.substring(1) + "Generated"; + + String packageName; + if (element instanceof TypeElement) { + packageName = element.getEnclosingElement().getSimpleName().toString(); + } + else { + packageName = element.getEnclosingElement().getEnclosingElement().getSimpleName().toString(); + } + + try (Writer writer = processingEnv.getFiler().createSourceFile(packageName + "." + name, element).openWriter()) { + writer.append("package ").append(packageName).append(";"); + writer.append("\npublic class ").append(name).append(" extends ").append(CLASSPATH_TYPE).append(" {}"); + } + catch (IOException ignored) { + } + } + } + + return false; + } +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithAggregatingApt.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithAggregatingApt.kt index e7e629f65e9..156d4ac1650 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithAggregatingApt.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithAggregatingApt.kt @@ -27,6 +27,7 @@ class KaptIncrementalWithAggregatingApt : KaptIncrementalIT() { override fun defaultBuildOptions(): BuildOptions = super.defaultBuildOptions().copy( incremental = true, + debug=false, kaptOptions = KaptOptions( verbose = true, useWorkers = true, @@ -171,7 +172,7 @@ class KaptIncrementalWithAggregatingApt : KaptIncrementalIT() { } project.build("build") { assertSuccessful() - assertTrue(getProcessedSources(output).isEmpty()) + assertTrue(output.contains("Skipping annotation processing as all sources are up-to-date.")) } } @@ -275,8 +276,9 @@ class KaptIncrementalWithAggregatingApt : KaptIncrementalIT() { assertEquals( setOf( fileInWorkingDir("build/tmp/kapt3/stubs/main/bar/NoAnnotationsKt.java").canonicalPath, - fileInWorkingDir("build/tmp/kapt3/stubs/main/error/NonExistentClass.java").canonicalPath - ), getProcessedSources(output) + fileInWorkingDir("build/tmp/kapt3/stubs/main/error/NonExistentClass.java").canonicalPath, + fileInWorkingDir("build/generated/source/kapt/main/bar/WithAnnotationGenerated.java").canonicalPath.takeUnless { isBinary }, + ).filterNotNull().toSet(), getProcessedSources(output) ) checkAggregatingResource { lines -> @@ -302,9 +304,9 @@ class KaptIncrementalWithAggregatingApt : KaptIncrementalIT() { assertEquals( setOf( fileInWorkingDir("build/tmp/kapt3/stubs/main/baz/BazClass.java").canonicalPath, - fileInWorkingDir("build/tmp/kapt3/stubs/main/error/NonExistentClass.java").canonicalPath - ), - getProcessedSources(output) + fileInWorkingDir("build/tmp/kapt3/stubs/main/error/NonExistentClass.java").canonicalPath, + fileInWorkingDir("build/generated/source/kapt/main/bar/WithAnnotationGenerated.java").canonicalPath.takeUnless { isBinary }, + ).filterNotNull().toSet(), getProcessedSources(output) ) checkAggregatingResource { lines -> @@ -330,9 +332,9 @@ class KaptIncrementalWithAggregatingApt : KaptIncrementalIT() { assertEquals( setOf( fileInWorkingDir("build/tmp/kapt3/stubs/main/baz/BazClass.java").canonicalPath, - fileInWorkingDir("build/tmp/kapt3/stubs/main/error/NonExistentClass.java").canonicalPath - ), - getProcessedSources(output) + fileInWorkingDir("build/tmp/kapt3/stubs/main/error/NonExistentClass.java").canonicalPath, + fileInWorkingDir("build/generated/source/kapt/main/bar/WithAnnotationGenerated.java").canonicalPath.takeUnless { isBinary }, + ).filterNotNull().toSet(), getProcessedSources(output) ) checkAggregatingResource { lines -> @@ -351,8 +353,30 @@ class KaptIncrementalWithAggregatingApt : KaptIncrementalIT() { assertEquals( setOf( fileInWorkingDir("build/tmp/kapt3/stubs/main/bar/NoAnnotationsKt.java").canonicalPath, - fileInWorkingDir("build/tmp/kapt3/stubs/main/error/NonExistentClass.java").canonicalPath - ), getProcessedSources(output) + fileInWorkingDir("build/tmp/kapt3/stubs/main/error/NonExistentClass.java").canonicalPath, + fileInWorkingDir("build/generated/source/kapt/main/bar/WithAnnotationGenerated.java").canonicalPath.takeUnless { isBinary }, + fileInWorkingDir("build/generated/source/kapt/main/BazClass/BazNestedGenerated.java").canonicalPath.takeUnless { isBinary }, + ).filterNotNull().toSet(), getProcessedSources(output) + ) + + checkAggregatingResource { lines -> + assertEquals(2, lines.size) + assertTrue(lines.contains("WithAnnotationGenerated")) + assertTrue(lines.contains("BazNestedGenerated")) + } + } + + // make sure that changing the origin of isolating that produced + project.projectFile("withAnnotation.kt").modify { current -> current.substringBeforeLast("}") + "\nfun otherFunction() {} }" } + project.build("build", options = buildOptions) { + assertSuccessful() + + assertEquals( + setOf( + fileInWorkingDir("build/tmp/kapt3/stubs/main/bar/WithAnnotation.java").canonicalPath, + fileInWorkingDir("build/tmp/kapt3/stubs/main/error/NonExistentClass.java").canonicalPath, + fileInWorkingDir("build/generated/source/kapt/main/BazClass/BazNestedGenerated.java").canonicalPath.takeUnless { isBinary }, + ).filterNotNull().toSet(), getProcessedSources(output) ) checkAggregatingResource { lines -> diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt index 30a7a13dbc2..4ef3d4bd631 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt @@ -6,10 +6,14 @@ package org.jetbrains.kotlin.gradle import org.jetbrains.kotlin.gradle.incapt.IncrementalProcessor +import org.jetbrains.kotlin.gradle.incapt.IncrementalProcessorReferencingClasspath import org.jetbrains.kotlin.gradle.util.modify import org.junit.Assert.assertEquals import org.junit.Assume import org.junit.Test +import org.objectweb.asm.ClassWriter +import org.objectweb.asm.Opcodes +import org.objectweb.asm.Type import test.kt33617.MyClass import java.io.File import java.util.zip.ZipEntry @@ -192,6 +196,59 @@ class KaptIncrementalWithIsolatingApt : KaptIncrementalIT() { assertSuccessful() } } + + /** Regression test for https://youtrack.jetbrains.com/issue/KT-42182. */ + @Test + fun testGeneratedSourcesImpactedByClasspathChanges() { + val project = Project( + "kaptIncrementalCompilationProject", + GradleVersionRequired.None + ).apply { + setupIncrementalAptProject("ISOLATING", procClass = IncrementalProcessorReferencingClasspath::class.java) + } + project.gradleSettingsScript().writeText("include ':', ':lib'") + val classpathTypeSource = project.projectDir.resolve("lib").run { + mkdirs() + resolve("build.gradle").writeText("apply plugin: 'java'") + val source = resolve("src/main/java/" + IncrementalProcessorReferencingClasspath.CLASSPATH_TYPE.replace(".", "/") + ".java") + source.parentFile.mkdirs() + + source.writeText( + """ + package ${IncrementalProcessorReferencingClasspath.CLASSPATH_TYPE.substringBeforeLast(".")}; + public class ${IncrementalProcessorReferencingClasspath.CLASSPATH_TYPE.substringAfterLast(".")} {} + """.trimIndent() + ) + return@run source + } + project.gradleBuildScript().appendText( + """ + + dependencies { + implementation project(':lib') + } + """.trimIndent() + ) + project.build("clean", "kaptKotlin") { + assertSuccessful() + } + + // change type that all generated sources reference + classpathTypeSource.writeText(classpathTypeSource.readText().replace("}", "int i = 10;\n}")) + project.build("build") { + assertSuccessful() + assertEquals( + setOf( + fileInWorkingDir("build/tmp/kapt3/stubs/main/foo/A.java").canonicalPath, + fileInWorkingDir("build/tmp/kapt3/stubs/main/bar/B.java").canonicalPath, + fileInWorkingDir("build/tmp/kapt3/stubs/main/bar/UseBKt.java").canonicalPath, + fileInWorkingDir("build/tmp/kapt3/stubs/main/baz/UtilKt.java").canonicalPath, + fileInWorkingDir("build/tmp/kapt3/stubs/main/error/NonExistentClass.java").canonicalPath + ), + getProcessedSources(output) + ) + } + } } private const val patternApt = "Processing java sources with annotation processors:" diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/KaptContext.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/KaptContext.kt index 5f06b01a622..5b8af760d28 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/KaptContext.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/KaptContext.kt @@ -60,10 +60,16 @@ open class KaptContext(val options: KaptOptions, val withJdk: Boolean, val logge JavaClassCacheManager(it) } if (options.flags[KaptFlag.INCREMENTAL_APT]) { - sourcesToReprocess = + sourcesToReprocess = run { + val start = System.currentTimeMillis() cacheManager?.invalidateAndGetDirtyFiles( options.changedFiles, options.classpathChanges - ) ?: SourcesToReprocess.FullRebuild + ).also { + if (logger.isVerbose) { + logger.info("Computing sources to reprocess took ${System.currentTimeMillis() - start}[ms].") + } + } + }?: SourcesToReprocess.FullRebuild if (sourcesToReprocess == SourcesToReprocess.FullRebuild) { // remove all generated sources and classes diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/annotationProcessing.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/annotationProcessing.kt index 1919bb94ca1..3ce96ff3de6 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/annotationProcessing.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/annotationProcessing.kt @@ -14,6 +14,7 @@ import com.sun.tools.javac.processing.JavacProcessingEnvironment import com.sun.tools.javac.tree.JCTree import org.jetbrains.kotlin.base.kapt3.KaptFlag import org.jetbrains.kotlin.kapt3.base.incremental.* +import org.jetbrains.kotlin.kapt3.base.javac.KaptJavaCompiler import org.jetbrains.kotlin.kapt3.base.util.KaptBaseError import org.jetbrains.kotlin.kapt3.base.util.KaptLogger import org.jetbrains.kotlin.kapt3.base.util.isJava9OrLater @@ -40,6 +41,13 @@ fun KaptContext.doAnnotationProcessing( val compilerAfterAP: JavaCompiler try { + if (javaSourceFiles.isEmpty() && aggregatedTypes.isEmpty() && additionalSources.isEmpty()) { + if (logger.isVerbose) { + logger.info("Skipping annotation processing as all sources are up-to-date.") + } + return + } + if (isJava9OrLater()) { val initProcessAnnotationsMethod = JavaCompiler::class.java.declaredMethods.single { it.name == "initProcessAnnotations" } initProcessAnnotationsMethod.invoke(compiler, wrappedProcessors, emptyList(), emptyList()) @@ -66,11 +74,6 @@ fun KaptContext.doAnnotationProcessing( CompileState.PARSE, compiler.enterTrees(parsedJavaFiles + additionalSources) ) - val generatedSourcesListener = sourcesStructureListener?.let { - compiler.getTaskListeners().remove(it) - GeneratedTypesTaskListener(cacheManager!!.javaCache) - }?.also { compiler.getTaskListeners().add(it) } - val additionalClassNames = JavacList.from(aggregatedTypes) if (isJava9OrLater()) { val processAnnotationsMethod = @@ -78,13 +81,12 @@ fun KaptContext.doAnnotationProcessing( processAnnotationsMethod.invoke(compiler, analyzedFiles, additionalClassNames) compiler } else { - compiler.processAnnotations(analyzedFiles, additionalClassNames).also { - generatedSourcesListener?.let { compiler.getTaskListeners().remove(it) } - } + compiler.processAnnotations(analyzedFiles, additionalClassNames) } } catch (e: AnnotationProcessingError) { throw KaptBaseError(KaptBaseError.Kind.EXCEPTION, e.cause ?: e) } + sourcesStructureListener?.let { compiler.getTaskListeners().remove(it) } cacheManager?.updateCache(processors, sourcesStructureListener?.failureReason != null) diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/IncrementalAptCache.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/IncrementalAptCache.kt index be6f5fc7249..bb3697dc4b0 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/IncrementalAptCache.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/IncrementalAptCache.kt @@ -10,16 +10,19 @@ import java.io.Serializable class IncrementalAptCache : Serializable { - private val aggregatingGenerated: MutableMap = mutableMapOf() + private val aggregatingGenerated: MutableSet = mutableSetOf() private val aggregatedTypes: MutableSet = linkedSetOf() - private val isolatingMapping: MutableMap> = mutableMapOf() - // Annotations claimed by aggregating annotation processors - private val aggregatingClaimedAnnotations: MutableSet = mutableSetOf() + private val isolatingMapping: MutableMap = mutableMapOf() var isIncremental = true private set - fun updateCache(processors: List): Boolean { + fun updateCache(processors: List, failedToAnalyzeSources: Boolean): Boolean { + if (failedToAnalyzeSources) { + invalidateCache() + return false + } + val aggregating = mutableListOf() val isolating = mutableListOf() val nonIncremental = mutableListOf() @@ -38,60 +41,68 @@ class IncrementalAptCache : Serializable { aggregatingGenerated.clear() aggregating.forEach { - it.getGeneratedToSourcesAll().mapValuesTo(aggregatingGenerated) { (_, value) -> - value?.first - } + aggregatingGenerated.addAll(it.getGeneratedToSources().keys) } - aggregatingClaimedAnnotations.clear() - aggregatingClaimedAnnotations.addAll(aggregating.flatMap { it.supportedAnnotationTypes }) - aggregatedTypes.clear() aggregatedTypes.addAll(aggregating.flatMap { it.getAggregatedTypes() }) - for (isolatingProcessor in isolating) { - isolatingProcessor.getGeneratedToSourcesAll().forEach { - isolatingMapping[it.key] = it.value!!.first to it.value!!.second!! + isolating.forEach { + it.getGeneratedToSources().forEach { (file, type) -> + isolatingMapping[file] = type!! } } + return true } - fun getAggregatingClaimedAnnotations(): Set = aggregatingClaimedAnnotations - - /** Returns generated Java sources originating from aggregating APs. */ - fun invalidateAggregating(): Pair, List> { - val dirtyAggregating = aggregatingGenerated.keys.filter { it.isJavaFileOrClass() } - aggregatingGenerated.forEach { it.key.delete() } + /** + * Invalidates all data collected about aggregating APs, making the cache ready for the next round of data collection. Also, + * all files generated by aggregating APs are deleted. + */ + fun invalidateAggregating() { + aggregatingGenerated.forEach { it.delete() } aggregatingGenerated.clear() - - val dirtyAggregated = ArrayList(aggregatedTypes) aggregatedTypes.clear() - - return dirtyAggregating to dirtyAggregated } - /** Returns generated Java sources originating from the specified sources, and generated by isloating APs. */ - fun invalidateIsolatingGenerated(fromSources: Set): Pair, Set> { - val allInvalidated = mutableListOf() - val invalidatedClassIds = mutableSetOf() - var changedSources = fromSources.toSet() + /** + * Prepares isolating processors for incremental compilation. The specified generated files are removed, and mapping + * information is deleted for them. The invalidation is non-transitive. + */ + fun invalidateIsolatingForOriginTypes(originatingTypes: Set) { + val isolatingGenerated = mutableSetOf() + isolatingMapping.forEach { (file, type) -> + if (type in originatingTypes) { + isolatingGenerated.add(file) + } + } + + isolatingGenerated.forEach { + isolatingMapping.remove(it) + it.delete() + } + } + + fun getIsolatingGeneratedTypesForOrigins( + originatingTypes: Set, + typeInfoProvider: (Collection) -> Set + ): List { + val allGeneratedTypes = mutableListOf() + var currentOrigins = originatingTypes.toSet() // We need to do it in a loop because mapping could be: [AGenerated.java -> A.java, AGeneratedGenerated.java -> AGenerated.java] - while (changedSources.isNotEmpty()) { - val generated = isolatingMapping.filter { changedSources.contains(it.value.second) }.keys - generated.forEach { - if (it.isJavaFileOrClass()) { - allInvalidated.add(it) - isolatingMapping[it]?.first?.let { invalidatedClassIds.add(it) } + while (currentOrigins.isNotEmpty()) { + val generated = mutableSetOf() + isolatingMapping.forEach { (file, origin) -> + if (origin in currentOrigins) { + generated.add(file) } - - it.delete() - isolatingMapping.remove(it) } - changedSources = generated + currentOrigins = typeInfoProvider(generated) + allGeneratedTypes.addAll(currentOrigins) } - return allInvalidated to invalidatedClassIds + return allGeneratedTypes } private fun File.isJavaFileOrClass() = extension == "java" || extension == "class" @@ -100,5 +111,38 @@ class IncrementalAptCache : Serializable { isIncremental = false aggregatingGenerated.clear() isolatingMapping.clear() + aggregatedTypes.clear() + } + + /** Gets the originating type for the specified type generated by isolating AP. */ + fun getOriginForGeneratedIsolatingType(generatedType: String, sourceFileProvider: (String) -> File?): String { + val generatedFile = checkNotNull(sourceFileProvider(generatedType)) { "Unable to find source for $generatedType" } + return isolatingMapping.getValue(generatedFile) + } + + /** Returns types that were processed by aggregating APs. */ + fun getAggregatingOrigins(): Set = aggregatedTypes + + /** Returns all types generated by aggregating APs. */ + fun getAggregatingGeneratedTypes(typeInfoProvider: (Collection) -> Set): Set { + val generatedAggregating: MutableSet = HashSet(aggregatingGenerated.size) + aggregatingGenerated.forEach { + if (it.isJavaFileOrClass()) { + generatedAggregating.add(it) + } + } + return typeInfoProvider(generatedAggregating) + } + + /** Returns all types generated by isolating APs. */ + fun getIsolatingGeneratedTypes(typeInfoProvider: (Collection) -> Set): Set { + val generatedIsolating: MutableSet = HashSet(isolatingMapping.size) + + isolatingMapping.keys.forEach { + if (it.isJavaFileOrClass()) { + generatedIsolating.add(it) + } + } + return typeInfoProvider(generatedIsolating) } } \ No newline at end of file diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/cache.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/cache.kt index 25f615725ba..a6f8936cfb8 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/cache.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/cache.kt @@ -19,8 +19,18 @@ class JavaClassCacheManager(val file: File) : Closeable { private var closed = false fun updateCache(processors: List, failedToAnalyzeSources: Boolean) { - if (failedToAnalyzeSources || !aptCache.updateCache(processors)) { + if (!aptCache.updateCache(processors, failedToAnalyzeSources)) { javaCache.invalidateAll() + return + } + // Compilation is fully incremental, record types defined in generated .class files + processors.forEach { processor -> + processor.getGeneratedClassFilesToTypes().forEach { (classFile, type) -> + val typeInformation = SourceFileStructure(classFile.toURI()).also { + it.addDeclaredType(type) + } + javaCache.addSourceStructure(typeInformation) + } } } @@ -39,38 +49,93 @@ class JavaClassCacheManager(val file: File) : Closeable { } val changes = Changes(changedSources, dirtyClasspathFqNames.toSet()) - val filesToReprocess = javaCache.invalidateEntriesForChangedFiles(changes) + val aggregatingGeneratedTypes = aptCache.getAggregatingGeneratedTypes(javaCache::getTypesForFiles) + val impactedTypes = getAllImpactedTypes(changes, aggregatingGeneratedTypes) + val isolatingGeneratedTypes = aptCache.getIsolatingGeneratedTypes(javaCache::getTypesForFiles) - return when (filesToReprocess) { - is SourcesToReprocess.FullRebuild -> SourcesToReprocess.FullRebuild - is SourcesToReprocess.Incremental -> { - val toReprocess = filesToReprocess.toReprocess.toMutableSet() + val sourcesToReprocess = changedSources.toMutableSet() + val classNamesToReprocess = mutableListOf() + var shouldProcessAggregating = false - val (invalidatedIsolatingGenerated, invalidatedIsolatingId) = aptCache.invalidateIsolatingGenerated(toReprocess) - val generatedDirtyTypes = javaCache.invalidateGeneratedTypes(invalidatedIsolatingGenerated).toMutableSet() /*+*/ - - val aggregatedTypes = mutableListOf() - if (!toReprocess.isEmpty()) { - // only if there are some files to reprocess we should invalidate the aggregating ones - val (aggregatingGenerated, aggregatedTypes1) = aptCache.invalidateAggregating() - aggregatedTypes.addAll(aggregatedTypes1) - generatedDirtyTypes.addAll(javaCache.invalidateGeneratedTypes(aggregatingGenerated)) - - toReprocess.addAll( - javaCache.invalidateEntriesAnnotatedWith(aptCache.getAggregatingClaimedAnnotations()) - ) + for (impactedType in impactedTypes) { + if (impactedType !in isolatingGeneratedTypes && impactedType !in aggregatingGeneratedTypes) { + // Reprocess only if original source + javaCache.getSourceForType(impactedType)?.let { + sourcesToReprocess.add(it) } - - SourcesToReprocess.Incremental( - toReprocess.toList(), - generatedDirtyTypes, - aggregatedTypes.also { - it.removeAll(filesToReprocess.dirtyTypes) - it.removeAll(generatedDirtyTypes) - it.removeAll(invalidatedIsolatingId) - }) + } else if (impactedType in isolatingGeneratedTypes) { + // this is a generated type by isolating AP + val isolatingOrigin = aptCache.getOriginForGeneratedIsolatingType(impactedType, javaCache::getSourceForType) + if (isolatingOrigin in impactedTypes) { + // we'll process origin, no need to do it now + continue + } + val originSource = javaCache.getSourceForType(isolatingOrigin) + if (originSource?.extension == "java") { + sourcesToReprocess.add(originSource) + } else if (originSource?.extension == "class") { + // This is a generated .class file that we need to reprocess. + classNamesToReprocess.add(isolatingOrigin) + } else { + // This is a type from classpath that was used as origin, just ignore it. It is used just to remove the generated file. + } + } else { + // processed separately + shouldProcessAggregating = true } } + + if (shouldProcessAggregating || sourcesToReprocess.isNotEmpty() || classNamesToReprocess.isNotEmpty()) { + for (aggregatingOrigin in aptCache.getAggregatingOrigins()) { + if (aggregatingOrigin in impactedTypes) continue + + val originSource = javaCache.getSourceForType(aggregatingOrigin) + if (originSource?.extension == "java") { + sourcesToReprocess.add(originSource) + } else if (originSource?.extension == "class") { + // This is a generated .class file that we need to reprocess. + classNamesToReprocess.add(aggregatingOrigin) + } + } + + // Invalidate state only if there are some files that will be reprocessed + javaCache.invalidateDataForTypes(impactedTypes) + aptCache.invalidateAggregating() + // for isolating, invalidate both own types and classpath types + aptCache.invalidateIsolatingForOriginTypes(impactedTypes) + aptCache.invalidateIsolatingForOriginTypes(dirtyClasspathFqNames) + } + + return SourcesToReprocess.Incremental(sourcesToReprocess.toList(), impactedTypes, classNamesToReprocess) + } + + private fun getAllImpactedTypes(changes: Changes, aggregatingGeneratedTypes: Set): MutableSet { + val impactedTypes = javaCache.getAllImpactedTypes(changes) + + /** + * In order to find all impacted types we do the following: + * - impacted types is a set of types that have changed from the previous compilation + * - if there is a changed source or a source file that is impacted by type changes, we'll need to run aggregating APs, so we + * invalidate all aggregating generated types, and add them to set of impacted types. + * - using this new impacted types set, we find all types generated by isolating APs with origins in those types + * - if there are some generated types by isolating APs, we'll need to run aggregating APs, so we invalidate all aggregating types + * and add them to impacted types. + * - using the final value of impacted types we get all generated types by isolating APs and add them to impacted types + */ + if (changes.sourceChanges.isNotEmpty() || impactedTypes.isNotEmpty()) { + // Any source change or any source impacted by type change invalidates aggregating APs generated types + impactedTypes.addAll(aggregatingGeneratedTypes) + } + aptCache.getIsolatingGeneratedTypesForOrigins(changes.dirtyFqNamesFromClasspath, javaCache::getTypesForFiles).let { + if (it.isNotEmpty()) { + impactedTypes.addAll(it) + impactedTypes.addAll(aggregatingGeneratedTypes) + } + } + aptCache.getIsolatingGeneratedTypesForOrigins(impactedTypes, javaCache::getTypesForFiles).let { + impactedTypes.addAll(it) + } + return impactedTypes } private fun maybeGetAptCacheFromFile(): IncrementalAptCache { diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/classStructureCache.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/classStructureCache.kt index 997fc5398bf..0bf8dc97aa5 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/classStructureCache.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/classStructureCache.kt @@ -11,17 +11,18 @@ import java.io.ObjectOutputStream import java.io.Serializable import java.lang.IllegalArgumentException import java.net.URI -import java.util.regex.Pattern +/** + * Stores type information about processed and generated sources. For .java files a fine-grained type information + * exists i.e we know all referenced types. For .class files we only know which type is defined in the .class file. + */ class JavaClassCache() : Serializable { private var sourceCache = mutableMapOf() - /** Record these separately because we only need to know where each generated type is coming from. */ - private var generatedTypes = mutableMapOf>() - /** Map from types to files they are mentioned in. */ @Transient private var dependencyCache = mutableMapOf>() + @Transient private var nonTransitiveCache = mutableMapOf>() @@ -29,21 +30,31 @@ class JavaClassCache() : Serializable { sourceCache[sourceStructure.sourceFile] = sourceStructure } - fun addGeneratedType(type: String, generatedFile: File) { - val typesInFile = generatedTypes[generatedFile] ?: ArrayList(1) - typesInFile.add(type) - generatedTypes[generatedFile] = typesInFile + /** Invalidates types for these files, and return the list of invalidated types.*/ + fun invalidateTypesForFiles(files: List): Set { + val typesFromFiles = HashSet() + for (file in files) { + sourceCache.remove(file.toURI())?.getDeclaredTypes()?.let { + typesFromFiles.addAll(it) + } + } + return typesFromFiles } - fun invalidateGeneratedTypes(files: List): Set { - return files.mapNotNull { generatedTypes.remove(it) }.flatten().toSet() + /** Returns all types defined in these files. */ + fun getTypesForFiles(files: Collection): Set { + val typesFromFiles = HashSet(files.size) + for (file in files) { + sourceCache[file.toURI()]?.getDeclaredTypes()?.let { + typesFromFiles.addAll(it) + } + } + return typesFromFiles } private fun readObject(input: ObjectInputStream) { @Suppress("UNCHECKED_CAST") sourceCache = input.readObject() as MutableMap - @Suppress("UNCHECKED_CAST") - generatedTypes = input.readObject() as MutableMap> dependencyCache = HashMap(sourceCache.size * 4) for (sourceInfo in sourceCache.values) { @@ -71,7 +82,6 @@ class JavaClassCache() : Serializable { private fun writeObject(output: ObjectOutputStream) { output.writeObject(sourceCache) - output.writeObject(generatedTypes) } fun isAlreadyProcessed(sourceFile: URI): Boolean { @@ -84,8 +94,7 @@ class JavaClassCache() : Serializable { return true } return try { - val fileFromUri = File(sourceFile) - sourceCache.containsKey(sourceFile) || generatedTypes.containsKey(fileFromUri) + sourceCache.containsKey(sourceFile) } catch (e: IllegalArgumentException) { // unable to create File instance, avoid processing these files true @@ -96,89 +105,66 @@ class JavaClassCache() : Serializable { internal fun getStructure(sourceFile: File) = sourceCache[sourceFile.toURI()] /** - * Invalidate cache entries for the specified files, and any files that depend on the changed ones. It returns the set of files that - * should be re-processed. - * */ - fun invalidateEntriesForChangedFiles(changes: Changes): SourcesToReprocess { - val allDirtyFiles = mutableSetOf() - var currentDirtyFiles = changes.sourceChanges.map { it.toURI() }.toMutableSet() - - for (classpathFqName in changes.dirtyFqNamesFromClasspath) { - nonTransitiveCache[classpathFqName]?.let { - allDirtyFiles.addAll(it) + * Compute the list of types that are impacted by source changes i.e [Changes.sourceChanges] and [Changes.dirtyFqNamesFromClasspath] + * i.e classpath changes. The search is transitive, if a file is impacted, all files referencing types defined in that file are + * also considered impacted. Only original sources and generated sources are reported as impacted (final result does not contain + * classpath types). + */ + fun getAllImpactedTypes(changes: Changes): MutableSet { + fun findImpactedTypes(changedType: String, transitiveDeps: MutableSet, nonTransitiveDeps: MutableSet) { + dependencyCache[changedType]?.let { impactedSources -> + impactedSources.forEach { + transitiveDeps.addAll(sourceCache.getValue(it).getDeclaredTypes()) + } } - - dependencyCache[classpathFqName]?.let { - currentDirtyFiles.addAll(it) + nonTransitiveCache[changedType]?.let { impactedSources -> + impactedSources.forEach { + nonTransitiveDeps.addAll(sourceCache.getValue(it).getDeclaredTypes()) + } } } val allDirtyTypes = mutableSetOf() + var currentDirtyTypes = getTypesForFiles(changes.sourceChanges).toMutableSet() - while (currentDirtyFiles.isNotEmpty()) { + changes.dirtyFqNamesFromClasspath.forEach { classpathChange -> + findImpactedTypes(classpathChange, currentDirtyTypes, allDirtyTypes) + } - val nextRound = mutableSetOf() - for (dirtyFile in currentDirtyFiles) { - allDirtyFiles.add(dirtyFile) - - val structure = sourceCache.remove(dirtyFile) ?: continue - val dirtyTypes = structure.getDeclaredTypes() - allDirtyTypes.addAll(dirtyTypes) - - dirtyTypes.forEach { type -> - nonTransitiveCache[type]?.let { - allDirtyFiles.addAll(it) - } - - dependencyCache[type]?.let { - nextRound.addAll(it) - } - } + while (currentDirtyTypes.isNotEmpty()) { + val nextRound = mutableSetOf() + for (dirtyType in currentDirtyTypes) { + allDirtyTypes.add(dirtyType) + findImpactedTypes(dirtyType, nextRound, allDirtyTypes) } - currentDirtyFiles = nextRound.filter { !allDirtyFiles.contains(it) }.toMutableSet() + currentDirtyTypes = nextRound.filterTo(HashSet()) { it !in allDirtyTypes } } - - return SourcesToReprocess.Incremental(allDirtyFiles.map { File(it) }, allDirtyTypes, emptyList()) - } - - /** - * For aggregating annotation processors, we always need to reprocess all files annotated with an annotation claimed by the aggregating - * annotation processor. This search is not transitive. - */ - fun invalidateEntriesAnnotatedWith(annotations: Set): Set { - val patterns: List = if ("*" in annotations) { - // optimize this case - create only one pattern - listOf(Pattern.compile(".*")) - } else { - annotations.map { - Pattern.compile( - // These are already valid import statements, otherwise run fails when loading the annotation processor. - // Handles structure; TypeName [.*] e.g. org.jetbrains.annotations.NotNull and org.jetbrains.annotations.* - it.replace(".", "\\.").replace("*", ".+") - ) - } - } - val matchesAnyPattern = { name: String -> patterns.any { it.matcher(name).matches() } } - - val toReprocess = mutableSetOf() - - for (cacheEntry in sourceCache) { - if (cacheEntry.value.getMentionedAnnotations().any(matchesAnyPattern)) { - toReprocess.add(cacheEntry.key) - } - } - - toReprocess.forEach { - sourceCache.remove(it) - } - - return toReprocess.map { File(it) }.toSet() + return allDirtyTypes } internal fun invalidateAll() { sourceCache.clear() - generatedTypes.clear() + } + + fun getSourceForType(type: String): File? { + sourceCache.forEach { (fileUri, typeInfo) -> + if (type in typeInfo.getDeclaredTypes()) { + return File(fileUri) + } + } + return null + } + + fun invalidateDataForTypes(impactedTypes: MutableSet) { + val allSources = mutableSetOf() + sourceCache.forEach { (fileUri, typeInfo) -> + if (typeInfo.getDeclaredTypes().any { it in impactedTypes }) { + allSources.add(fileUri) + } + } + + allSources.forEach { sourceCache.remove(it) } } } diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/incrementalProcessors.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/incrementalProcessors.kt index ae2c4361272..109b9a30e0e 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/incrementalProcessors.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/incrementalProcessors.kt @@ -70,11 +70,17 @@ class IncrementalProcessor(private val processor: Processor, private val kind: D } fun isUnableToRunIncrementally() = !kind.canRunIncrementally - fun getGeneratedToSources() = dependencyCollector.value.getGeneratedToSources() - fun getGeneratedToSourcesAll() = dependencyCollector.value.getGeneratedToSourcesAll() - fun getAggregatedTypes() = dependencyCollector.value.getAggregatedTypes() - fun getRuntimeType(): RuntimeProcType = dependencyCollector.value.getRuntimeType() + /** Mapping fromm generated file to type that were used as originating elements. For aggregating APs types will be [null]. */ + fun getGeneratedToSources(): Map = dependencyCollector.value.getGeneratedToSources() + + /** All top-level types that were processed by aggregating APs. */ + fun getAggregatedTypes() = dependencyCollector.value.getAggregatedTypes() + + /** Mapping from generated class file to type defined in that file. */ + fun getGeneratedClassFilesToTypes(): Map = dependencyCollector.value.getGeneratedClassFilesToTypes() + + fun getRuntimeType(): RuntimeProcType = dependencyCollector.value.getRuntimeType() override fun process(annotations: Set, roundEnv: RoundEnvironment): Boolean { if (getRuntimeType() == RuntimeProcType.AGGREGATING) { @@ -122,8 +128,9 @@ internal class AnnotationProcessorDependencyCollector( private val runtimeProcType: RuntimeProcType, private val warningCollector: (String) -> Unit ) { - private val generatedToSource = mutableMapOf?>() + private val generatedToSource = mutableMapOf() private val aggregatedTypes = mutableSetOf() + private val generatedClassFilesToTypes = mutableMapOf() private var isFullRebuild = !runtimeProcType.isIncremental @@ -131,7 +138,7 @@ internal class AnnotationProcessorDependencyCollector( if (isFullRebuild) return if (supportedAnnotationTypes.contains("*")) { - aggregatedTypes.addAll(getTopLevelClassNames(roundEnv.rootElements?.filterNotNull() ?: emptyList())) + aggregatedTypes.addAll(getTopLevelClassNames(roundEnv.rootElements?.filterNotNull() ?: emptySet())) } else { for (annotation in annotations) { aggregatedTypes.addAll( @@ -149,31 +156,40 @@ internal class AnnotationProcessorDependencyCollector( if (isFullRebuild) return val generatedFile = File(createdFile) + if (generatedFile.extension == "class") { + if (classId == null) { + isFullRebuild = true + warningCollector.invoke( + "Unable to determine type defined in $generatedFile." + ) + return + } + generatedClassFilesToTypes[generatedFile] = classId + } + if (runtimeProcType == RuntimeProcType.AGGREGATING) { - generatedToSource[generatedFile] = classId to null + generatedToSource[generatedFile] = null } else { - val srcFiles = getSrcFiles(originatingElements) - if (srcFiles.size != 1) { + val srcClasses = getTopLevelClassNames(originatingElements.filterNotNull()) + if (srcClasses.size != 1) { isFullRebuild = true warningCollector.invoke( "Expected 1 originating source file when generating $generatedFile, " + - "but detected ${srcFiles.size}: [${srcFiles.joinToString()}]." + "but detected ${srcClasses.size}: [${srcClasses.joinToString()}]." ) } else { - generatedToSource[generatedFile] = classId to srcFiles.single() + generatedToSource[generatedFile] = srcClasses.single() } } } - internal fun getGeneratedToSources(): Map = if (isFullRebuild) emptyMap() else generatedToSource.mapValues { (_, value) -> - value?.second - } - - internal fun getGeneratedToSourcesAll(): Map?> = - if (isFullRebuild) emptyMap() else generatedToSource + /** Mapping from generated files to top level class names that cause that file generation. */ + internal fun getGeneratedToSources(): Map = if (isFullRebuild) emptyMap() else generatedToSource internal fun getAggregatedTypes(): Set = if (isFullRebuild) emptySet() else aggregatedTypes + internal fun getGeneratedClassFilesToTypes(): Map = if (isFullRebuild) emptyMap() else generatedClassFilesToTypes + internal fun getRuntimeType(): RuntimeProcType { return if (isFullRebuild) { RuntimeProcType.NON_INCREMENTAL @@ -183,17 +199,6 @@ internal class AnnotationProcessorDependencyCollector( } } -private fun getSrcFiles(elements: Array): Set { - return elements.filterNotNull().mapNotNull { elem -> - var origin = elem - while (origin.enclosingElement != null && origin.enclosingElement !is PackageElement) { - origin = origin.enclosingElement - } - val uri = (origin as? Symbol.ClassSymbol)?.sourcefile?.toUri()?.takeIf { it.isAbsolute } - uri?.let { File(it).canonicalFile } - }.toSet() -} - private const val PACKAGE_TYPE_NAME = "package-info" fun getElementName(current: Element?): String? { @@ -211,8 +216,8 @@ fun getElementName(current: Element?): String? { return null } -private fun getTopLevelClassNames(elements: Collection): Collection { - return elements.mapNotNull { elem -> +private fun getTopLevelClassNames(elements: Collection): Set { + return elements.mapNotNullTo(HashSet()) { elem -> var origin = elem while (origin.enclosingElement != null && origin.enclosingElement !is PackageElement) { origin = origin.enclosingElement diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/javacVisitors.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/javacVisitors.kt index 28288c05928..fb56aca486b 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/javacVisitors.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/javacVisitors.kt @@ -246,28 +246,4 @@ private class ConstantTreeVisitor(val sourceStructure: SourceFileStructure) : Tr sourceStructure.addMentionedConstant(containingClass.qualifiedName.toString(), name.toString()) } -} - -class GeneratedTypesTaskListener(private val cache: JavaClassCache) : TaskListener { - - override fun started(e: TaskEvent) { - // do nothing, we just process on finish - } - - override fun finished(e: TaskEvent) { - if (e.kind != TaskEvent.Kind.ENTER || cache.isAlreadyProcessed(e.sourceFile.toUri())) return - - val treeVisitor = object : SimpleTreeVisitor() { - override fun visitClass(node: ClassTree, p: Void?): Void? { - node as JCTree.JCClassDecl - cache.addGeneratedType(node.sym.fullname.toString(), File(e.sourceFile.toUri())) - - node.members.forEach { visit(it, null) } - return null - } - } - e.compilationUnit.typeDecls.forEach { - it.accept(treeVisitor, null) - } - } } \ No newline at end of file diff --git a/plugins/kapt3/kapt3-base/test/org/jetbrains/kotlin/kapt3/base/incremental/DynamicIncrementalProcessorTest.kt b/plugins/kapt3/kapt3-base/test/org/jetbrains/kotlin/kapt3/base/incremental/DynamicIncrementalProcessorTest.kt index e2a84e771ab..3a47751a47d 100644 --- a/plugins/kapt3/kapt3-base/test/org/jetbrains/kotlin/kapt3/base/incremental/DynamicIncrementalProcessorTest.kt +++ b/plugins/kapt3/kapt3-base/test/org/jetbrains/kotlin/kapt3/base/incremental/DynamicIncrementalProcessorTest.kt @@ -36,8 +36,8 @@ class DynamicIncrementalProcessorTest { assertEquals( mapOf( - generatedSources.resolve("test/UserGenerated.java") to File("plugins/kapt3/kapt3-base/testData/runner/incremental/User.java").absoluteFile, - generatedSources.resolve("test/AddressGenerated.java") to File("plugins/kapt3/kapt3-base/testData/runner/incremental/Address.java").absoluteFile + generatedSources.resolve("test/UserGenerated.java") to "test.User", + generatedSources.resolve("test/AddressGenerated.java") to "test.Address" ), dynamic.getGeneratedToSources() ) diff --git a/plugins/kapt3/kapt3-base/test/org/jetbrains/kotlin/kapt3/base/incremental/IsolatingIncrementalProcessorTest.kt b/plugins/kapt3/kapt3-base/test/org/jetbrains/kotlin/kapt3/base/incremental/IsolatingIncrementalProcessorTest.kt index 223fa12b06a..06b28649244 100644 --- a/plugins/kapt3/kapt3-base/test/org/jetbrains/kotlin/kapt3/base/incremental/IsolatingIncrementalProcessorTest.kt +++ b/plugins/kapt3/kapt3-base/test/org/jetbrains/kotlin/kapt3/base/incremental/IsolatingIncrementalProcessorTest.kt @@ -35,8 +35,8 @@ class IsolationgIncrementalProcessorTest { assertEquals( mapOf( - generatedSources.resolve("test/UserGenerated.java") to File("plugins/kapt3/kapt3-base/testData/runner/incremental/User.java").absoluteFile, - generatedSources.resolve("test/AddressGenerated.java") to File("plugins/kapt3/kapt3-base/testData/runner/incremental/Address.java").absoluteFile + generatedSources.resolve("test/UserGenerated.java") to "test.User", + generatedSources.resolve("test/AddressGenerated.java") to "test.Address" ), isolating.getGeneratedToSources() ) @@ -62,12 +62,12 @@ class IsolationgIncrementalProcessorTest { assertEquals( mapOf( - generatedSources.resolve("test/UserGenerated.java") to TEST_DATA_DIR.resolve("User.java").absoluteFile, - generatedSources.resolve("test/UserGeneratedClass.class") to TEST_DATA_DIR.resolve("User.java").absoluteFile, - generatedSources.resolve("test/UserGeneratedResource") to TEST_DATA_DIR.resolve("User.java").absoluteFile, - generatedSources.resolve("test/AddressGenerated.java") to TEST_DATA_DIR.resolve("Address.java").absoluteFile, - generatedSources.resolve("test/AddressGeneratedClass.class") to TEST_DATA_DIR.resolve("Address.java").absoluteFile, - generatedSources.resolve("test/AddressGeneratedResource") to TEST_DATA_DIR.resolve("Address.java").absoluteFile + generatedSources.resolve("test/UserGenerated.java") to "test.User", + generatedSources.resolve("test/UserGeneratedClass.class") to "test.User", + generatedSources.resolve("test/UserGeneratedResource") to "test.User", + generatedSources.resolve("test/AddressGenerated.java") to "test.Address", + generatedSources.resolve("test/AddressGeneratedClass.class") to "test.Address", + generatedSources.resolve("test/AddressGeneratedResource") to "test.Address" ), isolating.getGeneratedToSources() ) @@ -95,15 +95,15 @@ class IsolationgIncrementalProcessorTest { isolating.forEach { assertEquals(RuntimeProcType.ISOLATING, it.getRuntimeType()) } assertEquals( mapOf( - generatedSources.resolve("test/UserGenerated.java") to File("plugins/kapt3/kapt3-base/testData/runner/incremental/User.java").absoluteFile, - generatedSources.resolve("test/AddressGenerated.java") to File("plugins/kapt3/kapt3-base/testData/runner/incremental/Address.java").absoluteFile + generatedSources.resolve("test/UserGenerated.java") to "test.User", + generatedSources.resolve("test/AddressGenerated.java") to "test.Address" ), isolating[0].getGeneratedToSources() ) assertEquals( mapOf( - generatedSources.resolve("test/UserGeneratedTwo.java") to File("plugins/kapt3/kapt3-base/testData/runner/incremental/User.java").absoluteFile, - generatedSources.resolve("test/AddressGeneratedTwo.java") to File("plugins/kapt3/kapt3-base/testData/runner/incremental/Address.java").absoluteFile + generatedSources.resolve("test/UserGeneratedTwo.java") to "test.User", + generatedSources.resolve("test/AddressGeneratedTwo.java") to "test.Address" ), isolating[1].getGeneratedToSources() ) } @@ -116,7 +116,7 @@ class IsolationgIncrementalProcessorTest { assertEquals( mapOf( - generatedSources.resolve("test/UserGenerated.java") to File("plugins/kapt3/kapt3-base/testData/runner/incremental/User.java").absoluteFile + generatedSources.resolve("test/UserGenerated.java") to "test.User" ), isolating[0].getGeneratedToSources() ) } diff --git a/plugins/kapt3/kapt3-base/test/org/jetbrains/kotlin/kapt3/base/incremental/JavaClassCacheManagerTest.kt b/plugins/kapt3/kapt3-base/test/org/jetbrains/kotlin/kapt3/base/incremental/JavaClassCacheManagerTest.kt index 845cfb6345a..f3c704c24eb 100644 --- a/plugins/kapt3/kapt3-base/test/org/jetbrains/kotlin/kapt3/base/incremental/JavaClassCacheManagerTest.kt +++ b/plugins/kapt3/kapt3-base/test/org/jetbrains/kotlin/kapt3/base/incremental/JavaClassCacheManagerTest.kt @@ -12,7 +12,6 @@ import org.junit.Rule import org.junit.Test import org.junit.rules.TemporaryFolder import java.io.File -import java.io.ObjectOutputStream class JavaClassCacheManagerTest { @@ -56,7 +55,8 @@ class JavaClassCacheManagerTest { } prepareForIncremental() - val dirtyFiles = cache.invalidateAndGetDirtyFiles(listOf(File("Mentioned.java")), emptyList()) as SourcesToReprocess.Incremental + val dirtyFiles = + cache.invalidateAndGetDirtyFiles(listOf(File("Mentioned.java").absoluteFile), emptyList()) as SourcesToReprocess.Incremental assertEquals( listOf( File("Mentioned.java").absoluteFile, @@ -84,7 +84,8 @@ class JavaClassCacheManagerTest { } prepareForIncremental() - val dirtyFiles = cache.invalidateAndGetDirtyFiles(listOf(File("Mentioned.java")), emptyList()) as SourcesToReprocess.Incremental + val dirtyFiles = + cache.invalidateAndGetDirtyFiles(listOf(File("Mentioned.java").absoluteFile), emptyList()) as SourcesToReprocess.Incremental assertEquals( listOf( File("Mentioned.java").absoluteFile, @@ -112,7 +113,8 @@ class JavaClassCacheManagerTest { } prepareForIncremental() - val dirtyFiles = cache.invalidateAndGetDirtyFiles(listOf(File("TwoTypes.java")), emptyList()) as SourcesToReprocess.Incremental + val dirtyFiles = + cache.invalidateAndGetDirtyFiles(listOf(File("TwoTypes.java").absoluteFile), emptyList()) as SourcesToReprocess.Incremental assertEquals( listOf( File("TwoTypes.java").absoluteFile, @@ -155,7 +157,7 @@ class JavaClassCacheManagerTest { val dirtyFiles = cache.invalidateAndGetDirtyFiles( - listOf(File("Constants.java")), emptyList() + listOf(File("Constants.java").absoluteFile), emptyList() ) as SourcesToReprocess.Incremental assertEquals( listOf(File("Constants.java").absoluteFile, File("MentionsConst.java").absoluteFile), @@ -163,30 +165,6 @@ class JavaClassCacheManagerTest { ) } - @Test - fun testWithAnnotations() { - SourceFileStructure(File("Annotated1.java").toURI()).also { - it.addDeclaredType("test.Annotated1") - it.addMentionedAnnotations("test.Annotation") - cache.javaCache.addSourceStructure(it) - } - SourceFileStructure(File("Annotated2.java").toURI()).also { - it.addDeclaredType("test.Annotated2") - it.addMentionedAnnotations("com.test.MyAnnotation") - cache.javaCache.addSourceStructure(it) - } - SourceFileStructure(File("Annotated3.java").toURI()).also { - it.addDeclaredType("test.Annotated3") - it.addMentionedAnnotations("Runnable") - cache.javaCache.addSourceStructure(it) - } - prepareForIncremental() - - assertEquals(setOf(File("Annotated1.java").absoluteFile), cache.javaCache.invalidateEntriesAnnotatedWith(setOf("test.Annotation"))) - assertEquals(setOf(File("Annotated2.java").absoluteFile), cache.javaCache.invalidateEntriesAnnotatedWith(setOf("com.test.*"))) - assertEquals(setOf(File("Annotated3.java").absoluteFile), cache.javaCache.invalidateEntriesAnnotatedWith(setOf("*"))) - } - private fun prepareForIncremental() { cache.close() cache = JavaClassCacheManager(cacheDir) diff --git a/plugins/kapt3/kapt3-base/test/org/jetbrains/kotlin/kapt3/base/incremental/TestSimpleIncrementalAptCache.kt b/plugins/kapt3/kapt3-base/test/org/jetbrains/kotlin/kapt3/base/incremental/TestSimpleIncrementalAptCache.kt index e7af1dbc5b6..abb1259d2d2 100644 --- a/plugins/kapt3/kapt3-base/test/org/jetbrains/kotlin/kapt3/base/incremental/TestSimpleIncrementalAptCache.kt +++ b/plugins/kapt3/kapt3-base/test/org/jetbrains/kotlin/kapt3/base/incremental/TestSimpleIncrementalAptCache.kt @@ -36,7 +36,7 @@ class TestSimpleIncrementalAptCache { fun testAggregatingAnnotations() { runProcessor(SimpleProcessor().toAggregating()) - val dirtyFiles = cache.invalidateAndGetDirtyFiles(listOf(TEST_DATA_DIR.resolve("User.java")), emptyList()) as SourcesToReprocess.Incremental + val dirtyFiles = cache.invalidateAndGetDirtyFiles(listOf(TEST_DATA_DIR.resolve("User.java").absoluteFile), emptyList()) as SourcesToReprocess.Incremental assertEquals( listOf(TEST_DATA_DIR.resolve("User.java").absoluteFile, TEST_DATA_DIR.resolve("Address.java").absoluteFile), dirtyFiles.toReprocess @@ -49,7 +49,7 @@ class TestSimpleIncrementalAptCache { fun testIsolatingAnnotations() { runProcessor(SimpleProcessor().toIsolating()) - val dirtyFiles = cache.invalidateAndGetDirtyFiles(listOf(TEST_DATA_DIR.resolve("User.java")), emptyList()) as SourcesToReprocess.Incremental + val dirtyFiles = cache.invalidateAndGetDirtyFiles(listOf(TEST_DATA_DIR.resolve("User.java").absoluteFile), emptyList()) as SourcesToReprocess.Incremental assertFalse(generatedSources.resolve("test/UserGenerated.java").exists()) assertEquals( listOf(TEST_DATA_DIR.resolve("User.java").absoluteFile), @@ -61,7 +61,7 @@ class TestSimpleIncrementalAptCache { fun testNonIncremental() { runProcessor(SimpleProcessor().toNonIncremental()) - val dirtyFiles = cache.invalidateAndGetDirtyFiles(listOf(TEST_DATA_DIR.resolve("User.java")), emptyList()) + val dirtyFiles = cache.invalidateAndGetDirtyFiles(listOf(TEST_DATA_DIR.resolve("User.java").absoluteFile), emptyList()) assertTrue(dirtyFiles is SourcesToReprocess.FullRebuild) } From 05e47da4583789e3cfdf0b4a6578f3ac19756e2b Mon Sep 17 00:00:00 2001 From: Ivan Gavrilovic Date: Fri, 27 Nov 2020 11:21:10 +0000 Subject: [PATCH 401/698] Incremental KAPT: simplify impacted types computation Process aggregating types first, and when computing impacted types compute isolating generated impacted by classpath changes first. --- .../base/incremental/IncrementalAptCache.kt | 4 +- .../kotlin/kapt3/base/incremental/cache.kt | 75 +++++++------------ .../base/incremental/classStructureCache.kt | 5 +- 3 files changed, 31 insertions(+), 53 deletions(-) diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/IncrementalAptCache.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/IncrementalAptCache.kt index bb3697dc4b0..adc0f4d5ad9 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/IncrementalAptCache.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/IncrementalAptCache.kt @@ -115,8 +115,8 @@ class IncrementalAptCache : Serializable { } /** Gets the originating type for the specified type generated by isolating AP. */ - fun getOriginForGeneratedIsolatingType(generatedType: String, sourceFileProvider: (String) -> File?): String { - val generatedFile = checkNotNull(sourceFileProvider(generatedType)) { "Unable to find source for $generatedType" } + fun getOriginForGeneratedIsolatingType(generatedType: String, sourceFileProvider: (String) -> File): String { + val generatedFile = sourceFileProvider(generatedType) return isolatingMapping.getValue(generatedFile) } diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/cache.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/cache.kt index a6f8936cfb8..513321ecfff 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/cache.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/cache.kt @@ -55,49 +55,40 @@ class JavaClassCacheManager(val file: File) : Closeable { val sourcesToReprocess = changedSources.toMutableSet() val classNamesToReprocess = mutableListOf() - var shouldProcessAggregating = false - for (impactedType in impactedTypes) { - if (impactedType !in isolatingGeneratedTypes && impactedType !in aggregatingGeneratedTypes) { - // Reprocess only if original source - javaCache.getSourceForType(impactedType)?.let { - sourcesToReprocess.add(it) - } - } else if (impactedType in isolatingGeneratedTypes) { - // this is a generated type by isolating AP - val isolatingOrigin = aptCache.getOriginForGeneratedIsolatingType(impactedType, javaCache::getSourceForType) - if (isolatingOrigin in impactedTypes) { - // we'll process origin, no need to do it now - continue - } - val originSource = javaCache.getSourceForType(isolatingOrigin) - if (originSource?.extension == "java") { - sourcesToReprocess.add(originSource) - } else if (originSource?.extension == "class") { - // This is a generated .class file that we need to reprocess. - classNamesToReprocess.add(isolatingOrigin) - } else { - // This is a type from classpath that was used as origin, just ignore it. It is used just to remove the generated file. - } - } else { - // processed separately - shouldProcessAggregating = true - } - } - - if (shouldProcessAggregating || sourcesToReprocess.isNotEmpty() || classNamesToReprocess.isNotEmpty()) { + if (changedSources.isNotEmpty() || impactedTypes.isNotEmpty()) { for (aggregatingOrigin in aptCache.getAggregatingOrigins()) { if (aggregatingOrigin in impactedTypes) continue val originSource = javaCache.getSourceForType(aggregatingOrigin) - if (originSource?.extension == "java") { + if (originSource.extension == "java") { sourcesToReprocess.add(originSource) - } else if (originSource?.extension == "class") { + } else if (originSource.extension == "class") { // This is a generated .class file that we need to reprocess. classNamesToReprocess.add(aggregatingOrigin) } } + } + for (impactedType in impactedTypes) { + if (impactedType !in isolatingGeneratedTypes && impactedType !in aggregatingGeneratedTypes) { + sourcesToReprocess.add(javaCache.getSourceForType(impactedType)) + } else if (impactedType in isolatingGeneratedTypes) { + // this is a generated type by isolating AP + val isolatingOrigin = aptCache.getOriginForGeneratedIsolatingType(impactedType, javaCache::getSourceForType) + if (isolatingOrigin in impactedTypes || isolatingOrigin in dirtyClasspathFqNames) { + continue + } + val originSource = javaCache.getSourceForType(isolatingOrigin) + if (originSource.extension == "java") { + sourcesToReprocess.add(originSource) + } else if (originSource.extension == "class") { + classNamesToReprocess.add(isolatingOrigin) + } + } + } + + if (sourcesToReprocess.isNotEmpty() || classNamesToReprocess.isNotEmpty()) { // Invalidate state only if there are some files that will be reprocessed javaCache.invalidateDataForTypes(impactedTypes) aptCache.invalidateAggregating() @@ -111,27 +102,13 @@ class JavaClassCacheManager(val file: File) : Closeable { private fun getAllImpactedTypes(changes: Changes, aggregatingGeneratedTypes: Set): MutableSet { val impactedTypes = javaCache.getAllImpactedTypes(changes) - - /** - * In order to find all impacted types we do the following: - * - impacted types is a set of types that have changed from the previous compilation - * - if there is a changed source or a source file that is impacted by type changes, we'll need to run aggregating APs, so we - * invalidate all aggregating generated types, and add them to set of impacted types. - * - using this new impacted types set, we find all types generated by isolating APs with origins in those types - * - if there are some generated types by isolating APs, we'll need to run aggregating APs, so we invalidate all aggregating types - * and add them to impacted types. - * - using the final value of impacted types we get all generated types by isolating APs and add them to impacted types - */ + // check isolating with origins from the classpath + impactedTypes.addAll(aptCache.getIsolatingGeneratedTypesForOrigins(changes.dirtyFqNamesFromClasspath, javaCache::getTypesForFiles)) if (changes.sourceChanges.isNotEmpty() || impactedTypes.isNotEmpty()) { // Any source change or any source impacted by type change invalidates aggregating APs generated types impactedTypes.addAll(aggregatingGeneratedTypes) } - aptCache.getIsolatingGeneratedTypesForOrigins(changes.dirtyFqNamesFromClasspath, javaCache::getTypesForFiles).let { - if (it.isNotEmpty()) { - impactedTypes.addAll(it) - impactedTypes.addAll(aggregatingGeneratedTypes) - } - } + // now check isolating with origins in any of the impacted types aptCache.getIsolatingGeneratedTypesForOrigins(impactedTypes, javaCache::getTypesForFiles).let { impactedTypes.addAll(it) } diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/classStructureCache.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/classStructureCache.kt index 0bf8dc97aa5..91e53ebe20b 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/classStructureCache.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/classStructureCache.kt @@ -10,6 +10,7 @@ import java.io.ObjectInputStream import java.io.ObjectOutputStream import java.io.Serializable import java.lang.IllegalArgumentException +import java.lang.IllegalStateException import java.net.URI /** @@ -147,13 +148,13 @@ class JavaClassCache() : Serializable { sourceCache.clear() } - fun getSourceForType(type: String): File? { + fun getSourceForType(type: String): File { sourceCache.forEach { (fileUri, typeInfo) -> if (type in typeInfo.getDeclaredTypes()) { return File(fileUri) } } - return null + throw IllegalStateException("Unable to find source file for type $type") } fun invalidateDataForTypes(impactedTypes: MutableSet) { From 0522583602b6e272c733a345bb89b5591ec8a33e Mon Sep 17 00:00:00 2001 From: Ivan Gavrilovic Date: Fri, 27 Nov 2020 11:22:33 +0000 Subject: [PATCH 402/698] Incremental KAPT: add test for isolating AP with classpath origin Add a regression test for KT-34340 that allows APs to have classpath types as origins. --- .../KaptIncrementalWithAggregatingApt.kt | 1 - .../gradle/KaptIncrementalWithIsolatingApt.kt | 40 +++++++++++++++---- .../baseLibrary/build.gradle | 29 ++++++++++++++ .../baseLibrary/src/main/AndroidManifest.xml | 5 +++ .../lib2/basemodule/BaseClassParcel.java | 8 ++++ .../lib2/basemodule/FieldClassParcel.java | 7 ++++ .../kaptIncrementalWithParceler/build.gradle | 20 ++++++++++ .../mylibrary/build.gradle | 30 ++++++++++++++ .../mylibrary/src/main/AndroidManifest.xml | 5 +++ .../java/com/example/lib/ExampleParcel.java | 31 ++++++++++++++ .../settings.gradle | 3 ++ 11 files changed, 171 insertions(+), 8 deletions(-) create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/baseLibrary/build.gradle create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/baseLibrary/src/main/AndroidManifest.xml create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/baseLibrary/src/main/java/com/example/lib2/basemodule/BaseClassParcel.java create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/baseLibrary/src/main/java/com/example/lib2/basemodule/FieldClassParcel.java create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/build.gradle create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/mylibrary/build.gradle create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/mylibrary/src/main/AndroidManifest.xml create mode 100755 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/mylibrary/src/main/java/com/example/lib/ExampleParcel.java create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/settings.gradle diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithAggregatingApt.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithAggregatingApt.kt index 156d4ac1650..632bf06045d 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithAggregatingApt.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithAggregatingApt.kt @@ -27,7 +27,6 @@ class KaptIncrementalWithAggregatingApt : KaptIncrementalIT() { override fun defaultBuildOptions(): BuildOptions = super.defaultBuildOptions().copy( incremental = true, - debug=false, kaptOptions = KaptOptions( verbose = true, useWorkers = true, diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt index 4ef3d4bd631..b5213788956 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt @@ -7,13 +7,11 @@ package org.jetbrains.kotlin.gradle import org.jetbrains.kotlin.gradle.incapt.IncrementalProcessor import org.jetbrains.kotlin.gradle.incapt.IncrementalProcessorReferencingClasspath +import org.jetbrains.kotlin.gradle.util.AGPVersion import org.jetbrains.kotlin.gradle.util.modify import org.junit.Assert.assertEquals import org.junit.Assume import org.junit.Test -import org.objectweb.asm.ClassWriter -import org.objectweb.asm.Opcodes -import org.objectweb.asm.Type import test.kt33617.MyClass import java.io.File import java.util.zip.ZipEntry @@ -229,7 +227,7 @@ class KaptIncrementalWithIsolatingApt : KaptIncrementalIT() { } """.trimIndent() ) - project.build("clean", "kaptKotlin") { + project.build("clean", "build") { assertSuccessful() } @@ -249,13 +247,41 @@ class KaptIncrementalWithIsolatingApt : KaptIncrementalIT() { ) } } + + /** Regression test for KT-34340. */ + @Test + fun testIsolatingWithOriginsInClasspath() { + val project = Project("kaptIncrementalWithParceler", GradleVersionRequired.None).apply { + setupWorkingDir() + } + val options = defaultBuildOptions().copy(androidGradlePluginVersion = AGPVersion.v3_4_1) + project.build("clean", ":mylibrary:assembleDebug", options = options) { + assertSuccessful() + } + + project.projectFile("BaseClassParcel.java").modify { current -> + current.replace("protected FieldClassParcel", "private FieldClassParcel") + } + + project.build(":mylibrary:assembleDebug", options = options) { + assertSuccessful() + assertEquals( + setOf( + fileInWorkingDir("mylibrary/src/main/java/com/example/lib/ExampleParcel.java").canonicalPath, + fileInWorkingDir("baseLibrary/src/main/java/com/example/lib2/basemodule/BaseClassParcel.java").canonicalPath, + ), + getProcessedSources(output) + ) + } + } } private const val patternApt = "Processing java sources with annotation processors:" fun getProcessedSources(output: String): Set { - val logging = output.lines().single { it.contains(patternApt) } - val indexOf = logging.indexOf(patternApt) + patternApt.length - return logging.drop(indexOf).split(",").map { it.trim() }.filter { !it.isEmpty() }.toSet() + return output.lines().filter { it.contains(patternApt) }.flatMapTo(HashSet()) { logging -> + val indexOf = logging.indexOf(patternApt) + patternApt.length + logging.drop(indexOf).split(",").map { it.trim() }.filter { !it.isEmpty() }.toSet() + } } fun BaseGradleIT.Project.setupIncrementalAptProject( diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/baseLibrary/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/baseLibrary/build.gradle new file mode 100644 index 00000000000..de1826342f2 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/baseLibrary/build.gradle @@ -0,0 +1,29 @@ +plugins { + id 'com.android.library' + id 'kotlin-android' + id 'kotlin-kapt' +} + +android { + compileSdkVersion 30 + + defaultConfig { + minSdkVersion 16 + targetSdkVersion 30 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles "consumer-rules.pro" + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + kapt 'org.parceler:parceler:1.1.12' + implementation 'org.parceler:parceler-api:1.1.12' +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/baseLibrary/src/main/AndroidManifest.xml b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/baseLibrary/src/main/AndroidManifest.xml new file mode 100644 index 00000000000..55745af377f --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/baseLibrary/src/main/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/baseLibrary/src/main/java/com/example/lib2/basemodule/BaseClassParcel.java b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/baseLibrary/src/main/java/com/example/lib2/basemodule/BaseClassParcel.java new file mode 100644 index 00000000000..7cc85c4f82b --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/baseLibrary/src/main/java/com/example/lib2/basemodule/BaseClassParcel.java @@ -0,0 +1,8 @@ +package com.example.lib2.basemodule; + +import org.parceler.Parcel; + +@Parcel +public class BaseClassParcel { + protected FieldClassParcel testField; +} diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/baseLibrary/src/main/java/com/example/lib2/basemodule/FieldClassParcel.java b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/baseLibrary/src/main/java/com/example/lib2/basemodule/FieldClassParcel.java new file mode 100644 index 00000000000..b06171ef3c4 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/baseLibrary/src/main/java/com/example/lib2/basemodule/FieldClassParcel.java @@ -0,0 +1,7 @@ +package com.example.lib2.basemodule; + +import org.parceler.Parcel; + +@Parcel +public class FieldClassParcel { +} diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/build.gradle new file mode 100644 index 00000000000..a5eb46aae03 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/build.gradle @@ -0,0 +1,20 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +buildscript { + repositories { + mavenLocal() + maven { url 'https://maven.google.com' } + jcenter() + } + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.android.tools.build:gradle:$android_tools_version" + } +} + +allprojects { + repositories { + mavenLocal() + maven { url 'https://maven.google.com' } + jcenter() + } +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/mylibrary/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/mylibrary/build.gradle new file mode 100644 index 00000000000..af869d82f01 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/mylibrary/build.gradle @@ -0,0 +1,30 @@ +plugins { + id 'com.android.library' + id 'kotlin-android' + id 'kotlin-kapt' +} + +android { + compileSdkVersion 30 + + defaultConfig { + minSdkVersion 16 + targetSdkVersion 30 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles "consumer-rules.pro" + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + kapt 'org.parceler:parceler:1.1.12' + implementation 'org.parceler:parceler-api:1.1.12' + implementation project(":baseLibrary") +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/mylibrary/src/main/AndroidManifest.xml b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/mylibrary/src/main/AndroidManifest.xml new file mode 100644 index 00000000000..ed91afc87d1 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/mylibrary/src/main/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/mylibrary/src/main/java/com/example/lib/ExampleParcel.java b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/mylibrary/src/main/java/com/example/lib/ExampleParcel.java new file mode 100755 index 00000000000..b24f28ed940 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/mylibrary/src/main/java/com/example/lib/ExampleParcel.java @@ -0,0 +1,31 @@ +// Sample project obtained from https://youtrack.jetbrains.com/issue/KT-34340, +// originally obtained from https://github.com/johncarl81/parceler. +package com.example.lib; + + +import com.example.lib2.basemodule.BaseClassParcel; + +import org.parceler.Parcel; +import org.parceler.ParcelFactory; + +/** + * Intentionally in a different package to make sure we don't accidentally match it with org.parceler Proguard matchers. + */ +@Parcel +public class ExampleParcel extends BaseClassParcel { + + private final String message; + + @ParcelFactory + public static ExampleParcel create(String message) { + return new ExampleParcel(message); + } + + public ExampleParcel(String message) { + this.message = message; + } + + public String getMessage(){ + return message; + } +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/settings.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/settings.gradle new file mode 100644 index 00000000000..ce68b0e9dc5 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalWithParceler/settings.gradle @@ -0,0 +1,3 @@ +rootProject.name = "PrarclerIncapKapt" +include ':mylibrary' +include ':baseLibrary' From 08a2b47c77c80251b7e18910dfd1661738c8dc18 Mon Sep 17 00:00:00 2001 From: Ivan Gavrilovic Date: Tue, 1 Dec 2020 17:12:14 +0000 Subject: [PATCH 403/698] Incremental KAPT: fix typo and do check processed sources on clean build --- .../gradle/KaptIncrementalWithIsolatingApt.kt | 21 ++++++++++--------- .../base/incremental/incrementalProcessors.kt | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt index b5213788956..4ce515d8f13 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt @@ -227,24 +227,25 @@ class KaptIncrementalWithIsolatingApt : KaptIncrementalIT() { } """.trimIndent() ) + + val allKotlinStubs = setOf( + project.projectDir.resolve("build/tmp/kapt3/stubs/main/foo/A.java").canonicalPath, + project.projectDir.resolve("build/tmp/kapt3/stubs/main/bar/B.java").canonicalPath, + project.projectDir.resolve("build/tmp/kapt3/stubs/main/bar/UseBKt.java").canonicalPath, + project.projectDir.resolve("build/tmp/kapt3/stubs/main/baz/UtilKt.java").canonicalPath, + project.projectDir.resolve("build/tmp/kapt3/stubs/main/error/NonExistentClass.java").canonicalPath + ) + project.build("clean", "build") { assertSuccessful() + assertEquals(allKotlinStubs + fileInWorkingDir("src/main/java/foo/JavaClass.java").canonicalPath, getProcessedSources(output)) } // change type that all generated sources reference classpathTypeSource.writeText(classpathTypeSource.readText().replace("}", "int i = 10;\n}")) project.build("build") { assertSuccessful() - assertEquals( - setOf( - fileInWorkingDir("build/tmp/kapt3/stubs/main/foo/A.java").canonicalPath, - fileInWorkingDir("build/tmp/kapt3/stubs/main/bar/B.java").canonicalPath, - fileInWorkingDir("build/tmp/kapt3/stubs/main/bar/UseBKt.java").canonicalPath, - fileInWorkingDir("build/tmp/kapt3/stubs/main/baz/UtilKt.java").canonicalPath, - fileInWorkingDir("build/tmp/kapt3/stubs/main/error/NonExistentClass.java").canonicalPath - ), - getProcessedSources(output) - ) + assertEquals(allKotlinStubs, getProcessedSources(output)) } } diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/incrementalProcessors.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/incrementalProcessors.kt index 109b9a30e0e..a674abc535c 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/incrementalProcessors.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/incrementalProcessors.kt @@ -71,7 +71,7 @@ class IncrementalProcessor(private val processor: Processor, private val kind: D fun isUnableToRunIncrementally() = !kind.canRunIncrementally - /** Mapping fromm generated file to type that were used as originating elements. For aggregating APs types will be [null]. */ + /** Mapping from generated file to type that were used as originating elements. For aggregating APs types will be [null]. */ fun getGeneratedToSources(): Map = dependencyCollector.value.getGeneratedToSources() /** All top-level types that were processed by aggregating APs. */ From 11673bd09c10a0059d2d5cda3923701d181b5e87 Mon Sep 17 00:00:00 2001 From: Ivan Gavrilovic Date: Wed, 2 Dec 2020 12:19:34 +0000 Subject: [PATCH 404/698] KAPT: add tests for processed types, remove dead code, simplify logic Add integration test which checks if only types can be reprocessed in an incremental round. Also, remove unused `invalidateTypesForFiles` method. Furthermore, clarify that types that are reprocessed (i.e types from .class files) are not necessarily aggregating types, but simply types that should be reprocessed. Test: KaptIncrementalWithIsolatingApt.testClasspathChangesCauseTypesToBeReprocessed --- ...regatingReferencingClasspathProcessor.java | 57 +++++++++++ .../gradle/KaptIncrementalWithIsolatingApt.kt | 97 +++++++++++++++++++ .../build.gradle | 4 + .../org/jetbrains/kotlin/kapt3/base/Kapt.kt | 2 +- .../kotlin/kapt3/base/annotationProcessing.kt | 8 +- .../kotlin/kapt3/base/incremental/cache.kt | 3 +- .../base/incremental/classStructureCache.kt | 11 --- 7 files changed, 164 insertions(+), 18 deletions(-) create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/java/org/jetbrains/kotlin/gradle/incapt/IncrementalAggregatingReferencingClasspathProcessor.java diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/java/org/jetbrains/kotlin/gradle/incapt/IncrementalAggregatingReferencingClasspathProcessor.java b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/java/org/jetbrains/kotlin/gradle/incapt/IncrementalAggregatingReferencingClasspathProcessor.java new file mode 100644 index 00000000000..74c7286ac6f --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/java/org/jetbrains/kotlin/gradle/incapt/IncrementalAggregatingReferencingClasspathProcessor.java @@ -0,0 +1,57 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.gradle.incapt; + +import javax.annotation.processing.AbstractProcessor; +import javax.annotation.processing.RoundEnvironment; +import javax.lang.model.element.Element; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.TypeElement; +import javax.lang.model.element.VariableElement; +import java.io.IOException; +import java.io.Writer; +import java.util.Collections; +import java.util.Set; +import java.util.TreeSet; + +public class IncrementalAggregatingReferencingClasspathProcessor extends AbstractProcessor { + + // Type that the generated source will extend. + public static final String CLASSPATH_TYPE = "com.example.FromClasspath"; + + private Set values = new TreeSet(); + + @Override + public Set getSupportedAnnotationTypes() { + return Collections.singleton("example.KotlinFilerGenerated"); + } + + @Override + public boolean process(Set annotations, RoundEnvironment roundEnv) { + for (TypeElement annotation : annotations) { + for (Element element : roundEnv.getElementsAnnotatedWith(annotation)) { + if (element instanceof TypeElement || element instanceof ExecutableElement || element instanceof VariableElement) { + values.add(element.getSimpleName().toString()); + } + } + } + + if (roundEnv.processingOver() && !values.isEmpty()) { + + try (Writer writer = processingEnv.getFiler().createSourceFile("com.example.AggGenerated").openWriter()) { + writer.append("package ").append("com.example").append(";"); + writer.append("\npublic class ").append("AggGenerated").append(" extends ").append(CLASSPATH_TYPE).append(" {}"); + } + catch (IOException e) { + throw new RuntimeException(e); + } + + values.clear(); + } + + return true; + } +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt index 4ce515d8f13..345ead8fd05 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt @@ -5,11 +5,14 @@ package org.jetbrains.kotlin.gradle +import org.jetbrains.kotlin.gradle.incapt.IncrementalAggregatingReferencingClasspathProcessor +import org.jetbrains.kotlin.gradle.incapt.IncrementalBinaryIsolatingProcessor import org.jetbrains.kotlin.gradle.incapt.IncrementalProcessor import org.jetbrains.kotlin.gradle.incapt.IncrementalProcessorReferencingClasspath import org.jetbrains.kotlin.gradle.util.AGPVersion import org.jetbrains.kotlin.gradle.util.modify import org.junit.Assert.assertEquals +import org.junit.Assert.assertTrue import org.junit.Assume import org.junit.Test import test.kt33617.MyClass @@ -275,6 +278,92 @@ class KaptIncrementalWithIsolatingApt : KaptIncrementalIT() { ) } } + + /** + * Make sure that changes to classpath can cause types to be reprocessed (i.e types in generated .class files that contain annotations + * claimed by annotation processors). + */ + @Test + fun testClasspathChangesCauseTypesToBeReprocessed() { + val project = Project( + "kaptIncrementalCompilationProject", + GradleVersionRequired.None + ).apply { + setupIncrementalAptProject( + Pair("ISOLATING", IncrementalBinaryIsolatingProcessor::class.java), + Pair("AGGREGATING", IncrementalAggregatingReferencingClasspathProcessor::class.java), + ) + } + project.gradleSettingsScript().writeText("include ':', ':lib'") + val classpathTypeSource = project.projectDir.resolve("lib").run { + mkdirs() + resolve("build.gradle").writeText("apply plugin: 'java'") + val source = + resolve("src/main/java/" + IncrementalAggregatingReferencingClasspathProcessor.CLASSPATH_TYPE.replace(".", "/") + ".java") + source.parentFile.mkdirs() + + source.writeText( + """ + package ${IncrementalAggregatingReferencingClasspathProcessor.CLASSPATH_TYPE.substringBeforeLast(".")}; + public class ${IncrementalAggregatingReferencingClasspathProcessor.CLASSPATH_TYPE.substringAfterLast(".")} {} + """.trimIndent() + ) + return@run source + } + project.gradleBuildScript().appendText( + """ + + dependencies { + implementation project(':lib') + } + """.trimIndent() + ) + + // Remove all sources, and add only 1 source file + project.projectDir.resolve("src").let { + it.deleteRecursively() + with(it.resolve("main/java/example/A.kt")) { + parentFile.mkdirs() + writeText( + """ + package example + + annotation class ExampleAnnotation + @ExampleAnnotation + class A + """.trimIndent() + ) + } + } + + val allKotlinStubs = setOf( + project.projectDir.resolve("build/tmp/kapt3/stubs/main/example/ExampleAnnotation.java").canonicalPath, + project.projectDir.resolve("build/tmp/kapt3/stubs/main/example/A.java").canonicalPath, + project.projectDir.resolve("build/tmp/kapt3/stubs/main/error/NonExistentClass.java").canonicalPath + ) + + project.build("clean", "build") { + assertSuccessful() + assertEquals(allKotlinStubs, getProcessedSources(output)) + + assertTrue( + "Aggregating sources exists", + fileInWorkingDir("build/generated/source/kapt/main/com/example/AggGenerated.java").exists() + ) + } + + // change type that the aggregated generated source reference + classpathTypeSource.writeText(classpathTypeSource.readText().replace("}", "int i = 10;\n}")) + project.build("build") { + assertSuccessful() + assertEquals(emptySet(), getProcessedSources(output)) + assertEquals(setOf("example.AGenerated"), getProcessedTypes(output)) + assertTrue( + "Aggregating sources exists", + fileInWorkingDir("build/generated/source/kapt/main/com/example/AggGenerated.java").exists() + ) + } + } } private const val patternApt = "Processing java sources with annotation processors:" @@ -285,6 +374,14 @@ fun getProcessedSources(output: String): Set { } } +private const val patternClassesApt = "Processing types with annotation processors: " +fun getProcessedTypes(output: String): Set { + return output.lines().filter { it.contains(patternClassesApt) }.flatMapTo(HashSet()) { logging -> + val indexOf = logging.indexOf(patternClassesApt) + patternClassesApt.length + logging.drop(indexOf).split(",").map { it.trim() }.filter { !it.isEmpty() }.toSet() + } +} + fun BaseGradleIT.Project.setupIncrementalAptProject( procType: String, buildFile: File = projectDir.resolve("build.gradle"), diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalCompilationProject/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalCompilationProject/build.gradle index b347cdb6bbc..f1f80a4ca42 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalCompilationProject/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kaptIncrementalCompilationProject/build.gradle @@ -15,11 +15,15 @@ apply plugin: "kotlin-kapt" repositories { jcenter() mavenLocal() + maven { + url "https://jetbrains.bintray.com/intellij-third-party-dependencies/" + } } dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version" kapt "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version" + kapt "org.jetbrains.intellij.deps:asm-all:9.0" testImplementation 'junit:junit:4.12' } \ No newline at end of file diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/Kapt.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/Kapt.kt index 35732bf20a2..140e3818f06 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/Kapt.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/Kapt.kt @@ -45,7 +45,7 @@ object Kapt { kaptContext.doAnnotationProcessing( javaSourceFiles, processors.processors, - aggregatedTypes = collectAggregatedTypes(kaptContext.sourcesToReprocess) + binaryTypesToReprocess = collectAggregatedTypes(kaptContext.sourcesToReprocess) ) } diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/annotationProcessing.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/annotationProcessing.kt index 3ce96ff3de6..7475a7f3129 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/annotationProcessing.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/annotationProcessing.kt @@ -14,7 +14,6 @@ import com.sun.tools.javac.processing.JavacProcessingEnvironment import com.sun.tools.javac.tree.JCTree import org.jetbrains.kotlin.base.kapt3.KaptFlag import org.jetbrains.kotlin.kapt3.base.incremental.* -import org.jetbrains.kotlin.kapt3.base.javac.KaptJavaCompiler import org.jetbrains.kotlin.kapt3.base.util.KaptBaseError import org.jetbrains.kotlin.kapt3.base.util.KaptLogger import org.jetbrains.kotlin.kapt3.base.util.isJava9OrLater @@ -33,7 +32,7 @@ fun KaptContext.doAnnotationProcessing( javaSourceFiles: List, processors: List, additionalSources: JavacList = JavacList.nil(), - aggregatedTypes: List = emptyList() + binaryTypesToReprocess: List = emptyList() ) { val processingEnvironment = JavacProcessingEnvironment.instance(context) @@ -41,7 +40,7 @@ fun KaptContext.doAnnotationProcessing( val compilerAfterAP: JavaCompiler try { - if (javaSourceFiles.isEmpty() && aggregatedTypes.isEmpty() && additionalSources.isEmpty()) { + if (javaSourceFiles.isEmpty() && binaryTypesToReprocess.isEmpty() && additionalSources.isEmpty()) { if (logger.isVerbose) { logger.info("Skipping annotation processing as all sources are up-to-date.") } @@ -57,6 +56,7 @@ fun KaptContext.doAnnotationProcessing( if (logger.isVerbose) { logger.info("Processing java sources with annotation processors: ${javaSourceFiles.joinToString()}") + logger.info("Processing types with annotation processors: ${binaryTypesToReprocess.joinToString()}") } val parsedJavaFiles = parseJavaFiles(javaSourceFiles) @@ -74,7 +74,7 @@ fun KaptContext.doAnnotationProcessing( CompileState.PARSE, compiler.enterTrees(parsedJavaFiles + additionalSources) ) - val additionalClassNames = JavacList.from(aggregatedTypes) + val additionalClassNames = JavacList.from(binaryTypesToReprocess) if (isJava9OrLater()) { val processAnnotationsMethod = compiler.javaClass.getMethod("processAnnotations", JavacList::class.java, java.util.Collection::class.java) diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/cache.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/cache.kt index 513321ecfff..90a17d0be90 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/cache.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/cache.kt @@ -93,8 +93,7 @@ class JavaClassCacheManager(val file: File) : Closeable { javaCache.invalidateDataForTypes(impactedTypes) aptCache.invalidateAggregating() // for isolating, invalidate both own types and classpath types - aptCache.invalidateIsolatingForOriginTypes(impactedTypes) - aptCache.invalidateIsolatingForOriginTypes(dirtyClasspathFqNames) + aptCache.invalidateIsolatingForOriginTypes(impactedTypes + dirtyClasspathFqNames) } return SourcesToReprocess.Incremental(sourcesToReprocess.toList(), impactedTypes, classNamesToReprocess) diff --git a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/classStructureCache.kt b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/classStructureCache.kt index 91e53ebe20b..2f64043510a 100644 --- a/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/classStructureCache.kt +++ b/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/classStructureCache.kt @@ -31,17 +31,6 @@ class JavaClassCache() : Serializable { sourceCache[sourceStructure.sourceFile] = sourceStructure } - /** Invalidates types for these files, and return the list of invalidated types.*/ - fun invalidateTypesForFiles(files: List): Set { - val typesFromFiles = HashSet() - for (file in files) { - sourceCache.remove(file.toURI())?.getDeclaredTypes()?.let { - typesFromFiles.addAll(it) - } - } - return typesFromFiles - } - /** Returns all types defined in these files. */ fun getTypesForFiles(files: Collection): Set { val typesFromFiles = HashSet(files.size) From e6a3e38c4dbd65f60a7e06ac4f1c0bd6fe437276 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Wed, 2 Dec 2020 14:58:05 +0300 Subject: [PATCH 405/698] JVM_IR no static inline class members for Kotlin JvmDefault methods KT-43698 KT-43051 --- .../ir/FirBlackBoxCodegenTestGenerated.java | 53 +++++++++++++++++ .../MemoizedInlineClassReplacements.kt | 14 ++++- .../javaDefaultMethod.kt | 38 ++++++++++++ .../javaDefaultMethodOverriddenByKotlin.kt | 49 +++++++++++++++ .../jvmDefaultAll.kt | 48 +++++++++++++++ .../jvmDefaultAllPrimaryProperty.kt | 44 ++++++++++++++ .../jvmDefaultAllProperty.kt | 50 ++++++++++++++++ .../jvmDefaultEnable.kt | 48 +++++++++++++++ .../jvmDefaultEnablePrimaryProperty.kt | 44 ++++++++++++++ .../jvmDefaultEnableProperty.kt | 50 ++++++++++++++++ .../javaDefaultInterfaceMember.kt | 38 ++++++++++++ .../javaDefaultInterfaceMember.txt | 59 +++++++++++++++++-- .../defaultInterfaceMembers/jvmDefaultAll.kt | 18 ++++++ .../defaultInterfaceMembers/jvmDefaultAll.txt | 53 +++++++++++++++++ .../jvmDefaultAll_ir.txt | 53 +++++++++++++++++ .../jvmDefaultEnable.kt | 18 ++++++ .../jvmDefaultEnable.txt | 53 +++++++++++++++++ .../jvmDefaultEnable_ir.txt | 53 +++++++++++++++++ .../javaDefaultInterfaceMember.kt | 22 ------- .../interfaceJvmDefaultImplStubs.kt | 5 +- .../codegen/BlackBoxCodegenTestGenerated.java | 53 +++++++++++++++++ .../codegen/BytecodeListingTestGenerated.java | 33 +++++++++-- .../LightAnalysisModeTestGenerated.java | 53 +++++++++++++++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 53 +++++++++++++++++ .../ir/IrBytecodeListingTestGenerated.java | 33 +++++++++-- .../IrJsCodegenBoxES6TestGenerated.java | 13 ++++ .../IrJsCodegenBoxTestGenerated.java | 13 ++++ .../semantics/JsCodegenBoxTestGenerated.java | 13 ++++ .../IrCodegenBoxWasmTestGenerated.java | 13 ++++ 29 files changed, 1044 insertions(+), 43 deletions(-) create mode 100644 compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethod.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethodOverriddenByKotlin.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAll.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllPrimaryProperty.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllProperty.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnable.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnablePrimaryProperty.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnableProperty.kt create mode 100644 compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/javaDefaultInterfaceMember.kt rename compiler/testData/codegen/bytecodeListing/inlineClasses/{ => defaultInterfaceMembers}/javaDefaultInterfaceMember.txt (60%) create mode 100644 compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultAll.kt create mode 100644 compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultAll.txt create mode 100644 compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultAll_ir.txt create mode 100644 compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultEnable.kt create mode 100644 compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultEnable.txt create mode 100644 compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultEnable_ir.txt delete mode 100644 compiler/testData/codegen/bytecodeListing/inlineClasses/javaDefaultInterfaceMember.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 4b71254f03d..da2726859e0 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -15164,6 +15164,59 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Jvm8DefaultInterfaceMethods extends AbstractFirBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); + } + + public void testAllFilesPresentInJvm8DefaultInterfaceMethods() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("javaDefaultMethod.kt") + public void testJavaDefaultMethod() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethod.kt"); + } + + @TestMetadata("javaDefaultMethodOverriddenByKotlin.kt") + public void testJavaDefaultMethodOverriddenByKotlin() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethodOverriddenByKotlin.kt"); + } + + @TestMetadata("jvmDefaultAll.kt") + public void testJvmDefaultAll() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAll.kt"); + } + + @TestMetadata("jvmDefaultAllPrimaryProperty.kt") + public void testJvmDefaultAllPrimaryProperty() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllPrimaryProperty.kt"); + } + + @TestMetadata("jvmDefaultAllProperty.kt") + public void testJvmDefaultAllProperty() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllProperty.kt"); + } + + @TestMetadata("jvmDefaultEnable.kt") + public void testJvmDefaultEnable() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnable.kt"); + } + + @TestMetadata("jvmDefaultEnablePrimaryProperty.kt") + public void testJvmDefaultEnablePrimaryProperty() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnablePrimaryProperty.kt"); + } + + @TestMetadata("jvmDefaultEnableProperty.kt") + public void testJvmDefaultEnableProperty() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnableProperty.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/propertyDelegation") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/inlineclasses/MemoizedInlineClassReplacements.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/inlineclasses/MemoizedInlineClassReplacements.kt index 1407ef3875a..298dbd39fca 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/inlineclasses/MemoizedInlineClassReplacements.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/inlineclasses/MemoizedInlineClassReplacements.kt @@ -13,6 +13,7 @@ import org.jetbrains.kotlin.backend.jvm.JvmBackendContext import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin import org.jetbrains.kotlin.backend.jvm.codegen.classFileContainsMethod import org.jetbrains.kotlin.backend.jvm.codegen.isJvmInterface +import org.jetbrains.kotlin.backend.jvm.ir.isCompiledToJvmDefault import org.jetbrains.kotlin.backend.jvm.ir.isFromJava import org.jetbrains.kotlin.backend.jvm.ir.isStaticInlineClassReplacement import org.jetbrains.kotlin.backend.jvm.lower.inlineclasses.InlineClassAbi.mangledNameFor @@ -71,7 +72,7 @@ class MemoizedInlineClassReplacements( when { it.isRemoveAtSpecialBuiltinStub() -> null - it.isInlineClassMemberFakeOverriddenFromDefaultJavaInterfaceMethod() -> + it.isInlineClassMemberFakeOverriddenFromJvmDefaultInterfaceMethod() -> null it.origin == IrDeclarationOrigin.IR_BUILTINS_STUB -> createMethodReplacement(it) @@ -97,14 +98,21 @@ class MemoizedInlineClassReplacements( valueParameters.size == 1 && valueParameters[0].type.isInt() - private fun IrFunction.isInlineClassMemberFakeOverriddenFromDefaultJavaInterfaceMethod(): Boolean { + private fun IrFunction.isInlineClassMemberFakeOverriddenFromJvmDefaultInterfaceMethod(): Boolean { if (this !is IrSimpleFunction) return false if (!this.isFakeOverride) return false val parentClass = parentClassOrNull ?: return false if (!parentClass.isInline) return false val overridden = resolveFakeOverride() ?: return false - return overridden.isFromJava() && overridden.modality != Modality.ABSTRACT && overridden.parentAsClass.isJvmInterface + if (!overridden.parentAsClass.isJvmInterface) return false + if (overridden.modality == Modality.ABSTRACT) return false + + // We have a non-abstract interface member. + // It is a JVM default interface method if one of the following conditions are true: + // - it is a Java method, + // - it is a Kotlin function compiled to JVM default interface method. + return overridden.isFromJava() || overridden.isCompiledToJvmDefault(context.state.jvmDefaultMode) } /** diff --git a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethod.kt b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethod.kt new file mode 100644 index 00000000000..c0cfa2a8fee --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethod.kt @@ -0,0 +1,38 @@ +// TARGET_BACKEND: JVM +// IGNORE_LIGHT_ANALYSIS +// IGNORE_BACKEND: JVM +// ^ KT-43698, fixed in JVM_IR +// JVM_TARGET: 1.8 +// FILE: javaDefaultMethod.kt +inline class K(val k: String) : J { + override fun get2() = k +} + +fun box(): String { + val k = K("K") + + val test1 = k.get1() + k.get2() + if (test1 != "OK") throw AssertionError("test1: $test1") + + val j: J = k + val test2 = j.get1() + j.get2() + if (test2 != "OK") throw AssertionError("test2: $test2") + + val test3 = JT.test(k) + if (test3 != "OK") throw AssertionError("test3: $test3") + + return "OK" +} + +// FILE: J.java +public interface J { + default String get1() { return "O"; } + default String get2() { return "Failed"; } +} + +// FILE: JT.java +public class JT { + public static String test(J j) { + return j.get1() + j.get2(); + } +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethodOverriddenByKotlin.kt b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethodOverriddenByKotlin.kt new file mode 100644 index 00000000000..02ac7ea6202 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethodOverriddenByKotlin.kt @@ -0,0 +1,49 @@ +// TARGET_BACKEND: JVM +// IGNORE_LIGHT_ANALYSIS +// IGNORE_BACKEND: JVM +// ^ KT-43698, fixed in JVM_IR +// JVM_TARGET: 1.8 +// FILE: javaDefaultMethod.kt +interface K2 : J { + override fun get2() = "Kotlin" +} + +inline class K(val k: String) : K2 { + override fun get2() = k +} + +fun box(): String { + val k = K("K") + + val test1 = k.get1() + k.get2() + if (test1 != "OK") throw AssertionError("test1: $test1") + + val j: J = k + val test2 = j.get1() + j.get2() + if (test2 != "OK") throw AssertionError("test2: $test2") + + val test3 = JT.test(k) + if (test3 != "OK") throw AssertionError("test3: $test3") + + val k2: K2 = k + val test4 = k2.get1() + k2.get2() + if (test4 != "OK") throw AssertionError("test4: $test4") + + val test5 = JT.test(k2) + if (test5 != "OK") throw AssertionError("test5: $test5") + + return "OK" +} + +// FILE: J.java +public interface J { + default String get1() { return "O"; } + default String get2() { return "Java"; } +} + +// FILE: JT.java +public class JT { + public static String test(J j) { + return j.get1() + j.get2(); + } +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAll.kt b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAll.kt new file mode 100644 index 00000000000..3c40e5857ee --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAll.kt @@ -0,0 +1,48 @@ +// !JVM_DEFAULT_MODE: all +// TARGET_BACKEND: JVM +// IGNORE_LIGHT_ANALYSIS +// IGNORE_BACKEND: JVM +// ^ KT-43698, fixed in JVM_IR +// WITH_RUNTIME +// JVM_TARGET: 1.8 +// FILE: jvmDefaultAll.kt + +interface IFooBar { + fun foo() = "O" + fun bar() = "Failed" +} + +interface IFooBar2 : IFooBar + +inline class Test1(val k: String): IFooBar { + override fun bar(): String = k +} + +inline class Test2(val k: String): IFooBar2 { + override fun bar(): String = k +} + +fun box(): String { + val k = Test1("K") + val ik: IFooBar = k + val k2 = Test2("K") + val ik2: IFooBar = k2 + val ik3: IFooBar2 = k2 + + val test1 = k.foo() + k.bar() + if (test1 != "OK") throw AssertionError("test1: $test1") + + val test2 = ik.foo() + ik.bar() + if (test2 != "OK") throw AssertionError("test2: $test2") + + val test3 = k2.foo() + k2.bar() + if (test3 != "OK") throw AssertionError("test3: $test3") + + val test4 = ik2.foo() + ik2.bar() + if (test4 != "OK") throw AssertionError("test4: $test4") + + val test5 = ik3.foo() + ik3.bar() + if (test5 != "OK") throw AssertionError("test5: $test5") + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllPrimaryProperty.kt b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllPrimaryProperty.kt new file mode 100644 index 00000000000..0258f121629 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllPrimaryProperty.kt @@ -0,0 +1,44 @@ +// !JVM_DEFAULT_MODE: all +// TARGET_BACKEND: JVM +// IGNORE_LIGHT_ANALYSIS +// IGNORE_BACKEND: JVM +// ^ KT-43698, fixed in JVM_IR +// WITH_RUNTIME +// JVM_TARGET: 1.8 +// FILE: jvmDefaultAll.kt + +interface IFooBar { + val foo get() = "O" + val bar get() = "Failed" +} + +interface IFooBar2 : IFooBar + +inline class Test1(override val bar: String): IFooBar + +inline class Test2(override val bar: String): IFooBar2 + +fun box(): String { + val k = Test1("K") + val ik: IFooBar = k + val k2 = Test2("K") + val ik2: IFooBar = k2 + val ik3: IFooBar2 = k2 + + val test1 = k.foo + k.bar + if (test1 != "OK") throw AssertionError("test1: $test1") + + val test2 = ik.foo + ik.bar + if (test2 != "OK") throw AssertionError("test2: $test2") + + val test3 = k2.foo + k2.bar + if (test3 != "OK") throw AssertionError("test3: $test3") + + val test4 = ik2.foo + ik2.bar + if (test4 != "OK") throw AssertionError("test4: $test4") + + val test5 = ik3.foo + ik3.bar + if (test5 != "OK") throw AssertionError("test5: $test5") + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllProperty.kt b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllProperty.kt new file mode 100644 index 00000000000..6932507a332 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllProperty.kt @@ -0,0 +1,50 @@ +// !JVM_DEFAULT_MODE: all +// TARGET_BACKEND: JVM +// IGNORE_LIGHT_ANALYSIS +// IGNORE_BACKEND: JVM +// ^ KT-43698, fixed in JVM_IR +// WITH_RUNTIME +// JVM_TARGET: 1.8 +// FILE: jvmDefaultAll.kt + +interface IFooBar { + val foo get() = "O" + val bar get() = "Failed" +} + +interface IFooBar2 : IFooBar + +inline class Test1(val k: String): IFooBar { + override val bar: String + get() = k +} + +inline class Test2(val k: String): IFooBar2 { + override val bar: String + get() = k +} + +fun box(): String { + val k = Test1("K") + val ik: IFooBar = k + val k2 = Test2("K") + val ik2: IFooBar = k2 + val ik3: IFooBar2 = k2 + + val test1 = k.foo + k.bar + if (test1 != "OK") throw AssertionError("test1: $test1") + + val test2 = ik.foo + ik.bar + if (test2 != "OK") throw AssertionError("test2: $test2") + + val test3 = k2.foo + k2.bar + if (test3 != "OK") throw AssertionError("test3: $test3") + + val test4 = ik2.foo + ik2.bar + if (test4 != "OK") throw AssertionError("test4: $test4") + + val test5 = ik3.foo + ik3.bar + if (test5 != "OK") throw AssertionError("test5: $test5") + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnable.kt b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnable.kt new file mode 100644 index 00000000000..ab633f270fd --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnable.kt @@ -0,0 +1,48 @@ +// !JVM_DEFAULT_MODE: enable +// TARGET_BACKEND: JVM +// IGNORE_LIGHT_ANALYSIS +// IGNORE_BACKEND: JVM +// ^ KT-43698, fixed in JVM_IR +// WITH_RUNTIME +// JVM_TARGET: 1.8 +// FILE: jvmDefaultEnable.kt + +interface IFooBar { + @JvmDefault fun foo() = "O" + @JvmDefault fun bar() = "Failed" +} + +interface IFooBar2 : IFooBar + +inline class Test1(val k: String): IFooBar { + override fun bar(): String = k +} + +inline class Test2(val k: String): IFooBar2 { + override fun bar(): String = k +} + +fun box(): String { + val k = Test1("K") + val ik: IFooBar = k + val k2 = Test2("K") + val ik2: IFooBar = k2 + val ik3: IFooBar2 = k2 + + val test1 = k.foo() + k.bar() + if (test1 != "OK") throw AssertionError("test1: $test1") + + val test2 = ik.foo() + ik.bar() + if (test2 != "OK") throw AssertionError("test2: $test2") + + val test3 = k2.foo() + k2.bar() + if (test3 != "OK") throw AssertionError("test3: $test3") + + val test4 = ik2.foo() + ik2.bar() + if (test4 != "OK") throw AssertionError("test4: $test4") + + val test5 = ik3.foo() + ik3.bar() + if (test5 != "OK") throw AssertionError("test5: $test5") + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnablePrimaryProperty.kt b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnablePrimaryProperty.kt new file mode 100644 index 00000000000..c89f86e2d83 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnablePrimaryProperty.kt @@ -0,0 +1,44 @@ +// !JVM_DEFAULT_MODE: enable +// TARGET_BACKEND: JVM +// IGNORE_LIGHT_ANALYSIS +// IGNORE_BACKEND: JVM +// ^ KT-43698, fixed in JVM_IR +// WITH_RUNTIME +// JVM_TARGET: 1.8 +// FILE: jvmDefaultEnable.kt + +interface IFooBar { + @JvmDefault val foo get() = "O" + @JvmDefault val bar get() = "Failed" +} + +interface IFooBar2 : IFooBar + +inline class Test1(override val bar: String): IFooBar + +inline class Test2(override val bar: String): IFooBar2 + +fun box(): String { + val k = Test1("K") + val ik: IFooBar = k + val k2 = Test2("K") + val ik2: IFooBar = k2 + val ik3: IFooBar2 = k2 + + val test1 = k.foo + k.bar + if (test1 != "OK") throw AssertionError("test1: $test1") + + val test2 = ik.foo + ik.bar + if (test2 != "OK") throw AssertionError("test2: $test2") + + val test3 = k2.foo + k2.bar + if (test3 != "OK") throw AssertionError("test3: $test3") + + val test4 = ik2.foo + ik2.bar + if (test4 != "OK") throw AssertionError("test4: $test4") + + val test5 = ik3.foo + ik3.bar + if (test5 != "OK") throw AssertionError("test5: $test5") + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnableProperty.kt b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnableProperty.kt new file mode 100644 index 00000000000..3e04523b893 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnableProperty.kt @@ -0,0 +1,50 @@ +// !JVM_DEFAULT_MODE: enable +// TARGET_BACKEND: JVM +// IGNORE_LIGHT_ANALYSIS +// IGNORE_BACKEND: JVM +// ^ KT-43698, fixed in JVM_IR +// WITH_RUNTIME +// JVM_TARGET: 1.8 +// FILE: jvmDefaultEnable.kt + +interface IFooBar { + @JvmDefault val foo get() = "O" + @JvmDefault val bar get() = "Failed" +} + +interface IFooBar2 : IFooBar + +inline class Test1(val k: String): IFooBar { + override val bar: String + get() = k +} + +inline class Test2(val k: String): IFooBar2 { + override val bar: String + get() = k +} + +fun box(): String { + val k = Test1("K") + val ik: IFooBar = k + val k2 = Test2("K") + val ik2: IFooBar = k2 + val ik3: IFooBar2 = k2 + + val test1 = k.foo + k.bar + if (test1 != "OK") throw AssertionError("test1: $test1") + + val test2 = ik.foo + ik.bar + if (test2 != "OK") throw AssertionError("test2: $test2") + + val test3 = k2.foo + k2.bar + if (test3 != "OK") throw AssertionError("test3: $test3") + + val test4 = ik2.foo + ik2.bar + if (test4 != "OK") throw AssertionError("test4: $test4") + + val test5 = ik3.foo + ik3.bar + if (test5 != "OK") throw AssertionError("test5: $test5") + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/javaDefaultInterfaceMember.kt b/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/javaDefaultInterfaceMember.kt new file mode 100644 index 00000000000..6cfdccc36e0 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/javaDefaultInterfaceMember.kt @@ -0,0 +1,38 @@ +// JVM_TARGET: 1.8 +// FILE: javaDefaultInterfaceMember.kt +interface KFoo2 : JIFoo + +interface KFooUnrelated { + fun foo() +} + +interface KFoo3 : KFoo2, KFooUnrelated { + override fun foo() {} +} + +interface KBar2 : JIBar + +inline class TestFoo1(val x: Int) : JIFoo + +inline class TestFoo2(val x: Int) : KFoo2 + +inline class TestFoo3(val x: Int) : KFoo3 + +inline class TestBar1(val x: Int) : JIBar { + override fun bar() {} +} + +inline class TestBar2(val x: Int) : KBar2 { + override fun bar() {} +} + +// FILE: JIFoo.java +public interface JIFoo { + default void foo() {} +} + +// FILE: JIBar.java +public interface JIBar { + default void foo() {} + default void bar() {} +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/javaDefaultInterfaceMember.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/javaDefaultInterfaceMember.txt similarity index 60% rename from compiler/testData/codegen/bytecodeListing/inlineClasses/javaDefaultInterfaceMember.txt rename to compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/javaDefaultInterfaceMember.txt index 2d69cc08b7b..0b72b8b2180 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/javaDefaultInterfaceMember.txt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/javaDefaultInterfaceMember.txt @@ -1,3 +1,8 @@ +@kotlin.Metadata +public interface KBar2 { + // source: 'javaDefaultInterfaceMember.kt' +} + @kotlin.Metadata public interface KFoo2 { // source: 'javaDefaultInterfaceMember.kt' @@ -25,11 +30,13 @@ public interface KFooUnrelated { @kotlin.jvm.JvmInline @kotlin.Metadata -public final class Test1 { +public final class TestBar1 { // source: 'javaDefaultInterfaceMember.kt' private final field x: int private synthetic method (p0: int): void - public synthetic final static method box-impl(p0: int): Test1 + public method bar(): void + public static method bar-impl(p0: int): void + public synthetic final static method box-impl(p0: int): TestBar1 public static method constructor-impl(p0: int): int public method equals(p0: java.lang.Object): boolean public static method equals-impl(p0: int, p1: java.lang.Object): boolean @@ -44,11 +51,13 @@ public final class Test1 { @kotlin.jvm.JvmInline @kotlin.Metadata -public final class Test2 { +public final class TestBar2 { // source: 'javaDefaultInterfaceMember.kt' private final field x: int private synthetic method (p0: int): void - public synthetic final static method box-impl(p0: int): Test2 + public method bar(): void + public static method bar-impl(p0: int): void + public synthetic final static method box-impl(p0: int): TestBar2 public static method constructor-impl(p0: int): int public method equals(p0: java.lang.Object): boolean public static method equals-impl(p0: int, p1: java.lang.Object): boolean @@ -63,11 +72,49 @@ public final class Test2 { @kotlin.jvm.JvmInline @kotlin.Metadata -public final class Test3 { +public final class TestFoo1 { // source: 'javaDefaultInterfaceMember.kt' private final field x: int private synthetic method (p0: int): void - public synthetic final static method box-impl(p0: int): Test3 + public synthetic final static method box-impl(p0: int): TestFoo1 + public static method constructor-impl(p0: int): int + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: int, p1: java.lang.Object): boolean + public final static method equals-impl0(p0: int, p1: int): boolean + public final method getX(): int + public method hashCode(): int + public static method hashCode-impl(p0: int): int + public method toString(): java.lang.String + public static method toString-impl(p0: int): java.lang.String + public synthetic final method unbox-impl(): int +} + +@kotlin.jvm.JvmInline +@kotlin.Metadata +public final class TestFoo2 { + // source: 'javaDefaultInterfaceMember.kt' + private final field x: int + private synthetic method (p0: int): void + public synthetic final static method box-impl(p0: int): TestFoo2 + public static method constructor-impl(p0: int): int + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: int, p1: java.lang.Object): boolean + public final static method equals-impl0(p0: int, p1: int): boolean + public final method getX(): int + public method hashCode(): int + public static method hashCode-impl(p0: int): int + public method toString(): java.lang.String + public static method toString-impl(p0: int): java.lang.String + public synthetic final method unbox-impl(): int +} + +@kotlin.jvm.JvmInline +@kotlin.Metadata +public final class TestFoo3 { + // source: 'javaDefaultInterfaceMember.kt' + private final field x: int + private synthetic method (p0: int): void + public synthetic final static method box-impl(p0: int): TestFoo3 public static method constructor-impl(p0: int): int public method equals(p0: java.lang.Object): boolean public static method equals-impl(p0: int, p1: java.lang.Object): boolean diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultAll.kt b/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultAll.kt new file mode 100644 index 00000000000..eb1d1efd205 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultAll.kt @@ -0,0 +1,18 @@ +// !JVM_DEFAULT_MODE: all +// WITH_RUNTIME +// JVM_TARGET: 1.8 + +interface IFooBar { + fun foo() = "O" + fun bar() = "Failed" +} + +interface IFooBar2 : IFooBar + +inline class Test1(val k: String): IFooBar { + override fun bar(): String = k +} + +inline class Test2(val k: String): IFooBar2 { + override fun bar(): String = k +} diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultAll.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultAll.txt new file mode 100644 index 00000000000..f3b6814a038 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultAll.txt @@ -0,0 +1,53 @@ +@kotlin.Metadata +public interface IFooBar { + // source: 'jvmDefaultAll.kt' + public @org.jetbrains.annotations.NotNull method bar(): java.lang.String + public @org.jetbrains.annotations.NotNull method foo(): java.lang.String +} + +@kotlin.Metadata +public interface IFooBar2 { + // source: 'jvmDefaultAll.kt' +} + +@kotlin.jvm.JvmInline +@kotlin.Metadata +public final class Test1 { + // source: 'jvmDefaultAll.kt' + private final @org.jetbrains.annotations.NotNull field k: java.lang.String + private synthetic method (p0: java.lang.String): void + public @org.jetbrains.annotations.NotNull method bar(): java.lang.String + public static @org.jetbrains.annotations.NotNull method bar-impl(p0: java.lang.String): java.lang.String + public synthetic final static method box-impl(p0: java.lang.String): Test1 + public static @org.jetbrains.annotations.NotNull method constructor-impl(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: java.lang.String, p1: java.lang.Object): boolean + public final static method equals-impl0(p0: java.lang.String, p1: java.lang.String): boolean + public final @org.jetbrains.annotations.NotNull method getK(): java.lang.String + public method hashCode(): int + public static method hashCode-impl(p0: java.lang.String): int + public method toString(): java.lang.String + public static method toString-impl(p0: java.lang.String): java.lang.String + public synthetic final method unbox-impl(): java.lang.String +} + +@kotlin.jvm.JvmInline +@kotlin.Metadata +public final class Test2 { + // source: 'jvmDefaultAll.kt' + private final @org.jetbrains.annotations.NotNull field k: java.lang.String + private synthetic method (p0: java.lang.String): void + public @org.jetbrains.annotations.NotNull method bar(): java.lang.String + public static @org.jetbrains.annotations.NotNull method bar-impl(p0: java.lang.String): java.lang.String + public synthetic final static method box-impl(p0: java.lang.String): Test2 + public static @org.jetbrains.annotations.NotNull method constructor-impl(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: java.lang.String, p1: java.lang.Object): boolean + public final static method equals-impl0(p0: java.lang.String, p1: java.lang.String): boolean + public final @org.jetbrains.annotations.NotNull method getK(): java.lang.String + public method hashCode(): int + public static method hashCode-impl(p0: java.lang.String): int + public method toString(): java.lang.String + public static method toString-impl(p0: java.lang.String): java.lang.String + public synthetic final method unbox-impl(): java.lang.String +} diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultAll_ir.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultAll_ir.txt new file mode 100644 index 00000000000..0d942d45dc1 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultAll_ir.txt @@ -0,0 +1,53 @@ +@kotlin.Metadata +public interface IFooBar { + // source: 'jvmDefaultAll.kt' + public @org.jetbrains.annotations.NotNull method bar(): java.lang.String + public @org.jetbrains.annotations.NotNull method foo(): java.lang.String +} + +@kotlin.Metadata +public interface IFooBar2 { + // source: 'jvmDefaultAll.kt' +} + +@kotlin.jvm.JvmInline +@kotlin.Metadata +public final class Test1 { + // source: 'jvmDefaultAll.kt' + private final @org.jetbrains.annotations.NotNull field k: java.lang.String + private synthetic method (p0: java.lang.String): void + public @org.jetbrains.annotations.NotNull method bar(): java.lang.String + public static @org.jetbrains.annotations.NotNull method bar-impl(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String + public synthetic final static method box-impl(p0: java.lang.String): Test1 + public static @org.jetbrains.annotations.NotNull method constructor-impl(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: java.lang.String, p1: java.lang.Object): boolean + public final static method equals-impl0(p0: java.lang.String, p1: java.lang.String): boolean + public final @org.jetbrains.annotations.NotNull method getK(): java.lang.String + public method hashCode(): int + public static method hashCode-impl(p0: java.lang.String): int + public method toString(): java.lang.String + public static method toString-impl(p0: java.lang.String): java.lang.String + public synthetic final method unbox-impl(): java.lang.String +} + +@kotlin.jvm.JvmInline +@kotlin.Metadata +public final class Test2 { + // source: 'jvmDefaultAll.kt' + private final @org.jetbrains.annotations.NotNull field k: java.lang.String + private synthetic method (p0: java.lang.String): void + public @org.jetbrains.annotations.NotNull method bar(): java.lang.String + public static @org.jetbrains.annotations.NotNull method bar-impl(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String + public synthetic final static method box-impl(p0: java.lang.String): Test2 + public static @org.jetbrains.annotations.NotNull method constructor-impl(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: java.lang.String, p1: java.lang.Object): boolean + public final static method equals-impl0(p0: java.lang.String, p1: java.lang.String): boolean + public final @org.jetbrains.annotations.NotNull method getK(): java.lang.String + public method hashCode(): int + public static method hashCode-impl(p0: java.lang.String): int + public method toString(): java.lang.String + public static method toString-impl(p0: java.lang.String): java.lang.String + public synthetic final method unbox-impl(): java.lang.String +} diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultEnable.kt b/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultEnable.kt new file mode 100644 index 00000000000..8fe943b641c --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultEnable.kt @@ -0,0 +1,18 @@ +// !JVM_DEFAULT_MODE: enable +// WITH_RUNTIME +// JVM_TARGET: 1.8 + +interface IFooBar { + @JvmDefault fun foo() = "O" + @JvmDefault fun bar() = "Failed" +} + +interface IFooBar2 : IFooBar + +inline class Test1(val k: String): IFooBar { + override fun bar(): String = k +} + +inline class Test2(val k: String): IFooBar2 { + override fun bar(): String = k +} diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultEnable.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultEnable.txt new file mode 100644 index 00000000000..9732168d406 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultEnable.txt @@ -0,0 +1,53 @@ +@kotlin.Metadata +public interface IFooBar { + // source: 'jvmDefaultEnable.kt' + public @kotlin.jvm.JvmDefault @org.jetbrains.annotations.NotNull method bar(): java.lang.String + public @kotlin.jvm.JvmDefault @org.jetbrains.annotations.NotNull method foo(): java.lang.String +} + +@kotlin.Metadata +public interface IFooBar2 { + // source: 'jvmDefaultEnable.kt' +} + +@kotlin.jvm.JvmInline +@kotlin.Metadata +public final class Test1 { + // source: 'jvmDefaultEnable.kt' + private final @org.jetbrains.annotations.NotNull field k: java.lang.String + private synthetic method (p0: java.lang.String): void + public @org.jetbrains.annotations.NotNull method bar(): java.lang.String + public static @org.jetbrains.annotations.NotNull method bar-impl(p0: java.lang.String): java.lang.String + public synthetic final static method box-impl(p0: java.lang.String): Test1 + public static @org.jetbrains.annotations.NotNull method constructor-impl(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: java.lang.String, p1: java.lang.Object): boolean + public final static method equals-impl0(p0: java.lang.String, p1: java.lang.String): boolean + public final @org.jetbrains.annotations.NotNull method getK(): java.lang.String + public method hashCode(): int + public static method hashCode-impl(p0: java.lang.String): int + public method toString(): java.lang.String + public static method toString-impl(p0: java.lang.String): java.lang.String + public synthetic final method unbox-impl(): java.lang.String +} + +@kotlin.jvm.JvmInline +@kotlin.Metadata +public final class Test2 { + // source: 'jvmDefaultEnable.kt' + private final @org.jetbrains.annotations.NotNull field k: java.lang.String + private synthetic method (p0: java.lang.String): void + public @org.jetbrains.annotations.NotNull method bar(): java.lang.String + public static @org.jetbrains.annotations.NotNull method bar-impl(p0: java.lang.String): java.lang.String + public synthetic final static method box-impl(p0: java.lang.String): Test2 + public static @org.jetbrains.annotations.NotNull method constructor-impl(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: java.lang.String, p1: java.lang.Object): boolean + public final static method equals-impl0(p0: java.lang.String, p1: java.lang.String): boolean + public final @org.jetbrains.annotations.NotNull method getK(): java.lang.String + public method hashCode(): int + public static method hashCode-impl(p0: java.lang.String): int + public method toString(): java.lang.String + public static method toString-impl(p0: java.lang.String): java.lang.String + public synthetic final method unbox-impl(): java.lang.String +} diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultEnable_ir.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultEnable_ir.txt new file mode 100644 index 00000000000..20c34e9f340 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultEnable_ir.txt @@ -0,0 +1,53 @@ +@kotlin.Metadata +public interface IFooBar { + // source: 'jvmDefaultEnable.kt' + public @kotlin.jvm.JvmDefault @org.jetbrains.annotations.NotNull method bar(): java.lang.String + public @kotlin.jvm.JvmDefault @org.jetbrains.annotations.NotNull method foo(): java.lang.String +} + +@kotlin.Metadata +public interface IFooBar2 { + // source: 'jvmDefaultEnable.kt' +} + +@kotlin.jvm.JvmInline +@kotlin.Metadata +public final class Test1 { + // source: 'jvmDefaultEnable.kt' + private final @org.jetbrains.annotations.NotNull field k: java.lang.String + private synthetic method (p0: java.lang.String): void + public @org.jetbrains.annotations.NotNull method bar(): java.lang.String + public static @org.jetbrains.annotations.NotNull method bar-impl(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String + public synthetic final static method box-impl(p0: java.lang.String): Test1 + public static @org.jetbrains.annotations.NotNull method constructor-impl(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: java.lang.String, p1: java.lang.Object): boolean + public final static method equals-impl0(p0: java.lang.String, p1: java.lang.String): boolean + public final @org.jetbrains.annotations.NotNull method getK(): java.lang.String + public method hashCode(): int + public static method hashCode-impl(p0: java.lang.String): int + public method toString(): java.lang.String + public static method toString-impl(p0: java.lang.String): java.lang.String + public synthetic final method unbox-impl(): java.lang.String +} + +@kotlin.jvm.JvmInline +@kotlin.Metadata +public final class Test2 { + // source: 'jvmDefaultEnable.kt' + private final @org.jetbrains.annotations.NotNull field k: java.lang.String + private synthetic method (p0: java.lang.String): void + public @org.jetbrains.annotations.NotNull method bar(): java.lang.String + public static @org.jetbrains.annotations.NotNull method bar-impl(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String + public synthetic final static method box-impl(p0: java.lang.String): Test2 + public static @org.jetbrains.annotations.NotNull method constructor-impl(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: java.lang.String, p1: java.lang.Object): boolean + public final static method equals-impl0(p0: java.lang.String, p1: java.lang.String): boolean + public final @org.jetbrains.annotations.NotNull method getK(): java.lang.String + public method hashCode(): int + public static method hashCode-impl(p0: java.lang.String): int + public method toString(): java.lang.String + public static method toString-impl(p0: java.lang.String): java.lang.String + public synthetic final method unbox-impl(): java.lang.String +} diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/javaDefaultInterfaceMember.kt b/compiler/testData/codegen/bytecodeListing/inlineClasses/javaDefaultInterfaceMember.kt deleted file mode 100644 index adf140afc0e..00000000000 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/javaDefaultInterfaceMember.kt +++ /dev/null @@ -1,22 +0,0 @@ -// JVM_TARGET: 1.8 -// FILE: javaDefaultInterfaceMember.kt -interface KFoo2 : JIFoo - -interface KFooUnrelated { - fun foo() -} - -interface KFoo3 : KFoo2, KFooUnrelated { - override fun foo() {} -} - -inline class Test1(val x: Int) : JIFoo - -inline class Test2(val x: Int) : KFoo2 - -inline class Test3(val x: Int) : KFoo3 - -// FILE: JIFoo.java -public interface JIFoo { - default void foo() {} -} diff --git a/compiler/testData/codegen/bytecodeText/inlineClasses/interfaceJvmDefaultImplStubs.kt b/compiler/testData/codegen/bytecodeText/inlineClasses/interfaceJvmDefaultImplStubs.kt index 8cda986d8d4..41c38966dc0 100644 --- a/compiler/testData/codegen/bytecodeText/inlineClasses/interfaceJvmDefaultImplStubs.kt +++ b/compiler/testData/codegen/bytecodeText/inlineClasses/interfaceJvmDefaultImplStubs.kt @@ -25,13 +25,14 @@ inline class B(val x: Int) : A // 1 public static f-impl\(I\)Ljava/lang/String; // 1 public f\(\)Ljava/lang/String; -// 1 public static g-impl\(I\)Ljava/lang/String; +// 0 public static g-impl\(I\)Ljava/lang/String; // 0 public g\(\)Ljava/lang/String; -// 1 INVOKESTATIC B.g-impl \(I\)Ljava/lang/String; +// 0 INVOKESTATIC B.g-impl \(I\)Ljava/lang/String; // JVM_TEMPLATES: // 2 INVOKESTATIC B.f-impl \(I\)Ljava/lang/String; // JVM_IR_TEMPLATES: // 1 INVOKESTATIC B.f-impl \(I\)Ljava/lang/String; + diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index b175f9f569d..2b539076b31 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -16564,6 +16564,59 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Jvm8DefaultInterfaceMethods extends AbstractBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInJvm8DefaultInterfaceMethods() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("javaDefaultMethod.kt") + public void testJavaDefaultMethod() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethod.kt"); + } + + @TestMetadata("javaDefaultMethodOverriddenByKotlin.kt") + public void testJavaDefaultMethodOverriddenByKotlin() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethodOverriddenByKotlin.kt"); + } + + @TestMetadata("jvmDefaultAll.kt") + public void testJvmDefaultAll() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAll.kt"); + } + + @TestMetadata("jvmDefaultAllPrimaryProperty.kt") + public void testJvmDefaultAllPrimaryProperty() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllPrimaryProperty.kt"); + } + + @TestMetadata("jvmDefaultAllProperty.kt") + public void testJvmDefaultAllProperty() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllProperty.kt"); + } + + @TestMetadata("jvmDefaultEnable.kt") + public void testJvmDefaultEnable() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnable.kt"); + } + + @TestMetadata("jvmDefaultEnablePrimaryProperty.kt") + public void testJvmDefaultEnablePrimaryProperty() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnablePrimaryProperty.kt"); + } + + @TestMetadata("jvmDefaultEnableProperty.kt") + public void testJvmDefaultEnableProperty() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnableProperty.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/propertyDelegation") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index 83948ecead1..a730a1eb31d 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -1007,11 +1007,6 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassWithManyKindsOfMembers.kt"); } - @TestMetadata("javaDefaultInterfaceMember.kt") - public void testJavaDefaultInterfaceMember() throws Exception { - runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/javaDefaultInterfaceMember.kt"); - } - @TestMetadata("jvmName.kt") public void testJvmName() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/jvmName.kt"); @@ -1072,6 +1067,34 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/shapeOfInlineClassWithPrimitive.kt"); } + @TestMetadata("compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class DefaultInterfaceMembers extends AbstractBytecodeListingTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInDefaultInterfaceMembers() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("javaDefaultInterfaceMember.kt") + public void testJavaDefaultInterfaceMember() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/javaDefaultInterfaceMember.kt"); + } + + @TestMetadata("jvmDefaultAll.kt") + public void testJvmDefaultAll() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultAll.kt"); + } + + @TestMetadata("jvmDefaultEnable.kt") + public void testJvmDefaultEnable() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultEnable.kt"); + } + } + @TestMetadata("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 2ee2e8e18c8..a190e8c247f 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -16564,6 +16564,59 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Jvm8DefaultInterfaceMethods extends AbstractLightAnalysisModeTest { + @TestMetadata("javaDefaultMethod.kt") + public void ignoreJavaDefaultMethod() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethod.kt"); + } + + @TestMetadata("javaDefaultMethodOverriddenByKotlin.kt") + public void ignoreJavaDefaultMethodOverriddenByKotlin() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethodOverriddenByKotlin.kt"); + } + + @TestMetadata("jvmDefaultAll.kt") + public void ignoreJvmDefaultAll() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAll.kt"); + } + + @TestMetadata("jvmDefaultAllPrimaryProperty.kt") + public void ignoreJvmDefaultAllPrimaryProperty() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllPrimaryProperty.kt"); + } + + @TestMetadata("jvmDefaultAllProperty.kt") + public void ignoreJvmDefaultAllProperty() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllProperty.kt"); + } + + @TestMetadata("jvmDefaultEnable.kt") + public void ignoreJvmDefaultEnable() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnable.kt"); + } + + @TestMetadata("jvmDefaultEnablePrimaryProperty.kt") + public void ignoreJvmDefaultEnablePrimaryProperty() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnablePrimaryProperty.kt"); + } + + @TestMetadata("jvmDefaultEnableProperty.kt") + public void ignoreJvmDefaultEnableProperty() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnableProperty.kt"); + } + + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInJvm8DefaultInterfaceMethods() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/propertyDelegation") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 328025700e5..856d146d81d 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -15164,6 +15164,59 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Jvm8DefaultInterfaceMethods extends AbstractIrBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInJvm8DefaultInterfaceMethods() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("javaDefaultMethod.kt") + public void testJavaDefaultMethod() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethod.kt"); + } + + @TestMetadata("javaDefaultMethodOverriddenByKotlin.kt") + public void testJavaDefaultMethodOverriddenByKotlin() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethodOverriddenByKotlin.kt"); + } + + @TestMetadata("jvmDefaultAll.kt") + public void testJvmDefaultAll() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAll.kt"); + } + + @TestMetadata("jvmDefaultAllPrimaryProperty.kt") + public void testJvmDefaultAllPrimaryProperty() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllPrimaryProperty.kt"); + } + + @TestMetadata("jvmDefaultAllProperty.kt") + public void testJvmDefaultAllProperty() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllProperty.kt"); + } + + @TestMetadata("jvmDefaultEnable.kt") + public void testJvmDefaultEnable() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnable.kt"); + } + + @TestMetadata("jvmDefaultEnablePrimaryProperty.kt") + public void testJvmDefaultEnablePrimaryProperty() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnablePrimaryProperty.kt"); + } + + @TestMetadata("jvmDefaultEnableProperty.kt") + public void testJvmDefaultEnableProperty() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnableProperty.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/propertyDelegation") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index 16f066ea6c2..74eab19f719 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -977,11 +977,6 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassWithManyKindsOfMembers.kt"); } - @TestMetadata("javaDefaultInterfaceMember.kt") - public void testJavaDefaultInterfaceMember() throws Exception { - runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/javaDefaultInterfaceMember.kt"); - } - @TestMetadata("jvmName.kt") public void testJvmName() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/jvmName.kt"); @@ -1042,6 +1037,34 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/shapeOfInlineClassWithPrimitive.kt"); } + @TestMetadata("compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class DefaultInterfaceMembers extends AbstractIrBytecodeListingTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInDefaultInterfaceMembers() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("javaDefaultInterfaceMember.kt") + public void testJavaDefaultInterfaceMember() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/javaDefaultInterfaceMember.kt"); + } + + @TestMetadata("jvmDefaultAll.kt") + public void testJvmDefaultAll() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultAll.kt"); + } + + @TestMetadata("jvmDefaultEnable.kt") + public void testJvmDefaultEnable() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMembers/jvmDefaultEnable.kt"); + } + } + @TestMetadata("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index e94581ca30c..ab656bc1582 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -13134,6 +13134,19 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Jvm8DefaultInterfaceMethods extends AbstractIrJsCodegenBoxES6Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); + } + + public void testAllFilesPresentInJvm8DefaultInterfaceMethods() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/propertyDelegation") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 230765ea840..191c494524a 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -13134,6 +13134,19 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Jvm8DefaultInterfaceMethods extends AbstractIrJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInJvm8DefaultInterfaceMethods() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/propertyDelegation") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 7892ef2e51c..82fc5e0759a 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -13199,6 +13199,19 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Jvm8DefaultInterfaceMethods extends AbstractJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); + } + + public void testAllFilesPresentInJvm8DefaultInterfaceMethods() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/propertyDelegation") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index c4bbcb442e3..38e97a4ec19 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -7434,6 +7434,19 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest } } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Jvm8DefaultInterfaceMethods extends AbstractIrCodegenBoxWasmTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath); + } + + public void testAllFilesPresentInJvm8DefaultInterfaceMethods() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); + } + } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/propertyDelegation") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) From 8ce2e4654b4c9d3eb8042b03722774a469be54f1 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Wed, 2 Dec 2020 16:36:46 +0100 Subject: [PATCH 406/698] JVM IR: allow custom toArray to have any array type To avoid breaking Java source compatibility. This problem can be fixed later once JVM IR is stabilized. #KT-43111 Fixed --- .../jvm/lower/SyntheticAccessorLowering.kt | 2 +- .../backend/jvm/lower/ToArrayLowering.kt | 15 +++-- .../codegen/box/toArray/toArrayFromJava.kt | 11 ++-- .../toArray/customNonGenericToArray.kt | 11 ++++ .../toArray/customNonGenericToArray.txt | 62 +++++++++++++++++++ .../toArray/customNonGenericToArray_ir.txt | 62 +++++++++++++++++++ .../toArray}/noToArrayInJava.kt | 0 .../toArray}/noToArrayInJava.txt | 0 .../toArray}/noToArrayInJava_ir.txt | 0 .../codegen/BytecodeListingTestGenerated.java | 28 +++++++-- .../ir/IrBytecodeListingTestGenerated.java | 28 +++++++-- 11 files changed, 199 insertions(+), 20 deletions(-) create mode 100644 compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/customNonGenericToArray.kt create mode 100644 compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/customNonGenericToArray.txt create mode 100644 compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/customNonGenericToArray_ir.txt rename compiler/testData/codegen/bytecodeListing/{ => collectionStubs/toArray}/noToArrayInJava.kt (100%) rename compiler/testData/codegen/bytecodeListing/{ => collectionStubs/toArray}/noToArrayInJava.txt (100%) rename compiler/testData/codegen/bytecodeListing/{ => collectionStubs/toArray}/noToArrayInJava_ir.txt (100%) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/SyntheticAccessorLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/SyntheticAccessorLowering.kt index 30265076126..d7f3367875d 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/SyntheticAccessorLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/SyntheticAccessorLowering.kt @@ -588,7 +588,7 @@ internal class SyntheticAccessorLowering(val context: JvmBackendContext) : IrEle if (!withSuper && !declaration.visibility.isPrivate && !declaration.visibility.isProtected) return true // `toArray` is always accessible cause mapped to public functions - if (symbolOwner is IrSimpleFunction && (symbolOwner.isNonGenericToArray(context) || symbolOwner.isGenericToArray(context))) { + if (symbolOwner is IrSimpleFunction && (symbolOwner.isNonGenericToArray() || symbolOwner.isGenericToArray(context))) { if (symbolOwner.parentAsClass.isCollectionSubClass) { return true } diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/ToArrayLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/ToArrayLowering.kt index 2651c849424..4a1da573b3b 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/ToArrayLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/ToArrayLowering.kt @@ -11,8 +11,8 @@ import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase import org.jetbrains.kotlin.backend.jvm.JvmBackendContext import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin import org.jetbrains.kotlin.backend.jvm.codegen.isJvmInterface -import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.descriptors.DescriptorVisibilities +import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.ir.builders.declarations.addDispatchReceiver import org.jetbrains.kotlin.ir.builders.declarations.addFunction import org.jetbrains.kotlin.ir.builders.declarations.addTypeParameter @@ -75,7 +75,7 @@ private class ToArrayLowering(private val context: JvmBackendContext) : ClassLow } } - irClass.findOrCreate(indirectCollectionSubClass, { it.isNonGenericToArray(context) }) { + irClass.findOrCreate(indirectCollectionSubClass, IrSimpleFunction::isNonGenericToArray) { irClass.addFunction { name = Name.identifier("toArray") origin = JvmLoweredDeclarationOrigin.TO_ARRAY @@ -132,7 +132,12 @@ internal fun IrSimpleFunction.isGenericToArray(context: JvmBackendContext): Bool returnType.isArrayOrNullableArrayOf(context, typeParameters[0].symbol) && valueParameters[0].type.isArrayOrNullableArrayOf(context, typeParameters[0].symbol) -// Match `fun toArray(): Array` -internal fun IrSimpleFunction.isNonGenericToArray(context: JvmBackendContext): Boolean = +// Match `fun toArray(): Array<...>`. +// It would be more correct to check that the return type is erased to `Object[]`, however the old backend doesn't do that +// (see `FunctionDescriptor.isNonGenericToArray` and KT-43111). +internal fun IrSimpleFunction.isNonGenericToArray(): Boolean = name.asString() == "toArray" && typeParameters.isEmpty() && valueParameters.isEmpty() && - extensionReceiverParameter == null && returnType.isArrayOrNullableArrayOf(context, context.irBuiltIns.anyClass) + extensionReceiverParameter == null && returnType.isArrayOrNullableArray() + +private fun IrType.isArrayOrNullableArray(): Boolean = + this is IrSimpleType && (isArray() || isNullableArray()) diff --git a/compiler/testData/codegen/box/toArray/toArrayFromJava.kt b/compiler/testData/codegen/box/toArray/toArrayFromJava.kt index 4ee49bb44ef..1992aed47cf 100644 --- a/compiler/testData/codegen/box/toArray/toArrayFromJava.kt +++ b/compiler/testData/codegen/box/toArray/toArrayFromJava.kt @@ -1,6 +1,4 @@ // TARGET_BACKEND: JVM -// The old backend thinks `toArray(): Array` is the same as `toArray(): Array` -// IGNORE_BACKEND: JVM // WITH_RUNTIME // FILE: MyListWithCustomToArray.java @@ -29,7 +27,7 @@ class MyListSubclass(val list: List): MyListWithCustomToArray() { get() = list.size } -class MyCollection(val list: List) : Collection by list { +class MyCollectionWithCustomIntToArray(val list: List) : Collection by list { fun toArray(): Array = arrayOfNulls(0) } @@ -43,8 +41,13 @@ fun box(): String { list2.toArray().contentToString().let { if (it != "[null]") return "fail 3: $it" } list2.toArray(arrayOfNulls(1)).contentToString().let { if (it != "[null]") return "fail 4: $it" } - val list3 = MyCollection(listOf(2, 3, 9)) as java.util.Collection<*> + val list3 = MyCollectionWithCustomIntToArray(listOf(2, 3, 9)) as java.util.Collection<*> + /* + // This fails with AbstractMethodError at the moment because of a bug where the backend doesn't check the array element type + // of the return type when looking for an implementation of the non-generic parameterless `toArray`. + // See `FunctionDescriptor.isNonGenericToArray`, `IrSimpleFunction.isNonGenericToArray` and KT-43111. list3.toArray().contentToString().let { if (it != "[2, 3, 9]") return "fail 5: $it" } list3.toArray(arrayOfNulls(0)).contentToString().let { if (it != "[2, 3, 9]") return "fail 6: $it" } + */ return "OK" } diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/customNonGenericToArray.kt b/compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/customNonGenericToArray.kt new file mode 100644 index 00000000000..5d8a3ceea98 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/customNonGenericToArray.kt @@ -0,0 +1,11 @@ +class InternalToArray(d: Collection): Collection by d { + internal fun toArray(): Array = null!! +} + +class PrivateToArray(d: Collection): Collection by d { + private fun toArray(): Array = null!! +} + +class PublicToArray(d: Collection): Collection by d { + public fun toArray(): Array = null!! +} diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/customNonGenericToArray.txt b/compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/customNonGenericToArray.txt new file mode 100644 index 00000000000..f520132fd70 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/customNonGenericToArray.txt @@ -0,0 +1,62 @@ +@kotlin.Metadata +public final class InternalToArray { + // source: 'customNonGenericToArray.kt' + private synthetic final field $$delegate_0: java.util.Collection + public method (@org.jetbrains.annotations.NotNull p0: java.util.Collection): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public method contains(@org.jetbrains.annotations.NotNull p0: java.lang.Object): boolean + public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public method getSize(): int + public method isEmpty(): boolean + public @org.jetbrains.annotations.NotNull method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public final @org.jetbrains.annotations.NotNull method toArray$test_module(): java.lang.Integer[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public final class PrivateToArray { + // source: 'customNonGenericToArray.kt' + private synthetic final field $$delegate_0: java.util.Collection + public method (@org.jetbrains.annotations.NotNull p0: java.util.Collection): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public method contains(@org.jetbrains.annotations.NotNull p0: java.lang.Object): boolean + public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public method getSize(): int + public method isEmpty(): boolean + public @org.jetbrains.annotations.NotNull method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public final @org.jetbrains.annotations.NotNull method toArray(): java.lang.Integer[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public final class PublicToArray { + // source: 'customNonGenericToArray.kt' + private synthetic final field $$delegate_0: java.util.Collection + public method (@org.jetbrains.annotations.NotNull p0: java.util.Collection): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public method contains(@org.jetbrains.annotations.NotNull p0: java.lang.Object): boolean + public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public method getSize(): int + public method isEmpty(): boolean + public @org.jetbrains.annotations.NotNull method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public final @org.jetbrains.annotations.NotNull method toArray(): java.lang.Integer[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/customNonGenericToArray_ir.txt b/compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/customNonGenericToArray_ir.txt new file mode 100644 index 00000000000..5643251b8e4 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/customNonGenericToArray_ir.txt @@ -0,0 +1,62 @@ +@kotlin.Metadata +public final class InternalToArray { + // source: 'customNonGenericToArray.kt' + private synthetic final field $$delegate_0: java.util.Collection + public method (@org.jetbrains.annotations.NotNull p0: java.util.Collection): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public method contains(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean + public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public method getSize(): int + public method isEmpty(): boolean + public @org.jetbrains.annotations.NotNull method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public final @org.jetbrains.annotations.NotNull method toArray(): java.lang.Integer[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public final class PrivateToArray { + // source: 'customNonGenericToArray.kt' + private synthetic final field $$delegate_0: java.util.Collection + public method (@org.jetbrains.annotations.NotNull p0: java.util.Collection): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public method contains(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean + public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public method getSize(): int + public method isEmpty(): boolean + public @org.jetbrains.annotations.NotNull method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public final @org.jetbrains.annotations.NotNull method toArray(): java.lang.Integer[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public final class PublicToArray { + // source: 'customNonGenericToArray.kt' + private synthetic final field $$delegate_0: java.util.Collection + public method (@org.jetbrains.annotations.NotNull p0: java.util.Collection): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public method contains(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean + public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public method getSize(): int + public method isEmpty(): boolean + public @org.jetbrains.annotations.NotNull method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public final @org.jetbrains.annotations.NotNull method toArray(): java.lang.Integer[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} diff --git a/compiler/testData/codegen/bytecodeListing/noToArrayInJava.kt b/compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/noToArrayInJava.kt similarity index 100% rename from compiler/testData/codegen/bytecodeListing/noToArrayInJava.kt rename to compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/noToArrayInJava.kt diff --git a/compiler/testData/codegen/bytecodeListing/noToArrayInJava.txt b/compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/noToArrayInJava.txt similarity index 100% rename from compiler/testData/codegen/bytecodeListing/noToArrayInJava.txt rename to compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/noToArrayInJava.txt diff --git a/compiler/testData/codegen/bytecodeListing/noToArrayInJava_ir.txt b/compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/noToArrayInJava_ir.txt similarity index 100% rename from compiler/testData/codegen/bytecodeListing/noToArrayInJava_ir.txt rename to compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/noToArrayInJava_ir.txt diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index a730a1eb31d..da780c90a5c 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -174,11 +174,6 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/noRemoveAtInReadOnly.kt"); } - @TestMetadata("noToArrayInJava.kt") - public void testNoToArrayInJava() throws Exception { - runTest("compiler/testData/codegen/bytecodeListing/noToArrayInJava.kt"); - } - @TestMetadata("privateCompanionFields.kt") public void testPrivateCompanionFields() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/privateCompanionFields.kt"); @@ -616,6 +611,29 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/abstractStubSignatures/stringGenericMutableMap.kt"); } } + + @TestMetadata("compiler/testData/codegen/bytecodeListing/collectionStubs/toArray") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ToArray extends AbstractBytecodeListingTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInToArray() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/collectionStubs/toArray"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("customNonGenericToArray.kt") + public void testCustomNonGenericToArray() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/customNonGenericToArray.kt"); + } + + @TestMetadata("noToArrayInJava.kt") + public void testNoToArrayInJava() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/noToArrayInJava.kt"); + } + } } @TestMetadata("compiler/testData/codegen/bytecodeListing/coroutines") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index 74eab19f719..5eda0b8c230 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -174,11 +174,6 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/noRemoveAtInReadOnly.kt"); } - @TestMetadata("noToArrayInJava.kt") - public void testNoToArrayInJava() throws Exception { - runTest("compiler/testData/codegen/bytecodeListing/noToArrayInJava.kt"); - } - @TestMetadata("privateCompanionFields.kt") public void testPrivateCompanionFields() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/privateCompanionFields.kt"); @@ -616,6 +611,29 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/abstractStubSignatures/stringGenericMutableMap.kt"); } } + + @TestMetadata("compiler/testData/codegen/bytecodeListing/collectionStubs/toArray") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ToArray extends AbstractIrBytecodeListingTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInToArray() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/collectionStubs/toArray"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("customNonGenericToArray.kt") + public void testCustomNonGenericToArray() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/customNonGenericToArray.kt"); + } + + @TestMetadata("noToArrayInJava.kt") + public void testNoToArrayInJava() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/noToArrayInJava.kt"); + } + } } @TestMetadata("compiler/testData/codegen/bytecodeListing/coroutines") From 6b649d02d3aa9fe89eeb52288c0c0ab486cbd8d2 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Wed, 2 Dec 2020 18:36:57 +0100 Subject: [PATCH 407/698] JVM IR: fix visibility/modality of $suspendImpl methods #KT-43614 Fixed --- .../backend/jvm/lower/AddContinuationLowering.kt | 9 +++++---- .../codegen/bytecodeListing/coroutines/suspendImpl.kt | 5 +++++ .../bytecodeListing/coroutines/suspendImpl.txt | 11 +++++++++++ .../bytecodeListing/coroutines/suspendImpl_ir.txt | 11 +++++++++++ .../kotlin/codegen/BytecodeListingTestGenerated.java | 5 +++++ .../codegen/ir/IrBytecodeListingTestGenerated.java | 5 +++++ 6 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 compiler/testData/codegen/bytecodeListing/coroutines/suspendImpl.kt create mode 100644 compiler/testData/codegen/bytecodeListing/coroutines/suspendImpl.txt create mode 100644 compiler/testData/codegen/bytecodeListing/coroutines/suspendImpl_ir.txt diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt index 3a307ce6802..d410b75f43b 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt @@ -22,6 +22,7 @@ import org.jetbrains.kotlin.backend.jvm.localDeclarationsPhase import org.jetbrains.kotlin.codegen.coroutines.* import org.jetbrains.kotlin.codegen.inline.coroutines.FOR_INLINE_SUFFIX import org.jetbrains.kotlin.descriptors.DescriptorVisibilities +import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.ir.IrStatement import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.builders.* @@ -208,10 +209,8 @@ private class AddContinuationLowering(context: JvmBackendContext) : SuspendLower } } - private fun Name.toSuspendImplementationName() = when { - isSpecial -> Name.special(asString() + SUSPEND_IMPL_NAME_SUFFIX) - else -> Name.identifier(asString() + SUSPEND_IMPL_NAME_SUFFIX) - } + private fun Name.toSuspendImplementationName(): Name = + Name.guessByFirstCharacter(asString() + SUSPEND_IMPL_NAME_SUFFIX) private fun createStaticSuspendImpl(irFunction: IrSimpleFunction): IrSimpleFunction { // Create static suspend impl method. @@ -220,6 +219,8 @@ private class AddContinuationLowering(context: JvmBackendContext) : SuspendLower irFunction.name.toSuspendImplementationName(), irFunction, origin = JvmLoweredDeclarationOrigin.SUSPEND_IMPL_STATIC_FUNCTION, + modality = Modality.OPEN, + visibility = JavaDescriptorVisibilities.PACKAGE_VISIBILITY, isFakeOverride = false, copyMetadata = false ) diff --git a/compiler/testData/codegen/bytecodeListing/coroutines/suspendImpl.kt b/compiler/testData/codegen/bytecodeListing/coroutines/suspendImpl.kt new file mode 100644 index 00000000000..4e0df96c0f6 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/coroutines/suspendImpl.kt @@ -0,0 +1,5 @@ +abstract class A { + public open suspend fun public() {} + protected open suspend fun protected() {} + internal open suspend fun internal() {} +} diff --git a/compiler/testData/codegen/bytecodeListing/coroutines/suspendImpl.txt b/compiler/testData/codegen/bytecodeListing/coroutines/suspendImpl.txt new file mode 100644 index 00000000000..cb7d7e6d264 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/coroutines/suspendImpl.txt @@ -0,0 +1,11 @@ +@kotlin.Metadata +public abstract class A { + // source: 'suspendImpl.kt' + public method (): void + synthetic static method internal$test_module$suspendImpl(p0: A, p1: java.lang.Object): java.lang.Object + public @org.jetbrains.annotations.Nullable method internal$test_module(@org.jetbrains.annotations.Nullable p0: java.lang.Object): java.lang.Object + synthetic static method protected$suspendImpl(p0: A, p1: java.lang.Object): java.lang.Object + protected @org.jetbrains.annotations.Nullable method protected(@org.jetbrains.annotations.Nullable p0: java.lang.Object): java.lang.Object + synthetic static method public$suspendImpl(p0: A, p1: java.lang.Object): java.lang.Object + public @org.jetbrains.annotations.Nullable method public(@org.jetbrains.annotations.Nullable p0: java.lang.Object): java.lang.Object +} diff --git a/compiler/testData/codegen/bytecodeListing/coroutines/suspendImpl_ir.txt b/compiler/testData/codegen/bytecodeListing/coroutines/suspendImpl_ir.txt new file mode 100644 index 00000000000..934e1407436 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/coroutines/suspendImpl_ir.txt @@ -0,0 +1,11 @@ +@kotlin.Metadata +public abstract class A { + // source: 'suspendImpl.kt' + public method (): void + synthetic static method internal$suspendImpl(p0: A, p1: kotlin.coroutines.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method internal$test_module(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object + synthetic static method protected$suspendImpl(p0: A, p1: kotlin.coroutines.Continuation): java.lang.Object + protected @org.jetbrains.annotations.Nullable method protected(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object + synthetic static method public$suspendImpl(p0: A, p1: kotlin.coroutines.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method public(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index da780c90a5c..b762ed65377 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -697,6 +697,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/coroutines/privateSuspendFun.kt"); } + @TestMetadata("suspendImpl.kt") + public void testSuspendImpl() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/coroutines/suspendImpl.kt"); + } + @TestMetadata("suspendReifiedFun.kt") public void testSuspendReifiedFun_1_2() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/bytecodeListing/coroutines/suspendReifiedFun.kt", "kotlin.coroutines.experimental"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index 5eda0b8c230..1561bc7a3f1 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -677,6 +677,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/coroutines/privateSuspendFun.kt"); } + @TestMetadata("suspendImpl.kt") + public void testSuspendImpl() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/coroutines/suspendImpl.kt"); + } + @TestMetadata("suspendReifiedFun.kt") public void testSuspendReifiedFun_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/bytecodeListing/coroutines/suspendReifiedFun.kt", "kotlin.coroutines"); From 8e5bcd349e41f007a6e255a925b75c4d467e0ddc Mon Sep 17 00:00:00 2001 From: Shagen Ogandzhanian Date: Wed, 2 Dec 2020 22:20:16 +0100 Subject: [PATCH 408/698] [JS IR] Respect JsExport while assigning stable names see https://youtrack.jetbrains.com/issue/KT-43404 --- .../kotlin/backend/common/ir/IrUtils.kt | 2 +- .../backend/js/lower/BridgesConstruction.kt | 4 +- .../kotlin/ir/backend/js/utils/NameTables.kt | 19 +++------ .../kotlin/ir/backend/js/utils/misc.kt | 18 +++++++++ .../semantics/IrBoxJsES6TestGenerated.java | 10 +++++ .../ir/semantics/IrBoxJsTestGenerated.java | 10 +++++ .../js/test/semantics/BoxJsTestGenerated.java | 10 +++++ .../testData/box/jsExport/dataClass.js | 13 +++++++ .../testData/box/jsExport/dataClass.kt | 30 ++++++++++++++ .../testData/box/jsExport/jsExportInClass.js | 13 +++++++ .../testData/box/jsExport/jsExportInClass.kt | 39 +++++++++++++++++++ 11 files changed, 152 insertions(+), 16 deletions(-) create mode 100644 js/js.translator/testData/box/jsExport/dataClass.js create mode 100644 js/js.translator/testData/box/jsExport/dataClass.kt create mode 100644 js/js.translator/testData/box/jsExport/jsExportInClass.js create mode 100644 js/js.translator/testData/box/jsExport/jsExportInClass.kt diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/IrUtils.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/IrUtils.kt index 11074dfd0b5..4f1ac7a583e 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/IrUtils.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/IrUtils.kt @@ -397,7 +397,7 @@ fun IrClass.createImplicitParameterDeclarationWithWrappedDescriptor() { @Suppress("UNCHECKED_CAST") fun isElseBranch(branch: IrBranch) = branch is IrElseBranch || ((branch.condition as? IrConst)?.value == true) -fun IrSimpleFunction.isMethodOfAny() = +fun IrFunction.isMethodOfAny() = ((valueParameters.size == 0 && name.asString().let { it == "hashCode" || it == "toString" }) || (valueParameters.size == 1 && name.asString() == "equals" && valueParameters[0].type.isNullableAny())) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/BridgesConstruction.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/BridgesConstruction.kt index dd5a8bd9d08..5cf0486cc77 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/BridgesConstruction.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/BridgesConstruction.kt @@ -15,7 +15,7 @@ import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.backend.js.JsCommonBackendContext import org.jetbrains.kotlin.ir.backend.js.JsLoweredDeclarationOrigin -import org.jetbrains.kotlin.ir.backend.js.utils.getJsName +import org.jetbrains.kotlin.ir.backend.js.utils.hasStableJsName import org.jetbrains.kotlin.ir.backend.js.utils.realOverrideTarget import org.jetbrains.kotlin.ir.builders.* import org.jetbrains.kotlin.ir.builders.declarations.buildFun @@ -118,7 +118,7 @@ abstract class BridgesConstruction(val context: JsCommonBackendContext) : Declar ): IrFunction { val origin = - if (bridge.isEffectivelyExternal() || bridge.getJsName() != null) + if (bridge.hasStableJsName()) JsLoweredDeclarationOrigin.BRIDGE_TO_EXTERNAL_FUNCTION else IrDeclarationOrigin.BRIDGE diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/utils/NameTables.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/utils/NameTables.kt index 74f4522f30a..09fb29e1ce7 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/utils/NameTables.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/utils/NameTables.kt @@ -109,20 +109,13 @@ fun jsFunctionSignature(declaration: IrFunction): Signature { require(declaration.dispatchReceiverParameter != null) val declarationName = declaration.getJsNameOrKotlinName().asString() - val stableName = StableNameSignature(declarationName) - if (declaration.origin == JsLoweredDeclarationOrigin.BRIDGE_TO_EXTERNAL_FUNCTION) { - return stableName - } - if (declaration.isEffectivelyExternal()) { - return stableName - } - if (declaration.getJsName() != null) { - return stableName - } - // Handle names for special functions - if (declaration is IrSimpleFunction && declaration.isMethodOfAny()) { - return stableName + val needsStableName = declaration.origin == JsLoweredDeclarationOrigin.BRIDGE_TO_EXTERNAL_FUNCTION || + declaration.hasStableJsName() || + (declaration as? IrSimpleFunction)?.isMethodOfAny() == true // Handle names for special functions + + if (needsStableName) { + return StableNameSignature(declarationName) } val nameBuilder = StringBuilder() diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/utils/misc.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/utils/misc.kt index 3b88272b7ba..ec756c0aba6 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/utils/misc.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/utils/misc.kt @@ -15,11 +15,29 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrVarargImpl import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.types.isNullableAny import org.jetbrains.kotlin.ir.types.isUnit +import org.jetbrains.kotlin.ir.util.isEffectivelyExternal import org.jetbrains.kotlin.ir.util.isTopLevelDeclaration +import org.jetbrains.kotlin.ir.util.parentClassOrNull import org.jetbrains.kotlin.name.Name fun TODO(element: IrElement): Nothing = TODO(element::class.java.simpleName + " is not supported yet here") +fun IrFunction.hasStableJsName(): Boolean { + val namedOrMissingGetter = when (this) { + is IrSimpleFunction -> { + val owner = correspondingPropertySymbol?.owner + if (owner == null) { + true + } else { + owner.getter?.getJsName() != null + } + } + else -> true + } + + return (isEffectivelyExternal() || getJsName() != null || parentClassOrNull?.isJsExport() == true) && namedOrMissingGetter +} + fun IrFunction.isEqualsInheritedFromAny() = name == Name.identifier("equals") && dispatchReceiverParameter != null && diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java index f7cd3292d61..02cf8144ea6 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java @@ -5167,6 +5167,16 @@ public class IrBoxJsES6TestGenerated extends AbstractIrBoxJsES6Test { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/jsExport"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } + @TestMetadata("dataClass.kt") + public void testDataClass() throws Exception { + runTest("js/js.translator/testData/box/jsExport/dataClass.kt"); + } + + @TestMetadata("jsExportInClass.kt") + public void testJsExportInClass() throws Exception { + runTest("js/js.translator/testData/box/jsExport/jsExportInClass.kt"); + } + @TestMetadata("recursiveExport.kt") public void testRecursiveExport() throws Exception { runTest("js/js.translator/testData/box/jsExport/recursiveExport.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java index b60b98a4a55..931a9b475e8 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java @@ -5167,6 +5167,16 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/jsExport"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true); } + @TestMetadata("dataClass.kt") + public void testDataClass() throws Exception { + runTest("js/js.translator/testData/box/jsExport/dataClass.kt"); + } + + @TestMetadata("jsExportInClass.kt") + public void testJsExportInClass() throws Exception { + runTest("js/js.translator/testData/box/jsExport/jsExportInClass.kt"); + } + @TestMetadata("recursiveExport.kt") public void testRecursiveExport() throws Exception { runTest("js/js.translator/testData/box/jsExport/recursiveExport.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java index 313c401b07b..39dd28a2554 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java @@ -5182,6 +5182,16 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/jsExport"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS, true); } + @TestMetadata("dataClass.kt") + public void testDataClass() throws Exception { + runTest("js/js.translator/testData/box/jsExport/dataClass.kt"); + } + + @TestMetadata("jsExportInClass.kt") + public void testJsExportInClass() throws Exception { + runTest("js/js.translator/testData/box/jsExport/jsExportInClass.kt"); + } + @TestMetadata("recursiveExport.kt") public void testRecursiveExport() throws Exception { runTest("js/js.translator/testData/box/jsExport/recursiveExport.kt"); diff --git a/js/js.translator/testData/box/jsExport/dataClass.js b/js/js.translator/testData/box/jsExport/dataClass.js new file mode 100644 index 00000000000..fdf2d9174dd --- /dev/null +++ b/js/js.translator/testData/box/jsExport/dataClass.js @@ -0,0 +1,13 @@ +$kotlin_test_internal$.beginModule(); + +module.exports = function() { + var Point = require("JS_TESTS").api.Point; + var p = new Point(3, 7); + + return { + "res": p.copy(13, 11).toString() + }; +}; + +$kotlin_test_internal$.endModule("lib"); + diff --git a/js/js.translator/testData/box/jsExport/dataClass.kt b/js/js.translator/testData/box/jsExport/dataClass.kt new file mode 100644 index 00000000000..7652ed91e02 --- /dev/null +++ b/js/js.translator/testData/box/jsExport/dataClass.kt @@ -0,0 +1,30 @@ +// MODULE_KIND: COMMON_JS +// SKIP_MINIFICATION + +// FILE: api.kt +package api + +@JsExport +data class Point(val x: Int, val y: Int) { + override fun toString(): String = "[${x}::${y}]" +} + +// we need his class to make sure that there's more than one ping method in existence - due to peculiarities of current namer otherwise test can pass but JsExport won't be actually respected +data class AltPoint(val x: Int, val y: Int) + +// FILE: main.kt +external interface JsResult { + val res: String +} + +@JsModule("lib") +external fun jsBox(): JsResult + +fun box(): String { + val res = jsBox().res + if (res != "[13::11]") { + return "Fail1: ${res}" + } + + return "OK" +} \ No newline at end of file diff --git a/js/js.translator/testData/box/jsExport/jsExportInClass.js b/js/js.translator/testData/box/jsExport/jsExportInClass.js new file mode 100644 index 00000000000..1836b97c6ad --- /dev/null +++ b/js/js.translator/testData/box/jsExport/jsExportInClass.js @@ -0,0 +1,13 @@ +$kotlin_test_internal$.beginModule(); + +module.exports = function() { + var A = require("JS_TESTS").api.A; + var B = require("JS_TESTS").api.B; + + return { + "res": (new A().ping()) + (new B().pong()) + }; +}; + +$kotlin_test_internal$.endModule("lib"); + diff --git a/js/js.translator/testData/box/jsExport/jsExportInClass.kt b/js/js.translator/testData/box/jsExport/jsExportInClass.kt new file mode 100644 index 00000000000..17ab65bf3b5 --- /dev/null +++ b/js/js.translator/testData/box/jsExport/jsExportInClass.kt @@ -0,0 +1,39 @@ +// MODULE_KIND: COMMON_JS +// SKIP_MINIFICATION + +// FILE: api.kt +package api + +@JsExport +class A() { + fun ping() = "ping" +} + +@JsExport +class B() { + @JsName("pong") + fun ping() = "pong" +} + +// we need his class to make sure that there's more than one ping method in existence - due to peculiarities of current namer otherwise test can pass but JsExport won't be actually respected +class C() { + fun ping() = "pong" +} + + +// FILE: main.kt +external interface JsResult { + val res: String +} + +@JsModule("lib") +external fun jsBox(): JsResult + +fun box(): String { + val res = jsBox().res + if (res != "pingpong") { + return "Fail: ${res}" + } + + return "OK" +} \ No newline at end of file From 1ccbb09029ec759b3bace680a9dd8e1040b6ae77 Mon Sep 17 00:00:00 2001 From: Victor Petukhov Date: Tue, 1 Dec 2020 17:15:56 +0300 Subject: [PATCH 409/698] Fix formatting in flexibleTypes.kt --- .../jetbrains/kotlin/types/flexibleTypes.kt | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/flexibleTypes.kt b/core/descriptors/src/org/jetbrains/kotlin/types/flexibleTypes.kt index 239026f01b5..13b325d05aa 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/flexibleTypes.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/types/flexibleTypes.kt @@ -45,10 +45,8 @@ fun KotlinType.isNullabilityFlexible(): Boolean { fun Collection.singleBestRepresentative(): KotlinType? { if (this.size == 1) return this.first() - return this.firstOrNull { - candidate -> - this.all { - other -> + return this.firstOrNull { candidate -> + this.all { other -> // We consider error types equal to anything here, so that intersections like // {Array, Array<[ERROR]>} work correctly candidate == other || ErrorTypesAreEqualToAnything.equalTypes(candidate, other) @@ -73,6 +71,7 @@ fun KotlinType.lowerIfFlexible(): SimpleType = with(unwrap()) { is SimpleType -> this } } + fun KotlinType.upperIfFlexible(): SimpleType = with(unwrap()) { when (this) { is FlexibleType -> upperBound @@ -98,10 +97,10 @@ class FlexibleTypeImpl(lowerBound: SimpleType, upperBound: SimpleType) : Flexibl if (!RUN_SLOW_ASSERTIONS || assertionsDone) return assertionsDone = true - assert (!lowerBound.isFlexible()) { "Lower bound of a flexible type can not be flexible: $lowerBound" } - assert (!upperBound.isFlexible()) { "Upper bound of a flexible type can not be flexible: $upperBound" } - assert (lowerBound != upperBound) { "Lower and upper bounds are equal: $lowerBound == $upperBound" } - assert (KotlinTypeChecker.DEFAULT.isSubtypeOf(lowerBound, upperBound)) { + assert(!lowerBound.isFlexible()) { "Lower bound of a flexible type can not be flexible: $lowerBound" } + assert(!upperBound.isFlexible()) { "Upper bound of a flexible type can not be flexible: $upperBound" } + assert(lowerBound != upperBound) { "Lower and upper bounds are equal: $lowerBound == $upperBound" } + assert(KotlinTypeChecker.DEFAULT.isSubtypeOf(lowerBound, upperBound)) { "Lower bound $lowerBound of a flexible type must be a subtype of the upper bound $upperBound" } } @@ -112,19 +111,20 @@ class FlexibleTypeImpl(lowerBound: SimpleType, upperBound: SimpleType) : Flexibl return lowerBound } - override val isTypeVariable: Boolean get() = lowerBound.constructor.declarationDescriptor is TypeParameterDescriptor - && lowerBound.constructor == upperBound.constructor + override val isTypeVariable: Boolean + get() = lowerBound.constructor.declarationDescriptor is TypeParameterDescriptor + && lowerBound.constructor == upperBound.constructor override fun substitutionResult(replacement: KotlinType): KotlinType { val unwrapped = replacement.unwrap() - return when(unwrapped) { + return when (unwrapped) { is FlexibleType -> unwrapped is SimpleType -> KotlinTypeFactory.flexibleType(unwrapped, unwrapped.makeNullableAsSpecified(true)) }.inheritEnhancement(unwrapped) } - override fun replaceAnnotations(newAnnotations: Annotations): UnwrappedType - = KotlinTypeFactory.flexibleType(lowerBound.replaceAnnotations(newAnnotations), upperBound.replaceAnnotations(newAnnotations)) + override fun replaceAnnotations(newAnnotations: Annotations): UnwrappedType = + KotlinTypeFactory.flexibleType(lowerBound.replaceAnnotations(newAnnotations), upperBound.replaceAnnotations(newAnnotations)) override fun render(renderer: DescriptorRenderer, options: DescriptorRendererOptions): String { if (options.debugMode) { @@ -133,8 +133,10 @@ class FlexibleTypeImpl(lowerBound: SimpleType, upperBound: SimpleType) : Flexibl return renderer.renderFlexibleType(renderer.renderType(lowerBound), renderer.renderType(upperBound), builtIns) } - override fun makeNullableAsSpecified(newNullability: Boolean): UnwrappedType - = KotlinTypeFactory.flexibleType(lowerBound.makeNullableAsSpecified(newNullability), upperBound.makeNullableAsSpecified(newNullability)) + override fun makeNullableAsSpecified(newNullability: Boolean): UnwrappedType = KotlinTypeFactory.flexibleType( + lowerBound.makeNullableAsSpecified(newNullability), + upperBound.makeNullableAsSpecified(newNullability) + ) @TypeRefinement @OptIn(TypeRefinement::class) From 9f58e4bcfedbfbcc561494e9ed5dbc796d987682 Mon Sep 17 00:00:00 2001 From: Victor Petukhov Date: Tue, 1 Dec 2020 17:19:00 +0300 Subject: [PATCH 410/698] Add `FlexibleTypeBoundsChecker` which can answer the question: "can two types be different bounds of the same flexible type?"; and provide the base bound for the given bound. For instance: `MutableList` and `List` may be within the same flexible type. --- .../jetbrains/kotlin/types/flexibleTypes.kt | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/flexibleTypes.kt b/core/descriptors/src/org/jetbrains/kotlin/types/flexibleTypes.kt index 13b325d05aa..31deca759d2 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/flexibleTypes.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/types/flexibleTypes.kt @@ -16,10 +16,13 @@ package org.jetbrains.kotlin.types +import org.jetbrains.kotlin.builtins.StandardNames import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor import org.jetbrains.kotlin.descriptors.annotations.Annotations +import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.renderer.DescriptorRenderer import org.jetbrains.kotlin.renderer.DescriptorRendererOptions +import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe import org.jetbrains.kotlin.types.checker.ErrorTypesAreEqualToAnything import org.jetbrains.kotlin.types.checker.KotlinTypeChecker import org.jetbrains.kotlin.types.checker.KotlinTypeRefiner @@ -147,3 +150,34 @@ class FlexibleTypeImpl(lowerBound: SimpleType, upperBound: SimpleType) : Flexibl ) } } + +object FlexibleTypeBoundsChecker { + private val fqNames = StandardNames.FqNames + private val baseTypesToMutableEquivalent = mapOf( + fqNames.iterable to fqNames.mutableIterable, + fqNames.iterator to fqNames.mutableIterator, + fqNames.listIterator to fqNames.mutableListIterator, + fqNames.list to fqNames.mutableList, + fqNames.collection to fqNames.mutableCollection, + fqNames.set to fqNames.mutableSet, + fqNames.map to fqNames.mutableMap, + fqNames.mapEntry to fqNames.mutableMapEntry + ) + private val mutableToBaseMap = baseTypesToMutableEquivalent.entries.associateBy({ it.value }) { it.key } + + fun areTypesMayBeLowerAndUpperBoundsOfSameFlexibleTypeByMutability(a: KotlinType, b: KotlinType): Boolean { + val fqName = a.constructor.declarationDescriptor?.fqNameSafe ?: return false + val possiblePairBound = (baseTypesToMutableEquivalent[fqName] ?: mutableToBaseMap[fqName]) ?: return false + + return possiblePairBound == b.constructor.declarationDescriptor?.fqNameSafe + } + + // We consider base bounds as not mutable collections + fun getBaseBoundFqNameByMutability(a: KotlinType): FqName? { + val fqName = a.constructor.declarationDescriptor?.fqNameSafe ?: return null + + if (fqName in baseTypesToMutableEquivalent) return fqName + + return mutableToBaseMap[fqName] + } +} From d25ad269e069c035e4ccf7cd7f00905834899dd9 Mon Sep 17 00:00:00 2001 From: Victor Petukhov Date: Tue, 1 Dec 2020 17:24:50 +0300 Subject: [PATCH 411/698] Reuse captured arguments for flexible type's bounds properly, by equality of type constructors modulo mutability and type argument ^KT-43630 Fixed --- ...irOldFrontendDiagnosticsTestGenerated.java | 10 +++ ...ntersectionTypesWithDifferentBounds.fir.kt | 23 +++++ ...bleIntersectionTypesWithDifferentBounds.kt | 23 +++++ ...ctionTypesWithDifferentConstructors.fir.kt | 29 ++++++ ...ersectionTypesWithDifferentConstructors.kt | 29 ++++++ .../checkers/DiagnosticsTestGenerated.java | 10 +++ .../DiagnosticsUsingJavacTestGenerated.java | 10 +++ .../kotlin/types/checker/NewCapturedType.kt | 89 ++++++++++++++----- 8 files changed, 200 insertions(+), 23 deletions(-) create mode 100644 compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentBounds.fir.kt create mode 100644 compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentBounds.kt create mode 100644 compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentConstructors.fir.kt create mode 100644 compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentConstructors.kt diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java index 6659b194ca6..6461511a692 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java @@ -10659,6 +10659,16 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/captureTypeOnlyOnTopLevel.kt"); } + @TestMetadata("capturedFlexibleIntersectionTypesWithDifferentBounds.kt") + public void testCapturedFlexibleIntersectionTypesWithDifferentBounds() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentBounds.kt"); + } + + @TestMetadata("capturedFlexibleIntersectionTypesWithDifferentConstructors.kt") + public void testCapturedFlexibleIntersectionTypesWithDifferentConstructors() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentConstructors.kt"); + } + @TestMetadata("capturedType.kt") public void testCapturedType() throws Exception { runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/capturedType.kt"); diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentBounds.fir.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentBounds.fir.kt new file mode 100644 index 00000000000..088e4a26ebf --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentBounds.fir.kt @@ -0,0 +1,23 @@ +// FILE: Bar.java +// !DIAGNOSTICS: -UNUSED_PARAMETER +// SKIP_TXT + +public class Bar { } + +// FILE: Foo.java + +public class Foo

extends Bar { + public static final Bar bar = null; +} + +// FILE: main.kt + +fun

takeFoo(foo: Foo

) {} + +fun main(x: Foo<*>?) { + val y = Foo.bar + if (y !is Foo<*>?) return + if (y == null) return + if (x != y) return + takeFoo(x) // Here we capture `{Bar & Foo<*>}..Foo<*>?` +} diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentBounds.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentBounds.kt new file mode 100644 index 00000000000..39f61226a39 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentBounds.kt @@ -0,0 +1,23 @@ +// FILE: Bar.java +// !DIAGNOSTICS: -UNUSED_PARAMETER +// SKIP_TXT + +public class Bar { } + +// FILE: Foo.java + +public class Foo

extends Bar { + public static final Bar bar = null; +} + +// FILE: main.kt + +fun

takeFoo(foo: Foo

) {} + +fun main(x: Foo<*>?) { + val y = Foo.bar + if (y !is Foo<*>?) return + if (y == null) return + if (x != y) return + takeFoo(x) // Here we capture `{Bar & Foo<*>}..Foo<*>?` +} diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentConstructors.fir.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentConstructors.fir.kt new file mode 100644 index 00000000000..9c3c11310f6 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentConstructors.fir.kt @@ -0,0 +1,29 @@ +// FULL_JDK +// !DIAGNOSTICS: -UNUSED_PARAMETER +// SKIP_TXT + +// FILE: Bar.java + +public class Bar { } + +// FILE: Foo.java + +import java.util.List; + +public class Foo

extends Bar { + public static final List bar = null; +} + +// FILE: main.kt + +fun

takeFoo(foo: Foo

) {} + +fun main(x: Foo<*>?) { + val y = Foo.bar + if (y !is Foo<*>?) return + if (y == null) return + if (x != y) return + // Here we capture `({Foo<*> & MutableList<*>}..{Foo<*>? & List<*>?})` + // `*` inside `MutableList` and `List` have to become the same captured type + takeFoo(x) +} diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentConstructors.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentConstructors.kt new file mode 100644 index 00000000000..d1137fc947e --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentConstructors.kt @@ -0,0 +1,29 @@ +// FULL_JDK +// !DIAGNOSTICS: -UNUSED_PARAMETER +// SKIP_TXT + +// FILE: Bar.java + +public class Bar { } + +// FILE: Foo.java + +import java.util.List; + +public class Foo

extends Bar { + public static final List bar = null; +} + +// FILE: main.kt + +fun

takeFoo(foo: Foo

) {} + +fun main(x: Foo<*>?) { + val y = Foo.bar + if (y !is Foo<*>?) return + if (y == null) return + if (x != y) return + // Here we capture `({Foo<*> & MutableList<*>}..{Foo<*>? & List<*>?})` + // `*` inside `MutableList` and `List` have to become the same captured type + takeFoo(x) +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index da36d1cfb30..0b2c9fb6136 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -10666,6 +10666,16 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/captureTypeOnlyOnTopLevel.kt"); } + @TestMetadata("capturedFlexibleIntersectionTypesWithDifferentBounds.kt") + public void testCapturedFlexibleIntersectionTypesWithDifferentBounds() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentBounds.kt"); + } + + @TestMetadata("capturedFlexibleIntersectionTypesWithDifferentConstructors.kt") + public void testCapturedFlexibleIntersectionTypesWithDifferentConstructors() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentConstructors.kt"); + } + @TestMetadata("capturedType.kt") public void testCapturedType() throws Exception { runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/capturedType.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java index 3b0c389a813..ac73819e95e 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java @@ -10661,6 +10661,16 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/captureTypeOnlyOnTopLevel.kt"); } + @TestMetadata("capturedFlexibleIntersectionTypesWithDifferentBounds.kt") + public void testCapturedFlexibleIntersectionTypesWithDifferentBounds() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentBounds.kt"); + } + + @TestMetadata("capturedFlexibleIntersectionTypesWithDifferentConstructors.kt") + public void testCapturedFlexibleIntersectionTypesWithDifferentConstructors() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentConstructors.kt"); + } + @TestMetadata("capturedType.kt") public void testCapturedType() throws Exception { runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/capturedType.kt"); diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/checker/NewCapturedType.kt b/core/descriptors/src/org/jetbrains/kotlin/types/checker/NewCapturedType.kt index ec3b1d1572a..e059d5295c8 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/checker/NewCapturedType.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/types/checker/NewCapturedType.kt @@ -23,12 +23,30 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotations import org.jetbrains.kotlin.resolve.calls.inference.CapturedTypeConstructor import org.jetbrains.kotlin.resolve.scopes.MemberScope import org.jetbrains.kotlin.types.* +import org.jetbrains.kotlin.types.FlexibleTypeBoundsChecker.areTypesMayBeLowerAndUpperBoundsOfSameFlexibleTypeByMutability import org.jetbrains.kotlin.types.model.CaptureStatus import org.jetbrains.kotlin.types.model.CapturedTypeMarker import org.jetbrains.kotlin.types.refinement.TypeRefinement import org.jetbrains.kotlin.types.typeUtil.asTypeProjection import org.jetbrains.kotlin.types.typeUtil.builtIns +private class CapturedArguments(val capturedArguments: List, private val originalType: KotlinType) { + fun isSuitableForType(type: KotlinType): Boolean { + val areArgumentsMatched = type.arguments.withIndex().all { (i, typeArgumentsType) -> + originalType.arguments.size > i && typeArgumentsType == originalType.arguments[i] + } + + if (!areArgumentsMatched) return false + + val areConstructorsMatched = originalType.constructor == type.constructor + || areTypesMayBeLowerAndUpperBoundsOfSameFlexibleTypeByMutability(originalType, type) + + if (!areConstructorsMatched) return false + + return true + } +} + // null means that type should be leaved as is fun prepareArgumentTypeRegardingCaptureTypes(argumentType: UnwrappedType): UnwrappedType? { return if (argumentType is NewCapturedType) null else captureFromExpression(argumentType) @@ -42,33 +60,44 @@ fun captureFromExpression(type: UnwrappedType): UnwrappedType? { } /* - * We capture intersection types in two stages: - * capture type arguments for each component and replace it in the original type after that. - * This is to substitute captured types into flexible types properly: - * we should have the same captured types both for lower bound and for upper one. - * - * Example: - * The original type: ({Comparable<*> & java.io.Serializable}..{Comparable<*>? & java.io.Serializable?}) - * Result of capturing arguments by components: [[CapturedType(*)], null] - * The resulting type: ({Comparable & java.io.Serializable}..{Comparable? & java.io.Serializable?}) + * We capture arguments in the intersection types in specific way: + * 1) Firstly, we create captured arguments for all type arguments grouped by a type constructor* and a type argument's type. + * It means, that we create only one captured argument for two types `Foo<*>` and `Foo<*>?` within a flexible type, for instance. + * * In addition to grouping by type constructors, we look at possibility locating of two types in different bounds of the same flexible type. + * This is necessary in order to create the same captured arguments, + * for example, for `MutableList` in the lower bound of the flexible type and for `List` in the upper one. + * Example: MutableList<*>..List<*>? -> MutableList..List?, Captured1(*) and Captured2(*) are the same. + * 2) Secondly, we replace type arguments with captured arguments by given a type constructor and type arguments. */ - val capturedArgumentsByComponents = captureArgumentsForIntersectionType(typeConstructor) ?: return null + val capturedArgumentsByComponents = captureArgumentsForIntersectionType(type) ?: return null - fun replaceArgumentsByComponents(typeToReplace: UnwrappedType) = - typeToReplace.constructor.supertypes.mapIndexed { i, componentType -> - val capturedArguments = capturedArgumentsByComponents[i] ?: return@mapIndexed componentType.asSimpleType() - componentType.unwrap().replaceArguments(capturedArguments) + // We reuse `TypeToCapture` for some types, suitability to reuse defines by `isSuitableForType` + fun findCorrespondingCapturedArgumentsForType(type: KotlinType) = + capturedArgumentsByComponents.find { typeToCapture -> typeToCapture.isSuitableForType(type) }?.capturedArguments + + fun replaceArgumentsWithCapturedArgumentsByIntersectionComponents(typeToReplace: UnwrappedType): List { + return if (typeToReplace.constructor is IntersectionTypeConstructor) { + typeToReplace.constructor.supertypes.map { componentType -> + val capturedArguments = findCorrespondingCapturedArgumentsForType(componentType) + ?: return@map componentType.asSimpleType() + componentType.unwrap().replaceArguments(capturedArguments) + } + } else { + val capturedArguments = findCorrespondingCapturedArgumentsForType(typeToReplace) + ?: return listOf(typeToReplace.asSimpleType()) + listOf(typeToReplace.unwrap().replaceArguments(capturedArguments)) } + } return if (type is FlexibleType) { - val lowerIntersectedType = - intersectTypes(replaceArgumentsByComponents(type.lowerBound)).makeNullableAsSpecified(type.lowerBound.isMarkedNullable) - val upperIntersectedType = - intersectTypes(replaceArgumentsByComponents(type.upperBound)).makeNullableAsSpecified(type.upperBound.isMarkedNullable) + val lowerIntersectedType = intersectTypes(replaceArgumentsWithCapturedArgumentsByIntersectionComponents(type.lowerBound)) + .makeNullableAsSpecified(type.lowerBound.isMarkedNullable) + val upperIntersectedType = intersectTypes(replaceArgumentsWithCapturedArgumentsByIntersectionComponents(type.upperBound)) + .makeNullableAsSpecified(type.upperBound.isMarkedNullable) KotlinTypeFactory.flexibleType(lowerIntersectedType, upperIntersectedType) } else { - intersectTypes(replaceArgumentsByComponents(type)).makeNullableAsSpecified(type.isMarkedNullable) + intersectTypes(replaceArgumentsWithCapturedArgumentsByIntersectionComponents(type)).makeNullableAsSpecified(type.isMarkedNullable) } } @@ -76,15 +105,29 @@ fun captureFromExpression(type: UnwrappedType): UnwrappedType? { internal fun captureFromArguments(type: SimpleType, status: CaptureStatus) = captureArguments(type, status)?.let { type.replaceArguments(it) } -private fun captureArgumentsForIntersectionType(typeConstructor: TypeConstructor): List?>? { +private fun captureArgumentsForIntersectionType(type: KotlinType): List? { + // It's possible to have one of the bounds as non-intersection type + fun getTypesToCapture(type: KotlinType) = + if (type.constructor is IntersectionTypeConstructor) type.constructor.supertypes else listOf(type) + + val filteredTypesToCapture = + if (type is FlexibleType) { + val typesToCapture = getTypesToCapture(type.lowerBound) + getTypesToCapture(type.upperBound) + typesToCapture.distinctBy { (FlexibleTypeBoundsChecker.getBaseBoundFqNameByMutability(it) ?: it.constructor) to it.arguments } + } else type.constructor.supertypes + var changed = false - val capturedArgumentsByComponents = typeConstructor.supertypes.map { supertype -> - captureArguments(supertype.unwrap(), CaptureStatus.FROM_EXPRESSION)?.apply { changed = true } + + val capturedArgumentsByTypes = filteredTypesToCapture.mapNotNull { typeToCapture -> + val capturedArguments = captureArguments(typeToCapture.unwrap(), CaptureStatus.FROM_EXPRESSION) + ?: return@mapNotNull null + changed = true + CapturedArguments(capturedArguments, originalType = typeToCapture) } if (!changed) return null - return capturedArgumentsByComponents + return capturedArgumentsByTypes } private fun captureFromArguments(type: UnwrappedType, status: CaptureStatus): UnwrappedType? { From 9d749feb644297f1952dfa41870f7bedb30ac6f8 Mon Sep 17 00:00:00 2001 From: LepilkinaElena Date: Thu, 3 Dec 2020 12:57:02 +0300 Subject: [PATCH 412/698] Fix gradle test for endorsed libraries in K/N (#3953) --- .../testProject/native-endorsed/src/hostMain/kotlin/main.kt | 3 --- 1 file changed, 3 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/native-endorsed/src/hostMain/kotlin/main.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/native-endorsed/src/hostMain/kotlin/main.kt index d332977d64a..837b4258c5d 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/native-endorsed/src/hostMain/kotlin/main.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/native-endorsed/src/hostMain/kotlin/main.kt @@ -2,9 +2,6 @@ import kotlinx.cli.* fun main(args: Array) { val argParser = ArgParser("test") - val mode by argParser.option( - ArgType.Choice(listOf("video", "audio", "both")), shortName = "m", description = "Play mode") - .default("both") val size by argParser.option(ArgType.Int, shortName = "s", description = "Required size of videoplayer window") .delimiter(",") val fileName by argParser.argument(ArgType.String, description = "File to play") From b0ff3e7e5ea589db3c61279ee5661012e66ed3e0 Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov Date: Thu, 26 Nov 2020 17:19:03 +0300 Subject: [PATCH 413/698] [Commonizer] More fine-grained control of commonized module dependencies - Reduce usage of 'isUnderStandardKotlinPackages' check in commonizer source code - Rely on common module dependencies supplied via commonizer Parameters which not only Kotlin standard library but may also include common fragments of other libraries --- .../descriptors/commonizer/Parameters.kt | 9 +- .../descriptors/commonizer/TargetProvider.kt | 5 +- .../descriptors/commonizer/builder/context.kt | 161 +++++--- .../konan/NativeDistributionCommonizer.kt | 58 +-- .../NativeDistributionModulesProvider.kt | 53 +-- .../konan/NativeDistributionStdlibProvider.kt | 46 +++ ...istributionLibrary.kt => NativeLibrary.kt} | 32 +- .../commonizer/mergedtree/CirTreeMerger.kt | 45 ++- .../commonizer/mergedtree/collectors.kt | 6 +- .../descriptors/commonizer/utils/fqName.kt | 12 +- .../commonizer/utils/moduleDescriptor.kt | 90 +---- .../linux/package_kotlinx_cinterop.kt | 12 - .../macos/package_kotlinx_cinterop.kt | 12 - .../common/package_kotlinx_cinterop.kt | 0 .../linux/package_kotlinx_cinterop.kt | 12 - .../macos/package_kotlinx_cinterop.kt | 12 - .../macos/package_kotlinx_cinterop.kt | 6 - .../common}/package_kotlinx_cinterop.kt | 0 .../original/ios/package_kotlinx_cinterop.kt | 6 - .../macos/package_kotlinx_cinterop.kt | 6 - .../AbstractCommonizationFromSourcesTest.kt | 358 ++++++++++-------- .../commonizer/CommonizerFacadeTest.kt | 3 +- .../descriptors/commonizer/utils/mocks.kt | 5 +- 23 files changed, 479 insertions(+), 470 deletions(-) create mode 100644 native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionStdlibProvider.kt rename native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/{NativeDistributionLibrary.kt => NativeLibrary.kt} (69%) delete mode 100644 native/commonizer/testData/classifierCommonization/typeAliases/commonized/linux/package_kotlinx_cinterop.kt delete mode 100644 native/commonizer/testData/classifierCommonization/typeAliases/commonized/macos/package_kotlinx_cinterop.kt rename native/commonizer/testData/classifierCommonization/typeAliases/{commonized => dependee}/common/package_kotlinx_cinterop.kt (100%) delete mode 100644 native/commonizer/testData/classifierCommonization/typeAliases/original/linux/package_kotlinx_cinterop.kt delete mode 100644 native/commonizer/testData/classifierCommonization/typeAliases/original/macos/package_kotlinx_cinterop.kt delete mode 100644 native/commonizer/testData/functionCommonization/valueParameters/commonized/macos/package_kotlinx_cinterop.kt rename native/commonizer/testData/functionCommonization/valueParameters/{commonized/ios => dependee/common}/package_kotlinx_cinterop.kt (100%) delete mode 100644 native/commonizer/testData/functionCommonization/valueParameters/original/ios/package_kotlinx_cinterop.kt delete mode 100644 native/commonizer/testData/functionCommonization/valueParameters/original/macos/package_kotlinx_cinterop.kt diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Parameters.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Parameters.kt index 6104607ebc1..e86707b0ff3 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Parameters.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Parameters.kt @@ -16,16 +16,13 @@ class Parameters( val targetProviders: List get() = _targetProviders.values.toList() - // only for test purposes - internal var extendedLookupForBuiltInsClassifiers: Boolean = false + // common module dependencies (ex: Kotlin stdlib) + var dependeeModulesProvider: ModulesProvider? = null set(value) { - check(!field || value) + check(field == null) field = value } - // only for test purposes - internal var commonModulesProvider: ModulesProvider? = null - fun addTarget(targetProvider: TargetProvider): Parameters { require(targetProvider.target !in _targetProviders) { "Target ${targetProvider.target} is already added" } _targetProviders[targetProvider.target] = targetProvider diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/TargetProvider.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/TargetProvider.kt index b3abce353fd..d2969f68ac0 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/TargetProvider.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/TargetProvider.kt @@ -14,7 +14,8 @@ class TargetProvider( val target: InputTarget, val builtInsClass: Class, val builtInsProvider: BuiltInsProvider, - val modulesProvider: ModulesProvider + val modulesProvider: ModulesProvider, + val dependeeModulesProvider: ModulesProvider? ) interface BuiltInsProvider { @@ -40,5 +41,5 @@ interface ModulesProvider { ) fun loadModuleInfos(): Map - fun loadModules(): Map + fun loadModules(dependencies: Collection): Map } diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/builder/context.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/builder/context.kt index 0cc87156e5e..b1ce4f240a6 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/builder/context.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/builder/context.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.descriptors.commonizer.builder import gnu.trove.THashMap import org.jetbrains.kotlin.builtins.KotlinBuiltIns +import org.jetbrains.kotlin.builtins.StandardNames import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.commonizer.Parameters import org.jetbrains.kotlin.descriptors.commonizer.Target @@ -133,68 +134,84 @@ class TargetDeclarationsBuilderComponents( val storageManager: StorageManager, val target: Target, val builtIns: KotlinBuiltIns, - val lazyModulesLookupTable: NotNullLazyValue>, - val isCommon: Boolean, + val lazyClassifierLookupTable: NotNullLazyValue, val index: Int, private val cache: DeclarationsBuilderCache ) { - // only for test purposes - internal var extendedLookupForBuiltInsClassifiers: Boolean = false - // N.B. this function may create new classifiers for types from Kotlin/Native forward declarations packages - fun findClassOrTypeAlias(classId: ClassId): ClassifierDescriptorWithTypeParameters { - return when { - classId.packageFqName.isUnderStandardKotlinPackages -> { - // look up for classifier in built-ins module: - val builtInsModule = builtIns.builtInsModule - - // TODO: this works fine for Native as far as built-ins module contains full Native stdlib, but this is not enough for JVM and JS - val classifier = builtInsModule.resolveClassOrTypeAlias(classId) - if (classifier != null) - return classifier - - if (extendedLookupForBuiltInsClassifiers) { - return findOriginalClassOrTypeAlias(classId) - ?: error("Classifier ${classId.asString()} not found neither in built-ins module $builtInsModule nor in original modules for $target") - } - - error("Classifier ${classId.asString()} not found in built-ins module $builtInsModule for $target") - } - classId.packageFqName.isUnderKotlinNativeSyntheticPackages -> { - // that's a synthetic Kotlin/Native classifier that was exported as forward declaration in one or more modules, - // but did not match any existing class or typealias - cache.getOrPutForwardDeclarationsModule(index) { - // N.B. forward declarations module is created only on demand - createKotlinNativeForwardDeclarationsModule( - storageManager = storageManager, - builtIns = builtIns - ) - }.resolveClassOrTypeAlias(classId) - ?: error("Classifier ${classId.asString()} not found for $target") - } - else -> { - cache.getCachedClassifier(classId, index) // first, look up in created descriptors cache - ?: findOriginalClassOrTypeAlias(classId) // then, attempt to load the original classifier - ?: error("Classifier ${classId.asString()} not found for $target") - } + fun findClassOrTypeAlias(classifierId: ClassId): ClassifierDescriptorWithTypeParameters { + return if (classifierId.packageFqName.isUnderKotlinNativeSyntheticPackages) { + // that's a synthetic Kotlin/Native classifier that was exported as forward declaration in one or more modules, + // but did not match any existing class or typealias + cache.getOrPutForwardDeclarationsModule(index) { + // N.B. forward declarations module is created only on demand + createKotlinNativeForwardDeclarationsModule( + storageManager = storageManager, + builtIns = builtIns + ) + }.resolveClassOrTypeAlias(classifierId) + ?: error("Classifier ${classifierId.asString()} not found for $target") + } else { + cache.getCachedClassifier(classifierId, index) // first, look up in created descriptors cache + ?: lazyClassifierLookupTable().resolveClassOrTypeAlias(classifierId) // then, attempt to load the original classifier + ?: error("Classifier ${classifierId.asString()} not found for $target") } } +} - private fun findOriginalClassOrTypeAlias(classId: ClassId): ClassifierDescriptorWithTypeParameters? { - if (classId.packageFqName.isRoot) - return null +class LazyClassifierLookupTable(lazyModules: Map>) { + private val table = THashMap>() + private val allModules: Collection - // first, guess containing module and look up in it - val classifier = lazyModulesLookupTable() - .guessModuleByPackageFqName(classId.packageFqName) - ?.resolveClassOrTypeAlias(classId) + init { + // add "module:" prefix for each key representing a module name, not a package name + lazyModules.forEach { (moduleName, modules) -> table[MODULE_NAME_PREFIX + moduleName.toLowerCase()] = modules } + allModules = lazyModules.values.flatten() + } - // if failed, then look up though all modules - return classifier - ?: lazyModulesLookupTable().values - .asSequence() - .mapNotNull { it?.resolveClassOrTypeAlias(classId) } - .firstOrNull() + fun resolveClassOrTypeAlias(classifierId: ClassId): ClassifierDescriptorWithTypeParameters? { + if (table.isEmpty) return null + + val packageFqName = classifierId.packageFqName + if (packageFqName.isRoot) return null + + val packageFqNameRaw = packageFqName.asString() + table[packageFqNameRaw]?.let { modules -> + for (module in modules) + return module.resolveClassOrTypeAlias(classifierId) ?: continue + } + + val packageFqNameFragments = packageFqNameRaw.split('.') + val moduleNameForLookup = when (packageFqNameFragments[0]) { + "kotlin" -> "kotlin" + "platform" -> if (packageFqNameFragments.size == 2) packageFqNameFragments[1].toLowerCase() else null + else -> null + } + + // try to find the classifier by guessing its container module + if (moduleNameForLookup != null) { + table[MODULE_NAME_PREFIX + moduleNameForLookup]?.let { modules -> + for (module in modules) { + val classifier = module.resolveClassOrTypeAlias(classifierId) ?: continue + table[packageFqNameRaw] = modules // cache to speed-up the further look-ups + return classifier + } + } + } + + // last resort: brute force + for (module in allModules) { + val classifier = module.resolveClassOrTypeAlias(classifierId) ?: continue + table[packageFqNameRaw] = listOf(module) // cache to speed-up the further look-ups + return classifier + } + + table[packageFqNameRaw] = null // cache to speed-up the further look-ups + return null + } + + companion object { + private const val MODULE_NAME_PREFIX = "module:" } } @@ -204,6 +221,10 @@ fun CirRootNode.createGlobalBuilderComponents( ): GlobalDeclarationsBuilderComponents { val cache = DeclarationsBuilderCache(dimension) + val lazyCommonDependeeModules = storageManager.createLazyValue { + parameters.dependeeModulesProvider?.loadModules(emptyList()).orEmpty() + } + val targetContexts = (0 until dimension).map { index -> val isCommon = index == indexOfCommon @@ -216,24 +237,38 @@ fun CirRootNode.createGlobalBuilderComponents( } val lazyModulesLookupTable = storageManager.createLazyValue { - val source = if (isCommon) - parameters.commonModulesProvider?.loadModules() ?: emptyMap() - else - parameters.targetProviders[index].modulesProvider.loadModules() - THashMap(source) + val result = mutableMapOf>() + + val commonDependeeModules: Map = lazyCommonDependeeModules() + + if (!isCommon) { + with(parameters.targetProviders[index]) { + val targetDependeeModules: Map = + dependeeModulesProvider?.loadModules(commonDependeeModules.values).orEmpty() + + val targetModules: Map = + modulesProvider.loadModules(targetDependeeModules.values + commonDependeeModules.values) + + targetModules.forEach { (moduleName, module) -> result.getOrPut(moduleName) { mutableListOf() } += module } + targetDependeeModules.forEach { (moduleName, module) -> result.getOrPut(moduleName) { mutableListOf() } += module } + } + } + + commonDependeeModules.forEach { (moduleName, module) -> result.getOrPut(moduleName) { mutableListOf() } += module } + + result.getOrPut(StandardNames.BUILT_INS_PACKAGE_FQ_NAME.asString()) { mutableListOf() } += builtIns.builtInsModule + + LazyClassifierLookupTable(result) } TargetDeclarationsBuilderComponents( storageManager = storageManager, target = root.target, builtIns = builtIns, - lazyModulesLookupTable = lazyModulesLookupTable, - isCommon = isCommon, + lazyClassifierLookupTable = lazyModulesLookupTable, index = index, cache = cache - ).also { - it.extendedLookupForBuiltInsClassifiers = parameters.extendedLookupForBuiltInsClassifiers - } + ) } return GlobalDeclarationsBuilderComponents(storageManager, targetContexts, cache, parameters.statsCollector) diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionCommonizer.kt index 7255c59f086..992eb4e6d4a 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionCommonizer.kt @@ -55,13 +55,13 @@ class NativeDistributionCommonizer( clockMark.reset() // 1. load libraries - val librariesByTargets = loadLibraries() + val allLibraries = loadLibraries() // 2. run commonization - val result = commonize(librariesByTargets) + val result = commonize(allLibraries) // 3. write new libraries - saveModules(librariesByTargets, result) + saveModules(allLibraries, result) logTotal() } @@ -86,29 +86,29 @@ class NativeDistributionCommonizer( private fun logTotal() = logger.log("TOTAL: ${clockMark.elapsedSinceStart()}") - private fun loadLibraries(): Map { + private fun loadLibraries(): AllNativeLibraries { val stdlibPath = repository.resolve(konanCommonLibraryPath(KONAN_STDLIB_NAME)) - val stdlib = loadLibrary(stdlibPath) + val stdlib = NativeLibrary(loadLibrary(stdlibPath)) - val result = targets.associate { target -> + val librariesByTargets = targets.associate { target -> val leafTarget = InputTarget(target.name, target) val platformLibs = leafTarget.platformLibrariesSource .takeIf { it.isDirectory } ?.listFiles() ?.takeIf { it.isNotEmpty() } - ?.map { loadLibrary(it) } + ?.map { NativeLibrary(loadLibrary(it)) } .orEmpty() if (platformLibs.isEmpty()) logger.warning("No platform libraries found for target $target. This target will be excluded from commonization.") - leafTarget to NativeDistributionLibraries(stdlib, platformLibs) + leafTarget to NativeLibrariesToCommonize(platformLibs) } logProgress("Read lazy (uninitialized) libraries") - return result + return AllNativeLibraries(stdlib, librariesByTargets) } private fun loadLibrary(location: File): KotlinLibrary { @@ -136,7 +136,7 @@ class NativeDistributionCommonizer( return library } - private fun commonize(librariesByTargets: Map): Result { + private fun commonize(allLibraries: AllNativeLibraries): Result { val statsCollector = when (statsType) { RAW -> RawStatsCollector(targets, FileStatsOutput(destination, "raw")) AGGREGATED -> AggregatedStatsCollector(targets, FileStatsOutput(destination, "aggregated")) @@ -144,20 +144,23 @@ class NativeDistributionCommonizer( } statsCollector.use { val parameters = Parameters(statsCollector, ::logProgress).apply { - librariesByTargets.forEach { (target, libraries) -> - if (libraries.platformLibs.isEmpty()) return@forEach + val storageManager = LockBasedStorageManager("Commonized modules") - val provider = NativeDistributionModulesProvider( - storageManager = LockBasedStorageManager("Target $target"), - libraries = libraries - ) + val stdlibProvider = NativeDistributionStdlibProvider(storageManager, allLibraries.stdlib) + dependeeModulesProvider = stdlibProvider + + allLibraries.librariesByTargets.forEach { (target, librariesToCommonize) -> + if (librariesToCommonize.libraries.isEmpty()) return@forEach + + val modulesProvider = NativeDistributionModulesProvider(storageManager, librariesToCommonize) addTarget( TargetProvider( target = target, builtInsClass = KonanBuiltIns::class.java, - builtInsProvider = provider, - modulesProvider = provider + builtInsProvider = stdlibProvider, + modulesProvider = modulesProvider, + dependeeModulesProvider = null // stdlib is already set as common dependency ) ) } @@ -167,10 +170,7 @@ class NativeDistributionCommonizer( } } - private fun saveModules( - originalLibrariesByTargets: Map, - result: Result - ) { + private fun saveModules(originalLibraries: AllNativeLibraries, result: Result) { // optimization: stdlib and endorsed libraries effectively remain the same across all Kotlin/Native targets, // so they can be just copied to the new destination without running serializer copyCommonStandardLibraries() @@ -180,8 +180,8 @@ class NativeDistributionCommonizer( // It may happen that all targets to be commonized (or at least all but one target) miss platform libraries. // In such case commonizer will do nothing and return a special result value 'NothingToCommonize'. // So, let's just copy platform libraries from the target where they are to the new destination. - originalLibrariesByTargets.forEach { (target, libraries) -> - copyTargetAsIs(target, libraries.platformLibs.size) + originalLibraries.librariesByTargets.forEach { (target, librariesToCommonize) -> + copyTargetAsIs(target, librariesToCommonize.libraries.size) } } @@ -194,11 +194,11 @@ class NativeDistributionCommonizer( ) // 'targetsToCopy' are some targets with empty set of platform libraries - val targetsToCopy = originalLibrariesByTargets.keys - result.leafTargets + val targetsToCopy = originalLibraries.librariesByTargets.keys - result.leafTargets if (targetsToCopy.isNotEmpty()) { targetsToCopy.forEach { target -> - val libraries = originalLibrariesByTargets.getValue(target) - copyTargetAsIs(target, libraries.platformLibs.size) + val librariesToCommonize = originalLibraries.librariesByTargets.getValue(target) + copyTargetAsIs(target, librariesToCommonize.libraries.size) } } @@ -214,11 +214,11 @@ class NativeDistributionCommonizer( val starredTarget: String? when (target) { is InputTarget -> { - manifestProvider = originalLibrariesByTargets.getValue(target) + manifestProvider = originalLibraries.librariesByTargets.getValue(target) starredTarget = target.name } is OutputTarget -> { - manifestProvider = CommonNativeManifestDataProvider(originalLibrariesByTargets.values) + manifestProvider = CommonNativeManifestDataProvider(originalLibraries.librariesByTargets.values) starredTarget = null } } diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionModulesProvider.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionModulesProvider.kt index b2929503f72..f05e72f196e 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionModulesProvider.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionModulesProvider.kt @@ -5,38 +5,26 @@ package org.jetbrains.kotlin.descriptors.commonizer.konan -import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.config.LanguageVersionSettingsImpl import org.jetbrains.kotlin.descriptors.ModuleDescriptor -import org.jetbrains.kotlin.descriptors.commonizer.BuiltInsProvider import org.jetbrains.kotlin.descriptors.commonizer.ModulesProvider import org.jetbrains.kotlin.descriptors.commonizer.ModulesProvider.CInteropModuleAttributes import org.jetbrains.kotlin.descriptors.commonizer.ModulesProvider.ModuleInfo import org.jetbrains.kotlin.descriptors.commonizer.utils.NativeFactories import org.jetbrains.kotlin.descriptors.commonizer.utils.createKotlinNativeForwardDeclarationsModule +import org.jetbrains.kotlin.descriptors.commonizer.utils.strip +import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl import org.jetbrains.kotlin.incremental.components.LookupTracker -import org.jetbrains.kotlin.konan.library.KONAN_STDLIB_NAME import org.jetbrains.kotlin.storage.StorageManager +import org.jetbrains.kotlin.utils.addIfNotNull import java.io.File internal class NativeDistributionModulesProvider( private val storageManager: StorageManager, - private val libraries: NativeDistributionLibraries -) : BuiltInsProvider, ModulesProvider { - override fun loadBuiltIns(): KotlinBuiltIns { - val stdlib = NativeFactories.DefaultDeserializedDescriptorFactory.createDescriptorAndNewBuiltIns( - library = libraries.stdlib.library, - languageVersionSettings = LanguageVersionSettingsImpl.DEFAULT, - storageManager = storageManager, - packageAccessHandler = null - ) - stdlib.setDependencies(listOf(stdlib)) - - return stdlib.builtIns - } - + private val librariesToCommonize: NativeLibrariesToCommonize +) : ModulesProvider { override fun loadModuleInfos(): Map { - return libraries.platformLibs.associate { library -> + return librariesToCommonize.libraries.associate { library -> val manifestData = library.manifestData val name = manifestData.uniqueName @@ -54,11 +42,18 @@ internal class NativeDistributionModulesProvider( } } - override fun loadModules(): Map { - val builtIns = loadBuiltIns() - val stdlib = builtIns.builtInsModule + override fun loadModules(dependencies: Collection): Map { + check(dependencies.isNotEmpty()) { "At least Kotlin/Native stdlib should be provided" } - val platformModulesMap = libraries.platformLibs.associate { library -> + val dependenciesMap = mutableMapOf>() + dependencies.forEach { dependency -> + val name = dependency.name.strip() + dependenciesMap.getOrPut(name) { mutableListOf() } += dependency as ModuleDescriptorImpl + } + + val builtIns = dependencies.first().builtIns + + val platformModulesMap = librariesToCommonize.libraries.associate { library -> val name = library.manifestData.uniqueName val module = NativeFactories.DefaultDeserializedDescriptorFactory.createDescriptorOptionalBuiltIns( library = library.library, @@ -78,11 +73,17 @@ internal class NativeDistributionModulesProvider( ) platformModulesMap.forEach { (name, module) -> - val dependencies = libraries.getManifest(name) - .dependencies - .map { if (it == KONAN_STDLIB_NAME) stdlib else platformModulesMap.getValue(it) } + val moduleDependencies = mutableListOf() + moduleDependencies += module - module.setDependencies(listOf(module) + dependencies + forwardDeclarations) + librariesToCommonize.getManifest(name).dependencies.forEach { + moduleDependencies.addIfNotNull(platformModulesMap[it]) + moduleDependencies += dependenciesMap[it].orEmpty() + } + + moduleDependencies += forwardDeclarations + + module.setDependencies(moduleDependencies) } return platformModulesMap diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionStdlibProvider.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionStdlibProvider.kt new file mode 100644 index 00000000000..02b2b469258 --- /dev/null +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionStdlibProvider.kt @@ -0,0 +1,46 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.descriptors.commonizer.konan + +import org.jetbrains.kotlin.builtins.KotlinBuiltIns +import org.jetbrains.kotlin.config.LanguageVersionSettingsImpl +import org.jetbrains.kotlin.descriptors.ModuleDescriptor +import org.jetbrains.kotlin.descriptors.commonizer.BuiltInsProvider +import org.jetbrains.kotlin.descriptors.commonizer.ModulesProvider +import org.jetbrains.kotlin.descriptors.commonizer.ModulesProvider.ModuleInfo +import org.jetbrains.kotlin.descriptors.commonizer.utils.NativeFactories +import org.jetbrains.kotlin.konan.library.KONAN_STDLIB_NAME +import org.jetbrains.kotlin.storage.StorageManager +import java.io.File + +internal class NativeDistributionStdlibProvider( + private val storageManager: StorageManager, + private val stdlib: NativeLibrary +) : BuiltInsProvider, ModulesProvider { + private val moduleInfo = ModuleInfo( + name = KONAN_STDLIB_NAME, + originalLocation = File(stdlib.library.libraryFile.absolutePath), + cInteropAttributes = null + ) + + override fun loadBuiltIns(): KotlinBuiltIns = loadStdlibModule().builtIns + override fun loadModuleInfos(): Map = mapOf(KONAN_STDLIB_NAME to moduleInfo) + + override fun loadModules(dependencies: Collection): Map { + check(dependencies.isEmpty()) + return mapOf(KONAN_STDLIB_NAME to loadStdlibModule()) + } + + private fun loadStdlibModule() = + NativeFactories.DefaultDeserializedDescriptorFactory.createDescriptorAndNewBuiltIns( + library = stdlib.library, + languageVersionSettings = LanguageVersionSettingsImpl.DEFAULT, + storageManager = storageManager, + packageAccessHandler = null + ).apply { + setDependencies(listOf(this)) + } +} \ No newline at end of file diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionLibrary.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeLibrary.kt similarity index 69% rename from native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionLibrary.kt rename to native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeLibrary.kt index a0ce30ddb91..e9587a195d4 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionLibrary.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeLibrary.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.descriptors.commonizer.konan import gnu.trove.THashMap +import org.jetbrains.kotlin.descriptors.commonizer.InputTarget import org.jetbrains.kotlin.library.KotlinLibrary internal interface NativeManifestDataProvider { @@ -13,33 +14,34 @@ internal interface NativeManifestDataProvider { } /** - * A separate Kotlin/Native library from the distribution. + * A separate Kotlin/Native library. */ -internal class NativeDistributionLibrary( +internal class NativeLibrary( val library: KotlinLibrary ) { val manifestData = NativeSensitiveManifestData.readFrom(library) } /** - * A collection of Kotlin/Native libraries for a certain Native target + stdlib from the distribution. + * A collection of Kotlin/Native libraries for a certain Native target. */ -internal class NativeDistributionLibraries( - val stdlib: NativeDistributionLibrary, - val platformLibs: List -) : NativeManifestDataProvider { - constructor(stdlib: KotlinLibrary, platformLibs: List) : this( - NativeDistributionLibrary(stdlib), - platformLibs.map(::NativeDistributionLibrary) - ) - +internal class NativeLibrariesToCommonize(val libraries: List) : NativeManifestDataProvider { private val manifestIndex: Map = buildManifestIndex() override fun getManifest(libraryName: String) = manifestIndex.getValue(libraryName) + + companion object { + fun create(libraries: List) = NativeLibrariesToCommonize(libraries.map(::NativeLibrary)) + } } +internal class AllNativeLibraries( + val stdlib: NativeLibrary, + val librariesByTargets: Map +) + internal class CommonNativeManifestDataProvider( - libraryGroups: Collection + libraryGroups: Collection ) : NativeManifestDataProvider { private val manifestIndex: Map @@ -66,5 +68,5 @@ internal class CommonNativeManifestDataProvider( override fun getManifest(libraryName: String) = manifestIndex.getValue(libraryName) } -private fun NativeDistributionLibraries.buildManifestIndex(): MutableMap = - (platformLibs + stdlib).map { it.manifestData }.associateByTo(THashMap()) { it.uniqueName } +private fun NativeLibrariesToCommonize.buildManifestIndex(): MutableMap = + libraries.map { it.manifestData }.associateByTo(THashMap()) { it.uniqueName } diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirTreeMerger.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirTreeMerger.kt index 2164fd37540..4ddb14e5bde 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirTreeMerger.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirTreeMerger.kt @@ -59,14 +59,26 @@ class CirTreeMerger( private val size = parameters.targetProviders.size fun merge(): CirTreeMergeResult { + val result = processRoot() + System.gc() + return result + } + + private fun processRoot(): CirTreeMergeResult { val rootNode: CirRootNode = buildRootNode(storageManager, size) + // remember any exported forward declarations from common fragments of dependee modules + parameters.dependeeModulesProvider?.loadModuleInfos()?.values?.forEach(::processCInteropModuleAttributes) + + // load common dependencies + val dependeeModules = parameters.dependeeModulesProvider?.loadModules(emptyList())?.values.orEmpty() + val allModuleInfos: List> = parameters.targetProviders.map { it.modulesProvider.loadModuleInfos() } val commonModuleNames = allModuleInfos.map { it.keys }.reduce { a, b -> a intersect b } parameters.targetProviders.forEachIndexed { targetIndex, targetProvider -> val commonModuleInfos = allModuleInfos[targetIndex].filterKeys { it in commonModuleNames } - processTarget(rootNode, targetIndex, targetProvider, commonModuleInfos) + processTarget(rootNode, targetIndex, targetProvider, commonModuleInfos, dependeeModules) parameters.progressLogger?.invoke("Loaded declarations for [${targetProvider.target.name}]") System.gc() } @@ -87,7 +99,8 @@ class CirTreeMerger( rootNode: CirRootNode, targetIndex: Int, targetProvider: TargetProvider, - commonModuleInfos: Map + commonModuleInfos: Map, + dependeeModules: Collection ) { rootNode.targetDeclarations[targetIndex] = CirRootFactory.create( targetProvider.target, @@ -95,7 +108,10 @@ class CirTreeMerger( targetProvider.builtInsProvider ) - val moduleDescriptors: Map = targetProvider.modulesProvider.loadModules() + val targetDependeeModules = targetProvider.dependeeModulesProvider?.loadModules(dependeeModules)?.values.orEmpty() + val allDependeeModules = targetDependeeModules + dependeeModules + + val moduleDescriptors: Map = targetProvider.modulesProvider.loadModules(allDependeeModules) val modules: MutableMap = rootNode.modules moduleDescriptors.forEach { (name, moduleDescriptor) -> @@ -110,16 +126,7 @@ class CirTreeMerger( moduleInfo: ModuleInfo, moduleDescriptor: ModuleDescriptor ) { - moduleInfo.cInteropAttributes?.let { cInteropAttributes -> - val exportForwardDeclarations = cInteropAttributes.exportForwardDeclarations.takeIf { it.isNotEmpty() } ?: return@let - val mainPackageFqName = FqName(cInteropAttributes.mainPackageFqName).intern() - - exportForwardDeclarations.forEach { classFqName -> - // Class has synthetic package FQ name (cnames/objcnames). Need to transfer it to the main package. - val className = Name.identifier(classFqName.substringAfterLast('.')).intern() - cache.addExportedForwardDeclaration(internedClassId(mainPackageFqName, className)) - } - } + processCInteropModuleAttributes(moduleInfo) val moduleName: Name = moduleDescriptor.name.intern() val moduleNode: CirModuleNode = modules.getOrPut(moduleName) { @@ -258,4 +265,16 @@ class CirTreeMerger( } typeAliasNode.targetDeclarations[targetIndex] = CirTypeAliasFactory.create(typeAliasDescriptor) } + + private fun processCInteropModuleAttributes(moduleInfo: ModuleInfo) { + val cInteropAttributes = moduleInfo.cInteropAttributes ?: return + val exportForwardDeclarations = cInteropAttributes.exportForwardDeclarations.takeIf { it.isNotEmpty() } ?: return + val mainPackageFqName = FqName(cInteropAttributes.mainPackageFqName).intern() + + exportForwardDeclarations.forEach { classFqName -> + // Class has synthetic package FQ name (cnames/objcnames). Need to transfer it to the main package. + val className = Name.identifier(classFqName.substringAfterLast('.')).intern() + cache.addExportedForwardDeclaration(internedClassId(mainPackageFqName, className)) + } + } } diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/collectors.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/collectors.kt index ea544306b47..1d1916a2382 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/collectors.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/collectors.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.descriptors.commonizer.mergedtree +import org.jetbrains.kotlin.backend.common.serialization.metadata.impl.ClassifierAliasingPackageFragmentDescriptor import org.jetbrains.kotlin.backend.common.serialization.metadata.impl.ExportedForwardDeclarationsPackageFragmentDescriptor import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.commonizer.utils.* @@ -69,12 +70,9 @@ internal fun ModuleDescriptor.collectNonEmptyPackageMemberScopes(collector: (FqN val packageFragmentProvider = this.packageFragmentProvider fun recurse(packageFqName: FqName) { - if (packageFqName.isUnderStandardKotlinPackages || packageFqName.isUnderKotlinNativeSyntheticPackages) - return - val ownPackageFragments = packageFragmentProvider.packageFragments(packageFqName) val ownPackageMemberScopes = ownPackageFragments.asSequence() - .filter { it !is ExportedForwardDeclarationsPackageFragmentDescriptor } + .filter { it !is ExportedForwardDeclarationsPackageFragmentDescriptor && it !is ClassifierAliasingPackageFragmentDescriptor } .map { it.getMemberScope() } .filter { it != MemberScope.Empty } .toList(ownPackageFragments.size) diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/fqName.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/fqName.kt index 0bb6100c64a..05b3c364828 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/fqName.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/fqName.kt @@ -10,18 +10,17 @@ import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.serialization.konan.impl.ForwardDeclarationsFqNames internal val DEPRECATED_ANNOTATION_FQN: FqName = FqName(Deprecated::class.java.name).intern() internal val DEPRECATED_ANNOTATION_CID: ClassId = internedClassId(DEPRECATED_ANNOTATION_FQN) -internal val STANDARD_KOTLIN_PACKAGE_FQNS: List = listOf( - StandardNames.BUILT_INS_PACKAGE_FQ_NAME.intern(), - FqName("kotlinx").intern() +private val STANDARD_KOTLIN_PACKAGES = listOf( + StandardNames.BUILT_INS_PACKAGE_FQ_NAME.asString(), + "kotlinx" ) -private val STANDARD_KOTLIN_PACKAGES = STANDARD_KOTLIN_PACKAGE_FQNS.map { it.asString() } - private val KOTLIN_NATIVE_SYNTHETIC_PACKAGES = ForwardDeclarationsFqNames.syntheticPackages .map { fqName -> check(!fqName.isRoot) @@ -37,6 +36,9 @@ private val OBJC_INTEROP_CALLABLE_ANNOTATIONS = listOf( "ObjCFactory" ) +internal fun Name.strip(): String = + asString().removeSurrounding("<", ">") + internal val FqName.isUnderStandardKotlinPackages: Boolean get() = hasAnyPrefix(STANDARD_KOTLIN_PACKAGES) diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/moduleDescriptor.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/moduleDescriptor.kt index aea590684ca..2e1e7715b17 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/moduleDescriptor.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/moduleDescriptor.kt @@ -5,25 +5,20 @@ package org.jetbrains.kotlin.descriptors.commonizer.utils -import org.jetbrains.kotlin.backend.common.serialization.metadata.impl.ExportedForwardDeclarationsPackageFragmentDescriptor import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.builtins.konan.KonanBuiltIns -import org.jetbrains.kotlin.descriptors.ClassDescriptor -import org.jetbrains.kotlin.descriptors.ClassifierDescriptorWithTypeParameters -import org.jetbrains.kotlin.descriptors.ModuleDescriptor +import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl -import org.jetbrains.kotlin.descriptors.packageFragments import org.jetbrains.kotlin.incremental.components.NoLookupLocation import org.jetbrains.kotlin.konan.util.KlibMetadataFactories import org.jetbrains.kotlin.library.metadata.NativeTypeTransformer import org.jetbrains.kotlin.library.metadata.NullFlexibleTypeDeserializer import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.resolve.scopes.MemberScope import org.jetbrains.kotlin.serialization.konan.impl.KlibResolvedModuleDescriptorsFactoryImpl import org.jetbrains.kotlin.storage.StorageManager -internal val ModuleDescriptor.packageFragmentProvider +internal val ModuleDescriptor.packageFragmentProvider: PackageFragmentProvider get() = (this as ModuleDescriptorImpl).packageFragmentProviderForModuleContentWithoutDependencies internal fun createKotlinNativeForwardDeclarationsModule( @@ -42,73 +37,30 @@ internal fun ModuleDescriptor.resolveClassOrTypeAlias(classId: ClassId): Classif if (relativeClassName.isRoot) return null - var memberScope: MemberScope = getPackage(classId.packageFqName).memberScope + return packageFragmentProvider.packageFragments(classId.packageFqName).asSequence().mapNotNull { packageFragment -> + var memberScope = packageFragment.getMemberScope() - val classifierName = if ('.' in relativeClassName.asString()) { - // resolve member scope of the nested class - relativeClassName.pathSegments().reduce { first, second -> - memberScope = (memberScope.getContributedClassifier( - first, - NoLookupLocation.FOR_ALREADY_TRACKED - ) as? ClassDescriptor)?.unsubstitutedMemberScope ?: return null + val classifierName = if ('.' in relativeClassName.asString()) { + // resolve member scope of the nested class + relativeClassName.pathSegments().reduce { first, second -> + memberScope = (memberScope.getContributedClassifier( + first, + NoLookupLocation.FOR_ALREADY_TRACKED + ) as? ClassDescriptor)?.unsubstitutedMemberScope ?: return@mapNotNull null - second + second + } + } else { + relativeClassName.shortName() } - } else { - relativeClassName.shortName() - } - return memberScope.getContributedClassifier( - classifierName, - NoLookupLocation.FOR_ALREADY_TRACKED - ) as? ClassifierDescriptorWithTypeParameters + memberScope.getContributedClassifier( + classifierName, + NoLookupLocation.FOR_ALREADY_TRACKED + ) as? ClassifierDescriptorWithTypeParameters + }.firstOrNull() } -internal fun MutableMap.guessModuleByPackageFqName(packageFqName: FqName): ModuleDescriptor? { - if (isEmpty()) return null - - val packageFqNameRaw = packageFqName.asString() - if (containsKey(packageFqNameRaw)) { - return this[packageFqNameRaw] // might return null if this is a previously cached result - } - - fun guessByEnding(): ModuleDescriptor? { - return entries - .firstOrNull { (name, _) -> name.endsWith(packageFqNameRaw, ignoreCase = true) } - ?.value - } - - fun guessBySmartEnding(): ModuleDescriptor? { - val packageFqNameFragments = packageFqNameRaw.split('.') - if (packageFqNameFragments.size < 2) return null - - return entries.firstOrNull { (name, _) -> - var startIndex = 0 - for (fragment in packageFqNameFragments) { - val index = name.indexOf(fragment, startIndex = startIndex, ignoreCase = true) - if (index < startIndex) - return@firstOrNull false - else - startIndex = index + fragment.length - } - true - }?.value - } - - val candidate = guessByEnding() ?: guessBySmartEnding() - this[packageFqNameRaw] = candidate // cache to speed-up the further look-ups - return candidate -} - -internal val ModuleDescriptor.hasSomethingUnderStandardKotlinPackages: Boolean - get() { - val packageFragmentProvider = packageFragmentProvider - return STANDARD_KOTLIN_PACKAGE_FQNS.any { fqName -> - packageFragmentProvider.packageFragments(fqName).any { packageFragment -> - packageFragment !is ExportedForwardDeclarationsPackageFragmentDescriptor - && packageFragment.getMemberScope() != MemberScope.Empty - } - } - } +internal const val MODULE_NAME_PREFIX = "module:" internal val NativeFactories = KlibMetadataFactories(::KonanBuiltIns, NullFlexibleTypeDeserializer, NativeTypeTransformer()) diff --git a/native/commonizer/testData/classifierCommonization/typeAliases/commonized/linux/package_kotlinx_cinterop.kt b/native/commonizer/testData/classifierCommonization/typeAliases/commonized/linux/package_kotlinx_cinterop.kt deleted file mode 100644 index cf366643a8f..00000000000 --- a/native/commonizer/testData/classifierCommonization/typeAliases/commonized/linux/package_kotlinx_cinterop.kt +++ /dev/null @@ -1,12 +0,0 @@ -// this is to avoid missing Kotlin/Native stdlib -package kotlinx.cinterop - -// fake classes with the default constructor and no member scope -abstract class CStructVar -class CPointer -@Suppress("FINAL_UPPER_BOUND") class UByteVarOf -class UByte - -// fake typealiases -typealias CArrayPointer = CPointer -typealias UByteVar = UByteVarOf diff --git a/native/commonizer/testData/classifierCommonization/typeAliases/commonized/macos/package_kotlinx_cinterop.kt b/native/commonizer/testData/classifierCommonization/typeAliases/commonized/macos/package_kotlinx_cinterop.kt deleted file mode 100644 index cf366643a8f..00000000000 --- a/native/commonizer/testData/classifierCommonization/typeAliases/commonized/macos/package_kotlinx_cinterop.kt +++ /dev/null @@ -1,12 +0,0 @@ -// this is to avoid missing Kotlin/Native stdlib -package kotlinx.cinterop - -// fake classes with the default constructor and no member scope -abstract class CStructVar -class CPointer -@Suppress("FINAL_UPPER_BOUND") class UByteVarOf -class UByte - -// fake typealiases -typealias CArrayPointer = CPointer -typealias UByteVar = UByteVarOf diff --git a/native/commonizer/testData/classifierCommonization/typeAliases/commonized/common/package_kotlinx_cinterop.kt b/native/commonizer/testData/classifierCommonization/typeAliases/dependee/common/package_kotlinx_cinterop.kt similarity index 100% rename from native/commonizer/testData/classifierCommonization/typeAliases/commonized/common/package_kotlinx_cinterop.kt rename to native/commonizer/testData/classifierCommonization/typeAliases/dependee/common/package_kotlinx_cinterop.kt diff --git a/native/commonizer/testData/classifierCommonization/typeAliases/original/linux/package_kotlinx_cinterop.kt b/native/commonizer/testData/classifierCommonization/typeAliases/original/linux/package_kotlinx_cinterop.kt deleted file mode 100644 index cf366643a8f..00000000000 --- a/native/commonizer/testData/classifierCommonization/typeAliases/original/linux/package_kotlinx_cinterop.kt +++ /dev/null @@ -1,12 +0,0 @@ -// this is to avoid missing Kotlin/Native stdlib -package kotlinx.cinterop - -// fake classes with the default constructor and no member scope -abstract class CStructVar -class CPointer -@Suppress("FINAL_UPPER_BOUND") class UByteVarOf -class UByte - -// fake typealiases -typealias CArrayPointer = CPointer -typealias UByteVar = UByteVarOf diff --git a/native/commonizer/testData/classifierCommonization/typeAliases/original/macos/package_kotlinx_cinterop.kt b/native/commonizer/testData/classifierCommonization/typeAliases/original/macos/package_kotlinx_cinterop.kt deleted file mode 100644 index cf366643a8f..00000000000 --- a/native/commonizer/testData/classifierCommonization/typeAliases/original/macos/package_kotlinx_cinterop.kt +++ /dev/null @@ -1,12 +0,0 @@ -// this is to avoid missing Kotlin/Native stdlib -package kotlinx.cinterop - -// fake classes with the default constructor and no member scope -abstract class CStructVar -class CPointer -@Suppress("FINAL_UPPER_BOUND") class UByteVarOf -class UByte - -// fake typealiases -typealias CArrayPointer = CPointer -typealias UByteVar = UByteVarOf diff --git a/native/commonizer/testData/functionCommonization/valueParameters/commonized/macos/package_kotlinx_cinterop.kt b/native/commonizer/testData/functionCommonization/valueParameters/commonized/macos/package_kotlinx_cinterop.kt deleted file mode 100644 index fe5970a0bf4..00000000000 --- a/native/commonizer/testData/functionCommonization/valueParameters/commonized/macos/package_kotlinx_cinterop.kt +++ /dev/null @@ -1,6 +0,0 @@ -// this is to avoid missing Kotlin/Native stdlib -package kotlinx.cinterop - -@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER) -@Retention(AnnotationRetention.BINARY) -annotation class ObjCMethod() // fake annotation class without properties diff --git a/native/commonizer/testData/functionCommonization/valueParameters/commonized/ios/package_kotlinx_cinterop.kt b/native/commonizer/testData/functionCommonization/valueParameters/dependee/common/package_kotlinx_cinterop.kt similarity index 100% rename from native/commonizer/testData/functionCommonization/valueParameters/commonized/ios/package_kotlinx_cinterop.kt rename to native/commonizer/testData/functionCommonization/valueParameters/dependee/common/package_kotlinx_cinterop.kt diff --git a/native/commonizer/testData/functionCommonization/valueParameters/original/ios/package_kotlinx_cinterop.kt b/native/commonizer/testData/functionCommonization/valueParameters/original/ios/package_kotlinx_cinterop.kt deleted file mode 100644 index fe5970a0bf4..00000000000 --- a/native/commonizer/testData/functionCommonization/valueParameters/original/ios/package_kotlinx_cinterop.kt +++ /dev/null @@ -1,6 +0,0 @@ -// this is to avoid missing Kotlin/Native stdlib -package kotlinx.cinterop - -@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER) -@Retention(AnnotationRetention.BINARY) -annotation class ObjCMethod() // fake annotation class without properties diff --git a/native/commonizer/testData/functionCommonization/valueParameters/original/macos/package_kotlinx_cinterop.kt b/native/commonizer/testData/functionCommonization/valueParameters/original/macos/package_kotlinx_cinterop.kt deleted file mode 100644 index fe5970a0bf4..00000000000 --- a/native/commonizer/testData/functionCommonization/valueParameters/original/macos/package_kotlinx_cinterop.kt +++ /dev/null @@ -1,6 +0,0 @@ -// this is to avoid missing Kotlin/Native stdlib -package kotlinx.cinterop - -@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER) -@Retention(AnnotationRetention.BINARY) -annotation class ObjCMethod() // fake annotation class without properties diff --git a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/AbstractCommonizationFromSourcesTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/AbstractCommonizationFromSourcesTest.kt index 05993646fef..9f798a872ab 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/AbstractCommonizationFromSourcesTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/AbstractCommonizationFromSourcesTest.kt @@ -17,7 +17,7 @@ import org.jetbrains.kotlin.config.CommonConfigurationKeys import org.jetbrains.kotlin.config.CompilerConfiguration import org.jetbrains.kotlin.config.languageVersionSettings import org.jetbrains.kotlin.descriptors.* -import org.jetbrains.kotlin.descriptors.commonizer.SourceModuleRoot.Companion.COMMON_TARGET_NAME +import org.jetbrains.kotlin.descriptors.commonizer.SourceModuleRoot.Companion.SHARED_TARGET_NAME import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.ClassCollector import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.FunctionCollector import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.collectMembers @@ -30,10 +30,8 @@ import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl import org.jetbrains.kotlin.js.resolve.diagnostics.findPsi import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.platform.CommonPlatforms -import org.jetbrains.kotlin.platform.TargetPlatform import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.KtPsiFactory -import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices import org.jetbrains.kotlin.resolve.scopes.MemberScope import org.jetbrains.kotlin.test.KotlinTestUtils.* import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase @@ -70,10 +68,10 @@ abstract class AbstractCommonizationFromSourcesTest : KtUsefulTestCase() { val result: Result = runCommonization(analyzedModules.toCommonizationParameters()) assertCommonizationPerformed(result) - val sharedTarget: OutputTarget = analyzedModules.commonizedCommonModule.target + val sharedTarget: OutputTarget = analyzedModules.sharedTarget assertEquals(sharedTarget, result.sharedTarget) - val sharedModuleAsExpected: ModuleDescriptor = analyzedModules.commonizedCommonModule.module + val sharedModuleAsExpected: ModuleDescriptor = analyzedModules.commonizedModules.getValue(sharedTarget) val sharedModuleByCommonizer: ModuleDescriptor = (result.modulesByTargets.getValue(sharedTarget).single() as ModuleResult.Commonized).module @@ -81,11 +79,11 @@ abstract class AbstractCommonizationFromSourcesTest : KtUsefulTestCase() { assertValidModule(sharedModuleByCommonizer) assertModulesAreEqual(sharedModuleAsExpected, sharedModuleByCommonizer, "\"$sharedTarget\" target") - val leafTargets: Set = analyzedModules.commonizedPlatformModules.keys + val leafTargets: Set = analyzedModules.leafTargets assertEquals(leafTargets, result.leafTargets) for (leafTarget in leafTargets) { - val leafTargetModuleAsExpected: ModuleDescriptor = analyzedModules.commonizedPlatformModules.getValue(leafTarget).module + val leafTargetModuleAsExpected: ModuleDescriptor = analyzedModules.commonizedModules.getValue(leafTarget) val leafTargetModuleByCommonizer: ModuleDescriptor = (result.modulesByTargets.getValue(leafTarget).single() as ModuleResult.Commonized).module @@ -98,117 +96,196 @@ abstract class AbstractCommonizationFromSourcesTest : KtUsefulTestCase() { private data class SourceModuleRoot( val targetName: String, - val root: File + val location: File ) { init { - assertIsDirectory(root) + assertIsDirectory(location) } companion object { fun load(directory: File): SourceModuleRoot = SourceModuleRoot( targetName = directory.name, - root = directory + location = directory ) - const val COMMON_TARGET_NAME = "common" + const val SHARED_TARGET_NAME = "common" } } private class SourceModuleRoots( - val originalPlatformRoots: Map, - val commonizedPlatformRoots: Map, - val commonizedCommonRoot: SourceModuleRoot + val originalRoots: Map, + val commonizedRoots: Map, + val dependeeRoots: Map ) { + val leafTargets: Set = originalRoots.keys + val sharedTarget: OutputTarget + init { - check(originalPlatformRoots.isNotEmpty()) - check(COMMON_TARGET_NAME !in originalPlatformRoots) - check(originalPlatformRoots.keys == commonizedPlatformRoots.keys) - check(commonizedCommonRoot.targetName == COMMON_TARGET_NAME) + check(leafTargets.size >= 2) + check(leafTargets.none { it.name == SHARED_TARGET_NAME }) + + val sharedTargets = commonizedRoots.keys.filterIsInstance() + check(sharedTargets.size == 1) + + sharedTarget = sharedTargets.single() + check(sharedTarget.targets == leafTargets) + + val allTargets = leafTargets + sharedTarget + check(commonizedRoots.keys == allTargets) + check(allTargets.containsAll(dependeeRoots.keys)) } companion object { fun load(dataDir: File): SourceModuleRoots = try { - val originalRoots = listRoots(dataDir, ORIGINAL_ROOTS_DIR) - val commonizedRoots = listRoots(dataDir, COMMONIZED_ROOTS_DIR) + val originalRoots = listRoots(dataDir, ORIGINAL_ROOTS_DIR).mapKeys { InputTarget(it.key) } - SourceModuleRoots( - originalPlatformRoots = originalRoots, - commonizedPlatformRoots = commonizedRoots - COMMON_TARGET_NAME, - commonizedCommonRoot = commonizedRoots.getValue(COMMON_TARGET_NAME) - ) + val leafTargets = originalRoots.keys + val sharedTarget = OutputTarget(leafTargets) + + fun getTarget(targetName: String): Target = + if (targetName == SHARED_TARGET_NAME) sharedTarget else leafTargets.first { it.name == targetName } + + val commonizedRoots = listRoots(dataDir, COMMONIZED_ROOTS_DIR).mapKeys { getTarget(it.key) } + val dependeeRoots = listRoots(dataDir, DEPENDEE_ROOTS_DIR).mapKeys { getTarget(it.key) } + + SourceModuleRoots(originalRoots, commonizedRoots, dependeeRoots) } catch (e: Exception) { fail("Source module misconfiguration in $dataDir", cause = e) } private const val ORIGINAL_ROOTS_DIR = "original" private const val COMMONIZED_ROOTS_DIR = "commonized" + private const val DEPENDEE_ROOTS_DIR = "dependee" private fun listRoots(dataDir: File, rootsDirName: String): Map = dataDir.resolve(rootsDirName).listFiles()?.toSet().orEmpty().map(SourceModuleRoot::load).associateBy { it.targetName } } } -private class AnalyzedModule( - val target: T, - val module: ModuleDescriptor +private class AnalyzedModuleDependencies( + val regularDependencies: Map>, + val expectByDependencies: List ) { - companion object { - fun create( - target: T, - sourceModuleRoot: SourceModuleRoot, - commonSourceModuleRoot: SourceModuleRoot? = null, - parentDisposable: Disposable - ): AnalyzedModule { - val moduleName: String = sourceModuleRoot.root.parentFile.parentFile.name - check(Name.isValidIdentifier(moduleName)) + fun withExpectByDependency(dependency: ModuleDescriptor) = + AnalyzedModuleDependencies( + regularDependencies = regularDependencies, + expectByDependencies = expectByDependencies + dependency + ) - return AnalyzedModule( - target = target, - module = analyze( - moduleName = moduleName, - moduleRoot = sourceModuleRoot.root, - commonModuleRoot = commonSourceModuleRoot?.root, - parentDisposable = parentDisposable + companion object { + val EMPTY = AnalyzedModuleDependencies(emptyMap(), emptyList()) + + fun create(regularDependencies: Map, expectByDependencies: List) = + AnalyzedModuleDependencies(regularDependencies.mapValues { listOf(it.value) }, expectByDependencies) + } +} + +private class AnalyzedModules( + val originalModules: Map, + val commonizedModules: Map, + val dependeeModules: Map +) { + val leafTargets: Set + val sharedTarget: OutputTarget + + init { + originalModules.keys.let { targets -> + check(targets.isNotEmpty()) + + leafTargets = targets.filterIsInstance().toSet() + check(targets.size == leafTargets.size) + } + + sharedTarget = OutputTarget(leafTargets) + val allTargets = leafTargets + sharedTarget + + check(commonizedModules.keys == allTargets) + check(allTargets.containsAll(dependeeModules.keys)) + } + + fun toCommonizationParameters(): Parameters { + val parameters = Parameters() + + leafTargets.forEach { leafTarget -> + val originalModule = originalModules.getValue(leafTarget) + + parameters.addTarget( + TargetProvider( + target = leafTarget, + builtInsClass = originalModule.builtIns::class.java, + builtInsProvider = MockBuiltInsProvider(originalModule.builtIns), + modulesProvider = MockModulesProvider(originalModule), + dependeeModulesProvider = dependeeModules[leafTarget]?.let(::MockModulesProvider) ) ) } - private fun analyze( - moduleName: String, - moduleRoot: File, - commonModuleRoot: File?, - parentDisposable: Disposable - ): ModuleDescriptor { - val commonModule: ModuleDescriptor? = if (commonModuleRoot != null) { - analyzeModule( - moduleName = "common" + moduleName.capitalize(), - moduleRoot = commonModuleRoot, - dependencyContainer = null, // common module does not have any specific dependencies - parentDisposable = parentDisposable - ) - } else null + parameters.dependeeModulesProvider = dependeeModules[sharedTarget]?.let(::MockModulesProvider) - val module: ModuleDescriptor = analyzeModule( - moduleName = moduleName, - moduleRoot = moduleRoot, - dependencyContainer = commonModule?.let(::CommonizedCommonDependenciesContainer), // platform module has dependencies to common module - parentDisposable = parentDisposable + return parameters + } + + companion object { + fun create( + sourceModuleRoots: SourceModuleRoots, + parentDisposable: Disposable + ): AnalyzedModules = with(sourceModuleRoots) { + // first, build the modules that are are the dependencies for "original" and "commonized" modules + val dependeeModules = + createModules(sharedTarget, dependeeRoots, AnalyzedModuleDependencies.EMPTY, parentDisposable, isDependeeModule = true) + + val dependencies = AnalyzedModuleDependencies.create( + regularDependencies = dependeeModules, + expectByDependencies = listOfNotNull(dependeeModules[sharedTarget]) ) - if (commonModule != null) { - check(commonModule in module.expectedByModules) - check(commonModule in module.allDependencyModules) + // then, build "original" and "commonized" modules + val originalModules = createModules(sharedTarget, originalRoots, dependencies, parentDisposable) + val commonizedModules = createModules(sharedTarget, commonizedRoots, dependencies, parentDisposable) + + return AnalyzedModules(originalModules, commonizedModules, dependeeModules) + } + + private fun createModules( + sharedTarget: OutputTarget, + moduleRoots: Map, + dependencies: AnalyzedModuleDependencies, + parentDisposable: Disposable, + isDependeeModule: Boolean = false + ): Map { + val result = mutableMapOf() + + var dependenciesForOthers = dependencies + + // first, process the common module + moduleRoots[sharedTarget]?.let { moduleRoot -> + val commonModule = createModule(sharedTarget, sharedTarget, moduleRoot, dependencies, parentDisposable, isDependeeModule) + result[sharedTarget] = commonModule + dependenciesForOthers = dependencies.withExpectByDependency(commonModule) } - return module + // then, all platform modules + moduleRoots.filterKeys { it != sharedTarget }.forEach { (leafTarget, moduleRoot) -> + result[leafTarget] = + createModule(sharedTarget, leafTarget, moduleRoot, dependenciesForOthers, parentDisposable, isDependeeModule) + } + + return result } - private fun analyzeModule( - moduleName: String, - moduleRoot: File, - dependencyContainer: CommonDependenciesContainer?, - parentDisposable: Disposable + private fun createModule( + sharedTarget: OutputTarget, + currentTarget: Target, + moduleRoot: SourceModuleRoot, + dependencies: AnalyzedModuleDependencies, + parentDisposable: Disposable, + isDependeeModule: Boolean ): ModuleDescriptor { + val moduleName: String = moduleRoot.location.parentFile.parentFile.name.let { + if (isDependeeModule) "dependee-$it" else it + } + check(Name.isValidIdentifier(moduleName)) + val configuration: CompilerConfiguration = newConfiguration() configuration.put(CommonConfigurationKeys.MODULE_NAME, moduleName) @@ -220,7 +297,7 @@ private class AnalyzedModule( val psiFactory = KtPsiFactory(environment.project) - val psiFiles: List = moduleRoot.walkTopDown() + val psiFiles: List = moduleRoot.location.walkTopDown() .filter { it.isFile } .map { psiFactory.createFile(it.name, doLoadFile(it)) } .toList() @@ -231,105 +308,68 @@ private class AnalyzedModule( dependOnBuiltIns = true, languageVersionSettings = environment.configuration.languageVersionSettings, targetPlatform = CommonPlatforms.defaultCommonPlatform, - dependenciesContainer = dependencyContainer + dependenciesContainer = DependenciesContainerImpl(sharedTarget, currentTarget, dependencies) ) { content -> environment.createPackagePartProvider(content.moduleContentScope) }.moduleDescriptor - module.accept(PatchingTestDescriptorVisitor, Unit) + if (!isDependeeModule) + module.accept(PatchingTestDescriptorVisitor, Unit) return module } } } -private class AnalyzedModules( - val originalPlatformModules: Map>, - val commonizedPlatformModules: Map>, - val commonizedCommonModule: AnalyzedModule -) { +private class DependenciesContainerImpl( + sharedTarget: OutputTarget, + currentTarget: Target, + dependencies: AnalyzedModuleDependencies +) : CommonDependenciesContainer { + private val moduleInfoToModule = mutableMapOf() + private val expectByModuleInfos = mutableListOf() + private val regularModuleInfos = mutableListOf() + init { - check(originalPlatformModules.isNotEmpty()) - check(originalPlatformModules.keys == commonizedPlatformModules.keys) - } - - fun toCommonizationParameters(): Parameters { - val parameters = originalPlatformModules.mapValues { it.value.module }.toCommonizationParameters() - parameters.commonModulesProvider = MockModulesProvider(commonizedCommonModule.module) - return parameters - } - - companion object { - fun create( - sourceModuleRoots: SourceModuleRoots, - parentDisposable: Disposable - ): AnalyzedModules { - val originalPlatformModules: Map> = createInputTargetModules( - sourceModuleRoots = sourceModuleRoots.originalPlatformRoots, - parentDisposable = parentDisposable - ) - - val commonizedCommonModule: AnalyzedModule = AnalyzedModule.create( - target = OutputTarget(originalPlatformModules.keys), - sourceModuleRoot = sourceModuleRoots.commonizedCommonRoot, - parentDisposable = parentDisposable - ) - - val commonizedPlatformModules: Map> = createInputTargetModules( - sourceModuleRoots = sourceModuleRoots.commonizedPlatformRoots, - commonSourceModuleRoot = sourceModuleRoots.commonizedCommonRoot, - parentDisposable = parentDisposable - ) - - return AnalyzedModules( - originalPlatformModules = originalPlatformModules, - commonizedPlatformModules = commonizedPlatformModules, - commonizedCommonModule = commonizedCommonModule - ) + if (currentTarget != sharedTarget) { + dependencies.expectByDependencies.forEach { expectByDependency -> + val moduleInfo = ModuleInfoImpl(expectByDependency, emptyList()) + moduleInfoToModule[moduleInfo] = expectByDependency + expectByModuleInfos += moduleInfo + } } - private fun createInputTargetModules( - sourceModuleRoots: Map, - commonSourceModuleRoot: SourceModuleRoot? = null, - parentDisposable: Disposable - ): Map> = sourceModuleRoots.map { (targetName, sourceModuleRoot) -> - AnalyzedModule.create( - target = InputTarget(targetName), - sourceModuleRoot = sourceModuleRoot, - commonSourceModuleRoot = commonSourceModuleRoot, - parentDisposable = parentDisposable - ) - }.associateBy { it.target } - } -} + dependencies.regularDependencies[currentTarget]?.forEach { regularDependency -> + val moduleInfo = ModuleInfoImpl(regularDependency, expectByModuleInfos) + moduleInfoToModule[moduleInfo] = regularDependency + regularModuleInfos += moduleInfo + } -private class CommonizedCommonDependenciesContainer( - private val commonModule: ModuleDescriptor -) : CommonDependenciesContainer { - private val commonModuleInfo = object : ModuleInfo { - override val name: Name get() = commonModule.name - - override fun dependencies(): List = listOf(this) - override fun dependencyOnBuiltIns(): ModuleInfo.DependencyOnBuiltIns = ModuleInfo.DependencyOnBuiltIns.LAST - - override val platform: TargetPlatform get() = CommonPlatforms.defaultCommonPlatform - override val analyzerServices: PlatformDependentAnalyzerServices get() = CommonPlatformAnalyzerServices + regularModuleInfos += expectByModuleInfos } - override val moduleInfos: List get() = listOf(commonModuleInfo) + private inner class ModuleInfoImpl( + private val module: ModuleDescriptor, + private val regularDependencies: List + ) : ModuleInfo { + override val name get() = module.name - override fun moduleDescriptorForModuleInfo(moduleInfo: ModuleInfo): ModuleDescriptor { - if (moduleInfo !== commonModuleInfo) - error("Unknown module info $moduleInfo") + override fun dependencies() = listOf(this) + regularDependencies + override fun dependencyOnBuiltIns() = ModuleInfo.DependencyOnBuiltIns.LAST - return commonModule + override val platform get() = CommonPlatforms.defaultCommonPlatform + override val analyzerServices get() = CommonPlatformAnalyzerServices } + override val moduleInfos: List get() = regularModuleInfos + override val friendModuleInfos: List get() = emptyList() + override val refinesModuleInfos: List get() = expectByModuleInfos + + override fun moduleDescriptorForModuleInfo(moduleInfo: ModuleInfo) = + moduleInfoToModule[moduleInfo] ?: error("Unknown module info $moduleInfo") + override fun registerDependencyForAllModules(moduleInfo: ModuleInfo, descriptorForModule: ModuleDescriptorImpl) = Unit override fun packageFragmentProviderForModuleInfo(moduleInfo: ModuleInfo): PackageFragmentProvider? = null - - override val friendModuleInfos: List get() = emptyList() - override val refinesModuleInfos: List get() = listOf(commonModuleInfo) } private object PatchingTestDescriptorVisitor : DeclarationDescriptorVisitorEmptyBodies() { @@ -368,21 +408,3 @@ private object PatchingTestDescriptorVisitor : DeclarationDescriptorVisitorEmpty } } } - -private fun Map.toCommonizationParameters(): Parameters = Parameters().also { parameters -> - forEach { (target, moduleDescriptor) -> - if (!parameters.extendedLookupForBuiltInsClassifiers) { - if (moduleDescriptor.hasSomethingUnderStandardKotlinPackages) - parameters.extendedLookupForBuiltInsClassifiers = true - } - - parameters.addTarget( - TargetProvider( - target = target, - builtInsClass = moduleDescriptor.builtIns::class.java, - builtInsProvider = MockBuiltInsProvider(moduleDescriptor.builtIns), - modulesProvider = MockModulesProvider(moduleDescriptor) - ) - ) - } -} diff --git a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/CommonizerFacadeTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/CommonizerFacadeTest.kt index 8664742f33b..38fc7cfb952 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/CommonizerFacadeTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/CommonizerFacadeTest.kt @@ -67,7 +67,8 @@ class CommonizerFacadeTest { target = InputTarget(targetName), builtInsClass = DefaultBuiltIns::class.java, builtInsProvider = BuiltInsProvider.defaultBuiltInsProvider, - modulesProvider = MockModulesProvider(moduleNames) + modulesProvider = MockModulesProvider(moduleNames), + dependeeModulesProvider = null ) ) } diff --git a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/utils/mocks.kt b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/utils/mocks.kt index bd5826048e0..dd4ab4c6ca1 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/utils/mocks.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/utils/mocks.kt @@ -46,8 +46,7 @@ internal fun mockClassType( storageManager = LockBasedStorageManager.NO_LOCKS, target = InputTarget("Arbitrary target"), builtIns = DefaultBuiltIns.Instance, - lazyModulesLookupTable = LockBasedStorageManager.NO_LOCKS.createLazyValue { mutableMapOf() }, - isCommon = false, + lazyClassifierLookupTable = LockBasedStorageManager.NO_LOCKS.createLazyValue { LazyClassifierLookupTable(emptyMap()) }, index = 0, cache = DeclarationsBuilderCache(1) ) @@ -173,7 +172,7 @@ internal class MockModulesProvider : ModulesProvider { } override fun loadModuleInfos() = moduleInfos - override fun loadModules() = modules + override fun loadModules(dependencies: Collection): Map = modules private fun fakeModuleInfo(name: String) = ModuleInfo(name, File("/tmp/commonizer/mocks/$name"), null) } From dce3d4d1b71f3289342fb7b99e929c8961c16bfe Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov Date: Mon, 30 Nov 2020 22:25:22 +0300 Subject: [PATCH 414/698] [Commonizer] Rename InputTarget and OutputTarget Rename target classes to better reflect their meaning: - InputTarget -> LeafTarget - OutputTarget -> SharedTarget --- .../descriptors/commonizer/Parameters.kt | 2 +- .../kotlin/descriptors/commonizer/Result.kt | 4 +- .../kotlin/descriptors/commonizer/Target.kt | 6 +- .../descriptors/commonizer/TargetProvider.kt | 2 +- .../commonizer/cir/factory/CirRootFactory.kt | 4 +- .../commonizer/core/RootCommonizer.kt | 12 +- .../kotlin/descriptors/commonizer/facade.kt | 2 +- .../konan/NativeDistributionCommonizer.kt | 14 +-- .../commonizer/konan/NativeLibrary.kt | 4 +- .../commonizer/mergedtree/CirTreeMerger.kt | 4 +- .../AbstractCommonizationFromSourcesTest.kt | 30 ++--- .../commonizer/CommonizerFacadeTest.kt | 2 +- .../commonizer/core/RootCommonizerTest.kt | 116 +++++++++--------- .../descriptors/commonizer/utils/mocks.kt | 4 +- 14 files changed, 103 insertions(+), 103 deletions(-) diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Parameters.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Parameters.kt index e86707b0ff3..34fa2041177 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Parameters.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Parameters.kt @@ -12,7 +12,7 @@ class Parameters( val progressLogger: ((String) -> Unit)? = null ) { // use linked hash map to preserve order - private val _targetProviders = LinkedHashMap() + private val _targetProviders = LinkedHashMap() val targetProviders: List get() = _targetProviders.values.toList() diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Result.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Result.kt index c5889410fc7..eca9f21d63c 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Result.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Result.kt @@ -14,8 +14,8 @@ sealed class Result { class Commonized( val modulesByTargets: Map> ) : Result() { - val sharedTarget: OutputTarget by lazy { modulesByTargets.keys.filterIsInstance().single() } - val leafTargets: Set by lazy { modulesByTargets.keys.filterIsInstance().toSet() } + val sharedTarget: SharedTarget by lazy { modulesByTargets.keys.filterIsInstance().single() } + val leafTargets: Set by lazy { modulesByTargets.keys.filterIsInstance().toSet() } } } diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Target.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Target.kt index 26f11d536e4..05a520c711a 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Target.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Target.kt @@ -11,10 +11,10 @@ import org.jetbrains.kotlin.konan.target.KonanTarget // JVM, JS and concrete Kotlin/Native targets, e.g. macos_x64, ios_x64, linux_x64. sealed class Target -data class InputTarget(val name: String, val konanTarget: KonanTarget? = null) : Target() +data class LeafTarget(val name: String, val konanTarget: KonanTarget? = null) : Target() -data class OutputTarget(val targets: Set) : Target() { +data class SharedTarget(val targets: Set) : Target() { init { require(targets.isNotEmpty()) } -} +} \ No newline at end of file diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/TargetProvider.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/TargetProvider.kt index d2969f68ac0..fc16cc90f75 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/TargetProvider.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/TargetProvider.kt @@ -11,7 +11,7 @@ import org.jetbrains.kotlin.descriptors.ModuleDescriptor import java.io.File class TargetProvider( - val target: InputTarget, + val target: LeafTarget, val builtInsClass: Class, val builtInsProvider: BuiltInsProvider, val modulesProvider: ModulesProvider, diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirRootFactory.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirRootFactory.kt index 86359646495..2aa6c5bd62a 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirRootFactory.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirRootFactory.kt @@ -7,7 +7,7 @@ package org.jetbrains.kotlin.descriptors.commonizer.cir.factory import org.jetbrains.kotlin.builtins.konan.KonanBuiltIns import org.jetbrains.kotlin.descriptors.commonizer.BuiltInsProvider -import org.jetbrains.kotlin.descriptors.commonizer.InputTarget +import org.jetbrains.kotlin.descriptors.commonizer.LeafTarget import org.jetbrains.kotlin.descriptors.commonizer.Target import org.jetbrains.kotlin.descriptors.commonizer.cir.CirRoot import org.jetbrains.kotlin.descriptors.commonizer.cir.impl.CirRootImpl @@ -18,7 +18,7 @@ object CirRootFactory { builtInsClass: String, builtInsProvider: BuiltInsProvider ): CirRoot { - if (target is InputTarget) { + if (target is LeafTarget) { check((target.konanTarget != null) == (builtInsClass == KonanBuiltIns::class.java.name)) } diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/RootCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/RootCommonizer.kt index c1fd7285eac..8c86b1104d9 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/RootCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/RootCommonizer.kt @@ -8,28 +8,28 @@ package org.jetbrains.kotlin.descriptors.commonizer.core import org.jetbrains.kotlin.builtins.DefaultBuiltIns import org.jetbrains.kotlin.builtins.konan.KonanBuiltIns import org.jetbrains.kotlin.descriptors.commonizer.BuiltInsProvider -import org.jetbrains.kotlin.descriptors.commonizer.InputTarget -import org.jetbrains.kotlin.descriptors.commonizer.OutputTarget +import org.jetbrains.kotlin.descriptors.commonizer.LeafTarget +import org.jetbrains.kotlin.descriptors.commonizer.SharedTarget import org.jetbrains.kotlin.descriptors.commonizer.cir.CirRoot import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirRootFactory class RootCommonizer : AbstractStandardCommonizer() { - private val inputTargets = mutableSetOf() + private val leafTargets = mutableSetOf() private var konanBuiltInsProvider: BuiltInsProvider? = null override fun commonizationResult() = CirRootFactory.create( - target = OutputTarget(inputTargets), + target = SharedTarget(leafTargets), builtInsClass = if (konanBuiltInsProvider != null) KonanBuiltIns::class.java.name else DefaultBuiltIns::class.java.name, builtInsProvider = konanBuiltInsProvider ?: BuiltInsProvider.defaultBuiltInsProvider ) override fun initialize(first: CirRoot) { - inputTargets += first.target as InputTarget + leafTargets += first.target as LeafTarget konanBuiltInsProvider = first.konanBuiltInsProvider } override fun doCommonizeWith(next: CirRoot): Boolean { - inputTargets += next.target as InputTarget + leafTargets += next.target as LeafTarget // keep the first met KonanBuiltIns when all targets are Kotlin/Native // otherwise use DefaultBuiltIns diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/facade.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/facade.kt index 55ae51748da..f65c1876028 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/facade.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/facade.kt @@ -40,7 +40,7 @@ fun runCommonization(parameters: Parameters): Result { val commonizedModules: List = components.cache.getAllModules(component.index).map(ModuleResult::Commonized) - val absentModules: List = if (target is InputTarget) + val absentModules: List = if (target is LeafTarget) mergeResult.absentModuleInfos.getValue(target).map { ModuleResult.Absent(it.originalLocation) } else emptyList() diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionCommonizer.kt index 992eb4e6d4a..7e9785d6c6e 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionCommonizer.kt @@ -91,7 +91,7 @@ class NativeDistributionCommonizer( val stdlib = NativeLibrary(loadLibrary(stdlibPath)) val librariesByTargets = targets.associate { target -> - val leafTarget = InputTarget(target.name, target) + val leafTarget = LeafTarget(target.name, target) val platformLibs = leafTarget.platformLibrariesSource .takeIf { it.isDirectory } @@ -213,11 +213,11 @@ class NativeDistributionCommonizer( val manifestProvider: NativeManifestDataProvider val starredTarget: String? when (target) { - is InputTarget -> { + is LeafTarget -> { manifestProvider = originalLibraries.librariesByTargets.getValue(target) starredTarget = target.name } - is OutputTarget -> { + is SharedTarget -> { manifestProvider = CommonNativeManifestDataProvider(originalLibraries.librariesByTargets.values) starredTarget = null } @@ -255,7 +255,7 @@ class NativeDistributionCommonizer( } } - private fun copyTargetAsIs(leafTarget: InputTarget, librariesCount: Int) { + private fun copyTargetAsIs(leafTarget: LeafTarget, librariesCount: Int) { val librariesDestination = leafTarget.librariesDestination librariesDestination.mkdirs() // always create an empty directory even if there is nothing to copy @@ -318,15 +318,15 @@ class NativeDistributionCommonizer( library.commit() } - private val InputTarget.platformLibrariesSource: File + private val LeafTarget.platformLibrariesSource: File get() = repository.resolve(KONAN_DISTRIBUTION_KLIB_DIR) .resolve(KONAN_DISTRIBUTION_PLATFORM_LIBS_DIR) .resolve(name) private val Target.librariesDestination: File get() = when (this) { - is InputTarget -> destination.resolve(KONAN_DISTRIBUTION_PLATFORM_LIBS_DIR).resolve(name) - is OutputTarget -> destination.resolve(KONAN_DISTRIBUTION_COMMON_LIBS_DIR) + is LeafTarget -> destination.resolve(KONAN_DISTRIBUTION_PLATFORM_LIBS_DIR).resolve(name) + is SharedTarget -> destination.resolve(KONAN_DISTRIBUTION_COMMON_LIBS_DIR) } private companion object { diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeLibrary.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeLibrary.kt index e9587a195d4..557274101b2 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeLibrary.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeLibrary.kt @@ -6,7 +6,7 @@ package org.jetbrains.kotlin.descriptors.commonizer.konan import gnu.trove.THashMap -import org.jetbrains.kotlin.descriptors.commonizer.InputTarget +import org.jetbrains.kotlin.descriptors.commonizer.LeafTarget import org.jetbrains.kotlin.library.KotlinLibrary internal interface NativeManifestDataProvider { @@ -37,7 +37,7 @@ internal class NativeLibrariesToCommonize(val libraries: List) : internal class AllNativeLibraries( val stdlib: NativeLibrary, - val librariesByTargets: Map + val librariesByTargets: Map ) internal class CommonNativeManifestDataProvider( diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirTreeMerger.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirTreeMerger.kt index 4ddb14e5bde..fc244b8ec1f 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirTreeMerger.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirTreeMerger.kt @@ -6,7 +6,7 @@ package org.jetbrains.kotlin.descriptors.commonizer.mergedtree import org.jetbrains.kotlin.descriptors.* -import org.jetbrains.kotlin.descriptors.commonizer.InputTarget +import org.jetbrains.kotlin.descriptors.commonizer.LeafTarget import org.jetbrains.kotlin.descriptors.commonizer.ModulesProvider.ModuleInfo import org.jetbrains.kotlin.descriptors.commonizer.Parameters import org.jetbrains.kotlin.descriptors.commonizer.TargetProvider @@ -53,7 +53,7 @@ class CirTreeMerger( ) { class CirTreeMergeResult( val root: CirRootNode, - val absentModuleInfos: Map> + val absentModuleInfos: Map> ) private val size = parameters.targetProviders.size diff --git a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/AbstractCommonizationFromSourcesTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/AbstractCommonizationFromSourcesTest.kt index 9f798a872ab..ed998be02a7 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/AbstractCommonizationFromSourcesTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/AbstractCommonizationFromSourcesTest.kt @@ -68,7 +68,7 @@ abstract class AbstractCommonizationFromSourcesTest : KtUsefulTestCase() { val result: Result = runCommonization(analyzedModules.toCommonizationParameters()) assertCommonizationPerformed(result) - val sharedTarget: OutputTarget = analyzedModules.sharedTarget + val sharedTarget: SharedTarget = analyzedModules.sharedTarget assertEquals(sharedTarget, result.sharedTarget) val sharedModuleAsExpected: ModuleDescriptor = analyzedModules.commonizedModules.getValue(sharedTarget) @@ -79,7 +79,7 @@ abstract class AbstractCommonizationFromSourcesTest : KtUsefulTestCase() { assertValidModule(sharedModuleByCommonizer) assertModulesAreEqual(sharedModuleAsExpected, sharedModuleByCommonizer, "\"$sharedTarget\" target") - val leafTargets: Set = analyzedModules.leafTargets + val leafTargets: Set = analyzedModules.leafTargets assertEquals(leafTargets, result.leafTargets) for (leafTarget in leafTargets) { @@ -113,18 +113,18 @@ private data class SourceModuleRoot( } private class SourceModuleRoots( - val originalRoots: Map, + val originalRoots: Map, val commonizedRoots: Map, val dependeeRoots: Map ) { - val leafTargets: Set = originalRoots.keys - val sharedTarget: OutputTarget + val leafTargets: Set = originalRoots.keys + val sharedTarget: SharedTarget init { check(leafTargets.size >= 2) check(leafTargets.none { it.name == SHARED_TARGET_NAME }) - val sharedTargets = commonizedRoots.keys.filterIsInstance() + val sharedTargets = commonizedRoots.keys.filterIsInstance() check(sharedTargets.size == 1) sharedTarget = sharedTargets.single() @@ -137,10 +137,10 @@ private class SourceModuleRoots( companion object { fun load(dataDir: File): SourceModuleRoots = try { - val originalRoots = listRoots(dataDir, ORIGINAL_ROOTS_DIR).mapKeys { InputTarget(it.key) } + val originalRoots = listRoots(dataDir, ORIGINAL_ROOTS_DIR).mapKeys { LeafTarget(it.key) } val leafTargets = originalRoots.keys - val sharedTarget = OutputTarget(leafTargets) + val sharedTarget = SharedTarget(leafTargets) fun getTarget(targetName: String): Target = if (targetName == SHARED_TARGET_NAME) sharedTarget else leafTargets.first { it.name == targetName } @@ -185,18 +185,18 @@ private class AnalyzedModules( val commonizedModules: Map, val dependeeModules: Map ) { - val leafTargets: Set - val sharedTarget: OutputTarget + val leafTargets: Set + val sharedTarget: SharedTarget init { originalModules.keys.let { targets -> check(targets.isNotEmpty()) - leafTargets = targets.filterIsInstance().toSet() + leafTargets = targets.filterIsInstance().toSet() check(targets.size == leafTargets.size) } - sharedTarget = OutputTarget(leafTargets) + sharedTarget = SharedTarget(leafTargets) val allTargets = leafTargets + sharedTarget check(commonizedModules.keys == allTargets) @@ -247,7 +247,7 @@ private class AnalyzedModules( } private fun createModules( - sharedTarget: OutputTarget, + sharedTarget: SharedTarget, moduleRoots: Map, dependencies: AnalyzedModuleDependencies, parentDisposable: Disposable, @@ -274,7 +274,7 @@ private class AnalyzedModules( } private fun createModule( - sharedTarget: OutputTarget, + sharedTarget: SharedTarget, currentTarget: Target, moduleRoot: SourceModuleRoot, dependencies: AnalyzedModuleDependencies, @@ -322,7 +322,7 @@ private class AnalyzedModules( } private class DependenciesContainerImpl( - sharedTarget: OutputTarget, + sharedTarget: SharedTarget, currentTarget: Target, dependencies: AnalyzedModuleDependencies ) : CommonDependenciesContainer { diff --git a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/CommonizerFacadeTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/CommonizerFacadeTest.kt index 38fc7cfb952..b8471e92d08 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/CommonizerFacadeTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/CommonizerFacadeTest.kt @@ -64,7 +64,7 @@ class CommonizerFacadeTest { forEach { (targetName, moduleNames) -> it.addTarget( TargetProvider( - target = InputTarget(targetName), + target = LeafTarget(targetName), builtInsClass = DefaultBuiltIns::class.java, builtInsProvider = BuiltInsProvider.defaultBuiltInsProvider, modulesProvider = MockModulesProvider(moduleNames), diff --git a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/RootCommonizerTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/RootCommonizerTest.kt index 839294ae086..0ee1cdc05fd 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/RootCommonizerTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/RootCommonizerTest.kt @@ -9,8 +9,8 @@ import org.jetbrains.kotlin.builtins.DefaultBuiltIns import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.builtins.jvm.JvmBuiltIns import org.jetbrains.kotlin.builtins.konan.KonanBuiltIns -import org.jetbrains.kotlin.descriptors.commonizer.InputTarget -import org.jetbrains.kotlin.descriptors.commonizer.OutputTarget +import org.jetbrains.kotlin.descriptors.commonizer.LeafTarget +import org.jetbrains.kotlin.descriptors.commonizer.SharedTarget import org.jetbrains.kotlin.descriptors.commonizer.Target import org.jetbrains.kotlin.descriptors.commonizer.cir.CirRoot import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirRootFactory @@ -24,129 +24,129 @@ class RootCommonizerTest : AbstractCommonizerTest() { @Test fun allAreNative() = doTestSuccess( expected = KONAN_BUILT_INS.toMock( - OutputTarget( + SharedTarget( setOf( - InputTarget("ios_x64", KonanTarget.IOS_X64), - InputTarget("ios_arm64", KonanTarget.IOS_ARM64), - InputTarget("ios_arm32", KonanTarget.IOS_ARM32) + LeafTarget("ios_x64", KonanTarget.IOS_X64), + LeafTarget("ios_arm64", KonanTarget.IOS_ARM64), + LeafTarget("ios_arm32", KonanTarget.IOS_ARM32) ) ) ), - KONAN_BUILT_INS.toMock(InputTarget("ios_x64", KonanTarget.IOS_X64)), - KONAN_BUILT_INS.toMock(InputTarget("ios_arm64", KonanTarget.IOS_ARM64)), - KONAN_BUILT_INS.toMock(InputTarget("ios_arm32", KonanTarget.IOS_ARM32)) + KONAN_BUILT_INS.toMock(LeafTarget("ios_x64", KonanTarget.IOS_X64)), + KONAN_BUILT_INS.toMock(LeafTarget("ios_arm64", KonanTarget.IOS_ARM64)), + KONAN_BUILT_INS.toMock(LeafTarget("ios_arm32", KonanTarget.IOS_ARM32)) ) @Test fun jvmAndNative1() = doTestSuccess( expected = DEFAULT_BUILT_INS.toMock( - OutputTarget( + SharedTarget( setOf( - InputTarget("jvm1"), - InputTarget("ios_x64", KonanTarget.IOS_X64), - InputTarget("jvm2") + LeafTarget("jvm1"), + LeafTarget("ios_x64", KonanTarget.IOS_X64), + LeafTarget("jvm2") ) ) ), - JVM_BUILT_INS.toMock(InputTarget("jvm1")), - KONAN_BUILT_INS.toMock(InputTarget("ios_x64", KonanTarget.IOS_X64)), - JVM_BUILT_INS.toMock(InputTarget("jvm2")) + JVM_BUILT_INS.toMock(LeafTarget("jvm1")), + KONAN_BUILT_INS.toMock(LeafTarget("ios_x64", KonanTarget.IOS_X64)), + JVM_BUILT_INS.toMock(LeafTarget("jvm2")) ) @Test fun jvmAndNative2() = doTestSuccess( expected = DEFAULT_BUILT_INS.toMock( - OutputTarget( + SharedTarget( setOf( - InputTarget("ios_x64", KonanTarget.IOS_X64), - InputTarget("jvm"), - InputTarget("ios_arm64", KonanTarget.IOS_ARM64) + LeafTarget("ios_x64", KonanTarget.IOS_X64), + LeafTarget("jvm"), + LeafTarget("ios_arm64", KonanTarget.IOS_ARM64) ) ) ), - KONAN_BUILT_INS.toMock(InputTarget("ios_x64", KonanTarget.IOS_X64)), - JVM_BUILT_INS.toMock(InputTarget("jvm")), - KONAN_BUILT_INS.toMock(InputTarget("ios_arm64", KonanTarget.IOS_ARM64)) + KONAN_BUILT_INS.toMock(LeafTarget("ios_x64", KonanTarget.IOS_X64)), + JVM_BUILT_INS.toMock(LeafTarget("jvm")), + KONAN_BUILT_INS.toMock(LeafTarget("ios_arm64", KonanTarget.IOS_ARM64)) ) @Test fun noNative1() = doTestSuccess( expected = DEFAULT_BUILT_INS.toMock( - OutputTarget( + SharedTarget( setOf( - InputTarget("default1"), - InputTarget("default2"), - InputTarget("default3") + LeafTarget("default1"), + LeafTarget("default2"), + LeafTarget("default3") ) ) ), - DEFAULT_BUILT_INS.toMock(InputTarget("default1")), - DEFAULT_BUILT_INS.toMock(InputTarget("default2")), - DEFAULT_BUILT_INS.toMock(InputTarget("default3")) + DEFAULT_BUILT_INS.toMock(LeafTarget("default1")), + DEFAULT_BUILT_INS.toMock(LeafTarget("default2")), + DEFAULT_BUILT_INS.toMock(LeafTarget("default3")) ) @Test fun noNative2() = doTestSuccess( expected = DEFAULT_BUILT_INS.toMock( - OutputTarget( + SharedTarget( setOf( - InputTarget("jvm1"), - InputTarget("default"), - InputTarget("jvm2") + LeafTarget("jvm1"), + LeafTarget("default"), + LeafTarget("jvm2") ) ) ), - JVM_BUILT_INS.toMock(InputTarget("jvm1")), - DEFAULT_BUILT_INS.toMock(InputTarget("default")), - JVM_BUILT_INS.toMock(InputTarget("jvm2")) + JVM_BUILT_INS.toMock(LeafTarget("jvm1")), + DEFAULT_BUILT_INS.toMock(LeafTarget("default")), + JVM_BUILT_INS.toMock(LeafTarget("jvm2")) ) @Test fun noNative3() = doTestSuccess( expected = DEFAULT_BUILT_INS.toMock( - OutputTarget( + SharedTarget( setOf( - InputTarget("jvm1"), - InputTarget("jvm2"), - InputTarget("jvm3") + LeafTarget("jvm1"), + LeafTarget("jvm2"), + LeafTarget("jvm3") ) ) ), - JVM_BUILT_INS.toMock(InputTarget("jvm1")), - JVM_BUILT_INS.toMock(InputTarget("jvm2")), - JVM_BUILT_INS.toMock(InputTarget("jvm3")) + JVM_BUILT_INS.toMock(LeafTarget("jvm1")), + JVM_BUILT_INS.toMock(LeafTarget("jvm2")), + JVM_BUILT_INS.toMock(LeafTarget("jvm3")) ) @Test(expected = IllegalStateException::class) fun misconfiguration1() = doTestSuccess( expected = KONAN_BUILT_INS.toMock( - OutputTarget( + SharedTarget( setOf( - InputTarget("ios_x64", KonanTarget.IOS_X64), - InputTarget("ios_arm64", KonanTarget.IOS_ARM64), - InputTarget("ios_arm32", KonanTarget.IOS_ARM32) + LeafTarget("ios_x64", KonanTarget.IOS_X64), + LeafTarget("ios_arm64", KonanTarget.IOS_ARM64), + LeafTarget("ios_arm32", KonanTarget.IOS_ARM32) ) ) ), - KONAN_BUILT_INS.toMock(InputTarget("ios_x64")), - KONAN_BUILT_INS.toMock(InputTarget("ios_arm64", KonanTarget.IOS_ARM64)), - KONAN_BUILT_INS.toMock(InputTarget("ios_arm32", KonanTarget.IOS_ARM32)) + KONAN_BUILT_INS.toMock(LeafTarget("ios_x64")), + KONAN_BUILT_INS.toMock(LeafTarget("ios_arm64", KonanTarget.IOS_ARM64)), + KONAN_BUILT_INS.toMock(LeafTarget("ios_arm32", KonanTarget.IOS_ARM32)) ) @Test(expected = IllegalStateException::class) fun misconfiguration2() = doTestSuccess( expected = DEFAULT_BUILT_INS.toMock( - OutputTarget( + SharedTarget( setOf( - InputTarget("jvm1"), - InputTarget("jvm2"), - InputTarget("jvm3") + LeafTarget("jvm1"), + LeafTarget("jvm2"), + LeafTarget("jvm3") ) ) ), - JVM_BUILT_INS.toMock(InputTarget("jvm1", KonanTarget.IOS_X64)), - JVM_BUILT_INS.toMock(InputTarget("jvm2")), - JVM_BUILT_INS.toMock(InputTarget("jvm3")) + JVM_BUILT_INS.toMock(LeafTarget("jvm1", KonanTarget.IOS_X64)), + JVM_BUILT_INS.toMock(LeafTarget("jvm2")), + JVM_BUILT_INS.toMock(LeafTarget("jvm3")) ) override fun createCommonizer() = RootCommonizer() diff --git a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/utils/mocks.kt b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/utils/mocks.kt index dd4ab4c6ca1..ca659851ad6 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/utils/mocks.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/utils/mocks.kt @@ -10,7 +10,7 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.annotations.Annotations import org.jetbrains.kotlin.descriptors.commonizer.BuiltInsProvider -import org.jetbrains.kotlin.descriptors.commonizer.InputTarget +import org.jetbrains.kotlin.descriptors.commonizer.LeafTarget import org.jetbrains.kotlin.descriptors.commonizer.ModulesProvider import org.jetbrains.kotlin.descriptors.commonizer.ModulesProvider.ModuleInfo import org.jetbrains.kotlin.descriptors.commonizer.builder.* @@ -44,7 +44,7 @@ internal fun mockClassType( val targetComponents = TargetDeclarationsBuilderComponents( storageManager = LockBasedStorageManager.NO_LOCKS, - target = InputTarget("Arbitrary target"), + target = LeafTarget("Arbitrary target"), builtIns = DefaultBuiltIns.Instance, lazyClassifierLookupTable = LockBasedStorageManager.NO_LOCKS.createLazyValue { LazyClassifierLookupTable(emptyMap()) }, index = 0, From 68f8e88d8b5aaff233d9b7c5562e0b8697874944 Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov Date: Mon, 30 Nov 2020 23:48:15 +0300 Subject: [PATCH 415/698] [Commonizer] Introduce various types of classifier caches - New CirCommonizedClassifiers and CirForwardDeclarations caches - New CirProvidedClassifiers cache with classifier names loaded from arbitrary modules - CirClassifiersCache is replaced by CirKnownClassifiers umbrella - Replace the remaining usages of 'isUnderStandardKotlinPackages' by delegation to CirKnownClassifiers.commonDependeeLibraries --- .../descriptors/commonizer/Parameters.kt | 1 + .../AbstractFunctionOrPropertyCommonizer.kt | 10 +- .../core/CallableValueParametersCommonizer.kt | 6 +- .../commonizer/core/ClassCommonizer.kt | 6 +- .../core/ClassConstructorCommonizer.kt | 10 +- .../commonizer/core/CommonizationVisitor.kt | 13 +- .../core/ExtensionReceiverCommonizer.kt | 6 +- .../commonizer/core/FunctionCommonizer.kt | 6 +- .../commonizer/core/PropertyCommonizer.kt | 4 +- .../commonizer/core/TypeAliasCommonizer.kt | 25 ++-- .../commonizer/core/TypeCommonizer.kt | 67 +++++---- .../core/TypeParameterCommonizer.kt | 10 +- .../core/TypeParameterListCommonizer.kt | 6 +- .../core/ValueParameterCommonizer.kt | 6 +- .../core/ValueParameterListCommonizer.kt | 6 +- .../kotlin/descriptors/commonizer/facade.kt | 35 +++-- .../mergedtree/CirClassifiersCache.kt | 128 ++++++++++++++---- .../commonizer/mergedtree/CirTreeMerger.kt | 14 +- .../commonizer/mergedtree/collectors.kt | 14 +- .../commonizer/mergedtree/nodeBuilders.kt | 24 ++-- .../descriptors/commonizer/utils/constants.kt | 2 - .../descriptors/commonizer/utils/misc.kt | 6 - .../commonizer/utils/moduleDescriptor.kt | 47 ++++--- .../AbstractCommonizationFromSourcesTest.kt | 45 +++--- .../commonizer/CommonizerFacadeTest.kt | 2 +- .../core/ExtensionReceiverCommonizerTest.kt | 4 +- .../commonizer/core/TypeCommonizerTest.kt | 42 ++++-- .../core/TypeParameterCommonizerTest.kt | 4 +- .../core/TypeParameterListCommonizerTest.kt | 4 +- .../core/ValueParameterCommonizerTest.kt | 14 +- .../core/ValueParameterListCommonizerTest.kt | 6 +- .../descriptors/commonizer/utils/mocks.kt | 100 ++++++++------ 32 files changed, 407 insertions(+), 266 deletions(-) diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Parameters.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Parameters.kt index 34fa2041177..c31c8fc5ef4 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Parameters.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Parameters.kt @@ -15,6 +15,7 @@ class Parameters( private val _targetProviders = LinkedHashMap() val targetProviders: List get() = _targetProviders.values.toList() + val sharedTarget: SharedTarget get() = SharedTarget(_targetProviders.keys) // common module dependencies (ex: Kotlin stdlib) var dependeeModulesProvider: ModulesProvider? = null diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/AbstractFunctionOrPropertyCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/AbstractFunctionOrPropertyCommonizer.kt index 818b66989a3..659ddb0d7f6 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/AbstractFunctionOrPropertyCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/AbstractFunctionOrPropertyCommonizer.kt @@ -9,19 +9,19 @@ import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.DELEGATION import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.SYNTHESIZED import org.jetbrains.kotlin.descriptors.commonizer.cir.CirFunctionOrProperty -import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirClassifiersCache +import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirKnownClassifiers import org.jetbrains.kotlin.name.Name abstract class AbstractFunctionOrPropertyCommonizer( - cache: CirClassifiersCache + classifiers: CirKnownClassifiers ) : AbstractStandardCommonizer() { protected lateinit var name: Name protected val modality = ModalityCommonizer() protected val visibility = VisibilityCommonizer.lowering() - protected val extensionReceiver = ExtensionReceiverCommonizer(cache) - protected val returnType = TypeCommonizer(cache) + protected val extensionReceiver = ExtensionReceiverCommonizer(classifiers) + protected val returnType = TypeCommonizer(classifiers) protected lateinit var kind: CallableMemberDescriptor.Kind - protected val typeParameters = TypeParameterListCommonizer(cache) + protected val typeParameters = TypeParameterListCommonizer(classifiers) override fun initialize(first: T) { name = first.name diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/CallableValueParametersCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/CallableValueParametersCommonizer.kt index f172172befe..a33598b081d 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/CallableValueParametersCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/CallableValueParametersCommonizer.kt @@ -12,14 +12,14 @@ import org.jetbrains.kotlin.descriptors.commonizer.cir.CirValueParameter import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirValueParameterFactory import org.jetbrains.kotlin.descriptors.commonizer.core.CallableValueParametersCommonizer.CallableToPatch.Companion.doNothing import org.jetbrains.kotlin.descriptors.commonizer.core.CallableValueParametersCommonizer.CallableToPatch.Companion.patchCallables -import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirClassifiersCache +import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirKnownClassifiers import org.jetbrains.kotlin.descriptors.commonizer.utils.compactMapIndexed import org.jetbrains.kotlin.descriptors.commonizer.utils.intern import org.jetbrains.kotlin.descriptors.commonizer.utils.isObjCInteropCallableAnnotation import org.jetbrains.kotlin.name.Name class CallableValueParametersCommonizer( - cache: CirClassifiersCache + classifiers: CirKnownClassifiers ) : Commonizer { class Result( val hasStableParameterNames: Boolean, @@ -118,7 +118,7 @@ class CallableValueParametersCommonizer( } } - private val valueParameters = ValueParameterListCommonizer(cache) + private val valueParameters = ValueParameterListCommonizer(classifiers) private val callables: MutableList = mutableListOf() private var hasStableParameterNames = true private var valueParameterNames: ValueParameterNames? = null diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/ClassCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/ClassCommonizer.kt index 2030d50752f..577e4a8e8b8 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/ClassCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/ClassCommonizer.kt @@ -8,13 +8,13 @@ package org.jetbrains.kotlin.descriptors.commonizer.core import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.descriptors.commonizer.cir.CirClass import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirClassFactory -import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirClassifiersCache +import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirKnownClassifiers import org.jetbrains.kotlin.name.Name -class ClassCommonizer(cache: CirClassifiersCache) : AbstractStandardCommonizer() { +class ClassCommonizer(classifiers: CirKnownClassifiers) : AbstractStandardCommonizer() { private lateinit var name: Name private lateinit var kind: ClassKind - private val typeParameters = TypeParameterListCommonizer(cache) + private val typeParameters = TypeParameterListCommonizer(classifiers) private val modality = ModalityCommonizer() private val visibility = VisibilityCommonizer.equalizing() private var isInner = false diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/ClassConstructorCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/ClassConstructorCommonizer.kt index 7b1f595e4c0..b1b42efa23c 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/ClassConstructorCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/ClassConstructorCommonizer.kt @@ -9,13 +9,15 @@ import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.descriptors.commonizer.cir.CirClassConstructor import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirClassConstructorFactory import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirContainingClassDetailsFactory -import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirClassifiersCache +import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirKnownClassifiers -class ClassConstructorCommonizer(cache: CirClassifiersCache) : AbstractStandardCommonizer() { +class ClassConstructorCommonizer( + classifiers: CirKnownClassifiers +) : AbstractStandardCommonizer() { private var isPrimary = false private val visibility = VisibilityCommonizer.equalizing() - private val typeParameters = TypeParameterListCommonizer(cache) - private val valueParameters = CallableValueParametersCommonizer(cache) + private val typeParameters = TypeParameterListCommonizer(classifiers) + private val valueParameters = CallableValueParametersCommonizer(classifiers) override fun commonizationResult(): CirClassConstructor { val valueParameters = valueParameters.result diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/CommonizationVisitor.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/CommonizationVisitor.kt index ba95c068dd1..69fac2e3e63 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/CommonizationVisitor.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/CommonizationVisitor.kt @@ -11,10 +11,9 @@ import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.* import org.jetbrains.kotlin.descriptors.commonizer.utils.CommonizedGroup import org.jetbrains.kotlin.descriptors.commonizer.utils.compactMapNotNull import org.jetbrains.kotlin.descriptors.commonizer.utils.internedClassId -import org.jetbrains.kotlin.descriptors.commonizer.utils.isUnderStandardKotlinPackages internal class CommonizationVisitor( - private val cache: CirClassifiersCache, + private val classifiers: CirKnownClassifiers, private val root: CirRootNode ) : CirNodeVisitor { override fun visitRootNode(node: CirRootNode, data: Unit) { @@ -88,7 +87,7 @@ internal class CommonizationVisitor( val companionObjectName = node.targetDeclarations.mapTo(HashSet()) { it!!.companion }.singleOrNull() if (companionObjectName != null) { val companionObjectClassId = internedClassId(node.classId, companionObjectName) - val companionObjectNode = cache.classNode(companionObjectClassId) + val companionObjectNode = classifiers.commonized.classNode(companionObjectClassId) ?: error("Can't find companion object with class ID $companionObjectClassId") if (companionObjectNode.commonDeclaration() != null) { @@ -129,10 +128,10 @@ internal class CommonizationVisitor( val supertypesMap: MutableMap> = linkedMapOf() // preserve supertype order for ((index, typeAlias) in targetDeclarations.withIndex()) { val expandedClassId = typeAlias!!.expandedType.classifierId - if (expandedClassId.packageFqName.isUnderStandardKotlinPackages) - return null // this case is not supported + if (classifiers.commonDependeeLibraries?.hasClassifier(expandedClassId) == true) + return null // this case is not supported yet - val expandedClassNode = cache.classNode(expandedClassId) ?: return null + val expandedClassNode = classifiers.commonized.classNode(expandedClassId) ?: return null val expandedClass = expandedClassNode.targetDeclarations[index] ?: error("Can't find expanded class with class ID $expandedClassId and index $index for type alias $classId") @@ -148,7 +147,7 @@ internal class CommonizationVisitor( if (supertypesMap.isNullOrEmpty()) emptyList() else - supertypesMap.values.compactMapNotNull { supertypesGroup -> commonize(supertypesGroup, TypeCommonizer(cache)) } + supertypesMap.values.compactMapNotNull { supertypesGroup -> commonize(supertypesGroup, TypeCommonizer(classifiers)) } ) } } diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/ExtensionReceiverCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/ExtensionReceiverCommonizer.kt index ba96bda8776..231e080b2ae 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/ExtensionReceiverCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/ExtensionReceiverCommonizer.kt @@ -8,11 +8,11 @@ package org.jetbrains.kotlin.descriptors.commonizer.core import org.jetbrains.kotlin.descriptors.commonizer.cir.CirExtensionReceiver import org.jetbrains.kotlin.descriptors.commonizer.cir.CirType import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirExtensionReceiverFactory -import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirClassifiersCache +import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirKnownClassifiers -class ExtensionReceiverCommonizer(cache: CirClassifiersCache) : +class ExtensionReceiverCommonizer(classifiers: CirKnownClassifiers) : AbstractNullableCommonizer( - wrappedCommonizerFactory = { TypeCommonizer(cache) }, + wrappedCommonizerFactory = { TypeCommonizer(classifiers) }, extractor = { it.type }, builder = { receiverType -> CirExtensionReceiverFactory.create( diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/FunctionCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/FunctionCommonizer.kt index d58532ba8b6..3c301a3fcaa 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/FunctionCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/FunctionCommonizer.kt @@ -7,12 +7,12 @@ package org.jetbrains.kotlin.descriptors.commonizer.core import org.jetbrains.kotlin.descriptors.commonizer.cir.CirFunction import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirFunctionFactory -import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirClassifiersCache +import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirKnownClassifiers -class FunctionCommonizer(cache: CirClassifiersCache) : AbstractFunctionOrPropertyCommonizer(cache) { +class FunctionCommonizer(classifiers: CirKnownClassifiers) : AbstractFunctionOrPropertyCommonizer(classifiers) { private val annotations = AnnotationsCommonizer() private val modifiers = FunctionModifiersCommonizer() - private val valueParameters = CallableValueParametersCommonizer(cache) + private val valueParameters = CallableValueParametersCommonizer(classifiers) override fun commonizationResult(): CirFunction { val valueParameters = valueParameters.result diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/PropertyCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/PropertyCommonizer.kt index 4712d2e2095..74e25eea2d4 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/PropertyCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/PropertyCommonizer.kt @@ -9,10 +9,10 @@ import org.jetbrains.kotlin.descriptors.commonizer.cir.CirProperty import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirPropertyFactory import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirPropertyGetterFactory import org.jetbrains.kotlin.descriptors.commonizer.core.PropertyCommonizer.ConstCommonizationState.* -import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirClassifiersCache +import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirKnownClassifiers import org.jetbrains.kotlin.resolve.constants.ConstantValue -class PropertyCommonizer(cache: CirClassifiersCache) : AbstractFunctionOrPropertyCommonizer(cache) { +class PropertyCommonizer(classifiers: CirKnownClassifiers) : AbstractFunctionOrPropertyCommonizer(classifiers) { private val setter = PropertySetterCommonizer() private var isExternal = true private lateinit var constCommonizationState: ConstCommonizationState diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeAliasCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeAliasCommonizer.kt index dcbe9bd1c50..00d9beee173 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeAliasCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeAliasCommonizer.kt @@ -10,8 +10,7 @@ import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.descriptors.commonizer.cir.* import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirClassFactory import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirTypeAliasFactory -import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirClassifiersCache -import org.jetbrains.kotlin.descriptors.commonizer.utils.isUnderStandardKotlinPackages +import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirKnownClassifiers import org.jetbrains.kotlin.name.Name /** @@ -24,9 +23,9 @@ import org.jetbrains.kotlin.name.Name * Tertiary (backup) branch: * - Produce an "expect class" for "common" fragment and the corresponding "actual typealias" declarations for each platform fragment. */ -class TypeAliasCommonizer(cache: CirClassifiersCache) : AbstractStandardCommonizer() { - private val primary = TypeAliasShortCircuitingCommonizer(cache) - private val secondary = TypeAliasLiftingUpCommonizer(cache) +class TypeAliasCommonizer(classifiers: CirKnownClassifiers) : AbstractStandardCommonizer() { + private val primary = TypeAliasShortCircuitingCommonizer(classifiers) + private val secondary = TypeAliasLiftingUpCommonizer(classifiers) private val tertiary = TypeAliasExpectClassCommonizer() override fun commonizationResult(): CirClassifier = primary.resultOrNull ?: secondary.resultOrNull ?: tertiary.result @@ -43,11 +42,13 @@ class TypeAliasCommonizer(cache: CirClassifiersCache) : AbstractStandardCommoniz } } -private class TypeAliasShortCircuitingCommonizer(cache: CirClassifiersCache) : AbstractStandardCommonizer() { +private class TypeAliasShortCircuitingCommonizer( + private val classifiers: CirKnownClassifiers +) : AbstractStandardCommonizer() { private lateinit var name: Name - private val typeParameters = TypeParameterListCommonizer(cache) + private val typeParameters = TypeParameterListCommonizer(classifiers) private lateinit var underlyingType: CirClassOrTypeAliasType - private val expandedType = TypeCommonizer(cache) + private val expandedType = TypeCommonizer(classifiers) private val visibility = VisibilityCommonizer.lowering() override fun commonizationResult() = CirTypeAliasFactory.create( @@ -75,7 +76,7 @@ private class TypeAliasShortCircuitingCommonizer(cache: CirClassifiersCache) : A private tailrec fun computeCommonizedUnderlyingType(underlyingType: CirClassOrTypeAliasType): CirClassOrTypeAliasType { return when (underlyingType) { is CirClassType -> underlyingType - is CirTypeAliasType -> if (underlyingType.classifierId.packageFqName.isUnderStandardKotlinPackages) + is CirTypeAliasType -> if (classifiers.commonDependeeLibraries?.hasClassifier(underlyingType.classifierId) == true) underlyingType else computeCommonizedUnderlyingType(underlyingType.underlyingType) @@ -83,10 +84,10 @@ private class TypeAliasShortCircuitingCommonizer(cache: CirClassifiersCache) : A } } -private class TypeAliasLiftingUpCommonizer(cache: CirClassifiersCache) : AbstractStandardCommonizer() { +private class TypeAliasLiftingUpCommonizer(classifiers: CirKnownClassifiers) : AbstractStandardCommonizer() { private lateinit var name: Name - private val typeParameters = TypeParameterListCommonizer(cache) - private val underlyingType = TypeCommonizer(cache) + private val typeParameters = TypeParameterListCommonizer(classifiers) + private val underlyingType = TypeCommonizer(classifiers) private val visibility = VisibilityCommonizer.lowering() override fun commonizationResult(): CirTypeAlias { diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeCommonizer.kt index 003a5b38663..b0e0d909ed4 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeCommonizer.kt @@ -10,13 +10,12 @@ import org.jetbrains.kotlin.descriptors.commonizer.cir.* import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirTypeFactory import org.jetbrains.kotlin.descriptors.commonizer.core.CommonizedTypeAliasAnswer.Companion.FAILURE_MISSING_IN_SOME_TARGET import org.jetbrains.kotlin.descriptors.commonizer.core.CommonizedTypeAliasAnswer.Companion.SUCCESS_FROM_DEPENDEE_LIBRARY -import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirClassifiersCache +import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirKnownClassifiers import org.jetbrains.kotlin.descriptors.commonizer.utils.isUnderKotlinNativeSyntheticPackages -import org.jetbrains.kotlin.descriptors.commonizer.utils.isUnderStandardKotlinPackages import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.types.Variance -class TypeCommonizer(private val cache: CirClassifiersCache) : AbstractStandardCommonizer() { +class TypeCommonizer(private val classifiers: CirKnownClassifiers) : AbstractStandardCommonizer() { private lateinit var wrapped: Commonizer<*, CirType> override fun commonizationResult() = wrapped.result @@ -24,10 +23,10 @@ class TypeCommonizer(private val cache: CirClassifiersCache) : AbstractStandardC override fun initialize(first: CirType) { @Suppress("UNCHECKED_CAST") wrapped = when (first) { - is CirClassType -> ClassTypeCommonizer(cache) - is CirTypeAliasType -> TypeAliasTypeCommonizer(cache) + is CirClassType -> ClassTypeCommonizer(classifiers) + is CirTypeAliasType -> TypeAliasTypeCommonizer(classifiers) is CirTypeParameterType -> TypeParameterTypeCommonizer() - is CirFlexibleType -> FlexibleTypeCommonizer(cache) + is CirFlexibleType -> FlexibleTypeCommonizer(classifiers) } as Commonizer<*, CirType> } @@ -39,11 +38,11 @@ class TypeCommonizer(private val cache: CirClassifiersCache) : AbstractStandardC } } -private class ClassTypeCommonizer(private val cache: CirClassifiersCache) : AbstractStandardCommonizer() { +private class ClassTypeCommonizer(private val classifiers: CirKnownClassifiers) : AbstractStandardCommonizer() { private lateinit var classId: ClassId - private val outerType = OuterClassTypeCommonizer(cache) + private val outerType = OuterClassTypeCommonizer(classifiers) private lateinit var anyVisibility: DescriptorVisibility - private val arguments = TypeArgumentListCommonizer(cache) + private val arguments = TypeArgumentListCommonizer(classifiers) private var isMarkedNullable = false override fun commonizationResult() = CirTypeFactory.createClassType( @@ -68,22 +67,22 @@ private class ClassTypeCommonizer(private val cache: CirClassifiersCache) : Abst isMarkedNullable == next.isMarkedNullable && classId == next.classifierId && outerType.commonizeWith(next.outerType) - && commonizeClass(classId, cache) + && commonizeClass(classId, classifiers) && arguments.commonizeWith(next.arguments) } -private class OuterClassTypeCommonizer(cache: CirClassifiersCache) : +private class OuterClassTypeCommonizer(classifiers: CirKnownClassifiers) : AbstractNullableCommonizer( - wrappedCommonizerFactory = { ClassTypeCommonizer(cache) }, + wrappedCommonizerFactory = { ClassTypeCommonizer(classifiers) }, extractor = { it }, builder = { it } ) -private class TypeAliasTypeCommonizer(private val cache: CirClassifiersCache) : +private class TypeAliasTypeCommonizer(private val classifiers: CirKnownClassifiers) : AbstractStandardCommonizer() { private lateinit var typeAliasId: ClassId - private val arguments = TypeArgumentListCommonizer(cache) + private val arguments = TypeArgumentListCommonizer(classifiers) private var isMarkedNullable = false private var commonizedTypeBuilder: CommonizedTypeAliasTypeBuilder? = null // null means not selected yet @@ -104,7 +103,7 @@ private class TypeAliasTypeCommonizer(private val cache: CirClassifiersCache) : return false if (commonizedTypeBuilder == null) { - val answer = commonizeTypeAlias(typeAliasId, cache) + val answer = commonizeTypeAlias(typeAliasId, classifiers) if (!answer.commonized) return false @@ -176,9 +175,9 @@ private class TypeParameterTypeCommonizer : AbstractStandardCommonizer() { - private val lowerBound = TypeCommonizer(cache) - private val upperBound = TypeCommonizer(cache) +private class FlexibleTypeCommonizer(classifiers: CirKnownClassifiers) : AbstractStandardCommonizer() { + private val lowerBound = TypeCommonizer(classifiers) + private val upperBound = TypeCommonizer(classifiers) override fun commonizationResult() = CirFlexibleType( lowerBound = lowerBound.result as CirSimpleType, @@ -191,10 +190,12 @@ private class FlexibleTypeCommonizer(cache: CirClassifiersCache) : AbstractStand lowerBound.commonizeWith(next.lowerBound) && upperBound.commonizeWith(next.upperBound) } -private class TypeArgumentCommonizer(cache: CirClassifiersCache) : AbstractStandardCommonizer() { +private class TypeArgumentCommonizer( + classifiers: CirKnownClassifiers +) : AbstractStandardCommonizer() { private var isStar = false private lateinit var projectionKind: Variance - private val type = TypeCommonizer(cache) + private val type = TypeCommonizer(classifiers) override fun commonizationResult() = if (isStar) CirStarTypeProjection else CirTypeProjectionImpl( projectionKind = projectionKind, @@ -214,16 +215,15 @@ private class TypeArgumentCommonizer(cache: CirClassifiersCache) : AbstractStand } } -private class TypeArgumentListCommonizer(cache: CirClassifiersCache) : AbstractListCommonizer( - singleElementCommonizerFactory = { TypeArgumentCommonizer(cache) } +private class TypeArgumentListCommonizer(classifiers: CirKnownClassifiers) : AbstractListCommonizer( + singleElementCommonizerFactory = { TypeArgumentCommonizer(classifiers) } ) -private fun commonizeClass(classId: ClassId, cache: CirClassifiersCache): Boolean { - val packageFqName = classId.packageFqName - if (packageFqName.isUnderStandardKotlinPackages) { - // The class is from Kotlin stdlib. Already commonized. +private fun commonizeClass(classId: ClassId, classifiers: CirKnownClassifiers): Boolean { + if (classifiers.commonDependeeLibraries?.hasClassifier(classId) == true) { + // The class is from common fragment of dependee library (ex: stdlib). Already commonized. return true - } else if (packageFqName.isUnderKotlinNativeSyntheticPackages) { + } else if (classId.packageFqName.isUnderKotlinNativeSyntheticPackages) { // C/Obj-C forward declarations are: // - Either resolved to real classes/interfaces from other interop libraries (which are generated by C-interop tool and // are known to have modality/visibility/other attributes to successfully pass commonization). @@ -232,12 +232,12 @@ private fun commonizeClass(classId: ClassId, cache: CirClassifiersCache): Boolea return true } - return when (val node = cache.classNode(classId)) { + return when (val node = classifiers.commonized.classNode(classId)) { null -> { // No node means that the class was not subject for commonization. // - Either it is missing in certain targets at all => not commonized. // - Or it is a known forward declaration => consider it as commonized. - cache.isExportedForwardDeclaration(classId) + classifiers.forwardDeclarations.isExportedForwardDeclaration(classId) } else -> { // Common declaration in node is not null -> successfully commonized. @@ -246,14 +246,13 @@ private fun commonizeClass(classId: ClassId, cache: CirClassifiersCache): Boolea } } -private fun commonizeTypeAlias(typeAliasId: ClassId, cache: CirClassifiersCache): CommonizedTypeAliasAnswer { - val packageFqName = typeAliasId.packageFqName - if (packageFqName.isUnderStandardKotlinPackages) { - // The type alias is from Kotlin stdlib. Already commonized. +private fun commonizeTypeAlias(typeAliasId: ClassId, classifiers: CirKnownClassifiers): CommonizedTypeAliasAnswer { + if (classifiers.commonDependeeLibraries?.hasClassifier(typeAliasId) == true) { + // The type alias is from common fragment of dependee library (ex: stdlib). Already commonized. return SUCCESS_FROM_DEPENDEE_LIBRARY } - return when (val node = cache.typeAliasNode(typeAliasId)) { + return when (val node = classifiers.commonized.typeAliasNode(typeAliasId)) { null -> { // No node means that the type alias was not subject for commonization. It is missing in some target(s) => not commonized. FAILURE_MISSING_IN_SOME_TARGET diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeParameterCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeParameterCommonizer.kt index 545d9f71d58..70aa038131e 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeParameterCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeParameterCommonizer.kt @@ -8,15 +8,15 @@ package org.jetbrains.kotlin.descriptors.commonizer.core import org.jetbrains.kotlin.descriptors.commonizer.cir.CirType import org.jetbrains.kotlin.descriptors.commonizer.cir.CirTypeParameter import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirTypeParameterFactory -import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirClassifiersCache +import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirKnownClassifiers import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.types.Variance -class TypeParameterCommonizer(cache: CirClassifiersCache) : AbstractStandardCommonizer() { +class TypeParameterCommonizer(classifiers: CirKnownClassifiers) : AbstractStandardCommonizer() { private lateinit var name: Name private var isReified = false private lateinit var variance: Variance - private val upperBounds = TypeParameterUpperBoundsCommonizer(cache) + private val upperBounds = TypeParameterUpperBoundsCommonizer(classifiers) override fun commonizationResult() = CirTypeParameterFactory.create( annotations = emptyList(), @@ -39,6 +39,6 @@ class TypeParameterCommonizer(cache: CirClassifiersCache) : AbstractStandardComm && upperBounds.commonizeWith(next.upperBounds) } -private class TypeParameterUpperBoundsCommonizer(cache: CirClassifiersCache) : AbstractListCommonizer( - singleElementCommonizerFactory = { TypeCommonizer(cache) } +private class TypeParameterUpperBoundsCommonizer(classifiers: CirKnownClassifiers) : AbstractListCommonizer( + singleElementCommonizerFactory = { TypeCommonizer(classifiers) } ) diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeParameterListCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeParameterListCommonizer.kt index b4807a76611..6c84320e519 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeParameterListCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeParameterListCommonizer.kt @@ -6,8 +6,8 @@ package org.jetbrains.kotlin.descriptors.commonizer.core import org.jetbrains.kotlin.descriptors.commonizer.cir.CirTypeParameter -import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirClassifiersCache +import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirKnownClassifiers -class TypeParameterListCommonizer(cache: CirClassifiersCache) : AbstractListCommonizer( - singleElementCommonizerFactory = { TypeParameterCommonizer(cache) } +class TypeParameterListCommonizer(classifiers: CirKnownClassifiers) : AbstractListCommonizer( + singleElementCommonizerFactory = { TypeParameterCommonizer(classifiers) } ) diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/ValueParameterCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/ValueParameterCommonizer.kt index 4306b80f27c..1df5409fee9 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/ValueParameterCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/ValueParameterCommonizer.kt @@ -8,13 +8,13 @@ package org.jetbrains.kotlin.descriptors.commonizer.core import org.jetbrains.kotlin.descriptors.commonizer.cir.CirType import org.jetbrains.kotlin.descriptors.commonizer.cir.CirValueParameter import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirValueParameterFactory -import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirClassifiersCache +import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirKnownClassifiers import org.jetbrains.kotlin.descriptors.commonizer.utils.isNull import org.jetbrains.kotlin.name.Name -class ValueParameterCommonizer(cache: CirClassifiersCache) : AbstractStandardCommonizer() { +class ValueParameterCommonizer(classifiers: CirKnownClassifiers) : AbstractStandardCommonizer() { private lateinit var name: Name - private val returnType = TypeCommonizer(cache) + private val returnType = TypeCommonizer(classifiers) private var varargElementType: CirType? = null private var isCrossinline = true private var isNoinline = true diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/ValueParameterListCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/ValueParameterListCommonizer.kt index ee093d06750..7293af81380 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/ValueParameterListCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/ValueParameterListCommonizer.kt @@ -6,11 +6,11 @@ package org.jetbrains.kotlin.descriptors.commonizer.core import org.jetbrains.kotlin.descriptors.commonizer.cir.CirValueParameter -import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirClassifiersCache +import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirKnownClassifiers import org.jetbrains.kotlin.name.Name -class ValueParameterListCommonizer(cache: CirClassifiersCache) : AbstractListCommonizer( - singleElementCommonizerFactory = { ValueParameterCommonizer(cache) } +class ValueParameterListCommonizer(classifiers: CirKnownClassifiers) : AbstractListCommonizer( + singleElementCommonizerFactory = { ValueParameterCommonizer(classifiers) } ) { fun overwriteNames(names: List) { forEachSingleElementCommonizer { index, singleElementCommonizer -> diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/facade.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/facade.kt index f65c1876028..d61136450f5 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/facade.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/facade.kt @@ -9,9 +9,10 @@ import org.jetbrains.kotlin.descriptors.commonizer.builder.DeclarationsBuilderVi import org.jetbrains.kotlin.descriptors.commonizer.builder.DeclarationsBuilderVisitor2 import org.jetbrains.kotlin.descriptors.commonizer.builder.createGlobalBuilderComponents import org.jetbrains.kotlin.descriptors.commonizer.core.CommonizationVisitor -import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirTreeMerger -import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.DefaultCirClassifiersCache +import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.* +import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirTreeMerger.CirTreeMergeResult import org.jetbrains.kotlin.storage.LockBasedStorageManager +import org.jetbrains.kotlin.storage.StorageManager fun runCommonization(parameters: Parameters): Result { if (!parameters.hasAnythingToCommonize()) @@ -19,14 +20,8 @@ fun runCommonization(parameters: Parameters): Result { val storageManager = LockBasedStorageManager("Declaration descriptors commonization") - // build merged tree: - val cache = DefaultCirClassifiersCache() - val mergeResult = CirTreeMerger(storageManager, cache, parameters).merge() - - // commonize: + val mergeResult = mergeAndCommonize(storageManager, parameters) val mergedTree = mergeResult.root - mergedTree.accept(CommonizationVisitor(cache, mergedTree), Unit) - parameters.progressLogger?.invoke("Commonized declarations") // build resulting descriptors: val components = mergedTree.createGlobalBuilderComponents(storageManager, parameters) @@ -51,3 +46,25 @@ fun runCommonization(parameters: Parameters): Result { return Result.Commonized(modulesByTargets) } + +private fun mergeAndCommonize(storageManager: StorageManager, parameters: Parameters): CirTreeMergeResult { + // build merged tree: + val classifiers = CirKnownClassifiers( + commonized = CirCommonizedClassifiers.default(), + forwardDeclarations = CirForwardDeclarations.default(), + dependeeLibraries = mapOf( + // for now, supply only common dependee libraries (ex: Kotlin stdlib) + parameters.sharedTarget to CirProvidedClassifiers.fromModules(storageManager) { + parameters.dependeeModulesProvider?.loadModules(emptyList())?.values.orEmpty() + } + ) + ) + val mergeResult = CirTreeMerger(storageManager, classifiers, parameters).merge() + + // commonize: + val mergedTree = mergeResult.root + mergedTree.accept(CommonizationVisitor(classifiers, mergedTree), Unit) + parameters.progressLogger?.invoke("Commonized declarations") + + return mergeResult +} diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirClassifiersCache.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirClassifiersCache.kt index 4b22c5d310c..bc5175d92c0 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirClassifiersCache.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirClassifiersCache.kt @@ -7,42 +7,122 @@ package org.jetbrains.kotlin.descriptors.commonizer.mergedtree import gnu.trove.THashMap import gnu.trove.THashSet +import org.jetbrains.kotlin.descriptors.ModuleDescriptor +import org.jetbrains.kotlin.descriptors.commonizer.SharedTarget +import org.jetbrains.kotlin.descriptors.commonizer.Target +import org.jetbrains.kotlin.descriptors.commonizer.utils.intern import org.jetbrains.kotlin.descriptors.commonizer.utils.isUnderKotlinNativeSyntheticPackages +import org.jetbrains.kotlin.descriptors.commonizer.utils.resolveClassOrTypeAlias import org.jetbrains.kotlin.name.ClassId +import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.resolve.scopes.MemberScope +import org.jetbrains.kotlin.storage.StorageManager +import org.jetbrains.kotlin.storage.getValue -interface CirClassifiersCache { - fun isExportedForwardDeclaration(classId: ClassId): Boolean +class CirKnownClassifiers( + val commonized: CirCommonizedClassifiers, + val forwardDeclarations: CirForwardDeclarations, + val dependeeLibraries: Map +) { + // a shortcut for fast access + val commonDependeeLibraries: CirProvidedClassifiers? = dependeeLibraries.filterKeys { it is SharedTarget }.values.singleOrNull() +} +interface CirCommonizedClassifiers { + /* Accessors */ fun classNode(classId: ClassId): CirClassNode? fun typeAliasNode(typeAliasId: ClassId): CirTypeAliasNode? - fun addExportedForwardDeclaration(classId: ClassId) - + /* Mutators */ fun addClassNode(classId: ClassId, node: CirClassNode) fun addTypeAliasNode(typeAliasId: ClassId, node: CirTypeAliasNode) -} -class DefaultCirClassifiersCache : CirClassifiersCache { - private val exportedForwardDeclarations = THashSet() - private val classNodes = THashMap() - private val typeAliases = THashMap() + companion object { + fun default() = object : CirCommonizedClassifiers { + private val classNodes = THashMap() + private val typeAliases = THashMap() - override fun isExportedForwardDeclaration(classId: ClassId) = classId in exportedForwardDeclarations - override fun classNode(classId: ClassId) = classNodes[classId] - override fun typeAliasNode(typeAliasId: ClassId) = typeAliases[typeAliasId] + override fun classNode(classId: ClassId) = classNodes[classId] + override fun typeAliasNode(typeAliasId: ClassId) = typeAliases[typeAliasId] - override fun addExportedForwardDeclaration(classId: ClassId) { - check(!classId.packageFqName.isUnderKotlinNativeSyntheticPackages) - exportedForwardDeclarations += classId - } + override fun addClassNode(classId: ClassId, node: CirClassNode) { + val oldNode = classNodes.put(classId, node) + check(oldNode == null) { "Rewriting class node $classId" } + } - override fun addClassNode(classId: ClassId, node: CirClassNode) { - val oldNode = classNodes.put(classId, node) - check(oldNode == null) { "Rewriting class node $classId" } - } - - override fun addTypeAliasNode(typeAliasId: ClassId, node: CirTypeAliasNode) { - val oldNode = typeAliases.put(typeAliasId, node) - check(oldNode == null) { "Rewriting type alias node $typeAliasId" } + override fun addTypeAliasNode(typeAliasId: ClassId, node: CirTypeAliasNode) { + val oldNode = typeAliases.put(typeAliasId, node) + check(oldNode == null) { "Rewriting type alias node $typeAliasId" } + } + } + } +} + +interface CirForwardDeclarations { + /* Accessors */ + fun isExportedForwardDeclaration(classId: ClassId): Boolean + + /* Mutators */ + fun addExportedForwardDeclaration(classId: ClassId) + + companion object { + fun default() = object : CirForwardDeclarations { + private val exportedForwardDeclarations = THashSet() + + override fun isExportedForwardDeclaration(classId: ClassId) = classId in exportedForwardDeclarations + + override fun addExportedForwardDeclaration(classId: ClassId) { + check(!classId.packageFqName.isUnderKotlinNativeSyntheticPackages) + exportedForwardDeclarations += classId + } + } + } +} + +interface CirProvidedClassifiers { + fun hasClassifier(classifierId: ClassId): Boolean + + // TODO: implement later + //fun classifier(classifierId: ClassId): Any? + + companion object { + // N.B. This is suboptimal implementation. It will be replaced by another implementation that will + // retrieve classifier information directly from the metadata. + fun fromModules(storageManager: StorageManager, modules: () -> Collection) = object : CirProvidedClassifiers { + private val nonEmptyMemberScopes: Map by storageManager.createLazyValue { + THashMap().apply { + for (module in modules()) { + module.collectNonEmptyPackageMemberScopes(probeRootPackageForEmptiness = true) { packageFqName, memberScope -> + this[packageFqName.intern()] = memberScope + } + } + } + } + + private val presentClassifiers = THashSet() + private val missingClassifiers = THashSet() + + override fun hasClassifier(classifierId: ClassId): Boolean { + val relativeClassName: FqName = classifierId.relativeClassName + if (relativeClassName.isRoot) + return false + + val packageFqName = classifierId.packageFqName + val memberScope = nonEmptyMemberScopes[packageFqName] ?: return false + + return when (classifierId) { + in presentClassifiers -> true + in missingClassifiers -> false + else -> { + val found = memberScope.resolveClassOrTypeAlias(relativeClassName) != null + when (found) { + true -> presentClassifiers += classifierId + false -> missingClassifiers += classifierId + } + found + } + } + } + } } } diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirTreeMerger.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirTreeMerger.kt index fc244b8ec1f..82b43b162e6 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirTreeMerger.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirTreeMerger.kt @@ -48,7 +48,7 @@ import org.jetbrains.kotlin.storage.StorageManager */ class CirTreeMerger( private val storageManager: StorageManager, - private val cache: CirClassifiersCache, + private val classifiers: CirKnownClassifiers, private val parameters: Parameters ) { class CirTreeMergeResult( @@ -183,7 +183,7 @@ class CirTreeMerger( parentCommonDeclaration: NullableLazyValue<*>? ) { val propertyNode: CirPropertyNode = properties.getOrPut(PropertyApproximationKey(propertyDescriptor)) { - buildPropertyNode(storageManager, size, cache, parentCommonDeclaration) + buildPropertyNode(storageManager, size, classifiers, parentCommonDeclaration) } propertyNode.targetDeclarations[targetIndex] = CirPropertyFactory.create(propertyDescriptor) } @@ -195,7 +195,7 @@ class CirTreeMerger( parentCommonDeclaration: NullableLazyValue<*>? ) { val functionNode: CirFunctionNode = functions.getOrPut(FunctionApproximationKey(functionDescriptor)) { - buildFunctionNode(storageManager, size, cache, parentCommonDeclaration) + buildFunctionNode(storageManager, size, classifiers, parentCommonDeclaration) } functionNode.targetDeclarations[targetIndex] = CirFunctionFactory.create(functionDescriptor) } @@ -211,7 +211,7 @@ class CirTreeMerger( val classId = classIdFunction(className) val classNode: CirClassNode = classes.getOrPut(className) { - buildClassNode(storageManager, size, cache, parentCommonDeclaration, classId) + buildClassNode(storageManager, size, classifiers, parentCommonDeclaration, classId) } classNode.targetDeclarations[targetIndex] = CirClassFactory.create(classDescriptor) @@ -246,7 +246,7 @@ class CirTreeMerger( parentCommonDeclaration: NullableLazyValue<*>? ) { val constructorNode: CirClassConstructorNode = constructors.getOrPut(ConstructorApproximationKey(constructorDescriptor)) { - buildClassConstructorNode(storageManager, size, cache, parentCommonDeclaration) + buildClassConstructorNode(storageManager, size, classifiers, parentCommonDeclaration) } constructorNode.targetDeclarations[targetIndex] = CirClassConstructorFactory.create(constructorDescriptor) } @@ -261,7 +261,7 @@ class CirTreeMerger( val typeAliasClassId = internedClassId(packageFqName, typeAliasName) val typeAliasNode: CirTypeAliasNode = typeAliases.getOrPut(typeAliasName) { - buildTypeAliasNode(storageManager, size, cache, typeAliasClassId) + buildTypeAliasNode(storageManager, size, classifiers, typeAliasClassId) } typeAliasNode.targetDeclarations[targetIndex] = CirTypeAliasFactory.create(typeAliasDescriptor) } @@ -274,7 +274,7 @@ class CirTreeMerger( exportForwardDeclarations.forEach { classFqName -> // Class has synthetic package FQ name (cnames/objcnames). Need to transfer it to the main package. val className = Name.identifier(classFqName.substringAfterLast('.')).intern() - cache.addExportedForwardDeclaration(internedClassId(mainPackageFqName, className)) + classifiers.forwardDeclarations.addExportedForwardDeclaration(internedClassId(mainPackageFqName, className)) } } } diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/collectors.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/collectors.kt index 1d1916a2382..5dd1ca3718e 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/collectors.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/collectors.kt @@ -64,18 +64,24 @@ internal inline fun FunctionCollector( } // collects member scopes for every non-empty package provided by this module -internal fun ModuleDescriptor.collectNonEmptyPackageMemberScopes(collector: (FqName, MemberScope) -> Unit) { +internal fun ModuleDescriptor.collectNonEmptyPackageMemberScopes( + probeRootPackageForEmptiness: Boolean = false, // false is the default as probing might be expensive and is not always necessary + collector: (FqName, MemberScope) -> Unit +) { // we don's need to process fragments from other modules which are the dependencies of this module, so // let's use the appropriate package fragment provider val packageFragmentProvider = this.packageFragmentProvider fun recurse(packageFqName: FqName) { - val ownPackageFragments = packageFragmentProvider.packageFragments(packageFqName) - val ownPackageMemberScopes = ownPackageFragments.asSequence() + val probeForEmptiness = probeRootPackageForEmptiness && packageFqName.isRoot + + val ownPackageMemberScopes = packageFragmentProvider.packageFragments(packageFqName) + .asSequence() .filter { it !is ExportedForwardDeclarationsPackageFragmentDescriptor && it !is ClassifierAliasingPackageFragmentDescriptor } .map { it.getMemberScope() } .filter { it != MemberScope.Empty } - .toList(ownPackageFragments.size) + .filter { !probeForEmptiness || it.getContributedDescriptors().isNotEmpty() } + .toList() if (ownPackageMemberScopes.isNotEmpty()) { // don't include subpackages into chained member scope diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/nodeBuilders.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/nodeBuilders.kt index bf96eba7df6..4407ff92f0b 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/nodeBuilders.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/nodeBuilders.kt @@ -53,44 +53,44 @@ internal fun buildPackageNode( internal fun buildPropertyNode( storageManager: StorageManager, size: Int, - cache: CirClassifiersCache, + classifiers: CirKnownClassifiers, parentCommonDeclaration: NullableLazyValue<*>? ): CirPropertyNode = buildNode( storageManager = storageManager, size = size, parentCommonDeclaration = parentCommonDeclaration, - commonizerProducer = { PropertyCommonizer(cache) }, + commonizerProducer = { PropertyCommonizer(classifiers) }, nodeProducer = ::CirPropertyNode ) internal fun buildFunctionNode( storageManager: StorageManager, size: Int, - cache: CirClassifiersCache, + classifiers: CirKnownClassifiers, parentCommonDeclaration: NullableLazyValue<*>? ): CirFunctionNode = buildNode( storageManager = storageManager, size = size, parentCommonDeclaration = parentCommonDeclaration, - commonizerProducer = { FunctionCommonizer(cache) }, + commonizerProducer = { FunctionCommonizer(classifiers) }, nodeProducer = ::CirFunctionNode ) internal fun buildClassNode( storageManager: StorageManager, size: Int, - cache: CirClassifiersCache, + classifiers: CirKnownClassifiers, parentCommonDeclaration: NullableLazyValue<*>?, classId: ClassId ): CirClassNode = buildNode( storageManager = storageManager, size = size, parentCommonDeclaration = parentCommonDeclaration, - commonizerProducer = { ClassCommonizer(cache) }, + commonizerProducer = { ClassCommonizer(classifiers) }, recursionMarker = CirClassRecursionMarker, nodeProducer = { targetDeclarations, commonDeclaration -> CirClassNode(targetDeclarations, commonDeclaration, classId).also { - cache.addClassNode(classId, it) + classifiers.commonized.addClassNode(classId, it) } } ) @@ -98,29 +98,29 @@ internal fun buildClassNode( internal fun buildClassConstructorNode( storageManager: StorageManager, size: Int, - cache: CirClassifiersCache, + classifiers: CirKnownClassifiers, parentCommonDeclaration: NullableLazyValue<*>? ): CirClassConstructorNode = buildNode( storageManager = storageManager, size = size, parentCommonDeclaration = parentCommonDeclaration, - commonizerProducer = { ClassConstructorCommonizer(cache) }, + commonizerProducer = { ClassConstructorCommonizer(classifiers) }, nodeProducer = ::CirClassConstructorNode ) internal fun buildTypeAliasNode( storageManager: StorageManager, size: Int, - cache: CirClassifiersCache, + classifiers: CirKnownClassifiers, typeAliasId: ClassId ): CirTypeAliasNode = buildNode( storageManager = storageManager, size = size, - commonizerProducer = { TypeAliasCommonizer(cache) }, + commonizerProducer = { TypeAliasCommonizer(classifiers) }, recursionMarker = CirClassifierRecursionMarker, nodeProducer = { targetDeclarations, commonDeclaration -> CirTypeAliasNode(targetDeclarations, commonDeclaration, typeAliasId).also { - cache.addTypeAliasNode(typeAliasId, it) + classifiers.commonized.addTypeAliasNode(typeAliasId, it) } } ) diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/constants.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/constants.kt index ef0e920246a..2f5099ac568 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/constants.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/constants.kt @@ -43,8 +43,6 @@ private fun checkConstantSupportedInCommonization( } is AnnotationValue -> { if (allowAnnotationValues) { - if (constantValue.value.fqName?.isUnderStandardKotlinPackages != true) - onError("Only ${constantValue::class.java} const values from Kotlin standard packages are supported, $constantValue at ${location()}") return // OK } // else fail (see below) } diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/misc.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/misc.kt index 04e86cd44be..c97431cb6af 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/misc.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/misc.kt @@ -15,12 +15,6 @@ import java.util.Collections.singletonList import java.util.Collections.singletonMap import kotlin.collections.ArrayList -internal fun Sequence.toList(expectedCapacity: Int): List { - val result = ArrayList(expectedCapacity) - toCollection(result) - return result -} - internal infix fun Map.compactConcat(other: Map): Map = when { isEmpty() -> other diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/moduleDescriptor.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/moduleDescriptor.kt index 2e1e7715b17..70c754fdc95 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/moduleDescriptor.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/moduleDescriptor.kt @@ -15,6 +15,7 @@ import org.jetbrains.kotlin.library.metadata.NativeTypeTransformer import org.jetbrains.kotlin.library.metadata.NullFlexibleTypeDeserializer import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.resolve.scopes.MemberScope import org.jetbrains.kotlin.serialization.konan.impl.KlibResolvedModuleDescriptorsFactoryImpl import org.jetbrains.kotlin.storage.StorageManager @@ -38,29 +39,35 @@ internal fun ModuleDescriptor.resolveClassOrTypeAlias(classId: ClassId): Classif return null return packageFragmentProvider.packageFragments(classId.packageFqName).asSequence().mapNotNull { packageFragment -> - var memberScope = packageFragment.getMemberScope() - - val classifierName = if ('.' in relativeClassName.asString()) { - // resolve member scope of the nested class - relativeClassName.pathSegments().reduce { first, second -> - memberScope = (memberScope.getContributedClassifier( - first, - NoLookupLocation.FOR_ALREADY_TRACKED - ) as? ClassDescriptor)?.unsubstitutedMemberScope ?: return@mapNotNull null - - second - } - } else { - relativeClassName.shortName() - } - - memberScope.getContributedClassifier( - classifierName, - NoLookupLocation.FOR_ALREADY_TRACKED - ) as? ClassifierDescriptorWithTypeParameters + packageFragment.getMemberScope().resolveClassOrTypeAlias(relativeClassName) }.firstOrNull() } +internal fun MemberScope.resolveClassOrTypeAlias(relativeClassName: FqName): ClassifierDescriptorWithTypeParameters? { + var memberScope: MemberScope = this + if (memberScope is MemberScope.Empty) + return null + + val classifierName = if ('.' in relativeClassName.asString()) { + // resolve member scope of the nested class + relativeClassName.pathSegments().reduce { first, second -> + memberScope = (memberScope.getContributedClassifier( + first, + NoLookupLocation.FOR_ALREADY_TRACKED + ) as? ClassDescriptor)?.unsubstitutedMemberScope ?: return null + + second + } + } else { + relativeClassName.shortName() + } + + return memberScope.getContributedClassifier( + classifierName, + NoLookupLocation.FOR_ALREADY_TRACKED + ) as? ClassifierDescriptorWithTypeParameters +} + internal const val MODULE_NAME_PREFIX = "module:" internal val NativeFactories = KlibMetadataFactories(::KonanBuiltIns, NullFlexibleTypeDeserializer, NativeTypeTransformer()) diff --git a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/AbstractCommonizationFromSourcesTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/AbstractCommonizationFromSourcesTest.kt index ed998be02a7..34c052c99dd 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/AbstractCommonizationFromSourcesTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/AbstractCommonizationFromSourcesTest.kt @@ -11,6 +11,7 @@ import org.jetbrains.kotlin.analyzer.ModuleInfo import org.jetbrains.kotlin.analyzer.common.CommonDependenciesContainer import org.jetbrains.kotlin.analyzer.common.CommonPlatformAnalyzerServices import org.jetbrains.kotlin.analyzer.common.CommonResolverForModuleFactory +import org.jetbrains.kotlin.builtins.DefaultBuiltIns import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment import org.jetbrains.kotlin.config.CommonConfigurationKeys @@ -174,16 +175,13 @@ private class AnalyzedModuleDependencies( companion object { val EMPTY = AnalyzedModuleDependencies(emptyMap(), emptyList()) - - fun create(regularDependencies: Map, expectByDependencies: List) = - AnalyzedModuleDependencies(regularDependencies.mapValues { listOf(it.value) }, expectByDependencies) } } private class AnalyzedModules( val originalModules: Map, val commonizedModules: Map, - val dependeeModules: Map + val dependeeModules: Map> ) { val leafTargets: Set val sharedTarget: SharedTarget @@ -214,13 +212,13 @@ private class AnalyzedModules( target = leafTarget, builtInsClass = originalModule.builtIns::class.java, builtInsProvider = MockBuiltInsProvider(originalModule.builtIns), - modulesProvider = MockModulesProvider(originalModule), - dependeeModulesProvider = dependeeModules[leafTarget]?.let(::MockModulesProvider) + modulesProvider = MockModulesProvider.create(originalModule), + dependeeModulesProvider = dependeeModules[leafTarget]?.let(MockModulesProvider::create) ) ) } - parameters.dependeeModulesProvider = dependeeModules[sharedTarget]?.let(::MockModulesProvider) + parameters.dependeeModulesProvider = dependeeModules[sharedTarget]?.let(MockModulesProvider::create) return parameters } @@ -230,22 +228,37 @@ private class AnalyzedModules( sourceModuleRoots: SourceModuleRoots, parentDisposable: Disposable ): AnalyzedModules = with(sourceModuleRoots) { - // first, build the modules that are are the dependencies for "original" and "commonized" modules - val dependeeModules = - createModules(sharedTarget, dependeeRoots, AnalyzedModuleDependencies.EMPTY, parentDisposable, isDependeeModule = true) + // phase 1: provide the modules that are the dependencies for "original" and "commonized" modules + val (dependeeModules, dependencies) = createDependeeModules(sharedTarget, dependeeRoots, parentDisposable) - val dependencies = AnalyzedModuleDependencies.create( - regularDependencies = dependeeModules, - expectByDependencies = listOfNotNull(dependeeModules[sharedTarget]) - ) - - // then, build "original" and "commonized" modules + // phase 2: build "original" and "commonized" modules val originalModules = createModules(sharedTarget, originalRoots, dependencies, parentDisposable) val commonizedModules = createModules(sharedTarget, commonizedRoots, dependencies, parentDisposable) return AnalyzedModules(originalModules, commonizedModules, dependeeModules) } + private fun createDependeeModules( + sharedTarget: SharedTarget, + dependeeRoots: Map, + parentDisposable: Disposable + ): Pair>, AnalyzedModuleDependencies> { + val customDependeeModules = + createModules(sharedTarget, dependeeRoots, AnalyzedModuleDependencies.EMPTY, parentDisposable, isDependeeModule = true) + + val stdlibModule = DefaultBuiltIns.Instance.builtInsModule + + val dependeeModules = (sharedTarget.targets + sharedTarget).associateWith { target -> + // prepend stdlib for each target explicitly, so that the commonizer can see symbols from the stdlib + listOfNotNull(stdlibModule, customDependeeModules[target]) + } + + return dependeeModules to AnalyzedModuleDependencies( + regularDependencies = dependeeModules, + expectByDependencies = dependeeModules.getValue(sharedTarget).filter { module -> module !== stdlibModule } + ) + } + private fun createModules( sharedTarget: SharedTarget, moduleRoots: Map, diff --git a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/CommonizerFacadeTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/CommonizerFacadeTest.kt index b8471e92d08..a5cfecb9193 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/CommonizerFacadeTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/CommonizerFacadeTest.kt @@ -67,7 +67,7 @@ class CommonizerFacadeTest { target = LeafTarget(targetName), builtInsClass = DefaultBuiltIns::class.java, builtInsProvider = BuiltInsProvider.defaultBuiltInsProvider, - modulesProvider = MockModulesProvider(moduleNames), + modulesProvider = MockModulesProvider.create(moduleNames), dependeeModulesProvider = null ) ) diff --git a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/ExtensionReceiverCommonizerTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/ExtensionReceiverCommonizerTest.kt index 430383627cf..80b518f0c26 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/ExtensionReceiverCommonizerTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/ExtensionReceiverCommonizerTest.kt @@ -8,7 +8,7 @@ package org.jetbrains.kotlin.descriptors.commonizer.core import org.jetbrains.kotlin.descriptors.commonizer.cir.CirExtensionReceiver import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirExtensionReceiverFactory import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirTypeFactory -import org.jetbrains.kotlin.descriptors.commonizer.utils.MOCK_CLASSIFIERS_CACHE +import org.jetbrains.kotlin.descriptors.commonizer.utils.MOCK_CLASSIFIERS import org.jetbrains.kotlin.descriptors.commonizer.utils.mockClassType import org.junit.Test @@ -49,7 +49,7 @@ class ExtensionReceiverCommonizerTest : AbstractCommonizerTest() { - private lateinit var cache: CirClassifiersCache + private lateinit var classifiers: CirKnownClassifiers @Before fun initialize() { - cache = DefaultCirClassifiersCache() // reset cache + // reset cache + classifiers = CirKnownClassifiers( + commonized = CirCommonizedClassifiers.default(), + forwardDeclarations = CirForwardDeclarations.default(), + dependeeLibraries = mapOf( + FAKE_SHARED_TARGET to object : CirProvidedClassifiers { + override fun hasClassifier(classifierId: ClassId): Boolean = classifierId.packageFqName.isUnderStandardKotlinPackages + } + ) + ) } @Test @@ -465,11 +477,11 @@ class TypeCommonizerTest : AbstractCommonizerTest() { when (descriptor) { is ClassDescriptor -> { val classId = descriptor.classId ?: error("No class ID for ${descriptor::class.java}, $descriptor") - val node = cache.classNode(classId) { + val node = classifiers.classNode(classId) { buildClassNode( storageManager = LockBasedStorageManager.NO_LOCKS, size = variants.size, - cache = cache, + classifiers = classifiers, parentCommonDeclaration = null, classId = classId ) @@ -478,11 +490,11 @@ class TypeCommonizerTest : AbstractCommonizerTest() { } is TypeAliasDescriptor -> { val typeAliasId = descriptor.classId ?: error("No class ID for ${descriptor::class.java}, $descriptor") - val node = cache.typeAliasNode(typeAliasId) { + val node = classifiers.typeAliasNode(typeAliasId) { buildTypeAliasNode( storageManager = LockBasedStorageManager.NO_LOCKS, size = variants.size, - cache = cache, + classifiers = classifiers, typeAliasId = typeAliasId ) } @@ -517,18 +529,20 @@ class TypeCommonizerTest : AbstractCommonizerTest() { ) } - override fun createCommonizer() = TypeCommonizer(cache) + override fun createCommonizer() = TypeCommonizer(classifiers) - override fun isEqual(a: CirType?, b: CirType?) = (a === b) || (a != null && b != null && areEqual(cache, a, b)) + override fun isEqual(a: CirType?, b: CirType?) = (a === b) || (a != null && b != null && areEqual(classifiers, a, b)) companion object { - fun areEqual(cache: CirClassifiersCache, a: CirType, b: CirType): Boolean = - TypeCommonizer(cache).run { commonizeWith(a) && commonizeWith(b) } + fun areEqual(classifiers: CirKnownClassifiers, a: CirType, b: CirType): Boolean = + TypeCommonizer(classifiers).run { commonizeWith(a) && commonizeWith(b) } - private fun CirClassifiersCache.classNode(classId: ClassId, computation: () -> CirClassNode) = - classNode(classId) ?: computation() + private val FAKE_SHARED_TARGET = SharedTarget(setOf(LeafTarget("a"), LeafTarget("b"))) - private fun CirClassifiersCache.typeAliasNode(typeAliasId: ClassId, computation: () -> CirTypeAliasNode) = - typeAliasNode(typeAliasId) ?: computation() + private fun CirKnownClassifiers.classNode(classId: ClassId, computation: () -> CirClassNode) = + commonized.classNode(classId) ?: computation() + + private fun CirKnownClassifiers.typeAliasNode(typeAliasId: ClassId, computation: () -> CirTypeAliasNode) = + commonized.typeAliasNode(typeAliasId) ?: computation() } } diff --git a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/TypeParameterCommonizerTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/TypeParameterCommonizerTest.kt index a570d4d56bc..3057e51eb13 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/TypeParameterCommonizerTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/TypeParameterCommonizerTest.kt @@ -8,14 +8,14 @@ package org.jetbrains.kotlin.descriptors.commonizer.core import org.jetbrains.kotlin.descriptors.commonizer.cir.CirTypeParameter import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirTypeFactory import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirTypeParameterFactory -import org.jetbrains.kotlin.descriptors.commonizer.utils.MOCK_CLASSIFIERS_CACHE +import org.jetbrains.kotlin.descriptors.commonizer.utils.MOCK_CLASSIFIERS import org.jetbrains.kotlin.descriptors.commonizer.utils.mockClassType import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.types.Variance import org.junit.Test class TypeParameterCommonizerTest : AbstractCommonizerTest() { - override fun createCommonizer() = TypeParameterCommonizer(MOCK_CLASSIFIERS_CACHE) + override fun createCommonizer() = TypeParameterCommonizer(MOCK_CLASSIFIERS) @Test fun allAreReified() = doTestSuccess( diff --git a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/TypeParameterListCommonizerTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/TypeParameterListCommonizerTest.kt index 6e6bf48f5b4..5082a42f7ab 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/TypeParameterListCommonizerTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/TypeParameterListCommonizerTest.kt @@ -6,7 +6,7 @@ package org.jetbrains.kotlin.descriptors.commonizer.core import org.jetbrains.kotlin.descriptors.commonizer.cir.CirTypeParameter -import org.jetbrains.kotlin.descriptors.commonizer.utils.MOCK_CLASSIFIERS_CACHE +import org.jetbrains.kotlin.descriptors.commonizer.utils.MOCK_CLASSIFIERS import org.junit.Test class TypeParameterListCommonizerTest : AbstractCommonizerTest, List>() { @@ -108,7 +108,7 @@ class TypeParameterListCommonizerTest : AbstractCommonizerTest): List { diff --git a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/ValueParameterCommonizerTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/ValueParameterCommonizerTest.kt index 18cebf335d0..59d129249de 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/ValueParameterCommonizerTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/ValueParameterCommonizerTest.kt @@ -11,8 +11,8 @@ import org.jetbrains.kotlin.descriptors.commonizer.cir.CirValueParameter import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirTypeFactory import org.jetbrains.kotlin.descriptors.commonizer.core.CirTestValueParameter.Companion.areEqual import org.jetbrains.kotlin.descriptors.commonizer.core.TypeCommonizerTest.Companion.areEqual -import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirClassifiersCache -import org.jetbrains.kotlin.descriptors.commonizer.utils.MOCK_CLASSIFIERS_CACHE +import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirKnownClassifiers +import org.jetbrains.kotlin.descriptors.commonizer.utils.MOCK_CLASSIFIERS import org.jetbrains.kotlin.descriptors.commonizer.utils.mockClassType import org.jetbrains.kotlin.name.Name import org.junit.Test @@ -141,10 +141,10 @@ class ValueParameterCommonizerTest : AbstractCommonizerTest, List>() { @@ -150,7 +150,7 @@ class ValueParameterListCommonizerTest : AbstractCommonizerTest?, b: List?): Boolean { if (a === b) @@ -159,7 +159,7 @@ class ValueParameterListCommonizerTest : AbstractCommonizerTest - private val modules: Map - - constructor(moduleNames: Collection) { - moduleInfos = moduleNames.associateWith { name -> fakeModuleInfo(name) } - modules = moduleNames.associateWith { name -> mockEmptyModule("<$name>") } - } - - constructor(module: ModuleDescriptor) { - val name = module.name.asString().removeSurrounding("<", ">") - moduleInfos = mapOf(name to fakeModuleInfo(name)) - modules = mapOf(name to module) - } +internal class MockModulesProvider private constructor( + private val modules: Map, +) : ModulesProvider { + private val moduleInfos: Map = modules.mapValues { (name, _) -> fakeModuleInfo(name) } override fun loadModuleInfos() = moduleInfos override fun loadModules(dependencies: Collection): Map = modules private fun fakeModuleInfo(name: String) = ModuleInfo(name, File("/tmp/commonizer/mocks/$name"), null) + + companion object { + @JvmName("createByModuleNames") + fun create(moduleNames: List) = MockModulesProvider( + moduleNames.associateWith { name -> mockEmptyModule("<$name>") } + ) + + @JvmName("createByModules") + fun create(modules: List) = MockModulesProvider( + modules.associateBy { module -> module.name.strip() } + ) + + @JvmName("createBySingleModule") + fun create(module: ModuleDescriptor) = MockModulesProvider( + mapOf(module.name.strip() to module) + ) + } } From 984b3c2f30ca605c4035dc47b29d1d60b2833f13 Mon Sep 17 00:00:00 2001 From: Vladimir Dolzhenko Date: Thu, 3 Dec 2020 12:35:31 +0100 Subject: [PATCH 416/698] Fix to address platform expectation for project path Project path has to be absolute --- .../perf/AbstractPerformanceProjectsTest.kt | 8 +++---- .../idea/testFramework/ProjectOpenAction.kt | 21 +++++++++++-------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/idea/performanceTests/test/org/jetbrains/kotlin/idea/perf/AbstractPerformanceProjectsTest.kt b/idea/performanceTests/test/org/jetbrains/kotlin/idea/perf/AbstractPerformanceProjectsTest.kt index 8ae91f075bd..8c1b7cb471c 100644 --- a/idea/performanceTests/test/org/jetbrains/kotlin/idea/perf/AbstractPerformanceProjectsTest.kt +++ b/idea/performanceTests/test/org/jetbrains/kotlin/idea/perf/AbstractPerformanceProjectsTest.kt @@ -166,9 +166,9 @@ abstract class AbstractPerformanceProjectsTest : UsefulTestCase() { openAction: ProjectOpenAction, fast: Boolean = false ): Project { - val projectPath = File(path).canonicalPath + val projectPath = File(path).absolutePath - assertTrue("path $path does not exist, check README.md", File(projectPath).exists()) + assertTrue("path $projectPath does not exist, check README.md", File(projectPath).exists()) val warmUpIterations = if (fast) 0 else 5 val iterations = if (fast) 1 else 5 @@ -177,7 +177,7 @@ abstract class AbstractPerformanceProjectsTest : UsefulTestCase() { var counter = 0 val openProject = OpenProject( - projectPath = path, + projectPath = projectPath, projectName = name, jdk = jdk18, projectOpenAction = openAction @@ -230,7 +230,7 @@ abstract class AbstractPerformanceProjectsTest : UsefulTestCase() { myApplication.setDataProvider(TestDataProvider(project)) } - return lastProject ?: error("unable to open project $name at $path") + return lastProject ?: error("unable to open project $name at $projectPath") } fun perfTypeAndAutocomplete( diff --git a/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/ProjectOpenAction.kt b/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/ProjectOpenAction.kt index bf1a742c0a1..a15d598b6f6 100644 --- a/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/ProjectOpenAction.kt +++ b/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/ProjectOpenAction.kt @@ -38,10 +38,11 @@ data class OpenProject(val projectPath: String, val projectName: String, val jdk enum class ProjectOpenAction { SIMPLE_JAVA_MODULE { override fun openProject(projectPath: String, projectName: String, jdk: Sdk): Project { - val project = ProjectManagerEx.getInstanceEx().loadAndOpenProject(projectPath)!! + val path = File(projectPath).absolutePath + val project = ProjectManagerEx.getInstanceEx().loadAndOpenProject(path)!! - val modulePath = "$projectPath/$name${ModuleFileType.DOT_DEFAULT_EXTENSION}" - val projectFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(File(projectPath))!! + val modulePath = "$path/$name${ModuleFileType.DOT_DEFAULT_EXTENSION}" + val projectFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(File(path))!! val srcFile = projectFile.findChild("src")!! val module = runWriteAction { @@ -61,16 +62,17 @@ enum class ProjectOpenAction { EXISTING_IDEA_PROJECT { override fun openProject(projectPath: String, projectName: String, jdk: Sdk): Project { + val path = File(projectPath).absolutePath val projectManagerEx = ProjectManagerEx.getInstanceEx() - val project = loadProjectWithName(projectPath, projectName) - ?: error("project $projectName at $projectPath is not loaded") + val project = loadProjectWithName(path, projectName) + ?: error("project $projectName at $path is not loaded") runWriteAction { ProjectRootManager.getInstance(project).projectSdk = jdk } - assertTrue(projectManagerEx.openProject(project), "project $projectName at $projectPath is not opened") + assertTrue(projectManagerEx.openProject(project), "project $projectName at $path is not opened") return project } @@ -78,17 +80,18 @@ enum class ProjectOpenAction { GRADLE_PROJECT { override fun openProject(projectPath: String, projectName: String, jdk: Sdk): Project { - val project = ProjectManagerEx.getInstanceEx().loadAndOpenProject(projectPath)!! + val path = File(projectPath).absolutePath + val project = ProjectManagerEx.getInstanceEx().loadAndOpenProject(path)!! assertTrue( !project.isDisposed, - "Gradle project $projectName at $projectPath is accidentally disposed immediately after import" + "Gradle project $projectName at $path is accidentally disposed immediately after import" ) runWriteAction { ProjectRootManager.getInstance(project).projectSdk = jdk } - refreshGradleProject(projectPath, project) + refreshGradleProject(path, project) return project } From daf42c1ee65200571e678b6cd2e7c729b4ea0fb3 Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov Date: Thu, 3 Dec 2020 13:37:29 +0300 Subject: [PATCH 417/698] [Commonizer] Remove unnecessary nullability at CirKnownClassifiers.commonDependeeLibraries --- .../descriptors/commonizer/core/CommonizationVisitor.kt | 2 +- .../descriptors/commonizer/core/TypeAliasCommonizer.kt | 2 +- .../kotlin/descriptors/commonizer/core/TypeCommonizer.kt | 4 ++-- .../commonizer/mergedtree/CirClassifiersCache.kt | 7 ++++++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/CommonizationVisitor.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/CommonizationVisitor.kt index 69fac2e3e63..366833e705b 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/CommonizationVisitor.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/CommonizationVisitor.kt @@ -128,7 +128,7 @@ internal class CommonizationVisitor( val supertypesMap: MutableMap> = linkedMapOf() // preserve supertype order for ((index, typeAlias) in targetDeclarations.withIndex()) { val expandedClassId = typeAlias!!.expandedType.classifierId - if (classifiers.commonDependeeLibraries?.hasClassifier(expandedClassId) == true) + if (classifiers.commonDependeeLibraries.hasClassifier(expandedClassId)) return null // this case is not supported yet val expandedClassNode = classifiers.commonized.classNode(expandedClassId) ?: return null diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeAliasCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeAliasCommonizer.kt index 00d9beee173..e17566f0886 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeAliasCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeAliasCommonizer.kt @@ -76,7 +76,7 @@ private class TypeAliasShortCircuitingCommonizer( private tailrec fun computeCommonizedUnderlyingType(underlyingType: CirClassOrTypeAliasType): CirClassOrTypeAliasType { return when (underlyingType) { is CirClassType -> underlyingType - is CirTypeAliasType -> if (classifiers.commonDependeeLibraries?.hasClassifier(underlyingType.classifierId) == true) + is CirTypeAliasType -> if (classifiers.commonDependeeLibraries.hasClassifier(underlyingType.classifierId)) underlyingType else computeCommonizedUnderlyingType(underlyingType.underlyingType) diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeCommonizer.kt index b0e0d909ed4..9c3d1a70c48 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/core/TypeCommonizer.kt @@ -220,7 +220,7 @@ private class TypeArgumentListCommonizer(classifiers: CirKnownClassifiers) : Abs ) private fun commonizeClass(classId: ClassId, classifiers: CirKnownClassifiers): Boolean { - if (classifiers.commonDependeeLibraries?.hasClassifier(classId) == true) { + if (classifiers.commonDependeeLibraries.hasClassifier(classId)) { // The class is from common fragment of dependee library (ex: stdlib). Already commonized. return true } else if (classId.packageFqName.isUnderKotlinNativeSyntheticPackages) { @@ -247,7 +247,7 @@ private fun commonizeClass(classId: ClassId, classifiers: CirKnownClassifiers): } private fun commonizeTypeAlias(typeAliasId: ClassId, classifiers: CirKnownClassifiers): CommonizedTypeAliasAnswer { - if (classifiers.commonDependeeLibraries?.hasClassifier(typeAliasId) == true) { + if (classifiers.commonDependeeLibraries.hasClassifier(typeAliasId)) { // The type alias is from common fragment of dependee library (ex: stdlib). Already commonized. return SUCCESS_FROM_DEPENDEE_LIBRARY } diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirClassifiersCache.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirClassifiersCache.kt index bc5175d92c0..f9ced646b45 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirClassifiersCache.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirClassifiersCache.kt @@ -25,7 +25,8 @@ class CirKnownClassifiers( val dependeeLibraries: Map ) { // a shortcut for fast access - val commonDependeeLibraries: CirProvidedClassifiers? = dependeeLibraries.filterKeys { it is SharedTarget }.values.singleOrNull() + val commonDependeeLibraries: CirProvidedClassifiers = + dependeeLibraries.filterKeys { it is SharedTarget }.values.singleOrNull() ?: CirProvidedClassifiers.EMPTY } interface CirCommonizedClassifiers { @@ -86,6 +87,10 @@ interface CirProvidedClassifiers { //fun classifier(classifierId: ClassId): Any? companion object { + internal val EMPTY = object : CirProvidedClassifiers { + override fun hasClassifier(classifierId: ClassId) = false + } + // N.B. This is suboptimal implementation. It will be replaced by another implementation that will // retrieve classifier information directly from the metadata. fun fromModules(storageManager: StorageManager, modules: () -> Collection) = object : CirProvidedClassifiers { From e5c46a86aa52e4658253f08f15ccda82fe2bf51e Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov Date: Thu, 3 Dec 2020 13:38:18 +0300 Subject: [PATCH 418/698] [Commonizer] Minor. Rename file --- .../{CirClassifiersCache.kt => classifierContainers.kt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/{CirClassifiersCache.kt => classifierContainers.kt} (100%) diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirClassifiersCache.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/classifierContainers.kt similarity index 100% rename from native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirClassifiersCache.kt rename to native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/classifierContainers.kt From fae5b8da4bc2a47b2258d4dd996d79a86e460db9 Mon Sep 17 00:00:00 2001 From: Mads Ager Date: Tue, 1 Dec 2020 13:41:24 +0100 Subject: [PATCH 419/698] [JVM] Do not put the name of default lambda parameter in LVT. If we do, the local variable table will not make sense. As as example: ``` inline fun foo(getString: () -> String = { "OK" }) { println(getString()) } inline fun bar() { } fun main() { bar() foo() } ``` leads to the following bytecode: ``` public static final void main(); descriptor: ()V flags: ACC_PUBLIC, ACC_STATIC, ACC_FINAL Code: stack=2, locals=4, args_size=0 0: iconst_0 1: istore_0 2: nop 3: nop 4: iconst_0 5: istore_1 6: nop 7: ldc #53 // String OK 9: astore_2 10: iconst_0 11: istore_3 12: getstatic #30 // Field java/lang/System.out:Ljava/io/PrintStream; 15: aload_2 16: invokevirtual #36 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V 19: nop 20: return LineNumberTable: line 9: 0 line 13: 2 line 10: 3 line 14: 4 line 15: 6 line 16: 7 line 17: 19 line 11: 20 LocalVariableTable: Start Length Slot Name Signature 2 1 0 $i$f$bar I 6 14 1 $i$f$foo I 4 16 0 getString$iv Lkotlin/jvm/functions/Function0; ``` The `getString$iv` local should not be there. It has been inlined away. Leaving it in the local variable table leads to inconsistent locals info. Local 0 contains an int but we declare a local of type Function0. --- .../codegen/inline/defaultMethodUtil.kt | 4 +++- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 +++++ .../codegen/box/coroutines/kt42554.kt | 9 +++++++++ .../function/defaultLambdaInline.kt | 7 +++++++ .../lambdaInlining/genericLambda.kt | 3 --- .../lambdaInlining/simpleGeneric.kt | 3 --- .../jetbrains/kotlin/codegen/D8Checker.java | 20 ++++++++++++++++++- .../codegen/BlackBoxCodegenTestGenerated.java | 5 +++++ .../LightAnalysisModeTestGenerated.java | 5 +++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 5 +++++ .../IrJsCodegenBoxES6TestGenerated.java | 5 +++++ .../IrJsCodegenBoxTestGenerated.java | 5 +++++ .../semantics/JsCodegenBoxTestGenerated.java | 5 +++++ .../IrCodegenBoxWasmTestGenerated.java | 5 +++++ 14 files changed, 78 insertions(+), 8 deletions(-) create mode 100644 compiler/testData/codegen/box/defaultArguments/function/defaultLambdaInline.kt diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/defaultMethodUtil.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/defaultMethodUtil.kt index e4653049b18..f83e2d48305 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/defaultMethodUtil.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/defaultMethodUtil.kt @@ -130,7 +130,9 @@ fun expandMaskConditionsAndUpdateVariableNodes( node.instructions.insert(position, newInsn) } - node.localVariables.removeIf { it.start in toDelete && it.end in toDelete } + node.localVariables.removeIf { + (it.start in toDelete && it.end in toDelete) || defaultLambdas.contains(it.index) + } node.remove(toDelete) diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index da2726859e0..0ede1cab971 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -9843,6 +9843,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/defaultArguments/function/covariantOverrideGeneric.kt"); } + @TestMetadata("defaultLambdaInline.kt") + public void testDefaultLambdaInline() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/function/defaultLambdaInline.kt"); + } + @TestMetadata("extensionFunctionManyArgs.kt") public void testExtensionFunctionManyArgs() throws Exception { runTest("compiler/testData/codegen/box/defaultArguments/function/extensionFunctionManyArgs.kt"); diff --git a/compiler/testData/codegen/box/coroutines/kt42554.kt b/compiler/testData/codegen/box/coroutines/kt42554.kt index 24b0dbf609c..9db7f4ff185 100644 --- a/compiler/testData/codegen/box/coroutines/kt42554.kt +++ b/compiler/testData/codegen/box/coroutines/kt42554.kt @@ -1,5 +1,14 @@ // WITH_RUNTIME +// Need to ignore dexing for now. This generates invalid inner-class attributes on the IR backend. +// +// java.lang.AssertionError: D8 dexing error: D8 dexing info: Malformed inner-class attribute: +// outerTypeInternal: C$result$1 +// innerTypeInternal: C$no_name_in_PSI_3d19d79d_1ba9_4cd0_b7f5_b46aa3cd5d40$WhenMappings +// innerName: WhenMappings +// +// IGNORE_DEXING + import kotlin.coroutines.* fun launch(block: suspend () -> String): String { diff --git a/compiler/testData/codegen/box/defaultArguments/function/defaultLambdaInline.kt b/compiler/testData/codegen/box/defaultArguments/function/defaultLambdaInline.kt new file mode 100644 index 00000000000..5ea7219d744 --- /dev/null +++ b/compiler/testData/codegen/box/defaultArguments/function/defaultLambdaInline.kt @@ -0,0 +1,7 @@ +inline fun f(getString: () -> String = { "OK" }) = getString() +inline fun g() { } + +fun box(): String { + g() + return f() +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/genericLambda.kt b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/genericLambda.kt index f425be21738..9886812a50b 100644 --- a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/genericLambda.kt +++ b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/genericLambda.kt @@ -1,6 +1,3 @@ -// Enable for dexing once we have a D8 version with a fix for -// https://issuetracker.google.com/148661132 -// IGNORE_DEXING // NO_CHECK_LAMBDA_INLINING // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/simpleGeneric.kt b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/simpleGeneric.kt index a12b033da38..8a5c76bffdb 100644 --- a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/simpleGeneric.kt +++ b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/simpleGeneric.kt @@ -1,6 +1,3 @@ -// Enable for dexing once we have a D8 version with a fix for -// https://issuetracker.google.com/148661132 -// IGNORE_DEXING // FILE: 1.kt // SKIP_INLINE_CHECK_IN: inlineFun$default package test diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/D8Checker.java b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/D8Checker.java index c7856c4bc25..e91232a3cbd 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/D8Checker.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/D8Checker.java @@ -40,9 +40,27 @@ public class D8Checker { }); } + // Compilation with D8 should proceed with no output. There should be no info, warnings, or errors. + static class TestDiagnosticsHandler implements DiagnosticsHandler { + @Override + public void error(Diagnostic diagnostic) { + Assert.fail("D8 dexing error: " + diagnostic.getDiagnosticMessage()); + } + + @Override + public void warning(Diagnostic diagnostic) { + Assert.fail("D8 dexing warning: " + diagnostic.getDiagnosticMessage()); + } + + @Override + public void info(Diagnostic diagnostic) { + Assert.fail("D8 dexing info: " + diagnostic.getDiagnosticMessage()); + } + } + private static void runD8(Consumer addInput) { ProgramConsumer ignoreOutputConsumer = new DexIndexedConsumer.ForwardingConsumer(null); - D8Command.Builder builder = D8Command.builder() + D8Command.Builder builder = D8Command.builder(new TestDiagnosticsHandler()) .setMinApiLevel(28) .setMode(CompilationMode.DEBUG) .setProgramConsumer(ignoreOutputConsumer); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 2b539076b31..f04fc8ffa0e 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -11243,6 +11243,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/defaultArguments/function/covariantOverrideGeneric.kt"); } + @TestMetadata("defaultLambdaInline.kt") + public void testDefaultLambdaInline() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/function/defaultLambdaInline.kt"); + } + @TestMetadata("extensionFunctionManyArgs.kt") public void testExtensionFunctionManyArgs() throws Exception { runTest("compiler/testData/codegen/box/defaultArguments/function/extensionFunctionManyArgs.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index a190e8c247f..2c3efe42faa 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -11243,6 +11243,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/defaultArguments/function/covariantOverrideGeneric.kt"); } + @TestMetadata("defaultLambdaInline.kt") + public void testDefaultLambdaInline() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/function/defaultLambdaInline.kt"); + } + @TestMetadata("extensionFunctionManyArgs.kt") public void testExtensionFunctionManyArgs() throws Exception { runTest("compiler/testData/codegen/box/defaultArguments/function/extensionFunctionManyArgs.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 856d146d81d..de8382c8918 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -9843,6 +9843,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/defaultArguments/function/covariantOverrideGeneric.kt"); } + @TestMetadata("defaultLambdaInline.kt") + public void testDefaultLambdaInline() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/function/defaultLambdaInline.kt"); + } + @TestMetadata("extensionFunctionManyArgs.kt") public void testExtensionFunctionManyArgs() throws Exception { runTest("compiler/testData/codegen/box/defaultArguments/function/extensionFunctionManyArgs.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index ab656bc1582..78071508f99 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -8353,6 +8353,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/defaultArguments/function/covariantOverrideGeneric.kt"); } + @TestMetadata("defaultLambdaInline.kt") + public void testDefaultLambdaInline() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/function/defaultLambdaInline.kt"); + } + @TestMetadata("extensionFunctionManyArgs.kt") public void testExtensionFunctionManyArgs() throws Exception { runTest("compiler/testData/codegen/box/defaultArguments/function/extensionFunctionManyArgs.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 191c494524a..fdac53b6054 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -8353,6 +8353,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/defaultArguments/function/covariantOverrideGeneric.kt"); } + @TestMetadata("defaultLambdaInline.kt") + public void testDefaultLambdaInline() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/function/defaultLambdaInline.kt"); + } + @TestMetadata("extensionFunctionManyArgs.kt") public void testExtensionFunctionManyArgs() throws Exception { runTest("compiler/testData/codegen/box/defaultArguments/function/extensionFunctionManyArgs.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 82fc5e0759a..22d7d2d69cc 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -8353,6 +8353,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/defaultArguments/function/covariantOverrideGeneric.kt"); } + @TestMetadata("defaultLambdaInline.kt") + public void testDefaultLambdaInline() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/function/defaultLambdaInline.kt"); + } + @TestMetadata("extensionFunctionManyArgs.kt") public void testExtensionFunctionManyArgs() throws Exception { runTest("compiler/testData/codegen/box/defaultArguments/function/extensionFunctionManyArgs.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index 38e97a4ec19..d7532a786f2 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -4033,6 +4033,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/defaultArguments/function/covariantOverrideGeneric.kt"); } + @TestMetadata("defaultLambdaInline.kt") + public void testDefaultLambdaInline() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/function/defaultLambdaInline.kt"); + } + @TestMetadata("extensionFunctionManyArgs.kt") public void testExtensionFunctionManyArgs() throws Exception { runTest("compiler/testData/codegen/box/defaultArguments/function/extensionFunctionManyArgs.kt"); From c776fcbd00e979e29202131aebf7f676aafa53b8 Mon Sep 17 00:00:00 2001 From: Mads Ager Date: Tue, 1 Dec 2020 15:20:22 +0100 Subject: [PATCH 420/698] [JVM_IR] Fix incorrect name in inner class attributes. --- .../jetbrains/kotlin/backend/jvm/codegen/IrTypeMapper.kt | 9 ++++----- compiler/testData/codegen/box/coroutines/kt42554.kt | 9 --------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrTypeMapper.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrTypeMapper.kt index 03c0bf9a014..43ed5866694 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrTypeMapper.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrTypeMapper.kt @@ -53,6 +53,10 @@ class IrTypeMapper(private val context: JvmBackendContext) : KotlinTypeMapperBas } private fun computeClassInternalName(irClass: IrClass): StringBuilder { + context.getLocalClassType(irClass)?.internalName?.let { + return StringBuilder(it) + } + val shortName = SpecialNames.safeIdentifier(irClass.name).identifier when (val parent = irClass.parent) { @@ -73,11 +77,6 @@ class IrTypeMapper(private val context: JvmBackendContext) : KotlinTypeMapperBas } } - val localClassType = context.getLocalClassType(irClass) - if (localClassType != null) { - return StringBuilder(localClassType.internalName) - } - error( "Local class should have its name computed in InventNamesForLocalClasses: ${irClass.fqNameWhenAvailable}\n" + "Ensure that any lowering that transforms elements with local class info (classes, function references) " + diff --git a/compiler/testData/codegen/box/coroutines/kt42554.kt b/compiler/testData/codegen/box/coroutines/kt42554.kt index 9db7f4ff185..24b0dbf609c 100644 --- a/compiler/testData/codegen/box/coroutines/kt42554.kt +++ b/compiler/testData/codegen/box/coroutines/kt42554.kt @@ -1,14 +1,5 @@ // WITH_RUNTIME -// Need to ignore dexing for now. This generates invalid inner-class attributes on the IR backend. -// -// java.lang.AssertionError: D8 dexing error: D8 dexing info: Malformed inner-class attribute: -// outerTypeInternal: C$result$1 -// innerTypeInternal: C$no_name_in_PSI_3d19d79d_1ba9_4cd0_b7f5_b46aa3cd5d40$WhenMappings -// innerName: WhenMappings -// -// IGNORE_DEXING - import kotlin.coroutines.* fun launch(block: suspend () -> String): String { From caea0a9df097f121e68fe785b082274669ca0da5 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Thu, 3 Dec 2020 14:15:04 +0300 Subject: [PATCH 421/698] JVM_IR KT-43721 coerce intrinsic result to corresponding unsigned type --- .../ir/FirBlackBoxCodegenTestGenerated.java | 53 +++++++++++++++++++ .../JvmStandardLibraryBuiltInsLowering.kt | 21 ++++++-- .../jvm8Intrinsics/unsignedIntCompare_jvm8.kt | 14 +++++ .../jvm8Intrinsics/unsignedIntDivide_jvm8.kt | 14 +++++ .../unsignedIntRemainder_jvm8.kt | 15 ++++++ .../unsignedIntToString_jvm8.kt | 16 ++++++ .../unsignedLongCompare_jvm8.kt | 14 +++++ .../jvm8Intrinsics/unsignedLongDivide_jvm8.kt | 18 +++++++ .../unsignedLongRemainder_jvm8.kt | 15 ++++++ .../unsignedLongToString_jvm8.kt | 16 ++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 53 +++++++++++++++++++ .../LightAnalysisModeTestGenerated.java | 53 +++++++++++++++++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 53 +++++++++++++++++++ .../IrJsCodegenBoxES6TestGenerated.java | 13 +++++ .../IrJsCodegenBoxTestGenerated.java | 13 +++++ .../semantics/JsCodegenBoxTestGenerated.java | 13 +++++ .../IrCodegenBoxWasmTestGenerated.java | 13 +++++ 17 files changed, 403 insertions(+), 4 deletions(-) create mode 100644 compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntCompare_jvm8.kt create mode 100644 compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntDivide_jvm8.kt create mode 100644 compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntRemainder_jvm8.kt create mode 100644 compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntToString_jvm8.kt create mode 100644 compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongCompare_jvm8.kt create mode 100644 compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongDivide_jvm8.kt create mode 100644 compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongRemainder_jvm8.kt create mode 100644 compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongToString_jvm8.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 0ede1cab971..d9bbbc1acf7 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -32308,6 +32308,59 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT public void testWhenByUnsigned() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/whenByUnsigned.kt"); } + + @TestMetadata("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Jvm8Intrinsics extends AbstractFirBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); + } + + public void testAllFilesPresentInJvm8Intrinsics() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("unsignedIntCompare_jvm8.kt") + public void testUnsignedIntCompare_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntCompare_jvm8.kt"); + } + + @TestMetadata("unsignedIntDivide_jvm8.kt") + public void testUnsignedIntDivide_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntDivide_jvm8.kt"); + } + + @TestMetadata("unsignedIntRemainder_jvm8.kt") + public void testUnsignedIntRemainder_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntRemainder_jvm8.kt"); + } + + @TestMetadata("unsignedIntToString_jvm8.kt") + public void testUnsignedIntToString_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntToString_jvm8.kt"); + } + + @TestMetadata("unsignedLongCompare_jvm8.kt") + public void testUnsignedLongCompare_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongCompare_jvm8.kt"); + } + + @TestMetadata("unsignedLongDivide_jvm8.kt") + public void testUnsignedLongDivide_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongDivide_jvm8.kt"); + } + + @TestMetadata("unsignedLongRemainder_jvm8.kt") + public void testUnsignedLongRemainder_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongRemainder_jvm8.kt"); + } + + @TestMetadata("unsignedLongToString_jvm8.kt") + public void testUnsignedLongToString_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongToString_jvm8.kt"); + } + } } @TestMetadata("compiler/testData/codegen/box/vararg") diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmStandardLibraryBuiltInsLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmStandardLibraryBuiltInsLowering.kt index 73a80287ddd..487693fb370 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmStandardLibraryBuiltInsLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmStandardLibraryBuiltInsLowering.kt @@ -14,8 +14,9 @@ import org.jetbrains.kotlin.ir.expressions.IrCall import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol -import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.types.* import org.jetbrains.kotlin.ir.util.fqNameForIrSerialization +import org.jetbrains.kotlin.ir.util.render import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid internal val jvmStandardLibraryBuiltInsPhase = makeIrFilePhase( @@ -60,11 +61,14 @@ class JvmStandardLibraryBuiltInsLowering(val context: JvmBackendContext) : FileL // Originals are so far only instance methods, and the replacements are // statics, so we copy dispatch receivers to a value argument if needed. // If we can't coerce arguments to required types, keep original expression (see below). - private fun IrCall.replaceWithCallTo(replacement: IrSimpleFunctionSymbol): IrCall = - IrCallImpl.fromSymbolOwner( + private fun IrCall.replaceWithCallTo(replacement: IrSimpleFunctionSymbol): IrExpression { + val expectedType = this.type + val intrinsicCallType = replacement.owner.returnType + + val intrinsicCall = IrCallImpl.fromSymbolOwner( startOffset, endOffset, - type, + intrinsicCallType, replacement ).also { newCall -> var valueArgumentOffset = 0 @@ -81,6 +85,15 @@ class JvmStandardLibraryBuiltInsLowering(val context: JvmBackendContext) : FileL } } + // Coerce intrinsic call result from JVM 'int' or 'long' to corresponding unsigned type if required. + return if (intrinsicCallType.isInt() || intrinsicCallType.isLong()) { + intrinsicCall.coerceIfPossible(expectedType) + ?: throw AssertionError("Can't coerce '${intrinsicCallType.render()}' to '${expectedType.render()}'") + } else { + intrinsicCall + } + } + private fun IrExpression.coerceIfPossible(toType: IrType): IrExpression? { // TODO maybe UnsafeCoerce could handle types with different, but coercible underlying representations. // See KT-43286 and related tests for details. diff --git a/compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntCompare_jvm8.kt b/compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntCompare_jvm8.kt new file mode 100644 index 00000000000..a1f10a5282f --- /dev/null +++ b/compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntCompare_jvm8.kt @@ -0,0 +1,14 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME +// JVM_TARGET: 1.8 + +val ua = 1234U +val ub = 5678U + +fun box(): String { + if (ua.compareTo(ub) > 0) { + throw AssertionError() + } + + return "OK" +} diff --git a/compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntDivide_jvm8.kt b/compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntDivide_jvm8.kt new file mode 100644 index 00000000000..b680a05b61f --- /dev/null +++ b/compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntDivide_jvm8.kt @@ -0,0 +1,14 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME +// JVM_TARGET: 1.8 + +val ua = 1234U +val ub = 5678U +val u = ua * ub + +fun box(): String { + val div = u / ua + if (div != ub) throw AssertionError("$div") + + return "OK" +} diff --git a/compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntRemainder_jvm8.kt b/compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntRemainder_jvm8.kt new file mode 100644 index 00000000000..57de3060b4f --- /dev/null +++ b/compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntRemainder_jvm8.kt @@ -0,0 +1,15 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME +// JVM_TARGET: 1.8 + +val ua = 1234U +val ub = 5678U +val uc = 3456U +val u = ua * ub + uc + +fun box(): String { + val rem = u % ub + if (rem != uc) throw AssertionError("$rem") + + return "OK" +} diff --git a/compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntToString_jvm8.kt b/compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntToString_jvm8.kt new file mode 100644 index 00000000000..227808f95e2 --- /dev/null +++ b/compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntToString_jvm8.kt @@ -0,0 +1,16 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME +// JVM_TARGET: 1.8 + +fun box(): String { + val min = 0U.toString() + if ("0" != min) throw AssertionError(min) + + val middle = 2_147_483_647U.toString() + if ("2147483647" != middle) throw AssertionError(middle) + + val max = 4_294_967_295U.toString() + if ("4294967295" != max) throw AssertionError(max) + + return "OK" +} diff --git a/compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongCompare_jvm8.kt b/compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongCompare_jvm8.kt new file mode 100644 index 00000000000..55975b6bd92 --- /dev/null +++ b/compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongCompare_jvm8.kt @@ -0,0 +1,14 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME +// JVM_TARGET: 1.8 + +val ua = 1234UL +val ub = 5678UL + +fun box(): String { + if (ua.compareTo(ub) > 0) { + throw AssertionError() + } + + return "OK" +} diff --git a/compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongDivide_jvm8.kt b/compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongDivide_jvm8.kt new file mode 100644 index 00000000000..6168f176677 --- /dev/null +++ b/compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongDivide_jvm8.kt @@ -0,0 +1,18 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME +// JVM_TARGET: 1.8 + +val ua = 1234UL +val ub = 5678UL +val uai = ua.toUInt() +val u = ua * ub + +fun box(): String { + val div = u / ua + if (div != ub) throw AssertionError("$div") + + val divInt = u / uai + if (div != ub) throw AssertionError("$div") + + return "OK" +} diff --git a/compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongRemainder_jvm8.kt b/compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongRemainder_jvm8.kt new file mode 100644 index 00000000000..19536182398 --- /dev/null +++ b/compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongRemainder_jvm8.kt @@ -0,0 +1,15 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME +// JVM_TARGET: 1.8 + +val ua = 1234UL +val ub = 5678UL +val uc = 3456UL +val u = ua * ub + uc + +fun box(): String { + val rem = u % ub + if (rem != uc) throw AssertionError("$rem") + + return "OK" +} diff --git a/compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongToString_jvm8.kt b/compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongToString_jvm8.kt new file mode 100644 index 00000000000..04b3e708ef2 --- /dev/null +++ b/compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongToString_jvm8.kt @@ -0,0 +1,16 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME +// JVM_TARGET: 1.8 + +fun box(): String { + val min = 0UL.toString() + if ("0" != min) throw AssertionError(min) + + val middle = 9_223_372_036_854_775_807UL.toString() + if ("9223372036854775807" != middle) throw AssertionError(middle) + + val max = 18_446_744_073_709_551_615UL.toString() + if ("18446744073709551615" != max) throw AssertionError(max) + + return "OK" +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index f04fc8ffa0e..2c84c045c40 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -34079,6 +34079,59 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { public void testWhenByUnsigned() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/whenByUnsigned.kt"); } + + @TestMetadata("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Jvm8Intrinsics extends AbstractBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInJvm8Intrinsics() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("unsignedIntCompare_jvm8.kt") + public void testUnsignedIntCompare_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntCompare_jvm8.kt"); + } + + @TestMetadata("unsignedIntDivide_jvm8.kt") + public void testUnsignedIntDivide_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntDivide_jvm8.kt"); + } + + @TestMetadata("unsignedIntRemainder_jvm8.kt") + public void testUnsignedIntRemainder_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntRemainder_jvm8.kt"); + } + + @TestMetadata("unsignedIntToString_jvm8.kt") + public void testUnsignedIntToString_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntToString_jvm8.kt"); + } + + @TestMetadata("unsignedLongCompare_jvm8.kt") + public void testUnsignedLongCompare_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongCompare_jvm8.kt"); + } + + @TestMetadata("unsignedLongDivide_jvm8.kt") + public void testUnsignedLongDivide_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongDivide_jvm8.kt"); + } + + @TestMetadata("unsignedLongRemainder_jvm8.kt") + public void testUnsignedLongRemainder_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongRemainder_jvm8.kt"); + } + + @TestMetadata("unsignedLongToString_jvm8.kt") + public void testUnsignedLongToString_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongToString_jvm8.kt"); + } + } } @TestMetadata("compiler/testData/codegen/box/vararg") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 2c3efe42faa..b858d41dc56 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -31713,6 +31713,59 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes public void testWhenByUnsigned() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/whenByUnsigned.kt"); } + + @TestMetadata("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Jvm8Intrinsics extends AbstractLightAnalysisModeTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInJvm8Intrinsics() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("unsignedIntCompare_jvm8.kt") + public void testUnsignedIntCompare_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntCompare_jvm8.kt"); + } + + @TestMetadata("unsignedIntDivide_jvm8.kt") + public void testUnsignedIntDivide_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntDivide_jvm8.kt"); + } + + @TestMetadata("unsignedIntRemainder_jvm8.kt") + public void testUnsignedIntRemainder_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntRemainder_jvm8.kt"); + } + + @TestMetadata("unsignedIntToString_jvm8.kt") + public void testUnsignedIntToString_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntToString_jvm8.kt"); + } + + @TestMetadata("unsignedLongCompare_jvm8.kt") + public void testUnsignedLongCompare_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongCompare_jvm8.kt"); + } + + @TestMetadata("unsignedLongDivide_jvm8.kt") + public void testUnsignedLongDivide_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongDivide_jvm8.kt"); + } + + @TestMetadata("unsignedLongRemainder_jvm8.kt") + public void testUnsignedLongRemainder_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongRemainder_jvm8.kt"); + } + + @TestMetadata("unsignedLongToString_jvm8.kt") + public void testUnsignedLongToString_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongToString_jvm8.kt"); + } + } } @TestMetadata("compiler/testData/codegen/box/vararg") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index de8382c8918..5a5577df85a 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -32308,6 +32308,59 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes public void testWhenByUnsigned() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/whenByUnsigned.kt"); } + + @TestMetadata("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Jvm8Intrinsics extends AbstractIrBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInJvm8Intrinsics() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("unsignedIntCompare_jvm8.kt") + public void testUnsignedIntCompare_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntCompare_jvm8.kt"); + } + + @TestMetadata("unsignedIntDivide_jvm8.kt") + public void testUnsignedIntDivide_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntDivide_jvm8.kt"); + } + + @TestMetadata("unsignedIntRemainder_jvm8.kt") + public void testUnsignedIntRemainder_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntRemainder_jvm8.kt"); + } + + @TestMetadata("unsignedIntToString_jvm8.kt") + public void testUnsignedIntToString_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedIntToString_jvm8.kt"); + } + + @TestMetadata("unsignedLongCompare_jvm8.kt") + public void testUnsignedLongCompare_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongCompare_jvm8.kt"); + } + + @TestMetadata("unsignedLongDivide_jvm8.kt") + public void testUnsignedLongDivide_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongDivide_jvm8.kt"); + } + + @TestMetadata("unsignedLongRemainder_jvm8.kt") + public void testUnsignedLongRemainder_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongRemainder_jvm8.kt"); + } + + @TestMetadata("unsignedLongToString_jvm8.kt") + public void testUnsignedLongToString_jvm8() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics/unsignedLongToString_jvm8.kt"); + } + } } @TestMetadata("compiler/testData/codegen/box/vararg") diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index 78071508f99..f7c791c06be 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -26239,6 +26239,19 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes public void testWhenByUnsigned() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/whenByUnsigned.kt"); } + + @TestMetadata("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Jvm8Intrinsics extends AbstractIrJsCodegenBoxES6Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); + } + + public void testAllFilesPresentInJvm8Intrinsics() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + } } @TestMetadata("compiler/testData/codegen/box/vararg") diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index fdac53b6054..ee3c62390c2 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -26239,6 +26239,19 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { public void testWhenByUnsigned() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/whenByUnsigned.kt"); } + + @TestMetadata("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Jvm8Intrinsics extends AbstractIrJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInJvm8Intrinsics() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + } } @TestMetadata("compiler/testData/codegen/box/vararg") diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 22d7d2d69cc..4a23106375d 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -26239,6 +26239,19 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { public void testWhenByUnsigned() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/whenByUnsigned.kt"); } + + @TestMetadata("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Jvm8Intrinsics extends AbstractJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); + } + + public void testAllFilesPresentInJvm8Intrinsics() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + } } @TestMetadata("compiler/testData/codegen/box/vararg") diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index d7532a786f2..edfa36732fd 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -14402,6 +14402,19 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest public void testUnsignedToSignedConversion() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/unsignedToSignedConversion.kt"); } + + @TestMetadata("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Jvm8Intrinsics extends AbstractIrCodegenBoxWasmTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath); + } + + public void testAllFilesPresentInJvm8Intrinsics() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/unsignedTypes/jvm8Intrinsics"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); + } + } } @TestMetadata("compiler/testData/codegen/box/vararg") From a9c072f826122eccdb681e9aaef40bfd8c0146c7 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Thu, 3 Dec 2020 17:02:35 +0100 Subject: [PATCH 422/698] Regenerate compiler tests --- .../kotlin/codegen/LightAnalysisModeTestGenerated.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index b858d41dc56..6cffdcee944 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -30849,11 +30849,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public static class ToArray extends AbstractLightAnalysisModeTest { - @TestMetadata("toArrayFromJava.kt") - public void ignoreToArrayFromJava() throws Exception { - runTest("compiler/testData/codegen/box/toArray/toArrayFromJava.kt"); - } - private void runTest(String testDataFilePath) throws Exception { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } @@ -30887,6 +30882,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/toArray/toArrayAlreadyPresent.kt"); } + @TestMetadata("toArrayFromJava.kt") + public void testToArrayFromJava() throws Exception { + runTest("compiler/testData/codegen/box/toArray/toArrayFromJava.kt"); + } + @TestMetadata("toArrayShouldBePublic.kt") public void testToArrayShouldBePublic() throws Exception { runTest("compiler/testData/codegen/box/toArray/toArrayShouldBePublic.kt"); From 516fce37dbee308c873b358f4d40a68ebafea8db Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Wed, 2 Dec 2020 20:14:43 +0100 Subject: [PATCH 423/698] Value classes: Allow unsigned arrays in annotations including varargs, apparently. So, we allow unsigned types and unsigned arrays in annotations, but disallow user-defined inline classes. #KT-23816 Fixed --- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 ++ .../resolve/CollectionLiteralResolver.kt | 9 ++- .../resolve/CompileTimeConstantUtils.java | 9 ++- .../evaluateConstructorOfUnsignedArrayType.kt | 68 +++++++++++++++++++ .../inlineClasses/annotationGetters.kt | 19 ++++++ .../inlineClasses/annotationGetters.txt | 16 +++++ .../allowedVarargsOfUnsignedTypes.kt | 2 +- .../codegen/BlackBoxCodegenTestGenerated.java | 5 ++ .../codegen/BytecodeListingTestGenerated.java | 5 ++ .../LightAnalysisModeTestGenerated.java | 5 ++ .../ir/IrBlackBoxCodegenTestGenerated.java | 5 ++ .../ir/IrBytecodeListingTestGenerated.java | 5 ++ .../kotlin/builtins/StandardNames.kt | 4 ++ .../kotlin/builtins/KotlinBuiltIns.java | 20 ++++++ .../jetbrains/kotlin/builtins/UnsignedType.kt | 52 ++++++++++++++ .../resolve/constants/constantValues.kt | 8 ++- 16 files changed, 229 insertions(+), 8 deletions(-) create mode 100644 compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedArrayType.kt create mode 100644 compiler/testData/codegen/bytecodeListing/inlineClasses/annotationGetters.kt create mode 100644 compiler/testData/codegen/bytecodeListing/inlineClasses/annotationGetters.txt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index d9bbbc1acf7..48e13480e7a 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -32129,6 +32129,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/unsignedTypes/equalsImplForInlineClassWrappingNullableInlineClass.kt"); } + @TestMetadata("evaluateConstructorOfUnsignedArrayType.kt") + public void testEvaluateConstructorOfUnsignedArrayType() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedArrayType.kt"); + } + @TestMetadata("evaluateConstructorOfUnsignedType.kt") public void testEvaluateConstructorOfUnsignedType() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedType.kt"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/CollectionLiteralResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/CollectionLiteralResolver.kt index aa56d037e33..6b357d83556 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/CollectionLiteralResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/CollectionLiteralResolver.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.resolve import com.intellij.psi.util.PsiTreeUtil import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.builtins.StandardNames +import org.jetbrains.kotlin.builtins.UnsignedTypes import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.config.LanguageVersionSettings import org.jetbrains.kotlin.descriptors.ModuleDescriptor @@ -93,12 +94,16 @@ class CollectionLiteralResolver( } private fun getArrayFunctionCallName(expectedType: KotlinType): Name { - if (NO_EXPECTED_TYPE === expectedType || !KotlinBuiltIns.isPrimitiveArray(expectedType)) { + if (NO_EXPECTED_TYPE === expectedType || + !(KotlinBuiltIns.isPrimitiveArray(expectedType) || KotlinBuiltIns.isUnsignedArrayType(expectedType)) + ) { return ArrayFqNames.ARRAY_OF_FUNCTION } val descriptor = expectedType.constructor.declarationDescriptor ?: return ArrayFqNames.ARRAY_OF_FUNCTION - return ArrayFqNames.PRIMITIVE_TYPE_TO_ARRAY[KotlinBuiltIns.getPrimitiveArrayType(descriptor)] ?: ArrayFqNames.ARRAY_OF_FUNCTION + return ArrayFqNames.PRIMITIVE_TYPE_TO_ARRAY[KotlinBuiltIns.getPrimitiveArrayType(descriptor)] + ?: UnsignedTypes.unsignedArrayTypeToArrayCall[UnsignedTypes.toUnsignedArrayType(descriptor)] + ?: ArrayFqNames.ARRAY_OF_FUNCTION } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/CompileTimeConstantUtils.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/CompileTimeConstantUtils.java index 011cd05d1b1..0906933f0e0 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/CompileTimeConstantUtils.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/CompileTimeConstantUtils.java @@ -59,7 +59,11 @@ public class CompileTimeConstantUtils { "kotlin.shortArrayOf", "kotlin.byteArrayOf", "kotlin.booleanArrayOf", - "kotlin.emptyArray" + "kotlin.emptyArray", + "kotlin.ubyteArrayOf", + "kotlin.ushortArrayOf", + "kotlin.uintArrayOf", + "kotlin.ulongArrayOf" ); public static void checkConstructorParametersType(@NotNull List parameters, @NotNull BindingTrace trace) { @@ -91,7 +95,8 @@ public class CompileTimeConstantUtils { KotlinBuiltIns.isPrimitiveArray(parameterType) || KotlinBuiltIns.isPrimitiveType(parameterType) || KotlinBuiltIns.isString(parameterType) || - UnsignedTypes.INSTANCE.isUnsignedType(parameterType)) { + UnsignedTypes.isUnsignedType(parameterType) || + UnsignedTypes.isUnsignedArrayType(parameterType)) { return true; } diff --git a/compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedArrayType.kt b/compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedArrayType.kt new file mode 100644 index 00000000000..257877a592f --- /dev/null +++ b/compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedArrayType.kt @@ -0,0 +1,68 @@ +// IGNORE_BACKEND_FIR: JVM_IR +// WITH_REFLECT +// TARGET_BACKEND: JVM + +annotation class AnnoUB(val ub: UByteArray) +annotation class AnnoUS(val us: UShortArray) +annotation class AnnoUI(val ui: UIntArray) +annotation class AnnoUL(val ul: ULongArray) + +@Suppress("INVISIBLE_MEMBER") +const val ub0 = UByte(1) +@Suppress("INVISIBLE_MEMBER") +const val us0 = UShort(2) +@Suppress("INVISIBLE_MEMBER") +const val ul0 = ULong(3) + +@Suppress("INVISIBLE_MEMBER") +const val ui0 = UInt(-1) +@Suppress("INVISIBLE_MEMBER") +const val ui1 = UInt(0) +@Suppress("INVISIBLE_MEMBER") +const val ui2 = UInt(40 + 2) + +@Suppress("INVISIBLE_MEMBER") +object Foo { + @AnnoUB([UByte(1), ub0]) + fun f0() {} + + @AnnoUS([UShort(2 + 5), us0]) + fun f1() {} + + @AnnoUI([ui0, ui1, ui2, UInt(100)]) + fun f2() {} + + @AnnoUL([ul0, ULong(5)]) + fun f3() {} +} + +fun check(ann: Annotation, f: T.() -> Boolean) { + val result = (ann as T).f() + if (!result) throw RuntimeException("fail for $ann") +} + +@Suppress("INVISIBLE_MEMBER") +fun box(): String { + if (ub0.toByte() != 1.toByte()) return "fail" + if (us0.toShort() != 2.toShort()) return "fail" + if (ul0.toLong() != 3L) return "fail" + if ((ui0 + ui1 + ui2).toInt() != 41) return "fail" + + check(Foo::f0.annotations.first()) { + this.ub[0] == UByte(1) && this.ub[1] == UByte(1) + } + + check(Foo::f1.annotations.first()) { + this.us[0] == UShort(7) && this.us[1] == UShort(2) + } + + check(Foo::f2.annotations.first()) { + this.ui[0] == UInt.MAX_VALUE && this.ui[1] == UInt(0) && this.ui[2] == UInt(42) && this.ui[3] == UInt(100) + } + + check(Foo::f3.annotations.first()) { + this.ul[0] == ULong(3) && this.ul[1] == ULong(5) + } + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/annotationGetters.kt b/compiler/testData/codegen/bytecodeListing/inlineClasses/annotationGetters.kt new file mode 100644 index 00000000000..21911eac793 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/annotationGetters.kt @@ -0,0 +1,19 @@ +// !LANGUAGE: +InlineClasses +// WITH_RUNTIME + +annotation class Ann( + val u: UInt, + val uba: UByteArray, + val usa: UShortArray, + val uia: UIntArray, + val ula: ULongArray +) + +@Ann( + 1u, + [1u], + ushortArrayOf(), + [1u, 1u], + ulongArrayOf(1u, 1u) +) +fun foo() {} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/annotationGetters.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/annotationGetters.txt new file mode 100644 index 00000000000..bf0a9158cb1 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/annotationGetters.txt @@ -0,0 +1,16 @@ +@java.lang.annotation.Retention +@kotlin.Metadata +public annotation class Ann { + // source: 'annotationGetters.kt' + public abstract method u(): int + public abstract method uba(): byte[] + public abstract method uia(): int[] + public abstract method ula(): long[] + public abstract method usa(): short[] +} + +@kotlin.Metadata +public final class AnnotationGettersKt { + // source: 'annotationGetters.kt' + public final static @Ann method foo(): void +} diff --git a/compiler/testData/diagnostics/testsWithUnsignedTypes/allowedVarargsOfUnsignedTypes.kt b/compiler/testData/diagnostics/testsWithUnsignedTypes/allowedVarargsOfUnsignedTypes.kt index e25d1f0d2b7..bd99c3ecfec 100644 --- a/compiler/testData/diagnostics/testsWithUnsignedTypes/allowedVarargsOfUnsignedTypes.kt +++ b/compiler/testData/diagnostics/testsWithUnsignedTypes/allowedVarargsOfUnsignedTypes.kt @@ -7,6 +7,6 @@ fun ulong(vararg a: ULong) {} class ValueParam(vararg val a: ULong) -annotation class Ann(vararg val a: UInt) +annotation class Ann(vararg val a: UInt) fun array(vararg a: UIntArray) {} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 2c84c045c40..d311c012888 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -33900,6 +33900,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/unsignedTypes/equalsImplForInlineClassWrappingNullableInlineClass.kt"); } + @TestMetadata("evaluateConstructorOfUnsignedArrayType.kt") + public void testEvaluateConstructorOfUnsignedArrayType() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedArrayType.kt"); + } + @TestMetadata("evaluateConstructorOfUnsignedType.kt") public void testEvaluateConstructorOfUnsignedType() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedType.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index b762ed65377..87f63b5435b 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -975,6 +975,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/annotatedPropertyWithInlineClassTypeInSignature.kt"); } + @TestMetadata("annotationGetters.kt") + public void testAnnotationGetters() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/annotationGetters.kt"); + } + @TestMetadata("annotationsOnHiddenConstructor.kt") public void testAnnotationsOnHiddenConstructor() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/annotationsOnHiddenConstructor.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 6cffdcee944..dbfd03b0ea2 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -31534,6 +31534,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/unsignedTypes/equalsImplForInlineClassWrappingNullableInlineClass.kt"); } + @TestMetadata("evaluateConstructorOfUnsignedArrayType.kt") + public void testEvaluateConstructorOfUnsignedArrayType() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedArrayType.kt"); + } + @TestMetadata("evaluateConstructorOfUnsignedType.kt") public void testEvaluateConstructorOfUnsignedType() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedType.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 5a5577df85a..08eaf8c8cfd 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -32129,6 +32129,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/unsignedTypes/equalsImplForInlineClassWrappingNullableInlineClass.kt"); } + @TestMetadata("evaluateConstructorOfUnsignedArrayType.kt") + public void testEvaluateConstructorOfUnsignedArrayType() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedArrayType.kt"); + } + @TestMetadata("evaluateConstructorOfUnsignedType.kt") public void testEvaluateConstructorOfUnsignedType() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedType.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index 1561bc7a3f1..3bf0870ddbb 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -945,6 +945,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/annotatedPropertyWithInlineClassTypeInSignature.kt"); } + @TestMetadata("annotationGetters.kt") + public void testAnnotationGetters() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/annotationGetters.kt"); + } + @TestMetadata("annotationsOnHiddenConstructor.kt") public void testAnnotationsOnHiddenConstructor() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/annotationsOnHiddenConstructor.kt"); diff --git a/core/compiler.common/src/org/jetbrains/kotlin/builtins/StandardNames.kt b/core/compiler.common/src/org/jetbrains/kotlin/builtins/StandardNames.kt index 25c7dca454c..da825427116 100644 --- a/core/compiler.common/src/org/jetbrains/kotlin/builtins/StandardNames.kt +++ b/core/compiler.common/src/org/jetbrains/kotlin/builtins/StandardNames.kt @@ -153,6 +153,10 @@ object StandardNames { @JvmField val uShort: ClassId = ClassId.topLevel(uShortFqName) @JvmField val uInt: ClassId = ClassId.topLevel(uIntFqName) @JvmField val uLong: ClassId = ClassId.topLevel(uLongFqName) + @JvmField val uByteArrayFqName: FqName = fqName("UByteArray") + @JvmField val uShortArrayFqName: FqName = fqName("UShortArray") + @JvmField val uIntArrayFqName: FqName = fqName("UIntArray") + @JvmField val uLongArrayFqName: FqName = fqName("ULongArray") @JvmField val primitiveTypeShortNames: Set = newHashSetWithExpectedSize(PrimitiveType.values().size).apply { PrimitiveType.values().mapTo(this) { it.typeName } diff --git a/core/descriptors/src/org/jetbrains/kotlin/builtins/KotlinBuiltIns.java b/core/descriptors/src/org/jetbrains/kotlin/builtins/KotlinBuiltIns.java index 415884e612a..d0bfb5fcaf8 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/builtins/KotlinBuiltIns.java +++ b/core/descriptors/src/org/jetbrains/kotlin/builtins/KotlinBuiltIns.java @@ -819,6 +819,26 @@ public abstract class KotlinBuiltIns { return isConstructedFromGivenClassAndNotNullable(type, FqNames.uLongFqName.toUnsafe()); } + public static boolean isUByteArray(@NotNull KotlinType type) { + return isConstructedFromGivenClassAndNotNullable(type, FqNames.uByteArrayFqName.toUnsafe()); + } + + public static boolean isUShortArray(@NotNull KotlinType type) { + return isConstructedFromGivenClassAndNotNullable(type, FqNames.uShortArrayFqName.toUnsafe()); + } + + public static boolean isUIntArray(@NotNull KotlinType type) { + return isConstructedFromGivenClassAndNotNullable(type, FqNames.uIntArrayFqName.toUnsafe()); + } + + public static boolean isULongArray(@NotNull KotlinType type) { + return isConstructedFromGivenClassAndNotNullable(type, FqNames.uLongArrayFqName.toUnsafe()); + } + + public static boolean isUnsignedArrayType(@NotNull KotlinType type) { + return isUByteArray(type) || isUShortArray(type) || isUIntArray(type) || isULongArray(type); + } + public static boolean isDoubleOrNullableDouble(@NotNull KotlinType type) { return isConstructedFromGivenClass(type, FqNames._double); } diff --git a/core/descriptors/src/org/jetbrains/kotlin/builtins/UnsignedType.kt b/core/descriptors/src/org/jetbrains/kotlin/builtins/UnsignedType.kt index 3e565bdb624..1d2c41e3869 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/builtins/UnsignedType.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/builtins/UnsignedType.kt @@ -23,10 +23,26 @@ enum class UnsignedType(val classId: ClassId) { val arrayClassId = ClassId(classId.packageFqName, Name.identifier(typeName.asString() + "Array")) } +enum class UnsignedArrayType(val classId: ClassId) { + UBYTEARRAY(ClassId.fromString("kotlin/UByteArray")), + USHORTARRAY(ClassId.fromString("kotlin/UShortArray")), + UINTARRAY(ClassId.fromString("kotlin/UIntArray")), + ULONGARRAY(ClassId.fromString("kotlin/ULongArray")); + + val typeName = classId.shortClassName +} + object UnsignedTypes { private val unsignedTypeNames = enumValues().map { it.typeName }.toSet() + private val unsignedArrayTypeNames = enumValues().map { it.typeName }.toSet() private val arrayClassIdToUnsignedClassId = hashMapOf() private val unsignedClassIdToArrayClassId = hashMapOf() + val unsignedArrayTypeToArrayCall = hashMapOf( + UnsignedArrayType.UBYTEARRAY to Name.identifier("ubyteArrayOf"), + UnsignedArrayType.USHORTARRAY to Name.identifier("ushortArrayOf"), + UnsignedArrayType.UINTARRAY to Name.identifier("uintArrayOf"), + UnsignedArrayType.ULONGARRAY to Name.identifier("ulongArrayOf"), + ) private val arrayClassesShortNames: Set = UnsignedType.values().mapTo(mutableSetOf()) { it.arrayClassId.shortClassName } @@ -66,4 +82,40 @@ object UnsignedTypes { container.fqName == StandardNames.BUILT_INS_PACKAGE_FQ_NAME && descriptor.name in UnsignedTypes.unsignedTypeNames } + + @JvmStatic + fun isUnsignedArrayType(type: KotlinType): Boolean { + if (TypeUtils.noExpectedType(type)) return false + + val descriptor = type.constructor.declarationDescriptor ?: return false + return isUnsignedArrayClass(descriptor) + } + + @JvmStatic + fun toUnsignedArrayType(type: KotlinType): UnsignedArrayType? = + when { + KotlinBuiltIns.isUByteArray(type) -> UnsignedArrayType.UBYTEARRAY + KotlinBuiltIns.isUShortArray(type) -> UnsignedArrayType.USHORTARRAY + KotlinBuiltIns.isUIntArray(type) -> UnsignedArrayType.UINTARRAY + KotlinBuiltIns.isULongArray(type) -> UnsignedArrayType.ULONGARRAY + else -> null + } + + @JvmStatic + fun toUnsignedArrayType(descriptor: DeclarationDescriptor): UnsignedArrayType? = + if (!isUnsignedArrayClass(descriptor)) null + else when (descriptor.name.asString()) { + "UByteArray" -> UnsignedArrayType.UBYTEARRAY + "UShortArray" -> UnsignedArrayType.USHORTARRAY + "UIntArray" -> UnsignedArrayType.UINTARRAY + "ULongArray" -> UnsignedArrayType.ULONGARRAY + else -> null + } + + fun isUnsignedArrayClass(descriptor: DeclarationDescriptor): Boolean { + val container = descriptor.containingDeclaration + return container is PackageFragmentDescriptor && + container.fqName == StandardNames.BUILT_INS_PACKAGE_FQ_NAME && + descriptor.name in unsignedArrayTypeNames + } } diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/constants/constantValues.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/constants/constantValues.kt index 0590d3e8dfd..a952785bb88 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/constants/constantValues.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/constants/constantValues.kt @@ -56,11 +56,13 @@ class AnnotationValue(value: AnnotationDescriptor) : ConstantValue>, - private val computeType: (ModuleDescriptor) -> KotlinType + value: List>, + private val computeType: (ModuleDescriptor) -> KotlinType ) : ConstantValue>>(value) { override fun getType(module: ModuleDescriptor): KotlinType = computeType(module).also { type -> - assert(KotlinBuiltIns.isArray(type) || KotlinBuiltIns.isPrimitiveArray(type)) { "Type should be an array, but was $type: $value" } + assert(KotlinBuiltIns.isArray(type) || KotlinBuiltIns.isPrimitiveArray(type) || KotlinBuiltIns.isUnsignedArrayType(type)) { + "Type should be an array, but was $type: $value" + } } override fun accept(visitor: AnnotationArgumentVisitor, data: D) = visitor.visitArrayValue(this, data) From c9806c5af9e4efc6cda3a75588c73d69d35aaea4 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 24 Nov 2020 12:06:02 +0300 Subject: [PATCH 424/698] [FIR] Simplify RedundantExplicitTypeChecker --- .../extended/RedundantExplicitTypeChecker.kt | 28 ++++--------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantExplicitTypeChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantExplicitTypeChecker.kt index 023416a2536..cdc4e17f832 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantExplicitTypeChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantExplicitTypeChecker.kt @@ -7,8 +7,6 @@ package org.jetbrains.kotlin.fir.analysis.checkers.extended import org.jetbrains.kotlin.KtNodeTypes import org.jetbrains.kotlin.fir.FirFakeSourceElementKind -import org.jetbrains.kotlin.fir.FirLightSourceElement -import org.jetbrains.kotlin.fir.FirPsiSourceElement import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.declaration.FirMemberDeclarationChecker import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter @@ -17,14 +15,11 @@ import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration import org.jetbrains.kotlin.fir.declarations.FirProperty import org.jetbrains.kotlin.fir.declarations.FirTypeAlias import org.jetbrains.kotlin.fir.expressions.* -import org.jetbrains.kotlin.fir.psi import org.jetbrains.kotlin.fir.references.FirNamedReference import org.jetbrains.kotlin.fir.symbols.StandardClassIds -import org.jetbrains.kotlin.fir.types.ConeKotlinType -import org.jetbrains.kotlin.fir.types.FirTypeRef -import org.jetbrains.kotlin.fir.types.classId -import org.jetbrains.kotlin.fir.types.coneType +import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.name.ClassId +import org.jetbrains.kotlin.name.Name object RedundantExplicitTypeChecker : FirMemberDeclarationChecker() { override fun check(declaration: FirMemberDeclaration, context: CheckerContext, reporter: DiagnosticReporter) { @@ -71,10 +66,10 @@ object RedundantExplicitTypeChecker : FirMemberDeclarationChecker() { } } is FirNamedReference -> { - if (typeReference.text != initializer.name.identifier) return + if (!type.hasSameNameWithoutModifiers(initializer.name)) return } is FirFunctionCall -> { - if (typeReference.text != initializer.calleeReference.name.asString()) return + if (!type.hasSameNameWithoutModifiers(initializer.calleeReference.name)) return } is FirGetClassCall -> { return @@ -91,23 +86,12 @@ object RedundantExplicitTypeChecker : FirMemberDeclarationChecker() { reporter.report(declaration.returnTypeRef.source, FirErrors.REDUNDANT_EXPLICIT_TYPE) } - private val FirTypeRef.text: String? - get() { - return when (source) { - is FirPsiSourceElement<*> -> { - source.psi?.text - } - is FirLightSourceElement -> { - source?.lighterASTNode?.toString() - } - else -> null - } - } - private fun ConeKotlinType.isSame(other: ClassId?): Boolean { if (this.nullability.isNullable) return false if (this.type.classId == other) return true return false } + private fun ConeKotlinType.hasSameNameWithoutModifiers(name: Name): Boolean = + this is ConeClassLikeType && lookupTag.name == name && typeArguments.isEmpty() && !isMarkedNullable } \ No newline at end of file From ea7d738ee19abd7d1da0b4aa1bd6ea25dada71c9 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 24 Nov 2020 16:09:50 +0300 Subject: [PATCH 425/698] [FIR] Introduce & use SourceElementPositioningStrategies.OPERATOR --- .../extended/ArrayEqualityCanBeReplacedWithEquals.kt | 5 +---- .../CanBeReplacedWithOperatorAssignmentChecker.kt | 4 +--- .../kotlin/fir/analysis/diagnostics/FirErrors.kt | 4 ++-- .../diagnostics/LightTreePositioningStrategies.kt | 9 +++++++++ .../diagnostics/SourceElementPositioningStrategies.kt | 5 +++++ .../kotlin/diagnostics/PositioningStrategies.kt | 10 ++++++++++ 6 files changed, 28 insertions(+), 9 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/ArrayEqualityCanBeReplacedWithEquals.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/ArrayEqualityCanBeReplacedWithEquals.kt index a2099c7d415..b42e7616fc2 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/ArrayEqualityCanBeReplacedWithEquals.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/ArrayEqualityCanBeReplacedWithEquals.kt @@ -9,7 +9,6 @@ import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.expression.FirBasicExpressionChecker import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS -import org.jetbrains.kotlin.fir.analysis.getChild import org.jetbrains.kotlin.fir.expressions.FirEqualityOperatorCall import org.jetbrains.kotlin.fir.expressions.FirOperation import org.jetbrains.kotlin.fir.expressions.FirStatement @@ -17,7 +16,6 @@ import org.jetbrains.kotlin.fir.expressions.arguments import org.jetbrains.kotlin.fir.symbols.StandardClassIds import org.jetbrains.kotlin.fir.types.classId import org.jetbrains.kotlin.fir.types.coneType -import org.jetbrains.kotlin.lexer.KtTokens object ArrayEqualityCanBeReplacedWithEquals : FirBasicExpressionChecker() { override fun check(expression: FirStatement, context: CheckerContext, reporter: DiagnosticReporter) { @@ -29,7 +27,6 @@ object ArrayEqualityCanBeReplacedWithEquals : FirBasicExpressionChecker() { if (left.typeRef.coneType.classId != StandardClassIds.Array) return if (right.typeRef.coneType.classId != StandardClassIds.Array) return - val source = expression.source?.getChild(setOf(KtTokens.EQEQ, KtTokens.EXCLEQ)) - reporter.report(source, ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS) + reporter.report(expression.source, ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS) } } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeReplacedWithOperatorAssignmentChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeReplacedWithOperatorAssignmentChecker.kt index 23ae31cc624..7d67c465f4e 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeReplacedWithOperatorAssignmentChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeReplacedWithOperatorAssignmentChecker.kt @@ -14,7 +14,6 @@ import org.jetbrains.kotlin.fir.analysis.checkers.expression.FirExpressionChecke import org.jetbrains.kotlin.fir.analysis.checkers.getChildren import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors -import org.jetbrains.kotlin.fir.analysis.getChild import org.jetbrains.kotlin.fir.expressions.FirFunctionCall import org.jetbrains.kotlin.fir.expressions.FirVariableAssignment import org.jetbrains.kotlin.fir.expressions.toResolvedCallableSymbol @@ -59,8 +58,7 @@ object CanBeReplacedWithOperatorAssignmentChecker : FirExpressionChecker() val REDUNDANT_SINGLE_EXPRESSION_STRING_TEMPLATE by warning0() val CAN_BE_VAL by warning0() - val CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT by warning0() + val CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT by warning0(SourceElementPositioningStrategies.OPERATOR) val REDUNDANT_CALL_OF_CONVERSION_METHOD by warning0() - val ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS by warning0() + val ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS by warning0(SourceElementPositioningStrategies.OPERATOR) val EMPTY_RANGE by warning0() val REDUNDANT_SETTER_PARAMETER_TYPE by warning0() val UNUSED_VARIABLE by warning0() diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt index b06f912bbda..c54e0704f2f 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt @@ -142,6 +142,12 @@ object LightTreePositioningStrategies { return super.mark(node, tree) } } + + val OPERATOR: LightTreePositioningStrategy = object : LightTreePositioningStrategy() { + override fun mark(node: LighterASTNode, tree: FlyweightCapableTreeStructure): List { + return markElement(tree.operationReference(node) ?: node, tree) + } + } } fun FirSourceElement.hasValOrVar(): Boolean = @@ -162,6 +168,9 @@ private fun FlyweightCapableTreeStructure.initKeyword(node: Ligh private fun FlyweightCapableTreeStructure.nameIdentifier(node: LighterASTNode): LighterASTNode? = findChildByType(node, KtTokens.IDENTIFIER) +private fun FlyweightCapableTreeStructure.operationReference(node: LighterASTNode): LighterASTNode? = + findChildByType(node, KtNodeTypes.OPERATION_REFERENCE) + private fun FlyweightCapableTreeStructure.rightParenthesis(node: LighterASTNode): LighterASTNode? = findChildByType(node, KtTokens.RPAR) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt index ddeef166db0..b17ce744feb 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt @@ -32,4 +32,9 @@ object SourceElementPositioningStrategies { LightTreePositioningStrategies.DECLARATION_SIGNATURE, PositioningStrategies.DECLARATION_SIGNATURE ) + + val OPERATOR = SourceElementPositioningStrategy( + LightTreePositioningStrategies.OPERATOR, + PositioningStrategies.OPERATOR + ) } \ No newline at end of file diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt index 0e3917bb3fa..ecbffa93870 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt @@ -687,4 +687,14 @@ object PositioningStrategies { return DEFAULT.mark(element) } } + + val OPERATOR: PositioningStrategy = object : PositioningStrategy() { + override fun mark(element: KtExpression): List { + return when (element) { + is KtBinaryExpression -> mark(element.operationReference) + is KtUnaryExpression -> mark(element.operationReference) + else -> super.mark(element) + } + } + } } From 38779339131ed545dba7bad267571340d6c67203 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 24 Nov 2020 16:17:13 +0300 Subject: [PATCH 426/698] [FIR] Adapt VAL_OR_VAR strategy & use it in CanBeValChecker --- .../kotlin/fir/analysis/checkers/extended/CanBeValChecker.kt | 4 +--- .../jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt | 2 +- .../jetbrains/kotlin/diagnostics/PositioningStrategies.kt | 5 +++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeValChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeValChecker.kt index 0525e53a240..f24ae12cb09 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeValChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeValChecker.kt @@ -12,11 +12,9 @@ import org.jetbrains.kotlin.fir.analysis.cfa.* import org.jetbrains.kotlin.fir.analysis.checkers.getChildren import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors -import org.jetbrains.kotlin.fir.analysis.getChild import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference import org.jetbrains.kotlin.fir.resolve.dfa.cfg.* import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol -import org.jetbrains.kotlin.lexer.KtTokens object CanBeValChecker : AbstractFirPropertyInitializationChecker() { override fun analyze( @@ -42,7 +40,7 @@ object CanBeValChecker : AbstractFirPropertyInitializationChecker() { var lastDestructuredVariables = 0 for ((symbol, value) in propertiesCharacteristics) { - val source = symbol.fir.source?.getChild(setOf(KtTokens.VAL_KEYWORD, KtTokens.VAR_KEYWORD), depth = 1) + val source = symbol.fir.source if (symbol.isDestructuring) { lastDestructuringSource = source lastDestructuredVariables = symbol.getDestructuringChildrenCount() ?: continue diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt index 7b31ea83432..ab2cfa3e2c0 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt @@ -159,7 +159,7 @@ object FirErrors { val REDUNDANT_RETURN_UNIT_TYPE by warning0() val REDUNDANT_EXPLICIT_TYPE by warning0() val REDUNDANT_SINGLE_EXPRESSION_STRING_TEMPLATE by warning0() - val CAN_BE_VAL by warning0() + val CAN_BE_VAL by warning0(SourceElementPositioningStrategies.VAL_OR_VAR_NODE) val CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT by warning0(SourceElementPositioningStrategies.OPERATOR) val REDUNDANT_CALL_OF_CONVERSION_METHOD by warning0() val ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS by warning0(SourceElementPositioningStrategies.OPERATOR) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt index ecbffa93870..545bd85c01b 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt @@ -477,11 +477,12 @@ object PositioningStrategies { } @JvmField - val VAL_OR_VAR_NODE: PositioningStrategy = object : PositioningStrategy() { - override fun mark(element: KtNamedDeclaration): List { + val VAL_OR_VAR_NODE: PositioningStrategy = object : PositioningStrategy() { + override fun mark(element: KtDeclaration): List { return when (element) { is KtParameter -> markElement(element.valOrVarKeyword ?: element) is KtProperty -> markElement(element.valOrVarKeyword) + is KtDestructuringDeclaration -> markElement(element.valOrVarKeyword ?: element) else -> error("Declaration is neither a parameter nor a property: " + element.getElementTextWithContext()) } } From 7f1b539011af9390dfcf9ad3072542bcb6542c96 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 1 Dec 2020 11:05:12 +0300 Subject: [PATCH 427/698] [FIR] Simplify CanBeValChecker.getDestructuringChildrenCount --- .../analysis/checkers/extended/CanBeValChecker.kt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeValChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeValChecker.kt index f24ae12cb09..389c6fd59d3 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeValChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeValChecker.kt @@ -95,15 +95,11 @@ object CanBeValChecker : AbstractFirPropertyInitializationChecker() { } } - private fun FirPropertySymbol.getDestructuringChildrenCount(): Int? = when (fir.source) { - is FirPsiSourceElement<*> -> fir.psi?.children?.size?.minus(1) // -1 cuz we don't need expression node after equals operator - is FirLightSourceElement -> { - val source = fir.source as FirLightSourceElement - val tree = (fir.source as FirLightSourceElement).treeStructure - val children = source.lighterASTNode.getChildren(tree) - children.filter { it?.tokenType == KtNodeTypes.DESTRUCTURING_DECLARATION_ENTRY }.size + private fun FirPropertySymbol.getDestructuringChildrenCount(): Int? { + val source = fir.source ?: return null + return source.lighterASTNode.getChildren(source.treeStructure).count { + it?.tokenType == KtNodeTypes.DESTRUCTURING_DECLARATION_ENTRY } - else -> null } private val FirPropertySymbol.isDestructuring From b1c9d4b0463d1048d36cbeca9e8a3fd68f203057 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 24 Nov 2020 17:07:33 +0300 Subject: [PATCH 428/698] [FIR] Introduce & use VISIBILITY_MODIFIER positioning strategy --- .../RedundantVisibilityModifierChecker.kt | 3 +-- .../fir/analysis/diagnostics/FirErrors.kt | 2 +- .../LightTreePositioningStrategies.kt | 19 +++++++++++++++++++ .../SourceElementPositioningStrategies.kt | 5 +++++ .../diagnostics/PositioningStrategies.kt | 7 +++---- 5 files changed, 29 insertions(+), 7 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantVisibilityModifierChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantVisibilityModifierChecker.kt index 272a0eeff28..d9551921c51 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantVisibilityModifierChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantVisibilityModifierChecker.kt @@ -16,7 +16,6 @@ import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.declaration.FirBasicDeclarationChecker import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors -import org.jetbrains.kotlin.fir.analysis.getChild import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.lexer.KtModifierKeywordToken import org.jetbrains.kotlin.lexer.KtTokens @@ -56,7 +55,7 @@ object RedundantVisibilityModifierChecker : FirBasicDeclarationChecker() { && declaration.setter?.visibility == Visibilities.Public ) return - reporter.report(declaration.source?.getChild(KtTokens.VISIBILITY_MODIFIERS), FirErrors.REDUNDANT_VISIBILITY_MODIFIER) + reporter.report(declaration.source, FirErrors.REDUNDANT_VISIBILITY_MODIFIER) } private fun FirDeclaration.implicitVisibility(context: CheckerContext): Visibility { diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt index ab2cfa3e2c0..536e4bd3711 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt @@ -154,7 +154,7 @@ object FirErrors { val WRONG_IMPLIES_CONDITION by error0() // Extended checkers group - val REDUNDANT_VISIBILITY_MODIFIER by warning0() + val REDUNDANT_VISIBILITY_MODIFIER by warning0(SourceElementPositioningStrategies.VISIBILITY_MODIFIER) val REDUNDANT_MODALITY_MODIFIER by warning0() val REDUNDANT_RETURN_UNIT_TYPE by warning0() val REDUNDANT_EXPLICIT_TYPE by warning0() diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt index c54e0704f2f..43f112837f7 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt @@ -143,6 +143,22 @@ object LightTreePositioningStrategies { } } + val VISIBILITY_MODIFIER: LightTreePositioningStrategy = object : LightTreePositioningStrategy() { + override fun mark(node: LighterASTNode, tree: FlyweightCapableTreeStructure): List { + tree.visibilityModifier(node)?.let { return markElement(it, tree) } + tree.nameIdentifier(node)?.let { return markElement(it, tree) } + return when (node.tokenType) { + KtNodeTypes.OBJECT_DECLARATION -> { + markElement(tree.objectKeyword(node)!!, tree) + } + KtNodeTypes.PROPERTY_ACCESSOR -> { + markElement(tree.accessorNamePlaceholder(node), tree) + } + else -> markElement(node, tree) + } + } + } + val OPERATOR: LightTreePositioningStrategy = object : LightTreePositioningStrategy() { override fun mark(node: LighterASTNode, tree: FlyweightCapableTreeStructure): List { return markElement(tree.operationReference(node) ?: node, tree) @@ -180,6 +196,9 @@ private fun FlyweightCapableTreeStructure.objectKeyword(node: Li private fun FlyweightCapableTreeStructure.valOrVarKeyword(node: LighterASTNode): LighterASTNode? = findChildByType(node, VAL_VAR_TOKEN_SET) +private fun FlyweightCapableTreeStructure.visibilityModifier(node: LighterASTNode): LighterASTNode? = + findChildByType(node, KtTokens.VISIBILITY_MODIFIERS) + private fun FlyweightCapableTreeStructure.accessorNamePlaceholder(node: LighterASTNode): LighterASTNode = findChildByType(node, KtTokens.GET_KEYWORD) ?: findChildByType(node, KtTokens.SET_KEYWORD)!! diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt index b17ce744feb..f5efd5b8b60 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt @@ -33,6 +33,11 @@ object SourceElementPositioningStrategies { PositioningStrategies.DECLARATION_SIGNATURE ) + val VISIBILITY_MODIFIER = SourceElementPositioningStrategy( + LightTreePositioningStrategies.VISIBILITY_MODIFIER, + PositioningStrategies.VISIBILITY_MODIFIER + ) + val OPERATOR = SourceElementPositioningStrategy( LightTreePositioningStrategies.OPERATOR, PositioningStrategies.OPERATOR diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt index 545bd85c01b..721d31e708a 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt @@ -17,6 +17,7 @@ import org.jetbrains.kotlin.diagnostics.Errors.ACTUAL_WITHOUT_EXPECT import org.jetbrains.kotlin.diagnostics.Errors.NO_ACTUAL_FOR_EXPECT import org.jetbrains.kotlin.lexer.KtModifierKeywordToken import org.jetbrains.kotlin.lexer.KtTokens +import org.jetbrains.kotlin.lexer.KtTokens.VISIBILITY_MODIFIERS import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.* import org.jetbrains.kotlin.resolve.multiplatform.ExpectedActualResolver.Compatibility.Incompatible @@ -405,12 +406,10 @@ object PositioningStrategies { @JvmField val VISIBILITY_MODIFIER: PositioningStrategy = object : PositioningStrategy() { override fun mark(element: KtModifierListOwner): List { - val visibilityTokens = - listOf(KtTokens.PRIVATE_KEYWORD, KtTokens.PROTECTED_KEYWORD, KtTokens.PUBLIC_KEYWORD, KtTokens.INTERNAL_KEYWORD) val modifierList = element.modifierList - val result = visibilityTokens.mapNotNull { modifierList?.getModifier(it)?.textRange } - if (!result.isEmpty()) return result + val result = VISIBILITY_MODIFIERS.types.mapNotNull { modifierList?.getModifier(it as KtModifierKeywordToken)?.textRange } + if (result.isNotEmpty()) return result // Try to resolve situation when there's no visibility modifiers written before element if (element is PsiNameIdentifierOwner) { From 54f9edb597c77f586337b4d8e7679f2d694be29e Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 1 Dec 2020 11:43:21 +0300 Subject: [PATCH 429/698] Simplify RedundantVisibilityModifierChecker --- .../RedundantVisibilityModifierChecker.kt | 32 +++++++------------ 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantVisibilityModifierChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantVisibilityModifierChecker.kt index d9551921c51..94030703087 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantVisibilityModifierChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantVisibilityModifierChecker.kt @@ -16,33 +16,31 @@ import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.declaration.FirBasicDeclarationChecker import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors +import org.jetbrains.kotlin.fir.analysis.diagnostics.overrideModifier +import org.jetbrains.kotlin.fir.analysis.diagnostics.visibilityModifier import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.lexer.KtModifierKeywordToken -import org.jetbrains.kotlin.lexer.KtTokens object RedundantVisibilityModifierChecker : FirBasicDeclarationChecker() { override fun check(declaration: FirDeclaration, context: CheckerContext, reporter: DiagnosticReporter) { - if (declaration is FirConstructor && declaration.source?.kind is FirFakeSourceElementKind) return - if (declaration.source is FirFakeSourceElement<*>) return + val source = declaration.source ?: return + if (declaration is FirConstructor && source.kind is FirFakeSourceElementKind) return + if (source is FirFakeSourceElement<*>) return if ( declaration !is FirMemberDeclaration && !(declaration is FirPropertyAccessor && declaration.visibility == context.containingPropertyVisibility) ) return - val modifiers = declaration.source.getModifierList() - val visibilityModifier = when (modifiers) { - is FirPsiModifierList -> modifiers.modifierList.getVisibility() - is FirLightModifierList -> modifiers.modifiers.visibilityOrNull() - else -> null - } ?: return + val visibilityModifier = source.treeStructure.visibilityModifier(source.lighterASTNode) + val explicitVisibility = (visibilityModifier?.tokenType as? KtModifierKeywordToken)?.toVisibilityOrNull() val implicitVisibility = declaration.implicitVisibility(context) val containingMemberDeclaration = context.findClosest() val redundantVisibility = when { - visibilityModifier == implicitVisibility -> implicitVisibility - modifiers?.modifiers.hasModifier(KtTokens.INTERNAL_KEYWORD) && + explicitVisibility == implicitVisibility -> implicitVisibility + explicitVisibility == Visibilities.Internal && containingMemberDeclaration.let { decl -> - decl != null && (decl.isLocalMember || modifiers?.modifiers.hasModifier(KtTokens.PRIVATE_KEYWORD)) + decl != null && decl.isLocalMember } -> Visibilities.Internal else -> return } @@ -50,12 +48,12 @@ object RedundantVisibilityModifierChecker : FirBasicDeclarationChecker() { if ( redundantVisibility == Visibilities.Public && declaration is FirProperty - && modifiers?.modifiers.hasModifier(KtTokens.OVERRIDE_KEYWORD) + && source.treeStructure.overrideModifier(source.lighterASTNode) != null && declaration.isVar && declaration.setter?.visibility == Visibilities.Public ) return - reporter.report(declaration.source, FirErrors.REDUNDANT_VISIBILITY_MODIFIER) + reporter.report(source, FirErrors.REDUNDANT_VISIBILITY_MODIFIER) } private fun FirDeclaration.implicitVisibility(context: CheckerContext): Visibility { @@ -125,10 +123,4 @@ object RedundantVisibilityModifierChecker : FirBasicDeclarationChecker() { private val CheckerContext.containingPropertyVisibility get() = (this.containingDeclarations.last() as? FirProperty)?.visibility - - private fun List.visibilityOrNull() = - firstOrNull { it.token.toVisibilityOrNull() != null }?.token?.toVisibilityOrNull() - - private fun List>?.hasModifier(token: KtModifierKeywordToken) = this != null && any { it.token == token } - } From 5fbdc0af5e6a89d52d50a7b3eca3d497ebc04e79 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 25 Nov 2020 13:51:22 +0300 Subject: [PATCH 430/698] [FIR] Introduce & use MODALITY_MODIFIER positioning strategy --- .../RedundantModalityModifierChecker.kt | 11 +++++------ .../fir/analysis/diagnostics/FirErrors.kt | 2 +- .../LightTreePositioningStrategies.kt | 17 +++++++++++++---- .../SourceElementPositioningStrategies.kt | 5 +++++ .../kotlin/diagnostics/PositioningStrategies.kt | 12 +++++++++--- 5 files changed, 33 insertions(+), 14 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantModalityModifierChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantModalityModifierChecker.kt index 3915541e22b..deaaf10ead8 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantModalityModifierChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/RedundantModalityModifierChecker.kt @@ -11,17 +11,17 @@ import org.jetbrains.kotlin.fir.FirFakeSourceElementKind import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.declaration.FirMemberDeclarationChecker import org.jetbrains.kotlin.fir.analysis.checkers.implicitModality -import org.jetbrains.kotlin.fir.analysis.checkers.toToken import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.REDUNDANT_MODALITY_MODIFIER -import org.jetbrains.kotlin.fir.analysis.getChild +import org.jetbrains.kotlin.fir.analysis.diagnostics.modalityModifier import org.jetbrains.kotlin.fir.declarations.FirClass import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration import org.jetbrains.kotlin.fir.declarations.modality object RedundantModalityModifierChecker : FirMemberDeclarationChecker() { override fun check(declaration: FirMemberDeclaration, context: CheckerContext, reporter: DiagnosticReporter) { - if (declaration.source?.kind is FirFakeSourceElementKind) return + val source = declaration.source + if (source?.kind is FirFakeSourceElementKind) return val modality = declaration.modality ?: return if ( @@ -29,11 +29,10 @@ object RedundantModalityModifierChecker : FirMemberDeclarationChecker() { && (context.containingDeclarations.last() as? FirClass<*>)?.classKind == ClassKind.INTERFACE ) return + if (source != null && source.treeStructure.modalityModifier(source.lighterASTNode) == null) return val implicitModality = declaration.implicitModality(context) - if (modality != implicitModality) return - val modalityModifierSource = declaration.source?.getChild(modality.toToken(), depth = 2) - reporter.report(modalityModifierSource, REDUNDANT_MODALITY_MODIFIER) + reporter.report(source, REDUNDANT_MODALITY_MODIFIER) } } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt index 536e4bd3711..981469e9b4b 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt @@ -155,7 +155,7 @@ object FirErrors { // Extended checkers group val REDUNDANT_VISIBILITY_MODIFIER by warning0(SourceElementPositioningStrategies.VISIBILITY_MODIFIER) - val REDUNDANT_MODALITY_MODIFIER by warning0() + val REDUNDANT_MODALITY_MODIFIER by warning0(SourceElementPositioningStrategies.MODALITY_MODIFIER) val REDUNDANT_RETURN_UNIT_TYPE by warning0() val REDUNDANT_EXPLICIT_TYPE by warning0() val REDUNDANT_SINGLE_EXPRESSION_STRING_TEMPLATE by warning0() diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt index 43f112837f7..b4418cf6948 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt @@ -14,6 +14,8 @@ import com.intellij.util.diff.FlyweightCapableTreeStructure import org.jetbrains.kotlin.KtNodeTypes import org.jetbrains.kotlin.fir.FirSourceElement import org.jetbrains.kotlin.lexer.KtTokens +import org.jetbrains.kotlin.lexer.KtTokens.MODALITY_MODIFIERS +import org.jetbrains.kotlin.lexer.KtTokens.VISIBILITY_MODIFIERS import org.jetbrains.kotlin.psi.KtParameter.VAL_VAR_TOKEN_SET object LightTreePositioningStrategies { @@ -143,9 +145,9 @@ object LightTreePositioningStrategies { } } - val VISIBILITY_MODIFIER: LightTreePositioningStrategy = object : LightTreePositioningStrategy() { + private class ModifierSetBasedLightTreePositioningStrategy(private val modifierSet: TokenSet) : LightTreePositioningStrategy() { override fun mark(node: LighterASTNode, tree: FlyweightCapableTreeStructure): List { - tree.visibilityModifier(node)?.let { return markElement(it, tree) } + tree.findChildByType(node, modifierSet)?.let { return markElement(it, tree) } tree.nameIdentifier(node)?.let { return markElement(it, tree) } return when (node.tokenType) { KtNodeTypes.OBJECT_DECLARATION -> { @@ -159,6 +161,10 @@ object LightTreePositioningStrategies { } } + val VISIBILITY_MODIFIER: LightTreePositioningStrategy = ModifierSetBasedLightTreePositioningStrategy(VISIBILITY_MODIFIERS) + + val MODALITY_MODIFIER: LightTreePositioningStrategy = ModifierSetBasedLightTreePositioningStrategy(MODALITY_MODIFIERS) + val OPERATOR: LightTreePositioningStrategy = object : LightTreePositioningStrategy() { override fun mark(node: LighterASTNode, tree: FlyweightCapableTreeStructure): List { return markElement(tree.operationReference(node) ?: node, tree) @@ -196,8 +202,11 @@ private fun FlyweightCapableTreeStructure.objectKeyword(node: Li private fun FlyweightCapableTreeStructure.valOrVarKeyword(node: LighterASTNode): LighterASTNode? = findChildByType(node, VAL_VAR_TOKEN_SET) -private fun FlyweightCapableTreeStructure.visibilityModifier(node: LighterASTNode): LighterASTNode? = - findChildByType(node, KtTokens.VISIBILITY_MODIFIERS) +internal fun FlyweightCapableTreeStructure.visibilityModifier(declaration: LighterASTNode): LighterASTNode? = + modifierList(declaration)?.let { findChildByType(it, VISIBILITY_MODIFIERS) } + +internal fun FlyweightCapableTreeStructure.modalityModifier(declaration: LighterASTNode): LighterASTNode? = + modifierList(declaration)?.let { findChildByType(it, MODALITY_MODIFIERS) } private fun FlyweightCapableTreeStructure.accessorNamePlaceholder(node: LighterASTNode): LighterASTNode = findChildByType(node, KtTokens.GET_KEYWORD) ?: findChildByType(node, KtTokens.SET_KEYWORD)!! diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt index f5efd5b8b60..f5eb8792cea 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt @@ -38,6 +38,11 @@ object SourceElementPositioningStrategies { PositioningStrategies.VISIBILITY_MODIFIER ) + val MODALITY_MODIFIER = SourceElementPositioningStrategy( + LightTreePositioningStrategies.MODALITY_MODIFIER, + PositioningStrategies.MODALITY_MODIFIER + ) + val OPERATOR = SourceElementPositioningStrategy( LightTreePositioningStrategies.OPERATOR, PositioningStrategies.OPERATOR diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt index 721d31e708a..ade1bd61250 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt @@ -17,6 +17,7 @@ import org.jetbrains.kotlin.diagnostics.Errors.ACTUAL_WITHOUT_EXPECT import org.jetbrains.kotlin.diagnostics.Errors.NO_ACTUAL_FOR_EXPECT import org.jetbrains.kotlin.lexer.KtModifierKeywordToken import org.jetbrains.kotlin.lexer.KtTokens +import org.jetbrains.kotlin.lexer.KtTokens.MODALITY_MODIFIERS import org.jetbrains.kotlin.lexer.KtTokens.VISIBILITY_MODIFIERS import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.* @@ -403,12 +404,11 @@ object PositioningStrategies { } } - @JvmField - val VISIBILITY_MODIFIER: PositioningStrategy = object : PositioningStrategy() { + private class ModifierSetBasedPositioningStrategy(private val modifierSet: TokenSet) : PositioningStrategy() { override fun mark(element: KtModifierListOwner): List { val modifierList = element.modifierList - val result = VISIBILITY_MODIFIERS.types.mapNotNull { modifierList?.getModifier(it as KtModifierKeywordToken)?.textRange } + val result = modifierSet.types.mapNotNull { modifierList?.getModifier(it as KtModifierKeywordToken)?.textRange } if (result.isNotEmpty()) return result // Try to resolve situation when there's no visibility modifiers written before element @@ -431,6 +431,12 @@ object PositioningStrategies { } } + @JvmField + val VISIBILITY_MODIFIER: PositioningStrategy = ModifierSetBasedPositioningStrategy(VISIBILITY_MODIFIERS) + + @JvmField + val MODALITY_MODIFIER: PositioningStrategy = ModifierSetBasedPositioningStrategy(MODALITY_MODIFIERS) + @JvmField val VARIANCE_IN_PROJECTION: PositioningStrategy = object : PositioningStrategy() { override fun mark(element: KtTypeProjection): List { From 8abf27898d4d57282281ab09d644d753ec52575c Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 1 Dec 2020 11:20:25 +0300 Subject: [PATCH 431/698] Simplify FirMemberDeclaration.implicitModality --- .../fir/analysis/checkers/FirHelpers.kt | 24 ++++++++++--------- .../LightTreePositioningStrategies.kt | 3 +++ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirHelpers.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirHelpers.kt index 7c70973ee92..b214513dce0 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirHelpers.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirHelpers.kt @@ -12,6 +12,9 @@ import org.jetbrains.kotlin.descriptors.Visibility import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.FirSymbolOwner import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext +import org.jetbrains.kotlin.fir.analysis.diagnostics.modalityModifier +import org.jetbrains.kotlin.fir.analysis.diagnostics.overrideModifier +import org.jetbrains.kotlin.fir.analysis.diagnostics.visibilityModifier import org.jetbrains.kotlin.fir.containingClass import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.expressions.FirFunctionCall @@ -250,20 +253,21 @@ fun FirMemberDeclaration.implicitModality(context: CheckerContext): Modality { } val klass = context.findClosestClassOrObject() ?: return Modality.FINAL - val modifiers = this.modifierListOrNull() ?: return Modality.FINAL - if (modifiers.contains(KtTokens.OVERRIDE_KEYWORD)) { - val klassModifiers = klass.modifierListOrNull() - if (klassModifiers != null && klassModifiers.run { - contains(KtTokens.ABSTRACT_KEYWORD) || contains(KtTokens.OPEN_KEYWORD) || contains(KtTokens.SEALED_KEYWORD) - }) { + val source = source ?: return Modality.FINAL + val tree = source.treeStructure + if (tree.overrideModifier(source.lighterASTNode) != null) { + val klassModalityTokenType = klass.source?.let { tree.modalityModifier(it.lighterASTNode)?.tokenType } + if (klassModalityTokenType == KtTokens.ABSTRACT_KEYWORD || + klassModalityTokenType == KtTokens.OPEN_KEYWORD || + klassModalityTokenType == KtTokens.SEALED_KEYWORD + ) { return Modality.OPEN } } - if ( - klass is FirRegularClass + if (klass is FirRegularClass && klass.classKind == ClassKind.INTERFACE - && !modifiers.contains(KtTokens.PRIVATE_KEYWORD) + && tree.visibilityModifier(source.lighterASTNode)?.tokenType != KtTokens.PRIVATE_KEYWORD ) { return if (this.hasBody()) Modality.OPEN else Modality.ABSTRACT } @@ -271,8 +275,6 @@ fun FirMemberDeclaration.implicitModality(context: CheckerContext): Modality { return Modality.FINAL } -private fun FirDeclaration.modifierListOrNull() = this.source.getModifierList()?.modifiers?.map { it.token } - private fun FirDeclaration.hasBody(): Boolean = when (this) { is FirSimpleFunction -> this.body != null && this.body !is FirEmptyExpressionBlock is FirProperty -> this.setter?.body !is FirEmptyExpressionBlock? || this.getter?.body !is FirEmptyExpressionBlock? diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt index b4418cf6948..78863350667 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt @@ -208,6 +208,9 @@ internal fun FlyweightCapableTreeStructure.visibilityModifier(de internal fun FlyweightCapableTreeStructure.modalityModifier(declaration: LighterASTNode): LighterASTNode? = modifierList(declaration)?.let { findChildByType(it, MODALITY_MODIFIERS) } +internal fun FlyweightCapableTreeStructure.overrideModifier(declaration: LighterASTNode): LighterASTNode? = + modifierList(declaration)?.let { findChildByType(it, KtTokens.OVERRIDE_KEYWORD) } + private fun FlyweightCapableTreeStructure.accessorNamePlaceholder(node: LighterASTNode): LighterASTNode = findChildByType(node, KtTokens.GET_KEYWORD) ?: findChildByType(node, KtTokens.SET_KEYWORD)!! From 94ddb712130fcf9bfb33a09b4295d962ec039a4a Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 25 Nov 2020 14:40:45 +0300 Subject: [PATCH 432/698] [FIR] Simplify UnusedChecker & delete FirSourceChildren.kt --- .../kotlin/fir/analysis/FirSourceChildren.kt | 41 ------------------- .../checkers/extended/UnusedChecker.kt | 19 ++++----- .../fir/analysis/diagnostics/FirErrors.kt | 4 +- 3 files changed, 10 insertions(+), 54 deletions(-) delete mode 100644 compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/FirSourceChildren.kt diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/FirSourceChildren.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/FirSourceChildren.kt deleted file mode 100644 index e12db21f4b4..00000000000 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/FirSourceChildren.kt +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.fir.analysis - -import com.intellij.psi.tree.IElementType -import com.intellij.psi.tree.TokenSet -import org.jetbrains.kotlin.fir.* - -fun FirSourceElement.getChild(type: IElementType, index: Int = 0, depth: Int = -1): FirSourceElement? { - return getChild(setOf(type), index, depth) -} - -fun FirSourceElement.getChild(types: TokenSet, index: Int = 0, depth: Int = -1): FirSourceElement? { - return getChild(types.types.toSet(), index, depth) -} - -fun FirSourceElement.getChild(types: Set, index: Int = 0, depth: Int = -1): FirSourceElement? { - return when (this) { - is FirPsiSourceElement<*> -> { - getChild(types, index, depth) - } - is FirLightSourceElement -> { - getChild(types, index, depth) - } - else -> null - } -} - -private fun FirPsiSourceElement<*>.getChild(types: Set, index: Int, depth: Int): FirSourceElement? { - val visitor = PsiElementFinderByType(types, index, depth) - return visitor.find(psi)?.toFirPsiSourceElement() -} - -private fun FirLightSourceElement.getChild(types: Set, index: Int, depth: Int): FirSourceElement? { - val visitor = LighterTreeElementFinderByType(treeStructure, types, index, depth) - - return visitor.find(lighterASTNode)?.toFirLightSourceElement(treeStructure) -} \ No newline at end of file diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt index 5c1acff49d1..0350230bc94 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt @@ -7,8 +7,8 @@ package org.jetbrains.kotlin.fir.analysis.checkers.extended import kotlinx.collections.immutable.PersistentMap import kotlinx.collections.immutable.persistentMapOf +import org.jetbrains.kotlin.KtNodeTypes import org.jetbrains.kotlin.fir.FirFakeSourceElementKind -import org.jetbrains.kotlin.fir.FirSourceElement import org.jetbrains.kotlin.fir.FirSymbolOwner import org.jetbrains.kotlin.fir.analysis.cfa.* import org.jetbrains.kotlin.fir.analysis.checkers.cfa.FirControlFlowChecker @@ -17,16 +17,17 @@ import org.jetbrains.kotlin.fir.analysis.checkers.getContainingClass import org.jetbrains.kotlin.fir.analysis.checkers.isIterator import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors -import org.jetbrains.kotlin.fir.analysis.getChild import org.jetbrains.kotlin.fir.expressions.FirFunctionCall import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference import org.jetbrains.kotlin.fir.resolve.dfa.cfg.* import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol -import org.jetbrains.kotlin.lexer.KtTokens object UnusedChecker : FirControlFlowChecker() { override fun analyze(graph: ControlFlowGraph, reporter: DiagnosticReporter, checkerContext: CheckerContext) { - if ((graph.declaration as? FirSymbolOwner<*>)?.getContainingClass(checkerContext)?.takeIf { !it.symbol.classId.isLocal }!= null) return + if ((graph.declaration as? FirSymbolOwner<*>)?.getContainingClass(checkerContext)?.takeIf { + !it.symbol.classId.isLocal + } != null + ) return val properties = LocalPropertyCollector.collect(graph) if (properties.isEmpty()) return @@ -55,11 +56,11 @@ object UnusedChecker : FirControlFlowChecker() { if (variableSymbol.isLoopIterator) return val data = data[node]?.get(variableSymbol) ?: return + val variableSource = variableSymbol.fir.source.takeIf { it?.elementType != KtNodeTypes.DESTRUCTURING_DECLARATION } when { data == VariableStatus.UNUSED -> { if ((node.fir.initializer as? FirFunctionCall)?.isIterator != true) { - val source = variableSymbol.identifierSource - reporter.report(source, FirErrors.UNUSED_VARIABLE) + reporter.report(variableSource, FirErrors.UNUSED_VARIABLE) } } data.isRedundantInit -> { @@ -67,8 +68,7 @@ object UnusedChecker : FirControlFlowChecker() { reporter.report(source, FirErrors.VARIABLE_INITIALIZER_IS_REDUNDANT) } data == VariableStatus.ONLY_WRITTEN_NEVER_READ -> { - val source = variableSymbol.identifierSource - reporter.report(source, FirErrors.VARIABLE_NEVER_READ) + reporter.report(variableSource, FirErrors.VARIABLE_NEVER_READ) } else -> { } @@ -203,7 +203,4 @@ object UnusedChecker : FirControlFlowChecker() { private val FirPropertySymbol.isLoopIterator get() = fir.initializer?.source?.kind == FirFakeSourceElementKind.DesugaredForLoop - - private val FirPropertySymbol.identifierSource: FirSourceElement? - get() = fir.source?.getChild(KtTokens.IDENTIFIER, 0, 1) } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt index 981469e9b4b..4d941074326 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt @@ -165,9 +165,9 @@ object FirErrors { val ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS by warning0(SourceElementPositioningStrategies.OPERATOR) val EMPTY_RANGE by warning0() val REDUNDANT_SETTER_PARAMETER_TYPE by warning0() - val UNUSED_VARIABLE by warning0() + val UNUSED_VARIABLE by warning0(SourceElementPositioningStrategies.DECLARATION_NAME) val ASSIGNED_VALUE_IS_NEVER_READ by warning0() val VARIABLE_INITIALIZER_IS_REDUNDANT by warning0() - val VARIABLE_NEVER_READ by warning0() + val VARIABLE_NEVER_READ by warning0(SourceElementPositioningStrategies.DECLARATION_NAME) val USELESS_CALL_ON_NOT_NULL by warning0() } From 68d271fc91fccf8d9929c506636a644071eda27d Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 2 Dec 2020 12:14:51 +0300 Subject: [PATCH 433/698] Move FirModifierList inside FirModifierChecker to reduce its scope --- .../fir/analysis/checkers/FirModifierList.kt | 77 --------------- .../declaration/FirModifierChecker.kt | 93 ++++++++++++++++--- 2 files changed, 78 insertions(+), 92 deletions(-) delete mode 100644 compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirModifierList.kt diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirModifierList.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirModifierList.kt deleted file mode 100644 index 750b2aaa930..00000000000 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirModifierList.kt +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.fir.analysis.checkers - -import com.intellij.lang.ASTNode -import com.intellij.lang.LighterASTNode -import com.intellij.psi.PsiElement -import com.intellij.psi.tree.TokenSet -import com.intellij.util.diff.FlyweightCapableTreeStructure -import org.jetbrains.kotlin.KtNodeTypes -import org.jetbrains.kotlin.fir.* -import org.jetbrains.kotlin.lexer.KtModifierKeywordToken -import org.jetbrains.kotlin.lexer.KtTokens -import org.jetbrains.kotlin.psi.KtModifierList -import org.jetbrains.kotlin.psi.KtModifierListOwner - -sealed class FirModifierList { - abstract val modifiers: List> -} - -fun FirSourceElement?.getModifierList(): FirModifierList? { - return when (this) { - null -> null - is FirPsiSourceElement<*> -> (psi as? KtModifierListOwner)?.modifierList?.let { FirPsiModifierList(it) } - is FirLightSourceElement -> { - val modifierListNode = lighterASTNode.getChildren(treeStructure).find { it?.tokenType == KtNodeTypes.MODIFIER_LIST } - ?: return null - FirLightModifierList(modifierListNode, treeStructure) - } - } -} - -private val MODIFIER_KEYWORD_SET = TokenSet.orSet(KtTokens.SOFT_KEYWORDS, TokenSet.create(KtTokens.IN_KEYWORD, KtTokens.FUN_KEYWORD)) - -class FirPsiModifierList(val modifierList: KtModifierList) : FirModifierList() { - override val modifiers: List - get() = modifierList.node.getChildren(MODIFIER_KEYWORD_SET).map { node -> - FirPsiModifier(node, node.elementType as KtModifierKeywordToken) - } - -} - -class FirLightModifierList(val modifierList: LighterASTNode, val tree: FlyweightCapableTreeStructure) : FirModifierList() { - override val modifiers: List - get() { - val modifierNodes = modifierList.getChildren(tree) - return modifierNodes.filterNotNull() - .filter { it.tokenType is KtModifierKeywordToken } - .map { FirLightModifier(it, it.tokenType as KtModifierKeywordToken, tree) } - } -} - -sealed class FirModifier(val node: Node, val token: KtModifierKeywordToken) - -class FirPsiModifier( - node: ASTNode, - token: KtModifierKeywordToken -) : FirModifier(node, token) - -class FirLightModifier( - node: LighterASTNode, - token: KtModifierKeywordToken, - val tree: FlyweightCapableTreeStructure -) : FirModifier(node, token) - -val FirModifier<*>.psi: PsiElement? get() = (this as? FirPsiModifier)?.node?.psi - -val FirModifier<*>.lightNode: LighterASTNode? get() = (this as? FirLightModifier)?.node - -val FirModifier<*>.source: FirSourceElement? - get() = when (this) { - is FirPsiModifier -> psi?.toFirPsiSourceElement() - is FirLightModifier -> node.toFirLightSourceElement(tree) - } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirModifierChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirModifierChecker.kt index a2ef26e346c..1f0920854e2 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirModifierChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirModifierChecker.kt @@ -5,19 +5,22 @@ package org.jetbrains.kotlin.fir.analysis.checkers.declaration +import com.intellij.lang.ASTNode +import com.intellij.lang.LighterASTNode +import com.intellij.psi.tree.TokenSet +import com.intellij.util.diff.FlyweightCapableTreeStructure import org.jetbrains.kotlin.KtNodeTypes -import org.jetbrains.kotlin.fir.FirSourceElement -import org.jetbrains.kotlin.fir.analysis.checkers.FirModifier -import org.jetbrains.kotlin.fir.analysis.checkers.FirModifierList +import org.jetbrains.kotlin.fir.* +import org.jetbrains.kotlin.fir.analysis.checkers.* import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext -import org.jetbrains.kotlin.fir.analysis.checkers.getModifierList -import org.jetbrains.kotlin.fir.analysis.checkers.source import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.impl.FirDefaultPropertyAccessor import org.jetbrains.kotlin.lexer.KtModifierKeywordToken import org.jetbrains.kotlin.lexer.KtTokens.* +import org.jetbrains.kotlin.psi.KtModifierList +import org.jetbrains.kotlin.psi.KtModifierListOwner object FirModifierChecker : FirBasicDeclarationChecker() { @@ -112,7 +115,8 @@ object FirModifierChecker : FirBasicDeclarationChecker() { val firstToken = firstModifier.token val secondToken = secondModifier.token when (val compatibilityType = deduceCompatibilityType(firstToken, secondToken)) { - CompatibilityType.COMPATIBLE -> {} + CompatibilityType.COMPATIBLE -> { + } CompatibilityType.REPEATED -> if (reportedNodes.add(secondModifier)) reporter.reportRepeatedModifier(secondModifier, secondToken) CompatibilityType.REDUNDANT_2_TO_1 -> @@ -170,35 +174,94 @@ object FirModifierChecker : FirBasicDeclarationChecker() { if (!isDeclarationMappedToSourceCorrectly(declaration, source)) return if (context.containingDeclarations.last() is FirDefaultPropertyAccessor) return - val modifierList = source.getModifierList() + val modifierList = with(FirModifierList) { source.getModifierList() } modifierList?.let { checkModifiers(it, declaration, reporter) } } private fun DiagnosticReporter.reportRepeatedModifier( modifier: FirModifier<*>, keyword: KtModifierKeywordToken ) { - val source = modifier.source - source?.let { report(FirErrors.REPEATED_MODIFIER.on(it, keyword)) } + report(FirErrors.REPEATED_MODIFIER.on(modifier.source, keyword)) } private fun DiagnosticReporter.reportRedundantModifier( modifier: FirModifier<*>, firstKeyword: KtModifierKeywordToken, secondKeyword: KtModifierKeywordToken ) { - val source = modifier.source - source?.let { report(FirErrors.REDUNDANT_MODIFIER.on(it, firstKeyword, secondKeyword)) } + report(FirErrors.REDUNDANT_MODIFIER.on(modifier.source, firstKeyword, secondKeyword)) } private fun DiagnosticReporter.reportDeprecatedModifierPair( modifier: FirModifier<*>, firstKeyword: KtModifierKeywordToken, secondKeyword: KtModifierKeywordToken ) { - val source = modifier.source - source?.let { report(FirErrors.DEPRECATED_MODIFIER_PAIR.on(it, firstKeyword, secondKeyword)) } + report(FirErrors.DEPRECATED_MODIFIER_PAIR.on(modifier.source, firstKeyword, secondKeyword)) } private fun DiagnosticReporter.reportIncompatibleModifiers( modifier: FirModifier<*>, firstKeyword: KtModifierKeywordToken, secondKeyword: KtModifierKeywordToken ) { - val source = modifier.source - source?.let { report(FirErrors.INCOMPATIBLE_MODIFIERS.on(it, firstKeyword, secondKeyword)) } + report(FirErrors.INCOMPATIBLE_MODIFIERS.on(modifier.source, firstKeyword, secondKeyword)) + } + + private sealed class FirModifierList { + abstract val modifiers: List> + + class FirPsiModifierList(val modifierList: KtModifierList) : FirModifierList() { + override val modifiers: List + get() = modifierList.node.getChildren(MODIFIER_KEYWORD_SET).map { node -> + FirModifier.FirPsiModifier(node, node.elementType as KtModifierKeywordToken) + } + + } + + class FirLightModifierList( + val modifierList: LighterASTNode, + val tree: FlyweightCapableTreeStructure + ) : FirModifierList() { + override val modifiers: List + get() { + val modifierNodes = modifierList.getChildren(tree) + return modifierNodes.filterNotNull() + .filter { it.tokenType is KtModifierKeywordToken } + .map { FirModifier.FirLightModifier(it, it.tokenType as KtModifierKeywordToken, tree) } + } + } + + companion object { + fun FirSourceElement?.getModifierList(): FirModifierList? { + return when (this) { + null -> null + is FirPsiSourceElement<*> -> (psi as? KtModifierListOwner)?.modifierList?.let { FirPsiModifierList(it) } + is FirLightSourceElement -> { + val modifierListNode = lighterASTNode.getChildren(treeStructure).find { it?.tokenType == KtNodeTypes.MODIFIER_LIST } + ?: return null + FirLightModifierList(modifierListNode, treeStructure) + } + } + } + } + } + + private val MODIFIER_KEYWORD_SET = TokenSet.orSet(SOFT_KEYWORDS, TokenSet.create(IN_KEYWORD, FUN_KEYWORD)) + + sealed class FirModifier(val node: Node, val token: KtModifierKeywordToken) { + + class FirPsiModifier( + node: ASTNode, + token: KtModifierKeywordToken + ) : FirModifier(node, token) { + override val source: FirSourceElement + get() = node.psi.toFirPsiSourceElement() + } + + class FirLightModifier( + node: LighterASTNode, + token: KtModifierKeywordToken, + val tree: FlyweightCapableTreeStructure + ) : FirModifier(node, token) { + override val source: FirSourceElement + get() = node.toFirLightSourceElement(tree) + } + + abstract val source: FirSourceElement } } From 4626f21c585c940dad08afea722e2b4a03419ec7 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 2 Dec 2020 13:21:35 +0300 Subject: [PATCH 434/698] Record type arguments for FirResolvedQualifier --- ...ypeArgumentsNotAllowedExpressionChecker.kt | 35 +------------------ .../jetbrains/kotlin/fir/FirCallResolver.kt | 2 +- .../kotlin/fir/FirQualifiedNameResolver.kt | 12 ++++--- .../function/longQualifiedNameGeneric.fir.kt | 2 +- 4 files changed, 11 insertions(+), 40 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirTypeArgumentsNotAllowedExpressionChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirTypeArgumentsNotAllowedExpressionChecker.kt index 7362bb279bd..2f8762e32d4 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirTypeArgumentsNotAllowedExpressionChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirTypeArgumentsNotAllowedExpressionChecker.kt @@ -5,22 +5,12 @@ package org.jetbrains.kotlin.fir.analysis.checkers.expression -import com.intellij.lang.LighterASTNode -import com.intellij.openapi.util.Ref -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiErrorElement -import com.intellij.util.diff.FlyweightCapableTreeStructure -import org.jetbrains.kotlin.KtNodeTypes.TYPE_ARGUMENT_LIST -import org.jetbrains.kotlin.fir.FirLightSourceElement import org.jetbrains.kotlin.fir.FirSourceElement import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext -import org.jetbrains.kotlin.fir.analysis.checkers.getChildren import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression import org.jetbrains.kotlin.fir.expressions.FirResolvedQualifier -import org.jetbrains.kotlin.fir.psi -import org.jetbrains.kotlin.psi.KtTypeArgumentList object FirTypeArgumentsNotAllowedExpressionChecker : FirQualifiedAccessChecker() { override fun check(expression: FirQualifiedAccessExpression, context: CheckerContext, reporter: DiagnosticReporter) { @@ -29,36 +19,13 @@ object FirTypeArgumentsNotAllowedExpressionChecker : FirQualifiedAccessChecker() val explicitReceiver = expression.explicitReceiver if (explicitReceiver is FirResolvedQualifier && explicitReceiver.symbol == null) { - if (explicitReceiver.source?.hasAnyArguments() == true) { + if (explicitReceiver.typeArguments.isNotEmpty()) { reporter.report(explicitReceiver.source) return } } } - private fun FirSourceElement.hasAnyArguments(): Boolean { - val localPsi = this.psi - val localLight = this.lighterASTNode - - if (localPsi != null && localPsi !is PsiErrorElement) { - return localPsi.hasAnyArguments() - } else if (this is FirLightSourceElement) { - return localLight.hasAnyArguments(this.treeStructure) - } - - return false - } - - private fun PsiElement.hasAnyArguments(): Boolean { - val children = this.children // this is a method call and it collects children - return children.size > 1 && children[1] is KtTypeArgumentList - } - - private fun LighterASTNode.hasAnyArguments(tree: FlyweightCapableTreeStructure): Boolean { - val children = getChildren(tree) - return children.count { it != null } > 1 && children[1]?.tokenType == TYPE_ARGUMENT_LIST - } - private fun DiagnosticReporter.report(source: FirSourceElement?) { source?.let { report(FirErrors.TYPE_ARGUMENTS_NOT_ALLOWED.on(it)) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirCallResolver.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirCallResolver.kt index 50e01c9e118..96063040316 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirCallResolver.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirCallResolver.kt @@ -168,7 +168,7 @@ class FirCallResolver( fun resolveVariableAccessAndSelectCandidate(qualifiedAccess: T): FirStatement { val callee = qualifiedAccess.calleeReference as? FirSimpleNamedReference ?: return qualifiedAccess - qualifiedResolver.initProcessingQualifiedAccess(callee) + qualifiedResolver.initProcessingQualifiedAccess(callee, qualifiedAccess.typeArguments) @Suppress("NAME_SHADOWING") val qualifiedAccess = qualifiedAccess.transformExplicitReceiver() diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirQualifiedNameResolver.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirQualifiedNameResolver.kt index 3b73b85dd67..6ca46209b58 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirQualifiedNameResolver.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirQualifiedNameResolver.kt @@ -16,14 +16,17 @@ import org.jetbrains.kotlin.fir.resolve.transformers.PackageOrClass import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.resultType import org.jetbrains.kotlin.fir.resolve.transformers.resolveToPackageOrClass import org.jetbrains.kotlin.fir.resolve.typeForQualifier +import org.jetbrains.kotlin.fir.types.FirTypeProjection import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name class FirQualifiedNameResolver(private val components: BodyResolveComponents) { private val session = components.session - private var qualifierStack = mutableListOf() + private var qualifierStack = mutableListOf() private var qualifierPartsToDrop = 0 + private class NameWithTypeArguments(val name: Name, val typeArguments: List) + fun reset() { qualifierStack.clear() qualifierPartsToDrop = 0 @@ -41,11 +44,11 @@ class FirQualifiedNameResolver(private val components: BodyResolveComponents) { */ fun isPotentialQualifierPartPosition() = qualifierStack.size > 1 - fun initProcessingQualifiedAccess(callee: FirSimpleNamedReference) { + fun initProcessingQualifiedAccess(callee: FirSimpleNamedReference, typeArguments: List) { if (callee.name.isSpecial) { qualifierStack.clear() } else { - qualifierStack.add(callee.name) + qualifierStack.add(NameWithTypeArguments(callee.name, typeArguments)) } } @@ -62,7 +65,7 @@ class FirQualifiedNameResolver(private val components: BodyResolveComponents) { return null } val symbolProvider = session.firSymbolProvider - var qualifierParts = qualifierStack.asReversed().map { it.asString() } + var qualifierParts = qualifierStack.asReversed().map { it.name.asString() } var resolved: PackageOrClass? do { resolved = resolveToPackageOrClass( @@ -80,6 +83,7 @@ class FirQualifiedNameResolver(private val components: BodyResolveComponents) { packageFqName = resolved.packageFqName relativeClassFqName = resolved.relativeClassFqName symbol = resolved.classSymbol + typeArguments.addAll(qualifierStack.take(qualifierParts.size).flatMap { it.typeArguments }) }.apply { resultType = components.typeForQualifier(this) } diff --git a/compiler/testData/diagnostics/tests/callableReference/function/longQualifiedNameGeneric.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/longQualifiedNameGeneric.fir.kt index df53d4d2ccb..155c40387b1 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/longQualifiedNameGeneric.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/longQualifiedNameGeneric.fir.kt @@ -14,5 +14,5 @@ import kotlin.reflect.KFunction3 fun main() { val x = a.b.c.D::foo - checkSubtype, String, Int, a.b.c.D>>(x) + checkSubtype, String, Int, a.b.c.D>>(x) } From 235813736ec7ca7f10b9d27547bdc4ef46a01f2d Mon Sep 17 00:00:00 2001 From: Vyacheslav Gerasimov Date: Tue, 1 Dec 2020 20:40:41 +0300 Subject: [PATCH 435/698] Build: Set file access rights explicitly in kotlin-stdlib-js jar Workaround for #KTI-401. Since gradle 6.6 ant.replaceregexp call sets incorrect access rights `-rw-------` instead of `-rw-r--r--` --- libraries/stdlib/js-v1/build.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/stdlib/js-v1/build.gradle b/libraries/stdlib/js-v1/build.gradle index 675bdf4d70a..36aecfe6c24 100644 --- a/libraries/stdlib/js-v1/build.gradle +++ b/libraries/stdlib/js-v1/build.gradle @@ -255,6 +255,7 @@ task libraryJarWithoutIr(type: Jar, dependsOn: compileJs) { from jsOutputMetaFile from "${jsOutputFile}.map" from sourceSets.main.output + filesMatching("*.*") { it.mode = 0b110100100 } // KTI-401 } task libraryJarWithIr(type: Zip, dependsOn: libraryJarWithoutIr) { @@ -269,6 +270,7 @@ task libraryJarWithIr(type: Zip, dependsOn: libraryJarWithoutIr) { def irKlib = tasks.getByPath(":kotlin-stdlib-js-ir:compileKotlinJs") fileTree(irKlib.outputs.files.first().path) } + filesMatching("*.*") { it.mode = 0b110100100 } // KTI-401 } jar.dependsOn(libraryJarWithIr) From 15c325cf10499a1891c44b87c93aac66951a2d1f Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Wed, 25 Nov 2020 17:59:07 +0100 Subject: [PATCH 436/698] Value classes: Allow nested inline classes --- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 ++++ .../rendering/DefaultErrorMessages.java | 2 +- .../checkers/InlineClassDeclarationChecker.kt | 2 +- .../box/inlineClasses/nestedInlineClass.kt | 25 ++++++++++++++++++ .../inlineClassDeclarationCheck.fir.kt | 7 +++++ .../inlineClassDeclarationCheck.kt | 13 +++++++--- .../inlineClassDeclarationCheck.txt | 26 +++++++++++++++++++ .../valueClassDeclarationCheck.kt | 6 ++--- .../codegen/BlackBoxCodegenTestGenerated.java | 5 ++++ .../LightAnalysisModeTestGenerated.java | 5 ++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 5 ++++ .../IrJsCodegenBoxES6TestGenerated.java | 5 ++++ .../IrJsCodegenBoxTestGenerated.java | 5 ++++ .../semantics/JsCodegenBoxTestGenerated.java | 5 ++++ .../IrCodegenBoxWasmTestGenerated.java | 5 ++++ 15 files changed, 113 insertions(+), 8 deletions(-) create mode 100644 compiler/testData/codegen/box/inlineClasses/nestedInlineClass.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 48e13480e7a..e887825e0c9 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -14157,6 +14157,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/inlineClasses/multifileClass.kt"); } + @TestMetadata("nestedInlineClass.kt") + public void testNestedInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/nestedInlineClass.kt"); + } + @TestMetadata("noAssertionsOnInlineClassBasedOnNullableType.kt") public void testNoAssertionsOnInlineClassBasedOnNullableType() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/noAssertionsOnInlineClassBasedOnNullableType.kt"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index 42bf6d53016..1d7d12906bc 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -704,7 +704,7 @@ public class DefaultErrorMessages { MAP.put(NON_PRIVATE_CONSTRUCTOR_IN_ENUM, "Constructor must be private in enum class"); MAP.put(NON_PRIVATE_CONSTRUCTOR_IN_SEALED, "Constructor must be private in sealed class"); - MAP.put(INLINE_CLASS_NOT_TOP_LEVEL, "Inline classes are only allowed on top level"); + MAP.put(INLINE_CLASS_NOT_TOP_LEVEL, "Inline classes cannot be local or inner"); MAP.put(INLINE_CLASS_NOT_FINAL, "Inline classes can be only final"); MAP.put(ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_INLINE_CLASS, "Primary constructor is required for inline class"); MAP.put(INLINE_CLASS_CONSTRUCTOR_WRONG_PARAMETERS_SIZE, "Inline class must have exactly one primary constructor parameter"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt index 64f026ace36..66616901983 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt @@ -29,7 +29,7 @@ object InlineClassDeclarationChecker : DeclarationChecker { require(inlineOrValueKeyword != null) { "Declaration of inline class must have 'inline' keyword" } val trace = context.trace - if (!DescriptorUtils.isTopLevelDeclaration(descriptor)) { + if (descriptor.isInner || DescriptorUtils.isLocal(descriptor)) { trace.report(Errors.INLINE_CLASS_NOT_TOP_LEVEL.on(inlineOrValueKeyword)) return } diff --git a/compiler/testData/codegen/box/inlineClasses/nestedInlineClass.kt b/compiler/testData/codegen/box/inlineClasses/nestedInlineClass.kt new file mode 100644 index 00000000000..e3e8528ae0c --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/nestedInlineClass.kt @@ -0,0 +1,25 @@ +// !LANGUAGE: +InlineClasses + +class C { + inline class IC1(val s: String) + + companion object { + inline class IC2(val s: String) + } +} + +object O { + inline class IC3(val s: String) +} + +interface I { + inline class IC4(val s: String) +} + +fun box(): String { + if (C.IC1("OK").s != "OK") return "FAIL 1" + if (C.Companion.IC2("OK").s != "OK") return "FAIL 2" + if (O.IC3("OK").s != "OK") return "FAIL 3" + if (I.IC4("OK").s != "OK") return "FAIL 4" + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inlineClasses/inlineClassDeclarationCheck.fir.kt b/compiler/testData/diagnostics/tests/inlineClasses/inlineClassDeclarationCheck.fir.kt index a16404c9a45..5911eaa8f3e 100644 --- a/compiler/testData/diagnostics/tests/inlineClasses/inlineClassDeclarationCheck.fir.kt +++ b/compiler/testData/diagnostics/tests/inlineClasses/inlineClassDeclarationCheck.fir.kt @@ -16,13 +16,20 @@ inline class A9(final val x: Int) class B1 { companion object { inline class C1(val x: Int) + inner inline class C11(val x: Int) } inline class C2(val x: Int) + inner inline class C21(val x: Int) } object B2 { inline class C3(val x: Int) + inner inline class C31(val x: Int) +} + +fun foo() { + inline class C4(val x: Int) } final inline class D0(val x: Int) diff --git a/compiler/testData/diagnostics/tests/inlineClasses/inlineClassDeclarationCheck.kt b/compiler/testData/diagnostics/tests/inlineClasses/inlineClassDeclarationCheck.kt index 492c52e6a14..cd55c8f55f5 100644 --- a/compiler/testData/diagnostics/tests/inlineClasses/inlineClassDeclarationCheck.kt +++ b/compiler/testData/diagnostics/tests/inlineClasses/inlineClassDeclarationCheck.kt @@ -15,14 +15,21 @@ inline class A9(final val x: Int) class B1 { companion object { - inline class C1(val x: Int) + inline class C1(val x: Int) + inner inline class C11(val x: Int) } - inline class C2(val x: Int) + inline class C2(val x: Int) + inner inline class C21(val x: Int) } object B2 { - inline class C3(val x: Int) + inline class C3(val x: Int) + inner inline class C31(val x: Int) +} + +fun foo() { + inline class C4(val x: Int) } final inline class D0(val x: Int) diff --git a/compiler/testData/diagnostics/tests/inlineClasses/inlineClassDeclarationCheck.txt b/compiler/testData/diagnostics/tests/inlineClasses/inlineClassDeclarationCheck.txt index 1ff6b483611..0933b86cc72 100644 --- a/compiler/testData/diagnostics/tests/inlineClasses/inlineClassDeclarationCheck.txt +++ b/compiler/testData/diagnostics/tests/inlineClasses/inlineClassDeclarationCheck.txt @@ -1,5 +1,7 @@ package +public fun foo(): kotlin.Unit + public final inline class A0 { public constructor A0(/*0*/ x: kotlin.Int) public final val x: kotlin.Int @@ -92,6 +94,14 @@ public final class B1 { public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String } + public final inner inline class C21 { + public constructor C21(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + public companion object Companion { private constructor Companion() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @@ -105,6 +115,14 @@ public final class B1 { public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String } + + public final inline class C11 { + public constructor C11(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } } } @@ -121,6 +139,14 @@ public object B2 { public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String } + + public final inline class C31 { + public constructor C31(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } } public final inline class D0 { diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt index a55cfb64cb4..8deb953d413 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt @@ -30,16 +30,16 @@ value class A9(final val x: Int) class B1 { companion object { @JvmInline - value class C1(val x: Int) + value class C1(val x: Int) } @JvmInline - value class C2(val x: Int) + value class C2(val x: Int) } object B2 { @JvmInline - value class C3(val x: Int) + value class C3(val x: Int) } @JvmInline diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index d311c012888..a2faa93e722 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -15557,6 +15557,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/inlineClasses/multifileClass.kt"); } + @TestMetadata("nestedInlineClass.kt") + public void testNestedInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/nestedInlineClass.kt"); + } + @TestMetadata("noAssertionsOnInlineClassBasedOnNullableType.kt") public void testNoAssertionsOnInlineClassBasedOnNullableType() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/noAssertionsOnInlineClassBasedOnNullableType.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index dbfd03b0ea2..467716f9c04 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -15567,6 +15567,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/inlineClasses/mappingOfBoxedFlexibleInlineClassType.kt"); } + @TestMetadata("nestedInlineClass.kt") + public void testNestedInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/nestedInlineClass.kt"); + } + @TestMetadata("noAssertionsOnInlineClassBasedOnNullableType.kt") public void testNoAssertionsOnInlineClassBasedOnNullableType() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/noAssertionsOnInlineClassBasedOnNullableType.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 08eaf8c8cfd..e1c4edc5dd4 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -14157,6 +14157,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/inlineClasses/multifileClass.kt"); } + @TestMetadata("nestedInlineClass.kt") + public void testNestedInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/nestedInlineClass.kt"); + } + @TestMetadata("noAssertionsOnInlineClassBasedOnNullableType.kt") public void testNoAssertionsOnInlineClassBasedOnNullableType() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/noAssertionsOnInlineClassBasedOnNullableType.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index f7c791c06be..ea6edae111a 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -12152,6 +12152,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/inlineClasses/multifileClass.kt"); } + @TestMetadata("nestedInlineClass.kt") + public void testNestedInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/nestedInlineClass.kt"); + } + @TestMetadata("noAssertionsOnInlineClassBasedOnNullableType.kt") public void testNoAssertionsOnInlineClassBasedOnNullableType() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/noAssertionsOnInlineClassBasedOnNullableType.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index ee3c62390c2..eb22ec13451 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -12152,6 +12152,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/inlineClasses/multifileClass.kt"); } + @TestMetadata("nestedInlineClass.kt") + public void testNestedInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/nestedInlineClass.kt"); + } + @TestMetadata("noAssertionsOnInlineClassBasedOnNullableType.kt") public void testNoAssertionsOnInlineClassBasedOnNullableType() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/noAssertionsOnInlineClassBasedOnNullableType.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 4a23106375d..c5181fd0c2c 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -12217,6 +12217,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/inlineClasses/multifileClass.kt"); } + @TestMetadata("nestedInlineClass.kt") + public void testNestedInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/nestedInlineClass.kt"); + } + @TestMetadata("noAssertionsOnInlineClassBasedOnNullableType.kt") public void testNoAssertionsOnInlineClassBasedOnNullableType() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/noAssertionsOnInlineClassBasedOnNullableType.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index edfa36732fd..7bf5699dec3 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -6627,6 +6627,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/inlineClasses/mangledSuperCalls.kt"); } + @TestMetadata("nestedInlineClass.kt") + public void testNestedInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/nestedInlineClass.kt"); + } + @TestMetadata("noAssertionsOnInlineClassBasedOnNullableType.kt") public void testNoAssertionsOnInlineClassBasedOnNullableType() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/noAssertionsOnInlineClassBasedOnNullableType.kt"); From 0d55c9108d46b508bab4c22578772578a9b8f278 Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Fri, 27 Nov 2020 23:44:57 +0100 Subject: [PATCH 437/698] IC: Forbid inner classes inside inline classes #KT-43067 Fixed --- ...irOldFrontendDiagnosticsTestGenerated.java | 5 ++++ .../jetbrains/kotlin/diagnostics/Errors.java | 1 + .../rendering/DefaultErrorMessages.java | 1 + .../resolve/PlatformConfiguratorBase.kt | 1 + .../checkers/InlineClassDeclarationChecker.kt | 12 ++++++++ .../codegen/box/inlineClasses/kt27705.kt | 1 + .../codegen/box/inlineClasses/kt27706.kt | 1 + .../constructorWithInlineClassParameters.kt | 1 + .../innerClassInsideInlineClass.fir.kt | 8 +++++ .../innerClassInsideInlineClass.kt | 8 +++++ .../innerClassInsideInlineClass.txt | 29 +++++++++++++++++++ .../checkers/DiagnosticsTestGenerated.java | 5 ++++ .../DiagnosticsUsingJavacTestGenerated.java | 5 ++++ 13 files changed, 78 insertions(+) create mode 100644 compiler/testData/diagnostics/tests/inlineClasses/innerClassInsideInlineClass.fir.kt create mode 100644 compiler/testData/diagnostics/tests/inlineClasses/innerClassInsideInlineClass.kt create mode 100644 compiler/testData/diagnostics/tests/inlineClasses/innerClassInsideInlineClass.txt diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java index 6461511a692..ee445859742 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java @@ -12917,6 +12917,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte runTest("compiler/testData/diagnostics/tests/inlineClasses/inlineClassesInsideAnnotations.kt"); } + @TestMetadata("innerClassInsideInlineClass.kt") + public void testInnerClassInsideInlineClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/inlineClasses/innerClassInsideInlineClass.kt"); + } + @TestMetadata("lateinitInlineClasses.kt") public void testLateinitInlineClasses() throws Exception { runTest("compiler/testData/diagnostics/tests/inlineClasses/lateinitInlineClasses.kt"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index 821a05c031e..af6d60a3286 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -362,6 +362,7 @@ public interface Errors { DiagnosticFactory0 INLINE_CLASS_CANNOT_BE_RECURSIVE = DiagnosticFactory0.create(ERROR); DiagnosticFactory1 RESERVED_MEMBER_INSIDE_INLINE_CLASS = DiagnosticFactory1.create(ERROR); DiagnosticFactory0 SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 INNER_CLASS_INSIDE_INLINE_CLASS = DiagnosticFactory0.create(ERROR); // Result class diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index 1d7d12906bc..135f8d5ebd7 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -717,6 +717,7 @@ public class DefaultErrorMessages { MAP.put(INLINE_CLASS_CANNOT_BE_RECURSIVE, "Inline class cannot be recursive"); MAP.put(RESERVED_MEMBER_INSIDE_INLINE_CLASS, "Member with the name ''{0}'' is reserved for future releases", STRING); MAP.put(SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS, "Secondary constructors with bodies are reserved for for future releases"); + MAP.put(INNER_CLASS_INSIDE_INLINE_CLASS, "Inline class cannot have inner classes"); MAP.put(RESULT_CLASS_IN_RETURN_TYPE, "'kotlin.Result' cannot be used as a return type"); MAP.put(RESULT_CLASS_WITH_NULLABLE_OPERATOR, "Expression of type 'kotlin.Result' cannot be used as a left operand of ''{0}''", STRING); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt index 5f5a9aba0f9..10c744d58d3 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt @@ -28,6 +28,7 @@ private val DEFAULT_DECLARATION_CHECKERS = listOf( SuspendLimitationsChecker, InlineClassDeclarationChecker, PropertiesWithBackingFieldsInsideInlineClass(), + InnerClassInsideInlineClass(), AnnotationClassTargetAndRetentionChecker(), ReservedMembersAndConstructsForInlineClass(), ResultClassInReturnTypeChecker(), diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt index 66616901983..97bc3378858 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt @@ -124,6 +124,18 @@ class PropertiesWithBackingFieldsInsideInlineClass : DeclarationChecker { } } +class InnerClassInsideInlineClass : DeclarationChecker { + override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) { + if (declaration !is KtClass) return + if (descriptor !is ClassDescriptor) return + if (!descriptor.isInner) return + + if (!descriptor.containingDeclaration.isInlineClass()) return + + context.trace.report(Errors.INNER_CLASS_INSIDE_INLINE_CLASS.on(declaration.modifierList!!.getModifier(KtTokens.INNER_KEYWORD)!!)) + } +} + class ReservedMembersAndConstructsForInlineClass : DeclarationChecker { companion object { diff --git a/compiler/testData/codegen/box/inlineClasses/kt27705.kt b/compiler/testData/codegen/box/inlineClasses/kt27705.kt index 49ba36aa170..dbc9fbb6785 100644 --- a/compiler/testData/codegen/box/inlineClasses/kt27705.kt +++ b/compiler/testData/codegen/box/inlineClasses/kt27705.kt @@ -2,6 +2,7 @@ // WITH_RUNTIME inline class Z(val x: Int) { + @Suppress("INNER_CLASS_INSIDE_INLINE_CLASS") inner class Inner(val y: Int) { val xx = x } diff --git a/compiler/testData/codegen/box/inlineClasses/kt27706.kt b/compiler/testData/codegen/box/inlineClasses/kt27706.kt index 3ef3ea87971..c5179393421 100644 --- a/compiler/testData/codegen/box/inlineClasses/kt27706.kt +++ b/compiler/testData/codegen/box/inlineClasses/kt27706.kt @@ -2,6 +2,7 @@ // WITH_RUNTIME inline class Z(val x: Int) { + @Suppress("INNER_CLASS_INSIDE_INLINE_CLASS") inner class Inner(val z: Z) { val xx = x } diff --git a/compiler/testData/codegen/box/reflection/call/inlineClasses/constructorWithInlineClassParameters.kt b/compiler/testData/codegen/box/reflection/call/inlineClasses/constructorWithInlineClassParameters.kt index afd064f8144..fb2716354de 100644 --- a/compiler/testData/codegen/box/reflection/call/inlineClasses/constructorWithInlineClassParameters.kt +++ b/compiler/testData/codegen/box/reflection/call/inlineClasses/constructorWithInlineClassParameters.kt @@ -12,6 +12,7 @@ class Outer(val z1: Z) { } inline class InlineOuter(val z1: Z) { + @Suppress("INNER_CLASS_INSIDE_INLINE_CLASS") inner class Inner(val z2: Z) { val test = "$z1 $z2" } diff --git a/compiler/testData/diagnostics/tests/inlineClasses/innerClassInsideInlineClass.fir.kt b/compiler/testData/diagnostics/tests/inlineClasses/innerClassInsideInlineClass.fir.kt new file mode 100644 index 00000000000..7188dcc1dc1 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inlineClasses/innerClassInsideInlineClass.fir.kt @@ -0,0 +1,8 @@ +// !LANGUAGE: +InlineClasses +// !DIAGNOSTICS: -UNUSED_VARIABLE + +inline class Foo(val x: Int) { + inner class InnerC + inner object InnerO + inner interface InnerI +} diff --git a/compiler/testData/diagnostics/tests/inlineClasses/innerClassInsideInlineClass.kt b/compiler/testData/diagnostics/tests/inlineClasses/innerClassInsideInlineClass.kt new file mode 100644 index 00000000000..3c64938fd96 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inlineClasses/innerClassInsideInlineClass.kt @@ -0,0 +1,8 @@ +// !LANGUAGE: +InlineClasses +// !DIAGNOSTICS: -UNUSED_VARIABLE + +inline class Foo(val x: Int) { + inner class InnerC + inner object InnerO + inner interface InnerI +} diff --git a/compiler/testData/diagnostics/tests/inlineClasses/innerClassInsideInlineClass.txt b/compiler/testData/diagnostics/tests/inlineClasses/innerClassInsideInlineClass.txt new file mode 100644 index 00000000000..214e6b891c9 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inlineClasses/innerClassInsideInlineClass.txt @@ -0,0 +1,29 @@ +package + +public final inline class Foo { + public constructor Foo(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + + public final inner class InnerC { + public constructor InnerC() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public interface InnerI { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public object InnerO { + private constructor InnerO() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 0b2c9fb6136..da47f330b4a 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -12924,6 +12924,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali runTest("compiler/testData/diagnostics/tests/inlineClasses/inlineClassesInsideAnnotations.kt"); } + @TestMetadata("innerClassInsideInlineClass.kt") + public void testInnerClassInsideInlineClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/inlineClasses/innerClassInsideInlineClass.kt"); + } + @TestMetadata("lateinitInlineClasses.kt") public void testLateinitInlineClasses() throws Exception { runTest("compiler/testData/diagnostics/tests/inlineClasses/lateinitInlineClasses.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java index ac73819e95e..6d1619ed9ba 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java @@ -12919,6 +12919,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing runTest("compiler/testData/diagnostics/tests/inlineClasses/inlineClassesInsideAnnotations.kt"); } + @TestMetadata("innerClassInsideInlineClass.kt") + public void testInnerClassInsideInlineClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/inlineClasses/innerClassInsideInlineClass.kt"); + } + @TestMetadata("lateinitInlineClasses.kt") public void testLateinitInlineClasses() throws Exception { runTest("compiler/testData/diagnostics/tests/inlineClasses/lateinitInlineClasses.kt"); From 19b16da183c01b3b739095e7f79c90a542e78398 Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Wed, 2 Dec 2020 23:50:17 +0100 Subject: [PATCH 438/698] Minor. Add test to check value classes --- .../ir/FirBlackBoxCodegenTestGenerated.java | 18 + .../codegen/box/valueClasses/jvmInline.kt | 1004 +++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 18 + .../LightAnalysisModeTestGenerated.java | 18 + .../ir/IrBlackBoxCodegenTestGenerated.java | 18 + .../IrJsCodegenBoxES6TestGenerated.java | 18 + .../IrJsCodegenBoxTestGenerated.java | 18 + .../semantics/JsCodegenBoxTestGenerated.java | 18 + .../IrCodegenBoxWasmTestGenerated.java | 18 + 9 files changed, 1148 insertions(+) create mode 100644 compiler/testData/codegen/box/valueClasses/jvmInline.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index e887825e0c9..94d9a383292 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -32373,6 +32373,24 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } } + @TestMetadata("compiler/testData/codegen/box/valueClasses") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ValueClasses extends AbstractFirBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); + } + + public void testAllFilesPresentInValueClasses() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("jvmInline.kt") + public void testJvmInline() throws Exception { + runTest("compiler/testData/codegen/box/valueClasses/jvmInline.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/vararg") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/testData/codegen/box/valueClasses/jvmInline.kt b/compiler/testData/codegen/box/valueClasses/jvmInline.kt new file mode 100644 index 00000000000..cdb5ca6edf9 --- /dev/null +++ b/compiler/testData/codegen/box/valueClasses/jvmInline.kt @@ -0,0 +1,1004 @@ +// WITH_RUNTIME +// KJS_WITH_FULL_RUNTIME +// IGNORE_DEXING +// IGNORE_BACKEND: WASM + +// FILE: 1.kt + +package kotlin.jvm + +annotation class JvmInline + +// FILE: 2.kt + +import kotlin.jvm.JvmInline +import kotlin.coroutines.* + +@JvmInline +value class VCString(val a: String) +@JvmInline +value class VCStringNullable(val a: String?) +@JvmInline +value class VCAny(val a: Any) +@JvmInline +value class VCAnyNullable(val a: Any?) +@JvmInline +value class VCInt(val a: Int) +@JvmInline +value class VCIntNullable(val a: Int?) + +var result: Any? = null +fun ordinaryNoninlineReturnsVCString(): VCString = VCString("OK") +fun ordinaryNoninlineReturnsVCStringNullable(): VCStringNullable = VCStringNullable("OK") +fun ordinaryNoninlineReturnsVCAny(): VCAny = VCAny("OK") +fun ordinaryNoninlineReturnsVCAnyNullable(): VCAnyNullable = VCAnyNullable("OK") +fun ordinaryNoninlineReturnsVCInt(): VCInt = VCInt(42) +fun ordinaryNoninlineReturnsVCIntNullable(): VCIntNullable = VCIntNullable(42) +fun ordinaryNoninlineReturnsVCString_Null(): VCString? = null +fun ordinaryNoninlineReturnsVCStringNullable_Null(): VCStringNullable? = null +fun ordinaryNoninlineReturnsVCAny_Null(): VCAny? = null +fun ordinaryNoninlineReturnsVCAnyNullable_Null(): VCAnyNullable? = null +fun ordinaryNoninlineReturnsVCInt_Null(): VCInt? = null +fun ordinaryNoninlineReturnsVCIntNullable_Null(): VCIntNullable? = null +fun ordinaryNoninlineAcceptsVCString(i: Int, vc: VCString) { + result = vc +} + +fun ordinaryNoninlineAcceptsVCStringNullable(i: Int, vc: VCStringNullable) { + result = vc +} + +fun ordinaryNoninlineAcceptsVCAny(i: Int, vc: VCAny) { + result = vc +} + +fun ordinaryNoninlineAcceptsVCAnyNullable(i: Int, vc: VCAnyNullable) { + result = vc +} + +fun ordinaryNoninlineAcceptsVCInt(i: Int, vc: VCInt) { + result = vc +} + +fun ordinaryNoninlineAcceptsVCIntNullable(i: Int, vc: VCIntNullable) { + result = vc +} + +fun ordinaryNoninlineAcceptsVCString_Null(i: Int, vc: VCString?) { + result = vc +} + +fun ordinaryNoninlineAcceptsVCStringNullable_Null(i: Int, vc: VCStringNullable?) { + result = vc +} + +fun ordinaryNoninlineAcceptsVCAny_Null(i: Int, vc: VCAny?) { + result = vc +} + +fun ordinaryNoninlineAcceptsVCAnyNullable_Null(i: Int, vc: VCAnyNullable?) { + result = vc +} + +fun ordinaryNoninlineAcceptsVCInt_Null(i: Int, vc: VCInt?) { + result = vc +} + +fun ordinaryNoninlineAcceptsVCIntNullable_Null(i: Int, vc: VCIntNullable?) { + result = vc +} + +inline fun ordinaryInlineReturnsVCString(): VCString = VCString("OK") +inline fun ordinaryInlineReturnsVCStringNullable(): VCStringNullable = VCStringNullable("OK") +inline fun ordinaryInlineReturnsVCAny(): VCAny = VCAny("OK") +inline fun ordinaryInlineReturnsVCAnyNullable(): VCAnyNullable = VCAnyNullable("OK") +inline fun ordinaryInlineReturnsVCInt(): VCInt = VCInt(42) +inline fun ordinaryInlineReturnsVCIntNullable(): VCIntNullable = VCIntNullable(42) +inline fun ordinaryInlineReturnsVCString_Null(): VCString? = null +inline fun ordinaryInlineReturnsVCStringNullable_Null(): VCStringNullable? = null +inline fun ordinaryInlineReturnsVCAny_Null(): VCAny? = null +inline fun ordinaryInlineReturnsVCAnyNullable_Null(): VCAnyNullable? = null +inline fun ordinaryInlineReturnsVCInt_Null(): VCInt? = null +inline fun ordinaryInlineReturnsVCIntNullable_Null(): VCIntNullable? = null +inline fun ordinaryInlineAcceptsVCString(i: Int, vc: VCString) { + result = vc +} + +inline fun ordinaryInlineAcceptsVCStringNullable(i: Int, vc: VCStringNullable) { + result = vc +} + +inline fun ordinaryInlineAcceptsVCAny(i: Int, vc: VCAny) { + result = vc +} + +inline fun ordinaryInlineAcceptsVCAnyNullable(i: Int, vc: VCAnyNullable) { + result = vc +} + +inline fun ordinaryInlineAcceptsVCInt(i: Int, vc: VCInt) { + result = vc +} + +inline fun ordinaryInlineAcceptsVCIntNullable(i: Int, vc: VCIntNullable) { + result = vc +} + +inline fun ordinaryInlineAcceptsVCString_Null(i: Int, vc: VCString?) { + result = vc +} + +inline fun ordinaryInlineAcceptsVCStringNullable_Null(i: Int, vc: VCStringNullable?) { + result = vc +} + +inline fun ordinaryInlineAcceptsVCAny_Null(i: Int, vc: VCAny?) { + result = vc +} + +inline fun ordinaryInlineAcceptsVCAnyNullable_Null(i: Int, vc: VCAnyNullable?) { + result = vc +} + +inline fun ordinaryInlineAcceptsVCInt_Null(i: Int, vc: VCInt?) { + result = vc +} + +inline fun ordinaryInlineAcceptsVCIntNullable_Null(i: Int, vc: VCIntNullable?) { + result = vc +} + +suspend fun suspendNoninlineReturnsVCString(): VCString = VCString("OK") +suspend fun suspendNoninlineReturnsVCStringNullable(): VCStringNullable = VCStringNullable("OK") +suspend fun suspendNoninlineReturnsVCAny(): VCAny = VCAny("OK") +suspend fun suspendNoninlineReturnsVCAnyNullable(): VCAnyNullable = VCAnyNullable("OK") +suspend fun suspendNoninlineReturnsVCInt(): VCInt = VCInt(42) +suspend fun suspendNoninlineReturnsVCIntNullable(): VCIntNullable = VCIntNullable(42) +suspend fun suspendNoninlineReturnsVCString_Null(): VCString? = null +suspend fun suspendNoninlineReturnsVCStringNullable_Null(): VCStringNullable? = null +suspend fun suspendNoninlineReturnsVCAny_Null(): VCAny? = null +suspend fun suspendNoninlineReturnsVCAnyNullable_Null(): VCAnyNullable? = null +suspend fun suspendNoninlineReturnsVCInt_Null(): VCInt? = null +suspend fun suspendNoninlineReturnsVCIntNullable_Null(): VCIntNullable? = null +suspend fun suspendNoninlineAcceptsVCString(i: Int, vc: VCString) { + result = vc +} + +suspend fun suspendNoninlineAcceptsVCStringNullable(i: Int, vc: VCStringNullable) { + result = vc +} + +suspend fun suspendNoninlineAcceptsVCAny(i: Int, vc: VCAny) { + result = vc +} + +suspend fun suspendNoninlineAcceptsVCAnyNullable(i: Int, vc: VCAnyNullable) { + result = vc +} + +suspend fun suspendNoninlineAcceptsVCInt(i: Int, vc: VCInt) { + result = vc +} + +suspend fun suspendNoninlineAcceptsVCIntNullable(i: Int, vc: VCIntNullable) { + result = vc +} + +suspend fun suspendNoninlineAcceptsVCString_Null(i: Int, vc: VCString?) { + result = vc +} + +suspend fun suspendNoninlineAcceptsVCStringNullable_Null(i: Int, vc: VCStringNullable?) { + result = vc +} + +suspend fun suspendNoninlineAcceptsVCAny_Null(i: Int, vc: VCAny?) { + result = vc +} + +suspend fun suspendNoninlineAcceptsVCAnyNullable_Null(i: Int, vc: VCAnyNullable?) { + result = vc +} + +suspend fun suspendNoninlineAcceptsVCInt_Null(i: Int, vc: VCInt?) { + result = vc +} + +suspend fun suspendNoninlineAcceptsVCIntNullable_Null(i: Int, vc: VCIntNullable?) { + result = vc +} + +suspend inline fun suspendInlineReturnsVCString(): VCString = VCString("OK") +suspend inline fun suspendInlineReturnsVCStringNullable(): VCStringNullable = VCStringNullable("OK") +suspend inline fun suspendInlineReturnsVCAny(): VCAny = VCAny("OK") +suspend inline fun suspendInlineReturnsVCAnyNullable(): VCAnyNullable = VCAnyNullable("OK") +suspend inline fun suspendInlineReturnsVCInt(): VCInt = VCInt(42) +suspend inline fun suspendInlineReturnsVCIntNullable(): VCIntNullable = VCIntNullable(42) +suspend inline fun suspendInlineReturnsVCString_Null(): VCString? = null +suspend inline fun suspendInlineReturnsVCStringNullable_Null(): VCStringNullable? = null +suspend inline fun suspendInlineReturnsVCAny_Null(): VCAny? = null +suspend inline fun suspendInlineReturnsVCAnyNullable_Null(): VCAnyNullable? = null +suspend inline fun suspendInlineReturnsVCInt_Null(): VCInt? = null +suspend inline fun suspendInlineReturnsVCIntNullable_Null(): VCIntNullable? = null +suspend inline fun suspendInlineAcceptsVCString(i: Int, vc: VCString) { + result = vc +} + +suspend inline fun suspendInlineAcceptsVCStringNullable(i: Int, vc: VCStringNullable) { + result = vc +} + +suspend inline fun suspendInlineAcceptsVCAny(i: Int, vc: VCAny) { + result = vc +} + +suspend inline fun suspendInlineAcceptsVCAnyNullable(i: Int, vc: VCAnyNullable) { + result = vc +} + +suspend inline fun suspendInlineAcceptsVCInt(i: Int, vc: VCInt) { + result = vc +} + +suspend inline fun suspendInlineAcceptsVCIntNullable(i: Int, vc: VCIntNullable) { + result = vc +} + +suspend inline fun suspendInlineAcceptsVCString_Null(i: Int, vc: VCString?) { + result = vc +} + +suspend inline fun suspendInlineAcceptsVCStringNullable_Null(i: Int, vc: VCStringNullable?) { + result = vc +} + +suspend inline fun suspendInlineAcceptsVCAny_Null(i: Int, vc: VCAny?) { + result = vc +} + +suspend inline fun suspendInlineAcceptsVCAnyNullable_Null(i: Int, vc: VCAnyNullable?) { + result = vc +} + +suspend inline fun suspendInlineAcceptsVCInt_Null(i: Int, vc: VCInt?) { + result = vc +} + +suspend inline fun suspendInlineAcceptsVCIntNullable_Null(i: Int, vc: VCIntNullable?) { + result = vc +} + +class C { + fun ordinaryNoninlineReturnsVCString(): VCString = VCString("OK") + fun ordinaryNoninlineReturnsVCStringNullable(): VCStringNullable = VCStringNullable("OK") + fun ordinaryNoninlineReturnsVCAny(): VCAny = VCAny("OK") + fun ordinaryNoninlineReturnsVCAnyNullable(): VCAnyNullable = VCAnyNullable("OK") + fun ordinaryNoninlineReturnsVCInt(): VCInt = VCInt(42) + fun ordinaryNoninlineReturnsVCIntNullable(): VCIntNullable = VCIntNullable(42) + fun ordinaryNoninlineReturnsVCString_Null(): VCString? = null + fun ordinaryNoninlineReturnsVCStringNullable_Null(): VCStringNullable? = null + fun ordinaryNoninlineReturnsVCAny_Null(): VCAny? = null + fun ordinaryNoninlineReturnsVCAnyNullable_Null(): VCAnyNullable? = null + fun ordinaryNoninlineReturnsVCInt_Null(): VCInt? = null + fun ordinaryNoninlineReturnsVCIntNullable_Null(): VCIntNullable? = null + fun ordinaryNoninlineAcceptsVCString(i: Int, vc: VCString) { + result = vc + } + + fun ordinaryNoninlineAcceptsVCStringNullable(i: Int, vc: VCStringNullable) { + result = vc + } + + fun ordinaryNoninlineAcceptsVCAny(i: Int, vc: VCAny) { + result = vc + } + + fun ordinaryNoninlineAcceptsVCAnyNullable(i: Int, vc: VCAnyNullable) { + result = vc + } + + fun ordinaryNoninlineAcceptsVCInt(i: Int, vc: VCInt) { + result = vc + } + + fun ordinaryNoninlineAcceptsVCIntNullable(i: Int, vc: VCIntNullable) { + result = vc + } + + fun ordinaryNoninlineAcceptsVCString_Null(i: Int, vc: VCString?) { + result = vc + } + + fun ordinaryNoninlineAcceptsVCStringNullable_Null(i: Int, vc: VCStringNullable?) { + result = vc + } + + fun ordinaryNoninlineAcceptsVCAny_Null(i: Int, vc: VCAny?) { + result = vc + } + + fun ordinaryNoninlineAcceptsVCAnyNullable_Null(i: Int, vc: VCAnyNullable?) { + result = vc + } + + fun ordinaryNoninlineAcceptsVCInt_Null(i: Int, vc: VCInt?) { + result = vc + } + + fun ordinaryNoninlineAcceptsVCIntNullable_Null(i: Int, vc: VCIntNullable?) { + result = vc + } + + inline fun ordinaryInlineReturnsVCString(): VCString = VCString("OK") + inline fun ordinaryInlineReturnsVCStringNullable(): VCStringNullable = VCStringNullable("OK") + inline fun ordinaryInlineReturnsVCAny(): VCAny = VCAny("OK") + inline fun ordinaryInlineReturnsVCAnyNullable(): VCAnyNullable = VCAnyNullable("OK") + inline fun ordinaryInlineReturnsVCInt(): VCInt = VCInt(42) + inline fun ordinaryInlineReturnsVCIntNullable(): VCIntNullable = VCIntNullable(42) + inline fun ordinaryInlineReturnsVCString_Null(): VCString? = null + inline fun ordinaryInlineReturnsVCStringNullable_Null(): VCStringNullable? = null + inline fun ordinaryInlineReturnsVCAny_Null(): VCAny? = null + inline fun ordinaryInlineReturnsVCAnyNullable_Null(): VCAnyNullable? = null + inline fun ordinaryInlineReturnsVCInt_Null(): VCInt? = null + inline fun ordinaryInlineReturnsVCIntNullable_Null(): VCIntNullable? = null + inline fun ordinaryInlineAcceptsVCString(i: Int, vc: VCString) { + result = vc + } + + inline fun ordinaryInlineAcceptsVCStringNullable(i: Int, vc: VCStringNullable) { + result = vc + } + + inline fun ordinaryInlineAcceptsVCAny(i: Int, vc: VCAny) { + result = vc + } + + inline fun ordinaryInlineAcceptsVCAnyNullable(i: Int, vc: VCAnyNullable) { + result = vc + } + + inline fun ordinaryInlineAcceptsVCInt(i: Int, vc: VCInt) { + result = vc + } + + inline fun ordinaryInlineAcceptsVCIntNullable(i: Int, vc: VCIntNullable) { + result = vc + } + + inline fun ordinaryInlineAcceptsVCString_Null(i: Int, vc: VCString?) { + result = vc + } + + inline fun ordinaryInlineAcceptsVCStringNullable_Null(i: Int, vc: VCStringNullable?) { + result = vc + } + + inline fun ordinaryInlineAcceptsVCAny_Null(i: Int, vc: VCAny?) { + result = vc + } + + inline fun ordinaryInlineAcceptsVCAnyNullable_Null(i: Int, vc: VCAnyNullable?) { + result = vc + } + + inline fun ordinaryInlineAcceptsVCInt_Null(i: Int, vc: VCInt?) { + result = vc + } + + inline fun ordinaryInlineAcceptsVCIntNullable_Null(i: Int, vc: VCIntNullable?) { + result = vc + } + + suspend fun suspendNoninlineReturnsVCString(): VCString = VCString("OK") + suspend fun suspendNoninlineReturnsVCStringNullable(): VCStringNullable = VCStringNullable("OK") + suspend fun suspendNoninlineReturnsVCAny(): VCAny = VCAny("OK") + suspend fun suspendNoninlineReturnsVCAnyNullable(): VCAnyNullable = VCAnyNullable("OK") + suspend fun suspendNoninlineReturnsVCInt(): VCInt = VCInt(42) + suspend fun suspendNoninlineReturnsVCIntNullable(): VCIntNullable = VCIntNullable(42) + suspend fun suspendNoninlineReturnsVCString_Null(): VCString? = null + suspend fun suspendNoninlineReturnsVCStringNullable_Null(): VCStringNullable? = null + suspend fun suspendNoninlineReturnsVCAny_Null(): VCAny? = null + suspend fun suspendNoninlineReturnsVCAnyNullable_Null(): VCAnyNullable? = null + suspend fun suspendNoninlineReturnsVCInt_Null(): VCInt? = null + suspend fun suspendNoninlineReturnsVCIntNullable_Null(): VCIntNullable? = null + suspend fun suspendNoninlineAcceptsVCString(i: Int, vc: VCString) { + result = vc + } + + suspend fun suspendNoninlineAcceptsVCStringNullable(i: Int, vc: VCStringNullable) { + result = vc + } + + suspend fun suspendNoninlineAcceptsVCAny(i: Int, vc: VCAny) { + result = vc + } + + suspend fun suspendNoninlineAcceptsVCAnyNullable(i: Int, vc: VCAnyNullable) { + result = vc + } + + suspend fun suspendNoninlineAcceptsVCInt(i: Int, vc: VCInt) { + result = vc + } + + suspend fun suspendNoninlineAcceptsVCIntNullable(i: Int, vc: VCIntNullable) { + result = vc + } + + suspend fun suspendNoninlineAcceptsVCString_Null(i: Int, vc: VCString?) { + result = vc + } + + suspend fun suspendNoninlineAcceptsVCStringNullable_Null(i: Int, vc: VCStringNullable?) { + result = vc + } + + suspend fun suspendNoninlineAcceptsVCAny_Null(i: Int, vc: VCAny?) { + result = vc + } + + suspend fun suspendNoninlineAcceptsVCAnyNullable_Null(i: Int, vc: VCAnyNullable?) { + result = vc + } + + suspend fun suspendNoninlineAcceptsVCInt_Null(i: Int, vc: VCInt?) { + result = vc + } + + suspend fun suspendNoninlineAcceptsVCIntNullable_Null(i: Int, vc: VCIntNullable?) { + result = vc + } + + suspend inline fun suspendInlineReturnsVCString(): VCString = VCString("OK") + suspend inline fun suspendInlineReturnsVCStringNullable(): VCStringNullable = VCStringNullable("OK") + suspend inline fun suspendInlineReturnsVCAny(): VCAny = VCAny("OK") + suspend inline fun suspendInlineReturnsVCAnyNullable(): VCAnyNullable = VCAnyNullable("OK") + suspend inline fun suspendInlineReturnsVCInt(): VCInt = VCInt(42) + suspend inline fun suspendInlineReturnsVCIntNullable(): VCIntNullable = VCIntNullable(42) + suspend inline fun suspendInlineReturnsVCString_Null(): VCString? = null + suspend inline fun suspendInlineReturnsVCStringNullable_Null(): VCStringNullable? = null + suspend inline fun suspendInlineReturnsVCAny_Null(): VCAny? = null + suspend inline fun suspendInlineReturnsVCAnyNullable_Null(): VCAnyNullable? = null + suspend inline fun suspendInlineReturnsVCInt_Null(): VCInt? = null + suspend inline fun suspendInlineReturnsVCIntNullable_Null(): VCIntNullable? = null + suspend inline fun suspendInlineAcceptsVCString(i: Int, vc: VCString) { + result = vc + } + + suspend inline fun suspendInlineAcceptsVCStringNullable(i: Int, vc: VCStringNullable) { + result = vc + } + + suspend inline fun suspendInlineAcceptsVCAny(i: Int, vc: VCAny) { + result = vc + } + + suspend inline fun suspendInlineAcceptsVCAnyNullable(i: Int, vc: VCAnyNullable) { + result = vc + } + + suspend inline fun suspendInlineAcceptsVCInt(i: Int, vc: VCInt) { + result = vc + } + + suspend inline fun suspendInlineAcceptsVCIntNullable(i: Int, vc: VCIntNullable) { + result = vc + } + + suspend inline fun suspendInlineAcceptsVCString_Null(i: Int, vc: VCString?) { + result = vc + } + + suspend inline fun suspendInlineAcceptsVCStringNullable_Null(i: Int, vc: VCStringNullable?) { + result = vc + } + + suspend inline fun suspendInlineAcceptsVCAny_Null(i: Int, vc: VCAny?) { + result = vc + } + + suspend inline fun suspendInlineAcceptsVCAnyNullable_Null(i: Int, vc: VCAnyNullable?) { + result = vc + } + + suspend inline fun suspendInlineAcceptsVCInt_Null(i: Int, vc: VCInt?) { + result = vc + } + + suspend inline fun suspendInlineAcceptsVCIntNullable_Null(i: Int, vc: VCIntNullable?) { + result = vc + } +} + +suspend fun test() { + if (ordinaryNoninlineReturnsVCString() != VCString("OK")) throw IllegalStateException("ordinaryNoninlineReturnsVCString") + + if (ordinaryNoninlineReturnsVCStringNullable() != VCStringNullable("OK")) throw IllegalStateException("ordinaryNoninlineReturnsVCStringNullable") + + if (ordinaryNoninlineReturnsVCAny() != VCAny("OK")) throw IllegalStateException("ordinaryNoninlineReturnsVCAny") + + if (ordinaryNoninlineReturnsVCAnyNullable() != VCAnyNullable("OK")) throw IllegalStateException("ordinaryNoninlineReturnsVCAnyNullable") + + if (ordinaryNoninlineReturnsVCInt() != VCInt(42)) throw IllegalStateException("ordinaryNoninlineReturnsVCInt") + + if (ordinaryNoninlineReturnsVCIntNullable() != VCIntNullable(42)) throw IllegalStateException("ordinaryNoninlineReturnsVCIntNullable") + + if (ordinaryNoninlineReturnsVCString_Null() != null) throw IllegalStateException("ordinaryNoninlineReturnsVCString_Null") + + if (ordinaryNoninlineReturnsVCStringNullable_Null() != null) throw IllegalStateException("ordinaryNoninlineReturnsVCStringNullable_Null") + + if (ordinaryNoninlineReturnsVCAny_Null() != null) throw IllegalStateException("ordinaryNoninlineReturnsVCAny_Null") + + if (ordinaryNoninlineReturnsVCAnyNullable_Null() != null) throw IllegalStateException("ordinaryNoninlineReturnsVCAnyNullable_Null") + + if (ordinaryNoninlineReturnsVCInt_Null() != null) throw IllegalStateException("ordinaryNoninlineReturnsVCInt_Null") + + if (ordinaryNoninlineReturnsVCIntNullable_Null() != null) throw IllegalStateException("ordinaryNoninlineReturnsVCIntNullable_Null") + + ordinaryNoninlineAcceptsVCString(1, VCString("OK")) + if (result != VCString("OK")) throw IllegalStateException("ordinaryNoninlineAcceptsVCString") + + ordinaryNoninlineAcceptsVCStringNullable(1, VCStringNullable("OK")) + if (result != VCStringNullable("OK")) throw IllegalStateException("ordinaryNoninlineAcceptsVCStringNullable") + + ordinaryNoninlineAcceptsVCAny(1, VCAny("OK")) + if (result != VCAny("OK")) throw IllegalStateException("ordinaryNoninlineAcceptsVCAny") + + ordinaryNoninlineAcceptsVCAnyNullable(1, VCAnyNullable("OK")) + if (result != VCAnyNullable("OK")) throw IllegalStateException("ordinaryNoninlineAcceptsVCAnyNullable") + + ordinaryNoninlineAcceptsVCInt(1, VCInt(42)) + if (result != VCInt(42)) throw IllegalStateException("ordinaryNoninlineAcceptsVCInt") + + ordinaryNoninlineAcceptsVCIntNullable(1, VCIntNullable(42)) + if (result != VCIntNullable(42)) throw IllegalStateException("ordinaryNoninlineAcceptsVCIntNullable") + + ordinaryNoninlineAcceptsVCString_Null(1, null) + if (result != null) throw IllegalStateException("ordinaryNoninlineAcceptsVCString_Null") + + ordinaryNoninlineAcceptsVCStringNullable_Null(1, null) + if (result != null) throw IllegalStateException("ordinaryNoninlineAcceptsVCStringNullable_Null") + + ordinaryNoninlineAcceptsVCAny_Null(1, null) + if (result != null) throw IllegalStateException("ordinaryNoninlineAcceptsVCAny_Null") + + ordinaryNoninlineAcceptsVCAnyNullable_Null(1, null) + if (result != null) throw IllegalStateException("ordinaryNoninlineAcceptsVCAnyNullable_Null") + + ordinaryNoninlineAcceptsVCInt_Null(1, null) + if (result != null) throw IllegalStateException("ordinaryNoninlineAcceptsVCInt_Null") + + ordinaryNoninlineAcceptsVCIntNullable_Null(1, null) + if (result != null) throw IllegalStateException("ordinaryNoninlineAcceptsVCIntNullable_Null") + + if (ordinaryInlineReturnsVCString() != VCString("OK")) throw IllegalStateException("ordinaryInlineReturnsVCString") + + if (ordinaryInlineReturnsVCStringNullable() != VCStringNullable("OK")) throw IllegalStateException("ordinaryInlineReturnsVCStringNullable") + + if (ordinaryInlineReturnsVCAny() != VCAny("OK")) throw IllegalStateException("ordinaryInlineReturnsVCAny") + + if (ordinaryInlineReturnsVCAnyNullable() != VCAnyNullable("OK")) throw IllegalStateException("ordinaryInlineReturnsVCAnyNullable") + + if (ordinaryInlineReturnsVCInt() != VCInt(42)) throw IllegalStateException("ordinaryInlineReturnsVCInt") + + if (ordinaryInlineReturnsVCIntNullable() != VCIntNullable(42)) throw IllegalStateException("ordinaryInlineReturnsVCIntNullable") + + if (ordinaryInlineReturnsVCString_Null() != null) throw IllegalStateException("ordinaryInlineReturnsVCString_Null") + + if (ordinaryInlineReturnsVCStringNullable_Null() != null) throw IllegalStateException("ordinaryInlineReturnsVCStringNullable_Null") + + if (ordinaryInlineReturnsVCAny_Null() != null) throw IllegalStateException("ordinaryInlineReturnsVCAny_Null") + + if (ordinaryInlineReturnsVCAnyNullable_Null() != null) throw IllegalStateException("ordinaryInlineReturnsVCAnyNullable_Null") + + if (ordinaryInlineReturnsVCInt_Null() != null) throw IllegalStateException("ordinaryInlineReturnsVCInt_Null") + + if (ordinaryInlineReturnsVCIntNullable_Null() != null) throw IllegalStateException("ordinaryInlineReturnsVCIntNullable_Null") + + ordinaryInlineAcceptsVCString(1, VCString("OK")) + if (result != VCString("OK")) throw IllegalStateException("ordinaryInlineAcceptsVCString") + + ordinaryInlineAcceptsVCStringNullable(1, VCStringNullable("OK")) + if (result != VCStringNullable("OK")) throw IllegalStateException("ordinaryInlineAcceptsVCStringNullable") + + ordinaryInlineAcceptsVCAny(1, VCAny("OK")) + if (result != VCAny("OK")) throw IllegalStateException("ordinaryInlineAcceptsVCAny") + + ordinaryInlineAcceptsVCAnyNullable(1, VCAnyNullable("OK")) + if (result != VCAnyNullable("OK")) throw IllegalStateException("ordinaryInlineAcceptsVCAnyNullable") + + ordinaryInlineAcceptsVCInt(1, VCInt(42)) + if (result != VCInt(42)) throw IllegalStateException("ordinaryInlineAcceptsVCInt") + + ordinaryInlineAcceptsVCIntNullable(1, VCIntNullable(42)) + if (result != VCIntNullable(42)) throw IllegalStateException("ordinaryInlineAcceptsVCIntNullable") + + ordinaryInlineAcceptsVCString_Null(1, null) + if (result != null) throw IllegalStateException("ordinaryInlineAcceptsVCString_Null") + + ordinaryInlineAcceptsVCStringNullable_Null(1, null) + if (result != null) throw IllegalStateException("ordinaryInlineAcceptsVCStringNullable_Null") + + ordinaryInlineAcceptsVCAny_Null(1, null) + if (result != null) throw IllegalStateException("ordinaryInlineAcceptsVCAny_Null") + + ordinaryInlineAcceptsVCAnyNullable_Null(1, null) + if (result != null) throw IllegalStateException("ordinaryInlineAcceptsVCAnyNullable_Null") + + ordinaryInlineAcceptsVCInt_Null(1, null) + if (result != null) throw IllegalStateException("ordinaryInlineAcceptsVCInt_Null") + + ordinaryInlineAcceptsVCIntNullable_Null(1, null) + if (result != null) throw IllegalStateException("ordinaryInlineAcceptsVCIntNullable_Null") + + if (suspendNoninlineReturnsVCString() != VCString("OK")) throw IllegalStateException("suspendNoninlineReturnsVCString") + + if (suspendNoninlineReturnsVCStringNullable() != VCStringNullable("OK")) throw IllegalStateException("suspendNoninlineReturnsVCStringNullable") + + if (suspendNoninlineReturnsVCAny() != VCAny("OK")) throw IllegalStateException("suspendNoninlineReturnsVCAny") + + if (suspendNoninlineReturnsVCAnyNullable() != VCAnyNullable("OK")) throw IllegalStateException("suspendNoninlineReturnsVCAnyNullable") + + if (suspendNoninlineReturnsVCInt() != VCInt(42)) throw IllegalStateException("suspendNoninlineReturnsVCInt") + + if (suspendNoninlineReturnsVCIntNullable() != VCIntNullable(42)) throw IllegalStateException("suspendNoninlineReturnsVCIntNullable") + + if (suspendNoninlineReturnsVCString_Null() != null) throw IllegalStateException("suspendNoninlineReturnsVCString_Null") + + if (suspendNoninlineReturnsVCStringNullable_Null() != null) throw IllegalStateException("suspendNoninlineReturnsVCStringNullable_Null") + + if (suspendNoninlineReturnsVCAny_Null() != null) throw IllegalStateException("suspendNoninlineReturnsVCAny_Null") + + if (suspendNoninlineReturnsVCAnyNullable_Null() != null) throw IllegalStateException("suspendNoninlineReturnsVCAnyNullable_Null") + + if (suspendNoninlineReturnsVCInt_Null() != null) throw IllegalStateException("suspendNoninlineReturnsVCInt_Null") + + if (suspendNoninlineReturnsVCIntNullable_Null() != null) throw IllegalStateException("suspendNoninlineReturnsVCIntNullable_Null") + + suspendNoninlineAcceptsVCString(1, VCString("OK")) + if (result != VCString("OK")) throw IllegalStateException("suspendNoninlineAcceptsVCString") + + suspendNoninlineAcceptsVCStringNullable(1, VCStringNullable("OK")) + if (result != VCStringNullable("OK")) throw IllegalStateException("suspendNoninlineAcceptsVCStringNullable") + + suspendNoninlineAcceptsVCAny(1, VCAny("OK")) + if (result != VCAny("OK")) throw IllegalStateException("suspendNoninlineAcceptsVCAny") + + suspendNoninlineAcceptsVCAnyNullable(1, VCAnyNullable("OK")) + if (result != VCAnyNullable("OK")) throw IllegalStateException("suspendNoninlineAcceptsVCAnyNullable") + + suspendNoninlineAcceptsVCInt(1, VCInt(42)) + if (result != VCInt(42)) throw IllegalStateException("suspendNoninlineAcceptsVCInt") + + suspendNoninlineAcceptsVCIntNullable(1, VCIntNullable(42)) + if (result != VCIntNullable(42)) throw IllegalStateException("suspendNoninlineAcceptsVCIntNullable") + + suspendNoninlineAcceptsVCString_Null(1, null) + if (result != null) throw IllegalStateException("suspendNoninlineAcceptsVCString_Null") + + suspendNoninlineAcceptsVCStringNullable_Null(1, null) + if (result != null) throw IllegalStateException("suspendNoninlineAcceptsVCStringNullable_Null") + + suspendNoninlineAcceptsVCAny_Null(1, null) + if (result != null) throw IllegalStateException("suspendNoninlineAcceptsVCAny_Null") + + suspendNoninlineAcceptsVCAnyNullable_Null(1, null) + if (result != null) throw IllegalStateException("suspendNoninlineAcceptsVCAnyNullable_Null") + + suspendNoninlineAcceptsVCInt_Null(1, null) + if (result != null) throw IllegalStateException("suspendNoninlineAcceptsVCInt_Null") + + suspendNoninlineAcceptsVCIntNullable_Null(1, null) + if (result != null) throw IllegalStateException("suspendNoninlineAcceptsVCIntNullable_Null") + + if (suspendInlineReturnsVCString() != VCString("OK")) throw IllegalStateException("suspendInlineReturnsVCString") + + if (suspendInlineReturnsVCStringNullable() != VCStringNullable("OK")) throw IllegalStateException("suspendInlineReturnsVCStringNullable") + + if (suspendInlineReturnsVCAny() != VCAny("OK")) throw IllegalStateException("suspendInlineReturnsVCAny") + + if (suspendInlineReturnsVCAnyNullable() != VCAnyNullable("OK")) throw IllegalStateException("suspendInlineReturnsVCAnyNullable") + + if (suspendInlineReturnsVCInt() != VCInt(42)) throw IllegalStateException("suspendInlineReturnsVCInt") + + if (suspendInlineReturnsVCIntNullable() != VCIntNullable(42)) throw IllegalStateException("suspendInlineReturnsVCIntNullable") + + if (suspendInlineReturnsVCString_Null() != null) throw IllegalStateException("suspendInlineReturnsVCString_Null") + + if (suspendInlineReturnsVCStringNullable_Null() != null) throw IllegalStateException("suspendInlineReturnsVCStringNullable_Null") + + if (suspendInlineReturnsVCAny_Null() != null) throw IllegalStateException("suspendInlineReturnsVCAny_Null") + + if (suspendInlineReturnsVCAnyNullable_Null() != null) throw IllegalStateException("suspendInlineReturnsVCAnyNullable_Null") + + if (suspendInlineReturnsVCInt_Null() != null) throw IllegalStateException("suspendInlineReturnsVCInt_Null") + + if (suspendInlineReturnsVCIntNullable_Null() != null) throw IllegalStateException("suspendInlineReturnsVCIntNullable_Null") + + suspendInlineAcceptsVCString(1, VCString("OK")) + if (result != VCString("OK")) throw IllegalStateException("suspendInlineAcceptsVCString") + + suspendInlineAcceptsVCStringNullable(1, VCStringNullable("OK")) + if (result != VCStringNullable("OK")) throw IllegalStateException("suspendInlineAcceptsVCStringNullable") + + suspendInlineAcceptsVCAny(1, VCAny("OK")) + if (result != VCAny("OK")) throw IllegalStateException("suspendInlineAcceptsVCAny") + + suspendInlineAcceptsVCAnyNullable(1, VCAnyNullable("OK")) + if (result != VCAnyNullable("OK")) throw IllegalStateException("suspendInlineAcceptsVCAnyNullable") + + suspendInlineAcceptsVCInt(1, VCInt(42)) + if (result != VCInt(42)) throw IllegalStateException("suspendInlineAcceptsVCInt") + + suspendInlineAcceptsVCIntNullable(1, VCIntNullable(42)) + if (result != VCIntNullable(42)) throw IllegalStateException("suspendInlineAcceptsVCIntNullable") + + suspendInlineAcceptsVCString_Null(1, null) + if (result != null) throw IllegalStateException("suspendInlineAcceptsVCString_Null") + + suspendInlineAcceptsVCStringNullable_Null(1, null) + if (result != null) throw IllegalStateException("suspendInlineAcceptsVCStringNullable_Null") + + suspendInlineAcceptsVCAny_Null(1, null) + if (result != null) throw IllegalStateException("suspendInlineAcceptsVCAny_Null") + + suspendInlineAcceptsVCAnyNullable_Null(1, null) + if (result != null) throw IllegalStateException("suspendInlineAcceptsVCAnyNullable_Null") + + suspendInlineAcceptsVCInt_Null(1, null) + if (result != null) throw IllegalStateException("suspendInlineAcceptsVCInt_Null") + + suspendInlineAcceptsVCIntNullable_Null(1, null) + if (result != null) throw IllegalStateException("suspendInlineAcceptsVCIntNullable_Null") + + if (C().ordinaryNoninlineReturnsVCString() != VCString("OK")) throw IllegalStateException("C().ordinaryNoninlineReturnsVCString") + + if (C().ordinaryNoninlineReturnsVCStringNullable() != VCStringNullable("OK")) throw IllegalStateException("C().ordinaryNoninlineReturnsVCStringNullable") + + if (C().ordinaryNoninlineReturnsVCAny() != VCAny("OK")) throw IllegalStateException("C().ordinaryNoninlineReturnsVCAny") + + if (C().ordinaryNoninlineReturnsVCAnyNullable() != VCAnyNullable("OK")) throw IllegalStateException("C().ordinaryNoninlineReturnsVCAnyNullable") + + if (C().ordinaryNoninlineReturnsVCInt() != VCInt(42)) throw IllegalStateException("C().ordinaryNoninlineReturnsVCInt") + + if (C().ordinaryNoninlineReturnsVCIntNullable() != VCIntNullable(42)) throw IllegalStateException("C().ordinaryNoninlineReturnsVCIntNullable") + + if (C().ordinaryNoninlineReturnsVCString_Null() != null) throw IllegalStateException("C().ordinaryNoninlineReturnsVCString_Null") + + if (C().ordinaryNoninlineReturnsVCStringNullable_Null() != null) throw IllegalStateException("C().ordinaryNoninlineReturnsVCStringNullable_Null") + + if (C().ordinaryNoninlineReturnsVCAny_Null() != null) throw IllegalStateException("C().ordinaryNoninlineReturnsVCAny_Null") + + if (C().ordinaryNoninlineReturnsVCAnyNullable_Null() != null) throw IllegalStateException("C().ordinaryNoninlineReturnsVCAnyNullable_Null") + + if (C().ordinaryNoninlineReturnsVCInt_Null() != null) throw IllegalStateException("C().ordinaryNoninlineReturnsVCInt_Null") + + if (C().ordinaryNoninlineReturnsVCIntNullable_Null() != null) throw IllegalStateException("C().ordinaryNoninlineReturnsVCIntNullable_Null") + + C().ordinaryNoninlineAcceptsVCString(1, VCString("OK")) + if (result != VCString("OK")) throw IllegalStateException("C().ordinaryNoninlineAcceptsVCString") + + C().ordinaryNoninlineAcceptsVCStringNullable(1, VCStringNullable("OK")) + if (result != VCStringNullable("OK")) throw IllegalStateException("C().ordinaryNoninlineAcceptsVCStringNullable") + + C().ordinaryNoninlineAcceptsVCAny(1, VCAny("OK")) + if (result != VCAny("OK")) throw IllegalStateException("C().ordinaryNoninlineAcceptsVCAny") + + C().ordinaryNoninlineAcceptsVCAnyNullable(1, VCAnyNullable("OK")) + if (result != VCAnyNullable("OK")) throw IllegalStateException("C().ordinaryNoninlineAcceptsVCAnyNullable") + + C().ordinaryNoninlineAcceptsVCInt(1, VCInt(42)) + if (result != VCInt(42)) throw IllegalStateException("C().ordinaryNoninlineAcceptsVCInt") + + C().ordinaryNoninlineAcceptsVCIntNullable(1, VCIntNullable(42)) + if (result != VCIntNullable(42)) throw IllegalStateException("C().ordinaryNoninlineAcceptsVCIntNullable") + + C().ordinaryNoninlineAcceptsVCString_Null(1, null) + if (result != null) throw IllegalStateException("C().ordinaryNoninlineAcceptsVCString_Null") + + C().ordinaryNoninlineAcceptsVCStringNullable_Null(1, null) + if (result != null) throw IllegalStateException("C().ordinaryNoninlineAcceptsVCStringNullable_Null") + + C().ordinaryNoninlineAcceptsVCAny_Null(1, null) + if (result != null) throw IllegalStateException("C().ordinaryNoninlineAcceptsVCAny_Null") + + C().ordinaryNoninlineAcceptsVCAnyNullable_Null(1, null) + if (result != null) throw IllegalStateException("C().ordinaryNoninlineAcceptsVCAnyNullable_Null") + + C().ordinaryNoninlineAcceptsVCInt_Null(1, null) + if (result != null) throw IllegalStateException("C().ordinaryNoninlineAcceptsVCInt_Null") + + C().ordinaryNoninlineAcceptsVCIntNullable_Null(1, null) + if (result != null) throw IllegalStateException("C().ordinaryNoninlineAcceptsVCIntNullable_Null") + + if (C().ordinaryInlineReturnsVCString() != VCString("OK")) throw IllegalStateException("C().ordinaryInlineReturnsVCString") + + if (C().ordinaryInlineReturnsVCStringNullable() != VCStringNullable("OK")) throw IllegalStateException("C().ordinaryInlineReturnsVCStringNullable") + + if (C().ordinaryInlineReturnsVCAny() != VCAny("OK")) throw IllegalStateException("C().ordinaryInlineReturnsVCAny") + + if (C().ordinaryInlineReturnsVCAnyNullable() != VCAnyNullable("OK")) throw IllegalStateException("C().ordinaryInlineReturnsVCAnyNullable") + + if (C().ordinaryInlineReturnsVCInt() != VCInt(42)) throw IllegalStateException("C().ordinaryInlineReturnsVCInt") + + if (C().ordinaryInlineReturnsVCIntNullable() != VCIntNullable(42)) throw IllegalStateException("C().ordinaryInlineReturnsVCIntNullable") + + if (C().ordinaryInlineReturnsVCString_Null() != null) throw IllegalStateException("C().ordinaryInlineReturnsVCString_Null") + + if (C().ordinaryInlineReturnsVCStringNullable_Null() != null) throw IllegalStateException("C().ordinaryInlineReturnsVCStringNullable_Null") + + if (C().ordinaryInlineReturnsVCAny_Null() != null) throw IllegalStateException("C().ordinaryInlineReturnsVCAny_Null") + + if (C().ordinaryInlineReturnsVCAnyNullable_Null() != null) throw IllegalStateException("C().ordinaryInlineReturnsVCAnyNullable_Null") + + if (C().ordinaryInlineReturnsVCInt_Null() != null) throw IllegalStateException("C().ordinaryInlineReturnsVCInt_Null") + + if (C().ordinaryInlineReturnsVCIntNullable_Null() != null) throw IllegalStateException("C().ordinaryInlineReturnsVCIntNullable_Null") + + C().ordinaryInlineAcceptsVCString(1, VCString("OK")) + if (result != VCString("OK")) throw IllegalStateException("C().ordinaryInlineAcceptsVCString") + + C().ordinaryInlineAcceptsVCStringNullable(1, VCStringNullable("OK")) + if (result != VCStringNullable("OK")) throw IllegalStateException("C().ordinaryInlineAcceptsVCStringNullable") + + C().ordinaryInlineAcceptsVCAny(1, VCAny("OK")) + if (result != VCAny("OK")) throw IllegalStateException("C().ordinaryInlineAcceptsVCAny") + + C().ordinaryInlineAcceptsVCAnyNullable(1, VCAnyNullable("OK")) + if (result != VCAnyNullable("OK")) throw IllegalStateException("C().ordinaryInlineAcceptsVCAnyNullable") + + C().ordinaryInlineAcceptsVCInt(1, VCInt(42)) + if (result != VCInt(42)) throw IllegalStateException("C().ordinaryInlineAcceptsVCInt") + + C().ordinaryInlineAcceptsVCIntNullable(1, VCIntNullable(42)) + if (result != VCIntNullable(42)) throw IllegalStateException("C().ordinaryInlineAcceptsVCIntNullable") + + C().ordinaryInlineAcceptsVCString_Null(1, null) + if (result != null) throw IllegalStateException("C().ordinaryInlineAcceptsVCString_Null") + + C().ordinaryInlineAcceptsVCStringNullable_Null(1, null) + if (result != null) throw IllegalStateException("C().ordinaryInlineAcceptsVCStringNullable_Null") + + C().ordinaryInlineAcceptsVCAny_Null(1, null) + if (result != null) throw IllegalStateException("C().ordinaryInlineAcceptsVCAny_Null") + + C().ordinaryInlineAcceptsVCAnyNullable_Null(1, null) + if (result != null) throw IllegalStateException("C().ordinaryInlineAcceptsVCAnyNullable_Null") + + C().ordinaryInlineAcceptsVCInt_Null(1, null) + if (result != null) throw IllegalStateException("C().ordinaryInlineAcceptsVCInt_Null") + + C().ordinaryInlineAcceptsVCIntNullable_Null(1, null) + if (result != null) throw IllegalStateException("C().ordinaryInlineAcceptsVCIntNullable_Null") + + if (C().suspendNoninlineReturnsVCString() != VCString("OK")) throw IllegalStateException("C().suspendNoninlineReturnsVCString") + + if (C().suspendNoninlineReturnsVCStringNullable() != VCStringNullable("OK")) throw IllegalStateException("C().suspendNoninlineReturnsVCStringNullable") + + if (C().suspendNoninlineReturnsVCAny() != VCAny("OK")) throw IllegalStateException("C().suspendNoninlineReturnsVCAny") + + if (C().suspendNoninlineReturnsVCAnyNullable() != VCAnyNullable("OK")) throw IllegalStateException("C().suspendNoninlineReturnsVCAnyNullable") + + if (C().suspendNoninlineReturnsVCInt() != VCInt(42)) throw IllegalStateException("C().suspendNoninlineReturnsVCInt") + + if (C().suspendNoninlineReturnsVCIntNullable() != VCIntNullable(42)) throw IllegalStateException("C().suspendNoninlineReturnsVCIntNullable") + + if (C().suspendNoninlineReturnsVCString_Null() != null) throw IllegalStateException("C().suspendNoninlineReturnsVCString_Null") + + if (C().suspendNoninlineReturnsVCStringNullable_Null() != null) throw IllegalStateException("C().suspendNoninlineReturnsVCStringNullable_Null") + + if (C().suspendNoninlineReturnsVCAny_Null() != null) throw IllegalStateException("C().suspendNoninlineReturnsVCAny_Null") + + if (C().suspendNoninlineReturnsVCAnyNullable_Null() != null) throw IllegalStateException("C().suspendNoninlineReturnsVCAnyNullable_Null") + + if (C().suspendNoninlineReturnsVCInt_Null() != null) throw IllegalStateException("C().suspendNoninlineReturnsVCInt_Null") + + if (C().suspendNoninlineReturnsVCIntNullable_Null() != null) throw IllegalStateException("C().suspendNoninlineReturnsVCIntNullable_Null") + + C().suspendNoninlineAcceptsVCString(1, VCString("OK")) + if (result != VCString("OK")) throw IllegalStateException("C().suspendNoninlineAcceptsVCString") + + C().suspendNoninlineAcceptsVCStringNullable(1, VCStringNullable("OK")) + if (result != VCStringNullable("OK")) throw IllegalStateException("C().suspendNoninlineAcceptsVCStringNullable") + + C().suspendNoninlineAcceptsVCAny(1, VCAny("OK")) + if (result != VCAny("OK")) throw IllegalStateException("C().suspendNoninlineAcceptsVCAny") + + C().suspendNoninlineAcceptsVCAnyNullable(1, VCAnyNullable("OK")) + if (result != VCAnyNullable("OK")) throw IllegalStateException("C().suspendNoninlineAcceptsVCAnyNullable") + + C().suspendNoninlineAcceptsVCInt(1, VCInt(42)) + if (result != VCInt(42)) throw IllegalStateException("C().suspendNoninlineAcceptsVCInt") + + C().suspendNoninlineAcceptsVCIntNullable(1, VCIntNullable(42)) + if (result != VCIntNullable(42)) throw IllegalStateException("C().suspendNoninlineAcceptsVCIntNullable") + + C().suspendNoninlineAcceptsVCString_Null(1, null) + if (result != null) throw IllegalStateException("C().suspendNoninlineAcceptsVCString_Null") + + C().suspendNoninlineAcceptsVCStringNullable_Null(1, null) + if (result != null) throw IllegalStateException("C().suspendNoninlineAcceptsVCStringNullable_Null") + + C().suspendNoninlineAcceptsVCAny_Null(1, null) + if (result != null) throw IllegalStateException("C().suspendNoninlineAcceptsVCAny_Null") + + C().suspendNoninlineAcceptsVCAnyNullable_Null(1, null) + if (result != null) throw IllegalStateException("C().suspendNoninlineAcceptsVCAnyNullable_Null") + + C().suspendNoninlineAcceptsVCInt_Null(1, null) + if (result != null) throw IllegalStateException("C().suspendNoninlineAcceptsVCInt_Null") + + C().suspendNoninlineAcceptsVCIntNullable_Null(1, null) + if (result != null) throw IllegalStateException("C().suspendNoninlineAcceptsVCIntNullable_Null") + + if (C().suspendInlineReturnsVCString() != VCString("OK")) throw IllegalStateException("C().suspendInlineReturnsVCString") + + if (C().suspendInlineReturnsVCStringNullable() != VCStringNullable("OK")) throw IllegalStateException("C().suspendInlineReturnsVCStringNullable") + + if (C().suspendInlineReturnsVCAny() != VCAny("OK")) throw IllegalStateException("C().suspendInlineReturnsVCAny") + + if (C().suspendInlineReturnsVCAnyNullable() != VCAnyNullable("OK")) throw IllegalStateException("C().suspendInlineReturnsVCAnyNullable") + + if (C().suspendInlineReturnsVCInt() != VCInt(42)) throw IllegalStateException("C().suspendInlineReturnsVCInt") + + if (C().suspendInlineReturnsVCIntNullable() != VCIntNullable(42)) throw IllegalStateException("C().suspendInlineReturnsVCIntNullable") + + if (C().suspendInlineReturnsVCString_Null() != null) throw IllegalStateException("C().suspendInlineReturnsVCString_Null") + + if (C().suspendInlineReturnsVCStringNullable_Null() != null) throw IllegalStateException("C().suspendInlineReturnsVCStringNullable_Null") + + if (C().suspendInlineReturnsVCAny_Null() != null) throw IllegalStateException("C().suspendInlineReturnsVCAny_Null") + + if (C().suspendInlineReturnsVCAnyNullable_Null() != null) throw IllegalStateException("C().suspendInlineReturnsVCAnyNullable_Null") + + if (C().suspendInlineReturnsVCInt_Null() != null) throw IllegalStateException("C().suspendInlineReturnsVCInt_Null") + + if (C().suspendInlineReturnsVCIntNullable_Null() != null) throw IllegalStateException("C().suspendInlineReturnsVCIntNullable_Null") + + C().suspendInlineAcceptsVCString(1, VCString("OK")) + if (result != VCString("OK")) throw IllegalStateException("C().suspendInlineAcceptsVCString") + + C().suspendInlineAcceptsVCStringNullable(1, VCStringNullable("OK")) + if (result != VCStringNullable("OK")) throw IllegalStateException("C().suspendInlineAcceptsVCStringNullable") + + C().suspendInlineAcceptsVCAny(1, VCAny("OK")) + if (result != VCAny("OK")) throw IllegalStateException("C().suspendInlineAcceptsVCAny") + + C().suspendInlineAcceptsVCAnyNullable(1, VCAnyNullable("OK")) + if (result != VCAnyNullable("OK")) throw IllegalStateException("C().suspendInlineAcceptsVCAnyNullable") + + C().suspendInlineAcceptsVCInt(1, VCInt(42)) + if (result != VCInt(42)) throw IllegalStateException("C().suspendInlineAcceptsVCInt") + + C().suspendInlineAcceptsVCIntNullable(1, VCIntNullable(42)) + if (result != VCIntNullable(42)) throw IllegalStateException("C().suspendInlineAcceptsVCIntNullable") + + C().suspendInlineAcceptsVCString_Null(1, null) + if (result != null) throw IllegalStateException("C().suspendInlineAcceptsVCString_Null") + + C().suspendInlineAcceptsVCStringNullable_Null(1, null) + if (result != null) throw IllegalStateException("C().suspendInlineAcceptsVCStringNullable_Null") + + C().suspendInlineAcceptsVCAny_Null(1, null) + if (result != null) throw IllegalStateException("C().suspendInlineAcceptsVCAny_Null") + + C().suspendInlineAcceptsVCAnyNullable_Null(1, null) + if (result != null) throw IllegalStateException("C().suspendInlineAcceptsVCAnyNullable_Null") + + C().suspendInlineAcceptsVCInt_Null(1, null) + if (result != null) throw IllegalStateException("C().suspendInlineAcceptsVCInt_Null") + + C().suspendInlineAcceptsVCIntNullable_Null(1, null) + if (result != null) throw IllegalStateException("C().suspendInlineAcceptsVCIntNullable_Null") +} + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(Continuation(EmptyCoroutineContext) {}) +} + +fun box(): String { + builder { + test() + } + return "OK" +} \ No newline at end of file diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index a2faa93e722..de242c036d2 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -34144,6 +34144,24 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } } + @TestMetadata("compiler/testData/codegen/box/valueClasses") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ValueClasses extends AbstractBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInValueClasses() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("jvmInline.kt") + public void testJvmInline() throws Exception { + runTest("compiler/testData/codegen/box/valueClasses/jvmInline.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/vararg") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 467716f9c04..bc9ccf66974 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -31778,6 +31778,24 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } } + @TestMetadata("compiler/testData/codegen/box/valueClasses") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ValueClasses extends AbstractLightAnalysisModeTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInValueClasses() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("jvmInline.kt") + public void testJvmInline() throws Exception { + runTest("compiler/testData/codegen/box/valueClasses/jvmInline.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/vararg") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index e1c4edc5dd4..74865be1a99 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -32373,6 +32373,24 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } } + @TestMetadata("compiler/testData/codegen/box/valueClasses") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ValueClasses extends AbstractIrBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInValueClasses() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("jvmInline.kt") + public void testJvmInline() throws Exception { + runTest("compiler/testData/codegen/box/valueClasses/jvmInline.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/vararg") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index ea6edae111a..643c18b2124 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -26259,6 +26259,24 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } } + @TestMetadata("compiler/testData/codegen/box/valueClasses") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ValueClasses extends AbstractIrJsCodegenBoxES6Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); + } + + public void testAllFilesPresentInValueClasses() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + + @TestMetadata("jvmInline.kt") + public void testJvmInline() throws Exception { + runTest("compiler/testData/codegen/box/valueClasses/jvmInline.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/vararg") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index eb22ec13451..707d42997f7 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -26259,6 +26259,24 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } } + @TestMetadata("compiler/testData/codegen/box/valueClasses") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ValueClasses extends AbstractIrJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInValueClasses() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + + @TestMetadata("jvmInline.kt") + public void testJvmInline() throws Exception { + runTest("compiler/testData/codegen/box/valueClasses/jvmInline.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/vararg") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index c5181fd0c2c..a788de84b29 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -26259,6 +26259,24 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } } + @TestMetadata("compiler/testData/codegen/box/valueClasses") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ValueClasses extends AbstractJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); + } + + public void testAllFilesPresentInValueClasses() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + + @TestMetadata("jvmInline.kt") + public void testJvmInline() throws Exception { + runTest("compiler/testData/codegen/box/valueClasses/jvmInline.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/vararg") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index 7bf5699dec3..3eb24aef7aa 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -14422,6 +14422,24 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest } } + @TestMetadata("compiler/testData/codegen/box/valueClasses") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ValueClasses extends AbstractIrCodegenBoxWasmTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath); + } + + public void testAllFilesPresentInValueClasses() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); + } + + @TestMetadata("jvmInline.kt") + public void testJvmInline() throws Exception { + runTest("compiler/testData/codegen/box/valueClasses/jvmInline.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/vararg") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) From f43899086a951452ef240319c56b5bd8a279af07 Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Fri, 27 Nov 2020 20:36:38 +0100 Subject: [PATCH 439/698] Value Classes: Forbid var properties with value class receivers --- ...irOldFrontendDiagnosticsTestGenerated.java | 5 +++++ .../jetbrains/kotlin/diagnostics/Errors.java | 3 ++- .../rendering/DefaultErrorMessages.java | 1 + .../resolve/PlatformConfiguratorBase.kt | 2 +- .../checkers/InlineClassDeclarationChecker.kt | 20 +++++++++++++------ .../delegatedPropertyInInlineClass.kt | 4 ++-- ...rtiesWithBackingFieldsInsideInlineClass.kt | 6 +++--- .../varPropertyWithInlineClassReceiver.fir.kt | 12 +++++++++++ .../varPropertyWithInlineClassReceiver.kt | 12 +++++++++++ .../varPropertyWithInlineClassReceiver.txt | 12 +++++++++++ .../delegatedPropertyInValueClass.kt | 4 ++-- ...ertiesWithBackingFieldsInsideValueClass.kt | 6 +++--- .../checkers/DiagnosticsTestGenerated.java | 5 +++++ .../DiagnosticsUsingJavacTestGenerated.java | 5 +++++ 14 files changed, 79 insertions(+), 18 deletions(-) create mode 100644 compiler/testData/diagnostics/tests/inlineClasses/varPropertyWithInlineClassReceiver.fir.kt create mode 100644 compiler/testData/diagnostics/tests/inlineClasses/varPropertyWithInlineClassReceiver.kt create mode 100644 compiler/testData/diagnostics/tests/inlineClasses/varPropertyWithInlineClassReceiver.txt diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java index ee445859742..48b52692805 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java @@ -12957,6 +12957,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte runTest("compiler/testData/diagnostics/tests/inlineClasses/unsignedLiteralsWithoutArtifactOnClasspath.kt"); } + @TestMetadata("varPropertyWithInlineClassReceiver.kt") + public void testVarPropertyWithInlineClassReceiver() throws Exception { + runTest("compiler/testData/diagnostics/tests/inlineClasses/varPropertyWithInlineClassReceiver.kt"); + } + @TestMetadata("varargsOnParametersOfInlineClassType.kt") public void testVarargsOnParametersOfInlineClassType() throws Exception { runTest("compiler/testData/diagnostics/tests/inlineClasses/varargsOnParametersOfInlineClassType.kt"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index af6d60a3286..23bb2e07731 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -347,7 +347,7 @@ public interface Errors { DiagnosticFactory0 NON_PRIVATE_CONSTRUCTOR_IN_ENUM = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 NON_PRIVATE_CONSTRUCTOR_IN_SEALED = DiagnosticFactory0.create(ERROR); - // Inline classes + // Inline and value classes DiagnosticFactory0 INLINE_CLASS_NOT_TOP_LEVEL = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 INLINE_CLASS_NOT_FINAL = DiagnosticFactory0.create(ERROR); @@ -355,6 +355,7 @@ public interface Errors { DiagnosticFactory0 INLINE_CLASS_CONSTRUCTOR_WRONG_PARAMETERS_SIZE = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 INLINE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 PROPERTY_WITH_BACKING_FIELD_INSIDE_INLINE_CLASS = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); + DiagnosticFactory0 RESERVED_VAR_PROPERTY_OF_VALUE_CLASS = DiagnosticFactory0.create(WARNING); DiagnosticFactory0 DELEGATED_PROPERTY_INSIDE_INLINE_CLASS = DiagnosticFactory0.create(ERROR); DiagnosticFactory1 INLINE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE = DiagnosticFactory1.create(ERROR); DiagnosticFactory0 INLINE_CLASS_CANNOT_IMPLEMENT_INTERFACE_BY_DELEGATION = DiagnosticFactory0.create(ERROR); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index 135f8d5ebd7..997874e2a62 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -710,6 +710,7 @@ public class DefaultErrorMessages { MAP.put(INLINE_CLASS_CONSTRUCTOR_WRONG_PARAMETERS_SIZE, "Inline class must have exactly one primary constructor parameter"); MAP.put(INLINE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER, "Value class primary constructor must have only final read-only (val) property parameter"); MAP.put(PROPERTY_WITH_BACKING_FIELD_INSIDE_INLINE_CLASS, "Inline class cannot have properties with backing fields"); + MAP.put(RESERVED_VAR_PROPERTY_OF_VALUE_CLASS, "'var' properties with value class receivers are reserved for future use"); MAP.put(DELEGATED_PROPERTY_INSIDE_INLINE_CLASS, "Inline class cannot have delegated properties"); MAP.put(INLINE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE, "Inline class cannot have value parameter of type ''{0}''", RENDER_TYPE); MAP.put(INLINE_CLASS_CANNOT_IMPLEMENT_INTERFACE_BY_DELEGATION, "Inline class cannot implement an interface by delegation"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt index 10c744d58d3..25ff6d7309b 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt @@ -27,8 +27,8 @@ private val DEFAULT_DECLARATION_CHECKERS = listOf( KClassWithIncorrectTypeArgumentChecker, SuspendLimitationsChecker, InlineClassDeclarationChecker, - PropertiesWithBackingFieldsInsideInlineClass(), InnerClassInsideInlineClass(), + PropertiesWithInlineClassAsReceiver(), AnnotationClassTargetAndRetentionChecker(), ReservedMembersAndConstructsForInlineClass(), ResultClassInReturnTypeChecker(), diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt index 97bc3378858..e17df9f33b1 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt @@ -107,19 +107,27 @@ object InlineClassDeclarationChecker : DeclarationChecker { } } -class PropertiesWithBackingFieldsInsideInlineClass : DeclarationChecker { +class PropertiesWithInlineClassAsReceiver : DeclarationChecker { override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) { if (declaration !is KtProperty) return if (descriptor !is PropertyDescriptor) return - if (!descriptor.containingDeclaration.isInlineClass()) return + if (descriptor.containingDeclaration.isInlineClass()) { + if (context.trace.get(BindingContext.BACKING_FIELD_REQUIRED, descriptor) == true) { + context.trace.report(Errors.PROPERTY_WITH_BACKING_FIELD_INSIDE_INLINE_CLASS.on(declaration)) + } - if (context.trace.get(BindingContext.BACKING_FIELD_REQUIRED, descriptor) == true) { - context.trace.report(Errors.PROPERTY_WITH_BACKING_FIELD_INSIDE_INLINE_CLASS.on(declaration)) + declaration.delegate?.let { + context.trace.report(Errors.DELEGATED_PROPERTY_INSIDE_INLINE_CLASS.on(it)) + } } - declaration.delegate?.let { - context.trace.report(Errors.DELEGATED_PROPERTY_INSIDE_INLINE_CLASS.on(it)) + if (!descriptor.isVar) return + + if (descriptor.containingDeclaration.isInlineClass() || + descriptor.extensionReceiverParameter?.type?.isInlineClassType() == true + ) { + context.trace.report(Errors.RESERVED_VAR_PROPERTY_OF_VALUE_CLASS.on(declaration.valOrVarKeyword)) } } } diff --git a/compiler/testData/diagnostics/tests/inlineClasses/delegatedPropertyInInlineClass.kt b/compiler/testData/diagnostics/tests/inlineClasses/delegatedPropertyInInlineClass.kt index 8a64831f52d..02356440d3f 100644 --- a/compiler/testData/diagnostics/tests/inlineClasses/delegatedPropertyInInlineClass.kt +++ b/compiler/testData/diagnostics/tests/inlineClasses/delegatedPropertyInInlineClass.kt @@ -21,8 +21,8 @@ object VarObject { inline class Z(val data: Int) { val testVal by Val() - var testVar by Var() + var testVar by Var() val testValBySingleton by ValObject - var testVarBySingleton by VarObject + var testVarBySingleton by VarObject } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inlineClasses/propertiesWithBackingFieldsInsideInlineClass.kt b/compiler/testData/diagnostics/tests/inlineClasses/propertiesWithBackingFieldsInsideInlineClass.kt index f5774f75596..5fba5d676df 100644 --- a/compiler/testData/diagnostics/tests/inlineClasses/propertiesWithBackingFieldsInsideInlineClass.kt +++ b/compiler/testData/diagnostics/tests/inlineClasses/propertiesWithBackingFieldsInsideInlineClass.kt @@ -15,11 +15,11 @@ inline class Foo(val x: Int) : A, B { val a1 = 0 - var a2: Int + var a2: Int get() = 1 set(value) {} - var a3: Int = 0 + var a3: Int = 0 get() = 1 set(value) { field = value @@ -30,5 +30,5 @@ inline class Foo(val x: Int) : A, B { override val badSize: Int = 0 - lateinit var lateinitProperty: String + lateinit var lateinitProperty: String } diff --git a/compiler/testData/diagnostics/tests/inlineClasses/varPropertyWithInlineClassReceiver.fir.kt b/compiler/testData/diagnostics/tests/inlineClasses/varPropertyWithInlineClassReceiver.fir.kt new file mode 100644 index 00000000000..7c4ae085dee --- /dev/null +++ b/compiler/testData/diagnostics/tests/inlineClasses/varPropertyWithInlineClassReceiver.fir.kt @@ -0,0 +1,12 @@ +// !LANGUAGE: +InlineClasses +// !DIAGNOSTICS: -UNUSED_PARAMETER + +inline class IC(val a: Any) { + var member: Any + get() = a + set(value) {} +} + +var IC.extension: Any + get() = a + set(value) {} diff --git a/compiler/testData/diagnostics/tests/inlineClasses/varPropertyWithInlineClassReceiver.kt b/compiler/testData/diagnostics/tests/inlineClasses/varPropertyWithInlineClassReceiver.kt new file mode 100644 index 00000000000..e005b0cbf2a --- /dev/null +++ b/compiler/testData/diagnostics/tests/inlineClasses/varPropertyWithInlineClassReceiver.kt @@ -0,0 +1,12 @@ +// !LANGUAGE: +InlineClasses +// !DIAGNOSTICS: -UNUSED_PARAMETER + +inline class IC(val a: Any) { + var member: Any + get() = a + set(value) {} +} + +var IC.extension: Any + get() = a + set(value) {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inlineClasses/varPropertyWithInlineClassReceiver.txt b/compiler/testData/diagnostics/tests/inlineClasses/varPropertyWithInlineClassReceiver.txt new file mode 100644 index 00000000000..65ffcfbb852 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inlineClasses/varPropertyWithInlineClassReceiver.txt @@ -0,0 +1,12 @@ +package + +public var IC.extension: kotlin.Any + +public final inline class IC { + public constructor IC(/*0*/ a: kotlin.Any) + public final val a: kotlin.Any + public final var member: kotlin.Any + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.kt b/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.kt index f000be7da44..1cd281daed8 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.kt @@ -26,8 +26,8 @@ object VarObject { @JvmInline value class Z(val data: Int) { val testVal by Val() - var testVar by Var() + var testVar by Var() val testValBySingleton by ValObject - var testVarBySingleton by VarObject + var testVarBySingleton by VarObject } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.kt b/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.kt index 8267ab02d03..c3d2df146d4 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.kt @@ -20,11 +20,11 @@ value class Foo(val x: Int) : A, B { val a1 = 0 - var a2: Int + var a2: Int get() = 1 set(value) {} - var a3: Int = 0 + var a3: Int = 0 get() = 1 set(value) { field = value @@ -35,5 +35,5 @@ value class Foo(val x: Int) : A, B { override val badSize: Int = 0 - lateinit var lateinitProperty: String + lateinit var lateinitProperty: String } diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index da47f330b4a..0b9c4617760 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -12964,6 +12964,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali runTest("compiler/testData/diagnostics/tests/inlineClasses/unsignedLiteralsWithoutArtifactOnClasspath.kt"); } + @TestMetadata("varPropertyWithInlineClassReceiver.kt") + public void testVarPropertyWithInlineClassReceiver() throws Exception { + runTest("compiler/testData/diagnostics/tests/inlineClasses/varPropertyWithInlineClassReceiver.kt"); + } + @TestMetadata("varargsOnParametersOfInlineClassType.kt") public void testVarargsOnParametersOfInlineClassType() throws Exception { runTest("compiler/testData/diagnostics/tests/inlineClasses/varargsOnParametersOfInlineClassType.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java index 6d1619ed9ba..8f13c7f2b56 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java @@ -12959,6 +12959,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing runTest("compiler/testData/diagnostics/tests/inlineClasses/unsignedLiteralsWithoutArtifactOnClasspath.kt"); } + @TestMetadata("varPropertyWithInlineClassReceiver.kt") + public void testVarPropertyWithInlineClassReceiver() throws Exception { + runTest("compiler/testData/diagnostics/tests/inlineClasses/varPropertyWithInlineClassReceiver.kt"); + } + @TestMetadata("varargsOnParametersOfInlineClassType.kt") public void testVarargsOnParametersOfInlineClassType() throws Exception { runTest("compiler/testData/diagnostics/tests/inlineClasses/varargsOnParametersOfInlineClassType.kt"); From 1ee0892f733c4e0f32421bbd4444faac2f894107 Mon Sep 17 00:00:00 2001 From: Igor Yakovlev Date: Mon, 9 Nov 2020 10:22:41 +0300 Subject: [PATCH 440/698] [ULC] Fix NPE on generating data class ctor parameters --- .../jetbrains/kotlin/asJava/classes/ultraLightClass.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/ultraLightClass.kt b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/ultraLightClass.kt index e368530dba6..c870ac26212 100644 --- a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/ultraLightClass.kt +++ b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/ultraLightClass.kt @@ -33,6 +33,7 @@ import org.jetbrains.kotlin.load.java.JvmAbi import org.jetbrains.kotlin.load.kotlin.TypeMappingMode import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.psi.* +import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.DelegationResolver import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils import org.jetbrains.kotlin.resolve.annotations.JVM_STATIC_ANNOTATION_FQ_NAME @@ -334,12 +335,19 @@ open class KtUltraLightClass(classOrObject: KtClassOrObject, internal val suppor private fun addMethodsFromDataClass(result: MutableList) { if (!classOrObject.hasModifier(DATA_KEYWORD)) return + val ktClass = classOrObject as? KtClass ?: return val descriptor = classOrObject.resolve() as? ClassDescriptor ?: return val bindingContext = classOrObject.analyze() // Force resolving data class members set descriptor.unsubstitutedMemberScope.getContributedDescriptors() + val areCtorParametersAreAnalyzed = ktClass.primaryConstructorParameters + .filter { it.hasValOrVar() } + .all { bindingContext.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, it) != null } + + if (!areCtorParametersAreAnalyzed) return + object : DataClassMethodGenerator(classOrObject, bindingContext) { private fun addFunction(descriptor: FunctionDescriptor, declarationForOrigin: KtDeclaration? = null) { result.add(createGeneratedMethodFromDescriptor(descriptor, JvmDeclarationOriginKind.OTHER, declarationForOrigin)) From 2d8bdcbc9b98e1af6f9a06857f406c687f212fd7 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Thu, 3 Dec 2020 19:42:56 +0300 Subject: [PATCH 441/698] Minor: use unique temp directories in jps-build tests --- .../jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt | 2 +- .../kotlin/jps/build/AbstractIncrementalJpsTest.kt.201 | 2 +- .../org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestBase.kt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt index ae59ed0dab8..e5144af90b6 100644 --- a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt +++ b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt @@ -300,7 +300,7 @@ abstract class AbstractIncrementalJpsTest( protected open fun doTest(testDataPath: String) { testDataDir = File(testDataPath) - workDir = FileUtilRt.createTempDirectory(TEMP_DIRECTORY_TO_USE, "jps-build", null) + workDir = FileUtilRt.createTempDirectory(TEMP_DIRECTORY_TO_USE, "aijt-jps-build", null) val buildLogFile = buildLogFinder.findBuildLog(testDataDir) Disposer.register(testRootDisposable, Disposable { FileUtilRt.delete(workDir) }) diff --git a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt.201 b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt.201 index 7da9b6c9102..53c501a11f0 100644 --- a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt.201 +++ b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt.201 @@ -301,7 +301,7 @@ abstract class AbstractIncrementalJpsTest( protected open fun doTest(testDataPath: String) { testDataDir = File(testDataPath) - workDir = FileUtilRt.createTempDirectory(TEMP_DIRECTORY_TO_USE, "jps-build", null) + workDir = FileUtilRt.createTempDirectory(TEMP_DIRECTORY_TO_USE, "aijt-jps-build", null) val buildLogFile = buildLogFinder.findBuildLog(testDataDir) Disposer.register(testRootDisposable, Disposable { FileUtilRt.delete(workDir) }) diff --git a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestBase.kt b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestBase.kt index 05e2fa1ec51..eae51a0d386 100644 --- a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestBase.kt +++ b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestBase.kt @@ -33,7 +33,7 @@ abstract class KotlinJpsBuildTestBase : AbstractKotlinJpsBuildTestCase() { protected open fun copyTestDataToTmpDir(testDataDir: File): File { assert(testDataDir.exists()) { "Cannot find source folder " + testDataDir.absolutePath } - val tmpDir = FileUtil.createTempDirectory("jps-build", null) + val tmpDir = FileUtil.createTempDirectory("kjbtb-jps-build", null) FileUtil.copyDir(testDataDir, tmpDir) return tmpDir } From 2bf22caeb7c687cd6b54b05b11e5c0f1a3caa07c Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Fri, 4 Dec 2020 13:57:16 +0300 Subject: [PATCH 442/698] Revert "Keep application environment alive between JPS tests" This reverts commit 175dd567 The revert fixes the flaky behaviour on Windows in jps-plugin tests. java.lang.RuntimeException: java.nio.file.FileSystemException: tempdir_path\jps-build\jslib-example.jar: The process cannot access the file because it is being used by another process. Can be reproduced when running KotlinJpsBuildTest after IncrementalJsJpsTestGenerated. 1. IncrementalJsJpsTestGenerated sets KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY 2. KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY disables environment clean-up. 3. No disposeApplicationEnvironment() call also means no ZipHandler.clearFileAccessorCache() 4. There's jslib-example.jar opening in JsConfig.checkLibFilesAndReportErrors() 5. File handler is not closed and tests fails in tearDown() Affected tests: KotlinJpsBuildTest.testKotlinJavaScriptProjectWithLibraryCustomOutputDir KotlinJpsBuildTest.testKotlinJavaScriptProjectWithLibraryAndErrors KotlinJpsBuildTest.testKotlinJavaScriptProjectWithLibrary KotlinJpsBuildTest.testKotlinJavaScriptProjectWithLibraryNoCopy KotlinJpsBuildTest.testKotlinJavaScriptProjectWithTwoModulesAndWithLibrary KotlinJpsBuildTestIncremental.testKotlinJavaScriptProjectWithLibraryCustomOutputDir KotlinJpsBuildTestIncremental.testKotlinJavaScriptProjectWithLibraryAndErrors KotlinJpsBuildTestIncremental.testKotlinJavaScriptProjectWithLibrary KotlinJpsBuildTestIncremental.testKotlinJavaScriptProjectWithLibraryNoCopy KotlinJpsBuildTestIncremental.testKotlinJavaScriptProjectWithTwoModulesAndWithLibrary --- .../jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt | 2 -- .../kotlin/jps/build/AbstractIncrementalJpsTest.kt.201 | 2 -- 2 files changed, 4 deletions(-) diff --git a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt index e5144af90b6..d3b89fa9b2f 100644 --- a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt +++ b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt @@ -43,7 +43,6 @@ import org.jetbrains.jps.model.JpsModuleRootModificationUtil import org.jetbrains.jps.model.java.JpsJavaExtensionService import org.jetbrains.jps.model.library.sdk.JpsSdk import org.jetbrains.jps.util.JpsPathUtil -import org.jetbrains.kotlin.cli.common.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments import org.jetbrains.kotlin.cli.common.arguments.K2MetadataCompilerArguments import org.jetbrains.kotlin.incremental.LookupSymbol @@ -128,7 +127,6 @@ abstract class AbstractIncrementalJpsTest( enableICFixture.setUp() lookupsDuringTest = hashSetOf() - System.setProperty(KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY, "true") if (DEBUG_LOGGING_ENABLED) { enableDebugLogging() diff --git a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt.201 b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt.201 index 53c501a11f0..1d20b2e2a4d 100644 --- a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt.201 +++ b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt.201 @@ -43,7 +43,6 @@ import org.jetbrains.jps.model.JpsModuleRootModificationUtil import org.jetbrains.jps.model.java.JpsJavaExtensionService import org.jetbrains.jps.model.library.sdk.JpsSdk import org.jetbrains.jps.util.JpsPathUtil -import org.jetbrains.kotlin.cli.common.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments import org.jetbrains.kotlin.cli.common.arguments.K2MetadataCompilerArguments import org.jetbrains.kotlin.incremental.LookupSymbol @@ -128,7 +127,6 @@ abstract class AbstractIncrementalJpsTest( enableICFixture.setUp() lookupsDuringTest = hashSetOf() - System.setProperty(KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY, "true") if (DEBUG_LOGGING_ENABLED) { enableDebugLogging() From 5167d69b7ce725149ec67e4d51420922b840169a Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Thu, 3 Dec 2020 15:27:32 -0800 Subject: [PATCH 443/698] FIR checker: introduce member property checker --- .../testData/resolve/openInInterface.kt | 4 +- .../declaration/FirMemberPropertyChecker.kt | 120 ++++++++++++++++++ .../fir/analysis/diagnostics/FirErrors.kt | 19 +++ .../fir/checkers/CommonDeclarationCheckers.kt | 1 + .../fir/declarations/FirDeclarationUtil.kt | 11 ++ .../tests/AbstractInAbstractClass.fir.kt | 12 +- .../diagnostics/tests/AbstractInClass.fir.kt | 16 +-- .../diagnostics/tests/AbstractInTrait.fir.kt | 28 ++-- .../diagnostics/tests/DeferredTypes.fir.kt | 2 +- .../tests/PrivateSetterForOverridden.fir.kt | 4 +- .../backingField/FieldInInterface.fir.kt | 2 +- .../tests/declarationChecks/kt2397.fir.kt | 2 +- .../abstractDelegatedProperty.fir.kt | 2 +- .../tests/enum/AbstractInEnum.fir.kt | 12 +- .../infos/PropertiesWithBackingFields.fir.kt | 8 +- .../modifiers/const/applicability.fir.kt | 2 +- .../tests/modifiers/privateInInterface.fir.kt | 2 +- ...pectClassWithExplicitAbstractMember.fir.kt | 2 +- .../tests/variance/Visibility.fir.kt | 4 +- .../abstract-classes/p-1/neg/1.1.fir.kt | 2 +- 20 files changed, 203 insertions(+), 52 deletions(-) create mode 100644 compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirMemberPropertyChecker.kt diff --git a/compiler/fir/analysis-tests/testData/resolve/openInInterface.kt b/compiler/fir/analysis-tests/testData/resolve/openInInterface.kt index b1fb9400c42..c827bacb73a 100644 --- a/compiler/fir/analysis-tests/testData/resolve/openInInterface.kt +++ b/compiler/fir/analysis-tests/testData/resolve/openInInterface.kt @@ -3,11 +3,11 @@ interface Some { open fun bar() {} open val x: Int - open val y = 1 + open val y = 1 open val z get() = 1 open var xx: Int - open var yy = 1 + open var yy = 1 open var zz: Int set(value) { field = value diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirMemberPropertyChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirMemberPropertyChecker.kt new file mode 100644 index 00000000000..d8b641a1ee0 --- /dev/null +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirMemberPropertyChecker.kt @@ -0,0 +1,120 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.fir.analysis.checkers.declaration + +import org.jetbrains.kotlin.descriptors.ClassKind +import org.jetbrains.kotlin.descriptors.Visibilities +import org.jetbrains.kotlin.fir.FirSourceElement +import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext +import org.jetbrains.kotlin.fir.analysis.checkers.extended.report +import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors +import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.fir.declarations.impl.FirDefaultPropertyAccessor +import org.jetbrains.kotlin.fir.expressions.FirExpression +import org.jetbrains.kotlin.fir.symbols.impl.FirPropertyAccessorSymbol +import org.jetbrains.kotlin.fir.types.FirImplicitTypeRef + +// See old FE's [DeclarationsChecker] +object FirMemberPropertyChecker : FirBasicDeclarationChecker() { + override fun check(declaration: FirDeclaration, context: CheckerContext, reporter: DiagnosticReporter) { + if (declaration !is FirRegularClass) { + return + } + for (member in declaration.declarations) { + if (member is FirProperty) { + checkProperty(declaration, member, reporter) + } + } + } + + private fun checkProperty(containingDeclaration: FirRegularClass, property: FirProperty, reporter: DiagnosticReporter) { + if (inInterface(containingDeclaration) && + property.visibility == Visibilities.Private && + !property.isAbstract && + (property.getter == null || property.getter is FirDefaultPropertyAccessor) + ) { + property.source?.let { source -> + reporter.report(source, FirErrors.PRIVATE_PROPERTY_IN_INTERFACE) + } + } + + if (property.isAbstract) { + if (!containingDeclaration.isAbstract && !containingDeclaration.isSealed && !inEnumClass(containingDeclaration)) { + property.source?.let { source -> + reporter.report(source, FirErrors.ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS) + return + } + } + + if (property.delegate != null) { + property.delegate!!.source?.let { + if (inInterface(containingDeclaration)) { + reporter.report(FirErrors.DELEGATED_PROPERTY_IN_INTERFACE.on(it, property.delegate!!)) + } else { + reporter.report(FirErrors.ABSTRACT_DELEGATED_PROPERTY.on(it, property.delegate!!)) + } + } + } + + checkAccessor(property.getter, property.delegate) { src, symbol -> + reporter.report(FirErrors.ABSTRACT_PROPERTY_WITH_GETTER.on(src, symbol)) + } + checkAccessor(property.setter, property.delegate) { src, symbol -> + if (symbol.fir.visibility == Visibilities.Private && property.visibility != Visibilities.Private) { + reporter.report(FirErrors.PRIVATE_SETTER_FOR_ABSTRACT_PROPERTY.on(src, symbol)) + } else { + reporter.report(FirErrors.ABSTRACT_PROPERTY_WITH_SETTER.on(src, symbol)) + } + } + } + + checkPropertyInitializer(containingDeclaration, property, reporter) + + if (property.isOpen) { + checkAccessor(property.setter, property.delegate) { src, symbol -> + if (symbol.fir.visibility == Visibilities.Private && property.visibility != Visibilities.Private) { + reporter.report(FirErrors.PRIVATE_SETTER_FOR_OPEN_PROPERTY.on(src, symbol)) + } + } + } + } + + private fun checkPropertyInitializer(containingDeclaration: FirRegularClass, property: FirProperty, reporter: DiagnosticReporter) { + property.initializer?.source?.let { + if (property.isAbstract) { + reporter.report(FirErrors.ABSTRACT_PROPERTY_WITH_INITIALIZER.on(it, property.initializer!!)) + } else if (inInterface(containingDeclaration)) { + reporter.report(FirErrors.PROPERTY_INITIALIZER_IN_INTERFACE.on(it, property.initializer!!)) + } + } + if (property.isAbstract) { + if (property.initializer == null && property.delegate == null && property.returnTypeRef is FirImplicitTypeRef) { + property.source?.let { + reporter.report(FirErrors.PROPERTY_WITH_NO_TYPE_NO_INITIALIZER.on(it, property.symbol)) + } + } + } + } + + private fun checkAccessor( + accessor: FirPropertyAccessor?, + delegate: FirExpression?, + report: (FirSourceElement, FirPropertyAccessorSymbol) -> Unit, + ) { + if (accessor != null && accessor !is FirDefaultPropertyAccessor && accessor.hasBody && delegate == null) { + accessor.source?.let { + report.invoke(it, accessor.symbol) + } + } + } + + private fun inInterface(containingDeclaration: FirRegularClass): Boolean = + containingDeclaration.classKind == ClassKind.INTERFACE + + private fun inEnumClass(containingDeclaration: FirRegularClass): Boolean = + containingDeclaration.classKind == ClassKind.ENUM_CLASS +} diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt index 4d941074326..199aaa4bfb8 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt @@ -12,7 +12,9 @@ import org.jetbrains.kotlin.fir.FirEffectiveVisibility import org.jetbrains.kotlin.fir.FirSourceElement import org.jetbrains.kotlin.fir.declarations.FirClass import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration +import org.jetbrains.kotlin.fir.expressions.FirExpression import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol +import org.jetbrains.kotlin.fir.symbols.impl.FirPropertyAccessorSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol @@ -147,6 +149,23 @@ object FirErrors { val LOCAL_OBJECT_NOT_ALLOWED by error1(SourceElementPositioningStrategies.DECLARATION_NAME) val LOCAL_INTERFACE_NOT_ALLOWED by error1(SourceElementPositioningStrategies.DECLARATION_NAME) + // Properties & accessors + val ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS by error0(SourceElementPositioningStrategies.MODALITY_MODIFIER) + val PRIVATE_PROPERTY_IN_INTERFACE by error0(SourceElementPositioningStrategies.VISIBILITY_MODIFIER) + + val ABSTRACT_PROPERTY_WITH_INITIALIZER by error1() + val PROPERTY_INITIALIZER_IN_INTERFACE by error1() + val PROPERTY_WITH_NO_TYPE_NO_INITIALIZER by error1() + + val ABSTRACT_DELEGATED_PROPERTY by error1() + val DELEGATED_PROPERTY_IN_INTERFACE by error1() + // TODO: val ACCESSOR_FOR_DELEGATED_PROPERTY by error1() + + val ABSTRACT_PROPERTY_WITH_GETTER by error1() + val ABSTRACT_PROPERTY_WITH_SETTER by error1() + val PRIVATE_SETTER_FOR_ABSTRACT_PROPERTY by error1() + val PRIVATE_SETTER_FOR_OPEN_PROPERTY by error1() + // Control flow diagnostics val UNINITIALIZED_VARIABLE by error1() val WRONG_INVOCATION_KIND by warning3, EventOccurrencesRange, EventOccurrencesRange>() diff --git a/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/checkers/CommonDeclarationCheckers.kt b/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/checkers/CommonDeclarationCheckers.kt index dd5aab40c41..ccbd436b7c2 100644 --- a/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/checkers/CommonDeclarationCheckers.kt +++ b/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/checkers/CommonDeclarationCheckers.kt @@ -43,6 +43,7 @@ object CommonDeclarationCheckers : DeclarationCheckers() { override val regularClassCheckers: Set = setOf( FirTypeMismatchOnOverrideChecker, + FirMemberPropertyChecker, ) override val constructorCheckers: Set = setOf( diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/FirDeclarationUtil.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/FirDeclarationUtil.kt index ae0c30205a6..abeeaddb8cd 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/FirDeclarationUtil.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/FirDeclarationUtil.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.fir.declarations import org.jetbrains.kotlin.descriptors.ClassKind +import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.fir.declarations.builder.FirRegularClassBuilder import org.jetbrains.kotlin.fir.declarations.builder.FirTypeParameterBuilder @@ -35,15 +36,24 @@ fun FirTypeParameterBuilder.addDefaultBoundIfNecessary(isFlexible: Boolean = fal } } +inline val FirRegularClass.modality get() = status.modality +inline val FirRegularClass.isSealed get() = status.modality == Modality.SEALED +inline val FirRegularClass.isAbstract get() = status.modality == Modality.ABSTRACT + inline val FirRegularClass.isInner get() = status.isInner inline val FirRegularClass.isCompanion get() = status.isCompanion inline val FirRegularClass.isData get() = status.isData inline val FirRegularClass.isInline get() = status.isInline inline val FirRegularClass.isFun get() = status.isFun + inline val FirMemberDeclaration.modality get() = status.modality +inline val FirMemberDeclaration.isAbstract get() = status.modality == Modality.ABSTRACT +inline val FirMemberDeclaration.isOpen get() = status.modality == Modality.OPEN + inline val FirMemberDeclaration.visibility get() = status.visibility inline val FirMemberDeclaration.allowsToHaveFakeOverride: Boolean get() = !Visibilities.isPrivate(visibility) && visibility != Visibilities.InvisibleFake + inline val FirMemberDeclaration.isActual get() = status.isActual inline val FirMemberDeclaration.isExpect get() = status.isExpect inline val FirMemberDeclaration.isInner get() = status.isInner @@ -64,6 +74,7 @@ inline val FirPropertyAccessor.modality get() = status.modality inline val FirPropertyAccessor.visibility get() = status.visibility inline val FirPropertyAccessor.isInline get() = status.isInline inline val FirPropertyAccessor.isExternal get() = status.isExternal +inline val FirPropertyAccessor.hasBody get() = body != null inline val FirProperty.allowsToHaveFakeOverride: Boolean get() = !Visibilities.isPrivate(visibility) && visibility != Visibilities.InvisibleFake diff --git a/compiler/testData/diagnostics/tests/AbstractInAbstractClass.fir.kt b/compiler/testData/diagnostics/tests/AbstractInAbstractClass.fir.kt index 5fa3158c3ca..b44c165a968 100644 --- a/compiler/testData/diagnostics/tests/AbstractInAbstractClass.fir.kt +++ b/compiler/testData/diagnostics/tests/AbstractInAbstractClass.fir.kt @@ -5,22 +5,22 @@ abstract class MyAbstractClass() { val a: Int val a1: Int = 1 abstract val a2: Int - abstract val a3: Int = 1 + abstract val a3: Int = 1 var b: Int private set var b1: Int = 0; private set abstract var b2: Int private set - abstract var b3: Int = 0; private set + abstract var b3: Int = 0; private set var c: Int set(v: Int) { field = v } var c1: Int = 0; set(v: Int) { field = v } - abstract var c2: Int set(v: Int) { field = v } - abstract var c3: Int = 0; set(v: Int) { field = v } + abstract var c2: Int set(v: Int) { field = v } + abstract var c3: Int = 0; set(v: Int) { field = v } val e: Int get() = a val e1: Int = 0; get() = a - abstract val e2: Int get() = a - abstract val e3: Int = 0; get() = a + abstract val e2: Int get() = a + abstract val e3: Int = 0; get() = a //methods fun f() diff --git a/compiler/testData/diagnostics/tests/AbstractInClass.fir.kt b/compiler/testData/diagnostics/tests/AbstractInClass.fir.kt index ca2612d35bb..4bdd5e8f34f 100644 --- a/compiler/testData/diagnostics/tests/AbstractInClass.fir.kt +++ b/compiler/testData/diagnostics/tests/AbstractInClass.fir.kt @@ -4,23 +4,23 @@ class MyClass() { //properties val a: Int val a1: Int = 1 - abstract val a2: Int - abstract val a3: Int = 1 + abstract val a2: Int + abstract val a3: Int = 1 var b: Int private set var b1: Int = 0; private set - abstract var b2: Int private set - abstract var b3: Int = 0; private set + abstract var b2: Int private set + abstract var b3: Int = 0; private set var c: Int set(v: Int) { field = v } var c1: Int = 0; set(v: Int) { field = v } - abstract var c2: Int set(v: Int) { field = v } - abstract var c3: Int = 0; set(v: Int) { field = v } + abstract var c2: Int set(v: Int) { field = v } + abstract var c3: Int = 0; set(v: Int) { field = v } val e: Int get() = a val e1: Int = 0; get() = a - abstract val e2: Int get() = a - abstract val e3: Int = 0; get() = a + abstract val e2: Int get() = a + abstract val e3: Int = 0; get() = a //methods fun f() diff --git a/compiler/testData/diagnostics/tests/AbstractInTrait.fir.kt b/compiler/testData/diagnostics/tests/AbstractInTrait.fir.kt index 2560ef10b9c..04439b920e5 100644 --- a/compiler/testData/diagnostics/tests/AbstractInTrait.fir.kt +++ b/compiler/testData/diagnostics/tests/AbstractInTrait.fir.kt @@ -3,24 +3,24 @@ package abstract interface MyTrait { //properties val a: Int - val a1: Int = 1 + val a1: Int = 1 abstract val a2: Int - abstract val a3: Int = 1 + abstract val a3: Int = 1 var b: Int private set - var b1: Int = 0; private set + var b1: Int = 0; private set abstract var b2: Int private set - abstract var b3: Int = 0; private set + abstract var b3: Int = 0; private set var c: Int set(v: Int) { field = v } - var c1: Int = 0; set(v: Int) { field = v } - abstract var c2: Int set(v: Int) { field = v } - abstract var c3: Int = 0; set(v: Int) { field = v } + var c1: Int = 0; set(v: Int) { field = v } + abstract var c2: Int set(v: Int) { field = v } + abstract var c3: Int = 0; set(v: Int) { field = v } val e: Int get() = a - val e1: Int = 0; get() = a - abstract val e2: Int get() = a - abstract val e3: Int = 0; get() = a + val e1: Int = 0; get() = a + abstract val e2: Int get() = a + abstract val e3: Int = 0; get() = a //methods fun f() @@ -30,16 +30,16 @@ interface MyTrait { //property accessors var i: Int abstract get abstract set - var i1: Int = 0; abstract get abstract set + var i1: Int = 0; abstract get abstract set var j: Int get() = i; abstract set - var j1: Int = 0; get() = i; abstract set + var j1: Int = 0; get() = i; abstract set var k: Int abstract set - var k1: Int = 0; abstract set + var k1: Int = 0; abstract set var l: Int abstract get abstract set - var l1: Int = 0; abstract get abstract set + var l1: Int = 0; abstract get abstract set var n: Int abstract get abstract set(v: Int) {} } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/DeferredTypes.fir.kt b/compiler/testData/diagnostics/tests/DeferredTypes.fir.kt index e2b364f0e11..3647a682a51 100644 --- a/compiler/testData/diagnostics/tests/DeferredTypes.fir.kt +++ b/compiler/testData/diagnostics/tests/DeferredTypes.fir.kt @@ -1,5 +1,5 @@ // NI_EXPECTED_FILE interface T { - val a = Foo.bar() + val a = Foo.bar() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/PrivateSetterForOverridden.fir.kt b/compiler/testData/diagnostics/tests/PrivateSetterForOverridden.fir.kt index 787940eac55..352d5a17af6 100644 --- a/compiler/testData/diagnostics/tests/PrivateSetterForOverridden.fir.kt +++ b/compiler/testData/diagnostics/tests/PrivateSetterForOverridden.fir.kt @@ -62,9 +62,9 @@ interface E : A { override var a: Int get() = 0 // Errors here and below - private set(arg) {} + private set(arg) {} override var b: Int get() = 0 - private set(arg) {} + private set(arg) {} } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/backingField/FieldInInterface.fir.kt b/compiler/testData/diagnostics/tests/backingField/FieldInInterface.fir.kt index 991779fad58..18688620953 100644 --- a/compiler/testData/diagnostics/tests/backingField/FieldInInterface.fir.kt +++ b/compiler/testData/diagnostics/tests/backingField/FieldInInterface.fir.kt @@ -1,4 +1,4 @@ interface My { - val x: Int = 0 + val x: Int = 0 get() = field } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/kt2397.fir.kt b/compiler/testData/diagnostics/tests/declarationChecks/kt2397.fir.kt index 2f85101af3a..08fac11d23c 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/kt2397.fir.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/kt2397.fir.kt @@ -9,7 +9,7 @@ interface T { final val c : Int get() = 42 - final val d = 1 + final val d = 1 } class A { diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/abstractDelegatedProperty.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/abstractDelegatedProperty.fir.kt index 14895513007..e05364cf8e3 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/abstractDelegatedProperty.fir.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/abstractDelegatedProperty.fir.kt @@ -3,7 +3,7 @@ import kotlin.reflect.KProperty abstract class A { - abstract val a: Int by Delegate() + abstract val a: Int by Delegate() } class Delegate { diff --git a/compiler/testData/diagnostics/tests/enum/AbstractInEnum.fir.kt b/compiler/testData/diagnostics/tests/enum/AbstractInEnum.fir.kt index e5ba1ab9ddc..343cf6d9488 100644 --- a/compiler/testData/diagnostics/tests/enum/AbstractInEnum.fir.kt +++ b/compiler/testData/diagnostics/tests/enum/AbstractInEnum.fir.kt @@ -7,22 +7,22 @@ enum class MyEnum() { val a: Int val a1: Int = 1 abstract val a2: Int - abstract val a3: Int = 1 + abstract val a3: Int = 1 var b: Int private set var b1: Int = 0; private set abstract var b2: Int private set - abstract var b3: Int = 0; private set + abstract var b3: Int = 0; private set var c: Int set(v: Int) { field = v } var c1: Int = 0; set(v: Int) { field = v } - abstract var c2: Int set(v: Int) { field = v } - abstract var c3: Int = 0; set(v: Int) { field = v } + abstract var c2: Int set(v: Int) { field = v } + abstract var c3: Int = 0; set(v: Int) { field = v } val e: Int get() = a val e1: Int = 0; get() = a - abstract val e2: Int get() = a - abstract val e3: Int = 0; get() = a + abstract val e2: Int get() = a + abstract val e3: Int = 0; get() = a //methods fun f() diff --git a/compiler/testData/diagnostics/tests/infos/PropertiesWithBackingFields.fir.kt b/compiler/testData/diagnostics/tests/infos/PropertiesWithBackingFields.fir.kt index 6e63b72af36..193b402b51d 100644 --- a/compiler/testData/diagnostics/tests/infos/PropertiesWithBackingFields.fir.kt +++ b/compiler/testData/diagnostics/tests/infos/PropertiesWithBackingFields.fir.kt @@ -1,7 +1,7 @@ abstract class Test() { abstract val x : Int abstract val x1 : Int get - abstract val x2 : Int get() = 1 + abstract val x2 : Int get() = 1 val a : Int val b : Int get @@ -22,9 +22,9 @@ abstract class Test() { abstract var y1 : Int get abstract var y2 : Int set abstract var y3 : Int set get - abstract var y4 : Int set get() = 1 - abstract var y5 : Int set(x) {} get() = 1 - abstract var y6 : Int set(x) {} + abstract var y4 : Int set get() = 1 + abstract var y5 : Int set(x) {} get() = 1 + abstract var y6 : Int set(x) {} var v : Int var v1 : Int get diff --git a/compiler/testData/diagnostics/tests/modifiers/const/applicability.fir.kt b/compiler/testData/diagnostics/tests/modifiers/const/applicability.fir.kt index 1d828a3b8ae..f500a17d974 100644 --- a/compiler/testData/diagnostics/tests/modifiers/const/applicability.fir.kt +++ b/compiler/testData/diagnostics/tests/modifiers/const/applicability.fir.kt @@ -17,7 +17,7 @@ class B(const val constructor: Int = 5) abstract class C { open const val x: Int = 6 - abstract const val y: Int = 7 + abstract const val y: Int = 7 companion object { const val inCompaionObject = 8 diff --git a/compiler/testData/diagnostics/tests/modifiers/privateInInterface.fir.kt b/compiler/testData/diagnostics/tests/modifiers/privateInInterface.fir.kt index 0dbf6aec924..940c479dc64 100644 --- a/compiler/testData/diagnostics/tests/modifiers/privateInInterface.fir.kt +++ b/compiler/testData/diagnostics/tests/modifiers/privateInInterface.fir.kt @@ -1,5 +1,5 @@ interface My { - private val x: Int + private val x: Int private abstract val xx: Int private val xxx: Int get() = 0 diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/expectClassWithExplicitAbstractMember.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/expectClassWithExplicitAbstractMember.fir.kt index 901cb01a6d3..98add0b1735 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/expectClassWithExplicitAbstractMember.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/expectClassWithExplicitAbstractMember.fir.kt @@ -9,7 +9,7 @@ interface Foo { expect class NonAbstractClass : Foo { abstract fun bar() - abstract val baz: Int + abstract val baz: Int abstract override fun foo() } diff --git a/compiler/testData/diagnostics/tests/variance/Visibility.fir.kt b/compiler/testData/diagnostics/tests/variance/Visibility.fir.kt index 9cdd40a0c09..09204ae6c0b 100644 --- a/compiler/testData/diagnostics/tests/variance/Visibility.fir.kt +++ b/compiler/testData/diagnostics/tests/variance/Visibility.fir.kt @@ -2,7 +2,7 @@ interface Test { val internal_val: I public val public_val: I protected val protected_val: I - private val private_val: I + private val private_val: I var interlan_private_set: O private set @@ -10,7 +10,7 @@ interface Test { private set protected var protected_private_set: O private set - private var private_private_set: O + private var private_private_set: O private set fun internal_fun(i: O) : I diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-1/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-1/neg/1.1.fir.kt index 35f4087aa11..3f6551a9ac9 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-1/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-1/neg/1.1.fir.kt @@ -7,7 +7,7 @@ abstract class Base() { abstract fun foo() = {} fun boo() : Unit - abstract val a = "" + abstract val a = "" val b var d } From 149bcc2d22e21cc7ed99a23d21504573e3be559a Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Fri, 4 Dec 2020 11:49:05 +0300 Subject: [PATCH 444/698] Revert using regex Pattern in String.replace Use String.indexOf(..., ignoreCase) instead in all branches to preserve compatibility with behavior before 1.4.20 that used String.split which essentially relied on that String.indexOf #KT-43745 Fixed --- .../stdlib/jvm/src/kotlin/text/StringsJVM.kt | 12 +----------- libraries/stdlib/test/text/StringTest.kt | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/libraries/stdlib/jvm/src/kotlin/text/StringsJVM.kt b/libraries/stdlib/jvm/src/kotlin/text/StringsJVM.kt index e1e6cc947cc..e90a0146368 100644 --- a/libraries/stdlib/jvm/src/kotlin/text/StringsJVM.kt +++ b/libraries/stdlib/jvm/src/kotlin/text/StringsJVM.kt @@ -77,17 +77,7 @@ public actual fun String.replace(oldChar: Char, newChar: Char, ignoreCase: Boole */ @Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS") public actual fun String.replace(oldValue: String, newValue: String, ignoreCase: Boolean = false): String { - if (ignoreCase) { - val matcher = Pattern.compile(oldValue, Pattern.LITERAL or Pattern.CASE_INSENSITIVE).matcher(this) - if (!matcher.find()) return this - val stringBuilder = StringBuilder() - var i = 0 - do { - stringBuilder.append(this, i, matcher.start()).append(newValue) - i = matcher.end() - } while (matcher.find()) - return stringBuilder.append(this, i, length).toString() - } else { + run { var occurrenceIndex: Int = indexOf(oldValue, 0, ignoreCase) // FAST PATH: no match if (occurrenceIndex < 0) return this diff --git a/libraries/stdlib/test/text/StringTest.kt b/libraries/stdlib/test/text/StringTest.kt index c57555b06c6..9046fb492b5 100644 --- a/libraries/stdlib/test/text/StringTest.kt +++ b/libraries/stdlib/test/text/StringTest.kt @@ -896,6 +896,22 @@ class StringTest { assertEquals("-a-b-b-A-b-", input.replace("", "-")) assertEquals("-a-b-b-A-b-", input.replace("", "-", ignoreCase = true)) + + fun testIgnoreCase(chars: String) { + for ((i, c) in chars.withIndex()) { + val message = "Char: $c (${c.toInt()})" + val expectOneReplaced = chars.replaceRange(i..i, "_") + val expectAllReplaced = "_".repeat(chars.length) + assertEquals(expectOneReplaced, chars.replace(c, '_'), message) + assertEquals(expectAllReplaced, chars.replace(c, '_', ignoreCase = true), "$message, ignoreCase") + assertEquals(expectOneReplaced, chars.replace(c.toString(), "_"), "$message, as string") + assertEquals(expectAllReplaced, chars.replace(c.toString(), "_", ignoreCase = true), "$message, as string, ignoreCase") + } + } + + testIgnoreCase("üÜ") + testIgnoreCase("öÖ") + testIgnoreCase("äÄ") } @Test fun replaceFirst() { From 3dbe02b7fe619bc1209850aecb39094288c4c0f4 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Fri, 4 Dec 2020 11:18:22 +0300 Subject: [PATCH 445/698] JVM_IR KT-43109 generate internal bridge for custom internal 'toArray' Also add some tests for internal collection stubs. --- .../ir/FirBlackBoxCodegenTestGenerated.java | 10 ++++ .../backend/jvm/lower/ToArrayLowering.kt | 56 ++++++++++++++----- .../codegen/box/collections/internalRemove.kt | 16 ++++++ .../box/collections/internalRemoveFromJava.kt | 34 +++++++++++ .../collectionWithInternalRemove.kt | 9 +++ .../collectionWithInternalRemove.txt | 19 +++++++ .../collectionWithInternalRemove_ir.txt | 20 +++++++ .../toArray/customNonGenericToArray_ir.txt | 3 +- .../toArray/internalGenericToArray.kt | 3 + .../toArray/internalGenericToArray.txt | 20 +++++++ .../toArray/internalGenericToArray_ir.txt | 21 +++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 10 ++++ .../codegen/BytecodeListingTestGenerated.java | 10 ++++ .../LightAnalysisModeTestGenerated.java | 10 ++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 10 ++++ .../ir/IrBytecodeListingTestGenerated.java | 10 ++++ .../IrJsCodegenBoxES6TestGenerated.java | 5 ++ .../IrJsCodegenBoxTestGenerated.java | 5 ++ .../semantics/JsCodegenBoxTestGenerated.java | 5 ++ .../IrCodegenBoxWasmTestGenerated.java | 5 ++ 20 files changed, 266 insertions(+), 15 deletions(-) create mode 100644 compiler/testData/codegen/box/collections/internalRemove.kt create mode 100644 compiler/testData/codegen/box/collections/internalRemoveFromJava.kt create mode 100644 compiler/testData/codegen/bytecodeListing/collectionStubs/collectionWithInternalRemove.kt create mode 100644 compiler/testData/codegen/bytecodeListing/collectionStubs/collectionWithInternalRemove.txt create mode 100644 compiler/testData/codegen/bytecodeListing/collectionStubs/collectionWithInternalRemove_ir.txt create mode 100644 compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/internalGenericToArray.kt create mode 100644 compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/internalGenericToArray.txt create mode 100644 compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/internalGenericToArray_ir.txt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 94d9a383292..85fd78ff175 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -5023,6 +5023,16 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/collections/inheritFromHashtable.kt"); } + @TestMetadata("internalRemove.kt") + public void testInternalRemove() throws Exception { + runTest("compiler/testData/codegen/box/collections/internalRemove.kt"); + } + + @TestMetadata("internalRemoveFromJava.kt") + public void testInternalRemoveFromJava() throws Exception { + runTest("compiler/testData/codegen/box/collections/internalRemoveFromJava.kt"); + } + @TestMetadata("irrelevantImplCharSequence.kt") public void testIrrelevantImplCharSequence() throws Exception { runTest("compiler/testData/codegen/box/collections/irrelevantImplCharSequence.kt"); diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/ToArrayLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/ToArrayLowering.kt index 4a1da573b3b..e5a653ef204 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/ToArrayLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/ToArrayLowering.kt @@ -49,11 +49,11 @@ private class ToArrayLowering(private val context: JvmBackendContext) : ClassLow it.origin != IrDeclarationOrigin.IR_EXTERNAL_JAVA_DECLARATION_STUB }?.isCollectionSubClass == true - irClass.findOrCreate(indirectCollectionSubClass, { it.isGenericToArray(context) }) { + irClass.findOrCreate(indirectCollectionSubClass, { it.isGenericToArray(context) }) { bridge -> irClass.addFunction { name = Name.identifier("toArray") origin = JvmLoweredDeclarationOrigin.TO_ARRAY - modality = Modality.OPEN + modality = if (bridge != null) Modality.FINAL else Modality.OPEN }.apply { val elementType = addTypeParameter { name = Name.identifier("T") @@ -67,19 +67,26 @@ private class ToArrayLowering(private val context: JvmBackendContext) : ClassLow } val prototype = addValueParameter("array", returnType, JvmLoweredDeclarationOrigin.TO_ARRAY) body = context.createIrBuilder(symbol).irBlockBody { - +irReturn(irCall(symbols.genericToArray, symbols.genericToArray.owner.returnType).apply { - putValueArgument(0, irGet(receiver)) - putValueArgument(1, irGet(prototype)) - }) + if (bridge == null) { + +irReturn(irCall(symbols.genericToArray, symbols.genericToArray.owner.returnType).apply { + putValueArgument(0, irGet(receiver)) + putValueArgument(1, irGet(prototype)) + }) + } else { + +irReturn(irCall(bridge.target.symbol, bridge.target.returnType).apply { + dispatchReceiver = irGet(receiver) + putValueArgument(0, irGet(prototype)) + }) + } } } } - irClass.findOrCreate(indirectCollectionSubClass, IrSimpleFunction::isNonGenericToArray) { + irClass.findOrCreate(indirectCollectionSubClass, IrSimpleFunction::isNonGenericToArray) { bridge -> irClass.addFunction { name = Name.identifier("toArray") origin = JvmLoweredDeclarationOrigin.TO_ARRAY - modality = Modality.OPEN + modality = if (bridge != null) Modality.FINAL else Modality.OPEN returnType = context.irBuiltIns.arrayClass.typeWith(context.irBuiltIns.anyNType) }.apply { val receiver = addDispatchReceiver { @@ -87,28 +94,49 @@ private class ToArrayLowering(private val context: JvmBackendContext) : ClassLow origin = JvmLoweredDeclarationOrigin.TO_ARRAY } body = context.createIrBuilder(symbol).irBlockBody { - +irReturn(irCall(symbols.nonGenericToArray, symbols.nonGenericToArray.owner.returnType).apply { - putValueArgument(0, irGet(receiver)) - }) + if (bridge == null) { + +irReturn(irCall(symbols.nonGenericToArray, symbols.nonGenericToArray.owner.returnType).apply { + putValueArgument(0, irGet(receiver)) + }) + } else { + +irReturn(irCall(bridge.target.symbol, bridge.target.returnType).apply { + dispatchReceiver = irGet(receiver) + }) + } } } } } - private fun IrClass.findOrCreate(indirectSubclass: Boolean, matcher: (IrSimpleFunction) -> Boolean, fallback: () -> IrSimpleFunction) { + private class ToArrayBridge( + val target: IrSimpleFunction + ) + + private fun IrClass.findOrCreate( + indirectSubclass: Boolean, + matcher: (IrSimpleFunction) -> Boolean, + fallback: (ToArrayBridge?) -> IrSimpleFunction + ) { val existing = functions.find(matcher) if (existing != null) { // This is an explicit override of a method defined in `kotlin.collections.AbstractCollection` // or `java.util.Collection`. From here on, the frontend will check the existence of implementations; // we just need to match visibility in the former case to the latter. - existing.visibility = DescriptorVisibilities.PUBLIC + if (existing.visibility == DescriptorVisibilities.INTERNAL) { + // If existing `toArray` is internal, create a public bridge method + // to preserve binary compatibility with code generated by the old back-end. + // NB This will preserve existing custom `toArray` signature. + fallback(ToArrayBridge(existing)) + } else { + existing.visibility = DescriptorVisibilities.PUBLIC + } return } if (indirectSubclass) { // There's a Kotlin class up the hierarchy that should already have `toArray`. return } - fallback() + fallback(null) } } diff --git a/compiler/testData/codegen/box/collections/internalRemove.kt b/compiler/testData/codegen/box/collections/internalRemove.kt new file mode 100644 index 00000000000..fe3d0cab133 --- /dev/null +++ b/compiler/testData/codegen/box/collections/internalRemove.kt @@ -0,0 +1,16 @@ +class Test : Collection { + override val size: Int get() = TODO() + override fun contains(element: T): Boolean = TODO() + override fun containsAll(elements: Collection): Boolean = TODO() + override fun isEmpty(): Boolean = TODO() + override fun iterator(): Iterator = TODO() + + internal fun remove(x: T): Boolean = false +} + +fun box(): String { + return if (Test().remove("") == false) + "OK" + else + "Fail" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/collections/internalRemoveFromJava.kt b/compiler/testData/codegen/box/collections/internalRemoveFromJava.kt new file mode 100644 index 00000000000..a0853c60115 --- /dev/null +++ b/compiler/testData/codegen/box/collections/internalRemoveFromJava.kt @@ -0,0 +1,34 @@ +// TARGET_BACKEND: JVM + +// IGNORE_BACKEND: JVM +// ^ KT-43334 AbstractMethodError when calling 'remove' from Java on a Kotlin Collection with custom internal 'remove' +// fixed in JVM_IR + +// FILE: internalRemoveFromJava.kt + +class Test : Collection { + override val size: Int get() = TODO() + override fun contains(element: T): Boolean = TODO() + override fun containsAll(elements: Collection): Boolean = TODO() + override fun isEmpty(): Boolean = TODO() + override fun iterator(): Iterator = TODO() + + internal fun remove(x: T): Boolean = false +} + +fun box(): String { + val t = Test() + return if (J.testRemove(t, "") == false) + "OK" + else + "Fail" +} + +// FILE: J.java +import java.util.Collection; + +public class J { + public static boolean testRemove(Collection c, T x) { + return c.remove(x); + } +} diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/collectionWithInternalRemove.kt b/compiler/testData/codegen/bytecodeListing/collectionStubs/collectionWithInternalRemove.kt new file mode 100644 index 00000000000..f0bbaf295f0 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/collectionWithInternalRemove.kt @@ -0,0 +1,9 @@ +class Test : Collection { + override val size: Int get() = TODO() + override fun contains(element: T): Boolean = TODO() + override fun containsAll(elements: Collection): Boolean = TODO() + override fun isEmpty(): Boolean = TODO() + override fun iterator(): Iterator = TODO() + + internal fun remove(x: T): Boolean = false +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/collectionWithInternalRemove.txt b/compiler/testData/codegen/bytecodeListing/collectionStubs/collectionWithInternalRemove.txt new file mode 100644 index 00000000000..cf39eca98d7 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/collectionWithInternalRemove.txt @@ -0,0 +1,19 @@ +@kotlin.Metadata +public final class Test { + // source: 'collectionWithInternalRemove.kt' + public method (): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public method contains(p0: java.lang.Object): boolean + public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public method getSize(): int + public method isEmpty(): boolean + public @org.jetbrains.annotations.NotNull method iterator(): java.util.Iterator + public final method remove$test_module(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/collectionWithInternalRemove_ir.txt b/compiler/testData/codegen/bytecodeListing/collectionStubs/collectionWithInternalRemove_ir.txt new file mode 100644 index 00000000000..49e7e15485b --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/collectionWithInternalRemove_ir.txt @@ -0,0 +1,20 @@ +@kotlin.Metadata +public final class Test { + // source: 'collectionWithInternalRemove.kt' + public method (): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public method contains(p0: java.lang.Object): boolean + public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public method getSize(): int + public method isEmpty(): boolean + public @org.jetbrains.annotations.NotNull method iterator(): java.util.Iterator + public final method remove$test_module(p0: java.lang.Object): boolean + public bridge final method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/customNonGenericToArray_ir.txt b/compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/customNonGenericToArray_ir.txt index 5643251b8e4..9fb603f4fd6 100644 --- a/compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/customNonGenericToArray_ir.txt +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/customNonGenericToArray_ir.txt @@ -15,7 +15,8 @@ public final class InternalToArray { public method removeAll(p0: java.util.Collection): boolean public method retainAll(p0: java.util.Collection): boolean public bridge final method size(): int - public final @org.jetbrains.annotations.NotNull method toArray(): java.lang.Integer[] + public final @org.jetbrains.annotations.NotNull method toArray$test_module(): java.lang.Integer[] + public final method toArray(): java.lang.Object[] public method toArray(p0: java.lang.Object[]): java.lang.Object[] } diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/internalGenericToArray.kt b/compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/internalGenericToArray.kt new file mode 100644 index 00000000000..f6229852e82 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/internalGenericToArray.kt @@ -0,0 +1,3 @@ +class InternalGenericToArray(d: Collection): Collection by d { + internal fun toArray(arr: Array): Array = null!! +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/internalGenericToArray.txt b/compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/internalGenericToArray.txt new file mode 100644 index 00000000000..87f22b0a14f --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/internalGenericToArray.txt @@ -0,0 +1,20 @@ +@kotlin.Metadata +public final class InternalGenericToArray { + // source: 'internalGenericToArray.kt' + private synthetic final field $$delegate_0: java.util.Collection + public method (@org.jetbrains.annotations.NotNull p0: java.util.Collection): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public method contains(p0: java.lang.Object): boolean + public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public method getSize(): int + public method isEmpty(): boolean + public @org.jetbrains.annotations.NotNull method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public final @org.jetbrains.annotations.NotNull method toArray$test_module(@org.jetbrains.annotations.NotNull p0: java.lang.Object[]): java.lang.Object[] + public method toArray(): java.lang.Object[] +} diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/internalGenericToArray_ir.txt b/compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/internalGenericToArray_ir.txt new file mode 100644 index 00000000000..6b49f33a2e6 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/internalGenericToArray_ir.txt @@ -0,0 +1,21 @@ +@kotlin.Metadata +public final class InternalGenericToArray { + // source: 'internalGenericToArray.kt' + private synthetic final field $$delegate_0: java.util.Collection + public method (@org.jetbrains.annotations.NotNull p0: java.util.Collection): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public method contains(p0: java.lang.Object): boolean + public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public method getSize(): int + public method isEmpty(): boolean + public @org.jetbrains.annotations.NotNull method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public final @org.jetbrains.annotations.NotNull method toArray$test_module(@org.jetbrains.annotations.NotNull p0: java.lang.Object[]): java.lang.Object[] + public method toArray(): java.lang.Object[] + public final method toArray(p0: java.lang.Object[]): java.lang.Object[] +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index de242c036d2..6e341c7966e 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -5053,6 +5053,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/collections/inheritFromHashtable.kt"); } + @TestMetadata("internalRemove.kt") + public void testInternalRemove() throws Exception { + runTest("compiler/testData/codegen/box/collections/internalRemove.kt"); + } + + @TestMetadata("internalRemoveFromJava.kt") + public void testInternalRemoveFromJava() throws Exception { + runTest("compiler/testData/codegen/box/collections/internalRemoveFromJava.kt"); + } + @TestMetadata("irrelevantImplCharSequence.kt") public void testIrrelevantImplCharSequence() throws Exception { runTest("compiler/testData/codegen/box/collections/irrelevantImplCharSequence.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index 87f63b5435b..5399293cbda 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -344,6 +344,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/collectionByDelegationWithFullJdk.kt"); } + @TestMetadata("collectionWithInternalRemove.kt") + public void testCollectionWithInternalRemove() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/collectionWithInternalRemove.kt"); + } + @TestMetadata("collectionsWithFullJdk.kt") public void testCollectionsWithFullJdk() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/collectionsWithFullJdk.kt"); @@ -629,6 +634,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/customNonGenericToArray.kt"); } + @TestMetadata("internalGenericToArray.kt") + public void testInternalGenericToArray() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/internalGenericToArray.kt"); + } + @TestMetadata("noToArrayInJava.kt") public void testNoToArrayInJava() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/noToArrayInJava.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index bc9ccf66974..75f5751ca61 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -5020,6 +5020,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public static class Collections extends AbstractLightAnalysisModeTest { + @TestMetadata("internalRemoveFromJava.kt") + public void ignoreInternalRemoveFromJava() throws Exception { + runTest("compiler/testData/codegen/box/collections/internalRemoveFromJava.kt"); + } + private void runTest(String testDataFilePath) throws Exception { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } @@ -5053,6 +5058,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/collections/inheritFromHashtable.kt"); } + @TestMetadata("internalRemove.kt") + public void testInternalRemove() throws Exception { + runTest("compiler/testData/codegen/box/collections/internalRemove.kt"); + } + @TestMetadata("irrelevantImplCharSequence.kt") public void testIrrelevantImplCharSequence() throws Exception { runTest("compiler/testData/codegen/box/collections/irrelevantImplCharSequence.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 74865be1a99..fb4fe1cefd9 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -5023,6 +5023,16 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/collections/inheritFromHashtable.kt"); } + @TestMetadata("internalRemove.kt") + public void testInternalRemove() throws Exception { + runTest("compiler/testData/codegen/box/collections/internalRemove.kt"); + } + + @TestMetadata("internalRemoveFromJava.kt") + public void testInternalRemoveFromJava() throws Exception { + runTest("compiler/testData/codegen/box/collections/internalRemoveFromJava.kt"); + } + @TestMetadata("irrelevantImplCharSequence.kt") public void testIrrelevantImplCharSequence() throws Exception { runTest("compiler/testData/codegen/box/collections/irrelevantImplCharSequence.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index 3bf0870ddbb..5b4a34b3657 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -344,6 +344,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/collectionByDelegationWithFullJdk.kt"); } + @TestMetadata("collectionWithInternalRemove.kt") + public void testCollectionWithInternalRemove() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/collectionWithInternalRemove.kt"); + } + @TestMetadata("collectionsWithFullJdk.kt") public void testCollectionsWithFullJdk() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/collectionsWithFullJdk.kt"); @@ -629,6 +634,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/customNonGenericToArray.kt"); } + @TestMetadata("internalGenericToArray.kt") + public void testInternalGenericToArray() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/internalGenericToArray.kt"); + } + @TestMetadata("noToArrayInJava.kt") public void testNoToArrayInJava() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/toArray/noToArrayInJava.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index 643c18b2124..1d871a46593 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -4123,6 +4123,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/collections/inSetWithSmartCast.kt"); } + @TestMetadata("internalRemove.kt") + public void testInternalRemove() throws Exception { + runTest("compiler/testData/codegen/box/collections/internalRemove.kt"); + } + @TestMetadata("kt41123.kt") public void testKt41123() throws Exception { runTest("compiler/testData/codegen/box/collections/kt41123.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 707d42997f7..9618f4ee91b 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -4123,6 +4123,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/collections/inSetWithSmartCast.kt"); } + @TestMetadata("internalRemove.kt") + public void testInternalRemove() throws Exception { + runTest("compiler/testData/codegen/box/collections/internalRemove.kt"); + } + @TestMetadata("kt41123.kt") public void testKt41123() throws Exception { runTest("compiler/testData/codegen/box/collections/kt41123.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index a788de84b29..599b2492b45 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -4123,6 +4123,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/collections/inSetWithSmartCast.kt"); } + @TestMetadata("internalRemove.kt") + public void testInternalRemove() throws Exception { + runTest("compiler/testData/codegen/box/collections/internalRemove.kt"); + } + @TestMetadata("kt41123.kt") public void testKt41123() throws Exception { runTest("compiler/testData/codegen/box/collections/kt41123.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index 3eb24aef7aa..0870716ac09 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -2979,6 +2979,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/collections"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); } + @TestMetadata("internalRemove.kt") + public void testInternalRemove() throws Exception { + runTest("compiler/testData/codegen/box/collections/internalRemove.kt"); + } + @TestMetadata("removeClash.kt") public void testRemoveClash() throws Exception { runTest("compiler/testData/codegen/box/collections/removeClash.kt"); From 5d9e86863a33c9c6969fb2747b4edbc00d8697bc Mon Sep 17 00:00:00 2001 From: Mads Ager Date: Fri, 27 Nov 2020 12:17:59 +0100 Subject: [PATCH 446/698] [IR] Make isHidden and isAssignable explicit on IrValueParameter. There were a couple of places where they were confused and isAssignable was passed as a positional parameter in the position of isHidden. --- .../jetbrains/kotlin/fir/backend/ConversionUtils.kt | 3 ++- .../kotlin/fir/backend/Fir2IrDeclarationStorage.kt | 6 ++++-- .../kotlin/fir/backend/generators/AdapterGenerator.kt | 1 + .../backend/generators/DataClassMembersGenerator.kt | 2 +- .../org/jetbrains/kotlin/backend/common/ir/IrUtils.kt | 10 +++++++--- .../ir/builders/declarations/declarationBuilders.kt | 3 ++- .../psi2ir/generators/ArgumentsGenerationUtils.kt | 3 ++- .../psi2ir/generators/ReflectionReferencesGenerator.kt | 2 +- .../kotlin/psi2ir/generators/ScriptGenerator.kt | 3 ++- .../ir/declarations/impl/IrValueParameterImpl.kt | 4 ++-- .../persistent/PersistentIrValueParameter.kt | 2 +- .../org/jetbrains/kotlin/ir/declarations/IrFactory.kt | 4 ++-- .../ir/declarations/lazy/IrLazyDeclarationBase.kt | 3 ++- .../org/jetbrains/kotlin/ir/descriptors/IrBuiltIns.kt | 4 ++-- .../kotlin/ir/descriptors/IrFunctionFactory.kt | 4 +++- .../kotlin/ir/overrides/FakeOverrideCopier.kt | 3 ++- .../kotlin/ir/util/DeclarationStubGenerator.kt | 2 +- .../kotlin/ir/util/DeepCopyIrTreeWithSymbols.kt | 1 + .../src/org/jetbrains/kotlin/ir/util/SymbolTable.kt | 3 ++- .../android/synthetic/codegen/AndroidIrExtension.kt | 3 ++- .../compiler/backend/ir/GeneratorHelpers.kt | 3 ++- 21 files changed, 44 insertions(+), 25 deletions(-) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt index bca4d4bdc20..908b8a7c018 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt @@ -338,7 +338,8 @@ internal fun IrDeclarationParent.declareThisReceiverParameter( symbolTable.irFactory.createValueParameter( startOffset, endOffset, thisOrigin, symbol, Name.special(""), UNDEFINED_PARAMETER_INDEX, thisType, - varargElementType = null, isCrossinline = false, isNoinline = false, isAssignable = false + varargElementType = null, isCrossinline = false, isNoinline = false, + isHidden = false, isAssignable = false ).apply { this.parent = this@declareThisReceiverParameter receiverDescriptor.bind(this) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt index 3f99bf128a7..1b2734c6a2b 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt @@ -269,7 +269,8 @@ class Fir2IrDeclarationStorage( startOffset, endOffset, IrDeclarationOrigin.DEFINED, symbol, Name.special(""), 0, type, varargElementType = null, - isCrossinline = false, isNoinline = false, isAssignable = false + isCrossinline = false, isNoinline = false, + isHidden = false, isAssignable = false ).apply { this.parent = parent descriptor.bind(this) @@ -895,7 +896,8 @@ class Fir2IrDeclarationStorage( valueParameter.name, index, type, if (!valueParameter.isVararg) null else valueParameter.returnTypeRef.coneType.arrayElementType()?.toIrType(typeContext), - valueParameter.isCrossinline, valueParameter.isNoinline + isCrossinline = valueParameter.isCrossinline, isNoinline = valueParameter.isNoinline, + isHidden = false, isAssignable = false ).apply { descriptor.bind(this) if (valueParameter.defaultValue.let { diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/AdapterGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/AdapterGenerator.kt index cb59bea9a29..8a545df2e03 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/AdapterGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/AdapterGenerator.kt @@ -266,6 +266,7 @@ internal class AdapterGenerator( varargElementType = null, isCrossinline = false, isNoinline = false, + isHidden = false, isAssignable = false ).also { irAdapterValueParameter -> descriptor.bind(irAdapterValueParameter) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DataClassMembersGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DataClassMembersGenerator.kt index c5e3a584bc6..7e0ecbf63dd 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DataClassMembersGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DataClassMembersGenerator.kt @@ -295,7 +295,7 @@ class DataClassMembersGenerator(val components: Fir2IrComponents) { ) { symbol -> components.irFactory.createValueParameter( UNDEFINED_OFFSET, UNDEFINED_OFFSET, origin, symbol, name, index, type, null, - isCrossinline = false, isNoinline = false, isAssignable = false + isCrossinline = false, isNoinline = false, isHidden = false, isAssignable = false ) }.apply { parent = irFunction diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/IrUtils.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/IrUtils.kt index 4f1ac7a583e..ea220ef45aa 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/IrUtils.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/IrUtils.kt @@ -144,7 +144,8 @@ fun IrValueParameter.copyTo( } return factory.createValueParameter( startOffset, endOffset, origin, symbol, - name, index, type, varargElementType, isCrossinline, isNoinline, isAssignable = isAssignable + name, index, type, varargElementType, isCrossinline = isCrossinline, + isNoinline = isNoinline, isHidden = false, isAssignable = isAssignable ).also { descriptor.bind(it) it.parent = irFunction @@ -173,7 +174,8 @@ fun IrFunction.copyReceiverParametersFrom(from: IrFunction, substitutionMap: Map name, index, type.substitute(substitutionMap), varargElementType?.substitute(substitutionMap), - isCrossinline, isNoinline + isCrossinline, isNoinline, + isHidden, isAssignable ).also { parameter -> parameter.parent = this@copyReceiverParametersFrom newDescriptor.bind(this) @@ -428,7 +430,9 @@ fun IrFunction.createDispatchReceiverParameter(origin: IrDeclarationOrigin? = nu parentAsClass.defaultType, null, isCrossinline = false, - isNoinline = false + isNoinline = false, + isHidden = false, + isAssignable = false ).apply { parent = this@createDispatchReceiverParameter newDescriptor.bind(this) diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/ir/builders/declarations/declarationBuilders.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/ir/builders/declarations/declarationBuilders.kt index 82081ca4438..4314229c78f 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/ir/builders/declarations/declarationBuilders.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/ir/builders/declarations/declarationBuilders.kt @@ -211,7 +211,8 @@ fun buildReceiverParameter( parent.factory.createValueParameter( startOffset, endOffset, origin, IrValueParameterSymbolImpl(wrappedDescriptor), - RECEIVER_PARAMETER_NAME, -1, type, null, isCrossinline = false, isNoinline = false, isAssignable = false + RECEIVER_PARAMETER_NAME, -1, type, null, isCrossinline = false, isNoinline = false, + isHidden = false, isAssignable = false ).also { wrappedDescriptor.bind(it) it.parent = parent diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ArgumentsGenerationUtils.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ArgumentsGenerationUtils.kt index 5fa26c4a8fb..ce574d96186 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ArgumentsGenerationUtils.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ArgumentsGenerationUtils.kt @@ -386,7 +386,8 @@ private fun StatementGenerator.createFunctionForSuspendConversion( ) { context.irFactory.createValueParameter( startOffset, endOffset, IrDeclarationOrigin.ADAPTER_PARAMETER_FOR_SUSPEND_CONVERSION, - it, Name.identifier(name), index, type, varargElementType = null, isCrossinline = false, isNoinline = false + it, Name.identifier(name), index, type, varargElementType = null, isCrossinline = false, isNoinline = false, + isHidden = false, isAssignable = false ) }.also { descriptor.bind(it) diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ReflectionReferencesGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ReflectionReferencesGenerator.kt index afb24766516..62c8337ccc2 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ReflectionReferencesGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ReflectionReferencesGenerator.kt @@ -383,7 +383,7 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St name, index, type.toIrType(), - varargElementType = null, isCrossinline = false, isNoinline = false, isAssignable = false + varargElementType = null, isCrossinline = false, isNoinline = false, isHidden = false, isAssignable = false ).also { irAdapterValueParameter -> descriptor.bind(irAdapterValueParameter) } diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ScriptGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ScriptGenerator.kt index 44aa66e2264..40537f04296 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ScriptGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ScriptGenerator.kt @@ -74,7 +74,8 @@ class ScriptGenerator(declarationGenerator: DeclarationGenerator) : DeclarationG origin, symbol, context.symbolTable.nameProvider.nameForDeclaration(descriptor), if (index != -1) index else descriptor.indexOrMinusOne, type, varargElementType, - descriptor.isCrossinline, descriptor.isNoinline, false + descriptor.isCrossinline, descriptor.isNoinline, + isHidden = false, isAssignable = false ) } .also { it.parent = irScript } } diff --git a/compiler/ir/ir.tree.impl/src/org/jetbrains/kotlin/ir/declarations/impl/IrValueParameterImpl.kt b/compiler/ir/ir.tree.impl/src/org/jetbrains/kotlin/ir/declarations/impl/IrValueParameterImpl.kt index 1e92a75769b..5e8e09a877e 100644 --- a/compiler/ir/ir.tree.impl/src/org/jetbrains/kotlin/ir/declarations/impl/IrValueParameterImpl.kt +++ b/compiler/ir/ir.tree.impl/src/org/jetbrains/kotlin/ir/declarations/impl/IrValueParameterImpl.kt @@ -39,8 +39,8 @@ class IrValueParameterImpl( override var varargElementType: IrType?, override val isCrossinline: Boolean, override val isNoinline: Boolean, - override val isHidden: Boolean = false, - override val isAssignable: Boolean = false + override val isHidden: Boolean, + override val isAssignable: Boolean ) : IrValueParameter() { @ObsoleteDescriptorBasedAPI override val descriptor: ParameterDescriptor diff --git a/compiler/ir/ir.tree.persistent/src/org/jetbrains/kotlin/ir/declarations/persistent/PersistentIrValueParameter.kt b/compiler/ir/ir.tree.persistent/src/org/jetbrains/kotlin/ir/declarations/persistent/PersistentIrValueParameter.kt index a7e6212d0da..84a10bee4c8 100644 --- a/compiler/ir/ir.tree.persistent/src/org/jetbrains/kotlin/ir/declarations/persistent/PersistentIrValueParameter.kt +++ b/compiler/ir/ir.tree.persistent/src/org/jetbrains/kotlin/ir/declarations/persistent/PersistentIrValueParameter.kt @@ -41,7 +41,7 @@ internal class PersistentIrValueParameter( varargElementType: IrType?, override val isCrossinline: Boolean, override val isNoinline: Boolean, - override val isHidden: Boolean = false, + override val isHidden: Boolean, override val isAssignable: Boolean ) : IrValueParameter(), PersistentIrDeclarationBase, diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrFactory.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrFactory.kt index 6ad4e6cfcda..89e67e51841 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrFactory.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrFactory.kt @@ -199,8 +199,8 @@ interface IrFactory { varargElementType: IrType?, isCrossinline: Boolean, isNoinline: Boolean, - isHidden: Boolean = false, - isAssignable: Boolean = false + isHidden: Boolean, + isAssignable: Boolean ): IrValueParameter // Bodies diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/lazy/IrLazyDeclarationBase.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/lazy/IrLazyDeclarationBase.kt index 3a8829bc43f..0bd01779c6a 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/lazy/IrLazyDeclarationBase.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/lazy/IrLazyDeclarationBase.kt @@ -32,7 +32,8 @@ interface IrLazyDeclarationBase : IrDeclaration { fun ReceiverParameterDescriptor.generateReceiverParameterStub(): IrValueParameter = factory.createValueParameter( UNDEFINED_OFFSET, UNDEFINED_OFFSET, origin, IrValueParameterSymbolImpl(this), - name, -1, type.toIrType(), null, isCrossinline = false, isNoinline = false, isAssignable = false + name, -1, type.toIrType(), null, isCrossinline = false, isNoinline = false, + isHidden = false, isAssignable = false ) fun generateMemberStubs(memberScope: MemberScope, container: MutableList) { diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrBuiltIns.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrBuiltIns.kt index 4b47ecf8410..a499065b010 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrBuiltIns.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrBuiltIns.kt @@ -80,7 +80,7 @@ class IrBuiltIns( val valueParameterSymbol = IrValueParameterSymbolImpl(valueParameterDescriptor) irFactory.createValueParameter( UNDEFINED_OFFSET, UNDEFINED_OFFSET, BUILTIN_OPERATOR, valueParameterSymbol, Name.identifier("arg$i"), i, - valueParameterType, null, isCrossinline = false, isNoinline = false, isAssignable = false + valueParameterType, null, isCrossinline = false, isNoinline = false, isHidden = false, isAssignable = false ).apply { parent = operator } @@ -165,7 +165,7 @@ class IrBuiltIns( val valueParameterSymbol = IrValueParameterSymbolImpl(valueParameterDescriptor) val valueParameter = irFactory.createValueParameter( UNDEFINED_OFFSET, UNDEFINED_OFFSET, BUILTIN_OPERATOR, valueParameterSymbol, Name.identifier("arg0"), 0, - valueIrType, null, isCrossinline = false, isNoinline = false, isAssignable = false + valueIrType, null, isCrossinline = false, isNoinline = false, isHidden = false, isAssignable = false ) valueParameter.parent = operator diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrFunctionFactory.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrFunctionFactory.kt index e66d28dfba4..bc2dd3b00db 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrFunctionFactory.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrFunctionFactory.kt @@ -269,6 +269,7 @@ class IrFunctionFactory(private val irBuiltIns: IrBuiltIns, private val symbolTa offset, offset, classOrigin, vSymbol, Name.special(""), -1, type, null, isCrossinline = false, isNoinline = false, + isHidden = false, isAssignable = false ) @@ -334,6 +335,7 @@ class IrFunctionFactory(private val irBuiltIns: IrBuiltIns, private val symbolTa offset, offset, memberOrigin, vSymbol, Name.identifier("p$i"), i - 1, vType, null, isCrossinline = false, isNoinline = false, + isHidden = false, isAssignable = false ) vDeclaration.parent = fDeclaration @@ -366,7 +368,7 @@ class IrFunctionFactory(private val irBuiltIns: IrBuiltIns, private val symbolTa private fun IrFunction.createValueParameter(descriptor: ParameterDescriptor): IrValueParameter = with(descriptor) { irFactory.createValueParameter( offset, offset, memberOrigin, IrValueParameterSymbolImpl(this), name, indexOrMinusOne, toIrType(type), - (this as? ValueParameterDescriptor)?.varargElementType?.let(::toIrType), isCrossinline, isNoinline + (this as? ValueParameterDescriptor)?.varargElementType?.let(::toIrType), isCrossinline, isNoinline, false, false ).also { it.parent = this@createValueParameter } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/overrides/FakeOverrideCopier.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/overrides/FakeOverrideCopier.kt index 4bfb6faeeb1..6805b771f1b 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/overrides/FakeOverrideCopier.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/overrides/FakeOverrideCopier.kt @@ -96,7 +96,8 @@ class FakeOverrideCopier( declaration.varargElementType?.remapType(), declaration.isCrossinline, declaration.isNoinline, - false + declaration.isHidden, + declaration.isAssignable ).apply { transformAnnotations(declaration) // Don't set the default value for fake overrides. diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeclarationStubGenerator.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeclarationStubGenerator.kt index 0ffed6b9f03..7287ed068a8 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeclarationStubGenerator.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeclarationStubGenerator.kt @@ -246,7 +246,7 @@ class DeclarationStubGenerator( internal fun generateValueParameterStub(descriptor: ValueParameterDescriptor): IrValueParameter = with(descriptor) { symbolTable.irFactory.createValueParameter( UNDEFINED_OFFSET, UNDEFINED_OFFSET, computeOrigin(this), IrValueParameterSymbolImpl(this), name, index, type.toIrType(), - varargElementType?.toIrType(), isCrossinline, isNoinline, false + varargElementType?.toIrType(), isCrossinline, isNoinline, isHidden = false, isAssignable = false ).also { irValueParameter -> if (descriptor.declaresDefaultValue()) { irValueParameter.defaultValue = diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTreeWithSymbols.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTreeWithSymbols.kt index 70b5b5214d3..9fb87ab940b 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTreeWithSymbols.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTreeWithSymbols.kt @@ -351,6 +351,7 @@ open class DeepCopyIrTreeWithSymbols( declaration.varargElementType?.remapType(), declaration.isCrossinline, declaration.isNoinline, + declaration.isHidden, declaration.isAssignable ).apply { transformAnnotations(declaration) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt index 28a46025702..6200f564dba 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt @@ -901,7 +901,8 @@ class SymbolTable( valueParameterFactory: (IrValueParameterSymbol) -> IrValueParameter = { irFactory.createValueParameter( startOffset, endOffset, origin, it, name ?: nameProvider.nameForDeclaration(descriptor), - descriptor.indexOrMinusOne, type, varargElementType, descriptor.isCrossinline, descriptor.isNoinline, false + descriptor.indexOrMinusOne, type, varargElementType, descriptor.isCrossinline, descriptor.isNoinline, + isHidden = false, isAssignable = false ) } ): IrValueParameter = diff --git a/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/codegen/AndroidIrExtension.kt b/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/codegen/AndroidIrExtension.kt index 7b6ee95706b..42667cb55a5 100644 --- a/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/codegen/AndroidIrExtension.kt +++ b/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/codegen/AndroidIrExtension.kt @@ -244,7 +244,8 @@ private fun TranslationPluginContext.declareParameterStub(parameterDescriptor: P val varargElementType = parameterDescriptor.varargElementType?.let { typeTranslator.translateType(it) } return irFactory.createValueParameter( UNDEFINED_OFFSET, UNDEFINED_OFFSET, IrDeclarationOrigin.DEFINED, symbol, parameterDescriptor.name, - parameterDescriptor.indexOrMinusOne, type, varargElementType, parameterDescriptor.isCrossinline, parameterDescriptor.isNoinline + parameterDescriptor.indexOrMinusOne, type, varargElementType, parameterDescriptor.isCrossinline, + parameterDescriptor.isNoinline, isHidden = false, isAssignable = false ) } diff --git a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/GeneratorHelpers.kt b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/GeneratorHelpers.kt index 42a41eb3847..9f8c2ec00c1 100644 --- a/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/GeneratorHelpers.kt +++ b/plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/GeneratorHelpers.kt @@ -418,7 +418,8 @@ interface IrBuilderExtension { fun irValueParameter(descriptor: ParameterDescriptor): IrValueParameter = with(descriptor) { factory.createValueParameter( function.startOffset, function.endOffset, SERIALIZABLE_PLUGIN_ORIGIN, IrValueParameterSymbolImpl(this), - name, indexOrMinusOne, type.toIrType(), varargElementType?.toIrType(), isCrossinline, isNoinline, false + name, indexOrMinusOne, type.toIrType(), varargElementType?.toIrType(), isCrossinline, isNoinline, + isHidden = false, isAssignable = false ).also { it.parent = function } From 7354bcbc991fb651f336afaa5718878899e18544 Mon Sep 17 00:00:00 2001 From: Vyacheslav Gerasimov Date: Mon, 16 Nov 2020 22:23:01 +0300 Subject: [PATCH 447/698] Build: Publish kotlin-compiler-internal-test-framework maven artifact --- .../build.gradle.kts | 15 +++++++++++++++ settings.gradle | 1 + 2 files changed, 16 insertions(+) create mode 100644 prepare/kotlin-compiler-internal-test-framework/build.gradle.kts diff --git a/prepare/kotlin-compiler-internal-test-framework/build.gradle.kts b/prepare/kotlin-compiler-internal-test-framework/build.gradle.kts new file mode 100644 index 00000000000..a726d6e6031 --- /dev/null +++ b/prepare/kotlin-compiler-internal-test-framework/build.gradle.kts @@ -0,0 +1,15 @@ +plugins { + java +} + +val embedded by configurations + +dependencies { + embedded(projectTests(":compiler:tests-common")) { isTransitive = false } +} + +publish() + +runtimeJar() +sourcesJar() +javadocJar() diff --git a/settings.gradle b/settings.gradle index e139e8bfe77..f0b59c44a99 100644 --- a/settings.gradle +++ b/settings.gradle @@ -224,6 +224,7 @@ include ":benchmarks", ":prepare:formatter", ":prepare:ide-lazy-resolver", ":prepare:idea-plugin", + ":prepare:kotlin-compiler-internal-test-framework", ":kotlin-compiler", ":kotlin-compiler-embeddable", ":kotlin-compiler-client-embeddable", From bf4f2605d4b80bee23c910b409cc549ad265416e Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Fri, 4 Dec 2020 18:05:25 +0300 Subject: [PATCH 448/698] Mark FirPsiCheckerTestGenerated.Regression.testJet53 as FLAKY --- tests/mute-common.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/mute-common.csv b/tests/mute-common.csv index c8c737a976d..b85ef64c32d 100644 --- a/tests/mute-common.csv +++ b/tests/mute-common.csv @@ -80,3 +80,4 @@ org.jetbrains.kotlin.idea.caches.resolve.IdeLightClassTestGenerated.Facades.test org.jetbrains.kotlin.idea.caches.resolve.IdeLightClassTestGenerated.CompilationErrors.testActualTypeAliasCustomJvmPackageName, Invalid behavior of old lightclasses in common tests,, org.jetbrains.kotlin.idea.caches.resolve.IdeLightClassTestGenerated.CompilationErrors.testJvmPackageName, Invalid behavior of old lightclasses in common tests,, org.jetbrains.uast.test.kotlin.SimpleKotlinRenderLogTest.testReceiverFun, Analysing of facade annotation with receiver site is broken (connected with KT-40403),, +org.jetbrains.kotlin.checkers.FirPsiCheckerTestGenerated.Regression.testJet53,,, FLAKY From b10e2061449d98432e450c027d3bbeac07d91f48 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Wed, 25 Nov 2020 17:09:42 +0100 Subject: [PATCH 449/698] IR: minor, deduplicate unbound symbol in error message --- .../ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt index 6200f564dba..7628d548567 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt @@ -1119,7 +1119,7 @@ fun SymbolTable.noUnboundLeft(message: String) { assert(unbound.isEmpty()) { "$message\n" + unbound.joinToString("\n") { - "$it ${it.signature?.toString() ?: "NON-PUBLIC API $it"}" + "$it ${it.signature?.toString() ?: "(NON-PUBLIC API)"}" } } } From a343fffe9ea4cccb4bd13104c3d321bdd6789a9b Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Thu, 26 Nov 2020 17:50:54 +0100 Subject: [PATCH 450/698] Noarg: somewhat refactor tests Extract method that registers components, merge abstract test classes into one file. --- plugins/noarg/noarg-cli/src/NoArgPlugin.kt | 21 +++++++----- .../AbstractBlackBoxCodegenTestForNoArg.kt | 22 ------------ .../AbstractBytecodeListingTestForNoArg.kt | 34 ------------------- .../org/jetbrains/kotlin/noarg/NoArgTests.kt | 30 ++++++++++++++++ 4 files changed, 43 insertions(+), 64 deletions(-) delete mode 100644 plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/AbstractBlackBoxCodegenTestForNoArg.kt delete mode 100644 plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/AbstractBytecodeListingTestForNoArg.kt create mode 100644 plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/NoArgTests.kt diff --git a/plugins/noarg/noarg-cli/src/NoArgPlugin.kt b/plugins/noarg/noarg-cli/src/NoArgPlugin.kt index 589a92b1b1d..348887eefdc 100644 --- a/plugins/noarg/noarg-cli/src/NoArgPlugin.kt +++ b/plugins/noarg/noarg-cli/src/NoArgPlugin.kt @@ -17,6 +17,7 @@ package org.jetbrains.kotlin.noarg import com.intellij.mock.MockProject +import com.intellij.openapi.project.Project import org.jetbrains.kotlin.codegen.extensions.ExpressionCodegenExtension import org.jetbrains.kotlin.compiler.plugin.* import org.jetbrains.kotlin.config.CompilerConfiguration @@ -66,7 +67,7 @@ class NoArgCommandLineProcessor : CommandLineProcessor { required = false, allowMultipleOccurrences = false ) - val PLUGIN_ID = "org.jetbrains.kotlin.noarg" + const val PLUGIN_ID = "org.jetbrains.kotlin.noarg" } override val pluginId = PLUGIN_ID @@ -82,16 +83,20 @@ class NoArgCommandLineProcessor : CommandLineProcessor { class NoArgComponentRegistrar : ComponentRegistrar { override fun registerProjectComponents(project: MockProject, configuration: CompilerConfiguration) { - val annotations = configuration.get(ANNOTATION)?.toMutableList() ?: mutableListOf() + val annotations = configuration.get(ANNOTATION).orEmpty().toMutableList() configuration.get(PRESET)?.forEach { preset -> SUPPORTED_PRESETS[preset]?.let { annotations += it } } - if (annotations.isEmpty()) return + if (annotations.isNotEmpty()) { + registerNoArgComponents(project, annotations, configuration.getBoolean(INVOKE_INITIALIZERS)) + } + } - StorageComponentContainerContributor.registerExtension(project, CliNoArgComponentContainerContributor(annotations)) - - val invokeInitializers = configuration[INVOKE_INITIALIZERS] ?: false - ExpressionCodegenExtension.registerExtension(project, CliNoArgExpressionCodegenExtension(annotations, invokeInitializers)) + internal companion object { + fun registerNoArgComponents(project: Project, annotations: List, invokeInitializers: Boolean) { + StorageComponentContainerContributor.registerExtension(project, CliNoArgComponentContainerContributor(annotations)) + ExpressionCodegenExtension.registerExtension(project, CliNoArgExpressionCodegenExtension(annotations, invokeInitializers)) + } } } @@ -103,4 +108,4 @@ class CliNoArgComponentContainerContributor(val annotations: List) : Sto container.useInstance(CliNoArgDeclarationChecker(annotations)) } -} \ No newline at end of file +} diff --git a/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/AbstractBlackBoxCodegenTestForNoArg.kt b/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/AbstractBlackBoxCodegenTestForNoArg.kt deleted file mode 100644 index 8175da2f181..00000000000 --- a/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/AbstractBlackBoxCodegenTestForNoArg.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.noarg - -import org.jetbrains.kotlin.codegen.AbstractBlackBoxCodegenTest -import org.jetbrains.kotlin.codegen.extensions.ExpressionCodegenExtension -import org.jetbrains.kotlin.extensions.StorageComponentContainerContributor.Companion.registerExtension -import org.jetbrains.kotlin.noarg.AbstractBytecodeListingTestForNoArg.Companion.NOARG_ANNOTATIONS - -abstract class AbstractBlackBoxCodegenTestForNoArg : AbstractBlackBoxCodegenTest() { - override fun loadMultiFiles(files: MutableList) { - val project = myEnvironment.project - registerExtension(project, CliNoArgComponentContainerContributor(NOARG_ANNOTATIONS)) - val invokeInitializers = files.any { "// INVOKE_INITIALIZERS" in it.content } - ExpressionCodegenExtension.registerExtension(project, CliNoArgExpressionCodegenExtension(NOARG_ANNOTATIONS, invokeInitializers)) - - super.loadMultiFiles(files) - } -} \ No newline at end of file diff --git a/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/AbstractBytecodeListingTestForNoArg.kt b/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/AbstractBytecodeListingTestForNoArg.kt deleted file mode 100644 index 2dff5c63275..00000000000 --- a/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/AbstractBytecodeListingTestForNoArg.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2010-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.noarg - -import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment -import org.jetbrains.kotlin.codegen.AbstractBytecodeListingTest -import org.jetbrains.kotlin.codegen.extensions.ExpressionCodegenExtension -import org.jetbrains.kotlin.extensions.StorageComponentContainerContributor - -abstract class AbstractBytecodeListingTestForNoArg : AbstractBytecodeListingTest() { - internal companion object { - val NOARG_ANNOTATIONS = listOf("NoArg", "NoArg2", "test.NoArg") - } - - override fun setupEnvironment(environment: KotlinCoreEnvironment) { - val project = environment.project - StorageComponentContainerContributor.registerExtension(project, CliNoArgComponentContainerContributor(NOARG_ANNOTATIONS)) - ExpressionCodegenExtension.registerExtension(project, CliNoArgExpressionCodegenExtension(NOARG_ANNOTATIONS, false)) - } -} \ No newline at end of file diff --git a/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/NoArgTests.kt b/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/NoArgTests.kt new file mode 100644 index 00000000000..07c557dd2de --- /dev/null +++ b/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/NoArgTests.kt @@ -0,0 +1,30 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.noarg + +import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment +import org.jetbrains.kotlin.codegen.AbstractBlackBoxCodegenTest +import org.jetbrains.kotlin.codegen.AbstractBytecodeListingTest + +internal val NOARG_ANNOTATIONS = listOf("NoArg", "NoArg2", "test.NoArg") + +abstract class AbstractBlackBoxCodegenTestForNoArg : AbstractBlackBoxCodegenTest() { + override fun loadMultiFiles(files: MutableList) { + NoArgComponentRegistrar.registerNoArgComponents( + myEnvironment.project, + NOARG_ANNOTATIONS, + files.any { it.directives.contains("INVOKE_INITIALIZERS") }, + ) + + super.loadMultiFiles(files) + } +} + +abstract class AbstractBytecodeListingTestForNoArg : AbstractBytecodeListingTest() { + override fun setupEnvironment(environment: KotlinCoreEnvironment) { + NoArgComponentRegistrar.registerNoArgComponents(environment.project, NOARG_ANNOTATIONS, false) + } +} From a06bffc4b975527833b61d8b316ea62fb7bbbe53 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Thu, 26 Nov 2020 17:44:29 +0100 Subject: [PATCH 451/698] Noarg: prohibit noarg for inner and local classes Report warning if old JVM backend is used, and error for JVM IR, which is supposed to be enabled as default in the next Kotlin release. #KT-43725 Fixed --- .../kotlin/generators/tests/GenerateTests.kt | 5 ++- .../generators/tests/GenerateTests.kt.as41 | 5 ++- .../generators/tests/GenerateTests.kt.as42 | 5 ++- plugins/noarg/noarg-cli/src/NoArgPlugin.kt | 16 +++++--- .../diagnostic/CliNoArgDeclarationChecker.kt | 30 ++++++++++---- .../diagnostic/DefaultErrorMessagesNoArg.kt | 12 +++++- .../kotlin/noarg/diagnostic/ErrorsNoArg.java | 6 ++- .../DiagnosticsTestForNoArgGenerated.java | 40 +++++++++++++++++++ .../org/jetbrains/kotlin/noarg/NoArgTests.kt | 10 ++++- .../testData/diagnostics/innerClass.kt | 14 +++++++ .../testData/diagnostics/innerClass.txt | 25 ++++++++++++ .../diagnostics/noNoargCtorInSuperclass.kt | 6 +++ .../diagnostics/noNoargCtorInSuperclass.txt | 24 +++++++++++ 13 files changed, 177 insertions(+), 21 deletions(-) create mode 100644 plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/DiagnosticsTestForNoArgGenerated.java create mode 100644 plugins/noarg/noarg-cli/testData/diagnostics/innerClass.kt create mode 100644 plugins/noarg/noarg-cli/testData/diagnostics/innerClass.txt create mode 100644 plugins/noarg/noarg-cli/testData/diagnostics/noNoargCtorInSuperclass.kt create mode 100644 plugins/noarg/noarg-cli/testData/diagnostics/noNoargCtorInSuperclass.txt diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index 6534ab2f8e4..cc3c6d9ebd8 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -166,8 +166,7 @@ import org.jetbrains.kotlin.nj2k.AbstractTextNewJavaToKotlinCopyPasteConversionT import org.jetbrains.kotlin.nj2k.inference.common.AbstractCommonConstraintCollectorTest import org.jetbrains.kotlin.nj2k.inference.mutability.AbstractMutabilityInferenceTest import org.jetbrains.kotlin.nj2k.inference.nullability.AbstractNullabilityInferenceTest -import org.jetbrains.kotlin.noarg.AbstractBlackBoxCodegenTestForNoArg -import org.jetbrains.kotlin.noarg.AbstractBytecodeListingTestForNoArg +import org.jetbrains.kotlin.noarg.* import org.jetbrains.kotlin.parcelize.test.AbstractParcelizeBoxTest import org.jetbrains.kotlin.parcelize.test.AbstractParcelizeBytecodeListingTest import org.jetbrains.kotlin.parcelize.test.AbstractParcelizeIrBoxTest @@ -1664,6 +1663,8 @@ fun main(args: Array) { } testGroup("plugins/noarg/noarg-cli/test", "plugins/noarg/noarg-cli/testData") { + testClass { model("diagnostics", extension = "kt") } + testClass { model("bytecodeListing", extension = "kt") } diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as41 b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as41 index 94e55acbead..dbcad1d5ecc 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as41 +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as41 @@ -146,8 +146,7 @@ import org.jetbrains.kotlin.nj2k.AbstractTextNewJavaToKotlinCopyPasteConversionT import org.jetbrains.kotlin.nj2k.inference.common.AbstractCommonConstraintCollectorTest import org.jetbrains.kotlin.nj2k.inference.mutability.AbstractMutabilityInferenceTest import org.jetbrains.kotlin.nj2k.inference.nullability.AbstractNullabilityInferenceTest -import org.jetbrains.kotlin.noarg.AbstractBlackBoxCodegenTestForNoArg -import org.jetbrains.kotlin.noarg.AbstractBytecodeListingTestForNoArg +import org.jetbrains.kotlin.noarg.* import org.jetbrains.kotlin.parcelize.test.AbstractParcelizeBoxTest import org.jetbrains.kotlin.parcelize.test.AbstractParcelizeBytecodeListingTest import org.jetbrains.kotlin.parcelize.test.AbstractParcelizeIrBoxTest @@ -1188,6 +1187,8 @@ fun main(args: Array) { } testGroup("plugins/noarg/noarg-cli/test", "plugins/noarg/noarg-cli/testData") { + testClass { model("diagnostics", extension = "kt") } + testClass { model("bytecodeListing", extension = "kt") } diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as42 b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as42 index 3414ed8fbf0..5ce7e754ae1 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as42 +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as42 @@ -149,8 +149,7 @@ import org.jetbrains.kotlin.nj2k.AbstractTextNewJavaToKotlinCopyPasteConversionT import org.jetbrains.kotlin.nj2k.inference.common.AbstractCommonConstraintCollectorTest import org.jetbrains.kotlin.nj2k.inference.mutability.AbstractMutabilityInferenceTest import org.jetbrains.kotlin.nj2k.inference.nullability.AbstractNullabilityInferenceTest -import org.jetbrains.kotlin.noarg.AbstractBlackBoxCodegenTestForNoArg -import org.jetbrains.kotlin.noarg.AbstractBytecodeListingTestForNoArg +import org.jetbrains.kotlin.noarg.* import org.jetbrains.kotlin.psi.patternMatching.AbstractPsiUnifierTest import org.jetbrains.kotlin.samWithReceiver.AbstractSamWithReceiverScriptTest import org.jetbrains.kotlin.samWithReceiver.AbstractSamWithReceiverTest @@ -1112,6 +1111,8 @@ fun main(args: Array) { } testGroup("plugins/noarg/noarg-cli/test", "plugins/noarg/noarg-cli/testData") { + testClass { model("diagnostics", extension = "kt") } + testClass { model("bytecodeListing", extension = "kt") } diff --git a/plugins/noarg/noarg-cli/src/NoArgPlugin.kt b/plugins/noarg/noarg-cli/src/NoArgPlugin.kt index 348887eefdc..547bc853155 100644 --- a/plugins/noarg/noarg-cli/src/NoArgPlugin.kt +++ b/plugins/noarg/noarg-cli/src/NoArgPlugin.kt @@ -22,6 +22,7 @@ import org.jetbrains.kotlin.codegen.extensions.ExpressionCodegenExtension import org.jetbrains.kotlin.compiler.plugin.* import org.jetbrains.kotlin.config.CompilerConfiguration import org.jetbrains.kotlin.config.CompilerConfigurationKey +import org.jetbrains.kotlin.config.JVMConfigurationKeys import org.jetbrains.kotlin.container.StorageComponentContainer import org.jetbrains.kotlin.container.useInstance import org.jetbrains.kotlin.descriptors.ModuleDescriptor @@ -88,24 +89,29 @@ class NoArgComponentRegistrar : ComponentRegistrar { SUPPORTED_PRESETS[preset]?.let { annotations += it } } if (annotations.isNotEmpty()) { - registerNoArgComponents(project, annotations, configuration.getBoolean(INVOKE_INITIALIZERS)) + registerNoArgComponents( + project, annotations, configuration.getBoolean(JVMConfigurationKeys.IR), configuration.getBoolean(INVOKE_INITIALIZERS), + ) } } internal companion object { - fun registerNoArgComponents(project: Project, annotations: List, invokeInitializers: Boolean) { - StorageComponentContainerContributor.registerExtension(project, CliNoArgComponentContainerContributor(annotations)) + fun registerNoArgComponents(project: Project, annotations: List, useIr: Boolean, invokeInitializers: Boolean) { + StorageComponentContainerContributor.registerExtension(project, CliNoArgComponentContainerContributor(annotations, useIr)) ExpressionCodegenExtension.registerExtension(project, CliNoArgExpressionCodegenExtension(annotations, invokeInitializers)) } } } -class CliNoArgComponentContainerContributor(val annotations: List) : StorageComponentContainerContributor { +private class CliNoArgComponentContainerContributor( + private val annotations: List, + private val useIr: Boolean, +) : StorageComponentContainerContributor { override fun registerModuleComponents( container: StorageComponentContainer, platform: TargetPlatform, moduleDescriptor: ModuleDescriptor ) { if (!platform.isJvm()) return - container.useInstance(CliNoArgDeclarationChecker(annotations)) + container.useInstance(CliNoArgDeclarationChecker(annotations, useIr)) } } diff --git a/plugins/noarg/noarg-cli/src/org/jetbrains/kotlin/noarg/diagnostic/CliNoArgDeclarationChecker.kt b/plugins/noarg/noarg-cli/src/org/jetbrains/kotlin/noarg/diagnostic/CliNoArgDeclarationChecker.kt index abce7d90a50..8094adf16dc 100644 --- a/plugins/noarg/noarg-cli/src/org/jetbrains/kotlin/noarg/diagnostic/CliNoArgDeclarationChecker.kt +++ b/plugins/noarg/noarg-cli/src/org/jetbrains/kotlin/noarg/diagnostic/CliNoArgDeclarationChecker.kt @@ -16,32 +16,48 @@ package org.jetbrains.kotlin.noarg.diagnostic +import com.intellij.psi.PsiElement import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.extensions.AnnotationBasedExtension +import org.jetbrains.kotlin.noarg.diagnostic.ErrorsNoArg.* import org.jetbrains.kotlin.psi.KtClass import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.psi.KtModifierListOwner +import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.checkers.DeclarationChecker import org.jetbrains.kotlin.resolve.checkers.DeclarationCheckerContext import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperClassOrAny -class CliNoArgDeclarationChecker(private val noArgAnnotationFqNames: List) : AbstractNoArgDeclarationChecker() { - override fun getAnnotationFqNames(modifierListOwner: KtModifierListOwner?) = noArgAnnotationFqNames +internal class CliNoArgDeclarationChecker( + private val noArgAnnotationFqNames: List, + useIr: Boolean, +) : AbstractNoArgDeclarationChecker(useIr) { + override fun getAnnotationFqNames(modifierListOwner: KtModifierListOwner?): List = noArgAnnotationFqNames } -abstract class AbstractNoArgDeclarationChecker : DeclarationChecker, AnnotationBasedExtension { +internal abstract class AbstractNoArgDeclarationChecker(private val useIr: Boolean) : DeclarationChecker, AnnotationBasedExtension { override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) { - // Handle only classes if (descriptor !is ClassDescriptor || declaration !is KtClass) return if (descriptor.kind != ClassKind.CLASS) return if (!descriptor.hasSpecialAnnotation(declaration)) return + if (descriptor.isInner) { + val diagnostic = if (useIr) NOARG_ON_INNER_CLASS_ERROR else NOARG_ON_INNER_CLASS + context.trace.report(diagnostic.on(declaration.reportTarget)) + } else if (DescriptorUtils.isLocal(descriptor)) { + val diagnostic = if (useIr) NOARG_ON_LOCAL_CLASS_ERROR else NOARG_ON_LOCAL_CLASS + context.trace.report(diagnostic.on(declaration.reportTarget)) + } + val superClass = descriptor.getSuperClassOrAny() if (superClass.constructors.none { it.isNoArgConstructor() } && !superClass.hasSpecialAnnotation(declaration)) { - val reportTarget = declaration.nameIdentifier ?: declaration.getClassOrInterfaceKeyword() ?: declaration - context.trace.report(ErrorsNoArg.NO_NOARG_CONSTRUCTOR_IN_SUPERCLASS.on(reportTarget)) + context.trace.report(NO_NOARG_CONSTRUCTOR_IN_SUPERCLASS.on(declaration.reportTarget)) } } - private fun ConstructorDescriptor.isNoArgConstructor() = valueParameters.all(ValueParameterDescriptor::declaresDefaultValue) + private val KtClass.reportTarget: PsiElement + get() = nameIdentifier ?: getClassOrInterfaceKeyword() ?: this + + private fun ConstructorDescriptor.isNoArgConstructor(): Boolean = + valueParameters.all(ValueParameterDescriptor::declaresDefaultValue) } diff --git a/plugins/noarg/noarg-cli/src/org/jetbrains/kotlin/noarg/diagnostic/DefaultErrorMessagesNoArg.kt b/plugins/noarg/noarg-cli/src/org/jetbrains/kotlin/noarg/diagnostic/DefaultErrorMessagesNoArg.kt index baea39626f0..1c90da11d73 100644 --- a/plugins/noarg/noarg-cli/src/org/jetbrains/kotlin/noarg/diagnostic/DefaultErrorMessagesNoArg.kt +++ b/plugins/noarg/noarg-cli/src/org/jetbrains/kotlin/noarg/diagnostic/DefaultErrorMessagesNoArg.kt @@ -25,5 +25,15 @@ object DefaultErrorMessagesNoArg : DefaultErrorMessages.Extension { init { MAP.put(ErrorsNoArg.NO_NOARG_CONSTRUCTOR_IN_SUPERCLASS, "Zero-argument constructor was not found in the superclass") + MAP.put( + ErrorsNoArg.NOARG_ON_INNER_CLASS, + "Noarg constructor generation for inner classes is deprecated and will be prohibited soon" + ) + MAP.put(ErrorsNoArg.NOARG_ON_INNER_CLASS_ERROR, "Noarg constructor generation is not possible for inner classes") + MAP.put( + ErrorsNoArg.NOARG_ON_LOCAL_CLASS, + "Noarg constructor generation for local classes is deprecated and will be prohibited soon" + ) + MAP.put(ErrorsNoArg.NOARG_ON_LOCAL_CLASS_ERROR, "Noarg constructor generation is not possible for local classes") } -} \ No newline at end of file +} diff --git a/plugins/noarg/noarg-cli/src/org/jetbrains/kotlin/noarg/diagnostic/ErrorsNoArg.java b/plugins/noarg/noarg-cli/src/org/jetbrains/kotlin/noarg/diagnostic/ErrorsNoArg.java index cc0e61d78fc..5f7652c44da 100644 --- a/plugins/noarg/noarg-cli/src/org/jetbrains/kotlin/noarg/diagnostic/ErrorsNoArg.java +++ b/plugins/noarg/noarg-cli/src/org/jetbrains/kotlin/noarg/diagnostic/ErrorsNoArg.java @@ -20,10 +20,15 @@ import com.intellij.psi.PsiElement; import org.jetbrains.kotlin.diagnostics.DiagnosticFactory0; import org.jetbrains.kotlin.diagnostics.Errors; +import static org.jetbrains.kotlin.diagnostics.Severity.ERROR; import static org.jetbrains.kotlin.diagnostics.Severity.WARNING; public interface ErrorsNoArg { DiagnosticFactory0 NO_NOARG_CONSTRUCTOR_IN_SUPERCLASS = DiagnosticFactory0.create(WARNING); + DiagnosticFactory0 NOARG_ON_INNER_CLASS = DiagnosticFactory0.create(WARNING); + DiagnosticFactory0 NOARG_ON_INNER_CLASS_ERROR = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 NOARG_ON_LOCAL_CLASS = DiagnosticFactory0.create(WARNING); + DiagnosticFactory0 NOARG_ON_LOCAL_CLASS_ERROR = DiagnosticFactory0.create(ERROR); @SuppressWarnings("UnusedDeclaration") Object _initializer = new Object() { @@ -31,5 +36,4 @@ public interface ErrorsNoArg { Errors.Initializer.initializeFactoryNamesAndDefaultErrorMessages(ErrorsNoArg.class, DefaultErrorMessagesNoArg.INSTANCE); } }; - } diff --git a/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/DiagnosticsTestForNoArgGenerated.java b/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/DiagnosticsTestForNoArgGenerated.java new file mode 100644 index 00000000000..ed4e047208b --- /dev/null +++ b/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/DiagnosticsTestForNoArgGenerated.java @@ -0,0 +1,40 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.noarg; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("plugins/noarg/noarg-cli/testData/diagnostics") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class DiagnosticsTestForNoArgGenerated extends AbstractDiagnosticsTestForNoArg { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInDiagnostics() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/noarg/noarg-cli/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("innerClass.kt") + public void testInnerClass() throws Exception { + runTest("plugins/noarg/noarg-cli/testData/diagnostics/innerClass.kt"); + } + + @TestMetadata("noNoargCtorInSuperclass.kt") + public void testNoNoargCtorInSuperclass() throws Exception { + runTest("plugins/noarg/noarg-cli/testData/diagnostics/noNoargCtorInSuperclass.kt"); + } +} diff --git a/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/NoArgTests.kt b/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/NoArgTests.kt index 07c557dd2de..577a3e92051 100644 --- a/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/NoArgTests.kt +++ b/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/NoArgTests.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.noarg +import org.jetbrains.kotlin.checkers.AbstractDiagnosticsTest import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment import org.jetbrains.kotlin.codegen.AbstractBlackBoxCodegenTest import org.jetbrains.kotlin.codegen.AbstractBytecodeListingTest @@ -16,6 +17,7 @@ abstract class AbstractBlackBoxCodegenTestForNoArg : AbstractBlackBoxCodegenTest NoArgComponentRegistrar.registerNoArgComponents( myEnvironment.project, NOARG_ANNOTATIONS, + backend.isIR, files.any { it.directives.contains("INVOKE_INITIALIZERS") }, ) @@ -25,6 +27,12 @@ abstract class AbstractBlackBoxCodegenTestForNoArg : AbstractBlackBoxCodegenTest abstract class AbstractBytecodeListingTestForNoArg : AbstractBytecodeListingTest() { override fun setupEnvironment(environment: KotlinCoreEnvironment) { - NoArgComponentRegistrar.registerNoArgComponents(environment.project, NOARG_ANNOTATIONS, false) + NoArgComponentRegistrar.registerNoArgComponents(environment.project, NOARG_ANNOTATIONS, backend.isIR, false) + } +} + +abstract class AbstractDiagnosticsTestForNoArg : AbstractDiagnosticsTest() { + override fun setupEnvironment(environment: KotlinCoreEnvironment) { + NoArgComponentRegistrar.registerNoArgComponents(environment.project, NOARG_ANNOTATIONS, backend.isIR, false) } } diff --git a/plugins/noarg/noarg-cli/testData/diagnostics/innerClass.kt b/plugins/noarg/noarg-cli/testData/diagnostics/innerClass.kt new file mode 100644 index 00000000000..f7bbfb9d26c --- /dev/null +++ b/plugins/noarg/noarg-cli/testData/diagnostics/innerClass.kt @@ -0,0 +1,14 @@ +annotation class NoArg + +class Outer { + @NoArg + inner class Inner(val b: Any) +} + +fun local() { + @NoArg + class Local(val l: Any) { + @NoArg + inner class InnerLocal(val x: Any) + } +} diff --git a/plugins/noarg/noarg-cli/testData/diagnostics/innerClass.txt b/plugins/noarg/noarg-cli/testData/diagnostics/innerClass.txt new file mode 100644 index 00000000000..221183e7ad5 --- /dev/null +++ b/plugins/noarg/noarg-cli/testData/diagnostics/innerClass.txt @@ -0,0 +1,25 @@ +package + +public fun local(): kotlin.Unit + +public final annotation class NoArg : kotlin.Annotation { + public constructor NoArg() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class Outer { + public constructor Outer() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + @NoArg public final inner class Inner { + public constructor Inner(/*0*/ b: kotlin.Any) + public final val b: kotlin.Any + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} diff --git a/plugins/noarg/noarg-cli/testData/diagnostics/noNoargCtorInSuperclass.kt b/plugins/noarg/noarg-cli/testData/diagnostics/noNoargCtorInSuperclass.kt new file mode 100644 index 00000000000..46a160ea2a5 --- /dev/null +++ b/plugins/noarg/noarg-cli/testData/diagnostics/noNoargCtorInSuperclass.kt @@ -0,0 +1,6 @@ +annotation class NoArg + +open class Base(val s: String) + +@NoArg +class Derived(s: String) : Base(s) diff --git a/plugins/noarg/noarg-cli/testData/diagnostics/noNoargCtorInSuperclass.txt b/plugins/noarg/noarg-cli/testData/diagnostics/noNoargCtorInSuperclass.txt new file mode 100644 index 00000000000..b8bdbdabe7a --- /dev/null +++ b/plugins/noarg/noarg-cli/testData/diagnostics/noNoargCtorInSuperclass.txt @@ -0,0 +1,24 @@ +package + +public open class Base { + public constructor Base(/*0*/ s: kotlin.String) + public final val s: kotlin.String + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +@NoArg public final class Derived : Base { + public constructor Derived(/*0*/ s: kotlin.String) + public final override /*1*/ /*fake_override*/ val s: kotlin.String + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final annotation class NoArg : kotlin.Annotation { + public constructor NoArg() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} From 25c228297a6485a2cbc9ca918b678843526508a3 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Wed, 25 Nov 2020 22:23:22 +0100 Subject: [PATCH 452/698] JVM IR: support noarg compiler plugin #KT-41265 Fixed --- .../kotlin/generators/tests/GenerateTests.kt | 22 +-- .../generators/tests/GenerateTests.kt.as41 | 10 +- .../generators/tests/GenerateTests.kt.as42 | 10 +- libraries/tools/kotlin-maven-noarg/pom.xml | 4 + plugins/noarg/noarg-cli/build.gradle.kts | 1 + .../src/NoArgIrGenerationExtension.kt | 146 ++++++++++++++++++ plugins/noarg/noarg-cli/src/NoArgPlugin.kt | 2 + .../BlackBoxCodegenTestForNoArgGenerated.java | 10 ++ .../BytecodeListingTestForNoArgGenerated.java | 15 +- ...rBlackBoxCodegenTestForNoArgGenerated.java | 71 +++++++++ ...rBytecodeListingTestForNoArgGenerated.java | 76 +++++++++ .../org/jetbrains/kotlin/noarg/NoArgTests.kt | 9 ++ .../noarg-cli/testData/box/initializers.kt | 33 ++-- .../initializersWithoutInvokeInitializers.kt | 25 ++- .../testData/box/localClassInInitiailzer.kt | 20 +++ .../noarg-cli/testData/box/nestedClass.kt | 14 ++ .../noarg/noarg-cli/testData/box/simple.kt | 10 +- .../bytecodeListing/constructorVisibility.kt | 10 ++ .../bytecodeListing/constructorVisibility.txt | 29 ++++ .../testData/bytecodeListing/nestedClass.kt | 6 + .../testData/bytecodeListing/nestedClass.txt | 21 +++ 21 files changed, 483 insertions(+), 61 deletions(-) create mode 100644 plugins/noarg/noarg-cli/src/NoArgIrGenerationExtension.kt create mode 100644 plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/IrBlackBoxCodegenTestForNoArgGenerated.java create mode 100644 plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/IrBytecodeListingTestForNoArgGenerated.java create mode 100644 plugins/noarg/noarg-cli/testData/box/localClassInInitiailzer.kt create mode 100644 plugins/noarg/noarg-cli/testData/box/nestedClass.kt create mode 100644 plugins/noarg/noarg-cli/testData/bytecodeListing/constructorVisibility.kt create mode 100644 plugins/noarg/noarg-cli/testData/bytecodeListing/constructorVisibility.txt create mode 100644 plugins/noarg/noarg-cli/testData/bytecodeListing/nestedClass.kt create mode 100644 plugins/noarg/noarg-cli/testData/bytecodeListing/nestedClass.txt diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index cc3c6d9ebd8..b39488b4eb8 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -78,17 +78,17 @@ import org.jetbrains.kotlin.idea.editor.AbstractMultiLineStringIndentTest import org.jetbrains.kotlin.idea.editor.backspaceHandler.AbstractBackspaceHandlerTest import org.jetbrains.kotlin.idea.editor.quickDoc.AbstractQuickDocProviderTest import org.jetbrains.kotlin.idea.filters.AbstractKotlinExceptionFilterTest -import org.jetbrains.kotlin.idea.fir.low.level.api.AbstractFirLazyResolveTest -import org.jetbrains.kotlin.idea.fir.low.level.api.AbstractFirMultiModuleResolveTest import org.jetbrains.kotlin.idea.fir.AbstractKtDeclarationAndFirDeclarationEqualityChecker import org.jetbrains.kotlin.idea.fir.low.level.api.AbstractFirLazyDeclarationResolveTest +import org.jetbrains.kotlin.idea.fir.low.level.api.AbstractFirLazyResolveTest import org.jetbrains.kotlin.idea.fir.low.level.api.AbstractFirMultiModuleLazyResolveTest -import org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.AbstractFileStructureTest +import org.jetbrains.kotlin.idea.fir.low.level.api.AbstractFirMultiModuleResolveTest import org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.AbstractFileStructureAndOutOfBlockModificationTrackerConsistencyTest +import org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.AbstractFileStructureTest import org.jetbrains.kotlin.idea.fir.low.level.api.sessions.AbstractSessionsInvalidationTest +import org.jetbrains.kotlin.idea.fir.low.level.api.trackers.AbstractProjectWideOutOfBlockKotlinModificationTrackerTest import org.jetbrains.kotlin.idea.folding.AbstractKotlinFoldingTest import org.jetbrains.kotlin.idea.frontend.api.fir.AbstractResolveCallTest -import org.jetbrains.kotlin.idea.fir.low.level.api.trackers.AbstractProjectWideOutOfBlockKotlinModificationTrackerTest import org.jetbrains.kotlin.idea.frontend.api.scopes.AbstractMemberScopeByFqNameTest import org.jetbrains.kotlin.idea.frontend.api.symbols.* import org.jetbrains.kotlin.idea.hierarchy.AbstractHierarchyTest @@ -167,12 +167,12 @@ import org.jetbrains.kotlin.nj2k.inference.common.AbstractCommonConstraintCollec import org.jetbrains.kotlin.nj2k.inference.mutability.AbstractMutabilityInferenceTest import org.jetbrains.kotlin.nj2k.inference.nullability.AbstractNullabilityInferenceTest import org.jetbrains.kotlin.noarg.* +import org.jetbrains.kotlin.pacelize.ide.test.AbstractParcelizeCheckerTest +import org.jetbrains.kotlin.pacelize.ide.test.AbstractParcelizeQuickFixTest import org.jetbrains.kotlin.parcelize.test.AbstractParcelizeBoxTest import org.jetbrains.kotlin.parcelize.test.AbstractParcelizeBytecodeListingTest import org.jetbrains.kotlin.parcelize.test.AbstractParcelizeIrBoxTest import org.jetbrains.kotlin.parcelize.test.AbstractParcelizeIrBytecodeListingTest -import org.jetbrains.kotlin.pacelize.ide.test.AbstractParcelizeCheckerTest -import org.jetbrains.kotlin.pacelize.ide.test.AbstractParcelizeQuickFixTest import org.jetbrains.kotlin.psi.patternMatching.AbstractPsiUnifierTest import org.jetbrains.kotlin.samWithReceiver.AbstractSamWithReceiverScriptTest import org.jetbrains.kotlin.samWithReceiver.AbstractSamWithReceiverTest @@ -1666,12 +1666,14 @@ fun main(args: Array) { testClass { model("diagnostics", extension = "kt") } testClass { - model("bytecodeListing", extension = "kt") + model("bytecodeListing", extension = "kt", targetBackend = TargetBackend.JVM) + } + testClass { + model("bytecodeListing", extension = "kt", targetBackend = TargetBackend.JVM_IR) } - testClass { - model("box", targetBackend = TargetBackend.JVM) - } + testClass { model("box", targetBackend = TargetBackend.JVM) } + testClass { model("box", targetBackend = TargetBackend.JVM_IR) } } testGroup("plugins/sam-with-receiver/sam-with-receiver-cli/test", "plugins/sam-with-receiver/sam-with-receiver-cli/testData") { diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as41 b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as41 index dbcad1d5ecc..12c50084cc5 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as41 +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as41 @@ -1190,12 +1190,14 @@ fun main(args: Array) { testClass { model("diagnostics", extension = "kt") } testClass { - model("bytecodeListing", extension = "kt") + model("bytecodeListing", extension = "kt", targetBackend = TargetBackend.JVM) + } + testClass { + model("bytecodeListing", extension = "kt", targetBackend = TargetBackend.JVM_IR) } - testClass { - model("box", targetBackend = TargetBackend.JVM) - } + testClass { model("box", targetBackend = TargetBackend.JVM) } + testClass { model("box", targetBackend = TargetBackend.JVM_IR) } } testGroup("plugins/sam-with-receiver/sam-with-receiver-cli/test", "plugins/sam-with-receiver/sam-with-receiver-cli/testData") { diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as42 b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as42 index 5ce7e754ae1..d4d273fb092 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as42 +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as42 @@ -1114,12 +1114,14 @@ fun main(args: Array) { testClass { model("diagnostics", extension = "kt") } testClass { - model("bytecodeListing", extension = "kt") + model("bytecodeListing", extension = "kt", targetBackend = TargetBackend.JVM) + } + testClass { + model("bytecodeListing", extension = "kt", targetBackend = TargetBackend.JVM_IR) } - testClass { - model("box", targetBackend = TargetBackend.JVM) - } + testClass { model("box", targetBackend = TargetBackend.JVM) } + testClass { model("box", targetBackend = TargetBackend.JVM_IR) } } testGroup("plugins/sam-with-receiver/sam-with-receiver-cli/test", "plugins/sam-with-receiver/sam-with-receiver-cli/testData") { diff --git a/libraries/tools/kotlin-maven-noarg/pom.xml b/libraries/tools/kotlin-maven-noarg/pom.xml index 0bce2bff702..0a90a533b46 100755 --- a/libraries/tools/kotlin-maven-noarg/pom.xml +++ b/libraries/tools/kotlin-maven-noarg/pom.xml @@ -72,6 +72,10 @@ compile + + + 1.8 + org.apache.maven.plugins diff --git a/plugins/noarg/noarg-cli/build.gradle.kts b/plugins/noarg/noarg-cli/build.gradle.kts index 9a726bc7971..fdbbc6c6148 100644 --- a/plugins/noarg/noarg-cli/build.gradle.kts +++ b/plugins/noarg/noarg-cli/build.gradle.kts @@ -12,6 +12,7 @@ dependencies { compileOnly(project(":compiler:backend")) compileOnly(project(":compiler:util")) compileOnly(project(":compiler:plugin-api")) + compileOnly(project(":compiler:ir.backend.common")) compileOnly(intellijCoreDep()) { includeJars("intellij-core") } compileOnly(intellijDep()) { includeJars("asm-all", rootProject = rootProject) } runtime(kotlinStdlib()) diff --git a/plugins/noarg/noarg-cli/src/NoArgIrGenerationExtension.kt b/plugins/noarg/noarg-cli/src/NoArgIrGenerationExtension.kt new file mode 100644 index 00000000000..52749df33b1 --- /dev/null +++ b/plugins/noarg/noarg-cli/src/NoArgIrGenerationExtension.kt @@ -0,0 +1,146 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.noarg + +import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension +import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext +import org.jetbrains.kotlin.backend.common.lower.SYNTHESIZED_INIT_BLOCK +import org.jetbrains.kotlin.descriptors.ClassKind +import org.jetbrains.kotlin.extensions.AnnotationBasedExtension +import org.jetbrains.kotlin.ir.IrElement +import org.jetbrains.kotlin.ir.IrStatement +import org.jetbrains.kotlin.ir.builders.declarations.buildConstructor +import org.jetbrains.kotlin.ir.declarations.* +import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns +import org.jetbrains.kotlin.ir.descriptors.toIrBasedDescriptor +import org.jetbrains.kotlin.ir.expressions.IrBlock +import org.jetbrains.kotlin.ir.expressions.IrGetValue +import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin +import org.jetbrains.kotlin.ir.expressions.impl.IrBlockImpl +import org.jetbrains.kotlin.ir.expressions.impl.IrDelegatingConstructorCallImpl +import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl +import org.jetbrains.kotlin.ir.expressions.impl.IrSetFieldImpl +import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.types.getClass +import org.jetbrains.kotlin.ir.util.* +import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid +import org.jetbrains.kotlin.psi.KtModifierListOwner +import org.jetbrains.kotlin.resolve.jvm.annotations.JVM_OVERLOADS_FQ_NAME +import org.jetbrains.kotlin.utils.addToStdlib.safeAs + +internal class NoArgIrGenerationExtension( + private val annotations: List, + private val invokeInitializers: Boolean, +) : IrGenerationExtension { + override fun generate(moduleFragment: IrModuleFragment, pluginContext: IrPluginContext) { + moduleFragment.accept(NoArgIrTransformer(pluginContext, annotations, invokeInitializers), null) + } +} + +private class NoArgIrTransformer( + private val context: IrPluginContext, + private val annotations: List, + private val invokeInitializers: Boolean, +) : AnnotationBasedExtension, IrElementVisitorVoid { + override fun getAnnotationFqNames(modifierListOwner: KtModifierListOwner?): List = annotations + + override fun visitElement(element: IrElement) { + element.acceptChildren(this, null) + } + + override fun visitClass(declaration: IrClass) { + super.visitClass(declaration) + + if (declaration.kind == ClassKind.CLASS && + declaration.isAnnotatedWithNoarg() && + declaration.constructors.none(::isZeroParameterConstructor) + ) { + declaration.declarations.add(getOrGenerateNoArgConstructor(declaration)) + } + } + + private val noArgConstructors = mutableMapOf() + + private fun getOrGenerateNoArgConstructor(klass: IrClass): IrConstructor = noArgConstructors.getOrPut(klass) { + val superClass = + klass.superTypes.mapNotNull(IrType::getClass).singleOrNull { it.kind == ClassKind.CLASS } + ?: context.irBuiltIns.anyClass.owner + + val superConstructor = + if (superClass.isAnnotatedWithNoarg()) + getOrGenerateNoArgConstructor(superClass) + else superClass.constructors.singleOrNull { it.valueParameters.isEmpty() } + ?: error("No noarg super constructor for ${klass.render()}:\n" + superClass.constructors.joinToString("\n") { it.render() }) + + context.irFactory.buildConstructor { + returnType = klass.defaultType + }.also { ctor -> + ctor.parent = klass + ctor.body = context.irFactory.createBlockBody( + ctor.startOffset, ctor.endOffset, + listOfNotNull( + IrDelegatingConstructorCallImpl( + ctor.startOffset, ctor.endOffset, context.irBuiltIns.unitType, + superConstructor.symbol, 0, superConstructor.valueParameters.size + ), + if (invokeInitializers) + NoArgInitializersLowering(context.irBuiltIns).createInitializersBlock(ctor) + else null + ) + ) + } + } + + private fun IrClass.isAnnotatedWithNoarg(): Boolean = + toIrBasedDescriptor().hasSpecialAnnotation(null) + + private fun isZeroParameterConstructor(constructor: IrConstructor): Boolean { + val parameters = constructor.valueParameters + return parameters.isEmpty() || + (parameters.all { it.defaultValue != null } && (constructor.isPrimary || constructor.hasAnnotation(JVM_OVERLOADS_FQ_NAME))) + } +} + +/** Main parts copied from [org.jetbrains.kotlin.backend.common.lower.InitializersLowering]. */ +private class NoArgInitializersLowering(private val builtIns: IrBuiltIns) { + fun createInitializersBlock(ctor: IrConstructor): IrBlock { + val irClass = ctor.constructedClass + return IrBlockImpl(irClass.startOffset, irClass.endOffset, builtIns.unitType, null, extractInitializers(irClass)) + .deepCopyWithSymbols(ctor) + } + + private fun extractInitializers(irClass: IrClass): List { + val result = mutableListOf() + for (declaration in irClass.declarations) { + when (declaration) { + is IrAnonymousInitializer -> if (!declaration.isStatic) { + result.add(with(declaration) { + IrBlockImpl(startOffset, endOffset, builtIns.unitType, SYNTHESIZED_INIT_BLOCK, body.statements) + }) + } + is IrProperty -> declaration.backingField.let { field -> + if (field != null && !field.isStatic) { + val initializer = field.initializer + // Take all field initializers except those for properties in the primary constructor, for which we have no values + // in the noarg constructor (and thus those properties will be uninitialized). + if (initializer != null && initializer.expression.safeAs()?.origin != + IrStatementOrigin.INITIALIZE_PROPERTY_FROM_PARAMETER + ) { + result.add(with(initializer) { + IrSetFieldImpl( + startOffset, endOffset, field.symbol, + IrGetValueImpl(startOffset, endOffset, irClass.thisReceiver!!.type, irClass.thisReceiver!!.symbol), + expression, builtIns.unitType, IrStatementOrigin.INITIALIZE_FIELD + ) + }) + } + } + } + } + } + return result + } +} diff --git a/plugins/noarg/noarg-cli/src/NoArgPlugin.kt b/plugins/noarg/noarg-cli/src/NoArgPlugin.kt index 547bc853155..158341fcea6 100644 --- a/plugins/noarg/noarg-cli/src/NoArgPlugin.kt +++ b/plugins/noarg/noarg-cli/src/NoArgPlugin.kt @@ -18,6 +18,7 @@ package org.jetbrains.kotlin.noarg import com.intellij.mock.MockProject import com.intellij.openapi.project.Project +import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension import org.jetbrains.kotlin.codegen.extensions.ExpressionCodegenExtension import org.jetbrains.kotlin.compiler.plugin.* import org.jetbrains.kotlin.config.CompilerConfiguration @@ -99,6 +100,7 @@ class NoArgComponentRegistrar : ComponentRegistrar { fun registerNoArgComponents(project: Project, annotations: List, useIr: Boolean, invokeInitializers: Boolean) { StorageComponentContainerContributor.registerExtension(project, CliNoArgComponentContainerContributor(annotations, useIr)) ExpressionCodegenExtension.registerExtension(project, CliNoArgExpressionCodegenExtension(annotations, invokeInitializers)) + IrGenerationExtension.registerExtension(project, NoArgIrGenerationExtension(annotations, invokeInitializers)) } } } diff --git a/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/BlackBoxCodegenTestForNoArgGenerated.java b/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/BlackBoxCodegenTestForNoArgGenerated.java index 4d61a9ea701..b4994ab197e 100644 --- a/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/BlackBoxCodegenTestForNoArgGenerated.java +++ b/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/BlackBoxCodegenTestForNoArgGenerated.java @@ -54,6 +54,16 @@ public class BlackBoxCodegenTestForNoArgGenerated extends AbstractBlackBoxCodege runTest("plugins/noarg/noarg-cli/testData/box/kt18668.kt"); } + @TestMetadata("localClassInInitiailzer.kt") + public void testLocalClassInInitiailzer() throws Exception { + runTest("plugins/noarg/noarg-cli/testData/box/localClassInInitiailzer.kt"); + } + + @TestMetadata("nestedClass.kt") + public void testNestedClass() throws Exception { + runTest("plugins/noarg/noarg-cli/testData/box/nestedClass.kt"); + } + @TestMetadata("simple.kt") public void testSimple() throws Exception { runTest("plugins/noarg/noarg-cli/testData/box/simple.kt"); diff --git a/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/BytecodeListingTestForNoArgGenerated.java b/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/BytecodeListingTestForNoArgGenerated.java index 3baf5f9f72b..87e919a2586 100644 --- a/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/BytecodeListingTestForNoArgGenerated.java +++ b/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/BytecodeListingTestForNoArgGenerated.java @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.noarg; import com.intellij.testFramework.TestDataPath; import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TargetBackend; import org.jetbrains.kotlin.test.TestMetadata; import org.junit.runner.RunWith; @@ -21,11 +22,11 @@ import java.util.regex.Pattern; @RunWith(JUnit3RunnerWithInners.class) public class BytecodeListingTestForNoArgGenerated extends AbstractBytecodeListingTestForNoArg { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } public void testAllFilesPresentInBytecodeListing() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/noarg/noarg-cli/testData/bytecodeListing"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/noarg/noarg-cli/testData/bytecodeListing"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("annoOnNotClass.kt") @@ -33,6 +34,11 @@ public class BytecodeListingTestForNoArgGenerated extends AbstractBytecodeListin runTest("plugins/noarg/noarg-cli/testData/bytecodeListing/annoOnNotClass.kt"); } + @TestMetadata("constructorVisibility.kt") + public void testConstructorVisibility() throws Exception { + runTest("plugins/noarg/noarg-cli/testData/bytecodeListing/constructorVisibility.kt"); + } + @TestMetadata("defaultParameters.kt") public void testDefaultParameters() throws Exception { runTest("plugins/noarg/noarg-cli/testData/bytecodeListing/defaultParameters.kt"); @@ -43,6 +49,11 @@ public class BytecodeListingTestForNoArgGenerated extends AbstractBytecodeListin runTest("plugins/noarg/noarg-cli/testData/bytecodeListing/inherited.kt"); } + @TestMetadata("nestedClass.kt") + public void testNestedClass() throws Exception { + runTest("plugins/noarg/noarg-cli/testData/bytecodeListing/nestedClass.kt"); + } + @TestMetadata("noNoArg.kt") public void testNoNoArg() throws Exception { runTest("plugins/noarg/noarg-cli/testData/bytecodeListing/noNoArg.kt"); diff --git a/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/IrBlackBoxCodegenTestForNoArgGenerated.java b/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/IrBlackBoxCodegenTestForNoArgGenerated.java new file mode 100644 index 00000000000..ebb0e88b286 --- /dev/null +++ b/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/IrBlackBoxCodegenTestForNoArgGenerated.java @@ -0,0 +1,71 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.noarg; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TargetBackend; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("plugins/noarg/noarg-cli/testData/box") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class IrBlackBoxCodegenTestForNoArgGenerated extends AbstractIrBlackBoxCodegenTestForNoArg { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInBox() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/noarg/noarg-cli/testData/box"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("initializers.kt") + public void testInitializers() throws Exception { + runTest("plugins/noarg/noarg-cli/testData/box/initializers.kt"); + } + + @TestMetadata("initializersWithoutInvokeInitializers.kt") + public void testInitializersWithoutInvokeInitializers() throws Exception { + runTest("plugins/noarg/noarg-cli/testData/box/initializersWithoutInvokeInitializers.kt"); + } + + @TestMetadata("kt18245.kt") + public void testKt18245() throws Exception { + runTest("plugins/noarg/noarg-cli/testData/box/kt18245.kt"); + } + + @TestMetadata("kt18667.kt") + public void testKt18667() throws Exception { + runTest("plugins/noarg/noarg-cli/testData/box/kt18667.kt"); + } + + @TestMetadata("kt18668.kt") + public void testKt18668() throws Exception { + runTest("plugins/noarg/noarg-cli/testData/box/kt18668.kt"); + } + + @TestMetadata("localClassInInitiailzer.kt") + public void testLocalClassInInitiailzer() throws Exception { + runTest("plugins/noarg/noarg-cli/testData/box/localClassInInitiailzer.kt"); + } + + @TestMetadata("nestedClass.kt") + public void testNestedClass() throws Exception { + runTest("plugins/noarg/noarg-cli/testData/box/nestedClass.kt"); + } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("plugins/noarg/noarg-cli/testData/box/simple.kt"); + } +} diff --git a/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/IrBytecodeListingTestForNoArgGenerated.java b/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/IrBytecodeListingTestForNoArgGenerated.java new file mode 100644 index 00000000000..af7c70a19ff --- /dev/null +++ b/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/IrBytecodeListingTestForNoArgGenerated.java @@ -0,0 +1,76 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.noarg; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TargetBackend; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("plugins/noarg/noarg-cli/testData/bytecodeListing") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class IrBytecodeListingTestForNoArgGenerated extends AbstractIrBytecodeListingTestForNoArg { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInBytecodeListing() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/noarg/noarg-cli/testData/bytecodeListing"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("annoOnNotClass.kt") + public void testAnnoOnNotClass() throws Exception { + runTest("plugins/noarg/noarg-cli/testData/bytecodeListing/annoOnNotClass.kt"); + } + + @TestMetadata("constructorVisibility.kt") + public void testConstructorVisibility() throws Exception { + runTest("plugins/noarg/noarg-cli/testData/bytecodeListing/constructorVisibility.kt"); + } + + @TestMetadata("defaultParameters.kt") + public void testDefaultParameters() throws Exception { + runTest("plugins/noarg/noarg-cli/testData/bytecodeListing/defaultParameters.kt"); + } + + @TestMetadata("inherited.kt") + public void testInherited() throws Exception { + runTest("plugins/noarg/noarg-cli/testData/bytecodeListing/inherited.kt"); + } + + @TestMetadata("nestedClass.kt") + public void testNestedClass() throws Exception { + runTest("plugins/noarg/noarg-cli/testData/bytecodeListing/nestedClass.kt"); + } + + @TestMetadata("noNoArg.kt") + public void testNoNoArg() throws Exception { + runTest("plugins/noarg/noarg-cli/testData/bytecodeListing/noNoArg.kt"); + } + + @TestMetadata("severalNoArg.kt") + public void testSeveralNoArg() throws Exception { + runTest("plugins/noarg/noarg-cli/testData/bytecodeListing/severalNoArg.kt"); + } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("plugins/noarg/noarg-cli/testData/bytecodeListing/simple.kt"); + } + + @TestMetadata("superTypes.kt") + public void testSuperTypes() throws Exception { + runTest("plugins/noarg/noarg-cli/testData/bytecodeListing/superTypes.kt"); + } +} diff --git a/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/NoArgTests.kt b/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/NoArgTests.kt index 577a3e92051..bf9ab0512e0 100644 --- a/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/NoArgTests.kt +++ b/plugins/noarg/noarg-cli/test/org/jetbrains/kotlin/noarg/NoArgTests.kt @@ -9,6 +9,7 @@ import org.jetbrains.kotlin.checkers.AbstractDiagnosticsTest import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment import org.jetbrains.kotlin.codegen.AbstractBlackBoxCodegenTest import org.jetbrains.kotlin.codegen.AbstractBytecodeListingTest +import org.jetbrains.kotlin.test.TargetBackend internal val NOARG_ANNOTATIONS = listOf("NoArg", "NoArg2", "test.NoArg") @@ -31,6 +32,14 @@ abstract class AbstractBytecodeListingTestForNoArg : AbstractBytecodeListingTest } } +abstract class AbstractIrBlackBoxCodegenTestForNoArg : AbstractBlackBoxCodegenTestForNoArg() { + override val backend: TargetBackend get() = TargetBackend.JVM_IR +} + +abstract class AbstractIrBytecodeListingTestForNoArg : AbstractBytecodeListingTestForNoArg() { + override val backend: TargetBackend get() = TargetBackend.JVM_IR +} + abstract class AbstractDiagnosticsTestForNoArg : AbstractDiagnosticsTest() { override fun setupEnvironment(environment: KotlinCoreEnvironment) { NoArgComponentRegistrar.registerNoArgComponents(environment.project, NOARG_ANNOTATIONS, backend.isIR, false) diff --git a/plugins/noarg/noarg-cli/testData/box/initializers.kt b/plugins/noarg/noarg-cli/testData/box/initializers.kt index 1702d879368..0b6ec798501 100644 --- a/plugins/noarg/noarg-cli/testData/box/initializers.kt +++ b/plugins/noarg/noarg-cli/testData/box/initializers.kt @@ -13,24 +13,19 @@ class Test(val a: String) { } fun box(): String { - try { - val test = Test::class.java.newInstance() + val test = Test::class.java.newInstance() - if (test.x != 5) { - return "Bad 5" - } - - if (test.y == null || test.y.a != "Hello, world!") { - return "Bad Hello, world!" - } - - if (test.z != "TEST") { - return "Bad TEST" - } - - return "OK" - } catch (e: Throwable) { - e.printStackTrace() - return "Fail" + if (test.x != 5) { + return "Bad 5" } -} \ No newline at end of file + + if (test.y == null || test.y.a != "Hello, world!") { + return "Bad Hello, world!" + } + + if (test.z != "TEST") { + return "Bad TEST" + } + + return "OK" +} diff --git a/plugins/noarg/noarg-cli/testData/box/initializersWithoutInvokeInitializers.kt b/plugins/noarg/noarg-cli/testData/box/initializersWithoutInvokeInitializers.kt index 6048cbbfa9a..aacf8628295 100644 --- a/plugins/noarg/noarg-cli/testData/box/initializersWithoutInvokeInitializers.kt +++ b/plugins/noarg/noarg-cli/testData/box/initializersWithoutInvokeInitializers.kt @@ -11,20 +11,15 @@ class Test(val a: String) { } fun box(): String { - try { - val test = Test::class.java.newInstance() + val test = Test::class.java.newInstance() - if (test.x != 0) { - return "Bad 5" - } - - if (test.y != null) { - return "Bad Hello, world!" - } - - return "OK" - } catch (e: Throwable) { - e.printStackTrace() - return "Fail" + if (test.x != 0) { + return "Bad 5" } -} \ No newline at end of file + + if (test.y != null) { + return "Bad Hello, world!" + } + + return "OK" +} diff --git a/plugins/noarg/noarg-cli/testData/box/localClassInInitiailzer.kt b/plugins/noarg/noarg-cli/testData/box/localClassInInitiailzer.kt new file mode 100644 index 00000000000..460fc0f1760 --- /dev/null +++ b/plugins/noarg/noarg-cli/testData/box/localClassInInitiailzer.kt @@ -0,0 +1,20 @@ +// WITH_RUNTIME +// INVOKE_INITIALIZERS + +annotation class NoArg + +@NoArg +class Test(val a: String) { + val lc = run { + class Local(val result: String) + Local("OK").result + } + + val obj = object { val result = "OK" }.result +} + +fun box(): String { + val t = Test::class.java.newInstance() + if (t.lc != "OK") return "Fail 1" + return t.obj +} diff --git a/plugins/noarg/noarg-cli/testData/box/nestedClass.kt b/plugins/noarg/noarg-cli/testData/box/nestedClass.kt new file mode 100644 index 00000000000..4e8c85b5707 --- /dev/null +++ b/plugins/noarg/noarg-cli/testData/box/nestedClass.kt @@ -0,0 +1,14 @@ +// WITH_RUNTIME + +annotation class NoArg + +class Outer { + @NoArg + class Nested(val a: String) +} + +fun box(): String { + Outer.Nested::class.java.newInstance() + + return "OK" +} diff --git a/plugins/noarg/noarg-cli/testData/box/simple.kt b/plugins/noarg/noarg-cli/testData/box/simple.kt index 8a4915bbba9..bd63a48d691 100644 --- a/plugins/noarg/noarg-cli/testData/box/simple.kt +++ b/plugins/noarg/noarg-cli/testData/box/simple.kt @@ -6,10 +6,6 @@ annotation class NoArg class Test(val a: String) fun box(): String { - try { - Test::class.java.newInstance() - return "OK" - } catch (_: Throwable) { - return "Fail" - } -} \ No newline at end of file + Test::class.java.newInstance() + return "OK" +} diff --git a/plugins/noarg/noarg-cli/testData/bytecodeListing/constructorVisibility.kt b/plugins/noarg/noarg-cli/testData/bytecodeListing/constructorVisibility.kt new file mode 100644 index 00000000000..be8b261e212 --- /dev/null +++ b/plugins/noarg/noarg-cli/testData/bytecodeListing/constructorVisibility.kt @@ -0,0 +1,10 @@ +annotation class NoArg + +@NoArg +class Internal internal constructor(z: Boolean) + +@NoArg +abstract class Protected protected constructor(c: Char) + +@NoArg +class Private private constructor(ia: IntArray) diff --git a/plugins/noarg/noarg-cli/testData/bytecodeListing/constructorVisibility.txt b/plugins/noarg/noarg-cli/testData/bytecodeListing/constructorVisibility.txt new file mode 100644 index 00000000000..4ad1088a004 --- /dev/null +++ b/plugins/noarg/noarg-cli/testData/bytecodeListing/constructorVisibility.txt @@ -0,0 +1,29 @@ +@NoArg +@kotlin.Metadata +public final class Internal { + // source: 'constructorVisibility.kt' + public method (): void + public method (p0: boolean): void +} + +@java.lang.annotation.Retention +@kotlin.Metadata +public annotation class NoArg { + // source: 'constructorVisibility.kt' +} + +@NoArg +@kotlin.Metadata +public final class Private { + // source: 'constructorVisibility.kt' + public method (): void + private method (p0: int[]): void +} + +@NoArg +@kotlin.Metadata +public abstract class Protected { + // source: 'constructorVisibility.kt' + public method (): void + protected method (p0: char): void +} diff --git a/plugins/noarg/noarg-cli/testData/bytecodeListing/nestedClass.kt b/plugins/noarg/noarg-cli/testData/bytecodeListing/nestedClass.kt new file mode 100644 index 00000000000..47ec1f37fc9 --- /dev/null +++ b/plugins/noarg/noarg-cli/testData/bytecodeListing/nestedClass.kt @@ -0,0 +1,6 @@ +annotation class NoArg + +class Outer { + @NoArg + class Nested(a: Long) +} diff --git a/plugins/noarg/noarg-cli/testData/bytecodeListing/nestedClass.txt b/plugins/noarg/noarg-cli/testData/bytecodeListing/nestedClass.txt new file mode 100644 index 00000000000..75f43398ee4 --- /dev/null +++ b/plugins/noarg/noarg-cli/testData/bytecodeListing/nestedClass.txt @@ -0,0 +1,21 @@ +@java.lang.annotation.Retention +@kotlin.Metadata +public annotation class NoArg { + // source: 'nestedClass.kt' +} + +@NoArg +@kotlin.Metadata +public final class Outer$Nested { + // source: 'nestedClass.kt' + public method (): void + public method (p0: long): void + public final inner class Outer$Nested +} + +@kotlin.Metadata +public final class Outer { + // source: 'nestedClass.kt' + public method (): void + public final inner class Outer$Nested +} From 69be56d04249c02ed864a1b2525becf041430d4b Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Fri, 4 Dec 2020 11:02:52 +0100 Subject: [PATCH 453/698] Value classes: Forbid cloneable value classes #KT-43741 Fixed --- .../jetbrains/kotlin/diagnostics/Errors.java | 1 + .../rendering/DefaultErrorMessages.java | 1 + .../checkers/InlineClassDeclarationChecker.kt | 15 +++ .../valueClasses/cloneable.fir.kt | 31 ++++++ .../valueClasses/cloneable.fir.txt | 95 +++++++++++++++++++ .../valueClasses/cloneable.kt | 31 ++++++ .../valueClasses/cloneable.txt | 95 +++++++++++++++++++ ...gnosticsTestWithJvmIrBackendGenerated.java | 23 +++++ ...nosticsTestWithOldJvmBackendGenerated.java | 23 +++++ 9 files changed, 315 insertions(+) create mode 100644 compiler/testData/diagnostics/testsWithJvmBackend/valueClasses/cloneable.fir.kt create mode 100644 compiler/testData/diagnostics/testsWithJvmBackend/valueClasses/cloneable.fir.txt create mode 100644 compiler/testData/diagnostics/testsWithJvmBackend/valueClasses/cloneable.kt create mode 100644 compiler/testData/diagnostics/testsWithJvmBackend/valueClasses/cloneable.txt diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index 23bb2e07731..543094cba25 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -364,6 +364,7 @@ public interface Errors { DiagnosticFactory1 RESERVED_MEMBER_INSIDE_INLINE_CLASS = DiagnosticFactory1.create(ERROR); DiagnosticFactory0 SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 INNER_CLASS_INSIDE_INLINE_CLASS = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 VALUE_CLASS_CANNOT_BE_CLONEABLE = DiagnosticFactory0.create(ERROR); // Result class diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index 997874e2a62..119c9b782c9 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -719,6 +719,7 @@ public class DefaultErrorMessages { MAP.put(RESERVED_MEMBER_INSIDE_INLINE_CLASS, "Member with the name ''{0}'' is reserved for future releases", STRING); MAP.put(SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS, "Secondary constructors with bodies are reserved for for future releases"); MAP.put(INNER_CLASS_INSIDE_INLINE_CLASS, "Inline class cannot have inner classes"); + MAP.put(VALUE_CLASS_CANNOT_BE_CLONEABLE, "Value class cannot be Cloneable"); MAP.put(RESULT_CLASS_IN_RETURN_TYPE, "'kotlin.Result' cannot be used as a return type"); MAP.put(RESULT_CLASS_WITH_NULLABLE_OPERATOR, "Expression of type 'kotlin.Result' cannot be used as a left operand of ''{0}''", STRING); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt index e17df9f33b1..b122fefe91b 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt @@ -6,18 +6,26 @@ package org.jetbrains.kotlin.resolve.checkers import org.jetbrains.kotlin.builtins.KotlinBuiltIns +import org.jetbrains.kotlin.builtins.StandardNames import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.diagnostics.Errors import org.jetbrains.kotlin.lexer.KtTokens +import org.jetbrains.kotlin.name.FqNameUnsafe import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.modalityModifier import org.jetbrains.kotlin.resolve.* +import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe +import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe +import org.jetbrains.kotlin.resolve.descriptorUtil.getAllSuperClassifiers +import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperInterfaces import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.typeUtil.isNothing import org.jetbrains.kotlin.types.typeUtil.isTypeParameter import org.jetbrains.kotlin.types.typeUtil.isUnit import org.jetbrains.kotlin.utils.addToStdlib.safeAs +private val javaLangCloneable = FqNameUnsafe("java.lang.Cloneable") + object InlineClassDeclarationChecker : DeclarationChecker { override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) { if (declaration !is KtClass) return @@ -87,6 +95,13 @@ object InlineClassDeclarationChecker : DeclarationChecker { } } } + + if (descriptor.getAllSuperClassifiers().any { + it.fqNameUnsafe == StandardNames.FqNames.cloneable || it.fqNameUnsafe == javaLangCloneable } + ) { + trace.report(Errors.VALUE_CLASS_CANNOT_BE_CLONEABLE.on(inlineOrValueKeyword)) + return + } } private fun KotlinType.isInapplicableParameterType() = diff --git a/compiler/testData/diagnostics/testsWithJvmBackend/valueClasses/cloneable.fir.kt b/compiler/testData/diagnostics/testsWithJvmBackend/valueClasses/cloneable.fir.kt new file mode 100644 index 00000000000..fc93e2f2698 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJvmBackend/valueClasses/cloneable.fir.kt @@ -0,0 +1,31 @@ +// !LANGUAGE: +InlineClasses +// !DIAGNOSTICS: -UNUSED_PARAMETER, -PLATFORM_CLASS_MAPPED_TO_KOTLIN +// WITH_RUNTIME + +package kotlin.jvm + +annotation class JvmInline + +inline class IC0(val a: Any): Cloneable + +@JvmInline +value class VC0(val a: Any): Cloneable + +inline class IC1(val a: Any): java.lang.Cloneable + +@JvmInline +value class VC1(val a: Any): java.lang.Cloneable + +interface MyCloneable1: Cloneable + +inline class IC2(val a: Any): MyCloneable1 + +@JvmInline +value class VC2(val a: Any): MyCloneable1 + +interface MyCloneable2: java.lang.Cloneable + +inline class IC3(val a: Any): MyCloneable2 + +@JvmInline +value class VC3(val a: Any): MyCloneable2 \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJvmBackend/valueClasses/cloneable.fir.txt b/compiler/testData/diagnostics/testsWithJvmBackend/valueClasses/cloneable.fir.txt new file mode 100644 index 00000000000..e854a208261 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJvmBackend/valueClasses/cloneable.fir.txt @@ -0,0 +1,95 @@ +package + +package kotlin { + + package kotlin.jvm { + + public final inline class IC0 : kotlin.Cloneable { + public constructor IC0(/*0*/ a: kotlin.Any) + public final val a: kotlin.Any + protected open override /*1*/ /*fake_override*/ fun clone(): kotlin.Any + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final inline class IC1 : java.lang.Cloneable { + public constructor IC1(/*0*/ a: kotlin.Any) + public final val a: kotlin.Any + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final inline class IC2 : kotlin.jvm.MyCloneable1 { + public constructor IC2(/*0*/ a: kotlin.Any) + public final val a: kotlin.Any + protected open override /*1*/ /*fake_override*/ fun clone(): kotlin.Any + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final inline class IC3 : kotlin.jvm.MyCloneable2 { + public constructor IC3(/*0*/ a: kotlin.Any) + public final val a: kotlin.Any + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public interface MyCloneable1 : kotlin.Cloneable { + protected open override /*1*/ /*fake_override*/ fun clone(): kotlin.Any + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public interface MyCloneable2 : java.lang.Cloneable { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class VC0 : kotlin.Cloneable { + public constructor VC0(/*0*/ a: kotlin.Any) + public final val a: kotlin.Any + protected open override /*1*/ /*fake_override*/ fun clone(): kotlin.Any + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class VC1 : java.lang.Cloneable { + public constructor VC1(/*0*/ a: kotlin.Any) + public final val a: kotlin.Any + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class VC2 : kotlin.jvm.MyCloneable1 { + public constructor VC2(/*0*/ a: kotlin.Any) + public final val a: kotlin.Any + protected open override /*1*/ /*fake_override*/ fun clone(): kotlin.Any + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class VC3 : kotlin.jvm.MyCloneable2 { + public constructor VC3(/*0*/ a: kotlin.Any) + public final val a: kotlin.Any + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + } +} diff --git a/compiler/testData/diagnostics/testsWithJvmBackend/valueClasses/cloneable.kt b/compiler/testData/diagnostics/testsWithJvmBackend/valueClasses/cloneable.kt new file mode 100644 index 00000000000..fc93e2f2698 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJvmBackend/valueClasses/cloneable.kt @@ -0,0 +1,31 @@ +// !LANGUAGE: +InlineClasses +// !DIAGNOSTICS: -UNUSED_PARAMETER, -PLATFORM_CLASS_MAPPED_TO_KOTLIN +// WITH_RUNTIME + +package kotlin.jvm + +annotation class JvmInline + +inline class IC0(val a: Any): Cloneable + +@JvmInline +value class VC0(val a: Any): Cloneable + +inline class IC1(val a: Any): java.lang.Cloneable + +@JvmInline +value class VC1(val a: Any): java.lang.Cloneable + +interface MyCloneable1: Cloneable + +inline class IC2(val a: Any): MyCloneable1 + +@JvmInline +value class VC2(val a: Any): MyCloneable1 + +interface MyCloneable2: java.lang.Cloneable + +inline class IC3(val a: Any): MyCloneable2 + +@JvmInline +value class VC3(val a: Any): MyCloneable2 \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJvmBackend/valueClasses/cloneable.txt b/compiler/testData/diagnostics/testsWithJvmBackend/valueClasses/cloneable.txt new file mode 100644 index 00000000000..e854a208261 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJvmBackend/valueClasses/cloneable.txt @@ -0,0 +1,95 @@ +package + +package kotlin { + + package kotlin.jvm { + + public final inline class IC0 : kotlin.Cloneable { + public constructor IC0(/*0*/ a: kotlin.Any) + public final val a: kotlin.Any + protected open override /*1*/ /*fake_override*/ fun clone(): kotlin.Any + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final inline class IC1 : java.lang.Cloneable { + public constructor IC1(/*0*/ a: kotlin.Any) + public final val a: kotlin.Any + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final inline class IC2 : kotlin.jvm.MyCloneable1 { + public constructor IC2(/*0*/ a: kotlin.Any) + public final val a: kotlin.Any + protected open override /*1*/ /*fake_override*/ fun clone(): kotlin.Any + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final inline class IC3 : kotlin.jvm.MyCloneable2 { + public constructor IC3(/*0*/ a: kotlin.Any) + public final val a: kotlin.Any + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + public final annotation class JvmInline : kotlin.Annotation { + public constructor JvmInline() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public interface MyCloneable1 : kotlin.Cloneable { + protected open override /*1*/ /*fake_override*/ fun clone(): kotlin.Any + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public interface MyCloneable2 : java.lang.Cloneable { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class VC0 : kotlin.Cloneable { + public constructor VC0(/*0*/ a: kotlin.Any) + public final val a: kotlin.Any + protected open override /*1*/ /*fake_override*/ fun clone(): kotlin.Any + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class VC1 : java.lang.Cloneable { + public constructor VC1(/*0*/ a: kotlin.Any) + public final val a: kotlin.Any + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class VC2 : kotlin.jvm.MyCloneable1 { + public constructor VC2(/*0*/ a: kotlin.Any) + public final val a: kotlin.Any + protected open override /*1*/ /*fake_override*/ fun clone(): kotlin.Any + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + + @kotlin.jvm.JvmInline public final value class VC3 : kotlin.jvm.MyCloneable2 { + public constructor VC3(/*0*/ a: kotlin.Any) + public final val a: kotlin.Any + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } + } +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJvmIrBackendGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJvmIrBackendGenerated.java index a2f5b30b304..4a14b006062 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJvmIrBackendGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJvmIrBackendGenerated.java @@ -583,4 +583,27 @@ public class DiagnosticsTestWithJvmIrBackendGenerated extends AbstractDiagnostic } } } + + @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend/valueClasses") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ValueClasses extends AbstractDiagnosticsTestWithJvmIrBackend { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInValueClasses() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend/valueClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("cloneable.kt") + public void testCloneable() throws Exception { + runTest("compiler/testData/diagnostics/testsWithJvmBackend/valueClasses/cloneable.kt"); + } + + @TestMetadata("cloneable.fir.kt") + public void testCloneable_fir() throws Exception { + runTest("compiler/testData/diagnostics/testsWithJvmBackend/valueClasses/cloneable.fir.kt"); + } + } } diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithOldJvmBackendGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithOldJvmBackendGenerated.java index 6b90997e0e1..1e3f91bf185 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithOldJvmBackendGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithOldJvmBackendGenerated.java @@ -573,4 +573,27 @@ public class DiagnosticsTestWithOldJvmBackendGenerated extends AbstractDiagnosti } } } + + @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend/valueClasses") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ValueClasses extends AbstractDiagnosticsTestWithOldJvmBackend { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_OLD, testDataFilePath); + } + + public void testAllFilesPresentInValueClasses() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend/valueClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_OLD, true); + } + + @TestMetadata("cloneable.kt") + public void testCloneable() throws Exception { + runTest("compiler/testData/diagnostics/testsWithJvmBackend/valueClasses/cloneable.kt"); + } + + @TestMetadata("cloneable.fir.kt") + public void testCloneable_fir() throws Exception { + runTest("compiler/testData/diagnostics/testsWithJvmBackend/valueClasses/cloneable.fir.kt"); + } + } } From c87edc44f38f3bff618df162520e1c39deb7b381 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Sat, 5 Dec 2020 00:59:18 +0100 Subject: [PATCH 454/698] Fix compilation error in :noarg-ide-plugin Was overlooked in a06bffc4b975527833b61d8b316ea62fb7bbbe53. --- .../kotlin/noarg/diagnostic/CliNoArgDeclarationChecker.kt | 2 +- plugins/noarg/noarg-ide/src/IdeNoArgDeclarationChecker.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/noarg/noarg-cli/src/org/jetbrains/kotlin/noarg/diagnostic/CliNoArgDeclarationChecker.kt b/plugins/noarg/noarg-cli/src/org/jetbrains/kotlin/noarg/diagnostic/CliNoArgDeclarationChecker.kt index 8094adf16dc..3b4e4622ddb 100644 --- a/plugins/noarg/noarg-cli/src/org/jetbrains/kotlin/noarg/diagnostic/CliNoArgDeclarationChecker.kt +++ b/plugins/noarg/noarg-cli/src/org/jetbrains/kotlin/noarg/diagnostic/CliNoArgDeclarationChecker.kt @@ -35,7 +35,7 @@ internal class CliNoArgDeclarationChecker( override fun getAnnotationFqNames(modifierListOwner: KtModifierListOwner?): List = noArgAnnotationFqNames } -internal abstract class AbstractNoArgDeclarationChecker(private val useIr: Boolean) : DeclarationChecker, AnnotationBasedExtension { +abstract class AbstractNoArgDeclarationChecker(private val useIr: Boolean) : DeclarationChecker, AnnotationBasedExtension { override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) { if (descriptor !is ClassDescriptor || declaration !is KtClass) return if (descriptor.kind != ClassKind.CLASS) return diff --git a/plugins/noarg/noarg-ide/src/IdeNoArgDeclarationChecker.kt b/plugins/noarg/noarg-ide/src/IdeNoArgDeclarationChecker.kt index 8c770b17c53..5cd2d6a6246 100644 --- a/plugins/noarg/noarg-ide/src/IdeNoArgDeclarationChecker.kt +++ b/plugins/noarg/noarg-ide/src/IdeNoArgDeclarationChecker.kt @@ -15,10 +15,10 @@ import org.jetbrains.kotlin.psi.KtModifierListOwner internal val NO_ARG_ANNOTATION_OPTION_PREFIX = "plugin:${NoArgCommandLineProcessor.PLUGIN_ID}:${NoArgCommandLineProcessor.ANNOTATION_OPTION.optionName}=" -class IdeNoArgDeclarationChecker(project: Project) : AbstractNoArgDeclarationChecker() { +class IdeNoArgDeclarationChecker(project: Project) : AbstractNoArgDeclarationChecker(false) { private val cachedAnnotationNames = CachedAnnotationNames(project, NO_ARG_ANNOTATION_OPTION_PREFIX) override fun getAnnotationFqNames(modifierListOwner: KtModifierListOwner?): List = cachedAnnotationNames.getAnnotationNames(modifierListOwner) -} \ No newline at end of file +} From 28a1d1ceac7592d510c3a1013ce5bb1c0cdfd880 Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Fri, 4 Dec 2020 11:29:00 +0100 Subject: [PATCH 455/698] Disable test on Windows #KTI-405 --- .../jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt index 345ead8fd05..95df7fac4fd 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KaptIncrementalWithIsolatingApt.kt @@ -255,6 +255,9 @@ class KaptIncrementalWithIsolatingApt : KaptIncrementalIT() { /** Regression test for KT-34340. */ @Test fun testIsolatingWithOriginsInClasspath() { + //https://youtrack.jetbrains.com/issue/KTI-405 + if (System.getProperty("os.name")?.toLowerCase()?.contains("windows") == true) return + val project = Project("kaptIncrementalWithParceler", GradleVersionRequired.None).apply { setupWorkingDir() } From 3d7d87ace5e87dec8a7b76afd0523ca7e30b572d Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Fri, 4 Dec 2020 23:18:58 -0800 Subject: [PATCH 456/698] FIR: keep nullability of lambda return type --- .../fir/resolve/inference/PostponedArgumentsAnalyzer.kt | 6 +++--- ...cionToUnitWithEqualityConstraintForNullableReturnType.kt | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/PostponedArgumentsAnalyzer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/PostponedArgumentsAnalyzer.kt index 314f0cc7d58..886b301fb1c 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/PostponedArgumentsAnalyzer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/PostponedArgumentsAnalyzer.kt @@ -13,8 +13,7 @@ import org.jetbrains.kotlin.fir.resolve.calls.* import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeUnresolvedReferenceError import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor import org.jetbrains.kotlin.fir.resolve.transformers.StoreNameReference -import org.jetbrains.kotlin.fir.types.ConeKotlinType -import org.jetbrains.kotlin.fir.types.ConeTypeVariable +import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef import org.jetbrains.kotlin.resolve.calls.components.PostponedArgumentsAnalyzerContext import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemBuilder @@ -117,7 +116,8 @@ class PostponedArgumentsAnalyzer( c.canBeProper(rawReturnType) -> substitute(rawReturnType) // For Unit-coercion - c.hasUpperOrEqualUnitConstraint(rawReturnType) -> unitType + c.hasUpperOrEqualUnitConstraint(rawReturnType) -> + if (rawReturnType.isMarkedNullable) unitType.withNullability(ConeNullability.NULLABLE) else unitType else -> null } diff --git a/compiler/testData/codegen/box/inference/noCoercionToUnitWithEqualityConstraintForNullableReturnType.kt b/compiler/testData/codegen/box/inference/noCoercionToUnitWithEqualityConstraintForNullableReturnType.kt index a0d2e6e1bae..52cfa132800 100644 --- a/compiler/testData/codegen/box/inference/noCoercionToUnitWithEqualityConstraintForNullableReturnType.kt +++ b/compiler/testData/codegen/box/inference/noCoercionToUnitWithEqualityConstraintForNullableReturnType.kt @@ -1,6 +1,5 @@ // DONT_TARGET_EXACT_BACKEND: WASM // WASM_MUTE_REASON: UNIT_ISSUES -// IGNORE_BACKEND_FIR: JVM_IR class Inv(val x: T?) From 168503573abc7bd6db17076c1cab1de38ee98f47 Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Tue, 24 Nov 2020 14:42:51 -0800 Subject: [PATCH 457/698] FIR checker: make unused checker path-sensitive --- .../checkers/extended/UnusedChecker.kt | 195 ++++++++++++------ 1 file changed, 128 insertions(+), 67 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt index 0350230bc94..2aa5022b6a5 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt @@ -36,41 +36,52 @@ object UnusedChecker : FirControlFlowChecker() { } class CfaVisitor( - val data: Map, VariableStatusInfo>, + val data: Map, PathAwareVariableStatusInfo>, val reporter: DiagnosticReporter ) : ControlFlowGraphVisitorVoid() { override fun visitNode(node: CFGNode<*>) {} override fun visitVariableAssignmentNode(node: VariableAssignmentNode) { val variableSymbol = (node.fir.calleeReference as? FirResolvedNamedReference)?.resolvedSymbol ?: return - val data = data[node]?.get(variableSymbol) ?: return - if (data == VariableStatus.ONLY_WRITTEN_NEVER_READ) { - // todo: report case like "a += 1" where `a` `doesn't writes` different way (special for Idea) - val source = node.fir.lValue.source - reporter.report(source, FirErrors.ASSIGNED_VALUE_IS_NEVER_READ) + val dataPerNode = data[node] ?: return + for (label in dataPerNode.keys) { + val data = dataPerNode[label]!![variableSymbol] ?: continue + if (data == VariableStatus.ONLY_WRITTEN_NEVER_READ) { + // todo: report case like "a += 1" where `a` `doesn't writes` different way (special for Idea) + val source = node.fir.lValue.source + reporter.report(source, FirErrors.ASSIGNED_VALUE_IS_NEVER_READ) + // To avoid duplicate reports, stop investigating remaining paths once reported. + break + } } } override fun visitVariableDeclarationNode(node: VariableDeclarationNode) { val variableSymbol = node.fir.symbol if (variableSymbol.isLoopIterator) return - val data = data[node]?.get(variableSymbol) ?: return + val dataPerNode = data[node] ?: return + for (label in dataPerNode.keys) { + val data = dataPerNode[label]!![variableSymbol] ?: continue - val variableSource = variableSymbol.fir.source.takeIf { it?.elementType != KtNodeTypes.DESTRUCTURING_DECLARATION } - when { - data == VariableStatus.UNUSED -> { - if ((node.fir.initializer as? FirFunctionCall)?.isIterator != true) { - reporter.report(variableSource, FirErrors.UNUSED_VARIABLE) + val variableSource = variableSymbol.fir.source.takeIf { it?.elementType != KtNodeTypes.DESTRUCTURING_DECLARATION } + when { + data == VariableStatus.UNUSED -> { + if ((node.fir.initializer as? FirFunctionCall)?.isIterator != true) { + reporter.report(variableSource, FirErrors.UNUSED_VARIABLE) + break + } + } + data.isRedundantInit -> { + val source = variableSymbol.fir.initializer?.source + reporter.report(source, FirErrors.VARIABLE_INITIALIZER_IS_REDUNDANT) + break + } + data == VariableStatus.ONLY_WRITTEN_NEVER_READ -> { + reporter.report(variableSource, FirErrors.VARIABLE_NEVER_READ) + break + } + else -> { } - } - data.isRedundantInit -> { - val source = variableSymbol.fir.initializer?.source - reporter.report(source, FirErrors.VARIABLE_INITIALIZER_IS_REDUNDANT) - } - data == VariableStatus.ONLY_WRITTEN_NEVER_READ -> { - reporter.report(variableSource, FirErrors.VARIABLE_NEVER_READ) - } - else -> { } } } @@ -122,72 +133,102 @@ object UnusedChecker : FirControlFlowChecker() { } + class PathAwareVariableStatusInfo( + map: PersistentMap = persistentMapOf() + ) : PathAwareControlFlowInfo(map) { + companion object { + val EMPTY = PathAwareVariableStatusInfo(persistentMapOf(NormalPath to VariableStatusInfo.EMPTY)) + } + + override val constructor: (PersistentMap) -> PathAwareVariableStatusInfo = + ::PathAwareVariableStatusInfo + + override val empty: () -> PathAwareVariableStatusInfo = + ::EMPTY + } + private class ValueWritesWithoutReading( private val localProperties: Set - ) : ControlFlowGraphVisitor>() { - fun getData(graph: ControlFlowGraph): Map, VariableStatusInfo> { - return graph.collectDataForNode(TraverseDirection.Backward, VariableStatusInfo.EMPTY, this) + ) : ControlFlowGraphVisitor>>() { + fun getData(graph: ControlFlowGraph): Map, PathAwareVariableStatusInfo> { + return graph.collectPathAwareDataForNode(TraverseDirection.Backward, PathAwareVariableStatusInfo.EMPTY, this) } - override fun visitNode(node: CFGNode<*>, data: Collection): VariableStatusInfo { - if (data.isEmpty()) return VariableStatusInfo.EMPTY - return data.reduce(VariableStatusInfo::merge) + override fun visitNode( + node: CFGNode<*>, + data: Collection> + ): PathAwareVariableStatusInfo { + if (data.isEmpty()) return PathAwareVariableStatusInfo.EMPTY + return data.map { (label, info) -> info.applyLabel(node, label) } + .reduce(PathAwareVariableStatusInfo::merge) } - override fun visitVariableDeclarationNode(node: VariableDeclarationNode, data: Collection): VariableStatusInfo { + override fun visitVariableDeclarationNode( + node: VariableDeclarationNode, + data: Collection> + ): PathAwareVariableStatusInfo { val dataForNode = visitNode(node, data) if (node.fir.source?.kind is FirFakeSourceElementKind) return dataForNode val symbol = node.fir.symbol - return when (dataForNode[symbol]) { - null -> { - dataForNode.put(symbol, VariableStatus.UNUSED) - } - VariableStatus.ONLY_WRITTEN_NEVER_READ, VariableStatus.WRITTEN_AFTER_READ -> { - if (node.fir.initializer != null && dataForNode[symbol]?.isRead == true) { - val newData = dataForNode[symbol] ?: VariableStatus.UNUSED - newData.isRedundantInit = true - dataForNode.put(symbol, newData) - } else if (node.fir.initializer != null) { - dataForNode.put(symbol, VariableStatus.ONLY_WRITTEN_NEVER_READ) - } else { - dataForNode + return update(dataForNode, symbol) { prev -> + when (prev) { + null -> { + VariableStatus.UNUSED + } + VariableStatus.ONLY_WRITTEN_NEVER_READ, VariableStatus.WRITTEN_AFTER_READ -> { + if (node.fir.initializer != null && prev.isRead) { + prev.isRedundantInit = true + prev + } else if (node.fir.initializer != null) { + VariableStatus.ONLY_WRITTEN_NEVER_READ + } else { + null + } + } + VariableStatus.READ -> { + VariableStatus.READ + } + else -> { + null } - } - VariableStatus.READ -> { - dataForNode.put(symbol, VariableStatus.READ) - } - else -> { - dataForNode } } } - override fun visitVariableAssignmentNode(node: VariableAssignmentNode, data: Collection): VariableStatusInfo { + override fun visitVariableAssignmentNode( + node: VariableAssignmentNode, + data: Collection> + ): PathAwareVariableStatusInfo { val dataForNode = visitNode(node, data) val reference = node.fir.lValue as? FirResolvedNamedReference ?: return dataForNode val symbol = reference.resolvedSymbol as? FirPropertySymbol ?: return dataForNode - val toPut = when { - symbol !in localProperties -> { - null - } - dataForNode[symbol] == VariableStatus.READ -> { - VariableStatus.WRITTEN_AFTER_READ - } - dataForNode[symbol] == VariableStatus.WRITTEN_AFTER_READ -> { - VariableStatus.ONLY_WRITTEN_NEVER_READ - } - else -> { - VariableStatus.ONLY_WRITTEN_NEVER_READ.merge(dataForNode[symbol] ?: VariableStatus.UNUSED) + return update(dataForNode, symbol) update@{ prev -> + val toPut = when { + symbol !in localProperties -> { + null + } + prev == VariableStatus.READ -> { + VariableStatus.WRITTEN_AFTER_READ + } + prev == VariableStatus.WRITTEN_AFTER_READ -> { + VariableStatus.ONLY_WRITTEN_NEVER_READ + } + else -> { + VariableStatus.ONLY_WRITTEN_NEVER_READ.merge(prev ?: VariableStatus.UNUSED) + } } + + toPut ?: return@update null + + toPut.isRead = prev?.isRead ?: false + toPut } - - toPut ?: return dataForNode - - toPut.isRead = dataForNode[symbol]?.isRead ?: false - return dataForNode.put(symbol, toPut) } - override fun visitQualifiedAccessNode(node: QualifiedAccessNode, data: Collection): VariableStatusInfo { + override fun visitQualifiedAccessNode( + node: QualifiedAccessNode, + data: Collection> + ): PathAwareVariableStatusInfo { val dataForNode = visitNode(node, data) if (node.fir.source?.kind is FirFakeSourceElementKind) return dataForNode val reference = node.fir.calleeReference as? FirResolvedNamedReference ?: return dataForNode @@ -197,7 +238,27 @@ object UnusedChecker : FirControlFlowChecker() { val status = VariableStatus.READ status.isRead = true - return dataForNode.put(symbol, status) + return update(dataForNode, symbol) { status } + } + + private fun update( + info: PathAwareVariableStatusInfo, + symbol: FirPropertySymbol, + updater: (VariableStatus?) -> VariableStatus?, + ): PathAwareVariableStatusInfo { + var resultMap = persistentMapOf() + var changed = false + for (label in info.keys) { + val dataPerLabel = info[label]!! + val v = updater.invoke(dataPerLabel[symbol]) + if (v != null) { + resultMap = resultMap.put(label, dataPerLabel.put(symbol, v)) + changed = true + } else { + resultMap = resultMap.put(label, dataPerLabel) + } + } + return if (changed) PathAwareVariableStatusInfo(resultMap) else info } } From 762e315ce393e41ee7ee7672c19f2eb8716ec8fe Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Tue, 24 Nov 2020 14:58:07 -0800 Subject: [PATCH 458/698] FIR checker: deprecate path-insensitive data collection --- .../kotlin/fir/analysis/cfa/CfaUtils.kt | 2 +- .../kotlin/fir/analysis/cfa/CfgTraverser.kt | 60 ++----------------- .../analysis/cfa/FirCallsEffectAnalyzer.kt | 2 +- .../checkers/extended/UnusedChecker.kt | 2 +- 4 files changed, 7 insertions(+), 59 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/CfaUtils.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/CfaUtils.kt index c11c3c21fc8..ce21e657581 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/CfaUtils.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/CfaUtils.kt @@ -112,7 +112,7 @@ class PropertyInitializationInfoCollector(private val localProperties: Set, K : Any, V : Any> ControlFlowGraph.collectDataForNode( direction: TraverseDirection, initialInfo: I, - visitor: ControlFlowGraphVisitor> + visitor: ControlFlowGraphVisitor>> ): Map, I> { val nodeMap = LinkedHashMap, I>() val startNode = getEnterNode(direction) @@ -53,56 +51,6 @@ fun , K : Any, V : Any> ControlFlowGraph.collectDat } private fun , K : Any, V : Any> ControlFlowGraph.collectDataForNodeInternal( - direction: TraverseDirection, - initialInfo: I, - visitor: ControlFlowGraphVisitor>, - nodeMap: MutableMap, I>, - changed: MutableMap, Boolean> -) { - val nodes = getNodesInOrder(direction) - for (node in nodes) { - if (direction == TraverseDirection.Backward && node is CFGNodeWithCfgOwner<*>) { - node.subGraphs.forEach { it.collectDataForNodeInternal(direction, initialInfo, visitor, nodeMap, changed) } - } - val previousNodes = when (direction) { - TraverseDirection.Forward -> node.previousCfgNodes - TraverseDirection.Backward -> node.followingCfgNodes - } - val previousData = previousNodes.mapNotNull { nodeMap[it] } - val data = nodeMap[node] - val newData = node.accept(visitor, previousData) - val hasChanged = newData != data - changed[node] = hasChanged - if (hasChanged) { - nodeMap[node] = newData - } - if (direction == TraverseDirection.Forward && node is CFGNodeWithCfgOwner<*>) { - node.subGraphs.forEach { it.collectDataForNodeInternal(direction, initialInfo, visitor, nodeMap, changed) } - } - } -} - -// ---------------------- Path-sensitive data collection ----------------------- - -// TODO: Once migration is done, get rid of "PathAware" from util names -fun , K : Any, V : Any> ControlFlowGraph.collectPathAwareDataForNode( - direction: TraverseDirection, - initialInfo: I, - visitor: ControlFlowGraphVisitor>> -): Map, I> { - val nodeMap = LinkedHashMap, I>() - val startNode = getEnterNode(direction) - nodeMap[startNode] = initialInfo - - val changed = mutableMapOf, Boolean>() - do { - collectPathAwareDataForNodeInternal(direction, initialInfo, visitor, nodeMap, changed) - } while (changed.any { it.value }) - - return nodeMap -} - -private fun , K : Any, V : Any> ControlFlowGraph.collectPathAwareDataForNodeInternal( direction: TraverseDirection, initialInfo: I, visitor: ControlFlowGraphVisitor>>, @@ -112,7 +60,7 @@ private fun , K : Any, V : Any> ControlFlowGraph.co val nodes = getNodesInOrder(direction) for (node in nodes) { if (direction == TraverseDirection.Backward && node is CFGNodeWithCfgOwner<*>) { - node.subGraphs.forEach { it.collectPathAwareDataForNodeInternal(direction, initialInfo, visitor, nodeMap, changed) } + node.subGraphs.forEach { it.collectDataForNodeInternal(direction, initialInfo, visitor, nodeMap, changed) } } val previousNodes = when (direction) { TraverseDirection.Forward -> node.previousCfgNodes @@ -136,7 +84,7 @@ private fun , K : Any, V : Any> ControlFlowGraph.co nodeMap[node] = newData } if (direction == TraverseDirection.Forward && node is CFGNodeWithCfgOwner<*>) { - node.subGraphs.forEach { it.collectPathAwareDataForNodeInternal(direction, initialInfo, visitor, nodeMap, changed) } + node.subGraphs.forEach { it.collectDataForNodeInternal(direction, initialInfo, visitor, nodeMap, changed) } } } } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt index 656fed1d504..d2cec5c9d10 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt @@ -80,7 +80,7 @@ object FirCallsEffectAnalyzer : FirControlFlowChecker() { } } - val invocationData = graph.collectPathAwareDataForNode( + val invocationData = graph.collectDataForNode( TraverseDirection.Forward, PathAwareLambdaInvocationInfo.EMPTY, InvocationDataCollector(functionalTypeEffects.keys.filterTo(mutableSetOf()) { it !in leakedSymbols }) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt index 2aa5022b6a5..f60f9936b1f 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt @@ -151,7 +151,7 @@ object UnusedChecker : FirControlFlowChecker() { private val localProperties: Set ) : ControlFlowGraphVisitor>>() { fun getData(graph: ControlFlowGraph): Map, PathAwareVariableStatusInfo> { - return graph.collectPathAwareDataForNode(TraverseDirection.Backward, PathAwareVariableStatusInfo.EMPTY, this) + return graph.collectDataForNode(TraverseDirection.Backward, PathAwareVariableStatusInfo.EMPTY, this) } override fun visitNode( From c959ad7911f243835f20b412780256413ad313fd Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Fri, 4 Dec 2020 10:04:27 -0800 Subject: [PATCH 459/698] FIR checker: revisit per-label iterations to avoid !! --- .../jetbrains/kotlin/fir/analysis/cfa/CfaUtils.kt | 5 ++--- .../fir/analysis/cfa/FirCallsEffectAnalyzer.kt | 6 +++--- .../cfa/FirPropertyInitializationAnalyzer.kt | 4 ++-- .../analysis/checkers/extended/UnusedChecker.kt | 15 +++++++-------- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/CfaUtils.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/CfaUtils.kt index ce21e657581..c3057877df5 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/CfaUtils.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/CfaUtils.kt @@ -128,15 +128,14 @@ class PropertyInitializationInfoCollector(private val localProperties: Set, S : ControlFlowInfo, K : Any> addRange( - info: P, + pathAwareInfo: P, key: K, range: EventOccurrencesRange, constructor: (PersistentMap) -> P ): P { var resultMap = persistentMapOf() // before: { |-> { p1 |-> PI1 }, l1 |-> { p2 |-> PI2 } } - for (label in info.keys) { - val dataPerLabel = info[label]!! + for ((label, dataPerLabel) in pathAwareInfo) { val existingKind = dataPerLabel[key] ?: EventOccurrencesRange.ZERO val kind = existingKind + range resultMap = resultMap.put(label, dataPerLabel.put(key, kind)) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt index d2cec5c9d10..f4b495535a9 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt @@ -89,9 +89,9 @@ object FirCallsEffectAnalyzer : FirControlFlowChecker() { for ((symbol, effectDeclaration) in functionalTypeEffects) { graph.exitNode.previousCfgNodes.forEach { node -> val requiredRange = effectDeclaration.kind - val info = invocationData.getValue(node) - for (label in info.keys) { - if (investigate(info.getValue(label), symbol, requiredRange, function, reporter)) { + val pathAwareInfo = invocationData.getValue(node) + for (info in pathAwareInfo.values) { + if (investigate(info, symbol, requiredRange, function, reporter)) { // To avoid duplicate reports, stop investigating remaining paths once reported. break } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirPropertyInitializationAnalyzer.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirPropertyInitializationAnalyzer.kt index f42b1564e7f..8a1fffdccf5 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirPropertyInitializationAnalyzer.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirPropertyInitializationAnalyzer.kt @@ -49,8 +49,8 @@ object FirPropertyInitializationAnalyzer : AbstractFirPropertyInitializationChec if (symbol !in localProperties) return if (symbol.fir.isLateInit) return val pathAwareInfo = data.getValue(node) - for (label in pathAwareInfo.keys) { - if (investigate(pathAwareInfo[label]!!, symbol, node)) { + for (info in pathAwareInfo.values) { + if (investigate(info, symbol, node)) { // To avoid duplicate reports, stop investigating remaining paths if the property is not initialized at any path. break } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt index f60f9936b1f..19f5dc3c62c 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt @@ -44,8 +44,8 @@ object UnusedChecker : FirControlFlowChecker() { override fun visitVariableAssignmentNode(node: VariableAssignmentNode) { val variableSymbol = (node.fir.calleeReference as? FirResolvedNamedReference)?.resolvedSymbol ?: return val dataPerNode = data[node] ?: return - for (label in dataPerNode.keys) { - val data = dataPerNode[label]!![variableSymbol] ?: continue + for (dataPerLabel in dataPerNode.values) { + val data = dataPerLabel[variableSymbol] ?: continue if (data == VariableStatus.ONLY_WRITTEN_NEVER_READ) { // todo: report case like "a += 1" where `a` `doesn't writes` different way (special for Idea) val source = node.fir.lValue.source @@ -60,8 +60,8 @@ object UnusedChecker : FirControlFlowChecker() { val variableSymbol = node.fir.symbol if (variableSymbol.isLoopIterator) return val dataPerNode = data[node] ?: return - for (label in dataPerNode.keys) { - val data = dataPerNode[label]!![variableSymbol] ?: continue + for (dataPerLabel in dataPerNode.values) { + val data = dataPerLabel[variableSymbol] ?: continue val variableSource = variableSymbol.fir.source.takeIf { it?.elementType != KtNodeTypes.DESTRUCTURING_DECLARATION } when { @@ -242,14 +242,13 @@ object UnusedChecker : FirControlFlowChecker() { } private fun update( - info: PathAwareVariableStatusInfo, + pathAwareInfo: PathAwareVariableStatusInfo, symbol: FirPropertySymbol, updater: (VariableStatus?) -> VariableStatus?, ): PathAwareVariableStatusInfo { var resultMap = persistentMapOf() var changed = false - for (label in info.keys) { - val dataPerLabel = info[label]!! + for ((label, dataPerLabel) in pathAwareInfo) { val v = updater.invoke(dataPerLabel[symbol]) if (v != null) { resultMap = resultMap.put(label, dataPerLabel.put(symbol, v)) @@ -258,7 +257,7 @@ object UnusedChecker : FirControlFlowChecker() { resultMap = resultMap.put(label, dataPerLabel) } } - return if (changed) PathAwareVariableStatusInfo(resultMap) else info + return if (changed) PathAwareVariableStatusInfo(resultMap) else pathAwareInfo } } From 5f91f79382ed41369e1541221348adc92c97bbe9 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Thu, 3 Dec 2020 22:51:00 +0300 Subject: [PATCH 460/698] Remove usage of idea file systems for checking js libraries The removed code is probably an outdated code from the age when Kotlin compiler was using VirtualFiles for operating. Previously the links were stored and passed further, but now it is only some additional check (files are unused after the check) with an implicit dependency to IDEA internals. The deleted check could probably be responsible for handling references to JS libraries because of the working compiler daemon. The code was spotted during an investigation for the 2bf22caeb7c687cd6b54b05b11e5c0f1a3caa07c commit (there's a detailed description in the commit message). --- .../jetbrains/kotlin/js/config/JsConfig.java | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/js/js.frontend/src/org/jetbrains/kotlin/js/config/JsConfig.java b/js/js.frontend/src/org/jetbrains/kotlin/js/config/JsConfig.java index 94ce2c8a774..63bf59de68e 100644 --- a/js/js.frontend/src/org/jetbrains/kotlin/js/config/JsConfig.java +++ b/js/js.frontend/src/org/jetbrains/kotlin/js/config/JsConfig.java @@ -164,9 +164,6 @@ public class JsConfig { return false; } - VirtualFileSystem fileSystem = VirtualFileManager.getInstance().getFileSystem(StandardFileSystems.FILE_PROTOCOL); - VirtualFileSystem jarFileSystem = VirtualFileManager.getInstance().getFileSystem(StandardFileSystems.JAR_PROTOCOL); - Set modules = new HashSet<>(); boolean skipMetadataVersionCheck = getLanguageVersionSettings().getFlag(AnalysisFlags.getSkipMetadataVersionCheck()); @@ -174,26 +171,12 @@ public class JsConfig { for (String path : libraries) { if (librariesToSkip != null && librariesToSkip.contains(path)) continue; - VirtualFile file; - File filePath = new File(path); if (!filePath.exists()) { report.error("Path '" + path + "' does not exist"); return true; } - if (path.endsWith(".jar") || path.endsWith(".zip")) { - file = jarFileSystem.findFileByPath(path + URLUtil.JAR_SEPARATOR); - } - else { - file = fileSystem.findFileByPath(path); - } - - if (file == null) { - report.error("File '" + path + "' does not exist or could not be read"); - return true; - } - List metadataList = KotlinJavascriptMetadataUtils.loadMetadata(path); if (metadataList.isEmpty()) { report.warning("'" + path + "' is not a valid Kotlin Javascript library"); From 0d8cdb7bdb5fa4e00568254b4be77d2f4398d0af Mon Sep 17 00:00:00 2001 From: Nikita Bobko Date: Fri, 4 Dec 2020 15:45:15 +0300 Subject: [PATCH 461/698] Fix double registered "com.intellij.psi.classFileDecompiler" for 203 platform This commit addresses 1243c641296e74a572a4f274df72a4cda60635c6 in intellij In intellij they added registration of "com.intellij.psi.classFileDecompiler" in `JavaCoreApplicationEnvironment`. And because the `KotlinCoreApplicationEnvironment` inherits `JavaCoreApplicationEnvironment` we don't need to register this EP ourselves. This commit fixes in 203 tests + 1.4.30 compiler: ``` java.lang.RuntimeException: Duplicate registration for EP 'com.intellij.psi.classFileDecompiler': first in com.intellij.openapi.extensions.DefaultPluginDescriptor@44f464d1, second in PluginDescriptor(name=org.jetbrains.kotlin, id=org.jetbrains.kotlin, path=/home/builduser/.m2/repository/org/jetbrains/kotlin/kotlin-compiler-for-ide/1.4.30-M1-30/kotlin-compiler-for-ide-1.4.30-M1-30.jar, version=1.2) at com.intellij.openapi.components.ComponentManager.createError(ComponentManager.java:167) at com.intellij.openapi.extensions.impl.ExtensionsAreaImpl.registerExtensionPoints(ExtensionsAreaImpl.java:262) at com.intellij.ide.plugins.PluginManagerCore.registerExtensionPointAndExtensions(PluginManagerCore.java:1334) ... ``` --- .../cli/cli-common/resources/META-INF/extensions/core.xml | 2 ++ .../kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/compiler/cli/cli-common/resources/META-INF/extensions/core.xml b/compiler/cli/cli-common/resources/META-INF/extensions/core.xml index da66522edb3..bc2b356021d 100644 --- a/compiler/cli/cli-common/resources/META-INF/extensions/core.xml +++ b/compiler/cli/cli-common/resources/META-INF/extensions/core.xml @@ -2,6 +2,8 @@ org.jetbrains.kotlin 1.2 + + Date: Wed, 25 Nov 2020 10:24:21 -0800 Subject: [PATCH 462/698] FIR: reproduce KT-43569 --- .../kotlin/fir/Fir2IrTextTestGenerated.java | 5 ++ .../inapplicableCollectionSet.fir.kt.txt | 32 +++++++ .../inapplicableCollectionSet.fir.txt | 82 ++++++++++++++++++ .../firProblems/inapplicableCollectionSet.kt | 20 +++++ .../inapplicableCollectionSet.kt.txt | 32 +++++++ .../firProblems/inapplicableCollectionSet.txt | 85 +++++++++++++++++++ .../kotlin/ir/IrTextTestCaseGenerated.java | 5 ++ 7 files changed, 261 insertions(+) create mode 100644 compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.fir.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.fir.txt create mode 100644 compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.kt create mode 100644 compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.txt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java index d90579d9d6e..b5d80bfd611 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java @@ -1807,6 +1807,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { runTest("compiler/testData/ir/irText/firProblems/FirBuilder.kt"); } + @TestMetadata("inapplicableCollectionSet.kt") + public void testInapplicableCollectionSet() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.kt"); + } + @TestMetadata("InnerClassInAnonymous.kt") public void testInnerClassInAnonymous() throws Exception { runTest("compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt"); diff --git a/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.fir.kt.txt b/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.fir.kt.txt new file mode 100644 index 00000000000..50b799c254c --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.fir.kt.txt @@ -0,0 +1,32 @@ +class Flaf { + constructor(javaName: String) /* primary */ { + super/*Any*/() + /* () */ + + } + + val javaName: String + field = javaName + get + + private val INSTANCES: MutableMap + field = mutableMapOf() + private get + + fun forJavaName(javaName: String): Flaf { + var result: Flaf? = .().get(key = javaName) + when { + EQEQ(arg0 = result, arg1 = null) -> { // BLOCK + result = .().get(key = javaName.toString() + "_alternative") + when { + EQEQ(arg0 = result, arg1 = null) -> { // BLOCK + result = Flaf(javaName = javaName) + } + } + error("") /* ErrorCallExpression */javaName; result; + } + } + return result + } + +} diff --git a/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.fir.txt b/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.fir.txt new file mode 100644 index 00000000000..4a37c0bf4a6 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.fir.txt @@ -0,0 +1,82 @@ +FILE fqName: fileName:/inapplicableCollectionSet.kt + CLASS CLASS name:Flaf modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Flaf + CONSTRUCTOR visibility:public <> (javaName:kotlin.String) returnType:.Flaf [primary] + VALUE_PARAMETER name:javaName index:0 type:kotlin.String + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Flaf modality:FINAL visibility:public superTypes:[kotlin.Any]' + PROPERTY name:javaName visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:javaName type:kotlin.String visibility:private [final] + EXPRESSION_BODY + GET_VAR 'javaName: kotlin.String declared in .Flaf.' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Flaf) returnType:kotlin.String + correspondingProperty: PROPERTY name:javaName visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Flaf + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .Flaf' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:javaName type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .Flaf declared in .Flaf.' type=.Flaf origin=null + PROPERTY name:INSTANCES visibility:private modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:INSTANCES type:kotlin.collections.MutableMap.Flaf> visibility:private [final] + EXPRESSION_BODY + CALL 'public final fun mutableMapOf (): kotlin.collections.MutableMap [inline] declared in kotlin.collections' type=kotlin.collections.MutableMap.Flaf> origin=null + : kotlin.String + : .Flaf + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.Flaf) returnType:kotlin.collections.MutableMap.Flaf> + correspondingProperty: PROPERTY name:INSTANCES visibility:private modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Flaf + BLOCK_BODY + RETURN type=kotlin.Nothing from='private final fun (): kotlin.collections.MutableMap.Flaf> declared in .Flaf' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:INSTANCES type:kotlin.collections.MutableMap.Flaf> visibility:private [final]' type=kotlin.collections.MutableMap.Flaf> origin=null + receiver: GET_VAR ': .Flaf declared in .Flaf.' type=.Flaf origin=null + FUN name:forJavaName visibility:public modality:FINAL <> ($this:.Flaf, javaName:kotlin.String) returnType:.Flaf + $this: VALUE_PARAMETER name: type:.Flaf + VALUE_PARAMETER name:javaName index:0 type:kotlin.String + BLOCK_BODY + VAR name:result type:.Flaf? [var] + CALL 'public abstract fun get (key: K of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? [fake_override,operator] declared in kotlin.collections.MutableMap' type=.Flaf? origin=null + $this: CALL 'private final fun (): kotlin.collections.MutableMap.Flaf> declared in .Flaf' type=kotlin.collections.MutableMap.Flaf> origin=GET_PROPERTY + $this: GET_VAR ': .Flaf declared in .Flaf.forJavaName' type=.Flaf origin=null + key: GET_VAR 'javaName: kotlin.String declared in .Flaf.forJavaName' type=kotlin.String origin=null + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ + arg0: GET_VAR 'var result: .Flaf? [var] declared in .Flaf.forJavaName' type=.Flaf? origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: BLOCK type=kotlin.Unit origin=null + SET_VAR 'var result: .Flaf? [var] declared in .Flaf.forJavaName' type=kotlin.Unit origin=EQ + CALL 'public abstract fun get (key: K of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? [fake_override,operator] declared in kotlin.collections.MutableMap' type=.Flaf? origin=null + $this: CALL 'private final fun (): kotlin.collections.MutableMap.Flaf> declared in .Flaf' type=kotlin.collections.MutableMap.Flaf> origin=GET_PROPERTY + $this: GET_VAR ': .Flaf declared in .Flaf.forJavaName' type=.Flaf origin=null + key: STRING_CONCATENATION type=kotlin.String + CALL 'public open fun toString (): kotlin.String [fake_override] declared in kotlin.String' type=kotlin.String origin=null + $this: GET_VAR 'javaName: kotlin.String declared in .Flaf.forJavaName' type=kotlin.String origin=null + CONST String type=kotlin.String value="_alternative" + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ + arg0: GET_VAR 'var result: .Flaf? [var] declared in .Flaf.forJavaName' type=.Flaf? origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: BLOCK type=kotlin.Unit origin=null + SET_VAR 'var result: .Flaf? [var] declared in .Flaf.forJavaName' type=kotlin.Unit origin=EQ + CONSTRUCTOR_CALL 'public constructor (javaName: kotlin.String) [primary] declared in .Flaf' type=.Flaf origin=null + javaName: GET_VAR 'javaName: kotlin.String declared in .Flaf.forJavaName' type=kotlin.String origin=null + ERROR_CALL 'Unresolved reference: #' type=kotlin.Unit + GET_VAR 'javaName: kotlin.String declared in .Flaf.forJavaName' type=kotlin.String origin=null + GET_VAR 'var result: .Flaf? [var] declared in .Flaf.forJavaName' type=.Flaf? origin=null + RETURN type=kotlin.Nothing from='public final fun forJavaName (javaName: kotlin.String): .Flaf declared in .Flaf' + GET_VAR 'var result: .Flaf? [var] declared in .Flaf.forJavaName' type=.Flaf? origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.kt b/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.kt new file mode 100644 index 00000000000..a423b0f883b --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.kt @@ -0,0 +1,20 @@ +// WITH_RUNTIME +// FULL_JDK + +class Flaf(val javaName: String) { + + private val INSTANCES = mutableMapOf() + + fun forJavaName(javaName: String): Flaf { + var result: Flaf? = INSTANCES[javaName] + if (result == null) { + result = INSTANCES["${javaName}_alternative"] + if (result == null) { + result = Flaf(javaName) + } + INSTANCES[javaName] = result + } + return result + } + +} diff --git a/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.kt.txt b/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.kt.txt new file mode 100644 index 00000000000..678b6459f08 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.kt.txt @@ -0,0 +1,32 @@ +class Flaf { + constructor(javaName: String) /* primary */ { + super/*Any*/() + /* () */ + + } + + val javaName: String + field = javaName + get + + private val INSTANCES: MutableMap + field = mutableMapOf() + private get + + fun forJavaName(javaName: String): Flaf { + var result: Flaf? = .().get(key = javaName) + when { + EQEQ(arg0 = result, arg1 = null) -> { // BLOCK + result = .().get(key = javaName + "_alternative") + when { + EQEQ(arg0 = result, arg1 = null) -> { // BLOCK + result = Flaf(javaName = javaName) + } + } + .().set(key = javaName, value = result) + } + } + return result + } + +} diff --git a/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.txt b/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.txt new file mode 100644 index 00000000000..961aaa9f82b --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.txt @@ -0,0 +1,85 @@ +FILE fqName: fileName:/inapplicableCollectionSet.kt + CLASS CLASS name:Flaf modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Flaf + CONSTRUCTOR visibility:public <> (javaName:kotlin.String) returnType:.Flaf [primary] + VALUE_PARAMETER name:javaName index:0 type:kotlin.String + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Flaf modality:FINAL visibility:public superTypes:[kotlin.Any]' + PROPERTY name:javaName visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:javaName type:kotlin.String visibility:private [final] + EXPRESSION_BODY + GET_VAR 'javaName: kotlin.String declared in .Flaf.' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Flaf) returnType:kotlin.String + correspondingProperty: PROPERTY name:javaName visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Flaf + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .Flaf' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:javaName type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .Flaf declared in .Flaf.' type=.Flaf origin=null + PROPERTY name:INSTANCES visibility:private modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:INSTANCES type:kotlin.collections.MutableMap.Flaf> visibility:private [final] + EXPRESSION_BODY + CALL 'public final fun mutableMapOf (): kotlin.collections.MutableMap [inline] declared in kotlin.collections' type=kotlin.collections.MutableMap.Flaf> origin=null + : kotlin.String + : .Flaf + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.Flaf) returnType:kotlin.collections.MutableMap.Flaf> + correspondingProperty: PROPERTY name:INSTANCES visibility:private modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Flaf + BLOCK_BODY + RETURN type=kotlin.Nothing from='private final fun (): kotlin.collections.MutableMap.Flaf> declared in .Flaf' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:INSTANCES type:kotlin.collections.MutableMap.Flaf> visibility:private [final]' type=kotlin.collections.MutableMap.Flaf> origin=null + receiver: GET_VAR ': .Flaf declared in .Flaf.' type=.Flaf origin=null + FUN name:forJavaName visibility:public modality:FINAL <> ($this:.Flaf, javaName:kotlin.String) returnType:.Flaf + $this: VALUE_PARAMETER name: type:.Flaf + VALUE_PARAMETER name:javaName index:0 type:kotlin.String + BLOCK_BODY + VAR name:result type:.Flaf? [var] + CALL 'public abstract fun get (key: K of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? [fake_override,operator] declared in kotlin.collections.MutableMap' type=.Flaf? origin=GET_ARRAY_ELEMENT + $this: CALL 'private final fun (): kotlin.collections.MutableMap.Flaf> declared in .Flaf' type=kotlin.collections.MutableMap.Flaf> origin=GET_PROPERTY + $this: GET_VAR ': .Flaf declared in .Flaf.forJavaName' type=.Flaf origin=null + key: GET_VAR 'javaName: kotlin.String declared in .Flaf.forJavaName' type=kotlin.String origin=null + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ + arg0: GET_VAR 'var result: .Flaf? [var] declared in .Flaf.forJavaName' type=.Flaf? origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: BLOCK type=kotlin.Unit origin=null + SET_VAR 'var result: .Flaf? [var] declared in .Flaf.forJavaName' type=kotlin.Unit origin=EQ + CALL 'public abstract fun get (key: K of kotlin.collections.MutableMap): V of kotlin.collections.MutableMap? [fake_override,operator] declared in kotlin.collections.MutableMap' type=.Flaf? origin=GET_ARRAY_ELEMENT + $this: CALL 'private final fun (): kotlin.collections.MutableMap.Flaf> declared in .Flaf' type=kotlin.collections.MutableMap.Flaf> origin=GET_PROPERTY + $this: GET_VAR ': .Flaf declared in .Flaf.forJavaName' type=.Flaf origin=null + key: STRING_CONCATENATION type=kotlin.String + GET_VAR 'javaName: kotlin.String declared in .Flaf.forJavaName' type=kotlin.String origin=null + CONST String type=kotlin.String value="_alternative" + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ + arg0: GET_VAR 'var result: .Flaf? [var] declared in .Flaf.forJavaName' type=.Flaf? origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: BLOCK type=kotlin.Unit origin=null + SET_VAR 'var result: .Flaf? [var] declared in .Flaf.forJavaName' type=kotlin.Unit origin=EQ + CONSTRUCTOR_CALL 'public constructor (javaName: kotlin.String) [primary] declared in .Flaf' type=.Flaf origin=null + javaName: GET_VAR 'javaName: kotlin.String declared in .Flaf.forJavaName' type=kotlin.String origin=null + CALL 'public final fun set (key: K of kotlin.collections.set, value: V of kotlin.collections.set): kotlin.Unit [inline,operator] declared in kotlin.collections' type=kotlin.Unit origin=EQ + : kotlin.String + : .Flaf + $receiver: CALL 'private final fun (): kotlin.collections.MutableMap.Flaf> declared in .Flaf' type=kotlin.collections.MutableMap.Flaf> origin=GET_PROPERTY + $this: GET_VAR ': .Flaf declared in .Flaf.forJavaName' type=.Flaf origin=null + key: GET_VAR 'javaName: kotlin.String declared in .Flaf.forJavaName' type=kotlin.String origin=null + value: GET_VAR 'var result: .Flaf? [var] declared in .Flaf.forJavaName' type=.Flaf? origin=null + RETURN type=kotlin.Nothing from='public final fun forJavaName (javaName: kotlin.String): .Flaf declared in .Flaf' + GET_VAR 'var result: .Flaf? [var] declared in .Flaf.forJavaName' type=.Flaf? origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index 9e5ac0cf31b..f16381fb6e9 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -1806,6 +1806,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { runTest("compiler/testData/ir/irText/firProblems/FirBuilder.kt"); } + @TestMetadata("inapplicableCollectionSet.kt") + public void testInapplicableCollectionSet() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.kt"); + } + @TestMetadata("InnerClassInAnonymous.kt") public void testInnerClassInAnonymous() throws Exception { runTest("compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt"); From 16b93126950f2879ce8b9c25038ff3fe80b2788e Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Tue, 1 Dec 2020 10:24:45 -0800 Subject: [PATCH 463/698] FIR DFA: refactor type statements manipulation --- .../kotlin/fir/resolve/dfa/LogicSystem.kt | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/LogicSystem.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/LogicSystem.kt index 20c2001ec71..dfdc0d3fe79 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/LogicSystem.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/LogicSystem.kt @@ -122,16 +122,22 @@ abstract class LogicSystem(protected val context: ConeInferenceCont return result } - protected fun or(statements: Collection): MutableTypeStatement { + private inline fun manipulateTypeStatements( + statements: Collection, + op: (Collection>) -> MutableSet + ): MutableTypeStatement { require(statements.isNotEmpty()) statements.singleOrNull()?.let { return it as MutableTypeStatement } val variable = statements.first().variable assert(statements.all { it.variable == variable }) - val exactType = orForTypes(statements.map { it.exactType }) - val exactNotType = orForTypes(statements.map { it.exactNotType }) + val exactType = op.invoke(statements.map { it.exactType }) + val exactNotType = op.invoke(statements.map { it.exactNotType }) return MutableTypeStatement(variable, exactType, exactNotType) } + protected fun or(statements: Collection): MutableTypeStatement = + manipulateTypeStatements(statements, ::orForTypes) + private fun orForTypes(types: Collection>): MutableSet { if (types.any { it.isEmpty() }) return mutableSetOf() val allTypes = types.flatMapTo(mutableSetOf()) { it } @@ -144,15 +150,8 @@ abstract class LogicSystem(protected val context: ConeInferenceCont return commonTypes } - protected fun and(statements: Collection): MutableTypeStatement { - require(statements.isNotEmpty()) - statements.singleOrNull()?.let { return it as MutableTypeStatement } - val variable = statements.first().variable - assert(statements.all { it.variable == variable }) - val exactType = andForTypes(statements.map { it.exactType }) - val exactNotType = andForTypes(statements.map { it.exactNotType }) - return MutableTypeStatement(variable, exactType, exactNotType) - } + protected fun and(statements: Collection): MutableTypeStatement = + manipulateTypeStatements(statements, ::andForTypes) private fun andForTypes(types: Collection>): MutableSet { return types.flatMapTo(mutableSetOf()) { it } From cdfe1771d9994ba169bdb5576ab9933da0cd2e2f Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Tue, 1 Dec 2020 10:56:36 -0800 Subject: [PATCH 464/698] FIR DFA: reimplement type OR operation to its original semantics #KT-43569 Fixed --- .../kotlin/fir/resolve/dfa/LogicSystem.kt | 17 ++++++++++------- .../inapplicableCollectionSet.fir.kt.txt | 4 ++-- .../inapplicableCollectionSet.fir.txt | 14 ++++++++++---- .../diagnostics/notLinked/dfa/neg/42.fir.kt | 8 ++++---- 4 files changed, 26 insertions(+), 17 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/LogicSystem.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/LogicSystem.kt index dfdc0d3fe79..6e11d2ed8cf 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/LogicSystem.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/LogicSystem.kt @@ -140,14 +140,17 @@ abstract class LogicSystem(protected val context: ConeInferenceCont private fun orForTypes(types: Collection>): MutableSet { if (types.any { it.isEmpty() }) return mutableSetOf() - val allTypes = types.flatMapTo(mutableSetOf()) { it } - val commonTypes = allTypes.toMutableSet() - types.forEach { commonTypes.retainAll(it) } - val differentTypes = types.mapNotNull { typeSet -> (typeSet - commonTypes).takeIf { it.isNotEmpty() } } - if (differentTypes.size == types.size) { - context.commonSuperTypeOrNull(differentTypes.flatten())?.let { commonTypes += it } + val intersectedTypes = types.map { + if (it.size > 1) { + context.intersectTypes(it.toList()) as ConeKotlinType + } else { + assert(it.size == 1) { "We've already checked each set of types is not empty." } + it.single() + } } - return commonTypes + val result = mutableSetOf() + context.commonSuperTypeOrNull(intersectedTypes)?.let { result.add(it) } + return result } protected fun and(statements: Collection): MutableTypeStatement = diff --git a/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.fir.kt.txt b/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.fir.kt.txt index 50b799c254c..7537cea0936 100644 --- a/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.fir.kt.txt +++ b/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.fir.kt.txt @@ -23,10 +23,10 @@ class Flaf { result = Flaf(javaName = javaName) } } - error("") /* ErrorCallExpression */javaName; result; + .().set(key = javaName, value = result /*as Flaf */) } } - return result + return result /*as Flaf */ } } diff --git a/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.fir.txt b/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.fir.txt index 4a37c0bf4a6..43ce9eeb68b 100644 --- a/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.fir.txt +++ b/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.fir.txt @@ -62,11 +62,17 @@ FILE fqName: fileName:/inapplicableCollectionSet.kt SET_VAR 'var result: .Flaf? [var] declared in .Flaf.forJavaName' type=kotlin.Unit origin=EQ CONSTRUCTOR_CALL 'public constructor (javaName: kotlin.String) [primary] declared in .Flaf' type=.Flaf origin=null javaName: GET_VAR 'javaName: kotlin.String declared in .Flaf.forJavaName' type=kotlin.String origin=null - ERROR_CALL 'Unresolved reference: #' type=kotlin.Unit - GET_VAR 'javaName: kotlin.String declared in .Flaf.forJavaName' type=kotlin.String origin=null - GET_VAR 'var result: .Flaf? [var] declared in .Flaf.forJavaName' type=.Flaf? origin=null + CALL 'public final fun set (key: K of kotlin.collections.set, value: V of kotlin.collections.set): kotlin.Unit [inline,operator] declared in kotlin.collections' type=kotlin.Unit origin=null + : kotlin.String + : .Flaf + $receiver: CALL 'private final fun (): kotlin.collections.MutableMap.Flaf> declared in .Flaf' type=kotlin.collections.MutableMap.Flaf> origin=GET_PROPERTY + $this: GET_VAR ': .Flaf declared in .Flaf.forJavaName' type=.Flaf origin=null + key: GET_VAR 'javaName: kotlin.String declared in .Flaf.forJavaName' type=kotlin.String origin=null + value: TYPE_OP type=.Flaf origin=IMPLICIT_CAST typeOperand=.Flaf + GET_VAR 'var result: .Flaf? [var] declared in .Flaf.forJavaName' type=.Flaf? origin=null RETURN type=kotlin.Nothing from='public final fun forJavaName (javaName: kotlin.String): .Flaf declared in .Flaf' - GET_VAR 'var result: .Flaf? [var] declared in .Flaf.forJavaName' type=.Flaf? origin=null + TYPE_OP type=.Flaf origin=IMPLICIT_CAST typeOperand=.Flaf + GET_VAR 'var result: .Flaf? [var] declared in .Flaf.forJavaName' type=.Flaf? origin=null FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.fir.kt index 3f3d9c5291d..9f0ec94f07c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.fir.kt @@ -19,8 +19,8 @@ fun case_1(x: Any) { */ fun case_2(x: Any?) { if (x is Int || x is Float?) { - x - x.toByte() + ? & kotlin.Any?")!>x + ? & kotlin.Any?")!>x.toByte() } } @@ -30,8 +30,8 @@ fun case_2(x: Any?) { */ fun case_3(x: Any?) { if (x is Int? || x is Float) { - x - x.toByte() + ? & kotlin.Any?")!>x + ? & kotlin.Any?")!>x.toByte() } } From 82ad230e0d9caf52ffb16858318483cf5f81d3a3 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Fri, 4 Dec 2020 18:12:10 +0300 Subject: [PATCH 465/698] [Gradle, JS] Add nodeArgs to NodeJsExec ^KT-43793 fixed --- .../kotlin/gradle/targets/js/nodejs/NodeJsExec.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/nodejs/NodeJsExec.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/nodejs/NodeJsExec.kt index 13222df0864..0e26e307e23 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/nodejs/NodeJsExec.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/nodejs/NodeJsExec.kt @@ -32,6 +32,9 @@ constructor( } } + @Input + var nodeArgs: MutableList = mutableListOf() + @Input var sourceMapStackTraces = true @@ -52,12 +55,13 @@ constructor( } override fun exec() { + val newArgs = mutableListOf() + newArgs.addAll(nodeArgs) if (inputFileProperty.isPresent) { - val newArgs = mutableListOf() newArgs.add(inputFileProperty.asFile.get().canonicalPath) - args?.let { newArgs.addAll(it) } - args = newArgs } + args?.let { newArgs.addAll(it) } + args = newArgs if (sourceMapStackTraces) { val sourceMapSupportArgs = mutableListOf( From 078aa18479eb92092f38bdfbe95dc03538e59627 Mon Sep 17 00:00:00 2001 From: Ivan Gavrilovic Date: Fri, 4 Dec 2020 17:42:50 +0000 Subject: [PATCH 466/698] Fix KAPT cli tests on windows - Fix line separator issue - Always quote args with delimiters (=, :) - fix one of args files by removing obsolete stdlib reference - Fix kotlinc.bat to ensure lazy evaluation of additional classpath --- compiler/cli/bin/kotlinc.bat | 3 ++- .../kotlin/kapt/cli/test/AbstractArgumentParsingTest.kt | 2 +- .../kapt/cli/test/AbstractKaptToolIntegrationTest.kt | 9 ++++++++- .../kapt3-cli/testData/integration/argfile/kaptArgs.txt | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/compiler/cli/bin/kotlinc.bat b/compiler/cli/bin/kotlinc.bat index 8f6ea431f69..fdcd6af6171 100644 --- a/compiler/cli/bin/kotlinc.bat +++ b/compiler/cli/bin/kotlinc.bat @@ -49,6 +49,7 @@ if "%_KOTLIN_RUNNER%"=="1" ( "%_JAVACMD%" %JAVA_OPTS% "-Dkotlin.home=%_KOTLIN_HOME%" -cp "%_KOTLIN_HOME%\lib\kotlin-runner.jar" ^ org.jetbrains.kotlin.runner.Main %KOTLIN_OPTS% ) else ( + setlocal EnableDelayedExpansion SET _ADDITIONAL_CLASSPATH= if not "%_KOTLIN_TOOL%"=="" ( @@ -56,7 +57,7 @@ if "%_KOTLIN_RUNNER%"=="1" ( ) "%_JAVACMD%" %JAVA_OPTS% -noverify -cp "%_KOTLIN_HOME%\lib\kotlin-preloader.jar" ^ - org.jetbrains.kotlin.preloading.Preloader -cp "%_KOTLIN_HOME%\lib\kotlin-compiler.jar%_ADDITIONAL_CLASSPATH%" ^ + org.jetbrains.kotlin.preloading.Preloader -cp "%_KOTLIN_HOME%\lib\kotlin-compiler.jar!_ADDITIONAL_CLASSPATH!" ^ %_KOTLIN_COMPILER% %KOTLIN_OPTS% ) diff --git a/plugins/kapt3/kapt3-cli/test/org/jetbrains/kotlin/kapt/cli/test/AbstractArgumentParsingTest.kt b/plugins/kapt3/kapt3-cli/test/org/jetbrains/kotlin/kapt/cli/test/AbstractArgumentParsingTest.kt index e5c1f339192..6186619eb29 100644 --- a/plugins/kapt3/kapt3-cli/test/org/jetbrains/kotlin/kapt/cli/test/AbstractArgumentParsingTest.kt +++ b/plugins/kapt3/kapt3-cli/test/org/jetbrains/kotlin/kapt/cli/test/AbstractArgumentParsingTest.kt @@ -25,7 +25,7 @@ abstract class AbstractArgumentParsingTest : TestCase() { val before = sections.single { it.name == "before" } val messageCollector = TestMessageCollector() - val transformedArgs = transformArgs(before.content.split(LINE_SEPARATOR), messageCollector, isTest = true) + val transformedArgs = transformArgs(before.content.lines(), messageCollector, isTest = true) val actualAfter = if (messageCollector.hasErrors()) messageCollector.toString() else transformedArgs.joinToString(LINE_SEPARATOR) val actual = sections.replacingSection("after", actualAfter).render() diff --git a/plugins/kapt3/kapt3-cli/test/org/jetbrains/kotlin/kapt/cli/test/AbstractKaptToolIntegrationTest.kt b/plugins/kapt3/kapt3-cli/test/org/jetbrains/kotlin/kapt/cli/test/AbstractKaptToolIntegrationTest.kt index 78ac71494fd..5863eaadbb3 100644 --- a/plugins/kapt3/kapt3-cli/test/org/jetbrains/kotlin/kapt/cli/test/AbstractKaptToolIntegrationTest.kt +++ b/plugins/kapt3/kapt3-cli/test/org/jetbrains/kotlin/kapt/cli/test/AbstractKaptToolIntegrationTest.kt @@ -103,7 +103,14 @@ abstract class AbstractKaptToolIntegrationTest : TestCaseWithTmpdir() { } private fun transformArguments(args: List): List { - return args.map { it.replace("%KOTLIN_STDLIB%", File("dist/kotlinc/lib/kotlin-stdlib.jar").absolutePath) } + return args.map { + val arg = it.replace("%KOTLIN_STDLIB%", File("dist/kotlinc/lib/kotlin-stdlib.jar").absolutePath) + if (SystemInfo.isWindows && (arg.contains("=") || arg.contains(":"))) { + "\"" + arg + "\"" + } else { + arg + } + } } private fun getJdk8Home(): File { diff --git a/plugins/kapt3/kapt3-cli/testData/integration/argfile/kaptArgs.txt b/plugins/kapt3/kapt3-cli/testData/integration/argfile/kaptArgs.txt index b391192ee61..68cf0ee1b86 100644 --- a/plugins/kapt3/kapt3-cli/testData/integration/argfile/kaptArgs.txt +++ b/plugins/kapt3/kapt3-cli/testData/integration/argfile/kaptArgs.txt @@ -4,5 +4,5 @@ -Kapt-classpath=output/ap -Kapt-processors=apt.SampleApt -d output/classes --cp output/ap:%KOTLIN_STDLIB% +-cp output/ap Test.kt \ No newline at end of file From b8903f8cf88612b2c24225ebbd016b7a0e22233b Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Mon, 30 Nov 2020 11:52:28 +0100 Subject: [PATCH 467/698] Enable kotlin-annotation-processing-cli tests on TC --- build.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle.kts b/build.gradle.kts index 4e41f4ea3b7..abf16ff88c6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -855,6 +855,7 @@ tasks { register("kaptIdeTest") { dependsOn(":kotlin-annotation-processing:test") dependsOn(":kotlin-annotation-processing-base:test") + dependsOn(":kotlin-annotation-processing-cli:test") } register("gradleIdeTest") { From f573b81456d4f26aac9c7bd73c040017e196cc7e Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Wed, 3 Jun 2020 02:06:40 +0300 Subject: [PATCH 468/698] [JS] Minor: fix typo in AntTaskJsTest --- .../kotlin/integration/AntTaskJsTest.java | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/js/js.tests/test/org/jetbrains/kotlin/integration/AntTaskJsTest.java b/js/js.tests/test/org/jetbrains/kotlin/integration/AntTaskJsTest.java index 83a5fd7ef9a..12dffa74f97 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/integration/AntTaskJsTest.java +++ b/js/js.tests/test/org/jetbrains/kotlin/integration/AntTaskJsTest.java @@ -1,17 +1,6 @@ /* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.integration; @@ -32,7 +21,7 @@ import java.util.List; public class AntTaskJsTest extends AbstractAntTaskTest { private static final String JS_OUT_FILE = "out.js"; - private static final Boolean useHashorn = Boolean.getBoolean("kotlin.js.useNashorn"); + private static final Boolean useNashorn = Boolean.getBoolean("kotlin.js.useNashorn"); @NotNull private String getTestDataDir() { @@ -60,7 +49,7 @@ public class AntTaskJsTest extends AbstractAntTaskTest { List filePaths = CollectionsKt.map(fileNames, s -> getOutputFileByName(s).getAbsolutePath()); - (useHashorn ? NashornJsTestChecker.INSTANCE : V8JsTestChecker.INSTANCE).check(filePaths, "out", "foo", "box", "OK", withModuleSystem); + (useNashorn ? NashornJsTestChecker.INSTANCE : V8JsTestChecker.INSTANCE).check(filePaths, "out", "foo", "box", "OK", withModuleSystem); } private void doJsAntTestForPostfixPrefix(@Nullable String prefix, @Nullable String postfix) throws Exception { From 70eb3d248608fd4084c88b8394e40ff1b4b102b5 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Wed, 3 Jun 2020 15:04:34 +0300 Subject: [PATCH 469/698] [JS] BasicBoxTest.kt: cleanup --- .../jetbrains/kotlin/js/test/BasicBoxTest.kt | 87 +++++++++---------- 1 file changed, 39 insertions(+), 48 deletions(-) diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt index 58ca1e812ac..b120586bf38 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt @@ -67,15 +67,15 @@ import java.util.regex.Matcher import java.util.regex.Pattern abstract class BasicBoxTest( - protected val pathToTestDir: String, - testGroupOutputDirPrefix: String, - pathToRootOutputDir: String = BasicBoxTest.TEST_DATA_DIR_PATH, - private val typedArraysEnabled: Boolean = true, - private val generateSourceMap: Boolean = false, - private val generateNodeJsRunner: Boolean = true, - private val targetBackend: TargetBackend = TargetBackend.JS + protected val pathToTestDir: String, + testGroupOutputDirPrefix: String, + pathToRootOutputDir: String = TEST_DATA_DIR_PATH, + private val typedArraysEnabled: Boolean = true, + private val generateSourceMap: Boolean = false, + private val generateNodeJsRunner: Boolean = true, + private val targetBackend: TargetBackend = TargetBackend.JS ) : KotlinTestWithEnvironment() { - val additionalCommonFileDirectories = mutableListOf() + private val additionalCommonFileDirectories = mutableListOf() private val testGroupOutputDirForCompilation = File(pathToRootOutputDir + "out/" + testGroupOutputDirPrefix) private val testGroupOutputDirForMinification = File(pathToRootOutputDir + "out-min/" + testGroupOutputDirPrefix) @@ -145,8 +145,8 @@ abstract class BasicBoxTest( coroutinesPackage ) val modules = inputFiles - .map { it.module }.distinct() - .map { it.name to it }.toMap() + .map { it.module }.distinct() + .map { it.name to it }.toMap() fun TestModule.allTransitiveDependencies(): Set { return dependenciesSymbols.toSet() + dependenciesSymbols.flatMap { modules[it]!!.allTransitiveDependencies() } @@ -218,13 +218,13 @@ abstract class BasicBoxTest( JsTestUtils.getFilesInDirectoryByExtension(baseDir + "/", JavaScript.EXTENSION) } val inputJsFiles = inputFiles - .filter { it.fileName.endsWith(".js") } - .map { inputJsFile -> - val sourceFile = File(inputJsFile.fileName) - val targetFile = File(outputDir, inputJsFile.module.outputFileSimpleName() + "-js-" + sourceFile.name) - FileUtil.copy(File(inputJsFile.fileName), targetFile) - targetFile.absolutePath - } + .filter { it.fileName.endsWith(".js") } + .map { inputJsFile -> + val sourceFile = File(inputJsFile.fileName) + val targetFile = File(outputDir, inputJsFile.module.outputFileSimpleName() + "-js-" + sourceFile.name) + FileUtil.copy(File(inputJsFile.fileName), targetFile) + targetFile.absolutePath + } val additionalFiles = mutableListOf() @@ -562,21 +562,10 @@ abstract class BasicBoxTest( val recompiledOutputFile = File(outputFile.parentFile, outputFile.nameWithoutExtension + "-recompiled.js") translateFiles( - translationUnits, - recompiledOutputFile, - recompiledOutputFile, - recompiledOutputFile, - recompiledConfig, - outputPrefixFile, - outputPostfixFile, - mainCallParameters, - incrementalData, - remap, - testPackage, - testFunction, - needsFullIrRuntime, - isMainModule = false, - skipDceDriven = true, + translationUnits, recompiledOutputFile, recompiledOutputFile, recompiledOutputFile, recompiledConfig, + outputPrefixFile, outputPostfixFile, + mainCallParameters, incrementalData, remap, testPackage, testFunction, needsFullIrRuntime, + isMainModule = false, skipDceDriven = true, splitPerModule = false, propertyLazyInitialization = false, ) @@ -586,23 +575,27 @@ abstract class BasicBoxTest( assertEquals("Output file changed after recompilation", originalOutput, recompiledOutput) val originalSourceMap = FileUtil.loadFile(File(outputFile.parentFile, outputFile.name + ".map")) - val recompiledSourceMap = removeRecompiledSuffix( - FileUtil.loadFile(File(recompiledOutputFile.parentFile, recompiledOutputFile.name + ".map"))) + val recompiledSourceMap = + removeRecompiledSuffix(FileUtil.loadFile(File(recompiledOutputFile.parentFile, recompiledOutputFile.name + ".map"))) if (originalSourceMap != recompiledSourceMap) { val originalSourceMapParse = SourceMapParser.parse(originalSourceMap) val recompiledSourceMapParse = SourceMapParser.parse(recompiledSourceMap) if (originalSourceMapParse is SourceMapSuccess && recompiledSourceMapParse is SourceMapSuccess) { - assertEquals("Source map file changed after recompilation", - originalSourceMapParse.toDebugString(), - recompiledSourceMapParse.toDebugString()) + assertEquals( + "Source map file changed after recompilation", + originalSourceMapParse.toDebugString(), + recompiledSourceMapParse.toDebugString() + ) } assertEquals("Source map file changed after recompilation", originalSourceMap, recompiledSourceMap) } if (multiModule) { val originalMetadata = FileUtil.loadFile(File(outputFile.parentFile, outputFile.nameWithoutExtension + ".meta.js")) - val recompiledMetadata = removeRecompiledSuffix( - FileUtil.loadFile(File(recompiledOutputFile.parentFile, recompiledOutputFile.nameWithoutExtension + ".meta.js"))) + val recompiledMetadata = + removeRecompiledSuffix( + FileUtil.loadFile(File(recompiledOutputFile.parentFile, recompiledOutputFile.nameWithoutExtension + ".meta.js")) + ) assertEquals( "Metadata file changed after recompilation", metadataAsString(originalMetadata), @@ -775,13 +768,11 @@ abstract class BasicBoxTest( }) } - protected fun createPsiFile(fileName: String): KtFile { + private fun createPsiFile(fileName: String): KtFile { val psiManager = PsiManager.getInstance(project) val fileSystem = VirtualFileManager.getInstance().getFileSystem(StandardFileSystems.FILE_PROTOCOL) - val file = fileSystem.findFileByPath(fileName) - if (file == null) - error("File not found: ${fileName}") + val file = fileSystem.findFileByPath(fileName) ?: error("File not found: ${fileName}") return psiManager.findFile(file) as KtFile } @@ -1061,10 +1052,10 @@ abstract class BasicBoxTest( @JvmStatic protected val runTestInNashorn = getBoolean("kotlin.js.useNashorn") - val TEST_MODULE = "JS_TESTS" - private val DEFAULT_MODULE = "main" - private val TEST_FUNCTION = "box" - private val OLD_MODULE_SUFFIX = "-old" + const val TEST_MODULE = "JS_TESTS" + private const val DEFAULT_MODULE = "main" + private const val TEST_FUNCTION = "box" + private const val OLD_MODULE_SUFFIX = "-old" const val KOTLIN_TEST_INTERNAL = "\$kotlin_test_internal\$" private val engineForMinifier = @@ -1084,4 +1075,4 @@ fun KotlinTestWithEnvironment.createPsiFile(fileName: String): KtFile { return psiManager.findFile(file) as KtFile } -fun KotlinTestWithEnvironment.createPsiFiles(fileNames: List): List = fileNames.map(this::createPsiFile) \ No newline at end of file +fun KotlinTestWithEnvironment.createPsiFiles(fileNames: List): List = fileNames.map(this::createPsiFile) From bc4c2349c08a6643b5a2c6b9af0dec2134358ba9 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Thu, 3 Dec 2020 21:25:59 +0300 Subject: [PATCH 470/698] [JS] Extract engine setup related code from wasmTest --- js/js.tests/build.gradle.kts | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/js/js.tests/build.gradle.kts b/js/js.tests/build.gradle.kts index 6cb4a4e19a1..e7abdba596a 100644 --- a/js/js.tests/build.gradle.kts +++ b/js/js.tests/build.gradle.kts @@ -297,15 +297,23 @@ val unzipV8 by task { into(unpackedDir) } -projectTest("wasmTest", true) { - dependsOn(unzipJsShell) +fun Test.setupV8() { dependsOn(unzipV8) - include("org/jetbrains/kotlin/js/test/wasm/semantics/*") - val jsShellExecutablePath = File(unzipJsShell.get().destinationDir, "js").absolutePath val v8ExecutablePath = File(unzipV8.get().destinationDir, "d8").absolutePath - - systemProperty("javascript.engine.path.SpiderMonkey", jsShellExecutablePath) systemProperty("javascript.engine.path.V8", v8ExecutablePath) +} + +fun Test.setupSpiderMonkey() { + dependsOn(unzipJsShell) + val jsShellExecutablePath = File(unzipJsShell.get().destinationDir, "js").absolutePath + systemProperty("javascript.engine.path.SpiderMonkey", jsShellExecutablePath) +} + +projectTest("wasmTest", true) { + setupV8() + setupSpiderMonkey() + + include("org/jetbrains/kotlin/js/test/wasm/semantics/*") dependsOn(":kotlin-stdlib-wasm:compileKotlinJs") systemProperty("kotlin.wasm.stdlib.path", "libraries/stdlib/wasm/build/classes/kotlin/js/main") From 9cc3725db16ca3e83a2b205367956d4efce2a768 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Thu, 3 Dec 2020 21:29:55 +0300 Subject: [PATCH 471/698] [JS] Move JS engines download and setup code higher to use it from other tasks --- js/js.tests/build.gradle.kts | 172 +++++++++++++++++------------------ 1 file changed, 86 insertions(+), 86 deletions(-) diff --git a/js/js.tests/build.gradle.kts b/js/js.tests/build.gradle.kts index e7abdba596a..7849406d723 100644 --- a/js/js.tests/build.gradle.kts +++ b/js/js.tests/build.gradle.kts @@ -114,6 +114,92 @@ if (kotlinBuildProperties.isInJpsBuildIdeaSync) { } } +enum class OsName { WINDOWS, MAC, LINUX, UNKNOWN } +enum class OsArch { X86_32, X86_64, UNKNOWN } +data class OsType(val name: OsName, val arch: OsArch) +val currentOsType = run { + val gradleOs = OperatingSystem.current() + val osName = when { + gradleOs.isMacOsX -> OsName.MAC + gradleOs.isWindows -> OsName.WINDOWS + gradleOs.isLinux -> OsName.LINUX + else -> OsName.UNKNOWN + } + + val osArch = when (System.getProperty("sun.arch.data.model")) { + "32" -> OsArch.X86_32 + "64" -> OsArch.X86_64 + else -> OsArch.UNKNOWN + } + + OsType(osName, osArch) +} + +val jsShellDirectory = "https://archive.mozilla.org/pub/firefox/nightly/2020/06/2020-06-29-15-46-04-mozilla-central" +val jsShellSuffix = when (currentOsType) { + OsType(OsName.LINUX, OsArch.X86_32) -> "linux-i686" + OsType(OsName.LINUX, OsArch.X86_64) -> "linux-x86_64" + OsType(OsName.MAC, OsArch.X86_64) -> "mac" + OsType(OsName.WINDOWS, OsArch.X86_32) -> "win32" + OsType(OsName.WINDOWS, OsArch.X86_64) -> "win64" + else -> error("unsupported os type $currentOsType") +} +val jsShellLocation = "$jsShellDirectory/jsshell-$jsShellSuffix.zip" + +val downloadedTools = File(buildDir, "tools") + +val downloadJsShell by task { + src(jsShellLocation) + dest(File(downloadedTools, "jsshell-$jsShellSuffix.zip")) + overwrite(false) +} + +val unzipJsShell by task { + dependsOn(downloadJsShell) + from(zipTree(downloadJsShell.get().dest)) + val unpackedDir = File(downloadedTools, "jsshell-$jsShellSuffix") + into(unpackedDir) +} + +val v8osString = when (currentOsType) { + OsType(OsName.LINUX, OsArch.X86_32) -> "linux32" + OsType(OsName.LINUX, OsArch.X86_64) -> "linux64" + OsType(OsName.MAC, OsArch.X86_64) -> "mac64" + OsType(OsName.WINDOWS, OsArch.X86_32) -> "win32" + OsType(OsName.WINDOWS, OsArch.X86_64) -> "win64" + else -> error("unsupported os type $currentOsType") +} + +val v8edition = "rel" // rel or dbg +val v8version = "8.8.104" +val v8fileName = "v8-${v8osString}-${v8edition}-${v8version}" +val v8url = "https://storage.googleapis.com/chromium-v8/official/canary/$v8fileName.zip" + +val downloadV8 by task { + src(v8url) + dest(File(downloadedTools, "$v8fileName.zip")) + overwrite(false) +} + +val unzipV8 by task { + dependsOn(downloadV8) + from(zipTree(downloadV8.get().dest)) + val unpackedDir = File(downloadedTools, v8fileName) + into(unpackedDir) +} + +fun Test.setupV8() { + dependsOn(unzipV8) + val v8ExecutablePath = File(unzipV8.get().destinationDir, "d8").absolutePath + systemProperty("javascript.engine.path.V8", v8ExecutablePath) +} + +fun Test.setupSpiderMonkey() { + dependsOn(unzipJsShell) + val jsShellExecutablePath = File(unzipJsShell.get().destinationDir, "js").absolutePath + systemProperty("javascript.engine.path.SpiderMonkey", jsShellExecutablePath) +} + fun Test.setUpJsBoxTests(jsEnabled: Boolean, jsIrEnabled: Boolean) { dependsOn(":dist") if (jsEnabled) dependsOn(testJsRuntime) @@ -223,92 +309,6 @@ val runMocha by task { check.dependsOn(this) } -enum class OsName { WINDOWS, MAC, LINUX, UNKNOWN } -enum class OsArch { X86_32, X86_64, UNKNOWN } -data class OsType(val name: OsName, val arch: OsArch) -val currentOsType = run { - val gradleOs = OperatingSystem.current() - val osName = when { - gradleOs.isMacOsX -> OsName.MAC - gradleOs.isWindows -> OsName.WINDOWS - gradleOs.isLinux -> OsName.LINUX - else -> OsName.UNKNOWN - } - - val osArch = when (System.getProperty("sun.arch.data.model")) { - "32" -> OsArch.X86_32 - "64" -> OsArch.X86_64 - else -> OsArch.UNKNOWN - } - - OsType(osName, osArch) -} - -val jsShellDirectory = "https://archive.mozilla.org/pub/firefox/nightly/2020/06/2020-06-29-15-46-04-mozilla-central" -val jsShellSuffix = when (currentOsType) { - OsType(OsName.LINUX, OsArch.X86_32) -> "linux-i686" - OsType(OsName.LINUX, OsArch.X86_64) -> "linux-x86_64" - OsType(OsName.MAC, OsArch.X86_64) -> "mac" - OsType(OsName.WINDOWS, OsArch.X86_32) -> "win32" - OsType(OsName.WINDOWS, OsArch.X86_64) -> "win64" - else -> error("unsupported os type $currentOsType") -} -val jsShellLocation = "$jsShellDirectory/jsshell-$jsShellSuffix.zip" - -val downloadedTools = File(buildDir, "tools") - -val downloadJsShell by task { - src(jsShellLocation) - dest(File(downloadedTools, "jsshell-$jsShellSuffix.zip")) - overwrite(false) -} - -val unzipJsShell by task { - dependsOn(downloadJsShell) - from(zipTree(downloadJsShell.get().dest)) - val unpackedDir = File(downloadedTools, "jsshell-$jsShellSuffix") - into(unpackedDir) -} - -val v8osString = when (currentOsType) { - OsType(OsName.LINUX, OsArch.X86_32) -> "linux32" - OsType(OsName.LINUX, OsArch.X86_64) -> "linux64" - OsType(OsName.MAC, OsArch.X86_64) -> "mac64" - OsType(OsName.WINDOWS, OsArch.X86_32) -> "win32" - OsType(OsName.WINDOWS, OsArch.X86_64) -> "win64" - else -> error("unsupported os type $currentOsType") -} - -val v8edition = "rel" // rel or dbg -val v8version = "8.8.104" -val v8fileName = "v8-${v8osString}-${v8edition}-${v8version}" -val v8url = "https://storage.googleapis.com/chromium-v8/official/canary/$v8fileName.zip" - -val downloadV8 by task { - src(v8url) - dest(File(downloadedTools, "$v8fileName.zip")) - overwrite(false) -} - -val unzipV8 by task { - dependsOn(downloadV8) - from(zipTree(downloadV8.get().dest)) - val unpackedDir = File(downloadedTools, v8fileName) - into(unpackedDir) -} - -fun Test.setupV8() { - dependsOn(unzipV8) - val v8ExecutablePath = File(unzipV8.get().destinationDir, "d8").absolutePath - systemProperty("javascript.engine.path.V8", v8ExecutablePath) -} - -fun Test.setupSpiderMonkey() { - dependsOn(unzipJsShell) - val jsShellExecutablePath = File(unzipJsShell.get().destinationDir, "js").absolutePath - systemProperty("javascript.engine.path.SpiderMonkey", jsShellExecutablePath) -} - projectTest("wasmTest", true) { setupV8() setupSpiderMonkey() From f4431a21fc681b4580d6fbbaed1c52a9a78ea8aa Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Thu, 3 Dec 2020 21:38:54 +0300 Subject: [PATCH 472/698] [JS] Make all JS test tasks depending on setupV8 --- js/js.tests/build.gradle.kts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/js.tests/build.gradle.kts b/js/js.tests/build.gradle.kts index 7849406d723..b78e23e60c8 100644 --- a/js/js.tests/build.gradle.kts +++ b/js/js.tests/build.gradle.kts @@ -201,6 +201,8 @@ fun Test.setupSpiderMonkey() { } fun Test.setUpJsBoxTests(jsEnabled: Boolean, jsIrEnabled: Boolean) { + setupV8() + dependsOn(":dist") if (jsEnabled) dependsOn(testJsRuntime) if (jsIrEnabled) { From 2cb4a4906f9482d0aeff727eb5d0b38cc6ec7168 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Wed, 3 Jun 2020 02:07:07 +0300 Subject: [PATCH 473/698] [JS] Remove j2v8 from dependencies --- js/js.engines/build.gradle.kts | 1 - js/js.tests/build.gradle.kts | 16 ---------------- 2 files changed, 17 deletions(-) diff --git a/js/js.engines/build.gradle.kts b/js/js.engines/build.gradle.kts index 096de69b33a..66402b7a5fb 100644 --- a/js/js.engines/build.gradle.kts +++ b/js/js.engines/build.gradle.kts @@ -9,7 +9,6 @@ dependencies { compile(project(":js:js.ast")) compile(project(":js:js.translator")) compileOnly(intellijCoreDep()) { includeJars("intellij-core") } - compileOnly("com.eclipsesource.j2v8:j2v8_linux_x86_64:4.6.0") } sourceSets { diff --git a/js/js.tests/build.gradle.kts b/js/js.tests/build.gradle.kts index b78e23e60c8..345a45cff74 100644 --- a/js/js.tests/build.gradle.kts +++ b/js/js.tests/build.gradle.kts @@ -67,22 +67,6 @@ dependencies { val currentOs = OperatingSystem.current() - val j2v8idString = when { - currentOs.isWindows -> { - val suffix = if (currentOs.toString().endsWith("64")) "_64" else "" - "com.eclipsesource.j2v8:j2v8_win32_x86$suffix:4.6.0" - } - currentOs.isMacOsX -> "com.eclipsesource.j2v8:j2v8_macosx_x86_64:4.6.0" - currentOs.run { isLinux || isUnix } -> "com.eclipsesource.j2v8:j2v8_linux_x86_64:4.8.0" - else -> { - logger.error("unsupported platform $currentOs - can not compile com.eclipsesource.j2v8 dependency") - "j2v8:$currentOs" - } - } - - testCompileOnly("com.eclipsesource.j2v8:j2v8_linux_x86_64:4.8.0") - testRuntimeOnly(j2v8idString) - testRuntime(kotlinStdlib()) testJsRuntime(kotlinStdlib("js")) if (!kotlinBuildProperties.isInJpsBuildIdeaSync) { From 39cc149da0c313abf046af957aa24d6fe951fa3d Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Wed, 3 Jun 2020 00:10:03 +0300 Subject: [PATCH 474/698] [JS] Revert disabling running ES6 tests on all platforms except linux Revert "[JS TESTS] Emulate failing of non-run tests" This reverts commit 2fd69218 Revert "[JS TESTS] Don't run ES6 test on win & mac till j2v8 issue is fixed." This reverts commit 08624165 Revert "[JS TESTS] Add EP to disable run test on specific platform" This reverts commit 50162265 --- .../org/jetbrains/kotlin/js/test/BasicBoxTest.kt | 13 +------------ .../jetbrains/kotlin/js/test/BasicIrBoxTest.kt | 15 +-------------- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt index b120586bf38..bbbeae12a19 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt @@ -104,8 +104,6 @@ abstract class BasicBoxTest( doTest(filePath, "OK", MainCallParameters.noCall(), coroutinesPackage) } - open fun dontRunOnSpecificPlatform(targetBackend: TargetBackend): Boolean = false - open fun doTest(filePath: String, expectedResult: String, mainCallParameters: MainCallParameters, coroutinesPackage: String = "") { val file = File(filePath) val outputDir = getOutputDir(file) @@ -258,7 +256,7 @@ abstract class BasicBoxTest( globalCommonFiles + localCommonFiles + additionalCommonFiles + additionalMainFiles - val dontRunGeneratedCode = InTextDirectivesUtils.dontRunGeneratedCode(targetBackend, file) || dontRunOnSpecificPlatform(targetBackend) + val dontRunGeneratedCode = InTextDirectivesUtils.dontRunGeneratedCode(targetBackend, file) if (!dontRunGeneratedCode && generateNodeJsRunner && !SKIP_NODE_JS.matcher(fileContent).find()) { val nodeRunnerName = mainModule.outputFileName(outputDir) + ".node.js" @@ -279,15 +277,6 @@ abstract class BasicBoxTest( if (runIrPir && !skipDceDriven) { runGeneratedCode(pirAllJsFiles, testModuleName, testPackage, testFunction, expectedResult, withModuleSystem) } - } else { - val ignored = InTextDirectivesUtils.isIgnoredTarget( - targetBackend, file, - InTextDirectivesUtils.IGNORE_BACKEND_DIRECTIVE_PREFIX - ) - - if (ignored) { - throw AssertionError("Ignored test hasn't been ran. Emulate its failing") - } } performAdditionalChecks(generatedJsFiles.map { it.first }, outputPrefixFile, outputPostfixFile) diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt index 9002741d78e..a8ae3a55a46 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -59,8 +59,6 @@ abstract class BasicIrBoxTest( val perModule: Boolean = getBoolean("kotlin.js.ir.perModule") - private val osName: String = System.getProperty("os.name").toLowerCase() - // TODO Design incremental compilation for IR and add test support override val incrementalCompilationChecksEnabled = false @@ -209,17 +207,6 @@ abstract class BasicIrBoxTest( cachedDependencies[outputFile.absolutePath] = dependencyPaths } - override fun dontRunOnSpecificPlatform(targetBackend: TargetBackend): Boolean { - if (targetBackend != TargetBackend.JS_IR_ES6) return false - if (!runEs6Mode) return false - - // TODO: Since j2v8 does not support ES6 on mac and windows, temporary don't run such test on those platforms. - if (osName.indexOf("win") >= 0) return true - if (osName.indexOf("mac") >= 0 || osName.indexOf("darwin") >= 0) return true - - return false - } - override fun runGeneratedCode( jsFiles: List, testModuleName: String?, From 4c69f78de8aa7f05f8d362619c4c82adfd84c0da Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Fri, 4 Dec 2020 01:59:25 +0300 Subject: [PATCH 475/698] [JS] Replace J2V8 based ScriptEngine with a process-based version The main advantage of this is that we can use a newer and official build of V8. Also, with new infra, we can use other JS engines. Other changes: * ScriptEngine API is simplified and documented. * Introduce ScriptEngineWithTypedResult with typed `eval`, mostly for JsReplEvaluator and JsScriptEvaluator. * J2V8 version is completely removed. * Use new ScriptEngineV8 everywhere by default. * System property `kotlin.js.useNashorn` switches to Nashorn in all tests. --- js/js.engines/build.gradle.kts | 2 +- .../js/engine/ProcessBasedScriptEngine.kt | 96 +++++++++++++ .../kotlin/js/engine/ScriptEngine.kt | 50 +++++-- .../kotlin/js/engine/ScriptEngineNashorn.kt | 38 +++-- .../kotlin/js/engine/ScriptEngineV8.kt | 101 ++----------- .../org/jetbrains/kotlin/js/engine/repl.js | 101 +++++++++++++ .../jetbrains/kotlin/js/test/BasicBoxTest.kt | 11 +- .../jetbrains/kotlin/js/test/JsTestChecker.kt | 135 ++++++++---------- .../js/test/optimizer/BasicOptimizerTest.kt | 19 +-- .../semantics/AbstractWebDemoExamplesTest.kt | 9 +- .../js/test/semantics/MultiModuleOrderTest.kt | 18 +-- .../semantics/WebDemoCanvasExamplesTest.java | 26 +--- .../scripting/repl/js/JsReplEvaluator.kt | 4 +- .../kotlin/scripting/repl/js/JsReplUtils.kt | 8 +- .../scripting/repl/js/JsScriptEvaluator.kt | 4 +- 15 files changed, 357 insertions(+), 265 deletions(-) create mode 100644 js/js.engines/src/org/jetbrains/kotlin/js/engine/ProcessBasedScriptEngine.kt create mode 100644 js/js.engines/src/org/jetbrains/kotlin/js/engine/repl.js diff --git a/js/js.engines/build.gradle.kts b/js/js.engines/build.gradle.kts index 66402b7a5fb..bcbd4322986 100644 --- a/js/js.engines/build.gradle.kts +++ b/js/js.engines/build.gradle.kts @@ -8,7 +8,7 @@ dependencies { compile(project(":compiler:util")) compile(project(":js:js.ast")) compile(project(":js:js.translator")) - compileOnly(intellijCoreDep()) { includeJars("intellij-core") } + compile(intellijCoreDep()) { includeJars("intellij-core") } } sourceSets { diff --git a/js/js.engines/src/org/jetbrains/kotlin/js/engine/ProcessBasedScriptEngine.kt b/js/js.engines/src/org/jetbrains/kotlin/js/engine/ProcessBasedScriptEngine.kt new file mode 100644 index 00000000000..4cf663f5e37 --- /dev/null +++ b/js/js.engines/src/org/jetbrains/kotlin/js/engine/ProcessBasedScriptEngine.kt @@ -0,0 +1,96 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.js.engine + +import com.intellij.openapi.util.text.StringUtil + +private val LINE_SEPARATOR = System.getProperty("line.separator")!! +private val END_MARKER = "$LINE_SEPARATOR" + +abstract class ProcessBasedScriptEngine( + private val executablePath: String +) : ScriptEngine { + + private var process: Process? = null + private val buffer = ByteArray(1024) + + override fun eval(script: String): String { + val vm = getOrCreateProcess() + + val stdin = vm.outputStream + val stdout = vm.inputStream + val stderr = vm.errorStream + + val writer = stdin.writer() + writer.write(StringUtil.convertLineSeparators(script, "\\n") + "\n") + writer.flush() + + val out = StringBuilder() + + while (vm.isAlive) { + val n = stdout.available() + if (n == 0) continue + + val count = stdout.read(buffer) + + val s = String(buffer, 0, count) + out.append(s) + + if (out.endsWith(END_MARKER)) break + } + + if (stderr.available() > 0) { + val err = StringBuilder() + + while (vm.isAlive && stderr.available() > 0) { + val count = stderr.read(buffer) + val s = String(buffer, 0, count) + err.append(s) + } + + error("ERROR:\n$err\nOUTPUT:\n$out") + } + + return out.removeSuffix(END_MARKER).removeSuffix(LINE_SEPARATOR).toString() + } + + override fun loadFile(path: String) { + eval("load('${path.replace('\\', '/')}');") + } + + override fun reset() { + eval("!reset") + } + + override fun saveGlobalState() { + eval("!saveGlobalState") + } + + override fun restoreGlobalState() { + eval("!restoreGlobalState") + } + + override fun release() { + process?.destroy() + process = null + } + + private fun getOrCreateProcess(): Process { + val p = process + + if (p != null && p.isAlive) return p + + process = null + + val builder = ProcessBuilder( + executablePath, + "js/js.engines/src/org/jetbrains/kotlin/js/engine/repl.js", + ) + return builder.start().also { + process = it + } + } +} diff --git a/js/js.engines/src/org/jetbrains/kotlin/js/engine/ScriptEngine.kt b/js/js.engines/src/org/jetbrains/kotlin/js/engine/ScriptEngine.kt index 1b0fb773a4c..d307db8bb75 100644 --- a/js/js.engines/src/org/jetbrains/kotlin/js/engine/ScriptEngine.kt +++ b/js/js.engines/src/org/jetbrains/kotlin/js/engine/ScriptEngine.kt @@ -1,18 +1,48 @@ /* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.js.engine interface ScriptEngine { - fun eval(script: String): T - fun evalVoid(script: String) - fun callMethod(obj: Any, name: String, vararg args: Any?): T - fun loadFile(path: String) - fun release() - fun releaseObject(t: T) + fun eval(script: String): String - fun saveState() - fun restoreState() -} \ No newline at end of file + // TODO Add API to load few files at once? + fun loadFile(path: String) + + /** + * Performs truly reset of the engine state. + * */ + fun reset() + + /** + * Saves current state of global object. + * + * See also [restoreGlobalState] + */ + fun saveGlobalState() + + /** + * Restores global object from the last saved state. + * + * See also [saveGlobalState] + */ + fun restoreGlobalState() + + + /** + * Release held resources. + * + * Must be called explicitly before an object is garbage collected to avoid leaking resources. + */ + fun release() +} + +interface ScriptEngineWithTypedResult : ScriptEngine { + fun evalWithTypedResult(script: String): R +} + +fun ScriptEngine.loadFiles(files: List) { + files.forEach { loadFile(it) } +} diff --git a/js/js.engines/src/org/jetbrains/kotlin/js/engine/ScriptEngineNashorn.kt b/js/js.engines/src/org/jetbrains/kotlin/js/engine/ScriptEngineNashorn.kt index c5e86590824..270c9a78175 100644 --- a/js/js.engines/src/org/jetbrains/kotlin/js/engine/ScriptEngineNashorn.kt +++ b/js/js.engines/src/org/jetbrains/kotlin/js/engine/ScriptEngineNashorn.kt @@ -1,53 +1,49 @@ /* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @file:Suppress("JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE") package org.jetbrains.kotlin.js.engine +import jdk.nashorn.api.scripting.NashornScriptEngine import jdk.nashorn.api.scripting.NashornScriptEngineFactory import jdk.nashorn.internal.runtime.ScriptRuntime -import javax.script.Invocable -class ScriptEngineNashorn : ScriptEngine { +class ScriptEngineNashorn : ScriptEngineWithTypedResult { private var savedState: Map? = null // TODO use "-strict" private val myEngine = NashornScriptEngineFactory().getScriptEngine("--language=es5", "--no-java", "--no-syntax-extensions") - @Suppress("UNCHECKED_CAST") - override fun eval(script: String): T { - return myEngine.eval(script) as T - } - - override fun evalVoid(script: String) { - myEngine.eval(script) - } + override fun eval(script: String): String = evalWithTypedResult(script).toString() @Suppress("UNCHECKED_CAST") - override fun callMethod(obj: Any, name: String, vararg args: Any?): T { - return (myEngine as Invocable).invokeMethod(obj, name, *args) as T + override fun evalWithTypedResult(script: String): R { + return myEngine.eval(script) as R } override fun loadFile(path: String) { - evalVoid("load('${path.replace('\\', '/')}');") + eval("load('${path.replace('\\', '/')}');") } - override fun release() {} - override fun releaseObject(t: T) {} + override fun reset() { + throw UnsupportedOperationException() + } + private fun getGlobalState(): MutableMap = evalWithTypedResult("this") - private fun getGlobalState(): MutableMap = eval("this") - - override fun saveState() { + override fun saveGlobalState() { savedState = getGlobalState().toMap() } - override fun restoreState() { + override fun restoreGlobalState() { val globalState = getGlobalState() val originalState = savedState!! for (key in globalState.keys) { globalState[key] = originalState[key] ?: ScriptRuntime.UNDEFINED } } -} \ No newline at end of file + + override fun release() { + } +} diff --git a/js/js.engines/src/org/jetbrains/kotlin/js/engine/ScriptEngineV8.kt b/js/js.engines/src/org/jetbrains/kotlin/js/engine/ScriptEngineV8.kt index 398a2ded22f..511d7420a35 100644 --- a/js/js.engines/src/org/jetbrains/kotlin/js/engine/ScriptEngineV8.kt +++ b/js/js.engines/src/org/jetbrains/kotlin/js/engine/ScriptEngineV8.kt @@ -1,98 +1,23 @@ /* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.js.engine -import com.eclipsesource.v8.V8 -import com.eclipsesource.v8.V8Array -import com.eclipsesource.v8.V8Object -import com.eclipsesource.v8.utils.V8ObjectUtils -import java.io.File +class ScriptEngineV8 : ProcessBasedScriptEngine(System.getProperty("javascript.engine.path.V8")) -class ScriptEngineV8(LIBRARY_PATH_BASE: String) : ScriptEngine { - - override fun releaseObject(t: T) { - (t as? V8Object)?.release() - } - - private var savedState: List? = null - - override fun restoreState() { - val scriptBuilder = StringBuilder() - - val globalState = getGlobalPropertyNames() - val originalState = savedState!! - for (key in globalState) { - if (key !in originalState) { - scriptBuilder.append("this['$key'] = void 0;\n") - } +fun main() { +// System.setProperty("javascript.engine.path.V8", "") + val vm = ScriptEngineV8() + println("Welcome!") + while (true) { + print("> ") + val t = readLine() + try { + println(vm.eval(t!!)) + } catch (e: Throwable) { + System.err.println(e) } - evalVoid(scriptBuilder.toString()) - } - - private fun getGlobalPropertyNames(): List { - val v8Array = eval("Object.getOwnPropertyNames(this)") - @Suppress("UNCHECKED_CAST") val javaArray = V8ObjectUtils.toList(v8Array) as List - v8Array.release() - return javaArray - } - - override fun saveState() { - if (savedState == null) { - savedState = getGlobalPropertyNames() - } - } - - private val myRuntime: V8 = V8.createV8Runtime("global", LIBRARY_PATH_BASE) - - @Suppress("UNCHECKED_CAST") - override fun eval(script: String): T { - return myRuntime.executeScript(script) as T - } - - override fun evalVoid(script: String) { - return myRuntime.executeVoidScript(script) - } - - @Suppress("UNCHECKED_CAST") - override fun callMethod(obj: Any, name: String, vararg args: Any?): T { - if (obj !is V8Object) { - throw Exception("InteropV8 can deal only with V8Object") - } - - val runtimeArray = V8Array(myRuntime) - val result = obj.executeFunction(name, runtimeArray) as T - runtimeArray.release() - return result - } - - override fun loadFile(path: String) { - myRuntime.executeVoidScript(File(path).bufferedReader().use { it.readText() }, path, 0) - } - - override fun release() { - myRuntime.release() } } - -class ScriptEngineV8Lazy(LIBRARY_PATH_BASE: String) : ScriptEngine { - override fun eval(script: String) = engine.eval(script) - - override fun saveState() = engine.saveState() - - override fun evalVoid(script: String) = engine.evalVoid(script) - - override fun callMethod(obj: Any, name: String, vararg args: Any?) = engine.callMethod(obj, name, args) - - override fun loadFile(path: String) = engine.loadFile(path) - - override fun release() = engine.release() - - override fun releaseObject(t: T) = engine.releaseObject(t) - - override fun restoreState() = engine.restoreState() - - private val engine by lazy { ScriptEngineV8(LIBRARY_PATH_BASE) } -} \ No newline at end of file diff --git a/js/js.engines/src/org/jetbrains/kotlin/js/engine/repl.js b/js/js.engines/src/org/jetbrains/kotlin/js/engine/repl.js new file mode 100644 index 00000000000..87f5158e964 --- /dev/null +++ b/js/js.engines/src/org/jetbrains/kotlin/js/engine/repl.js @@ -0,0 +1,101 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +// js/js.engines/src/org/jetbrains/kotlin/js/engine/repl.js + +/* +Some of non-standard APIs available in standalone JS engines: + + v8 sm jsc +load + + + load and evaluate a file +print + + + print to stdout +printErr + + + print to stderr +read + + + read a file as a text (v8, sm, jsc) or binary (sm, jsc) +readline + + + read line from stdin +readbuffer + - - read a binary file in v8 +quit + + + stop the process + +V8: +https://v8.dev/docs/d8 +https://github.com/v8/v8/blob/4b9b23521e6fd42373ebbcb20ebe03bf445494f9/src/d8.cc +https://riptutorial.com/v8/example/25393/useful-built-in-functions-and-objects-in-d8 + +SpiderMonkey: +https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Introduction_to_the_JavaScript_shell + +JavaScriptCore: +https://trac.webkit.org/wiki/JSC +https://github.com/WebKit/webkit/blob/master/Source/JavaScriptCore/jsc.cpp +*/ + +/** + * @type {number} + */ +let currentRealmIndex = Realm.current(); + +function resetRealm() { + if (currentRealmIndex !== 0) Realm.dispose(currentRealmIndex); + currentRealmIndex = Realm.createAllowCrossRealmAccess() +} + +/** + * @type {?Map} + */ +let globalState = null; + +function saveGlobalState() { + globalState = new Map(); + const currentGlobal = Realm.global(currentRealmIndex) + for (const k in currentGlobal) { + globalState.set(k, currentGlobal[k]); + } + + console.log(Array.from(globalState.entries())) +} + +function restoreGlobalState() { + if (globalState === null) throw Error("There is no saved state!") + + const currentGlobal = Realm.global(currentRealmIndex) + + console.log(Array.from(globalState.entries())) + + for (const k in currentGlobal) { + let prev = globalState.get(k); + if (prev !== currentGlobal[k]) { + currentGlobal[k] = prev; + } + } + globalState = null; +} + +// To prevent accessing to current global state +resetRealm(); + +// noinspection InfiniteLoopJS +while (true) { + let code = readline().replace(/\\n/g, '\n'); + + try { + switch (code) { + case "!reset": + resetRealm() + break; + case "!saveGlobalState": + saveGlobalState(); + break; + case "!restoreGlobalState": + restoreGlobalState(); + break; + default: + print(Realm.eval(currentRealmIndex, code)); + } + } catch(e) { + printErr(e.stack != null ? e.stack : e.toString()); + printErr('\nCODE:\n' + code); + } + + print(''); +} diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt index bbbeae12a19..93581764ea0 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt @@ -32,8 +32,7 @@ import org.jetbrains.kotlin.js.config.* import org.jetbrains.kotlin.js.dce.DeadCodeElimination import org.jetbrains.kotlin.js.dce.InputFile import org.jetbrains.kotlin.js.dce.InputResource -import org.jetbrains.kotlin.js.engine.ScriptEngineNashorn -import org.jetbrains.kotlin.js.engine.ScriptEngineV8Lazy +import org.jetbrains.kotlin.js.engine.loadFiles import org.jetbrains.kotlin.js.facade.* import org.jetbrains.kotlin.js.parser.parse import org.jetbrains.kotlin.js.parser.sourcemaps.SourceMapError @@ -878,9 +877,9 @@ abstract class BasicBoxTest( runList += allJsFiles.map { filesToMinify[it]?.outputPath ?: it } val result = engineForMinifier.runAndRestoreContext { - runList.forEach(this::loadFile) + loadFiles(runList) overrideAsserter() - eval(SETUP_KOTLIN_OUTPUT) + eval(SETUP_KOTLIN_OUTPUT) runTestFunction(testModuleName, testPackage, testFunction, withModuleSystem) } TestCase.assertEquals(expectedResult, result) @@ -1047,9 +1046,7 @@ abstract class BasicBoxTest( private const val OLD_MODULE_SUFFIX = "-old" const val KOTLIN_TEST_INTERNAL = "\$kotlin_test_internal\$" - private val engineForMinifier = - if (runTestInNashorn) ScriptEngineNashorn() - else ScriptEngineV8Lazy(KotlinTestUtils.tmpDirForReusableFolder("j2v8_library_path").path) + private val engineForMinifier = createScriptEngine() const val overwriteReachableNodesProperty = "kotlin.js.overwriteReachableNodes" } diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/JsTestChecker.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/JsTestChecker.kt index d5a8e06f490..54f3d77427e 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/JsTestChecker.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/JsTestChecker.kt @@ -1,22 +1,23 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.js.test +import com.intellij.openapi.util.text.StringUtil import org.jetbrains.kotlin.js.engine.ScriptEngine import org.jetbrains.kotlin.js.engine.ScriptEngineNashorn import org.jetbrains.kotlin.js.engine.ScriptEngineV8 -import org.jetbrains.kotlin.test.KotlinTestUtils +import org.jetbrains.kotlin.js.engine.loadFiles import org.junit.Assert fun createScriptEngine(): ScriptEngine { - return ScriptEngineNashorn() + return if (java.lang.Boolean.getBoolean("kotlin.js.useNashorn")) ScriptEngineNashorn() else ScriptEngineV8() } fun ScriptEngine.overrideAsserter() { - evalVoid("this['kotlin-test'].kotlin.test.overrideAsserter_wbnzx$(this['kotlin-test'].kotlin.test.DefaultAsserter);") + eval("this['kotlin-test'].kotlin.test.overrideAsserter_wbnzx$(this['kotlin-test'].kotlin.test.DefaultAsserter);") } fun ScriptEngine.runTestFunction( @@ -24,7 +25,7 @@ fun ScriptEngine.runTestFunction( testPackageName: String?, testFunctionName: String, withModuleSystem: Boolean -): String? { +): String { var script = when { withModuleSystem -> BasicBoxTest.KOTLIN_TEST_INTERNAL + ".require('" + testModuleName!! + "')" testModuleName === null -> "this" @@ -35,10 +36,9 @@ fun ScriptEngine.runTestFunction( script += ".$testPackageName" } - val testPackage = eval(script) - return callMethod(testPackage, testFunctionName).also { - releaseObject(testPackage) - } + script += ".$testFunctionName()" + + return eval(script) } abstract class AbstractJsTestChecker { @@ -51,7 +51,7 @@ abstract class AbstractJsTestChecker { withModuleSystem: Boolean ) { val actualResult = run(files, testModuleName, testPackageName, testFunctionName, withModuleSystem) - Assert.assertEquals(expectedResult, actualResult) + Assert.assertEquals(expectedResult, actualResult.normalize()) } private fun run( @@ -66,20 +66,28 @@ abstract class AbstractJsTestChecker { fun run(files: List) { - run(files) { null } + run(files) { "" } } - abstract fun checkStdout(files: List, expectedResult: String) + fun checkStdout(files: List, expectedResult: String) { + run(files) { + val actualResult = eval(GET_KOTLIN_OUTPUT) + Assert.assertEquals(expectedResult, actualResult.normalize()) + "" + } + } - protected abstract fun run(files: List, f: ScriptEngine.() -> Any?): Any? + private fun String.normalize() = StringUtil.convertLineSeparators(this) + + protected abstract fun run(files: List, f: ScriptEngine.() -> String): String } -fun ScriptEngine.runAndRestoreContext(f: ScriptEngine.() -> Any?): Any? { +fun ScriptEngine.runAndRestoreContext(f: ScriptEngine.() -> String): String { return try { - saveState() + saveGlobalState() f() } finally { - restoreState() + restoreGlobalState() } } @@ -96,7 +104,7 @@ abstract class AbstractNashornJsTestChecker : AbstractJsTestChecker() { protected open fun beforeRun() {} - override fun run(files: List, f: ScriptEngine.() -> Any?): Any? { + override fun run(files: List, f: ScriptEngine.() -> String): String { // Recreate the engine once in a while if (engineUsageCnt++ > 100) { engineUsageCnt = 0 @@ -106,23 +114,17 @@ abstract class AbstractNashornJsTestChecker : AbstractJsTestChecker() { beforeRun() return engine.runAndRestoreContext { - files.forEach { loadFile(it) } + loadFiles(files) f() } } - override fun checkStdout(files: List, expectedResult: String) { - run(files) - val actualResult = engine.eval(GET_KOTLIN_OUTPUT) - Assert.assertEquals(expectedResult, actualResult) - } - protected abstract val preloadedScripts: List protected open fun createScriptEngineForTest(): ScriptEngineNashorn { val engine = ScriptEngineNashorn() - preloadedScripts.forEach { engine.loadFile(it) } + engine.loadFiles(preloadedScripts) return engine } @@ -134,7 +136,7 @@ const val GET_KOTLIN_OUTPUT = "kotlin.kotlin.io.output.buffer;" object NashornJsTestChecker : AbstractNashornJsTestChecker() { override fun beforeRun() { - engine.evalVoid(SETUP_KOTLIN_OUTPUT) + engine.eval(SETUP_KOTLIN_OUTPUT) } override val preloadedScripts = listOf( @@ -159,69 +161,50 @@ class NashornIrJsTestChecker : AbstractNashornJsTestChecker() { ) } -abstract class AbstractV8JsTestChecker : AbstractJsTestChecker() { - protected abstract val engine: ScriptEngineV8 +object V8JsTestChecker : AbstractJsTestChecker() { + private val engineTL = object : ThreadLocal() { + override fun initialValue() = + ScriptEngineV8().apply { + val preloadedScripts = listOf( + BasicBoxTest.DIST_DIR_JS_PATH + "kotlin.js", + BasicBoxTest.DIST_DIR_JS_PATH + "kotlin-test.js" + ) + loadFiles(preloadedScripts) - override fun checkStdout(files: List, expectedResult: String) { - run(files) { - val actualResult = engine.eval(GET_KOTLIN_OUTPUT) - Assert.assertEquals(expectedResult, actualResult) - } - } -} + overrideAsserter() + } -object V8JsTestChecker : AbstractV8JsTestChecker() { - override val engine get() = tlsEngine.get() - - private val tlsEngine = object : ThreadLocal() { - override fun initialValue() = createV8Engine() override fun remove() { get().release() } } - private fun createV8Engine(): ScriptEngineV8 { - val v8 = ScriptEngineV8(KotlinTestUtils.tmpDirForReusableFolder("j2v8_library_path").path) + private val engine get() = engineTL.get() - listOf( - BasicBoxTest.DIST_DIR_JS_PATH + "kotlin.js", - BasicBoxTest.DIST_DIR_JS_PATH + "kotlin-test.js" - ).forEach { v8.loadFile(it) } - - v8.overrideAsserter() - - return v8 - } - - override fun run(files: List, f: ScriptEngine.() -> Any?): Any? { - engine.evalVoid(SETUP_KOTLIN_OUTPUT) + override fun run(files: List, f: ScriptEngine.() -> String): String { + engine.eval(SETUP_KOTLIN_OUTPUT) return engine.runAndRestoreContext { - files.forEach { loadFile(it) } + loadFiles(files) f() } } } -object V8IrJsTestChecker : AbstractV8JsTestChecker() { - override val engine get() = ScriptEngineV8(KotlinTestUtils.tmpDirForReusableFolder("j2v8_library_path").path) - - override fun run(files: List, f: ScriptEngine.() -> Any?): Any? { - - val v8 = engine - - val v = try { - files.forEach { v8.loadFile(it) } - v8.f() - } catch (t: Throwable) { - try { - v8.release() - } finally { - // Don't mask the original exception - throw t - } +object V8IrJsTestChecker : AbstractJsTestChecker() { + private val engineTL = object : ThreadLocal() { + override fun initialValue() = ScriptEngineV8() + override fun remove() { + get().release() } - v8.release() - - return v } -} \ No newline at end of file + + override fun run(files: List, f: ScriptEngine.() -> String): String { + val engine = engineTL.get() + return try { + engine.loadFiles(files) + engine.f() + } finally { + engine.reset() + } + } +} diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/optimizer/BasicOptimizerTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/optimizer/BasicOptimizerTest.kt index 900de61b370..90429adbfe6 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/optimizer/BasicOptimizerTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/optimizer/BasicOptimizerTest.kt @@ -1,17 +1,6 @@ /* - * Copyright 2010-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.js.test.optimizer @@ -128,8 +117,8 @@ abstract class BasicOptimizerTest(private var basePath: String) { private fun runScript(fileName: String, code: String) { val engine = createScriptEngine() - engine.evalVoid(code) - val result = engine.eval("box()") + engine.eval(code) + val result = engine.eval("box()") Assert.assertEquals("$fileName: box() function must return 'OK'", "OK", result) } diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/AbstractWebDemoExamplesTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/AbstractWebDemoExamplesTest.kt index d6cd283d091..0c42c7c4567 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/AbstractWebDemoExamplesTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/AbstractWebDemoExamplesTest.kt @@ -1,15 +1,14 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.js.test.semantics -import com.eclipsesource.v8.V8ScriptException import com.google.common.collect.Lists import com.intellij.openapi.util.text.StringUtil import org.jetbrains.kotlin.js.facade.MainCallParameters -import org.jetbrains.kotlin.js.test.* +import org.jetbrains.kotlin.js.test.BasicBoxTest import java.io.File import javax.script.ScriptException @@ -29,7 +28,7 @@ abstract class AbstractWebDemoExamplesTest(relativePath: String) : BasicBoxTest( testChecker.checkStdout(jsFiles, expectedResult) } - @Throws(ScriptException::class, V8ScriptException::class) + @Throws(ScriptException::class) protected fun runMainAndCheckOutput(fileName: String, expectedResult: String, vararg args: String) { doTest(pathToTestDir + fileName, expectedResult, MainCallParameters.mainWithArguments(Lists.newArrayList(*args))) } @@ -38,4 +37,4 @@ abstract class AbstractWebDemoExamplesTest(relativePath: String) : BasicBoxTest( val expectedResult = StringUtil.convertLineSeparators(File(pathToTestDir + testName + testId + ".out").readText()) doTest(pathToTestDir + testName + ".kt", expectedResult, MainCallParameters.mainWithArguments(Lists.newArrayList(*args))) } -} \ No newline at end of file +} diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/MultiModuleOrderTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/MultiModuleOrderTest.kt index 6cdcb0ff9af..01576d5c1b5 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/MultiModuleOrderTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/MultiModuleOrderTest.kt @@ -1,22 +1,10 @@ /* - * Copyright 2010-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.js.test.semantics -import com.eclipsesource.v8.V8ScriptException import org.jetbrains.kotlin.js.test.BasicBoxTest import java.io.File import javax.script.ScriptException @@ -47,7 +35,7 @@ class MultiModuleOrderTest : BasicBoxTest(pathToTestGroupDir, testGroupDir) { testChecker.run(listOf(mainJsFile, libJsFile)) } catch (e: RuntimeException) { - assertTrue(e is ScriptException || e is V8ScriptException) + assertTrue(e is ScriptException || e is IllegalStateException) val message = e.message!! assertTrue("Exception message should contain reference to dependency (lib)", "'lib'" in message) assertTrue("Exception message should contain reference to module that failed to load (main)", "'main'" in message) diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/WebDemoCanvasExamplesTest.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/WebDemoCanvasExamplesTest.java index 7ab7b229db8..f3e48107062 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/WebDemoCanvasExamplesTest.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/WebDemoCanvasExamplesTest.java @@ -1,22 +1,10 @@ /* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.js.test.semantics; -import com.eclipsesource.v8.V8ScriptException; import org.jetbrains.annotations.NotNull; import javax.script.ScriptException; @@ -55,16 +43,16 @@ public final class WebDemoCanvasExamplesTest extends AbstractWebDemoExamplesTest catch (ScriptException e) { verifyException("\"" + firstUnknownSymbolEncountered + "\"", e.getMessage()); } - catch (V8ScriptException e) { - verifyException(firstUnknownSymbolEncountered, e.getJSMessage()); + catch (IllegalStateException e) { + verifyException(firstUnknownSymbolEncountered, e.getMessage()); } } private static void verifyException(@NotNull String firstUnknownSymbolEncountered, @NotNull String message) { String expectedErrorMessage = "ReferenceError: " + firstUnknownSymbolEncountered + " is not defined"; assertTrue("Unexpected error when running compiled canvas examples with rhino.\n" + - "Expected: " + expectedErrorMessage + "\n" + - "Actual: " + message, - message.startsWith(expectedErrorMessage)); + "Expected message contains \"" + expectedErrorMessage + "\".\n" + + "Message: " + message, + message.contains(expectedErrorMessage)); } } diff --git a/libraries/scripting/js/src/org/jetbrains/kotlin/scripting/repl/js/JsReplEvaluator.kt b/libraries/scripting/js/src/org/jetbrains/kotlin/scripting/repl/js/JsReplEvaluator.kt index 0d221f19403..4e30e0dcb14 100644 --- a/libraries/scripting/js/src/org/jetbrains/kotlin/scripting/repl/js/JsReplEvaluator.kt +++ b/libraries/scripting/js/src/org/jetbrains/kotlin/scripting/repl/js/JsReplEvaluator.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -21,7 +21,7 @@ class JsReplEvaluator : ReplEvaluator { ): ReplEvalResult { return try { val evaluationState = state.asState(JsEvaluationState::class.java) - val evalResult = evaluationState.engine.eval(compileResult.data as String) + val evalResult = evaluationState.engine.evalWithTypedResult(compileResult.data as String) ReplEvalResult.ValueResult("result", evalResult, "Any?") } catch (e: Exception) { ReplEvalResult.Error.Runtime("Error while evaluating", e) diff --git a/libraries/scripting/js/src/org/jetbrains/kotlin/scripting/repl/js/JsReplUtils.kt b/libraries/scripting/js/src/org/jetbrains/kotlin/scripting/repl/js/JsReplUtils.kt index d0c35af5172..6fe2772dbd3 100644 --- a/libraries/scripting/js/src/org/jetbrains/kotlin/scripting/repl/js/JsReplUtils.kt +++ b/libraries/scripting/js/src/org/jetbrains/kotlin/scripting/repl/js/JsReplUtils.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -9,7 +9,7 @@ import org.jetbrains.kotlin.cli.common.repl.* import org.jetbrains.kotlin.descriptors.ModuleDescriptor import org.jetbrains.kotlin.descriptors.ScriptDescriptor import org.jetbrains.kotlin.ir.backend.js.utils.NameTables -import org.jetbrains.kotlin.js.engine.ScriptEngine +import org.jetbrains.kotlin.js.engine.ScriptEngineWithTypedResult import java.util.concurrent.locks.ReentrantReadWriteLock import kotlin.reflect.KClass import kotlin.script.experimental.api.CompiledScript @@ -31,9 +31,9 @@ abstract class JsCompilationState( val nameTables: NameTables, val dependencies: List) : JsState(lock) -class JsEvaluationState(lock: ReentrantReadWriteLock, val engine: ScriptEngine) : JsState(lock) { +class JsEvaluationState(lock: ReentrantReadWriteLock, val engine: ScriptEngineWithTypedResult) : JsState(lock) { override fun dispose() { - engine.release() + engine.reset() } } diff --git a/libraries/scripting/js/src/org/jetbrains/kotlin/scripting/repl/js/JsScriptEvaluator.kt b/libraries/scripting/js/src/org/jetbrains/kotlin/scripting/repl/js/JsScriptEvaluator.kt index 28479d88a91..34375780fa8 100644 --- a/libraries/scripting/js/src/org/jetbrains/kotlin/scripting/repl/js/JsScriptEvaluator.kt +++ b/libraries/scripting/js/src/org/jetbrains/kotlin/scripting/repl/js/JsScriptEvaluator.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -17,7 +17,7 @@ class JsScriptEvaluator : ScriptEvaluator { scriptEvaluationConfiguration: ScriptEvaluationConfiguration ): ResultWithDiagnostics { return try { - val evalResult = engine.eval((compiledScript as JsCompiledScript).jsCode) + val evalResult = engine.evalWithTypedResult((compiledScript as JsCompiledScript).jsCode) ResultWithDiagnostics.Success( EvaluationResult( ResultValue.Value( From 7ca54ec4058e4de0a96b86faa1057faa74672be1 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Wed, 3 Jun 2020 00:05:54 +0300 Subject: [PATCH 476/698] [JS IR] unmute test arraySort.kt --- js/js.translator/testData/box/standardClasses/arraySort.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/js/js.translator/testData/box/standardClasses/arraySort.kt b/js/js.translator/testData/box/standardClasses/arraySort.kt index 1eba9ad22af..70e3a4913db 100644 --- a/js/js.translator/testData/box/standardClasses/arraySort.kt +++ b/js/js.translator/testData/box/standardClasses/arraySort.kt @@ -1,6 +1,4 @@ // KJS_WITH_FULL_RUNTIME -// IGNORE_BACKEND: JS_IR -// IGNORE_BACKEND: JS_IR_ES6 // EXPECTED_REACHABLE_NODES: 1284 package foo From e5c62c38389232da0f889ab887ddeb344b80d940 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Wed, 3 Jun 2020 03:45:46 +0300 Subject: [PATCH 477/698] [JS] Disable special checks in labeled-block-to-do-while --- .../labeled-block-to-do-while/simple.optimized.js | 14 ++++++++------ .../labeled-block-to-do-while/simple.original.js | 14 ++++++++------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/js/js.translator/testData/js-optimizer/labeled-block-to-do-while/simple.optimized.js b/js/js.translator/testData/js-optimizer/labeled-block-to-do-while/simple.optimized.js index 584040072bf..8cd81340c63 100644 --- a/js/js.translator/testData/js-optimizer/labeled-block-to-do-while/simple.optimized.js +++ b/js/js.translator/testData/js-optimizer/labeled-block-to-do-while/simple.optimized.js @@ -7,12 +7,14 @@ function box() { var f = functions[i]; var result = f(); - if (f.toString().indexOf("label: do {") < 0) { - // http://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8177691 - if (result === "OK") return "Looks like JDK-8177691 fixed for " + f; - if (result !== void 0) return "Result of function changed: " + f; - } - else if (result !== "OK") { + // Disabled check to run js optimizer tests using V8. + // Created the issue KT-39337 to address it separately. + // if (f.toString().indexOf("label: do {") < 0) { + // // See http://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8177691 + // if (result === "OK") return "Looks like JDK-8177691 fixed for " + f; + // if (result !== void 0) return "Result of function changed: " + f; + // } + if (result !== "OK") { return "fail on " + f } } diff --git a/js/js.translator/testData/js-optimizer/labeled-block-to-do-while/simple.original.js b/js/js.translator/testData/js-optimizer/labeled-block-to-do-while/simple.original.js index 6ac8d9f2c97..d1511616fe0 100644 --- a/js/js.translator/testData/js-optimizer/labeled-block-to-do-while/simple.original.js +++ b/js/js.translator/testData/js-optimizer/labeled-block-to-do-while/simple.original.js @@ -7,12 +7,14 @@ function box() { var f = functions[i]; var result = f(); - if (f.toString().indexOf("label: do {") < 0) { - // See http://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8177691 - if (result === "OK") return "Looks like JDK-8177691 fixed for " + f; - if (result !== void 0) return "Result of function changed: " + f; - } - else if (result !== "OK") { + // Disabled check to run js optimizer tests using V8. + // Created the issue KT-39337 to address it separately. + // if (f.toString().indexOf("label: do {") < 0) { + // // See http://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8177691 + // if (result === "OK") return "Looks like JDK-8177691 fixed for " + f; + // if (result !== void 0) return "Result of function changed: " + f; + // } + if (result !== "OK") { return "fail on " + f } } From 1d51dffd768340e00893585f8b62aba300a9ea56 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Wed, 18 Nov 2020 13:21:52 +0300 Subject: [PATCH 478/698] Reminder about -Pidea.fir.plugin=true for running fir-idea tests --- idea/idea-fir-performance-tests/build.gradle.kts | 11 +++++++---- idea/idea-fir/build.gradle.kts | 11 +++++++---- idea/idea-frontend-fir/build.gradle.kts | 11 +++++++---- .../idea-fir-low-level-api/build.gradle.kts | 11 +++++++---- 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/idea/idea-fir-performance-tests/build.gradle.kts b/idea/idea-fir-performance-tests/build.gradle.kts index 5e390461d87..76ba999be43 100644 --- a/idea/idea-fir-performance-tests/build.gradle.kts +++ b/idea/idea-fir-performance-tests/build.gradle.kts @@ -37,10 +37,13 @@ sourceSets { "test" { projectDefault() } } -if (kotlinBuildProperties.useFirIdeaPlugin) { - projectTest(parallel = true) { - dependsOn(":dist") - workingDir = rootDir +projectTest(parallel = true) { + dependsOn(":dist") + workingDir = rootDir + doFirst { + if (!kotlinBuildProperties.useFirIdeaPlugin) { + error("Test task in the module should be executed with -Pidea.fir.plugin=true") + } } } diff --git a/idea/idea-fir/build.gradle.kts b/idea/idea-fir/build.gradle.kts index e90d560910b..71c7e9e39f2 100644 --- a/idea/idea-fir/build.gradle.kts +++ b/idea/idea-fir/build.gradle.kts @@ -34,10 +34,13 @@ sourceSets { "test" { projectDefault() } } -if (kotlinBuildProperties.useFirIdeaPlugin) { - projectTest(parallel = true) { - dependsOn(":dist") - workingDir = rootDir +projectTest(parallel = true) { + dependsOn(":dist") + workingDir = rootDir + doFirst { + if (!kotlinBuildProperties.useFirIdeaPlugin) { + error("Test task in the module should be executed with -Pidea.fir.plugin=true") + } } } diff --git a/idea/idea-frontend-fir/build.gradle.kts b/idea/idea-frontend-fir/build.gradle.kts index fc1a1dbdfe5..1f29a646041 100644 --- a/idea/idea-frontend-fir/build.gradle.kts +++ b/idea/idea-frontend-fir/build.gradle.kts @@ -41,10 +41,13 @@ sourceSets { "test" { projectDefault() } } -if (kotlinBuildProperties.useFirIdeaPlugin) { - projectTest { - dependsOn(":dist") - workingDir = rootDir +projectTest { + dependsOn(":dist") + workingDir = rootDir + doFirst { + if (!kotlinBuildProperties.useFirIdeaPlugin) { + error("Test task in the module should be executed with -Pidea.fir.plugin=true") + } } } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/build.gradle.kts b/idea/idea-frontend-fir/idea-fir-low-level-api/build.gradle.kts index 1afaef59769..33d9bcee2f3 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/build.gradle.kts +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/build.gradle.kts @@ -44,10 +44,13 @@ sourceSets { "test" { projectDefault() } } -if (kotlinBuildProperties.useFirIdeaPlugin) { - projectTest { - dependsOn(":dist") - workingDir = rootDir +projectTest { + dependsOn(":dist") + workingDir = rootDir + doFirst { + if (!kotlinBuildProperties.useFirIdeaPlugin) { + error("Test task in the module should be executed with -Pidea.fir.plugin=true") + } } } From b6d80a11498483b9c2fb7b66cb25159a918b15ab Mon Sep 17 00:00:00 2001 From: Vyacheslav Gerasimov Date: Mon, 7 Dec 2020 15:58:27 +0300 Subject: [PATCH 479/698] Build: Fix kotlin-compiler-internal-test-framework empty sources jar Should also pack pack test source set from :compiler:tests-common --- .../build.gradle.kts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/prepare/kotlin-compiler-internal-test-framework/build.gradle.kts b/prepare/kotlin-compiler-internal-test-framework/build.gradle.kts index a726d6e6031..6f57e54f2c7 100644 --- a/prepare/kotlin-compiler-internal-test-framework/build.gradle.kts +++ b/prepare/kotlin-compiler-internal-test-framework/build.gradle.kts @@ -11,5 +11,11 @@ dependencies { publish() runtimeJar() -sourcesJar() + +sourcesJar { + from { + project(":compiler:tests-common").sourceSets["test"].allSource + } +} + javadocJar() From a671054fa32f991bb4ebde2cf5aa1ac915f0337e Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Sun, 6 Dec 2020 17:12:21 +0100 Subject: [PATCH 480/698] FIR IDE: change until-build to 203.* in plugin.xml --- idea/resources-fir/META-INF/plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/idea/resources-fir/META-INF/plugin.xml b/idea/resources-fir/META-INF/plugin.xml index 80f50a1d5d6..6b3ef0cbfc4 100644 --- a/idea/resources-fir/META-INF/plugin.xml +++ b/idea/resources-fir/META-INF/plugin.xml @@ -13,7 +13,7 @@ The Kotlin FIR plugin provides language support in IntelliJ IDEA and Android Stu @snapshot@ JetBrains - + com.intellij.modules.platform From d6330337a988200443c66c23ec6f2ed194e502a3 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Sun, 6 Dec 2020 17:30:43 +0100 Subject: [PATCH 481/698] FIR IDE: introduce param for enabling disabled tests --- .../tests/org/jetbrains/kotlin/test/uitls/IgnoreTests.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/idea/idea-frontend-independent/tests/org/jetbrains/kotlin/test/uitls/IgnoreTests.kt b/idea/idea-frontend-independent/tests/org/jetbrains/kotlin/test/uitls/IgnoreTests.kt index 8e37b2b02a0..54908b64f08 100644 --- a/idea/idea-frontend-independent/tests/org/jetbrains/kotlin/test/uitls/IgnoreTests.kt +++ b/idea/idea-frontend-independent/tests/org/jetbrains/kotlin/test/uitls/IgnoreTests.kt @@ -11,6 +11,7 @@ import java.nio.file.Path object IgnoreTests { private const val INSERT_DIRECTIVE_AUTOMATICALLY = false // TODO use environment variable instead + private const val ALWAYS_CONSIDER_TEST_AS_PASSING = false // TODO use environment variable instead fun runTestIfEnabledByFileDirective( testFile: Path, @@ -46,6 +47,11 @@ object IgnoreTests { additionalFilesExtensions: List, test: () -> Unit ) { + if (ALWAYS_CONSIDER_TEST_AS_PASSING) { + test() + return + } + val testIsEnabled = directive.isEnabledInFile(testFile) try { From 0dc5f3ac0022e458c9df23ed8e3134468e9d7aab Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Mon, 7 Dec 2020 15:13:54 +0100 Subject: [PATCH 482/698] IC: call JvmDefault method of inline class using boxed receiver #KT-43698 Fixed --- .../kotlin/codegen/CallableMethod.kt | 6 +- .../kotlin/codegen/state/KotlinTypeMapper.kt | 37 +++++-- .../ir/FirBlackBoxCodegenTestGenerated.java | 20 ++++ .../javaDefaultMethod.kt | 3 - .../javaDefaultMethodOverriddenByKotlin.kt | 3 - .../jvmDefaultAll.kt | 3 - .../jvmDefaultAllPrimaryProperty.kt | 3 - .../jvmDefaultAllProperty.kt | 3 - .../jvmDefaultEnable.kt | 3 - .../jvmDefaultEnablePrimaryProperty.kt | 3 - .../jvmDefaultEnableProperty.kt | 3 - .../jvmDefaultGeneric.kt | 16 +++ .../jvmDefaultSafeCall.kt | 14 +++ .../jvmDefaultSmartCast.kt | 16 +++ .../jvmDefaultSuspend.kt | 28 +++++ .../interfaceJvmDefaultImplStubs.kt | 4 - .../codegen/BlackBoxCodegenTestGenerated.java | 20 ++++ .../LightAnalysisModeTestGenerated.java | 100 +++++++++++------- .../ir/IrBlackBoxCodegenTestGenerated.java | 20 ++++ 19 files changed, 227 insertions(+), 78 deletions(-) create mode 100644 compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultGeneric.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultSafeCall.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultSmartCast.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultSuspend.kt diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/CallableMethod.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/CallableMethod.kt index ef1c6f9f15e..bad19c172b0 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/CallableMethod.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/CallableMethod.kt @@ -29,7 +29,8 @@ class CallableMethod( override val generateCalleeType: Type?, override val returnKotlinType: KotlinType?, val isInterfaceMethod: Boolean, - private val isDefaultMethodInInterface: Boolean + private val isDefaultMethodInInterface: Boolean, + private val boxInlineClassBeforeInvoke: Boolean ) : Callable { private val defaultImplMethod: Method by lazy(LazyThreadSafetyMode.PUBLICATION, computeDefaultMethod) @@ -49,6 +50,9 @@ class CallableMethod( get() = getAsmMethod().argumentTypes override fun genInvokeInstruction(v: InstructionAdapter) { + if (boxInlineClassBeforeInvoke) { + StackValue.boxInlineClass(dispatchReceiverKotlinType!!, v) + } v.visitMethodInsn( invokeOpcode, owner.internalName, diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt index d490572bc3c..f9324d61432 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt @@ -379,7 +379,8 @@ class KotlinTypeMapper @JvmOverloads constructor( val originalDescriptor = descriptor.original return CallableMethod( owner, owner, { mapDefaultMethod(originalDescriptor, OwnerKind.IMPLEMENTATION) }, method, INVOKESPECIAL, - null, null, null, null, null, originalDescriptor.returnType, isInterfaceMethod = false, isDefaultMethodInInterface = false + null, null, null, null, null, originalDescriptor.returnType, isInterfaceMethod = false, isDefaultMethodInInterface = false, + boxInlineClassBeforeInvoke = false ) } @@ -402,6 +403,7 @@ class KotlinTypeMapper @JvmOverloads constructor( val dispatchReceiverKotlinType: KotlinType? var isInterfaceMember = false var isDefaultMethodInInterface = false + var boxInlineClassBeforeInvoke = false if (functionParent is ClassDescriptor) { val declarationFunctionDescriptor = findAnyDeclaration(functionDescriptor) @@ -452,11 +454,15 @@ class KotlinTypeMapper @JvmOverloads constructor( functionDescriptor = descriptor } - val isStaticInvocation = - isStaticDeclaration(functionDescriptor) && functionDescriptor !is ImportedFromObjectCallableDescriptor<*> || - isStaticAccessor(functionDescriptor) || - functionDescriptor.isJvmStaticInObjectOrClassOrInterface() || - toInlinedErasedClass + val isFakeOverrideOfJvmDefault = toInlinedErasedClass && + functionDescriptor.kind == CallableMemberDescriptor.Kind.FAKE_OVERRIDE && + functionDescriptor.overridesJvmDefault() + + val isStaticInvocation = !isFakeOverrideOfJvmDefault && + (isStaticDeclaration(functionDescriptor) && functionDescriptor !is ImportedFromObjectCallableDescriptor<*> || + isStaticAccessor(functionDescriptor) || + functionDescriptor.isJvmStaticInObjectOrClassOrInterface() || + toInlinedErasedClass) when { isStaticInvocation -> { invokeOpcode = INVOKESTATIC @@ -466,8 +472,13 @@ class KotlinTypeMapper @JvmOverloads constructor( invokeOpcode = INVOKEINTERFACE isInterfaceMember = true } + isFakeOverrideOfJvmDefault -> { + invokeOpcode = INVOKEVIRTUAL + boxInlineClassBeforeInvoke = true + } else -> { - val isPrivateFunInvocation = DescriptorVisibilities.isPrivate(functionDescriptor.visibility) && !functionDescriptor.isSuspend + val isPrivateFunInvocation = + DescriptorVisibilities.isPrivate(functionDescriptor.visibility) && !functionDescriptor.isSuspend invokeOpcode = if (superCall || isPrivateFunInvocation) INVOKESPECIAL else INVOKEVIRTUAL isInterfaceMember = false } @@ -479,7 +490,7 @@ class KotlinTypeMapper @JvmOverloads constructor( else functionDescriptor.original - signature = if (toInlinedErasedClass) + signature = if (toInlinedErasedClass && !isFakeOverrideOfJvmDefault) mapSignatureForInlineErasedClassSkipGeneric(functionToCall) else mapSignature( @@ -547,10 +558,18 @@ class KotlinTypeMapper @JvmOverloads constructor( signature, invokeOpcode, thisClass, dispatchReceiverKotlinType, receiverParameterType, extensionReceiverKotlinType, calleeType, returnKotlinType, if (jvmTarget >= JvmTarget.JVM_1_8) isInterfaceMember else invokeOpcode == INVOKEINTERFACE, - isDefaultMethodInInterface + isDefaultMethodInInterface, boxInlineClassBeforeInvoke ) } + private fun CallableMemberDescriptor.overridesJvmDefault(): Boolean { + if (kind == CallableMemberDescriptor.Kind.FAKE_OVERRIDE) { + return overriddenDescriptors.any { it.overridesJvmDefault() } + } + if (isCompiledToJvmDefault(jvmDefaultMode)) return true + return (containingDeclaration as? JavaClassDescriptor)?.kind == ClassKind.INTERFACE && modality != Modality.ABSTRACT + } + fun mapFunctionName(descriptor: FunctionDescriptor, kind: OwnerKind?): String { if (descriptor !is JavaCallableMemberDescriptor) { val platformName = getJvmName(descriptor) diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 85fd78ff175..27b1a4b67fd 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -15235,6 +15235,26 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT public void testJvmDefaultEnableProperty() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnableProperty.kt"); } + + @TestMetadata("jvmDefaultGeneric.kt") + public void testJvmDefaultGeneric() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultGeneric.kt"); + } + + @TestMetadata("jvmDefaultSafeCall.kt") + public void testJvmDefaultSafeCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultSafeCall.kt"); + } + + @TestMetadata("jvmDefaultSmartCast.kt") + public void testJvmDefaultSmartCast() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultSmartCast.kt"); + } + + @TestMetadata("jvmDefaultSuspend.kt") + public void testJvmDefaultSuspend() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultSuspend.kt"); + } } @TestMetadata("compiler/testData/codegen/box/inlineClasses/propertyDelegation") diff --git a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethod.kt b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethod.kt index c0cfa2a8fee..5ac8bf8e81f 100644 --- a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethod.kt +++ b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethod.kt @@ -1,7 +1,4 @@ // TARGET_BACKEND: JVM -// IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: JVM -// ^ KT-43698, fixed in JVM_IR // JVM_TARGET: 1.8 // FILE: javaDefaultMethod.kt inline class K(val k: String) : J { diff --git a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethodOverriddenByKotlin.kt b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethodOverriddenByKotlin.kt index 02ac7ea6202..841caea6370 100644 --- a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethodOverriddenByKotlin.kt +++ b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethodOverriddenByKotlin.kt @@ -1,7 +1,4 @@ // TARGET_BACKEND: JVM -// IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: JVM -// ^ KT-43698, fixed in JVM_IR // JVM_TARGET: 1.8 // FILE: javaDefaultMethod.kt interface K2 : J { diff --git a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAll.kt b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAll.kt index 3c40e5857ee..982fd903f4b 100644 --- a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAll.kt +++ b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAll.kt @@ -1,8 +1,5 @@ // !JVM_DEFAULT_MODE: all // TARGET_BACKEND: JVM -// IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: JVM -// ^ KT-43698, fixed in JVM_IR // WITH_RUNTIME // JVM_TARGET: 1.8 // FILE: jvmDefaultAll.kt diff --git a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllPrimaryProperty.kt b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllPrimaryProperty.kt index 0258f121629..60c3c31c0b9 100644 --- a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllPrimaryProperty.kt +++ b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllPrimaryProperty.kt @@ -1,8 +1,5 @@ // !JVM_DEFAULT_MODE: all // TARGET_BACKEND: JVM -// IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: JVM -// ^ KT-43698, fixed in JVM_IR // WITH_RUNTIME // JVM_TARGET: 1.8 // FILE: jvmDefaultAll.kt diff --git a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllProperty.kt b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllProperty.kt index 6932507a332..3e6073335c7 100644 --- a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllProperty.kt +++ b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllProperty.kt @@ -1,8 +1,5 @@ // !JVM_DEFAULT_MODE: all // TARGET_BACKEND: JVM -// IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: JVM -// ^ KT-43698, fixed in JVM_IR // WITH_RUNTIME // JVM_TARGET: 1.8 // FILE: jvmDefaultAll.kt diff --git a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnable.kt b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnable.kt index ab633f270fd..cb5146a2de9 100644 --- a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnable.kt +++ b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnable.kt @@ -1,8 +1,5 @@ // !JVM_DEFAULT_MODE: enable // TARGET_BACKEND: JVM -// IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: JVM -// ^ KT-43698, fixed in JVM_IR // WITH_RUNTIME // JVM_TARGET: 1.8 // FILE: jvmDefaultEnable.kt diff --git a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnablePrimaryProperty.kt b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnablePrimaryProperty.kt index c89f86e2d83..61f78c66454 100644 --- a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnablePrimaryProperty.kt +++ b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnablePrimaryProperty.kt @@ -1,8 +1,5 @@ // !JVM_DEFAULT_MODE: enable // TARGET_BACKEND: JVM -// IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: JVM -// ^ KT-43698, fixed in JVM_IR // WITH_RUNTIME // JVM_TARGET: 1.8 // FILE: jvmDefaultEnable.kt diff --git a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnableProperty.kt b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnableProperty.kt index 3e04523b893..7259e2d0952 100644 --- a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnableProperty.kt +++ b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnableProperty.kt @@ -1,8 +1,5 @@ // !JVM_DEFAULT_MODE: enable // TARGET_BACKEND: JVM -// IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: JVM -// ^ KT-43698, fixed in JVM_IR // WITH_RUNTIME // JVM_TARGET: 1.8 // FILE: jvmDefaultEnable.kt diff --git a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultGeneric.kt b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultGeneric.kt new file mode 100644 index 00000000000..968baae4f5a --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultGeneric.kt @@ -0,0 +1,16 @@ +// !JVM_DEFAULT_MODE: all +// TARGET_BACKEND: JVM +// WITH_RUNTIME +// JVM_TARGET: 1.8 + +class Cell(val x: T) + +interface IOk { + fun ok(): String = "OK" +} + +inline class InlineClass(val s: String) : IOk + +fun test(cell: Cell): String = cell.x.ok() + +fun box() = test(Cell(InlineClass("FAIL"))) diff --git a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultSafeCall.kt b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultSafeCall.kt new file mode 100644 index 00000000000..eb88d38a2f7 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultSafeCall.kt @@ -0,0 +1,14 @@ +// !JVM_DEFAULT_MODE: all +// TARGET_BACKEND: JVM +// WITH_RUNTIME +// JVM_TARGET: 1.8 + +interface IOk { + fun ok(): String = "OK" +} + +inline class InlineClass(val s: String) : IOk + +fun test(x: InlineClass?) = x?.ok() ?: "Failed" + +fun box() = test(InlineClass("")) diff --git a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultSmartCast.kt b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultSmartCast.kt new file mode 100644 index 00000000000..9dbb31e7c3a --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultSmartCast.kt @@ -0,0 +1,16 @@ +// !JVM_DEFAULT_MODE: all +// TARGET_BACKEND: JVM +// WITH_RUNTIME +// JVM_TARGET: 1.8 + +interface IOk { + fun ok(): String = "OK" +} + +inline class InlineClass(val s: String) : IOk + +fun test(x: Any): String { + return if (x is InlineClass) x.ok() else "FAIL" +} + +fun box() = test(InlineClass("Dummy")) diff --git a/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultSuspend.kt b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultSuspend.kt new file mode 100644 index 00000000000..883bb3b447b --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultSuspend.kt @@ -0,0 +1,28 @@ +// !JVM_DEFAULT_MODE: all +// TARGET_BACKEND: JVM +// WITH_RUNTIME +// JVM_TARGET: 1.8 + +import kotlin.coroutines.* + +interface IOk { + fun ok(): String = "OK" +} + +inline class InlineClass(val s: String) : IOk + +suspend fun returnsUnboxed() = InlineClass("") + +suspend fun test(): String = returnsUnboxed().ok() + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(Continuation(EmptyCoroutineContext) {}) +} + +fun box(): String { + var res = "FAIL" + builder { + res = test() + } + return res +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/inlineClasses/interfaceJvmDefaultImplStubs.kt b/compiler/testData/codegen/bytecodeText/inlineClasses/interfaceJvmDefaultImplStubs.kt index 41c38966dc0..c6e344b8c4b 100644 --- a/compiler/testData/codegen/bytecodeText/inlineClasses/interfaceJvmDefaultImplStubs.kt +++ b/compiler/testData/codegen/bytecodeText/inlineClasses/interfaceJvmDefaultImplStubs.kt @@ -1,9 +1,5 @@ // !LANGUAGE: +InlineClasses // IGNORE_BACKEND_FIR: JVM_IR - -// IGNORE_BACKEND: JVM -// The JVM backend does not generate the g-impl method, but ends up calling it from box. - // !JVM_DEFAULT_MODE: enable // JVM_TARGET: 1.8 // FILE: test.kt diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 6e341c7966e..c1bae21017f 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -16635,6 +16635,26 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { public void testJvmDefaultEnableProperty() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnableProperty.kt"); } + + @TestMetadata("jvmDefaultGeneric.kt") + public void testJvmDefaultGeneric() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultGeneric.kt"); + } + + @TestMetadata("jvmDefaultSafeCall.kt") + public void testJvmDefaultSafeCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultSafeCall.kt"); + } + + @TestMetadata("jvmDefaultSmartCast.kt") + public void testJvmDefaultSmartCast() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultSmartCast.kt"); + } + + @TestMetadata("jvmDefaultSuspend.kt") + public void testJvmDefaultSuspend() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultSuspend.kt"); + } } @TestMetadata("compiler/testData/codegen/box/inlineClasses/propertyDelegation") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 75f5751ca61..3ac4543710b 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -16588,46 +16588,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public static class Jvm8DefaultInterfaceMethods extends AbstractLightAnalysisModeTest { - @TestMetadata("javaDefaultMethod.kt") - public void ignoreJavaDefaultMethod() throws Exception { - runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethod.kt"); - } - - @TestMetadata("javaDefaultMethodOverriddenByKotlin.kt") - public void ignoreJavaDefaultMethodOverriddenByKotlin() throws Exception { - runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethodOverriddenByKotlin.kt"); - } - - @TestMetadata("jvmDefaultAll.kt") - public void ignoreJvmDefaultAll() throws Exception { - runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAll.kt"); - } - - @TestMetadata("jvmDefaultAllPrimaryProperty.kt") - public void ignoreJvmDefaultAllPrimaryProperty() throws Exception { - runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllPrimaryProperty.kt"); - } - - @TestMetadata("jvmDefaultAllProperty.kt") - public void ignoreJvmDefaultAllProperty() throws Exception { - runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllProperty.kt"); - } - - @TestMetadata("jvmDefaultEnable.kt") - public void ignoreJvmDefaultEnable() throws Exception { - runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnable.kt"); - } - - @TestMetadata("jvmDefaultEnablePrimaryProperty.kt") - public void ignoreJvmDefaultEnablePrimaryProperty() throws Exception { - runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnablePrimaryProperty.kt"); - } - - @TestMetadata("jvmDefaultEnableProperty.kt") - public void ignoreJvmDefaultEnableProperty() throws Exception { - runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnableProperty.kt"); - } - private void runTest(String testDataFilePath) throws Exception { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } @@ -16635,6 +16595,66 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes public void testAllFilesPresentInJvm8DefaultInterfaceMethods() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } + + @TestMetadata("javaDefaultMethod.kt") + public void testJavaDefaultMethod() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethod.kt"); + } + + @TestMetadata("javaDefaultMethodOverriddenByKotlin.kt") + public void testJavaDefaultMethodOverriddenByKotlin() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/javaDefaultMethodOverriddenByKotlin.kt"); + } + + @TestMetadata("jvmDefaultAll.kt") + public void testJvmDefaultAll() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAll.kt"); + } + + @TestMetadata("jvmDefaultAllPrimaryProperty.kt") + public void testJvmDefaultAllPrimaryProperty() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllPrimaryProperty.kt"); + } + + @TestMetadata("jvmDefaultAllProperty.kt") + public void testJvmDefaultAllProperty() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultAllProperty.kt"); + } + + @TestMetadata("jvmDefaultEnable.kt") + public void testJvmDefaultEnable() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnable.kt"); + } + + @TestMetadata("jvmDefaultEnablePrimaryProperty.kt") + public void testJvmDefaultEnablePrimaryProperty() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnablePrimaryProperty.kt"); + } + + @TestMetadata("jvmDefaultEnableProperty.kt") + public void testJvmDefaultEnableProperty() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnableProperty.kt"); + } + + @TestMetadata("jvmDefaultGeneric.kt") + public void testJvmDefaultGeneric() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultGeneric.kt"); + } + + @TestMetadata("jvmDefaultSafeCall.kt") + public void testJvmDefaultSafeCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultSafeCall.kt"); + } + + @TestMetadata("jvmDefaultSmartCast.kt") + public void testJvmDefaultSmartCast() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultSmartCast.kt"); + } + + @TestMetadata("jvmDefaultSuspend.kt") + public void testJvmDefaultSuspend() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultSuspend.kt"); + } } @TestMetadata("compiler/testData/codegen/box/inlineClasses/propertyDelegation") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index fb4fe1cefd9..ac5cbfb6d24 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -15235,6 +15235,26 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes public void testJvmDefaultEnableProperty() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultEnableProperty.kt"); } + + @TestMetadata("jvmDefaultGeneric.kt") + public void testJvmDefaultGeneric() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultGeneric.kt"); + } + + @TestMetadata("jvmDefaultSafeCall.kt") + public void testJvmDefaultSafeCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultSafeCall.kt"); + } + + @TestMetadata("jvmDefaultSmartCast.kt") + public void testJvmDefaultSmartCast() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultSmartCast.kt"); + } + + @TestMetadata("jvmDefaultSuspend.kt") + public void testJvmDefaultSuspend() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods/jvmDefaultSuspend.kt"); + } } @TestMetadata("compiler/testData/codegen/box/inlineClasses/propertyDelegation") From 7f51f57998676ca1171da37c19507d0f2eb15363 Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Mon, 7 Dec 2020 08:55:28 +0100 Subject: [PATCH 483/698] Generate correct $default method for actual suspend function In order to do this, we need to get initial expect suspend function before generating default value parameters checks. #KT-43587 Fixed --- .../kotlin/codegen/FunctionCodegen.java | 7 +++++- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 ++++ .../featureIntersection/defaultExpect.kt | 25 +++++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 5 ++++ .../LightAnalysisModeTestGenerated.java | 5 ++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 5 ++++ .../IrJsCodegenBoxES6TestGenerated.java | 5 ++++ .../IrJsCodegenBoxTestGenerated.java | 5 ++++ .../semantics/JsCodegenBoxTestGenerated.java | 5 ++++ 9 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 compiler/testData/codegen/box/coroutines/featureIntersection/defaultExpect.kt diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java index 70e2d6844cf..5466c5c4d96 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java @@ -1221,7 +1221,12 @@ public class FunctionCodegen { // 'null' because the "could not find expected declaration" error has been already reported in isDefaultNeeded earlier List valueParameters = - CodegenUtil.getFunctionParametersForDefaultValueGeneration(functionDescriptor, null); + functionDescriptor.isSuspend() + ? CollectionsKt.plus( + CodegenUtil.getFunctionParametersForDefaultValueGeneration( + CoroutineCodegenUtilKt.unwrapInitialDescriptorForSuspendFunction(functionDescriptor), null), + CollectionsKt.last(functionDescriptor.getValueParameters())) + : CodegenUtil.getFunctionParametersForDefaultValueGeneration(functionDescriptor, null); boolean isStatic = isStaticMethod(methodContext.getContextKind(), functionDescriptor); FrameMap frameMap = createFrameMap(state, signature, functionDescriptor.getExtensionReceiverParameter(), valueParameters, isStatic); diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 27b1a4b67fd..99dfee1d850 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -7356,6 +7356,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt", "kotlin.coroutines"); } + @TestMetadata("defaultExpect.kt") + public void testDefaultExpect() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/defaultExpect.kt"); + } + @TestMetadata("delegate.kt") public void testDelegate_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt", "kotlin.coroutines"); diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/defaultExpect.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/defaultExpect.kt new file mode 100644 index 00000000000..ed82d02b1ba --- /dev/null +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/defaultExpect.kt @@ -0,0 +1,25 @@ +// !LANGUAGE: +MultiPlatformProjects +// KJS_WITH_FULL_RUNTIME +// WITH_RUNTIME +// IGNORE_BACKEND_FIR: JVM_IR + +import kotlin.coroutines.* + +var res = 0L + +expect suspend fun withLimit(limit: Long = 42L) + +actual suspend fun withLimit(limit: Long) { + res = limit +} + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(Continuation(EmptyCoroutineContext) {}) +} + +fun box(): String { + builder { + withLimit() + } + return if (res == 42L) "OK" else "FAIL $res" +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index c1bae21017f..b1c26de07bb 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -7951,6 +7951,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt", "kotlin.coroutines"); } + @TestMetadata("defaultExpect.kt") + public void testDefaultExpect() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/defaultExpect.kt"); + } + @TestMetadata("delegate.kt") public void testDelegate_1_2() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt", "kotlin.coroutines.experimental"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 3ac4543710b..050474433c5 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -7956,6 +7956,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt", "kotlin.coroutines"); } + @TestMetadata("defaultExpect.kt") + public void testDefaultExpect() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/defaultExpect.kt"); + } + @TestMetadata("delegate.kt") public void testDelegate_1_2() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt", "kotlin.coroutines.experimental"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index ac5cbfb6d24..ca2ec69d0ee 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -7356,6 +7356,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt", "kotlin.coroutines"); } + @TestMetadata("defaultExpect.kt") + public void testDefaultExpect() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/defaultExpect.kt"); + } + @TestMetadata("delegate.kt") public void testDelegate_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt", "kotlin.coroutines"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index 1d871a46593..071916bd0a2 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -6121,6 +6121,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt", "kotlin.coroutines"); } + @TestMetadata("defaultExpect.kt") + public void testDefaultExpect() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/defaultExpect.kt"); + } + @TestMetadata("delegate.kt") public void testDelegate_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt", "kotlin.coroutines"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 9618f4ee91b..b3c5cdbfc7a 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -6121,6 +6121,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt", "kotlin.coroutines"); } + @TestMetadata("defaultExpect.kt") + public void testDefaultExpect() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/defaultExpect.kt"); + } + @TestMetadata("delegate.kt") public void testDelegate_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt", "kotlin.coroutines"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 599b2492b45..6fd9d930afc 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -6121,6 +6121,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt", "kotlin.coroutines"); } + @TestMetadata("defaultExpect.kt") + public void testDefaultExpect() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/defaultExpect.kt"); + } + @TestMetadata("delegate.kt") public void testDelegate_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt", "kotlin.coroutines"); From c5015c9294e5b51e101f9bf33f82e6c38c0e297d Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Mon, 7 Dec 2020 10:00:11 +0100 Subject: [PATCH 484/698] Don't recognize IrVariable as declaration scope in inlining #KT-42815 Fixed --- ...FirBlackBoxInlineCodegenTestGenerated.java | 10 +++++++ .../jvm/ir/IrInlineReferenceLocator.kt | 8 ++--- .../boxInline/anonymousObject/kt42815.kt | 21 +++++++++++++ .../anonymousObject/kt42815_delegated.kt | 30 +++++++++++++++++++ .../BlackBoxInlineCodegenTestGenerated.java | 10 +++++++ ...otlinAgainstInlineKotlinTestGenerated.java | 10 +++++++ .../IrBlackBoxInlineCodegenTestGenerated.java | 10 +++++++ ...otlinAgainstInlineKotlinTestGenerated.java | 10 +++++++ ...JvmIrAgainstOldBoxInlineTestGenerated.java | 10 +++++++ ...JvmOldAgainstIrBoxInlineTestGenerated.java | 10 +++++++ .../IrJsCodegenInlineES6TestGenerated.java | 10 +++++++ .../IrJsCodegenInlineTestGenerated.java | 10 +++++++ .../JsCodegenInlineTestGenerated.java | 10 +++++++ 13 files changed, 154 insertions(+), 5 deletions(-) create mode 100644 compiler/testData/codegen/boxInline/anonymousObject/kt42815.kt create mode 100644 compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxInlineCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxInlineCodegenTestGenerated.java index 308a59f154c..3ed7216e2d4 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxInlineCodegenTestGenerated.java @@ -246,6 +246,16 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn runTest("compiler/testData/codegen/boxInline/anonymousObject/kt38197.kt"); } + @TestMetadata("kt42815.kt") + public void testKt42815() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815.kt"); + } + + @TestMetadata("kt42815_delegated.kt") + public void testKt42815_delegated() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt"); + } + @TestMetadata("kt6552.kt") public void testKt6552() throws Exception { runTest("compiler/testData/codegen/boxInline/anonymousObject/kt6552.kt"); diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/ir/IrInlineReferenceLocator.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/ir/IrInlineReferenceLocator.kt index ae1fed26604..246d685b5c6 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/ir/IrInlineReferenceLocator.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/ir/IrInlineReferenceLocator.kt @@ -9,10 +9,7 @@ import org.jetbrains.kotlin.backend.jvm.JvmBackendContext import org.jetbrains.kotlin.backend.jvm.codegen.isInlineFunctionCall import org.jetbrains.kotlin.backend.jvm.codegen.isInlineIrExpression import org.jetbrains.kotlin.ir.IrElement -import org.jetbrains.kotlin.ir.declarations.IrDeclaration -import org.jetbrains.kotlin.ir.declarations.IrDeclarationBase -import org.jetbrains.kotlin.ir.declarations.IrFunction -import org.jetbrains.kotlin.ir.declarations.IrValueParameter +import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.IrBlock import org.jetbrains.kotlin.ir.expressions.IrCallableReference import org.jetbrains.kotlin.ir.expressions.IrFunctionAccessExpression @@ -25,7 +22,8 @@ internal open class IrInlineReferenceLocator(private val context: JvmBackendCont } override fun visitDeclaration(declaration: IrDeclarationBase, data: IrDeclaration?) { - declaration.acceptChildren(this, declaration) + val scope = if (declaration is IrVariable) data else declaration + declaration.acceptChildren(this, scope) } override fun visitFunctionAccess(expression: IrFunctionAccessExpression, data: IrDeclaration?) { diff --git a/compiler/testData/codegen/boxInline/anonymousObject/kt42815.kt b/compiler/testData/codegen/boxInline/anonymousObject/kt42815.kt new file mode 100644 index 00000000000..9590ce4726f --- /dev/null +++ b/compiler/testData/codegen/boxInline/anonymousObject/kt42815.kt @@ -0,0 +1,21 @@ +// FILE: 1.kt +package test + +inline fun myRun(x: () -> String) = x() + +// FILE: 2.kt +// NO_CHECK_LAMBDA_INLINING +import test.* + +class C { + val x: String + init { + val y = myRun { { "OK" }() } + x = y + } + + constructor(y: Int) + constructor(y: String) +} + +fun box(): String = C("").x \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt b/compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt new file mode 100644 index 00000000000..15051795575 --- /dev/null +++ b/compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt @@ -0,0 +1,30 @@ +// WITH_RUNTIME +// FILE: 1.kt +package test + +inline fun myRun( x: () -> String): Lazy { + val value2 = x() + return object : Lazy { + override val value: String + get() = value2 + + override fun isInitialized(): Boolean = true + } +} + +// FILE: 2.kt + +import test.* + +class C { + val x: String + init { + val y by myRun { { "OK" }() } + x = y + } + + constructor(y: Int) + constructor(y: String) +} + +fun box(): String = C("").x \ No newline at end of file diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java index ab94c7a571a..34f6d2cebd4 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java @@ -246,6 +246,16 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo runTest("compiler/testData/codegen/boxInline/anonymousObject/kt38197.kt"); } + @TestMetadata("kt42815.kt") + public void testKt42815() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815.kt"); + } + + @TestMetadata("kt42815_delegated.kt") + public void testKt42815_delegated() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt"); + } + @TestMetadata("kt6552.kt") public void testKt6552() throws Exception { runTest("compiler/testData/codegen/boxInline/anonymousObject/kt6552.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java index 2155efe0562..e3d11df63c5 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java @@ -246,6 +246,16 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi runTest("compiler/testData/codegen/boxInline/anonymousObject/kt38197.kt"); } + @TestMetadata("kt42815.kt") + public void testKt42815() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815.kt"); + } + + @TestMetadata("kt42815_delegated.kt") + public void testKt42815_delegated() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt"); + } + @TestMetadata("kt6552.kt") public void testKt6552() throws Exception { runTest("compiler/testData/codegen/boxInline/anonymousObject/kt6552.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java index 5a6a62de7d2..339372300a6 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java @@ -246,6 +246,16 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli runTest("compiler/testData/codegen/boxInline/anonymousObject/kt38197.kt"); } + @TestMetadata("kt42815.kt") + public void testKt42815() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815.kt"); + } + + @TestMetadata("kt42815_delegated.kt") + public void testKt42815_delegated() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt"); + } + @TestMetadata("kt6552.kt") public void testKt6552() throws Exception { runTest("compiler/testData/codegen/boxInline/anonymousObject/kt6552.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java index bc93b2fa427..bff2ed9cbd6 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java @@ -246,6 +246,16 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC runTest("compiler/testData/codegen/boxInline/anonymousObject/kt38197.kt"); } + @TestMetadata("kt42815.kt") + public void testKt42815() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815.kt"); + } + + @TestMetadata("kt42815_delegated.kt") + public void testKt42815_delegated() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt"); + } + @TestMetadata("kt6552.kt") public void testKt6552() throws Exception { runTest("compiler/testData/codegen/boxInline/anonymousObject/kt6552.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxInlineTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxInlineTestGenerated.java index e607d85e13a..667670a5fff 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxInlineTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxInlineTestGenerated.java @@ -246,6 +246,16 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO runTest("compiler/testData/codegen/boxInline/anonymousObject/kt38197.kt"); } + @TestMetadata("kt42815.kt") + public void testKt42815() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815.kt"); + } + + @TestMetadata("kt42815_delegated.kt") + public void testKt42815_delegated() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt"); + } + @TestMetadata("kt6552.kt") public void testKt6552() throws Exception { runTest("compiler/testData/codegen/boxInline/anonymousObject/kt6552.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxInlineTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxInlineTestGenerated.java index 6d9b781d163..36a35e81b21 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxInlineTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxInlineTestGenerated.java @@ -246,6 +246,16 @@ public class JvmOldAgainstIrBoxInlineTestGenerated extends AbstractJvmOldAgainst runTest("compiler/testData/codegen/boxInline/anonymousObject/kt38197.kt"); } + @TestMetadata("kt42815.kt") + public void testKt42815() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815.kt"); + } + + @TestMetadata("kt42815_delegated.kt") + public void testKt42815_delegated() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt"); + } + @TestMetadata("kt6552.kt") public void testKt6552() throws Exception { runTest("compiler/testData/codegen/boxInline/anonymousObject/kt6552.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java index 7b09e3c6123..b758b1ee66b 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java @@ -226,6 +226,16 @@ public class IrJsCodegenInlineES6TestGenerated extends AbstractIrJsCodegenInline runTest("compiler/testData/codegen/boxInline/anonymousObject/kt38197.kt"); } + @TestMetadata("kt42815.kt") + public void testKt42815() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815.kt"); + } + + @TestMetadata("kt42815_delegated.kt") + public void testKt42815_delegated() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt"); + } + @TestMetadata("kt6552.kt") public void testKt6552() throws Exception { runTest("compiler/testData/codegen/boxInline/anonymousObject/kt6552.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java index 7960803a286..23d718edc84 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java @@ -226,6 +226,16 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes runTest("compiler/testData/codegen/boxInline/anonymousObject/kt38197.kt"); } + @TestMetadata("kt42815.kt") + public void testKt42815() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815.kt"); + } + + @TestMetadata("kt42815_delegated.kt") + public void testKt42815_delegated() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt"); + } + @TestMetadata("kt6552.kt") public void testKt6552() throws Exception { runTest("compiler/testData/codegen/boxInline/anonymousObject/kt6552.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java index 9d1de7d54f0..9a4df584fd9 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java @@ -226,6 +226,16 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest { runTest("compiler/testData/codegen/boxInline/anonymousObject/kt38197.kt"); } + @TestMetadata("kt42815.kt") + public void testKt42815() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815.kt"); + } + + @TestMetadata("kt42815_delegated.kt") + public void testKt42815_delegated() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt"); + } + @TestMetadata("kt6552.kt") public void testKt6552() throws Exception { runTest("compiler/testData/codegen/boxInline/anonymousObject/kt6552.kt"); From 2ad4824eb0505d6306f475c890bb9396ea398bed Mon Sep 17 00:00:00 2001 From: Mikhail Zarechenskiy Date: Tue, 8 Dec 2020 04:02:36 +0300 Subject: [PATCH 485/698] Fix exception on resolving collection literal inside lambda #KT-31907 Fixed #EA-90906 Fixed --- .../kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java | 5 +++++ .../jetbrains/kotlin/resolve/CollectionLiteralResolver.kt | 4 ++-- .../resolveCollectionLiteralInsideLambda.fir.kt | 7 +++++++ .../regressions/resolveCollectionLiteralInsideLambda.kt | 7 +++++++ .../regressions/resolveCollectionLiteralInsideLambda.txt | 6 ++++++ .../kotlin/checkers/DiagnosticsTestGenerated.java | 5 +++++ .../checkers/javac/DiagnosticsUsingJavacTestGenerated.java | 5 +++++ 7 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 compiler/testData/diagnostics/tests/regressions/resolveCollectionLiteralInsideLambda.fir.kt create mode 100644 compiler/testData/diagnostics/tests/regressions/resolveCollectionLiteralInsideLambda.kt create mode 100644 compiler/testData/diagnostics/tests/regressions/resolveCollectionLiteralInsideLambda.txt diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java index 48b52692805..36ca6647f4a 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java @@ -19071,6 +19071,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte runTest("compiler/testData/diagnostics/tests/regressions/propertyWithExtensionTypeInvoke.kt"); } + @TestMetadata("resolveCollectionLiteralInsideLambda.kt") + public void testResolveCollectionLiteralInsideLambda() throws Exception { + runTest("compiler/testData/diagnostics/tests/regressions/resolveCollectionLiteralInsideLambda.kt"); + } + @TestMetadata("resolveSubclassOfList.kt") public void testResolveSubclassOfList() throws Exception { runTest("compiler/testData/diagnostics/tests/regressions/resolveSubclassOfList.kt"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/CollectionLiteralResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/CollectionLiteralResolver.kt index 6b357d83556..4a98fa90c94 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/CollectionLiteralResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/CollectionLiteralResolver.kt @@ -23,7 +23,7 @@ import org.jetbrains.kotlin.resolve.BindingContext.COLLECTION_LITERAL_CALL import org.jetbrains.kotlin.resolve.calls.CallResolver import org.jetbrains.kotlin.resolve.calls.util.CallMaker import org.jetbrains.kotlin.types.KotlinType -import org.jetbrains.kotlin.types.TypeUtils.NO_EXPECTED_TYPE +import org.jetbrains.kotlin.types.TypeUtils import org.jetbrains.kotlin.types.expressions.ExpressionTypingContext import org.jetbrains.kotlin.types.expressions.KotlinTypeInfo import org.jetbrains.kotlin.types.expressions.typeInfoFactory.createTypeInfo @@ -94,7 +94,7 @@ class CollectionLiteralResolver( } private fun getArrayFunctionCallName(expectedType: KotlinType): Name { - if (NO_EXPECTED_TYPE === expectedType || + if (TypeUtils.noExpectedType(expectedType) || !(KotlinBuiltIns.isPrimitiveArray(expectedType) || KotlinBuiltIns.isUnsignedArrayType(expectedType)) ) { return ArrayFqNames.ARRAY_OF_FUNCTION diff --git a/compiler/testData/diagnostics/tests/regressions/resolveCollectionLiteralInsideLambda.fir.kt b/compiler/testData/diagnostics/tests/regressions/resolveCollectionLiteralInsideLambda.fir.kt new file mode 100644 index 00000000000..00fae356ed0 --- /dev/null +++ b/compiler/testData/diagnostics/tests/regressions/resolveCollectionLiteralInsideLambda.fir.kt @@ -0,0 +1,7 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +fun foo(l: () -> Unit) {} +fun bar(l: () -> String) {} + +val a = foo { [] } +val b = bar { [] } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/resolveCollectionLiteralInsideLambda.kt b/compiler/testData/diagnostics/tests/regressions/resolveCollectionLiteralInsideLambda.kt new file mode 100644 index 00000000000..a3fa7cfc78c --- /dev/null +++ b/compiler/testData/diagnostics/tests/regressions/resolveCollectionLiteralInsideLambda.kt @@ -0,0 +1,7 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +fun foo(l: () -> Unit) {} +fun bar(l: () -> String) {} + +val a = foo { [] } +val b = bar { [] } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/resolveCollectionLiteralInsideLambda.txt b/compiler/testData/diagnostics/tests/regressions/resolveCollectionLiteralInsideLambda.txt new file mode 100644 index 00000000000..edb024773b7 --- /dev/null +++ b/compiler/testData/diagnostics/tests/regressions/resolveCollectionLiteralInsideLambda.txt @@ -0,0 +1,6 @@ +package + +public val a: kotlin.Unit +public val b: kotlin.Unit +public fun bar(/*0*/ l: () -> kotlin.String): kotlin.Unit +public fun foo(/*0*/ l: () -> kotlin.Unit): kotlin.Unit diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 0b9c4617760..427baf31113 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -19083,6 +19083,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali runTest("compiler/testData/diagnostics/tests/regressions/propertyWithExtensionTypeInvoke.kt"); } + @TestMetadata("resolveCollectionLiteralInsideLambda.kt") + public void testResolveCollectionLiteralInsideLambda() throws Exception { + runTest("compiler/testData/diagnostics/tests/regressions/resolveCollectionLiteralInsideLambda.kt"); + } + @TestMetadata("resolveSubclassOfList.kt") public void testResolveSubclassOfList() throws Exception { runTest("compiler/testData/diagnostics/tests/regressions/resolveSubclassOfList.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java index 8f13c7f2b56..0f50aa981ae 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java @@ -19073,6 +19073,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing runTest("compiler/testData/diagnostics/tests/regressions/propertyWithExtensionTypeInvoke.kt"); } + @TestMetadata("resolveCollectionLiteralInsideLambda.kt") + public void testResolveCollectionLiteralInsideLambda() throws Exception { + runTest("compiler/testData/diagnostics/tests/regressions/resolveCollectionLiteralInsideLambda.kt"); + } + @TestMetadata("resolveSubclassOfList.kt") public void testResolveSubclassOfList() throws Exception { runTest("compiler/testData/diagnostics/tests/regressions/resolveSubclassOfList.kt"); From b0347c38222f9a3529184b1efbbeb294ba434615 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Sat, 28 Nov 2020 01:56:13 +0300 Subject: [PATCH 486/698] Stable order of generation and errors in ConvertSealedClassToEnumIntention --- .../ConvertSealedClassToEnumIntention.kt | 28 +++++++++++++------ tests/mute-platform.csv | 6 ---- tests/mute-platform.csv.201 | 5 ---- tests/mute-platform.csv.as41 | 5 ---- 4 files changed, 20 insertions(+), 24 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertSealedClassToEnumIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertSealedClassToEnumIntention.kt index 282f2bf5904..3da15faa05c 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertSealedClassToEnumIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertSealedClassToEnumIntention.kt @@ -49,11 +49,11 @@ class ConvertSealedClassToEnumIntention : SelfTargetingRangeIntention( val klass = element.liftToExpected() as? KtClass ?: element - val subclasses = project.runSynchronouslyWithProgress(KotlinBundle.message("searching.inheritors"), true) { + val subclasses: List = project.runSynchronouslyWithProgress(KotlinBundle.message("searching.inheritors"), true) { HierarchySearchRequest(klass, klass.useScope, false).searchInheritors().mapNotNull { it.unwrapped } } ?: return - val subclassesByContainer = subclasses.groupBy { + val subclassesByContainer: Map> = subclasses.groupBy { if (it !is KtObjectDeclaration) return@groupBy null if (it.superTypeListEntries.size != 1) return@groupBy null val containingClass = it.containingClassOrObject as? KtClass ?: return@groupBy null @@ -61,7 +61,7 @@ class ConvertSealedClassToEnumIntention : SelfTargetingRangeIntention( containingClass } - val inconvertibleSubclasses = subclassesByContainer[null] ?: emptyList() + val inconvertibleSubclasses: List = subclassesByContainer[null] ?: emptyList() if (inconvertibleSubclasses.isNotEmpty()) { return showError( KotlinBundle.message("all.inheritors.must.be.nested.objects.of.the.class.itself.and.may.not.inherit.from.other.classes.or.interfaces"), @@ -83,23 +83,34 @@ class ConvertSealedClassToEnumIntention : SelfTargetingRangeIntention( } if (subclassesByContainer.isNotEmpty()) { - subclassesByContainer.forEach { (currentClass, currentSubclasses) -> processClass(currentClass!!, currentSubclasses, project) } + subclassesByContainer.forEach { (currentClass, currentSubclasses) -> + processClass(currentClass!!, currentSubclasses, project) + } } else { processClass(klass, emptyList(), project) } } private fun showError(message: String, elements: List, project: Project, editor: Editor?) { + val elementDescriptions = elements.map { + ElementDescriptionUtil.getElementDescription(it, RefactoringDescriptionLocation.WITHOUT_PARENT) + } + val errorText = buildString { append(message) append(KotlinBundle.message("following.problems.are.found")) - elements.joinTo(this) { ElementDescriptionUtil.getElementDescription(it, RefactoringDescriptionLocation.WITHOUT_PARENT) } + elementDescriptions.sorted().joinTo(this) } + return CommonRefactoringUtil.showErrorHint(project, editor, errorText, text, null) } private fun processClass(klass: KtClass, subclasses: List, project: Project) { val needSemicolon = klass.declarations.size > subclasses.size + val movedDeclarations = run { + val subclassesSet = subclasses.toSet() + klass.declarations.filter { it in subclassesSet } + } val psiFactory = KtPsiFactory(klass) @@ -107,7 +118,8 @@ class ConvertSealedClassToEnumIntention : SelfTargetingRangeIntention( val semicolon = psiFactory.createSemicolon() val constructorCallNeeded = klass.hasExplicitPrimaryConstructor() || klass.secondaryConstructors.isNotEmpty() - val entriesToAdd = subclasses.mapIndexed { i, subclass -> + + val entriesToAdd = movedDeclarations.mapIndexed { i, subclass -> subclass as KtObjectDeclaration val entryText = buildString { @@ -120,7 +132,7 @@ class ConvertSealedClassToEnumIntention : SelfTargetingRangeIntention( val entry = psiFactory.createEnumEntry(entryText) subclass.body?.let { body -> entry.add(body) } - if (i < subclasses.lastIndex) { + if (i < movedDeclarations.lastIndex) { entry.add(comma) } else if (needSemicolon) { entry.add(semicolon) @@ -129,7 +141,7 @@ class ConvertSealedClassToEnumIntention : SelfTargetingRangeIntention( entry } - subclasses.forEach { it.delete() } + movedDeclarations.forEach { it.delete() } klass.removeModifier(KtTokens.SEALED_KEYWORD) klass.addModifier(KtTokens.ENUM_KEYWORD) diff --git a/tests/mute-platform.csv b/tests/mute-platform.csv index 1a93520f31a..f244eec8a34 100644 --- a/tests/mute-platform.csv +++ b/tests/mute-platform.csv @@ -62,14 +62,11 @@ org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveB org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveBraces.testIf, KT-34408,, org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveBraces.testNotSingleLineStatement, KT-34408,, org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveBraces.testWhenEntry, KT-34408,, -org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertSealedClassToEnum.testWithNonObjectInheritors, Enum reorder,, FLAKY org.jetbrains.kotlin.idea.navigation.KotlinGotoImplementationMultiModuleTestGenerated.testExpectClassSuperclassFun,,, FLAKY org.jetbrains.kotlin.idea.parameterInfo.ParameterInfoTestGenerated.WithLib1.testUseJavaFromLib, KT-34542, FAIL, org.jetbrains.kotlin.idea.parameterInfo.ParameterInfoTestGenerated.WithLib2.testUseJavaSAMFromLib, KT-34542, FAIL, org.jetbrains.kotlin.idea.parameterInfo.ParameterInfoTestGenerated.WithLib3.testUseJavaSAMFromLib, KT-34542, FAIL, org.jetbrains.kotlin.idea.quickfix.QuickFixMultiFileTestGenerated.ChangeSignature.Jk.testJkKeepValOnParameterTypeChange, Unprocessed,, -org.jetbrains.kotlin.idea.quickfix.QuickFixMultiModuleTestGenerated.Other.testConvertActualSealedClassToEnum, Enum reorder,, -org.jetbrains.kotlin.idea.quickfix.QuickFixMultiModuleTestGenerated.Other.testConvertExpectSealedClassToEnum, Enum reorder,, org.jetbrains.kotlin.idea.refactoring.inline.InlineTestGenerated.Function.ExpressionBody.testMultipleInExpression, Unstable order of usages,,FLAKY org.jetbrains.kotlin.idea.refactoring.introduce.ExtractionTestGenerated.IntroduceJavaParameter.testJavaMethodOverridingKotlinFunctionWithUsages, Unprocessed,, FLAKY org.jetbrains.kotlin.idea.refactoring.move.MoveTestGenerated.testJava_moveClass_moveInnerToTop_moveNestedClassToTopLevelInTheSamePackageAndAddOuterInstanceWithLambda_MoveNestedClassToTopLevelInTheSamePackageAndAddOuterInstanceWithLambda, final modifier added,, @@ -111,8 +108,6 @@ org.jetbrains.kotlin.jps.build.IncrementalJvmJpsTestGenerated.WithJava.JavaUsedI org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Var.testVarWithTypeWoInitializer, Unprocessed,, FLAKY org.jetbrains.kotlin.idea.refactoring.pullUp.PullUpTestGenerated.K2K.testAccidentalOverrides, Unprocessed,, FLAKY org.jetbrains.kotlin.idea.refactoring.move.MoveTestGenerated.testKotlin_moveTopLevelDeclarations_moveFunctionToPackage_MoveFunctionToPackage, fail on TeamCity but works well locally,, FLAKY -org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertSealedClassToEnum.testInstancesOnly, Generated entries reordered,, FLAKY -org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertSealedClassToEnum.testInstancesAndMembers, Enum reorder,, FLAKY org.jetbrains.kotlin.idea.navigation.GotoDeclarationTestGenerated.testImportAliasMultiDeclarations, showInBestPositionFor doesn't work in headless in 202,, org.jetbrains.kotlin.idea.navigation.GotoDeclarationTestGenerated.testItParameterInLambda,Broken in 202,, org.jetbrains.kotlin.idea.navigation.GotoDeclarationTestGenerated.testThisExtensionFunction,Broken in 202,, @@ -134,7 +129,6 @@ org.jetbrains.kotlin.idea.externalAnnotations.ExternalAnnotationTest.testNotNull org.jetbrains.kotlin.idea.externalAnnotations.ExternalAnnotationTest.testNullableMethodParameter,Unprocessed,, FLAKY org.jetbrains.kotlin.idea.externalAnnotations.ExternalAnnotationTest.testNullableField,Unprocessed,, FLAKY org.jetbrains.kotlin.idea.externalAnnotations.ExternalAnnotationTest.testNullableMethod,Unprocessed,, FLAKY -org.jetbrains.kotlin.idea.quickfix.QuickFixMultiModuleTestGenerated$Other.testConvertActualSealedClassToEnum,Unprocessed,, FLAKY org.jetbrains.kotlin.idea.quickfix.UpdateConfigurationQuickFixTest.testEnableCoroutinesFacet,Unprocessed,, FLAKY org.jetbrains.kotlin.idea.quickfix.UpdateConfigurationQuickFixTest.testEnableInlineClasses,Unprocessed,, FLAKY org.jetbrains.kotlin.idea.quickfix.UpdateConfigurationQuickFixTest.testIncreaseLangLevelFacet,Unprocessed,, FLAKY diff --git a/tests/mute-platform.csv.201 b/tests/mute-platform.csv.201 index 2fcdef022f7..69c5b260bc7 100644 --- a/tests/mute-platform.csv.201 +++ b/tests/mute-platform.csv.201 @@ -64,14 +64,11 @@ org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveB org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveBraces.testIf, KT-34408,, org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveBraces.testNotSingleLineStatement, KT-34408,, org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveBraces.testWhenEntry, KT-34408,, -org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertSealedClassToEnum.testWithNonObjectInheritors, Enum reorder,, FLAKY org.jetbrains.kotlin.idea.navigation.KotlinGotoImplementationMultiModuleTestGenerated.testExpectClassSuperclassFun,,, FLAKY org.jetbrains.kotlin.idea.parameterInfo.ParameterInfoTestGenerated.WithLib1.testUseJavaFromLib, KT-34542, FAIL, org.jetbrains.kotlin.idea.parameterInfo.ParameterInfoTestGenerated.WithLib2.testUseJavaSAMFromLib, KT-34542, FAIL, org.jetbrains.kotlin.idea.parameterInfo.ParameterInfoTestGenerated.WithLib3.testUseJavaSAMFromLib, KT-34542, FAIL, org.jetbrains.kotlin.idea.quickfix.QuickFixMultiFileTestGenerated.ChangeSignature.Jk.testJkKeepValOnParameterTypeChange, Unprocessed,, -org.jetbrains.kotlin.idea.quickfix.QuickFixMultiModuleTestGenerated.Other.testConvertActualSealedClassToEnum, Enum reorder,, -org.jetbrains.kotlin.idea.quickfix.QuickFixMultiModuleTestGenerated.Other.testConvertExpectSealedClassToEnum, Enum reorder,, org.jetbrains.kotlin.idea.refactoring.inline.InlineTestGenerated.Function.ExpressionBody.testMultipleInExpression, Unstable order of usages,,FLAKY org.jetbrains.kotlin.idea.refactoring.introduce.ExtractionTestGenerated.IntroduceJavaParameter.testJavaMethodOverridingKotlinFunctionWithUsages, Unprocessed,, FLAKY org.jetbrains.kotlin.idea.refactoring.move.MoveTestGenerated.testJava_moveClass_moveInnerToTop_moveNestedClassToTopLevelInTheSamePackageAndAddOuterInstanceWithLambda_MoveNestedClassToTopLevelInTheSamePackageAndAddOuterInstanceWithLambda, final modifier added,, @@ -113,8 +110,6 @@ org.jetbrains.kotlin.jps.build.IncrementalJvmJpsTestGenerated.WithJava.JavaUsedI org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Var.testVarWithTypeWoInitializer, Unprocessed,, FLAKY org.jetbrains.kotlin.idea.refactoring.pullUp.PullUpTestGenerated.K2K.testAccidentalOverrides, Unprocessed,, FLAKY org.jetbrains.kotlin.idea.refactoring.move.MoveTestGenerated.testKotlin_moveTopLevelDeclarations_moveFunctionToPackage_MoveFunctionToPackage, fail on TeamCity but works well locally,, FLAKY -org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertSealedClassToEnum.testInstancesOnly, Generated entries reordered,, FLAKY -org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertSealedClassToEnum.testInstancesAndMembers, Enum reorder,, FLAKY org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testChangeInsideNonKtsFileInvalidatesOtherFiles, Unprocessed,, org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testTwoFilesChanged, Unprocessed,, org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testLoadedConfigurationWhenExternalFileChanged, Unprocessed,, \ No newline at end of file diff --git a/tests/mute-platform.csv.as41 b/tests/mute-platform.csv.as41 index 30507db54bd..c82ed8c1ba7 100644 --- a/tests/mute-platform.csv.as41 +++ b/tests/mute-platform.csv.as41 @@ -64,14 +64,11 @@ org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveB org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveBraces.testIf, KT-34408,, org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveBraces.testNotSingleLineStatement, KT-34408,, org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveBraces.testWhenEntry, KT-34408,, -org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertSealedClassToEnum.testWithNonObjectInheritors, Enum reorder,, FLAKY org.jetbrains.kotlin.idea.navigation.KotlinGotoImplementationMultiModuleTestGenerated.testExpectClassSuperclassFun,,, FLAKY org.jetbrains.kotlin.idea.parameterInfo.ParameterInfoTestGenerated.WithLib1.testUseJavaFromLib, KT-34542, FAIL, org.jetbrains.kotlin.idea.parameterInfo.ParameterInfoTestGenerated.WithLib2.testUseJavaSAMFromLib, KT-34542, FAIL, org.jetbrains.kotlin.idea.parameterInfo.ParameterInfoTestGenerated.WithLib3.testUseJavaSAMFromLib, KT-34542, FAIL, org.jetbrains.kotlin.idea.quickfix.QuickFixMultiFileTestGenerated.ChangeSignature.Jk.testJkKeepValOnParameterTypeChange, Unprocessed,, -org.jetbrains.kotlin.idea.quickfix.QuickFixMultiModuleTestGenerated.Other.testConvertActualSealedClassToEnum, Enum reorder,, -org.jetbrains.kotlin.idea.quickfix.QuickFixMultiModuleTestGenerated.Other.testConvertExpectSealedClassToEnum, Enum reorder,, org.jetbrains.kotlin.idea.refactoring.inline.InlineTestGenerated.Function.ExpressionBody.testMultipleInExpression, Unstable order of usages,,FLAKY org.jetbrains.kotlin.idea.refactoring.introduce.ExtractionTestGenerated.IntroduceJavaParameter.testJavaMethodOverridingKotlinFunctionWithUsages, Unprocessed,, FLAKY org.jetbrains.kotlin.idea.refactoring.move.MoveTestGenerated.testJava_moveClass_moveInnerToTop_moveNestedClassToTopLevelInTheSamePackageAndAddOuterInstanceWithLambda_MoveNestedClassToTopLevelInTheSamePackageAndAddOuterInstanceWithLambda, final modifier added,, @@ -113,8 +110,6 @@ org.jetbrains.kotlin.jps.build.IncrementalJvmJpsTestGenerated.WithJava.JavaUsedI org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Var.testVarWithTypeWoInitializer, Unprocessed,, FLAKY org.jetbrains.kotlin.idea.refactoring.pullUp.PullUpTestGenerated.K2K.testAccidentalOverrides, Unprocessed,, FLAKY org.jetbrains.kotlin.idea.refactoring.move.MoveTestGenerated.testKotlin_moveTopLevelDeclarations_moveFunctionToPackage_MoveFunctionToPackage, fail on TeamCity but works well locally,, FLAKY -org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertSealedClassToEnum.testInstancesOnly, Generated entries reordered,, FLAKY -org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertSealedClassToEnum.testInstancesAndMembers, Enum reorder,, FLAKY org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testChangeInsideNonKtsFileInvalidatesOtherFiles, Unprocessed,, org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testTwoFilesChanged, Unprocessed,, org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testLoadedConfigurationWhenExternalFileChanged, Unprocessed,, From 8e38f9d176e932de8068428f6a61485635b2a4be Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Sat, 5 Dec 2020 00:03:29 +0300 Subject: [PATCH 487/698] Stop mangle common project descriptor in GenerateTestSupport tests Use custom project descriptor instead. Mitingate flaky failures: ERROR: Save settings failed java.lang.RuntimeException: java.io.IOException: Cannot save /test_path/test.ipr. Unable to open the file for writing. at com.intellij.util.ExceptionUtil.rethrow(ExceptionUtil.java:116) at com.intellij.util.lang.CompoundRuntimeException.throwIfNotEmpty(CompoundRuntimeException.java:106) at com.intellij.configurationStore.SaveResult.throwIfErrored(SaveResult.kt:59) at com.intellij.configurationStore.ComponentStoreImpl.save$suspendImpl(ComponentStoreImpl.kt:152) at com.intellij.configurationStore.ComponentStoreImpl$save$1.invokeSuspend(ComponentStoreImpl.kt) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56) at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274) at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:84) at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59) at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source) at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38) at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source) at com.intellij.configurationStore.StoreUtil$Companion.saveSettings(storeUtil.kt:44) at com.intellij.configurationStore.StoreUtil.saveSettings(storeUtil.kt) at com.intellij.openapi.project.impl.ProjectImpl.save(ProjectImpl.java:157) at org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateTestSupportMethodActionTest$setUpTestSourceRoot$1.invoke(AbstractGenerateTestSupportMethodActionTest.kt:22) at org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateTestSupportMethodActionTest$setUpTestSourceRoot$1.invoke(AbstractGenerateTestSupportMethodActionTest.kt:20) --- .../generate/AbstractCodeInsightActionTest.kt | 3 +- ...ractGenerateTestSupportMethodActionTest.kt | 31 +++++++++---------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/generate/AbstractCodeInsightActionTest.kt b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/generate/AbstractCodeInsightActionTest.kt index 08ce7d224b8..c5f900c06b0 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/generate/AbstractCodeInsightActionTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/generate/AbstractCodeInsightActionTest.kt @@ -10,6 +10,7 @@ import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.Presentation import com.intellij.openapi.util.io.FileUtil import com.intellij.refactoring.util.CommonRefactoringUtil +import com.intellij.testFramework.LightProjectDescriptor import com.intellij.testFramework.PlatformTestUtil import com.intellij.testFramework.TestActionEvent import junit.framework.ComparisonFailure @@ -113,5 +114,5 @@ abstract class AbstractCodeInsightActionTest : KotlinLightCodeInsightFixtureTest } } - override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE + override fun getProjectDescriptor(): LightProjectDescriptor = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE } diff --git a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/generate/AbstractGenerateTestSupportMethodActionTest.kt b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/generate/AbstractGenerateTestSupportMethodActionTest.kt index 5efaae03728..5afc4ebfc85 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/generate/AbstractGenerateTestSupportMethodActionTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/generate/AbstractGenerateTestSupportMethodActionTest.kt @@ -5,30 +5,27 @@ package org.jetbrains.kotlin.idea.codeInsight.generate -import com.intellij.openapi.roots.ModuleRootManager +import com.intellij.openapi.module.ModuleTypeId +import com.intellij.openapi.projectRoots.Sdk +import com.intellij.testFramework.LightProjectDescriptor +import org.jetbrains.jps.model.java.JavaSourceRootType +import org.jetbrains.jps.model.module.JpsModuleSourceRootType import org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateTestSupportActionBase -import org.jetbrains.kotlin.idea.util.application.runWriteAction +import org.jetbrains.kotlin.idea.test.PluginTestCaseBase import org.jetbrains.kotlin.test.InTextDirectivesUtils abstract class AbstractGenerateTestSupportMethodActionTest : AbstractCodeInsightActionTest() { - private fun setUpTestSourceRoot() { - val model = ModuleRootManager.getInstance(module).modifiableModel - val entry = model.contentEntries.single() - val sourceFolderFile = entry.sourceFolderFiles.single() - entry.removeSourceFolder(entry.sourceFolders.single()) - entry.addSourceFolder(sourceFolderFile, true) - runWriteAction { - model.commit() - module.project.save() - } - } - override fun createAction(fileText: String) = (super.createAction(fileText) as KotlinGenerateTestSupportActionBase).apply { testFrameworkToUse = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// TEST_FRAMEWORK:") } - override fun doTest(path: String) { - setUpTestSourceRoot() - super.doTest(path) + override fun getProjectDescriptor(): LightProjectDescriptor = TEST_ROOT_PROJECT_DESCRIPTOR + + companion object { + val TEST_ROOT_PROJECT_DESCRIPTOR = object : LightProjectDescriptor() { + override fun getModuleTypeId(): String = ModuleTypeId.JAVA_MODULE + override fun getSdk(): Sdk = PluginTestCaseBase.mockJdk() + override fun getSourceRootType(): JpsModuleSourceRootType<*> = JavaSourceRootType.TEST_SOURCE + } } } \ No newline at end of file From 1bb864bbb066e68e785aaf103d0922cecc746179 Mon Sep 17 00:00:00 2001 From: Mads Ager Date: Tue, 8 Dec 2020 09:30:05 +0100 Subject: [PATCH 488/698] [JVM] Add tests that expose problem with locals collapsing. The collapsing happens during suspend function state machine transformation. --- .../CoroutineTransformerMethodVisitor.kt | 1 + .../inlineLocalsStateMachineTransform.kt | 43 ++++++++++++++++ .../suspend/localsStateMachineTransform.kt | 50 +++++++++++++++++++ .../IrLocalVariableTestGenerated.java | 12 +++++ .../LocalVariableTestGenerated.java | 12 +++++ 5 files changed, 118 insertions(+) create mode 100644 compiler/testData/debug/localVariables/suspend/inlineLocalsStateMachineTransform.kt create mode 100644 compiler/testData/debug/localVariables/suspend/localsStateMachineTransform.kt diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt index 26e7d78fb87..d43f9884a96 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.codegen.coroutines +import com.sun.org.apache.bcel.internal.generic.StoreInstruction import org.jetbrains.kotlin.codegen.* import org.jetbrains.kotlin.codegen.inline.* import org.jetbrains.kotlin.codegen.optimization.common.* diff --git a/compiler/testData/debug/localVariables/suspend/inlineLocalsStateMachineTransform.kt b/compiler/testData/debug/localVariables/suspend/inlineLocalsStateMachineTransform.kt new file mode 100644 index 00000000000..d29c27117cf --- /dev/null +++ b/compiler/testData/debug/localVariables/suspend/inlineLocalsStateMachineTransform.kt @@ -0,0 +1,43 @@ +// WITH_COROUTINES +// FILE: test.kt +inline fun hasLocal(): Int { + val x = 41 + return x + 1 +} + +suspend fun h() { } + +suspend fun box() { + // Force state machine transformation. + h() + // Local `x` should be visible in the inlined code. + hasLocal() + // Local `x` is not visible here. + 42 + // Local `x` (different one) is visible in the inlined code. + hasLocal() +} + +// LOCAL VARIABLES +// test.kt:10 box: +// CoroutineUtil.kt:28 getContext: + +// LOCAL VARIABLES JVM_IR +// test.kt:-1 : $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation + +// LOCAL VARIABLES JVM +// test.kt:-1 : + +// LOCAL VARIABLES +// test.kt:10 box: +// test.kt:12 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null +// test.kt:8 h: $completion:kotlin.coroutines.Continuation=TestKt$box$1 +// test.kt:12 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null +// test.kt:14 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null +// test.kt:4 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, $i$f$hasLocal:int=0:int +// test.kt:5 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, $i$f$hasLocal:int=0:int, x$iv:int=41:int +// test.kt:16 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x$iv:int=41:int +// test.kt:18 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x$iv:int=41:int +// test.kt:4 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x$iv:int=41:int, $i$f$hasLocal:int=0:int +// test.kt:5 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x$iv:int=41:int, $i$f$hasLocal:int=0:int +// test.kt:19 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null diff --git a/compiler/testData/debug/localVariables/suspend/localsStateMachineTransform.kt b/compiler/testData/debug/localVariables/suspend/localsStateMachineTransform.kt new file mode 100644 index 00000000000..1048cc68a54 --- /dev/null +++ b/compiler/testData/debug/localVariables/suspend/localsStateMachineTransform.kt @@ -0,0 +1,50 @@ +// WITH_COROUTINES +// FILE: test.kt +suspend fun h() { } + +fun f(x: Int) = x + +suspend fun box() { + // Force state machine transformation. + h() + for (x in 0..1) { + f(x) + } + // Local `x` is NOT visible here. + 42 + for (x in 0..1) { + f(x) + } +} + +// The current backend does not have `x` visible in the locals table for the for loop at all. +// IGNORE_BACKEND: JVM + +// LOCAL VARIABLES +// test.kt:7 box: +// CoroutineUtil.kt:28 getContext: +// test.kt:-1 : $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation +// test.kt:7 box: +// test.kt:9 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null +// test.kt:3 h: $completion:kotlin.coroutines.Continuation=TestKt$box$1 +// test.kt:9 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null +// test.kt:10 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null +// test.kt:11 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=0:int +// test.kt:5 f: x:int=0:int +// test.kt:11 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=0:int +// test.kt:10 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=0:int +// test.kt:11 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int +// test.kt:5 f: x:int=1:int +// test.kt:11 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int +// test.kt:10 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int +// test.kt:14 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int +// test.kt:15 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int +// test.kt:16 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=0:int +// test.kt:5 f: x:int=0:int +// test.kt:16 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=0:int +// test.kt:15 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null +// test.kt:16 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int +// test.kt:5 f: x:int=1:int +// test.kt:16 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int +// test.kt:15 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null +// test.kt:18 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/IrLocalVariableTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/IrLocalVariableTestGenerated.java index 06f802eb132..9cff4f76673 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/IrLocalVariableTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/IrLocalVariableTestGenerated.java @@ -154,6 +154,18 @@ public class IrLocalVariableTestGenerated extends AbstractIrLocalVariableTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/debug/localVariables/suspend"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @Test + @TestMetadata("inlineLocalsStateMachineTransform.kt") + public void testInlineLocalsStateMachineTransform() throws Exception { + runTest("compiler/testData/debug/localVariables/suspend/inlineLocalsStateMachineTransform.kt"); + } + + @Test + @TestMetadata("localsStateMachineTransform.kt") + public void testLocalsStateMachineTransform() throws Exception { + runTest("compiler/testData/debug/localVariables/suspend/localsStateMachineTransform.kt"); + } + @Test @TestMetadata("simple.kt") public void testSimple() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/LocalVariableTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/LocalVariableTestGenerated.java index abcc2223d1a..588933c69fd 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/LocalVariableTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/LocalVariableTestGenerated.java @@ -154,6 +154,18 @@ public class LocalVariableTestGenerated extends AbstractLocalVariableTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/debug/localVariables/suspend"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } + @Test + @TestMetadata("inlineLocalsStateMachineTransform.kt") + public void testInlineLocalsStateMachineTransform() throws Exception { + runTest("compiler/testData/debug/localVariables/suspend/inlineLocalsStateMachineTransform.kt"); + } + + @Test + @TestMetadata("localsStateMachineTransform.kt") + public void testLocalsStateMachineTransform() throws Exception { + runTest("compiler/testData/debug/localVariables/suspend/localsStateMachineTransform.kt"); + } + @Test @TestMetadata("simple.kt") public void testSimple() throws Exception { From 717e087fd92c198250b43f0b9f941d26426a8113 Mon Sep 17 00:00:00 2001 From: Mads Ager Date: Tue, 8 Dec 2020 15:56:05 +0100 Subject: [PATCH 489/698] [JVM] Do not collaps unrelated locals in state machine transform. --- .../CoroutineTransformerMethodVisitor.kt | 28 ++++++------------- .../inlineLocalsStateMachineTransform.kt | 8 +++--- .../suspend/localsStateMachineTransform.kt | 8 +++--- 3 files changed, 17 insertions(+), 27 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt index d43f9884a96..2099d5c044f 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt @@ -5,7 +5,6 @@ package org.jetbrains.kotlin.codegen.coroutines -import com.sun.org.apache.bcel.internal.generic.StoreInstruction import org.jetbrains.kotlin.codegen.* import org.jetbrains.kotlin.codegen.inline.* import org.jetbrains.kotlin.codegen.optimization.common.* @@ -1223,8 +1222,9 @@ private fun updateLvtAccordingToLiveness(method: MethodNode, isForNamedFunction: oldLvt += record } method.localVariables.clear() - // Skip `this` for suspend lamdba + // Skip `this` for suspend lambda val start = if (isForNamedFunction) 0 else 1 + val oldLvtNodeToLatestNewLvtNode = mutableMapOf() for (variableIndex in start until method.maxLocals) { if (oldLvt.none { it.index == variableIndex }) continue var startLabel: LabelNode? = null @@ -1240,25 +1240,15 @@ private fun updateLvtAccordingToLiveness(method: MethodNode, isForNamedFunction: val endLabel = insn as? LabelNode ?: insn.findNextOrNull { it is LabelNode } as? LabelNode ?: continue // startLabel can be null in case of parameters @Suppress("NAME_SHADOWING") val startLabel = startLabel ?: lvtRecord.start - var recordToExtend: LocalVariableNode? = null - for (record in method.localVariables) { - if (record.name == lvtRecord.name && - record.desc == lvtRecord.desc && - record.signature == lvtRecord.signature && - record.index == lvtRecord.index - ) { - if (InsnSequence(record.end, startLabel).none { isBeforeSuspendMarker(it) }) { - recordToExtend = record - break - } - } - } - if (recordToExtend != null) { + // Attempt to extend existing local variable node corresponding to the record in + // the original local variable table. + var recordToExtend: LocalVariableNode? = oldLvtNodeToLatestNewLvtNode[lvtRecord] + if (recordToExtend != null && InsnSequence(recordToExtend.end, startLabel).none { isBeforeSuspendMarker(it) }) { recordToExtend.end = endLabel } else { - method.localVariables.add( - LocalVariableNode(lvtRecord.name, lvtRecord.desc, lvtRecord.signature, startLabel, endLabel, lvtRecord.index) - ) + val node = LocalVariableNode(lvtRecord.name, lvtRecord.desc, lvtRecord.signature, startLabel, endLabel, lvtRecord.index) + method.localVariables.add(node) + oldLvtNodeToLatestNewLvtNode[lvtRecord] = node } } } diff --git a/compiler/testData/debug/localVariables/suspend/inlineLocalsStateMachineTransform.kt b/compiler/testData/debug/localVariables/suspend/inlineLocalsStateMachineTransform.kt index d29c27117cf..602172aa480 100644 --- a/compiler/testData/debug/localVariables/suspend/inlineLocalsStateMachineTransform.kt +++ b/compiler/testData/debug/localVariables/suspend/inlineLocalsStateMachineTransform.kt @@ -36,8 +36,8 @@ suspend fun box() { // test.kt:14 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null // test.kt:4 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, $i$f$hasLocal:int=0:int // test.kt:5 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, $i$f$hasLocal:int=0:int, x$iv:int=41:int -// test.kt:16 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x$iv:int=41:int -// test.kt:18 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x$iv:int=41:int -// test.kt:4 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x$iv:int=41:int, $i$f$hasLocal:int=0:int -// test.kt:5 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x$iv:int=41:int, $i$f$hasLocal:int=0:int +// test.kt:16 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null +// test.kt:18 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null +// test.kt:4 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, $i$f$hasLocal:int=0:int +// test.kt:5 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, $i$f$hasLocal:int=0:int, x$iv:int=41:int // test.kt:19 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null diff --git a/compiler/testData/debug/localVariables/suspend/localsStateMachineTransform.kt b/compiler/testData/debug/localVariables/suspend/localsStateMachineTransform.kt index 1048cc68a54..0ae1b1c2f09 100644 --- a/compiler/testData/debug/localVariables/suspend/localsStateMachineTransform.kt +++ b/compiler/testData/debug/localVariables/suspend/localsStateMachineTransform.kt @@ -32,13 +32,13 @@ suspend fun box() { // test.kt:11 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=0:int // test.kt:5 f: x:int=0:int // test.kt:11 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=0:int -// test.kt:10 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=0:int +// test.kt:10 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null // test.kt:11 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int // test.kt:5 f: x:int=1:int // test.kt:11 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int -// test.kt:10 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int -// test.kt:14 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int -// test.kt:15 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int +// test.kt:10 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null +// test.kt:14 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null +// test.kt:15 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null // test.kt:16 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=0:int // test.kt:5 f: x:int=0:int // test.kt:16 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=0:int From 0ca7c504520ccb313deb84096c438fe202e6e937 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Tue, 8 Dec 2020 17:21:37 +0100 Subject: [PATCH 490/698] FIR IDE: refactor, separate resolveSimpleNameReference into functions --- .../references/FirReferenceResolveHelper.kt | 340 +++++++++++------- 1 file changed, 203 insertions(+), 137 deletions(-) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/FirReferenceResolveHelper.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/FirReferenceResolveHelper.kt index 0164b12d778..2f5db53c68d 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/FirReferenceResolveHelper.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/FirReferenceResolveHelper.kt @@ -140,150 +140,215 @@ internal object FirReferenceResolveHelper { val symbolBuilder = analysisSession.firSymbolBuilder val fir = expression.getOrBuildFir(analysisSession.firResolveState) val session = analysisSession.firResolveState.rootModuleSession - when (fir) { - is FirResolvedTypeRef -> { - if (expression.isPartOfUserTypeRefQualifier()) { - val typeQualifier = findPossibleTypeQualifier(expression, fir)?.toTargetPsi(session, symbolBuilder) - val typeOrPackageQualifier = typeQualifier ?: getPackageSymbolFor(expression, symbolBuilder, forQualifiedType = true) - - return listOfNotNull(typeOrPackageQualifier) - } - return listOfNotNull(fir.toTargetSymbol(session, symbolBuilder)) - } - is FirResolvedQualifier -> { - // TODO refactor that block - val classId = fir.classId ?: return emptyList() - - var parent = expression.parent as? KtDotQualifiedExpression - // Distinguish A.foo() from A(.Companion).foo() - // Make expression.parent as? KtDotQualifiedExpression local function - while (parent != null) { - val selectorExpression = parent.selectorExpression ?: break - if (selectorExpression === expression) { - parent = parent.parent as? KtDotQualifiedExpression - continue - } - val receiverClassId = if (parent.receiverExpression == expression) { - /* - * A.Named.i -> class A - */ - val name = fir.relativeClassFqName?.pathSegments()?.firstOrNull() - name?.let { ClassId(fir.packageFqName, it) } - } else null - val parentFir = selectorExpression.getOrBuildFir(analysisSession.firResolveState) - when { - parentFir is FirQualifiedAccess -> { - return listOfNotNull( - (receiverClassId ?: classId).toTargetPsi(session, symbolBuilder, parentFir.calleeReference) - ) - } - receiverClassId != null -> { - return listOfNotNull(receiverClassId.toTargetPsi(session, symbolBuilder)) - } - else -> parent = parent.parent as? KtDotQualifiedExpression - } - } - return listOfNotNull(classId.toTargetPsi(session, symbolBuilder)) - } - is FirAnnotationCall -> { - val type = fir.typeRef as? FirResolvedTypeRef ?: return emptyList() - return listOfNotNull(type.toTargetSymbol(session, symbolBuilder)) - } - is FirResolvedImport -> { - if (expression.isPartOfQualifiedExpression()) { - return listOfNotNull(getPackageSymbolFor(expression, symbolBuilder, forQualifiedType = false)) - } - - val classId = fir.resolvedClassId - if (classId != null) { - return listOfNotNull(classId.toTargetPsi(session, symbolBuilder)) - } - val name = fir.importedName ?: return emptyList() - val symbolProvider = session.firSymbolProvider - - @OptIn(ExperimentalStdlibApi::class) - return buildList { - symbolProvider.getTopLevelCallableSymbols(fir.packageFqName, name) - .mapTo(this) { it.fir.buildSymbol(symbolBuilder) } - symbolProvider - .getClassLikeSymbolByFqName(ClassId(fir.packageFqName, name)) - ?.fir - ?.buildSymbol(symbolBuilder) - ?.let(::add) - } - } - is FirFile -> { - if (expression.getNonStrictParentOfType() != null) { - // Special: package reference in the middle of package directive - return listOfNotNull(getPackageSymbolFor(expression, symbolBuilder, forQualifiedType = false)) - } - return listOf(symbolBuilder.buildSymbol(fir)) - } + return when (fir) { + is FirResolvedTypeRef -> getSymbolsForResolvedTypeRef(fir, expression, session, symbolBuilder) + is FirResolvedQualifier -> + getSymbolsForResolvedQualifier(fir, expression, session, symbolBuilder, analysisSession) + is FirAnnotationCall -> getSymbolsForAnnotationCall(fir, session, symbolBuilder) + is FirResolvedImport -> getSymbolsByResolvedImport(expression, symbolBuilder, fir, session) + is FirFile -> getSymbolsByFirFile(expression, symbolBuilder, fir) is FirArrayOfCall -> { // We can't yet find PsiElement for arrayOf, intArrayOf, etc. - return emptyList() - } - is FirReturnExpression -> { - return if (expression is KtLabelReferenceExpression) { - listOf(fir.target.labeledElement.buildSymbol(symbolBuilder)) - } else emptyList() - } - is FirErrorNamedReference -> { - val candidates = when (val diagnostic = fir.diagnostic) { - is ConeAmbiguityError -> diagnostic.candidates - is ConeOperatorAmbiguityError -> diagnostic.candidates - is ConeInapplicableCandidateError -> listOf(diagnostic.candidateSymbol) - else -> emptyList() - } - return candidates.mapNotNull { it.fir.buildSymbol(symbolBuilder) } - } - is FirResolvable -> { - val calleeReference = - if (fir is FirFunctionCall - && fir.isImplicitFunctionCall() - && expression is KtNameReferenceExpression - ) { - // we are resolving implicit invoke call, like - // fun foo(a: () -> Unit) { - // a() - // } - (fir.dispatchReceiver as FirQualifiedAccessExpression).calleeReference - } else fir.calleeReference - return listOfNotNull(calleeReference.toTargetSymbol(session, symbolBuilder)) - } - else -> { - // Handle situation when we're in the middle/beginning of qualifier - // A.B.C.foo() or A.B.C.foo() - // NB: in this case we get some parent FIR, like FirBlock, FirProperty, FirFunction or the like - var parent = expression.parent as? KtDotQualifiedExpression - var unresolvedCounter = 1 - while (parent != null) { - val selectorExpression = parent.selectorExpression ?: break - if (selectorExpression === expression) { - parent = parent.parent as? KtDotQualifiedExpression - continue - } - val parentFir = selectorExpression.getOrBuildFir(analysisSession.firResolveState) - if (parentFir is FirResolvedQualifier) { - var classId = parentFir.classId - while (unresolvedCounter > 0) { - unresolvedCounter-- - classId = classId?.outerClassId - } - return listOfNotNull(classId?.toTargetPsi(session, symbolBuilder)) - } - parent = parent.parent as? KtDotQualifiedExpression - unresolvedCounter++ - } - return emptyList() + emptyList() } + is FirReturnExpression -> getSymbolsByReturnExpression(expression, fir, symbolBuilder) + is FirErrorNamedReference -> getSymbolsByErrorNamedReference(fir, symbolBuilder) + is FirResolvable -> getSymbolsByResolvable(fir, expression, session, symbolBuilder) + else -> handleUnknownFirElement(expression, analysisSession, session, symbolBuilder) } } - private fun findPossibleTypeQualifier(qualifier: KtSimpleNameExpression, wholeTypeFir: FirResolvedTypeRef): ClassId? { + private fun handleUnknownFirElement( + expression: KtSimpleNameExpression, + analysisSession: KtFirAnalysisSession, + session: FirSession, + symbolBuilder: KtSymbolByFirBuilder + ): List { + // Handle situation when we're in the middle/beginning of qualifier + // A.B.C.foo() or A.B.C.foo() + // NB: in this case we get some parent FIR, like FirBlock, FirProperty, FirFunction or the like + var parent = expression.parent as? KtDotQualifiedExpression + var unresolvedCounter = 1 + while (parent != null) { + val selectorExpression = parent.selectorExpression ?: break + if (selectorExpression === expression) { + parent = parent.parent as? KtDotQualifiedExpression + continue + } + val parentFir = selectorExpression.getOrBuildFir(analysisSession.firResolveState) + if (parentFir is FirResolvedQualifier) { + var classId = parentFir.classId + while (unresolvedCounter > 0) { + unresolvedCounter-- + classId = classId?.outerClassId + } + return listOfNotNull(classId?.toTargetPsi(session, symbolBuilder)) + } + parent = parent.parent as? KtDotQualifiedExpression + unresolvedCounter++ + } + return emptyList() + } + + private fun getSymbolsByResolvable( + fir: FirResolvable, + expression: KtSimpleNameExpression, + session: FirSession, + symbolBuilder: KtSymbolByFirBuilder + ): List { + val calleeReference = + if (fir is FirFunctionCall + && fir.isImplicitFunctionCall() + && expression is KtNameReferenceExpression + ) { + // we are resolving implicit invoke call, like + // fun foo(a: () -> Unit) { + // a() + // } + (fir.dispatchReceiver as FirQualifiedAccessExpression).calleeReference + } else fir.calleeReference + return listOfNotNull(calleeReference.toTargetSymbol(session, symbolBuilder)) + } + + private fun getSymbolsByErrorNamedReference( + fir: FirErrorNamedReference, + symbolBuilder: KtSymbolByFirBuilder + ): List { + val candidates = when (val diagnostic = fir.diagnostic) { + is ConeAmbiguityError -> diagnostic.candidates + is ConeOperatorAmbiguityError -> diagnostic.candidates + is ConeInapplicableCandidateError -> listOf(diagnostic.candidateSymbol) + else -> emptyList() + } + return candidates.mapNotNull { it.fir.buildSymbol(symbolBuilder) } + } + + private fun getSymbolsByReturnExpression( + expression: KtSimpleNameExpression, + fir: FirReturnExpression, + symbolBuilder: KtSymbolByFirBuilder + ): Collection { + return if (expression is KtLabelReferenceExpression) { + listOf(fir.target.labeledElement.buildSymbol(symbolBuilder)) + } else emptyList() + } + + private fun getSymbolsByFirFile( + expression: KtSimpleNameExpression, + symbolBuilder: KtSymbolByFirBuilder, + fir: FirFile + ): List { + if (expression.getNonStrictParentOfType() != null) { + // Special: package reference in the middle of package directive + return listOfNotNull(getPackageSymbolFor(expression, symbolBuilder, forQualifiedType = false)) + } + return listOf(symbolBuilder.buildSymbol(fir)) + } + + private fun getSymbolsByResolvedImport( + expression: KtSimpleNameExpression, + symbolBuilder: KtSymbolByFirBuilder, + fir: FirResolvedImport, + session: FirSession + ): List { + if (expression.isPartOfQualifiedExpression()) { + return listOfNotNull(getPackageSymbolFor(expression, symbolBuilder, forQualifiedType = false)) + } + + val classId = fir.resolvedClassId + if (classId != null) { + return listOfNotNull(classId.toTargetPsi(session, symbolBuilder)) + } + val name = fir.importedName ?: return emptyList() + val symbolProvider = session.firSymbolProvider + + @OptIn(ExperimentalStdlibApi::class) + return buildList { + symbolProvider.getTopLevelCallableSymbols(fir.packageFqName, name) + .mapTo(this) { it.fir.buildSymbol(symbolBuilder) } + symbolProvider + .getClassLikeSymbolByFqName(ClassId(fir.packageFqName, name)) + ?.fir + ?.buildSymbol(symbolBuilder) + ?.let(::add) + } + } + + private fun getSymbolsForResolvedTypeRef( + fir: FirResolvedTypeRef, + expression: KtSimpleNameExpression, + session: FirSession, + symbolBuilder: KtSymbolByFirBuilder + ): Collection { + if (expression.isPartOfUserTypeRefQualifier()) { + val typeQualifier = findPossibleTypeQualifier(expression, fir)?.toTargetPsi(session, symbolBuilder) + val typeOrPackageQualifier = + typeQualifier ?: getPackageSymbolFor(expression, symbolBuilder, forQualifiedType = true) + + return listOfNotNull(typeOrPackageQualifier) + } + return listOfNotNull(fir.toTargetSymbol(session, symbolBuilder)) + } + + private fun getSymbolsForResolvedQualifier( + fir: FirResolvedQualifier, + expression: KtSimpleNameExpression, + session: FirSession, + symbolBuilder: KtSymbolByFirBuilder, + analysisSession: KtFirAnalysisSession + ): Collection { + // TODO refactor that block + val classId = fir.classId ?: return emptyList() + + var parent = expression.parent as? KtDotQualifiedExpression + // Distinguish A.foo() from A(.Companion).foo() + // Make expression.parent as? KtDotQualifiedExpression local function + while (parent != null) { + val selectorExpression = parent.selectorExpression ?: break + if (selectorExpression === expression) { + parent = parent.parent as? KtDotQualifiedExpression + continue + } + val receiverClassId = if (parent.receiverExpression == expression) { + /* + * A.Named.i -> class A + */ + val name = fir.relativeClassFqName?.pathSegments()?.firstOrNull() + name?.let { ClassId(fir.packageFqName, it) } + } else null + val parentFir = selectorExpression.getOrBuildFir(analysisSession.firResolveState) + when { + parentFir is FirQualifiedAccess -> { + return listOfNotNull( + (receiverClassId ?: classId).toTargetPsi(session, symbolBuilder, parentFir.calleeReference) + ) + } + receiverClassId != null -> { + return listOfNotNull(receiverClassId.toTargetPsi(session, symbolBuilder)) + } + else -> parent = parent.parent as? KtDotQualifiedExpression + } + } + return listOfNotNull(classId.toTargetPsi(session, symbolBuilder)) + } + + private fun getSymbolsForAnnotationCall( + fir: FirAnnotationCall, + session: FirSession, + symbolBuilder: KtSymbolByFirBuilder + ): Collection { + val type = fir.typeRef as? FirResolvedTypeRef ?: return emptyList() + return listOfNotNull(type.toTargetSymbol(session, symbolBuilder)) + } + + private fun findPossibleTypeQualifier( + qualifier: KtSimpleNameExpression, + wholeTypeFir: FirResolvedTypeRef + ): ClassId? { val qualifierToResolve = qualifier.parent as KtUserType // FIXME make it work with generics in functional types (like () -> AA.BB) - val wholeType = (wholeTypeFir.psi as KtTypeReference).typeElement?.unwrapNullable() as? KtUserType ?: return null + val wholeType = + (wholeTypeFir.psi as KtTypeReference).typeElement?.unwrapNullable() as? KtUserType ?: return null val qualifiersToDrop = countQualifiersToDrop(wholeType, qualifierToResolve) return wholeTypeFir.type.classId?.dropLastNestedClasses(qualifiersToDrop) @@ -294,7 +359,8 @@ internal object FirReferenceResolveHelper { * * Example: `foo.bar.Baz.Inner` with 1 dropped class is `foo.bar.Baz`, and with 2 dropped class is `null`. */ - private fun ClassId.dropLastNestedClasses(classesToDrop: Int) = generateSequence(this) { it.outerClassId }.drop(classesToDrop).firstOrNull() + private fun ClassId.dropLastNestedClasses(classesToDrop: Int) = + generateSequence(this) { it.outerClassId }.drop(classesToDrop).firstOrNull() /** * @return How many qualifiers needs to be dropped from [wholeType] to get [nestedType]. From df9ecb0f4aebe404a105598b345b7c34c96f8e06 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Tue, 8 Dec 2020 17:21:56 +0300 Subject: [PATCH 491/698] Dependency of js tests generation on compiler test data generation (KTI-404) There was an error during "Generate Compiler Tests" execution: Exception in thread "main" java.lang.RuntimeException: java.io.FileNotFoundException: compiler\testData\codegen\box\ranges\expression\inexactDownToMinValue.kt The error was probable caused by parallel execution of tasks:compiler:generateTests and :js:js.tests:generateTests. Exception could occur when GenerateRangesCodegenTestData.main(args) has just removed directory with test data for regeneration but :js:js.tests:generateTests had already seen files present. #KTI-404 Fixed --- buildSrc/src/main/kotlin/CommonUtil.kt | 3 ++- compiler/build.gradle.kts | 5 ++++- .../generators/tests/GenerateCompilerTestData.kt | 13 +++++++++++++ .../generators/tests/GenerateCompilerTests.kt | 5 ----- js/js.tests/build.gradle.kts | 5 ++++- 5 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTestData.kt diff --git a/buildSrc/src/main/kotlin/CommonUtil.kt b/buildSrc/src/main/kotlin/CommonUtil.kt index daf26a29c44..72c8f9630c2 100644 --- a/buildSrc/src/main/kotlin/CommonUtil.kt +++ b/buildSrc/src/main/kotlin/CommonUtil.kt @@ -54,11 +54,12 @@ var Project.javaHome: String? extra["javaHome"] = v } -fun Project.generator(fqName: String, sourceSet: SourceSet? = null) = smartJavaExec { +fun Project.generator(fqName: String, sourceSet: SourceSet? = null, configure: JavaExec.() -> Unit = {}) = smartJavaExec { classpath = (sourceSet ?: testSourceSet).runtimeClasspath mainClass.set(fqName) workingDir = rootDir systemProperty("line.separator", "\n") + configure() } fun Project.getBooleanProperty(name: String): Boolean? = this.findProperty(name)?.let { diff --git a/compiler/build.gradle.kts b/compiler/build.gradle.kts index f2dc5e8c8bc..e01d48d01cf 100644 --- a/compiler/build.gradle.kts +++ b/compiler/build.gradle.kts @@ -98,6 +98,9 @@ projectTest(parallel = true) { } } -val generateTests by generator("org.jetbrains.kotlin.generators.tests.GenerateCompilerTestsKt") +val generateTestData by generator("org.jetbrains.kotlin.generators.tests.GenerateCompilerTestDataKt") +val generateTests by generator("org.jetbrains.kotlin.generators.tests.GenerateCompilerTestsKt") { + dependsOn(generateTestData) +} testsJar() diff --git a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTestData.kt b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTestData.kt new file mode 100644 index 00000000000..422ba3627e3 --- /dev/null +++ b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTestData.kt @@ -0,0 +1,13 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.generators.tests + +fun main(args: Array) { + GenerateRangesCodegenTestData.main(args) + GenerateInRangeExpressionTestData.main(args) + GenerateSteppedRangesCodegenTestData.main(args) + GeneratePrimitiveVsObjectEqualityTestData.main(args) +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt index 1001e93c592..56a73b4b4c8 100644 --- a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt +++ b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt @@ -181,11 +181,6 @@ fun main(args: Array) { model("parseCodeFragment/block", testMethod = "doBlockCodeFragmentParsingTest", extension = "kt") } - GenerateRangesCodegenTestData.main(args) - GenerateInRangeExpressionTestData.main(args) - GenerateSteppedRangesCodegenTestData.main(args) - GeneratePrimitiveVsObjectEqualityTestData.main(args) - testClass { model("codegen/box", targetBackend = TargetBackend.JVM) } diff --git a/js/js.tests/build.gradle.kts b/js/js.tests/build.gradle.kts index 345a45cff74..8e98c305c41 100644 --- a/js/js.tests/build.gradle.kts +++ b/js/js.tests/build.gradle.kts @@ -272,7 +272,10 @@ projectTest("quickTest", true) { testsJar {} -val generateTests by generator("org.jetbrains.kotlin.generators.tests.GenerateJsTestsKt") +val generateTests by generator("org.jetbrains.kotlin.generators.tests.GenerateJsTestsKt") { + dependsOn(":compiler:generateTestData") +} + val testDataDir = project(":js:js.translator").projectDir.resolve("testData") extensions.getByType(NodeExtension::class.java).nodeModulesDir = testDataDir From e089e3606fdea9e203517e1a1ec0fdaa503877b8 Mon Sep 17 00:00:00 2001 From: Alexander Dudinsky Date: Wed, 9 Dec 2020 09:27:04 +0300 Subject: [PATCH 492/698] Disable `testSingleAndroidTarget` while OOM investigation in progress KT-43755 --- .../kotlin/gradle/NewMultiplatformProjectImportingTest.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt index 0c4829039ee..62bf108442c 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt @@ -21,6 +21,7 @@ import org.jetbrains.plugins.gradle.tooling.annotation.PluginTargetVersions import org.junit.After import org.junit.Before import org.junit.Test +import org.junit.Ignore //ToDo: Need to remove RUNTIME dependencies when KT-40551 is resolved class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportingTestCase() { @@ -435,6 +436,7 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin @Test + @Ignore @PluginTargetVersions(gradleVersion = "5.0+", pluginVersion = "1.3.50+", gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster) fun testSingleAndroidTarget() { configureByFiles() From d8d30263d3361c8c24c7f407d836791d3e6f79b4 Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Tue, 8 Dec 2020 15:25:33 +0100 Subject: [PATCH 493/698] IC Mangling: search parents for method if descriptor is fake override Otherwise, the compiler generates call using old mangling scheme because classfile does not contain the method. --- .../codegen/inlineClassesCodegenUtil.kt | 9 ++++---- ...mpileKotlinAgainstKotlinTestGenerated.java | 5 +++++ .../inlineClassFakeOverrideMangling.kt | 22 +++++++++++++++++++ ...mpileKotlinAgainstKotlinTestGenerated.java | 5 +++++ ...mpileKotlinAgainstKotlinTestGenerated.java | 5 +++++ .../ir/JvmIrAgainstOldBoxTestGenerated.java | 5 +++++ .../ir/JvmOldAgainstIrBoxTestGenerated.java | 5 +++++ 7 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 compiler/testData/compileKotlinAgainstKotlin/inlineClassFakeOverrideMangling.kt diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/inlineClassesCodegenUtil.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/inlineClassesCodegenUtil.kt index 64945f6bdb5..3c4754923a8 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/inlineClassesCodegenUtil.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/inlineClassesCodegenUtil.kt @@ -6,10 +6,7 @@ package org.jetbrains.kotlin.codegen import org.jetbrains.kotlin.codegen.state.GenerationState -import org.jetbrains.kotlin.descriptors.CallableDescriptor -import org.jetbrains.kotlin.descriptors.ClassDescriptor -import org.jetbrains.kotlin.descriptors.FunctionDescriptor -import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor +import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor import org.jetbrains.kotlin.load.kotlin.JvmPackagePartSource import org.jetbrains.kotlin.load.kotlin.VirtualFileFinder @@ -44,6 +41,10 @@ fun CallableDescriptor.isGenericParameter(): Boolean { fun classFileContainsMethod(descriptor: FunctionDescriptor, state: GenerationState, method: Method): Boolean? { if (descriptor !is DeserializedSimpleFunctionDescriptor) return null + if (descriptor.kind == CallableMemberDescriptor.Kind.FAKE_OVERRIDE) { + return descriptor.overriddenDescriptors.any { classFileContainsMethod(it, state, method) == true } + } + val classId: ClassId = when { descriptor.containingDeclaration is DeserializedClassDescriptor -> { (descriptor.containingDeclaration as DeserializedClassDescriptor).classId ?: return null diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java index 1f28a59acc0..19dc082737c 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java @@ -153,6 +153,11 @@ public class FirCompileKotlinAgainstKotlinTestGenerated extends AbstractFirCompi runTest("compiler/testData/compileKotlinAgainstKotlin/importCompanion.kt"); } + @TestMetadata("inlineClassFakeOverrideMangling.kt") + public void testInlineClassFakeOverrideMangling() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/inlineClassFakeOverrideMangling.kt"); + } + @TestMetadata("inlineClassFromBinaryDependencies.kt") public void testInlineClassFromBinaryDependencies() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/inlineClassFromBinaryDependencies.kt"); diff --git a/compiler/testData/compileKotlinAgainstKotlin/inlineClassFakeOverrideMangling.kt b/compiler/testData/compileKotlinAgainstKotlin/inlineClassFakeOverrideMangling.kt new file mode 100644 index 00000000000..b5f77ab6073 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstKotlin/inlineClassFakeOverrideMangling.kt @@ -0,0 +1,22 @@ +// !LANGUAGE: +InlineClasses + +// FILE: 1.kt + +inline class IC(val s: String) + +abstract class A { + fun foo(s: String) = IC(s) +} + +open class C : A() + +class D: C() + +// FILE: 2.kt + +fun box(): String { + var res = C().foo("OK").s + if (res != "OK") return "FAIL 1 $res" + res = D().foo("OK").s + return res +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java index 334e1f82531..7d17c880e71 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java @@ -158,6 +158,11 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl runTest("compiler/testData/compileKotlinAgainstKotlin/importCompanion.kt"); } + @TestMetadata("inlineClassFakeOverrideMangling.kt") + public void testInlineClassFakeOverrideMangling() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/inlineClassFakeOverrideMangling.kt"); + } + @TestMetadata("inlineClassFromBinaryDependencies.kt") public void testInlineClassFromBinaryDependencies() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/inlineClassFromBinaryDependencies.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java index a7fcd65d271..17e2689dd24 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java @@ -153,6 +153,11 @@ public class IrCompileKotlinAgainstKotlinTestGenerated extends AbstractIrCompile runTest("compiler/testData/compileKotlinAgainstKotlin/importCompanion.kt"); } + @TestMetadata("inlineClassFakeOverrideMangling.kt") + public void testInlineClassFakeOverrideMangling() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/inlineClassFakeOverrideMangling.kt"); + } + @TestMetadata("inlineClassFromBinaryDependencies.kt") public void testInlineClassFromBinaryDependencies() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/inlineClassFromBinaryDependencies.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java index b00353dd020..216c3c86fab 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java @@ -153,6 +153,11 @@ public class JvmIrAgainstOldBoxTestGenerated extends AbstractJvmIrAgainstOldBoxT runTest("compiler/testData/compileKotlinAgainstKotlin/importCompanion.kt"); } + @TestMetadata("inlineClassFakeOverrideMangling.kt") + public void testInlineClassFakeOverrideMangling() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/inlineClassFakeOverrideMangling.kt"); + } + @TestMetadata("inlineClassFromBinaryDependencies.kt") public void testInlineClassFromBinaryDependencies() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/inlineClassFromBinaryDependencies.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java index 0ac43e5c1dc..29e0050ee99 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java @@ -153,6 +153,11 @@ public class JvmOldAgainstIrBoxTestGenerated extends AbstractJvmOldAgainstIrBoxT runTest("compiler/testData/compileKotlinAgainstKotlin/importCompanion.kt"); } + @TestMetadata("inlineClassFakeOverrideMangling.kt") + public void testInlineClassFakeOverrideMangling() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/inlineClassFakeOverrideMangling.kt"); + } + @TestMetadata("inlineClassFromBinaryDependencies.kt") public void testInlineClassFromBinaryDependencies() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/inlineClassFromBinaryDependencies.kt"); From 69c88a8a0a4a8bc00bb1085363cb37f7ea01e6b4 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Tue, 8 Dec 2020 17:13:39 +0300 Subject: [PATCH 494/698] PSI2IR KT-41284 use getters for open data class property values 'allopen' compiler plug-in can make data classes and their members open, which is a compilation error in usual case, but makes sense for Spring and other frameworks that generate proxy-classes. --- .../generators/DataClassMembersGenerator.kt | 11 +- .../ir/FirBytecodeTextTestGenerated.java | 10 ++ .../kotlin/fir/Fir2IrTextTestGenerated.java | 5 + .../generators/DataClassMembersGenerator.kt | 8 +- .../ir/util/DataClassMembersGenerator.kt | 55 ++++--- .../bytecodeText/properties/dataClass.kt | 8 + .../bytecodeText/properties/openDataClass.kt | 14 ++ .../irText/classes/openDataClass.fir.kt.txt | 56 +++++++ .../ir/irText/classes/openDataClass.fir.txt | 139 ++++++++++++++++++ .../ir/irText/classes/openDataClass.kt | 7 + .../ir/irText/classes/openDataClass.kt.txt | 56 +++++++ .../ir/irText/classes/openDataClass.txt | 139 ++++++++++++++++++ .../codegen/BytecodeTextTestGenerated.java | 10 ++ .../ir/IrBytecodeTextTestGenerated.java | 10 ++ .../kotlin/ir/IrTextTestCaseGenerated.java | 5 + 15 files changed, 503 insertions(+), 30 deletions(-) create mode 100644 compiler/testData/codegen/bytecodeText/properties/dataClass.kt create mode 100644 compiler/testData/codegen/bytecodeText/properties/openDataClass.kt create mode 100644 compiler/testData/ir/irText/classes/openDataClass.fir.kt.txt create mode 100644 compiler/testData/ir/irText/classes/openDataClass.fir.txt create mode 100644 compiler/testData/ir/irText/classes/openDataClass.kt create mode 100644 compiler/testData/ir/irText/classes/openDataClass.kt.txt create mode 100644 compiler/testData/ir/irText/classes/openDataClass.txt diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DataClassMembersGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DataClassMembersGenerator.kt index 7e0ecbf63dd..c78bbd2d935 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DataClassMembersGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DataClassMembersGenerator.kt @@ -17,8 +17,6 @@ import org.jetbrains.kotlin.fir.declarations.impl.FirDeclarationStatusImpl import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope import org.jetbrains.kotlin.fir.symbols.CallableId import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag -import org.jetbrains.kotlin.fir.symbols.impl.ConeClassLikeLookupTagImpl -import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirVariableSymbol import org.jetbrains.kotlin.fir.types.ConeStarProjection @@ -37,7 +35,6 @@ import org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.ir.util.DataClassMembersGenerator -import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.Name /** @@ -84,11 +81,11 @@ class DataClassMembersGenerator(val components: Fir2IrComponents) { // TODO } - override fun getBackingField(parameter: ValueParameterDescriptor?, irValueParameter: IrValueParameter?): IrField? = + override fun getProperty(parameter: ValueParameterDescriptor?, irValueParameter: IrValueParameter?): IrProperty? = irValueParameter?.let { irClass.properties.single { irProperty -> irProperty.name == irValueParameter.name && irProperty.backingField?.type == irValueParameter.type - }.backingField + } } override fun transform(typeParameterDescriptor: TypeParameterDescriptor): IrType { @@ -216,8 +213,8 @@ class DataClassMembersGenerator(val components: Fir2IrComponents) { fun generateComponentBody(irFunction: IrFunction) { val index = getComponentIndex(irFunction)!! val valueParameter = irClass.primaryConstructor!!.valueParameters[index - 1] - val backingField = irDataClassMembersGenerator.getBackingField(null, valueParameter)!! - irDataClassMembersGenerator.generateComponentFunction(irFunction, backingField) + val irProperty = irDataClassMembersGenerator.getProperty(null, valueParameter)!! + irDataClassMembersGenerator.generateComponentFunction(irFunction, irProperty) } fun generateCopyBody(irFunction: IrFunction) = diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBytecodeTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBytecodeTextTestGenerated.java index 83b4453a87f..1188525c21b 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBytecodeTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBytecodeTextTestGenerated.java @@ -4210,6 +4210,16 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/properties"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @TestMetadata("dataClass.kt") + public void testDataClass() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/properties/dataClass.kt"); + } + + @TestMetadata("openDataClass.kt") + public void testOpenDataClass() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/properties/openDataClass.kt"); + } + @TestMetadata("compiler/testData/codegen/bytecodeText/properties/lateinit") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java index b5d80bfd611..7f13a2d4ae3 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java @@ -221,6 +221,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { runTest("compiler/testData/ir/irText/classes/objectWithInitializers.kt"); } + @TestMetadata("openDataClass.kt") + public void testOpenDataClass() throws Exception { + runTest("compiler/testData/ir/irText/classes/openDataClass.kt"); + } + @TestMetadata("outerClassAccess.kt") public void testOuterClassAccess() throws Exception { runTest("compiler/testData/ir/irText/classes/outerClassAccess.kt"); diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DataClassMembersGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DataClassMembersGenerator.kt index ad7079d37fd..0c9f09e84bb 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DataClassMembersGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DataClassMembersGenerator.kt @@ -69,10 +69,10 @@ class DataClassMembersGenerator( FunctionGenerator(declarationGenerator).generateSyntheticFunctionParameterDeclarations(irFunction) } - override fun getBackingField(parameter: ValueParameterDescriptor?, irValueParameter: IrValueParameter?): IrField? = + override fun getProperty(parameter: ValueParameterDescriptor?, irValueParameter: IrValueParameter?): IrProperty? = parameter?.let { val property = getOrFail(BindingContext.VALUE_PARAMETER_AS_PROPERTY, parameter) - return getBackingField(property) + return getProperty(property) } override fun transform(typeParameterDescriptor: TypeParameterDescriptor): IrType = @@ -86,8 +86,8 @@ class DataClassMembersGenerator( override fun generateComponentFunction(function: FunctionDescriptor, parameter: ValueParameterDescriptor) { if (!irClass.isData) return - val backingField = irDataClassMembersGenerator.getBackingField(parameter, null) ?: return - irDataClassMembersGenerator.generateComponentFunction(function, backingField) + val irProperty = irDataClassMembersGenerator.getProperty(parameter, null) ?: return + irDataClassMembersGenerator.generateComponentFunction(function, irProperty) } override fun generateCopyFunction(function: FunctionDescriptor, constructorParameters: List) { diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DataClassMembersGenerator.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DataClassMembersGenerator.kt index 15ff8885722..dc9b19bfa01 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DataClassMembersGenerator.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DataClassMembersGenerator.kt @@ -43,6 +43,8 @@ abstract class DataClassMembersGenerator( val irClass: IrClass, val origin: IrDeclarationOrigin ) { + private val irPropertiesByDescriptor: Map = + irClass.properties.associateBy { it.descriptor } inline fun T.buildWithScope(builder: (T) -> Unit): T = also { irDeclaration -> @@ -87,12 +89,26 @@ abstract class DataClassMembersGenerator( ) } + fun irGetProperty(receiver: IrExpression, property: IrProperty): IrExpression { + // In some JVM-specific cases, such as when 'allopen' compiler plugin is applied, + // data classes and corresponding properties can be non-final. + // We should use getters for such properties (see KT-41284). + val backingField = property.backingField + return if (property.modality == Modality.FINAL && backingField != null) { + irGetField(receiver, backingField) + } else { + irCall(property.getter!!).apply { + dispatchReceiver = receiver + } + } + } + fun putDefault(parameter: ValueParameterDescriptor, value: IrExpression) { irFunction.putDefault(parameter, irExprBody(value)) } - fun generateComponentFunction(irField: IrField) { - +irReturn(irGetField(irThis(), irField)) + fun generateComponentFunction(irProperty: IrProperty) { + +irReturn(irGetProperty(irThis(), irProperty)) } fun generateCopyFunction(constructorSymbol: IrConstructorSymbol) { @@ -120,9 +136,9 @@ abstract class DataClassMembersGenerator( +irIfThenReturnFalse(irNotIs(irOther(), irType)) val otherWithCast = irTemporary(irAs(irOther(), irType), "other_with_cast") for (property in properties) { - val field = getBackingField(property) - val arg1 = irGetField(irThis(), field) - val arg2 = irGetField(irGet(irType, otherWithCast.symbol), field) + val irProperty = getProperty(property) + val arg1 = irGetProperty(irThis(), irProperty) + val arg2 = irGetProperty(irGet(irType, otherWithCast.symbol), irProperty) +irIfThenReturnFalse(irNotEquals(arg1, arg2)) } +irReturnTrue() @@ -176,17 +192,17 @@ abstract class DataClassMembersGenerator( } private fun getHashCodeOfProperty(property: PropertyDescriptor): IrExpression { - val field = getBackingField(property) + val irProperty = getProperty(property) return when { property.type.isNullable() -> irIfNull( context.irBuiltIns.intType, - irGetField(irThis(), field), + irGetProperty(irThis(), irProperty), irInt(0), - getHashCodeOf(property, irGetField(irThis(), field)) + getHashCodeOf(property, irGetProperty(irThis(), irProperty)) ) else -> - getHashCodeOf(property, irGetField(irThis(), field)) + getHashCodeOf(property, irGetProperty(irThis(), irProperty)) } } @@ -222,7 +238,7 @@ abstract class DataClassMembersGenerator( irConcat.addArgument(irString(property.name.asString() + "=")) - val irPropertyValue = irGetField(irThis(), getBackingField(property)) + val irPropertyValue = irGetProperty(irThis(), getProperty(property)) val typeConstructorDescriptor = property.type.constructor.declarationDescriptor val irPropertyStringValue = @@ -243,8 +259,9 @@ abstract class DataClassMembersGenerator( } } - fun getBackingField(property: PropertyDescriptor): IrField = - irClass.properties.single { it.descriptor == property }.backingField!! + fun getProperty(property: PropertyDescriptor): IrProperty = + irPropertiesByDescriptor[property] + ?: throw AssertionError("Class: ${irClass.descriptor}: unexpected property descriptor: $property") abstract fun declareSimpleFunction(startOffset: Int, endOffset: Int, functionDescriptor: FunctionDescriptor): IrFunction @@ -281,20 +298,20 @@ abstract class DataClassMembersGenerator( } // Entry for psi2ir - fun generateComponentFunction(function: FunctionDescriptor, irField: IrField) { + fun generateComponentFunction(function: FunctionDescriptor, irProperty: IrProperty) { buildMember(function) { - generateComponentFunction(irField) + generateComponentFunction(irProperty) } } // Entry for fir2ir - fun generateComponentFunction(irFunction: IrFunction, irField: IrField) { + fun generateComponentFunction(irFunction: IrFunction, irProperty: IrProperty) { buildMember(irFunction) { - generateComponentFunction(irField) + generateComponentFunction(irProperty) } } - abstract fun getBackingField(parameter: ValueParameterDescriptor?, irValueParameter: IrValueParameter?): IrField? + abstract fun getProperty(parameter: ValueParameterDescriptor?, irValueParameter: IrValueParameter?): IrProperty? abstract fun transform(typeParameterDescriptor: TypeParameterDescriptor): IrType @@ -302,7 +319,7 @@ abstract class DataClassMembersGenerator( fun generateCopyFunction(function: FunctionDescriptor, constructorSymbol: IrConstructorSymbol) { buildMember(function) { function.valueParameters.forEach { parameter -> - putDefault(parameter, irGetField(irThis(), getBackingField(parameter, null)!!)) + putDefault(parameter, irGetProperty(irThis(), getProperty(parameter, null)!!)) } generateCopyFunction(constructorSymbol) } @@ -312,7 +329,7 @@ abstract class DataClassMembersGenerator( fun generateCopyFunction(irFunction: IrFunction, constructorSymbol: IrConstructorSymbol) { buildMember(irFunction) { irFunction.valueParameters.forEach { irValueParameter -> - irValueParameter.defaultValue = irExprBody(irGetField(irThis(), getBackingField(null, irValueParameter)!!)) + irValueParameter.defaultValue = irExprBody(irGetProperty(irThis(), getProperty(null, irValueParameter)!!)) } generateCopyFunction(constructorSymbol) } diff --git a/compiler/testData/codegen/bytecodeText/properties/dataClass.kt b/compiler/testData/codegen/bytecodeText/properties/dataClass.kt new file mode 100644 index 00000000000..fcdb74310c3 --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/properties/dataClass.kt @@ -0,0 +1,8 @@ +data class Test( + val x: String, + val y: String +) + +// 7 GETFIELD Test\.x +// 7 GETFIELD Test\.y +// - get, componentN, copy$default, toString, hashCode, 2 times in equals \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/properties/openDataClass.kt b/compiler/testData/codegen/bytecodeText/properties/openDataClass.kt new file mode 100644 index 00000000000..cf8a11eaacb --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/properties/openDataClass.kt @@ -0,0 +1,14 @@ +// This test emulates 'allopen' compiler plugin. + +@Suppress("INCOMPATIBLE_MODIFIERS") +open data class Test( + open val x: String, + open val y: String +) + +// 1 GETFIELD Test\.x +// 1 GETFIELD Test\.y + +// 6 INVOKEVIRTUAL Test\.getX +// 6 INVOKEVIRTUAL Test\.getY +// - componentN, copy$default, toString, hashCode, 2 times in equals \ No newline at end of file diff --git a/compiler/testData/ir/irText/classes/openDataClass.fir.kt.txt b/compiler/testData/ir/irText/classes/openDataClass.fir.kt.txt new file mode 100644 index 00000000000..0a475797811 --- /dev/null +++ b/compiler/testData/ir/irText/classes/openDataClass.fir.kt.txt @@ -0,0 +1,56 @@ +@Suppress(names = ["INCOMPATIBLE_MODIFIERS"]) +open data class ValidatedProperties { + constructor(test1: String, test2: String) /* primary */ { + super/*Any*/() + /* () */ + + } + + open val test1: String + field = test1 + open get + + open val test2: String + field = test2 + open get + + fun component1(): String { + return .() + } + + fun component2(): String { + return .() + } + + fun copy(test1: String = .(), test2: String = .()): ValidatedProperties { + return ValidatedProperties(test1 = test1, test2 = test2) + } + + override fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is ValidatedProperties -> return false + } + val tmp0_other_with_cast: ValidatedProperties = other as ValidatedProperties + when { + EQEQ(arg0 = .(), arg1 = tmp0_other_with_cast.()).not() -> return false + } + when { + EQEQ(arg0 = .(), arg1 = tmp0_other_with_cast.()).not() -> return false + } + return true + } + + override fun hashCode(): Int { + var result: Int = .().hashCode() + result = result.times(other = 31).plus(other = .().hashCode()) + return result + } + + override fun toString(): String { + return "ValidatedProperties(" + "test1=" + .() + ", " + "test2=" + .() + ")" + } + +} diff --git a/compiler/testData/ir/irText/classes/openDataClass.fir.txt b/compiler/testData/ir/irText/classes/openDataClass.fir.txt new file mode 100644 index 00000000000..445e2927336 --- /dev/null +++ b/compiler/testData/ir/irText/classes/openDataClass.fir.txt @@ -0,0 +1,139 @@ +FILE fqName: fileName:/openDataClass.kt + CLASS CLASS name:ValidatedProperties modality:OPEN visibility:public [data] superTypes:[kotlin.Any] + annotations: + Suppress(names = ['INCOMPATIBLE_MODIFIERS']) + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.ValidatedProperties + CONSTRUCTOR visibility:public <> (test1:kotlin.String, test2:kotlin.String) returnType:.ValidatedProperties [primary] + VALUE_PARAMETER name:test1 index:0 type:kotlin.String + VALUE_PARAMETER name:test2 index:1 type:kotlin.String + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:ValidatedProperties modality:OPEN visibility:public [data] superTypes:[kotlin.Any]' + PROPERTY name:test1 visibility:public modality:OPEN [val] + FIELD PROPERTY_BACKING_FIELD name:test1 type:kotlin.String visibility:private [final] + EXPRESSION_BODY + GET_VAR 'test1: kotlin.String declared in .ValidatedProperties.' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:OPEN <> ($this:.ValidatedProperties) returnType:kotlin.String + correspondingProperty: PROPERTY name:test1 visibility:public modality:OPEN [val] + $this: VALUE_PARAMETER name: type:.ValidatedProperties + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .ValidatedProperties' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test1 type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.' type=.ValidatedProperties origin=null + PROPERTY name:test2 visibility:public modality:OPEN [val] + FIELD PROPERTY_BACKING_FIELD name:test2 type:kotlin.String visibility:private [final] + EXPRESSION_BODY + GET_VAR 'test2: kotlin.String declared in .ValidatedProperties.' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:OPEN <> ($this:.ValidatedProperties) returnType:kotlin.String + correspondingProperty: PROPERTY name:test2 visibility:public modality:OPEN [val] + $this: VALUE_PARAMETER name: type:.ValidatedProperties + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .ValidatedProperties' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test2 type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.' type=.ValidatedProperties origin=null + FUN name:component1 visibility:public modality:FINAL <> ($this:.ValidatedProperties) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:.ValidatedProperties + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.String declared in .ValidatedProperties' + CALL 'public open fun (): kotlin.String declared in .ValidatedProperties' type=kotlin.String origin=null + $this: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.component1' type=.ValidatedProperties origin=null + FUN name:component2 visibility:public modality:FINAL <> ($this:.ValidatedProperties) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:.ValidatedProperties + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun component2 (): kotlin.String declared in .ValidatedProperties' + CALL 'public open fun (): kotlin.String declared in .ValidatedProperties' type=kotlin.String origin=null + $this: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.component2' type=.ValidatedProperties origin=null + FUN name:copy visibility:public modality:FINAL <> ($this:.ValidatedProperties, test1:kotlin.String, test2:kotlin.String) returnType:.ValidatedProperties + $this: VALUE_PARAMETER name: type:.ValidatedProperties + VALUE_PARAMETER name:test1 index:0 type:kotlin.String + EXPRESSION_BODY + CALL 'public open fun (): kotlin.String declared in .ValidatedProperties' type=kotlin.String origin=null + $this: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.copy' type=.ValidatedProperties origin=null + VALUE_PARAMETER name:test2 index:1 type:kotlin.String + EXPRESSION_BODY + CALL 'public open fun (): kotlin.String declared in .ValidatedProperties' type=kotlin.String origin=null + $this: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.copy' type=.ValidatedProperties origin=null + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun copy (test1: kotlin.String, test2: kotlin.String): .ValidatedProperties declared in .ValidatedProperties' + CONSTRUCTOR_CALL 'public constructor (test1: kotlin.String, test2: kotlin.String) [primary] declared in .ValidatedProperties' type=.ValidatedProperties origin=null + test1: GET_VAR 'test1: kotlin.String declared in .ValidatedProperties.copy' type=kotlin.String origin=null + test2: GET_VAR 'test2: kotlin.String declared in .ValidatedProperties.copy' type=kotlin.String origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.ValidatedProperties, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.ValidatedProperties + VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name:other index:0 type:kotlin.Any? + BLOCK_BODY + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ + arg0: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.equals' type=.ValidatedProperties origin=null + arg1: GET_VAR 'other: kotlin.Any? declared in .ValidatedProperties.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .ValidatedProperties' + CONST Boolean type=kotlin.Boolean value=true + WHEN type=kotlin.Unit origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.ValidatedProperties + GET_VAR 'other: kotlin.Any? declared in .ValidatedProperties.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .ValidatedProperties' + CONST Boolean type=kotlin.Boolean value=false + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.ValidatedProperties [val] + TYPE_OP type=.ValidatedProperties origin=CAST typeOperand=.ValidatedProperties + GET_VAR 'other: kotlin.Any? declared in .ValidatedProperties.equals' type=kotlin.Any? origin=null + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL 'public open fun (): kotlin.String declared in .ValidatedProperties' type=kotlin.String origin=null + $this: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.equals' type=.ValidatedProperties origin=null + arg1: CALL 'public open fun (): kotlin.String declared in .ValidatedProperties' type=kotlin.String origin=null + $this: GET_VAR 'val tmp_0: .ValidatedProperties [val] declared in .ValidatedProperties.equals' type=.ValidatedProperties origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .ValidatedProperties' + CONST Boolean type=kotlin.Boolean value=false + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL 'public open fun (): kotlin.String declared in .ValidatedProperties' type=kotlin.String origin=null + $this: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.equals' type=.ValidatedProperties origin=null + arg1: CALL 'public open fun (): kotlin.String declared in .ValidatedProperties' type=kotlin.String origin=null + $this: GET_VAR 'val tmp_0: .ValidatedProperties [val] declared in .ValidatedProperties.equals' type=.ValidatedProperties origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .ValidatedProperties' + CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .ValidatedProperties' + CONST Boolean type=kotlin.Boolean value=true + FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.ValidatedProperties) returnType:kotlin.Int + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.ValidatedProperties + BLOCK_BODY + VAR name:result type:kotlin.Int [var] + CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.String' type=kotlin.Int origin=null + $this: CALL 'public open fun (): kotlin.String declared in .ValidatedProperties' type=kotlin.String origin=null + $this: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.hashCode' type=.ValidatedProperties origin=null + SET_VAR 'var result: kotlin.Int [var] declared in .ValidatedProperties.hashCode' type=kotlin.Unit origin=EQ + CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'var result: kotlin.Int [var] declared in .ValidatedProperties.hashCode' type=kotlin.Int origin=null + other: CONST Int type=kotlin.Int value=31 + other: CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.String' type=kotlin.Int origin=null + $this: CALL 'public open fun (): kotlin.String declared in .ValidatedProperties' type=kotlin.String origin=null + $this: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.hashCode' type=.ValidatedProperties origin=null + RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .ValidatedProperties' + GET_VAR 'var result: kotlin.Int [var] declared in .ValidatedProperties.hashCode' type=kotlin.Int origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.ValidatedProperties) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.ValidatedProperties + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .ValidatedProperties' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="ValidatedProperties(" + CONST String type=kotlin.String value="test1=" + CALL 'public open fun (): kotlin.String declared in .ValidatedProperties' type=kotlin.String origin=null + $this: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.toString' type=.ValidatedProperties origin=null + CONST String type=kotlin.String value=", " + CONST String type=kotlin.String value="test2=" + CALL 'public open fun (): kotlin.String declared in .ValidatedProperties' type=kotlin.String origin=null + $this: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.toString' type=.ValidatedProperties origin=null + CONST String type=kotlin.String value=")" diff --git a/compiler/testData/ir/irText/classes/openDataClass.kt b/compiler/testData/ir/irText/classes/openDataClass.kt new file mode 100644 index 00000000000..38b6584498a --- /dev/null +++ b/compiler/testData/ir/irText/classes/openDataClass.kt @@ -0,0 +1,7 @@ +// This test emulates 'allopen' compiler plugin. + +@Suppress("INCOMPATIBLE_MODIFIERS") +open data class ValidatedProperties( + open val test1: String, + open val test2: String +) \ No newline at end of file diff --git a/compiler/testData/ir/irText/classes/openDataClass.kt.txt b/compiler/testData/ir/irText/classes/openDataClass.kt.txt new file mode 100644 index 00000000000..048610182c2 --- /dev/null +++ b/compiler/testData/ir/irText/classes/openDataClass.kt.txt @@ -0,0 +1,56 @@ +@Suppress(names = ["INCOMPATIBLE_MODIFIERS"]) +open data class ValidatedProperties { + constructor(test1: String, test2: String) /* primary */ { + super/*Any*/() + /* () */ + + } + + open val test1: String + field = test1 + open get + + open val test2: String + field = test2 + open get + + operator fun component1(): String { + return .() + } + + operator fun component2(): String { + return .() + } + + fun copy(test1: String = .(), test2: String = .()): ValidatedProperties { + return ValidatedProperties(test1 = test1, test2 = test2) + } + + override fun toString(): String { + return "ValidatedProperties(" + "test1=" + .() + ", " + "test2=" + .() + ")" + } + + override fun hashCode(): Int { + var result: Int = .().hashCode() + result = result.times(other = 31).plus(other = .().hashCode()) + return result + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is ValidatedProperties -> return false + } + val tmp0_other_with_cast: ValidatedProperties = other as ValidatedProperties + when { + EQEQ(arg0 = .(), arg1 = tmp0_other_with_cast.()).not() -> return false + } + when { + EQEQ(arg0 = .(), arg1 = tmp0_other_with_cast.()).not() -> return false + } + return true + } + +} diff --git a/compiler/testData/ir/irText/classes/openDataClass.txt b/compiler/testData/ir/irText/classes/openDataClass.txt new file mode 100644 index 00000000000..8dce07178be --- /dev/null +++ b/compiler/testData/ir/irText/classes/openDataClass.txt @@ -0,0 +1,139 @@ +FILE fqName: fileName:/openDataClass.kt + CLASS CLASS name:ValidatedProperties modality:OPEN visibility:public [data] superTypes:[kotlin.Any] + annotations: + Suppress(names = ['INCOMPATIBLE_MODIFIERS']) + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.ValidatedProperties + CONSTRUCTOR visibility:public <> (test1:kotlin.String, test2:kotlin.String) returnType:.ValidatedProperties [primary] + VALUE_PARAMETER name:test1 index:0 type:kotlin.String + VALUE_PARAMETER name:test2 index:1 type:kotlin.String + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:ValidatedProperties modality:OPEN visibility:public [data] superTypes:[kotlin.Any]' + PROPERTY name:test1 visibility:public modality:OPEN [val] + FIELD PROPERTY_BACKING_FIELD name:test1 type:kotlin.String visibility:private [final] + EXPRESSION_BODY + GET_VAR 'test1: kotlin.String declared in .ValidatedProperties.' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:OPEN <> ($this:.ValidatedProperties) returnType:kotlin.String + correspondingProperty: PROPERTY name:test1 visibility:public modality:OPEN [val] + $this: VALUE_PARAMETER name: type:.ValidatedProperties + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .ValidatedProperties' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test1 type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.' type=.ValidatedProperties origin=null + PROPERTY name:test2 visibility:public modality:OPEN [val] + FIELD PROPERTY_BACKING_FIELD name:test2 type:kotlin.String visibility:private [final] + EXPRESSION_BODY + GET_VAR 'test2: kotlin.String declared in .ValidatedProperties.' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:OPEN <> ($this:.ValidatedProperties) returnType:kotlin.String + correspondingProperty: PROPERTY name:test2 visibility:public modality:OPEN [val] + $this: VALUE_PARAMETER name: type:.ValidatedProperties + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .ValidatedProperties' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test2 type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.' type=.ValidatedProperties origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:component1 visibility:public modality:FINAL <> ($this:.ValidatedProperties) returnType:kotlin.String [operator] + $this: VALUE_PARAMETER name: type:.ValidatedProperties + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.String [operator] declared in .ValidatedProperties' + CALL 'public open fun (): kotlin.String declared in .ValidatedProperties' type=kotlin.String origin=null + $this: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.component1' type=.ValidatedProperties origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:component2 visibility:public modality:FINAL <> ($this:.ValidatedProperties) returnType:kotlin.String [operator] + $this: VALUE_PARAMETER name: type:.ValidatedProperties + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun component2 (): kotlin.String [operator] declared in .ValidatedProperties' + CALL 'public open fun (): kotlin.String declared in .ValidatedProperties' type=kotlin.String origin=null + $this: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.component2' type=.ValidatedProperties origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:copy visibility:public modality:FINAL <> ($this:.ValidatedProperties, test1:kotlin.String, test2:kotlin.String) returnType:.ValidatedProperties + $this: VALUE_PARAMETER name: type:.ValidatedProperties + VALUE_PARAMETER name:test1 index:0 type:kotlin.String + EXPRESSION_BODY + CALL 'public open fun (): kotlin.String declared in .ValidatedProperties' type=kotlin.String origin=null + $this: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.copy' type=.ValidatedProperties origin=null + VALUE_PARAMETER name:test2 index:1 type:kotlin.String + EXPRESSION_BODY + CALL 'public open fun (): kotlin.String declared in .ValidatedProperties' type=kotlin.String origin=null + $this: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.copy' type=.ValidatedProperties origin=null + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun copy (test1: kotlin.String, test2: kotlin.String): .ValidatedProperties declared in .ValidatedProperties' + CONSTRUCTOR_CALL 'public constructor (test1: kotlin.String, test2: kotlin.String) [primary] declared in .ValidatedProperties' type=.ValidatedProperties origin=null + test1: GET_VAR 'test1: kotlin.String declared in .ValidatedProperties.copy' type=kotlin.String origin=null + test2: GET_VAR 'test2: kotlin.String declared in .ValidatedProperties.copy' type=kotlin.String origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.ValidatedProperties) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:.ValidatedProperties + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .ValidatedProperties' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="ValidatedProperties(" + CONST String type=kotlin.String value="test1=" + CALL 'public open fun (): kotlin.String declared in .ValidatedProperties' type=kotlin.String origin=null + $this: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.toString' type=.ValidatedProperties origin=null + CONST String type=kotlin.String value=", " + CONST String type=kotlin.String value="test2=" + CALL 'public open fun (): kotlin.String declared in .ValidatedProperties' type=kotlin.String origin=null + $this: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.toString' type=.ValidatedProperties origin=null + CONST String type=kotlin.String value=")" + FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.ValidatedProperties) returnType:kotlin.Int + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:.ValidatedProperties + BLOCK_BODY + VAR name:result type:kotlin.Int [var] + CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.String' type=kotlin.Int origin=null + $this: CALL 'public open fun (): kotlin.String declared in .ValidatedProperties' type=kotlin.String origin=null + $this: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.hashCode' type=.ValidatedProperties origin=null + SET_VAR 'var result: kotlin.Int [var] declared in .ValidatedProperties.hashCode' type=kotlin.Unit origin=EQ + CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'var result: kotlin.Int [var] declared in .ValidatedProperties.hashCode' type=kotlin.Int origin=null + other: CONST Int type=kotlin.Int value=31 + other: CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.String' type=kotlin.Int origin=null + $this: CALL 'public open fun (): kotlin.String declared in .ValidatedProperties' type=kotlin.String origin=null + $this: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.hashCode' type=.ValidatedProperties origin=null + RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .ValidatedProperties' + GET_VAR 'var result: kotlin.Int [var] declared in .ValidatedProperties.hashCode' type=kotlin.Int origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.ValidatedProperties, other:kotlin.Any?) returnType:kotlin.Boolean [operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:.ValidatedProperties + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + BLOCK_BODY + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ + arg0: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.equals' type=.ValidatedProperties origin=null + arg1: GET_VAR 'other: kotlin.Any? declared in .ValidatedProperties.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .ValidatedProperties' + CONST Boolean type=kotlin.Boolean value=true + WHEN type=kotlin.Unit origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.ValidatedProperties + GET_VAR 'other: kotlin.Any? declared in .ValidatedProperties.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .ValidatedProperties' + CONST Boolean type=kotlin.Boolean value=false + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.ValidatedProperties [val] + TYPE_OP type=.ValidatedProperties origin=CAST typeOperand=.ValidatedProperties + GET_VAR 'other: kotlin.Any? declared in .ValidatedProperties.equals' type=kotlin.Any? origin=null + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL 'public open fun (): kotlin.String declared in .ValidatedProperties' type=kotlin.String origin=null + $this: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.equals' type=.ValidatedProperties origin=null + arg1: CALL 'public open fun (): kotlin.String declared in .ValidatedProperties' type=kotlin.String origin=null + $this: GET_VAR 'val tmp_0: .ValidatedProperties [val] declared in .ValidatedProperties.equals' type=.ValidatedProperties origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .ValidatedProperties' + CONST Boolean type=kotlin.Boolean value=false + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL 'public open fun (): kotlin.String declared in .ValidatedProperties' type=kotlin.String origin=null + $this: GET_VAR ': .ValidatedProperties declared in .ValidatedProperties.equals' type=.ValidatedProperties origin=null + arg1: CALL 'public open fun (): kotlin.String declared in .ValidatedProperties' type=kotlin.String origin=null + $this: GET_VAR 'val tmp_0: .ValidatedProperties [val] declared in .ValidatedProperties.equals' type=.ValidatedProperties origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .ValidatedProperties' + CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .ValidatedProperties' + CONST Boolean type=kotlin.Boolean value=true diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java index b4e160d8211..cd167f36637 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java @@ -4282,6 +4282,16 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/properties"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } + @TestMetadata("dataClass.kt") + public void testDataClass() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/properties/dataClass.kt"); + } + + @TestMetadata("openDataClass.kt") + public void testOpenDataClass() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/properties/openDataClass.kt"); + } + @TestMetadata("compiler/testData/codegen/bytecodeText/properties/lateinit") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java index 315f7cd4837..e7e3faff259 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java @@ -4210,6 +4210,16 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/properties"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @TestMetadata("dataClass.kt") + public void testDataClass() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/properties/dataClass.kt"); + } + + @TestMetadata("openDataClass.kt") + public void testOpenDataClass() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/properties/openDataClass.kt"); + } + @TestMetadata("compiler/testData/codegen/bytecodeText/properties/lateinit") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index f16381fb6e9..5b81fdc7934 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -220,6 +220,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { runTest("compiler/testData/ir/irText/classes/objectWithInitializers.kt"); } + @TestMetadata("openDataClass.kt") + public void testOpenDataClass() throws Exception { + runTest("compiler/testData/ir/irText/classes/openDataClass.kt"); + } + @TestMetadata("outerClassAccess.kt") public void testOuterClassAccess() throws Exception { runTest("compiler/testData/ir/irText/classes/outerClassAccess.kt"); From 3370fa03d73900fa846edf996c97ff8243e9b501 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Tue, 8 Dec 2020 17:44:43 +0100 Subject: [PATCH 495/698] Revert "JVM IR: remove obsolete isDefaultImplsBridge in findInterfaceImplementation" This reverts commit d41d1bf64d094e0fabf4b15960b34360ce0f663a. --- ...nheritedDefaultMethodsOnClassesLowering.kt | 8 +++-- .../kotlin/ir/util/IrFakeOverrideUtils.kt | 36 ++++++++++++------- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InheritedDefaultMethodsOnClassesLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InheritedDefaultMethodsOnClassesLowering.kt index ecf892ef780..4c286cafaee 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InheritedDefaultMethodsOnClassesLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InheritedDefaultMethodsOnClassesLowering.kt @@ -14,6 +14,7 @@ import org.jetbrains.kotlin.backend.common.ir.passTypeArgumentsFrom import org.jetbrains.kotlin.backend.common.lower.createIrBuilder import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase import org.jetbrains.kotlin.backend.jvm.JvmBackendContext +import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin import org.jetbrains.kotlin.backend.jvm.codegen.isJvmInterface import org.jetbrains.kotlin.backend.jvm.ir.* import org.jetbrains.kotlin.builtins.StandardNames @@ -263,14 +264,14 @@ internal fun IrSimpleFunction.findInterfaceImplementation(jvmDefaultMode: JvmDef if (!isFakeOverride) return null parent.let { if (it is IrClass && it.isJvmInterface) return null } - val implementation = resolveFakeOverride() ?: return null + val implementation = resolveFakeOverride(toSkip = ::isDefaultImplsBridge) ?: return null // Only generate interface delegation for functions immediately inherited from an interface. // (Otherwise, delegation will be present in the parent class) if (overriddenSymbols.any { !it.owner.parentAsClass.isInterface && it.owner.modality != Modality.ABSTRACT && - it.owner.resolveFakeOverride() == implementation + it.owner.resolveFakeOverride(toSkip = ::isDefaultImplsBridge) == implementation }) { return null } @@ -285,3 +286,6 @@ internal fun IrSimpleFunction.findInterfaceImplementation(jvmDefaultMode: JvmDef return implementation } + +private fun isDefaultImplsBridge(f: IrSimpleFunction) = + f.origin == JvmLoweredDeclarationOrigin.SUPER_INTERFACE_METHOD_BRIDGE diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/IrFakeOverrideUtils.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/IrFakeOverrideUtils.kt index 20c456a4c2a..5639181114c 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/IrFakeOverrideUtils.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/IrFakeOverrideUtils.kt @@ -24,26 +24,36 @@ val IrSimpleFunction.target: IrSimpleFunction else resolveFakeOverride() ?: error("Could not resolveFakeOverride() for ${this.render()}") -val IrFunction.target: IrFunction - get() = when (this) { - is IrSimpleFunction -> this.target - is IrConstructor -> this - else -> error(this) - } +val IrFunction.target: IrFunction get() = when (this) { + is IrSimpleFunction -> this.target + is IrConstructor -> this + else -> error(this) +} -fun IrSimpleFunction.collectRealOverrides(filter: (IrOverridableMember) -> Boolean = { false }): Set { - if (isReal) return setOf(this) +fun IrSimpleFunction.collectRealOverrides( + toSkip: (IrSimpleFunction) -> Boolean = { false }, + filter: (IrOverridableMember) -> Boolean = { false } +): Set { + if (isReal && !toSkip(this)) return setOf(this) return this.overriddenSymbols .map { it.owner } - .collectAndFilterRealOverrides(filter) + .collectAndFilterRealOverrides( + { + require(it is IrSimpleFunction) { "Expected IrSimpleFunction: ${it.render()}" } + toSkip(it) + }, + filter + ) .map { it as IrSimpleFunction } .toSet() } fun Collection.collectAndFilterRealOverrides( + toSkip: (IrOverridableMember) -> Boolean = { false }, filter: (IrOverridableMember) -> Boolean = { false } ): Set { + val visited = mutableSetOf() val realOverrides = mutableSetOf() @@ -58,7 +68,7 @@ fun Collection.collectAndFilterRealOverrides( fun collectRealOverrides(member: IrOverridableMember) { if (!visited.add(member) || filter(member)) return - if (member.isReal) { + if (member.isReal && !toSkip(member)) { realOverrides += member } else { overriddenSymbols(member).forEach { collectRealOverrides(it.owner as IrOverridableMember) } @@ -83,13 +93,13 @@ fun Collection.collectAndFilterRealOverrides( } // TODO: use this implementation instead of any other -fun IrSimpleFunction.resolveFakeOverride(allowAbstract: Boolean = false): IrSimpleFunction? { +fun IrSimpleFunction.resolveFakeOverride(allowAbstract: Boolean = false, toSkip: (IrSimpleFunction) -> Boolean = { false }): IrSimpleFunction? { return if (allowAbstract) { - val reals = collectRealOverrides() + val reals = collectRealOverrides(toSkip) if (reals.isEmpty()) error("No real overrides for ${this.render()}") reals.first() } else { - collectRealOverrides { it.modality == Modality.ABSTRACT } + collectRealOverrides(toSkip, { it.modality == Modality.ABSTRACT }) .let { realOverrides -> // Kotlin forbids conflicts between overrides, but they may trickle down from Java. realOverrides.singleOrNull { it.parent.safeAs()?.isInterface != true } From 3e0efeef31b28f613f679b687672d8840ce4a4fe Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Tue, 8 Dec 2020 20:37:18 +0100 Subject: [PATCH 496/698] JVM IR: add test for complex generic diamond hierarchy This is a test for KT-43832, which is fixed in the previous commit. --- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 +++ .../box/traits/doubleGenericDiamond.kt | 34 +++++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 5 +++ .../LightAnalysisModeTestGenerated.java | 5 +++ .../ir/IrBlackBoxCodegenTestGenerated.java | 5 +++ .../IrJsCodegenBoxES6TestGenerated.java | 5 +++ .../IrJsCodegenBoxTestGenerated.java | 5 +++ .../semantics/JsCodegenBoxTestGenerated.java | 5 +++ .../IrCodegenBoxWasmTestGenerated.java | 5 +++ 9 files changed, 74 insertions(+) create mode 100644 compiler/testData/codegen/box/traits/doubleGenericDiamond.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 99dfee1d850..a5a3048e364 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -31636,6 +31636,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/traits/doubleDiamond.kt"); } + @TestMetadata("doubleGenericDiamond.kt") + public void testDoubleGenericDiamond() throws Exception { + runTest("compiler/testData/codegen/box/traits/doubleGenericDiamond.kt"); + } + @TestMetadata("genericMethod.kt") public void testGenericMethod() throws Exception { runTest("compiler/testData/codegen/box/traits/genericMethod.kt"); diff --git a/compiler/testData/codegen/box/traits/doubleGenericDiamond.kt b/compiler/testData/codegen/box/traits/doubleGenericDiamond.kt new file mode 100644 index 00000000000..b3f7c32c348 --- /dev/null +++ b/compiler/testData/codegen/box/traits/doubleGenericDiamond.kt @@ -0,0 +1,34 @@ +// FILE: lib.kt + +var result = "" + +interface Left +interface Right +class Bottom : Left, Right + +interface A { + fun f(): T? { + result = "A" + return null + } +} + +interface B : A { + override fun f(): T? { + result = "B" + return null + } +} + +abstract class C : A + +abstract class D : C() + +// FILE: box.kt + +class Z : D(), B + +fun box(): String { + Z().f() + return if (result == "B") "OK" else "Fail: $result" +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index b1c26de07bb..87cfb1fc0c5 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -33407,6 +33407,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/traits/doubleDiamond.kt"); } + @TestMetadata("doubleGenericDiamond.kt") + public void testDoubleGenericDiamond() throws Exception { + runTest("compiler/testData/codegen/box/traits/doubleGenericDiamond.kt"); + } + @TestMetadata("genericMethod.kt") public void testGenericMethod() throws Exception { runTest("compiler/testData/codegen/box/traits/genericMethod.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 050474433c5..8871864fb7a 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -31041,6 +31041,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/traits/doubleDiamond.kt"); } + @TestMetadata("doubleGenericDiamond.kt") + public void testDoubleGenericDiamond() throws Exception { + runTest("compiler/testData/codegen/box/traits/doubleGenericDiamond.kt"); + } + @TestMetadata("genericMethod.kt") public void testGenericMethod() throws Exception { runTest("compiler/testData/codegen/box/traits/genericMethod.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index ca2ec69d0ee..b06b6c3c28e 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -31636,6 +31636,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/traits/doubleDiamond.kt"); } + @TestMetadata("doubleGenericDiamond.kt") + public void testDoubleGenericDiamond() throws Exception { + runTest("compiler/testData/codegen/box/traits/doubleGenericDiamond.kt"); + } + @TestMetadata("genericMethod.kt") public void testGenericMethod() throws Exception { runTest("compiler/testData/codegen/box/traits/genericMethod.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index 071916bd0a2..15f4be5fddb 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -25592,6 +25592,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/traits/doubleDiamond.kt"); } + @TestMetadata("doubleGenericDiamond.kt") + public void testDoubleGenericDiamond() throws Exception { + runTest("compiler/testData/codegen/box/traits/doubleGenericDiamond.kt"); + } + @TestMetadata("genericMethod.kt") public void testGenericMethod() throws Exception { runTest("compiler/testData/codegen/box/traits/genericMethod.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index b3c5cdbfc7a..a2f65e44e31 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -25592,6 +25592,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/traits/doubleDiamond.kt"); } + @TestMetadata("doubleGenericDiamond.kt") + public void testDoubleGenericDiamond() throws Exception { + runTest("compiler/testData/codegen/box/traits/doubleGenericDiamond.kt"); + } + @TestMetadata("genericMethod.kt") public void testGenericMethod() throws Exception { runTest("compiler/testData/codegen/box/traits/genericMethod.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 6fd9d930afc..293c78c94ce 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -25592,6 +25592,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/traits/doubleDiamond.kt"); } + @TestMetadata("doubleGenericDiamond.kt") + public void testDoubleGenericDiamond() throws Exception { + runTest("compiler/testData/codegen/box/traits/doubleGenericDiamond.kt"); + } + @TestMetadata("genericMethod.kt") public void testGenericMethod() throws Exception { runTest("compiler/testData/codegen/box/traits/genericMethod.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index 0870716ac09..0fc21b69740 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -13890,6 +13890,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/traits/doubleDiamond.kt"); } + @TestMetadata("doubleGenericDiamond.kt") + public void testDoubleGenericDiamond() throws Exception { + runTest("compiler/testData/codegen/box/traits/doubleGenericDiamond.kt"); + } + @TestMetadata("genericMethod.kt") public void testGenericMethod() throws Exception { runTest("compiler/testData/codegen/box/traits/genericMethod.kt"); From 1cfb81455ca2fc96077bc55b3208f76165464877 Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Wed, 9 Dec 2020 10:21:04 +0100 Subject: [PATCH 497/698] Generate correct names for companion @JvmStatic accessors in annotation class #KT-31389 Fixed --- .../kotlin/codegen/state/KotlinTypeMapper.kt | 5 ++- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 +++ .../testData/codegen/box/jvmStatic/kt31389.kt | 36 +++++++++++++++++++ .../codegen/bytecodeListing/kt31389.kt | 12 +++++++ .../codegen/bytecodeListing/kt31389.txt | 26 ++++++++++++++ .../codegen/bytecodeListing/kt31389_ir.txt | 26 ++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 5 +++ .../codegen/BytecodeListingTestGenerated.java | 5 +++ .../LightAnalysisModeTestGenerated.java | 5 +++ .../ir/IrBlackBoxCodegenTestGenerated.java | 5 +++ .../ir/IrBytecodeListingTestGenerated.java | 5 +++ 11 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 compiler/testData/codegen/box/jvmStatic/kt31389.kt create mode 100644 compiler/testData/codegen/bytecodeListing/kt31389.kt create mode 100644 compiler/testData/codegen/bytecodeListing/kt31389.txt create mode 100644 compiler/testData/codegen/bytecodeListing/kt31389_ir.txt diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt index f9324d61432..df20065d4be 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt @@ -50,6 +50,7 @@ import org.jetbrains.kotlin.resolve.* import org.jetbrains.kotlin.resolve.BindingContextUtils.getDelegationConstructorCall import org.jetbrains.kotlin.resolve.BindingContextUtils.isBoxedLocalCapturedInClosure import org.jetbrains.kotlin.resolve.DescriptorUtils.* +import org.jetbrains.kotlin.resolve.annotations.hasJvmStaticAnnotation import org.jetbrains.kotlin.resolve.bindingContextUtil.isUsedAsExpression import org.jetbrains.kotlin.resolve.calls.model.DefaultValueArgument import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall @@ -582,7 +583,9 @@ class KotlinTypeMapper @JvmOverloads constructor( return when { descriptor is PropertyAccessorDescriptor -> { val property = descriptor.correspondingProperty - if (isAnnotationClass(property.containingDeclaration)) { + if (isAnnotationClass(property.containingDeclaration) && + (!property.hasJvmStaticAnnotation() && !descriptor.hasJvmStaticAnnotation()) + ) { return property.name.asString() } diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index a5a3048e364..cbc5d97d0d4 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -18022,6 +18022,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/jvmStatic/kt21246a.kt"); } + @TestMetadata("kt31389.kt") + public void testKt31389() throws Exception { + runTest("compiler/testData/codegen/box/jvmStatic/kt31389.kt"); + } + @TestMetadata("kt35716.kt") public void testKt35716() throws Exception { runTest("compiler/testData/codegen/box/jvmStatic/kt35716.kt"); diff --git a/compiler/testData/codegen/box/jvmStatic/kt31389.kt b/compiler/testData/codegen/box/jvmStatic/kt31389.kt new file mode 100644 index 00000000000..5b105554ec6 --- /dev/null +++ b/compiler/testData/codegen/box/jvmStatic/kt31389.kt @@ -0,0 +1,36 @@ +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME +// FILE: Test.java + +class Test { + public static String foo() { + return Annotation.getTEST_FIELD(); + } + + public static String foo2() { + return Annotation.getTEST_FIELD2(); + } + + public static void foo2Set() { + Annotation.setTEST_FIELD2("OK"); + } +} + +// FILE: kt31389.kt + +annotation class Annotation { + companion object { + @JvmStatic val TEST_FIELD = "OK" + + var TEST_FIELD2 = "" + @JvmStatic get + @JvmStatic set + } +} + +fun box(): String { + if (Test.foo() != "OK") return "Fail 1: ${Test.foo()}" + Test.foo2Set() + return Test.foo2() +} diff --git a/compiler/testData/codegen/bytecodeListing/kt31389.kt b/compiler/testData/codegen/bytecodeListing/kt31389.kt new file mode 100644 index 00000000000..16ac14e3323 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/kt31389.kt @@ -0,0 +1,12 @@ +// JVM_TARGET: 1.8 +// WITH_RUNTIME + +annotation class Annotation { + companion object { + @JvmStatic val TEST_FIELD = "OK" + + var TEST_FIELD2 = "" + @JvmStatic get + @JvmStatic set + } +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/kt31389.txt b/compiler/testData/codegen/bytecodeListing/kt31389.txt new file mode 100644 index 00000000000..6b3246831d9 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/kt31389.txt @@ -0,0 +1,26 @@ +@kotlin.Metadata +public final class Annotation$Companion { + // source: 'kt31389.kt' + synthetic final static field $$INSTANCE: Annotation$Companion + private static @org.jetbrains.annotations.NotNull field TEST_FIELD2: java.lang.String + private final static @org.jetbrains.annotations.NotNull field TEST_FIELD: java.lang.String + static method (): void + private method (): void + public synthetic deprecated static @kotlin.jvm.JvmStatic method getTEST_FIELD$annotations(): void + public final @org.jetbrains.annotations.NotNull method getTEST_FIELD(): java.lang.String + public final @kotlin.jvm.JvmStatic @org.jetbrains.annotations.NotNull method getTEST_FIELD2(): java.lang.String + public final @kotlin.jvm.JvmStatic method setTEST_FIELD2(@org.jetbrains.annotations.NotNull p0: java.lang.String): void + public final inner class Annotation$Companion +} + +@java.lang.annotation.Retention +@kotlin.Metadata +public annotation class Annotation { + // source: 'kt31389.kt' + public final static @org.jetbrains.annotations.NotNull field Companion: Annotation$Companion + static method (): void + public static method getTEST_FIELD(): java.lang.String + public static @kotlin.jvm.JvmStatic method getTEST_FIELD2(): java.lang.String + public static @kotlin.jvm.JvmStatic method setTEST_FIELD2(@org.jetbrains.annotations.NotNull p0: java.lang.String): void + public final inner class Annotation$Companion +} diff --git a/compiler/testData/codegen/bytecodeListing/kt31389_ir.txt b/compiler/testData/codegen/bytecodeListing/kt31389_ir.txt new file mode 100644 index 00000000000..34432aabd03 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/kt31389_ir.txt @@ -0,0 +1,26 @@ +@kotlin.Metadata +public final class Annotation$Companion { + // source: 'kt31389.kt' + synthetic final static field $$INSTANCE: Annotation$Companion + private static @org.jetbrains.annotations.NotNull field TEST_FIELD2: java.lang.String + private final static @org.jetbrains.annotations.NotNull field TEST_FIELD: java.lang.String + static method (): void + private method (): void + public synthetic deprecated static @kotlin.jvm.JvmStatic method getTEST_FIELD$annotations(): void + public final @org.jetbrains.annotations.NotNull method getTEST_FIELD(): java.lang.String + public final @kotlin.jvm.JvmStatic @org.jetbrains.annotations.NotNull method getTEST_FIELD2(): java.lang.String + public final @kotlin.jvm.JvmStatic method setTEST_FIELD2(@org.jetbrains.annotations.NotNull p0: java.lang.String): void + public final inner class Annotation$Companion +} + +@java.lang.annotation.Retention +@kotlin.Metadata +public annotation class Annotation { + // source: 'kt31389.kt' + public final static @org.jetbrains.annotations.NotNull field Companion: Annotation$Companion + static method (): void + public static @org.jetbrains.annotations.NotNull method getTEST_FIELD(): java.lang.String + public static @kotlin.jvm.JvmStatic @org.jetbrains.annotations.NotNull method getTEST_FIELD2(): java.lang.String + public static @kotlin.jvm.JvmStatic method setTEST_FIELD2(@org.jetbrains.annotations.NotNull p0: java.lang.String): void + public final inner class Annotation$Companion +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 87cfb1fc0c5..1ca163d8a9f 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -19422,6 +19422,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/jvmStatic/kt21246a.kt"); } + @TestMetadata("kt31389.kt") + public void testKt31389() throws Exception { + runTest("compiler/testData/codegen/box/jvmStatic/kt31389.kt"); + } + @TestMetadata("kt35716.kt") public void testKt35716() throws Exception { runTest("compiler/testData/codegen/box/jvmStatic/kt35716.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index 5399293cbda..fa229ea4ab2 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -114,6 +114,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/jvmStaticWithDefaultParameters.kt"); } + @TestMetadata("kt31389.kt") + public void testKt31389() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/kt31389.kt"); + } + @TestMetadata("kt42137.kt") public void testKt42137() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/kt42137.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 8871864fb7a..29bc2f066da 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -19422,6 +19422,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/jvmStatic/kt21246a.kt"); } + @TestMetadata("kt31389.kt") + public void testKt31389() throws Exception { + runTest("compiler/testData/codegen/box/jvmStatic/kt31389.kt"); + } + @TestMetadata("kt35716.kt") public void testKt35716() throws Exception { runTest("compiler/testData/codegen/box/jvmStatic/kt35716.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index b06b6c3c28e..77118ac6c05 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -18022,6 +18022,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/jvmStatic/kt21246a.kt"); } + @TestMetadata("kt31389.kt") + public void testKt31389() throws Exception { + runTest("compiler/testData/codegen/box/jvmStatic/kt31389.kt"); + } + @TestMetadata("kt35716.kt") public void testKt35716() throws Exception { runTest("compiler/testData/codegen/box/jvmStatic/kt35716.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index 5b4a34b3657..16d73c5e213 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -114,6 +114,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/jvmStaticWithDefaultParameters.kt"); } + @TestMetadata("kt31389.kt") + public void testKt31389() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/kt31389.kt"); + } + @TestMetadata("kt42137.kt") public void testKt42137() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/kt42137.kt"); From 6063353b64755e69ae8c7676278d0f240f93aac1 Mon Sep 17 00:00:00 2001 From: Svyatoslav Kuzmich Date: Sat, 5 Dec 2020 16:45:02 +0300 Subject: [PATCH 498/698] [Wasm] Generate stdlib WasmOp based on WasmOp from Wasm IR --- .../kotlin/wasm/internal/WasmInstructions.kt | 291 ++++++++++++++++- .../WasmOp.kt => src/generated/_WasmOp.kt} | 300 +----------------- .../tools/kotlin-stdlib-gen/build.gradle | 1 + .../src/generators/GenerateStandardLib.kt | 2 + .../src/generators/GenerateWasmOps.kt | 41 +++ 5 files changed, 340 insertions(+), 295 deletions(-) rename libraries/stdlib/wasm/{internal/kotlin/wasm/internal/WasmOp.kt => src/generated/_WasmOp.kt} (53%) create mode 100644 libraries/tools/kotlin-stdlib-gen/src/generators/GenerateWasmOps.kt diff --git a/libraries/stdlib/wasm/internal/kotlin/wasm/internal/WasmInstructions.kt b/libraries/stdlib/wasm/internal/kotlin/wasm/internal/WasmInstructions.kt index ff5569aa198..f19537293c1 100644 --- a/libraries/stdlib/wasm/internal/kotlin/wasm/internal/WasmInstructions.kt +++ b/libraries/stdlib/wasm/internal/kotlin/wasm/internal/WasmInstructions.kt @@ -4,7 +4,8 @@ */ @file:ExcludedFromCodegen -@file:Suppress("unused") +@file:Suppress("unused", "NON_ABSTRACT_FUNCTION_WITH_NO_BODY", "INLINE_CLASS_IN_EXTERNAL_DECLARATION") + package kotlin.wasm.internal @@ -19,4 +20,290 @@ internal fun wasm_double_nan(): Double = implementedAsIntrinsic internal fun wasm_ref_cast(a: From): To = - implementedAsIntrinsic \ No newline at end of file + implementedAsIntrinsic + +@WasmOp(WasmOp.I32_EQ) +public external fun wasm_i32_eq(a: Int, b: Int): Boolean + +@WasmOp(WasmOp.I32_NE) +public external fun wasm_i32_ne(a: Int, b: Int): Boolean + +@WasmOp(WasmOp.I32_LT_S) +public external fun wasm_i32_lt_s(a: Int, b: Int): Boolean + +@WasmOp(WasmOp.I32_LT_U) +public external fun wasm_i32_lt_u(a: Int, b: Int): Boolean + +@WasmOp(WasmOp.I32_GT_S) +public external fun wasm_i32_gt_s(a: Int, b: Int): Boolean + +@WasmOp(WasmOp.I32_GT_U) +public external fun wasm_i32_gt_u(a: Int, b: Int): Boolean + +@WasmOp(WasmOp.I32_LE_S) +public external fun wasm_i32_le_s(a: Int, b: Int): Boolean + +@WasmOp(WasmOp.I32_LE_U) +public external fun wasm_i32_le_u(a: Int, b: Int): Boolean + +@WasmOp(WasmOp.I32_GE_S) +public external fun wasm_i32_ge_s(a: Int, b: Int): Boolean + +@WasmOp(WasmOp.I32_GE_U) +public external fun wasm_i32_ge_u(a: Int, b: Int): Boolean + +@WasmOp(WasmOp.I64_EQ) +public external fun wasm_i64_eq(a: Long, b: Long): Boolean + +@WasmOp(WasmOp.I64_NE) +public external fun wasm_i64_ne(a: Long, b: Long): Boolean + +@WasmOp(WasmOp.I64_LT_S) +public external fun wasm_i64_lt_s(a: Long, b: Long): Boolean + +@WasmOp(WasmOp.I64_LT_U) +public external fun wasm_i64_lt_u(a: Long, b: Long): Boolean + +@WasmOp(WasmOp.I64_GT_S) +public external fun wasm_i64_gt_s(a: Long, b: Long): Boolean + +@WasmOp(WasmOp.I64_GT_U) +public external fun wasm_i64_gt_u(a: Long, b: Long): Boolean + +@WasmOp(WasmOp.I64_LE_S) +public external fun wasm_i64_le_s(a: Long, b: Long): Boolean + +@WasmOp(WasmOp.I64_LE_U) +public external fun wasm_i64_le_u(a: Long, b: Long): Boolean + +@WasmOp(WasmOp.I64_GE_S) +public external fun wasm_i64_ge_s(a: Long, b: Long): Boolean + +@WasmOp(WasmOp.I64_GE_U) +public external fun wasm_i64_ge_u(a: Long, b: Long): Boolean + +@WasmOp(WasmOp.F32_EQ) +public external fun wasm_f32_eq(a: Float, b: Float): Boolean + +@WasmOp(WasmOp.F32_NE) +public external fun wasm_f32_ne(a: Float, b: Float): Boolean + +@WasmOp(WasmOp.F32_LT) +public external fun wasm_f32_lt(a: Float, b: Float): Boolean + +@WasmOp(WasmOp.F32_GT) +public external fun wasm_f32_gt(a: Float, b: Float): Boolean + +@WasmOp(WasmOp.F32_LE) +public external fun wasm_f32_le(a: Float, b: Float): Boolean + +@WasmOp(WasmOp.F32_GE) +public external fun wasm_f32_ge(a: Float, b: Float): Boolean + +@WasmOp(WasmOp.F64_EQ) +public external fun wasm_f64_eq(a: Double, b: Double): Boolean + +@WasmOp(WasmOp.F64_NE) +public external fun wasm_f64_ne(a: Double, b: Double): Boolean + +@WasmOp(WasmOp.F64_LT) +public external fun wasm_f64_lt(a: Double, b: Double): Boolean + +@WasmOp(WasmOp.F64_GT) +public external fun wasm_f64_gt(a: Double, b: Double): Boolean + +@WasmOp(WasmOp.F64_LE) +public external fun wasm_f64_le(a: Double, b: Double): Boolean + +@WasmOp(WasmOp.F64_GE) +public external fun wasm_f64_ge(a: Double, b: Double): Boolean + +@WasmOp(WasmOp.I32_ADD) +public external fun wasm_i32_add(a: Int, b: Int): Int + +@WasmOp(WasmOp.I32_SUB) +public external fun wasm_i32_sub(a: Int, b: Int): Int + +@WasmOp(WasmOp.I32_MUL) +public external fun wasm_i32_mul(a: Int, b: Int): Int + +@WasmOp(WasmOp.I32_DIV_S) +public external fun wasm_i32_div_s(a: Int, b: Int): Int + +@WasmOp(WasmOp.I32_DIV_U) +public external fun wasm_i32_div_u(a: Int, b: Int): Int + +@WasmOp(WasmOp.I32_REM_S) +public external fun wasm_i32_rem_s(a: Int, b: Int): Int + +@WasmOp(WasmOp.I32_REM_U) +public external fun wasm_i32_rem_u(a: Int, b: Int): Int + +@WasmOp(WasmOp.I32_AND) +public external fun wasm_i32_and(a: Int, b: Int): Int + +@WasmOp(WasmOp.I32_OR) +public external fun wasm_i32_or(a: Int, b: Int): Int + +@WasmOp(WasmOp.I32_XOR) +public external fun wasm_i32_xor(a: Int, b: Int): Int + +@WasmOp(WasmOp.I32_SHL) +public external fun wasm_i32_shl(a: Int, b: Int): Int + +@WasmOp(WasmOp.I32_SHR_S) +public external fun wasm_i32_shr_s(a: Int, b: Int): Int + +@WasmOp(WasmOp.I32_SHR_U) +public external fun wasm_i32_shr_u(a: Int, b: Int): Int + +@WasmOp(WasmOp.I32_ROTL) +public external fun wasm_i32_rotl(a: Int, b: Int): Int + +@WasmOp(WasmOp.I32_ROTR) +public external fun wasm_i32_rotr(a: Int, b: Int): Int + +@WasmOp(WasmOp.I64_ADD) +public external fun wasm_i64_add(a: Long, b: Long): Long + +@WasmOp(WasmOp.I64_SUB) +public external fun wasm_i64_sub(a: Long, b: Long): Long + +@WasmOp(WasmOp.I64_MUL) +public external fun wasm_i64_mul(a: Long, b: Long): Long + +@WasmOp(WasmOp.I64_DIV_S) +public external fun wasm_i64_div_s(a: Long, b: Long): Long + +@WasmOp(WasmOp.I64_DIV_U) +public external fun wasm_i64_div_u(a: Long, b: Long): Long + +@WasmOp(WasmOp.I64_REM_S) +public external fun wasm_i64_rem_s(a: Long, b: Long): Long + +@WasmOp(WasmOp.I64_REM_U) +public external fun wasm_i64_rem_u(a: Long, b: Long): Long + +@WasmOp(WasmOp.I64_AND) +public external fun wasm_i64_and(a: Long, b: Long): Long + +@WasmOp(WasmOp.I64_OR) +public external fun wasm_i64_or(a: Long, b: Long): Long + +@WasmOp(WasmOp.I64_XOR) +public external fun wasm_i64_xor(a: Long, b: Long): Long + +@WasmOp(WasmOp.I64_SHL) +public external fun wasm_i64_shl(a: Long, b: Long): Long + +@WasmOp(WasmOp.I64_SHR_S) +public external fun wasm_i64_shr_s(a: Long, b: Long): Long + +@WasmOp(WasmOp.I64_SHR_U) +public external fun wasm_i64_shr_u(a: Long, b: Long): Long + +@WasmOp(WasmOp.I64_ROTL) +public external fun wasm_i64_rotl(a: Long, b: Long): Long + +@WasmOp(WasmOp.I64_ROTR) +public external fun wasm_i64_rotr(a: Long, b: Long): Long + +@WasmOp(WasmOp.F32_ADD) +public external fun wasm_f32_add(a: Float, b: Float): Float + +@WasmOp(WasmOp.F32_SUB) +public external fun wasm_f32_sub(a: Float, b: Float): Float + +@WasmOp(WasmOp.F32_MUL) +public external fun wasm_f32_mul(a: Float, b: Float): Float + +@WasmOp(WasmOp.F32_DIV) +public external fun wasm_f32_div(a: Float, b: Float): Float + +@WasmOp(WasmOp.F32_MIN) +public external fun wasm_f32_min(a: Float, b: Float): Float + +@WasmOp(WasmOp.F32_MAX) +public external fun wasm_f32_max(a: Float, b: Float): Float + +@WasmOp(WasmOp.F32_COPYSIGN) +public external fun wasm_f32_copysign(a: Float, b: Float): Float + +@WasmOp(WasmOp.F64_ADD) +public external fun wasm_f64_add(a: Double, b: Double): Double + +@WasmOp(WasmOp.F64_SUB) +public external fun wasm_f64_sub(a: Double, b: Double): Double + +@WasmOp(WasmOp.F64_MUL) +public external fun wasm_f64_mul(a: Double, b: Double): Double + +@WasmOp(WasmOp.F64_DIV) +public external fun wasm_f64_div(a: Double, b: Double): Double + +@WasmOp(WasmOp.F64_MIN) +public external fun wasm_f64_min(a: Double, b: Double): Double + +@WasmOp(WasmOp.F64_MAX) +public external fun wasm_f64_max(a: Double, b: Double): Double + + +@WasmOp(WasmOp.REF_IS_NULL) +public external fun wasm_ref_is_null(a: Any?): Boolean + +@WasmOp(WasmOp.REF_EQ) +public external fun wasm_ref_eq(a: Any?, b: Any?): Boolean + + +// --- + +@WasmOp(WasmOp.F32_NEAREST) +public external fun wasm_f32_nearest(a: Float): Float + +@WasmOp(WasmOp.F64_NEAREST) +public external fun wasm_f64_nearest(a: Double): Double + +@WasmOp(WasmOp.I32_WRAP_I64) +public external fun wasm_i32_wrap_i64(a: Long): Int + +@WasmOp(WasmOp.I64_EXTEND_I32_S) +public external fun wasm_i64_extend_i32_s(a: Int): Long + +@WasmOp(WasmOp.F32_CONVERT_I32_S) +public external fun wasm_f32_convert_i32_s(a: Int): Float + +@WasmOp(WasmOp.F32_CONVERT_I64_S) +public external fun wasm_f32_convert_i64_s(a: Long): Float + +@WasmOp(WasmOp.F32_DEMOTE_F64) +public external fun wasm_f32_demote_f64(a: Double): Float + +@WasmOp(WasmOp.F64_CONVERT_I32_S) +public external fun wasm_f64_convert_i32_s(a: Int): Double + +@WasmOp(WasmOp.F64_CONVERT_I64_S) +public external fun wasm_f64_convert_i64_s(a: Long): Double + +@WasmOp(WasmOp.F64_PROMOTE_F32) +public external fun wasm_f64_promote_f32(a: Float): Double + +@WasmOp(WasmOp.I32_REINTERPRET_F32) +public external fun wasm_i32_reinterpret_f32(a: Float): Int + +@WasmOp(WasmOp.F32_REINTERPRET_I32) +public external fun wasm_f32_reinterpret_i32(a: Int): Float + +@WasmOp(WasmOp.I32_TRUNC_SAT_F32_S) +public external fun wasm_i32_trunc_sat_f32_s(a: Float): Int + +@WasmOp(WasmOp.I32_TRUNC_SAT_F64_S) +public external fun wasm_i32_trunc_sat_f64_s(a: Double): Int + +@WasmOp(WasmOp.I64_TRUNC_SAT_F32_S) +public external fun wasm_i64_trunc_sat_f32_s(a: Float): Long + +@WasmOp(WasmOp.I64_TRUNC_SAT_F64_S) +public external fun wasm_i64_trunc_sat_f64_s(a: Double): Long + +@WasmOp(WasmOp.I32_LOAD) +public external fun wasm_i32_load(x: Int): Int \ No newline at end of file diff --git a/libraries/stdlib/wasm/internal/kotlin/wasm/internal/WasmOp.kt b/libraries/stdlib/wasm/src/generated/_WasmOp.kt similarity index 53% rename from libraries/stdlib/wasm/internal/kotlin/wasm/internal/WasmOp.kt rename to libraries/stdlib/wasm/src/generated/_WasmOp.kt index b69794a9f4f..cf9528d2a08 100644 --- a/libraries/stdlib/wasm/internal/kotlin/wasm/internal/WasmOp.kt +++ b/libraries/stdlib/wasm/src/generated/_WasmOp.kt @@ -3,15 +3,15 @@ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ -@file:ExcludedFromCodegen -@file:Suppress( - "INLINE_CLASS_IN_EXTERNAL_DECLARATION", - "NON_ABSTRACT_FUNCTION_WITH_NO_BODY", - "unused" -) - package kotlin.wasm.internal +// +// NOTE: THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt +// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib +// + +@ExcludedFromCodegen +@Suppress("unused") @Target(AnnotationTarget.FUNCTION) @Retention(AnnotationRetention.BINARY) internal annotation class WasmOp(val name: String) { @@ -226,289 +226,3 @@ internal annotation class WasmOp(val name: String) { const val RTT_SUB = "RTT_SUB" } } - -@WasmOp(WasmOp.I32_EQ) -public external fun wasm_i32_eq(a: Int, b: Int): Boolean - -@WasmOp(WasmOp.I32_NE) -public external fun wasm_i32_ne(a: Int, b: Int): Boolean - -@WasmOp(WasmOp.I32_LT_S) -public external fun wasm_i32_lt_s(a: Int, b: Int): Boolean - -@WasmOp(WasmOp.I32_LT_U) -public external fun wasm_i32_lt_u(a: Int, b: Int): Boolean - -@WasmOp(WasmOp.I32_GT_S) -public external fun wasm_i32_gt_s(a: Int, b: Int): Boolean - -@WasmOp(WasmOp.I32_GT_U) -public external fun wasm_i32_gt_u(a: Int, b: Int): Boolean - -@WasmOp(WasmOp.I32_LE_S) -public external fun wasm_i32_le_s(a: Int, b: Int): Boolean - -@WasmOp(WasmOp.I32_LE_U) -public external fun wasm_i32_le_u(a: Int, b: Int): Boolean - -@WasmOp(WasmOp.I32_GE_S) -public external fun wasm_i32_ge_s(a: Int, b: Int): Boolean - -@WasmOp(WasmOp.I32_GE_U) -public external fun wasm_i32_ge_u(a: Int, b: Int): Boolean - -@WasmOp(WasmOp.I64_EQ) -public external fun wasm_i64_eq(a: Long, b: Long): Boolean - -@WasmOp(WasmOp.I64_NE) -public external fun wasm_i64_ne(a: Long, b: Long): Boolean - -@WasmOp(WasmOp.I64_LT_S) -public external fun wasm_i64_lt_s(a: Long, b: Long): Boolean - -@WasmOp(WasmOp.I64_LT_U) -public external fun wasm_i64_lt_u(a: Long, b: Long): Boolean - -@WasmOp(WasmOp.I64_GT_S) -public external fun wasm_i64_gt_s(a: Long, b: Long): Boolean - -@WasmOp(WasmOp.I64_GT_U) -public external fun wasm_i64_gt_u(a: Long, b: Long): Boolean - -@WasmOp(WasmOp.I64_LE_S) -public external fun wasm_i64_le_s(a: Long, b: Long): Boolean - -@WasmOp(WasmOp.I64_LE_U) -public external fun wasm_i64_le_u(a: Long, b: Long): Boolean - -@WasmOp(WasmOp.I64_GE_S) -public external fun wasm_i64_ge_s(a: Long, b: Long): Boolean - -@WasmOp(WasmOp.I64_GE_U) -public external fun wasm_i64_ge_u(a: Long, b: Long): Boolean - -@WasmOp(WasmOp.F32_EQ) -public external fun wasm_f32_eq(a: Float, b: Float): Boolean - -@WasmOp(WasmOp.F32_NE) -public external fun wasm_f32_ne(a: Float, b: Float): Boolean - -@WasmOp(WasmOp.F32_LT) -public external fun wasm_f32_lt(a: Float, b: Float): Boolean - -@WasmOp(WasmOp.F32_GT) -public external fun wasm_f32_gt(a: Float, b: Float): Boolean - -@WasmOp(WasmOp.F32_LE) -public external fun wasm_f32_le(a: Float, b: Float): Boolean - -@WasmOp(WasmOp.F32_GE) -public external fun wasm_f32_ge(a: Float, b: Float): Boolean - -@WasmOp(WasmOp.F64_EQ) -public external fun wasm_f64_eq(a: Double, b: Double): Boolean - -@WasmOp(WasmOp.F64_NE) -public external fun wasm_f64_ne(a: Double, b: Double): Boolean - -@WasmOp(WasmOp.F64_LT) -public external fun wasm_f64_lt(a: Double, b: Double): Boolean - -@WasmOp(WasmOp.F64_GT) -public external fun wasm_f64_gt(a: Double, b: Double): Boolean - -@WasmOp(WasmOp.F64_LE) -public external fun wasm_f64_le(a: Double, b: Double): Boolean - -@WasmOp(WasmOp.F64_GE) -public external fun wasm_f64_ge(a: Double, b: Double): Boolean - -@WasmOp(WasmOp.I32_ADD) -public external fun wasm_i32_add(a: Int, b: Int): Int - -@WasmOp(WasmOp.I32_SUB) -public external fun wasm_i32_sub(a: Int, b: Int): Int - -@WasmOp(WasmOp.I32_MUL) -public external fun wasm_i32_mul(a: Int, b: Int): Int - -@WasmOp(WasmOp.I32_DIV_S) -public external fun wasm_i32_div_s(a: Int, b: Int): Int - -@WasmOp(WasmOp.I32_DIV_U) -public external fun wasm_i32_div_u(a: Int, b: Int): Int - -@WasmOp(WasmOp.I32_REM_S) -public external fun wasm_i32_rem_s(a: Int, b: Int): Int - -@WasmOp(WasmOp.I32_REM_U) -public external fun wasm_i32_rem_u(a: Int, b: Int): Int - -@WasmOp(WasmOp.I32_AND) -public external fun wasm_i32_and(a: Int, b: Int): Int - -@WasmOp(WasmOp.I32_OR) -public external fun wasm_i32_or(a: Int, b: Int): Int - -@WasmOp(WasmOp.I32_XOR) -public external fun wasm_i32_xor(a: Int, b: Int): Int - -@WasmOp(WasmOp.I32_SHL) -public external fun wasm_i32_shl(a: Int, b: Int): Int - -@WasmOp(WasmOp.I32_SHR_S) -public external fun wasm_i32_shr_s(a: Int, b: Int): Int - -@WasmOp(WasmOp.I32_SHR_U) -public external fun wasm_i32_shr_u(a: Int, b: Int): Int - -@WasmOp(WasmOp.I32_ROTL) -public external fun wasm_i32_rotl(a: Int, b: Int): Int - -@WasmOp(WasmOp.I32_ROTR) -public external fun wasm_i32_rotr(a: Int, b: Int): Int - -@WasmOp(WasmOp.I64_ADD) -public external fun wasm_i64_add(a: Long, b: Long): Long - -@WasmOp(WasmOp.I64_SUB) -public external fun wasm_i64_sub(a: Long, b: Long): Long - -@WasmOp(WasmOp.I64_MUL) -public external fun wasm_i64_mul(a: Long, b: Long): Long - -@WasmOp(WasmOp.I64_DIV_S) -public external fun wasm_i64_div_s(a: Long, b: Long): Long - -@WasmOp(WasmOp.I64_DIV_U) -public external fun wasm_i64_div_u(a: Long, b: Long): Long - -@WasmOp(WasmOp.I64_REM_S) -public external fun wasm_i64_rem_s(a: Long, b: Long): Long - -@WasmOp(WasmOp.I64_REM_U) -public external fun wasm_i64_rem_u(a: Long, b: Long): Long - -@WasmOp(WasmOp.I64_AND) -public external fun wasm_i64_and(a: Long, b: Long): Long - -@WasmOp(WasmOp.I64_OR) -public external fun wasm_i64_or(a: Long, b: Long): Long - -@WasmOp(WasmOp.I64_XOR) -public external fun wasm_i64_xor(a: Long, b: Long): Long - -@WasmOp(WasmOp.I64_SHL) -public external fun wasm_i64_shl(a: Long, b: Long): Long - -@WasmOp(WasmOp.I64_SHR_S) -public external fun wasm_i64_shr_s(a: Long, b: Long): Long - -@WasmOp(WasmOp.I64_SHR_U) -public external fun wasm_i64_shr_u(a: Long, b: Long): Long - -@WasmOp(WasmOp.I64_ROTL) -public external fun wasm_i64_rotl(a: Long, b: Long): Long - -@WasmOp(WasmOp.I64_ROTR) -public external fun wasm_i64_rotr(a: Long, b: Long): Long - -@WasmOp(WasmOp.F32_ADD) -public external fun wasm_f32_add(a: Float, b: Float): Float - -@WasmOp(WasmOp.F32_SUB) -public external fun wasm_f32_sub(a: Float, b: Float): Float - -@WasmOp(WasmOp.F32_MUL) -public external fun wasm_f32_mul(a: Float, b: Float): Float - -@WasmOp(WasmOp.F32_DIV) -public external fun wasm_f32_div(a: Float, b: Float): Float - -@WasmOp(WasmOp.F32_MIN) -public external fun wasm_f32_min(a: Float, b: Float): Float - -@WasmOp(WasmOp.F32_MAX) -public external fun wasm_f32_max(a: Float, b: Float): Float - -@WasmOp(WasmOp.F32_COPYSIGN) -public external fun wasm_f32_copysign(a: Float, b: Float): Float - -@WasmOp(WasmOp.F64_ADD) -public external fun wasm_f64_add(a: Double, b: Double): Double - -@WasmOp(WasmOp.F64_SUB) -public external fun wasm_f64_sub(a: Double, b: Double): Double - -@WasmOp(WasmOp.F64_MUL) -public external fun wasm_f64_mul(a: Double, b: Double): Double - -@WasmOp(WasmOp.F64_DIV) -public external fun wasm_f64_div(a: Double, b: Double): Double - -@WasmOp(WasmOp.F64_MIN) -public external fun wasm_f64_min(a: Double, b: Double): Double - -@WasmOp(WasmOp.F64_MAX) -public external fun wasm_f64_max(a: Double, b: Double): Double - - -@WasmOp(WasmOp.REF_IS_NULL) -public external fun wasm_ref_is_null(a: Any?): Boolean - -@WasmOp(WasmOp.REF_EQ) -public external fun wasm_ref_eq(a: Any?, b: Any?): Boolean - - -// --- - -@WasmOp(WasmOp.F32_NEAREST) -public external fun wasm_f32_nearest(a: Float): Float - -@WasmOp(WasmOp.F64_NEAREST) -public external fun wasm_f64_nearest(a: Double): Double - -@WasmOp(WasmOp.I32_WRAP_I64) -public external fun wasm_i32_wrap_i64(a: Long): Int - -@WasmOp(WasmOp.I64_EXTEND_I32_S) -public external fun wasm_i64_extend_i32_s(a: Int): Long - -@WasmOp(WasmOp.F32_CONVERT_I32_S) -public external fun wasm_f32_convert_i32_s(a: Int): Float - -@WasmOp(WasmOp.F32_CONVERT_I64_S) -public external fun wasm_f32_convert_i64_s(a: Long): Float - -@WasmOp(WasmOp.F32_DEMOTE_F64) -public external fun wasm_f32_demote_f64(a: Double): Float - -@WasmOp(WasmOp.F64_CONVERT_I32_S) -public external fun wasm_f64_convert_i32_s(a: Int): Double - -@WasmOp(WasmOp.F64_CONVERT_I64_S) -public external fun wasm_f64_convert_i64_s(a: Long): Double - -@WasmOp(WasmOp.F64_PROMOTE_F32) -public external fun wasm_f64_promote_f32(a: Float): Double - -@WasmOp(WasmOp.I32_REINTERPRET_F32) -public external fun wasm_i32_reinterpret_f32(a: Float): Int - -@WasmOp(WasmOp.F32_REINTERPRET_I32) -public external fun wasm_f32_reinterpret_i32(a: Int): Float - -@WasmOp(WasmOp.I32_TRUNC_SAT_F32_S) -public external fun wasm_i32_trunc_sat_f32_s(a: Float): Int - -@WasmOp(WasmOp.I32_TRUNC_SAT_F64_S) -public external fun wasm_i32_trunc_sat_f64_s(a: Double): Int - -@WasmOp(WasmOp.I64_TRUNC_SAT_F32_S) -public external fun wasm_i64_trunc_sat_f32_s(a: Float): Long - -@WasmOp(WasmOp.I64_TRUNC_SAT_F64_S) -public external fun wasm_i64_trunc_sat_f64_s(a: Double): Long - -@WasmOp(WasmOp.I32_LOAD) -public external fun wasm_i32_load(x: Int): Int \ No newline at end of file diff --git a/libraries/tools/kotlin-stdlib-gen/build.gradle b/libraries/tools/kotlin-stdlib-gen/build.gradle index d1f953ec885..c50f3f6dbe9 100644 --- a/libraries/tools/kotlin-stdlib-gen/build.gradle +++ b/libraries/tools/kotlin-stdlib-gen/build.gradle @@ -10,6 +10,7 @@ sourceSets { dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib:$bootstrapKotlinVersion" compile "org.jetbrains.kotlin:kotlin-reflect:$bootstrapKotlinVersion" + compile project(":wasm:wasm.ir") } compileKotlin { diff --git a/libraries/tools/kotlin-stdlib-gen/src/generators/GenerateStandardLib.kt b/libraries/tools/kotlin-stdlib-gen/src/generators/GenerateStandardLib.kt index c1a7fbb243e..c9c548e922c 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/generators/GenerateStandardLib.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/generators/GenerateStandardLib.kt @@ -71,6 +71,8 @@ fun main(args: Array) { } targetDir.resolve("_${source.name.capitalize()}$platformSuffix.kt") } + + targetBaseDirs[KotlinTarget.WASM]?.let { generateWasmOps(it) } } fun File.resolveExistingDir(subpath: String) = resolve(subpath).also { it.requireExistingDir() } diff --git a/libraries/tools/kotlin-stdlib-gen/src/generators/GenerateWasmOps.kt b/libraries/tools/kotlin-stdlib-gen/src/generators/GenerateWasmOps.kt new file mode 100644 index 00000000000..f55c535982c --- /dev/null +++ b/libraries/tools/kotlin-stdlib-gen/src/generators/GenerateWasmOps.kt @@ -0,0 +1,41 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package generators + +import org.jetbrains.kotlin.wasm.ir.WasmOp +import templates.COMMON_AUTOGENERATED_WARNING +import templates.COPYRIGHT_NOTICE +import java.io.File +import java.io.FileWriter + +fun generateWasmOps(targetDir: File) { + FileWriter(targetDir.resolve("_WasmOp.kt")).use { writer -> + writer.appendLine(COPYRIGHT_NOTICE) + writer.appendLine("package kotlin.wasm.internal") + writer.appendLine() + writer.appendLine(COMMON_AUTOGENERATED_WARNING) + writer.appendLine() + writer.appendLine( + """ + @ExcludedFromCodegen + @Suppress("unused") + @Target(AnnotationTarget.FUNCTION) + @Retention(AnnotationRetention.BINARY) + internal annotation class WasmOp(val name: String) { + companion object { + """.trimIndent() + ) + WasmOp.values().forEach { op -> + writer.appendLine(" const val $op = \"$op\"") + } + writer.appendLine( + """ + } + } + """.trimIndent() + ) + } +} \ No newline at end of file From 4bb163fd1fcfc1ffb3455d80e19ff5230f1f779d Mon Sep 17 00:00:00 2001 From: Svyatoslav Kuzmich Date: Sat, 5 Dec 2020 17:23:40 +0300 Subject: [PATCH 499/698] [Wasm IR] Add missing GC and function reference instructions --- .../stdlib/wasm/src/generated/_WasmOp.kt | 25 ++++++++++++- .../org/jetbrains/kotlin/wasm/ir/Operators.kt | 37 +++++++++++++++++-- .../wasm/ir/convertors/WasmBinaryToIR.kt | 1 + 3 files changed, 57 insertions(+), 6 deletions(-) diff --git a/libraries/stdlib/wasm/src/generated/_WasmOp.kt b/libraries/stdlib/wasm/src/generated/_WasmOp.kt index cf9528d2a08..36f58dca653 100644 --- a/libraries/stdlib/wasm/src/generated/_WasmOp.kt +++ b/libraries/stdlib/wasm/src/generated/_WasmOp.kt @@ -216,13 +216,34 @@ internal annotation class WasmOp(val name: String) { const val GLOBAL_SET = "GLOBAL_SET" const val REF_NULL = "REF_NULL" const val REF_IS_NULL = "REF_IS_NULL" - const val REF_EQ = "REF_EQ" const val REF_FUNC = "REF_FUNC" + const val REF_AS_NOT_NULL = "REF_AS_NOT_NULL" + const val BR_ON_NULL = "BR_ON_NULL" + const val REF_EQ = "REF_EQ" + const val CALL_REF = "CALL_REF" + const val RETURN_CALL_REF = "RETURN_CALL_REF" + const val FUNC_BIND = "FUNC_BIND" + const val LET = "LET" const val STRUCT_NEW_WITH_RTT = "STRUCT_NEW_WITH_RTT" + const val STRUCT_NEW_DEFAULT_WITH_RTT = "STRUCT_NEW_DEFAULT_WITH_RTT" const val STRUCT_GET = "STRUCT_GET" + const val STRUCT_GET_S = "STRUCT_GET_S" + const val STRUCT_GET_U = "STRUCT_GET_U" const val STRUCT_SET = "STRUCT_SET" - const val REF_CAST = "REF_CAST" + const val ARRAY_NEW_WITH_RTT = "ARRAY_NEW_WITH_RTT" + const val ARRAY_NEW_DEFAULT_WITH_RTT = "ARRAY_NEW_DEFAULT_WITH_RTT" + const val ARRAY_GET = "ARRAY_GET" + const val ARRAY_GET_S = "ARRAY_GET_S" + const val ARRAY_GET_U = "ARRAY_GET_U" + const val ARRAY_SET = "ARRAY_SET" + const val ARRAY_LEN = "ARRAY_LEN" + const val I31_NEW = "I31_NEW" + const val I31_GET_S = "I31_GET_S" + const val I31_GET_U = "I31_GET_U" const val RTT_CANON = "RTT_CANON" const val RTT_SUB = "RTT_SUB" + const val REF_TEST = "REF_TEST" + const val REF_CAST = "REF_CAST" + const val BR_ON_CAST = "BR_ON_CAST" } } diff --git a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/Operators.kt b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/Operators.kt index 7b5f7cff947..bc8478ea310 100644 --- a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/Operators.kt +++ b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/Operators.kt @@ -16,6 +16,7 @@ enum class WasmImmediateKind { MEM_ARG, BLOCK_TYPE, + LOCAL_DEFS, FUNC_IDX, LOCAL_IDX, @@ -319,18 +320,46 @@ enum class WasmOp( // Reference types REF_NULL("ref.null", 0xD0, HEAP_TYPE), REF_IS_NULL("ref.is_null", 0xD1), - REF_EQ("ref.eq", 0xD5), REF_FUNC("ref.func", 0xD2, FUNC_IDX), + REF_AS_NOT_NULL("ref.as_non_null", 0xD3), + BR_ON_NULL("br_on_null", 0xD4, LABEL_IDX), + REF_EQ("ref.eq", 0xD5), + + CALL_REF("call_ref", 0x14), + RETURN_CALL_REF("return_call_ref", 0x15), + FUNC_BIND("func.bind", 0x16, FUNC_IDX), + LET("let", 0x17, listOf(BLOCK_TYPE, LOCAL_DEFS)), // GC STRUCT_NEW_WITH_RTT("struct.new_with_rtt", 0xFB_01, STRUCT_TYPE_IDX), + STRUCT_NEW_DEFAULT_WITH_RTT("struct.new_default_with_rtt", 0xFB_02, STRUCT_TYPE_IDX), STRUCT_GET("struct.get", 0xFB_03, listOf(STRUCT_TYPE_IDX, STRUCT_FIELD_IDX)), + STRUCT_GET_S("struct.get_s", 0xFB_04, listOf(STRUCT_TYPE_IDX, STRUCT_FIELD_IDX)), + STRUCT_GET_U("struct.get_u", 0xFB_05, listOf(STRUCT_TYPE_IDX, STRUCT_FIELD_IDX)), STRUCT_SET("struct.set", 0xFB_06, listOf(STRUCT_TYPE_IDX, STRUCT_FIELD_IDX)), - REF_CAST("ref.cast", 0xFB_41, listOf(HEAP_TYPE, HEAP_TYPE)), - RTT_CANON("rtt.canon", 0xFB_30, HEAP_TYPE), - RTT_SUB("rtt.sub", 0xFB_31, HEAP_TYPE); + ARRAY_NEW_WITH_RTT("array.new_with_rtt", 0xFB_11, STRUCT_TYPE_IDX), + ARRAY_NEW_DEFAULT_WITH_RTT("array.new_default_with_rtt", 0xFB_12, STRUCT_TYPE_IDX), + ARRAY_GET("array.get", 0xFB_13, listOf(STRUCT_TYPE_IDX)), + ARRAY_GET_S("array.get_s", 0xFB_14, listOf(STRUCT_TYPE_IDX)), + ARRAY_GET_U("array.get_u", 0xFB_15, listOf(STRUCT_TYPE_IDX)), + ARRAY_SET("array.set", 0xFB_16, listOf(STRUCT_TYPE_IDX)), + ARRAY_LEN("array.len", 0xFB_17, listOf(STRUCT_TYPE_IDX)), + I31_NEW("i31.new", 0xFB_20), + I31_GET_S("i31.get_s", 0xFB_21), + I31_GET_U("i31.get_u", 0xFB_22), + + RTT_CANON("rtt.canon", 0xFB_30, HEAP_TYPE), + + // TODO: GC spec also has "depth" and "input heap type" immediates. V8 currently implements without them. + RTT_SUB("rtt.sub", 0xFB_31, HEAP_TYPE), + REF_TEST("ref.test", 0xFB_40, listOf(HEAP_TYPE, HEAP_TYPE)), + REF_CAST("ref.cast", 0xFB_41, listOf(HEAP_TYPE, HEAP_TYPE)), + + // TODO: GC spec also has two heap type immediates. V8 currently implements without them. + BR_ON_CAST("br_on_cast", 0xFB_42, listOf(LABEL_IDX)), + ; constructor(mnemonic: String, opcode: Int, vararg immediates: WasmImmediateKind) : this(mnemonic, opcode, immediates.toList()) } diff --git a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmBinaryToIR.kt b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmBinaryToIR.kt index a9c38336fc4..7490004f8b2 100644 --- a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmBinaryToIR.kt +++ b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmBinaryToIR.kt @@ -411,6 +411,7 @@ class WasmBinaryToIR(val b: MyByteReader) { WasmImmediateKind.STRUCT_FIELD_IDX -> TODO() WasmImmediateKind.TYPE_IMM -> TODO() WasmImmediateKind.HEAP_TYPE -> WasmImmediate.HeapType(readRefType()) + WasmImmediateKind.LOCAL_DEFS -> TODO() } } From d15af70a3ea364938d2289fe5a848ecda08502bc Mon Sep 17 00:00:00 2001 From: Svyatoslav Kuzmich Date: Sat, 5 Dec 2020 18:18:39 +0300 Subject: [PATCH 500/698] [Wasm] Refactoring: replace "struct types" with "GC types" In preparation for adding array types --- .../kotlin/backend/wasm/ir2wasm/BodyGenerator.kt | 8 ++++---- .../backend/wasm/ir2wasm/DeclarationGenerator.kt | 2 +- .../kotlin/backend/wasm/ir2wasm/TypeTransformer.kt | 3 +-- .../backend/wasm/ir2wasm/WasmBaseCodegenContext.kt | 2 +- .../wasm/ir2wasm/WasmCompiledModuleFragment.kt | 8 ++++---- .../backend/wasm/ir2wasm/WasmModuleCodegenContext.kt | 2 +- .../wasm/ir2wasm/WasmModuleCodegenContextImpl.kt | 8 ++++---- .../src/org/jetbrains/kotlin/wasm/ir/Declarations.kt | 2 +- .../src/org/jetbrains/kotlin/wasm/ir/Operators.kt | 4 ++-- .../src/org/jetbrains/kotlin/wasm/ir/Utils.kt | 2 +- .../kotlin/wasm/ir/WasmExpressionBuilder.kt | 12 ++++++------ .../kotlin/wasm/ir/convertors/WasmBinaryToIR.kt | 6 +++--- .../kotlin/wasm/ir/convertors/WasmIrToBinary.kt | 11 ++++++++--- .../kotlin/wasm/ir/convertors/WasmIrToText.kt | 11 +++++++++-- 14 files changed, 46 insertions(+), 35 deletions(-) diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/BodyGenerator.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/BodyGenerator.kt index 8e4e8701f5a..5488a75789d 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/BodyGenerator.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/BodyGenerator.kt @@ -78,7 +78,7 @@ class BodyGenerator(val context: WasmFunctionCodegenContext) : IrElementVisitorV private fun generateInstanceFieldAccess(field: IrField) { body.buildStructGet( - context.referenceStructType(field.parentAsClass.symbol), + context.referenceGcType(field.parentAsClass.symbol), context.getStructFieldRef(field) ) } @@ -91,7 +91,7 @@ class BodyGenerator(val context: WasmFunctionCodegenContext) : IrElementVisitorV generateExpression(receiver) generateExpression(expression.value) body.buildStructSet( - struct = context.referenceStructType(field.parentAsClass.symbol), + struct = context.referenceGcType(field.parentAsClass.symbol), fieldId = context.getStructFieldRef(field), ) } else { @@ -122,7 +122,7 @@ class BodyGenerator(val context: WasmFunctionCodegenContext) : IrElementVisitorV return } - val wasmStruct: WasmSymbol = context.referenceStructType(klass.symbol) + val wasmStruct: WasmSymbol = context.referenceGcType(klass.symbol) val wasmClassId = context.referenceClassId(klass.symbol) val irFields: List = klass.allFields(backendContext.irBuiltIns) @@ -157,7 +157,7 @@ class BodyGenerator(val context: WasmFunctionCodegenContext) : IrElementVisitorV if (call.symbol == wasmSymbols.boxIntrinsic) { val toType = call.getTypeArgument(0)!! val klass = toType.erasedUpperBound!! - val structTypeName = context.referenceStructType(klass.symbol) + val structTypeName = context.referenceGcType(klass.symbol) val klassId = context.referenceClassId(klass.symbol) body.buildConstI32Symbol(klassId) diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/DeclarationGenerator.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/DeclarationGenerator.kt index 0535998afd0..55ed3f7f8df 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/DeclarationGenerator.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/DeclarationGenerator.kt @@ -183,7 +183,7 @@ class DeclarationGenerator(val context: WasmModuleCodegenContext) : IrElementVis } ) - context.defineStructType(symbol, structType) + context.defineGcType(symbol, structType) var depth = 2 val metadata = context.getClassMetadata(symbol) diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/TypeTransformer.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/TypeTransformer.kt index 584a710f37b..98596092c7d 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/TypeTransformer.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/TypeTransformer.kt @@ -13,7 +13,6 @@ import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol import org.jetbrains.kotlin.ir.types.IrType -import org.jetbrains.kotlin.ir.types.classOrNull import org.jetbrains.kotlin.ir.types.classifierOrNull import org.jetbrains.kotlin.ir.types.getClass import org.jetbrains.kotlin.ir.util.getInlineClassUnderlyingType @@ -47,7 +46,7 @@ class WasmTypeTransformer( } fun IrType.toStructType(): WasmType = - WasmRefNullType(WasmHeapType.Type(context.referenceStructType(erasedUpperBound?.symbol ?: builtIns.anyClass))) + WasmRefNullType(WasmHeapType.Type(context.referenceGcType(erasedUpperBound?.symbol ?: builtIns.anyClass))) fun IrType.toBoxedInlineClassType(): WasmType = toStructType() diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/WasmBaseCodegenContext.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/WasmBaseCodegenContext.kt index 13ea4f95b2e..341cc0dd9f8 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/WasmBaseCodegenContext.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/WasmBaseCodegenContext.kt @@ -21,7 +21,7 @@ interface WasmBaseCodegenContext { fun referenceFunction(irFunction: IrFunctionSymbol): WasmSymbol fun referenceGlobal(irField: IrFieldSymbol): WasmSymbol - fun referenceStructType(irClass: IrClassSymbol): WasmSymbol + fun referenceGcType(irClass: IrClassSymbol): WasmSymbol fun referenceFunctionType(irFunction: IrFunctionSymbol): WasmSymbol fun referenceClassId(irClass: IrClassSymbol): WasmSymbol diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/WasmCompiledModuleFragment.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/WasmCompiledModuleFragment.kt index bb8e8842606..e5f40324807 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/WasmCompiledModuleFragment.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/WasmCompiledModuleFragment.kt @@ -20,8 +20,8 @@ class WasmCompiledModuleFragment { ReferencableAndDefinable() val functionTypes = ReferencableAndDefinable() - val structTypes = - ReferencableAndDefinable() + val gcTypes = + ReferencableAndDefinable() val classIds = ReferencableElements() val interfaceId = @@ -88,7 +88,7 @@ class WasmCompiledModuleFragment { bind(functions.unbound, functions.defined) bind(globals.unbound, globals.defined) bind(functionTypes.unbound, functionTypes.defined) - bind(structTypes.unbound, structTypes.defined) + bind(gcTypes.unbound, gcTypes.defined) bind(runtimeTypes.unbound, runtimeTypes.defined) val klassIds = mutableMapOf() @@ -162,7 +162,7 @@ class WasmCompiledModuleFragment { val module = WasmModule( functionTypes = functionTypes.elements, - structs = structTypes.elements, + gcTypes = gcTypes.elements, importsInOrder = importedFunctions, importedFunctions = importedFunctions, definedFunctions = functions.elements.filterIsInstance(), diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/WasmModuleCodegenContext.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/WasmModuleCodegenContext.kt index b0d380faa42..f8e2b7f1d83 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/WasmModuleCodegenContext.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/WasmModuleCodegenContext.kt @@ -19,7 +19,7 @@ import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol interface WasmModuleCodegenContext : WasmBaseCodegenContext { fun defineFunction(irFunction: IrFunctionSymbol, wasmFunction: WasmFunction) fun defineGlobal(irField: IrFieldSymbol, wasmGlobal: WasmGlobal) - fun defineStructType(irClass: IrClassSymbol, wasmStruct: WasmStructDeclaration) + fun defineGcType(irClass: IrClassSymbol, wasmType: WasmTypeDeclaration) fun defineRTT(irClass: IrClassSymbol, wasmGlobal: WasmGlobal) fun defineFunctionType(irFunction: IrFunctionSymbol, wasmFunctionType: WasmFunctionType) fun addJsFun(importName: String, jsCode: String) diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/WasmModuleCodegenContextImpl.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/WasmModuleCodegenContextImpl.kt index 7759bd5834f..c6796576178 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/WasmModuleCodegenContextImpl.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/WasmModuleCodegenContextImpl.kt @@ -92,8 +92,8 @@ class WasmModuleCodegenContextImpl( wasmFragment.globals.define(irField, wasmGlobal) } - override fun defineStructType(irClass: IrClassSymbol, wasmStruct: WasmStructDeclaration) { - wasmFragment.structTypes.define(irClass, wasmStruct) + override fun defineGcType(irClass: IrClassSymbol, wasmStruct: WasmTypeDeclaration) { + wasmFragment.gcTypes.define(irClass, wasmStruct) } override fun defineRTT(irClass: IrClassSymbol, wasmGlobal: WasmGlobal) { @@ -122,12 +122,12 @@ class WasmModuleCodegenContextImpl( override fun referenceGlobal(irField: IrFieldSymbol): WasmSymbol = wasmFragment.globals.reference(irField) - override fun referenceStructType(irClass: IrClassSymbol): WasmSymbol { + override fun referenceGcType(irClass: IrClassSymbol): WasmSymbol { val type = irClass.defaultType require(!type.isNothing()) { "Can't reference Nothing type" } - return wasmFragment.structTypes.reference(irClass) + return wasmFragment.gcTypes.reference(irClass) } override fun referenceClassRTT(irClass: IrClassSymbol): WasmSymbol = diff --git a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/Declarations.kt b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/Declarations.kt index cbc7e971293..fa076105238 100644 --- a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/Declarations.kt +++ b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/Declarations.kt @@ -8,7 +8,7 @@ package org.jetbrains.kotlin.wasm.ir class WasmModule( val functionTypes: List = emptyList(), - val structs: List = emptyList(), + val gcTypes: List = emptyList(), val importsInOrder: List = emptyList(), val importedFunctions: List = emptyList(), diff --git a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/Operators.kt b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/Operators.kt index bc8478ea310..bfc57698742 100644 --- a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/Operators.kt +++ b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/Operators.kt @@ -79,8 +79,8 @@ sealed class WasmImmediate { class LabelIdxVector(val value: List) : WasmImmediate() class ElemIdx(val value: WasmElement) : WasmImmediate() - class StructType(val value: WasmSymbol) : WasmImmediate() { - constructor(value: WasmStructDeclaration) : this(WasmSymbol(value)) + class GcType(val value: WasmSymbol) : WasmImmediate() { + constructor(value: WasmTypeDeclaration) : this(WasmSymbol(value)) } class StructFieldIdx(val value: WasmSymbol) : WasmImmediate() diff --git a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/Utils.kt b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/Utils.kt index b4656e9c967..911e8524a45 100644 --- a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/Utils.kt +++ b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/Utils.kt @@ -16,7 +16,7 @@ fun WasmModule.calculateIds() { } functionTypes.calculateIds() - structs.calculateIds(startIndex = functionTypes.size) + gcTypes.calculateIds(startIndex = functionTypes.size) importedFunctions.calculateIds() importedMemories.calculateIds() importedTables.calculateIds() diff --git a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/WasmExpressionBuilder.kt b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/WasmExpressionBuilder.kt index 15d3f1e5d41..5244bfaa151 100644 --- a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/WasmExpressionBuilder.kt +++ b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/WasmExpressionBuilder.kt @@ -106,22 +106,22 @@ abstract class WasmExpressionBuilder { buildInstr(WasmOp.GLOBAL_SET, WasmImmediate.GlobalIdx(global)) } - fun buildStructGet(struct: WasmSymbol, fieldId: WasmSymbol) { + fun buildStructGet(struct: WasmSymbol, fieldId: WasmSymbol) { buildInstr( WasmOp.STRUCT_GET, - WasmImmediate.StructType(struct), + WasmImmediate.GcType(struct), WasmImmediate.StructFieldIdx(fieldId) ) } - fun buildStructNew(struct: WasmSymbol) { - buildInstr(WasmOp.STRUCT_NEW_WITH_RTT, WasmImmediate.StructType(struct)) + fun buildStructNew(struct: WasmSymbol) { + buildInstr(WasmOp.STRUCT_NEW_WITH_RTT, WasmImmediate.GcType(struct)) } - fun buildStructSet(struct: WasmSymbol, fieldId: WasmSymbol) { + fun buildStructSet(struct: WasmSymbol, fieldId: WasmSymbol) { buildInstr( WasmOp.STRUCT_SET, - WasmImmediate.StructType(struct), + WasmImmediate.GcType(struct), WasmImmediate.StructFieldIdx(fieldId) ) } diff --git a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmBinaryToIR.kt b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmBinaryToIR.kt index 7490004f8b2..298f38674ee 100644 --- a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmBinaryToIR.kt +++ b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmBinaryToIR.kt @@ -15,7 +15,7 @@ class WasmBinaryToIR(val b: MyByteReader) { val validVersion = 1u val functionTypes: MutableList = mutableListOf() - val structs: MutableList = mutableListOf() + val gcTypes: MutableList = mutableListOf() val importsInOrder: MutableList = mutableListOf() val importedFunctions: MutableList = mutableListOf() @@ -80,7 +80,7 @@ class WasmBinaryToIR(val b: MyByteReader) { is WasmFunctionType -> functionTypes += type is WasmStructDeclaration -> - structs += type + gcTypes += type } } } @@ -313,7 +313,7 @@ class WasmBinaryToIR(val b: MyByteReader) { return WasmModule( functionTypes = functionTypes, - structs = structs, + gcTypes = gcTypes, importsInOrder = importsInOrder, importedFunctions = importedFunctions, importedMemories = importedMemories, diff --git a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmIrToBinary.kt b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmIrToBinary.kt index 1c289091d66..7aff5c8e626 100644 --- a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmIrToBinary.kt +++ b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmIrToBinary.kt @@ -21,9 +21,14 @@ class WasmIrToBinary(outputStream: OutputStream, val module: WasmModule) { with(module) { // type section appendSection(1u) { - appendVectorSize(functionTypes.size + structs.size) + appendVectorSize(functionTypes.size + gcTypes.size) functionTypes.forEach { appendFunctionTypeDeclaration(it) } - structs.forEach { appendStructTypeDeclaration(it) } + gcTypes.forEach { + when (it) { + is WasmStructDeclaration -> appendStructTypeDeclaration(it) + else -> TODO("Support arrays") + } + } } // import section @@ -148,7 +153,7 @@ class WasmIrToBinary(outputStream: OutputStream, val module: WasmModule) { appendType(type) } } - is WasmImmediate.StructType -> appendModuleFieldReference(x.value.owner) + is WasmImmediate.GcType -> appendModuleFieldReference(x.value.owner) is WasmImmediate.StructFieldIdx -> b.writeVarUInt32(x.value.owner) is WasmImmediate.HeapType -> appendHeapType(x.value) } diff --git a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmIrToText.kt b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmIrToText.kt index d8ea08533d4..a023490d499 100644 --- a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmIrToText.kt +++ b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmIrToText.kt @@ -107,7 +107,7 @@ class WasmIrToText : SExpressionBuilder() { is WasmImmediate.ValTypeVector -> sameLineList("result") { x.value.forEach { appendType(it) } } - is WasmImmediate.StructType -> appendModuleFieldReference(x.value.owner) + is WasmImmediate.GcType -> appendModuleFieldReference(x.value.owner) is WasmImmediate.StructFieldIdx -> appendElement(x.value.owner.toString()) is WasmImmediate.HeapType -> { appendHeapType(x.value) @@ -197,7 +197,14 @@ class WasmIrToText : SExpressionBuilder() { with(module) { newLineList("module") { functionTypes.forEach { appendFunctionTypeDeclaration(it) } - structs.forEach { appendStructTypeDeclaration(it) } + gcTypes.forEach { + when (it) { + is WasmStructDeclaration -> + appendStructTypeDeclaration(it) + else -> + TODO("Support arrays") + } + } importsInOrder.forEach { when (it) { is WasmFunction.Imported -> appendImportedFunction(it) From d4233f3f0ea0691e07038de81742b9813c01c7d4 Mon Sep 17 00:00:00 2001 From: Svyatoslav Kuzmich Date: Mon, 7 Dec 2020 15:42:55 +0300 Subject: [PATCH 501/698] [Wasm] Use Wasm GC arrays instead of JS arrays JS arrays was a workaround for lack of arrays in Firefox Wasm GC prototype Now with V8 as a test runner we can use proper arrays --- .../jetbrains/kotlin/backend/wasm/compiler.kt | 18 +- .../backend/wasm/ir2wasm/BodyGenerator.kt | 32 ++- .../wasm/ir2wasm/DeclarationGenerator.kt | 17 ++ .../backend/wasm/ir2wasm/TypeTransformer.kt | 6 +- .../kotlin/backend/wasm/utils/Annotations.kt | 17 ++ .../stdlib/wasm/builtins/kotlin/Array.kt | 10 +- .../stdlib/wasm/builtins/kotlin/Arrays.kt | 119 ++++------- .../internal/kotlin/wasm/internal/JsArray.kt | 153 -------------- .../kotlin/wasm/internal/WasmAnnotations.kt | 8 + .../stdlib/wasm/src/generated/_WasmArrays.kt | 196 ++++++++++++++++++ .../src/generators/GenerateStandardLib.kt | 2 +- .../src/generators/GenerateWasmOps.kt | 63 +++++- .../jetbrains/kotlin/wasm/ir/Declarations.kt | 5 + .../wasm/ir/convertors/WasmIrToBinary.kt | 15 +- .../kotlin/wasm/ir/convertors/WasmIrToText.kt | 15 +- 15 files changed, 400 insertions(+), 276 deletions(-) delete mode 100644 libraries/stdlib/wasm/internal/kotlin/wasm/internal/JsArray.kt create mode 100644 libraries/stdlib/wasm/src/generated/_WasmArrays.kt diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/compiler.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/compiler.kt index a0ab3d1db13..e19fc62d910 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/compiler.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/compiler.kt @@ -128,23 +128,7 @@ fun WasmCompiledModuleFragment.generateJs(): String { Char_toString(char) { return String.fromCharCode(char) }, - - JsArray_new(size) { - return new Array(size); - }, - - JsArray_get(array, index) { - return array[index]; - }, - - JsArray_set(array, index, value) { - array[index] = value; - }, - - JsArray_getSize(array) { - return array.length; - }, - + identity(x) { return x; }, diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/BodyGenerator.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/BodyGenerator.kt index 5488a75789d..22cd4da8aa2 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/BodyGenerator.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/BodyGenerator.kt @@ -122,7 +122,19 @@ class BodyGenerator(val context: WasmFunctionCodegenContext) : IrElementVisitorV return } - val wasmStruct: WasmSymbol = context.referenceGcType(klass.symbol) + val wasmGcType: WasmSymbol = context.referenceGcType(klass.symbol) + + klass.getWasmArrayAnnotation()?.let { wasmArrayInfo -> + require(expression.valueArgumentsCount == 1) { "@WasmArrayOf constructs must have exactly one argument" } + generateExpression(expression.getValueArgument(0)!!) + body.buildRttCanon(context.transformType(klass.defaultType)) + body.buildInstr( + WasmOp.ARRAY_NEW_DEFAULT_WITH_RTT, + WasmImmediate.GcType(wasmGcType) + ) + return + } + val wasmClassId = context.referenceClassId(klass.symbol) val irFields: List = klass.allFields(backendContext.irBuiltIns) @@ -135,7 +147,7 @@ class BodyGenerator(val context: WasmFunctionCodegenContext) : IrElementVisitorV } body.buildGetGlobal(context.referenceClassRTT(klass.symbol)) - body.buildStructNew(wasmStruct) + body.buildStructNew(wasmGcType) generateCall(expression) } @@ -472,12 +484,16 @@ class BodyGenerator(val context: WasmFunctionCodegenContext) : IrElementVisitorV 0 -> { } 1 -> { - when (val imm = op.immediates[0]) { - WasmImmediateKind.MEM_ARG -> - immediates = arrayOf(WasmImmediate.MemArg(0u, 0u)) - else -> - error("Immediate $imm is unsupported") - } + immediates = arrayOf( + when (val imm = op.immediates[0]) { + WasmImmediateKind.MEM_ARG -> + WasmImmediate.MemArg(0u, 0u) + WasmImmediateKind.STRUCT_TYPE_IDX -> + WasmImmediate.GcType(context.referenceGcType(function.dispatchReceiverParameter!!.type.classOrNull!!)) + else -> + error("Immediate $imm is unsupported") + } + ) } else -> error("Op $opString is unsupported") diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/DeclarationGenerator.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/DeclarationGenerator.kt index 55ed3f7f8df..ffa99ad0679 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/DeclarationGenerator.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/DeclarationGenerator.kt @@ -168,6 +168,23 @@ class DeclarationGenerator(val context: WasmModuleCodegenContext) : IrElementVis if (declaration.isAnnotationClass) return val symbol = declaration.symbol + + // Handle arrays + declaration.getWasmArrayAnnotation()?.let { wasmArrayAnnotation -> + val nameStr = declaration.fqNameWhenAvailable.toString() + val wasmArrayDeclaration = WasmArrayDeclaration( + nameStr, + WasmStructFieldDeclaration( + name = "field", + type = context.transformType(wasmArrayAnnotation.type), + isMutable = true + ) + ) + + context.defineGcType(symbol, wasmArrayDeclaration) + return + } + if (declaration.isInterface) { context.registerInterface(symbol) } else { diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/TypeTransformer.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/TypeTransformer.kt index 98596092c7d..d20a35ef1bd 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/TypeTransformer.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/TypeTransformer.kt @@ -45,11 +45,11 @@ class WasmTypeTransformer( toWasmValueType() } - fun IrType.toStructType(): WasmType = + fun IrType.toWasmGcRefType(): WasmType = WasmRefNullType(WasmHeapType.Type(context.referenceGcType(erasedUpperBound?.symbol ?: builtIns.anyClass))) fun IrType.toBoxedInlineClassType(): WasmType = - toStructType() + toWasmGcRefType() fun IrType.toWasmValueType(): WasmType = when (this) { @@ -88,7 +88,7 @@ class WasmTypeTransformer( } else if (ic != null) { getInlineClassUnderlyingType(ic).toWasmValueType() } else { - this.toStructType() + this.toWasmGcRefType() } } } diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/utils/Annotations.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/utils/Annotations.kt index f303b6707cf..75243f64760 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/utils/Annotations.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/utils/Annotations.kt @@ -7,7 +7,11 @@ package org.jetbrains.kotlin.backend.wasm.utils import org.jetbrains.kotlin.ir.backend.js.utils.getSingleConstStringArgument import org.jetbrains.kotlin.ir.declarations.IrAnnotationContainer +import org.jetbrains.kotlin.ir.declarations.IrClass +import org.jetbrains.kotlin.ir.expressions.IrClassReference import org.jetbrains.kotlin.ir.expressions.IrConst +import org.jetbrains.kotlin.ir.types.makeNullable +import org.jetbrains.kotlin.ir.util.defaultType import org.jetbrains.kotlin.ir.util.getAnnotation import org.jetbrains.kotlin.ir.util.hasAnnotation import org.jetbrains.kotlin.name.FqName @@ -36,5 +40,18 @@ fun IrAnnotationContainer.getWasmImportAnnotation(): WasmImportPair? = ) } + +class WasmArrayInfo(val klass: IrClass, val isNullable: Boolean) { + val type = klass.defaultType.let { if (isNullable) it.makeNullable() else it } +} + +fun IrAnnotationContainer.getWasmArrayAnnotation(): WasmArrayInfo? = + getAnnotation(FqName("kotlin.wasm.internal.WasmArrayOf"))?.let { + WasmArrayInfo( + (it.getValueArgument(0) as IrClassReference).symbol.owner as IrClass, + (it.getValueArgument(1) as IrConst<*>).value as Boolean, + ) + } + fun IrAnnotationContainer.getJsFunAnnotation(): String? = getAnnotation(FqName("kotlin.JsFun"))?.getSingleConstStringArgument() diff --git a/libraries/stdlib/wasm/builtins/kotlin/Array.kt b/libraries/stdlib/wasm/builtins/kotlin/Array.kt index cdc115b427f..98a40a67815 100644 --- a/libraries/stdlib/wasm/builtins/kotlin/Array.kt +++ b/libraries/stdlib/wasm/builtins/kotlin/Array.kt @@ -15,7 +15,7 @@ import kotlin.wasm.internal.* * for more information on arrays. */ public class Array constructor(size: Int) { - private var jsArray: WasmExternRef = JsArray_new(size) + private var storage: WasmAnyArray = WasmAnyArray(size) /** * Creates a new array with the specified [size], where each element is calculated by calling the specified @@ -26,7 +26,7 @@ public class Array constructor(size: Int) { */ @Suppress("TYPE_PARAMETER_AS_REIFIED") public constructor(size: Int, init: (Int) -> T) : this(size) { - JsArray_fill_T(jsArray, size, init) + storage.fill(size, init) } /** @@ -41,7 +41,7 @@ public class Array constructor(size: Int) { */ @Suppress("UNCHECKED_CAST") public operator fun get(index: Int): T = - WasmExternRefToAny(JsArray_get_WasmExternRef(jsArray, index)) as T + storage.get(index) as T /** * Sets the array element at the specified [index] to the specified [value]. This method can @@ -54,14 +54,14 @@ public class Array constructor(size: Int) { * where the behavior is unspecified. */ public operator fun set(index: Int, value: T) { - JsArray_set_WasmExternRef(jsArray, index, value.toWasmExternRef()) + storage.set(index, value) } /** * Returns the number of elements in the array. */ public val size: Int - get() = JsArray_getSize(jsArray) + get() = storage.len() /** * Creates an iterator for iterating over the elements of the array. diff --git a/libraries/stdlib/wasm/builtins/kotlin/Arrays.kt b/libraries/stdlib/wasm/builtins/kotlin/Arrays.kt index 3cc884ec1c9..1bbf8ae056c 100644 --- a/libraries/stdlib/wasm/builtins/kotlin/Arrays.kt +++ b/libraries/stdlib/wasm/builtins/kotlin/Arrays.kt @@ -8,27 +8,21 @@ package kotlin import kotlin.wasm.internal.* public class ByteArray(size: Int) { - private var jsArray: WasmExternRef = JsArray_new(size) - - init { - JsArray_fill_Byte(jsArray, size) { 0 } - } + private var storage = WasmByteArray(size) public constructor(size: Int, init: (Int) -> Byte) : this(size) { - jsArray = JsArray_new(size) - JsArray_fill_Byte(jsArray, size, init) + storage.fill(size, init) } public operator fun get(index: Int): Byte = - JsArray_get_Byte(jsArray, index) + storage.get(index) public operator fun set(index: Int, value: Byte) { - JsArray_set_Byte(jsArray, index, value) + storage.set(index, value) } public val size: Int - get() = JsArray_getSize(jsArray) - + get() = storage.len() public operator fun iterator(): ByteIterator = byteArrayIterator(this) } @@ -41,26 +35,21 @@ internal fun byteArrayIterator(array: ByteArray) = object : ByteIterator() { public class CharArray(size: Int) { - private var jsArray: WasmExternRef = JsArray_new(size) - - init { - JsArray_fill_Char(jsArray, size) { 0.toChar() } - } + private var storage = WasmShortArray(size) public constructor(size: Int, init: (Int) -> Char) : this(size) { - jsArray = JsArray_new(size) - JsArray_fill_Char(jsArray, size, init) + storage.fill(size) { init(it).toShort() } } public operator fun get(index: Int): Char = - JsArray_get_Char(jsArray, index) + storage.get(index).toChar() public operator fun set(index: Int, value: Char) { - JsArray_set_Char(jsArray, index, value) + storage.set(index, value.toShort()) } public val size: Int - get() = JsArray_getSize(jsArray) + get() = storage.len() public operator fun iterator(): CharIterator = charArrayIterator(this) @@ -74,25 +63,21 @@ internal fun charArrayIterator(array: CharArray) = object : CharIterator() { public class ShortArray(size: Int) { - private var jsArray: WasmExternRef = JsArray_new(size) - - init { - JsArray_fill_Short(jsArray, size) { 0 } - } + private var storage = WasmShortArray(size) public constructor(size: Int, init: (Int) -> Short) : this(size) { - JsArray_fill_Short(jsArray, size, init) + storage.fill(size, init) } public operator fun get(index: Int): Short = - JsArray_get_Short(jsArray, index) + storage.get(index) public operator fun set(index: Int, value: Short) { - JsArray_set_Short(jsArray, index, value) + storage.set(index, value) } public val size: Int - get() = JsArray_getSize(jsArray) + get() = storage.len() public operator fun iterator(): ShortIterator = shortArrayIterator(this) @@ -106,25 +91,21 @@ internal fun shortArrayIterator(array: ShortArray) = object : ShortIterator() { public class IntArray(size: Int) { - private var jsArray: WasmExternRef = JsArray_new(size) - - init { - JsArray_fill_Int(jsArray, size) { 0 } - } + private var storage = WasmIntArray(size) public constructor(size: Int, init: (Int) -> Int) : this(size) { - JsArray_fill_Int(jsArray, size, init) + storage.fill(size, init) } public operator fun get(index: Int): Int = - JsArray_get_Int(jsArray, index) + storage.get(index) public operator fun set(index: Int, value: Int) { - JsArray_set_Int(jsArray, index, value) + storage.set(index, value) } public val size: Int - get() = JsArray_getSize(jsArray) + get() = storage.len() public operator fun iterator(): IntIterator = intArrayIterator(this) @@ -138,26 +119,21 @@ internal fun intArrayIterator(array: IntArray) = object : IntIterator() { public class LongArray(size: Int) { - private var jsArray: WasmExternRef = JsArray_new(size) - - init { - JsArray_fill_Long(jsArray, size) { 0L } - } + private var storage = WasmLongArray (size) public constructor(size: Int, init: (Int) -> Long) : this(size) { - JsArray_fill_Long(jsArray, size, init) + storage.fill(size, init) } public operator fun get(index: Int): Long = - JsArray_get_Long(jsArray, index) + storage.get(index) public operator fun set(index: Int, value: Long) { - JsArray_set_Long(jsArray, index, value) + storage.set(index, value) } public val size: Int - get() = JsArray_getSize(jsArray) - + get() = storage.len() public operator fun iterator(): LongIterator = longArrayIterator(this) } @@ -170,26 +146,21 @@ internal fun longArrayIterator(array: LongArray) = object : LongIterator() { public class FloatArray(size: Int) { - private var jsArray: WasmExternRef = JsArray_new(size) - - init { - JsArray_fill_Float(jsArray, size) { 0.0f } - } + private var storage = WasmFloatArray(size) public constructor(size: Int, init: (Int) -> Float) : this(size) { - JsArray_fill_Float(jsArray, size, init) + storage.fill(size, init) } public operator fun get(index: Int): Float = - JsArray_get_Float(jsArray, index) + storage.get(index) public operator fun set(index: Int, value: Float) { - JsArray_set_Float(jsArray, index, value) + storage.set(index, value) } public val size: Int - get() = JsArray_getSize(jsArray) - + get() = storage.len() public operator fun iterator(): FloatIterator = floatArrayIterator(this) } @@ -202,26 +173,21 @@ internal fun floatArrayIterator(array: FloatArray) = object : FloatIterator() { public class DoubleArray(size: Int) { - private var jsArray: WasmExternRef = JsArray_new(size) - - init { - JsArray_fill_Double(jsArray, size) { 0.0 } - } + private var storage = WasmDoubleArray(size) public constructor(size: Int, init: (Int) -> Double) : this(size) { - JsArray_fill_Double(jsArray, size, init) + storage.fill(size, init) } public operator fun get(index: Int): Double = - JsArray_get_Double(jsArray, index) + storage.get(index) public operator fun set(index: Int, value: Double) { - JsArray_set_Double(jsArray, index, value) + storage.set(index, value) } public val size: Int - get() = JsArray_getSize(jsArray) - + get() = storage.len() public operator fun iterator(): DoubleIterator = doubleArrayIterator(this) } @@ -234,26 +200,21 @@ internal fun doubleArrayIterator(array: DoubleArray) = object : DoubleIterator() public class BooleanArray(size: Int) { - private var jsArray: WasmExternRef = JsArray_new(size) - - init { - JsArray_fill_Boolean(jsArray, size) { false } - } + private var storage = WasmBooleanArray(size) public constructor(size: Int, init: (Int) -> Boolean) : this(size) { - JsArray_fill_Boolean(jsArray, size, init) + storage.fill(size, init) } public operator fun get(index: Int): Boolean = - JsArray_get_Boolean(jsArray, index) + storage.get(index) public operator fun set(index: Int, value: Boolean) { - JsArray_set_Boolean(jsArray, index, value) + storage.set(index, value) } public val size: Int - get() = JsArray_getSize(jsArray) - + get() = storage.len() public operator fun iterator(): BooleanIterator = booleanArrayIterator(this) } diff --git a/libraries/stdlib/wasm/internal/kotlin/wasm/internal/JsArray.kt b/libraries/stdlib/wasm/internal/kotlin/wasm/internal/JsArray.kt deleted file mode 100644 index 2d74af9b300..00000000000 --- a/libraries/stdlib/wasm/internal/kotlin/wasm/internal/JsArray.kt +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - - -package kotlin.wasm.internal - -@ExcludedFromCodegen -@WasmForeign -internal class WasmExternRef - -@WasmImport("runtime", "JsArray_new") -internal fun JsArray_new(size: Int): WasmExternRef = - implementedAsIntrinsic - -@WasmImport("runtime", "JsArray_get") -internal fun JsArray_get_Byte(array: WasmExternRef, index: Int): Byte = implementedAsIntrinsic - -@WasmImport("runtime", "JsArray_set") -internal fun JsArray_set_Byte(array: WasmExternRef, index: Int, value: Byte): Unit = implementedAsIntrinsic - -@WasmImport("runtime", "JsArray_get") -internal fun JsArray_get_Char(array: WasmExternRef, index: Int): Char = implementedAsIntrinsic - -@WasmImport("runtime", "JsArray_set") -internal fun JsArray_set_Char(array: WasmExternRef, index: Int, value: Char): Unit = implementedAsIntrinsic - -@WasmImport("runtime", "JsArray_get") -internal fun JsArray_get_Short(array: WasmExternRef, index: Int): Short = implementedAsIntrinsic - -@WasmImport("runtime", "JsArray_set") -internal fun JsArray_set_Short(array: WasmExternRef, index: Int, value: Short): Unit = implementedAsIntrinsic - -@WasmImport("runtime", "JsArray_get") -internal fun JsArray_get_Int(array: WasmExternRef, index: Int): Int = implementedAsIntrinsic - -@WasmImport("runtime", "JsArray_set") -internal fun JsArray_set_Int(array: WasmExternRef, index: Int, value: Int): Unit = implementedAsIntrinsic - -@WasmImport("runtime", "JsArray_get") -internal fun JsArray_get_Long(array: WasmExternRef, index: Int): Long = implementedAsIntrinsic - -@WasmImport("runtime", "JsArray_set") -internal fun JsArray_set_Long(array: WasmExternRef, index: Int, value: Long): Unit = implementedAsIntrinsic - -@WasmImport("runtime", "JsArray_get") -internal fun JsArray_get_Float(array: WasmExternRef, index: Int): Float = implementedAsIntrinsic - -@WasmImport("runtime", "JsArray_set") -internal fun JsArray_set_Float(array: WasmExternRef, index: Int, value: Float): Unit = implementedAsIntrinsic - -@WasmImport("runtime", "JsArray_get") -internal fun JsArray_get_Double(array: WasmExternRef, index: Int): Double = implementedAsIntrinsic - -@WasmImport("runtime", "JsArray_set") -internal fun JsArray_set_Double(array: WasmExternRef, index: Int, value: Double): Unit = implementedAsIntrinsic - -@WasmImport("runtime", "JsArray_get") -internal fun JsArray_get_Boolean(array: WasmExternRef, index: Int): Boolean = implementedAsIntrinsic - -@WasmImport("runtime", "JsArray_set") -internal fun JsArray_set_Boolean(array: WasmExternRef, index: Int, value: Boolean): Unit = implementedAsIntrinsic - -@WasmImport("runtime", "JsArray_get") -internal fun JsArray_get_WasmExternRef(array: WasmExternRef, index: Int): WasmExternRef = implementedAsIntrinsic - -@WasmImport("runtime", "JsArray_set") -internal fun JsArray_set_WasmExternRef(array: WasmExternRef, index: Int, value: WasmExternRef): Unit = implementedAsIntrinsic - -@WasmImport("runtime", "JsArray_getSize") -internal fun JsArray_getSize(array: WasmExternRef): Int = - implementedAsIntrinsic - -@JsFun("(x) => x") -internal fun Any?.toWasmExternRef(): WasmExternRef = - implementedAsIntrinsic - -@JsFun("(x) => x") -internal fun WasmExternRefToAny(ref: WasmExternRef): Any? = - implementedAsIntrinsic - -internal inline fun JsArray_fill_Byte(array: WasmExternRef, size: Int, init: (Int) -> Byte) { - var i = 0 - while (i < size) { - JsArray_set_Byte(array, i, init(i)) - i++ - } -} - -internal inline fun JsArray_fill_Char(array: WasmExternRef, size: Int, init: (Int) -> Char) { - var i = 0 - while (i < size) { - JsArray_set_Char(array, i, init(i)) - i++ - } -} - -internal inline fun JsArray_fill_Short(array: WasmExternRef, size: Int, init: (Int) -> Short) { - var i = 0 - while (i < size) { - JsArray_set_Short(array, i, init(i)) - i++ - } -} - -internal inline fun JsArray_fill_Int(array: WasmExternRef, size: Int, init: (Int) -> Int) { - var i = 0 - while (i < size) { - JsArray_set_Int(array, i, init(i)) - i++ - } -} - -internal inline fun JsArray_fill_Long(array: WasmExternRef, size: Int, init: (Int) -> Long) { - var i = 0 - while (i < size) { - JsArray_set_Long(array, i, init(i)) - i++ - } -} - -internal inline fun JsArray_fill_Float(array: WasmExternRef, size: Int, init: (Int) -> Float) { - var i = 0 - while (i < size) { - JsArray_set_Float(array, i, init(i)) - i++ - } -} - -internal inline fun JsArray_fill_Double(array: WasmExternRef, size: Int, init: (Int) -> Double) { - var i = 0 - while (i < size) { - JsArray_set_Double(array, i, init(i)) - i++ - } -} - -internal inline fun JsArray_fill_Boolean(array: WasmExternRef, size: Int, init: (Int) -> Boolean) { - var i = 0 - while (i < size) { - JsArray_set_Boolean(array, i, init(i)) - i++ - } -} - -internal inline fun JsArray_fill_T(array: WasmExternRef, size: Int, init: (Int) -> T) { - var i = 0 - while (i < size) { - JsArray_set_WasmExternRef(array, i, init(i).toWasmExternRef()) - i++ - } -} \ No newline at end of file diff --git a/libraries/stdlib/wasm/internal/kotlin/wasm/internal/WasmAnnotations.kt b/libraries/stdlib/wasm/internal/kotlin/wasm/internal/WasmAnnotations.kt index 24f44c8057e..1b03001c9ef 100644 --- a/libraries/stdlib/wasm/internal/kotlin/wasm/internal/WasmAnnotations.kt +++ b/libraries/stdlib/wasm/internal/kotlin/wasm/internal/WasmAnnotations.kt @@ -6,6 +6,7 @@ package kotlin.wasm.internal import kotlin.annotation.AnnotationTarget.* +import kotlin.reflect.KClass // Exclude declaration or file from lowering and code generation @Target(FILE, CLASS, FUNCTION, CONSTRUCTOR, PROPERTY) @@ -20,6 +21,13 @@ internal annotation class WasmImport(val module: String, val name: String) @Retention(AnnotationRetention.BINARY) internal annotation class WasmForeign +@Target(CLASS) +@Retention(AnnotationRetention.BINARY) +internal annotation class WasmArrayOf( + val type: KClass<*>, + val isNullable: Boolean, +) + @Target(AnnotationTarget.FUNCTION) @Retention(AnnotationRetention.BINARY) internal annotation class WasmReinterpret diff --git a/libraries/stdlib/wasm/src/generated/_WasmArrays.kt b/libraries/stdlib/wasm/src/generated/_WasmArrays.kt new file mode 100644 index 00000000000..ec59a1e957f --- /dev/null +++ b/libraries/stdlib/wasm/src/generated/_WasmArrays.kt @@ -0,0 +1,196 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package kotlin.wasm.internal + +// +// NOTE: THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt +// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib +// + +@WasmArrayOf(Any::class, isNullable = true) +internal class WasmAnyArray(size: Int) { + @WasmOp(WasmOp.ARRAY_GET) + fun get(index: Int): Any? = + implementedAsIntrinsic + + @WasmOp(WasmOp.ARRAY_SET) + fun set(index: Int, value: Any?): Unit = + implementedAsIntrinsic + + @WasmOp(WasmOp.ARRAY_LEN) + fun len(): Int = + implementedAsIntrinsic +} + +internal inline fun WasmAnyArray.fill(size: Int, init: (Int) -> Any?) { + var i = 0 + while (i < size) { + set(i, init(i)) + i++ + } +} + +@WasmArrayOf(Boolean::class, isNullable = false) +internal class WasmBooleanArray(size: Int) { + @WasmOp(WasmOp.ARRAY_GET) + fun get(index: Int): Boolean = + implementedAsIntrinsic + + @WasmOp(WasmOp.ARRAY_SET) + fun set(index: Int, value: Boolean): Unit = + implementedAsIntrinsic + + @WasmOp(WasmOp.ARRAY_LEN) + fun len(): Int = + implementedAsIntrinsic +} + +internal inline fun WasmBooleanArray.fill(size: Int, init: (Int) -> Boolean) { + var i = 0 + while (i < size) { + set(i, init(i)) + i++ + } +} + +@WasmArrayOf(Byte::class, isNullable = false) +internal class WasmByteArray(size: Int) { + @WasmOp(WasmOp.ARRAY_GET) + fun get(index: Int): Byte = + implementedAsIntrinsic + + @WasmOp(WasmOp.ARRAY_SET) + fun set(index: Int, value: Byte): Unit = + implementedAsIntrinsic + + @WasmOp(WasmOp.ARRAY_LEN) + fun len(): Int = + implementedAsIntrinsic +} + +internal inline fun WasmByteArray.fill(size: Int, init: (Int) -> Byte) { + var i = 0 + while (i < size) { + set(i, init(i)) + i++ + } +} + +@WasmArrayOf(Short::class, isNullable = false) +internal class WasmShortArray(size: Int) { + @WasmOp(WasmOp.ARRAY_GET) + fun get(index: Int): Short = + implementedAsIntrinsic + + @WasmOp(WasmOp.ARRAY_SET) + fun set(index: Int, value: Short): Unit = + implementedAsIntrinsic + + @WasmOp(WasmOp.ARRAY_LEN) + fun len(): Int = + implementedAsIntrinsic +} + +internal inline fun WasmShortArray.fill(size: Int, init: (Int) -> Short) { + var i = 0 + while (i < size) { + set(i, init(i)) + i++ + } +} + +@WasmArrayOf(Int::class, isNullable = false) +internal class WasmIntArray(size: Int) { + @WasmOp(WasmOp.ARRAY_GET) + fun get(index: Int): Int = + implementedAsIntrinsic + + @WasmOp(WasmOp.ARRAY_SET) + fun set(index: Int, value: Int): Unit = + implementedAsIntrinsic + + @WasmOp(WasmOp.ARRAY_LEN) + fun len(): Int = + implementedAsIntrinsic +} + +internal inline fun WasmIntArray.fill(size: Int, init: (Int) -> Int) { + var i = 0 + while (i < size) { + set(i, init(i)) + i++ + } +} + +@WasmArrayOf(Long::class, isNullable = false) +internal class WasmLongArray(size: Int) { + @WasmOp(WasmOp.ARRAY_GET) + fun get(index: Int): Long = + implementedAsIntrinsic + + @WasmOp(WasmOp.ARRAY_SET) + fun set(index: Int, value: Long): Unit = + implementedAsIntrinsic + + @WasmOp(WasmOp.ARRAY_LEN) + fun len(): Int = + implementedAsIntrinsic +} + +internal inline fun WasmLongArray.fill(size: Int, init: (Int) -> Long) { + var i = 0 + while (i < size) { + set(i, init(i)) + i++ + } +} + +@WasmArrayOf(Float::class, isNullable = false) +internal class WasmFloatArray(size: Int) { + @WasmOp(WasmOp.ARRAY_GET) + fun get(index: Int): Float = + implementedAsIntrinsic + + @WasmOp(WasmOp.ARRAY_SET) + fun set(index: Int, value: Float): Unit = + implementedAsIntrinsic + + @WasmOp(WasmOp.ARRAY_LEN) + fun len(): Int = + implementedAsIntrinsic +} + +internal inline fun WasmFloatArray.fill(size: Int, init: (Int) -> Float) { + var i = 0 + while (i < size) { + set(i, init(i)) + i++ + } +} + +@WasmArrayOf(Double::class, isNullable = false) +internal class WasmDoubleArray(size: Int) { + @WasmOp(WasmOp.ARRAY_GET) + fun get(index: Int): Double = + implementedAsIntrinsic + + @WasmOp(WasmOp.ARRAY_SET) + fun set(index: Int, value: Double): Unit = + implementedAsIntrinsic + + @WasmOp(WasmOp.ARRAY_LEN) + fun len(): Int = + implementedAsIntrinsic +} + +internal inline fun WasmDoubleArray.fill(size: Int, init: (Int) -> Double) { + var i = 0 + while (i < size) { + set(i, init(i)) + i++ + } +} + diff --git a/libraries/tools/kotlin-stdlib-gen/src/generators/GenerateStandardLib.kt b/libraries/tools/kotlin-stdlib-gen/src/generators/GenerateStandardLib.kt index c9c548e922c..9d84e3552b5 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/generators/GenerateStandardLib.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/generators/GenerateStandardLib.kt @@ -72,7 +72,7 @@ fun main(args: Array) { targetDir.resolve("_${source.name.capitalize()}$platformSuffix.kt") } - targetBaseDirs[KotlinTarget.WASM]?.let { generateWasmOps(it) } + targetBaseDirs[KotlinTarget.WASM]?.let { generateWasmBuiltIns(it) } } fun File.resolveExistingDir(subpath: String) = resolve(subpath).also { it.requireExistingDir() } diff --git a/libraries/tools/kotlin-stdlib-gen/src/generators/GenerateWasmOps.kt b/libraries/tools/kotlin-stdlib-gen/src/generators/GenerateWasmOps.kt index f55c535982c..350f73fa400 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/generators/GenerateWasmOps.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/generators/GenerateWasmOps.kt @@ -8,16 +8,27 @@ package generators import org.jetbrains.kotlin.wasm.ir.WasmOp import templates.COMMON_AUTOGENERATED_WARNING import templates.COPYRIGHT_NOTICE +import templates.PrimitiveType import java.io.File import java.io.FileWriter + +fun generateWasmBuiltIns(targetDir: File) { + generateWasmOps(targetDir) + generateWasmArrays(targetDir) +} + +fun FileWriter.generateStandardWasmInternalHeader() { + appendLine(COPYRIGHT_NOTICE) + appendLine("package kotlin.wasm.internal") + appendLine() + appendLine(COMMON_AUTOGENERATED_WARNING) + appendLine() +} + fun generateWasmOps(targetDir: File) { FileWriter(targetDir.resolve("_WasmOp.kt")).use { writer -> - writer.appendLine(COPYRIGHT_NOTICE) - writer.appendLine("package kotlin.wasm.internal") - writer.appendLine() - writer.appendLine(COMMON_AUTOGENERATED_WARNING) - writer.appendLine() + writer.generateStandardWasmInternalHeader() writer.appendLine( """ @ExcludedFromCodegen @@ -38,4 +49,46 @@ fun generateWasmOps(targetDir: File) { """.trimIndent() ) } +} + +fun generateWasmArrays(targetDir: File) { + FileWriter(targetDir.resolve("_WasmArrays.kt")).use { writer -> + writer.generateStandardWasmInternalHeader() + + writer.appendLine(wasmArrayForType("Any", true)) + writer.appendLine(wasmArrayForType("Boolean", false)) + PrimitiveType.numericPrimitives.sortedBy { it.capacity }.forEach { primitive -> + writer.appendLine(wasmArrayForType(primitive.name, false)) + } + } +} + +fun wasmArrayForType(klass: String, isNullable: Boolean): String { + val type = klass + if (isNullable) "?" else "" + val name = "Wasm${klass}Array" + return """ + @WasmArrayOf($klass::class, isNullable = $isNullable) + internal class $name(size: Int) { + @WasmOp(WasmOp.ARRAY_GET) + fun get(index: Int): $type = + implementedAsIntrinsic + + @WasmOp(WasmOp.ARRAY_SET) + fun set(index: Int, value: $type): Unit = + implementedAsIntrinsic + + @WasmOp(WasmOp.ARRAY_LEN) + fun len(): Int = + implementedAsIntrinsic + } + + internal inline fun $name.fill(size: Int, init: (Int) -> $type) { + var i = 0 + while (i < size) { + set(i, init(i)) + i++ + } + } + + """.trimIndent() } \ No newline at end of file diff --git a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/Declarations.kt b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/Declarations.kt index fa076105238..83e48b3dc39 100644 --- a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/Declarations.kt +++ b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/Declarations.kt @@ -145,6 +145,11 @@ class WasmStructDeclaration( val fields: List ) : WasmTypeDeclaration(name) +class WasmArrayDeclaration( + name: String, + val field: WasmStructFieldDeclaration +) : WasmTypeDeclaration(name) + class WasmStructFieldDeclaration( val name: String, val type: WasmType, diff --git a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmIrToBinary.kt b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmIrToBinary.kt index 7aff5c8e626..0ed326c03fb 100644 --- a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmIrToBinary.kt +++ b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmIrToBinary.kt @@ -26,7 +26,7 @@ class WasmIrToBinary(outputStream: OutputStream, val module: WasmModule) { gcTypes.forEach { when (it) { is WasmStructDeclaration -> appendStructTypeDeclaration(it) - else -> TODO("Support arrays") + is WasmArrayDeclaration -> appendArrayTypeDeclaration(it) } } } @@ -197,15 +197,24 @@ class WasmIrToBinary(outputStream: OutputStream, val module: WasmModule) { } } + private fun appendFiledType(field: WasmStructFieldDeclaration) { + appendType(field.type) + b.writeVarUInt1(field.isMutable) + } + private fun appendStructTypeDeclaration(type: WasmStructDeclaration) { b.writeVarInt7(-0x21) b.writeVarUInt32(type.fields.size) type.fields.forEach { - appendType(it.type) - b.writeVarUInt1(it.isMutable) + appendFiledType(it) } } + private fun appendArrayTypeDeclaration(type: WasmArrayDeclaration) { + b.writeVarInt7(-0x22) + appendFiledType(type.field) + } + val WasmFunctionType.index: Int get() = module.functionTypes.indexOf(this) diff --git a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmIrToText.kt b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmIrToText.kt index a023490d499..dfcdf07ac43 100644 --- a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmIrToText.kt +++ b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmIrToText.kt @@ -201,8 +201,9 @@ class WasmIrToText : SExpressionBuilder() { when (it) { is WasmStructDeclaration -> appendStructTypeDeclaration(it) - else -> - TODO("Support arrays") + is WasmArrayDeclaration -> + appendArrayTypeDeclaration(it) + else -> error("Unexpected GC type: $it") } } importsInOrder.forEach { @@ -253,6 +254,16 @@ class WasmIrToText : SExpressionBuilder() { } } + private fun appendArrayTypeDeclaration(type: WasmArrayDeclaration) { + newLineList("type") { + appendModuleFieldReference(type) + sameLineList("array") { + appendStructField(type.field) + } + } + } + + private fun appendImportedFunction(function: WasmFunction.Imported) { newLineList("func") { appendModuleFieldReference(function) From ff52a3f867f6cb92a1ea203ebe5ef4f1cf924007 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Wed, 9 Dec 2020 12:26:01 +0300 Subject: [PATCH 502/698] [Gradle, JS] Null library and libraryTarget when they are null ^KT-43842 fixed --- .../kotlin/gradle/targets/js/webpack/KotlinWebpackConfig.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/webpack/KotlinWebpackConfig.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/webpack/KotlinWebpackConfig.kt index 48c41520c7e..65bdbd79be9 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/webpack/KotlinWebpackConfig.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/webpack/KotlinWebpackConfig.kt @@ -302,8 +302,8 @@ data class KotlinWebpackConfig( ? ${outputFileName!!.jsQuoted()} : ${multiEntryOutput.jsQuoted()}; }, - library: "${output!!.library}", - libraryTarget: "${output!!.libraryTarget}", + ${output!!.library?.let { "library: ${it.jsQuoted()}," } ?: ""} + ${output!!.libraryTarget?.let { "libraryTarget: ${it.jsQuoted()}," } ?: ""} globalObject: "${output!!.globalObject}" }; From 430da22b4b22075a062234a9f6b6f02b4376a42e Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Tue, 24 Nov 2020 10:42:09 +0300 Subject: [PATCH 503/698] Setup 15_PREVIEW LanguageLevel for Java sources in CLI It's necessary to read preview-features related Java PSI parts It should be OK to set it unconditionally because we don't compile Java sources, only obtain declaration structure from them --- .../kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt index 1624b9df21b..b898e84423d 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt @@ -33,11 +33,13 @@ import com.intellij.openapi.extensions.Extensions import com.intellij.openapi.extensions.ExtensionsArea import com.intellij.openapi.fileTypes.PlainTextFileType import com.intellij.openapi.project.Project +import com.intellij.openapi.roots.LanguageLevelProjectExtension import com.intellij.openapi.util.Disposer import com.intellij.openapi.util.io.FileUtilRt import com.intellij.openapi.util.text.StringUtil import com.intellij.openapi.vfs.* import com.intellij.openapi.vfs.impl.ZipHandler +import com.intellij.pom.java.LanguageLevel import com.intellij.psi.PsiElementFinder import com.intellij.psi.PsiManager import com.intellij.psi.compiled.ClassFileDecompilers @@ -250,6 +252,8 @@ class KotlinCoreEnvironment private constructor( project.putUserData(APPEND_JAVA_SOURCE_ROOTS_HANDLER_KEY, fun(roots: List) { updateClasspath(roots.map { JavaSourceRoot(it, null) }) }) + + LanguageLevelProjectExtension.getInstance(project).languageLevel = LanguageLevel.JDK_15_PREVIEW } private fun collectAdditionalSources(project: MockProject) { From f25b7672a79036cb18c188151e2d2be717d99d6a Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Tue, 24 Nov 2020 10:54:41 +0300 Subject: [PATCH 504/698] Introduce FULL_JDK_15 TestJdkKind --- .../org/jetbrains/kotlin/test/KotlinTestUtils.java | 14 +++++++++++++- .../org/jetbrains/kotlin/test/TestJdkKind.java | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java index b96758d6632..81a13679807 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java @@ -365,6 +365,9 @@ public class KotlinTestUtils { else if (jdkKind == TestJdkKind.FULL_JDK_9) { configuration.put(JVMConfigurationKeys.JDK_HOME, getJdk9Home()); } + else if (jdkKind == TestJdkKind.FULL_JDK_15) { + configuration.put(JVMConfigurationKeys.JDK_HOME, getJdk15Home()); + } else if (SystemInfo.IS_AT_LEAST_JAVA9) { configuration.put(JVMConfigurationKeys.JDK_HOME, new File(System.getProperty("java.home"))); } @@ -408,6 +411,15 @@ public class KotlinTestUtils { return new File(jdk11); } + @NotNull + public static File getJdk15Home() { + String jdk15 = System.getenv("JDK_15"); + if (jdk15 == null) { + throw new AssertionError("Environment variable JDK_15 is not set!"); + } + return new File(jdk15); + } + public static void resolveAllKotlinFiles(KotlinCoreEnvironment environment) throws IOException { List roots = ContentRootsKt.getKotlinSourceRoots(environment.getConfiguration()); if (roots.isEmpty()) return; @@ -669,7 +681,7 @@ public class KotlinTestUtils { public static boolean compileJavaFilesExternallyWithJava9(@NotNull Collection files, @NotNull List options) { List command = new ArrayList<>(); - command.add(new File(getJdk9Home(), "bin/javac").getPath()); + command.add(new File(jdkHome, "bin/javac").getPath()); command.addAll(options); for (File file : files) { command.add(file.getPath()); diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestJdkKind.java b/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestJdkKind.java index 35d3e901642..fa450d20f1c 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestJdkKind.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestJdkKind.java @@ -26,6 +26,8 @@ public enum TestJdkKind { FULL_JDK_6, // JDK found at $JDK_19 FULL_JDK_9, + // JDK found at $JDK_15 + FULL_JDK_15, // JDK found at java.home FULL_JDK, ANDROID_API, From 513f7177ca4cabd0acfcc29ced8c4a3c0105b6bd Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Mon, 23 Nov 2020 16:02:26 +0300 Subject: [PATCH 505/698] Support loading Java records ^KT-43677 In Progress --- .../java/components/LazyResolveBasedCache.kt | 7 +- .../sam/SamAdapterFunctionDescriptor.java | 2 +- .../SignaturesPropagationData.java | 3 +- .../synthetic/JavaSyntheticPropertiesScope.kt | 102 +++++++++++++----- .../javac/components/StubJavaResolverCache.kt | 6 +- .../javac/resolve/KotlinClassifiersCache.kt | 3 + .../wrappers/symbols/FakeSymbolBasedClass.kt | 3 + .../wrappers/symbols/SymbolBasedClass.kt | 6 ++ .../javac/wrappers/trees/TreeBasedClass.kt | 7 ++ .../load/java/structure/impl/JavaClassImpl.kt | 10 ++ .../JavaElementCollectionFromPsiArrayUtil.kt | 4 +- .../structure/impl/JavaRecordComponentImpl.kt | 18 ++++ .../impl/classFiles/BinaryJavaClass.kt | 15 +++ .../java/structure/impl/classFiles/Other.kt | 16 +++ .../testsWithJava15/simpleRecords.kt | 16 +++ .../testsWithJava15/simpleRecords.txt | 12 +++ .../loadJava15/GenericRecord.compiled.psi.txt | 11 ++ .../loadJava15/GenericRecord.compiled.txt | 11 ++ .../testData/loadJava15/GenericRecord.java | 6 ++ .../testData/loadJava15/GenericRecord.txt | 9 ++ .../loadJava15/SimpleRecord.compiled.psi.txt | 11 ++ .../loadJava15/SimpleRecord.compiled.txt | 11 ++ .../testData/loadJava15/SimpleRecord.java | 6 ++ compiler/testData/loadJava15/SimpleRecord.txt | 9 ++ .../AbstractDiagnosticsWithJdk15Test.kt | 25 +++++ .../jvm/compiler/AbstractLoadJava15Test.kt | 18 ++++ ...stractLoadJava15WithPsiClassReadingTest.kt | 16 +++ .../jvm/compiler/AbstractLoadJavaTest.java | 26 ++++- .../jvm/compiler/LoadDescriptorUtil.java | 16 ++- .../kotlin/test/KotlinTestUtils.java | 4 + .../util/RecursiveDescriptorComparator.java | 21 +++- .../DiagnosticsWithJdk15TestGenerated.java | 35 ++++++ .../generators/tests/GenerateCompilerTests.kt | 13 +++ .../jvm/compiler/LoadJava15TestGenerated.java | 66 ++++++++++++ ...ava15WithPsiClassReadingTestGenerated.java | 40 +++++++ .../load/java/structure/javaElements.kt | 7 ++ .../java/components/JavaResolverCache.java | 10 +- .../java/descriptors/JavaClassDescriptor.java | 1 + .../descriptors/JavaMethodDescriptor.java | 17 ++- .../lazy/descriptors/DeclaredMemberIndex.kt | 10 ++ .../descriptors/LazyJavaClassDescriptor.kt | 2 + .../descriptors/LazyJavaClassMemberScope.kt | 99 ++++++++++++++++- .../java/lazy/descriptors/LazyJavaScope.kt | 9 +- .../runtime/structure/ReflectJavaClass.kt | 8 ++ .../AbstractJvmRuntimeDescriptorLoaderTest.kt | 2 +- 45 files changed, 688 insertions(+), 61 deletions(-) create mode 100644 compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaRecordComponentImpl.kt create mode 100644 compiler/testData/diagnostics/testsWithJava15/simpleRecords.kt create mode 100644 compiler/testData/diagnostics/testsWithJava15/simpleRecords.txt create mode 100644 compiler/testData/loadJava15/GenericRecord.compiled.psi.txt create mode 100644 compiler/testData/loadJava15/GenericRecord.compiled.txt create mode 100644 compiler/testData/loadJava15/GenericRecord.java create mode 100644 compiler/testData/loadJava15/GenericRecord.txt create mode 100644 compiler/testData/loadJava15/SimpleRecord.compiled.psi.txt create mode 100644 compiler/testData/loadJava15/SimpleRecord.compiled.txt create mode 100644 compiler/testData/loadJava15/SimpleRecord.java create mode 100644 compiler/testData/loadJava15/SimpleRecord.txt create mode 100644 compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsWithJdk15Test.kt create mode 100644 compiler/tests-common/tests/org/jetbrains/kotlin/jvm/compiler/AbstractLoadJava15Test.kt create mode 100644 compiler/tests-common/tests/org/jetbrains/kotlin/jvm/compiler/AbstractLoadJava15WithPsiClassReadingTest.kt create mode 100644 compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java create mode 100644 compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJava15TestGenerated.java create mode 100644 compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJava15WithPsiClassReadingTestGenerated.java diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/components/LazyResolveBasedCache.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/components/LazyResolveBasedCache.kt index 5c451f766a2..4ba81f70b46 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/components/LazyResolveBasedCache.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/components/LazyResolveBasedCache.kt @@ -23,19 +23,18 @@ import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor import org.jetbrains.kotlin.load.java.structure.JavaClass import org.jetbrains.kotlin.load.java.structure.JavaElement import org.jetbrains.kotlin.load.java.structure.JavaField -import org.jetbrains.kotlin.load.java.structure.JavaMethod +import org.jetbrains.kotlin.load.java.structure.JavaMember import org.jetbrains.kotlin.load.java.structure.impl.JavaClassImpl import org.jetbrains.kotlin.load.java.structure.impl.JavaElementImpl import org.jetbrains.kotlin.load.java.structure.impl.JavaFieldImpl -import org.jetbrains.kotlin.load.java.structure.impl.JavaMethodImpl import org.jetbrains.kotlin.resolve.BindingContext.* import org.jetbrains.kotlin.resolve.BindingContextUtils import org.jetbrains.kotlin.resolve.lazy.ResolveSession class LazyResolveBasedCache(resolveSession: ResolveSession) : AbstractJavaResolverCache(resolveSession) { - override fun recordMethod(method: JavaMethod, descriptor: SimpleFunctionDescriptor) { - BindingContextUtils.recordFunctionDeclarationToDescriptor(trace, (method as? JavaMethodImpl)?.psi ?: return, descriptor) + override fun recordMethod(member: JavaMember, descriptor: SimpleFunctionDescriptor) { + BindingContextUtils.recordFunctionDeclarationToDescriptor(trace, (member as? JavaElementImpl<*>)?.psi ?: return, descriptor) } override fun recordConstructor(element: JavaElement, descriptor: ConstructorDescriptor) { diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/sam/SamAdapterFunctionDescriptor.java b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/sam/SamAdapterFunctionDescriptor.java index ab67df6b4af..d53a2d8ded8 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/sam/SamAdapterFunctionDescriptor.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/sam/SamAdapterFunctionDescriptor.java @@ -39,7 +39,7 @@ import org.jetbrains.kotlin.name.Name; @NotNull Kind kind, @NotNull JavaMethodDescriptor declaration ) { - super(containingDeclaration, original, declaration.getAnnotations(), declaration.getName(), kind, declaration.getSource()); + super(containingDeclaration, original, declaration.getAnnotations(), declaration.getName(), kind, declaration.getSource(), false); this.declaration = declaration; setParameterNamesStatus(declaration.hasStableParameterNames(), declaration.hasSynthesizedParameterNames()); } diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/kotlinSignature/SignaturesPropagationData.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/kotlinSignature/SignaturesPropagationData.java index f7384b77a96..bb1f88ff226 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/kotlinSignature/SignaturesPropagationData.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/kotlinSignature/SignaturesPropagationData.java @@ -88,7 +88,8 @@ public class SignaturesPropagationData { Annotations.Companion.getEMPTY(), method.getName(), //TODO: what to do? - SourceElement.NO_SOURCE + SourceElement.NO_SOURCE, + false ); autoMethodDescriptor.initialize( null, diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticPropertiesScope.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticPropertiesScope.kt index fe9441cbfe0..972a38d8f01 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticPropertiesScope.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticPropertiesScope.kt @@ -27,6 +27,8 @@ import org.jetbrains.kotlin.incremental.components.LookupTracker import org.jetbrains.kotlin.incremental.components.NoLookupLocation import org.jetbrains.kotlin.incremental.record import org.jetbrains.kotlin.load.java.JvmAbi +import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor +import org.jetbrains.kotlin.load.java.descriptors.JavaMethodDescriptor import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.DescriptorFactory import org.jetbrains.kotlin.resolve.DescriptorUtils @@ -113,20 +115,37 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager, private val l } private fun syntheticPropertyInClassNotCached(ownerClass: ClassDescriptor, name: Name): SyntheticPropertyHolder { + val forBean = syntheticPropertyHolderForBeanConvention(name, ownerClass) + if (forBean.descriptor != null) return forBean - fun result(descriptor: PropertyDescriptor?, getterNames: List, setterName: Name? = null): SyntheticPropertyHolder { - if (lookupTracker === LookupTracker.DO_NOTHING) { - return if (descriptor == null) SyntheticPropertyHolder.EMPTY else SyntheticPropertyHolder(descriptor, emptyList()) - } + if (!ownerClass.isRecord()) return forBean - val names = ArrayList(getterNames.size + (setterName?.let { 1 } ?: 0)) + val propertyForComponent = syntheticPropertyDescriptorForRecordComponent(name, ownerClass) - names.addAll(getterNames) - names.addIfNotNull(setterName) + return createSyntheticPropertyHolder(propertyForComponent, forBean.lookedNames, name) + } - return SyntheticPropertyHolder(descriptor, names) + private fun createSyntheticPropertyHolder( + descriptor: PropertyDescriptor?, + lookedNames: List, + additionalName: Name? = null + ): SyntheticPropertyHolder { + if (lookupTracker === LookupTracker.DO_NOTHING) { + return if (descriptor == null) SyntheticPropertyHolder.EMPTY else SyntheticPropertyHolder(descriptor, emptyList()) } + val names = ArrayList(lookedNames.size + (additionalName?.let { 1 } ?: 0)) + + names.addAll(lookedNames) + names.addIfNotNull(additionalName) + + return SyntheticPropertyHolder(descriptor, names) + } + + private fun syntheticPropertyHolderForBeanConvention( + name: Name, + ownerClass: ClassDescriptor + ): SyntheticPropertyHolder { if (name.isSpecial) return SyntheticPropertyHolder.EMPTY val identifier = name.identifier @@ -142,7 +161,7 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager, private val l .flatMap { memberScope.getContributedFunctions(it, NoLookupLocation.FROM_SYNTHETIC_SCOPE) } .singleOrNull { it.hasJavaOriginInHierarchy() && isGoodGetMethod(it) - } ?: return result(null, possibleGetMethodNames) + } ?: return createSyntheticPropertyHolder(null, possibleGetMethodNames) val setMethodName = setMethodName(getMethod.name) @@ -152,7 +171,25 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager, private val l val propertyType = getMethod.returnType!! val descriptor = MyPropertyDescriptor.create(ownerClass, getMethod.original, setMethod?.original, name, propertyType) - return result(descriptor, possibleGetMethodNames, setMethodName) + return createSyntheticPropertyHolder(descriptor, possibleGetMethodNames, setMethodName) + } + + private fun syntheticPropertyDescriptorForRecordComponent( + name: Name, + ownerClass: ClassDescriptor + ): PropertyDescriptor? { + val componentLikeMethod = + ownerClass.unsubstitutedMemberScope + .getContributedFunctions(name, NoLookupLocation.FROM_SYNTHETIC_SCOPE) + .singleOrNull(this::isGoodGetMethod) ?: return null + + if (componentLikeMethod !is JavaMethodDescriptor || !componentLikeMethod.isForRecordComponent) { + return null + } + + val propertyType = componentLikeMethod.returnType!! + + return MyPropertyDescriptor.create(ownerClass, componentLikeMethod.original, null, name, propertyType) } private fun isGoodGetMethod(descriptor: FunctionDescriptor): Boolean { @@ -249,8 +286,14 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager, private val l if (classifier is ClassDescriptor) { for (descriptor in classifier.unsubstitutedMemberScope.getContributedDescriptors(DescriptorKindFilter.FUNCTIONS)) { if (descriptor is FunctionDescriptor) { - val propertyName = SyntheticJavaPropertyDescriptor.propertyNameByGetMethodName(descriptor.getName()) ?: continue - addIfNotNull(syntheticPropertyInClass(Pair(classifier, propertyName)).descriptor) + val propertyName = SyntheticJavaPropertyDescriptor.propertyNameByGetMethodName(descriptor.getName()) + if (propertyName != null) { + addIfNotNull(syntheticPropertyInClass(Pair(classifier, propertyName)).descriptor) + } + + if (classifier.isRecord()) { + addIfNotNull(syntheticPropertyInClass(Pair(classifier, descriptor.name)).descriptor) + } } } } else { @@ -258,6 +301,9 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager, private val l } } + private fun ClassifierDescriptor.isRecord() = + this is JavaClassDescriptor && isRecord + private fun SmartList?.add(property: PropertyDescriptor?): SmartList? { if (property == null) return this val list = if (this != null) this else SmartList() @@ -280,15 +326,15 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager, private val l } private class MyPropertyDescriptor( - containingDeclaration: DeclarationDescriptor, - original: PropertyDescriptor?, - annotations: Annotations, - modality: Modality, - visibility: DescriptorVisibility, - isVar: Boolean, - name: Name, - kind: CallableMemberDescriptor.Kind, - source: SourceElement + containingDeclaration: DeclarationDescriptor, + original: PropertyDescriptor?, + annotations: Annotations, + modality: Modality, + visibility: DescriptorVisibility, + isVar: Boolean, + name: Name, + kind: CallableMemberDescriptor.Kind, + source: SourceElement ) : SyntheticJavaPropertyDescriptor, PropertyDescriptorImpl( containingDeclaration, original, annotations, modality, visibility, isVar, name, kind, source, /* lateInit = */ false, /* isConst = */ false, /* isExpect = */ false, /* isActual = */ false, /* isExternal = */ false, @@ -374,13 +420,13 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager, private val l } override fun createSubstitutedCopy( - newOwner: DeclarationDescriptor, - newModality: Modality, - newVisibility: DescriptorVisibility, - original: PropertyDescriptor?, - kind: CallableMemberDescriptor.Kind, - newName: Name, - source: SourceElement + newOwner: DeclarationDescriptor, + newModality: Modality, + newVisibility: DescriptorVisibility, + original: PropertyDescriptor?, + kind: CallableMemberDescriptor.Kind, + newName: Name, + source: SourceElement ): PropertyDescriptorImpl { return MyPropertyDescriptor(newOwner, this, annotations, newModality, newVisibility, isVar, newName, kind, this.source).apply { getMethod = this@MyPropertyDescriptor.getMethod diff --git a/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/components/StubJavaResolverCache.kt b/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/components/StubJavaResolverCache.kt index 904d7dfa216..1af897ee210 100644 --- a/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/components/StubJavaResolverCache.kt +++ b/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/components/StubJavaResolverCache.kt @@ -24,12 +24,12 @@ import org.jetbrains.kotlin.load.java.components.AbstractJavaResolverCache import org.jetbrains.kotlin.load.java.structure.JavaClass import org.jetbrains.kotlin.load.java.structure.JavaElement import org.jetbrains.kotlin.load.java.structure.JavaField -import org.jetbrains.kotlin.load.java.structure.JavaMethod +import org.jetbrains.kotlin.load.java.structure.JavaMember import org.jetbrains.kotlin.resolve.lazy.ResolveSession class StubJavaResolverCache(resolveSession: ResolveSession) : AbstractJavaResolverCache(resolveSession) { - override fun recordMethod(method: JavaMethod, descriptor: SimpleFunctionDescriptor) {} + override fun recordMethod(member: JavaMember, descriptor: SimpleFunctionDescriptor) {} override fun recordConstructor(element: JavaElement, descriptor: ConstructorDescriptor) {} @@ -37,4 +37,4 @@ class StubJavaResolverCache(resolveSession: ResolveSession) : AbstractJavaResolv override fun recordClass(javaClass: JavaClass, descriptor: ClassDescriptor) {} -} \ No newline at end of file +} diff --git a/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/resolve/KotlinClassifiersCache.kt b/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/resolve/KotlinClassifiersCache.kt index 7703b7cddb7..dbf128ce3d6 100644 --- a/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/resolve/KotlinClassifiersCache.kt +++ b/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/resolve/KotlinClassifiersCache.kt @@ -157,9 +157,12 @@ class MockKotlinClassifier(override val classId: ClassId, override val isInterface get() = shouldNotBeCalled() override val isAnnotationType get() = shouldNotBeCalled() override val isEnum get() = shouldNotBeCalled() + override val isRecord get() = shouldNotBeCalled() override val methods get() = shouldNotBeCalled() override val fields get() = shouldNotBeCalled() override val constructors get() = shouldNotBeCalled() + override val recordComponents get() = shouldNotBeCalled() + override fun hasDefaultConstructor() = shouldNotBeCalled() override val annotations get() = shouldNotBeCalled() override val isDeprecatedInJavaDoc get() = shouldNotBeCalled() diff --git a/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/wrappers/symbols/FakeSymbolBasedClass.kt b/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/wrappers/symbols/FakeSymbolBasedClass.kt index 0a6ad55ad9e..a1c37ddff5b 100644 --- a/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/wrappers/symbols/FakeSymbolBasedClass.kt +++ b/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/wrappers/symbols/FakeSymbolBasedClass.kt @@ -65,6 +65,9 @@ class FakeSymbolBasedClass( override val isEnum: Boolean get() = false + override val isRecord: Boolean get() = false + + override val recordComponents: Collection get() = emptyList() override val lightClassOriginKind: LightClassOriginKind? get() = null override val methods: Collection get() = emptyList() diff --git a/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/wrappers/symbols/SymbolBasedClass.kt b/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/wrappers/symbols/SymbolBasedClass.kt index 2366edc88d9..e731f775ec9 100644 --- a/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/wrappers/symbols/SymbolBasedClass.kt +++ b/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/wrappers/symbols/SymbolBasedClass.kt @@ -133,6 +133,12 @@ class SymbolBasedClass( .filter { it.kind == ElementKind.CONSTRUCTOR } .map { SymbolBasedConstructor(it as ExecutableElement, this, javac) } + override val isRecord: Boolean + get() = false + + override val recordComponents: Collection + get() = emptyList() + override fun hasDefaultConstructor() = false // default constructors are explicit in symbols override val innerClassNames: Collection diff --git a/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/wrappers/trees/TreeBasedClass.kt b/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/wrappers/trees/TreeBasedClass.kt index 187811ccdab..686ba9f0201 100644 --- a/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/wrappers/trees/TreeBasedClass.kt +++ b/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/wrappers/trees/TreeBasedClass.kt @@ -114,6 +114,10 @@ class TreeBasedClass( override val isEnum: Boolean get() = tree.modifiers.flags and Flags.ENUM.toLong() != 0L + // TODO: Support + override val isRecord: Boolean + get() = false + override val lightClassOriginKind: LightClassOriginKind? get() = null @@ -134,6 +138,9 @@ class TreeBasedClass( TreeBasedConstructor(constructor as JCTree.JCMethodDecl, compilationUnit, this, javac) } + override val recordComponents: Collection + get() = emptyList() + override fun hasDefaultConstructor() = !isInterface && constructors.isEmpty() override val innerClassNames: Collection diff --git a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt index f5085cd1021..359e4e5a2dc 100644 --- a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt +++ b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt @@ -59,6 +59,9 @@ class JavaClassImpl(psiClass: PsiClass) : JavaClassifierImpl(psiClass) override val isEnum: Boolean get() = psi.isEnum + override val isRecord: Boolean + get() = psi.isRecord + override val outerClass: JavaClassImpl? get() { val outer = psi.containingClass @@ -100,6 +103,13 @@ class JavaClassImpl(psiClass: PsiClass) : JavaClassifierImpl(psiClass) return constructors(psi.constructors.filter { method -> method.isConstructor }) } + override val recordComponents: Collection + get() { + assertNotLightClass() + + return psi.recordComponents.convert(::JavaRecordComponentImpl) + } + override fun hasDefaultConstructor() = !isInterface && constructors.isEmpty() override val isAbstract: Boolean diff --git a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaElementCollectionFromPsiArrayUtil.kt b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaElementCollectionFromPsiArrayUtil.kt index e793e0e6a01..3889abe9d17 100644 --- a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaElementCollectionFromPsiArrayUtil.kt +++ b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaElementCollectionFromPsiArrayUtil.kt @@ -24,14 +24,14 @@ import org.jetbrains.kotlin.load.java.NULLABILITY_ANNOTATIONS import org.jetbrains.kotlin.load.java.structure.* import org.jetbrains.kotlin.name.Name -private inline fun Array.convert(factory: (Psi) -> Java): List = +inline fun Array.convert(factory: (Psi) -> Java): List = when (size) { 0 -> emptyList() 1 -> listOf(factory(first())) else -> map(factory) } -private fun Collection.convert(factory: (Psi) -> Java): List = +fun Collection.convert(factory: (Psi) -> Java): List = when (size) { 0 -> emptyList() 1 -> listOf(factory(first())) diff --git a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaRecordComponentImpl.kt b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaRecordComponentImpl.kt new file mode 100644 index 00000000000..09e353cb50a --- /dev/null +++ b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaRecordComponentImpl.kt @@ -0,0 +1,18 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.load.java.structure.impl + +import com.intellij.psi.PsiRecordComponent +import org.jetbrains.kotlin.load.java.structure.JavaRecordComponent +import org.jetbrains.kotlin.load.java.structure.JavaType + +class JavaRecordComponentImpl(psiRecordComponent: PsiRecordComponent) : JavaMemberImpl(psiRecordComponent), JavaRecordComponent { + override val type: JavaType + get() = JavaTypeImpl.create(psi.type) + + override val isVararg: Boolean + get() = psi.isVarArgs +} diff --git a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/BinaryJavaClass.kt b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/BinaryJavaClass.kt index dba70a0a5bc..73e75d17baa 100644 --- a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/BinaryJavaClass.kt +++ b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/BinaryJavaClass.kt @@ -47,6 +47,8 @@ class BinaryJavaClass( override val methods = arrayListOf() override val fields = arrayListOf() override val constructors = arrayListOf() + override val recordComponents = arrayListOf() + override fun hasDefaultConstructor() = false // never: all constructors explicit in bytecode override val annotationsByFqName by buildLazyValueForMap() @@ -63,6 +65,9 @@ class BinaryJavaClass( override val isInterface get() = isSet(Opcodes.ACC_INTERFACE) override val isAnnotationType get() = isSet(Opcodes.ACC_ANNOTATION) override val isEnum get() = isSet(Opcodes.ACC_ENUM) + + override val isRecord get() = isSet(Opcodes.ACC_RECORD) + override val lightClassOriginKind: LightClassOriginKind? get() = null override fun isFromSourceCodeInScope(scope: SearchScope): Boolean = false @@ -184,6 +189,16 @@ class BinaryJavaClass( } } + + override fun visitRecordComponent(name: String, descriptor: String, signature: String?): RecordComponentVisitor? { + val type = signatureParser.parseTypeString(StringCharacterIterator(signature ?: descriptor), context) + // TODO: Read isVararg properly + val isVararg = false + recordComponents.add(BinaryJavaRecordComponent(Name.identifier(name), this, type, isVararg)) + + return null + } + /** * All the int-like values (including Char/Boolean) come in visitor as Integer instances */ diff --git a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/Other.kt b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/Other.kt index 72fc2c3d979..9328dbcc8fa 100644 --- a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/Other.kt +++ b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/Other.kt @@ -64,6 +64,22 @@ class BinaryJavaValueParameter( } } +class BinaryJavaRecordComponent( + override val name: Name, + override val containingClass: JavaClass, + override val type: JavaType, + override val isVararg: Boolean, +) : JavaRecordComponent, BinaryJavaModifierListOwner { + override val annotations: Collection + get() = emptyList() + + override val access: Int + get() = 0 + + override val annotationsByFqName: Map + get() = emptyMap() +} + fun isNotTopLevelClass(classContent: ByteArray): Boolean { var isNotTopLevelClass = false ClassReader(classContent).accept( diff --git a/compiler/testData/diagnostics/testsWithJava15/simpleRecords.kt b/compiler/testData/diagnostics/testsWithJava15/simpleRecords.kt new file mode 100644 index 00000000000..0517df7484f --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJava15/simpleRecords.kt @@ -0,0 +1,16 @@ +// FILE: MyRecord.java +public record MyRecord(int x, CharSequence y) { + +} + +// FILE: main.kt + +fun foo(mr: MyRecord) { + MyRecord(1, "") + + mr.x() + mr.y() + + mr.x + mr.y +} diff --git a/compiler/testData/diagnostics/testsWithJava15/simpleRecords.txt b/compiler/testData/diagnostics/testsWithJava15/simpleRecords.txt new file mode 100644 index 00000000000..b7fd8e172d0 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJava15/simpleRecords.txt @@ -0,0 +1,12 @@ +package + +public fun foo(/*0*/ mr: MyRecord): kotlin.Unit + +/*record*/ public final class MyRecord : java.lang.Record { + public constructor MyRecord(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.CharSequence!) + public abstract override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public abstract override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun toString(): kotlin.String + /*record component*/ public open fun x(): kotlin.Int + /*record component*/ public open fun y(): kotlin.CharSequence! +} diff --git a/compiler/testData/loadJava15/GenericRecord.compiled.psi.txt b/compiler/testData/loadJava15/GenericRecord.compiled.psi.txt new file mode 100644 index 00000000000..f43c4c8da67 --- /dev/null +++ b/compiler/testData/loadJava15/GenericRecord.compiled.psi.txt @@ -0,0 +1,11 @@ +package test + +public final class GenericRecord : java.lang.Record { + public constructor GenericRecord(/*0*/ x: T!, /*1*/ y: E!) + private final val x: T! + private final val y: E! + public open fun x(): T! + public open fun y(): E! + public open fun y(/*0*/ p0: E!): E! + public open fun z(): kotlin.Double +} diff --git a/compiler/testData/loadJava15/GenericRecord.compiled.txt b/compiler/testData/loadJava15/GenericRecord.compiled.txt new file mode 100644 index 00000000000..8b9536b6638 --- /dev/null +++ b/compiler/testData/loadJava15/GenericRecord.compiled.txt @@ -0,0 +1,11 @@ +package test + +/*record*/ public final class GenericRecord : java.lang.Record { + public constructor GenericRecord(/*0*/ x: T!, /*1*/ y: E!) + private final val x: T! + private final val y: E! + /*record component*/ public open fun x(): T! + /*record component*/ public open fun y(): E! + public open fun y(/*0*/ p0: E!): E! + public open fun z(): kotlin.Double +} diff --git a/compiler/testData/loadJava15/GenericRecord.java b/compiler/testData/loadJava15/GenericRecord.java new file mode 100644 index 00000000000..cf0ab901911 --- /dev/null +++ b/compiler/testData/loadJava15/GenericRecord.java @@ -0,0 +1,6 @@ +package test; +public record GenericRecord(T x, E y) { + public E y() { return y; } + public E y(E n) { return y; } + public double z() { return 0.0; } +} diff --git a/compiler/testData/loadJava15/GenericRecord.txt b/compiler/testData/loadJava15/GenericRecord.txt new file mode 100644 index 00000000000..1d86e74f611 --- /dev/null +++ b/compiler/testData/loadJava15/GenericRecord.txt @@ -0,0 +1,9 @@ +package test + +/*record*/ public final class GenericRecord : java.lang.Record { + public constructor GenericRecord(/*0*/ x: T!, /*1*/ y: E!) + /*record component*/ public open fun x(): T! + /*record component*/ public open fun y(): E! + public open fun y(/*0*/ n: E!): E! + public open fun z(): kotlin.Double +} diff --git a/compiler/testData/loadJava15/SimpleRecord.compiled.psi.txt b/compiler/testData/loadJava15/SimpleRecord.compiled.psi.txt new file mode 100644 index 00000000000..39fe6007beb --- /dev/null +++ b/compiler/testData/loadJava15/SimpleRecord.compiled.psi.txt @@ -0,0 +1,11 @@ +package test + +public final class SimpleRecord : java.lang.Record { + public constructor SimpleRecord(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.CharSequence!) + private final val x: kotlin.Int + private final val y: kotlin.CharSequence! + public open fun x(): kotlin.Int + public open fun y(): kotlin.CharSequence! + public open fun y(/*0*/ p0: kotlin.Int): kotlin.CharSequence! + public open fun z(): kotlin.Double +} diff --git a/compiler/testData/loadJava15/SimpleRecord.compiled.txt b/compiler/testData/loadJava15/SimpleRecord.compiled.txt new file mode 100644 index 00000000000..2698f419842 --- /dev/null +++ b/compiler/testData/loadJava15/SimpleRecord.compiled.txt @@ -0,0 +1,11 @@ +package test + +/*record*/ public final class SimpleRecord : java.lang.Record { + public constructor SimpleRecord(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.CharSequence!) + private final val x: kotlin.Int + private final val y: kotlin.CharSequence! + /*record component*/ public open fun x(): kotlin.Int + /*record component*/ public open fun y(): kotlin.CharSequence! + public open fun y(/*0*/ p0: kotlin.Int): kotlin.CharSequence! + public open fun z(): kotlin.Double +} diff --git a/compiler/testData/loadJava15/SimpleRecord.java b/compiler/testData/loadJava15/SimpleRecord.java new file mode 100644 index 00000000000..163ae7619e3 --- /dev/null +++ b/compiler/testData/loadJava15/SimpleRecord.java @@ -0,0 +1,6 @@ +package test; +public record SimpleRecord(int x, CharSequence y) { + public CharSequence y() { return y; } + public CharSequence y(int n) { return y; } + public double z() { return 0.0; } +} diff --git a/compiler/testData/loadJava15/SimpleRecord.txt b/compiler/testData/loadJava15/SimpleRecord.txt new file mode 100644 index 00000000000..210be160dd4 --- /dev/null +++ b/compiler/testData/loadJava15/SimpleRecord.txt @@ -0,0 +1,9 @@ +package test + +/*record*/ public final class SimpleRecord : java.lang.Record { + public constructor SimpleRecord(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.CharSequence!) + /*record component*/ public open fun x(): kotlin.Int + /*record component*/ public open fun y(): kotlin.CharSequence! + public open fun y(/*0*/ n: kotlin.Int): kotlin.CharSequence! + public open fun z(): kotlin.Double +} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsWithJdk15Test.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsWithJdk15Test.kt new file mode 100644 index 00000000000..12c227f4d59 --- /dev/null +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsWithJdk15Test.kt @@ -0,0 +1,25 @@ +/* + * Copyright 2010-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jetbrains.kotlin.checkers + +import org.jetbrains.kotlin.test.TestJdkKind + +abstract class AbstractDiagnosticsWithJdk15Test : AbstractDiagnosticsTest() { + + override fun getTestJdkKind(files: List): TestJdkKind { + return TestJdkKind.FULL_JDK_15 + } +} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/jvm/compiler/AbstractLoadJava15Test.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/jvm/compiler/AbstractLoadJava15Test.kt new file mode 100644 index 00000000000..f55f166d6a4 --- /dev/null +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/jvm/compiler/AbstractLoadJava15Test.kt @@ -0,0 +1,18 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.jvm.compiler + +import org.jetbrains.kotlin.test.KotlinTestUtils +import org.jetbrains.kotlin.test.TestJdkKind +import java.io.File + +abstract class AbstractLoadJava15Test : AbstractLoadJavaTest() { + override fun getJdkKind(): TestJdkKind = TestJdkKind.FULL_JDK_15 + override fun getJdkHomeForJavac(): File = KotlinTestUtils.getJdk15Home() + override fun getAdditionalJavacArgs(): List = ADDITIONAL_JAVAC_ARGS_FOR_15 +} + +val ADDITIONAL_JAVAC_ARGS_FOR_15 = listOf("--release", "15", "--enable-preview") \ No newline at end of file diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/jvm/compiler/AbstractLoadJava15WithPsiClassReadingTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/jvm/compiler/AbstractLoadJava15WithPsiClassReadingTest.kt new file mode 100644 index 00000000000..65f174495d0 --- /dev/null +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/jvm/compiler/AbstractLoadJava15WithPsiClassReadingTest.kt @@ -0,0 +1,16 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.jvm.compiler + +import org.jetbrains.kotlin.test.KotlinTestUtils +import org.jetbrains.kotlin.test.TestJdkKind +import java.io.File + +abstract class AbstractLoadJava15WithPsiClassReadingTest : AbstractLoadJavaWithPsiClassReadingTest() { + override fun getJdkKind(): TestJdkKind = TestJdkKind.FULL_JDK_15 + override fun getJdkHomeForJavac(): File = KotlinTestUtils.getJdk15Home() + override fun getAdditionalJavacArgs(): List = ADDITIONAL_JAVAC_ARGS_FOR_15 +} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/jvm/compiler/AbstractLoadJavaTest.java b/compiler/tests-common/tests/org/jetbrains/kotlin/jvm/compiler/AbstractLoadJavaTest.java index 4f244b25362..8937b36687e 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/jvm/compiler/AbstractLoadJavaTest.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/jvm/compiler/AbstractLoadJavaTest.java @@ -9,6 +9,7 @@ import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.io.FileUtil; import junit.framework.ComparisonFailure; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.analyzer.AnalysisResult; import org.jetbrains.kotlin.checkers.CompilerTestLanguageVersionSettingsKt; import org.jetbrains.kotlin.cli.common.config.ContentRootsKt; @@ -299,7 +300,19 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir { Pair javaPackageAndContext = compileJavaAndLoadTestPackageAndBindingContextFromBinary( srcFiles, compiledDir, ConfigurationKind.ALL ); - checkJavaPackage(getExpectedFile(javaFileName.replaceFirst("\\.java$", ".txt")), javaPackageAndContext.first, javaPackageAndContext.second, configuration); + + + + checkJavaPackage(getExpectedFile( + useTxtSuffixIfFileExists(javaFileName.replaceFirst("\\.java$", ".txt"), "compiled") + ), javaPackageAndContext.first, javaPackageAndContext.second, configuration); + } + + public static String useTxtSuffixIfFileExists(String name, String suffix) { + File differentResultFile = KotlinTestUtils.replaceExtension(new File(name), suffix + ".txt"); + if (differentResultFile.exists()) return differentResultFile.getPath(); + + return name; } @NotNull @@ -308,12 +321,21 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir { @NotNull File outDir, @NotNull ConfigurationKind configurationKind ) throws IOException { - compileJavaWithAnnotationsJar(javaFiles, outDir); + compileJavaWithAnnotationsJar(javaFiles, outDir, getAdditionalJavacArgs(), getJdkHomeForJavac()); return loadTestPackageAndBindingContextFromJavaRoot(outDir, getTestRootDisposable(), getJdkKind(), configurationKind, true, usePsiClassFilesReading(), useJavacWrapper(), null, getExtraClasspath(), this::configureEnvironment); } + protected List getAdditionalJavacArgs() { + return Collections.emptyList(); + } + + @Nullable + protected File getJdkHomeForJavac() { + return null; + } + private static void checkJavaPackage( File txtFile, PackageViewDescriptor javaPackage, diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/jvm/compiler/LoadDescriptorUtil.java b/compiler/tests-common/tests/org/jetbrains/kotlin/jvm/compiler/LoadDescriptorUtil.java index e5291ecc78f..149e68e72ca 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/jvm/compiler/LoadDescriptorUtil.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/jvm/compiler/LoadDescriptorUtil.java @@ -142,7 +142,12 @@ public class LoadDescriptorUtil { return Pair.create(packageView, analysisResult.getBindingContext()); } - public static void compileJavaWithAnnotationsJar(@NotNull Collection javaFiles, @NotNull File outDir) throws IOException { + public static void compileJavaWithAnnotationsJar( + @NotNull Collection javaFiles, + @NotNull File outDir, + @NotNull List additionalArgs, + @Nullable File customJdkHomeForJavac + ) throws IOException { List args = new ArrayList<>(Arrays.asList( "-sourcepath", "compiler/testData/loadJava/include", "-d", outDir.getPath()) @@ -170,7 +175,14 @@ public class LoadDescriptorUtil { args.add("-classpath"); args.add(classpath.stream().map(File::getPath).collect(Collectors.joining(File.pathSeparator))); - KotlinTestUtils.compileJavaFiles(javaFiles, args); + args.addAll(additionalArgs); + + if (customJdkHomeForJavac != null) { + KotlinTestUtils.compileJavaFilesExternally(javaFiles, args, customJdkHomeForJavac); + } + else { + KotlinTestUtils.compileJavaFiles(javaFiles, args); + } } @NotNull diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java index 81a13679807..56267d438cc 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java @@ -680,6 +680,10 @@ public class KotlinTestUtils { } public static boolean compileJavaFilesExternallyWithJava9(@NotNull Collection files, @NotNull List options) { + return compileJavaFilesExternally(files, options, getJdk9Home()); + } + + public static boolean compileJavaFilesExternally(@NotNull Collection files, @NotNull List options, @NotNull File jdkHome) { List command = new ArrayList<>(); command.add(new File(jdkHome, "bin/javac").getPath()); command.addAll(options); diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/util/RecursiveDescriptorComparator.java b/compiler/tests-common/tests/org/jetbrains/kotlin/test/util/RecursiveDescriptorComparator.java index 515a32be755..8977f5ace0a 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/util/RecursiveDescriptorComparator.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/util/RecursiveDescriptorComparator.java @@ -27,6 +27,8 @@ import org.jetbrains.kotlin.contracts.description.*; import org.jetbrains.kotlin.descriptors.*; import org.jetbrains.kotlin.descriptors.impl.SubpackagesScope; import org.jetbrains.kotlin.jvm.compiler.ExpectedLoadErrorsUtil; +import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor; +import org.jetbrains.kotlin.load.java.descriptors.JavaMethodDescriptor; import org.jetbrains.kotlin.name.FqName; import org.jetbrains.kotlin.platform.TargetPlatformKt; import org.jetbrains.kotlin.renderer.*; @@ -193,7 +195,24 @@ public class RecursiveDescriptorComparator { boolean isPrimaryConstructor = conf.checkPrimaryConstructors && descriptor instanceof ConstructorDescriptor && ((ConstructorDescriptor) descriptor).isPrimary(); - printer.print(isPrimaryConstructor ? "/*primary*/ " : "", conf.renderer.render(descriptor)); + boolean isRecord = descriptor instanceof JavaClassDescriptor && ((JavaClassDescriptor) descriptor).isRecord(); + boolean isRecordComponent = descriptor instanceof JavaMethodDescriptor && ((JavaMethodDescriptor) descriptor).isForRecordComponent(); + + StringBuilder prefix = new StringBuilder(); + + if (isPrimaryConstructor) { + prefix.append("/*primary*/ "); + } + + if (isRecord) { + prefix.append("/*record*/ "); + } + + if (isRecordComponent) { + prefix.append("/*record component*/ "); + } + + printer.print(prefix.toString(), conf.renderer.render(descriptor)); if (descriptor instanceof FunctionDescriptor && conf.checkFunctionContracts) { printEffectsIfAny((FunctionDescriptor) descriptor, printer); diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java new file mode 100644 index 00000000000..c2c94de340e --- /dev/null +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java @@ -0,0 +1,35 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.checkers; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("compiler/testData/diagnostics/testsWithJava15") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class DiagnosticsWithJdk15TestGenerated extends AbstractDiagnosticsWithJdk15Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInTestsWithJava15() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJava15"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("simpleRecords.kt") + public void testSimpleRecords() throws Exception { + runTest("compiler/testData/diagnostics/testsWithJava15/simpleRecords.kt"); + } +} diff --git a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt index 56a73b4b4c8..5ebd70e752d 100644 --- a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt +++ b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt @@ -123,6 +123,10 @@ fun main(args: Array) { model("diagnostics/testsWithJava9") } + testClass { + model("diagnostics/testsWithJava15") + } + testClass { model("diagnostics/testsWithUnsignedTypes") } @@ -309,6 +313,15 @@ fun main(args: Array) { model("loadJava/compiledJava", extension = "java", testMethod = "doTestCompiledJava") } + testClass { + model("loadJava15", extension = "java", testMethod = "doTestCompiledJava", testClassName = "CompiledJava") + model("loadJava15", extension = "java", testMethod = "doTestSourceJava", testClassName = "SourceJava") + } + + testClass { + model("loadJava15", extension = "java", testMethod = "doTestCompiledJava") + } + testClass { model( "compileJavaAgainstKotlin", diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJava15TestGenerated.java b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJava15TestGenerated.java new file mode 100644 index 00000000000..a306af5eb18 --- /dev/null +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJava15TestGenerated.java @@ -0,0 +1,66 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.jvm.compiler; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@RunWith(JUnit3RunnerWithInners.class) +public class LoadJava15TestGenerated extends AbstractLoadJava15Test { + @TestMetadata("compiler/testData/loadJava15") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class CompiledJava extends AbstractLoadJava15Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTestCompiledJava, this, testDataFilePath); + } + + public void testAllFilesPresentInCompiledJava() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava15"), Pattern.compile("^(.+)\\.java$"), null, true); + } + + @TestMetadata("GenericRecord.java") + public void testGenericRecord() throws Exception { + runTest("compiler/testData/loadJava15/GenericRecord.java"); + } + + @TestMetadata("SimpleRecord.java") + public void testSimpleRecord() throws Exception { + runTest("compiler/testData/loadJava15/SimpleRecord.java"); + } + } + + @TestMetadata("compiler/testData/loadJava15") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class SourceJava extends AbstractLoadJava15Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTestSourceJava, this, testDataFilePath); + } + + public void testAllFilesPresentInSourceJava() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava15"), Pattern.compile("^(.+)\\.java$"), null, true); + } + + @TestMetadata("GenericRecord.java") + public void testGenericRecord() throws Exception { + runTest("compiler/testData/loadJava15/GenericRecord.java"); + } + + @TestMetadata("SimpleRecord.java") + public void testSimpleRecord() throws Exception { + runTest("compiler/testData/loadJava15/SimpleRecord.java"); + } + } +} diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJava15WithPsiClassReadingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJava15WithPsiClassReadingTestGenerated.java new file mode 100644 index 00000000000..aad9d58fcd9 --- /dev/null +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJava15WithPsiClassReadingTestGenerated.java @@ -0,0 +1,40 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.jvm.compiler; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("compiler/testData/loadJava15") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class LoadJava15WithPsiClassReadingTestGenerated extends AbstractLoadJava15WithPsiClassReadingTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTestCompiledJava, this, testDataFilePath); + } + + public void testAllFilesPresentInLoadJava15() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava15"), Pattern.compile("^(.+)\\.java$"), null, true); + } + + @TestMetadata("GenericRecord.java") + public void testGenericRecord() throws Exception { + runTest("compiler/testData/loadJava15/GenericRecord.java"); + } + + @TestMetadata("SimpleRecord.java") + public void testSimpleRecord() throws Exception { + runTest("compiler/testData/loadJava15/SimpleRecord.java"); + } +} diff --git a/core/compiler.common.jvm/src/org/jetbrains/kotlin/load/java/structure/javaElements.kt b/core/compiler.common.jvm/src/org/jetbrains/kotlin/load/java/structure/javaElements.kt index 45e221f9716..72700425946 100644 --- a/core/compiler.common.jvm/src/org/jetbrains/kotlin/load/java/structure/javaElements.kt +++ b/core/compiler.common.jvm/src/org/jetbrains/kotlin/load/java/structure/javaElements.kt @@ -85,11 +85,13 @@ interface JavaClass : JavaClassifier, JavaTypeParameterListOwner, JavaModifierLi val isInterface: Boolean val isAnnotationType: Boolean val isEnum: Boolean + val isRecord: Boolean val lightClassOriginKind: LightClassOriginKind? val methods: Collection val fields: Collection val constructors: Collection + val recordComponents: Collection fun hasDefaultConstructor(): Boolean } @@ -133,6 +135,11 @@ interface JavaValueParameter : JavaAnnotationOwner { val isVararg: Boolean } +interface JavaRecordComponent : JavaMember { + val type: JavaType + val isVararg: Boolean +} + interface JavaTypeParameter : JavaClassifier { val upperBounds: Collection } diff --git a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/components/JavaResolverCache.java b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/components/JavaResolverCache.java index 6b982077d3c..9559661ed3c 100644 --- a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/components/JavaResolverCache.java +++ b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/components/JavaResolverCache.java @@ -22,10 +22,7 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor; import org.jetbrains.kotlin.descriptors.ConstructorDescriptor; import org.jetbrains.kotlin.descriptors.PropertyDescriptor; import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor; -import org.jetbrains.kotlin.load.java.structure.JavaClass; -import org.jetbrains.kotlin.load.java.structure.JavaElement; -import org.jetbrains.kotlin.load.java.structure.JavaField; -import org.jetbrains.kotlin.load.java.structure.JavaMethod; +import org.jetbrains.kotlin.load.java.structure.*; import org.jetbrains.kotlin.name.FqName; public interface JavaResolverCache { @@ -37,7 +34,7 @@ public interface JavaResolverCache { } @Override - public void recordMethod(@NotNull JavaMethod method, @NotNull SimpleFunctionDescriptor descriptor) { + public void recordMethod(@NotNull JavaMember member, @NotNull SimpleFunctionDescriptor descriptor) { } @Override @@ -56,7 +53,8 @@ public interface JavaResolverCache { @Nullable ClassDescriptor getClassResolvedFromSource(@NotNull FqName fqName); - void recordMethod(@NotNull JavaMethod method, @NotNull SimpleFunctionDescriptor descriptor); + // It's a JavaMethod or JavaRecordComponent + void recordMethod(@NotNull JavaMember member, @NotNull SimpleFunctionDescriptor descriptor); void recordConstructor(@NotNull JavaElement element, @NotNull ConstructorDescriptor descriptor); diff --git a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/descriptors/JavaClassDescriptor.java b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/descriptors/JavaClassDescriptor.java index 23f0232716f..01f1d282008 100644 --- a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/descriptors/JavaClassDescriptor.java +++ b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/descriptors/JavaClassDescriptor.java @@ -19,4 +19,5 @@ package org.jetbrains.kotlin.load.java.descriptors; import org.jetbrains.kotlin.descriptors.ClassDescriptor; public interface JavaClassDescriptor extends ClassDescriptor { + boolean isRecord(); } diff --git a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/descriptors/JavaMethodDescriptor.java b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/descriptors/JavaMethodDescriptor.java index 9259258a755..06954c9959e 100644 --- a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/descriptors/JavaMethodDescriptor.java +++ b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/descriptors/JavaMethodDescriptor.java @@ -60,6 +60,7 @@ public class JavaMethodDescriptor extends SimpleFunctionDescriptorImpl implement } private ParameterNamesStatus parameterNamesStatus = null; + private final boolean isForRecordComponent; protected JavaMethodDescriptor( @NotNull DeclarationDescriptor containingDeclaration, @@ -67,9 +68,11 @@ public class JavaMethodDescriptor extends SimpleFunctionDescriptorImpl implement @NotNull Annotations annotations, @NotNull Name name, @NotNull Kind kind, - @NotNull SourceElement source + @NotNull SourceElement source, + boolean isForRecordComponent ) { super(containingDeclaration, original, annotations, name, kind, source); + this.isForRecordComponent = isForRecordComponent; } @NotNull @@ -77,9 +80,10 @@ public class JavaMethodDescriptor extends SimpleFunctionDescriptorImpl implement @NotNull DeclarationDescriptor containingDeclaration, @NotNull Annotations annotations, @NotNull Name name, - @NotNull SourceElement source + @NotNull SourceElement source, + boolean isForRecordComponent ) { - return new JavaMethodDescriptor(containingDeclaration, null, annotations, name, Kind.DECLARATION, source); + return new JavaMethodDescriptor(containingDeclaration, null, annotations, name, Kind.DECLARATION, source, isForRecordComponent); } @NotNull @@ -118,6 +122,10 @@ public class JavaMethodDescriptor extends SimpleFunctionDescriptorImpl implement this.parameterNamesStatus = ParameterNamesStatus.get(hasStableParameterNames, hasSynthesizedParameterNames); } + public boolean isForRecordComponent() { + return isForRecordComponent; + } + @NotNull @Override protected JavaMethodDescriptor createSubstitutedCopy( @@ -134,7 +142,8 @@ public class JavaMethodDescriptor extends SimpleFunctionDescriptorImpl implement annotations, newName != null ? newName : getName(), kind, - source + source, + isForRecordComponent ); result.setParameterNamesStatus(hasStableParameterNames(), hasSynthesizedParameterNames()); return result; diff --git a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/DeclaredMemberIndex.kt b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/DeclaredMemberIndex.kt index bb22d28182d..a4ee63a8d09 100644 --- a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/DeclaredMemberIndex.kt +++ b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/DeclaredMemberIndex.kt @@ -26,12 +26,18 @@ interface DeclaredMemberIndex { fun findFieldByName(name: Name): JavaField? fun getFieldNames(): Set + fun getRecordComponentNames(): Set + fun findRecordComponentByName(name: Name): JavaRecordComponent? + object Empty : DeclaredMemberIndex { override fun findMethodsByName(name: Name) = listOf() override fun getMethodNames() = emptySet() override fun findFieldByName(name: Name): JavaField? = null override fun getFieldNames() = emptySet() + + override fun getRecordComponentNames(): Set = emptySet() + override fun findRecordComponentByName(name: Name): JavaRecordComponent? = null } } @@ -45,11 +51,15 @@ open class ClassDeclaredMemberIndex( private val methods = jClass.methods.asSequence().filter(methodFilter).groupBy { m -> m.name } private val fields = jClass.fields.asSequence().filter(memberFilter).associateBy { m -> m.name } + private val components = jClass.recordComponents.filter(memberFilter).associateBy { it.name } override fun findMethodsByName(name: Name): Collection = methods[name] ?: listOf() override fun getMethodNames(): Set = jClass.methods.asSequence().filter(methodFilter).mapTo(mutableSetOf(), JavaMethod::name) override fun findFieldByName(name: Name): JavaField? = fields[name] override fun getFieldNames(): Set = jClass.fields.asSequence().filter(memberFilter).mapTo(mutableSetOf(), JavaField::name) + + override fun getRecordComponentNames(): Set = components.keys + override fun findRecordComponentByName(name: Name): JavaRecordComponent? = components[name] } diff --git a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt index 5a5c60b822d..d352a0a4a47 100644 --- a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt +++ b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt @@ -84,6 +84,8 @@ class LazyJavaClassDescriptor( override fun getKind() = kind override fun getModality() = modality + override fun isRecord(): Boolean = jClass.isRecord + // To workaround a problem with Scala compatibility (KT-9700), // we consider private visibility of a Java top level class as package private // Shortly: Scala plugin introduces special kind of "private in package" classes diff --git a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassMemberScope.kt b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassMemberScope.kt index 63878923daf..7a0399d71b1 100644 --- a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassMemberScope.kt +++ b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassMemberScope.kt @@ -39,10 +39,7 @@ import org.jetbrains.kotlin.load.java.lazy.LazyJavaResolverContext import org.jetbrains.kotlin.load.java.lazy.childForMethod import org.jetbrains.kotlin.load.java.lazy.resolveAnnotations import org.jetbrains.kotlin.load.java.lazy.types.toAttributes -import org.jetbrains.kotlin.load.java.structure.JavaArrayType -import org.jetbrains.kotlin.load.java.structure.JavaClass -import org.jetbrains.kotlin.load.java.structure.JavaConstructor -import org.jetbrains.kotlin.load.java.structure.JavaMethod +import org.jetbrains.kotlin.load.java.structure.* import org.jetbrains.kotlin.load.kotlin.computeJvmDescriptor import org.jetbrains.kotlin.name.FqNameUnsafe import org.jetbrains.kotlin.name.Name @@ -79,23 +76,79 @@ class LazyJavaClassMemberScope( it.memberScope.getFunctionNames() }.apply { addAll(declaredMemberIndex().getMethodNames()) + addAll(declaredMemberIndex().getRecordComponentNames()) addAll(computeClassNames(kindFilter, nameFilter)) } internal val constructors = c.storageManager.createLazyValue { val constructors = jClass.constructors - val result = ArrayList(constructors.size) + val result = ArrayList(constructors.size) for (constructor in constructors) { val descriptor = resolveConstructor(constructor) result.add(descriptor) } + if (jClass.isRecord) { + val defaultConstructor = createDefaultRecordConstructor() + val jvmDescriptor = defaultConstructor.computeJvmDescriptor(withReturnType = false) + + if (result.none { it.computeJvmDescriptor(withReturnType = false) == jvmDescriptor }) { + result.add(defaultConstructor) + c.components.javaResolverCache.recordConstructor(jClass, defaultConstructor) + } + } + c.components.signatureEnhancement.enhanceSignatures( c, result.ifEmpty { listOfNotNull(createDefaultConstructor()) } ).toList() } + private fun createDefaultRecordConstructor(): ClassConstructorDescriptor { + val classDescriptor = ownerDescriptor + val constructorDescriptor = JavaClassConstructorDescriptor.createJavaConstructor( + classDescriptor, Annotations.EMPTY, /* isPrimary = */ true, c.components.sourceElementFactory.source(jClass) + ) + val valueParameters = createRecordConstructorParameters(constructorDescriptor) + constructorDescriptor.setHasSynthesizedParameterNames(false) + + constructorDescriptor.initialize(valueParameters, getConstructorVisibility(classDescriptor)) + constructorDescriptor.setHasStableParameterNames(false) + constructorDescriptor.returnType = classDescriptor.defaultType + return constructorDescriptor + } + + private fun createRecordConstructorParameters(constructor: ClassConstructorDescriptorImpl): List { + val components = jClass.recordComponents + val result = ArrayList(components.size) + + val attr = TypeUsage.COMMON.toAttributes(isForAnnotationParameter = false) + + for ((index, component) in components.withIndex()) { + val parameterType = c.typeResolver.transformJavaType(component.type, attr) + val varargElementType = + if (component.isVararg) c.components.module.builtIns.getArrayElementType(parameterType) else null + + result.add( + ValueParameterDescriptorImpl( + constructor, + null, + index, + Annotations.EMPTY, + component.name, + parameterType, + /* deeclaresDefaultValue = */false, + /* isCrossinline = */ false, + /* isNoinline = */ false, + varargElementType, + c.components.sourceElementFactory.source(component) + ) + ) + } + + return result + } + override fun JavaMethodDescriptor.isVisibleAsFunction(): Boolean { if (jClass.isAnnotationType) return false return isVisibleAsFunctionInCurrentClass(this) @@ -439,6 +492,42 @@ class LazyJavaClassMemberScope( } } + override fun computeImplicitlyDeclaredFunctions(result: MutableCollection, name: Name) { + if (jClass.isRecord && declaredMemberIndex().findRecordComponentByName(name) != null && result.none { it.valueParameters.isEmpty() }) { + result.add(resolveRecordComponentToFunctionDescriptor(declaredMemberIndex().findRecordComponentByName(name)!!)) + } + } + + private fun resolveRecordComponentToFunctionDescriptor(recordComponent: JavaRecordComponent): JavaMethodDescriptor { + val annotations = c.resolveAnnotations(recordComponent) + val functionDescriptorImpl = JavaMethodDescriptor.createJavaMethod( + ownerDescriptor, annotations, recordComponent.name, c.components.sourceElementFactory.source(recordComponent), true + ) + + val returnTypeAttrs = TypeUsage.COMMON.toAttributes(isForAnnotationParameter = false) + val returnType = c.typeResolver.transformJavaType(recordComponent.type, returnTypeAttrs) + + functionDescriptorImpl.initialize( + null, + getDispatchReceiverParameter(), + emptyList(), + emptyList(), + returnType, + // Those functions are generated as open in bytecode + // Actually, it should not be important because the class is final anyway, but leaving them open is convenient for consistency + Modality.convertFromFlags(abstract = false, open = true), + DescriptorVisibilities.PUBLIC, + null, + ) + + functionDescriptorImpl.setParameterNamesStatus(false, false) + + c.components.javaResolverCache.recordMethod(recordComponent, functionDescriptorImpl) + + return functionDescriptorImpl + } + + override fun computeNonDeclaredProperties(name: Name, result: MutableCollection) { if (jClass.isAnnotationType) { computeAnnotationProperties(name, result) diff --git a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaScope.kt b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaScope.kt index cb435ecf92c..8642044363f 100644 --- a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaScope.kt +++ b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaScope.kt @@ -82,6 +82,10 @@ abstract class LazyJavaScope( // Fake overrides, values()/valueOf(), etc. protected abstract fun computeNonDeclaredFunctions(result: MutableCollection, name: Name) + // It has a similar semantics to computeNonDeclaredFunctions, but it's being called just once per class + // While computeNonDeclaredFunctions is being called once per scope instance (once per KotlinTypeRefiner) + protected open fun computeImplicitlyDeclaredFunctions(result: MutableCollection, name: Name) {} + protected abstract fun getDispatchReceiverParameter(): ReceiverParameterDescriptor? private val declaredFunctions: MemoizedFunctionToNotNull> = @@ -98,6 +102,8 @@ abstract class LazyJavaScope( result.add(descriptor) } + computeImplicitlyDeclaredFunctions(result, name) + result } @@ -154,7 +160,8 @@ abstract class LazyJavaScope( protected fun resolveMethodToFunctionDescriptor(method: JavaMethod): JavaMethodDescriptor { val annotations = c.resolveAnnotations(method) val functionDescriptorImpl = JavaMethodDescriptor.createJavaMethod( - ownerDescriptor, annotations, method.name, c.components.sourceElementFactory.source(method) + ownerDescriptor, annotations, method.name, c.components.sourceElementFactory.source(method), + declaredMemberIndex().findRecordComponentByName(method.name) != null && method.valueParameters.isEmpty() ) val c = c.childForMethod(functionDescriptorImpl, method) diff --git a/core/descriptors.runtime/src/org/jetbrains/kotlin/descriptors/runtime/structure/ReflectJavaClass.kt b/core/descriptors.runtime/src/org/jetbrains/kotlin/descriptors/runtime/structure/ReflectJavaClass.kt index b2097b11e79..f98ca3118f9 100644 --- a/core/descriptors.runtime/src/org/jetbrains/kotlin/descriptors/runtime/structure/ReflectJavaClass.kt +++ b/core/descriptors.runtime/src/org/jetbrains/kotlin/descriptors/runtime/structure/ReflectJavaClass.kt @@ -18,6 +18,7 @@ package org.jetbrains.kotlin.descriptors.runtime.structure import org.jetbrains.kotlin.load.java.structure.JavaClass import org.jetbrains.kotlin.load.java.structure.JavaClassifierType +import org.jetbrains.kotlin.load.java.structure.JavaRecordComponent import org.jetbrains.kotlin.load.java.structure.LightClassOriginKind import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name @@ -96,6 +97,9 @@ class ReflectJavaClass( .map(::ReflectJavaConstructor) .toList() + override val recordComponents: Collection + get() = emptyList() + override fun hasDefaultConstructor() = false // any default constructor is returned by constructors override val lightClassOriginKind: LightClassOriginKind? @@ -114,6 +118,10 @@ class ReflectJavaClass( override val isEnum: Boolean get() = klass.isEnum + // TODO: Support reflect + override val isRecord: Boolean + get() = false + override fun equals(other: Any?) = other is ReflectJavaClass && klass == other.klass override fun hashCode() = klass.hashCode() diff --git a/core/descriptors.runtime/tests/org/jetbrains/kotlin/jvm/runtime/AbstractJvmRuntimeDescriptorLoaderTest.kt b/core/descriptors.runtime/tests/org/jetbrains/kotlin/jvm/runtime/AbstractJvmRuntimeDescriptorLoaderTest.kt index 243a47f4b16..dc000741501 100644 --- a/core/descriptors.runtime/tests/org/jetbrains/kotlin/jvm/runtime/AbstractJvmRuntimeDescriptorLoaderTest.kt +++ b/core/descriptors.runtime/tests/org/jetbrains/kotlin/jvm/runtime/AbstractJvmRuntimeDescriptorLoaderTest.kt @@ -125,7 +125,7 @@ abstract class AbstractJvmRuntimeDescriptorLoaderTest : TestCaseWithTmpdir() { }, "" ) - LoadDescriptorUtil.compileJavaWithAnnotationsJar(sources, tmpdir) + LoadDescriptorUtil.compileJavaWithAnnotationsJar(sources, tmpdir, emptyList(), null) } fileName.endsWith(".kt") -> { val environment = KotlinTestUtils.createEnvironmentWithJdkAndNullabilityAnnotationsFromIdea( From 5d054190166f07f3647f52e0648fb549c58422aa Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Tue, 24 Nov 2020 16:22:49 +0300 Subject: [PATCH 506/698] Add simple JDK15 BlackBox test ^KT-43677 In Progress --- .../box/recordDifferentPropertyOverride.kt | 20 +++++ .../box/recordDifferentSyntheticProperty.kt | 15 ++++ .../java15/box/recordPropertyAccess.kt | 10 +++ .../codegen/AbstractBlackBoxCodegenTest.java | 2 +- .../AbstractCustomJDKBlackBoxCodegenTest.kt | 81 +++++++++++++++++++ .../AbstractJdk15BlackBoxCodegenTest.kt | 20 +++++ .../kotlin/codegen/CodegenTestCase.java | 17 +++- .../kotlin/codegen/CodegenTestUtil.java | 34 +++++--- .../Jdk15BlackBoxCodegenTestGenerated.java | 45 +++++++++++ .../generators/tests/GenerateCompilerTests.kt | 4 + 10 files changed, 234 insertions(+), 14 deletions(-) create mode 100644 compiler/testData/codegen/java15/box/recordDifferentPropertyOverride.kt create mode 100644 compiler/testData/codegen/java15/box/recordDifferentSyntheticProperty.kt create mode 100644 compiler/testData/codegen/java15/box/recordPropertyAccess.kt create mode 100644 compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCustomJDKBlackBoxCodegenTest.kt create mode 100644 compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk15BlackBoxCodegenTest.kt create mode 100644 compiler/tests/org/jetbrains/kotlin/codegen/Jdk15BlackBoxCodegenTestGenerated.java diff --git a/compiler/testData/codegen/java15/box/recordDifferentPropertyOverride.kt b/compiler/testData/codegen/java15/box/recordDifferentPropertyOverride.kt new file mode 100644 index 00000000000..2752ede043d --- /dev/null +++ b/compiler/testData/codegen/java15/box/recordDifferentPropertyOverride.kt @@ -0,0 +1,20 @@ +// FILE: MyRec.java +public record MyRec(String name) implements KI { + public String getName() { + return "OK"; + } +} + +// FILE: main.kt + +interface KI { + val name: String +} + +fun box(): String { + val r = MyRec("fail") + if (r.name() != "fail") return "fail 1" + if ((r as KI).name != "OK") return "fail 2" + + return r.name +} diff --git a/compiler/testData/codegen/java15/box/recordDifferentSyntheticProperty.kt b/compiler/testData/codegen/java15/box/recordDifferentSyntheticProperty.kt new file mode 100644 index 00000000000..80b39f384aa --- /dev/null +++ b/compiler/testData/codegen/java15/box/recordDifferentSyntheticProperty.kt @@ -0,0 +1,15 @@ +// FILE: MyRec.java +public record MyRec(String name) { + public String getName() { + return "OK"; + } +} + +// FILE: main.kt +fun box(): String { + val r = MyRec("fail") + if (r.name() != "fail") return "fail 1" + if (r.getName() != "OK") return "fail 2" + + return r.name +} diff --git a/compiler/testData/codegen/java15/box/recordPropertyAccess.kt b/compiler/testData/codegen/java15/box/recordPropertyAccess.kt new file mode 100644 index 00000000000..05939f3dea5 --- /dev/null +++ b/compiler/testData/codegen/java15/box/recordPropertyAccess.kt @@ -0,0 +1,10 @@ +// FILE: MyRec.java +public record MyRec(String name) {} + +// FILE: recordPropertyAccess.kt +fun box(): String { + val r = MyRec("OK") + if (r.name() != "OK") return "fail 1" + + return r.name +} \ No newline at end of file diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTest.java b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTest.java index 118df8a46e2..505173a92a4 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTest.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTest.java @@ -136,7 +136,7 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase { } @Nullable - private static String getFacadeFqName(@NotNull KtFile file) { + protected static String getFacadeFqName(@NotNull KtFile file) { return CodegenUtil.getMemberDeclarationsToGenerate(file).isEmpty() ? null : JvmFileClassUtil.getFileClassInfoNoResolve(file).getFacadeClassFqName().asString(); diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCustomJDKBlackBoxCodegenTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCustomJDKBlackBoxCodegenTest.kt new file mode 100644 index 00000000000..e53093e5d2e --- /dev/null +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCustomJDKBlackBoxCodegenTest.kt @@ -0,0 +1,81 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.codegen + +import org.jetbrains.kotlin.cli.common.output.writeAll +import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime +import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils +import org.jetbrains.kotlin.test.ConfigurationKind +import org.jetbrains.kotlin.test.KotlinTestUtils +import org.jetbrains.kotlin.test.TestJdkKind +import java.io.File +import java.util.concurrent.TimeUnit + +abstract class AbstractCustomJDKBlackBoxCodegenTest : AbstractBlackBoxCodegenTest() { + @Throws(Exception::class) + override fun doTest(filePath: String) { + val file = File(filePath) + val expectedText = + KotlinTestUtils.doLoadFile(file) + + "\n" + + """ + fun main() { + val res = box() + if (res != "OK") throw AssertionError(res) + } + """.trimIndent() + val testFiles = createTestFilesFromFile(file, expectedText) + doMultiFileTest(file, testFiles) + } + + override fun extractConfigurationKind(files: List): ConfigurationKind { + return ConfigurationKind.NO_KOTLIN_REFLECT + } + + override fun runJavacTask(files: MutableCollection, options: List) { + KotlinTestUtils.compileJavaFilesExternally(files, options + getAdditionalJavacArgs(), getJdkHome()) + } + + override fun getTestJdkKind(files: List): TestJdkKind { + return getTestJdkKind() + } + + abstract fun getTestJdkKind(): TestJdkKind + abstract fun getJdkHome(): File + + open fun getAdditionalJavacArgs(): List = emptyList() + open fun getAdditionalJvmArgs(): List = emptyList() + + abstract override fun getPrefix(): String + + override fun blackBox(reportProblems: Boolean, unexpectedBehaviour: Boolean) { + val tmpdir = KotlinTestUtils.tmpDirForTest(this) + val fileFactory = generateClassesInFile() + fileFactory.writeAll(tmpdir, null) + + val jdkHome = getJdkHome() + val javaExe = File(jdkHome, "bin/java.exe").takeIf(File::exists) + ?: File(jdkHome, "bin/java").takeIf(File::exists) + ?: error("Can't find 'java' executable in $jdkHome") + + + val command = arrayOf( + javaExe.absolutePath, + "-ea", + *getAdditionalJvmArgs().toTypedArray(), + "-classpath", + listOfNotNull( + tmpdir, ForTestCompileRuntime.runtimeJarForTests(), + javaClassesOutputDirectory + ).joinToString(File.pathSeparator, transform = File::getAbsolutePath), + getFacadeFqName(myFiles.psiFile) + ) + + val process = ProcessBuilder(*command).inheritIO().start() + process.waitFor(1, TimeUnit.MINUTES) + assertEquals(0, process.exitValue()) + } +} \ No newline at end of file diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk15BlackBoxCodegenTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk15BlackBoxCodegenTest.kt new file mode 100644 index 00000000000..6e50e9a59be --- /dev/null +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk15BlackBoxCodegenTest.kt @@ -0,0 +1,20 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.codegen + +import org.jetbrains.kotlin.jvm.compiler.ADDITIONAL_JAVAC_ARGS_FOR_15 +import org.jetbrains.kotlin.test.KotlinTestUtils +import org.jetbrains.kotlin.test.TestJdkKind +import java.io.File + +abstract class AbstractJdk15BlackBoxCodegenTest : AbstractCustomJDKBlackBoxCodegenTest() { + override fun getTestJdkKind(): TestJdkKind = TestJdkKind.FULL_JDK_15 + override fun getJdkHome(): File = KotlinTestUtils.getJdk15Home() + override fun getPrefix(): String = "java15/box" + + override fun getAdditionalJavacArgs(): List = ADDITIONAL_JAVAC_ARGS_FOR_15 + override fun getAdditionalJvmArgs(): List = listOf("--enable-preview") +} \ No newline at end of file diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java index 9debd333195..60072773ce9 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java @@ -58,6 +58,7 @@ import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import java.util.*; +import java.util.stream.Collectors; import static org.jetbrains.kotlin.cli.common.output.OutputUtilsKt.writeAllTo; import static org.jetbrains.kotlin.codegen.CodegenTestUtil.*; @@ -529,10 +530,24 @@ public abstract class CodegenTestCase extends KotlinBaseTest javacOptions = extractJavacOptions(files, configuration.get(JVMConfigurationKeys.JVM_TARGET)); - compileJava(findJavaSourcesInDirectory(javaSourceDir), javaClasspath, javacOptions, javaClassesOutputDirectory); + List finalJavacOptions = prepareJavacOptions(javaClasspath, javacOptions, javaClassesOutputDirectory); + + try { + runJavacTask( + findJavaSourcesInDirectory(javaSourceDir).stream().map(File::new).collect(Collectors.toList()), + finalJavacOptions + ); + } + catch (IOException e) { + throw ExceptionUtilsKt.rethrow(e); + } } } + protected void runJavacTask(@NotNull Collection files, @NotNull List options) throws IOException { + KotlinTestUtils.compileJavaFiles(files, options); + } + protected void updateJavaClasspath(@NotNull List javaClasspath) {} @NotNull diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestUtil.java b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestUtil.java index 57ecc004ffd..b526bd0d784 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestUtil.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestUtil.java @@ -101,18 +101,7 @@ public class CodegenTestUtil { @NotNull File outDirectory ) { try { - List classpath = new ArrayList<>(); - classpath.add(ForTestCompileRuntime.runtimeJarForTests().getPath()); - classpath.add(ForTestCompileRuntime.reflectJarForTests().getPath()); - classpath.add(KotlinTestUtils.getAnnotationsJar().getPath()); - classpath.addAll(additionalClasspath); - - List options = new ArrayList<>(Arrays.asList( - "-classpath", StringsKt.join(classpath, File.pathSeparator), - "-d", outDirectory.getPath() - )); - options.addAll(additionalOptions); - + List options = prepareJavacOptions(additionalClasspath, additionalOptions, outDirectory); KotlinTestUtils.compileJavaFiles(CollectionsKt.map(fileNames, File::new), options); } catch (IOException e) { @@ -120,6 +109,27 @@ public class CodegenTestUtil { } } + @NotNull + public static List prepareJavacOptions( + @NotNull List additionalClasspath, + @NotNull List additionalOptions, + @NotNull File outDirectory + ) { + List classpath = new ArrayList<>(); + classpath.add(ForTestCompileRuntime.runtimeJarForTests().getPath()); + classpath.add(ForTestCompileRuntime.reflectJarForTests().getPath()); + classpath.add(KotlinTestUtils.getAnnotationsJar().getPath()); + classpath.addAll(additionalClasspath); + + List options = new ArrayList<>(Arrays.asList( + "-classpath", StringsKt.join(classpath, File.pathSeparator), + "-d", outDirectory.getPath() + )); + options.addAll(additionalOptions); + return options; + } + + @NotNull public static Method findTheOnlyMethod(@NotNull Class aClass) { Method r = null; diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/Jdk15BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/Jdk15BlackBoxCodegenTestGenerated.java new file mode 100644 index 00000000000..3fb4b629608 --- /dev/null +++ b/compiler/tests/org/jetbrains/kotlin/codegen/Jdk15BlackBoxCodegenTestGenerated.java @@ -0,0 +1,45 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.codegen; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("compiler/testData/codegen/java15/box") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class Jdk15BlackBoxCodegenTestGenerated extends AbstractJdk15BlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInBox() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/java15/box"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("recordDifferentPropertyOverride.kt") + public void testRecordDifferentPropertyOverride() throws Exception { + runTest("compiler/testData/codegen/java15/box/recordDifferentPropertyOverride.kt"); + } + + @TestMetadata("recordDifferentSyntheticProperty.kt") + public void testRecordDifferentSyntheticProperty() throws Exception { + runTest("compiler/testData/codegen/java15/box/recordDifferentSyntheticProperty.kt"); + } + + @TestMetadata("recordPropertyAccess.kt") + public void testRecordPropertyAccess() throws Exception { + runTest("compiler/testData/codegen/java15/box/recordPropertyAccess.kt"); + } +} diff --git a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt index 5ebd70e752d..55105acc4af 100644 --- a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt +++ b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt @@ -211,6 +211,10 @@ fun main(args: Array) { model("codegen/boxAgainstJava") } + testClass { + model("codegen/java15/box") + } + testClass { model("codegen/script", extension = "kts") } From 059e2aab7a4fa2ef8c82e87795dff94b3b13d62f Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Tue, 24 Nov 2020 18:12:26 +0300 Subject: [PATCH 507/698] Make BlackBox tests for Java 9 generated --- .../codegen/java9/box/concatDynamic.kt | 6 +- .../codegen/java9/box/concatDynamic200.kt | 6 +- .../codegen/java9/box/concatDynamic201.kt | 6 +- .../codegen/java9/box/concatDynamicIndy200.kt | 6 +- .../codegen/java9/box/concatDynamicIndy201.kt | 6 +- .../java9/box/concatDynamicInlineClasses.kt | 4 - .../java9/box/concatDynamicWithInline.kt | 4 - .../testData/codegen/java9/box/varHandle.kt | 6 +- .../AbstractJdk9BlackBoxCodegenTest.kt | 16 ++++ .../kotlin/codegen/Java9CodegenTest.kt | 89 ------------------- .../Jdk9BlackBoxCodegenTestGenerated.java | 70 +++++++++++++++ .../generators/tests/GenerateCompilerTests.kt | 4 + 12 files changed, 96 insertions(+), 127 deletions(-) create mode 100644 compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk9BlackBoxCodegenTest.kt delete mode 100644 compiler/tests/org/jetbrains/kotlin/codegen/Java9CodegenTest.kt create mode 100644 compiler/tests/org/jetbrains/kotlin/codegen/Jdk9BlackBoxCodegenTestGenerated.java diff --git a/compiler/testData/codegen/java9/box/concatDynamic.kt b/compiler/testData/codegen/java9/box/concatDynamic.kt index 2c684da3f4e..37753eb20aa 100644 --- a/compiler/testData/codegen/java9/box/concatDynamic.kt +++ b/compiler/testData/codegen/java9/box/concatDynamic.kt @@ -7,8 +7,4 @@ fun box(): String { val s = a + "1" + "2" + 3 + 4L + b + 5.0 + 6F + '7' + true + false + 3147483647u + p return if (s != "_1234_5.06.07truefalse31474836473147483648") "fail $s" else "OK" -} - -fun main() { - box().let { if (it != "OK") throw AssertionError(it) } -} +} \ No newline at end of file diff --git a/compiler/testData/codegen/java9/box/concatDynamic200.kt b/compiler/testData/codegen/java9/box/concatDynamic200.kt index 8748f1603c1..67340759357 100644 --- a/compiler/testData/codegen/java9/box/concatDynamic200.kt +++ b/compiler/testData/codegen/java9/box/concatDynamic200.kt @@ -15,8 +15,4 @@ fun box(): String { return if (result.length != 200) "fail: ${result.length}" else "OK" -} - -fun main() { - box().let { if (it != "OK") throw AssertionError(it) } -} +} \ No newline at end of file diff --git a/compiler/testData/codegen/java9/box/concatDynamic201.kt b/compiler/testData/codegen/java9/box/concatDynamic201.kt index de3808a0035..06207a053d7 100644 --- a/compiler/testData/codegen/java9/box/concatDynamic201.kt +++ b/compiler/testData/codegen/java9/box/concatDynamic201.kt @@ -16,8 +16,4 @@ fun box(): String { return if (result.length != 201) "fail: ${result.length}" else "OK" -} - -fun main() { - box().let { if (it != "OK") throw AssertionError(it) } -} +} \ No newline at end of file diff --git a/compiler/testData/codegen/java9/box/concatDynamicIndy200.kt b/compiler/testData/codegen/java9/box/concatDynamicIndy200.kt index 7aef336f88f..0d9284a5604 100644 --- a/compiler/testData/codegen/java9/box/concatDynamicIndy200.kt +++ b/compiler/testData/codegen/java9/box/concatDynamicIndy200.kt @@ -15,8 +15,4 @@ fun box(): String { return if (result.length != 200) "fail: ${result.length}" else "OK" -} - -fun main() { - box().let { if (it != "OK") throw AssertionError(it) } -} +} \ No newline at end of file diff --git a/compiler/testData/codegen/java9/box/concatDynamicIndy201.kt b/compiler/testData/codegen/java9/box/concatDynamicIndy201.kt index a76dfaa790b..8d28a89f659 100644 --- a/compiler/testData/codegen/java9/box/concatDynamicIndy201.kt +++ b/compiler/testData/codegen/java9/box/concatDynamicIndy201.kt @@ -16,8 +16,4 @@ fun box(): String { return if (result.length != 201) "fail: ${result.length}" else "OK" -} - -fun main() { - box().let { if (it != "OK") throw AssertionError(it) } -} +} \ No newline at end of file diff --git a/compiler/testData/codegen/java9/box/concatDynamicInlineClasses.kt b/compiler/testData/codegen/java9/box/concatDynamicInlineClasses.kt index 39933ea1bd0..a13b01c4666 100644 --- a/compiler/testData/codegen/java9/box/concatDynamicInlineClasses.kt +++ b/compiler/testData/codegen/java9/box/concatDynamicInlineClasses.kt @@ -24,8 +24,4 @@ fun box(): String { if (test5 != "2nullnull") return "fail 5: $test5" return "OK" -} - -fun main() { - box().let { if (it != "OK") throw AssertionError(it) } } \ No newline at end of file diff --git a/compiler/testData/codegen/java9/box/concatDynamicWithInline.kt b/compiler/testData/codegen/java9/box/concatDynamicWithInline.kt index b430a20d795..958aa279f7a 100644 --- a/compiler/testData/codegen/java9/box/concatDynamicWithInline.kt +++ b/compiler/testData/codegen/java9/box/concatDynamicWithInline.kt @@ -18,8 +18,4 @@ fun box(): String { val result2 = test { it + "_" } return if (result2 != "12_3456_789_10") "fail 2: $result2" else "OK" -} - -fun main() { - box().let { if (it != "OK") throw AssertionError(it) } } \ No newline at end of file diff --git a/compiler/testData/codegen/java9/box/varHandle.kt b/compiler/testData/codegen/java9/box/varHandle.kt index f1511259d47..bdbf3eab67e 100644 --- a/compiler/testData/codegen/java9/box/varHandle.kt +++ b/compiler/testData/codegen/java9/box/varHandle.kt @@ -31,8 +31,4 @@ fun box(): String { } return if (handle.getVolatile(array, index) == newValue) "OK" else "Fail" -} - -fun main() { - box().let { if (it != "OK") throw AssertionError(it) } -} +} \ No newline at end of file diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk9BlackBoxCodegenTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk9BlackBoxCodegenTest.kt new file mode 100644 index 00000000000..74ed94364cd --- /dev/null +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk9BlackBoxCodegenTest.kt @@ -0,0 +1,16 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.codegen + +import org.jetbrains.kotlin.test.KotlinTestUtils +import org.jetbrains.kotlin.test.TestJdkKind +import java.io.File + +abstract class AbstractJdk9BlackBoxCodegenTest : AbstractCustomJDKBlackBoxCodegenTest() { + override fun getTestJdkKind(): TestJdkKind = TestJdkKind.FULL_JDK_9 + override fun getJdkHome(): File = KotlinTestUtils.getJdk9Home() + override fun getPrefix(): String = "java9/box" +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/Java9CodegenTest.kt b/compiler/tests/org/jetbrains/kotlin/codegen/Java9CodegenTest.kt deleted file mode 100644 index d4fd2582610..00000000000 --- a/compiler/tests/org/jetbrains/kotlin/codegen/Java9CodegenTest.kt +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.codegen - -import org.jetbrains.kotlin.cli.common.output.writeAll -import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime -import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils -import org.jetbrains.kotlin.test.ConfigurationKind -import org.jetbrains.kotlin.test.KotlinTestUtils -import org.jetbrains.kotlin.test.TestJdkKind -import java.io.File -import java.util.concurrent.TimeUnit - -// TODO: merge into main codegen box tests somehow -class Java9CodegenTest : AbstractBlackBoxCodegenTest() { - override fun setUp() { - super.setUp() - val fileName = KotlinTestUtils.getTestDataPathBase() + "/codegen/" + prefix + "/" + getTestName(true) + ".kt" - val testFile = TestFile(fileName, File(fileName).readText()) - createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.NO_KOTLIN_REFLECT, listOf(testFile), TestJdkKind.FULL_JDK_9) - } - - override fun getPrefix(): String = "java9/box" - - override fun blackBox(reportFailures: Boolean) { - val tmpdir = KotlinTestUtils.tmpDirForTest(this) - generateClassesInFile().writeAll(tmpdir, null) - - val jdk9Home = KotlinTestUtils.getJdk9Home() - val javaExe = File(jdk9Home, "bin/java.exe").takeIf(File::exists) - ?: File(jdk9Home, "bin/java").takeIf(File::exists) - ?: error("Can't find 'java' executable in $jdk9Home") - - val command = arrayOf( - javaExe.absolutePath, - "-ea", - "-classpath", - listOf(tmpdir, ForTestCompileRuntime.runtimeJarForTests()).joinToString(File.pathSeparator, transform = File::getAbsolutePath), - PackagePartClassUtils.getFilePartShortName(getTestName(false)) - ) - - val process = ProcessBuilder(*command).inheritIO().start() - process.waitFor(1, TimeUnit.MINUTES) - assertEquals(0, process.exitValue()) - } - - fun testVarHandle() { - loadFile() - blackBox(true) - } - - fun testConcatDynamic() { - loadFile() - blackBox(true) - } - - fun testConcatDynamic200() { - loadFile() - blackBox(true) - } - - fun testConcatDynamic201() { - loadFile() - blackBox(true) - } - - fun testConcatDynamicIndy200() { - loadFile() - blackBox(true) - } - - fun testConcatDynamicIndy201() { - loadFile() - blackBox(true) - } - - fun testConcatDynamicWithInline() { - loadFile() - blackBox(true) - } - - fun testConcatDynamicInlineClasses() { - loadFile() - blackBox(true) - } -} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/Jdk9BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/Jdk9BlackBoxCodegenTestGenerated.java new file mode 100644 index 00000000000..59349e24c79 --- /dev/null +++ b/compiler/tests/org/jetbrains/kotlin/codegen/Jdk9BlackBoxCodegenTestGenerated.java @@ -0,0 +1,70 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.codegen; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("compiler/testData/codegen/java9/box") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class Jdk9BlackBoxCodegenTestGenerated extends AbstractJdk9BlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInBox() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/java9/box"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("concatDynamic.kt") + public void testConcatDynamic() throws Exception { + runTest("compiler/testData/codegen/java9/box/concatDynamic.kt"); + } + + @TestMetadata("concatDynamic200.kt") + public void testConcatDynamic200() throws Exception { + runTest("compiler/testData/codegen/java9/box/concatDynamic200.kt"); + } + + @TestMetadata("concatDynamic201.kt") + public void testConcatDynamic201() throws Exception { + runTest("compiler/testData/codegen/java9/box/concatDynamic201.kt"); + } + + @TestMetadata("concatDynamicIndy200.kt") + public void testConcatDynamicIndy200() throws Exception { + runTest("compiler/testData/codegen/java9/box/concatDynamicIndy200.kt"); + } + + @TestMetadata("concatDynamicIndy201.kt") + public void testConcatDynamicIndy201() throws Exception { + runTest("compiler/testData/codegen/java9/box/concatDynamicIndy201.kt"); + } + + @TestMetadata("concatDynamicInlineClasses.kt") + public void testConcatDynamicInlineClasses() throws Exception { + runTest("compiler/testData/codegen/java9/box/concatDynamicInlineClasses.kt"); + } + + @TestMetadata("concatDynamicWithInline.kt") + public void testConcatDynamicWithInline() throws Exception { + runTest("compiler/testData/codegen/java9/box/concatDynamicWithInline.kt"); + } + + @TestMetadata("varHandle.kt") + public void testVarHandle() throws Exception { + runTest("compiler/testData/codegen/java9/box/varHandle.kt"); + } +} diff --git a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt index 55105acc4af..f06e2aba8f4 100644 --- a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt +++ b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt @@ -215,6 +215,10 @@ fun main(args: Array) { model("codegen/java15/box") } + testClass { + model("codegen/java9/box") + } + testClass { model("codegen/script", extension = "kts") } From 4f5db241eaa6622c7f199ec51307b27558ff9b94 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Wed, 25 Nov 2020 12:54:40 +0300 Subject: [PATCH 508/698] Add @JvmRecord annotation and relevant diagnostics ^KT-43677 In Progress --- .../jvm/annotations/jvmAnnotationUtil.kt | 3 + .../checkers/JvmRecordApplicabilityChecker.kt | 67 +++++++++++++++++++ .../diagnostics/DefaultErrorMessagesJvm.java | 5 ++ .../resolve/jvm/diagnostics/ErrorsJvm.java | 5 ++ .../jvm/platform/JvmPlatformConfigurator.kt | 1 + .../testsWithJava15/jvmRecord/diagnostics.kt | 34 ++++++++++ .../jvmRecord/disabledFeature.kt | 9 +++ .../AbstractDiagnosticsWithJdk15Test.kt | 5 ++ .../DiagnosticsWithJdk15TestGenerated.java | 24 ++++++- .../kotlin/config/LanguageVersionSettings.kt | 1 + .../common/src/kotlin/JvmAnnotationsH.kt | 11 ++- .../jvm/annotations/JvmPlatformAnnotations.kt | 10 ++- .../kotlin-stdlib-runtime-merged.txt | 3 + 13 files changed, 173 insertions(+), 5 deletions(-) create mode 100644 compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt create mode 100644 compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt create mode 100644 compiler/testData/diagnostics/testsWithJava15/jvmRecord/disabledFeature.kt diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/annotations/jvmAnnotationUtil.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/annotations/jvmAnnotationUtil.kt index 8ed167fb0ae..c0b9bdc1a7a 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/annotations/jvmAnnotationUtil.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/annotations/jvmAnnotationUtil.kt @@ -23,6 +23,7 @@ val JVM_OVERLOADS_FQ_NAME = FqName("kotlin.jvm.JvmOverloads") @JvmField val JVM_SYNTHETIC_ANNOTATION_FQ_NAME = FqName("kotlin.jvm.JvmSynthetic") +val JVM_RECORD_ANNOTATION_FQ_NAME = FqName("kotlin.jvm.JvmRecord") @JvmField val SYNCHRONIZED_ANNOTATION_FQ_NAME = FqName("kotlin.jvm.Synchronized") @@ -92,3 +93,5 @@ fun DeclarationDescriptor.findStrictfpAnnotation(): AnnotationDescriptor? = fun DeclarationDescriptor.findSynchronizedAnnotation(): AnnotationDescriptor? = annotations.findAnnotation(SYNCHRONIZED_ANNOTATION_FQ_NAME) + +fun ClassDescriptor.isJvmRecord(): Boolean = annotations.hasAnnotation(JVM_RECORD_ANNOTATION_FQ_NAME) diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt new file mode 100644 index 00000000000..cde02cbecff --- /dev/null +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt @@ -0,0 +1,67 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.resolve.jvm.checkers + +import org.jetbrains.kotlin.config.LanguageFeature +import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.descriptors.DeclarationDescriptor +import org.jetbrains.kotlin.diagnostics.Errors +import org.jetbrains.kotlin.psi.KtClassOrObject +import org.jetbrains.kotlin.psi.KtDeclaration +import org.jetbrains.kotlin.resolve.DescriptorUtils +import org.jetbrains.kotlin.resolve.checkers.DeclarationChecker +import org.jetbrains.kotlin.resolve.checkers.DeclarationCheckerContext +import org.jetbrains.kotlin.resolve.jvm.annotations.JVM_RECORD_ANNOTATION_FQ_NAME +import org.jetbrains.kotlin.resolve.jvm.annotations.isJvmRecord +import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm + +object JvmRecordApplicabilityChecker : DeclarationChecker { + override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) { + if (descriptor !is ClassDescriptor || declaration !is KtClassOrObject || !descriptor.isJvmRecord()) return + + val reportOn = + declaration.annotationEntries.firstOrNull { it.shortName == JVM_RECORD_ANNOTATION_FQ_NAME.shortName() } + ?: declaration + + if (!context.languageVersionSettings.supportsFeature(LanguageFeature.JvmRecordSupport)) { + context.trace.report( + Errors.UNSUPPORTED_FEATURE.on( + reportOn, + LanguageFeature.JvmRecordSupport to context.languageVersionSettings + ) + ) + return + } + + if (DescriptorUtils.isLocal(descriptor)) { + context.trace.report(ErrorsJvm.LOCAL_JVM_RECORD.on(reportOn)) + return + } + + val primaryConstructor = declaration.primaryConstructor + val parameters = primaryConstructor?.valueParameters ?: emptyList() + if (parameters.isEmpty()) { + (primaryConstructor?.valueParameterList ?: declaration.nameIdentifier)?.let { + context.trace.report(ErrorsJvm.JVM_RECORD_WITHOUT_PRIMARY_CONSTRUCTOR_PARAMETERS.on(it)) + return + } + } + + for (parameter in parameters) { + if (!parameter.hasValOrVar() || parameter.isMutable) { + context.trace.report(ErrorsJvm.JVM_RECORD_NOT_VAL_PARAMETER.on(parameter)) + return + } + } + + for (parameter in parameters.dropLast(1)) { + if (parameter.isVarArg) { + context.trace.report(ErrorsJvm.JVM_RECORD_NOT_LAST_VARARG_PARAMETER.on(parameter)) + return + } + } + } +} diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java index 206dc2d47fd..5b18c715464 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java @@ -152,6 +152,11 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension { MAP.put(SUSPENSION_POINT_INSIDE_MONITOR, "A suspension point at {0} is inside a critical section", STRING); MAP.put(SUSPENSION_POINT_INSIDE_CRITICAL_SECTION, "The ''{0}'' suspension point is inside a critical section", NAME); + MAP.put(LOCAL_JVM_RECORD, "Local @JvmRecord classes are not allowed"); + MAP.put(JVM_RECORD_WITHOUT_PRIMARY_CONSTRUCTOR_PARAMETERS, "Primary constructor with parameters is required for @JvmRecord class"); + MAP.put(JVM_RECORD_NOT_VAL_PARAMETER, "Constructor parameter of @JvmRecord class should be a val"); + MAP.put(JVM_RECORD_NOT_LAST_VARARG_PARAMETER, "Only the last constructor parameter of @JvmRecord may be a vararg"); + String MESSAGE_FOR_CONCURRENT_HASH_MAP_CONTAINS = "Method 'contains' from ConcurrentHashMap may have unexpected semantics: it calls 'containsValue' instead of 'containsKey'. " + "Use explicit form of the call to 'containsKey'/'containsValue'/'contains' or cast the value to kotlin.collections.Map instead. " + diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java index d83fb0af60f..63068b5a065 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java @@ -115,6 +115,11 @@ public interface ErrorsJvm { DiagnosticFactory0 JVM_DEFAULT_THROUGH_INHERITANCE = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); DiagnosticFactory0 USAGE_OF_JVM_DEFAULT_THROUGH_SUPER_CALL = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 LOCAL_JVM_RECORD = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 JVM_RECORD_WITHOUT_PRIMARY_CONSTRUCTOR_PARAMETERS = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 JVM_RECORD_NOT_VAL_PARAMETER = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 JVM_RECORD_NOT_LAST_VARARG_PARAMETER = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 NON_JVM_DEFAULT_OVERRIDES_JAVA_DEFAULT = DiagnosticFactory0.create(WARNING, DECLARATION_SIGNATURE); DiagnosticFactory0 EXPLICIT_METADATA_IS_DISALLOWED = DiagnosticFactory0.create(ERROR); diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/platform/JvmPlatformConfigurator.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/platform/JvmPlatformConfigurator.kt index 0193fe88314..1154a8cfe6c 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/platform/JvmPlatformConfigurator.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/platform/JvmPlatformConfigurator.kt @@ -42,6 +42,7 @@ object JvmPlatformConfigurator : PlatformConfiguratorBase( SynchronizedOnInlineMethodChecker, DefaultCheckerInTailrec, FunctionDelegateMemberNameClashChecker, + JvmRecordApplicabilityChecker ), additionalCallCheckers = listOf( diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt new file mode 100644 index 00000000000..11d96263680 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt @@ -0,0 +1,34 @@ +// !LANGUAGE: +JvmRecordSupport +// SKIP_TXT + +@JvmRecord +class A0 + +@JvmRecord +class A1 { + constructor() +} + +@JvmRecord +class A2() + +@JvmRecord +class A3(name: String) + +@JvmRecord +class A4(var name: String) + +@JvmRecord +class A5(vararg val name: String, y: Int) + +@JvmRecord +class A6( + val x: String, + val y: Int, + vararg val z: Double, +) + +fun main() { + @JvmRecord + class Local +} diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/disabledFeature.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/disabledFeature.kt new file mode 100644 index 00000000000..51212af265b --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/disabledFeature.kt @@ -0,0 +1,9 @@ +// !LANGUAGE: -JvmRecordSupport +// SKIP_TXT + +@JvmRecord +class MyRec( + val x: String, + val y: Int, + vararg val z: Double, +) diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsWithJdk15Test.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsWithJdk15Test.kt index 12c227f4d59..186b4b836d9 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsWithJdk15Test.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsWithJdk15Test.kt @@ -15,6 +15,7 @@ */ package org.jetbrains.kotlin.checkers +import org.jetbrains.kotlin.test.ConfigurationKind import org.jetbrains.kotlin.test.TestJdkKind abstract class AbstractDiagnosticsWithJdk15Test : AbstractDiagnosticsTest() { @@ -22,4 +23,8 @@ abstract class AbstractDiagnosticsWithJdk15Test : AbstractDiagnosticsTest() { override fun getTestJdkKind(files: List): TestJdkKind { return TestJdkKind.FULL_JDK_15 } + + override fun extractConfigurationKind(files: List): ConfigurationKind { + return ConfigurationKind.ALL + } } diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java index c2c94de340e..b54808d7415 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java @@ -28,8 +28,26 @@ public class DiagnosticsWithJdk15TestGenerated extends AbstractDiagnosticsWithJd KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJava15"), Pattern.compile("^(.+)\\.kt$"), null, true); } - @TestMetadata("simpleRecords.kt") - public void testSimpleRecords() throws Exception { - runTest("compiler/testData/diagnostics/testsWithJava15/simpleRecords.kt"); + @TestMetadata("compiler/testData/diagnostics/testsWithJava15/jvmRecord") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class JvmRecord extends AbstractDiagnosticsWithJdk15Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInJvmRecord() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJava15/jvmRecord"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("diagnostics.kt") + public void testDiagnostics() throws Exception { + runTest("compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt"); + } + + @TestMetadata("disabledFeature.kt") + public void testDisabledFeature() throws Exception { + runTest("compiler/testData/diagnostics/testsWithJava15/jvmRecord/disabledFeature.kt"); + } } } diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index 682b69ae7bd..c64025f7364 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -141,6 +141,7 @@ enum class LanguageFeature( ForbidAnonymousReturnTypesInPrivateInlineFunctions(KOTLIN_1_5, kind = BUG_FIX), ForbidReferencingToUnderscoreNamedParameterOfCatchBlock(KOTLIN_1_5, kind = BUG_FIX), UseCorrectExecutionOrderForVarargArguments(KOTLIN_1_5, kind = BUG_FIX), + JvmRecordSupport(KOTLIN_1_5), // Temporarily disabled, see KT-27084/KT-22379 SoundSmartcastFromLoopConditionForLoopAssignedVariables(sinceVersion = null, kind = BUG_FIX), diff --git a/libraries/stdlib/common/src/kotlin/JvmAnnotationsH.kt b/libraries/stdlib/common/src/kotlin/JvmAnnotationsH.kt index a51356b3200..99956bdf2ee 100644 --- a/libraries/stdlib/common/src/kotlin/JvmAnnotationsH.kt +++ b/libraries/stdlib/common/src/kotlin/JvmAnnotationsH.kt @@ -113,6 +113,14 @@ public expect annotation class JvmWildcard() @OptionalExpectation public expect annotation class JvmInline() +/** + * Instructs compiler to mark the class as a record and generate relevant toString/equals/hashCode methods + */ +@Target(AnnotationTarget.CLASS) +@MustBeDocumented +@OptionalExpectation +public expect annotation class JvmRecord + /** * Marks the JVM backing field of the annotated property as `volatile`, meaning that writes to this field * are immediately made visible to other threads. @@ -157,4 +165,5 @@ public expect annotation class Synchronized() @MustBeDocumented @SinceKotlin("1.2") @OptionalExpectation -internal expect annotation class JvmPackageName(val name: String) \ No newline at end of file +internal expect annotation class JvmPackageName(val name: String) + diff --git a/libraries/stdlib/jvm/runtime/kotlin/jvm/annotations/JvmPlatformAnnotations.kt b/libraries/stdlib/jvm/runtime/kotlin/jvm/annotations/JvmPlatformAnnotations.kt index 92015204695..a96202d3ec1 100644 --- a/libraries/stdlib/jvm/runtime/kotlin/jvm/annotations/JvmPlatformAnnotations.kt +++ b/libraries/stdlib/jvm/runtime/kotlin/jvm/annotations/JvmPlatformAnnotations.kt @@ -144,4 +144,12 @@ public actual annotation class JvmWildcard @Retention(AnnotationRetention.RUNTIME) @MustBeDocumented @SinceKotlin("1.5") -public actual annotation class JvmInline \ No newline at end of file +public actual annotation class JvmInline + +/** + * Instructs compiler to mark the class as a record and generate relevant toString/equals/hashCode methods + */ +@Target(AnnotationTarget.CLASS) +@Retention(AnnotationRetention.SOURCE) +@MustBeDocumented +public actual annotation class JvmRecord diff --git a/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-runtime-merged.txt b/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-runtime-merged.txt index 97eb0e92f0c..8e87548bb66 100644 --- a/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-runtime-merged.txt +++ b/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-runtime-merged.txt @@ -3250,6 +3250,9 @@ public abstract interface annotation class kotlin/jvm/JvmName : java/lang/annota public abstract interface annotation class kotlin/jvm/JvmOverloads : java/lang/annotation/Annotation { } +public abstract interface annotation class kotlin/jvm/JvmRecord : java/lang/annotation/Annotation { +} + public abstract interface annotation class kotlin/jvm/JvmStatic : java/lang/annotation/Annotation { } From 85962d8312ff940db7e772cf526186358fe4de72 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Wed, 25 Nov 2020 18:20:55 +0300 Subject: [PATCH 509/698] Add check that @JvmRecord classes cannot inherit other classes ^KT-43677 In Progress --- .../kotlin/resolve/jvm/JdkClasses.kt | 10 ++++ .../checkers/JvmRecordApplicabilityChecker.kt | 12 +++++ .../diagnostics/DefaultErrorMessagesJvm.java | 1 + .../resolve/jvm/diagnostics/ErrorsJvm.java | 1 + .../jvmRecord/supertypesCheck.kt | 19 +++++++ .../jvmRecord/supertypesCheck.txt | 54 +++++++++++++++++++ .../DiagnosticsWithJdk15TestGenerated.java | 5 ++ 7 files changed, 102 insertions(+) create mode 100644 compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/JdkClasses.kt create mode 100644 compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt create mode 100644 compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.txt diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/JdkClasses.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/JdkClasses.kt new file mode 100644 index 00000000000..57a07930bf5 --- /dev/null +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/JdkClasses.kt @@ -0,0 +1,10 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.resolve.jvm + +import org.jetbrains.kotlin.name.FqName + +val JAVA_LANG_RECORD_FQ_NAME = FqName("java.lang.Record") diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt index cde02cbecff..9adc7a58165 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.resolve.jvm.checkers import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.diagnostics.Errors import org.jetbrains.kotlin.psi.KtClassOrObject @@ -14,6 +15,8 @@ import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.checkers.DeclarationChecker import org.jetbrains.kotlin.resolve.checkers.DeclarationCheckerContext +import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe +import org.jetbrains.kotlin.resolve.jvm.JAVA_LANG_RECORD_FQ_NAME import org.jetbrains.kotlin.resolve.jvm.annotations.JVM_RECORD_ANNOTATION_FQ_NAME import org.jetbrains.kotlin.resolve.jvm.annotations.isJvmRecord import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm @@ -63,5 +66,14 @@ object JvmRecordApplicabilityChecker : DeclarationChecker { return } } + + for (supertype in descriptor.typeConstructor.supertypes) { + val classDescriptor = supertype.constructor.declarationDescriptor as? ClassDescriptor ?: continue + if (classDescriptor.kind == ClassKind.INTERFACE || classDescriptor.fqNameSafe == JAVA_LANG_RECORD_FQ_NAME) continue + + val reportSupertypeOn = declaration.nameIdentifier ?: declaration + context.trace.report(ErrorsJvm.JVM_RECORD_EXTENDS_CLASS.on(reportSupertypeOn, supertype)) + return + } } } diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java index 5b18c715464..a3331c99177 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java @@ -156,6 +156,7 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension { MAP.put(JVM_RECORD_WITHOUT_PRIMARY_CONSTRUCTOR_PARAMETERS, "Primary constructor with parameters is required for @JvmRecord class"); MAP.put(JVM_RECORD_NOT_VAL_PARAMETER, "Constructor parameter of @JvmRecord class should be a val"); MAP.put(JVM_RECORD_NOT_LAST_VARARG_PARAMETER, "Only the last constructor parameter of @JvmRecord may be a vararg"); + MAP.put(JVM_RECORD_EXTENDS_CLASS, "Record cannot inherit an other class but java.lang.Record" , RENDER_TYPE); String MESSAGE_FOR_CONCURRENT_HASH_MAP_CONTAINS = "Method 'contains' from ConcurrentHashMap may have unexpected semantics: it calls 'containsValue' instead of 'containsKey'. " + diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java index 63068b5a065..dd2c8e72897 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java @@ -119,6 +119,7 @@ public interface ErrorsJvm { DiagnosticFactory0 JVM_RECORD_WITHOUT_PRIMARY_CONSTRUCTOR_PARAMETERS = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 JVM_RECORD_NOT_VAL_PARAMETER = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 JVM_RECORD_NOT_LAST_VARARG_PARAMETER = DiagnosticFactory0.create(ERROR); + DiagnosticFactory1 JVM_RECORD_EXTENDS_CLASS = DiagnosticFactory1.create(ERROR); DiagnosticFactory0 NON_JVM_DEFAULT_OVERRIDES_JAVA_DEFAULT = DiagnosticFactory0.create(WARNING, DECLARATION_SIGNATURE); diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt new file mode 100644 index 00000000000..0dcb9c4ea0f --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt @@ -0,0 +1,19 @@ +// !LANGUAGE: +JvmRecordSupport + +abstract class Abstract +interface I + +@JvmRecord +class A1(val x: String) : Abstract(), I + +@JvmRecord +class A2(val x: String) : Any(), I + +@JvmRecord +class A3(val x: String) : Record(), I + +@JvmRecord +class A4(val x: String) : java.lang.Record(), I + +@JvmRecord +class A5(val x: String) : I diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.txt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.txt new file mode 100644 index 00000000000..ae493fa8619 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.txt @@ -0,0 +1,54 @@ +package + +@kotlin.jvm.JvmRecord public final class A1 : Abstract, I, java.lang.Record { + public constructor A1(/*0*/ x: kotlin.String) + public final val x: kotlin.String + public open override /*3*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*3*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*3*/ /*synthesized*/ fun toString(): kotlin.String +} + +@kotlin.jvm.JvmRecord public final class A2 : kotlin.Any, I, java.lang.Record { + public constructor A2(/*0*/ x: kotlin.String) + public final val x: kotlin.String + public open override /*3*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*3*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*3*/ /*synthesized*/ fun toString(): kotlin.String +} + +@kotlin.jvm.JvmRecord public final class A3 : java.lang.Record, I { + public constructor A3(/*0*/ x: kotlin.String) + public final val x: kotlin.String + public open override /*2*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*2*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*2*/ /*synthesized*/ fun toString(): kotlin.String +} + +@kotlin.jvm.JvmRecord public final class A4 : java.lang.Record, I { + public constructor A4(/*0*/ x: kotlin.String) + public final val x: kotlin.String + public open override /*2*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*2*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*2*/ /*synthesized*/ fun toString(): kotlin.String +} + +@kotlin.jvm.JvmRecord public final class A5 : I, java.lang.Record { + public constructor A5(/*0*/ x: kotlin.String) + public final val x: kotlin.String + public open override /*2*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*2*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*2*/ /*synthesized*/ fun toString(): kotlin.String +} + +public abstract class Abstract { + public constructor Abstract() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface I { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java index b54808d7415..372d0000bdb 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java @@ -49,5 +49,10 @@ public class DiagnosticsWithJdk15TestGenerated extends AbstractDiagnosticsWithJd public void testDisabledFeature() throws Exception { runTest("compiler/testData/diagnostics/testsWithJava15/jvmRecord/disabledFeature.kt"); } + + @TestMetadata("supertypesCheck.kt") + public void testSupertypesCheck() throws Exception { + runTest("compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt"); + } } } From d4de2c4dced4af441289fa0ae25ed9c135c1d651 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Wed, 25 Nov 2020 18:36:14 +0300 Subject: [PATCH 510/698] Add check that we have JDK 15 in classpath when using @JvmRecord ^KT-43677 In Progress --- ...FirOldFrontendDiagnosticsTestWithStdlibGenerated.java | 5 +++++ .../jvm/checkers/JvmRecordApplicabilityChecker.kt | 7 +++++++ .../resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java | 1 + .../kotlin/resolve/jvm/diagnostics/ErrorsJvm.java | 1 + .../annotations/jvmRecordWithoutJdk15.fir.kt | 9 +++++++++ .../testsWithStdLib/annotations/jvmRecordWithoutJdk15.kt | 9 +++++++++ .../checkers/DiagnosticsTestWithStdLibGenerated.java | 5 +++++ .../DiagnosticsTestWithStdLibUsingJavacGenerated.java | 5 +++++ 8 files changed, 42 insertions(+) create mode 100644 compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.fir.kt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.kt diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java index f9b31e8be6c..f9f25fdec03 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java @@ -201,6 +201,11 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/explicitMetadata.kt"); } + @TestMetadata("jvmRecordWithoutJdk15.kt") + public void testJvmRecordWithoutJdk15() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.kt"); + } + @TestMetadata("JvmSyntheticOnDelegate.kt") public void testJvmSyntheticOnDelegate() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/JvmSyntheticOnDelegate.kt"); diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt index 9adc7a58165..26283c25c3b 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt @@ -10,12 +10,14 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.diagnostics.Errors +import org.jetbrains.kotlin.incremental.components.NoLookupLocation import org.jetbrains.kotlin.psi.KtClassOrObject import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.checkers.DeclarationChecker import org.jetbrains.kotlin.resolve.checkers.DeclarationCheckerContext import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe +import org.jetbrains.kotlin.resolve.descriptorUtil.resolveTopLevelClass import org.jetbrains.kotlin.resolve.jvm.JAVA_LANG_RECORD_FQ_NAME import org.jetbrains.kotlin.resolve.jvm.annotations.JVM_RECORD_ANNOTATION_FQ_NAME import org.jetbrains.kotlin.resolve.jvm.annotations.isJvmRecord @@ -29,6 +31,11 @@ object JvmRecordApplicabilityChecker : DeclarationChecker { declaration.annotationEntries.firstOrNull { it.shortName == JVM_RECORD_ANNOTATION_FQ_NAME.shortName() } ?: declaration + if (context.moduleDescriptor.resolveTopLevelClass(JAVA_LANG_RECORD_FQ_NAME, NoLookupLocation.FOR_DEFAULT_IMPORTS) == null) { + context.trace.report(ErrorsJvm.JVM_RECORD_REQUIRES_JDK15.on(reportOn)) + return + } + if (!context.languageVersionSettings.supportsFeature(LanguageFeature.JvmRecordSupport)) { context.trace.report( Errors.UNSUPPORTED_FEATURE.on( diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java index a3331c99177..55a5378d8c1 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java @@ -157,6 +157,7 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension { MAP.put(JVM_RECORD_NOT_VAL_PARAMETER, "Constructor parameter of @JvmRecord class should be a val"); MAP.put(JVM_RECORD_NOT_LAST_VARARG_PARAMETER, "Only the last constructor parameter of @JvmRecord may be a vararg"); MAP.put(JVM_RECORD_EXTENDS_CLASS, "Record cannot inherit an other class but java.lang.Record" , RENDER_TYPE); + MAP.put(JVM_RECORD_REQUIRES_JDK15, "Using @JvmRecords requires at least JDK 15"); String MESSAGE_FOR_CONCURRENT_HASH_MAP_CONTAINS = "Method 'contains' from ConcurrentHashMap may have unexpected semantics: it calls 'containsValue' instead of 'containsKey'. " + diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java index dd2c8e72897..13b4606b1e5 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java @@ -120,6 +120,7 @@ public interface ErrorsJvm { DiagnosticFactory0 JVM_RECORD_NOT_VAL_PARAMETER = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 JVM_RECORD_NOT_LAST_VARARG_PARAMETER = DiagnosticFactory0.create(ERROR); DiagnosticFactory1 JVM_RECORD_EXTENDS_CLASS = DiagnosticFactory1.create(ERROR); + DiagnosticFactory0 JVM_RECORD_REQUIRES_JDK15 = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 NON_JVM_DEFAULT_OVERRIDES_JAVA_DEFAULT = DiagnosticFactory0.create(WARNING, DECLARATION_SIGNATURE); diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.fir.kt new file mode 100644 index 00000000000..a9d577ce323 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.fir.kt @@ -0,0 +1,9 @@ +// !LANGUAGE: +JvmRecordSupport +// SKIP_TXT + +@JvmRecord +class MyRec( + val x: String, + val y: Int, + vararg val z: Double, +) diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.kt new file mode 100644 index 00000000000..8012ef2fdcb --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.kt @@ -0,0 +1,9 @@ +// !LANGUAGE: +JvmRecordSupport +// SKIP_TXT + +@JvmRecord +class MyRec( + val x: String, + val y: Int, + vararg val z: Double, +) diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java index 102b487a90c..8889dc53890 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java @@ -201,6 +201,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/explicitMetadata.kt"); } + @TestMetadata("jvmRecordWithoutJdk15.kt") + public void testJvmRecordWithoutJdk15() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.kt"); + } + @TestMetadata("JvmSyntheticOnDelegate.kt") public void testJvmSyntheticOnDelegate() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/JvmSyntheticOnDelegate.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java index 25a24d11639..d4ef163daa6 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java @@ -201,6 +201,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/explicitMetadata.kt"); } + @TestMetadata("jvmRecordWithoutJdk15.kt") + public void testJvmRecordWithoutJdk15() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.kt"); + } + @TestMetadata("JvmSyntheticOnDelegate.kt") public void testJvmSyntheticOnDelegate() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/JvmSyntheticOnDelegate.kt"); From ca2e199b53eb240dd1df3fb26d3d5a02545afbb7 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Wed, 25 Nov 2020 18:40:01 +0300 Subject: [PATCH 511/698] Minor. Move @JvmRecord tests to relevant directory ^KT-43677 In Progress --- .../testsWithJava15/{ => jvmRecord}/simpleRecords.kt | 0 .../testsWithJava15/{ => jvmRecord}/simpleRecords.txt | 0 .../kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java | 5 +++++ 3 files changed, 5 insertions(+) rename compiler/testData/diagnostics/testsWithJava15/{ => jvmRecord}/simpleRecords.kt (100%) rename compiler/testData/diagnostics/testsWithJava15/{ => jvmRecord}/simpleRecords.txt (100%) diff --git a/compiler/testData/diagnostics/testsWithJava15/simpleRecords.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/simpleRecords.kt similarity index 100% rename from compiler/testData/diagnostics/testsWithJava15/simpleRecords.kt rename to compiler/testData/diagnostics/testsWithJava15/jvmRecord/simpleRecords.kt diff --git a/compiler/testData/diagnostics/testsWithJava15/simpleRecords.txt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/simpleRecords.txt similarity index 100% rename from compiler/testData/diagnostics/testsWithJava15/simpleRecords.txt rename to compiler/testData/diagnostics/testsWithJava15/jvmRecord/simpleRecords.txt diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java index 372d0000bdb..453580a3942 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java @@ -50,6 +50,11 @@ public class DiagnosticsWithJdk15TestGenerated extends AbstractDiagnosticsWithJd runTest("compiler/testData/diagnostics/testsWithJava15/jvmRecord/disabledFeature.kt"); } + @TestMetadata("simpleRecords.kt") + public void testSimpleRecords() throws Exception { + runTest("compiler/testData/diagnostics/testsWithJava15/jvmRecord/simpleRecords.kt"); + } + @TestMetadata("supertypesCheck.kt") public void testSupertypesCheck() throws Exception { runTest("compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt"); From bef50c0342d54d126c29d8e5627e44e29be8e869 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Wed, 25 Nov 2020 18:42:51 +0300 Subject: [PATCH 512/698] Correct descriptor shape for @JvmRecord annotated classes This commit adds relevant functions: hashCode, toString, equals (if the class is not a data class) And supertype j.l.Record It only affects descriptor contents, i.e. works for FE ^KT-43677 In Progress --- .../jvm/JvmAdditionalClassPartsProvider.kt | 49 +++++++++++++++++++ .../jvm/platform/JvmPlatformConfigurator.kt | 1 + .../kotlin/resolve/DescriptorResolver.java | 6 ++- .../kotlin/resolve/FunctionsFromAny.kt | 29 +++++++++-- .../kotlin/resolve/lazy/LazyClassContext.kt | 1 + .../kotlin/resolve/lazy/ResolveSession.java | 13 +++++ .../lazy/descriptors/LazyClassMemberScope.kt | 25 ++-------- .../expressions/LocalClassifierAnalyzer.kt | 11 +++-- .../jvmRecord/jvmRecordDescriptorStructure.kt | 11 +++++ .../jvmRecordDescriptorStructure.txt | 27 ++++++++++ .../DiagnosticsWithJdk15TestGenerated.java | 5 ++ .../resolve/AdditionalClassPartsProvider.kt | 44 +++++++++++++++++ 12 files changed, 193 insertions(+), 29 deletions(-) create mode 100644 compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/JvmAdditionalClassPartsProvider.kt create mode 100644 compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt create mode 100644 compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.txt create mode 100644 core/descriptors/src/org/jetbrains/kotlin/resolve/AdditionalClassPartsProvider.kt diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/JvmAdditionalClassPartsProvider.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/JvmAdditionalClassPartsProvider.kt new file mode 100644 index 00000000000..a3021869654 --- /dev/null +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/JvmAdditionalClassPartsProvider.kt @@ -0,0 +1,49 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.resolve.jvm + +import org.jetbrains.kotlin.builtins.KotlinBuiltIns +import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor +import org.jetbrains.kotlin.incremental.components.LookupLocation +import org.jetbrains.kotlin.incremental.components.NoLookupLocation +import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.resolve.AdditionalClassPartsProvider +import org.jetbrains.kotlin.resolve.FunctionsFromAny +import org.jetbrains.kotlin.resolve.descriptorUtil.module +import org.jetbrains.kotlin.resolve.descriptorUtil.resolveTopLevelClass +import org.jetbrains.kotlin.resolve.jvm.annotations.isJvmRecord +import org.jetbrains.kotlin.types.KotlinType + +class JvmAdditionalClassPartsProvider : AdditionalClassPartsProvider { + override fun generateAdditionalMethods( + thisDescriptor: ClassDescriptor, + result: MutableCollection, + name: Name, + location: LookupLocation, + fromSupertypes: Collection + ) { + if (thisDescriptor.isJvmRecord()) { + FunctionsFromAny.addFunctionFromAnyIfNeeded(thisDescriptor, result, name, fromSupertypes) + } + } + + override fun getAdditionalSupertypes( + thisDescriptor: ClassDescriptor, + existingSupertypes: List + ): List { + if (thisDescriptor.isJvmRecord() && existingSupertypes.none(::isJavaLangRecordType)) { + thisDescriptor.module.resolveTopLevelClass(JAVA_LANG_RECORD_FQ_NAME, NoLookupLocation.FOR_DEFAULT_IMPORTS)?.defaultType?.let { + return listOf(it) + } + } + + return emptyList() + } +} + +private fun isJavaLangRecordType(it: KotlinType) = + KotlinBuiltIns.isConstructedFromGivenClass(it, JAVA_LANG_RECORD_FQ_NAME) diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/platform/JvmPlatformConfigurator.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/platform/JvmPlatformConfigurator.kt index 1154a8cfe6c..efb12405a6a 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/platform/JvmPlatformConfigurator.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/platform/JvmPlatformConfigurator.kt @@ -110,6 +110,7 @@ object JvmPlatformConfigurator : PlatformConfiguratorBase( container.useImpl() container.useImpl() container.useImpl() + container.useImpl() container.useInstance(FunctionWithBigAritySupport.LanguageVersionDependent) container.useInstance(GenericArrayClassLiteralSupport.Enabled) container.useInstance(JavaActualAnnotationArgumentExtractor()) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java index c684d9fb48e..2714eeef1ff 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java @@ -92,6 +92,7 @@ public class DescriptorResolver { private final DeclarationReturnTypeSanitizer declarationReturnTypeSanitizer; private final DataFlowValueFactory dataFlowValueFactory; private final Iterable anonymousTypeTransformers; + private final AdditionalClassPartsProvider additionalClassPartsProvider; public DescriptorResolver( @NotNull AnnotationResolver annotationResolver, @@ -111,7 +112,8 @@ public class DescriptorResolver { @NotNull TypeApproximator approximator, @NotNull DeclarationReturnTypeSanitizer declarationReturnTypeSanitizer, @NotNull DataFlowValueFactory dataFlowValueFactory, - @NotNull Iterable anonymousTypeTransformers + @NotNull Iterable anonymousTypeTransformers, + @NotNull AdditionalClassPartsProvider additionalClassPartsProvider ) { this.annotationResolver = annotationResolver; this.builtIns = builtIns; @@ -131,6 +133,7 @@ public class DescriptorResolver { this.declarationReturnTypeSanitizer = declarationReturnTypeSanitizer; this.dataFlowValueFactory = dataFlowValueFactory; this.anonymousTypeTransformers = anonymousTypeTransformers; + this.additionalClassPartsProvider = additionalClassPartsProvider; } public List resolveSupertypes( @@ -156,6 +159,7 @@ public class DescriptorResolver { } syntheticResolveExtension.addSyntheticSupertypes(classDescriptor, supertypes); + supertypes.addAll(additionalClassPartsProvider.getAdditionalSupertypes(classDescriptor, supertypes)); if (supertypes.isEmpty()) { addValidSupertype(supertypes, getDefaultSupertype(classDescriptor)); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionsFromAny.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionsFromAny.kt index 1ccaaeadf23..ff2c838fb45 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionsFromAny.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionsFromAny.kt @@ -19,10 +19,29 @@ object FunctionsFromAny { val HASH_CODE_METHOD_NAME = Name.identifier("hashCode") val TO_STRING_METHOD_NAME = Name.identifier("toString") + fun addFunctionFromAnyIfNeeded( + thisDescriptor: ClassDescriptor, + result: MutableCollection, + name: Name, + fromSupertypes: Collection, + ) { + if (shouldAddEquals(name, result, fromSupertypes)) { + result.add(createEqualsFunctionDescriptor(thisDescriptor)) + } + + if (shouldAddHashCode(name, result, fromSupertypes)) { + result.add(createHashCodeFunctionDescriptor(thisDescriptor)) + } + + if (shouldAddToString(name, result, fromSupertypes)) { + result.add(createToStringFunctionDescriptor(thisDescriptor)) + } + } + fun shouldAddEquals( name: Name, declaredFunctions: Collection, - fromSupertypes: List + fromSupertypes: Collection ): Boolean { return name == EQUALS_METHOD_NAME && shouldAddFunctionFromAny( declaredFunctions, @@ -36,7 +55,7 @@ object FunctionsFromAny { fun shouldAddHashCode( name: Name, declaredFunctions: Collection, - fromSupertypes: List + fromSupertypes: Collection ): Boolean { return name == HASH_CODE_METHOD_NAME && shouldAddFunctionFromAny( declaredFunctions, @@ -49,7 +68,7 @@ object FunctionsFromAny { fun shouldAddToString( name: Name, declaredFunctions: Collection, - fromSupertypes: List + fromSupertypes: Collection ): Boolean { return name == TO_STRING_METHOD_NAME && shouldAddFunctionFromAny( declaredFunctions, @@ -90,8 +109,8 @@ object FunctionsFromAny { } private fun shouldAddFunctionFromAny( - declaredFunctions: Collection , - fromSupertypes: List, + declaredFunctions: Collection, + fromSupertypes: Collection, checkParameters: (FunctionDescriptor) -> Boolean ): Boolean { // Add 'equals', 'hashCode', 'toString' iff there is no such declared member AND there is no such final member in supertypes diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyClassContext.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyClassContext.kt index d5f5ed1b061..c0f217ee5b6 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyClassContext.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyClassContext.kt @@ -47,4 +47,5 @@ interface LazyClassContext { val wrappedTypeFactory: WrappedTypeFactory val kotlinTypeChecker: NewKotlinTypeChecker val samConversionResolver: SamConversionResolver + val additionalClassPartsProvider: AdditionalClassPartsProvider } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/ResolveSession.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/ResolveSession.java index a4ea5c5269f..cd86cb6e2a9 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/ResolveSession.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/ResolveSession.java @@ -86,6 +86,8 @@ public class ResolveSession implements KotlinCodeAnalyzer, LazyClassContext { private PlatformDiagnosticSuppressor platformDiagnosticSuppressor; private SamConversionResolver samConversionResolver; + private AdditionalClassPartsProvider additionalClassPartsProvider; + private final SyntheticResolveExtension syntheticResolveExtension; private final NewKotlinTypeChecker kotlinTypeChecker; @@ -157,6 +159,11 @@ public class ResolveSession implements KotlinCodeAnalyzer, LazyClassContext { this.samConversionResolver = samConversionResolver; } + @Inject + public void setAdditionalClassPartsProvider(@NotNull AdditionalClassPartsProvider additionalClassPartsProvider) { + this.additionalClassPartsProvider = additionalClassPartsProvider; + } + // Only calls from injectors expected @Deprecated public ResolveSession( @@ -500,4 +507,10 @@ public class ResolveSession implements KotlinCodeAnalyzer, LazyClassContext { public SamConversionResolver getSamConversionResolver() { return samConversionResolver; } + + @NotNull + @Override + public AdditionalClassPartsProvider getAdditionalClassPartsProvider() { + return additionalClassPartsProvider; + } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassMemberScope.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassMemberScope.kt index 089a712515c..1b96443b57e 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassMemberScope.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassMemberScope.kt @@ -250,6 +250,9 @@ open class LazyClassMemberScope( generateDataClassMethods(result, name, location, fromSupertypes) generateFunctionsFromAnyForInlineClass(result, name, fromSupertypes) c.syntheticResolveExtension.generateSyntheticMethods(thisDescriptor, name, trace.bindingContext, fromSupertypes, result) + + c.additionalClassPartsProvider.generateAdditionalMethods(thisDescriptor, result, name, location, fromSupertypes) + generateFakeOverrides(name, fromSupertypes, result, SimpleFunctionDescriptor::class.java) } @@ -259,7 +262,7 @@ open class LazyClassMemberScope( fromSupertypes: List ) { if (!thisDescriptor.isInlineClass()) return - addFunctionFromAnyIfNeeded(result, name, fromSupertypes) + FunctionsFromAny.addFunctionFromAnyIfNeeded(thisDescriptor, result, name, fromSupertypes) } private fun generateDataClassMethods( @@ -309,25 +312,7 @@ open class LazyClassMemberScope( } if (c.languageVersionSettings.supportsFeature(LanguageFeature.DataClassInheritance)) { - addFunctionFromAnyIfNeeded(result, name, fromSupertypes) - } - } - - private fun addFunctionFromAnyIfNeeded( - result: MutableCollection, - name: Name, - fromSupertypes: List - ) { - if (FunctionsFromAny.shouldAddEquals(name, result, fromSupertypes)) { - result.add(FunctionsFromAny.createEqualsFunctionDescriptor(thisDescriptor)) - } - - if (FunctionsFromAny.shouldAddHashCode(name, result, fromSupertypes)) { - result.add(FunctionsFromAny.createHashCodeFunctionDescriptor(thisDescriptor)) - } - - if (FunctionsFromAny.shouldAddToString(name, result, fromSupertypes)) { - result.add(FunctionsFromAny.createToStringFunctionDescriptor(thisDescriptor)) + FunctionsFromAny.addFunctionFromAnyIfNeeded(thisDescriptor, result, name, fromSupertypes) } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/LocalClassifierAnalyzer.kt b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/LocalClassifierAnalyzer.kt index 839ae065ee9..c92f40eb10c 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/LocalClassifierAnalyzer.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/LocalClassifierAnalyzer.kt @@ -69,7 +69,8 @@ class LocalClassifierAnalyzer( private val delegationFilter: DelegationFilter, private val wrappedTypeFactory: WrappedTypeFactory, private val kotlinTypeChecker: NewKotlinTypeChecker, - private val samConversionResolver: SamConversionResolver + private val samConversionResolver: SamConversionResolver, + private val additionalClassPartsProvider: AdditionalClassPartsProvider, ) { fun processClassOrObject( scope: LexicalWritableScope?, @@ -104,7 +105,8 @@ class LocalClassifierAnalyzer( delegationFilter, wrappedTypeFactory, kotlinTypeChecker, - samConversionResolver + samConversionResolver, + additionalClassPartsProvider, ), analyzerServices ) @@ -134,7 +136,8 @@ class LocalClassDescriptorHolder( val delegationFilter: DelegationFilter, val wrappedTypeFactory: WrappedTypeFactory, val kotlinTypeChecker: NewKotlinTypeChecker, - val samConversionResolver: SamConversionResolver + val samConversionResolver: SamConversionResolver, + val additionalClassPartsProvider: AdditionalClassPartsProvider, ) { // We do not need to synchronize here, because this code is used strictly from one thread private var classDescriptor: ClassDescriptor? = null @@ -176,6 +179,8 @@ class LocalClassDescriptorHolder( override val wrappedTypeFactory: WrappedTypeFactory = this@LocalClassDescriptorHolder.wrappedTypeFactory override val kotlinTypeChecker: NewKotlinTypeChecker = this@LocalClassDescriptorHolder.kotlinTypeChecker override val samConversionResolver: SamConversionResolver = this@LocalClassDescriptorHolder.samConversionResolver + override val additionalClassPartsProvider: AdditionalClassPartsProvider = + this@LocalClassDescriptorHolder.additionalClassPartsProvider }, containingDeclaration, classOrObject.nameAsSafeName, diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt new file mode 100644 index 00000000000..e2f2df9e5db --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt @@ -0,0 +1,11 @@ +// !LANGUAGE: +JvmRecordSupport + +@JvmRecord +class BasicRecord(val x: String) + +@JvmRecord +data class BasicDataRecord(val x: String) + +@JvmRecord +class BasicRecordWithSuperClass(val x: String) : Record() + diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.txt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.txt new file mode 100644 index 00000000000..5c4b0ada9f6 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.txt @@ -0,0 +1,27 @@ +package + +@kotlin.jvm.JvmRecord public final data class BasicDataRecord : java.lang.Record { + public constructor BasicDataRecord(/*0*/ x: kotlin.String) + public final val x: kotlin.String + public final operator /*synthesized*/ fun component1(): kotlin.String + public final /*synthesized*/ fun copy(/*0*/ x: kotlin.String = ...): BasicDataRecord + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String +} + +@kotlin.jvm.JvmRecord public final class BasicRecord : java.lang.Record { + public constructor BasicRecord(/*0*/ x: kotlin.String) + public final val x: kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String +} + +@kotlin.jvm.JvmRecord public final class BasicRecordWithSuperClass : java.lang.Record { + public constructor BasicRecordWithSuperClass(/*0*/ x: kotlin.String) + public final val x: kotlin.String + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String +} diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java index 453580a3942..80854b70acc 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java @@ -50,6 +50,11 @@ public class DiagnosticsWithJdk15TestGenerated extends AbstractDiagnosticsWithJd runTest("compiler/testData/diagnostics/testsWithJava15/jvmRecord/disabledFeature.kt"); } + @TestMetadata("jvmRecordDescriptorStructure.kt") + public void testJvmRecordDescriptorStructure() throws Exception { + runTest("compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt"); + } + @TestMetadata("simpleRecords.kt") public void testSimpleRecords() throws Exception { runTest("compiler/testData/diagnostics/testsWithJava15/jvmRecord/simpleRecords.kt"); diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/AdditionalClassPartsProvider.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/AdditionalClassPartsProvider.kt new file mode 100644 index 00000000000..6237006ea77 --- /dev/null +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/AdditionalClassPartsProvider.kt @@ -0,0 +1,44 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.resolve + +import org.jetbrains.kotlin.container.DefaultImplementation +import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor +import org.jetbrains.kotlin.incremental.components.LookupLocation +import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.types.KotlinType + +@DefaultImplementation(impl = AdditionalClassPartsProvider.Default::class) +interface AdditionalClassPartsProvider { + fun generateAdditionalMethods( + thisDescriptor: ClassDescriptor, + result: MutableCollection, + name: Name, + location: LookupLocation, + fromSupertypes: Collection + ) + + fun getAdditionalSupertypes( + thisDescriptor: ClassDescriptor, + existingSupertypes: List + ): List + + object Default : AdditionalClassPartsProvider { + override fun generateAdditionalMethods( + thisDescriptor: ClassDescriptor, + result: MutableCollection, + name: Name, + location: LookupLocation, + fromSupertypes: Collection + ) {} + + override fun getAdditionalSupertypes( + thisDescriptor: ClassDescriptor, + existingSupertypes: List + ): List = emptyList() + } +} From f6a3580c9342d287dc274da941ef580e5601a80a Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Thu, 26 Nov 2020 11:15:11 +0300 Subject: [PATCH 513/698] Add @JvmRecord diagnostics for open and enums ^KT-43677 In Progress --- .../checkers/JvmRecordApplicabilityChecker.kt | 29 +++++++++++++++++++ .../diagnostics/DefaultErrorMessagesJvm.java | 2 ++ .../resolve/jvm/diagnostics/ErrorsJvm.java | 2 ++ .../testsWithJava15/jvmRecord/diagnostics.kt | 16 +++++++++- 4 files changed, 48 insertions(+), 1 deletion(-) diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt index 26283c25c3b..9a84d7be9ad 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt @@ -5,14 +5,19 @@ package org.jetbrains.kotlin.resolve.jvm.checkers +import com.intellij.psi.PsiElement import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.descriptors.DeclarationDescriptor +import org.jetbrains.kotlin.descriptors.isFinalClass import org.jetbrains.kotlin.diagnostics.Errors import org.jetbrains.kotlin.incremental.components.NoLookupLocation +import org.jetbrains.kotlin.lexer.KtModifierKeywordToken +import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.KtClassOrObject import org.jetbrains.kotlin.psi.KtDeclaration +import org.jetbrains.kotlin.psi.KtModifierList import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.checkers.DeclarationChecker import org.jetbrains.kotlin.resolve.checkers.DeclarationCheckerContext @@ -22,6 +27,7 @@ import org.jetbrains.kotlin.resolve.jvm.JAVA_LANG_RECORD_FQ_NAME import org.jetbrains.kotlin.resolve.jvm.annotations.JVM_RECORD_ANNOTATION_FQ_NAME import org.jetbrains.kotlin.resolve.jvm.annotations.isJvmRecord import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm +import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult object JvmRecordApplicabilityChecker : DeclarationChecker { override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) { @@ -46,6 +52,26 @@ object JvmRecordApplicabilityChecker : DeclarationChecker { return } + if (descriptor.kind == ClassKind.ENUM_CLASS) { + val modifierOrName = + declaration.modifierList?.getModifier(KtTokens.ENUM_KEYWORD) + ?: declaration.nameIdentifier + ?: declaration + + context.trace.report(ErrorsJvm.ENUM_JVM_RECORD.on(modifierOrName)) + return + } + + if (!descriptor.isFinalClass) { + val modifierOrName = + declaration.modifierList?.findOneOfModifiers(KtTokens.ABSTRACT_KEYWORD, KtTokens.OPEN_KEYWORD, KtTokens.SEALED_KEYWORD) + ?: declaration.nameIdentifier + ?: declaration + + context.trace.report(ErrorsJvm.NON_FINAL_JVM_RECORD.on(modifierOrName)) + return + } + if (DescriptorUtils.isLocal(descriptor)) { context.trace.report(ErrorsJvm.LOCAL_JVM_RECORD.on(reportOn)) return @@ -84,3 +110,6 @@ object JvmRecordApplicabilityChecker : DeclarationChecker { } } } + +private fun KtModifierList.findOneOfModifiers(vararg modifierTokens: KtModifierKeywordToken): PsiElement? = + modifierTokens.firstNotNullResult(this::getModifier) diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java index 55a5378d8c1..1ccb32a1d24 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java @@ -153,6 +153,8 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension { MAP.put(SUSPENSION_POINT_INSIDE_CRITICAL_SECTION, "The ''{0}'' suspension point is inside a critical section", NAME); MAP.put(LOCAL_JVM_RECORD, "Local @JvmRecord classes are not allowed"); + MAP.put(NON_FINAL_JVM_RECORD, "@JvmRecord class should be final"); + MAP.put(ENUM_JVM_RECORD, "@JvmRecord class should not be an enum"); MAP.put(JVM_RECORD_WITHOUT_PRIMARY_CONSTRUCTOR_PARAMETERS, "Primary constructor with parameters is required for @JvmRecord class"); MAP.put(JVM_RECORD_NOT_VAL_PARAMETER, "Constructor parameter of @JvmRecord class should be a val"); MAP.put(JVM_RECORD_NOT_LAST_VARARG_PARAMETER, "Only the last constructor parameter of @JvmRecord may be a vararg"); diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java index 13b4606b1e5..999c15ac60c 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java @@ -116,6 +116,8 @@ public interface ErrorsJvm { DiagnosticFactory0 USAGE_OF_JVM_DEFAULT_THROUGH_SUPER_CALL = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 LOCAL_JVM_RECORD = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 NON_FINAL_JVM_RECORD = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 ENUM_JVM_RECORD = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 JVM_RECORD_WITHOUT_PRIMARY_CONSTRUCTOR_PARAMETERS = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 JVM_RECORD_NOT_VAL_PARAMETER = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 JVM_RECORD_NOT_LAST_VARARG_PARAMETER = DiagnosticFactory0.create(ERROR); diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt index 11d96263680..a43e8683aca 100644 --- a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt @@ -22,7 +22,21 @@ class A4(var name: String) class A5(vararg val name: String, y: Int) @JvmRecord -class A6( +open class A6(val x: String) + +@JvmRecord +abstract class A7(val x: String) + +@JvmRecord +sealed class A8(val x: String) + +@JvmRecord +enum class A9(val x: String) { + X(""); +} + +@JvmRecord +class A10( val x: String, val y: Int, vararg val z: Double, From 26d525fa3c2c42e3c642ff607c67c4d1fa3ff8b4 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Thu, 26 Nov 2020 13:06:29 +0300 Subject: [PATCH 514/698] Prepare ClassBuilder for record components ^KT-43677 In Progress --- .../kotlin/codegen/AbstractClassBuilder.java | 12 +++- .../kotlin/codegen/ClassBuilder.java | 12 ++-- .../codegen/DelegatingClassBuilder.java | 14 +++-- ...eClinitClassBuilderInterceptorExtension.kt | 14 ++++- ...DestroyClassBuilderInterceptorExtension.kt | 56 +++++++++++-------- ...eClinitClassBuilderInterceptorExtension.kt | 8 ++- 6 files changed, 77 insertions(+), 39 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/AbstractClassBuilder.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/AbstractClassBuilder.java index efc0106db6b..c16dfe7ac0b 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/AbstractClassBuilder.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/AbstractClassBuilder.java @@ -26,13 +26,13 @@ import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings; import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin; import org.jetbrains.org.objectweb.asm.*; -import java.util.ArrayList; import java.util.List; import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtilsKt.GENERATE_SMAP; public abstract class AbstractClassBuilder implements ClassBuilder { protected static final MethodVisitor EMPTY_METHOD_VISITOR = new MethodVisitor(Opcodes.API_VERSION) {}; + public static final RecordComponentVisitor EMPTY_RECORD_VISITOR = new RecordComponentVisitor(Opcodes.API_VERSION) {}; protected static final FieldVisitor EMPTY_FIELD_VISITOR = new FieldVisitor(Opcodes.API_VERSION) {}; private String thisName; @@ -91,6 +91,16 @@ public abstract class AbstractClassBuilder implements ClassBuilder { return visitor; } + @NotNull + @Override + public RecordComponentVisitor newRecordComponent(@NotNull String name, @NotNull String desc, @Nullable String signature) { + RecordComponentVisitor visitor = getVisitor().visitRecordComponent(name, desc, signature); + if (visitor == null) { + return EMPTY_RECORD_VISITOR; + } + return visitor; + } + @Override @NotNull public JvmSerializationBindings getSerializationBindings() { diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassBuilder.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassBuilder.java index 13f242d32c3..d015313eeb1 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassBuilder.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassBuilder.java @@ -19,14 +19,10 @@ package org.jetbrains.kotlin.codegen; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.codegen.inline.FileMapping; import org.jetbrains.kotlin.codegen.inline.SourceMapper; import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings; import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin; -import org.jetbrains.org.objectweb.asm.AnnotationVisitor; -import org.jetbrains.org.objectweb.asm.ClassVisitor; -import org.jetbrains.org.objectweb.asm.FieldVisitor; -import org.jetbrains.org.objectweb.asm.MethodVisitor; +import org.jetbrains.org.objectweb.asm.*; public interface ClassBuilder { @NotNull @@ -49,6 +45,12 @@ public interface ClassBuilder { @Nullable String[] exceptions ); + @NotNull RecordComponentVisitor newRecordComponent( + @NotNull String name, + @NotNull String desc, + @Nullable String signature + ); + @NotNull JvmSerializationBindings getSerializationBindings(); diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/DelegatingClassBuilder.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/DelegatingClassBuilder.java index 362422dbd8c..a9b403949f4 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/DelegatingClassBuilder.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/DelegatingClassBuilder.java @@ -19,14 +19,10 @@ package org.jetbrains.kotlin.codegen; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.codegen.inline.FileMapping; import org.jetbrains.kotlin.codegen.inline.SourceMapper; import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings; import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin; -import org.jetbrains.org.objectweb.asm.AnnotationVisitor; -import org.jetbrains.org.objectweb.asm.ClassVisitor; -import org.jetbrains.org.objectweb.asm.FieldVisitor; -import org.jetbrains.org.objectweb.asm.MethodVisitor; +import org.jetbrains.org.objectweb.asm.*; public abstract class DelegatingClassBuilder implements ClassBuilder { @NotNull @@ -58,6 +54,14 @@ public abstract class DelegatingClassBuilder implements ClassBuilder { return getDelegate().newMethod(origin, access, name, desc, signature, exceptions); } + @NotNull + @Override + public RecordComponentVisitor newRecordComponent( + @NotNull String name, @NotNull String desc, @Nullable String signature + ) { + return getDelegate().newRecordComponent(name, desc, signature); + } + @NotNull @Override public JvmSerializationBindings getSerializationBindings() { diff --git a/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/parcel/ParcelableClinitClassBuilderInterceptorExtension.kt b/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/parcel/ParcelableClinitClassBuilderInterceptorExtension.kt index 07a524d9197..ddd2a19e38a 100644 --- a/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/parcel/ParcelableClinitClassBuilderInterceptorExtension.kt +++ b/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/parcel/ParcelableClinitClassBuilderInterceptorExtension.kt @@ -18,6 +18,7 @@ package org.jetbrains.kotlin.android.synthetic.codegen import com.intellij.psi.PsiElement import org.jetbrains.kotlin.android.parcel.isParcelize +import org.jetbrains.kotlin.codegen.AbstractClassBuilder import org.jetbrains.kotlin.codegen.ClassBuilder import org.jetbrains.kotlin.codegen.ClassBuilderFactory import org.jetbrains.kotlin.codegen.DelegatingClassBuilder @@ -26,8 +27,11 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticSink import org.jetbrains.kotlin.psi.KtClassOrObject import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin -import org.jetbrains.org.objectweb.asm.* -import org.jetbrains.org.objectweb.asm.Opcodes.* +import org.jetbrains.org.objectweb.asm.MethodVisitor +import org.jetbrains.org.objectweb.asm.Opcodes +import org.jetbrains.org.objectweb.asm.Opcodes.ACC_STATIC +import org.jetbrains.org.objectweb.asm.RecordComponentVisitor +import org.jetbrains.org.objectweb.asm.Type import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter class ParcelableClinitClassBuilderInterceptorExtension : ClassBuilderInterceptorExtension { @@ -132,6 +136,10 @@ class ParcelableClinitClassBuilderInterceptorExtension : ClassBuilderInterceptor return super.newMethod(origin, access, name, desc, signature, exceptions) } + + override fun newRecordComponent(name: String, desc: String, signature: String?): RecordComponentVisitor { + return AbstractClassBuilder.EMPTY_RECORD_VISITOR + } } private class ClinitAwareMethodVisitor(val parcelableName: String, mv: MethodVisitor) : MethodVisitor(Opcodes.API_VERSION, mv) { @@ -150,4 +158,4 @@ class ParcelableClinitClassBuilderInterceptorExtension : ClassBuilderInterceptor super.visitInsn(opcode) } } -} \ No newline at end of file +} diff --git a/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/codegen/AndroidOnDestroyClassBuilderInterceptorExtension.kt b/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/codegen/AndroidOnDestroyClassBuilderInterceptorExtension.kt index 021d9751eba..e25a3d840b5 100644 --- a/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/codegen/AndroidOnDestroyClassBuilderInterceptorExtension.kt +++ b/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/codegen/AndroidOnDestroyClassBuilderInterceptorExtension.kt @@ -18,26 +18,30 @@ package org.jetbrains.kotlin.android.synthetic.codegen import com.intellij.psi.PsiElement import kotlinx.android.extensions.CacheImplementation +import org.jetbrains.kotlin.android.synthetic.codegen.AbstractAndroidExtensionsExpressionCodegenExtension.Companion.CLEAR_CACHE_METHOD_NAME import org.jetbrains.kotlin.android.synthetic.codegen.AbstractAndroidExtensionsExpressionCodegenExtension.Companion.ON_DESTROY_METHOD_NAME import org.jetbrains.kotlin.android.synthetic.descriptors.ContainerOptionsProxy +import org.jetbrains.kotlin.codegen.AbstractClassBuilder import org.jetbrains.kotlin.codegen.ClassBuilder import org.jetbrains.kotlin.codegen.ClassBuilderFactory import org.jetbrains.kotlin.codegen.DelegatingClassBuilder import org.jetbrains.kotlin.codegen.extensions.ClassBuilderInterceptorExtension import org.jetbrains.kotlin.diagnostics.DiagnosticSink import org.jetbrains.kotlin.psi.KtClass +import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin -import org.jetbrains.org.objectweb.asm.* +import org.jetbrains.org.objectweb.asm.MethodVisitor +import org.jetbrains.org.objectweb.asm.Opcodes +import org.jetbrains.org.objectweb.asm.RecordComponentVisitor +import org.jetbrains.org.objectweb.asm.Type import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter -import org.jetbrains.kotlin.android.synthetic.codegen.AbstractAndroidExtensionsExpressionCodegenExtension.Companion.CLEAR_CACHE_METHOD_NAME -import org.jetbrains.kotlin.psi.KtElement abstract class AbstractAndroidOnDestroyClassBuilderInterceptorExtension : ClassBuilderInterceptorExtension { override fun interceptClassBuilderFactory( - interceptedFactory: ClassBuilderFactory, - bindingContext: BindingContext, - diagnostics: DiagnosticSink + interceptedFactory: ClassBuilderFactory, + bindingContext: BindingContext, + diagnostics: DiagnosticSink ): ClassBuilderFactory { return AndroidOnDestroyClassBuilderFactory(interceptedFactory, bindingContext) } @@ -45,8 +49,8 @@ abstract class AbstractAndroidOnDestroyClassBuilderInterceptorExtension : ClassB abstract fun getGlobalCacheImpl(element: KtElement): CacheImplementation private inner class AndroidOnDestroyClassBuilderFactory( - private val delegateFactory: ClassBuilderFactory, - val bindingContext: BindingContext + private val delegateFactory: ClassBuilderFactory, + val bindingContext: BindingContext ) : ClassBuilderFactory { override fun newClassBuilder(origin: JvmDeclarationOrigin): ClassBuilder { @@ -69,8 +73,8 @@ abstract class AbstractAndroidOnDestroyClassBuilderInterceptorExtension : ClassB } private inner class AndroidOnDestroyCollectorClassBuilder( - internal val delegateClassBuilder: ClassBuilder, - val bindingContext: BindingContext + internal val delegateClassBuilder: ClassBuilder, + val bindingContext: BindingContext ) : DelegatingClassBuilder() { private var currentClass: KtClass? = null private var currentClassName: String? = null @@ -78,13 +82,13 @@ abstract class AbstractAndroidOnDestroyClassBuilderInterceptorExtension : ClassB override fun getDelegate() = delegateClassBuilder override fun defineClass( - origin: PsiElement?, - version: Int, - access: Int, - name: String, - signature: String?, - superName: String, - interfaces: Array + origin: PsiElement?, + version: Int, + access: Int, + name: String, + signature: String?, + superName: String, + interfaces: Array ) { if (origin is KtClass) { currentClass = origin @@ -94,12 +98,12 @@ abstract class AbstractAndroidOnDestroyClassBuilderInterceptorExtension : ClassB } override fun newMethod( - origin: JvmDeclarationOrigin, - access: Int, - name: String, - desc: String, - signature: String?, - exceptions: Array? + origin: JvmDeclarationOrigin, + access: Int, + name: String, + desc: String, + signature: String?, + exceptions: Array? ): MethodVisitor { return object : MethodVisitor(Opcodes.API_VERSION, super.newMethod(origin, access, name, desc, signature, exceptions)) { override fun visitInsn(opcode: Int) { @@ -128,6 +132,10 @@ abstract class AbstractAndroidOnDestroyClassBuilderInterceptorExtension : ClassB } } } + + override fun newRecordComponent(name: String, desc: String, signature: String?): RecordComponentVisitor { + return AbstractClassBuilder.EMPTY_RECORD_VISITOR + } } -} \ No newline at end of file +} diff --git a/plugins/parcelize/parcelize-compiler/src/org/jetbrains/kotlin/parcelize/ParcelizeClinitClassBuilderInterceptorExtension.kt b/plugins/parcelize/parcelize-compiler/src/org/jetbrains/kotlin/parcelize/ParcelizeClinitClassBuilderInterceptorExtension.kt index da91f94c9c6..9f88df0de00 100644 --- a/plugins/parcelize/parcelize-compiler/src/org/jetbrains/kotlin/parcelize/ParcelizeClinitClassBuilderInterceptorExtension.kt +++ b/plugins/parcelize/parcelize-compiler/src/org/jetbrains/kotlin/parcelize/ParcelizeClinitClassBuilderInterceptorExtension.kt @@ -17,6 +17,7 @@ package org.jetbrains.kotlin.parcelize import com.intellij.psi.PsiElement +import org.jetbrains.kotlin.codegen.AbstractClassBuilder import org.jetbrains.kotlin.codegen.ClassBuilder import org.jetbrains.kotlin.codegen.ClassBuilderFactory import org.jetbrains.kotlin.codegen.DelegatingClassBuilder @@ -27,6 +28,7 @@ import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin import org.jetbrains.org.objectweb.asm.MethodVisitor import org.jetbrains.org.objectweb.asm.Opcodes +import org.jetbrains.org.objectweb.asm.RecordComponentVisitor import org.jetbrains.org.objectweb.asm.Type import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter @@ -128,6 +130,10 @@ class ParcelizeClinitClassBuilderInterceptorExtension : ClassBuilderInterceptorE return super.newMethod(origin, access, name, desc, signature, exceptions) } + + override fun newRecordComponent(name: String, desc: String, signature: String?): RecordComponentVisitor { + return AbstractClassBuilder.EMPTY_RECORD_VISITOR + } } private class ClinitAwareMethodVisitor(val parcelableName: String, mv: MethodVisitor) : MethodVisitor(Opcodes.API_VERSION, mv) { @@ -146,4 +152,4 @@ class ParcelizeClinitClassBuilderInterceptorExtension : ClassBuilderInterceptorE super.visitInsn(opcode) } } -} \ No newline at end of file +} From 1b575d79030b98c35a9587bfbdec6c7394c021a8 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Fri, 27 Nov 2020 15:56:07 +0300 Subject: [PATCH 515/698] Add initial support for @JvmRecord in backend - Write relevant class files attributes - Emit property accessors with records-convention: propertyName -> propertyName() ^KT-43677 In Progress --- .../codegen/ImplementationBodyCodegen.java | 5 +++ .../kotlin/codegen/PropertyCodegen.java | 8 +++- .../kotlin/codegen/state/KotlinTypeMapper.kt | 7 +++- .../org/jetbrains/kotlin/config/JvmTarget.kt | 8 ++-- .../backend/jvm/codegen/ClassCodegen.kt | 7 ++++ .../jvm/codegen/MethodSignatureMapper.kt | 3 +- .../box/records/bytecodeShapeForJava.kt | 29 ++++++++++++++ .../recordDifferentPropertyOverride.kt | 0 .../recordDifferentSyntheticProperty.kt | 0 .../box/{ => records}/recordPropertyAccess.kt | 0 .../AbstractJdk15BlackBoxCodegenTest.kt | 4 +- .../Jdk15BlackBoxCodegenTestGenerated.java | 40 ++++++++++++++----- 12 files changed, 93 insertions(+), 18 deletions(-) create mode 100644 compiler/testData/codegen/java15/box/records/bytecodeShapeForJava.kt rename compiler/testData/codegen/java15/box/{ => records}/recordDifferentPropertyOverride.kt (100%) rename compiler/testData/codegen/java15/box/{ => records}/recordDifferentSyntheticProperty.kt (100%) rename compiler/testData/codegen/java15/box/{ => records}/recordPropertyAccess.kt (100%) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java index c9c28a57deb..caa9fedb583 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java @@ -43,6 +43,7 @@ import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt; import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall; import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall; import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt; +import org.jetbrains.kotlin.resolve.jvm.annotations.JvmAnnotationUtilKt; import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin; import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt; import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmClassSignature; @@ -221,6 +222,10 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { access |= ACC_ENUM; } + if (JvmAnnotationUtilKt.isJvmRecord(descriptor)) { + access |= ACC_RECORD; + } + v.defineClass( myClass.getPsiOrParent(), state.getClassFileVersion(), diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/PropertyCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/PropertyCodegen.java index c10a8e61814..449fb9a82d3 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/PropertyCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/PropertyCodegen.java @@ -29,6 +29,7 @@ import org.jetbrains.kotlin.resolve.InlineClassesUtilsKt; import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall; import org.jetbrains.kotlin.resolve.calls.util.UnderscoreUtilKt; import org.jetbrains.kotlin.resolve.constants.ConstantValue; +import org.jetbrains.kotlin.resolve.jvm.annotations.JvmAnnotationUtilKt; import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt; import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodGenericSignature; import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature; @@ -435,9 +436,10 @@ public class PropertyCodegen { v.getSerializationBindings().put(FIELD_FOR_PROPERTY, propertyDescriptor, new Pair<>(type, name)); if (isBackingFieldOwner) { + String signature = isDelegate ? null : typeMapper.mapFieldSignature(kotlinType, propertyDescriptor); FieldVisitor fv = builder.newField( JvmDeclarationOriginKt.OtherOrigin(propertyDescriptor), modifiers, name, type.getDescriptor(), - isDelegate ? null : typeMapper.mapFieldSignature(kotlinType, propertyDescriptor), defaultValue + signature, defaultValue ); if (annotatedField != null) { @@ -450,6 +452,10 @@ public class PropertyCodegen { AnnotationCodegen.forField(fv, memberCodegen, state, skipNullabilityAnnotations) .genAnnotations(annotatedField, type, propertyDescriptor.getType(), null, additionalVisibleAnnotations); } + + if (propertyDescriptor.getContainingDeclaration() instanceof ClassDescriptor && JvmAnnotationUtilKt.isJvmRecord((ClassDescriptor) propertyDescriptor.getContainingDeclaration())) { + builder.newRecordComponent(name, type.getDescriptor(), signature); + } } } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt index df20065d4be..b6c994a9b89 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt @@ -63,6 +63,7 @@ import org.jetbrains.kotlin.resolve.jvm.AsmTypes.DEFAULT_CONSTRUCTOR_MARKER import org.jetbrains.kotlin.resolve.jvm.AsmTypes.OBJECT_TYPE import org.jetbrains.kotlin.resolve.jvm.JvmClassName import org.jetbrains.kotlin.resolve.jvm.annotations.isCompiledToJvmDefault +import org.jetbrains.kotlin.resolve.jvm.annotations.isJvmRecord import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodGenericSignature import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature @@ -583,12 +584,16 @@ class KotlinTypeMapper @JvmOverloads constructor( return when { descriptor is PropertyAccessorDescriptor -> { val property = descriptor.correspondingProperty - if (isAnnotationClass(property.containingDeclaration) && + val containingDeclaration = property.containingDeclaration + + if (isAnnotationClass(containingDeclaration) && (!property.hasJvmStaticAnnotation() && !descriptor.hasJvmStaticAnnotation()) ) { return property.name.asString() } + if ((containingDeclaration as? ClassDescriptor)?.isJvmRecord() == true) return property.name.asString() + val isAccessor = property is AccessorForPropertyDescriptor val propertyName = if (isAccessor) (property as AccessorForPropertyDescriptor).accessorSuffix diff --git a/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt b/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt index ea140a8d9af..28dd3296a6a 100644 --- a/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt +++ b/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt @@ -29,6 +29,7 @@ enum class JvmTarget(override val description: String) : TargetPlatformVersion { JVM_13("13"), JVM_14("14"), JVM_15("15"), + JVM_15_PREVIEW("15_PREVIEW"), ; val bytecodeVersion: Int by lazy { @@ -39,9 +40,10 @@ enum class JvmTarget(override val description: String) : TargetPlatformVersion { JVM_10 -> Opcodes.V10 JVM_11 -> Opcodes.V11 JVM_12 -> Opcodes.V12 - JVM_13 -> Opcodes.V12 + 1 - JVM_14 -> Opcodes.V12 + 2 - JVM_15 -> Opcodes.V12 + 3 + JVM_13 -> Opcodes.V13 + JVM_14 -> Opcodes.V14 + JVM_15 -> Opcodes.V15 + JVM_15_PREVIEW -> Opcodes.V15 + (0xffff shl 16) } } diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ClassCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ClassCodegen.kt index c19804ada95..21758e69cd7 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ClassCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ClassCodegen.kt @@ -33,6 +33,7 @@ import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader import org.jetbrains.kotlin.metadata.jvm.serialization.JvmStringTable import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.protobuf.MessageLite +import org.jetbrains.kotlin.resolve.jvm.annotations.JVM_RECORD_ANNOTATION_FQ_NAME import org.jetbrains.kotlin.resolve.jvm.annotations.JVM_SYNTHETIC_ANNOTATION_FQ_NAME import org.jetbrains.kotlin.resolve.jvm.annotations.TRANSIENT_ANNOTATION_FQ_NAME import org.jetbrains.kotlin.resolve.jvm.annotations.VOLATILE_ANNOTATION_FQ_NAME @@ -306,6 +307,11 @@ class ClassCodegen private constructor( (field.metadata as? MetadataSource.Property)?.let { metadataSerializer.bindFieldMetadata(it, fieldType to fieldName) } + + if (irClass.hasAnnotation(JVM_RECORD_ANNOTATION_FQ_NAME) && !field.isStatic) { + // TODO: Write annotations to the component + visitor.newRecordComponent(fieldName, fieldType.descriptor, fieldSignature) + } } private val generatedInlineMethods = mutableMapOf() @@ -452,6 +458,7 @@ private val IrClass.flags: Int isAnnotationClass -> Opcodes.ACC_ANNOTATION or Opcodes.ACC_INTERFACE or Opcodes.ACC_ABSTRACT isInterface -> Opcodes.ACC_INTERFACE or Opcodes.ACC_ABSTRACT isEnumClass -> Opcodes.ACC_ENUM or Opcodes.ACC_SUPER or modality.flags + hasAnnotation(JVM_RECORD_ANNOTATION_FQ_NAME) -> Opcodes.ACC_RECORD or Opcodes.ACC_SUPER or modality.flags else -> Opcodes.ACC_SUPER or modality.flags } diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt index ee87513a15d..1e9427642f5 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt @@ -41,6 +41,7 @@ import org.jetbrains.kotlin.metadata.deserialization.getExtensionOrNull import org.jetbrains.kotlin.metadata.jvm.JvmProtoBuf import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil import org.jetbrains.kotlin.name.NameUtils +import org.jetbrains.kotlin.resolve.jvm.annotations.JVM_RECORD_ANNOTATION_FQ_NAME import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodGenericSignature import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature @@ -83,7 +84,7 @@ class MethodSignatureMapper(private val context: JvmBackendContext) { if (property != null) { val propertyName = property.name.asString() val propertyParent = property.parentAsClass - if (propertyParent.isAnnotationClass) + if (propertyParent.isAnnotationClass || propertyParent.hasAnnotation(JVM_RECORD_ANNOTATION_FQ_NAME)) return propertyName // The enum property getters and have special names which also diff --git a/compiler/testData/codegen/java15/box/records/bytecodeShapeForJava.kt b/compiler/testData/codegen/java15/box/records/bytecodeShapeForJava.kt new file mode 100644 index 00000000000..53ea772abe1 --- /dev/null +++ b/compiler/testData/codegen/java15/box/records/bytecodeShapeForJava.kt @@ -0,0 +1,29 @@ +// !LANGUAGE: +JvmRecordSupport +// JVM_TARGET: 15_PREVIEW +// FILE: JavaClass.java +public class JavaClass { + public static String box() { + MyRec m = new MyRec("O", "K"); + return m.x() + m.y(); + } +} +// FILE: main.kt + +@JvmRecord +class MyRec(val x: String, val y: R) + +fun box(): String { + val recordComponents = MyRec::class.java.recordComponents + val x = recordComponents[0] + val y = recordComponents[1] + + if (x.name != "x") return "fail 1: ${x.name}" + if (x.type != String::class.java) return "fail 2: ${x.type}" + if (x.genericSignature != null) return "fail 3: ${x.genericSignature}" + + if (y.name != "y") return "fail 4: ${y.name}" + if (y.type != Any::class.java) return "fail 5: ${y.type}" + if (y.genericSignature != "TR;") return "fail 6: ${y.genericSignature}" + + return JavaClass.box() +} diff --git a/compiler/testData/codegen/java15/box/recordDifferentPropertyOverride.kt b/compiler/testData/codegen/java15/box/records/recordDifferentPropertyOverride.kt similarity index 100% rename from compiler/testData/codegen/java15/box/recordDifferentPropertyOverride.kt rename to compiler/testData/codegen/java15/box/records/recordDifferentPropertyOverride.kt diff --git a/compiler/testData/codegen/java15/box/recordDifferentSyntheticProperty.kt b/compiler/testData/codegen/java15/box/records/recordDifferentSyntheticProperty.kt similarity index 100% rename from compiler/testData/codegen/java15/box/recordDifferentSyntheticProperty.kt rename to compiler/testData/codegen/java15/box/records/recordDifferentSyntheticProperty.kt diff --git a/compiler/testData/codegen/java15/box/recordPropertyAccess.kt b/compiler/testData/codegen/java15/box/records/recordPropertyAccess.kt similarity index 100% rename from compiler/testData/codegen/java15/box/recordPropertyAccess.kt rename to compiler/testData/codegen/java15/box/records/recordPropertyAccess.kt diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk15BlackBoxCodegenTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk15BlackBoxCodegenTest.kt index 6e50e9a59be..b46c6b1f3cd 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk15BlackBoxCodegenTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk15BlackBoxCodegenTest.kt @@ -17,4 +17,6 @@ abstract class AbstractJdk15BlackBoxCodegenTest : AbstractCustomJDKBlackBoxCodeg override fun getAdditionalJavacArgs(): List = ADDITIONAL_JAVAC_ARGS_FOR_15 override fun getAdditionalJvmArgs(): List = listOf("--enable-preview") -} \ No newline at end of file + + override fun verifyWithDex(): Boolean = false +} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/Jdk15BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/Jdk15BlackBoxCodegenTestGenerated.java index 3fb4b629608..c7a922ea017 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/Jdk15BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/Jdk15BlackBoxCodegenTestGenerated.java @@ -28,18 +28,36 @@ public class Jdk15BlackBoxCodegenTestGenerated extends AbstractJdk15BlackBoxCode KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/java15/box"), Pattern.compile("^(.+)\\.kt$"), null, true); } - @TestMetadata("recordDifferentPropertyOverride.kt") - public void testRecordDifferentPropertyOverride() throws Exception { - runTest("compiler/testData/codegen/java15/box/recordDifferentPropertyOverride.kt"); - } + @TestMetadata("compiler/testData/codegen/java15/box/records") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Records extends AbstractJdk15BlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } - @TestMetadata("recordDifferentSyntheticProperty.kt") - public void testRecordDifferentSyntheticProperty() throws Exception { - runTest("compiler/testData/codegen/java15/box/recordDifferentSyntheticProperty.kt"); - } + public void testAllFilesPresentInRecords() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/java15/box/records"), Pattern.compile("^(.+)\\.kt$"), null, true); + } - @TestMetadata("recordPropertyAccess.kt") - public void testRecordPropertyAccess() throws Exception { - runTest("compiler/testData/codegen/java15/box/recordPropertyAccess.kt"); + @TestMetadata("bytecodeShapeForJava.kt") + public void testBytecodeShapeForJava() throws Exception { + runTest("compiler/testData/codegen/java15/box/records/bytecodeShapeForJava.kt"); + } + + @TestMetadata("recordDifferentPropertyOverride.kt") + public void testRecordDifferentPropertyOverride() throws Exception { + runTest("compiler/testData/codegen/java15/box/records/recordDifferentPropertyOverride.kt"); + } + + @TestMetadata("recordDifferentSyntheticProperty.kt") + public void testRecordDifferentSyntheticProperty() throws Exception { + runTest("compiler/testData/codegen/java15/box/records/recordDifferentSyntheticProperty.kt"); + } + + @TestMetadata("recordPropertyAccess.kt") + public void testRecordPropertyAccess() throws Exception { + runTest("compiler/testData/codegen/java15/box/records/recordPropertyAccess.kt"); + } } } From 033f43794d1ad6c565c1e91c0586554eb3f82f01 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Fri, 27 Nov 2020 18:53:06 +0300 Subject: [PATCH 516/698] Prohibit irrelevant fields in @JvmRecord classes ^KT-43677 In Progress --- .../checkers/JvmRecordApplicabilityChecker.kt | 37 +++++++++++++---- .../diagnostics/DefaultErrorMessagesJvm.java | 3 ++ .../resolve/jvm/diagnostics/ErrorsJvm.java | 3 ++ .../testsWithJava15/jvmRecord/diagnostics.kt | 5 +++ .../jvmRecord/irrelevantFields.kt | 40 +++++++++++++++++++ .../DiagnosticsWithJdk15TestGenerated.java | 5 +++ 6 files changed, 86 insertions(+), 7 deletions(-) create mode 100644 compiler/testData/diagnostics/testsWithJava15/jvmRecord/irrelevantFields.kt diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt index 9a84d7be9ad..af4c2442bae 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt @@ -7,17 +7,13 @@ package org.jetbrains.kotlin.resolve.jvm.checkers import com.intellij.psi.PsiElement import org.jetbrains.kotlin.config.LanguageFeature -import org.jetbrains.kotlin.descriptors.ClassDescriptor -import org.jetbrains.kotlin.descriptors.ClassKind -import org.jetbrains.kotlin.descriptors.DeclarationDescriptor -import org.jetbrains.kotlin.descriptors.isFinalClass +import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.diagnostics.Errors import org.jetbrains.kotlin.incremental.components.NoLookupLocation import org.jetbrains.kotlin.lexer.KtModifierKeywordToken import org.jetbrains.kotlin.lexer.KtTokens -import org.jetbrains.kotlin.psi.KtClassOrObject -import org.jetbrains.kotlin.psi.KtDeclaration -import org.jetbrains.kotlin.psi.KtModifierList +import org.jetbrains.kotlin.psi.* +import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.checkers.DeclarationChecker import org.jetbrains.kotlin.resolve.checkers.DeclarationCheckerContext @@ -72,6 +68,16 @@ object JvmRecordApplicabilityChecker : DeclarationChecker { return } + if (descriptor.isInner) { + val modifierOrName = + declaration.modifierList?.getModifier(KtTokens.INNER_KEYWORD) + ?: declaration.nameIdentifier + ?: declaration + + context.trace.report(ErrorsJvm.INNER_JVM_RECORD.on(modifierOrName)) + return + } + if (DescriptorUtils.isLocal(descriptor)) { context.trace.report(ErrorsJvm.LOCAL_JVM_RECORD.on(reportOn)) return @@ -100,6 +106,23 @@ object JvmRecordApplicabilityChecker : DeclarationChecker { } } + for (member in declaration.declarations) { + if (member !is KtProperty) continue + + val propertyDescriptor = context.trace[BindingContext.DECLARATION_TO_DESCRIPTOR, member] as? PropertyDescriptor ?: continue + if (context.trace.bindingContext[BindingContext.BACKING_FIELD_REQUIRED, propertyDescriptor] != true && member.delegate == null) continue + + context.trace.report(ErrorsJvm.FIELD_IN_JVM_RECORD.on(member)) + return + } + + for (superTypeEntry in declaration.superTypeListEntries) { + if (superTypeEntry !is KtDelegatedSuperTypeEntry) continue + + context.trace.report(ErrorsJvm.DELEGATION_BY_IN_JVM_RECORD.on(superTypeEntry)) + return + } + for (supertype in descriptor.typeConstructor.supertypes) { val classDescriptor = supertype.constructor.declarationDescriptor as? ClassDescriptor ?: continue if (classDescriptor.kind == ClassKind.INTERFACE || classDescriptor.fqNameSafe == JAVA_LANG_RECORD_FQ_NAME) continue diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java index 1ccb32a1d24..ecae1cde86e 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java @@ -160,6 +160,9 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension { MAP.put(JVM_RECORD_NOT_LAST_VARARG_PARAMETER, "Only the last constructor parameter of @JvmRecord may be a vararg"); MAP.put(JVM_RECORD_EXTENDS_CLASS, "Record cannot inherit an other class but java.lang.Record" , RENDER_TYPE); MAP.put(JVM_RECORD_REQUIRES_JDK15, "Using @JvmRecords requires at least JDK 15"); + MAP.put(INNER_JVM_RECORD, "@JvmRecord class should not be inner"); + MAP.put(FIELD_IN_JVM_RECORD, "It's not allowed to have non-constructor properties with backing filed in @JvmRecord class"); + MAP.put(DELEGATION_BY_IN_JVM_RECORD, "Delegation is not allowed for @JvmRecord classes"); String MESSAGE_FOR_CONCURRENT_HASH_MAP_CONTAINS = "Method 'contains' from ConcurrentHashMap may have unexpected semantics: it calls 'containsValue' instead of 'containsKey'. " + diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java index 999c15ac60c..9b2c0e9fc51 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java @@ -123,6 +123,9 @@ public interface ErrorsJvm { DiagnosticFactory0 JVM_RECORD_NOT_LAST_VARARG_PARAMETER = DiagnosticFactory0.create(ERROR); DiagnosticFactory1 JVM_RECORD_EXTENDS_CLASS = DiagnosticFactory1.create(ERROR); DiagnosticFactory0 JVM_RECORD_REQUIRES_JDK15 = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 INNER_JVM_RECORD = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 FIELD_IN_JVM_RECORD = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 DELEGATION_BY_IN_JVM_RECORD = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 NON_JVM_DEFAULT_OVERRIDES_JAVA_DEFAULT = DiagnosticFactory0.create(WARNING, DECLARATION_SIGNATURE); diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt index a43e8683aca..8aa985c3a64 100644 --- a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt @@ -46,3 +46,8 @@ fun main() { @JvmRecord class Local } + +class Outer { + @JvmRecord + inner class Inner(val name: String) +} diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/irrelevantFields.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/irrelevantFields.kt new file mode 100644 index 00000000000..8733a6eafe1 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/irrelevantFields.kt @@ -0,0 +1,40 @@ +// !LANGUAGE: +JvmRecordSupport +// SKIP_TXT + +interface I + +val i: I = object : I {} + +@JvmRecord +class MyRec1(val name: String) : I by i + +@JvmRecord +class MyRec2(val name: String) { + val x: Int = 0 +} + +@JvmRecord +class MyRec3(val name: String) { + val y: String + get() = field + "1" + + init { + y = "" + } +} + +@JvmRecord +class MyRec4(val name: String) { + val z: Int by lazy { 1 } +} + +@JvmRecord +class MyRec5(val name: String) { + val w: String get() = name + "1" +} + + + + + + diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java index 80854b70acc..8d5993043e9 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java @@ -50,6 +50,11 @@ public class DiagnosticsWithJdk15TestGenerated extends AbstractDiagnosticsWithJd runTest("compiler/testData/diagnostics/testsWithJava15/jvmRecord/disabledFeature.kt"); } + @TestMetadata("irrelevantFields.kt") + public void testIrrelevantFields() throws Exception { + runTest("compiler/testData/diagnostics/testsWithJava15/jvmRecord/irrelevantFields.kt"); + } + @TestMetadata("jvmRecordDescriptorStructure.kt") public void testJvmRecordDescriptorStructure() throws Exception { runTest("compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt"); From 1d873a1a73cc49848881d82cd1fc787fdddccbef Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Mon, 30 Nov 2020 20:07:13 +0300 Subject: [PATCH 517/698] Move earlier generated tests ^KT-43677 In Progress --- .../kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java | 0 .../kotlin/codegen/Jdk15BlackBoxCodegenTestGenerated.java | 0 .../kotlin/codegen/Jdk9BlackBoxCodegenTestGenerated.java | 0 .../jetbrains/kotlin/jvm/compiler/LoadJava15TestGenerated.java | 0 .../jvm/compiler/LoadJava15WithPsiClassReadingTestGenerated.java | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/Jdk15BlackBoxCodegenTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/codegen/Jdk9BlackBoxCodegenTestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/jvm/compiler/LoadJava15TestGenerated.java (100%) rename compiler/{tests => tests-gen}/org/jetbrains/kotlin/jvm/compiler/LoadJava15WithPsiClassReadingTestGenerated.java (100%) diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/Jdk15BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15BlackBoxCodegenTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/Jdk15BlackBoxCodegenTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15BlackBoxCodegenTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/Jdk9BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk9BlackBoxCodegenTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/codegen/Jdk9BlackBoxCodegenTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk9BlackBoxCodegenTestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJava15TestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/LoadJava15TestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJava15TestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/LoadJava15TestGenerated.java diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJava15WithPsiClassReadingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/LoadJava15WithPsiClassReadingTestGenerated.java similarity index 100% rename from compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJava15WithPsiClassReadingTestGenerated.java rename to compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/LoadJava15WithPsiClassReadingTestGenerated.java From cc0b584445d6aaff655c221add580fc95ebab657 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Mon, 30 Nov 2020 20:15:15 +0300 Subject: [PATCH 518/698] Adapt test infrastructure to the latest changes ^KT-43677 In Progress --- .../src/org/jetbrains/kotlin/config/JvmTarget.kt | 8 ++++++-- .../box/records/recordDifferentPropertyOverride.kt | 1 + .../box/records/recordDifferentSyntheticProperty.kt | 1 + .../codegen/java15/box/records/recordPropertyAccess.kt | 3 ++- .../codegen/AbstractCustomJDKBlackBoxCodegenTest.kt | 8 ++++---- .../kotlin/codegen/AbstractJdk15BlackBoxCodegenTest.kt | 2 -- .../org/jetbrains/kotlin/codegen/CodegenTestCase.java | 10 +++++++++- 7 files changed, 23 insertions(+), 10 deletions(-) diff --git a/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt b/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt index 28dd3296a6a..e9f61674f66 100644 --- a/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt +++ b/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt @@ -19,7 +19,11 @@ package org.jetbrains.kotlin.config import org.jetbrains.kotlin.platform.TargetPlatformVersion import org.jetbrains.org.objectweb.asm.Opcodes -enum class JvmTarget(override val description: String) : TargetPlatformVersion { +enum class JvmTarget( + override val description: String, + val descriptionForJavacArgument: String = description, + val isPreview: Boolean = false, +) : TargetPlatformVersion { JVM_1_6("1.6"), JVM_1_8("1.8"), JVM_9("9"), @@ -29,7 +33,7 @@ enum class JvmTarget(override val description: String) : TargetPlatformVersion { JVM_13("13"), JVM_14("14"), JVM_15("15"), - JVM_15_PREVIEW("15_PREVIEW"), + JVM_15_PREVIEW("15_PREVIEW", descriptionForJavacArgument = "15", isPreview = true), ; val bytecodeVersion: Int by lazy { diff --git a/compiler/testData/codegen/java15/box/records/recordDifferentPropertyOverride.kt b/compiler/testData/codegen/java15/box/records/recordDifferentPropertyOverride.kt index 2752ede043d..894b37db7cf 100644 --- a/compiler/testData/codegen/java15/box/records/recordDifferentPropertyOverride.kt +++ b/compiler/testData/codegen/java15/box/records/recordDifferentPropertyOverride.kt @@ -1,3 +1,4 @@ +// JVM_TARGET: 15_PREVIEW // FILE: MyRec.java public record MyRec(String name) implements KI { public String getName() { diff --git a/compiler/testData/codegen/java15/box/records/recordDifferentSyntheticProperty.kt b/compiler/testData/codegen/java15/box/records/recordDifferentSyntheticProperty.kt index 80b39f384aa..8b68537f4aa 100644 --- a/compiler/testData/codegen/java15/box/records/recordDifferentSyntheticProperty.kt +++ b/compiler/testData/codegen/java15/box/records/recordDifferentSyntheticProperty.kt @@ -1,3 +1,4 @@ +// JVM_TARGET: 15_PREVIEW // FILE: MyRec.java public record MyRec(String name) { public String getName() { diff --git a/compiler/testData/codegen/java15/box/records/recordPropertyAccess.kt b/compiler/testData/codegen/java15/box/records/recordPropertyAccess.kt index 05939f3dea5..8b10b44304a 100644 --- a/compiler/testData/codegen/java15/box/records/recordPropertyAccess.kt +++ b/compiler/testData/codegen/java15/box/records/recordPropertyAccess.kt @@ -1,3 +1,4 @@ +// JVM_TARGET: 15_PREVIEW // FILE: MyRec.java public record MyRec(String name) {} @@ -7,4 +8,4 @@ fun box(): String { if (r.name() != "OK") return "fail 1" return r.name -} \ No newline at end of file +} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCustomJDKBlackBoxCodegenTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCustomJDKBlackBoxCodegenTest.kt index e53093e5d2e..50855f28539 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCustomJDKBlackBoxCodegenTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCustomJDKBlackBoxCodegenTest.kt @@ -7,7 +7,6 @@ package org.jetbrains.kotlin.codegen import org.jetbrains.kotlin.cli.common.output.writeAll import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime -import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils import org.jetbrains.kotlin.test.ConfigurationKind import org.jetbrains.kotlin.test.KotlinTestUtils import org.jetbrains.kotlin.test.TestJdkKind @@ -36,7 +35,9 @@ abstract class AbstractCustomJDKBlackBoxCodegenTest : AbstractBlackBoxCodegenTes } override fun runJavacTask(files: MutableCollection, options: List) { - KotlinTestUtils.compileJavaFilesExternally(files, options + getAdditionalJavacArgs(), getJdkHome()) + assert(KotlinTestUtils.compileJavaFilesExternally(files, options, getJdkHome())) { + "Javac failed: $options on $files" + } } override fun getTestJdkKind(files: List): TestJdkKind { @@ -46,7 +47,6 @@ abstract class AbstractCustomJDKBlackBoxCodegenTest : AbstractBlackBoxCodegenTes abstract fun getTestJdkKind(): TestJdkKind abstract fun getJdkHome(): File - open fun getAdditionalJavacArgs(): List = emptyList() open fun getAdditionalJvmArgs(): List = emptyList() abstract override fun getPrefix(): String @@ -78,4 +78,4 @@ abstract class AbstractCustomJDKBlackBoxCodegenTest : AbstractBlackBoxCodegenTes process.waitFor(1, TimeUnit.MINUTES) assertEquals(0, process.exitValue()) } -} \ No newline at end of file +} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk15BlackBoxCodegenTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk15BlackBoxCodegenTest.kt index b46c6b1f3cd..ade7bd2b4b8 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk15BlackBoxCodegenTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk15BlackBoxCodegenTest.kt @@ -5,7 +5,6 @@ package org.jetbrains.kotlin.codegen -import org.jetbrains.kotlin.jvm.compiler.ADDITIONAL_JAVAC_ARGS_FOR_15 import org.jetbrains.kotlin.test.KotlinTestUtils import org.jetbrains.kotlin.test.TestJdkKind import java.io.File @@ -15,7 +14,6 @@ abstract class AbstractJdk15BlackBoxCodegenTest : AbstractCustomJDKBlackBoxCodeg override fun getJdkHome(): File = KotlinTestUtils.getJdk15Home() override fun getPrefix(): String = "java15/box" - override fun getAdditionalJavacArgs(): List = ADDITIONAL_JAVAC_ARGS_FOR_15 override fun getAdditionalJvmArgs(): List = listOf("--enable-preview") override fun verifyWithDex(): Boolean = false diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java index 60072773ce9..5c46f1b1baf 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java @@ -556,6 +556,14 @@ public abstract class CodegenTestCase extends KotlinBaseTest 0) - return kotlinTarget.getDescription(); + return kotlinTarget.getDescriptionForJavacArgument(); if (IS_SOURCE_6_STILL_SUPPORTED) return "1.6"; return null; From c8851c4f751d1a3d56f79667bd3e592f5148bca6 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Mon, 30 Nov 2020 20:20:14 +0300 Subject: [PATCH 519/698] Prohibit @JvmRecord for non-data classes ^KT-43677 In Progress --- .../checkers/JvmRecordApplicabilityChecker.kt | 50 +++++++++++-------- .../diagnostics/DefaultErrorMessagesJvm.java | 1 + .../resolve/jvm/diagnostics/ErrorsJvm.java | 1 + .../box/records/bytecodeShapeForJava.kt | 2 +- .../java15/box/records/dataJvmRecord.kt | 16 ++++++ .../testsWithJava15/jvmRecord/diagnostics.kt | 26 +++++----- .../jvmRecord/irrelevantFields.kt | 10 ++-- .../jvmRecord/jvmRecordDescriptorStructure.kt | 4 +- .../jvmRecord/supertypesCheck.kt | 10 ++-- .../jvmRecord/supertypesCheck.txt | 20 ++++++-- .../Jdk15BlackBoxCodegenTestGenerated.java | 5 ++ 11 files changed, 92 insertions(+), 53 deletions(-) create mode 100644 compiler/testData/codegen/java15/box/records/dataJvmRecord.kt diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt index af4c2442bae..9bf745d6254 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt @@ -83,28 +83,6 @@ object JvmRecordApplicabilityChecker : DeclarationChecker { return } - val primaryConstructor = declaration.primaryConstructor - val parameters = primaryConstructor?.valueParameters ?: emptyList() - if (parameters.isEmpty()) { - (primaryConstructor?.valueParameterList ?: declaration.nameIdentifier)?.let { - context.trace.report(ErrorsJvm.JVM_RECORD_WITHOUT_PRIMARY_CONSTRUCTOR_PARAMETERS.on(it)) - return - } - } - - for (parameter in parameters) { - if (!parameter.hasValOrVar() || parameter.isMutable) { - context.trace.report(ErrorsJvm.JVM_RECORD_NOT_VAL_PARAMETER.on(parameter)) - return - } - } - - for (parameter in parameters.dropLast(1)) { - if (parameter.isVarArg) { - context.trace.report(ErrorsJvm.JVM_RECORD_NOT_LAST_VARARG_PARAMETER.on(parameter)) - return - } - } for (member in declaration.declarations) { if (member !is KtProperty) continue @@ -131,6 +109,34 @@ object JvmRecordApplicabilityChecker : DeclarationChecker { context.trace.report(ErrorsJvm.JVM_RECORD_EXTENDS_CLASS.on(reportSupertypeOn, supertype)) return } + + if (!descriptor.isData) { + context.trace.report(ErrorsJvm.NON_DATA_CLASS_JVM_RECORD.on(reportOn)) + return + } + + val primaryConstructor = declaration.primaryConstructor + val parameters = primaryConstructor?.valueParameters ?: emptyList() + if (parameters.isEmpty()) { + (primaryConstructor?.valueParameterList ?: declaration.nameIdentifier)?.let { + context.trace.report(ErrorsJvm.JVM_RECORD_WITHOUT_PRIMARY_CONSTRUCTOR_PARAMETERS.on(it)) + return + } + } + + for (parameter in parameters) { + if (!parameter.hasValOrVar() || parameter.isMutable) { + context.trace.report(ErrorsJvm.JVM_RECORD_NOT_VAL_PARAMETER.on(parameter)) + return + } + } + + for (parameter in parameters.dropLast(1)) { + if (parameter.isVarArg) { + context.trace.report(ErrorsJvm.JVM_RECORD_NOT_LAST_VARARG_PARAMETER.on(parameter)) + return + } + } } } diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java index ecae1cde86e..3d14accdb69 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java @@ -163,6 +163,7 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension { MAP.put(INNER_JVM_RECORD, "@JvmRecord class should not be inner"); MAP.put(FIELD_IN_JVM_RECORD, "It's not allowed to have non-constructor properties with backing filed in @JvmRecord class"); MAP.put(DELEGATION_BY_IN_JVM_RECORD, "Delegation is not allowed for @JvmRecord classes"); + MAP.put(NON_DATA_CLASS_JVM_RECORD, "Only data classes are allowed to be marked as @JvmRecord"); String MESSAGE_FOR_CONCURRENT_HASH_MAP_CONTAINS = "Method 'contains' from ConcurrentHashMap may have unexpected semantics: it calls 'containsValue' instead of 'containsKey'. " + diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java index 9b2c0e9fc51..17068ba9c75 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java @@ -126,6 +126,7 @@ public interface ErrorsJvm { DiagnosticFactory0 INNER_JVM_RECORD = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 FIELD_IN_JVM_RECORD = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 DELEGATION_BY_IN_JVM_RECORD = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 NON_DATA_CLASS_JVM_RECORD = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 NON_JVM_DEFAULT_OVERRIDES_JAVA_DEFAULT = DiagnosticFactory0.create(WARNING, DECLARATION_SIGNATURE); diff --git a/compiler/testData/codegen/java15/box/records/bytecodeShapeForJava.kt b/compiler/testData/codegen/java15/box/records/bytecodeShapeForJava.kt index 53ea772abe1..45ba2eb96b4 100644 --- a/compiler/testData/codegen/java15/box/records/bytecodeShapeForJava.kt +++ b/compiler/testData/codegen/java15/box/records/bytecodeShapeForJava.kt @@ -10,7 +10,7 @@ public class JavaClass { // FILE: main.kt @JvmRecord -class MyRec(val x: String, val y: R) +data class MyRec(val x: String, val y: R) fun box(): String { val recordComponents = MyRec::class.java.recordComponents diff --git a/compiler/testData/codegen/java15/box/records/dataJvmRecord.kt b/compiler/testData/codegen/java15/box/records/dataJvmRecord.kt new file mode 100644 index 00000000000..5e606378551 --- /dev/null +++ b/compiler/testData/codegen/java15/box/records/dataJvmRecord.kt @@ -0,0 +1,16 @@ +// !LANGUAGE: +JvmRecordSupport +// JVM_TARGET: 15_PREVIEW + +@JvmRecord +data class MyRec(val x: String, val y: R) + +fun box(): String { + val m1 = MyRec("O", "K") + val m2 = MyRec("O", "K") + + if (m1 != m2) return "fail 1" + if (m1.hashCode() != m2.hashCode()) return "fail 2" + if (m1.toString() != "MyRec(x=O, y=K)") return "fail 3: $m1" + + return "OK" +} diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt index 8aa985c3a64..0f966df7fdf 100644 --- a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt @@ -1,25 +1,25 @@ // !LANGUAGE: +JvmRecordSupport // SKIP_TXT -@JvmRecord -class A0 +@JvmRecord +class A0 -@JvmRecord -class A1 { +@JvmRecord +class A1 { constructor() } -@JvmRecord -class A2() +@JvmRecord +class A2() -@JvmRecord -class A3(name: String) +@JvmRecord +class A3(name: String) -@JvmRecord -class A4(var name: String) +@JvmRecord +class A4(var name: String) -@JvmRecord -class A5(vararg val name: String, y: Int) +@JvmRecord +class A5(vararg val name: String, y: Int) @JvmRecord open class A6(val x: String) @@ -35,7 +35,7 @@ class A5(vararg val name: String, @JvmRecord class A10( val x: String, val y: Int, diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/irrelevantFields.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/irrelevantFields.kt index 8733a6eafe1..e7ab68514a0 100644 --- a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/irrelevantFields.kt +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/irrelevantFields.kt @@ -6,15 +6,15 @@ interface I val i: I = object : I {} @JvmRecord -class MyRec1(val name: String) : I by i +data class MyRec1(val name: String) : I by i @JvmRecord -class MyRec2(val name: String) { +data class MyRec2(val name: String) { val x: Int = 0 } @JvmRecord -class MyRec3(val name: String) { +data class MyRec3(val name: String) { val y: String get() = field + "1" @@ -24,12 +24,12 @@ class MyRec3(val name: String) { } @JvmRecord -class MyRec4(val name: String) { +data class MyRec4(val name: String) { val z: Int by lazy { 1 } } @JvmRecord -class MyRec5(val name: String) { +data class MyRec5(val name: String) { val w: String get() = name + "1" } diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt index e2f2df9e5db..03f7c4db25d 100644 --- a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt @@ -1,11 +1,11 @@ // !LANGUAGE: +JvmRecordSupport -@JvmRecord +@JvmRecord class BasicRecord(val x: String) @JvmRecord data class BasicDataRecord(val x: String) -@JvmRecord +@JvmRecord class BasicRecordWithSuperClass(val x: String) : Record() diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt index 0dcb9c4ea0f..0bb0aeb8f93 100644 --- a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt @@ -4,16 +4,16 @@ abstract class Abstract interface I @JvmRecord -class A1(val x: String) : Abstract(), I +data class A1(val x: String) : Abstract(), I @JvmRecord -class A2(val x: String) : Any(), I +data class A2(val x: String) : Any(), I @JvmRecord -class A3(val x: String) : Record(), I +data class A3(val x: String) : Record(), I @JvmRecord -class A4(val x: String) : java.lang.Record(), I +data class A4(val x: String) : java.lang.Record(), I @JvmRecord -class A5(val x: String) : I +data class A5(val x: String) : I diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.txt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.txt index ae493fa8619..aa23a5d9ad8 100644 --- a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.txt +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.txt @@ -1,40 +1,50 @@ package -@kotlin.jvm.JvmRecord public final class A1 : Abstract, I, java.lang.Record { +@kotlin.jvm.JvmRecord public final data class A1 : Abstract, I, java.lang.Record { public constructor A1(/*0*/ x: kotlin.String) public final val x: kotlin.String + public final operator /*synthesized*/ fun component1(): kotlin.String + public final /*synthesized*/ fun copy(/*0*/ x: kotlin.String = ...): A1 public open override /*3*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*3*/ /*synthesized*/ fun hashCode(): kotlin.Int public open override /*3*/ /*synthesized*/ fun toString(): kotlin.String } -@kotlin.jvm.JvmRecord public final class A2 : kotlin.Any, I, java.lang.Record { +@kotlin.jvm.JvmRecord public final data class A2 : kotlin.Any, I, java.lang.Record { public constructor A2(/*0*/ x: kotlin.String) public final val x: kotlin.String + public final operator /*synthesized*/ fun component1(): kotlin.String + public final /*synthesized*/ fun copy(/*0*/ x: kotlin.String = ...): A2 public open override /*3*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*3*/ /*synthesized*/ fun hashCode(): kotlin.Int public open override /*3*/ /*synthesized*/ fun toString(): kotlin.String } -@kotlin.jvm.JvmRecord public final class A3 : java.lang.Record, I { +@kotlin.jvm.JvmRecord public final data class A3 : java.lang.Record, I { public constructor A3(/*0*/ x: kotlin.String) public final val x: kotlin.String + public final operator /*synthesized*/ fun component1(): kotlin.String + public final /*synthesized*/ fun copy(/*0*/ x: kotlin.String = ...): A3 public open override /*2*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*2*/ /*synthesized*/ fun hashCode(): kotlin.Int public open override /*2*/ /*synthesized*/ fun toString(): kotlin.String } -@kotlin.jvm.JvmRecord public final class A4 : java.lang.Record, I { +@kotlin.jvm.JvmRecord public final data class A4 : java.lang.Record, I { public constructor A4(/*0*/ x: kotlin.String) public final val x: kotlin.String + public final operator /*synthesized*/ fun component1(): kotlin.String + public final /*synthesized*/ fun copy(/*0*/ x: kotlin.String = ...): A4 public open override /*2*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*2*/ /*synthesized*/ fun hashCode(): kotlin.Int public open override /*2*/ /*synthesized*/ fun toString(): kotlin.String } -@kotlin.jvm.JvmRecord public final class A5 : I, java.lang.Record { +@kotlin.jvm.JvmRecord public final data class A5 : I, java.lang.Record { public constructor A5(/*0*/ x: kotlin.String) public final val x: kotlin.String + public final operator /*synthesized*/ fun component1(): kotlin.String + public final /*synthesized*/ fun copy(/*0*/ x: kotlin.String = ...): A5 public open override /*2*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*2*/ /*synthesized*/ fun hashCode(): kotlin.Int public open override /*2*/ /*synthesized*/ fun toString(): kotlin.String diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15BlackBoxCodegenTestGenerated.java index c7a922ea017..0508221571b 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15BlackBoxCodegenTestGenerated.java @@ -45,6 +45,11 @@ public class Jdk15BlackBoxCodegenTestGenerated extends AbstractJdk15BlackBoxCode runTest("compiler/testData/codegen/java15/box/records/bytecodeShapeForJava.kt"); } + @TestMetadata("dataJvmRecord.kt") + public void testDataJvmRecord() throws Exception { + runTest("compiler/testData/codegen/java15/box/records/dataJvmRecord.kt"); + } + @TestMetadata("recordDifferentPropertyOverride.kt") public void testRecordDifferentPropertyOverride() throws Exception { runTest("compiler/testData/codegen/java15/box/records/recordDifferentPropertyOverride.kt"); From b860a0c6644ccf83cd0d56243ccb7b5829be5ad2 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Tue, 1 Dec 2020 18:17:57 +0300 Subject: [PATCH 520/698] Separate JvmTarget::bytecodeVersion version into major/minor parts --- .../kotlin/codegen/state/GenerationState.kt | 2 +- .../jetbrains/kotlin/cli/jvm/jvmArguments.kt | 6 +-- .../org/jetbrains/kotlin/config/JvmTarget.kt | 43 +++++++++---------- .../InlinePlatformCompatibilityChecker.kt | 2 +- .../jvm/checkers/declarationCheckers.kt | 2 +- .../kotlin/codegen/CodegenTestCase.java | 2 +- 6 files changed, 28 insertions(+), 29 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt index 1dbf3d2ffc8..e19871abf89 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt @@ -201,7 +201,7 @@ class GenerationState private constructor( val target = configuration.get(JVMConfigurationKeys.JVM_TARGET) ?: JvmTarget.DEFAULT val runtimeStringConcat = - if (target.bytecodeVersion >= JvmTarget.JVM_9.bytecodeVersion) + if (target.majorVersion >= JvmTarget.JVM_9.majorVersion) configuration.get(JVMConfigurationKeys.STRING_CONCAT) ?: JvmStringConcat.INLINE else JvmStringConcat.INLINE diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt index 8d8fdcc0549..992bf036778 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt @@ -39,7 +39,7 @@ fun CompilerConfiguration.setupJvmSpecificArguments(arguments: K2JVMCompilerArgu } val jvmTarget = get(JVMConfigurationKeys.JVM_TARGET) ?: JvmTarget.DEFAULT - if (jvmTarget.bytecodeVersion < JvmTarget.JVM_1_8.bytecodeVersion) { + if (jvmTarget.majorVersion < JvmTarget.JVM_1_8.majorVersion) { val jvmDefaultMode = languageVersionSettings.getFlag(JvmAnalysisFlags.jvmDefaultMode) if (jvmDefaultMode.forAllMethodsWithBody) { messageCollector.report( @@ -53,7 +53,7 @@ fun CompilerConfiguration.setupJvmSpecificArguments(arguments: K2JVMCompilerArgu val runtimeStringConcat = JvmStringConcat.fromString(arguments.stringConcat!!) if (runtimeStringConcat != null) { put(JVMConfigurationKeys.STRING_CONCAT, runtimeStringConcat) - if (jvmTarget.bytecodeVersion < JvmTarget.JVM_9.bytecodeVersion && runtimeStringConcat != JvmStringConcat.INLINE) { + if (jvmTarget.majorVersion < JvmTarget.JVM_9.majorVersion && runtimeStringConcat != JvmStringConcat.INLINE) { messageCollector.report( WARNING, "`-Xstring-concat=${arguments.stringConcat}` does nothing with JVM target `${jvmTarget.description}`." @@ -242,4 +242,4 @@ fun CompilerConfiguration.configureKlibPaths(arguments: K2JVMCompilerArguments) ?.toTypedArray() ?.filterNot { it.isEmpty() } ?.let { put(JVMConfigurationKeys.KLIB_PATHS, it) } -} \ No newline at end of file +} diff --git a/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt b/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt index e9f61674f66..bcb55969294 100644 --- a/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt +++ b/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt @@ -21,34 +21,33 @@ import org.jetbrains.org.objectweb.asm.Opcodes enum class JvmTarget( override val description: String, + val majorVersion: Int, val descriptionForJavacArgument: String = description, val isPreview: Boolean = false, ) : TargetPlatformVersion { - JVM_1_6("1.6"), - JVM_1_8("1.8"), - JVM_9("9"), - JVM_10("10"), - JVM_11("11"), - JVM_12("12"), - JVM_13("13"), - JVM_14("14"), - JVM_15("15"), - JVM_15_PREVIEW("15_PREVIEW", descriptionForJavacArgument = "15", isPreview = true), + JVM_1_6("1.6", Opcodes.V1_6), + JVM_1_8("1.8", Opcodes.V1_8), + JVM_9("9", Opcodes.V9), + JVM_10("10", Opcodes.V10), + JVM_11("11", Opcodes.V11), + JVM_12("12", Opcodes.V12), + JVM_13("13", Opcodes.V13), + JVM_14("14", Opcodes.V14), + JVM_15("15", Opcodes.V15), + JVM_15_PREVIEW( + "15_PREVIEW", Opcodes.V15, + descriptionForJavacArgument = "15", isPreview = true + ), ; + val minorVersion: Int = + if (isPreview) + 0xffff + else + 0 + val bytecodeVersion: Int by lazy { - when (this) { - JVM_1_6 -> Opcodes.V1_6 - JVM_1_8 -> Opcodes.V1_8 - JVM_9 -> Opcodes.V9 - JVM_10 -> Opcodes.V10 - JVM_11 -> Opcodes.V11 - JVM_12 -> Opcodes.V12 - JVM_13 -> Opcodes.V13 - JVM_14 -> Opcodes.V14 - JVM_15 -> Opcodes.V15 - JVM_15_PREVIEW -> Opcodes.V15 + (0xffff shl 16) - } + (minorVersion shl 16) + majorVersion } companion object { diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/InlinePlatformCompatibilityChecker.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/InlinePlatformCompatibilityChecker.kt index 90bbc8802b3..6f99ef8e748 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/InlinePlatformCompatibilityChecker.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/InlinePlatformCompatibilityChecker.kt @@ -62,7 +62,7 @@ class InlinePlatformCompatibilityChecker(val jvmTarget: JvmTarget, languageVersi val propertyOrFun = DescriptorUtils.getDirectMember(resultingDescriptor) - val compilingBytecodeVersion = jvmTarget.bytecodeVersion + val compilingBytecodeVersion = jvmTarget.majorVersion if (!properError) { val inliningBytecodeVersion = getBytecodeVersionIfDeserializedDescriptor(propertyOrFun, false) if (inliningBytecodeVersion != null && compilingBytecodeVersion < inliningBytecodeVersion) { diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/declarationCheckers.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/declarationCheckers.kt index 7041075f017..89d8adcb54f 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/declarationCheckers.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/declarationCheckers.kt @@ -59,7 +59,7 @@ class LocalFunInlineChecker : DeclarationChecker { } class JvmStaticChecker(jvmTarget: JvmTarget, languageVersionSettings: LanguageVersionSettings) : DeclarationChecker { - private val isLessJVM18 = jvmTarget.bytecodeVersion < JvmTarget.JVM_1_8.bytecodeVersion + private val isLessJVM18 = jvmTarget.majorVersion < JvmTarget.JVM_1_8.majorVersion private val supportJvmStaticInInterface = languageVersionSettings.supportsFeature(LanguageFeature.JvmStaticInInterface) diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java index 5c46f1b1baf..73d7b592784 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java @@ -460,7 +460,7 @@ public abstract class CodegenTestCase extends KotlinBaseTest originalTarget.getBytecodeVersion()) { + if (originalTarget == null || customDefaultTarget.getMajorVersion() > originalTarget.getMajorVersion()) { // It's not safe to substitute target in general // cause it can affect generated bytecode and original behaviour should be tested somehow. // Original behaviour testing is perfomed by From f64980a5976cdd3f7dcfce5579268b4236466736 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Tue, 1 Dec 2020 19:08:41 +0300 Subject: [PATCH 521/698] Add check for bytecode target when @JvmRecord is used ^KT-43677 In Progress --- .../src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt | 12 ++++++++++++ compiler/testData/cli/jvm/jvmRecordOk.args | 8 ++++++++ compiler/testData/cli/jvm/jvmRecordOk.kt | 2 ++ compiler/testData/cli/jvm/jvmRecordOk.out | 10 ++++++++++ compiler/testData/cli/jvm/jvmRecordWrongTarget.args | 8 ++++++++ compiler/testData/cli/jvm/jvmRecordWrongTarget.kt | 2 ++ compiler/testData/cli/jvm/jvmRecordWrongTarget.out | 11 +++++++++++ compiler/testData/cli/jvm/wrongJvmTargetVersion.out | 2 +- .../org/jetbrains/kotlin/cli/AbstractCliTest.java | 3 +++ .../org/jetbrains/kotlin/cli/CliTestGenerated.java | 10 ++++++++++ 10 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 compiler/testData/cli/jvm/jvmRecordOk.args create mode 100644 compiler/testData/cli/jvm/jvmRecordOk.kt create mode 100644 compiler/testData/cli/jvm/jvmRecordOk.out create mode 100644 compiler/testData/cli/jvm/jvmRecordWrongTarget.args create mode 100644 compiler/testData/cli/jvm/jvmRecordWrongTarget.kt create mode 100644 compiler/testData/cli/jvm/jvmRecordWrongTarget.out diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt index 992bf036778..87cd6044808 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt @@ -67,9 +67,21 @@ fun CompilerConfiguration.setupJvmSpecificArguments(arguments: K2JVMCompilerArgu } } + if (languageVersionSettings.supportsFeature(LanguageFeature.JvmRecordSupport) && !jvmTarget.isRecordsAllowed()) { + messageCollector.report( + ERROR, + "-XXLanguage:+${LanguageFeature.JvmRecordSupport} feature is only supported with JVM target ${JvmTarget.JVM_15_PREVIEW.description} or later" + ) + } + addAll(JVMConfigurationKeys.ADDITIONAL_JAVA_MODULES, arguments.additionalJavaModules?.asList()) } +private fun JvmTarget.isRecordsAllowed(): Boolean { + if (majorVersion < JvmTarget.JVM_15_PREVIEW.majorVersion) return false + return isPreview || majorVersion > JvmTarget.JVM_15_PREVIEW.majorVersion +} + fun CompilerConfiguration.configureJdkHome(arguments: K2JVMCompilerArguments): Boolean { val messageCollector = getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY) diff --git a/compiler/testData/cli/jvm/jvmRecordOk.args b/compiler/testData/cli/jvm/jvmRecordOk.args new file mode 100644 index 00000000000..f8aa7b4e607 --- /dev/null +++ b/compiler/testData/cli/jvm/jvmRecordOk.args @@ -0,0 +1,8 @@ +$TESTDATA_DIR$/jvmRecordWrongTarget.kt +-d +$TEMP_DIR$ +-jdk-home +$JDK_15$ +-XXLanguage:+JvmRecordSupport +-jvm-target +15_PREVIEW diff --git a/compiler/testData/cli/jvm/jvmRecordOk.kt b/compiler/testData/cli/jvm/jvmRecordOk.kt new file mode 100644 index 00000000000..429d606052c --- /dev/null +++ b/compiler/testData/cli/jvm/jvmRecordOk.kt @@ -0,0 +1,2 @@ +@JvmRecord +data class MyRec(val name: String) diff --git a/compiler/testData/cli/jvm/jvmRecordOk.out b/compiler/testData/cli/jvm/jvmRecordOk.out new file mode 100644 index 00000000000..ade09bd2ec2 --- /dev/null +++ b/compiler/testData/cli/jvm/jvmRecordOk.out @@ -0,0 +1,10 @@ +warning: ATTENTION! +This build uses unsafe internal compiler arguments: + +-XXLanguage:+JvmRecordSupport + +This mode is not recommended for production use, +as no stability/compatibility guarantees are given on +compiler or generated code. Use it at your own risk! + +OK diff --git a/compiler/testData/cli/jvm/jvmRecordWrongTarget.args b/compiler/testData/cli/jvm/jvmRecordWrongTarget.args new file mode 100644 index 00000000000..86dc212f348 --- /dev/null +++ b/compiler/testData/cli/jvm/jvmRecordWrongTarget.args @@ -0,0 +1,8 @@ +$TESTDATA_DIR$/jvmRecordWrongTarget.kt +-d +$TEMP_DIR$ +-cp +$JDK_15$ +-XXLanguage:+JvmRecordSupport +-jvm-target +9 diff --git a/compiler/testData/cli/jvm/jvmRecordWrongTarget.kt b/compiler/testData/cli/jvm/jvmRecordWrongTarget.kt new file mode 100644 index 00000000000..429d606052c --- /dev/null +++ b/compiler/testData/cli/jvm/jvmRecordWrongTarget.kt @@ -0,0 +1,2 @@ +@JvmRecord +data class MyRec(val name: String) diff --git a/compiler/testData/cli/jvm/jvmRecordWrongTarget.out b/compiler/testData/cli/jvm/jvmRecordWrongTarget.out new file mode 100644 index 00000000000..f4989fec672 --- /dev/null +++ b/compiler/testData/cli/jvm/jvmRecordWrongTarget.out @@ -0,0 +1,11 @@ +warning: ATTENTION! +This build uses unsafe internal compiler arguments: + +-XXLanguage:+JvmRecordSupport + +This mode is not recommended for production use, +as no stability/compatibility guarantees are given on +compiler or generated code. Use it at your own risk! + +error: -XXLanguage:+JvmRecordSupport feature is only supported with JVM target 15_PREVIEW or later +COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/wrongJvmTargetVersion.out b/compiler/testData/cli/jvm/wrongJvmTargetVersion.out index 7afaea0c1de..a7a87090cff 100644 --- a/compiler/testData/cli/jvm/wrongJvmTargetVersion.out +++ b/compiler/testData/cli/jvm/wrongJvmTargetVersion.out @@ -1,3 +1,3 @@ error: unknown JVM target version: 1.5 -Supported versions: 1.6, 1.8, 9, 10, 11, 12, 13, 14, 15 +Supported versions: 1.6, 1.8, 9, 10, 11, 12, 13, 14, 15, 15_PREVIEW COMPILATION_ERROR diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/cli/AbstractCliTest.java b/compiler/tests-common/tests/org/jetbrains/kotlin/cli/AbstractCliTest.java index 43f98edda4c..088dabfa2bf 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/cli/AbstractCliTest.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/cli/AbstractCliTest.java @@ -261,6 +261,9 @@ public abstract class AbstractCliTest extends TestCaseWithTmpdir { .replace( "$FOREIGN_ANNOTATIONS_DIR$", new File(AbstractForeignAnnotationsTestKt.getFOREIGN_ANNOTATIONS_SOURCES_PATH()).getPath() + ).replace( + "$JDK_15$", + KotlinTestUtils.getJdk15Home().getPath() ); } diff --git a/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java index 9c8ee054464..0887e77bfdd 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java @@ -530,6 +530,16 @@ public class CliTestGenerated extends AbstractCliTest { runTest("compiler/testData/cli/jvm/jvmDefaultAll.args"); } + @TestMetadata("jvmRecordOk.args") + public void testJvmRecordOk() throws Exception { + runTest("compiler/testData/cli/jvm/jvmRecordOk.args"); + } + + @TestMetadata("jvmRecordWrongTarget.args") + public void testJvmRecordWrongTarget() throws Exception { + runTest("compiler/testData/cli/jvm/jvmRecordWrongTarget.args"); + } + @TestMetadata("kotlinHomeWithoutStdlib.args") public void testKotlinHomeWithoutStdlib() throws Exception { runTest("compiler/testData/cli/jvm/kotlinHomeWithoutStdlib.args"); From a4bf36aee7b59cfd06a4ab5224ef0d2d36eed746 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Tue, 1 Dec 2020 19:16:27 +0300 Subject: [PATCH 522/698] Support @JvmRecord for JVM_IR ^KT-43677 In Progress --- .../backend/jvm/JvmGeneratorExtensions.kt | 34 ++++++++++ .../kotlin/psi2ir/generators/BodyGenerator.kt | 5 ++ .../psi2ir/generators/GeneratorExtensions.kt | 10 ++- .../AbstractJdk15IrBlackBoxCodegenTest.kt | 13 ++++ .../Jdk15IrBlackBoxCodegenTestGenerated.java | 68 +++++++++++++++++++ .../generators/tests/GenerateCompilerTests.kt | 4 ++ 6 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk15IrBlackBoxCodegenTest.kt create mode 100644 compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15IrBlackBoxCodegenTestGenerated.java diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmGeneratorExtensions.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmGeneratorExtensions.kt index ad6c5fcbc2e..13608a5a0dc 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmGeneratorExtensions.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmGeneratorExtensions.kt @@ -10,12 +10,16 @@ import org.jetbrains.kotlin.backend.common.ir.createParameterDeclarations import org.jetbrains.kotlin.codegen.SamType import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.annotations.FilteredAnnotations +import org.jetbrains.kotlin.incremental.components.NoLookupLocation +import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI import org.jetbrains.kotlin.ir.builders.declarations.addConstructor import org.jetbrains.kotlin.ir.builders.declarations.buildClass import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.declarations.impl.IrExternalPackageFragmentImpl import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns +import org.jetbrains.kotlin.ir.expressions.IrDelegatingConstructorCall +import org.jetbrains.kotlin.ir.expressions.impl.IrDelegatingConstructorCallImpl import org.jetbrains.kotlin.ir.symbols.impl.DescriptorlessExternalPackageFragmentSymbol import org.jetbrains.kotlin.ir.util.constructors import org.jetbrains.kotlin.load.java.JvmAnnotationNames @@ -27,11 +31,19 @@ import org.jetbrains.kotlin.load.java.typeEnhancement.hasEnhancedNullability import org.jetbrains.kotlin.load.kotlin.JvmPackagePartSource import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.psi.KtPureClassOrObject +import org.jetbrains.kotlin.psi.psiUtil.pureEndOffset +import org.jetbrains.kotlin.psi.psiUtil.pureStartOffset +import org.jetbrains.kotlin.psi2ir.generators.GeneratorContext import org.jetbrains.kotlin.psi2ir.generators.GeneratorExtensions import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.annotations.hasJvmStaticAnnotation +import org.jetbrains.kotlin.resolve.descriptorUtil.module +import org.jetbrains.kotlin.resolve.descriptorUtil.resolveTopLevelClass +import org.jetbrains.kotlin.resolve.jvm.JAVA_LANG_RECORD_FQ_NAME import org.jetbrains.kotlin.resolve.jvm.JvmClassName import org.jetbrains.kotlin.resolve.jvm.annotations.hasJvmFieldAnnotation +import org.jetbrains.kotlin.resolve.jvm.annotations.isJvmRecord import org.jetbrains.kotlin.resolve.scopes.MemberScope import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource import org.jetbrains.kotlin.types.KotlinType @@ -127,6 +139,28 @@ class JvmGeneratorExtensions(private val generateFacades: Boolean = true) : Gene } } + override fun createCustomSuperConstructorCall( + ktPureClassOrObject: KtPureClassOrObject, + descriptor: ClassDescriptor, + context: GeneratorContext + ): IrDelegatingConstructorCall? { + if (!descriptor.isJvmRecord()) return null + + val recordClass = + // We assume j.l.Record is in the classpath because otherwise it should be a compile time error + descriptor.module.resolveTopLevelClass(JAVA_LANG_RECORD_FQ_NAME, NoLookupLocation.FROM_BACKEND) + ?: error("Class not found: $JAVA_LANG_RECORD_FQ_NAME") + + val recordConstructor = recordClass.constructors.single() + // OptIn is needed for the same as for Any constructor at BodyGenerator::generateAnySuperConstructorCall + @OptIn(ObsoleteDescriptorBasedAPI::class) + return IrDelegatingConstructorCallImpl.fromSymbolDescriptor( + ktPureClassOrObject.pureStartOffset, ktPureClassOrObject.pureEndOffset, + context.irBuiltIns.unitType, + context.symbolTable.referenceConstructor(recordConstructor) + ) + } + private val flexibleNullabilityAnnotationClass = createSpecialAnnotationClass(FLEXIBLE_NULLABILITY_ANNOTATION_FQ_NAME, kotlinIrInternalPackage) diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/BodyGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/BodyGenerator.kt index 3305347b82e..2428ac4c49f 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/BodyGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/BodyGenerator.kt @@ -217,6 +217,11 @@ class BodyGenerator( private fun generateSuperConstructorCall(body: IrBlockBody, ktClassOrObject: KtPureClassOrObject) { val classDescriptor = ktClassOrObject.findClassDescriptor(context.bindingContext) + context.extensions.createCustomSuperConstructorCall(ktClassOrObject, classDescriptor, context)?.let { + body.statements.add(it) + return + } + when (classDescriptor.kind) { // enums can't be synthetic ClassKind.ENUM_CLASS -> generateEnumSuperConstructorCall(body, ktClassOrObject as KtClassOrObject, classDescriptor) diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/GeneratorExtensions.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/GeneratorExtensions.kt index 56e9c8008ff..7e0b83e2c42 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/GeneratorExtensions.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/GeneratorExtensions.kt @@ -6,10 +6,12 @@ package org.jetbrains.kotlin.psi2ir.generators import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.descriptors.DescriptorVisibility import org.jetbrains.kotlin.descriptors.PropertyDescriptor import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor -import org.jetbrains.kotlin.descriptors.DescriptorVisibility +import org.jetbrains.kotlin.ir.expressions.IrDelegatingConstructorCall import org.jetbrains.kotlin.ir.util.StubGeneratorExtensions +import org.jetbrains.kotlin.psi.KtPureClassOrObject import org.jetbrains.kotlin.resolve.scopes.MemberScope import org.jetbrains.kotlin.types.KotlinType @@ -29,4 +31,10 @@ open class GeneratorExtensions : StubGeneratorExtensions() { open fun computeFieldVisibility(descriptor: PropertyDescriptor): DescriptorVisibility? = null open fun getParentClassStaticScope(descriptor: ClassDescriptor): MemberScope? = null + + open fun createCustomSuperConstructorCall( + ktPureClassOrObject: KtPureClassOrObject, + descriptor: ClassDescriptor, + context: GeneratorContext, + ): IrDelegatingConstructorCall? = null } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk15IrBlackBoxCodegenTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk15IrBlackBoxCodegenTest.kt new file mode 100644 index 00000000000..199427f71c6 --- /dev/null +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk15IrBlackBoxCodegenTest.kt @@ -0,0 +1,13 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.codegen + +import org.jetbrains.kotlin.test.TargetBackend + +abstract class AbstractJdk15IrBlackBoxCodegenTest : AbstractJdk15BlackBoxCodegenTest() { + override val backend: TargetBackend + get() = TargetBackend.JVM_IR +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15IrBlackBoxCodegenTestGenerated.java new file mode 100644 index 00000000000..a1ac4871c41 --- /dev/null +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15IrBlackBoxCodegenTestGenerated.java @@ -0,0 +1,68 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.codegen; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("compiler/testData/codegen/java15/box") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class Jdk15IrBlackBoxCodegenTestGenerated extends AbstractJdk15IrBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInBox() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/java15/box"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/testData/codegen/java15/box/records") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Records extends AbstractJdk15IrBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInRecords() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/java15/box/records"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("bytecodeShapeForJava.kt") + public void testBytecodeShapeForJava() throws Exception { + runTest("compiler/testData/codegen/java15/box/records/bytecodeShapeForJava.kt"); + } + + @TestMetadata("dataJvmRecord.kt") + public void testDataJvmRecord() throws Exception { + runTest("compiler/testData/codegen/java15/box/records/dataJvmRecord.kt"); + } + + @TestMetadata("recordDifferentPropertyOverride.kt") + public void testRecordDifferentPropertyOverride() throws Exception { + runTest("compiler/testData/codegen/java15/box/records/recordDifferentPropertyOverride.kt"); + } + + @TestMetadata("recordDifferentSyntheticProperty.kt") + public void testRecordDifferentSyntheticProperty() throws Exception { + runTest("compiler/testData/codegen/java15/box/records/recordDifferentSyntheticProperty.kt"); + } + + @TestMetadata("recordPropertyAccess.kt") + public void testRecordPropertyAccess() throws Exception { + runTest("compiler/testData/codegen/java15/box/records/recordPropertyAccess.kt"); + } + } +} diff --git a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt index f06e2aba8f4..9d4dd0e0e52 100644 --- a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt +++ b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt @@ -215,6 +215,10 @@ fun main(args: Array) { model("codegen/java15/box") } + testClass { + model("codegen/java15/box") + } + testClass { model("codegen/java9/box") } From 695d0dbfbbfbb93ca2d33437cd3d7565d9f2ecfe Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Wed, 2 Dec 2020 13:29:42 +0300 Subject: [PATCH 523/698] Check JvmRecordSupport language feature before generating synthetic properties --- .../synthetic/JavaSyntheticPropertiesScope.kt | 8 +++++++- .../kotlin/synthetic/JavaSyntheticScopes.kt | 10 +++++++--- .../java15/box/records/recordPropertyAccess.kt | 1 + .../testsWithJava15/jvmRecord/disabledFeature.kt | 13 +++++++++++++ .../testsWithJava15/jvmRecord/simpleRecords.kt | 1 + .../DebuggerFieldExpressionCodegenExtension.kt | 9 +++++---- .../DebuggerFieldKotlinIndicesHelperExtension.kt | 6 +++--- 7 files changed, 37 insertions(+), 11 deletions(-) diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticPropertiesScope.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticPropertiesScope.kt index 972a38d8f01..2b3306695dc 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticPropertiesScope.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticPropertiesScope.kt @@ -94,7 +94,11 @@ interface SyntheticJavaPropertyDescriptor : PropertyDescriptor, SyntheticPropert } } -class JavaSyntheticPropertiesScope(storageManager: StorageManager, private val lookupTracker: LookupTracker) : SyntheticScope.Default() { +class JavaSyntheticPropertiesScope( + storageManager: StorageManager, + private val lookupTracker: LookupTracker, + private val supportJavaRecords: Boolean, +) : SyntheticScope.Default() { private val syntheticPropertyInClass = storageManager.createMemoizedFunction, SyntheticPropertyHolder> { pair -> syntheticPropertyInClassNotCached(pair.first, pair.second) @@ -178,6 +182,8 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager, private val l name: Name, ownerClass: ClassDescriptor ): PropertyDescriptor? { + if (!supportJavaRecords) return null + val componentLikeMethod = ownerClass.unsubstitutedMemberScope .getContributedFunctions(name, NoLookupLocation.FROM_SYNTHETIC_SCOPE) diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticScopes.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticScopes.kt index ac00ba1b552..f22925b77c1 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticScopes.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticScopes.kt @@ -22,9 +22,9 @@ import org.jetbrains.kotlin.config.LanguageVersionSettings import org.jetbrains.kotlin.descriptors.ModuleDescriptor import org.jetbrains.kotlin.extensions.ProjectExtensionDescriptor import org.jetbrains.kotlin.incremental.components.LookupTracker -import org.jetbrains.kotlin.resolve.sam.SamConversionResolver import org.jetbrains.kotlin.resolve.deprecation.DeprecationResolver import org.jetbrains.kotlin.resolve.sam.SamConversionOracle +import org.jetbrains.kotlin.resolve.sam.SamConversionResolver import org.jetbrains.kotlin.resolve.scopes.SyntheticScope import org.jetbrains.kotlin.resolve.scopes.SyntheticScopes import org.jetbrains.kotlin.resolve.scopes.synthetic.FunInterfaceConstructorsSyntheticScope @@ -52,7 +52,11 @@ class JavaSyntheticScopes( languageVersionSettings.supportsFeature(LanguageFeature.SamConversionPerArgument) && languageVersionSettings.supportsFeature(LanguageFeature.NewInference) - val javaSyntheticPropertiesScope = JavaSyntheticPropertiesScope(storageManager, lookupTracker) + val javaSyntheticPropertiesScope = + JavaSyntheticPropertiesScope( + storageManager, lookupTracker, + supportJavaRecords = languageVersionSettings.supportsFeature(LanguageFeature.JvmRecordSupport) + ) val scopesFromExtensions = SyntheticScopeProviderExtension .getInstances(project) .flatMap { it.getScopes(moduleDescriptor, javaSyntheticPropertiesScope) } @@ -100,4 +104,4 @@ interface SyntheticScopeProviderExtension { ) fun getScopes(moduleDescriptor: ModuleDescriptor, javaSyntheticPropertiesScope: JavaSyntheticPropertiesScope): List -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/java15/box/records/recordPropertyAccess.kt b/compiler/testData/codegen/java15/box/records/recordPropertyAccess.kt index 8b10b44304a..222fd6414ac 100644 --- a/compiler/testData/codegen/java15/box/records/recordPropertyAccess.kt +++ b/compiler/testData/codegen/java15/box/records/recordPropertyAccess.kt @@ -1,3 +1,4 @@ +// !LANGUAGE: +JvmRecordSupport // JVM_TARGET: 15_PREVIEW // FILE: MyRec.java public record MyRec(String name) {} diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/disabledFeature.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/disabledFeature.kt index 51212af265b..839708b63d0 100644 --- a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/disabledFeature.kt +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/disabledFeature.kt @@ -1,5 +1,8 @@ // !LANGUAGE: -JvmRecordSupport // SKIP_TXT +// FILE: JRecord.java +public record JRecord(int x, CharSequence y) {} +// FILE: main.kt @JvmRecord class MyRec( @@ -7,3 +10,13 @@ class MyRec( val y: Int, vararg val z: Double, ) + +fun foo(jr: JRecord) { + JRecord(1, "") + + jr.x() + jr.y() + + jr.x + jr.y +} diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/simpleRecords.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/simpleRecords.kt index 0517df7484f..a56a6b3b13e 100644 --- a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/simpleRecords.kt +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/simpleRecords.kt @@ -1,3 +1,4 @@ +// !LANGUAGE: +JvmRecordSupport // FILE: MyRecord.java public record MyRecord(int x, CharSequence y) { diff --git a/idea/jvm-debugger/jvm-debugger-evaluation/src/org/jetbrains/kotlin/idea/debugger/evaluate/DebuggerFieldExpressionCodegenExtension.kt b/idea/jvm-debugger/jvm-debugger-evaluation/src/org/jetbrains/kotlin/idea/debugger/evaluate/DebuggerFieldExpressionCodegenExtension.kt index 3a74da7bd94..63419ec6582 100644 --- a/idea/jvm-debugger/jvm-debugger-evaluation/src/org/jetbrains/kotlin/idea/debugger/evaluate/DebuggerFieldExpressionCodegenExtension.kt +++ b/idea/jvm-debugger/jvm-debugger-evaluation/src/org/jetbrains/kotlin/idea/debugger/evaluate/DebuggerFieldExpressionCodegenExtension.kt @@ -33,9 +33,10 @@ class DebuggerFieldExpressionCodegenExtension : ExpressionCodegenExtension { if (propertyDescriptor is JavaPropertyDescriptor) { val containingClass = propertyDescriptor.containingDeclaration as? JavaClassDescriptor if (containingClass != null) { - val correspondingGetter = JavaSyntheticPropertiesScope(LockBasedStorageManager.NO_LOCKS, LookupTracker.DO_NOTHING) - .getSyntheticExtensionProperties(listOf(containingClass.defaultType), NoLookupLocation.FROM_BACKEND) - .firstOrNull { it.name == propertyDescriptor.name } + val correspondingGetter = + JavaSyntheticPropertiesScope(LockBasedStorageManager.NO_LOCKS, LookupTracker.DO_NOTHING, supportJavaRecords = true) + .getSyntheticExtensionProperties(listOf(containingClass.defaultType), NoLookupLocation.FROM_BACKEND) + .firstOrNull { it.name == propertyDescriptor.name } if (correspondingGetter != null) { return c.codegen.intermediateValueForProperty( @@ -49,4 +50,4 @@ class DebuggerFieldExpressionCodegenExtension : ExpressionCodegenExtension { return null } -} \ No newline at end of file +} diff --git a/idea/jvm-debugger/jvm-debugger-evaluation/src/org/jetbrains/kotlin/idea/debugger/evaluate/DebuggerFieldKotlinIndicesHelperExtension.kt b/idea/jvm-debugger/jvm-debugger-evaluation/src/org/jetbrains/kotlin/idea/debugger/evaluate/DebuggerFieldKotlinIndicesHelperExtension.kt index 87fd3a9e63c..2cd73aa6ac3 100644 --- a/idea/jvm-debugger/jvm-debugger-evaluation/src/org/jetbrains/kotlin/idea/debugger/evaluate/DebuggerFieldKotlinIndicesHelperExtension.kt +++ b/idea/jvm-debugger/jvm-debugger-evaluation/src/org/jetbrains/kotlin/idea/debugger/evaluate/DebuggerFieldKotlinIndicesHelperExtension.kt @@ -13,7 +13,6 @@ import org.jetbrains.kotlin.incremental.components.LookupTracker import org.jetbrains.kotlin.storage.LockBasedStorageManager import org.jetbrains.kotlin.synthetic.JavaSyntheticPropertiesScope import org.jetbrains.kotlin.types.KotlinType -import java.lang.IllegalStateException class DebuggerFieldKotlinIndicesHelperExtension : KotlinIndicesHelperExtension { override fun appendExtensionCallables( @@ -23,7 +22,8 @@ class DebuggerFieldKotlinIndicesHelperExtension : KotlinIndicesHelperExtension { nameFilter: (String) -> Boolean, lookupLocation: LookupLocation ) { - val javaPropertiesScope = JavaSyntheticPropertiesScope(LockBasedStorageManager.NO_LOCKS, LookupTracker.DO_NOTHING) + val javaPropertiesScope = + JavaSyntheticPropertiesScope(LockBasedStorageManager.NO_LOCKS, LookupTracker.DO_NOTHING, supportJavaRecords = true) val fieldScope = DebuggerFieldSyntheticScope(javaPropertiesScope) for (property in fieldScope.getSyntheticExtensionProperties(receiverTypes, lookupLocation)) { @@ -41,4 +41,4 @@ class DebuggerFieldKotlinIndicesHelperExtension : KotlinIndicesHelperExtension { ) { throw IllegalStateException("Should not be called") } -} \ No newline at end of file +} From ddbd62054f4595d55730680fb820af98cc177bef Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Wed, 2 Dec 2020 16:13:22 +0300 Subject: [PATCH 524/698] Prohibit extending java.lang.Record from non-@JvmRecord classes --- .../checkers/JvmRecordApplicabilityChecker.kt | 10 +++++++++- .../diagnostics/DefaultErrorMessagesJvm.java | 1 + .../resolve/jvm/diagnostics/ErrorsJvm.java | 1 + .../jvmRecord/supertypesCheck.kt | 4 ++++ .../jvmRecord/supertypesCheck.txt | 20 +++++++++++++++++++ 5 files changed, 35 insertions(+), 1 deletion(-) diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt index 9bf745d6254..ff54e6dccb4 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt @@ -17,6 +17,7 @@ import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.checkers.DeclarationChecker import org.jetbrains.kotlin.resolve.checkers.DeclarationCheckerContext +import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameOrNull import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe import org.jetbrains.kotlin.resolve.descriptorUtil.resolveTopLevelClass import org.jetbrains.kotlin.resolve.jvm.JAVA_LANG_RECORD_FQ_NAME @@ -27,7 +28,14 @@ import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult object JvmRecordApplicabilityChecker : DeclarationChecker { override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) { - if (descriptor !is ClassDescriptor || declaration !is KtClassOrObject || !descriptor.isJvmRecord()) return + if (descriptor !is ClassDescriptor || declaration !is KtClassOrObject) return + + if (!descriptor.isJvmRecord()) { + if (descriptor.typeConstructor.supertypes.any { it.constructor.declarationDescriptor?.fqNameOrNull() == JAVA_LANG_RECORD_FQ_NAME }) { + context.trace.report(ErrorsJvm.ILLEGAL_JAVA_LANG_RECORD_SUPERTYPE.on(declaration)) + } + return + } val reportOn = declaration.annotationEntries.firstOrNull { it.shortName == JVM_RECORD_ANNOTATION_FQ_NAME.shortName() } diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java index 3d14accdb69..2de395e1786 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java @@ -164,6 +164,7 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension { MAP.put(FIELD_IN_JVM_RECORD, "It's not allowed to have non-constructor properties with backing filed in @JvmRecord class"); MAP.put(DELEGATION_BY_IN_JVM_RECORD, "Delegation is not allowed for @JvmRecord classes"); MAP.put(NON_DATA_CLASS_JVM_RECORD, "Only data classes are allowed to be marked as @JvmRecord"); + MAP.put(ILLEGAL_JAVA_LANG_RECORD_SUPERTYPE, "Only @JvmRecord classes are allowed to have java.lang.Record supertype"); String MESSAGE_FOR_CONCURRENT_HASH_MAP_CONTAINS = "Method 'contains' from ConcurrentHashMap may have unexpected semantics: it calls 'containsValue' instead of 'containsKey'. " + diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java index 17068ba9c75..a78ee260315 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java @@ -127,6 +127,7 @@ public interface ErrorsJvm { DiagnosticFactory0 FIELD_IN_JVM_RECORD = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 DELEGATION_BY_IN_JVM_RECORD = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 NON_DATA_CLASS_JVM_RECORD = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 ILLEGAL_JAVA_LANG_RECORD_SUPERTYPE = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 NON_JVM_DEFAULT_OVERRIDES_JAVA_DEFAULT = DiagnosticFactory0.create(WARNING, DECLARATION_SIGNATURE); diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt index 0bb0aeb8f93..1db55f41fe7 100644 --- a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt @@ -17,3 +17,7 @@ data class A4(val x: String) : java.lang.Record(), I @JvmRecord data class A5(val x: String) : I + +data class A6(val x: String) : Record(), I + +data class A7(val x: String) : java.lang.Record(), I diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.txt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.txt index aa23a5d9ad8..e33f8d91d92 100644 --- a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.txt +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.txt @@ -50,6 +50,26 @@ package public open override /*2*/ /*synthesized*/ fun toString(): kotlin.String } +public final data class A6 : java.lang.Record, I { + public constructor A6(/*0*/ x: kotlin.String) + public final val x: kotlin.String + public final operator /*synthesized*/ fun component1(): kotlin.String + public final /*synthesized*/ fun copy(/*0*/ x: kotlin.String = ...): A6 + public open override /*2*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*2*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*2*/ /*synthesized*/ fun toString(): kotlin.String +} + +public final data class A7 : java.lang.Record, I { + public constructor A7(/*0*/ x: kotlin.String) + public final val x: kotlin.String + public final operator /*synthesized*/ fun component1(): kotlin.String + public final /*synthesized*/ fun copy(/*0*/ x: kotlin.String = ...): A7 + public open override /*2*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*2*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*2*/ /*synthesized*/ fun toString(): kotlin.String +} + public abstract class Abstract { public constructor Abstract() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean From 6e4f84dddfc85fed15c68e19ae4a359119e40501 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Wed, 2 Dec 2020 17:47:13 +0300 Subject: [PATCH 525/698] Add @SinceKotlin("1.5") on JvmRecord annotation --- compiler/testData/cli/jvm/jvmRecordWrongTarget.out | 3 ++- .../codegen/java15/box/records/bytecodeShapeForJava.kt | 1 + compiler/testData/codegen/java15/box/records/dataJvmRecord.kt | 1 + .../diagnostics/testsWithJava15/jvmRecord/diagnostics.kt | 1 + .../diagnostics/testsWithJava15/jvmRecord/disabledFeature.kt | 1 + .../diagnostics/testsWithJava15/jvmRecord/irrelevantFields.kt | 1 + .../testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt | 1 + .../diagnostics/testsWithJava15/jvmRecord/simpleRecords.kt | 1 + .../diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt | 1 + .../testsWithStdLib/annotations/jvmRecordWithoutJdk15.fir.kt | 1 + .../testsWithStdLib/annotations/jvmRecordWithoutJdk15.kt | 1 + libraries/stdlib/common/src/kotlin/JvmAnnotationsH.kt | 2 +- .../runtime/kotlin/jvm/annotations/JvmPlatformAnnotations.kt | 1 + 13 files changed, 14 insertions(+), 2 deletions(-) diff --git a/compiler/testData/cli/jvm/jvmRecordWrongTarget.out b/compiler/testData/cli/jvm/jvmRecordWrongTarget.out index f4989fec672..8e6229c35bd 100644 --- a/compiler/testData/cli/jvm/jvmRecordWrongTarget.out +++ b/compiler/testData/cli/jvm/jvmRecordWrongTarget.out @@ -7,5 +7,6 @@ This mode is not recommended for production use, as no stability/compatibility guarantees are given on compiler or generated code. Use it at your own risk! -error: -XXLanguage:+JvmRecordSupport feature is only supported with JVM target 15_PREVIEW or later +warning: language version 1.5 is experimental, there are no backwards compatibility guarantees for new language and library features +error: -XXLanguage:+JvmRecordSupport feature is only supported with JVM target 15 or later COMPILATION_ERROR diff --git a/compiler/testData/codegen/java15/box/records/bytecodeShapeForJava.kt b/compiler/testData/codegen/java15/box/records/bytecodeShapeForJava.kt index 45ba2eb96b4..4d5ec2b2c74 100644 --- a/compiler/testData/codegen/java15/box/records/bytecodeShapeForJava.kt +++ b/compiler/testData/codegen/java15/box/records/bytecodeShapeForJava.kt @@ -1,3 +1,4 @@ +// !API_VERSION: 1.5 // !LANGUAGE: +JvmRecordSupport // JVM_TARGET: 15_PREVIEW // FILE: JavaClass.java diff --git a/compiler/testData/codegen/java15/box/records/dataJvmRecord.kt b/compiler/testData/codegen/java15/box/records/dataJvmRecord.kt index 5e606378551..e4e227fa580 100644 --- a/compiler/testData/codegen/java15/box/records/dataJvmRecord.kt +++ b/compiler/testData/codegen/java15/box/records/dataJvmRecord.kt @@ -1,3 +1,4 @@ +// !API_VERSION: 1.5 // !LANGUAGE: +JvmRecordSupport // JVM_TARGET: 15_PREVIEW diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt index 0f966df7fdf..6e3584e5de5 100644 --- a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt @@ -1,3 +1,4 @@ +// !API_VERSION: 1.5 // !LANGUAGE: +JvmRecordSupport // SKIP_TXT diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/disabledFeature.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/disabledFeature.kt index 839708b63d0..c518c1bcecc 100644 --- a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/disabledFeature.kt +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/disabledFeature.kt @@ -1,3 +1,4 @@ +// !API_VERSION: 1.5 // !LANGUAGE: -JvmRecordSupport // SKIP_TXT // FILE: JRecord.java diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/irrelevantFields.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/irrelevantFields.kt index e7ab68514a0..4055201e76d 100644 --- a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/irrelevantFields.kt +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/irrelevantFields.kt @@ -1,3 +1,4 @@ +// !API_VERSION: 1.5 // !LANGUAGE: +JvmRecordSupport // SKIP_TXT diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt index 03f7c4db25d..5d76ab12982 100644 --- a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt @@ -1,3 +1,4 @@ +// !API_VERSION: 1.5 // !LANGUAGE: +JvmRecordSupport @JvmRecord diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/simpleRecords.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/simpleRecords.kt index a56a6b3b13e..8d52377b34f 100644 --- a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/simpleRecords.kt +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/simpleRecords.kt @@ -1,3 +1,4 @@ +// !API_VERSION: 1.5 // !LANGUAGE: +JvmRecordSupport // FILE: MyRecord.java public record MyRecord(int x, CharSequence y) { diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt index 1db55f41fe7..6d7a4092a6d 100644 --- a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt @@ -1,3 +1,4 @@ +// !API_VERSION: 1.5 // !LANGUAGE: +JvmRecordSupport abstract class Abstract diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.fir.kt index a9d577ce323..414fc8fb11a 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.fir.kt @@ -1,4 +1,5 @@ // !LANGUAGE: +JvmRecordSupport +// !API_VERSION: 1.5 // SKIP_TXT @JvmRecord diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.kt index 8012ef2fdcb..9b419f6224d 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.kt @@ -1,4 +1,5 @@ // !LANGUAGE: +JvmRecordSupport +// !API_VERSION: 1.5 // SKIP_TXT @JvmRecord diff --git a/libraries/stdlib/common/src/kotlin/JvmAnnotationsH.kt b/libraries/stdlib/common/src/kotlin/JvmAnnotationsH.kt index 99956bdf2ee..313e185c4f0 100644 --- a/libraries/stdlib/common/src/kotlin/JvmAnnotationsH.kt +++ b/libraries/stdlib/common/src/kotlin/JvmAnnotationsH.kt @@ -119,6 +119,7 @@ public expect annotation class JvmInline() @Target(AnnotationTarget.CLASS) @MustBeDocumented @OptionalExpectation +@SinceKotlin("1.5") public expect annotation class JvmRecord /** @@ -166,4 +167,3 @@ public expect annotation class Synchronized() @SinceKotlin("1.2") @OptionalExpectation internal expect annotation class JvmPackageName(val name: String) - diff --git a/libraries/stdlib/jvm/runtime/kotlin/jvm/annotations/JvmPlatformAnnotations.kt b/libraries/stdlib/jvm/runtime/kotlin/jvm/annotations/JvmPlatformAnnotations.kt index a96202d3ec1..b4840dcf71d 100644 --- a/libraries/stdlib/jvm/runtime/kotlin/jvm/annotations/JvmPlatformAnnotations.kt +++ b/libraries/stdlib/jvm/runtime/kotlin/jvm/annotations/JvmPlatformAnnotations.kt @@ -152,4 +152,5 @@ public actual annotation class JvmInline @Target(AnnotationTarget.CLASS) @Retention(AnnotationRetention.SOURCE) @MustBeDocumented +@SinceKotlin("1.5") public actual annotation class JvmRecord From ac0604377d1fb8f9c50358566dd1d7647ede670d Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Tue, 8 Dec 2020 12:09:22 +0300 Subject: [PATCH 526/698] Minor. Extract runJvmInstance for running BB tests with custom JVM --- .../AbstractCustomJDKBlackBoxCodegenTest.kt | 47 ++++++++++++------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCustomJDKBlackBoxCodegenTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCustomJDKBlackBoxCodegenTest.kt index 50855f28539..68bbe470618 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCustomJDKBlackBoxCodegenTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCustomJDKBlackBoxCodegenTest.kt @@ -56,26 +56,37 @@ abstract class AbstractCustomJDKBlackBoxCodegenTest : AbstractBlackBoxCodegenTes val fileFactory = generateClassesInFile() fileFactory.writeAll(tmpdir, null) - val jdkHome = getJdkHome() - val javaExe = File(jdkHome, "bin/java.exe").takeIf(File::exists) - ?: File(jdkHome, "bin/java").takeIf(File::exists) - ?: error("Can't find 'java' executable in $jdkHome") - - - val command = arrayOf( - javaExe.absolutePath, - "-ea", - *getAdditionalJvmArgs().toTypedArray(), - "-classpath", - listOfNotNull( + runJvmInstance( + getJdkHome(), getAdditionalJvmArgs(), + classPath = listOfNotNull( tmpdir, ForTestCompileRuntime.runtimeJarForTests(), javaClassesOutputDirectory - ).joinToString(File.pathSeparator, transform = File::getAbsolutePath), - getFacadeFqName(myFiles.psiFile) + ), + classNameToRun = getFacadeFqName(myFiles.psiFile)!! ) - - val process = ProcessBuilder(*command).inheritIO().start() - process.waitFor(1, TimeUnit.MINUTES) - assertEquals(0, process.exitValue()) } } + +internal fun runJvmInstance( + jdkHome: File, + additionalArgs: List, + classPath: List, + classNameToRun: String, +) { + val javaExe = File(jdkHome, "bin/java.exe").takeIf(File::exists) + ?: File(jdkHome, "bin/java").takeIf(File::exists) + ?: error("Can't find 'java' executable in $jdkHome") + + val command = arrayOf( + javaExe.absolutePath, + "-ea", + *additionalArgs.toTypedArray(), + "-classpath", + classPath.joinToString(File.pathSeparator, transform = File::getAbsolutePath), + classNameToRun, + ) + + val process = ProcessBuilder(*command).inheritIO().start() + process.waitFor(1, TimeUnit.MINUTES) + AbstractBlackBoxCodegenTest.assertEquals(0, process.exitValue()) +} From dc1a1c5821eafff5da9b857c3c41d38fee53ecdd Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Thu, 3 Dec 2020 17:59:14 +0300 Subject: [PATCH 527/698] Support cross-module usages of @JvmRecord classes The problem is that JvmRecord has SOURCE retention Probably, increasing its retention might be a more reliable solution (or in some other way serializing that the class is a record) Just checking supertypes seems like a reasonable approximation: only records kotlin are allowed to extend j.l.Record. But the relevant diagnostic has been added only since 1.4.30, so potentially there could have been exist a non-record class with such supertype compiled by 1.4.20, but this case seems to be ill-formed and marginal anyway. For Java classes, it's irrelevant since they don't have member properties (only synthetic extensions) ^KT-43677 In Progress --- .../kotlin/codegen/state/KotlinTypeMapper.kt | 7 ++-- .../jvm/codegen/MethodSignatureMapper.kt | 7 ++-- .../org/jetbrains/kotlin/ir/types/irTypes.kt | 5 +++ .../jvmRecordBinary.kt | 16 +++++++++ ...ractCompileKotlinAgainstKotlinJdk15Test.kt | 27 ++++++++++++++ ...bstractCompileKotlinAgainstKotlinTest.java | 6 ++-- ...ctIrCompileKotlinAgainstKotlinJdk15Test.kt | 18 ++++++++++ ...KotlinAgainstKotlinJdk15TestGenerated.java | 35 +++++++++++++++++++ ...KotlinAgainstKotlinJdk15TestGenerated.java | 35 +++++++++++++++++++ .../generators/tests/GenerateCompilerTests.kt | 8 +++++ 10 files changed, 156 insertions(+), 8 deletions(-) create mode 100644 compiler/testData/compileKotlinAgainstKotlinJdk15/jvmRecordBinary.kt create mode 100644 compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstKotlinJdk15Test.kt create mode 100644 compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractIrCompileKotlinAgainstKotlinJdk15Test.kt create mode 100644 compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinJdk15TestGenerated.java create mode 100644 compiler/tests-gen/org/jetbrains/kotlin/codegen/IrCompileKotlinAgainstKotlinJdk15TestGenerated.java diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt index b6c994a9b89..9df67a870c3 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt @@ -61,9 +61,9 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.isPublishedApi import org.jetbrains.kotlin.resolve.descriptorUtil.module import org.jetbrains.kotlin.resolve.jvm.AsmTypes.DEFAULT_CONSTRUCTOR_MARKER import org.jetbrains.kotlin.resolve.jvm.AsmTypes.OBJECT_TYPE +import org.jetbrains.kotlin.resolve.jvm.JAVA_LANG_RECORD_FQ_NAME import org.jetbrains.kotlin.resolve.jvm.JvmClassName import org.jetbrains.kotlin.resolve.jvm.annotations.isCompiledToJvmDefault -import org.jetbrains.kotlin.resolve.jvm.annotations.isJvmRecord import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodGenericSignature import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature @@ -592,7 +592,7 @@ class KotlinTypeMapper @JvmOverloads constructor( return property.name.asString() } - if ((containingDeclaration as? ClassDescriptor)?.isJvmRecord() == true) return property.name.asString() + if ((containingDeclaration as? ClassDescriptor)?.hasJavaLangRecordSupertype() == true) return property.name.asString() val isAccessor = property is AccessorForPropertyDescriptor val propertyName = if (isAccessor) @@ -628,6 +628,9 @@ class KotlinTypeMapper @JvmOverloads constructor( } } + private fun ClassDescriptor.hasJavaLangRecordSupertype() = + typeConstructor.supertypes.any { KotlinBuiltIns.isConstructedFromGivenClass(it, JAVA_LANG_RECORD_FQ_NAME) } + private val shouldMangleByReturnType = languageVersionSettings.supportsFeature(LanguageFeature.MangleClassMembersReturningInlineClasses) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt index 1e9427642f5..ee529cefb01 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt @@ -41,7 +41,7 @@ import org.jetbrains.kotlin.metadata.deserialization.getExtensionOrNull import org.jetbrains.kotlin.metadata.jvm.JvmProtoBuf import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil import org.jetbrains.kotlin.name.NameUtils -import org.jetbrains.kotlin.resolve.jvm.annotations.JVM_RECORD_ANNOTATION_FQ_NAME +import org.jetbrains.kotlin.resolve.jvm.JAVA_LANG_RECORD_FQ_NAME import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodGenericSignature import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature @@ -84,8 +84,7 @@ class MethodSignatureMapper(private val context: JvmBackendContext) { if (property != null) { val propertyName = property.name.asString() val propertyParent = property.parentAsClass - if (propertyParent.isAnnotationClass || propertyParent.hasAnnotation(JVM_RECORD_ANNOTATION_FQ_NAME)) - return propertyName + if (propertyParent.isAnnotationClass || propertyParent.superTypes.any { it.isJavaLangRecord() }) return propertyName // The enum property getters and have special names which also // apply to their fake overrides. Unfortunately, getJvmMethodNameIfSpecial does not handle @@ -102,6 +101,8 @@ class MethodSignatureMapper(private val context: JvmBackendContext) { return mangleMemberNameIfRequired(function.name.asString(), function) } + private fun IrType.isJavaLangRecord() = getClass()!!.hasEqualFqName(JAVA_LANG_RECORD_FQ_NAME) + private fun mangleMemberNameIfRequired(name: String, function: IrSimpleFunction): String { val newName = JvmCodegenUtil.sanitizeNameIfNeeded(name, context.state.languageVersionSettings) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/irTypes.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/irTypes.kt index 148e8ad430b..00c2732e0cf 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/irTypes.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/irTypes.kt @@ -17,7 +17,9 @@ import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol import org.jetbrains.kotlin.ir.types.impl.* import org.jetbrains.kotlin.ir.util.defaultType +import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable import org.jetbrains.kotlin.ir.util.isPropertyAccessor +import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.types.* import org.jetbrains.kotlin.types.typeUtil.makeNotNullable import org.jetbrains.kotlin.types.typeUtil.makeNullable @@ -74,6 +76,9 @@ val IrType.classifierOrNull: IrClassifierSymbol? val IrType.classOrNull: IrClassSymbol? get() = classifierOrNull as? IrClassSymbol +val IrType.classFqName: FqName? + get() = classOrNull?.owner?.fqNameWhenAvailable + val IrTypeArgument.typeOrNull: IrType? get() = (this as? IrTypeProjection)?.type fun IrType.makeNotNull() = diff --git a/compiler/testData/compileKotlinAgainstKotlinJdk15/jvmRecordBinary.kt b/compiler/testData/compileKotlinAgainstKotlinJdk15/jvmRecordBinary.kt new file mode 100644 index 00000000000..1a03e42f875 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstKotlinJdk15/jvmRecordBinary.kt @@ -0,0 +1,16 @@ +// !API_VERSION: 1.5 +// !LANGUAGE: +JvmRecordSupport +// JVM_TARGET: 15_PREVIEW +// FILE: A.kt +@JvmRecord +data class MyRecord(val foo: String, val bar: String) + +// FILE: B.kt + +fun main() { + val myRecord = MyRecord("O", "K") + val s = myRecord.foo + myRecord.bar + if (s != "OK") { + throw AssertionError("fail: $s") + } +} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstKotlinJdk15Test.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstKotlinJdk15Test.kt new file mode 100644 index 00000000000..fbad556ee4b --- /dev/null +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstKotlinJdk15Test.kt @@ -0,0 +1,27 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.codegen + +import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime +import org.jetbrains.kotlin.test.KotlinTestUtils +import org.jetbrains.kotlin.test.TestJdkKind + +abstract class AbstractCompileKotlinAgainstKotlinJdk15Test : AbstractCompileKotlinAgainstKotlinTest() { + override fun invokeBox(className: String) { + runJvmInstance( + KotlinTestUtils.getJdk15Home(), + additionalArgs = listOf("--enable-preview"), + classPath = listOfNotNull( + aDir, bDir, ForTestCompileRuntime.runtimeJarForTests(), + ), + className + ) + } + + override fun getTestJdkKind(files: List): TestJdkKind { + return TestJdkKind.FULL_JDK_15 + } +} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstKotlinTest.java b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstKotlinTest.java index 1079b2c6760..9085cf3b184 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstKotlinTest.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstKotlinTest.java @@ -35,8 +35,8 @@ import java.util.stream.Collectors; public abstract class AbstractCompileKotlinAgainstKotlinTest extends CodegenTestCase { private File tmpdir; - private File aDir; - private File bDir; + protected File aDir; + protected File bDir; @Override protected void setUp() throws Exception { @@ -80,7 +80,7 @@ public abstract class AbstractCompileKotlinAgainstKotlinTest extends CodegenTest return new Pair<>(factoryA, factoryB); } - private void invokeBox(@NotNull String className) throws Exception { + protected void invokeBox(@NotNull String className) throws Exception { callBoxMethodAndCheckResult(createGeneratedClassLoader(), className); } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractIrCompileKotlinAgainstKotlinJdk15Test.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractIrCompileKotlinAgainstKotlinJdk15Test.kt new file mode 100644 index 00000000000..f7c555620b6 --- /dev/null +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractIrCompileKotlinAgainstKotlinJdk15Test.kt @@ -0,0 +1,18 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.codegen + +import org.jetbrains.kotlin.test.TargetBackend + +abstract class AbstractIrCompileKotlinAgainstKotlinJdk15Test : AbstractCompileKotlinAgainstKotlinJdk15Test() { + override fun getBackendA(): TargetBackend { + return TargetBackend.JVM_IR + } + + override fun getBackendB(): TargetBackend { + return TargetBackend.JVM_IR + } +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinJdk15TestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinJdk15TestGenerated.java new file mode 100644 index 00000000000..bdaf5dfa80c --- /dev/null +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinJdk15TestGenerated.java @@ -0,0 +1,35 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.codegen; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("compiler/testData/compileKotlinAgainstKotlinJdk15") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class CompileKotlinAgainstKotlinJdk15TestGenerated extends AbstractCompileKotlinAgainstKotlinJdk15Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInCompileKotlinAgainstKotlinJdk15() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlinJdk15"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("jvmRecordBinary.kt") + public void testJvmRecordBinary() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlinJdk15/jvmRecordBinary.kt"); + } +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/IrCompileKotlinAgainstKotlinJdk15TestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/IrCompileKotlinAgainstKotlinJdk15TestGenerated.java new file mode 100644 index 00000000000..f4ff67670fb --- /dev/null +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/IrCompileKotlinAgainstKotlinJdk15TestGenerated.java @@ -0,0 +1,35 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.codegen; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("compiler/testData/compileKotlinAgainstKotlinJdk15") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class IrCompileKotlinAgainstKotlinJdk15TestGenerated extends AbstractIrCompileKotlinAgainstKotlinJdk15Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInCompileKotlinAgainstKotlinJdk15() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlinJdk15"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("jvmRecordBinary.kt") + public void testJvmRecordBinary() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlinJdk15/jvmRecordBinary.kt"); + } +} diff --git a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt index 9d4dd0e0e52..6310e05612c 100644 --- a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt +++ b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt @@ -368,6 +368,14 @@ fun main(args: Array) { model("compileKotlinAgainstKotlin") } + testClass { + model("compileKotlinAgainstKotlinJdk15") + } + + testClass { + model("compileKotlinAgainstKotlinJdk15") + } + testClass { model("renderer") } From 3abd8b1ab280a3a34ccb2165ee738cf428a1a4ef Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Fri, 4 Dec 2020 18:44:28 +0300 Subject: [PATCH 528/698] Adapt CliTests for api requirement of @JvmRecord --- compiler/testData/cli/jvm/{jvmRecordOk.kt => jvmRecord.kt} | 0 compiler/testData/cli/jvm/jvmRecordOk.args | 6 +++++- compiler/testData/cli/jvm/jvmRecordWrongTarget.args | 6 +++++- compiler/testData/cli/jvm/jvmRecordWrongTarget.kt | 2 -- 4 files changed, 10 insertions(+), 4 deletions(-) rename compiler/testData/cli/jvm/{jvmRecordOk.kt => jvmRecord.kt} (100%) delete mode 100644 compiler/testData/cli/jvm/jvmRecordWrongTarget.kt diff --git a/compiler/testData/cli/jvm/jvmRecordOk.kt b/compiler/testData/cli/jvm/jvmRecord.kt similarity index 100% rename from compiler/testData/cli/jvm/jvmRecordOk.kt rename to compiler/testData/cli/jvm/jvmRecord.kt diff --git a/compiler/testData/cli/jvm/jvmRecordOk.args b/compiler/testData/cli/jvm/jvmRecordOk.args index f8aa7b4e607..b975df8aa47 100644 --- a/compiler/testData/cli/jvm/jvmRecordOk.args +++ b/compiler/testData/cli/jvm/jvmRecordOk.args @@ -1,6 +1,10 @@ -$TESTDATA_DIR$/jvmRecordWrongTarget.kt +$TESTDATA_DIR$/jvmRecord.kt -d $TEMP_DIR$ +-api-version +1.5 +-language-version +1.5 -jdk-home $JDK_15$ -XXLanguage:+JvmRecordSupport diff --git a/compiler/testData/cli/jvm/jvmRecordWrongTarget.args b/compiler/testData/cli/jvm/jvmRecordWrongTarget.args index 86dc212f348..807f3b5ee9a 100644 --- a/compiler/testData/cli/jvm/jvmRecordWrongTarget.args +++ b/compiler/testData/cli/jvm/jvmRecordWrongTarget.args @@ -1,6 +1,10 @@ -$TESTDATA_DIR$/jvmRecordWrongTarget.kt +$TESTDATA_DIR$/jvmRecord.kt -d $TEMP_DIR$ +-api-version +1.5 +-language-version +1.5 -cp $JDK_15$ -XXLanguage:+JvmRecordSupport diff --git a/compiler/testData/cli/jvm/jvmRecordWrongTarget.kt b/compiler/testData/cli/jvm/jvmRecordWrongTarget.kt deleted file mode 100644 index 429d606052c..00000000000 --- a/compiler/testData/cli/jvm/jvmRecordWrongTarget.kt +++ /dev/null @@ -1,2 +0,0 @@ -@JvmRecord -data class MyRec(val name: String) From 46c3979acd06a6eb8ef6e5cd3e01827362b1ec9c Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Fri, 4 Dec 2020 19:04:14 +0300 Subject: [PATCH 529/698] Separate JVM target option from javac's --enable-preview analogue --- .../kotlin/codegen/state/GenerationState.kt | 5 ++++- .../arguments/K2JVMCompilerArguments.kt | 7 ++++++ .../jetbrains/kotlin/cli/jvm/jvmArguments.kt | 16 +++++++++----- .../kotlin/config/JVMConfigurationKeys.java | 3 +++ .../org/jetbrains/kotlin/config/JvmTarget.kt | 22 +++---------------- compiler/testData/cli/jvm/extraHelp.out | 2 ++ compiler/testData/cli/jvm/jvmRecordOk.args | 3 ++- compiler/testData/cli/jvm/jvmRecordOk.out | 2 ++ .../cli/jvm/wrongJvmTargetVersion.out | 2 +- .../box/records/bytecodeShapeForJava.kt | 3 ++- .../java15/box/records/dataJvmRecord.kt | 3 ++- .../recordDifferentPropertyOverride.kt | 3 ++- .../recordDifferentSyntheticProperty.kt | 3 ++- .../box/records/recordPropertyAccess.kt | 3 ++- .../jvmRecordBinary.kt | 3 ++- .../AbstractBlackBoxAgainstJavaCodegenTest.kt | 9 +++++++- .../kotlin/codegen/CodegenTestCase.java | 18 ++++++++++----- .../jetbrains/kotlin/test/KotlinBaseTest.kt | 5 +++++ 18 files changed, 73 insertions(+), 39 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt index e19871abf89..1923db861c7 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt @@ -272,7 +272,10 @@ class GenerationState private constructor( val rootContext: CodegenContext<*> = RootContext(this) - val classFileVersion: Int = target.bytecodeVersion + val classFileVersion: Int = run { + val minorVersion = if (configuration.getBoolean(JVMConfigurationKeys.ENABLE_JVM_PREVIEW)) 0xffff else 0 + (minorVersion shl 16) + target.majorVersion + } val generateParametersMetadata: Boolean = configuration.getBoolean(JVMConfigurationKeys.PARAMETERS_METADATA) diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt index e86edf8ff64..6ba157ce2d2 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt @@ -418,6 +418,13 @@ class K2JVMCompilerArguments : CommonCompilerArguments() { ) var useOldInlineClassesManglingScheme: Boolean by FreezableVar(false) + @Argument( + value = "-Xjvm-enable-preview", + description = "Allow using features from Java language that are in preview phase.\n" + + "Works as `--enable-preview` in Java. All class files are marked as preview-generated thus it won't be possible to use them in release environment" + ) + var enableJvmPreview: Boolean by FreezableVar(false) + override fun configureAnalysisFlags(collector: MessageCollector): MutableMap, Any> { val result = super.configureAnalysisFlags(collector) result[JvmAnalysisFlags.strictMetadataVersionSemantics] = strictMetadataVersionSemantics diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt index 87cd6044808..16b31435ac4 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt @@ -67,19 +67,19 @@ fun CompilerConfiguration.setupJvmSpecificArguments(arguments: K2JVMCompilerArgu } } - if (languageVersionSettings.supportsFeature(LanguageFeature.JvmRecordSupport) && !jvmTarget.isRecordsAllowed()) { + if (languageVersionSettings.supportsFeature(LanguageFeature.JvmRecordSupport) && !jvmTarget.areRecordsAllowed(arguments.enableJvmPreview)) { messageCollector.report( ERROR, - "-XXLanguage:+${LanguageFeature.JvmRecordSupport} feature is only supported with JVM target ${JvmTarget.JVM_15_PREVIEW.description} or later" + "-XXLanguage:+${LanguageFeature.JvmRecordSupport} feature is only supported with JVM target ${JvmTarget.JVM_15.description} or later" ) } addAll(JVMConfigurationKeys.ADDITIONAL_JAVA_MODULES, arguments.additionalJavaModules?.asList()) } -private fun JvmTarget.isRecordsAllowed(): Boolean { - if (majorVersion < JvmTarget.JVM_15_PREVIEW.majorVersion) return false - return isPreview || majorVersion > JvmTarget.JVM_15_PREVIEW.majorVersion +private fun JvmTarget.areRecordsAllowed(enableJvmPreview: Boolean): Boolean { + if (majorVersion < JvmTarget.JVM_15.majorVersion) return false + return enableJvmPreview || majorVersion > JvmTarget.JVM_15.majorVersion } fun CompilerConfiguration.configureJdkHome(arguments: K2JVMCompilerArguments): Boolean { @@ -244,6 +244,12 @@ fun CompilerConfiguration.configureAdvancedJvmOptions(arguments: K2JVMCompilerAr put(JVMConfigurationKeys.USE_SINGLE_MODULE, arguments.singleModule) put(JVMConfigurationKeys.USE_OLD_SPILLED_VAR_TYPE_ANALYSIS, arguments.useOldSpilledVarTypeAnalysis) put(JVMConfigurationKeys.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME, arguments.useOldInlineClassesManglingScheme) + put(JVMConfigurationKeys.ENABLE_JVM_PREVIEW, arguments.enableJvmPreview) + + if (arguments.enableJvmPreview) { + getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY) + .report(INFO, "Using preview Java language features") + } arguments.declarationsOutputPath?.let { put(JVMConfigurationKeys.DECLARATIONS_JSON_PATH, it) } } diff --git a/compiler/config.jvm/src/org/jetbrains/kotlin/config/JVMConfigurationKeys.java b/compiler/config.jvm/src/org/jetbrains/kotlin/config/JVMConfigurationKeys.java index bc896a1f725..de4c0f9e015 100644 --- a/compiler/config.jvm/src/org/jetbrains/kotlin/config/JVMConfigurationKeys.java +++ b/compiler/config.jvm/src/org/jetbrains/kotlin/config/JVMConfigurationKeys.java @@ -140,4 +140,7 @@ public class JVMConfigurationKeys { public static final CompilerConfigurationKey USE_OLD_INLINE_CLASSES_MANGLING_SCHEME = CompilerConfigurationKey.create("Use old, 1.4 version of inline classes mangling scheme"); + + public static final CompilerConfigurationKey ENABLE_JVM_PREVIEW = + CompilerConfigurationKey.create("Enable Java language preview features"); } diff --git a/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt b/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt index bcb55969294..883283cc6b8 100644 --- a/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt +++ b/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt @@ -22,8 +22,6 @@ import org.jetbrains.org.objectweb.asm.Opcodes enum class JvmTarget( override val description: String, val majorVersion: Int, - val descriptionForJavacArgument: String = description, - val isPreview: Boolean = false, ) : TargetPlatformVersion { JVM_1_6("1.6", Opcodes.V1_6), JVM_1_8("1.8", Opcodes.V1_8), @@ -34,22 +32,8 @@ enum class JvmTarget( JVM_13("13", Opcodes.V13), JVM_14("14", Opcodes.V14), JVM_15("15", Opcodes.V15), - JVM_15_PREVIEW( - "15_PREVIEW", Opcodes.V15, - descriptionForJavacArgument = "15", isPreview = true - ), ; - val minorVersion: Int = - if (isPreview) - 0xffff - else - 0 - - val bytecodeVersion: Int by lazy { - (minorVersion shl 16) + majorVersion - } - companion object { @JvmField val DEFAULT = JVM_1_6 @@ -57,14 +41,14 @@ enum class JvmTarget( @JvmStatic fun fromString(string: String) = values().find { it.description == string } - fun getDescription(bytecodeVersion: Int): String { - val platformDescription = values().find { it.bytecodeVersion == bytecodeVersion }?.description ?: when (bytecodeVersion) { + fun getDescription(majorVersion: Int): String { + val platformDescription = values().find { it.majorVersion == majorVersion }?.description ?: when (majorVersion) { Opcodes.V1_7 -> "1.7" else -> null } return if (platformDescription != null) "JVM target $platformDescription" - else "JVM bytecode version $bytecodeVersion" + else "JVM bytecode version $majorVersion" } } } diff --git a/compiler/testData/cli/jvm/extraHelp.out b/compiler/testData/cli/jvm/extraHelp.out index d4a0c34af7c..7d8bc2eaba4 100644 --- a/compiler/testData/cli/jvm/extraHelp.out +++ b/compiler/testData/cli/jvm/extraHelp.out @@ -22,6 +22,8 @@ where advanced options include: -Xir-do-not-clear-binding-context When using the IR backend, do not clear BindingContext between psi2ir and lowerings -Xemit-jvm-type-annotations Emit JVM type annotations in bytecode + -Xjvm-enable-preview Allow using features from Java language that are in preview phase. + Works as `--enable-preview` in Java. All class files are marked as preview-generated thus it won't be possible to use them in release environment -Xfriend-paths= Paths to output directories for friend modules (whose internals should be visible) -Xmultifile-parts-inherit Compile multifile classes as a hierarchy of parts and facade -Xir-check-local-names Check that names of local classes and anonymous objects are the same in the IR backend as in the old backend diff --git a/compiler/testData/cli/jvm/jvmRecordOk.args b/compiler/testData/cli/jvm/jvmRecordOk.args index b975df8aa47..8e284011c5e 100644 --- a/compiler/testData/cli/jvm/jvmRecordOk.args +++ b/compiler/testData/cli/jvm/jvmRecordOk.args @@ -8,5 +8,6 @@ $TEMP_DIR$ -jdk-home $JDK_15$ -XXLanguage:+JvmRecordSupport +-Xjvm-enable-preview -jvm-target -15_PREVIEW +15 diff --git a/compiler/testData/cli/jvm/jvmRecordOk.out b/compiler/testData/cli/jvm/jvmRecordOk.out index ade09bd2ec2..06702215887 100644 --- a/compiler/testData/cli/jvm/jvmRecordOk.out +++ b/compiler/testData/cli/jvm/jvmRecordOk.out @@ -7,4 +7,6 @@ This mode is not recommended for production use, as no stability/compatibility guarantees are given on compiler or generated code. Use it at your own risk! +warning: language version 1.5 is experimental, there are no backwards compatibility guarantees for new language and library features +info: using preview Java language features OK diff --git a/compiler/testData/cli/jvm/wrongJvmTargetVersion.out b/compiler/testData/cli/jvm/wrongJvmTargetVersion.out index a7a87090cff..7afaea0c1de 100644 --- a/compiler/testData/cli/jvm/wrongJvmTargetVersion.out +++ b/compiler/testData/cli/jvm/wrongJvmTargetVersion.out @@ -1,3 +1,3 @@ error: unknown JVM target version: 1.5 -Supported versions: 1.6, 1.8, 9, 10, 11, 12, 13, 14, 15, 15_PREVIEW +Supported versions: 1.6, 1.8, 9, 10, 11, 12, 13, 14, 15 COMPILATION_ERROR diff --git a/compiler/testData/codegen/java15/box/records/bytecodeShapeForJava.kt b/compiler/testData/codegen/java15/box/records/bytecodeShapeForJava.kt index 4d5ec2b2c74..ddbd77508f6 100644 --- a/compiler/testData/codegen/java15/box/records/bytecodeShapeForJava.kt +++ b/compiler/testData/codegen/java15/box/records/bytecodeShapeForJava.kt @@ -1,6 +1,7 @@ // !API_VERSION: 1.5 // !LANGUAGE: +JvmRecordSupport -// JVM_TARGET: 15_PREVIEW +// JVM_TARGET: 15 +// ENABLE_JVM_PREVIEW // FILE: JavaClass.java public class JavaClass { public static String box() { diff --git a/compiler/testData/codegen/java15/box/records/dataJvmRecord.kt b/compiler/testData/codegen/java15/box/records/dataJvmRecord.kt index e4e227fa580..4b3d26a5e03 100644 --- a/compiler/testData/codegen/java15/box/records/dataJvmRecord.kt +++ b/compiler/testData/codegen/java15/box/records/dataJvmRecord.kt @@ -1,6 +1,7 @@ // !API_VERSION: 1.5 // !LANGUAGE: +JvmRecordSupport -// JVM_TARGET: 15_PREVIEW +// JVM_TARGET: 15 +// ENABLE_JVM_PREVIEW @JvmRecord data class MyRec(val x: String, val y: R) diff --git a/compiler/testData/codegen/java15/box/records/recordDifferentPropertyOverride.kt b/compiler/testData/codegen/java15/box/records/recordDifferentPropertyOverride.kt index 894b37db7cf..56141cb269f 100644 --- a/compiler/testData/codegen/java15/box/records/recordDifferentPropertyOverride.kt +++ b/compiler/testData/codegen/java15/box/records/recordDifferentPropertyOverride.kt @@ -1,4 +1,5 @@ -// JVM_TARGET: 15_PREVIEW +// JVM_TARGET: 15 +// ENABLE_JVM_PREVIEW // FILE: MyRec.java public record MyRec(String name) implements KI { public String getName() { diff --git a/compiler/testData/codegen/java15/box/records/recordDifferentSyntheticProperty.kt b/compiler/testData/codegen/java15/box/records/recordDifferentSyntheticProperty.kt index 8b68537f4aa..ff3604c49ba 100644 --- a/compiler/testData/codegen/java15/box/records/recordDifferentSyntheticProperty.kt +++ b/compiler/testData/codegen/java15/box/records/recordDifferentSyntheticProperty.kt @@ -1,4 +1,5 @@ -// JVM_TARGET: 15_PREVIEW +// JVM_TARGET: 15 +// ENABLE_JVM_PREVIEW // FILE: MyRec.java public record MyRec(String name) { public String getName() { diff --git a/compiler/testData/codegen/java15/box/records/recordPropertyAccess.kt b/compiler/testData/codegen/java15/box/records/recordPropertyAccess.kt index 222fd6414ac..ef7fb26d562 100644 --- a/compiler/testData/codegen/java15/box/records/recordPropertyAccess.kt +++ b/compiler/testData/codegen/java15/box/records/recordPropertyAccess.kt @@ -1,5 +1,6 @@ // !LANGUAGE: +JvmRecordSupport -// JVM_TARGET: 15_PREVIEW +// JVM_TARGET: 15 +// ENABLE_JVM_PREVIEW // FILE: MyRec.java public record MyRec(String name) {} diff --git a/compiler/testData/compileKotlinAgainstKotlinJdk15/jvmRecordBinary.kt b/compiler/testData/compileKotlinAgainstKotlinJdk15/jvmRecordBinary.kt index 1a03e42f875..59f7770f952 100644 --- a/compiler/testData/compileKotlinAgainstKotlinJdk15/jvmRecordBinary.kt +++ b/compiler/testData/compileKotlinAgainstKotlinJdk15/jvmRecordBinary.kt @@ -1,6 +1,7 @@ // !API_VERSION: 1.5 // !LANGUAGE: +JvmRecordSupport -// JVM_TARGET: 15_PREVIEW +// JVM_TARGET: 15 +// ENABLE_JVM_PREVIEW // FILE: A.kt @JvmRecord data class MyRecord(val foo: String, val bar: String) diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxAgainstJavaCodegenTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxAgainstJavaCodegenTest.kt index e7805127728..4a3ad7319b7 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxAgainstJavaCodegenTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxAgainstJavaCodegenTest.kt @@ -25,9 +25,16 @@ abstract class AbstractBlackBoxAgainstJavaCodegenTest : AbstractBlackBoxCodegenT override fun doMultiFileTest(wholeFile: File, files: List) { javaClassesOutputDirectory = writeJavaFiles(files)!!.let { directory -> val jvmTargets = files.mapNotNullTo(mutableSetOf()) { it.directives["JVM_TARGET"]?.let((JvmTarget)::fromString) } + val enablePreview = files.any { it.directives.contains("ENABLE_JVM_PREVIEW") } check(jvmTargets.size <= 1) { "Having different JVM_TARGETs for different files is not supported in this test." } CodegenTestUtil.compileJava( - CodegenTestUtil.findJavaSourcesInDirectory(directory), emptyList(), extractJavacOptions(files, jvmTargets.firstOrNull()) + CodegenTestUtil.findJavaSourcesInDirectory(directory), + emptyList(), + extractJavacOptions( + files, + jvmTargets.firstOrNull(), + enablePreview, + ), ) } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java index 73d7b592784..bbe6985df8c 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java @@ -529,7 +529,11 @@ public abstract class CodegenTestCase extends KotlinBaseTest javacOptions = extractJavacOptions(files, configuration.get(JVMConfigurationKeys.JVM_TARGET)); + List javacOptions = extractJavacOptions( + files, + configuration.get(JVMConfigurationKeys.JVM_TARGET), + configuration.getBoolean(JVMConfigurationKeys.ENABLE_JVM_PREVIEW) + ); List finalJavacOptions = prepareJavacOptions(javaClasspath, javacOptions, javaClassesOutputDirectory); try { @@ -551,15 +555,19 @@ public abstract class CodegenTestCase extends KotlinBaseTest javaClasspath) {} @NotNull - protected static List extractJavacOptions(@NotNull List files, @Nullable JvmTarget kotlinTarget) { + protected static List extractJavacOptions( + @NotNull List files, + @Nullable JvmTarget kotlinTarget, + boolean isJvmPreviewEnabled + ) { List javacOptions = new ArrayList<>(0); for (TestFile file : files) { javacOptions.addAll(InTextDirectivesUtils.findListWithPrefixes(file.content, "// JAVAC_OPTIONS:")); } - if (kotlinTarget != null && kotlinTarget.isPreview()) { + if (kotlinTarget != null && isJvmPreviewEnabled) { javacOptions.add("--release"); - javacOptions.add(kotlinTarget.getDescriptionForJavacArgument()); + javacOptions.add(kotlinTarget.getDescription()); javacOptions.add("--enable-preview"); return javacOptions; } @@ -582,7 +590,7 @@ public abstract class CodegenTestCase extends KotlinBaseTest 0) - return kotlinTarget.getDescriptionForJavacArgument(); + return kotlinTarget.getDescription(); if (IS_SOURCE_6_STILL_SUPPORTED) return "1.6"; return null; diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt index 32198172ce9..01078eeefbd 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt @@ -227,6 +227,11 @@ abstract class KotlinBaseTest : KtUsefulTestCase() ?: error("Unknown target: $targetString") configuration.put(JVMConfigurationKeys.JVM_TARGET, jvmTarget) } + + if (directives.contains("ENABLE_JVM_PREVIEW")) { + configuration.put(JVMConfigurationKeys.ENABLE_JVM_PREVIEW, true) + } + val version = directives["LANGUAGE_VERSION"] if (version != null) { throw AssertionError( From f399f013dd7338f56ef6fedd897b37eaaba4795f Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Fri, 4 Dec 2020 19:47:21 +0300 Subject: [PATCH 530/698] Temporary add another env variable JDK_15_0 that is set on TC agents --- .../tests/org/jetbrains/kotlin/test/KotlinTestUtils.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java index 56267d438cc..5d99a01c596 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java @@ -414,6 +414,11 @@ public class KotlinTestUtils { @NotNull public static File getJdk15Home() { String jdk15 = System.getenv("JDK_15"); + + if (jdk15 == null) { + jdk15 = System.getenv("JDK_15_0"); + } + if (jdk15 == null) { throw new AssertionError("Environment variable JDK_15 is not set!"); } From 2b29e70b6408eed0f68990d34b5edca0dac9871d Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Mon, 7 Dec 2020 10:26:44 +0300 Subject: [PATCH 531/698] Temporary avoid using constant from the new ASM To make it compilable with 201 platform --- .../config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt b/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt index 883283cc6b8..69ebe32e62b 100644 --- a/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt +++ b/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt @@ -29,9 +29,9 @@ enum class JvmTarget( JVM_10("10", Opcodes.V10), JVM_11("11", Opcodes.V11), JVM_12("12", Opcodes.V12), - JVM_13("13", Opcodes.V13), - JVM_14("14", Opcodes.V14), - JVM_15("15", Opcodes.V15), + JVM_13("13", Opcodes.V12 + 1), + JVM_14("14", Opcodes.V12 + 2), + JVM_15("15", Opcodes.V12 + 3), ; companion object { From 3aa55620d089ef501bbd659233103706ee466b0a Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Mon, 7 Dec 2020 14:24:33 +0300 Subject: [PATCH 532/698] Prohibit explicit j.l.Record supertype even for @JvmRecord --- .../jvm/checkers/JvmRecordApplicabilityChecker.kt | 11 +++++++---- .../jvm/diagnostics/DefaultErrorMessagesJvm.java | 4 ++-- .../jvmRecord/jvmRecordDescriptorStructure.kt | 4 ++-- .../testsWithJava15/jvmRecord/supertypesCheck.kt | 8 ++++---- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt index ff54e6dccb4..76c30d583f9 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt @@ -30,13 +30,16 @@ object JvmRecordApplicabilityChecker : DeclarationChecker { override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) { if (descriptor !is ClassDescriptor || declaration !is KtClassOrObject) return - if (!descriptor.isJvmRecord()) { - if (descriptor.typeConstructor.supertypes.any { it.constructor.declarationDescriptor?.fqNameOrNull() == JAVA_LANG_RECORD_FQ_NAME }) { - context.trace.report(ErrorsJvm.ILLEGAL_JAVA_LANG_RECORD_SUPERTYPE.on(declaration)) + for (supertypeEntry in declaration.superTypeListEntries) { + val supertype = context.trace[BindingContext.TYPE, supertypeEntry.typeReference] + if (supertype?.constructor?.declarationDescriptor?.fqNameOrNull() == JAVA_LANG_RECORD_FQ_NAME) { + context.trace.report(ErrorsJvm.ILLEGAL_JAVA_LANG_RECORD_SUPERTYPE.on(supertypeEntry)) + return } - return } + if (!descriptor.isJvmRecord()) return + val reportOn = declaration.annotationEntries.firstOrNull { it.shortName == JVM_RECORD_ANNOTATION_FQ_NAME.shortName() } ?: declaration diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java index 2de395e1786..1ad721aace3 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java @@ -158,13 +158,13 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension { MAP.put(JVM_RECORD_WITHOUT_PRIMARY_CONSTRUCTOR_PARAMETERS, "Primary constructor with parameters is required for @JvmRecord class"); MAP.put(JVM_RECORD_NOT_VAL_PARAMETER, "Constructor parameter of @JvmRecord class should be a val"); MAP.put(JVM_RECORD_NOT_LAST_VARARG_PARAMETER, "Only the last constructor parameter of @JvmRecord may be a vararg"); - MAP.put(JVM_RECORD_EXTENDS_CLASS, "Record cannot inherit an other class but java.lang.Record" , RENDER_TYPE); + MAP.put(JVM_RECORD_EXTENDS_CLASS, "Record cannot inherit a class" , RENDER_TYPE); MAP.put(JVM_RECORD_REQUIRES_JDK15, "Using @JvmRecords requires at least JDK 15"); MAP.put(INNER_JVM_RECORD, "@JvmRecord class should not be inner"); MAP.put(FIELD_IN_JVM_RECORD, "It's not allowed to have non-constructor properties with backing filed in @JvmRecord class"); MAP.put(DELEGATION_BY_IN_JVM_RECORD, "Delegation is not allowed for @JvmRecord classes"); MAP.put(NON_DATA_CLASS_JVM_RECORD, "Only data classes are allowed to be marked as @JvmRecord"); - MAP.put(ILLEGAL_JAVA_LANG_RECORD_SUPERTYPE, "Only @JvmRecord classes are allowed to have java.lang.Record supertype"); + MAP.put(ILLEGAL_JAVA_LANG_RECORD_SUPERTYPE, "Classes cannot have explicit 'java.lang.Record' supertype"); String MESSAGE_FOR_CONCURRENT_HASH_MAP_CONTAINS = "Method 'contains' from ConcurrentHashMap may have unexpected semantics: it calls 'containsValue' instead of 'containsKey'. " + diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt index 5d76ab12982..a3e0630a40a 100644 --- a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt @@ -7,6 +7,6 @@ class BasicRecord(val x: String) @JvmRecord data class BasicDataRecord(val x: String) -@JvmRecord -class BasicRecordWithSuperClass(val x: String) : Record() +@JvmRecord +class BasicRecordWithSuperClass(val x: String) : Record() diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt index 6d7a4092a6d..2486625928b 100644 --- a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt @@ -11,14 +11,14 @@ data class A1(val x: String) : Abstract(), I data class A2(val x: String) : Any(), I @JvmRecord -data class A3(val x: String) : Record(), I +data class A3(val x: String) : Record(), I @JvmRecord -data class A4(val x: String) : java.lang.Record(), I +data class A4(val x: String) : java.lang.Record(), I @JvmRecord data class A5(val x: String) : I -data class A6(val x: String) : Record(), I +data class A6(val x: String) : Record(), I -data class A7(val x: String) : java.lang.Record(), I +data class A7(val x: String) : java.lang.Record(), I From 920ed558eed17d894f63cc6b2cc0ef6f70841520 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Tue, 8 Dec 2020 11:41:50 +0300 Subject: [PATCH 533/698] Add some tests on corner cases for @JvmRecord --- .../bytecodeListing/jvmRecordStructure.kt | 15 ++++++++ .../bytecodeListing/jvmRecordStructure.txt | 33 +++++++++++++++++ .../box/records/collectionSizeOverrides.kt | 35 +++++++++++++++++++ .../java15/box/records/propertiesOverrides.kt | 28 +++++++++++++++ ...tiesOverridesAllCompatibilityJvmDefault.kt | 29 +++++++++++++++ .../propertiesOverridesEnableJvmDefault.kt | 29 +++++++++++++++ .../jetbrains/kotlin/test/KotlinBaseTest.kt | 2 ++ .../codegen/BytecodeListingTestGenerated.java | 5 +++ .../Jdk15BlackBoxCodegenTestGenerated.java | 20 +++++++++++ .../Jdk15IrBlackBoxCodegenTestGenerated.java | 20 +++++++++++ .../ir/IrBytecodeListingTestGenerated.java | 5 +++ 11 files changed, 221 insertions(+) create mode 100644 compiler/testData/codegen/bytecodeListing/jvmRecordStructure.kt create mode 100644 compiler/testData/codegen/bytecodeListing/jvmRecordStructure.txt create mode 100644 compiler/testData/codegen/java15/box/records/collectionSizeOverrides.kt create mode 100644 compiler/testData/codegen/java15/box/records/propertiesOverrides.kt create mode 100644 compiler/testData/codegen/java15/box/records/propertiesOverridesAllCompatibilityJvmDefault.kt create mode 100644 compiler/testData/codegen/java15/box/records/propertiesOverridesEnableJvmDefault.kt diff --git a/compiler/testData/codegen/bytecodeListing/jvmRecordStructure.kt b/compiler/testData/codegen/bytecodeListing/jvmRecordStructure.kt new file mode 100644 index 00000000000..af49a7918b3 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/jvmRecordStructure.kt @@ -0,0 +1,15 @@ +// !API_VERSION: 1.5 +// !LANGUAGE: +JvmRecordSupport +// JVM_TARGET: 15 +// ENABLE_JVM_PREVIEW +// WITH_RUNTIME +// JDK_15 +// IGNORE_DEXING + +interface KI { + val x: String get() = "" + val y: T +} + +@JvmRecord +data class MyRec(override val x: String, override val y: R) : KI diff --git a/compiler/testData/codegen/bytecodeListing/jvmRecordStructure.txt b/compiler/testData/codegen/bytecodeListing/jvmRecordStructure.txt new file mode 100644 index 00000000000..36367bddcad --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/jvmRecordStructure.txt @@ -0,0 +1,33 @@ +@kotlin.Metadata +public final class KI$DefaultImpls { + // source: 'jvmRecordStructure.kt' + public static @org.jetbrains.annotations.NotNull method getX(@org.jetbrains.annotations.NotNull p0: KI): java.lang.String + public final inner class KI$DefaultImpls +} + +@kotlin.Metadata +public interface KI { + // source: 'jvmRecordStructure.kt' + public abstract @org.jetbrains.annotations.NotNull method getX(): java.lang.String + public abstract method getY(): java.lang.Object + public final inner class KI$DefaultImpls +} + +@kotlin.Metadata +public final class MyRec { + // source: 'jvmRecordStructure.kt' + private final @org.jetbrains.annotations.NotNull field x: java.lang.String + private final field y: java.lang.Object + public method (@org.jetbrains.annotations.NotNull p0: java.lang.String, p1: java.lang.Object): void + public final @org.jetbrains.annotations.NotNull method component1(): java.lang.String + public final method component2(): java.lang.Object + public synthetic static method copy$default(p0: MyRec, p1: java.lang.String, p2: java.lang.Object, p3: int, p4: java.lang.Object): MyRec + public final @org.jetbrains.annotations.NotNull method copy(@org.jetbrains.annotations.NotNull p0: java.lang.String, p1: java.lang.Object): MyRec + public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean + public synthetic bridge method getX(): java.lang.String + public synthetic bridge method getY(): java.lang.Object + public method hashCode(): int + public @org.jetbrains.annotations.NotNull method toString(): java.lang.String + public @org.jetbrains.annotations.NotNull method x(): java.lang.String + public method y(): java.lang.Object +} diff --git a/compiler/testData/codegen/java15/box/records/collectionSizeOverrides.kt b/compiler/testData/codegen/java15/box/records/collectionSizeOverrides.kt new file mode 100644 index 00000000000..aaf0d2b4621 --- /dev/null +++ b/compiler/testData/codegen/java15/box/records/collectionSizeOverrides.kt @@ -0,0 +1,35 @@ +// !API_VERSION: 1.5 +// !LANGUAGE: +JvmRecordSupport +// JVM_TARGET: 15 +// ENABLE_JVM_PREVIEW + +@JvmRecord +data class MyRec(override val size: Int) : Collection { + override fun contains(element: String): Boolean { + TODO("Not yet implemented") + } + + override fun containsAll(elements: Collection): Boolean { + TODO("Not yet implemented") + } + + override fun isEmpty(): Boolean { + TODO("Not yet implemented") + } + + override fun iterator(): Iterator { + TODO("Not yet implemented") + } +} + +fun box(m: MyRec, c: Collection<*>): String { + val c: Collection<*> = m + if (m.size != 56) return "fail 1" + if (c.size != 56) return "fail 2" + return "OK" +} + +fun box(): String { + val m = MyRec(56) + return box(m, m) +} diff --git a/compiler/testData/codegen/java15/box/records/propertiesOverrides.kt b/compiler/testData/codegen/java15/box/records/propertiesOverrides.kt new file mode 100644 index 00000000000..637e842b415 --- /dev/null +++ b/compiler/testData/codegen/java15/box/records/propertiesOverrides.kt @@ -0,0 +1,28 @@ +// !API_VERSION: 1.5 +// !LANGUAGE: +JvmRecordSupport +// JVM_TARGET: 15 +// ENABLE_JVM_PREVIEW + +// FILE: JavaClass.java +public class JavaClass { + public static String box() { + MyRec m = new MyRec("O", "K"); + KI ki = m; + return m.x() + m.y() + ki.getX() + ki.getY(); + } +} +// FILE: main.kt + +interface KI { + val x: String get() = "" + val y: T +} + +@JvmRecord +data class MyRec(override val x: String, override val y: R) : KI + +fun box(): String { + val res = JavaClass.box() + if (res != "OKOK") return "fail 1: $res" + return "OK" +} diff --git a/compiler/testData/codegen/java15/box/records/propertiesOverridesAllCompatibilityJvmDefault.kt b/compiler/testData/codegen/java15/box/records/propertiesOverridesAllCompatibilityJvmDefault.kt new file mode 100644 index 00000000000..c0ffda1447b --- /dev/null +++ b/compiler/testData/codegen/java15/box/records/propertiesOverridesAllCompatibilityJvmDefault.kt @@ -0,0 +1,29 @@ +// !API_VERSION: 1.5 +// !LANGUAGE: +JvmRecordSupport +// JVM_TARGET: 15 +// ENABLE_JVM_PREVIEW +// !JVM_DEFAULT_MODE: all-compatibility + +// FILE: JavaClass.java +public class JavaClass { + public static String box() { + MyRec m = new MyRec("O", "K"); + KI ki = m; + return m.x() + m.y() + ki.getX() + ki.getY(); + } +} +// FILE: main.kt + +interface KI { + val x: String get() = "" + val y: T +} + +@JvmRecord +data class MyRec(override val x: String, override val y: R) : KI + +fun box(): String { + val res = JavaClass.box() + if (res != "OKOK") return "fail 1: $res" + return "OK" +} diff --git a/compiler/testData/codegen/java15/box/records/propertiesOverridesEnableJvmDefault.kt b/compiler/testData/codegen/java15/box/records/propertiesOverridesEnableJvmDefault.kt new file mode 100644 index 00000000000..d3cd96abdd3 --- /dev/null +++ b/compiler/testData/codegen/java15/box/records/propertiesOverridesEnableJvmDefault.kt @@ -0,0 +1,29 @@ +// !API_VERSION: 1.5 +// !LANGUAGE: +JvmRecordSupport +// JVM_TARGET: 15 +// ENABLE_JVM_PREVIEW +// !JVM_DEFAULT_MODE: enable + +// FILE: JavaClass.java +public class JavaClass { + public static String box() { + MyRec m = new MyRec("O", "K"); + KI ki = m; + return m.x() + m.y() + ki.getX() + ki.getY(); + } +} +// FILE: main.kt + +interface KI { + val x: String get() = "" + val y: T +} + +@JvmRecord +data class MyRec(override val x: String, override val y: R) : KI + +fun box(): String { + val res = JavaClass.box() + if (res != "OKOK") return "fail 1: $res" + return "OK" +} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt index 01078eeefbd..07a8228493a 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt @@ -60,6 +60,8 @@ abstract class KotlinBaseTest : KtUsefulTestCase() } protected open fun getTestJdkKind(files: List): TestJdkKind { + if (files.any { file -> InTextDirectivesUtils.isDirectiveDefined(file.content, "JDK_15") }) return TestJdkKind.FULL_JDK_15 + for (file in files) { if (InTextDirectivesUtils.isDirectiveDefined(file.content, "FULL_JDK")) { return TestJdkKind.FULL_JDK diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index fa229ea4ab2..c421d32d645 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -104,6 +104,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/jvmOverloadsExternal.kt"); } + @TestMetadata("jvmRecordStructure.kt") + public void testJvmRecordStructure() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/jvmRecordStructure.kt"); + } + @TestMetadata("jvmStaticExternal.kt") public void testJvmStaticExternal() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/jvmStaticExternal.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15BlackBoxCodegenTestGenerated.java index 0508221571b..f61ed7795cc 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15BlackBoxCodegenTestGenerated.java @@ -45,11 +45,31 @@ public class Jdk15BlackBoxCodegenTestGenerated extends AbstractJdk15BlackBoxCode runTest("compiler/testData/codegen/java15/box/records/bytecodeShapeForJava.kt"); } + @TestMetadata("collectionSizeOverrides.kt") + public void testCollectionSizeOverrides() throws Exception { + runTest("compiler/testData/codegen/java15/box/records/collectionSizeOverrides.kt"); + } + @TestMetadata("dataJvmRecord.kt") public void testDataJvmRecord() throws Exception { runTest("compiler/testData/codegen/java15/box/records/dataJvmRecord.kt"); } + @TestMetadata("propertiesOverrides.kt") + public void testPropertiesOverrides() throws Exception { + runTest("compiler/testData/codegen/java15/box/records/propertiesOverrides.kt"); + } + + @TestMetadata("propertiesOverridesAllCompatibilityJvmDefault.kt") + public void testPropertiesOverridesAllCompatibilityJvmDefault() throws Exception { + runTest("compiler/testData/codegen/java15/box/records/propertiesOverridesAllCompatibilityJvmDefault.kt"); + } + + @TestMetadata("propertiesOverridesEnableJvmDefault.kt") + public void testPropertiesOverridesEnableJvmDefault() throws Exception { + runTest("compiler/testData/codegen/java15/box/records/propertiesOverridesEnableJvmDefault.kt"); + } + @TestMetadata("recordDifferentPropertyOverride.kt") public void testRecordDifferentPropertyOverride() throws Exception { runTest("compiler/testData/codegen/java15/box/records/recordDifferentPropertyOverride.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15IrBlackBoxCodegenTestGenerated.java index a1ac4871c41..f43e9cb7d25 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15IrBlackBoxCodegenTestGenerated.java @@ -45,11 +45,31 @@ public class Jdk15IrBlackBoxCodegenTestGenerated extends AbstractJdk15IrBlackBox runTest("compiler/testData/codegen/java15/box/records/bytecodeShapeForJava.kt"); } + @TestMetadata("collectionSizeOverrides.kt") + public void testCollectionSizeOverrides() throws Exception { + runTest("compiler/testData/codegen/java15/box/records/collectionSizeOverrides.kt"); + } + @TestMetadata("dataJvmRecord.kt") public void testDataJvmRecord() throws Exception { runTest("compiler/testData/codegen/java15/box/records/dataJvmRecord.kt"); } + @TestMetadata("propertiesOverrides.kt") + public void testPropertiesOverrides() throws Exception { + runTest("compiler/testData/codegen/java15/box/records/propertiesOverrides.kt"); + } + + @TestMetadata("propertiesOverridesAllCompatibilityJvmDefault.kt") + public void testPropertiesOverridesAllCompatibilityJvmDefault() throws Exception { + runTest("compiler/testData/codegen/java15/box/records/propertiesOverridesAllCompatibilityJvmDefault.kt"); + } + + @TestMetadata("propertiesOverridesEnableJvmDefault.kt") + public void testPropertiesOverridesEnableJvmDefault() throws Exception { + runTest("compiler/testData/codegen/java15/box/records/propertiesOverridesEnableJvmDefault.kt"); + } + @TestMetadata("recordDifferentPropertyOverride.kt") public void testRecordDifferentPropertyOverride() throws Exception { runTest("compiler/testData/codegen/java15/box/records/recordDifferentPropertyOverride.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index 16d73c5e213..98ed33c98c4 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -104,6 +104,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/jvmOverloadsExternal.kt"); } + @TestMetadata("jvmRecordStructure.kt") + public void testJvmRecordStructure() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/jvmRecordStructure.kt"); + } + @TestMetadata("jvmStaticExternal.kt") public void testJvmStaticExternal() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/jvmStaticExternal.kt"); From 92b402759b2fe876d7ecee76b81d2290f9671215 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Tue, 8 Dec 2020 16:48:31 +0300 Subject: [PATCH 534/698] Report incorrect JVM target only when @JvmRecord is actually used --- .../common/arguments/K2JVMCompilerArguments.kt | 1 + .../org/jetbrains/kotlin/cli/jvm/jvmArguments.kt | 12 ------------ .../jetbrains/kotlin/config/JvmAnalysisFlags.kt | 3 +++ .../checkers/JvmRecordApplicabilityChecker.kt | 16 +++++++++++++++- .../jvm/diagnostics/DefaultErrorMessagesJvm.java | 1 + .../resolve/jvm/diagnostics/ErrorsJvm.java | 1 + .../jvm/platform/JvmPlatformConfigurator.kt | 4 ++-- .../testData/cli/jvm/jvmRecordWrongTarget.args | 2 +- .../testData/cli/jvm/jvmRecordWrongTarget.out | 4 +++- .../testsWithJava15/jvmRecord/diagnostics.kt | 2 ++ .../jvmRecord/irrelevantFields.kt | 2 ++ .../jvmRecord/jvmRecordDescriptorStructure.kt | 2 ++ .../testsWithJava15/jvmRecord/supertypesCheck.kt | 2 ++ .../CompilerTestLanguageVersionSettings.kt | 2 ++ .../org/jetbrains/kotlin/test/KotlinBaseTest.kt | 3 ++- 15 files changed, 39 insertions(+), 18 deletions(-) diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt index 6ba157ce2d2..2137b548ada 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt @@ -445,6 +445,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() { result[JvmAnalysisFlags.sanitizeParentheses] = sanitizeParentheses result[JvmAnalysisFlags.suppressMissingBuiltinsError] = suppressMissingBuiltinsError result[JvmAnalysisFlags.irCheckLocalNames] = irCheckLocalNames + result[JvmAnalysisFlags.enableJvmPreview] = enableJvmPreview result[AnalysisFlags.reportErrorsOnIrDependencies] = !useIR && !useFir && !allowJvmIrDependencies result[JvmAnalysisFlags.disableUltraLightClasses] = disableUltraLightClasses return result diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt index 16b31435ac4..709ba73a6b3 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt @@ -67,21 +67,9 @@ fun CompilerConfiguration.setupJvmSpecificArguments(arguments: K2JVMCompilerArgu } } - if (languageVersionSettings.supportsFeature(LanguageFeature.JvmRecordSupport) && !jvmTarget.areRecordsAllowed(arguments.enableJvmPreview)) { - messageCollector.report( - ERROR, - "-XXLanguage:+${LanguageFeature.JvmRecordSupport} feature is only supported with JVM target ${JvmTarget.JVM_15.description} or later" - ) - } - addAll(JVMConfigurationKeys.ADDITIONAL_JAVA_MODULES, arguments.additionalJavaModules?.asList()) } -private fun JvmTarget.areRecordsAllowed(enableJvmPreview: Boolean): Boolean { - if (majorVersion < JvmTarget.JVM_15.majorVersion) return false - return enableJvmPreview || majorVersion > JvmTarget.JVM_15.majorVersion -} - fun CompilerConfiguration.configureJdkHome(arguments: K2JVMCompilerArguments): Boolean { val messageCollector = getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY) diff --git a/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmAnalysisFlags.kt b/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmAnalysisFlags.kt index 1626c05fa15..38f1b62fdce 100644 --- a/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmAnalysisFlags.kt +++ b/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmAnalysisFlags.kt @@ -33,6 +33,9 @@ object JvmAnalysisFlags { @JvmStatic val disableUltraLightClasses by AnalysisFlag.Delegates.Boolean + @JvmStatic + val enableJvmPreview by AnalysisFlag.Delegates.Boolean + private object Delegates { object JavaTypeEnhancementStateWarnByDefault { operator fun provideDelegate(instance: Any?, property: KProperty<*>): AnalysisFlag.Delegate = diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt index 76c30d583f9..344a2b1c56b 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt @@ -6,6 +6,8 @@ package org.jetbrains.kotlin.resolve.jvm.checkers import com.intellij.psi.PsiElement +import org.jetbrains.kotlin.config.JvmAnalysisFlags +import org.jetbrains.kotlin.config.JvmTarget import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.diagnostics.Errors @@ -26,7 +28,7 @@ import org.jetbrains.kotlin.resolve.jvm.annotations.isJvmRecord import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult -object JvmRecordApplicabilityChecker : DeclarationChecker { +class JvmRecordApplicabilityChecker(private val jvmTarget: JvmTarget) : DeclarationChecker { override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) { if (descriptor !is ClassDescriptor || declaration !is KtClassOrObject) return @@ -59,6 +61,13 @@ object JvmRecordApplicabilityChecker : DeclarationChecker { return } + if (!jvmTarget.areRecordsAllowed(context.languageVersionSettings.getFlag(JvmAnalysisFlags.enableJvmPreview))) { + context.trace.report( + ErrorsJvm.JVM_RECORDS_ILLEGAL_BYTECODE_TARGET.on(reportOn) + ) + return + } + if (descriptor.kind == ClassKind.ENUM_CLASS) { val modifierOrName = declaration.modifierList?.getModifier(KtTokens.ENUM_KEYWORD) @@ -153,3 +162,8 @@ object JvmRecordApplicabilityChecker : DeclarationChecker { private fun KtModifierList.findOneOfModifiers(vararg modifierTokens: KtModifierKeywordToken): PsiElement? = modifierTokens.firstNotNullResult(this::getModifier) + +private fun JvmTarget.areRecordsAllowed(enableJvmPreview: Boolean): Boolean { + if (majorVersion < JvmTarget.JVM_15.majorVersion) return false + return enableJvmPreview || majorVersion > JvmTarget.JVM_15.majorVersion +} diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java index 1ad721aace3..5bc4af923fd 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java @@ -165,6 +165,7 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension { MAP.put(DELEGATION_BY_IN_JVM_RECORD, "Delegation is not allowed for @JvmRecord classes"); MAP.put(NON_DATA_CLASS_JVM_RECORD, "Only data classes are allowed to be marked as @JvmRecord"); MAP.put(ILLEGAL_JAVA_LANG_RECORD_SUPERTYPE, "Classes cannot have explicit 'java.lang.Record' supertype"); + MAP.put(JVM_RECORDS_ILLEGAL_BYTECODE_TARGET, "Using @JvmRecord is only allowed with -jvm-target 15 and -Xjvm-enable-preview flag enabled"); String MESSAGE_FOR_CONCURRENT_HASH_MAP_CONTAINS = "Method 'contains' from ConcurrentHashMap may have unexpected semantics: it calls 'containsValue' instead of 'containsKey'. " + diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java index a78ee260315..4ad4694f415 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java @@ -128,6 +128,7 @@ public interface ErrorsJvm { DiagnosticFactory0 DELEGATION_BY_IN_JVM_RECORD = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 NON_DATA_CLASS_JVM_RECORD = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 ILLEGAL_JAVA_LANG_RECORD_SUPERTYPE = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 JVM_RECORDS_ILLEGAL_BYTECODE_TARGET = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 NON_JVM_DEFAULT_OVERRIDES_JAVA_DEFAULT = DiagnosticFactory0.create(WARNING, DECLARATION_SIGNATURE); diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/platform/JvmPlatformConfigurator.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/platform/JvmPlatformConfigurator.kt index efb12405a6a..3f4fe948f76 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/platform/JvmPlatformConfigurator.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/platform/JvmPlatformConfigurator.kt @@ -41,8 +41,7 @@ object JvmPlatformConfigurator : PlatformConfiguratorBase( JvmMultifileClassStateChecker, SynchronizedOnInlineMethodChecker, DefaultCheckerInTailrec, - FunctionDelegateMemberNameClashChecker, - JvmRecordApplicabilityChecker + FunctionDelegateMemberNameClashChecker ), additionalCallCheckers = listOf( @@ -111,6 +110,7 @@ object JvmPlatformConfigurator : PlatformConfiguratorBase( container.useImpl() container.useImpl() container.useImpl() + container.useImpl() container.useInstance(FunctionWithBigAritySupport.LanguageVersionDependent) container.useInstance(GenericArrayClassLiteralSupport.Enabled) container.useInstance(JavaActualAnnotationArgumentExtractor()) diff --git a/compiler/testData/cli/jvm/jvmRecordWrongTarget.args b/compiler/testData/cli/jvm/jvmRecordWrongTarget.args index 807f3b5ee9a..e650dcec31e 100644 --- a/compiler/testData/cli/jvm/jvmRecordWrongTarget.args +++ b/compiler/testData/cli/jvm/jvmRecordWrongTarget.args @@ -5,7 +5,7 @@ $TEMP_DIR$ 1.5 -language-version 1.5 --cp +-jdk-home $JDK_15$ -XXLanguage:+JvmRecordSupport -jvm-target diff --git a/compiler/testData/cli/jvm/jvmRecordWrongTarget.out b/compiler/testData/cli/jvm/jvmRecordWrongTarget.out index 8e6229c35bd..ecb2e575bc2 100644 --- a/compiler/testData/cli/jvm/jvmRecordWrongTarget.out +++ b/compiler/testData/cli/jvm/jvmRecordWrongTarget.out @@ -8,5 +8,7 @@ as no stability/compatibility guarantees are given on compiler or generated code. Use it at your own risk! warning: language version 1.5 is experimental, there are no backwards compatibility guarantees for new language and library features -error: -XXLanguage:+JvmRecordSupport feature is only supported with JVM target 15 or later +compiler/testData/cli/jvm/jvmRecord.kt:1:1: error: using @JvmRecord is only allowed with -jvm-target 15 and -Xjvm-enable-preview flag enabled +@JvmRecord +^ COMPILATION_ERROR diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt index 6e3584e5de5..9d5405ca797 100644 --- a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt @@ -1,6 +1,8 @@ // !API_VERSION: 1.5 // !LANGUAGE: +JvmRecordSupport // SKIP_TXT +// JVM_TARGET: 15 +// ENABLE_JVM_PREVIEW @JvmRecord class A0 diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/irrelevantFields.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/irrelevantFields.kt index 4055201e76d..f2a38f74978 100644 --- a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/irrelevantFields.kt +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/irrelevantFields.kt @@ -1,6 +1,8 @@ // !API_VERSION: 1.5 // !LANGUAGE: +JvmRecordSupport // SKIP_TXT +// JVM_TARGET: 15 +// ENABLE_JVM_PREVIEW interface I diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt index a3e0630a40a..e5bf69480a8 100644 --- a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt @@ -1,5 +1,7 @@ // !API_VERSION: 1.5 // !LANGUAGE: +JvmRecordSupport +// JVM_TARGET: 15 +// ENABLE_JVM_PREVIEW @JvmRecord class BasicRecord(val x: String) diff --git a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt index 2486625928b..0af7efaafc7 100644 --- a/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt +++ b/compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt @@ -1,5 +1,7 @@ // !API_VERSION: 1.5 // !LANGUAGE: +JvmRecordSupport +// JVM_TARGET: 15 +// ENABLE_JVM_PREVIEW abstract class Abstract interface I diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/CompilerTestLanguageVersionSettings.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/CompilerTestLanguageVersionSettings.kt index 3c897f5ccfb..b3611f27d18 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/CompilerTestLanguageVersionSettings.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/CompilerTestLanguageVersionSettings.kt @@ -25,6 +25,7 @@ const val ALLOW_RESULT_RETURN_TYPE = "ALLOW_RESULT_RETURN_TYPE" const val INHERIT_MULTIFILE_PARTS = "INHERIT_MULTIFILE_PARTS" const val SANITIZE_PARENTHESES = "SANITIZE_PARENTHESES" const val CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION = "CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION" +const val ENABLE_JVM_PREVIEW = "ENABLE_JVM_PREVIEW" data class CompilerTestLanguageVersionSettings( private val initialLanguageFeatures: Map, @@ -67,6 +68,7 @@ fun parseLanguageVersionSettings(directives: Directives): CompilerTestLanguageVe analysisFlag(AnalysisFlags.allowResultReturnType, if (ALLOW_RESULT_RETURN_TYPE in directives) true else null), analysisFlag(JvmAnalysisFlags.inheritMultifileParts, if (INHERIT_MULTIFILE_PARTS in directives) true else null), analysisFlag(JvmAnalysisFlags.sanitizeParentheses, if (SANITIZE_PARENTHESES in directives) true else null), + analysisFlag(JvmAnalysisFlags.enableJvmPreview, if (ENABLE_JVM_PREVIEW in directives) true else null), analysisFlag(AnalysisFlags.constraintSystemForOverloadResolution, directives[CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION]?.let { ConstraintSystemForOverloadResolutionMode.valueOf(it) }), diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt index 07a8228493a..c5615da32dc 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt @@ -9,6 +9,7 @@ import com.google.common.collect.ImmutableList import com.google.common.collect.ImmutableMap import org.jetbrains.kotlin.builtins.StandardNames import org.jetbrains.kotlin.checkers.CompilerTestLanguageVersionSettings +import org.jetbrains.kotlin.checkers.ENABLE_JVM_PREVIEW import org.jetbrains.kotlin.checkers.parseLanguageVersionSettings import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment @@ -230,7 +231,7 @@ abstract class KotlinBaseTest : KtUsefulTestCase() configuration.put(JVMConfigurationKeys.JVM_TARGET, jvmTarget) } - if (directives.contains("ENABLE_JVM_PREVIEW")) { + if (directives.contains(ENABLE_JVM_PREVIEW)) { configuration.put(JVMConfigurationKeys.ENABLE_JVM_PREVIEW, true) } From 5a006a36907898b3d6ae8c707c1e473dc96226fa Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Tue, 8 Dec 2020 17:51:50 +0300 Subject: [PATCH 535/698] Minor. Specify targetBackend for new IR tests --- .../IrCompileKotlinAgainstKotlinJdk15TestGenerated.java | 5 +++-- .../codegen/Jdk15IrBlackBoxCodegenTestGenerated.java | 9 +++++---- .../kotlin/generators/tests/GenerateCompilerTests.kt | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/IrCompileKotlinAgainstKotlinJdk15TestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/IrCompileKotlinAgainstKotlinJdk15TestGenerated.java index f4ff67670fb..dd2e73bf317 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/IrCompileKotlinAgainstKotlinJdk15TestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/IrCompileKotlinAgainstKotlinJdk15TestGenerated.java @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.codegen; import com.intellij.testFramework.TestDataPath; import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TargetBackend; import org.jetbrains.kotlin.test.TestMetadata; import org.junit.runner.RunWith; @@ -21,11 +22,11 @@ import java.util.regex.Pattern; @RunWith(JUnit3RunnerWithInners.class) public class IrCompileKotlinAgainstKotlinJdk15TestGenerated extends AbstractIrCompileKotlinAgainstKotlinJdk15Test { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } public void testAllFilesPresentInCompileKotlinAgainstKotlinJdk15() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlinJdk15"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlinJdk15"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("jvmRecordBinary.kt") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15IrBlackBoxCodegenTestGenerated.java index f43e9cb7d25..189c1344a69 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15IrBlackBoxCodegenTestGenerated.java @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.codegen; import com.intellij.testFramework.TestDataPath; import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TargetBackend; import org.jetbrains.kotlin.test.TestMetadata; import org.junit.runner.RunWith; @@ -21,11 +22,11 @@ import java.util.regex.Pattern; @RunWith(JUnit3RunnerWithInners.class) public class Jdk15IrBlackBoxCodegenTestGenerated extends AbstractJdk15IrBlackBoxCodegenTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } public void testAllFilesPresentInBox() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/java15/box"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/java15/box"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("compiler/testData/codegen/java15/box/records") @@ -33,11 +34,11 @@ public class Jdk15IrBlackBoxCodegenTestGenerated extends AbstractJdk15IrBlackBox @RunWith(JUnit3RunnerWithInners.class) public static class Records extends AbstractJdk15IrBlackBoxCodegenTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } public void testAllFilesPresentInRecords() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/java15/box/records"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/java15/box/records"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("bytecodeShapeForJava.kt") diff --git a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt index 6310e05612c..27a52900e5b 100644 --- a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt +++ b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt @@ -216,7 +216,7 @@ fun main(args: Array) { } testClass { - model("codegen/java15/box") + model("codegen/java15/box", targetBackend = TargetBackend.JVM_IR) } testClass { @@ -373,7 +373,7 @@ fun main(args: Array) { } testClass { - model("compileKotlinAgainstKotlinJdk15") + model("compileKotlinAgainstKotlinJdk15", targetBackend = TargetBackend.JVM_IR) } testClass { From 2d8a8d252b039fbe4d38b7f63bf9dfcd2f433d09 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Tue, 8 Dec 2020 18:27:41 +0300 Subject: [PATCH 536/698] Add 201 bunch files for JavaClass implementations In 201, there's an old ASM version and PSI doesn't have record-related API --- .../codegen/AbstractClassBuilder.java.201 | 158 +++ .../kotlin/codegen/ClassBuilder.java.201 | 79 ++ .../codegen/DelegatingClassBuilder.java.201 | 118 ++ .../ImplementationBodyCodegen.java.201 | 1248 +++++++++++++++++ .../kotlin/codegen/PropertyCodegen.java.201 | 680 +++++++++ .../jvm/compiler/KotlinCoreEnvironment.kt.201 | 703 ++++++++++ .../backend/jvm/codegen/ClassCodegen.kt.201 | 496 +++++++ .../java/structure/impl/JavaClassImpl.kt.201 | 148 ++ .../impl/classFiles/BinaryJavaClass.kt.201 | 226 +++ ...nitClassBuilderInterceptorExtension.kt.201 | 156 +++ ...royClassBuilderInterceptorExtension.kt.201 | 136 ++ ...nitClassBuilderInterceptorExtension.kt.201 | 150 ++ 12 files changed, 4298 insertions(+) create mode 100644 compiler/backend/src/org/jetbrains/kotlin/codegen/AbstractClassBuilder.java.201 create mode 100644 compiler/backend/src/org/jetbrains/kotlin/codegen/ClassBuilder.java.201 create mode 100644 compiler/backend/src/org/jetbrains/kotlin/codegen/DelegatingClassBuilder.java.201 create mode 100644 compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java.201 create mode 100644 compiler/backend/src/org/jetbrains/kotlin/codegen/PropertyCodegen.java.201 create mode 100644 compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt.201 create mode 100644 compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ClassCodegen.kt.201 create mode 100644 compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt.201 create mode 100644 compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/BinaryJavaClass.kt.201 create mode 100644 plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/parcel/ParcelableClinitClassBuilderInterceptorExtension.kt.201 create mode 100644 plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/codegen/AndroidOnDestroyClassBuilderInterceptorExtension.kt.201 create mode 100644 plugins/parcelize/parcelize-compiler/src/org/jetbrains/kotlin/parcelize/ParcelizeClinitClassBuilderInterceptorExtension.kt.201 diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/AbstractClassBuilder.java.201 b/compiler/backend/src/org/jetbrains/kotlin/codegen/AbstractClassBuilder.java.201 new file mode 100644 index 00000000000..9339caf91e8 --- /dev/null +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/AbstractClassBuilder.java.201 @@ -0,0 +1,158 @@ +/* + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.codegen; + +import com.intellij.psi.PsiElement; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.kotlin.codegen.inline.FileMapping; +import org.jetbrains.kotlin.codegen.inline.SMAPBuilder; +import org.jetbrains.kotlin.codegen.inline.SourceMapper; +import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings; +import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin; +import org.jetbrains.org.objectweb.asm.*; + +import java.util.List; + +import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtilsKt.GENERATE_SMAP; + +public abstract class AbstractClassBuilder implements ClassBuilder { + protected static final MethodVisitor EMPTY_METHOD_VISITOR = new MethodVisitor(Opcodes.API_VERSION) {}; + protected static final FieldVisitor EMPTY_FIELD_VISITOR = new FieldVisitor(Opcodes.API_VERSION) {}; + + private String thisName; + + private final JvmSerializationBindings serializationBindings = new JvmSerializationBindings(); + + private String sourceName; + + private String debugInfo; + + public static class Concrete extends AbstractClassBuilder { + private final ClassVisitor v; + + public Concrete(@NotNull ClassVisitor v) { + this.v = v; + } + + @Override + @NotNull + public ClassVisitor getVisitor() { + return v; + } + } + + @Override + @NotNull + public FieldVisitor newField( + @NotNull JvmDeclarationOrigin origin, + int access, + @NotNull String name, + @NotNull String desc, + @Nullable String signature, + @Nullable Object value + ) { + FieldVisitor visitor = getVisitor().visitField(access, name, desc, signature, value); + if (visitor == null) { + return EMPTY_FIELD_VISITOR; + } + return visitor; + } + + @Override + @NotNull + public MethodVisitor newMethod( + @NotNull JvmDeclarationOrigin origin, + int access, + @NotNull String name, + @NotNull String desc, + @Nullable String signature, + @Nullable String[] exceptions + ) { + MethodVisitor visitor = getVisitor().visitMethod(access, name, desc, signature, exceptions); + if (visitor == null) { + return EMPTY_METHOD_VISITOR; + } + return visitor; + } + + @Override + @NotNull + public JvmSerializationBindings getSerializationBindings() { + return serializationBindings; + } + + @Override + @NotNull + public AnnotationVisitor newAnnotation(@NotNull String desc, boolean visible) { + return getVisitor().visitAnnotation(desc, visible); + } + + @Override + public void done() { + getVisitor().visitSource(sourceName, debugInfo); + getVisitor().visitEnd(); + } + + @Override + public void defineClass( + @Nullable PsiElement origin, + int version, + int access, + @NotNull String name, + @Nullable String signature, + @NotNull String superName, + @NotNull String[] interfaces + ) { + thisName = name; + getVisitor().visit(version, access, name, signature, superName, interfaces); + } + + @Override + public void visitSource(@NotNull String name, @Nullable String debug) { + assert sourceName == null || sourceName.equals(name) : "inconsistent file name: " + sourceName + " vs " + name; + sourceName = name; + debugInfo = debug; + } + + @Override + public void visitSMAP(@NotNull SourceMapper smap, boolean backwardsCompatibleSyntax) { + if (!GENERATE_SMAP) return; + + List fileMappings = smap.getResultMappings(); + if (fileMappings.isEmpty()) return; + + visitSource(fileMappings.get(0).getName(), SMAPBuilder.INSTANCE.build(fileMappings, backwardsCompatibleSyntax)); + } + + @Override + public void visitOuterClass(@NotNull String owner, @Nullable String name, @Nullable String desc) { + getVisitor().visitOuterClass(owner, name, desc); + } + + @Override + public void visitInnerClass(@NotNull String name, @Nullable String outerName, @Nullable String innerName, int access) { + getVisitor().visitInnerClass(name, outerName, innerName, access); + } + + @Override + @NotNull + public String getThisName() { + assert thisName != null : "This name isn't set"; + return thisName; + } +} diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassBuilder.java.201 b/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassBuilder.java.201 new file mode 100644 index 00000000000..6e5bf2b6259 --- /dev/null +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassBuilder.java.201 @@ -0,0 +1,79 @@ +/* + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.codegen; + +import com.intellij.psi.PsiElement; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.kotlin.codegen.inline.SourceMapper; +import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings; +import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin; +import org.jetbrains.org.objectweb.asm.*; + +public interface ClassBuilder { + @NotNull + FieldVisitor newField( + @NotNull JvmDeclarationOrigin origin, + int access, + @NotNull String name, + @NotNull String desc, + @Nullable String signature, + @Nullable Object value + ); + + @NotNull + MethodVisitor newMethod( + @NotNull JvmDeclarationOrigin origin, + int access, + @NotNull String name, + @NotNull String desc, + @Nullable String signature, + @Nullable String[] exceptions + ); + + @NotNull + JvmSerializationBindings getSerializationBindings(); + + @NotNull + AnnotationVisitor newAnnotation(@NotNull String desc, boolean visible); + + void done(); + + @NotNull + ClassVisitor getVisitor(); + + void defineClass( + @Nullable PsiElement origin, + int version, + int access, + @NotNull String name, + @Nullable String signature, + @NotNull String superName, + @NotNull String[] interfaces + ); + + void visitSource(@NotNull String name, @Nullable String debug); + + void visitSMAP(@NotNull SourceMapper smap, boolean backwardsCompatibleSyntax); + + void visitOuterClass(@NotNull String owner, @Nullable String name, @Nullable String desc); + + void visitInnerClass(@NotNull String name, @Nullable String outerName, @Nullable String innerName, int access); + + @NotNull + String getThisName(); +} diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/DelegatingClassBuilder.java.201 b/compiler/backend/src/org/jetbrains/kotlin/codegen/DelegatingClassBuilder.java.201 new file mode 100644 index 00000000000..998b33ff552 --- /dev/null +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/DelegatingClassBuilder.java.201 @@ -0,0 +1,118 @@ +/* + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.codegen; + +import com.intellij.psi.PsiElement; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.kotlin.codegen.inline.SourceMapper; +import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings; +import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin; +import org.jetbrains.org.objectweb.asm.*; + +public abstract class DelegatingClassBuilder implements ClassBuilder { + @NotNull + protected abstract ClassBuilder getDelegate(); + + @NotNull + @Override + public FieldVisitor newField( + @NotNull JvmDeclarationOrigin origin, + int access, + @NotNull String name, + @NotNull String desc, + @Nullable String signature, + @Nullable Object value + ) { + return getDelegate().newField(origin, access, name, desc, signature, value); + } + + @NotNull + @Override + public MethodVisitor newMethod( + @NotNull JvmDeclarationOrigin origin, + int access, + @NotNull String name, + @NotNull String desc, + @Nullable String signature, + @Nullable String[] exceptions + ) { + return getDelegate().newMethod(origin, access, name, desc, signature, exceptions); + } + + @NotNull + @Override + public JvmSerializationBindings getSerializationBindings() { + return getDelegate().getSerializationBindings(); + } + + @NotNull + @Override + public AnnotationVisitor newAnnotation(@NotNull String desc, boolean visible) { + return getDelegate().newAnnotation(desc, visible); + } + + @Override + public void done() { + getDelegate().done(); + } + + @NotNull + @Override + public ClassVisitor getVisitor() { + return getDelegate().getVisitor(); + } + + @Override + public void defineClass( + @Nullable PsiElement origin, + int version, + int access, + @NotNull String name, + @Nullable String signature, + @NotNull String superName, + @NotNull String[] interfaces + ) { + getDelegate().defineClass(origin, version, access, name, signature, superName, interfaces); + } + + @Override + public void visitSource(@NotNull String name, @Nullable String debug) { + getDelegate().visitSource(name, debug); + } + + @Override + public void visitSMAP(@NotNull SourceMapper smap, boolean backwardsCompatibleSyntax) { + getDelegate().visitSMAP(smap, backwardsCompatibleSyntax); + } + + @Override + public void visitOuterClass(@NotNull String owner, @Nullable String name, @Nullable String desc) { + getDelegate().visitOuterClass(owner, name, desc); + } + + @Override + public void visitInnerClass(@NotNull String name, @Nullable String outerName, @Nullable String innerName, int access) { + getDelegate().visitInnerClass(name, outerName, innerName, access); + } + + @NotNull + @Override + public String getThisName() { + return getDelegate().getThisName(); + } +} diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java.201 b/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java.201 new file mode 100644 index 00000000000..f2c8aa9d96d --- /dev/null +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java.201 @@ -0,0 +1,1248 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.codegen; + +import com.intellij.openapi.progress.ProcessCanceledException; +import com.intellij.psi.PsiElement; +import com.intellij.util.ArrayUtil; +import kotlin.Unit; +import kotlin.collections.CollectionsKt; +import kotlin.jvm.functions.Function2; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.kotlin.backend.common.DataClassMethodGenerator; +import org.jetbrains.kotlin.builtins.KotlinBuiltIns; +import org.jetbrains.kotlin.builtins.jvm.JavaToKotlinClassMap; +import org.jetbrains.kotlin.builtins.jvm.JavaToKotlinClassMap.PlatformMutabilityMapping; +import org.jetbrains.kotlin.codegen.binding.CodegenBinding; +import org.jetbrains.kotlin.codegen.binding.MutableClosure; +import org.jetbrains.kotlin.codegen.context.*; +import org.jetbrains.kotlin.codegen.extensions.ExpressionCodegenExtension; +import org.jetbrains.kotlin.codegen.serialization.JvmSerializerExtension; +import org.jetbrains.kotlin.codegen.signature.BothSignatureWriter; +import org.jetbrains.kotlin.codegen.signature.JvmSignatureWriter; +import org.jetbrains.kotlin.codegen.state.GenerationState; +import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper; +import org.jetbrains.kotlin.config.LanguageFeature; +import org.jetbrains.kotlin.descriptors.*; +import org.jetbrains.kotlin.incremental.components.NoLookupLocation; +import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor; +import org.jetbrains.kotlin.load.kotlin.TypeMappingMode; +import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader; +import org.jetbrains.kotlin.metadata.ProtoBuf; +import org.jetbrains.kotlin.name.ClassId; +import org.jetbrains.kotlin.name.FqName; +import org.jetbrains.kotlin.name.Name; +import org.jetbrains.kotlin.psi.*; +import org.jetbrains.kotlin.psi.synthetics.SyntheticClassOrObjectDescriptor; +import org.jetbrains.kotlin.resolve.*; +import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt; +import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall; +import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall; +import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt; +import org.jetbrains.kotlin.resolve.jvm.annotations.JvmAnnotationUtilKt; +import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin; +import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt; +import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmClassSignature; +import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature; +import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter; +import org.jetbrains.kotlin.resolve.scopes.MemberScope; +import org.jetbrains.kotlin.resolve.scopes.receivers.ExtensionReceiver; +import org.jetbrains.kotlin.resolve.scopes.receivers.ImplicitReceiver; +import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue; +import org.jetbrains.kotlin.serialization.DescriptorSerializer; +import org.jetbrains.kotlin.types.KotlinType; +import org.jetbrains.org.objectweb.asm.FieldVisitor; +import org.jetbrains.org.objectweb.asm.MethodVisitor; +import org.jetbrains.org.objectweb.asm.Type; +import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter; +import org.jetbrains.org.objectweb.asm.commons.Method; + +import java.util.*; + +import static org.jetbrains.kotlin.builtins.StandardNames.ENUM_VALUES; +import static org.jetbrains.kotlin.builtins.StandardNames.ENUM_VALUE_OF; +import static org.jetbrains.kotlin.codegen.AsmUtil.CAPTURED_THIS_FIELD; +import static org.jetbrains.kotlin.codegen.CodegenUtilKt.isGenericToArray; +import static org.jetbrains.kotlin.codegen.CodegenUtilKt.isNonGenericToArray; +import static org.jetbrains.kotlin.codegen.DescriptorAsmUtil.*; +import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.*; +import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.enumEntryNeedSubclass; +import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.getDelegatedLocalVariableMetadata; +import static org.jetbrains.kotlin.load.java.DescriptorsJvmAbiUtil.*; +import static org.jetbrains.kotlin.load.java.JvmAbi.HIDDEN_INSTANCE_FIELD; +import static org.jetbrains.kotlin.load.java.JvmAbi.INSTANCE_FIELD; +import static org.jetbrains.kotlin.resolve.BindingContext.INDEXED_LVALUE_GET; +import static org.jetbrains.kotlin.resolve.BindingContext.INDEXED_LVALUE_SET; +import static org.jetbrains.kotlin.resolve.BindingContextUtils.getNotNull; +import static org.jetbrains.kotlin.resolve.DescriptorToSourceUtils.descriptorToDeclaration; +import static org.jetbrains.kotlin.resolve.DescriptorUtils.*; +import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.OBJECT_TYPE; +import static org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin.NO_ORIGIN; +import static org.jetbrains.kotlin.types.Variance.INVARIANT; +import static org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils.isLocalFunction; +import static org.jetbrains.org.objectweb.asm.Opcodes.*; +import static org.jetbrains.org.objectweb.asm.Type.getObjectType; + +public class ImplementationBodyCodegen extends ClassBodyCodegen { + public static final String ENUM_VALUES_FIELD_NAME = "$VALUES"; + private Type superClassAsmType; + @NotNull + private SuperClassInfo superClassInfo; + private final Type classAsmType; + private final boolean isLocal; + + private List companionObjectPropertiesToCopy; + + private final DelegationFieldsInfo delegationFieldsInfo; + + private final List> additionalTasks = new ArrayList<>(); + + private final DescriptorSerializer serializer; + + private final ConstructorCodegen constructorCodegen; + + public ImplementationBodyCodegen( + @NotNull KtPureClassOrObject aClass, + @NotNull ClassContext context, + @NotNull ClassBuilder v, + @NotNull GenerationState state, + @Nullable MemberCodegen parentCodegen, + boolean isLocal + ) { + super(aClass, context, v, state, parentCodegen); + this.classAsmType = getObjectType(typeMapper.classInternalName(descriptor)); + this.isLocal = isLocal; + + this.delegationFieldsInfo = + new DelegationFieldsInfo(classAsmType, descriptor, state, bindingContext) + .getDelegationFieldsInfo(myClass.getSuperTypeListEntries()); + + JvmSerializerExtension extension = new JvmSerializerExtension(v.getSerializationBindings(), state); + this.serializer = DescriptorSerializer.create( + descriptor, extension, + parentCodegen instanceof ImplementationBodyCodegen + ? ((ImplementationBodyCodegen) parentCodegen).serializer + : DescriptorSerializer.createTopLevel(extension), + state.getProject() + ); + + this.constructorCodegen = new ConstructorCodegen( + descriptor, context, functionCodegen, this, + this, state, kind, v, classAsmType, myClass, bindingContext + ); + } + + @Override + protected void generateDeclaration() { + superClassInfo = SuperClassInfo.getSuperClassInfo(descriptor, typeMapper); + superClassAsmType = superClassInfo.getType(); + + JvmClassSignature signature = signature(); + + boolean isAbstract = false; + boolean isInterface = false; + boolean isFinal = false; + boolean isAnnotation = false; + boolean isEnum = false; + + ClassKind kind = descriptor.getKind(); + + Modality modality = descriptor.getModality(); + + if (modality == Modality.ABSTRACT || modality == Modality.SEALED) { + isAbstract = true; + } + + if (kind == ClassKind.INTERFACE) { + isAbstract = true; + isInterface = true; + } + else if (kind == ClassKind.ANNOTATION_CLASS) { + isAbstract = true; + isInterface = true; + isAnnotation = true; + } + else if (kind == ClassKind.ENUM_CLASS) { + isAbstract = hasAbstractMembers(descriptor); + isEnum = true; + } + + if (modality != Modality.OPEN && !isAbstract) { + isFinal = kind == ClassKind.OBJECT || + // Light-class mode: Do not make enum classes final since PsiClass corresponding to enum is expected to be inheritable from + !(kind == ClassKind.ENUM_CLASS && !state.getClassBuilderMode().generateBodies); + } + + int access = 0; + + if (state.getClassBuilderMode() == ClassBuilderMode.LIGHT_CLASSES && !DescriptorUtils.isTopLevelDeclaration(descriptor)) { + // !ClassBuilderMode.generateBodies means we are generating light classes & looking at a nested or inner class + // Light class generation is implemented so that Cls-classes only read bare code of classes, + // without knowing whether these classes are inner or not (see ClassStubBuilder.EMPTY_STRATEGY) + // Thus we must write full accessibility flags on inner classes in this mode + access |= getVisibilityAccessFlag(descriptor); + // Same for STATIC + if (!descriptor.isInner()) { + access |= ACC_STATIC; + } + } + else { + access |= getVisibilityAccessFlagForClass(descriptor); + } + if (isAbstract) { + access |= ACC_ABSTRACT; + } + if (isInterface) { + access |= ACC_INTERFACE; // ACC_SUPER + } + else { + access |= ACC_SUPER; + } + if (isFinal) { + access |= ACC_FINAL; + } + if (isAnnotation) { + access |= ACC_ANNOTATION; + } + if (KotlinBuiltIns.isDeprecated(descriptor)) { + access |= ACC_DEPRECATED; + } + if (isEnum) { + for (KtDeclaration declaration : myClass.getDeclarations()) { + if (declaration instanceof KtEnumEntry) { + if (enumEntryNeedSubclass(bindingContext, (KtEnumEntry) declaration)) { + access &= ~ACC_FINAL; + } + } + } + access |= ACC_ENUM; + } + + v.defineClass( + myClass.getPsiOrParent(), + state.getClassFileVersion(), + access, + signature.getName(), + signature.getJavaGenericSignature(), + signature.getSuperclassName(), + ArrayUtil.toStringArray(signature.getInterfaces()) + ); + + v.visitSource(myClass.getContainingKtFile().getName(), null); + + initDefaultSourceMappingIfNeeded(); + + writeEnclosingMethod(); + + AnnotationCodegen.forClass(v.getVisitor(), this, state).genAnnotations(descriptor, null, null); + + generateEnumEntries(); + } + + @Override + protected void generateDefaultImplsIfNeeded() { + if (isInterface(descriptor) && !isLocal) { + Type defaultImplsType = state.getTypeMapper().mapDefaultImpls(descriptor); + ClassBuilder defaultImplsBuilder = + state.getFactory().newVisitor(JvmDeclarationOriginKt.DefaultImpls(myClass.getPsiOrParent(), descriptor), defaultImplsType, myClass.getContainingKtFile()); + + CodegenContext parentContext = context.getParentContext(); + assert parentContext != null : "Parent context of interface declaration should not be null"; + + ClassContext defaultImplsContext = parentContext.intoDefaultImplsClass(descriptor, (ClassContext) context, state); + new InterfaceImplBodyCodegen(myClass, defaultImplsContext, defaultImplsBuilder, state, this).generate(); + } + } + + @Override + protected void generateErasedInlineClassIfNeeded() { + if (!(myClass instanceof KtClass)) return; + if (!InlineClassesUtilsKt.isInlineClass(descriptor)) return; + + ClassContext erasedInlineClassContext = context.intoWrapperForErasedInlineClass(descriptor, state); + new ErasedInlineClassBodyCodegen((KtClass) myClass, erasedInlineClassContext, v, state, this).generate(); + } + + @Override + protected void generateUnboxMethodForInlineClass() { + if (!(myClass instanceof KtClass)) return; + if (!InlineClassesUtilsKt.isInlineClass(descriptor)) return; + + Type ownerType = typeMapper.mapClass(descriptor); + ValueParameterDescriptor inlinedValue = InlineClassesUtilsKt.underlyingRepresentation(this.descriptor); + if (inlinedValue == null) return; + + Type valueType = typeMapper.mapType(inlinedValue.getType()); + SimpleFunctionDescriptor functionDescriptor = InlineClassDescriptorResolver.createUnboxFunctionDescriptor(this.descriptor); + assert functionDescriptor != null : "FunctionDescriptor for unbox method should be not null during codegen"; + + functionCodegen.generateMethod( + JvmDeclarationOriginKt.UnboxMethodOfInlineClass(functionDescriptor), functionDescriptor, + new FunctionGenerationStrategy.CodegenBased(state) { + @Override + public void doGenerateBody( + @NotNull ExpressionCodegen codegen, @NotNull JvmMethodSignature signature + ) { + InstructionAdapter iv = codegen.v; + iv.load(0, OBJECT_TYPE); + iv.getfield(ownerType.getInternalName(), inlinedValue.getName().asString(), valueType.getDescriptor()); + iv.areturn(valueType); + } + } + ); + } + + @Override + protected void generateKotlinMetadataAnnotation() { + ProtoBuf.Class classProto = serializer.classProto(descriptor).build(); + + WriteAnnotationUtilKt.writeKotlinMetadata(v, state, KotlinClassHeader.Kind.CLASS, 0, av -> { + writeAnnotationData(av, serializer, classProto); + return Unit.INSTANCE; + }); + } + + private void writeEnclosingMethod() { + // Do not emit enclosing method in "light-classes mode" since currently we generate local light classes as if they're top level + if (!state.getClassBuilderMode().generateBodies) { + return; + } + + //JVMS7: A class must have an EnclosingMethod attribute if and only if it is a local class or an anonymous class. + if (isAnonymousObject(descriptor) || !(descriptor.getContainingDeclaration() instanceof ClassOrPackageFragmentDescriptor)) { + writeOuterClassAndEnclosingMethod(); + } + } + + private static final Map KOTLIN_MARKER_INTERFACES = new HashMap<>(); + + static { + for (PlatformMutabilityMapping platformMutabilityMapping : JavaToKotlinClassMap.INSTANCE.getMutabilityMappings()) { + KOTLIN_MARKER_INTERFACES.put( + platformMutabilityMapping.getKotlinReadOnly().asSingleFqName(), + "kotlin/jvm/internal/markers/KMappedMarker"); + + ClassId mutableClassId = platformMutabilityMapping.getKotlinMutable(); + KOTLIN_MARKER_INTERFACES.put( + mutableClassId.asSingleFqName(), + "kotlin/jvm/internal/markers/K" + mutableClassId.getRelativeClassName().asString() + .replace("MutableEntry", "Entry") // kotlin.jvm.internal.markers.KMutableMap.Entry for some reason + .replace(".", "$") + ); + } + } + + @NotNull + private JvmClassSignature signature() { + return signature(descriptor, classAsmType, superClassInfo, typeMapper); + } + + @NotNull + public static JvmClassSignature signature( + @NotNull ClassDescriptor descriptor, + @NotNull Type classAsmType, + @NotNull SuperClassInfo superClassInfo, + @NotNull KotlinTypeMapper typeMapper + ) { + JvmSignatureWriter sw = new BothSignatureWriter(BothSignatureWriter.Mode.CLASS); + + typeMapper.writeFormalTypeParameters(descriptor.getDeclaredTypeParameters(), sw); + + sw.writeSuperclass(); + if (superClassInfo.getKotlinType() == null) { + sw.writeClassBegin(superClassInfo.getType()); + sw.writeClassEnd(); + } + else { + typeMapper.mapSupertype(superClassInfo.getKotlinType(), sw); + } + sw.writeSuperclassEnd(); + + LinkedHashSet superInterfaces = new LinkedHashSet<>(); + Set kotlinMarkerInterfaces = new LinkedHashSet<>(); + + for (KotlinType supertype : descriptor.getTypeConstructor().getSupertypes()) { + if (isJvmInterface(supertype.getConstructor().getDeclarationDescriptor())) { + FqName kotlinInterfaceName = DescriptorUtils.getFqName(supertype.getConstructor().getDeclarationDescriptor()).toSafe(); + + sw.writeInterface(); + Type jvmInterfaceType = typeMapper.mapSupertype(supertype, sw); + sw.writeInterfaceEnd(); + String jvmInterfaceInternalName = jvmInterfaceType.getInternalName(); + + superInterfaces.add(jvmInterfaceInternalName); + + String kotlinMarkerInterfaceInternalName = KOTLIN_MARKER_INTERFACES.get(kotlinInterfaceName); + if (kotlinMarkerInterfaceInternalName != null) { + if (typeMapper.getClassBuilderMode() == ClassBuilderMode.LIGHT_CLASSES) { + sw.writeInterface(); + Type kotlinCollectionType = typeMapper.mapType(supertype, sw, TypeMappingMode.SUPER_TYPE_KOTLIN_COLLECTIONS_AS_IS); + sw.writeInterfaceEnd(); + superInterfaces.add(kotlinCollectionType.getInternalName()); + } + + kotlinMarkerInterfaces.add(kotlinMarkerInterfaceInternalName); + } + } + } + + for (String kotlinMarkerInterface : kotlinMarkerInterfaces) { + sw.writeInterface(); + sw.writeAsmType(getObjectType(kotlinMarkerInterface)); + sw.writeInterfaceEnd(); + } + + superInterfaces.addAll(kotlinMarkerInterfaces); + + return new JvmClassSignature(classAsmType.getInternalName(), superClassInfo.getType().getInternalName(), + new ArrayList<>(superInterfaces), sw.makeJavaGenericSignature()); + } + + @Override + protected void generateSyntheticPartsBeforeBody() { + generatePropertyMetadataArrayFieldIfNeeded(classAsmType); + } + + @Override + protected void generateSyntheticPartsAfterBody() { + generateFieldForSingleton(); + + initializeObjects(); + + generateCompanionObjectBackingFieldCopies(); + + generateDelegatesToDefaultImpl(); + + generateDelegates(delegationFieldsInfo); + + generateSyntheticAccessors(); + + generateEnumMethods(); + + generateFunctionsForDataClasses(); + + generateFunctionsFromAnyForInlineClasses(); + + if (state.getClassBuilderMode() != ClassBuilderMode.LIGHT_CLASSES) { + new CollectionStubMethodGenerator(typeMapper, descriptor).generate(functionCodegen, v); + + generateToArray(); + } + + + if (context.closure != null) + genClosureFields(context.closure, v, typeMapper, state.getLanguageVersionSettings()); + + for (ExpressionCodegenExtension extension : ExpressionCodegenExtension.Companion.getInstances(state.getProject())) { + if (state.getClassBuilderMode() != ClassBuilderMode.LIGHT_CLASSES + || extension.getShouldGenerateClassSyntheticPartsInLightClassesMode() + ) { + extension.generateClassSyntheticParts(this); + } + } + } + + @Override + protected void generateConstructors() { + try { + lookupConstructorExpressionsInClosureIfPresent(); + constructorCodegen.generatePrimaryConstructor(delegationFieldsInfo, superClassAsmType); + if (!InlineClassesUtilsKt.isInlineClass(descriptor) && !(descriptor instanceof SyntheticClassOrObjectDescriptor)) { + // Synthetic classes does not have declarations for secondary constructors + for (ClassConstructorDescriptor secondaryConstructor : DescriptorUtilsKt.getSecondaryConstructors(descriptor)) { + constructorCodegen.generateSecondaryConstructor(secondaryConstructor, superClassAsmType); + } + } + } + catch (CompilationException | ProcessCanceledException e) { + throw e; + } + catch (RuntimeException e) { + throw new RuntimeException("Error generating constructors of class " + myClass.getName() + " with kind " + kind, e); + } + } + + private void generateToArray() { + if (descriptor.getKind() == ClassKind.INTERFACE) return; + + KotlinBuiltIns builtIns = DescriptorUtilsKt.getBuiltIns(descriptor); + if (!isSubclass(descriptor, builtIns.getCollection())) return; + + if (CollectionsKt.any(DescriptorUtilsKt.getAllSuperclassesWithoutAny(descriptor), + classDescriptor -> !(classDescriptor instanceof JavaClassDescriptor) && + isSubclass(classDescriptor, builtIns.getCollection()))) { + return; + } + + Collection functions = descriptor.getDefaultType().getMemberScope().getContributedFunctions( + Name.identifier("toArray"), NoLookupLocation.FROM_BACKEND + ); + boolean hasGenericToArray = false; + boolean hasNonGenericToArray = false; + for (FunctionDescriptor function : functions) { + hasGenericToArray |= isGenericToArray(function); + hasNonGenericToArray |= isNonGenericToArray(function); + } + + if (!hasNonGenericToArray) { + MethodVisitor mv = v.newMethod(NO_ORIGIN, ACC_PUBLIC, "toArray", "()[Ljava/lang/Object;", null, null); + + InstructionAdapter iv = new InstructionAdapter(mv); + mv.visitCode(); + + iv.load(0, classAsmType); + iv.invokestatic("kotlin/jvm/internal/CollectionToArray", "toArray", "(Ljava/util/Collection;)[Ljava/lang/Object;", false); + iv.areturn(Type.getType("[Ljava/lang/Object;")); + + FunctionCodegen.endVisit(mv, "toArray", myClass); + } + + if (!hasGenericToArray) { + MethodVisitor mv = v.newMethod( + NO_ORIGIN, ACC_PUBLIC, "toArray", "([Ljava/lang/Object;)[Ljava/lang/Object;", "([TT;)[TT;", null); + + InstructionAdapter iv = new InstructionAdapter(mv); + mv.visitCode(); + + iv.load(0, classAsmType); + iv.load(1, Type.getType("[Ljava/lang/Object;")); + + iv.invokestatic("kotlin/jvm/internal/CollectionToArray", "toArray", + "(Ljava/util/Collection;[Ljava/lang/Object;)[Ljava/lang/Object;", false); + iv.areturn(Type.getType("[Ljava/lang/Object;")); + + FunctionCodegen.endVisit(mv, "toArray", myClass); + } + } + + public static JvmKotlinType genPropertyOnStack( + InstructionAdapter iv, + MethodContext context, + @NotNull PropertyDescriptor propertyDescriptor, + Type classAsmType, + int index, + GenerationState state + ) { + iv.load(index, classAsmType); + if (couldUseDirectAccessToProperty(propertyDescriptor, /* forGetter = */ true, + /* isDelegated = */ false, context, state.getShouldInlineConstVals())) { + KotlinType kotlinType = propertyDescriptor.getType(); + Type type = state.getTypeMapper().mapType(kotlinType); + String fieldName = ((FieldOwnerContext) context.getParentContext()).getFieldName(propertyDescriptor, false); + iv.getfield(classAsmType.getInternalName(), fieldName, type.getDescriptor()); + return new JvmKotlinType(type, kotlinType); + } + else { + PropertyGetterDescriptor getter = propertyDescriptor.getGetter(); + + //noinspection ConstantConditions + Method method = state.getTypeMapper().mapAsmMethod(getter); + iv.invokevirtual(classAsmType.getInternalName(), method.getName(), method.getDescriptor(), false); + return new JvmKotlinType(method.getReturnType(), getter.getReturnType()); + } + } + + private void generateFunctionsForDataClasses() { + if (!descriptor.isData()) return; + if (!(myClass instanceof KtClassOrObject)) return; + new DataClassMethodGeneratorImpl((KtClassOrObject)myClass, bindingContext).generate(); + } + + private void generateFunctionsFromAnyForInlineClasses() { + if (!InlineClassesUtilsKt.isInlineClass(descriptor)) return; + if (!(myClass instanceof KtClassOrObject)) return; + new FunctionsFromAnyGeneratorImpl( + (KtClassOrObject) myClass, bindingContext, descriptor, classAsmType, context, v, state + ).generate(); + } + + private class DataClassMethodGeneratorImpl extends DataClassMethodGenerator { + private final FunctionsFromAnyGeneratorImpl functionsFromAnyGenerator; + + DataClassMethodGeneratorImpl( + KtClassOrObject klass, + BindingContext bindingContext + ) { + super(klass, bindingContext); + this.functionsFromAnyGenerator = new FunctionsFromAnyGeneratorImpl( + klass, bindingContext, descriptor, classAsmType, ImplementationBodyCodegen.this.context, v, state + ); + } + + @Override + public void generateEqualsMethod(@NotNull FunctionDescriptor function, @NotNull List properties) { + functionsFromAnyGenerator.generateEqualsMethod(function, properties); + } + + @Override + public void generateHashCodeMethod(@NotNull FunctionDescriptor function, @NotNull List properties) { + functionsFromAnyGenerator.generateHashCodeMethod(function, properties); + } + + @Override + public void generateToStringMethod(@NotNull FunctionDescriptor function, @NotNull List properties) { + functionsFromAnyGenerator.generateToStringMethod(function, properties); + } + + @Override + public void generateComponentFunction(@NotNull FunctionDescriptor function, @NotNull ValueParameterDescriptor parameter) { + PsiElement originalElement = DescriptorToSourceUtils.descriptorToDeclaration(parameter); + functionCodegen.generateMethod(JvmDeclarationOriginKt.OtherOrigin(originalElement, function), function, new FunctionGenerationStrategy() { + @Override + public void generateBody( + @NotNull MethodVisitor mv, + @NotNull FrameMap frameMap, + @NotNull JvmMethodSignature signature, + @NotNull MethodContext context, + @NotNull MemberCodegen parentCodegen + ) { + Type componentType = signature.getReturnType(); + InstructionAdapter iv = new InstructionAdapter(mv); + if (!componentType.equals(Type.VOID_TYPE)) { + PropertyDescriptor property = + bindingContext.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, descriptorToDeclaration(parameter)); + assert property != null : "Property descriptor is not found for primary constructor parameter: " + parameter; + + JvmKotlinType propertyType = genPropertyOnStack( + iv, context, property, ImplementationBodyCodegen.this.classAsmType, 0, state + ); + StackValue.coerce(propertyType.getType(), componentType, iv); + } + iv.areturn(componentType); + } + + @Override + public boolean skipNotNullAssertionsForParameters() { + return false; + } + }); + } + + @Override + public void generateCopyFunction( + @NotNull FunctionDescriptor function, + @NotNull List constructorParameters + ) { + Type thisDescriptorType = typeMapper.mapType(descriptor); + + functionCodegen.generateMethod(JvmDeclarationOriginKt.OtherOriginFromPure(myClass, function), function, new FunctionGenerationStrategy() { + @Override + public void generateBody( + @NotNull MethodVisitor mv, + @NotNull FrameMap frameMap, + @NotNull JvmMethodSignature signature, + @NotNull MethodContext context, + @NotNull MemberCodegen parentCodegen + ) { + InstructionAdapter iv = new InstructionAdapter(mv); + + iv.anew(thisDescriptorType); + iv.dup(); + + ConstructorDescriptor constructor = getPrimaryConstructorOfDataClass(descriptor); + assert function.getValueParameters().size() == constructor.getValueParameters().size() : + "Number of parameters of copy function and constructor are different. " + + "Copy: " + function.getValueParameters().size() + ", " + + "constructor: " + constructor.getValueParameters().size(); + + MutableClosure closure = ImplementationBodyCodegen.this.context.closure; + if (closure != null) { + pushCapturedFieldsOnStack(iv, closure); + } + + int parameterIndex = 1; // localVariable 0 = this + for (ValueParameterDescriptor parameterDescriptor : function.getValueParameters()) { + Type type = typeMapper.mapType(parameterDescriptor.getType()); + iv.load(parameterIndex, type); + parameterIndex += type.getSize(); + } + + Method constructorAsmMethod = typeMapper.mapAsmMethod(constructor); + iv.invokespecial(thisDescriptorType.getInternalName(), "", constructorAsmMethod.getDescriptor(), false); + + iv.areturn(thisDescriptorType); + } + + @Override + public boolean skipNotNullAssertionsForParameters() { + return false; + } + + private void pushCapturedFieldsOnStack(InstructionAdapter iv, MutableClosure closure) { + ClassDescriptor captureThis = closure.getCapturedOuterClassDescriptor(); + if (captureThis != null) { + iv.load(0, classAsmType); + Type type = typeMapper.mapType(captureThis); + iv.getfield(classAsmType.getInternalName(), CAPTURED_THIS_FIELD, type.getDescriptor()); + } + + KotlinType captureReceiver = closure.getCapturedReceiverFromOuterContext(); + if (captureReceiver != null) { + iv.load(0, classAsmType); + Type type = typeMapper.mapType(captureReceiver); + String fieldName = closure.getCapturedReceiverFieldName(bindingContext, state.getLanguageVersionSettings()); + iv.getfield(classAsmType.getInternalName(), fieldName, type.getDescriptor()); + } + + for (Map.Entry entry : closure.getCaptureVariables().entrySet()) { + DeclarationDescriptor declarationDescriptor = entry.getKey(); + EnclosedValueDescriptor enclosedValueDescriptor = entry.getValue(); + StackValue capturedValue = enclosedValueDescriptor.getInstanceValue(); + Type sharedVarType = typeMapper.getSharedVarType(declarationDescriptor); + if (sharedVarType == null) { + sharedVarType = typeMapper.mapType((VariableDescriptor) declarationDescriptor); + } + capturedValue.put(sharedVarType, iv); + } + } + }); + + functionCodegen.generateDefaultIfNeeded( + context.intoFunction(function), function, OwnerKind.IMPLEMENTATION, + (valueParameter, codegen) -> { + assert ((ClassDescriptor) function.getContainingDeclaration()).isData() + : "Function container must have [data] modifier: " + function; + PropertyDescriptor property = bindingContext.get(BindingContext.VALUE_PARAMETER_AS_PROPERTY, valueParameter); + assert property != null : "Copy function doesn't correspond to any property: " + function; + return codegen.intermediateValueForProperty(property, false, null, StackValue.LOCAL_0); + }, + null + ); + } + } + + @NotNull + private static ConstructorDescriptor getPrimaryConstructorOfDataClass(@NotNull ClassDescriptor classDescriptor) { + ConstructorDescriptor constructor = classDescriptor.getUnsubstitutedPrimaryConstructor(); + assert constructor != null : "Data class must have primary constructor: " + classDescriptor; + return constructor; + } + + private void generateEnumMethods() { + if (isEnumClass(descriptor)) { + generateEnumValuesMethod(); + generateEnumValueOfMethod(); + } + } + + private void generateEnumValuesMethod() { + Type type = typeMapper.mapType(DescriptorUtilsKt.getBuiltIns(descriptor).getArrayType(INVARIANT, descriptor.getDefaultType())); + + FunctionDescriptor valuesFunction = + CollectionsKt.single(descriptor.getStaticScope().getContributedFunctions(ENUM_VALUES, NoLookupLocation.FROM_BACKEND)); + MethodVisitor mv = v.newMethod( + JvmDeclarationOriginKt.OtherOriginFromPure(myClass, valuesFunction), ACC_PUBLIC | ACC_STATIC, ENUM_VALUES.asString(), + "()" + type.getDescriptor(), null, null + ); + if (!state.getClassBuilderMode().generateBodies) return; + + mv.visitCode(); + mv.visitFieldInsn(GETSTATIC, classAsmType.getInternalName(), ENUM_VALUES_FIELD_NAME, type.getDescriptor()); + mv.visitMethodInsn(INVOKEVIRTUAL, type.getInternalName(), "clone", "()Ljava/lang/Object;", false); + mv.visitTypeInsn(CHECKCAST, type.getInternalName()); + mv.visitInsn(ARETURN); + FunctionCodegen.endVisit(mv, "values()", myClass); + } + + private void generateEnumValueOfMethod() { + FunctionDescriptor valueOfFunction = + CollectionsKt.single(descriptor.getStaticScope().getContributedFunctions(ENUM_VALUE_OF, NoLookupLocation.FROM_BACKEND), + DescriptorUtilsKt::isEnumValueOfMethod); + MethodVisitor mv = + v.newMethod(JvmDeclarationOriginKt.OtherOriginFromPure(myClass, valueOfFunction), ACC_PUBLIC | ACC_STATIC, ENUM_VALUE_OF.asString(), + "(Ljava/lang/String;)" + classAsmType.getDescriptor(), null, null); + if (!state.getClassBuilderMode().generateBodies) return; + + mv.visitCode(); + mv.visitLdcInsn(classAsmType); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn(INVOKESTATIC, "java/lang/Enum", "valueOf", "(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;", false); + mv.visitTypeInsn(CHECKCAST, classAsmType.getInternalName()); + mv.visitInsn(ARETURN); + FunctionCodegen.endVisit(mv, "valueOf()", myClass); + } + + private void generateFieldForSingleton() { + if (isCompanionObjectInInterfaceNotIntrinsic(descriptor)) { + StackValue.Field field = StackValue.createSingletonViaInstance(descriptor, typeMapper, HIDDEN_INSTANCE_FIELD); + //hidden instance in interface companion + v.newField(JvmDeclarationOriginKt.OtherOrigin(descriptor), + ACC_SYNTHETIC | ACC_STATIC | ACC_FINAL, field.name, field.type.getDescriptor(), null, null); + } + + if (isEnumEntry(descriptor) || isCompanionObject(descriptor)) return; + + if (isNonCompanionObject(descriptor)) { + StackValue.Field field = StackValue.createSingletonViaInstance(descriptor, typeMapper, INSTANCE_FIELD); + FieldVisitor fv = v.newField( + JvmDeclarationOriginKt.OtherOriginFromPure(myClass), + ACC_PUBLIC | ACC_STATIC | ACC_FINAL, + field.name, field.type.getDescriptor(), null, null + ); + AnnotationCodegen.forField(fv, this, state).visitAnnotation(Type.getDescriptor(NotNull.class), false).visitEnd(); + return; + } + + ClassDescriptor companionObjectDescriptor = descriptor.getCompanionObjectDescriptor(); + if (companionObjectDescriptor == null) { + return; + } + + @Nullable KtObjectDeclaration companionObject = CollectionsKt.firstOrNull(myClass.getCompanionObjects()); + + int properFieldVisibilityFlag = getVisibilityAccessFlag(companionObjectDescriptor); + boolean deprecatedFieldForInvisibleCompanionObject = + state.getLanguageVersionSettings().supportsFeature(LanguageFeature.DeprecatedFieldForInvisibleCompanionObject); + boolean properVisibilityForCompanionObjectInstanceField = + state.getLanguageVersionSettings().supportsFeature(LanguageFeature.ProperVisibilityForCompanionObjectInstanceField); + boolean hasPrivateOrProtectedProperVisibility = (properFieldVisibilityFlag & (ACC_PRIVATE | ACC_PROTECTED)) != 0; + boolean hasPackagePrivateProperVisibility = (properFieldVisibilityFlag & (ACC_PUBLIC | ACC_PRIVATE | ACC_PROTECTED)) == 0; + boolean fieldShouldBeDeprecated = + deprecatedFieldForInvisibleCompanionObject && + !properVisibilityForCompanionObjectInstanceField && + (hasPrivateOrProtectedProperVisibility || hasPackagePrivateProperVisibility || + isNonIntrinsicPrivateCompanionObjectInInterface(companionObjectDescriptor)); + boolean fieldIsForcedToBePublic = + JvmCodegenUtil.isJvmInterface(descriptor) || + !properVisibilityForCompanionObjectInstanceField; + int fieldAccessFlags = ACC_STATIC | ACC_FINAL; + if (fieldIsForcedToBePublic) { + fieldAccessFlags |= ACC_PUBLIC; + } + else { + fieldAccessFlags |= properFieldVisibilityFlag; + } + if (fieldShouldBeDeprecated) { + fieldAccessFlags |= ACC_DEPRECATED; + } + if (properVisibilityForCompanionObjectInstanceField && + JvmCodegenUtil.isCompanionObjectInInterfaceNotIntrinsic(companionObjectDescriptor) && + DescriptorVisibilities.isPrivate(companionObjectDescriptor.getVisibility())) { + fieldAccessFlags |= ACC_SYNTHETIC; + } + StackValue.Field field = StackValue.singleton(companionObjectDescriptor, typeMapper); + FieldVisitor fv = v.newField( + JvmDeclarationOriginKt.OtherOrigin(companionObject == null ? myClass.getPsiOrParent() : companionObject), + fieldAccessFlags, field.name, field.type.getDescriptor(), null, null + ); + AnnotationCodegen.forField(fv, this, state).visitAnnotation(Type.getDescriptor(NotNull.class), false).visitEnd(); + if (fieldShouldBeDeprecated) { + AnnotationCodegen.forField(fv, this, state).visitAnnotation(Type.getDescriptor(Deprecated.class), true).visitEnd(); + } + } + + private void initializeObjects() { + if (!DescriptorUtils.isObject(descriptor)) return; + if (!state.getClassBuilderMode().generateBodies) return; + + boolean isNonCompanionObject = isNonCompanionObject(descriptor); + boolean isInterfaceCompanion = isCompanionObjectInInterfaceNotIntrinsic(descriptor); + boolean isInterfaceCompanionWithBackingFieldsInOuter = isInterfaceCompanionWithBackingFieldsInOuter(descriptor); + boolean isMappedIntrinsicCompanionObject = isMappedIntrinsicCompanionObject(descriptor); + boolean isClassCompanionWithBackingFieldsInOuter = isClassCompanionObjectWithBackingFieldsInOuter(descriptor); + if (isNonCompanionObject || + (isInterfaceCompanion && !isInterfaceCompanionWithBackingFieldsInOuter) || + isMappedIntrinsicCompanionObject + ) { + ExpressionCodegen clInitCodegen = createOrGetClInitCodegen(); + InstructionAdapter v = clInitCodegen.v; + markLineNumberForElement(element.getPsiOrParent(), v); + v.anew(classAsmType); + v.dup(); + v.invokespecial(classAsmType.getInternalName(), "", "()V", false); + + //local0 emulates this in object constructor + int local0Index = clInitCodegen.getFrameMap().enterTemp(classAsmType); + assert local0Index == 0 : "Local variable with index 0 in clInit should be used only for singleton instance keeping"; + StackValue.Local local0 = StackValue.local(0, classAsmType); + local0.store(StackValue.onStack(classAsmType), clInitCodegen.v); + StackValue.Field singleton = + StackValue.createSingletonViaInstance( + descriptor, typeMapper, isInterfaceCompanion ? HIDDEN_INSTANCE_FIELD : INSTANCE_FIELD + ); + singleton.store(local0, clInitCodegen.v); + + generateInitializers(clInitCodegen); + + if (isInterfaceCompanion) { + //initialize singleton instance in outer by hidden instance + StackValue.singleton(descriptor, typeMapper).store( + singleton, getParentCodegen().createOrGetClInitCodegen().v, true + ); + } + } + else if (isClassCompanionWithBackingFieldsInOuter || isInterfaceCompanionWithBackingFieldsInOuter) { + ImplementationBodyCodegen parentCodegen = (ImplementationBodyCodegen) getParentCodegen(); + ExpressionCodegen parentClInitCodegen = parentCodegen.createOrGetClInitCodegen(); + InstructionAdapter parentVisitor = parentClInitCodegen.v; + + FunctionDescriptor constructor = (FunctionDescriptor) parentCodegen.context.accessibleDescriptor( + CollectionsKt.single(descriptor.getConstructors()), /* superCallExpression = */ null + ); + parentCodegen.generateMethodCallTo(constructor, null, parentVisitor); + StackValue instance = StackValue.onStack(parentCodegen.typeMapper.mapClass(descriptor)); + StackValue.singleton(descriptor, parentCodegen.typeMapper).store(instance, parentVisitor, true); + + generateInitializers(parentClInitCodegen); + } + else { + assert false : "Unknown object type: " + descriptor; + } + } + + private static boolean isInterfaceCompanionWithBackingFieldsInOuter(@NotNull DeclarationDescriptor declarationDescriptor) { + DeclarationDescriptor interfaceClass = declarationDescriptor.getContainingDeclaration(); + if (!isCompanionObject(declarationDescriptor) || !isJvmInterface(interfaceClass)) return false; + + Collection descriptors = ((ClassDescriptor) declarationDescriptor).getUnsubstitutedMemberScope() + .getContributedDescriptors(DescriptorKindFilter.ALL, MemberScope.Companion.getALL_NAME_FILTER()); + return CollectionsKt.any(descriptors, d -> d instanceof PropertyDescriptor && hasJvmFieldAnnotation((PropertyDescriptor) d)); + } + + private void generateCompanionObjectBackingFieldCopies() { + if (companionObjectPropertiesToCopy == null || companionObjectPropertiesToCopy.isEmpty()) return; + + boolean isPrivateCompanion = + DescriptorVisibilities.isPrivate( + ((ClassDescriptor) companionObjectPropertiesToCopy.get(0).descriptor.getContainingDeclaration()).getVisibility()); + + int modifiers = ACC_STATIC | ACC_FINAL | ACC_PUBLIC | (isPrivateCompanion ? ACC_DEPRECATED : 0); + List additionalVisibleAnnotations = + isPrivateCompanion ? Collections.singletonList(CodegenUtilKt.JAVA_LANG_DEPRECATED) : Collections.emptyList(); + for (PropertyAndDefaultValue info : companionObjectPropertiesToCopy) { + PropertyDescriptor property = info.descriptor; + + Type type = typeMapper.mapType(property); + + FieldVisitor fv = v.newField(JvmDeclarationOriginKt.Synthetic(DescriptorToSourceUtils.descriptorToDeclaration(property), property), + modifiers, context.getFieldName(property, false), + type.getDescriptor(), typeMapper.mapFieldSignature(property.getType(), property), + info.defaultValue); + + AnnotationCodegen.forField(fv, this, state).genAnnotations(property, type, null, null, additionalVisibleAnnotations); + + //This field are always static and final so if it has constant initializer don't do anything in clinit, + //field would be initialized via default value in v.newField(...) - see JVM SPEC Ch.4 + // TODO: test this code + if (state.getClassBuilderMode().generateBodies && info.defaultValue == null) { + ExpressionCodegen codegen = createOrGetClInitCodegen(); + int companionObjectIndex = putCompanionObjectInLocalVar(codegen); + StackValue.local(companionObjectIndex, OBJECT_TYPE).put(codegen.v); + copyFieldFromCompanionObject(property); + } + } + } + + private int putCompanionObjectInLocalVar(ExpressionCodegen codegen) { + FrameMap frameMap = codegen.myFrameMap; + ClassDescriptor companionObjectDescriptor = descriptor.getCompanionObjectDescriptor(); + int companionObjectIndex = frameMap.getIndex(companionObjectDescriptor); + if (companionObjectIndex == -1) { + companionObjectIndex = frameMap.enter(companionObjectDescriptor, OBJECT_TYPE); + StackValue companionObject = StackValue.singleton(companionObjectDescriptor, typeMapper); + StackValue.local(companionObjectIndex, companionObject.type).store(companionObject, codegen.v); + } + return companionObjectIndex; + } + + private void copyFieldFromCompanionObject(PropertyDescriptor propertyDescriptor) { + ExpressionCodegen codegen = createOrGetClInitCodegen(); + StackValue property = codegen.intermediateValueForProperty(propertyDescriptor, false, null, StackValue.none()); + StackValue.Field field = StackValue.field( + property.type, property.kotlinType, classAsmType, propertyDescriptor.getName().asString(), + true, StackValue.none(), propertyDescriptor + ); + field.store(property, codegen.v); + } + + public void generateInitializers(@NotNull ExpressionCodegen codegen) { + generateInitializers(() -> codegen); + } + + private void lookupConstructorExpressionsInClosureIfPresent() { + if (!state.getClassBuilderMode().generateBodies || descriptor.getConstructors().isEmpty()) return; + + KtVisitorVoid visitor = new KtVisitorVoid() { + @Override + public void visitKtElement(@NotNull KtElement e) { + e.acceptChildren(this); + } + + @Override + public void visitSimpleNameExpression(@NotNull KtSimpleNameExpression expr) { + DeclarationDescriptor descriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, expr); + + if (isLocalFunction(descriptor)) { + lookupInContext(descriptor); + } + else if (descriptor instanceof CallableMemberDescriptor) { + ResolvedCall call = CallUtilKt.getResolvedCall(expr, bindingContext); + if (call != null) { + lookupReceivers(call); + } + if (call instanceof VariableAsFunctionResolvedCall) { + lookupReceivers(((VariableAsFunctionResolvedCall) call).getVariableCall()); + } + } + else if (descriptor instanceof VariableDescriptor) { + DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration(); + if (containingDeclaration instanceof ConstructorDescriptor) { + ClassDescriptor classDescriptor = ((ConstructorDescriptor) containingDeclaration).getConstructedClass(); + if (classDescriptor == ImplementationBodyCodegen.this.descriptor) return; + } + if (lookupInContext(descriptor)) { + if (isDelegatedLocalVariable(descriptor)) { + VariableDescriptor metadata = getDelegatedLocalVariableMetadata((VariableDescriptor) descriptor, bindingContext); + lookupInContext(metadata); + } + } + } + } + + private void lookupReceivers(@NotNull ResolvedCall call) { + lookupReceiver(call.getDispatchReceiver()); + lookupReceiver(call.getExtensionReceiver()); + } + + private void lookupReceiver(@Nullable ReceiverValue value) { + if (value instanceof ImplicitReceiver) { + if (value instanceof ExtensionReceiver) { + ReceiverParameterDescriptor parameter = + ((ExtensionReceiver) value).getDeclarationDescriptor().getExtensionReceiverParameter(); + assert parameter != null : "Extension receiver should exist: " + ((ExtensionReceiver) value).getDeclarationDescriptor(); + lookupInContext(parameter); + } + else { + lookupInContext(((ImplicitReceiver) value).getDeclarationDescriptor()); + } + } + } + + private boolean lookupInContext(@NotNull DeclarationDescriptor toLookup) { + return context.lookupInContext(toLookup, StackValue.LOCAL_0, state, true) != null; + } + + @Override + public void visitThisExpression(@NotNull KtThisExpression expression) { + DeclarationDescriptor descriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, expression.getInstanceReference()); + assert descriptor instanceof CallableDescriptor || + descriptor instanceof ClassDescriptor : "'This' reference target should be class or callable descriptor but was " + descriptor; + if (descriptor instanceof ClassDescriptor) { + lookupInContext(descriptor); + } + + if (descriptor instanceof CallableDescriptor) { + ReceiverParameterDescriptor parameter = ((CallableDescriptor) descriptor).getExtensionReceiverParameter(); + if (parameter != null) { + lookupInContext(parameter); + } + } + } + + @Override + public void visitSuperExpression(@NotNull KtSuperExpression expression) { + lookupInContext(ExpressionCodegen.getSuperCallLabelTarget(context, expression)); + } + + @Override + public void visitArrayAccessExpression(@NotNull KtArrayAccessExpression expression) { + ResolvedCall resolvedGetCall = bindingContext.get(INDEXED_LVALUE_GET, expression); + if (resolvedGetCall != null) { + ReceiverValue receiver = resolvedGetCall.getDispatchReceiver(); + lookupReceiver(receiver); + } + + ResolvedCall resolvedSetCall = bindingContext.get(INDEXED_LVALUE_SET, expression); + if (resolvedSetCall != null) { + ReceiverValue receiver = resolvedSetCall.getDispatchReceiver(); + lookupReceiver(receiver); + } + super.visitArrayAccessExpression(expression); + } + }; + + for (KtDeclaration declaration : myClass.getDeclarations()) { + if (declaration instanceof KtProperty) { + KtProperty property = (KtProperty) declaration; + KtExpression initializer = property.getDelegateExpressionOrInitializer(); + if (initializer != null) { + initializer.accept(visitor); + } + } + else if (declaration instanceof KtAnonymousInitializer) { + KtAnonymousInitializer initializer = (KtAnonymousInitializer) declaration; + initializer.accept(visitor); + } + else if (declaration instanceof KtSecondaryConstructor) { + KtSecondaryConstructor constructor = (KtSecondaryConstructor) declaration; + constructor.accept(visitor); + } + } + + for (KtSuperTypeListEntry specifier : myClass.getSuperTypeListEntries()) { + if (specifier instanceof KtDelegatedSuperTypeEntry) { + KtExpression delegateExpression = ((KtDelegatedSuperTypeEntry) specifier).getDelegateExpression(); + assert delegateExpression != null; + delegateExpression.accept(visitor); + } + else if (specifier instanceof KtSuperTypeCallEntry) { + specifier.accept(visitor); + } + } + } + + private void generateEnumEntries() { + if (descriptor.getKind() != ClassKind.ENUM_CLASS) return; + + List enumEntries = CollectionsKt.filterIsInstance(element.getDeclarations(), KtEnumEntry.class); + + for (KtEnumEntry enumEntry : enumEntries) { + ClassDescriptor descriptor = getNotNull(bindingContext, BindingContext.CLASS, enumEntry); + int isDeprecated = KotlinBuiltIns.isDeprecated(descriptor) ? ACC_DEPRECATED : 0; + FieldVisitor fv = v.newField(JvmDeclarationOriginKt.OtherOrigin(enumEntry, descriptor), ACC_PUBLIC | ACC_ENUM | ACC_STATIC | ACC_FINAL | isDeprecated, + descriptor.getName().asString(), classAsmType.getDescriptor(), null, null); + AnnotationCodegen.forField(fv, this, state).genAnnotations(descriptor, null, null); + } + + initializeEnumConstants(enumEntries); + } + + private void initializeEnumConstants(@NotNull List enumEntries) { + if (!state.getClassBuilderMode().generateBodies) return; + + ExpressionCodegen codegen = createOrGetClInitCodegen(); + InstructionAdapter iv = codegen.v; + + Type arrayAsmType = typeMapper.mapType(DescriptorUtilsKt.getBuiltIns(descriptor).getArrayType(INVARIANT, descriptor.getDefaultType())); + v.newField(JvmDeclarationOriginKt.OtherOriginFromPure(myClass), ACC_PRIVATE | ACC_STATIC | ACC_FINAL | ACC_SYNTHETIC, ENUM_VALUES_FIELD_NAME, + arrayAsmType.getDescriptor(), null, null); + + iv.iconst(enumEntries.size()); + iv.newarray(classAsmType); + + if (!enumEntries.isEmpty()) { + iv.dup(); + for (int ordinal = 0, size = enumEntries.size(); ordinal < size; ordinal++) { + initializeEnumConstant(enumEntries, ordinal); + } + } + + iv.putstatic(classAsmType.getInternalName(), ENUM_VALUES_FIELD_NAME, arrayAsmType.getDescriptor()); + } + + private void initializeEnumConstant(@NotNull List enumEntries, int ordinal) { + ExpressionCodegen codegen = createOrGetClInitCodegen(); + InstructionAdapter iv = codegen.v; + KtEnumEntry enumEntry = enumEntries.get(ordinal); + + iv.dup(); + iv.iconst(ordinal); + + ClassDescriptor classDescriptor = getNotNull(bindingContext, BindingContext.CLASS, enumEntry); + Type implClass = typeMapper.mapClass(classDescriptor); + + iv.anew(implClass); + iv.dup(); + + iv.aconst(enumEntry.getName()); + iv.iconst(ordinal); + + List delegationSpecifiers = enumEntry.getSuperTypeListEntries(); + ResolvedCall defaultArgumentsConstructorCall = CallUtilKt.getResolvedCall(enumEntry, bindingContext); + boolean enumEntryHasSubclass = CodegenBinding.enumEntryNeedSubclass(bindingContext, classDescriptor); + if (delegationSpecifiers.size() == 1 && !enumEntryNeedSubclass(bindingContext, enumEntry)) { + ResolvedCall resolvedCall = CallUtilKt.getResolvedCallWithAssert(delegationSpecifiers.get(0), bindingContext); + + CallableMethod method = typeMapper.mapToCallableMethod((ConstructorDescriptor) resolvedCall.getResultingDescriptor(), false); + + codegen.invokeMethodWithArguments(method, resolvedCall, StackValue.none()); + } + else if (defaultArgumentsConstructorCall != null && !enumEntryHasSubclass) { + codegen.invokeFunction(defaultArgumentsConstructorCall, StackValue.none()).put(Type.VOID_TYPE, iv); + } + else { + iv.invokespecial(implClass.getInternalName(), "", "(Ljava/lang/String;I)V", false); + } + + iv.dup(); + iv.putstatic(classAsmType.getInternalName(), enumEntry.getName(), classAsmType.getDescriptor()); + iv.astore(OBJECT_TYPE); + } + + private void generateDelegates(DelegationFieldsInfo delegationFieldsInfo) { + for (KtSuperTypeListEntry specifier : myClass.getSuperTypeListEntries()) { + if (specifier instanceof KtDelegatedSuperTypeEntry) { + DelegationFieldsInfo.Field field = delegationFieldsInfo.getInfo((KtDelegatedSuperTypeEntry) specifier); + if (field == null) continue; + + generateDelegateField(field); + KtExpression delegateExpression = ((KtDelegatedSuperTypeEntry) specifier).getDelegateExpression(); + KotlinType delegateExpressionType = delegateExpression != null ? bindingContext.getType(delegateExpression) : null; + ClassDescriptor superClass = JvmCodegenUtil.getSuperClass(specifier, state, bindingContext); + if (superClass == null) continue; + + generateDelegates(superClass, delegateExpressionType, field); + } + } + } + + private void generateDelegateField(DelegationFieldsInfo.Field fieldInfo) { + if (!fieldInfo.generateField) return; + + v.newField(JvmDeclarationOrigin.NO_ORIGIN, ACC_PRIVATE | ACC_FINAL | ACC_SYNTHETIC, + fieldInfo.name, fieldInfo.type.getDescriptor(), fieldInfo.genericSignature, null); + } + + private void generateDelegates( + @NotNull ClassDescriptor toInterface, + @Nullable KotlinType delegateExpressionType, + @NotNull DelegationFieldsInfo.Field field + ) { + for (Map.Entry entry : DelegationResolver.Companion.getDelegates( + descriptor, toInterface, delegateExpressionType).entrySet() + ) { + CallableMemberDescriptor member = entry.getKey(); + CallableMemberDescriptor delegateTo = entry.getValue(); + if (member instanceof PropertyDescriptor) { + propertyCodegen.genDelegate((PropertyDescriptor) member, (PropertyDescriptor) delegateTo, field.getStackValue()); + } + else if (member instanceof FunctionDescriptor) { + functionCodegen.genDelegate((FunctionDescriptor) member, (FunctionDescriptor) delegateTo, field.getStackValue()); + } + } + } + + public void addCompanionObjectPropertyToCopy(@NotNull PropertyDescriptor descriptor, Object defaultValue) { + if (companionObjectPropertiesToCopy == null) { + companionObjectPropertiesToCopy = new ArrayList<>(); + } + companionObjectPropertiesToCopy.add(new PropertyAndDefaultValue(descriptor, defaultValue)); + } + + @Override + protected void done() { + for (Function2 task : additionalTasks) { + task.invoke(this, v); + } + + super.done(); + } + + private static class PropertyAndDefaultValue { + public final PropertyDescriptor descriptor; + public final Object defaultValue; + + public PropertyAndDefaultValue(@NotNull PropertyDescriptor descriptor, Object defaultValue) { + this.descriptor = descriptor; + this.defaultValue = defaultValue; + } + } + + public void addAdditionalTask(Function2 additionalTask) { + additionalTasks.add(additionalTask); + } +} diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/PropertyCodegen.java.201 b/compiler/backend/src/org/jetbrains/kotlin/codegen/PropertyCodegen.java.201 new file mode 100644 index 00000000000..25b7285eb81 --- /dev/null +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/PropertyCodegen.java.201 @@ -0,0 +1,680 @@ +/* + * Copyright 2000-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.codegen; + +import com.intellij.psi.PsiElement; +import kotlin.Pair; +import kotlin.collections.CollectionsKt; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.kotlin.codegen.context.CodegenContextUtil; +import org.jetbrains.kotlin.codegen.context.FieldOwnerContext; +import org.jetbrains.kotlin.codegen.context.MultifileClassFacadeContext; +import org.jetbrains.kotlin.codegen.context.MultifileClassPartContext; +import org.jetbrains.kotlin.codegen.state.GenerationState; +import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper; +import org.jetbrains.kotlin.config.LanguageFeature; +import org.jetbrains.kotlin.descriptors.*; +import org.jetbrains.kotlin.descriptors.annotations.Annotations; +import org.jetbrains.kotlin.load.java.DescriptorsJvmAbiUtil; +import org.jetbrains.kotlin.load.java.JvmAbi; +import org.jetbrains.kotlin.psi.*; +import org.jetbrains.kotlin.resolve.BindingContext; +import org.jetbrains.kotlin.resolve.DescriptorFactory; +import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils; +import org.jetbrains.kotlin.resolve.InlineClassesUtilsKt; +import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall; +import org.jetbrains.kotlin.resolve.calls.util.UnderscoreUtilKt; +import org.jetbrains.kotlin.resolve.constants.ConstantValue; +import org.jetbrains.kotlin.resolve.jvm.annotations.JvmAnnotationUtilKt; +import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt; +import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodGenericSignature; +import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature; +import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedPropertyDescriptor; +import org.jetbrains.kotlin.types.ErrorUtils; +import org.jetbrains.kotlin.types.KotlinType; +import org.jetbrains.org.objectweb.asm.FieldVisitor; +import org.jetbrains.org.objectweb.asm.MethodVisitor; +import org.jetbrains.org.objectweb.asm.Opcodes; +import org.jetbrains.org.objectweb.asm.Type; +import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter; +import org.jetbrains.org.objectweb.asm.commons.Method; + +import java.util.Collections; +import java.util.List; + +import static org.jetbrains.kotlin.codegen.DescriptorAsmUtil.getDeprecatedAccessFlag; +import static org.jetbrains.kotlin.codegen.DescriptorAsmUtil.getVisibilityForBackingField; +import static org.jetbrains.kotlin.codegen.FunctionCodegen.processInterfaceMethod; +import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.isConstOrHasJvmFieldAnnotation; +import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.isJvmInterface; +import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.*; +import static org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings.*; +import static org.jetbrains.kotlin.diagnostics.Errors.EXPECTED_FUNCTION_SOURCE_WITH_DEFAULT_ARGUMENTS_NOT_FOUND; +import static org.jetbrains.kotlin.fileClasses.JvmFileClassUtilKt.isTopLevelInJvmMultifileClass; +import static org.jetbrains.kotlin.resolve.DescriptorUtils.isCompanionObject; +import static org.jetbrains.kotlin.resolve.DescriptorUtils.isInterface; +import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.K_PROPERTY_TYPE; +import static org.jetbrains.kotlin.resolve.jvm.annotations.JvmAnnotationUtilKt.hasJvmFieldAnnotation; +import static org.jetbrains.kotlin.resolve.jvm.annotations.JvmAnnotationUtilKt.hasJvmSyntheticAnnotation; +import static org.jetbrains.org.objectweb.asm.Opcodes.*; + +public class PropertyCodegen { + private final GenerationState state; + private final ClassBuilder v; + private final FunctionCodegen functionCodegen; + private final KotlinTypeMapper typeMapper; + private final BindingContext bindingContext; + private final FieldOwnerContext context; + private final MemberCodegen memberCodegen; + private final OwnerKind kind; + + public PropertyCodegen( + @NotNull FieldOwnerContext context, + @NotNull ClassBuilder v, + @NotNull FunctionCodegen functionCodegen, + @NotNull MemberCodegen memberCodegen + ) { + this.state = functionCodegen.state; + this.v = v; + this.functionCodegen = functionCodegen; + this.typeMapper = state.getTypeMapper(); + this.bindingContext = state.getBindingContext(); + this.context = context; + this.memberCodegen = memberCodegen; + this.kind = context.getContextKind(); + } + + public void gen(@NotNull KtProperty property) { + VariableDescriptor variableDescriptor = bindingContext.get(BindingContext.VARIABLE, property); + if (!(variableDescriptor instanceof PropertyDescriptor)) { + throw ExceptionLogger.logDescriptorNotFound( + "Property " + property.getName() + " should have a property descriptor: " + variableDescriptor, property + ); + } + + PropertyDescriptor propertyDescriptor = (PropertyDescriptor) variableDescriptor; + gen(property, propertyDescriptor, property.getGetter(), property.getSetter()); + } + + public void genDestructuringDeclaration(@NotNull KtDestructuringDeclarationEntry entry) { + VariableDescriptor variableDescriptor = bindingContext.get(BindingContext.VARIABLE, entry); + if (!(variableDescriptor instanceof PropertyDescriptor)) { + throw ExceptionLogger.logDescriptorNotFound( + "Destructuring declaration entry" + entry.getName() + " should have a property descriptor: " + variableDescriptor, entry + ); + } + + if (!UnderscoreUtilKt.isSingleUnderscore(entry)) { + genDestructuringDeclaration((PropertyDescriptor) variableDescriptor); + } + } + + public void generateInPackageFacade(@NotNull DeserializedPropertyDescriptor deserializedProperty) { + assert context instanceof MultifileClassFacadeContext : "should be called only for generating facade: " + context; + + genBackingFieldAndAnnotations(deserializedProperty); + + if (!isConstOrHasJvmFieldAnnotation(deserializedProperty)) { + generateGetter(deserializedProperty, null); + generateSetter(deserializedProperty, null); + } + } + + private void gen( + @NotNull KtProperty declaration, + @NotNull PropertyDescriptor descriptor, + @Nullable KtPropertyAccessor getter, + @Nullable KtPropertyAccessor setter + ) { + assert kind == OwnerKind.PACKAGE || kind == OwnerKind.IMPLEMENTATION || + kind == OwnerKind.DEFAULT_IMPLS || kind == OwnerKind.ERASED_INLINE_CLASS + : "Generating property with a wrong kind (" + kind + "): " + descriptor; + + genBackingFieldAndAnnotations(descriptor); + + boolean isDefaultGetterAndSetter = isDefaultAccessor(getter) && isDefaultAccessor(setter); + + if (isAccessorNeeded(descriptor, getter, isDefaultGetterAndSetter)) { + generateGetter(descriptor, getter); + } + if (isAccessorNeeded(descriptor, setter, isDefaultGetterAndSetter)) { + generateSetter(descriptor, setter); + } + } + + private static boolean isDefaultAccessor(@Nullable KtPropertyAccessor accessor) { + return accessor == null || !accessor.hasBody(); + } + + private void genDestructuringDeclaration(@NotNull PropertyDescriptor descriptor) { + assert kind == OwnerKind.PACKAGE || kind == OwnerKind.IMPLEMENTATION || kind == OwnerKind.DEFAULT_IMPLS + : "Generating property with a wrong kind (" + kind + "): " + descriptor; + + genBackingFieldAndAnnotations(descriptor); + + generateGetter(descriptor, null); + generateSetter(descriptor, null); + } + + private void genBackingFieldAndAnnotations(@NotNull PropertyDescriptor descriptor) { + // Fields and '$annotations' methods for non-private const properties are generated in the multi-file facade + boolean isBackingFieldOwner = descriptor.isConst() && !DescriptorVisibilities.isPrivate(descriptor.getVisibility()) + ? !(context instanceof MultifileClassPartContext) + : CodegenContextUtil.isImplementationOwner(context, descriptor); + + generateBackingField(descriptor, isBackingFieldOwner); + generateSyntheticMethodIfNeeded(descriptor, isBackingFieldOwner); + } + + private boolean isAccessorNeeded( + @NotNull PropertyDescriptor descriptor, + @Nullable KtPropertyAccessor accessor, + boolean isDefaultGetterAndSetter + ) { + return isAccessorNeeded(descriptor, accessor, isDefaultGetterAndSetter, kind); + } + + public static boolean isReferenceablePropertyWithGetter(@NotNull PropertyDescriptor descriptor) { + PsiElement psiElement = DescriptorToSourceUtils.descriptorToDeclaration(descriptor); + KtDeclaration ktDeclaration = psiElement instanceof KtDeclaration ? (KtDeclaration) psiElement : null; + if (ktDeclaration instanceof KtProperty) { + KtProperty ktProperty = (KtProperty) ktDeclaration; + boolean isDefaultGetterAndSetter = + isDefaultAccessor(ktProperty.getGetter()) && isDefaultAccessor(ktProperty.getSetter()); + return isAccessorNeeded(descriptor, ktProperty.getGetter(), isDefaultGetterAndSetter, OwnerKind.IMPLEMENTATION); + } else if (ktDeclaration instanceof KtParameter) { + return isAccessorNeeded(descriptor, null, true, OwnerKind.IMPLEMENTATION); + } else { + return isAccessorNeeded(descriptor, null, false, OwnerKind.IMPLEMENTATION); + } + } + + /** + * Determines if it's necessary to generate an accessor to the property, i.e. if this property can be referenced via getter/setter + * for any reason + * + * @see JvmCodegenUtil#couldUseDirectAccessToProperty + */ + private static boolean isAccessorNeeded( + @NotNull PropertyDescriptor descriptor, + @Nullable KtPropertyAccessor accessor, + boolean isDefaultGetterAndSetter, + OwnerKind kind + ) { + if (isConstOrHasJvmFieldAnnotation(descriptor)) return false; + + boolean isDefaultAccessor = isDefaultAccessor(accessor); + + // Don't generate accessors for interface properties with default accessors in DefaultImpls + if (kind == OwnerKind.DEFAULT_IMPLS && isDefaultAccessor) return false; + + // Delegated or extension properties can only be referenced via accessors + if (descriptor.isDelegated() || descriptor.getExtensionReceiverParameter() != null) return true; + + // Companion object properties should have accessors for non-private properties because these properties can be referenced + // via getter/setter. But these accessors getter/setter are not required for private properties that have a default getter + // and setter, in this case, the property can always be accessed through the accessor 'access$cp' and avoid some + // useless indirection by using others accessors. + if (isCompanionObject(descriptor.getContainingDeclaration())) { + if (DescriptorVisibilities.isPrivate(descriptor.getVisibility()) && isDefaultGetterAndSetter) { + return false; + } + return true; + } + + // Non-const properties from multifile classes have accessors regardless of visibility + if (isTopLevelInJvmMultifileClass(descriptor)) return true; + + // Private class properties have accessors only in cases when those accessors are non-trivial + if (DescriptorVisibilities.isPrivate(descriptor.getVisibility())) { + return !isDefaultAccessor; + } + + // Non-private properties with private setter should not be generated for trivial properties + // as the class will use direct field access instead + //noinspection ConstantConditions + if (accessor != null && accessor.isSetter() && DescriptorVisibilities.isPrivate(descriptor.getSetter().getVisibility())) { + return !isDefaultAccessor; + } + + // Non-public API (private and internal) primary vals of inline classes don't have getter + if (InlineClassesUtilsKt.isUnderlyingPropertyOfInlineClass(descriptor) && !descriptor.getVisibility().isPublicAPI()) { + return false; + } + + return true; + } + + private static boolean areAccessorsNeededForPrimaryConstructorProperty( + @NotNull PropertyDescriptor descriptor, + @NotNull OwnerKind kind + ) { + if (hasJvmFieldAnnotation(descriptor)) return false; + if (kind == OwnerKind.ERASED_INLINE_CLASS) return false; + + DescriptorVisibility visibility = descriptor.getVisibility(); + if (InlineClassesUtilsKt.isInlineClass(descriptor.getContainingDeclaration())) { + return visibility.isPublicAPI(); + } + else { + return !DescriptorVisibilities.isPrivate(visibility); + } + } + + public void generatePrimaryConstructorProperty(@NotNull PropertyDescriptor descriptor) { + genBackingFieldAndAnnotations(descriptor); + + if (areAccessorsNeededForPrimaryConstructorProperty(descriptor, context.getContextKind())) { + generateGetter(descriptor, null); + generateSetter(descriptor, null); + } + } + + public void generateConstructorPropertyAsMethodForAnnotationClass( + @NotNull KtParameter parameter, + @NotNull PropertyDescriptor descriptor, + @Nullable FunctionDescriptor expectedAnnotationConstructor + ) { + JvmMethodGenericSignature signature = typeMapper.mapAnnotationParameterSignature(descriptor); + Method asmMethod = signature.getAsmMethod(); + MethodVisitor mv = v.newMethod( + JvmDeclarationOriginKt.OtherOrigin(parameter, descriptor), + ACC_PUBLIC | ACC_ABSTRACT, + asmMethod.getName(), + asmMethod.getDescriptor(), + signature.getGenericsSignature(), + null + ); + + PropertyGetterDescriptor getter = descriptor.getGetter(); + assert getter != null : "Annotation property should have a getter: " + descriptor; + v.getSerializationBindings().put(METHOD_FOR_FUNCTION, getter, asmMethod); + AnnotationCodegen.forMethod(mv, memberCodegen, state).genAnnotations(getter, asmMethod.getReturnType(), null); + + KtExpression defaultValue = loadAnnotationArgumentDefaultValue(parameter, descriptor, expectedAnnotationConstructor); + if (defaultValue != null) { + ConstantValue constant = ExpressionCodegen.getCompileTimeConstant( + defaultValue, bindingContext, true, state.getShouldInlineConstVals()); + assert !state.getClassBuilderMode().generateBodies || constant != null + : "Default value for annotation parameter should be compile time value: " + defaultValue.getText(); + if (constant != null) { + AnnotationCodegen annotationCodegen = AnnotationCodegen.forAnnotationDefaultValue(mv, memberCodegen, state); + annotationCodegen.generateAnnotationDefaultValue(constant, descriptor.getType()); + } + } + + mv.visitEnd(); + } + + private KtExpression loadAnnotationArgumentDefaultValue( + @NotNull KtParameter ktParameter, + @NotNull PropertyDescriptor descriptor, + @Nullable FunctionDescriptor expectedAnnotationConstructor + ) { + KtExpression value = ktParameter.getDefaultValue(); + if (value != null) return value; + + if (expectedAnnotationConstructor != null) { + ValueParameterDescriptor expectedParameter = CollectionsKt.single( + expectedAnnotationConstructor.getValueParameters(), parameter -> parameter.getName().equals(descriptor.getName()) + ); + PsiElement element = DescriptorToSourceUtils.descriptorToDeclaration(expectedParameter); + if (!(element instanceof KtParameter)) { + state.getDiagnostics().report(EXPECTED_FUNCTION_SOURCE_WITH_DEFAULT_ARGUMENTS_NOT_FOUND.on(ktParameter)); + return null; + } + return ((KtParameter) element).getDefaultValue(); + } + + return null; + } + + private void generateBackingField(@NotNull PropertyDescriptor descriptor, boolean isBackingFieldOwner) { + if (isJvmInterface(descriptor.getContainingDeclaration()) || kind == OwnerKind.DEFAULT_IMPLS || + kind == OwnerKind.ERASED_INLINE_CLASS) { + return; + } + + Object defaultValue; + if (descriptor.isDelegated()) { + defaultValue = null; + } + else if (Boolean.TRUE.equals(bindingContext.get(BindingContext.BACKING_FIELD_REQUIRED, descriptor))) { + if (shouldWriteFieldInitializer(descriptor)) { + ConstantValue initializer = descriptor.getCompileTimeInitializer(); + defaultValue = initializer == null ? null : initializer.getValue(); + } + else { + defaultValue = null; + } + } + else { + return; + } + + generateBackingField(descriptor, descriptor.isDelegated(), defaultValue, isBackingFieldOwner); + } + + // Annotations on properties are stored in bytecode on an empty synthetic method. This way they're still + // accessible via reflection, and 'deprecated' and 'synthetic' flags prevent this method from being called accidentally + private void generateSyntheticMethodIfNeeded(@NotNull PropertyDescriptor descriptor, boolean isBackingFieldOwner) { + Annotations annotations = descriptor.getAnnotations(); + if (annotations.isEmpty()) return; + + Method signature = typeMapper.mapSyntheticMethodForPropertyAnnotations(descriptor); + if (kind != OwnerKind.DEFAULT_IMPLS && CodegenContextUtil.isImplementationOwner(context, descriptor)) { + v.getSerializationBindings().put(SYNTHETIC_METHOD_FOR_PROPERTY, descriptor, signature); + } + + if (isBackingFieldOwner) { + if (!isInterface(context.getContextDescriptor()) || + processInterfaceMethod(descriptor, kind, false, true, state.getJvmDefaultMode())) { + memberCodegen.generateSyntheticAnnotationsMethod(descriptor, signature, annotations); + } + } + } + + private void generateBackingField( + @NotNull PropertyDescriptor propertyDescriptor, + boolean isDelegate, + @Nullable Object defaultValue, + boolean isBackingFieldOwner + ) { + FieldDescriptor annotatedField = isDelegate ? propertyDescriptor.getDelegateField() : propertyDescriptor.getBackingField(); + + int modifiers = getDeprecatedAccessFlag(propertyDescriptor); + + for (AnnotationCodegen.JvmFlagAnnotation flagAnnotation : AnnotationCodegen.FIELD_FLAGS) { + modifiers |= flagAnnotation.getJvmFlag(annotatedField); + } + + if (kind == OwnerKind.PACKAGE) { + modifiers |= ACC_STATIC; + } + + if (!propertyDescriptor.isLateInit() && (!propertyDescriptor.isVar() || isDelegate)) { + modifiers |= ACC_FINAL; + } + + if (hasJvmSyntheticAnnotation(propertyDescriptor)) { + modifiers |= ACC_SYNTHETIC; + } + + KotlinType kotlinType = isDelegate ? getDelegateTypeForProperty(propertyDescriptor, bindingContext) : propertyDescriptor.getType(); + Type type = typeMapper.mapType(kotlinType); + + ClassBuilder builder = v; + + FieldOwnerContext backingFieldContext = context; + List additionalVisibleAnnotations = Collections.emptyList(); + if (DescriptorAsmUtil.isInstancePropertyWithStaticBackingField(propertyDescriptor) ) { + modifiers |= ACC_STATIC; + + if (DescriptorsJvmAbiUtil.isPropertyWithBackingFieldInOuterClass(propertyDescriptor)) { + ImplementationBodyCodegen codegen = (ImplementationBodyCodegen) memberCodegen.getParentCodegen(); + builder = codegen.v; + backingFieldContext = codegen.context; + if (DescriptorVisibilities.isPrivate(((ClassDescriptor) propertyDescriptor.getContainingDeclaration()).getVisibility())) { + modifiers |= ACC_DEPRECATED; + additionalVisibleAnnotations = Collections.singletonList(CodegenUtilKt.JAVA_LANG_DEPRECATED); + } + } + } + modifiers |= getVisibilityForBackingField(propertyDescriptor, isDelegate); + + if (DescriptorAsmUtil.isPropertyWithBackingFieldCopyInOuterClass(propertyDescriptor)) { + ImplementationBodyCodegen parentBodyCodegen = (ImplementationBodyCodegen) memberCodegen.getParentCodegen(); + parentBodyCodegen.addCompanionObjectPropertyToCopy(propertyDescriptor, defaultValue); + } + + String name = backingFieldContext.getFieldName(propertyDescriptor, isDelegate); + + v.getSerializationBindings().put(FIELD_FOR_PROPERTY, propertyDescriptor, new Pair<>(type, name)); + + if (isBackingFieldOwner) { + String signature = isDelegate ? null : typeMapper.mapFieldSignature(kotlinType, propertyDescriptor); + FieldVisitor fv = builder.newField( + JvmDeclarationOriginKt.OtherOrigin(propertyDescriptor), modifiers, name, type.getDescriptor(), + signature, defaultValue + ); + + if (annotatedField != null) { + // Don't emit nullability annotations for backing field if: + // - backing field is synthetic; + // - property is lateinit (since corresponding field is actually nullable). + boolean skipNullabilityAnnotations = + (modifiers & ACC_SYNTHETIC) != 0 || + propertyDescriptor.isLateInit(); + AnnotationCodegen.forField(fv, memberCodegen, state, skipNullabilityAnnotations) + .genAnnotations(annotatedField, type, propertyDescriptor.getType(), null, additionalVisibleAnnotations); + } + + if (propertyDescriptor.getContainingDeclaration() instanceof ClassDescriptor && JvmAnnotationUtilKt.isJvmRecord((ClassDescriptor) propertyDescriptor.getContainingDeclaration())) { + // builder.newRecordComponent(name, type.getDescriptor(), signature); + } + } + } + + @NotNull + public static KotlinType getDelegateTypeForProperty( + @NotNull PropertyDescriptor propertyDescriptor, + @NotNull BindingContext bindingContext + ) { + ResolvedCall provideDelegateResolvedCall = + bindingContext.get(BindingContext.PROVIDE_DELEGATE_RESOLVED_CALL, propertyDescriptor); + + KtProperty property = (KtProperty) DescriptorToSourceUtils.descriptorToDeclaration(propertyDescriptor); + KtExpression delegateExpression = property != null ? property.getDelegateExpression() : null; + + KotlinType delegateType; + if (provideDelegateResolvedCall != null) { + delegateType = provideDelegateResolvedCall.getResultingDescriptor().getReturnType(); + } + else if (delegateExpression != null) { + delegateType = bindingContext.getType(delegateExpression); + } + else { + delegateType = null; + } + + if (delegateType == null) { + // Delegation convention is unresolved + delegateType = ErrorUtils.createErrorType("Delegate type"); + } + return delegateType; + } + + private boolean shouldWriteFieldInitializer(@NotNull PropertyDescriptor descriptor) { + if (!descriptor.isConst() && + state.getLanguageVersionSettings().supportsFeature(LanguageFeature.NoConstantValueAttributeForNonConstVals)) { + return false; + } + + //final field of primitive or String type + if (!descriptor.isVar()) { + Type type = typeMapper.mapType(descriptor); + return AsmUtil.isPrimitive(type) || "java.lang.String".equals(type.getClassName()); + } + return false; + } + + private void generateGetter(@NotNull PropertyDescriptor descriptor, @Nullable KtPropertyAccessor getter) { + generateAccessor( + getter, + descriptor.getGetter() != null ? descriptor.getGetter() : DescriptorFactory.createDefaultGetter( + descriptor, Annotations.Companion.getEMPTY() + ) + ); + } + + private void generateSetter(@NotNull PropertyDescriptor descriptor, @Nullable KtPropertyAccessor setter) { + if (!descriptor.isVar()) return; + + generateAccessor( + setter, + descriptor.getSetter() != null ? descriptor.getSetter() : DescriptorFactory.createDefaultSetter( + descriptor, Annotations.Companion.getEMPTY(), Annotations.Companion.getEMPTY() + ) + ); + } + + private void generateAccessor(@Nullable KtPropertyAccessor accessor, @NotNull PropertyAccessorDescriptor descriptor) { + if (context instanceof MultifileClassFacadeContext && + (DescriptorVisibilities.isPrivate(descriptor.getVisibility()) || + DescriptorAsmUtil.getVisibilityAccessFlag(descriptor) == Opcodes.ACC_PRIVATE)) { + return; + } + + FunctionGenerationStrategy strategy; + if (accessor == null || !accessor.hasBody()) { + if (descriptor.getCorrespondingProperty().isDelegated()) { + strategy = new DelegatedPropertyAccessorStrategy(state, descriptor); + } + else { + strategy = new DefaultPropertyAccessorStrategy(state, descriptor); + } + } + else { + strategy = new FunctionGenerationStrategy.FunctionDefault(state, accessor); + } + + functionCodegen.generateMethod(JvmDeclarationOriginKt.OtherOrigin(descriptor), descriptor, strategy); + } + + private static class DefaultPropertyAccessorStrategy extends FunctionGenerationStrategy.CodegenBased { + private final PropertyAccessorDescriptor propertyAccessorDescriptor; + + public DefaultPropertyAccessorStrategy(@NotNull GenerationState state, @NotNull PropertyAccessorDescriptor descriptor) { + super(state); + propertyAccessorDescriptor = descriptor; + } + + @Override + public void doGenerateBody(@NotNull ExpressionCodegen codegen, @NotNull JvmMethodSignature signature) { + InstructionAdapter v = codegen.v; + PropertyDescriptor propertyDescriptor = propertyAccessorDescriptor.getCorrespondingProperty(); + StackValue property = codegen.intermediateValueForProperty(propertyDescriptor, true, null, StackValue.LOCAL_0); + + PsiElement jetProperty = DescriptorToSourceUtils.descriptorToDeclaration(propertyDescriptor); + if (jetProperty instanceof KtProperty || jetProperty instanceof KtParameter) { + codegen.markLineNumber((KtElement) jetProperty, false); + } + + if (propertyAccessorDescriptor instanceof PropertyGetterDescriptor) { + Type type = signature.getReturnType(); + property.put(type, v); + v.areturn(type); + } + else if (propertyAccessorDescriptor instanceof PropertySetterDescriptor) { + List valueParameters = propertyAccessorDescriptor.getValueParameters(); + assert valueParameters.size() == 1 : "Property setter should have only one value parameter but has " + propertyAccessorDescriptor; + int parameterIndex = codegen.lookupLocalIndex(valueParameters.get(0)); + assert parameterIndex >= 0 : "Local index for setter parameter should be positive or zero: " + propertyAccessorDescriptor; + Type type = codegen.typeMapper.mapType(propertyDescriptor); + property.store(StackValue.local(parameterIndex, type), codegen.v); + v.visitInsn(RETURN); + } + else { + throw new IllegalStateException("Unknown property accessor: " + propertyAccessorDescriptor); + } + } + } + + public static StackValue invokeDelegatedPropertyConventionMethod( + @NotNull ExpressionCodegen codegen, + @NotNull ResolvedCall resolvedCall, + @NotNull StackValue receiver, + @NotNull PropertyDescriptor propertyDescriptor + ) { + codegen.tempVariables.put( + resolvedCall.getCall().getValueArguments().get(1).asElement(), + getDelegatedPropertyMetadata(propertyDescriptor, codegen.getBindingContext()) + ); + + return codegen.invokeFunction(resolvedCall, receiver); + } + + public static boolean isDelegatedPropertyWithOptimizedMetadata( + @NotNull VariableDescriptorWithAccessors descriptor, + @NotNull BindingContext bindingContext + ) { + return Boolean.TRUE == bindingContext.get(DELEGATED_PROPERTY_WITH_OPTIMIZED_METADATA, descriptor); + } + + public static @NotNull StackValue getOptimizedDelegatedPropertyMetadataValue() { + return StackValue.constant(null, K_PROPERTY_TYPE); + } + + @NotNull + public static StackValue getDelegatedPropertyMetadata( + @NotNull VariableDescriptorWithAccessors descriptor, + @NotNull BindingContext bindingContext + ) { + if (isDelegatedPropertyWithOptimizedMetadata(descriptor, bindingContext)) { + return getOptimizedDelegatedPropertyMetadataValue(); + } + + Type owner = bindingContext.get(DELEGATED_PROPERTY_METADATA_OWNER, descriptor); + assert owner != null : "Delegated property owner not found: " + descriptor; + + List allDelegatedProperties = bindingContext.get(DELEGATED_PROPERTIES_WITH_METADATA, owner); + int index = allDelegatedProperties == null ? -1 : allDelegatedProperties.indexOf(descriptor); + if (index < 0) { + throw new AssertionError("Delegated property not found in " + owner + ": " + descriptor); + } + + StackValue.Field array = StackValue.field( + Type.getType("[" + K_PROPERTY_TYPE), owner, JvmAbi.DELEGATED_PROPERTIES_ARRAY_NAME, true, StackValue.none() + ); + return StackValue.arrayElement(K_PROPERTY_TYPE, null, array, StackValue.constant(index)); + } + + private static class DelegatedPropertyAccessorStrategy extends FunctionGenerationStrategy.CodegenBased { + private final PropertyAccessorDescriptor propertyAccessorDescriptor; + + public DelegatedPropertyAccessorStrategy(@NotNull GenerationState state, @NotNull PropertyAccessorDescriptor descriptor) { + super(state); + this.propertyAccessorDescriptor = descriptor; + } + + @Override + public void doGenerateBody(@NotNull ExpressionCodegen codegen, @NotNull JvmMethodSignature signature) { + InstructionAdapter v = codegen.v; + + BindingContext bindingContext = state.getBindingContext(); + ResolvedCall resolvedCall = + bindingContext.get(BindingContext.DELEGATED_PROPERTY_RESOLVED_CALL, propertyAccessorDescriptor); + assert resolvedCall != null : "Resolve call should be recorded for delegate call " + signature.toString(); + + PropertyDescriptor propertyDescriptor = propertyAccessorDescriptor.getCorrespondingProperty(); + StackValue.Property property = codegen.intermediateValueForProperty(propertyDescriptor, true, null, StackValue.LOCAL_0); + StackValue.Property delegate = property.getDelegateOrNull(); + assert delegate != null : "No delegate for delegated property: " + propertyDescriptor; + StackValue lastValue = invokeDelegatedPropertyConventionMethod(codegen, resolvedCall, delegate, propertyDescriptor); + Type asmType = signature.getReturnType(); + KotlinType kotlinReturnType = propertyAccessorDescriptor.getOriginal().getReturnType(); + lastValue.put(asmType, kotlinReturnType, v); + v.areturn(asmType); + } + } + + public void genDelegate(@NotNull PropertyDescriptor delegate, @NotNull PropertyDescriptor delegateTo, @NotNull StackValue field) { + ClassDescriptor toClass = (ClassDescriptor) delegateTo.getContainingDeclaration(); + + PropertyGetterDescriptor getter = delegate.getGetter(); + if (getter != null) { + //noinspection ConstantConditions + functionCodegen.genDelegate(getter, delegateTo.getGetter().getOriginal(), toClass, field); + } + + PropertySetterDescriptor setter = delegate.getSetter(); + if (setter != null) { + //noinspection ConstantConditions + functionCodegen.genDelegate(setter, delegateTo.getSetter().getOriginal(), toClass, field); + } + } +} diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt.201 b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt.201 new file mode 100644 index 00000000000..6120985d6ce --- /dev/null +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt.201 @@ -0,0 +1,703 @@ +/* + * Copyright 2010-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.cli.jvm.compiler + +import com.intellij.codeInsight.ExternalAnnotationsManager +import com.intellij.codeInsight.InferredAnnotationsManager +import com.intellij.core.CoreApplicationEnvironment +import com.intellij.core.CoreJavaFileManager +import com.intellij.core.JavaCoreProjectEnvironment +import com.intellij.ide.highlighter.JavaFileType +import com.intellij.lang.java.JavaParserDefinition +import com.intellij.mock.MockProject +import com.intellij.openapi.Disposable +import com.intellij.openapi.application.TransactionGuard +import com.intellij.openapi.application.TransactionGuardImpl +import com.intellij.openapi.components.ServiceManager +import com.intellij.openapi.diagnostic.Logger +import com.intellij.openapi.extensions.Extensions +import com.intellij.openapi.extensions.ExtensionsArea +import com.intellij.openapi.fileTypes.PlainTextFileType +import com.intellij.openapi.project.Project +import com.intellij.openapi.roots.LanguageLevelProjectExtension +import com.intellij.openapi.util.Disposer +import com.intellij.openapi.util.io.FileUtilRt +import com.intellij.openapi.util.text.StringUtil +import com.intellij.openapi.vfs.* +import com.intellij.openapi.vfs.impl.ZipHandler +import com.intellij.pom.java.LanguageLevel +import com.intellij.psi.PsiElementFinder +import com.intellij.psi.PsiManager +import com.intellij.psi.compiled.ClassFileDecompilers +import com.intellij.psi.impl.JavaClassSupersImpl +import com.intellij.psi.impl.PsiElementFinderImpl +import com.intellij.psi.impl.PsiTreeChangePreprocessor +import com.intellij.psi.impl.file.impl.JavaFileManager +import com.intellij.psi.search.GlobalSearchScope +import com.intellij.psi.util.JavaClassSupers +import com.intellij.util.io.URLUtil +import com.intellij.util.lang.UrlClassLoader +import org.jetbrains.annotations.TestOnly +import org.jetbrains.kotlin.asJava.KotlinAsJavaSupport +import org.jetbrains.kotlin.asJava.LightClassGenerationSupport +import org.jetbrains.kotlin.asJava.classes.FacadeCache +import org.jetbrains.kotlin.asJava.finder.JavaElementFinder +import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension +import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys +import org.jetbrains.kotlin.cli.common.CliModuleVisibilityManagerImpl +import org.jetbrains.kotlin.cli.common.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY +import org.jetbrains.kotlin.cli.common.config.ContentRoot +import org.jetbrains.kotlin.cli.common.config.KotlinSourceRoot +import org.jetbrains.kotlin.cli.common.config.kotlinSourceRoots +import org.jetbrains.kotlin.cli.common.extensions.ScriptEvaluationExtension +import org.jetbrains.kotlin.cli.common.extensions.ShellExtension +import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity +import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.ERROR +import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.STRONG_WARNING +import org.jetbrains.kotlin.cli.common.messages.MessageCollector +import org.jetbrains.kotlin.cli.common.toBooleanLenient +import org.jetbrains.kotlin.cli.jvm.JvmRuntimeVersionsConsistencyChecker +import org.jetbrains.kotlin.cli.jvm.config.* +import org.jetbrains.kotlin.cli.jvm.index.* +import org.jetbrains.kotlin.cli.jvm.javac.JavacWrapperRegistrar +import org.jetbrains.kotlin.cli.jvm.modules.CliJavaModuleFinder +import org.jetbrains.kotlin.cli.jvm.modules.CliJavaModuleResolver +import org.jetbrains.kotlin.cli.jvm.modules.CoreJrtFileSystem +import org.jetbrains.kotlin.codegen.extensions.ClassBuilderInterceptorExtension +import org.jetbrains.kotlin.codegen.extensions.ExpressionCodegenExtension +import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar +import org.jetbrains.kotlin.config.* +import org.jetbrains.kotlin.extensions.* +import org.jetbrains.kotlin.extensions.internal.CandidateInterceptor +import org.jetbrains.kotlin.extensions.internal.TypeResolutionInterceptor +import org.jetbrains.kotlin.idea.KotlinFileType +import org.jetbrains.kotlin.js.translate.extensions.JsSyntheticTranslateExtension +import org.jetbrains.kotlin.load.kotlin.KotlinBinaryClassCache +import org.jetbrains.kotlin.load.kotlin.MetadataFinderFactory +import org.jetbrains.kotlin.load.kotlin.ModuleVisibilityManager +import org.jetbrains.kotlin.load.kotlin.VirtualFileFinderFactory +import org.jetbrains.kotlin.parsing.KotlinParserDefinition +import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.resolve.CodeAnalyzerInitializer +import org.jetbrains.kotlin.resolve.ModuleAnnotationsResolver +import org.jetbrains.kotlin.resolve.extensions.ExtraImportsProviderExtension +import org.jetbrains.kotlin.resolve.extensions.SyntheticResolveExtension +import org.jetbrains.kotlin.resolve.jvm.KotlinJavaPsiFacade +import org.jetbrains.kotlin.resolve.jvm.extensions.AnalysisHandlerExtension +import org.jetbrains.kotlin.resolve.jvm.extensions.PackageFragmentProviderExtension +import org.jetbrains.kotlin.resolve.jvm.modules.JavaModuleResolver +import org.jetbrains.kotlin.resolve.lazy.declarations.CliDeclarationProviderFactoryService +import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactoryService +import org.jetbrains.kotlin.serialization.DescriptorSerializerPlugin +import org.jetbrains.kotlin.utils.PathUtil +import java.io.File +import java.nio.file.FileSystems +import java.util.zip.ZipFile + +class KotlinCoreEnvironment private constructor( + val projectEnvironment: JavaCoreProjectEnvironment, + private val initialConfiguration: CompilerConfiguration, + configFiles: EnvironmentConfigFiles +) { + + class ProjectEnvironment( + disposable: Disposable, + applicationEnvironment: KotlinCoreApplicationEnvironment + ) : + KotlinCoreProjectEnvironment(disposable, applicationEnvironment) { + + private var extensionRegistered = false + + override fun preregisterServices() { + registerProjectExtensionPoints(project.extensionArea) + } + + fun registerExtensionsFromPlugins(configuration: CompilerConfiguration) { + if (!extensionRegistered) { + registerPluginExtensionPoints(project) + registerExtensionsFromPlugins(project, configuration) + extensionRegistered = true + } + } + + override fun registerJavaPsiFacade() { + with(project) { + registerService( + CoreJavaFileManager::class.java, + ServiceManager.getService(this, JavaFileManager::class.java) as CoreJavaFileManager + ) + + registerKotlinLightClassSupport(project) + + registerService(ExternalAnnotationsManager::class.java, MockExternalAnnotationsManager()) + registerService(InferredAnnotationsManager::class.java, MockInferredAnnotationsManager()) + } + + super.registerJavaPsiFacade() + } + } + + private val sourceFiles = mutableListOf() + private val rootsIndex: JvmDependenciesDynamicCompoundIndex + private val packagePartProviders = mutableListOf() + + private val classpathRootsResolver: ClasspathRootsResolver + private val initialRoots = ArrayList() + + val configuration: CompilerConfiguration = initialConfiguration.apply { setupJdkClasspathRoots(configFiles) }.copy() + + init { + PersistentFSConstants::class.java.getDeclaredField("ourMaxIntellisenseFileSize") + .apply { isAccessible = true } + .setInt(null, FileUtilRt.LARGE_FOR_CONTENT_LOADING) + + val project = projectEnvironment.project + + val messageCollector = configuration.get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY) + + (projectEnvironment as? ProjectEnvironment)?.registerExtensionsFromPlugins(configuration) + // otherwise consider that project environment is properly configured before passing to the environment + // TODO: consider some asserts to check important extension points + + project.registerService(DeclarationProviderFactoryService::class.java, CliDeclarationProviderFactoryService(sourceFiles)) + + val isJvm = configFiles == EnvironmentConfigFiles.JVM_CONFIG_FILES + project.registerService(ModuleVisibilityManager::class.java, CliModuleVisibilityManagerImpl(isJvm)) + + registerProjectServicesForCLI(projectEnvironment) + + registerProjectServices(projectEnvironment.project) + + for (extension in CompilerConfigurationExtension.getInstances(project)) { + extension.updateConfiguration(configuration) + } + + sourceFiles += createKtFiles(project) + + collectAdditionalSources(project) + + sourceFiles.sortBy { it.virtualFile.path } + + val jdkHome = configuration.get(JVMConfigurationKeys.JDK_HOME) + val jrtFileSystem = VirtualFileManager.getInstance().getFileSystem(StandardFileSystems.JRT_PROTOCOL) + val javaModuleFinder = CliJavaModuleFinder(jdkHome?.path?.let { path -> + jrtFileSystem?.findFileByPath(path + URLUtil.JAR_SEPARATOR) + }) + + val outputDirectory = + configuration.get(JVMConfigurationKeys.MODULES)?.singleOrNull()?.getOutputDirectory() + ?: configuration.get(JVMConfigurationKeys.OUTPUT_DIRECTORY)?.absolutePath + + classpathRootsResolver = ClasspathRootsResolver( + PsiManager.getInstance(project), + messageCollector, + configuration.getList(JVMConfigurationKeys.ADDITIONAL_JAVA_MODULES), + this::contentRootToVirtualFile, + javaModuleFinder, + !configuration.getBoolean(CLIConfigurationKeys.ALLOW_KOTLIN_PACKAGE), + outputDirectory?.let(this::findLocalFile) + ) + + val (initialRoots, javaModules) = + classpathRootsResolver.convertClasspathRoots(configuration.getList(CLIConfigurationKeys.CONTENT_ROOTS)) + this.initialRoots.addAll(initialRoots) + + if (!configuration.getBoolean(JVMConfigurationKeys.SKIP_RUNTIME_VERSION_CHECK) && messageCollector != null) { + JvmRuntimeVersionsConsistencyChecker.checkCompilerClasspathConsistency( + messageCollector, + configuration, + initialRoots.mapNotNull { (file, type) -> if (type == JavaRoot.RootType.BINARY) file else null } + ) + } + + val (roots, singleJavaFileRoots) = + initialRoots.partition { (file) -> file.isDirectory || file.extension != JavaFileType.DEFAULT_EXTENSION } + + // REPL and kapt2 update classpath dynamically + rootsIndex = JvmDependenciesDynamicCompoundIndex().apply { + addIndex(JvmDependenciesIndexImpl(roots)) + updateClasspathFromRootsIndex(this) + } + + (ServiceManager.getService(project, CoreJavaFileManager::class.java) as KotlinCliJavaFileManagerImpl).initialize( + rootsIndex, + packagePartProviders, + SingleJavaFileRootsIndex(singleJavaFileRoots), + configuration.getBoolean(JVMConfigurationKeys.USE_PSI_CLASS_FILES_READING) + ) + + project.registerService( + JavaModuleResolver::class.java, + CliJavaModuleResolver(classpathRootsResolver.javaModuleGraph, javaModules, javaModuleFinder.systemModules.toList()) + ) + + val finderFactory = CliVirtualFileFinderFactory(rootsIndex) + project.registerService(MetadataFinderFactory::class.java, finderFactory) + project.registerService(VirtualFileFinderFactory::class.java, finderFactory) + + project.putUserData(APPEND_JAVA_SOURCE_ROOTS_HANDLER_KEY, fun(roots: List) { + updateClasspath(roots.map { JavaSourceRoot(it, null) }) + }) + } + + private fun collectAdditionalSources(project: MockProject) { + var unprocessedSources: Collection = sourceFiles + val processedSources = HashSet() + val processedSourcesByExtension = HashMap>() + // repeat feeding extensions with sources while new sources a being added + var sourceCollectionIterations = 0 + while (unprocessedSources.isNotEmpty()) { + if (sourceCollectionIterations++ > 10) { // TODO: consider using some appropriate global constant + throw IllegalStateException("Unable to collect additional sources in reasonable number of iterations") + } + processedSources.addAll(unprocessedSources) + val allNewSources = ArrayList() + for (extension in CollectAdditionalSourcesExtension.getInstances(project)) { + // do not feed the extension with the sources it returned on the previous iteration + val sourcesToProcess = unprocessedSources - (processedSourcesByExtension[extension] ?: emptyList()) + val newSources = extension.collectAdditionalSourcesAndUpdateConfiguration(sourcesToProcess, configuration, project) + if (newSources.isNotEmpty()) { + allNewSources.addAll(newSources) + processedSourcesByExtension[extension] = newSources + } + } + unprocessedSources = allNewSources.filterNot { processedSources.contains(it) }.distinct() + sourceFiles += unprocessedSources + } + } + + fun addKotlinSourceRoots(rootDirs: List) { + val roots = rootDirs.map { KotlinSourceRoot(it.absolutePath, isCommon = false) } + sourceFiles += createSourceFilesFromSourceRoots(configuration, project, roots) + } + + fun createPackagePartProvider(scope: GlobalSearchScope): JvmPackagePartProvider { + return JvmPackagePartProvider(configuration.languageVersionSettings, scope).apply { + addRoots(initialRoots, configuration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY)) + packagePartProviders += this + (ModuleAnnotationsResolver.getInstance(project) as CliModuleAnnotationsResolver).addPackagePartProvider(this) + } + } + + private val VirtualFile.javaFiles: List + get() = mutableListOf().apply { + VfsUtilCore.processFilesRecursively(this@javaFiles) { file -> + if (file.fileType == JavaFileType.INSTANCE) { + add(file) + } + true + } + } + + private val allJavaFiles: List + get() = configuration.javaSourceRoots + .mapNotNull(this::findLocalFile) + .flatMap { it.javaFiles } + .map { File(it.canonicalPath) } + + fun registerJavac( + javaFiles: List = allJavaFiles, + kotlinFiles: List = sourceFiles, + arguments: Array? = null, + bootClasspath: List? = null, + sourcePath: List? = null + ): Boolean { + return JavacWrapperRegistrar.registerJavac( + projectEnvironment.project, configuration, javaFiles, kotlinFiles, arguments, bootClasspath, sourcePath, + LightClassGenerationSupport.getInstance(project), packagePartProviders + ) + } + + private val applicationEnvironment: CoreApplicationEnvironment + get() = projectEnvironment.environment + + val project: Project + get() = projectEnvironment.project + + internal fun countLinesOfCode(sourceFiles: List): Int = + sourceFiles.sumBy { sourceFile -> + val text = sourceFile.text + StringUtil.getLineBreakCount(text) + (if (StringUtil.endsWithLineBreak(text)) 0 else 1) + } + + private fun updateClasspathFromRootsIndex(index: JvmDependenciesIndex) { + index.indexedRoots.forEach { + projectEnvironment.addSourcesToClasspath(it.file) + } + } + + fun updateClasspath(contentRoots: List): List? { + // TODO: add new Java modules to CliJavaModuleResolver + val newRoots = classpathRootsResolver.convertClasspathRoots(contentRoots).roots + + if (packagePartProviders.isEmpty()) { + initialRoots.addAll(newRoots) + } else { + for (packagePartProvider in packagePartProviders) { + packagePartProvider.addRoots(newRoots, configuration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY)) + } + } + + return rootsIndex.addNewIndexForRoots(newRoots)?.let { newIndex -> + updateClasspathFromRootsIndex(newIndex) + newIndex.indexedRoots.mapNotNull { (file) -> + VfsUtilCore.virtualToIoFile(VfsUtilCore.getVirtualFileForJar(file) ?: file) + }.toList() + }.orEmpty() + } + + private fun contentRootToVirtualFile(root: JvmContentRoot): VirtualFile? = + when (root) { + is JvmClasspathRoot -> + if (root.file.isFile) findJarRoot(root.file) else findExistingRoot(root, "Classpath entry") + is JvmModulePathRoot -> + if (root.file.isFile) findJarRoot(root.file) else findExistingRoot(root, "Java module root") + is JavaSourceRoot -> + findExistingRoot(root, "Java source root") + else -> + throw IllegalStateException("Unexpected root: $root") + } + + internal fun findLocalFile(path: String): VirtualFile? = + applicationEnvironment.localFileSystem.findFileByPath(path) + + private fun findExistingRoot(root: JvmContentRoot, rootDescription: String): VirtualFile? { + return findLocalFile(root.file.absolutePath).also { + if (it == null) { + report(STRONG_WARNING, "$rootDescription points to a non-existent location: ${root.file}") + } + } + } + + private fun findJarRoot(file: File): VirtualFile? = + applicationEnvironment.jarFileSystem.findFileByPath("$file${URLUtil.JAR_SEPARATOR}") + + private fun getSourceRootsCheckingForDuplicates(): List { + val uniqueSourceRoots = hashSetOf() + val result = mutableListOf() + + for (root in configuration.kotlinSourceRoots) { + if (!uniqueSourceRoots.add(root.path)) { + report(STRONG_WARNING, "Duplicate source root: ${root.path}") + } + result.add(root) + } + + return result + } + + fun getSourceFiles(): List = sourceFiles + + private fun createKtFiles(project: Project): List = + createSourceFilesFromSourceRoots(configuration, project, getSourceRootsCheckingForDuplicates()) + + internal fun report(severity: CompilerMessageSeverity, message: String) = configuration.report(severity, message) + + companion object { + private val LOG = Logger.getInstance(KotlinCoreEnvironment::class.java) + + private val APPLICATION_LOCK = Object() + private var ourApplicationEnvironment: KotlinCoreApplicationEnvironment? = null + private var ourProjectCount = 0 + + @JvmStatic + fun createForProduction( + parentDisposable: Disposable, configuration: CompilerConfiguration, configFiles: EnvironmentConfigFiles + ): KotlinCoreEnvironment { + setupIdeaStandaloneExecution() + val appEnv = getOrCreateApplicationEnvironmentForProduction(parentDisposable, configuration) + val projectEnv = ProjectEnvironment(parentDisposable, appEnv) + val environment = KotlinCoreEnvironment(projectEnv, configuration, configFiles) + + synchronized(APPLICATION_LOCK) { + ourProjectCount++ + } + return environment + } + + @JvmStatic + fun createForProduction( + projectEnvironment: JavaCoreProjectEnvironment, configuration: CompilerConfiguration, configFiles: EnvironmentConfigFiles + ): KotlinCoreEnvironment { + val environment = KotlinCoreEnvironment(projectEnvironment, configuration, configFiles) + + if (projectEnvironment.environment == applicationEnvironment) { + // accounting for core environment disposing + synchronized(APPLICATION_LOCK) { + ourProjectCount++ + } + } + return environment + } + + @TestOnly + @JvmStatic + fun createForTests( + parentDisposable: Disposable, initialConfiguration: CompilerConfiguration, extensionConfigs: EnvironmentConfigFiles + ): KotlinCoreEnvironment { + val configuration = initialConfiguration.copy() + // Tests are supposed to create a single project and dispose it right after use + val appEnv = createApplicationEnvironment(parentDisposable, configuration, unitTestMode = true) + val projectEnv = ProjectEnvironment(parentDisposable, appEnv) + return KotlinCoreEnvironment(projectEnv, configuration, extensionConfigs) + } + + // used in the daemon for jar cache cleanup + val applicationEnvironment: KotlinCoreApplicationEnvironment? get() = ourApplicationEnvironment + + fun getOrCreateApplicationEnvironmentForProduction( + parentDisposable: Disposable, configuration: CompilerConfiguration + ): KotlinCoreApplicationEnvironment { + synchronized(APPLICATION_LOCK) { + if (ourApplicationEnvironment == null) { + val disposable = Disposer.newDisposable() + ourApplicationEnvironment = createApplicationEnvironment(disposable, configuration, unitTestMode = false) + ourProjectCount = 0 + Disposer.register(disposable, Disposable { + synchronized(APPLICATION_LOCK) { + ourApplicationEnvironment = null + } + }) + } + // Disposing of the environment is unsafe in production then parallel builds are enabled, but turning it off universally + // breaks a lot of tests, therefore it is disabled for production and enabled for tests + if (System.getProperty(KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY).toBooleanLenient() != true) { + // JPS may run many instances of the compiler in parallel (there's an option for compiling independent modules in parallel in IntelliJ) + // All projects share the same ApplicationEnvironment, and when the last project is disposed, the ApplicationEnvironment is disposed as well + @Suppress("ObjectLiteralToLambda") // Disposer tree depends on identity of disposables. + Disposer.register(parentDisposable, object : Disposable { + override fun dispose() { + synchronized(APPLICATION_LOCK) { + if (--ourProjectCount <= 0) { + disposeApplicationEnvironment() + } + } + } + }) + } + + return ourApplicationEnvironment!! + } + } + + /** + * This method is also used in Gradle after configuration phase finished. + */ + fun disposeApplicationEnvironment() { + synchronized(APPLICATION_LOCK) { + val environment = ourApplicationEnvironment ?: return + ourApplicationEnvironment = null + Disposer.dispose(environment.parentDisposable) + ZipHandler.clearFileAccessorCache() + } + } + + private fun createApplicationEnvironment( + parentDisposable: Disposable, configuration: CompilerConfiguration, unitTestMode: Boolean + ): KotlinCoreApplicationEnvironment { + val applicationEnvironment = KotlinCoreApplicationEnvironment.create(parentDisposable, unitTestMode) + + registerApplicationExtensionPointsAndExtensionsFrom(configuration, "extensions/compiler.xml") + // FIX ME WHEN BUNCH 202 REMOVED: this code is required to support compiler bundled to both 202 and 203. + // Please, remove "com.intellij.psi.classFileDecompiler" EP registration once 202 is no longer supported by the compiler + if (!Extensions.getRootArea().hasExtensionPoint("com.intellij.psi.classFileDecompiler")) { + registerApplicationExtensionPointsAndExtensionsFrom(configuration, "extensions/core.xml") + } + + registerApplicationServicesForCLI(applicationEnvironment) + registerApplicationServices(applicationEnvironment) + + return applicationEnvironment + } + + private fun registerApplicationExtensionPointsAndExtensionsFrom(configuration: CompilerConfiguration, configFilePath: String) { + fun File.hasConfigFile(configFile: String): Boolean = + if (isDirectory) File(this, "META-INF" + File.separator + configFile).exists() + else try { + ZipFile(this).use { + it.getEntry("META-INF/$configFile") != null + } + } catch (e: Throwable) { + false + } + + val pluginRoot: File = + configuration.get(CLIConfigurationKeys.INTELLIJ_PLUGIN_ROOT)?.let(::File) + ?: PathUtil.getResourcePathForClass(this::class.java).takeIf { it.hasConfigFile(configFilePath) } + // hack for load extensions when compiler run directly from project directory (e.g. in tests) + ?: File("compiler/cli/cli-common/resources").takeIf { it.hasConfigFile(configFilePath) } + ?: throw IllegalStateException( + "Unable to find extension point configuration $configFilePath " + + "(cp:\n ${(Thread.currentThread().contextClassLoader as? UrlClassLoader)?.urls?.joinToString("\n ") { it.file }})" + ) + + CoreApplicationEnvironment.registerExtensionPointAndExtensions( + FileSystems.getDefault().getPath(pluginRoot.path), + configFilePath, + Extensions.getRootArea() + ) + } + + @JvmStatic + @Suppress("MemberVisibilityCanPrivate") // made public for CLI Android Lint + fun registerPluginExtensionPoints(project: MockProject) { + ExpressionCodegenExtension.registerExtensionPoint(project) + SyntheticResolveExtension.registerExtensionPoint(project) + ClassBuilderInterceptorExtension.registerExtensionPoint(project) + AnalysisHandlerExtension.registerExtensionPoint(project) + PackageFragmentProviderExtension.registerExtensionPoint(project) + StorageComponentContainerContributor.registerExtensionPoint(project) + DeclarationAttributeAltererExtension.registerExtensionPoint(project) + PreprocessedVirtualFileFactoryExtension.registerExtensionPoint(project) + JsSyntheticTranslateExtension.registerExtensionPoint(project) + CompilerConfigurationExtension.registerExtensionPoint(project) + CollectAdditionalSourcesExtension.registerExtensionPoint(project) + ExtraImportsProviderExtension.registerExtensionPoint(project) + IrGenerationExtension.registerExtensionPoint(project) + ScriptEvaluationExtension.registerExtensionPoint(project) + ShellExtension.registerExtensionPoint(project) + TypeResolutionInterceptor.registerExtensionPoint(project) + CandidateInterceptor.registerExtensionPoint(project) + DescriptorSerializerPlugin.registerExtensionPoint(project) + } + + internal fun registerExtensionsFromPlugins(project: MockProject, configuration: CompilerConfiguration) { + val messageCollector = configuration.get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY) + for (registrar in configuration.getList(ComponentRegistrar.PLUGIN_COMPONENT_REGISTRARS)) { + try { + registrar.registerProjectComponents(project, configuration) + } catch (e: AbstractMethodError) { + val message = "The provided plugin ${registrar.javaClass.name} is not compatible with this version of compiler" + // Since the scripting plugin is often discovered in the compiler environment, it is often taken from the incompatible + // location, and in many cases this is not a fatal error, therefore strong warning is generated instead of exception + if (registrar.javaClass.simpleName == "ScriptingCompilerConfigurationComponentRegistrar") { + messageCollector?.report(STRONG_WARNING, "Default scripting plugin is disabled: $message") + } else { + throw IllegalStateException(message, e) + } + } + } + } + + + private fun registerApplicationServicesForCLI(applicationEnvironment: KotlinCoreApplicationEnvironment) { + // ability to get text from annotations xml files + applicationEnvironment.registerFileType(PlainTextFileType.INSTANCE, "xml") + applicationEnvironment.registerParserDefinition(JavaParserDefinition()) + } + + // made public for Upsource + @Suppress("MemberVisibilityCanBePrivate") + @JvmStatic + fun registerApplicationServices(applicationEnvironment: KotlinCoreApplicationEnvironment) { + with(applicationEnvironment) { + registerFileType(KotlinFileType.INSTANCE, "kt") + registerFileType(KotlinFileType.INSTANCE, KotlinParserDefinition.STD_SCRIPT_SUFFIX) + registerParserDefinition(KotlinParserDefinition()) + application.registerService(KotlinBinaryClassCache::class.java, KotlinBinaryClassCache()) + application.registerService(JavaClassSupers::class.java, JavaClassSupersImpl::class.java) + application.registerService(TransactionGuard::class.java, TransactionGuardImpl::class.java) + } + } + + @JvmStatic + fun registerProjectExtensionPoints(area: ExtensionsArea) { + CoreApplicationEnvironment.registerExtensionPoint( + area, PsiTreeChangePreprocessor.EP.name, PsiTreeChangePreprocessor::class.java + ) + CoreApplicationEnvironment.registerExtensionPoint(area, PsiElementFinder.EP.name, PsiElementFinder::class.java) + + IdeaExtensionPoints.registerVersionSpecificProjectExtensionPoints(area) + } + + // made public for Upsource + @JvmStatic + @Deprecated("Use registerProjectServices(project) instead.", ReplaceWith("registerProjectServices(projectEnvironment.project)")) + fun registerProjectServices( + projectEnvironment: JavaCoreProjectEnvironment, + @Suppress("UNUSED_PARAMETER") messageCollector: MessageCollector? + ) { + registerProjectServices(projectEnvironment.project) + } + + // made public for Android Lint + @JvmStatic + fun registerProjectServices(project: MockProject) { + with(project) { + registerService(KotlinJavaPsiFacade::class.java, KotlinJavaPsiFacade(this)) + registerService(FacadeCache::class.java, FacadeCache(this)) + registerService(ModuleAnnotationsResolver::class.java, CliModuleAnnotationsResolver()) + } + } + + private fun registerProjectServicesForCLI(@Suppress("UNUSED_PARAMETER") projectEnvironment: JavaCoreProjectEnvironment) { + /** + * Note that Kapt may restart code analysis process, and CLI services should be aware of that. + * Use PsiManager.getModificationTracker() to ensure that all the data you cached is still valid. + */ + } + + // made public for Android Lint + @JvmStatic + fun registerKotlinLightClassSupport(project: MockProject) { + with(project) { + val traceHolder = CliTraceHolder() + val cliLightClassGenerationSupport = CliLightClassGenerationSupport(traceHolder, project) + val kotlinAsJavaSupport = CliKotlinAsJavaSupport(this, traceHolder) + registerService(LightClassGenerationSupport::class.java, cliLightClassGenerationSupport) + registerService(CliLightClassGenerationSupport::class.java, cliLightClassGenerationSupport) + registerService(KotlinAsJavaSupport::class.java, kotlinAsJavaSupport) + registerService(CodeAnalyzerInitializer::class.java, traceHolder) + + // We don't pass Disposable because in some tests, we manually unregister these extensions, and that leads to LOG.error + // exception from `ExtensionPointImpl.doRegisterExtension`, because the registered extension can no longer be found + // when the project is being disposed. + // For example, see the `unregisterExtension` call in `GenerationUtils.compileFilesUsingFrontendIR`. + // TODO: refactor this to avoid registering unneeded extensions in the first place, and avoid using deprecated API. + @Suppress("DEPRECATION") + PsiElementFinder.EP.getPoint(project).registerExtension(JavaElementFinder(this, kotlinAsJavaSupport)) + @Suppress("DEPRECATION") + PsiElementFinder.EP.getPoint(project).registerExtension(PsiElementFinderImpl(this)) + } + } + + private fun CompilerConfiguration.setupJdkClasspathRoots(configFiles: EnvironmentConfigFiles) { + if (getBoolean(JVMConfigurationKeys.NO_JDK)) return + + val jvmTarget = configFiles == EnvironmentConfigFiles.JVM_CONFIG_FILES + if (!jvmTarget) return + + val jdkHome = get(JVMConfigurationKeys.JDK_HOME) + val (javaRoot, classesRoots) = if (jdkHome == null) { + val javaHome = File(System.getProperty("java.home")) + put(JVMConfigurationKeys.JDK_HOME, javaHome) + + javaHome to PathUtil.getJdkClassesRootsFromCurrentJre() + } else { + jdkHome to PathUtil.getJdkClassesRoots(jdkHome) + } + + if (!CoreJrtFileSystem.isModularJdk(javaRoot)) { + if (classesRoots.isEmpty()) { + report(ERROR, "No class roots are found in the JDK path: $javaRoot") + } else { + addJvmSdkRoots(classesRoots) + } + } + } + } +} diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ClassCodegen.kt.201 b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ClassCodegen.kt.201 new file mode 100644 index 00000000000..f27ad043172 --- /dev/null +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ClassCodegen.kt.201 @@ -0,0 +1,496 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.backend.jvm.codegen + +import org.jetbrains.kotlin.backend.jvm.JvmBackendContext +import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin +import org.jetbrains.kotlin.backend.jvm.lower.MultifileFacadeFileEntry +import org.jetbrains.kotlin.backend.jvm.lower.buildAssertionsDisabledField +import org.jetbrains.kotlin.backend.jvm.lower.hasAssertionsDisabledField +import org.jetbrains.kotlin.codegen.DescriptorAsmUtil +import org.jetbrains.kotlin.codegen.inline.* +import org.jetbrains.kotlin.codegen.writeKotlinMetadata +import org.jetbrains.kotlin.config.LanguageFeature +import org.jetbrains.kotlin.config.LanguageVersionSettings +import org.jetbrains.kotlin.descriptors.DescriptorVisibilities +import org.jetbrains.kotlin.descriptors.DescriptorVisibility +import org.jetbrains.kotlin.descriptors.Modality +import org.jetbrains.kotlin.ir.builders.declarations.addFunction +import org.jetbrains.kotlin.ir.declarations.* +import org.jetbrains.kotlin.ir.descriptors.toIrBasedDescriptor +import org.jetbrains.kotlin.ir.expressions.IrBlockBody +import org.jetbrains.kotlin.ir.expressions.IrConst +import org.jetbrains.kotlin.ir.expressions.IrExpression +import org.jetbrains.kotlin.ir.expressions.IrFunctionReference +import org.jetbrains.kotlin.ir.expressions.impl.IrBlockBodyImpl +import org.jetbrains.kotlin.ir.expressions.impl.IrSetFieldImpl +import org.jetbrains.kotlin.ir.util.* +import org.jetbrains.kotlin.load.java.JvmAnnotationNames +import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader +import org.jetbrains.kotlin.metadata.jvm.serialization.JvmStringTable +import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.protobuf.MessageLite +import org.jetbrains.kotlin.resolve.jvm.annotations.JVM_RECORD_ANNOTATION_FQ_NAME +import org.jetbrains.kotlin.resolve.jvm.annotations.JVM_SYNTHETIC_ANNOTATION_FQ_NAME +import org.jetbrains.kotlin.resolve.jvm.annotations.TRANSIENT_ANNOTATION_FQ_NAME +import org.jetbrains.kotlin.resolve.jvm.annotations.VOLATILE_ANNOTATION_FQ_NAME +import org.jetbrains.kotlin.resolve.jvm.checkers.JvmSimpleNameBacktickChecker +import org.jetbrains.kotlin.resolve.jvm.diagnostics.* +import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmClassSignature +import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull +import org.jetbrains.kotlin.utils.addToStdlib.safeAs +import org.jetbrains.org.objectweb.asm.* +import org.jetbrains.org.objectweb.asm.commons.Method +import org.jetbrains.org.objectweb.asm.tree.MethodNode +import java.io.File + +interface MetadataSerializer { + fun serialize(metadata: MetadataSource): Pair? + fun bindMethodMetadata(metadata: MetadataSource.Property, signature: Method) + fun bindMethodMetadata(metadata: MetadataSource.Function, signature: Method) + fun bindFieldMetadata(metadata: MetadataSource.Property, signature: Pair) +} + +class ClassCodegen private constructor( + val irClass: IrClass, + val context: JvmBackendContext, + private val parentFunction: IrFunction?, +) : InnerClassConsumer { + private val parentClassCodegen = (parentFunction?.parentAsClass ?: irClass.parent as? IrClass)?.let { getOrCreate(it, context) } + private val withinInline: Boolean = parentClassCodegen?.withinInline == true || parentFunction?.isInline == true + + private val state get() = context.state + private val typeMapper get() = context.typeMapper + + val type: Type = typeMapper.mapClass(irClass) + + val reifiedTypeParametersUsages = ReifiedTypeParametersUsages() + + private val jvmSignatureClashDetector = JvmSignatureClashDetector(irClass, type, context) + + private val classOrigin = irClass.descriptorOrigin + + private val visitor = state.factory.newVisitor(classOrigin, type, irClass.fileParent.loadSourceFilesInfo()).apply { + val signature = typeMapper.mapClassSignature(irClass, type) + // Ensure that the backend only produces class names that would be valid in the frontend for JVM. + if (context.state.classBuilderMode.generateBodies && signature.hasInvalidName()) { + throw IllegalStateException("Generating class with invalid name '${type.className}': ${irClass.dump()}") + } + defineClass( + irClass.psiElement, + state.classFileVersion, + irClass.flags, + signature.name, + signature.javaGenericSignature, + signature.superclassName, + signature.interfaces.toTypedArray() + ) + } + + // TODO: the order of entries in this set depends on the order in which methods are generated; this means it is unstable + // under incremental compilation, as calls to `inline fun`s declared in this class cause them to be generated out of order. + private val innerClasses = linkedSetOf() + + // TODO: the names produced by generators in this map depend on the order in which methods are generated; see above. + private val regeneratedObjectNameGenerators = mutableMapOf() + + fun getRegeneratedObjectNameGenerator(function: IrFunction): NameGenerator { + val name = if (function.name.isSpecial) "special" else function.name.asString() + return regeneratedObjectNameGenerators.getOrPut(name) { + NameGenerator("${type.internalName}\$$name\$\$inlined") + } + } + + private var generated = false + + fun generate() { + // TODO: reject repeated generate() calls; currently, these can happen for objects in finally + // blocks since they are `accept`ed once per each CFG edge out of the try-finally. + if (generated) return + generated = true + + // We remove reads of `$$delegatedProperties` (and the field itself) if they are not in fact used for anything. + val delegatedProperties = irClass.fields.singleOrNull { it.origin == JvmLoweredDeclarationOrigin.GENERATED_PROPERTY_REFERENCE } + val delegatedPropertyOptimizer = if (delegatedProperties != null) DelegatedPropertyOptimizer() else null + // Generating a method node may cause the addition of a field with an initializer if an inline function + // call uses `assert` and the JVM assertions mode is enabled. To avoid concurrent modification errors, + // there is a very specific generation order. + val smap = context.getSourceMapper(irClass) + // 1. Any method other than `` can add a field and a `` statement: + for (method in irClass.declarations.filterIsInstance()) { + if (method.name.asString() != "") { + generateMethod(method, smap, delegatedPropertyOptimizer) + } + } + // 2. `` itself can add a field, but the statement is generated via the `return init` hack: + irClass.functions.find { it.name.asString() == "" }?.let { generateMethod(it, smap, delegatedPropertyOptimizer) } + // 3. Now we have all the fields (`$$delegatedProperties` might be redundant if all reads were optimized out): + for (field in irClass.fields) { + if (field !== delegatedProperties || delegatedPropertyOptimizer?.needsDelegatedProperties == true) { + generateField(field) + } + } + // 4. Generate nested classes at the end, to ensure that when the companion's metadata is serialized + // everything moved to the outer class has already been recorded in `globalSerializationBindings`. + for (declaration in irClass.declarations) { + if (declaration is IrClass) { + getOrCreate(declaration, context).generate() + } + } + + object : AnnotationCodegen(this@ClassCodegen, context) { + override fun visitAnnotation(descr: String?, visible: Boolean): AnnotationVisitor { + return visitor.visitor.visitAnnotation(descr, visible) + } + }.genAnnotations(irClass, null, null) + generateKotlinMetadataAnnotation() + + generateInnerAndOuterClasses() + + if (withinInline || !smap.isTrivial) { + visitor.visitSMAP(smap, !context.state.languageVersionSettings.supportsFeature(LanguageFeature.CorrectSourceMappingSyntax)) + } else { + smap.sourceInfo!!.sourceFileName?.let { + visitor.visitSource(it, null) + } + } + + visitor.done() + jvmSignatureClashDetector.reportErrors(classOrigin) + } + + fun generateAssertFieldIfNeeded(generatingClInit: Boolean): IrExpression? { + if (irClass.hasAssertionsDisabledField(context)) + return null + val topLevelClass = generateSequence(this) { it.parentClassCodegen }.last().irClass + val field = irClass.buildAssertionsDisabledField(context, topLevelClass) + generateField(field) + // Normally, `InitializersLowering` would move the initializer to , but + // it's obviously too late for that. + val init = IrSetFieldImpl( + field.startOffset, field.endOffset, field.symbol, null, + field.initializer!!.expression, context.irBuiltIns.unitType + ) + if (generatingClInit) { + // Too late to modify the IR; have to ask the currently active `ExpressionCodegen` + // to generate this statement directly. + return init + } + val classInitializer = irClass.functions.singleOrNull { it.name.asString() == "" } ?: irClass.addFunction { + name = Name.special("") + returnType = context.irBuiltIns.unitType + }.apply { + body = IrBlockBodyImpl(startOffset, endOffset) + } + (classInitializer.body as IrBlockBody).statements.add(0, init) + return null + } + + private val metadataSerializer: MetadataSerializer = + context.serializerFactory(context, irClass, type, visitor.serializationBindings, parentClassCodegen?.metadataSerializer) + + private fun generateKotlinMetadataAnnotation() { + // TODO: if `-Xmultifile-parts-inherit` is enabled, write the corresponding flag for parts and facades to [Metadata.extraInt]. + var extraFlags = JvmAnnotationNames.METADATA_JVM_IR_FLAG + if (state.isIrWithStableAbi) { + extraFlags += JvmAnnotationNames.METADATA_JVM_IR_STABLE_ABI_FLAG + } + + val facadeClassName = context.multifileFacadeForPart[irClass.attributeOwnerId] + val metadata = irClass.metadata + val entry = irClass.fileParent.fileEntry + val kind = when { + facadeClassName != null -> KotlinClassHeader.Kind.MULTIFILE_CLASS_PART + metadata is MetadataSource.Class -> KotlinClassHeader.Kind.CLASS + metadata is MetadataSource.File -> KotlinClassHeader.Kind.FILE_FACADE + metadata is MetadataSource.Function -> KotlinClassHeader.Kind.SYNTHETIC_CLASS + entry is MultifileFacadeFileEntry -> KotlinClassHeader.Kind.MULTIFILE_CLASS + else -> KotlinClassHeader.Kind.SYNTHETIC_CLASS + } + writeKotlinMetadata(visitor, state, kind, extraFlags) { + if (metadata != null) { + metadataSerializer.serialize(metadata)?.let { (proto, stringTable) -> + DescriptorAsmUtil.writeAnnotationData(it, proto, stringTable) + } + } + + if (entry is MultifileFacadeFileEntry) { + val arv = it.visitArray(JvmAnnotationNames.METADATA_DATA_FIELD_NAME) + for (partFile in entry.partFiles) { + val fileClass = partFile.declarations.singleOrNull { it.isFileClass } as IrClass? + if (fileClass != null) arv.visit(null, typeMapper.mapClass(fileClass).internalName) + } + arv.visitEnd() + } + + if (facadeClassName != null) { + it.visit(JvmAnnotationNames.METADATA_MULTIFILE_CLASS_NAME_FIELD_NAME, facadeClassName.internalName) + } + + if (irClass in context.classNameOverride) { + val isFileClass = kind == KotlinClassHeader.Kind.MULTIFILE_CLASS || + kind == KotlinClassHeader.Kind.MULTIFILE_CLASS_PART || + kind == KotlinClassHeader.Kind.FILE_FACADE + assert(isFileClass) { "JvmPackageName is not supported for classes: ${irClass.render()}" } + it.visit(JvmAnnotationNames.METADATA_PACKAGE_NAME_FIELD_NAME, irClass.fqNameWhenAvailable!!.parent().asString()) + } + } + } + + private fun IrFile.loadSourceFilesInfo(): List { + val entry = fileEntry + if (entry is MultifileFacadeFileEntry) { + return entry.partFiles.flatMap { it.loadSourceFilesInfo() } + } + return listOfNotNull(context.psiSourceManager.getFileEntry(this)?.let { File(it.name) }) + } + + companion object { + fun getOrCreate( + irClass: IrClass, + context: JvmBackendContext, + // The `parentFunction` is only set for classes nested inside of functions. This is usually safe, since there is no + // way to refer to (inline) members of such a class from outside of the function unless the function in question is + // itself declared as inline. In that case, the function will be compiled before we can refer to the nested class. + // + // The one exception to this rule are anonymous objects defined as members of a class. These are nested inside of the + // class initializer, but can be referred to from anywhere within the scope of the class. That's why we have to ensure + // that all references to classes inside of have a non-null `parentFunction`. + parentFunction: IrFunction? = irClass.parent.safeAs()?.takeIf { + it.origin == JvmLoweredDeclarationOrigin.CLASS_STATIC_INITIALIZER + }, + ): ClassCodegen = + context.classCodegens.getOrPut(irClass) { ClassCodegen(irClass, context, parentFunction) }.also { + assert(parentFunction == null || it.parentFunction == parentFunction) { + "inconsistent parent function for ${irClass.render()}:\n" + + "New: ${parentFunction!!.render()}\n" + + "Old: ${it.parentFunction?.render()}" + } + } + + private fun JvmClassSignature.hasInvalidName() = + name.splitToSequence('/').any { identifier -> identifier.any { it in JvmSimpleNameBacktickChecker.INVALID_CHARS } } + } + + private fun generateField(field: IrField) { + val fieldType = typeMapper.mapType(field) + val fieldSignature = + if (field.origin == IrDeclarationOrigin.PROPERTY_DELEGATE) null + else context.methodSignatureMapper.mapFieldSignature(field) + val fieldName = field.name.asString() + val flags = field.computeFieldFlags(context, state.languageVersionSettings) + val fv = visitor.newField( + field.descriptorOrigin, flags, fieldName, fieldType.descriptor, + fieldSignature, (field.initializer?.expression as? IrConst<*>)?.value + ) + + jvmSignatureClashDetector.trackField(field, RawSignature(fieldName, fieldType.descriptor, MemberKind.FIELD)) + + if (field.origin != JvmLoweredDeclarationOrigin.CONTINUATION_CLASS_RESULT_FIELD) { + val skipNullabilityAnnotations = + flags and (Opcodes.ACC_SYNTHETIC or Opcodes.ACC_ENUM) != 0 || + field.origin == JvmLoweredDeclarationOrigin.FIELD_FOR_STATIC_CALLABLE_REFERENCE_INSTANCE + object : AnnotationCodegen(this@ClassCodegen, context, skipNullabilityAnnotations) { + override fun visitAnnotation(descr: String?, visible: Boolean): AnnotationVisitor { + return fv.visitAnnotation(descr, visible) + } + + override fun visitTypeAnnotation(descr: String?, path: TypePath?, visible: Boolean): AnnotationVisitor { + return fv.visitTypeAnnotation(TypeReference.newTypeReference(TypeReference.FIELD).value, path, descr, visible) + } + }.genAnnotations(field, fieldType, field.type) + } + + (field.metadata as? MetadataSource.Property)?.let { + metadataSerializer.bindFieldMetadata(it, fieldType to fieldName) + } + + if (irClass.hasAnnotation(JVM_RECORD_ANNOTATION_FQ_NAME) && !field.isStatic) { + // TODO: Write annotations to the component + // visitor.newRecordComponent(fieldName, fieldType.descriptor, fieldSignature) + } + } + + private val generatedInlineMethods = mutableMapOf() + + fun generateMethodNode(method: IrFunction): SMAPAndMethodNode { + if (!method.isInline && !method.isSuspendCapturingCrossinline()) { + // Inline methods can be used multiple times by `IrSourceCompilerForInline`, suspend methods + // are used twice (`f` and `f$$forInline`) if they capture crossinline lambdas, and everything + // else is only generated by `generateMethod` below so does not need caching. + // TODO: inline lambdas are not marked `isInline`, and are generally used once, but may be needed + // multiple times if declared in a `finally` block - should they be cached? + return FunctionCodegen(method, this).generate() + } + val (node, smap) = generatedInlineMethods.getOrPut(method) { FunctionCodegen(method, this).generate() } + val copy = with(node) { MethodNode(Opcodes.API_VERSION, access, name, desc, signature, exceptions.toTypedArray()) } + node.instructions.resetLabels() + node.accept(copy) + return SMAPAndMethodNode(copy, smap) + } + + private fun generateMethod(method: IrFunction, classSMAP: SourceMapper, delegatedPropertyOptimizer: DelegatedPropertyOptimizer?) { + if (method.isFakeOverride) { + jvmSignatureClashDetector.trackFakeOverrideMethod(method) + return + } + + val (node, smap) = generateMethodNode(method) + if (delegatedPropertyOptimizer != null) { + delegatedPropertyOptimizer.transform(node) + if (method.name.asString() == "") { + delegatedPropertyOptimizer.transformClassInitializer(node) + } + } + node.preprocessSuspendMarkers( + method.origin == JvmLoweredDeclarationOrigin.FOR_INLINE_STATE_MACHINE_TEMPLATE || method.isEffectivelyInlineOnly(), + method.origin == JvmLoweredDeclarationOrigin.FOR_INLINE_STATE_MACHINE_TEMPLATE_CAPTURES_CROSSINLINE + ) + val mv = with(node) { visitor.newMethod(method.descriptorOrigin, access, name, desc, signature, exceptions.toTypedArray()) } + val smapCopier = SourceMapCopier(classSMAP, smap) + val smapCopyingVisitor = object : MethodVisitor(Opcodes.API_VERSION, mv) { + override fun visitLineNumber(line: Int, start: Label) = + super.visitLineNumber(smapCopier.mapLineNumber(line), start) + } + if (method.hasContinuation()) { + // Generate a state machine within this method. The continuation class for it should be generated + // lazily so that if tail call optimization kicks in, the unused class will not be written to the output. + val continuationClass = method.continuationClass() // null if `SuspendLambda.invokeSuspend` - `this` is continuation itself + val continuationClassCodegen = lazy { if (continuationClass != null) getOrCreate(continuationClass, context, method) else this } + node.acceptWithStateMachine(method, this, smapCopyingVisitor) { continuationClassCodegen.value.visitor } + if (continuationClass != null && (continuationClassCodegen.isInitialized() || method.isSuspendCapturingCrossinline())) { + continuationClassCodegen.value.generate() + } + } else { + node.accept(smapCopyingVisitor) + } + jvmSignatureClashDetector.trackMethod(method, RawSignature(node.name, node.desc, MemberKind.METHOD)) + + when (val metadata = method.metadata) { + is MetadataSource.Property -> { + assert(method.origin == JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_OR_TYPEALIAS_ANNOTATIONS) { + "MetadataSource.Property on IrFunction should only be used for synthetic \$annotations methods: ${method.render()}" + } + metadataSerializer.bindMethodMetadata(metadata, Method(node.name, node.desc)) + } + is MetadataSource.Function -> metadataSerializer.bindMethodMetadata(metadata, Method(node.name, node.desc)) + null -> Unit + else -> error("Incorrect metadata source $metadata for:\n${method.dump()}") + } + } + + private fun generateInnerAndOuterClasses() { + // JVMS7 (4.7.6): a nested class or interface member will have InnerClasses information + // for each enclosing class and for each immediate member + parentClassCodegen?.innerClasses?.add(irClass) + for (codegen in generateSequence(this) { it.parentClassCodegen }.takeWhile { it.parentClassCodegen != null }) { + innerClasses.add(codegen.irClass) + } + + // JVMS7 (4.7.7): A class must have an EnclosingMethod attribute if and only if + // it is a local class or an anonymous class. + // + // The attribute contains the innermost class that encloses the declaration of + // the current class. If the current class is immediately enclosed by a method + // or constructor, the name and type of the function is recorded as well. + if (parentClassCodegen != null) { + // In case there's no primary constructor, it's unclear which constructor should be the enclosing one, so we select the first. + val enclosingFunction = if (irClass.attributeOwnerId in context.isEnclosedInConstructor) { + val containerClass = parentClassCodegen.irClass + containerClass.primaryConstructor + ?: containerClass.declarations.firstIsInstanceOrNull() + ?: error("Class in a non-static initializer found, but container has no constructors: ${containerClass.render()}") + } else parentFunction + if (enclosingFunction != null || irClass.isAnonymousObject) { + val method = enclosingFunction?.let(context.methodSignatureMapper::mapAsmMethod) + visitor.visitOuterClass(parentClassCodegen.type.internalName, method?.name, method?.descriptor) + } + } + + for (klass in innerClasses) { + val innerClass = typeMapper.classInternalName(klass) + val outerClass = + if (klass.attributeOwnerId in context.isEnclosedInConstructor) null + else klass.parent.safeAs()?.let(typeMapper::classInternalName) + val innerName = klass.name.takeUnless { it.isSpecial }?.asString() + visitor.visitInnerClass(innerClass, outerClass, innerName, klass.calculateInnerClassAccessFlags(context)) + } + } + + override fun addInnerClassInfoFromAnnotation(innerClass: IrClass) { + // It's necessary for proper recovering of classId by plain string JVM descriptor when loading annotations + // See FileBasedKotlinClass.convertAnnotationVisitor + generateSequence(innerClass) { it.parent as? IrDeclaration }.takeWhile { !it.isTopLevelDeclaration }.forEach { + if (it is IrClass) { + innerClasses.add(it) + } + } + } + + private val IrDeclaration.descriptorOrigin: JvmDeclarationOrigin + get() { + val psiElement = context.psiSourceManager.findPsiElement(this) + // For declarations inside lambdas, produce a descriptor which refers back to the original function. + // This is needed for plugins which check for lambdas inside of inline functions using the descriptor + // contained in JvmDeclarationOrigin. This matches the behavior of the JVM backend. + // TODO: this is really not very useful, as this does nothing for other anonymous objects. + val isLambda = irClass.origin == JvmLoweredDeclarationOrigin.LAMBDA_IMPL || + irClass.origin == JvmLoweredDeclarationOrigin.SUSPEND_LAMBDA + val descriptor = if (isLambda) + irClass.attributeOwnerId.safeAs()?.symbol?.owner?.toIrBasedDescriptor() ?: toIrBasedDescriptor() + else + toIrBasedDescriptor() + return if (origin == IrDeclarationOrigin.FILE_CLASS) + JvmDeclarationOrigin(JvmDeclarationOriginKind.PACKAGE_PART, psiElement, descriptor) + else + OtherOrigin(psiElement, descriptor) + } +} + +private val IrClass.flags: Int + get() = origin.flags or getVisibilityAccessFlagForClass() or + (if (isAnnotatedWithDeprecated) Opcodes.ACC_DEPRECATED else 0) or + (if (hasAnnotation(JVM_SYNTHETIC_ANNOTATION_FQ_NAME)) Opcodes.ACC_SYNTHETIC else 0) or + when { + isAnnotationClass -> Opcodes.ACC_ANNOTATION or Opcodes.ACC_INTERFACE or Opcodes.ACC_ABSTRACT + isInterface -> Opcodes.ACC_INTERFACE or Opcodes.ACC_ABSTRACT + isEnumClass -> Opcodes.ACC_ENUM or Opcodes.ACC_SUPER or modality.flags + else -> Opcodes.ACC_SUPER or modality.flags + } + +private fun IrField.computeFieldFlags(context: JvmBackendContext, languageVersionSettings: LanguageVersionSettings): Int = + origin.flags or visibility.flags or + (if (isDeprecatedCallable(context) || + correspondingPropertySymbol?.owner?.isDeprecatedCallable(context) == true + ) Opcodes.ACC_DEPRECATED else 0) or + (if (isFinal) Opcodes.ACC_FINAL else 0) or + (if (isStatic) Opcodes.ACC_STATIC else 0) or + (if (hasAnnotation(VOLATILE_ANNOTATION_FQ_NAME)) Opcodes.ACC_VOLATILE else 0) or + (if (hasAnnotation(TRANSIENT_ANNOTATION_FQ_NAME)) Opcodes.ACC_TRANSIENT else 0) or + (if (hasAnnotation(JVM_SYNTHETIC_ANNOTATION_FQ_NAME) || + isPrivateCompanionFieldInInterface(languageVersionSettings) + ) Opcodes.ACC_SYNTHETIC else 0) + +private fun IrField.isPrivateCompanionFieldInInterface(languageVersionSettings: LanguageVersionSettings): Boolean = + origin == IrDeclarationOrigin.FIELD_FOR_OBJECT_INSTANCE && + languageVersionSettings.supportsFeature(LanguageFeature.ProperVisibilityForCompanionObjectInstanceField) && + parentAsClass.isJvmInterface && + DescriptorVisibilities.isPrivate(parentAsClass.companionObject()!!.visibility) + +private val IrDeclarationOrigin.flags: Int + get() = (if (isSynthetic) Opcodes.ACC_SYNTHETIC else 0) or + (if (this == IrDeclarationOrigin.FIELD_FOR_ENUM_ENTRY) Opcodes.ACC_ENUM else 0) + +private val Modality.flags: Int + get() = when (this) { + Modality.ABSTRACT, Modality.SEALED -> Opcodes.ACC_ABSTRACT + Modality.FINAL -> Opcodes.ACC_FINAL + Modality.OPEN -> 0 + else -> throw AssertionError("Unsupported modality $this") + } + +private val DescriptorVisibility.flags: Int + get() = DescriptorAsmUtil.getVisibilityAccessFlag(this) ?: throw AssertionError("Unsupported visibility $this") diff --git a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt.201 b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt.201 new file mode 100644 index 00000000000..345cf8ac9c7 --- /dev/null +++ b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt.201 @@ -0,0 +1,148 @@ +/* + * Copyright 2010-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.load.java.structure.impl + +import com.intellij.openapi.diagnostic.Logger +import com.intellij.openapi.vfs.VirtualFile +import com.intellij.psi.PsiClass +import com.intellij.psi.PsiTypeParameter +import com.intellij.psi.search.SearchScope +import org.jetbrains.kotlin.asJava.KtLightClassMarker +import org.jetbrains.kotlin.asJava.isSyntheticValuesOrValueOfMethod +import org.jetbrains.kotlin.descriptors.Visibility +import org.jetbrains.kotlin.load.java.structure.* +import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.psi.KtPsiUtil + +class JavaClassImpl(psiClass: PsiClass) : JavaClassifierImpl(psiClass), VirtualFileBoundJavaClass, JavaAnnotationOwnerImpl, JavaModifierListOwnerImpl { + init { + assert(psiClass !is PsiTypeParameter) { "PsiTypeParameter should be wrapped in JavaTypeParameter, not JavaClass: use JavaClassifier.create()" } + } + + override val innerClassNames: Collection + get() = psi.innerClasses.mapNotNull { it.name?.takeIf(Name::isValidIdentifier)?.let(Name::identifier) } + + override fun findInnerClass(name: Name): JavaClass? { + return psi.findInnerClassByName(name.asString(), false)?.let(::JavaClassImpl) + } + + override val fqName: FqName? + get() { + val qualifiedName = psi.qualifiedName + return if (qualifiedName == null) null else FqName(qualifiedName) + } + + override val name: Name + get() = KtPsiUtil.safeName(psi.name) + + override val isInterface: Boolean + get() = psi.isInterface + + override val isAnnotationType: Boolean + get() = psi.isAnnotationType + + override val isEnum: Boolean + get() = psi.isEnum + + override val isRecord: Boolean + get() = false + + override val outerClass: JavaClassImpl? + get() { + val outer = psi.containingClass + return if (outer == null) null else JavaClassImpl(outer) + } + + override val typeParameters: List + get() = typeParameters(psi.typeParameters) + + override val supertypes: Collection + get() = classifierTypes(psi.superTypes) + + override val methods: Collection + get() { + assertNotLightClass() + // We apply distinct here because PsiClass#getMethods() can return duplicate PSI methods, for example in Lombok (see KT-11778) + // Return type seems to be null for example for the 'clone' Groovy method generated by @AutoClone (see EA-73795) + return methods( + psi.methods.filter { method -> + !method.isConstructor && method.returnType != null && !(isEnum && isSyntheticValuesOrValueOfMethod(method)) + } + ).distinct() + } + + override val fields: Collection + get() { + assertNotLightClass() + return fields(psi.fields.filter { + // ex. Android plugin generates LightFields for resources started from '.' (.DS_Store file etc) + Name.isValidIdentifier(it.name) + }) + } + + override val constructors: Collection + get() { + assertNotLightClass() + // See for example org.jetbrains.plugins.scala.lang.psi.light.ScFunctionWrapper, + // which is present in getConstructors(), but its isConstructor() returns false + return constructors(psi.constructors.filter { method -> method.isConstructor }) + } + + override val recordComponents: Collection + get() { + assertNotLightClass() + + return emptyList() + } + + override fun hasDefaultConstructor() = !isInterface && constructors.isEmpty() + + override val isAbstract: Boolean + get() = JavaElementUtil.isAbstract(this) + + override val isStatic: Boolean + get() = JavaElementUtil.isStatic(this) + + override val isFinal: Boolean + get() = JavaElementUtil.isFinal(this) + + override val visibility: Visibility + get() = JavaElementUtil.getVisibility(this) + + override val lightClassOriginKind: LightClassOriginKind? + get() = (psi as? KtLightClassMarker)?.originKind + + override val virtualFile: VirtualFile? + get() = psi.containingFile?.virtualFile + + override fun isFromSourceCodeInScope(scope: SearchScope): Boolean = psi.containingFile.virtualFile in scope + + override fun getAnnotationOwnerPsi() = psi.modifierList + + private fun assertNotLightClass() { + val psiClass = psi + if (psiClass !is KtLightClassMarker) return + + val message = "Querying members of JavaClass created for $psiClass of type ${psiClass::class.java} defined in file ${psiClass.containingFile?.virtualFile?.canonicalPath}" + LOGGER.error(message) + } + + companion object { + private val LOGGER = Logger.getInstance(JavaClassImpl::class.java) + } +} diff --git a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/BinaryJavaClass.kt.201 b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/BinaryJavaClass.kt.201 new file mode 100644 index 00000000000..b2901f3c74e --- /dev/null +++ b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/BinaryJavaClass.kt.201 @@ -0,0 +1,226 @@ +/* + * Copyright 2010-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.load.java.structure.impl.classFiles + +import com.intellij.openapi.vfs.VirtualFile +import com.intellij.psi.search.SearchScope +import gnu.trove.THashMap +import org.jetbrains.kotlin.builtins.PrimitiveType +import org.jetbrains.kotlin.load.java.structure.* +import org.jetbrains.kotlin.load.java.structure.impl.VirtualFileBoundJavaClass +import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.utils.SmartList +import org.jetbrains.kotlin.utils.addIfNotNull +import org.jetbrains.org.objectweb.asm.* +import java.text.CharacterIterator +import java.text.StringCharacterIterator + +class BinaryJavaClass( + override val virtualFile: VirtualFile, + override val fqName: FqName, + internal val context: ClassifierResolutionContext, + private val signatureParser: BinaryClassSignatureParser, + override var access: Int = 0, + override val outerClass: JavaClass?, + classContent: ByteArray? = null +) : ClassVisitor(ASM_API_VERSION_FOR_CLASS_READING), VirtualFileBoundJavaClass, BinaryJavaModifierListOwner, MapBasedJavaAnnotationOwner { + private lateinit var myInternalName: String + + override val annotations: MutableCollection = SmartList() + override lateinit var typeParameters: List + override lateinit var supertypes: Collection + override val methods = arrayListOf() + override val fields = arrayListOf() + override val constructors = arrayListOf() + override val recordComponents = arrayListOf() + + override fun hasDefaultConstructor() = false // never: all constructors explicit in bytecode + + override val annotationsByFqName by buildLazyValueForMap() + + // Short name of a nested class of this class -> access flags as seen in the InnerClasses attribute value. + // Note that it doesn't include classes mentioned in other InnerClasses attribute values (those which are not nested in this class). + private val ownInnerClassNameToAccess: MutableMap = THashMap() + + override val innerClassNames get() = ownInnerClassNameToAccess.keys + + override val name: Name + get() = fqName.shortName() + + override val isInterface get() = isSet(Opcodes.ACC_INTERFACE) + override val isAnnotationType get() = isSet(Opcodes.ACC_ANNOTATION) + override val isEnum get() = isSet(Opcodes.ACC_ENUM) + + override val isRecord get() = false + + override val lightClassOriginKind: LightClassOriginKind? get() = null + + override fun isFromSourceCodeInScope(scope: SearchScope): Boolean = false + + override fun visitEnd() { + methods.trimToSize() + fields.trimToSize() + constructors.trimToSize() + } + + init { + try { + ClassReader(classContent ?: virtualFile.contentsToByteArray()).accept( + this, + ClassReader.SKIP_CODE or ClassReader.SKIP_FRAMES + ) + } catch (e: Throwable) { + throw IllegalStateException("Could not read class: $virtualFile", e) + } + } + + override fun visitMethod(access: Int, name: String, desc: String, signature: String?, exceptions: Array?): MethodVisitor? { + if (access.isSet(Opcodes.ACC_SYNTHETIC) || access.isSet(Opcodes.ACC_BRIDGE) || name == "") return null + + // skip semi-synthetic enum methods + if (isEnum) { + if (name == "values" && desc.startsWith("()")) return null + if (name == "valueOf" && desc.startsWith("(Ljava/lang/String;)")) return null + } + + val (member, visitor) = BinaryJavaMethodBase.create(name, access, desc, signature, this, context.copyForMember(), signatureParser) + + when (member) { + is JavaMethod -> methods.add(member) + is JavaConstructor -> constructors.add(member) + else -> error("Unexpected member: ${member.javaClass}") + } + + return visitor + } + + override fun visitInnerClass(name: String, outerName: String?, innerName: String?, access: Int) { + if (access.isSet(Opcodes.ACC_SYNTHETIC)) return + if (innerName == null || outerName == null) return + + // Do not read InnerClasses attribute values where full name != outer + $ + inner; treat those classes as top level instead. + // This is possible for example for Groovy-generated $Trait$FieldHelper classes. + if (name == "$outerName$$innerName") { + context.addInnerClass(name, outerName, innerName) + + if (myInternalName == outerName) { + ownInnerClassNameToAccess[context.mapInternalNameToClassId(name).shortClassName] = access + } + } + } + + override fun visit( + version: Int, + access: Int, + name: String, + signature: String?, + superName: String?, + interfaces: Array? + ) { + this.access = this.access or access + this.myInternalName = name + + if (signature != null) { + parseClassSignature(signature) + } else { + this.typeParameters = emptyList() + this.supertypes = mutableListOf().apply { + addIfNotNull(superName?.convertInternalNameToClassifierType()) + interfaces?.forEach { + addIfNotNull(it.convertInternalNameToClassifierType()) + } + } + } + } + + private fun parseClassSignature(signature: String) { + val iterator = StringCharacterIterator(signature) + this.typeParameters = + signatureParser + .parseTypeParametersDeclaration(iterator, context) + .also(context::addTypeParameters) + + val supertypes = SmartList() + supertypes.addIfNotNull(signatureParser.parseClassifierRefSignature(iterator, context)) + while (iterator.current() != CharacterIterator.DONE) { + supertypes.addIfNotNull(signatureParser.parseClassifierRefSignature(iterator, context)) + } + this.supertypes = supertypes + } + + private fun String.convertInternalNameToClassifierType(): JavaClassifierType = + PlainJavaClassifierType({ context.resolveByInternalName(this) }, emptyList()) + + override fun visitField(access: Int, name: String, desc: String, signature: String?, value: Any?): FieldVisitor? { + if (access.isSet(Opcodes.ACC_SYNTHETIC)) return null + + val type = signatureParser.parseTypeString(StringCharacterIterator(signature ?: desc), context) + + val processedValue = processValue(value, type) + + return BinaryJavaField(Name.identifier(name), access, this, access.isSet(Opcodes.ACC_ENUM), type, processedValue).run { + fields.add(this) + + object : FieldVisitor(ASM_API_VERSION_FOR_CLASS_READING) { + override fun visitAnnotation(desc: String, visible: Boolean) = + BinaryJavaAnnotation.addAnnotation(this@run.annotations, desc, context, signatureParser) + + override fun visitTypeAnnotation(typeRef: Int, typePath: TypePath?, desc: String, visible: Boolean) = + if (typePath == null) + BinaryJavaAnnotation.addTypeAnnotation(type, desc, context, signatureParser) + else + null + } + } + } + + /** + * All the int-like values (including Char/Boolean) come in visitor as Integer instances + */ + private fun processValue(value: Any?, fieldType: JavaType): Any? { + if (fieldType !is JavaPrimitiveType || fieldType.type == null || value !is Int) return value + + return when (fieldType.type) { + PrimitiveType.BOOLEAN -> { + when (value) { + 0 -> false + 1 -> true + else -> value + } + } + PrimitiveType.CHAR -> value.toChar() + else -> value + } + } + + override fun visitAnnotation(desc: String, visible: Boolean) = + BinaryJavaAnnotation.addAnnotation(annotations, desc, context, signatureParser) + + override fun findInnerClass(name: Name): JavaClass? = findInnerClass(name, classFileContent = null) + + fun findInnerClass(name: Name, classFileContent: ByteArray?): JavaClass? { + val access = ownInnerClassNameToAccess[name] ?: return null + + return virtualFile.parent.findChild("${virtualFile.nameWithoutExtension}$$name.class")?.let { + BinaryJavaClass( + it, fqName.child(name), context.copyForMember(), signatureParser, access, this, + classFileContent + ) + } + } +} diff --git a/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/parcel/ParcelableClinitClassBuilderInterceptorExtension.kt.201 b/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/parcel/ParcelableClinitClassBuilderInterceptorExtension.kt.201 new file mode 100644 index 00000000000..4ebe4e21252 --- /dev/null +++ b/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/parcel/ParcelableClinitClassBuilderInterceptorExtension.kt.201 @@ -0,0 +1,156 @@ +/* + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.android.synthetic.codegen + +import com.intellij.psi.PsiElement +import org.jetbrains.kotlin.android.parcel.isParcelize +import org.jetbrains.kotlin.codegen.AbstractClassBuilder +import org.jetbrains.kotlin.codegen.ClassBuilder +import org.jetbrains.kotlin.codegen.ClassBuilderFactory +import org.jetbrains.kotlin.codegen.DelegatingClassBuilder +import org.jetbrains.kotlin.codegen.extensions.ClassBuilderInterceptorExtension +import org.jetbrains.kotlin.diagnostics.DiagnosticSink +import org.jetbrains.kotlin.psi.KtClassOrObject +import org.jetbrains.kotlin.resolve.BindingContext +import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin +import org.jetbrains.org.objectweb.asm.MethodVisitor +import org.jetbrains.org.objectweb.asm.Opcodes +import org.jetbrains.org.objectweb.asm.Opcodes.ACC_STATIC +import org.jetbrains.org.objectweb.asm.Type +import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter + +class ParcelableClinitClassBuilderInterceptorExtension : ClassBuilderInterceptorExtension { + override fun interceptClassBuilderFactory( + interceptedFactory: ClassBuilderFactory, + bindingContext: BindingContext, + diagnostics: DiagnosticSink + ): ClassBuilderFactory { + return ParcelableClinitClassBuilderFactory(interceptedFactory, bindingContext) + } + + private inner class ParcelableClinitClassBuilderFactory( + private val delegateFactory: ClassBuilderFactory, + val bindingContext: BindingContext + ) : ClassBuilderFactory { + + override fun newClassBuilder(origin: JvmDeclarationOrigin): ClassBuilder { + return AndroidOnDestroyCollectorClassBuilder(origin, delegateFactory.newClassBuilder(origin), bindingContext) + } + + override fun getClassBuilderMode() = delegateFactory.classBuilderMode + + override fun asText(builder: ClassBuilder?): String? { + return delegateFactory.asText((builder as AndroidOnDestroyCollectorClassBuilder).delegateClassBuilder) + } + + override fun asBytes(builder: ClassBuilder?): ByteArray? { + return delegateFactory.asBytes((builder as AndroidOnDestroyCollectorClassBuilder).delegateClassBuilder) + } + + override fun close() { + delegateFactory.close() + } + } + + private inner class AndroidOnDestroyCollectorClassBuilder( + val declarationOrigin: JvmDeclarationOrigin, + internal val delegateClassBuilder: ClassBuilder, + val bindingContext: BindingContext + ) : DelegatingClassBuilder() { + private var currentClass: KtClassOrObject? = null + private var currentClassName: String? = null + private var isClinitGenerated = false + + override fun getDelegate() = delegateClassBuilder + + override fun defineClass( + origin: PsiElement?, + version: Int, + access: Int, + name: String, + signature: String?, + superName: String, + interfaces: Array + ) { + if (origin is KtClassOrObject) { + currentClass = origin + } else { + currentClass = null + } + + currentClassName = name + isClinitGenerated = false + + super.defineClass(origin, version, access, name, signature, superName, interfaces) + } + + override fun done() { + if (!isClinitGenerated && currentClass != null && currentClassName != null) { + val descriptor = bindingContext[BindingContext.CLASS, currentClass] + if (descriptor != null && declarationOrigin.descriptor == descriptor && descriptor.isParcelize) { + val baseVisitor = super.newMethod(JvmDeclarationOrigin.NO_ORIGIN, ACC_STATIC, "", "()V", null, null) + val visitor = ClinitAwareMethodVisitor(currentClassName!!, baseVisitor) + + visitor.visitCode() + visitor.visitInsn(Opcodes.RETURN) + visitor.visitEnd() + } + } + + super.done() + } + + override fun newMethod( + origin: JvmDeclarationOrigin, + access: Int, + name: String, + desc: String, + signature: String?, + exceptions: Array? + ): MethodVisitor { + if (name == "" && currentClass != null && currentClassName != null) { + isClinitGenerated = true + + val descriptor = bindingContext[BindingContext.CLASS, currentClass] + if (descriptor != null && declarationOrigin.descriptor == descriptor && descriptor.isParcelize) { + return ClinitAwareMethodVisitor( + currentClassName!!, + super.newMethod(origin, access, name, desc, signature, exceptions)) + } + } + + return super.newMethod(origin, access, name, desc, signature, exceptions) + } + } + + private class ClinitAwareMethodVisitor(val parcelableName: String, mv: MethodVisitor) : MethodVisitor(Opcodes.API_VERSION, mv) { + override fun visitInsn(opcode: Int) { + if (opcode == Opcodes.RETURN) { + val iv = InstructionAdapter(this) + val creatorName = "$parcelableName\$Creator" + val creatorType = Type.getObjectType(creatorName) + + iv.anew(creatorType) + iv.dup() + iv.invokespecial(creatorName, "", "()V", false) + iv.putstatic(parcelableName, "CREATOR", "Landroid/os/Parcelable\$Creator;") + } + + super.visitInsn(opcode) + } + } +} diff --git a/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/codegen/AndroidOnDestroyClassBuilderInterceptorExtension.kt.201 b/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/codegen/AndroidOnDestroyClassBuilderInterceptorExtension.kt.201 new file mode 100644 index 00000000000..15e71b8c17f --- /dev/null +++ b/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/codegen/AndroidOnDestroyClassBuilderInterceptorExtension.kt.201 @@ -0,0 +1,136 @@ +/* + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.android.synthetic.codegen + +import com.intellij.psi.PsiElement +import kotlinx.android.extensions.CacheImplementation +import org.jetbrains.kotlin.android.synthetic.codegen.AbstractAndroidExtensionsExpressionCodegenExtension.Companion.CLEAR_CACHE_METHOD_NAME +import org.jetbrains.kotlin.android.synthetic.codegen.AbstractAndroidExtensionsExpressionCodegenExtension.Companion.ON_DESTROY_METHOD_NAME +import org.jetbrains.kotlin.android.synthetic.descriptors.ContainerOptionsProxy +import org.jetbrains.kotlin.codegen.AbstractClassBuilder +import org.jetbrains.kotlin.codegen.ClassBuilder +import org.jetbrains.kotlin.codegen.ClassBuilderFactory +import org.jetbrains.kotlin.codegen.DelegatingClassBuilder +import org.jetbrains.kotlin.codegen.extensions.ClassBuilderInterceptorExtension +import org.jetbrains.kotlin.diagnostics.DiagnosticSink +import org.jetbrains.kotlin.psi.KtClass +import org.jetbrains.kotlin.psi.KtElement +import org.jetbrains.kotlin.resolve.BindingContext +import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin +import org.jetbrains.org.objectweb.asm.MethodVisitor +import org.jetbrains.org.objectweb.asm.Opcodes +import org.jetbrains.org.objectweb.asm.Type +import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter + +abstract class AbstractAndroidOnDestroyClassBuilderInterceptorExtension : ClassBuilderInterceptorExtension { + override fun interceptClassBuilderFactory( + interceptedFactory: ClassBuilderFactory, + bindingContext: BindingContext, + diagnostics: DiagnosticSink + ): ClassBuilderFactory { + return AndroidOnDestroyClassBuilderFactory(interceptedFactory, bindingContext) + } + + abstract fun getGlobalCacheImpl(element: KtElement): CacheImplementation + + private inner class AndroidOnDestroyClassBuilderFactory( + private val delegateFactory: ClassBuilderFactory, + val bindingContext: BindingContext + ) : ClassBuilderFactory { + + override fun newClassBuilder(origin: JvmDeclarationOrigin): ClassBuilder { + return AndroidOnDestroyCollectorClassBuilder(delegateFactory.newClassBuilder(origin), bindingContext) + } + + override fun getClassBuilderMode() = delegateFactory.classBuilderMode + + override fun asText(builder: ClassBuilder?): String? { + return delegateFactory.asText((builder as AndroidOnDestroyCollectorClassBuilder).delegateClassBuilder) + } + + override fun asBytes(builder: ClassBuilder?): ByteArray? { + return delegateFactory.asBytes((builder as AndroidOnDestroyCollectorClassBuilder).delegateClassBuilder) + } + + override fun close() { + delegateFactory.close() + } + } + + private inner class AndroidOnDestroyCollectorClassBuilder( + internal val delegateClassBuilder: ClassBuilder, + val bindingContext: BindingContext + ) : DelegatingClassBuilder() { + private var currentClass: KtClass? = null + private var currentClassName: String? = null + + override fun getDelegate() = delegateClassBuilder + + override fun defineClass( + origin: PsiElement?, + version: Int, + access: Int, + name: String, + signature: String?, + superName: String, + interfaces: Array + ) { + if (origin is KtClass) { + currentClass = origin + currentClassName = name + } + super.defineClass(origin, version, access, name, signature, superName, interfaces) + } + + override fun newMethod( + origin: JvmDeclarationOrigin, + access: Int, + name: String, + desc: String, + signature: String?, + exceptions: Array? + ): MethodVisitor { + return object : MethodVisitor(Opcodes.API_VERSION, super.newMethod(origin, access, name, desc, signature, exceptions)) { + override fun visitInsn(opcode: Int) { + if (opcode == Opcodes.RETURN) { + generateClearCacheMethodCall() + } + + super.visitInsn(opcode) + } + + private fun generateClearCacheMethodCall() { + val currentClass = currentClass + if (name != ON_DESTROY_METHOD_NAME || currentClass == null) return + if (Type.getArgumentTypes(desc).isNotEmpty()) return + if (Type.getReturnType(desc) != Type.VOID_TYPE) return + + val containerType = currentClassName?.let { Type.getObjectType(it) } ?: return + + val container = bindingContext.get(BindingContext.CLASS, currentClass) ?: return + val entityOptions = ContainerOptionsProxy.create(container) + if (!entityOptions.containerType.isFragment || !(entityOptions.cache ?: getGlobalCacheImpl(currentClass)).hasCache) return + + val iv = InstructionAdapter(this) + iv.load(0, containerType) + iv.invokevirtual(currentClassName, CLEAR_CACHE_METHOD_NAME, "()V", false) + } + } + } + } + +} diff --git a/plugins/parcelize/parcelize-compiler/src/org/jetbrains/kotlin/parcelize/ParcelizeClinitClassBuilderInterceptorExtension.kt.201 b/plugins/parcelize/parcelize-compiler/src/org/jetbrains/kotlin/parcelize/ParcelizeClinitClassBuilderInterceptorExtension.kt.201 new file mode 100644 index 00000000000..3657aebecfb --- /dev/null +++ b/plugins/parcelize/parcelize-compiler/src/org/jetbrains/kotlin/parcelize/ParcelizeClinitClassBuilderInterceptorExtension.kt.201 @@ -0,0 +1,150 @@ +/* + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.parcelize + +import com.intellij.psi.PsiElement +import org.jetbrains.kotlin.codegen.AbstractClassBuilder +import org.jetbrains.kotlin.codegen.ClassBuilder +import org.jetbrains.kotlin.codegen.ClassBuilderFactory +import org.jetbrains.kotlin.codegen.DelegatingClassBuilder +import org.jetbrains.kotlin.codegen.extensions.ClassBuilderInterceptorExtension +import org.jetbrains.kotlin.diagnostics.DiagnosticSink +import org.jetbrains.kotlin.psi.KtClassOrObject +import org.jetbrains.kotlin.resolve.BindingContext +import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin +import org.jetbrains.org.objectweb.asm.MethodVisitor +import org.jetbrains.org.objectweb.asm.Opcodes +import org.jetbrains.org.objectweb.asm.Type +import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter + +class ParcelizeClinitClassBuilderInterceptorExtension : ClassBuilderInterceptorExtension { + override fun interceptClassBuilderFactory( + interceptedFactory: ClassBuilderFactory, + bindingContext: BindingContext, + diagnostics: DiagnosticSink + ): ClassBuilderFactory { + return ParcelableClinitClassBuilderFactory(interceptedFactory, bindingContext) + } + + private inner class ParcelableClinitClassBuilderFactory( + private val delegateFactory: ClassBuilderFactory, + val bindingContext: BindingContext + ) : ClassBuilderFactory { + + override fun newClassBuilder(origin: JvmDeclarationOrigin): ClassBuilder { + return AndroidOnDestroyCollectorClassBuilder(origin, delegateFactory.newClassBuilder(origin), bindingContext) + } + + override fun getClassBuilderMode() = delegateFactory.classBuilderMode + + override fun asText(builder: ClassBuilder?): String? { + return delegateFactory.asText((builder as AndroidOnDestroyCollectorClassBuilder).delegateClassBuilder) + } + + override fun asBytes(builder: ClassBuilder?): ByteArray? { + return delegateFactory.asBytes((builder as AndroidOnDestroyCollectorClassBuilder).delegateClassBuilder) + } + + override fun close() { + delegateFactory.close() + } + } + + private class AndroidOnDestroyCollectorClassBuilder( + val declarationOrigin: JvmDeclarationOrigin, + val delegateClassBuilder: ClassBuilder, + val bindingContext: BindingContext + ) : DelegatingClassBuilder() { + private var currentClass: KtClassOrObject? = null + private var currentClassName: String? = null + private var isClinitGenerated = false + + override fun getDelegate() = delegateClassBuilder + + override fun defineClass( + origin: PsiElement?, + version: Int, + access: Int, + name: String, + signature: String?, + superName: String, + interfaces: Array + ) { + currentClass = origin as? KtClassOrObject + currentClassName = name + isClinitGenerated = false + + super.defineClass(origin, version, access, name, signature, superName, interfaces) + } + + override fun done() { + if (!isClinitGenerated && currentClass != null && currentClassName != null) { + val descriptor = bindingContext[BindingContext.CLASS, currentClass] + if (descriptor != null && declarationOrigin.descriptor == descriptor && descriptor.isParcelize) { + val baseVisitor = super.newMethod(JvmDeclarationOrigin.NO_ORIGIN, Opcodes.ACC_STATIC, "", "()V", null, null) + val visitor = ClinitAwareMethodVisitor(currentClassName!!, baseVisitor) + + visitor.visitCode() + visitor.visitInsn(Opcodes.RETURN) + visitor.visitEnd() + } + } + + super.done() + } + + override fun newMethod( + origin: JvmDeclarationOrigin, + access: Int, + name: String, + desc: String, + signature: String?, + exceptions: Array? + ): MethodVisitor { + if (name == "" && currentClass != null && currentClassName != null) { + isClinitGenerated = true + + val descriptor = bindingContext[BindingContext.CLASS, currentClass] + if (descriptor != null && declarationOrigin.descriptor == descriptor && descriptor.isParcelize) { + return ClinitAwareMethodVisitor( + currentClassName!!, + super.newMethod(origin, access, name, desc, signature, exceptions) + ) + } + } + + return super.newMethod(origin, access, name, desc, signature, exceptions) + } + } + + private class ClinitAwareMethodVisitor(val parcelableName: String, mv: MethodVisitor) : MethodVisitor(Opcodes.API_VERSION, mv) { + override fun visitInsn(opcode: Int) { + if (opcode == Opcodes.RETURN) { + val iv = InstructionAdapter(this) + val creatorName = "$parcelableName\$Creator" + val creatorType = Type.getObjectType(creatorName) + + iv.anew(creatorType) + iv.dup() + iv.invokespecial(creatorName, "", "()V", false) + iv.putstatic(parcelableName, "CREATOR", "Landroid/os/Parcelable\$Creator;") + } + + super.visitInsn(opcode) + } + } +} From 71459db9dd9e45979717e33abc4e47658aca7fc5 Mon Sep 17 00:00:00 2001 From: "anastasiia.spaseeva" Date: Mon, 7 Dec 2020 11:50:31 +0300 Subject: [PATCH 537/698] Wizard: Do not add bintray repoitory for eap versions --- .../kotlin/code/CodeConformanceTest.kt | 38 ------------------- gradle/cacheRedirector.gradle.kts | 1 - ...plePluginVersionGradleImportingTestCase.kt | 1 - .../ConfigureKotlinInProjectUtils.kt | 9 ----- .../jvm/simpleProjectEAP/pom_after.xml | 28 -------------- .../jvm/simpleProjectRc/pom_after.xml | 28 -------------- .../deprecatedJre.fixed.1.xml | 21 ---------- .../maven-inspections/deprecatedJre.xml | 21 ---------- .../deprecatedKotlinxCoroutines.fixed.1.xml | 18 --------- .../deprecatedKotlinxCoroutines.xml | 18 --------- .../deprecatedKotlinxCoroutinesNoError.xml | 18 --------- .../gradle/eapVersion/build_after.gradle | 2 - .../gradle/m04Version/build_after.gradle | 2 - .../gradle/rcVersion/build_after.gradle | 2 - .../gsk/eap11Version/build_after.gradle.kts | 1 - .../gsk/eapVersion/build_after.gradle.kts | 1 - .../build.gradle.after | 3 +- .../build.gradle.kts.after | 3 +- .../build.gradle.after | 3 +- .../build.gradle.kts.after | 1 - .../settings.gradle | 1 - .../build.gradle.kts | 1 - .../settings.gradle.kts | 1 - .../build.gradle.kts | 1 - .../settings.gradle.kts | 1 - .../native/_common/build.gradle.kts.header | 2 - .../native/_common/settings.gradle.kts | 1 - .../experimental/test/MavenResolverTest.kt | 3 +- .../tools/new-project-wizard/build.gradle.kts | 1 + .../jvmToJvmDependency/expected/a/pom.xml | 11 ------ .../jvmToJvmDependency/expected/b/pom.xml | 11 ------ .../jvmToJvmDependency/expected/c/pom.xml | 11 ------ .../jvmToJvmDependency/expected/d/pom.xml | 11 ------ .../jvmToJvmDependency/expected/pom.xml | 10 ----- .../expected/b/c/pom.xml | 11 ------ .../expected/b/pom.xml | 10 ----- .../expected/pom.xml | 11 ------ .../buildFileGeneration/kotlinJvm/pom.xml | 11 ------ .../backendApplication/build.gradle.kts | 1 - .../backendApplication/pom.xml | 8 +--- .../backendApplication/settings.gradle.kts | 1 - .../consoleApplication/build.gradle.kts | 1 - .../consoleApplication/pom.xml | 8 +--- .../consoleApplication/settings.gradle.kts | 1 - .../frontendApplication/build.gradle | 1 - .../frontendApplication/build.gradle.kts | 1 - .../frontendApplication/settings.gradle | 1 - .../frontendApplication/settings.gradle.kts | 1 - .../fullStackWebApplication/build.gradle | 1 - .../fullStackWebApplication/build.gradle.kts | 1 - .../fullStackWebApplication/settings.gradle | 1 - .../settings.gradle.kts | 1 - .../multiplatformApplication/build.gradle | 1 - .../multiplatformApplication/build.gradle.kts | 1 - .../multiplatformApplication/settings.gradle | 1 - .../settings.gradle.kts | 1 - .../multiplatformLibrary/build.gradle | 1 - .../multiplatformLibrary/build.gradle.kts | 1 - .../multiplatformLibrary/settings.gradle | 1 - .../multiplatformLibrary/settings.gradle.kts | 1 - .../expected/build.gradle | 3 +- .../expected/build.gradle.kts | 3 +- .../expected/settings.gradle | 1 - .../expected/settings.gradle.kts | 1 - .../expected/build.gradle | 1 - .../expected/build.gradle.kts | 1 - .../expected/settings.gradle | 1 - .../expected/settings.gradle.kts | 1 - .../nativeApplication/build.gradle | 1 - .../nativeApplication/build.gradle.kts | 1 - .../nativeApplication/settings.gradle | 1 - .../nativeApplication/settings.gradle.kts | 1 - .../cli/AbstractBuildFileGenerationTest.kt | 2 - .../KotlinVersionProviderTestWizardService.kt | 5 +-- .../service/KotlinVersionProviderService.kt | 25 +++++++++--- .../plugins/kotlin/KotlinPlugin.kt | 3 +- .../settings/buildsystem/Repository.kt | 2 +- 77 files changed, 35 insertions(+), 382 deletions(-) diff --git a/compiler/tests/org/jetbrains/kotlin/code/CodeConformanceTest.kt b/compiler/tests/org/jetbrains/kotlin/code/CodeConformanceTest.kt index bc0e9fec769..6ae128d070c 100644 --- a/compiler/tests/org/jetbrains/kotlin/code/CodeConformanceTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/code/CodeConformanceTest.kt @@ -336,44 +336,6 @@ class CodeConformanceTest : TestCase() { ) ), RepoAllowList("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlin-dev", root, setOf()), - RepoAllowList( - // Please use cache-redirector for importing in tests - "https://dl.bintray.com/kotlin/kotlin-eap", root, setOf( - "kotlin-ultimate/ide/android-studio-native/testData/wizard/expected/app/build.gradle.kts", - "kotlin-ultimate/ide/android-studio-native/testData/wizard/expected/shared/build.gradle.kts", - "kotlin-ultimate/ide/android-studio-native/testData/wizard/expected/build.gradle.kts", - "kotlin-ultimate/ide/android-studio-native/testData/wizard/expected/settings.gradle.kts", - "kotlin-ultimate/ide/android-studio-native/src/com/jetbrains/kmm/wizard/templates/buildFile.kt", - "libraries/scripting/dependencies-maven/test/kotlin/script/experimental/test/MavenResolverTest.kt", - "idea/testData/configuration/gradle/eapVersion/build_after.gradle", - "idea/testData/configuration/gradle/rcVersion/build_after.gradle", - "idea/testData/configuration/gradle/m04Version/build_after.gradle", - "idea/testData/configuration/gsk/eapVersion/build_after.gradle.kts", - "idea/testData/configuration/gsk/eap11Version/build_after.gradle.kts", - "idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinInProjectUtils.kt", - "gradle/cacheRedirector.gradle.kts", - "idea/idea-maven/testData/configurator/jvm/simpleProjectEAP/pom_after.xml", - "idea/idea-maven/testData/configurator/jvm/simpleProjectRc/pom_after.xml", - "idea/idea-maven/testData/maven-inspections/deprecatedJre.fixed.1.xml", - "idea/idea-maven/testData/maven-inspections/deprecatedJre.xml", - "idea/idea-maven/testData/maven-inspections/deprecatedKotlinxCoroutines.fixed.1.xml", - "idea/idea-maven/testData/maven-inspections/deprecatedKotlinxCoroutines.xml", - "idea/idea-maven/testData/maven-inspections/deprecatedKotlinxCoroutinesNoError.xml", - "idea/testData/gradle/configurator/configureJsEAPWithBuildGradle/build.gradle.after", - "idea/testData/gradle/configurator/configureJsEAPWithBuildGradleKts/build.gradle.kts.after", - "idea/testData/gradle/configurator/configureJvmEAPWithBuildGradle/build.gradle.after", - "idea/testData/gradle/configurator/configureJvmEAPWithBuildGradleKts/build.gradle.kts.after", - "idea/testData/gradle/nativeRunConfiguration/customEntryPointWithoutRunGutter/build.gradle.kts", - "idea/testData/gradle/nativeRunConfiguration/customEntryPointWithoutRunGutter/settings.gradle.kts", - "idea/testData/gradle/nativeRunConfiguration/multiplatformNativeRunGutter/build.gradle.kts", - "idea/testData/gradle/nativeRunConfiguration/multiplatformNativeRunGutter/settings.gradle.kts", - "idea/testData/perfTest/native/_common/settings.gradle.kts", - "kotlin-ultimate/gradle/cidrPluginTools.gradle.kts", - "libraries/tools/new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/core/service/KotlinVersionProviderService.kt", - "idea/testData/perfTest/native/_common/build.gradle.kts.header" - ) - ), - RepoAllowList("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlin-eap", root, setOf()), RepoAllowList( // Please use cache-redirector for importing in tests "https://dl.bintray.com/kotlin/kotlin-bootstrap", root, setOf( diff --git a/gradle/cacheRedirector.gradle.kts b/gradle/cacheRedirector.gradle.kts index 5424a71d4a4..c41cc504564 100644 --- a/gradle/cacheRedirector.gradle.kts +++ b/gradle/cacheRedirector.gradle.kts @@ -23,7 +23,6 @@ val mirroredUrls = listOf( "https://dl.bintray.com/kodein-framework/Kodein-DI", "https://dl.bintray.com/konsoletyper/teavm", "https://dl.bintray.com/kotlin/kotlin-dev", - "https://dl.bintray.com/kotlin/kotlin-eap", "https://dl.bintray.com/kotlin/kotlinx.html", "https://dl.bintray.com/kotlin/kotlinx", "https://dl.bintray.com/kotlin/ktor", diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/MultiplePluginVersionGradleImportingTestCase.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/MultiplePluginVersionGradleImportingTestCase.kt index 91648ea9aa2..ebabb3c78a2 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/MultiplePluginVersionGradleImportingTestCase.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/MultiplePluginVersionGradleImportingTestCase.kt @@ -83,7 +83,6 @@ abstract class MultiplePluginVersionGradleImportingTestCase : GradleImportingTes fun repositories(useKts: Boolean): String { val customRepositories = arrayOf( "https://dl.bintray.com/kotlin/kotlin-dev", - "http://dl.bintray.com/kotlin/kotlin-eap" ) val customMavenRepositories = customRepositories.map { if (useKts) "maven(\"$it\")" else "maven { url '$it' } " }.joinToString("\n") return """ diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinInProjectUtils.kt b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinInProjectUtils.kt index c68d632d5fd..e3e14621492 100644 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinInProjectUtils.kt +++ b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinInProjectUtils.kt @@ -59,14 +59,6 @@ val SNAPSHOT_REPOSITORY = RepositoryDescription( isSnapshot = true ) -val EAP_REPOSITORY = RepositoryDescription( - "bintray.kotlin.eap", - "Bintray Kotlin EAP Repository", - "https://dl.bintray.com/kotlin/kotlin-eap", - "https://bintray.com/kotlin/kotlin-eap/kotlin/", - isSnapshot = false -) - val DEFAULT_GRADLE_PLUGIN_REPOSITORY = RepositoryDescription( "default.gradle.plugins", "Default Gradle Plugin Repository", @@ -113,7 +105,6 @@ fun RepositoryDescription.toKotlinRepositorySnippet() = "maven(\"$url\")" fun getRepositoryForVersion(version: String): RepositoryDescription? = when { isSnapshot(version) -> SNAPSHOT_REPOSITORY - isEap(version) -> EAP_REPOSITORY isDev(version) -> devRepository(version) else -> null } diff --git a/idea/idea-maven/testData/configurator/jvm/simpleProjectEAP/pom_after.xml b/idea/idea-maven/testData/configurator/jvm/simpleProjectEAP/pom_after.xml index 06a8a184728..2c7d3159b59 100644 --- a/idea/idea-maven/testData/configurator/jvm/simpleProjectEAP/pom_after.xml +++ b/idea/idea-maven/testData/configurator/jvm/simpleProjectEAP/pom_after.xml @@ -26,34 +26,6 @@ - - - - true - - - false - - bintray.kotlin.eap - Bintray Kotlin EAP Repository - https://dl.bintray.com/kotlin/kotlin-eap - - - - - - - true - - - false - - bintray.kotlin.eap - Bintray Kotlin EAP Repository - https://dl.bintray.com/kotlin/kotlin-eap - - - diff --git a/idea/idea-maven/testData/configurator/jvm/simpleProjectRc/pom_after.xml b/idea/idea-maven/testData/configurator/jvm/simpleProjectRc/pom_after.xml index 156c184c52f..174a9e877f8 100644 --- a/idea/idea-maven/testData/configurator/jvm/simpleProjectRc/pom_after.xml +++ b/idea/idea-maven/testData/configurator/jvm/simpleProjectRc/pom_after.xml @@ -26,34 +26,6 @@ - - - - true - - - false - - bintray.kotlin.eap - Bintray Kotlin EAP Repository - https://dl.bintray.com/kotlin/kotlin-eap - - - - - - - true - - - false - - bintray.kotlin.eap - Bintray Kotlin EAP Repository - https://dl.bintray.com/kotlin/kotlin-eap - - - diff --git a/idea/idea-maven/testData/maven-inspections/deprecatedJre.fixed.1.xml b/idea/idea-maven/testData/maven-inspections/deprecatedJre.fixed.1.xml index 7734d42d7aa..d4739871294 100644 --- a/idea/idea-maven/testData/maven-inspections/deprecatedJre.fixed.1.xml +++ b/idea/idea-maven/testData/maven-inspections/deprecatedJre.fixed.1.xml @@ -26,27 +26,6 @@ - - - - false - - bintray-kotlin-kotlin-eap - bintray - https://dl.bintray.com/kotlin/kotlin-eap - - - - - - false - - bintray-kotlin-kotlin-eap - bintray-plugins - https://dl.bintray.com/kotlin/kotlin-eap - - - diff --git a/idea/idea-maven/testData/maven-inspections/deprecatedJre.xml b/idea/idea-maven/testData/maven-inspections/deprecatedJre.xml index 2a1ba49b659..7062d60bdc9 100644 --- a/idea/idea-maven/testData/maven-inspections/deprecatedJre.xml +++ b/idea/idea-maven/testData/maven-inspections/deprecatedJre.xml @@ -26,27 +26,6 @@ - - - - false - - bintray-kotlin-kotlin-eap - bintray - https://dl.bintray.com/kotlin/kotlin-eap - - - - - - false - - bintray-kotlin-kotlin-eap - bintray-plugins - https://dl.bintray.com/kotlin/kotlin-eap - - - diff --git a/idea/idea-maven/testData/maven-inspections/deprecatedKotlinxCoroutines.fixed.1.xml b/idea/idea-maven/testData/maven-inspections/deprecatedKotlinxCoroutines.fixed.1.xml index 4cb052fcf48..5b020e72b98 100644 --- a/idea/idea-maven/testData/maven-inspections/deprecatedKotlinxCoroutines.fixed.1.xml +++ b/idea/idea-maven/testData/maven-inspections/deprecatedKotlinxCoroutines.fixed.1.xml @@ -27,14 +27,6 @@ - - - false - - bintray-kotlin-kotlin-eap - bintray - https://dl.bintray.com/kotlin/kotlin-eap - false @@ -44,16 +36,6 @@ https://kotlin.bintray.com/kotlinx - - - - false - - bintray-kotlin-kotlin-eap - bintray-plugins - https://dl.bintray.com/kotlin/kotlin-eap - - diff --git a/idea/idea-maven/testData/maven-inspections/deprecatedKotlinxCoroutines.xml b/idea/idea-maven/testData/maven-inspections/deprecatedKotlinxCoroutines.xml index 0155d5e07d8..4d11368714f 100644 --- a/idea/idea-maven/testData/maven-inspections/deprecatedKotlinxCoroutines.xml +++ b/idea/idea-maven/testData/maven-inspections/deprecatedKotlinxCoroutines.xml @@ -27,14 +27,6 @@ - - - false - - bintray-kotlin-kotlin-eap - bintray - https://dl.bintray.com/kotlin/kotlin-eap - false @@ -44,16 +36,6 @@ https://kotlin.bintray.com/kotlinx - - - - false - - bintray-kotlin-kotlin-eap - bintray-plugins - https://dl.bintray.com/kotlin/kotlin-eap - - diff --git a/idea/idea-maven/testData/maven-inspections/deprecatedKotlinxCoroutinesNoError.xml b/idea/idea-maven/testData/maven-inspections/deprecatedKotlinxCoroutinesNoError.xml index c87e4929e90..5eecbdec9d1 100644 --- a/idea/idea-maven/testData/maven-inspections/deprecatedKotlinxCoroutinesNoError.xml +++ b/idea/idea-maven/testData/maven-inspections/deprecatedKotlinxCoroutinesNoError.xml @@ -27,14 +27,6 @@ - - - false - - bintray-kotlin-kotlin-eap - bintray - https://dl.bintray.com/kotlin/kotlin-eap - false @@ -44,16 +36,6 @@ https://kotlin.bintray.com/kotlinx - - - - false - - bintray-kotlin-kotlin-eap - bintray-plugins - https://dl.bintray.com/kotlin/kotlin-eap - - diff --git a/idea/testData/configuration/gradle/eapVersion/build_after.gradle b/idea/testData/configuration/gradle/eapVersion/build_after.gradle index 441bc5941b7..6214f6d9bcb 100644 --- a/idea/testData/configuration/gradle/eapVersion/build_after.gradle +++ b/idea/testData/configuration/gradle/eapVersion/build_after.gradle @@ -6,7 +6,6 @@ version = '1.0' repositories { mavenCentral() - maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' } } dependencies { @@ -16,7 +15,6 @@ dependencies { buildscript { ext.kotlin_version = '$VERSION$' repositories { - maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' } mavenCentral() } dependencies { diff --git a/idea/testData/configuration/gradle/m04Version/build_after.gradle b/idea/testData/configuration/gradle/m04Version/build_after.gradle index cd1414642c6..3608a69883d 100644 --- a/idea/testData/configuration/gradle/m04Version/build_after.gradle +++ b/idea/testData/configuration/gradle/m04Version/build_after.gradle @@ -6,7 +6,6 @@ version = '1.0' repositories { mavenCentral() - maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' } } dependencies { @@ -16,7 +15,6 @@ dependencies { buildscript { ext.kotlin_version = '$VERSION$' repositories { - maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' } mavenCentral() } dependencies { diff --git a/idea/testData/configuration/gradle/rcVersion/build_after.gradle b/idea/testData/configuration/gradle/rcVersion/build_after.gradle index 441bc5941b7..6214f6d9bcb 100644 --- a/idea/testData/configuration/gradle/rcVersion/build_after.gradle +++ b/idea/testData/configuration/gradle/rcVersion/build_after.gradle @@ -6,7 +6,6 @@ version = '1.0' repositories { mavenCentral() - maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' } } dependencies { @@ -16,7 +15,6 @@ dependencies { buildscript { ext.kotlin_version = '$VERSION$' repositories { - maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' } mavenCentral() } dependencies { diff --git a/idea/testData/configuration/gsk/eap11Version/build_after.gradle.kts b/idea/testData/configuration/gsk/eap11Version/build_after.gradle.kts index d95125b5e9b..8067a8c6872 100644 --- a/idea/testData/configuration/gsk/eap11Version/build_after.gradle.kts +++ b/idea/testData/configuration/gsk/eap11Version/build_after.gradle.kts @@ -12,7 +12,6 @@ application { repositories { jcenter() - maven("https://dl.bintray.com/kotlin/kotlin-eap") } dependencies { diff --git a/idea/testData/configuration/gsk/eapVersion/build_after.gradle.kts b/idea/testData/configuration/gsk/eapVersion/build_after.gradle.kts index abadf6019b6..2e989c4de8f 100644 --- a/idea/testData/configuration/gsk/eapVersion/build_after.gradle.kts +++ b/idea/testData/configuration/gsk/eapVersion/build_after.gradle.kts @@ -11,7 +11,6 @@ application { repositories { jcenter() - maven("https://dl.bintray.com/kotlin/kotlin-eap") } dependencies { diff --git a/idea/testData/gradle/configurator/configureJsEAPWithBuildGradle/build.gradle.after b/idea/testData/gradle/configurator/configureJsEAPWithBuildGradle/build.gradle.after index bb61241e3ab..1f8ca5aee32 100644 --- a/idea/testData/gradle/configurator/configureJsEAPWithBuildGradle/build.gradle.after +++ b/idea/testData/gradle/configurator/configureJsEAPWithBuildGradle/build.gradle.after @@ -6,8 +6,7 @@ version '1.0-SNAPSHOT' repositories { mavenCentral() - maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' } } dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-js" -} +} \ No newline at end of file diff --git a/idea/testData/gradle/configurator/configureJsEAPWithBuildGradleKts/build.gradle.kts.after b/idea/testData/gradle/configurator/configureJsEAPWithBuildGradleKts/build.gradle.kts.after index f52be89aca4..90941f417d0 100644 --- a/idea/testData/gradle/configurator/configureJsEAPWithBuildGradleKts/build.gradle.kts.after +++ b/idea/testData/gradle/configurator/configureJsEAPWithBuildGradleKts/build.gradle.kts.after @@ -6,8 +6,7 @@ version = "1.0-SNAPSHOT" repositories { mavenCentral() - maven("https://dl.bintray.com/kotlin/kotlin-eap") } dependencies { implementation(kotlin("stdlib-js")) -} +} \ No newline at end of file diff --git a/idea/testData/gradle/configurator/configureJvmEAPWithBuildGradle/build.gradle.after b/idea/testData/gradle/configurator/configureJvmEAPWithBuildGradle/build.gradle.after index 80655e995cb..1ba35bf673f 100644 --- a/idea/testData/gradle/configurator/configureJvmEAPWithBuildGradle/build.gradle.after +++ b/idea/testData/gradle/configurator/configureJvmEAPWithBuildGradle/build.gradle.after @@ -10,7 +10,6 @@ sourceCompatibility = 1.8 repositories { mavenCentral() - maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' } } dependencies { @@ -26,4 +25,4 @@ compileTestKotlin { kotlinOptions { jvmTarget = "1.8" } -} +} \ No newline at end of file diff --git a/idea/testData/gradle/configurator/configureJvmEAPWithBuildGradleKts/build.gradle.kts.after b/idea/testData/gradle/configurator/configureJvmEAPWithBuildGradleKts/build.gradle.kts.after index 1d2ec9c5885..0f5a203099d 100644 --- a/idea/testData/gradle/configurator/configureJvmEAPWithBuildGradleKts/build.gradle.kts.after +++ b/idea/testData/gradle/configurator/configureJvmEAPWithBuildGradleKts/build.gradle.kts.after @@ -10,7 +10,6 @@ version = "1.0-SNAPSHOT" repositories { mavenCentral() - maven("https://dl.bintray.com/kotlin/kotlin-eap") } dependencies { diff --git a/idea/testData/gradle/configurator/enableFeatureSupportMultiplatformWithXFlag/settings.gradle b/idea/testData/gradle/configurator/enableFeatureSupportMultiplatformWithXFlag/settings.gradle index 87618c203be..ebdc76086c1 100644 --- a/idea/testData/gradle/configurator/enableFeatureSupportMultiplatformWithXFlag/settings.gradle +++ b/idea/testData/gradle/configurator/enableFeatureSupportMultiplatformWithXFlag/settings.gradle @@ -1,7 +1,6 @@ pluginManagement { repositories { maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap' } } } \ No newline at end of file diff --git a/idea/testData/gradle/nativeRunConfiguration/customEntryPointWithoutRunGutter/build.gradle.kts b/idea/testData/gradle/nativeRunConfiguration/customEntryPointWithoutRunGutter/build.gradle.kts index f4f8fae875f..45d27602ee0 100644 --- a/idea/testData/gradle/nativeRunConfiguration/customEntryPointWithoutRunGutter/build.gradle.kts +++ b/idea/testData/gradle/nativeRunConfiguration/customEntryPointWithoutRunGutter/build.gradle.kts @@ -2,7 +2,6 @@ plugins { id("org.jetbrains.kotlin.multiplatform") version ("{{kotlin_plugin_version}}") } repositories { - maven("https://dl.bintray.com/kotlin/kotlin-eap") maven("https://dl.bintray.com/kotlin/kotlin-dev") mavenLocal() } diff --git a/idea/testData/gradle/nativeRunConfiguration/customEntryPointWithoutRunGutter/settings.gradle.kts b/idea/testData/gradle/nativeRunConfiguration/customEntryPointWithoutRunGutter/settings.gradle.kts index e9d561aa042..0f4dc7d56f3 100644 --- a/idea/testData/gradle/nativeRunConfiguration/customEntryPointWithoutRunGutter/settings.gradle.kts +++ b/idea/testData/gradle/nativeRunConfiguration/customEntryPointWithoutRunGutter/settings.gradle.kts @@ -1,6 +1,5 @@ pluginManagement { repositories { - maven("https://dl.bintray.com/kotlin/kotlin-eap") maven("https://dl.bintray.com/kotlin/kotlin-dev") mavenLocal() gradlePluginPortal() diff --git a/idea/testData/gradle/nativeRunConfiguration/multiplatformNativeRunGutter/build.gradle.kts b/idea/testData/gradle/nativeRunConfiguration/multiplatformNativeRunGutter/build.gradle.kts index 28ffe236ffb..dfe88e7604c 100644 --- a/idea/testData/gradle/nativeRunConfiguration/multiplatformNativeRunGutter/build.gradle.kts +++ b/idea/testData/gradle/nativeRunConfiguration/multiplatformNativeRunGutter/build.gradle.kts @@ -2,7 +2,6 @@ plugins { id("org.jetbrains.kotlin.multiplatform") version ("{{kotlin_plugin_version}}") } repositories { - maven("https://dl.bintray.com/kotlin/kotlin-eap") maven("https://dl.bintray.com/kotlin/kotlin-dev") mavenLocal() } diff --git a/idea/testData/gradle/nativeRunConfiguration/multiplatformNativeRunGutter/settings.gradle.kts b/idea/testData/gradle/nativeRunConfiguration/multiplatformNativeRunGutter/settings.gradle.kts index e9d561aa042..0f4dc7d56f3 100644 --- a/idea/testData/gradle/nativeRunConfiguration/multiplatformNativeRunGutter/settings.gradle.kts +++ b/idea/testData/gradle/nativeRunConfiguration/multiplatformNativeRunGutter/settings.gradle.kts @@ -1,6 +1,5 @@ pluginManagement { repositories { - maven("https://dl.bintray.com/kotlin/kotlin-eap") maven("https://dl.bintray.com/kotlin/kotlin-dev") mavenLocal() gradlePluginPortal() diff --git a/idea/testData/perfTest/native/_common/build.gradle.kts.header b/idea/testData/perfTest/native/_common/build.gradle.kts.header index 5f7d7f5a00e..e3774efdd82 100644 --- a/idea/testData/perfTest/native/_common/build.gradle.kts.header +++ b/idea/testData/perfTest/native/_common/build.gradle.kts.header @@ -2,7 +2,6 @@ buildscript { repositories { mavenCentral() maven("https://dl.bintray.com/kotlin/kotlin-dev") - maven("https://dl.bintray.com/kotlin/kotlin-eap") } val kotlin_version: String by rootProject @@ -18,7 +17,6 @@ plugins { repositories { mavenCentral() maven("https://dl.bintray.com/kotlin/kotlin-dev") - maven("https://dl.bintray.com/kotlin/kotlin-eap") } // "kotlin" section goes under this line diff --git a/idea/testData/perfTest/native/_common/settings.gradle.kts b/idea/testData/perfTest/native/_common/settings.gradle.kts index 6d7cb134561..8d36003a9aa 100644 --- a/idea/testData/perfTest/native/_common/settings.gradle.kts +++ b/idea/testData/perfTest/native/_common/settings.gradle.kts @@ -11,6 +11,5 @@ pluginManagement { repositories { gradlePluginPortal() maven("https://dl.bintray.com/kotlin/kotlin-dev") - maven("https://dl.bintray.com/kotlin/kotlin-eap") } } diff --git a/libraries/scripting/dependencies-maven/test/kotlin/script/experimental/test/MavenResolverTest.kt b/libraries/scripting/dependencies-maven/test/kotlin/script/experimental/test/MavenResolverTest.kt index 58d61fa1b3a..9201bb7a84c 100644 --- a/libraries/scripting/dependencies-maven/test/kotlin/script/experimental/test/MavenResolverTest.kt +++ b/libraries/scripting/dependencies-maven/test/kotlin/script/experimental/test/MavenResolverTest.kt @@ -95,11 +95,10 @@ class MavenResolverTest : ResolversTestBase() { ) ) - // @Repository("https://dl.bintray.com/kotlin/kotlin-eap", "https://dl.bintray.com/jakubriegel/kotlin-shell") + // @Repository( "https://dl.bintray.com/jakubriegel/kotlin-shell") val repositories = repositoryConstructor.callBy( mapOf( repositoryConstructor.parameters.first() to arrayOf( - "https://dl.bintray.com/kotlin/kotlin-eap", "https://dl.bintray.com/jakubriegel/kotlin-shell" ) ) diff --git a/libraries/tools/new-project-wizard/build.gradle.kts b/libraries/tools/new-project-wizard/build.gradle.kts index f2b780da3bf..e405bb96e85 100644 --- a/libraries/tools/new-project-wizard/build.gradle.kts +++ b/libraries/tools/new-project-wizard/build.gradle.kts @@ -14,6 +14,7 @@ dependencies { testImplementation(project(":kotlin-test:kotlin-test-junit")) implementation(kotlinxCollectionsImmutable()) + implementation("com.google.code.gson:gson:2.8.6") } sourceSets { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/a/pom.xml b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/a/pom.xml index 00a15b3288c..108a3321035 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/a/pom.xml +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/a/pom.xml @@ -22,19 +22,8 @@ mavenCentral https://repo1.maven.org/maven2/ - - bintray.kotlin.kotlin-eap - KOTLIN_REPO - - - - bintray.kotlin.kotlin-eap - KOTLIN_REPO - - - src/main/kotlin src/test/kotlin diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/b/pom.xml b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/b/pom.xml index 08beee6bc76..ae4295337fa 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/b/pom.xml +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/b/pom.xml @@ -22,19 +22,8 @@ mavenCentral https://repo1.maven.org/maven2/ - - bintray.kotlin.kotlin-eap - KOTLIN_REPO - - - - bintray.kotlin.kotlin-eap - KOTLIN_REPO - - - src/main/kotlin src/test/kotlin diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/c/pom.xml b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/c/pom.xml index 0202f7959c0..369b643ca1d 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/c/pom.xml +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/c/pom.xml @@ -22,19 +22,8 @@ mavenCentral https://repo1.maven.org/maven2/ - - bintray.kotlin.kotlin-eap - KOTLIN_REPO - - - - bintray.kotlin.kotlin-eap - KOTLIN_REPO - - - src/main/kotlin src/test/kotlin diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/d/pom.xml b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/d/pom.xml index 98fb38b2386..cdef8d51cf3 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/d/pom.xml +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/d/pom.xml @@ -22,19 +22,8 @@ mavenCentral https://repo1.maven.org/maven2/ - - bintray.kotlin.kotlin-eap - KOTLIN_REPO - - - - bintray.kotlin.kotlin-eap - KOTLIN_REPO - - - src/main/kotlin src/test/kotlin diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/pom.xml b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/pom.xml index ef2d57fa9e3..6bff653011f 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/pom.xml +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/pom.xml @@ -21,18 +21,8 @@ mavenCentral https://repo1.maven.org/maven2/ - - bintray.kotlin.kotlin-eap - KOTLIN_REPO - - - - bintray.kotlin.kotlin-eap - KOTLIN_REPO - - a b diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependencyWithSingleRoot/expected/b/c/pom.xml b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependencyWithSingleRoot/expected/b/c/pom.xml index 94cb3a9b210..81e2fa1dc68 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependencyWithSingleRoot/expected/b/c/pom.xml +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependencyWithSingleRoot/expected/b/c/pom.xml @@ -22,19 +22,8 @@ mavenCentral https://repo1.maven.org/maven2/ - - bintray.kotlin.kotlin-eap - KOTLIN_REPO - - - - bintray.kotlin.kotlin-eap - KOTLIN_REPO - - - src/main/kotlin src/test/kotlin diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependencyWithSingleRoot/expected/b/pom.xml b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependencyWithSingleRoot/expected/b/pom.xml index a9a8db0cc23..f28f625ac64 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependencyWithSingleRoot/expected/b/pom.xml +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependencyWithSingleRoot/expected/b/pom.xml @@ -22,18 +22,8 @@ mavenCentral https://repo1.maven.org/maven2/ - - bintray.kotlin.kotlin-eap - KOTLIN_REPO - - - - bintray.kotlin.kotlin-eap - KOTLIN_REPO - - src/main/kotlin diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependencyWithSingleRoot/expected/pom.xml b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependencyWithSingleRoot/expected/pom.xml index cb227eb6d45..8d316c88593 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependencyWithSingleRoot/expected/pom.xml +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependencyWithSingleRoot/expected/pom.xml @@ -22,19 +22,8 @@ mavenCentral https://repo1.maven.org/maven2/ - - bintray.kotlin.kotlin-eap - KOTLIN_REPO - - - - bintray.kotlin.kotlin-eap - KOTLIN_REPO - - - src/main/kotlin src/test/kotlin diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/kotlinJvm/pom.xml b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/kotlinJvm/pom.xml index bdb360f8391..c125181c7d9 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/kotlinJvm/pom.xml +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/kotlinJvm/pom.xml @@ -22,19 +22,8 @@ mavenCentral https://repo1.maven.org/maven2/ - - bintray.kotlin.kotlin-eap - KOTLIN_REPO - - - - bintray.kotlin.kotlin-eap - KOTLIN_REPO - - - src/main/kotlin src/test/kotlin diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/backendApplication/build.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/backendApplication/build.gradle.kts index f4e23912781..3d3a41b2d80 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/backendApplication/build.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/backendApplication/build.gradle.kts @@ -9,7 +9,6 @@ version = "1.0-SNAPSHOT" repositories { mavenCentral() - maven { url = uri("KOTLIN_REPO") } } dependencies { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/backendApplication/pom.xml b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/backendApplication/pom.xml index 398ff723610..1fb9049a4dc 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/backendApplication/pom.xml +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/backendApplication/pom.xml @@ -22,16 +22,12 @@ mavenCentral https://repo1.maven.org/maven2/ - - bintray.kotlin.kotlin-eap - KOTLIN_REPO - - bintray.kotlin.kotlin-eap - KOTLIN_REPO + mavenCentral + https://repo1.maven.org/maven2/ diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/backendApplication/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/backendApplication/settings.gradle.kts index f3088af95cb..fc5c9d6107b 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/backendApplication/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/backendApplication/settings.gradle.kts @@ -2,7 +2,6 @@ pluginManagement { repositories { gradlePluginPortal() mavenCentral() - maven { url = uri("KOTLIN_REPO") } } } diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/consoleApplication/build.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/consoleApplication/build.gradle.kts index 8b24ea2ae9c..5b2b067c043 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/consoleApplication/build.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/consoleApplication/build.gradle.kts @@ -10,7 +10,6 @@ version = "1.0-SNAPSHOT" repositories { mavenCentral() - maven { url = uri("KOTLIN_REPO") } } dependencies { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/consoleApplication/pom.xml b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/consoleApplication/pom.xml index 5a51c9107bd..6942df6d098 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/consoleApplication/pom.xml +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/consoleApplication/pom.xml @@ -22,16 +22,12 @@ mavenCentral https://repo1.maven.org/maven2/ - - bintray.kotlin.kotlin-eap - KOTLIN_REPO - - bintray.kotlin.kotlin-eap - KOTLIN_REPO + mavenCentral + https://repo1.maven.org/maven2/ diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/consoleApplication/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/consoleApplication/settings.gradle.kts index ab1848222f0..903b8e2214f 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/consoleApplication/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/consoleApplication/settings.gradle.kts @@ -2,7 +2,6 @@ pluginManagement { repositories { gradlePluginPortal() mavenCentral() - maven { url = uri("KOTLIN_REPO") } } } diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/frontendApplication/build.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/frontendApplication/build.gradle index 7adc9924943..68b4f639160 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/frontendApplication/build.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/frontendApplication/build.gradle @@ -8,7 +8,6 @@ version = '1.0-SNAPSHOT' repositories { jcenter() mavenCentral() - maven { url 'KOTLIN_REPO' } } dependencies { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/frontendApplication/build.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/frontendApplication/build.gradle.kts index 26ba7cf4943..3f73bd6e7e5 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/frontendApplication/build.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/frontendApplication/build.gradle.kts @@ -8,7 +8,6 @@ version = "1.0-SNAPSHOT" repositories { jcenter() mavenCentral() - maven { url = uri("KOTLIN_REPO") } } dependencies { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/frontendApplication/settings.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/frontendApplication/settings.gradle index 840d688c6bb..724f1eddf45 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/frontendApplication/settings.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/frontendApplication/settings.gradle @@ -2,7 +2,6 @@ pluginManagement { repositories { gradlePluginPortal() mavenCentral() - maven { url 'KOTLIN_REPO' } } } diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/frontendApplication/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/frontendApplication/settings.gradle.kts index 15cdb5c4ce0..ebb21c133ed 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/frontendApplication/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/frontendApplication/settings.gradle.kts @@ -2,7 +2,6 @@ pluginManagement { repositories { gradlePluginPortal() mavenCentral() - maven { url = uri("KOTLIN_REPO") } } } diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/fullStackWebApplication/build.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/fullStackWebApplication/build.gradle index e83d16c7f75..61edc3a6071 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/fullStackWebApplication/build.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/fullStackWebApplication/build.gradle @@ -11,7 +11,6 @@ version = '1.0-SNAPSHOT' repositories { jcenter() mavenCentral() - maven { url 'KOTLIN_REPO' } maven { url 'https://dl.bintray.com/kotlin/kotlin-js-wrappers' } maven { url 'https://dl.bintray.com/kotlin/kotlinx' } maven { url 'https://dl.bintray.com/kotlin/ktor' } diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/fullStackWebApplication/build.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/fullStackWebApplication/build.gradle.kts index cf57f06815d..75eb49fc43e 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/fullStackWebApplication/build.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/fullStackWebApplication/build.gradle.kts @@ -11,7 +11,6 @@ version = "1.0-SNAPSHOT" repositories { jcenter() mavenCentral() - maven { url = uri("KOTLIN_REPO") } maven { url = uri("https://dl.bintray.com/kotlin/kotlin-js-wrappers") } maven { url = uri("https://dl.bintray.com/kotlin/kotlinx") } maven { url = uri("https://dl.bintray.com/kotlin/ktor") } diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/fullStackWebApplication/settings.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/fullStackWebApplication/settings.gradle index 1c12eaf0390..cd8a015cf06 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/fullStackWebApplication/settings.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/fullStackWebApplication/settings.gradle @@ -2,7 +2,6 @@ pluginManagement { repositories { gradlePluginPortal() mavenCentral() - maven { url 'KOTLIN_REPO' } } } diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/fullStackWebApplication/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/fullStackWebApplication/settings.gradle.kts index 542e67fd1fc..f0432acd02a 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/fullStackWebApplication/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/fullStackWebApplication/settings.gradle.kts @@ -2,7 +2,6 @@ pluginManagement { repositories { gradlePluginPortal() mavenCentral() - maven { url = uri("KOTLIN_REPO") } } } diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformApplication/build.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformApplication/build.gradle index 7e059b47869..592cea65413 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformApplication/build.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformApplication/build.gradle @@ -7,7 +7,6 @@ version = '1.0-SNAPSHOT' repositories { mavenCentral() - maven { url 'KOTLIN_REPO' } } kotlin { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformApplication/build.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformApplication/build.gradle.kts index 3e3efaa4f35..8dbf7fa6d8d 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformApplication/build.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformApplication/build.gradle.kts @@ -7,7 +7,6 @@ version = "1.0-SNAPSHOT" repositories { mavenCentral() - maven { url = uri("KOTLIN_REPO") } } kotlin { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformApplication/settings.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformApplication/settings.gradle index 6f7b29c41a3..eaa435d1931 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformApplication/settings.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformApplication/settings.gradle @@ -2,7 +2,6 @@ pluginManagement { repositories { gradlePluginPortal() mavenCentral() - maven { url 'KOTLIN_REPO' } } } diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformApplication/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformApplication/settings.gradle.kts index fff457d8347..3c423f85c6f 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformApplication/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformApplication/settings.gradle.kts @@ -2,7 +2,6 @@ pluginManagement { repositories { gradlePluginPortal() mavenCentral() - maven { url = uri("KOTLIN_REPO") } } } diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformLibrary/build.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformLibrary/build.gradle index 7bb5a5ad128..db193a12658 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformLibrary/build.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformLibrary/build.gradle @@ -9,7 +9,6 @@ version = '1.0-SNAPSHOT' repositories { mavenCentral() - maven { url 'KOTLIN_REPO' } } kotlin { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformLibrary/build.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformLibrary/build.gradle.kts index 214ebde603c..54d5ce8ccc5 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformLibrary/build.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformLibrary/build.gradle.kts @@ -7,7 +7,6 @@ version = "1.0-SNAPSHOT" repositories { mavenCentral() - maven { url = uri("KOTLIN_REPO") } } kotlin { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformLibrary/settings.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformLibrary/settings.gradle index 1da46fa11bc..3dd573b3ec2 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformLibrary/settings.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformLibrary/settings.gradle @@ -2,7 +2,6 @@ pluginManagement { repositories { gradlePluginPortal() mavenCentral() - maven { url 'KOTLIN_REPO' } } } diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformLibrary/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformLibrary/settings.gradle.kts index 9f5d0628485..c45d64281d5 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformLibrary/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformLibrary/settings.gradle.kts @@ -2,7 +2,6 @@ pluginManagement { repositories { gradlePluginPortal() mavenCentral() - maven { url = uri("KOTLIN_REPO") } } } diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileApplication/expected/build.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileApplication/expected/build.gradle index b4534b8a1c2..be368660ada 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileApplication/expected/build.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileApplication/expected/build.gradle @@ -3,7 +3,7 @@ buildscript { gradlePluginPortal() jcenter() google() - maven { url 'KOTLIN_REPO' } + mavenCentral() } dependencies { classpath('org.jetbrains.kotlin:kotlin-gradle-plugin:KOTLIN_VERSION') @@ -19,6 +19,5 @@ allprojects { google() jcenter() mavenCentral() - maven { url 'KOTLIN_REPO' } } } \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileApplication/expected/build.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileApplication/expected/build.gradle.kts index af13723974b..bef7811f2a7 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileApplication/expected/build.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileApplication/expected/build.gradle.kts @@ -3,7 +3,7 @@ buildscript { gradlePluginPortal() jcenter() google() - maven { url = uri("KOTLIN_REPO") } + mavenCentral() } dependencies { classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:KOTLIN_VERSION") @@ -19,6 +19,5 @@ allprojects { google() jcenter() mavenCentral() - maven { url = uri("KOTLIN_REPO") } } } \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileApplication/expected/settings.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileApplication/expected/settings.gradle index 77530fec3a2..a20108a29df 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileApplication/expected/settings.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileApplication/expected/settings.gradle @@ -4,7 +4,6 @@ pluginManagement { jcenter() gradlePluginPortal() mavenCentral() - maven { url 'KOTLIN_REPO' } } } diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileApplication/expected/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileApplication/expected/settings.gradle.kts index f85bda775ef..ee1041fbea7 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileApplication/expected/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileApplication/expected/settings.gradle.kts @@ -4,7 +4,6 @@ pluginManagement { jcenter() gradlePluginPortal() mavenCentral() - maven { url = uri("KOTLIN_REPO") } } } diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileLibrary/expected/build.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileLibrary/expected/build.gradle index 977a727c227..21d227ef074 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileLibrary/expected/build.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileLibrary/expected/build.gradle @@ -11,7 +11,6 @@ repositories { google() jcenter() mavenCentral() - maven { url 'KOTLIN_REPO' } } kotlin { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileLibrary/expected/build.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileLibrary/expected/build.gradle.kts index da271346b3f..8b34a1cc5ed 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileLibrary/expected/build.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileLibrary/expected/build.gradle.kts @@ -11,7 +11,6 @@ repositories { google() jcenter() mavenCentral() - maven { url = uri("KOTLIN_REPO") } } kotlin { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileLibrary/expected/settings.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileLibrary/expected/settings.gradle index 67b7d6f3b1e..c2c8b082326 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileLibrary/expected/settings.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileLibrary/expected/settings.gradle @@ -4,7 +4,6 @@ pluginManagement { jcenter() gradlePluginPortal() mavenCentral() - maven { url 'KOTLIN_REPO' } } resolutionStrategy { eachPlugin { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileLibrary/expected/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileLibrary/expected/settings.gradle.kts index fbaac754e27..1488ee1a215 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileLibrary/expected/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformMobileLibrary/expected/settings.gradle.kts @@ -4,7 +4,6 @@ pluginManagement { jcenter() gradlePluginPortal() mavenCentral() - maven { url = uri("KOTLIN_REPO") } } resolutionStrategy { eachPlugin { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/nativeApplication/build.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/nativeApplication/build.gradle index db96d903422..912876d5c86 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/nativeApplication/build.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/nativeApplication/build.gradle @@ -9,7 +9,6 @@ version = '1.0-SNAPSHOT' repositories { mavenCentral() - maven { url 'KOTLIN_REPO' } } kotlin { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/nativeApplication/build.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/nativeApplication/build.gradle.kts index ba9d38af011..3a7cf1a6886 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/nativeApplication/build.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/nativeApplication/build.gradle.kts @@ -7,7 +7,6 @@ version = "1.0-SNAPSHOT" repositories { mavenCentral() - maven { url = uri("KOTLIN_REPO") } } kotlin { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/nativeApplication/settings.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/nativeApplication/settings.gradle index fe0fbee596d..6b5729d5436 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/nativeApplication/settings.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/nativeApplication/settings.gradle @@ -2,7 +2,6 @@ pluginManagement { repositories { gradlePluginPortal() mavenCentral() - maven { url 'KOTLIN_REPO' } } } diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/nativeApplication/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/nativeApplication/settings.gradle.kts index 77ee1055c51..4f5974ac49c 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/nativeApplication/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/nativeApplication/settings.gradle.kts @@ -2,7 +2,6 @@ pluginManagement { repositories { gradlePluginPortal() mavenCentral() - maven { url = uri("KOTLIN_REPO") } } } diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/tests/org/jetbrains/kotlin/tools/projectWizard/cli/AbstractBuildFileGenerationTest.kt b/libraries/tools/new-project-wizard/new-project-wizard-cli/tests/org/jetbrains/kotlin/tools/projectWizard/cli/AbstractBuildFileGenerationTest.kt index 919e396e7fa..4afbc62d74d 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/tests/org/jetbrains/kotlin/tools/projectWizard/cli/AbstractBuildFileGenerationTest.kt +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/tests/org/jetbrains/kotlin/tools/projectWizard/cli/AbstractBuildFileGenerationTest.kt @@ -53,9 +53,7 @@ abstract class AbstractBuildFileGenerationTest : UsefulTestCase() { KOTLIN_VERSION_PLACEHOLDER ).replaceAllTo( listOf( - Repositories.KOTLIN_EAP_BINTRAY.url, Repositories.KOTLIN_DEV_BINTRAY.url, - KotlinVersionProviderTestWizardService.KOTLIN_EAP_BINTRAY_WITH_CACHE_REDIRECTOR.url, KotlinVersionProviderTestWizardService.KOTLIN_DEV_BINTRAY_WITH_CACHE_REDIRECTOR.url, ), KOTLIN_REPO_PLACEHOLDER diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/tests/org/jetbrains/kotlin/tools/projectWizard/cli/KotlinVersionProviderTestWizardService.kt b/libraries/tools/new-project-wizard/new-project-wizard-cli/tests/org/jetbrains/kotlin/tools/projectWizard/cli/KotlinVersionProviderTestWizardService.kt index f4e6797e2eb..aad9bd8b7ff 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/tests/org/jetbrains/kotlin/tools/projectWizard/cli/KotlinVersionProviderTestWizardService.kt +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/tests/org/jetbrains/kotlin/tools/projectWizard/cli/KotlinVersionProviderTestWizardService.kt @@ -36,15 +36,14 @@ class KotlinVersionProviderTestWizardService() : KotlinVersionProviderService(), private fun getKotlinVersionRepositoryWithCacheRedirector(versionKind: KotlinVersionKind): Repository = when (versionKind) { KotlinVersionKind.STABLE -> DefaultRepository.MAVEN_CENTRAL - KotlinVersionKind.EAP -> KOTLIN_EAP_BINTRAY_WITH_CACHE_REDIRECTOR + KotlinVersionKind.EAP -> DefaultRepository.MAVEN_CENTRAL KotlinVersionKind.DEV -> KOTLIN_DEV_BINTRAY_WITH_CACHE_REDIRECTOR - KotlinVersionKind.M -> KOTLIN_EAP_BINTRAY_WITH_CACHE_REDIRECTOR + KotlinVersionKind.M -> DefaultRepository.MAVEN_CENTRAL } companion object { private const val CACHE_REDIRECTOR_BINTRAY_URL = "https://cache-redirector.jetbrains.com/dl.bintray.com" - val KOTLIN_EAP_BINTRAY_WITH_CACHE_REDIRECTOR = BintrayRepository("kotlin/kotlin-eap", CACHE_REDIRECTOR_BINTRAY_URL) val KOTLIN_DEV_BINTRAY_WITH_CACHE_REDIRECTOR = BintrayRepository("kotlin/kotlin-dev", CACHE_REDIRECTOR_BINTRAY_URL) diff --git a/libraries/tools/new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/core/service/KotlinVersionProviderService.kt b/libraries/tools/new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/core/service/KotlinVersionProviderService.kt index 42daa70fad8..4c152fe8fc6 100644 --- a/libraries/tools/new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/core/service/KotlinVersionProviderService.kt +++ b/libraries/tools/new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/core/service/KotlinVersionProviderService.kt @@ -5,6 +5,8 @@ package org.jetbrains.kotlin.tools.projectWizard.core.service +import com.google.gson.JsonObject +import com.google.gson.JsonParser.parseString import org.jetbrains.annotations.NonNls import org.jetbrains.kotlin.tools.projectWizard.Versions import org.jetbrains.kotlin.tools.projectWizard.core.TaskResult @@ -33,9 +35,7 @@ abstract class KotlinVersionProviderService : WizardService { ) protected open fun getKotlinVersionRepository(versionKind: KotlinVersionKind): Repository = when (versionKind) { - KotlinVersionKind.STABLE -> DefaultRepository.MAVEN_CENTRAL - KotlinVersionKind.EAP -> Repositories.KOTLIN_EAP_BINTRAY - KotlinVersionKind.M -> Repositories.KOTLIN_EAP_BINTRAY + KotlinVersionKind.STABLE, KotlinVersionKind.EAP, KotlinVersionKind.M -> DefaultRepository.MAVEN_CENTRAL KotlinVersionKind.DEV -> Repositories.KOTLIN_DEV_BINTRAY } @@ -69,13 +69,28 @@ val KotlinVersionKind.isStable get() = this == KotlinVersionKind.STABLE object EapVersionDownloader { - fun getLatestEapVersion() = downloadVersions(EAP_URL).firstOrNull() + fun getLatestEapVersion() = downloadVersionFromMavenCentral(EAP_URL).firstOrNull() fun getLatestDevVersion() = downloadVersions(DEV_URL).firstOrNull() private fun downloadPage(url: String): TaskResult = safe { BufferedReader(InputStreamReader(URL(url).openStream())).lines().collect(Collectors.joining("\n")) } + @Suppress("SameParameterValue") + private fun downloadVersionFromMavenCentral(url: String) = compute { + val (text) = downloadPage(url) + val (versionString) = parseLatestVersionFromJson(text) + if (versionString.isNotEmpty()) + listOf(Version.fromString(versionString)) + else + emptyList() + }.asNullable.orEmpty() + + private fun parseLatestVersionFromJson(text: String) = safe { + val json = parseString(text) as JsonObject + json.get("response").asJsonObject.get("docs").asJsonArray.get(0).asJsonObject.get("latestVersion").asString + } + @Suppress("SameParameterValue") private fun downloadVersions(url: String): List = compute { val (text) = downloadPage(url) @@ -88,7 +103,7 @@ object EapVersionDownloader { }.asNullable.orEmpty() @NonNls - private val EAP_URL = "https://dl.bintray.com/kotlin/kotlin-eap/org/jetbrains/kotlin/jvm/org.jetbrains.kotlin.jvm.gradle.plugin/" + private val EAP_URL = "https://search.maven.org/solrsearch/select?q=g:org.jetbrains.kotlin%20AND%20a:kotlin-gradle-plugin" @NonNls private val DEV_URL = "https://dl.bintray.com/kotlin/kotlin-dev/org/jetbrains/kotlin/jvm/org.jetbrains.kotlin.jvm.gradle.plugin/" diff --git a/libraries/tools/new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/plugins/kotlin/KotlinPlugin.kt b/libraries/tools/new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/plugins/kotlin/KotlinPlugin.kt index 47b9a904d0a..d777281bb41 100644 --- a/libraries/tools/new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/plugins/kotlin/KotlinPlugin.kt +++ b/libraries/tools/new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/plugins/kotlin/KotlinPlugin.kt @@ -16,7 +16,6 @@ import org.jetbrains.kotlin.tools.projectWizard.ir.buildsystem.BuildFileIR import org.jetbrains.kotlin.tools.projectWizard.ir.buildsystem.RepositoryIR import org.jetbrains.kotlin.tools.projectWizard.ir.buildsystem.withIrs import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.ModuleConfigurator -import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.inContextOfModuleConfigurator import org.jetbrains.kotlin.tools.projectWizard.phases.GenerationPhase import org.jetbrains.kotlin.tools.projectWizard.plugins.StructurePlugin import org.jetbrains.kotlin.tools.projectWizard.plugins.buildSystem.BuildSystemPlugin @@ -56,7 +55,7 @@ class KotlinPlugin(context: Context) : Plugin(context) { val version by property( // todo do not hardcode kind & repository - WizardKotlinVersion(Versions.KOTLIN, KotlinVersionKind.M, Repositories.KOTLIN_EAP_BINTRAY) + WizardKotlinVersion(Versions.KOTLIN, KotlinVersionKind.M, Repositories.KOTLIN_EAP_MAVEN_CENTRAL) ) val initKotlinVersions by pipelineTask(GenerationPhase.PREPARE_GENERATION) { diff --git a/libraries/tools/new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/settings/buildsystem/Repository.kt b/libraries/tools/new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/settings/buildsystem/Repository.kt index 5b8402e427d..f4a0fe533c4 100644 --- a/libraries/tools/new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/settings/buildsystem/Repository.kt +++ b/libraries/tools/new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/settings/buildsystem/Repository.kt @@ -48,7 +48,7 @@ object Repositories { val KTOR_BINTRAY = BintrayRepository("kotlin/ktor") val KOTLINX = BintrayRepository("kotlin/kotlinx") val KOTLIN_JS_WRAPPERS_BINTRAY = BintrayRepository("kotlin/kotlin-js-wrappers") - val KOTLIN_EAP_BINTRAY = BintrayRepository("kotlin/kotlin-eap") + val KOTLIN_EAP_MAVEN_CENTRAL = DefaultRepository.MAVEN_CENTRAL val KOTLIN_DEV_BINTRAY = BintrayRepository("kotlin/kotlin-dev") val JETBRAINS_COMPOSE_DEV = JetBrainsSpace("compose/dev") } From 38b59ddabf2e58d5141f33a98893397914d61a77 Mon Sep 17 00:00:00 2001 From: "anastasiia.spaseeva" Date: Wed, 9 Dec 2020 17:37:35 +0300 Subject: [PATCH 538/698] Wizard: Fix tests --- .../buildFileGeneration/android/expected/build.gradle | 3 +-- .../buildFileGeneration/android/expected/build.gradle.kts | 3 +-- .../buildFileGeneration/android/expected/settings.gradle | 1 - .../android/expected/settings.gradle.kts | 1 - .../jsNodeAndBrowserTargets/build.gradle | 1 - .../jsNodeAndBrowserTargets/build.gradle.kts | 1 - .../jsNodeAndBrowserTargets/settings.gradle | 8 -------- .../jsNodeAndBrowserTargets/settings.gradle.kts | 8 -------- .../testData/buildFileGeneration/jvmTarget/build.gradle | 1 - .../buildFileGeneration/jvmTarget/build.gradle.kts | 1 - .../buildFileGeneration/jvmTarget/settings.gradle | 8 -------- .../buildFileGeneration/jvmTarget/settings.gradle.kts | 8 -------- .../buildFileGeneration/jvmTargetWithJava/build.gradle | 1 - .../jvmTargetWithJava/build.gradle.kts | 1 - .../buildFileGeneration/jvmTargetWithJava/settings.gradle | 8 -------- .../jvmTargetWithJava/settings.gradle.kts | 8 -------- .../jvmToJvmDependency/expected/build.gradle | 1 - .../jvmToJvmDependency/expected/build.gradle.kts | 1 - .../jvmToJvmDependency/expected/settings.gradle | 8 -------- .../jvmToJvmDependency/expected/settings.gradle.kts | 8 -------- .../expected/settings.gradle | 8 -------- .../expected/settings.gradle.kts | 8 -------- .../buildFileGeneration/kotlinJvm/build.gradle.kts | 1 - .../buildFileGeneration/kotlinJvm/settings.gradle.kts | 8 -------- .../nativeForCurrentSystem/build.gradle | 1 - .../nativeForCurrentSystem/build.gradle.kts | 1 - .../nativeForCurrentSystem/settings.gradle | 8 -------- .../nativeForCurrentSystem/settings.gradle.kts | 8 -------- .../buildFileGeneration/simpleMultiplatform/build.gradle | 1 - .../simpleMultiplatform/build.gradle.kts | 1 - .../simpleMultiplatform/settings.gradle | 8 -------- .../simpleMultiplatform/settings.gradle.kts | 8 -------- .../buildFileGeneration/simpleNativeTarget/build.gradle | 1 - .../simpleNativeTarget/build.gradle.kts | 1 - .../simpleNativeTarget/settings.gradle | 8 -------- .../simpleNativeTarget/settings.gradle.kts | 8 -------- .../singlePlatformJsBrowser/expected/build.gradle | 1 - .../singlePlatformJsBrowser/expected/build.gradle.kts | 1 - .../singlePlatformJsBrowser/expected/settings.gradle | 8 -------- .../singlePlatformJsBrowser/expected/settings.gradle.kts | 8 -------- .../singlePlatformJsNode/expected/build.gradle | 1 - .../singlePlatformJsNode/expected/build.gradle.kts | 1 - .../singlePlatformJsNode/expected/settings.gradle | 8 -------- .../singlePlatformJsNode/expected/settings.gradle.kts | 8 -------- .../backendApplication/pom.xml | 7 ------- .../backendApplication/settings.gradle.kts | 7 ------- .../consoleApplication/pom.xml | 7 ------- .../consoleApplication/settings.gradle.kts | 7 ------- .../frontendApplication/settings.gradle | 7 ------- .../frontendApplication/settings.gradle.kts | 7 ------- .../fullStackWebApplication/settings.gradle | 7 ------- .../fullStackWebApplication/settings.gradle.kts | 7 ------- .../multiplatformApplication/settings.gradle | 7 ------- .../multiplatformApplication/settings.gradle.kts | 7 ------- .../multiplatformLibrary/settings.gradle | 7 ------- .../multiplatformLibrary/settings.gradle.kts | 7 ------- .../nativeApplication/settings.gradle | 7 ------- .../nativeApplication/settings.gradle.kts | 7 ------- 58 files changed, 2 insertions(+), 291 deletions(-) diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/android/expected/build.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/android/expected/build.gradle index 2d66efb8925..044a43e436f 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/android/expected/build.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/android/expected/build.gradle @@ -3,7 +3,7 @@ buildscript { gradlePluginPortal() jcenter() google() - maven { url 'KOTLIN_REPO' } + mavenCentral() } dependencies { classpath('org.jetbrains.kotlin:kotlin-gradle-plugin:KOTLIN_VERSION') @@ -19,6 +19,5 @@ allprojects { google() jcenter() mavenCentral() - maven { url 'KOTLIN_REPO' } } } \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/android/expected/build.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/android/expected/build.gradle.kts index 7c6e8d937e5..78eaaa29a9b 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/android/expected/build.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/android/expected/build.gradle.kts @@ -3,7 +3,7 @@ buildscript { gradlePluginPortal() jcenter() google() - maven { url = uri("KOTLIN_REPO") } + mavenCentral() } dependencies { classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:KOTLIN_VERSION") @@ -19,6 +19,5 @@ allprojects { google() jcenter() mavenCentral() - maven { url = uri("KOTLIN_REPO") } } } \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/android/expected/settings.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/android/expected/settings.gradle index b7e0580aae5..5ecc21806c3 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/android/expected/settings.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/android/expected/settings.gradle @@ -4,7 +4,6 @@ pluginManagement { jcenter() gradlePluginPortal() mavenCentral() - maven { url 'KOTLIN_REPO' } } } diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/android/expected/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/android/expected/settings.gradle.kts index 22fb1b43006..f739a307f91 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/android/expected/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/android/expected/settings.gradle.kts @@ -4,7 +4,6 @@ pluginManagement { jcenter() gradlePluginPortal() mavenCentral() - maven { url = uri("KOTLIN_REPO") } } } diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jsNodeAndBrowserTargets/build.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jsNodeAndBrowserTargets/build.gradle index c389d8b38d2..4bd9b3b25f7 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jsNodeAndBrowserTargets/build.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jsNodeAndBrowserTargets/build.gradle @@ -7,7 +7,6 @@ version = '1.0-SNAPSHOT' repositories { mavenCentral() - maven { url 'KOTLIN_REPO' } } kotlin { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jsNodeAndBrowserTargets/build.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jsNodeAndBrowserTargets/build.gradle.kts index f4d510bae5a..ae81a356f01 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jsNodeAndBrowserTargets/build.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jsNodeAndBrowserTargets/build.gradle.kts @@ -7,7 +7,6 @@ version = "1.0-SNAPSHOT" repositories { mavenCentral() - maven { url = uri("KOTLIN_REPO") } } kotlin { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jsNodeAndBrowserTargets/settings.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jsNodeAndBrowserTargets/settings.gradle index 567d05668b4..c8f757733f2 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jsNodeAndBrowserTargets/settings.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jsNodeAndBrowserTargets/settings.gradle @@ -1,9 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - maven { url 'KOTLIN_REPO' } - } - -} rootProject.name = 'generatedProject' \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jsNodeAndBrowserTargets/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jsNodeAndBrowserTargets/settings.gradle.kts index 25f0ad14f1d..b9c39b1ab0d 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jsNodeAndBrowserTargets/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jsNodeAndBrowserTargets/settings.gradle.kts @@ -1,9 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - maven { url = uri("KOTLIN_REPO") } - } - -} rootProject.name = "generatedProject" \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTarget/build.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTarget/build.gradle index 774e4ae6807..e5697dce6bc 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTarget/build.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTarget/build.gradle @@ -7,7 +7,6 @@ version = '1.0-SNAPSHOT' repositories { mavenCentral() - maven { url 'KOTLIN_REPO' } } kotlin { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTarget/build.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTarget/build.gradle.kts index 1e047594290..10df219e3ba 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTarget/build.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTarget/build.gradle.kts @@ -7,7 +7,6 @@ version = "1.0-SNAPSHOT" repositories { mavenCentral() - maven { url = uri("KOTLIN_REPO") } } kotlin { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTarget/settings.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTarget/settings.gradle index 567d05668b4..c8f757733f2 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTarget/settings.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTarget/settings.gradle @@ -1,9 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - maven { url 'KOTLIN_REPO' } - } - -} rootProject.name = 'generatedProject' \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTarget/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTarget/settings.gradle.kts index 25f0ad14f1d..b9c39b1ab0d 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTarget/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTarget/settings.gradle.kts @@ -1,9 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - maven { url = uri("KOTLIN_REPO") } - } - -} rootProject.name = "generatedProject" \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTargetWithJava/build.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTargetWithJava/build.gradle index 380448acbbd..cb58bd988e5 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTargetWithJava/build.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTargetWithJava/build.gradle @@ -7,7 +7,6 @@ version = '1.0-SNAPSHOT' repositories { mavenCentral() - maven { url 'KOTLIN_REPO' } } kotlin { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTargetWithJava/build.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTargetWithJava/build.gradle.kts index 3cdc8ff940a..75135cc3d34 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTargetWithJava/build.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTargetWithJava/build.gradle.kts @@ -7,7 +7,6 @@ version = "1.0-SNAPSHOT" repositories { mavenCentral() - maven { url = uri("KOTLIN_REPO") } } kotlin { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTargetWithJava/settings.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTargetWithJava/settings.gradle index 567d05668b4..c8f757733f2 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTargetWithJava/settings.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTargetWithJava/settings.gradle @@ -1,9 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - maven { url 'KOTLIN_REPO' } - } - -} rootProject.name = 'generatedProject' \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTargetWithJava/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTargetWithJava/settings.gradle.kts index 25f0ad14f1d..b9c39b1ab0d 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTargetWithJava/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmTargetWithJava/settings.gradle.kts @@ -1,9 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - maven { url = uri("KOTLIN_REPO") } - } - -} rootProject.name = "generatedProject" \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/build.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/build.gradle index 756027e8093..5aa6d74be30 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/build.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/build.gradle @@ -4,6 +4,5 @@ version = '1.0-SNAPSHOT' allprojects { repositories { mavenCentral() - maven { url 'KOTLIN_REPO' } } } \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/build.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/build.gradle.kts index 39dc58df36a..64899f68649 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/build.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/build.gradle.kts @@ -4,6 +4,5 @@ version = "1.0-SNAPSHOT" allprojects { repositories { mavenCentral() - maven { url = uri("KOTLIN_REPO") } } } \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/settings.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/settings.gradle index 0bf2a718c29..d2431889430 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/settings.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/settings.gradle @@ -1,11 +1,3 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - maven { url 'KOTLIN_REPO' } - } - -} rootProject.name = 'generatedProject' diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/settings.gradle.kts index 1fd5581c7d4..82bd5ec47a1 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependency/expected/settings.gradle.kts @@ -1,11 +1,3 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - maven { url = uri("KOTLIN_REPO") } - } - -} rootProject.name = "generatedProject" diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependencyWithSingleRoot/expected/settings.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependencyWithSingleRoot/expected/settings.gradle index fffb79133b0..d4e8ebb242b 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependencyWithSingleRoot/expected/settings.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependencyWithSingleRoot/expected/settings.gradle @@ -1,11 +1,3 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - maven { url 'KOTLIN_REPO' } - } - -} rootProject.name = 'generatedProject' diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependencyWithSingleRoot/expected/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependencyWithSingleRoot/expected/settings.gradle.kts index fde8b4be4e5..4c22f40e48a 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependencyWithSingleRoot/expected/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/jvmToJvmDependencyWithSingleRoot/expected/settings.gradle.kts @@ -1,11 +1,3 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - maven { url = uri("KOTLIN_REPO") } - } - -} rootProject.name = "generatedProject" diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/kotlinJvm/build.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/kotlinJvm/build.gradle.kts index 3264d703acc..c7f7a3d2a4d 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/kotlinJvm/build.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/kotlinJvm/build.gradle.kts @@ -9,7 +9,6 @@ version = "1.0-SNAPSHOT" repositories { mavenCentral() - maven { url = uri("KOTLIN_REPO") } } dependencies { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/kotlinJvm/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/kotlinJvm/settings.gradle.kts index 25f0ad14f1d..b9c39b1ab0d 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/kotlinJvm/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/kotlinJvm/settings.gradle.kts @@ -1,9 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - maven { url = uri("KOTLIN_REPO") } - } - -} rootProject.name = "generatedProject" \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/nativeForCurrentSystem/build.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/nativeForCurrentSystem/build.gradle index 6a6aa0ac9d5..ca3713490f1 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/nativeForCurrentSystem/build.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/nativeForCurrentSystem/build.gradle @@ -9,7 +9,6 @@ version = '1.0-SNAPSHOT' repositories { mavenCentral() - maven { url 'KOTLIN_REPO' } } kotlin { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/nativeForCurrentSystem/build.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/nativeForCurrentSystem/build.gradle.kts index 6d93c460068..d4098e623b4 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/nativeForCurrentSystem/build.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/nativeForCurrentSystem/build.gradle.kts @@ -7,7 +7,6 @@ version = "1.0-SNAPSHOT" repositories { mavenCentral() - maven { url = uri("KOTLIN_REPO") } } kotlin { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/nativeForCurrentSystem/settings.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/nativeForCurrentSystem/settings.gradle index 567d05668b4..c8f757733f2 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/nativeForCurrentSystem/settings.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/nativeForCurrentSystem/settings.gradle @@ -1,9 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - maven { url 'KOTLIN_REPO' } - } - -} rootProject.name = 'generatedProject' \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/nativeForCurrentSystem/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/nativeForCurrentSystem/settings.gradle.kts index 25f0ad14f1d..b9c39b1ab0d 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/nativeForCurrentSystem/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/nativeForCurrentSystem/settings.gradle.kts @@ -1,9 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - maven { url = uri("KOTLIN_REPO") } - } - -} rootProject.name = "generatedProject" \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleMultiplatform/build.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleMultiplatform/build.gradle index 577b1fb75ca..c4bf8656749 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleMultiplatform/build.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleMultiplatform/build.gradle @@ -7,7 +7,6 @@ version = '1.0-SNAPSHOT' repositories { mavenCentral() - maven { url 'KOTLIN_REPO' } } kotlin { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleMultiplatform/build.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleMultiplatform/build.gradle.kts index e2a0ce16373..03f08a74805 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleMultiplatform/build.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleMultiplatform/build.gradle.kts @@ -7,7 +7,6 @@ version = "1.0-SNAPSHOT" repositories { mavenCentral() - maven { url = uri("KOTLIN_REPO") } } kotlin { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleMultiplatform/settings.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleMultiplatform/settings.gradle index d46d5b63b19..c8f757733f2 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleMultiplatform/settings.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleMultiplatform/settings.gradle @@ -1,9 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - maven { url 'KOTLIN_REPO' } - } - -} rootProject.name = 'generatedProject' \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleMultiplatform/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleMultiplatform/settings.gradle.kts index 25f0ad14f1d..b9c39b1ab0d 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleMultiplatform/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleMultiplatform/settings.gradle.kts @@ -1,9 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - maven { url = uri("KOTLIN_REPO") } - } - -} rootProject.name = "generatedProject" \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleNativeTarget/build.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleNativeTarget/build.gradle index c47c4886b80..7f105254566 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleNativeTarget/build.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleNativeTarget/build.gradle @@ -7,7 +7,6 @@ version = '1.0-SNAPSHOT' repositories { mavenCentral() - maven { url 'KOTLIN_REPO' } } kotlin { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleNativeTarget/build.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleNativeTarget/build.gradle.kts index 33f196629dd..5948d4cc8d4 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleNativeTarget/build.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleNativeTarget/build.gradle.kts @@ -7,7 +7,6 @@ version = "1.0-SNAPSHOT" repositories { mavenCentral() - maven { url = uri("KOTLIN_REPO") } } kotlin { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleNativeTarget/settings.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleNativeTarget/settings.gradle index 567d05668b4..c8f757733f2 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleNativeTarget/settings.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleNativeTarget/settings.gradle @@ -1,9 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - maven { url 'KOTLIN_REPO' } - } - -} rootProject.name = 'generatedProject' \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleNativeTarget/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleNativeTarget/settings.gradle.kts index 25f0ad14f1d..b9c39b1ab0d 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleNativeTarget/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/simpleNativeTarget/settings.gradle.kts @@ -1,9 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - maven { url = uri("KOTLIN_REPO") } - } - -} rootProject.name = "generatedProject" \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsBrowser/expected/build.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsBrowser/expected/build.gradle index dd17d748bbb..1ef23e53b65 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsBrowser/expected/build.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsBrowser/expected/build.gradle @@ -7,7 +7,6 @@ version = '1.0-SNAPSHOT' repositories { mavenCentral() - maven { url 'KOTLIN_REPO' } } dependencies { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsBrowser/expected/build.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsBrowser/expected/build.gradle.kts index c5953bfc21e..0f2de6a8fe9 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsBrowser/expected/build.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsBrowser/expected/build.gradle.kts @@ -7,7 +7,6 @@ version = "1.0-SNAPSHOT" repositories { mavenCentral() - maven { url = uri("KOTLIN_REPO") } } dependencies { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsBrowser/expected/settings.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsBrowser/expected/settings.gradle index 567d05668b4..c8f757733f2 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsBrowser/expected/settings.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsBrowser/expected/settings.gradle @@ -1,9 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - maven { url 'KOTLIN_REPO' } - } - -} rootProject.name = 'generatedProject' \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsBrowser/expected/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsBrowser/expected/settings.gradle.kts index 25f0ad14f1d..b9c39b1ab0d 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsBrowser/expected/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsBrowser/expected/settings.gradle.kts @@ -1,9 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - maven { url = uri("KOTLIN_REPO") } - } - -} rootProject.name = "generatedProject" \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsNode/expected/build.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsNode/expected/build.gradle index b4b36796706..b7cc6e41a31 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsNode/expected/build.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsNode/expected/build.gradle @@ -7,7 +7,6 @@ version = '1.0-SNAPSHOT' repositories { mavenCentral() - maven { url 'KOTLIN_REPO' } } dependencies { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsNode/expected/build.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsNode/expected/build.gradle.kts index 9c008385984..9a420c9b7b9 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsNode/expected/build.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsNode/expected/build.gradle.kts @@ -7,7 +7,6 @@ version = "1.0-SNAPSHOT" repositories { mavenCentral() - maven { url = uri("KOTLIN_REPO") } } dependencies { diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsNode/expected/settings.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsNode/expected/settings.gradle index 567d05668b4..c8f757733f2 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsNode/expected/settings.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsNode/expected/settings.gradle @@ -1,9 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - maven { url 'KOTLIN_REPO' } - } - -} rootProject.name = 'generatedProject' \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsNode/expected/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsNode/expected/settings.gradle.kts index 25f0ad14f1d..b9c39b1ab0d 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsNode/expected/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/buildFileGeneration/singlePlatformJsNode/expected/settings.gradle.kts @@ -1,9 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - maven { url = uri("KOTLIN_REPO") } - } - -} rootProject.name = "generatedProject" \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/backendApplication/pom.xml b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/backendApplication/pom.xml index 1fb9049a4dc..5c319544951 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/backendApplication/pom.xml +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/backendApplication/pom.xml @@ -24,13 +24,6 @@ - - - mavenCentral - https://repo1.maven.org/maven2/ - - - src/main/kotlin src/test/kotlin diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/backendApplication/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/backendApplication/settings.gradle.kts index fc5c9d6107b..aa24d421749 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/backendApplication/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/backendApplication/settings.gradle.kts @@ -1,8 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - } - -} rootProject.name = "backendApplication" \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/consoleApplication/pom.xml b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/consoleApplication/pom.xml index 6942df6d098..d1712791889 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/consoleApplication/pom.xml +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/consoleApplication/pom.xml @@ -24,13 +24,6 @@ - - - mavenCentral - https://repo1.maven.org/maven2/ - - - src/main/kotlin src/test/kotlin diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/consoleApplication/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/consoleApplication/settings.gradle.kts index 903b8e2214f..befe43c8a6f 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/consoleApplication/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/consoleApplication/settings.gradle.kts @@ -1,8 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - } - -} rootProject.name = "consoleApplication" \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/frontendApplication/settings.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/frontendApplication/settings.gradle index 724f1eddf45..4c7f557ba4c 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/frontendApplication/settings.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/frontendApplication/settings.gradle @@ -1,8 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - } - -} rootProject.name = 'frontendApplication' \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/frontendApplication/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/frontendApplication/settings.gradle.kts index ebb21c133ed..cf38e9a251a 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/frontendApplication/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/frontendApplication/settings.gradle.kts @@ -1,8 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - } - -} rootProject.name = "frontendApplication" \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/fullStackWebApplication/settings.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/fullStackWebApplication/settings.gradle index cd8a015cf06..206fb6359f7 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/fullStackWebApplication/settings.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/fullStackWebApplication/settings.gradle @@ -1,8 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - } - -} rootProject.name = 'fullStackWebApplication' \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/fullStackWebApplication/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/fullStackWebApplication/settings.gradle.kts index f0432acd02a..8ebd9dee641 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/fullStackWebApplication/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/fullStackWebApplication/settings.gradle.kts @@ -1,8 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - } - -} rootProject.name = "fullStackWebApplication" \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformApplication/settings.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformApplication/settings.gradle index eaa435d1931..7a5d14ea3cb 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformApplication/settings.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformApplication/settings.gradle @@ -1,8 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - } - -} rootProject.name = 'multiplatformApplication' \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformApplication/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformApplication/settings.gradle.kts index 3c423f85c6f..b9fd26915fc 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformApplication/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformApplication/settings.gradle.kts @@ -1,8 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - } - -} rootProject.name = "multiplatformApplication" \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformLibrary/settings.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformLibrary/settings.gradle index 3dd573b3ec2..3ecb8c04951 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformLibrary/settings.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformLibrary/settings.gradle @@ -1,8 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - } - -} rootProject.name = 'multiplatformLibrary' \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformLibrary/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformLibrary/settings.gradle.kts index c45d64281d5..a3f0720e973 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformLibrary/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/multiplatformLibrary/settings.gradle.kts @@ -1,8 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - } - -} rootProject.name = "multiplatformLibrary" \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/nativeApplication/settings.gradle b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/nativeApplication/settings.gradle index 6b5729d5436..298b45d38da 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/nativeApplication/settings.gradle +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/nativeApplication/settings.gradle @@ -1,8 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - } - -} rootProject.name = 'nativeApplication' \ No newline at end of file diff --git a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/nativeApplication/settings.gradle.kts b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/nativeApplication/settings.gradle.kts index 4f5974ac49c..654390f406f 100644 --- a/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/nativeApplication/settings.gradle.kts +++ b/libraries/tools/new-project-wizard/new-project-wizard-cli/testData/projectTemplatesBuildFileGeneration/nativeApplication/settings.gradle.kts @@ -1,8 +1 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - } - -} rootProject.name = "nativeApplication" \ No newline at end of file From 2b22cbcdd273a1fbc4d3468d61de96acf45c518e Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Wed, 9 Dec 2020 16:05:16 +0300 Subject: [PATCH 539/698] Advance bootstrap to 1.5.0-dev-309 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index ae2c02db3ae..34d85ab19c6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ kotlin.build.useIR=true #maven.repository.mirror=http://repository.jetbrains.com/remote-repos/ #bootstrap.kotlin.repo=https://dl.bintray.com/kotlin/kotlin-dev #bootstrap.kotlin.version=1.1.50-dev-1451 -bootstrap.kotlin.default.version=1.4.30-dev-2196 +bootstrap.kotlin.default.version=1.5.0-dev-309 kotlin.build.publishing.attempts=20 #signingRequired=true From 8fedfd2d2ac78a22aefe1bfe41e371bdcb172594 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Mon, 7 Dec 2020 19:11:56 +0100 Subject: [PATCH 540/698] Minor, add workaround for KT-43812 --- .../org/jetbrains/kotlin/idea/util/ProgressIndicatorUtils.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/util/ProgressIndicatorUtils.kt b/idea/src/org/jetbrains/kotlin/idea/util/ProgressIndicatorUtils.kt index 8d9d807fc99..95d62782a0d 100644 --- a/idea/src/org/jetbrains/kotlin/idea/util/ProgressIndicatorUtils.kt +++ b/idea/src/org/jetbrains/kotlin/idea/util/ProgressIndicatorUtils.kt @@ -23,12 +23,15 @@ import java.util.concurrent.TimeoutException * Copied from [com.intellij.openapi.progress.util.ProgressIndicatorUtils] */ object ProgressIndicatorUtils { + @Suppress("ObjectLiteralToLambda") // Workaround for KT-43812. @JvmStatic fun underModalProgress( project: Project, @Nls progressTitle: String, computable: () -> T - ): T = com.intellij.openapi.actionSystem.ex.ActionUtil.underModalProgress(project, progressTitle, computable) + ): T = com.intellij.openapi.actionSystem.ex.ActionUtil.underModalProgress(project, progressTitle, object : Computable { + override fun compute(): T = computable() + }) fun runUnderDisposeAwareIndicator( parent: Disposable, From 15021f30ff295553b8b19b616f8c2a3741bcb7ad Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 2 Dec 2020 17:22:18 +0300 Subject: [PATCH 541/698] Use FirNamedFunctionSymbol around processOverriddenFunctions --- .../fir/analysis/checkers/FirHelpers.kt | 4 +- .../kotlin/fir/backend/ConversionUtils.kt | 42 ++++++++++--------- .../JavaAnnotationSyntheticPropertiesScope.kt | 4 +- .../JavaClassMembersEnhancementScope.kt | 21 ++++------ .../kotlin/fir/scopes/jvm/JvmMappedScope.kt | 4 +- .../org/jetbrains/kotlin/fir/SessionUtils.kt | 13 ++---- .../resolve/FirDefaultParametersResolver.kt | 4 +- .../kotlin/fir/resolve/calls/Synthetics.kt | 5 ++- .../fir/resolve/inference/InferenceUtils.kt | 7 +++- .../resolve/transformers/FirStatusResolver.kt | 13 +++--- .../impl/AbstractFirUseSiteMemberScope.kt | 24 +++++------ .../scopes/impl/FirClassSubstitutionScope.kt | 4 +- .../scopes/impl/FirDelegatedMemberScope.kt | 4 +- .../FirScopeWithFakeOverrideTypeCalculator.kt | 4 +- .../scopes/impl/FirTypeIntersectionScope.kt | 4 +- .../jetbrains/kotlin/fir/scopes/FirScope.kt | 21 +++++----- .../kotlin/fir/scopes/FirTypeScope.kt | 18 ++++---- 17 files changed, 97 insertions(+), 99 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirHelpers.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirHelpers.kt index b214513dce0..a0023cc3134 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirHelpers.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirHelpers.kt @@ -28,6 +28,7 @@ import org.jetbrains.kotlin.fir.scopes.ProcessorAction import org.jetbrains.kotlin.fir.scopes.processOverriddenFunctions import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol +import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol import org.jetbrains.kotlin.fir.types.ConeClassLikeType import org.jetbrains.kotlin.fir.types.ConeKotlinType @@ -152,7 +153,7 @@ fun FirSymbolOwner<*>.getContainingClass(context: CheckerContext): FirClassLikeD * Returns the FirClassLikeDeclaration the type alias is pointing * to provided `this` is a FirTypeAlias. Returns this otherwise. */ -fun FirClassLikeDeclaration<*>.followAlias(session: FirSession): FirClassLikeDeclaration<*>? { +fun FirClassLikeDeclaration<*>.followAlias(session: FirSession): FirClassLikeDeclaration<*> { return this.safeAs() ?.expandedTypeRef ?.firClassLike(session) @@ -199,6 +200,7 @@ fun FirSimpleFunction.overriddenFunctions( containingClass: FirClass<*>, context: CheckerContext ): List> { + val symbol = symbol as? FirNamedFunctionSymbol ?: return emptyList() val firTypeScope = containingClass.unsubstitutedScope( context.sessionHolder.session, context.sessionHolder.scopeSession, diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt index 908b8a7c018..6d3a9201a61 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt @@ -140,26 +140,27 @@ fun FirReference.toSymbolForCall( } } -private fun FirCallableSymbol<*>.toSymbolForCall(declarationStorage: Fir2IrDeclarationStorage, preferGetter: Boolean): IrSymbol? = when (this) { - is FirFunctionSymbol<*> -> declarationStorage.getIrFunctionSymbol(this) - is SyntheticPropertySymbol -> { - (fir as? FirSyntheticProperty)?.let { syntheticProperty -> - val delegateSymbol = if (preferGetter) { - syntheticProperty.getter.delegate.symbol - } else { - syntheticProperty.setter?.delegate?.symbol - ?: throw AssertionError("Written synthetic property must have a setter") - } - delegateSymbol.unwrapCallRepresentative().toSymbolForCall(declarationStorage, preferGetter) - } ?: declarationStorage.getIrPropertySymbol(this) +private fun FirCallableSymbol<*>.toSymbolForCall(declarationStorage: Fir2IrDeclarationStorage, preferGetter: Boolean): IrSymbol? = + when (this) { + is FirFunctionSymbol<*> -> declarationStorage.getIrFunctionSymbol(this) + is SyntheticPropertySymbol -> { + (fir as? FirSyntheticProperty)?.let { syntheticProperty -> + val delegateSymbol = if (preferGetter) { + syntheticProperty.getter.delegate.symbol + } else { + syntheticProperty.setter?.delegate?.symbol + ?: throw AssertionError("Written synthetic property must have a setter") + } + delegateSymbol.unwrapCallRepresentative().toSymbolForCall(declarationStorage, preferGetter) + } ?: declarationStorage.getIrPropertySymbol(this) + } + is FirPropertySymbol -> declarationStorage.getIrPropertySymbol(this) + is FirFieldSymbol -> declarationStorage.getIrFieldSymbol(this) + is FirBackingFieldSymbol -> declarationStorage.getIrBackingFieldSymbol(this) + is FirDelegateFieldSymbol<*> -> declarationStorage.getIrBackingFieldSymbol(this) + is FirVariableSymbol<*> -> declarationStorage.getIrValueSymbol(this) + else -> null } - is FirPropertySymbol -> declarationStorage.getIrPropertySymbol(this) - is FirFieldSymbol -> declarationStorage.getIrFieldSymbol(this) - is FirBackingFieldSymbol -> declarationStorage.getIrBackingFieldSymbol(this) - is FirDelegateFieldSymbol<*> -> declarationStorage.getIrBackingFieldSymbol(this) - is FirVariableSymbol<*> -> declarationStorage.getIrValueSymbol(this) - else -> null -} fun FirConstExpression<*>.getIrConstKind(): IrConstKind<*> = when (kind) { FirConstKind.IntegerLiteral -> { @@ -249,8 +250,9 @@ internal fun FirSimpleFunction.generateOverriddenFunctionSymbols( val scope = containingClass.unsubstitutedScope(session, scopeSession, withForcedTypeCalculator = true) scope.processFunctionsByName(name) {} val overriddenSet = mutableSetOf() + val symbol = symbol as? FirNamedFunctionSymbol ?: return emptyList() scope.processDirectlyOverriddenFunctions(symbol) { - if ((it.fir as FirSimpleFunction).visibility == Visibilities.Private) { + if (it.fir.visibility == Visibilities.Private) { return@processDirectlyOverriddenFunctions ProcessorAction.NEXT } diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaAnnotationSyntheticPropertiesScope.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaAnnotationSyntheticPropertiesScope.kt index 35adabf64c1..1728ddcd160 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaAnnotationSyntheticPropertiesScope.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaAnnotationSyntheticPropertiesScope.kt @@ -55,8 +55,8 @@ class JavaAnnotationSyntheticPropertiesScope( } override fun processDirectOverriddenFunctionsWithBaseScope( - functionSymbol: FirFunctionSymbol<*>, - processor: (FirFunctionSymbol<*>, FirTypeScope) -> ProcessorAction + functionSymbol: FirNamedFunctionSymbol, + processor: (FirNamedFunctionSymbol, FirTypeScope) -> ProcessorAction ): ProcessorAction { return ProcessorAction.NONE } diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassMembersEnhancementScope.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassMembersEnhancementScope.kt index f66b0687f45..c7341de513d 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassMembersEnhancementScope.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassMembersEnhancementScope.kt @@ -36,7 +36,7 @@ class JavaClassMembersEnhancementScope( private val owner: FirRegularClassSymbol, private val useSiteMemberScope: JavaClassUseSiteMemberScope, ) : FirTypeScope() { - private val overriddenFunctions = mutableMapOf, Collection>>() + private val overriddenFunctions = mutableMapOf>() private val overriddenProperties = mutableMapOf>() private val overrideBindCache = mutableMapOf?, List>>>() @@ -149,16 +149,11 @@ class JavaClassMembersEnhancementScope( val enhancedFunction = (symbol.fir as? FirSimpleFunction)?.changeSignatureIfErasedValueParameter() val enhancedFunctionSymbol = enhancedFunction?.symbol ?: symbol - val originalFunction = original.fir as? FirSimpleFunction - - overriddenFunctions[enhancedFunctionSymbol] = - if (enhancedFunction != null && originalFunction != null) - originalFunction - .overriddenMembers(enhancedFunction.name) - .mapNotNull { it.symbol as? FirFunctionSymbol<*> } - else - emptyList() - + if (enhancedFunctionSymbol is FirNamedFunctionSymbol && original is FirNamedFunctionSymbol) { + overriddenFunctions[enhancedFunctionSymbol] = original.fir + .overriddenMembers(enhancedFunctionSymbol.fir.name) + .mapNotNull { it.symbol as? FirNamedFunctionSymbol } + } processor(enhancedFunctionSymbol) } @@ -188,8 +183,8 @@ class JavaClassMembersEnhancementScope( } override fun processDirectOverriddenFunctionsWithBaseScope( - functionSymbol: FirFunctionSymbol<*>, - processor: (FirFunctionSymbol<*>, FirTypeScope) -> ProcessorAction + functionSymbol: FirNamedFunctionSymbol, + processor: (FirNamedFunctionSymbol, FirTypeScope) -> ProcessorAction ): ProcessorAction = doProcessDirectOverriddenCallables( functionSymbol, processor, overriddenFunctions, useSiteMemberScope, diff --git a/compiler/fir/jvm/src/org/jetbrains/kotlin/fir/scopes/jvm/JvmMappedScope.kt b/compiler/fir/jvm/src/org/jetbrains/kotlin/fir/scopes/jvm/JvmMappedScope.kt index b0764383e8b..141be33094d 100644 --- a/compiler/fir/jvm/src/org/jetbrains/kotlin/fir/scopes/jvm/JvmMappedScope.kt +++ b/compiler/fir/jvm/src/org/jetbrains/kotlin/fir/scopes/jvm/JvmMappedScope.kt @@ -42,8 +42,8 @@ class JvmMappedScope( } override fun processDirectOverriddenFunctionsWithBaseScope( - functionSymbol: FirFunctionSymbol<*>, - processor: (FirFunctionSymbol<*>, FirTypeScope) -> ProcessorAction + functionSymbol: FirNamedFunctionSymbol, + processor: (FirNamedFunctionSymbol, FirTypeScope) -> ProcessorAction ) = ProcessorAction.NONE override fun processDeclaredConstructors(processor: (FirConstructorSymbol) -> Unit) { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/SessionUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/SessionUtils.kt index fd31dc34384..050a43bf830 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/SessionUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/SessionUtils.kt @@ -12,6 +12,7 @@ import org.jetbrains.kotlin.fir.resolve.inference.inferenceComponents import org.jetbrains.kotlin.fir.scopes.ProcessorAction import org.jetbrains.kotlin.fir.scopes.processOverriddenFunctions import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope +import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol import org.jetbrains.kotlin.fir.types.ConeInferenceContext import org.jetbrains.kotlin.fir.types.ConeTypeCheckerContext @@ -29,6 +30,7 @@ fun FirSimpleFunction.lowestVisibilityAmongOverrides( session: FirSession, scopeSession: ScopeSession ): Visibility { + val symbol = symbol as? FirNamedFunctionSymbol ?: return visibility val firTypeScope = containingClass.unsubstitutedScope(session, scopeSession, withForcedTypeCalculator = false) var visibility = visibility @@ -37,16 +39,7 @@ fun FirSimpleFunction.lowestVisibilityAmongOverrides( firTypeScope.processFunctionsByName(symbol.fir.name) { } firTypeScope.processOverriddenFunctions(symbol) { - val overriddenVisibility = when (val fir = it.fir) { - is FirMemberDeclaration -> fir.visibility - is FirPropertyAccessor -> fir.visibility - else -> null - } - - overriddenVisibility?.let { that -> - visibility = that - } - + visibility = it.fir.visibility ProcessorAction.NEXT } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/FirDefaultParametersResolver.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/FirDefaultParametersResolver.kt index 78c76cfe569..bc4ae62c53f 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/FirDefaultParametersResolver.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/FirDefaultParametersResolver.kt @@ -13,6 +13,7 @@ import org.jetbrains.kotlin.fir.scopes.FirScope import org.jetbrains.kotlin.fir.scopes.FirTypeScope import org.jetbrains.kotlin.fir.scopes.ProcessorAction import org.jetbrains.kotlin.fir.scopes.processOverriddenFunctions +import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol class FirDefaultParametersResolver : FirSessionComponent { fun declaresDefaultValue( @@ -23,9 +24,10 @@ class FirDefaultParametersResolver : FirSessionComponent { ): Boolean { if (valueParameter.defaultValue != null) return true if (originScope !is FirTypeScope) return false + val symbol = function.symbol as? FirNamedFunctionSymbol ?: return false var result = false - originScope.processOverriddenFunctions(function.symbol) { overridden -> + originScope.processOverriddenFunctions(symbol) { overridden -> if (overridden.fir.valueParameters[index].defaultValue != null) { result = true return@processOverriddenFunctions ProcessorAction.STOP diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Synthetics.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Synthetics.kt index 99afcf68f14..604d216b827 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Synthetics.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Synthetics.kt @@ -56,7 +56,8 @@ class FirSyntheticPropertiesScope( getterSymbol: FirFunctionSymbol<*>, processor: (FirVariableSymbol<*>) -> Unit ) { - val getter = getterSymbol.fir as? FirSimpleFunction ?: return + if (getterSymbol !is FirNamedFunctionSymbol) return + val getter = getterSymbol.fir if (getter.typeParameters.isNotEmpty()) return if (getter.valueParameters.isNotEmpty()) return @@ -121,7 +122,7 @@ class FirSyntheticPropertiesScope( processor(property.symbol) } - private fun FirFunctionSymbol<*>.hasJavaOverridden(): Boolean { + private fun FirNamedFunctionSymbol.hasJavaOverridden(): Boolean { var result = false baseScope.processOverriddenFunctionsAndSelf(this) { if (it.unwrapFakeOverrides().fir.origin == FirDeclarationOrigin.Enhancement) { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/InferenceUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/InferenceUtils.kt index dc9e4f15eda..0ebce74b100 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/InferenceUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/InferenceUtils.kt @@ -19,6 +19,7 @@ import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope import org.jetbrains.kotlin.fir.symbols.StandardClassIds import org.jetbrains.kotlin.fir.symbols.impl.ConeClassLikeLookupTagImpl import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol +import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol import org.jetbrains.kotlin.fir.typeContext import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl @@ -125,9 +126,11 @@ fun ConeKotlinType.findContributedInvokeSymbol( FakeOverrideTypeCalculator.DoNothing } val scope = scope(session, scopeSession, fakeOverrideTypeCalculator) ?: return null - var declaredInvoke: FirFunctionSymbol<*>? = null + var declaredInvoke: FirNamedFunctionSymbol? = null scope.processFunctionsByName(OperatorNameConventions.INVOKE) { functionSymbol -> - if (functionSymbol.fir.valueParameters.size == baseInvokeSymbol.fir.valueParameters.size) { + if (functionSymbol is FirNamedFunctionSymbol && + functionSymbol.fir.valueParameters.size == baseInvokeSymbol.fir.valueParameters.size + ) { declaredInvoke = functionSymbol return@processFunctionsByName } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolver.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolver.kt index 28313a5819f..e6ec933f3bd 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolver.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolver.kt @@ -17,6 +17,7 @@ import org.jetbrains.kotlin.fir.render import org.jetbrains.kotlin.fir.resolve.ScopeSession import org.jetbrains.kotlin.fir.scopes.ProcessorAction import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope +import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol class FirStatusResolver( val session: FirSession, @@ -73,14 +74,14 @@ class FirStatusResolver( @Suppress("RemoveExplicitTypeArguments") // Workaround for KT-42175 buildList> { val scope = containingClass.unsubstitutedScope(session, scopeSession, withForcedTypeCalculator = false) - scope.processFunctionsByName(function.name) {} - scope - .processDirectOverriddenFunctionsWithBaseScope(function.symbol) { symbol, _ -> - (symbol.fir as? FirCallableMemberDeclaration<*>)?.let { - this += it - } + val symbol = function.symbol + if (symbol is FirNamedFunctionSymbol) { + scope.processFunctionsByName(function.name) {} + scope.processDirectOverriddenFunctionsWithBaseScope(symbol) { overriddenSymbol, _ -> + this += overriddenSymbol.fir ProcessorAction.NEXT } + } }.mapNotNull { it.status as? FirResolvedDeclarationStatus } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/AbstractFirUseSiteMemberScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/AbstractFirUseSiteMemberScope.kt index 3b66f5868ae..b60a7d1a39d 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/AbstractFirUseSiteMemberScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/AbstractFirUseSiteMemberScope.kt @@ -6,7 +6,6 @@ package org.jetbrains.kotlin.fir.scopes.impl import org.jetbrains.kotlin.fir.FirSession -import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor import org.jetbrains.kotlin.fir.scopes.* import org.jetbrains.kotlin.fir.symbols.impl.* @@ -20,7 +19,7 @@ abstract class AbstractFirUseSiteMemberScope( ) : AbstractFirOverrideScope(session, overrideChecker) { private val functions = hashMapOf>>() - private val directOverriddenFunctions = hashMapOf, Collection>>() + private val directOverriddenFunctions = hashMapOf>() protected val directOverriddenProperties = hashMapOf>() override fun processFunctionsByName(name: Name, processor: (FirFunctionSymbol<*>) -> Unit) { @@ -37,8 +36,10 @@ abstract class AbstractFirUseSiteMemberScope( val overrideCandidates = mutableSetOf>() declaredMemberScope.processFunctionsByName(name) { symbol -> if (symbol.isStatic) return@processFunctionsByName - val directOverridden = computeDirectOverridden(symbol) - this@AbstractFirUseSiteMemberScope.directOverriddenFunctions[symbol] = directOverridden + if (symbol is FirNamedFunctionSymbol) { + val directOverridden = computeDirectOverridden(symbol) + this@AbstractFirUseSiteMemberScope.directOverriddenFunctions[symbol] = directOverridden + } overrideCandidates += symbol add(symbol) } @@ -53,13 +54,12 @@ abstract class AbstractFirUseSiteMemberScope( } } - private fun computeDirectOverridden(symbol: FirFunctionSymbol<*>): Collection> { - val result = mutableListOf>() - val firSimpleFunction = symbol.fir as? FirSimpleFunction ?: return emptyList() + private fun computeDirectOverridden(symbol: FirNamedFunctionSymbol): Collection { + val result = mutableListOf() + val firSimpleFunction = symbol.fir superTypesScope.processFunctionsByName(symbol.callableId.callableName) { superSymbol -> - val superFunctionFir = superSymbol.fir - if (superFunctionFir is FirSimpleFunction && - overrideChecker.isOverriddenFunction(firSimpleFunction, superFunctionFir) + if (superSymbol is FirNamedFunctionSymbol && + overrideChecker.isOverriddenFunction(firSimpleFunction, superSymbol.fir) ) { result.add(superSymbol) } @@ -69,8 +69,8 @@ abstract class AbstractFirUseSiteMemberScope( } override fun processDirectOverriddenFunctionsWithBaseScope( - functionSymbol: FirFunctionSymbol<*>, - processor: (FirFunctionSymbol<*>, FirTypeScope) -> ProcessorAction + functionSymbol: FirNamedFunctionSymbol, + processor: (FirNamedFunctionSymbol, FirTypeScope) -> ProcessorAction ): ProcessorAction = doProcessDirectOverriddenCallables( functionSymbol, processor, directOverriddenFunctions, superTypesScope, diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassSubstitutionScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassSubstitutionScope.kt index 808ddf6985e..c62711f7d2f 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassSubstitutionScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassSubstitutionScope.kt @@ -44,8 +44,8 @@ class FirClassSubstitutionScope( } override fun processDirectOverriddenFunctionsWithBaseScope( - functionSymbol: FirFunctionSymbol<*>, - processor: (FirFunctionSymbol<*>, FirTypeScope) -> ProcessorAction + functionSymbol: FirNamedFunctionSymbol, + processor: (FirNamedFunctionSymbol, FirTypeScope) -> ProcessorAction ): ProcessorAction = processDirectOverriddenWithBaseScope( functionSymbol, processor, FirTypeScope::processDirectOverriddenFunctionsWithBaseScope, substitutionOverrideFunctions diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirDelegatedMemberScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirDelegatedMemberScope.kt index cda5129b689..3e20196a1d2 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirDelegatedMemberScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirDelegatedMemberScope.kt @@ -108,8 +108,8 @@ class FirDelegatedMemberScope( } override fun processDirectOverriddenFunctionsWithBaseScope( - functionSymbol: FirFunctionSymbol<*>, - processor: (FirFunctionSymbol<*>, FirTypeScope) -> ProcessorAction + functionSymbol: FirNamedFunctionSymbol, + processor: (FirNamedFunctionSymbol, FirTypeScope) -> ProcessorAction ): ProcessorAction { return processDirectOverriddenWithBaseScope( functionSymbol, processor, FirTypeScope::processDirectOverriddenFunctionsWithBaseScope diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirScopeWithFakeOverrideTypeCalculator.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirScopeWithFakeOverrideTypeCalculator.kt index 26871a7fa40..cf9466297d9 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirScopeWithFakeOverrideTypeCalculator.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirScopeWithFakeOverrideTypeCalculator.kt @@ -47,8 +47,8 @@ class FirScopeWithFakeOverrideTypeCalculator( } override fun processDirectOverriddenFunctionsWithBaseScope( - functionSymbol: FirFunctionSymbol<*>, - processor: (FirFunctionSymbol<*>, FirTypeScope) -> ProcessorAction + functionSymbol: FirNamedFunctionSymbol, + processor: (FirNamedFunctionSymbol, FirTypeScope) -> ProcessorAction ): ProcessorAction { return delegate.processDirectOverriddenFunctionsWithBaseScope(functionSymbol) { symbol, scope -> updateReturnType(symbol.fir) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScope.kt index ed44c7157cc..64498314fc6 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScope.kt @@ -444,8 +444,8 @@ class FirTypeIntersectionScope private constructor( } override fun processDirectOverriddenFunctionsWithBaseScope( - functionSymbol: FirFunctionSymbol<*>, - processor: (FirFunctionSymbol<*>, FirTypeScope) -> ProcessorAction + functionSymbol: FirNamedFunctionSymbol, + processor: (FirNamedFunctionSymbol, FirTypeScope) -> ProcessorAction ): ProcessorAction = processDirectOverriddenCallablesWithBaseScope( functionSymbol, processor, diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirScope.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirScope.kt index 6cb30557051..3345ec25923 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirScope.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirScope.kt @@ -6,31 +6,32 @@ package org.jetbrains.kotlin.fir.scopes import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor -import org.jetbrains.kotlin.fir.symbols.impl.FirClassifierSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirConstructorSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirVariableSymbol +import org.jetbrains.kotlin.fir.symbols.impl.* import org.jetbrains.kotlin.name.Name abstract class FirScope { open fun processClassifiersByNameWithSubstitution( name: Name, processor: (FirClassifierSymbol<*>, ConeSubstitutor) -> Unit - ) {} + ) { + } open fun processFunctionsByName( name: Name, processor: (FirFunctionSymbol<*>) -> Unit - ) {} + ) { + } open fun processPropertiesByName( name: Name, processor: (FirVariableSymbol<*>) -> Unit - ) {} + ) { + } open fun processDeclaredConstructors( processor: (FirConstructorSymbol) -> Unit - ) {} + ) { + } open fun mayContainName(name: Name) = true } @@ -52,8 +53,8 @@ fun FirScope.getDeclaredConstructors(): List = mutableList } fun FirTypeScope.processOverriddenFunctionsAndSelf( - functionSymbol: FirFunctionSymbol<*>, - processor: (FirFunctionSymbol<*>) -> ProcessorAction + functionSymbol: FirNamedFunctionSymbol, + processor: (FirNamedFunctionSymbol) -> ProcessorAction ): ProcessorAction { if (!processor(functionSymbol)) return ProcessorAction.STOP diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirTypeScope.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirTypeScope.kt index 34fdbb741d0..a1b542042fc 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirTypeScope.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirTypeScope.kt @@ -7,7 +7,6 @@ package org.jetbrains.kotlin.fir.scopes import org.jetbrains.kotlin.fir.isIntersectionOverride import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol import org.jetbrains.kotlin.name.Name @@ -29,8 +28,8 @@ abstract class FirTypeScope : FirScope(), FirContainingNamesAwareScope { // - It may silently do nothing on symbols originated from different scope instance // - It may return the same overridden symbols more then once in case of substitution abstract fun processDirectOverriddenFunctionsWithBaseScope( - functionSymbol: FirFunctionSymbol<*>, - processor: (FirFunctionSymbol<*>, FirTypeScope) -> ProcessorAction + functionSymbol: FirNamedFunctionSymbol, + processor: (FirNamedFunctionSymbol, FirTypeScope) -> ProcessorAction ): ProcessorAction // ------------------------------------------------------------------------------------ @@ -44,8 +43,8 @@ abstract class FirTypeScope : FirScope(), FirContainingNamesAwareScope { object Empty : FirTypeScope() { override fun processDirectOverriddenFunctionsWithBaseScope( - functionSymbol: FirFunctionSymbol<*>, - processor: (FirFunctionSymbol<*>, FirTypeScope) -> ProcessorAction + functionSymbol: FirNamedFunctionSymbol, + processor: (FirNamedFunctionSymbol, FirTypeScope) -> ProcessorAction ): ProcessorAction = ProcessorAction.NEXT override fun processDirectOverriddenPropertiesWithBaseScope( @@ -84,8 +83,8 @@ abstract class FirTypeScope : FirScope(), FirContainingNamesAwareScope { typealias ProcessOverriddenWithBaseScope = FirTypeScope.(D, (D, FirTypeScope) -> ProcessorAction) -> ProcessorAction fun FirTypeScope.processOverriddenFunctions( - functionSymbol: FirFunctionSymbol<*>, - processor: (FirFunctionSymbol<*>) -> ProcessorAction + functionSymbol: FirNamedFunctionSymbol, + processor: (FirNamedFunctionSymbol) -> ProcessorAction ): ProcessorAction = doProcessAllOverriddenCallables( functionSymbol, @@ -128,8 +127,8 @@ private fun > FirTypeScope.doProcessAllOverriddenCallab doProcessAllOverriddenCallables(callableSymbol, { s, _ -> processor(s) }, processDirectOverriddenCallablesWithBaseScope, visited) inline fun FirTypeScope.processDirectlyOverriddenFunctions( - functionSymbol: FirFunctionSymbol<*>, - crossinline processor: (FirFunctionSymbol<*>) -> ProcessorAction + functionSymbol: FirNamedFunctionSymbol, + crossinline processor: (FirNamedFunctionSymbol) -> ProcessorAction ): ProcessorAction = processDirectOverriddenFunctionsWithBaseScope(functionSymbol) { overridden, _ -> processor(overridden) } @@ -145,7 +144,6 @@ fun FirTypeScope.getDirectOverriddenFunctions(function: FirNamedFunctionSymbol): val overriddenFunctions = mutableSetOf() processDirectlyOverriddenFunctions(function) { - if (it !is FirNamedFunctionSymbol) return@processDirectlyOverriddenFunctions ProcessorAction.NEXT overriddenFunctions.add(it) ProcessorAction.NEXT } From 91834ccf46728ec01e449ab4705fa502869be3cf Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 2 Dec 2020 17:31:17 +0300 Subject: [PATCH 542/698] Use FirNamedFunctionSymbol in FirSimpleFunction & its inheritors --- .../kotlin/fir/analysis/checkers/FirHelpers.kt | 1 - .../declaration/FirTypeMismatchOnOverrideChecker.kt | 2 +- .../resolve/providers/impl/FirBuiltinSymbolProvider.kt | 2 +- .../jetbrains/kotlin/fir/backend/ConversionUtils.kt | 1 - .../kotlin/fir/java/declarations/FirJavaMethod.kt | 4 ++-- .../src/org/jetbrains/kotlin/fir/SessionUtils.kt | 2 -- .../kotlin/fir/resolve/calls/ConstructorProcessing.kt | 2 +- .../fir/resolve/transformers/FirStatusResolver.kt | 10 ++++------ .../kotlin/fir/scopes/impl/FirDelegatedMemberScope.kt | 2 +- .../kotlin/fir/scopes/impl/FirFakeOverrideGenerator.kt | 4 ++-- .../jetbrains/kotlin/fir/scopes/impl/FirLocalScope.kt | 2 +- .../kotlin/fir/declarations/FirSimpleFunction.kt | 4 ++-- .../declarations/builder/FirSimpleFunctionBuilder.kt | 4 ++-- .../fir/declarations/impl/FirSimpleFunctionImpl.kt | 4 ++-- .../kotlin/fir/tree/generator/NodeConfigurator.kt | 2 +- 15 files changed, 20 insertions(+), 26 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirHelpers.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirHelpers.kt index a0023cc3134..7ce2f17043d 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirHelpers.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirHelpers.kt @@ -200,7 +200,6 @@ fun FirSimpleFunction.overriddenFunctions( containingClass: FirClass<*>, context: CheckerContext ): List> { - val symbol = symbol as? FirNamedFunctionSymbol ?: return emptyList() val firTypeScope = containingClass.unsubstitutedScope( context.sessionHolder.session, context.sessionHolder.scopeSession, diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirTypeMismatchOnOverrideChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirTypeMismatchOnOverrideChecker.kt index 318fa8af947..cb87609960d 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirTypeMismatchOnOverrideChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirTypeMismatchOnOverrideChecker.kt @@ -51,7 +51,7 @@ object FirTypeMismatchOnOverrideChecker : FirRegularClassChecker() { private fun FirTypeScope.retrieveDirectOverriddenOf(function: FirSimpleFunction): List> { processFunctionsByName(function.name) {} - return getDirectOverriddenFunctions(function.symbol as FirNamedFunctionSymbol) + return getDirectOverriddenFunctions(function.symbol) } private fun FirTypeScope.retrieveDirectOverriddenOf(property: FirProperty): List { diff --git a/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirBuiltinSymbolProvider.kt b/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirBuiltinSymbolProvider.kt index 2deebf524dd..0ddaad82ffb 100644 --- a/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirBuiltinSymbolProvider.kt +++ b/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirBuiltinSymbolProvider.kt @@ -233,7 +233,7 @@ class FirBuiltinSymbolProvider(session: FirSession, val kotlinScopeProvider: Kot val functionClass = getClassLikeSymbolByFqName(classId(arity)) ?: return null val invoke = functionClass.fir.declarations.find { it is FirSimpleFunction && it.name == OperatorNameConventions.INVOKE } ?: return null - return (invoke as FirSimpleFunction).symbol as? FirNamedFunctionSymbol + return (invoke as FirSimpleFunction).symbol } private fun FunctionClassKind.classId(arity: Int) = ClassId(packageFqName, numberedClassName(arity)) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt index 6d3a9201a61..d34e472b1b6 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt @@ -250,7 +250,6 @@ internal fun FirSimpleFunction.generateOverriddenFunctionSymbols( val scope = containingClass.unsubstitutedScope(session, scopeSession, withForcedTypeCalculator = true) scope.processFunctionsByName(name) {} val overriddenSet = mutableSetOf() - val symbol = symbol as? FirNamedFunctionSymbol ?: return emptyList() scope.processDirectlyOverriddenFunctions(symbol) { if (it.fir.visibility == Visibilities.Private) { return@processDirectlyOverriddenFunctions ProcessorAction.NEXT diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/declarations/FirJavaMethod.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/declarations/FirJavaMethod.kt index 5beda4584f5..bd8ec9a79aa 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/declarations/FirJavaMethod.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/declarations/FirJavaMethod.kt @@ -17,7 +17,7 @@ import org.jetbrains.kotlin.fir.declarations.builder.FirSimpleFunctionBuilder import org.jetbrains.kotlin.fir.declarations.impl.FirSimpleFunctionImpl import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall import org.jetbrains.kotlin.fir.expressions.FirBlock -import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol +import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol import org.jetbrains.kotlin.fir.types.ConeKotlinType import org.jetbrains.kotlin.fir.types.FirTypeRef import org.jetbrains.kotlin.fir.types.jvm.FirJavaTypeRef @@ -52,7 +52,7 @@ class FirJavaMethod @FirImplementationDetail constructor( name: Name, status: FirDeclarationStatus, containerSource: DeserializedContainerSource?, - symbol: FirFunctionSymbol, + symbol: FirNamedFunctionSymbol, annotations: MutableList, dispatchReceiverType: ConeKotlinType?, ) : FirSimpleFunctionImpl( diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/SessionUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/SessionUtils.kt index 050a43bf830..cf587bfbd09 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/SessionUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/SessionUtils.kt @@ -12,7 +12,6 @@ import org.jetbrains.kotlin.fir.resolve.inference.inferenceComponents import org.jetbrains.kotlin.fir.scopes.ProcessorAction import org.jetbrains.kotlin.fir.scopes.processOverriddenFunctions import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope -import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol import org.jetbrains.kotlin.fir.types.ConeInferenceContext import org.jetbrains.kotlin.fir.types.ConeTypeCheckerContext @@ -30,7 +29,6 @@ fun FirSimpleFunction.lowestVisibilityAmongOverrides( session: FirSession, scopeSession: ScopeSession ): Visibility { - val symbol = symbol as? FirNamedFunctionSymbol ?: return visibility val firTypeScope = containingClass.unsubstitutedScope(session, scopeSession, withForcedTypeCalculator = false) var visibility = visibility diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ConstructorProcessing.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ConstructorProcessing.kt index fb830ca4691..f812220e4e2 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ConstructorProcessing.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ConstructorProcessing.kt @@ -117,7 +117,7 @@ private fun FirTypeAliasSymbol.findSAMConstructorForTypeAlias( if (type.typeArguments.isEmpty()) return samConstructorForClass - val namedSymbol = samConstructorForClass.symbol as? FirNamedFunctionSymbol ?: return null + val namedSymbol = samConstructorForClass.symbol val substitutor = prepareSubstitutorForTypeAliasConstructors( type, diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolver.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolver.kt index e6ec933f3bd..a3d0a6562de 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolver.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolver.kt @@ -75,12 +75,10 @@ class FirStatusResolver( buildList> { val scope = containingClass.unsubstitutedScope(session, scopeSession, withForcedTypeCalculator = false) val symbol = function.symbol - if (symbol is FirNamedFunctionSymbol) { - scope.processFunctionsByName(function.name) {} - scope.processDirectOverriddenFunctionsWithBaseScope(symbol) { overriddenSymbol, _ -> - this += overriddenSymbol.fir - ProcessorAction.NEXT - } + scope.processFunctionsByName(function.name) {} + scope.processDirectOverriddenFunctionsWithBaseScope(symbol) { overriddenSymbol, _ -> + this += overriddenSymbol.fir + ProcessorAction.NEXT } }.mapNotNull { it.status as? FirResolvedDeclarationStatus diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirDelegatedMemberScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirDelegatedMemberScope.kt index 3e20196a1d2..eafd6e2f1d4 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirDelegatedMemberScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirDelegatedMemberScope.kt @@ -64,7 +64,7 @@ class FirDelegatedMemberScope( newModality = Modality.OPEN, ).apply { delegatedWrapperData = DelegatedWrapperData(functionSymbol.fir, containingClass.symbol.toLookupTag(), delegateField) - }.symbol as FirNamedFunctionSymbol + }.symbol } processor(delegatedSymbol) } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirFakeOverrideGenerator.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirFakeOverrideGenerator.kt index 27b8d8f85f2..5171b81f6ce 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirFakeOverrideGenerator.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirFakeOverrideGenerator.kt @@ -54,7 +54,7 @@ object FirFakeOverrideGenerator { } private fun createSubstitutionOverrideFunction( - fakeOverrideSymbol: FirFunctionSymbol, + fakeOverrideSymbol: FirNamedFunctionSymbol, session: FirSession, baseFunction: FirSimpleFunction, newDispatchReceiverType: ConeKotlinType?, @@ -85,7 +85,7 @@ object FirFakeOverrideGenerator { } fun createCopyForFirFunction( - newSymbol: FirFunctionSymbol, + newSymbol: FirNamedFunctionSymbol, baseFunction: FirSimpleFunction, session: FirSession, origin: FirDeclarationOrigin, diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirLocalScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirLocalScope.kt index c3b257d3bda..3f96d7ee5d4 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirLocalScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirLocalScope.kt @@ -34,7 +34,7 @@ class FirLocalScope private constructor( fun storeFunction(function: FirSimpleFunction): FirLocalScope { return FirLocalScope( - properties, functions.put(function.name, function.symbol as FirNamedFunctionSymbol), classes + properties, functions.put(function.name, function.symbol), classes ) } diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirSimpleFunction.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirSimpleFunction.kt index db8a0c96919..5db64495e60 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirSimpleFunction.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirSimpleFunction.kt @@ -12,7 +12,7 @@ import org.jetbrains.kotlin.fir.contracts.FirContractDescription import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall import org.jetbrains.kotlin.fir.expressions.FirBlock import org.jetbrains.kotlin.fir.references.FirControlFlowGraphReference -import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol +import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol import org.jetbrains.kotlin.fir.types.ConeKotlinType import org.jetbrains.kotlin.fir.types.FirTypeRef import org.jetbrains.kotlin.name.Name @@ -40,7 +40,7 @@ abstract class FirSimpleFunction : FirPureAbstractElement(), FirFunction + abstract override val symbol: FirNamedFunctionSymbol abstract override val annotations: List abstract override val typeParameters: List diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirSimpleFunctionBuilder.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirSimpleFunctionBuilder.kt index ca78e01239b..dfdded038c9 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirSimpleFunctionBuilder.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirSimpleFunctionBuilder.kt @@ -26,7 +26,7 @@ import org.jetbrains.kotlin.fir.declarations.impl.FirSimpleFunctionImpl import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall import org.jetbrains.kotlin.fir.expressions.FirBlock import org.jetbrains.kotlin.fir.references.FirControlFlowGraphReference -import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol +import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol import org.jetbrains.kotlin.fir.types.ConeKotlinType import org.jetbrains.kotlin.fir.types.FirTypeRef import org.jetbrains.kotlin.fir.visitors.* @@ -54,7 +54,7 @@ open class FirSimpleFunctionBuilder : FirFunctionBuilder, FirTypeParametersOwner open var dispatchReceiverType: ConeKotlinType? = null open var contractDescription: FirContractDescription = FirEmptyContractDescription open lateinit var name: Name - open lateinit var symbol: FirFunctionSymbol + open lateinit var symbol: FirNamedFunctionSymbol override val annotations: MutableList = mutableListOf() override val typeParameters: MutableList = mutableListOf() diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirSimpleFunctionImpl.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirSimpleFunctionImpl.kt index 436d7a0fb7d..849c0cc26b8 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirSimpleFunctionImpl.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirSimpleFunctionImpl.kt @@ -19,7 +19,7 @@ import org.jetbrains.kotlin.fir.declarations.FirValueParameter import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall import org.jetbrains.kotlin.fir.expressions.FirBlock import org.jetbrains.kotlin.fir.references.FirControlFlowGraphReference -import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol +import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol import org.jetbrains.kotlin.fir.types.ConeKotlinType import org.jetbrains.kotlin.fir.types.FirTypeRef import org.jetbrains.kotlin.name.Name @@ -46,7 +46,7 @@ open class FirSimpleFunctionImpl @FirImplementationDetail constructor( override val dispatchReceiverType: ConeKotlinType?, override var contractDescription: FirContractDescription, override val name: Name, - override val symbol: FirFunctionSymbol, + override val symbol: FirNamedFunctionSymbol, override val annotations: MutableList, override val typeParameters: MutableList, ) : FirSimpleFunction() { diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/NodeConfigurator.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/NodeConfigurator.kt index c3af76d7f56..ae47709304d 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/NodeConfigurator.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/NodeConfigurator.kt @@ -299,7 +299,7 @@ object NodeConfigurator : AbstractFieldConfigurator(FirTreeBuild parentArg(function, "F", simpleFunction) parentArg(callableMemberDeclaration, "F", simpleFunction) +name - +symbol("FirFunctionSymbol") + +symbol("FirNamedFunctionSymbol") +annotations +typeParameters } From 9b0ada2b0f8e0dd737060b9d563ed4937c14d9e4 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 30 Nov 2020 15:31:40 +0300 Subject: [PATCH 543/698] [FIR2IR] Generate f/o overridden symbol with FakeOverrideGenerator #KT-43669 Fixed --- .../generators/FakeOverrideGenerator.kt | 73 +++++++------- .../fir/lazy/Fir2IrLazySimpleFunction.kt | 5 + ...mpileKotlinAgainstKotlinTestGenerated.java | 5 + .../fir/IrConstAcceptMultiModule.kt | 97 +++++++++++++++++++ ...mpileKotlinAgainstKotlinTestGenerated.java | 5 + ...mpileKotlinAgainstKotlinTestGenerated.java | 5 + .../ir/JvmIrAgainstOldBoxTestGenerated.java | 5 + .../ir/JvmOldAgainstIrBoxTestGenerated.java | 5 + 8 files changed, 162 insertions(+), 38 deletions(-) create mode 100644 compiler/testData/compileKotlinAgainstKotlin/fir/IrConstAcceptMultiModule.kt diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/FakeOverrideGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/FakeOverrideGenerator.kt index 69dfb982391..c6241de9f4d 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/FakeOverrideGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/FakeOverrideGenerator.kt @@ -149,46 +149,40 @@ class FakeOverrideGenerator( val origin = IrDeclarationOrigin.FAKE_OVERRIDE val baseSymbol = originalSymbol.unwrapSubstitutionAndIntersectionOverrides() as S - - if (originalSymbol.fir.origin.fromSupertypes && originalSymbol.dispatchReceiverClassOrNull() == classLookupTag) { - // Substitution case - // NB: see comment above about substituted function' parent - val irDeclaration = cachedIrDeclaration(originalDeclaration) { - // Sometimes we can have clashing here when FIR substitution/intersection override - // have the same signature. - // Now we avoid this problem by signature caching, - // so both FIR overrides correspond to one IR fake override - signatureComposer.composeSignature(originalDeclaration) - }?.takeIf { it.parent == irClass } - ?: createIrDeclaration( - originalDeclaration, irClass, - declarationStorage.findIrParent(baseSymbol.fir) as? IrClass, - origin, - isLocal - ) - irDeclaration.parent = irClass - baseSymbols[irDeclaration] = computeBaseSymbols(originalSymbol, baseSymbol, computeDirectOverridden, scope, classLookupTag) - result += irDeclaration - } else if (originalDeclaration.allowsToHaveFakeOverrideIn(klass)) { - // Trivial fake override case - val fakeOverrideSymbol = createFakeOverrideSymbol( - originalDeclaration, baseSymbol - ) - - classifierStorage.preCacheTypeParameters(originalDeclaration) - val irDeclaration = createIrDeclaration( - fakeOverrideSymbol.fir, irClass, - declarationStorage.findIrParent(baseSymbol.fir) as? IrClass, + val baseDeclaration = when { + originalSymbol.fir.origin.fromSupertypes && originalSymbol.dispatchReceiverClassOrNull() == classLookupTag -> { + // Substitution case + originalDeclaration + } + originalDeclaration.allowsToHaveFakeOverrideIn(klass) -> { + // Trivial fake override case + val fakeOverrideSymbol = createFakeOverrideSymbol(originalDeclaration, baseSymbol) + classifierStorage.preCacheTypeParameters(originalDeclaration) + fakeOverrideSymbol.fir + } + else -> { + return + } + } + val irDeclaration = cachedIrDeclaration(baseDeclaration) { + // Sometimes we can have clashing here when FIR substitution/intersection override + // have the same signature. + // Now we avoid this problem by signature caching, + // so both FIR overrides correspond to one IR fake override + signatureComposer.composeSignature(baseDeclaration) + }?.takeIf { it.parent == irClass } + ?: createIrDeclaration( + baseDeclaration, + irClass, + /* thisReceiverOwner = */ declarationStorage.findIrParent(baseSymbol.fir) as? IrClass, origin, isLocal ) - if (containsErrorTypes(irDeclaration)) { - return - } - irDeclaration.parent = irClass - baseSymbols[irDeclaration] = computeBaseSymbols(originalSymbol, baseSymbol, computeDirectOverridden, scope, classLookupTag) - result += irDeclaration + if (containsErrorTypes(irDeclaration)) { + return } + baseSymbols[irDeclaration] = computeBaseSymbols(originalSymbol, baseSymbol, computeDirectOverridden, scope, classLookupTag) + result += irDeclaration } private inline fun > computeBaseSymbols( @@ -208,13 +202,16 @@ class FakeOverrideGenerator( } } + internal fun getOverriddenSymbols(function: IrSimpleFunction): List? { + return baseFunctionSymbols[function]?.map { declarationStorage.getIrFunctionSymbol(it) as IrSimpleFunctionSymbol } + } + fun bindOverriddenSymbols(declarations: List) { for (declaration in declarations) { if (declaration.origin != IrDeclarationOrigin.FAKE_OVERRIDE) continue when (declaration) { is IrSimpleFunction -> { - val baseSymbols = - baseFunctionSymbols[declaration]!!.map { declarationStorage.getIrFunctionSymbol(it) as IrSimpleFunctionSymbol } + val baseSymbols = getOverriddenSymbols(declaration)!! declaration.withFunction { overriddenSymbols = baseSymbols } diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/lazy/Fir2IrLazySimpleFunction.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/lazy/Fir2IrLazySimpleFunction.kt index 1da2d995609..3a02aad285e 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/lazy/Fir2IrLazySimpleFunction.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/lazy/Fir2IrLazySimpleFunction.kt @@ -67,6 +67,11 @@ class Fir2IrLazySimpleFunction( } override var overriddenSymbols: List by lazyVar { + val parent = parent + if (isFakeOverride && parent is Fir2IrLazyClass) { + parent.declarations + fakeOverrideGenerator.getOverriddenSymbols(this)?.let { return@lazyVar it } + } fir.generateOverriddenFunctionSymbols(firParent, session, scopeSession, declarationStorage) } diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java index 19dc082737c..9eabc99689d 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java @@ -435,6 +435,11 @@ public class FirCompileKotlinAgainstKotlinTestGenerated extends AbstractFirCompi runTest("compiler/testData/compileKotlinAgainstKotlin/fir/ExistingSymbolInFakeOverride.kt"); } + @TestMetadata("IrConstAcceptMultiModule.kt") + public void testIrConstAcceptMultiModule() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/fir/IrConstAcceptMultiModule.kt"); + } + @TestMetadata("LibraryProperty.kt") public void testLibraryProperty() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/fir/LibraryProperty.kt"); diff --git a/compiler/testData/compileKotlinAgainstKotlin/fir/IrConstAcceptMultiModule.kt b/compiler/testData/compileKotlinAgainstKotlin/fir/IrConstAcceptMultiModule.kt new file mode 100644 index 00000000000..e0c04b520e6 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstKotlin/fir/IrConstAcceptMultiModule.kt @@ -0,0 +1,97 @@ +// TARGET_BACKEND: JVM +// FILE: A.kt +// WITH_RUNTIME + +abstract class IrConst : IrExpression(), IrExpressionWithCopy { + abstract val kind: IrConstKind + abstract val value: T + + abstract override fun copy(): IrConst + abstract fun copyWithOffsets(startOffset: Int, endOffset: Int): IrConst +} + +sealed class IrConstKind(val asString: kotlin.String) { + @Suppress("UNCHECKED_CAST") + fun valueOf(aConst: IrConst<*>) = + (aConst as IrConst).value + + object Null : IrConstKind("Null") + object Boolean : IrConstKind("Boolean") + object Char : IrConstKind("Char") + object Byte : IrConstKind("Byte") + object Short : IrConstKind("Short") + object Int : IrConstKind("Int") + object Long : IrConstKind("Long") + object String : IrConstKind("String") + object Float : IrConstKind("Float") + object Double : IrConstKind("Double") + + override fun toString() = asString +} + +interface IrType + +abstract class IrExpression : IrElementBase(), IrStatement, IrVarargElement, IrAttributeContainer { + @Suppress("LeakingThis") + override var attributeOwnerId: IrAttributeContainer = this + + abstract var type: IrType + + override fun transform(transformer: IrElementTransformer, data: D): IrExpression = + accept(transformer, data) as IrExpression + + override fun acceptChildren(visitor: IrElementVisitor, data: D) { + // No children by default + } + + override fun transformChildren(transformer: IrElementTransformer, data: D) { + // No children by default + } +} + +interface IrExpressionWithCopy { + fun copy(): IrExpression +} + +interface IrAttributeContainer : IrElement { + var attributeOwnerId: IrAttributeContainer +} + +abstract class IrElementBase : IrElement + +interface IrStatement : IrElement + +interface IrVarargElement : IrElement + +interface IrElement { + val startOffset: Int + val endOffset: Int + + fun accept(visitor: IrElementVisitor, data: D): R + + fun acceptChildren(visitor: IrElementVisitor, data: D): Unit + + fun transform(transformer: IrElementTransformer, data: D): IrElement = + accept(transformer, data) + + fun transformChildren(transformer: IrElementTransformer, data: D): Unit +} + +interface IrElementVisitor + +interface IrElementTransformer : IrElementVisitor + +// FILE: B.kt + +fun foo(cases: Collection>, exprTransformer: IrElementTransformer, context: Any) { + cases.map { + it.accept(exprTransformer, context) + } +} + +fun box(): String { + return "OK" +} + + + diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java index 7d17c880e71..47dc0148f5e 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java @@ -440,6 +440,11 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl runTest("compiler/testData/compileKotlinAgainstKotlin/fir/ExistingSymbolInFakeOverride.kt"); } + @TestMetadata("IrConstAcceptMultiModule.kt") + public void testIrConstAcceptMultiModule() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/fir/IrConstAcceptMultiModule.kt"); + } + @TestMetadata("LibraryProperty.kt") public void testLibraryProperty() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/fir/LibraryProperty.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java index 17e2689dd24..c80d0bae244 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java @@ -435,6 +435,11 @@ public class IrCompileKotlinAgainstKotlinTestGenerated extends AbstractIrCompile runTest("compiler/testData/compileKotlinAgainstKotlin/fir/ExistingSymbolInFakeOverride.kt"); } + @TestMetadata("IrConstAcceptMultiModule.kt") + public void testIrConstAcceptMultiModule() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/fir/IrConstAcceptMultiModule.kt"); + } + @TestMetadata("LibraryProperty.kt") public void testLibraryProperty() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/fir/LibraryProperty.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java index 216c3c86fab..ec454d9f138 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java @@ -435,6 +435,11 @@ public class JvmIrAgainstOldBoxTestGenerated extends AbstractJvmIrAgainstOldBoxT runTest("compiler/testData/compileKotlinAgainstKotlin/fir/ExistingSymbolInFakeOverride.kt"); } + @TestMetadata("IrConstAcceptMultiModule.kt") + public void testIrConstAcceptMultiModule() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/fir/IrConstAcceptMultiModule.kt"); + } + @TestMetadata("LibraryProperty.kt") public void testLibraryProperty() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/fir/LibraryProperty.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java index 29e0050ee99..032b2129eca 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java @@ -435,6 +435,11 @@ public class JvmOldAgainstIrBoxTestGenerated extends AbstractJvmOldAgainstIrBoxT runTest("compiler/testData/compileKotlinAgainstKotlin/fir/ExistingSymbolInFakeOverride.kt"); } + @TestMetadata("IrConstAcceptMultiModule.kt") + public void testIrConstAcceptMultiModule() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/fir/IrConstAcceptMultiModule.kt"); + } + @TestMetadata("LibraryProperty.kt") public void testLibraryProperty() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/fir/LibraryProperty.kt"); From 94014ba3eb8c42a40fcde4ad84b085e0bacf8c45 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 3 Dec 2020 10:43:50 +0300 Subject: [PATCH 544/698] Fir2IrLazyClass: don't generate non-f/o properties from superclass --- .../kotlin/fir/lazy/Fir2IrLazyClass.kt | 8 +++++-- ...mpileKotlinAgainstKotlinTestGenerated.java | 5 ++++ .../fir/IncrementalCompilerRunner.kt | 24 +++++++++++++++++++ ...mpileKotlinAgainstKotlinTestGenerated.java | 5 ++++ ...mpileKotlinAgainstKotlinTestGenerated.java | 5 ++++ .../ir/JvmIrAgainstOldBoxTestGenerated.java | 5 ++++ .../ir/JvmOldAgainstIrBoxTestGenerated.java | 5 ++++ 7 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 compiler/testData/compileKotlinAgainstKotlin/fir/IncrementalCompilerRunner.kt diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/lazy/Fir2IrLazyClass.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/lazy/Fir2IrLazyClass.kt index b7a1418ffd5..1d93cb0f28c 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/lazy/Fir2IrLazyClass.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/lazy/Fir2IrLazyClass.kt @@ -23,6 +23,8 @@ import org.jetbrains.kotlin.ir.declarations.lazy.lazyVar import org.jetbrains.kotlin.ir.expressions.IrConstructorCall import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl +import org.jetbrains.kotlin.ir.util.isFakeOverride +import org.jetbrains.kotlin.ir.util.render import org.jetbrains.kotlin.name.Name class Fir2IrLazyClass( @@ -151,7 +153,7 @@ class Fir2IrLazyClass( if (declaration.name !in processedNames) { processedNames += declaration.name scope.processPropertiesByName(declaration.name) { - if (it is FirPropertySymbol) { + if (it is FirPropertySymbol && it.dispatchReceiverClassOrNull() == fir.symbol.toLookupTag()) { result += declarationStorage.getIrPropertySymbol(it).owner as IrProperty } } @@ -172,7 +174,9 @@ class Fir2IrLazyClass( // TODO: remove this check to save time for (declaration in result) { if (declaration.parent != this) { - throw AssertionError("Unmatched parent for lazy class member") + throw AssertionError( + "Unmatched parent for lazy class ${fir.name} member ${declaration.render()} f/o ${declaration.isFakeOverride}" + ) } } result diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java index 9eabc99689d..dca0ac2c850 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java @@ -435,6 +435,11 @@ public class FirCompileKotlinAgainstKotlinTestGenerated extends AbstractFirCompi runTest("compiler/testData/compileKotlinAgainstKotlin/fir/ExistingSymbolInFakeOverride.kt"); } + @TestMetadata("IncrementalCompilerRunner.kt") + public void testIncrementalCompilerRunner() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/fir/IncrementalCompilerRunner.kt"); + } + @TestMetadata("IrConstAcceptMultiModule.kt") public void testIrConstAcceptMultiModule() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/fir/IrConstAcceptMultiModule.kt"); diff --git a/compiler/testData/compileKotlinAgainstKotlin/fir/IncrementalCompilerRunner.kt b/compiler/testData/compileKotlinAgainstKotlin/fir/IncrementalCompilerRunner.kt new file mode 100644 index 00000000000..0ffc71aaf4d --- /dev/null +++ b/compiler/testData/compileKotlinAgainstKotlin/fir/IncrementalCompilerRunner.kt @@ -0,0 +1,24 @@ +// TARGET_BACKEND: JVM +// FILE: A.kt +// WITH_RUNTIME + +abstract class IncrementalCompilerRunner( + private val workingDir: String, + val fail: Boolean, + val output: Collection = emptyList() +) { + fun res(res: T? = null): String = (res as? String) ?: (if (fail) "FAIL" else workingDir) +} + +class IncrementalJsCompilerRunner( + private val workingDir: String, + fail: Boolean = true +) : IncrementalCompilerRunner(workingDir, fail) { +} + +// FILE: B.kt + +fun box(): String { + val runner = IncrementalJsCompilerRunner(workingDir = "OK", fail = false) + return runner.res() +} \ No newline at end of file diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java index 47dc0148f5e..131fa5a6431 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java @@ -440,6 +440,11 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl runTest("compiler/testData/compileKotlinAgainstKotlin/fir/ExistingSymbolInFakeOverride.kt"); } + @TestMetadata("IncrementalCompilerRunner.kt") + public void testIncrementalCompilerRunner() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/fir/IncrementalCompilerRunner.kt"); + } + @TestMetadata("IrConstAcceptMultiModule.kt") public void testIrConstAcceptMultiModule() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/fir/IrConstAcceptMultiModule.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java index c80d0bae244..6f3c23ba64a 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java @@ -435,6 +435,11 @@ public class IrCompileKotlinAgainstKotlinTestGenerated extends AbstractIrCompile runTest("compiler/testData/compileKotlinAgainstKotlin/fir/ExistingSymbolInFakeOverride.kt"); } + @TestMetadata("IncrementalCompilerRunner.kt") + public void testIncrementalCompilerRunner() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/fir/IncrementalCompilerRunner.kt"); + } + @TestMetadata("IrConstAcceptMultiModule.kt") public void testIrConstAcceptMultiModule() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/fir/IrConstAcceptMultiModule.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java index ec454d9f138..1a5dd9b4c01 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java @@ -435,6 +435,11 @@ public class JvmIrAgainstOldBoxTestGenerated extends AbstractJvmIrAgainstOldBoxT runTest("compiler/testData/compileKotlinAgainstKotlin/fir/ExistingSymbolInFakeOverride.kt"); } + @TestMetadata("IncrementalCompilerRunner.kt") + public void testIncrementalCompilerRunner() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/fir/IncrementalCompilerRunner.kt"); + } + @TestMetadata("IrConstAcceptMultiModule.kt") public void testIrConstAcceptMultiModule() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/fir/IrConstAcceptMultiModule.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java index 032b2129eca..a152a8fc6b2 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java @@ -435,6 +435,11 @@ public class JvmOldAgainstIrBoxTestGenerated extends AbstractJvmOldAgainstIrBoxT runTest("compiler/testData/compileKotlinAgainstKotlin/fir/ExistingSymbolInFakeOverride.kt"); } + @TestMetadata("IncrementalCompilerRunner.kt") + public void testIncrementalCompilerRunner() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/fir/IncrementalCompilerRunner.kt"); + } + @TestMetadata("IrConstAcceptMultiModule.kt") public void testIrConstAcceptMultiModule() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/fir/IrConstAcceptMultiModule.kt"); From d6e144c80ec50fa9b3a96c26733d039809fd8de5 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 3 Dec 2020 16:09:18 +0300 Subject: [PATCH 545/698] [FIR] Extend callableNames known for JvmMappedScope --- .../kotlin/fir/Fir2IrTextTestGenerated.java | 5 + .../kotlin/fir/scopes/jvm/JvmMappedScope.kt | 2 +- .../firProblems/AbstractMutableMap.fir.txt | 54 ++++ .../ImplicitReceiverStack.fir.kt.txt | 85 ++++++ .../firProblems/ImplicitReceiverStack.fir.txt | 252 +++++++++++++++++ .../firProblems/ImplicitReceiverStack.kt | 46 ++++ .../firProblems/ImplicitReceiverStack.kt.txt | 85 ++++++ .../firProblems/ImplicitReceiverStack.txt | 256 ++++++++++++++++++ .../ir/irText/firProblems/MultiList.fir.txt | 75 +++-- .../kotlin/ir/IrTextTestCaseGenerated.java | 5 + 10 files changed, 844 insertions(+), 21 deletions(-) create mode 100644 compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.fir.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.fir.txt create mode 100644 compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.kt create mode 100644 compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.txt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java index 7f13a2d4ae3..a6d9d2f26b7 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java @@ -1812,6 +1812,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { runTest("compiler/testData/ir/irText/firProblems/FirBuilder.kt"); } + @TestMetadata("ImplicitReceiverStack.kt") + public void testImplicitReceiverStack() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.kt"); + } + @TestMetadata("inapplicableCollectionSet.kt") public void testInapplicableCollectionSet() throws Exception { runTest("compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.kt"); diff --git a/compiler/fir/jvm/src/org/jetbrains/kotlin/fir/scopes/jvm/JvmMappedScope.kt b/compiler/fir/jvm/src/org/jetbrains/kotlin/fir/scopes/jvm/JvmMappedScope.kt index 141be33094d..fa4a240654d 100644 --- a/compiler/fir/jvm/src/org/jetbrains/kotlin/fir/scopes/jvm/JvmMappedScope.kt +++ b/compiler/fir/jvm/src/org/jetbrains/kotlin/fir/scopes/jvm/JvmMappedScope.kt @@ -76,7 +76,7 @@ class JvmMappedScope( } override fun getCallableNames(): Set { - return declaredMemberScope.getContainingCallableNamesIfPresent() + return declaredMemberScope.getContainingCallableNamesIfPresent() + signatures.visibleMethodSignaturesByName.keys } override fun getClassifierNames(): Set { diff --git a/compiler/testData/ir/irText/firProblems/AbstractMutableMap.fir.txt b/compiler/testData/ir/irText/firProblems/AbstractMutableMap.fir.txt index 88468b10bc9..53ef0b5e355 100644 --- a/compiler/testData/ir/irText/firProblems/AbstractMutableMap.fir.txt +++ b/compiler/testData/ir/irText/firProblems/AbstractMutableMap.fir.txt @@ -65,6 +65,55 @@ FILE fqName: fileName:/AbstractMutableMap.kt overridden: public abstract fun (): kotlin.collections.MutableCollection declared in kotlin.collections.MutableMap $this: VALUE_PARAMETER name: type:kotlin.collections.MutableMap + FUN FAKE_OVERRIDE name:replaceAll visibility:public modality:OPEN <> ($this:java.util.Map, p0:@[FlexibleNullability] java.util.function.BiFunction.MyMap?, in V of .MyMap?, out V of .MyMap?>) returnType:kotlin.Unit [fake_override] + overridden: + public open fun replaceAll (p0: @[FlexibleNullability] java.util.function.BiFunction): kotlin.Unit declared in java.util.Map + $this: VALUE_PARAMETER name: type:java.util.Map + VALUE_PARAMETER name:p0 index:0 type:@[FlexibleNullability] java.util.function.BiFunction.MyMap?, in V of .MyMap?, out V of .MyMap?> + FUN FAKE_OVERRIDE name:merge visibility:public modality:OPEN <> ($this:java.util.Map, p0:K of .MyMap, p1:V of .MyMap, p2:@[FlexibleNullability] java.util.function.BiFunction.MyMap?, in V of .MyMap?, out V of .MyMap?>) returnType:V of .MyMap? [fake_override] + overridden: + public open fun merge (p0: @[FlexibleNullability] K of java.util.Map, p1: @[FlexibleNullability] V of java.util.Map, p2: @[FlexibleNullability] java.util.function.BiFunction): @[FlexibleNullability] V of java.util.Map? declared in java.util.Map + $this: VALUE_PARAMETER name: type:java.util.Map + VALUE_PARAMETER name:p0 index:0 type:K of .MyMap + VALUE_PARAMETER name:p1 index:1 type:V of .MyMap + VALUE_PARAMETER name:p2 index:2 type:@[FlexibleNullability] java.util.function.BiFunction.MyMap?, in V of .MyMap?, out V of .MyMap?> + FUN FAKE_OVERRIDE name:computeIfPresent visibility:public modality:OPEN <> ($this:java.util.Map, p0:K of .MyMap, p1:@[FlexibleNullability] java.util.function.BiFunction.MyMap?, in V of .MyMap?, out V of .MyMap?>) returnType:V of .MyMap? [fake_override] + overridden: + public open fun computeIfPresent (p0: @[FlexibleNullability] K of java.util.Map, p1: @[FlexibleNullability] java.util.function.BiFunction): @[FlexibleNullability] V of java.util.Map? declared in java.util.Map + $this: VALUE_PARAMETER name: type:java.util.Map + VALUE_PARAMETER name:p0 index:0 type:K of .MyMap + VALUE_PARAMETER name:p1 index:1 type:@[FlexibleNullability] java.util.function.BiFunction.MyMap?, in V of .MyMap?, out V of .MyMap?> + FUN FAKE_OVERRIDE name:putIfAbsent visibility:public modality:OPEN <> ($this:java.util.Map, p0:K of .MyMap, p1:V of .MyMap) returnType:V of .MyMap? [fake_override] + overridden: + public open fun putIfAbsent (p0: @[FlexibleNullability] K of java.util.Map, p1: @[FlexibleNullability] V of java.util.Map): @[FlexibleNullability] V of java.util.Map? declared in java.util.Map + $this: VALUE_PARAMETER name: type:java.util.Map + VALUE_PARAMETER name:p0 index:0 type:K of .MyMap + VALUE_PARAMETER name:p1 index:1 type:V of .MyMap + FUN FAKE_OVERRIDE name:replace visibility:public modality:OPEN <> ($this:java.util.Map, p0:K of .MyMap?, p1:V of .MyMap?, p2:V of .MyMap?) returnType:kotlin.Boolean [fake_override] + overridden: + public open fun replace (p0: K of java.util.Map?, p1: V of java.util.Map?, p2: V of java.util.Map?): kotlin.Boolean declared in java.util.Map + $this: VALUE_PARAMETER name: type:java.util.Map + VALUE_PARAMETER name:p0 index:0 type:K of .MyMap? + VALUE_PARAMETER name:p1 index:1 type:V of .MyMap? + VALUE_PARAMETER name:p2 index:2 type:V of .MyMap? + FUN FAKE_OVERRIDE name:replace visibility:public modality:OPEN <> ($this:java.util.Map, p0:K of .MyMap, p1:V of .MyMap) returnType:V of .MyMap? [fake_override] + overridden: + public open fun replace (p0: @[FlexibleNullability] K of java.util.Map, p1: @[FlexibleNullability] V of java.util.Map): @[FlexibleNullability] V of java.util.Map? declared in java.util.Map + $this: VALUE_PARAMETER name: type:java.util.Map + VALUE_PARAMETER name:p0 index:0 type:K of .MyMap + VALUE_PARAMETER name:p1 index:1 type:V of .MyMap + FUN FAKE_OVERRIDE name:computeIfAbsent visibility:public modality:OPEN <> ($this:java.util.Map, p0:K of .MyMap, p1:@[FlexibleNullability] java.util.function.Function.MyMap?, out V of .MyMap?>) returnType:V of .MyMap [fake_override] + overridden: + public open fun computeIfAbsent (p0: @[FlexibleNullability] K of java.util.Map, p1: @[FlexibleNullability] java.util.function.Function): @[FlexibleNullability] V of java.util.Map declared in java.util.Map + $this: VALUE_PARAMETER name: type:java.util.Map + VALUE_PARAMETER name:p0 index:0 type:K of .MyMap + VALUE_PARAMETER name:p1 index:1 type:@[FlexibleNullability] java.util.function.Function.MyMap?, out V of .MyMap?> + FUN FAKE_OVERRIDE name:compute visibility:public modality:OPEN <> ($this:java.util.Map, p0:K of .MyMap, p1:@[FlexibleNullability] java.util.function.BiFunction.MyMap?, in V of .MyMap?, out V of .MyMap?>) returnType:V of .MyMap? [fake_override] + overridden: + public open fun compute (p0: @[FlexibleNullability] K of java.util.Map, p1: @[FlexibleNullability] java.util.function.BiFunction): @[FlexibleNullability] V of java.util.Map? declared in java.util.Map + $this: VALUE_PARAMETER name: type:java.util.Map + VALUE_PARAMETER name:p0 index:0 type:K of .MyMap + VALUE_PARAMETER name:p1 index:1 type:@[FlexibleNullability] java.util.function.BiFunction.MyMap?, in V of .MyMap?, out V of .MyMap?> FUN FAKE_OVERRIDE name:containsKey visibility:public modality:OPEN <> ($this:kotlin.collections.Map, key:K of .MyMap) returnType:kotlin.Boolean [fake_override] overridden: public abstract fun containsKey (key: K of kotlin.collections.Map): kotlin.Boolean declared in kotlin.collections.Map @@ -101,6 +150,11 @@ FILE fqName: fileName:/AbstractMutableMap.kt overridden: public abstract fun (): kotlin.Int declared in kotlin.collections.Map $this: VALUE_PARAMETER name: type:kotlin.collections.Map + FUN FAKE_OVERRIDE name:forEach visibility:public modality:OPEN <> ($this:java.util.Map, p0:@[FlexibleNullability] java.util.function.BiConsumer.MyMap?, in V of .MyMap?>) returnType:kotlin.Unit [fake_override] + overridden: + public open fun forEach (p0: @[FlexibleNullability] java.util.function.BiConsumer): kotlin.Unit declared in java.util.Map + $this: VALUE_PARAMETER name: type:java.util.Map + VALUE_PARAMETER name:p0 index:0 type:@[FlexibleNullability] java.util.function.BiConsumer.MyMap?, in V of .MyMap?> FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any diff --git a/compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.fir.kt.txt b/compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.fir.kt.txt new file mode 100644 index 00000000000..31d5a81df78 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.fir.kt.txt @@ -0,0 +1,85 @@ +interface SymbolOwner> { + +} + +interface Symbol> { + +} + +interface ReceiverValue { + abstract val type: String + abstract get + +} + +class ImplicitReceiverValue> : ReceiverValue { + constructor(boundSymbol: S?, type: String) /* primary */ { + super/*Any*/() + /* () */ + + } + + val boundSymbol: S? + field = boundSymbol + get + + override val type: String + field = type + override get + +} + +abstract class ImplicitReceiverStack : Iterable> { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + abstract operator fun get(name: String?): ImplicitReceiverValue<*>? + +} + +class PersistentImplicitReceiverStack : ImplicitReceiverStack, Iterable> { + constructor(stack: List>) /* primary */ { + super/*ImplicitReceiverStack*/() + /* () */ + + } + + private val stack: List> + field = stack + private get + + override operator fun iterator(): Iterator> { + return .().iterator() + } + + override operator fun get(name: String?): ImplicitReceiverValue<*>? { + return .().lastOrNull>() + } + +} + +fun bar(s: String) { +} + +fun foo(stack: PersistentImplicitReceiverStack) { + stack.forEach>(action = local fun (it: ImplicitReceiverValue<*>) { + it.() /*~> Unit */ + bar(s = it.()) + } +) +} + +fun box(): String { + val stack: PersistentImplicitReceiverStack = PersistentImplicitReceiverStack(stack = listOf>(elements = [ImplicitReceiverValue(boundSymbol = null, type = "O"), ImplicitReceiverValue(boundSymbol = null, type = "K")])) + foo(stack = stack) + return stack.first>().().plus(other = { // BLOCK + val tmp0_safe_receiver: ImplicitReceiverValue<*>? = stack.get(name = null) + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + else -> tmp0_safe_receiver.() + } + }) +} diff --git a/compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.fir.txt b/compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.fir.txt new file mode 100644 index 00000000000..3be1f4a8686 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.fir.txt @@ -0,0 +1,252 @@ +FILE fqName: fileName:/ImplicitReceiverStack.kt + CLASS INTERFACE name:SymbolOwner modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.SymbolOwner.SymbolOwner> + TYPE_PARAMETER name:E index:0 variance: superTypes:[.SymbolOwner.SymbolOwner>] + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:Symbol modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Symbol.Symbol> + TYPE_PARAMETER name:E index:0 variance: superTypes:[.SymbolOwner.Symbol>] + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:ReceiverValue modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.ReceiverValue + PROPERTY name:type visibility:public modality:ABSTRACT [val] + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:ABSTRACT <> ($this:.ReceiverValue) returnType:kotlin.String + correspondingProperty: PROPERTY name:type visibility:public modality:ABSTRACT [val] + $this: VALUE_PARAMETER name: type:.ReceiverValue + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:ImplicitReceiverValue modality:FINAL visibility:public superTypes:[.ReceiverValue] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.ImplicitReceiverValue.ImplicitReceiverValue> + TYPE_PARAMETER name:S index:0 variance: superTypes:[.Symbol<*>] + CONSTRUCTOR visibility:public <> (boundSymbol:S of .ImplicitReceiverValue?, type:kotlin.String) returnType:.ImplicitReceiverValue.ImplicitReceiverValue> [primary] + VALUE_PARAMETER name:boundSymbol index:0 type:S of .ImplicitReceiverValue? + VALUE_PARAMETER name:type index:1 type:kotlin.String + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:ImplicitReceiverValue modality:FINAL visibility:public superTypes:[.ReceiverValue]' + PROPERTY name:boundSymbol visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:boundSymbol type:S of .ImplicitReceiverValue? visibility:private [final] + EXPRESSION_BODY + GET_VAR 'boundSymbol: S of .ImplicitReceiverValue? declared in .ImplicitReceiverValue.' type=S of .ImplicitReceiverValue? origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.ImplicitReceiverValue.ImplicitReceiverValue>) returnType:S of .ImplicitReceiverValue? + correspondingProperty: PROPERTY name:boundSymbol visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.ImplicitReceiverValue.ImplicitReceiverValue> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): S of .ImplicitReceiverValue? declared in .ImplicitReceiverValue' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:boundSymbol type:S of .ImplicitReceiverValue? visibility:private [final]' type=S of .ImplicitReceiverValue? origin=null + receiver: GET_VAR ': .ImplicitReceiverValue.ImplicitReceiverValue> declared in .ImplicitReceiverValue.' type=.ImplicitReceiverValue.ImplicitReceiverValue> origin=null + PROPERTY name:type visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:type type:kotlin.String visibility:private [final] + EXPRESSION_BODY + GET_VAR 'type: kotlin.String declared in .ImplicitReceiverValue.' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.ImplicitReceiverValue.ImplicitReceiverValue>) returnType:kotlin.String + correspondingProperty: PROPERTY name:type visibility:public modality:FINAL [val] + overridden: + public abstract fun (): kotlin.String declared in .ReceiverValue + $this: VALUE_PARAMETER name: type:.ImplicitReceiverValue.ImplicitReceiverValue> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .ImplicitReceiverValue' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:type type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .ImplicitReceiverValue.ImplicitReceiverValue> declared in .ImplicitReceiverValue.' type=.ImplicitReceiverValue.ImplicitReceiverValue> origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:ImplicitReceiverStack modality:ABSTRACT visibility:public superTypes:[kotlin.collections.Iterable<.ImplicitReceiverValue<*>>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.ImplicitReceiverStack + CONSTRUCTOR visibility:public <> () returnType:.ImplicitReceiverStack [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:ImplicitReceiverStack modality:ABSTRACT visibility:public superTypes:[kotlin.collections.Iterable<.ImplicitReceiverValue<*>>]' + FUN name:get visibility:public modality:ABSTRACT <> ($this:.ImplicitReceiverStack, name:kotlin.String?) returnType:.ImplicitReceiverValue<*>? [operator] + $this: VALUE_PARAMETER name: type:.ImplicitReceiverStack + VALUE_PARAMETER name:name index:0 type:kotlin.String? + FUN FAKE_OVERRIDE name:iterator visibility:public modality:ABSTRACT <> ($this:kotlin.collections.Iterable) returnType:kotlin.collections.Iterator<.ImplicitReceiverValue<*>> [fake_override,operator] + overridden: + public abstract fun iterator (): kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterable + $this: VALUE_PARAMETER name: type:kotlin.collections.Iterable + FUN FAKE_OVERRIDE name:forEach visibility:public modality:OPEN <> ($this:java.lang.Iterable, p0:java.util.function.Consumer.ImplicitReceiverValue<*>?>?) returnType:kotlin.Unit [fake_override] + overridden: + public open fun forEach (p0: java.util.function.Consumer?): kotlin.Unit declared in java.lang.Iterable + $this: VALUE_PARAMETER name: type:java.lang.Iterable + VALUE_PARAMETER name:p0 index:0 type:java.util.function.Consumer.ImplicitReceiverValue<*>?>? + FUN FAKE_OVERRIDE name:spliterator visibility:public modality:OPEN <> ($this:java.lang.Iterable) returnType:@[FlexibleNullability] java.util.Spliterator<.ImplicitReceiverValue<*>?> [fake_override] + overridden: + public open fun spliterator (): @[FlexibleNullability] java.util.Spliterator declared in java.lang.Iterable + $this: VALUE_PARAMETER name: type:java.lang.Iterable + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:PersistentImplicitReceiverStack modality:FINAL visibility:public superTypes:[.ImplicitReceiverStack; kotlin.collections.Iterable<.ImplicitReceiverValue<*>>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.PersistentImplicitReceiverStack + CONSTRUCTOR visibility:public <> (stack:kotlin.collections.List<.ImplicitReceiverValue<*>>) returnType:.PersistentImplicitReceiverStack [primary] + VALUE_PARAMETER name:stack index:0 type:kotlin.collections.List<.ImplicitReceiverValue<*>> + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in .ImplicitReceiverStack' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:PersistentImplicitReceiverStack modality:FINAL visibility:public superTypes:[.ImplicitReceiverStack; kotlin.collections.Iterable<.ImplicitReceiverValue<*>>]' + PROPERTY name:stack visibility:private modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:stack type:kotlin.collections.List<.ImplicitReceiverValue<*>> visibility:private [final] + EXPRESSION_BODY + GET_VAR 'stack: kotlin.collections.List<.ImplicitReceiverValue<*>> declared in .PersistentImplicitReceiverStack.' type=kotlin.collections.List<.ImplicitReceiverValue<*>> origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.PersistentImplicitReceiverStack) returnType:kotlin.collections.List<.ImplicitReceiverValue<*>> + correspondingProperty: PROPERTY name:stack visibility:private modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.PersistentImplicitReceiverStack + BLOCK_BODY + RETURN type=kotlin.Nothing from='private final fun (): kotlin.collections.List<.ImplicitReceiverValue<*>> declared in .PersistentImplicitReceiverStack' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:stack type:kotlin.collections.List<.ImplicitReceiverValue<*>> visibility:private [final]' type=kotlin.collections.List<.ImplicitReceiverValue<*>> origin=null + receiver: GET_VAR ': .PersistentImplicitReceiverStack declared in .PersistentImplicitReceiverStack.' type=.PersistentImplicitReceiverStack origin=null + FUN name:iterator visibility:public modality:FINAL <> ($this:.PersistentImplicitReceiverStack) returnType:kotlin.collections.Iterator<.ImplicitReceiverValue<*>> [operator] + overridden: + public abstract fun iterator (): kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterable + $this: VALUE_PARAMETER name: type:.PersistentImplicitReceiverStack + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun iterator (): kotlin.collections.Iterator<.ImplicitReceiverValue<*>> [operator] declared in .PersistentImplicitReceiverStack' + CALL 'public abstract fun iterator (): kotlin.collections.Iterator [operator] declared in kotlin.collections.List' type=kotlin.collections.Iterator<.ImplicitReceiverValue<*>> origin=null + $this: CALL 'private final fun (): kotlin.collections.List<.ImplicitReceiverValue<*>> declared in .PersistentImplicitReceiverStack' type=kotlin.collections.List<.ImplicitReceiverValue<*>> origin=GET_PROPERTY + $this: GET_VAR ': .PersistentImplicitReceiverStack declared in .PersistentImplicitReceiverStack.iterator' type=.PersistentImplicitReceiverStack origin=null + FUN name:get visibility:public modality:FINAL <> ($this:.PersistentImplicitReceiverStack, name:kotlin.String?) returnType:.ImplicitReceiverValue<*>? [operator] + overridden: + public abstract fun get (name: kotlin.String?): .ImplicitReceiverValue<*>? [operator] declared in .ImplicitReceiverStack + $this: VALUE_PARAMETER name: type:.PersistentImplicitReceiverStack + VALUE_PARAMETER name:name index:0 type:kotlin.String? + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun get (name: kotlin.String?): .ImplicitReceiverValue<*>? [operator] declared in .PersistentImplicitReceiverStack' + CALL 'public final fun lastOrNull (): T of kotlin.collections.lastOrNull? declared in kotlin.collections' type=.ImplicitReceiverValue<*>? origin=null + : .ImplicitReceiverValue<*> + $receiver: CALL 'private final fun (): kotlin.collections.List<.ImplicitReceiverValue<*>> declared in .PersistentImplicitReceiverStack' type=kotlin.collections.List<.ImplicitReceiverValue<*>> origin=GET_PROPERTY + $this: GET_VAR ': .PersistentImplicitReceiverStack declared in .PersistentImplicitReceiverStack.get' type=.PersistentImplicitReceiverStack origin=null + FUN FAKE_OVERRIDE name:forEach visibility:public modality:OPEN <> ($this:java.lang.Iterable, p0:java.util.function.Consumer.ImplicitReceiverValue<*>?>?) returnType:kotlin.Unit [fake_override] + overridden: + public open fun forEach (p0: java.util.function.Consumer.ImplicitReceiverValue<*>?>?): kotlin.Unit [fake_override] declared in .ImplicitReceiverStack + public open fun forEach (p0: java.util.function.Consumer?): kotlin.Unit declared in kotlin.collections.Iterable + $this: VALUE_PARAMETER name: type:java.lang.Iterable + VALUE_PARAMETER name:p0 index:0 type:java.util.function.Consumer.ImplicitReceiverValue<*>?>? + FUN FAKE_OVERRIDE name:spliterator visibility:public modality:OPEN <> ($this:java.lang.Iterable) returnType:@[FlexibleNullability] java.util.Spliterator<.ImplicitReceiverValue<*>?> [fake_override] + overridden: + public open fun spliterator (): @[FlexibleNullability] java.util.Spliterator<.ImplicitReceiverValue<*>?> [fake_override] declared in .ImplicitReceiverStack + public open fun spliterator (): @[FlexibleNullability] java.util.Spliterator declared in kotlin.collections.Iterable + $this: VALUE_PARAMETER name: type:java.lang.Iterable + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:bar visibility:public modality:FINAL <> (s:kotlin.String) returnType:kotlin.Unit + VALUE_PARAMETER name:s index:0 type:kotlin.String + BLOCK_BODY + FUN name:foo visibility:public modality:FINAL <> (stack:.PersistentImplicitReceiverStack) returnType:kotlin.Unit + VALUE_PARAMETER name:stack index:0 type:.PersistentImplicitReceiverStack + BLOCK_BODY + CALL 'public final fun forEach (action: kotlin.Function1): kotlin.Unit [inline] declared in kotlin.collections' type=kotlin.Unit origin=null + : .ImplicitReceiverValue<*> + $receiver: GET_VAR 'stack: .PersistentImplicitReceiverStack declared in .foo' type=.PersistentImplicitReceiverStack origin=null + action: FUN_EXPR type=kotlin.Function1<.ImplicitReceiverValue<*>, kotlin.Unit> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:.ImplicitReceiverValue<*>) returnType:kotlin.Unit + VALUE_PARAMETER name:it index:0 type:.ImplicitReceiverValue<*> + BLOCK_BODY + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public final fun (): S of .ImplicitReceiverValue? declared in .ImplicitReceiverValue' type=.Symbol<*>? origin=GET_PROPERTY + $this: GET_VAR 'it: .ImplicitReceiverValue<*> declared in .foo.' type=.ImplicitReceiverValue<*> origin=null + CALL 'public final fun bar (s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + s: CALL 'public final fun (): kotlin.String declared in .ImplicitReceiverValue' type=kotlin.String origin=GET_PROPERTY + $this: GET_VAR 'it: .ImplicitReceiverValue<*> declared in .foo.' type=.ImplicitReceiverValue<*> origin=null + FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String + BLOCK_BODY + VAR name:stack type:.PersistentImplicitReceiverStack [val] + CONSTRUCTOR_CALL 'public constructor (stack: kotlin.collections.List<.ImplicitReceiverValue<*>>) [primary] declared in .PersistentImplicitReceiverStack' type=.PersistentImplicitReceiverStack origin=null + stack: CALL 'public final fun listOf (vararg elements: T of kotlin.collections.listOf): kotlin.collections.List declared in kotlin.collections' type=kotlin.collections.List<.ImplicitReceiverValue> origin=null + : .ImplicitReceiverValue + elements: VARARG type=kotlin.Array.ImplicitReceiverValue> varargElementType=.ImplicitReceiverValue + CONSTRUCTOR_CALL 'public constructor (boundSymbol: S of .ImplicitReceiverValue?, type: kotlin.String) [primary] declared in .ImplicitReceiverValue' type=.ImplicitReceiverValue origin=null + : kotlin.Nothing + boundSymbol: CONST Null type=kotlin.Nothing? value=null + type: CONST String type=kotlin.String value="O" + CONSTRUCTOR_CALL 'public constructor (boundSymbol: S of .ImplicitReceiverValue?, type: kotlin.String) [primary] declared in .ImplicitReceiverValue' type=.ImplicitReceiverValue origin=null + : kotlin.Nothing + boundSymbol: CONST Null type=kotlin.Nothing? value=null + type: CONST String type=kotlin.String value="K" + CALL 'public final fun foo (stack: .PersistentImplicitReceiverStack): kotlin.Unit declared in ' type=kotlin.Unit origin=null + stack: GET_VAR 'val stack: .PersistentImplicitReceiverStack [val] declared in .box' type=.PersistentImplicitReceiverStack origin=null + RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS + $this: CALL 'public final fun (): kotlin.String declared in .ImplicitReceiverValue' type=kotlin.String origin=GET_PROPERTY + $this: CALL 'public final fun first (): T of kotlin.collections.first declared in kotlin.collections' type=.ImplicitReceiverValue<*> origin=null + : .ImplicitReceiverValue<*> + $receiver: GET_VAR 'val stack: .PersistentImplicitReceiverStack [val] declared in .box' type=.PersistentImplicitReceiverStack origin=null + other: BLOCK type=kotlin.String? origin=SAFE_CALL + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.ImplicitReceiverValue<*>? [val] + CALL 'public final fun get (name: kotlin.String?): .ImplicitReceiverValue<*>? [operator] declared in .PersistentImplicitReceiverStack' type=.ImplicitReceiverValue<*>? origin=null + $this: GET_VAR 'val stack: .PersistentImplicitReceiverStack [val] declared in .box' type=.PersistentImplicitReceiverStack origin=null + name: CONST Null type=kotlin.Nothing? value=null + WHEN type=kotlin.String? origin=null + BRANCH + if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ + arg0: GET_VAR 'val tmp_0: .ImplicitReceiverValue<*>? [val] declared in .box' type=.ImplicitReceiverValue<*>? origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: CALL 'public final fun (): kotlin.String declared in .ImplicitReceiverValue' type=kotlin.String origin=GET_PROPERTY + $this: GET_VAR 'val tmp_0: .ImplicitReceiverValue<*>? [val] declared in .box' type=.ImplicitReceiverValue<*>? origin=null diff --git a/compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.kt b/compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.kt new file mode 100644 index 00000000000..15b59886069 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.kt @@ -0,0 +1,46 @@ +// WITH_RUNTIME +// FULL_JDK +// JVM_TARGET: 1.8 + +interface SymbolOwner> + +interface Symbol> + +interface ReceiverValue { + val type: String +} + +class ImplicitReceiverValue>(val boundSymbol: S?, override val type: String) : ReceiverValue + +abstract class ImplicitReceiverStack : Iterable> { + abstract operator fun get(name: String?): ImplicitReceiverValue<*>? +} + +class PersistentImplicitReceiverStack( + private val stack: List> +) : ImplicitReceiverStack(), Iterable> { + override operator fun iterator(): Iterator> { + return stack.iterator() + } + + override operator fun get(name: String?): ImplicitReceiverValue<*>? { + return stack.lastOrNull() + } +} + +fun bar(s: String) {} + +fun foo(stack: PersistentImplicitReceiverStack) { + stack.forEach { + it.boundSymbol + bar(it.type) + } +} + +fun box(): String { + val stack = PersistentImplicitReceiverStack( + listOf(ImplicitReceiverValue(null, "O"), ImplicitReceiverValue(null, "K")) + ) + foo(stack) + return stack.first().type + stack[null]?.type +} diff --git a/compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.kt.txt b/compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.kt.txt new file mode 100644 index 00000000000..31d5a81df78 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.kt.txt @@ -0,0 +1,85 @@ +interface SymbolOwner> { + +} + +interface Symbol> { + +} + +interface ReceiverValue { + abstract val type: String + abstract get + +} + +class ImplicitReceiverValue> : ReceiverValue { + constructor(boundSymbol: S?, type: String) /* primary */ { + super/*Any*/() + /* () */ + + } + + val boundSymbol: S? + field = boundSymbol + get + + override val type: String + field = type + override get + +} + +abstract class ImplicitReceiverStack : Iterable> { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + abstract operator fun get(name: String?): ImplicitReceiverValue<*>? + +} + +class PersistentImplicitReceiverStack : ImplicitReceiverStack, Iterable> { + constructor(stack: List>) /* primary */ { + super/*ImplicitReceiverStack*/() + /* () */ + + } + + private val stack: List> + field = stack + private get + + override operator fun iterator(): Iterator> { + return .().iterator() + } + + override operator fun get(name: String?): ImplicitReceiverValue<*>? { + return .().lastOrNull>() + } + +} + +fun bar(s: String) { +} + +fun foo(stack: PersistentImplicitReceiverStack) { + stack.forEach>(action = local fun (it: ImplicitReceiverValue<*>) { + it.() /*~> Unit */ + bar(s = it.()) + } +) +} + +fun box(): String { + val stack: PersistentImplicitReceiverStack = PersistentImplicitReceiverStack(stack = listOf>(elements = [ImplicitReceiverValue(boundSymbol = null, type = "O"), ImplicitReceiverValue(boundSymbol = null, type = "K")])) + foo(stack = stack) + return stack.first>().().plus(other = { // BLOCK + val tmp0_safe_receiver: ImplicitReceiverValue<*>? = stack.get(name = null) + when { + EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null + else -> tmp0_safe_receiver.() + } + }) +} diff --git a/compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.txt b/compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.txt new file mode 100644 index 00000000000..2b363bfc8a8 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.txt @@ -0,0 +1,256 @@ +FILE fqName: fileName:/ImplicitReceiverStack.kt + CLASS INTERFACE name:SymbolOwner modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.SymbolOwner.SymbolOwner> + TYPE_PARAMETER name:E index:0 variance: superTypes:[.SymbolOwner.SymbolOwner>] + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:Symbol modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Symbol.Symbol> + TYPE_PARAMETER name:E index:0 variance: superTypes:[.SymbolOwner.Symbol>] + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:ReceiverValue modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.ReceiverValue + PROPERTY name:type visibility:public modality:ABSTRACT [val] + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:ABSTRACT <> ($this:.ReceiverValue) returnType:kotlin.String + correspondingProperty: PROPERTY name:type visibility:public modality:ABSTRACT [val] + $this: VALUE_PARAMETER name: type:.ReceiverValue + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:ImplicitReceiverValue modality:FINAL visibility:public superTypes:[.ReceiverValue] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.ImplicitReceiverValue.ImplicitReceiverValue> + TYPE_PARAMETER name:S index:0 variance: superTypes:[.Symbol<*>] + CONSTRUCTOR visibility:public <> (boundSymbol:S of .ImplicitReceiverValue?, type:kotlin.String) returnType:.ImplicitReceiverValue.ImplicitReceiverValue> [primary] + VALUE_PARAMETER name:boundSymbol index:0 type:S of .ImplicitReceiverValue? + VALUE_PARAMETER name:type index:1 type:kotlin.String + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:ImplicitReceiverValue modality:FINAL visibility:public superTypes:[.ReceiverValue]' + PROPERTY name:boundSymbol visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:boundSymbol type:S of .ImplicitReceiverValue? visibility:private [final] + EXPRESSION_BODY + GET_VAR 'boundSymbol: S of .ImplicitReceiverValue? declared in .ImplicitReceiverValue.' type=S of .ImplicitReceiverValue? origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.ImplicitReceiverValue.ImplicitReceiverValue>) returnType:S of .ImplicitReceiverValue? + correspondingProperty: PROPERTY name:boundSymbol visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.ImplicitReceiverValue.ImplicitReceiverValue> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): S of .ImplicitReceiverValue? declared in .ImplicitReceiverValue' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:boundSymbol type:S of .ImplicitReceiverValue? visibility:private [final]' type=S of .ImplicitReceiverValue? origin=null + receiver: GET_VAR ': .ImplicitReceiverValue.ImplicitReceiverValue> declared in .ImplicitReceiverValue.' type=.ImplicitReceiverValue.ImplicitReceiverValue> origin=null + PROPERTY name:type visibility:public modality:OPEN [val] + FIELD PROPERTY_BACKING_FIELD name:type type:kotlin.String visibility:private [final] + EXPRESSION_BODY + GET_VAR 'type: kotlin.String declared in .ImplicitReceiverValue.' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:OPEN <> ($this:.ImplicitReceiverValue.ImplicitReceiverValue>) returnType:kotlin.String + correspondingProperty: PROPERTY name:type visibility:public modality:OPEN [val] + overridden: + public abstract fun (): kotlin.String declared in .ReceiverValue + $this: VALUE_PARAMETER name: type:.ImplicitReceiverValue.ImplicitReceiverValue> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .ImplicitReceiverValue' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:type type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .ImplicitReceiverValue.ImplicitReceiverValue> declared in .ImplicitReceiverValue.' type=.ImplicitReceiverValue.ImplicitReceiverValue> origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .ReceiverValue + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in .ReceiverValue + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in .ReceiverValue + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:ImplicitReceiverStack modality:ABSTRACT visibility:public superTypes:[kotlin.collections.Iterable<.ImplicitReceiverValue<*>>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.ImplicitReceiverStack + CONSTRUCTOR visibility:public <> () returnType:.ImplicitReceiverStack [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:ImplicitReceiverStack modality:ABSTRACT visibility:public superTypes:[kotlin.collections.Iterable<.ImplicitReceiverValue<*>>]' + FUN name:get visibility:public modality:ABSTRACT <> ($this:.ImplicitReceiverStack, name:kotlin.String?) returnType:.ImplicitReceiverValue<*>? [operator] + $this: VALUE_PARAMETER name: type:.ImplicitReceiverStack + VALUE_PARAMETER name:name index:0 type:kotlin.String? + FUN FAKE_OVERRIDE name:iterator visibility:public modality:ABSTRACT <> ($this:kotlin.collections.Iterable<.ImplicitReceiverValue<*>>) returnType:kotlin.collections.Iterator<.ImplicitReceiverValue<*>> [fake_override,operator] + overridden: + public abstract fun iterator (): kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterable + $this: VALUE_PARAMETER name: type:kotlin.collections.Iterable<.ImplicitReceiverValue<*>> + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in kotlin.collections.Iterable + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:forEach visibility:public modality:OPEN <> ($this:kotlin.collections.Iterable<.ImplicitReceiverValue<*>>, p0:@[FlexibleNullability] java.util.function.Consumer.ImplicitReceiverValue<*>?>?) returnType:kotlin.Unit [fake_override] + overridden: + public open fun forEach (p0: @[FlexibleNullability] java.util.function.Consumer?): kotlin.Unit declared in kotlin.collections.Iterable + $this: VALUE_PARAMETER name: type:kotlin.collections.Iterable<.ImplicitReceiverValue<*>> + VALUE_PARAMETER name:p0 index:0 type:@[FlexibleNullability] java.util.function.Consumer.ImplicitReceiverValue<*>?>? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.collections.Iterable + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:spliterator visibility:public modality:OPEN <> ($this:kotlin.collections.Iterable<.ImplicitReceiverValue<*>>) returnType:@[EnhancedNullability] java.util.Spliterator<@[EnhancedNullability] .ImplicitReceiverValue<*>> [fake_override] + overridden: + public open fun spliterator (): @[EnhancedNullability] java.util.Spliterator<@[EnhancedNullability] T of kotlin.collections.Iterable> declared in kotlin.collections.Iterable + $this: VALUE_PARAMETER name: type:kotlin.collections.Iterable<.ImplicitReceiverValue<*>> + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in kotlin.collections.Iterable + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:PersistentImplicitReceiverStack modality:FINAL visibility:public superTypes:[.ImplicitReceiverStack; kotlin.collections.Iterable<.ImplicitReceiverValue<*>>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.PersistentImplicitReceiverStack + CONSTRUCTOR visibility:public <> (stack:kotlin.collections.List<.ImplicitReceiverValue<*>>) returnType:.PersistentImplicitReceiverStack [primary] + VALUE_PARAMETER name:stack index:0 type:kotlin.collections.List<.ImplicitReceiverValue<*>> + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in .ImplicitReceiverStack' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:PersistentImplicitReceiverStack modality:FINAL visibility:public superTypes:[.ImplicitReceiverStack; kotlin.collections.Iterable<.ImplicitReceiverValue<*>>]' + PROPERTY name:stack visibility:private modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:stack type:kotlin.collections.List<.ImplicitReceiverValue<*>> visibility:private [final] + EXPRESSION_BODY + GET_VAR 'stack: kotlin.collections.List<.ImplicitReceiverValue<*>> declared in .PersistentImplicitReceiverStack.' type=kotlin.collections.List<.ImplicitReceiverValue<*>> origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.PersistentImplicitReceiverStack) returnType:kotlin.collections.List<.ImplicitReceiverValue<*>> + correspondingProperty: PROPERTY name:stack visibility:private modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.PersistentImplicitReceiverStack + BLOCK_BODY + RETURN type=kotlin.Nothing from='private final fun (): kotlin.collections.List<.ImplicitReceiverValue<*>> declared in .PersistentImplicitReceiverStack' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:stack type:kotlin.collections.List<.ImplicitReceiverValue<*>> visibility:private [final]' type=kotlin.collections.List<.ImplicitReceiverValue<*>> origin=null + receiver: GET_VAR ': .PersistentImplicitReceiverStack declared in .PersistentImplicitReceiverStack.' type=.PersistentImplicitReceiverStack origin=null + FUN name:iterator visibility:public modality:OPEN <> ($this:.PersistentImplicitReceiverStack) returnType:kotlin.collections.Iterator<.ImplicitReceiverValue<*>> [operator] + overridden: + public abstract fun iterator (): kotlin.collections.Iterator<.ImplicitReceiverValue<*>> [fake_override,operator] declared in .ImplicitReceiverStack + public abstract fun iterator (): kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterable + $this: VALUE_PARAMETER name: type:.PersistentImplicitReceiverStack + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun iterator (): kotlin.collections.Iterator<.ImplicitReceiverValue<*>> [operator] declared in .PersistentImplicitReceiverStack' + CALL 'public abstract fun iterator (): kotlin.collections.Iterator [operator] declared in kotlin.collections.List' type=kotlin.collections.Iterator<.ImplicitReceiverValue<*>> origin=null + $this: CALL 'private final fun (): kotlin.collections.List<.ImplicitReceiverValue<*>> declared in .PersistentImplicitReceiverStack' type=kotlin.collections.List<.ImplicitReceiverValue<*>> origin=GET_PROPERTY + $this: GET_VAR ': .PersistentImplicitReceiverStack declared in .PersistentImplicitReceiverStack.iterator' type=.PersistentImplicitReceiverStack origin=null + FUN name:get visibility:public modality:OPEN <> ($this:.PersistentImplicitReceiverStack, name:kotlin.String?) returnType:.ImplicitReceiverValue<*>? [operator] + overridden: + public abstract fun get (name: kotlin.String?): .ImplicitReceiverValue<*>? [operator] declared in .ImplicitReceiverStack + $this: VALUE_PARAMETER name: type:.PersistentImplicitReceiverStack + VALUE_PARAMETER name:name index:0 type:kotlin.String? + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun get (name: kotlin.String?): .ImplicitReceiverValue<*>? [operator] declared in .PersistentImplicitReceiverStack' + CALL 'public final fun lastOrNull (): T of kotlin.collections.lastOrNull? declared in kotlin.collections' type=.ImplicitReceiverValue<*>? origin=null + : .ImplicitReceiverValue<*> + $receiver: CALL 'private final fun (): kotlin.collections.List<.ImplicitReceiverValue<*>> declared in .PersistentImplicitReceiverStack' type=kotlin.collections.List<.ImplicitReceiverValue<*>> origin=GET_PROPERTY + $this: GET_VAR ': .PersistentImplicitReceiverStack declared in .PersistentImplicitReceiverStack.get' type=.PersistentImplicitReceiverStack origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .ImplicitReceiverStack + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in kotlin.collections.Iterable + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:forEach visibility:public modality:OPEN <> ($this:kotlin.collections.Iterable<.ImplicitReceiverValue<*>>, p0:@[FlexibleNullability] java.util.function.Consumer.ImplicitReceiverValue<*>?>?) returnType:kotlin.Unit [fake_override] + overridden: + public open fun forEach (p0: @[FlexibleNullability] java.util.function.Consumer.ImplicitReceiverValue<*>?>?): kotlin.Unit [fake_override] declared in .ImplicitReceiverStack + public open fun forEach (p0: @[FlexibleNullability] java.util.function.Consumer?): kotlin.Unit declared in kotlin.collections.Iterable + $this: VALUE_PARAMETER name: type:kotlin.collections.Iterable<.ImplicitReceiverValue<*>> + VALUE_PARAMETER name:p0 index:0 type:@[FlexibleNullability] java.util.function.Consumer.ImplicitReceiverValue<*>?>? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in .ImplicitReceiverStack + public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.collections.Iterable + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:spliterator visibility:public modality:OPEN <> ($this:kotlin.collections.Iterable<.ImplicitReceiverValue<*>>) returnType:@[EnhancedNullability] java.util.Spliterator<@[EnhancedNullability] .ImplicitReceiverValue<*>> [fake_override] + overridden: + public open fun spliterator (): @[EnhancedNullability] java.util.Spliterator<@[EnhancedNullability] .ImplicitReceiverValue<*>> [fake_override] declared in .ImplicitReceiverStack + public open fun spliterator (): @[EnhancedNullability] java.util.Spliterator<@[EnhancedNullability] T of kotlin.collections.Iterable> declared in kotlin.collections.Iterable + $this: VALUE_PARAMETER name: type:kotlin.collections.Iterable<.ImplicitReceiverValue<*>> + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in .ImplicitReceiverStack + public open fun toString (): kotlin.String [fake_override] declared in kotlin.collections.Iterable + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:bar visibility:public modality:FINAL <> (s:kotlin.String) returnType:kotlin.Unit + VALUE_PARAMETER name:s index:0 type:kotlin.String + BLOCK_BODY + FUN name:foo visibility:public modality:FINAL <> (stack:.PersistentImplicitReceiverStack) returnType:kotlin.Unit + VALUE_PARAMETER name:stack index:0 type:.PersistentImplicitReceiverStack + BLOCK_BODY + CALL 'public final fun forEach (action: kotlin.Function1): kotlin.Unit [inline] declared in kotlin.collections' type=kotlin.Unit origin=null + : .ImplicitReceiverValue<*> + $receiver: GET_VAR 'stack: .PersistentImplicitReceiverStack declared in .foo' type=.PersistentImplicitReceiverStack origin=null + action: FUN_EXPR type=kotlin.Function1<.ImplicitReceiverValue<*>, kotlin.Unit> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:.ImplicitReceiverValue<*>) returnType:kotlin.Unit + VALUE_PARAMETER name:it index:0 type:.ImplicitReceiverValue<*> + BLOCK_BODY + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public final fun (): S of .ImplicitReceiverValue? declared in .ImplicitReceiverValue' type=.Symbol<*>? origin=GET_PROPERTY + $this: GET_VAR 'it: .ImplicitReceiverValue<*> declared in .foo.' type=.ImplicitReceiverValue<*> origin=null + CALL 'public final fun bar (s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + s: CALL 'public open fun (): kotlin.String declared in .ImplicitReceiverValue' type=kotlin.String origin=GET_PROPERTY + $this: GET_VAR 'it: .ImplicitReceiverValue<*> declared in .foo.' type=.ImplicitReceiverValue<*> origin=null + FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String + BLOCK_BODY + VAR name:stack type:.PersistentImplicitReceiverStack [val] + CONSTRUCTOR_CALL 'public constructor (stack: kotlin.collections.List<.ImplicitReceiverValue<*>>) [primary] declared in .PersistentImplicitReceiverStack' type=.PersistentImplicitReceiverStack origin=null + stack: CALL 'public final fun listOf (vararg elements: T of kotlin.collections.listOf): kotlin.collections.List declared in kotlin.collections' type=kotlin.collections.List<.ImplicitReceiverValue> origin=null + : .ImplicitReceiverValue + elements: VARARG type=kotlin.Array.ImplicitReceiverValue> varargElementType=.ImplicitReceiverValue + CONSTRUCTOR_CALL 'public constructor (boundSymbol: S of .ImplicitReceiverValue?, type: kotlin.String) [primary] declared in .ImplicitReceiverValue' type=.ImplicitReceiverValue origin=null + : kotlin.Nothing + boundSymbol: CONST Null type=kotlin.Nothing? value=null + type: CONST String type=kotlin.String value="O" + CONSTRUCTOR_CALL 'public constructor (boundSymbol: S of .ImplicitReceiverValue?, type: kotlin.String) [primary] declared in .ImplicitReceiverValue' type=.ImplicitReceiverValue origin=null + : kotlin.Nothing + boundSymbol: CONST Null type=kotlin.Nothing? value=null + type: CONST String type=kotlin.String value="K" + CALL 'public final fun foo (stack: .PersistentImplicitReceiverStack): kotlin.Unit declared in ' type=kotlin.Unit origin=null + stack: GET_VAR 'val stack: .PersistentImplicitReceiverStack [val] declared in .box' type=.PersistentImplicitReceiverStack origin=null + RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS + $this: CALL 'public open fun (): kotlin.String declared in .ImplicitReceiverValue' type=kotlin.String origin=GET_PROPERTY + $this: CALL 'public final fun first (): T of kotlin.collections.first declared in kotlin.collections' type=.ImplicitReceiverValue<*> origin=null + : .ImplicitReceiverValue<*> + $receiver: GET_VAR 'val stack: .PersistentImplicitReceiverStack [val] declared in .box' type=.PersistentImplicitReceiverStack origin=null + other: BLOCK type=kotlin.String? origin=SAFE_CALL + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.ImplicitReceiverValue<*>? [val] + CALL 'public open fun get (name: kotlin.String?): .ImplicitReceiverValue<*>? [operator] declared in .PersistentImplicitReceiverStack' type=.ImplicitReceiverValue<*>? origin=GET_ARRAY_ELEMENT + $this: GET_VAR 'val stack: .PersistentImplicitReceiverStack [val] declared in .box' type=.PersistentImplicitReceiverStack origin=null + name: CONST Null type=kotlin.Nothing? value=null + WHEN type=kotlin.String? origin=null + BRANCH + if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ + arg0: GET_VAR 'val tmp_0: .ImplicitReceiverValue<*>? [val] declared in .box' type=.ImplicitReceiverValue<*>? origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: CALL 'public open fun (): kotlin.String declared in .ImplicitReceiverValue' type=kotlin.String origin=GET_PROPERTY + $this: GET_VAR 'val tmp_0: .ImplicitReceiverValue<*>? [val] declared in .box' type=.ImplicitReceiverValue<*>? origin=null diff --git a/compiler/testData/ir/irText/firProblems/MultiList.fir.txt b/compiler/testData/ir/irText/firProblems/MultiList.fir.txt index 7dcc48ba3f5..c682c9524ee 100644 --- a/compiler/testData/ir/irText/firProblems/MultiList.fir.txt +++ b/compiler/testData/ir/irText/firProblems/MultiList.fir.txt @@ -156,6 +156,23 @@ FILE fqName: fileName:/MultiList.kt overridden: public abstract fun (): kotlin.Int declared in kotlin.collections.List $this: VALUE_PARAMETER name: type:kotlin.collections.List + FUN FAKE_OVERRIDE name:spliterator visibility:public modality:OPEN <> ($this:java.util.Collection) returnType:@[FlexibleNullability] java.util.Spliterator<.Some.MyList>?> [fake_override] + overridden: + public open fun spliterator (): @[FlexibleNullability] java.util.Spliterator declared in java.util.Collection + $this: VALUE_PARAMETER name: type:java.util.Collection + FUN FAKE_OVERRIDE name:parallelStream visibility:public modality:OPEN <> ($this:java.util.Collection) returnType:@[FlexibleNullability] java.util.stream.Stream<.Some.MyList>?> [fake_override] + overridden: + public open fun parallelStream (): @[FlexibleNullability] java.util.stream.Stream declared in java.util.Collection + $this: VALUE_PARAMETER name: type:java.util.Collection + FUN FAKE_OVERRIDE name:stream visibility:public modality:OPEN <> ($this:java.util.Collection) returnType:@[FlexibleNullability] java.util.stream.Stream<.Some.MyList>?> [fake_override] + overridden: + public open fun stream (): @[FlexibleNullability] java.util.stream.Stream declared in java.util.Collection + $this: VALUE_PARAMETER name: type:java.util.Collection + FUN FAKE_OVERRIDE name:forEach visibility:public modality:OPEN <> ($this:java.lang.Iterable, p0:java.util.function.Consumer.Some.MyList>?>?) returnType:kotlin.Unit [fake_override] + overridden: + public open fun forEach (p0: java.util.function.Consumer?): kotlin.Unit declared in java.lang.Iterable + $this: VALUE_PARAMETER name: type:java.lang.Iterable + VALUE_PARAMETER name:p0 index:0 type:java.util.function.Consumer.Some.MyList>?>? FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any @@ -246,6 +263,27 @@ FILE fqName: fileName:/MultiList.kt public abstract fun (): kotlin.Int declared in kotlin.collections.List public abstract fun (): kotlin.Int declared in java.util.ArrayList $this: VALUE_PARAMETER name: type:kotlin.collections.List + FUN FAKE_OVERRIDE name:spliterator visibility:public modality:OPEN <> ($this:java.util.Collection) returnType:@[FlexibleNullability] java.util.Spliterator<.Some.SomeList>?> [fake_override] + overridden: + public open fun spliterator (): @[FlexibleNullability] java.util.Spliterator<.Some.MyList>?> [fake_override] declared in .MyList + public open fun spliterator (): @[FlexibleNullability] java.util.Spliterator declared in java.util.ArrayList + $this: VALUE_PARAMETER name: type:java.util.Collection + FUN FAKE_OVERRIDE name:parallelStream visibility:public modality:OPEN <> ($this:java.util.Collection) returnType:@[FlexibleNullability] java.util.stream.Stream<.Some.SomeList>?> [fake_override] + overridden: + public open fun parallelStream (): @[FlexibleNullability] java.util.stream.Stream<.Some.MyList>?> [fake_override] declared in .MyList + public open fun parallelStream (): @[FlexibleNullability] java.util.stream.Stream<@[FlexibleNullability] E of java.util.ArrayList?> declared in java.util.ArrayList + $this: VALUE_PARAMETER name: type:java.util.Collection + FUN FAKE_OVERRIDE name:stream visibility:public modality:OPEN <> ($this:java.util.Collection) returnType:@[FlexibleNullability] java.util.stream.Stream<.Some.SomeList>?> [fake_override] + overridden: + public open fun stream (): @[FlexibleNullability] java.util.stream.Stream<.Some.MyList>?> [fake_override] declared in .MyList + public open fun stream (): @[FlexibleNullability] java.util.stream.Stream<@[FlexibleNullability] E of java.util.ArrayList?> declared in java.util.ArrayList + $this: VALUE_PARAMETER name: type:java.util.Collection + FUN FAKE_OVERRIDE name:forEach visibility:public modality:OPEN <> ($this:java.lang.Iterable, p0:java.util.function.Consumer.Some.SomeList>?>?) returnType:kotlin.Unit [fake_override] + overridden: + public open fun forEach (p0: java.util.function.Consumer.Some.MyList>?>?): kotlin.Unit [fake_override] declared in .MyList + public open fun forEach (p0: java.util.function.Consumer?): kotlin.Unit declared in java.util.ArrayList + $this: VALUE_PARAMETER name: type:java.lang.Iterable + VALUE_PARAMETER name:p0 index:0 type:java.util.function.Consumer.Some.SomeList>?>? FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any @@ -348,17 +386,6 @@ FILE fqName: fileName:/MultiList.kt public open fun retainAll (p0: kotlin.collections.Collection): kotlin.Boolean declared in java.util.ArrayList $this: VALUE_PARAMETER name: type:java.util.ArrayList VALUE_PARAMETER name:p0 index:0 type:kotlin.collections.Collection<.Some.SomeList>> - FUN FAKE_OVERRIDE name:forEach visibility:public modality:OPEN <> ($this:java.lang.Iterable, p0:java.util.function.Consumer.Some.SomeList>?>?) returnType:kotlin.Unit [fake_override] - overridden: - public open fun forEach (p0: java.util.function.Consumer.Some.MyList>?>?): kotlin.Unit declared in .MyList - public open fun forEach (p0: java.util.function.Consumer?): kotlin.Unit declared in java.util.ArrayList - $this: VALUE_PARAMETER name: type:java.lang.Iterable - VALUE_PARAMETER name:p0 index:0 type:java.util.function.Consumer.Some.SomeList>?>? - FUN FAKE_OVERRIDE name:spliterator visibility:public modality:OPEN <> ($this:java.util.Collection) returnType:@[FlexibleNullability] java.util.Spliterator<.Some.SomeList>?> [fake_override] - overridden: - public open fun spliterator (): @[FlexibleNullability] java.util.Spliterator<.Some.MyList>?> declared in .MyList - public open fun spliterator (): @[FlexibleNullability] java.util.Spliterator declared in java.util.ArrayList - $this: VALUE_PARAMETER name: type:java.util.Collection FUN FAKE_OVERRIDE name:removeIf visibility:public modality:OPEN <> ($this:java.util.ArrayList, p0:java.util.function.Predicate.Some.SomeList>?>?) returnType:kotlin.Boolean [fake_override] overridden: public open fun removeIf (p0: java.util.function.Predicate?): kotlin.Boolean declared in java.util.ArrayList @@ -446,6 +473,23 @@ FILE fqName: fileName:/MultiList.kt public abstract fun (): kotlin.Int declared in kotlin.collections.List public abstract fun (): kotlin.Int declared in java.util.ArrayList $this: VALUE_PARAMETER name: type:kotlin.collections.List + FUN FAKE_OVERRIDE name:spliterator visibility:public modality:OPEN <> ($this:java.util.Collection) returnType:@[FlexibleNullability] java.util.Spliterator<.Some?> [fake_override] + overridden: + public open fun spliterator (): @[FlexibleNullability] java.util.Spliterator declared in java.util.Collection + $this: VALUE_PARAMETER name: type:java.util.Collection + FUN FAKE_OVERRIDE name:parallelStream visibility:public modality:OPEN <> ($this:java.util.Collection) returnType:@[FlexibleNullability] java.util.stream.Stream<.Some?> [fake_override] + overridden: + public open fun parallelStream (): @[FlexibleNullability] java.util.stream.Stream declared in java.util.Collection + $this: VALUE_PARAMETER name: type:java.util.Collection + FUN FAKE_OVERRIDE name:stream visibility:public modality:OPEN <> ($this:java.util.Collection) returnType:@[FlexibleNullability] java.util.stream.Stream<.Some?> [fake_override] + overridden: + public open fun stream (): @[FlexibleNullability] java.util.stream.Stream declared in java.util.Collection + $this: VALUE_PARAMETER name: type:java.util.Collection + FUN FAKE_OVERRIDE name:forEach visibility:public modality:OPEN <> ($this:java.lang.Iterable, p0:java.util.function.Consumer.Some?>?) returnType:kotlin.Unit [fake_override] + overridden: + public open fun forEach (p0: java.util.function.Consumer?): kotlin.Unit declared in java.lang.Iterable + $this: VALUE_PARAMETER name: type:java.lang.Iterable + VALUE_PARAMETER name:p0 index:0 type:java.util.function.Consumer.Some?>? FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any @@ -548,15 +592,6 @@ FILE fqName: fileName:/MultiList.kt public open fun retainAll (p0: kotlin.collections.Collection): kotlin.Boolean declared in java.util.ArrayList $this: VALUE_PARAMETER name: type:java.util.ArrayList VALUE_PARAMETER name:p0 index:0 type:kotlin.collections.Collection<.Some> - FUN FAKE_OVERRIDE name:forEach visibility:public modality:OPEN <> ($this:java.lang.Iterable, p0:java.util.function.Consumer.Some?>?) returnType:kotlin.Unit [fake_override] - overridden: - public open fun forEach (p0: java.util.function.Consumer?): kotlin.Unit declared in java.lang.Iterable - $this: VALUE_PARAMETER name: type:java.lang.Iterable - VALUE_PARAMETER name:p0 index:0 type:java.util.function.Consumer.Some?>? - FUN FAKE_OVERRIDE name:spliterator visibility:public modality:OPEN <> ($this:java.util.Collection) returnType:@[FlexibleNullability] java.util.Spliterator<.Some?> [fake_override] - overridden: - public open fun spliterator (): @[FlexibleNullability] java.util.Spliterator declared in java.util.Collection - $this: VALUE_PARAMETER name: type:java.util.Collection FUN FAKE_OVERRIDE name:removeIf visibility:public modality:OPEN <> ($this:java.util.ArrayList, p0:java.util.function.Predicate.Some?>?) returnType:kotlin.Boolean [fake_override] overridden: public open fun removeIf (p0: java.util.function.Predicate?): kotlin.Boolean declared in java.util.ArrayList diff --git a/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index 5b81fdc7934..a6d46b7c275 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -1811,6 +1811,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { runTest("compiler/testData/ir/irText/firProblems/FirBuilder.kt"); } + @TestMetadata("ImplicitReceiverStack.kt") + public void testImplicitReceiverStack() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.kt"); + } + @TestMetadata("inapplicableCollectionSet.kt") public void testInapplicableCollectionSet() throws Exception { runTest("compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.kt"); From 42ea4463eee8c7ec8565726d0ca821a31dbfeca4 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 7 Dec 2020 17:22:14 +0300 Subject: [PATCH 546/698] Fix type argument inconsistency in FirResolvedQualifier --- .../problems/TypesEligibleForSimpleVisit.kt | 12 ++++++++++++ .../problems/TypesEligibleForSimpleVisit.txt | 3 +++ .../fir/FirDiagnosticsWithStdlibTestGenerated.java | 5 +++++ .../jetbrains/kotlin/fir/FirQualifiedNameResolver.kt | 2 +- 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/TypesEligibleForSimpleVisit.kt create mode 100644 compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/TypesEligibleForSimpleVisit.txt diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/TypesEligibleForSimpleVisit.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/TypesEligibleForSimpleVisit.kt new file mode 100644 index 00000000000..a8cd7c29635 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/TypesEligibleForSimpleVisit.kt @@ -0,0 +1,12 @@ +// Extracted from ReflectKotlinClass.kt + +private val TYPES_ELIGIBLE_FOR_SIMPLE_VISIT = setOf>( + // Primitives + java.lang.Integer::class.java, java.lang.Character::class.java, java.lang.Byte::class.java, java.lang.Long::class.java, + java.lang.Short::class.java, java.lang.Boolean::class.java, java.lang.Double::class.java, java.lang.Float::class.java, + // Arrays of primitives + IntArray::class.java, CharArray::class.java, ByteArray::class.java, LongArray::class.java, + ShortArray::class.java, BooleanArray::class.java, DoubleArray::class.java, FloatArray::class.java, + // Others + Class::class.java, String::class.java +) diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/TypesEligibleForSimpleVisit.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/TypesEligibleForSimpleVisit.txt new file mode 100644 index 00000000000..b17fc03afe3 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/TypesEligibleForSimpleVisit.txt @@ -0,0 +1,3 @@ +FILE: TypesEligibleForSimpleVisit.kt + private final val TYPES_ELIGIBLE_FOR_SIMPLE_VISIT: R|kotlin/collections/Set>| = R|kotlin/collections/setOf||>(vararg((Q|java/lang/Integer|).R|kotlin/jvm/java|, (Q|java/lang/Character|).R|kotlin/jvm/java|, (Q|java/lang/Byte|).R|kotlin/jvm/java|, (Q|java/lang/Long|).R|kotlin/jvm/java|, (Q|java/lang/Short|).R|kotlin/jvm/java|, (Q|java/lang/Boolean|).R|kotlin/jvm/java|, (Q|java/lang/Double|).R|kotlin/jvm/java|, (Q|java/lang/Float|).R|kotlin/jvm/java|, (Q|kotlin/IntArray|).R|kotlin/jvm/java|, (Q|kotlin/CharArray|).R|kotlin/jvm/java|, (Q|kotlin/ByteArray|).R|kotlin/jvm/java|, (Q|kotlin/LongArray|).R|kotlin/jvm/java|, (Q|kotlin/ShortArray|).R|kotlin/jvm/java|, (Q|kotlin/BooleanArray|).R|kotlin/jvm/java|, (Q|kotlin/DoubleArray|).R|kotlin/jvm/java|, (Q|kotlin/FloatArray|).R|kotlin/jvm/java|, (Q|java/lang/Class|).R|kotlin/jvm/java||>, (Q|kotlin/String|).R|kotlin/jvm/java|)) + private get(): R|kotlin/collections/Set>| diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java index 75a1c08b174..87f0f776e9e 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java @@ -1239,6 +1239,11 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/receiverResolutionInLambda.kt"); } + @TestMetadata("TypesEligibleForSimpleVisit.kt") + public void testTypesEligibleForSimpleVisit() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/TypesEligibleForSimpleVisit.kt"); + } + @TestMetadata("weakHashMap.kt") public void testWeakHashMap() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/weakHashMap.kt"); diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirQualifiedNameResolver.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirQualifiedNameResolver.kt index 6ca46209b58..b4777c7ccbc 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirQualifiedNameResolver.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirQualifiedNameResolver.kt @@ -48,7 +48,7 @@ class FirQualifiedNameResolver(private val components: BodyResolveComponents) { if (callee.name.isSpecial) { qualifierStack.clear() } else { - qualifierStack.add(NameWithTypeArguments(callee.name, typeArguments)) + qualifierStack.add(NameWithTypeArguments(callee.name, typeArguments.toList())) } } From 2dfba10d8401824a5622fc7758027965c152aa5e Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Fri, 4 Dec 2020 15:54:38 -0800 Subject: [PATCH 547/698] FIR: extend suspend conversion to intersection type --- .../backend/generators/AdapterGenerator.kt | 27 +++++------- .../kotlin/fir/resolve/calls/Arguments.kt | 42 ++++++++----------- .../fir/resolve/inference/InferenceUtils.kt | 27 ++++++++++++ .../intersectionTypeToSubtypeConversion.kt | 1 - 4 files changed, 56 insertions(+), 41 deletions(-) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/AdapterGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/AdapterGenerator.kt index 8a545df2e03..79e66bca164 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/AdapterGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/AdapterGenerator.kt @@ -400,8 +400,8 @@ internal class AdapterGenerator( return this } val expectedType = parameter?.returnTypeRef?.coneType ?: return this - // Expect the expected type to be a suspend functional type, and the argument type is not a suspend functional type. - if (!expectedType.isSuspendFunctionType(session) || argument.typeRef.coneType.isSuspendFunctionType(session)) { + // Expect the expected type to be a suspend functional type. + if (!expectedType.isSuspendFunctionType(session)) { return this } val expectedFunctionalType = expectedType.suspendFunctionTypeToFunctionType(session) @@ -424,22 +424,17 @@ internal class AdapterGenerator( private fun findInvokeSymbol(expectedFunctionalType: ConeClassLikeType, argument: FirExpression): IrSimpleFunctionSymbol? { val argumentType = argument.typeRef.coneType - // To avoid any remaining exotic types, e.g., intersection type, like it(FunctionN..., SuspendFunctionN...) - if (argumentType !is ConeClassLikeType) { - return null - } + val argumentTypeWithInvoke = argumentType.findSubtypeOfNonSuspendFunctionalType(session, expectedFunctionalType) ?: return null - if (argumentType.isSubtypeOfFunctionalType(session, expectedFunctionalType)) { - return if (argumentType.isBuiltinFunctionalType(session)) { - argumentType.findBaseInvokeSymbol(session, scopeSession) - } else { - argumentType.findContributedInvokeSymbol(session, scopeSession, expectedFunctionalType, shouldCalculateReturnTypesOfFakeOverrides = true) - }?.let { - declarationStorage.getIrFunctionSymbol(it) as? IrSimpleFunctionSymbol - } + return if (argumentTypeWithInvoke.isBuiltinFunctionalType(session)) { + (argumentTypeWithInvoke as? ConeClassLikeType)?.findBaseInvokeSymbol(session, scopeSession) + } else { + argumentTypeWithInvoke.findContributedInvokeSymbol( + session, scopeSession, expectedFunctionalType, shouldCalculateReturnTypesOfFakeOverrides = true + ) + }?.let { + declarationStorage.getIrFunctionSymbol(it) as? IrSimpleFunctionSymbol } - - return null } private fun createAdapterFunctionForArgument( diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt index a217d289950..25593e0f709 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt @@ -247,36 +247,30 @@ private fun argumentTypeWithSuspendConversion( ): ConeKotlinType? { // TODO: should refer to LanguageVersionSettings.SuspendConversion - // To avoid any remaining exotic types, e.g., intersection type, like it(FunctionN..., SuspendFunctionN...) - if (argumentType !is ConeClassLikeType) { - return null - } - - // Expect the expected type to be a suspend functional type, and the argument type is not a suspend functional type. - if (!expectedType.isSuspendFunctionType(session) || argumentType.isSuspendFunctionType(session)) { + // Expect the expected type to be a suspend functional type. + if (!expectedType.isSuspendFunctionType(session)) { return null } // We want to check the argument type against non-suspend functional type. val expectedFunctionalType = expectedType.suspendFunctionTypeToFunctionType(session) - if (argumentType.isSubtypeOfFunctionalType(session, expectedFunctionalType)) { - return argumentType.findContributedInvokeSymbol( - session, - scopeSession, - expectedFunctionalType, - shouldCalculateReturnTypesOfFakeOverrides = false - )?.let { invokeSymbol -> - createFunctionalType( - invokeSymbol.fir.valueParameters.map { it.returnTypeRef.coneType }, - null, - invokeSymbol.fir.returnTypeRef.coneType, - isSuspend = true, - isKFunctionType = argumentType.isKFunctionType(session) - ) - } - } - return null + val argumentTypeWithInvoke = argumentType.findSubtypeOfNonSuspendFunctionalType(session, expectedFunctionalType) + + return argumentTypeWithInvoke?.findContributedInvokeSymbol( + session, + scopeSession, + expectedFunctionalType, + shouldCalculateReturnTypesOfFakeOverrides = false + )?.let { invokeSymbol -> + createFunctionalType( + invokeSymbol.fir.valueParameters.map { it.returnTypeRef.coneType }, + null, + invokeSymbol.fir.returnTypeRef.coneType, + isSuspend = true, + isKFunctionType = argumentType.isKFunctionType(session) + ) + } } fun Candidate.prepareCapturedType(argumentType: ConeKotlinType, context: ResolutionContext): ConeKotlinType { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/InferenceUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/InferenceUtils.kt index 0ebce74b100..f884ff32dd0 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/InferenceUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/InferenceUtils.kt @@ -97,6 +97,33 @@ fun ConeKotlinType.isSubtypeOfFunctionalType(session: FirSession, expectedFuncti return AbstractTypeChecker.isSubtypeOf(session.typeContext, this, expectedFunctionalType.replaceArgumentsWithStarProjections()) } +fun ConeKotlinType.findSubtypeOfNonSuspendFunctionalType(session: FirSession, expectedFunctionalType: ConeClassLikeType): ConeKotlinType? { + require(expectedFunctionalType.isBuiltinFunctionalType(session) && !expectedFunctionalType.isSuspendFunctionType(session)) + return when (this) { + is ConeClassLikeType -> { + // Expect the argument type is not a suspend functional type. + if (isSuspendFunctionType(session) || !isSubtypeOfFunctionalType(session, expectedFunctionalType)) + null + else + this + } + is ConeIntersectionType -> { + if (intersectedTypes.any { it.isSuspendFunctionType(session) }) + null + else + intersectedTypes.find { it.findSubtypeOfNonSuspendFunctionalType(session, expectedFunctionalType) != null } + } + is ConeTypeParameterType -> { + val bounds = lookupTag.typeParameterSymbol.fir.bounds.map { it.coneType } + if (bounds.any { it.isSuspendFunctionType(session) }) + null + else + bounds.find { it.findSubtypeOfNonSuspendFunctionalType(session, expectedFunctionalType) != null } + } + else -> null + } +} + fun ConeClassLikeType.findBaseInvokeSymbol(session: FirSession, scopeSession: ScopeSession): FirFunctionSymbol<*>? { require(this.isBuiltinFunctionalType(session)) val functionN = (lookupTag.toSymbol(session)?.fir as? FirClass<*>) ?: return null diff --git a/compiler/testData/codegen/box/coroutines/suspendConversion/intersectionTypeToSubtypeConversion.kt b/compiler/testData/codegen/box/coroutines/suspendConversion/intersectionTypeToSubtypeConversion.kt index e23cf2d35d3..0b626b0b9e5 100644 --- a/compiler/testData/codegen/box/coroutines/suspendConversion/intersectionTypeToSubtypeConversion.kt +++ b/compiler/testData/codegen/box/coroutines/suspendConversion/intersectionTypeToSubtypeConversion.kt @@ -3,7 +3,6 @@ // WITH_COROUTINES // IGNORE_BACKEND: JVM, NATIVE, JS, JS_IR // IGNORE_BACKEND: JS_IR_ES6 -// IGNORE_BACKEND_FIR: JVM_IR // IGNORE_LIGHT_ANALYSIS import helpers.* From 5daa406cdfface3d5d708afd59526f8885b3fe50 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 9 Dec 2020 17:36:26 +0300 Subject: [PATCH 548/698] Use FirNamedFunctionSymbol in FirScope.processFunctionsByName --- .../generators/DataClassMembersGenerator.kt | 4 +--- .../generators/DelegatedMemberGenerator.kt | 2 -- .../kotlin/fir/lazy/Fir2IrLazyClass.kt | 2 +- .../JavaAnnotationSyntheticPropertiesScope.kt | 6 ++--- .../JavaClassMembersEnhancementScope.kt | 6 ++--- .../scopes/JavaClassStaticEnhancementScope.kt | 6 +++-- .../scopes/JavaClassStaticUseSiteScope.kt | 7 +++--- .../scopes/JavaClassUseSiteMemberScope.kt | 8 +++---- .../kotlin/fir/scopes/jvm/JvmMappedScope.kt | 7 +++--- .../kotlin/fir/resolve/SamResolution.kt | 9 ++----- .../kotlin/fir/resolve/calls/SuperCalls.kt | 3 +-- .../fir/resolve/inference/InferenceUtils.kt | 8 +++---- .../scopes/impl/AbstractFirOverrideScope.kt | 2 -- .../impl/AbstractFirUseSiteMemberScope.kt | 24 +++++++------------ .../scopes/impl/FirAbstractImportingScope.kt | 4 ++-- .../impl/FirClassDeclaredMemberScope.kt | 2 +- .../scopes/impl/FirClassSubstitutionScope.kt | 12 ++++------ .../scopes/impl/FirDelegatedMemberScope.kt | 6 ++--- .../kotlin/fir/scopes/impl/FirLocalScope.kt | 4 ++-- ...irNestedClassifierScopeWithSubstitution.kt | 2 +- .../impl/FirObjectImportedCallableScope.kt | 6 +---- .../fir/scopes/impl/FirOnlyCallablesScope.kt | 4 ++-- .../fir/scopes/impl/FirPackageMemberScope.kt | 7 ++---- .../FirScopeWithFakeOverrideTypeCalculator.kt | 2 +- .../kotlin/fir/scopes/impl/FirStaticScope.kt | 5 ++-- .../scopes/impl/FirTypeIntersectionScope.kt | 2 +- .../kotlin/fir/scopes/FirCompositeScope.kt | 4 ++-- .../scopes/FirContainingNamesAwareScope.kt | 9 ++----- .../jetbrains/kotlin/fir/scopes/FirScope.kt | 4 ++-- .../api/fir/scopes/KtFirDelegatingScope.kt | 7 +----- 30 files changed, 66 insertions(+), 108 deletions(-) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DataClassMembersGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DataClassMembersGenerator.kt index c78bbd2d935..6e59e9879e3 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DataClassMembersGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DataClassMembersGenerator.kt @@ -156,9 +156,7 @@ class DataClassMembersGenerator(val components: Fir2IrComponents) { withForcedTypeCalculator = true ).processFunctionsByName(name) { val declaration = it.fir - if (declaration is FirSimpleFunction && - declaration.matchesDataClassSyntheticMemberSignatures - ) { + if (declaration.matchesDataClassSyntheticMemberSignatures) { putIfAbsent(declaration.name, declaration) } } diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DelegatedMemberGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DelegatedMemberGenerator.kt index 32f8027bb27..5bba834af73 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DelegatedMemberGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DelegatedMemberGenerator.kt @@ -42,8 +42,6 @@ internal class DelegatedMemberGenerator( val subClassScope = firSubClass.unsubstitutedScope(session, scopeSession, withForcedTypeCalculator = true) subClassScope.processAllFunctions { functionSymbol -> - if (functionSymbol !is FirNamedFunctionSymbol) return@processAllFunctions - val unwrapped = functionSymbol .unwrapDelegateTarget(subClassLookupTag, subClassScope::getDirectOverriddenFunctions, firField, firSubClass) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/lazy/Fir2IrLazyClass.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/lazy/Fir2IrLazyClass.kt index 1d93cb0f28c..7fcc8ad800e 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/lazy/Fir2IrLazyClass.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/lazy/Fir2IrLazyClass.kt @@ -139,7 +139,7 @@ class Fir2IrLazyClass( result += declarationStorage.getIrFunctionSymbol(declaration.symbol).owner } else { scope.processFunctionsByName(declaration.name) { - if (it is FirNamedFunctionSymbol && it.dispatchReceiverClassOrNull() == fir.symbol.toLookupTag()) { + if (it.dispatchReceiverClassOrNull() == fir.symbol.toLookupTag()) { if (it.isAbstractMethodOfAny()) { return@processFunctionsByName } diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaAnnotationSyntheticPropertiesScope.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaAnnotationSyntheticPropertiesScope.kt index 1728ddcd160..0ed0a39f5c0 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaAnnotationSyntheticPropertiesScope.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaAnnotationSyntheticPropertiesScope.kt @@ -24,13 +24,13 @@ class JavaAnnotationSyntheticPropertiesScope( ) : FirTypeScope() { private val classId: ClassId = owner.classId private val names: Set = owner.fir.declarations.mapNotNullTo(mutableSetOf()) { (it as? FirSimpleFunction)?.name } - private val syntheticPropertiesCache = mutableMapOf, FirVariableSymbol<*>>() + private val syntheticPropertiesCache = mutableMapOf>() override fun processDeclaredConstructors(processor: (FirConstructorSymbol) -> Unit) { delegateScope.processDeclaredConstructors(processor) } - override fun processFunctionsByName(name: Name, processor: (FirFunctionSymbol<*>) -> Unit) { + override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) { if (name in names) return delegateScope.processFunctionsByName(name, processor) } @@ -38,7 +38,7 @@ class JavaAnnotationSyntheticPropertiesScope( override fun processPropertiesByName(name: Name, processor: (FirVariableSymbol<*>) -> Unit) { if (name !in names) return delegateScope.processFunctionsByName(name) { functionSymbol -> - val function = functionSymbol.fir as? FirSimpleFunction ?: return@processFunctionsByName + val function = functionSymbol.fir val symbol = syntheticPropertiesCache.getOrPut(functionSymbol) { val callableId = CallableId(classId, name) FirAccessorSymbol(callableId, callableId).also { diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassMembersEnhancementScope.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassMembersEnhancementScope.kt index c7341de513d..fcedee9c6df 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassMembersEnhancementScope.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassMembersEnhancementScope.kt @@ -143,18 +143,18 @@ class JavaClassMembersEnhancementScope( return this } - override fun processFunctionsByName(name: Name, processor: (FirFunctionSymbol<*>) -> Unit) { + override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) { useSiteMemberScope.processFunctionsByName(name) process@{ original -> val symbol = signatureEnhancement.enhancedFunction(original, name) val enhancedFunction = (symbol.fir as? FirSimpleFunction)?.changeSignatureIfErasedValueParameter() val enhancedFunctionSymbol = enhancedFunction?.symbol ?: symbol - if (enhancedFunctionSymbol is FirNamedFunctionSymbol && original is FirNamedFunctionSymbol) { + if (enhancedFunctionSymbol is FirNamedFunctionSymbol) { overriddenFunctions[enhancedFunctionSymbol] = original.fir .overriddenMembers(enhancedFunctionSymbol.fir.name) .mapNotNull { it.symbol as? FirNamedFunctionSymbol } + processor(enhancedFunctionSymbol) } - processor(enhancedFunctionSymbol) } return super.processFunctionsByName(name, processor) diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassStaticEnhancementScope.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassStaticEnhancementScope.kt index a10c49a0d5e..0970e5b8845 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassStaticEnhancementScope.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassStaticEnhancementScope.kt @@ -30,10 +30,12 @@ class JavaClassStaticEnhancementScope( return super.processPropertiesByName(name, processor) } - override fun processFunctionsByName(name: Name, processor: (FirFunctionSymbol<*>) -> Unit) { + override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) { useSiteStaticScope.processFunctionsByName(name) process@{ original -> val enhancedFunction = signatureEnhancement.enhancedFunction(original, name) - processor(enhancedFunction) + if (enhancedFunction is FirNamedFunctionSymbol) { + processor(enhancedFunction) + } } return super.processFunctionsByName(name, processor) diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassStaticUseSiteScope.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassStaticUseSiteScope.kt index bd6ce009fd4..ba531606c4e 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassStaticUseSiteScope.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassStaticUseSiteScope.kt @@ -10,7 +10,6 @@ import org.jetbrains.kotlin.fir.java.JavaTypeParameterStack import org.jetbrains.kotlin.fir.scopes.FirContainingNamesAwareScope import org.jetbrains.kotlin.fir.scopes.FirScope import org.jetbrains.kotlin.fir.scopes.getContainingCallableNamesIfPresent -import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirVariableSymbol import org.jetbrains.kotlin.fir.symbols.impl.isStatic @@ -24,11 +23,11 @@ class JavaClassStaticUseSiteScope internal constructor( private val superTypesScopes: List, javaTypeParameterStack: JavaTypeParameterStack, ) : FirScope(), FirContainingNamesAwareScope { - private val functions = hashMapOf>>() + private val functions = hashMapOf>() private val properties = hashMapOf>>() private val overrideChecker = JavaOverrideChecker(session, javaTypeParameterStack) - override fun processFunctionsByName(name: Name, processor: (FirFunctionSymbol<*>) -> Unit) { + override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) { functions.getOrPut(name) { computeFunctions(name) }.forEach(processor) @@ -43,7 +42,7 @@ class JavaClassStaticUseSiteScope internal constructor( val result = mutableListOf() declaredMemberScope.processFunctionsByName(name) l@{ functionSymbol -> - if (functionSymbol !is FirNamedFunctionSymbol || !functionSymbol.isStatic) return@l + if (!functionSymbol.isStatic) return@l result.add(functionSymbol) superClassSymbols.removeAll { superClassSymbol -> diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassUseSiteMemberScope.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassUseSiteMemberScope.kt index dc0aaee3938..1a442177c27 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassUseSiteMemberScope.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassUseSiteMemberScope.kt @@ -41,7 +41,7 @@ class JavaClassUseSiteMemberScope( internal val symbol = klass.symbol internal fun bindOverrides(name: Name) { - val overrideCandidates = mutableSetOf>() + val overrideCandidates = mutableSetOf() declaredMemberScope.processFunctionsByName(name) { overrideCandidates += it } @@ -93,7 +93,7 @@ class JavaClassUseSiteMemberScope( var getterSymbol: FirNamedFunctionSymbol? = null var setterSymbol: FirNamedFunctionSymbol? = null declaredMemberScope.processFunctionsByName(getterName) { functionSymbol -> - if (getterSymbol == null && functionSymbol is FirNamedFunctionSymbol) { + if (getterSymbol == null) { val function = functionSymbol.fir if (!function.isStatic && function.valueParameters.isEmpty()) { getterSymbol = functionSymbol @@ -103,7 +103,7 @@ class JavaClassUseSiteMemberScope( val setterName = session.syntheticNamesProvider.setterNameByGetterName(getterName) if (getterSymbol != null && setterName != null) { declaredMemberScope.processFunctionsByName(setterName) { functionSymbol -> - if (setterSymbol == null && functionSymbol is FirNamedFunctionSymbol) { + if (setterSymbol == null) { val function = functionSymbol.fir if (!function.isStatic && function.valueParameters.size == 1) { val returnTypeRef = function.returnTypeRef @@ -152,7 +152,7 @@ class JavaClassUseSiteMemberScope( return processAccessorFunctionsAndPropertiesByName(name, getterNames, processor) } - override fun processFunctionsByName(name: Name, processor: (FirFunctionSymbol<*>) -> Unit) { + override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) { if (symbol.fir !is FirJavaClass) { return super.processFunctionsByName(name, processor) } diff --git a/compiler/fir/jvm/src/org/jetbrains/kotlin/fir/scopes/jvm/JvmMappedScope.kt b/compiler/fir/jvm/src/org/jetbrains/kotlin/fir/scopes/jvm/JvmMappedScope.kt index fa4a240654d..62a08051b3c 100644 --- a/compiler/fir/jvm/src/org/jetbrains/kotlin/fir/scopes/jvm/JvmMappedScope.kt +++ b/compiler/fir/jvm/src/org/jetbrains/kotlin/fir/scopes/jvm/JvmMappedScope.kt @@ -11,7 +11,6 @@ import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor import org.jetbrains.kotlin.fir.scopes.* import org.jetbrains.kotlin.fir.symbols.impl.* import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.utils.addIfNotNull class JvmMappedScope( private val declaredMemberScope: FirScope, @@ -19,13 +18,13 @@ class JvmMappedScope( private val signatures: Signatures ) : FirTypeScope() { - override fun processFunctionsByName(name: Name, processor: (FirFunctionSymbol<*>) -> Unit) { + override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) { val visibleMethods = signatures.visibleMethodSignaturesByName[name] ?: return declaredMemberScope.processFunctionsByName(name, processor) val declared = mutableListOf() declaredMemberScope.processFunctionsByName(name) { symbol -> - declared.addIfNotNull(symbol as FirNamedFunctionSymbol) + declared += symbol processor(symbol) } @@ -91,7 +90,7 @@ class JvmMappedScope( // NOTE: No-arg constructors @OptIn(ExperimentalStdlibApi::class) - private val additionalHiddenConstructors = buildSet { + private val additionalHiddenConstructors = buildSet { // kotlin.text.String pseudo-constructors should be used instead of java.lang.String constructors listOf( "", diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SamResolution.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SamResolution.kt index 699027ec044..0b8947f2440 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SamResolution.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SamResolution.kt @@ -288,13 +288,8 @@ private fun FirRegularClass.findSingleAbstractMethodByNames( classUseSiteMemberScope.processFunctionsByName(candidateName) { functionSymbol -> val firFunction = functionSymbol.fir - require(firFunction is FirSimpleFunction) { - "${functionSymbol.callableId - .callableName} is expected to be _root_ide_package_.org.jetbrains.kotlin.fir.declarations.FirSimpleFunction, but ${functionSymbol::class} was found" - } - - if (firFunction.modality != Modality.ABSTRACT || firFunction - .isPublicInObject(checkOnlyName = false) + if (firFunction.modality != Modality.ABSTRACT || + firFunction.isPublicInObject(checkOnlyName = false) ) return@processFunctionsByName if (resultMethod != null) { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/SuperCalls.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/SuperCalls.kt index 08f80b1da1c..02a97a20dde 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/SuperCalls.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/SuperCalls.kt @@ -9,7 +9,6 @@ import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.fir.declarations.FirCallableMemberDeclaration import org.jetbrains.kotlin.fir.declarations.FirProperty -import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction import org.jetbrains.kotlin.fir.declarations.modality import org.jetbrains.kotlin.fir.dispatchReceiverClassOrNull import org.jetbrains.kotlin.fir.expressions.FirFunctionCall @@ -124,7 +123,7 @@ private inline fun BodyResolveComponents.resolveSupertypesByMembers( private fun BodyResolveComponents.getFunctionMembers(type: ConeKotlinType, name: Name): Collection> = buildList { type.scope(session, scopeSession, FakeOverrideTypeCalculator.DoNothing)?.processFunctionsByName(name) { - addIfNotNull(it.fir as? FirSimpleFunction) + add(it.fir) } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/InferenceUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/InferenceUtils.kt index f884ff32dd0..602f1792166 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/InferenceUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/InferenceUtils.kt @@ -124,10 +124,10 @@ fun ConeKotlinType.findSubtypeOfNonSuspendFunctionalType(session: FirSession, ex } } -fun ConeClassLikeType.findBaseInvokeSymbol(session: FirSession, scopeSession: ScopeSession): FirFunctionSymbol<*>? { +fun ConeClassLikeType.findBaseInvokeSymbol(session: FirSession, scopeSession: ScopeSession): FirNamedFunctionSymbol? { require(this.isBuiltinFunctionalType(session)) val functionN = (lookupTag.toSymbol(session)?.fir as? FirClass<*>) ?: return null - var baseInvokeSymbol: FirFunctionSymbol<*>? = null + var baseInvokeSymbol: FirNamedFunctionSymbol? = null functionN.unsubstitutedScope( session, scopeSession, @@ -155,9 +155,7 @@ fun ConeKotlinType.findContributedInvokeSymbol( val scope = scope(session, scopeSession, fakeOverrideTypeCalculator) ?: return null var declaredInvoke: FirNamedFunctionSymbol? = null scope.processFunctionsByName(OperatorNameConventions.INVOKE) { functionSymbol -> - if (functionSymbol is FirNamedFunctionSymbol && - functionSymbol.fir.valueParameters.size == baseInvokeSymbol.fir.valueParameters.size - ) { + if (functionSymbol.fir.valueParameters.size == baseInvokeSymbol.fir.valueParameters.size) { declaredInvoke = functionSymbol return@processFunctionsByName } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/AbstractFirOverrideScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/AbstractFirOverrideScope.kt index 28fc28d6904..a1dcd85471f 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/AbstractFirOverrideScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/AbstractFirOverrideScope.kt @@ -8,12 +8,10 @@ package org.jetbrains.kotlin.fir.scopes.impl import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.declarations.* -import org.jetbrains.kotlin.fir.declarations.builder.FirSimpleFunctionBuilder import org.jetbrains.kotlin.fir.scopes.FirOverrideChecker import org.jetbrains.kotlin.fir.scopes.FirTypeScope import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol abstract class AbstractFirOverrideScope( val session: FirSession, diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/AbstractFirUseSiteMemberScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/AbstractFirUseSiteMemberScope.kt index b60a7d1a39d..ca22a5f4dc1 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/AbstractFirUseSiteMemberScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/AbstractFirUseSiteMemberScope.kt @@ -18,11 +18,11 @@ abstract class AbstractFirUseSiteMemberScope( protected val declaredMemberScope: FirScope ) : AbstractFirOverrideScope(session, overrideChecker) { - private val functions = hashMapOf>>() + private val functions = hashMapOf>() private val directOverriddenFunctions = hashMapOf>() protected val directOverriddenProperties = hashMapOf>() - override fun processFunctionsByName(name: Name, processor: (FirFunctionSymbol<*>) -> Unit) { + override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) { functions.getOrPut(name) { doProcessFunctions(name) }.forEach { @@ -32,24 +32,20 @@ abstract class AbstractFirUseSiteMemberScope( private fun doProcessFunctions( name: Name - ): Collection> = mutableListOf>().apply { + ): Collection = mutableListOf().apply { val overrideCandidates = mutableSetOf>() declaredMemberScope.processFunctionsByName(name) { symbol -> if (symbol.isStatic) return@processFunctionsByName - if (symbol is FirNamedFunctionSymbol) { - val directOverridden = computeDirectOverridden(symbol) - this@AbstractFirUseSiteMemberScope.directOverriddenFunctions[symbol] = directOverridden - } + val directOverridden = computeDirectOverridden(symbol) + this@AbstractFirUseSiteMemberScope.directOverriddenFunctions[symbol] = directOverridden overrideCandidates += symbol add(symbol) } superTypesScope.processFunctionsByName(name) { - if (it !is FirConstructorSymbol) { - val overriddenBy = it.getOverridden(overrideCandidates) - if (overriddenBy == null) { - add(it) - } + val overriddenBy = it.getOverridden(overrideCandidates) + if (overriddenBy == null) { + add(it) } } } @@ -58,9 +54,7 @@ abstract class AbstractFirUseSiteMemberScope( val result = mutableListOf() val firSimpleFunction = symbol.fir superTypesScope.processFunctionsByName(symbol.callableId.callableName) { superSymbol -> - if (superSymbol is FirNamedFunctionSymbol && - overrideChecker.isOverriddenFunction(firSimpleFunction, superSymbol.fir) - ) { + if (overrideChecker.isOverriddenFunction(firSimpleFunction, superSymbol.fir)) { result.add(superSymbol) } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirAbstractImportingScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirAbstractImportingScope.kt index 4111f925e23..23ddb2458b9 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirAbstractImportingScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirAbstractImportingScope.kt @@ -88,11 +88,11 @@ abstract class FirAbstractImportingScope( processor: (FirCallableSymbol<*>) -> Unit ) - final override fun processFunctionsByName(name: Name, processor: (FirFunctionSymbol<*>) -> Unit) { + final override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) { return processCallables( name, TowerScopeLevel.Token.Functions - ) { if (it is FirFunctionSymbol<*>) processor(it) } + ) { if (it is FirNamedFunctionSymbol) processor(it) } } final override fun processPropertiesByName(name: Name, processor: (FirVariableSymbol<*>) -> Unit) { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassDeclaredMemberScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassDeclaredMemberScope.kt index 2a9e5615f14..9d85dfc5f7d 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassDeclaredMemberScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassDeclaredMemberScope.kt @@ -45,7 +45,7 @@ class FirClassDeclaredMemberScope( result } - override fun processFunctionsByName(name: Name, processor: (FirFunctionSymbol<*>) -> Unit) { + override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) { if (name == CONSTRUCTOR_NAME) return processCallables(name, processor) } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassSubstitutionScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassSubstitutionScope.kt index c62711f7d2f..e6e22c6fdff 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassSubstitutionScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassSubstitutionScope.kt @@ -28,13 +28,13 @@ class FirClassSubstitutionScope( private val makeExpect: Boolean = false ) : FirTypeScope() { - private val substitutionOverrideFunctions = mutableMapOf, FirFunctionSymbol<*>>() + private val substitutionOverrideFunctions = mutableMapOf() private val substitutionOverrideConstructors = mutableMapOf() private val substitutionOverrideVariables = mutableMapOf, FirVariableSymbol<*>>() private val newOwnerClassId = dispatchReceiverTypeForSubstitutedMembers.lookupTag.classId - override fun processFunctionsByName(name: Name, processor: (FirFunctionSymbol<*>) -> Unit) { + override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) { useSiteMemberScope.processFunctionsByName(name) process@{ original -> val function = substitutionOverrideFunctions.getOrPut(original) { createSubstitutionOverrideFunction(original) } processor(function) @@ -110,13 +110,9 @@ class FirClassSubstitutionScope( return substitutor.substituteOrNull(this) } - private fun createSubstitutionOverrideFunction(original: FirFunctionSymbol<*>): FirFunctionSymbol<*> { + private fun createSubstitutionOverrideFunction(original: FirNamedFunctionSymbol): FirNamedFunctionSymbol { if (substitutor == ConeSubstitutor.Empty) return original - val member = when (original) { - is FirNamedFunctionSymbol -> original.fir - is FirConstructorSymbol -> return original - else -> throw AssertionError("Should not be here") - } + val member = original.fir if (skipPrivateMembers && member.visibility == Visibilities.Private) return original val (newTypeParameters, newReceiverType, newReturnType, newSubstitutor, fakeOverrideSubstitution) = createSubstitutedData(member) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirDelegatedMemberScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirDelegatedMemberScope.kt index eafd6e2f1d4..6dc9c3586f6 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirDelegatedMemberScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirDelegatedMemberScope.kt @@ -33,9 +33,9 @@ class FirDelegatedMemberScope( private val dispatchReceiverType = containingClass.defaultType() private val overrideChecker = FirStandardOverrideChecker(session) - override fun processFunctionsByName(name: Name, processor: (FirFunctionSymbol<*>) -> Unit) { + override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) { useSiteScope.processFunctionsByName(name) processor@{ functionSymbol -> - if (functionSymbol !is FirNamedFunctionSymbol || functionSymbol.fir.isPublicInAny()) { + if (functionSymbol.fir.isPublicInAny()) { processor(functionSymbol) return@processor } @@ -46,7 +46,7 @@ class FirDelegatedMemberScope( return@processor } - if (declaredMemberScope.getFunctions(name).any { it is FirNamedFunctionSymbol && overrideChecker.isOverriddenFunction(it.fir, original) }) { + if (declaredMemberScope.getFunctions(name).any { overrideChecker.isOverriddenFunction(it.fir, original) }) { processor(functionSymbol) return@processor } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirLocalScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirLocalScope.kt index 3f96d7ee5d4..d4dd9312a77 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirLocalScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirLocalScope.kt @@ -21,7 +21,7 @@ import org.jetbrains.kotlin.name.Name class FirLocalScope private constructor( val properties: PersistentMap>, - val functions: PersistentMultimap>, + val functions: PersistentMultimap, val classes: PersistentMap ) : FirScope(), FirContainingNamesAwareScope { constructor() : this(persistentMapOf(), PersistentMultimap(), persistentMapOf()) @@ -50,7 +50,7 @@ class FirLocalScope private constructor( ) } - override fun processFunctionsByName(name: Name, processor: (FirFunctionSymbol<*>) -> Unit) { + override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) { for (function in functions[name]) { processor(function) } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirNestedClassifierScopeWithSubstitution.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirNestedClassifierScopeWithSubstitution.kt index a3fc0f9f7db..6af59a16a95 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirNestedClassifierScopeWithSubstitution.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirNestedClassifierScopeWithSubstitution.kt @@ -20,7 +20,7 @@ private class FirNestedClassifierScopeWithSubstitution( private val substitutor: ConeSubstitutor ) : FirScope() { - override fun processFunctionsByName(name: Name, processor: (FirFunctionSymbol<*>) -> Unit) { + override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) { scope.processFunctionsByName(name, processor) } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirObjectImportedCallableScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirObjectImportedCallableScope.kt index 8d4e082837c..676c22fe672 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirObjectImportedCallableScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirObjectImportedCallableScope.kt @@ -20,12 +20,8 @@ class FirObjectImportedCallableScope( private val importedClassId: ClassId, private val objectUseSiteScope: FirTypeScope ) : FirScope(), FirContainingNamesAwareScope { - override fun processFunctionsByName(name: Name, processor: (FirFunctionSymbol<*>) -> Unit) { + override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) { objectUseSiteScope.processFunctionsByName(name) wrapper@{ symbol -> - if (symbol !is FirNamedFunctionSymbol) { - processor(symbol) - return@wrapper - } val function = symbol.fir val syntheticFunction = buildSimpleFunctionCopy(function) { origin = FirDeclarationOrigin.ImportedFromObject diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirOnlyCallablesScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirOnlyCallablesScope.kt index 196159d97c0..1e145ffce37 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirOnlyCallablesScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirOnlyCallablesScope.kt @@ -6,12 +6,12 @@ package org.jetbrains.kotlin.fir.scopes.impl import org.jetbrains.kotlin.fir.scopes.FirScope -import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol +import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirVariableSymbol import org.jetbrains.kotlin.name.Name class FirOnlyCallablesScope(val delegate: FirScope) : FirScope() { - override fun processFunctionsByName(name: Name, processor: (FirFunctionSymbol<*>) -> Unit) { + override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) { return delegate.processFunctionsByName(name, processor) } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirPackageMemberScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirPackageMemberScope.kt index ddef6bc15f2..01a2658079c 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirPackageMemberScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirPackageMemberScope.kt @@ -10,10 +10,7 @@ import org.jetbrains.kotlin.fir.resolve.firSymbolProvider import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor import org.jetbrains.kotlin.fir.resolve.transformers.ensureResolvedForCalls import org.jetbrains.kotlin.fir.scopes.FirScope -import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirClassifierSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirVariableSymbol +import org.jetbrains.kotlin.fir.symbols.impl.* import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name @@ -39,7 +36,7 @@ class FirPackageMemberScope(val fqName: FqName, val session: FirSession) : FirSc } } - override fun processFunctionsByName(name: Name, processor: (FirFunctionSymbol<*>) -> Unit) { + override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) { processCallables(name, processor) } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirScopeWithFakeOverrideTypeCalculator.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirScopeWithFakeOverrideTypeCalculator.kt index cf9466297d9..62d2e0d49f5 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirScopeWithFakeOverrideTypeCalculator.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirScopeWithFakeOverrideTypeCalculator.kt @@ -24,7 +24,7 @@ class FirScopeWithFakeOverrideTypeCalculator( delegate.processClassifiersByNameWithSubstitution(name, processor) } - override fun processFunctionsByName(name: Name, processor: (FirFunctionSymbol<*>) -> Unit) { + override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) { delegate.processFunctionsByName(name) { updateReturnType(it.fir) processor(it) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirStaticScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirStaticScope.kt index ecc31ee1edf..b8900ce9f84 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirStaticScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirStaticScope.kt @@ -10,9 +10,8 @@ import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction import org.jetbrains.kotlin.fir.declarations.isStatic import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor import org.jetbrains.kotlin.fir.scopes.FirScope -import org.jetbrains.kotlin.fir.scopes.getContainingCallableNamesIfPresent import org.jetbrains.kotlin.fir.symbols.impl.FirClassifierSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol +import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirVariableSymbol import org.jetbrains.kotlin.name.Name @@ -21,7 +20,7 @@ class FirStaticScope(private val delegateScope: FirScope) : FirScope() { delegateScope.processClassifiersByNameWithSubstitution(name, processor) } - override fun processFunctionsByName(name: Name, processor: (FirFunctionSymbol<*>) -> Unit) { + override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) { delegateScope.processFunctionsByName(name) { if ((it.fir as? FirSimpleFunction)?.isStatic == true) { processor(it) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScope.kt index 64498314fc6..88913c34eca 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScope.kt @@ -40,7 +40,7 @@ class FirTypeIntersectionScope private constructor( private val intersectionOverrides: MutableMap, MemberWithBaseScope>> = mutableMapOf() - override fun processFunctionsByName(name: Name, processor: (FirFunctionSymbol<*>) -> Unit) { + override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) { if (!processCallablesByName(name, processor, absentFunctions, FirScope::processFunctionsByName)) { super.processFunctionsByName(name, processor) } diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirCompositeScope.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirCompositeScope.kt index 4f6fbe520fa..16037f8c429 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirCompositeScope.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirCompositeScope.kt @@ -7,7 +7,7 @@ package org.jetbrains.kotlin.fir.scopes import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor import org.jetbrains.kotlin.fir.symbols.impl.FirClassifierSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol +import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirVariableSymbol import org.jetbrains.kotlin.name.Name @@ -37,7 +37,7 @@ class FirCompositeScope(val scopes: Iterable) : FirScope(), FirContain } } - override fun processFunctionsByName(name: Name, processor: (FirFunctionSymbol<*>) -> Unit) { + override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) { return processComposite(FirScope::processFunctionsByName, name, processor) } diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirContainingNamesAwareScope.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirContainingNamesAwareScope.kt index d0fcc4c6325..ebce240c8be 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirContainingNamesAwareScope.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirContainingNamesAwareScope.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.fir.scopes import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol +import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirVariableSymbol import org.jetbrains.kotlin.name.Name @@ -21,7 +22,7 @@ fun FirScope.getContainingCallableNamesIfPresent(): Set = fun FirScope.getContainingClassifierNamesIfPresent(): Set = if (this is FirContainingNamesAwareScope) getClassifierNames() else emptySet() -fun S.processAllFunctions(processor: (FirFunctionSymbol<*>) -> Unit) where S : FirScope, S : FirContainingNamesAwareScope { +fun S.processAllFunctions(processor: (FirNamedFunctionSymbol) -> Unit) where S : FirScope, S : FirContainingNamesAwareScope { for (name in getCallableNames()) { processFunctionsByName(name, processor) } @@ -33,12 +34,6 @@ fun S.processAllProperties(processor: (FirVariableSymbol<*>) -> Unit) where } } -fun S.collectAllFunctions(): Collection> where S : FirScope, S : FirContainingNamesAwareScope { - return mutableListOf>().apply { - processAllFunctions(this::add) - } -} - fun S.collectAllProperties(): Collection> where S : FirScope, S : FirContainingNamesAwareScope { return mutableListOf>().apply { processAllProperties(this::add) diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirScope.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirScope.kt index 3345ec25923..835b8d15e63 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirScope.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirScope.kt @@ -18,7 +18,7 @@ abstract class FirScope { open fun processFunctionsByName( name: Name, - processor: (FirFunctionSymbol<*>) -> Unit + processor: (FirNamedFunctionSymbol) -> Unit ) { } @@ -40,7 +40,7 @@ fun FirScope.getSingleClassifier(name: Name): FirClassifierSymbol<*>? = mutableL processClassifiersByName(name, this::add) }.singleOrNull() -fun FirScope.getFunctions(name: Name): List> = mutableListOf>().apply { +fun FirScope.getFunctions(name: Name): List = mutableListOf().apply { processFunctionsByName(name, this::add) } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/scopes/KtFirDelegatingScope.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/scopes/KtFirDelegatingScope.kt index 3c6ce6fc5d1..11f67dfc73f 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/scopes/KtFirDelegatingScope.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/scopes/KtFirDelegatingScope.kt @@ -5,13 +5,10 @@ package org.jetbrains.kotlin.idea.frontend.api.fir.scopes -import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction import org.jetbrains.kotlin.fir.isSubstitutionOverride import org.jetbrains.kotlin.fir.scopes.FirContainingNamesAwareScope import org.jetbrains.kotlin.fir.scopes.FirScope -import org.jetbrains.kotlin.fir.scopes.getDeclaredConstructors import org.jetbrains.kotlin.fir.scopes.processClassifiersByName -import org.jetbrains.kotlin.fir.symbols.impl.FirConstructorSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol import org.jetbrains.kotlin.idea.frontend.api.ValidityToken import org.jetbrains.kotlin.idea.frontend.api.fir.KtSymbolByFirBuilder @@ -62,9 +59,7 @@ internal fun FirScope.getCallableSymbols(callableNames: Collection, builde callableNames.forEach { name -> val callables = mutableListOf() processFunctionsByName(name) { firSymbol -> - (firSymbol.fir as? FirSimpleFunction)?.let { fir -> - callables.add(builder.buildFunctionSymbol(fir)) - } + callables.add(builder.buildFunctionSymbol(firSymbol.fir)) } processPropertiesByName(name) { firSymbol -> val symbol = when { From 313dfaf48cf31d62a2965f7b9f283d4bcb602f53 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Wed, 9 Dec 2020 11:23:36 +0300 Subject: [PATCH 549/698] JVM_IR KT-43812 erase generic arguments of SAM wrapper supertype --- .../kotlin/backend/jvm/ir/IrUtils.kt | 21 +++++++++++-------- .../lower/JvmSingleAbstractMethodLowering.kt | 8 +++---- .../samGenericSuperinterface.kt | 16 ++++++++++++++ .../samGenericSuperinterface.txt | 13 ++++++++++++ .../samGenericSuperinterface_ir.txt | 15 +++++++++++++ .../samSpecializedGenericSuperinterface.kt | 16 ++++++++++++++ .../samSpecializedGenericSuperinterface.txt | 13 ++++++++++++ ...samSpecializedGenericSuperinterface_ir.txt | 15 +++++++++++++ .../codegen/BytecodeListingTestGenerated.java | 10 +++++++++ .../ir/IrBytecodeListingTestGenerated.java | 10 +++++++++ 10 files changed, 124 insertions(+), 13 deletions(-) create mode 100644 compiler/testData/codegen/bytecodeListing/samGenericSuperinterface.kt create mode 100644 compiler/testData/codegen/bytecodeListing/samGenericSuperinterface.txt create mode 100644 compiler/testData/codegen/bytecodeListing/samGenericSuperinterface_ir.txt create mode 100644 compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface.kt create mode 100644 compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface.txt create mode 100644 compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface_ir.txt diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/ir/IrUtils.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/ir/IrUtils.kt index 786d67dd08a..10b77a303ae 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/ir/IrUtils.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/ir/IrUtils.kt @@ -379,18 +379,21 @@ fun collectVisibleTypeParameters(scopeOwner: IrTypeParametersContainer): Set genericSam(f: () -> T): T = J.g(f) + +// FILE: J.java +public class J { + static T g(Sam s) { + return s.get(); + } +} + +// FILE: Sam.java +public interface Sam { + T get(); +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/samGenericSuperinterface.txt b/compiler/testData/codegen/bytecodeListing/samGenericSuperinterface.txt new file mode 100644 index 00000000000..95f7782207e --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/samGenericSuperinterface.txt @@ -0,0 +1,13 @@ +@kotlin.Metadata +final class SamGenericSuperinterfaceKt$sam$Sam$0 { + // source: 'samGenericSuperinterface.kt' + method (p0: kotlin.jvm.functions.Function0): void + public synthetic final method get(): java.lang.Object + private synthetic final field function: kotlin.jvm.functions.Function0 +} + +@kotlin.Metadata +public final class SamGenericSuperinterfaceKt { + // source: 'samGenericSuperinterface.kt' + public final static <(Lkotlin/jvm/functions/Function0<+TT;>;)TT;> method genericSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Object +} diff --git a/compiler/testData/codegen/bytecodeListing/samGenericSuperinterface_ir.txt b/compiler/testData/codegen/bytecodeListing/samGenericSuperinterface_ir.txt new file mode 100644 index 00000000000..96e17793796 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/samGenericSuperinterface_ir.txt @@ -0,0 +1,15 @@ +@kotlin.Metadata +final class SamGenericSuperinterfaceKt$sam$Sam$0 { + // source: 'samGenericSuperinterface.kt' + method (@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): void + public synthetic final method get(): java.lang.Object + private synthetic final field function: kotlin.jvm.functions.Function0 + final inner class SamGenericSuperinterfaceKt$sam$Sam$0 +} + +@kotlin.Metadata +public final class SamGenericSuperinterfaceKt { + // source: 'samGenericSuperinterface.kt' + public final static <(Lkotlin/jvm/functions/Function0<+TT;>;)TT;> method genericSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Object + final inner class SamGenericSuperinterfaceKt$sam$Sam$0 +} diff --git a/compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface.kt b/compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface.kt new file mode 100644 index 00000000000..5d2290fba45 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface.kt @@ -0,0 +1,16 @@ +// WITH_SIGNATURES +// FILE: samGenericSuperinterface.kt + +fun specializedSam(f: () -> String) = J.g(f) + +// FILE: J.java +public class J { + static T g(Sam s) { + return s.get(); + } +} + +// FILE: Sam.java +public interface Sam { + T get(); +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface.txt b/compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface.txt new file mode 100644 index 00000000000..da97bd5cec5 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface.txt @@ -0,0 +1,13 @@ +@kotlin.Metadata +final class SamGenericSuperinterfaceKt$sam$Sam$0 { + // source: 'samGenericSuperinterface.kt' + method (p0: kotlin.jvm.functions.Function0): void + public synthetic final method get(): java.lang.Object + private synthetic final field function: kotlin.jvm.functions.Function0 +} + +@kotlin.Metadata +public final class SamGenericSuperinterfaceKt { + // source: 'samGenericSuperinterface.kt' + public final static <(Lkotlin/jvm/functions/Function0;)Ljava/lang/String;> method specializedSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.String +} diff --git a/compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface_ir.txt b/compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface_ir.txt new file mode 100644 index 00000000000..25f44905b2a --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface_ir.txt @@ -0,0 +1,15 @@ +@kotlin.Metadata +final class SamGenericSuperinterfaceKt$sam$Sam$0 { + // source: 'samGenericSuperinterface.kt' + method (@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): void + public synthetic final method get(): java.lang.Object + private synthetic final field function: kotlin.jvm.functions.Function0 + final inner class SamGenericSuperinterfaceKt$sam$Sam$0 +} + +@kotlin.Metadata +public final class SamGenericSuperinterfaceKt { + // source: 'samGenericSuperinterface.kt' + public final static <(Lkotlin/jvm/functions/Function0;)Ljava/lang/String;> method specializedSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.String + final inner class SamGenericSuperinterfaceKt$sam$Sam$0 +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index c421d32d645..5897a7b6fbe 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -214,6 +214,16 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/samAdapterAndInlinedOne.kt"); } + @TestMetadata("samGenericSuperinterface.kt") + public void testSamGenericSuperinterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/samGenericSuperinterface.kt"); + } + + @TestMetadata("samSpecializedGenericSuperinterface.kt") + public void testSamSpecializedGenericSuperinterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface.kt"); + } + @TestMetadata("varargsBridge.kt") public void testVarargsBridge() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/varargsBridge.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index 98ed33c98c4..139e31166d6 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -214,6 +214,16 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/samAdapterAndInlinedOne.kt"); } + @TestMetadata("samGenericSuperinterface.kt") + public void testSamGenericSuperinterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/samGenericSuperinterface.kt"); + } + + @TestMetadata("samSpecializedGenericSuperinterface.kt") + public void testSamSpecializedGenericSuperinterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface.kt"); + } + @TestMetadata("varargsBridge.kt") public void testVarargsBridge() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/varargsBridge.kt"); From a6cb156ce923dffe26c397d13f6c3c01d5c79a41 Mon Sep 17 00:00:00 2001 From: Jiaxiang Chen Date: Mon, 26 Oct 2020 23:50:00 -0700 Subject: [PATCH 550/698] Allow multiple retry for AnalysisHandlerExtension --- .../kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt index 80b91b123e3..862235a02f2 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt @@ -472,8 +472,8 @@ object KotlinToJVMBytecodeCompiler { // Clear all diagnostic messages configuration[CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY]?.clear() - // Repeat analysis with additional Java roots (kapt generated sources) - return analyze(environment) + // Repeat analysis with additional source roots generated by compiler plugins. + return repeatAnalysisIfNeeded(analyze(environment), environment) } return result From 1a377069dd860be18482d1d3c67302ac57cfbce5 Mon Sep 17 00:00:00 2001 From: Jiaxiang Chen Date: Tue, 24 Nov 2020 01:28:58 -0800 Subject: [PATCH 551/698] Allow AnalysisHandlerExtension to provide additional classpath on retry --- .../kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt | 4 ++++ .../src/org/jetbrains/kotlin/analyzer/AnalysisResult.kt | 1 + 2 files changed, 5 insertions(+) diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt index 862235a02f2..bf750a4a152 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt @@ -463,6 +463,10 @@ object KotlinToJVMBytecodeCompiler { environment.updateClasspath(result.additionalJavaRoots.map { JavaSourceRoot(it, null) }) } + if (result.additionalClassPathRoots.isNotEmpty()) { + environment.updateClasspath(result.additionalClassPathRoots.map { JvmClasspathRoot(it, false) }) + } + if (result.additionalKotlinRoots.isNotEmpty()) { environment.addKotlinSourceRoots(result.additionalKotlinRoots) } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/analyzer/AnalysisResult.kt b/compiler/frontend/src/org/jetbrains/kotlin/analyzer/AnalysisResult.kt index 86c7ea1e61a..73717ca991f 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/analyzer/AnalysisResult.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/analyzer/AnalysisResult.kt @@ -72,6 +72,7 @@ open class AnalysisResult protected constructor( moduleDescriptor: ModuleDescriptor, val additionalJavaRoots: List, val additionalKotlinRoots: List, + val additionalClassPathRoots: List = emptyList(), val addToEnvironment: Boolean = true ) : AnalysisResult(bindingContext, moduleDescriptor) From f5f1984a6053b912fdf1660081bc5c0a471260e0 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Mon, 16 Nov 2020 11:27:04 +0300 Subject: [PATCH 552/698] [FE] Allow declare sealed class inheritors in different files in one module #KT-13495 --- ...irOldFrontendDiagnosticsTestGenerated.java | 5 +++ .../ir/FirBlackBoxCodegenTestGenerated.java | 5 +++ .../resolve/FunctionDescriptorResolver.kt | 17 ++++--- .../lazy/descriptors/LazyClassMemberScope.kt | 4 +- .../box/sealed/multipleFiles_enabled.kt | 24 ++++++++++ .../tests/sealed/MultipleFiles_enabled.fir.kt | 30 +++++++++++++ .../tests/sealed/MultipleFiles_enabled.kt | 30 +++++++++++++ .../tests/sealed/MultipleFiles_enabled.txt | 45 +++++++++++++++++++ .../checkers/DiagnosticsTestGenerated.java | 5 +++ .../DiagnosticsUsingJavacTestGenerated.java | 5 +++ .../codegen/BlackBoxCodegenTestGenerated.java | 5 +++ .../LightAnalysisModeTestGenerated.java | 5 +++ .../ir/IrBlackBoxCodegenTestGenerated.java | 5 +++ .../kotlin/config/LanguageVersionSettings.kt | 2 + .../kotlin/resolve/DescriptorFactory.java | 14 ++++-- .../kotlin/resolve/DescriptorUtils.java | 14 +++++- .../IrJsCodegenBoxES6TestGenerated.java | 5 +++ .../IrJsCodegenBoxTestGenerated.java | 5 +++ .../semantics/JsCodegenBoxTestGenerated.java | 5 +++ .../IrCodegenBoxWasmTestGenerated.java | 5 +++ 20 files changed, 222 insertions(+), 13 deletions(-) create mode 100644 compiler/testData/codegen/box/sealed/multipleFiles_enabled.kt create mode 100644 compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.fir.kt create mode 100644 compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.kt create mode 100644 compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.txt diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java index 36ca6647f4a..0edb6b80eef 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java @@ -20778,6 +20778,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte runTest("compiler/testData/diagnostics/tests/sealed/LocalSealed.kt"); } + @TestMetadata("MultipleFiles_enabled.kt") + public void testMultipleFiles_enabled() throws Exception { + runTest("compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.kt"); + } + @TestMetadata("NestedSealed.kt") public void testNestedSealed() throws Exception { runTest("compiler/testData/diagnostics/tests/sealed/NestedSealed.kt"); diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index cbc5d97d0d4..7f455b6029e 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -30255,6 +30255,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sealed"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @TestMetadata("multipleFiles_enabled.kt") + public void testMultipleFiles_enabled() throws Exception { + runTest("compiler/testData/codegen/box/sealed/multipleFiles_enabled.kt"); + } + @TestMetadata("objects.kt") public void testObjects() throws Exception { runTest("compiler/testData/codegen/box/sealed/objects.kt"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionDescriptorResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionDescriptorResolver.kt index 138a5d0e756..18cf3717c3d 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionDescriptorResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionDescriptorResolver.kt @@ -323,7 +323,8 @@ class FunctionDescriptorResolver( scope: LexicalScope, classDescriptor: ClassDescriptor, classElement: KtPureClassOrObject, - trace: BindingTrace + trace: BindingTrace, + languageVersionSettings: LanguageVersionSettings ): ClassConstructorDescriptorImpl? { if (classDescriptor.kind == ClassKind.ENUM_ENTRY || !classElement.hasPrimaryConstructor()) return null return createConstructorDescriptor( @@ -333,7 +334,8 @@ class FunctionDescriptorResolver( classElement.primaryConstructorModifierList, classElement.primaryConstructor ?: classElement, classElement.primaryConstructorParameters, - trace + trace, + languageVersionSettings ) } @@ -341,7 +343,8 @@ class FunctionDescriptorResolver( scope: LexicalScope, classDescriptor: ClassDescriptor, constructor: KtSecondaryConstructor, - trace: BindingTrace + trace: BindingTrace, + languageVersionSettings: LanguageVersionSettings ): ClassConstructorDescriptorImpl { return createConstructorDescriptor( scope, @@ -350,7 +353,8 @@ class FunctionDescriptorResolver( constructor.modifierList, constructor, constructor.valueParameters, - trace + trace, + languageVersionSettings ) } @@ -361,7 +365,8 @@ class FunctionDescriptorResolver( modifierList: KtModifierList?, declarationToTrace: KtPureElement, valueParameters: List, - trace: BindingTrace + trace: BindingTrace, + languageVersionSettings: LanguageVersionSettings ): ClassConstructorDescriptorImpl { val constructorDescriptor = ClassConstructorDescriptorImpl.create( classDescriptor, @@ -387,7 +392,7 @@ class FunctionDescriptorResolver( resolveValueParameters(constructorDescriptor, parameterScope, valueParameters, trace, null), resolveVisibilityFromModifiers( modifierList, - DescriptorUtils.getDefaultConstructorVisibility(classDescriptor) + DescriptorUtils.getDefaultConstructorVisibility(classDescriptor, languageVersionSettings.supportsFeature(LanguageFeature.FreedomForSealedClasses)) ) ) constructor.returnType = classDescriptor.defaultType diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassMemberScope.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassMemberScope.kt index 1b96443b57e..a58ac3c2ca5 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassMemberScope.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassMemberScope.kt @@ -488,7 +488,7 @@ open class LazyClassMemberScope( if (DescriptorUtils.canHaveDeclaredConstructors(thisDescriptor) || hasPrimaryConstructor) { val constructor = c.functionDescriptorResolver.resolvePrimaryConstructorDescriptor( - thisDescriptor.scopeForConstructorHeaderResolution, thisDescriptor, classOrObject, trace + thisDescriptor.scopeForConstructorHeaderResolution, thisDescriptor, classOrObject, trace, c.languageVersionSettings ) constructor ?: return null setDeferredReturnType(constructor) @@ -505,7 +505,7 @@ open class LazyClassMemberScope( return classOrObject.secondaryConstructors.map { constructor -> val descriptor = c.functionDescriptorResolver.resolveSecondaryConstructorDescriptor( - thisDescriptor.scopeForConstructorHeaderResolution, thisDescriptor, constructor, trace + thisDescriptor.scopeForConstructorHeaderResolution, thisDescriptor, constructor, trace, c.languageVersionSettings ) setDeferredReturnType(descriptor) descriptor diff --git a/compiler/testData/codegen/box/sealed/multipleFiles_enabled.kt b/compiler/testData/codegen/box/sealed/multipleFiles_enabled.kt new file mode 100644 index 00000000000..e975dbe9924 --- /dev/null +++ b/compiler/testData/codegen/box/sealed/multipleFiles_enabled.kt @@ -0,0 +1,24 @@ +// ISSUE: KT-13495 +// IGNORE_BACKEND_FIR: JVM_IR +// !LANGUAGE: +FreedomForSealedClasses + +// FILE: a.kt + +sealed class Base { + class A : Base() +} + +// FILE: b.kt + +class B : Base() + +// FILE: c.kt + +fun getLetter(base: Base): String = when (base) { + is Base.A -> "O" + is B -> "K" +} + +fun box(): String { + return getLetter(Base.A()) + getLetter(B()) +} diff --git a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.fir.kt b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.fir.kt new file mode 100644 index 00000000000..062325d1383 --- /dev/null +++ b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.fir.kt @@ -0,0 +1,30 @@ +// ISSUE: KT-13495 +// !DIAGNOSTICS: -UNUSED_VARIABLE +// !LANGUAGE: +FreedomForSealedClasses + +// FILE: a.kt + +sealed class Base { + class A : Base() +} + +// FILE: b.kt + +class B : Base() + +// FILE: c.kt + +class Container { + class C : Base() + + inner class D : Base() +} + +// FILE: d.kt + +fun test(base: Base) { + val x = when (base) { + is Base.A -> 1 + is B -> 2 + } +} diff --git a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.kt b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.kt new file mode 100644 index 00000000000..76ee023fea1 --- /dev/null +++ b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.kt @@ -0,0 +1,30 @@ +// ISSUE: KT-13495 +// !DIAGNOSTICS: -UNUSED_VARIABLE +// !LANGUAGE: +FreedomForSealedClasses + +// FILE: a.kt + +sealed class Base { + class A : Base() +} + +// FILE: b.kt + +class B : Base() + +// FILE: c.kt + +class Container { + class C : Base() + + inner class D : Base() +} + +// FILE: d.kt + +fun test(base: Base) { + val x = when (base) { + is Base.A -> 1 + is B -> 2 + } +} diff --git a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.txt b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.txt new file mode 100644 index 00000000000..c03f125ae7a --- /dev/null +++ b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.txt @@ -0,0 +1,45 @@ +package + +public fun test(/*0*/ base: Base): kotlin.Unit + +public final class B : Base { + public constructor B() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public sealed class Base { + internal constructor Base() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public final class A : Base { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + +public final class Container { + public constructor Container() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public final class C : Base { + public constructor C() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final inner class D : Base { + public constructor D() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 427baf31113..111cc4e95a3 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -20855,6 +20855,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali runTest("compiler/testData/diagnostics/tests/sealed/LocalSealed.kt"); } + @TestMetadata("MultipleFiles_enabled.kt") + public void testMultipleFiles_enabled() throws Exception { + runTest("compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.kt"); + } + @TestMetadata("NestedSealed.kt") public void testNestedSealed() throws Exception { runTest("compiler/testData/diagnostics/tests/sealed/NestedSealed.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java index 0f50aa981ae..7be16516432 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java @@ -20780,6 +20780,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing runTest("compiler/testData/diagnostics/tests/sealed/LocalSealed.kt"); } + @TestMetadata("MultipleFiles_enabled.kt") + public void testMultipleFiles_enabled() throws Exception { + runTest("compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.kt"); + } + @TestMetadata("NestedSealed.kt") public void testNestedSealed() throws Exception { runTest("compiler/testData/diagnostics/tests/sealed/NestedSealed.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 1ca163d8a9f..66606008be0 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -32026,6 +32026,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sealed"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } + @TestMetadata("multipleFiles_enabled.kt") + public void testMultipleFiles_enabled() throws Exception { + runTest("compiler/testData/codegen/box/sealed/multipleFiles_enabled.kt"); + } + @TestMetadata("objects.kt") public void testObjects() throws Exception { runTest("compiler/testData/codegen/box/sealed/objects.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 29bc2f066da..b589166eb2b 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -29660,6 +29660,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sealed"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } + @TestMetadata("multipleFiles_enabled.kt") + public void testMultipleFiles_enabled() throws Exception { + runTest("compiler/testData/codegen/box/sealed/multipleFiles_enabled.kt"); + } + @TestMetadata("objects.kt") public void testObjects() throws Exception { runTest("compiler/testData/codegen/box/sealed/objects.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 77118ac6c05..5ccaafe90ca 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -30255,6 +30255,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sealed"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @TestMetadata("multipleFiles_enabled.kt") + public void testMultipleFiles_enabled() throws Exception { + runTest("compiler/testData/codegen/box/sealed/multipleFiles_enabled.kt"); + } + @TestMetadata("objects.kt") public void testObjects() throws Exception { runTest("compiler/testData/codegen/box/sealed/objects.kt"); diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index c64025f7364..487e7a6e9ef 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -143,6 +143,8 @@ enum class LanguageFeature( UseCorrectExecutionOrderForVarargArguments(KOTLIN_1_5, kind = BUG_FIX), JvmRecordSupport(KOTLIN_1_5), + FreedomForSealedClasses(KOTLIN_1_5), + // Temporarily disabled, see KT-27084/KT-22379 SoundSmartcastFromLoopConditionForLoopAssignedVariables(sinceVersion = null, kind = BUG_FIX), diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorFactory.java b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorFactory.java index d911ccb55f8..433ed53721b 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorFactory.java +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorFactory.java @@ -35,10 +35,14 @@ import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt.getB public class DescriptorFactory { private static class DefaultClassConstructorDescriptor extends ClassConstructorDescriptorImpl { - public DefaultClassConstructorDescriptor(@NotNull ClassDescriptor containingClass, @NotNull SourceElement source) { + public DefaultClassConstructorDescriptor( + @NotNull ClassDescriptor containingClass, + @NotNull SourceElement source, + boolean freedomForSealedInterfacesSupported + ) { super(containingClass, null, Annotations.Companion.getEMPTY(), true, Kind.DECLARATION, source); initialize(Collections.emptyList(), - getDefaultConstructorVisibility(containingClass)); + getDefaultConstructorVisibility(containingClass, freedomForSealedInterfacesSupported)); } } @@ -130,7 +134,11 @@ public class DescriptorFactory { @NotNull ClassDescriptor containingClass, @NotNull SourceElement source ) { - return new DefaultClassConstructorDescriptor(containingClass, source); + /* + * Language version settings are needed here only for computing default visibility of constructors of sealed classes + * Since object can not be sealed class it's OK to pass default settings here + */ + return new DefaultClassConstructorDescriptor(containingClass, source, false); } @NotNull diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.java b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.java index b019f7d702b..005b58cf637 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.java +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.java @@ -380,11 +380,21 @@ public class DescriptorUtils { } @NotNull - public static DescriptorVisibility getDefaultConstructorVisibility(@NotNull ClassDescriptor classDescriptor) { + public static DescriptorVisibility getDefaultConstructorVisibility( + @NotNull ClassDescriptor classDescriptor, + boolean freedomForSealedInterfacesSupported + ) { ClassKind classKind = classDescriptor.getKind(); - if (classKind == ClassKind.ENUM_CLASS || classKind.isSingleton() || isSealedClass(classDescriptor)) { + if (classKind == ClassKind.ENUM_CLASS || classKind.isSingleton()) { return DescriptorVisibilities.PRIVATE; } + if (isSealedClass(classDescriptor)) { + if (freedomForSealedInterfacesSupported) { + return DescriptorVisibilities.INTERNAL; + } else { + return DescriptorVisibilities.PRIVATE; + } + } if (isAnonymousObject(classDescriptor)) { return DescriptorVisibilities.DEFAULT_VISIBILITY; } diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index 15f4be5fddb..e2d8f4db811 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -24526,6 +24526,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sealed"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } + @TestMetadata("multipleFiles_enabled.kt") + public void testMultipleFiles_enabled() throws Exception { + runTest("compiler/testData/codegen/box/sealed/multipleFiles_enabled.kt"); + } + @TestMetadata("objects.kt") public void testObjects() throws Exception { runTest("compiler/testData/codegen/box/sealed/objects.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index a2f65e44e31..010e8fcf14c 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -24526,6 +24526,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sealed"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } + @TestMetadata("multipleFiles_enabled.kt") + public void testMultipleFiles_enabled() throws Exception { + runTest("compiler/testData/codegen/box/sealed/multipleFiles_enabled.kt"); + } + @TestMetadata("objects.kt") public void testObjects() throws Exception { runTest("compiler/testData/codegen/box/sealed/objects.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 293c78c94ce..6236c45be81 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -24526,6 +24526,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sealed"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } + @TestMetadata("multipleFiles_enabled.kt") + public void testMultipleFiles_enabled() throws Exception { + runTest("compiler/testData/codegen/box/sealed/multipleFiles_enabled.kt"); + } + @TestMetadata("objects.kt") public void testObjects() throws Exception { runTest("compiler/testData/codegen/box/sealed/objects.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index 0fc21b69740..20538c6806f 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -12997,6 +12997,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sealed"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); } + @TestMetadata("multipleFiles_enabled.kt") + public void testMultipleFiles_enabled() throws Exception { + runTest("compiler/testData/codegen/box/sealed/multipleFiles_enabled.kt"); + } + @TestMetadata("objects.kt") public void testObjects() throws Exception { runTest("compiler/testData/codegen/box/sealed/objects.kt"); From 70c61be1ef1226516500b0c5e8e23ee3264bbb67 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Mon, 16 Nov 2020 11:59:27 +0300 Subject: [PATCH 553/698] [FE] Allow declare sealed class inheritors as inner or nested classes #KT-13495 --- .../org/jetbrains/kotlin/resolve/BodyResolver.java | 8 +++++++- .../tests/sealed/MultipleFiles_enabled.fir.kt | 8 ++++++++ .../tests/sealed/MultipleFiles_enabled.kt | 12 ++++++++++-- .../tests/sealed/MultipleFiles_enabled.txt | 2 ++ 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java index c641bdb1636..c7fca35ba93 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java @@ -56,6 +56,7 @@ import org.jetbrains.kotlin.util.ReenteringLazyValueComputationException; import java.util.*; +import static org.jetbrains.kotlin.config.LanguageFeature.FreedomForSealedClasses; import static org.jetbrains.kotlin.config.LanguageFeature.TopLevelSealedInheritance; import static org.jetbrains.kotlin.diagnostics.Errors.*; import static org.jetbrains.kotlin.resolve.BindingContext.*; @@ -635,7 +636,12 @@ public class BodyResolver { containingDescriptor = containingDescriptor.getContainingDeclaration(); } if (containingDescriptor == null) { - trace.report(SEALED_SUPERTYPE.on(typeReference)); + if ( + !languageVersionSettings.supportsFeature(FreedomForSealedClasses) || + DescriptorUtils.isLocal(supertypeOwner) + ) { + trace.report(SEALED_SUPERTYPE.on(typeReference)); + } } else { trace.report(SEALED_SUPERTYPE_IN_LOCAL_CLASS.on(typeReference)); diff --git a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.fir.kt b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.fir.kt index 062325d1383..a490bda54c5 100644 --- a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.fir.kt +++ b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.fir.kt @@ -18,6 +18,12 @@ class Container { class C : Base() inner class D : Base() + + val anon = object : Base() {} // Should be an error + + fun someFun() { + class LocalClass : Base() {} // Should be an error + } } // FILE: d.kt @@ -26,5 +32,7 @@ fun test(base: Base) { val x = when (base) { is Base.A -> 1 is B -> 2 + is Container.C -> 3 + is Container.D -> 4 } } diff --git a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.kt b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.kt index 76ee023fea1..267ac83315a 100644 --- a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.kt +++ b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.kt @@ -15,9 +15,15 @@ class B : Base() // FILE: c.kt class Container { - class C : Base() + class C : Base() - inner class D : Base() + inner class D : Base() + + val anon = object : Base() {} // Should be an error + + fun someFun() { + class LocalClass : Base() {} // Should be an error + } } // FILE: d.kt @@ -26,5 +32,7 @@ fun test(base: Base) { val x = when (base) { is Base.A -> 1 is B -> 2 + is Container.C -> 3 + is Container.D -> 4 } } diff --git a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.txt b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.txt index c03f125ae7a..0a71f3f94b6 100644 --- a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.txt +++ b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.txt @@ -25,8 +25,10 @@ public sealed class Base { public final class Container { public constructor Container() + public final val anon: Base public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun someFun(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public final class C : Base { From e76acc8ee09e446567b1189118e2389ef9f54d9f Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Mon, 16 Nov 2020 12:20:15 +0300 Subject: [PATCH 554/698] [FE] Collect inheritors of sealed classes from new places in `computeSealedSubclasses` #KT-13495 --- ...irOldFrontendDiagnosticsTestGenerated.java | 10 +++ .../lazy/descriptors/LazyClassDescriptor.java | 3 +- .../box/sealed/multipleFiles_enabled.kt | 31 +++++++-- .../tests/sealed/ExhaustiveWithFreedom.fir.kt | 64 +++++++++++++++++++ .../tests/sealed/ExhaustiveWithFreedom.kt | 64 +++++++++++++++++++ .../tests/sealed/ExhaustiveWithFreedom.txt | 49 ++++++++++++++ .../tests/sealed/MultipleFiles_enabled.fir.kt | 12 ---- .../tests/sealed/MultipleFiles_enabled.kt | 12 ---- .../tests/sealed/MultipleFiles_enabled.txt | 2 - .../NestedSealedWithoutRestrictions.fir.kt | 39 +++++++++++ .../sealed/NestedSealedWithoutRestrictions.kt | 39 +++++++++++ .../NestedSealedWithoutRestrictions.txt | 47 ++++++++++++++ .../checkers/DiagnosticsTestGenerated.java | 10 +++ .../DiagnosticsUsingJavacTestGenerated.java | 10 +++ .../kotlin/resolve/DescriptorUtils.kt | 13 +++- .../DeserializedClassDescriptor.kt | 2 +- .../builder/CommonizedClassDescriptor.kt | 6 +- 17 files changed, 374 insertions(+), 39 deletions(-) create mode 100644 compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.fir.kt create mode 100644 compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.kt create mode 100644 compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.txt create mode 100644 compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.fir.kt create mode 100644 compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.kt create mode 100644 compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.txt diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java index 0edb6b80eef..ce1d6ddf0cf 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java @@ -20768,6 +20768,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte runTest("compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenWithElse.kt"); } + @TestMetadata("ExhaustiveWithFreedom.kt") + public void testExhaustiveWithFreedom() throws Exception { + runTest("compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.kt"); + } + @TestMetadata("Local.kt") public void testLocal() throws Exception { runTest("compiler/testData/diagnostics/tests/sealed/Local.kt"); @@ -20788,6 +20793,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte runTest("compiler/testData/diagnostics/tests/sealed/NestedSealed.kt"); } + @TestMetadata("NestedSealedWithoutRestrictions.kt") + public void testNestedSealedWithoutRestrictions() throws Exception { + runTest("compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.kt"); + } + @TestMetadata("NeverConstructed.kt") public void testNeverConstructed() throws Exception { runTest("compiler/testData/diagnostics/tests/sealed/NeverConstructed.kt"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java index e0de663ae1d..02e41a83ad7 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java @@ -271,7 +271,8 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes ); // TODO: only consider classes from the same file, not the whole package fragment - this.sealedSubclasses = storageManager.createLazyValue(() -> DescriptorUtilsKt.computeSealedSubclasses(this)); + boolean freedomForSealedInterfacesSupported = c.getLanguageVersionSettings().supportsFeature(LanguageFeature.FreedomForSealedClasses); + this.sealedSubclasses = storageManager.createLazyValue(() -> DescriptorUtilsKt.computeSealedSubclasses(this, freedomForSealedInterfacesSupported)); } private static boolean isIllegalInner(@NotNull DeclarationDescriptor descriptor) { diff --git a/compiler/testData/codegen/box/sealed/multipleFiles_enabled.kt b/compiler/testData/codegen/box/sealed/multipleFiles_enabled.kt index e975dbe9924..bdae46a7afe 100644 --- a/compiler/testData/codegen/box/sealed/multipleFiles_enabled.kt +++ b/compiler/testData/codegen/box/sealed/multipleFiles_enabled.kt @@ -2,23 +2,40 @@ // IGNORE_BACKEND_FIR: JVM_IR // !LANGUAGE: +FreedomForSealedClasses -// FILE: a.kt +// FILE: Base.kt sealed class Base { class A : Base() } -// FILE: b.kt +// FILE: B.kt class B : Base() -// FILE: c.kt +// FILE: Container.kt -fun getLetter(base: Base): String = when (base) { - is Base.A -> "O" - is B -> "K" +class Containter { + class C : Base() + + inner class D : Base() + + val d = D() +} + +// FILE: main.kt + +fun getValue(base: Base): Int = when (base) { + is Base.A -> 1 + is B -> 2 + is Containter.C -> 3 + is Containter.D -> 4 } fun box(): String { - return getLetter(Base.A()) + getLetter(B()) + var res = 0 + res += getValue(Base.A()) + res += getValue(B()) + res += getValue(Containter.C()) + res += getValue(Containter().d) + return if (res == 10) "OK" else "Fail" } diff --git a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.fir.kt b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.fir.kt new file mode 100644 index 00000000000..171f5f2e107 --- /dev/null +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.fir.kt @@ -0,0 +1,64 @@ +// ISSUE: KT-13495 +// !DIAGNOSTICS: -UNUSED_VARIABLE +// !LANGUAGE: +FreedomForSealedClasses + +// FILE: Base.kt + +sealed class Base { + class A : Base() +} + +// FILE: B.kt + +class B : Base() + +// FILE: Container.kt + +class Containter { + class C : Base() + + inner class D : Base() +} + +// FILE: main.kt + +fun test_OK(base: Base) { + val x = when (base) { + is Base.A -> 1 + is B -> 2 + is Containter.C -> 3 + is Containter.D -> 4 + } +} + +fun test_error_1(base: Base) { + val x = when (base) { + is B -> 2 + is Containter.C -> 3 + is Containter.D -> 4 + } +} + +fun test_error_2(base: Base) { + val x = when (base) { + is Base.A -> 1 + is Containter.C -> 3 + is Containter.D -> 4 + } +} + +fun test_error_3(base: Base) { + val x = when (base) { + is Base.A -> 1 + is B -> 2 + is Containter.D -> 4 + } +} + +fun test_error_4(base: Base) { + val x = when (base) { + is Base.A -> 1 + is B -> 2 + is Containter.C -> 3 + } +} diff --git a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.kt b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.kt new file mode 100644 index 00000000000..fc58d0236cc --- /dev/null +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.kt @@ -0,0 +1,64 @@ +// ISSUE: KT-13495 +// !DIAGNOSTICS: -UNUSED_VARIABLE +// !LANGUAGE: +FreedomForSealedClasses + +// FILE: Base.kt + +sealed class Base { + class A : Base() +} + +// FILE: B.kt + +class B : Base() + +// FILE: Container.kt + +class Containter { + class C : Base() + + inner class D : Base() +} + +// FILE: main.kt + +fun test_OK(base: Base) { + val x = when (base) { + is Base.A -> 1 + is B -> 2 + is Containter.C -> 3 + is Containter.D -> 4 + } +} + +fun test_error_1(base: Base) { + val x = when (base) { + is B -> 2 + is Containter.C -> 3 + is Containter.D -> 4 + } +} + +fun test_error_2(base: Base) { + val x = when (base) { + is Base.A -> 1 + is Containter.C -> 3 + is Containter.D -> 4 + } +} + +fun test_error_3(base: Base) { + val x = when (base) { + is Base.A -> 1 + is B -> 2 + is Containter.D -> 4 + } +} + +fun test_error_4(base: Base) { + val x = when (base) { + is Base.A -> 1 + is B -> 2 + is Containter.C -> 3 + } +} diff --git a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.txt b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.txt new file mode 100644 index 00000000000..ca2a9591379 --- /dev/null +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.txt @@ -0,0 +1,49 @@ +package + +public fun test_OK(/*0*/ base: Base): kotlin.Unit +public fun test_error_1(/*0*/ base: Base): kotlin.Unit +public fun test_error_2(/*0*/ base: Base): kotlin.Unit +public fun test_error_3(/*0*/ base: Base): kotlin.Unit +public fun test_error_4(/*0*/ base: Base): kotlin.Unit + +public final class B : Base { + public constructor B() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public sealed class Base { + internal constructor Base() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public final class A : Base { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + +public final class Containter { + public constructor Containter() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public final class C : Base { + public constructor C() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final inner class D : Base { + public constructor D() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.fir.kt b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.fir.kt index a490bda54c5..fb520120ea8 100644 --- a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.fir.kt +++ b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.fir.kt @@ -1,5 +1,4 @@ // ISSUE: KT-13495 -// !DIAGNOSTICS: -UNUSED_VARIABLE // !LANGUAGE: +FreedomForSealedClasses // FILE: a.kt @@ -25,14 +24,3 @@ class Container { class LocalClass : Base() {} // Should be an error } } - -// FILE: d.kt - -fun test(base: Base) { - val x = when (base) { - is Base.A -> 1 - is B -> 2 - is Container.C -> 3 - is Container.D -> 4 - } -} diff --git a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.kt b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.kt index 267ac83315a..b54b8f82f2c 100644 --- a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.kt +++ b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.kt @@ -1,5 +1,4 @@ // ISSUE: KT-13495 -// !DIAGNOSTICS: -UNUSED_VARIABLE // !LANGUAGE: +FreedomForSealedClasses // FILE: a.kt @@ -25,14 +24,3 @@ class Container { class LocalClass : Base() {} // Should be an error } } - -// FILE: d.kt - -fun test(base: Base) { - val x = when (base) { - is Base.A -> 1 - is B -> 2 - is Container.C -> 3 - is Container.D -> 4 - } -} diff --git a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.txt b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.txt index 0a71f3f94b6..51fcecaca3b 100644 --- a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.txt +++ b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.txt @@ -1,7 +1,5 @@ package -public fun test(/*0*/ base: Base): kotlin.Unit - public final class B : Base { public constructor B() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.fir.kt b/compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.fir.kt new file mode 100644 index 00000000000..444fb416c12 --- /dev/null +++ b/compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.fir.kt @@ -0,0 +1,39 @@ +// ISSUE: KT-13495 +// !LANGUAGE: +FreedomForSealedClasses +// !DIAGNOSTICS: -UNUSED_VARIABLE + +// FILE: base.kt + +package foo + +class Container { + sealed class Base +} + +// FILE: a.kt + +package foo + +class A : Container.Base() + +// FILE: b.kt + +package foo + +class BContainer { + class B : Container.Base() + + inner class C : Container.Base() +} + +// FILE: test.kt + +package foo + +fun test(base: Container.Base) { + val x = when (base) { + is A -> 1 + is BContainer.B -> 2 + is BContainer.C -> 3 + } +} diff --git a/compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.kt b/compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.kt new file mode 100644 index 00000000000..fdd2bdcb6a8 --- /dev/null +++ b/compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.kt @@ -0,0 +1,39 @@ +// ISSUE: KT-13495 +// !LANGUAGE: +FreedomForSealedClasses +// !DIAGNOSTICS: -UNUSED_VARIABLE + +// FILE: base.kt + +package foo + +class Container { + sealed class Base +} + +// FILE: a.kt + +package foo + +class A : Container.Base() + +// FILE: b.kt + +package foo + +class BContainer { + class B : Container.Base() + + inner class C : Container.Base() +} + +// FILE: test.kt + +package foo + +fun test(base: Container.Base) { + val x = when (base) { + is A -> 1 + is BContainer.B -> 2 + is BContainer.C -> 3 + } +} diff --git a/compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.txt b/compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.txt new file mode 100644 index 00000000000..319749dd71b --- /dev/null +++ b/compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.txt @@ -0,0 +1,47 @@ +package + +package foo { + public fun test(/*0*/ base: foo.Container.Base): kotlin.Unit + + public final class A : foo.Container.Base { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final class BContainer { + public constructor BContainer() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public final class B : foo.Container.Base { + public constructor B() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final inner class C : foo.Container.Base { + public constructor C() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } + + public final class Container { + public constructor Container() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public sealed class Base { + internal constructor Base() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 111cc4e95a3..5c1521aa986 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -20845,6 +20845,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali runTest("compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenWithElse.kt"); } + @TestMetadata("ExhaustiveWithFreedom.kt") + public void testExhaustiveWithFreedom() throws Exception { + runTest("compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.kt"); + } + @TestMetadata("Local.kt") public void testLocal() throws Exception { runTest("compiler/testData/diagnostics/tests/sealed/Local.kt"); @@ -20865,6 +20870,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali runTest("compiler/testData/diagnostics/tests/sealed/NestedSealed.kt"); } + @TestMetadata("NestedSealedWithoutRestrictions.kt") + public void testNestedSealedWithoutRestrictions() throws Exception { + runTest("compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.kt"); + } + @TestMetadata("NeverConstructed.kt") public void testNeverConstructed() throws Exception { runTest("compiler/testData/diagnostics/tests/sealed/NeverConstructed.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java index 7be16516432..6b56a052b0f 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java @@ -20770,6 +20770,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing runTest("compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenWithElse.kt"); } + @TestMetadata("ExhaustiveWithFreedom.kt") + public void testExhaustiveWithFreedom() throws Exception { + runTest("compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.kt"); + } + @TestMetadata("Local.kt") public void testLocal() throws Exception { runTest("compiler/testData/diagnostics/tests/sealed/Local.kt"); @@ -20790,6 +20795,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing runTest("compiler/testData/diagnostics/tests/sealed/NestedSealed.kt"); } + @TestMetadata("NestedSealedWithoutRestrictions.kt") + public void testNestedSealedWithoutRestrictions() throws Exception { + runTest("compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.kt"); + } + @TestMetadata("NeverConstructed.kt") public void testNeverConstructed() throws Exception { runTest("compiler/testData/diagnostics/tests/sealed/NeverConstructed.kt"); diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.kt index d88800d8032..7577fcf601f 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.kt @@ -377,7 +377,7 @@ fun ClassifierDescriptor.getAllSuperClassifiers(): Sequence { +fun computeSealedSubclasses(sealedClass: ClassDescriptor, freedomForSealedInterfacesSupported: Boolean): Collection { if (sealedClass.modality != Modality.SEALED) return emptyList() val result = linkedSetOf() @@ -396,9 +396,16 @@ fun computeSealedSubclasses(sealedClass: ClassDescriptor): Collection Date: Mon, 16 Nov 2020 16:00:38 +0300 Subject: [PATCH 555/698] [FE] Prohibit inheritors of sealed classes which are declared in different package #KT-13495 --- .../jetbrains/kotlin/diagnostics/Errors.java | 1 + .../rendering/DefaultErrorMessages.java | 1 + .../resolve/PlatformConfiguratorBase.kt | 3 +- .../SealedInheritorInSamePackageChecker.kt | 34 ++++++++++ .../tests/sealed/MultipleFiles_enabled.fir.kt | 14 +++++ .../tests/sealed/MultipleFiles_enabled.kt | 14 +++++ .../tests/sealed/MultipleFiles_enabled.txt | 63 +++++++++++-------- .../kotlin/descriptors/descriptorUtil.kt | 21 +++++++ 8 files changed, 125 insertions(+), 26 deletions(-) create mode 100644 compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/SealedInheritorInSamePackageChecker.kt diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index 543094cba25..3cb26257efd 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -426,6 +426,7 @@ public interface Errors { DiagnosticFactory0 SEALED_CLASS_CONSTRUCTOR_CALL = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 SEALED_SUPERTYPE = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 SEALED_SUPERTYPE_IN_LOCAL_CLASS = DiagnosticFactory0.create(ERROR); + DiagnosticFactory2 SEALED_INHERITOR_IN_DIFFERENT_PACKAGE = DiagnosticFactory2.create(ERROR); // Companion objects diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index 119c9b782c9..c6d18ba488d 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -633,6 +633,7 @@ public class DefaultErrorMessages { MAP.put(DATA_CLASS_CANNOT_HAVE_CLASS_SUPERTYPES, "Data class inheritance from other classes is forbidden"); MAP.put(SEALED_SUPERTYPE, "This type is sealed, so it can be inherited by only its own nested classes or objects"); MAP.put(SEALED_SUPERTYPE_IN_LOCAL_CLASS, "Local class cannot extend a sealed class"); + MAP.put(SEALED_INHERITOR_IN_DIFFERENT_PACKAGE, "Inheritor of sealed class or interface declared in package {1} but it must be in package {2} where base class is declared", TO_STRING, TO_STRING); MAP.put(SINGLETON_IN_SUPERTYPE, "Cannot inherit from a singleton"); MAP.put(CLASS_CANNOT_BE_EXTENDED_DIRECTLY, "Class {0} cannot be extended directly", NAME); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt index 25ff6d7309b..34391d681cc 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt @@ -40,7 +40,8 @@ private val DEFAULT_DECLARATION_CHECKERS = listOf( FunInterfaceDeclarationChecker(), DeprecatedSinceKotlinAnnotationChecker, ContractDescriptionBlockChecker, - PrivateInlineFunctionsReturningAnonymousObjectsChecker + PrivateInlineFunctionsReturningAnonymousObjectsChecker, + SealedInheritorInSamePackageChecker, ) private val DEFAULT_CALL_CHECKERS = listOf( diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/SealedInheritorInSamePackageChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/SealedInheritorInSamePackageChecker.kt new file mode 100644 index 00000000000..31be306ed15 --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/SealedInheritorInSamePackageChecker.kt @@ -0,0 +1,34 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.resolve.checkers + +import org.jetbrains.kotlin.config.LanguageFeature +import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.descriptors.DeclarationDescriptor +import org.jetbrains.kotlin.descriptors.containingPackage +import org.jetbrains.kotlin.descriptors.isSealed +import org.jetbrains.kotlin.diagnostics.Errors +import org.jetbrains.kotlin.psi.KtClassOrObject +import org.jetbrains.kotlin.psi.KtDeclaration +import org.jetbrains.kotlin.resolve.bindingContextUtil.getAbbreviatedTypeOrType + +object SealedInheritorInSamePackageChecker : DeclarationChecker { + override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) { + if (!context.languageVersionSettings.supportsFeature(LanguageFeature.FreedomForSealedClasses)) return + if (descriptor !is ClassDescriptor || declaration !is KtClassOrObject) return + val classPackage = descriptor.containingPackage() ?: return // local class, SEALED_SUPERTYPE already reported + for (superTypeListEntry in declaration.superTypeListEntries) { + val typeReference = superTypeListEntry.typeReference ?: continue + val superType = typeReference.getAbbreviatedTypeOrType(context.trace.bindingContext)?.unwrap() ?: continue + val superClass = superType.constructor.declarationDescriptor ?: continue + if (!superClass.isSealed()) continue + val superClassPackage = superClass.containingPackage() ?: continue + if (classPackage != superClassPackage) { + context.trace.report(Errors.SEALED_INHERITOR_IN_DIFFERENT_PACKAGE.on(typeReference, classPackage, superClassPackage)) + } + } + } +} diff --git a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.fir.kt b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.fir.kt index fb520120ea8..aa349ea0459 100644 --- a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.fir.kt +++ b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.fir.kt @@ -3,16 +3,22 @@ // FILE: a.kt +package foo + sealed class Base { class A : Base() } // FILE: b.kt +package foo + class B : Base() // FILE: c.kt +package foo + class Container { class C : Base() @@ -24,3 +30,11 @@ class Container { class LocalClass : Base() {} // Should be an error } } + +// FILE: E.kt + +package bar + +import foo.Base + +class E : Base() diff --git a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.kt b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.kt index b54b8f82f2c..4e7c7fbf94a 100644 --- a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.kt +++ b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.kt @@ -3,16 +3,22 @@ // FILE: a.kt +package foo + sealed class Base { class A : Base() } // FILE: b.kt +package foo + class B : Base() // FILE: c.kt +package foo + class Container { class C : Base() @@ -24,3 +30,11 @@ class Container { class LocalClass : Base() {} // Should be an error } } + +// FILE: E.kt + +package bar + +import foo.Base + +class E : Base() diff --git a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.txt b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.txt index 51fcecaca3b..dcfabb459ad 100644 --- a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.txt +++ b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.txt @@ -1,45 +1,58 @@ package -public final class B : Base { - public constructor B() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} +package bar { -public sealed class Base { - internal constructor Base() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - - public final class A : Base { - public constructor A() + public final class E : foo.Base { + public constructor E() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } } -public final class Container { - public constructor Container() - public final val anon: Base - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun someFun(): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +package foo { - public final class C : Base { - public constructor C() + public final class B : foo.Base { + public constructor B() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } - public final inner class D : Base { - public constructor D() + public sealed class Base { + internal constructor Base() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public final class A : foo.Base { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } + + public final class Container { + public constructor Container() + public final val anon: foo.Base + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun someFun(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public final class C : foo.Base { + public constructor C() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final inner class D : foo.Base { + public constructor D() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } } } diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/descriptorUtil.kt b/core/descriptors/src/org/jetbrains/kotlin/descriptors/descriptorUtil.kt index f70c0276280..81062155718 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/descriptorUtil.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/descriptorUtil.kt @@ -10,11 +10,14 @@ import org.jetbrains.kotlin.builtins.StandardNames.CONTINUATION_INTERFACE_FQ_NAM import org.jetbrains.kotlin.incremental.components.LookupLocation import org.jetbrains.kotlin.incremental.components.NoLookupLocation import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.descriptorUtil.module import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.KotlinTypeFactory import org.jetbrains.kotlin.types.typeUtil.asTypeProjection import org.jetbrains.kotlin.utils.sure +import kotlin.contracts.ExperimentalContracts +import kotlin.contracts.contract fun ModuleDescriptor.resolveClassByFqName(fqName: FqName, lookupLocation: LookupLocation): ClassDescriptor? { if (fqName.isRoot) return null @@ -56,3 +59,21 @@ fun DeclarationDescriptor.isTopLevelInPackage(name: String, packageName: String) } fun CallableDescriptor.isSupportedForCallableReference() = this is PropertyDescriptor || this is FunctionDescriptor + +@OptIn(ExperimentalContracts::class) +fun DeclarationDescriptor.isSealed(): Boolean { + contract { + returns(true) implies (this@isSealed is ClassDescriptor) + } + return DescriptorUtils.isSealedClass(this) +} + +fun DeclarationDescriptor.containingPackage(): FqName? { + var container = containingDeclaration + while (true) { + if (container == null || container is PackageFragmentDescriptor) break + container = container.containingDeclaration + } + require(container is PackageFragmentDescriptor?) + return container?.fqName +} From 9609954560772d409b2320fdbd84304dda065670 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Mon, 16 Nov 2020 17:38:18 +0300 Subject: [PATCH 556/698] [FE] Allow using sealed modifier on interface and compute `sealed` modality for them #KT-20423 --- ...irOldFrontendDiagnosticsTestGenerated.java | 23 +++++++ .../kotlin/resolve/ModifiersChecker.kt | 2 +- .../resolve/PlatformConfiguratorBase.kt | 1 + .../checkers/SealedInterfaceAllowedChecker.kt | 23 +++++++ .../sealedInterfacesDisabled.fir.kt | 5 ++ .../interfaces/sealedInterfacesDisabled.kt | 5 ++ .../interfaces/sealedInterfacesDisabled.txt | 7 ++ .../interfaces/simpleSealedInterface.fir.kt | 38 +++++++++++ .../interfaces/simpleSealedInterface.kt | 38 +++++++++++ .../interfaces/simpleSealedInterface.txt | 65 +++++++++++++++++++ .../checkers/DiagnosticsTestGenerated.java | 23 +++++++ .../DiagnosticsUsingJavacTestGenerated.java | 23 +++++++ .../kotlin/config/LanguageVersionSettings.kt | 1 + .../kotlin/resolve/DescriptorUtils.java | 2 +- 14 files changed, 254 insertions(+), 2 deletions(-) create mode 100644 compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/SealedInterfaceAllowedChecker.kt create mode 100644 compiler/testData/diagnostics/tests/sealed/interfaces/sealedInterfacesDisabled.fir.kt create mode 100644 compiler/testData/diagnostics/tests/sealed/interfaces/sealedInterfacesDisabled.kt create mode 100644 compiler/testData/diagnostics/tests/sealed/interfaces/sealedInterfacesDisabled.txt create mode 100644 compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.fir.kt create mode 100644 compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.kt create mode 100644 compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.txt diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java index ce1d6ddf0cf..16395f5f8a4 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java @@ -20897,6 +20897,29 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte public void testWithInterface() throws Exception { runTest("compiler/testData/diagnostics/tests/sealed/WithInterface.kt"); } + + @TestMetadata("compiler/testData/diagnostics/tests/sealed/interfaces") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Interfaces extends AbstractFirOldFrontendDiagnosticsTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInInterfaces() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/sealed/interfaces"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("sealedInterfacesDisabled.kt") + public void testSealedInterfacesDisabled() throws Exception { + runTest("compiler/testData/diagnostics/tests/sealed/interfaces/sealedInterfacesDisabled.kt"); + } + + @TestMetadata("simpleSealedInterface.kt") + public void testSimpleSealedInterface() throws Exception { + runTest("compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.kt"); + } + } } @TestMetadata("compiler/testData/diagnostics/tests/secondaryConstructors") diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.kt index cd212c74625..bed41c3165b 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.kt @@ -52,7 +52,7 @@ object ModifierCheckerCore { ABSTRACT_KEYWORD to EnumSet.of(CLASS_ONLY, LOCAL_CLASS, INTERFACE, MEMBER_PROPERTY, MEMBER_FUNCTION), OPEN_KEYWORD to EnumSet.of(CLASS_ONLY, LOCAL_CLASS, INTERFACE, MEMBER_PROPERTY, MEMBER_FUNCTION), FINAL_KEYWORD to EnumSet.of(CLASS_ONLY, LOCAL_CLASS, ENUM_CLASS, OBJECT, MEMBER_PROPERTY, MEMBER_FUNCTION), - SEALED_KEYWORD to EnumSet.of(CLASS_ONLY), + SEALED_KEYWORD to EnumSet.of(CLASS_ONLY, INTERFACE), INNER_KEYWORD to EnumSet.of(CLASS_ONLY), OVERRIDE_KEYWORD to EnumSet.of(MEMBER_PROPERTY, MEMBER_FUNCTION), PRIVATE_KEYWORD to defaultVisibilityTargets, diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt index 34391d681cc..43734e9792a 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt @@ -42,6 +42,7 @@ private val DEFAULT_DECLARATION_CHECKERS = listOf( ContractDescriptionBlockChecker, PrivateInlineFunctionsReturningAnonymousObjectsChecker, SealedInheritorInSamePackageChecker, + SealedInterfaceAllowedChecker, ) private val DEFAULT_CALL_CHECKERS = listOf( diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/SealedInterfaceAllowedChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/SealedInterfaceAllowedChecker.kt new file mode 100644 index 00000000000..ae9f92c84a8 --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/SealedInterfaceAllowedChecker.kt @@ -0,0 +1,23 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.resolve.checkers + +import org.jetbrains.kotlin.config.LanguageFeature +import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.descriptors.annotations.KotlinTarget +import org.jetbrains.kotlin.diagnostics.Errors +import org.jetbrains.kotlin.lexer.KtTokens +import org.jetbrains.kotlin.psi.KtDeclaration + +object SealedInterfaceAllowedChecker : DeclarationChecker { + override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) { + if (context.languageVersionSettings.supportsFeature(LanguageFeature.SealedInterfaces)) return + if (descriptor !is ClassDescriptor) return + if (descriptor.kind != ClassKind.INTERFACE) return + val keyword = declaration.modifierList?.getModifier(KtTokens.SEALED_KEYWORD) ?: return + context.trace.report(Errors.WRONG_MODIFIER_TARGET.on(keyword, KtTokens.SEALED_KEYWORD, KotlinTarget.INTERFACE.description)) + } +} diff --git a/compiler/testData/diagnostics/tests/sealed/interfaces/sealedInterfacesDisabled.fir.kt b/compiler/testData/diagnostics/tests/sealed/interfaces/sealedInterfacesDisabled.fir.kt new file mode 100644 index 00000000000..300a769e364 --- /dev/null +++ b/compiler/testData/diagnostics/tests/sealed/interfaces/sealedInterfacesDisabled.fir.kt @@ -0,0 +1,5 @@ +// ISSUE: KT-20423 +// !LANGUAGE: -SealedInterfaces +// !DIAGNOSTICS: -UNUSED_VARIABLE + +sealed interface Base diff --git a/compiler/testData/diagnostics/tests/sealed/interfaces/sealedInterfacesDisabled.kt b/compiler/testData/diagnostics/tests/sealed/interfaces/sealedInterfacesDisabled.kt new file mode 100644 index 00000000000..2ba0a7ccbd9 --- /dev/null +++ b/compiler/testData/diagnostics/tests/sealed/interfaces/sealedInterfacesDisabled.kt @@ -0,0 +1,5 @@ +// ISSUE: KT-20423 +// !LANGUAGE: -SealedInterfaces +// !DIAGNOSTICS: -UNUSED_VARIABLE + +sealed interface Base diff --git a/compiler/testData/diagnostics/tests/sealed/interfaces/sealedInterfacesDisabled.txt b/compiler/testData/diagnostics/tests/sealed/interfaces/sealedInterfacesDisabled.txt new file mode 100644 index 00000000000..f2ed48d03d4 --- /dev/null +++ b/compiler/testData/diagnostics/tests/sealed/interfaces/sealedInterfacesDisabled.txt @@ -0,0 +1,7 @@ +package + +public sealed interface Base { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.fir.kt b/compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.fir.kt new file mode 100644 index 00000000000..2d63915cbcb --- /dev/null +++ b/compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.fir.kt @@ -0,0 +1,38 @@ +// ISSUE: KT-20423 +// !LANGUAGE: +FreedomForSealedClasses +SealedInterfaces +// !DIAGNOSTICS: -UNUSED_VARIABLE + +sealed interface Base + +interface A : Base + +sealed class B : Base { + class First : B() + class Second : B() +} + +enum class C : Base { + SomeValue, AnotherValue +} + +object D : Base + +fun test_1(base: Base) { + val x = when (base) { + is A -> 1 + is B -> 2 + is C -> 3 + is D -> 4 + } +} + +fun test_2(base: Base) { + val x = when (base) { + is A -> 1 + is B.First -> 2 + is B.Second -> 3 + C.SomeValue -> 4 + C.AnotherValue -> 5 + D -> 6 + } +} diff --git a/compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.kt b/compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.kt new file mode 100644 index 00000000000..4f87a029760 --- /dev/null +++ b/compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.kt @@ -0,0 +1,38 @@ +// ISSUE: KT-20423 +// !LANGUAGE: +FreedomForSealedClasses +SealedInterfaces +// !DIAGNOSTICS: -UNUSED_VARIABLE + +sealed interface Base + +interface A : Base + +sealed class B : Base { + class First : B() + class Second : B() +} + +enum class C : Base { + SomeValue, AnotherValue +} + +object D : Base + +fun test_1(base: Base) { + val x = when (base) { + is A -> 1 + is B -> 2 + is C -> 3 + is D -> 4 + } +} + +fun test_2(base: Base) { + val x = when (base) { + is A -> 1 + is B.First -> 2 + is B.Second -> 3 + C.SomeValue -> 4 + C.AnotherValue -> 5 + D -> 6 + } +} diff --git a/compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.txt b/compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.txt new file mode 100644 index 00000000000..1cc0a6b869a --- /dev/null +++ b/compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.txt @@ -0,0 +1,65 @@ +package + +public fun test_1(/*0*/ base: Base): kotlin.Unit +public fun test_2(/*0*/ base: Base): kotlin.Unit + +public interface A : Base { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public sealed class B : Base { + internal constructor B() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public final class First : B { + public constructor First() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final class Second : B { + public constructor Second() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + +public sealed interface Base { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final enum class C : kotlin.Enum, Base { + enum entry SomeValue + + enum entry AnotherValue + + private constructor C() + public final override /*1*/ /*fake_override*/ val name: kotlin.String + public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int + protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any + public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: C): kotlin.Int + public final override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit + public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class! + public final override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String + + // Static members + public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): C + public final /*synthesized*/ fun values(): kotlin.Array +} + +public object D : Base { + private constructor D() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 5c1521aa986..04fa8c6fbbc 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -20974,6 +20974,29 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali public void testWithInterface() throws Exception { runTest("compiler/testData/diagnostics/tests/sealed/WithInterface.kt"); } + + @TestMetadata("compiler/testData/diagnostics/tests/sealed/interfaces") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Interfaces extends AbstractDiagnosticsTestWithFirValidation { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInInterfaces() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/sealed/interfaces"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("sealedInterfacesDisabled.kt") + public void testSealedInterfacesDisabled() throws Exception { + runTest("compiler/testData/diagnostics/tests/sealed/interfaces/sealedInterfacesDisabled.kt"); + } + + @TestMetadata("simpleSealedInterface.kt") + public void testSimpleSealedInterface() throws Exception { + runTest("compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.kt"); + } + } } @TestMetadata("compiler/testData/diagnostics/tests/secondaryConstructors") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java index 6b56a052b0f..44bf9026e50 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java @@ -20899,6 +20899,29 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing public void testWithInterface() throws Exception { runTest("compiler/testData/diagnostics/tests/sealed/WithInterface.kt"); } + + @TestMetadata("compiler/testData/diagnostics/tests/sealed/interfaces") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Interfaces extends AbstractDiagnosticsUsingJavacTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInInterfaces() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/sealed/interfaces"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("sealedInterfacesDisabled.kt") + public void testSealedInterfacesDisabled() throws Exception { + runTest("compiler/testData/diagnostics/tests/sealed/interfaces/sealedInterfacesDisabled.kt"); + } + + @TestMetadata("simpleSealedInterface.kt") + public void testSimpleSealedInterface() throws Exception { + runTest("compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.kt"); + } + } } @TestMetadata("compiler/testData/diagnostics/tests/secondaryConstructors") diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index 487e7a6e9ef..6b8aff23492 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -144,6 +144,7 @@ enum class LanguageFeature( JvmRecordSupport(KOTLIN_1_5), FreedomForSealedClasses(KOTLIN_1_5), + SealedInterfaces(KOTLIN_1_5), // Temporarily disabled, see KT-27084/KT-22379 SoundSmartcastFromLoopConditionForLoopAssignedVariables(sinceVersion = null, kind = BUG_FIX), diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.java b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.java index 005b58cf637..51f6c92f8f2 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.java +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.java @@ -270,7 +270,7 @@ public class DescriptorUtils { } public static boolean isSealedClass(@Nullable DeclarationDescriptor descriptor) { - return isKindOf(descriptor, ClassKind.CLASS) && ((ClassDescriptor) descriptor).getModality() == Modality.SEALED; + return (isKindOf(descriptor, ClassKind.CLASS) || isKindOf(descriptor, ClassKind.INTERFACE)) && ((ClassDescriptor) descriptor).getModality() == Modality.SEALED; } public static boolean isAnonymousObject(@NotNull DeclarationDescriptor descriptor) { From 8e9e34350fc1972c597865ee45a6bfe9d0118cf6 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Tue, 17 Nov 2020 10:59:30 +0300 Subject: [PATCH 557/698] [FE] Properly support sealed interfaces in exhaustiveness checker #KT-20423 --- .../org/jetbrains/kotlin/cfg/WhenChecker.kt | 32 +++++++++------- .../interfaces/simpleSealedInterface.fir.kt | 38 ------------------- .../interfaces/simpleSealedInterface.kt | 3 +- 3 files changed, 21 insertions(+), 52 deletions(-) delete mode 100644 compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.fir.kt diff --git a/compiler/frontend/src/org/jetbrains/kotlin/cfg/WhenChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/cfg/WhenChecker.kt index d6bed65a6ec..be754db3ec2 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/cfg/WhenChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/cfg/WhenChecker.kt @@ -146,10 +146,23 @@ internal abstract class WhenOnClassExhaustivenessChecker : WhenExhaustivenessChe else -> null } - protected val ClassDescriptor.deepSealedSubclasses: List - get() = this.sealedSubclasses.flatMap { - if (it.modality == Modality.SEALED) it.deepSealedSubclasses - else setOf(it) + protected val ClassDescriptor.enumEntries: Set + get() = DescriptorUtils.getAllDescriptors(this.unsubstitutedInnerClassesScope) + .filter(::isEnumEntry) + .filterIsInstance() + .toSet() + + + protected val ClassDescriptor.deepSealedSubclasses: Set + get() = this.sealedSubclasses.flatMapTo(mutableSetOf()) { + it.subclasses + } + + private val ClassDescriptor.subclasses: Set + get() = when { + this.modality == Modality.SEALED -> this.deepSealedSubclasses + this.kind == ClassKind.ENUM_CLASS -> this.enumEntries + else -> setOf(this) } private val KtWhenCondition.negated @@ -189,9 +202,7 @@ internal abstract class WhenOnClassExhaustivenessChecker : WhenExhaustivenessChe for (condition in whenEntry.conditions) { val negated = condition.negated val checkedDescriptor = condition.getCheckedDescriptor(context) ?: continue - val checkedDescriptorSubclasses = - if (checkedDescriptor.modality == Modality.SEALED) checkedDescriptor.deepSealedSubclasses - else listOf(checkedDescriptor) + val checkedDescriptorSubclasses = checkedDescriptor.subclasses // Checks are important only for nested subclasses of the sealed class // In additional, check without "is" is important only for objects @@ -220,12 +231,7 @@ private object WhenOnEnumExhaustivenessChecker : WhenOnClassExhaustivenessChecke nullable: Boolean ): List { assert(isEnumClass(subjectDescriptor)) { "isWhenOnEnumExhaustive should be called with an enum class descriptor" } - val entryDescriptors = - DescriptorUtils.getAllDescriptors(subjectDescriptor!!.unsubstitutedInnerClassesScope) - .filter(::isEnumEntry) - .filterIsInstance() - .toSet() - return getMissingClassCases(expression, entryDescriptors, context) + + return getMissingClassCases(expression, subjectDescriptor!!.enumEntries, context) + WhenOnNullableExhaustivenessChecker.getMissingCases(expression, context, nullable) } diff --git a/compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.fir.kt b/compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.fir.kt deleted file mode 100644 index 2d63915cbcb..00000000000 --- a/compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.fir.kt +++ /dev/null @@ -1,38 +0,0 @@ -// ISSUE: KT-20423 -// !LANGUAGE: +FreedomForSealedClasses +SealedInterfaces -// !DIAGNOSTICS: -UNUSED_VARIABLE - -sealed interface Base - -interface A : Base - -sealed class B : Base { - class First : B() - class Second : B() -} - -enum class C : Base { - SomeValue, AnotherValue -} - -object D : Base - -fun test_1(base: Base) { - val x = when (base) { - is A -> 1 - is B -> 2 - is C -> 3 - is D -> 4 - } -} - -fun test_2(base: Base) { - val x = when (base) { - is A -> 1 - is B.First -> 2 - is B.Second -> 3 - C.SomeValue -> 4 - C.AnotherValue -> 5 - D -> 6 - } -} diff --git a/compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.kt b/compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.kt index 4f87a029760..284c4f84434 100644 --- a/compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.kt +++ b/compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // ISSUE: KT-20423 // !LANGUAGE: +FreedomForSealedClasses +SealedInterfaces // !DIAGNOSTICS: -UNUSED_VARIABLE @@ -27,7 +28,7 @@ fun test_1(base: Base) { } fun test_2(base: Base) { - val x = when (base) { + val x = when (base) { is A -> 1 is B.First -> 2 is B.Second -> 3 From bdfb71b149dad4cd212378fe43d00b3c3b65c4cf Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Thu, 19 Nov 2020 17:32:12 +0300 Subject: [PATCH 558/698] [FE] Add sealed classes related properties to java model --- .../kotlin/javac/resolve/KotlinClassifiersCache.kt | 2 ++ .../kotlin/javac/wrappers/symbols/FakeSymbolBasedClass.kt | 5 +++++ .../kotlin/javac/wrappers/symbols/SymbolBasedClass.kt | 7 +++++++ .../kotlin/javac/wrappers/trees/TreeBasedClass.kt | 7 +++++++ .../kotlin/load/java/structure/impl/JavaClassImpl.kt | 6 ++++++ .../kotlin/load/java/structure/impl/JavaElementUtil.java | 4 ++++ .../load/java/structure/impl/classFiles/BinaryJavaClass.kt | 7 +++++++ .../jetbrains/kotlin/load/java/structure/javaElements.kt | 2 ++ .../descriptors/runtime/structure/ReflectJavaClass.kt | 6 ++++++ 9 files changed, 46 insertions(+) diff --git a/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/resolve/KotlinClassifiersCache.kt b/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/resolve/KotlinClassifiersCache.kt index dbf128ce3d6..d9e23b02dd3 100644 --- a/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/resolve/KotlinClassifiersCache.kt +++ b/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/resolve/KotlinClassifiersCache.kt @@ -158,6 +158,8 @@ class MockKotlinClassifier(override val classId: ClassId, override val isAnnotationType get() = shouldNotBeCalled() override val isEnum get() = shouldNotBeCalled() override val isRecord get() = shouldNotBeCalled() + override val isSealed: Boolean get() = shouldNotBeCalled() + override val permittedTypes: Collection get() = shouldNotBeCalled() override val methods get() = shouldNotBeCalled() override val fields get() = shouldNotBeCalled() override val constructors get() = shouldNotBeCalled() diff --git a/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/wrappers/symbols/FakeSymbolBasedClass.kt b/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/wrappers/symbols/FakeSymbolBasedClass.kt index a1c37ddff5b..a59c094bfe7 100644 --- a/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/wrappers/symbols/FakeSymbolBasedClass.kt +++ b/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/wrappers/symbols/FakeSymbolBasedClass.kt @@ -68,6 +68,11 @@ class FakeSymbolBasedClass( override val isRecord: Boolean get() = false override val recordComponents: Collection get() = emptyList() + + override val isSealed: Boolean get() = false + + override val permittedTypes: Collection get() = emptyList() + override val lightClassOriginKind: LightClassOriginKind? get() = null override val methods: Collection get() = emptyList() diff --git a/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/wrappers/symbols/SymbolBasedClass.kt b/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/wrappers/symbols/SymbolBasedClass.kt index e731f775ec9..16dddafab71 100644 --- a/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/wrappers/symbols/SymbolBasedClass.kt +++ b/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/wrappers/symbols/SymbolBasedClass.kt @@ -107,6 +107,13 @@ class SymbolBasedClass( override val isEnum: Boolean get() = element.kind == ElementKind.ENUM + // TODO + override val isSealed: Boolean + get() = false + + override val permittedTypes: Collection + get() = emptyList() + override val lightClassOriginKind: LightClassOriginKind? get() = null diff --git a/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/wrappers/trees/TreeBasedClass.kt b/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/wrappers/trees/TreeBasedClass.kt index 686ba9f0201..cfb50104589 100644 --- a/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/wrappers/trees/TreeBasedClass.kt +++ b/compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/wrappers/trees/TreeBasedClass.kt @@ -118,6 +118,13 @@ class TreeBasedClass( override val isRecord: Boolean get() = false + // TODO + override val isSealed: Boolean + get() = false + + override val permittedTypes: Collection + get() = emptyList() + override val lightClassOriginKind: LightClassOriginKind? get() = null diff --git a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt index 359e4e5a2dc..96c8ca301f8 100644 --- a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt +++ b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt @@ -59,6 +59,12 @@ class JavaClassImpl(psiClass: PsiClass) : JavaClassifierImpl(psiClass) override val isEnum: Boolean get() = psi.isEnum + override val isSealed: Boolean + get() = JavaElementUtil.isSealed(this) + + override val permittedTypes: Collection + get() = classifierTypes(psi.permitsListTypes) + override val isRecord: Boolean get() = psi.isRecord diff --git a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaElementUtil.java b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaElementUtil.java index 173cbd51253..fde0178de4f 100644 --- a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaElementUtil.java +++ b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaElementUtil.java @@ -52,6 +52,10 @@ import static org.jetbrains.kotlin.load.java.structure.impl.JavaElementCollectio return owner.getPsi().hasModifierProperty(PsiModifier.FINAL); } + public static boolean isSealed(@NotNull JavaModifierListOwnerImpl owner) { + return owner.getPsi().hasModifierProperty(PsiModifier.SEALED); + } + @NotNull public static Visibility getVisibility(@NotNull JavaModifierListOwnerImpl owner) { PsiModifierListOwner psiOwner = owner.getPsi(); diff --git a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/BinaryJavaClass.kt b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/BinaryJavaClass.kt index 73e75d17baa..3dbf87805b9 100644 --- a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/BinaryJavaClass.kt +++ b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/BinaryJavaClass.kt @@ -70,6 +70,9 @@ class BinaryJavaClass( override val lightClassOriginKind: LightClassOriginKind? get() = null + override val isSealed: Boolean get() = permittedTypes.isNotEmpty() + override val permittedTypes = arrayListOf() + override fun isFromSourceCodeInScope(scope: SearchScope): Boolean = false override fun visitEnd() { @@ -233,4 +236,8 @@ class BinaryJavaClass( ) } } + + override fun visitPermittedSubtypeExperimental(permittedSubtype: String?) { + permittedTypes.addIfNotNull(permittedSubtype?.convertInternalNameToClassifierType()) + } } diff --git a/core/compiler.common.jvm/src/org/jetbrains/kotlin/load/java/structure/javaElements.kt b/core/compiler.common.jvm/src/org/jetbrains/kotlin/load/java/structure/javaElements.kt index 72700425946..15d34def2c8 100644 --- a/core/compiler.common.jvm/src/org/jetbrains/kotlin/load/java/structure/javaElements.kt +++ b/core/compiler.common.jvm/src/org/jetbrains/kotlin/load/java/structure/javaElements.kt @@ -86,6 +86,8 @@ interface JavaClass : JavaClassifier, JavaTypeParameterListOwner, JavaModifierLi val isAnnotationType: Boolean val isEnum: Boolean val isRecord: Boolean + val isSealed: Boolean + val permittedTypes: Collection val lightClassOriginKind: LightClassOriginKind? val methods: Collection diff --git a/core/descriptors.runtime/src/org/jetbrains/kotlin/descriptors/runtime/structure/ReflectJavaClass.kt b/core/descriptors.runtime/src/org/jetbrains/kotlin/descriptors/runtime/structure/ReflectJavaClass.kt index f98ca3118f9..a8606dfb2ac 100644 --- a/core/descriptors.runtime/src/org/jetbrains/kotlin/descriptors/runtime/structure/ReflectJavaClass.kt +++ b/core/descriptors.runtime/src/org/jetbrains/kotlin/descriptors/runtime/structure/ReflectJavaClass.kt @@ -122,6 +122,12 @@ class ReflectJavaClass( override val isRecord: Boolean get() = false + override val isSealed: Boolean + get() = false + + override val permittedTypes: Collection + get() = emptyList() + override fun equals(other: Any?) = other is ReflectJavaClass && klass == other.klass override fun hashCode() = klass.hashCode() From 7897bb6adbb30947dc1b9d7803c57c09d5addef1 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Thu, 19 Nov 2020 17:48:25 +0300 Subject: [PATCH 559/698] [FE] Support sealed classes and interfaces from java KT-43551 KT-41215 --- .../javaSealedClassExhaustiveness.kt | 44 +++++++++++++ .../javaSealedClassExhaustiveness.txt | 41 ++++++++++++ .../javaSealedInterfaceExhaustiveness.kt | 64 +++++++++++++++++++ .../javaSealedInterfaceExhaustiveness.txt | 60 +++++++++++++++++ .../DiagnosticsWithJdk15TestGenerated.java | 33 ++++++++++ .../jetbrains/kotlin/descriptors/Modality.kt | 13 ++-- .../descriptors/LazyJavaClassDescriptor.kt | 11 +++- .../descriptors/LazyJavaClassMemberScope.kt | 2 +- .../java/lazy/descriptors/LazyJavaScope.kt | 2 +- 9 files changed, 260 insertions(+), 10 deletions(-) create mode 100644 compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedClassExhaustiveness.kt create mode 100644 compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedClassExhaustiveness.txt create mode 100644 compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedInterfaceExhaustiveness.kt create mode 100644 compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedInterfaceExhaustiveness.txt diff --git a/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedClassExhaustiveness.kt b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedClassExhaustiveness.kt new file mode 100644 index 00000000000..0ae9771eb1f --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedClassExhaustiveness.kt @@ -0,0 +1,44 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE +// ISSUE: KT-41215, KT-43551 + +// FILE: Base.java +public sealed class Base permits A, B {} + +// FILE: A.java +public final class A extends Base {} + +// FILE: B.java +public sealed class B extends Base permits B.C, B.D { + public static final class C implements B {} + + public static non-sealed class D extends B {} +} + +// FILE: main.kt +fun test_ok_1(base: Base) { + val x = when (base) { + is A -> 1 + is B -> 2 + } +} + +fun test_ok_2(base: Base) { + val x = when (base) { + is A -> 1 + is B.C -> 2 + is B.D -> 3 + } +} + +fun test_error_1(base: Base) { + val x = when (base) { + is A -> 1 + } +} + +fun test_error_2(base: Base) { + val x = when (base) { + is A -> 1 + is B.C -> 2 + } +} diff --git a/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedClassExhaustiveness.txt b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedClassExhaustiveness.txt new file mode 100644 index 00000000000..8d90f4c6fcf --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedClassExhaustiveness.txt @@ -0,0 +1,41 @@ +package + +public fun test_error_1(/*0*/ base: Base): kotlin.Unit +public fun test_error_2(/*0*/ base: Base): kotlin.Unit +public fun test_ok_1(/*0*/ base: Base): kotlin.Unit +public fun test_ok_2(/*0*/ base: Base): kotlin.Unit + +public final class A : Base { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public sealed class B : Base { + public constructor B() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public final class C : B { + public constructor C() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public open class D : B { + public constructor D() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + +public sealed class Base { + public constructor Base() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedInterfaceExhaustiveness.kt b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedInterfaceExhaustiveness.kt new file mode 100644 index 00000000000..3419f18de62 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedInterfaceExhaustiveness.kt @@ -0,0 +1,64 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE +// ISSUE: KT-41215, KT-43551 + +// FILE: Base.java +public sealed interface Base permits A, B, E {} + +// FILE: A.java +public non-sealed interface A extends Base {} + +// FILE: B.java +public sealed interface B extends Base permits B.C, B.D { + public static final class C implements B {} + + public static non-sealed interface D extends B {} +} + +// FILE: E.java +public enum E implements Base { + First, Second +} + +// FILE: main.kt +fun test_ok_1(base: Base) { + val x = when (base) { + is A -> 1 + is B -> 2 + is E -> 3 + } +} + +fun test_ok_2(base: Base) { + val x = when (base) { + is A -> 1 + is B.C -> 2 + is B.D -> 3 + E.First -> 4 + E.Second -> 5 + } +} + +fun test_error_1(base: Base) { + val x = when (base) { + is A -> 1 + is B -> 2 + } +} + +fun test_error_2(base: Base) { + val x = when (base) { + is A -> 1 + is B.C -> 2 + is B.D -> 3 + E.Second -> 5 + } +} + +fun test_error_3(base: Base) { + val x = when (base) { + is A -> 1 + is B.C -> 2 + E.First -> 4 + E.Second -> 5 + } +} diff --git a/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedInterfaceExhaustiveness.txt b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedInterfaceExhaustiveness.txt new file mode 100644 index 00000000000..6b88bec8277 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedInterfaceExhaustiveness.txt @@ -0,0 +1,60 @@ +package + +public fun test_error_1(/*0*/ base: Base): kotlin.Unit +public fun test_error_2(/*0*/ base: Base): kotlin.Unit +public fun test_error_3(/*0*/ base: Base): kotlin.Unit +public fun test_ok_1(/*0*/ base: Base): kotlin.Unit +public fun test_ok_2(/*0*/ base: Base): kotlin.Unit + +public interface A : Base { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public sealed interface B : Base { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public final class C : B { + public constructor C() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public interface D : B { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + +public sealed interface Base { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final enum class E : kotlin.Enum, Base { + enum entry First + + enum entry Second + + public constructor E() + public final override /*1*/ /*fake_override*/ val name: kotlin.String + public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int + protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any + public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: E!): kotlin.Int + @kotlin.Deprecated(level = DeprecationLevel.WARNING, message = "This member is not fully supported by Kotlin compiler, so it may be absent or have different signature in next major version", replaceWith = kotlin.ReplaceWith(expression = "", imports = {})) public final override /*1*/ /*fake_override*/ fun describeConstable(): java.util.Optional!>! + public final override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit + public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class! + public final override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String + + // Static members + public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): E + public final /*synthesized*/ fun values(): kotlin.Array +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java index 8d5993043e9..1a4c5ea600f 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsWithJdk15TestGenerated.java @@ -70,4 +70,37 @@ public class DiagnosticsWithJdk15TestGenerated extends AbstractDiagnosticsWithJd runTest("compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt"); } } + + @TestMetadata("compiler/testData/diagnostics/testsWithJava15/sealedClasses") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class SealedClasses extends AbstractDiagnosticsWithJdk15Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInSealedClasses() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJava15/sealedClasses"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("javaSealedClassExhaustiveness.kt") + public void testJavaSealedClassExhaustiveness() throws Exception { + runTest("compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedClassExhaustiveness.kt"); + } + + @TestMetadata("javaSealedInterfaceExhaustiveness.kt") + public void testJavaSealedInterfaceExhaustiveness() throws Exception { + runTest("compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedInterfaceExhaustiveness.kt"); + } + + @TestMetadata("kotlinInheritsJavaClass.kt") + public void testKotlinInheritsJavaClass() throws Exception { + runTest("compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaClass.kt"); + } + + @TestMetadata("kotlinInheritsJavaInterface.kt") + public void testKotlinInheritsJavaInterface() throws Exception { + runTest("compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaInterface.kt"); + } + } } diff --git a/core/compiler.common/src/org/jetbrains/kotlin/descriptors/Modality.kt b/core/compiler.common/src/org/jetbrains/kotlin/descriptors/Modality.kt index 0b91487dfa4..eb5c8bbbd3f 100644 --- a/core/compiler.common/src/org/jetbrains/kotlin/descriptors/Modality.kt +++ b/core/compiler.common/src/org/jetbrains/kotlin/descriptors/Modality.kt @@ -15,12 +15,13 @@ enum class Modality { ABSTRACT; companion object { - - // NB: never returns SEALED - fun convertFromFlags(abstract: Boolean, open: Boolean): Modality { - if (abstract) return ABSTRACT - if (open) return OPEN - return FINAL + fun convertFromFlags(sealed: Boolean, abstract: Boolean, open: Boolean): Modality { + return when { + sealed -> SEALED + abstract -> ABSTRACT + open -> OPEN + else -> FINAL + } } } } diff --git a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt index d352a0a4a47..42688fbb51f 100644 --- a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt +++ b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt @@ -76,7 +76,7 @@ class LazyJavaClassDescriptor( private val modality = if (jClass.isAnnotationType || jClass.isEnum) Modality.FINAL - else Modality.convertFromFlags(jClass.isAbstract || jClass.isInterface, !jClass.isFinal) + else Modality.convertFromFlags(jClass.isSealed, jClass.isAbstract || jClass.isInterface, !jClass.isFinal) private val visibility = jClass.visibility private val isInner = jClass.outerClass != null && !jClass.isStatic @@ -180,7 +180,14 @@ class LazyJavaClassDescriptor( fun wasScopeContentRequested() = getUnsubstitutedMemberScope().wasContentRequested() || staticScope.wasContentRequested() - override fun getSealedSubclasses(): Collection = emptyList() + override fun getSealedSubclasses(): Collection = if (modality == Modality.SEALED) { + val attributes = TypeUsage.COMMON.toAttributes() + jClass.permittedTypes.mapNotNull { + c.typeResolver.transformJavaType(it, attributes).constructor.declarationDescriptor as? ClassDescriptor + } + } else { + emptyList() + } override fun toString() = "Lazy Java class ${this.fqNameUnsafe}" diff --git a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassMemberScope.kt b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassMemberScope.kt index 7a0399d71b1..4cef902b5ee 100644 --- a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassMemberScope.kt +++ b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassMemberScope.kt @@ -515,7 +515,7 @@ class LazyJavaClassMemberScope( returnType, // Those functions are generated as open in bytecode // Actually, it should not be important because the class is final anyway, but leaving them open is convenient for consistency - Modality.convertFromFlags(abstract = false, open = true), + Modality.convertFromFlags(sealed = false, abstract = false, open = true), DescriptorVisibilities.PUBLIC, null, ) diff --git a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaScope.kt b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaScope.kt index 8642044363f..e38a6004ec2 100644 --- a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaScope.kt +++ b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaScope.kt @@ -181,7 +181,7 @@ abstract class LazyJavaScope( effectiveSignature.typeParameters, effectiveSignature.valueParameters, effectiveSignature.returnType, - Modality.convertFromFlags(method.isAbstract, !method.isFinal), + Modality.convertFromFlags(sealed = false, method.isAbstract, !method.isFinal), method.visibility.toDescriptorVisibility(), if (effectiveSignature.receiverType != null) mapOf(JavaMethodDescriptor.ORIGINAL_VALUE_PARAMETER_FOR_EXTENSION_RECEIVER to valueParameters.descriptors.first()) From c0a1aecf9b13fcc76a2ae66688d33121d4959114 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Fri, 20 Nov 2020 13:36:49 +0300 Subject: [PATCH 560/698] [FE] Add test for compiling against library with kotlin sealed classes and interfaces #KT-20423 #KT-13495 --- .../sealedClassesAndInterfaces/library/A.kt | 3 ++ .../sealedClassesAndInterfaces/library/B.kt | 6 ++++ .../library/Base.kt | 5 +++ .../sealedClassesAndInterfaces/library/C.kt | 5 +++ .../sealedClassesAndInterfaces/library/D.kt | 3 ++ .../sealedClassesAndInterfaces/main.kt | 36 +++++++++++++++++++ .../sealedClassesAndInterfaces/output.txt | 23 ++++++++++++ .../CompileKotlinAgainstCustomBinariesTest.kt | 6 ++++ 8 files changed, 87 insertions(+) create mode 100644 compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/library/A.kt create mode 100644 compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/library/B.kt create mode 100644 compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/library/Base.kt create mode 100644 compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/library/C.kt create mode 100644 compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/library/D.kt create mode 100644 compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/main.kt create mode 100644 compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/output.txt diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/library/A.kt b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/library/A.kt new file mode 100644 index 00000000000..b350cf24c72 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/library/A.kt @@ -0,0 +1,3 @@ +package test + +interface IA : IBase diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/library/B.kt b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/library/B.kt new file mode 100644 index 00000000000..06fbd0abafb --- /dev/null +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/library/B.kt @@ -0,0 +1,6 @@ +package test + +sealed class B : Base(), IBase { + class First : B() + class Second : B() +} diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/library/Base.kt b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/library/Base.kt new file mode 100644 index 00000000000..7e707c9b6a2 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/library/Base.kt @@ -0,0 +1,5 @@ +package test + +sealed interface IBase + +sealed class Base diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/library/C.kt b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/library/C.kt new file mode 100644 index 00000000000..30034bc8027 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/library/C.kt @@ -0,0 +1,5 @@ +package test + +enum class C : IBase { + SomeValue, AnotherValue +} diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/library/D.kt b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/library/D.kt new file mode 100644 index 00000000000..5cdbef39915 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/library/D.kt @@ -0,0 +1,3 @@ +package test + +object D : Base(), IBase diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/main.kt b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/main.kt new file mode 100644 index 00000000000..1dd93074578 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/main.kt @@ -0,0 +1,36 @@ +import test.* + +fun test_1(base: IBase) { + val x = when (base) { + is IA -> 1 + is B -> 2 + is C -> 3 + is D -> 4 + } +} + +fun test_2(base: IBase) { + val x = when (base) { + is IA -> 1 + is B.First -> 2 + is B.Second -> 3 + C.SomeValue -> 4 + C.AnotherValue -> 5 + D -> 6 + } +} + +fun test_3(base: Base) { + val x = when (base) { + is B -> 2 + is D -> 4 + } +} + +fun test_4(base: Base) { + val x = when (base) { + is B.First -> 2 + is B.Second -> 3 + D -> 6 + } +} diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/output.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/output.txt new file mode 100644 index 00000000000..e4d9b26ce29 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/output.txt @@ -0,0 +1,23 @@ +warning: ATTENTION! +This build uses unsafe internal compiler arguments: + +-XXLanguage:+FreedomForSealedClasses +-XXLanguage:+SealedInterfaces + +This mode is not recommended for production use, +as no stability/compatibility guarantees are given on +compiler or generated code. Use it at your own risk! + +compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/main.kt:4:9: warning: variable 'x' is never used + val x = when (base) { + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/main.kt:13:9: warning: variable 'x' is never used + val x = when (base) { + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/main.kt:24:9: warning: variable 'x' is never used + val x = when (base) { + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/main.kt:31:9: warning: variable 'x' is never used + val x = when (base) { + ^ +OK diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt index cfe3369ee02..64626e8ce3c 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt @@ -694,6 +694,12 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-Xallow-jvm-ir-dependencies")) } + fun testSealedClassesAndInterfaces() { + val features = listOf("-XXLanguage:+FreedomForSealedClasses", "-XXLanguage:+SealedInterfaces") + val library = compileLibrary("library", additionalOptions = features, checkKotlinOutput = {}) + compileKotlin("main.kt", tmpdir, listOf(library), additionalOptions = features) + } + // If this test fails, then bootstrap compiler most likely should be advanced fun testPreReleaseFlagIsConsistentBetweenBootstrapAndCurrentCompiler() { val bootstrapCompiler = JarFile(PathUtil.kotlinPathsForCompiler.compilerPath) From 6809adee9c2b955cc0d42de872f56d1c0f970207 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Mon, 23 Nov 2020 11:14:22 +0300 Subject: [PATCH 561/698] [FE] Extract computation of sealed class inheritors into separate component This is needed to provide more optimal provider in IDE plugin --- .../jetbrains/kotlin/frontend/di/injection.kt | 1 + .../kotlin/resolve/lazy/LazyClassContext.kt | 1 + .../kotlin/resolve/lazy/ResolveSession.java | 12 ++++ .../lazy/descriptors/LazyClassDescriptor.java | 3 +- .../expressions/LocalClassifierAnalyzer.kt | 4 ++ .../kotlin/resolve/DescriptorUtils.kt | 37 ----------- .../resolve/SealedClassInheritorsProvider.kt | 63 +++++++++++++++++++ .../serialization/deserialization/context.kt | 1 + .../DeserializedClassDescriptor.kt | 4 +- .../builder/CommonizedClassDescriptor.kt | 4 +- 10 files changed, 87 insertions(+), 43 deletions(-) create mode 100644 core/descriptors/src/org/jetbrains/kotlin/resolve/SealedClassInheritorsProvider.kt diff --git a/compiler/frontend/src/org/jetbrains/kotlin/frontend/di/injection.kt b/compiler/frontend/src/org/jetbrains/kotlin/frontend/di/injection.kt index e55b0f295f5..33f1f8e84ba 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/frontend/di/injection.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/frontend/di/injection.kt @@ -103,6 +103,7 @@ private fun StorageComponentContainer.configurePlatformIndependentComponents() { useImpl() useImpl() useInstance(ProgressManagerBasedCancellationChecker) + useInstance(SealedClassInheritorsProviderImpl) } /** diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyClassContext.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyClassContext.kt index c0f217ee5b6..47107bdbe38 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyClassContext.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyClassContext.kt @@ -48,4 +48,5 @@ interface LazyClassContext { val kotlinTypeChecker: NewKotlinTypeChecker val samConversionResolver: SamConversionResolver val additionalClassPartsProvider: AdditionalClassPartsProvider + val sealedClassInheritorsProvider: SealedClassInheritorsProvider } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/ResolveSession.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/ResolveSession.java index cd86cb6e2a9..c597435ad03 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/ResolveSession.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/ResolveSession.java @@ -85,6 +85,7 @@ public class ResolveSession implements KotlinCodeAnalyzer, LazyClassContext { private WrappedTypeFactory wrappedTypeFactory; private PlatformDiagnosticSuppressor platformDiagnosticSuppressor; private SamConversionResolver samConversionResolver; + private SealedClassInheritorsProvider sealedClassInheritorsProvider; private AdditionalClassPartsProvider additionalClassPartsProvider; @@ -164,6 +165,11 @@ public class ResolveSession implements KotlinCodeAnalyzer, LazyClassContext { this.additionalClassPartsProvider = additionalClassPartsProvider; } + @Inject + public void setSealedClassInheritorsProvider(@NotNull SealedClassInheritorsProvider sealedClassInheritorsProvider) { + this.sealedClassInheritorsProvider = sealedClassInheritorsProvider; + } + // Only calls from injectors expected @Deprecated public ResolveSession( @@ -513,4 +519,10 @@ public class ResolveSession implements KotlinCodeAnalyzer, LazyClassContext { public AdditionalClassPartsProvider getAdditionalClassPartsProvider() { return additionalClassPartsProvider; } + + @NotNull + @Override + public SealedClassInheritorsProvider getSealedClassInheritorsProvider() { + return sealedClassInheritorsProvider; + } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java index 02e41a83ad7..599982fff30 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java @@ -270,9 +270,8 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes ) ); - // TODO: only consider classes from the same file, not the whole package fragment boolean freedomForSealedInterfacesSupported = c.getLanguageVersionSettings().supportsFeature(LanguageFeature.FreedomForSealedClasses); - this.sealedSubclasses = storageManager.createLazyValue(() -> DescriptorUtilsKt.computeSealedSubclasses(this, freedomForSealedInterfacesSupported)); + this.sealedSubclasses = storageManager.createLazyValue(() -> c.getSealedClassInheritorsProvider().computeSealedSubclasses(this, freedomForSealedInterfacesSupported)); } private static boolean isIllegalInner(@NotNull DeclarationDescriptor descriptor) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/LocalClassifierAnalyzer.kt b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/LocalClassifierAnalyzer.kt index c92f40eb10c..8643f9907be 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/LocalClassifierAnalyzer.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/LocalClassifierAnalyzer.kt @@ -71,6 +71,7 @@ class LocalClassifierAnalyzer( private val kotlinTypeChecker: NewKotlinTypeChecker, private val samConversionResolver: SamConversionResolver, private val additionalClassPartsProvider: AdditionalClassPartsProvider, + private val sealedClassInheritorsProvider: SealedClassInheritorsProvider ) { fun processClassOrObject( scope: LexicalWritableScope?, @@ -107,6 +108,7 @@ class LocalClassifierAnalyzer( kotlinTypeChecker, samConversionResolver, additionalClassPartsProvider, + sealedClassInheritorsProvider ), analyzerServices ) @@ -138,6 +140,7 @@ class LocalClassDescriptorHolder( val kotlinTypeChecker: NewKotlinTypeChecker, val samConversionResolver: SamConversionResolver, val additionalClassPartsProvider: AdditionalClassPartsProvider, + val sealedClassInheritorsProvider: SealedClassInheritorsProvider ) { // We do not need to synchronize here, because this code is used strictly from one thread private var classDescriptor: ClassDescriptor? = null @@ -181,6 +184,7 @@ class LocalClassDescriptorHolder( override val samConversionResolver: SamConversionResolver = this@LocalClassDescriptorHolder.samConversionResolver override val additionalClassPartsProvider: AdditionalClassPartsProvider = this@LocalClassDescriptorHolder.additionalClassPartsProvider + override val sealedClassInheritorsProvider: SealedClassInheritorsProvider = this@LocalClassDescriptorHolder.sealedClassInheritorsProvider }, containingDeclaration, classOrObject.nameAsSafeName, diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.kt index 7577fcf601f..e1255ce6f27 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.kt @@ -374,43 +374,6 @@ fun ClassifierDescriptor.getAllSuperClassifiers(): Sequence { - if (sealedClass.modality != Modality.SEALED) return emptyList() - - val result = linkedSetOf() - - fun collectSubclasses(scope: MemberScope, collectNested: Boolean) { - for (descriptor in scope.getContributedDescriptors(DescriptorKindFilter.CLASSIFIERS)) { - if (descriptor !is ClassDescriptor) continue - - if (DescriptorUtils.isDirectSubclass(descriptor, sealedClass)) { - result.add(descriptor) - } - - if (collectNested) { - collectSubclasses(descriptor.unsubstitutedInnerClassesScope, collectNested) - } - } - } - - val container = if (!freedomForSealedInterfacesSupported) { - sealedClass.containingDeclaration - } else { - sealedClass.parents.firstOrNull { it is PackageFragmentDescriptor } - } - if (container is PackageFragmentDescriptor) { - collectSubclasses( - container.getMemberScope(), - collectNested = freedomForSealedInterfacesSupported - ) - } - collectSubclasses(sealedClass.unsubstitutedInnerClassesScope, collectNested = true) - return result -} - fun DeclarationDescriptor.isPublishedApi(): Boolean { val descriptor = if (this is CallableMemberDescriptor) DescriptorUtils.getDirectMember(this) else this return descriptor.annotations.hasAnnotation(StandardNames.FqNames.publishedApi) diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/SealedClassInheritorsProvider.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/SealedClassInheritorsProvider.kt new file mode 100644 index 00000000000..7f663f6f0d2 --- /dev/null +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/SealedClassInheritorsProvider.kt @@ -0,0 +1,63 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.resolve + +import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.descriptors.Modality +import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor +import org.jetbrains.kotlin.resolve.descriptorUtil.parents +import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter +import org.jetbrains.kotlin.resolve.scopes.MemberScope + +abstract class SealedClassInheritorsProvider { + abstract fun computeSealedSubclasses( + sealedClass: ClassDescriptor, + freedomForSealedInterfacesSupported: Boolean + ): Collection +} + +object SealedClassInheritorsProviderImpl : SealedClassInheritorsProvider() { + // Note this is a generic and slow implementation which would work almost for any subclass of ClassDescriptor. + // Please avoid using it in new code. + // TODO: do something more clever instead at call sites of this function + override fun computeSealedSubclasses( + sealedClass: ClassDescriptor, + freedomForSealedInterfacesSupported: Boolean + ): Collection { + if (sealedClass.modality != Modality.SEALED) return emptyList() + + val result = linkedSetOf() + + fun collectSubclasses(scope: MemberScope, collectNested: Boolean) { + for (descriptor in scope.getContributedDescriptors(DescriptorKindFilter.CLASSIFIERS)) { + if (descriptor !is ClassDescriptor) continue + + if (DescriptorUtils.isDirectSubclass(descriptor, sealedClass)) { + result.add(descriptor) + } + + if (collectNested) { + collectSubclasses(descriptor.unsubstitutedInnerClassesScope, collectNested) + } + } + } + + val container = if (!freedomForSealedInterfacesSupported) { + sealedClass.containingDeclaration + } else { + sealedClass.parents.firstOrNull { it is PackageFragmentDescriptor } + } + if (container is PackageFragmentDescriptor) { + collectSubclasses( + container.getMemberScope(), + collectNested = freedomForSealedInterfacesSupported + ) + } + collectSubclasses(sealedClass.unsubstitutedInnerClassesScope, collectNested = true) + return result + } + +} diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/context.kt b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/context.kt index 5b60f70ab61..18cdddc8281 100644 --- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/context.kt +++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/context.kt @@ -27,6 +27,7 @@ import org.jetbrains.kotlin.metadata.ProtoBuf import org.jetbrains.kotlin.metadata.deserialization.* import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.protobuf.ExtensionRegistryLite +import org.jetbrains.kotlin.resolve.SealedClassInheritorsProvider import org.jetbrains.kotlin.resolve.constants.ConstantValue import org.jetbrains.kotlin.resolve.sam.SamConversionResolver import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedClassDescriptor.kt b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedClassDescriptor.kt index d43626fb3c2..bb29c10df39 100644 --- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedClassDescriptor.kt +++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedClassDescriptor.kt @@ -18,8 +18,8 @@ import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.DescriptorFactory import org.jetbrains.kotlin.resolve.NonReportingOverrideStrategy import org.jetbrains.kotlin.resolve.OverridingUtil +import org.jetbrains.kotlin.resolve.SealedClassInheritorsProviderImpl import org.jetbrains.kotlin.resolve.descriptorUtil.classId -import org.jetbrains.kotlin.resolve.descriptorUtil.computeSealedSubclasses import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter import org.jetbrains.kotlin.resolve.scopes.MemberScope import org.jetbrains.kotlin.resolve.scopes.StaticScopeForKotlinEnum @@ -165,7 +165,7 @@ class DeserializedClassDescriptor( } // This is needed because classes compiled with Kotlin 1.0 did not contain the sealed_subclass_fq_name field - return computeSealedSubclasses(this, freedomForSealedInterfacesSupported = false) + return SealedClassInheritorsProviderImpl.computeSealedSubclasses(this, freedomForSealedInterfacesSupported = false) } override fun getSealedSubclasses() = sealedSubclasses() diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/builder/CommonizedClassDescriptor.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/builder/CommonizedClassDescriptor.kt index 3d1c40f4c69..9cc4543f360 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/builder/CommonizedClassDescriptor.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/builder/CommonizedClassDescriptor.kt @@ -15,7 +15,7 @@ import org.jetbrains.kotlin.descriptors.impl.ClassDescriptorBase import org.jetbrains.kotlin.incremental.components.NoLookupLocation import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.DescriptorFactory.createPrimaryConstructorForObject -import org.jetbrains.kotlin.resolve.descriptorUtil.computeSealedSubclasses +import org.jetbrains.kotlin.resolve.SealedClassInheritorsProviderImpl import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe import org.jetbrains.kotlin.resolve.scopes.MemberScope import org.jetbrains.kotlin.resolve.scopes.StaticScopeForKotlinEnum @@ -54,7 +54,7 @@ class CommonizedClassDescriptor( private val typeConstructor = CommonizedClassTypeConstructor(targetComponents, cirSupertypes) private val sealedSubclasses = targetComponents.storageManager.createLazyValue { // TODO: pass proper language version settings - computeSealedSubclasses(this, freedomForSealedInterfacesSupported = false) + SealedClassInheritorsProviderImpl.computeSealedSubclasses(this, freedomForSealedInterfacesSupported = false) } private val declaredTypeParametersAndTypeParameterResolver = targetComponents.storageManager.createLazyValue { From 1c9f9130e6e16fd1330d042347eee2aff3d8c8ee Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Tue, 24 Nov 2020 12:24:50 +0300 Subject: [PATCH 562/698] [FE] Prohibit implementing java sealed classes --- .../ClassInheritsJavaSealedClassChecker.kt | 30 +++++++++++++++++++ .../jvm/platform/JvmPlatformConfigurator.kt | 3 +- .../jetbrains/kotlin/diagnostics/Errors.java | 1 + .../rendering/DefaultErrorMessages.java | 1 + .../sealedClasses/kotlinInheritsJavaClass.kt | 11 +++++++ .../sealedClasses/kotlinInheritsJavaClass.txt | 22 ++++++++++++++ .../kotlinInheritsJavaInterface.kt | 11 +++++++ .../kotlinInheritsJavaInterface.txt | 21 +++++++++++++ 8 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/ClassInheritsJavaSealedClassChecker.kt create mode 100644 compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaClass.kt create mode 100644 compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaClass.txt create mode 100644 compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaInterface.kt create mode 100644 compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaInterface.txt diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/ClassInheritsJavaSealedClassChecker.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/ClassInheritsJavaSealedClassChecker.kt new file mode 100644 index 00000000000..fb95e10f266 --- /dev/null +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/ClassInheritsJavaSealedClassChecker.kt @@ -0,0 +1,30 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.resolve.jvm.checkers + +import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.descriptors.DeclarationDescriptor +import org.jetbrains.kotlin.diagnostics.Errors +import org.jetbrains.kotlin.load.java.lazy.descriptors.LazyJavaClassDescriptor +import org.jetbrains.kotlin.psi.KtClassOrObject +import org.jetbrains.kotlin.psi.KtDeclaration +import org.jetbrains.kotlin.resolve.bindingContextUtil.getAbbreviatedTypeOrType +import org.jetbrains.kotlin.resolve.checkers.DeclarationChecker +import org.jetbrains.kotlin.resolve.checkers.DeclarationCheckerContext + +object ClassInheritsJavaSealedClassChecker : DeclarationChecker { + override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) { + if (descriptor !is ClassDescriptor || declaration !is KtClassOrObject) return + for (superTypeListEntry in declaration.superTypeListEntries) { + val typeReference = superTypeListEntry.typeReference ?: continue + val superType = typeReference.getAbbreviatedTypeOrType(context.trace.bindingContext)?.unwrap() ?: continue + val superClass = superType.constructor.declarationDescriptor as? LazyJavaClassDescriptor ?: continue + if (superClass.jClass.isSealed) { + context.trace.report(Errors.CLASS_INHERITS_JAVA_SEALED_CLASS.on(typeReference)) + } + } + } +} diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/platform/JvmPlatformConfigurator.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/platform/JvmPlatformConfigurator.kt index 3f4fe948f76..9c0addcdca7 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/platform/JvmPlatformConfigurator.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/platform/JvmPlatformConfigurator.kt @@ -41,7 +41,8 @@ object JvmPlatformConfigurator : PlatformConfiguratorBase( JvmMultifileClassStateChecker, SynchronizedOnInlineMethodChecker, DefaultCheckerInTailrec, - FunctionDelegateMemberNameClashChecker + FunctionDelegateMemberNameClashChecker, + ClassInheritsJavaSealedClassChecker ), additionalCallCheckers = listOf( diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index 3cb26257efd..7daa75e5199 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -427,6 +427,7 @@ public interface Errors { DiagnosticFactory0 SEALED_SUPERTYPE = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 SEALED_SUPERTYPE_IN_LOCAL_CLASS = DiagnosticFactory0.create(ERROR); DiagnosticFactory2 SEALED_INHERITOR_IN_DIFFERENT_PACKAGE = DiagnosticFactory2.create(ERROR); + DiagnosticFactory0 CLASS_INHERITS_JAVA_SEALED_CLASS = DiagnosticFactory0.create(ERROR); // Companion objects diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index c6d18ba488d..330b13fc9ed 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -634,6 +634,7 @@ public class DefaultErrorMessages { MAP.put(SEALED_SUPERTYPE, "This type is sealed, so it can be inherited by only its own nested classes or objects"); MAP.put(SEALED_SUPERTYPE_IN_LOCAL_CLASS, "Local class cannot extend a sealed class"); MAP.put(SEALED_INHERITOR_IN_DIFFERENT_PACKAGE, "Inheritor of sealed class or interface declared in package {1} but it must be in package {2} where base class is declared", TO_STRING, TO_STRING); + MAP.put(CLASS_INHERITS_JAVA_SEALED_CLASS, "Inheritance of java sealed classes is prohibited"); MAP.put(SINGLETON_IN_SUPERTYPE, "Cannot inherit from a singleton"); MAP.put(CLASS_CANNOT_BE_EXTENDED_DIRECTLY, "Class {0} cannot be extended directly", NAME); diff --git a/compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaClass.kt b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaClass.kt new file mode 100644 index 00000000000..3c2e16a6c76 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaClass.kt @@ -0,0 +1,11 @@ +// ISSUE: KT-41215 + +// FILE: Base.java +public sealed class Base permits A, B {} + +// FILE: A.java +public final class A extends Base {} + +// FILE: B.kt + +class B : Base() diff --git a/compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaClass.txt b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaClass.txt new file mode 100644 index 00000000000..0b902f9c44b --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaClass.txt @@ -0,0 +1,22 @@ +package + +public final class A : Base { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class B : Base { + public constructor B() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public sealed class Base { + public constructor Base() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaInterface.kt b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaInterface.kt new file mode 100644 index 00000000000..ab37a583b01 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaInterface.kt @@ -0,0 +1,11 @@ +// ISSUE: KT-41215 + +// FILE: Base.java +public sealed interface Base permits A, B {} + +// FILE: A.java +public final class A extends Base {} + +// FILE: B.kt + +class B : Base diff --git a/compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaInterface.txt b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaInterface.txt new file mode 100644 index 00000000000..5e98dbfb22d --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaInterface.txt @@ -0,0 +1,21 @@ +package + +public final class A : Base { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class B : Base { + public constructor B() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public sealed interface Base { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} From f8d6f79c177179c9025adf421357169ced22f4db Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Tue, 24 Nov 2020 12:30:37 +0300 Subject: [PATCH 563/698] [FE] Temporary disable exhaustiveness checker for java sealed classes KT-43551 KT-41215 --- .../sealedClasses/javaSealedClassExhaustiveness.kt | 4 ++-- .../sealedClasses/javaSealedClassExhaustiveness.txt | 4 ++-- .../sealedClasses/javaSealedInterfaceExhaustiveness.kt | 4 ++-- .../sealedClasses/javaSealedInterfaceExhaustiveness.txt | 4 ++-- .../testsWithJava15/sealedClasses/kotlinInheritsJavaClass.txt | 2 +- .../sealedClasses/kotlinInheritsJavaInterface.txt | 2 +- .../load/java/lazy/descriptors/LazyJavaClassDescriptor.kt | 3 ++- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedClassExhaustiveness.kt b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedClassExhaustiveness.kt index 0ae9771eb1f..6bd8769c2bd 100644 --- a/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedClassExhaustiveness.kt +++ b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedClassExhaustiveness.kt @@ -16,14 +16,14 @@ public sealed class B extends Base permits B.C, B.D { // FILE: main.kt fun test_ok_1(base: Base) { - val x = when (base) { + val x = when (base) { is A -> 1 is B -> 2 } } fun test_ok_2(base: Base) { - val x = when (base) { + val x = when (base) { is A -> 1 is B.C -> 2 is B.D -> 3 diff --git a/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedClassExhaustiveness.txt b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedClassExhaustiveness.txt index 8d90f4c6fcf..5a14a0617b1 100644 --- a/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedClassExhaustiveness.txt +++ b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedClassExhaustiveness.txt @@ -12,7 +12,7 @@ public final class A : Base { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public sealed class B : Base { +public abstract class B : Base { public constructor B() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int @@ -33,7 +33,7 @@ public sealed class B : Base { } } -public sealed class Base { +public abstract class Base { public constructor Base() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedInterfaceExhaustiveness.kt b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedInterfaceExhaustiveness.kt index 3419f18de62..47af93f24e0 100644 --- a/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedInterfaceExhaustiveness.kt +++ b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedInterfaceExhaustiveness.kt @@ -21,7 +21,7 @@ public enum E implements Base { // FILE: main.kt fun test_ok_1(base: Base) { - val x = when (base) { + val x = when (base) { is A -> 1 is B -> 2 is E -> 3 @@ -29,7 +29,7 @@ fun test_ok_1(base: Base) { } fun test_ok_2(base: Base) { - val x = when (base) { + val x = when (base) { is A -> 1 is B.C -> 2 is B.D -> 3 diff --git a/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedInterfaceExhaustiveness.txt b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedInterfaceExhaustiveness.txt index 6b88bec8277..fc87a4c379d 100644 --- a/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedInterfaceExhaustiveness.txt +++ b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedInterfaceExhaustiveness.txt @@ -12,7 +12,7 @@ public interface A : Base { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public sealed interface B : Base { +public interface B : Base { public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String @@ -31,7 +31,7 @@ public sealed interface B : Base { } } -public sealed interface Base { +public interface Base { public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String diff --git a/compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaClass.txt b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaClass.txt index 0b902f9c44b..707ef3816da 100644 --- a/compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaClass.txt +++ b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaClass.txt @@ -14,7 +14,7 @@ public final class B : Base { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public sealed class Base { +public abstract class Base { public constructor Base() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaInterface.txt b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaInterface.txt index 5e98dbfb22d..cf566afb543 100644 --- a/compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaInterface.txt +++ b/compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaInterface.txt @@ -14,7 +14,7 @@ public final class B : Base { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public sealed interface Base { +public interface Base { public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String diff --git a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt index 42688fbb51f..233bf329a67 100644 --- a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt +++ b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt @@ -76,7 +76,8 @@ class LazyJavaClassDescriptor( private val modality = if (jClass.isAnnotationType || jClass.isEnum) Modality.FINAL - else Modality.convertFromFlags(jClass.isSealed, jClass.isAbstract || jClass.isInterface, !jClass.isFinal) + // TODO: replace false with jClass.isSealed when it will be properly supported in platform + else Modality.convertFromFlags(sealed = false, jClass.isSealed || jClass.isAbstract || jClass.isInterface, !jClass.isFinal) private val visibility = jClass.visibility private val isInner = jClass.outerClass != null && !jClass.isStatic From 57a081c3990a4518e11efa63626bcbc471b64b0b Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Tue, 24 Nov 2020 14:42:10 +0300 Subject: [PATCH 564/698] [FE] Prohibit inheritance of sealed classes in different module KT-20423 --- ...irOldFrontendDiagnosticsTestGenerated.java | 10 ++++++ .../jetbrains/kotlin/diagnostics/Errors.java | 1 + .../rendering/DefaultErrorMessages.java | 1 + .../resolve/PlatformConfiguratorBase.kt | 1 + .../SealedInheritorInSameModuleChecker.kt | 30 +++++++++++++++++ .../library/base.kt | 7 ++++ .../sealedInheritorInDifferentModule/main.kt | 5 +++ .../output.txt | 20 +++++++++++ .../sealed/inheritorInDifferentModule.fir.kt | 17 ++++++++++ .../sealed/inheritorInDifferentModule.kt | 17 ++++++++++ .../sealed/inheritorInDifferentModule.txt | 33 +++++++++++++++++++ .../inheritorInDifferentModule.fir.kt | 17 ++++++++++ .../interfaces/inheritorInDifferentModule.kt | 17 ++++++++++ .../interfaces/inheritorInDifferentModule.txt | 30 +++++++++++++++++ .../checkers/DiagnosticsTestGenerated.java | 10 ++++++ .../DiagnosticsUsingJavacTestGenerated.java | 10 ++++++ .../CompileKotlinAgainstCustomBinariesTest.kt | 6 ++++ 17 files changed, 232 insertions(+) create mode 100644 compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/SealedInheritorInSameModuleChecker.kt create mode 100644 compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/library/base.kt create mode 100644 compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/main.kt create mode 100644 compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/output.txt create mode 100644 compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.fir.kt create mode 100644 compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.kt create mode 100644 compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.txt create mode 100644 compiler/testData/diagnostics/tests/sealed/interfaces/inheritorInDifferentModule.fir.kt create mode 100644 compiler/testData/diagnostics/tests/sealed/interfaces/inheritorInDifferentModule.kt create mode 100644 compiler/testData/diagnostics/tests/sealed/interfaces/inheritorInDifferentModule.txt diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java index 16395f5f8a4..5eadec45ee5 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java @@ -20773,6 +20773,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte runTest("compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.kt"); } + @TestMetadata("inheritorInDifferentModule.kt") + public void testInheritorInDifferentModule() throws Exception { + runTest("compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.kt"); + } + @TestMetadata("Local.kt") public void testLocal() throws Exception { runTest("compiler/testData/diagnostics/tests/sealed/Local.kt"); @@ -20910,6 +20915,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/sealed/interfaces"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } + @TestMetadata("inheritorInDifferentModule.kt") + public void testInheritorInDifferentModule() throws Exception { + runTest("compiler/testData/diagnostics/tests/sealed/interfaces/inheritorInDifferentModule.kt"); + } + @TestMetadata("sealedInterfacesDisabled.kt") public void testSealedInterfacesDisabled() throws Exception { runTest("compiler/testData/diagnostics/tests/sealed/interfaces/sealedInterfacesDisabled.kt"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index 7daa75e5199..3fcbcc93663 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -427,6 +427,7 @@ public interface Errors { DiagnosticFactory0 SEALED_SUPERTYPE = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 SEALED_SUPERTYPE_IN_LOCAL_CLASS = DiagnosticFactory0.create(ERROR); DiagnosticFactory2 SEALED_INHERITOR_IN_DIFFERENT_PACKAGE = DiagnosticFactory2.create(ERROR); + DiagnosticFactory0 SEALED_INHERITOR_IN_DIFFERENT_MODULE = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 CLASS_INHERITS_JAVA_SEALED_CLASS = DiagnosticFactory0.create(ERROR); // Companion objects diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index 330b13fc9ed..254ffeef805 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -634,6 +634,7 @@ public class DefaultErrorMessages { MAP.put(SEALED_SUPERTYPE, "This type is sealed, so it can be inherited by only its own nested classes or objects"); MAP.put(SEALED_SUPERTYPE_IN_LOCAL_CLASS, "Local class cannot extend a sealed class"); MAP.put(SEALED_INHERITOR_IN_DIFFERENT_PACKAGE, "Inheritor of sealed class or interface declared in package {1} but it must be in package {2} where base class is declared", TO_STRING, TO_STRING); + MAP.put(SEALED_INHERITOR_IN_DIFFERENT_MODULE, "Inheritance of sealed classes or interfaces from different module is prohibited"); MAP.put(CLASS_INHERITS_JAVA_SEALED_CLASS, "Inheritance of java sealed classes is prohibited"); MAP.put(SINGLETON_IN_SUPERTYPE, "Cannot inherit from a singleton"); MAP.put(CLASS_CANNOT_BE_EXTENDED_DIRECTLY, "Class {0} cannot be extended directly", NAME); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt index 43734e9792a..746e376885f 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt @@ -42,6 +42,7 @@ private val DEFAULT_DECLARATION_CHECKERS = listOf( ContractDescriptionBlockChecker, PrivateInlineFunctionsReturningAnonymousObjectsChecker, SealedInheritorInSamePackageChecker, + SealedInheritorInSameModuleChecker, SealedInterfaceAllowedChecker, ) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/SealedInheritorInSameModuleChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/SealedInheritorInSameModuleChecker.kt new file mode 100644 index 00000000000..1e0d55233ad --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/SealedInheritorInSameModuleChecker.kt @@ -0,0 +1,30 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.resolve.checkers + +import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.descriptors.DeclarationDescriptor +import org.jetbrains.kotlin.descriptors.isSealed +import org.jetbrains.kotlin.diagnostics.Errors +import org.jetbrains.kotlin.psi.KtClassOrObject +import org.jetbrains.kotlin.psi.KtDeclaration +import org.jetbrains.kotlin.resolve.bindingContextUtil.getAbbreviatedTypeOrType +import org.jetbrains.kotlin.resolve.descriptorUtil.module + +object SealedInheritorInSameModuleChecker : DeclarationChecker { + override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) { + if (descriptor !is ClassDescriptor || declaration !is KtClassOrObject) return + val currentModule = descriptor.module + for (superTypeListEntry in declaration.superTypeListEntries) { + val typeReference = superTypeListEntry.typeReference ?: continue + val superType = typeReference.getAbbreviatedTypeOrType(context.trace.bindingContext)?.unwrap() ?: continue + val superClass = superType.constructor.declarationDescriptor ?: continue + if (superClass.isSealed() && superClass.module != currentModule) { + context.trace.report(Errors.SEALED_INHERITOR_IN_DIFFERENT_MODULE.on(typeReference)) + } + } + } +} diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/library/base.kt b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/library/base.kt new file mode 100644 index 00000000000..54b4f44da1b --- /dev/null +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/library/base.kt @@ -0,0 +1,7 @@ +package a + +sealed class Base + +sealed interface IBase + +class A : Base(), IBase diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/main.kt b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/main.kt new file mode 100644 index 00000000000..8558dd31d47 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/main.kt @@ -0,0 +1,5 @@ +// ISSUE: KT-20423 + +package a + +class B : Base(), IBase diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/output.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/output.txt new file mode 100644 index 00000000000..4f0b6da9911 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/output.txt @@ -0,0 +1,20 @@ +warning: ATTENTION! +This build uses unsafe internal compiler arguments: + +-XXLanguage:+FreedomForSealedClasses +-XXLanguage:+SealedInterfaces + +This mode is not recommended for production use, +as no stability/compatibility guarantees are given on +compiler or generated code. Use it at your own risk! + +compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/main.kt:5:11: error: cannot access '': it is internal in 'Base' +class B : Base(), IBase + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/main.kt:5:11: error: inheritance of sealed classes or interfaces from different module is prohibited +class B : Base(), IBase + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/main.kt:5:19: error: inheritance of sealed classes or interfaces from different module is prohibited +class B : Base(), IBase + ^ +COMPILATION_ERROR diff --git a/compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.fir.kt b/compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.fir.kt new file mode 100644 index 00000000000..4587f2142b4 --- /dev/null +++ b/compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.fir.kt @@ -0,0 +1,17 @@ +// ISSUE: KT-20423 +// !LANGUAGE: +SealedInterfaces +FreedomForSealedClasses + +// MODULE: m1 +// FILE: a.kt +package a + +sealed class Base + +class A : Base() + +// MODULE: m2(m1) +// FILE: b.kt + +package a + +class B : Base() diff --git a/compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.kt b/compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.kt new file mode 100644 index 00000000000..44736417247 --- /dev/null +++ b/compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.kt @@ -0,0 +1,17 @@ +// ISSUE: KT-20423 +// !LANGUAGE: +SealedInterfaces +FreedomForSealedClasses + +// MODULE: m1 +// FILE: a.kt +package a + +sealed class Base + +class A : Base() + +// MODULE: m2(m1) +// FILE: b.kt + +package a + +class B : Base() diff --git a/compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.txt b/compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.txt new file mode 100644 index 00000000000..f6c493cc02d --- /dev/null +++ b/compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.txt @@ -0,0 +1,33 @@ +// -- Module: -- +package + +package a { + + public final class A : a.Base { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public sealed class Base { + internal constructor Base() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + + +// -- Module: -- +package + +package a { + + public final class B : a.Base { + public constructor B() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/tests/sealed/interfaces/inheritorInDifferentModule.fir.kt b/compiler/testData/diagnostics/tests/sealed/interfaces/inheritorInDifferentModule.fir.kt new file mode 100644 index 00000000000..6ef6ef701ac --- /dev/null +++ b/compiler/testData/diagnostics/tests/sealed/interfaces/inheritorInDifferentModule.fir.kt @@ -0,0 +1,17 @@ +// ISSUE: KT-20423 +// !LANGUAGE: +SealedInterfaces +FreedomForSealedClasses + +// MODULE: m1 +// FILE: a.kt +package a + +sealed interface Base + +interface A : Base + +// MODULE: m2(m1) +// FILE: b.kt + +package a + +interface B : Base diff --git a/compiler/testData/diagnostics/tests/sealed/interfaces/inheritorInDifferentModule.kt b/compiler/testData/diagnostics/tests/sealed/interfaces/inheritorInDifferentModule.kt new file mode 100644 index 00000000000..4074595d4c3 --- /dev/null +++ b/compiler/testData/diagnostics/tests/sealed/interfaces/inheritorInDifferentModule.kt @@ -0,0 +1,17 @@ +// ISSUE: KT-20423 +// !LANGUAGE: +SealedInterfaces +FreedomForSealedClasses + +// MODULE: m1 +// FILE: a.kt +package a + +sealed interface Base + +interface A : Base + +// MODULE: m2(m1) +// FILE: b.kt + +package a + +interface B : Base diff --git a/compiler/testData/diagnostics/tests/sealed/interfaces/inheritorInDifferentModule.txt b/compiler/testData/diagnostics/tests/sealed/interfaces/inheritorInDifferentModule.txt new file mode 100644 index 00000000000..8d6d9f86841 --- /dev/null +++ b/compiler/testData/diagnostics/tests/sealed/interfaces/inheritorInDifferentModule.txt @@ -0,0 +1,30 @@ +// -- Module: -- +package + +package a { + + public interface A : a.Base { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public sealed interface Base { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + + +// -- Module: -- +package + +package a { + + public interface B : a.Base { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 04fa8c6fbbc..c2d9b7057ba 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -20850,6 +20850,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali runTest("compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.kt"); } + @TestMetadata("inheritorInDifferentModule.kt") + public void testInheritorInDifferentModule() throws Exception { + runTest("compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.kt"); + } + @TestMetadata("Local.kt") public void testLocal() throws Exception { runTest("compiler/testData/diagnostics/tests/sealed/Local.kt"); @@ -20987,6 +20992,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/sealed/interfaces"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } + @TestMetadata("inheritorInDifferentModule.kt") + public void testInheritorInDifferentModule() throws Exception { + runTest("compiler/testData/diagnostics/tests/sealed/interfaces/inheritorInDifferentModule.kt"); + } + @TestMetadata("sealedInterfacesDisabled.kt") public void testSealedInterfacesDisabled() throws Exception { runTest("compiler/testData/diagnostics/tests/sealed/interfaces/sealedInterfacesDisabled.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java index 44bf9026e50..c48401eb6d1 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java @@ -20775,6 +20775,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing runTest("compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.kt"); } + @TestMetadata("inheritorInDifferentModule.kt") + public void testInheritorInDifferentModule() throws Exception { + runTest("compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.kt"); + } + @TestMetadata("Local.kt") public void testLocal() throws Exception { runTest("compiler/testData/diagnostics/tests/sealed/Local.kt"); @@ -20912,6 +20917,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/sealed/interfaces"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } + @TestMetadata("inheritorInDifferentModule.kt") + public void testInheritorInDifferentModule() throws Exception { + runTest("compiler/testData/diagnostics/tests/sealed/interfaces/inheritorInDifferentModule.kt"); + } + @TestMetadata("sealedInterfacesDisabled.kt") public void testSealedInterfacesDisabled() throws Exception { runTest("compiler/testData/diagnostics/tests/sealed/interfaces/sealedInterfacesDisabled.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt index 64626e8ce3c..c72ba064348 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt @@ -700,6 +700,12 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration compileKotlin("main.kt", tmpdir, listOf(library), additionalOptions = features) } + fun testSealedInheritorInDifferentModule() { + val features = listOf("-XXLanguage:+FreedomForSealedClasses", "-XXLanguage:+SealedInterfaces") + val library = compileLibrary("library", additionalOptions = features, checkKotlinOutput = {}) + compileKotlin("main.kt", tmpdir, listOf(library), additionalOptions = features) + } + // If this test fails, then bootstrap compiler most likely should be advanced fun testPreReleaseFlagIsConsistentBetweenBootstrapAndCurrentCompiler() { val bootstrapCompiler = JarFile(PathUtil.kotlinPathsForCompiler.compilerPath) From 3246e6b9ac2a44c6af1578f84d0ab64c209034ec Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Mon, 23 Nov 2020 12:38:55 +0300 Subject: [PATCH 565/698] [IC] Add ability to pass additional compiler args to IC tests Additional arguments should be declared in `args.txt` file in test directory in common CLI arguments format --- .../build.gradle.kts | 2 ++ ...stractIncrementalCompilerRunnerTestBase.kt | 22 ++++++++++++-- .../jps/build/AbstractIncrementalJpsTest.kt | 30 +++++++++++++++++-- .../build/AbstractIncrementalJpsTest.kt.201 | 25 +++++++++++++++- 4 files changed, 73 insertions(+), 6 deletions(-) diff --git a/compiler/incremental-compilation-impl/build.gradle.kts b/compiler/incremental-compilation-impl/build.gradle.kts index 6f44c1e3b85..b22008cb49c 100644 --- a/compiler/incremental-compilation-impl/build.gradle.kts +++ b/compiler/incremental-compilation-impl/build.gradle.kts @@ -24,6 +24,8 @@ dependencies { testCompile(projectTests(":compiler:tests-common")) testCompile(intellijCoreDep()) { includeJars("intellij-core") } testCompile(intellijDep()) { includeJars("log4j", "jdom") } + testRuntime(project(":kotlin-reflect")) + testRuntime(project(":core:descriptors.runtime")) if (Platform.P192.orHigher()) { testRuntime(intellijDep()) { includeJars("lz4-java", rootProject = rootProject) } diff --git a/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/AbstractIncrementalCompilerRunnerTestBase.kt b/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/AbstractIncrementalCompilerRunnerTestBase.kt index 0d2fba1cef3..c80bd2a3851 100644 --- a/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/AbstractIncrementalCompilerRunnerTestBase.kt +++ b/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/AbstractIncrementalCompilerRunnerTestBase.kt @@ -19,6 +19,7 @@ package org.jetbrains.kotlin.incremental import org.jetbrains.kotlin.TestWithWorkingDir import org.jetbrains.kotlin.cli.common.ExitCode import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments +import org.jetbrains.kotlin.cli.common.arguments.parseCommandLineArguments import org.jetbrains.kotlin.incremental.testingUtils.* import org.jetbrains.kotlin.incremental.utils.TestCompilationResult import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase @@ -28,6 +29,10 @@ import java.io.File abstract class AbstractIncrementalCompilerRunnerTestBase : TestWithWorkingDir() { protected abstract fun createCompilerArguments(destinationDir: File, testDir: File): Args + private fun createCompilerArgumentsImpl(destinationDir: File, testDir: File): Args = createCompilerArguments(destinationDir, testDir).apply { + parseCommandLineArguments(parseAdditionalArgs(testDir), this) + } + fun doTest(path: String) { val testDir = File(path) @@ -40,7 +45,7 @@ abstract class AbstractIncrementalCompilerRunnerTestBase { + return File(testDir, ARGUMENTS_FILE_NAME) + .takeIf { it.exists() } + ?.readText() + ?.split(" ", "\n") + ?.filter { it.isNotBlank() } + ?: emptyList() + } } -} \ No newline at end of file +} diff --git a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt index d3b89fa9b2f..9d1c9816369 100644 --- a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt +++ b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt @@ -15,7 +15,6 @@ */ package org.jetbrains.kotlin.jps.build - import com.intellij.openapi.Disposable import com.intellij.openapi.util.Disposer import com.intellij.openapi.util.io.FileUtil @@ -43,15 +42,22 @@ import org.jetbrains.jps.model.JpsModuleRootModificationUtil import org.jetbrains.jps.model.java.JpsJavaExtensionService import org.jetbrains.jps.model.library.sdk.JpsSdk import org.jetbrains.jps.util.JpsPathUtil +import org.jetbrains.kotlin.cli.common.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY +import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments import org.jetbrains.kotlin.cli.common.arguments.K2MetadataCompilerArguments +import org.jetbrains.kotlin.cli.common.arguments.parseCommandLineArguments import org.jetbrains.kotlin.incremental.LookupSymbol import org.jetbrains.kotlin.incremental.testingUtils.* import org.jetbrains.kotlin.jps.build.dependeciestxt.ModulesTxt import org.jetbrains.kotlin.jps.build.dependeciestxt.ModulesTxtBuilder import org.jetbrains.kotlin.jps.build.fixtures.EnableICFixture -import org.jetbrains.kotlin.jps.incremental.* +import org.jetbrains.kotlin.jps.incremental.CacheAttributesDiff +import org.jetbrains.kotlin.jps.incremental.CacheVersionManager +import org.jetbrains.kotlin.jps.incremental.CompositeLookupsCacheAttributesManager +import org.jetbrains.kotlin.jps.incremental.getKotlinCache import org.jetbrains.kotlin.jps.model.JpsKotlinFacetModuleExtension +import org.jetbrains.kotlin.jps.model.kotlinCommonCompilerArguments import org.jetbrains.kotlin.jps.model.kotlinFacet import org.jetbrains.kotlin.jps.targets.KotlinModuleBuildTarget import org.jetbrains.kotlin.platform.idePlatformKind @@ -77,11 +83,23 @@ abstract class AbstractIncrementalJpsTest( private val TEMP_DIRECTORY_TO_USE = File(FileUtilRt.getTempDirectory()) private val DEBUG_LOGGING_ENABLED = System.getProperty("debug.logging.enabled") == "true" + + private const val ARGUMENTS_FILE_NAME = "args.txt" + + private fun parseAdditionalArgs(testDir: File): List { + return File(testDir, ARGUMENTS_FILE_NAME) + .takeIf { it.exists() } + ?.readText() + ?.split(" ", "\n") + ?.filter { it.isNotBlank() } + ?: emptyList() + } } protected lateinit var testDataDir: File protected lateinit var workDir: File protected lateinit var projectDescriptor: ProjectDescriptor + protected lateinit var additionalCommandLineArguments: List // is used to compare lookup dumps in a human readable way (lookup symbols are hashed in an actual lookup storage) protected lateinit var lookupsDuringTest: MutableSet private var isJvmICEnabledBackup: Boolean = false @@ -175,6 +193,9 @@ abstract class AbstractIncrementalJpsTest( val buildResult = BuildResult() builder.addMessageHandler(buildResult) val finalScope = scope.build() + projectDescriptor.project.kotlinCommonCompilerArguments = projectDescriptor.project.kotlinCommonCompilerArguments.apply { + updateCommandLineArguments(this) + } builder.build(finalScope, false) @@ -231,6 +252,10 @@ abstract class AbstractIncrementalJpsTest( return build(null, CompileScopeTestBuilder.rebuild().allModules()) } + private fun updateCommandLineArguments(arguments: CommonCompilerArguments) { + parseCommandLineArguments(additionalCommandLineArguments, arguments) + } + private fun rebuildAndCheckOutput(makeOverallResult: MakeResult) { val outDir = File(getAbsolutePath("out")) val outAfterMake = File(getAbsolutePath("out-after-make")) @@ -299,6 +324,7 @@ abstract class AbstractIncrementalJpsTest( protected open fun doTest(testDataPath: String) { testDataDir = File(testDataPath) workDir = FileUtilRt.createTempDirectory(TEMP_DIRECTORY_TO_USE, "aijt-jps-build", null) + additionalCommandLineArguments = parseAdditionalArgs(File(testDataPath)) val buildLogFile = buildLogFinder.findBuildLog(testDataDir) Disposer.register(testRootDisposable, Disposable { FileUtilRt.delete(workDir) }) diff --git a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt.201 b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt.201 index 1d20b2e2a4d..94af68daeef 100644 --- a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt.201 +++ b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt.201 @@ -15,7 +15,6 @@ */ package org.jetbrains.kotlin.jps.build - import com.intellij.openapi.Disposable import com.intellij.openapi.util.Disposer import com.intellij.openapi.util.io.FileUtil @@ -43,8 +42,11 @@ import org.jetbrains.jps.model.JpsModuleRootModificationUtil import org.jetbrains.jps.model.java.JpsJavaExtensionService import org.jetbrains.jps.model.library.sdk.JpsSdk import org.jetbrains.jps.util.JpsPathUtil +import org.jetbrains.kotlin.cli.common.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY +import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments import org.jetbrains.kotlin.cli.common.arguments.K2MetadataCompilerArguments +import org.jetbrains.kotlin.cli.common.arguments.parseCommandLineArguments import org.jetbrains.kotlin.incremental.LookupSymbol import org.jetbrains.kotlin.incremental.testingUtils.* import org.jetbrains.kotlin.jps.build.dependeciestxt.ModulesTxt @@ -52,6 +54,7 @@ import org.jetbrains.kotlin.jps.build.dependeciestxt.ModulesTxtBuilder import org.jetbrains.kotlin.jps.build.fixtures.EnableICFixture import org.jetbrains.kotlin.jps.incremental.* import org.jetbrains.kotlin.jps.model.JpsKotlinFacetModuleExtension +import org.jetbrains.kotlin.jps.model.kotlinCommonCompilerArguments import org.jetbrains.kotlin.jps.model.kotlinFacet import org.jetbrains.kotlin.jps.targets.KotlinModuleBuildTarget import org.jetbrains.kotlin.platform.idePlatformKind @@ -77,11 +80,23 @@ abstract class AbstractIncrementalJpsTest( private val TEMP_DIRECTORY_TO_USE = File(FileUtilRt.getTempDirectory()) private val DEBUG_LOGGING_ENABLED = System.getProperty("debug.logging.enabled") == "true" + + private const val ARGUMENTS_FILE_NAME = "args.txt" + + private fun parseAdditionalArgs(testDir: File): List { + return File(testDir, ARGUMENTS_FILE_NAME) + .takeIf { it.exists() } + ?.readText() + ?.split(" ", "\n") + ?.filter { it.isNotBlank() } + ?: emptyList() + } } protected lateinit var testDataDir: File protected lateinit var workDir: File protected lateinit var projectDescriptor: ProjectDescriptor + protected lateinit var additionalCommandLineArguments: List // is used to compare lookup dumps in a human readable way (lookup symbols are hashed in an actual lookup storage) protected lateinit var lookupsDuringTest: MutableSet private var isJvmICEnabledBackup: Boolean = false @@ -176,6 +191,9 @@ abstract class AbstractIncrementalJpsTest( val buildResult = BuildResult() builder.addMessageHandler(buildResult) val finalScope = scope.build() + projectDescriptor.project.kotlinCommonCompilerArguments = projectDescriptor.project.kotlinCommonCompilerArguments.apply { + updateCommandLineArguments(this) + } builder.build(finalScope, false) @@ -232,6 +250,10 @@ abstract class AbstractIncrementalJpsTest( return build(null, CompileScopeTestBuilder.rebuild().allModules()) } + private fun updateCommandLineArguments(arguments: CommonCompilerArguments) { + parseCommandLineArguments(additionalCommandLineArguments, arguments) + } + private fun rebuildAndCheckOutput(makeOverallResult: MakeResult) { val outDir = File(getAbsolutePath("out")) val outAfterMake = File(getAbsolutePath("out-after-make")) @@ -300,6 +322,7 @@ abstract class AbstractIncrementalJpsTest( protected open fun doTest(testDataPath: String) { testDataDir = File(testDataPath) workDir = FileUtilRt.createTempDirectory(TEMP_DIRECTORY_TO_USE, "aijt-jps-build", null) + additionalCommandLineArguments = parseAdditionalArgs(File(testDataPath)) val buildLogFile = buildLogFinder.findBuildLog(testDataDir) Disposer.register(testRootDisposable, Disposable { FileUtilRt.delete(workDir) }) From 77aad06008de05c8e9e990a6aad3704bae3b7ec7 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Mon, 30 Nov 2020 12:27:15 +0300 Subject: [PATCH 566/698] [FE] Add bunch files to fix compilation on 201 platform --- .../java/structure/impl/JavaClassImpl.kt.201 | 6 + .../structure/impl/JavaElementUtil.java.201 | 113 ++++++++++++++++++ .../impl/classFiles/BinaryJavaClass.kt.201 | 2 + 3 files changed, 121 insertions(+) create mode 100644 compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaElementUtil.java.201 diff --git a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt.201 b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt.201 index 345cf8ac9c7..cb79b6d81b2 100644 --- a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt.201 +++ b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt.201 @@ -62,6 +62,12 @@ class JavaClassImpl(psiClass: PsiClass) : JavaClassifierImpl(psiClass) override val isRecord: Boolean get() = false + override val isSealed: Boolean + get() = JavaElementUtil.isSealed(this) + + override val permittedTypes: Collection + get() = emptyList() + override val outerClass: JavaClassImpl? get() { val outer = psi.containingClass diff --git a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaElementUtil.java.201 b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaElementUtil.java.201 new file mode 100644 index 00000000000..9696b156fd9 --- /dev/null +++ b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaElementUtil.java.201 @@ -0,0 +1,113 @@ +/* + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.load.java.structure.impl; + +import com.intellij.codeInsight.ExternalAnnotationsManager; +import com.intellij.psi.PsiAnnotation; +import com.intellij.psi.PsiAnnotationOwner; +import com.intellij.psi.PsiModifier; +import com.intellij.psi.PsiModifierListOwner; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.kotlin.descriptors.Visibilities; +import org.jetbrains.kotlin.descriptors.Visibility; +import org.jetbrains.kotlin.descriptors.java.JavaVisibilities; +import org.jetbrains.kotlin.load.java.structure.JavaAnnotation; +import org.jetbrains.kotlin.name.FqName; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; + +import static org.jetbrains.kotlin.load.java.structure.impl.JavaElementCollectionFromPsiArrayUtil.annotations; +import static org.jetbrains.kotlin.load.java.structure.impl.JavaElementCollectionFromPsiArrayUtil.nullabilityAnnotations; + +/* package */ class JavaElementUtil { + private JavaElementUtil() { + } + + public static boolean isAbstract(@NotNull JavaModifierListOwnerImpl owner) { + return owner.getPsi().hasModifierProperty(PsiModifier.ABSTRACT); + } + + public static boolean isStatic(@NotNull JavaModifierListOwnerImpl owner) { + return owner.getPsi().hasModifierProperty(PsiModifier.STATIC); + } + + public static boolean isFinal(@NotNull JavaModifierListOwnerImpl owner) { + return owner.getPsi().hasModifierProperty(PsiModifier.FINAL); + } + + public static boolean isSealed(@NotNull JavaModifierListOwnerImpl owner) { + return false; + } + + @NotNull + public static Visibility getVisibility(@NotNull JavaModifierListOwnerImpl owner) { + PsiModifierListOwner psiOwner = owner.getPsi(); + if (psiOwner.hasModifierProperty(PsiModifier.PUBLIC)) { + return Visibilities.Public.INSTANCE; + } + if (psiOwner.hasModifierProperty(PsiModifier.PRIVATE)) { + return Visibilities.Private.INSTANCE; + } + if (psiOwner.hasModifierProperty(PsiModifier.PROTECTED)) { + return owner.isStatic() ? JavaVisibilities.ProtectedStaticVisibility.INSTANCE : JavaVisibilities.ProtectedAndPackage.INSTANCE; + } + return JavaVisibilities.PackageVisibility.INSTANCE; + } + + @NotNull + public static Collection getAnnotations(@NotNull JavaAnnotationOwnerImpl owner) { + PsiAnnotationOwner annotationOwnerPsi = owner.getAnnotationOwnerPsi(); + if (annotationOwnerPsi != null) { + return annotations(annotationOwnerPsi.getAnnotations()); + } + return Collections.emptyList(); + } + + @Nullable + private static PsiAnnotation[] getExternalAnnotations(@NotNull JavaModifierListOwnerImpl modifierListOwner) { + PsiModifierListOwner psiModifierListOwner = modifierListOwner.getPsi(); + ExternalAnnotationsManager externalAnnotationManager = ExternalAnnotationsManager + .getInstance(psiModifierListOwner.getProject()); + return externalAnnotationManager.findExternalAnnotations(psiModifierListOwner); + } + + @NotNull + static + Collection getRegularAndExternalAnnotations(@NotNull T owner) { + PsiAnnotation[] externalAnnotations = getExternalAnnotations(owner); + if (externalAnnotations == null) { + return getAnnotations(owner); + } + Collection annotations = new ArrayList<>(getAnnotations(owner)); + annotations.addAll(nullabilityAnnotations(externalAnnotations)); + return annotations; + } + + + @Nullable + public static JavaAnnotation findAnnotation(@NotNull JavaAnnotationOwnerImpl owner, @NotNull FqName fqName) { + PsiAnnotationOwner annotationOwnerPsi = owner.getAnnotationOwnerPsi(); + if (annotationOwnerPsi != null) { + PsiAnnotation psiAnnotation = annotationOwnerPsi.findAnnotation(fqName.asString()); + return psiAnnotation == null ? null : new JavaAnnotationImpl(psiAnnotation); + } + return null; + } +} diff --git a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/BinaryJavaClass.kt.201 b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/BinaryJavaClass.kt.201 index b2901f3c74e..2c38ac263ee 100644 --- a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/BinaryJavaClass.kt.201 +++ b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/BinaryJavaClass.kt.201 @@ -69,6 +69,8 @@ class BinaryJavaClass( override val isRecord get() = false override val lightClassOriginKind: LightClassOriginKind? get() = null + override val isSealed: Boolean get() = permittedTypes.isNotEmpty() + override val permittedTypes = arrayListOf() override fun isFromSourceCodeInScope(scope: SearchScope): Boolean = false From b6bd7c48f4e394cb18f01032152222f24ca5c4bb Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Tue, 1 Dec 2020 10:37:50 +0300 Subject: [PATCH 567/698] [FE] Rename FreedomForSealedClasses feature with more meaningful name --- .../src/org/jetbrains/kotlin/resolve/BodyResolver.java | 4 ++-- .../jetbrains/kotlin/resolve/FunctionDescriptorResolver.kt | 2 +- .../resolve/checkers/SealedInheritorInSamePackageChecker.kt | 2 +- .../kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java | 3 +-- compiler/testData/codegen/box/sealed/multipleFiles_enabled.kt | 2 +- .../sealedClassesAndInterfaces/output.txt | 2 +- .../sealedInheritorInDifferentModule/output.txt | 2 +- .../diagnostics/tests/sealed/ExhaustiveWithFreedom.fir.kt | 2 +- .../diagnostics/tests/sealed/ExhaustiveWithFreedom.kt | 2 +- .../diagnostics/tests/sealed/MultipleFiles_enabled.fir.kt | 2 +- .../diagnostics/tests/sealed/MultipleFiles_enabled.kt | 2 +- .../tests/sealed/NestedSealedWithoutRestrictions.fir.kt | 2 +- .../tests/sealed/NestedSealedWithoutRestrictions.kt | 2 +- .../tests/sealed/inheritorInDifferentModule.fir.kt | 2 +- .../diagnostics/tests/sealed/inheritorInDifferentModule.kt | 2 +- .../tests/sealed/interfaces/inheritorInDifferentModule.fir.kt | 2 +- .../tests/sealed/interfaces/inheritorInDifferentModule.kt | 2 +- .../tests/sealed/interfaces/simpleSealedInterface.kt | 2 +- .../jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt | 4 ++-- .../org/jetbrains/kotlin/config/LanguageVersionSettings.kt | 2 +- 20 files changed, 22 insertions(+), 23 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java index c7fca35ba93..e204e3c0b48 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java @@ -56,7 +56,7 @@ import org.jetbrains.kotlin.util.ReenteringLazyValueComputationException; import java.util.*; -import static org.jetbrains.kotlin.config.LanguageFeature.FreedomForSealedClasses; +import static org.jetbrains.kotlin.config.LanguageFeature.AllowSealedInheritorsInDifferentFilesOfSamePackage; import static org.jetbrains.kotlin.config.LanguageFeature.TopLevelSealedInheritance; import static org.jetbrains.kotlin.diagnostics.Errors.*; import static org.jetbrains.kotlin.resolve.BindingContext.*; @@ -637,7 +637,7 @@ public class BodyResolver { } if (containingDescriptor == null) { if ( - !languageVersionSettings.supportsFeature(FreedomForSealedClasses) || + !languageVersionSettings.supportsFeature(AllowSealedInheritorsInDifferentFilesOfSamePackage) || DescriptorUtils.isLocal(supertypeOwner) ) { trace.report(SEALED_SUPERTYPE.on(typeReference)); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionDescriptorResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionDescriptorResolver.kt index 18cf3717c3d..9b77161e5ab 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionDescriptorResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionDescriptorResolver.kt @@ -392,7 +392,7 @@ class FunctionDescriptorResolver( resolveValueParameters(constructorDescriptor, parameterScope, valueParameters, trace, null), resolveVisibilityFromModifiers( modifierList, - DescriptorUtils.getDefaultConstructorVisibility(classDescriptor, languageVersionSettings.supportsFeature(LanguageFeature.FreedomForSealedClasses)) + DescriptorUtils.getDefaultConstructorVisibility(classDescriptor, languageVersionSettings.supportsFeature(LanguageFeature.AllowSealedInheritorsInDifferentFilesOfSamePackage)) ) ) constructor.returnType = classDescriptor.defaultType diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/SealedInheritorInSamePackageChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/SealedInheritorInSamePackageChecker.kt index 31be306ed15..4bfa3d70bf0 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/SealedInheritorInSamePackageChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/SealedInheritorInSamePackageChecker.kt @@ -17,7 +17,7 @@ import org.jetbrains.kotlin.resolve.bindingContextUtil.getAbbreviatedTypeOrType object SealedInheritorInSamePackageChecker : DeclarationChecker { override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) { - if (!context.languageVersionSettings.supportsFeature(LanguageFeature.FreedomForSealedClasses)) return + if (!context.languageVersionSettings.supportsFeature(LanguageFeature.AllowSealedInheritorsInDifferentFilesOfSamePackage)) return if (descriptor !is ClassDescriptor || declaration !is KtClassOrObject) return val classPackage = descriptor.containingPackage() ?: return // local class, SEALED_SUPERTYPE already reported for (superTypeListEntry in declaration.superTypeListEntries) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java index 599982fff30..d6d9790b64a 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java @@ -30,7 +30,6 @@ import org.jetbrains.kotlin.resolve.BindingContext; import org.jetbrains.kotlin.resolve.BindingTrace; import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils; import org.jetbrains.kotlin.resolve.DescriptorUtils; -import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt; import org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil; import org.jetbrains.kotlin.resolve.lazy.LazyClassContext; import org.jetbrains.kotlin.resolve.lazy.LazyEntity; @@ -270,7 +269,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes ) ); - boolean freedomForSealedInterfacesSupported = c.getLanguageVersionSettings().supportsFeature(LanguageFeature.FreedomForSealedClasses); + boolean freedomForSealedInterfacesSupported = c.getLanguageVersionSettings().supportsFeature(LanguageFeature.AllowSealedInheritorsInDifferentFilesOfSamePackage); this.sealedSubclasses = storageManager.createLazyValue(() -> c.getSealedClassInheritorsProvider().computeSealedSubclasses(this, freedomForSealedInterfacesSupported)); } diff --git a/compiler/testData/codegen/box/sealed/multipleFiles_enabled.kt b/compiler/testData/codegen/box/sealed/multipleFiles_enabled.kt index bdae46a7afe..ff712206259 100644 --- a/compiler/testData/codegen/box/sealed/multipleFiles_enabled.kt +++ b/compiler/testData/codegen/box/sealed/multipleFiles_enabled.kt @@ -1,6 +1,6 @@ // ISSUE: KT-13495 // IGNORE_BACKEND_FIR: JVM_IR -// !LANGUAGE: +FreedomForSealedClasses +// !LANGUAGE: +AllowSealedInheritorsInDifferentFilesOfSamePackage // FILE: Base.kt diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/output.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/output.txt index e4d9b26ce29..89bef39328d 100644 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/output.txt +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedClassesAndInterfaces/output.txt @@ -1,7 +1,7 @@ warning: ATTENTION! This build uses unsafe internal compiler arguments: --XXLanguage:+FreedomForSealedClasses +-XXLanguage:+AllowSealedInheritorsInDifferentFilesOfSamePackage -XXLanguage:+SealedInterfaces This mode is not recommended for production use, diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/output.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/output.txt index 4f0b6da9911..b22e0dc8b0d 100644 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/output.txt +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/output.txt @@ -1,7 +1,7 @@ warning: ATTENTION! This build uses unsafe internal compiler arguments: --XXLanguage:+FreedomForSealedClasses +-XXLanguage:+AllowSealedInheritorsInDifferentFilesOfSamePackage -XXLanguage:+SealedInterfaces This mode is not recommended for production use, diff --git a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.fir.kt b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.fir.kt index 171f5f2e107..f90edc7720d 100644 --- a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.fir.kt +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.fir.kt @@ -1,6 +1,6 @@ // ISSUE: KT-13495 // !DIAGNOSTICS: -UNUSED_VARIABLE -// !LANGUAGE: +FreedomForSealedClasses +// !LANGUAGE: +AllowSealedInheritorsInDifferentFilesOfSamePackage // FILE: Base.kt diff --git a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.kt b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.kt index fc58d0236cc..d72d40c9102 100644 --- a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.kt +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.kt @@ -1,6 +1,6 @@ // ISSUE: KT-13495 // !DIAGNOSTICS: -UNUSED_VARIABLE -// !LANGUAGE: +FreedomForSealedClasses +// !LANGUAGE: +AllowSealedInheritorsInDifferentFilesOfSamePackage // FILE: Base.kt diff --git a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.fir.kt b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.fir.kt index aa349ea0459..3300a9cb6aa 100644 --- a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.fir.kt +++ b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.fir.kt @@ -1,5 +1,5 @@ // ISSUE: KT-13495 -// !LANGUAGE: +FreedomForSealedClasses +// !LANGUAGE: +AllowSealedInheritorsInDifferentFilesOfSamePackage // FILE: a.kt diff --git a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.kt b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.kt index 4e7c7fbf94a..005d87ff9f2 100644 --- a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.kt +++ b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.kt @@ -1,5 +1,5 @@ // ISSUE: KT-13495 -// !LANGUAGE: +FreedomForSealedClasses +// !LANGUAGE: +AllowSealedInheritorsInDifferentFilesOfSamePackage // FILE: a.kt diff --git a/compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.fir.kt b/compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.fir.kt index 444fb416c12..ff3c72191d0 100644 --- a/compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.fir.kt +++ b/compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.fir.kt @@ -1,5 +1,5 @@ // ISSUE: KT-13495 -// !LANGUAGE: +FreedomForSealedClasses +// !LANGUAGE: +AllowSealedInheritorsInDifferentFilesOfSamePackage // !DIAGNOSTICS: -UNUSED_VARIABLE // FILE: base.kt diff --git a/compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.kt b/compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.kt index fdd2bdcb6a8..c6da20d58a6 100644 --- a/compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.kt +++ b/compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.kt @@ -1,5 +1,5 @@ // ISSUE: KT-13495 -// !LANGUAGE: +FreedomForSealedClasses +// !LANGUAGE: +AllowSealedInheritorsInDifferentFilesOfSamePackage // !DIAGNOSTICS: -UNUSED_VARIABLE // FILE: base.kt diff --git a/compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.fir.kt b/compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.fir.kt index 4587f2142b4..28c559c7734 100644 --- a/compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.fir.kt +++ b/compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.fir.kt @@ -1,5 +1,5 @@ // ISSUE: KT-20423 -// !LANGUAGE: +SealedInterfaces +FreedomForSealedClasses +// !LANGUAGE: +SealedInterfaces +AllowSealedInheritorsInDifferentFilesOfSamePackage // MODULE: m1 // FILE: a.kt diff --git a/compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.kt b/compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.kt index 44736417247..b1204703749 100644 --- a/compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.kt +++ b/compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.kt @@ -1,5 +1,5 @@ // ISSUE: KT-20423 -// !LANGUAGE: +SealedInterfaces +FreedomForSealedClasses +// !LANGUAGE: +SealedInterfaces +AllowSealedInheritorsInDifferentFilesOfSamePackage // MODULE: m1 // FILE: a.kt diff --git a/compiler/testData/diagnostics/tests/sealed/interfaces/inheritorInDifferentModule.fir.kt b/compiler/testData/diagnostics/tests/sealed/interfaces/inheritorInDifferentModule.fir.kt index 6ef6ef701ac..d73f4940e35 100644 --- a/compiler/testData/diagnostics/tests/sealed/interfaces/inheritorInDifferentModule.fir.kt +++ b/compiler/testData/diagnostics/tests/sealed/interfaces/inheritorInDifferentModule.fir.kt @@ -1,5 +1,5 @@ // ISSUE: KT-20423 -// !LANGUAGE: +SealedInterfaces +FreedomForSealedClasses +// !LANGUAGE: +SealedInterfaces +AllowSealedInheritorsInDifferentFilesOfSamePackage // MODULE: m1 // FILE: a.kt diff --git a/compiler/testData/diagnostics/tests/sealed/interfaces/inheritorInDifferentModule.kt b/compiler/testData/diagnostics/tests/sealed/interfaces/inheritorInDifferentModule.kt index 4074595d4c3..74b6512a36d 100644 --- a/compiler/testData/diagnostics/tests/sealed/interfaces/inheritorInDifferentModule.kt +++ b/compiler/testData/diagnostics/tests/sealed/interfaces/inheritorInDifferentModule.kt @@ -1,5 +1,5 @@ // ISSUE: KT-20423 -// !LANGUAGE: +SealedInterfaces +FreedomForSealedClasses +// !LANGUAGE: +SealedInterfaces +AllowSealedInheritorsInDifferentFilesOfSamePackage // MODULE: m1 // FILE: a.kt diff --git a/compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.kt b/compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.kt index 284c4f84434..bb3b9fcbbbb 100644 --- a/compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.kt +++ b/compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.kt @@ -1,6 +1,6 @@ // FIR_IDENTICAL // ISSUE: KT-20423 -// !LANGUAGE: +FreedomForSealedClasses +SealedInterfaces +// !LANGUAGE: +AllowSealedInheritorsInDifferentFilesOfSamePackage +SealedInterfaces // !DIAGNOSTICS: -UNUSED_VARIABLE sealed interface Base diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt index c72ba064348..296aa35261e 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt @@ -695,13 +695,13 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration } fun testSealedClassesAndInterfaces() { - val features = listOf("-XXLanguage:+FreedomForSealedClasses", "-XXLanguage:+SealedInterfaces") + val features = listOf("-XXLanguage:+AllowSealedInheritorsInDifferentFilesOfSamePackage", "-XXLanguage:+SealedInterfaces") val library = compileLibrary("library", additionalOptions = features, checkKotlinOutput = {}) compileKotlin("main.kt", tmpdir, listOf(library), additionalOptions = features) } fun testSealedInheritorInDifferentModule() { - val features = listOf("-XXLanguage:+FreedomForSealedClasses", "-XXLanguage:+SealedInterfaces") + val features = listOf("-XXLanguage:+AllowSealedInheritorsInDifferentFilesOfSamePackage", "-XXLanguage:+SealedInterfaces") val library = compileLibrary("library", additionalOptions = features, checkKotlinOutput = {}) compileKotlin("main.kt", tmpdir, listOf(library), additionalOptions = features) } diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index 6b8aff23492..b016571cdcd 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -143,7 +143,7 @@ enum class LanguageFeature( UseCorrectExecutionOrderForVarargArguments(KOTLIN_1_5, kind = BUG_FIX), JvmRecordSupport(KOTLIN_1_5), - FreedomForSealedClasses(KOTLIN_1_5), + AllowSealedInheritorsInDifferentFilesOfSamePackage(KOTLIN_1_5), SealedInterfaces(KOTLIN_1_5), // Temporarily disabled, see KT-27084/KT-22379 From d5c1e5681cdefa0a96f55a15369793d4637ee386 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Sun, 6 Dec 2020 14:53:08 +0300 Subject: [PATCH 568/698] [IR] Don't assume subclasses as part of member scope of sealed class --- .../psi2ir/generators/IrSyntheticDeclarationGenerator.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/IrSyntheticDeclarationGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/IrSyntheticDeclarationGenerator.kt index c0aa1bfaf87..cbb2d891fc5 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/IrSyntheticDeclarationGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/IrSyntheticDeclarationGenerator.kt @@ -27,7 +27,6 @@ class IrSyntheticDeclarationGenerator(context: GeneratorContext) : IrElementVisi val result = mutableListOf() result.addAll(DescriptorUtils.getAllDescriptors(descriptor.unsubstitutedMemberScope)) result.addAll(descriptor.constructors) - result.addAll(descriptor.sealedSubclasses) descriptor.companionObjectDescriptor?.let { result.add(it) } return result @@ -49,4 +48,4 @@ class IrSyntheticDeclarationGenerator(context: GeneratorContext) : IrElementVisi declaration.acceptChildrenVoid(this) } -} \ No newline at end of file +} From 0389589d83918e1c7b2dbb707a287b4c403dc2f8 Mon Sep 17 00:00:00 2001 From: Vyacheslav Gerasimov Date: Sun, 5 Jul 2020 14:26:21 +0300 Subject: [PATCH 569/698] Build: Setup inputs and outputs for :js:js-tests:test task properly All task inputs should be declared and separated from outputs produced by it (e.g. node modules and js compile outputs) to make gradle test distribution work --- js/js.tests/build.gradle.kts | 51 +++++- .../jetbrains/kotlin/js/test/BasicBoxTest.kt | 158 ++++++++++++------ .../kotlin/js/test/BasicIrBoxTest.kt | 2 - .../AbstractIrJsTypeScriptExportTest.kt | 1 - .../AbstractLegacyJsTypeScriptExportTest.kt | 3 +- 5 files changed, 151 insertions(+), 64 deletions(-) diff --git a/js/js.tests/build.gradle.kts b/js/js.tests/build.gradle.kts index 8e98c305c41..f4bd1b52f83 100644 --- a/js/js.tests/build.gradle.kts +++ b/js/js.tests/build.gradle.kts @@ -188,14 +188,22 @@ fun Test.setUpJsBoxTests(jsEnabled: Boolean, jsIrEnabled: Boolean) { setupV8() dependsOn(":dist") - if (jsEnabled) dependsOn(testJsRuntime) + if (jsEnabled) { + dependsOn(testJsRuntime) + inputs.files(testJsRuntime) + } if (jsIrEnabled) { dependsOn(":kotlin-stdlib-js-ir:compileKotlinJs") systemProperty("kotlin.js.full.stdlib.path", "libraries/stdlib/js-ir/build/classes/kotlin/js/main") + inputs.dir(rootDir.resolve("libraries/stdlib/js-ir/build/classes/kotlin/js/main")) + dependsOn(":kotlin-stdlib-js-ir-minimal-for-test:compileKotlinJs") systemProperty("kotlin.js.reduced.stdlib.path", "libraries/stdlib/js-ir-minimal-for-test/build/classes/kotlin/js/main") + inputs.dir(rootDir.resolve("libraries/stdlib/js-ir-minimal-for-test/build/classes/kotlin/js/main")) + dependsOn(":kotlin-test:kotlin-test-js-ir:compileKotlinJs") systemProperty("kotlin.js.kotlin.test.path", "libraries/kotlin.test/js-ir/build/classes/kotlin/js/main") + inputs.dir(rootDir.resolve("libraries/kotlin.test/js-ir/build/classes/kotlin/js/main")) } exclude("org/jetbrains/kotlin/js/test/wasm/semantics/*") @@ -210,6 +218,8 @@ fun Test.setUpJsBoxTests(jsEnabled: Boolean, jsIrEnabled: Boolean) { fun Test.setUpBoxTests() { workingDir = rootDir + dependsOn(antLauncherJar) + inputs.files(antLauncherJar) doFirst { systemProperty("kotlin.ant.classpath", antLauncherJar.asPath) systemProperty("kotlin.ant.launcher.class", "org.apache.tools.ant.Main") @@ -225,8 +235,23 @@ fun Test.setUpBoxTests() { } } +val testDataDir = project(":js:js.translator").projectDir.resolve("testData") + projectTest(parallel = true) { setUpJsBoxTests(jsEnabled = true, jsIrEnabled = true) + + inputs.dir(rootDir.resolve("compiler/cli/cli-common/resources")) // compiler.xml + + inputs.dir(testDataDir) + inputs.dir(rootDir.resolve("dist")) + inputs.dir(rootDir.resolve("compiler/testData")) + inputs.dir(rootDir.resolve("libraries/stdlib/api/js")) + inputs.dir(rootDir.resolve("libraries/stdlib/api/js-v1")) + + systemProperty("kotlin.js.test.root.out.dir", "$buildDir/") + outputs.dir("$buildDir/out") + outputs.dir("$buildDir/out-min") + outputs.dir("$buildDir/out-pir") } projectTest("jsTest", true) { @@ -276,16 +301,23 @@ val generateTests by generator("org.jetbrains.kotlin.generators.tests.GenerateJs dependsOn(":compiler:generateTestData") } -val testDataDir = project(":js:js.translator").projectDir.resolve("testData") +extensions.getByType(NodeExtension::class.java).nodeModulesDir = buildDir -extensions.getByType(NodeExtension::class.java).nodeModulesDir = testDataDir +val prepareMochaTestData by tasks.registering(Copy::class) { + from(testDataDir) { + include("package.json") + include("test.js") + } + into(buildDir) +} val npmInstall by tasks.getting(NpmTask::class) { - setWorkingDir(testDataDir) + dependsOn(prepareMochaTestData) + setWorkingDir(buildDir) } val runMocha by task { - setWorkingDir(testDataDir) + setWorkingDir(buildDir) val target = if (project.hasProperty("teamcity")) "runOnTeamcity" else "test" setArgs(listOf("run", target)) @@ -296,6 +328,15 @@ val runMocha by task { val check by tasks check.dependsOn(this) + + doFirst { + setEnvironment( + mapOf( + "KOTLIN_JS_LOCATION" to rootDir.resolve("dist/js/kotlin.js"), + "KOTLIN_JS_TEST_LOCATION" to rootDir.resolve("dist/js/kotlin-test.js") + ) + ) + } } projectTest("wasmTest", true) { diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt index 93581764ea0..b628f1cdec0 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt @@ -68,7 +68,6 @@ import java.util.regex.Pattern abstract class BasicBoxTest( protected val pathToTestDir: String, testGroupOutputDirPrefix: String, - pathToRootOutputDir: String = TEST_DATA_DIR_PATH, private val typedArraysEnabled: Boolean = true, private val generateSourceMap: Boolean = false, private val generateNodeJsRunner: Boolean = true, @@ -76,6 +75,7 @@ abstract class BasicBoxTest( ) : KotlinTestWithEnvironment() { private val additionalCommonFileDirectories = mutableListOf() + val pathToRootOutputDir = System.getProperty("kotlin.js.test.root.out.dir") ?: error("'kotlin.js.test.root.out.dir' is not set") private val testGroupOutputDirForCompilation = File(pathToRootOutputDir + "out/" + testGroupOutputDirPrefix) private val testGroupOutputDirForMinification = File(pathToRootOutputDir + "out-min/" + testGroupOutputDirPrefix) private val testGroupOutputDirForPir = File(pathToRootOutputDir + "out-pir/" + testGroupOutputDirPrefix) @@ -116,7 +116,10 @@ abstract class BasicBoxTest( val needsFullIrRuntime = KJS_WITH_FULL_RUNTIME.matcher(fileContent).find() || WITH_RUNTIME.matcher(fileContent).find() - val actualMainCallParameters = if (CALL_MAIN_PATTERN.matcher(fileContent).find()) MainCallParameters.mainWithArguments(listOf("testArg")) else mainCallParameters + val actualMainCallParameters = if (CALL_MAIN_PATTERN.matcher(fileContent).find()) + MainCallParameters.mainWithArguments(listOf("testArg")) + else + mainCallParameters val outputPrefixFile = getOutputPrefixFile(filePath) val outputPostfixFile = getOutputPostfixFile(filePath) @@ -246,16 +249,26 @@ abstract class BasicBoxTest( } val allJsFiles = additionalFiles + inputJsFiles + generatedJsFiles.map { it.first } + globalCommonFiles + localCommonFiles + - additionalCommonFiles + additionalMainFiles + additionalCommonFiles + additionalMainFiles - val dceAllJsFiles = additionalFiles + inputJsFiles + generatedJsFiles.map { it.first.replace(outputDir.absolutePath, dceOutputDir.absolutePath) } + - globalCommonFiles + localCommonFiles + additionalCommonFiles + additionalMainFiles + val dceAllJsFiles = additionalFiles + inputJsFiles + generatedJsFiles.map { + it.first.replace( + outputDir.absolutePath, + dceOutputDir.absolutePath + ) + } + globalCommonFiles + localCommonFiles + additionalCommonFiles + additionalMainFiles - val pirAllJsFiles = additionalFiles + inputJsFiles + generatedJsFiles.map { it.first.replace(outputDir.absolutePath, pirOutputDir.absolutePath) } + + val pirAllJsFiles = additionalFiles + inputJsFiles + generatedJsFiles.map { + it.first.replace( + outputDir.absolutePath, + pirOutputDir.absolutePath + ) + } + globalCommonFiles + localCommonFiles + additionalCommonFiles + additionalMainFiles - val dontRunGeneratedCode = InTextDirectivesUtils.dontRunGeneratedCode(targetBackend, file) + val dontRunGeneratedCode = + InTextDirectivesUtils.dontRunGeneratedCode(targetBackend, file) if (!dontRunGeneratedCode && generateNodeJsRunner && !SKIP_NODE_JS.matcher(fileContent).find()) { val nodeRunnerName = mainModule.outputFileName(outputDir) + ".node.js" @@ -306,7 +319,8 @@ abstract class BasicBoxTest( testPackage = testPackage, testFunction = testFunction, withModuleSystem = withModuleSystem, - minificationThresholdChecker = thresholdChecker) + minificationThresholdChecker = thresholdChecker + ) } } } @@ -369,11 +383,11 @@ abstract class BasicBoxTest( protected open fun performAdditionalChecks(inputFile: File, outputFile: File) {} private fun generateNodeRunner( - files: Collection, - dir: File, - moduleName: String, - ignored: Boolean, - testPackage: String? + files: Collection, + dir: File, + moduleName: String, + ignored: Boolean, + testPackage: String? ): String { val filesToLoad = files.map { FileUtil.getRelativePath(dir, File(it))!!.replace(File.separatorChar, '/') }.map { "\"$it\"" } val fqn = testPackage?.let { ".$it" } ?: "" @@ -390,8 +404,7 @@ abstract class BasicBoxTest( sb.append(" catch (e) {\n") sb.append(" return 'OK';\n") sb.append("}\n") - } - else { + } else { sb.append(" return $loadAndRun;\n") } sb.append("};\n") @@ -402,10 +415,10 @@ abstract class BasicBoxTest( protected fun getOutputDir(file: File, testGroupOutputDir: File = testGroupOutputDirForCompilation): File { val stopFile = File(pathToTestDir) return generateSequence(file.parentFile) { it.parentFile } - .takeWhile { it != stopFile } - .map { it.name } - .toList().asReversed() - .fold(testGroupOutputDir, ::File) + .takeWhile { it != stopFile } + .map { it.name } + .toList().asReversed() + .fold(testGroupOutputDir, ::File) } private fun TestModule.outputFileSimpleName(): String { @@ -440,7 +453,7 @@ abstract class BasicBoxTest( errorIgnorancePolicy: ErrorTolerancePolicy, propertyLazyInitialization: Boolean, ) { - val kotlinFiles = module.files.filter { it.fileName.endsWith(".kt") } + val kotlinFiles = module.files.filter { it.fileName.endsWith(".kt") } val testFiles = kotlinFiles.map { it.fileName } val globalCommonFiles = JsTestUtils.getFilesInDirectoryByExtension(COMMON_FILES_DIR_PATH, KotlinFileType.EXTENSION) val localCommonFile = directory + "/" + COMMON_FILES_NAME + "." + KotlinFileType.EXTENSION @@ -464,7 +477,7 @@ abstract class BasicBoxTest( tmpDir, incrementalData = null, expectActualLinker = expectActualLinker, - errorIgnorancePolicy, + errorIgnorancePolicy ) val outputFile = File(outputFileName) val dceOutputFile = File(dceOutputFileName) @@ -493,8 +506,24 @@ abstract class BasicBoxTest( if (incrementalCompilationChecksEnabled && module.hasFilesToRecompile) { checkIncrementalCompilation( - sourceDirs, module, kotlinFiles, dependencies, allDependencies, friends, multiModule, tmpDir, remap, - outputFile, outputPrefixFile, outputPostfixFile, mainCallParameters, incrementalData, testPackage, testFunction, needsFullIrRuntime, expectActualLinker + sourceDirs, + module, + kotlinFiles, + dependencies, + allDependencies, + friends, + multiModule, + tmpDir, + remap, + outputFile, + outputPrefixFile, + outputPostfixFile, + mainCallParameters, + incrementalData, + testPackage, + testFunction, + needsFullIrRuntime, + expectActualLinker ) } } @@ -532,8 +561,8 @@ abstract class BasicBoxTest( sourceToTranslationUnit[sourceFile] = TranslationUnit.BinaryAst(data.binaryAst, data.inlineData) } val translationUnits = sourceToTranslationUnit.keys - .sortedBy { it.canonicalPath } - .map { sourceToTranslationUnit[it]!! } + .sortedBy { it.canonicalPath } + .map { sourceToTranslationUnit[it]!! } val recompiledConfig = createConfig( sourceDirs, @@ -545,16 +574,27 @@ abstract class BasicBoxTest( tmpDir, incrementalData, expectActualLinker, - ErrorTolerancePolicy.DEFAULT, + ErrorTolerancePolicy.DEFAULT ) val recompiledOutputFile = File(outputFile.parentFile, outputFile.nameWithoutExtension + "-recompiled.js") translateFiles( - translationUnits, recompiledOutputFile, recompiledOutputFile, recompiledOutputFile, recompiledConfig, - outputPrefixFile, outputPostfixFile, - mainCallParameters, incrementalData, remap, testPackage, testFunction, needsFullIrRuntime, - isMainModule = false, skipDceDriven = true, - splitPerModule = false, + translationUnits, + recompiledOutputFile, + recompiledOutputFile, + recompiledOutputFile, + recompiledConfig, + outputPrefixFile, + outputPostfixFile, + mainCallParameters, + incrementalData, + remap, + testPackage, + testFunction, + needsFullIrRuntime, + isMainModule = false, + skipDceDriven = true, + splitPerModule = false, propertyLazyInitialization = false, ) @@ -564,7 +604,8 @@ abstract class BasicBoxTest( val originalSourceMap = FileUtil.loadFile(File(outputFile.parentFile, outputFile.name + ".map")) val recompiledSourceMap = - removeRecompiledSuffix(FileUtil.loadFile(File(recompiledOutputFile.parentFile, recompiledOutputFile.name + ".map"))) + removeRecompiledSuffix(FileUtil.loadFile(File(recompiledOutputFile.parentFile, recompiledOutputFile.name + ".map")) + ) if (originalSourceMap != recompiledSourceMap) { val originalSourceMapParse = SourceMapParser.parse(originalSourceMap) val recompiledSourceMapParse = SourceMapParser.parse(recompiledSourceMap) @@ -580,10 +621,9 @@ abstract class BasicBoxTest( if (multiModule) { val originalMetadata = FileUtil.loadFile(File(outputFile.parentFile, outputFile.nameWithoutExtension + ".meta.js")) - val recompiledMetadata = - removeRecompiledSuffix( - FileUtil.loadFile(File(recompiledOutputFile.parentFile, recompiledOutputFile.nameWithoutExtension + ".meta.js")) - ) + val recompiledMetadata = removeRecompiledSuffix( + FileUtil.loadFile(File(recompiledOutputFile.parentFile, recompiledOutputFile.nameWithoutExtension + ".meta.js")) + ) assertEquals( "Metadata file changed after recompilation", metadataAsString(originalMetadata), @@ -697,8 +737,8 @@ abstract class BasicBoxTest( private fun processJsProgram(program: JsProgram, psiFiles: List) { psiFiles.asSequence() - .map { it.text } - .forEach { DirectiveTestUtils.processDirectives(program, it) } + .map { it.text } + .forEach { DirectiveTestUtils.processDirectives(program, it) } program.verifyAst() } @@ -710,6 +750,7 @@ abstract class BasicBoxTest( super.visitObjectLiteral(x) x.isMultiline = false } + override fun visitVars(x: JsVars) { x.isMultiline = false super.visitVars(x) @@ -721,8 +762,11 @@ abstract class BasicBoxTest( val output = TextOutputImpl() val pathResolver = SourceFilePathResolver(mutableListOf(File(".")), null) val sourceMapBuilder = SourceMap3Builder(outputFile, output, "") - generatedProgram.accept(JsToStringGenerationVisitor( - output, SourceMapBuilderConsumer(File("."), sourceMapBuilder, pathResolver, false, false))) + generatedProgram.accept( + JsToStringGenerationVisitor( + output, SourceMapBuilderConsumer(File("."), sourceMapBuilder, pathResolver, false, false) + ) + ) val code = output.toString() val generatedSourceMap = sourceMapBuilder.build() @@ -813,7 +857,13 @@ abstract class BasicBoxTest( if (header != null) { configuration.put( JSConfigurationKeys.INCREMENTAL_DATA_PROVIDER, - IncrementalDataProviderImpl(header, incrementalData.translatedFiles, JsMetadataVersion.INSTANCE.toArray(), incrementalData.packageMetadata, emptyMap()) + IncrementalDataProviderImpl( + header, + incrementalData.translatedFiles, + JsMetadataVersion.INSTANCE.toArray(), + incrementalData.packageMetadata, + emptyMap() + ) ) } @@ -841,9 +891,9 @@ abstract class BasicBoxTest( } private fun minifyAndRun( - workDir: File, allJsFiles: List, generatedJsFiles: List>, - expectedResult: String, testModuleName: String?, testPackage: String?, testFunction: String, withModuleSystem: Boolean, - minificationThresholdChecker: (Int) -> Unit + workDir: File, allJsFiles: List, generatedJsFiles: List>, + expectedResult: String, testModuleName: String?, testPackage: String?, testFunction: String, withModuleSystem: Boolean, + minificationThresholdChecker: (Int) -> Unit ) { val kotlinJsLib = DIST_DIR_JS_PATH + "kotlin.js" val kotlinTestJsLib = DIST_DIR_JS_PATH + "kotlin-test.js" @@ -860,9 +910,9 @@ abstract class BasicBoxTest( val testFunctionFqn = testModuleName + (if (testPackage.isNullOrEmpty()) "" else ".$testPackage") + ".$testFunction" val additionalReachableNodes = setOf( - testFunctionFqn, "kotlin.kotlin.io.BufferedOutput", "kotlin.kotlin.io.output.flush", - "kotlin.kotlin.io.output.buffer", "kotlin-test.kotlin.test.overrideAsserter_wbnzx$", - "kotlin-test.kotlin.test.DefaultAsserter" + testFunctionFqn, "kotlin.kotlin.io.BufferedOutput", "kotlin.kotlin.io.output.flush", + "kotlin.kotlin.io.output.buffer", "kotlin-test.kotlin.test.overrideAsserter_wbnzx$", + "kotlin-test.kotlin.test.DefaultAsserter" ) val allFilesToMinify = filesToMinify.values + kotlinJsInputFile + kotlinTestJsInputFile val dceResult = DeadCodeElimination.run(allFilesToMinify, additionalReachableNodes) { _, _ -> } @@ -895,7 +945,7 @@ abstract class BasicBoxTest( val currentModule = module ?: defaultModule val ktFile = KtPsiFactory(project).createFile(text) - val boxFunction = ktFile.declarations.find { it is KtNamedFunction && it.name == TEST_FUNCTION } + val boxFunction = ktFile.declarations.find { it is KtNamedFunction && it.name == TEST_FUNCTION } if (boxFunction != null) { testPackage = ktFile.packageFqName.asString() if (testPackage?.isEmpty() == true) { @@ -962,7 +1012,7 @@ abstract class BasicBoxTest( } override fun createModule(name: String, dependencies: List, friends: List) = - TestModule(name, dependencies, friends) + TestModule(name, dependencies, friends) override fun close() { FileUtil.delete(tmpDir) @@ -976,10 +1026,10 @@ abstract class BasicBoxTest( } private class TestModule( - name: String, - dependencies: List, - friends: List - ): KotlinBaseTest.TestModule(name, dependencies, friends) { + name: String, + dependencies: List, + friends: List + ) : KotlinBaseTest.TestModule(name, dependencies, friends) { var moduleKind = ModuleKind.PLAIN var inliningDisabled = false val files = mutableListOf() @@ -990,7 +1040,7 @@ abstract class BasicBoxTest( } override fun createEnvironment() = - KotlinCoreEnvironment.createForTests(testRootDisposable, CompilerConfiguration(), EnvironmentConfigFiles.JS_CONFIG_FILES) + KotlinCoreEnvironment.createForTests(testRootDisposable, CompilerConfiguration(), EnvironmentConfigFiles.JS_CONFIG_FILES) companion object { val METADATA_CACHE = (JsConfig.JS_STDLIB + JsConfig.JS_KOTLIN_TEST).flatMap { path -> diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt index a8ae3a55a46..c45cc27b282 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt @@ -30,14 +30,12 @@ private val kotlinTestKLib = System.getProperty("kotlin.js.kotlin.test.path") abstract class BasicIrBoxTest( pathToTestDir: String, testGroupOutputDirPrefix: String, - pathToRootOutputDir: String = TEST_DATA_DIR_PATH, generateSourceMap: Boolean = false, generateNodeJsRunner: Boolean = false, targetBackend: TargetBackend = TargetBackend.JS_IR ) : BasicBoxTest( pathToTestDir, testGroupOutputDirPrefix, - pathToRootOutputDir = pathToRootOutputDir, typedArraysEnabled = true, generateSourceMap = generateSourceMap, generateNodeJsRunner = generateNodeJsRunner, diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/AbstractIrJsTypeScriptExportTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/AbstractIrJsTypeScriptExportTest.kt index 94501c6b259..f1d59b255a7 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/AbstractIrJsTypeScriptExportTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/AbstractIrJsTypeScriptExportTest.kt @@ -18,7 +18,6 @@ abstract class AbstractIrJsTypeScriptExportTest( ) : BasicIrBoxTest( pathToTestDir = TEST_DATA_DIR_PATH + "typescript-export/", testGroupOutputDirPrefix = "typescript-export/", - pathToRootOutputDir = TEST_DATA_DIR_PATH, targetBackend = targetBackend ) { override val generateDts = true diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/AbstractLegacyJsTypeScriptExportTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/AbstractLegacyJsTypeScriptExportTest.kt index 62d95585995..c95489f9a08 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/AbstractLegacyJsTypeScriptExportTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/AbstractLegacyJsTypeScriptExportTest.kt @@ -9,6 +9,5 @@ import org.jetbrains.kotlin.js.test.BasicBoxTest abstract class AbstractLegacyJsTypeScriptExportTest : BasicBoxTest( pathToTestDir = TEST_DATA_DIR_PATH + "typescript-export/", - testGroupOutputDirPrefix = "legacy-typescript-export/", - pathToRootOutputDir = TEST_DATA_DIR_PATH + testGroupOutputDirPrefix = "legacy-typescript-export/" ) \ No newline at end of file From 8c4b7ad1e16696b05cc8fdb1005f2bc7239d239b Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Tue, 1 Dec 2020 17:26:15 +0300 Subject: [PATCH 570/698] [TEST] Drop generating tests for coroutines of Kotlin 1.2 --- ...endDiagnosticsTestWithStdlibGenerated.java | 141 +- ...mpileKotlinAgainstKotlinTestGenerated.java | 8 +- .../ir/FirBlackBoxCodegenTestGenerated.java | 1404 ++++----- ...FirBlackBoxInlineCodegenTestGenerated.java | 276 +- .../ir/FirBytecodeTextTestGenerated.java | 52 +- .../DiagnosticsTestWithStdLibGenerated.java | 291 +- ...ticsTestWithStdLibUsingJavacGenerated.java | 291 +- .../codegen/BlackBoxCodegenTestGenerated.java | 2741 ++++------------- .../BlackBoxInlineCodegenTestGenerated.java | 532 +--- .../codegen/BytecodeListingTestGenerated.java | 58 +- .../codegen/BytecodeTextTestGenerated.java | 107 +- ...otlinAgainstInlineKotlinTestGenerated.java | 532 +--- ...mpileKotlinAgainstKotlinTestGenerated.java | 14 +- .../LightAnalysisModeTestGenerated.java | 2741 ++++------------- .../ir/IrBlackBoxCodegenTestGenerated.java | 1404 ++++----- .../IrBlackBoxInlineCodegenTestGenerated.java | 276 +- .../ir/IrBytecodeListingTestGenerated.java | 28 +- .../ir/IrBytecodeTextTestGenerated.java | 52 +- ...otlinAgainstInlineKotlinTestGenerated.java | 276 +- ...mpileKotlinAgainstKotlinTestGenerated.java | 8 +- ...JvmIrAgainstOldBoxInlineTestGenerated.java | 276 +- .../ir/JvmIrAgainstOldBoxTestGenerated.java | 8 +- ...JvmOldAgainstIrBoxInlineTestGenerated.java | 276 +- .../ir/JvmOldAgainstIrBoxTestGenerated.java | 8 +- .../generators/tests/GenerateCompilerTests.kt | 9 +- ...unTestMethodWithPackageReplacementModel.kt | 39 - .../tests/generator/SimpleTestClassModel.java | 46 +- .../tests/generator/TestGenerationDSL.kt | 6 +- .../kotlin/generators/util/coroutines.kt | 96 - .../IrJsCodegenBoxES6TestGenerated.java | 1320 ++++---- .../IrJsCodegenInlineES6TestGenerated.java | 264 +- .../IrJsCodegenBoxTestGenerated.java | 1320 ++++---- .../IrJsCodegenInlineTestGenerated.java | 264 +- .../semantics/JsCodegenBoxTestGenerated.java | 1320 ++++---- .../JsCodegenInlineTestGenerated.java | 264 +- .../IrCodegenBoxWasmTestGenerated.java | 8 - 36 files changed, 5902 insertions(+), 10854 deletions(-) delete mode 100644 generators/test-generator/tests/org/jetbrains/kotlin/generators/tests/generator/RunTestMethodWithPackageReplacementModel.kt delete mode 100644 generators/test-generator/tests/org/jetbrains/kotlin/generators/util/coroutines.kt diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java index f9f25fdec03..148898ae8df 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java @@ -8,7 +8,6 @@ package org.jetbrains.kotlin.fir; import com.intellij.testFramework.TestDataPath; import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; import org.jetbrains.kotlin.test.KotlinTestUtils; -import org.jetbrains.kotlin.test.TargetBackend; import org.jetbrains.kotlin.test.TestMetadata; import org.junit.runner.RunWith; @@ -1659,10 +1658,6 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.ANY, testDataFilePath); - } - public void testAllFilesPresentInCoroutines() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/coroutines"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } @@ -1788,8 +1783,8 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi } @TestMetadata("noDefaultCoroutineImports.kt") - public void testNoDefaultCoroutineImports_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.kt", "kotlin.coroutines"); + public void testNoDefaultCoroutineImports() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.kt"); } @TestMetadata("nonLocalSuspension.kt") @@ -1818,8 +1813,8 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi } @TestMetadata("suspendApplicability.kt") - public void testSuspendApplicability_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendApplicability.kt", "kotlin.coroutines"); + public void testSuspendApplicability() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendApplicability.kt"); } @TestMetadata("suspendConflictsWithNoSuspend.kt") @@ -1848,8 +1843,8 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi } @TestMetadata("suspendCovarianJavaOverride.kt") - public void testSuspendCovarianJavaOverride_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCovarianJavaOverride.kt", "kotlin.coroutines"); + public void testSuspendCovarianJavaOverride() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCovarianJavaOverride.kt"); } @TestMetadata("suspendDestructuring.kt") @@ -1868,23 +1863,23 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi } @TestMetadata("suspendFunctions.kt") - public void testSuspendFunctions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.kt", "kotlin.coroutines"); + public void testSuspendFunctions() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.kt"); } @TestMetadata("suspendJavaImplementationFromDifferentClass.kt") - public void testSuspendJavaImplementationFromDifferentClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaImplementationFromDifferentClass.kt", "kotlin.coroutines"); + public void testSuspendJavaImplementationFromDifferentClass() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaImplementationFromDifferentClass.kt"); } @TestMetadata("suspendJavaOverrides.kt") - public void testSuspendJavaOverrides_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaOverrides.kt", "kotlin.coroutines"); + public void testSuspendJavaOverrides() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaOverrides.kt"); } @TestMetadata("suspendLambda.kt") - public void testSuspendLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendLambda.kt", "kotlin.coroutines"); + public void testSuspendLambda() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendLambda.kt"); } @TestMetadata("suspendOverridability.kt") @@ -1945,10 +1940,6 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.ANY, testDataFilePath); - } - public void testAllFilesPresentInCallableReference() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } @@ -1964,8 +1955,8 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi } @TestMetadata("property.kt") - public void testProperty_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/property.kt", "kotlin.coroutines"); + public void testProperty() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/property.kt"); } @TestMetadata("suspendConversionForCallableReferences.kt") @@ -2265,72 +2256,68 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.ANY, testDataFilePath); - } - public void testAllFilesPresentInInlineCrossinline() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } @TestMetadata("inlineOrdinaryOfCrossinlineOrdinary.kt") - public void testInlineOrdinaryOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineOrdinary.kt") - public void testInlineOrdinaryOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineOrdinary.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfOrdinary.kt") - public void testInlineOrdinaryOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfOrdinary() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfOrdinary.kt"); } @TestMetadata("inlineOrdinaryOfSuspend.kt") - public void testInlineOrdinaryOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfSuspend() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfSuspend.kt"); } @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfOrdinary() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfOrdinary.kt"); } @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfSuspend() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfSuspend.kt"); } } @@ -2370,32 +2357,28 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.ANY, testDataFilePath); - } - public void testAllFilesPresentInRestrictSuspension() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } @TestMetadata("allMembersAllowed.kt") - public void testAllMembersAllowed_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/allMembersAllowed.kt", "kotlin.coroutines"); + public void testAllMembersAllowed() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/allMembersAllowed.kt"); } @TestMetadata("extensions.kt") - public void testExtensions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/extensions.kt", "kotlin.coroutines"); + public void testExtensions() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/extensions.kt"); } @TestMetadata("memberExtension.kt") - public void testMemberExtension_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/memberExtension.kt", "kotlin.coroutines"); + public void testMemberExtension() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/memberExtension.kt"); } @TestMetadata("notRelatedFun.kt") - public void testNotRelatedFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/notRelatedFun.kt", "kotlin.coroutines"); + public void testNotRelatedFun() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/notRelatedFun.kt"); } @TestMetadata("outerYield_1_2.kt") @@ -2409,18 +2392,18 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi } @TestMetadata("sameInstance.kt") - public void testSameInstance_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/sameInstance.kt", "kotlin.coroutines"); + public void testSameInstance() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/sameInstance.kt"); } @TestMetadata("simpleForbidden.kt") - public void testSimpleForbidden_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/simpleForbidden.kt", "kotlin.coroutines"); + public void testSimpleForbidden() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/simpleForbidden.kt"); } @TestMetadata("wrongEnclosingFunction.kt") - public void testWrongEnclosingFunction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/wrongEnclosingFunction.kt", "kotlin.coroutines"); + public void testWrongEnclosingFunction() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/wrongEnclosingFunction.kt"); } } @@ -2515,17 +2498,13 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.ANY, testDataFilePath); - } - public void testAllFilesPresentInTailCalls() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } @TestMetadata("forbidden.kt") - public void testForbidden_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/forbidden.kt", "kotlin.coroutines"); + public void testForbidden() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/forbidden.kt"); } @TestMetadata("localFunctions.kt") @@ -2549,13 +2528,13 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi } @TestMetadata("tryCatch.kt") - public void testTryCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/tryCatch.kt", "kotlin.coroutines"); + public void testTryCatch() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/tryCatch.kt"); } @TestMetadata("valid.kt") - public void testValid_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/valid.kt", "kotlin.coroutines"); + public void testValid() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/valid.kt"); } } } diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java index dca0ac2c850..0c5b20dbeba 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java @@ -25,10 +25,6 @@ public class FirCompileKotlinAgainstKotlinTestGenerated extends AbstractFirCompi KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInCompileKotlinAgainstKotlin() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @@ -99,8 +95,8 @@ public class FirCompileKotlinAgainstKotlinTestGenerated extends AbstractFirCompi } @TestMetadata("coroutinesBinary.kt") - public void testCoroutinesBinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/compileKotlinAgainstKotlin/coroutinesBinary.kt", "kotlin.coroutines"); + public void testCoroutinesBinary() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/coroutinesBinary.kt"); } @TestMetadata("defaultConstructor.kt") diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 7f455b6029e..20674d12e13 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -934,10 +934,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInJvm() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/assert/jvm"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @@ -1033,23 +1029,23 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("suspendFunctionAssertionDisabled.kt") - public void testSuspendFunctionAssertionDisabled_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionDisabled.kt", "kotlin.coroutines"); + public void testSuspendFunctionAssertionDisabled() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionDisabled.kt"); } @TestMetadata("suspendFunctionAssertionsEnabled.kt") - public void testSuspendFunctionAssertionsEnabled_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionsEnabled.kt", "kotlin.coroutines"); + public void testSuspendFunctionAssertionsEnabled() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionsEnabled.kt"); } @TestMetadata("suspendLambdaAssertionsDisabled.kt") - public void testSuspendLambdaAssertionsDisabled_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsDisabled.kt", "kotlin.coroutines"); + public void testSuspendLambdaAssertionsDisabled() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsDisabled.kt"); } @TestMetadata("suspendLambdaAssertionsEnabled.kt") - public void testSuspendLambdaAssertionsEnabled_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsEnabled.kt", "kotlin.coroutines"); + public void testSuspendLambdaAssertionsEnabled() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsEnabled.kt"); } } } @@ -4845,10 +4841,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInCapturedVarsOptimization() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/closures/capturedVarsOptimization"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @@ -4898,14 +4890,14 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/closures/capturedVarsOptimization/sharedSlotsWithCapturedVars.kt"); } - @TestMetadata("withCoroutinesNoStdLib.kt") - public void testWithCoroutinesNoStdLib_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutinesNoStdLib.kt", "kotlin.coroutines"); + @TestMetadata("withCoroutines.kt") + public void testWithCoroutines() throws Exception { + runTest("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt"); } - @TestMetadata("withCoroutines.kt") - public void testWithCoroutines_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt", "kotlin.coroutines"); + @TestMetadata("withCoroutinesNoStdLib.kt") + public void testWithCoroutinesNoStdLib() throws Exception { + runTest("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutinesNoStdLib.kt"); } } @@ -5351,10 +5343,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInContracts() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/contracts"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @@ -5400,8 +5388,8 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("kt39374.kt") - public void testKt39374_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/contracts/kt39374.kt", "kotlin.coroutines"); + public void testKt39374() throws Exception { + runTest("compiler/testData/codegen/box/contracts/kt39374.kt"); } @TestMetadata("lambdaParameter.kt") @@ -6535,27 +6523,28 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - @TestMetadata("32defaultParametersInSuspend.kt") - public void test32defaultParametersInSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/32defaultParametersInSuspend.kt", "kotlin.coroutines"); + public void test32defaultParametersInSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/32defaultParametersInSuspend.kt"); } @TestMetadata("accessorForSuspend.kt") - public void testAccessorForSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/accessorForSuspend.kt", "kotlin.coroutines"); + public void testAccessorForSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/accessorForSuspend.kt"); } public void testAllFilesPresentInCoroutines() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @TestMetadata("async.kt") + public void testAsync() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/async.kt"); + } + @TestMetadata("asyncException.kt") - public void testAsyncException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/asyncException.kt", "kotlin.coroutines"); + public void testAsyncException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/asyncException.kt"); } @TestMetadata("asyncIteratorNullMerge_1_3.kt") @@ -6573,24 +6562,19 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/coroutines/asyncIterator_1_3.kt"); } - @TestMetadata("async.kt") - public void testAsync_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/async.kt", "kotlin.coroutines"); - } - @TestMetadata("await.kt") - public void testAwait_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/await.kt", "kotlin.coroutines"); - } - - @TestMetadata("beginWithExceptionNoHandleException.kt") - public void testBeginWithExceptionNoHandleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/beginWithExceptionNoHandleException.kt", "kotlin.coroutines"); + public void testAwait() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/await.kt"); } @TestMetadata("beginWithException.kt") - public void testBeginWithException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/beginWithException.kt", "kotlin.coroutines"); + public void testBeginWithException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/beginWithException.kt"); + } + + @TestMetadata("beginWithExceptionNoHandleException.kt") + public void testBeginWithExceptionNoHandleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/beginWithExceptionNoHandleException.kt"); } @TestMetadata("builderInferenceAndGenericArrayAcessCall.kt") @@ -6614,28 +6598,28 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("capturedVarInSuspendLambda.kt") - public void testCapturedVarInSuspendLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt", "kotlin.coroutines"); + public void testCapturedVarInSuspendLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt"); } @TestMetadata("catchWithInlineInsideSuspend.kt") - public void testCatchWithInlineInsideSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/catchWithInlineInsideSuspend.kt", "kotlin.coroutines"); + public void testCatchWithInlineInsideSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/catchWithInlineInsideSuspend.kt"); } @TestMetadata("coercionToUnit.kt") - public void testCoercionToUnit_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/coercionToUnit.kt", "kotlin.coroutines"); + public void testCoercionToUnit() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/coercionToUnit.kt"); } @TestMetadata("controllerAccessFromInnerLambda.kt") - public void testControllerAccessFromInnerLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controllerAccessFromInnerLambda.kt", "kotlin.coroutines"); + public void testControllerAccessFromInnerLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controllerAccessFromInnerLambda.kt"); } @TestMetadata("coroutineContextInInlinedLambda.kt") - public void testCoroutineContextInInlinedLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/coroutineContextInInlinedLambda.kt", "kotlin.coroutines"); + public void testCoroutineContextInInlinedLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/coroutineContextInInlinedLambda.kt"); } @TestMetadata("coroutineToString.kt") @@ -6644,18 +6628,23 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("createCoroutineSafe.kt") - public void testCreateCoroutineSafe_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/createCoroutineSafe.kt", "kotlin.coroutines"); + public void testCreateCoroutineSafe() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/createCoroutineSafe.kt"); } @TestMetadata("createCoroutinesOnManualInstances.kt") - public void testCreateCoroutinesOnManualInstances_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/createCoroutinesOnManualInstances.kt", "kotlin.coroutines"); + public void testCreateCoroutinesOnManualInstances() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/createCoroutinesOnManualInstances.kt"); } @TestMetadata("crossInlineWithCapturedOuterReceiver.kt") - public void testCrossInlineWithCapturedOuterReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/crossInlineWithCapturedOuterReceiver.kt", "kotlin.coroutines"); + public void testCrossInlineWithCapturedOuterReceiver() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/crossInlineWithCapturedOuterReceiver.kt"); + } + + @TestMetadata("defaultParametersInSuspend.kt") + public void testDefaultParametersInSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/defaultParametersInSuspend.kt"); } @TestMetadata("defaultParametersInSuspendWithJvmOverloads.kt") @@ -6663,19 +6652,14 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/coroutines/defaultParametersInSuspendWithJvmOverloads.kt"); } - @TestMetadata("defaultParametersInSuspend.kt") - public void testDefaultParametersInSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/defaultParametersInSuspend.kt", "kotlin.coroutines"); - } - @TestMetadata("delegatedSuspendMember.kt") - public void testDelegatedSuspendMember_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt", "kotlin.coroutines"); + public void testDelegatedSuspendMember() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt"); } @TestMetadata("dispatchResume.kt") - public void testDispatchResume_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/dispatchResume.kt", "kotlin.coroutines"); + public void testDispatchResume() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/dispatchResume.kt"); } @TestMetadata("doubleColonExpressionsGenerationInBuilderInference.kt") @@ -6684,8 +6668,8 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("emptyClosure.kt") - public void testEmptyClosure_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/emptyClosure.kt", "kotlin.coroutines"); + public void testEmptyClosure() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/emptyClosure.kt"); } @TestMetadata("emptyCommonConstraintSystemForCoroutineInferenceCall.kt") @@ -6694,38 +6678,38 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("epam.kt") - public void testEpam_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/epam.kt", "kotlin.coroutines"); + public void testEpam() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/epam.kt"); } @TestMetadata("falseUnitCoercion.kt") - public void testFalseUnitCoercion_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/falseUnitCoercion.kt", "kotlin.coroutines"); + public void testFalseUnitCoercion() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/falseUnitCoercion.kt"); } @TestMetadata("generate.kt") - public void testGenerate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/generate.kt", "kotlin.coroutines"); + public void testGenerate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/generate.kt"); } @TestMetadata("handleException.kt") - public void testHandleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleException.kt", "kotlin.coroutines"); + public void testHandleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleException.kt"); } @TestMetadata("handleResultCallEmptyBody.kt") - public void testHandleResultCallEmptyBody_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultCallEmptyBody.kt", "kotlin.coroutines"); + public void testHandleResultCallEmptyBody() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleResultCallEmptyBody.kt"); } @TestMetadata("handleResultNonUnitExpression.kt") - public void testHandleResultNonUnitExpression_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultNonUnitExpression.kt", "kotlin.coroutines"); + public void testHandleResultNonUnitExpression() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleResultNonUnitExpression.kt"); } @TestMetadata("handleResultSuspended.kt") - public void testHandleResultSuspended_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultSuspended.kt", "kotlin.coroutines"); + public void testHandleResultSuspended() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleResultSuspended.kt"); } @TestMetadata("illegalState.kt") @@ -6734,93 +6718,93 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("indirectInlineUsedAsNonInline.kt") - public void testIndirectInlineUsedAsNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/indirectInlineUsedAsNonInline.kt", "kotlin.coroutines"); + public void testIndirectInlineUsedAsNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/indirectInlineUsedAsNonInline.kt"); } @TestMetadata("inlineFunInGenericClass.kt") - public void testInlineFunInGenericClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineFunInGenericClass.kt", "kotlin.coroutines"); - } - - @TestMetadata("inlineFunctionInMultifileClassUnoptimized.kt") - public void testInlineFunctionInMultifileClassUnoptimized_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClassUnoptimized.kt", "kotlin.coroutines"); + public void testInlineFunInGenericClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineFunInGenericClass.kt"); } @TestMetadata("inlineFunctionInMultifileClass.kt") - public void testInlineFunctionInMultifileClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClass.kt", "kotlin.coroutines"); + public void testInlineFunctionInMultifileClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClass.kt"); + } + + @TestMetadata("inlineFunctionInMultifileClassUnoptimized.kt") + public void testInlineFunctionInMultifileClassUnoptimized() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClassUnoptimized.kt"); } @TestMetadata("inlineGenericFunCalledFromSubclass.kt") - public void testInlineGenericFunCalledFromSubclass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineGenericFunCalledFromSubclass.kt", "kotlin.coroutines"); + public void testInlineGenericFunCalledFromSubclass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineGenericFunCalledFromSubclass.kt"); } @TestMetadata("inlineSuspendFunction.kt") - public void testInlineSuspendFunction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineSuspendFunction.kt", "kotlin.coroutines"); + public void testInlineSuspendFunction() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineSuspendFunction.kt"); } @TestMetadata("inlineSuspendLambdaNonLocalReturn.kt") - public void testInlineSuspendLambdaNonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineSuspendLambdaNonLocalReturn.kt", "kotlin.coroutines"); + public void testInlineSuspendLambdaNonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineSuspendLambdaNonLocalReturn.kt"); } @TestMetadata("inlinedTryCatchFinally.kt") - public void testInlinedTryCatchFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlinedTryCatchFinally.kt", "kotlin.coroutines"); + public void testInlinedTryCatchFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlinedTryCatchFinally.kt"); } @TestMetadata("innerSuspensionCalls.kt") - public void testInnerSuspensionCalls_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/innerSuspensionCalls.kt", "kotlin.coroutines"); + public void testInnerSuspensionCalls() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/innerSuspensionCalls.kt"); } @TestMetadata("instanceOfContinuation.kt") - public void testInstanceOfContinuation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/instanceOfContinuation.kt", "kotlin.coroutines"); + public void testInstanceOfContinuation() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/instanceOfContinuation.kt"); } @TestMetadata("iterateOverArray.kt") - public void testIterateOverArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/iterateOverArray.kt", "kotlin.coroutines"); + public void testIterateOverArray() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/iterateOverArray.kt"); } @TestMetadata("kt12958.kt") - public void testKt12958_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt12958.kt", "kotlin.coroutines"); + public void testKt12958() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt12958.kt"); } @TestMetadata("kt15016.kt") - public void testKt15016_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15016.kt", "kotlin.coroutines"); + public void testKt15016() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt15016.kt"); } @TestMetadata("kt15017.kt") - public void testKt15017_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15017.kt", "kotlin.coroutines"); + public void testKt15017() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt15017.kt"); } @TestMetadata("kt15930.kt") - public void testKt15930_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15930.kt", "kotlin.coroutines"); + public void testKt15930() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt15930.kt"); } @TestMetadata("kt21605.kt") - public void testKt21605_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt21605.kt", "kotlin.coroutines"); + public void testKt21605() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt21605.kt"); } @TestMetadata("kt25912.kt") - public void testKt25912_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt25912.kt", "kotlin.coroutines"); + public void testKt25912() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt25912.kt"); } @TestMetadata("kt28844.kt") - public void testKt28844_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt28844.kt", "kotlin.coroutines"); + public void testKt28844() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt28844.kt"); } @TestMetadata("kt30858.kt") @@ -6849,23 +6833,23 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("lastExpressionIsLoop.kt") - public void testLastExpressionIsLoop_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt", "kotlin.coroutines"); + public void testLastExpressionIsLoop() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt"); } @TestMetadata("lastStatementInc.kt") - public void testLastStatementInc_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastStatementInc.kt", "kotlin.coroutines"); + public void testLastStatementInc() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastStatementInc.kt"); } @TestMetadata("lastStementAssignment.kt") - public void testLastStementAssignment_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastStementAssignment.kt", "kotlin.coroutines"); + public void testLastStementAssignment() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastStementAssignment.kt"); } @TestMetadata("lastUnitExpression.kt") - public void testLastUnitExpression_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastUnitExpression.kt", "kotlin.coroutines"); + public void testLastUnitExpression() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastUnitExpression.kt"); } @TestMetadata("localCallableRef.kt") @@ -6874,53 +6858,53 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("localDelegate.kt") - public void testLocalDelegate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localDelegate.kt", "kotlin.coroutines"); + public void testLocalDelegate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localDelegate.kt"); } @TestMetadata("longRangeInSuspendCall.kt") - public void testLongRangeInSuspendCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/longRangeInSuspendCall.kt", "kotlin.coroutines"); + public void testLongRangeInSuspendCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/longRangeInSuspendCall.kt"); } @TestMetadata("longRangeInSuspendFun.kt") - public void testLongRangeInSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/longRangeInSuspendFun.kt", "kotlin.coroutines"); + public void testLongRangeInSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/longRangeInSuspendFun.kt"); } @TestMetadata("mergeNullAndString.kt") - public void testMergeNullAndString_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/mergeNullAndString.kt", "kotlin.coroutines"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda1.kt") - public void testMultipleInvokeCallsInsideInlineLambda1_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt", "kotlin.coroutines"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda2.kt") - public void testMultipleInvokeCallsInsideInlineLambda2_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt", "kotlin.coroutines"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda3.kt") - public void testMultipleInvokeCallsInsideInlineLambda3_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt", "kotlin.coroutines"); + public void testMergeNullAndString() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/mergeNullAndString.kt"); } @TestMetadata("multipleInvokeCalls.kt") - public void testMultipleInvokeCalls_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt", "kotlin.coroutines"); + public void testMultipleInvokeCalls() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt"); + } + + @TestMetadata("multipleInvokeCallsInsideInlineLambda1.kt") + public void testMultipleInvokeCallsInsideInlineLambda1() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt"); + } + + @TestMetadata("multipleInvokeCallsInsideInlineLambda2.kt") + public void testMultipleInvokeCallsInsideInlineLambda2() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt"); + } + + @TestMetadata("multipleInvokeCallsInsideInlineLambda3.kt") + public void testMultipleInvokeCallsInsideInlineLambda3() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt"); } @TestMetadata("nestedTryCatch.kt") - public void testNestedTryCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nestedTryCatch.kt", "kotlin.coroutines"); + public void testNestedTryCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/nestedTryCatch.kt"); } @TestMetadata("noSuspensionPoints.kt") - public void testNoSuspensionPoints_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noSuspensionPoints.kt", "kotlin.coroutines"); + public void testNoSuspensionPoints() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/noSuspensionPoints.kt"); } @TestMetadata("nonLocalReturn.kt") @@ -6928,24 +6912,24 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/coroutines/nonLocalReturn.kt"); } - @TestMetadata("nonLocalReturnFromInlineLambdaDeep.kt") - public void testNonLocalReturnFromInlineLambdaDeep_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt", "kotlin.coroutines"); + @TestMetadata("nonLocalReturnFromInlineLambda.kt") + public void testNonLocalReturnFromInlineLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt"); } - @TestMetadata("nonLocalReturnFromInlineLambda.kt") - public void testNonLocalReturnFromInlineLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt", "kotlin.coroutines"); + @TestMetadata("nonLocalReturnFromInlineLambdaDeep.kt") + public void testNonLocalReturnFromInlineLambdaDeep() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt"); } @TestMetadata("overrideDefaultArgument.kt") - public void testOverrideDefaultArgument_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/overrideDefaultArgument.kt", "kotlin.coroutines"); + public void testOverrideDefaultArgument() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/overrideDefaultArgument.kt"); } @TestMetadata("recursiveSuspend.kt") - public void testRecursiveSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/recursiveSuspend.kt", "kotlin.coroutines"); + public void testRecursiveSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/recursiveSuspend.kt"); } @TestMetadata("restrictedSuspendLambda.kt") @@ -6954,13 +6938,18 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("returnByLabel.kt") - public void testReturnByLabel_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/returnByLabel.kt", "kotlin.coroutines"); + public void testReturnByLabel() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/returnByLabel.kt"); + } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/simple.kt"); } @TestMetadata("simpleException.kt") - public void testSimpleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simpleException.kt", "kotlin.coroutines"); + public void testSimpleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/simpleException.kt"); } @TestMetadata("simpleSuspendCallableReference.kt") @@ -6969,18 +6958,13 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("simpleWithHandleResult.kt") - public void testSimpleWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simpleWithHandleResult.kt", "kotlin.coroutines"); - } - - @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simple.kt", "kotlin.coroutines"); + public void testSimpleWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/simpleWithHandleResult.kt"); } @TestMetadata("statementLikeLastExpression.kt") - public void testStatementLikeLastExpression_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/statementLikeLastExpression.kt", "kotlin.coroutines"); + public void testStatementLikeLastExpression() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/statementLikeLastExpression.kt"); } @TestMetadata("stopAfter.kt") @@ -6989,13 +6973,13 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("suspendCallsInArguments.kt") - public void testSuspendCallsInArguments_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendCallsInArguments.kt", "kotlin.coroutines"); + public void testSuspendCallsInArguments() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendCallsInArguments.kt"); } @TestMetadata("suspendCoroutineFromStateMachine.kt") - public void testSuspendCoroutineFromStateMachine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt", "kotlin.coroutines"); + public void testSuspendCoroutineFromStateMachine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt"); } @TestMetadata("suspendCovariantJavaOverrides.kt") @@ -7004,23 +6988,23 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("suspendDefaultImpl.kt") - public void testSuspendDefaultImpl_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendDefaultImpl.kt", "kotlin.coroutines"); + public void testSuspendDefaultImpl() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendDefaultImpl.kt"); } @TestMetadata("suspendDelegation.kt") - public void testSuspendDelegation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendDelegation.kt", "kotlin.coroutines"); + public void testSuspendDelegation() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendDelegation.kt"); } @TestMetadata("suspendFromInlineLambda.kt") - public void testSuspendFromInlineLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt", "kotlin.coroutines"); + public void testSuspendFromInlineLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt"); } @TestMetadata("suspendFunImportedFromObject.kt") - public void testSuspendFunImportedFromObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunImportedFromObject.kt", "kotlin.coroutines"); + public void testSuspendFunImportedFromObject() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunImportedFromObject.kt"); } @TestMetadata("suspendFunctionMethodReference.kt") @@ -7034,23 +7018,23 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("suspendInCycle.kt") - public void testSuspendInCycle_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInCycle.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt") - public void testSuspendInTheMiddleOfObjectConstructionEvaluationOrder_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendInTheMiddleOfObjectConstructionWithJumpOut.kt") - public void testSuspendInTheMiddleOfObjectConstructionWithJumpOut_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionWithJumpOut.kt", "kotlin.coroutines"); + public void testSuspendInCycle() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInCycle.kt"); } @TestMetadata("suspendInTheMiddleOfObjectConstruction.kt") - public void testSuspendInTheMiddleOfObjectConstruction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt", "kotlin.coroutines"); + public void testSuspendInTheMiddleOfObjectConstruction() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt"); + } + + @TestMetadata("suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt") + public void testSuspendInTheMiddleOfObjectConstructionEvaluationOrder() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt"); + } + + @TestMetadata("suspendInTheMiddleOfObjectConstructionWithJumpOut.kt") + public void testSuspendInTheMiddleOfObjectConstructionWithJumpOut() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionWithJumpOut.kt"); } @TestMetadata("suspendJavaOverrides.kt") @@ -7064,8 +7048,8 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("suspendLambdaWithArgumentRearrangement.kt") - public void testSuspendLambdaWithArgumentRearrangement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendLambdaWithArgumentRearrangement.kt", "kotlin.coroutines"); + public void testSuspendLambdaWithArgumentRearrangement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendLambdaWithArgumentRearrangement.kt"); } @TestMetadata("suspendReturningPlatformType.kt") @@ -7073,14 +7057,14 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/coroutines/suspendReturningPlatformType.kt"); } - @TestMetadata("suspensionInsideSafeCallWithElvis.kt") - public void testSuspensionInsideSafeCallWithElvis_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt", "kotlin.coroutines"); + @TestMetadata("suspensionInsideSafeCall.kt") + public void testSuspensionInsideSafeCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCall.kt"); } - @TestMetadata("suspensionInsideSafeCall.kt") - public void testSuspensionInsideSafeCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCall.kt", "kotlin.coroutines"); + @TestMetadata("suspensionInsideSafeCallWithElvis.kt") + public void testSuspensionInsideSafeCallWithElvis() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt"); } @TestMetadata("tailCallToNothing.kt") @@ -7089,38 +7073,38 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("tryCatchFinallyWithHandleResult.kt") - public void testTryCatchFinallyWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt", "kotlin.coroutines"); + public void testTryCatchFinallyWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt"); } @TestMetadata("tryCatchWithHandleResult.kt") - public void testTryCatchWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryCatchWithHandleResult.kt", "kotlin.coroutines"); + public void testTryCatchWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryCatchWithHandleResult.kt"); } @TestMetadata("tryFinallyInsideInlineLambda.kt") - public void testTryFinallyInsideInlineLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt", "kotlin.coroutines"); + public void testTryFinallyInsideInlineLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt"); } @TestMetadata("tryFinallyWithHandleResult.kt") - public void testTryFinallyWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryFinallyWithHandleResult.kt", "kotlin.coroutines"); + public void testTryFinallyWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryFinallyWithHandleResult.kt"); } @TestMetadata("varCaptuedInCoroutineIntrinsic.kt") - public void testVarCaptuedInCoroutineIntrinsic_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varCaptuedInCoroutineIntrinsic.kt", "kotlin.coroutines"); - } - - @TestMetadata("varValueConflictsWithTableSameSort.kt") - public void testVarValueConflictsWithTableSameSort_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt", "kotlin.coroutines"); + public void testVarCaptuedInCoroutineIntrinsic() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varCaptuedInCoroutineIntrinsic.kt"); } @TestMetadata("varValueConflictsWithTable.kt") - public void testVarValueConflictsWithTable_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varValueConflictsWithTable.kt", "kotlin.coroutines"); + public void testVarValueConflictsWithTable() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varValueConflictsWithTable.kt"); + } + + @TestMetadata("varValueConflictsWithTableSameSort.kt") + public void testVarValueConflictsWithTableSameSort() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt"); } @TestMetadata("compiler/testData/codegen/box/coroutines/bridges") @@ -7131,27 +7115,23 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInBridges() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/bridges"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("interfaceSpecialization.kt") - public void testInterfaceSpecialization_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/interfaceSpecialization.kt", "kotlin.coroutines"); + public void testInterfaceSpecialization() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/bridges/interfaceSpecialization.kt"); } @TestMetadata("lambdaWithLongReceiver.kt") - public void testLambdaWithLongReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/lambdaWithLongReceiver.kt", "kotlin.coroutines"); + public void testLambdaWithLongReceiver() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithLongReceiver.kt"); } @TestMetadata("lambdaWithMultipleParameters.kt") - public void testLambdaWithMultipleParameters_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt", "kotlin.coroutines"); + public void testLambdaWithMultipleParameters() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt"); } } @@ -7163,62 +7143,58 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInControlFlow() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/controlFlow"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("breakFinally.kt") - public void testBreakFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/breakFinally.kt", "kotlin.coroutines"); + public void testBreakFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/breakFinally.kt"); } @TestMetadata("breakStatement.kt") - public void testBreakStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/breakStatement.kt", "kotlin.coroutines"); + public void testBreakStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/breakStatement.kt"); } @TestMetadata("complexChainSuspend.kt") - public void testComplexChainSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/complexChainSuspend.kt", "kotlin.coroutines"); + public void testComplexChainSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/complexChainSuspend.kt"); } @TestMetadata("doWhileStatement.kt") - public void testDoWhileStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/doWhileStatement.kt", "kotlin.coroutines"); + public void testDoWhileStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/doWhileStatement.kt"); } @TestMetadata("doubleBreak.kt") - public void testDoubleBreak_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/doubleBreak.kt", "kotlin.coroutines"); + public void testDoubleBreak() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/doubleBreak.kt"); } @TestMetadata("finallyCatch.kt") - public void testFinallyCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/finallyCatch.kt", "kotlin.coroutines"); + public void testFinallyCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/finallyCatch.kt"); } @TestMetadata("forContinue.kt") - public void testForContinue_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forContinue.kt", "kotlin.coroutines"); + public void testForContinue() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/forContinue.kt"); } @TestMetadata("forStatement.kt") - public void testForStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forStatement.kt", "kotlin.coroutines"); + public void testForStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/forStatement.kt"); } @TestMetadata("forWithStep.kt") - public void testForWithStep_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forWithStep.kt", "kotlin.coroutines"); + public void testForWithStep() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/forWithStep.kt"); } @TestMetadata("ifStatement.kt") - public void testIfStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt", "kotlin.coroutines"); + public void testIfStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt"); } @TestMetadata("kt22694_1_3.kt") @@ -7227,58 +7203,58 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("labeledWhile.kt") - public void testLabeledWhile_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/labeledWhile.kt", "kotlin.coroutines"); + public void testLabeledWhile() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/labeledWhile.kt"); } @TestMetadata("multipleCatchBlocksSuspend.kt") - public void testMultipleCatchBlocksSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/multipleCatchBlocksSuspend.kt", "kotlin.coroutines"); + public void testMultipleCatchBlocksSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/multipleCatchBlocksSuspend.kt"); } @TestMetadata("returnFromFinally.kt") - public void testReturnFromFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/returnFromFinally.kt", "kotlin.coroutines"); + public void testReturnFromFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/returnFromFinally.kt"); } @TestMetadata("returnWithFinally.kt") - public void testReturnWithFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/returnWithFinally.kt", "kotlin.coroutines"); + public void testReturnWithFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/returnWithFinally.kt"); } @TestMetadata("suspendInStringTemplate.kt") - public void testSuspendInStringTemplate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/suspendInStringTemplate.kt", "kotlin.coroutines"); + public void testSuspendInStringTemplate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/suspendInStringTemplate.kt"); } @TestMetadata("switchLikeWhen.kt") - public void testSwitchLikeWhen_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/switchLikeWhen.kt", "kotlin.coroutines"); + public void testSwitchLikeWhen() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/switchLikeWhen.kt"); } @TestMetadata("throwFromCatch.kt") - public void testThrowFromCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwFromCatch.kt", "kotlin.coroutines"); + public void testThrowFromCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/throwFromCatch.kt"); } @TestMetadata("throwFromFinally.kt") - public void testThrowFromFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwFromFinally.kt", "kotlin.coroutines"); + public void testThrowFromFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/throwFromFinally.kt"); } @TestMetadata("throwInTryWithHandleResult.kt") - public void testThrowInTryWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt", "kotlin.coroutines"); + public void testThrowInTryWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt"); } @TestMetadata("whenWithSuspensions.kt") - public void testWhenWithSuspensions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/whenWithSuspensions.kt", "kotlin.coroutines"); + public void testWhenWithSuspensions() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/whenWithSuspensions.kt"); } @TestMetadata("whileStatement.kt") - public void testWhileStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/whileStatement.kt", "kotlin.coroutines"); + public void testWhileStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/whileStatement.kt"); } } @@ -7343,17 +7319,13 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInFeatureIntersection() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/featureIntersection"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("breakWithNonEmptyStack.kt") - public void testBreakWithNonEmptyStack_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt", "kotlin.coroutines"); + public void testBreakWithNonEmptyStack() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt"); } @TestMetadata("defaultExpect.kt") @@ -7362,13 +7334,13 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("delegate.kt") - public void testDelegate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt", "kotlin.coroutines"); + public void testDelegate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt"); } @TestMetadata("destructuringInLambdas.kt") - public void testDestructuringInLambdas_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt", "kotlin.coroutines"); + public void testDestructuringInLambdas() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt"); } @TestMetadata("funInterface.kt") @@ -7377,8 +7349,8 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("inlineSuspendFinally.kt") - public void testInlineSuspendFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/inlineSuspendFinally.kt", "kotlin.coroutines"); + public void testInlineSuspendFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/inlineSuspendFinally.kt"); } @TestMetadata("interfaceMethodWithBody.kt") @@ -7396,19 +7368,19 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/coroutines/featureIntersection/overrideInInlineClass.kt"); } - @TestMetadata("safeCallOnTwoReceiversLong.kt") - public void testSafeCallOnTwoReceiversLong_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt", "kotlin.coroutines"); + @TestMetadata("safeCallOnTwoReceivers.kt") + public void testSafeCallOnTwoReceivers() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt"); } - @TestMetadata("safeCallOnTwoReceivers.kt") - public void testSafeCallOnTwoReceivers_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt", "kotlin.coroutines"); + @TestMetadata("safeCallOnTwoReceiversLong.kt") + public void testSafeCallOnTwoReceiversLong() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt"); } @TestMetadata("suspendDestructuringInLambdas.kt") - public void testSuspendDestructuringInLambdas_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt", "kotlin.coroutines"); + public void testSuspendDestructuringInLambdas() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt"); } @TestMetadata("suspendFunctionIsAs.kt") @@ -7417,23 +7389,23 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("suspendInlineSuspendFinally.kt") - public void testSuspendInlineSuspendFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendInlineSuspendFinally.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendOperatorPlusAssign.kt") - public void testSuspendOperatorPlusAssign_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusAssign.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendOperatorPlusCallFromLambda.kt") - public void testSuspendOperatorPlusCallFromLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusCallFromLambda.kt", "kotlin.coroutines"); + public void testSuspendInlineSuspendFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendInlineSuspendFinally.kt"); } @TestMetadata("suspendOperatorPlus.kt") - public void testSuspendOperatorPlus_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlus.kt", "kotlin.coroutines"); + public void testSuspendOperatorPlus() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlus.kt"); + } + + @TestMetadata("suspendOperatorPlusAssign.kt") + public void testSuspendOperatorPlusAssign() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusAssign.kt"); + } + + @TestMetadata("suspendOperatorPlusCallFromLambda.kt") + public void testSuspendOperatorPlusCallFromLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusCallFromLambda.kt"); } @TestMetadata("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference") @@ -7444,17 +7416,13 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInCallableReference() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("bigArity.kt") - public void testBigArity_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/bigArity.kt", "kotlin.coroutines"); + public void testBigArity() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/bigArity.kt"); } @TestMetadata("fromJava.kt") @@ -7540,77 +7508,73 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInTailrec() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("controlFlowIf.kt") - public void testControlFlowIf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowIf.kt", "kotlin.coroutines"); + public void testControlFlowIf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowIf.kt"); } @TestMetadata("controlFlowWhen.kt") - public void testControlFlowWhen_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowWhen.kt", "kotlin.coroutines"); + public void testControlFlowWhen() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowWhen.kt"); } @TestMetadata("extention.kt") - public void testExtention_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/extention.kt", "kotlin.coroutines"); + public void testExtention() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/extention.kt"); } @TestMetadata("infixCall.kt") - public void testInfixCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixCall.kt", "kotlin.coroutines"); + public void testInfixCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixCall.kt"); } @TestMetadata("infixRecursiveCall.kt") - public void testInfixRecursiveCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixRecursiveCall.kt", "kotlin.coroutines"); + public void testInfixRecursiveCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixRecursiveCall.kt"); } @TestMetadata("realIteratorFoldl.kt") - public void testRealIteratorFoldl_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realIteratorFoldl.kt", "kotlin.coroutines"); + public void testRealIteratorFoldl() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realIteratorFoldl.kt"); } @TestMetadata("realStringEscape.kt") - public void testRealStringEscape_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringEscape.kt", "kotlin.coroutines"); + public void testRealStringEscape() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringEscape.kt"); } @TestMetadata("realStringRepeat.kt") - public void testRealStringRepeat_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringRepeat.kt", "kotlin.coroutines"); + public void testRealStringRepeat() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringRepeat.kt"); } @TestMetadata("returnInParentheses.kt") - public void testReturnInParentheses_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/returnInParentheses.kt", "kotlin.coroutines"); + public void testReturnInParentheses() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/returnInParentheses.kt"); } @TestMetadata("sum.kt") - public void testSum_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/sum.kt", "kotlin.coroutines"); + public void testSum() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/sum.kt"); } @TestMetadata("tailCallInBlockInParentheses.kt") - public void testTailCallInBlockInParentheses_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInBlockInParentheses.kt", "kotlin.coroutines"); + public void testTailCallInBlockInParentheses() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInBlockInParentheses.kt"); } @TestMetadata("tailCallInParentheses.kt") - public void testTailCallInParentheses_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInParentheses.kt", "kotlin.coroutines"); + public void testTailCallInParentheses() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInParentheses.kt"); } @TestMetadata("whenWithIs.kt") - public void testWhenWithIs_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/whenWithIs.kt", "kotlin.coroutines"); + public void testWhenWithIs() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/whenWithIs.kt"); } } } @@ -7640,10 +7604,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInDirect() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses/direct"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @@ -7659,58 +7619,58 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Any.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineInt() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineInt.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Int.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Long() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Long.kt"); } @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_NAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_NAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_nonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_nonLocalReturn.kt"); } @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_suspendFunType() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_suspendFunType.kt"); } @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationCrossinline.kt", "kotlin.coroutines"); + public void testBridgeGenerationCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationCrossinline.kt"); } @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationNonInline.kt", "kotlin.coroutines"); + public void testBridgeGenerationNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationNonInline.kt"); } @TestMetadata("covariantOverrideSuspendFun.kt") @@ -7824,8 +7784,8 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); + public void testInterfaceDelegateWithInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt"); } @TestMetadata("invokeOperator.kt") @@ -7834,28 +7794,28 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt"); } @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any.kt"); } @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_itf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_itf.kt"); } @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_this.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_this() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_this.kt"); } @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Int.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Int.kt"); } @TestMetadata("returnResult.kt") @@ -7872,10 +7832,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInResume() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses/resume"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @@ -7891,58 +7847,58 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Any.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineInt() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineInt.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Int.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Long() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Long.kt"); } @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_NAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_NAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_nonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_nonLocalReturn.kt"); } @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_suspendFunType() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_suspendFunType.kt"); } @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationCrossinline.kt", "kotlin.coroutines"); + public void testBridgeGenerationCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationCrossinline.kt"); } @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationNonInline.kt", "kotlin.coroutines"); + public void testBridgeGenerationNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationNonInline.kt"); } @TestMetadata("covariantOverrideSuspendFun.kt") @@ -8056,8 +8012,8 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); + public void testInterfaceDelegateWithInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt"); } @TestMetadata("invokeOperator.kt") @@ -8066,28 +8022,28 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt"); } @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any.kt"); } @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_itf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_itf.kt"); } @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_this.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_this() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_this.kt"); } @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Int.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Int.kt"); } @TestMetadata("returnResult.kt") @@ -8104,10 +8060,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInResumeWithException() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @@ -8123,58 +8075,58 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Any.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineInt() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineInt.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Int.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Long() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Long.kt"); } @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_NAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_NAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_nonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_nonLocalReturn.kt"); } @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_suspendFunType() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_suspendFunType.kt"); } @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationCrossinline.kt", "kotlin.coroutines"); + public void testBridgeGenerationCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationCrossinline.kt"); } @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationNonInline.kt", "kotlin.coroutines"); + public void testBridgeGenerationNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationNonInline.kt"); } @TestMetadata("covariantOverrideSuspendFun.kt") @@ -8273,8 +8225,8 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); + public void testInterfaceDelegateWithInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt"); } @TestMetadata("invokeOperator.kt") @@ -8283,28 +8235,28 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt"); } @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any.kt"); } @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_itf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_itf.kt"); } @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_this.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_this() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_this.kt"); } @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Int.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Int.kt"); } @TestMetadata("returnResult.kt") @@ -8322,22 +8274,18 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInIntLikeVarSpilling() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/intLikeVarSpilling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("complicatedMerge.kt") - public void testComplicatedMerge_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt", "kotlin.coroutines"); + public void testComplicatedMerge() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt"); } @TestMetadata("i2bResult.kt") - public void testI2bResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines"); + public void testI2bResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt"); } @TestMetadata("listThrowablePairInOneSlot.kt") @@ -8346,43 +8294,43 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("loadFromBooleanArray.kt") - public void testLoadFromBooleanArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines"); + public void testLoadFromBooleanArray() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt"); } @TestMetadata("loadFromByteArray.kt") - public void testLoadFromByteArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt", "kotlin.coroutines"); + public void testLoadFromByteArray() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt"); } @TestMetadata("noVariableInTable.kt") - public void testNoVariableInTable_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt", "kotlin.coroutines"); + public void testNoVariableInTable() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt"); } @TestMetadata("sameIconst1ManyVars.kt") - public void testSameIconst1ManyVars_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt", "kotlin.coroutines"); + public void testSameIconst1ManyVars() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt"); } @TestMetadata("usedInArrayStore.kt") - public void testUsedInArrayStore_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInArrayStore.kt", "kotlin.coroutines"); + public void testUsedInArrayStore() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInArrayStore.kt"); } @TestMetadata("usedInMethodCall.kt") - public void testUsedInMethodCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt", "kotlin.coroutines"); + public void testUsedInMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt"); } @TestMetadata("usedInPutfield.kt") - public void testUsedInPutfield_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInPutfield.kt", "kotlin.coroutines"); + public void testUsedInPutfield() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInPutfield.kt"); } @TestMetadata("usedInVarStore.kt") - public void testUsedInVarStore_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt", "kotlin.coroutines"); + public void testUsedInVarStore() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt"); } } @@ -8394,52 +8342,48 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInIntrinsicSemantics() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/intrinsicSemantics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } - @TestMetadata("coroutineContextReceiverNotIntrinsic.kt") - public void testCoroutineContextReceiverNotIntrinsic_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiverNotIntrinsic.kt", "kotlin.coroutines"); + @TestMetadata("coroutineContext.kt") + public void testCoroutineContext() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContext.kt"); } @TestMetadata("coroutineContextReceiver.kt") - public void testCoroutineContextReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiver.kt", "kotlin.coroutines"); + public void testCoroutineContextReceiver() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiver.kt"); } - @TestMetadata("coroutineContext.kt") - public void testCoroutineContext_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContext.kt", "kotlin.coroutines"); + @TestMetadata("coroutineContextReceiverNotIntrinsic.kt") + public void testCoroutineContextReceiverNotIntrinsic() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiverNotIntrinsic.kt"); } @TestMetadata("intercepted.kt") - public void testIntercepted_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/intercepted.kt", "kotlin.coroutines"); - } - - @TestMetadata("startCoroutineUninterceptedOrReturnInterception.kt") - public void testStartCoroutineUninterceptedOrReturnInterception_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt", "kotlin.coroutines"); - } - - @TestMetadata("startCoroutineUninterceptedOrReturn.kt") - public void testStartCoroutineUninterceptedOrReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt", "kotlin.coroutines"); + public void testIntercepted() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/intercepted.kt"); } @TestMetadata("startCoroutine.kt") - public void testStartCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt", "kotlin.coroutines"); + public void testStartCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt"); + } + + @TestMetadata("startCoroutineUninterceptedOrReturn.kt") + public void testStartCoroutineUninterceptedOrReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt"); + } + + @TestMetadata("startCoroutineUninterceptedOrReturnInterception.kt") + public void testStartCoroutineUninterceptedOrReturnInterception() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt"); } @TestMetadata("suspendCoroutineUninterceptedOrReturn.kt") - public void testSuspendCoroutineUninterceptedOrReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/suspendCoroutineUninterceptedOrReturn.kt", "kotlin.coroutines"); + public void testSuspendCoroutineUninterceptedOrReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/suspendCoroutineUninterceptedOrReturn.kt"); } } @@ -8451,37 +8395,33 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInJavaInterop() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("objectWithSeveralSuspends.kt") - public void testObjectWithSeveralSuspends_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/objectWithSeveralSuspends.kt", "kotlin.coroutines"); + public void testObjectWithSeveralSuspends() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/javaInterop/objectWithSeveralSuspends.kt"); } @TestMetadata("returnLambda.kt") - public void testReturnLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/returnLambda.kt", "kotlin.coroutines"); + public void testReturnLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/javaInterop/returnLambda.kt"); } @TestMetadata("returnObject.kt") - public void testReturnObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/returnObject.kt", "kotlin.coroutines"); + public void testReturnObject() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/javaInterop/returnObject.kt"); } @TestMetadata("severalCaptures.kt") - public void testSeveralCaptures_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/severalCaptures.kt", "kotlin.coroutines"); + public void testSeveralCaptures() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/javaInterop/severalCaptures.kt"); } @TestMetadata("suspendInlineWithCrossinline.kt") - public void testSuspendInlineWithCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/suspendInlineWithCrossinline.kt", "kotlin.coroutines"); + public void testSuspendInlineWithCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/javaInterop/suspendInlineWithCrossinline.kt"); } } @@ -8505,17 +8445,13 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInAnonymous() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/localFunctions/anonymous"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/anonymous/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/anonymous/simple.kt"); } } @@ -8527,42 +8463,38 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInNamed() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/localFunctions/named"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("capturedParameters.kt") - public void testCapturedParameters_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedParameters.kt", "kotlin.coroutines"); + public void testCapturedParameters() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedParameters.kt"); } @TestMetadata("capturedVariables.kt") - public void testCapturedVariables_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedVariables.kt", "kotlin.coroutines"); + public void testCapturedVariables() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedVariables.kt"); } @TestMetadata("extension.kt") - public void testExtension_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/extension.kt", "kotlin.coroutines"); + public void testExtension() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/extension.kt"); } @TestMetadata("infix.kt") - public void testInfix_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/infix.kt", "kotlin.coroutines"); + public void testInfix() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/infix.kt"); } @TestMetadata("insideLambda.kt") - public void testInsideLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/insideLambda.kt", "kotlin.coroutines"); + public void testInsideLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/insideLambda.kt"); } @TestMetadata("nestedLocals.kt") - public void testNestedLocals_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/nestedLocals.kt", "kotlin.coroutines"); + public void testNestedLocals() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/nestedLocals.kt"); } @TestMetadata("rec.kt") @@ -8570,24 +8502,24 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/rec.kt"); } - @TestMetadata("simpleSuspensionPoint.kt") - public void testSimpleSuspensionPoint_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/simpleSuspensionPoint.kt", "kotlin.coroutines"); + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/simple.kt"); } - @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/simple.kt", "kotlin.coroutines"); + @TestMetadata("simpleSuspensionPoint.kt") + public void testSimpleSuspensionPoint() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/simpleSuspensionPoint.kt"); } @TestMetadata("stateMachine.kt") - public void testStateMachine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/stateMachine.kt", "kotlin.coroutines"); + public void testStateMachine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/stateMachine.kt"); } @TestMetadata("withArguments.kt") - public void testWithArguments_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/withArguments.kt", "kotlin.coroutines"); + public void testWithArguments() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/withArguments.kt"); } } } @@ -8600,47 +8532,43 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInMultiModule() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("inlineCrossModule.kt") - public void testInlineCrossModule_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt", "kotlin.coroutines"); + public void testInlineCrossModule() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt"); } @TestMetadata("inlineFunctionWithOptionalParam.kt") - public void testInlineFunctionWithOptionalParam_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt", "kotlin.coroutines"); - } - - @TestMetadata("inlineMultiModuleOverride.kt") - public void testInlineMultiModuleOverride_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleOverride.kt", "kotlin.coroutines"); - } - - @TestMetadata("inlineMultiModuleWithController.kt") - public void testInlineMultiModuleWithController_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithController.kt", "kotlin.coroutines"); - } - - @TestMetadata("inlineMultiModuleWithInnerInlining.kt") - public void testInlineMultiModuleWithInnerInlining_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithInnerInlining.kt", "kotlin.coroutines"); + public void testInlineFunctionWithOptionalParam() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt"); } @TestMetadata("inlineMultiModule.kt") - public void testInlineMultiModule_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModule.kt", "kotlin.coroutines"); + public void testInlineMultiModule() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModule.kt"); + } + + @TestMetadata("inlineMultiModuleOverride.kt") + public void testInlineMultiModuleOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleOverride.kt"); + } + + @TestMetadata("inlineMultiModuleWithController.kt") + public void testInlineMultiModuleWithController() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithController.kt"); + } + + @TestMetadata("inlineMultiModuleWithInnerInlining.kt") + public void testInlineMultiModuleWithInnerInlining() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithInnerInlining.kt"); } @TestMetadata("inlineTailCall.kt") - public void testInlineTailCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineTailCall.kt", "kotlin.coroutines"); + public void testInlineTailCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineTailCall.kt"); } @TestMetadata("inlineWithJava.kt") @@ -8649,8 +8577,8 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/simple.kt"); } } @@ -8662,17 +8590,13 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInRedundantLocalsElimination() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/redundantLocalsElimination"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("ktor_receivedMessage.kt") - public void testKtor_receivedMessage_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/redundantLocalsElimination/ktor_receivedMessage.kt", "kotlin.coroutines"); + public void testKtor_receivedMessage() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/redundantLocalsElimination/ktor_receivedMessage.kt"); } } @@ -8712,42 +8636,38 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInStackUnwinding() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/stackUnwinding"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("exception.kt") - public void testException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/exception.kt", "kotlin.coroutines"); + public void testException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/exception.kt"); } @TestMetadata("inlineSuspendFunction.kt") - public void testInlineSuspendFunction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt", "kotlin.coroutines"); - } - - @TestMetadata("rethrowInFinallyWithSuspension.kt") - public void testRethrowInFinallyWithSuspension_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinallyWithSuspension.kt", "kotlin.coroutines"); + public void testInlineSuspendFunction() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt"); } @TestMetadata("rethrowInFinally.kt") - public void testRethrowInFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinally.kt", "kotlin.coroutines"); + public void testRethrowInFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinally.kt"); + } + + @TestMetadata("rethrowInFinallyWithSuspension.kt") + public void testRethrowInFinallyWithSuspension() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinallyWithSuspension.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt"); } @TestMetadata("suspendInCycle.kt") - public void testSuspendInCycle_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt", "kotlin.coroutines"); + public void testSuspendInCycle() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt"); } } @@ -8792,22 +8712,18 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInSuspendFunctionAsCoroutine() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("dispatchResume.kt") - public void testDispatchResume_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt", "kotlin.coroutines"); + public void testDispatchResume() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt"); } @TestMetadata("handleException.kt") - public void testHandleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt", "kotlin.coroutines"); + public void testHandleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt"); } @TestMetadata("ifExpressionInsideCoroutine_1_3.kt") @@ -8815,24 +8731,24 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine_1_3.kt"); } - @TestMetadata("inlineTwoReceivers.kt") - public void testInlineTwoReceivers_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt", "kotlin.coroutines"); + @TestMetadata("inline.kt") + public void testInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt"); } - @TestMetadata("inline.kt") - public void testInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt", "kotlin.coroutines"); + @TestMetadata("inlineTwoReceivers.kt") + public void testInlineTwoReceivers() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt"); } @TestMetadata("member.kt") - public void testMember_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt", "kotlin.coroutines"); + public void testMember() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt"); } @TestMetadata("noinlineTwoReceivers.kt") - public void testNoinlineTwoReceivers_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt", "kotlin.coroutines"); + public void testNoinlineTwoReceivers() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt"); } @TestMetadata("openFunWithJava.kt") @@ -8841,53 +8757,53 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("operators.kt") - public void testOperators_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt", "kotlin.coroutines"); + public void testOperators() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt"); } @TestMetadata("privateFunctions.kt") - public void testPrivateFunctions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt", "kotlin.coroutines"); + public void testPrivateFunctions() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt"); } @TestMetadata("privateInFile.kt") - public void testPrivateInFile_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt", "kotlin.coroutines"); + public void testPrivateInFile() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt"); } @TestMetadata("returnNoSuspend.kt") - public void testReturnNoSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt", "kotlin.coroutines"); + public void testReturnNoSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt", "kotlin.coroutines"); - } - - @TestMetadata("superCallAbstractClass.kt") - public void testSuperCallAbstractClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallAbstractClass.kt", "kotlin.coroutines"); - } - - @TestMetadata("superCallInterface.kt") - public void testSuperCallInterface_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallInterface.kt", "kotlin.coroutines"); - } - - @TestMetadata("superCallOverload.kt") - public void testSuperCallOverload_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallOverload.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt"); } @TestMetadata("superCall.kt") - public void testSuperCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt", "kotlin.coroutines"); + public void testSuperCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt"); + } + + @TestMetadata("superCallAbstractClass.kt") + public void testSuperCallAbstractClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallAbstractClass.kt"); + } + + @TestMetadata("superCallInterface.kt") + public void testSuperCallInterface() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallInterface.kt"); + } + + @TestMetadata("superCallOverload.kt") + public void testSuperCallOverload() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallOverload.kt"); } @TestMetadata("withVariables.kt") - public void testWithVariables_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt", "kotlin.coroutines"); + public void testWithVariables() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt"); } } @@ -8899,37 +8815,33 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInSuspendFunctionTypeCall() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("localVal.kt") - public void testLocalVal_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt", "kotlin.coroutines"); - } - - @TestMetadata("manyParametersNoCapture.kt") - public void testManyParametersNoCapture_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParametersNoCapture.kt", "kotlin.coroutines"); + public void testLocalVal() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt"); } @TestMetadata("manyParameters.kt") - public void testManyParameters_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt", "kotlin.coroutines"); + public void testManyParameters() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt"); + } + + @TestMetadata("manyParametersNoCapture.kt") + public void testManyParametersNoCapture() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParametersNoCapture.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt"); } @TestMetadata("suspendModifier.kt") - public void testSuspendModifier_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt", "kotlin.coroutines"); + public void testSuspendModifier() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt"); } } @@ -8941,10 +8853,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInTailCallOptimizations() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/tailCallOptimizations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @@ -8955,8 +8863,8 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("crossinline.kt") - public void testCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/crossinline.kt", "kotlin.coroutines"); + public void testCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/crossinline.kt"); } @TestMetadata("inlineWithStateMachine.kt") @@ -8965,13 +8873,13 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("inlineWithoutStateMachine.kt") - public void testInlineWithoutStateMachine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt", "kotlin.coroutines"); + public void testInlineWithoutStateMachine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt"); } @TestMetadata("innerObjectRetransformation.kt") - public void testInnerObjectRetransformation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation.kt", "kotlin.coroutines"); + public void testInnerObjectRetransformation() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation.kt"); } @TestMetadata("interfaceDelegation.kt") @@ -9004,16 +8912,16 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/tailSuspendUnitFun.kt"); } + @TestMetadata("tryCatch.kt") + public void testTryCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/tryCatch.kt"); + } + @TestMetadata("tryCatchTailCall.kt") public void testTryCatchTailCall() throws Exception { runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/tryCatchTailCall.kt"); } - @TestMetadata("tryCatch.kt") - public void testTryCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/tryCatch.kt", "kotlin.coroutines"); - } - @TestMetadata("unreachable.kt") public void testUnreachable() throws Exception { runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/unreachable.kt"); @@ -9101,32 +9009,28 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInTailOperations() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/tailOperations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("suspendWithIf.kt") - public void testSuspendWithIf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithIf.kt", "kotlin.coroutines"); + public void testSuspendWithIf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithIf.kt"); } @TestMetadata("suspendWithTryCatch.kt") - public void testSuspendWithTryCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt", "kotlin.coroutines"); + public void testSuspendWithTryCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt"); } @TestMetadata("suspendWithWhen.kt") - public void testSuspendWithWhen_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithWhen.kt", "kotlin.coroutines"); + public void testSuspendWithWhen() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithWhen.kt"); } @TestMetadata("tailInlining.kt") - public void testTailInlining_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/tailInlining.kt", "kotlin.coroutines"); + public void testTailInlining() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/tailInlining.kt"); } } @@ -9138,22 +9042,18 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInUnitTypeReturn() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/unitTypeReturn"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("coroutineNonLocalReturn.kt") - public void testCoroutineNonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt", "kotlin.coroutines"); + public void testCoroutineNonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt"); } @TestMetadata("coroutineReturn.kt") - public void testCoroutineReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt", "kotlin.coroutines"); + public void testCoroutineReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt"); } @TestMetadata("inlineUnitFunction.kt") @@ -9167,18 +9067,18 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("suspendNonLocalReturn.kt") - public void testSuspendNonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt", "kotlin.coroutines"); + public void testSuspendNonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt"); } @TestMetadata("suspendReturn.kt") - public void testSuspendReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt", "kotlin.coroutines"); + public void testSuspendReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt"); } @TestMetadata("unitSafeCall.kt") - public void testUnitSafeCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/unitSafeCall.kt", "kotlin.coroutines"); + public void testUnitSafeCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/unitSafeCall.kt"); } } @@ -9190,10 +9090,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInVarSpilling() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/varSpilling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @@ -9204,18 +9100,18 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("kt19475.kt") - public void testKt19475_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/kt19475.kt", "kotlin.coroutines"); + public void testKt19475() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt19475.kt"); } @TestMetadata("kt38925.kt") - public void testKt38925_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/kt38925.kt", "kotlin.coroutines"); + public void testKt38925() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt38925.kt"); } @TestMetadata("nullSpilling.kt") - public void testNullSpilling_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/nullSpilling.kt", "kotlin.coroutines"); + public void testNullSpilling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/nullSpilling.kt"); } @TestMetadata("refinedIntTypesAnalysis.kt") @@ -20396,10 +20292,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInParametersMetadata() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/parametersMetadata"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @@ -20450,8 +20342,8 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @TestMetadata("suspendFunction.kt") - public void testSuspendFunction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/parametersMetadata/suspendFunction.kt", "kotlin.coroutines"); + public void testSuspendFunction() throws Exception { + runTest("compiler/testData/codegen/box/parametersMetadata/suspendFunction.kt"); } } diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxInlineCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxInlineCodegenTestGenerated.java index 3ed7216e2d4..cab38e83de3 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxInlineCodegenTestGenerated.java @@ -3967,22 +3967,18 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInSuspend() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("capturedVariables.kt") - public void testCapturedVariables_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/capturedVariables.kt", "kotlin.coroutines"); + public void testCapturedVariables() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/capturedVariables.kt"); } @TestMetadata("crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt") - public void testCrossinlineSuspendLambdaInsideCrossinlineSuspendLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt", "kotlin.coroutines"); + public void testCrossinlineSuspendLambdaInsideCrossinlineSuspendLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt"); } @TestMetadata("debugMetadataCrossinline.kt") @@ -3991,18 +3987,18 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn } @TestMetadata("delegatedProperties.kt") - public void testDelegatedProperties_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt", "kotlin.coroutines"); + public void testDelegatedProperties() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt"); } @TestMetadata("doubleRegenerationWithNonSuspendingLambda.kt") - public void testDoubleRegenerationWithNonSuspendingLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt", "kotlin.coroutines"); + public void testDoubleRegenerationWithNonSuspendingLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt"); } @TestMetadata("enclodingMethod.kt") - public void testEnclodingMethod_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/enclodingMethod.kt", "kotlin.coroutines"); + public void testEnclodingMethod() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/enclodingMethod.kt"); } @TestMetadata("fileNameInMetadata.kt") @@ -4011,18 +4007,18 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn } @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendContinuation.kt") - public void testInlineSuspendContinuation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendContinuation.kt", "kotlin.coroutines"); + public void testInlineSuspendContinuation() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendContinuation.kt"); } @TestMetadata("inlineSuspendInMultifileClass.kt") @@ -4031,38 +4027,38 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn } @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt"); } @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt"); } @TestMetadata("jvmName.kt") - public void testJvmName_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/jvmName.kt", "kotlin.coroutines"); + public void testJvmName() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/jvmName.kt"); } @TestMetadata("kt26658.kt") @@ -4071,18 +4067,18 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn } @TestMetadata("maxStackWithCrossinline.kt") - public void testMaxStackWithCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt", "kotlin.coroutines"); + public void testMaxStackWithCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt"); } @TestMetadata("multipleLocals.kt") - public void testMultipleLocals_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines"); + public void testMultipleLocals() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt"); } @TestMetadata("multipleSuspensionPoints.kt") - public void testMultipleSuspensionPoints_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt", "kotlin.coroutines"); + public void testMultipleSuspensionPoints() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt"); } @TestMetadata("nestedMethodWith2XParameter.kt") @@ -4096,23 +4092,23 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn } @TestMetadata("nonSuspendCrossinline.kt") - public void testNonSuspendCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt", "kotlin.coroutines"); + public void testNonSuspendCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt"); } @TestMetadata("returnValue.kt") - public void testReturnValue_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/returnValue.kt", "kotlin.coroutines"); + public void testReturnValue() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/returnValue.kt"); } @TestMetadata("tryCatchReceiver.kt") - public void testTryCatchReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt", "kotlin.coroutines"); + public void testTryCatchReceiver() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt"); } @TestMetadata("tryCatchStackTransform.kt") - public void testTryCatchStackTransform_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt", "kotlin.coroutines"); + public void testTryCatchStackTransform() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt"); } @TestMetadata("twiceRegeneratedAnonymousObject.kt") @@ -4171,17 +4167,13 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInDefaultParameter() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/defaultParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("defaultValueCrossinline.kt") - public void testDefaultValueCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt", "kotlin.coroutines"); + public void testDefaultValueCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt"); } @TestMetadata("defaultValueInClass.kt") @@ -4189,14 +4181,14 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInClass.kt"); } - @TestMetadata("defaultValueInlineFromMultiFileFacade.kt") - public void testDefaultValueInlineFromMultiFileFacade_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt", "kotlin.coroutines"); + @TestMetadata("defaultValueInline.kt") + public void testDefaultValueInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt"); } - @TestMetadata("defaultValueInline.kt") - public void testDefaultValueInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt", "kotlin.coroutines"); + @TestMetadata("defaultValueInlineFromMultiFileFacade.kt") + public void testDefaultValueInlineFromMultiFileFacade() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt"); } } @@ -4264,52 +4256,48 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInReceiver() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/receiver"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt"); } @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt"); } } @@ -4321,77 +4309,73 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInStateMachine() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/stateMachine"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("crossingCoroutineBoundaries.kt") - public void testCrossingCoroutineBoundaries_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt", "kotlin.coroutines"); + public void testCrossingCoroutineBoundaries() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt"); } @TestMetadata("independentInline.kt") - public void testIndependentInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerLambdaInsideLambda.kt") - public void testInnerLambdaInsideLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerLambdaWithoutCrossinline.kt") - public void testInnerLambdaWithoutCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt", "kotlin.coroutines"); + public void testIndependentInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt"); } @TestMetadata("innerLambda.kt") - public void testInnerLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt", "kotlin.coroutines"); + public void testInnerLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt"); } - @TestMetadata("innerMadnessCallSite.kt") - public void testInnerMadnessCallSite_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt", "kotlin.coroutines"); + @TestMetadata("innerLambdaInsideLambda.kt") + public void testInnerLambdaInsideLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt"); + } + + @TestMetadata("innerLambdaWithoutCrossinline.kt") + public void testInnerLambdaWithoutCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt"); } @TestMetadata("innerMadness.kt") - public void testInnerMadness_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt", "kotlin.coroutines"); + public void testInnerMadness() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt"); } - @TestMetadata("innerObjectInsideInnerObject.kt") - public void testInnerObjectInsideInnerObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectRetransformation.kt") - public void testInnerObjectRetransformation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectSeveralFunctions.kt") - public void testInnerObjectSeveralFunctions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectWithoutCapturingCrossinline.kt") - public void testInnerObjectWithoutCapturingCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt", "kotlin.coroutines"); + @TestMetadata("innerMadnessCallSite.kt") + public void testInnerMadnessCallSite() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt"); } @TestMetadata("innerObject.kt") - public void testInnerObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt", "kotlin.coroutines"); + public void testInnerObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt"); + } + + @TestMetadata("innerObjectInsideInnerObject.kt") + public void testInnerObjectInsideInnerObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt"); + } + + @TestMetadata("innerObjectRetransformation.kt") + public void testInnerObjectRetransformation() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt"); + } + + @TestMetadata("innerObjectSeveralFunctions.kt") + public void testInnerObjectSeveralFunctions() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt"); + } + + @TestMetadata("innerObjectWithoutCapturingCrossinline.kt") + public void testInnerObjectWithoutCapturingCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt"); } @TestMetadata("insideObject.kt") - public void testInsideObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt", "kotlin.coroutines"); + public void testInsideObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt"); } @TestMetadata("lambdaTransformation.kt") @@ -4400,43 +4384,43 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn } @TestMetadata("normalInline.kt") - public void testNormalInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt", "kotlin.coroutines"); + public void testNormalInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt"); } @TestMetadata("numberOfSuspentions.kt") - public void testNumberOfSuspentions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt", "kotlin.coroutines"); + public void testNumberOfSuspentions() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt"); } @TestMetadata("objectInsideLambdas.kt") - public void testObjectInsideLambdas_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt", "kotlin.coroutines"); + public void testObjectInsideLambdas() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt"); } @TestMetadata("oneInlineTwoCaptures.kt") - public void testOneInlineTwoCaptures_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt", "kotlin.coroutines"); + public void testOneInlineTwoCaptures() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt"); } @TestMetadata("passLambda.kt") - public void testPassLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt", "kotlin.coroutines"); - } - - @TestMetadata("passParameterLambda.kt") - public void testPassParameterLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt", "kotlin.coroutines"); + public void testPassLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt"); } @TestMetadata("passParameter.kt") - public void testPassParameter_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt", "kotlin.coroutines"); + public void testPassParameter() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt"); + } + + @TestMetadata("passParameterLambda.kt") + public void testPassParameterLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt"); } @TestMetadata("unreachableSuspendMarker.kt") - public void testUnreachableSuspendMarker_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt", "kotlin.coroutines"); + public void testUnreachableSuspendMarker() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt"); } } } diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBytecodeTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBytecodeTextTestGenerated.java index 1188525c21b..33848c6fe9a 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBytecodeTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBytecodeTextTestGenerated.java @@ -1413,10 +1413,6 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest { KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInCoroutines() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/coroutines"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @@ -1447,8 +1443,8 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest { } @TestMetadata("returnUnitInLambda.kt") - public void testReturnUnitInLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/returnUnitInLambda.kt", "kotlin.coroutines"); + public void testReturnUnitInLambda() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/returnUnitInLambda.kt"); } @TestMetadata("suspendMain.kt") @@ -1626,62 +1622,58 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest { KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); - } - public void testAllFilesPresentInIntLikeVarSpilling() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("complicatedMerge.kt") - public void testComplicatedMerge_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/complicatedMerge.kt", "kotlin.coroutines"); + public void testComplicatedMerge() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/complicatedMerge.kt"); } @TestMetadata("i2bResult.kt") - public void testI2bResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines"); + public void testI2bResult() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/i2bResult.kt"); } @TestMetadata("loadFromBooleanArray.kt") - public void testLoadFromBooleanArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines"); + public void testLoadFromBooleanArray() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt"); } @TestMetadata("loadFromByteArray.kt") - public void testLoadFromByteArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/loadFromByteArray.kt", "kotlin.coroutines"); + public void testLoadFromByteArray() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/loadFromByteArray.kt"); } @TestMetadata("noVariableInTable.kt") - public void testNoVariableInTable_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/noVariableInTable.kt", "kotlin.coroutines"); + public void testNoVariableInTable() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/noVariableInTable.kt"); } @TestMetadata("sameIconst1ManyVars.kt") - public void testSameIconst1ManyVars_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt", "kotlin.coroutines"); + public void testSameIconst1ManyVars() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt"); } @TestMetadata("usedInArrayStore.kt") - public void testUsedInArrayStore_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInArrayStore.kt", "kotlin.coroutines"); + public void testUsedInArrayStore() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInArrayStore.kt"); } @TestMetadata("usedInMethodCall.kt") - public void testUsedInMethodCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInMethodCall.kt", "kotlin.coroutines"); + public void testUsedInMethodCall() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInMethodCall.kt"); } @TestMetadata("usedInPutfield.kt") - public void testUsedInPutfield_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInPutfield.kt", "kotlin.coroutines"); + public void testUsedInPutfield() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInPutfield.kt"); } @TestMetadata("usedInVarStore.kt") - public void testUsedInVarStore_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInVarStore.kt", "kotlin.coroutines"); + public void testUsedInVarStore() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInVarStore.kt"); } } diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java index 8889dc53890..6411620cb77 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java @@ -8,7 +8,6 @@ package org.jetbrains.kotlin.checkers; import com.intellij.testFramework.TestDataPath; import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; import org.jetbrains.kotlin.test.KotlinTestUtils; -import org.jetbrains.kotlin.test.TargetBackend; import org.jetbrains.kotlin.test.TestMetadata; import org.junit.runner.RunWith; @@ -1659,10 +1658,6 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.ANY, testDataFilePath); - } - public void testAllFilesPresentInCoroutines() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/coroutines"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } @@ -1788,13 +1783,8 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW } @TestMetadata("noDefaultCoroutineImports.kt") - public void testNoDefaultCoroutineImports_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("noDefaultCoroutineImports.kt") - public void testNoDefaultCoroutineImports_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.kt", "kotlin.coroutines"); + public void testNoDefaultCoroutineImports() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.kt"); } @TestMetadata("nonLocalSuspension.kt") @@ -1823,13 +1813,8 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW } @TestMetadata("suspendApplicability.kt") - public void testSuspendApplicability_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendApplicability.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendApplicability.kt") - public void testSuspendApplicability_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendApplicability.kt", "kotlin.coroutines"); + public void testSuspendApplicability() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendApplicability.kt"); } @TestMetadata("suspendConflictsWithNoSuspend.kt") @@ -1858,13 +1843,8 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW } @TestMetadata("suspendCovarianJavaOverride.kt") - public void testSuspendCovarianJavaOverride_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCovarianJavaOverride.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendCovarianJavaOverride.kt") - public void testSuspendCovarianJavaOverride_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCovarianJavaOverride.kt", "kotlin.coroutines"); + public void testSuspendCovarianJavaOverride() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCovarianJavaOverride.kt"); } @TestMetadata("suspendDestructuring.kt") @@ -1883,43 +1863,23 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW } @TestMetadata("suspendFunctions.kt") - public void testSuspendFunctions_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendFunctions.kt") - public void testSuspendFunctions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.kt", "kotlin.coroutines"); + public void testSuspendFunctions() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.kt"); } @TestMetadata("suspendJavaImplementationFromDifferentClass.kt") - public void testSuspendJavaImplementationFromDifferentClass_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaImplementationFromDifferentClass.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendJavaImplementationFromDifferentClass.kt") - public void testSuspendJavaImplementationFromDifferentClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaImplementationFromDifferentClass.kt", "kotlin.coroutines"); + public void testSuspendJavaImplementationFromDifferentClass() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaImplementationFromDifferentClass.kt"); } @TestMetadata("suspendJavaOverrides.kt") - public void testSuspendJavaOverrides_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaOverrides.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendJavaOverrides.kt") - public void testSuspendJavaOverrides_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaOverrides.kt", "kotlin.coroutines"); + public void testSuspendJavaOverrides() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaOverrides.kt"); } @TestMetadata("suspendLambda.kt") - public void testSuspendLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendLambda.kt") - public void testSuspendLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendLambda.kt", "kotlin.coroutines"); + public void testSuspendLambda() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendLambda.kt"); } @TestMetadata("suspendOverridability.kt") @@ -1980,10 +1940,6 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.ANY, testDataFilePath); - } - public void testAllFilesPresentInCallableReference() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } @@ -1999,13 +1955,8 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW } @TestMetadata("property.kt") - public void testProperty_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/property.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("property.kt") - public void testProperty_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/property.kt", "kotlin.coroutines"); + public void testProperty() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/property.kt"); } @TestMetadata("suspendConversionForCallableReferences.kt") @@ -2305,132 +2256,68 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.ANY, testDataFilePath); - } - public void testAllFilesPresentInInlineCrossinline() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } @TestMetadata("inlineOrdinaryOfCrossinlineOrdinary.kt") - public void testInlineOrdinaryOfCrossinlineOrdinary_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineOrdinary.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineOrdinaryOfCrossinlineOrdinary.kt") - public void testInlineOrdinaryOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineOrdinary.kt") - public void testInlineOrdinaryOfNoinlineOrdinary_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineOrdinary.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineOrdinaryOfNoinlineOrdinary.kt") - public void testInlineOrdinaryOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineOrdinary.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfOrdinary.kt") - public void testInlineOrdinaryOfOrdinary_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfOrdinary.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineOrdinaryOfOrdinary.kt") - public void testInlineOrdinaryOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfOrdinary() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfOrdinary.kt"); } @TestMetadata("inlineOrdinaryOfSuspend.kt") - public void testInlineOrdinaryOfSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineOrdinaryOfSuspend.kt") - public void testInlineOrdinaryOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfSuspend() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfSuspend.kt"); } @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfOrdinary.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfOrdinary() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfOrdinary.kt"); } @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfSuspend() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfSuspend.kt"); } } @@ -2470,52 +2357,28 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.ANY, testDataFilePath); - } - public void testAllFilesPresentInRestrictSuspension() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } @TestMetadata("allMembersAllowed.kt") - public void testAllMembersAllowed_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/allMembersAllowed.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("allMembersAllowed.kt") - public void testAllMembersAllowed_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/allMembersAllowed.kt", "kotlin.coroutines"); + public void testAllMembersAllowed() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/allMembersAllowed.kt"); } @TestMetadata("extensions.kt") - public void testExtensions_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/extensions.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("extensions.kt") - public void testExtensions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/extensions.kt", "kotlin.coroutines"); + public void testExtensions() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/extensions.kt"); } @TestMetadata("memberExtension.kt") - public void testMemberExtension_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/memberExtension.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("memberExtension.kt") - public void testMemberExtension_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/memberExtension.kt", "kotlin.coroutines"); + public void testMemberExtension() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/memberExtension.kt"); } @TestMetadata("notRelatedFun.kt") - public void testNotRelatedFun_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/notRelatedFun.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("notRelatedFun.kt") - public void testNotRelatedFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/notRelatedFun.kt", "kotlin.coroutines"); + public void testNotRelatedFun() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/notRelatedFun.kt"); } @TestMetadata("outerYield_1_2.kt") @@ -2529,33 +2392,18 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW } @TestMetadata("sameInstance.kt") - public void testSameInstance_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/sameInstance.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("sameInstance.kt") - public void testSameInstance_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/sameInstance.kt", "kotlin.coroutines"); + public void testSameInstance() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/sameInstance.kt"); } @TestMetadata("simpleForbidden.kt") - public void testSimpleForbidden_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/simpleForbidden.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("simpleForbidden.kt") - public void testSimpleForbidden_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/simpleForbidden.kt", "kotlin.coroutines"); + public void testSimpleForbidden() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/simpleForbidden.kt"); } @TestMetadata("wrongEnclosingFunction.kt") - public void testWrongEnclosingFunction_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/wrongEnclosingFunction.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("wrongEnclosingFunction.kt") - public void testWrongEnclosingFunction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/wrongEnclosingFunction.kt", "kotlin.coroutines"); + public void testWrongEnclosingFunction() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/wrongEnclosingFunction.kt"); } } @@ -2650,22 +2498,13 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.ANY, testDataFilePath); - } - public void testAllFilesPresentInTailCalls() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } @TestMetadata("forbidden.kt") - public void testForbidden_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/forbidden.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("forbidden.kt") - public void testForbidden_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/forbidden.kt", "kotlin.coroutines"); + public void testForbidden() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/forbidden.kt"); } @TestMetadata("localFunctions.kt") @@ -2689,23 +2528,13 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW } @TestMetadata("tryCatch.kt") - public void testTryCatch_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/tryCatch.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("tryCatch.kt") - public void testTryCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/tryCatch.kt", "kotlin.coroutines"); + public void testTryCatch() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/tryCatch.kt"); } @TestMetadata("valid.kt") - public void testValid_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/valid.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("valid.kt") - public void testValid_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/valid.kt", "kotlin.coroutines"); + public void testValid() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/valid.kt"); } } } diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java index d4ef163daa6..eff4688ebf6 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java @@ -8,7 +8,6 @@ package org.jetbrains.kotlin.checkers.javac; import com.intellij.testFramework.TestDataPath; import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; import org.jetbrains.kotlin.test.KotlinTestUtils; -import org.jetbrains.kotlin.test.TargetBackend; import org.jetbrains.kotlin.test.TestMetadata; import org.junit.runner.RunWith; @@ -1659,10 +1658,6 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.ANY, testDataFilePath); - } - public void testAllFilesPresentInCoroutines() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/coroutines"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } @@ -1788,13 +1783,8 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno } @TestMetadata("noDefaultCoroutineImports.kt") - public void testNoDefaultCoroutineImports_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("noDefaultCoroutineImports.kt") - public void testNoDefaultCoroutineImports_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.kt", "kotlin.coroutines"); + public void testNoDefaultCoroutineImports() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.kt"); } @TestMetadata("nonLocalSuspension.kt") @@ -1823,13 +1813,8 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno } @TestMetadata("suspendApplicability.kt") - public void testSuspendApplicability_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendApplicability.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendApplicability.kt") - public void testSuspendApplicability_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendApplicability.kt", "kotlin.coroutines"); + public void testSuspendApplicability() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendApplicability.kt"); } @TestMetadata("suspendConflictsWithNoSuspend.kt") @@ -1858,13 +1843,8 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno } @TestMetadata("suspendCovarianJavaOverride.kt") - public void testSuspendCovarianJavaOverride_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCovarianJavaOverride.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendCovarianJavaOverride.kt") - public void testSuspendCovarianJavaOverride_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCovarianJavaOverride.kt", "kotlin.coroutines"); + public void testSuspendCovarianJavaOverride() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCovarianJavaOverride.kt"); } @TestMetadata("suspendDestructuring.kt") @@ -1883,43 +1863,23 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno } @TestMetadata("suspendFunctions.kt") - public void testSuspendFunctions_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendFunctions.kt") - public void testSuspendFunctions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.kt", "kotlin.coroutines"); + public void testSuspendFunctions() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.kt"); } @TestMetadata("suspendJavaImplementationFromDifferentClass.kt") - public void testSuspendJavaImplementationFromDifferentClass_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaImplementationFromDifferentClass.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendJavaImplementationFromDifferentClass.kt") - public void testSuspendJavaImplementationFromDifferentClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaImplementationFromDifferentClass.kt", "kotlin.coroutines"); + public void testSuspendJavaImplementationFromDifferentClass() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaImplementationFromDifferentClass.kt"); } @TestMetadata("suspendJavaOverrides.kt") - public void testSuspendJavaOverrides_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaOverrides.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendJavaOverrides.kt") - public void testSuspendJavaOverrides_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaOverrides.kt", "kotlin.coroutines"); + public void testSuspendJavaOverrides() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaOverrides.kt"); } @TestMetadata("suspendLambda.kt") - public void testSuspendLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendLambda.kt") - public void testSuspendLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendLambda.kt", "kotlin.coroutines"); + public void testSuspendLambda() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendLambda.kt"); } @TestMetadata("suspendOverridability.kt") @@ -1980,10 +1940,6 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.ANY, testDataFilePath); - } - public void testAllFilesPresentInCallableReference() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } @@ -1999,13 +1955,8 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno } @TestMetadata("property.kt") - public void testProperty_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/property.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("property.kt") - public void testProperty_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/property.kt", "kotlin.coroutines"); + public void testProperty() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/property.kt"); } @TestMetadata("suspendConversionForCallableReferences.kt") @@ -2305,132 +2256,68 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.ANY, testDataFilePath); - } - public void testAllFilesPresentInInlineCrossinline() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } @TestMetadata("inlineOrdinaryOfCrossinlineOrdinary.kt") - public void testInlineOrdinaryOfCrossinlineOrdinary_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineOrdinary.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineOrdinaryOfCrossinlineOrdinary.kt") - public void testInlineOrdinaryOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineOrdinary.kt") - public void testInlineOrdinaryOfNoinlineOrdinary_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineOrdinary.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineOrdinaryOfNoinlineOrdinary.kt") - public void testInlineOrdinaryOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineOrdinary.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfOrdinary.kt") - public void testInlineOrdinaryOfOrdinary_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfOrdinary.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineOrdinaryOfOrdinary.kt") - public void testInlineOrdinaryOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfOrdinary() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfOrdinary.kt"); } @TestMetadata("inlineOrdinaryOfSuspend.kt") - public void testInlineOrdinaryOfSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineOrdinaryOfSuspend.kt") - public void testInlineOrdinaryOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfSuspend() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfSuspend.kt"); } @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfOrdinary.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfOrdinary() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfOrdinary.kt"); } @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfSuspend() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfSuspend.kt"); } } @@ -2470,52 +2357,28 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.ANY, testDataFilePath); - } - public void testAllFilesPresentInRestrictSuspension() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } @TestMetadata("allMembersAllowed.kt") - public void testAllMembersAllowed_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/allMembersAllowed.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("allMembersAllowed.kt") - public void testAllMembersAllowed_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/allMembersAllowed.kt", "kotlin.coroutines"); + public void testAllMembersAllowed() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/allMembersAllowed.kt"); } @TestMetadata("extensions.kt") - public void testExtensions_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/extensions.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("extensions.kt") - public void testExtensions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/extensions.kt", "kotlin.coroutines"); + public void testExtensions() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/extensions.kt"); } @TestMetadata("memberExtension.kt") - public void testMemberExtension_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/memberExtension.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("memberExtension.kt") - public void testMemberExtension_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/memberExtension.kt", "kotlin.coroutines"); + public void testMemberExtension() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/memberExtension.kt"); } @TestMetadata("notRelatedFun.kt") - public void testNotRelatedFun_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/notRelatedFun.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("notRelatedFun.kt") - public void testNotRelatedFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/notRelatedFun.kt", "kotlin.coroutines"); + public void testNotRelatedFun() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/notRelatedFun.kt"); } @TestMetadata("outerYield_1_2.kt") @@ -2529,33 +2392,18 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno } @TestMetadata("sameInstance.kt") - public void testSameInstance_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/sameInstance.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("sameInstance.kt") - public void testSameInstance_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/sameInstance.kt", "kotlin.coroutines"); + public void testSameInstance() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/sameInstance.kt"); } @TestMetadata("simpleForbidden.kt") - public void testSimpleForbidden_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/simpleForbidden.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("simpleForbidden.kt") - public void testSimpleForbidden_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/simpleForbidden.kt", "kotlin.coroutines"); + public void testSimpleForbidden() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/simpleForbidden.kt"); } @TestMetadata("wrongEnclosingFunction.kt") - public void testWrongEnclosingFunction_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/wrongEnclosingFunction.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("wrongEnclosingFunction.kt") - public void testWrongEnclosingFunction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/wrongEnclosingFunction.kt", "kotlin.coroutines"); + public void testWrongEnclosingFunction() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/wrongEnclosingFunction.kt"); } } @@ -2650,22 +2498,13 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.ANY, testDataFilePath); - } - public void testAllFilesPresentInTailCalls() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } @TestMetadata("forbidden.kt") - public void testForbidden_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/forbidden.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("forbidden.kt") - public void testForbidden_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/forbidden.kt", "kotlin.coroutines"); + public void testForbidden() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/forbidden.kt"); } @TestMetadata("localFunctions.kt") @@ -2689,23 +2528,13 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno } @TestMetadata("tryCatch.kt") - public void testTryCatch_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/tryCatch.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("tryCatch.kt") - public void testTryCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/tryCatch.kt", "kotlin.coroutines"); + public void testTryCatch() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/tryCatch.kt"); } @TestMetadata("valid.kt") - public void testValid_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/valid.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("valid.kt") - public void testValid_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/valid.kt", "kotlin.coroutines"); + public void testValid() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/valid.kt"); } } } diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 66606008be0..3bdffdca101 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -934,10 +934,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInJvm() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/assert/jvm"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @@ -1033,43 +1029,23 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("suspendFunctionAssertionDisabled.kt") - public void testSuspendFunctionAssertionDisabled_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionDisabled.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendFunctionAssertionDisabled.kt") - public void testSuspendFunctionAssertionDisabled_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionDisabled.kt", "kotlin.coroutines"); + public void testSuspendFunctionAssertionDisabled() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionDisabled.kt"); } @TestMetadata("suspendFunctionAssertionsEnabled.kt") - public void testSuspendFunctionAssertionsEnabled_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionsEnabled.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendFunctionAssertionsEnabled.kt") - public void testSuspendFunctionAssertionsEnabled_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionsEnabled.kt", "kotlin.coroutines"); + public void testSuspendFunctionAssertionsEnabled() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionsEnabled.kt"); } @TestMetadata("suspendLambdaAssertionsDisabled.kt") - public void testSuspendLambdaAssertionsDisabled_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsDisabled.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendLambdaAssertionsDisabled.kt") - public void testSuspendLambdaAssertionsDisabled_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsDisabled.kt", "kotlin.coroutines"); + public void testSuspendLambdaAssertionsDisabled() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsDisabled.kt"); } @TestMetadata("suspendLambdaAssertionsEnabled.kt") - public void testSuspendLambdaAssertionsEnabled_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsEnabled.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendLambdaAssertionsEnabled.kt") - public void testSuspendLambdaAssertionsEnabled_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsEnabled.kt", "kotlin.coroutines"); + public void testSuspendLambdaAssertionsEnabled() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsEnabled.kt"); } } } @@ -4865,10 +4841,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInCapturedVarsOptimization() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/closures/capturedVarsOptimization"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @@ -4918,24 +4890,14 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/closures/capturedVarsOptimization/sharedSlotsWithCapturedVars.kt"); } - @TestMetadata("withCoroutinesNoStdLib.kt") - public void testWithCoroutinesNoStdLib_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutinesNoStdLib.kt", "kotlin.coroutines.experimental"); + @TestMetadata("withCoroutines.kt") + public void testWithCoroutines() throws Exception { + runTest("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt"); } @TestMetadata("withCoroutinesNoStdLib.kt") - public void testWithCoroutinesNoStdLib_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutinesNoStdLib.kt", "kotlin.coroutines"); - } - - @TestMetadata("withCoroutines.kt") - public void testWithCoroutines_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("withCoroutines.kt") - public void testWithCoroutines_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt", "kotlin.coroutines"); + public void testWithCoroutinesNoStdLib() throws Exception { + runTest("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutinesNoStdLib.kt"); } } @@ -5381,10 +5343,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInContracts() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/contracts"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @@ -5430,13 +5388,8 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("kt39374.kt") - public void testKt39374_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/contracts/kt39374.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("kt39374.kt") - public void testKt39374_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/contracts/kt39374.kt", "kotlin.coroutines"); + public void testKt39374() throws Exception { + runTest("compiler/testData/codegen/box/contracts/kt39374.kt"); } @TestMetadata("lambdaParameter.kt") @@ -6570,42 +6523,28 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - @TestMetadata("32defaultParametersInSuspend.kt") - public void test32defaultParametersInSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/32defaultParametersInSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("32defaultParametersInSuspend.kt") - public void test32defaultParametersInSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/32defaultParametersInSuspend.kt", "kotlin.coroutines"); + public void test32defaultParametersInSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/32defaultParametersInSuspend.kt"); } @TestMetadata("accessorForSuspend.kt") - public void testAccessorForSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/accessorForSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("accessorForSuspend.kt") - public void testAccessorForSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/accessorForSuspend.kt", "kotlin.coroutines"); + public void testAccessorForSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/accessorForSuspend.kt"); } public void testAllFilesPresentInCoroutines() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } - @TestMetadata("asyncException.kt") - public void testAsyncException_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/asyncException.kt", "kotlin.coroutines.experimental"); + @TestMetadata("async.kt") + public void testAsync() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/async.kt"); } @TestMetadata("asyncException.kt") - public void testAsyncException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/asyncException.kt", "kotlin.coroutines"); + public void testAsyncException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/asyncException.kt"); } @TestMetadata("asyncIteratorNullMerge_1_3.kt") @@ -6623,44 +6562,19 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/coroutines/asyncIterator_1_3.kt"); } - @TestMetadata("async.kt") - public void testAsync_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/async.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("async.kt") - public void testAsync_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/async.kt", "kotlin.coroutines"); - } - @TestMetadata("await.kt") - public void testAwait_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/await.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("await.kt") - public void testAwait_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/await.kt", "kotlin.coroutines"); - } - - @TestMetadata("beginWithExceptionNoHandleException.kt") - public void testBeginWithExceptionNoHandleException_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/beginWithExceptionNoHandleException.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("beginWithExceptionNoHandleException.kt") - public void testBeginWithExceptionNoHandleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/beginWithExceptionNoHandleException.kt", "kotlin.coroutines"); + public void testAwait() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/await.kt"); } @TestMetadata("beginWithException.kt") - public void testBeginWithException_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/beginWithException.kt", "kotlin.coroutines.experimental"); + public void testBeginWithException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/beginWithException.kt"); } - @TestMetadata("beginWithException.kt") - public void testBeginWithException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/beginWithException.kt", "kotlin.coroutines"); + @TestMetadata("beginWithExceptionNoHandleException.kt") + public void testBeginWithExceptionNoHandleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/beginWithExceptionNoHandleException.kt"); } @TestMetadata("builderInferenceAndGenericArrayAcessCall.kt") @@ -6684,53 +6598,28 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("capturedVarInSuspendLambda.kt") - public void testCapturedVarInSuspendLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("capturedVarInSuspendLambda.kt") - public void testCapturedVarInSuspendLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt", "kotlin.coroutines"); + public void testCapturedVarInSuspendLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt"); } @TestMetadata("catchWithInlineInsideSuspend.kt") - public void testCatchWithInlineInsideSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/catchWithInlineInsideSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("catchWithInlineInsideSuspend.kt") - public void testCatchWithInlineInsideSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/catchWithInlineInsideSuspend.kt", "kotlin.coroutines"); + public void testCatchWithInlineInsideSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/catchWithInlineInsideSuspend.kt"); } @TestMetadata("coercionToUnit.kt") - public void testCoercionToUnit_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/coercionToUnit.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("coercionToUnit.kt") - public void testCoercionToUnit_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/coercionToUnit.kt", "kotlin.coroutines"); + public void testCoercionToUnit() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/coercionToUnit.kt"); } @TestMetadata("controllerAccessFromInnerLambda.kt") - public void testControllerAccessFromInnerLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controllerAccessFromInnerLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("controllerAccessFromInnerLambda.kt") - public void testControllerAccessFromInnerLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controllerAccessFromInnerLambda.kt", "kotlin.coroutines"); + public void testControllerAccessFromInnerLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controllerAccessFromInnerLambda.kt"); } @TestMetadata("coroutineContextInInlinedLambda.kt") - public void testCoroutineContextInInlinedLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/coroutineContextInInlinedLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("coroutineContextInInlinedLambda.kt") - public void testCoroutineContextInInlinedLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/coroutineContextInInlinedLambda.kt", "kotlin.coroutines"); + public void testCoroutineContextInInlinedLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/coroutineContextInInlinedLambda.kt"); } @TestMetadata("coroutineToString.kt") @@ -6739,33 +6628,23 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("createCoroutineSafe.kt") - public void testCreateCoroutineSafe_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/createCoroutineSafe.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("createCoroutineSafe.kt") - public void testCreateCoroutineSafe_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/createCoroutineSafe.kt", "kotlin.coroutines"); + public void testCreateCoroutineSafe() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/createCoroutineSafe.kt"); } @TestMetadata("createCoroutinesOnManualInstances.kt") - public void testCreateCoroutinesOnManualInstances_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/createCoroutinesOnManualInstances.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("createCoroutinesOnManualInstances.kt") - public void testCreateCoroutinesOnManualInstances_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/createCoroutinesOnManualInstances.kt", "kotlin.coroutines"); + public void testCreateCoroutinesOnManualInstances() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/createCoroutinesOnManualInstances.kt"); } @TestMetadata("crossInlineWithCapturedOuterReceiver.kt") - public void testCrossInlineWithCapturedOuterReceiver_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/crossInlineWithCapturedOuterReceiver.kt", "kotlin.coroutines.experimental"); + public void testCrossInlineWithCapturedOuterReceiver() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/crossInlineWithCapturedOuterReceiver.kt"); } - @TestMetadata("crossInlineWithCapturedOuterReceiver.kt") - public void testCrossInlineWithCapturedOuterReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/crossInlineWithCapturedOuterReceiver.kt", "kotlin.coroutines"); + @TestMetadata("defaultParametersInSuspend.kt") + public void testDefaultParametersInSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/defaultParametersInSuspend.kt"); } @TestMetadata("defaultParametersInSuspendWithJvmOverloads.kt") @@ -6773,34 +6652,14 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/coroutines/defaultParametersInSuspendWithJvmOverloads.kt"); } - @TestMetadata("defaultParametersInSuspend.kt") - public void testDefaultParametersInSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/defaultParametersInSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("defaultParametersInSuspend.kt") - public void testDefaultParametersInSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/defaultParametersInSuspend.kt", "kotlin.coroutines"); - } - @TestMetadata("delegatedSuspendMember.kt") - public void testDelegatedSuspendMember_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("delegatedSuspendMember.kt") - public void testDelegatedSuspendMember_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt", "kotlin.coroutines"); + public void testDelegatedSuspendMember() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt"); } @TestMetadata("dispatchResume.kt") - public void testDispatchResume_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/dispatchResume.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("dispatchResume.kt") - public void testDispatchResume_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/dispatchResume.kt", "kotlin.coroutines"); + public void testDispatchResume() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/dispatchResume.kt"); } @TestMetadata("doubleColonExpressionsGenerationInBuilderInference.kt") @@ -6809,13 +6668,8 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("emptyClosure.kt") - public void testEmptyClosure_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/emptyClosure.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("emptyClosure.kt") - public void testEmptyClosure_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/emptyClosure.kt", "kotlin.coroutines"); + public void testEmptyClosure() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/emptyClosure.kt"); } @TestMetadata("emptyCommonConstraintSystemForCoroutineInferenceCall.kt") @@ -6824,73 +6678,38 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("epam.kt") - public void testEpam_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/epam.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("epam.kt") - public void testEpam_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/epam.kt", "kotlin.coroutines"); + public void testEpam() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/epam.kt"); } @TestMetadata("falseUnitCoercion.kt") - public void testFalseUnitCoercion_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/falseUnitCoercion.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("falseUnitCoercion.kt") - public void testFalseUnitCoercion_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/falseUnitCoercion.kt", "kotlin.coroutines"); + public void testFalseUnitCoercion() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/falseUnitCoercion.kt"); } @TestMetadata("generate.kt") - public void testGenerate_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/generate.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("generate.kt") - public void testGenerate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/generate.kt", "kotlin.coroutines"); + public void testGenerate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/generate.kt"); } @TestMetadata("handleException.kt") - public void testHandleException_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleException.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("handleException.kt") - public void testHandleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleException.kt", "kotlin.coroutines"); + public void testHandleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleException.kt"); } @TestMetadata("handleResultCallEmptyBody.kt") - public void testHandleResultCallEmptyBody_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultCallEmptyBody.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("handleResultCallEmptyBody.kt") - public void testHandleResultCallEmptyBody_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultCallEmptyBody.kt", "kotlin.coroutines"); + public void testHandleResultCallEmptyBody() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleResultCallEmptyBody.kt"); } @TestMetadata("handleResultNonUnitExpression.kt") - public void testHandleResultNonUnitExpression_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultNonUnitExpression.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("handleResultNonUnitExpression.kt") - public void testHandleResultNonUnitExpression_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultNonUnitExpression.kt", "kotlin.coroutines"); + public void testHandleResultNonUnitExpression() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleResultNonUnitExpression.kt"); } @TestMetadata("handleResultSuspended.kt") - public void testHandleResultSuspended_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultSuspended.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("handleResultSuspended.kt") - public void testHandleResultSuspended_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultSuspended.kt", "kotlin.coroutines"); + public void testHandleResultSuspended() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleResultSuspended.kt"); } @TestMetadata("illegalState.kt") @@ -6899,183 +6718,93 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("indirectInlineUsedAsNonInline.kt") - public void testIndirectInlineUsedAsNonInline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/indirectInlineUsedAsNonInline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("indirectInlineUsedAsNonInline.kt") - public void testIndirectInlineUsedAsNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/indirectInlineUsedAsNonInline.kt", "kotlin.coroutines"); + public void testIndirectInlineUsedAsNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/indirectInlineUsedAsNonInline.kt"); } @TestMetadata("inlineFunInGenericClass.kt") - public void testInlineFunInGenericClass_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineFunInGenericClass.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineFunInGenericClass.kt") - public void testInlineFunInGenericClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineFunInGenericClass.kt", "kotlin.coroutines"); - } - - @TestMetadata("inlineFunctionInMultifileClassUnoptimized.kt") - public void testInlineFunctionInMultifileClassUnoptimized_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClassUnoptimized.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineFunctionInMultifileClassUnoptimized.kt") - public void testInlineFunctionInMultifileClassUnoptimized_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClassUnoptimized.kt", "kotlin.coroutines"); + public void testInlineFunInGenericClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineFunInGenericClass.kt"); } @TestMetadata("inlineFunctionInMultifileClass.kt") - public void testInlineFunctionInMultifileClass_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClass.kt", "kotlin.coroutines.experimental"); + public void testInlineFunctionInMultifileClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClass.kt"); } - @TestMetadata("inlineFunctionInMultifileClass.kt") - public void testInlineFunctionInMultifileClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClass.kt", "kotlin.coroutines"); + @TestMetadata("inlineFunctionInMultifileClassUnoptimized.kt") + public void testInlineFunctionInMultifileClassUnoptimized() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClassUnoptimized.kt"); } @TestMetadata("inlineGenericFunCalledFromSubclass.kt") - public void testInlineGenericFunCalledFromSubclass_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineGenericFunCalledFromSubclass.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineGenericFunCalledFromSubclass.kt") - public void testInlineGenericFunCalledFromSubclass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineGenericFunCalledFromSubclass.kt", "kotlin.coroutines"); + public void testInlineGenericFunCalledFromSubclass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineGenericFunCalledFromSubclass.kt"); } @TestMetadata("inlineSuspendFunction.kt") - public void testInlineSuspendFunction_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineSuspendFunction.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendFunction.kt") - public void testInlineSuspendFunction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineSuspendFunction.kt", "kotlin.coroutines"); + public void testInlineSuspendFunction() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineSuspendFunction.kt"); } @TestMetadata("inlineSuspendLambdaNonLocalReturn.kt") - public void testInlineSuspendLambdaNonLocalReturn_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineSuspendLambdaNonLocalReturn.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendLambdaNonLocalReturn.kt") - public void testInlineSuspendLambdaNonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineSuspendLambdaNonLocalReturn.kt", "kotlin.coroutines"); + public void testInlineSuspendLambdaNonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineSuspendLambdaNonLocalReturn.kt"); } @TestMetadata("inlinedTryCatchFinally.kt") - public void testInlinedTryCatchFinally_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlinedTryCatchFinally.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlinedTryCatchFinally.kt") - public void testInlinedTryCatchFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlinedTryCatchFinally.kt", "kotlin.coroutines"); + public void testInlinedTryCatchFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlinedTryCatchFinally.kt"); } @TestMetadata("innerSuspensionCalls.kt") - public void testInnerSuspensionCalls_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/innerSuspensionCalls.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("innerSuspensionCalls.kt") - public void testInnerSuspensionCalls_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/innerSuspensionCalls.kt", "kotlin.coroutines"); + public void testInnerSuspensionCalls() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/innerSuspensionCalls.kt"); } @TestMetadata("instanceOfContinuation.kt") - public void testInstanceOfContinuation_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/instanceOfContinuation.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("instanceOfContinuation.kt") - public void testInstanceOfContinuation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/instanceOfContinuation.kt", "kotlin.coroutines"); + public void testInstanceOfContinuation() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/instanceOfContinuation.kt"); } @TestMetadata("iterateOverArray.kt") - public void testIterateOverArray_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/iterateOverArray.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("iterateOverArray.kt") - public void testIterateOverArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/iterateOverArray.kt", "kotlin.coroutines"); + public void testIterateOverArray() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/iterateOverArray.kt"); } @TestMetadata("kt12958.kt") - public void testKt12958_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt12958.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("kt12958.kt") - public void testKt12958_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt12958.kt", "kotlin.coroutines"); + public void testKt12958() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt12958.kt"); } @TestMetadata("kt15016.kt") - public void testKt15016_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15016.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("kt15016.kt") - public void testKt15016_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15016.kt", "kotlin.coroutines"); + public void testKt15016() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt15016.kt"); } @TestMetadata("kt15017.kt") - public void testKt15017_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15017.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("kt15017.kt") - public void testKt15017_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15017.kt", "kotlin.coroutines"); + public void testKt15017() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt15017.kt"); } @TestMetadata("kt15930.kt") - public void testKt15930_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15930.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("kt15930.kt") - public void testKt15930_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15930.kt", "kotlin.coroutines"); + public void testKt15930() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt15930.kt"); } @TestMetadata("kt21605.kt") - public void testKt21605_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt21605.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("kt21605.kt") - public void testKt21605_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt21605.kt", "kotlin.coroutines"); + public void testKt21605() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt21605.kt"); } @TestMetadata("kt25912.kt") - public void testKt25912_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt25912.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("kt25912.kt") - public void testKt25912_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt25912.kt", "kotlin.coroutines"); + public void testKt25912() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt25912.kt"); } @TestMetadata("kt28844.kt") - public void testKt28844_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt28844.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("kt28844.kt") - public void testKt28844_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt28844.kt", "kotlin.coroutines"); + public void testKt28844() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt28844.kt"); } @TestMetadata("kt30858.kt") @@ -7104,43 +6833,23 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("lastExpressionIsLoop.kt") - public void testLastExpressionIsLoop_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("lastExpressionIsLoop.kt") - public void testLastExpressionIsLoop_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt", "kotlin.coroutines"); + public void testLastExpressionIsLoop() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt"); } @TestMetadata("lastStatementInc.kt") - public void testLastStatementInc_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastStatementInc.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("lastStatementInc.kt") - public void testLastStatementInc_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastStatementInc.kt", "kotlin.coroutines"); + public void testLastStatementInc() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastStatementInc.kt"); } @TestMetadata("lastStementAssignment.kt") - public void testLastStementAssignment_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastStementAssignment.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("lastStementAssignment.kt") - public void testLastStementAssignment_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastStementAssignment.kt", "kotlin.coroutines"); + public void testLastStementAssignment() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastStementAssignment.kt"); } @TestMetadata("lastUnitExpression.kt") - public void testLastUnitExpression_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastUnitExpression.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("lastUnitExpression.kt") - public void testLastUnitExpression_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastUnitExpression.kt", "kotlin.coroutines"); + public void testLastUnitExpression() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastUnitExpression.kt"); } @TestMetadata("localCallableRef.kt") @@ -7149,103 +6858,53 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("localDelegate.kt") - public void testLocalDelegate_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localDelegate.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("localDelegate.kt") - public void testLocalDelegate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localDelegate.kt", "kotlin.coroutines"); + public void testLocalDelegate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localDelegate.kt"); } @TestMetadata("longRangeInSuspendCall.kt") - public void testLongRangeInSuspendCall_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/longRangeInSuspendCall.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("longRangeInSuspendCall.kt") - public void testLongRangeInSuspendCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/longRangeInSuspendCall.kt", "kotlin.coroutines"); + public void testLongRangeInSuspendCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/longRangeInSuspendCall.kt"); } @TestMetadata("longRangeInSuspendFun.kt") - public void testLongRangeInSuspendFun_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/longRangeInSuspendFun.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("longRangeInSuspendFun.kt") - public void testLongRangeInSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/longRangeInSuspendFun.kt", "kotlin.coroutines"); + public void testLongRangeInSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/longRangeInSuspendFun.kt"); } @TestMetadata("mergeNullAndString.kt") - public void testMergeNullAndString_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/mergeNullAndString.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("mergeNullAndString.kt") - public void testMergeNullAndString_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/mergeNullAndString.kt", "kotlin.coroutines"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda1.kt") - public void testMultipleInvokeCallsInsideInlineLambda1_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda1.kt") - public void testMultipleInvokeCallsInsideInlineLambda1_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt", "kotlin.coroutines"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda2.kt") - public void testMultipleInvokeCallsInsideInlineLambda2_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda2.kt") - public void testMultipleInvokeCallsInsideInlineLambda2_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt", "kotlin.coroutines"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda3.kt") - public void testMultipleInvokeCallsInsideInlineLambda3_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda3.kt") - public void testMultipleInvokeCallsInsideInlineLambda3_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt", "kotlin.coroutines"); + public void testMergeNullAndString() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/mergeNullAndString.kt"); } @TestMetadata("multipleInvokeCalls.kt") - public void testMultipleInvokeCalls_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt", "kotlin.coroutines.experimental"); + public void testMultipleInvokeCalls() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt"); } - @TestMetadata("multipleInvokeCalls.kt") - public void testMultipleInvokeCalls_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt", "kotlin.coroutines"); + @TestMetadata("multipleInvokeCallsInsideInlineLambda1.kt") + public void testMultipleInvokeCallsInsideInlineLambda1() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt"); + } + + @TestMetadata("multipleInvokeCallsInsideInlineLambda2.kt") + public void testMultipleInvokeCallsInsideInlineLambda2() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt"); + } + + @TestMetadata("multipleInvokeCallsInsideInlineLambda3.kt") + public void testMultipleInvokeCallsInsideInlineLambda3() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt"); } @TestMetadata("nestedTryCatch.kt") - public void testNestedTryCatch_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nestedTryCatch.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("nestedTryCatch.kt") - public void testNestedTryCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nestedTryCatch.kt", "kotlin.coroutines"); + public void testNestedTryCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/nestedTryCatch.kt"); } @TestMetadata("noSuspensionPoints.kt") - public void testNoSuspensionPoints_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noSuspensionPoints.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("noSuspensionPoints.kt") - public void testNoSuspensionPoints_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noSuspensionPoints.kt", "kotlin.coroutines"); + public void testNoSuspensionPoints() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/noSuspensionPoints.kt"); } @TestMetadata("nonLocalReturn.kt") @@ -7253,44 +6912,24 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/coroutines/nonLocalReturn.kt"); } - @TestMetadata("nonLocalReturnFromInlineLambdaDeep.kt") - public void testNonLocalReturnFromInlineLambdaDeep_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt", "kotlin.coroutines.experimental"); + @TestMetadata("nonLocalReturnFromInlineLambda.kt") + public void testNonLocalReturnFromInlineLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt"); } @TestMetadata("nonLocalReturnFromInlineLambdaDeep.kt") - public void testNonLocalReturnFromInlineLambdaDeep_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt", "kotlin.coroutines"); - } - - @TestMetadata("nonLocalReturnFromInlineLambda.kt") - public void testNonLocalReturnFromInlineLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("nonLocalReturnFromInlineLambda.kt") - public void testNonLocalReturnFromInlineLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt", "kotlin.coroutines"); + public void testNonLocalReturnFromInlineLambdaDeep() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt"); } @TestMetadata("overrideDefaultArgument.kt") - public void testOverrideDefaultArgument_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/overrideDefaultArgument.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideDefaultArgument.kt") - public void testOverrideDefaultArgument_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/overrideDefaultArgument.kt", "kotlin.coroutines"); + public void testOverrideDefaultArgument() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/overrideDefaultArgument.kt"); } @TestMetadata("recursiveSuspend.kt") - public void testRecursiveSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/recursiveSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("recursiveSuspend.kt") - public void testRecursiveSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/recursiveSuspend.kt", "kotlin.coroutines"); + public void testRecursiveSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/recursiveSuspend.kt"); } @TestMetadata("restrictedSuspendLambda.kt") @@ -7299,23 +6938,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("returnByLabel.kt") - public void testReturnByLabel_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/returnByLabel.kt", "kotlin.coroutines.experimental"); + public void testReturnByLabel() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/returnByLabel.kt"); } - @TestMetadata("returnByLabel.kt") - public void testReturnByLabel_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/returnByLabel.kt", "kotlin.coroutines"); + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/simple.kt"); } @TestMetadata("simpleException.kt") - public void testSimpleException_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simpleException.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("simpleException.kt") - public void testSimpleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simpleException.kt", "kotlin.coroutines"); + public void testSimpleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/simpleException.kt"); } @TestMetadata("simpleSuspendCallableReference.kt") @@ -7324,33 +6958,13 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("simpleWithHandleResult.kt") - public void testSimpleWithHandleResult_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simpleWithHandleResult.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("simpleWithHandleResult.kt") - public void testSimpleWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simpleWithHandleResult.kt", "kotlin.coroutines"); - } - - @TestMetadata("simple.kt") - public void testSimple_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simple.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simple.kt", "kotlin.coroutines"); + public void testSimpleWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/simpleWithHandleResult.kt"); } @TestMetadata("statementLikeLastExpression.kt") - public void testStatementLikeLastExpression_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/statementLikeLastExpression.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("statementLikeLastExpression.kt") - public void testStatementLikeLastExpression_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/statementLikeLastExpression.kt", "kotlin.coroutines"); + public void testStatementLikeLastExpression() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/statementLikeLastExpression.kt"); } @TestMetadata("stopAfter.kt") @@ -7359,23 +6973,13 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("suspendCallsInArguments.kt") - public void testSuspendCallsInArguments_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendCallsInArguments.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendCallsInArguments.kt") - public void testSuspendCallsInArguments_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendCallsInArguments.kt", "kotlin.coroutines"); + public void testSuspendCallsInArguments() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendCallsInArguments.kt"); } @TestMetadata("suspendCoroutineFromStateMachine.kt") - public void testSuspendCoroutineFromStateMachine_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendCoroutineFromStateMachine.kt") - public void testSuspendCoroutineFromStateMachine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt", "kotlin.coroutines"); + public void testSuspendCoroutineFromStateMachine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt"); } @TestMetadata("suspendCovariantJavaOverrides.kt") @@ -7384,43 +6988,23 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("suspendDefaultImpl.kt") - public void testSuspendDefaultImpl_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendDefaultImpl.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendDefaultImpl.kt") - public void testSuspendDefaultImpl_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendDefaultImpl.kt", "kotlin.coroutines"); + public void testSuspendDefaultImpl() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendDefaultImpl.kt"); } @TestMetadata("suspendDelegation.kt") - public void testSuspendDelegation_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendDelegation.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendDelegation.kt") - public void testSuspendDelegation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendDelegation.kt", "kotlin.coroutines"); + public void testSuspendDelegation() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendDelegation.kt"); } @TestMetadata("suspendFromInlineLambda.kt") - public void testSuspendFromInlineLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendFromInlineLambda.kt") - public void testSuspendFromInlineLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt", "kotlin.coroutines"); + public void testSuspendFromInlineLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt"); } @TestMetadata("suspendFunImportedFromObject.kt") - public void testSuspendFunImportedFromObject_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunImportedFromObject.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendFunImportedFromObject.kt") - public void testSuspendFunImportedFromObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunImportedFromObject.kt", "kotlin.coroutines"); + public void testSuspendFunImportedFromObject() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunImportedFromObject.kt"); } @TestMetadata("suspendFunctionMethodReference.kt") @@ -7434,43 +7018,23 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("suspendInCycle.kt") - public void testSuspendInCycle_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInCycle.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendInCycle.kt") - public void testSuspendInCycle_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInCycle.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt") - public void testSuspendInTheMiddleOfObjectConstructionEvaluationOrder_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt") - public void testSuspendInTheMiddleOfObjectConstructionEvaluationOrder_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendInTheMiddleOfObjectConstructionWithJumpOut.kt") - public void testSuspendInTheMiddleOfObjectConstructionWithJumpOut_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionWithJumpOut.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendInTheMiddleOfObjectConstructionWithJumpOut.kt") - public void testSuspendInTheMiddleOfObjectConstructionWithJumpOut_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionWithJumpOut.kt", "kotlin.coroutines"); + public void testSuspendInCycle() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInCycle.kt"); } @TestMetadata("suspendInTheMiddleOfObjectConstruction.kt") - public void testSuspendInTheMiddleOfObjectConstruction_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt", "kotlin.coroutines.experimental"); + public void testSuspendInTheMiddleOfObjectConstruction() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt"); } - @TestMetadata("suspendInTheMiddleOfObjectConstruction.kt") - public void testSuspendInTheMiddleOfObjectConstruction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt", "kotlin.coroutines"); + @TestMetadata("suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt") + public void testSuspendInTheMiddleOfObjectConstructionEvaluationOrder() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt"); + } + + @TestMetadata("suspendInTheMiddleOfObjectConstructionWithJumpOut.kt") + public void testSuspendInTheMiddleOfObjectConstructionWithJumpOut() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionWithJumpOut.kt"); } @TestMetadata("suspendJavaOverrides.kt") @@ -7484,13 +7048,8 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("suspendLambdaWithArgumentRearrangement.kt") - public void testSuspendLambdaWithArgumentRearrangement_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendLambdaWithArgumentRearrangement.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendLambdaWithArgumentRearrangement.kt") - public void testSuspendLambdaWithArgumentRearrangement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendLambdaWithArgumentRearrangement.kt", "kotlin.coroutines"); + public void testSuspendLambdaWithArgumentRearrangement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendLambdaWithArgumentRearrangement.kt"); } @TestMetadata("suspendReturningPlatformType.kt") @@ -7498,24 +7057,14 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/coroutines/suspendReturningPlatformType.kt"); } - @TestMetadata("suspensionInsideSafeCallWithElvis.kt") - public void testSuspensionInsideSafeCallWithElvis_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt", "kotlin.coroutines.experimental"); + @TestMetadata("suspensionInsideSafeCall.kt") + public void testSuspensionInsideSafeCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCall.kt"); } @TestMetadata("suspensionInsideSafeCallWithElvis.kt") - public void testSuspensionInsideSafeCallWithElvis_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspensionInsideSafeCall.kt") - public void testSuspensionInsideSafeCall_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCall.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspensionInsideSafeCall.kt") - public void testSuspensionInsideSafeCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCall.kt", "kotlin.coroutines"); + public void testSuspensionInsideSafeCallWithElvis() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt"); } @TestMetadata("tailCallToNothing.kt") @@ -7524,73 +7073,38 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("tryCatchFinallyWithHandleResult.kt") - public void testTryCatchFinallyWithHandleResult_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("tryCatchFinallyWithHandleResult.kt") - public void testTryCatchFinallyWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt", "kotlin.coroutines"); + public void testTryCatchFinallyWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt"); } @TestMetadata("tryCatchWithHandleResult.kt") - public void testTryCatchWithHandleResult_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryCatchWithHandleResult.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("tryCatchWithHandleResult.kt") - public void testTryCatchWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryCatchWithHandleResult.kt", "kotlin.coroutines"); + public void testTryCatchWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryCatchWithHandleResult.kt"); } @TestMetadata("tryFinallyInsideInlineLambda.kt") - public void testTryFinallyInsideInlineLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("tryFinallyInsideInlineLambda.kt") - public void testTryFinallyInsideInlineLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt", "kotlin.coroutines"); + public void testTryFinallyInsideInlineLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt"); } @TestMetadata("tryFinallyWithHandleResult.kt") - public void testTryFinallyWithHandleResult_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryFinallyWithHandleResult.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("tryFinallyWithHandleResult.kt") - public void testTryFinallyWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryFinallyWithHandleResult.kt", "kotlin.coroutines"); + public void testTryFinallyWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryFinallyWithHandleResult.kt"); } @TestMetadata("varCaptuedInCoroutineIntrinsic.kt") - public void testVarCaptuedInCoroutineIntrinsic_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varCaptuedInCoroutineIntrinsic.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("varCaptuedInCoroutineIntrinsic.kt") - public void testVarCaptuedInCoroutineIntrinsic_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varCaptuedInCoroutineIntrinsic.kt", "kotlin.coroutines"); - } - - @TestMetadata("varValueConflictsWithTableSameSort.kt") - public void testVarValueConflictsWithTableSameSort_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("varValueConflictsWithTableSameSort.kt") - public void testVarValueConflictsWithTableSameSort_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt", "kotlin.coroutines"); + public void testVarCaptuedInCoroutineIntrinsic() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varCaptuedInCoroutineIntrinsic.kt"); } @TestMetadata("varValueConflictsWithTable.kt") - public void testVarValueConflictsWithTable_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varValueConflictsWithTable.kt", "kotlin.coroutines.experimental"); + public void testVarValueConflictsWithTable() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varValueConflictsWithTable.kt"); } - @TestMetadata("varValueConflictsWithTable.kt") - public void testVarValueConflictsWithTable_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varValueConflictsWithTable.kt", "kotlin.coroutines"); + @TestMetadata("varValueConflictsWithTableSameSort.kt") + public void testVarValueConflictsWithTableSameSort() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt"); } @TestMetadata("compiler/testData/codegen/box/coroutines/bridges") @@ -7601,42 +7115,23 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInBridges() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/bridges"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("interfaceSpecialization.kt") - public void testInterfaceSpecialization_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/interfaceSpecialization.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("interfaceSpecialization.kt") - public void testInterfaceSpecialization_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/interfaceSpecialization.kt", "kotlin.coroutines"); + public void testInterfaceSpecialization() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/bridges/interfaceSpecialization.kt"); } @TestMetadata("lambdaWithLongReceiver.kt") - public void testLambdaWithLongReceiver_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/lambdaWithLongReceiver.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("lambdaWithLongReceiver.kt") - public void testLambdaWithLongReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/lambdaWithLongReceiver.kt", "kotlin.coroutines"); + public void testLambdaWithLongReceiver() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithLongReceiver.kt"); } @TestMetadata("lambdaWithMultipleParameters.kt") - public void testLambdaWithMultipleParameters_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("lambdaWithMultipleParameters.kt") - public void testLambdaWithMultipleParameters_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt", "kotlin.coroutines"); + public void testLambdaWithMultipleParameters() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt"); } } @@ -7648,112 +7143,58 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInControlFlow() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/controlFlow"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("breakFinally.kt") - public void testBreakFinally_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/breakFinally.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("breakFinally.kt") - public void testBreakFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/breakFinally.kt", "kotlin.coroutines"); + public void testBreakFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/breakFinally.kt"); } @TestMetadata("breakStatement.kt") - public void testBreakStatement_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/breakStatement.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("breakStatement.kt") - public void testBreakStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/breakStatement.kt", "kotlin.coroutines"); + public void testBreakStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/breakStatement.kt"); } @TestMetadata("complexChainSuspend.kt") - public void testComplexChainSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/complexChainSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("complexChainSuspend.kt") - public void testComplexChainSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/complexChainSuspend.kt", "kotlin.coroutines"); + public void testComplexChainSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/complexChainSuspend.kt"); } @TestMetadata("doWhileStatement.kt") - public void testDoWhileStatement_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/doWhileStatement.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("doWhileStatement.kt") - public void testDoWhileStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/doWhileStatement.kt", "kotlin.coroutines"); + public void testDoWhileStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/doWhileStatement.kt"); } @TestMetadata("doubleBreak.kt") - public void testDoubleBreak_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/doubleBreak.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("doubleBreak.kt") - public void testDoubleBreak_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/doubleBreak.kt", "kotlin.coroutines"); + public void testDoubleBreak() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/doubleBreak.kt"); } @TestMetadata("finallyCatch.kt") - public void testFinallyCatch_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/finallyCatch.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("finallyCatch.kt") - public void testFinallyCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/finallyCatch.kt", "kotlin.coroutines"); + public void testFinallyCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/finallyCatch.kt"); } @TestMetadata("forContinue.kt") - public void testForContinue_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forContinue.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("forContinue.kt") - public void testForContinue_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forContinue.kt", "kotlin.coroutines"); + public void testForContinue() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/forContinue.kt"); } @TestMetadata("forStatement.kt") - public void testForStatement_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forStatement.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("forStatement.kt") - public void testForStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forStatement.kt", "kotlin.coroutines"); + public void testForStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/forStatement.kt"); } @TestMetadata("forWithStep.kt") - public void testForWithStep_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forWithStep.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("forWithStep.kt") - public void testForWithStep_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forWithStep.kt", "kotlin.coroutines"); + public void testForWithStep() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/forWithStep.kt"); } @TestMetadata("ifStatement.kt") - public void testIfStatement_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("ifStatement.kt") - public void testIfStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt", "kotlin.coroutines"); + public void testIfStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt"); } @TestMetadata("kt22694_1_3.kt") @@ -7762,113 +7203,58 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("labeledWhile.kt") - public void testLabeledWhile_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/labeledWhile.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("labeledWhile.kt") - public void testLabeledWhile_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/labeledWhile.kt", "kotlin.coroutines"); + public void testLabeledWhile() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/labeledWhile.kt"); } @TestMetadata("multipleCatchBlocksSuspend.kt") - public void testMultipleCatchBlocksSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/multipleCatchBlocksSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("multipleCatchBlocksSuspend.kt") - public void testMultipleCatchBlocksSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/multipleCatchBlocksSuspend.kt", "kotlin.coroutines"); + public void testMultipleCatchBlocksSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/multipleCatchBlocksSuspend.kt"); } @TestMetadata("returnFromFinally.kt") - public void testReturnFromFinally_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/returnFromFinally.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("returnFromFinally.kt") - public void testReturnFromFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/returnFromFinally.kt", "kotlin.coroutines"); + public void testReturnFromFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/returnFromFinally.kt"); } @TestMetadata("returnWithFinally.kt") - public void testReturnWithFinally_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/returnWithFinally.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("returnWithFinally.kt") - public void testReturnWithFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/returnWithFinally.kt", "kotlin.coroutines"); + public void testReturnWithFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/returnWithFinally.kt"); } @TestMetadata("suspendInStringTemplate.kt") - public void testSuspendInStringTemplate_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/suspendInStringTemplate.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendInStringTemplate.kt") - public void testSuspendInStringTemplate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/suspendInStringTemplate.kt", "kotlin.coroutines"); + public void testSuspendInStringTemplate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/suspendInStringTemplate.kt"); } @TestMetadata("switchLikeWhen.kt") - public void testSwitchLikeWhen_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/switchLikeWhen.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("switchLikeWhen.kt") - public void testSwitchLikeWhen_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/switchLikeWhen.kt", "kotlin.coroutines"); + public void testSwitchLikeWhen() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/switchLikeWhen.kt"); } @TestMetadata("throwFromCatch.kt") - public void testThrowFromCatch_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwFromCatch.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("throwFromCatch.kt") - public void testThrowFromCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwFromCatch.kt", "kotlin.coroutines"); + public void testThrowFromCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/throwFromCatch.kt"); } @TestMetadata("throwFromFinally.kt") - public void testThrowFromFinally_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwFromFinally.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("throwFromFinally.kt") - public void testThrowFromFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwFromFinally.kt", "kotlin.coroutines"); + public void testThrowFromFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/throwFromFinally.kt"); } @TestMetadata("throwInTryWithHandleResult.kt") - public void testThrowInTryWithHandleResult_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("throwInTryWithHandleResult.kt") - public void testThrowInTryWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt", "kotlin.coroutines"); + public void testThrowInTryWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt"); } @TestMetadata("whenWithSuspensions.kt") - public void testWhenWithSuspensions_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/whenWithSuspensions.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("whenWithSuspensions.kt") - public void testWhenWithSuspensions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/whenWithSuspensions.kt", "kotlin.coroutines"); + public void testWhenWithSuspensions() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/whenWithSuspensions.kt"); } @TestMetadata("whileStatement.kt") - public void testWhileStatement_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/whileStatement.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("whileStatement.kt") - public void testWhileStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/whileStatement.kt", "kotlin.coroutines"); + public void testWhileStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/whileStatement.kt"); } } @@ -7933,22 +7319,13 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInFeatureIntersection() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/featureIntersection"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("breakWithNonEmptyStack.kt") - public void testBreakWithNonEmptyStack_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("breakWithNonEmptyStack.kt") - public void testBreakWithNonEmptyStack_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt", "kotlin.coroutines"); + public void testBreakWithNonEmptyStack() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt"); } @TestMetadata("defaultExpect.kt") @@ -7957,23 +7334,13 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("delegate.kt") - public void testDelegate_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("delegate.kt") - public void testDelegate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt", "kotlin.coroutines"); + public void testDelegate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt"); } @TestMetadata("destructuringInLambdas.kt") - public void testDestructuringInLambdas_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("destructuringInLambdas.kt") - public void testDestructuringInLambdas_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt", "kotlin.coroutines"); + public void testDestructuringInLambdas() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt"); } @TestMetadata("funInterface.kt") @@ -7982,13 +7349,8 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("inlineSuspendFinally.kt") - public void testInlineSuspendFinally_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/inlineSuspendFinally.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendFinally.kt") - public void testInlineSuspendFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/inlineSuspendFinally.kt", "kotlin.coroutines"); + public void testInlineSuspendFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/inlineSuspendFinally.kt"); } @TestMetadata("interfaceMethodWithBody.kt") @@ -8006,34 +7368,19 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/coroutines/featureIntersection/overrideInInlineClass.kt"); } - @TestMetadata("safeCallOnTwoReceiversLong.kt") - public void testSafeCallOnTwoReceiversLong_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt", "kotlin.coroutines.experimental"); + @TestMetadata("safeCallOnTwoReceivers.kt") + public void testSafeCallOnTwoReceivers() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt"); } @TestMetadata("safeCallOnTwoReceiversLong.kt") - public void testSafeCallOnTwoReceiversLong_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt", "kotlin.coroutines"); - } - - @TestMetadata("safeCallOnTwoReceivers.kt") - public void testSafeCallOnTwoReceivers_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("safeCallOnTwoReceivers.kt") - public void testSafeCallOnTwoReceivers_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt", "kotlin.coroutines"); + public void testSafeCallOnTwoReceiversLong() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt"); } @TestMetadata("suspendDestructuringInLambdas.kt") - public void testSuspendDestructuringInLambdas_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendDestructuringInLambdas.kt") - public void testSuspendDestructuringInLambdas_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt", "kotlin.coroutines"); + public void testSuspendDestructuringInLambdas() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt"); } @TestMetadata("suspendFunctionIsAs.kt") @@ -8042,43 +7389,23 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("suspendInlineSuspendFinally.kt") - public void testSuspendInlineSuspendFinally_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendInlineSuspendFinally.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendInlineSuspendFinally.kt") - public void testSuspendInlineSuspendFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendInlineSuspendFinally.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendOperatorPlusAssign.kt") - public void testSuspendOperatorPlusAssign_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusAssign.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendOperatorPlusAssign.kt") - public void testSuspendOperatorPlusAssign_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusAssign.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendOperatorPlusCallFromLambda.kt") - public void testSuspendOperatorPlusCallFromLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusCallFromLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendOperatorPlusCallFromLambda.kt") - public void testSuspendOperatorPlusCallFromLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusCallFromLambda.kt", "kotlin.coroutines"); + public void testSuspendInlineSuspendFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendInlineSuspendFinally.kt"); } @TestMetadata("suspendOperatorPlus.kt") - public void testSuspendOperatorPlus_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlus.kt", "kotlin.coroutines.experimental"); + public void testSuspendOperatorPlus() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlus.kt"); } - @TestMetadata("suspendOperatorPlus.kt") - public void testSuspendOperatorPlus_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlus.kt", "kotlin.coroutines"); + @TestMetadata("suspendOperatorPlusAssign.kt") + public void testSuspendOperatorPlusAssign() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusAssign.kt"); + } + + @TestMetadata("suspendOperatorPlusCallFromLambda.kt") + public void testSuspendOperatorPlusCallFromLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusCallFromLambda.kt"); } @TestMetadata("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference") @@ -8089,22 +7416,13 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInCallableReference() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("bigArity.kt") - public void testBigArity_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/bigArity.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("bigArity.kt") - public void testBigArity_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/bigArity.kt", "kotlin.coroutines"); + public void testBigArity() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/bigArity.kt"); } @TestMetadata("fromJava.kt") @@ -8190,142 +7508,73 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInTailrec() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("controlFlowIf.kt") - public void testControlFlowIf_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowIf.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("controlFlowIf.kt") - public void testControlFlowIf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowIf.kt", "kotlin.coroutines"); + public void testControlFlowIf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowIf.kt"); } @TestMetadata("controlFlowWhen.kt") - public void testControlFlowWhen_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowWhen.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("controlFlowWhen.kt") - public void testControlFlowWhen_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowWhen.kt", "kotlin.coroutines"); + public void testControlFlowWhen() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowWhen.kt"); } @TestMetadata("extention.kt") - public void testExtention_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/extention.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("extention.kt") - public void testExtention_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/extention.kt", "kotlin.coroutines"); + public void testExtention() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/extention.kt"); } @TestMetadata("infixCall.kt") - public void testInfixCall_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixCall.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("infixCall.kt") - public void testInfixCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixCall.kt", "kotlin.coroutines"); + public void testInfixCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixCall.kt"); } @TestMetadata("infixRecursiveCall.kt") - public void testInfixRecursiveCall_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixRecursiveCall.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("infixRecursiveCall.kt") - public void testInfixRecursiveCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixRecursiveCall.kt", "kotlin.coroutines"); + public void testInfixRecursiveCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixRecursiveCall.kt"); } @TestMetadata("realIteratorFoldl.kt") - public void testRealIteratorFoldl_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realIteratorFoldl.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("realIteratorFoldl.kt") - public void testRealIteratorFoldl_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realIteratorFoldl.kt", "kotlin.coroutines"); + public void testRealIteratorFoldl() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realIteratorFoldl.kt"); } @TestMetadata("realStringEscape.kt") - public void testRealStringEscape_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringEscape.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("realStringEscape.kt") - public void testRealStringEscape_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringEscape.kt", "kotlin.coroutines"); + public void testRealStringEscape() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringEscape.kt"); } @TestMetadata("realStringRepeat.kt") - public void testRealStringRepeat_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringRepeat.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("realStringRepeat.kt") - public void testRealStringRepeat_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringRepeat.kt", "kotlin.coroutines"); + public void testRealStringRepeat() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringRepeat.kt"); } @TestMetadata("returnInParentheses.kt") - public void testReturnInParentheses_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/returnInParentheses.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("returnInParentheses.kt") - public void testReturnInParentheses_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/returnInParentheses.kt", "kotlin.coroutines"); + public void testReturnInParentheses() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/returnInParentheses.kt"); } @TestMetadata("sum.kt") - public void testSum_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/sum.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("sum.kt") - public void testSum_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/sum.kt", "kotlin.coroutines"); + public void testSum() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/sum.kt"); } @TestMetadata("tailCallInBlockInParentheses.kt") - public void testTailCallInBlockInParentheses_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInBlockInParentheses.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("tailCallInBlockInParentheses.kt") - public void testTailCallInBlockInParentheses_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInBlockInParentheses.kt", "kotlin.coroutines"); + public void testTailCallInBlockInParentheses() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInBlockInParentheses.kt"); } @TestMetadata("tailCallInParentheses.kt") - public void testTailCallInParentheses_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInParentheses.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("tailCallInParentheses.kt") - public void testTailCallInParentheses_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInParentheses.kt", "kotlin.coroutines"); + public void testTailCallInParentheses() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInParentheses.kt"); } @TestMetadata("whenWithIs.kt") - public void testWhenWithIs_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/whenWithIs.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("whenWithIs.kt") - public void testWhenWithIs_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/whenWithIs.kt", "kotlin.coroutines"); + public void testWhenWithIs() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/whenWithIs.kt"); } } } @@ -8355,10 +7604,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInDirect() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses/direct"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @@ -8374,113 +7619,58 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Any.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineInt() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineInt.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Int.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Long() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Long.kt"); } @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_NAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_NAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_nonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_nonLocalReturn.kt"); } @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_suspendFunType() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_suspendFunType.kt"); } @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationCrossinline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationCrossinline.kt", "kotlin.coroutines"); + public void testBridgeGenerationCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationCrossinline.kt"); } @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationNonInline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationNonInline.kt", "kotlin.coroutines"); + public void testBridgeGenerationNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationNonInline.kt"); } @TestMetadata("covariantOverrideSuspendFun.kt") @@ -8594,13 +7784,8 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); + public void testInterfaceDelegateWithInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt"); } @TestMetadata("invokeOperator.kt") @@ -8609,53 +7794,28 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt"); } @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any.kt"); } @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_itf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_itf.kt"); } @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_this.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_this.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_this() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_this.kt"); } @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Int.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Int.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Int.kt"); } @TestMetadata("returnResult.kt") @@ -8672,10 +7832,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInResume() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses/resume"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @@ -8691,113 +7847,58 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Any.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineInt() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineInt.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Int.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Long() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Long.kt"); } @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_NAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_NAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_nonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_nonLocalReturn.kt"); } @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_suspendFunType() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_suspendFunType.kt"); } @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationCrossinline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationCrossinline.kt", "kotlin.coroutines"); + public void testBridgeGenerationCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationCrossinline.kt"); } @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationNonInline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationNonInline.kt", "kotlin.coroutines"); + public void testBridgeGenerationNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationNonInline.kt"); } @TestMetadata("covariantOverrideSuspendFun.kt") @@ -8911,13 +8012,8 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); + public void testInterfaceDelegateWithInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt"); } @TestMetadata("invokeOperator.kt") @@ -8926,53 +8022,28 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt"); } @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any.kt"); } @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_itf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_itf.kt"); } @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_this.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_this.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_this() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_this.kt"); } @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Int.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Int.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Int.kt"); } @TestMetadata("returnResult.kt") @@ -8989,10 +8060,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInResumeWithException() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @@ -9008,113 +8075,58 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Any.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineInt() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineInt.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Int.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Long() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Long.kt"); } @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_NAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_NAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_nonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_nonLocalReturn.kt"); } @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_suspendFunType() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_suspendFunType.kt"); } @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationCrossinline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationCrossinline.kt", "kotlin.coroutines"); + public void testBridgeGenerationCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationCrossinline.kt"); } @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationNonInline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationNonInline.kt", "kotlin.coroutines"); + public void testBridgeGenerationNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationNonInline.kt"); } @TestMetadata("covariantOverrideSuspendFun.kt") @@ -9213,13 +8225,8 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); + public void testInterfaceDelegateWithInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt"); } @TestMetadata("invokeOperator.kt") @@ -9228,53 +8235,28 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt"); } @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any.kt"); } @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_itf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_itf.kt"); } @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_this.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_this.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_this() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_this.kt"); } @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Int.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Int.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Int.kt"); } @TestMetadata("returnResult.kt") @@ -9292,32 +8274,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInIntLikeVarSpilling() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/intLikeVarSpilling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("complicatedMerge.kt") - public void testComplicatedMerge_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("complicatedMerge.kt") - public void testComplicatedMerge_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt", "kotlin.coroutines"); + public void testComplicatedMerge() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt"); } @TestMetadata("i2bResult.kt") - public void testI2bResult_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("i2bResult.kt") - public void testI2bResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines"); + public void testI2bResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt"); } @TestMetadata("listThrowablePairInOneSlot.kt") @@ -9326,83 +8294,43 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("loadFromBooleanArray.kt") - public void testLoadFromBooleanArray_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("loadFromBooleanArray.kt") - public void testLoadFromBooleanArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines"); + public void testLoadFromBooleanArray() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt"); } @TestMetadata("loadFromByteArray.kt") - public void testLoadFromByteArray_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("loadFromByteArray.kt") - public void testLoadFromByteArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt", "kotlin.coroutines"); + public void testLoadFromByteArray() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt"); } @TestMetadata("noVariableInTable.kt") - public void testNoVariableInTable_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("noVariableInTable.kt") - public void testNoVariableInTable_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt", "kotlin.coroutines"); + public void testNoVariableInTable() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt"); } @TestMetadata("sameIconst1ManyVars.kt") - public void testSameIconst1ManyVars_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("sameIconst1ManyVars.kt") - public void testSameIconst1ManyVars_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt", "kotlin.coroutines"); + public void testSameIconst1ManyVars() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt"); } @TestMetadata("usedInArrayStore.kt") - public void testUsedInArrayStore_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInArrayStore.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("usedInArrayStore.kt") - public void testUsedInArrayStore_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInArrayStore.kt", "kotlin.coroutines"); + public void testUsedInArrayStore() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInArrayStore.kt"); } @TestMetadata("usedInMethodCall.kt") - public void testUsedInMethodCall_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("usedInMethodCall.kt") - public void testUsedInMethodCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt", "kotlin.coroutines"); + public void testUsedInMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt"); } @TestMetadata("usedInPutfield.kt") - public void testUsedInPutfield_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInPutfield.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("usedInPutfield.kt") - public void testUsedInPutfield_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInPutfield.kt", "kotlin.coroutines"); + public void testUsedInPutfield() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInPutfield.kt"); } @TestMetadata("usedInVarStore.kt") - public void testUsedInVarStore_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("usedInVarStore.kt") - public void testUsedInVarStore_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt", "kotlin.coroutines"); + public void testUsedInVarStore() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt"); } } @@ -9414,92 +8342,48 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInIntrinsicSemantics() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/intrinsicSemantics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } - @TestMetadata("coroutineContextReceiverNotIntrinsic.kt") - public void testCoroutineContextReceiverNotIntrinsic_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiverNotIntrinsic.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("coroutineContextReceiverNotIntrinsic.kt") - public void testCoroutineContextReceiverNotIntrinsic_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiverNotIntrinsic.kt", "kotlin.coroutines"); + @TestMetadata("coroutineContext.kt") + public void testCoroutineContext() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContext.kt"); } @TestMetadata("coroutineContextReceiver.kt") - public void testCoroutineContextReceiver_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiver.kt", "kotlin.coroutines.experimental"); + public void testCoroutineContextReceiver() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiver.kt"); } - @TestMetadata("coroutineContextReceiver.kt") - public void testCoroutineContextReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiver.kt", "kotlin.coroutines"); - } - - @TestMetadata("coroutineContext.kt") - public void testCoroutineContext_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContext.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("coroutineContext.kt") - public void testCoroutineContext_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContext.kt", "kotlin.coroutines"); + @TestMetadata("coroutineContextReceiverNotIntrinsic.kt") + public void testCoroutineContextReceiverNotIntrinsic() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiverNotIntrinsic.kt"); } @TestMetadata("intercepted.kt") - public void testIntercepted_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/intercepted.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("intercepted.kt") - public void testIntercepted_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/intercepted.kt", "kotlin.coroutines"); - } - - @TestMetadata("startCoroutineUninterceptedOrReturnInterception.kt") - public void testStartCoroutineUninterceptedOrReturnInterception_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("startCoroutineUninterceptedOrReturnInterception.kt") - public void testStartCoroutineUninterceptedOrReturnInterception_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt", "kotlin.coroutines"); - } - - @TestMetadata("startCoroutineUninterceptedOrReturn.kt") - public void testStartCoroutineUninterceptedOrReturn_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("startCoroutineUninterceptedOrReturn.kt") - public void testStartCoroutineUninterceptedOrReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt", "kotlin.coroutines"); + public void testIntercepted() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/intercepted.kt"); } @TestMetadata("startCoroutine.kt") - public void testStartCoroutine_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt", "kotlin.coroutines.experimental"); + public void testStartCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt"); } - @TestMetadata("startCoroutine.kt") - public void testStartCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt", "kotlin.coroutines"); + @TestMetadata("startCoroutineUninterceptedOrReturn.kt") + public void testStartCoroutineUninterceptedOrReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt"); + } + + @TestMetadata("startCoroutineUninterceptedOrReturnInterception.kt") + public void testStartCoroutineUninterceptedOrReturnInterception() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt"); } @TestMetadata("suspendCoroutineUninterceptedOrReturn.kt") - public void testSuspendCoroutineUninterceptedOrReturn_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/suspendCoroutineUninterceptedOrReturn.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendCoroutineUninterceptedOrReturn.kt") - public void testSuspendCoroutineUninterceptedOrReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/suspendCoroutineUninterceptedOrReturn.kt", "kotlin.coroutines"); + public void testSuspendCoroutineUninterceptedOrReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/suspendCoroutineUninterceptedOrReturn.kt"); } } @@ -9511,62 +8395,33 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInJavaInterop() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("objectWithSeveralSuspends.kt") - public void testObjectWithSeveralSuspends_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/objectWithSeveralSuspends.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("objectWithSeveralSuspends.kt") - public void testObjectWithSeveralSuspends_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/objectWithSeveralSuspends.kt", "kotlin.coroutines"); + public void testObjectWithSeveralSuspends() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/javaInterop/objectWithSeveralSuspends.kt"); } @TestMetadata("returnLambda.kt") - public void testReturnLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/returnLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("returnLambda.kt") - public void testReturnLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/returnLambda.kt", "kotlin.coroutines"); + public void testReturnLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/javaInterop/returnLambda.kt"); } @TestMetadata("returnObject.kt") - public void testReturnObject_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/returnObject.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("returnObject.kt") - public void testReturnObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/returnObject.kt", "kotlin.coroutines"); + public void testReturnObject() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/javaInterop/returnObject.kt"); } @TestMetadata("severalCaptures.kt") - public void testSeveralCaptures_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/severalCaptures.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("severalCaptures.kt") - public void testSeveralCaptures_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/severalCaptures.kt", "kotlin.coroutines"); + public void testSeveralCaptures() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/javaInterop/severalCaptures.kt"); } @TestMetadata("suspendInlineWithCrossinline.kt") - public void testSuspendInlineWithCrossinline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/suspendInlineWithCrossinline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendInlineWithCrossinline.kt") - public void testSuspendInlineWithCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/suspendInlineWithCrossinline.kt", "kotlin.coroutines"); + public void testSuspendInlineWithCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/javaInterop/suspendInlineWithCrossinline.kt"); } } @@ -9590,22 +8445,13 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInAnonymous() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/localFunctions/anonymous"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("simple.kt") - public void testSimple_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/anonymous/simple.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/anonymous/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/anonymous/simple.kt"); } } @@ -9617,72 +8463,38 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInNamed() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/localFunctions/named"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("capturedParameters.kt") - public void testCapturedParameters_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedParameters.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("capturedParameters.kt") - public void testCapturedParameters_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedParameters.kt", "kotlin.coroutines"); + public void testCapturedParameters() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedParameters.kt"); } @TestMetadata("capturedVariables.kt") - public void testCapturedVariables_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedVariables.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("capturedVariables.kt") - public void testCapturedVariables_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedVariables.kt", "kotlin.coroutines"); + public void testCapturedVariables() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedVariables.kt"); } @TestMetadata("extension.kt") - public void testExtension_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/extension.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("extension.kt") - public void testExtension_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/extension.kt", "kotlin.coroutines"); + public void testExtension() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/extension.kt"); } @TestMetadata("infix.kt") - public void testInfix_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/infix.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("infix.kt") - public void testInfix_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/infix.kt", "kotlin.coroutines"); + public void testInfix() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/infix.kt"); } @TestMetadata("insideLambda.kt") - public void testInsideLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/insideLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("insideLambda.kt") - public void testInsideLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/insideLambda.kt", "kotlin.coroutines"); + public void testInsideLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/insideLambda.kt"); } @TestMetadata("nestedLocals.kt") - public void testNestedLocals_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/nestedLocals.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("nestedLocals.kt") - public void testNestedLocals_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/nestedLocals.kt", "kotlin.coroutines"); + public void testNestedLocals() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/nestedLocals.kt"); } @TestMetadata("rec.kt") @@ -9690,44 +8502,24 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/rec.kt"); } - @TestMetadata("simpleSuspensionPoint.kt") - public void testSimpleSuspensionPoint_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/simpleSuspensionPoint.kt", "kotlin.coroutines.experimental"); + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/simple.kt"); } @TestMetadata("simpleSuspensionPoint.kt") - public void testSimpleSuspensionPoint_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/simpleSuspensionPoint.kt", "kotlin.coroutines"); - } - - @TestMetadata("simple.kt") - public void testSimple_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/simple.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/simple.kt", "kotlin.coroutines"); + public void testSimpleSuspensionPoint() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/simpleSuspensionPoint.kt"); } @TestMetadata("stateMachine.kt") - public void testStateMachine_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/stateMachine.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("stateMachine.kt") - public void testStateMachine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/stateMachine.kt", "kotlin.coroutines"); + public void testStateMachine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/stateMachine.kt"); } @TestMetadata("withArguments.kt") - public void testWithArguments_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/withArguments.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("withArguments.kt") - public void testWithArguments_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/withArguments.kt", "kotlin.coroutines"); + public void testWithArguments() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/withArguments.kt"); } } } @@ -9740,82 +8532,43 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInMultiModule() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("inlineCrossModule.kt") - public void testInlineCrossModule_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineCrossModule.kt") - public void testInlineCrossModule_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt", "kotlin.coroutines"); + public void testInlineCrossModule() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt"); } @TestMetadata("inlineFunctionWithOptionalParam.kt") - public void testInlineFunctionWithOptionalParam_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineFunctionWithOptionalParam.kt") - public void testInlineFunctionWithOptionalParam_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt", "kotlin.coroutines"); - } - - @TestMetadata("inlineMultiModuleOverride.kt") - public void testInlineMultiModuleOverride_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleOverride.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineMultiModuleOverride.kt") - public void testInlineMultiModuleOverride_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleOverride.kt", "kotlin.coroutines"); - } - - @TestMetadata("inlineMultiModuleWithController.kt") - public void testInlineMultiModuleWithController_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithController.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineMultiModuleWithController.kt") - public void testInlineMultiModuleWithController_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithController.kt", "kotlin.coroutines"); - } - - @TestMetadata("inlineMultiModuleWithInnerInlining.kt") - public void testInlineMultiModuleWithInnerInlining_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithInnerInlining.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineMultiModuleWithInnerInlining.kt") - public void testInlineMultiModuleWithInnerInlining_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithInnerInlining.kt", "kotlin.coroutines"); + public void testInlineFunctionWithOptionalParam() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt"); } @TestMetadata("inlineMultiModule.kt") - public void testInlineMultiModule_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModule.kt", "kotlin.coroutines.experimental"); + public void testInlineMultiModule() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModule.kt"); } - @TestMetadata("inlineMultiModule.kt") - public void testInlineMultiModule_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModule.kt", "kotlin.coroutines"); + @TestMetadata("inlineMultiModuleOverride.kt") + public void testInlineMultiModuleOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleOverride.kt"); + } + + @TestMetadata("inlineMultiModuleWithController.kt") + public void testInlineMultiModuleWithController() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithController.kt"); + } + + @TestMetadata("inlineMultiModuleWithInnerInlining.kt") + public void testInlineMultiModuleWithInnerInlining() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithInnerInlining.kt"); } @TestMetadata("inlineTailCall.kt") - public void testInlineTailCall_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineTailCall.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineTailCall.kt") - public void testInlineTailCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineTailCall.kt", "kotlin.coroutines"); + public void testInlineTailCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineTailCall.kt"); } @TestMetadata("inlineWithJava.kt") @@ -9824,13 +8577,8 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("simple.kt") - public void testSimple_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/simple.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/simple.kt"); } } @@ -9842,22 +8590,13 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInRedundantLocalsElimination() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/redundantLocalsElimination"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("ktor_receivedMessage.kt") - public void testKtor_receivedMessage_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/redundantLocalsElimination/ktor_receivedMessage.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("ktor_receivedMessage.kt") - public void testKtor_receivedMessage_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/redundantLocalsElimination/ktor_receivedMessage.kt", "kotlin.coroutines"); + public void testKtor_receivedMessage() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/redundantLocalsElimination/ktor_receivedMessage.kt"); } } @@ -9897,72 +8636,38 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInStackUnwinding() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/stackUnwinding"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("exception.kt") - public void testException_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/exception.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("exception.kt") - public void testException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/exception.kt", "kotlin.coroutines"); + public void testException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/exception.kt"); } @TestMetadata("inlineSuspendFunction.kt") - public void testInlineSuspendFunction_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendFunction.kt") - public void testInlineSuspendFunction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt", "kotlin.coroutines"); - } - - @TestMetadata("rethrowInFinallyWithSuspension.kt") - public void testRethrowInFinallyWithSuspension_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinallyWithSuspension.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("rethrowInFinallyWithSuspension.kt") - public void testRethrowInFinallyWithSuspension_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinallyWithSuspension.kt", "kotlin.coroutines"); + public void testInlineSuspendFunction() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt"); } @TestMetadata("rethrowInFinally.kt") - public void testRethrowInFinally_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinally.kt", "kotlin.coroutines.experimental"); + public void testRethrowInFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinally.kt"); } - @TestMetadata("rethrowInFinally.kt") - public void testRethrowInFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinally.kt", "kotlin.coroutines"); + @TestMetadata("rethrowInFinallyWithSuspension.kt") + public void testRethrowInFinallyWithSuspension() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinallyWithSuspension.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt"); } @TestMetadata("suspendInCycle.kt") - public void testSuspendInCycle_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendInCycle.kt") - public void testSuspendInCycle_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt", "kotlin.coroutines"); + public void testSuspendInCycle() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt"); } } @@ -10007,32 +8712,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInSuspendFunctionAsCoroutine() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("dispatchResume.kt") - public void testDispatchResume_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("dispatchResume.kt") - public void testDispatchResume_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt", "kotlin.coroutines"); + public void testDispatchResume() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt"); } @TestMetadata("handleException.kt") - public void testHandleException_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("handleException.kt") - public void testHandleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt", "kotlin.coroutines"); + public void testHandleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt"); } @TestMetadata("ifExpressionInsideCoroutine_1_3.kt") @@ -10040,44 +8731,24 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine_1_3.kt"); } - @TestMetadata("inlineTwoReceivers.kt") - public void testInlineTwoReceivers_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt", "kotlin.coroutines.experimental"); + @TestMetadata("inline.kt") + public void testInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt"); } @TestMetadata("inlineTwoReceivers.kt") - public void testInlineTwoReceivers_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt", "kotlin.coroutines"); - } - - @TestMetadata("inline.kt") - public void testInline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inline.kt") - public void testInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt", "kotlin.coroutines"); + public void testInlineTwoReceivers() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt"); } @TestMetadata("member.kt") - public void testMember_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("member.kt") - public void testMember_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt", "kotlin.coroutines"); + public void testMember() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt"); } @TestMetadata("noinlineTwoReceivers.kt") - public void testNoinlineTwoReceivers_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("noinlineTwoReceivers.kt") - public void testNoinlineTwoReceivers_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt", "kotlin.coroutines"); + public void testNoinlineTwoReceivers() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt"); } @TestMetadata("openFunWithJava.kt") @@ -10086,103 +8757,53 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("operators.kt") - public void testOperators_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("operators.kt") - public void testOperators_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt", "kotlin.coroutines"); + public void testOperators() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt"); } @TestMetadata("privateFunctions.kt") - public void testPrivateFunctions_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("privateFunctions.kt") - public void testPrivateFunctions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt", "kotlin.coroutines"); + public void testPrivateFunctions() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt"); } @TestMetadata("privateInFile.kt") - public void testPrivateInFile_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("privateInFile.kt") - public void testPrivateInFile_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt", "kotlin.coroutines"); + public void testPrivateInFile() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt"); } @TestMetadata("returnNoSuspend.kt") - public void testReturnNoSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("returnNoSuspend.kt") - public void testReturnNoSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt", "kotlin.coroutines"); + public void testReturnNoSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt", "kotlin.coroutines"); - } - - @TestMetadata("superCallAbstractClass.kt") - public void testSuperCallAbstractClass_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallAbstractClass.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("superCallAbstractClass.kt") - public void testSuperCallAbstractClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallAbstractClass.kt", "kotlin.coroutines"); - } - - @TestMetadata("superCallInterface.kt") - public void testSuperCallInterface_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallInterface.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("superCallInterface.kt") - public void testSuperCallInterface_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallInterface.kt", "kotlin.coroutines"); - } - - @TestMetadata("superCallOverload.kt") - public void testSuperCallOverload_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallOverload.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("superCallOverload.kt") - public void testSuperCallOverload_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallOverload.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt"); } @TestMetadata("superCall.kt") - public void testSuperCall_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt", "kotlin.coroutines.experimental"); + public void testSuperCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt"); } - @TestMetadata("superCall.kt") - public void testSuperCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt", "kotlin.coroutines"); + @TestMetadata("superCallAbstractClass.kt") + public void testSuperCallAbstractClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallAbstractClass.kt"); + } + + @TestMetadata("superCallInterface.kt") + public void testSuperCallInterface() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallInterface.kt"); + } + + @TestMetadata("superCallOverload.kt") + public void testSuperCallOverload() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallOverload.kt"); } @TestMetadata("withVariables.kt") - public void testWithVariables_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("withVariables.kt") - public void testWithVariables_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt", "kotlin.coroutines"); + public void testWithVariables() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt"); } } @@ -10194,62 +8815,33 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInSuspendFunctionTypeCall() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("localVal.kt") - public void testLocalVal_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("localVal.kt") - public void testLocalVal_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt", "kotlin.coroutines"); - } - - @TestMetadata("manyParametersNoCapture.kt") - public void testManyParametersNoCapture_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParametersNoCapture.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("manyParametersNoCapture.kt") - public void testManyParametersNoCapture_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParametersNoCapture.kt", "kotlin.coroutines"); + public void testLocalVal() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt"); } @TestMetadata("manyParameters.kt") - public void testManyParameters_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt", "kotlin.coroutines.experimental"); + public void testManyParameters() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt"); } - @TestMetadata("manyParameters.kt") - public void testManyParameters_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt", "kotlin.coroutines"); + @TestMetadata("manyParametersNoCapture.kt") + public void testManyParametersNoCapture() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParametersNoCapture.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt"); } @TestMetadata("suspendModifier.kt") - public void testSuspendModifier_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendModifier.kt") - public void testSuspendModifier_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt", "kotlin.coroutines"); + public void testSuspendModifier() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt"); } } @@ -10261,10 +8853,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInTailCallOptimizations() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/tailCallOptimizations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @@ -10275,13 +8863,8 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("crossinline.kt") - public void testCrossinline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/crossinline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("crossinline.kt") - public void testCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/crossinline.kt", "kotlin.coroutines"); + public void testCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/crossinline.kt"); } @TestMetadata("inlineWithStateMachine.kt") @@ -10290,23 +8873,13 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("inlineWithoutStateMachine.kt") - public void testInlineWithoutStateMachine_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineWithoutStateMachine.kt") - public void testInlineWithoutStateMachine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt", "kotlin.coroutines"); + public void testInlineWithoutStateMachine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt"); } @TestMetadata("innerObjectRetransformation.kt") - public void testInnerObjectRetransformation_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("innerObjectRetransformation.kt") - public void testInnerObjectRetransformation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation.kt", "kotlin.coroutines"); + public void testInnerObjectRetransformation() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation.kt"); } @TestMetadata("interfaceDelegation.kt") @@ -10339,21 +8912,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/tailSuspendUnitFun.kt"); } + @TestMetadata("tryCatch.kt") + public void testTryCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/tryCatch.kt"); + } + @TestMetadata("tryCatchTailCall.kt") public void testTryCatchTailCall() throws Exception { runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/tryCatchTailCall.kt"); } - @TestMetadata("tryCatch.kt") - public void testTryCatch_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/tryCatch.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("tryCatch.kt") - public void testTryCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/tryCatch.kt", "kotlin.coroutines"); - } - @TestMetadata("unreachable.kt") public void testUnreachable() throws Exception { runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/unreachable.kt"); @@ -10441,52 +9009,28 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInTailOperations() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/tailOperations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("suspendWithIf.kt") - public void testSuspendWithIf_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithIf.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendWithIf.kt") - public void testSuspendWithIf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithIf.kt", "kotlin.coroutines"); + public void testSuspendWithIf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithIf.kt"); } @TestMetadata("suspendWithTryCatch.kt") - public void testSuspendWithTryCatch_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendWithTryCatch.kt") - public void testSuspendWithTryCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt", "kotlin.coroutines"); + public void testSuspendWithTryCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt"); } @TestMetadata("suspendWithWhen.kt") - public void testSuspendWithWhen_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithWhen.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendWithWhen.kt") - public void testSuspendWithWhen_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithWhen.kt", "kotlin.coroutines"); + public void testSuspendWithWhen() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithWhen.kt"); } @TestMetadata("tailInlining.kt") - public void testTailInlining_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/tailInlining.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("tailInlining.kt") - public void testTailInlining_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/tailInlining.kt", "kotlin.coroutines"); + public void testTailInlining() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/tailInlining.kt"); } } @@ -10498,32 +9042,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInUnitTypeReturn() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/unitTypeReturn"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("coroutineNonLocalReturn.kt") - public void testCoroutineNonLocalReturn_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("coroutineNonLocalReturn.kt") - public void testCoroutineNonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt", "kotlin.coroutines"); + public void testCoroutineNonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt"); } @TestMetadata("coroutineReturn.kt") - public void testCoroutineReturn_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("coroutineReturn.kt") - public void testCoroutineReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt", "kotlin.coroutines"); + public void testCoroutineReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt"); } @TestMetadata("inlineUnitFunction.kt") @@ -10537,33 +9067,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("suspendNonLocalReturn.kt") - public void testSuspendNonLocalReturn_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendNonLocalReturn.kt") - public void testSuspendNonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt", "kotlin.coroutines"); + public void testSuspendNonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt"); } @TestMetadata("suspendReturn.kt") - public void testSuspendReturn_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendReturn.kt") - public void testSuspendReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt", "kotlin.coroutines"); + public void testSuspendReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt"); } @TestMetadata("unitSafeCall.kt") - public void testUnitSafeCall_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/unitSafeCall.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("unitSafeCall.kt") - public void testUnitSafeCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/unitSafeCall.kt", "kotlin.coroutines"); + public void testUnitSafeCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/unitSafeCall.kt"); } } @@ -10575,10 +9090,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInVarSpilling() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/varSpilling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @@ -10589,33 +9100,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("kt19475.kt") - public void testKt19475_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/kt19475.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("kt19475.kt") - public void testKt19475_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/kt19475.kt", "kotlin.coroutines"); + public void testKt19475() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt19475.kt"); } @TestMetadata("kt38925.kt") - public void testKt38925_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/kt38925.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("kt38925.kt") - public void testKt38925_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/kt38925.kt", "kotlin.coroutines"); + public void testKt38925() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt38925.kt"); } @TestMetadata("nullSpilling.kt") - public void testNullSpilling_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/nullSpilling.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("nullSpilling.kt") - public void testNullSpilling_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/nullSpilling.kt", "kotlin.coroutines"); + public void testNullSpilling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/nullSpilling.kt"); } @TestMetadata("refinedIntTypesAnalysis.kt") @@ -22162,10 +20658,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInParametersMetadata() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/parametersMetadata"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @@ -22216,13 +20708,8 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @TestMetadata("suspendFunction.kt") - public void testSuspendFunction_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/parametersMetadata/suspendFunction.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendFunction.kt") - public void testSuspendFunction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/parametersMetadata/suspendFunction.kt", "kotlin.coroutines"); + public void testSuspendFunction() throws Exception { + runTest("compiler/testData/codegen/box/parametersMetadata/suspendFunction.kt"); } } diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java index 34f6d2cebd4..560468424e3 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java @@ -3967,32 +3967,18 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInSuspend() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("capturedVariables.kt") - public void testCapturedVariables_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/capturedVariables.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("capturedVariables.kt") - public void testCapturedVariables_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/capturedVariables.kt", "kotlin.coroutines"); + public void testCapturedVariables() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/capturedVariables.kt"); } @TestMetadata("crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt") - public void testCrossinlineSuspendLambdaInsideCrossinlineSuspendLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt") - public void testCrossinlineSuspendLambdaInsideCrossinlineSuspendLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt", "kotlin.coroutines"); + public void testCrossinlineSuspendLambdaInsideCrossinlineSuspendLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt"); } @TestMetadata("debugMetadataCrossinline.kt") @@ -4001,33 +3987,18 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo } @TestMetadata("delegatedProperties.kt") - public void testDelegatedProperties_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("delegatedProperties.kt") - public void testDelegatedProperties_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt", "kotlin.coroutines"); + public void testDelegatedProperties() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt"); } @TestMetadata("doubleRegenerationWithNonSuspendingLambda.kt") - public void testDoubleRegenerationWithNonSuspendingLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("doubleRegenerationWithNonSuspendingLambda.kt") - public void testDoubleRegenerationWithNonSuspendingLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt", "kotlin.coroutines"); + public void testDoubleRegenerationWithNonSuspendingLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt"); } @TestMetadata("enclodingMethod.kt") - public void testEnclodingMethod_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/enclodingMethod.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("enclodingMethod.kt") - public void testEnclodingMethod_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/enclodingMethod.kt", "kotlin.coroutines"); + public void testEnclodingMethod() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/enclodingMethod.kt"); } @TestMetadata("fileNameInMetadata.kt") @@ -4036,33 +4007,18 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo } @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendContinuation.kt") - public void testInlineSuspendContinuation_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendContinuation.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendContinuation.kt") - public void testInlineSuspendContinuation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendContinuation.kt", "kotlin.coroutines"); + public void testInlineSuspendContinuation() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendContinuation.kt"); } @TestMetadata("inlineSuspendInMultifileClass.kt") @@ -4071,73 +4027,38 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo } @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt"); } @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt"); } @TestMetadata("jvmName.kt") - public void testJvmName_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/jvmName.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("jvmName.kt") - public void testJvmName_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/jvmName.kt", "kotlin.coroutines"); + public void testJvmName() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/jvmName.kt"); } @TestMetadata("kt26658.kt") @@ -4146,33 +4067,18 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo } @TestMetadata("maxStackWithCrossinline.kt") - public void testMaxStackWithCrossinline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("maxStackWithCrossinline.kt") - public void testMaxStackWithCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt", "kotlin.coroutines"); + public void testMaxStackWithCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt"); } @TestMetadata("multipleLocals.kt") - public void testMultipleLocals_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("multipleLocals.kt") - public void testMultipleLocals_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines"); + public void testMultipleLocals() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt"); } @TestMetadata("multipleSuspensionPoints.kt") - public void testMultipleSuspensionPoints_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("multipleSuspensionPoints.kt") - public void testMultipleSuspensionPoints_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt", "kotlin.coroutines"); + public void testMultipleSuspensionPoints() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt"); } @TestMetadata("nestedMethodWith2XParameter.kt") @@ -4186,43 +4092,23 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo } @TestMetadata("nonSuspendCrossinline.kt") - public void testNonSuspendCrossinline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("nonSuspendCrossinline.kt") - public void testNonSuspendCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt", "kotlin.coroutines"); + public void testNonSuspendCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt"); } @TestMetadata("returnValue.kt") - public void testReturnValue_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/returnValue.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("returnValue.kt") - public void testReturnValue_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/returnValue.kt", "kotlin.coroutines"); + public void testReturnValue() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/returnValue.kt"); } @TestMetadata("tryCatchReceiver.kt") - public void testTryCatchReceiver_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("tryCatchReceiver.kt") - public void testTryCatchReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt", "kotlin.coroutines"); + public void testTryCatchReceiver() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt"); } @TestMetadata("tryCatchStackTransform.kt") - public void testTryCatchStackTransform_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("tryCatchStackTransform.kt") - public void testTryCatchStackTransform_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt", "kotlin.coroutines"); + public void testTryCatchStackTransform() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt"); } @TestMetadata("twiceRegeneratedAnonymousObject.kt") @@ -4281,22 +4167,13 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInDefaultParameter() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/defaultParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("defaultValueCrossinline.kt") - public void testDefaultValueCrossinline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("defaultValueCrossinline.kt") - public void testDefaultValueCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt", "kotlin.coroutines"); + public void testDefaultValueCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt"); } @TestMetadata("defaultValueInClass.kt") @@ -4304,24 +4181,14 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInClass.kt"); } - @TestMetadata("defaultValueInlineFromMultiFileFacade.kt") - public void testDefaultValueInlineFromMultiFileFacade_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt", "kotlin.coroutines.experimental"); + @TestMetadata("defaultValueInline.kt") + public void testDefaultValueInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt"); } @TestMetadata("defaultValueInlineFromMultiFileFacade.kt") - public void testDefaultValueInlineFromMultiFileFacade_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt", "kotlin.coroutines"); - } - - @TestMetadata("defaultValueInline.kt") - public void testDefaultValueInline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("defaultValueInline.kt") - public void testDefaultValueInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt", "kotlin.coroutines"); + public void testDefaultValueInlineFromMultiFileFacade() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt"); } } @@ -4389,92 +4256,48 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInReceiver() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/receiver"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt"); } @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt"); } } @@ -4486,142 +4309,73 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInStateMachine() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/stateMachine"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("crossingCoroutineBoundaries.kt") - public void testCrossingCoroutineBoundaries_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("crossingCoroutineBoundaries.kt") - public void testCrossingCoroutineBoundaries_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt", "kotlin.coroutines"); + public void testCrossingCoroutineBoundaries() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt"); } @TestMetadata("independentInline.kt") - public void testIndependentInline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("independentInline.kt") - public void testIndependentInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerLambdaInsideLambda.kt") - public void testInnerLambdaInsideLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("innerLambdaInsideLambda.kt") - public void testInnerLambdaInsideLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerLambdaWithoutCrossinline.kt") - public void testInnerLambdaWithoutCrossinline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("innerLambdaWithoutCrossinline.kt") - public void testInnerLambdaWithoutCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt", "kotlin.coroutines"); + public void testIndependentInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt"); } @TestMetadata("innerLambda.kt") - public void testInnerLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt", "kotlin.coroutines.experimental"); + public void testInnerLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt"); } - @TestMetadata("innerLambda.kt") - public void testInnerLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt", "kotlin.coroutines"); + @TestMetadata("innerLambdaInsideLambda.kt") + public void testInnerLambdaInsideLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt"); } - @TestMetadata("innerMadnessCallSite.kt") - public void testInnerMadnessCallSite_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("innerMadnessCallSite.kt") - public void testInnerMadnessCallSite_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt", "kotlin.coroutines"); + @TestMetadata("innerLambdaWithoutCrossinline.kt") + public void testInnerLambdaWithoutCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt"); } @TestMetadata("innerMadness.kt") - public void testInnerMadness_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt", "kotlin.coroutines.experimental"); + public void testInnerMadness() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt"); } - @TestMetadata("innerMadness.kt") - public void testInnerMadness_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectInsideInnerObject.kt") - public void testInnerObjectInsideInnerObject_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("innerObjectInsideInnerObject.kt") - public void testInnerObjectInsideInnerObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectRetransformation.kt") - public void testInnerObjectRetransformation_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("innerObjectRetransformation.kt") - public void testInnerObjectRetransformation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectSeveralFunctions.kt") - public void testInnerObjectSeveralFunctions_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("innerObjectSeveralFunctions.kt") - public void testInnerObjectSeveralFunctions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectWithoutCapturingCrossinline.kt") - public void testInnerObjectWithoutCapturingCrossinline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("innerObjectWithoutCapturingCrossinline.kt") - public void testInnerObjectWithoutCapturingCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt", "kotlin.coroutines"); + @TestMetadata("innerMadnessCallSite.kt") + public void testInnerMadnessCallSite() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt"); } @TestMetadata("innerObject.kt") - public void testInnerObject_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt", "kotlin.coroutines.experimental"); + public void testInnerObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt"); } - @TestMetadata("innerObject.kt") - public void testInnerObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt", "kotlin.coroutines"); + @TestMetadata("innerObjectInsideInnerObject.kt") + public void testInnerObjectInsideInnerObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt"); + } + + @TestMetadata("innerObjectRetransformation.kt") + public void testInnerObjectRetransformation() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt"); + } + + @TestMetadata("innerObjectSeveralFunctions.kt") + public void testInnerObjectSeveralFunctions() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt"); + } + + @TestMetadata("innerObjectWithoutCapturingCrossinline.kt") + public void testInnerObjectWithoutCapturingCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt"); } @TestMetadata("insideObject.kt") - public void testInsideObject_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("insideObject.kt") - public void testInsideObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt", "kotlin.coroutines"); + public void testInsideObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt"); } @TestMetadata("lambdaTransformation.kt") @@ -4630,83 +4384,43 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo } @TestMetadata("normalInline.kt") - public void testNormalInline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("normalInline.kt") - public void testNormalInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt", "kotlin.coroutines"); + public void testNormalInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt"); } @TestMetadata("numberOfSuspentions.kt") - public void testNumberOfSuspentions_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("numberOfSuspentions.kt") - public void testNumberOfSuspentions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt", "kotlin.coroutines"); + public void testNumberOfSuspentions() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt"); } @TestMetadata("objectInsideLambdas.kt") - public void testObjectInsideLambdas_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("objectInsideLambdas.kt") - public void testObjectInsideLambdas_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt", "kotlin.coroutines"); + public void testObjectInsideLambdas() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt"); } @TestMetadata("oneInlineTwoCaptures.kt") - public void testOneInlineTwoCaptures_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("oneInlineTwoCaptures.kt") - public void testOneInlineTwoCaptures_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt", "kotlin.coroutines"); + public void testOneInlineTwoCaptures() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt"); } @TestMetadata("passLambda.kt") - public void testPassLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("passLambda.kt") - public void testPassLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt", "kotlin.coroutines"); - } - - @TestMetadata("passParameterLambda.kt") - public void testPassParameterLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("passParameterLambda.kt") - public void testPassParameterLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt", "kotlin.coroutines"); + public void testPassLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt"); } @TestMetadata("passParameter.kt") - public void testPassParameter_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt", "kotlin.coroutines.experimental"); + public void testPassParameter() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt"); } - @TestMetadata("passParameter.kt") - public void testPassParameter_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt", "kotlin.coroutines"); + @TestMetadata("passParameterLambda.kt") + public void testPassParameterLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt"); } @TestMetadata("unreachableSuspendMarker.kt") - public void testUnreachableSuspendMarker_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("unreachableSuspendMarker.kt") - public void testUnreachableSuspendMarker_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt", "kotlin.coroutines"); + public void testUnreachableSuspendMarker() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt"); } } } diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index 5897a7b6fbe..d396a68e870 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -674,52 +674,28 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInCoroutines() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/coroutines"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("coroutineContextIntrinsic.kt") - public void testCoroutineContextIntrinsic_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeListing/coroutines/coroutineContextIntrinsic.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("coroutineContextIntrinsic.kt") - public void testCoroutineContextIntrinsic_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeListing/coroutines/coroutineContextIntrinsic.kt", "kotlin.coroutines"); + public void testCoroutineContextIntrinsic() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/coroutines/coroutineContextIntrinsic.kt"); } @TestMetadata("coroutineFields.kt") - public void testCoroutineFields_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeListing/coroutines/coroutineFields.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("coroutineFields.kt") - public void testCoroutineFields_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeListing/coroutines/coroutineFields.kt", "kotlin.coroutines"); + public void testCoroutineFields() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/coroutines/coroutineFields.kt"); } @TestMetadata("oomInReturnUnit.kt") - public void testOomInReturnUnit_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeListing/coroutines/oomInReturnUnit.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("oomInReturnUnit.kt") - public void testOomInReturnUnit_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeListing/coroutines/oomInReturnUnit.kt", "kotlin.coroutines"); + public void testOomInReturnUnit() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/coroutines/oomInReturnUnit.kt"); } @TestMetadata("privateAccessor.kt") - public void testPrivateAccessor_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeListing/coroutines/privateAccessor.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("privateAccessor.kt") - public void testPrivateAccessor_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeListing/coroutines/privateAccessor.kt", "kotlin.coroutines"); + public void testPrivateAccessor() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/coroutines/privateAccessor.kt"); } @TestMetadata("privateSuspendFun.kt") @@ -733,23 +709,13 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { } @TestMetadata("suspendReifiedFun.kt") - public void testSuspendReifiedFun_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeListing/coroutines/suspendReifiedFun.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendReifiedFun.kt") - public void testSuspendReifiedFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeListing/coroutines/suspendReifiedFun.kt", "kotlin.coroutines"); + public void testSuspendReifiedFun() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/coroutines/suspendReifiedFun.kt"); } @TestMetadata("tcoContinuation.kt") - public void testTcoContinuation_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeListing/coroutines/tcoContinuation.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("tcoContinuation.kt") - public void testTcoContinuation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeListing/coroutines/tcoContinuation.kt", "kotlin.coroutines"); + public void testTcoContinuation() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/coroutines/tcoContinuation.kt"); } @TestMetadata("compiler/testData/codegen/bytecodeListing/coroutines/spilling") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java index cd167f36637..59439ce3d61 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java @@ -1403,10 +1403,6 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInCoroutines() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/coroutines"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @@ -1437,13 +1433,8 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest { } @TestMetadata("returnUnitInLambda.kt") - public void testReturnUnitInLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/returnUnitInLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("returnUnitInLambda.kt") - public void testReturnUnitInLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/returnUnitInLambda.kt", "kotlin.coroutines"); + public void testReturnUnitInLambda() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/returnUnitInLambda.kt"); } @TestMetadata("suspendMain.kt") @@ -1621,112 +1612,58 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInIntLikeVarSpilling() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("complicatedMerge.kt") - public void testComplicatedMerge_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/complicatedMerge.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("complicatedMerge.kt") - public void testComplicatedMerge_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/complicatedMerge.kt", "kotlin.coroutines"); + public void testComplicatedMerge() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/complicatedMerge.kt"); } @TestMetadata("i2bResult.kt") - public void testI2bResult_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("i2bResult.kt") - public void testI2bResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines"); + public void testI2bResult() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/i2bResult.kt"); } @TestMetadata("loadFromBooleanArray.kt") - public void testLoadFromBooleanArray_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("loadFromBooleanArray.kt") - public void testLoadFromBooleanArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines"); + public void testLoadFromBooleanArray() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt"); } @TestMetadata("loadFromByteArray.kt") - public void testLoadFromByteArray_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/loadFromByteArray.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("loadFromByteArray.kt") - public void testLoadFromByteArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/loadFromByteArray.kt", "kotlin.coroutines"); + public void testLoadFromByteArray() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/loadFromByteArray.kt"); } @TestMetadata("noVariableInTable.kt") - public void testNoVariableInTable_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/noVariableInTable.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("noVariableInTable.kt") - public void testNoVariableInTable_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/noVariableInTable.kt", "kotlin.coroutines"); + public void testNoVariableInTable() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/noVariableInTable.kt"); } @TestMetadata("sameIconst1ManyVars.kt") - public void testSameIconst1ManyVars_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("sameIconst1ManyVars.kt") - public void testSameIconst1ManyVars_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt", "kotlin.coroutines"); + public void testSameIconst1ManyVars() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt"); } @TestMetadata("usedInArrayStore.kt") - public void testUsedInArrayStore_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInArrayStore.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("usedInArrayStore.kt") - public void testUsedInArrayStore_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInArrayStore.kt", "kotlin.coroutines"); + public void testUsedInArrayStore() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInArrayStore.kt"); } @TestMetadata("usedInMethodCall.kt") - public void testUsedInMethodCall_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInMethodCall.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("usedInMethodCall.kt") - public void testUsedInMethodCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInMethodCall.kt", "kotlin.coroutines"); + public void testUsedInMethodCall() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInMethodCall.kt"); } @TestMetadata("usedInPutfield.kt") - public void testUsedInPutfield_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInPutfield.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("usedInPutfield.kt") - public void testUsedInPutfield_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInPutfield.kt", "kotlin.coroutines"); + public void testUsedInPutfield() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInPutfield.kt"); } @TestMetadata("usedInVarStore.kt") - public void testUsedInVarStore_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInVarStore.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("usedInVarStore.kt") - public void testUsedInVarStore_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInVarStore.kt", "kotlin.coroutines"); + public void testUsedInVarStore() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInVarStore.kt"); } } diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java index e3d11df63c5..bd4dcd72c7e 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java @@ -3967,32 +3967,18 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); - } - public void testAllFilesPresentInSuspend() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("capturedVariables.kt") - public void testCapturedVariables_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/capturedVariables.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("capturedVariables.kt") - public void testCapturedVariables_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/capturedVariables.kt", "kotlin.coroutines"); + public void testCapturedVariables() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/capturedVariables.kt"); } @TestMetadata("crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt") - public void testCrossinlineSuspendLambdaInsideCrossinlineSuspendLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt") - public void testCrossinlineSuspendLambdaInsideCrossinlineSuspendLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt", "kotlin.coroutines"); + public void testCrossinlineSuspendLambdaInsideCrossinlineSuspendLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt"); } @TestMetadata("debugMetadataCrossinline.kt") @@ -4001,33 +3987,18 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi } @TestMetadata("delegatedProperties.kt") - public void testDelegatedProperties_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("delegatedProperties.kt") - public void testDelegatedProperties_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt", "kotlin.coroutines"); + public void testDelegatedProperties() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt"); } @TestMetadata("doubleRegenerationWithNonSuspendingLambda.kt") - public void testDoubleRegenerationWithNonSuspendingLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("doubleRegenerationWithNonSuspendingLambda.kt") - public void testDoubleRegenerationWithNonSuspendingLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt", "kotlin.coroutines"); + public void testDoubleRegenerationWithNonSuspendingLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt"); } @TestMetadata("enclodingMethod.kt") - public void testEnclodingMethod_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/enclodingMethod.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("enclodingMethod.kt") - public void testEnclodingMethod_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/enclodingMethod.kt", "kotlin.coroutines"); + public void testEnclodingMethod() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/enclodingMethod.kt"); } @TestMetadata("fileNameInMetadata.kt") @@ -4036,33 +4007,18 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi } @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendContinuation.kt") - public void testInlineSuspendContinuation_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendContinuation.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendContinuation.kt") - public void testInlineSuspendContinuation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendContinuation.kt", "kotlin.coroutines"); + public void testInlineSuspendContinuation() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendContinuation.kt"); } @TestMetadata("inlineSuspendInMultifileClass.kt") @@ -4071,73 +4027,38 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi } @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt"); } @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt"); } @TestMetadata("jvmName.kt") - public void testJvmName_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/jvmName.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("jvmName.kt") - public void testJvmName_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/jvmName.kt", "kotlin.coroutines"); + public void testJvmName() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/jvmName.kt"); } @TestMetadata("kt26658.kt") @@ -4146,33 +4067,18 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi } @TestMetadata("maxStackWithCrossinline.kt") - public void testMaxStackWithCrossinline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("maxStackWithCrossinline.kt") - public void testMaxStackWithCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt", "kotlin.coroutines"); + public void testMaxStackWithCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt"); } @TestMetadata("multipleLocals.kt") - public void testMultipleLocals_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("multipleLocals.kt") - public void testMultipleLocals_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines"); + public void testMultipleLocals() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt"); } @TestMetadata("multipleSuspensionPoints.kt") - public void testMultipleSuspensionPoints_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("multipleSuspensionPoints.kt") - public void testMultipleSuspensionPoints_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt", "kotlin.coroutines"); + public void testMultipleSuspensionPoints() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt"); } @TestMetadata("nestedMethodWith2XParameter.kt") @@ -4186,43 +4092,23 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi } @TestMetadata("nonSuspendCrossinline.kt") - public void testNonSuspendCrossinline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("nonSuspendCrossinline.kt") - public void testNonSuspendCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt", "kotlin.coroutines"); + public void testNonSuspendCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt"); } @TestMetadata("returnValue.kt") - public void testReturnValue_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/returnValue.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("returnValue.kt") - public void testReturnValue_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/returnValue.kt", "kotlin.coroutines"); + public void testReturnValue() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/returnValue.kt"); } @TestMetadata("tryCatchReceiver.kt") - public void testTryCatchReceiver_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("tryCatchReceiver.kt") - public void testTryCatchReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt", "kotlin.coroutines"); + public void testTryCatchReceiver() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt"); } @TestMetadata("tryCatchStackTransform.kt") - public void testTryCatchStackTransform_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("tryCatchStackTransform.kt") - public void testTryCatchStackTransform_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt", "kotlin.coroutines"); + public void testTryCatchStackTransform() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt"); } @TestMetadata("twiceRegeneratedAnonymousObject.kt") @@ -4281,22 +4167,13 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); - } - public void testAllFilesPresentInDefaultParameter() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/defaultParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("defaultValueCrossinline.kt") - public void testDefaultValueCrossinline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("defaultValueCrossinline.kt") - public void testDefaultValueCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt", "kotlin.coroutines"); + public void testDefaultValueCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt"); } @TestMetadata("defaultValueInClass.kt") @@ -4304,24 +4181,14 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInClass.kt"); } - @TestMetadata("defaultValueInlineFromMultiFileFacade.kt") - public void testDefaultValueInlineFromMultiFileFacade_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt", "kotlin.coroutines.experimental"); + @TestMetadata("defaultValueInline.kt") + public void testDefaultValueInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt"); } @TestMetadata("defaultValueInlineFromMultiFileFacade.kt") - public void testDefaultValueInlineFromMultiFileFacade_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt", "kotlin.coroutines"); - } - - @TestMetadata("defaultValueInline.kt") - public void testDefaultValueInline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("defaultValueInline.kt") - public void testDefaultValueInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt", "kotlin.coroutines"); + public void testDefaultValueInlineFromMultiFileFacade() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt"); } } @@ -4389,92 +4256,48 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); - } - public void testAllFilesPresentInReceiver() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/receiver"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt"); } @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt"); } } @@ -4486,142 +4309,73 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); - } - public void testAllFilesPresentInStateMachine() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/stateMachine"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("crossingCoroutineBoundaries.kt") - public void testCrossingCoroutineBoundaries_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("crossingCoroutineBoundaries.kt") - public void testCrossingCoroutineBoundaries_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt", "kotlin.coroutines"); + public void testCrossingCoroutineBoundaries() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt"); } @TestMetadata("independentInline.kt") - public void testIndependentInline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("independentInline.kt") - public void testIndependentInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerLambdaInsideLambda.kt") - public void testInnerLambdaInsideLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("innerLambdaInsideLambda.kt") - public void testInnerLambdaInsideLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerLambdaWithoutCrossinline.kt") - public void testInnerLambdaWithoutCrossinline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("innerLambdaWithoutCrossinline.kt") - public void testInnerLambdaWithoutCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt", "kotlin.coroutines"); + public void testIndependentInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt"); } @TestMetadata("innerLambda.kt") - public void testInnerLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt", "kotlin.coroutines.experimental"); + public void testInnerLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt"); } - @TestMetadata("innerLambda.kt") - public void testInnerLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt", "kotlin.coroutines"); + @TestMetadata("innerLambdaInsideLambda.kt") + public void testInnerLambdaInsideLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt"); } - @TestMetadata("innerMadnessCallSite.kt") - public void testInnerMadnessCallSite_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("innerMadnessCallSite.kt") - public void testInnerMadnessCallSite_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt", "kotlin.coroutines"); + @TestMetadata("innerLambdaWithoutCrossinline.kt") + public void testInnerLambdaWithoutCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt"); } @TestMetadata("innerMadness.kt") - public void testInnerMadness_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt", "kotlin.coroutines.experimental"); + public void testInnerMadness() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt"); } - @TestMetadata("innerMadness.kt") - public void testInnerMadness_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectInsideInnerObject.kt") - public void testInnerObjectInsideInnerObject_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("innerObjectInsideInnerObject.kt") - public void testInnerObjectInsideInnerObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectRetransformation.kt") - public void testInnerObjectRetransformation_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("innerObjectRetransformation.kt") - public void testInnerObjectRetransformation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectSeveralFunctions.kt") - public void testInnerObjectSeveralFunctions_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("innerObjectSeveralFunctions.kt") - public void testInnerObjectSeveralFunctions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectWithoutCapturingCrossinline.kt") - public void testInnerObjectWithoutCapturingCrossinline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("innerObjectWithoutCapturingCrossinline.kt") - public void testInnerObjectWithoutCapturingCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt", "kotlin.coroutines"); + @TestMetadata("innerMadnessCallSite.kt") + public void testInnerMadnessCallSite() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt"); } @TestMetadata("innerObject.kt") - public void testInnerObject_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt", "kotlin.coroutines.experimental"); + public void testInnerObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt"); } - @TestMetadata("innerObject.kt") - public void testInnerObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt", "kotlin.coroutines"); + @TestMetadata("innerObjectInsideInnerObject.kt") + public void testInnerObjectInsideInnerObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt"); + } + + @TestMetadata("innerObjectRetransformation.kt") + public void testInnerObjectRetransformation() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt"); + } + + @TestMetadata("innerObjectSeveralFunctions.kt") + public void testInnerObjectSeveralFunctions() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt"); + } + + @TestMetadata("innerObjectWithoutCapturingCrossinline.kt") + public void testInnerObjectWithoutCapturingCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt"); } @TestMetadata("insideObject.kt") - public void testInsideObject_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("insideObject.kt") - public void testInsideObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt", "kotlin.coroutines"); + public void testInsideObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt"); } @TestMetadata("lambdaTransformation.kt") @@ -4630,83 +4384,43 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi } @TestMetadata("normalInline.kt") - public void testNormalInline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("normalInline.kt") - public void testNormalInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt", "kotlin.coroutines"); + public void testNormalInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt"); } @TestMetadata("numberOfSuspentions.kt") - public void testNumberOfSuspentions_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("numberOfSuspentions.kt") - public void testNumberOfSuspentions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt", "kotlin.coroutines"); + public void testNumberOfSuspentions() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt"); } @TestMetadata("objectInsideLambdas.kt") - public void testObjectInsideLambdas_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("objectInsideLambdas.kt") - public void testObjectInsideLambdas_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt", "kotlin.coroutines"); + public void testObjectInsideLambdas() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt"); } @TestMetadata("oneInlineTwoCaptures.kt") - public void testOneInlineTwoCaptures_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("oneInlineTwoCaptures.kt") - public void testOneInlineTwoCaptures_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt", "kotlin.coroutines"); + public void testOneInlineTwoCaptures() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt"); } @TestMetadata("passLambda.kt") - public void testPassLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("passLambda.kt") - public void testPassLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt", "kotlin.coroutines"); - } - - @TestMetadata("passParameterLambda.kt") - public void testPassParameterLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("passParameterLambda.kt") - public void testPassParameterLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt", "kotlin.coroutines"); + public void testPassLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt"); } @TestMetadata("passParameter.kt") - public void testPassParameter_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt", "kotlin.coroutines.experimental"); + public void testPassParameter() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt"); } - @TestMetadata("passParameter.kt") - public void testPassParameter_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt", "kotlin.coroutines"); + @TestMetadata("passParameterLambda.kt") + public void testPassParameterLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt"); } @TestMetadata("unreachableSuspendMarker.kt") - public void testUnreachableSuspendMarker_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("unreachableSuspendMarker.kt") - public void testUnreachableSuspendMarker_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt", "kotlin.coroutines"); + public void testUnreachableSuspendMarker() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt"); } } } diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java index 131fa5a6431..768154b00c0 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java @@ -8,7 +8,6 @@ package org.jetbrains.kotlin.codegen; import com.intellij.testFramework.TestDataPath; import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; import org.jetbrains.kotlin.test.KotlinTestUtils; -import org.jetbrains.kotlin.test.TargetBackend; import org.jetbrains.kotlin.test.TestMetadata; import org.junit.runner.RunWith; @@ -25,10 +24,6 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.ANY, testDataFilePath); - } - public void testAllFilesPresentInCompileKotlinAgainstKotlin() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin"), Pattern.compile("^(.+)\\.kt$"), null, true); } @@ -99,13 +94,8 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl } @TestMetadata("coroutinesBinary.kt") - public void testCoroutinesBinary_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/compileKotlinAgainstKotlin/coroutinesBinary.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("coroutinesBinary.kt") - public void testCoroutinesBinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/compileKotlinAgainstKotlin/coroutinesBinary.kt", "kotlin.coroutines"); + public void testCoroutinesBinary() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/coroutinesBinary.kt"); } @TestMetadata("defaultConstructor.kt") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index b589166eb2b..488e065ea32 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -949,10 +949,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInJvm() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/assert/jvm"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @@ -1033,43 +1029,23 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("suspendFunctionAssertionDisabled.kt") - public void testSuspendFunctionAssertionDisabled_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionDisabled.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendFunctionAssertionDisabled.kt") - public void testSuspendFunctionAssertionDisabled_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionDisabled.kt", "kotlin.coroutines"); + public void testSuspendFunctionAssertionDisabled() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionDisabled.kt"); } @TestMetadata("suspendFunctionAssertionsEnabled.kt") - public void testSuspendFunctionAssertionsEnabled_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionsEnabled.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendFunctionAssertionsEnabled.kt") - public void testSuspendFunctionAssertionsEnabled_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionsEnabled.kt", "kotlin.coroutines"); + public void testSuspendFunctionAssertionsEnabled() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionsEnabled.kt"); } @TestMetadata("suspendLambdaAssertionsDisabled.kt") - public void testSuspendLambdaAssertionsDisabled_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsDisabled.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendLambdaAssertionsDisabled.kt") - public void testSuspendLambdaAssertionsDisabled_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsDisabled.kt", "kotlin.coroutines"); + public void testSuspendLambdaAssertionsDisabled() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsDisabled.kt"); } @TestMetadata("suspendLambdaAssertionsEnabled.kt") - public void testSuspendLambdaAssertionsEnabled_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsEnabled.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendLambdaAssertionsEnabled.kt") - public void testSuspendLambdaAssertionsEnabled_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsEnabled.kt", "kotlin.coroutines"); + public void testSuspendLambdaAssertionsEnabled() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsEnabled.kt"); } } } @@ -4865,10 +4841,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInCapturedVarsOptimization() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/closures/capturedVarsOptimization"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @@ -4918,24 +4890,14 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/closures/capturedVarsOptimization/sharedSlotsWithCapturedVars.kt"); } - @TestMetadata("withCoroutinesNoStdLib.kt") - public void testWithCoroutinesNoStdLib_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutinesNoStdLib.kt", "kotlin.coroutines.experimental"); + @TestMetadata("withCoroutines.kt") + public void testWithCoroutines() throws Exception { + runTest("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt"); } @TestMetadata("withCoroutinesNoStdLib.kt") - public void testWithCoroutinesNoStdLib_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutinesNoStdLib.kt", "kotlin.coroutines"); - } - - @TestMetadata("withCoroutines.kt") - public void testWithCoroutines_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("withCoroutines.kt") - public void testWithCoroutines_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt", "kotlin.coroutines"); + public void testWithCoroutinesNoStdLib() throws Exception { + runTest("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutinesNoStdLib.kt"); } } @@ -5381,10 +5343,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInContracts() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/contracts"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @@ -5430,13 +5388,8 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("kt39374.kt") - public void testKt39374_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/contracts/kt39374.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("kt39374.kt") - public void testKt39374_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/contracts/kt39374.kt", "kotlin.coroutines"); + public void testKt39374() throws Exception { + runTest("compiler/testData/codegen/box/contracts/kt39374.kt"); } @TestMetadata("lambdaParameter.kt") @@ -6570,42 +6523,28 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - @TestMetadata("32defaultParametersInSuspend.kt") - public void test32defaultParametersInSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/32defaultParametersInSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("32defaultParametersInSuspend.kt") - public void test32defaultParametersInSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/32defaultParametersInSuspend.kt", "kotlin.coroutines"); + public void test32defaultParametersInSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/32defaultParametersInSuspend.kt"); } @TestMetadata("accessorForSuspend.kt") - public void testAccessorForSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/accessorForSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("accessorForSuspend.kt") - public void testAccessorForSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/accessorForSuspend.kt", "kotlin.coroutines"); + public void testAccessorForSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/accessorForSuspend.kt"); } public void testAllFilesPresentInCoroutines() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } - @TestMetadata("asyncException.kt") - public void testAsyncException_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/asyncException.kt", "kotlin.coroutines.experimental"); + @TestMetadata("async.kt") + public void testAsync() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/async.kt"); } @TestMetadata("asyncException.kt") - public void testAsyncException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/asyncException.kt", "kotlin.coroutines"); + public void testAsyncException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/asyncException.kt"); } @TestMetadata("asyncIteratorNullMerge_1_3.kt") @@ -6623,44 +6562,19 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/coroutines/asyncIterator_1_3.kt"); } - @TestMetadata("async.kt") - public void testAsync_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/async.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("async.kt") - public void testAsync_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/async.kt", "kotlin.coroutines"); - } - @TestMetadata("await.kt") - public void testAwait_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/await.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("await.kt") - public void testAwait_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/await.kt", "kotlin.coroutines"); - } - - @TestMetadata("beginWithExceptionNoHandleException.kt") - public void testBeginWithExceptionNoHandleException_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/beginWithExceptionNoHandleException.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("beginWithExceptionNoHandleException.kt") - public void testBeginWithExceptionNoHandleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/beginWithExceptionNoHandleException.kt", "kotlin.coroutines"); + public void testAwait() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/await.kt"); } @TestMetadata("beginWithException.kt") - public void testBeginWithException_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/beginWithException.kt", "kotlin.coroutines.experimental"); + public void testBeginWithException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/beginWithException.kt"); } - @TestMetadata("beginWithException.kt") - public void testBeginWithException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/beginWithException.kt", "kotlin.coroutines"); + @TestMetadata("beginWithExceptionNoHandleException.kt") + public void testBeginWithExceptionNoHandleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/beginWithExceptionNoHandleException.kt"); } @TestMetadata("builderInferenceAndGenericArrayAcessCall.kt") @@ -6684,53 +6598,28 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("capturedVarInSuspendLambda.kt") - public void testCapturedVarInSuspendLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("capturedVarInSuspendLambda.kt") - public void testCapturedVarInSuspendLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt", "kotlin.coroutines"); + public void testCapturedVarInSuspendLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt"); } @TestMetadata("catchWithInlineInsideSuspend.kt") - public void testCatchWithInlineInsideSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/catchWithInlineInsideSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("catchWithInlineInsideSuspend.kt") - public void testCatchWithInlineInsideSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/catchWithInlineInsideSuspend.kt", "kotlin.coroutines"); + public void testCatchWithInlineInsideSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/catchWithInlineInsideSuspend.kt"); } @TestMetadata("coercionToUnit.kt") - public void testCoercionToUnit_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/coercionToUnit.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("coercionToUnit.kt") - public void testCoercionToUnit_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/coercionToUnit.kt", "kotlin.coroutines"); + public void testCoercionToUnit() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/coercionToUnit.kt"); } @TestMetadata("controllerAccessFromInnerLambda.kt") - public void testControllerAccessFromInnerLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controllerAccessFromInnerLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("controllerAccessFromInnerLambda.kt") - public void testControllerAccessFromInnerLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controllerAccessFromInnerLambda.kt", "kotlin.coroutines"); + public void testControllerAccessFromInnerLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controllerAccessFromInnerLambda.kt"); } @TestMetadata("coroutineContextInInlinedLambda.kt") - public void testCoroutineContextInInlinedLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/coroutineContextInInlinedLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("coroutineContextInInlinedLambda.kt") - public void testCoroutineContextInInlinedLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/coroutineContextInInlinedLambda.kt", "kotlin.coroutines"); + public void testCoroutineContextInInlinedLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/coroutineContextInInlinedLambda.kt"); } @TestMetadata("coroutineToString.kt") @@ -6739,33 +6628,23 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("createCoroutineSafe.kt") - public void testCreateCoroutineSafe_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/createCoroutineSafe.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("createCoroutineSafe.kt") - public void testCreateCoroutineSafe_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/createCoroutineSafe.kt", "kotlin.coroutines"); + public void testCreateCoroutineSafe() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/createCoroutineSafe.kt"); } @TestMetadata("createCoroutinesOnManualInstances.kt") - public void testCreateCoroutinesOnManualInstances_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/createCoroutinesOnManualInstances.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("createCoroutinesOnManualInstances.kt") - public void testCreateCoroutinesOnManualInstances_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/createCoroutinesOnManualInstances.kt", "kotlin.coroutines"); + public void testCreateCoroutinesOnManualInstances() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/createCoroutinesOnManualInstances.kt"); } @TestMetadata("crossInlineWithCapturedOuterReceiver.kt") - public void testCrossInlineWithCapturedOuterReceiver_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/crossInlineWithCapturedOuterReceiver.kt", "kotlin.coroutines.experimental"); + public void testCrossInlineWithCapturedOuterReceiver() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/crossInlineWithCapturedOuterReceiver.kt"); } - @TestMetadata("crossInlineWithCapturedOuterReceiver.kt") - public void testCrossInlineWithCapturedOuterReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/crossInlineWithCapturedOuterReceiver.kt", "kotlin.coroutines"); + @TestMetadata("defaultParametersInSuspend.kt") + public void testDefaultParametersInSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/defaultParametersInSuspend.kt"); } @TestMetadata("defaultParametersInSuspendWithJvmOverloads.kt") @@ -6773,34 +6652,14 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/coroutines/defaultParametersInSuspendWithJvmOverloads.kt"); } - @TestMetadata("defaultParametersInSuspend.kt") - public void testDefaultParametersInSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/defaultParametersInSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("defaultParametersInSuspend.kt") - public void testDefaultParametersInSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/defaultParametersInSuspend.kt", "kotlin.coroutines"); - } - @TestMetadata("delegatedSuspendMember.kt") - public void testDelegatedSuspendMember_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("delegatedSuspendMember.kt") - public void testDelegatedSuspendMember_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt", "kotlin.coroutines"); + public void testDelegatedSuspendMember() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt"); } @TestMetadata("dispatchResume.kt") - public void testDispatchResume_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/dispatchResume.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("dispatchResume.kt") - public void testDispatchResume_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/dispatchResume.kt", "kotlin.coroutines"); + public void testDispatchResume() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/dispatchResume.kt"); } @TestMetadata("doubleColonExpressionsGenerationInBuilderInference.kt") @@ -6809,13 +6668,8 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("emptyClosure.kt") - public void testEmptyClosure_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/emptyClosure.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("emptyClosure.kt") - public void testEmptyClosure_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/emptyClosure.kt", "kotlin.coroutines"); + public void testEmptyClosure() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/emptyClosure.kt"); } @TestMetadata("emptyCommonConstraintSystemForCoroutineInferenceCall.kt") @@ -6824,73 +6678,38 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("epam.kt") - public void testEpam_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/epam.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("epam.kt") - public void testEpam_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/epam.kt", "kotlin.coroutines"); + public void testEpam() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/epam.kt"); } @TestMetadata("falseUnitCoercion.kt") - public void testFalseUnitCoercion_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/falseUnitCoercion.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("falseUnitCoercion.kt") - public void testFalseUnitCoercion_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/falseUnitCoercion.kt", "kotlin.coroutines"); + public void testFalseUnitCoercion() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/falseUnitCoercion.kt"); } @TestMetadata("generate.kt") - public void testGenerate_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/generate.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("generate.kt") - public void testGenerate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/generate.kt", "kotlin.coroutines"); + public void testGenerate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/generate.kt"); } @TestMetadata("handleException.kt") - public void testHandleException_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleException.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("handleException.kt") - public void testHandleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleException.kt", "kotlin.coroutines"); + public void testHandleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleException.kt"); } @TestMetadata("handleResultCallEmptyBody.kt") - public void testHandleResultCallEmptyBody_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultCallEmptyBody.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("handleResultCallEmptyBody.kt") - public void testHandleResultCallEmptyBody_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultCallEmptyBody.kt", "kotlin.coroutines"); + public void testHandleResultCallEmptyBody() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleResultCallEmptyBody.kt"); } @TestMetadata("handleResultNonUnitExpression.kt") - public void testHandleResultNonUnitExpression_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultNonUnitExpression.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("handleResultNonUnitExpression.kt") - public void testHandleResultNonUnitExpression_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultNonUnitExpression.kt", "kotlin.coroutines"); + public void testHandleResultNonUnitExpression() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleResultNonUnitExpression.kt"); } @TestMetadata("handleResultSuspended.kt") - public void testHandleResultSuspended_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultSuspended.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("handleResultSuspended.kt") - public void testHandleResultSuspended_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultSuspended.kt", "kotlin.coroutines"); + public void testHandleResultSuspended() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleResultSuspended.kt"); } @TestMetadata("illegalState.kt") @@ -6899,183 +6718,93 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("indirectInlineUsedAsNonInline.kt") - public void testIndirectInlineUsedAsNonInline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/indirectInlineUsedAsNonInline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("indirectInlineUsedAsNonInline.kt") - public void testIndirectInlineUsedAsNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/indirectInlineUsedAsNonInline.kt", "kotlin.coroutines"); + public void testIndirectInlineUsedAsNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/indirectInlineUsedAsNonInline.kt"); } @TestMetadata("inlineFunInGenericClass.kt") - public void testInlineFunInGenericClass_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineFunInGenericClass.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineFunInGenericClass.kt") - public void testInlineFunInGenericClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineFunInGenericClass.kt", "kotlin.coroutines"); - } - - @TestMetadata("inlineFunctionInMultifileClassUnoptimized.kt") - public void testInlineFunctionInMultifileClassUnoptimized_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClassUnoptimized.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineFunctionInMultifileClassUnoptimized.kt") - public void testInlineFunctionInMultifileClassUnoptimized_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClassUnoptimized.kt", "kotlin.coroutines"); + public void testInlineFunInGenericClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineFunInGenericClass.kt"); } @TestMetadata("inlineFunctionInMultifileClass.kt") - public void testInlineFunctionInMultifileClass_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClass.kt", "kotlin.coroutines.experimental"); + public void testInlineFunctionInMultifileClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClass.kt"); } - @TestMetadata("inlineFunctionInMultifileClass.kt") - public void testInlineFunctionInMultifileClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClass.kt", "kotlin.coroutines"); + @TestMetadata("inlineFunctionInMultifileClassUnoptimized.kt") + public void testInlineFunctionInMultifileClassUnoptimized() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClassUnoptimized.kt"); } @TestMetadata("inlineGenericFunCalledFromSubclass.kt") - public void testInlineGenericFunCalledFromSubclass_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineGenericFunCalledFromSubclass.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineGenericFunCalledFromSubclass.kt") - public void testInlineGenericFunCalledFromSubclass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineGenericFunCalledFromSubclass.kt", "kotlin.coroutines"); + public void testInlineGenericFunCalledFromSubclass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineGenericFunCalledFromSubclass.kt"); } @TestMetadata("inlineSuspendFunction.kt") - public void testInlineSuspendFunction_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineSuspendFunction.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendFunction.kt") - public void testInlineSuspendFunction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineSuspendFunction.kt", "kotlin.coroutines"); + public void testInlineSuspendFunction() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineSuspendFunction.kt"); } @TestMetadata("inlineSuspendLambdaNonLocalReturn.kt") - public void testInlineSuspendLambdaNonLocalReturn_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineSuspendLambdaNonLocalReturn.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendLambdaNonLocalReturn.kt") - public void testInlineSuspendLambdaNonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineSuspendLambdaNonLocalReturn.kt", "kotlin.coroutines"); + public void testInlineSuspendLambdaNonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineSuspendLambdaNonLocalReturn.kt"); } @TestMetadata("inlinedTryCatchFinally.kt") - public void testInlinedTryCatchFinally_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlinedTryCatchFinally.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlinedTryCatchFinally.kt") - public void testInlinedTryCatchFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlinedTryCatchFinally.kt", "kotlin.coroutines"); + public void testInlinedTryCatchFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlinedTryCatchFinally.kt"); } @TestMetadata("innerSuspensionCalls.kt") - public void testInnerSuspensionCalls_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/innerSuspensionCalls.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("innerSuspensionCalls.kt") - public void testInnerSuspensionCalls_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/innerSuspensionCalls.kt", "kotlin.coroutines"); + public void testInnerSuspensionCalls() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/innerSuspensionCalls.kt"); } @TestMetadata("instanceOfContinuation.kt") - public void testInstanceOfContinuation_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/instanceOfContinuation.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("instanceOfContinuation.kt") - public void testInstanceOfContinuation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/instanceOfContinuation.kt", "kotlin.coroutines"); + public void testInstanceOfContinuation() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/instanceOfContinuation.kt"); } @TestMetadata("iterateOverArray.kt") - public void testIterateOverArray_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/iterateOverArray.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("iterateOverArray.kt") - public void testIterateOverArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/iterateOverArray.kt", "kotlin.coroutines"); + public void testIterateOverArray() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/iterateOverArray.kt"); } @TestMetadata("kt12958.kt") - public void testKt12958_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt12958.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("kt12958.kt") - public void testKt12958_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt12958.kt", "kotlin.coroutines"); + public void testKt12958() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt12958.kt"); } @TestMetadata("kt15016.kt") - public void testKt15016_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15016.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("kt15016.kt") - public void testKt15016_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15016.kt", "kotlin.coroutines"); + public void testKt15016() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt15016.kt"); } @TestMetadata("kt15017.kt") - public void testKt15017_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15017.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("kt15017.kt") - public void testKt15017_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15017.kt", "kotlin.coroutines"); + public void testKt15017() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt15017.kt"); } @TestMetadata("kt15930.kt") - public void testKt15930_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15930.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("kt15930.kt") - public void testKt15930_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15930.kt", "kotlin.coroutines"); + public void testKt15930() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt15930.kt"); } @TestMetadata("kt21605.kt") - public void testKt21605_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt21605.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("kt21605.kt") - public void testKt21605_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt21605.kt", "kotlin.coroutines"); + public void testKt21605() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt21605.kt"); } @TestMetadata("kt25912.kt") - public void testKt25912_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt25912.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("kt25912.kt") - public void testKt25912_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt25912.kt", "kotlin.coroutines"); + public void testKt25912() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt25912.kt"); } @TestMetadata("kt28844.kt") - public void testKt28844_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt28844.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("kt28844.kt") - public void testKt28844_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt28844.kt", "kotlin.coroutines"); + public void testKt28844() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt28844.kt"); } @TestMetadata("kt30858.kt") @@ -7104,43 +6833,23 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("lastExpressionIsLoop.kt") - public void testLastExpressionIsLoop_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("lastExpressionIsLoop.kt") - public void testLastExpressionIsLoop_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt", "kotlin.coroutines"); + public void testLastExpressionIsLoop() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt"); } @TestMetadata("lastStatementInc.kt") - public void testLastStatementInc_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastStatementInc.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("lastStatementInc.kt") - public void testLastStatementInc_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastStatementInc.kt", "kotlin.coroutines"); + public void testLastStatementInc() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastStatementInc.kt"); } @TestMetadata("lastStementAssignment.kt") - public void testLastStementAssignment_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastStementAssignment.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("lastStementAssignment.kt") - public void testLastStementAssignment_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastStementAssignment.kt", "kotlin.coroutines"); + public void testLastStementAssignment() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastStementAssignment.kt"); } @TestMetadata("lastUnitExpression.kt") - public void testLastUnitExpression_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastUnitExpression.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("lastUnitExpression.kt") - public void testLastUnitExpression_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastUnitExpression.kt", "kotlin.coroutines"); + public void testLastUnitExpression() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastUnitExpression.kt"); } @TestMetadata("localCallableRef.kt") @@ -7149,103 +6858,53 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("localDelegate.kt") - public void testLocalDelegate_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localDelegate.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("localDelegate.kt") - public void testLocalDelegate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localDelegate.kt", "kotlin.coroutines"); + public void testLocalDelegate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localDelegate.kt"); } @TestMetadata("longRangeInSuspendCall.kt") - public void testLongRangeInSuspendCall_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/longRangeInSuspendCall.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("longRangeInSuspendCall.kt") - public void testLongRangeInSuspendCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/longRangeInSuspendCall.kt", "kotlin.coroutines"); + public void testLongRangeInSuspendCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/longRangeInSuspendCall.kt"); } @TestMetadata("longRangeInSuspendFun.kt") - public void testLongRangeInSuspendFun_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/longRangeInSuspendFun.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("longRangeInSuspendFun.kt") - public void testLongRangeInSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/longRangeInSuspendFun.kt", "kotlin.coroutines"); + public void testLongRangeInSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/longRangeInSuspendFun.kt"); } @TestMetadata("mergeNullAndString.kt") - public void testMergeNullAndString_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/mergeNullAndString.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("mergeNullAndString.kt") - public void testMergeNullAndString_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/mergeNullAndString.kt", "kotlin.coroutines"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda1.kt") - public void testMultipleInvokeCallsInsideInlineLambda1_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda1.kt") - public void testMultipleInvokeCallsInsideInlineLambda1_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt", "kotlin.coroutines"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda2.kt") - public void testMultipleInvokeCallsInsideInlineLambda2_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda2.kt") - public void testMultipleInvokeCallsInsideInlineLambda2_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt", "kotlin.coroutines"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda3.kt") - public void testMultipleInvokeCallsInsideInlineLambda3_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda3.kt") - public void testMultipleInvokeCallsInsideInlineLambda3_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt", "kotlin.coroutines"); + public void testMergeNullAndString() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/mergeNullAndString.kt"); } @TestMetadata("multipleInvokeCalls.kt") - public void testMultipleInvokeCalls_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt", "kotlin.coroutines.experimental"); + public void testMultipleInvokeCalls() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt"); } - @TestMetadata("multipleInvokeCalls.kt") - public void testMultipleInvokeCalls_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt", "kotlin.coroutines"); + @TestMetadata("multipleInvokeCallsInsideInlineLambda1.kt") + public void testMultipleInvokeCallsInsideInlineLambda1() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt"); + } + + @TestMetadata("multipleInvokeCallsInsideInlineLambda2.kt") + public void testMultipleInvokeCallsInsideInlineLambda2() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt"); + } + + @TestMetadata("multipleInvokeCallsInsideInlineLambda3.kt") + public void testMultipleInvokeCallsInsideInlineLambda3() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt"); } @TestMetadata("nestedTryCatch.kt") - public void testNestedTryCatch_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nestedTryCatch.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("nestedTryCatch.kt") - public void testNestedTryCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nestedTryCatch.kt", "kotlin.coroutines"); + public void testNestedTryCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/nestedTryCatch.kt"); } @TestMetadata("noSuspensionPoints.kt") - public void testNoSuspensionPoints_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noSuspensionPoints.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("noSuspensionPoints.kt") - public void testNoSuspensionPoints_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noSuspensionPoints.kt", "kotlin.coroutines"); + public void testNoSuspensionPoints() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/noSuspensionPoints.kt"); } @TestMetadata("nonLocalReturn.kt") @@ -7253,44 +6912,24 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/coroutines/nonLocalReturn.kt"); } - @TestMetadata("nonLocalReturnFromInlineLambdaDeep.kt") - public void testNonLocalReturnFromInlineLambdaDeep_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt", "kotlin.coroutines.experimental"); + @TestMetadata("nonLocalReturnFromInlineLambda.kt") + public void testNonLocalReturnFromInlineLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt"); } @TestMetadata("nonLocalReturnFromInlineLambdaDeep.kt") - public void testNonLocalReturnFromInlineLambdaDeep_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt", "kotlin.coroutines"); - } - - @TestMetadata("nonLocalReturnFromInlineLambda.kt") - public void testNonLocalReturnFromInlineLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("nonLocalReturnFromInlineLambda.kt") - public void testNonLocalReturnFromInlineLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt", "kotlin.coroutines"); + public void testNonLocalReturnFromInlineLambdaDeep() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt"); } @TestMetadata("overrideDefaultArgument.kt") - public void testOverrideDefaultArgument_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/overrideDefaultArgument.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideDefaultArgument.kt") - public void testOverrideDefaultArgument_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/overrideDefaultArgument.kt", "kotlin.coroutines"); + public void testOverrideDefaultArgument() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/overrideDefaultArgument.kt"); } @TestMetadata("recursiveSuspend.kt") - public void testRecursiveSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/recursiveSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("recursiveSuspend.kt") - public void testRecursiveSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/recursiveSuspend.kt", "kotlin.coroutines"); + public void testRecursiveSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/recursiveSuspend.kt"); } @TestMetadata("restrictedSuspendLambda.kt") @@ -7299,23 +6938,18 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("returnByLabel.kt") - public void testReturnByLabel_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/returnByLabel.kt", "kotlin.coroutines.experimental"); + public void testReturnByLabel() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/returnByLabel.kt"); } - @TestMetadata("returnByLabel.kt") - public void testReturnByLabel_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/returnByLabel.kt", "kotlin.coroutines"); + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/simple.kt"); } @TestMetadata("simpleException.kt") - public void testSimpleException_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simpleException.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("simpleException.kt") - public void testSimpleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simpleException.kt", "kotlin.coroutines"); + public void testSimpleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/simpleException.kt"); } @TestMetadata("simpleSuspendCallableReference.kt") @@ -7324,33 +6958,13 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("simpleWithHandleResult.kt") - public void testSimpleWithHandleResult_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simpleWithHandleResult.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("simpleWithHandleResult.kt") - public void testSimpleWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simpleWithHandleResult.kt", "kotlin.coroutines"); - } - - @TestMetadata("simple.kt") - public void testSimple_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simple.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simple.kt", "kotlin.coroutines"); + public void testSimpleWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/simpleWithHandleResult.kt"); } @TestMetadata("statementLikeLastExpression.kt") - public void testStatementLikeLastExpression_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/statementLikeLastExpression.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("statementLikeLastExpression.kt") - public void testStatementLikeLastExpression_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/statementLikeLastExpression.kt", "kotlin.coroutines"); + public void testStatementLikeLastExpression() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/statementLikeLastExpression.kt"); } @TestMetadata("stopAfter.kt") @@ -7359,23 +6973,13 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("suspendCallsInArguments.kt") - public void testSuspendCallsInArguments_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendCallsInArguments.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendCallsInArguments.kt") - public void testSuspendCallsInArguments_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendCallsInArguments.kt", "kotlin.coroutines"); + public void testSuspendCallsInArguments() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendCallsInArguments.kt"); } @TestMetadata("suspendCoroutineFromStateMachine.kt") - public void testSuspendCoroutineFromStateMachine_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendCoroutineFromStateMachine.kt") - public void testSuspendCoroutineFromStateMachine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt", "kotlin.coroutines"); + public void testSuspendCoroutineFromStateMachine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt"); } @TestMetadata("suspendCovariantJavaOverrides.kt") @@ -7384,43 +6988,23 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("suspendDefaultImpl.kt") - public void testSuspendDefaultImpl_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendDefaultImpl.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendDefaultImpl.kt") - public void testSuspendDefaultImpl_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendDefaultImpl.kt", "kotlin.coroutines"); + public void testSuspendDefaultImpl() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendDefaultImpl.kt"); } @TestMetadata("suspendDelegation.kt") - public void testSuspendDelegation_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendDelegation.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendDelegation.kt") - public void testSuspendDelegation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendDelegation.kt", "kotlin.coroutines"); + public void testSuspendDelegation() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendDelegation.kt"); } @TestMetadata("suspendFromInlineLambda.kt") - public void testSuspendFromInlineLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendFromInlineLambda.kt") - public void testSuspendFromInlineLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt", "kotlin.coroutines"); + public void testSuspendFromInlineLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt"); } @TestMetadata("suspendFunImportedFromObject.kt") - public void testSuspendFunImportedFromObject_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunImportedFromObject.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendFunImportedFromObject.kt") - public void testSuspendFunImportedFromObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunImportedFromObject.kt", "kotlin.coroutines"); + public void testSuspendFunImportedFromObject() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunImportedFromObject.kt"); } @TestMetadata("suspendFunctionMethodReference.kt") @@ -7434,43 +7018,23 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("suspendInCycle.kt") - public void testSuspendInCycle_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInCycle.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendInCycle.kt") - public void testSuspendInCycle_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInCycle.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt") - public void testSuspendInTheMiddleOfObjectConstructionEvaluationOrder_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt") - public void testSuspendInTheMiddleOfObjectConstructionEvaluationOrder_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendInTheMiddleOfObjectConstructionWithJumpOut.kt") - public void testSuspendInTheMiddleOfObjectConstructionWithJumpOut_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionWithJumpOut.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendInTheMiddleOfObjectConstructionWithJumpOut.kt") - public void testSuspendInTheMiddleOfObjectConstructionWithJumpOut_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionWithJumpOut.kt", "kotlin.coroutines"); + public void testSuspendInCycle() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInCycle.kt"); } @TestMetadata("suspendInTheMiddleOfObjectConstruction.kt") - public void testSuspendInTheMiddleOfObjectConstruction_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt", "kotlin.coroutines.experimental"); + public void testSuspendInTheMiddleOfObjectConstruction() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt"); } - @TestMetadata("suspendInTheMiddleOfObjectConstruction.kt") - public void testSuspendInTheMiddleOfObjectConstruction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt", "kotlin.coroutines"); + @TestMetadata("suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt") + public void testSuspendInTheMiddleOfObjectConstructionEvaluationOrder() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt"); + } + + @TestMetadata("suspendInTheMiddleOfObjectConstructionWithJumpOut.kt") + public void testSuspendInTheMiddleOfObjectConstructionWithJumpOut() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionWithJumpOut.kt"); } @TestMetadata("suspendJavaOverrides.kt") @@ -7484,13 +7048,8 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("suspendLambdaWithArgumentRearrangement.kt") - public void testSuspendLambdaWithArgumentRearrangement_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendLambdaWithArgumentRearrangement.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendLambdaWithArgumentRearrangement.kt") - public void testSuspendLambdaWithArgumentRearrangement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendLambdaWithArgumentRearrangement.kt", "kotlin.coroutines"); + public void testSuspendLambdaWithArgumentRearrangement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendLambdaWithArgumentRearrangement.kt"); } @TestMetadata("suspendReturningPlatformType.kt") @@ -7498,24 +7057,14 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/coroutines/suspendReturningPlatformType.kt"); } - @TestMetadata("suspensionInsideSafeCallWithElvis.kt") - public void testSuspensionInsideSafeCallWithElvis_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt", "kotlin.coroutines.experimental"); + @TestMetadata("suspensionInsideSafeCall.kt") + public void testSuspensionInsideSafeCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCall.kt"); } @TestMetadata("suspensionInsideSafeCallWithElvis.kt") - public void testSuspensionInsideSafeCallWithElvis_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspensionInsideSafeCall.kt") - public void testSuspensionInsideSafeCall_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCall.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspensionInsideSafeCall.kt") - public void testSuspensionInsideSafeCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCall.kt", "kotlin.coroutines"); + public void testSuspensionInsideSafeCallWithElvis() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt"); } @TestMetadata("tailCallToNothing.kt") @@ -7524,73 +7073,38 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("tryCatchFinallyWithHandleResult.kt") - public void testTryCatchFinallyWithHandleResult_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("tryCatchFinallyWithHandleResult.kt") - public void testTryCatchFinallyWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt", "kotlin.coroutines"); + public void testTryCatchFinallyWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt"); } @TestMetadata("tryCatchWithHandleResult.kt") - public void testTryCatchWithHandleResult_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryCatchWithHandleResult.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("tryCatchWithHandleResult.kt") - public void testTryCatchWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryCatchWithHandleResult.kt", "kotlin.coroutines"); + public void testTryCatchWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryCatchWithHandleResult.kt"); } @TestMetadata("tryFinallyInsideInlineLambda.kt") - public void testTryFinallyInsideInlineLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("tryFinallyInsideInlineLambda.kt") - public void testTryFinallyInsideInlineLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt", "kotlin.coroutines"); + public void testTryFinallyInsideInlineLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt"); } @TestMetadata("tryFinallyWithHandleResult.kt") - public void testTryFinallyWithHandleResult_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryFinallyWithHandleResult.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("tryFinallyWithHandleResult.kt") - public void testTryFinallyWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryFinallyWithHandleResult.kt", "kotlin.coroutines"); + public void testTryFinallyWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryFinallyWithHandleResult.kt"); } @TestMetadata("varCaptuedInCoroutineIntrinsic.kt") - public void testVarCaptuedInCoroutineIntrinsic_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varCaptuedInCoroutineIntrinsic.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("varCaptuedInCoroutineIntrinsic.kt") - public void testVarCaptuedInCoroutineIntrinsic_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varCaptuedInCoroutineIntrinsic.kt", "kotlin.coroutines"); - } - - @TestMetadata("varValueConflictsWithTableSameSort.kt") - public void testVarValueConflictsWithTableSameSort_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("varValueConflictsWithTableSameSort.kt") - public void testVarValueConflictsWithTableSameSort_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt", "kotlin.coroutines"); + public void testVarCaptuedInCoroutineIntrinsic() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varCaptuedInCoroutineIntrinsic.kt"); } @TestMetadata("varValueConflictsWithTable.kt") - public void testVarValueConflictsWithTable_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varValueConflictsWithTable.kt", "kotlin.coroutines.experimental"); + public void testVarValueConflictsWithTable() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varValueConflictsWithTable.kt"); } - @TestMetadata("varValueConflictsWithTable.kt") - public void testVarValueConflictsWithTable_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varValueConflictsWithTable.kt", "kotlin.coroutines"); + @TestMetadata("varValueConflictsWithTableSameSort.kt") + public void testVarValueConflictsWithTableSameSort() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt"); } @TestMetadata("compiler/testData/codegen/box/coroutines/bridges") @@ -7601,42 +7115,23 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInBridges() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/bridges"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("interfaceSpecialization.kt") - public void testInterfaceSpecialization_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/interfaceSpecialization.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("interfaceSpecialization.kt") - public void testInterfaceSpecialization_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/interfaceSpecialization.kt", "kotlin.coroutines"); + public void testInterfaceSpecialization() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/bridges/interfaceSpecialization.kt"); } @TestMetadata("lambdaWithLongReceiver.kt") - public void testLambdaWithLongReceiver_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/lambdaWithLongReceiver.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("lambdaWithLongReceiver.kt") - public void testLambdaWithLongReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/lambdaWithLongReceiver.kt", "kotlin.coroutines"); + public void testLambdaWithLongReceiver() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithLongReceiver.kt"); } @TestMetadata("lambdaWithMultipleParameters.kt") - public void testLambdaWithMultipleParameters_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("lambdaWithMultipleParameters.kt") - public void testLambdaWithMultipleParameters_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt", "kotlin.coroutines"); + public void testLambdaWithMultipleParameters() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt"); } } @@ -7648,112 +7143,58 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInControlFlow() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/controlFlow"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("breakFinally.kt") - public void testBreakFinally_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/breakFinally.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("breakFinally.kt") - public void testBreakFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/breakFinally.kt", "kotlin.coroutines"); + public void testBreakFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/breakFinally.kt"); } @TestMetadata("breakStatement.kt") - public void testBreakStatement_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/breakStatement.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("breakStatement.kt") - public void testBreakStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/breakStatement.kt", "kotlin.coroutines"); + public void testBreakStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/breakStatement.kt"); } @TestMetadata("complexChainSuspend.kt") - public void testComplexChainSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/complexChainSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("complexChainSuspend.kt") - public void testComplexChainSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/complexChainSuspend.kt", "kotlin.coroutines"); + public void testComplexChainSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/complexChainSuspend.kt"); } @TestMetadata("doWhileStatement.kt") - public void testDoWhileStatement_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/doWhileStatement.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("doWhileStatement.kt") - public void testDoWhileStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/doWhileStatement.kt", "kotlin.coroutines"); + public void testDoWhileStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/doWhileStatement.kt"); } @TestMetadata("doubleBreak.kt") - public void testDoubleBreak_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/doubleBreak.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("doubleBreak.kt") - public void testDoubleBreak_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/doubleBreak.kt", "kotlin.coroutines"); + public void testDoubleBreak() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/doubleBreak.kt"); } @TestMetadata("finallyCatch.kt") - public void testFinallyCatch_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/finallyCatch.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("finallyCatch.kt") - public void testFinallyCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/finallyCatch.kt", "kotlin.coroutines"); + public void testFinallyCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/finallyCatch.kt"); } @TestMetadata("forContinue.kt") - public void testForContinue_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forContinue.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("forContinue.kt") - public void testForContinue_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forContinue.kt", "kotlin.coroutines"); + public void testForContinue() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/forContinue.kt"); } @TestMetadata("forStatement.kt") - public void testForStatement_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forStatement.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("forStatement.kt") - public void testForStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forStatement.kt", "kotlin.coroutines"); + public void testForStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/forStatement.kt"); } @TestMetadata("forWithStep.kt") - public void testForWithStep_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forWithStep.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("forWithStep.kt") - public void testForWithStep_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forWithStep.kt", "kotlin.coroutines"); + public void testForWithStep() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/forWithStep.kt"); } @TestMetadata("ifStatement.kt") - public void testIfStatement_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("ifStatement.kt") - public void testIfStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt", "kotlin.coroutines"); + public void testIfStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt"); } @TestMetadata("kt22694_1_3.kt") @@ -7762,113 +7203,58 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("labeledWhile.kt") - public void testLabeledWhile_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/labeledWhile.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("labeledWhile.kt") - public void testLabeledWhile_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/labeledWhile.kt", "kotlin.coroutines"); + public void testLabeledWhile() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/labeledWhile.kt"); } @TestMetadata("multipleCatchBlocksSuspend.kt") - public void testMultipleCatchBlocksSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/multipleCatchBlocksSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("multipleCatchBlocksSuspend.kt") - public void testMultipleCatchBlocksSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/multipleCatchBlocksSuspend.kt", "kotlin.coroutines"); + public void testMultipleCatchBlocksSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/multipleCatchBlocksSuspend.kt"); } @TestMetadata("returnFromFinally.kt") - public void testReturnFromFinally_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/returnFromFinally.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("returnFromFinally.kt") - public void testReturnFromFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/returnFromFinally.kt", "kotlin.coroutines"); + public void testReturnFromFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/returnFromFinally.kt"); } @TestMetadata("returnWithFinally.kt") - public void testReturnWithFinally_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/returnWithFinally.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("returnWithFinally.kt") - public void testReturnWithFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/returnWithFinally.kt", "kotlin.coroutines"); + public void testReturnWithFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/returnWithFinally.kt"); } @TestMetadata("suspendInStringTemplate.kt") - public void testSuspendInStringTemplate_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/suspendInStringTemplate.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendInStringTemplate.kt") - public void testSuspendInStringTemplate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/suspendInStringTemplate.kt", "kotlin.coroutines"); + public void testSuspendInStringTemplate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/suspendInStringTemplate.kt"); } @TestMetadata("switchLikeWhen.kt") - public void testSwitchLikeWhen_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/switchLikeWhen.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("switchLikeWhen.kt") - public void testSwitchLikeWhen_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/switchLikeWhen.kt", "kotlin.coroutines"); + public void testSwitchLikeWhen() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/switchLikeWhen.kt"); } @TestMetadata("throwFromCatch.kt") - public void testThrowFromCatch_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwFromCatch.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("throwFromCatch.kt") - public void testThrowFromCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwFromCatch.kt", "kotlin.coroutines"); + public void testThrowFromCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/throwFromCatch.kt"); } @TestMetadata("throwFromFinally.kt") - public void testThrowFromFinally_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwFromFinally.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("throwFromFinally.kt") - public void testThrowFromFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwFromFinally.kt", "kotlin.coroutines"); + public void testThrowFromFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/throwFromFinally.kt"); } @TestMetadata("throwInTryWithHandleResult.kt") - public void testThrowInTryWithHandleResult_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("throwInTryWithHandleResult.kt") - public void testThrowInTryWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt", "kotlin.coroutines"); + public void testThrowInTryWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt"); } @TestMetadata("whenWithSuspensions.kt") - public void testWhenWithSuspensions_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/whenWithSuspensions.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("whenWithSuspensions.kt") - public void testWhenWithSuspensions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/whenWithSuspensions.kt", "kotlin.coroutines"); + public void testWhenWithSuspensions() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/whenWithSuspensions.kt"); } @TestMetadata("whileStatement.kt") - public void testWhileStatement_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/whileStatement.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("whileStatement.kt") - public void testWhileStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/whileStatement.kt", "kotlin.coroutines"); + public void testWhileStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/whileStatement.kt"); } } @@ -7938,22 +7324,13 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInFeatureIntersection() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/featureIntersection"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("breakWithNonEmptyStack.kt") - public void testBreakWithNonEmptyStack_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("breakWithNonEmptyStack.kt") - public void testBreakWithNonEmptyStack_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt", "kotlin.coroutines"); + public void testBreakWithNonEmptyStack() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt"); } @TestMetadata("defaultExpect.kt") @@ -7962,33 +7339,18 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("delegate.kt") - public void testDelegate_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("delegate.kt") - public void testDelegate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt", "kotlin.coroutines"); + public void testDelegate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt"); } @TestMetadata("destructuringInLambdas.kt") - public void testDestructuringInLambdas_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("destructuringInLambdas.kt") - public void testDestructuringInLambdas_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt", "kotlin.coroutines"); + public void testDestructuringInLambdas() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt"); } @TestMetadata("inlineSuspendFinally.kt") - public void testInlineSuspendFinally_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/inlineSuspendFinally.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendFinally.kt") - public void testInlineSuspendFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/inlineSuspendFinally.kt", "kotlin.coroutines"); + public void testInlineSuspendFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/inlineSuspendFinally.kt"); } @TestMetadata("interfaceMethodWithBody.kt") @@ -8006,34 +7368,19 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/coroutines/featureIntersection/overrideInInlineClass.kt"); } - @TestMetadata("safeCallOnTwoReceiversLong.kt") - public void testSafeCallOnTwoReceiversLong_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt", "kotlin.coroutines.experimental"); + @TestMetadata("safeCallOnTwoReceivers.kt") + public void testSafeCallOnTwoReceivers() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt"); } @TestMetadata("safeCallOnTwoReceiversLong.kt") - public void testSafeCallOnTwoReceiversLong_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt", "kotlin.coroutines"); - } - - @TestMetadata("safeCallOnTwoReceivers.kt") - public void testSafeCallOnTwoReceivers_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("safeCallOnTwoReceivers.kt") - public void testSafeCallOnTwoReceivers_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt", "kotlin.coroutines"); + public void testSafeCallOnTwoReceiversLong() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt"); } @TestMetadata("suspendDestructuringInLambdas.kt") - public void testSuspendDestructuringInLambdas_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendDestructuringInLambdas.kt") - public void testSuspendDestructuringInLambdas_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt", "kotlin.coroutines"); + public void testSuspendDestructuringInLambdas() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt"); } @TestMetadata("suspendFunctionIsAs.kt") @@ -8042,43 +7389,23 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("suspendInlineSuspendFinally.kt") - public void testSuspendInlineSuspendFinally_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendInlineSuspendFinally.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendInlineSuspendFinally.kt") - public void testSuspendInlineSuspendFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendInlineSuspendFinally.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendOperatorPlusAssign.kt") - public void testSuspendOperatorPlusAssign_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusAssign.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendOperatorPlusAssign.kt") - public void testSuspendOperatorPlusAssign_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusAssign.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendOperatorPlusCallFromLambda.kt") - public void testSuspendOperatorPlusCallFromLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusCallFromLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendOperatorPlusCallFromLambda.kt") - public void testSuspendOperatorPlusCallFromLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusCallFromLambda.kt", "kotlin.coroutines"); + public void testSuspendInlineSuspendFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendInlineSuspendFinally.kt"); } @TestMetadata("suspendOperatorPlus.kt") - public void testSuspendOperatorPlus_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlus.kt", "kotlin.coroutines.experimental"); + public void testSuspendOperatorPlus() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlus.kt"); } - @TestMetadata("suspendOperatorPlus.kt") - public void testSuspendOperatorPlus_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlus.kt", "kotlin.coroutines"); + @TestMetadata("suspendOperatorPlusAssign.kt") + public void testSuspendOperatorPlusAssign() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusAssign.kt"); + } + + @TestMetadata("suspendOperatorPlusCallFromLambda.kt") + public void testSuspendOperatorPlusCallFromLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusCallFromLambda.kt"); } @TestMetadata("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference") @@ -8089,22 +7416,13 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInCallableReference() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("bigArity.kt") - public void testBigArity_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/bigArity.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("bigArity.kt") - public void testBigArity_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/bigArity.kt", "kotlin.coroutines"); + public void testBigArity() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/bigArity.kt"); } @TestMetadata("fromJava.kt") @@ -8190,142 +7508,73 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInTailrec() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("controlFlowIf.kt") - public void testControlFlowIf_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowIf.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("controlFlowIf.kt") - public void testControlFlowIf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowIf.kt", "kotlin.coroutines"); + public void testControlFlowIf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowIf.kt"); } @TestMetadata("controlFlowWhen.kt") - public void testControlFlowWhen_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowWhen.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("controlFlowWhen.kt") - public void testControlFlowWhen_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowWhen.kt", "kotlin.coroutines"); + public void testControlFlowWhen() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowWhen.kt"); } @TestMetadata("extention.kt") - public void testExtention_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/extention.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("extention.kt") - public void testExtention_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/extention.kt", "kotlin.coroutines"); + public void testExtention() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/extention.kt"); } @TestMetadata("infixCall.kt") - public void testInfixCall_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixCall.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("infixCall.kt") - public void testInfixCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixCall.kt", "kotlin.coroutines"); + public void testInfixCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixCall.kt"); } @TestMetadata("infixRecursiveCall.kt") - public void testInfixRecursiveCall_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixRecursiveCall.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("infixRecursiveCall.kt") - public void testInfixRecursiveCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixRecursiveCall.kt", "kotlin.coroutines"); + public void testInfixRecursiveCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixRecursiveCall.kt"); } @TestMetadata("realIteratorFoldl.kt") - public void testRealIteratorFoldl_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realIteratorFoldl.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("realIteratorFoldl.kt") - public void testRealIteratorFoldl_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realIteratorFoldl.kt", "kotlin.coroutines"); + public void testRealIteratorFoldl() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realIteratorFoldl.kt"); } @TestMetadata("realStringEscape.kt") - public void testRealStringEscape_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringEscape.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("realStringEscape.kt") - public void testRealStringEscape_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringEscape.kt", "kotlin.coroutines"); + public void testRealStringEscape() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringEscape.kt"); } @TestMetadata("realStringRepeat.kt") - public void testRealStringRepeat_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringRepeat.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("realStringRepeat.kt") - public void testRealStringRepeat_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringRepeat.kt", "kotlin.coroutines"); + public void testRealStringRepeat() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringRepeat.kt"); } @TestMetadata("returnInParentheses.kt") - public void testReturnInParentheses_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/returnInParentheses.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("returnInParentheses.kt") - public void testReturnInParentheses_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/returnInParentheses.kt", "kotlin.coroutines"); + public void testReturnInParentheses() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/returnInParentheses.kt"); } @TestMetadata("sum.kt") - public void testSum_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/sum.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("sum.kt") - public void testSum_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/sum.kt", "kotlin.coroutines"); + public void testSum() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/sum.kt"); } @TestMetadata("tailCallInBlockInParentheses.kt") - public void testTailCallInBlockInParentheses_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInBlockInParentheses.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("tailCallInBlockInParentheses.kt") - public void testTailCallInBlockInParentheses_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInBlockInParentheses.kt", "kotlin.coroutines"); + public void testTailCallInBlockInParentheses() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInBlockInParentheses.kt"); } @TestMetadata("tailCallInParentheses.kt") - public void testTailCallInParentheses_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInParentheses.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("tailCallInParentheses.kt") - public void testTailCallInParentheses_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInParentheses.kt", "kotlin.coroutines"); + public void testTailCallInParentheses() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInParentheses.kt"); } @TestMetadata("whenWithIs.kt") - public void testWhenWithIs_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/whenWithIs.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("whenWithIs.kt") - public void testWhenWithIs_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/whenWithIs.kt", "kotlin.coroutines"); + public void testWhenWithIs() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/whenWithIs.kt"); } } } @@ -8355,10 +7604,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInDirect() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses/direct"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @@ -8374,113 +7619,58 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Any.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineInt() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineInt.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Int.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Long() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Long.kt"); } @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_NAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_NAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_nonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_nonLocalReturn.kt"); } @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_suspendFunType() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_suspendFunType.kt"); } @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationCrossinline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationCrossinline.kt", "kotlin.coroutines"); + public void testBridgeGenerationCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationCrossinline.kt"); } @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationNonInline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationNonInline.kt", "kotlin.coroutines"); + public void testBridgeGenerationNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationNonInline.kt"); } @TestMetadata("covariantOverrideSuspendFun.kt") @@ -8594,13 +7784,8 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); + public void testInterfaceDelegateWithInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt"); } @TestMetadata("invokeOperator.kt") @@ -8609,53 +7794,28 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt"); } @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any.kt"); } @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_itf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_itf.kt"); } @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_this.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_this.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_this() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_this.kt"); } @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Int.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Int.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Int.kt"); } @TestMetadata("returnResult.kt") @@ -8672,10 +7832,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInResume() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses/resume"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @@ -8691,113 +7847,58 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Any.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineInt() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineInt.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Int.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Long() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Long.kt"); } @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_NAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_NAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_nonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_nonLocalReturn.kt"); } @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_suspendFunType() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_suspendFunType.kt"); } @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationCrossinline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationCrossinline.kt", "kotlin.coroutines"); + public void testBridgeGenerationCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationCrossinline.kt"); } @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationNonInline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationNonInline.kt", "kotlin.coroutines"); + public void testBridgeGenerationNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationNonInline.kt"); } @TestMetadata("covariantOverrideSuspendFun.kt") @@ -8911,13 +8012,8 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); + public void testInterfaceDelegateWithInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt"); } @TestMetadata("invokeOperator.kt") @@ -8926,53 +8022,28 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt"); } @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any.kt"); } @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_itf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_itf.kt"); } @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_this.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_this.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_this() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_this.kt"); } @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Int.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Int.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Int.kt"); } @TestMetadata("returnResult.kt") @@ -8989,10 +8060,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInResumeWithException() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @@ -9008,113 +8075,58 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Any.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineInt() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineInt.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Int.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Long() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Long.kt"); } @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_NAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_NAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_nonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_nonLocalReturn.kt"); } @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_suspendFunType() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_suspendFunType.kt"); } @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationCrossinline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationCrossinline.kt", "kotlin.coroutines"); + public void testBridgeGenerationCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationCrossinline.kt"); } @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationNonInline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationNonInline.kt", "kotlin.coroutines"); + public void testBridgeGenerationNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationNonInline.kt"); } @TestMetadata("covariantOverrideSuspendFun.kt") @@ -9213,13 +8225,8 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); + public void testInterfaceDelegateWithInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt"); } @TestMetadata("invokeOperator.kt") @@ -9228,53 +8235,28 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt"); } @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any.kt"); } @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_itf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_itf.kt"); } @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_this.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_this.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_this() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_this.kt"); } @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Int.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Int.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Int.kt"); } @TestMetadata("returnResult.kt") @@ -9292,32 +8274,18 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInIntLikeVarSpilling() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/intLikeVarSpilling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("complicatedMerge.kt") - public void testComplicatedMerge_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("complicatedMerge.kt") - public void testComplicatedMerge_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt", "kotlin.coroutines"); + public void testComplicatedMerge() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt"); } @TestMetadata("i2bResult.kt") - public void testI2bResult_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("i2bResult.kt") - public void testI2bResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines"); + public void testI2bResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt"); } @TestMetadata("listThrowablePairInOneSlot.kt") @@ -9326,83 +8294,43 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("loadFromBooleanArray.kt") - public void testLoadFromBooleanArray_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("loadFromBooleanArray.kt") - public void testLoadFromBooleanArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines"); + public void testLoadFromBooleanArray() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt"); } @TestMetadata("loadFromByteArray.kt") - public void testLoadFromByteArray_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("loadFromByteArray.kt") - public void testLoadFromByteArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt", "kotlin.coroutines"); + public void testLoadFromByteArray() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt"); } @TestMetadata("noVariableInTable.kt") - public void testNoVariableInTable_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("noVariableInTable.kt") - public void testNoVariableInTable_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt", "kotlin.coroutines"); + public void testNoVariableInTable() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt"); } @TestMetadata("sameIconst1ManyVars.kt") - public void testSameIconst1ManyVars_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("sameIconst1ManyVars.kt") - public void testSameIconst1ManyVars_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt", "kotlin.coroutines"); + public void testSameIconst1ManyVars() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt"); } @TestMetadata("usedInArrayStore.kt") - public void testUsedInArrayStore_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInArrayStore.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("usedInArrayStore.kt") - public void testUsedInArrayStore_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInArrayStore.kt", "kotlin.coroutines"); + public void testUsedInArrayStore() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInArrayStore.kt"); } @TestMetadata("usedInMethodCall.kt") - public void testUsedInMethodCall_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("usedInMethodCall.kt") - public void testUsedInMethodCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt", "kotlin.coroutines"); + public void testUsedInMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt"); } @TestMetadata("usedInPutfield.kt") - public void testUsedInPutfield_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInPutfield.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("usedInPutfield.kt") - public void testUsedInPutfield_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInPutfield.kt", "kotlin.coroutines"); + public void testUsedInPutfield() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInPutfield.kt"); } @TestMetadata("usedInVarStore.kt") - public void testUsedInVarStore_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("usedInVarStore.kt") - public void testUsedInVarStore_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt", "kotlin.coroutines"); + public void testUsedInVarStore() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt"); } } @@ -9414,92 +8342,48 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInIntrinsicSemantics() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/intrinsicSemantics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } - @TestMetadata("coroutineContextReceiverNotIntrinsic.kt") - public void testCoroutineContextReceiverNotIntrinsic_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiverNotIntrinsic.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("coroutineContextReceiverNotIntrinsic.kt") - public void testCoroutineContextReceiverNotIntrinsic_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiverNotIntrinsic.kt", "kotlin.coroutines"); + @TestMetadata("coroutineContext.kt") + public void testCoroutineContext() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContext.kt"); } @TestMetadata("coroutineContextReceiver.kt") - public void testCoroutineContextReceiver_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiver.kt", "kotlin.coroutines.experimental"); + public void testCoroutineContextReceiver() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiver.kt"); } - @TestMetadata("coroutineContextReceiver.kt") - public void testCoroutineContextReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiver.kt", "kotlin.coroutines"); - } - - @TestMetadata("coroutineContext.kt") - public void testCoroutineContext_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContext.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("coroutineContext.kt") - public void testCoroutineContext_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContext.kt", "kotlin.coroutines"); + @TestMetadata("coroutineContextReceiverNotIntrinsic.kt") + public void testCoroutineContextReceiverNotIntrinsic() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiverNotIntrinsic.kt"); } @TestMetadata("intercepted.kt") - public void testIntercepted_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/intercepted.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("intercepted.kt") - public void testIntercepted_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/intercepted.kt", "kotlin.coroutines"); - } - - @TestMetadata("startCoroutineUninterceptedOrReturnInterception.kt") - public void testStartCoroutineUninterceptedOrReturnInterception_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("startCoroutineUninterceptedOrReturnInterception.kt") - public void testStartCoroutineUninterceptedOrReturnInterception_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt", "kotlin.coroutines"); - } - - @TestMetadata("startCoroutineUninterceptedOrReturn.kt") - public void testStartCoroutineUninterceptedOrReturn_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("startCoroutineUninterceptedOrReturn.kt") - public void testStartCoroutineUninterceptedOrReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt", "kotlin.coroutines"); + public void testIntercepted() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/intercepted.kt"); } @TestMetadata("startCoroutine.kt") - public void testStartCoroutine_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt", "kotlin.coroutines.experimental"); + public void testStartCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt"); } - @TestMetadata("startCoroutine.kt") - public void testStartCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt", "kotlin.coroutines"); + @TestMetadata("startCoroutineUninterceptedOrReturn.kt") + public void testStartCoroutineUninterceptedOrReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt"); + } + + @TestMetadata("startCoroutineUninterceptedOrReturnInterception.kt") + public void testStartCoroutineUninterceptedOrReturnInterception() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt"); } @TestMetadata("suspendCoroutineUninterceptedOrReturn.kt") - public void testSuspendCoroutineUninterceptedOrReturn_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/suspendCoroutineUninterceptedOrReturn.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendCoroutineUninterceptedOrReturn.kt") - public void testSuspendCoroutineUninterceptedOrReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/suspendCoroutineUninterceptedOrReturn.kt", "kotlin.coroutines"); + public void testSuspendCoroutineUninterceptedOrReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/suspendCoroutineUninterceptedOrReturn.kt"); } } @@ -9511,62 +8395,33 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInJavaInterop() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("objectWithSeveralSuspends.kt") - public void testObjectWithSeveralSuspends_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/objectWithSeveralSuspends.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("objectWithSeveralSuspends.kt") - public void testObjectWithSeveralSuspends_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/objectWithSeveralSuspends.kt", "kotlin.coroutines"); + public void testObjectWithSeveralSuspends() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/javaInterop/objectWithSeveralSuspends.kt"); } @TestMetadata("returnLambda.kt") - public void testReturnLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/returnLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("returnLambda.kt") - public void testReturnLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/returnLambda.kt", "kotlin.coroutines"); + public void testReturnLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/javaInterop/returnLambda.kt"); } @TestMetadata("returnObject.kt") - public void testReturnObject_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/returnObject.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("returnObject.kt") - public void testReturnObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/returnObject.kt", "kotlin.coroutines"); + public void testReturnObject() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/javaInterop/returnObject.kt"); } @TestMetadata("severalCaptures.kt") - public void testSeveralCaptures_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/severalCaptures.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("severalCaptures.kt") - public void testSeveralCaptures_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/severalCaptures.kt", "kotlin.coroutines"); + public void testSeveralCaptures() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/javaInterop/severalCaptures.kt"); } @TestMetadata("suspendInlineWithCrossinline.kt") - public void testSuspendInlineWithCrossinline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/suspendInlineWithCrossinline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendInlineWithCrossinline.kt") - public void testSuspendInlineWithCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/suspendInlineWithCrossinline.kt", "kotlin.coroutines"); + public void testSuspendInlineWithCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/javaInterop/suspendInlineWithCrossinline.kt"); } } @@ -9587,23 +8442,14 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes @RunWith(JUnit3RunnerWithInners.class) public static class Anonymous extends AbstractLightAnalysisModeTest { @TestMetadata("simple.kt") - public void ignoreSimple_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/anonymous/simple.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("simple.kt") - public void ignoreSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/anonymous/simple.kt", "kotlin.coroutines"); + public void ignoreSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/anonymous/simple.kt"); } private void runTest(String testDataFilePath) throws Exception { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInAnonymous() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/localFunctions/anonymous"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @@ -9617,72 +8463,38 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInNamed() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/localFunctions/named"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("capturedParameters.kt") - public void testCapturedParameters_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedParameters.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("capturedParameters.kt") - public void testCapturedParameters_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedParameters.kt", "kotlin.coroutines"); + public void testCapturedParameters() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedParameters.kt"); } @TestMetadata("capturedVariables.kt") - public void testCapturedVariables_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedVariables.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("capturedVariables.kt") - public void testCapturedVariables_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedVariables.kt", "kotlin.coroutines"); + public void testCapturedVariables() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedVariables.kt"); } @TestMetadata("extension.kt") - public void testExtension_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/extension.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("extension.kt") - public void testExtension_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/extension.kt", "kotlin.coroutines"); + public void testExtension() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/extension.kt"); } @TestMetadata("infix.kt") - public void testInfix_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/infix.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("infix.kt") - public void testInfix_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/infix.kt", "kotlin.coroutines"); + public void testInfix() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/infix.kt"); } @TestMetadata("insideLambda.kt") - public void testInsideLambda_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/insideLambda.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("insideLambda.kt") - public void testInsideLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/insideLambda.kt", "kotlin.coroutines"); + public void testInsideLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/insideLambda.kt"); } @TestMetadata("nestedLocals.kt") - public void testNestedLocals_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/nestedLocals.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("nestedLocals.kt") - public void testNestedLocals_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/nestedLocals.kt", "kotlin.coroutines"); + public void testNestedLocals() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/nestedLocals.kt"); } @TestMetadata("rec.kt") @@ -9690,44 +8502,24 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/rec.kt"); } - @TestMetadata("simpleSuspensionPoint.kt") - public void testSimpleSuspensionPoint_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/simpleSuspensionPoint.kt", "kotlin.coroutines.experimental"); + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/simple.kt"); } @TestMetadata("simpleSuspensionPoint.kt") - public void testSimpleSuspensionPoint_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/simpleSuspensionPoint.kt", "kotlin.coroutines"); - } - - @TestMetadata("simple.kt") - public void testSimple_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/simple.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/simple.kt", "kotlin.coroutines"); + public void testSimpleSuspensionPoint() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/simpleSuspensionPoint.kt"); } @TestMetadata("stateMachine.kt") - public void testStateMachine_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/stateMachine.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("stateMachine.kt") - public void testStateMachine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/stateMachine.kt", "kotlin.coroutines"); + public void testStateMachine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/stateMachine.kt"); } @TestMetadata("withArguments.kt") - public void testWithArguments_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/withArguments.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("withArguments.kt") - public void testWithArguments_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/withArguments.kt", "kotlin.coroutines"); + public void testWithArguments() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/withArguments.kt"); } } } @@ -9740,82 +8532,43 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInMultiModule() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("inlineCrossModule.kt") - public void testInlineCrossModule_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineCrossModule.kt") - public void testInlineCrossModule_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt", "kotlin.coroutines"); + public void testInlineCrossModule() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt"); } @TestMetadata("inlineFunctionWithOptionalParam.kt") - public void testInlineFunctionWithOptionalParam_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineFunctionWithOptionalParam.kt") - public void testInlineFunctionWithOptionalParam_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt", "kotlin.coroutines"); - } - - @TestMetadata("inlineMultiModuleOverride.kt") - public void testInlineMultiModuleOverride_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleOverride.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineMultiModuleOverride.kt") - public void testInlineMultiModuleOverride_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleOverride.kt", "kotlin.coroutines"); - } - - @TestMetadata("inlineMultiModuleWithController.kt") - public void testInlineMultiModuleWithController_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithController.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineMultiModuleWithController.kt") - public void testInlineMultiModuleWithController_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithController.kt", "kotlin.coroutines"); - } - - @TestMetadata("inlineMultiModuleWithInnerInlining.kt") - public void testInlineMultiModuleWithInnerInlining_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithInnerInlining.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineMultiModuleWithInnerInlining.kt") - public void testInlineMultiModuleWithInnerInlining_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithInnerInlining.kt", "kotlin.coroutines"); + public void testInlineFunctionWithOptionalParam() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt"); } @TestMetadata("inlineMultiModule.kt") - public void testInlineMultiModule_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModule.kt", "kotlin.coroutines.experimental"); + public void testInlineMultiModule() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModule.kt"); } - @TestMetadata("inlineMultiModule.kt") - public void testInlineMultiModule_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModule.kt", "kotlin.coroutines"); + @TestMetadata("inlineMultiModuleOverride.kt") + public void testInlineMultiModuleOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleOverride.kt"); + } + + @TestMetadata("inlineMultiModuleWithController.kt") + public void testInlineMultiModuleWithController() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithController.kt"); + } + + @TestMetadata("inlineMultiModuleWithInnerInlining.kt") + public void testInlineMultiModuleWithInnerInlining() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithInnerInlining.kt"); } @TestMetadata("inlineTailCall.kt") - public void testInlineTailCall_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineTailCall.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineTailCall.kt") - public void testInlineTailCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineTailCall.kt", "kotlin.coroutines"); + public void testInlineTailCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineTailCall.kt"); } @TestMetadata("inlineWithJava.kt") @@ -9824,13 +8577,8 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("simple.kt") - public void testSimple_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/simple.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/simple.kt"); } } @@ -9842,22 +8590,13 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInRedundantLocalsElimination() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/redundantLocalsElimination"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("ktor_receivedMessage.kt") - public void testKtor_receivedMessage_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/redundantLocalsElimination/ktor_receivedMessage.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("ktor_receivedMessage.kt") - public void testKtor_receivedMessage_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/redundantLocalsElimination/ktor_receivedMessage.kt", "kotlin.coroutines"); + public void testKtor_receivedMessage() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/redundantLocalsElimination/ktor_receivedMessage.kt"); } } @@ -9897,72 +8636,38 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInStackUnwinding() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/stackUnwinding"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("exception.kt") - public void testException_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/exception.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("exception.kt") - public void testException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/exception.kt", "kotlin.coroutines"); + public void testException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/exception.kt"); } @TestMetadata("inlineSuspendFunction.kt") - public void testInlineSuspendFunction_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineSuspendFunction.kt") - public void testInlineSuspendFunction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt", "kotlin.coroutines"); - } - - @TestMetadata("rethrowInFinallyWithSuspension.kt") - public void testRethrowInFinallyWithSuspension_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinallyWithSuspension.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("rethrowInFinallyWithSuspension.kt") - public void testRethrowInFinallyWithSuspension_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinallyWithSuspension.kt", "kotlin.coroutines"); + public void testInlineSuspendFunction() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt"); } @TestMetadata("rethrowInFinally.kt") - public void testRethrowInFinally_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinally.kt", "kotlin.coroutines.experimental"); + public void testRethrowInFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinally.kt"); } - @TestMetadata("rethrowInFinally.kt") - public void testRethrowInFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinally.kt", "kotlin.coroutines"); + @TestMetadata("rethrowInFinallyWithSuspension.kt") + public void testRethrowInFinallyWithSuspension() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinallyWithSuspension.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt"); } @TestMetadata("suspendInCycle.kt") - public void testSuspendInCycle_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendInCycle.kt") - public void testSuspendInCycle_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt", "kotlin.coroutines"); + public void testSuspendInCycle() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt"); } } @@ -10007,32 +8712,18 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInSuspendFunctionAsCoroutine() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("dispatchResume.kt") - public void testDispatchResume_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("dispatchResume.kt") - public void testDispatchResume_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt", "kotlin.coroutines"); + public void testDispatchResume() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt"); } @TestMetadata("handleException.kt") - public void testHandleException_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("handleException.kt") - public void testHandleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt", "kotlin.coroutines"); + public void testHandleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt"); } @TestMetadata("ifExpressionInsideCoroutine_1_3.kt") @@ -10040,44 +8731,24 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine_1_3.kt"); } - @TestMetadata("inlineTwoReceivers.kt") - public void testInlineTwoReceivers_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt", "kotlin.coroutines.experimental"); + @TestMetadata("inline.kt") + public void testInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt"); } @TestMetadata("inlineTwoReceivers.kt") - public void testInlineTwoReceivers_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt", "kotlin.coroutines"); - } - - @TestMetadata("inline.kt") - public void testInline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inline.kt") - public void testInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt", "kotlin.coroutines"); + public void testInlineTwoReceivers() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt"); } @TestMetadata("member.kt") - public void testMember_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("member.kt") - public void testMember_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt", "kotlin.coroutines"); + public void testMember() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt"); } @TestMetadata("noinlineTwoReceivers.kt") - public void testNoinlineTwoReceivers_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("noinlineTwoReceivers.kt") - public void testNoinlineTwoReceivers_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt", "kotlin.coroutines"); + public void testNoinlineTwoReceivers() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt"); } @TestMetadata("openFunWithJava.kt") @@ -10086,103 +8757,53 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("operators.kt") - public void testOperators_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("operators.kt") - public void testOperators_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt", "kotlin.coroutines"); + public void testOperators() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt"); } @TestMetadata("privateFunctions.kt") - public void testPrivateFunctions_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("privateFunctions.kt") - public void testPrivateFunctions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt", "kotlin.coroutines"); + public void testPrivateFunctions() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt"); } @TestMetadata("privateInFile.kt") - public void testPrivateInFile_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("privateInFile.kt") - public void testPrivateInFile_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt", "kotlin.coroutines"); + public void testPrivateInFile() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt"); } @TestMetadata("returnNoSuspend.kt") - public void testReturnNoSuspend_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("returnNoSuspend.kt") - public void testReturnNoSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt", "kotlin.coroutines"); + public void testReturnNoSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt", "kotlin.coroutines"); - } - - @TestMetadata("superCallAbstractClass.kt") - public void testSuperCallAbstractClass_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallAbstractClass.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("superCallAbstractClass.kt") - public void testSuperCallAbstractClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallAbstractClass.kt", "kotlin.coroutines"); - } - - @TestMetadata("superCallInterface.kt") - public void testSuperCallInterface_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallInterface.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("superCallInterface.kt") - public void testSuperCallInterface_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallInterface.kt", "kotlin.coroutines"); - } - - @TestMetadata("superCallOverload.kt") - public void testSuperCallOverload_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallOverload.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("superCallOverload.kt") - public void testSuperCallOverload_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallOverload.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt"); } @TestMetadata("superCall.kt") - public void testSuperCall_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt", "kotlin.coroutines.experimental"); + public void testSuperCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt"); } - @TestMetadata("superCall.kt") - public void testSuperCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt", "kotlin.coroutines"); + @TestMetadata("superCallAbstractClass.kt") + public void testSuperCallAbstractClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallAbstractClass.kt"); + } + + @TestMetadata("superCallInterface.kt") + public void testSuperCallInterface() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallInterface.kt"); + } + + @TestMetadata("superCallOverload.kt") + public void testSuperCallOverload() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallOverload.kt"); } @TestMetadata("withVariables.kt") - public void testWithVariables_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("withVariables.kt") - public void testWithVariables_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt", "kotlin.coroutines"); + public void testWithVariables() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt"); } } @@ -10194,62 +8815,33 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInSuspendFunctionTypeCall() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("localVal.kt") - public void testLocalVal_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("localVal.kt") - public void testLocalVal_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt", "kotlin.coroutines"); - } - - @TestMetadata("manyParametersNoCapture.kt") - public void testManyParametersNoCapture_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParametersNoCapture.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("manyParametersNoCapture.kt") - public void testManyParametersNoCapture_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParametersNoCapture.kt", "kotlin.coroutines"); + public void testLocalVal() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt"); } @TestMetadata("manyParameters.kt") - public void testManyParameters_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt", "kotlin.coroutines.experimental"); + public void testManyParameters() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt"); } - @TestMetadata("manyParameters.kt") - public void testManyParameters_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt", "kotlin.coroutines"); + @TestMetadata("manyParametersNoCapture.kt") + public void testManyParametersNoCapture() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParametersNoCapture.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt"); } @TestMetadata("suspendModifier.kt") - public void testSuspendModifier_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendModifier.kt") - public void testSuspendModifier_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt", "kotlin.coroutines"); + public void testSuspendModifier() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt"); } } @@ -10261,10 +8853,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInTailCallOptimizations() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/tailCallOptimizations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @@ -10275,13 +8863,8 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("crossinline.kt") - public void testCrossinline_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/crossinline.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("crossinline.kt") - public void testCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/crossinline.kt", "kotlin.coroutines"); + public void testCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/crossinline.kt"); } @TestMetadata("inlineWithStateMachine.kt") @@ -10290,23 +8873,13 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("inlineWithoutStateMachine.kt") - public void testInlineWithoutStateMachine_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("inlineWithoutStateMachine.kt") - public void testInlineWithoutStateMachine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt", "kotlin.coroutines"); + public void testInlineWithoutStateMachine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt"); } @TestMetadata("innerObjectRetransformation.kt") - public void testInnerObjectRetransformation_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("innerObjectRetransformation.kt") - public void testInnerObjectRetransformation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation.kt", "kotlin.coroutines"); + public void testInnerObjectRetransformation() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation.kt"); } @TestMetadata("interfaceDelegation.kt") @@ -10339,21 +8912,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/tailSuspendUnitFun.kt"); } + @TestMetadata("tryCatch.kt") + public void testTryCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/tryCatch.kt"); + } + @TestMetadata("tryCatchTailCall.kt") public void testTryCatchTailCall() throws Exception { runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/tryCatchTailCall.kt"); } - @TestMetadata("tryCatch.kt") - public void testTryCatch_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/tryCatch.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("tryCatch.kt") - public void testTryCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/tryCatch.kt", "kotlin.coroutines"); - } - @TestMetadata("unreachable.kt") public void testUnreachable() throws Exception { runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/unreachable.kt"); @@ -10441,52 +9009,28 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInTailOperations() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/tailOperations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("suspendWithIf.kt") - public void testSuspendWithIf_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithIf.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendWithIf.kt") - public void testSuspendWithIf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithIf.kt", "kotlin.coroutines"); + public void testSuspendWithIf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithIf.kt"); } @TestMetadata("suspendWithTryCatch.kt") - public void testSuspendWithTryCatch_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendWithTryCatch.kt") - public void testSuspendWithTryCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt", "kotlin.coroutines"); + public void testSuspendWithTryCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt"); } @TestMetadata("suspendWithWhen.kt") - public void testSuspendWithWhen_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithWhen.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendWithWhen.kt") - public void testSuspendWithWhen_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithWhen.kt", "kotlin.coroutines"); + public void testSuspendWithWhen() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithWhen.kt"); } @TestMetadata("tailInlining.kt") - public void testTailInlining_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/tailInlining.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("tailInlining.kt") - public void testTailInlining_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/tailInlining.kt", "kotlin.coroutines"); + public void testTailInlining() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/tailInlining.kt"); } } @@ -10498,32 +9042,18 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInUnitTypeReturn() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/unitTypeReturn"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("coroutineNonLocalReturn.kt") - public void testCoroutineNonLocalReturn_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("coroutineNonLocalReturn.kt") - public void testCoroutineNonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt", "kotlin.coroutines"); + public void testCoroutineNonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt"); } @TestMetadata("coroutineReturn.kt") - public void testCoroutineReturn_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("coroutineReturn.kt") - public void testCoroutineReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt", "kotlin.coroutines"); + public void testCoroutineReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt"); } @TestMetadata("inlineUnitFunction.kt") @@ -10537,33 +9067,18 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("suspendNonLocalReturn.kt") - public void testSuspendNonLocalReturn_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendNonLocalReturn.kt") - public void testSuspendNonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt", "kotlin.coroutines"); + public void testSuspendNonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt"); } @TestMetadata("suspendReturn.kt") - public void testSuspendReturn_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendReturn.kt") - public void testSuspendReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt", "kotlin.coroutines"); + public void testSuspendReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt"); } @TestMetadata("unitSafeCall.kt") - public void testUnitSafeCall_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/unitSafeCall.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("unitSafeCall.kt") - public void testUnitSafeCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/unitSafeCall.kt", "kotlin.coroutines"); + public void testUnitSafeCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/unitSafeCall.kt"); } } @@ -10575,10 +9090,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInVarSpilling() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/varSpilling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @@ -10589,33 +9100,18 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("kt19475.kt") - public void testKt19475_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/kt19475.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("kt19475.kt") - public void testKt19475_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/kt19475.kt", "kotlin.coroutines"); + public void testKt19475() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt19475.kt"); } @TestMetadata("kt38925.kt") - public void testKt38925_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/kt38925.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("kt38925.kt") - public void testKt38925_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/kt38925.kt", "kotlin.coroutines"); + public void testKt38925() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt38925.kt"); } @TestMetadata("nullSpilling.kt") - public void testNullSpilling_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/nullSpilling.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("nullSpilling.kt") - public void testNullSpilling_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/nullSpilling.kt", "kotlin.coroutines"); + public void testNullSpilling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/nullSpilling.kt"); } @TestMetadata("refinedIntTypesAnalysis.kt") @@ -22162,10 +20658,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); - } - public void testAllFilesPresentInParametersMetadata() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/parametersMetadata"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @@ -22216,13 +20708,8 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } @TestMetadata("suspendFunction.kt") - public void testSuspendFunction_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/parametersMetadata/suspendFunction.kt", "kotlin.coroutines.experimental"); - } - - @TestMetadata("suspendFunction.kt") - public void testSuspendFunction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/parametersMetadata/suspendFunction.kt", "kotlin.coroutines"); + public void testSuspendFunction() throws Exception { + runTest("compiler/testData/codegen/box/parametersMetadata/suspendFunction.kt"); } } diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 5ccaafe90ca..f0f0882d326 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -934,10 +934,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInJvm() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/assert/jvm"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @@ -1033,23 +1029,23 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("suspendFunctionAssertionDisabled.kt") - public void testSuspendFunctionAssertionDisabled_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionDisabled.kt", "kotlin.coroutines"); + public void testSuspendFunctionAssertionDisabled() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionDisabled.kt"); } @TestMetadata("suspendFunctionAssertionsEnabled.kt") - public void testSuspendFunctionAssertionsEnabled_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionsEnabled.kt", "kotlin.coroutines"); + public void testSuspendFunctionAssertionsEnabled() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionsEnabled.kt"); } @TestMetadata("suspendLambdaAssertionsDisabled.kt") - public void testSuspendLambdaAssertionsDisabled_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsDisabled.kt", "kotlin.coroutines"); + public void testSuspendLambdaAssertionsDisabled() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsDisabled.kt"); } @TestMetadata("suspendLambdaAssertionsEnabled.kt") - public void testSuspendLambdaAssertionsEnabled_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsEnabled.kt", "kotlin.coroutines"); + public void testSuspendLambdaAssertionsEnabled() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsEnabled.kt"); } } } @@ -4845,10 +4841,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInCapturedVarsOptimization() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/closures/capturedVarsOptimization"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @@ -4898,14 +4890,14 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/closures/capturedVarsOptimization/sharedSlotsWithCapturedVars.kt"); } - @TestMetadata("withCoroutinesNoStdLib.kt") - public void testWithCoroutinesNoStdLib_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutinesNoStdLib.kt", "kotlin.coroutines"); + @TestMetadata("withCoroutines.kt") + public void testWithCoroutines() throws Exception { + runTest("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt"); } - @TestMetadata("withCoroutines.kt") - public void testWithCoroutines_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt", "kotlin.coroutines"); + @TestMetadata("withCoroutinesNoStdLib.kt") + public void testWithCoroutinesNoStdLib() throws Exception { + runTest("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutinesNoStdLib.kt"); } } @@ -5351,10 +5343,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInContracts() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/contracts"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @@ -5400,8 +5388,8 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("kt39374.kt") - public void testKt39374_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/contracts/kt39374.kt", "kotlin.coroutines"); + public void testKt39374() throws Exception { + runTest("compiler/testData/codegen/box/contracts/kt39374.kt"); } @TestMetadata("lambdaParameter.kt") @@ -6535,27 +6523,28 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - @TestMetadata("32defaultParametersInSuspend.kt") - public void test32defaultParametersInSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/32defaultParametersInSuspend.kt", "kotlin.coroutines"); + public void test32defaultParametersInSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/32defaultParametersInSuspend.kt"); } @TestMetadata("accessorForSuspend.kt") - public void testAccessorForSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/accessorForSuspend.kt", "kotlin.coroutines"); + public void testAccessorForSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/accessorForSuspend.kt"); } public void testAllFilesPresentInCoroutines() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @TestMetadata("async.kt") + public void testAsync() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/async.kt"); + } + @TestMetadata("asyncException.kt") - public void testAsyncException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/asyncException.kt", "kotlin.coroutines"); + public void testAsyncException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/asyncException.kt"); } @TestMetadata("asyncIteratorNullMerge_1_3.kt") @@ -6573,24 +6562,19 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/coroutines/asyncIterator_1_3.kt"); } - @TestMetadata("async.kt") - public void testAsync_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/async.kt", "kotlin.coroutines"); - } - @TestMetadata("await.kt") - public void testAwait_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/await.kt", "kotlin.coroutines"); - } - - @TestMetadata("beginWithExceptionNoHandleException.kt") - public void testBeginWithExceptionNoHandleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/beginWithExceptionNoHandleException.kt", "kotlin.coroutines"); + public void testAwait() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/await.kt"); } @TestMetadata("beginWithException.kt") - public void testBeginWithException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/beginWithException.kt", "kotlin.coroutines"); + public void testBeginWithException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/beginWithException.kt"); + } + + @TestMetadata("beginWithExceptionNoHandleException.kt") + public void testBeginWithExceptionNoHandleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/beginWithExceptionNoHandleException.kt"); } @TestMetadata("builderInferenceAndGenericArrayAcessCall.kt") @@ -6614,28 +6598,28 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("capturedVarInSuspendLambda.kt") - public void testCapturedVarInSuspendLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt", "kotlin.coroutines"); + public void testCapturedVarInSuspendLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt"); } @TestMetadata("catchWithInlineInsideSuspend.kt") - public void testCatchWithInlineInsideSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/catchWithInlineInsideSuspend.kt", "kotlin.coroutines"); + public void testCatchWithInlineInsideSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/catchWithInlineInsideSuspend.kt"); } @TestMetadata("coercionToUnit.kt") - public void testCoercionToUnit_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/coercionToUnit.kt", "kotlin.coroutines"); + public void testCoercionToUnit() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/coercionToUnit.kt"); } @TestMetadata("controllerAccessFromInnerLambda.kt") - public void testControllerAccessFromInnerLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controllerAccessFromInnerLambda.kt", "kotlin.coroutines"); + public void testControllerAccessFromInnerLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controllerAccessFromInnerLambda.kt"); } @TestMetadata("coroutineContextInInlinedLambda.kt") - public void testCoroutineContextInInlinedLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/coroutineContextInInlinedLambda.kt", "kotlin.coroutines"); + public void testCoroutineContextInInlinedLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/coroutineContextInInlinedLambda.kt"); } @TestMetadata("coroutineToString.kt") @@ -6644,18 +6628,23 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("createCoroutineSafe.kt") - public void testCreateCoroutineSafe_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/createCoroutineSafe.kt", "kotlin.coroutines"); + public void testCreateCoroutineSafe() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/createCoroutineSafe.kt"); } @TestMetadata("createCoroutinesOnManualInstances.kt") - public void testCreateCoroutinesOnManualInstances_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/createCoroutinesOnManualInstances.kt", "kotlin.coroutines"); + public void testCreateCoroutinesOnManualInstances() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/createCoroutinesOnManualInstances.kt"); } @TestMetadata("crossInlineWithCapturedOuterReceiver.kt") - public void testCrossInlineWithCapturedOuterReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/crossInlineWithCapturedOuterReceiver.kt", "kotlin.coroutines"); + public void testCrossInlineWithCapturedOuterReceiver() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/crossInlineWithCapturedOuterReceiver.kt"); + } + + @TestMetadata("defaultParametersInSuspend.kt") + public void testDefaultParametersInSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/defaultParametersInSuspend.kt"); } @TestMetadata("defaultParametersInSuspendWithJvmOverloads.kt") @@ -6663,19 +6652,14 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/coroutines/defaultParametersInSuspendWithJvmOverloads.kt"); } - @TestMetadata("defaultParametersInSuspend.kt") - public void testDefaultParametersInSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/defaultParametersInSuspend.kt", "kotlin.coroutines"); - } - @TestMetadata("delegatedSuspendMember.kt") - public void testDelegatedSuspendMember_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt", "kotlin.coroutines"); + public void testDelegatedSuspendMember() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt"); } @TestMetadata("dispatchResume.kt") - public void testDispatchResume_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/dispatchResume.kt", "kotlin.coroutines"); + public void testDispatchResume() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/dispatchResume.kt"); } @TestMetadata("doubleColonExpressionsGenerationInBuilderInference.kt") @@ -6684,8 +6668,8 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("emptyClosure.kt") - public void testEmptyClosure_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/emptyClosure.kt", "kotlin.coroutines"); + public void testEmptyClosure() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/emptyClosure.kt"); } @TestMetadata("emptyCommonConstraintSystemForCoroutineInferenceCall.kt") @@ -6694,38 +6678,38 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("epam.kt") - public void testEpam_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/epam.kt", "kotlin.coroutines"); + public void testEpam() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/epam.kt"); } @TestMetadata("falseUnitCoercion.kt") - public void testFalseUnitCoercion_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/falseUnitCoercion.kt", "kotlin.coroutines"); + public void testFalseUnitCoercion() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/falseUnitCoercion.kt"); } @TestMetadata("generate.kt") - public void testGenerate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/generate.kt", "kotlin.coroutines"); + public void testGenerate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/generate.kt"); } @TestMetadata("handleException.kt") - public void testHandleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleException.kt", "kotlin.coroutines"); + public void testHandleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleException.kt"); } @TestMetadata("handleResultCallEmptyBody.kt") - public void testHandleResultCallEmptyBody_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultCallEmptyBody.kt", "kotlin.coroutines"); + public void testHandleResultCallEmptyBody() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleResultCallEmptyBody.kt"); } @TestMetadata("handleResultNonUnitExpression.kt") - public void testHandleResultNonUnitExpression_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultNonUnitExpression.kt", "kotlin.coroutines"); + public void testHandleResultNonUnitExpression() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleResultNonUnitExpression.kt"); } @TestMetadata("handleResultSuspended.kt") - public void testHandleResultSuspended_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultSuspended.kt", "kotlin.coroutines"); + public void testHandleResultSuspended() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleResultSuspended.kt"); } @TestMetadata("illegalState.kt") @@ -6734,93 +6718,93 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("indirectInlineUsedAsNonInline.kt") - public void testIndirectInlineUsedAsNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/indirectInlineUsedAsNonInline.kt", "kotlin.coroutines"); + public void testIndirectInlineUsedAsNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/indirectInlineUsedAsNonInline.kt"); } @TestMetadata("inlineFunInGenericClass.kt") - public void testInlineFunInGenericClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineFunInGenericClass.kt", "kotlin.coroutines"); - } - - @TestMetadata("inlineFunctionInMultifileClassUnoptimized.kt") - public void testInlineFunctionInMultifileClassUnoptimized_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClassUnoptimized.kt", "kotlin.coroutines"); + public void testInlineFunInGenericClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineFunInGenericClass.kt"); } @TestMetadata("inlineFunctionInMultifileClass.kt") - public void testInlineFunctionInMultifileClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClass.kt", "kotlin.coroutines"); + public void testInlineFunctionInMultifileClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClass.kt"); + } + + @TestMetadata("inlineFunctionInMultifileClassUnoptimized.kt") + public void testInlineFunctionInMultifileClassUnoptimized() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClassUnoptimized.kt"); } @TestMetadata("inlineGenericFunCalledFromSubclass.kt") - public void testInlineGenericFunCalledFromSubclass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineGenericFunCalledFromSubclass.kt", "kotlin.coroutines"); + public void testInlineGenericFunCalledFromSubclass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineGenericFunCalledFromSubclass.kt"); } @TestMetadata("inlineSuspendFunction.kt") - public void testInlineSuspendFunction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineSuspendFunction.kt", "kotlin.coroutines"); + public void testInlineSuspendFunction() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineSuspendFunction.kt"); } @TestMetadata("inlineSuspendLambdaNonLocalReturn.kt") - public void testInlineSuspendLambdaNonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineSuspendLambdaNonLocalReturn.kt", "kotlin.coroutines"); + public void testInlineSuspendLambdaNonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineSuspendLambdaNonLocalReturn.kt"); } @TestMetadata("inlinedTryCatchFinally.kt") - public void testInlinedTryCatchFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlinedTryCatchFinally.kt", "kotlin.coroutines"); + public void testInlinedTryCatchFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlinedTryCatchFinally.kt"); } @TestMetadata("innerSuspensionCalls.kt") - public void testInnerSuspensionCalls_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/innerSuspensionCalls.kt", "kotlin.coroutines"); + public void testInnerSuspensionCalls() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/innerSuspensionCalls.kt"); } @TestMetadata("instanceOfContinuation.kt") - public void testInstanceOfContinuation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/instanceOfContinuation.kt", "kotlin.coroutines"); + public void testInstanceOfContinuation() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/instanceOfContinuation.kt"); } @TestMetadata("iterateOverArray.kt") - public void testIterateOverArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/iterateOverArray.kt", "kotlin.coroutines"); + public void testIterateOverArray() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/iterateOverArray.kt"); } @TestMetadata("kt12958.kt") - public void testKt12958_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt12958.kt", "kotlin.coroutines"); + public void testKt12958() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt12958.kt"); } @TestMetadata("kt15016.kt") - public void testKt15016_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15016.kt", "kotlin.coroutines"); + public void testKt15016() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt15016.kt"); } @TestMetadata("kt15017.kt") - public void testKt15017_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15017.kt", "kotlin.coroutines"); + public void testKt15017() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt15017.kt"); } @TestMetadata("kt15930.kt") - public void testKt15930_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15930.kt", "kotlin.coroutines"); + public void testKt15930() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt15930.kt"); } @TestMetadata("kt21605.kt") - public void testKt21605_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt21605.kt", "kotlin.coroutines"); + public void testKt21605() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt21605.kt"); } @TestMetadata("kt25912.kt") - public void testKt25912_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt25912.kt", "kotlin.coroutines"); + public void testKt25912() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt25912.kt"); } @TestMetadata("kt28844.kt") - public void testKt28844_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt28844.kt", "kotlin.coroutines"); + public void testKt28844() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt28844.kt"); } @TestMetadata("kt30858.kt") @@ -6849,23 +6833,23 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("lastExpressionIsLoop.kt") - public void testLastExpressionIsLoop_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt", "kotlin.coroutines"); + public void testLastExpressionIsLoop() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt"); } @TestMetadata("lastStatementInc.kt") - public void testLastStatementInc_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastStatementInc.kt", "kotlin.coroutines"); + public void testLastStatementInc() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastStatementInc.kt"); } @TestMetadata("lastStementAssignment.kt") - public void testLastStementAssignment_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastStementAssignment.kt", "kotlin.coroutines"); + public void testLastStementAssignment() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastStementAssignment.kt"); } @TestMetadata("lastUnitExpression.kt") - public void testLastUnitExpression_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastUnitExpression.kt", "kotlin.coroutines"); + public void testLastUnitExpression() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastUnitExpression.kt"); } @TestMetadata("localCallableRef.kt") @@ -6874,53 +6858,53 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("localDelegate.kt") - public void testLocalDelegate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localDelegate.kt", "kotlin.coroutines"); + public void testLocalDelegate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localDelegate.kt"); } @TestMetadata("longRangeInSuspendCall.kt") - public void testLongRangeInSuspendCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/longRangeInSuspendCall.kt", "kotlin.coroutines"); + public void testLongRangeInSuspendCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/longRangeInSuspendCall.kt"); } @TestMetadata("longRangeInSuspendFun.kt") - public void testLongRangeInSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/longRangeInSuspendFun.kt", "kotlin.coroutines"); + public void testLongRangeInSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/longRangeInSuspendFun.kt"); } @TestMetadata("mergeNullAndString.kt") - public void testMergeNullAndString_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/mergeNullAndString.kt", "kotlin.coroutines"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda1.kt") - public void testMultipleInvokeCallsInsideInlineLambda1_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt", "kotlin.coroutines"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda2.kt") - public void testMultipleInvokeCallsInsideInlineLambda2_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt", "kotlin.coroutines"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda3.kt") - public void testMultipleInvokeCallsInsideInlineLambda3_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt", "kotlin.coroutines"); + public void testMergeNullAndString() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/mergeNullAndString.kt"); } @TestMetadata("multipleInvokeCalls.kt") - public void testMultipleInvokeCalls_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt", "kotlin.coroutines"); + public void testMultipleInvokeCalls() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt"); + } + + @TestMetadata("multipleInvokeCallsInsideInlineLambda1.kt") + public void testMultipleInvokeCallsInsideInlineLambda1() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt"); + } + + @TestMetadata("multipleInvokeCallsInsideInlineLambda2.kt") + public void testMultipleInvokeCallsInsideInlineLambda2() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt"); + } + + @TestMetadata("multipleInvokeCallsInsideInlineLambda3.kt") + public void testMultipleInvokeCallsInsideInlineLambda3() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt"); } @TestMetadata("nestedTryCatch.kt") - public void testNestedTryCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nestedTryCatch.kt", "kotlin.coroutines"); + public void testNestedTryCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/nestedTryCatch.kt"); } @TestMetadata("noSuspensionPoints.kt") - public void testNoSuspensionPoints_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noSuspensionPoints.kt", "kotlin.coroutines"); + public void testNoSuspensionPoints() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/noSuspensionPoints.kt"); } @TestMetadata("nonLocalReturn.kt") @@ -6928,24 +6912,24 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/coroutines/nonLocalReturn.kt"); } - @TestMetadata("nonLocalReturnFromInlineLambdaDeep.kt") - public void testNonLocalReturnFromInlineLambdaDeep_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt", "kotlin.coroutines"); + @TestMetadata("nonLocalReturnFromInlineLambda.kt") + public void testNonLocalReturnFromInlineLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt"); } - @TestMetadata("nonLocalReturnFromInlineLambda.kt") - public void testNonLocalReturnFromInlineLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt", "kotlin.coroutines"); + @TestMetadata("nonLocalReturnFromInlineLambdaDeep.kt") + public void testNonLocalReturnFromInlineLambdaDeep() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt"); } @TestMetadata("overrideDefaultArgument.kt") - public void testOverrideDefaultArgument_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/overrideDefaultArgument.kt", "kotlin.coroutines"); + public void testOverrideDefaultArgument() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/overrideDefaultArgument.kt"); } @TestMetadata("recursiveSuspend.kt") - public void testRecursiveSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/recursiveSuspend.kt", "kotlin.coroutines"); + public void testRecursiveSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/recursiveSuspend.kt"); } @TestMetadata("restrictedSuspendLambda.kt") @@ -6954,13 +6938,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("returnByLabel.kt") - public void testReturnByLabel_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/returnByLabel.kt", "kotlin.coroutines"); + public void testReturnByLabel() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/returnByLabel.kt"); + } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/simple.kt"); } @TestMetadata("simpleException.kt") - public void testSimpleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simpleException.kt", "kotlin.coroutines"); + public void testSimpleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/simpleException.kt"); } @TestMetadata("simpleSuspendCallableReference.kt") @@ -6969,18 +6958,13 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("simpleWithHandleResult.kt") - public void testSimpleWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simpleWithHandleResult.kt", "kotlin.coroutines"); - } - - @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simple.kt", "kotlin.coroutines"); + public void testSimpleWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/simpleWithHandleResult.kt"); } @TestMetadata("statementLikeLastExpression.kt") - public void testStatementLikeLastExpression_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/statementLikeLastExpression.kt", "kotlin.coroutines"); + public void testStatementLikeLastExpression() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/statementLikeLastExpression.kt"); } @TestMetadata("stopAfter.kt") @@ -6989,13 +6973,13 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("suspendCallsInArguments.kt") - public void testSuspendCallsInArguments_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendCallsInArguments.kt", "kotlin.coroutines"); + public void testSuspendCallsInArguments() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendCallsInArguments.kt"); } @TestMetadata("suspendCoroutineFromStateMachine.kt") - public void testSuspendCoroutineFromStateMachine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt", "kotlin.coroutines"); + public void testSuspendCoroutineFromStateMachine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt"); } @TestMetadata("suspendCovariantJavaOverrides.kt") @@ -7004,23 +6988,23 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("suspendDefaultImpl.kt") - public void testSuspendDefaultImpl_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendDefaultImpl.kt", "kotlin.coroutines"); + public void testSuspendDefaultImpl() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendDefaultImpl.kt"); } @TestMetadata("suspendDelegation.kt") - public void testSuspendDelegation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendDelegation.kt", "kotlin.coroutines"); + public void testSuspendDelegation() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendDelegation.kt"); } @TestMetadata("suspendFromInlineLambda.kt") - public void testSuspendFromInlineLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt", "kotlin.coroutines"); + public void testSuspendFromInlineLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt"); } @TestMetadata("suspendFunImportedFromObject.kt") - public void testSuspendFunImportedFromObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunImportedFromObject.kt", "kotlin.coroutines"); + public void testSuspendFunImportedFromObject() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunImportedFromObject.kt"); } @TestMetadata("suspendFunctionMethodReference.kt") @@ -7034,23 +7018,23 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("suspendInCycle.kt") - public void testSuspendInCycle_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInCycle.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt") - public void testSuspendInTheMiddleOfObjectConstructionEvaluationOrder_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendInTheMiddleOfObjectConstructionWithJumpOut.kt") - public void testSuspendInTheMiddleOfObjectConstructionWithJumpOut_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionWithJumpOut.kt", "kotlin.coroutines"); + public void testSuspendInCycle() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInCycle.kt"); } @TestMetadata("suspendInTheMiddleOfObjectConstruction.kt") - public void testSuspendInTheMiddleOfObjectConstruction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt", "kotlin.coroutines"); + public void testSuspendInTheMiddleOfObjectConstruction() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt"); + } + + @TestMetadata("suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt") + public void testSuspendInTheMiddleOfObjectConstructionEvaluationOrder() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt"); + } + + @TestMetadata("suspendInTheMiddleOfObjectConstructionWithJumpOut.kt") + public void testSuspendInTheMiddleOfObjectConstructionWithJumpOut() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionWithJumpOut.kt"); } @TestMetadata("suspendJavaOverrides.kt") @@ -7064,8 +7048,8 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("suspendLambdaWithArgumentRearrangement.kt") - public void testSuspendLambdaWithArgumentRearrangement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendLambdaWithArgumentRearrangement.kt", "kotlin.coroutines"); + public void testSuspendLambdaWithArgumentRearrangement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendLambdaWithArgumentRearrangement.kt"); } @TestMetadata("suspendReturningPlatformType.kt") @@ -7073,14 +7057,14 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/coroutines/suspendReturningPlatformType.kt"); } - @TestMetadata("suspensionInsideSafeCallWithElvis.kt") - public void testSuspensionInsideSafeCallWithElvis_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt", "kotlin.coroutines"); + @TestMetadata("suspensionInsideSafeCall.kt") + public void testSuspensionInsideSafeCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCall.kt"); } - @TestMetadata("suspensionInsideSafeCall.kt") - public void testSuspensionInsideSafeCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCall.kt", "kotlin.coroutines"); + @TestMetadata("suspensionInsideSafeCallWithElvis.kt") + public void testSuspensionInsideSafeCallWithElvis() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt"); } @TestMetadata("tailCallToNothing.kt") @@ -7089,38 +7073,38 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("tryCatchFinallyWithHandleResult.kt") - public void testTryCatchFinallyWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt", "kotlin.coroutines"); + public void testTryCatchFinallyWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt"); } @TestMetadata("tryCatchWithHandleResult.kt") - public void testTryCatchWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryCatchWithHandleResult.kt", "kotlin.coroutines"); + public void testTryCatchWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryCatchWithHandleResult.kt"); } @TestMetadata("tryFinallyInsideInlineLambda.kt") - public void testTryFinallyInsideInlineLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt", "kotlin.coroutines"); + public void testTryFinallyInsideInlineLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt"); } @TestMetadata("tryFinallyWithHandleResult.kt") - public void testTryFinallyWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryFinallyWithHandleResult.kt", "kotlin.coroutines"); + public void testTryFinallyWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryFinallyWithHandleResult.kt"); } @TestMetadata("varCaptuedInCoroutineIntrinsic.kt") - public void testVarCaptuedInCoroutineIntrinsic_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varCaptuedInCoroutineIntrinsic.kt", "kotlin.coroutines"); - } - - @TestMetadata("varValueConflictsWithTableSameSort.kt") - public void testVarValueConflictsWithTableSameSort_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt", "kotlin.coroutines"); + public void testVarCaptuedInCoroutineIntrinsic() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varCaptuedInCoroutineIntrinsic.kt"); } @TestMetadata("varValueConflictsWithTable.kt") - public void testVarValueConflictsWithTable_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varValueConflictsWithTable.kt", "kotlin.coroutines"); + public void testVarValueConflictsWithTable() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varValueConflictsWithTable.kt"); + } + + @TestMetadata("varValueConflictsWithTableSameSort.kt") + public void testVarValueConflictsWithTableSameSort() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt"); } @TestMetadata("compiler/testData/codegen/box/coroutines/bridges") @@ -7131,27 +7115,23 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInBridges() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/bridges"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("interfaceSpecialization.kt") - public void testInterfaceSpecialization_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/interfaceSpecialization.kt", "kotlin.coroutines"); + public void testInterfaceSpecialization() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/bridges/interfaceSpecialization.kt"); } @TestMetadata("lambdaWithLongReceiver.kt") - public void testLambdaWithLongReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/lambdaWithLongReceiver.kt", "kotlin.coroutines"); + public void testLambdaWithLongReceiver() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithLongReceiver.kt"); } @TestMetadata("lambdaWithMultipleParameters.kt") - public void testLambdaWithMultipleParameters_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt", "kotlin.coroutines"); + public void testLambdaWithMultipleParameters() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt"); } } @@ -7163,62 +7143,58 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInControlFlow() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/controlFlow"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("breakFinally.kt") - public void testBreakFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/breakFinally.kt", "kotlin.coroutines"); + public void testBreakFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/breakFinally.kt"); } @TestMetadata("breakStatement.kt") - public void testBreakStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/breakStatement.kt", "kotlin.coroutines"); + public void testBreakStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/breakStatement.kt"); } @TestMetadata("complexChainSuspend.kt") - public void testComplexChainSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/complexChainSuspend.kt", "kotlin.coroutines"); + public void testComplexChainSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/complexChainSuspend.kt"); } @TestMetadata("doWhileStatement.kt") - public void testDoWhileStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/doWhileStatement.kt", "kotlin.coroutines"); + public void testDoWhileStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/doWhileStatement.kt"); } @TestMetadata("doubleBreak.kt") - public void testDoubleBreak_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/doubleBreak.kt", "kotlin.coroutines"); + public void testDoubleBreak() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/doubleBreak.kt"); } @TestMetadata("finallyCatch.kt") - public void testFinallyCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/finallyCatch.kt", "kotlin.coroutines"); + public void testFinallyCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/finallyCatch.kt"); } @TestMetadata("forContinue.kt") - public void testForContinue_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forContinue.kt", "kotlin.coroutines"); + public void testForContinue() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/forContinue.kt"); } @TestMetadata("forStatement.kt") - public void testForStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forStatement.kt", "kotlin.coroutines"); + public void testForStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/forStatement.kt"); } @TestMetadata("forWithStep.kt") - public void testForWithStep_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forWithStep.kt", "kotlin.coroutines"); + public void testForWithStep() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/forWithStep.kt"); } @TestMetadata("ifStatement.kt") - public void testIfStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt", "kotlin.coroutines"); + public void testIfStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt"); } @TestMetadata("kt22694_1_3.kt") @@ -7227,58 +7203,58 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("labeledWhile.kt") - public void testLabeledWhile_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/labeledWhile.kt", "kotlin.coroutines"); + public void testLabeledWhile() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/labeledWhile.kt"); } @TestMetadata("multipleCatchBlocksSuspend.kt") - public void testMultipleCatchBlocksSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/multipleCatchBlocksSuspend.kt", "kotlin.coroutines"); + public void testMultipleCatchBlocksSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/multipleCatchBlocksSuspend.kt"); } @TestMetadata("returnFromFinally.kt") - public void testReturnFromFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/returnFromFinally.kt", "kotlin.coroutines"); + public void testReturnFromFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/returnFromFinally.kt"); } @TestMetadata("returnWithFinally.kt") - public void testReturnWithFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/returnWithFinally.kt", "kotlin.coroutines"); + public void testReturnWithFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/returnWithFinally.kt"); } @TestMetadata("suspendInStringTemplate.kt") - public void testSuspendInStringTemplate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/suspendInStringTemplate.kt", "kotlin.coroutines"); + public void testSuspendInStringTemplate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/suspendInStringTemplate.kt"); } @TestMetadata("switchLikeWhen.kt") - public void testSwitchLikeWhen_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/switchLikeWhen.kt", "kotlin.coroutines"); + public void testSwitchLikeWhen() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/switchLikeWhen.kt"); } @TestMetadata("throwFromCatch.kt") - public void testThrowFromCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwFromCatch.kt", "kotlin.coroutines"); + public void testThrowFromCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/throwFromCatch.kt"); } @TestMetadata("throwFromFinally.kt") - public void testThrowFromFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwFromFinally.kt", "kotlin.coroutines"); + public void testThrowFromFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/throwFromFinally.kt"); } @TestMetadata("throwInTryWithHandleResult.kt") - public void testThrowInTryWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt", "kotlin.coroutines"); + public void testThrowInTryWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt"); } @TestMetadata("whenWithSuspensions.kt") - public void testWhenWithSuspensions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/whenWithSuspensions.kt", "kotlin.coroutines"); + public void testWhenWithSuspensions() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/whenWithSuspensions.kt"); } @TestMetadata("whileStatement.kt") - public void testWhileStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/whileStatement.kt", "kotlin.coroutines"); + public void testWhileStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/whileStatement.kt"); } } @@ -7343,17 +7319,13 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInFeatureIntersection() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/featureIntersection"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("breakWithNonEmptyStack.kt") - public void testBreakWithNonEmptyStack_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt", "kotlin.coroutines"); + public void testBreakWithNonEmptyStack() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt"); } @TestMetadata("defaultExpect.kt") @@ -7362,13 +7334,13 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("delegate.kt") - public void testDelegate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt", "kotlin.coroutines"); + public void testDelegate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt"); } @TestMetadata("destructuringInLambdas.kt") - public void testDestructuringInLambdas_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt", "kotlin.coroutines"); + public void testDestructuringInLambdas() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt"); } @TestMetadata("funInterface.kt") @@ -7377,8 +7349,8 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("inlineSuspendFinally.kt") - public void testInlineSuspendFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/inlineSuspendFinally.kt", "kotlin.coroutines"); + public void testInlineSuspendFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/inlineSuspendFinally.kt"); } @TestMetadata("interfaceMethodWithBody.kt") @@ -7396,19 +7368,19 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/coroutines/featureIntersection/overrideInInlineClass.kt"); } - @TestMetadata("safeCallOnTwoReceiversLong.kt") - public void testSafeCallOnTwoReceiversLong_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt", "kotlin.coroutines"); + @TestMetadata("safeCallOnTwoReceivers.kt") + public void testSafeCallOnTwoReceivers() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt"); } - @TestMetadata("safeCallOnTwoReceivers.kt") - public void testSafeCallOnTwoReceivers_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt", "kotlin.coroutines"); + @TestMetadata("safeCallOnTwoReceiversLong.kt") + public void testSafeCallOnTwoReceiversLong() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt"); } @TestMetadata("suspendDestructuringInLambdas.kt") - public void testSuspendDestructuringInLambdas_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt", "kotlin.coroutines"); + public void testSuspendDestructuringInLambdas() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt"); } @TestMetadata("suspendFunctionIsAs.kt") @@ -7417,23 +7389,23 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("suspendInlineSuspendFinally.kt") - public void testSuspendInlineSuspendFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendInlineSuspendFinally.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendOperatorPlusAssign.kt") - public void testSuspendOperatorPlusAssign_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusAssign.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendOperatorPlusCallFromLambda.kt") - public void testSuspendOperatorPlusCallFromLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusCallFromLambda.kt", "kotlin.coroutines"); + public void testSuspendInlineSuspendFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendInlineSuspendFinally.kt"); } @TestMetadata("suspendOperatorPlus.kt") - public void testSuspendOperatorPlus_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlus.kt", "kotlin.coroutines"); + public void testSuspendOperatorPlus() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlus.kt"); + } + + @TestMetadata("suspendOperatorPlusAssign.kt") + public void testSuspendOperatorPlusAssign() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusAssign.kt"); + } + + @TestMetadata("suspendOperatorPlusCallFromLambda.kt") + public void testSuspendOperatorPlusCallFromLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusCallFromLambda.kt"); } @TestMetadata("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference") @@ -7444,17 +7416,13 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInCallableReference() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("bigArity.kt") - public void testBigArity_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/bigArity.kt", "kotlin.coroutines"); + public void testBigArity() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/bigArity.kt"); } @TestMetadata("fromJava.kt") @@ -7540,77 +7508,73 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInTailrec() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("controlFlowIf.kt") - public void testControlFlowIf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowIf.kt", "kotlin.coroutines"); + public void testControlFlowIf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowIf.kt"); } @TestMetadata("controlFlowWhen.kt") - public void testControlFlowWhen_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowWhen.kt", "kotlin.coroutines"); + public void testControlFlowWhen() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowWhen.kt"); } @TestMetadata("extention.kt") - public void testExtention_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/extention.kt", "kotlin.coroutines"); + public void testExtention() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/extention.kt"); } @TestMetadata("infixCall.kt") - public void testInfixCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixCall.kt", "kotlin.coroutines"); + public void testInfixCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixCall.kt"); } @TestMetadata("infixRecursiveCall.kt") - public void testInfixRecursiveCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixRecursiveCall.kt", "kotlin.coroutines"); + public void testInfixRecursiveCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixRecursiveCall.kt"); } @TestMetadata("realIteratorFoldl.kt") - public void testRealIteratorFoldl_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realIteratorFoldl.kt", "kotlin.coroutines"); + public void testRealIteratorFoldl() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realIteratorFoldl.kt"); } @TestMetadata("realStringEscape.kt") - public void testRealStringEscape_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringEscape.kt", "kotlin.coroutines"); + public void testRealStringEscape() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringEscape.kt"); } @TestMetadata("realStringRepeat.kt") - public void testRealStringRepeat_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringRepeat.kt", "kotlin.coroutines"); + public void testRealStringRepeat() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringRepeat.kt"); } @TestMetadata("returnInParentheses.kt") - public void testReturnInParentheses_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/returnInParentheses.kt", "kotlin.coroutines"); + public void testReturnInParentheses() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/returnInParentheses.kt"); } @TestMetadata("sum.kt") - public void testSum_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/sum.kt", "kotlin.coroutines"); + public void testSum() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/sum.kt"); } @TestMetadata("tailCallInBlockInParentheses.kt") - public void testTailCallInBlockInParentheses_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInBlockInParentheses.kt", "kotlin.coroutines"); + public void testTailCallInBlockInParentheses() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInBlockInParentheses.kt"); } @TestMetadata("tailCallInParentheses.kt") - public void testTailCallInParentheses_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInParentheses.kt", "kotlin.coroutines"); + public void testTailCallInParentheses() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInParentheses.kt"); } @TestMetadata("whenWithIs.kt") - public void testWhenWithIs_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/whenWithIs.kt", "kotlin.coroutines"); + public void testWhenWithIs() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/whenWithIs.kt"); } } } @@ -7640,10 +7604,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInDirect() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses/direct"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @@ -7659,58 +7619,58 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Any.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineInt() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineInt.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Int.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Long() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Long.kt"); } @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_NAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_NAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_nonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_nonLocalReturn.kt"); } @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_suspendFunType() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_suspendFunType.kt"); } @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationCrossinline.kt", "kotlin.coroutines"); + public void testBridgeGenerationCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationCrossinline.kt"); } @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationNonInline.kt", "kotlin.coroutines"); + public void testBridgeGenerationNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationNonInline.kt"); } @TestMetadata("covariantOverrideSuspendFun.kt") @@ -7824,8 +7784,8 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); + public void testInterfaceDelegateWithInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt"); } @TestMetadata("invokeOperator.kt") @@ -7834,28 +7794,28 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt"); } @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any.kt"); } @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_itf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_itf.kt"); } @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_this.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_this() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_this.kt"); } @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Int.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Int.kt"); } @TestMetadata("returnResult.kt") @@ -7872,10 +7832,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInResume() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses/resume"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @@ -7891,58 +7847,58 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Any.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineInt() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineInt.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Int.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Long() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Long.kt"); } @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_NAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_NAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_nonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_nonLocalReturn.kt"); } @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_suspendFunType() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_suspendFunType.kt"); } @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationCrossinline.kt", "kotlin.coroutines"); + public void testBridgeGenerationCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationCrossinline.kt"); } @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationNonInline.kt", "kotlin.coroutines"); + public void testBridgeGenerationNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationNonInline.kt"); } @TestMetadata("covariantOverrideSuspendFun.kt") @@ -8056,8 +8012,8 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); + public void testInterfaceDelegateWithInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt"); } @TestMetadata("invokeOperator.kt") @@ -8066,28 +8022,28 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt"); } @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any.kt"); } @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_itf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_itf.kt"); } @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_this.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_this() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_this.kt"); } @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Int.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Int.kt"); } @TestMetadata("returnResult.kt") @@ -8104,10 +8060,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInResumeWithException() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @@ -8123,58 +8075,58 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Any.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineInt() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineInt.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Int.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Long() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Long.kt"); } @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_NAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_NAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_nonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_nonLocalReturn.kt"); } @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_suspendFunType() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_suspendFunType.kt"); } @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationCrossinline.kt", "kotlin.coroutines"); + public void testBridgeGenerationCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationCrossinline.kt"); } @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationNonInline.kt", "kotlin.coroutines"); + public void testBridgeGenerationNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationNonInline.kt"); } @TestMetadata("covariantOverrideSuspendFun.kt") @@ -8273,8 +8225,8 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); + public void testInterfaceDelegateWithInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt"); } @TestMetadata("invokeOperator.kt") @@ -8283,28 +8235,28 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt"); } @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any.kt"); } @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_itf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_itf.kt"); } @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_this.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_this() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_this.kt"); } @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Int.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Int.kt"); } @TestMetadata("returnResult.kt") @@ -8322,22 +8274,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInIntLikeVarSpilling() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/intLikeVarSpilling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("complicatedMerge.kt") - public void testComplicatedMerge_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt", "kotlin.coroutines"); + public void testComplicatedMerge() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt"); } @TestMetadata("i2bResult.kt") - public void testI2bResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines"); + public void testI2bResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt"); } @TestMetadata("listThrowablePairInOneSlot.kt") @@ -8346,43 +8294,43 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("loadFromBooleanArray.kt") - public void testLoadFromBooleanArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines"); + public void testLoadFromBooleanArray() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt"); } @TestMetadata("loadFromByteArray.kt") - public void testLoadFromByteArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt", "kotlin.coroutines"); + public void testLoadFromByteArray() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt"); } @TestMetadata("noVariableInTable.kt") - public void testNoVariableInTable_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt", "kotlin.coroutines"); + public void testNoVariableInTable() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt"); } @TestMetadata("sameIconst1ManyVars.kt") - public void testSameIconst1ManyVars_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt", "kotlin.coroutines"); + public void testSameIconst1ManyVars() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt"); } @TestMetadata("usedInArrayStore.kt") - public void testUsedInArrayStore_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInArrayStore.kt", "kotlin.coroutines"); + public void testUsedInArrayStore() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInArrayStore.kt"); } @TestMetadata("usedInMethodCall.kt") - public void testUsedInMethodCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt", "kotlin.coroutines"); + public void testUsedInMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt"); } @TestMetadata("usedInPutfield.kt") - public void testUsedInPutfield_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInPutfield.kt", "kotlin.coroutines"); + public void testUsedInPutfield() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInPutfield.kt"); } @TestMetadata("usedInVarStore.kt") - public void testUsedInVarStore_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt", "kotlin.coroutines"); + public void testUsedInVarStore() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt"); } } @@ -8394,52 +8342,48 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInIntrinsicSemantics() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/intrinsicSemantics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } - @TestMetadata("coroutineContextReceiverNotIntrinsic.kt") - public void testCoroutineContextReceiverNotIntrinsic_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiverNotIntrinsic.kt", "kotlin.coroutines"); + @TestMetadata("coroutineContext.kt") + public void testCoroutineContext() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContext.kt"); } @TestMetadata("coroutineContextReceiver.kt") - public void testCoroutineContextReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiver.kt", "kotlin.coroutines"); + public void testCoroutineContextReceiver() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiver.kt"); } - @TestMetadata("coroutineContext.kt") - public void testCoroutineContext_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContext.kt", "kotlin.coroutines"); + @TestMetadata("coroutineContextReceiverNotIntrinsic.kt") + public void testCoroutineContextReceiverNotIntrinsic() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiverNotIntrinsic.kt"); } @TestMetadata("intercepted.kt") - public void testIntercepted_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/intercepted.kt", "kotlin.coroutines"); - } - - @TestMetadata("startCoroutineUninterceptedOrReturnInterception.kt") - public void testStartCoroutineUninterceptedOrReturnInterception_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt", "kotlin.coroutines"); - } - - @TestMetadata("startCoroutineUninterceptedOrReturn.kt") - public void testStartCoroutineUninterceptedOrReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt", "kotlin.coroutines"); + public void testIntercepted() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/intercepted.kt"); } @TestMetadata("startCoroutine.kt") - public void testStartCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt", "kotlin.coroutines"); + public void testStartCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt"); + } + + @TestMetadata("startCoroutineUninterceptedOrReturn.kt") + public void testStartCoroutineUninterceptedOrReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt"); + } + + @TestMetadata("startCoroutineUninterceptedOrReturnInterception.kt") + public void testStartCoroutineUninterceptedOrReturnInterception() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt"); } @TestMetadata("suspendCoroutineUninterceptedOrReturn.kt") - public void testSuspendCoroutineUninterceptedOrReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/suspendCoroutineUninterceptedOrReturn.kt", "kotlin.coroutines"); + public void testSuspendCoroutineUninterceptedOrReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/suspendCoroutineUninterceptedOrReturn.kt"); } } @@ -8451,37 +8395,33 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInJavaInterop() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("objectWithSeveralSuspends.kt") - public void testObjectWithSeveralSuspends_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/objectWithSeveralSuspends.kt", "kotlin.coroutines"); + public void testObjectWithSeveralSuspends() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/javaInterop/objectWithSeveralSuspends.kt"); } @TestMetadata("returnLambda.kt") - public void testReturnLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/returnLambda.kt", "kotlin.coroutines"); + public void testReturnLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/javaInterop/returnLambda.kt"); } @TestMetadata("returnObject.kt") - public void testReturnObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/returnObject.kt", "kotlin.coroutines"); + public void testReturnObject() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/javaInterop/returnObject.kt"); } @TestMetadata("severalCaptures.kt") - public void testSeveralCaptures_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/severalCaptures.kt", "kotlin.coroutines"); + public void testSeveralCaptures() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/javaInterop/severalCaptures.kt"); } @TestMetadata("suspendInlineWithCrossinline.kt") - public void testSuspendInlineWithCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/javaInterop/suspendInlineWithCrossinline.kt", "kotlin.coroutines"); + public void testSuspendInlineWithCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/javaInterop/suspendInlineWithCrossinline.kt"); } } @@ -8505,17 +8445,13 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInAnonymous() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/localFunctions/anonymous"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/anonymous/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/anonymous/simple.kt"); } } @@ -8527,42 +8463,38 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInNamed() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/localFunctions/named"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("capturedParameters.kt") - public void testCapturedParameters_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedParameters.kt", "kotlin.coroutines"); + public void testCapturedParameters() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedParameters.kt"); } @TestMetadata("capturedVariables.kt") - public void testCapturedVariables_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedVariables.kt", "kotlin.coroutines"); + public void testCapturedVariables() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedVariables.kt"); } @TestMetadata("extension.kt") - public void testExtension_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/extension.kt", "kotlin.coroutines"); + public void testExtension() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/extension.kt"); } @TestMetadata("infix.kt") - public void testInfix_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/infix.kt", "kotlin.coroutines"); + public void testInfix() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/infix.kt"); } @TestMetadata("insideLambda.kt") - public void testInsideLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/insideLambda.kt", "kotlin.coroutines"); + public void testInsideLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/insideLambda.kt"); } @TestMetadata("nestedLocals.kt") - public void testNestedLocals_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/nestedLocals.kt", "kotlin.coroutines"); + public void testNestedLocals() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/nestedLocals.kt"); } @TestMetadata("rec.kt") @@ -8570,24 +8502,24 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/rec.kt"); } - @TestMetadata("simpleSuspensionPoint.kt") - public void testSimpleSuspensionPoint_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/simpleSuspensionPoint.kt", "kotlin.coroutines"); + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/simple.kt"); } - @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/simple.kt", "kotlin.coroutines"); + @TestMetadata("simpleSuspensionPoint.kt") + public void testSimpleSuspensionPoint() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/simpleSuspensionPoint.kt"); } @TestMetadata("stateMachine.kt") - public void testStateMachine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/stateMachine.kt", "kotlin.coroutines"); + public void testStateMachine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/stateMachine.kt"); } @TestMetadata("withArguments.kt") - public void testWithArguments_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/withArguments.kt", "kotlin.coroutines"); + public void testWithArguments() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/withArguments.kt"); } } } @@ -8600,47 +8532,43 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInMultiModule() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("inlineCrossModule.kt") - public void testInlineCrossModule_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt", "kotlin.coroutines"); + public void testInlineCrossModule() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt"); } @TestMetadata("inlineFunctionWithOptionalParam.kt") - public void testInlineFunctionWithOptionalParam_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt", "kotlin.coroutines"); - } - - @TestMetadata("inlineMultiModuleOverride.kt") - public void testInlineMultiModuleOverride_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleOverride.kt", "kotlin.coroutines"); - } - - @TestMetadata("inlineMultiModuleWithController.kt") - public void testInlineMultiModuleWithController_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithController.kt", "kotlin.coroutines"); - } - - @TestMetadata("inlineMultiModuleWithInnerInlining.kt") - public void testInlineMultiModuleWithInnerInlining_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithInnerInlining.kt", "kotlin.coroutines"); + public void testInlineFunctionWithOptionalParam() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt"); } @TestMetadata("inlineMultiModule.kt") - public void testInlineMultiModule_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModule.kt", "kotlin.coroutines"); + public void testInlineMultiModule() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModule.kt"); + } + + @TestMetadata("inlineMultiModuleOverride.kt") + public void testInlineMultiModuleOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleOverride.kt"); + } + + @TestMetadata("inlineMultiModuleWithController.kt") + public void testInlineMultiModuleWithController() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithController.kt"); + } + + @TestMetadata("inlineMultiModuleWithInnerInlining.kt") + public void testInlineMultiModuleWithInnerInlining() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithInnerInlining.kt"); } @TestMetadata("inlineTailCall.kt") - public void testInlineTailCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineTailCall.kt", "kotlin.coroutines"); + public void testInlineTailCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineTailCall.kt"); } @TestMetadata("inlineWithJava.kt") @@ -8649,8 +8577,8 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/simple.kt"); } } @@ -8662,17 +8590,13 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInRedundantLocalsElimination() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/redundantLocalsElimination"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("ktor_receivedMessage.kt") - public void testKtor_receivedMessage_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/redundantLocalsElimination/ktor_receivedMessage.kt", "kotlin.coroutines"); + public void testKtor_receivedMessage() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/redundantLocalsElimination/ktor_receivedMessage.kt"); } } @@ -8712,42 +8636,38 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInStackUnwinding() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/stackUnwinding"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("exception.kt") - public void testException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/exception.kt", "kotlin.coroutines"); + public void testException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/exception.kt"); } @TestMetadata("inlineSuspendFunction.kt") - public void testInlineSuspendFunction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt", "kotlin.coroutines"); - } - - @TestMetadata("rethrowInFinallyWithSuspension.kt") - public void testRethrowInFinallyWithSuspension_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinallyWithSuspension.kt", "kotlin.coroutines"); + public void testInlineSuspendFunction() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt"); } @TestMetadata("rethrowInFinally.kt") - public void testRethrowInFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinally.kt", "kotlin.coroutines"); + public void testRethrowInFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinally.kt"); + } + + @TestMetadata("rethrowInFinallyWithSuspension.kt") + public void testRethrowInFinallyWithSuspension() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinallyWithSuspension.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt"); } @TestMetadata("suspendInCycle.kt") - public void testSuspendInCycle_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt", "kotlin.coroutines"); + public void testSuspendInCycle() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt"); } } @@ -8792,22 +8712,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInSuspendFunctionAsCoroutine() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("dispatchResume.kt") - public void testDispatchResume_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt", "kotlin.coroutines"); + public void testDispatchResume() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt"); } @TestMetadata("handleException.kt") - public void testHandleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt", "kotlin.coroutines"); + public void testHandleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt"); } @TestMetadata("ifExpressionInsideCoroutine_1_3.kt") @@ -8815,24 +8731,24 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine_1_3.kt"); } - @TestMetadata("inlineTwoReceivers.kt") - public void testInlineTwoReceivers_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt", "kotlin.coroutines"); + @TestMetadata("inline.kt") + public void testInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt"); } - @TestMetadata("inline.kt") - public void testInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt", "kotlin.coroutines"); + @TestMetadata("inlineTwoReceivers.kt") + public void testInlineTwoReceivers() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt"); } @TestMetadata("member.kt") - public void testMember_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt", "kotlin.coroutines"); + public void testMember() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt"); } @TestMetadata("noinlineTwoReceivers.kt") - public void testNoinlineTwoReceivers_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt", "kotlin.coroutines"); + public void testNoinlineTwoReceivers() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt"); } @TestMetadata("openFunWithJava.kt") @@ -8841,53 +8757,53 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("operators.kt") - public void testOperators_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt", "kotlin.coroutines"); + public void testOperators() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt"); } @TestMetadata("privateFunctions.kt") - public void testPrivateFunctions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt", "kotlin.coroutines"); + public void testPrivateFunctions() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt"); } @TestMetadata("privateInFile.kt") - public void testPrivateInFile_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt", "kotlin.coroutines"); + public void testPrivateInFile() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt"); } @TestMetadata("returnNoSuspend.kt") - public void testReturnNoSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt", "kotlin.coroutines"); + public void testReturnNoSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt", "kotlin.coroutines"); - } - - @TestMetadata("superCallAbstractClass.kt") - public void testSuperCallAbstractClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallAbstractClass.kt", "kotlin.coroutines"); - } - - @TestMetadata("superCallInterface.kt") - public void testSuperCallInterface_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallInterface.kt", "kotlin.coroutines"); - } - - @TestMetadata("superCallOverload.kt") - public void testSuperCallOverload_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallOverload.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt"); } @TestMetadata("superCall.kt") - public void testSuperCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt", "kotlin.coroutines"); + public void testSuperCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt"); + } + + @TestMetadata("superCallAbstractClass.kt") + public void testSuperCallAbstractClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallAbstractClass.kt"); + } + + @TestMetadata("superCallInterface.kt") + public void testSuperCallInterface() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallInterface.kt"); + } + + @TestMetadata("superCallOverload.kt") + public void testSuperCallOverload() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallOverload.kt"); } @TestMetadata("withVariables.kt") - public void testWithVariables_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt", "kotlin.coroutines"); + public void testWithVariables() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt"); } } @@ -8899,37 +8815,33 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInSuspendFunctionTypeCall() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("localVal.kt") - public void testLocalVal_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt", "kotlin.coroutines"); - } - - @TestMetadata("manyParametersNoCapture.kt") - public void testManyParametersNoCapture_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParametersNoCapture.kt", "kotlin.coroutines"); + public void testLocalVal() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt"); } @TestMetadata("manyParameters.kt") - public void testManyParameters_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt", "kotlin.coroutines"); + public void testManyParameters() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt"); + } + + @TestMetadata("manyParametersNoCapture.kt") + public void testManyParametersNoCapture() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParametersNoCapture.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt"); } @TestMetadata("suspendModifier.kt") - public void testSuspendModifier_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt", "kotlin.coroutines"); + public void testSuspendModifier() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt"); } } @@ -8941,10 +8853,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInTailCallOptimizations() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/tailCallOptimizations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @@ -8955,8 +8863,8 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("crossinline.kt") - public void testCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/crossinline.kt", "kotlin.coroutines"); + public void testCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/crossinline.kt"); } @TestMetadata("inlineWithStateMachine.kt") @@ -8965,13 +8873,13 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("inlineWithoutStateMachine.kt") - public void testInlineWithoutStateMachine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt", "kotlin.coroutines"); + public void testInlineWithoutStateMachine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt"); } @TestMetadata("innerObjectRetransformation.kt") - public void testInnerObjectRetransformation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation.kt", "kotlin.coroutines"); + public void testInnerObjectRetransformation() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation.kt"); } @TestMetadata("interfaceDelegation.kt") @@ -9004,16 +8912,16 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/tailSuspendUnitFun.kt"); } + @TestMetadata("tryCatch.kt") + public void testTryCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/tryCatch.kt"); + } + @TestMetadata("tryCatchTailCall.kt") public void testTryCatchTailCall() throws Exception { runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/tryCatchTailCall.kt"); } - @TestMetadata("tryCatch.kt") - public void testTryCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/tryCatch.kt", "kotlin.coroutines"); - } - @TestMetadata("unreachable.kt") public void testUnreachable() throws Exception { runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/unreachable.kt"); @@ -9101,32 +9009,28 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInTailOperations() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/tailOperations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("suspendWithIf.kt") - public void testSuspendWithIf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithIf.kt", "kotlin.coroutines"); + public void testSuspendWithIf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithIf.kt"); } @TestMetadata("suspendWithTryCatch.kt") - public void testSuspendWithTryCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt", "kotlin.coroutines"); + public void testSuspendWithTryCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt"); } @TestMetadata("suspendWithWhen.kt") - public void testSuspendWithWhen_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithWhen.kt", "kotlin.coroutines"); + public void testSuspendWithWhen() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithWhen.kt"); } @TestMetadata("tailInlining.kt") - public void testTailInlining_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/tailInlining.kt", "kotlin.coroutines"); + public void testTailInlining() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/tailInlining.kt"); } } @@ -9138,22 +9042,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInUnitTypeReturn() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/unitTypeReturn"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("coroutineNonLocalReturn.kt") - public void testCoroutineNonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt", "kotlin.coroutines"); + public void testCoroutineNonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt"); } @TestMetadata("coroutineReturn.kt") - public void testCoroutineReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt", "kotlin.coroutines"); + public void testCoroutineReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt"); } @TestMetadata("inlineUnitFunction.kt") @@ -9167,18 +9067,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("suspendNonLocalReturn.kt") - public void testSuspendNonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt", "kotlin.coroutines"); + public void testSuspendNonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt"); } @TestMetadata("suspendReturn.kt") - public void testSuspendReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt", "kotlin.coroutines"); + public void testSuspendReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt"); } @TestMetadata("unitSafeCall.kt") - public void testUnitSafeCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/unitSafeCall.kt", "kotlin.coroutines"); + public void testUnitSafeCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/unitSafeCall.kt"); } } @@ -9190,10 +9090,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInVarSpilling() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/varSpilling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @@ -9204,18 +9100,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("kt19475.kt") - public void testKt19475_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/kt19475.kt", "kotlin.coroutines"); + public void testKt19475() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt19475.kt"); } @TestMetadata("kt38925.kt") - public void testKt38925_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/kt38925.kt", "kotlin.coroutines"); + public void testKt38925() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt38925.kt"); } @TestMetadata("nullSpilling.kt") - public void testNullSpilling_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/nullSpilling.kt", "kotlin.coroutines"); + public void testNullSpilling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/nullSpilling.kt"); } @TestMetadata("refinedIntTypesAnalysis.kt") @@ -20396,10 +20292,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInParametersMetadata() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/parametersMetadata"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @@ -20450,8 +20342,8 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @TestMetadata("suspendFunction.kt") - public void testSuspendFunction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/parametersMetadata/suspendFunction.kt", "kotlin.coroutines"); + public void testSuspendFunction() throws Exception { + runTest("compiler/testData/codegen/box/parametersMetadata/suspendFunction.kt"); } } diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java index 339372300a6..72ae58bb07a 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java @@ -3967,22 +3967,18 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInSuspend() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("capturedVariables.kt") - public void testCapturedVariables_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/capturedVariables.kt", "kotlin.coroutines"); + public void testCapturedVariables() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/capturedVariables.kt"); } @TestMetadata("crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt") - public void testCrossinlineSuspendLambdaInsideCrossinlineSuspendLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt", "kotlin.coroutines"); + public void testCrossinlineSuspendLambdaInsideCrossinlineSuspendLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt"); } @TestMetadata("debugMetadataCrossinline.kt") @@ -3991,18 +3987,18 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli } @TestMetadata("delegatedProperties.kt") - public void testDelegatedProperties_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt", "kotlin.coroutines"); + public void testDelegatedProperties() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt"); } @TestMetadata("doubleRegenerationWithNonSuspendingLambda.kt") - public void testDoubleRegenerationWithNonSuspendingLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt", "kotlin.coroutines"); + public void testDoubleRegenerationWithNonSuspendingLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt"); } @TestMetadata("enclodingMethod.kt") - public void testEnclodingMethod_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/enclodingMethod.kt", "kotlin.coroutines"); + public void testEnclodingMethod() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/enclodingMethod.kt"); } @TestMetadata("fileNameInMetadata.kt") @@ -4011,18 +4007,18 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli } @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendContinuation.kt") - public void testInlineSuspendContinuation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendContinuation.kt", "kotlin.coroutines"); + public void testInlineSuspendContinuation() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendContinuation.kt"); } @TestMetadata("inlineSuspendInMultifileClass.kt") @@ -4031,38 +4027,38 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli } @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt"); } @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt"); } @TestMetadata("jvmName.kt") - public void testJvmName_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/jvmName.kt", "kotlin.coroutines"); + public void testJvmName() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/jvmName.kt"); } @TestMetadata("kt26658.kt") @@ -4071,18 +4067,18 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli } @TestMetadata("maxStackWithCrossinline.kt") - public void testMaxStackWithCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt", "kotlin.coroutines"); + public void testMaxStackWithCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt"); } @TestMetadata("multipleLocals.kt") - public void testMultipleLocals_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines"); + public void testMultipleLocals() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt"); } @TestMetadata("multipleSuspensionPoints.kt") - public void testMultipleSuspensionPoints_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt", "kotlin.coroutines"); + public void testMultipleSuspensionPoints() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt"); } @TestMetadata("nestedMethodWith2XParameter.kt") @@ -4096,23 +4092,23 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli } @TestMetadata("nonSuspendCrossinline.kt") - public void testNonSuspendCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt", "kotlin.coroutines"); + public void testNonSuspendCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt"); } @TestMetadata("returnValue.kt") - public void testReturnValue_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/returnValue.kt", "kotlin.coroutines"); + public void testReturnValue() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/returnValue.kt"); } @TestMetadata("tryCatchReceiver.kt") - public void testTryCatchReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt", "kotlin.coroutines"); + public void testTryCatchReceiver() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt"); } @TestMetadata("tryCatchStackTransform.kt") - public void testTryCatchStackTransform_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt", "kotlin.coroutines"); + public void testTryCatchStackTransform() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt"); } @TestMetadata("twiceRegeneratedAnonymousObject.kt") @@ -4171,17 +4167,13 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInDefaultParameter() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/defaultParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("defaultValueCrossinline.kt") - public void testDefaultValueCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt", "kotlin.coroutines"); + public void testDefaultValueCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt"); } @TestMetadata("defaultValueInClass.kt") @@ -4189,14 +4181,14 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInClass.kt"); } - @TestMetadata("defaultValueInlineFromMultiFileFacade.kt") - public void testDefaultValueInlineFromMultiFileFacade_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt", "kotlin.coroutines"); + @TestMetadata("defaultValueInline.kt") + public void testDefaultValueInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt"); } - @TestMetadata("defaultValueInline.kt") - public void testDefaultValueInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt", "kotlin.coroutines"); + @TestMetadata("defaultValueInlineFromMultiFileFacade.kt") + public void testDefaultValueInlineFromMultiFileFacade() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt"); } } @@ -4264,52 +4256,48 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInReceiver() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/receiver"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt"); } @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt"); } } @@ -4321,77 +4309,73 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInStateMachine() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/stateMachine"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("crossingCoroutineBoundaries.kt") - public void testCrossingCoroutineBoundaries_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt", "kotlin.coroutines"); + public void testCrossingCoroutineBoundaries() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt"); } @TestMetadata("independentInline.kt") - public void testIndependentInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerLambdaInsideLambda.kt") - public void testInnerLambdaInsideLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerLambdaWithoutCrossinline.kt") - public void testInnerLambdaWithoutCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt", "kotlin.coroutines"); + public void testIndependentInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt"); } @TestMetadata("innerLambda.kt") - public void testInnerLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt", "kotlin.coroutines"); + public void testInnerLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt"); } - @TestMetadata("innerMadnessCallSite.kt") - public void testInnerMadnessCallSite_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt", "kotlin.coroutines"); + @TestMetadata("innerLambdaInsideLambda.kt") + public void testInnerLambdaInsideLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt"); + } + + @TestMetadata("innerLambdaWithoutCrossinline.kt") + public void testInnerLambdaWithoutCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt"); } @TestMetadata("innerMadness.kt") - public void testInnerMadness_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt", "kotlin.coroutines"); + public void testInnerMadness() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt"); } - @TestMetadata("innerObjectInsideInnerObject.kt") - public void testInnerObjectInsideInnerObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectRetransformation.kt") - public void testInnerObjectRetransformation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectSeveralFunctions.kt") - public void testInnerObjectSeveralFunctions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectWithoutCapturingCrossinline.kt") - public void testInnerObjectWithoutCapturingCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt", "kotlin.coroutines"); + @TestMetadata("innerMadnessCallSite.kt") + public void testInnerMadnessCallSite() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt"); } @TestMetadata("innerObject.kt") - public void testInnerObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt", "kotlin.coroutines"); + public void testInnerObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt"); + } + + @TestMetadata("innerObjectInsideInnerObject.kt") + public void testInnerObjectInsideInnerObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt"); + } + + @TestMetadata("innerObjectRetransformation.kt") + public void testInnerObjectRetransformation() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt"); + } + + @TestMetadata("innerObjectSeveralFunctions.kt") + public void testInnerObjectSeveralFunctions() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt"); + } + + @TestMetadata("innerObjectWithoutCapturingCrossinline.kt") + public void testInnerObjectWithoutCapturingCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt"); } @TestMetadata("insideObject.kt") - public void testInsideObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt", "kotlin.coroutines"); + public void testInsideObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt"); } @TestMetadata("lambdaTransformation.kt") @@ -4400,43 +4384,43 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli } @TestMetadata("normalInline.kt") - public void testNormalInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt", "kotlin.coroutines"); + public void testNormalInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt"); } @TestMetadata("numberOfSuspentions.kt") - public void testNumberOfSuspentions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt", "kotlin.coroutines"); + public void testNumberOfSuspentions() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt"); } @TestMetadata("objectInsideLambdas.kt") - public void testObjectInsideLambdas_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt", "kotlin.coroutines"); + public void testObjectInsideLambdas() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt"); } @TestMetadata("oneInlineTwoCaptures.kt") - public void testOneInlineTwoCaptures_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt", "kotlin.coroutines"); + public void testOneInlineTwoCaptures() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt"); } @TestMetadata("passLambda.kt") - public void testPassLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt", "kotlin.coroutines"); - } - - @TestMetadata("passParameterLambda.kt") - public void testPassParameterLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt", "kotlin.coroutines"); + public void testPassLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt"); } @TestMetadata("passParameter.kt") - public void testPassParameter_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt", "kotlin.coroutines"); + public void testPassParameter() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt"); + } + + @TestMetadata("passParameterLambda.kt") + public void testPassParameterLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt"); } @TestMetadata("unreachableSuspendMarker.kt") - public void testUnreachableSuspendMarker_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt", "kotlin.coroutines"); + public void testUnreachableSuspendMarker() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt"); } } } diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index 139e31166d6..55440bc1093 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -674,32 +674,28 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInCoroutines() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/coroutines"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("coroutineContextIntrinsic.kt") - public void testCoroutineContextIntrinsic_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeListing/coroutines/coroutineContextIntrinsic.kt", "kotlin.coroutines"); + public void testCoroutineContextIntrinsic() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/coroutines/coroutineContextIntrinsic.kt"); } @TestMetadata("coroutineFields.kt") - public void testCoroutineFields_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeListing/coroutines/coroutineFields.kt", "kotlin.coroutines"); + public void testCoroutineFields() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/coroutines/coroutineFields.kt"); } @TestMetadata("oomInReturnUnit.kt") - public void testOomInReturnUnit_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeListing/coroutines/oomInReturnUnit.kt", "kotlin.coroutines"); + public void testOomInReturnUnit() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/coroutines/oomInReturnUnit.kt"); } @TestMetadata("privateAccessor.kt") - public void testPrivateAccessor_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeListing/coroutines/privateAccessor.kt", "kotlin.coroutines"); + public void testPrivateAccessor() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/coroutines/privateAccessor.kt"); } @TestMetadata("privateSuspendFun.kt") @@ -713,13 +709,13 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes } @TestMetadata("suspendReifiedFun.kt") - public void testSuspendReifiedFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeListing/coroutines/suspendReifiedFun.kt", "kotlin.coroutines"); + public void testSuspendReifiedFun() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/coroutines/suspendReifiedFun.kt"); } @TestMetadata("tcoContinuation.kt") - public void testTcoContinuation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeListing/coroutines/tcoContinuation.kt", "kotlin.coroutines"); + public void testTcoContinuation() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/coroutines/tcoContinuation.kt"); } @TestMetadata("compiler/testData/codegen/bytecodeListing/coroutines/spilling") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java index e7e3faff259..b68ce967cf4 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java @@ -1413,10 +1413,6 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInCoroutines() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/coroutines"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @@ -1447,8 +1443,8 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest { } @TestMetadata("returnUnitInLambda.kt") - public void testReturnUnitInLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/returnUnitInLambda.kt", "kotlin.coroutines"); + public void testReturnUnitInLambda() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/returnUnitInLambda.kt"); } @TestMetadata("suspendMain.kt") @@ -1626,62 +1622,58 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInIntLikeVarSpilling() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("complicatedMerge.kt") - public void testComplicatedMerge_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/complicatedMerge.kt", "kotlin.coroutines"); + public void testComplicatedMerge() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/complicatedMerge.kt"); } @TestMetadata("i2bResult.kt") - public void testI2bResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines"); + public void testI2bResult() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/i2bResult.kt"); } @TestMetadata("loadFromBooleanArray.kt") - public void testLoadFromBooleanArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines"); + public void testLoadFromBooleanArray() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt"); } @TestMetadata("loadFromByteArray.kt") - public void testLoadFromByteArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/loadFromByteArray.kt", "kotlin.coroutines"); + public void testLoadFromByteArray() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/loadFromByteArray.kt"); } @TestMetadata("noVariableInTable.kt") - public void testNoVariableInTable_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/noVariableInTable.kt", "kotlin.coroutines"); + public void testNoVariableInTable() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/noVariableInTable.kt"); } @TestMetadata("sameIconst1ManyVars.kt") - public void testSameIconst1ManyVars_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt", "kotlin.coroutines"); + public void testSameIconst1ManyVars() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt"); } @TestMetadata("usedInArrayStore.kt") - public void testUsedInArrayStore_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInArrayStore.kt", "kotlin.coroutines"); + public void testUsedInArrayStore() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInArrayStore.kt"); } @TestMetadata("usedInMethodCall.kt") - public void testUsedInMethodCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInMethodCall.kt", "kotlin.coroutines"); + public void testUsedInMethodCall() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInMethodCall.kt"); } @TestMetadata("usedInPutfield.kt") - public void testUsedInPutfield_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInPutfield.kt", "kotlin.coroutines"); + public void testUsedInPutfield() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInPutfield.kt"); } @TestMetadata("usedInVarStore.kt") - public void testUsedInVarStore_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInVarStore.kt", "kotlin.coroutines"); + public void testUsedInVarStore() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInVarStore.kt"); } } diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java index bff2ed9cbd6..0020e5583d8 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java @@ -3967,22 +3967,18 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); - } - public void testAllFilesPresentInSuspend() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("capturedVariables.kt") - public void testCapturedVariables_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/capturedVariables.kt", "kotlin.coroutines"); + public void testCapturedVariables() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/capturedVariables.kt"); } @TestMetadata("crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt") - public void testCrossinlineSuspendLambdaInsideCrossinlineSuspendLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt", "kotlin.coroutines"); + public void testCrossinlineSuspendLambdaInsideCrossinlineSuspendLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt"); } @TestMetadata("debugMetadataCrossinline.kt") @@ -3991,18 +3987,18 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC } @TestMetadata("delegatedProperties.kt") - public void testDelegatedProperties_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt", "kotlin.coroutines"); + public void testDelegatedProperties() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt"); } @TestMetadata("doubleRegenerationWithNonSuspendingLambda.kt") - public void testDoubleRegenerationWithNonSuspendingLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt", "kotlin.coroutines"); + public void testDoubleRegenerationWithNonSuspendingLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt"); } @TestMetadata("enclodingMethod.kt") - public void testEnclodingMethod_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/enclodingMethod.kt", "kotlin.coroutines"); + public void testEnclodingMethod() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/enclodingMethod.kt"); } @TestMetadata("fileNameInMetadata.kt") @@ -4011,18 +4007,18 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC } @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendContinuation.kt") - public void testInlineSuspendContinuation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendContinuation.kt", "kotlin.coroutines"); + public void testInlineSuspendContinuation() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendContinuation.kt"); } @TestMetadata("inlineSuspendInMultifileClass.kt") @@ -4031,38 +4027,38 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC } @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt"); } @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt"); } @TestMetadata("jvmName.kt") - public void testJvmName_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/jvmName.kt", "kotlin.coroutines"); + public void testJvmName() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/jvmName.kt"); } @TestMetadata("kt26658.kt") @@ -4071,18 +4067,18 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC } @TestMetadata("maxStackWithCrossinline.kt") - public void testMaxStackWithCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt", "kotlin.coroutines"); + public void testMaxStackWithCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt"); } @TestMetadata("multipleLocals.kt") - public void testMultipleLocals_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines"); + public void testMultipleLocals() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt"); } @TestMetadata("multipleSuspensionPoints.kt") - public void testMultipleSuspensionPoints_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt", "kotlin.coroutines"); + public void testMultipleSuspensionPoints() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt"); } @TestMetadata("nestedMethodWith2XParameter.kt") @@ -4096,23 +4092,23 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC } @TestMetadata("nonSuspendCrossinline.kt") - public void testNonSuspendCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt", "kotlin.coroutines"); + public void testNonSuspendCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt"); } @TestMetadata("returnValue.kt") - public void testReturnValue_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/returnValue.kt", "kotlin.coroutines"); + public void testReturnValue() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/returnValue.kt"); } @TestMetadata("tryCatchReceiver.kt") - public void testTryCatchReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt", "kotlin.coroutines"); + public void testTryCatchReceiver() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt"); } @TestMetadata("tryCatchStackTransform.kt") - public void testTryCatchStackTransform_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt", "kotlin.coroutines"); + public void testTryCatchStackTransform() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt"); } @TestMetadata("twiceRegeneratedAnonymousObject.kt") @@ -4171,17 +4167,13 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); - } - public void testAllFilesPresentInDefaultParameter() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/defaultParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("defaultValueCrossinline.kt") - public void testDefaultValueCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt", "kotlin.coroutines"); + public void testDefaultValueCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt"); } @TestMetadata("defaultValueInClass.kt") @@ -4189,14 +4181,14 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInClass.kt"); } - @TestMetadata("defaultValueInlineFromMultiFileFacade.kt") - public void testDefaultValueInlineFromMultiFileFacade_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt", "kotlin.coroutines"); + @TestMetadata("defaultValueInline.kt") + public void testDefaultValueInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt"); } - @TestMetadata("defaultValueInline.kt") - public void testDefaultValueInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt", "kotlin.coroutines"); + @TestMetadata("defaultValueInlineFromMultiFileFacade.kt") + public void testDefaultValueInlineFromMultiFileFacade() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt"); } } @@ -4264,52 +4256,48 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); - } - public void testAllFilesPresentInReceiver() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/receiver"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt"); } @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt"); } } @@ -4321,77 +4309,73 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); - } - public void testAllFilesPresentInStateMachine() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/stateMachine"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("crossingCoroutineBoundaries.kt") - public void testCrossingCoroutineBoundaries_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt", "kotlin.coroutines"); + public void testCrossingCoroutineBoundaries() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt"); } @TestMetadata("independentInline.kt") - public void testIndependentInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerLambdaInsideLambda.kt") - public void testInnerLambdaInsideLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerLambdaWithoutCrossinline.kt") - public void testInnerLambdaWithoutCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt", "kotlin.coroutines"); + public void testIndependentInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt"); } @TestMetadata("innerLambda.kt") - public void testInnerLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt", "kotlin.coroutines"); + public void testInnerLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt"); } - @TestMetadata("innerMadnessCallSite.kt") - public void testInnerMadnessCallSite_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt", "kotlin.coroutines"); + @TestMetadata("innerLambdaInsideLambda.kt") + public void testInnerLambdaInsideLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt"); + } + + @TestMetadata("innerLambdaWithoutCrossinline.kt") + public void testInnerLambdaWithoutCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt"); } @TestMetadata("innerMadness.kt") - public void testInnerMadness_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt", "kotlin.coroutines"); + public void testInnerMadness() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt"); } - @TestMetadata("innerObjectInsideInnerObject.kt") - public void testInnerObjectInsideInnerObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectRetransformation.kt") - public void testInnerObjectRetransformation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectSeveralFunctions.kt") - public void testInnerObjectSeveralFunctions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectWithoutCapturingCrossinline.kt") - public void testInnerObjectWithoutCapturingCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt", "kotlin.coroutines"); + @TestMetadata("innerMadnessCallSite.kt") + public void testInnerMadnessCallSite() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt"); } @TestMetadata("innerObject.kt") - public void testInnerObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt", "kotlin.coroutines"); + public void testInnerObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt"); + } + + @TestMetadata("innerObjectInsideInnerObject.kt") + public void testInnerObjectInsideInnerObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt"); + } + + @TestMetadata("innerObjectRetransformation.kt") + public void testInnerObjectRetransformation() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt"); + } + + @TestMetadata("innerObjectSeveralFunctions.kt") + public void testInnerObjectSeveralFunctions() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt"); + } + + @TestMetadata("innerObjectWithoutCapturingCrossinline.kt") + public void testInnerObjectWithoutCapturingCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt"); } @TestMetadata("insideObject.kt") - public void testInsideObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt", "kotlin.coroutines"); + public void testInsideObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt"); } @TestMetadata("lambdaTransformation.kt") @@ -4400,43 +4384,43 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC } @TestMetadata("normalInline.kt") - public void testNormalInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt", "kotlin.coroutines"); + public void testNormalInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt"); } @TestMetadata("numberOfSuspentions.kt") - public void testNumberOfSuspentions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt", "kotlin.coroutines"); + public void testNumberOfSuspentions() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt"); } @TestMetadata("objectInsideLambdas.kt") - public void testObjectInsideLambdas_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt", "kotlin.coroutines"); + public void testObjectInsideLambdas() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt"); } @TestMetadata("oneInlineTwoCaptures.kt") - public void testOneInlineTwoCaptures_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt", "kotlin.coroutines"); + public void testOneInlineTwoCaptures() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt"); } @TestMetadata("passLambda.kt") - public void testPassLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt", "kotlin.coroutines"); - } - - @TestMetadata("passParameterLambda.kt") - public void testPassParameterLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt", "kotlin.coroutines"); + public void testPassLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt"); } @TestMetadata("passParameter.kt") - public void testPassParameter_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt", "kotlin.coroutines"); + public void testPassParameter() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt"); + } + + @TestMetadata("passParameterLambda.kt") + public void testPassParameterLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt"); } @TestMetadata("unreachableSuspendMarker.kt") - public void testUnreachableSuspendMarker_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt", "kotlin.coroutines"); + public void testUnreachableSuspendMarker() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt"); } } } diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java index 6f3c23ba64a..661e383ed48 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java @@ -25,10 +25,6 @@ public class IrCompileKotlinAgainstKotlinTestGenerated extends AbstractIrCompile KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath); - } - public void testAllFilesPresentInCompileKotlinAgainstKotlin() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @@ -99,8 +95,8 @@ public class IrCompileKotlinAgainstKotlinTestGenerated extends AbstractIrCompile } @TestMetadata("coroutinesBinary.kt") - public void testCoroutinesBinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/compileKotlinAgainstKotlin/coroutinesBinary.kt", "kotlin.coroutines"); + public void testCoroutinesBinary() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/coroutinesBinary.kt"); } @TestMetadata("defaultConstructor.kt") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxInlineTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxInlineTestGenerated.java index 667670a5fff..80f53c21a77 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxInlineTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxInlineTestGenerated.java @@ -3967,22 +3967,18 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); - } - public void testAllFilesPresentInSuspend() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, true); } @TestMetadata("capturedVariables.kt") - public void testCapturedVariables_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/capturedVariables.kt", "kotlin.coroutines"); + public void testCapturedVariables() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/capturedVariables.kt"); } @TestMetadata("crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt") - public void testCrossinlineSuspendLambdaInsideCrossinlineSuspendLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt", "kotlin.coroutines"); + public void testCrossinlineSuspendLambdaInsideCrossinlineSuspendLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt"); } @TestMetadata("debugMetadataCrossinline.kt") @@ -3991,18 +3987,18 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO } @TestMetadata("delegatedProperties.kt") - public void testDelegatedProperties_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt", "kotlin.coroutines"); + public void testDelegatedProperties() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt"); } @TestMetadata("doubleRegenerationWithNonSuspendingLambda.kt") - public void testDoubleRegenerationWithNonSuspendingLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt", "kotlin.coroutines"); + public void testDoubleRegenerationWithNonSuspendingLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt"); } @TestMetadata("enclodingMethod.kt") - public void testEnclodingMethod_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/enclodingMethod.kt", "kotlin.coroutines"); + public void testEnclodingMethod() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/enclodingMethod.kt"); } @TestMetadata("fileNameInMetadata.kt") @@ -4011,18 +4007,18 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO } @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendContinuation.kt") - public void testInlineSuspendContinuation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendContinuation.kt", "kotlin.coroutines"); + public void testInlineSuspendContinuation() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendContinuation.kt"); } @TestMetadata("inlineSuspendInMultifileClass.kt") @@ -4031,38 +4027,38 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO } @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt"); } @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt"); } @TestMetadata("jvmName.kt") - public void testJvmName_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/jvmName.kt", "kotlin.coroutines"); + public void testJvmName() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/jvmName.kt"); } @TestMetadata("kt26658.kt") @@ -4071,18 +4067,18 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO } @TestMetadata("maxStackWithCrossinline.kt") - public void testMaxStackWithCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt", "kotlin.coroutines"); + public void testMaxStackWithCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt"); } @TestMetadata("multipleLocals.kt") - public void testMultipleLocals_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines"); + public void testMultipleLocals() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt"); } @TestMetadata("multipleSuspensionPoints.kt") - public void testMultipleSuspensionPoints_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt", "kotlin.coroutines"); + public void testMultipleSuspensionPoints() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt"); } @TestMetadata("nestedMethodWith2XParameter.kt") @@ -4096,23 +4092,23 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO } @TestMetadata("nonSuspendCrossinline.kt") - public void testNonSuspendCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt", "kotlin.coroutines"); + public void testNonSuspendCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt"); } @TestMetadata("returnValue.kt") - public void testReturnValue_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/returnValue.kt", "kotlin.coroutines"); + public void testReturnValue() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/returnValue.kt"); } @TestMetadata("tryCatchReceiver.kt") - public void testTryCatchReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt", "kotlin.coroutines"); + public void testTryCatchReceiver() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt"); } @TestMetadata("tryCatchStackTransform.kt") - public void testTryCatchStackTransform_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt", "kotlin.coroutines"); + public void testTryCatchStackTransform() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt"); } @TestMetadata("twiceRegeneratedAnonymousObject.kt") @@ -4171,17 +4167,13 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); - } - public void testAllFilesPresentInDefaultParameter() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/defaultParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, true); } @TestMetadata("defaultValueCrossinline.kt") - public void testDefaultValueCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt", "kotlin.coroutines"); + public void testDefaultValueCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt"); } @TestMetadata("defaultValueInClass.kt") @@ -4189,14 +4181,14 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInClass.kt"); } - @TestMetadata("defaultValueInlineFromMultiFileFacade.kt") - public void testDefaultValueInlineFromMultiFileFacade_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt", "kotlin.coroutines"); + @TestMetadata("defaultValueInline.kt") + public void testDefaultValueInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt"); } - @TestMetadata("defaultValueInline.kt") - public void testDefaultValueInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt", "kotlin.coroutines"); + @TestMetadata("defaultValueInlineFromMultiFileFacade.kt") + public void testDefaultValueInlineFromMultiFileFacade() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt"); } } @@ -4264,52 +4256,48 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); - } - public void testAllFilesPresentInReceiver() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/receiver"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, true); } @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt"); } @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt"); } } @@ -4321,77 +4309,73 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); - } - public void testAllFilesPresentInStateMachine() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/stateMachine"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, true); } @TestMetadata("crossingCoroutineBoundaries.kt") - public void testCrossingCoroutineBoundaries_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt", "kotlin.coroutines"); + public void testCrossingCoroutineBoundaries() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt"); } @TestMetadata("independentInline.kt") - public void testIndependentInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerLambdaInsideLambda.kt") - public void testInnerLambdaInsideLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerLambdaWithoutCrossinline.kt") - public void testInnerLambdaWithoutCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt", "kotlin.coroutines"); + public void testIndependentInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt"); } @TestMetadata("innerLambda.kt") - public void testInnerLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt", "kotlin.coroutines"); + public void testInnerLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt"); } - @TestMetadata("innerMadnessCallSite.kt") - public void testInnerMadnessCallSite_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt", "kotlin.coroutines"); + @TestMetadata("innerLambdaInsideLambda.kt") + public void testInnerLambdaInsideLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt"); + } + + @TestMetadata("innerLambdaWithoutCrossinline.kt") + public void testInnerLambdaWithoutCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt"); } @TestMetadata("innerMadness.kt") - public void testInnerMadness_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt", "kotlin.coroutines"); + public void testInnerMadness() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt"); } - @TestMetadata("innerObjectInsideInnerObject.kt") - public void testInnerObjectInsideInnerObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectRetransformation.kt") - public void testInnerObjectRetransformation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectSeveralFunctions.kt") - public void testInnerObjectSeveralFunctions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectWithoutCapturingCrossinline.kt") - public void testInnerObjectWithoutCapturingCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt", "kotlin.coroutines"); + @TestMetadata("innerMadnessCallSite.kt") + public void testInnerMadnessCallSite() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt"); } @TestMetadata("innerObject.kt") - public void testInnerObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt", "kotlin.coroutines"); + public void testInnerObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt"); + } + + @TestMetadata("innerObjectInsideInnerObject.kt") + public void testInnerObjectInsideInnerObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt"); + } + + @TestMetadata("innerObjectRetransformation.kt") + public void testInnerObjectRetransformation() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt"); + } + + @TestMetadata("innerObjectSeveralFunctions.kt") + public void testInnerObjectSeveralFunctions() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt"); + } + + @TestMetadata("innerObjectWithoutCapturingCrossinline.kt") + public void testInnerObjectWithoutCapturingCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt"); } @TestMetadata("insideObject.kt") - public void testInsideObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt", "kotlin.coroutines"); + public void testInsideObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt"); } @TestMetadata("lambdaTransformation.kt") @@ -4400,43 +4384,43 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO } @TestMetadata("normalInline.kt") - public void testNormalInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt", "kotlin.coroutines"); + public void testNormalInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt"); } @TestMetadata("numberOfSuspentions.kt") - public void testNumberOfSuspentions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt", "kotlin.coroutines"); + public void testNumberOfSuspentions() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt"); } @TestMetadata("objectInsideLambdas.kt") - public void testObjectInsideLambdas_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt", "kotlin.coroutines"); + public void testObjectInsideLambdas() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt"); } @TestMetadata("oneInlineTwoCaptures.kt") - public void testOneInlineTwoCaptures_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt", "kotlin.coroutines"); + public void testOneInlineTwoCaptures() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt"); } @TestMetadata("passLambda.kt") - public void testPassLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt", "kotlin.coroutines"); - } - - @TestMetadata("passParameterLambda.kt") - public void testPassParameterLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt", "kotlin.coroutines"); + public void testPassLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt"); } @TestMetadata("passParameter.kt") - public void testPassParameter_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt", "kotlin.coroutines"); + public void testPassParameter() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt"); + } + + @TestMetadata("passParameterLambda.kt") + public void testPassParameterLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt"); } @TestMetadata("unreachableSuspendMarker.kt") - public void testUnreachableSuspendMarker_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt", "kotlin.coroutines"); + public void testUnreachableSuspendMarker() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt"); } } } diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java index 1a5dd9b4c01..2bf647867d7 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java @@ -25,10 +25,6 @@ public class JvmIrAgainstOldBoxTestGenerated extends AbstractJvmIrAgainstOldBoxT KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, testDataFilePath); - } - public void testAllFilesPresentInCompileKotlinAgainstKotlin() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, true); } @@ -99,8 +95,8 @@ public class JvmIrAgainstOldBoxTestGenerated extends AbstractJvmIrAgainstOldBoxT } @TestMetadata("coroutinesBinary.kt") - public void testCoroutinesBinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/compileKotlinAgainstKotlin/coroutinesBinary.kt", "kotlin.coroutines"); + public void testCoroutinesBinary() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/coroutinesBinary.kt"); } @TestMetadata("defaultConstructor.kt") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxInlineTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxInlineTestGenerated.java index 36a35e81b21..6adf46a8b9e 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxInlineTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxInlineTestGenerated.java @@ -3967,22 +3967,18 @@ public class JvmOldAgainstIrBoxInlineTestGenerated extends AbstractJvmOldAgainst KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); - } - public void testAllFilesPresentInSuspend() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, true); } @TestMetadata("capturedVariables.kt") - public void testCapturedVariables_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/capturedVariables.kt", "kotlin.coroutines"); + public void testCapturedVariables() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/capturedVariables.kt"); } @TestMetadata("crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt") - public void testCrossinlineSuspendLambdaInsideCrossinlineSuspendLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt", "kotlin.coroutines"); + public void testCrossinlineSuspendLambdaInsideCrossinlineSuspendLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt"); } @TestMetadata("debugMetadataCrossinline.kt") @@ -3991,18 +3987,18 @@ public class JvmOldAgainstIrBoxInlineTestGenerated extends AbstractJvmOldAgainst } @TestMetadata("delegatedProperties.kt") - public void testDelegatedProperties_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt", "kotlin.coroutines"); + public void testDelegatedProperties() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt"); } @TestMetadata("doubleRegenerationWithNonSuspendingLambda.kt") - public void testDoubleRegenerationWithNonSuspendingLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt", "kotlin.coroutines"); + public void testDoubleRegenerationWithNonSuspendingLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt"); } @TestMetadata("enclodingMethod.kt") - public void testEnclodingMethod_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/enclodingMethod.kt", "kotlin.coroutines"); + public void testEnclodingMethod() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/enclodingMethod.kt"); } @TestMetadata("fileNameInMetadata.kt") @@ -4011,18 +4007,18 @@ public class JvmOldAgainstIrBoxInlineTestGenerated extends AbstractJvmOldAgainst } @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendContinuation.kt") - public void testInlineSuspendContinuation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendContinuation.kt", "kotlin.coroutines"); + public void testInlineSuspendContinuation() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendContinuation.kt"); } @TestMetadata("inlineSuspendInMultifileClass.kt") @@ -4031,38 +4027,38 @@ public class JvmOldAgainstIrBoxInlineTestGenerated extends AbstractJvmOldAgainst } @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt"); } @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt"); } @TestMetadata("jvmName.kt") - public void testJvmName_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/jvmName.kt", "kotlin.coroutines"); + public void testJvmName() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/jvmName.kt"); } @TestMetadata("kt26658.kt") @@ -4071,18 +4067,18 @@ public class JvmOldAgainstIrBoxInlineTestGenerated extends AbstractJvmOldAgainst } @TestMetadata("maxStackWithCrossinline.kt") - public void testMaxStackWithCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt", "kotlin.coroutines"); + public void testMaxStackWithCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt"); } @TestMetadata("multipleLocals.kt") - public void testMultipleLocals_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines"); + public void testMultipleLocals() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt"); } @TestMetadata("multipleSuspensionPoints.kt") - public void testMultipleSuspensionPoints_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt", "kotlin.coroutines"); + public void testMultipleSuspensionPoints() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt"); } @TestMetadata("nestedMethodWith2XParameter.kt") @@ -4096,23 +4092,23 @@ public class JvmOldAgainstIrBoxInlineTestGenerated extends AbstractJvmOldAgainst } @TestMetadata("nonSuspendCrossinline.kt") - public void testNonSuspendCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt", "kotlin.coroutines"); + public void testNonSuspendCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt"); } @TestMetadata("returnValue.kt") - public void testReturnValue_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/returnValue.kt", "kotlin.coroutines"); + public void testReturnValue() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/returnValue.kt"); } @TestMetadata("tryCatchReceiver.kt") - public void testTryCatchReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt", "kotlin.coroutines"); + public void testTryCatchReceiver() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt"); } @TestMetadata("tryCatchStackTransform.kt") - public void testTryCatchStackTransform_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt", "kotlin.coroutines"); + public void testTryCatchStackTransform() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt"); } @TestMetadata("twiceRegeneratedAnonymousObject.kt") @@ -4171,17 +4167,13 @@ public class JvmOldAgainstIrBoxInlineTestGenerated extends AbstractJvmOldAgainst KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); - } - public void testAllFilesPresentInDefaultParameter() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/defaultParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, true); } @TestMetadata("defaultValueCrossinline.kt") - public void testDefaultValueCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt", "kotlin.coroutines"); + public void testDefaultValueCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt"); } @TestMetadata("defaultValueInClass.kt") @@ -4189,14 +4181,14 @@ public class JvmOldAgainstIrBoxInlineTestGenerated extends AbstractJvmOldAgainst runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInClass.kt"); } - @TestMetadata("defaultValueInlineFromMultiFileFacade.kt") - public void testDefaultValueInlineFromMultiFileFacade_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt", "kotlin.coroutines"); + @TestMetadata("defaultValueInline.kt") + public void testDefaultValueInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt"); } - @TestMetadata("defaultValueInline.kt") - public void testDefaultValueInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt", "kotlin.coroutines"); + @TestMetadata("defaultValueInlineFromMultiFileFacade.kt") + public void testDefaultValueInlineFromMultiFileFacade() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt"); } } @@ -4264,52 +4256,48 @@ public class JvmOldAgainstIrBoxInlineTestGenerated extends AbstractJvmOldAgainst KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); - } - public void testAllFilesPresentInReceiver() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/receiver"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, true); } @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt"); } @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt"); } } @@ -4321,77 +4309,73 @@ public class JvmOldAgainstIrBoxInlineTestGenerated extends AbstractJvmOldAgainst KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, testDataFilePath, "// IGNORE_BACKEND_MULTI_MODULE: "); - } - public void testAllFilesPresentInStateMachine() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/stateMachine"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, true); } @TestMetadata("crossingCoroutineBoundaries.kt") - public void testCrossingCoroutineBoundaries_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt", "kotlin.coroutines"); + public void testCrossingCoroutineBoundaries() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt"); } @TestMetadata("independentInline.kt") - public void testIndependentInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerLambdaInsideLambda.kt") - public void testInnerLambdaInsideLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerLambdaWithoutCrossinline.kt") - public void testInnerLambdaWithoutCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt", "kotlin.coroutines"); + public void testIndependentInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt"); } @TestMetadata("innerLambda.kt") - public void testInnerLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt", "kotlin.coroutines"); + public void testInnerLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt"); } - @TestMetadata("innerMadnessCallSite.kt") - public void testInnerMadnessCallSite_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt", "kotlin.coroutines"); + @TestMetadata("innerLambdaInsideLambda.kt") + public void testInnerLambdaInsideLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt"); + } + + @TestMetadata("innerLambdaWithoutCrossinline.kt") + public void testInnerLambdaWithoutCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt"); } @TestMetadata("innerMadness.kt") - public void testInnerMadness_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt", "kotlin.coroutines"); + public void testInnerMadness() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt"); } - @TestMetadata("innerObjectInsideInnerObject.kt") - public void testInnerObjectInsideInnerObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectRetransformation.kt") - public void testInnerObjectRetransformation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectSeveralFunctions.kt") - public void testInnerObjectSeveralFunctions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectWithoutCapturingCrossinline.kt") - public void testInnerObjectWithoutCapturingCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt", "kotlin.coroutines"); + @TestMetadata("innerMadnessCallSite.kt") + public void testInnerMadnessCallSite() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt"); } @TestMetadata("innerObject.kt") - public void testInnerObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt", "kotlin.coroutines"); + public void testInnerObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt"); + } + + @TestMetadata("innerObjectInsideInnerObject.kt") + public void testInnerObjectInsideInnerObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt"); + } + + @TestMetadata("innerObjectRetransformation.kt") + public void testInnerObjectRetransformation() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt"); + } + + @TestMetadata("innerObjectSeveralFunctions.kt") + public void testInnerObjectSeveralFunctions() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt"); + } + + @TestMetadata("innerObjectWithoutCapturingCrossinline.kt") + public void testInnerObjectWithoutCapturingCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt"); } @TestMetadata("insideObject.kt") - public void testInsideObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt", "kotlin.coroutines"); + public void testInsideObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt"); } @TestMetadata("lambdaTransformation.kt") @@ -4400,43 +4384,43 @@ public class JvmOldAgainstIrBoxInlineTestGenerated extends AbstractJvmOldAgainst } @TestMetadata("normalInline.kt") - public void testNormalInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt", "kotlin.coroutines"); + public void testNormalInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt"); } @TestMetadata("numberOfSuspentions.kt") - public void testNumberOfSuspentions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt", "kotlin.coroutines"); + public void testNumberOfSuspentions() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt"); } @TestMetadata("objectInsideLambdas.kt") - public void testObjectInsideLambdas_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt", "kotlin.coroutines"); + public void testObjectInsideLambdas() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt"); } @TestMetadata("oneInlineTwoCaptures.kt") - public void testOneInlineTwoCaptures_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt", "kotlin.coroutines"); + public void testOneInlineTwoCaptures() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt"); } @TestMetadata("passLambda.kt") - public void testPassLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt", "kotlin.coroutines"); - } - - @TestMetadata("passParameterLambda.kt") - public void testPassParameterLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt", "kotlin.coroutines"); + public void testPassLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt"); } @TestMetadata("passParameter.kt") - public void testPassParameter_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt", "kotlin.coroutines"); + public void testPassParameter() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt"); + } + + @TestMetadata("passParameterLambda.kt") + public void testPassParameterLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt"); } @TestMetadata("unreachableSuspendMarker.kt") - public void testUnreachableSuspendMarker_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt", "kotlin.coroutines"); + public void testUnreachableSuspendMarker() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt"); } } } diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java index a152a8fc6b2..b9e522e054a 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java @@ -25,10 +25,6 @@ public class JvmOldAgainstIrBoxTestGenerated extends AbstractJvmOldAgainstIrBoxT KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, testDataFilePath); - } - public void testAllFilesPresentInCompileKotlinAgainstKotlin() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, true); } @@ -99,8 +95,8 @@ public class JvmOldAgainstIrBoxTestGenerated extends AbstractJvmOldAgainstIrBoxT } @TestMetadata("coroutinesBinary.kt") - public void testCoroutinesBinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/compileKotlinAgainstKotlin/coroutinesBinary.kt", "kotlin.coroutines"); + public void testCoroutinesBinary() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/coroutinesBinary.kt"); } @TestMetadata("defaultConstructor.kt") diff --git a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt index 27a52900e5b..69e9121d2b7 100644 --- a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt +++ b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt @@ -509,8 +509,7 @@ fun main(args: Array) { testClass { model( "compileKotlinAgainstKotlin", - targetBackend = TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, - skipTestsForExperimentalCoroutines = true + targetBackend = TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR ) } @@ -634,8 +633,7 @@ fun main(args: Array) { testClass { model( "codegen/boxInline", - targetBackend = TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, - skipTestsForExperimentalCoroutines = true + targetBackend = TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR ) } } @@ -713,8 +711,7 @@ fun main(args: Array) { testClass { model( "diagnostics/testsWithStdLib", - excludedPattern = excludedFirTestdataPattern, - skipTestsForExperimentalCoroutines = true + excludedPattern = excludedFirTestdataPattern ) } } diff --git a/generators/test-generator/tests/org/jetbrains/kotlin/generators/tests/generator/RunTestMethodWithPackageReplacementModel.kt b/generators/test-generator/tests/org/jetbrains/kotlin/generators/tests/generator/RunTestMethodWithPackageReplacementModel.kt deleted file mode 100644 index ae7da1cc1f3..00000000000 --- a/generators/test-generator/tests/org/jetbrains/kotlin/generators/tests/generator/RunTestMethodWithPackageReplacementModel.kt +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.generators.tests.generator - -import org.jetbrains.kotlin.test.TargetBackend -import org.jetbrains.kotlin.utils.Printer - -class RunTestMethodWithPackageReplacementModel( - private val targetBackend: TargetBackend, - private val testMethodName: String, - private val testRunnerMethodName: String, - private val additionalRunnerArguments: List -) : MethodModel { - override val name = METHOD_NAME - override val dataString: String? = null - - override fun generateSignature(p: Printer) { - p.print("private void $name(String testDataFilePath, String packageName) throws Exception") - } - - override fun generateBody(p: Printer) { - val className = TargetBackend::class.java.simpleName - val additionalArguments = if (additionalRunnerArguments.isNotEmpty()) - additionalRunnerArguments.joinToString(separator = ", ", prefix = ", ") - else "" - p.println("KotlinTestUtils.$testRunnerMethodName(filePath -> $testMethodName(filePath, packageName), $className.$targetBackend, testDataFilePath$additionalArguments);") - } - - override fun imports(): Collection> { - return super.imports() + setOf(TargetBackend::class.java) - } - - companion object { - const val METHOD_NAME = "runTestWithPackageReplacement" - } -} \ No newline at end of file diff --git a/generators/test-generator/tests/org/jetbrains/kotlin/generators/tests/generator/SimpleTestClassModel.java b/generators/test-generator/tests/org/jetbrains/kotlin/generators/tests/generator/SimpleTestClassModel.java index c2bdff95e45..dbe9a2f1700 100644 --- a/generators/test-generator/tests/org/jetbrains/kotlin/generators/tests/generator/SimpleTestClassModel.java +++ b/generators/test-generator/tests/org/jetbrains/kotlin/generators/tests/generator/SimpleTestClassModel.java @@ -9,7 +9,6 @@ import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.generators.util.CoroutinesKt; import org.jetbrains.kotlin.test.KotlinTestUtils; import org.jetbrains.kotlin.test.TargetBackend; import org.jetbrains.kotlin.utils.Printer; @@ -17,7 +16,6 @@ import org.jetbrains.kotlin.utils.Printer; import java.io.File; import java.util.*; import java.util.regex.Pattern; -import java.util.stream.Collectors; public class SimpleTestClassModel extends TestClassModel { private static final Comparator BY_NAME = Comparator.comparing(TestEntityModel::getName); @@ -53,8 +51,6 @@ public class SimpleTestClassModel extends TestClassModel { private final String testRunnerMethodName; private final List additionalRunnerArguments; - private boolean skipTestsForExperimentalCoroutines; - public SimpleTestClassModel( @NotNull File rootFile, boolean recursive, @@ -70,8 +66,7 @@ public class SimpleTestClassModel extends TestClassModel { String testRunnerMethodName, List additionalRunnerArguments, Integer deep, - @NotNull Collection annotations, - boolean skipTestsForExperimentalCoroutines + @NotNull Collection annotations ) { this.rootFile = rootFile; this.recursive = recursive; @@ -88,7 +83,6 @@ public class SimpleTestClassModel extends TestClassModel { this.additionalRunnerArguments = additionalRunnerArguments; this.deep = deep; this.annotations = annotations; - this.skipTestsForExperimentalCoroutines = skipTestsForExperimentalCoroutines; } @NotNull @@ -108,8 +102,8 @@ public class SimpleTestClassModel extends TestClassModel { children.add(new SimpleTestClassModel( file, true, excludeParentDirs, filenamePattern, excludePattern, checkFilenameStartsLowerCase, doTestMethodName, innerTestClassName, targetBackend, excludesStripOneDirectory(file.getName()), - skipIgnored, testRunnerMethodName, additionalRunnerArguments, deep != null ? deep - 1 : null, annotations, - skipTestsForExperimentalCoroutines) + skipIgnored, testRunnerMethodName, additionalRunnerArguments, deep != null ? deep - 1 : null, annotations + ) ); } @@ -158,16 +152,9 @@ public class SimpleTestClassModel extends TestClassModel { public Collection getMethods() { if (testMethods == null) { if (!rootFile.isDirectory()) { - if (CoroutinesKt.isCommonCoroutineTest(rootFile)) { - testMethods = CoroutinesKt.createCommonCoroutinesTestMethodModels(rootFile, rootFile, filenamePattern, - checkFilenameStartsLowerCase, targetBackend, - skipIgnored, skipTestsForExperimentalCoroutines); - } - else { - testMethods = Collections.singletonList(new SimpleTestMethodModel( - rootFile, rootFile, filenamePattern, checkFilenameStartsLowerCase, targetBackend, skipIgnored - )); - } + testMethods = Collections.singletonList(new SimpleTestMethodModel( + rootFile, rootFile, filenamePattern, checkFilenameStartsLowerCase, targetBackend, skipIgnored + )); } else { List result = new ArrayList<>(); @@ -178,8 +165,6 @@ public class SimpleTestClassModel extends TestClassModel { File[] listFiles = rootFile.listFiles(); - boolean hasCoroutines = false; - if (listFiles != null && (deep == null || deep == 0)) { for (File file : listFiles) { boolean excluded = excludePattern != null && excludePattern.matcher(file.getName()).matches(); @@ -188,28 +173,11 @@ public class SimpleTestClassModel extends TestClassModel { if (file.isDirectory() && excludeParentDirs && dirHasSubDirs(file)) { continue; } - - if (!file.isDirectory() && CoroutinesKt.isCommonCoroutineTest(file)) { - hasCoroutines = true; - result.addAll(CoroutinesKt.createCommonCoroutinesTestMethodModels(rootFile, file, - filenamePattern, - checkFilenameStartsLowerCase, - targetBackend, skipIgnored, - skipTestsForExperimentalCoroutines)); - } - else { - result.add(new SimpleTestMethodModel(rootFile, file, filenamePattern, - checkFilenameStartsLowerCase, targetBackend, skipIgnored)); - } + result.add(new SimpleTestMethodModel(rootFile, file, filenamePattern, checkFilenameStartsLowerCase, targetBackend, skipIgnored)); } } } - if (hasCoroutines) { - String methodName = doTestMethodName + "WithCoroutinesPackageReplacement"; - result.add(new RunTestMethodWithPackageReplacementModel(targetBackend, methodName, testRunnerMethodName, additionalRunnerArguments)); - } - result.sort(BY_NAME); testMethods = result; diff --git a/generators/test-generator/tests/org/jetbrains/kotlin/generators/tests/generator/TestGenerationDSL.kt b/generators/test-generator/tests/org/jetbrains/kotlin/generators/tests/generator/TestGenerationDSL.kt index f9ca7941677..e0d31bd80a6 100644 --- a/generators/test-generator/tests/org/jetbrains/kotlin/generators/tests/generator/TestGenerationDSL.kt +++ b/generators/test-generator/tests/org/jetbrains/kotlin/generators/tests/generator/TestGenerationDSL.kt @@ -66,8 +66,7 @@ class TestGroup( excludeDirs: List = listOf(), filenameStartsLowerCase: Boolean? = null, skipIgnored: Boolean = false, - deep: Int? = null, - skipTestsForExperimentalCoroutines: Boolean = false + deep: Int? = null ) { val rootFile = File("$testDataRoot/$relativeRootPath") val compiledPattern = Pattern.compile(pattern) @@ -84,8 +83,7 @@ class TestGroup( SimpleTestClassModel( rootFile, recursive, excludeParentDirs, compiledPattern, compiledExcludedPattern, filenameStartsLowerCase, testMethod, className, - targetBackend, excludeDirs, skipIgnored, testRunnerMethodName, additionalRunnerArguments, deep, annotations, - skipTestsForExperimentalCoroutines + targetBackend, excludeDirs, skipIgnored, testRunnerMethodName, additionalRunnerArguments, deep, annotations ) } ) diff --git a/generators/test-generator/tests/org/jetbrains/kotlin/generators/util/coroutines.kt b/generators/test-generator/tests/org/jetbrains/kotlin/generators/util/coroutines.kt deleted file mode 100644 index 6f526277d52..00000000000 --- a/generators/test-generator/tests/org/jetbrains/kotlin/generators/util/coroutines.kt +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.generators.util - -import org.jetbrains.kotlin.generators.tests.generator.MethodModel -import org.jetbrains.kotlin.generators.tests.generator.RunTestMethodWithPackageReplacementModel -import org.jetbrains.kotlin.generators.tests.generator.SimpleTestMethodModel -import org.jetbrains.kotlin.test.InTextDirectivesUtils -import org.jetbrains.kotlin.test.KotlinTestUtils -import org.jetbrains.kotlin.test.TargetBackend -import org.jetbrains.kotlin.utils.Printer -import java.io.File -import java.util.regex.Pattern - -class CoroutinesTestModel( - rootDir: File, - file: File, - filenamePattern: Pattern, - checkFilenameStartsLowerCase: Boolean?, - targetBackend: TargetBackend, - skipIgnored: Boolean, - private val isLanguageVersion1_3: Boolean -) : SimpleTestMethodModel( - rootDir, - file, - filenamePattern, - checkFilenameStartsLowerCase, - targetBackend, - skipIgnored -) { - override val name: String - get() = super.name + if (isLanguageVersion1_3) "_1_3" else "_1_2" - - override fun generateBody(p: Printer) { - val filePath = KotlinTestUtils.getFilePath(file) + if (file.isDirectory) "/" else "" - val packageName = if (isLanguageVersion1_3) "kotlin.coroutines" else "kotlin.coroutines.experimental" - - p.println(RunTestMethodWithPackageReplacementModel.METHOD_NAME, "(\"$filePath\", \"$packageName\");") - } -} - -fun isCommonCoroutineTest(file: File): Boolean { - return InTextDirectivesUtils.isDirectiveDefined(file.readText(), "COMMON_COROUTINES_TEST") -} - -fun createCommonCoroutinesTestMethodModels( - rootDir: File, - file: File, - filenamePattern: Pattern, - checkFilenameStartsLowerCase: Boolean?, - targetBackend: TargetBackend, - skipIgnored: Boolean, - skipExperimental: Boolean -): Collection { - return if (targetBackend.isIR || targetBackend == TargetBackend.JS) - listOf( - CoroutinesTestModel( - rootDir, - file, - filenamePattern, - checkFilenameStartsLowerCase, - targetBackend, - skipIgnored, - true - ) - ) - else { - mutableListOf( - CoroutinesTestModel( - rootDir, - file, - filenamePattern, - checkFilenameStartsLowerCase, - targetBackend, - skipIgnored, - true - ) - ).apply { - if (!skipExperimental) { - this += CoroutinesTestModel( - rootDir, - file, - filenamePattern, - checkFilenameStartsLowerCase, - targetBackend, - skipIgnored, - false - ) - - } - } - } -} \ No newline at end of file diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index e2d8f4db811..16c667b847c 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -699,10 +699,6 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInJvm() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/assert/jvm"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @@ -3980,10 +3976,6 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInCapturedVarsOptimization() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/closures/capturedVarsOptimization"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @@ -4033,14 +4025,14 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/closures/capturedVarsOptimization/sharedSlotsWithCapturedVars.kt"); } - @TestMetadata("withCoroutinesNoStdLib.kt") - public void testWithCoroutinesNoStdLib_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutinesNoStdLib.kt", "kotlin.coroutines"); + @TestMetadata("withCoroutines.kt") + public void testWithCoroutines() throws Exception { + runTest("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt"); } - @TestMetadata("withCoroutines.kt") - public void testWithCoroutines_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt", "kotlin.coroutines"); + @TestMetadata("withCoroutinesNoStdLib.kt") + public void testWithCoroutinesNoStdLib() throws Exception { + runTest("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutinesNoStdLib.kt"); } } @@ -4241,10 +4233,6 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInContracts() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/contracts"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @@ -4290,8 +4278,8 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("kt39374.kt") - public void testKt39374_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/contracts/kt39374.kt", "kotlin.coroutines"); + public void testKt39374() throws Exception { + runTest("compiler/testData/codegen/box/contracts/kt39374.kt"); } @TestMetadata("lambdaParameter.kt") @@ -5400,18 +5388,14 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - @TestMetadata("32defaultParametersInSuspend.kt") - public void test32defaultParametersInSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/32defaultParametersInSuspend.kt", "kotlin.coroutines"); + public void test32defaultParametersInSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/32defaultParametersInSuspend.kt"); } @TestMetadata("accessorForSuspend.kt") - public void testAccessorForSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/accessorForSuspend.kt", "kotlin.coroutines"); + public void testAccessorForSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/accessorForSuspend.kt"); } public void testAllFilesPresentInCoroutines() throws Exception { @@ -5434,18 +5418,18 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("await.kt") - public void testAwait_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/await.kt", "kotlin.coroutines"); - } - - @TestMetadata("beginWithExceptionNoHandleException.kt") - public void testBeginWithExceptionNoHandleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/beginWithExceptionNoHandleException.kt", "kotlin.coroutines"); + public void testAwait() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/await.kt"); } @TestMetadata("beginWithException.kt") - public void testBeginWithException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/beginWithException.kt", "kotlin.coroutines"); + public void testBeginWithException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/beginWithException.kt"); + } + + @TestMetadata("beginWithExceptionNoHandleException.kt") + public void testBeginWithExceptionNoHandleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/beginWithExceptionNoHandleException.kt"); } @TestMetadata("builderInferenceAndGenericArrayAcessCall.kt") @@ -5469,58 +5453,58 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("capturedVarInSuspendLambda.kt") - public void testCapturedVarInSuspendLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt", "kotlin.coroutines"); + public void testCapturedVarInSuspendLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt"); } @TestMetadata("catchWithInlineInsideSuspend.kt") - public void testCatchWithInlineInsideSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/catchWithInlineInsideSuspend.kt", "kotlin.coroutines"); + public void testCatchWithInlineInsideSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/catchWithInlineInsideSuspend.kt"); } @TestMetadata("coercionToUnit.kt") - public void testCoercionToUnit_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/coercionToUnit.kt", "kotlin.coroutines"); + public void testCoercionToUnit() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/coercionToUnit.kt"); } @TestMetadata("controllerAccessFromInnerLambda.kt") - public void testControllerAccessFromInnerLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controllerAccessFromInnerLambda.kt", "kotlin.coroutines"); + public void testControllerAccessFromInnerLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controllerAccessFromInnerLambda.kt"); } @TestMetadata("coroutineContextInInlinedLambda.kt") - public void testCoroutineContextInInlinedLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/coroutineContextInInlinedLambda.kt", "kotlin.coroutines"); + public void testCoroutineContextInInlinedLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/coroutineContextInInlinedLambda.kt"); } @TestMetadata("createCoroutineSafe.kt") - public void testCreateCoroutineSafe_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/createCoroutineSafe.kt", "kotlin.coroutines"); + public void testCreateCoroutineSafe() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/createCoroutineSafe.kt"); } @TestMetadata("createCoroutinesOnManualInstances.kt") - public void testCreateCoroutinesOnManualInstances_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/createCoroutinesOnManualInstances.kt", "kotlin.coroutines"); + public void testCreateCoroutinesOnManualInstances() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/createCoroutinesOnManualInstances.kt"); } @TestMetadata("crossInlineWithCapturedOuterReceiver.kt") - public void testCrossInlineWithCapturedOuterReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/crossInlineWithCapturedOuterReceiver.kt", "kotlin.coroutines"); + public void testCrossInlineWithCapturedOuterReceiver() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/crossInlineWithCapturedOuterReceiver.kt"); } @TestMetadata("defaultParametersInSuspend.kt") - public void testDefaultParametersInSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/defaultParametersInSuspend.kt", "kotlin.coroutines"); + public void testDefaultParametersInSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/defaultParametersInSuspend.kt"); } @TestMetadata("delegatedSuspendMember.kt") - public void testDelegatedSuspendMember_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt", "kotlin.coroutines"); + public void testDelegatedSuspendMember() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt"); } @TestMetadata("dispatchResume.kt") - public void testDispatchResume_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/dispatchResume.kt", "kotlin.coroutines"); + public void testDispatchResume() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/dispatchResume.kt"); } @TestMetadata("doubleColonExpressionsGenerationInBuilderInference.kt") @@ -5529,8 +5513,8 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("emptyClosure.kt") - public void testEmptyClosure_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/emptyClosure.kt", "kotlin.coroutines"); + public void testEmptyClosure() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/emptyClosure.kt"); } @TestMetadata("emptyCommonConstraintSystemForCoroutineInferenceCall.kt") @@ -5539,118 +5523,118 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("epam.kt") - public void testEpam_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/epam.kt", "kotlin.coroutines"); + public void testEpam() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/epam.kt"); } @TestMetadata("falseUnitCoercion.kt") - public void testFalseUnitCoercion_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/falseUnitCoercion.kt", "kotlin.coroutines"); + public void testFalseUnitCoercion() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/falseUnitCoercion.kt"); } @TestMetadata("generate.kt") - public void testGenerate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/generate.kt", "kotlin.coroutines"); + public void testGenerate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/generate.kt"); } @TestMetadata("handleException.kt") - public void testHandleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleException.kt", "kotlin.coroutines"); + public void testHandleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleException.kt"); } @TestMetadata("handleResultCallEmptyBody.kt") - public void testHandleResultCallEmptyBody_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultCallEmptyBody.kt", "kotlin.coroutines"); + public void testHandleResultCallEmptyBody() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleResultCallEmptyBody.kt"); } @TestMetadata("handleResultNonUnitExpression.kt") - public void testHandleResultNonUnitExpression_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultNonUnitExpression.kt", "kotlin.coroutines"); + public void testHandleResultNonUnitExpression() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleResultNonUnitExpression.kt"); } @TestMetadata("handleResultSuspended.kt") - public void testHandleResultSuspended_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultSuspended.kt", "kotlin.coroutines"); + public void testHandleResultSuspended() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleResultSuspended.kt"); } @TestMetadata("indirectInlineUsedAsNonInline.kt") - public void testIndirectInlineUsedAsNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/indirectInlineUsedAsNonInline.kt", "kotlin.coroutines"); + public void testIndirectInlineUsedAsNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/indirectInlineUsedAsNonInline.kt"); } @TestMetadata("inlineFunInGenericClass.kt") - public void testInlineFunInGenericClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineFunInGenericClass.kt", "kotlin.coroutines"); + public void testInlineFunInGenericClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineFunInGenericClass.kt"); } @TestMetadata("inlineGenericFunCalledFromSubclass.kt") - public void testInlineGenericFunCalledFromSubclass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineGenericFunCalledFromSubclass.kt", "kotlin.coroutines"); + public void testInlineGenericFunCalledFromSubclass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineGenericFunCalledFromSubclass.kt"); } @TestMetadata("inlineSuspendFunction.kt") - public void testInlineSuspendFunction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineSuspendFunction.kt", "kotlin.coroutines"); + public void testInlineSuspendFunction() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineSuspendFunction.kt"); } @TestMetadata("inlineSuspendLambdaNonLocalReturn.kt") - public void testInlineSuspendLambdaNonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineSuspendLambdaNonLocalReturn.kt", "kotlin.coroutines"); + public void testInlineSuspendLambdaNonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineSuspendLambdaNonLocalReturn.kt"); } @TestMetadata("inlinedTryCatchFinally.kt") - public void testInlinedTryCatchFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlinedTryCatchFinally.kt", "kotlin.coroutines"); + public void testInlinedTryCatchFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlinedTryCatchFinally.kt"); } @TestMetadata("innerSuspensionCalls.kt") - public void testInnerSuspensionCalls_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/innerSuspensionCalls.kt", "kotlin.coroutines"); + public void testInnerSuspensionCalls() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/innerSuspensionCalls.kt"); } @TestMetadata("instanceOfContinuation.kt") - public void testInstanceOfContinuation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/instanceOfContinuation.kt", "kotlin.coroutines"); + public void testInstanceOfContinuation() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/instanceOfContinuation.kt"); } @TestMetadata("iterateOverArray.kt") - public void testIterateOverArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/iterateOverArray.kt", "kotlin.coroutines"); + public void testIterateOverArray() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/iterateOverArray.kt"); } @TestMetadata("kt12958.kt") - public void testKt12958_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt12958.kt", "kotlin.coroutines"); + public void testKt12958() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt12958.kt"); } @TestMetadata("kt15016.kt") - public void testKt15016_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15016.kt", "kotlin.coroutines"); + public void testKt15016() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt15016.kt"); } @TestMetadata("kt15017.kt") - public void testKt15017_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15017.kt", "kotlin.coroutines"); + public void testKt15017() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt15017.kt"); } @TestMetadata("kt15930.kt") - public void testKt15930_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15930.kt", "kotlin.coroutines"); + public void testKt15930() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt15930.kt"); } @TestMetadata("kt21605.kt") - public void testKt21605_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt21605.kt", "kotlin.coroutines"); + public void testKt21605() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt21605.kt"); } @TestMetadata("kt25912.kt") - public void testKt25912_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt25912.kt", "kotlin.coroutines"); + public void testKt25912() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt25912.kt"); } @TestMetadata("kt28844.kt") - public void testKt28844_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt28844.kt", "kotlin.coroutines"); + public void testKt28844() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt28844.kt"); } @TestMetadata("kt30858.kt") @@ -5679,23 +5663,23 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("lastExpressionIsLoop.kt") - public void testLastExpressionIsLoop_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt", "kotlin.coroutines"); + public void testLastExpressionIsLoop() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt"); } @TestMetadata("lastStatementInc.kt") - public void testLastStatementInc_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastStatementInc.kt", "kotlin.coroutines"); + public void testLastStatementInc() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastStatementInc.kt"); } @TestMetadata("lastStementAssignment.kt") - public void testLastStementAssignment_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastStementAssignment.kt", "kotlin.coroutines"); + public void testLastStementAssignment() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastStementAssignment.kt"); } @TestMetadata("lastUnitExpression.kt") - public void testLastUnitExpression_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastUnitExpression.kt", "kotlin.coroutines"); + public void testLastUnitExpression() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastUnitExpression.kt"); } @TestMetadata("localCallableRef.kt") @@ -5704,53 +5688,53 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("localDelegate.kt") - public void testLocalDelegate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localDelegate.kt", "kotlin.coroutines"); + public void testLocalDelegate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localDelegate.kt"); } @TestMetadata("longRangeInSuspendCall.kt") - public void testLongRangeInSuspendCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/longRangeInSuspendCall.kt", "kotlin.coroutines"); + public void testLongRangeInSuspendCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/longRangeInSuspendCall.kt"); } @TestMetadata("longRangeInSuspendFun.kt") - public void testLongRangeInSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/longRangeInSuspendFun.kt", "kotlin.coroutines"); + public void testLongRangeInSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/longRangeInSuspendFun.kt"); } @TestMetadata("mergeNullAndString.kt") - public void testMergeNullAndString_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/mergeNullAndString.kt", "kotlin.coroutines"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda1.kt") - public void testMultipleInvokeCallsInsideInlineLambda1_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt", "kotlin.coroutines"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda2.kt") - public void testMultipleInvokeCallsInsideInlineLambda2_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt", "kotlin.coroutines"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda3.kt") - public void testMultipleInvokeCallsInsideInlineLambda3_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt", "kotlin.coroutines"); + public void testMergeNullAndString() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/mergeNullAndString.kt"); } @TestMetadata("multipleInvokeCalls.kt") - public void testMultipleInvokeCalls_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt", "kotlin.coroutines"); + public void testMultipleInvokeCalls() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt"); + } + + @TestMetadata("multipleInvokeCallsInsideInlineLambda1.kt") + public void testMultipleInvokeCallsInsideInlineLambda1() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt"); + } + + @TestMetadata("multipleInvokeCallsInsideInlineLambda2.kt") + public void testMultipleInvokeCallsInsideInlineLambda2() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt"); + } + + @TestMetadata("multipleInvokeCallsInsideInlineLambda3.kt") + public void testMultipleInvokeCallsInsideInlineLambda3() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt"); } @TestMetadata("nestedTryCatch.kt") - public void testNestedTryCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nestedTryCatch.kt", "kotlin.coroutines"); + public void testNestedTryCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/nestedTryCatch.kt"); } @TestMetadata("noSuspensionPoints.kt") - public void testNoSuspensionPoints_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noSuspensionPoints.kt", "kotlin.coroutines"); + public void testNoSuspensionPoints() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/noSuspensionPoints.kt"); } @TestMetadata("nonLocalReturn.kt") @@ -5758,34 +5742,39 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/coroutines/nonLocalReturn.kt"); } - @TestMetadata("nonLocalReturnFromInlineLambdaDeep.kt") - public void testNonLocalReturnFromInlineLambdaDeep_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt", "kotlin.coroutines"); + @TestMetadata("nonLocalReturnFromInlineLambda.kt") + public void testNonLocalReturnFromInlineLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt"); } - @TestMetadata("nonLocalReturnFromInlineLambda.kt") - public void testNonLocalReturnFromInlineLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt", "kotlin.coroutines"); + @TestMetadata("nonLocalReturnFromInlineLambdaDeep.kt") + public void testNonLocalReturnFromInlineLambdaDeep() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt"); } @TestMetadata("overrideDefaultArgument.kt") - public void testOverrideDefaultArgument_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/overrideDefaultArgument.kt", "kotlin.coroutines"); + public void testOverrideDefaultArgument() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/overrideDefaultArgument.kt"); } @TestMetadata("recursiveSuspend.kt") - public void testRecursiveSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/recursiveSuspend.kt", "kotlin.coroutines"); + public void testRecursiveSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/recursiveSuspend.kt"); } @TestMetadata("returnByLabel.kt") - public void testReturnByLabel_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/returnByLabel.kt", "kotlin.coroutines"); + public void testReturnByLabel() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/returnByLabel.kt"); + } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/simple.kt"); } @TestMetadata("simpleException.kt") - public void testSimpleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simpleException.kt", "kotlin.coroutines"); + public void testSimpleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/simpleException.kt"); } @TestMetadata("simpleSuspendCallableReference.kt") @@ -5794,18 +5783,13 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("simpleWithHandleResult.kt") - public void testSimpleWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simpleWithHandleResult.kt", "kotlin.coroutines"); - } - - @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simple.kt", "kotlin.coroutines"); + public void testSimpleWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/simpleWithHandleResult.kt"); } @TestMetadata("statementLikeLastExpression.kt") - public void testStatementLikeLastExpression_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/statementLikeLastExpression.kt", "kotlin.coroutines"); + public void testStatementLikeLastExpression() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/statementLikeLastExpression.kt"); } @TestMetadata("stopAfter.kt") @@ -5814,33 +5798,33 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("suspendCallsInArguments.kt") - public void testSuspendCallsInArguments_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendCallsInArguments.kt", "kotlin.coroutines"); + public void testSuspendCallsInArguments() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendCallsInArguments.kt"); } @TestMetadata("suspendCoroutineFromStateMachine.kt") - public void testSuspendCoroutineFromStateMachine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt", "kotlin.coroutines"); + public void testSuspendCoroutineFromStateMachine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt"); } @TestMetadata("suspendDefaultImpl.kt") - public void testSuspendDefaultImpl_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendDefaultImpl.kt", "kotlin.coroutines"); + public void testSuspendDefaultImpl() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendDefaultImpl.kt"); } @TestMetadata("suspendDelegation.kt") - public void testSuspendDelegation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendDelegation.kt", "kotlin.coroutines"); + public void testSuspendDelegation() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendDelegation.kt"); } @TestMetadata("suspendFromInlineLambda.kt") - public void testSuspendFromInlineLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt", "kotlin.coroutines"); + public void testSuspendFromInlineLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt"); } @TestMetadata("suspendFunImportedFromObject.kt") - public void testSuspendFunImportedFromObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunImportedFromObject.kt", "kotlin.coroutines"); + public void testSuspendFunImportedFromObject() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunImportedFromObject.kt"); } @TestMetadata("suspendFunctionMethodReference.kt") @@ -5849,23 +5833,23 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("suspendInCycle.kt") - public void testSuspendInCycle_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInCycle.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt") - public void testSuspendInTheMiddleOfObjectConstructionEvaluationOrder_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendInTheMiddleOfObjectConstructionWithJumpOut.kt") - public void testSuspendInTheMiddleOfObjectConstructionWithJumpOut_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionWithJumpOut.kt", "kotlin.coroutines"); + public void testSuspendInCycle() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInCycle.kt"); } @TestMetadata("suspendInTheMiddleOfObjectConstruction.kt") - public void testSuspendInTheMiddleOfObjectConstruction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt", "kotlin.coroutines"); + public void testSuspendInTheMiddleOfObjectConstruction() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt"); + } + + @TestMetadata("suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt") + public void testSuspendInTheMiddleOfObjectConstructionEvaluationOrder() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt"); + } + + @TestMetadata("suspendInTheMiddleOfObjectConstructionWithJumpOut.kt") + public void testSuspendInTheMiddleOfObjectConstructionWithJumpOut() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionWithJumpOut.kt"); } @TestMetadata("suspendLambdaInInterface.kt") @@ -5874,18 +5858,18 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("suspendLambdaWithArgumentRearrangement.kt") - public void testSuspendLambdaWithArgumentRearrangement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendLambdaWithArgumentRearrangement.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspensionInsideSafeCallWithElvis.kt") - public void testSuspensionInsideSafeCallWithElvis_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt", "kotlin.coroutines"); + public void testSuspendLambdaWithArgumentRearrangement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendLambdaWithArgumentRearrangement.kt"); } @TestMetadata("suspensionInsideSafeCall.kt") - public void testSuspensionInsideSafeCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCall.kt", "kotlin.coroutines"); + public void testSuspensionInsideSafeCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCall.kt"); + } + + @TestMetadata("suspensionInsideSafeCallWithElvis.kt") + public void testSuspensionInsideSafeCallWithElvis() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt"); } @TestMetadata("tailCallToNothing.kt") @@ -5894,38 +5878,38 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("tryCatchFinallyWithHandleResult.kt") - public void testTryCatchFinallyWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt", "kotlin.coroutines"); + public void testTryCatchFinallyWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt"); } @TestMetadata("tryCatchWithHandleResult.kt") - public void testTryCatchWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryCatchWithHandleResult.kt", "kotlin.coroutines"); + public void testTryCatchWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryCatchWithHandleResult.kt"); } @TestMetadata("tryFinallyInsideInlineLambda.kt") - public void testTryFinallyInsideInlineLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt", "kotlin.coroutines"); + public void testTryFinallyInsideInlineLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt"); } @TestMetadata("tryFinallyWithHandleResult.kt") - public void testTryFinallyWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryFinallyWithHandleResult.kt", "kotlin.coroutines"); + public void testTryFinallyWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryFinallyWithHandleResult.kt"); } @TestMetadata("varCaptuedInCoroutineIntrinsic.kt") - public void testVarCaptuedInCoroutineIntrinsic_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varCaptuedInCoroutineIntrinsic.kt", "kotlin.coroutines"); - } - - @TestMetadata("varValueConflictsWithTableSameSort.kt") - public void testVarValueConflictsWithTableSameSort_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt", "kotlin.coroutines"); + public void testVarCaptuedInCoroutineIntrinsic() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varCaptuedInCoroutineIntrinsic.kt"); } @TestMetadata("varValueConflictsWithTable.kt") - public void testVarValueConflictsWithTable_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varValueConflictsWithTable.kt", "kotlin.coroutines"); + public void testVarValueConflictsWithTable() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varValueConflictsWithTable.kt"); + } + + @TestMetadata("varValueConflictsWithTableSameSort.kt") + public void testVarValueConflictsWithTableSameSort() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt"); } @TestMetadata("compiler/testData/codegen/box/coroutines/bridges") @@ -5936,27 +5920,23 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInBridges() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/bridges"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @TestMetadata("interfaceSpecialization.kt") - public void testInterfaceSpecialization_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/interfaceSpecialization.kt", "kotlin.coroutines"); + public void testInterfaceSpecialization() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/bridges/interfaceSpecialization.kt"); } @TestMetadata("lambdaWithLongReceiver.kt") - public void testLambdaWithLongReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/lambdaWithLongReceiver.kt", "kotlin.coroutines"); + public void testLambdaWithLongReceiver() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithLongReceiver.kt"); } @TestMetadata("lambdaWithMultipleParameters.kt") - public void testLambdaWithMultipleParameters_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt", "kotlin.coroutines"); + public void testLambdaWithMultipleParameters() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt"); } } @@ -5968,62 +5948,58 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInControlFlow() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/controlFlow"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @TestMetadata("breakFinally.kt") - public void testBreakFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/breakFinally.kt", "kotlin.coroutines"); + public void testBreakFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/breakFinally.kt"); } @TestMetadata("breakStatement.kt") - public void testBreakStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/breakStatement.kt", "kotlin.coroutines"); + public void testBreakStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/breakStatement.kt"); } @TestMetadata("complexChainSuspend.kt") - public void testComplexChainSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/complexChainSuspend.kt", "kotlin.coroutines"); + public void testComplexChainSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/complexChainSuspend.kt"); } @TestMetadata("doWhileStatement.kt") - public void testDoWhileStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/doWhileStatement.kt", "kotlin.coroutines"); + public void testDoWhileStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/doWhileStatement.kt"); } @TestMetadata("doubleBreak.kt") - public void testDoubleBreak_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/doubleBreak.kt", "kotlin.coroutines"); + public void testDoubleBreak() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/doubleBreak.kt"); } @TestMetadata("finallyCatch.kt") - public void testFinallyCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/finallyCatch.kt", "kotlin.coroutines"); + public void testFinallyCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/finallyCatch.kt"); } @TestMetadata("forContinue.kt") - public void testForContinue_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forContinue.kt", "kotlin.coroutines"); + public void testForContinue() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/forContinue.kt"); } @TestMetadata("forStatement.kt") - public void testForStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forStatement.kt", "kotlin.coroutines"); + public void testForStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/forStatement.kt"); } @TestMetadata("forWithStep.kt") - public void testForWithStep_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forWithStep.kt", "kotlin.coroutines"); + public void testForWithStep() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/forWithStep.kt"); } @TestMetadata("ifStatement.kt") - public void testIfStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt", "kotlin.coroutines"); + public void testIfStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt"); } @TestMetadata("kt22694_1_3.kt") @@ -6032,58 +6008,58 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("labeledWhile.kt") - public void testLabeledWhile_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/labeledWhile.kt", "kotlin.coroutines"); + public void testLabeledWhile() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/labeledWhile.kt"); } @TestMetadata("multipleCatchBlocksSuspend.kt") - public void testMultipleCatchBlocksSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/multipleCatchBlocksSuspend.kt", "kotlin.coroutines"); + public void testMultipleCatchBlocksSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/multipleCatchBlocksSuspend.kt"); } @TestMetadata("returnFromFinally.kt") - public void testReturnFromFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/returnFromFinally.kt", "kotlin.coroutines"); + public void testReturnFromFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/returnFromFinally.kt"); } @TestMetadata("returnWithFinally.kt") - public void testReturnWithFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/returnWithFinally.kt", "kotlin.coroutines"); + public void testReturnWithFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/returnWithFinally.kt"); } @TestMetadata("suspendInStringTemplate.kt") - public void testSuspendInStringTemplate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/suspendInStringTemplate.kt", "kotlin.coroutines"); + public void testSuspendInStringTemplate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/suspendInStringTemplate.kt"); } @TestMetadata("switchLikeWhen.kt") - public void testSwitchLikeWhen_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/switchLikeWhen.kt", "kotlin.coroutines"); + public void testSwitchLikeWhen() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/switchLikeWhen.kt"); } @TestMetadata("throwFromCatch.kt") - public void testThrowFromCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwFromCatch.kt", "kotlin.coroutines"); + public void testThrowFromCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/throwFromCatch.kt"); } @TestMetadata("throwFromFinally.kt") - public void testThrowFromFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwFromFinally.kt", "kotlin.coroutines"); + public void testThrowFromFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/throwFromFinally.kt"); } @TestMetadata("throwInTryWithHandleResult.kt") - public void testThrowInTryWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt", "kotlin.coroutines"); + public void testThrowInTryWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt"); } @TestMetadata("whenWithSuspensions.kt") - public void testWhenWithSuspensions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/whenWithSuspensions.kt", "kotlin.coroutines"); + public void testWhenWithSuspensions() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/whenWithSuspensions.kt"); } @TestMetadata("whileStatement.kt") - public void testWhileStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/whileStatement.kt", "kotlin.coroutines"); + public void testWhileStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/whileStatement.kt"); } } @@ -6108,17 +6084,13 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInFeatureIntersection() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/featureIntersection"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @TestMetadata("breakWithNonEmptyStack.kt") - public void testBreakWithNonEmptyStack_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt", "kotlin.coroutines"); + public void testBreakWithNonEmptyStack() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt"); } @TestMetadata("defaultExpect.kt") @@ -6127,18 +6099,18 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("delegate.kt") - public void testDelegate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt", "kotlin.coroutines"); + public void testDelegate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt"); } @TestMetadata("destructuringInLambdas.kt") - public void testDestructuringInLambdas_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt", "kotlin.coroutines"); + public void testDestructuringInLambdas() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt"); } @TestMetadata("inlineSuspendFinally.kt") - public void testInlineSuspendFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/inlineSuspendFinally.kt", "kotlin.coroutines"); + public void testInlineSuspendFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/inlineSuspendFinally.kt"); } @TestMetadata("interfaceMethodWithBody.kt") @@ -6156,19 +6128,19 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/coroutines/featureIntersection/overrideInInlineClass.kt"); } - @TestMetadata("safeCallOnTwoReceiversLong.kt") - public void testSafeCallOnTwoReceiversLong_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt", "kotlin.coroutines"); + @TestMetadata("safeCallOnTwoReceivers.kt") + public void testSafeCallOnTwoReceivers() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt"); } - @TestMetadata("safeCallOnTwoReceivers.kt") - public void testSafeCallOnTwoReceivers_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt", "kotlin.coroutines"); + @TestMetadata("safeCallOnTwoReceiversLong.kt") + public void testSafeCallOnTwoReceiversLong() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt"); } @TestMetadata("suspendDestructuringInLambdas.kt") - public void testSuspendDestructuringInLambdas_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt", "kotlin.coroutines"); + public void testSuspendDestructuringInLambdas() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt"); } @TestMetadata("suspendFunctionIsAs.kt") @@ -6177,23 +6149,23 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("suspendInlineSuspendFinally.kt") - public void testSuspendInlineSuspendFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendInlineSuspendFinally.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendOperatorPlusAssign.kt") - public void testSuspendOperatorPlusAssign_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusAssign.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendOperatorPlusCallFromLambda.kt") - public void testSuspendOperatorPlusCallFromLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusCallFromLambda.kt", "kotlin.coroutines"); + public void testSuspendInlineSuspendFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendInlineSuspendFinally.kt"); } @TestMetadata("suspendOperatorPlus.kt") - public void testSuspendOperatorPlus_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlus.kt", "kotlin.coroutines"); + public void testSuspendOperatorPlus() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlus.kt"); + } + + @TestMetadata("suspendOperatorPlusAssign.kt") + public void testSuspendOperatorPlusAssign() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusAssign.kt"); + } + + @TestMetadata("suspendOperatorPlusCallFromLambda.kt") + public void testSuspendOperatorPlusCallFromLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusCallFromLambda.kt"); } @TestMetadata("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference") @@ -6204,17 +6176,13 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInCallableReference() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @TestMetadata("bigArity.kt") - public void testBigArity_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/bigArity.kt", "kotlin.coroutines"); + public void testBigArity() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/bigArity.kt"); } @TestMetadata("longArgs.kt") @@ -6285,77 +6253,73 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInTailrec() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @TestMetadata("controlFlowIf.kt") - public void testControlFlowIf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowIf.kt", "kotlin.coroutines"); + public void testControlFlowIf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowIf.kt"); } @TestMetadata("controlFlowWhen.kt") - public void testControlFlowWhen_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowWhen.kt", "kotlin.coroutines"); + public void testControlFlowWhen() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowWhen.kt"); } @TestMetadata("extention.kt") - public void testExtention_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/extention.kt", "kotlin.coroutines"); + public void testExtention() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/extention.kt"); } @TestMetadata("infixCall.kt") - public void testInfixCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixCall.kt", "kotlin.coroutines"); + public void testInfixCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixCall.kt"); } @TestMetadata("infixRecursiveCall.kt") - public void testInfixRecursiveCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixRecursiveCall.kt", "kotlin.coroutines"); + public void testInfixRecursiveCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixRecursiveCall.kt"); } @TestMetadata("realIteratorFoldl.kt") - public void testRealIteratorFoldl_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realIteratorFoldl.kt", "kotlin.coroutines"); + public void testRealIteratorFoldl() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realIteratorFoldl.kt"); } @TestMetadata("realStringEscape.kt") - public void testRealStringEscape_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringEscape.kt", "kotlin.coroutines"); + public void testRealStringEscape() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringEscape.kt"); } @TestMetadata("realStringRepeat.kt") - public void testRealStringRepeat_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringRepeat.kt", "kotlin.coroutines"); + public void testRealStringRepeat() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringRepeat.kt"); } @TestMetadata("returnInParentheses.kt") - public void testReturnInParentheses_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/returnInParentheses.kt", "kotlin.coroutines"); + public void testReturnInParentheses() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/returnInParentheses.kt"); } @TestMetadata("sum.kt") - public void testSum_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/sum.kt", "kotlin.coroutines"); + public void testSum() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/sum.kt"); } @TestMetadata("tailCallInBlockInParentheses.kt") - public void testTailCallInBlockInParentheses_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInBlockInParentheses.kt", "kotlin.coroutines"); + public void testTailCallInBlockInParentheses() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInBlockInParentheses.kt"); } @TestMetadata("tailCallInParentheses.kt") - public void testTailCallInParentheses_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInParentheses.kt", "kotlin.coroutines"); + public void testTailCallInParentheses() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInParentheses.kt"); } @TestMetadata("whenWithIs.kt") - public void testWhenWithIs_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/whenWithIs.kt", "kotlin.coroutines"); + public void testWhenWithIs() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/whenWithIs.kt"); } } } @@ -6385,10 +6349,6 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInDirect() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses/direct"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @@ -6404,58 +6364,58 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Any.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineInt() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineInt.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Int.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Long() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Long.kt"); } @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_NAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_NAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_nonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_nonLocalReturn.kt"); } @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_suspendFunType() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_suspendFunType.kt"); } @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationCrossinline.kt", "kotlin.coroutines"); + public void testBridgeGenerationCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationCrossinline.kt"); } @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationNonInline.kt", "kotlin.coroutines"); + public void testBridgeGenerationNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationNonInline.kt"); } @TestMetadata("covariantOverrideSuspendFun.kt") @@ -6569,8 +6529,8 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); + public void testInterfaceDelegateWithInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt"); } @TestMetadata("invokeOperator.kt") @@ -6579,28 +6539,28 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt"); } @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any.kt"); } @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_itf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_itf.kt"); } @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_this.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_this() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_this.kt"); } @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Int.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Int.kt"); } @TestMetadata("returnResult.kt") @@ -6617,10 +6577,6 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInResume() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses/resume"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @@ -6636,58 +6592,58 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Any.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineInt() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineInt.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Int.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Long() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Long.kt"); } @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_NAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_NAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_nonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_nonLocalReturn.kt"); } @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_suspendFunType() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_suspendFunType.kt"); } @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationCrossinline.kt", "kotlin.coroutines"); + public void testBridgeGenerationCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationCrossinline.kt"); } @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationNonInline.kt", "kotlin.coroutines"); + public void testBridgeGenerationNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationNonInline.kt"); } @TestMetadata("covariantOverrideSuspendFun.kt") @@ -6801,8 +6757,8 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); + public void testInterfaceDelegateWithInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt"); } @TestMetadata("invokeOperator.kt") @@ -6811,28 +6767,28 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt"); } @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any.kt"); } @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_itf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_itf.kt"); } @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_this.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_this() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_this.kt"); } @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Int.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Int.kt"); } @TestMetadata("returnResult.kt") @@ -6849,10 +6805,6 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInResumeWithException() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @@ -6868,58 +6820,58 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Any.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineInt() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineInt.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Int.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Long() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Long.kt"); } @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_NAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_NAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_nonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_nonLocalReturn.kt"); } @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_suspendFunType() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_suspendFunType.kt"); } @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationCrossinline.kt", "kotlin.coroutines"); + public void testBridgeGenerationCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationCrossinline.kt"); } @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationNonInline.kt", "kotlin.coroutines"); + public void testBridgeGenerationNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationNonInline.kt"); } @TestMetadata("covariantOverrideSuspendFun.kt") @@ -7018,8 +6970,8 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); + public void testInterfaceDelegateWithInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt"); } @TestMetadata("invokeOperator.kt") @@ -7028,28 +6980,28 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt"); } @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any.kt"); } @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_itf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_itf.kt"); } @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_this.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_this() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_this.kt"); } @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Int.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Int.kt"); } @TestMetadata("returnResult.kt") @@ -7067,22 +7019,18 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInIntLikeVarSpilling() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/intLikeVarSpilling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @TestMetadata("complicatedMerge.kt") - public void testComplicatedMerge_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt", "kotlin.coroutines"); + public void testComplicatedMerge() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt"); } @TestMetadata("i2bResult.kt") - public void testI2bResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines"); + public void testI2bResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt"); } @TestMetadata("listThrowablePairInOneSlot.kt") @@ -7091,33 +7039,33 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("loadFromBooleanArray.kt") - public void testLoadFromBooleanArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines"); + public void testLoadFromBooleanArray() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt"); } @TestMetadata("loadFromByteArray.kt") - public void testLoadFromByteArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt", "kotlin.coroutines"); + public void testLoadFromByteArray() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt"); } @TestMetadata("noVariableInTable.kt") - public void testNoVariableInTable_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt", "kotlin.coroutines"); + public void testNoVariableInTable() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt"); } @TestMetadata("sameIconst1ManyVars.kt") - public void testSameIconst1ManyVars_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt", "kotlin.coroutines"); + public void testSameIconst1ManyVars() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt"); } @TestMetadata("usedInMethodCall.kt") - public void testUsedInMethodCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt", "kotlin.coroutines"); + public void testUsedInMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt"); } @TestMetadata("usedInVarStore.kt") - public void testUsedInVarStore_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt", "kotlin.coroutines"); + public void testUsedInVarStore() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt"); } } @@ -7129,52 +7077,48 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInIntrinsicSemantics() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/intrinsicSemantics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } - @TestMetadata("coroutineContextReceiverNotIntrinsic.kt") - public void testCoroutineContextReceiverNotIntrinsic_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiverNotIntrinsic.kt", "kotlin.coroutines"); + @TestMetadata("coroutineContext.kt") + public void testCoroutineContext() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContext.kt"); } @TestMetadata("coroutineContextReceiver.kt") - public void testCoroutineContextReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiver.kt", "kotlin.coroutines"); + public void testCoroutineContextReceiver() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiver.kt"); } - @TestMetadata("coroutineContext.kt") - public void testCoroutineContext_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContext.kt", "kotlin.coroutines"); + @TestMetadata("coroutineContextReceiverNotIntrinsic.kt") + public void testCoroutineContextReceiverNotIntrinsic() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiverNotIntrinsic.kt"); } @TestMetadata("intercepted.kt") - public void testIntercepted_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/intercepted.kt", "kotlin.coroutines"); - } - - @TestMetadata("startCoroutineUninterceptedOrReturnInterception.kt") - public void testStartCoroutineUninterceptedOrReturnInterception_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt", "kotlin.coroutines"); - } - - @TestMetadata("startCoroutineUninterceptedOrReturn.kt") - public void testStartCoroutineUninterceptedOrReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt", "kotlin.coroutines"); + public void testIntercepted() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/intercepted.kt"); } @TestMetadata("startCoroutine.kt") - public void testStartCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt", "kotlin.coroutines"); + public void testStartCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt"); + } + + @TestMetadata("startCoroutineUninterceptedOrReturn.kt") + public void testStartCoroutineUninterceptedOrReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt"); + } + + @TestMetadata("startCoroutineUninterceptedOrReturnInterception.kt") + public void testStartCoroutineUninterceptedOrReturnInterception() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt"); } @TestMetadata("suspendCoroutineUninterceptedOrReturn.kt") - public void testSuspendCoroutineUninterceptedOrReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/suspendCoroutineUninterceptedOrReturn.kt", "kotlin.coroutines"); + public void testSuspendCoroutineUninterceptedOrReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/suspendCoroutineUninterceptedOrReturn.kt"); } } @@ -7186,10 +7130,6 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInJavaInterop() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @@ -7215,17 +7155,13 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInAnonymous() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/localFunctions/anonymous"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/anonymous/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/anonymous/simple.kt"); } } @@ -7237,62 +7173,58 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInNamed() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/localFunctions/named"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @TestMetadata("capturedParameters.kt") - public void testCapturedParameters_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedParameters.kt", "kotlin.coroutines"); + public void testCapturedParameters() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedParameters.kt"); } @TestMetadata("capturedVariables.kt") - public void testCapturedVariables_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedVariables.kt", "kotlin.coroutines"); + public void testCapturedVariables() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedVariables.kt"); } @TestMetadata("extension.kt") - public void testExtension_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/extension.kt", "kotlin.coroutines"); + public void testExtension() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/extension.kt"); } @TestMetadata("infix.kt") - public void testInfix_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/infix.kt", "kotlin.coroutines"); + public void testInfix() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/infix.kt"); } @TestMetadata("insideLambda.kt") - public void testInsideLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/insideLambda.kt", "kotlin.coroutines"); + public void testInsideLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/insideLambda.kt"); } @TestMetadata("nestedLocals.kt") - public void testNestedLocals_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/nestedLocals.kt", "kotlin.coroutines"); - } - - @TestMetadata("simpleSuspensionPoint.kt") - public void testSimpleSuspensionPoint_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/simpleSuspensionPoint.kt", "kotlin.coroutines"); + public void testNestedLocals() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/nestedLocals.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/simple.kt"); + } + + @TestMetadata("simpleSuspensionPoint.kt") + public void testSimpleSuspensionPoint() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/simpleSuspensionPoint.kt"); } @TestMetadata("stateMachine.kt") - public void testStateMachine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/stateMachine.kt", "kotlin.coroutines"); + public void testStateMachine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/stateMachine.kt"); } @TestMetadata("withArguments.kt") - public void testWithArguments_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/withArguments.kt", "kotlin.coroutines"); + public void testWithArguments() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/withArguments.kt"); } } } @@ -7305,52 +7237,48 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInMultiModule() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @TestMetadata("inlineCrossModule.kt") - public void testInlineCrossModule_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt", "kotlin.coroutines"); + public void testInlineCrossModule() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt"); } @TestMetadata("inlineFunctionWithOptionalParam.kt") - public void testInlineFunctionWithOptionalParam_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt", "kotlin.coroutines"); - } - - @TestMetadata("inlineMultiModuleOverride.kt") - public void testInlineMultiModuleOverride_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleOverride.kt", "kotlin.coroutines"); - } - - @TestMetadata("inlineMultiModuleWithController.kt") - public void testInlineMultiModuleWithController_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithController.kt", "kotlin.coroutines"); - } - - @TestMetadata("inlineMultiModuleWithInnerInlining.kt") - public void testInlineMultiModuleWithInnerInlining_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithInnerInlining.kt", "kotlin.coroutines"); + public void testInlineFunctionWithOptionalParam() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt"); } @TestMetadata("inlineMultiModule.kt") - public void testInlineMultiModule_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModule.kt", "kotlin.coroutines"); + public void testInlineMultiModule() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModule.kt"); + } + + @TestMetadata("inlineMultiModuleOverride.kt") + public void testInlineMultiModuleOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleOverride.kt"); + } + + @TestMetadata("inlineMultiModuleWithController.kt") + public void testInlineMultiModuleWithController() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithController.kt"); + } + + @TestMetadata("inlineMultiModuleWithInnerInlining.kt") + public void testInlineMultiModuleWithInnerInlining() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithInnerInlining.kt"); } @TestMetadata("inlineTailCall.kt") - public void testInlineTailCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineTailCall.kt", "kotlin.coroutines"); + public void testInlineTailCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineTailCall.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/simple.kt"); } } @@ -7362,17 +7290,13 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInRedundantLocalsElimination() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/redundantLocalsElimination"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @TestMetadata("ktor_receivedMessage.kt") - public void testKtor_receivedMessage_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/redundantLocalsElimination/ktor_receivedMessage.kt", "kotlin.coroutines"); + public void testKtor_receivedMessage() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/redundantLocalsElimination/ktor_receivedMessage.kt"); } } @@ -7397,42 +7321,38 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInStackUnwinding() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/stackUnwinding"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @TestMetadata("exception.kt") - public void testException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/exception.kt", "kotlin.coroutines"); + public void testException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/exception.kt"); } @TestMetadata("inlineSuspendFunction.kt") - public void testInlineSuspendFunction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt", "kotlin.coroutines"); - } - - @TestMetadata("rethrowInFinallyWithSuspension.kt") - public void testRethrowInFinallyWithSuspension_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinallyWithSuspension.kt", "kotlin.coroutines"); + public void testInlineSuspendFunction() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt"); } @TestMetadata("rethrowInFinally.kt") - public void testRethrowInFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinally.kt", "kotlin.coroutines"); + public void testRethrowInFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinally.kt"); + } + + @TestMetadata("rethrowInFinallyWithSuspension.kt") + public void testRethrowInFinallyWithSuspension() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinallyWithSuspension.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt"); } @TestMetadata("suspendInCycle.kt") - public void testSuspendInCycle_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt", "kotlin.coroutines"); + public void testSuspendInCycle() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt"); } } @@ -7477,22 +7397,18 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInSuspendFunctionAsCoroutine() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @TestMetadata("dispatchResume.kt") - public void testDispatchResume_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt", "kotlin.coroutines"); + public void testDispatchResume() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt"); } @TestMetadata("handleException.kt") - public void testHandleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt", "kotlin.coroutines"); + public void testHandleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt"); } @TestMetadata("ifExpressionInsideCoroutine_1_3.kt") @@ -7500,74 +7416,74 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine_1_3.kt"); } - @TestMetadata("inlineTwoReceivers.kt") - public void testInlineTwoReceivers_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt", "kotlin.coroutines"); + @TestMetadata("inline.kt") + public void testInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt"); } - @TestMetadata("inline.kt") - public void testInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt", "kotlin.coroutines"); + @TestMetadata("inlineTwoReceivers.kt") + public void testInlineTwoReceivers() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt"); } @TestMetadata("member.kt") - public void testMember_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt", "kotlin.coroutines"); + public void testMember() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt"); } @TestMetadata("noinlineTwoReceivers.kt") - public void testNoinlineTwoReceivers_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt", "kotlin.coroutines"); + public void testNoinlineTwoReceivers() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt"); } @TestMetadata("operators.kt") - public void testOperators_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt", "kotlin.coroutines"); + public void testOperators() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt"); } @TestMetadata("privateFunctions.kt") - public void testPrivateFunctions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt", "kotlin.coroutines"); + public void testPrivateFunctions() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt"); } @TestMetadata("privateInFile.kt") - public void testPrivateInFile_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt", "kotlin.coroutines"); + public void testPrivateInFile() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt"); } @TestMetadata("returnNoSuspend.kt") - public void testReturnNoSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt", "kotlin.coroutines"); + public void testReturnNoSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt", "kotlin.coroutines"); - } - - @TestMetadata("superCallAbstractClass.kt") - public void testSuperCallAbstractClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallAbstractClass.kt", "kotlin.coroutines"); - } - - @TestMetadata("superCallInterface.kt") - public void testSuperCallInterface_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallInterface.kt", "kotlin.coroutines"); - } - - @TestMetadata("superCallOverload.kt") - public void testSuperCallOverload_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallOverload.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt"); } @TestMetadata("superCall.kt") - public void testSuperCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt", "kotlin.coroutines"); + public void testSuperCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt"); + } + + @TestMetadata("superCallAbstractClass.kt") + public void testSuperCallAbstractClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallAbstractClass.kt"); + } + + @TestMetadata("superCallInterface.kt") + public void testSuperCallInterface() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallInterface.kt"); + } + + @TestMetadata("superCallOverload.kt") + public void testSuperCallOverload() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallOverload.kt"); } @TestMetadata("withVariables.kt") - public void testWithVariables_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt", "kotlin.coroutines"); + public void testWithVariables() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt"); } } @@ -7579,37 +7495,33 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInSuspendFunctionTypeCall() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @TestMetadata("localVal.kt") - public void testLocalVal_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt", "kotlin.coroutines"); - } - - @TestMetadata("manyParametersNoCapture.kt") - public void testManyParametersNoCapture_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParametersNoCapture.kt", "kotlin.coroutines"); + public void testLocalVal() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt"); } @TestMetadata("manyParameters.kt") - public void testManyParameters_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt", "kotlin.coroutines"); + public void testManyParameters() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt"); + } + + @TestMetadata("manyParametersNoCapture.kt") + public void testManyParametersNoCapture() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParametersNoCapture.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt"); } @TestMetadata("suspendModifier.kt") - public void testSuspendModifier_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt", "kotlin.coroutines"); + public void testSuspendModifier() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt"); } } @@ -7621,32 +7533,28 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInTailCallOptimizations() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/tailCallOptimizations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @TestMetadata("crossinline.kt") - public void testCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/crossinline.kt", "kotlin.coroutines"); + public void testCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/crossinline.kt"); } @TestMetadata("inlineWithoutStateMachine.kt") - public void testInlineWithoutStateMachine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt", "kotlin.coroutines"); + public void testInlineWithoutStateMachine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt"); } @TestMetadata("innerObjectRetransformation.kt") - public void testInnerObjectRetransformation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation.kt", "kotlin.coroutines"); + public void testInnerObjectRetransformation() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation.kt"); } @TestMetadata("tryCatch.kt") - public void testTryCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/tryCatch.kt", "kotlin.coroutines"); + public void testTryCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/tryCatch.kt"); } @TestMetadata("compiler/testData/codegen/box/coroutines/tailCallOptimizations/unit") @@ -7671,32 +7579,28 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInTailOperations() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/tailOperations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @TestMetadata("suspendWithIf.kt") - public void testSuspendWithIf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithIf.kt", "kotlin.coroutines"); + public void testSuspendWithIf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithIf.kt"); } @TestMetadata("suspendWithTryCatch.kt") - public void testSuspendWithTryCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt", "kotlin.coroutines"); + public void testSuspendWithTryCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt"); } @TestMetadata("suspendWithWhen.kt") - public void testSuspendWithWhen_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithWhen.kt", "kotlin.coroutines"); + public void testSuspendWithWhen() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithWhen.kt"); } @TestMetadata("tailInlining.kt") - public void testTailInlining_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/tailInlining.kt", "kotlin.coroutines"); + public void testTailInlining() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/tailInlining.kt"); } } @@ -7708,22 +7612,18 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInUnitTypeReturn() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/unitTypeReturn"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @TestMetadata("coroutineNonLocalReturn.kt") - public void testCoroutineNonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt", "kotlin.coroutines"); + public void testCoroutineNonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt"); } @TestMetadata("coroutineReturn.kt") - public void testCoroutineReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt", "kotlin.coroutines"); + public void testCoroutineReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt"); } @TestMetadata("inlineUnitFunction.kt") @@ -7737,18 +7637,18 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("suspendNonLocalReturn.kt") - public void testSuspendNonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt", "kotlin.coroutines"); + public void testSuspendNonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt"); } @TestMetadata("suspendReturn.kt") - public void testSuspendReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt", "kotlin.coroutines"); + public void testSuspendReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt"); } @TestMetadata("unitSafeCall.kt") - public void testUnitSafeCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/unitSafeCall.kt", "kotlin.coroutines"); + public void testUnitSafeCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/unitSafeCall.kt"); } } @@ -7760,10 +7660,6 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInVarSpilling() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/varSpilling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @@ -7774,18 +7670,18 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } @TestMetadata("kt19475.kt") - public void testKt19475_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/kt19475.kt", "kotlin.coroutines"); + public void testKt19475() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt19475.kt"); } @TestMetadata("kt38925.kt") - public void testKt38925_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/kt38925.kt", "kotlin.coroutines"); + public void testKt38925() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt38925.kt"); } @TestMetadata("nullSpilling.kt") - public void testNullSpilling_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/nullSpilling.kt", "kotlin.coroutines"); + public void testNullSpilling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/nullSpilling.kt"); } @TestMetadata("refinedIntTypesAnalysis.kt") @@ -16737,10 +16633,6 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInParametersMetadata() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/parametersMetadata"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java index b758b1ee66b..66dbe5bc502 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java @@ -3557,72 +3557,68 @@ public class IrJsCodegenInlineES6TestGenerated extends AbstractIrJsCodegenInline KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInSuspend() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @TestMetadata("capturedVariables.kt") - public void testCapturedVariables_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/capturedVariables.kt", "kotlin.coroutines"); + public void testCapturedVariables() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/capturedVariables.kt"); } @TestMetadata("crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt") - public void testCrossinlineSuspendLambdaInsideCrossinlineSuspendLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt", "kotlin.coroutines"); + public void testCrossinlineSuspendLambdaInsideCrossinlineSuspendLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt"); } @TestMetadata("delegatedProperties.kt") - public void testDelegatedProperties_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt", "kotlin.coroutines"); + public void testDelegatedProperties() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt"); } @TestMetadata("doubleRegenerationWithNonSuspendingLambda.kt") - public void testDoubleRegenerationWithNonSuspendingLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt", "kotlin.coroutines"); + public void testDoubleRegenerationWithNonSuspendingLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt"); } @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt"); } @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt"); } @TestMetadata("kt26658.kt") @@ -3631,18 +3627,18 @@ public class IrJsCodegenInlineES6TestGenerated extends AbstractIrJsCodegenInline } @TestMetadata("maxStackWithCrossinline.kt") - public void testMaxStackWithCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt", "kotlin.coroutines"); + public void testMaxStackWithCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt"); } @TestMetadata("multipleLocals.kt") - public void testMultipleLocals_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines"); + public void testMultipleLocals() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt"); } @TestMetadata("multipleSuspensionPoints.kt") - public void testMultipleSuspensionPoints_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt", "kotlin.coroutines"); + public void testMultipleSuspensionPoints() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt"); } @TestMetadata("nonLocalReturn.kt") @@ -3651,23 +3647,23 @@ public class IrJsCodegenInlineES6TestGenerated extends AbstractIrJsCodegenInline } @TestMetadata("nonSuspendCrossinline.kt") - public void testNonSuspendCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt", "kotlin.coroutines"); + public void testNonSuspendCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt"); } @TestMetadata("returnValue.kt") - public void testReturnValue_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/returnValue.kt", "kotlin.coroutines"); + public void testReturnValue() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/returnValue.kt"); } @TestMetadata("tryCatchReceiver.kt") - public void testTryCatchReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt", "kotlin.coroutines"); + public void testTryCatchReceiver() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt"); } @TestMetadata("tryCatchStackTransform.kt") - public void testTryCatchStackTransform_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt", "kotlin.coroutines"); + public void testTryCatchStackTransform() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt"); } @TestMetadata("twiceRegeneratedAnonymousObject.kt") @@ -3726,17 +3722,13 @@ public class IrJsCodegenInlineES6TestGenerated extends AbstractIrJsCodegenInline KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInDefaultParameter() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/defaultParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @TestMetadata("defaultValueCrossinline.kt") - public void testDefaultValueCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt", "kotlin.coroutines"); + public void testDefaultValueCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt"); } @TestMetadata("defaultValueInClass.kt") @@ -3744,14 +3736,14 @@ public class IrJsCodegenInlineES6TestGenerated extends AbstractIrJsCodegenInline runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInClass.kt"); } - @TestMetadata("defaultValueInlineFromMultiFileFacade.kt") - public void testDefaultValueInlineFromMultiFileFacade_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt", "kotlin.coroutines"); + @TestMetadata("defaultValueInline.kt") + public void testDefaultValueInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt"); } - @TestMetadata("defaultValueInline.kt") - public void testDefaultValueInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt", "kotlin.coroutines"); + @TestMetadata("defaultValueInlineFromMultiFileFacade.kt") + public void testDefaultValueInlineFromMultiFileFacade() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt"); } } @@ -3809,52 +3801,48 @@ public class IrJsCodegenInlineES6TestGenerated extends AbstractIrJsCodegenInline KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInReceiver() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/receiver"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt"); } @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt"); } } @@ -3866,77 +3854,73 @@ public class IrJsCodegenInlineES6TestGenerated extends AbstractIrJsCodegenInline KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR_ES6, testDataFilePath); - } - public void testAllFilesPresentInStateMachine() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/stateMachine"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @TestMetadata("crossingCoroutineBoundaries.kt") - public void testCrossingCoroutineBoundaries_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt", "kotlin.coroutines"); + public void testCrossingCoroutineBoundaries() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt"); } @TestMetadata("independentInline.kt") - public void testIndependentInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerLambdaInsideLambda.kt") - public void testInnerLambdaInsideLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerLambdaWithoutCrossinline.kt") - public void testInnerLambdaWithoutCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt", "kotlin.coroutines"); + public void testIndependentInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt"); } @TestMetadata("innerLambda.kt") - public void testInnerLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt", "kotlin.coroutines"); + public void testInnerLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt"); } - @TestMetadata("innerMadnessCallSite.kt") - public void testInnerMadnessCallSite_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt", "kotlin.coroutines"); + @TestMetadata("innerLambdaInsideLambda.kt") + public void testInnerLambdaInsideLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt"); + } + + @TestMetadata("innerLambdaWithoutCrossinline.kt") + public void testInnerLambdaWithoutCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt"); } @TestMetadata("innerMadness.kt") - public void testInnerMadness_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt", "kotlin.coroutines"); + public void testInnerMadness() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt"); } - @TestMetadata("innerObjectInsideInnerObject.kt") - public void testInnerObjectInsideInnerObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectRetransformation.kt") - public void testInnerObjectRetransformation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectSeveralFunctions.kt") - public void testInnerObjectSeveralFunctions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectWithoutCapturingCrossinline.kt") - public void testInnerObjectWithoutCapturingCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt", "kotlin.coroutines"); + @TestMetadata("innerMadnessCallSite.kt") + public void testInnerMadnessCallSite() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt"); } @TestMetadata("innerObject.kt") - public void testInnerObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt", "kotlin.coroutines"); + public void testInnerObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt"); + } + + @TestMetadata("innerObjectInsideInnerObject.kt") + public void testInnerObjectInsideInnerObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt"); + } + + @TestMetadata("innerObjectRetransformation.kt") + public void testInnerObjectRetransformation() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt"); + } + + @TestMetadata("innerObjectSeveralFunctions.kt") + public void testInnerObjectSeveralFunctions() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt"); + } + + @TestMetadata("innerObjectWithoutCapturingCrossinline.kt") + public void testInnerObjectWithoutCapturingCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt"); } @TestMetadata("insideObject.kt") - public void testInsideObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt", "kotlin.coroutines"); + public void testInsideObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt"); } @TestMetadata("lambdaTransformation.kt") @@ -3945,43 +3929,43 @@ public class IrJsCodegenInlineES6TestGenerated extends AbstractIrJsCodegenInline } @TestMetadata("normalInline.kt") - public void testNormalInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt", "kotlin.coroutines"); + public void testNormalInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt"); } @TestMetadata("numberOfSuspentions.kt") - public void testNumberOfSuspentions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt", "kotlin.coroutines"); + public void testNumberOfSuspentions() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt"); } @TestMetadata("objectInsideLambdas.kt") - public void testObjectInsideLambdas_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt", "kotlin.coroutines"); + public void testObjectInsideLambdas() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt"); } @TestMetadata("oneInlineTwoCaptures.kt") - public void testOneInlineTwoCaptures_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt", "kotlin.coroutines"); + public void testOneInlineTwoCaptures() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt"); } @TestMetadata("passLambda.kt") - public void testPassLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt", "kotlin.coroutines"); - } - - @TestMetadata("passParameterLambda.kt") - public void testPassParameterLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt", "kotlin.coroutines"); + public void testPassLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt"); } @TestMetadata("passParameter.kt") - public void testPassParameter_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt", "kotlin.coroutines"); + public void testPassParameter() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt"); + } + + @TestMetadata("passParameterLambda.kt") + public void testPassParameterLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt"); } @TestMetadata("unreachableSuspendMarker.kt") - public void testUnreachableSuspendMarker_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt", "kotlin.coroutines"); + public void testUnreachableSuspendMarker() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt"); } } } diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 010e8fcf14c..50ce36ce3e7 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -699,10 +699,6 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInJvm() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/assert/jvm"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @@ -3980,10 +3976,6 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInCapturedVarsOptimization() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/closures/capturedVarsOptimization"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @@ -4033,14 +4025,14 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/closures/capturedVarsOptimization/sharedSlotsWithCapturedVars.kt"); } - @TestMetadata("withCoroutinesNoStdLib.kt") - public void testWithCoroutinesNoStdLib_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutinesNoStdLib.kt", "kotlin.coroutines"); + @TestMetadata("withCoroutines.kt") + public void testWithCoroutines() throws Exception { + runTest("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt"); } - @TestMetadata("withCoroutines.kt") - public void testWithCoroutines_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt", "kotlin.coroutines"); + @TestMetadata("withCoroutinesNoStdLib.kt") + public void testWithCoroutinesNoStdLib() throws Exception { + runTest("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutinesNoStdLib.kt"); } } @@ -4241,10 +4233,6 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInContracts() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/contracts"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @@ -4290,8 +4278,8 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("kt39374.kt") - public void testKt39374_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/contracts/kt39374.kt", "kotlin.coroutines"); + public void testKt39374() throws Exception { + runTest("compiler/testData/codegen/box/contracts/kt39374.kt"); } @TestMetadata("lambdaParameter.kt") @@ -5400,18 +5388,14 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - @TestMetadata("32defaultParametersInSuspend.kt") - public void test32defaultParametersInSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/32defaultParametersInSuspend.kt", "kotlin.coroutines"); + public void test32defaultParametersInSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/32defaultParametersInSuspend.kt"); } @TestMetadata("accessorForSuspend.kt") - public void testAccessorForSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/accessorForSuspend.kt", "kotlin.coroutines"); + public void testAccessorForSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/accessorForSuspend.kt"); } public void testAllFilesPresentInCoroutines() throws Exception { @@ -5434,18 +5418,18 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("await.kt") - public void testAwait_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/await.kt", "kotlin.coroutines"); - } - - @TestMetadata("beginWithExceptionNoHandleException.kt") - public void testBeginWithExceptionNoHandleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/beginWithExceptionNoHandleException.kt", "kotlin.coroutines"); + public void testAwait() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/await.kt"); } @TestMetadata("beginWithException.kt") - public void testBeginWithException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/beginWithException.kt", "kotlin.coroutines"); + public void testBeginWithException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/beginWithException.kt"); + } + + @TestMetadata("beginWithExceptionNoHandleException.kt") + public void testBeginWithExceptionNoHandleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/beginWithExceptionNoHandleException.kt"); } @TestMetadata("builderInferenceAndGenericArrayAcessCall.kt") @@ -5469,58 +5453,58 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("capturedVarInSuspendLambda.kt") - public void testCapturedVarInSuspendLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt", "kotlin.coroutines"); + public void testCapturedVarInSuspendLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt"); } @TestMetadata("catchWithInlineInsideSuspend.kt") - public void testCatchWithInlineInsideSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/catchWithInlineInsideSuspend.kt", "kotlin.coroutines"); + public void testCatchWithInlineInsideSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/catchWithInlineInsideSuspend.kt"); } @TestMetadata("coercionToUnit.kt") - public void testCoercionToUnit_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/coercionToUnit.kt", "kotlin.coroutines"); + public void testCoercionToUnit() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/coercionToUnit.kt"); } @TestMetadata("controllerAccessFromInnerLambda.kt") - public void testControllerAccessFromInnerLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controllerAccessFromInnerLambda.kt", "kotlin.coroutines"); + public void testControllerAccessFromInnerLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controllerAccessFromInnerLambda.kt"); } @TestMetadata("coroutineContextInInlinedLambda.kt") - public void testCoroutineContextInInlinedLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/coroutineContextInInlinedLambda.kt", "kotlin.coroutines"); + public void testCoroutineContextInInlinedLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/coroutineContextInInlinedLambda.kt"); } @TestMetadata("createCoroutineSafe.kt") - public void testCreateCoroutineSafe_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/createCoroutineSafe.kt", "kotlin.coroutines"); + public void testCreateCoroutineSafe() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/createCoroutineSafe.kt"); } @TestMetadata("createCoroutinesOnManualInstances.kt") - public void testCreateCoroutinesOnManualInstances_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/createCoroutinesOnManualInstances.kt", "kotlin.coroutines"); + public void testCreateCoroutinesOnManualInstances() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/createCoroutinesOnManualInstances.kt"); } @TestMetadata("crossInlineWithCapturedOuterReceiver.kt") - public void testCrossInlineWithCapturedOuterReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/crossInlineWithCapturedOuterReceiver.kt", "kotlin.coroutines"); + public void testCrossInlineWithCapturedOuterReceiver() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/crossInlineWithCapturedOuterReceiver.kt"); } @TestMetadata("defaultParametersInSuspend.kt") - public void testDefaultParametersInSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/defaultParametersInSuspend.kt", "kotlin.coroutines"); + public void testDefaultParametersInSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/defaultParametersInSuspend.kt"); } @TestMetadata("delegatedSuspendMember.kt") - public void testDelegatedSuspendMember_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt", "kotlin.coroutines"); + public void testDelegatedSuspendMember() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt"); } @TestMetadata("dispatchResume.kt") - public void testDispatchResume_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/dispatchResume.kt", "kotlin.coroutines"); + public void testDispatchResume() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/dispatchResume.kt"); } @TestMetadata("doubleColonExpressionsGenerationInBuilderInference.kt") @@ -5529,8 +5513,8 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("emptyClosure.kt") - public void testEmptyClosure_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/emptyClosure.kt", "kotlin.coroutines"); + public void testEmptyClosure() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/emptyClosure.kt"); } @TestMetadata("emptyCommonConstraintSystemForCoroutineInferenceCall.kt") @@ -5539,118 +5523,118 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("epam.kt") - public void testEpam_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/epam.kt", "kotlin.coroutines"); + public void testEpam() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/epam.kt"); } @TestMetadata("falseUnitCoercion.kt") - public void testFalseUnitCoercion_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/falseUnitCoercion.kt", "kotlin.coroutines"); + public void testFalseUnitCoercion() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/falseUnitCoercion.kt"); } @TestMetadata("generate.kt") - public void testGenerate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/generate.kt", "kotlin.coroutines"); + public void testGenerate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/generate.kt"); } @TestMetadata("handleException.kt") - public void testHandleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleException.kt", "kotlin.coroutines"); + public void testHandleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleException.kt"); } @TestMetadata("handleResultCallEmptyBody.kt") - public void testHandleResultCallEmptyBody_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultCallEmptyBody.kt", "kotlin.coroutines"); + public void testHandleResultCallEmptyBody() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleResultCallEmptyBody.kt"); } @TestMetadata("handleResultNonUnitExpression.kt") - public void testHandleResultNonUnitExpression_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultNonUnitExpression.kt", "kotlin.coroutines"); + public void testHandleResultNonUnitExpression() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleResultNonUnitExpression.kt"); } @TestMetadata("handleResultSuspended.kt") - public void testHandleResultSuspended_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultSuspended.kt", "kotlin.coroutines"); + public void testHandleResultSuspended() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleResultSuspended.kt"); } @TestMetadata("indirectInlineUsedAsNonInline.kt") - public void testIndirectInlineUsedAsNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/indirectInlineUsedAsNonInline.kt", "kotlin.coroutines"); + public void testIndirectInlineUsedAsNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/indirectInlineUsedAsNonInline.kt"); } @TestMetadata("inlineFunInGenericClass.kt") - public void testInlineFunInGenericClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineFunInGenericClass.kt", "kotlin.coroutines"); + public void testInlineFunInGenericClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineFunInGenericClass.kt"); } @TestMetadata("inlineGenericFunCalledFromSubclass.kt") - public void testInlineGenericFunCalledFromSubclass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineGenericFunCalledFromSubclass.kt", "kotlin.coroutines"); + public void testInlineGenericFunCalledFromSubclass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineGenericFunCalledFromSubclass.kt"); } @TestMetadata("inlineSuspendFunction.kt") - public void testInlineSuspendFunction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineSuspendFunction.kt", "kotlin.coroutines"); + public void testInlineSuspendFunction() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineSuspendFunction.kt"); } @TestMetadata("inlineSuspendLambdaNonLocalReturn.kt") - public void testInlineSuspendLambdaNonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineSuspendLambdaNonLocalReturn.kt", "kotlin.coroutines"); + public void testInlineSuspendLambdaNonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineSuspendLambdaNonLocalReturn.kt"); } @TestMetadata("inlinedTryCatchFinally.kt") - public void testInlinedTryCatchFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlinedTryCatchFinally.kt", "kotlin.coroutines"); + public void testInlinedTryCatchFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlinedTryCatchFinally.kt"); } @TestMetadata("innerSuspensionCalls.kt") - public void testInnerSuspensionCalls_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/innerSuspensionCalls.kt", "kotlin.coroutines"); + public void testInnerSuspensionCalls() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/innerSuspensionCalls.kt"); } @TestMetadata("instanceOfContinuation.kt") - public void testInstanceOfContinuation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/instanceOfContinuation.kt", "kotlin.coroutines"); + public void testInstanceOfContinuation() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/instanceOfContinuation.kt"); } @TestMetadata("iterateOverArray.kt") - public void testIterateOverArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/iterateOverArray.kt", "kotlin.coroutines"); + public void testIterateOverArray() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/iterateOverArray.kt"); } @TestMetadata("kt12958.kt") - public void testKt12958_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt12958.kt", "kotlin.coroutines"); + public void testKt12958() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt12958.kt"); } @TestMetadata("kt15016.kt") - public void testKt15016_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15016.kt", "kotlin.coroutines"); + public void testKt15016() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt15016.kt"); } @TestMetadata("kt15017.kt") - public void testKt15017_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15017.kt", "kotlin.coroutines"); + public void testKt15017() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt15017.kt"); } @TestMetadata("kt15930.kt") - public void testKt15930_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15930.kt", "kotlin.coroutines"); + public void testKt15930() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt15930.kt"); } @TestMetadata("kt21605.kt") - public void testKt21605_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt21605.kt", "kotlin.coroutines"); + public void testKt21605() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt21605.kt"); } @TestMetadata("kt25912.kt") - public void testKt25912_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt25912.kt", "kotlin.coroutines"); + public void testKt25912() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt25912.kt"); } @TestMetadata("kt28844.kt") - public void testKt28844_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt28844.kt", "kotlin.coroutines"); + public void testKt28844() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt28844.kt"); } @TestMetadata("kt30858.kt") @@ -5679,23 +5663,23 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("lastExpressionIsLoop.kt") - public void testLastExpressionIsLoop_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt", "kotlin.coroutines"); + public void testLastExpressionIsLoop() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt"); } @TestMetadata("lastStatementInc.kt") - public void testLastStatementInc_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastStatementInc.kt", "kotlin.coroutines"); + public void testLastStatementInc() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastStatementInc.kt"); } @TestMetadata("lastStementAssignment.kt") - public void testLastStementAssignment_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastStementAssignment.kt", "kotlin.coroutines"); + public void testLastStementAssignment() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastStementAssignment.kt"); } @TestMetadata("lastUnitExpression.kt") - public void testLastUnitExpression_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastUnitExpression.kt", "kotlin.coroutines"); + public void testLastUnitExpression() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastUnitExpression.kt"); } @TestMetadata("localCallableRef.kt") @@ -5704,53 +5688,53 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("localDelegate.kt") - public void testLocalDelegate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localDelegate.kt", "kotlin.coroutines"); + public void testLocalDelegate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localDelegate.kt"); } @TestMetadata("longRangeInSuspendCall.kt") - public void testLongRangeInSuspendCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/longRangeInSuspendCall.kt", "kotlin.coroutines"); + public void testLongRangeInSuspendCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/longRangeInSuspendCall.kt"); } @TestMetadata("longRangeInSuspendFun.kt") - public void testLongRangeInSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/longRangeInSuspendFun.kt", "kotlin.coroutines"); + public void testLongRangeInSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/longRangeInSuspendFun.kt"); } @TestMetadata("mergeNullAndString.kt") - public void testMergeNullAndString_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/mergeNullAndString.kt", "kotlin.coroutines"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda1.kt") - public void testMultipleInvokeCallsInsideInlineLambda1_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt", "kotlin.coroutines"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda2.kt") - public void testMultipleInvokeCallsInsideInlineLambda2_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt", "kotlin.coroutines"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda3.kt") - public void testMultipleInvokeCallsInsideInlineLambda3_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt", "kotlin.coroutines"); + public void testMergeNullAndString() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/mergeNullAndString.kt"); } @TestMetadata("multipleInvokeCalls.kt") - public void testMultipleInvokeCalls_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt", "kotlin.coroutines"); + public void testMultipleInvokeCalls() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt"); + } + + @TestMetadata("multipleInvokeCallsInsideInlineLambda1.kt") + public void testMultipleInvokeCallsInsideInlineLambda1() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt"); + } + + @TestMetadata("multipleInvokeCallsInsideInlineLambda2.kt") + public void testMultipleInvokeCallsInsideInlineLambda2() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt"); + } + + @TestMetadata("multipleInvokeCallsInsideInlineLambda3.kt") + public void testMultipleInvokeCallsInsideInlineLambda3() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt"); } @TestMetadata("nestedTryCatch.kt") - public void testNestedTryCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nestedTryCatch.kt", "kotlin.coroutines"); + public void testNestedTryCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/nestedTryCatch.kt"); } @TestMetadata("noSuspensionPoints.kt") - public void testNoSuspensionPoints_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noSuspensionPoints.kt", "kotlin.coroutines"); + public void testNoSuspensionPoints() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/noSuspensionPoints.kt"); } @TestMetadata("nonLocalReturn.kt") @@ -5758,34 +5742,39 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/nonLocalReturn.kt"); } - @TestMetadata("nonLocalReturnFromInlineLambdaDeep.kt") - public void testNonLocalReturnFromInlineLambdaDeep_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt", "kotlin.coroutines"); + @TestMetadata("nonLocalReturnFromInlineLambda.kt") + public void testNonLocalReturnFromInlineLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt"); } - @TestMetadata("nonLocalReturnFromInlineLambda.kt") - public void testNonLocalReturnFromInlineLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt", "kotlin.coroutines"); + @TestMetadata("nonLocalReturnFromInlineLambdaDeep.kt") + public void testNonLocalReturnFromInlineLambdaDeep() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt"); } @TestMetadata("overrideDefaultArgument.kt") - public void testOverrideDefaultArgument_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/overrideDefaultArgument.kt", "kotlin.coroutines"); + public void testOverrideDefaultArgument() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/overrideDefaultArgument.kt"); } @TestMetadata("recursiveSuspend.kt") - public void testRecursiveSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/recursiveSuspend.kt", "kotlin.coroutines"); + public void testRecursiveSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/recursiveSuspend.kt"); } @TestMetadata("returnByLabel.kt") - public void testReturnByLabel_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/returnByLabel.kt", "kotlin.coroutines"); + public void testReturnByLabel() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/returnByLabel.kt"); + } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/simple.kt"); } @TestMetadata("simpleException.kt") - public void testSimpleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simpleException.kt", "kotlin.coroutines"); + public void testSimpleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/simpleException.kt"); } @TestMetadata("simpleSuspendCallableReference.kt") @@ -5794,18 +5783,13 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("simpleWithHandleResult.kt") - public void testSimpleWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simpleWithHandleResult.kt", "kotlin.coroutines"); - } - - @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simple.kt", "kotlin.coroutines"); + public void testSimpleWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/simpleWithHandleResult.kt"); } @TestMetadata("statementLikeLastExpression.kt") - public void testStatementLikeLastExpression_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/statementLikeLastExpression.kt", "kotlin.coroutines"); + public void testStatementLikeLastExpression() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/statementLikeLastExpression.kt"); } @TestMetadata("stopAfter.kt") @@ -5814,33 +5798,33 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("suspendCallsInArguments.kt") - public void testSuspendCallsInArguments_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendCallsInArguments.kt", "kotlin.coroutines"); + public void testSuspendCallsInArguments() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendCallsInArguments.kt"); } @TestMetadata("suspendCoroutineFromStateMachine.kt") - public void testSuspendCoroutineFromStateMachine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt", "kotlin.coroutines"); + public void testSuspendCoroutineFromStateMachine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt"); } @TestMetadata("suspendDefaultImpl.kt") - public void testSuspendDefaultImpl_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendDefaultImpl.kt", "kotlin.coroutines"); + public void testSuspendDefaultImpl() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendDefaultImpl.kt"); } @TestMetadata("suspendDelegation.kt") - public void testSuspendDelegation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendDelegation.kt", "kotlin.coroutines"); + public void testSuspendDelegation() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendDelegation.kt"); } @TestMetadata("suspendFromInlineLambda.kt") - public void testSuspendFromInlineLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt", "kotlin.coroutines"); + public void testSuspendFromInlineLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt"); } @TestMetadata("suspendFunImportedFromObject.kt") - public void testSuspendFunImportedFromObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunImportedFromObject.kt", "kotlin.coroutines"); + public void testSuspendFunImportedFromObject() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunImportedFromObject.kt"); } @TestMetadata("suspendFunctionMethodReference.kt") @@ -5849,23 +5833,23 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("suspendInCycle.kt") - public void testSuspendInCycle_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInCycle.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt") - public void testSuspendInTheMiddleOfObjectConstructionEvaluationOrder_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendInTheMiddleOfObjectConstructionWithJumpOut.kt") - public void testSuspendInTheMiddleOfObjectConstructionWithJumpOut_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionWithJumpOut.kt", "kotlin.coroutines"); + public void testSuspendInCycle() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInCycle.kt"); } @TestMetadata("suspendInTheMiddleOfObjectConstruction.kt") - public void testSuspendInTheMiddleOfObjectConstruction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt", "kotlin.coroutines"); + public void testSuspendInTheMiddleOfObjectConstruction() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt"); + } + + @TestMetadata("suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt") + public void testSuspendInTheMiddleOfObjectConstructionEvaluationOrder() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt"); + } + + @TestMetadata("suspendInTheMiddleOfObjectConstructionWithJumpOut.kt") + public void testSuspendInTheMiddleOfObjectConstructionWithJumpOut() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionWithJumpOut.kt"); } @TestMetadata("suspendLambdaInInterface.kt") @@ -5874,18 +5858,18 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("suspendLambdaWithArgumentRearrangement.kt") - public void testSuspendLambdaWithArgumentRearrangement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendLambdaWithArgumentRearrangement.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspensionInsideSafeCallWithElvis.kt") - public void testSuspensionInsideSafeCallWithElvis_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt", "kotlin.coroutines"); + public void testSuspendLambdaWithArgumentRearrangement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendLambdaWithArgumentRearrangement.kt"); } @TestMetadata("suspensionInsideSafeCall.kt") - public void testSuspensionInsideSafeCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCall.kt", "kotlin.coroutines"); + public void testSuspensionInsideSafeCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCall.kt"); + } + + @TestMetadata("suspensionInsideSafeCallWithElvis.kt") + public void testSuspensionInsideSafeCallWithElvis() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt"); } @TestMetadata("tailCallToNothing.kt") @@ -5894,38 +5878,38 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("tryCatchFinallyWithHandleResult.kt") - public void testTryCatchFinallyWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt", "kotlin.coroutines"); + public void testTryCatchFinallyWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt"); } @TestMetadata("tryCatchWithHandleResult.kt") - public void testTryCatchWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryCatchWithHandleResult.kt", "kotlin.coroutines"); + public void testTryCatchWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryCatchWithHandleResult.kt"); } @TestMetadata("tryFinallyInsideInlineLambda.kt") - public void testTryFinallyInsideInlineLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt", "kotlin.coroutines"); + public void testTryFinallyInsideInlineLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt"); } @TestMetadata("tryFinallyWithHandleResult.kt") - public void testTryFinallyWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryFinallyWithHandleResult.kt", "kotlin.coroutines"); + public void testTryFinallyWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryFinallyWithHandleResult.kt"); } @TestMetadata("varCaptuedInCoroutineIntrinsic.kt") - public void testVarCaptuedInCoroutineIntrinsic_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varCaptuedInCoroutineIntrinsic.kt", "kotlin.coroutines"); - } - - @TestMetadata("varValueConflictsWithTableSameSort.kt") - public void testVarValueConflictsWithTableSameSort_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt", "kotlin.coroutines"); + public void testVarCaptuedInCoroutineIntrinsic() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varCaptuedInCoroutineIntrinsic.kt"); } @TestMetadata("varValueConflictsWithTable.kt") - public void testVarValueConflictsWithTable_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varValueConflictsWithTable.kt", "kotlin.coroutines"); + public void testVarValueConflictsWithTable() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varValueConflictsWithTable.kt"); + } + + @TestMetadata("varValueConflictsWithTableSameSort.kt") + public void testVarValueConflictsWithTableSameSort() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt"); } @TestMetadata("compiler/testData/codegen/box/coroutines/bridges") @@ -5936,27 +5920,23 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInBridges() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/bridges"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @TestMetadata("interfaceSpecialization.kt") - public void testInterfaceSpecialization_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/interfaceSpecialization.kt", "kotlin.coroutines"); + public void testInterfaceSpecialization() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/bridges/interfaceSpecialization.kt"); } @TestMetadata("lambdaWithLongReceiver.kt") - public void testLambdaWithLongReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/lambdaWithLongReceiver.kt", "kotlin.coroutines"); + public void testLambdaWithLongReceiver() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithLongReceiver.kt"); } @TestMetadata("lambdaWithMultipleParameters.kt") - public void testLambdaWithMultipleParameters_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt", "kotlin.coroutines"); + public void testLambdaWithMultipleParameters() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt"); } } @@ -5968,62 +5948,58 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInControlFlow() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/controlFlow"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @TestMetadata("breakFinally.kt") - public void testBreakFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/breakFinally.kt", "kotlin.coroutines"); + public void testBreakFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/breakFinally.kt"); } @TestMetadata("breakStatement.kt") - public void testBreakStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/breakStatement.kt", "kotlin.coroutines"); + public void testBreakStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/breakStatement.kt"); } @TestMetadata("complexChainSuspend.kt") - public void testComplexChainSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/complexChainSuspend.kt", "kotlin.coroutines"); + public void testComplexChainSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/complexChainSuspend.kt"); } @TestMetadata("doWhileStatement.kt") - public void testDoWhileStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/doWhileStatement.kt", "kotlin.coroutines"); + public void testDoWhileStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/doWhileStatement.kt"); } @TestMetadata("doubleBreak.kt") - public void testDoubleBreak_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/doubleBreak.kt", "kotlin.coroutines"); + public void testDoubleBreak() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/doubleBreak.kt"); } @TestMetadata("finallyCatch.kt") - public void testFinallyCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/finallyCatch.kt", "kotlin.coroutines"); + public void testFinallyCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/finallyCatch.kt"); } @TestMetadata("forContinue.kt") - public void testForContinue_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forContinue.kt", "kotlin.coroutines"); + public void testForContinue() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/forContinue.kt"); } @TestMetadata("forStatement.kt") - public void testForStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forStatement.kt", "kotlin.coroutines"); + public void testForStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/forStatement.kt"); } @TestMetadata("forWithStep.kt") - public void testForWithStep_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forWithStep.kt", "kotlin.coroutines"); + public void testForWithStep() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/forWithStep.kt"); } @TestMetadata("ifStatement.kt") - public void testIfStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt", "kotlin.coroutines"); + public void testIfStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt"); } @TestMetadata("kt22694_1_3.kt") @@ -6032,58 +6008,58 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("labeledWhile.kt") - public void testLabeledWhile_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/labeledWhile.kt", "kotlin.coroutines"); + public void testLabeledWhile() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/labeledWhile.kt"); } @TestMetadata("multipleCatchBlocksSuspend.kt") - public void testMultipleCatchBlocksSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/multipleCatchBlocksSuspend.kt", "kotlin.coroutines"); + public void testMultipleCatchBlocksSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/multipleCatchBlocksSuspend.kt"); } @TestMetadata("returnFromFinally.kt") - public void testReturnFromFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/returnFromFinally.kt", "kotlin.coroutines"); + public void testReturnFromFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/returnFromFinally.kt"); } @TestMetadata("returnWithFinally.kt") - public void testReturnWithFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/returnWithFinally.kt", "kotlin.coroutines"); + public void testReturnWithFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/returnWithFinally.kt"); } @TestMetadata("suspendInStringTemplate.kt") - public void testSuspendInStringTemplate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/suspendInStringTemplate.kt", "kotlin.coroutines"); + public void testSuspendInStringTemplate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/suspendInStringTemplate.kt"); } @TestMetadata("switchLikeWhen.kt") - public void testSwitchLikeWhen_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/switchLikeWhen.kt", "kotlin.coroutines"); + public void testSwitchLikeWhen() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/switchLikeWhen.kt"); } @TestMetadata("throwFromCatch.kt") - public void testThrowFromCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwFromCatch.kt", "kotlin.coroutines"); + public void testThrowFromCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/throwFromCatch.kt"); } @TestMetadata("throwFromFinally.kt") - public void testThrowFromFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwFromFinally.kt", "kotlin.coroutines"); + public void testThrowFromFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/throwFromFinally.kt"); } @TestMetadata("throwInTryWithHandleResult.kt") - public void testThrowInTryWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt", "kotlin.coroutines"); + public void testThrowInTryWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt"); } @TestMetadata("whenWithSuspensions.kt") - public void testWhenWithSuspensions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/whenWithSuspensions.kt", "kotlin.coroutines"); + public void testWhenWithSuspensions() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/whenWithSuspensions.kt"); } @TestMetadata("whileStatement.kt") - public void testWhileStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/whileStatement.kt", "kotlin.coroutines"); + public void testWhileStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/whileStatement.kt"); } } @@ -6108,17 +6084,13 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInFeatureIntersection() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/featureIntersection"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @TestMetadata("breakWithNonEmptyStack.kt") - public void testBreakWithNonEmptyStack_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt", "kotlin.coroutines"); + public void testBreakWithNonEmptyStack() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt"); } @TestMetadata("defaultExpect.kt") @@ -6127,18 +6099,18 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("delegate.kt") - public void testDelegate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt", "kotlin.coroutines"); + public void testDelegate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt"); } @TestMetadata("destructuringInLambdas.kt") - public void testDestructuringInLambdas_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt", "kotlin.coroutines"); + public void testDestructuringInLambdas() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt"); } @TestMetadata("inlineSuspendFinally.kt") - public void testInlineSuspendFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/inlineSuspendFinally.kt", "kotlin.coroutines"); + public void testInlineSuspendFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/inlineSuspendFinally.kt"); } @TestMetadata("interfaceMethodWithBody.kt") @@ -6156,19 +6128,19 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/featureIntersection/overrideInInlineClass.kt"); } - @TestMetadata("safeCallOnTwoReceiversLong.kt") - public void testSafeCallOnTwoReceiversLong_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt", "kotlin.coroutines"); + @TestMetadata("safeCallOnTwoReceivers.kt") + public void testSafeCallOnTwoReceivers() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt"); } - @TestMetadata("safeCallOnTwoReceivers.kt") - public void testSafeCallOnTwoReceivers_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt", "kotlin.coroutines"); + @TestMetadata("safeCallOnTwoReceiversLong.kt") + public void testSafeCallOnTwoReceiversLong() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt"); } @TestMetadata("suspendDestructuringInLambdas.kt") - public void testSuspendDestructuringInLambdas_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt", "kotlin.coroutines"); + public void testSuspendDestructuringInLambdas() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt"); } @TestMetadata("suspendFunctionIsAs.kt") @@ -6177,23 +6149,23 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("suspendInlineSuspendFinally.kt") - public void testSuspendInlineSuspendFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendInlineSuspendFinally.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendOperatorPlusAssign.kt") - public void testSuspendOperatorPlusAssign_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusAssign.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendOperatorPlusCallFromLambda.kt") - public void testSuspendOperatorPlusCallFromLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusCallFromLambda.kt", "kotlin.coroutines"); + public void testSuspendInlineSuspendFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendInlineSuspendFinally.kt"); } @TestMetadata("suspendOperatorPlus.kt") - public void testSuspendOperatorPlus_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlus.kt", "kotlin.coroutines"); + public void testSuspendOperatorPlus() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlus.kt"); + } + + @TestMetadata("suspendOperatorPlusAssign.kt") + public void testSuspendOperatorPlusAssign() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusAssign.kt"); + } + + @TestMetadata("suspendOperatorPlusCallFromLambda.kt") + public void testSuspendOperatorPlusCallFromLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusCallFromLambda.kt"); } @TestMetadata("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference") @@ -6204,17 +6176,13 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInCallableReference() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @TestMetadata("bigArity.kt") - public void testBigArity_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/bigArity.kt", "kotlin.coroutines"); + public void testBigArity() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/bigArity.kt"); } @TestMetadata("longArgs.kt") @@ -6285,77 +6253,73 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInTailrec() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @TestMetadata("controlFlowIf.kt") - public void testControlFlowIf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowIf.kt", "kotlin.coroutines"); + public void testControlFlowIf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowIf.kt"); } @TestMetadata("controlFlowWhen.kt") - public void testControlFlowWhen_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowWhen.kt", "kotlin.coroutines"); + public void testControlFlowWhen() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowWhen.kt"); } @TestMetadata("extention.kt") - public void testExtention_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/extention.kt", "kotlin.coroutines"); + public void testExtention() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/extention.kt"); } @TestMetadata("infixCall.kt") - public void testInfixCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixCall.kt", "kotlin.coroutines"); + public void testInfixCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixCall.kt"); } @TestMetadata("infixRecursiveCall.kt") - public void testInfixRecursiveCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixRecursiveCall.kt", "kotlin.coroutines"); + public void testInfixRecursiveCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixRecursiveCall.kt"); } @TestMetadata("realIteratorFoldl.kt") - public void testRealIteratorFoldl_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realIteratorFoldl.kt", "kotlin.coroutines"); + public void testRealIteratorFoldl() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realIteratorFoldl.kt"); } @TestMetadata("realStringEscape.kt") - public void testRealStringEscape_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringEscape.kt", "kotlin.coroutines"); + public void testRealStringEscape() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringEscape.kt"); } @TestMetadata("realStringRepeat.kt") - public void testRealStringRepeat_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringRepeat.kt", "kotlin.coroutines"); + public void testRealStringRepeat() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringRepeat.kt"); } @TestMetadata("returnInParentheses.kt") - public void testReturnInParentheses_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/returnInParentheses.kt", "kotlin.coroutines"); + public void testReturnInParentheses() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/returnInParentheses.kt"); } @TestMetadata("sum.kt") - public void testSum_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/sum.kt", "kotlin.coroutines"); + public void testSum() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/sum.kt"); } @TestMetadata("tailCallInBlockInParentheses.kt") - public void testTailCallInBlockInParentheses_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInBlockInParentheses.kt", "kotlin.coroutines"); + public void testTailCallInBlockInParentheses() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInBlockInParentheses.kt"); } @TestMetadata("tailCallInParentheses.kt") - public void testTailCallInParentheses_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInParentheses.kt", "kotlin.coroutines"); + public void testTailCallInParentheses() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInParentheses.kt"); } @TestMetadata("whenWithIs.kt") - public void testWhenWithIs_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/whenWithIs.kt", "kotlin.coroutines"); + public void testWhenWithIs() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/whenWithIs.kt"); } } } @@ -6385,10 +6349,6 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInDirect() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses/direct"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @@ -6404,58 +6364,58 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Any.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineInt() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineInt.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Int.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Long() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Long.kt"); } @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_NAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_NAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_nonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_nonLocalReturn.kt"); } @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_suspendFunType() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_suspendFunType.kt"); } @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationCrossinline.kt", "kotlin.coroutines"); + public void testBridgeGenerationCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationCrossinline.kt"); } @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationNonInline.kt", "kotlin.coroutines"); + public void testBridgeGenerationNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationNonInline.kt"); } @TestMetadata("covariantOverrideSuspendFun.kt") @@ -6569,8 +6529,8 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); + public void testInterfaceDelegateWithInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt"); } @TestMetadata("invokeOperator.kt") @@ -6579,28 +6539,28 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt"); } @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any.kt"); } @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_itf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_itf.kt"); } @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_this.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_this() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_this.kt"); } @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Int.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Int.kt"); } @TestMetadata("returnResult.kt") @@ -6617,10 +6577,6 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInResume() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses/resume"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @@ -6636,58 +6592,58 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Any.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineInt() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineInt.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Int.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Long() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Long.kt"); } @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_NAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_NAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_nonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_nonLocalReturn.kt"); } @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_suspendFunType() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_suspendFunType.kt"); } @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationCrossinline.kt", "kotlin.coroutines"); + public void testBridgeGenerationCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationCrossinline.kt"); } @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationNonInline.kt", "kotlin.coroutines"); + public void testBridgeGenerationNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationNonInline.kt"); } @TestMetadata("covariantOverrideSuspendFun.kt") @@ -6801,8 +6757,8 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); + public void testInterfaceDelegateWithInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt"); } @TestMetadata("invokeOperator.kt") @@ -6811,28 +6767,28 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt"); } @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any.kt"); } @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_itf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_itf.kt"); } @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_this.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_this() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_this.kt"); } @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Int.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Int.kt"); } @TestMetadata("returnResult.kt") @@ -6849,10 +6805,6 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInResumeWithException() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @@ -6868,58 +6820,58 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Any.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineInt() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineInt.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Int.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Long() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Long.kt"); } @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_NAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_NAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_nonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_nonLocalReturn.kt"); } @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_suspendFunType() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_suspendFunType.kt"); } @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationCrossinline.kt", "kotlin.coroutines"); + public void testBridgeGenerationCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationCrossinline.kt"); } @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationNonInline.kt", "kotlin.coroutines"); + public void testBridgeGenerationNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationNonInline.kt"); } @TestMetadata("covariantOverrideSuspendFun.kt") @@ -7018,8 +6970,8 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); + public void testInterfaceDelegateWithInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt"); } @TestMetadata("invokeOperator.kt") @@ -7028,28 +6980,28 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt"); } @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any.kt"); } @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_itf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_itf.kt"); } @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_this.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_this() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_this.kt"); } @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Int.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Int.kt"); } @TestMetadata("returnResult.kt") @@ -7067,22 +7019,18 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInIntLikeVarSpilling() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/intLikeVarSpilling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @TestMetadata("complicatedMerge.kt") - public void testComplicatedMerge_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt", "kotlin.coroutines"); + public void testComplicatedMerge() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt"); } @TestMetadata("i2bResult.kt") - public void testI2bResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines"); + public void testI2bResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt"); } @TestMetadata("listThrowablePairInOneSlot.kt") @@ -7091,33 +7039,33 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("loadFromBooleanArray.kt") - public void testLoadFromBooleanArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines"); + public void testLoadFromBooleanArray() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt"); } @TestMetadata("loadFromByteArray.kt") - public void testLoadFromByteArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt", "kotlin.coroutines"); + public void testLoadFromByteArray() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt"); } @TestMetadata("noVariableInTable.kt") - public void testNoVariableInTable_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt", "kotlin.coroutines"); + public void testNoVariableInTable() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt"); } @TestMetadata("sameIconst1ManyVars.kt") - public void testSameIconst1ManyVars_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt", "kotlin.coroutines"); + public void testSameIconst1ManyVars() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt"); } @TestMetadata("usedInMethodCall.kt") - public void testUsedInMethodCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt", "kotlin.coroutines"); + public void testUsedInMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt"); } @TestMetadata("usedInVarStore.kt") - public void testUsedInVarStore_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt", "kotlin.coroutines"); + public void testUsedInVarStore() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt"); } } @@ -7129,52 +7077,48 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInIntrinsicSemantics() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/intrinsicSemantics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } - @TestMetadata("coroutineContextReceiverNotIntrinsic.kt") - public void testCoroutineContextReceiverNotIntrinsic_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiverNotIntrinsic.kt", "kotlin.coroutines"); + @TestMetadata("coroutineContext.kt") + public void testCoroutineContext() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContext.kt"); } @TestMetadata("coroutineContextReceiver.kt") - public void testCoroutineContextReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiver.kt", "kotlin.coroutines"); + public void testCoroutineContextReceiver() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiver.kt"); } - @TestMetadata("coroutineContext.kt") - public void testCoroutineContext_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContext.kt", "kotlin.coroutines"); + @TestMetadata("coroutineContextReceiverNotIntrinsic.kt") + public void testCoroutineContextReceiverNotIntrinsic() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiverNotIntrinsic.kt"); } @TestMetadata("intercepted.kt") - public void testIntercepted_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/intercepted.kt", "kotlin.coroutines"); - } - - @TestMetadata("startCoroutineUninterceptedOrReturnInterception.kt") - public void testStartCoroutineUninterceptedOrReturnInterception_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt", "kotlin.coroutines"); - } - - @TestMetadata("startCoroutineUninterceptedOrReturn.kt") - public void testStartCoroutineUninterceptedOrReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt", "kotlin.coroutines"); + public void testIntercepted() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/intercepted.kt"); } @TestMetadata("startCoroutine.kt") - public void testStartCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt", "kotlin.coroutines"); + public void testStartCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt"); + } + + @TestMetadata("startCoroutineUninterceptedOrReturn.kt") + public void testStartCoroutineUninterceptedOrReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt"); + } + + @TestMetadata("startCoroutineUninterceptedOrReturnInterception.kt") + public void testStartCoroutineUninterceptedOrReturnInterception() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt"); } @TestMetadata("suspendCoroutineUninterceptedOrReturn.kt") - public void testSuspendCoroutineUninterceptedOrReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/suspendCoroutineUninterceptedOrReturn.kt", "kotlin.coroutines"); + public void testSuspendCoroutineUninterceptedOrReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/suspendCoroutineUninterceptedOrReturn.kt"); } } @@ -7186,10 +7130,6 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInJavaInterop() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @@ -7215,17 +7155,13 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInAnonymous() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/localFunctions/anonymous"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/anonymous/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/anonymous/simple.kt"); } } @@ -7237,62 +7173,58 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInNamed() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/localFunctions/named"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @TestMetadata("capturedParameters.kt") - public void testCapturedParameters_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedParameters.kt", "kotlin.coroutines"); + public void testCapturedParameters() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedParameters.kt"); } @TestMetadata("capturedVariables.kt") - public void testCapturedVariables_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedVariables.kt", "kotlin.coroutines"); + public void testCapturedVariables() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedVariables.kt"); } @TestMetadata("extension.kt") - public void testExtension_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/extension.kt", "kotlin.coroutines"); + public void testExtension() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/extension.kt"); } @TestMetadata("infix.kt") - public void testInfix_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/infix.kt", "kotlin.coroutines"); + public void testInfix() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/infix.kt"); } @TestMetadata("insideLambda.kt") - public void testInsideLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/insideLambda.kt", "kotlin.coroutines"); + public void testInsideLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/insideLambda.kt"); } @TestMetadata("nestedLocals.kt") - public void testNestedLocals_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/nestedLocals.kt", "kotlin.coroutines"); - } - - @TestMetadata("simpleSuspensionPoint.kt") - public void testSimpleSuspensionPoint_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/simpleSuspensionPoint.kt", "kotlin.coroutines"); + public void testNestedLocals() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/nestedLocals.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/simple.kt"); + } + + @TestMetadata("simpleSuspensionPoint.kt") + public void testSimpleSuspensionPoint() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/simpleSuspensionPoint.kt"); } @TestMetadata("stateMachine.kt") - public void testStateMachine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/stateMachine.kt", "kotlin.coroutines"); + public void testStateMachine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/stateMachine.kt"); } @TestMetadata("withArguments.kt") - public void testWithArguments_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/withArguments.kt", "kotlin.coroutines"); + public void testWithArguments() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/withArguments.kt"); } } } @@ -7305,52 +7237,48 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInMultiModule() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @TestMetadata("inlineCrossModule.kt") - public void testInlineCrossModule_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt", "kotlin.coroutines"); + public void testInlineCrossModule() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt"); } @TestMetadata("inlineFunctionWithOptionalParam.kt") - public void testInlineFunctionWithOptionalParam_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt", "kotlin.coroutines"); - } - - @TestMetadata("inlineMultiModuleOverride.kt") - public void testInlineMultiModuleOverride_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleOverride.kt", "kotlin.coroutines"); - } - - @TestMetadata("inlineMultiModuleWithController.kt") - public void testInlineMultiModuleWithController_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithController.kt", "kotlin.coroutines"); - } - - @TestMetadata("inlineMultiModuleWithInnerInlining.kt") - public void testInlineMultiModuleWithInnerInlining_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithInnerInlining.kt", "kotlin.coroutines"); + public void testInlineFunctionWithOptionalParam() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt"); } @TestMetadata("inlineMultiModule.kt") - public void testInlineMultiModule_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModule.kt", "kotlin.coroutines"); + public void testInlineMultiModule() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModule.kt"); + } + + @TestMetadata("inlineMultiModuleOverride.kt") + public void testInlineMultiModuleOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleOverride.kt"); + } + + @TestMetadata("inlineMultiModuleWithController.kt") + public void testInlineMultiModuleWithController() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithController.kt"); + } + + @TestMetadata("inlineMultiModuleWithInnerInlining.kt") + public void testInlineMultiModuleWithInnerInlining() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithInnerInlining.kt"); } @TestMetadata("inlineTailCall.kt") - public void testInlineTailCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineTailCall.kt", "kotlin.coroutines"); + public void testInlineTailCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineTailCall.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/simple.kt"); } } @@ -7362,17 +7290,13 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInRedundantLocalsElimination() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/redundantLocalsElimination"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @TestMetadata("ktor_receivedMessage.kt") - public void testKtor_receivedMessage_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/redundantLocalsElimination/ktor_receivedMessage.kt", "kotlin.coroutines"); + public void testKtor_receivedMessage() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/redundantLocalsElimination/ktor_receivedMessage.kt"); } } @@ -7397,42 +7321,38 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInStackUnwinding() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/stackUnwinding"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @TestMetadata("exception.kt") - public void testException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/exception.kt", "kotlin.coroutines"); + public void testException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/exception.kt"); } @TestMetadata("inlineSuspendFunction.kt") - public void testInlineSuspendFunction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt", "kotlin.coroutines"); - } - - @TestMetadata("rethrowInFinallyWithSuspension.kt") - public void testRethrowInFinallyWithSuspension_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinallyWithSuspension.kt", "kotlin.coroutines"); + public void testInlineSuspendFunction() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt"); } @TestMetadata("rethrowInFinally.kt") - public void testRethrowInFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinally.kt", "kotlin.coroutines"); + public void testRethrowInFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinally.kt"); + } + + @TestMetadata("rethrowInFinallyWithSuspension.kt") + public void testRethrowInFinallyWithSuspension() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinallyWithSuspension.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt"); } @TestMetadata("suspendInCycle.kt") - public void testSuspendInCycle_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt", "kotlin.coroutines"); + public void testSuspendInCycle() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt"); } } @@ -7477,22 +7397,18 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInSuspendFunctionAsCoroutine() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @TestMetadata("dispatchResume.kt") - public void testDispatchResume_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt", "kotlin.coroutines"); + public void testDispatchResume() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt"); } @TestMetadata("handleException.kt") - public void testHandleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt", "kotlin.coroutines"); + public void testHandleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt"); } @TestMetadata("ifExpressionInsideCoroutine_1_3.kt") @@ -7500,74 +7416,74 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine_1_3.kt"); } - @TestMetadata("inlineTwoReceivers.kt") - public void testInlineTwoReceivers_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt", "kotlin.coroutines"); + @TestMetadata("inline.kt") + public void testInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt"); } - @TestMetadata("inline.kt") - public void testInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt", "kotlin.coroutines"); + @TestMetadata("inlineTwoReceivers.kt") + public void testInlineTwoReceivers() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt"); } @TestMetadata("member.kt") - public void testMember_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt", "kotlin.coroutines"); + public void testMember() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt"); } @TestMetadata("noinlineTwoReceivers.kt") - public void testNoinlineTwoReceivers_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt", "kotlin.coroutines"); + public void testNoinlineTwoReceivers() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt"); } @TestMetadata("operators.kt") - public void testOperators_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt", "kotlin.coroutines"); + public void testOperators() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt"); } @TestMetadata("privateFunctions.kt") - public void testPrivateFunctions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt", "kotlin.coroutines"); + public void testPrivateFunctions() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt"); } @TestMetadata("privateInFile.kt") - public void testPrivateInFile_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt", "kotlin.coroutines"); + public void testPrivateInFile() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt"); } @TestMetadata("returnNoSuspend.kt") - public void testReturnNoSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt", "kotlin.coroutines"); + public void testReturnNoSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt", "kotlin.coroutines"); - } - - @TestMetadata("superCallAbstractClass.kt") - public void testSuperCallAbstractClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallAbstractClass.kt", "kotlin.coroutines"); - } - - @TestMetadata("superCallInterface.kt") - public void testSuperCallInterface_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallInterface.kt", "kotlin.coroutines"); - } - - @TestMetadata("superCallOverload.kt") - public void testSuperCallOverload_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallOverload.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt"); } @TestMetadata("superCall.kt") - public void testSuperCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt", "kotlin.coroutines"); + public void testSuperCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt"); + } + + @TestMetadata("superCallAbstractClass.kt") + public void testSuperCallAbstractClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallAbstractClass.kt"); + } + + @TestMetadata("superCallInterface.kt") + public void testSuperCallInterface() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallInterface.kt"); + } + + @TestMetadata("superCallOverload.kt") + public void testSuperCallOverload() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallOverload.kt"); } @TestMetadata("withVariables.kt") - public void testWithVariables_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt", "kotlin.coroutines"); + public void testWithVariables() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt"); } } @@ -7579,37 +7495,33 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInSuspendFunctionTypeCall() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @TestMetadata("localVal.kt") - public void testLocalVal_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt", "kotlin.coroutines"); - } - - @TestMetadata("manyParametersNoCapture.kt") - public void testManyParametersNoCapture_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParametersNoCapture.kt", "kotlin.coroutines"); + public void testLocalVal() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt"); } @TestMetadata("manyParameters.kt") - public void testManyParameters_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt", "kotlin.coroutines"); + public void testManyParameters() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt"); + } + + @TestMetadata("manyParametersNoCapture.kt") + public void testManyParametersNoCapture() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParametersNoCapture.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt"); } @TestMetadata("suspendModifier.kt") - public void testSuspendModifier_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt", "kotlin.coroutines"); + public void testSuspendModifier() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt"); } } @@ -7621,32 +7533,28 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInTailCallOptimizations() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/tailCallOptimizations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @TestMetadata("crossinline.kt") - public void testCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/crossinline.kt", "kotlin.coroutines"); + public void testCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/crossinline.kt"); } @TestMetadata("inlineWithoutStateMachine.kt") - public void testInlineWithoutStateMachine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt", "kotlin.coroutines"); + public void testInlineWithoutStateMachine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt"); } @TestMetadata("innerObjectRetransformation.kt") - public void testInnerObjectRetransformation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation.kt", "kotlin.coroutines"); + public void testInnerObjectRetransformation() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation.kt"); } @TestMetadata("tryCatch.kt") - public void testTryCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/tryCatch.kt", "kotlin.coroutines"); + public void testTryCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/tryCatch.kt"); } @TestMetadata("compiler/testData/codegen/box/coroutines/tailCallOptimizations/unit") @@ -7671,32 +7579,28 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInTailOperations() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/tailOperations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @TestMetadata("suspendWithIf.kt") - public void testSuspendWithIf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithIf.kt", "kotlin.coroutines"); + public void testSuspendWithIf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithIf.kt"); } @TestMetadata("suspendWithTryCatch.kt") - public void testSuspendWithTryCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt", "kotlin.coroutines"); + public void testSuspendWithTryCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt"); } @TestMetadata("suspendWithWhen.kt") - public void testSuspendWithWhen_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithWhen.kt", "kotlin.coroutines"); + public void testSuspendWithWhen() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithWhen.kt"); } @TestMetadata("tailInlining.kt") - public void testTailInlining_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/tailInlining.kt", "kotlin.coroutines"); + public void testTailInlining() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/tailInlining.kt"); } } @@ -7708,22 +7612,18 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInUnitTypeReturn() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/unitTypeReturn"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @TestMetadata("coroutineNonLocalReturn.kt") - public void testCoroutineNonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt", "kotlin.coroutines"); + public void testCoroutineNonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt"); } @TestMetadata("coroutineReturn.kt") - public void testCoroutineReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt", "kotlin.coroutines"); + public void testCoroutineReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt"); } @TestMetadata("inlineUnitFunction.kt") @@ -7737,18 +7637,18 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("suspendNonLocalReturn.kt") - public void testSuspendNonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt", "kotlin.coroutines"); + public void testSuspendNonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt"); } @TestMetadata("suspendReturn.kt") - public void testSuspendReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt", "kotlin.coroutines"); + public void testSuspendReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt"); } @TestMetadata("unitSafeCall.kt") - public void testUnitSafeCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/unitSafeCall.kt", "kotlin.coroutines"); + public void testUnitSafeCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/unitSafeCall.kt"); } } @@ -7760,10 +7660,6 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInVarSpilling() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/varSpilling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @@ -7774,18 +7670,18 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @TestMetadata("kt19475.kt") - public void testKt19475_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/kt19475.kt", "kotlin.coroutines"); + public void testKt19475() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt19475.kt"); } @TestMetadata("kt38925.kt") - public void testKt38925_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/kt38925.kt", "kotlin.coroutines"); + public void testKt38925() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt38925.kt"); } @TestMetadata("nullSpilling.kt") - public void testNullSpilling_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/nullSpilling.kt", "kotlin.coroutines"); + public void testNullSpilling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/nullSpilling.kt"); } @TestMetadata("refinedIntTypesAnalysis.kt") @@ -16737,10 +16633,6 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInParametersMetadata() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/parametersMetadata"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java index 23d718edc84..e4fc9475d11 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java @@ -3557,72 +3557,68 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInSuspend() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @TestMetadata("capturedVariables.kt") - public void testCapturedVariables_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/capturedVariables.kt", "kotlin.coroutines"); + public void testCapturedVariables() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/capturedVariables.kt"); } @TestMetadata("crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt") - public void testCrossinlineSuspendLambdaInsideCrossinlineSuspendLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt", "kotlin.coroutines"); + public void testCrossinlineSuspendLambdaInsideCrossinlineSuspendLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt"); } @TestMetadata("delegatedProperties.kt") - public void testDelegatedProperties_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt", "kotlin.coroutines"); + public void testDelegatedProperties() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt"); } @TestMetadata("doubleRegenerationWithNonSuspendingLambda.kt") - public void testDoubleRegenerationWithNonSuspendingLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt", "kotlin.coroutines"); + public void testDoubleRegenerationWithNonSuspendingLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt"); } @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt"); } @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt"); } @TestMetadata("kt26658.kt") @@ -3631,18 +3627,18 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes } @TestMetadata("maxStackWithCrossinline.kt") - public void testMaxStackWithCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt", "kotlin.coroutines"); + public void testMaxStackWithCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt"); } @TestMetadata("multipleLocals.kt") - public void testMultipleLocals_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines"); + public void testMultipleLocals() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt"); } @TestMetadata("multipleSuspensionPoints.kt") - public void testMultipleSuspensionPoints_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt", "kotlin.coroutines"); + public void testMultipleSuspensionPoints() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt"); } @TestMetadata("nonLocalReturn.kt") @@ -3651,23 +3647,23 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes } @TestMetadata("nonSuspendCrossinline.kt") - public void testNonSuspendCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt", "kotlin.coroutines"); + public void testNonSuspendCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt"); } @TestMetadata("returnValue.kt") - public void testReturnValue_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/returnValue.kt", "kotlin.coroutines"); + public void testReturnValue() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/returnValue.kt"); } @TestMetadata("tryCatchReceiver.kt") - public void testTryCatchReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt", "kotlin.coroutines"); + public void testTryCatchReceiver() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt"); } @TestMetadata("tryCatchStackTransform.kt") - public void testTryCatchStackTransform_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt", "kotlin.coroutines"); + public void testTryCatchStackTransform() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt"); } @TestMetadata("twiceRegeneratedAnonymousObject.kt") @@ -3726,17 +3722,13 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInDefaultParameter() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/defaultParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @TestMetadata("defaultValueCrossinline.kt") - public void testDefaultValueCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt", "kotlin.coroutines"); + public void testDefaultValueCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt"); } @TestMetadata("defaultValueInClass.kt") @@ -3744,14 +3736,14 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInClass.kt"); } - @TestMetadata("defaultValueInlineFromMultiFileFacade.kt") - public void testDefaultValueInlineFromMultiFileFacade_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt", "kotlin.coroutines"); + @TestMetadata("defaultValueInline.kt") + public void testDefaultValueInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt"); } - @TestMetadata("defaultValueInline.kt") - public void testDefaultValueInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt", "kotlin.coroutines"); + @TestMetadata("defaultValueInlineFromMultiFileFacade.kt") + public void testDefaultValueInlineFromMultiFileFacade() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt"); } } @@ -3809,52 +3801,48 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInReceiver() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/receiver"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt"); } @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt"); } } @@ -3866,77 +3854,73 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath); - } - public void testAllFilesPresentInStateMachine() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/stateMachine"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } @TestMetadata("crossingCoroutineBoundaries.kt") - public void testCrossingCoroutineBoundaries_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt", "kotlin.coroutines"); + public void testCrossingCoroutineBoundaries() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt"); } @TestMetadata("independentInline.kt") - public void testIndependentInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerLambdaInsideLambda.kt") - public void testInnerLambdaInsideLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerLambdaWithoutCrossinline.kt") - public void testInnerLambdaWithoutCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt", "kotlin.coroutines"); + public void testIndependentInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt"); } @TestMetadata("innerLambda.kt") - public void testInnerLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt", "kotlin.coroutines"); + public void testInnerLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt"); } - @TestMetadata("innerMadnessCallSite.kt") - public void testInnerMadnessCallSite_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt", "kotlin.coroutines"); + @TestMetadata("innerLambdaInsideLambda.kt") + public void testInnerLambdaInsideLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt"); + } + + @TestMetadata("innerLambdaWithoutCrossinline.kt") + public void testInnerLambdaWithoutCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt"); } @TestMetadata("innerMadness.kt") - public void testInnerMadness_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt", "kotlin.coroutines"); + public void testInnerMadness() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt"); } - @TestMetadata("innerObjectInsideInnerObject.kt") - public void testInnerObjectInsideInnerObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectRetransformation.kt") - public void testInnerObjectRetransformation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectSeveralFunctions.kt") - public void testInnerObjectSeveralFunctions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectWithoutCapturingCrossinline.kt") - public void testInnerObjectWithoutCapturingCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt", "kotlin.coroutines"); + @TestMetadata("innerMadnessCallSite.kt") + public void testInnerMadnessCallSite() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt"); } @TestMetadata("innerObject.kt") - public void testInnerObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt", "kotlin.coroutines"); + public void testInnerObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt"); + } + + @TestMetadata("innerObjectInsideInnerObject.kt") + public void testInnerObjectInsideInnerObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt"); + } + + @TestMetadata("innerObjectRetransformation.kt") + public void testInnerObjectRetransformation() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt"); + } + + @TestMetadata("innerObjectSeveralFunctions.kt") + public void testInnerObjectSeveralFunctions() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt"); + } + + @TestMetadata("innerObjectWithoutCapturingCrossinline.kt") + public void testInnerObjectWithoutCapturingCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt"); } @TestMetadata("insideObject.kt") - public void testInsideObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt", "kotlin.coroutines"); + public void testInsideObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt"); } @TestMetadata("lambdaTransformation.kt") @@ -3945,43 +3929,43 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes } @TestMetadata("normalInline.kt") - public void testNormalInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt", "kotlin.coroutines"); + public void testNormalInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt"); } @TestMetadata("numberOfSuspentions.kt") - public void testNumberOfSuspentions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt", "kotlin.coroutines"); + public void testNumberOfSuspentions() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt"); } @TestMetadata("objectInsideLambdas.kt") - public void testObjectInsideLambdas_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt", "kotlin.coroutines"); + public void testObjectInsideLambdas() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt"); } @TestMetadata("oneInlineTwoCaptures.kt") - public void testOneInlineTwoCaptures_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt", "kotlin.coroutines"); + public void testOneInlineTwoCaptures() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt"); } @TestMetadata("passLambda.kt") - public void testPassLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt", "kotlin.coroutines"); - } - - @TestMetadata("passParameterLambda.kt") - public void testPassParameterLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt", "kotlin.coroutines"); + public void testPassLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt"); } @TestMetadata("passParameter.kt") - public void testPassParameter_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt", "kotlin.coroutines"); + public void testPassParameter() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt"); + } + + @TestMetadata("passParameterLambda.kt") + public void testPassParameterLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt"); } @TestMetadata("unreachableSuspendMarker.kt") - public void testUnreachableSuspendMarker_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt", "kotlin.coroutines"); + public void testUnreachableSuspendMarker() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt"); } } } diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 6236c45be81..eb23ac83c59 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -699,10 +699,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInJvm() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/assert/jvm"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @@ -3980,10 +3976,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInCapturedVarsOptimization() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/closures/capturedVarsOptimization"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @@ -4033,14 +4025,14 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/closures/capturedVarsOptimization/sharedSlotsWithCapturedVars.kt"); } - @TestMetadata("withCoroutinesNoStdLib.kt") - public void testWithCoroutinesNoStdLib_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutinesNoStdLib.kt", "kotlin.coroutines"); + @TestMetadata("withCoroutines.kt") + public void testWithCoroutines() throws Exception { + runTest("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt"); } - @TestMetadata("withCoroutines.kt") - public void testWithCoroutines_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt", "kotlin.coroutines"); + @TestMetadata("withCoroutinesNoStdLib.kt") + public void testWithCoroutinesNoStdLib() throws Exception { + runTest("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutinesNoStdLib.kt"); } } @@ -4241,10 +4233,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInContracts() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/contracts"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @@ -4290,8 +4278,8 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("kt39374.kt") - public void testKt39374_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/contracts/kt39374.kt", "kotlin.coroutines"); + public void testKt39374() throws Exception { + runTest("compiler/testData/codegen/box/contracts/kt39374.kt"); } @TestMetadata("lambdaParameter.kt") @@ -5400,18 +5388,14 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - @TestMetadata("32defaultParametersInSuspend.kt") - public void test32defaultParametersInSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/32defaultParametersInSuspend.kt", "kotlin.coroutines"); + public void test32defaultParametersInSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/32defaultParametersInSuspend.kt"); } @TestMetadata("accessorForSuspend.kt") - public void testAccessorForSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/accessorForSuspend.kt", "kotlin.coroutines"); + public void testAccessorForSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/accessorForSuspend.kt"); } public void testAllFilesPresentInCoroutines() throws Exception { @@ -5434,18 +5418,18 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("await.kt") - public void testAwait_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/await.kt", "kotlin.coroutines"); - } - - @TestMetadata("beginWithExceptionNoHandleException.kt") - public void testBeginWithExceptionNoHandleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/beginWithExceptionNoHandleException.kt", "kotlin.coroutines"); + public void testAwait() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/await.kt"); } @TestMetadata("beginWithException.kt") - public void testBeginWithException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/beginWithException.kt", "kotlin.coroutines"); + public void testBeginWithException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/beginWithException.kt"); + } + + @TestMetadata("beginWithExceptionNoHandleException.kt") + public void testBeginWithExceptionNoHandleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/beginWithExceptionNoHandleException.kt"); } @TestMetadata("builderInferenceAndGenericArrayAcessCall.kt") @@ -5469,58 +5453,58 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("capturedVarInSuspendLambda.kt") - public void testCapturedVarInSuspendLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt", "kotlin.coroutines"); + public void testCapturedVarInSuspendLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt"); } @TestMetadata("catchWithInlineInsideSuspend.kt") - public void testCatchWithInlineInsideSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/catchWithInlineInsideSuspend.kt", "kotlin.coroutines"); + public void testCatchWithInlineInsideSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/catchWithInlineInsideSuspend.kt"); } @TestMetadata("coercionToUnit.kt") - public void testCoercionToUnit_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/coercionToUnit.kt", "kotlin.coroutines"); + public void testCoercionToUnit() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/coercionToUnit.kt"); } @TestMetadata("controllerAccessFromInnerLambda.kt") - public void testControllerAccessFromInnerLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controllerAccessFromInnerLambda.kt", "kotlin.coroutines"); + public void testControllerAccessFromInnerLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controllerAccessFromInnerLambda.kt"); } @TestMetadata("coroutineContextInInlinedLambda.kt") - public void testCoroutineContextInInlinedLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/coroutineContextInInlinedLambda.kt", "kotlin.coroutines"); + public void testCoroutineContextInInlinedLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/coroutineContextInInlinedLambda.kt"); } @TestMetadata("createCoroutineSafe.kt") - public void testCreateCoroutineSafe_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/createCoroutineSafe.kt", "kotlin.coroutines"); + public void testCreateCoroutineSafe() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/createCoroutineSafe.kt"); } @TestMetadata("createCoroutinesOnManualInstances.kt") - public void testCreateCoroutinesOnManualInstances_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/createCoroutinesOnManualInstances.kt", "kotlin.coroutines"); + public void testCreateCoroutinesOnManualInstances() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/createCoroutinesOnManualInstances.kt"); } @TestMetadata("crossInlineWithCapturedOuterReceiver.kt") - public void testCrossInlineWithCapturedOuterReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/crossInlineWithCapturedOuterReceiver.kt", "kotlin.coroutines"); + public void testCrossInlineWithCapturedOuterReceiver() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/crossInlineWithCapturedOuterReceiver.kt"); } @TestMetadata("defaultParametersInSuspend.kt") - public void testDefaultParametersInSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/defaultParametersInSuspend.kt", "kotlin.coroutines"); + public void testDefaultParametersInSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/defaultParametersInSuspend.kt"); } @TestMetadata("delegatedSuspendMember.kt") - public void testDelegatedSuspendMember_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt", "kotlin.coroutines"); + public void testDelegatedSuspendMember() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt"); } @TestMetadata("dispatchResume.kt") - public void testDispatchResume_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/dispatchResume.kt", "kotlin.coroutines"); + public void testDispatchResume() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/dispatchResume.kt"); } @TestMetadata("doubleColonExpressionsGenerationInBuilderInference.kt") @@ -5529,8 +5513,8 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("emptyClosure.kt") - public void testEmptyClosure_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/emptyClosure.kt", "kotlin.coroutines"); + public void testEmptyClosure() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/emptyClosure.kt"); } @TestMetadata("emptyCommonConstraintSystemForCoroutineInferenceCall.kt") @@ -5539,118 +5523,118 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("epam.kt") - public void testEpam_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/epam.kt", "kotlin.coroutines"); + public void testEpam() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/epam.kt"); } @TestMetadata("falseUnitCoercion.kt") - public void testFalseUnitCoercion_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/falseUnitCoercion.kt", "kotlin.coroutines"); + public void testFalseUnitCoercion() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/falseUnitCoercion.kt"); } @TestMetadata("generate.kt") - public void testGenerate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/generate.kt", "kotlin.coroutines"); + public void testGenerate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/generate.kt"); } @TestMetadata("handleException.kt") - public void testHandleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleException.kt", "kotlin.coroutines"); + public void testHandleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleException.kt"); } @TestMetadata("handleResultCallEmptyBody.kt") - public void testHandleResultCallEmptyBody_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultCallEmptyBody.kt", "kotlin.coroutines"); + public void testHandleResultCallEmptyBody() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleResultCallEmptyBody.kt"); } @TestMetadata("handleResultNonUnitExpression.kt") - public void testHandleResultNonUnitExpression_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultNonUnitExpression.kt", "kotlin.coroutines"); + public void testHandleResultNonUnitExpression() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleResultNonUnitExpression.kt"); } @TestMetadata("handleResultSuspended.kt") - public void testHandleResultSuspended_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/handleResultSuspended.kt", "kotlin.coroutines"); + public void testHandleResultSuspended() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/handleResultSuspended.kt"); } @TestMetadata("indirectInlineUsedAsNonInline.kt") - public void testIndirectInlineUsedAsNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/indirectInlineUsedAsNonInline.kt", "kotlin.coroutines"); + public void testIndirectInlineUsedAsNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/indirectInlineUsedAsNonInline.kt"); } @TestMetadata("inlineFunInGenericClass.kt") - public void testInlineFunInGenericClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineFunInGenericClass.kt", "kotlin.coroutines"); + public void testInlineFunInGenericClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineFunInGenericClass.kt"); } @TestMetadata("inlineGenericFunCalledFromSubclass.kt") - public void testInlineGenericFunCalledFromSubclass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineGenericFunCalledFromSubclass.kt", "kotlin.coroutines"); + public void testInlineGenericFunCalledFromSubclass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineGenericFunCalledFromSubclass.kt"); } @TestMetadata("inlineSuspendFunction.kt") - public void testInlineSuspendFunction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineSuspendFunction.kt", "kotlin.coroutines"); + public void testInlineSuspendFunction() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineSuspendFunction.kt"); } @TestMetadata("inlineSuspendLambdaNonLocalReturn.kt") - public void testInlineSuspendLambdaNonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineSuspendLambdaNonLocalReturn.kt", "kotlin.coroutines"); + public void testInlineSuspendLambdaNonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineSuspendLambdaNonLocalReturn.kt"); } @TestMetadata("inlinedTryCatchFinally.kt") - public void testInlinedTryCatchFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlinedTryCatchFinally.kt", "kotlin.coroutines"); + public void testInlinedTryCatchFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlinedTryCatchFinally.kt"); } @TestMetadata("innerSuspensionCalls.kt") - public void testInnerSuspensionCalls_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/innerSuspensionCalls.kt", "kotlin.coroutines"); + public void testInnerSuspensionCalls() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/innerSuspensionCalls.kt"); } @TestMetadata("instanceOfContinuation.kt") - public void testInstanceOfContinuation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/instanceOfContinuation.kt", "kotlin.coroutines"); + public void testInstanceOfContinuation() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/instanceOfContinuation.kt"); } @TestMetadata("iterateOverArray.kt") - public void testIterateOverArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/iterateOverArray.kt", "kotlin.coroutines"); + public void testIterateOverArray() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/iterateOverArray.kt"); } @TestMetadata("kt12958.kt") - public void testKt12958_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt12958.kt", "kotlin.coroutines"); + public void testKt12958() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt12958.kt"); } @TestMetadata("kt15016.kt") - public void testKt15016_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15016.kt", "kotlin.coroutines"); + public void testKt15016() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt15016.kt"); } @TestMetadata("kt15017.kt") - public void testKt15017_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15017.kt", "kotlin.coroutines"); + public void testKt15017() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt15017.kt"); } @TestMetadata("kt15930.kt") - public void testKt15930_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt15930.kt", "kotlin.coroutines"); + public void testKt15930() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt15930.kt"); } @TestMetadata("kt21605.kt") - public void testKt21605_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt21605.kt", "kotlin.coroutines"); + public void testKt21605() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt21605.kt"); } @TestMetadata("kt25912.kt") - public void testKt25912_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt25912.kt", "kotlin.coroutines"); + public void testKt25912() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt25912.kt"); } @TestMetadata("kt28844.kt") - public void testKt28844_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/kt28844.kt", "kotlin.coroutines"); + public void testKt28844() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt28844.kt"); } @TestMetadata("kt30858.kt") @@ -5679,23 +5663,23 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("lastExpressionIsLoop.kt") - public void testLastExpressionIsLoop_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt", "kotlin.coroutines"); + public void testLastExpressionIsLoop() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt"); } @TestMetadata("lastStatementInc.kt") - public void testLastStatementInc_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastStatementInc.kt", "kotlin.coroutines"); + public void testLastStatementInc() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastStatementInc.kt"); } @TestMetadata("lastStementAssignment.kt") - public void testLastStementAssignment_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastStementAssignment.kt", "kotlin.coroutines"); + public void testLastStementAssignment() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastStementAssignment.kt"); } @TestMetadata("lastUnitExpression.kt") - public void testLastUnitExpression_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastUnitExpression.kt", "kotlin.coroutines"); + public void testLastUnitExpression() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/lastUnitExpression.kt"); } @TestMetadata("localCallableRef.kt") @@ -5704,53 +5688,53 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("localDelegate.kt") - public void testLocalDelegate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localDelegate.kt", "kotlin.coroutines"); + public void testLocalDelegate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localDelegate.kt"); } @TestMetadata("longRangeInSuspendCall.kt") - public void testLongRangeInSuspendCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/longRangeInSuspendCall.kt", "kotlin.coroutines"); + public void testLongRangeInSuspendCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/longRangeInSuspendCall.kt"); } @TestMetadata("longRangeInSuspendFun.kt") - public void testLongRangeInSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/longRangeInSuspendFun.kt", "kotlin.coroutines"); + public void testLongRangeInSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/longRangeInSuspendFun.kt"); } @TestMetadata("mergeNullAndString.kt") - public void testMergeNullAndString_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/mergeNullAndString.kt", "kotlin.coroutines"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda1.kt") - public void testMultipleInvokeCallsInsideInlineLambda1_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt", "kotlin.coroutines"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda2.kt") - public void testMultipleInvokeCallsInsideInlineLambda2_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt", "kotlin.coroutines"); - } - - @TestMetadata("multipleInvokeCallsInsideInlineLambda3.kt") - public void testMultipleInvokeCallsInsideInlineLambda3_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt", "kotlin.coroutines"); + public void testMergeNullAndString() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/mergeNullAndString.kt"); } @TestMetadata("multipleInvokeCalls.kt") - public void testMultipleInvokeCalls_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt", "kotlin.coroutines"); + public void testMultipleInvokeCalls() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt"); + } + + @TestMetadata("multipleInvokeCallsInsideInlineLambda1.kt") + public void testMultipleInvokeCallsInsideInlineLambda1() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt"); + } + + @TestMetadata("multipleInvokeCallsInsideInlineLambda2.kt") + public void testMultipleInvokeCallsInsideInlineLambda2() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt"); + } + + @TestMetadata("multipleInvokeCallsInsideInlineLambda3.kt") + public void testMultipleInvokeCallsInsideInlineLambda3() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt"); } @TestMetadata("nestedTryCatch.kt") - public void testNestedTryCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nestedTryCatch.kt", "kotlin.coroutines"); + public void testNestedTryCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/nestedTryCatch.kt"); } @TestMetadata("noSuspensionPoints.kt") - public void testNoSuspensionPoints_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noSuspensionPoints.kt", "kotlin.coroutines"); + public void testNoSuspensionPoints() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/noSuspensionPoints.kt"); } @TestMetadata("nonLocalReturn.kt") @@ -5758,34 +5742,39 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/nonLocalReturn.kt"); } - @TestMetadata("nonLocalReturnFromInlineLambdaDeep.kt") - public void testNonLocalReturnFromInlineLambdaDeep_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt", "kotlin.coroutines"); + @TestMetadata("nonLocalReturnFromInlineLambda.kt") + public void testNonLocalReturnFromInlineLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt"); } - @TestMetadata("nonLocalReturnFromInlineLambda.kt") - public void testNonLocalReturnFromInlineLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt", "kotlin.coroutines"); + @TestMetadata("nonLocalReturnFromInlineLambdaDeep.kt") + public void testNonLocalReturnFromInlineLambdaDeep() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt"); } @TestMetadata("overrideDefaultArgument.kt") - public void testOverrideDefaultArgument_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/overrideDefaultArgument.kt", "kotlin.coroutines"); + public void testOverrideDefaultArgument() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/overrideDefaultArgument.kt"); } @TestMetadata("recursiveSuspend.kt") - public void testRecursiveSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/recursiveSuspend.kt", "kotlin.coroutines"); + public void testRecursiveSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/recursiveSuspend.kt"); } @TestMetadata("returnByLabel.kt") - public void testReturnByLabel_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/returnByLabel.kt", "kotlin.coroutines"); + public void testReturnByLabel() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/returnByLabel.kt"); + } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/simple.kt"); } @TestMetadata("simpleException.kt") - public void testSimpleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simpleException.kt", "kotlin.coroutines"); + public void testSimpleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/simpleException.kt"); } @TestMetadata("simpleSuspendCallableReference.kt") @@ -5794,18 +5783,13 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("simpleWithHandleResult.kt") - public void testSimpleWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simpleWithHandleResult.kt", "kotlin.coroutines"); - } - - @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/simple.kt", "kotlin.coroutines"); + public void testSimpleWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/simpleWithHandleResult.kt"); } @TestMetadata("statementLikeLastExpression.kt") - public void testStatementLikeLastExpression_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/statementLikeLastExpression.kt", "kotlin.coroutines"); + public void testStatementLikeLastExpression() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/statementLikeLastExpression.kt"); } @TestMetadata("stopAfter.kt") @@ -5814,33 +5798,33 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("suspendCallsInArguments.kt") - public void testSuspendCallsInArguments_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendCallsInArguments.kt", "kotlin.coroutines"); + public void testSuspendCallsInArguments() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendCallsInArguments.kt"); } @TestMetadata("suspendCoroutineFromStateMachine.kt") - public void testSuspendCoroutineFromStateMachine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt", "kotlin.coroutines"); + public void testSuspendCoroutineFromStateMachine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt"); } @TestMetadata("suspendDefaultImpl.kt") - public void testSuspendDefaultImpl_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendDefaultImpl.kt", "kotlin.coroutines"); + public void testSuspendDefaultImpl() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendDefaultImpl.kt"); } @TestMetadata("suspendDelegation.kt") - public void testSuspendDelegation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendDelegation.kt", "kotlin.coroutines"); + public void testSuspendDelegation() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendDelegation.kt"); } @TestMetadata("suspendFromInlineLambda.kt") - public void testSuspendFromInlineLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt", "kotlin.coroutines"); + public void testSuspendFromInlineLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt"); } @TestMetadata("suspendFunImportedFromObject.kt") - public void testSuspendFunImportedFromObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunImportedFromObject.kt", "kotlin.coroutines"); + public void testSuspendFunImportedFromObject() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunImportedFromObject.kt"); } @TestMetadata("suspendFunctionMethodReference.kt") @@ -5849,23 +5833,23 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("suspendInCycle.kt") - public void testSuspendInCycle_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInCycle.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt") - public void testSuspendInTheMiddleOfObjectConstructionEvaluationOrder_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendInTheMiddleOfObjectConstructionWithJumpOut.kt") - public void testSuspendInTheMiddleOfObjectConstructionWithJumpOut_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionWithJumpOut.kt", "kotlin.coroutines"); + public void testSuspendInCycle() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInCycle.kt"); } @TestMetadata("suspendInTheMiddleOfObjectConstruction.kt") - public void testSuspendInTheMiddleOfObjectConstruction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt", "kotlin.coroutines"); + public void testSuspendInTheMiddleOfObjectConstruction() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt"); + } + + @TestMetadata("suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt") + public void testSuspendInTheMiddleOfObjectConstructionEvaluationOrder() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt"); + } + + @TestMetadata("suspendInTheMiddleOfObjectConstructionWithJumpOut.kt") + public void testSuspendInTheMiddleOfObjectConstructionWithJumpOut() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionWithJumpOut.kt"); } @TestMetadata("suspendLambdaInInterface.kt") @@ -5874,18 +5858,18 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("suspendLambdaWithArgumentRearrangement.kt") - public void testSuspendLambdaWithArgumentRearrangement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendLambdaWithArgumentRearrangement.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspensionInsideSafeCallWithElvis.kt") - public void testSuspensionInsideSafeCallWithElvis_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt", "kotlin.coroutines"); + public void testSuspendLambdaWithArgumentRearrangement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendLambdaWithArgumentRearrangement.kt"); } @TestMetadata("suspensionInsideSafeCall.kt") - public void testSuspensionInsideSafeCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCall.kt", "kotlin.coroutines"); + public void testSuspensionInsideSafeCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCall.kt"); + } + + @TestMetadata("suspensionInsideSafeCallWithElvis.kt") + public void testSuspensionInsideSafeCallWithElvis() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt"); } @TestMetadata("tailCallToNothing.kt") @@ -5894,38 +5878,38 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("tryCatchFinallyWithHandleResult.kt") - public void testTryCatchFinallyWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt", "kotlin.coroutines"); + public void testTryCatchFinallyWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt"); } @TestMetadata("tryCatchWithHandleResult.kt") - public void testTryCatchWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryCatchWithHandleResult.kt", "kotlin.coroutines"); + public void testTryCatchWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryCatchWithHandleResult.kt"); } @TestMetadata("tryFinallyInsideInlineLambda.kt") - public void testTryFinallyInsideInlineLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt", "kotlin.coroutines"); + public void testTryFinallyInsideInlineLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt"); } @TestMetadata("tryFinallyWithHandleResult.kt") - public void testTryFinallyWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tryFinallyWithHandleResult.kt", "kotlin.coroutines"); + public void testTryFinallyWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tryFinallyWithHandleResult.kt"); } @TestMetadata("varCaptuedInCoroutineIntrinsic.kt") - public void testVarCaptuedInCoroutineIntrinsic_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varCaptuedInCoroutineIntrinsic.kt", "kotlin.coroutines"); - } - - @TestMetadata("varValueConflictsWithTableSameSort.kt") - public void testVarValueConflictsWithTableSameSort_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt", "kotlin.coroutines"); + public void testVarCaptuedInCoroutineIntrinsic() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varCaptuedInCoroutineIntrinsic.kt"); } @TestMetadata("varValueConflictsWithTable.kt") - public void testVarValueConflictsWithTable_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varValueConflictsWithTable.kt", "kotlin.coroutines"); + public void testVarValueConflictsWithTable() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varValueConflictsWithTable.kt"); + } + + @TestMetadata("varValueConflictsWithTableSameSort.kt") + public void testVarValueConflictsWithTableSameSort() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt"); } @TestMetadata("compiler/testData/codegen/box/coroutines/bridges") @@ -5936,27 +5920,23 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInBridges() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/bridges"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @TestMetadata("interfaceSpecialization.kt") - public void testInterfaceSpecialization_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/interfaceSpecialization.kt", "kotlin.coroutines"); + public void testInterfaceSpecialization() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/bridges/interfaceSpecialization.kt"); } @TestMetadata("lambdaWithLongReceiver.kt") - public void testLambdaWithLongReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/lambdaWithLongReceiver.kt", "kotlin.coroutines"); + public void testLambdaWithLongReceiver() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithLongReceiver.kt"); } @TestMetadata("lambdaWithMultipleParameters.kt") - public void testLambdaWithMultipleParameters_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt", "kotlin.coroutines"); + public void testLambdaWithMultipleParameters() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt"); } } @@ -5968,62 +5948,58 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInControlFlow() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/controlFlow"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @TestMetadata("breakFinally.kt") - public void testBreakFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/breakFinally.kt", "kotlin.coroutines"); + public void testBreakFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/breakFinally.kt"); } @TestMetadata("breakStatement.kt") - public void testBreakStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/breakStatement.kt", "kotlin.coroutines"); + public void testBreakStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/breakStatement.kt"); } @TestMetadata("complexChainSuspend.kt") - public void testComplexChainSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/complexChainSuspend.kt", "kotlin.coroutines"); + public void testComplexChainSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/complexChainSuspend.kt"); } @TestMetadata("doWhileStatement.kt") - public void testDoWhileStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/doWhileStatement.kt", "kotlin.coroutines"); + public void testDoWhileStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/doWhileStatement.kt"); } @TestMetadata("doubleBreak.kt") - public void testDoubleBreak_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/doubleBreak.kt", "kotlin.coroutines"); + public void testDoubleBreak() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/doubleBreak.kt"); } @TestMetadata("finallyCatch.kt") - public void testFinallyCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/finallyCatch.kt", "kotlin.coroutines"); + public void testFinallyCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/finallyCatch.kt"); } @TestMetadata("forContinue.kt") - public void testForContinue_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forContinue.kt", "kotlin.coroutines"); + public void testForContinue() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/forContinue.kt"); } @TestMetadata("forStatement.kt") - public void testForStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forStatement.kt", "kotlin.coroutines"); + public void testForStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/forStatement.kt"); } @TestMetadata("forWithStep.kt") - public void testForWithStep_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/forWithStep.kt", "kotlin.coroutines"); + public void testForWithStep() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/forWithStep.kt"); } @TestMetadata("ifStatement.kt") - public void testIfStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt", "kotlin.coroutines"); + public void testIfStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt"); } @TestMetadata("kt22694_1_3.kt") @@ -6032,58 +6008,58 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("labeledWhile.kt") - public void testLabeledWhile_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/labeledWhile.kt", "kotlin.coroutines"); + public void testLabeledWhile() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/labeledWhile.kt"); } @TestMetadata("multipleCatchBlocksSuspend.kt") - public void testMultipleCatchBlocksSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/multipleCatchBlocksSuspend.kt", "kotlin.coroutines"); + public void testMultipleCatchBlocksSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/multipleCatchBlocksSuspend.kt"); } @TestMetadata("returnFromFinally.kt") - public void testReturnFromFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/returnFromFinally.kt", "kotlin.coroutines"); + public void testReturnFromFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/returnFromFinally.kt"); } @TestMetadata("returnWithFinally.kt") - public void testReturnWithFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/returnWithFinally.kt", "kotlin.coroutines"); + public void testReturnWithFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/returnWithFinally.kt"); } @TestMetadata("suspendInStringTemplate.kt") - public void testSuspendInStringTemplate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/suspendInStringTemplate.kt", "kotlin.coroutines"); + public void testSuspendInStringTemplate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/suspendInStringTemplate.kt"); } @TestMetadata("switchLikeWhen.kt") - public void testSwitchLikeWhen_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/switchLikeWhen.kt", "kotlin.coroutines"); + public void testSwitchLikeWhen() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/switchLikeWhen.kt"); } @TestMetadata("throwFromCatch.kt") - public void testThrowFromCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwFromCatch.kt", "kotlin.coroutines"); + public void testThrowFromCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/throwFromCatch.kt"); } @TestMetadata("throwFromFinally.kt") - public void testThrowFromFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwFromFinally.kt", "kotlin.coroutines"); + public void testThrowFromFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/throwFromFinally.kt"); } @TestMetadata("throwInTryWithHandleResult.kt") - public void testThrowInTryWithHandleResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt", "kotlin.coroutines"); + public void testThrowInTryWithHandleResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt"); } @TestMetadata("whenWithSuspensions.kt") - public void testWhenWithSuspensions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/whenWithSuspensions.kt", "kotlin.coroutines"); + public void testWhenWithSuspensions() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/whenWithSuspensions.kt"); } @TestMetadata("whileStatement.kt") - public void testWhileStatement_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/whileStatement.kt", "kotlin.coroutines"); + public void testWhileStatement() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/whileStatement.kt"); } } @@ -6108,17 +6084,13 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInFeatureIntersection() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/featureIntersection"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @TestMetadata("breakWithNonEmptyStack.kt") - public void testBreakWithNonEmptyStack_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt", "kotlin.coroutines"); + public void testBreakWithNonEmptyStack() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt"); } @TestMetadata("defaultExpect.kt") @@ -6127,18 +6099,18 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("delegate.kt") - public void testDelegate_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt", "kotlin.coroutines"); + public void testDelegate() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt"); } @TestMetadata("destructuringInLambdas.kt") - public void testDestructuringInLambdas_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt", "kotlin.coroutines"); + public void testDestructuringInLambdas() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt"); } @TestMetadata("inlineSuspendFinally.kt") - public void testInlineSuspendFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/inlineSuspendFinally.kt", "kotlin.coroutines"); + public void testInlineSuspendFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/inlineSuspendFinally.kt"); } @TestMetadata("interfaceMethodWithBody.kt") @@ -6156,19 +6128,19 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/featureIntersection/overrideInInlineClass.kt"); } - @TestMetadata("safeCallOnTwoReceiversLong.kt") - public void testSafeCallOnTwoReceiversLong_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt", "kotlin.coroutines"); + @TestMetadata("safeCallOnTwoReceivers.kt") + public void testSafeCallOnTwoReceivers() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt"); } - @TestMetadata("safeCallOnTwoReceivers.kt") - public void testSafeCallOnTwoReceivers_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt", "kotlin.coroutines"); + @TestMetadata("safeCallOnTwoReceiversLong.kt") + public void testSafeCallOnTwoReceiversLong() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt"); } @TestMetadata("suspendDestructuringInLambdas.kt") - public void testSuspendDestructuringInLambdas_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt", "kotlin.coroutines"); + public void testSuspendDestructuringInLambdas() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt"); } @TestMetadata("suspendFunctionIsAs.kt") @@ -6177,23 +6149,23 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("suspendInlineSuspendFinally.kt") - public void testSuspendInlineSuspendFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendInlineSuspendFinally.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendOperatorPlusAssign.kt") - public void testSuspendOperatorPlusAssign_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusAssign.kt", "kotlin.coroutines"); - } - - @TestMetadata("suspendOperatorPlusCallFromLambda.kt") - public void testSuspendOperatorPlusCallFromLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusCallFromLambda.kt", "kotlin.coroutines"); + public void testSuspendInlineSuspendFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendInlineSuspendFinally.kt"); } @TestMetadata("suspendOperatorPlus.kt") - public void testSuspendOperatorPlus_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlus.kt", "kotlin.coroutines"); + public void testSuspendOperatorPlus() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlus.kt"); + } + + @TestMetadata("suspendOperatorPlusAssign.kt") + public void testSuspendOperatorPlusAssign() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusAssign.kt"); + } + + @TestMetadata("suspendOperatorPlusCallFromLambda.kt") + public void testSuspendOperatorPlusCallFromLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusCallFromLambda.kt"); } @TestMetadata("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference") @@ -6204,17 +6176,13 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInCallableReference() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @TestMetadata("bigArity.kt") - public void testBigArity_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/bigArity.kt", "kotlin.coroutines"); + public void testBigArity() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/bigArity.kt"); } @TestMetadata("longArgs.kt") @@ -6285,77 +6253,73 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInTailrec() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @TestMetadata("controlFlowIf.kt") - public void testControlFlowIf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowIf.kt", "kotlin.coroutines"); + public void testControlFlowIf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowIf.kt"); } @TestMetadata("controlFlowWhen.kt") - public void testControlFlowWhen_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowWhen.kt", "kotlin.coroutines"); + public void testControlFlowWhen() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowWhen.kt"); } @TestMetadata("extention.kt") - public void testExtention_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/extention.kt", "kotlin.coroutines"); + public void testExtention() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/extention.kt"); } @TestMetadata("infixCall.kt") - public void testInfixCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixCall.kt", "kotlin.coroutines"); + public void testInfixCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixCall.kt"); } @TestMetadata("infixRecursiveCall.kt") - public void testInfixRecursiveCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixRecursiveCall.kt", "kotlin.coroutines"); + public void testInfixRecursiveCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixRecursiveCall.kt"); } @TestMetadata("realIteratorFoldl.kt") - public void testRealIteratorFoldl_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realIteratorFoldl.kt", "kotlin.coroutines"); + public void testRealIteratorFoldl() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realIteratorFoldl.kt"); } @TestMetadata("realStringEscape.kt") - public void testRealStringEscape_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringEscape.kt", "kotlin.coroutines"); + public void testRealStringEscape() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringEscape.kt"); } @TestMetadata("realStringRepeat.kt") - public void testRealStringRepeat_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringRepeat.kt", "kotlin.coroutines"); + public void testRealStringRepeat() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringRepeat.kt"); } @TestMetadata("returnInParentheses.kt") - public void testReturnInParentheses_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/returnInParentheses.kt", "kotlin.coroutines"); + public void testReturnInParentheses() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/returnInParentheses.kt"); } @TestMetadata("sum.kt") - public void testSum_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/sum.kt", "kotlin.coroutines"); + public void testSum() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/sum.kt"); } @TestMetadata("tailCallInBlockInParentheses.kt") - public void testTailCallInBlockInParentheses_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInBlockInParentheses.kt", "kotlin.coroutines"); + public void testTailCallInBlockInParentheses() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInBlockInParentheses.kt"); } @TestMetadata("tailCallInParentheses.kt") - public void testTailCallInParentheses_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInParentheses.kt", "kotlin.coroutines"); + public void testTailCallInParentheses() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInParentheses.kt"); } @TestMetadata("whenWithIs.kt") - public void testWhenWithIs_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/whenWithIs.kt", "kotlin.coroutines"); + public void testWhenWithIs() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/whenWithIs.kt"); } } } @@ -6385,10 +6349,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInDirect() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses/direct"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @@ -6404,58 +6364,58 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Any.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineInt() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineInt.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Int.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Long() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Long.kt"); } @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_NAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_NAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_nonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_nonLocalReturn.kt"); } @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_suspendFunType() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_suspendFunType.kt"); } @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationCrossinline.kt", "kotlin.coroutines"); + public void testBridgeGenerationCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationCrossinline.kt"); } @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationNonInline.kt", "kotlin.coroutines"); + public void testBridgeGenerationNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationNonInline.kt"); } @TestMetadata("covariantOverrideSuspendFun.kt") @@ -6569,8 +6529,8 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); + public void testInterfaceDelegateWithInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt"); } @TestMetadata("invokeOperator.kt") @@ -6579,28 +6539,28 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt"); } @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any.kt"); } @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_itf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_itf.kt"); } @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_this.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_this() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_this.kt"); } @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Int.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Int.kt"); } @TestMetadata("returnResult.kt") @@ -6617,10 +6577,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInResume() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses/resume"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @@ -6636,58 +6592,58 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Any.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineInt() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineInt.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Int.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Long() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Long.kt"); } @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_NAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_NAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_nonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_nonLocalReturn.kt"); } @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_suspendFunType() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_suspendFunType.kt"); } @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationCrossinline.kt", "kotlin.coroutines"); + public void testBridgeGenerationCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationCrossinline.kt"); } @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationNonInline.kt", "kotlin.coroutines"); + public void testBridgeGenerationNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationNonInline.kt"); } @TestMetadata("covariantOverrideSuspendFun.kt") @@ -6801,8 +6757,8 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); + public void testInterfaceDelegateWithInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt"); } @TestMetadata("invokeOperator.kt") @@ -6811,28 +6767,28 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt"); } @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any.kt"); } @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_itf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_itf.kt"); } @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_this.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_this() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_this.kt"); } @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Int.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Int.kt"); } @TestMetadata("returnResult.kt") @@ -6849,10 +6805,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInResumeWithException() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @@ -6868,58 +6820,58 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("boxUnboxInsideCoroutine.kt") - public void testBoxUnboxInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Any.kt") - public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Any.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt") - public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt") - public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_InlineInt() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineInt.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Int.kt") - public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Int.kt"); } @TestMetadata("boxUnboxInsideCoroutine_Long.kt") - public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_Long() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Long.kt"); } @TestMetadata("boxUnboxInsideCoroutine_NAny.kt") - public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_NAny() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_NAny.kt"); } @TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt") - public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_nonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_nonLocalReturn.kt"); } @TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt") - public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines"); + public void testBoxUnboxInsideCoroutine_suspendFunType() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_suspendFunType.kt"); } @TestMetadata("bridgeGenerationCrossinline.kt") - public void testBridgeGenerationCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationCrossinline.kt", "kotlin.coroutines"); + public void testBridgeGenerationCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationCrossinline.kt"); } @TestMetadata("bridgeGenerationNonInline.kt") - public void testBridgeGenerationNonInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationNonInline.kt", "kotlin.coroutines"); + public void testBridgeGenerationNonInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationNonInline.kt"); } @TestMetadata("covariantOverrideSuspendFun.kt") @@ -7018,8 +6970,8 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("interfaceDelegateWithInlineClass.kt") - public void testInterfaceDelegateWithInlineClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines"); + public void testInterfaceDelegateWithInlineClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt"); } @TestMetadata("invokeOperator.kt") @@ -7028,28 +6980,28 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("overrideSuspendFun.kt") - public void testOverrideSuspendFun_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt"); } @TestMetadata("overrideSuspendFun_Any.kt") - public void testOverrideSuspendFun_Any_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any.kt"); } @TestMetadata("overrideSuspendFun_Any_itf.kt") - public void testOverrideSuspendFun_Any_itf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_itf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_itf.kt"); } @TestMetadata("overrideSuspendFun_Any_this.kt") - public void testOverrideSuspendFun_Any_this_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_this.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Any_this() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_this.kt"); } @TestMetadata("overrideSuspendFun_Int.kt") - public void testOverrideSuspendFun_Int_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Int.kt", "kotlin.coroutines"); + public void testOverrideSuspendFun_Int() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Int.kt"); } @TestMetadata("returnResult.kt") @@ -7067,22 +7019,18 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInIntLikeVarSpilling() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/intLikeVarSpilling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @TestMetadata("complicatedMerge.kt") - public void testComplicatedMerge_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt", "kotlin.coroutines"); + public void testComplicatedMerge() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt"); } @TestMetadata("i2bResult.kt") - public void testI2bResult_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines"); + public void testI2bResult() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt"); } @TestMetadata("listThrowablePairInOneSlot.kt") @@ -7091,33 +7039,33 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("loadFromBooleanArray.kt") - public void testLoadFromBooleanArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines"); + public void testLoadFromBooleanArray() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt"); } @TestMetadata("loadFromByteArray.kt") - public void testLoadFromByteArray_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt", "kotlin.coroutines"); + public void testLoadFromByteArray() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt"); } @TestMetadata("noVariableInTable.kt") - public void testNoVariableInTable_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt", "kotlin.coroutines"); + public void testNoVariableInTable() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt"); } @TestMetadata("sameIconst1ManyVars.kt") - public void testSameIconst1ManyVars_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt", "kotlin.coroutines"); + public void testSameIconst1ManyVars() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt"); } @TestMetadata("usedInMethodCall.kt") - public void testUsedInMethodCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt", "kotlin.coroutines"); + public void testUsedInMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt"); } @TestMetadata("usedInVarStore.kt") - public void testUsedInVarStore_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt", "kotlin.coroutines"); + public void testUsedInVarStore() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt"); } } @@ -7129,52 +7077,48 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInIntrinsicSemantics() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/intrinsicSemantics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } - @TestMetadata("coroutineContextReceiverNotIntrinsic.kt") - public void testCoroutineContextReceiverNotIntrinsic_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiverNotIntrinsic.kt", "kotlin.coroutines"); + @TestMetadata("coroutineContext.kt") + public void testCoroutineContext() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContext.kt"); } @TestMetadata("coroutineContextReceiver.kt") - public void testCoroutineContextReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiver.kt", "kotlin.coroutines"); + public void testCoroutineContextReceiver() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiver.kt"); } - @TestMetadata("coroutineContext.kt") - public void testCoroutineContext_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContext.kt", "kotlin.coroutines"); + @TestMetadata("coroutineContextReceiverNotIntrinsic.kt") + public void testCoroutineContextReceiverNotIntrinsic() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiverNotIntrinsic.kt"); } @TestMetadata("intercepted.kt") - public void testIntercepted_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/intercepted.kt", "kotlin.coroutines"); - } - - @TestMetadata("startCoroutineUninterceptedOrReturnInterception.kt") - public void testStartCoroutineUninterceptedOrReturnInterception_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt", "kotlin.coroutines"); - } - - @TestMetadata("startCoroutineUninterceptedOrReturn.kt") - public void testStartCoroutineUninterceptedOrReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt", "kotlin.coroutines"); + public void testIntercepted() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/intercepted.kt"); } @TestMetadata("startCoroutine.kt") - public void testStartCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt", "kotlin.coroutines"); + public void testStartCoroutine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt"); + } + + @TestMetadata("startCoroutineUninterceptedOrReturn.kt") + public void testStartCoroutineUninterceptedOrReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt"); + } + + @TestMetadata("startCoroutineUninterceptedOrReturnInterception.kt") + public void testStartCoroutineUninterceptedOrReturnInterception() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt"); } @TestMetadata("suspendCoroutineUninterceptedOrReturn.kt") - public void testSuspendCoroutineUninterceptedOrReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intrinsicSemantics/suspendCoroutineUninterceptedOrReturn.kt", "kotlin.coroutines"); + public void testSuspendCoroutineUninterceptedOrReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/intrinsicSemantics/suspendCoroutineUninterceptedOrReturn.kt"); } } @@ -7186,10 +7130,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInJavaInterop() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @@ -7215,17 +7155,13 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInAnonymous() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/localFunctions/anonymous"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/anonymous/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/anonymous/simple.kt"); } } @@ -7237,62 +7173,58 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInNamed() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/localFunctions/named"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @TestMetadata("capturedParameters.kt") - public void testCapturedParameters_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedParameters.kt", "kotlin.coroutines"); + public void testCapturedParameters() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedParameters.kt"); } @TestMetadata("capturedVariables.kt") - public void testCapturedVariables_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedVariables.kt", "kotlin.coroutines"); + public void testCapturedVariables() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/capturedVariables.kt"); } @TestMetadata("extension.kt") - public void testExtension_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/extension.kt", "kotlin.coroutines"); + public void testExtension() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/extension.kt"); } @TestMetadata("infix.kt") - public void testInfix_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/infix.kt", "kotlin.coroutines"); + public void testInfix() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/infix.kt"); } @TestMetadata("insideLambda.kt") - public void testInsideLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/insideLambda.kt", "kotlin.coroutines"); + public void testInsideLambda() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/insideLambda.kt"); } @TestMetadata("nestedLocals.kt") - public void testNestedLocals_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/nestedLocals.kt", "kotlin.coroutines"); - } - - @TestMetadata("simpleSuspensionPoint.kt") - public void testSimpleSuspensionPoint_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/simpleSuspensionPoint.kt", "kotlin.coroutines"); + public void testNestedLocals() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/nestedLocals.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/simple.kt"); + } + + @TestMetadata("simpleSuspensionPoint.kt") + public void testSimpleSuspensionPoint() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/simpleSuspensionPoint.kt"); } @TestMetadata("stateMachine.kt") - public void testStateMachine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/stateMachine.kt", "kotlin.coroutines"); + public void testStateMachine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/stateMachine.kt"); } @TestMetadata("withArguments.kt") - public void testWithArguments_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/localFunctions/named/withArguments.kt", "kotlin.coroutines"); + public void testWithArguments() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/localFunctions/named/withArguments.kt"); } } } @@ -7305,52 +7237,48 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInMultiModule() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @TestMetadata("inlineCrossModule.kt") - public void testInlineCrossModule_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt", "kotlin.coroutines"); + public void testInlineCrossModule() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt"); } @TestMetadata("inlineFunctionWithOptionalParam.kt") - public void testInlineFunctionWithOptionalParam_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt", "kotlin.coroutines"); - } - - @TestMetadata("inlineMultiModuleOverride.kt") - public void testInlineMultiModuleOverride_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleOverride.kt", "kotlin.coroutines"); - } - - @TestMetadata("inlineMultiModuleWithController.kt") - public void testInlineMultiModuleWithController_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithController.kt", "kotlin.coroutines"); - } - - @TestMetadata("inlineMultiModuleWithInnerInlining.kt") - public void testInlineMultiModuleWithInnerInlining_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithInnerInlining.kt", "kotlin.coroutines"); + public void testInlineFunctionWithOptionalParam() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt"); } @TestMetadata("inlineMultiModule.kt") - public void testInlineMultiModule_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModule.kt", "kotlin.coroutines"); + public void testInlineMultiModule() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModule.kt"); + } + + @TestMetadata("inlineMultiModuleOverride.kt") + public void testInlineMultiModuleOverride() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleOverride.kt"); + } + + @TestMetadata("inlineMultiModuleWithController.kt") + public void testInlineMultiModuleWithController() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithController.kt"); + } + + @TestMetadata("inlineMultiModuleWithInnerInlining.kt") + public void testInlineMultiModuleWithInnerInlining() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithInnerInlining.kt"); } @TestMetadata("inlineTailCall.kt") - public void testInlineTailCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineTailCall.kt", "kotlin.coroutines"); + public void testInlineTailCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineTailCall.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/multiModule/simple.kt"); } } @@ -7362,17 +7290,13 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInRedundantLocalsElimination() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/redundantLocalsElimination"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @TestMetadata("ktor_receivedMessage.kt") - public void testKtor_receivedMessage_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/redundantLocalsElimination/ktor_receivedMessage.kt", "kotlin.coroutines"); + public void testKtor_receivedMessage() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/redundantLocalsElimination/ktor_receivedMessage.kt"); } } @@ -7397,42 +7321,38 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInStackUnwinding() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/stackUnwinding"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @TestMetadata("exception.kt") - public void testException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/exception.kt", "kotlin.coroutines"); + public void testException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/exception.kt"); } @TestMetadata("inlineSuspendFunction.kt") - public void testInlineSuspendFunction_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt", "kotlin.coroutines"); - } - - @TestMetadata("rethrowInFinallyWithSuspension.kt") - public void testRethrowInFinallyWithSuspension_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinallyWithSuspension.kt", "kotlin.coroutines"); + public void testInlineSuspendFunction() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt"); } @TestMetadata("rethrowInFinally.kt") - public void testRethrowInFinally_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinally.kt", "kotlin.coroutines"); + public void testRethrowInFinally() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinally.kt"); + } + + @TestMetadata("rethrowInFinallyWithSuspension.kt") + public void testRethrowInFinallyWithSuspension() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinallyWithSuspension.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt"); } @TestMetadata("suspendInCycle.kt") - public void testSuspendInCycle_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt", "kotlin.coroutines"); + public void testSuspendInCycle() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt"); } } @@ -7477,22 +7397,18 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInSuspendFunctionAsCoroutine() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @TestMetadata("dispatchResume.kt") - public void testDispatchResume_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt", "kotlin.coroutines"); + public void testDispatchResume() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt"); } @TestMetadata("handleException.kt") - public void testHandleException_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt", "kotlin.coroutines"); + public void testHandleException() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt"); } @TestMetadata("ifExpressionInsideCoroutine_1_3.kt") @@ -7500,74 +7416,74 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine_1_3.kt"); } - @TestMetadata("inlineTwoReceivers.kt") - public void testInlineTwoReceivers_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt", "kotlin.coroutines"); + @TestMetadata("inline.kt") + public void testInline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt"); } - @TestMetadata("inline.kt") - public void testInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt", "kotlin.coroutines"); + @TestMetadata("inlineTwoReceivers.kt") + public void testInlineTwoReceivers() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt"); } @TestMetadata("member.kt") - public void testMember_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt", "kotlin.coroutines"); + public void testMember() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt"); } @TestMetadata("noinlineTwoReceivers.kt") - public void testNoinlineTwoReceivers_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt", "kotlin.coroutines"); + public void testNoinlineTwoReceivers() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt"); } @TestMetadata("operators.kt") - public void testOperators_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt", "kotlin.coroutines"); + public void testOperators() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt"); } @TestMetadata("privateFunctions.kt") - public void testPrivateFunctions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt", "kotlin.coroutines"); + public void testPrivateFunctions() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt"); } @TestMetadata("privateInFile.kt") - public void testPrivateInFile_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt", "kotlin.coroutines"); + public void testPrivateInFile() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt"); } @TestMetadata("returnNoSuspend.kt") - public void testReturnNoSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt", "kotlin.coroutines"); + public void testReturnNoSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt", "kotlin.coroutines"); - } - - @TestMetadata("superCallAbstractClass.kt") - public void testSuperCallAbstractClass_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallAbstractClass.kt", "kotlin.coroutines"); - } - - @TestMetadata("superCallInterface.kt") - public void testSuperCallInterface_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallInterface.kt", "kotlin.coroutines"); - } - - @TestMetadata("superCallOverload.kt") - public void testSuperCallOverload_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallOverload.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt"); } @TestMetadata("superCall.kt") - public void testSuperCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt", "kotlin.coroutines"); + public void testSuperCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt"); + } + + @TestMetadata("superCallAbstractClass.kt") + public void testSuperCallAbstractClass() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallAbstractClass.kt"); + } + + @TestMetadata("superCallInterface.kt") + public void testSuperCallInterface() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallInterface.kt"); + } + + @TestMetadata("superCallOverload.kt") + public void testSuperCallOverload() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallOverload.kt"); } @TestMetadata("withVariables.kt") - public void testWithVariables_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt", "kotlin.coroutines"); + public void testWithVariables() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt"); } } @@ -7579,37 +7495,33 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInSuspendFunctionTypeCall() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @TestMetadata("localVal.kt") - public void testLocalVal_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt", "kotlin.coroutines"); - } - - @TestMetadata("manyParametersNoCapture.kt") - public void testManyParametersNoCapture_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParametersNoCapture.kt", "kotlin.coroutines"); + public void testLocalVal() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt"); } @TestMetadata("manyParameters.kt") - public void testManyParameters_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt", "kotlin.coroutines"); + public void testManyParameters() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt"); + } + + @TestMetadata("manyParametersNoCapture.kt") + public void testManyParametersNoCapture() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParametersNoCapture.kt"); } @TestMetadata("simple.kt") - public void testSimple_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt", "kotlin.coroutines"); + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt"); } @TestMetadata("suspendModifier.kt") - public void testSuspendModifier_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt", "kotlin.coroutines"); + public void testSuspendModifier() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt"); } } @@ -7621,32 +7533,28 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInTailCallOptimizations() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/tailCallOptimizations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @TestMetadata("crossinline.kt") - public void testCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/crossinline.kt", "kotlin.coroutines"); + public void testCrossinline() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/crossinline.kt"); } @TestMetadata("inlineWithoutStateMachine.kt") - public void testInlineWithoutStateMachine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt", "kotlin.coroutines"); + public void testInlineWithoutStateMachine() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt"); } @TestMetadata("innerObjectRetransformation.kt") - public void testInnerObjectRetransformation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation.kt", "kotlin.coroutines"); + public void testInnerObjectRetransformation() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation.kt"); } @TestMetadata("tryCatch.kt") - public void testTryCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailCallOptimizations/tryCatch.kt", "kotlin.coroutines"); + public void testTryCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/tryCatch.kt"); } @TestMetadata("compiler/testData/codegen/box/coroutines/tailCallOptimizations/unit") @@ -7671,32 +7579,28 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInTailOperations() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/tailOperations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @TestMetadata("suspendWithIf.kt") - public void testSuspendWithIf_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithIf.kt", "kotlin.coroutines"); + public void testSuspendWithIf() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithIf.kt"); } @TestMetadata("suspendWithTryCatch.kt") - public void testSuspendWithTryCatch_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt", "kotlin.coroutines"); + public void testSuspendWithTryCatch() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt"); } @TestMetadata("suspendWithWhen.kt") - public void testSuspendWithWhen_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithWhen.kt", "kotlin.coroutines"); + public void testSuspendWithWhen() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/suspendWithWhen.kt"); } @TestMetadata("tailInlining.kt") - public void testTailInlining_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/tailOperations/tailInlining.kt", "kotlin.coroutines"); + public void testTailInlining() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/tailOperations/tailInlining.kt"); } } @@ -7708,22 +7612,18 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInUnitTypeReturn() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/unitTypeReturn"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @TestMetadata("coroutineNonLocalReturn.kt") - public void testCoroutineNonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt", "kotlin.coroutines"); + public void testCoroutineNonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt"); } @TestMetadata("coroutineReturn.kt") - public void testCoroutineReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt", "kotlin.coroutines"); + public void testCoroutineReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt"); } @TestMetadata("inlineUnitFunction.kt") @@ -7737,18 +7637,18 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("suspendNonLocalReturn.kt") - public void testSuspendNonLocalReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt", "kotlin.coroutines"); + public void testSuspendNonLocalReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt"); } @TestMetadata("suspendReturn.kt") - public void testSuspendReturn_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt", "kotlin.coroutines"); + public void testSuspendReturn() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt"); } @TestMetadata("unitSafeCall.kt") - public void testUnitSafeCall_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/unitTypeReturn/unitSafeCall.kt", "kotlin.coroutines"); + public void testUnitSafeCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/unitTypeReturn/unitSafeCall.kt"); } } @@ -7760,10 +7660,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInVarSpilling() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/varSpilling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @@ -7774,18 +7670,18 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @TestMetadata("kt19475.kt") - public void testKt19475_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/kt19475.kt", "kotlin.coroutines"); + public void testKt19475() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt19475.kt"); } @TestMetadata("kt38925.kt") - public void testKt38925_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/kt38925.kt", "kotlin.coroutines"); + public void testKt38925() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt38925.kt"); } @TestMetadata("nullSpilling.kt") - public void testNullSpilling_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/nullSpilling.kt", "kotlin.coroutines"); + public void testNullSpilling() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/nullSpilling.kt"); } @TestMetadata("refinedIntTypesAnalysis.kt") @@ -16842,10 +16738,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInParametersMetadata() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/parametersMetadata"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java index 9a4df584fd9..0e519de0f46 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java @@ -3557,72 +3557,68 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInSuspend() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @TestMetadata("capturedVariables.kt") - public void testCapturedVariables_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/capturedVariables.kt", "kotlin.coroutines"); + public void testCapturedVariables() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/capturedVariables.kt"); } @TestMetadata("crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt") - public void testCrossinlineSuspendLambdaInsideCrossinlineSuspendLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt", "kotlin.coroutines"); + public void testCrossinlineSuspendLambdaInsideCrossinlineSuspendLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt"); } @TestMetadata("delegatedProperties.kt") - public void testDelegatedProperties_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt", "kotlin.coroutines"); + public void testDelegatedProperties() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt"); } @TestMetadata("doubleRegenerationWithNonSuspendingLambda.kt") - public void testDoubleRegenerationWithNonSuspendingLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt", "kotlin.coroutines"); + public void testDoubleRegenerationWithNonSuspendingLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt"); } @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt"); } @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt"); } @TestMetadata("kt26658.kt") @@ -3631,18 +3627,18 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest { } @TestMetadata("maxStackWithCrossinline.kt") - public void testMaxStackWithCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt", "kotlin.coroutines"); + public void testMaxStackWithCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt"); } @TestMetadata("multipleLocals.kt") - public void testMultipleLocals_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines"); + public void testMultipleLocals() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt"); } @TestMetadata("multipleSuspensionPoints.kt") - public void testMultipleSuspensionPoints_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt", "kotlin.coroutines"); + public void testMultipleSuspensionPoints() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt"); } @TestMetadata("nonLocalReturn.kt") @@ -3651,23 +3647,23 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest { } @TestMetadata("nonSuspendCrossinline.kt") - public void testNonSuspendCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt", "kotlin.coroutines"); + public void testNonSuspendCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt"); } @TestMetadata("returnValue.kt") - public void testReturnValue_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/returnValue.kt", "kotlin.coroutines"); + public void testReturnValue() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/returnValue.kt"); } @TestMetadata("tryCatchReceiver.kt") - public void testTryCatchReceiver_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt", "kotlin.coroutines"); + public void testTryCatchReceiver() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt"); } @TestMetadata("tryCatchStackTransform.kt") - public void testTryCatchStackTransform_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt", "kotlin.coroutines"); + public void testTryCatchStackTransform() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt"); } @TestMetadata("twiceRegeneratedAnonymousObject.kt") @@ -3726,17 +3722,13 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInDefaultParameter() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/defaultParameter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @TestMetadata("defaultValueCrossinline.kt") - public void testDefaultValueCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt", "kotlin.coroutines"); + public void testDefaultValueCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt"); } @TestMetadata("defaultValueInClass.kt") @@ -3744,14 +3736,14 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest { runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInClass.kt"); } - @TestMetadata("defaultValueInlineFromMultiFileFacade.kt") - public void testDefaultValueInlineFromMultiFileFacade_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt", "kotlin.coroutines"); + @TestMetadata("defaultValueInline.kt") + public void testDefaultValueInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt"); } - @TestMetadata("defaultValueInline.kt") - public void testDefaultValueInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt", "kotlin.coroutines"); + @TestMetadata("defaultValueInlineFromMultiFileFacade.kt") + public void testDefaultValueInlineFromMultiFileFacade() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt"); } } @@ -3809,52 +3801,48 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInReceiver() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/receiver"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @TestMetadata("inlineOrdinaryOfCrossinlineSuspend.kt") - public void testInlineOrdinaryOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt"); } @TestMetadata("inlineOrdinaryOfNoinlineSuspend.kt") - public void testInlineOrdinaryOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineOrdinaryOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfCrossinlineOrdinary.kt") - public void testInlineSuspendOfCrossinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfCrossinlineSuspend.kt") - public void testInlineSuspendOfCrossinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfCrossinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfNoinlineOrdinary.kt") - public void testInlineSuspendOfNoinlineOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt"); } @TestMetadata("inlineSuspendOfNoinlineSuspend.kt") - public void testInlineSuspendOfNoinlineSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfNoinlineSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt"); } @TestMetadata("inlineSuspendOfOrdinary.kt") - public void testInlineSuspendOfOrdinary_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt", "kotlin.coroutines"); + public void testInlineSuspendOfOrdinary() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt"); } @TestMetadata("inlineSuspendOfSuspend.kt") - public void testInlineSuspendOfSuspend_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt", "kotlin.coroutines"); + public void testInlineSuspendOfSuspend() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt"); } } @@ -3866,77 +3854,73 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath); - } - public void testAllFilesPresentInStateMachine() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/stateMachine"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } @TestMetadata("crossingCoroutineBoundaries.kt") - public void testCrossingCoroutineBoundaries_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt", "kotlin.coroutines"); + public void testCrossingCoroutineBoundaries() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt"); } @TestMetadata("independentInline.kt") - public void testIndependentInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerLambdaInsideLambda.kt") - public void testInnerLambdaInsideLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerLambdaWithoutCrossinline.kt") - public void testInnerLambdaWithoutCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt", "kotlin.coroutines"); + public void testIndependentInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt"); } @TestMetadata("innerLambda.kt") - public void testInnerLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt", "kotlin.coroutines"); + public void testInnerLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt"); } - @TestMetadata("innerMadnessCallSite.kt") - public void testInnerMadnessCallSite_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt", "kotlin.coroutines"); + @TestMetadata("innerLambdaInsideLambda.kt") + public void testInnerLambdaInsideLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt"); + } + + @TestMetadata("innerLambdaWithoutCrossinline.kt") + public void testInnerLambdaWithoutCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt"); } @TestMetadata("innerMadness.kt") - public void testInnerMadness_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt", "kotlin.coroutines"); + public void testInnerMadness() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt"); } - @TestMetadata("innerObjectInsideInnerObject.kt") - public void testInnerObjectInsideInnerObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectRetransformation.kt") - public void testInnerObjectRetransformation_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectSeveralFunctions.kt") - public void testInnerObjectSeveralFunctions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt", "kotlin.coroutines"); - } - - @TestMetadata("innerObjectWithoutCapturingCrossinline.kt") - public void testInnerObjectWithoutCapturingCrossinline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt", "kotlin.coroutines"); + @TestMetadata("innerMadnessCallSite.kt") + public void testInnerMadnessCallSite() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt"); } @TestMetadata("innerObject.kt") - public void testInnerObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt", "kotlin.coroutines"); + public void testInnerObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt"); + } + + @TestMetadata("innerObjectInsideInnerObject.kt") + public void testInnerObjectInsideInnerObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt"); + } + + @TestMetadata("innerObjectRetransformation.kt") + public void testInnerObjectRetransformation() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt"); + } + + @TestMetadata("innerObjectSeveralFunctions.kt") + public void testInnerObjectSeveralFunctions() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt"); + } + + @TestMetadata("innerObjectWithoutCapturingCrossinline.kt") + public void testInnerObjectWithoutCapturingCrossinline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt"); } @TestMetadata("insideObject.kt") - public void testInsideObject_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt", "kotlin.coroutines"); + public void testInsideObject() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt"); } @TestMetadata("lambdaTransformation.kt") @@ -3945,43 +3929,43 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest { } @TestMetadata("normalInline.kt") - public void testNormalInline_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt", "kotlin.coroutines"); + public void testNormalInline() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt"); } @TestMetadata("numberOfSuspentions.kt") - public void testNumberOfSuspentions_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt", "kotlin.coroutines"); + public void testNumberOfSuspentions() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt"); } @TestMetadata("objectInsideLambdas.kt") - public void testObjectInsideLambdas_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt", "kotlin.coroutines"); + public void testObjectInsideLambdas() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt"); } @TestMetadata("oneInlineTwoCaptures.kt") - public void testOneInlineTwoCaptures_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt", "kotlin.coroutines"); + public void testOneInlineTwoCaptures() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt"); } @TestMetadata("passLambda.kt") - public void testPassLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt", "kotlin.coroutines"); - } - - @TestMetadata("passParameterLambda.kt") - public void testPassParameterLambda_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt", "kotlin.coroutines"); + public void testPassLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt"); } @TestMetadata("passParameter.kt") - public void testPassParameter_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt", "kotlin.coroutines"); + public void testPassParameter() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt"); + } + + @TestMetadata("passParameterLambda.kt") + public void testPassParameterLambda() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt"); } @TestMetadata("unreachableSuspendMarker.kt") - public void testUnreachableSuspendMarker_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt", "kotlin.coroutines"); + public void testUnreachableSuspendMarker() throws Exception { + runTest("compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt"); } } } diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index 20538c6806f..99bde8de4b9 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -594,10 +594,6 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.WASM, testDataFilePath); - } - public void testAllFilesPresentInJvm() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/assert/jvm"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); } @@ -2861,10 +2857,6 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath); } - private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.WASM, testDataFilePath); - } - public void testAllFilesPresentInCapturedVarsOptimization() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/closures/capturedVarsOptimization"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); } From aacf934b49c029c4ad5aa6cb8dce031b48965ed2 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Tue, 1 Dec 2020 17:46:41 +0300 Subject: [PATCH 571/698] [TEST] Drop machinery about experimental coroutines from compiler tests --- .../java/AbstractFirTypeEnhancementTest.kt | 2 +- .../checkers/AbstractDiagnosticsTest.kt | 25 +++---------- .../AbstractDiagnosticsTestWithStdLib.kt | 2 +- .../checkers/KotlinMultiFileTestWithJava.kt | 7 +--- .../codegen/AbstractBlackBoxCodegenTest.java | 8 ++--- .../codegen/AbstractBytecodeListingTest.kt | 3 +- .../codegen/AbstractDumpDeclarationsTest.kt | 4 +-- .../kotlin/codegen/CodegenTestCase.java | 15 ++------ .../kotlin/fir/AbstractFirDiagnosticTest.kt | 9 +---- .../jvm/compiler/AbstractLoadJavaTest.java | 2 +- .../resolve/ExtensibleResolveTestCase.java | 2 +- .../jetbrains/kotlin/test/KotlinBaseTest.kt | 35 ++----------------- .../kotlin/test/KotlinTestUtils.java | 2 +- .../org/jetbrains/kotlin/test/TestFiles.java | 17 +++------ .../AbstractJvmRuntimeDescriptorLoaderTest.kt | 3 +- .../quickfix/AbstractQuickFixMultiFileTest.kt | 2 +- .../js/test/AbstractJsLineNumberTest.kt | 4 +-- .../jetbrains/kotlin/js/test/BasicBoxTest.kt | 3 +- .../kotlin/js/test/BasicWasmBoxTest.kt | 8 +---- 19 files changed, 31 insertions(+), 122 deletions(-) diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/java/AbstractFirTypeEnhancementTest.kt b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/java/AbstractFirTypeEnhancementTest.kt index de044a956ec..47147ad1248 100644 --- a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/java/AbstractFirTypeEnhancementTest.kt +++ b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/java/AbstractFirTypeEnhancementTest.kt @@ -116,7 +116,7 @@ abstract class AbstractFirTypeEnhancementTest : KtUsefulTestCase() { return targetFile } - }, "" + } ) environment = createEnvironment(content) val virtualFiles = srcFiles.map { diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt index 77f25e674ed..1a0ee265e1c 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt @@ -17,7 +17,6 @@ import org.jetbrains.kotlin.TestsCompilerError import org.jetbrains.kotlin.analyzer.AnalysisResult import org.jetbrains.kotlin.analyzer.common.CommonResolverForModuleFactory import org.jetbrains.kotlin.asJava.finder.JavaElementFinder -import org.jetbrains.kotlin.builtins.StandardNames import org.jetbrains.kotlin.builtins.jvm.JvmBuiltIns import org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport import org.jetbrains.kotlin.cli.common.messages.GroupingMessageCollector @@ -127,15 +126,7 @@ abstract class AbstractDiagnosticsTest : BaseDiagnosticsTest() { val oldModule = modules[testModule]!! - val languageVersionSettings = - if (coroutinesPackage.isNotEmpty()) { - val isExperimental = coroutinesPackage == StandardNames.COROUTINES_PACKAGE_FQ_NAME_EXPERIMENTAL.asString() - CompilerTestLanguageVersionSettings( - DEFAULT_DIAGNOSTIC_TESTS_FEATURES, - if (isExperimental) ApiVersion.KOTLIN_1_2 else ApiVersion.KOTLIN_1_3, - if (isExperimental) LanguageVersion.KOTLIN_1_2 else LanguageVersion.KOTLIN_1_3 - ) - } else loadLanguageVersionSettings(testFilesInModule) + val languageVersionSettings = loadLanguageVersionSettings(testFilesInModule) languageVersionSettingsByModule[testModule] = languageVersionSettings @@ -180,7 +171,7 @@ abstract class AbstractDiagnosticsTest : BaseDiagnosticsTest() { var exceptionFromDescriptorValidation: Throwable? = null try { val expectedFile = getExpectedDescriptorFile(testDataFile, files) - validateAndCompareDescriptorWithFile(expectedFile, files, modules, coroutinesPackage) + validateAndCompareDescriptorWithFile(expectedFile, files, modules) } catch (e: Throwable) { exceptionFromDescriptorValidation = e } @@ -262,9 +253,7 @@ abstract class AbstractDiagnosticsTest : BaseDiagnosticsTest() { } protected open fun checkDiagnostics(actualText: String, testDataFile: File) { - KotlinTestUtils.assertEqualsToFile(getExpectedDiagnosticsFile(testDataFile), actualText) { s -> - s.replace("COROUTINES_PACKAGE", coroutinesPackage) - } + KotlinTestUtils.assertEqualsToFile(getExpectedDiagnosticsFile(testDataFile), actualText) } private fun checkFirTestdata(testDataFile: File, files: List) { @@ -289,7 +278,6 @@ abstract class AbstractDiagnosticsTest : BaseDiagnosticsTest() { val testRunner = object : AbstractFirOldFrontendDiagnosticsTest() { init { environment = this@AbstractDiagnosticsTest.environment - coroutinesPackage = this@AbstractDiagnosticsTest.coroutinesPackage } } if (testDataFile.readText().contains("// FIR_IDENTICAL")) { @@ -529,8 +517,7 @@ abstract class AbstractDiagnosticsTest : BaseDiagnosticsTest() { private fun validateAndCompareDescriptorWithFile( expectedFile: File, testFiles: List, - modules: Map, - coroutinesPackage: String + modules: Map ) { if (skipDescriptorsValidation()) return if (testFiles.any { file -> InTextDirectivesUtils.isDirectiveDefined(file.expectedText, "// SKIP_TXT") }) { @@ -591,9 +578,7 @@ abstract class AbstractDiagnosticsTest : BaseDiagnosticsTest() { "Such tests are hard to maintain, take long time to execute and are subject to sudden unreviewed changes anyway." } - KotlinTestUtils.assertEqualsToFile(expectedFile, allPackagesText) { s -> - s.replace("COROUTINES_PACKAGE", coroutinesPackage) - } + KotlinTestUtils.assertEqualsToFile(expectedFile, allPackagesText) } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTestWithStdLib.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTestWithStdLib.kt index 4ea5ecd7872..58f86254873 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTestWithStdLib.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTestWithStdLib.kt @@ -16,6 +16,6 @@ abstract class AbstractDiagnosticsTestWithStdLib : AbstractDiagnosticsTest() { override fun shouldValidateFirTestData(testDataFile: File): Boolean { val path = testDataFile.absolutePath - return !path.endsWith(".kts") && coroutinesPackage != StandardNames.COROUTINES_PACKAGE_FQ_NAME_EXPERIMENTAL.asString() + return !path.endsWith(".kts") } } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/KotlinMultiFileTestWithJava.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/KotlinMultiFileTestWithJava.kt index 398d20ae6dc..525689ce89d 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/KotlinMultiFileTestWithJava.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/KotlinMultiFileTestWithJava.kt @@ -88,11 +88,6 @@ abstract class KotlinMultiFileTestWithJava s.replace("COROUTINES_PACKAGE", coroutinesPackage)); + assertEqualsToFile(expectedFile, text); } protected void blackBox(boolean reportProblems, boolean unexpectedBehaviour) { diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBytecodeListingTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBytecodeListingTest.kt index a5f74ca9ffd..701cb204048 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBytecodeListingTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBytecodeListingTest.kt @@ -31,8 +31,7 @@ abstract class AbstractBytecodeListingTest : CodegenTestCase() { ) val prefixes = when { - backend.isIR -> listOf("_ir", "_1_3", "") - coroutinesPackage == StandardNames.COROUTINES_PACKAGE_FQ_NAME_RELEASE.asString() -> listOf("_1_3", "") + backend.isIR -> listOf("_ir", "") else -> listOf("") } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractDumpDeclarationsTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractDumpDeclarationsTest.kt index 4699e551d3d..c47c6429ea7 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractDumpDeclarationsTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractDumpDeclarationsTest.kt @@ -19,9 +19,7 @@ abstract class AbstractDumpDeclarationsTest : CodegenTestCase() { dumpToFile = KotlinTestUtils.tmpDirForTest(this).resolve("$name.json") compile(files) classFileFactory.generationState.destroy() - KotlinTestUtils.assertEqualsToFile(expectedResult, dumpToFile.readText()) { - it.replace("COROUTINES_PACKAGE", coroutinesPackage) - } + KotlinTestUtils.assertEqualsToFile(expectedResult, dumpToFile.readText()) } override fun updateConfiguration(configuration: CompilerConfiguration) { diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java index bbe6985df8c..0048d97e788 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java @@ -607,32 +607,21 @@ public abstract class CodegenTestCase extends KotlinBaseTest testFiles = createTestFilesFromFile(file, expectedText); doMultiFileTest(file, testFiles); } - @Override - protected void doTestWithCoroutinesPackageReplacement(@NotNull String filePath, @NotNull String packageName) throws Exception { - this.coroutinesPackage = packageName; - doTest(filePath); - } - @Override @NotNull protected List createTestFilesFromFile(@NotNull File file, @NotNull String expectedText) { - return createTestFilesFromFile(file, expectedText, coroutinesPackage, parseDirectivesPerFiles(), getBackend()); + return createTestFilesFromFile(file, expectedText, parseDirectivesPerFiles(), getBackend()); } @NotNull public static List createTestFilesFromFile( @NotNull File file, @NotNull String expectedText, - @NotNull String coroutinesPackage, boolean parseDirectivesPerFiles, @NotNull TargetBackend backend ) { @@ -643,7 +632,7 @@ public abstract class CodegenTestCase extends KotlinBaseTest javaPackageAndContext = compileJavaAndLoadTestPackageAndBindingContextFromBinary( srcFiles, compiledDir, ConfigurationKind.ALL diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/resolve/ExtensibleResolveTestCase.java b/compiler/tests-common/tests/org/jetbrains/kotlin/resolve/ExtensibleResolveTestCase.java index a32170843b9..0ca2cf943ee 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/resolve/ExtensibleResolveTestCase.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/resolve/ExtensibleResolveTestCase.java @@ -50,7 +50,7 @@ public abstract class ExtensibleResolveTestCase extends KotlinTestWithEnvironmen public KtFile create(@NotNull String fileName, @NotNull String text, @NotNull Directives directives) { return expectedResolveData.createFileFromMarkedUpText(fileName, text); } - }, ""); + }); expectedResolveData.checkResult(ExpectedResolveData.analyze(files, getEnvironment())); } } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt index c5615da32dc..f41d9d4ce5a 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt @@ -24,29 +24,15 @@ import java.util.* import java.util.regex.Pattern abstract class KotlinBaseTest : KtUsefulTestCase() { - - @JvmField - protected var coroutinesPackage: String = "" - @Throws(Exception::class) override fun setUp() { - coroutinesPackage = "" super.setUp() } - @Throws(java.lang.Exception::class) - protected open fun doTestWithCoroutinesPackageReplacement(filePath: String, coroutinesPackage: String) { - this.coroutinesPackage = coroutinesPackage - doTest(filePath) - } - @Throws(java.lang.Exception::class) protected open fun doTest(filePath: String) { val file = File(filePath) - var expectedText = KotlinTestUtils.doLoadFile(file) - if (coroutinesPackage.isNotEmpty()) { - expectedText = expectedText.replace("COROUTINES_PACKAGE", coroutinesPackage) - } + val expectedText = KotlinTestUtils.doLoadFile(file) doMultiFileTest(file, createTestFilesFromFile(file, expectedText)) } @@ -98,7 +84,6 @@ abstract class KotlinBaseTest : KtUsefulTestCase() updateConfigurationByDirectivesInTestFiles( testFilesWithConfigurationDirectives, configuration, - coroutinesPackage, parseDirectivesPerFiles() ) updateConfiguration(configuration) @@ -203,18 +188,16 @@ abstract class KotlinBaseTest : KtUsefulTestCase() testFilesWithConfigurationDirectives: List, configuration: CompilerConfiguration ) { - updateConfigurationByDirectivesInTestFiles(testFilesWithConfigurationDirectives, configuration, "", false) + updateConfigurationByDirectivesInTestFiles(testFilesWithConfigurationDirectives, configuration, false) } private fun updateConfigurationByDirectivesInTestFiles( testFilesWithConfigurationDirectives: List, configuration: CompilerConfiguration, - coroutinesPackage: String, usePreparsedDirectives: Boolean ) { var explicitLanguageVersionSettings: LanguageVersionSettings? = null - var disableReleaseCoroutines = false var includeCompatExperimentalCoroutines = false val kotlinConfigurationFlags: MutableList = ArrayList(0) for (testFile in testFilesWithConfigurationDirectives) { @@ -247,13 +230,6 @@ abstract class KotlinBaseTest : KtUsefulTestCase() """.trimIndent() ) } - if (directives.contains("COMMON_COROUTINES_TEST")) { - assert(!directives.contains("COROUTINES_PACKAGE")) { "Must replace COROUTINES_PACKAGE prior to tests compilation" } - if (StandardNames.COROUTINES_PACKAGE_FQ_NAME_EXPERIMENTAL.asString() == coroutinesPackage) { - disableReleaseCoroutines = true - includeCompatExperimentalCoroutines = true - } - } if (content.contains(StandardNames.COROUTINES_PACKAGE_FQ_NAME_EXPERIMENTAL.asString())) { includeCompatExperimentalCoroutines = true } @@ -263,13 +239,6 @@ abstract class KotlinBaseTest : KtUsefulTestCase() explicitLanguageVersionSettings = fileLanguageVersionSettings } } - if (disableReleaseCoroutines) { - explicitLanguageVersionSettings = CompilerTestLanguageVersionSettings( - Collections.singletonMap(LanguageFeature.ReleaseCoroutines, LanguageFeature.State.DISABLED), - ApiVersion.LATEST_STABLE, - LanguageVersion.LATEST_STABLE, emptyMap() - ) - } if (includeCompatExperimentalCoroutines) { configuration.addJvmClasspathRoot(ForTestCompileRuntime.coroutinesCompatForTests()) } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java index 5d99a01c596..a45ce8992f6 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java @@ -574,7 +574,7 @@ public class KotlinTestUtils { int firstLineEnd = text.indexOf('\n'); return StringUtil.trimTrailing(text.substring(firstLineEnd + 1)); } - }, ""); + }); Assert.assertTrue("Exactly two files expected: ", files.size() == 2); diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestFiles.java b/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestFiles.java index 2e5dfe3d518..fa6d858610b 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestFiles.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestFiles.java @@ -41,23 +41,18 @@ public class TestFiles { @NotNull public static List createTestFiles(@Nullable String testFileName, String expectedText, TestFileFactory factory) { - return createTestFiles(testFileName, expectedText, factory, false, ""); - } - - @NotNull - public static List createTestFiles(@Nullable String testFileName, String expectedText, TestFileFactory factory, String coroutinesPackage) { - return createTestFiles(testFileName, expectedText, factory, false, coroutinesPackage); + return createTestFiles(testFileName, expectedText, factory, false); } @NotNull public static List createTestFiles(String testFileName, String expectedText, TestFileFactory factory, - boolean preserveLocations, String coroutinesPackage) { - return createTestFiles(testFileName, expectedText, factory, preserveLocations, coroutinesPackage, false); + boolean preserveLocations) { + return createTestFiles(testFileName, expectedText, factory, preserveLocations, false); } @NotNull public static List createTestFiles(String testFileName, String expectedText, TestFileFactory factory, - boolean preserveLocations, String coroutinesPackage, boolean parseDirectivesPerFile) { + boolean preserveLocations, boolean parseDirectivesPerFile) { Map modules = new HashMap<>(); List testFiles = Lists.newArrayList(); Matcher matcher = FILE_OR_MODULE_PATTERN.matcher(expectedText); @@ -127,9 +122,7 @@ public class TestFiles { assert oldValue == null : "Module with name " + supportModule.name + " already present in file"; } - boolean isReleaseCoroutines = - !coroutinesPackage.contains("experimental") && - !isDirectiveDefined(expectedText, "!LANGUAGE: -ReleaseCoroutines"); + boolean isReleaseCoroutines = !isDirectiveDefined(expectedText, "!LANGUAGE: -ReleaseCoroutines"); boolean checkStateMachine = isDirectiveDefined(expectedText, "CHECK_STATE_MACHINE"); boolean checkTailCallOptimization = isDirectiveDefined(expectedText, "CHECK_TAIL_CALL_OPTIMIZATION"); diff --git a/core/descriptors.runtime/tests/org/jetbrains/kotlin/jvm/runtime/AbstractJvmRuntimeDescriptorLoaderTest.kt b/core/descriptors.runtime/tests/org/jetbrains/kotlin/jvm/runtime/AbstractJvmRuntimeDescriptorLoaderTest.kt index dc000741501..2464d77580e 100644 --- a/core/descriptors.runtime/tests/org/jetbrains/kotlin/jvm/runtime/AbstractJvmRuntimeDescriptorLoaderTest.kt +++ b/core/descriptors.runtime/tests/org/jetbrains/kotlin/jvm/runtime/AbstractJvmRuntimeDescriptorLoaderTest.kt @@ -122,8 +122,7 @@ abstract class AbstractJvmRuntimeDescriptorLoaderTest : TestCaseWithTmpdir() { targetFile.writeText(adaptJavaSource(text)) return targetFile } - }, - "" + } ) LoadDescriptorUtil.compileJavaWithAnnotationsJar(sources, tmpdir, emptyList(), null) } diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/AbstractQuickFixMultiFileTest.kt b/idea/tests/org/jetbrains/kotlin/idea/quickfix/AbstractQuickFixMultiFileTest.kt index 2bd4fb58780..c0efd188c53 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/AbstractQuickFixMultiFileTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/AbstractQuickFixMultiFileTest.kt @@ -121,7 +121,7 @@ abstract class AbstractQuickFixMultiFileTest : KotlinLightCodeInsightFixtureTest } return TestFile(fileName, linesWithoutDirectives.joinToString(separator = "\n")) } - }, "" + } ) val afterFile = subFiles.firstOrNull { file -> file.path.contains(".after") } diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/AbstractJsLineNumberTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/AbstractJsLineNumberTest.kt index 88e303b046c..ba506fbf626 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/AbstractJsLineNumberTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/AbstractJsLineNumberTest.kt @@ -44,7 +44,7 @@ abstract class AbstractJsLineNumberTest : KotlinTestWithEnvironment() { val sourceCode = file.readText() TestFileFactoryImpl().use { testFactory -> - val inputFiles = TestFiles.createTestFiles(file.name, sourceCode, testFactory, true, "") + val inputFiles = TestFiles.createTestFiles(file.name, sourceCode, testFactory, true) val modules = inputFiles .map { it.module }.distinct() .associateBy { it.name } @@ -175,4 +175,4 @@ abstract class AbstractJsLineNumberTest : KotlinTestWithEnvironment() { private val BASE_PATH = "${BasicBoxTest.TEST_DATA_DIR_PATH}/$DIR_NAME" private val OUT_PATH = "${BasicBoxTest.TEST_DATA_DIR_PATH}/out/$DIR_NAME" } -} \ No newline at end of file +} diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt index b628f1cdec0..91d9ee82cbf 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt @@ -141,8 +141,7 @@ abstract class BasicBoxTest( file.name, fileContent, testFactory, - true, - coroutinesPackage + true ) val modules = inputFiles .map { it.module }.distinct() diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicWasmBoxTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicWasmBoxTest.kt index 68594c305d3..bc67960b279 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicWasmBoxTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicWasmBoxTest.kt @@ -6,10 +6,6 @@ package org.jetbrains.kotlin.js.test import com.intellij.openapi.util.io.FileUtil -import com.intellij.openapi.vfs.StandardFileSystems -import com.intellij.openapi.vfs.VirtualFileManager -import com.intellij.psi.PsiManager -import junit.framework.TestCase import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig import org.jetbrains.kotlin.backend.common.phaser.toPhaseMap import org.jetbrains.kotlin.backend.wasm.compileWasm @@ -28,10 +24,8 @@ import org.jetbrains.kotlin.js.test.engines.SpiderMonkeyEngine import org.jetbrains.kotlin.library.resolver.impl.KotlinLibraryResolverResultImpl import org.jetbrains.kotlin.library.resolver.impl.KotlinResolvedLibraryImpl import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.KtNamedFunction import org.jetbrains.kotlin.psi.KtPsiFactory -import org.jetbrains.kotlin.test.InTextDirectivesUtils import org.jetbrains.kotlin.test.Directives import org.jetbrains.kotlin.test.KotlinTestUtils import org.jetbrains.kotlin.test.KotlinTestWithEnvironment @@ -63,7 +57,7 @@ abstract class BasicWasmBoxTest( val fileContent = KotlinTestUtils.doLoadFile(file) TestFileFactoryImpl().use { testFactory -> - val inputFiles: MutableList = TestFiles.createTestFiles(file.name, fileContent, testFactory, true, "") + val inputFiles: MutableList = TestFiles.createTestFiles(file.name, fileContent, testFactory, true) val testPackage = testFactory.testPackage val outputFileBase = outputDir.absolutePath + "/" + getTestName(true) val outputWatFile = outputFileBase + ".wat" From b416c669b0813fc4ade8bf40b8315deb5af99218 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Tue, 1 Dec 2020 17:59:29 +0300 Subject: [PATCH 572/698] [TEST] Update testdata due to dropped COMMON_COROUTINE_TEST directive --- .../jvm/suspendFunctionAssertionDisabled.kt | 6 +- .../jvm/suspendFunctionAssertionsEnabled.kt | 6 +- .../jvm/suspendLambdaAssertionsDisabled.kt | 6 +- .../jvm/suspendLambdaAssertionsEnabled.kt | 6 +- .../withCoroutines.kt | 6 +- .../withCoroutinesNoStdLib.kt | 6 +- .../testData/codegen/box/contracts/kt39374.kt | 6 +- .../32defaultParametersInSuspend.kt | 5 +- .../box/coroutines/accessorForSuspend.kt | 5 +- .../testData/codegen/box/coroutines/async.kt | 5 +- .../codegen/box/coroutines/asyncException.kt | 5 +- .../testData/codegen/box/coroutines/await.kt | 13 +- .../box/coroutines/beginWithException.kt | 5 +- .../beginWithExceptionNoHandleException.kt | 5 +- .../bridges/interfaceSpecialization.kt | 4 +- .../bridges/lambdaWithLongReceiver.kt | 3 +- .../bridges/lambdaWithMultipleParameters.kt | 3 +- .../coroutines/capturedVarInSuspendLambda.kt | 8 +- .../catchWithInlineInsideSuspend.kt | 7 +- .../codegen/box/coroutines/coercionToUnit.kt | 5 +- .../coroutines/controlFlow/breakFinally.kt | 5 +- .../coroutines/controlFlow/breakStatement.kt | 5 +- .../controlFlow/complexChainSuspend.kt | 5 +- .../controlFlow/doWhileStatement.kt | 5 +- .../box/coroutines/controlFlow/doubleBreak.kt | 7 +- .../coroutines/controlFlow/finallyCatch.kt | 7 +- .../box/coroutines/controlFlow/forContinue.kt | 5 +- .../coroutines/controlFlow/forStatement.kt | 5 +- .../box/coroutines/controlFlow/forWithStep.kt | 5 +- .../box/coroutines/controlFlow/ifStatement.kt | 5 +- .../coroutines/controlFlow/labeledWhile.kt | 5 +- .../controlFlow/multipleCatchBlocksSuspend.kt | 5 +- .../controlFlow/returnFromFinally.kt | 7 +- .../controlFlow/returnWithFinally.kt | 5 +- .../controlFlow/suspendInStringTemplate.kt | 7 +- .../coroutines/controlFlow/switchLikeWhen.kt | 5 +- .../coroutines/controlFlow/throwFromCatch.kt | 5 +- .../controlFlow/throwFromFinally.kt | 7 +- .../controlFlow/throwInTryWithHandleResult.kt | 5 +- .../controlFlow/whenWithSuspensions.kt | 7 +- .../coroutines/controlFlow/whileStatement.kt | 7 +- .../controllerAccessFromInnerLambda.kt | 5 +- .../coroutineContextInInlinedLambda.kt | 5 +- .../box/coroutines/createCoroutineSafe.kt | 5 +- .../createCoroutinesOnManualInstances.kt | 5 +- .../crossInlineWithCapturedOuterReceiver.kt | 5 +- .../coroutines/defaultParametersInSuspend.kt | 5 +- .../box/coroutines/delegatedSuspendMember.kt | 8 +- .../codegen/box/coroutines/dispatchResume.kt | 5 +- .../codegen/box/coroutines/emptyClosure.kt | 5 +- .../testData/codegen/box/coroutines/epam.kt | 5 +- .../box/coroutines/falseUnitCoercion.kt | 5 +- .../breakWithNonEmptyStack.kt | 5 +- .../callableReference/bigArity.kt | 5 +- .../featureIntersection/delegate.kt | 4 +- .../destructuringInLambdas.kt | 5 +- .../inlineSuspendFinally.kt | 5 +- .../safeCallOnTwoReceivers.kt | 5 +- .../safeCallOnTwoReceiversLong.kt | 5 +- .../suspendDestructuringInLambdas.kt | 5 +- .../suspendInlineSuspendFinally.kt | 5 +- .../suspendOperatorPlus.kt | 5 +- .../suspendOperatorPlusAssign.kt | 5 +- .../suspendOperatorPlusCallFromLambda.kt | 5 +- .../tailrec/controlFlowIf.kt | 6 +- .../tailrec/controlFlowWhen.kt | 6 +- .../featureIntersection/tailrec/extention.kt | 5 +- .../featureIntersection/tailrec/infixCall.kt | 5 +- .../tailrec/infixRecursiveCall.kt | 5 +- .../tailrec/realIteratorFoldl.kt | 5 +- .../tailrec/realStringEscape.kt | 3 +- .../tailrec/realStringRepeat.kt | 3 +- .../tailrec/returnInParentheses.kt | 5 +- .../featureIntersection/tailrec/sum.kt | 5 +- .../tailrec/tailCallInBlockInParentheses.kt | 3 +- .../tailrec/tailCallInParentheses.kt | 5 +- .../featureIntersection/tailrec/whenWithIs.kt | 3 +- .../codegen/box/coroutines/generate.kt | 5 +- .../codegen/box/coroutines/handleException.kt | 5 +- .../coroutines/handleResultCallEmptyBody.kt | 5 +- .../handleResultNonUnitExpression.kt | 5 +- .../box/coroutines/handleResultSuspended.kt | 5 +- .../indirectInlineUsedAsNonInline.kt | 7 +- .../direct/boxUnboxInsideCoroutine.kt | 6 +- .../direct/boxUnboxInsideCoroutine_Any.kt | 6 +- .../boxUnboxInsideCoroutine_InlineAny.kt | 6 +- .../boxUnboxInsideCoroutine_InlineInt.kt | 6 +- .../direct/boxUnboxInsideCoroutine_Int.kt | 6 +- .../direct/boxUnboxInsideCoroutine_Long.kt | 6 +- .../direct/boxUnboxInsideCoroutine_NAny.kt | 6 +- .../boxUnboxInsideCoroutine_nonLocalReturn.kt | 6 +- .../boxUnboxInsideCoroutine_suspendFunType.kt | 5 +- .../direct/bridgeGenerationCrossinline.kt | 6 +- .../direct/bridgeGenerationNonInline.kt | 6 +- .../interfaceDelegateWithInlineClass.kt | 8 +- .../direct/overrideSuspendFun.kt | 6 +- .../direct/overrideSuspendFun_Any.kt | 6 +- .../direct/overrideSuspendFun_Any_itf.kt | 6 +- .../direct/overrideSuspendFun_Any_this.kt | 6 +- .../direct/overrideSuspendFun_Int.kt | 6 +- .../resume/boxUnboxInsideCoroutine.kt | 6 +- .../resume/boxUnboxInsideCoroutine_Any.kt | 6 +- .../boxUnboxInsideCoroutine_InlineAny.kt | 6 +- .../boxUnboxInsideCoroutine_InlineInt.kt | 6 +- .../resume/boxUnboxInsideCoroutine_Int.kt | 6 +- .../resume/boxUnboxInsideCoroutine_Long.kt | 6 +- .../resume/boxUnboxInsideCoroutine_NAny.kt | 6 +- .../boxUnboxInsideCoroutine_nonLocalReturn.kt | 6 +- .../boxUnboxInsideCoroutine_suspendFunType.kt | 6 +- .../resume/bridgeGenerationCrossinline.kt | 6 +- .../resume/bridgeGenerationNonInline.kt | 6 +- .../interfaceDelegateWithInlineClass.kt | 8 +- .../resume/overrideSuspendFun.kt | 6 +- .../resume/overrideSuspendFun_Any.kt | 6 +- .../resume/overrideSuspendFun_Any_itf.kt | 6 +- .../resume/overrideSuspendFun_Any_this.kt | 6 +- .../resume/overrideSuspendFun_Int.kt | 6 +- .../boxUnboxInsideCoroutine.kt | 6 +- .../boxUnboxInsideCoroutine_Any.kt | 6 +- .../boxUnboxInsideCoroutine_InlineAny.kt | 6 +- .../boxUnboxInsideCoroutine_InlineInt.kt | 6 +- .../boxUnboxInsideCoroutine_Int.kt | 6 +- .../boxUnboxInsideCoroutine_Long.kt | 6 +- .../boxUnboxInsideCoroutine_NAny.kt | 6 +- .../boxUnboxInsideCoroutine_nonLocalReturn.kt | 6 +- .../boxUnboxInsideCoroutine_suspendFunType.kt | 6 +- .../bridgeGenerationCrossinline.kt | 6 +- .../bridgeGenerationNonInline.kt | 6 +- .../interfaceDelegateWithInlineClass.kt | 8 +- .../resumeWithException/overrideSuspendFun.kt | 6 +- .../overrideSuspendFun_Any.kt | 6 +- .../overrideSuspendFun_Any_itf.kt | 6 +- .../overrideSuspendFun_Any_this.kt | 6 +- .../overrideSuspendFun_Int.kt | 6 +- .../box/coroutines/inlineFunInGenericClass.kt | 5 +- .../inlineFunctionInMultifileClass.kt | 5 +- ...lineFunctionInMultifileClassUnoptimized.kt | 5 +- .../inlineGenericFunCalledFromSubclass.kt | 5 +- .../box/coroutines/inlineSuspendFunction.kt | 5 +- .../inlineSuspendLambdaNonLocalReturn.kt | 7 +- .../box/coroutines/inlinedTryCatchFinally.kt | 5 +- .../box/coroutines/innerSuspensionCalls.kt | 5 +- .../box/coroutines/instanceOfContinuation.kt | 5 +- .../intLikeVarSpilling/complicatedMerge.kt | 5 +- .../intLikeVarSpilling/i2bResult.kt | 5 +- .../loadFromBooleanArray.kt | 5 +- .../intLikeVarSpilling/loadFromByteArray.kt | 5 +- .../intLikeVarSpilling/noVariableInTable.kt | 5 +- .../intLikeVarSpilling/sameIconst1ManyVars.kt | 5 +- .../intLikeVarSpilling/usedInArrayStore.kt | 5 +- .../intLikeVarSpilling/usedInMethodCall.kt | 5 +- .../intLikeVarSpilling/usedInPutfield.kt | 5 +- .../intLikeVarSpilling/usedInVarStore.kt | 5 +- .../intrinsicSemantics/coroutineContext.kt | 3 +- .../coroutineContextReceiver.kt | 3 +- .../coroutineContextReceiverNotIntrinsic.kt | 3 +- .../intrinsicSemantics/intercepted.kt | 5 +- .../intrinsicSemantics/startCoroutine.kt | 5 +- .../startCoroutineUninterceptedOrReturn.kt | 5 +- ...outineUninterceptedOrReturnInterception.kt | 5 +- .../suspendCoroutineUninterceptedOrReturn.kt | 5 +- .../box/coroutines/iterateOverArray.kt | 5 +- .../javaInterop/objectWithSeveralSuspends.kt | 7 +- .../coroutines/javaInterop/returnLambda.kt | 7 +- .../coroutines/javaInterop/returnObject.kt | 7 +- .../coroutines/javaInterop/severalCaptures.kt | 7 +- .../suspendInlineWithCrossinline.kt | 9 +- .../codegen/box/coroutines/kt12958.kt | 5 +- .../codegen/box/coroutines/kt15016.kt | 7 +- .../codegen/box/coroutines/kt15017.kt | 3 +- .../codegen/box/coroutines/kt15930.kt | 6 +- .../codegen/box/coroutines/kt21605.kt | 4 +- .../codegen/box/coroutines/kt25912.kt | 3 +- .../codegen/box/coroutines/kt28844.kt | 3 +- .../box/coroutines/lastExpressionIsLoop.kt | 5 +- .../box/coroutines/lastStatementInc.kt | 5 +- .../box/coroutines/lastStementAssignment.kt | 5 +- .../box/coroutines/lastUnitExpression.kt | 5 +- .../codegen/box/coroutines/localDelegate.kt | 7 +- .../localFunctions/anonymous/simple.kt | 5 +- .../named/capturedParameters.kt | 6 +- .../localFunctions/named/capturedVariables.kt | 6 +- .../localFunctions/named/extension.kt | 6 +- .../coroutines/localFunctions/named/infix.kt | 6 +- .../localFunctions/named/insideLambda.kt | 6 +- .../localFunctions/named/nestedLocals.kt | 6 +- .../coroutines/localFunctions/named/simple.kt | 4 +- .../named/simpleSuspensionPoint.kt | 6 +- .../localFunctions/named/stateMachine.kt | 6 +- .../localFunctions/named/withArguments.kt | 6 +- .../box/coroutines/longRangeInSuspendCall.kt | 5 +- .../box/coroutines/longRangeInSuspendFun.kt | 5 +- .../box/coroutines/mergeNullAndString.kt | 5 +- .../multiModule/inlineCrossModule.kt | 14 +- .../inlineFunctionWithOptionalParam.kt | 5 +- .../multiModule/inlineMultiModule.kt | 10 +- .../multiModule/inlineMultiModuleOverride.kt | 10 +- .../inlineMultiModuleWithController.kt | 10 +- .../inlineMultiModuleWithInnerInlining.kt | 10 +- .../coroutines/multiModule/inlineTailCall.kt | 5 +- .../box/coroutines/multiModule/simple.kt | 9 +- .../box/coroutines/multipleInvokeCalls.kt | 5 +- .../multipleInvokeCallsInsideInlineLambda1.kt | 5 +- .../multipleInvokeCallsInsideInlineLambda2.kt | 5 +- .../multipleInvokeCallsInsideInlineLambda3.kt | 5 +- .../codegen/box/coroutines/nestedTryCatch.kt | 5 +- .../box/coroutines/noSuspensionPoints.kt | 5 +- .../nonLocalReturnFromInlineLambda.kt | 5 +- .../nonLocalReturnFromInlineLambdaDeep.kt | 5 +- .../box/coroutines/overrideDefaultArgument.kt | 5 +- .../box/coroutines/recursiveSuspend.kt | 5 +- .../ktor_receivedMessage.kt | 6 +- .../codegen/box/coroutines/returnByLabel.kt | 5 +- .../testData/codegen/box/coroutines/simple.kt | 5 +- .../codegen/box/coroutines/simpleException.kt | 5 +- .../box/coroutines/simpleWithHandleResult.kt | 5 +- .../coroutines/stackUnwinding/exception.kt | 5 +- .../stackUnwinding/inlineSuspendFunction.kt | 5 +- .../stackUnwinding/rethrowInFinally.kt | 7 +- .../rethrowInFinallyWithSuspension.kt | 7 +- .../box/coroutines/stackUnwinding/simple.kt | 5 +- .../stackUnwinding/suspendInCycle.kt | 5 +- .../coroutines/statementLikeLastExpression.kt | 5 +- .../box/coroutines/suspendCallsInArguments.kt | 5 +- .../suspendCoroutineFromStateMachine.kt | 7 +- .../box/coroutines/suspendDefaultImpl.kt | 5 +- .../box/coroutines/suspendDelegation.kt | 5 +- .../box/coroutines/suspendFromInlineLambda.kt | 5 +- .../suspendFunImportedFromObject.kt | 10 +- .../dispatchResume.kt | 5 +- .../handleException.kt | 5 +- .../suspendFunctionAsCoroutine/inline.kt | 5 +- .../inlineTwoReceivers.kt | 7 +- .../suspendFunctionAsCoroutine/member.kt | 5 +- .../noinlineTwoReceivers.kt | 7 +- .../suspendFunctionAsCoroutine/operators.kt | 5 +- .../privateFunctions.kt | 5 +- .../privateInFile.kt | 5 +- .../returnNoSuspend.kt | 5 +- .../suspendFunctionAsCoroutine/simple.kt | 5 +- .../suspendFunctionAsCoroutine/superCall.kt | 5 +- .../superCallAbstractClass.kt | 5 +- .../superCallInterface.kt | 5 +- .../superCallOverload.kt | 5 +- .../withVariables.kt | 5 +- .../suspendFunctionTypeCall/localVal.kt | 5 +- .../suspendFunctionTypeCall/manyParameters.kt | 5 +- .../manyParametersNoCapture.kt | 5 +- .../suspendFunctionTypeCall/simple.kt | 5 +- .../suspendModifier.kt | 5 +- .../codegen/box/coroutines/suspendInCycle.kt | 5 +- .../suspendInTheMiddleOfObjectConstruction.kt | 5 +- ...ddleOfObjectConstructionEvaluationOrder.kt | 5 +- ...heMiddleOfObjectConstructionWithJumpOut.kt | 5 +- .../suspendLambdaWithArgumentRearrangement.kt | 5 +- .../coroutines/suspensionInsideSafeCall.kt | 5 +- .../suspensionInsideSafeCallWithElvis.kt | 5 +- .../tailCallOptimizations/crossinline.kt | 7 +- .../inlineWithoutStateMachine.kt | 5 +- .../innerObjectRetransformation.kt | 3 +- .../tailCallOptimizations/tryCatch.kt | 7 +- .../tailOperations/suspendWithIf.kt | 5 +- .../tailOperations/suspendWithTryCatch.kt | 5 +- .../tailOperations/suspendWithWhen.kt | 5 +- .../coroutines/tailOperations/tailInlining.kt | 3 +- .../tryCatchFinallyWithHandleResult.kt | 5 +- .../coroutines/tryCatchWithHandleResult.kt | 5 +- .../tryFinallyInsideInlineLambda.kt | 5 +- .../coroutines/tryFinallyWithHandleResult.kt | 5 +- .../unitTypeReturn/coroutineNonLocalReturn.kt | 5 +- .../unitTypeReturn/coroutineReturn.kt | 5 +- .../unitTypeReturn/suspendNonLocalReturn.kt | 5 +- .../unitTypeReturn/suspendReturn.kt | 5 +- .../coroutines/unitTypeReturn/unitSafeCall.kt | 5 +- .../varCaptuedInCoroutineIntrinsic.kt | 8 +- .../box/coroutines/varSpilling/kt19475.kt | 5 +- .../box/coroutines/varSpilling/kt38925.kt | 5 +- .../coroutines/varSpilling/nullSpilling.kt | 5 +- .../coroutines/varValueConflictsWithTable.kt | 5 +- .../varValueConflictsWithTableSameSort.kt | 5 +- .../box/parametersMetadata/suspendFunction.kt | 7 +- .../boxInline/suspend/capturedVariables.kt | 9 +- ...endLambdaInsideCrossinlineSuspendLambda.kt | 7 +- .../defaultValueCrossinline.kt | 7 +- .../defaultParameter/defaultValueInline.kt | 7 +- .../defaultValueInlineFromMultiFileFacade.kt | 7 +- .../boxInline/suspend/delegatedProperties.kt | 9 +- ...ubleRegenerationWithNonSuspendingLambda.kt | 5 +- .../boxInline/suspend/enclodingMethod.kt | 3 - .../inlineOrdinaryOfCrossinlineSuspend.kt | 5 +- .../inlineOrdinaryOfNoinlineSuspend.kt | 5 +- .../suspend/inlineSuspendContinuation.kt | 9 +- .../inlineSuspendOfCrossinlineOrdinary.kt | 7 +- .../inlineSuspendOfCrossinlineSuspend.kt | 7 +- .../inlineSuspendOfNoinlineOrdinary.kt | 7 +- .../suspend/inlineSuspendOfNoinlineSuspend.kt | 7 +- .../suspend/inlineSuspendOfOrdinary.kt | 7 +- .../suspend/inlineSuspendOfSuspend.kt | 7 +- .../codegen/boxInline/suspend/jvmName.kt | 9 +- .../suspend/maxStackWithCrossinline.kt | 4 - .../boxInline/suspend/multipleLocals.kt | 5 +- .../suspend/multipleSuspensionPoints.kt | 7 +- .../suspend/nonSuspendCrossinline.kt | 5 +- .../inlineOrdinaryOfCrossinlineSuspend.kt | 5 +- .../inlineOrdinaryOfNoinlineSuspend.kt | 5 +- .../inlineSuspendOfCrossinlineOrdinary.kt | 7 +- .../inlineSuspendOfCrossinlineSuspend.kt | 7 +- .../inlineSuspendOfNoinlineOrdinary.kt | 7 +- .../inlineSuspendOfNoinlineSuspend.kt | 7 +- .../receiver/inlineSuspendOfOrdinary.kt | 7 +- .../receiver/inlineSuspendOfSuspend.kt | 7 +- .../codegen/boxInline/suspend/returnValue.kt | 10 +- .../crossingCoroutineBoundaries.kt | 7 +- .../suspend/stateMachine/independentInline.kt | 7 +- .../suspend/stateMachine/innerLambda.kt | 7 +- .../stateMachine/innerLambdaInsideLambda.kt | 7 +- .../innerLambdaWithoutCrossinline.kt | 7 +- .../suspend/stateMachine/innerMadness.kt | 7 +- .../stateMachine/innerMadnessCallSite.kt | 7 +- .../suspend/stateMachine/innerObject.kt | 7 +- .../innerObjectInsideInnerObject.kt | 7 +- .../innerObjectRetransformation.kt | 5 +- .../innerObjectSeveralFunctions.kt | 7 +- .../innerObjectWithoutCapturingCrossinline.kt | 7 +- .../suspend/stateMachine/insideObject.kt | 5 +- .../suspend/stateMachine/normalInline.kt | 7 +- .../stateMachine/numberOfSuspentions.kt | 7 +- .../stateMachine/objectInsideLambdas.kt | 5 +- .../stateMachine/oneInlineTwoCaptures.kt | 5 +- .../suspend/stateMachine/passLambda.kt | 7 +- .../suspend/stateMachine/passParameter.kt | 5 +- .../stateMachine/passParameterLambda.kt | 5 +- .../stateMachine/unreachableSuspendMarker.kt | 5 +- .../boxInline/suspend/tryCatchReceiver.kt | 4 +- .../suspend/tryCatchStackTransform.kt | 7 +- .../coroutines/coroutineContextIntrinsic.kt | 5 +- .../coroutines/coroutineContextIntrinsic.txt | 21 +- .../coroutineContextIntrinsic_1_3.txt | 21 - .../coroutines/coroutineFields.kt | 5 +- .../coroutines/coroutineFields.txt | 42 +- .../coroutines/coroutineFields_1_3.txt | 63 --- .../coroutines/oomInReturnUnit.kt | 7 +- .../coroutines/oomInReturnUnit.txt | 17 +- .../coroutines/oomInReturnUnit_1_3.txt | 20 - .../coroutines/privateAccessor.kt | 5 +- .../coroutines/privateAccessor.txt | 2 +- .../coroutines/privateAccessor_1_3.txt | 6 - .../coroutines/privateAccessor_ir.txt | 6 - .../coroutines/suspendReifiedFun.kt | 1 - .../coroutines/suspendReifiedFun.txt | 4 +- .../coroutines/suspendReifiedFun_1_3.txt | 13 - .../coroutines/tcoContinuation.kt | 1 - .../coroutines/tcoContinuation.txt | 245 +++++------ .../coroutines/tcoContinuation_1_3.txt | 382 ------------------ .../intLikeVarSpilling/complicatedMerge.kt | 5 +- .../intLikeVarSpilling/i2bResult.kt | 5 +- .../loadFromBooleanArray.kt | 5 +- .../intLikeVarSpilling/loadFromByteArray.kt | 5 +- .../intLikeVarSpilling/noVariableInTable.kt | 5 +- .../intLikeVarSpilling/sameIconst1ManyVars.kt | 5 +- .../intLikeVarSpilling/usedInArrayStore.kt | 5 +- .../intLikeVarSpilling/usedInMethodCall.kt | 5 +- .../intLikeVarSpilling/usedInPutfield.kt | 5 +- .../intLikeVarSpilling/usedInVarStore.kt | 5 +- .../coroutines/returnUnitInLambda.kt | 5 +- .../coroutines/overrideDefaultArgument.txt | 20 +- .../tailOperations/tailInlining.txt | 16 +- .../coroutinesBinary.kt | 5 +- .../callableReference/property.fir.kt | 6 +- .../coroutines/callableReference/property.kt | 6 +- ...inlineOrdinaryOfCrossinlineOrdinary.fir.kt | 5 +- .../inlineOrdinaryOfCrossinlineOrdinary.kt | 5 +- .../inlineOrdinaryOfCrossinlineSuspend.fir.kt | 5 +- .../inlineOrdinaryOfCrossinlineSuspend.kt | 5 +- .../inlineOrdinaryOfNoinlineOrdinary.fir.kt | 5 +- .../inlineOrdinaryOfNoinlineOrdinary.kt | 5 +- .../inlineOrdinaryOfNoinlineSuspend.fir.kt | 5 +- .../inlineOrdinaryOfNoinlineSuspend.kt | 5 +- .../inlineOrdinaryOfOrdinary.fir.kt | 5 +- .../inlineOrdinaryOfOrdinary.kt | 5 +- .../inlineOrdinaryOfSuspend.fir.kt | 5 +- .../inlineOrdinaryOfSuspend.kt | 5 +- .../inlineSuspendOfCrossinlineOrdinary.fir.kt | 5 +- .../inlineSuspendOfCrossinlineOrdinary.kt | 5 +- .../inlineSuspendOfCrossinlineSuspend.fir.kt | 5 +- .../inlineSuspendOfCrossinlineSuspend.kt | 5 +- .../inlineSuspendOfNoinlineOrdinary.fir.kt | 5 +- .../inlineSuspendOfNoinlineOrdinary.kt | 5 +- .../inlineSuspendOfNoinlineSuspend.kt | 5 +- .../inlineSuspendOfOrdinary.fir.kt | 5 +- .../inlineSuspendOfOrdinary.kt | 5 +- .../inlineSuspendOfSuspend.fir.kt | 5 +- .../inlineSuspendOfSuspend.kt | 5 +- .../noDefaultCoroutineImports.fir.kt | 4 +- .../coroutines/noDefaultCoroutineImports.kt | 4 +- .../coroutines/noDefaultCoroutineImports.txt | 2 +- .../restrictSuspension/allMembersAllowed.kt | 4 +- .../restrictSuspension/allMembersAllowed.txt | 2 +- .../restrictSuspension/extensions.fir.kt | 4 +- .../restrictSuspension/extensions.kt | 4 +- .../restrictSuspension/extensions.txt | 2 +- .../restrictSuspension/memberExtension.fir.kt | 3 +- .../restrictSuspension/memberExtension.kt | 3 +- .../restrictSuspension/notRelatedFun.fir.kt | 4 +- .../restrictSuspension/notRelatedFun.kt | 4 +- .../restrictSuspension/notRelatedFun.txt | 2 +- .../restrictSuspension/sameInstance.fir.kt | 4 +- .../restrictSuspension/sameInstance.kt | 4 +- .../restrictSuspension/sameInstance.txt | 2 +- .../restrictSuspension/simpleForbidden.fir.kt | 3 +- .../restrictSuspension/simpleForbidden.kt | 3 +- .../restrictSuspension/simpleForbidden.txt | 2 +- .../wrongEnclosingFunction.fir.kt | 3 +- .../wrongEnclosingFunction.kt | 3 +- .../coroutines/suspendApplicability.kt | 3 +- .../coroutines/suspendApplicability.txt | 2 +- .../suspendCovarianJavaOverride.fir.kt | 5 +- .../coroutines/suspendCovarianJavaOverride.kt | 5 +- .../suspendCovarianJavaOverride.txt | 4 +- .../coroutines/suspendFunctions.fir.kt | 3 +- .../coroutines/suspendFunctions.kt | 7 +- ...avaImplementationFromDifferentClass.fir.kt | 5 +- ...endJavaImplementationFromDifferentClass.kt | 5 +- ...ndJavaImplementationFromDifferentClass.txt | 6 +- .../coroutines/suspendJavaOverrides.fir.kt | 5 +- .../coroutines/suspendJavaOverrides.kt | 5 +- .../coroutines/suspendJavaOverrides.txt | 4 +- .../coroutines/suspendLambda.kt | 3 +- .../coroutines/tailCalls/forbidden.kt | 5 +- .../coroutines/tailCalls/tryCatch.kt | 5 +- .../coroutines/tailCalls/valid.kt | 5 +- 431 files changed, 999 insertions(+), 2140 deletions(-) delete mode 100644 compiler/testData/codegen/bytecodeListing/coroutines/coroutineContextIntrinsic_1_3.txt delete mode 100644 compiler/testData/codegen/bytecodeListing/coroutines/coroutineFields_1_3.txt delete mode 100644 compiler/testData/codegen/bytecodeListing/coroutines/oomInReturnUnit_1_3.txt delete mode 100644 compiler/testData/codegen/bytecodeListing/coroutines/privateAccessor_1_3.txt delete mode 100644 compiler/testData/codegen/bytecodeListing/coroutines/privateAccessor_ir.txt delete mode 100644 compiler/testData/codegen/bytecodeListing/coroutines/suspendReifiedFun_1_3.txt delete mode 100644 compiler/testData/codegen/bytecodeListing/coroutines/tcoContinuation_1_3.txt diff --git a/compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionDisabled.kt b/compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionDisabled.kt index 1981ecc6c7a..b9da206e874 100644 --- a/compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionDisabled.kt +++ b/compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionDisabled.kt @@ -2,12 +2,10 @@ // KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - package suspendFunctionAssertionDisabled import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* class Checker { suspend fun check() { @@ -33,4 +31,4 @@ fun box(): String { builder { c.check() } return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionsEnabled.kt b/compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionsEnabled.kt index e843ffcb26d..a937c0c5bb8 100644 --- a/compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionsEnabled.kt +++ b/compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionsEnabled.kt @@ -2,12 +2,10 @@ // KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - package suspendFunctionAssertionsEnabled import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* class Checker { suspend fun check() { @@ -37,4 +35,4 @@ fun box(): String { } return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsDisabled.kt b/compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsDisabled.kt index a3425c11bf5..098235714c0 100644 --- a/compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsDisabled.kt +++ b/compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsDisabled.kt @@ -2,12 +2,10 @@ // KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - package suspendLambdaAssertionsDisabled import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* class Checker { fun check() { @@ -33,4 +31,4 @@ fun box(): String { c.check() return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsEnabled.kt b/compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsEnabled.kt index 4328c0d333d..e9f3ebc920f 100644 --- a/compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsEnabled.kt +++ b/compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsEnabled.kt @@ -2,12 +2,10 @@ // KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - package suspendLambdaAssertionsEnabled import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* class Checker { fun check() { @@ -37,4 +35,4 @@ fun box(): String { } return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt b/compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt index 4a6150b2030..8aebf31e159 100644 --- a/compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt +++ b/compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt @@ -3,11 +3,9 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { diff --git a/compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutinesNoStdLib.kt b/compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutinesNoStdLib.kt index c64f4d1f374..0a01d53ca1d 100644 --- a/compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutinesNoStdLib.kt +++ b/compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutinesNoStdLib.kt @@ -2,11 +2,9 @@ // WASM_MUTE_REASON: UNIT_ISSUES // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { diff --git a/compiler/testData/codegen/box/contracts/kt39374.kt b/compiler/testData/codegen/box/contracts/kt39374.kt index 708010d3e92..e69bdf6f00d 100644 --- a/compiler/testData/codegen/box/contracts/kt39374.kt +++ b/compiler/testData/codegen/box/contracts/kt39374.kt @@ -2,10 +2,8 @@ // WITH_RUNTIME // KJS_WITH_FULL_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import kotlin.contracts.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* @ExperimentalContracts @@ -31,4 +29,4 @@ val z: S = S.Z() @ExperimentalContracts fun box(): String = when (val w = z) { is S.Z -> runBlocking { w.f() } -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/32defaultParametersInSuspend.kt b/compiler/testData/codegen/box/coroutines/32defaultParametersInSuspend.kt index 92c1aa88445..f76e008e42d 100644 --- a/compiler/testData/codegen/box/coroutines/32defaultParametersInSuspend.kt +++ b/compiler/testData/codegen/box/coroutines/32defaultParametersInSuspend.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere( diff --git a/compiler/testData/codegen/box/coroutines/accessorForSuspend.kt b/compiler/testData/codegen/box/coroutines/accessorForSuspend.kt index e35dfb3e971..48e7f1b0705 100644 --- a/compiler/testData/codegen/box/coroutines/accessorForSuspend.kt +++ b/compiler/testData/codegen/box/coroutines/accessorForSuspend.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/async.kt b/compiler/testData/codegen/box/coroutines/async.kt index c3a29497255..e432aafa5d9 100644 --- a/compiler/testData/codegen/box/coroutines/async.kt +++ b/compiler/testData/codegen/box/coroutines/async.kt @@ -1,13 +1,12 @@ // SKIP_JDK6 // TARGET_BACKEND: JVM // WITH_RUNTIME -// COMMON_COROUTINES_TEST // FULL_JDK // WITH_COROUTINES import java.util.concurrent.CompletableFuture -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun foo(): CompletableFuture = CompletableFuture.supplyAsync { "foo" } fun bar(v: String): CompletableFuture = CompletableFuture.supplyAsync { "bar with $v" } diff --git a/compiler/testData/codegen/box/coroutines/asyncException.kt b/compiler/testData/codegen/box/coroutines/asyncException.kt index f7dd341c2b9..3c4c83a142b 100644 --- a/compiler/testData/codegen/box/coroutines/asyncException.kt +++ b/compiler/testData/codegen/box/coroutines/asyncException.kt @@ -1,13 +1,12 @@ // SKIP_JDK6 // TARGET_BACKEND: JVM // WITH_RUNTIME -// COMMON_COROUTINES_TEST // FULL_JDK // WITH_COROUTINES import java.util.concurrent.CompletableFuture -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun exception(v: String): CompletableFuture = CompletableFuture.supplyAsync { throw RuntimeException(v) } diff --git a/compiler/testData/codegen/box/coroutines/await.kt b/compiler/testData/codegen/box/coroutines/await.kt index a47acf9136e..1c6e084f587 100644 --- a/compiler/testData/codegen/box/coroutines/await.kt +++ b/compiler/testData/codegen/box/coroutines/await.kt @@ -1,11 +1,10 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST // FILE: promise.kt import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Promise(private val executor: ((T) -> Unit) -> Unit) { private var value: Any? = null @@ -53,8 +52,8 @@ fun processQueue() { // FILE: await.kt import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* private var log = "" @@ -99,8 +98,8 @@ fun asyncOperation(resultSupplier: () -> T) = Promise { resolve -> fun getLog() = log // FILE: main.kt -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* private fun test() = async { val o = await(asyncOperation { "O" }) diff --git a/compiler/testData/codegen/box/coroutines/beginWithException.kt b/compiler/testData/codegen/box/coroutines/beginWithException.kt index d259f4b6e45..f49f36f6144 100644 --- a/compiler/testData/codegen/box/coroutines/beginWithException.kt +++ b/compiler/testData/codegen/box/coroutines/beginWithException.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendHere(): Any = suspendCoroutineUninterceptedOrReturn { x -> } diff --git a/compiler/testData/codegen/box/coroutines/beginWithExceptionNoHandleException.kt b/compiler/testData/codegen/box/coroutines/beginWithExceptionNoHandleException.kt index 3e1e1d7e1b0..d6435b1679f 100644 --- a/compiler/testData/codegen/box/coroutines/beginWithExceptionNoHandleException.kt +++ b/compiler/testData/codegen/box/coroutines/beginWithExceptionNoHandleException.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendHere(): Any = suspendCoroutineUninterceptedOrReturn { x ->} fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/box/coroutines/bridges/interfaceSpecialization.kt b/compiler/testData/codegen/box/coroutines/bridges/interfaceSpecialization.kt index e7fb2356c1c..8219ba77c79 100644 --- a/compiler/testData/codegen/box/coroutines/bridges/interfaceSpecialization.kt +++ b/compiler/testData/codegen/box/coroutines/bridges/interfaceSpecialization.kt @@ -1,9 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* interface I1 { suspend fun f(a: A, b: B): String diff --git a/compiler/testData/codegen/box/coroutines/bridges/lambdaWithLongReceiver.kt b/compiler/testData/codegen/box/coroutines/bridges/lambdaWithLongReceiver.kt index 126678efe35..a55c3f22157 100644 --- a/compiler/testData/codegen/box/coroutines/bridges/lambdaWithLongReceiver.kt +++ b/compiler/testData/codegen/box/coroutines/bridges/lambdaWithLongReceiver.kt @@ -1,10 +1,9 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST // CHECK_BYTECODE_LISTING import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt b/compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt index d8b34165fbe..eaacff10bad 100644 --- a/compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt +++ b/compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt @@ -1,10 +1,9 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST // CHECK_BYTECODE_LISTING import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun builder(c: suspend() -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt b/compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt index 3606d4c0ea7..4bd01f09560 100644 --- a/compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt +++ b/compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendHere(): String { var z = "fail1" @@ -28,4 +26,4 @@ fun box(): String { } return result -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/catchWithInlineInsideSuspend.kt b/compiler/testData/codegen/box/coroutines/catchWithInlineInsideSuspend.kt index e793d5d9372..a5b7d713e9d 100644 --- a/compiler/testData/codegen/box/coroutines/catchWithInlineInsideSuspend.kt +++ b/compiler/testData/codegen/box/coroutines/catchWithInlineInsideSuspend.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { var result = "FAIL" @@ -34,4 +33,4 @@ fun builder(c: suspend Controller.() -> Unit): String { fun box(): String { return builder() { bar() } -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/coercionToUnit.kt b/compiler/testData/codegen/box/coroutines/coercionToUnit.kt index f26e8fdf6d0..f3a90c11316 100644 --- a/compiler/testData/codegen/box/coroutines/coercionToUnit.kt +++ b/compiler/testData/codegen/box/coroutines/coercionToUnit.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun await(t: T): T = suspendCoroutineUninterceptedOrReturn { c -> diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/breakFinally.kt b/compiler/testData/codegen/box/coroutines/controlFlow/breakFinally.kt index e9000bb7ae7..2e7ab381301 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/breakFinally.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/breakFinally.kt @@ -2,10 +2,9 @@ // IGNORE_BACKEND: JS // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/breakStatement.kt b/compiler/testData/codegen/box/coroutines/controlFlow/breakStatement.kt index 287a5efa163..caa4b89ad54 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/breakStatement.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/breakStatement.kt @@ -1,10 +1,9 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/complexChainSuspend.kt b/compiler/testData/codegen/box/coroutines/controlFlow/complexChainSuspend.kt index e3d48fcb9b8..9884582c4e8 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/complexChainSuspend.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/complexChainSuspend.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { var result = "" diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/doWhileStatement.kt b/compiler/testData/codegen/box/coroutines/controlFlow/doWhileStatement.kt index d25fc2bf712..16e7072e9cf 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/doWhileStatement.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/doWhileStatement.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/doubleBreak.kt b/compiler/testData/codegen/box/coroutines/controlFlow/doubleBreak.kt index a6606899ddb..3e8bb7bae2a 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/doubleBreak.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/doubleBreak.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { @@ -67,4 +66,4 @@ fun box(): String { if (res != "slh;rlh;rlb;slt;slh;rlh;rlc;slb;return;") return "FAIL: $res" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/finallyCatch.kt b/compiler/testData/codegen/box/coroutines/controlFlow/finallyCatch.kt index 5d664329e7e..1b7ee4516e6 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/finallyCatch.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/finallyCatch.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { var result = "" @@ -41,4 +40,4 @@ fun builder(c: suspend Controller.() -> Unit): String { fun box(): String { return builder { result = bars() } -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/forContinue.kt b/compiler/testData/codegen/box/coroutines/controlFlow/forContinue.kt index 1fc095f3854..961074283d5 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/forContinue.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/forContinue.kt @@ -1,10 +1,9 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/forStatement.kt b/compiler/testData/codegen/box/coroutines/controlFlow/forStatement.kt index 4bb0bea41c7..f104c41e9e5 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/forStatement.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/forStatement.kt @@ -1,10 +1,9 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/forWithStep.kt b/compiler/testData/codegen/box/coroutines/controlFlow/forWithStep.kt index cf85b08bcdc..957ea5d903b 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/forWithStep.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/forWithStep.kt @@ -1,10 +1,9 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt b/compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt index ba14d5e6f5e..05475b66c00 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt @@ -1,10 +1,9 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/labeledWhile.kt b/compiler/testData/codegen/box/coroutines/controlFlow/labeledWhile.kt index 205634c1a0c..29a0e6af31c 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/labeledWhile.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/labeledWhile.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit): Unit { c.startCoroutine(handleResultContinuation { diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/multipleCatchBlocksSuspend.kt b/compiler/testData/codegen/box/coroutines/controlFlow/multipleCatchBlocksSuspend.kt index bed07027828..0d7ddc28946 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/multipleCatchBlocksSuspend.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/multipleCatchBlocksSuspend.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { var result = "" diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/returnFromFinally.kt b/compiler/testData/codegen/box/coroutines/controlFlow/returnFromFinally.kt index 8ea2cedaf8f..695002a438b 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/returnFromFinally.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/returnFromFinally.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* @@ -52,4 +51,4 @@ fun box(): String { if (res != "log(1);suspend(2);log(3);return(4);") return "FAIL: $res" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/returnWithFinally.kt b/compiler/testData/codegen/box/coroutines/controlFlow/returnWithFinally.kt index 440f86654b4..0d6a9786623 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/returnWithFinally.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/returnWithFinally.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { var result = "" diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/suspendInStringTemplate.kt b/compiler/testData/codegen/box/coroutines/controlFlow/suspendInStringTemplate.kt index 851229874e0..3dfff638c64 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/suspendInStringTemplate.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/suspendInStringTemplate.kt @@ -1,10 +1,9 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST // IGNORE_BACKEND: JS import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* // KT-36897 @@ -26,4 +25,4 @@ fun box(): String { } return result -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/switchLikeWhen.kt b/compiler/testData/codegen/box/coroutines/controlFlow/switchLikeWhen.kt index 38bc1800523..275ce510683 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/switchLikeWhen.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/switchLikeWhen.kt @@ -1,10 +1,9 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/throwFromCatch.kt b/compiler/testData/codegen/box/coroutines/controlFlow/throwFromCatch.kt index bb9036e2c3f..c7200720390 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/throwFromCatch.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/throwFromCatch.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/throwFromFinally.kt b/compiler/testData/codegen/box/coroutines/controlFlow/throwFromFinally.kt index 5ab5f60cd78..834359066c6 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/throwFromFinally.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/throwFromFinally.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { var result = "" @@ -62,4 +61,4 @@ fun box(): String { if (res != "try;try(t);catch;return;") return "FAIL: $res" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt b/compiler/testData/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt index d01e25273c0..c8a267ea0d1 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/whenWithSuspensions.kt b/compiler/testData/codegen/box/coroutines/controlFlow/whenWithSuspensions.kt index bc6735b3f9c..58df295846f 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/whenWithSuspensions.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/whenWithSuspensions.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var result = "" @@ -44,4 +43,4 @@ fun box():String { id("b") if (result != "a012b") return "FAIL: $result" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/whileStatement.kt b/compiler/testData/codegen/box/coroutines/controlFlow/whileStatement.kt index 1065573ddb1..d8c168e5e29 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/whileStatement.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/whileStatement.kt @@ -1,10 +1,9 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.Continuation -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.Continuation +import kotlin.coroutines.intrinsics.* class Controller { diff --git a/compiler/testData/codegen/box/coroutines/controllerAccessFromInnerLambda.kt b/compiler/testData/codegen/box/coroutines/controllerAccessFromInnerLambda.kt index 4072acf4bed..40b08bd2ac1 100644 --- a/compiler/testData/codegen/box/coroutines/controllerAccessFromInnerLambda.kt +++ b/compiler/testData/codegen/box/coroutines/controllerAccessFromInnerLambda.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { var result = false diff --git a/compiler/testData/codegen/box/coroutines/coroutineContextInInlinedLambda.kt b/compiler/testData/codegen/box/coroutines/coroutineContextInInlinedLambda.kt index 8c018988501..bb6039a50bd 100644 --- a/compiler/testData/codegen/box/coroutines/coroutineContextInInlinedLambda.kt +++ b/compiler/testData/codegen/box/coroutines/coroutineContextInInlinedLambda.kt @@ -1,8 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* inline fun inlinedLambda(block: () -> Unit) { return block() @@ -31,4 +30,4 @@ fun box(): String { } } return res -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/createCoroutineSafe.kt b/compiler/testData/codegen/box/coroutines/createCoroutineSafe.kt index 8da10cbc5aa..8f6553ba9c9 100644 --- a/compiler/testData/codegen/box/coroutines/createCoroutineSafe.kt +++ b/compiler/testData/codegen/box/coroutines/createCoroutineSafe.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { val x = c.createCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/createCoroutinesOnManualInstances.kt b/compiler/testData/codegen/box/coroutines/createCoroutinesOnManualInstances.kt index 668053126de..fa3dd5a07ce 100644 --- a/compiler/testData/codegen/box/coroutines/createCoroutinesOnManualInstances.kt +++ b/compiler/testData/codegen/box/coroutines/createCoroutinesOnManualInstances.kt @@ -3,10 +3,9 @@ // IGNORE_BACKEND: JS_IR_ES6 // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.ContinuationAdapter fun runCustomLambdaAsCoroutine(e: Throwable? = null, x: (Continuation) -> Any?): String { diff --git a/compiler/testData/codegen/box/coroutines/crossInlineWithCapturedOuterReceiver.kt b/compiler/testData/codegen/box/coroutines/crossInlineWithCapturedOuterReceiver.kt index 296199d5562..4c7384f25df 100644 --- a/compiler/testData/codegen/box/coroutines/crossInlineWithCapturedOuterReceiver.kt +++ b/compiler/testData/codegen/box/coroutines/crossInlineWithCapturedOuterReceiver.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME -// COMMON_COROUTINES_TEST // WITH_COROUTINES import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* interface Consumer { fun consume(s: String) } diff --git a/compiler/testData/codegen/box/coroutines/defaultParametersInSuspend.kt b/compiler/testData/codegen/box/coroutines/defaultParametersInSuspend.kt index 37c31f507fd..d90883f2319 100644 --- a/compiler/testData/codegen/box/coroutines/defaultParametersInSuspend.kt +++ b/compiler/testData/codegen/box/coroutines/defaultParametersInSuspend.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(a: String = "abc", i: Int = 2): String = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt b/compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt index 0ab41fbf21d..42a74baf42e 100644 --- a/compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt +++ b/compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var result = "fail" @@ -29,4 +27,4 @@ fun box(): String { } return result -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/dispatchResume.kt b/compiler/testData/codegen/box/coroutines/dispatchResume.kt index 5f84e849ae1..0b19f347c6a 100644 --- a/compiler/testData/codegen/box/coroutines/dispatchResume.kt +++ b/compiler/testData/codegen/box/coroutines/dispatchResume.kt @@ -1,10 +1,9 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST // FULL_JDK import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { var log = "" diff --git a/compiler/testData/codegen/box/coroutines/emptyClosure.kt b/compiler/testData/codegen/box/coroutines/emptyClosure.kt index 73d54cfd669..8146a6a4c8b 100644 --- a/compiler/testData/codegen/box/coroutines/emptyClosure.kt +++ b/compiler/testData/codegen/box/coroutines/emptyClosure.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var result = 0 diff --git a/compiler/testData/codegen/box/coroutines/epam.kt b/compiler/testData/codegen/box/coroutines/epam.kt index f388c03238d..e8422f0a507 100644 --- a/compiler/testData/codegen/box/coroutines/epam.kt +++ b/compiler/testData/codegen/box/coroutines/epam.kt @@ -1,10 +1,9 @@ // FULL_JDK -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* class MyDeferred(val t: suspend () -> T) { suspend fun await() = t() @@ -29,4 +28,4 @@ fun box(): String { result = zip(first, second) { firstValue: Int, secondValue: Int -> firstValue + secondValue }.await() } return if (result == 3) "OK" else "FAIL $result" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/falseUnitCoercion.kt b/compiler/testData/codegen/box/coroutines/falseUnitCoercion.kt index 00357aa8264..f23d75b5f32 100644 --- a/compiler/testData/codegen/box/coroutines/falseUnitCoercion.kt +++ b/compiler/testData/codegen/box/coroutines/falseUnitCoercion.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(v: T): T = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt index c3b5ccd0398..9347c3e330a 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt @@ -1,10 +1,9 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class A { var result = mutableListOf("O", "K", null) diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/bigArity.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/bigArity.kt index e9f58439168..e1bb79bedb6 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/bigArity.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/bigArity.kt @@ -2,10 +2,9 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt index 4a4c44d03b3..38d12584c1d 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt @@ -1,10 +1,8 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import kotlin.properties.Delegates class Pipe { diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt index e65f3f23746..8ede15ed52e 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* data class A(val o: String) { operator fun component2(): String = "K" diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/inlineSuspendFinally.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/inlineSuspendFinally.kt index e7cb0c2d18e..d53f464b26f 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/inlineSuspendFinally.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/inlineSuspendFinally.kt @@ -1,10 +1,9 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt index 6e9ef63419b..0e5b3198637 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class A(val w: String) { suspend fun String.ext(): String = suspendCoroutineUninterceptedOrReturn { diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt index 64305315c39..9db95a1c021 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class A(val w: String) { suspend fun Long.ext(): String = suspendCoroutineUninterceptedOrReturn { diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt index c8e7b616b80..5f15aca8868 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* data class A(val o: String) { operator suspend fun component2(): String = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/suspendInlineSuspendFinally.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/suspendInlineSuspendFinally.kt index 7b7b4342d2e..ddbf1cbfa81 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/suspendInlineSuspendFinally.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/suspendInlineSuspendFinally.kt @@ -1,10 +1,9 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlus.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlus.kt index 2328571d9b2..9963fabcb7e 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlus.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlus.kt @@ -1,10 +1,9 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendThere(v: A): A = suspendCoroutineUninterceptedOrReturn { x -> x.resume(v) diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusAssign.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusAssign.kt index 6f369b93679..f30c90874f4 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusAssign.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusAssign.kt @@ -1,10 +1,9 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendThere(v: A): A = suspendCoroutineUninterceptedOrReturn { x -> x.resume(v) diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusCallFromLambda.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusCallFromLambda.kt index fe1df792459..9b1a24626ca 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusCallFromLambda.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/suspendOperatorPlusCallFromLambda.kt @@ -1,10 +1,9 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendThere(v: A): A = suspendCoroutineUninterceptedOrReturn { x -> x.resume(v) diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowIf.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowIf.kt index 58b8f89974e..ebee646d974 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowIf.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowIf.kt @@ -1,10 +1,8 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* class CompilerKillingIterator(private val underlying: Iterator, private val transform: suspend (e: T) -> Iterator) { private var currentIt: Iterator = object : Iterator { @@ -40,4 +38,4 @@ fun box(): String { } } return res -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowWhen.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowWhen.kt index 334020019c7..599d627ff21 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowWhen.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/controlFlowWhen.kt @@ -1,10 +1,8 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* class CompilerKillingIterator(private val underlying: Iterator, private val transform: suspend (e: T) -> Iterator) { private var currentIt: Iterator = object : Iterator { @@ -40,4 +38,4 @@ fun box(): String { } } return res -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/extention.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/extention.kt index f10fbcdfe89..85d42f8afda 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/extention.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/extention.kt @@ -1,10 +1,9 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import kotlin.test.assertEquals suspend fun ArrayList.yield(v: Int): Unit = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixCall.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixCall.kt index b3093221741..89989b58559 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixCall.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixCall.kt @@ -1,10 +1,9 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST // DONT_RUN_GENERATED_CODE: JS import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* tailrec suspend infix fun Int.test(x : Int) : Int { if (this > 1) { @@ -23,4 +22,4 @@ fun box() : String { res = if (1000000.test(1000000) == 1) "OK" else "FAIL" } return res -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixRecursiveCall.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixRecursiveCall.kt index 9b644f4b38c..472676e6bcc 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixRecursiveCall.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/infixRecursiveCall.kt @@ -1,10 +1,9 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST // DONT_RUN_GENERATED_CODE: JS import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* tailrec suspend infix fun Int.foo(x: Int) { if (x == 0) return @@ -21,4 +20,4 @@ fun box(): String { 1 foo 1000000 } return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realIteratorFoldl.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realIteratorFoldl.kt index 17871dd2a1b..12765bde182 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realIteratorFoldl.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realIteratorFoldl.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST // DONT_RUN_GENERATED_CODE: JS import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* tailrec suspend fun Iterator.foldl(acc : A, foldFunction : (e : T, acc : A) -> A) : A = if (!hasNext()) acc @@ -22,4 +21,4 @@ fun box() : String { } return if (sum == 500000500000) "OK" else "FAIL: $sum" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringEscape.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringEscape.kt index 5ba04452f46..9f8357791b6 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringEscape.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringEscape.kt @@ -1,9 +1,8 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* suspend fun escapeChar(c : Char) : String? = when (c) { '\\' -> "\\\\" diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringRepeat.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringRepeat.kt index e26d74de1bb..af6920acbd9 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringRepeat.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/realStringRepeat.kt @@ -2,9 +2,8 @@ // WITH_RUNTIME // WITH_COROUTINES // DONT_RUN_GENERATED_CODE: JS -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* tailrec suspend fun String.repeat(num : Int, acc : StringBuilder = StringBuilder()) : String = if (num == 0) acc.toString() diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/returnInParentheses.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/returnInParentheses.kt index 8cf0c689920..18c4b74054d 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/returnInParentheses.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/returnInParentheses.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST // DONT_RUN_GENERATED_CODE: JS import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* tailrec suspend fun foo(x: Int) { if (x == 0) return @@ -19,4 +18,4 @@ fun box(): String { foo(1000000) } return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/sum.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/sum.kt index 6355270dac6..dc928e3e802 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/sum.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/sum.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST // DONT_RUN_GENERATED_CODE: JS import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* tailrec suspend fun sum(x: Long, sum: Long): Long { if (x == 0.toLong()) return sum @@ -21,4 +20,4 @@ fun box() : String { } if (sum != 500000500000.toLong()) return "Fail $sum" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInBlockInParentheses.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInBlockInParentheses.kt index df9aeb6a5da..3560e3c1bd2 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInBlockInParentheses.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInBlockInParentheses.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST // DONT_RUN_GENERATED_CODE: JS import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* tailrec suspend fun foo(x: Int) { return if (x > 0) { diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInParentheses.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInParentheses.kt index b131b38901b..85097623d83 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInParentheses.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/tailCallInParentheses.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST // DONT_RUN_GENERATED_CODE: JS import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* tailrec suspend fun foo(x: Int) { if (x == 0) return @@ -19,4 +18,4 @@ fun box(): String { foo(1000000) } return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/whenWithIs.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/whenWithIs.kt index eb3d58c6158..f85a69b51f7 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/whenWithIs.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/tailrec/whenWithIs.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST // DONT_RUN_GENERATED_CODE: JS import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* tailrec suspend fun withWhen(counter : Int, d : Any) : Int = if (counter == 0) { diff --git a/compiler/testData/codegen/box/coroutines/generate.kt b/compiler/testData/codegen/box/coroutines/generate.kt index 91863e3eee4..332f76db86c 100644 --- a/compiler/testData/codegen/box/coroutines/generate.kt +++ b/compiler/testData/codegen/box/coroutines/generate.kt @@ -1,11 +1,10 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* // FULL_JDK -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun box(): String { val x = gen().joinToString() diff --git a/compiler/testData/codegen/box/coroutines/handleException.kt b/compiler/testData/codegen/box/coroutines/handleException.kt index 4cd66eac93b..6a1c89136d1 100644 --- a/compiler/testData/codegen/box/coroutines/handleException.kt +++ b/compiler/testData/codegen/box/coroutines/handleException.kt @@ -1,10 +1,9 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { var exception: Throwable? = null diff --git a/compiler/testData/codegen/box/coroutines/handleResultCallEmptyBody.kt b/compiler/testData/codegen/box/coroutines/handleResultCallEmptyBody.kt index c30b0d23890..7ba6aa92cbf 100644 --- a/compiler/testData/codegen/box/coroutines/handleResultCallEmptyBody.kt +++ b/compiler/testData/codegen/box/coroutines/handleResultCallEmptyBody.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit): String { diff --git a/compiler/testData/codegen/box/coroutines/handleResultNonUnitExpression.kt b/compiler/testData/codegen/box/coroutines/handleResultNonUnitExpression.kt index 8bbbfa402f8..a4a02524ce0 100644 --- a/compiler/testData/codegen/box/coroutines/handleResultNonUnitExpression.kt +++ b/compiler/testData/codegen/box/coroutines/handleResultNonUnitExpression.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/handleResultSuspended.kt b/compiler/testData/codegen/box/coroutines/handleResultSuspended.kt index 211bfe46211..c64caa6282f 100644 --- a/compiler/testData/codegen/box/coroutines/handleResultSuspended.kt +++ b/compiler/testData/codegen/box/coroutines/handleResultSuspended.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { var log = "" diff --git a/compiler/testData/codegen/box/coroutines/indirectInlineUsedAsNonInline.kt b/compiler/testData/codegen/box/coroutines/indirectInlineUsedAsNonInline.kt index 53113bc548a..6c32b28a927 100644 --- a/compiler/testData/codegen/box/coroutines/indirectInlineUsedAsNonInline.kt +++ b/compiler/testData/codegen/box/coroutines/indirectInlineUsedAsNonInline.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var stopped = false var log = "" @@ -48,4 +47,4 @@ fun box(): String { if (log != "123") return "fail: $log" return result -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine.kt index 50768e1f589..2659adf15e7 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Any.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Any.kt index 5db8f8a566b..e5c0a5d8b09 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Any.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Any.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineAny.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineAny.kt index e5d201fdd82..e6fd0ddf8f4 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineAny.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineAny.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineInt.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineInt.kt index ab485ceb801..20f2d04ae14 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineInt.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineInt.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Int.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Int.kt index b4078fefef5..46105358627 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Int.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Int.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Long.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Long.kt index 8c38adfaa5a..91a3120e448 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Long.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Long.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_NAny.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_NAny.kt index c993eb6e897..c980c8131b8 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_NAny.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_NAny.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_nonLocalReturn.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_nonLocalReturn.kt index 15ad71b4e49..c3b1f2626b8 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_nonLocalReturn.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_nonLocalReturn.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_suspendFunType.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_suspendFunType.kt index 673673cf0c7..09411359c9f 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_suspendFunType.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_suspendFunType.kt @@ -1,11 +1,10 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST // IGNORE_BACKEND: JS_IR import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationCrossinline.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationCrossinline.kt index 019248de7f6..63b9611c2c9 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationCrossinline.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationCrossinline.kt @@ -1,9 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) @@ -43,4 +41,4 @@ fun test() { fun box(): String { test() return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationNonInline.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationNonInline.kt index cc9552b170f..d5ae231e07a 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationNonInline.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationNonInline.kt @@ -1,9 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) @@ -43,4 +41,4 @@ fun test() { fun box(): String { test() return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt index 5ac261989c2..449d7a2f72b 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) @@ -38,4 +36,4 @@ fun box(): String { if (result != "OK") return "FAIL: $result" return result -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt index 958a5cf9a2a..b9bca379f0d 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any.kt index a9d7dc57e6a..b64ecb7c266 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_itf.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_itf.kt index 61e94f2973a..2a4fd0ec6fa 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_itf.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_itf.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_this.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_this.kt index 897adc26438..a9038ac2c50 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_this.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_this.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Int.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Int.kt index 29abe545919..754ed403daf 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Int.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Int.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine.kt index 1ad31eb48bc..59a2ce42a32 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Any.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Any.kt index e6af827e69b..28c57e0e032 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Any.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Any.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineAny.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineAny.kt index 91f01db2062..d8188a7c391 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineAny.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineAny.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineInt.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineInt.kt index ed9f7aa6bf4..1cb0ed38fe9 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineInt.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineInt.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Int.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Int.kt index c1b4263c404..8f63afefff8 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Int.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Int.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Long.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Long.kt index 43e9c5b1c43..2fa7262a88a 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Long.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Long.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_NAny.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_NAny.kt index e992bc12dfb..4c1d6c7ece4 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_NAny.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_NAny.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_nonLocalReturn.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_nonLocalReturn.kt index b3d8f3bfc83..56d1de5b032 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_nonLocalReturn.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_nonLocalReturn.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_suspendFunType.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_suspendFunType.kt index ad47d13e527..aca1dc83c17 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_suspendFunType.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_suspendFunType.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationCrossinline.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationCrossinline.kt index ea0e6e015a3..933b1e87eb3 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationCrossinline.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationCrossinline.kt @@ -1,9 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) @@ -51,4 +49,4 @@ fun test() { fun box(): String { test() return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationNonInline.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationNonInline.kt index 4361ea7d5de..f9a9896c970 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationNonInline.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationNonInline.kt @@ -1,9 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) @@ -51,4 +49,4 @@ fun test() { fun box(): String { test() return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt index 2dc3da93548..1ff072f8ff0 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) @@ -44,4 +42,4 @@ fun box(): String { if (result != "OK") return "FAIL: $result" return result -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt index 5d3d7c7dce6..3427679fcf4 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any.kt index bea9484893c..f43f1dfb54c 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_itf.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_itf.kt index 7d32fbda6fb..5952f79a20c 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_itf.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_itf.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_this.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_this.kt index 98b8edd97bd..70f41f9d312 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_this.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_this.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Int.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Int.kt index 8b193bc04ad..4372aeb274b 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Int.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Int.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine.kt index a4f922a0065..e02a337fdf7 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var result = "FAIL" diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Any.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Any.kt index d73098fc7c7..119f8179e1e 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Any.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Any.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var result = "FAIL" diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineAny.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineAny.kt index 73b1acd71fa..74d2b1949c5 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineAny.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineAny.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var result = "FAIL" diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineInt.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineInt.kt index fc08508ad24..901a5de8301 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineInt.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineInt.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var result = "FAIL" diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Int.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Int.kt index d0fadab5062..4e007d32618 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Int.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Int.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var result = "FAIL" diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Long.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Long.kt index c60a0815245..2ccd2676978 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Long.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Long.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var result = "FAIL" diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_NAny.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_NAny.kt index 8988ec5e51f..e33ab032478 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_NAny.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_NAny.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var result = "FAIL" diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_nonLocalReturn.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_nonLocalReturn.kt index c199f7be7ba..1cced7e1d89 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_nonLocalReturn.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_nonLocalReturn.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var result = "FAIL" diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_suspendFunType.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_suspendFunType.kt index b0ab0e65ff6..232f9bc8515 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_suspendFunType.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_suspendFunType.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var result = "FAIL" diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationCrossinline.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationCrossinline.kt index 8fb3abf1b0b..9795923d827 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationCrossinline.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationCrossinline.kt @@ -1,9 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* var result = "FAIL" @@ -55,4 +53,4 @@ fun test() { fun box(): String { test() return result -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationNonInline.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationNonInline.kt index efa22111697..1b69cd83e76 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationNonInline.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationNonInline.kt @@ -1,9 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* var result = "FAIL" @@ -55,4 +53,4 @@ fun test() { fun box(): String { test() return result -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt index e9a9f202754..e4fc462d868 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var result = "FAIL" @@ -46,4 +44,4 @@ fun box(): String { if (result != "OK") return "FAIL: $result" return result -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt index f0ea3de33d8..380e3a6e673 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var result = "FAIL" diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any.kt index fcfcb43a1e5..edc97528e63 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var result = "FAIL" diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_itf.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_itf.kt index 34423556600..4433bdb6788 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_itf.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_itf.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var result = "FAIL" diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_this.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_this.kt index f7c82953694..f6b9f19243a 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_this.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_this.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var result = "FAIL" diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Int.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Int.kt index 21a42a432a3..b828c0115c4 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Int.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Int.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var result = "FAIL" diff --git a/compiler/testData/codegen/box/coroutines/inlineFunInGenericClass.kt b/compiler/testData/codegen/box/coroutines/inlineFunInGenericClass.kt index ef425c2dcd5..47c7cc2bda5 100644 --- a/compiler/testData/codegen/box/coroutines/inlineFunInGenericClass.kt +++ b/compiler/testData/codegen/box/coroutines/inlineFunInGenericClass.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendThere(v: Any?): String = suspendCoroutineUninterceptedOrReturn { x -> x.resume(v?.toString() ?: "") diff --git a/compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClass.kt b/compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClass.kt index 7b092b89728..dfe4e6fb462 100644 --- a/compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClass.kt +++ b/compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClass.kt @@ -1,6 +1,5 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST // IGNORE_LIGHT_ANALYSIS // !INHERIT_MULTIFILE_PARTS // TARGET_BACKEND: JVM @@ -13,8 +12,8 @@ package test import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun foo(): String = bar("OK") diff --git a/compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClassUnoptimized.kt b/compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClassUnoptimized.kt index ea0f92853c1..209047ba11a 100644 --- a/compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClassUnoptimized.kt +++ b/compiler/testData/codegen/box/coroutines/inlineFunctionInMultifileClassUnoptimized.kt @@ -1,6 +1,5 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST // TARGET_BACKEND: JVM // FILE: test.kt @@ -11,8 +10,8 @@ package test import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun foo(): String = bar("OK") diff --git a/compiler/testData/codegen/box/coroutines/inlineGenericFunCalledFromSubclass.kt b/compiler/testData/codegen/box/coroutines/inlineGenericFunCalledFromSubclass.kt index 02cf582a154..bfbf7d3055d 100644 --- a/compiler/testData/codegen/box/coroutines/inlineGenericFunCalledFromSubclass.kt +++ b/compiler/testData/codegen/box/coroutines/inlineGenericFunCalledFromSubclass.kt @@ -1,10 +1,9 @@ // WITH_RUNTIME // WITH_COROUTINES // WITH_REFLECT -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendThere(v: String): String = suspendCoroutineUninterceptedOrReturn { x -> x.resume(v) diff --git a/compiler/testData/codegen/box/coroutines/inlineSuspendFunction.kt b/compiler/testData/codegen/box/coroutines/inlineSuspendFunction.kt index fecaa567153..a3be99db7be 100644 --- a/compiler/testData/codegen/box/coroutines/inlineSuspendFunction.kt +++ b/compiler/testData/codegen/box/coroutines/inlineSuspendFunction.kt @@ -1,13 +1,12 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST // WITH_REFLECT // CHECK_NOT_CALLED: suspendInline_61zpoe$ // CHECK_NOT_CALLED: suspendInline_6r51u9$ // CHECK_NOT_CALLED: suspendInline import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { fun withValue(v: String, x: Continuation) { diff --git a/compiler/testData/codegen/box/coroutines/inlineSuspendLambdaNonLocalReturn.kt b/compiler/testData/codegen/box/coroutines/inlineSuspendLambdaNonLocalReturn.kt index ab6dde1150a..36311f7b6d4 100644 --- a/compiler/testData/codegen/box/coroutines/inlineSuspendLambdaNonLocalReturn.kt +++ b/compiler/testData/codegen/box/coroutines/inlineSuspendLambdaNonLocalReturn.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend inline fun doTwice(block: suspend () -> Unit) { block() @@ -26,4 +25,4 @@ fun box(): String { } return testResult -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/inlinedTryCatchFinally.kt b/compiler/testData/codegen/box/coroutines/inlinedTryCatchFinally.kt index d66f21d0203..0237ce77cf5 100644 --- a/compiler/testData/codegen/box/coroutines/inlinedTryCatchFinally.kt +++ b/compiler/testData/codegen/box/coroutines/inlinedTryCatchFinally.kt @@ -1,10 +1,9 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var globalResult = "" var wasCalled = false diff --git a/compiler/testData/codegen/box/coroutines/innerSuspensionCalls.kt b/compiler/testData/codegen/box/coroutines/innerSuspensionCalls.kt index f220b0740ed..2cfdcb2ecbb 100644 --- a/compiler/testData/codegen/box/coroutines/innerSuspensionCalls.kt +++ b/compiler/testData/codegen/box/coroutines/innerSuspensionCalls.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { var i = 0 diff --git a/compiler/testData/codegen/box/coroutines/instanceOfContinuation.kt b/compiler/testData/codegen/box/coroutines/instanceOfContinuation.kt index 193e709fef0..28c33ee5317 100644 --- a/compiler/testData/codegen/box/coroutines/instanceOfContinuation.kt +++ b/compiler/testData/codegen/box/coroutines/instanceOfContinuation.kt @@ -1,10 +1,9 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* // WITH_REFLECT -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun runInstanceOf(): Boolean = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt index e55e2058860..f6b76381e2f 100644 --- a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt +++ b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): Unit = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt index aa3976a5040..87b7e1c24cf 100644 --- a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt +++ b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): Unit = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt index 2222a1969f4..5496b783177 100644 --- a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt +++ b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): Unit = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt index 87313527e19..e067af09cc7 100644 --- a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt +++ b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): Unit = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt index 47308031f7e..8c36dadb6a9 100644 --- a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt +++ b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): Unit = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt index 17e2f510d20..eda3ca071a9 100644 --- a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt +++ b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): Unit = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInArrayStore.kt b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInArrayStore.kt index d6ce61323c0..840d76645e1 100644 --- a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInArrayStore.kt +++ b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInArrayStore.kt @@ -1,10 +1,9 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* // TARGET_BACKEND: JVM -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): Unit = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt index ccb729668d2..3bc6f947c5c 100644 --- a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt +++ b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): Unit = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInPutfield.kt b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInPutfield.kt index 750bd0695fc..9e34f402d75 100644 --- a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInPutfield.kt +++ b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInPutfield.kt @@ -1,10 +1,9 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* // TARGET_BACKEND: JVM -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): Unit = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt index 07c37314f25..e4c2a041596 100644 --- a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt +++ b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): Unit = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContext.kt b/compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContext.kt index 192b484d2e9..71d63b62f18 100644 --- a/compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContext.kt +++ b/compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContext.kt @@ -1,8 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import kotlin.test.assertEquals suspend fun suspendHere() = diff --git a/compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiver.kt b/compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiver.kt index 9f5e66713ed..d6ed978e6f7 100644 --- a/compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiver.kt +++ b/compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiver.kt @@ -1,8 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import kotlin.test.assertEquals class Controller { diff --git a/compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiverNotIntrinsic.kt b/compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiverNotIntrinsic.kt index d7f375fa797..25b9fbf508e 100644 --- a/compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiverNotIntrinsic.kt +++ b/compiler/testData/codegen/box/coroutines/intrinsicSemantics/coroutineContextReceiverNotIntrinsic.kt @@ -1,8 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import kotlin.test.assertEquals @Suppress("DEPRECATION_ERROR") diff --git a/compiler/testData/codegen/box/coroutines/intrinsicSemantics/intercepted.kt b/compiler/testData/codegen/box/coroutines/intrinsicSemantics/intercepted.kt index 75bbf60adee..be100bbcacc 100644 --- a/compiler/testData/codegen/box/coroutines/intrinsicSemantics/intercepted.kt +++ b/compiler/testData/codegen/box/coroutines/intrinsicSemantics/intercepted.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import kotlin.test.assertEquals suspend fun suspendHereUnintercepted(): String = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt b/compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt index 65a477c0cc5..df94880cc59 100644 --- a/compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt +++ b/compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import kotlin.test.assertEquals suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt b/compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt index 51bee8a6ded..d982f890690 100644 --- a/compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt +++ b/compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import kotlin.test.assertEquals suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt b/compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt index 73361284dc5..0bba8305606 100644 --- a/compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt +++ b/compiler/testData/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import kotlin.test.assertEquals var callback: () -> Unit = {} diff --git a/compiler/testData/codegen/box/coroutines/intrinsicSemantics/suspendCoroutineUninterceptedOrReturn.kt b/compiler/testData/codegen/box/coroutines/intrinsicSemantics/suspendCoroutineUninterceptedOrReturn.kt index 77a3e04b449..c93096b090e 100644 --- a/compiler/testData/codegen/box/coroutines/intrinsicSemantics/suspendCoroutineUninterceptedOrReturn.kt +++ b/compiler/testData/codegen/box/coroutines/intrinsicSemantics/suspendCoroutineUninterceptedOrReturn.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import kotlin.test.assertEquals suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/iterateOverArray.kt b/compiler/testData/codegen/box/coroutines/iterateOverArray.kt index 2db9dcfdbc4..7bf8486af83 100644 --- a/compiler/testData/codegen/box/coroutines/iterateOverArray.kt +++ b/compiler/testData/codegen/box/coroutines/iterateOverArray.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/javaInterop/objectWithSeveralSuspends.kt b/compiler/testData/codegen/box/coroutines/javaInterop/objectWithSeveralSuspends.kt index 45089b9df38..e18f4e0f1e9 100644 --- a/compiler/testData/codegen/box/coroutines/javaInterop/objectWithSeveralSuspends.kt +++ b/compiler/testData/codegen/box/coroutines/javaInterop/objectWithSeveralSuspends.kt @@ -1,5 +1,4 @@ // TARGET_BACKEND: JVM -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING @@ -62,7 +61,7 @@ import test.InlineMeKt; import helpers.CoroutineUtilKt; import helpers.EmptyContinuation; import kotlin.jvm.functions.Function1; -import COROUTINES_PACKAGE.Continuation; +import kotlin.coroutines.Continuation; import kotlin.Unit; public class A { @@ -87,7 +86,7 @@ public class A { import test.* import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun builder(c: suspend () -> Unit) { c.startCoroutine(CheckStateMachineContinuation) @@ -196,4 +195,4 @@ fun box(): String { StateMachineChecker.check(18) return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/javaInterop/returnLambda.kt b/compiler/testData/codegen/box/coroutines/javaInterop/returnLambda.kt index 32e6f43fe0c..a99a90b02b5 100644 --- a/compiler/testData/codegen/box/coroutines/javaInterop/returnLambda.kt +++ b/compiler/testData/codegen/box/coroutines/javaInterop/returnLambda.kt @@ -1,5 +1,4 @@ // TARGET_BACKEND: JVM -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING @@ -32,7 +31,7 @@ import test.InlineMeKt; import helpers.CoroutineUtilKt; import helpers.EmptyContinuation; import kotlin.jvm.functions.Function1; -import COROUTINES_PACKAGE.Continuation; +import kotlin.coroutines.Continuation; import kotlin.Unit; public class A { @@ -57,7 +56,7 @@ public class A { import test.* import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun builder(c: suspend () -> Unit) { c.startCoroutine(CheckStateMachineContinuation) @@ -108,4 +107,4 @@ fun box(): String { } StateMachineChecker.check(16) return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/javaInterop/returnObject.kt b/compiler/testData/codegen/box/coroutines/javaInterop/returnObject.kt index fadae10ebbf..6cc18e8049c 100644 --- a/compiler/testData/codegen/box/coroutines/javaInterop/returnObject.kt +++ b/compiler/testData/codegen/box/coroutines/javaInterop/returnObject.kt @@ -1,5 +1,4 @@ // TARGET_BACKEND: JVM -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING @@ -42,7 +41,7 @@ import test.InlineMeKt; import helpers.CoroutineUtilKt; import helpers.EmptyContinuation; import kotlin.jvm.functions.Function1; -import COROUTINES_PACKAGE.Continuation; +import kotlin.coroutines.Continuation; import kotlin.Unit; public class A { @@ -67,7 +66,7 @@ public class A { import test.* import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun builder(c: suspend () -> Unit) { c.startCoroutine(CheckStateMachineContinuation) @@ -118,4 +117,4 @@ fun box(): String { } StateMachineChecker.check(16) return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/javaInterop/severalCaptures.kt b/compiler/testData/codegen/box/coroutines/javaInterop/severalCaptures.kt index 7dbd4704982..dcfc53a3695 100644 --- a/compiler/testData/codegen/box/coroutines/javaInterop/severalCaptures.kt +++ b/compiler/testData/codegen/box/coroutines/javaInterop/severalCaptures.kt @@ -1,5 +1,4 @@ // TARGET_BACKEND: JVM -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // CHECK_STATE_MACHINE @@ -72,7 +71,7 @@ import test.InlineMeKt; import helpers.CoroutineUtilKt; import helpers.EmptyContinuation; import kotlin.jvm.functions.Function1; -import COROUTINES_PACKAGE.Continuation; +import kotlin.coroutines.Continuation; import kotlin.Unit; public class A { @@ -103,7 +102,7 @@ public class A { import test.* import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun builder(c: suspend () -> Unit) { c.startCoroutine(CheckStateMachineContinuation) @@ -283,4 +282,4 @@ fun box(): String { StateMachineChecker.reset() return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/javaInterop/suspendInlineWithCrossinline.kt b/compiler/testData/codegen/box/coroutines/javaInterop/suspendInlineWithCrossinline.kt index 71be1cd6cbf..c7f6918f3bc 100644 --- a/compiler/testData/codegen/box/coroutines/javaInterop/suspendInlineWithCrossinline.kt +++ b/compiler/testData/codegen/box/coroutines/javaInterop/suspendInlineWithCrossinline.kt @@ -1,5 +1,4 @@ // TARGET_BACKEND: JVM -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING @@ -19,7 +18,7 @@ import test.InlineMeKt; import helpers.CoroutineUtilKt; import helpers.EmptyContinuation; import kotlin.jvm.functions.Function1; -import COROUTINES_PACKAGE.Continuation; +import kotlin.coroutines.Continuation; import kotlin.Unit; public class A { @@ -41,8 +40,8 @@ public class A { import test.* import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(CheckStateMachineContinuation) @@ -74,4 +73,4 @@ fun box(): String { } StateMachineChecker.check(4) return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/kt12958.kt b/compiler/testData/codegen/box/coroutines/kt12958.kt index 5de10da7c30..6bc7710dcfb 100644 --- a/compiler/testData/codegen/box/coroutines/kt12958.kt +++ b/compiler/testData/codegen/box/coroutines/kt12958.kt @@ -1,10 +1,9 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* // WITH_CONTINUATION -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendHere(v: V): V = suspendCoroutineUninterceptedOrReturn { x -> x.resume(v) diff --git a/compiler/testData/codegen/box/coroutines/kt15016.kt b/compiler/testData/codegen/box/coroutines/kt15016.kt index 864ba110a29..cd078cce761 100644 --- a/compiler/testData/codegen/box/coroutines/kt15016.kt +++ b/compiler/testData/codegen/box/coroutines/kt15016.kt @@ -1,11 +1,10 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.intrinsics.COROUTINE_SUSPENDED -import COROUTINES_PACKAGE.intrinsics.suspendCoroutineUninterceptedOrReturn -import COROUTINES_PACKAGE.* +import kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED +import kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn +import kotlin.coroutines.* class Bar(val x: Any) inline fun Any.map(transform: (Any) -> Any) { diff --git a/compiler/testData/codegen/box/coroutines/kt15017.kt b/compiler/testData/codegen/box/coroutines/kt15017.kt index 865f44594e9..c65464dd893 100644 --- a/compiler/testData/codegen/box/coroutines/kt15017.kt +++ b/compiler/testData/codegen/box/coroutines/kt15017.kt @@ -1,8 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.startCoroutine +import kotlin.coroutines.startCoroutine class Controller { suspend inline fun suspendInlineThrow(v: String): String = throw RuntimeException(v) diff --git a/compiler/testData/codegen/box/coroutines/kt15930.kt b/compiler/testData/codegen/box/coroutines/kt15930.kt index 51fb9abde85..042cf0761d8 100644 --- a/compiler/testData/codegen/box/coroutines/kt15930.kt +++ b/compiler/testData/codegen/box/coroutines/kt15930.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.intrinsics.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.intrinsics.* +import kotlin.coroutines.* class A { var isMinusAssignCalled = false diff --git a/compiler/testData/codegen/box/coroutines/kt21605.kt b/compiler/testData/codegen/box/coroutines/kt21605.kt index 738382154f8..6e7536ab520 100644 --- a/compiler/testData/codegen/box/coroutines/kt21605.kt +++ b/compiler/testData/codegen/box/coroutines/kt21605.kt @@ -1,9 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* interface Consumer { fun consume(s: String) } diff --git a/compiler/testData/codegen/box/coroutines/kt25912.kt b/compiler/testData/codegen/box/coroutines/kt25912.kt index 130aa067c96..beaf3608e6d 100644 --- a/compiler/testData/codegen/box/coroutines/kt25912.kt +++ b/compiler/testData/codegen/box/coroutines/kt25912.kt @@ -1,11 +1,10 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST // IGNORE_BACKEND: NATIVE import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun box(): String { val gg = object : Grouping { diff --git a/compiler/testData/codegen/box/coroutines/kt28844.kt b/compiler/testData/codegen/box/coroutines/kt28844.kt index 7fbb3846bd5..c83f1a0577e 100644 --- a/compiler/testData/codegen/box/coroutines/kt28844.kt +++ b/compiler/testData/codegen/box/coroutines/kt28844.kt @@ -1,10 +1,9 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST // IGNORE_BACKEND: NATIVE import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun builder(block: suspend Unit.() -> Unit) { block.startCoroutine(Unit, EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt b/compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt index 101a1257da5..098e0bdac00 100644 --- a/compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt +++ b/compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { var result = "" diff --git a/compiler/testData/codegen/box/coroutines/lastStatementInc.kt b/compiler/testData/codegen/box/coroutines/lastStatementInc.kt index e3cad551967..de3479956c1 100644 --- a/compiler/testData/codegen/box/coroutines/lastStatementInc.kt +++ b/compiler/testData/codegen/box/coroutines/lastStatementInc.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> x.resume("OK") diff --git a/compiler/testData/codegen/box/coroutines/lastStementAssignment.kt b/compiler/testData/codegen/box/coroutines/lastStementAssignment.kt index e8402f6a1b9..728a0648229 100644 --- a/compiler/testData/codegen/box/coroutines/lastStementAssignment.kt +++ b/compiler/testData/codegen/box/coroutines/lastStementAssignment.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> x.resume("OK") diff --git a/compiler/testData/codegen/box/coroutines/lastUnitExpression.kt b/compiler/testData/codegen/box/coroutines/lastUnitExpression.kt index d4d946acf64..615bdb45d39 100644 --- a/compiler/testData/codegen/box/coroutines/lastUnitExpression.kt +++ b/compiler/testData/codegen/box/coroutines/lastUnitExpression.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { var ok = false diff --git a/compiler/testData/codegen/box/coroutines/localDelegate.kt b/compiler/testData/codegen/box/coroutines/localDelegate.kt index b38dbf8d921..f02290e1f4c 100644 --- a/compiler/testData/codegen/box/coroutines/localDelegate.kt +++ b/compiler/testData/codegen/box/coroutines/localDelegate.kt @@ -1,10 +1,9 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.COROUTINE_SUSPENDED -import COROUTINES_PACKAGE.intrinsics.suspendCoroutineUninterceptedOrReturn +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED +import kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn class OkDelegate { operator fun getValue(receiver: Any?, property: Any?): String = "OK" diff --git a/compiler/testData/codegen/box/coroutines/localFunctions/anonymous/simple.kt b/compiler/testData/codegen/box/coroutines/localFunctions/anonymous/simple.kt index 21760f011d9..c5d939772e0 100644 --- a/compiler/testData/codegen/box/coroutines/localFunctions/anonymous/simple.kt +++ b/compiler/testData/codegen/box/coroutines/localFunctions/anonymous/simple.kt @@ -4,10 +4,9 @@ // IGNORE_BACKEND: JVM, JS, NATIVE // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun callLocal(): String { val local = suspend fun() = "OK" diff --git a/compiler/testData/codegen/box/coroutines/localFunctions/named/capturedParameters.kt b/compiler/testData/codegen/box/coroutines/localFunctions/named/capturedParameters.kt index 67eff67c23e..a518e94d06c 100644 --- a/compiler/testData/codegen/box/coroutines/localFunctions/named/capturedParameters.kt +++ b/compiler/testData/codegen/box/coroutines/localFunctions/named/capturedParameters.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun callLocal(a: String, b: String): String { suspend fun local() = suspendCoroutineUninterceptedOrReturn { diff --git a/compiler/testData/codegen/box/coroutines/localFunctions/named/capturedVariables.kt b/compiler/testData/codegen/box/coroutines/localFunctions/named/capturedVariables.kt index 8f01b97097b..3c0e88eeebc 100644 --- a/compiler/testData/codegen/box/coroutines/localFunctions/named/capturedVariables.kt +++ b/compiler/testData/codegen/box/coroutines/localFunctions/named/capturedVariables.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun callLocal(): String { val a = "O" diff --git a/compiler/testData/codegen/box/coroutines/localFunctions/named/extension.kt b/compiler/testData/codegen/box/coroutines/localFunctions/named/extension.kt index c6148d35bff..92b22244acf 100644 --- a/compiler/testData/codegen/box/coroutines/localFunctions/named/extension.kt +++ b/compiler/testData/codegen/box/coroutines/localFunctions/named/extension.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun callLocal(): String { suspend fun String.local() = suspendCoroutineUninterceptedOrReturn { diff --git a/compiler/testData/codegen/box/coroutines/localFunctions/named/infix.kt b/compiler/testData/codegen/box/coroutines/localFunctions/named/infix.kt index 47cdbe05977..c28fd71dfaf 100644 --- a/compiler/testData/codegen/box/coroutines/localFunctions/named/infix.kt +++ b/compiler/testData/codegen/box/coroutines/localFunctions/named/infix.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun callLocal(): String { suspend infix fun String.local(a: String) = suspendCoroutineUninterceptedOrReturn { diff --git a/compiler/testData/codegen/box/coroutines/localFunctions/named/insideLambda.kt b/compiler/testData/codegen/box/coroutines/localFunctions/named/insideLambda.kt index d03f2546a69..05b8d9ab210 100644 --- a/compiler/testData/codegen/box/coroutines/localFunctions/named/insideLambda.kt +++ b/compiler/testData/codegen/box/coroutines/localFunctions/named/insideLambda.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun callLocal(): String { val l: suspend () -> String = { diff --git a/compiler/testData/codegen/box/coroutines/localFunctions/named/nestedLocals.kt b/compiler/testData/codegen/box/coroutines/localFunctions/named/nestedLocals.kt index e895cfc5926..62691c8354a 100644 --- a/compiler/testData/codegen/box/coroutines/localFunctions/named/nestedLocals.kt +++ b/compiler/testData/codegen/box/coroutines/localFunctions/named/nestedLocals.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun callLocal(): String { suspend fun local(): String { diff --git a/compiler/testData/codegen/box/coroutines/localFunctions/named/simple.kt b/compiler/testData/codegen/box/coroutines/localFunctions/named/simple.kt index b438db745ec..8e884a71422 100644 --- a/compiler/testData/codegen/box/coroutines/localFunctions/named/simple.kt +++ b/compiler/testData/codegen/box/coroutines/localFunctions/named/simple.kt @@ -1,9 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* suspend fun callLocal(): String { suspend fun local() = "OK" diff --git a/compiler/testData/codegen/box/coroutines/localFunctions/named/simpleSuspensionPoint.kt b/compiler/testData/codegen/box/coroutines/localFunctions/named/simpleSuspensionPoint.kt index 87c6d43c296..973588191eb 100644 --- a/compiler/testData/codegen/box/coroutines/localFunctions/named/simpleSuspensionPoint.kt +++ b/compiler/testData/codegen/box/coroutines/localFunctions/named/simpleSuspensionPoint.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun callLocal(): String { suspend fun local() = suspendCoroutineUninterceptedOrReturn { diff --git a/compiler/testData/codegen/box/coroutines/localFunctions/named/stateMachine.kt b/compiler/testData/codegen/box/coroutines/localFunctions/named/stateMachine.kt index a65c502cb60..a857c18fc9f 100644 --- a/compiler/testData/codegen/box/coroutines/localFunctions/named/stateMachine.kt +++ b/compiler/testData/codegen/box/coroutines/localFunctions/named/stateMachine.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var result = "FAIL" var i = 0 diff --git a/compiler/testData/codegen/box/coroutines/localFunctions/named/withArguments.kt b/compiler/testData/codegen/box/coroutines/localFunctions/named/withArguments.kt index bc8115db659..691492a1585 100644 --- a/compiler/testData/codegen/box/coroutines/localFunctions/named/withArguments.kt +++ b/compiler/testData/codegen/box/coroutines/localFunctions/named/withArguments.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun callLocal(a: String, b: String): String { suspend fun local(a: String, b: String) = suspendCoroutineUninterceptedOrReturn { diff --git a/compiler/testData/codegen/box/coroutines/longRangeInSuspendCall.kt b/compiler/testData/codegen/box/coroutines/longRangeInSuspendCall.kt index 917aae72d2f..c0641638b62 100644 --- a/compiler/testData/codegen/box/coroutines/longRangeInSuspendCall.kt +++ b/compiler/testData/codegen/box/coroutines/longRangeInSuspendCall.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun getLong(): Long = suspendCoroutineUninterceptedOrReturn { x -> x.resume(1234567890123L) diff --git a/compiler/testData/codegen/box/coroutines/longRangeInSuspendFun.kt b/compiler/testData/codegen/box/coroutines/longRangeInSuspendFun.kt index c491c20c86e..5d3fbef2bdb 100644 --- a/compiler/testData/codegen/box/coroutines/longRangeInSuspendFun.kt +++ b/compiler/testData/codegen/box/coroutines/longRangeInSuspendFun.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendHere(r: LongRange): Long = suspendCoroutineUninterceptedOrReturn { x -> x.resume(r.start + r.endInclusive) diff --git a/compiler/testData/codegen/box/coroutines/mergeNullAndString.kt b/compiler/testData/codegen/box/coroutines/mergeNullAndString.kt index 7e0c607cd4e..cfdf55891d2 100644 --- a/compiler/testData/codegen/box/coroutines/mergeNullAndString.kt +++ b/compiler/testData/codegen/box/coroutines/mergeNullAndString.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt b/compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt index 553ee474395..33d5dbbfa45 100644 --- a/compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt +++ b/compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt @@ -1,14 +1,12 @@ // IGNORE_BACKEND: NATIVE // WITH_COROUTINES // WITH_RUNTIME -// COMMON_COROUTINES_TEST - // MODULE: lib(support) // FILE: lib.kt import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend inline fun inlined( crossinline step: suspend () -> R @@ -22,11 +20,9 @@ suspend fun notInlined( // FILE: main.kt // WITH_COROUTINES // WITH_RUNTIME -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var result = "FAIL" @@ -45,4 +41,4 @@ fun box(): String { test() } return result -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt b/compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt index 258aace95b7..4e61ecf8103 100644 --- a/compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt +++ b/compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt @@ -8,10 +8,9 @@ inline fun foo(x: String = "OK"): String { // FILE: main.kt // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var result = "" diff --git a/compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModule.kt b/compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModule.kt index 72cee2ee5e4..285dae7d44e 100644 --- a/compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModule.kt +++ b/compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModule.kt @@ -1,13 +1,11 @@ // WITH_COROUTINES // WITH_RUNTIME -// COMMON_COROUTINES_TEST - // MODULE: lib(support) // FILE: lib.kt import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var continuation: () -> Unit = { } var log = "" @@ -39,8 +37,8 @@ fun builder(c: suspend () -> Unit) { // MODULE: main(lib) // FILE: main.kt -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun baz() { bar("A") diff --git a/compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleOverride.kt b/compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleOverride.kt index 96bd6e26f5e..8d689cd45e5 100644 --- a/compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleOverride.kt +++ b/compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleOverride.kt @@ -1,13 +1,11 @@ // WITH_COROUTINES // WITH_RUNTIME -// COMMON_COROUTINES_TEST - // MODULE: lib(support) // FILE: lib.kt import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var continuation: () -> Unit = { } var log = "" @@ -45,8 +43,8 @@ fun builder(c: suspend () -> Unit) { // MODULE: main(lib) // FILE: main.kt -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun baz() { val a = A("A") diff --git a/compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithController.kt b/compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithController.kt index 02f12ed6240..736540d70a3 100644 --- a/compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithController.kt +++ b/compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithController.kt @@ -1,13 +1,11 @@ // WITH_COROUTINES // WITH_RUNTIME -// COMMON_COROUTINES_TEST - // MODULE: lib(support) // FILE: lib.kt import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var continuation: () -> Unit = { } var log = "" @@ -43,8 +41,8 @@ fun C.builder(c: suspend C.() -> Unit) { // MODULE: main(lib) // FILE: main.kt -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun C.baz() { v = "A" diff --git a/compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithInnerInlining.kt b/compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithInnerInlining.kt index 3aca04ab5a1..99501074f46 100644 --- a/compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithInnerInlining.kt +++ b/compiler/testData/codegen/box/coroutines/multiModule/inlineMultiModuleWithInnerInlining.kt @@ -1,14 +1,12 @@ // IGNORE_BACKEND: NATIVE // WITH_COROUTINES // WITH_RUNTIME -// COMMON_COROUTINES_TEST - // MODULE: lib(support) // FILE: lib.kt import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var continuation: () -> Unit = { } var log = "" @@ -44,8 +42,8 @@ fun builder(c: suspend () -> Unit) { // MODULE: main(lib) // FILE: main.kt -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun baz() { val a = bar("A") diff --git a/compiler/testData/codegen/box/coroutines/multiModule/inlineTailCall.kt b/compiler/testData/codegen/box/coroutines/multiModule/inlineTailCall.kt index 204539f0b59..a66518f6dff 100644 --- a/compiler/testData/codegen/box/coroutines/multiModule/inlineTailCall.kt +++ b/compiler/testData/codegen/box/coroutines/multiModule/inlineTailCall.kt @@ -1,7 +1,6 @@ // IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST // MODULE: lib // FILE: lib.kt suspend inline fun foo(v: String): String = v @@ -11,8 +10,8 @@ suspend inline fun bar(): String = foo("O") // MODULE: main(lib, support) // FILE: main.kt import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/multiModule/simple.kt b/compiler/testData/codegen/box/coroutines/multiModule/simple.kt index 64d9c856784..0a2c2596937 100644 --- a/compiler/testData/codegen/box/coroutines/multiModule/simple.kt +++ b/compiler/testData/codegen/box/coroutines/multiModule/simple.kt @@ -1,13 +1,12 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST // MODULE: controller(support) // FILE: controller.kt package lib import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> @@ -20,8 +19,8 @@ class Controller { // FILE: main.kt import lib.* import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend Controller.() -> Unit) { c.startCoroutine(Controller(), EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt b/compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt index 83363299870..2e7856f3de9 100644 --- a/compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt +++ b/compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { var lastSuspension: Continuation? = null diff --git a/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt b/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt index 877d4054d00..6a01e0bf54e 100644 --- a/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt +++ b/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { var lastSuspension: Continuation? = null diff --git a/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt b/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt index cac917da90e..996f7354952 100644 --- a/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt +++ b/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { var lastSuspension: Continuation? = null diff --git a/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt b/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt index 5dedd0226ce..663999ab4cf 100644 --- a/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt +++ b/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { var lastSuspension: Continuation? = null diff --git a/compiler/testData/codegen/box/coroutines/nestedTryCatch.kt b/compiler/testData/codegen/box/coroutines/nestedTryCatch.kt index 350d544d3ae..cf4f4c1c01c 100644 --- a/compiler/testData/codegen/box/coroutines/nestedTryCatch.kt +++ b/compiler/testData/codegen/box/coroutines/nestedTryCatch.kt @@ -1,10 +1,9 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var globalResult = "" var wasCalled = false diff --git a/compiler/testData/codegen/box/coroutines/noSuspensionPoints.kt b/compiler/testData/codegen/box/coroutines/noSuspensionPoints.kt index c8eddab8a3b..34d8eff0711 100644 --- a/compiler/testData/codegen/box/coroutines/noSuspensionPoints.kt +++ b/compiler/testData/codegen/box/coroutines/noSuspensionPoints.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun builder(c: suspend () -> Int): Int { diff --git a/compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt b/compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt index d393f5ceea5..f1189aa83fb 100644 --- a/compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt +++ b/compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME -// COMMON_COROUTINES_TEST // WITH_COROUTINES import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { var cResult = 0 diff --git a/compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt b/compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt index af5fc73a96a..45721e9f8ff 100644 --- a/compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt +++ b/compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME -// COMMON_COROUTINES_TEST // WITH_COROUTINES import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { diff --git a/compiler/testData/codegen/box/coroutines/overrideDefaultArgument.kt b/compiler/testData/codegen/box/coroutines/overrideDefaultArgument.kt index e292198e2be..780d61ebadd 100644 --- a/compiler/testData/codegen/box/coroutines/overrideDefaultArgument.kt +++ b/compiler/testData/codegen/box/coroutines/overrideDefaultArgument.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun box(): String { async { diff --git a/compiler/testData/codegen/box/coroutines/recursiveSuspend.kt b/compiler/testData/codegen/box/coroutines/recursiveSuspend.kt index 90f5e4c633f..b7cc79806bc 100644 --- a/compiler/testData/codegen/box/coroutines/recursiveSuspend.kt +++ b/compiler/testData/codegen/box/coroutines/recursiveSuspend.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun box(): String { var result = 0 diff --git a/compiler/testData/codegen/box/coroutines/redundantLocalsElimination/ktor_receivedMessage.kt b/compiler/testData/codegen/box/coroutines/redundantLocalsElimination/ktor_receivedMessage.kt index aa360c8bb59..9ebccd0669f 100644 --- a/compiler/testData/codegen/box/coroutines/redundantLocalsElimination/ktor_receivedMessage.kt +++ b/compiler/testData/codegen/box/coroutines/redundantLocalsElimination/ktor_receivedMessage.kt @@ -1,10 +1,8 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* private var prevSender: String = "FAIL" @@ -42,4 +40,4 @@ fun box(): String { receivedMessage("OK", "/who") } return prevSender -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/returnByLabel.kt b/compiler/testData/codegen/box/coroutines/returnByLabel.kt index 836f10ae700..25440dfc6d9 100644 --- a/compiler/testData/codegen/box/coroutines/returnByLabel.kt +++ b/compiler/testData/codegen/box/coroutines/returnByLabel.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> x.resume("OK") diff --git a/compiler/testData/codegen/box/coroutines/simple.kt b/compiler/testData/codegen/box/coroutines/simple.kt index 3731dd4ec0b..62903aba8b8 100644 --- a/compiler/testData/codegen/box/coroutines/simple.kt +++ b/compiler/testData/codegen/box/coroutines/simple.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> x.resume("OK") diff --git a/compiler/testData/codegen/box/coroutines/simpleException.kt b/compiler/testData/codegen/box/coroutines/simpleException.kt index b086b794eaf..21297ff1b46 100644 --- a/compiler/testData/codegen/box/coroutines/simpleException.kt +++ b/compiler/testData/codegen/box/coroutines/simpleException.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/simpleWithHandleResult.kt b/compiler/testData/codegen/box/coroutines/simpleWithHandleResult.kt index 25ca2d4562c..892e0320273 100644 --- a/compiler/testData/codegen/box/coroutines/simpleWithHandleResult.kt +++ b/compiler/testData/codegen/box/coroutines/simpleWithHandleResult.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> x.resume("OK") diff --git a/compiler/testData/codegen/box/coroutines/stackUnwinding/exception.kt b/compiler/testData/codegen/box/coroutines/stackUnwinding/exception.kt index 67be6b24d95..06573c23347 100644 --- a/compiler/testData/codegen/box/coroutines/stackUnwinding/exception.kt +++ b/compiler/testData/codegen/box/coroutines/stackUnwinding/exception.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): String = throw RuntimeException("OK") diff --git a/compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt b/compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt index 527fd45bc1b..a83b52f2a2f 100644 --- a/compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt +++ b/compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt @@ -1,13 +1,12 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* // WITH_REFLECT // CHECK_NOT_CALLED: suspendInline_61zpoe$ // CHECK_NOT_CALLED: suspendInline_6r51u9$ // CHECK_NOT_CALLED: suspendInline -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend inline fun suspendInline(v: String): String = v diff --git a/compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinally.kt b/compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinally.kt index 4bf708ac8ac..1ab732d22f2 100644 --- a/compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinally.kt +++ b/compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinally.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* // Note: This test for issue KT-28207 about infinite loop after throwing exception from finally block @@ -39,4 +38,4 @@ fun box(): String { } return result -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinallyWithSuspension.kt b/compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinallyWithSuspension.kt index d3ffc479cd6..74fc2624e00 100644 --- a/compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinallyWithSuspension.kt +++ b/compiler/testData/codegen/box/coroutines/stackUnwinding/rethrowInFinallyWithSuspension.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* // Note: This test for issue KT-28207 about infinite loop after throwing exception from finally block @@ -48,4 +47,4 @@ fun box(): String { return result -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt b/compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt index 0b49fa281b0..20f13292af4 100644 --- a/compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt +++ b/compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere() = "OK" diff --git a/compiler/testData/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt b/compiler/testData/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt index 38bc0cb13eb..f33921ca516 100644 --- a/compiler/testData/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt +++ b/compiler/testData/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): Int = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/statementLikeLastExpression.kt b/compiler/testData/codegen/box/coroutines/statementLikeLastExpression.kt index 2e356a6257c..5b861804f88 100644 --- a/compiler/testData/codegen/box/coroutines/statementLikeLastExpression.kt +++ b/compiler/testData/codegen/box/coroutines/statementLikeLastExpression.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var globalResult = "" suspend fun suspendWithValue(v: String): String = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/suspendCallsInArguments.kt b/compiler/testData/codegen/box/coroutines/suspendCallsInArguments.kt index 5b7ef570bfe..12625c6b078 100644 --- a/compiler/testData/codegen/box/coroutines/suspendCallsInArguments.kt +++ b/compiler/testData/codegen/box/coroutines/suspendCallsInArguments.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { var result = "" diff --git a/compiler/testData/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt b/compiler/testData/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt index 4e2fd0f4157..7598aa584eb 100644 --- a/compiler/testData/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt +++ b/compiler/testData/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt @@ -1,10 +1,9 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.suspendCoroutineUninterceptedOrReturn -import COROUTINES_PACKAGE.intrinsics.COROUTINE_SUSPENDED +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn +import kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED fun box(): String { async { diff --git a/compiler/testData/codegen/box/coroutines/suspendDefaultImpl.kt b/compiler/testData/codegen/box/coroutines/suspendDefaultImpl.kt index 06f7be45741..2371d5e9643 100644 --- a/compiler/testData/codegen/box/coroutines/suspendDefaultImpl.kt +++ b/compiler/testData/codegen/box/coroutines/suspendDefaultImpl.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* interface TestInterface { suspend fun toInt(): Int = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/suspendDelegation.kt b/compiler/testData/codegen/box/coroutines/suspendDelegation.kt index 92750645f98..802fc81ab4d 100644 --- a/compiler/testData/codegen/box/coroutines/suspendDelegation.kt +++ b/compiler/testData/codegen/box/coroutines/suspendDelegation.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): String = suspendThere() diff --git a/compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt b/compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt index de1171d1037..c776dec68f0 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(v: Int): Int = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/suspendFunImportedFromObject.kt b/compiler/testData/codegen/box/coroutines/suspendFunImportedFromObject.kt index 7a2f2b96a46..b71f7dd891e 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFunImportedFromObject.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFunImportedFromObject.kt @@ -1,13 +1,11 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - // FILE: stuff.kt package stuff import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* object Host { suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> @@ -19,8 +17,8 @@ object Host { // FILE: test.kt import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import stuff.Host.suspendHere fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt index 345b9db67e0..a1228e8d4cc 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt @@ -1,10 +1,9 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST // FULL_JDK import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { var log = "" diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt index dfa2bab7997..b3d35447b7e 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt @@ -1,10 +1,9 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { var exception: Throwable? = null diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt index 87c31afe684..1199f00256f 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendThere(v: String): String = suspendCoroutineUninterceptedOrReturn { x -> x.resume(v) diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt index 678765c6e7b..5310f5b2d50 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt @@ -1,11 +1,10 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.COROUTINE_SUSPENDED -import COROUTINES_PACKAGE.intrinsics.suspendCoroutineUninterceptedOrReturn +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED +import kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn class MyTest { suspend fun act(value: String): String = suspendCoroutineUninterceptedOrReturn { diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt index 7ca863cfc43..82df555a2aa 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class A(val v: String) { suspend fun suspendThere(v: String): String = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt index 0523f92f294..afd2d38de64 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt @@ -1,11 +1,10 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.COROUTINE_SUSPENDED -import COROUTINES_PACKAGE.intrinsics.suspendCoroutineUninterceptedOrReturn +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED +import kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn class MyTest { suspend fun act(value: String): String = suspendCoroutineUninterceptedOrReturn { diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt index 149f3b3cd09..8fc377e3b07 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import kotlin.reflect.KProperty suspend fun suspendThere(v: String): String = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt index 0e4dd227270..b6e14a89cf5 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class X { var res = "" diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt index 86f9adb506c..b9f3528392f 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var x = true diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt index 756fe4bb4cc..c8f27f44fe9 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendThere(v: String): String = suspendCoroutineUninterceptedOrReturn { x -> x.resume(v) diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt index 5771cc14152..a00aca0923c 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendThere(v: String): String = suspendCoroutineUninterceptedOrReturn { x -> x.resume(v) diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt index 34775f65723..8dbe5c8a8aa 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* open class A(val v: String) { suspend fun suspendThere(v: String): String = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallAbstractClass.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallAbstractClass.kt index 25d9fd9baa2..cf270224486 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallAbstractClass.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallAbstractClass.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* abstract class A(val v: String) { suspend abstract fun foo(v: String): String diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallInterface.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallInterface.kt index cda43f8cee3..69641063159 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallInterface.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallInterface.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* interface A { val v: String diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallOverload.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallOverload.kt index 14411f2977d..2a5d0f2f0f9 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallOverload.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallOverload.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* open class A(val v: String) { suspend fun suspendThere(v: String): String = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt index 1dbe4637a50..fba9816e6cd 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendThere(v: String): String = suspendCoroutineUninterceptedOrReturn { x -> x.resume(v) diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt index 02113d0964d..e51f2eab6a1 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendHere(v: String): String = suspendCoroutineUninterceptedOrReturn { x -> x.resume(v) diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt index 9db14a3230c..2c7d9e01696 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendHere(v: String): String = suspendCoroutineUninterceptedOrReturn { x -> x.resume(v) diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParametersNoCapture.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParametersNoCapture.kt index 679f28ef211..a44a237525e 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParametersNoCapture.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/manyParametersNoCapture.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendHere(v: String): String = suspendCoroutineUninterceptedOrReturn { x -> x.resume(v) diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt index 5f8d15e93ba..88792fdca97 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME -// COMMON_COROUTINES_TEST // WITH_COROUTINES import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendHere(v: String): String = suspendCoroutineUninterceptedOrReturn { x -> x.resume(v) diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt index e80bb76623c..d9e1b23e387 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME -// COMMON_COROUTINES_TEST // WITH_COROUTINES import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendHere(v: String): String = suspendCoroutineUninterceptedOrReturn { x -> x.resume(v) diff --git a/compiler/testData/codegen/box/coroutines/suspendInCycle.kt b/compiler/testData/codegen/box/coroutines/suspendInCycle.kt index 2f7965b8c9c..9b7492d2e6f 100644 --- a/compiler/testData/codegen/box/coroutines/suspendInCycle.kt +++ b/compiler/testData/codegen/box/coroutines/suspendInCycle.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { var i = 0 diff --git a/compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt b/compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt index 1123c751bbb..ed5d7104a9a 100644 --- a/compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt +++ b/compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt b/compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt index c5959647e05..93f2c54f061 100644 --- a/compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt +++ b/compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt @@ -2,10 +2,9 @@ // IGNORE_BACKEND: JS_IR_ES6 // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionWithJumpOut.kt b/compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionWithJumpOut.kt index 8d9acce99ce..1cfa7a75989 100644 --- a/compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionWithJumpOut.kt +++ b/compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionWithJumpOut.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/suspendLambdaWithArgumentRearrangement.kt b/compiler/testData/codegen/box/coroutines/suspendLambdaWithArgumentRearrangement.kt index 22e10d91535..61efe9c020f 100644 --- a/compiler/testData/codegen/box/coroutines/suspendLambdaWithArgumentRearrangement.kt +++ b/compiler/testData/codegen/box/coroutines/suspendLambdaWithArgumentRearrangement.kt @@ -1,10 +1,9 @@ // IGNORE_BACKEND: JS // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* inline fun callAction(aux: Int, action: () -> String): String { return action() diff --git a/compiler/testData/codegen/box/coroutines/suspensionInsideSafeCall.kt b/compiler/testData/codegen/box/coroutines/suspensionInsideSafeCall.kt index a6e9d2fc2b6..776227d7d45 100644 --- a/compiler/testData/codegen/box/coroutines/suspensionInsideSafeCall.kt +++ b/compiler/testData/codegen/box/coroutines/suspensionInsideSafeCall.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class TestClass { suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt b/compiler/testData/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt index acaccff04e6..01de31a0be7 100644 --- a/compiler/testData/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt +++ b/compiler/testData/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class TestClass { suspend fun toInt(): Int = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/tailCallOptimizations/crossinline.kt b/compiler/testData/codegen/box/coroutines/tailCallOptimizations/crossinline.kt index 7782cb0405e..ee7e3bb331d 100644 --- a/compiler/testData/codegen/box/coroutines/tailCallOptimizations/crossinline.kt +++ b/compiler/testData/codegen/box/coroutines/tailCallOptimizations/crossinline.kt @@ -1,11 +1,10 @@ // IGNORE_BACKEND_FIR: JVM_IR -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // CHECK_BYTECODE_LISTING import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* interface SourceCrossinline { suspend fun consume(sink: Sink) @@ -72,4 +71,4 @@ fun box(): String { } if (res != 12) return "FAIL" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt b/compiler/testData/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt index dcd448f84b9..dcc818fb856 100644 --- a/compiler/testData/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt +++ b/compiler/testData/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt @@ -1,12 +1,11 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST // CHECK_BYTECODE_LISTING // CHECK_NEW_COUNT: function=suspendHere count=0 // CHECK_NEW_COUNT: function=complexSuspend count=0 import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* inline suspend fun suspendThere(v: String): String = suspendCoroutineUninterceptedOrReturn { x -> x.resume(v) diff --git a/compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation.kt b/compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation.kt index d407e0f35e2..a3a15301870 100644 --- a/compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation.kt +++ b/compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation.kt @@ -1,5 +1,4 @@ // IGNORE_BACKEND_FIR: JVM_IR -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // CHECK_BYTECODE_LISTING @@ -15,7 +14,7 @@ package flow -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* interface FlowCollector { diff --git a/compiler/testData/codegen/box/coroutines/tailCallOptimizations/tryCatch.kt b/compiler/testData/codegen/box/coroutines/tailCallOptimizations/tryCatch.kt index 6b9518e2e61..32f9c62522d 100644 --- a/compiler/testData/codegen/box/coroutines/tailCallOptimizations/tryCatch.kt +++ b/compiler/testData/codegen/box/coroutines/tailCallOptimizations/tryCatch.kt @@ -1,10 +1,9 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* val postponedActions = ArrayList<() -> Unit>() @@ -36,4 +35,4 @@ fun box(): String { return run { catchException() } -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/tailOperations/suspendWithIf.kt b/compiler/testData/codegen/box/coroutines/tailOperations/suspendWithIf.kt index c8502ed7398..1b4873af4ed 100644 --- a/compiler/testData/codegen/box/coroutines/tailOperations/suspendWithIf.kt +++ b/compiler/testData/codegen/box/coroutines/tailOperations/suspendWithIf.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun foo(x: Any): Int { return if (x == "56") suspendHere() else 13 diff --git a/compiler/testData/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt b/compiler/testData/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt index 310c1ddc2f6..2e30058ba41 100644 --- a/compiler/testData/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt +++ b/compiler/testData/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun foo(x: Any): Int { return try { diff --git a/compiler/testData/codegen/box/coroutines/tailOperations/suspendWithWhen.kt b/compiler/testData/codegen/box/coroutines/tailOperations/suspendWithWhen.kt index c60c498aa4d..5b14dbb3061 100644 --- a/compiler/testData/codegen/box/coroutines/tailOperations/suspendWithWhen.kt +++ b/compiler/testData/codegen/box/coroutines/tailOperations/suspendWithWhen.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun foo(x: Any): Int { return when { diff --git a/compiler/testData/codegen/box/coroutines/tailOperations/tailInlining.kt b/compiler/testData/codegen/box/coroutines/tailOperations/tailInlining.kt index b3285d0760f..0eacff0bcf4 100644 --- a/compiler/testData/codegen/box/coroutines/tailOperations/tailInlining.kt +++ b/compiler/testData/codegen/box/coroutines/tailOperations/tailInlining.kt @@ -1,8 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun box(): String { async { diff --git a/compiler/testData/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt b/compiler/testData/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt index 8e7d908d8b9..fe5bb4c82b8 100644 --- a/compiler/testData/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt +++ b/compiler/testData/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt @@ -1,10 +1,9 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var globalResult = "" var wasCalled = false diff --git a/compiler/testData/codegen/box/coroutines/tryCatchWithHandleResult.kt b/compiler/testData/codegen/box/coroutines/tryCatchWithHandleResult.kt index bc9f122350f..7211b9e6126 100644 --- a/compiler/testData/codegen/box/coroutines/tryCatchWithHandleResult.kt +++ b/compiler/testData/codegen/box/coroutines/tryCatchWithHandleResult.kt @@ -1,10 +1,9 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var globalResult = "" var wasCalled = false diff --git a/compiler/testData/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt b/compiler/testData/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt index 8ca5670a359..e6a7fdef492 100644 --- a/compiler/testData/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt +++ b/compiler/testData/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(v: String): String = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/tryFinallyWithHandleResult.kt b/compiler/testData/codegen/box/coroutines/tryFinallyWithHandleResult.kt index 11c44fc116f..b73074dec6d 100644 --- a/compiler/testData/codegen/box/coroutines/tryFinallyWithHandleResult.kt +++ b/compiler/testData/codegen/box/coroutines/tryFinallyWithHandleResult.kt @@ -1,10 +1,9 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var globalResult = "" var wasCalled = false diff --git a/compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt b/compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt index f73be96daf0..22acd215dbd 100644 --- a/compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt +++ b/compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> x.resume("OK") diff --git a/compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt b/compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt index e444505b7b1..233f0646446 100644 --- a/compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt +++ b/compiler/testData/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> x.resume("OK") diff --git a/compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt b/compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt index dc343d309d8..523629f2c83 100644 --- a/compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt +++ b/compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var result = "0" diff --git a/compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt b/compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt index 24105a85d79..796f0b4a6b7 100644 --- a/compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt +++ b/compiler/testData/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var result = "0" diff --git a/compiler/testData/codegen/box/coroutines/unitTypeReturn/unitSafeCall.kt b/compiler/testData/codegen/box/coroutines/unitTypeReturn/unitSafeCall.kt index 04d923b6ca9..b9ce426fea9 100644 --- a/compiler/testData/codegen/box/coroutines/unitTypeReturn/unitSafeCall.kt +++ b/compiler/testData/codegen/box/coroutines/unitTypeReturn/unitSafeCall.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var log = "" var postponed: () -> Unit = { } diff --git a/compiler/testData/codegen/box/coroutines/varCaptuedInCoroutineIntrinsic.kt b/compiler/testData/codegen/box/coroutines/varCaptuedInCoroutineIntrinsic.kt index 2c75e3c721c..938d54342fb 100644 --- a/compiler/testData/codegen/box/coroutines/varCaptuedInCoroutineIntrinsic.kt +++ b/compiler/testData/codegen/box/coroutines/varCaptuedInCoroutineIntrinsic.kt @@ -1,10 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendHere(): String { var s: String? = null @@ -29,4 +27,4 @@ fun box(): String { } return result -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/coroutines/varSpilling/kt19475.kt b/compiler/testData/codegen/box/coroutines/varSpilling/kt19475.kt index 39f59c5f5d4..9d5f518805d 100644 --- a/compiler/testData/codegen/box/coroutines/varSpilling/kt19475.kt +++ b/compiler/testData/codegen/box/coroutines/varSpilling/kt19475.kt @@ -1,10 +1,9 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> x.resume("OK") diff --git a/compiler/testData/codegen/box/coroutines/varSpilling/kt38925.kt b/compiler/testData/codegen/box/coroutines/varSpilling/kt38925.kt index 6c5eb45c557..24e0597e38d 100644 --- a/compiler/testData/codegen/box/coroutines/varSpilling/kt38925.kt +++ b/compiler/testData/codegen/box/coroutines/varSpilling/kt38925.kt @@ -1,10 +1,9 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun foo() { bar { diff --git a/compiler/testData/codegen/box/coroutines/varSpilling/nullSpilling.kt b/compiler/testData/codegen/box/coroutines/varSpilling/nullSpilling.kt index fdad0a16caf..8fa7ff33fb5 100644 --- a/compiler/testData/codegen/box/coroutines/varSpilling/nullSpilling.kt +++ b/compiler/testData/codegen/box/coroutines/varSpilling/nullSpilling.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun foo(value: String): String = suspendCoroutineUninterceptedOrReturn { x -> x.resume(value) diff --git a/compiler/testData/codegen/box/coroutines/varValueConflictsWithTable.kt b/compiler/testData/codegen/box/coroutines/varValueConflictsWithTable.kt index 14bac4017fd..21222a17f84 100644 --- a/compiler/testData/codegen/box/coroutines/varValueConflictsWithTable.kt +++ b/compiler/testData/codegen/box/coroutines/varValueConflictsWithTable.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt b/compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt index 7741fc0e6d0..47b6e1bf099 100644 --- a/compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt +++ b/compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/box/parametersMetadata/suspendFunction.kt b/compiler/testData/codegen/box/parametersMetadata/suspendFunction.kt index 5be423553b6..b79a3386c7b 100644 --- a/compiler/testData/codegen/box/parametersMetadata/suspendFunction.kt +++ b/compiler/testData/codegen/box/parametersMetadata/suspendFunction.kt @@ -3,9 +3,8 @@ // WITH_RUNTIME // FULL_JDK // KOTLIN_CONFIGURATION_FLAGS: +JVM.PARAMETERS_METADATA -// COMMON_COROUTINES_TEST -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class A() { suspend fun test(OK: String) { @@ -21,4 +20,4 @@ fun box(): String { if (parameters[0].modifiers != 0) return "wrong modifier on value parameter: ${parameters[0].modifiers}" if (parameters[1].modifiers != 0) return "wrong modifier on Continuation parameter: ${parameters[1].modifiers}" return parameters[0].name -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxInline/suspend/capturedVariables.kt b/compiler/testData/codegen/boxInline/suspend/capturedVariables.kt index e653ec6d307..d916a116d42 100644 --- a/compiler/testData/codegen/boxInline/suspend/capturedVariables.kt +++ b/compiler/testData/codegen/boxInline/suspend/capturedVariables.kt @@ -1,9 +1,8 @@ // FILE: test.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* suspend inline fun test1(c: suspend () -> Unit) { @@ -16,10 +15,8 @@ suspend inline fun test2(crossinline c: suspend () -> Unit) { } // FILE: box.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt b/compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt index a5075cb2728..5b00ac8e5a2 100644 --- a/compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt +++ b/compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt @@ -1,9 +1,8 @@ // FILE: test.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* inline suspend fun foo(crossinline a: suspend () -> Unit, crossinline b: suspend () -> Unit) { @@ -21,12 +20,10 @@ fun builder(c: suspend () -> Unit) { } // FILE: box.kt -// COMMON_COROUTINES_TEST - fun box(): String { var y = "fail" builder { foo({ y = "O" }) { y += "K" } } return y -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt b/compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt index 3f4bcfc9006..911f9ebd0d5 100644 --- a/compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt +++ b/compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt @@ -1,10 +1,9 @@ // FILE: test.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* class Controller { @@ -38,9 +37,7 @@ suspend inline fun test3(controller: Controller = defaultController, crossinline } // FILE: box.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt b/compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt index af2a989202a..644d74c3e4f 100644 --- a/compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt +++ b/compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt @@ -1,10 +1,9 @@ // FILE: test.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* class Controller { @@ -18,9 +17,7 @@ suspend inline fun test(controller: Controller = defaultController, c: suspend C } // FILE: box.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt b/compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt index a4382510c57..22633a69837 100644 --- a/compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt +++ b/compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInlineFromMultiFileFacade.kt @@ -1,10 +1,9 @@ // FILE: test.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* class Controller { @@ -18,9 +17,7 @@ suspend inline fun test(controller: Controller, c: () -> Unit = { controller.re } // FILE: box.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt b/compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt index 2de5ca1129c..79dd8b581f6 100644 --- a/compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt +++ b/compiler/testData/codegen/boxInline/suspend/delegatedProperties.kt @@ -1,10 +1,9 @@ // FILE: test.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // WITH_REFLECT -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* import kotlin.reflect.KProperty @@ -29,9 +28,7 @@ suspend inline fun test(crossinline c: suspend (String) -> String): String { } // FILE: box.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* fun builder(c: suspend () -> Unit) { @@ -46,4 +43,4 @@ fun box(): String { res = test { it } } return res -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt b/compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt index beca6d56678..ac7ca97eb5d 100644 --- a/compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt +++ b/compiler/testData/codegen/boxInline/suspend/doubleRegenerationWithNonSuspendingLambda.kt @@ -1,5 +1,4 @@ // FILE: test.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES @@ -30,9 +29,7 @@ inline fun Flow<*>.filterIsInstance(): Flow = filter { it is R } as Flow // FILE: box.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/boxInline/suspend/enclodingMethod.kt b/compiler/testData/codegen/boxInline/suspend/enclodingMethod.kt index fca768a6649..d0975166d0e 100644 --- a/compiler/testData/codegen/boxInline/suspend/enclodingMethod.kt +++ b/compiler/testData/codegen/boxInline/suspend/enclodingMethod.kt @@ -1,6 +1,5 @@ // TARGET_BACKEND: JVM // FILE: flow.kt -// COMMON_COROUTINES_TEST // FULL_JDK // WITH_RUNTIME // WITH_COROUTINES @@ -43,8 +42,6 @@ inline fun decorate() = suspend { } // FILE: box.kt -// COMMON_COROUTINES_TEST - import flow.* fun box() : String { diff --git a/compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt b/compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt index 15a4f9e48d1..a5521b9c995 100644 --- a/compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt +++ b/compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt @@ -1,9 +1,8 @@ // FILE: test.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* // Block is allowed to be called from nested classes/lambdas (as common crossinlines) @@ -32,8 +31,6 @@ fun builder(c: suspend () -> Unit) { } // FILE: box.kt -// COMMON_COROUTINES_TEST - suspend fun calculate() = "OK" fun box(): String { diff --git a/compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt b/compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt index c7fc5f17467..1d256ff2ae7 100644 --- a/compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt +++ b/compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt @@ -1,9 +1,8 @@ // FILE: test.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* // Block is allowed to be called from nested classes/lambdas (as common crossinlines) @@ -37,8 +36,6 @@ fun builder(c: suspend () -> Unit) { } // FILE: box.kt -// COMMON_COROUTINES_TEST - suspend fun calculate() = "OK" fun box(): String { diff --git a/compiler/testData/codegen/boxInline/suspend/inlineSuspendContinuation.kt b/compiler/testData/codegen/boxInline/suspend/inlineSuspendContinuation.kt index 6797a429499..2272e155a1c 100644 --- a/compiler/testData/codegen/boxInline/suspend/inlineSuspendContinuation.kt +++ b/compiler/testData/codegen/boxInline/suspend/inlineSuspendContinuation.kt @@ -1,5 +1,4 @@ // FILE: test.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING @@ -36,12 +35,10 @@ suspend inline fun test5(crossinline c: suspend() -> Unit) { } // FILE: box.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* -import COROUTINES_PACKAGE.jvm.internal.* +import kotlin.coroutines.jvm.internal.* fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt b/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt index 40ea9b34541..202ff0ace90 100644 --- a/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt +++ b/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt @@ -1,8 +1,7 @@ // FILE: test.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* // Block is allowed to be called inside the body of owner inline function @@ -40,9 +39,7 @@ fun builder(c: suspend () -> Unit) { } // FILE: box.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* fun box() : String { diff --git a/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt b/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt index 8d4f7be1c72..96ea53cf6c1 100644 --- a/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt +++ b/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt @@ -1,9 +1,8 @@ // FILE: test.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* // Block is allowed to be called inside the body of owner inline function @@ -33,9 +32,7 @@ suspend inline fun test3(crossinline c: suspend () -> Unit) { } // FILE: box.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt b/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt index a0d25fba8ae..97d3a8bd5e3 100644 --- a/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt +++ b/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt @@ -1,8 +1,7 @@ // FILE: test.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* // Block is allowed to be called inside the body of owner inline function @@ -40,9 +39,7 @@ fun builder(c: suspend () -> Unit) { } // FILE: box.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* fun box() : String { diff --git a/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt b/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt index c57caf2dea6..b0567dab7c2 100644 --- a/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt +++ b/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt @@ -1,9 +1,8 @@ // FILE: test.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* // Block is allowed to be called from nested classes/lambdas (as common crossinlines) @@ -43,9 +42,7 @@ suspend inline fun test4(noinline c: suspend () -> Unit) { } // FILE: box.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* suspend fun calculate() = "OK" diff --git a/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt b/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt index a1032fc5ded..b3c16a7b24f 100644 --- a/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt +++ b/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt @@ -1,10 +1,9 @@ // FILE: test.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* // Block is allowed to be called inside the body of owner inline function @@ -23,9 +22,7 @@ inline fun transform(crossinline c: suspend () -> Unit) { } // FILE: box.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* suspend fun calculate() = "OK" diff --git a/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt b/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt index 6886678e0d9..dd34e3ca116 100644 --- a/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt +++ b/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt @@ -1,10 +1,9 @@ // FILE: test.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* // Block is allowed to be called inside the body of owner inline function @@ -15,9 +14,7 @@ suspend inline fun test(c: suspend () -> Unit) { } // FILE: box.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/boxInline/suspend/jvmName.kt b/compiler/testData/codegen/boxInline/suspend/jvmName.kt index cc2b0022165..abe9f30594e 100644 --- a/compiler/testData/codegen/boxInline/suspend/jvmName.kt +++ b/compiler/testData/codegen/boxInline/suspend/jvmName.kt @@ -1,11 +1,10 @@ // FILE: test.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING // TARGET_BACKEND: JVM -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* class Result(val x: T) @@ -17,10 +16,8 @@ suspend inline fun test(c: Result) = c.x suspend inline fun test(c: Result) = c.x // FILE: box.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt b/compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt index bd7723034fa..53a2f13b391 100644 --- a/compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt +++ b/compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt @@ -3,8 +3,6 @@ // NO_CHECK_LAMBDA_INLINING // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST - fun handle(f: suspend () -> Unit) {} open class Foo { @@ -26,8 +24,6 @@ class Bar : Foo() { class Baz(unit: Unit) // FILE: inlineSite.kt -// COMMON_COROUTINES_TEST - fun box(): String { Bar().bar {} return "OK" diff --git a/compiler/testData/codegen/boxInline/suspend/multipleLocals.kt b/compiler/testData/codegen/boxInline/suspend/multipleLocals.kt index a8960ae97fe..b0e93f73385 100644 --- a/compiler/testData/codegen/boxInline/suspend/multipleLocals.kt +++ b/compiler/testData/codegen/boxInline/suspend/multipleLocals.kt @@ -1,5 +1,4 @@ // FILE: inlined.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING @@ -60,9 +59,7 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { } // FILE: inlineSite.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt b/compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt index 4309e753c7c..48426297d9c 100644 --- a/compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt +++ b/compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt @@ -1,5 +1,4 @@ // FILE: inlined.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING @@ -27,9 +26,7 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { } // FILE: inlineSite.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* fun builder(c: suspend () -> Unit) { @@ -75,4 +72,4 @@ fun box(): String { if (j != 10) return "FAIL J" if (k != 10) return "FAIL K" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt b/compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt index cb66c494798..33e10a0e4bb 100644 --- a/compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt +++ b/compiler/testData/codegen/boxInline/suspend/nonSuspendCrossinline.kt @@ -1,4 +1,3 @@ -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // CHECK_STATE_MACHINE @@ -38,7 +37,7 @@ inline fun map3(source: MyDeferred, crossinline mapper1: (T) // FILE: box.kt import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) @@ -60,4 +59,4 @@ fun box(): String { } if (result != 10) return "FAIL 3 $result" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt b/compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt index e94339a6c65..3cacae437c4 100644 --- a/compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt +++ b/compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt @@ -1,9 +1,8 @@ // FILE: test.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // SKIP_SOURCEMAP_REMAPPING -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* // Block is allowed to be called from nested classes/lambdas (as common crossinlines) @@ -36,8 +35,6 @@ fun builder(controller: Controller, c: suspend Controller.() -> Unit) { } // FILE: box.kt -// COMMON_COROUTINES_TEST - suspend fun calculate() = "OK" fun box(): String { diff --git a/compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt b/compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt index 9e65cc7e552..86f6d390bc6 100644 --- a/compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt +++ b/compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt @@ -1,9 +1,8 @@ // FILE: test.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // SKIP_SOURCEMAP_REMAPPING -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* // Block is allowed to be called from nested classes/lambdas (as common crossinlines) @@ -41,8 +40,6 @@ fun builder(controller: Controller, c: suspend Controller.() -> Unit) { } // FILE: box.kt -// COMMON_COROUTINES_TEST - suspend fun calculate() = "OK" fun box(): String { diff --git a/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt b/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt index f72cdb13483..6f3e3ea9f39 100644 --- a/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt +++ b/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt @@ -1,9 +1,8 @@ // FILE: test.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // IGNORE_BACKEND: JS -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* // Block is allowed to be called inside the body of owner inline function @@ -45,9 +44,7 @@ fun builder(controller : Controller, c: suspend Controller.() -> Unit) { } // FILE: box.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* fun box() : String { diff --git a/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt b/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt index 126d7fd59c2..9b3e95addfa 100644 --- a/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt +++ b/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt @@ -1,9 +1,8 @@ // FILE: test.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // SKIP_SOURCEMAP_REMAPPING -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* // Block is allowed to be called inside the body of owner inline function @@ -37,9 +36,7 @@ class Controller { } // FILE: box.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* fun builder(controller: Controller, c: suspend Controller.() -> Unit) { diff --git a/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt b/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt index 1180c7c4e09..2170b31a764 100644 --- a/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt +++ b/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt @@ -1,9 +1,8 @@ // FILE: test.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // IGNORE_BACKEND: JS -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* // Block is allowed to be called inside the body of owner inline function @@ -45,9 +44,7 @@ fun builder(controller: Controller, c: suspend Controller.() -> Unit) { } // FILE: box.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* fun box() : String { diff --git a/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt b/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt index 1e13cf2866d..260096b26ed 100644 --- a/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt +++ b/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt @@ -1,9 +1,8 @@ // FILE: test.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // SKIP_SOURCEMAP_REMAPPING -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* // Block is allowed to be called from nested classes/lambdas (as common crossinlines) @@ -47,9 +46,7 @@ fun builder(controller: Controller, c: suspend Controller.() -> Unit) { } // FILE: box.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* suspend fun calculate() = "OK" diff --git a/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt b/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt index 4c5a3303491..f9b1f99e407 100644 --- a/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt +++ b/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt @@ -1,10 +1,9 @@ // FILE: test.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* // Block is allowed to be called inside the body of owner inline function @@ -27,9 +26,7 @@ fun builder(controller: Controller, c: suspend Controller.() -> Unit) { } // FILE: box.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* suspend fun calculate() = "OK" diff --git a/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt b/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt index e93f778b2f5..36b3072b44e 100644 --- a/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt +++ b/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt @@ -1,10 +1,9 @@ // FILE: test.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* // Block is allowed to be called inside the body of owner inline function @@ -19,9 +18,7 @@ class Controller { } // FILE: box.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* fun builder(controller: Controller, c: suspend Controller.() -> Unit) { diff --git a/compiler/testData/codegen/boxInline/suspend/returnValue.kt b/compiler/testData/codegen/boxInline/suspend/returnValue.kt index dab4fe03b0d..817db3ecb44 100644 --- a/compiler/testData/codegen/boxInline/suspend/returnValue.kt +++ b/compiler/testData/codegen/boxInline/suspend/returnValue.kt @@ -1,10 +1,9 @@ // FILE: inlined.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* inline suspend fun suspendThere(v: String): String = suspendCoroutineUninterceptedOrReturn { x -> @@ -19,9 +18,8 @@ suspend inline fun complexSuspend(crossinline c: suspend () -> String): String { } // FILE: inleneSite.kt -// COMMON_COROUTINES_TEST -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt index 84af03aaa19..b866fb06668 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/crossingCoroutineBoundaries.kt @@ -1,4 +1,3 @@ -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // CHECK_STATE_MACHINE @@ -6,7 +5,7 @@ // FILE: inline.kt import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* interface SuspendRunnable { suspend fun run() @@ -40,10 +39,8 @@ inline suspend fun inlineMe(crossinline c1: suspend () -> Unit) { // FILE: box.kt -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun builder(c: suspend () -> Unit) { c.startCoroutine(CheckStateMachineContinuation) diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt index 60b882c4d27..d8a7ef5f0a7 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/independentInline.kt @@ -1,4 +1,3 @@ -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // CHECK_STATE_MACHINE @@ -40,10 +39,8 @@ inline fun inlineMe2(crossinline c2: suspend () -> Unit): SuspendRunnable = } // FILE: box.kt -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun builder(c: suspend () -> Unit) { c.startCoroutine(CheckStateMachineContinuation) @@ -65,4 +62,4 @@ fun box(): String { } StateMachineChecker.check(numberOfSuspensions = 4) return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt index 462d21bd780..7677d0f4170 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt @@ -1,5 +1,4 @@ // FILE: inlined.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING @@ -15,10 +14,8 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { } // FILE: inlineSite.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt index 5aec1077517..d1a5918c833 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt @@ -1,6 +1,5 @@ // IGNORE_BACKEND_FIR: JVM_IR // FILE: inlined.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING @@ -20,10 +19,8 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { } // FILE: inlineSite.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt index 6edf3d7c16c..f286865f78a 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt @@ -1,11 +1,10 @@ // FILE: inlined.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING // CHECK_STATE_MACHINE -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.intrinsics.* import helpers.* suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { @@ -21,9 +20,7 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { } // FILE: inlineSite.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt index 61c4dee625a..fc31a227aea 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt @@ -1,6 +1,5 @@ // IGNORE_BACKEND_FIR: JVM_IR // FILE: inlined.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING @@ -46,10 +45,8 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { } // FILE: inlineSite.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt index e257cafcd67..a60a9da3935 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt @@ -1,6 +1,5 @@ // IGNORE_BACKEND_FIR: JVM_IR // FILE: inlined.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING @@ -20,10 +19,8 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { } // FILE: inlineSite.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt index 1de655b1392..e9912fc010d 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt @@ -1,5 +1,4 @@ // FILE: inlined.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING @@ -21,10 +20,8 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { } // FILE: inlineSite.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt index a5a336fbe4a..47d6a5f9fc6 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt @@ -1,5 +1,4 @@ // FILE: inlined.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING @@ -27,10 +26,8 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { } // FILE: inlineSite.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt index 72049cdce51..7814be72b3d 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectRetransformation.kt @@ -1,4 +1,3 @@ -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // CHECK_STATE_MACHINE @@ -46,12 +45,10 @@ inline fun Flow.flowWith(crossinline builderBlock: suspend } // FILE: box.kt -// COMMON_COROUTINES_TEST - import flow.* import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun builder(c: suspend () -> Unit) { c.startCoroutine(CheckStateMachineContinuation) diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt index d3ae1435f04..a5c6a414adb 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt @@ -1,5 +1,4 @@ // FILE: inlined.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING @@ -26,9 +25,7 @@ suspend inline fun crossinlineMe(crossinline c1: suspend () -> Unit, crossinline } // FILE: inlineSite.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* fun builder(c: suspend () -> Unit) { @@ -49,4 +46,4 @@ fun box(): String { StateMachineChecker.check(numberOfSuspensions = 2) if (j != 2) return "FAIL j != 2 $j" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt index e2b36fb44f7..48accc627e6 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt @@ -1,11 +1,10 @@ // FILE: inlined.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING // CHECK_STATE_MACHINE -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.intrinsics.* import helpers.* interface SuspendRunnable { @@ -26,9 +25,7 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { } // FILE: inlineSite.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt index 96d88510c28..ada4b3018f2 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/insideObject.kt @@ -1,4 +1,3 @@ -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // CHECK_STATE_MACHINE @@ -29,10 +28,8 @@ class R : SuspendRunnable { } // FILE: box.kt -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun builder(c: suspend () -> Unit) { c.startCoroutine(CheckStateMachineContinuation) diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt index fe9b071115e..6fd44fd96b6 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt @@ -1,5 +1,4 @@ // FILE: inlined.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING @@ -11,10 +10,8 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { } // FILE: inlineSite.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt index 3cf406512ec..b95ad874df8 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/numberOfSuspentions.kt @@ -1,5 +1,4 @@ // FILE: inlined.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING @@ -15,10 +14,8 @@ suspend inline fun crossinlineMe2(crossinline c: suspend () -> Unit) { } // FILE: inlineSite.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt index 7f7855a0873..37c3fe96a6e 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt @@ -1,4 +1,3 @@ -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // CHECK_STATE_MACHINE @@ -22,10 +21,8 @@ inline fun inlineMe(crossinline c: suspend () -> Unit) = { }() // FILE: box.kt -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun builder(c: suspend () -> Unit) { c.startCoroutine(CheckStateMachineContinuation) diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt index 85fce7eea6a..0a2583db9d6 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt @@ -1,4 +1,3 @@ -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // CHECK_STATE_MACHINE @@ -24,10 +23,8 @@ inline fun inlineMe(crossinline c: suspend () -> Unit, crossinline c2: suspend ( } // FILE: box.kt -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun builder(c: suspend () -> Unit) { c.startCoroutine(CheckStateMachineContinuation) diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt index 2ad6b7dd82f..6641edfaa39 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/passLambda.kt @@ -1,4 +1,3 @@ -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING @@ -59,10 +58,8 @@ inline suspend fun inlineMe13(crossinline c: suspend () -> Unit) = inlineMe3(c) inline suspend fun inlineMe14(crossinline c: suspend () -> Unit) = inlineMe4(c) // FILE: box.kt -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun builder(c: suspend () -> Unit) { c.startCoroutine(CheckStateMachineContinuation) @@ -146,4 +143,4 @@ fun box(): String { StateMachineChecker.check(numberOfSuspensions = 4) return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt index 0592b2005bd..c072baeaba4 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/passParameter.kt @@ -1,4 +1,3 @@ -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // CHECK_STATE_MACHINE @@ -31,10 +30,8 @@ inline fun inlineMe2(crossinline c1: suspend () -> Unit) = } // FILE: box.kt -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun builder(c: suspend () -> Unit) { c.startCoroutine(CheckStateMachineContinuation) diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt index d8c3b9f2a92..a00ddca18de 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/passParameterLambda.kt @@ -1,4 +1,3 @@ -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // CHECK_STATE_MACHINE @@ -12,10 +11,8 @@ inline fun inlineMe(crossinline c: suspend () -> Unit) = suspend { c(); c() } inline fun inlineMe2(crossinline c: suspend () -> Unit) = inlineMe { c(); c() } // FILE: box.kt -// COMMON_COROUTINES_TEST - import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun builder(c: suspend () -> Unit) { c.startCoroutine(CheckStateMachineContinuation) diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt index a1ccd141afd..59c4e082522 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/unreachableSuspendMarker.kt @@ -1,5 +1,4 @@ // FILE: inline.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // FULL_JDK @@ -7,7 +6,7 @@ // CHECK_STATE_MACHINE import helpers.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.intrinsics.* fun check() = true @@ -20,7 +19,7 @@ inline suspend fun inlineMe(): Unit { // FILE: box.kt // WITH_COROUTINES -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt b/compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt index 72f4110e2c1..e3c6e91aaee 100644 --- a/compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt +++ b/compiler/testData/codegen/boxInline/suspend/tryCatchReceiver.kt @@ -1,5 +1,4 @@ // FILE: inlined.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING @@ -38,8 +37,7 @@ private class SafeFlow(private val block: suspend FlowCollector.() -> Unit } // FILE: inlineSite.kt -// COMMON_COROUTINES_TEST -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* fun Flow.abc() = map { line -> diff --git a/compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt b/compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt index dde11dccd53..ce8cd56391d 100644 --- a/compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt +++ b/compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt @@ -1,5 +1,4 @@ // FILE: inlined.kt -// COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING @@ -17,9 +16,7 @@ suspend inline fun crossinlineMe(crossinline c: suspend (String) -> String, cros } // FILE: inlineSite.kt -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* import helpers.* fun builder(c: suspend () -> Unit) { @@ -75,4 +72,4 @@ fun box(): String { inlineSite() } return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/bytecodeListing/coroutines/coroutineContextIntrinsic.kt b/compiler/testData/codegen/bytecodeListing/coroutines/coroutineContextIntrinsic.kt index 3c406d64a77..6881043ce03 100644 --- a/compiler/testData/codegen/bytecodeListing/coroutines/coroutineContextIntrinsic.kt +++ b/compiler/testData/codegen/bytecodeListing/coroutines/coroutineContextIntrinsic.kt @@ -1,7 +1,6 @@ // WITH_RUNTIME -// COMMON_COROUTINES_TEST -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun suspendHere(ctx: CoroutineContext) = suspendCoroutineUninterceptedOrReturn { x -> if (x.context == ctx) x.resume("OK") else x.resume("FAIL") diff --git a/compiler/testData/codegen/bytecodeListing/coroutines/coroutineContextIntrinsic.txt b/compiler/testData/codegen/bytecodeListing/coroutines/coroutineContextIntrinsic.txt index 9df177c7292..1920ff7472b 100644 --- a/compiler/testData/codegen/bytecodeListing/coroutines/coroutineContextIntrinsic.txt +++ b/compiler/testData/codegen/bytecodeListing/coroutines/coroutineContextIntrinsic.txt @@ -1,22 +1,21 @@ @kotlin.Metadata +@kotlin.coroutines.jvm.internal.DebugMetadata final class CoroutineContextIntrinsicKt$notTailCall$1 { // source: 'coroutineContextIntrinsic.kt' - enclosing method CoroutineContextIntrinsicKt.notTailCall(Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; - synthetic field data: java.lang.Object - synthetic field exception: java.lang.Throwable + enclosing method CoroutineContextIntrinsicKt.notTailCall(Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + field label: int + synthetic field result: java.lang.Object inner (anonymous) class CoroutineContextIntrinsicKt$notTailCall$1 - method (p0: kotlin.coroutines.experimental.Continuation): void - public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object - synthetic final method getLabel(): int - synthetic final method setLabel(p0: int): void + method (p0: kotlin.coroutines.Continuation): void + public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object } @kotlin.Metadata public final class CoroutineContextIntrinsicKt { // source: 'coroutineContextIntrinsic.kt' inner (anonymous) class CoroutineContextIntrinsicKt$notTailCall$1 - public final static @org.jetbrains.annotations.Nullable method mustBeTailCall(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object - public final static @org.jetbrains.annotations.Nullable method notTailCall(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object - public final static @org.jetbrains.annotations.Nullable method retrieveCoroutineContext(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object - public final static @org.jetbrains.annotations.Nullable method suspendHere(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.CoroutineContext, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object + public final static @org.jetbrains.annotations.Nullable method mustBeTailCall(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object + public final static @org.jetbrains.annotations.Nullable method notTailCall(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object + public final static @org.jetbrains.annotations.Nullable method retrieveCoroutineContext(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object + public final static @org.jetbrains.annotations.Nullable method suspendHere(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.CoroutineContext, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object } diff --git a/compiler/testData/codegen/bytecodeListing/coroutines/coroutineContextIntrinsic_1_3.txt b/compiler/testData/codegen/bytecodeListing/coroutines/coroutineContextIntrinsic_1_3.txt deleted file mode 100644 index 1920ff7472b..00000000000 --- a/compiler/testData/codegen/bytecodeListing/coroutines/coroutineContextIntrinsic_1_3.txt +++ /dev/null @@ -1,21 +0,0 @@ -@kotlin.Metadata -@kotlin.coroutines.jvm.internal.DebugMetadata -final class CoroutineContextIntrinsicKt$notTailCall$1 { - // source: 'coroutineContextIntrinsic.kt' - enclosing method CoroutineContextIntrinsicKt.notTailCall(Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - field label: int - synthetic field result: java.lang.Object - inner (anonymous) class CoroutineContextIntrinsicKt$notTailCall$1 - method (p0: kotlin.coroutines.Continuation): void - public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object -} - -@kotlin.Metadata -public final class CoroutineContextIntrinsicKt { - // source: 'coroutineContextIntrinsic.kt' - inner (anonymous) class CoroutineContextIntrinsicKt$notTailCall$1 - public final static @org.jetbrains.annotations.Nullable method mustBeTailCall(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object - public final static @org.jetbrains.annotations.Nullable method notTailCall(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object - public final static @org.jetbrains.annotations.Nullable method retrieveCoroutineContext(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object - public final static @org.jetbrains.annotations.Nullable method suspendHere(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.CoroutineContext, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object -} diff --git a/compiler/testData/codegen/bytecodeListing/coroutines/coroutineFields.kt b/compiler/testData/codegen/bytecodeListing/coroutines/coroutineFields.kt index 537d3753aaf..9d2c933a6f7 100644 --- a/compiler/testData/codegen/bytecodeListing/coroutines/coroutineFields.kt +++ b/compiler/testData/codegen/bytecodeListing/coroutines/coroutineFields.kt @@ -1,8 +1,7 @@ // TODO: KT-37010 KT-37085 // WITH_RUNTIME -// COMMON_COROUTINES_TEST -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere() = suspendCoroutineUninterceptedOrReturn { x -> x.resume("OK") diff --git a/compiler/testData/codegen/bytecodeListing/coroutines/coroutineFields.txt b/compiler/testData/codegen/bytecodeListing/coroutines/coroutineFields.txt index 715278a3840..69e6211de5d 100644 --- a/compiler/testData/codegen/bytecodeListing/coroutines/coroutineFields.txt +++ b/compiler/testData/codegen/bytecodeListing/coroutines/coroutineFields.txt @@ -1,30 +1,28 @@ @kotlin.Metadata +@kotlin.coroutines.jvm.internal.DebugMetadata final class Controller$multipleSuspensions$1 { // source: 'coroutineFields.kt' - enclosing method Controller.multipleSuspensions(Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; + enclosing method Controller.multipleSuspensions(Lkotlin/coroutines/Continuation;)Ljava/lang/Object; field L$0: java.lang.Object - synthetic field data: java.lang.Object - synthetic field exception: java.lang.Throwable + field label: int + synthetic field result: java.lang.Object synthetic final field this$0: Controller inner (anonymous) class Controller$multipleSuspensions$1 - method (p0: Controller, p1: kotlin.coroutines.experimental.Continuation): void - public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object - synthetic final method getLabel(): int - synthetic final method setLabel(p0: int): void + method (p0: Controller, p1: kotlin.coroutines.Continuation): void + public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object } @kotlin.Metadata +@kotlin.coroutines.jvm.internal.DebugMetadata final class Controller$nonTailCall$1 { // source: 'coroutineFields.kt' - enclosing method Controller.nonTailCall(Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; - synthetic field data: java.lang.Object - synthetic field exception: java.lang.Throwable + enclosing method Controller.nonTailCall(Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + field label: int + synthetic field result: java.lang.Object synthetic final field this$0: Controller inner (anonymous) class Controller$nonTailCall$1 - method (p0: Controller, p1: kotlin.coroutines.experimental.Continuation): void - public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object - synthetic final method getLabel(): int - synthetic final method setLabel(p0: int): void + method (p0: Controller, p1: kotlin.coroutines.Continuation): void + public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object } @kotlin.Metadata @@ -33,12 +31,13 @@ public final class Controller { inner (anonymous) class Controller$multipleSuspensions$1 inner (anonymous) class Controller$nonTailCall$1 public method (): void - public final @org.jetbrains.annotations.Nullable method multipleSuspensions(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object - public final @org.jetbrains.annotations.Nullable method nonTailCall(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object - public final @org.jetbrains.annotations.Nullable method suspendHere(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object - public final @org.jetbrains.annotations.Nullable method tailCall(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object + public final @org.jetbrains.annotations.Nullable method multipleSuspensions(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object + public final @org.jetbrains.annotations.Nullable method nonTailCall(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object + public final @org.jetbrains.annotations.Nullable method suspendHere(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object + public final @org.jetbrains.annotations.Nullable method tailCall(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object } +@kotlin.coroutines.jvm.internal.DebugMetadata @kotlin.Metadata final class CoroutineFieldsKt$box$1 { // source: 'coroutineFields.kt' @@ -47,11 +46,12 @@ final class CoroutineFieldsKt$box$1 { field J$0: long private synthetic field L$0: java.lang.Object field L$1: java.lang.Object + field label: int inner (anonymous) class CoroutineFieldsKt$box$1 - method (p0: kotlin.jvm.internal.Ref$ObjectRef, p1: kotlin.coroutines.experimental.Continuation): void - public final @org.jetbrains.annotations.NotNull method create(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): kotlin.coroutines.experimental.Continuation - public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object + method (p0: kotlin.jvm.internal.Ref$ObjectRef, p1: kotlin.coroutines.Continuation): void + public final @org.jetbrains.annotations.NotNull method create(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): kotlin.coroutines.Continuation public final method invoke(p0: java.lang.Object, p1: java.lang.Object): java.lang.Object + public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object } @kotlin.Metadata diff --git a/compiler/testData/codegen/bytecodeListing/coroutines/coroutineFields_1_3.txt b/compiler/testData/codegen/bytecodeListing/coroutines/coroutineFields_1_3.txt deleted file mode 100644 index 69e6211de5d..00000000000 --- a/compiler/testData/codegen/bytecodeListing/coroutines/coroutineFields_1_3.txt +++ /dev/null @@ -1,63 +0,0 @@ -@kotlin.Metadata -@kotlin.coroutines.jvm.internal.DebugMetadata -final class Controller$multipleSuspensions$1 { - // source: 'coroutineFields.kt' - enclosing method Controller.multipleSuspensions(Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - field L$0: java.lang.Object - field label: int - synthetic field result: java.lang.Object - synthetic final field this$0: Controller - inner (anonymous) class Controller$multipleSuspensions$1 - method (p0: Controller, p1: kotlin.coroutines.Continuation): void - public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object -} - -@kotlin.Metadata -@kotlin.coroutines.jvm.internal.DebugMetadata -final class Controller$nonTailCall$1 { - // source: 'coroutineFields.kt' - enclosing method Controller.nonTailCall(Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - field label: int - synthetic field result: java.lang.Object - synthetic final field this$0: Controller - inner (anonymous) class Controller$nonTailCall$1 - method (p0: Controller, p1: kotlin.coroutines.Continuation): void - public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object -} - -@kotlin.Metadata -public final class Controller { - // source: 'coroutineFields.kt' - inner (anonymous) class Controller$multipleSuspensions$1 - inner (anonymous) class Controller$nonTailCall$1 - public method (): void - public final @org.jetbrains.annotations.Nullable method multipleSuspensions(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object - public final @org.jetbrains.annotations.Nullable method nonTailCall(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object - public final @org.jetbrains.annotations.Nullable method suspendHere(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object - public final @org.jetbrains.annotations.Nullable method tailCall(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object -} - -@kotlin.coroutines.jvm.internal.DebugMetadata -@kotlin.Metadata -final class CoroutineFieldsKt$box$1 { - // source: 'coroutineFields.kt' - enclosing method CoroutineFieldsKt.box()Ljava/lang/String; - synthetic final field $result: kotlin.jvm.internal.Ref$ObjectRef - field J$0: long - private synthetic field L$0: java.lang.Object - field L$1: java.lang.Object - field label: int - inner (anonymous) class CoroutineFieldsKt$box$1 - method (p0: kotlin.jvm.internal.Ref$ObjectRef, p1: kotlin.coroutines.Continuation): void - public final @org.jetbrains.annotations.NotNull method create(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): kotlin.coroutines.Continuation - public final method invoke(p0: java.lang.Object, p1: java.lang.Object): java.lang.Object - public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object -} - -@kotlin.Metadata -public final class CoroutineFieldsKt { - // source: 'coroutineFields.kt' - inner (anonymous) class CoroutineFieldsKt$box$1 - public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String - public final static method builder(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function2): void -} diff --git a/compiler/testData/codegen/bytecodeListing/coroutines/oomInReturnUnit.kt b/compiler/testData/codegen/bytecodeListing/coroutines/oomInReturnUnit.kt index 9fea21bb17a..079d67e03e1 100644 --- a/compiler/testData/codegen/bytecodeListing/coroutines/oomInReturnUnit.kt +++ b/compiler/testData/codegen/bytecodeListing/coroutines/oomInReturnUnit.kt @@ -1,7 +1,6 @@ // WITH_RUNTIME -// COMMON_COROUTINES_TEST -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun some() {} @@ -11,4 +10,4 @@ suspend fun test() { } finally { some() } -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/bytecodeListing/coroutines/oomInReturnUnit.txt b/compiler/testData/codegen/bytecodeListing/coroutines/oomInReturnUnit.txt index 0819ca162cb..7ad7a452a5e 100644 --- a/compiler/testData/codegen/bytecodeListing/coroutines/oomInReturnUnit.txt +++ b/compiler/testData/codegen/bytecodeListing/coroutines/oomInReturnUnit.txt @@ -1,21 +1,20 @@ @kotlin.Metadata +@kotlin.coroutines.jvm.internal.DebugMetadata final class OomInReturnUnitKt$test$1 { // source: 'oomInReturnUnit.kt' - enclosing method OomInReturnUnitKt.test(Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; + enclosing method OomInReturnUnitKt.test(Lkotlin/coroutines/Continuation;)Ljava/lang/Object; field L$0: java.lang.Object - synthetic field data: java.lang.Object - synthetic field exception: java.lang.Throwable + field label: int + synthetic field result: java.lang.Object inner (anonymous) class OomInReturnUnitKt$test$1 - method (p0: kotlin.coroutines.experimental.Continuation): void - public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object - synthetic final method getLabel(): int - synthetic final method setLabel(p0: int): void + method (p0: kotlin.coroutines.Continuation): void + public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object } @kotlin.Metadata public final class OomInReturnUnitKt { // source: 'oomInReturnUnit.kt' inner (anonymous) class OomInReturnUnitKt$test$1 - public final static @org.jetbrains.annotations.Nullable method some(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object - public final static @org.jetbrains.annotations.Nullable method test(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object + public final static @org.jetbrains.annotations.Nullable method some(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object + public final static @org.jetbrains.annotations.Nullable method test(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object } diff --git a/compiler/testData/codegen/bytecodeListing/coroutines/oomInReturnUnit_1_3.txt b/compiler/testData/codegen/bytecodeListing/coroutines/oomInReturnUnit_1_3.txt deleted file mode 100644 index 7ad7a452a5e..00000000000 --- a/compiler/testData/codegen/bytecodeListing/coroutines/oomInReturnUnit_1_3.txt +++ /dev/null @@ -1,20 +0,0 @@ -@kotlin.Metadata -@kotlin.coroutines.jvm.internal.DebugMetadata -final class OomInReturnUnitKt$test$1 { - // source: 'oomInReturnUnit.kt' - enclosing method OomInReturnUnitKt.test(Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - field L$0: java.lang.Object - field label: int - synthetic field result: java.lang.Object - inner (anonymous) class OomInReturnUnitKt$test$1 - method (p0: kotlin.coroutines.Continuation): void - public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object -} - -@kotlin.Metadata -public final class OomInReturnUnitKt { - // source: 'oomInReturnUnit.kt' - inner (anonymous) class OomInReturnUnitKt$test$1 - public final static @org.jetbrains.annotations.Nullable method some(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object - public final static @org.jetbrains.annotations.Nullable method test(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object -} diff --git a/compiler/testData/codegen/bytecodeListing/coroutines/privateAccessor.kt b/compiler/testData/codegen/bytecodeListing/coroutines/privateAccessor.kt index 35aae7d604c..364cb651ea6 100644 --- a/compiler/testData/codegen/bytecodeListing/coroutines/privateAccessor.kt +++ b/compiler/testData/codegen/bytecodeListing/coroutines/privateAccessor.kt @@ -1,9 +1,8 @@ // WITH_RUNTIME -// COMMON_COROUTINES_TEST -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* private fun foo() {} private suspend fun bar() = suspendCoroutine { foo() -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/bytecodeListing/coroutines/privateAccessor.txt b/compiler/testData/codegen/bytecodeListing/coroutines/privateAccessor.txt index 8465234304b..b7dd9b3abfc 100644 --- a/compiler/testData/codegen/bytecodeListing/coroutines/privateAccessor.txt +++ b/compiler/testData/codegen/bytecodeListing/coroutines/privateAccessor.txt @@ -1,6 +1,6 @@ @kotlin.Metadata public final class PrivateAccessorKt { // source: 'privateAccessor.kt' - synthetic final static method bar(p0: kotlin.coroutines.experimental.Continuation): java.lang.Object + synthetic final static method bar(p0: kotlin.coroutines.Continuation): java.lang.Object private final static method foo(): void } diff --git a/compiler/testData/codegen/bytecodeListing/coroutines/privateAccessor_1_3.txt b/compiler/testData/codegen/bytecodeListing/coroutines/privateAccessor_1_3.txt deleted file mode 100644 index b7dd9b3abfc..00000000000 --- a/compiler/testData/codegen/bytecodeListing/coroutines/privateAccessor_1_3.txt +++ /dev/null @@ -1,6 +0,0 @@ -@kotlin.Metadata -public final class PrivateAccessorKt { - // source: 'privateAccessor.kt' - synthetic final static method bar(p0: kotlin.coroutines.Continuation): java.lang.Object - private final static method foo(): void -} diff --git a/compiler/testData/codegen/bytecodeListing/coroutines/privateAccessor_ir.txt b/compiler/testData/codegen/bytecodeListing/coroutines/privateAccessor_ir.txt deleted file mode 100644 index b7dd9b3abfc..00000000000 --- a/compiler/testData/codegen/bytecodeListing/coroutines/privateAccessor_ir.txt +++ /dev/null @@ -1,6 +0,0 @@ -@kotlin.Metadata -public final class PrivateAccessorKt { - // source: 'privateAccessor.kt' - synthetic final static method bar(p0: kotlin.coroutines.Continuation): java.lang.Object - private final static method foo(): void -} diff --git a/compiler/testData/codegen/bytecodeListing/coroutines/suspendReifiedFun.kt b/compiler/testData/codegen/bytecodeListing/coroutines/suspendReifiedFun.kt index 89e4f357fe4..e5e5b5974af 100644 --- a/compiler/testData/codegen/bytecodeListing/coroutines/suspendReifiedFun.kt +++ b/compiler/testData/codegen/bytecodeListing/coroutines/suspendReifiedFun.kt @@ -1,4 +1,3 @@ -// COMMON_COROUTINES_TEST // WITH_RUNTIME open class AbstractStuff() { diff --git a/compiler/testData/codegen/bytecodeListing/coroutines/suspendReifiedFun.txt b/compiler/testData/codegen/bytecodeListing/coroutines/suspendReifiedFun.txt index 411031c39cf..99de7cee8da 100644 --- a/compiler/testData/codegen/bytecodeListing/coroutines/suspendReifiedFun.txt +++ b/compiler/testData/codegen/bytecodeListing/coroutines/suspendReifiedFun.txt @@ -2,12 +2,12 @@ public class AbstractStuff { // source: 'suspendReifiedFun.kt' public method (): void - public synthetic final method hello(p0: java.lang.Object, p1: kotlin.coroutines.experimental.Continuation): java.lang.Object + public synthetic final method hello(p0: java.lang.Object, p1: kotlin.coroutines.Continuation): java.lang.Object } @kotlin.Metadata public final class Stuff { // source: 'suspendReifiedFun.kt' public method (): void - public final @org.jetbrains.annotations.Nullable method foo(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object + public final @org.jetbrains.annotations.Nullable method foo(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object } diff --git a/compiler/testData/codegen/bytecodeListing/coroutines/suspendReifiedFun_1_3.txt b/compiler/testData/codegen/bytecodeListing/coroutines/suspendReifiedFun_1_3.txt deleted file mode 100644 index 99de7cee8da..00000000000 --- a/compiler/testData/codegen/bytecodeListing/coroutines/suspendReifiedFun_1_3.txt +++ /dev/null @@ -1,13 +0,0 @@ -@kotlin.Metadata -public class AbstractStuff { - // source: 'suspendReifiedFun.kt' - public method (): void - public synthetic final method hello(p0: java.lang.Object, p1: kotlin.coroutines.Continuation): java.lang.Object -} - -@kotlin.Metadata -public final class Stuff { - // source: 'suspendReifiedFun.kt' - public method (): void - public final @org.jetbrains.annotations.Nullable method foo(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object -} diff --git a/compiler/testData/codegen/bytecodeListing/coroutines/tcoContinuation.kt b/compiler/testData/codegen/bytecodeListing/coroutines/tcoContinuation.kt index cb95e9e91dd..5ccf857c790 100644 --- a/compiler/testData/codegen/bytecodeListing/coroutines/tcoContinuation.kt +++ b/compiler/testData/codegen/bytecodeListing/coroutines/tcoContinuation.kt @@ -1,5 +1,4 @@ // TODO: KT-36987 KT-37093 -// COMMON_COROUTINES_TEST // WITH_RUNTIME // There should be no $foo$$inlined$map$1$1 class diff --git a/compiler/testData/codegen/bytecodeListing/coroutines/tcoContinuation.txt b/compiler/testData/codegen/bytecodeListing/coroutines/tcoContinuation.txt index 56111dbc299..11ccae7c8e5 100644 --- a/compiler/testData/codegen/bytecodeListing/coroutines/tcoContinuation.txt +++ b/compiler/testData/codegen/bytecodeListing/coroutines/tcoContinuation.txt @@ -1,55 +1,51 @@ @kotlin.Metadata public interface Flow { // source: 'tcoContinuation.kt' - public abstract @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object + public abstract @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object } @kotlin.Metadata public interface FlowCollector { // source: 'tcoContinuation.kt' - public abstract @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object + public abstract @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object } @kotlin.Metadata public final class TcoContinuationKt$collect$2$emit$1 { // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt$collect$2.emit(Ljava/lang/Object;Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; - synthetic field data: java.lang.Object - synthetic field exception: java.lang.Throwable + enclosing method TcoContinuationKt$collect$2.emit(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + field label: int + synthetic field result: java.lang.Object synthetic final field this$0: TcoContinuationKt$collect$2 inner (anonymous) class TcoContinuationKt$collect$2 inner (anonymous) class TcoContinuationKt$collect$2$emit$1 - public method (p0: TcoContinuationKt$collect$2, p1: kotlin.coroutines.experimental.Continuation): void - public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object - synthetic final method getLabel(): int - synthetic final method setLabel(p0: int): void + public method (p0: TcoContinuationKt$collect$2, p1: kotlin.coroutines.Continuation): void + public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object } @kotlin.Metadata public final class TcoContinuationKt$collect$2 { // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt.collect(LFlow;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; + enclosing method TcoContinuationKt.collect(LFlow;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; synthetic final field $action: kotlin.jvm.functions.Function2 inner (anonymous) class TcoContinuationKt$collect$2 inner (anonymous) class TcoContinuationKt$collect$2$emit$1 public method (p0: kotlin.jvm.functions.Function2): void - public @org.jetbrains.annotations.Nullable method emit$$forInline(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object - public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method emit$$forInline(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object } @kotlin.Metadata public final class TcoContinuationKt$flow$1$collect$1 { // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt$flow$1.collect(LFlowCollector;Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; - synthetic field data: java.lang.Object - synthetic field exception: java.lang.Throwable + enclosing method TcoContinuationKt$flow$1.collect(LFlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + field label: int + synthetic field result: java.lang.Object synthetic final field this$0: TcoContinuationKt$flow$1 inner (anonymous) class TcoContinuationKt$flow$1 inner (anonymous) class TcoContinuationKt$flow$1$collect$1 - public method (p0: TcoContinuationKt$flow$1, p1: kotlin.coroutines.experimental.Continuation): void - public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object - synthetic final method getLabel(): int - synthetic final method setLabel(p0: int): void + public method (p0: TcoContinuationKt$flow$1, p1: kotlin.coroutines.Continuation): void + public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object } @kotlin.Metadata @@ -60,105 +56,101 @@ public final class TcoContinuationKt$flow$1 { inner (anonymous) class TcoContinuationKt$flow$1 inner (anonymous) class TcoContinuationKt$flow$1$collect$1 public method (p0: kotlin.jvm.functions.Function2): void - public @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object - public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object } @kotlin.Metadata public final class TcoContinuationKt$foo$$inlined$collect$1 { // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt.foo(Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; + enclosing method TcoContinuationKt.foo(Lkotlin/coroutines/Continuation;)Ljava/lang/Object; inner (anonymous) class TcoContinuationKt$foo$$inlined$collect$1 public method (): void - public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object } @kotlin.Metadata public final class TcoContinuationKt$foo$$inlined$flow$1 { // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt.foo(Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; + enclosing method TcoContinuationKt.foo(Lkotlin/coroutines/Continuation;)Ljava/lang/Object; inner (anonymous) class TcoContinuationKt$foo$$inlined$flow$1 public method (): void - public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object } @kotlin.Metadata +@kotlin.coroutines.jvm.internal.DebugMetadata public final class TcoContinuationKt$foo$$inlined$map$1$2$1 { - enclosing method TcoContinuationKt$foo$$inlined$map$1$2.emit(Ljava/lang/Object;Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; + enclosing method TcoContinuationKt$foo$$inlined$map$1$2.emit(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; field L$0: java.lang.Object - synthetic field data: java.lang.Object - synthetic field exception: java.lang.Throwable + field label: int + synthetic field result: java.lang.Object synthetic final field this$0: TcoContinuationKt$foo$$inlined$map$1$2 inner (anonymous) class TcoContinuationKt$foo$$inlined$map$1$2 inner (anonymous) class TcoContinuationKt$foo$$inlined$map$1$2$1 - public method (p0: TcoContinuationKt$foo$$inlined$map$1$2, p1: kotlin.coroutines.experimental.Continuation): void - public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object - synthetic final method getLabel(): int - synthetic final method setLabel(p0: int): void + public method (p0: TcoContinuationKt$foo$$inlined$map$1$2, p1: kotlin.coroutines.Continuation): void + public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object } @kotlin.Metadata public final class TcoContinuationKt$foo$$inlined$map$1$2 { // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt$foo$$inlined$map$1.collect(LFlowCollector;Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; + enclosing method TcoContinuationKt$foo$$inlined$map$1.collect(LFlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; synthetic final field $this_flow$inlined: FlowCollector synthetic final field this$0: TcoContinuationKt$foo$$inlined$map$1 inner (anonymous) class TcoContinuationKt$foo$$inlined$map$1$2 inner (anonymous) class TcoContinuationKt$foo$$inlined$map$1$2$1 public method (p0: FlowCollector, p1: TcoContinuationKt$foo$$inlined$map$1): void - public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object } @kotlin.Metadata public final class TcoContinuationKt$foo$$inlined$map$1 { // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt.foo(Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; + enclosing method TcoContinuationKt.foo(Lkotlin/coroutines/Continuation;)Ljava/lang/Object; synthetic final field $this_transform$inlined: Flow inner (anonymous) class TcoContinuationKt$foo$$inlined$map$1 public method (p0: Flow): void - public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object } @kotlin.Metadata public final class TcoContinuationKt$map$$inlined$transform$1$1 { - enclosing method TcoContinuationKt$map$$inlined$transform$1.collect(LFlowCollector;Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; - synthetic field data: java.lang.Object - synthetic field exception: java.lang.Throwable + enclosing method TcoContinuationKt$map$$inlined$transform$1.collect(LFlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + field label: int + synthetic field result: java.lang.Object synthetic final field this$0: TcoContinuationKt$map$$inlined$transform$1 inner (anonymous) class TcoContinuationKt$map$$inlined$transform$1 inner (anonymous) class TcoContinuationKt$map$$inlined$transform$1$1 - public method (p0: TcoContinuationKt$map$$inlined$transform$1, p1: kotlin.coroutines.experimental.Continuation): void - public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object - synthetic final method getLabel(): int - synthetic final method setLabel(p0: int): void + public method (p0: TcoContinuationKt$map$$inlined$transform$1, p1: kotlin.coroutines.Continuation): void + public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object } @kotlin.Metadata +@kotlin.coroutines.jvm.internal.DebugMetadata public final class TcoContinuationKt$map$$inlined$transform$1$2$1 { - enclosing method TcoContinuationKt$map$$inlined$transform$1$2.emit(Ljava/lang/Object;Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; + enclosing method TcoContinuationKt$map$$inlined$transform$1$2.emit(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; field L$0: java.lang.Object - synthetic field data: java.lang.Object - synthetic field exception: java.lang.Throwable + field label: int + synthetic field result: java.lang.Object synthetic final field this$0: TcoContinuationKt$map$$inlined$transform$1$2 inner (anonymous) class TcoContinuationKt$map$$inlined$transform$1$2 inner (anonymous) class TcoContinuationKt$map$$inlined$transform$1$2$1 - public method (p0: TcoContinuationKt$map$$inlined$transform$1$2, p1: kotlin.coroutines.experimental.Continuation): void - public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object - synthetic final method getLabel(): int - synthetic final method setLabel(p0: int): void + public method (p0: TcoContinuationKt$map$$inlined$transform$1$2, p1: kotlin.coroutines.Continuation): void + public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object } @kotlin.Metadata public final class TcoContinuationKt$map$$inlined$transform$1$2 { // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt$map$$inlined$transform$1.collect(LFlowCollector;Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; + enclosing method TcoContinuationKt$map$$inlined$transform$1.collect(LFlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; synthetic final field $this_flow$inlined: FlowCollector synthetic final field this$0: TcoContinuationKt$map$$inlined$transform$1 inner (anonymous) class TcoContinuationKt$map$$inlined$transform$1$2 inner (anonymous) class TcoContinuationKt$map$$inlined$transform$1$2$1 public method (p0: FlowCollector, p1: TcoContinuationKt$map$$inlined$transform$1): void - public @org.jetbrains.annotations.Nullable method emit$$forInline(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object - public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method emit$$forInline(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object } @kotlin.Metadata @@ -170,50 +162,47 @@ public final class TcoContinuationKt$map$$inlined$transform$1 { inner (anonymous) class TcoContinuationKt$map$$inlined$transform$1 inner (anonymous) class TcoContinuationKt$map$$inlined$transform$1$1 public method (p0: Flow, p1: kotlin.jvm.functions.Function2): void - public @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object - public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object } @kotlin.Metadata public final class TcoContinuationKt$map$$inlined$transform$2$1 { - enclosing method TcoContinuationKt$map$$inlined$transform$2.collect(LFlowCollector;Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; - synthetic field data: java.lang.Object - synthetic field exception: java.lang.Throwable + enclosing method TcoContinuationKt$map$$inlined$transform$2.collect(LFlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + field label: int + synthetic field result: java.lang.Object synthetic final field this$0: TcoContinuationKt$map$$inlined$transform$2 inner (anonymous) class TcoContinuationKt$map$$inlined$transform$2 inner (anonymous) class TcoContinuationKt$map$$inlined$transform$2$1 - public method (p0: TcoContinuationKt$map$$inlined$transform$2, p1: kotlin.coroutines.experimental.Continuation): void - public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object - synthetic final method getLabel(): int - synthetic final method setLabel(p0: int): void + public method (p0: TcoContinuationKt$map$$inlined$transform$2, p1: kotlin.coroutines.Continuation): void + public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object } @kotlin.Metadata +@kotlin.coroutines.jvm.internal.DebugMetadata public final class TcoContinuationKt$map$$inlined$transform$2$2$1 { - enclosing method TcoContinuationKt$map$$inlined$transform$2$2.emit(Ljava/lang/Object;Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; + enclosing method TcoContinuationKt$map$$inlined$transform$2$2.emit(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; field L$0: java.lang.Object - synthetic field data: java.lang.Object - synthetic field exception: java.lang.Throwable + field label: int + synthetic field result: java.lang.Object synthetic final field this$0: TcoContinuationKt$map$$inlined$transform$2$2 inner (anonymous) class TcoContinuationKt$map$$inlined$transform$2$2 inner (anonymous) class TcoContinuationKt$map$$inlined$transform$2$2$1 - public method (p0: TcoContinuationKt$map$$inlined$transform$2$2, p1: kotlin.coroutines.experimental.Continuation): void - public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object - synthetic final method getLabel(): int - synthetic final method setLabel(p0: int): void + public method (p0: TcoContinuationKt$map$$inlined$transform$2$2, p1: kotlin.coroutines.Continuation): void + public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object } @kotlin.Metadata public final class TcoContinuationKt$map$$inlined$transform$2$2 { // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt$map$$inlined$transform$2.collect(LFlowCollector;Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; + enclosing method TcoContinuationKt$map$$inlined$transform$2.collect(LFlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; synthetic final field $this_flow$inlined: FlowCollector synthetic final field this$0: TcoContinuationKt$map$$inlined$transform$2 inner (anonymous) class TcoContinuationKt$map$$inlined$transform$2$2 inner (anonymous) class TcoContinuationKt$map$$inlined$transform$2$2$1 public method (p0: FlowCollector, p1: TcoContinuationKt$map$$inlined$transform$2): void - public @org.jetbrains.annotations.Nullable method emit$$forInline(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object - public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method emit$$forInline(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object } @kotlin.Metadata @@ -225,49 +214,45 @@ public final class TcoContinuationKt$map$$inlined$transform$2 { inner (anonymous) class TcoContinuationKt$map$$inlined$transform$2 inner (anonymous) class TcoContinuationKt$map$$inlined$transform$2$1 public method (p0: Flow, p1: kotlin.jvm.functions.Function2): void - public @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object - public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object } @kotlin.Metadata public final class TcoContinuationKt$transform$$inlined$flow$1$1 { - enclosing method TcoContinuationKt$transform$$inlined$flow$1.collect(LFlowCollector;Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; - synthetic field data: java.lang.Object - synthetic field exception: java.lang.Throwable + enclosing method TcoContinuationKt$transform$$inlined$flow$1.collect(LFlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + field label: int + synthetic field result: java.lang.Object synthetic final field this$0: TcoContinuationKt$transform$$inlined$flow$1 inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$1 inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$1$1 - public method (p0: TcoContinuationKt$transform$$inlined$flow$1, p1: kotlin.coroutines.experimental.Continuation): void - public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object - synthetic final method getLabel(): int - synthetic final method setLabel(p0: int): void + public method (p0: TcoContinuationKt$transform$$inlined$flow$1, p1: kotlin.coroutines.Continuation): void + public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object } @kotlin.Metadata public final class TcoContinuationKt$transform$$inlined$flow$1$lambda$1$1 { - enclosing method TcoContinuationKt$transform$$inlined$flow$1$lambda$1.emit(Ljava/lang/Object;Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; - synthetic field data: java.lang.Object - synthetic field exception: java.lang.Throwable + enclosing method TcoContinuationKt$transform$$inlined$flow$1$lambda$1.emit(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + field label: int + synthetic field result: java.lang.Object synthetic final field this$0: TcoContinuationKt$transform$$inlined$flow$1$lambda$1 inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$1$lambda$1 inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$1$lambda$1$1 - public method (p0: TcoContinuationKt$transform$$inlined$flow$1$lambda$1, p1: kotlin.coroutines.experimental.Continuation): void - public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object - synthetic final method getLabel(): int - synthetic final method setLabel(p0: int): void + public method (p0: TcoContinuationKt$transform$$inlined$flow$1$lambda$1, p1: kotlin.coroutines.Continuation): void + public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object } @kotlin.Metadata public final class TcoContinuationKt$transform$$inlined$flow$1$lambda$1 { // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt$transform$$inlined$flow$1.collect(LFlowCollector;Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; + enclosing method TcoContinuationKt$transform$$inlined$flow$1.collect(LFlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; synthetic final field $this_flow$inlined: FlowCollector synthetic final field this$0: TcoContinuationKt$transform$$inlined$flow$1 inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$1$lambda$1 inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$1$lambda$1$1 public method (p0: FlowCollector, p1: TcoContinuationKt$transform$$inlined$flow$1): void - public @org.jetbrains.annotations.Nullable method emit$$forInline(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object - public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method emit$$forInline(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object } @kotlin.Metadata @@ -279,49 +264,45 @@ public final class TcoContinuationKt$transform$$inlined$flow$1 { inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$1 inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$1$1 public method (p0: Flow, p1: kotlin.jvm.functions.Function3): void - public @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object - public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object } @kotlin.Metadata public final class TcoContinuationKt$transform$$inlined$flow$2$1 { - enclosing method TcoContinuationKt$transform$$inlined$flow$2.collect(LFlowCollector;Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; - synthetic field data: java.lang.Object - synthetic field exception: java.lang.Throwable + enclosing method TcoContinuationKt$transform$$inlined$flow$2.collect(LFlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + field label: int + synthetic field result: java.lang.Object synthetic final field this$0: TcoContinuationKt$transform$$inlined$flow$2 inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$2 inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$2$1 - public method (p0: TcoContinuationKt$transform$$inlined$flow$2, p1: kotlin.coroutines.experimental.Continuation): void - public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object - synthetic final method getLabel(): int - synthetic final method setLabel(p0: int): void + public method (p0: TcoContinuationKt$transform$$inlined$flow$2, p1: kotlin.coroutines.Continuation): void + public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object } @kotlin.Metadata public final class TcoContinuationKt$transform$$inlined$flow$2$lambda$1$1 { - enclosing method TcoContinuationKt$transform$$inlined$flow$2$lambda$1.emit(Ljava/lang/Object;Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; - synthetic field data: java.lang.Object - synthetic field exception: java.lang.Throwable + enclosing method TcoContinuationKt$transform$$inlined$flow$2$lambda$1.emit(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + field label: int + synthetic field result: java.lang.Object synthetic final field this$0: TcoContinuationKt$transform$$inlined$flow$2$lambda$1 inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$2$lambda$1 inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$2$lambda$1$1 - public method (p0: TcoContinuationKt$transform$$inlined$flow$2$lambda$1, p1: kotlin.coroutines.experimental.Continuation): void - public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object - synthetic final method getLabel(): int - synthetic final method setLabel(p0: int): void + public method (p0: TcoContinuationKt$transform$$inlined$flow$2$lambda$1, p1: kotlin.coroutines.Continuation): void + public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object } @kotlin.Metadata public final class TcoContinuationKt$transform$$inlined$flow$2$lambda$1 { // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt$transform$$inlined$flow$2.collect(LFlowCollector;Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; + enclosing method TcoContinuationKt$transform$$inlined$flow$2.collect(LFlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; synthetic final field $this_flow$inlined: FlowCollector synthetic final field this$0: TcoContinuationKt$transform$$inlined$flow$2 inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$2$lambda$1 inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$2$lambda$1$1 public method (p0: FlowCollector, p1: TcoContinuationKt$transform$$inlined$flow$2): void - public @org.jetbrains.annotations.Nullable method emit$$forInline(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object - public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method emit$$forInline(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object } @kotlin.Metadata @@ -333,49 +314,45 @@ public final class TcoContinuationKt$transform$$inlined$flow$2 { inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$2 inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$2$1 public method (p0: Flow, p1: kotlin.jvm.functions.Function3): void - public @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object - public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object } @kotlin.Metadata public final class TcoContinuationKt$transform$$inlined$flow$3$1 { - enclosing method TcoContinuationKt$transform$$inlined$flow$3.collect(LFlowCollector;Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; - synthetic field data: java.lang.Object - synthetic field exception: java.lang.Throwable + enclosing method TcoContinuationKt$transform$$inlined$flow$3.collect(LFlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + field label: int + synthetic field result: java.lang.Object synthetic final field this$0: TcoContinuationKt$transform$$inlined$flow$3 inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$3 inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$3$1 - public method (p0: TcoContinuationKt$transform$$inlined$flow$3, p1: kotlin.coroutines.experimental.Continuation): void - public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object - synthetic final method getLabel(): int - synthetic final method setLabel(p0: int): void + public method (p0: TcoContinuationKt$transform$$inlined$flow$3, p1: kotlin.coroutines.Continuation): void + public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object } @kotlin.Metadata public final class TcoContinuationKt$transform$$inlined$flow$3$lambda$1$1 { - enclosing method TcoContinuationKt$transform$$inlined$flow$3$lambda$1.emit(Ljava/lang/Object;Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; - synthetic field data: java.lang.Object - synthetic field exception: java.lang.Throwable + enclosing method TcoContinuationKt$transform$$inlined$flow$3$lambda$1.emit(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + field label: int + synthetic field result: java.lang.Object synthetic final field this$0: TcoContinuationKt$transform$$inlined$flow$3$lambda$1 inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$3$lambda$1 inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$3$lambda$1$1 - public method (p0: TcoContinuationKt$transform$$inlined$flow$3$lambda$1, p1: kotlin.coroutines.experimental.Continuation): void - public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object - synthetic final method getLabel(): int - synthetic final method setLabel(p0: int): void + public method (p0: TcoContinuationKt$transform$$inlined$flow$3$lambda$1, p1: kotlin.coroutines.Continuation): void + public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object } @kotlin.Metadata public final class TcoContinuationKt$transform$$inlined$flow$3$lambda$1 { // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt$transform$$inlined$flow$3.collect(LFlowCollector;Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object; + enclosing method TcoContinuationKt$transform$$inlined$flow$3.collect(LFlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; synthetic final field $this_flow$inlined: FlowCollector synthetic final field this$0: TcoContinuationKt$transform$$inlined$flow$3 inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$3$lambda$1 inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$3$lambda$1$1 public method (p0: FlowCollector, p1: TcoContinuationKt$transform$$inlined$flow$3): void - public @org.jetbrains.annotations.Nullable method emit$$forInline(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object - public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method emit$$forInline(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object } @kotlin.Metadata @@ -387,8 +364,8 @@ public final class TcoContinuationKt$transform$$inlined$flow$3 { inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$3 inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$3$1 public method (p0: Flow, p1: kotlin.jvm.functions.Function3): void - public @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object - public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object } @kotlin.Metadata @@ -396,10 +373,10 @@ public final class TcoContinuationKt { // source: 'tcoContinuation.kt' inner (anonymous) class TcoContinuationKt$collect$2 inner (anonymous) class TcoContinuationKt$flow$1 - private final static @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: Flow, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function2, @org.jetbrains.annotations.NotNull p2: kotlin.coroutines.experimental.Continuation): java.lang.Object - public final static @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: Flow, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function2, @org.jetbrains.annotations.NotNull p2: kotlin.coroutines.experimental.Continuation): java.lang.Object + private final static @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: Flow, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function2, @org.jetbrains.annotations.NotNull p2: kotlin.coroutines.Continuation): java.lang.Object + public final static @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: Flow, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function2, @org.jetbrains.annotations.NotNull p2: kotlin.coroutines.Continuation): java.lang.Object public final static @org.jetbrains.annotations.NotNull method flow(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function2): Flow - public final static @org.jetbrains.annotations.Nullable method foo(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object + public final static @org.jetbrains.annotations.Nullable method foo(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object public final static @org.jetbrains.annotations.NotNull method map(@org.jetbrains.annotations.NotNull p0: Flow, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function2): Flow public final static @org.jetbrains.annotations.NotNull method transform(@org.jetbrains.annotations.NotNull p0: Flow, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function3): Flow } diff --git a/compiler/testData/codegen/bytecodeListing/coroutines/tcoContinuation_1_3.txt b/compiler/testData/codegen/bytecodeListing/coroutines/tcoContinuation_1_3.txt deleted file mode 100644 index 11ccae7c8e5..00000000000 --- a/compiler/testData/codegen/bytecodeListing/coroutines/tcoContinuation_1_3.txt +++ /dev/null @@ -1,382 +0,0 @@ -@kotlin.Metadata -public interface Flow { - // source: 'tcoContinuation.kt' - public abstract @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object -} - -@kotlin.Metadata -public interface FlowCollector { - // source: 'tcoContinuation.kt' - public abstract @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$collect$2$emit$1 { - // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt$collect$2.emit(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - field label: int - synthetic field result: java.lang.Object - synthetic final field this$0: TcoContinuationKt$collect$2 - inner (anonymous) class TcoContinuationKt$collect$2 - inner (anonymous) class TcoContinuationKt$collect$2$emit$1 - public method (p0: TcoContinuationKt$collect$2, p1: kotlin.coroutines.Continuation): void - public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$collect$2 { - // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt.collect(LFlow;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - synthetic final field $action: kotlin.jvm.functions.Function2 - inner (anonymous) class TcoContinuationKt$collect$2 - inner (anonymous) class TcoContinuationKt$collect$2$emit$1 - public method (p0: kotlin.jvm.functions.Function2): void - public @org.jetbrains.annotations.Nullable method emit$$forInline(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object - public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$flow$1$collect$1 { - // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt$flow$1.collect(LFlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - field label: int - synthetic field result: java.lang.Object - synthetic final field this$0: TcoContinuationKt$flow$1 - inner (anonymous) class TcoContinuationKt$flow$1 - inner (anonymous) class TcoContinuationKt$flow$1$collect$1 - public method (p0: TcoContinuationKt$flow$1, p1: kotlin.coroutines.Continuation): void - public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$flow$1 { - // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt.flow(Lkotlin/jvm/functions/Function2;)LFlow; - synthetic final field $block: kotlin.jvm.functions.Function2 - inner (anonymous) class TcoContinuationKt$flow$1 - inner (anonymous) class TcoContinuationKt$flow$1$collect$1 - public method (p0: kotlin.jvm.functions.Function2): void - public @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object - public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$foo$$inlined$collect$1 { - // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt.foo(Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - inner (anonymous) class TcoContinuationKt$foo$$inlined$collect$1 - public method (): void - public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$foo$$inlined$flow$1 { - // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt.foo(Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - inner (anonymous) class TcoContinuationKt$foo$$inlined$flow$1 - public method (): void - public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object -} - -@kotlin.Metadata -@kotlin.coroutines.jvm.internal.DebugMetadata -public final class TcoContinuationKt$foo$$inlined$map$1$2$1 { - enclosing method TcoContinuationKt$foo$$inlined$map$1$2.emit(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - field L$0: java.lang.Object - field label: int - synthetic field result: java.lang.Object - synthetic final field this$0: TcoContinuationKt$foo$$inlined$map$1$2 - inner (anonymous) class TcoContinuationKt$foo$$inlined$map$1$2 - inner (anonymous) class TcoContinuationKt$foo$$inlined$map$1$2$1 - public method (p0: TcoContinuationKt$foo$$inlined$map$1$2, p1: kotlin.coroutines.Continuation): void - public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$foo$$inlined$map$1$2 { - // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt$foo$$inlined$map$1.collect(LFlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - synthetic final field $this_flow$inlined: FlowCollector - synthetic final field this$0: TcoContinuationKt$foo$$inlined$map$1 - inner (anonymous) class TcoContinuationKt$foo$$inlined$map$1$2 - inner (anonymous) class TcoContinuationKt$foo$$inlined$map$1$2$1 - public method (p0: FlowCollector, p1: TcoContinuationKt$foo$$inlined$map$1): void - public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$foo$$inlined$map$1 { - // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt.foo(Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - synthetic final field $this_transform$inlined: Flow - inner (anonymous) class TcoContinuationKt$foo$$inlined$map$1 - public method (p0: Flow): void - public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$map$$inlined$transform$1$1 { - enclosing method TcoContinuationKt$map$$inlined$transform$1.collect(LFlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - field label: int - synthetic field result: java.lang.Object - synthetic final field this$0: TcoContinuationKt$map$$inlined$transform$1 - inner (anonymous) class TcoContinuationKt$map$$inlined$transform$1 - inner (anonymous) class TcoContinuationKt$map$$inlined$transform$1$1 - public method (p0: TcoContinuationKt$map$$inlined$transform$1, p1: kotlin.coroutines.Continuation): void - public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object -} - -@kotlin.Metadata -@kotlin.coroutines.jvm.internal.DebugMetadata -public final class TcoContinuationKt$map$$inlined$transform$1$2$1 { - enclosing method TcoContinuationKt$map$$inlined$transform$1$2.emit(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - field L$0: java.lang.Object - field label: int - synthetic field result: java.lang.Object - synthetic final field this$0: TcoContinuationKt$map$$inlined$transform$1$2 - inner (anonymous) class TcoContinuationKt$map$$inlined$transform$1$2 - inner (anonymous) class TcoContinuationKt$map$$inlined$transform$1$2$1 - public method (p0: TcoContinuationKt$map$$inlined$transform$1$2, p1: kotlin.coroutines.Continuation): void - public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$map$$inlined$transform$1$2 { - // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt$map$$inlined$transform$1.collect(LFlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - synthetic final field $this_flow$inlined: FlowCollector - synthetic final field this$0: TcoContinuationKt$map$$inlined$transform$1 - inner (anonymous) class TcoContinuationKt$map$$inlined$transform$1$2 - inner (anonymous) class TcoContinuationKt$map$$inlined$transform$1$2$1 - public method (p0: FlowCollector, p1: TcoContinuationKt$map$$inlined$transform$1): void - public @org.jetbrains.annotations.Nullable method emit$$forInline(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object - public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$map$$inlined$transform$1 { - // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt.map(LFlow;Lkotlin/jvm/functions/Function2;)LFlow; - synthetic final field $this_transform$inlined: Flow - synthetic final field $transformer$inlined$1: kotlin.jvm.functions.Function2 - inner (anonymous) class TcoContinuationKt$map$$inlined$transform$1 - inner (anonymous) class TcoContinuationKt$map$$inlined$transform$1$1 - public method (p0: Flow, p1: kotlin.jvm.functions.Function2): void - public @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object - public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$map$$inlined$transform$2$1 { - enclosing method TcoContinuationKt$map$$inlined$transform$2.collect(LFlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - field label: int - synthetic field result: java.lang.Object - synthetic final field this$0: TcoContinuationKt$map$$inlined$transform$2 - inner (anonymous) class TcoContinuationKt$map$$inlined$transform$2 - inner (anonymous) class TcoContinuationKt$map$$inlined$transform$2$1 - public method (p0: TcoContinuationKt$map$$inlined$transform$2, p1: kotlin.coroutines.Continuation): void - public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object -} - -@kotlin.Metadata -@kotlin.coroutines.jvm.internal.DebugMetadata -public final class TcoContinuationKt$map$$inlined$transform$2$2$1 { - enclosing method TcoContinuationKt$map$$inlined$transform$2$2.emit(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - field L$0: java.lang.Object - field label: int - synthetic field result: java.lang.Object - synthetic final field this$0: TcoContinuationKt$map$$inlined$transform$2$2 - inner (anonymous) class TcoContinuationKt$map$$inlined$transform$2$2 - inner (anonymous) class TcoContinuationKt$map$$inlined$transform$2$2$1 - public method (p0: TcoContinuationKt$map$$inlined$transform$2$2, p1: kotlin.coroutines.Continuation): void - public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$map$$inlined$transform$2$2 { - // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt$map$$inlined$transform$2.collect(LFlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - synthetic final field $this_flow$inlined: FlowCollector - synthetic final field this$0: TcoContinuationKt$map$$inlined$transform$2 - inner (anonymous) class TcoContinuationKt$map$$inlined$transform$2$2 - inner (anonymous) class TcoContinuationKt$map$$inlined$transform$2$2$1 - public method (p0: FlowCollector, p1: TcoContinuationKt$map$$inlined$transform$2): void - public @org.jetbrains.annotations.Nullable method emit$$forInline(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object - public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$map$$inlined$transform$2 { - // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt.map(LFlow;Lkotlin/jvm/functions/Function2;)LFlow; - synthetic final field $this_transform$inlined: Flow - synthetic final field $transformer$inlined$1: kotlin.jvm.functions.Function2 - inner (anonymous) class TcoContinuationKt$map$$inlined$transform$2 - inner (anonymous) class TcoContinuationKt$map$$inlined$transform$2$1 - public method (p0: Flow, p1: kotlin.jvm.functions.Function2): void - public @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object - public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$transform$$inlined$flow$1$1 { - enclosing method TcoContinuationKt$transform$$inlined$flow$1.collect(LFlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - field label: int - synthetic field result: java.lang.Object - synthetic final field this$0: TcoContinuationKt$transform$$inlined$flow$1 - inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$1 - inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$1$1 - public method (p0: TcoContinuationKt$transform$$inlined$flow$1, p1: kotlin.coroutines.Continuation): void - public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$transform$$inlined$flow$1$lambda$1$1 { - enclosing method TcoContinuationKt$transform$$inlined$flow$1$lambda$1.emit(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - field label: int - synthetic field result: java.lang.Object - synthetic final field this$0: TcoContinuationKt$transform$$inlined$flow$1$lambda$1 - inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$1$lambda$1 - inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$1$lambda$1$1 - public method (p0: TcoContinuationKt$transform$$inlined$flow$1$lambda$1, p1: kotlin.coroutines.Continuation): void - public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$transform$$inlined$flow$1$lambda$1 { - // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt$transform$$inlined$flow$1.collect(LFlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - synthetic final field $this_flow$inlined: FlowCollector - synthetic final field this$0: TcoContinuationKt$transform$$inlined$flow$1 - inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$1$lambda$1 - inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$1$lambda$1$1 - public method (p0: FlowCollector, p1: TcoContinuationKt$transform$$inlined$flow$1): void - public @org.jetbrains.annotations.Nullable method emit$$forInline(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object - public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$transform$$inlined$flow$1 { - // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt.transform(LFlow;Lkotlin/jvm/functions/Function3;)LFlow; - synthetic final field $this_transform$inlined: Flow - synthetic final field $transformer$inlined: kotlin.jvm.functions.Function3 - inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$1 - inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$1$1 - public method (p0: Flow, p1: kotlin.jvm.functions.Function3): void - public @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object - public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$transform$$inlined$flow$2$1 { - enclosing method TcoContinuationKt$transform$$inlined$flow$2.collect(LFlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - field label: int - synthetic field result: java.lang.Object - synthetic final field this$0: TcoContinuationKt$transform$$inlined$flow$2 - inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$2 - inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$2$1 - public method (p0: TcoContinuationKt$transform$$inlined$flow$2, p1: kotlin.coroutines.Continuation): void - public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$transform$$inlined$flow$2$lambda$1$1 { - enclosing method TcoContinuationKt$transform$$inlined$flow$2$lambda$1.emit(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - field label: int - synthetic field result: java.lang.Object - synthetic final field this$0: TcoContinuationKt$transform$$inlined$flow$2$lambda$1 - inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$2$lambda$1 - inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$2$lambda$1$1 - public method (p0: TcoContinuationKt$transform$$inlined$flow$2$lambda$1, p1: kotlin.coroutines.Continuation): void - public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$transform$$inlined$flow$2$lambda$1 { - // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt$transform$$inlined$flow$2.collect(LFlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - synthetic final field $this_flow$inlined: FlowCollector - synthetic final field this$0: TcoContinuationKt$transform$$inlined$flow$2 - inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$2$lambda$1 - inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$2$lambda$1$1 - public method (p0: FlowCollector, p1: TcoContinuationKt$transform$$inlined$flow$2): void - public @org.jetbrains.annotations.Nullable method emit$$forInline(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object - public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$transform$$inlined$flow$2 { - // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt.transform(LFlow;Lkotlin/jvm/functions/Function3;)LFlow; - synthetic final field $this_transform$inlined: Flow - synthetic final field $transformer$inlined: kotlin.jvm.functions.Function3 - inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$2 - inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$2$1 - public method (p0: Flow, p1: kotlin.jvm.functions.Function3): void - public @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object - public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$transform$$inlined$flow$3$1 { - enclosing method TcoContinuationKt$transform$$inlined$flow$3.collect(LFlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - field label: int - synthetic field result: java.lang.Object - synthetic final field this$0: TcoContinuationKt$transform$$inlined$flow$3 - inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$3 - inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$3$1 - public method (p0: TcoContinuationKt$transform$$inlined$flow$3, p1: kotlin.coroutines.Continuation): void - public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$transform$$inlined$flow$3$lambda$1$1 { - enclosing method TcoContinuationKt$transform$$inlined$flow$3$lambda$1.emit(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - field label: int - synthetic field result: java.lang.Object - synthetic final field this$0: TcoContinuationKt$transform$$inlined$flow$3$lambda$1 - inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$3$lambda$1 - inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$3$lambda$1$1 - public method (p0: TcoContinuationKt$transform$$inlined$flow$3$lambda$1, p1: kotlin.coroutines.Continuation): void - public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$transform$$inlined$flow$3$lambda$1 { - // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt$transform$$inlined$flow$3.collect(LFlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - synthetic final field $this_flow$inlined: FlowCollector - synthetic final field this$0: TcoContinuationKt$transform$$inlined$flow$3 - inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$3$lambda$1 - inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$3$lambda$1$1 - public method (p0: FlowCollector, p1: TcoContinuationKt$transform$$inlined$flow$3): void - public @org.jetbrains.annotations.Nullable method emit$$forInline(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object - public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt$transform$$inlined$flow$3 { - // source: 'tcoContinuation.kt' - enclosing method TcoContinuationKt.transform(LFlow;Lkotlin/jvm/functions/Function3;)LFlow; - synthetic final field $this_transform$inlined: Flow - synthetic final field $transformer$inlined: kotlin.jvm.functions.Function3 - inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$3 - inner (anonymous) class TcoContinuationKt$transform$$inlined$flow$3$1 - public method (p0: Flow, p1: kotlin.jvm.functions.Function3): void - public @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object - public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object -} - -@kotlin.Metadata -public final class TcoContinuationKt { - // source: 'tcoContinuation.kt' - inner (anonymous) class TcoContinuationKt$collect$2 - inner (anonymous) class TcoContinuationKt$flow$1 - private final static @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: Flow, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function2, @org.jetbrains.annotations.NotNull p2: kotlin.coroutines.Continuation): java.lang.Object - public final static @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: Flow, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function2, @org.jetbrains.annotations.NotNull p2: kotlin.coroutines.Continuation): java.lang.Object - public final static @org.jetbrains.annotations.NotNull method flow(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function2): Flow - public final static @org.jetbrains.annotations.Nullable method foo(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object - public final static @org.jetbrains.annotations.NotNull method map(@org.jetbrains.annotations.NotNull p0: Flow, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function2): Flow - public final static @org.jetbrains.annotations.NotNull method transform(@org.jetbrains.annotations.NotNull p0: Flow, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function3): Flow -} diff --git a/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/complicatedMerge.kt b/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/complicatedMerge.kt index 3d08806ba6a..8cf0f42e453 100644 --- a/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/complicatedMerge.kt +++ b/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/complicatedMerge.kt @@ -1,10 +1,9 @@ -// COMMON_COROUTINES_TEST // WITH_COROUTINES // TREAT_AS_ONE_FILE import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): Unit = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/i2bResult.kt b/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/i2bResult.kt index 4e030edf190..bc7e373d7e9 100644 --- a/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/i2bResult.kt +++ b/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/i2bResult.kt @@ -1,10 +1,9 @@ -// COMMON_COROUTINES_TEST // WITH_COROUTINES // TREAT_AS_ONE_FILE import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): Unit = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt b/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt index cee5926a9dc..563a801ac5f 100644 --- a/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt +++ b/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt @@ -1,10 +1,9 @@ -// COMMON_COROUTINES_TEST // WITH_COROUTINES // TREAT_AS_ONE_FILE import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): Unit = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/loadFromByteArray.kt b/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/loadFromByteArray.kt index 7fb114d3c2b..692157b335e 100644 --- a/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/loadFromByteArray.kt +++ b/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/loadFromByteArray.kt @@ -1,10 +1,9 @@ -// COMMON_COROUTINES_TEST // WITH_COROUTINES // TREAT_AS_ONE_FILE import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): Unit = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/noVariableInTable.kt b/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/noVariableInTable.kt index 2e82a2c91df..7f94c5e4cd7 100644 --- a/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/noVariableInTable.kt +++ b/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/noVariableInTable.kt @@ -1,10 +1,9 @@ -// COMMON_COROUTINES_TEST // WITH_COROUTINES // TREAT_AS_ONE_FILE import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): Unit = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt b/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt index 593b9b004de..e7dc1f37e9f 100644 --- a/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt +++ b/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt @@ -1,10 +1,9 @@ -// COMMON_COROUTINES_TEST // WITH_COROUTINES // TREAT_AS_ONE_FILE import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): Unit = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInArrayStore.kt b/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInArrayStore.kt index 8be753e320b..8e28aa5d6d1 100644 --- a/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInArrayStore.kt +++ b/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInArrayStore.kt @@ -1,10 +1,9 @@ -// COMMON_COROUTINES_TEST // WITH_COROUTINES // TREAT_AS_ONE_FILE import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): Unit = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInMethodCall.kt b/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInMethodCall.kt index e12930d9dab..ca5cf9874a8 100644 --- a/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInMethodCall.kt +++ b/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInMethodCall.kt @@ -1,10 +1,9 @@ -// COMMON_COROUTINES_TEST // WITH_COROUTINES // TREAT_AS_ONE_FILE import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): Unit = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInPutfield.kt b/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInPutfield.kt index 4ad238b035b..6f19e3fa680 100644 --- a/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInPutfield.kt +++ b/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInPutfield.kt @@ -1,10 +1,9 @@ -// COMMON_COROUTINES_TEST // WITH_COROUTINES // TREAT_AS_ONE_FILE import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): Unit = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInVarStore.kt b/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInVarStore.kt index d67c6a221e6..696bad3612a 100644 --- a/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInVarStore.kt +++ b/compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInVarStore.kt @@ -1,10 +1,9 @@ -// COMMON_COROUTINES_TEST // WITH_COROUTINES // TREAT_AS_ONE_FILE import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { suspend fun suspendHere(): Unit = suspendCoroutineUninterceptedOrReturn { x -> diff --git a/compiler/testData/codegen/bytecodeText/coroutines/returnUnitInLambda.kt b/compiler/testData/codegen/bytecodeText/coroutines/returnUnitInLambda.kt index b014aea9f74..2cfec730688 100644 --- a/compiler/testData/codegen/bytecodeText/coroutines/returnUnitInLambda.kt +++ b/compiler/testData/codegen/bytecodeText/coroutines/returnUnitInLambda.kt @@ -1,10 +1,9 @@ -// COMMON_COROUTINES_TEST // WITH_COROUTINES // TREAT_AS_ONE_FILE import helpers.* -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* var res = "FAIL" diff --git a/compiler/testData/codegen/light-analysis/coroutines/overrideDefaultArgument.txt b/compiler/testData/codegen/light-analysis/coroutines/overrideDefaultArgument.txt index d4376077edc..1fc95fcd643 100644 --- a/compiler/testData/codegen/light-analysis/coroutines/overrideDefaultArgument.txt +++ b/compiler/testData/codegen/light-analysis/coroutines/overrideDefaultArgument.txt @@ -1,18 +1,18 @@ @kotlin.Metadata public final class CoroutineUtilKt { - public final static @org.jetbrains.annotations.NotNull method handleExceptionContinuation(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): COROUTINES_PACKAGE.Continuation - public final static @org.jetbrains.annotations.NotNull method handleResultContinuation(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): COROUTINES_PACKAGE.Continuation + public final static @org.jetbrains.annotations.NotNull method handleExceptionContinuation(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): kotlin.coroutines.Continuation + public final static @org.jetbrains.annotations.NotNull method handleResultContinuation(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): kotlin.coroutines.Continuation } @kotlin.Metadata public class EmptyContinuation { public final static field Companion: EmptyContinuation.Companion - private final @org.jetbrains.annotations.NotNull field context: COROUTINES_PACKAGE.CoroutineContext + private final @org.jetbrains.annotations.NotNull field context: kotlin.coroutines.CoroutineContext inner class EmptyContinuation/Companion public @synthetic.kotlin.jvm.GeneratedByJvmOverloads method (): void - public method (@org.jetbrains.annotations.NotNull p0: COROUTINES_PACKAGE.CoroutineContext): void - public synthetic method (p0: COROUTINES_PACKAGE.CoroutineContext, p1: int, p2: kotlin.jvm.internal.DefaultConstructorMarker): void - public @org.jetbrains.annotations.NotNull method getContext(): COROUTINES_PACKAGE.CoroutineContext + public method (@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.CoroutineContext): void + public synthetic method (p0: kotlin.coroutines.CoroutineContext, p1: int, p2: kotlin.jvm.internal.DefaultConstructorMarker): void + public @org.jetbrains.annotations.NotNull method getContext(): kotlin.coroutines.CoroutineContext public method resume(@org.jetbrains.annotations.Nullable p0: java.lang.Object): void public method resumeWithException(@org.jetbrains.annotations.NotNull p0: java.lang.Throwable): void } @@ -26,20 +26,20 @@ public final static class EmptyContinuation/Companion { @kotlin.Metadata public interface I { inner class I/DefaultImpls - public abstract @org.jetbrains.annotations.Nullable method foo(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.NotNull p1: COROUTINES_PACKAGE.Continuation): java.lang.Object + public abstract @org.jetbrains.annotations.Nullable method foo(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object } @kotlin.Metadata public final class I/DefaultImpls { inner class I/DefaultImpls - public synthetic static method foo$default(p0: I, p1: java.lang.String, p2: COROUTINES_PACKAGE.Continuation, p3: int, p4: java.lang.Object): java.lang.Object + public synthetic static method foo$default(p0: I, p1: java.lang.String, p2: kotlin.coroutines.Continuation, p3: int, p4: java.lang.Object): java.lang.Object } @kotlin.Metadata public final class O { public final static field INSTANCE: O private method (): void - public @org.jetbrains.annotations.Nullable method foo(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.NotNull p1: COROUTINES_PACKAGE.Continuation): java.lang.Object + public @org.jetbrains.annotations.Nullable method foo(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object } @kotlin.Metadata @@ -56,5 +56,5 @@ public final class OverrideDefaultArgumentKt { public final static method setFinished(p0: boolean): void public final static method setProceed(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): void public final static method setResult(@org.jetbrains.annotations.NotNull p0: java.lang.String): void - public final static @org.jetbrains.annotations.Nullable method sleep(@org.jetbrains.annotations.NotNull p0: COROUTINES_PACKAGE.Continuation): java.lang.Object + public final static @org.jetbrains.annotations.Nullable method sleep(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object } diff --git a/compiler/testData/codegen/light-analysis/coroutines/tailOperations/tailInlining.txt b/compiler/testData/codegen/light-analysis/coroutines/tailOperations/tailInlining.txt index 1e83fca8d6f..4095b0d4189 100644 --- a/compiler/testData/codegen/light-analysis/coroutines/tailOperations/tailInlining.txt +++ b/compiler/testData/codegen/light-analysis/coroutines/tailOperations/tailInlining.txt @@ -1,18 +1,18 @@ @kotlin.Metadata public final class CoroutineUtilKt { - public final static @org.jetbrains.annotations.NotNull method handleExceptionContinuation(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): COROUTINES_PACKAGE.Continuation - public final static @org.jetbrains.annotations.NotNull method handleResultContinuation(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): COROUTINES_PACKAGE.Continuation + public final static @org.jetbrains.annotations.NotNull method handleExceptionContinuation(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): kotlin.coroutines.Continuation + public final static @org.jetbrains.annotations.NotNull method handleResultContinuation(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): kotlin.coroutines.Continuation } @kotlin.Metadata public class EmptyContinuation { public final static field Companion: EmptyContinuation.Companion - private final @org.jetbrains.annotations.NotNull field context: COROUTINES_PACKAGE.CoroutineContext + private final @org.jetbrains.annotations.NotNull field context: kotlin.coroutines.CoroutineContext inner class EmptyContinuation/Companion public @synthetic.kotlin.jvm.GeneratedByJvmOverloads method (): void - public method (@org.jetbrains.annotations.NotNull p0: COROUTINES_PACKAGE.CoroutineContext): void - public synthetic method (p0: COROUTINES_PACKAGE.CoroutineContext, p1: int, p2: kotlin.jvm.internal.DefaultConstructorMarker): void - public @org.jetbrains.annotations.NotNull method getContext(): COROUTINES_PACKAGE.CoroutineContext + public method (@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.CoroutineContext): void + public synthetic method (p0: kotlin.coroutines.CoroutineContext, p1: int, p2: kotlin.jvm.internal.DefaultConstructorMarker): void + public @org.jetbrains.annotations.NotNull method getContext(): kotlin.coroutines.CoroutineContext public method resume(@org.jetbrains.annotations.Nullable p0: java.lang.Object): void public method resumeWithException(@org.jetbrains.annotations.NotNull p0: java.lang.Throwable): void } @@ -29,9 +29,9 @@ public final class TailInliningKt { private static @org.jetbrains.annotations.NotNull field proceed: kotlin.jvm.functions.Function0 private static @org.jetbrains.annotations.NotNull field result: java.lang.String public final static method async(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): void - public final static @org.jetbrains.annotations.Nullable method bar(p0: int, @org.jetbrains.annotations.NotNull p1: COROUTINES_PACKAGE.Continuation): java.lang.Object + public final static @org.jetbrains.annotations.Nullable method bar(p0: int, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String - public final static @org.jetbrains.annotations.Nullable method foo(p0: int, @org.jetbrains.annotations.NotNull p1: COROUTINES_PACKAGE.Continuation): java.lang.Object + public final static @org.jetbrains.annotations.Nullable method foo(p0: int, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object public final static method getFinished(): boolean public final static @org.jetbrains.annotations.NotNull method getProceed(): kotlin.jvm.functions.Function0 public final static @org.jetbrains.annotations.NotNull method getResult(): java.lang.String diff --git a/compiler/testData/compileKotlinAgainstKotlin/coroutinesBinary.kt b/compiler/testData/compileKotlinAgainstKotlin/coroutinesBinary.kt index d1df3eed38a..5d1626cbf08 100644 --- a/compiler/testData/compileKotlinAgainstKotlin/coroutinesBinary.kt +++ b/compiler/testData/compileKotlinAgainstKotlin/coroutinesBinary.kt @@ -1,12 +1,11 @@ // IGNORE_BACKEND_FIR: JVM_IR -// COMMON_COROUTINES_TEST // FILE: A.kt // WITH_RUNTIME // WITH_COROUTINES package a -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* class Controller { var callback: () -> Unit = {} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/property.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/property.fir.kt index 3c3106e6bfa..11c5a7520c2 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/property.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/property.fir.kt @@ -1,7 +1,5 @@ // SKIP_TXT -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.coroutineContext +import kotlin.coroutines.coroutineContext val c = ::coroutineContext @@ -11,4 +9,4 @@ fun test() { suspend fun test2() { c() -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/property.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/property.kt index 37fb60da24e..1d68edc5504 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/property.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/property.kt @@ -1,7 +1,5 @@ // SKIP_TXT -// COMMON_COROUTINES_TEST - -import COROUTINES_PACKAGE.coroutineContext +import kotlin.coroutines.coroutineContext val c = ::coroutineContext @@ -11,4 +9,4 @@ fun test() { suspend fun test2() { c() -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineOrdinary.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineOrdinary.fir.kt index ddbc650d602..10b112eae1c 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineOrdinary.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineOrdinary.fir.kt @@ -1,9 +1,8 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -// COMMON_COROUTINES_TEST // WITH_COROUTINES // SKIP_TXT -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* // Function is NOT suspend diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineOrdinary.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineOrdinary.kt index 1a30239fa4d..863a608ddd4 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineOrdinary.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineOrdinary.kt @@ -1,9 +1,8 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -// COMMON_COROUTINES_TEST // WITH_COROUTINES // SKIP_TXT -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* // Function is NOT suspend diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineSuspend.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineSuspend.fir.kt index 9577cee6faf..1274ba3fb3d 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineSuspend.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineSuspend.fir.kt @@ -1,9 +1,8 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -NOTHING_TO_INLINE -// COMMON_COROUTINES_TEST // SKIP_TXT // WITH_COROUTINES -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* interface SuspendRunnable { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineSuspend.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineSuspend.kt index 1b3b489fd96..9588905e908 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineSuspend.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineSuspend.kt @@ -1,9 +1,8 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -NOTHING_TO_INLINE -// COMMON_COROUTINES_TEST // SKIP_TXT // WITH_COROUTINES -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* interface SuspendRunnable { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineOrdinary.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineOrdinary.fir.kt index 6a071da0963..74f94fa1795 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineOrdinary.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineOrdinary.fir.kt @@ -1,9 +1,8 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -NOTHING_TO_INLINE -// COMMON_COROUTINES_TEST // SKIP_TXT // WITH_COROUTINES -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* // Function is NOT suspend diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineOrdinary.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineOrdinary.kt index d1da3576b2b..aa8036e2d2b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineOrdinary.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineOrdinary.kt @@ -1,9 +1,8 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -NOTHING_TO_INLINE -// COMMON_COROUTINES_TEST // SKIP_TXT // WITH_COROUTINES -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* // Function is NOT suspend diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineSuspend.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineSuspend.fir.kt index 0de218dc6e9..54188b3b056 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineSuspend.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineSuspend.fir.kt @@ -1,9 +1,8 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -NOTHING_TO_INLINE -// COMMON_COROUTINES_TEST // SKIP_TXT // WITH_COROUTINES -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* interface SuspendRunnable { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineSuspend.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineSuspend.kt index 471649c5260..dc127f73b13 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineSuspend.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineSuspend.kt @@ -1,9 +1,8 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -NOTHING_TO_INLINE -// COMMON_COROUTINES_TEST // SKIP_TXT // WITH_COROUTINES -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* interface SuspendRunnable { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfOrdinary.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfOrdinary.fir.kt index f759654dc3a..2a6c74bef99 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfOrdinary.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfOrdinary.fir.kt @@ -1,9 +1,8 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -// COMMON_COROUTINES_TEST // SKIP_TXT // WITH_COROUTINES -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* // Function is NOT suspend diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfOrdinary.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfOrdinary.kt index cab6c85ba1a..c08b9608e54 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfOrdinary.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfOrdinary.kt @@ -1,9 +1,8 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -// COMMON_COROUTINES_TEST // SKIP_TXT // WITH_COROUTINES -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* // Function is NOT suspend diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfSuspend.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfSuspend.fir.kt index cb56e6f083c..da657917e87 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfSuspend.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfSuspend.fir.kt @@ -1,9 +1,8 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -NOTHING_TO_INLINE -UNUSED_PARAMETER -// COMMON_COROUTINES_TEST // SKIP_TXT // WITH_COROUTINES -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* interface SuspendRunnable { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfSuspend.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfSuspend.kt index 971aef074e8..7567093d39d 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfSuspend.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfSuspend.kt @@ -1,9 +1,8 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -NOTHING_TO_INLINE -UNUSED_PARAMETER -// COMMON_COROUTINES_TEST // SKIP_TXT // WITH_COROUTINES -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* interface SuspendRunnable { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineOrdinary.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineOrdinary.fir.kt index ae87366f501..3a8b813993b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineOrdinary.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineOrdinary.fir.kt @@ -1,9 +1,8 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -// COMMON_COROUTINES_TEST // SKIP_TXT // WITH_COROUTINES -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* // Function is suspend diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineOrdinary.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineOrdinary.kt index 829171e8a3d..24e4f06072d 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineOrdinary.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineOrdinary.kt @@ -1,9 +1,8 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -// COMMON_COROUTINES_TEST // SKIP_TXT // WITH_COROUTINES -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* // Function is suspend diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineSuspend.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineSuspend.fir.kt index 5946e802530..ba40df50841 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineSuspend.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineSuspend.fir.kt @@ -1,9 +1,8 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -NOTHING_TO_INLINE -// COMMON_COROUTINES_TEST // SKIP_TXT // WITH_COROUTINES -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* interface SuspendRunnable { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineSuspend.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineSuspend.kt index a8aba21f048..96a048574b7 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineSuspend.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineSuspend.kt @@ -1,9 +1,8 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -NOTHING_TO_INLINE -// COMMON_COROUTINES_TEST // SKIP_TXT // WITH_COROUTINES -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* interface SuspendRunnable { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineOrdinary.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineOrdinary.fir.kt index 7dd80fd573c..65833bc430a 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineOrdinary.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineOrdinary.fir.kt @@ -1,9 +1,8 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -NOTHING_TO_INLINE -// COMMON_COROUTINES_TEST // SKIP_TXT // WITH_COROUTINES -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* // Function is suspend diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineOrdinary.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineOrdinary.kt index 9a228c61458..320e2cb495f 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineOrdinary.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineOrdinary.kt @@ -1,9 +1,8 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -NOTHING_TO_INLINE -// COMMON_COROUTINES_TEST // SKIP_TXT // WITH_COROUTINES -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* // Function is suspend diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineSuspend.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineSuspend.kt index e0918cd51a4..e3475839a15 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineSuspend.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineSuspend.kt @@ -1,10 +1,9 @@ // FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -NOTHING_TO_INLINE -UNUSED_PARAMETER -// COMMON_COROUTINES_TEST // SKIP_TXT // WITH_COROUTINES -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* interface SuspendRunnable { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfOrdinary.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfOrdinary.fir.kt index e6a297f600e..cfea83085db 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfOrdinary.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfOrdinary.fir.kt @@ -1,9 +1,8 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -// COMMON_COROUTINES_TEST // SKIP_TXT // WITH_COROUTINES -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* // Function is suspend diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfOrdinary.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfOrdinary.kt index 3a3628ddd0c..b92ea4d18fd 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfOrdinary.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfOrdinary.kt @@ -1,9 +1,8 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -// COMMON_COROUTINES_TEST // SKIP_TXT // WITH_COROUTINES -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* // Function is suspend diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfSuspend.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfSuspend.fir.kt index 25fcfa6329b..6501622345b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfSuspend.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfSuspend.fir.kt @@ -1,9 +1,8 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -NOTHING_TO_INLINE -// COMMON_COROUTINES_TEST // SKIP_TXT // WITH_COROUTINES -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* interface SuspendRunnable { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfSuspend.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfSuspend.kt index b78b5ecf1e9..58ac52872eb 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfSuspend.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfSuspend.kt @@ -1,9 +1,8 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -NOTHING_TO_INLINE -// COMMON_COROUTINES_TEST // SKIP_TXT // WITH_COROUTINES -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* import helpers.* interface SuspendRunnable { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.fir.kt index 1e7e7f9c3a0..5b5f961f592 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.fir.kt @@ -1,9 +1,7 @@ // FILE: 1.kt -// COMMON_COROUTINES_TEST - fun test(c: Continuation) {} // FILE: 2.kt -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun test2(c: Continuation) {} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.kt index fdce1581313..cf1e9382e5e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.kt @@ -1,9 +1,7 @@ // FILE: 1.kt -// COMMON_COROUTINES_TEST - fun test(c: Continuation) {} // FILE: 2.kt -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun test2(c: Continuation) {} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.txt index 2f46b37d932..ecd5c30af16 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.txt @@ -1,4 +1,4 @@ package public fun test(/*0*/ c: [ERROR : Continuation]): kotlin.Unit -public fun test2(/*0*/ c: COROUTINES_PACKAGE.Continuation): kotlin.Unit +public fun test2(/*0*/ c: kotlin.coroutines.Continuation): kotlin.Unit diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/allMembersAllowed.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/allMembersAllowed.kt index 7e40a04e7cd..1800c70b0e8 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/allMembersAllowed.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/allMembersAllowed.kt @@ -1,13 +1,11 @@ // FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER -SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE -// COMMON_COROUTINES_TEST - interface SuperInterface { suspend fun superFun() {} suspend fun String.superExtFun() {} } -@COROUTINES_PACKAGE.RestrictsSuspension +@kotlin.coroutines.RestrictsSuspension open class RestrictedController : SuperInterface { suspend fun memberFun() {} suspend fun String.memberExtFun() {} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/allMembersAllowed.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/allMembersAllowed.txt index 05e1c15bce4..9584af8e13b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/allMembersAllowed.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/allMembersAllowed.txt @@ -5,7 +5,7 @@ public fun generate2(/*0*/ f: suspend RestrictedController.() -> kotlin.Unit): k public fun generate3(/*0*/ f: suspend SubClass.() -> kotlin.Unit): kotlin.Unit public fun kotlin.String.test(): kotlin.Unit -@COROUTINES_PACKAGE.RestrictsSuspension public open class RestrictedController : SuperInterface { +@kotlin.coroutines.RestrictsSuspension public open class RestrictedController : SuperInterface { public constructor RestrictedController() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/extensions.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/extensions.fir.kt index 0645a203746..57997e3f91e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/extensions.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/extensions.fir.kt @@ -1,9 +1,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE -// COMMON_COROUTINES_TEST - interface SuperInterface -@COROUTINES_PACKAGE.RestrictsSuspension +@kotlin.coroutines.RestrictsSuspension open class RestrictedController : SuperInterface class SubClass : RestrictedController() diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/extensions.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/extensions.kt index 1a0b91f8110..b3fda9f481e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/extensions.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/extensions.kt @@ -1,9 +1,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE -// COMMON_COROUTINES_TEST - interface SuperInterface -@COROUTINES_PACKAGE.RestrictsSuspension +@kotlin.coroutines.RestrictsSuspension open class RestrictedController : SuperInterface class SubClass : RestrictedController() diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/extensions.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/extensions.txt index 353c47b3963..8140a0d9dba 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/extensions.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/extensions.txt @@ -20,7 +20,7 @@ public final class A { public final suspend fun SuperInterface.memExtSuper(): kotlin.Unit } -@COROUTINES_PACKAGE.RestrictsSuspension public open class RestrictedController : SuperInterface { +@kotlin.coroutines.RestrictsSuspension public open class RestrictedController : SuperInterface { public constructor RestrictedController() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/memberExtension.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/memberExtension.fir.kt index a48b3936b18..25cbbb7d0ef 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/memberExtension.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/memberExtension.fir.kt @@ -1,6 +1,5 @@ -// COMMON_COROUTINES_TEST // SKIP_TXT -@COROUTINES_PACKAGE.RestrictsSuspension +@kotlin.coroutines.RestrictsSuspension class RestrictedController { suspend fun member() { ext() diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/memberExtension.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/memberExtension.kt index 629f8bdf393..59be393309e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/memberExtension.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/memberExtension.kt @@ -1,6 +1,5 @@ -// COMMON_COROUTINES_TEST // SKIP_TXT -@COROUTINES_PACKAGE.RestrictsSuspension +@kotlin.coroutines.RestrictsSuspension class RestrictedController { suspend fun member() { ext() diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/notRelatedFun.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/notRelatedFun.fir.kt index 23c472769a3..ab14bac2adc 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/notRelatedFun.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/notRelatedFun.fir.kt @@ -1,9 +1,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE -// COMMON_COROUTINES_TEST - interface SuperInterface -@COROUTINES_PACKAGE.RestrictsSuspension +@kotlin.coroutines.RestrictsSuspension open class RestrictedController : SuperInterface class SubClass : RestrictedController() diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/notRelatedFun.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/notRelatedFun.kt index af76adccd60..82900b4b71d 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/notRelatedFun.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/notRelatedFun.kt @@ -1,9 +1,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE -// COMMON_COROUTINES_TEST - interface SuperInterface -@COROUTINES_PACKAGE.RestrictsSuspension +@kotlin.coroutines.RestrictsSuspension open class RestrictedController : SuperInterface class SubClass : RestrictedController() diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/notRelatedFun.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/notRelatedFun.txt index 141a4745877..ea2894e4f21 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/notRelatedFun.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/notRelatedFun.txt @@ -14,7 +14,7 @@ public final class A { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -@COROUTINES_PACKAGE.RestrictsSuspension public open class RestrictedController : SuperInterface { +@kotlin.coroutines.RestrictsSuspension public open class RestrictedController : SuperInterface { public constructor RestrictedController() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/sameInstance.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/sameInstance.fir.kt index 18e7fdc5a87..cb175b40fce 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/sameInstance.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/sameInstance.fir.kt @@ -1,7 +1,5 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE -// COMMON_COROUTINES_TEST - -@COROUTINES_PACKAGE.RestrictsSuspension +@kotlin.coroutines.RestrictsSuspension class RestrictedController { suspend fun member() {} } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/sameInstance.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/sameInstance.kt index 6dfbfcf511b..5d7d2a21f22 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/sameInstance.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/sameInstance.kt @@ -1,7 +1,5 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE -// COMMON_COROUTINES_TEST - -@COROUTINES_PACKAGE.RestrictsSuspension +@kotlin.coroutines.RestrictsSuspension class RestrictedController { suspend fun member() {} } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/sameInstance.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/sameInstance.txt index 476846c3b2f..38e0ff18dc7 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/sameInstance.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/sameInstance.txt @@ -5,7 +5,7 @@ public fun test(): kotlin.Unit public suspend fun RestrictedController.extension(): kotlin.Unit public suspend fun RestrictedController.l(): kotlin.Unit -@COROUTINES_PACKAGE.RestrictsSuspension public final class RestrictedController { +@kotlin.coroutines.RestrictsSuspension public final class RestrictedController { public constructor RestrictedController() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/simpleForbidden.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/simpleForbidden.fir.kt index 877b528ccf9..8e1f2ff8c03 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/simpleForbidden.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/simpleForbidden.fir.kt @@ -1,5 +1,4 @@ -// COMMON_COROUTINES_TEST -@COROUTINES_PACKAGE.RestrictsSuspension +@kotlin.coroutines.RestrictsSuspension class RestrictedController suspend fun Any?.extFun() {} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/simpleForbidden.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/simpleForbidden.kt index 41ad0852a44..296aadf0748 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/simpleForbidden.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/simpleForbidden.kt @@ -1,5 +1,4 @@ -// COMMON_COROUTINES_TEST -@COROUTINES_PACKAGE.RestrictsSuspension +@kotlin.coroutines.RestrictsSuspension class RestrictedController suspend fun Any?.extFun() {} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/simpleForbidden.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/simpleForbidden.txt index 0ceda5dab23..7e1a2cfeee5 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/simpleForbidden.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/simpleForbidden.txt @@ -5,7 +5,7 @@ public suspend fun suspendFun(): kotlin.Unit public fun test(): kotlin.Unit public suspend fun kotlin.Any?.extFun(): kotlin.Unit -@COROUTINES_PACKAGE.RestrictsSuspension public final class RestrictedController { +@kotlin.coroutines.RestrictsSuspension public final class RestrictedController { public constructor RestrictedController() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/wrongEnclosingFunction.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/wrongEnclosingFunction.fir.kt index 60d2895331d..8c886cd1d1f 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/wrongEnclosingFunction.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/wrongEnclosingFunction.fir.kt @@ -1,6 +1,5 @@ -// COMMON_COROUTINES_TEST // SKIP_TXT -@COROUTINES_PACKAGE.RestrictsSuspension +@kotlin.coroutines.RestrictsSuspension class RestrictedController { suspend fun yield() {} } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/wrongEnclosingFunction.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/wrongEnclosingFunction.kt index fa8c641da80..259b1ca2210 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/wrongEnclosingFunction.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/wrongEnclosingFunction.kt @@ -1,6 +1,5 @@ -// COMMON_COROUTINES_TEST // SKIP_TXT -@COROUTINES_PACKAGE.RestrictsSuspension +@kotlin.coroutines.RestrictsSuspension class RestrictedController { suspend fun yield() {} } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendApplicability.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendApplicability.kt index 210edcdbf6b..8c366c6fad4 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendApplicability.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendApplicability.kt @@ -1,7 +1,6 @@ // FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER -NOTHING_TO_INLINE -// COMMON_COROUTINES_TEST -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* suspend fun notMember(q: Double) = 1 diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendApplicability.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendApplicability.txt index 8b482a8a964..226605fdc45 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendApplicability.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendApplicability.txt @@ -10,7 +10,7 @@ public final class Controller { public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public final suspend inline fun inlineFun(/*0*/ x: kotlin.Int): kotlin.Unit public final suspend fun noParameters(): kotlin.Unit - public final suspend fun oldConvention(/*0*/ x: COROUTINES_PACKAGE.Continuation): kotlin.Unit + public final suspend fun oldConvention(/*0*/ x: kotlin.coroutines.Continuation): kotlin.Unit public final suspend fun oneParameter(/*0*/ q: kotlin.Any): kotlin.Unit public final suspend fun returnsString(/*0*/ q: kotlin.Any): kotlin.String public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCovarianJavaOverride.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCovarianJavaOverride.fir.kt index d24b143c660..769fbcd6523 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCovarianJavaOverride.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCovarianJavaOverride.fir.kt @@ -1,4 +1,3 @@ -// COMMON_COROUTINES_TEST // FILE: I.kt interface I { @@ -8,14 +7,14 @@ interface I { // FILE: JavaClass.java public class JavaClass implements I { @Override - public String foo(int x, COROUTINES_PACKAGE.Continuation continuation) { + public String foo(int x, kotlin.coroutines.Continuation continuation) { return null; } } // FILE: main.kt -import COROUTINES_PACKAGE.Continuation +import kotlin.coroutines.Continuation class K1 : JavaClass() class K2 : JavaClass() { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCovarianJavaOverride.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCovarianJavaOverride.kt index 6f88bff7f1b..84b56542ce7 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCovarianJavaOverride.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCovarianJavaOverride.kt @@ -1,4 +1,3 @@ -// COMMON_COROUTINES_TEST // FILE: I.kt interface I { @@ -8,14 +7,14 @@ interface I { // FILE: JavaClass.java public class JavaClass implements I { @Override - public String foo(int x, COROUTINES_PACKAGE.Continuation continuation) { + public String foo(int x, kotlin.coroutines.Continuation continuation) { return null; } } // FILE: main.kt -import COROUTINES_PACKAGE.Continuation +import kotlin.coroutines.Continuation class K1 : JavaClass() class K2 : JavaClass() { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCovarianJavaOverride.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCovarianJavaOverride.txt index 01ec7dd2996..5555f9fc616 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCovarianJavaOverride.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCovarianJavaOverride.txt @@ -1,7 +1,7 @@ package public fun builder(/*0*/ block: suspend () -> kotlin.Unit): kotlin.Unit -public fun main(/*0*/ x: COROUTINES_PACKAGE.Continuation): kotlin.Unit +public fun main(/*0*/ x: kotlin.coroutines.Continuation): kotlin.Unit public interface I { public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @@ -38,7 +38,7 @@ public final class K3 : JavaClass { public constructor K3() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @java.lang.Override public open override /*1*/ suspend /*fake_override*/ fun foo(/*0*/ x: kotlin.Int): kotlin.String - public open fun foo(/*0*/ x: kotlin.Int, /*1*/ y: COROUTINES_PACKAGE.Continuation): kotlin.Any? + public open fun foo(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.coroutines.Continuation): kotlin.Any? public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.fir.kt index 4e5c8968405..056131d68e4 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.fir.kt @@ -1,8 +1,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER // !CHECK_TYPE // !WITH_NEW_INFERENCE -// COMMON_COROUTINES_TEST -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* class Controller { suspend fun noParams() { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.kt index b729d7c6e91..86402fb4a75 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.kt @@ -1,8 +1,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER // !CHECK_TYPE // !WITH_NEW_INFERENCE -// COMMON_COROUTINES_TEST -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* class Controller { suspend fun noParams() { @@ -38,7 +37,7 @@ fun test() { severalParams("", 89) checkType { _() } // TODO: should we allow somehow to call with passing continuation explicitly? - severalParams("", 89, 6.9) checkType { _() } - severalParams("", 89, this as Continuation) checkType { _() } + severalParams("", 89, 6.9) checkType { _() } + severalParams("", 89, this as Continuation) checkType { _() } } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaImplementationFromDifferentClass.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaImplementationFromDifferentClass.fir.kt index 7c7440c533c..eae685e55c2 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaImplementationFromDifferentClass.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaImplementationFromDifferentClass.fir.kt @@ -1,4 +1,3 @@ -// COMMON_COROUTINES_TEST // FILE: I.kt interface I { @@ -7,7 +6,7 @@ interface I { // FILE: BaseJavaClass.java public class BaseJavaClass { - public Object foo(int x, COROUTINES_PACKAGE.Continuation continuation) { + public Object foo(int x, kotlin.coroutines.Continuation continuation) { return null; } } @@ -18,7 +17,7 @@ public class JavaClass extends BaseJavaClass implements I { // FILE: main.kt -import COROUTINES_PACKAGE.Continuation +import kotlin.coroutines.Continuation class K1 : JavaClass() class K2 : JavaClass() { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaImplementationFromDifferentClass.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaImplementationFromDifferentClass.kt index dee8b5cf90c..289182ebb34 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaImplementationFromDifferentClass.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaImplementationFromDifferentClass.kt @@ -1,4 +1,3 @@ -// COMMON_COROUTINES_TEST // FILE: I.kt interface I { @@ -7,7 +6,7 @@ interface I { // FILE: BaseJavaClass.java public class BaseJavaClass { - public Object foo(int x, COROUTINES_PACKAGE.Continuation continuation) { + public Object foo(int x, kotlin.coroutines.Continuation continuation) { return null; } } @@ -18,7 +17,7 @@ public class JavaClass extends BaseJavaClass implements I { // FILE: main.kt -import COROUTINES_PACKAGE.Continuation +import kotlin.coroutines.Continuation class K1 : JavaClass() class K2 : JavaClass() { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaImplementationFromDifferentClass.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaImplementationFromDifferentClass.txt index b18d4f3710b..6d986e1996c 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaImplementationFromDifferentClass.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaImplementationFromDifferentClass.txt @@ -1,12 +1,12 @@ package public fun builder(/*0*/ block: suspend () -> kotlin.Unit): kotlin.Unit -public fun main(/*0*/ x: COROUTINES_PACKAGE.Continuation): kotlin.Unit +public fun main(/*0*/ x: kotlin.coroutines.Continuation): kotlin.Unit public open class BaseJavaClass { public constructor BaseJavaClass() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open fun foo(/*0*/ x: kotlin.Int, /*1*/ continuation: COROUTINES_PACKAGE.Continuation!): kotlin.Any! + public open fun foo(/*0*/ x: kotlin.Int, /*1*/ continuation: kotlin.coroutines.Continuation!): kotlin.Any! public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } @@ -46,7 +46,7 @@ public final class K3 : JavaClass { public constructor K3() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ suspend /*fake_override*/ fun foo(/*0*/ x: kotlin.Int): kotlin.String - public open fun foo(/*0*/ x: kotlin.Int, /*1*/ y: COROUTINES_PACKAGE.Continuation): kotlin.Any? + public open fun foo(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.coroutines.Continuation): kotlin.Any? public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaOverrides.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaOverrides.fir.kt index 0c2d26716df..2ffcd3ef844 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaOverrides.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaOverrides.fir.kt @@ -1,4 +1,3 @@ -// COMMON_COROUTINES_TEST // FILE: I.kt interface I { @@ -8,14 +7,14 @@ interface I { // FILE: JavaClass.java public class JavaClass implements I { @Override - public Object foo(int x, COROUTINES_PACKAGE.Continuation continuation) { + public Object foo(int x, kotlin.coroutines.Continuation continuation) { return null; } } // FILE: main.kt -import COROUTINES_PACKAGE.Continuation +import kotlin.coroutines.Continuation class K1 : JavaClass() class K2 : JavaClass() { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaOverrides.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaOverrides.kt index 8ba2a503022..f6c6595e108 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaOverrides.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaOverrides.kt @@ -1,4 +1,3 @@ -// COMMON_COROUTINES_TEST // FILE: I.kt interface I { @@ -8,14 +7,14 @@ interface I { // FILE: JavaClass.java public class JavaClass implements I { @Override - public Object foo(int x, COROUTINES_PACKAGE.Continuation continuation) { + public Object foo(int x, kotlin.coroutines.Continuation continuation) { return null; } } // FILE: main.kt -import COROUTINES_PACKAGE.Continuation +import kotlin.coroutines.Continuation class K1 : JavaClass() class K2 : JavaClass() { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaOverrides.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaOverrides.txt index 01ec7dd2996..5555f9fc616 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaOverrides.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaOverrides.txt @@ -1,7 +1,7 @@ package public fun builder(/*0*/ block: suspend () -> kotlin.Unit): kotlin.Unit -public fun main(/*0*/ x: COROUTINES_PACKAGE.Continuation): kotlin.Unit +public fun main(/*0*/ x: kotlin.coroutines.Continuation): kotlin.Unit public interface I { public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @@ -38,7 +38,7 @@ public final class K3 : JavaClass { public constructor K3() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @java.lang.Override public open override /*1*/ suspend /*fake_override*/ fun foo(/*0*/ x: kotlin.Int): kotlin.String - public open fun foo(/*0*/ x: kotlin.Int, /*1*/ y: COROUTINES_PACKAGE.Continuation): kotlin.Any? + public open fun foo(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.coroutines.Continuation): kotlin.Any? public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendLambda.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendLambda.kt index 3bf0483cb69..d330e716728 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendLambda.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendLambda.kt @@ -1,7 +1,6 @@ // FIR_IDENTICAL -// COMMON_COROUTINES_TEST // SKIP_TXT -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* fun foo(): Continuation = null!! diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/forbidden.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/forbidden.kt index 51fb71a4918..d6c5812ea19 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/forbidden.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/forbidden.kt @@ -1,8 +1,7 @@ // FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_ANONYMOUS_PARAMETER -// COMMON_COROUTINES_TEST -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun nonSuspend() {} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/tryCatch.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/tryCatch.kt index 6fecf4646b6..6cf835ed37f 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/tryCatch.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/tryCatch.kt @@ -1,8 +1,7 @@ // FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_ANONYMOUS_PARAMETER -// COMMON_COROUTINES_TEST -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* fun nonSuspend() {} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/valid.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/valid.kt index 3bb325029f4..c30dd8f4352 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/valid.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/valid.kt @@ -1,8 +1,7 @@ // FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_ANONYMOUS_PARAMETER -// COMMON_COROUTINES_TEST -import COROUTINES_PACKAGE.* -import COROUTINES_PACKAGE.intrinsics.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* suspend fun baz() = 1 From dbc85a5f18946a8b595c9ff144da713f30bb4a6d Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Wed, 2 Dec 2020 13:34:55 +0300 Subject: [PATCH 573/698] [TEST] Fix compilation of CodegenTestsOnAndroidGenerator.kt --- .../kotlin/android/tests/CodegenTestsOnAndroidGenerator.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/CodegenTestsOnAndroidGenerator.kt b/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/CodegenTestsOnAndroidGenerator.kt index 059e1760748..055daf8e553 100644 --- a/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/CodegenTestsOnAndroidGenerator.kt +++ b/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/CodegenTestsOnAndroidGenerator.kt @@ -269,8 +269,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager continue } - val fullFileText = - FileUtil.loadFile(file, true).replace("COROUTINES_PACKAGE", "kotlin.coroutines") + val fullFileText = FileUtil.loadFile(file, true) if (fullFileText.contains("// WITH_COROUTINES")) { if (fullFileText.contains("kotlin.coroutines.experimental")) continue @@ -317,7 +316,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager } private fun createTestFiles(file: File, expectedText: String): List = - CodegenTestCase.createTestFilesFromFile(file, expectedText, "kotlin.coroutines", false, TargetBackend.JVM) + CodegenTestCase.createTestFilesFromFile(file, expectedText, false, TargetBackend.JVM) companion object { const val GRADLE_VERSION = "5.6.4" // update GRADLE_SHA_256 on change From 7e088457a250b21e153ed5cc73d636935cf8e1c4 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Wed, 9 Dec 2020 22:29:55 +0300 Subject: [PATCH 574/698] Temporary clear sinceVersion for ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated ^KT-36770 Related ^KT-26245 Related --- .../org/jetbrains/kotlin/config/LanguageVersionSettings.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index b016571cdcd..6c594382d31 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -135,7 +135,6 @@ enum class LanguageFeature( ProperArrayConventionSetterWithDefaultCalls(KOTLIN_1_5, kind = OTHER), DisableCompatibilityModeForNewInference(KOTLIN_1_5, defaultState = LanguageFeature.State.DISABLED), AdaptedCallableReferenceAgainstReflectiveType(KOTLIN_1_5, defaultState = LanguageFeature.State.DISABLED), - ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated(KOTLIN_1_5, kind = BUG_FIX), InferenceCompatibility(KOTLIN_1_5, kind = BUG_FIX), RequiredPrimaryConstructorDelegationCallInEnums(KOTLIN_1_5, kind = BUG_FIX), ForbidAnonymousReturnTypesInPrivateInlineFunctions(KOTLIN_1_5, kind = BUG_FIX), @@ -149,6 +148,9 @@ enum class LanguageFeature( // Temporarily disabled, see KT-27084/KT-22379 SoundSmartcastFromLoopConditionForLoopAssignedVariables(sinceVersion = null, kind = BUG_FIX), + // Looks like we can't enable it until KT-26245 is fixed because otherwise some use cases become broken because of overrides + ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated(sinceVersion = null, kind = BUG_FIX), + // Experimental features Coroutines( From 775d610045d074e768cd0360c81ca7fc7d512c8c Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Wed, 9 Dec 2020 13:43:51 +0100 Subject: [PATCH 575/698] Value classes: Forbid any identity equality check on value class #KT-31130 Fixed --- .../expressions/BasicExpressionTypingVisitor.java | 6 +++--- .../identityComparisonWithInlineClasses.fir.kt | 7 +++++++ .../identityComparisonWithInlineClasses.kt | 13 ++++++++++--- .../identityComparisonWithValueClasses.fir.kt | 7 +++++++ .../identityComparisonWithValueClasses.kt | 13 ++++++++++--- .../forbiddenEqualsOnUnsignedTypes.kt | 2 +- 6 files changed, 38 insertions(+), 10 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java index fcf2b259c01..99fd1c63a4b 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java @@ -1110,13 +1110,13 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor { if (KotlinBuiltIns.isPrimitiveType(leftType)) { context.trace.report(DEPRECATED_IDENTITY_EQUALS.on(expression, leftType, rightType)); } - else if (InlineClassesUtilsKt.isInlineClassType(leftType)) { - context.trace.report(FORBIDDEN_IDENTITY_EQUALS.on(expression, leftType, rightType)); - } } else if (isIdentityComparedWithImplicitBoxing(leftType, rightType) || isIdentityComparedWithImplicitBoxing(rightType, leftType)) { context.trace.report(IMPLICIT_BOXING_IN_IDENTITY_EQUALS.on(expression, leftType, rightType)); } + if (InlineClassesUtilsKt.isInlineClassType(leftType) || InlineClassesUtilsKt.isInlineClassType(rightType)) { + context.trace.report(FORBIDDEN_IDENTITY_EQUALS.on(expression, leftType, rightType)); + } } private static boolean isIdentityComparedWithImplicitBoxing(KotlinType leftType, KotlinType rightType) { diff --git a/compiler/testData/diagnostics/tests/inlineClasses/identityComparisonWithInlineClasses.fir.kt b/compiler/testData/diagnostics/tests/inlineClasses/identityComparisonWithInlineClasses.fir.kt index b4e920e64a8..24566925dc7 100644 --- a/compiler/testData/diagnostics/tests/inlineClasses/identityComparisonWithInlineClasses.fir.kt +++ b/compiler/testData/diagnostics/tests/inlineClasses/identityComparisonWithInlineClasses.fir.kt @@ -12,4 +12,11 @@ fun test(f1: Foo, f2: Foo, b1: Bar, fn1: Foo?, fn2: Foo?) { val c1 = fn1 === fn2 || fn1 !== fn2 val c2 = f1 === fn1 || f1 !== fn1 val c3 = b1 === fn1 || b1 !== fn1 + + val any = Any() + + val d1 = any === f1 || any !== f1 + val d2 = f1 === any || f1 !== any + val d3 = any === fn1 || any !== fn1 + val d4 = fn1 === any || fn1 !== any } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inlineClasses/identityComparisonWithInlineClasses.kt b/compiler/testData/diagnostics/tests/inlineClasses/identityComparisonWithInlineClasses.kt index 9f7ed6e3eb9..82ee455bb16 100644 --- a/compiler/testData/diagnostics/tests/inlineClasses/identityComparisonWithInlineClasses.kt +++ b/compiler/testData/diagnostics/tests/inlineClasses/identityComparisonWithInlineClasses.kt @@ -7,9 +7,16 @@ inline class Bar(val y: String) fun test(f1: Foo, f2: Foo, b1: Bar, fn1: Foo?, fn2: Foo?) { val a1 = f1 === f2 || f1 !== f2 val a2 = f1 === f1 - val a3 = f1 === b1 || f1 !== b1 + val a3 = f1 === b1 || f1 !== b1 val c1 = fn1 === fn2 || fn1 !== fn2 - val c2 = f1 === fn1 || f1 !== fn1 - val c3 = b1 === fn1 || b1 !== fn1 + val c2 = f1 === fn1 || f1 !== fn1 + val c3 = b1 === fn1 || b1 !== fn1 + + val any = Any() + + val d1 = any === f1 || any !== f1 + val d2 = f1 === any || f1 !== any + val d3 = any === fn1 || any !== fn1 + val d4 = fn1 === any || fn1 !== any } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.fir.kt index 7adb195d541..dd27c6493d6 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.fir.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.fir.kt @@ -18,4 +18,11 @@ fun test(f1: Foo, f2: Foo, b1: Bar, fn1: Foo?, fn2: Foo?) { val c1 = fn1 === fn2 || fn1 !== fn2 val c2 = f1 === fn1 || f1 !== fn1 val c3 = b1 === fn1 || b1 !== fn1 + + val any = Any() + + val d1 = any === f1 || any !== f1 + val d2 = f1 === any || f1 !== any + val d3 = any === fn1 || any !== fn1 + val d4 = fn1 === any || fn1 !== any } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.kt b/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.kt index dff2b4db257..070d5e588e1 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.kt @@ -13,9 +13,16 @@ value class Bar(val y: String) fun test(f1: Foo, f2: Foo, b1: Bar, fn1: Foo?, fn2: Foo?) { val a1 = f1 === f2 || f1 !== f2 val a2 = f1 === f1 - val a3 = f1 === b1 || f1 !== b1 + val a3 = f1 === b1 || f1 !== b1 val c1 = fn1 === fn2 || fn1 !== fn2 - val c2 = f1 === fn1 || f1 !== fn1 - val c3 = b1 === fn1 || b1 !== fn1 + val c2 = f1 === fn1 || f1 !== fn1 + val c3 = b1 === fn1 || b1 !== fn1 + + val any = Any() + + val d1 = any === f1 || any !== f1 + val d2 = f1 === any || f1 !== any + val d3 = any === fn1 || any !== fn1 + val d4 = fn1 === any || fn1 !== any } \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithUnsignedTypes/forbiddenEqualsOnUnsignedTypes.kt b/compiler/testData/diagnostics/testsWithUnsignedTypes/forbiddenEqualsOnUnsignedTypes.kt index fe73b5e18cc..30c4dbbe163 100644 --- a/compiler/testData/diagnostics/testsWithUnsignedTypes/forbiddenEqualsOnUnsignedTypes.kt +++ b/compiler/testData/diagnostics/testsWithUnsignedTypes/forbiddenEqualsOnUnsignedTypes.kt @@ -11,7 +11,7 @@ fun test( val ui = ui1 === ui2 || ui1 !== ui2 val ul = ul1 === ul2 || ul1 !== ul2 - val u = ub1 === ul1 + val u = ub1 === ul1 val a1 = 1u === 2u || 1u !== 2u val a2 = 0xFFFF_FFFF_FFFF_FFFFu === 0xFFFF_FFFF_FFFF_FFFFu From dccfb33bcc9271aa3e3fe1a6d91d3d68e8785731 Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Wed, 9 Dec 2020 12:23:02 +0100 Subject: [PATCH 576/698] JVM_IR: Unbox argument of type kotlin.Result if the argument has different type in parent: either generic or Any. #KT-41163 Fixed #KT-43536 Fixed --- .../backend/jvm/codegen/ExpressionCodegen.kt | 20 +++++++++++++++++++ .../funInterface/result.kt | 2 -- .../unboxGenericParameter/lambda/result.kt | 2 -- .../objectLiteral/result.kt | 2 -- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt index d874cbca46c..2953928ced8 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt @@ -11,11 +11,13 @@ import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin import org.jetbrains.kotlin.backend.jvm.JvmLoweredStatementOrigin import org.jetbrains.kotlin.backend.jvm.intrinsics.IrIntrinsicMethods import org.jetbrains.kotlin.backend.jvm.intrinsics.JavaClassProperty +import org.jetbrains.kotlin.backend.jvm.ir.erasedUpperBound import org.jetbrains.kotlin.backend.jvm.lower.MultifileFacadeFileEntry import org.jetbrains.kotlin.backend.jvm.lower.constantValue import org.jetbrains.kotlin.backend.jvm.lower.inlineclasses.unboxInlineClass import org.jetbrains.kotlin.backend.jvm.lower.isMultifileBridge import org.jetbrains.kotlin.backend.jvm.lower.suspendFunctionOriginal +import org.jetbrains.kotlin.builtins.StandardNames import org.jetbrains.kotlin.codegen.* import org.jetbrains.kotlin.codegen.AsmUtil.* import org.jetbrains.kotlin.codegen.DescriptorAsmUtil.getNameForReceiverParameter @@ -628,9 +630,27 @@ class ExpressionCodegen( expression.markLineNumber(startOffset = true) val type = frameMap.typeOf(expression.symbol) mv.load(findLocalIndex(expression.symbol), type) + unboxResultIfNeeded(expression) return MaterialValue(this, type, expression.type) } + // We do not mangle functions if Result is the only parameter of the function, + // thus, if the function overrides generic parameter, its argument is boxed and there is no + // bridge to unbox it. Instead, we unbox it in the non-mangled function manually. + private fun unboxResultIfNeeded(arg: IrGetValue) { + if (arg.type.erasedUpperBound.fqNameWhenAvailable != StandardNames.RESULT_FQ_NAME) return + if (irFunction !is IrSimpleFunction) return + + val index = (arg.symbol as? IrValueParameterSymbol)?.owner?.index ?: return + val genericOrAnyOverride = irFunction.overriddenSymbols.any { + val overriddenParam = if (index < 0) it.owner.dispatchReceiverParameter!! else it.owner.valueParameters[index] + overriddenParam.type.erasedUpperBound.fqNameWhenAvailable != StandardNames.RESULT_FQ_NAME + } || irFunction.parentAsClass.origin == JvmLoweredDeclarationOrigin.LAMBDA_IMPL + if (!genericOrAnyOverride) return + + StackValue.unboxInlineClass(OBJECT_TYPE, arg.type.toIrBasedKotlinType(), mv) + } + override fun visitFieldAccess(expression: IrFieldAccessExpression, data: BlockInfo): PromisedValue { val callee = expression.symbol.owner if (context.state.shouldInlineConstVals) { diff --git a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/result.kt b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/result.kt index aace7ed01cc..4537fa84cf7 100644 --- a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/result.kt +++ b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/result.kt @@ -1,7 +1,5 @@ // !LANGUAGE: +InlineClasses // WITH_RUNTIME -// IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND_FIR: JVM_IR fun foo(a: Result): T = bar(a) { it.getOrThrow() diff --git a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/result.kt b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/result.kt index ea0c0dff3fd..38e8b625326 100644 --- a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/result.kt +++ b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/result.kt @@ -1,7 +1,5 @@ // !LANGUAGE: +InlineClasses // WITH_RUNTIME -// IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND_FIR: JVM_IR fun foo(a: Result): T = bar(a) { it.getOrThrow() diff --git a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/result.kt b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/result.kt index 9a0d8e7d0f9..23d285cae90 100644 --- a/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/result.kt +++ b/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/result.kt @@ -1,7 +1,5 @@ // !LANGUAGE: +InlineClasses // WITH_RUNTIME -// IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND_FIR: JVM_IR fun foo(a: Result): T = bar(a, object : IFace, T> { override fun call(ic: Result): T = ic.getOrThrow() From c8c83c04c081bd890d13229047b2c3ebae75279c Mon Sep 17 00:00:00 2001 From: LepilkinaElena Date: Thu, 10 Dec 2020 12:24:23 +0300 Subject: [PATCH 577/698] [IR] Fix saving function calls during inlining const properties in PropertyAccessorInlineLowering (#3971) --- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 +++ .../PropertyAccessorInlineLowering.kt | 21 +++++++++-- .../js/lower/BlockDecomposerLowering.kt | 2 +- .../js/lower/PropertyLazyInitLowering.kt | 2 +- .../backend/js/lower/TypeOperatorLowering.kt | 2 +- .../js/lower/cleanup/CleanupLowering.kt | 2 +- .../lower/coroutines/StateMachineBuilder.kt | 2 +- .../kotlin/ir/backend/js/utils/misc.kt | 35 ------------------- .../wasm/lower/WasmTypeOperatorLowering.kt | 2 +- .../org/jetbrains/kotlin/ir/util/IrUtils.kt | 35 +++++++++++++++++++ .../properties/const/constPropertyAccessor.kt | 22 ++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 5 +++ .../LightAnalysisModeTestGenerated.java | 5 +++ .../ir/IrBlackBoxCodegenTestGenerated.java | 5 +++ .../IrJsCodegenBoxES6TestGenerated.java | 5 +++ .../IrJsCodegenBoxTestGenerated.java | 5 +++ .../semantics/JsCodegenBoxTestGenerated.java | 5 +++ .../IrCodegenBoxWasmTestGenerated.java | 5 +++ 18 files changed, 121 insertions(+), 44 deletions(-) create mode 100644 compiler/testData/codegen/box/properties/const/constPropertyAccessor.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 20674d12e13..759fffebb75 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -21575,6 +21575,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/properties/const/constFlags.kt"); } + @TestMetadata("constPropertyAccessor.kt") + public void testConstPropertyAccessor() throws Exception { + runTest("compiler/testData/codegen/box/properties/const/constPropertyAccessor.kt"); + } + @TestMetadata("constValInAnnotationDefault.kt") public void testConstValInAnnotationDefault() throws Exception { runTest("compiler/testData/codegen/box/properties/const/constValInAnnotationDefault.kt"); diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/optimizations/PropertyAccessorInlineLowering.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/optimizations/PropertyAccessorInlineLowering.kt index d48efb021e9..dea400679fc 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/optimizations/PropertyAccessorInlineLowering.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/optimizations/PropertyAccessorInlineLowering.kt @@ -8,6 +8,8 @@ package org.jetbrains.kotlin.backend.common.lower.optimizations import org.jetbrains.kotlin.backend.common.BodyLoweringPass import org.jetbrains.kotlin.backend.common.CommonBackendContext import org.jetbrains.kotlin.backend.common.ir.isTopLevel +import org.jetbrains.kotlin.backend.common.lower.createIrBuilder +import org.jetbrains.kotlin.backend.common.lower.irBlock import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.descriptors.DescriptorVisibilities import org.jetbrains.kotlin.ir.declarations.* @@ -16,6 +18,7 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrGetFieldImpl import org.jetbrains.kotlin.ir.expressions.impl.IrSetFieldImpl import org.jetbrains.kotlin.ir.util.deepCopyWithSymbols import org.jetbrains.kotlin.ir.util.isEffectivelyExternal +import org.jetbrains.kotlin.ir.util.isPure import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid @@ -46,13 +49,25 @@ class PropertyAccessorInlineLowering(private val context: CommonBackendContext) } if (property.isEffectivelyExternal()) return expression + val backingField = property.backingField ?: return expression + if (property.isConst) { val initializer = - (property.backingField?.initializer ?: error("Constant property has to have a backing field with initializer")) - return initializer.expression.deepCopyWithSymbols() + (backingField.initializer ?: error("Constant property has to have a backing field with initializer")) + val constExpression = initializer.expression.deepCopyWithSymbols() + val receiver = expression.dispatchReceiver + if (receiver != null && !receiver.isPure(true)) { + val builder = context.createIrBuilder(expression.symbol, + expression.startOffset, expression.endOffset) + return builder.irBlock(expression) { + +receiver + +constExpression + } + } + return constExpression } - val backingField = property.backingField ?: return expression + if (property.getter === callee) { return tryInlineSimpleGetter(expression, callee, backingField) ?: expression diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/BlockDecomposerLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/BlockDecomposerLowering.kt index dec10d32c08..fb41a8dc6c1 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/BlockDecomposerLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/BlockDecomposerLowering.kt @@ -14,7 +14,7 @@ import org.jetbrains.kotlin.ir.IrStatement import org.jetbrains.kotlin.ir.backend.js.JsCommonBackendContext import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext import org.jetbrains.kotlin.ir.backend.js.ir.JsIrBuilder -import org.jetbrains.kotlin.ir.backend.js.utils.isPure +import org.jetbrains.kotlin.ir.util.isPure import org.jetbrains.kotlin.ir.builders.declarations.buildFun import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.* diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt index 3b186528117..23ef4a638dc 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt @@ -14,7 +14,7 @@ import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext import org.jetbrains.kotlin.ir.backend.js.ir.JsIrArithBuilder import org.jetbrains.kotlin.ir.backend.js.ir.JsIrBuilder -import org.jetbrains.kotlin.ir.backend.js.utils.isPure +import org.jetbrains.kotlin.ir.util.isPure import org.jetbrains.kotlin.ir.builders.declarations.addFunction import org.jetbrains.kotlin.ir.builders.declarations.buildField import org.jetbrains.kotlin.ir.declarations.* diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/TypeOperatorLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/TypeOperatorLowering.kt index 6d4a87f077f..314ad29428b 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/TypeOperatorLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/TypeOperatorLowering.kt @@ -10,7 +10,7 @@ import org.jetbrains.kotlin.ir.IrStatement import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext import org.jetbrains.kotlin.ir.backend.js.ir.JsIrArithBuilder import org.jetbrains.kotlin.ir.backend.js.ir.JsIrBuilder -import org.jetbrains.kotlin.ir.backend.js.utils.isPure +import org.jetbrains.kotlin.ir.util.isPure import org.jetbrains.kotlin.ir.declarations.IrClass import org.jetbrains.kotlin.ir.declarations.IrDeclaration import org.jetbrains.kotlin.ir.declarations.IrDeclarationParent diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/cleanup/CleanupLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/cleanup/CleanupLowering.kt index caae71e2b23..4311218d931 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/cleanup/CleanupLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/cleanup/CleanupLowering.kt @@ -8,7 +8,7 @@ package org.jetbrains.kotlin.ir.backend.js.lower.cleanup import org.jetbrains.kotlin.backend.common.BodyLoweringPass import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.IrStatement -import org.jetbrains.kotlin.ir.backend.js.utils.isPure +import org.jetbrains.kotlin.ir.util.isPure import org.jetbrains.kotlin.ir.declarations.IrDeclaration import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.types.isNothing diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/coroutines/StateMachineBuilder.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/coroutines/StateMachineBuilder.kt index 2f550983b31..b4f60caf748 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/coroutines/StateMachineBuilder.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/coroutines/StateMachineBuilder.kt @@ -15,7 +15,7 @@ import org.jetbrains.kotlin.ir.IrStatement import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.backend.js.JsCommonBackendContext import org.jetbrains.kotlin.ir.backend.js.ir.JsIrBuilder -import org.jetbrains.kotlin.ir.backend.js.utils.isPure +import org.jetbrains.kotlin.ir.util.isPure import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction import org.jetbrains.kotlin.ir.declarations.IrVariable import org.jetbrains.kotlin.ir.expressions.* diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/utils/misc.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/utils/misc.kt index ec756c0aba6..f80c95eb6cf 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/utils/misc.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/utils/misc.kt @@ -64,41 +64,6 @@ fun List.toJsArrayLiteral(context: JsIrBackendContext, arrayType: } } -// TODO: support more cases like built-in operator call and so on - -fun IrExpression?.isPure(anyVariable: Boolean, checkFields: Boolean = true): Boolean { - if (this == null) return true - - fun IrExpression.isPureImpl(): Boolean { - return when (this) { - is IrConst<*> -> true - is IrGetValue -> { - if (anyVariable) return true - val valueDeclaration = symbol.owner - if (valueDeclaration is IrVariable) !valueDeclaration.isVar - else true - } - is IrGetObjectValue -> type.isUnit() - else -> false - } - } - - if (isPureImpl()) return true - - if (!checkFields) return false - - if (this is IrGetField) { - if (!symbol.owner.isFinal) { - if (!anyVariable) { - return false - } - } - return receiver.isPure(anyVariable) - } - - return false -} - val IrValueDeclaration.isDispatchReceiver: Boolean get() { val parent = this.parent diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/WasmTypeOperatorLowering.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/WasmTypeOperatorLowering.kt index d567cbb98ef..d050028358f 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/WasmTypeOperatorLowering.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/WasmTypeOperatorLowering.kt @@ -13,7 +13,7 @@ import org.jetbrains.kotlin.backend.common.lower.createIrBuilder import org.jetbrains.kotlin.backend.common.lower.irNot import org.jetbrains.kotlin.backend.wasm.WasmBackendContext import org.jetbrains.kotlin.backend.wasm.ir2wasm.erasedUpperBound -import org.jetbrains.kotlin.ir.backend.js.utils.isPure +import org.jetbrains.kotlin.ir.util.isPure import org.jetbrains.kotlin.ir.builders.* import org.jetbrains.kotlin.ir.declarations.IrFile import org.jetbrains.kotlin.ir.declarations.IrTypeParameter diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/IrUtils.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/IrUtils.kt index 2d65573733f..d9c8cc74742 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/IrUtils.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/IrUtils.kt @@ -570,3 +570,38 @@ val IrFunction.originalFunction: IrFunction val IrProperty.originalProperty: IrProperty get() = attributeOwnerId as? IrProperty ?: this + +// TODO: support more cases like built-in operator call and so on + +fun IrExpression?.isPure(anyVariable: Boolean, checkFields: Boolean = true): Boolean { + if (this == null) return true + + fun IrExpression.isPureImpl(): Boolean { + return when (this) { + is IrConst<*> -> true + is IrGetValue -> { + if (anyVariable) return true + val valueDeclaration = symbol.owner + if (valueDeclaration is IrVariable) !valueDeclaration.isVar + else true + } + is IrGetObjectValue -> type.isUnit() + else -> false + } + } + + if (isPureImpl()) return true + + if (!checkFields) return false + + if (this is IrGetField) { + if (!symbol.owner.isFinal) { + if (!anyVariable) { + return false + } + } + return receiver.isPure(anyVariable) + } + + return false +} diff --git a/compiler/testData/codegen/box/properties/const/constPropertyAccessor.kt b/compiler/testData/codegen/box/properties/const/constPropertyAccessor.kt new file mode 100644 index 00000000000..538d1ec197f --- /dev/null +++ b/compiler/testData/codegen/box/properties/const/constPropertyAccessor.kt @@ -0,0 +1,22 @@ +// IGNORE_BACKEND: JVM_IR, JS, JS_IR_ES6 +// IGNORE_BACKEND_FIR: JVM_IR + +var a = 12 + +object C { + const val x = 42 +} + +fun getC(): C { + a = 123 + return C +} + +fun box(): String { + val field = getC().x + val expectedResult = 123 + if (a == expectedResult) + return "OK" + else + return "FAIL" +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 3bdffdca101..b443c0b47d6 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -21941,6 +21941,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/properties/const/constFlags.kt"); } + @TestMetadata("constPropertyAccessor.kt") + public void testConstPropertyAccessor() throws Exception { + runTest("compiler/testData/codegen/box/properties/const/constPropertyAccessor.kt"); + } + @TestMetadata("constValInAnnotationDefault.kt") public void testConstValInAnnotationDefault() throws Exception { runTest("compiler/testData/codegen/box/properties/const/constValInAnnotationDefault.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 488e065ea32..fde5ea803b4 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -21941,6 +21941,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/properties/const/constFlags.kt"); } + @TestMetadata("constPropertyAccessor.kt") + public void testConstPropertyAccessor() throws Exception { + runTest("compiler/testData/codegen/box/properties/const/constPropertyAccessor.kt"); + } + @TestMetadata("constValInAnnotationDefault.kt") public void testConstValInAnnotationDefault() throws Exception { runTest("compiler/testData/codegen/box/properties/const/constValInAnnotationDefault.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index f0f0882d326..b9587e1bd53 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -21575,6 +21575,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/properties/const/constFlags.kt"); } + @TestMetadata("constPropertyAccessor.kt") + public void testConstPropertyAccessor() throws Exception { + runTest("compiler/testData/codegen/box/properties/const/constPropertyAccessor.kt"); + } + @TestMetadata("constValInAnnotationDefault.kt") public void testConstValInAnnotationDefault() throws Exception { runTest("compiler/testData/codegen/box/properties/const/constValInAnnotationDefault.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index 16c667b847c..e3bbbe9f8fc 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -17735,6 +17735,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes public void testAnotherFile() throws Exception { runTest("compiler/testData/codegen/box/properties/const/anotherFile.kt"); } + + @TestMetadata("constPropertyAccessor.kt") + public void testConstPropertyAccessor() throws Exception { + runTest("compiler/testData/codegen/box/properties/const/constPropertyAccessor.kt"); + } } @TestMetadata("compiler/testData/codegen/box/properties/lateinit") diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 50ce36ce3e7..3ab7141df36 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -17735,6 +17735,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { public void testAnotherFile() throws Exception { runTest("compiler/testData/codegen/box/properties/const/anotherFile.kt"); } + + @TestMetadata("constPropertyAccessor.kt") + public void testConstPropertyAccessor() throws Exception { + runTest("compiler/testData/codegen/box/properties/const/constPropertyAccessor.kt"); + } } @TestMetadata("compiler/testData/codegen/box/properties/lateinit") diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index eb23ac83c59..dac1e1b5e89 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -17825,6 +17825,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { public void testAnotherFile() throws Exception { runTest("compiler/testData/codegen/box/properties/const/anotherFile.kt"); } + + @TestMetadata("constPropertyAccessor.kt") + public void testConstPropertyAccessor() throws Exception { + runTest("compiler/testData/codegen/box/properties/const/constPropertyAccessor.kt"); + } } @TestMetadata("compiler/testData/codegen/box/properties/lateinit") diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index 99bde8de4b9..0cb5cf7cafa 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -11216,6 +11216,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest public void testAnotherFile() throws Exception { runTest("compiler/testData/codegen/box/properties/const/anotherFile.kt"); } + + @TestMetadata("constPropertyAccessor.kt") + public void testConstPropertyAccessor() throws Exception { + runTest("compiler/testData/codegen/box/properties/const/constPropertyAccessor.kt"); + } } @TestMetadata("compiler/testData/codegen/box/properties/lateinit") From bf8de487a0552d0fce81e67d0fc2802bff0e8304 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 10 Dec 2020 09:36:54 +0300 Subject: [PATCH 578/698] CliTrace: rewrite smart cast-vulnerable piece of code --- .../jetbrains/kotlin/cli/jvm/compiler/CliTrace.kt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/CliTrace.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/CliTrace.kt index a7142eaf1e0..16a55f3edfb 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/CliTrace.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/CliTrace.kt @@ -77,15 +77,23 @@ open class CliBindingTrace @TestOnly constructor() : BindingTraceContext() { this.kotlinCodeAnalyzer = kotlinCodeAnalyzer } + @Suppress("UNCHECKED_CAST") override fun get(slice: ReadOnlySlice, key: K): V? { val value = super.get(slice, key) if (value == null) { - if (BindingContext.FUNCTION === slice || BindingContext.VARIABLE === slice) { - if (key is KtDeclaration) { + if (key is KtDeclaration) { + // NB: intentional code duplication, see https://youtrack.jetbrains.com/issue/KT-43296 + if (BindingContext.FUNCTION === slice) { if (!KtPsiUtil.isLocal(key)) { kotlinCodeAnalyzer!!.resolveToDescriptor(key) - return super.get(slice, key) + return super.get(slice, key) as V? + } + } + if (BindingContext.VARIABLE === slice) { + if (!KtPsiUtil.isLocal(key)) { + kotlinCodeAnalyzer!!.resolveToDescriptor(key) + return super.get(slice, key) as V? } } } From f88d51613fdae978f0a7dc3d4f401ef9b83b76cf Mon Sep 17 00:00:00 2001 From: Yunir Salimzyanov Date: Thu, 10 Dec 2020 07:32:08 +0300 Subject: [PATCH 579/698] Remove old 193 and as40 bunches --- .bunch | 2 -- 1 file changed, 2 deletions(-) diff --git a/.bunch b/.bunch index 951ad47e8be..67304541a87 100644 --- a/.bunch +++ b/.bunch @@ -1,6 +1,4 @@ 202 201 -193_201 -as40_193_201 as41_201 as42 \ No newline at end of file From bb0410b143bde6c0318490b424a3d8b4d64b1177 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 7 Dec 2020 12:08:19 +0300 Subject: [PATCH 580/698] [FIR] Drop unused utility functions from StandardTypes.kt --- .../kotlin/fir/symbols/StandardTypes.kt | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 compiler/fir/resolve/src/org/jetbrains/kotlin/fir/symbols/StandardTypes.kt diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/symbols/StandardTypes.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/symbols/StandardTypes.kt deleted file mode 100644 index f3e68c4a357..00000000000 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/symbols/StandardTypes.kt +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.fir.symbols - -import org.jetbrains.kotlin.fir.resolve.providers.FirSymbolProvider -import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol -import org.jetbrains.kotlin.name.ClassId - -val FirSymbolProvider.Any: FirClassLikeSymbol<*> get() = this.getClassLikeSymbolByFqName(StandardClassIds.Any)!! -val FirSymbolProvider.Nothing: FirClassLikeSymbol<*> get() = this.getClassLikeSymbolByFqName(StandardClassIds.Nothing)!! - -operator fun ClassId.invoke(symbolProvider: FirSymbolProvider): FirClassLikeSymbol<*> { - return symbolProvider.getClassLikeSymbolByFqName(this)!! -} From e344d9e4388947b6ee35c5c14d24afaa1d340644 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 7 Dec 2020 13:01:49 +0300 Subject: [PATCH 581/698] Drop unused functions from FirBuiltinSymbolProvider --- .../providers/impl/FirBuiltinSymbolProvider.kt | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirBuiltinSymbolProvider.kt b/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirBuiltinSymbolProvider.kt index 0ddaad82ffb..b58f0e01bbc 100644 --- a/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirBuiltinSymbolProvider.kt +++ b/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirBuiltinSymbolProvider.kt @@ -228,14 +228,6 @@ class FirBuiltinSymbolProvider(session: FirSession, val kotlinScopeProvider: Kot } } - // Find the symbol for "invoke" in the function class - private fun FunctionClassKind.getInvoke(arity: Int): FirNamedFunctionSymbol? { - val functionClass = getClassLikeSymbolByFqName(classId(arity)) ?: return null - val invoke = - functionClass.fir.declarations.find { it is FirSimpleFunction && it.name == OperatorNameConventions.INVOKE } ?: return null - return (invoke as FirSimpleFunction).symbol - } - private fun FunctionClassKind.classId(arity: Int) = ClassId(packageFqName, numberedClassName(arity)) @FirSymbolProviderInternals @@ -309,13 +301,5 @@ class FirBuiltinSymbolProvider(session: FirSession, val kotlinScopeProvider: Kot memberDeserializer.loadFunction(it).symbol } } - - fun getAllCallableNames(): Set { - return packageProto.`package`.functionList.mapTo(mutableSetOf()) { nameResolver.getName(it.name) } - } - - fun getAllClassNames(): Set { - return classDataFinder.allClassIds.mapTo(mutableSetOf()) { it.shortClassName } - } } } From d90cc452fe1598cc19bc137caca98a65f9e82100 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 7 Dec 2020 13:40:33 +0300 Subject: [PATCH 582/698] Simplify: FirSymbolProvider.getClassDeclaredPropertySymbols --- .../java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt | 6 +++--- .../KotlinDeserializedJvmSymbolsProvider.kt | 8 ++++---- .../kotlin/fir/resolve/providers/FirSymbolProvider.kt | 6 ++---- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt index 2d2d248a400..2559a9b40ac 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt @@ -25,7 +25,7 @@ import org.jetbrains.kotlin.fir.resolve.bindSymbolToLookupTag import org.jetbrains.kotlin.fir.resolve.defaultType import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeUnresolvedReferenceError import org.jetbrains.kotlin.fir.resolve.firSymbolProvider -import org.jetbrains.kotlin.fir.resolve.providers.getClassDeclaredCallableSymbols +import org.jetbrains.kotlin.fir.resolve.providers.getClassDeclaredPropertySymbols import org.jetbrains.kotlin.fir.resolve.toSymbol import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.expectedConeType import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.firUnsafe @@ -557,10 +557,10 @@ private fun JavaAnnotationArgument.toFirExpression( val classId = this@toFirExpression.enumClassId val entryName = this@toFirExpression.entryName val calleeReference = if (classId != null && entryName != null) { - val callableSymbol = session.firSymbolProvider.getClassDeclaredCallableSymbols( + val propertySymbol = session.firSymbolProvider.getClassDeclaredPropertySymbols( classId, entryName ).firstOrNull() - callableSymbol?.let { + propertySymbol?.let { buildResolvedNamedReference { name = entryName resolvedSymbol = it diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/deserialization/KotlinDeserializedJvmSymbolsProvider.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/deserialization/KotlinDeserializedJvmSymbolsProvider.kt index 8ad7c4262dc..71b8cf07540 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/deserialization/KotlinDeserializedJvmSymbolsProvider.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/deserialization/KotlinDeserializedJvmSymbolsProvider.kt @@ -197,16 +197,16 @@ class KotlinDeserializedJvmSymbolsProvider( private fun ClassId.toEnumEntryReferenceExpression(name: Name): FirExpression { return buildFunctionCall { - val entryCallableSymbol = - this@KotlinDeserializedJvmSymbolsProvider.session.firSymbolProvider.getClassDeclaredCallableSymbols( + val entryPropertySymbol = + this@KotlinDeserializedJvmSymbolsProvider.session.firSymbolProvider.getClassDeclaredPropertySymbols( this@toEnumEntryReferenceExpression, name, ).firstOrNull() calleeReference = when { - entryCallableSymbol != null -> { + entryPropertySymbol != null -> { buildResolvedNamedReference { this.name = name - resolvedSymbol = entryCallableSymbol + resolvedSymbol = entryPropertySymbol } } else -> { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/providers/FirSymbolProvider.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/providers/FirSymbolProvider.kt index c18913bc527..1763efbc62a 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/providers/FirSymbolProvider.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/providers/FirSymbolProvider.kt @@ -35,13 +35,11 @@ abstract class FirSymbolProvider(val session: FirSession) : FirSessionComponent abstract fun getPackage(fqName: FqName): FqName? // TODO: Replace to symbol sometime } -fun FirSymbolProvider.getClassDeclaredCallableSymbols(classId: ClassId, name: Name): List> { +fun FirSymbolProvider.getClassDeclaredPropertySymbols(classId: ClassId, name: Name): List> { val classSymbol = getClassLikeSymbolByFqName(classId) as? FirRegularClassSymbol ?: return emptyList() val declaredMemberScope = declaredMemberScope(classSymbol.fir) - val result = mutableListOf>() - declaredMemberScope.processFunctionsByName(name, result::add) + val result = mutableListOf>() declaredMemberScope.processPropertiesByName(name, result::add) - if (name == classId.shortClassName) declaredMemberScope.processDeclaredConstructors(result::add) return result } From 67c7b5ca0a844c393a72a4855cb57d829b857682 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 7 Dec 2020 13:48:59 +0300 Subject: [PATCH 583/698] Optimize/simplify FirAbstractImportingScope.getStaticsScope --- .../scopes/impl/FirAbstractImportingScope.kt | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirAbstractImportingScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirAbstractImportingScope.kt index 23ddb2458b9..525e5c16987 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirAbstractImportingScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirAbstractImportingScope.kt @@ -26,24 +26,32 @@ abstract class FirAbstractImportingScope( lookupInFir: Boolean ) : FirAbstractProviderBasedScope(session, lookupInFir) { - // TODO: Rewrite somehow? - fun getStaticsScope(classId: ClassId): FirScope? { - val symbol = provider.getClassLikeSymbolByFqName(classId) ?: return null + private fun getStaticsScope(symbol: FirClassLikeSymbol<*>): FirScope? { if (symbol is FirTypeAliasSymbol) { val expansionSymbol = symbol.fir.expandedConeType?.lookupTag?.toSymbol(session) if (expansionSymbol != null) { - return getStaticsScope(expansionSymbol.classId) + return getStaticsScope(expansionSymbol) } } else { val firClass = (symbol as FirClassSymbol<*>).fir - return if (firClass.classKind == ClassKind.OBJECT) - FirObjectImportedCallableScope(classId, firClass.unsubstitutedScope(session, scopeSession, withForcedTypeCalculator = false)) - else + return if (firClass.classKind == ClassKind.OBJECT) { + FirObjectImportedCallableScope( + symbol.classId, + firClass.unsubstitutedScope(session, scopeSession, withForcedTypeCalculator = false) + ) + } else { firClass.scopeProvider.getStaticScope(firClass, session, scopeSession) + } } return null + + } + + fun getStaticsScope(classId: ClassId): FirScope? { + val symbol = provider.getClassLikeSymbolByFqName(classId) ?: return null + return getStaticsScope(symbol) } protected fun > processCallables( @@ -79,7 +87,6 @@ abstract class FirAbstractImportingScope( processor(symbol) } } - } abstract fun > processCallables( From 7e99f0ee2381f4f9d5c5061202c36ec77f8f3cdf Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 7 Dec 2020 14:46:28 +0300 Subject: [PATCH 584/698] Optimize ConeInferenceContext.typeDepth a bit --- .../kotlin/fir/types/ConeInferenceContext.kt | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/ConeInferenceContext.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/ConeInferenceContext.kt index d5d683b683c..71ab78fc4c2 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/ConeInferenceContext.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/ConeInferenceContext.kt @@ -121,6 +121,13 @@ interface ConeInferenceContext : TypeSystemInferenceExtensionContext, ConeTypeCo require(this is ConeKotlinType) // if (this is TypeUtils.SpecialType) return 0 // TODO: WTF? + if (this is ConeClassLikeType) { + val fullyExpanded = fullyExpandedType(session) + if (this !== fullyExpanded) { + return fullyExpanded.typeDepth() + } + } + var maxArgumentDepth = 0 for (arg in typeArguments) { val current = if (arg is ConeStarProjection) 1 else (arg as ConeKotlinTypeProjection).type.typeDepth() @@ -129,19 +136,7 @@ interface ConeInferenceContext : TypeSystemInferenceExtensionContext, ConeTypeCo } } - var result = maxArgumentDepth + 1 - - if (this is ConeClassLikeType) { - val fullyExpanded = fullyExpandedType(session) - if (this !== fullyExpanded) { - val fullyExpandedTypeDepth = fullyExpanded.typeDepth() - if (fullyExpandedTypeDepth > result) { - result = fullyExpandedTypeDepth - } - } - } - - return result + return maxArgumentDepth + 1 } override fun KotlinTypeMarker.contains(predicate: (KotlinTypeMarker) -> Boolean): Boolean { From 1383e923ea910bd5ea11cccdcb90f11c09ea2875 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 7 Dec 2020 13:29:50 +0300 Subject: [PATCH 585/698] Drop KotlinDeserializedJvmSymbolsProvider.findRegularClass --- .../deserialization/KotlinDeserializedJvmSymbolsProvider.kt | 3 --- 1 file changed, 3 deletions(-) diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/deserialization/KotlinDeserializedJvmSymbolsProvider.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/deserialization/KotlinDeserializedJvmSymbolsProvider.kt index 71b8cf07540..f29d3e8cfc2 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/deserialization/KotlinDeserializedJvmSymbolsProvider.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/deserialization/KotlinDeserializedJvmSymbolsProvider.kt @@ -401,8 +401,5 @@ class KotlinDeserializedJvmSymbolsProvider( }!! } - private fun findRegularClass(classId: ClassId): FirRegularClass? = - getClassLikeSymbolByFqName(classId)?.fir as? FirRegularClass - override fun getPackage(fqName: FqName): FqName? = null } From e51503ab420b6bd341d9f3806adaa1a41844c8bf Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 7 Dec 2020 13:56:24 +0300 Subject: [PATCH 586/698] Code cleanup: KotlinDeserializedJvmSymbolsProvider --- .../KotlinDeserializedJvmSymbolsProvider.kt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/deserialization/KotlinDeserializedJvmSymbolsProvider.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/deserialization/KotlinDeserializedJvmSymbolsProvider.kt index f29d3e8cfc2..2795cb4a208 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/deserialization/KotlinDeserializedJvmSymbolsProvider.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/deserialization/KotlinDeserializedJvmSymbolsProvider.kt @@ -73,7 +73,6 @@ class KotlinDeserializedJvmSymbolsProvider( private class PackagePartsCacheData( val proto: ProtoBuf.Package, val context: FirDeserializationContext, - val source: JvmPackagePartSource, ) { val topLevelFunctionNameIndex by lazy { proto.functionList.withIndex() @@ -130,7 +129,6 @@ class KotlinDeserializedJvmSymbolsProvider( FirConstDeserializer(session, facadeBinaryClass ?: kotlinJvmBinaryClass), source ), - source, ) } } @@ -176,7 +174,7 @@ class KotlinDeserializedJvmSymbolsProvider( private fun loadAnnotation( annotationClassId: ClassId, result: MutableList, - ): KotlinJvmBinaryClass.AnnotationArgumentVisitor? { + ): KotlinJvmBinaryClass.AnnotationArgumentVisitor { val lookupTag = ConeClassLikeLookupTagImpl(annotationClassId) return object : KotlinJvmBinaryClass.AnnotationArgumentVisitor { @@ -231,7 +229,7 @@ class KotlinDeserializedJvmSymbolsProvider( argumentMap[name] = enumClassId.toEnumEntryReferenceExpression(enumEntryName) } - override fun visitArray(name: Name): AnnotationArrayArgumentVisitor? { + override fun visitArray(name: Name): AnnotationArrayArgumentVisitor { return object : AnnotationArrayArgumentVisitor { private val elements = mutableListOf() @@ -261,9 +259,9 @@ class KotlinDeserializedJvmSymbolsProvider( } } - override fun visitAnnotation(name: Name, classId: ClassId): KotlinJvmBinaryClass.AnnotationArgumentVisitor? { + override fun visitAnnotation(name: Name, classId: ClassId): KotlinJvmBinaryClass.AnnotationArgumentVisitor { val list = mutableListOf() - val visitor = loadAnnotation(classId, list)!! + val visitor = loadAnnotation(classId, list) return object : KotlinJvmBinaryClass.AnnotationArgumentVisitor by visitor { override fun visitEnd() { visitor.visitEnd() From 7b277600a943330e95c40ef04a6f5cbf871a73f7 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 8 Dec 2020 13:10:30 +0300 Subject: [PATCH 587/698] Optimize/simplify loadFunctions(Properties)ByName in FIR deserializer --- .../KotlinDeserializedJvmSymbolsProvider.kt | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/deserialization/KotlinDeserializedJvmSymbolsProvider.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/deserialization/KotlinDeserializedJvmSymbolsProvider.kt index 2795cb4a208..191135f168a 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/deserialization/KotlinDeserializedJvmSymbolsProvider.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/deserialization/KotlinDeserializedJvmSymbolsProvider.kt @@ -12,7 +12,6 @@ import org.jetbrains.kotlin.descriptors.SourceElement import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.ThreadSafeMutableState import org.jetbrains.kotlin.fir.declarations.* -import org.jetbrains.kotlin.fir.declarations.impl.FirSimpleFunctionImpl import org.jetbrains.kotlin.fir.deserialization.FirConstDeserializer import org.jetbrains.kotlin.fir.deserialization.FirDeserializationContext import org.jetbrains.kotlin.fir.deserialization.deserializeClassToSymbol @@ -366,20 +365,16 @@ class KotlinDeserializedJvmSymbolsProvider( private fun loadFunctionsByName(part: PackagePartsCacheData, name: Name): List> { val functionIds = part.topLevelFunctionNameIndex[name] ?: return emptyList() - return functionIds.map { part.proto.getFunction(it) } - .map { - val firNamedFunction = part.context.memberDeserializer.loadFunction(it) as FirSimpleFunctionImpl - firNamedFunction.symbol - } + return functionIds.map { + part.context.memberDeserializer.loadFunction(part.proto.getFunction(it)).symbol + } } private fun loadPropertiesByName(part: PackagePartsCacheData, name: Name): List> { val propertyIds = part.topLevelPropertyNameIndex[name] ?: return emptyList() - return propertyIds.map { part.proto.getProperty(it) } - .map { - val firProperty = part.context.memberDeserializer.loadProperty(it) - firProperty.symbol - } + return propertyIds.map { + part.context.memberDeserializer.loadProperty(part.proto.getProperty(it)).symbol + } } @FirSymbolProviderInternals From af4941b222df54fa24a9e5bb4f88c1955dd49a10 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 8 Dec 2020 13:25:30 +0300 Subject: [PATCH 588/698] [FIR] Drop delayedNode from ControlFlowGraph.orderNodes --- .../jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraph.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraph.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraph.kt index c328c199bf2..7d21f20d2de 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraph.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraph.kt @@ -155,19 +155,17 @@ enum class EdgeKind( @OptIn(ExperimentalStdlibApi::class) private fun ControlFlowGraph.orderNodes(): LinkedHashSet> { - val visitedNodes = LinkedHashSet>() + val visitedNodes = linkedSetOf>() /* * [delayedNodes] is needed to accomplish next order contract: * for each node all previous node lays before it */ - val delayedNodes = LinkedHashSet>() val stack = ArrayDeque>() stack.addFirst(enterNode) while (stack.isNotEmpty()) { val node = stack.removeFirst() val previousNodes = node.previousNodes if (previousNodes.any { it !in visitedNodes && it.owner == this && !node.incomingEdges.getValue(it).kind.isBack }) { - delayedNodes.add(node) stack.addLast(node) continue } From 34d7a7c184824e87a15bc95476d596d51352eb11 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 9 Dec 2020 22:01:51 +0300 Subject: [PATCH 589/698] FIR tower levels: inline processElementsByName[AndStoreResult] --- .../resolve/calls/tower/TowerLevelHandler.kt | 51 +------ .../fir/resolve/calls/tower/TowerLevels.kt | 127 ++++++++++-------- 2 files changed, 80 insertions(+), 98 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevelHandler.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevelHandler.kt index 754b641da99..8b8042e77aa 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevelHandler.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevelHandler.kt @@ -53,17 +53,18 @@ internal class TowerLevelHandler { when (info.callKind) { CallKind.VariableAccess -> { - towerLevel.processProperties(info.name, processor) + processResult += towerLevel.processPropertiesByName(info.name, processor) - if (!collector.isSuccess()) { - towerLevel.processObjectsAsVariables(info.name, processor) + if (!collector.isSuccess() && towerLevel is ScopeTowerLevel && towerLevel.extensionReceiver == null) { + processResult += towerLevel.processObjectsByName(info.name, processor) } } CallKind.Function -> { - towerLevel.processFunctions(info.name, processor) + processResult += towerLevel.processFunctionsByName(info.name, processor) } CallKind.CallableReference -> { - towerLevel.processFunctionsAndProperties(info.name, processor) + processResult += towerLevel.processFunctionsByName(info.name, processor) + processResult += towerLevel.processPropertiesByName(info.name, processor) } else -> { throw AssertionError("Unsupported call kind in tower resolver: ${info.callKind}") @@ -71,46 +72,6 @@ internal class TowerLevelHandler { } return processResult } - - private fun TowerScopeLevel.processProperties( - name: Name, - processor: TowerScopeLevel.TowerScopeLevelProcessor> - ) { - processElementsByNameAndStoreResult(TowerScopeLevel.Token.Properties, name, processor) - } - - private fun TowerScopeLevel.processFunctions( - name: Name, - processor: TowerScopeLevel.TowerScopeLevelProcessor> - ) { - processElementsByNameAndStoreResult(TowerScopeLevel.Token.Functions, name, processor) - } - - private fun TowerScopeLevel.processFunctionsAndProperties( - name: Name, processor: TowerScopeLevel.TowerScopeLevelProcessor> - ) { - processFunctions(name, processor) - processProperties(name, processor) - } - - private fun TowerScopeLevel.processObjectsAsVariables( - name: Name, processor: TowerScopeLevel.TowerScopeLevelProcessor> - ) { - // Skipping objects when extension receiver is bound to the level - if (this is ScopeTowerLevel && this.extensionReceiver != null) return - - processElementsByNameAndStoreResult(TowerScopeLevel.Token.Objects, name, processor) - } - - private fun > TowerScopeLevel.processElementsByNameAndStoreResult( - token: TowerScopeLevel.Token, - name: Name, - processor: TowerScopeLevel.TowerScopeLevelProcessor - ): ProcessorAction { - return processElementsByName(token, name, processor).also { - processResult += it - } - } } private class TowerScopeLevelProcessor( diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevels.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevels.kt index e5e11b61a25..0cc7ded84cd 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevels.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevels.kt @@ -31,13 +31,13 @@ interface TowerScopeLevel { object Objects : Token>() } - fun > processElementsByName( - token: Token, - name: Name, - processor: TowerScopeLevelProcessor - ): ProcessorAction + fun processFunctionsByName(name: Name, processor: TowerScopeLevelProcessor>): ProcessorAction - interface TowerScopeLevelProcessor> { + fun processPropertiesByName(name: Name, processor: TowerScopeLevelProcessor>): ProcessorAction + + fun processObjectsByName(name: Name, processor: TowerScopeLevelProcessor>): ProcessorAction + + interface TowerScopeLevelProcessor> { fun consumeCandidate( symbol: T, dispatchReceiverValue: ReceiverValue?, @@ -115,38 +115,47 @@ class MemberScopeTowerLevel( return if (empty) ProcessorAction.NONE else ProcessorAction.NEXT } - override fun > processElementsByName( - token: TowerScopeLevel.Token, + override fun processFunctionsByName( name: Name, - processor: TowerScopeLevel.TowerScopeLevelProcessor + processor: TowerScopeLevel.TowerScopeLevelProcessor> ): ProcessorAction { - val isInvoke = name == OperatorNameConventions.INVOKE && token == TowerScopeLevel.Token.Functions + val isInvoke = name == OperatorNameConventions.INVOKE if (implicitExtensionInvokeMode && !isInvoke) { return ProcessorAction.NEXT } - return when (token) { - is TowerScopeLevel.Token.Properties -> processMembers(processor) { consumer -> - this.processPropertiesByName(name) { + return processMembers(processor) { consumer -> + this.processFunctionsAndConstructorsByName( + name, session, bodyResolveComponents, + includeInnerConstructors = true, + processor = { // WARNING, DO NOT CAST FUNCTIONAL TYPE ITSELF @Suppress("UNCHECKED_CAST") - consumer(it as T) + consumer(it as FirFunctionSymbol<*>) } - } - TowerScopeLevel.Token.Functions -> processMembers(processor) { consumer -> - this.processFunctionsAndConstructorsByName( - name, session, bodyResolveComponents, - includeInnerConstructors = true, - processor = { - // WARNING, DO NOT CAST FUNCTIONAL TYPE ITSELF - @Suppress("UNCHECKED_CAST") - consumer(it as T) - } - ) - } - TowerScopeLevel.Token.Objects -> ProcessorAction.NEXT + ) } } + override fun processPropertiesByName( + name: Name, + processor: TowerScopeLevel.TowerScopeLevelProcessor> + ): ProcessorAction { + return processMembers(processor) { consumer -> + this.processPropertiesByName(name) { + // WARNING, DO NOT CAST FUNCTIONAL TYPE ITSELF + @Suppress("UNCHECKED_CAST") + consumer(it) + } + } + } + + override fun processObjectsByName( + name: Name, + processor: TowerScopeLevel.TowerScopeLevelProcessor> + ): ProcessorAction { + return ProcessorAction.NEXT + } + override fun replaceReceiverValue(receiverValue: ReceiverValue): SessionBasedTowerLevel { return MemberScopeTowerLevel( session, bodyResolveComponents, receiverValue, extensionReceiver, implicitExtensionInvokeMode, scopeSession @@ -222,35 +231,47 @@ class ScopeTowerLevel( } } - override fun > processElementsByName( - token: TowerScopeLevel.Token, + override fun processFunctionsByName( name: Name, - processor: TowerScopeLevel.TowerScopeLevelProcessor + processor: TowerScopeLevel.TowerScopeLevelProcessor> ): ProcessorAction { var empty = true - @Suppress("UNCHECKED_CAST") - when (token) { - TowerScopeLevel.Token.Properties -> scope.processPropertiesByName(name) { candidate -> - empty = false - consumeCallableCandidate(candidate, processor) - } - TowerScopeLevel.Token.Functions -> scope.processFunctionsAndConstructorsByName( - name, - session, - bodyResolveComponents, - includeInnerConstructors = includeInnerConstructors - ) { candidate -> - empty = false - consumeCallableCandidate(candidate, processor) - } - TowerScopeLevel.Token.Objects -> scope.processClassifiersByName(name) { - empty = false - processor.consumeCandidate( - it as T, dispatchReceiverValue = null, - extensionReceiverValue = null, - scope = scope - ) - } + scope.processFunctionsAndConstructorsByName( + name, + session, + bodyResolveComponents, + includeInnerConstructors = includeInnerConstructors + ) { candidate -> + empty = false + consumeCallableCandidate(candidate, processor) + } + return if (empty) ProcessorAction.NONE else ProcessorAction.NEXT + } + + override fun processPropertiesByName( + name: Name, + processor: TowerScopeLevel.TowerScopeLevelProcessor> + ): ProcessorAction { + var empty = true + scope.processPropertiesByName(name) { candidate -> + empty = false + consumeCallableCandidate(candidate, processor) + } + return if (empty) ProcessorAction.NONE else ProcessorAction.NEXT + } + + override fun processObjectsByName( + name: Name, + processor: TowerScopeLevel.TowerScopeLevelProcessor> + ): ProcessorAction { + var empty = true + scope.processClassifiersByName(name) { + empty = false + processor.consumeCandidate( + it, dispatchReceiverValue = null, + extensionReceiverValue = null, + scope = scope + ) } return if (empty) ProcessorAction.NONE else ProcessorAction.NEXT } From 6d545fc281dfdc8fcd2774a4da08e8f7985c3ad5 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 9 Dec 2020 22:14:49 +0300 Subject: [PATCH 590/698] Make FirTowerLevel an abstract class --- .../fir/resolve/calls/tower/TowerLevels.kt | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevels.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevels.kt index 0cc7ded84cd..5912506b72c 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevels.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevels.kt @@ -23,7 +23,7 @@ import org.jetbrains.kotlin.fir.types.ConeClassLikeType import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.util.OperatorNameConventions -interface TowerScopeLevel { +abstract class TowerScopeLevel { sealed class Token> { object Properties : Token>() @@ -31,11 +31,11 @@ interface TowerScopeLevel { object Objects : Token>() } - fun processFunctionsByName(name: Name, processor: TowerScopeLevelProcessor>): ProcessorAction + abstract fun processFunctionsByName(name: Name, processor: TowerScopeLevelProcessor>): ProcessorAction - fun processPropertiesByName(name: Name, processor: TowerScopeLevelProcessor>): ProcessorAction + abstract fun processPropertiesByName(name: Name, processor: TowerScopeLevelProcessor>): ProcessorAction - fun processObjectsByName(name: Name, processor: TowerScopeLevelProcessor>): ProcessorAction + abstract fun processObjectsByName(name: Name, processor: TowerScopeLevelProcessor>): ProcessorAction interface TowerScopeLevelProcessor> { fun consumeCandidate( @@ -48,7 +48,7 @@ interface TowerScopeLevel { } } -abstract class SessionBasedTowerLevel(val session: FirSession) : TowerScopeLevel { +abstract class SessionBasedTowerLevel(val session: FirSession) : TowerScopeLevel() { protected fun FirCallableSymbol<*>.hasConsistentExtensionReceiver(extensionReceiver: Receiver?): Boolean { return (extensionReceiver != null) == hasExtensionReceiver() } @@ -71,7 +71,7 @@ class MemberScopeTowerLevel( private val scopeSession: ScopeSession ) : SessionBasedTowerLevel(session) { private fun > processMembers( - output: TowerScopeLevel.TowerScopeLevelProcessor, + output: TowerScopeLevelProcessor, processScopeMembers: FirScope.(processor: (T) -> Unit) -> Unit ): ProcessorAction { var empty = true @@ -117,7 +117,7 @@ class MemberScopeTowerLevel( override fun processFunctionsByName( name: Name, - processor: TowerScopeLevel.TowerScopeLevelProcessor> + processor: TowerScopeLevelProcessor> ): ProcessorAction { val isInvoke = name == OperatorNameConventions.INVOKE if (implicitExtensionInvokeMode && !isInvoke) { @@ -138,7 +138,7 @@ class MemberScopeTowerLevel( override fun processPropertiesByName( name: Name, - processor: TowerScopeLevel.TowerScopeLevelProcessor> + processor: TowerScopeLevelProcessor> ): ProcessorAction { return processMembers(processor) { consumer -> this.processPropertiesByName(name) { @@ -151,7 +151,7 @@ class MemberScopeTowerLevel( override fun processObjectsByName( name: Name, - processor: TowerScopeLevel.TowerScopeLevelProcessor> + processor: TowerScopeLevelProcessor> ): ProcessorAction { return ProcessorAction.NEXT } @@ -217,7 +217,7 @@ class ScopeTowerLevel( private fun > consumeCallableCandidate( candidate: FirCallableSymbol<*>, - processor: TowerScopeLevel.TowerScopeLevelProcessor + processor: TowerScopeLevelProcessor ) { if (candidate.hasConsistentReceivers(extensionReceiver)) { val dispatchReceiverValue = dispatchReceiverValue(candidate) @@ -233,7 +233,7 @@ class ScopeTowerLevel( override fun processFunctionsByName( name: Name, - processor: TowerScopeLevel.TowerScopeLevelProcessor> + processor: TowerScopeLevelProcessor> ): ProcessorAction { var empty = true scope.processFunctionsAndConstructorsByName( @@ -250,7 +250,7 @@ class ScopeTowerLevel( override fun processPropertiesByName( name: Name, - processor: TowerScopeLevel.TowerScopeLevelProcessor> + processor: TowerScopeLevelProcessor> ): ProcessorAction { var empty = true scope.processPropertiesByName(name) { candidate -> @@ -262,7 +262,7 @@ class ScopeTowerLevel( override fun processObjectsByName( name: Name, - processor: TowerScopeLevel.TowerScopeLevelProcessor> + processor: TowerScopeLevelProcessor> ): ProcessorAction { var empty = true scope.processClassifiersByName(name) { From dd66da7c654f93a159183c46ce0ef3eaeabcbd7f Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 10 Dec 2020 11:25:59 +0300 Subject: [PATCH 591/698] Optimize FirJavaSyntheticNamesProvider.possibleGetterNamesByPropertyName --- .../resolve/FirJavaSyntheticNamesProvider.kt | 50 +++++++++++++++---- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/compiler/fir/jvm/src/org/jetbrains/kotlin/fir/resolve/FirJavaSyntheticNamesProvider.kt b/compiler/fir/jvm/src/org/jetbrains/kotlin/fir/resolve/FirJavaSyntheticNamesProvider.kt index f820ac38670..4071a0932dd 100644 --- a/compiler/fir/jvm/src/org/jetbrains/kotlin/fir/resolve/FirJavaSyntheticNamesProvider.kt +++ b/compiler/fir/jvm/src/org/jetbrains/kotlin/fir/resolve/FirJavaSyntheticNamesProvider.kt @@ -7,10 +7,9 @@ package org.jetbrains.kotlin.fir.resolve import org.jetbrains.kotlin.fir.NoMutableState import org.jetbrains.kotlin.fir.resolve.calls.FirSyntheticNamesProvider -import org.jetbrains.kotlin.load.java.propertyNameByGetMethodName import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeAsciiOnly -import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeFirstWord +import org.jetbrains.kotlin.util.capitalizeDecapitalize.toUpperCaseAsciiOnly @NoMutableState object FirJavaSyntheticNamesProvider : FirSyntheticNamesProvider() { @@ -18,18 +17,49 @@ object FirJavaSyntheticNamesProvider : FirSyntheticNamesProvider() { private const val SETTER_PREFIX = "set" private const val IS_PREFIX = "is" + @Suppress("NOTHING_TO_INLINE") + private inline fun Char.isAsciiUpperCase() = this in 'A'..'Z' + + @Suppress("NOTHING_TO_INLINE") + private inline fun Char.isAsciiLowerCase() = this in 'a'..'z' + override fun possibleGetterNamesByPropertyName(name: Name): List { if (name.isSpecial) return emptyList() val identifier = name.identifier - val capitalizedAsciiName = identifier.capitalizeAsciiOnly() - val capitalizedFirstWordName = identifier.capitalizeFirstWord(asciiOnly = true) - return listOfNotNull( - Name.identifier(GETTER_PREFIX + capitalizedAsciiName), - if (capitalizedFirstWordName == capitalizedAsciiName) null else Name.identifier(GETTER_PREFIX + capitalizedFirstWordName), - name.takeIf { identifier.startsWith(IS_PREFIX) } - ).filter { - propertyNameByGetMethodName(it) == name + if (identifier.isEmpty()) return emptyList() + val result = ArrayList(3) + val standardName = Name.identifier(GETTER_PREFIX + identifier.capitalizeAsciiOnly()) + val length = identifier.length + if (length == 1) { + if (identifier[0].isAsciiLowerCase()) { + // 'x' --> 'getX' but not 'X' --> 'getX' + result += standardName + } + } else if (identifier[1].isAsciiLowerCase()) { + if (identifier[0].isAsciiLowerCase()) { + // 'something' --> 'getSomething' classic case + result += standardName + } + var secondWordStart = 2 + while (secondWordStart < length && identifier[secondWordStart].isAsciiLowerCase()) { + secondWordStart++ + } + val capitalizedFirstWordName = Name.identifier( + GETTER_PREFIX + identifier.substring(0, secondWordStart).toUpperCaseAsciiOnly() + identifier.substring(secondWordStart) + ) + if (secondWordStart >= length || identifier[secondWordStart].isAsciiUpperCase()) { + // 'xyz' --> 'getXYZ' or 'xyzOfSomething' --> 'getXYZOfSomething' + result += capitalizedFirstWordName + } + } else if (length < 3 || !identifier[2].isAsciiUpperCase()) { + // 'xOfSomething' --> 'getXOfSomething' but not 'xYZ' --> 'getXYZ' + result += standardName } + if (length > IS_PREFIX.length && identifier.startsWith(IS_PREFIX) && !identifier[IS_PREFIX.length].isAsciiLowerCase()) { + // 'isSomething' (but not 'is' or 'issomething') + result += name + } + return result } override fun setterNameByGetterName(name: Name): Name? { From f4a25066a8d391c2b23e0e7da31e6b90242de14f Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Thu, 10 Dec 2020 16:15:10 +0300 Subject: [PATCH 592/698] Fix freshly added CLI tests for windows agents --- compiler/testData/cli/jvm/jvmRecordOk.args | 2 +- compiler/testData/cli/jvm/jvmRecordWrongTarget.args | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/testData/cli/jvm/jvmRecordOk.args b/compiler/testData/cli/jvm/jvmRecordOk.args index 8e284011c5e..9d635ef6d36 100644 --- a/compiler/testData/cli/jvm/jvmRecordOk.args +++ b/compiler/testData/cli/jvm/jvmRecordOk.args @@ -7,7 +7,7 @@ $TEMP_DIR$ 1.5 -jdk-home $JDK_15$ --XXLanguage:+JvmRecordSupport +-XXLanguage\:+JvmRecordSupport -Xjvm-enable-preview -jvm-target 15 diff --git a/compiler/testData/cli/jvm/jvmRecordWrongTarget.args b/compiler/testData/cli/jvm/jvmRecordWrongTarget.args index e650dcec31e..3848a851905 100644 --- a/compiler/testData/cli/jvm/jvmRecordWrongTarget.args +++ b/compiler/testData/cli/jvm/jvmRecordWrongTarget.args @@ -7,6 +7,6 @@ $TEMP_DIR$ 1.5 -jdk-home $JDK_15$ --XXLanguage:+JvmRecordSupport +-XXLanguage\:+JvmRecordSupport -jvm-target 9 From b0ef6ee1fc5fc13c011204bdde5f99566db9174f Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Thu, 10 Dec 2020 14:34:20 +0300 Subject: [PATCH 593/698] JVM_IR Minor: refactor rawType --- .../org/jetbrains/kotlin/backend/jvm/ir/IrUtils.kt | 12 ++---------- .../jvm/lower/JvmSingleAbstractMethodLowering.kt | 7 +++---- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/ir/IrUtils.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/ir/IrUtils.kt index 10b77a303ae..e0839712178 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/ir/IrUtils.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/ir/IrUtils.kt @@ -387,13 +387,5 @@ private fun JvmBackendContext.makeRawTypeAnnotation() = generatorExtensions.rawTypeAnnotationConstructor.symbol ) -fun IrClassSymbol.rawDefaultType(context: JvmBackendContext): IrType = - this.defaultType.addAnnotations(listOf(context.makeRawTypeAnnotation())) - -fun IrClassSymbol.rawStarProjectedType(context: JvmBackendContext): IrSimpleType = - IrSimpleTypeImpl( - this, - hasQuestionMark = false, - arguments = owner.typeParameters.map { IrStarProjectionImpl }, - annotations = listOf(context.makeRawTypeAnnotation()) - ) +fun IrClass.rawType(context: JvmBackendContext): IrType = + defaultType.addAnnotations(listOf(context.makeRawTypeAnnotation())) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmSingleAbstractMethodLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmSingleAbstractMethodLowering.kt index fb52c2f5aea..4266d0ac37f 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmSingleAbstractMethodLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmSingleAbstractMethodLowering.kt @@ -10,8 +10,7 @@ import org.jetbrains.kotlin.backend.common.lower.SingleAbstractMethodLowering import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase import org.jetbrains.kotlin.backend.jvm.JvmBackendContext import org.jetbrains.kotlin.backend.jvm.ir.erasedUpperBound -import org.jetbrains.kotlin.backend.jvm.ir.rawDefaultType -import org.jetbrains.kotlin.backend.jvm.ir.rawStarProjectedType +import org.jetbrains.kotlin.backend.jvm.ir.rawType import org.jetbrains.kotlin.descriptors.DescriptorVisibilities import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET @@ -45,10 +44,10 @@ private class JvmSingleAbstractMethodLowering(context: JvmBackendContext) : Sing if (inInlineFunctionScope) DescriptorVisibilities.PUBLIC else JavaDescriptorVisibilities.PACKAGE_VISIBILITY override fun getSuperTypeForWrapper(typeOperand: IrType): IrType = - typeOperand.erasedUpperBound.symbol.rawDefaultType(context as JvmBackendContext) + typeOperand.erasedUpperBound.rawType(context as JvmBackendContext) override fun getWrappedFunctionType(klass: IrClass): IrType = - klass.symbol.rawStarProjectedType(context as JvmBackendContext) + klass.rawType(context as JvmBackendContext) // The constructor of a SAM wrapper is non-synthetic and should not have line numbers. // Otherwise the debugger will try to step into it. From 5be28520fcfa8790e6704b3666ff19aa5f68f65a Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Thu, 10 Dec 2020 15:43:36 +0300 Subject: [PATCH 594/698] JVM_IR KT-43851 preserve static initialization order in const val read --- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 ++ .../kotlin/backend/jvm/lower/ConstLowering.kt | 26 ++++-- .../properties/const/constInObjectWithInit.kt | 79 +++++++++++++++++++ .../properties/const/constPropertyAccessor.kt | 3 +- .../codegen/BlackBoxCodegenTestGenerated.java | 5 ++ .../LightAnalysisModeTestGenerated.java | 5 ++ .../ir/IrBlackBoxCodegenTestGenerated.java | 5 ++ 7 files changed, 118 insertions(+), 10 deletions(-) create mode 100644 compiler/testData/codegen/box/properties/const/constInObjectWithInit.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 759fffebb75..4dad0e4eac1 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -21575,6 +21575,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/properties/const/constFlags.kt"); } + @TestMetadata("constInObjectWithInit.kt") + public void testConstInObjectWithInit() throws Exception { + runTest("compiler/testData/codegen/box/properties/const/constInObjectWithInit.kt"); + } + @TestMetadata("constPropertyAccessor.kt") public void testConstPropertyAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/const/constPropertyAccessor.kt"); diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/ConstLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/ConstLowering.kt index 1acdba35f4d..ed42b23eba1 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/ConstLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/ConstLowering.kt @@ -13,10 +13,8 @@ import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin import org.jetbrains.kotlin.ir.declarations.IrField import org.jetbrains.kotlin.ir.declarations.IrFile import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction -import org.jetbrains.kotlin.ir.expressions.IrCall -import org.jetbrains.kotlin.ir.expressions.IrConst -import org.jetbrains.kotlin.ir.expressions.IrExpression -import org.jetbrains.kotlin.ir.expressions.IrGetField +import org.jetbrains.kotlin.ir.expressions.* +import org.jetbrains.kotlin.ir.expressions.impl.IrCompositeImpl import org.jetbrains.kotlin.ir.expressions.impl.IrGetFieldImpl import org.jetbrains.kotlin.ir.types.isPrimitiveType import org.jetbrains.kotlin.ir.types.isStringClassType @@ -46,21 +44,33 @@ fun IrField.constantValue(context: JvmBackendContext? = null): IrConst<*>? { class ConstLowering(val context: JvmBackendContext) : IrElementTransformerVoid(), FileLoweringPass { override fun lower(irFile: IrFile) = irFile.transformChildrenVoid() - private fun IrExpression.lowerConstRead(field: IrField?): IrExpression? { + private fun IrExpression.lowerConstRead(receiver: IrExpression?, field: IrField?): IrExpression? { val value = field?.constantValue() ?: return null - return if (context.state.shouldInlineConstVals) + val resultExpression = if (context.state.shouldInlineConstVals) value.copyWithOffsets(startOffset, endOffset) else IrGetFieldImpl(startOffset, endOffset, field.symbol, field.type) + + return if (receiver == null || receiver.shouldDropConstReceiver()) + resultExpression + else + IrCompositeImpl( + startOffset, endOffset, resultExpression.type, null, + listOf(receiver, resultExpression) + ) } + + private fun IrExpression.shouldDropConstReceiver() = + this is IrConst<*> || this is IrGetValue || + this is IrGetObjectValue override fun visitCall(expression: IrCall): IrExpression { val function = (expression.symbol.owner as? IrSimpleFunction) ?: return super.visitCall(expression) val property = function.correspondingPropertySymbol?.owner ?: return super.visitCall(expression) // If `constantValue` is not null, `function` can only be the getter because the property is immutable. - return expression.lowerConstRead(property.backingField) ?: super.visitCall(expression) + return expression.lowerConstRead(expression.dispatchReceiver, property.backingField) ?: super.visitCall(expression) } override fun visitGetField(expression: IrGetField): IrExpression = - expression.lowerConstRead(expression.symbol.owner) ?: super.visitGetField(expression) + expression.lowerConstRead(expression.receiver, expression.symbol.owner) ?: super.visitGetField(expression) } diff --git a/compiler/testData/codegen/box/properties/const/constInObjectWithInit.kt b/compiler/testData/codegen/box/properties/const/constInObjectWithInit.kt new file mode 100644 index 00000000000..bd4bdb72755 --- /dev/null +++ b/compiler/testData/codegen/box/properties/const/constInObjectWithInit.kt @@ -0,0 +1,79 @@ +// TARGET_BACKEND: JVM +// This test checks that JVM-specific static initialization behavior is preserved in JVM_IR. + +var testObjectInit = false +var testClassCompanionInit = false +var testInterfaceCompanionInit = false + +fun use(x: Int) {} + +object TestObject { + init { + testObjectInit = true + } + const val x = 42 +} + +fun getTestObject() = TestObject + +class TestClassCompanion { + companion object { + init { + testClassCompanionInit = true + } + const val x = 42 + } +} + +fun getTestClassCompanion() = TestClassCompanion + +class TestInterfaceCompanion { + companion object { + init { + testInterfaceCompanionInit = true + } + const val x = 42 + } +} + +fun getInterfaceCompanion() = TestInterfaceCompanion + +fun box(): String { + use(TestObject.x) + if (testObjectInit) + throw Exception("use(TestObject.x)") + + use((TestObject).x) + if (testObjectInit) + throw Exception("use((TestObject).x)") + + use(getTestObject().x) + if (!testObjectInit) + throw Exception("use(getTestObject().x)") + + use(TestClassCompanion.x) + if (testClassCompanionInit) + throw Exception("use(TestClassCompanion.x)") + + use((TestClassCompanion).x) + if (testClassCompanionInit) + throw Exception("use((TestClassCompanion).x)") + + use(getTestClassCompanion().x) + if (!testClassCompanionInit) + throw Exception("use(getTestClassCompanion().x)") + + use(TestInterfaceCompanion.x) + if (testInterfaceCompanionInit) + throw Exception("use(TestInterfaceCompanion.x)") + + use((TestInterfaceCompanion).x) + if (testInterfaceCompanionInit) + throw Exception("use((TestInterfaceCompanion).x)") + + use(getInterfaceCompanion().x) + if (!testInterfaceCompanionInit) + throw Exception("use(getInterfaceCompanion().x)") + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/properties/const/constPropertyAccessor.kt b/compiler/testData/codegen/box/properties/const/constPropertyAccessor.kt index 538d1ec197f..7306a92bb07 100644 --- a/compiler/testData/codegen/box/properties/const/constPropertyAccessor.kt +++ b/compiler/testData/codegen/box/properties/const/constPropertyAccessor.kt @@ -1,5 +1,4 @@ -// IGNORE_BACKEND: JVM_IR, JS, JS_IR_ES6 -// IGNORE_BACKEND_FIR: JVM_IR +// IGNORE_BACKEND: JS, JS_IR_ES6 var a = 12 diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index b443c0b47d6..4c23c7115b6 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -21941,6 +21941,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/properties/const/constFlags.kt"); } + @TestMetadata("constInObjectWithInit.kt") + public void testConstInObjectWithInit() throws Exception { + runTest("compiler/testData/codegen/box/properties/const/constInObjectWithInit.kt"); + } + @TestMetadata("constPropertyAccessor.kt") public void testConstPropertyAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/const/constPropertyAccessor.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index fde5ea803b4..4e9d7f19813 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -21941,6 +21941,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/properties/const/constFlags.kt"); } + @TestMetadata("constInObjectWithInit.kt") + public void testConstInObjectWithInit() throws Exception { + runTest("compiler/testData/codegen/box/properties/const/constInObjectWithInit.kt"); + } + @TestMetadata("constPropertyAccessor.kt") public void testConstPropertyAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/const/constPropertyAccessor.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index b9587e1bd53..71a78e1ba65 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -21575,6 +21575,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/properties/const/constFlags.kt"); } + @TestMetadata("constInObjectWithInit.kt") + public void testConstInObjectWithInit() throws Exception { + runTest("compiler/testData/codegen/box/properties/const/constInObjectWithInit.kt"); + } + @TestMetadata("constPropertyAccessor.kt") public void testConstPropertyAccessor() throws Exception { runTest("compiler/testData/codegen/box/properties/const/constPropertyAccessor.kt"); From 167e60b9fb4109b36c281ae5234660fdff910670 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Thu, 3 Dec 2020 19:17:07 +0300 Subject: [PATCH 595/698] [JS IR] Assert createdOn equals 0 for properties initialization fun for file --- .../backend/js/lower/PropertyLazyInitLowering.kt | 14 ++++++++++++-- .../noInitializationLazilyOnNonPropertiesCall.kt | 5 +++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt index 23ef4a638dc..9bf85282574 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt @@ -50,11 +50,13 @@ class PropertyLazyInitLowering( if (container !is IrField && container !is IrSimpleFunction && container !is IrProperty) return - if (container.origin !in compatibleOrigins) return + if (!container.isCompatibleDeclaration()) return val file = container.parent as? IrFile ?: return + container.assertCompatibleDeclaration() + val initFun = (when { file in fileToInitializationFuns -> fileToInitializationFuns[file] fileToInitializerPureness[file] == true -> null @@ -242,7 +244,10 @@ class RemoveInitializersForLazyProperties( declaration.correspondingProperty ?.takeIf { it.isForLazyInit() } ?.backingField - ?.let { it.initializer = null } + ?.let { + it.assertCompatibleDeclaration() + it.initializer = null + } return null } @@ -298,9 +303,14 @@ private fun IrDeclaration.propertyWithPersistentSafe(transform: IrDeclaration.() private fun IrDeclaration.isCompatibleDeclaration() = origin in compatibleOrigins +private fun IrDeclaration.assertCompatibleDeclaration() { + assert((this as? PersistentIrElementBase<*>)?.createdOn?.let { it == 0 } != false) +} + private val compatibleOrigins = listOf( IrDeclarationOrigin.DEFINED, IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR, + IrDeclarationOrigin.PROPERTY_DELEGATE, IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR, IrDeclarationOrigin.PROPERTY_BACKING_FIELD, ) \ No newline at end of file diff --git a/compiler/testData/codegen/box/properties/noInitializationLazilyOnNonPropertiesCall.kt b/compiler/testData/codegen/box/properties/noInitializationLazilyOnNonPropertiesCall.kt index d0aceeec2e5..91c7a177628 100644 --- a/compiler/testData/codegen/box/properties/noInitializationLazilyOnNonPropertiesCall.kt +++ b/compiler/testData/codegen/box/properties/noInitializationLazilyOnNonPropertiesCall.kt @@ -1,12 +1,17 @@ // TARGET_BACKEND: JS_IR // DONT_TARGET_EXACT_BACKEND: WASM // PROPERTY_LAZY_INITIALIZATION +// KJS_WITH_FULL_RUNTIME // FILE: A.kt val a1 = "a".let { it + "a" } +val b1 by lazy { + "b1" +} + object A { private val foo = "foo" val foo2 = foo From a7efa5c98bbe162d45cd8c671bb0d7215573425f Mon Sep 17 00:00:00 2001 From: Mads Ager Date: Mon, 30 Nov 2020 13:16:23 +0100 Subject: [PATCH 596/698] [IR] Fix remapping of arguments in LocalDeclarationsLowering. It only remapped arguments for IrGetValue and not for IrSetValue. This is hitting Compose which has non-standard default argument handling. --- .../common/lower/LocalDeclarationsLowering.kt | 17 +++++++ .../backend/jvm/codegen/ExpressionCodegen.kt | 4 -- .../composeLikeBytecodeText/default.kt | 4 ++ .../composeLikeBytecodeText/defaultInline.kt | 3 ++ .../composeLikeBytecodeText/defaultLocal.kt | 4 ++ .../AbstractComposeLikeIrBytecodeTextTest.kt | 13 ++++++ .../ir/ComposeLikeGenerationExtension.kt | 7 +++ ...omposeLikeIrBytecodeTextTestGenerated.java | 46 +++++++++++++++++++ 8 files changed, 94 insertions(+), 4 deletions(-) create mode 100644 compiler/testData/codegen/composeLikeBytecodeText/default.kt create mode 100644 compiler/testData/codegen/composeLikeBytecodeText/defaultInline.kt create mode 100644 compiler/testData/codegen/composeLikeBytecodeText/defaultLocal.kt create mode 100644 compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractComposeLikeIrBytecodeTextTest.kt create mode 100644 compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/ComposeLikeGenerationExtension.kt create mode 100644 compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/ComposeLikeIrBytecodeTextTestGenerated.java diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt index 5ec8868dc3c..aa4ad74b6a0 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt @@ -305,6 +305,23 @@ class LocalDeclarationsLowering( return expression } + override fun visitSetValue(expression: IrSetValue): IrExpression { + expression.transformChildrenVoid(this) + + val declaration = expression.symbol.owner + oldParameterToNew[declaration]?.let { + return IrSetValueImpl( + expression.startOffset, + expression.endOffset, + it.type, + it.symbol, + expression.value, + expression.origin + ) + } + return expression + } + override fun visitCall(expression: IrCall): IrExpression { expression.transformChildrenVoid(this) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt index 2953928ced8..fdb016e48b8 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt @@ -346,10 +346,6 @@ class ExpressionCodegen( } private fun writeValueParameterInLocalVariableTable(param: IrValueParameter, startLabel: Label, endLabel: Label, isReceiver: Boolean) { - // TODO: old code has a special treatment for destructuring lambda parameters. - // There is no (easy) way to reproduce it with IR structures. - // Does not show up in tests, but might come to bite us at some point. - // If the parameter is an extension receiver parameter or a captured extension receiver from enclosing, // then generate name accordingly. val name = if (param.origin == BOUND_RECEIVER_PARAMETER || isReceiver) { diff --git a/compiler/testData/codegen/composeLikeBytecodeText/default.kt b/compiler/testData/codegen/composeLikeBytecodeText/default.kt new file mode 100644 index 00000000000..6f2dbd0bdea --- /dev/null +++ b/compiler/testData/codegen/composeLikeBytecodeText/default.kt @@ -0,0 +1,4 @@ +fun foo(s: String = "O") = s + +fun box() = foo() + foo("K") + diff --git a/compiler/testData/codegen/composeLikeBytecodeText/defaultInline.kt b/compiler/testData/codegen/composeLikeBytecodeText/defaultInline.kt new file mode 100644 index 00000000000..48384ba3361 --- /dev/null +++ b/compiler/testData/codegen/composeLikeBytecodeText/defaultInline.kt @@ -0,0 +1,3 @@ +inline fun foo(s: String = "O") = s + +fun box() = foo() + foo("K") diff --git a/compiler/testData/codegen/composeLikeBytecodeText/defaultLocal.kt b/compiler/testData/codegen/composeLikeBytecodeText/defaultLocal.kt new file mode 100644 index 00000000000..d3b1c75bc67 --- /dev/null +++ b/compiler/testData/codegen/composeLikeBytecodeText/defaultLocal.kt @@ -0,0 +1,4 @@ +fun box(): String { + fun foo(s: String = "O") = s + return foo() + foo("K") +} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractComposeLikeIrBytecodeTextTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractComposeLikeIrBytecodeTextTest.kt new file mode 100644 index 00000000000..aa38c234f63 --- /dev/null +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractComposeLikeIrBytecodeTextTest.kt @@ -0,0 +1,13 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.codegen.ir + +import org.jetbrains.kotlin.codegen.AbstractBytecodeTextTest +import org.jetbrains.kotlin.test.TargetBackend + +abstract class AbstractComposeLikeIrBytecodeTextTest : AbstractBytecodeTextTest() { + override val backend = TargetBackend.JVM_IR +} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/ComposeLikeGenerationExtension.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/ComposeLikeGenerationExtension.kt new file mode 100644 index 00000000000..52329090f27 --- /dev/null +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/ComposeLikeGenerationExtension.kt @@ -0,0 +1,7 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.codegen.ir + diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/ComposeLikeIrBytecodeTextTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/ComposeLikeIrBytecodeTextTestGenerated.java new file mode 100644 index 00000000000..0f8c46e3c77 --- /dev/null +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/ComposeLikeIrBytecodeTextTestGenerated.java @@ -0,0 +1,46 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.codegen.ir; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TargetBackend; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("compiler/testData/codegen/composeLike") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class ComposeLikeIrBytecodeTextTestGenerated extends AbstractComposeLikeIrBytecodeTextTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInComposeLike() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/composeLike"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("default.kt") + public void testDefault() throws Exception { + runTest("compiler/testData/codegen/composeLike/default.kt"); + } + + @TestMetadata("defaultInline.kt") + public void testDefaultInline() throws Exception { + runTest("compiler/testData/codegen/composeLike/defaultInline.kt"); + } + + @TestMetadata("defaultLocal.kt") + public void testDefaultLocal() throws Exception { + runTest("compiler/testData/codegen/composeLike/defaultLocal.kt"); + } +} From 83588e9f221d6dcca95ba297d446acd9c5f758ee Mon Sep 17 00:00:00 2001 From: Mads Ager Date: Mon, 30 Nov 2020 16:41:07 +0100 Subject: [PATCH 597/698] [JVM_IR] Add tests of Compose-like default argument handling. --- .../testData/codegen/composeLike/default.kt | 4 + .../codegen/composeLike/defaultInline.kt | 3 + .../codegen/composeLike/defaultLocal.kt | 4 + ...bstractComposeLikeIrBlackBoxCodegenTest.kt | 336 ++++++++++++++++++ ...oseLikeIrBlackBoxCodegenTestGenerated.java | 46 +++ .../generators/tests/GenerateCompilerTests.kt | 6 +- 6 files changed, 397 insertions(+), 2 deletions(-) create mode 100644 compiler/testData/codegen/composeLike/default.kt create mode 100644 compiler/testData/codegen/composeLike/defaultInline.kt create mode 100644 compiler/testData/codegen/composeLike/defaultLocal.kt create mode 100644 compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractComposeLikeIrBlackBoxCodegenTest.kt create mode 100644 compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/ComposeLikeIrBlackBoxCodegenTestGenerated.java diff --git a/compiler/testData/codegen/composeLike/default.kt b/compiler/testData/codegen/composeLike/default.kt new file mode 100644 index 00000000000..6f2dbd0bdea --- /dev/null +++ b/compiler/testData/codegen/composeLike/default.kt @@ -0,0 +1,4 @@ +fun foo(s: String = "O") = s + +fun box() = foo() + foo("K") + diff --git a/compiler/testData/codegen/composeLike/defaultInline.kt b/compiler/testData/codegen/composeLike/defaultInline.kt new file mode 100644 index 00000000000..48384ba3361 --- /dev/null +++ b/compiler/testData/codegen/composeLike/defaultInline.kt @@ -0,0 +1,3 @@ +inline fun foo(s: String = "O") = s + +fun box() = foo() + foo("K") diff --git a/compiler/testData/codegen/composeLike/defaultLocal.kt b/compiler/testData/codegen/composeLike/defaultLocal.kt new file mode 100644 index 00000000000..d3b1c75bc67 --- /dev/null +++ b/compiler/testData/codegen/composeLike/defaultLocal.kt @@ -0,0 +1,4 @@ +fun box(): String { + fun foo(s: String = "O") = s + return foo() + foo("K") +} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractComposeLikeIrBlackBoxCodegenTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractComposeLikeIrBlackBoxCodegenTest.kt new file mode 100644 index 00000000000..06ba3520954 --- /dev/null +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractComposeLikeIrBlackBoxCodegenTest.kt @@ -0,0 +1,336 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.codegen.ir + +import com.intellij.mock.MockProject +import com.intellij.openapi.project.Project +import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension +import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext +import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment +import org.jetbrains.kotlin.codegen.AbstractBlackBoxCodegenTest +import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar +import org.jetbrains.kotlin.config.CompilerConfiguration +import org.jetbrains.kotlin.ir.IrStatement +import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET +import org.jetbrains.kotlin.ir.builders.declarations.addValueParameter +import org.jetbrains.kotlin.ir.declarations.* +import org.jetbrains.kotlin.ir.declarations.impl.IrValueParameterImpl +import org.jetbrains.kotlin.ir.descriptors.WrappedValueParameterDescriptor +import org.jetbrains.kotlin.ir.expressions.* +import org.jetbrains.kotlin.ir.expressions.impl.* +import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol +import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol +import org.jetbrains.kotlin.ir.symbols.IrValueSymbol +import org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl +import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.types.isPrimitiveType +import org.jetbrains.kotlin.ir.types.makeNullable +import org.jetbrains.kotlin.ir.util.hasDefaultValue +import org.jetbrains.kotlin.ir.util.isInlined +import org.jetbrains.kotlin.ir.util.statements +import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid +import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid +import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.test.TargetBackend + +abstract class AbstractComposeLikeIrBlackBoxCodegenTest : AbstractBlackBoxCodegenTest() { + override val backend = TargetBackend.JVM_IR + + override fun setupEnvironment(environment: KotlinCoreEnvironment) { + ComposeLikeExtensionRegistrar.registerComponents(environment.project) + super.setupEnvironment(environment) + } + +} + +class ComposeLikeExtensionRegistrar : ComponentRegistrar { + companion object { + fun registerComponents(project: Project) { + IrGenerationExtension.registerExtension(project, ComposeLikeGenerationExtension()) + } + } + + override fun registerProjectComponents(project: MockProject, configuration: CompilerConfiguration) { + registerComponents(project) + } +} + +class ComposeLikeGenerationExtension : IrGenerationExtension { + private val rewrittenFunctions = mutableSetOf() + + override fun generate(moduleFragment: IrModuleFragment, pluginContext: IrPluginContext) { + moduleFragment.transformChildrenVoid(ComposeLikeDefaultArgumentRewriter(pluginContext, rewrittenFunctions)) + moduleFragment.transformChildrenVoid(ComposeLikeDefaultMethodCallRewriter(pluginContext, rewrittenFunctions)) + } +} + +class ComposeLikeDefaultMethodCallRewriter(private val context: IrPluginContext, private val rewrittenFunctions: Set) : + IrElementTransformerVoid() { + override fun visitCall(expression: IrCall): IrExpression { + val function = expression.symbol.owner + return if (rewrittenFunctions.contains(function)) { + IrCallImpl( + expression.startOffset, + expression.endOffset, + expression.type, + expression.symbol, + function.typeParameters.size, + function.valueParameters.size, + expression.origin, + expression.superQualifierSymbol + ).also { + it.dispatchReceiver = expression.dispatchReceiver?.transform(this, null) + it.extensionReceiver = expression.extensionReceiver?.transform(this, null) + var bitmap = 0 + for (i in function.valueParameters.indices) { + if (i < expression.valueArgumentsCount) { + if (expression.getValueArgument(i) != null) { + it.putValueArgument(i, expression.getValueArgument(i)) + } else { + bitmap = bitmap or (1.shl(i)) + it.putValueArgument( + i, + IrConstImpl.defaultValueForType( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + function.valueParameters[i].type + ).let { defaultValue -> + IrCompositeImpl( + defaultValue.startOffset, + defaultValue.endOffset, + defaultValue.type, + IrStatementOrigin.DEFAULT_VALUE, + listOf(defaultValue) + ) + } + ) + } + } + } + it.putValueArgument( + function.valueParameters.size - 1, + IrConstImpl.int(UNDEFINED_OFFSET, UNDEFINED_OFFSET, context.irBuiltIns.intType, bitmap) + ) + } + } else { + super.visitCall(expression) + } + } +} + +class ComposeLikeDefaultArgumentRewriter( + private val context: IrPluginContext, + private val rewrittenFunctions: MutableSet +) : IrElementTransformerVoid() { + private val parameterMapping = mutableMapOf() + + override fun visitGetValue(expression: IrGetValue): IrExpression { + parameterMapping[expression.symbol.owner]?.let { + return IrGetValueImpl( + expression.startOffset, + expression.endOffset, + expression.type, + it.symbol, + expression.origin + ) + } ?: return super.visitGetValue(expression) + } + + override fun visitFunction(declaration: IrFunction): IrStatement { + val hasDefaultArguments = declaration.valueParameters.any { it.defaultValue != null } + if (!hasDefaultArguments) return super.visitFunction(declaration) + rewrittenFunctions.add(declaration) + val newParameters = mutableListOf() + declaration.valueParameters.forEach { param -> + newParameters.add( + if (param.defaultValue != null) { + val result = IrValueParameterImpl( + param.startOffset, + param.endOffset, + param.origin, + IrValueParameterSymbolImpl(WrappedValueParameterDescriptor()), + param.name, + index = param.index, + type = defaultParameterType(param), + varargElementType = param.varargElementType, + isCrossinline = param.isCrossinline, + isNoinline = param.isNoinline, + isAssignable = param.defaultValue != null + ).also { + it.defaultValue = param.defaultValue + it.parent = declaration + } + parameterMapping[param] = result + result + } else param + ) + } + declaration.valueParameters = newParameters + val defaultParam = declaration.addValueParameter( + "\$default", + context.irBuiltIns.intType, + IrDeclarationOrigin.MASK_FOR_DEFAULT_FUNCTION + ) + declaration.transformChildrenVoid() + val body = declaration.body!! + val defaultSelection = mutableListOf() + declaration.valueParameters.forEach { + if (it.hasDefaultValue()) { + val index = defaultSelection.size + defaultSelection.add( + irIf( + condition = irGetBit(defaultParam, index), + body = irSet(it, it.defaultValue!!.expression) + ) + ) + it.defaultValue = null + } + } + + declaration.body = IrBlockBodyImpl( + body.startOffset, + body.endOffset, + listOf( + *defaultSelection.toTypedArray(), + *body.statements.toTypedArray() + ), + ) + return declaration + } + + private fun defaultParameterType(param: IrValueParameter): IrType { + val type = param.type + return when { + type.isPrimitiveType() -> type + type.isInlined() -> type + else -> type.makeNullable() + } + } + + private fun irIf(condition: IrExpression, body: IrExpression): IrExpression { + return IrIfThenElseImpl( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + context.irBuiltIns.unitType, + origin = IrStatementOrigin.IF + ).also { + it.branches.add( + IrBranchImpl(condition, body) + ) + } + } + + private fun irSet(variable: IrValueDeclaration, value: IrExpression): IrExpression { + return IrSetValueImpl( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + context.irBuiltIns.unitType, + variable.symbol, + value = value, + origin = null + ) + } + + private fun irNotEqual(lhs: IrExpression, rhs: IrExpression): IrExpression { + return irNot(irEqual(lhs, rhs)) + } + + private fun irGetBit(param: IrValueParameter, index: Int): IrExpression { + // value and (1 shl index) != 0 + return irNotEqual( + irAnd( + // a value of 1 in default means it was NOT provided + irGet(param), + irConst(0b1 shl index) + ), + irConst(0) + ) + } + + private fun irConst(value: Int): IrConst = IrConstImpl( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + context.irBuiltIns.intType, + IrConstKind.Int, + value + ) + + private fun irConst(value: Boolean) = IrConstImpl( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + context.irBuiltIns.booleanType, + IrConstKind.Boolean, + value + ) + + private fun irGet(type: IrType, symbol: IrValueSymbol): IrExpression { + return IrGetValueImpl( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + type, + symbol + ) + } + + private fun irGet(variable: IrValueDeclaration): IrExpression { + return irGet(variable.type, variable.symbol) + } + + private fun IrType.binaryOperator(name: Name, paramType: IrType): IrFunctionSymbol = + context.symbols.getBinaryOperator(name, this, paramType) + + private fun irAnd(lhs: IrExpression, rhs: IrExpression): IrCallImpl { + return irCall( + lhs.type.binaryOperator(Name.identifier("and"), rhs.type), + null, + lhs, + null, + rhs + ) + } + + private fun irCall( + symbol: IrFunctionSymbol, + origin: IrStatementOrigin? = null, + dispatchReceiver: IrExpression? = null, + extensionReceiver: IrExpression? = null, + vararg args: IrExpression + ): IrCallImpl { + return IrCallImpl( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + symbol.owner.returnType, + symbol as IrSimpleFunctionSymbol, + symbol.owner.typeParameters.size, + symbol.owner.valueParameters.size, + origin + ).also { + if (dispatchReceiver != null) it.dispatchReceiver = dispatchReceiver + if (extensionReceiver != null) it.extensionReceiver = extensionReceiver + args.forEachIndexed { index, arg -> + it.putValueArgument(index, arg) + } + } + } + + private fun irNot(value: IrExpression): IrExpression { + return irCall( + context.irBuiltIns.booleanNotSymbol, + dispatchReceiver = value + ) + } + + private fun irEqual(lhs: IrExpression, rhs: IrExpression): IrExpression { + return irCall( + context.irBuiltIns.eqeqeqSymbol, + null, + null, + null, + lhs, + rhs + ) + } +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/ComposeLikeIrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/ComposeLikeIrBlackBoxCodegenTestGenerated.java new file mode 100644 index 00000000000..3a3a08e1fe1 --- /dev/null +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/ComposeLikeIrBlackBoxCodegenTestGenerated.java @@ -0,0 +1,46 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.codegen.ir; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TargetBackend; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("compiler/testData/codegen/composeLike") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class ComposeLikeIrBlackBoxCodegenTestGenerated extends AbstractComposeLikeIrBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInComposeLike() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/composeLike"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("default.kt") + public void testDefault() throws Exception { + runTest("compiler/testData/codegen/composeLike/default.kt"); + } + + @TestMetadata("defaultInline.kt") + public void testDefaultInline() throws Exception { + runTest("compiler/testData/codegen/composeLike/defaultInline.kt"); + } + + @TestMetadata("defaultLocal.kt") + public void testDefaultLocal() throws Exception { + runTest("compiler/testData/codegen/composeLike/defaultLocal.kt"); + } +} diff --git a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt index 69e9121d2b7..b7230c63cef 100644 --- a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt +++ b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt @@ -251,8 +251,6 @@ fun main(args: Array) { model("ir/sourceRanges") } - - testClass { model("codegen/bytecodeListing", targetBackend = TargetBackend.JVM) } @@ -462,6 +460,10 @@ fun main(args: Array) { model("lexer/kotlin") } + testClass { + model("codegen/composeLike", targetBackend = TargetBackend.JVM_IR) + } + testClass { model("codegen/box", targetBackend = TargetBackend.JVM_IR, excludeDirs = listOf("oldLanguageVersions")) } From fadedc84dbd3ac9aba1d7224732f53105692ec47 Mon Sep 17 00:00:00 2001 From: Mads Ager Date: Mon, 30 Nov 2020 17:19:02 +0100 Subject: [PATCH 598/698] [JVM_IR] Refactor and add bytecode text tests for compose-like code. Tests that the default argument mask is not in the local variable table. --- .../composeLikeBytecodeText/default.kt | 4 + .../composeLikeBytecodeText/defaultInline.kt | 5 + .../composeLikeBytecodeText/defaultLocal.kt | 5 + .../kotlin/codegen/CodegenTestCase.java | 2 + ...bstractComposeLikeIrBlackBoxCodegenTest.kt | 317 ----------------- .../AbstractComposeLikeIrBytecodeTextTest.kt | 6 + .../ir/ComposeLikeGenerationExtension.kt | 326 ++++++++++++++++++ ...omposeLikeIrBytecodeTextTestGenerated.java | 12 +- .../generators/tests/GenerateCompilerTests.kt | 4 + license/README.md | 5 +- 10 files changed, 362 insertions(+), 324 deletions(-) diff --git a/compiler/testData/codegen/composeLikeBytecodeText/default.kt b/compiler/testData/codegen/composeLikeBytecodeText/default.kt index 6f2dbd0bdea..d2ba7131515 100644 --- a/compiler/testData/codegen/composeLikeBytecodeText/default.kt +++ b/compiler/testData/codegen/composeLikeBytecodeText/default.kt @@ -2,3 +2,7 @@ fun foo(s: String = "O") = s fun box() = foo() + foo("K") +// For Compose special default arugment handling, we still do not want +// the default argument mask in the local variable table. + +// 0 \$default \ No newline at end of file diff --git a/compiler/testData/codegen/composeLikeBytecodeText/defaultInline.kt b/compiler/testData/codegen/composeLikeBytecodeText/defaultInline.kt index 48384ba3361..3ad962ef369 100644 --- a/compiler/testData/codegen/composeLikeBytecodeText/defaultInline.kt +++ b/compiler/testData/codegen/composeLikeBytecodeText/defaultInline.kt @@ -1,3 +1,8 @@ inline fun foo(s: String = "O") = s fun box() = foo() + foo("K") + +// For Compose special default arugment handling, we still do not want +// the default argument mask in the local variable table. + +// 0 \$default \ No newline at end of file diff --git a/compiler/testData/codegen/composeLikeBytecodeText/defaultLocal.kt b/compiler/testData/codegen/composeLikeBytecodeText/defaultLocal.kt index d3b1c75bc67..035c9105c8c 100644 --- a/compiler/testData/codegen/composeLikeBytecodeText/defaultLocal.kt +++ b/compiler/testData/codegen/composeLikeBytecodeText/defaultLocal.kt @@ -2,3 +2,8 @@ fun box(): String { fun foo(s: String = "O") = s return foo() + foo("K") } + +// For Compose special default arugment handling, we still do not want +// the default argument mask in the local variable table. + +// 0 \$default \ No newline at end of file diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java index 0048d97e788..1d2aa0b83d6 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java @@ -110,6 +110,8 @@ public abstract class CodegenTestCase extends KotlinBaseTest() - - override fun generate(moduleFragment: IrModuleFragment, pluginContext: IrPluginContext) { - moduleFragment.transformChildrenVoid(ComposeLikeDefaultArgumentRewriter(pluginContext, rewrittenFunctions)) - moduleFragment.transformChildrenVoid(ComposeLikeDefaultMethodCallRewriter(pluginContext, rewrittenFunctions)) - } -} - -class ComposeLikeDefaultMethodCallRewriter(private val context: IrPluginContext, private val rewrittenFunctions: Set) : - IrElementTransformerVoid() { - override fun visitCall(expression: IrCall): IrExpression { - val function = expression.symbol.owner - return if (rewrittenFunctions.contains(function)) { - IrCallImpl( - expression.startOffset, - expression.endOffset, - expression.type, - expression.symbol, - function.typeParameters.size, - function.valueParameters.size, - expression.origin, - expression.superQualifierSymbol - ).also { - it.dispatchReceiver = expression.dispatchReceiver?.transform(this, null) - it.extensionReceiver = expression.extensionReceiver?.transform(this, null) - var bitmap = 0 - for (i in function.valueParameters.indices) { - if (i < expression.valueArgumentsCount) { - if (expression.getValueArgument(i) != null) { - it.putValueArgument(i, expression.getValueArgument(i)) - } else { - bitmap = bitmap or (1.shl(i)) - it.putValueArgument( - i, - IrConstImpl.defaultValueForType( - UNDEFINED_OFFSET, - UNDEFINED_OFFSET, - function.valueParameters[i].type - ).let { defaultValue -> - IrCompositeImpl( - defaultValue.startOffset, - defaultValue.endOffset, - defaultValue.type, - IrStatementOrigin.DEFAULT_VALUE, - listOf(defaultValue) - ) - } - ) - } - } - } - it.putValueArgument( - function.valueParameters.size - 1, - IrConstImpl.int(UNDEFINED_OFFSET, UNDEFINED_OFFSET, context.irBuiltIns.intType, bitmap) - ) - } - } else { - super.visitCall(expression) - } - } -} - -class ComposeLikeDefaultArgumentRewriter( - private val context: IrPluginContext, - private val rewrittenFunctions: MutableSet -) : IrElementTransformerVoid() { - private val parameterMapping = mutableMapOf() - - override fun visitGetValue(expression: IrGetValue): IrExpression { - parameterMapping[expression.symbol.owner]?.let { - return IrGetValueImpl( - expression.startOffset, - expression.endOffset, - expression.type, - it.symbol, - expression.origin - ) - } ?: return super.visitGetValue(expression) - } - - override fun visitFunction(declaration: IrFunction): IrStatement { - val hasDefaultArguments = declaration.valueParameters.any { it.defaultValue != null } - if (!hasDefaultArguments) return super.visitFunction(declaration) - rewrittenFunctions.add(declaration) - val newParameters = mutableListOf() - declaration.valueParameters.forEach { param -> - newParameters.add( - if (param.defaultValue != null) { - val result = IrValueParameterImpl( - param.startOffset, - param.endOffset, - param.origin, - IrValueParameterSymbolImpl(WrappedValueParameterDescriptor()), - param.name, - index = param.index, - type = defaultParameterType(param), - varargElementType = param.varargElementType, - isCrossinline = param.isCrossinline, - isNoinline = param.isNoinline, - isAssignable = param.defaultValue != null - ).also { - it.defaultValue = param.defaultValue - it.parent = declaration - } - parameterMapping[param] = result - result - } else param - ) - } - declaration.valueParameters = newParameters - val defaultParam = declaration.addValueParameter( - "\$default", - context.irBuiltIns.intType, - IrDeclarationOrigin.MASK_FOR_DEFAULT_FUNCTION - ) - declaration.transformChildrenVoid() - val body = declaration.body!! - val defaultSelection = mutableListOf() - declaration.valueParameters.forEach { - if (it.hasDefaultValue()) { - val index = defaultSelection.size - defaultSelection.add( - irIf( - condition = irGetBit(defaultParam, index), - body = irSet(it, it.defaultValue!!.expression) - ) - ) - it.defaultValue = null - } - } - - declaration.body = IrBlockBodyImpl( - body.startOffset, - body.endOffset, - listOf( - *defaultSelection.toTypedArray(), - *body.statements.toTypedArray() - ), - ) - return declaration - } - - private fun defaultParameterType(param: IrValueParameter): IrType { - val type = param.type - return when { - type.isPrimitiveType() -> type - type.isInlined() -> type - else -> type.makeNullable() - } - } - - private fun irIf(condition: IrExpression, body: IrExpression): IrExpression { - return IrIfThenElseImpl( - UNDEFINED_OFFSET, - UNDEFINED_OFFSET, - context.irBuiltIns.unitType, - origin = IrStatementOrigin.IF - ).also { - it.branches.add( - IrBranchImpl(condition, body) - ) - } - } - - private fun irSet(variable: IrValueDeclaration, value: IrExpression): IrExpression { - return IrSetValueImpl( - UNDEFINED_OFFSET, - UNDEFINED_OFFSET, - context.irBuiltIns.unitType, - variable.symbol, - value = value, - origin = null - ) - } - - private fun irNotEqual(lhs: IrExpression, rhs: IrExpression): IrExpression { - return irNot(irEqual(lhs, rhs)) - } - - private fun irGetBit(param: IrValueParameter, index: Int): IrExpression { - // value and (1 shl index) != 0 - return irNotEqual( - irAnd( - // a value of 1 in default means it was NOT provided - irGet(param), - irConst(0b1 shl index) - ), - irConst(0) - ) - } - - private fun irConst(value: Int): IrConst = IrConstImpl( - UNDEFINED_OFFSET, - UNDEFINED_OFFSET, - context.irBuiltIns.intType, - IrConstKind.Int, - value - ) - - private fun irConst(value: Boolean) = IrConstImpl( - UNDEFINED_OFFSET, - UNDEFINED_OFFSET, - context.irBuiltIns.booleanType, - IrConstKind.Boolean, - value - ) - - private fun irGet(type: IrType, symbol: IrValueSymbol): IrExpression { - return IrGetValueImpl( - UNDEFINED_OFFSET, - UNDEFINED_OFFSET, - type, - symbol - ) - } - - private fun irGet(variable: IrValueDeclaration): IrExpression { - return irGet(variable.type, variable.symbol) - } - - private fun IrType.binaryOperator(name: Name, paramType: IrType): IrFunctionSymbol = - context.symbols.getBinaryOperator(name, this, paramType) - - private fun irAnd(lhs: IrExpression, rhs: IrExpression): IrCallImpl { - return irCall( - lhs.type.binaryOperator(Name.identifier("and"), rhs.type), - null, - lhs, - null, - rhs - ) - } - - private fun irCall( - symbol: IrFunctionSymbol, - origin: IrStatementOrigin? = null, - dispatchReceiver: IrExpression? = null, - extensionReceiver: IrExpression? = null, - vararg args: IrExpression - ): IrCallImpl { - return IrCallImpl( - UNDEFINED_OFFSET, - UNDEFINED_OFFSET, - symbol.owner.returnType, - symbol as IrSimpleFunctionSymbol, - symbol.owner.typeParameters.size, - symbol.owner.valueParameters.size, - origin - ).also { - if (dispatchReceiver != null) it.dispatchReceiver = dispatchReceiver - if (extensionReceiver != null) it.extensionReceiver = extensionReceiver - args.forEachIndexed { index, arg -> - it.putValueArgument(index, arg) - } - } - } - - private fun irNot(value: IrExpression): IrExpression { - return irCall( - context.irBuiltIns.booleanNotSymbol, - dispatchReceiver = value - ) - } - - private fun irEqual(lhs: IrExpression, rhs: IrExpression): IrExpression { - return irCall( - context.irBuiltIns.eqeqeqSymbol, - null, - null, - null, - lhs, - rhs - ) - } } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractComposeLikeIrBytecodeTextTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractComposeLikeIrBytecodeTextTest.kt index aa38c234f63..c63f8f6ee85 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractComposeLikeIrBytecodeTextTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractComposeLikeIrBytecodeTextTest.kt @@ -5,9 +5,15 @@ package org.jetbrains.kotlin.codegen.ir +import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment import org.jetbrains.kotlin.codegen.AbstractBytecodeTextTest import org.jetbrains.kotlin.test.TargetBackend abstract class AbstractComposeLikeIrBytecodeTextTest : AbstractBytecodeTextTest() { override val backend = TargetBackend.JVM_IR + + override fun setupEnvironment(environment: KotlinCoreEnvironment) { + ComposeLikeExtensionRegistrar.registerComponents(environment.project) + super.setupEnvironment(environment) + } } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/ComposeLikeGenerationExtension.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/ComposeLikeGenerationExtension.kt index 52329090f27..b3140b4e942 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/ComposeLikeGenerationExtension.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/ComposeLikeGenerationExtension.kt @@ -1,7 +1,333 @@ /* * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + * + * + * Copyright 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.jetbrains.kotlin.codegen.ir +import com.intellij.mock.MockProject +import com.intellij.openapi.project.Project +import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension +import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext +import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar +import org.jetbrains.kotlin.config.CompilerConfiguration +import org.jetbrains.kotlin.ir.IrStatement +import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET +import org.jetbrains.kotlin.ir.builders.declarations.addValueParameter +import org.jetbrains.kotlin.ir.declarations.* +import org.jetbrains.kotlin.ir.declarations.impl.IrValueParameterImpl +import org.jetbrains.kotlin.ir.descriptors.WrappedValueParameterDescriptor +import org.jetbrains.kotlin.ir.expressions.* +import org.jetbrains.kotlin.ir.expressions.impl.* +import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol +import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol +import org.jetbrains.kotlin.ir.symbols.IrValueSymbol +import org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl +import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.types.isPrimitiveType +import org.jetbrains.kotlin.ir.types.makeNullable +import org.jetbrains.kotlin.ir.util.hasDefaultValue +import org.jetbrains.kotlin.ir.util.isInlined +import org.jetbrains.kotlin.ir.util.statements +import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid +import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid +import org.jetbrains.kotlin.name.Name + +class ComposeLikeExtensionRegistrar : ComponentRegistrar { + companion object { + fun registerComponents(project: Project) { + IrGenerationExtension.registerExtension(project, ComposeLikeGenerationExtension()) + } + } + + override fun registerProjectComponents(project: MockProject, configuration: CompilerConfiguration) { + registerComponents(project) + } +} + +class ComposeLikeGenerationExtension : IrGenerationExtension { + private val rewrittenFunctions = mutableSetOf() + + override fun generate(moduleFragment: IrModuleFragment, pluginContext: IrPluginContext) { + moduleFragment.transformChildrenVoid(ComposeLikeDefaultArgumentRewriter(pluginContext, rewrittenFunctions)) + moduleFragment.transformChildrenVoid(ComposeLikeDefaultMethodCallRewriter(pluginContext, rewrittenFunctions)) + } +} + +class ComposeLikeDefaultMethodCallRewriter(private val context: IrPluginContext, private val rewrittenFunctions: Set) : + IrElementTransformerVoid() { + override fun visitCall(expression: IrCall): IrExpression { + val function = expression.symbol.owner + return if (rewrittenFunctions.contains(function)) { + IrCallImpl( + expression.startOffset, + expression.endOffset, + expression.type, + expression.symbol, + function.typeParameters.size, + function.valueParameters.size, + expression.origin, + expression.superQualifierSymbol + ).also { + it.dispatchReceiver = expression.dispatchReceiver?.transform(this, null) + it.extensionReceiver = expression.extensionReceiver?.transform(this, null) + var bitmap = 0 + for (i in function.valueParameters.indices) { + if (i < expression.valueArgumentsCount) { + if (expression.getValueArgument(i) != null) { + it.putValueArgument(i, expression.getValueArgument(i)) + } else { + bitmap = bitmap or (1.shl(i)) + it.putValueArgument( + i, + IrConstImpl.defaultValueForType( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + function.valueParameters[i].type + ).let { defaultValue -> + IrCompositeImpl( + defaultValue.startOffset, + defaultValue.endOffset, + defaultValue.type, + IrStatementOrigin.DEFAULT_VALUE, + listOf(defaultValue) + ) + } + ) + } + } + } + it.putValueArgument( + function.valueParameters.size - 1, + IrConstImpl.int(UNDEFINED_OFFSET, UNDEFINED_OFFSET, context.irBuiltIns.intType, bitmap) + ) + } + } else { + super.visitCall(expression) + } + } +} + +class ComposeLikeDefaultArgumentRewriter( + private val context: IrPluginContext, + private val rewrittenFunctions: MutableSet +) : IrElementTransformerVoid() { + private val parameterMapping = mutableMapOf() + + override fun visitGetValue(expression: IrGetValue): IrExpression { + parameterMapping[expression.symbol.owner]?.let { + return IrGetValueImpl( + expression.startOffset, + expression.endOffset, + expression.type, + it.symbol, + expression.origin + ) + } ?: return super.visitGetValue(expression) + } + + override fun visitFunction(declaration: IrFunction): IrStatement { + val hasDefaultArguments = declaration.valueParameters.any { it.defaultValue != null } + if (!hasDefaultArguments) return super.visitFunction(declaration) + rewrittenFunctions.add(declaration) + val newParameters = mutableListOf() + declaration.valueParameters.forEach { param -> + newParameters.add( + if (param.defaultValue != null) { + val descriptor = WrappedValueParameterDescriptor() + val result = IrValueParameterImpl( + param.startOffset, + param.endOffset, + param.origin, + IrValueParameterSymbolImpl(descriptor), + param.name, + index = param.index, + type = defaultParameterType(param), + varargElementType = param.varargElementType, + isCrossinline = param.isCrossinline, + isNoinline = param.isNoinline, + isHidden = false, + isAssignable = param.defaultValue != null + ).also { + it.defaultValue = param.defaultValue + it.parent = declaration + } + descriptor.bind(result) + parameterMapping[param] = result + result + } else param + ) + } + declaration.valueParameters = newParameters + val defaultParam = declaration.addValueParameter( + "\$default", + context.irBuiltIns.intType, + IrDeclarationOrigin.MASK_FOR_DEFAULT_FUNCTION + ) + declaration.transformChildrenVoid() + val body = declaration.body!! + val defaultSelection = mutableListOf() + declaration.valueParameters.forEach { + if (it.hasDefaultValue()) { + val index = defaultSelection.size + defaultSelection.add( + irIf( + condition = irGetBit(defaultParam, index), + body = irSet(it, it.defaultValue!!.expression) + ) + ) + it.defaultValue = null + } + } + + declaration.body = IrBlockBodyImpl( + body.startOffset, + body.endOffset, + listOf( + *defaultSelection.toTypedArray(), + *body.statements.toTypedArray() + ), + ) + return declaration + } + + private fun defaultParameterType(param: IrValueParameter): IrType { + val type = param.type + return when { + type.isPrimitiveType() -> type + type.isInlined() -> type + else -> type.makeNullable() + } + } + + private fun irIf(condition: IrExpression, body: IrExpression): IrExpression { + return IrIfThenElseImpl( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + context.irBuiltIns.unitType, + origin = IrStatementOrigin.IF + ).also { + it.branches.add( + IrBranchImpl(condition, body) + ) + } + } + + private fun irSet(variable: IrValueDeclaration, value: IrExpression): IrExpression { + return IrSetValueImpl( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + context.irBuiltIns.unitType, + variable.symbol, + value = value, + origin = null + ) + } + + private fun irNotEqual(lhs: IrExpression, rhs: IrExpression): IrExpression { + return irNot(irEqual(lhs, rhs)) + } + + private fun irGetBit(param: IrValueParameter, index: Int): IrExpression { + // value and (1 shl index) != 0 + return irNotEqual( + irAnd( + // a value of 1 in default means it was NOT provided + irGet(param), + irConst(0b1 shl index) + ), + irConst(0) + ) + } + + private fun irConst(value: Int): IrConst = IrConstImpl( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + context.irBuiltIns.intType, + IrConstKind.Int, + value + ) + + private fun irGet(type: IrType, symbol: IrValueSymbol): IrExpression { + return IrGetValueImpl( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + type, + symbol + ) + } + + private fun irGet(variable: IrValueDeclaration): IrExpression { + return irGet(variable.type, variable.symbol) + } + + private fun IrType.binaryOperator(name: Name, paramType: IrType): IrFunctionSymbol = + context.symbols.getBinaryOperator(name, this, paramType) + + private fun irAnd(lhs: IrExpression, rhs: IrExpression): IrCallImpl { + return irCall( + lhs.type.binaryOperator(Name.identifier("and"), rhs.type), + null, + lhs, + null, + rhs + ) + } + + private fun irCall( + symbol: IrFunctionSymbol, + origin: IrStatementOrigin? = null, + dispatchReceiver: IrExpression? = null, + extensionReceiver: IrExpression? = null, + vararg args: IrExpression + ): IrCallImpl { + return IrCallImpl( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + symbol.owner.returnType, + symbol as IrSimpleFunctionSymbol, + symbol.owner.typeParameters.size, + symbol.owner.valueParameters.size, + origin + ).also { + if (dispatchReceiver != null) it.dispatchReceiver = dispatchReceiver + if (extensionReceiver != null) it.extensionReceiver = extensionReceiver + args.forEachIndexed { index, arg -> + it.putValueArgument(index, arg) + } + } + } + + private fun irNot(value: IrExpression): IrExpression { + return irCall( + context.irBuiltIns.booleanNotSymbol, + dispatchReceiver = value + ) + } + + private fun irEqual(lhs: IrExpression, rhs: IrExpression): IrExpression { + return irCall( + context.irBuiltIns.eqeqeqSymbol, + null, + null, + null, + lhs, + rhs + ) + } +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/ComposeLikeIrBytecodeTextTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/ComposeLikeIrBytecodeTextTestGenerated.java index 0f8c46e3c77..0db1026e44e 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/ComposeLikeIrBytecodeTextTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/ComposeLikeIrBytecodeTextTestGenerated.java @@ -17,7 +17,7 @@ import java.util.regex.Pattern; /** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") -@TestMetadata("compiler/testData/codegen/composeLike") +@TestMetadata("compiler/testData/codegen/composeLikeBytecodeText") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public class ComposeLikeIrBytecodeTextTestGenerated extends AbstractComposeLikeIrBytecodeTextTest { @@ -25,22 +25,22 @@ public class ComposeLikeIrBytecodeTextTestGenerated extends AbstractComposeLikeI KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } - public void testAllFilesPresentInComposeLike() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/composeLike"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + public void testAllFilesPresentInComposeLikeBytecodeText() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/composeLikeBytecodeText"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } @TestMetadata("default.kt") public void testDefault() throws Exception { - runTest("compiler/testData/codegen/composeLike/default.kt"); + runTest("compiler/testData/codegen/composeLikeBytecodeText/default.kt"); } @TestMetadata("defaultInline.kt") public void testDefaultInline() throws Exception { - runTest("compiler/testData/codegen/composeLike/defaultInline.kt"); + runTest("compiler/testData/codegen/composeLikeBytecodeText/defaultInline.kt"); } @TestMetadata("defaultLocal.kt") public void testDefaultLocal() throws Exception { - runTest("compiler/testData/codegen/composeLike/defaultLocal.kt"); + runTest("compiler/testData/codegen/composeLikeBytecodeText/defaultLocal.kt"); } } diff --git a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt index b7230c63cef..74186a873d9 100644 --- a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt +++ b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt @@ -464,6 +464,10 @@ fun main(args: Array) { model("codegen/composeLike", targetBackend = TargetBackend.JVM_IR) } + testClass { + model("codegen/composeLikeBytecodeText", targetBackend = TargetBackend.JVM_IR) + } + testClass { model("codegen/box", targetBackend = TargetBackend.JVM_IR, excludeDirs = listOf("oldLanguageVersions")) } diff --git a/license/README.md b/license/README.md index 42a92549719..150af1e3dd2 100644 --- a/license/README.md +++ b/license/README.md @@ -92,7 +92,10 @@ the Kotlin IntelliJ IDEA plugin: - Path: wasm/ir/src/org/jetbrains/kotlin/wasm/ir/convertors - License: MIT ([license/third_party/asmble_license.txt][asmble]) - Origin: Copyright (C) 2018 Chad Retz - + + - Path: compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/ComposeLikeGenerationExtension.kt + - License: Apache 2 ([license/third_party/aosp_license.txt][aosp]) + - Origin: Derived from JetPack Compose compiler plugin code, Copyright 2019 The Android Open Source Project ## Kotlin Test Data From d43af46bf465e919516db5896be6d512072100c3 Mon Sep 17 00:00:00 2001 From: Vyacheslav Gerasimov Date: Thu, 10 Dec 2020 03:36:41 +0300 Subject: [PATCH 599/698] Build: Add V8 engine & repl.js to js tests inputs --- js/js.tests/build.gradle.kts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/js.tests/build.gradle.kts b/js/js.tests/build.gradle.kts index f4bd1b52f83..88aaf5f24b8 100644 --- a/js/js.tests/build.gradle.kts +++ b/js/js.tests/build.gradle.kts @@ -174,8 +174,10 @@ val unzipV8 by task { fun Test.setupV8() { dependsOn(unzipV8) - val v8ExecutablePath = File(unzipV8.get().destinationDir, "d8").absolutePath + val v8Path = unzipV8.get().destinationDir + val v8ExecutablePath = File(v8Path, "d8") systemProperty("javascript.engine.path.V8", v8ExecutablePath) + inputs.dir(v8Path) } fun Test.setupSpiderMonkey() { @@ -187,11 +189,14 @@ fun Test.setupSpiderMonkey() { fun Test.setUpJsBoxTests(jsEnabled: Boolean, jsIrEnabled: Boolean) { setupV8() + inputs.files(rootDir.resolve("js/js.engines/src/org/jetbrains/kotlin/js/engine/repl.js")) + dependsOn(":dist") if (jsEnabled) { dependsOn(testJsRuntime) inputs.files(testJsRuntime) } + if (jsIrEnabled) { dependsOn(":kotlin-stdlib-js-ir:compileKotlinJs") systemProperty("kotlin.js.full.stdlib.path", "libraries/stdlib/js-ir/build/classes/kotlin/js/main") From 7bbb738a71309ced368fbece91572cb1be180f56 Mon Sep 17 00:00:00 2001 From: Vyacheslav Gerasimov Date: Thu, 10 Dec 2020 16:52:23 +0300 Subject: [PATCH 600/698] Build: Cleanup :js:js.tests buildscript --- js/js.tests/build.gradle.kts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/js/js.tests/build.gradle.kts b/js/js.tests/build.gradle.kts index 88aaf5f24b8..c419bb194f9 100644 --- a/js/js.tests/build.gradle.kts +++ b/js/js.tests/build.gradle.kts @@ -37,9 +37,6 @@ dependencies { testCompileOnly(project(":compiler:cli-js-klib")) testCompileOnly(project(":compiler:util")) testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") } - Platform[193].orLower { - testCompileOnly(intellijDep()) { includeJars("openapi", rootProject = rootProject) } - } testCompileOnly(intellijDep()) { includeJars("idea", "idea_rt", "util") } testCompile(project(":compiler:backend.js")) testCompile(project(":compiler:backend.wasm")) @@ -59,14 +56,8 @@ dependencies { testRuntime(project(":kotlin-reflect")) - if (Platform[193].orLower()) { - testRuntime(intellijDep()) { includeJars("picocontainer", rootProject = rootProject) } - } testRuntime(intellijDep()) { includeJars("trove4j", "guava", "jdom", rootProject = rootProject) } - - val currentOs = OperatingSystem.current() - testRuntime(kotlinStdlib()) testJsRuntime(kotlinStdlib("js")) if (!kotlinBuildProperties.isInJpsBuildIdeaSync) { From 06fd7f8526bf3ab4b928ab5a21c891198cb01983 Mon Sep 17 00:00:00 2001 From: Vyacheslav Gerasimov Date: Thu, 10 Dec 2020 02:51:01 +0300 Subject: [PATCH 601/698] Build: Add helper to configure gradle test distribution --- buildSrc/build.gradle.kts | 1 + buildSrc/src/main/kotlin/testDistribution.kt | 27 ++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 buildSrc/src/main/kotlin/testDistribution.kt diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 145258fee11..2ae3bb8fe71 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -114,6 +114,7 @@ dependencies { implementation("gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:0.5") implementation("org.gradle:test-retry-gradle-plugin:1.1.9") + implementation("com.gradle.enterprise:test-distribution-gradle-plugin:1.2.1") } samWithReceiver { diff --git a/buildSrc/src/main/kotlin/testDistribution.kt b/buildSrc/src/main/kotlin/testDistribution.kt new file mode 100644 index 00000000000..b773e1f27b5 --- /dev/null +++ b/buildSrc/src/main/kotlin/testDistribution.kt @@ -0,0 +1,27 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +import com.gradle.enterprise.gradleplugin.testdistribution.TestDistributionExtension +import org.gradle.api.tasks.testing.Test +import org.gradle.internal.os.OperatingSystem + + +fun Test.configureTestDistribution(configure: TestDistributionExtension.() -> Unit = {}) { + val isTeamcityBuild = project.kotlinBuildProperties.isTeamcityBuild + val testDistributionEnabled = project.findProperty("kotlin.build.test.distribution.enabled")?.toString()?.toBoolean() + ?: isTeamcityBuild + + useJUnitPlatform() + extensions.configure(TestDistributionExtension::class.java) { + enabled.set(testDistributionEnabled) + maxRemoteExecutors.set(20) + if (isTeamcityBuild) { + requirements.set(setOf("os=${OperatingSystem.current().familyName}")) + } else { + maxLocalExecutors.set(0) + } + configure() + } +} From e6327ef49057c2cac8444396b752f9cae3f3324f Mon Sep 17 00:00:00 2001 From: Vyacheslav Gerasimov Date: Thu, 10 Dec 2020 03:06:16 +0300 Subject: [PATCH 602/698] Build: Enable test distribution for :js:js.tests:test task --- js/js.tests/build.gradle.kts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/js.tests/build.gradle.kts b/js/js.tests/build.gradle.kts index c419bb194f9..f7f39642891 100644 --- a/js/js.tests/build.gradle.kts +++ b/js/js.tests/build.gradle.kts @@ -11,6 +11,7 @@ plugins { id("jps-compatible") id("com.github.node-gradle.node") version "2.2.0" id("de.undercouch.download") + id("com.gradle.enterprise.test-distribution") } node { @@ -70,6 +71,8 @@ dependencies { antLauncherJar(commonDep("org.apache.ant", "ant")) antLauncherJar(toolsJar()) + + testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.6.2") } val generationRoot = projectDir.resolve("tests-gen") @@ -248,6 +251,8 @@ projectTest(parallel = true) { outputs.dir("$buildDir/out") outputs.dir("$buildDir/out-min") outputs.dir("$buildDir/out-pir") + + configureTestDistribution() } projectTest("jsTest", true) { From f30c6bf86a7010ebbe99da5b552c112ef8e8e05a Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Mon, 7 Dec 2020 17:43:29 +0100 Subject: [PATCH 603/698] FIR IDE: rework KtCall to work with error cals --- .../FunctionCallHighlightingVisitor.kt | 38 ++++---- .../kotlin/idea/frontend/api/CallInfo.kt | 30 ------- .../idea/frontend/api/KtAnalysisSession.kt | 5 +- .../kotlin/idea/frontend/api/calls/KtCall.kt | 81 +++++++++++++++++ .../idea/frontend/api/calls/ktCallUtils.kt | 20 +++++ .../frontend/api/components/KtCallResolver.kt | 6 +- .../frontend/api/diagnostics/KtDiagnostic.kt | 12 +++ .../org/jetbrains/kotlin/idea/fir/FirUtils.kt | 25 +++++- .../frontend/api/fir/KtSymbolByFirBuilder.kt | 6 +- .../api/fir/components/KtFirCallResolver.kt | 86 +++++++++++-------- .../references/FirReferenceResolveHelper.kt | 19 ++-- .../KtFirInvokeFunctionReference.kt | 6 +- .../resolveCall/functionCallInTheSameFile.kt | 2 +- .../resolveCall/functionWithReceiverCall.kt | 2 +- .../functionWithReceiverSafeCall.kt | 2 +- .../resolveCall/implicitConstuctorCall.kt | 2 +- .../resolveCall/implicitJavaConstuctorCall.kt | 2 +- .../resolveCall/javaFunctionCall.kt | 2 +- .../simpleCallWithNonMatchingArgs.kt | 7 ++ .../resolveCall/variableAsFunction.kt | 2 +- .../resolveCall/variableAsFunctionLikeCall.kt | 2 +- .../api/fir/AbstractResolveCallTest.kt | 10 ++- .../api/fir/ResolveCallTestGenerated.java | 5 ++ .../invoke/lambdaNoParIncorrectVararg.kt | 2 - .../invoke/lambdaNoParLabelIncorrectVararg.kt | 2 - .../lambdaNoParRCurlyIncorrectVararg.kt | 2 - .../nonemptyLambdaRParIncorrectVararg.kt | 2 - 27 files changed, 256 insertions(+), 124 deletions(-) delete mode 100644 idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/CallInfo.kt create mode 100644 idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/calls/KtCall.kt create mode 100644 idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/calls/ktCallUtils.kt create mode 100644 idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/diagnostics/KtDiagnostic.kt create mode 100644 idea/idea-frontend-fir/testData/analysisSession/resolveCall/simpleCallWithNonMatchingArgs.kt diff --git a/idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/highlighter/visitors/FunctionCallHighlightingVisitor.kt b/idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/highlighter/visitors/FunctionCallHighlightingVisitor.kt index 3a90c7c15d9..868fcee900b 100644 --- a/idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/highlighter/visitors/FunctionCallHighlightingVisitor.kt +++ b/idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/highlighter/visitors/FunctionCallHighlightingVisitor.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.idea.fir.highlighter.visitors import com.intellij.lang.annotation.AnnotationHolder import com.intellij.openapi.editor.colors.TextAttributesKey import org.jetbrains.kotlin.idea.frontend.api.* +import org.jetbrains.kotlin.idea.frontend.api.calls.* import org.jetbrains.kotlin.idea.frontend.api.symbols.* import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolKind import org.jetbrains.kotlin.lexer.KtTokens @@ -20,25 +21,20 @@ internal class FunctionCallHighlightingVisitor( holder: AnnotationHolder ) : FirAfterResolveHighlightingVisitor(analysisSession, holder) { override fun visitBinaryExpression(expression: KtBinaryExpression) = with(analysisSession) { - (expression.operationReference as? KtReferenceExpression) - ?.takeIf { - // do not highlight assignment statement - (it as? KtOperationReferenceExpression)?.operationSignTokenType != KtTokens.EQ - }?.let { callee -> - expression.resolveCall() - ?.takeIf { callInfo -> - // ignore arithmetic-like operator calls - (callInfo.targetFunction as? KtFunctionSymbol)?.isOperator != true - } - ?.let { callInfo -> - getTextAttributesForCal(callInfo)?.let { attributes -> - highlightName(callee, attributes) - } - } - } + val operationReference = expression.operationReference as? KtReferenceExpression ?: return + if (operationReference.isAssignment()) return + val call = expression.resolveCall() ?: return + if (call.isErrorCall) return + if (call.isSuccessCallOf { it.isOperator }) return + getTextAttributesForCal(call)?.let { attributes -> + highlightName(operationReference, attributes) + } super.visitBinaryExpression(expression) } + private fun KtReferenceExpression.isAssignment() = + (this as? KtOperationReferenceExpression)?.operationSignTokenType == KtTokens.EQ + override fun visitCallExpression(expression: KtCallExpression) = with(analysisSession) { expression.calleeExpression ?.takeUnless { it is KtLambdaExpression } @@ -53,9 +49,9 @@ internal class FunctionCallHighlightingVisitor( super.visitCallExpression(expression) } - private fun getTextAttributesForCal(callInfo: CallInfo): TextAttributesKey? = when { - callInfo.isSuspendCall -> Colors.SUSPEND_FUNCTION_CALL - callInfo is FunctionCallInfo -> when (val function = callInfo.targetFunction) { + private fun getTextAttributesForCal(call: KtCall): TextAttributesKey? = when { + call.isSuccessCallOf { it.isSuspend } -> Colors.SUSPEND_FUNCTION_CALL + call is KtFunctionCall -> when (val function = call.targetFunction) { is KtConstructorSymbol -> Colors.CONSTRUCTOR_CALL is KtAnonymousFunctionSymbol -> null is KtFunctionSymbol -> when { @@ -66,8 +62,8 @@ internal class FunctionCallHighlightingVisitor( } else -> Colors.FUNCTION_CALL //TODO () } - callInfo is VariableAsFunctionCallInfo -> Colors.VARIABLE_AS_FUNCTION_CALL - callInfo is VariableAsFunctionLikeCallInfo -> Colors.VARIABLE_AS_FUNCTION_LIKE_CALL + call is KtFunctionalTypeVariableCall -> Colors.VARIABLE_AS_FUNCTION_CALL + call is KtVariableWithInvokeFunctionCall -> Colors.VARIABLE_AS_FUNCTION_LIKE_CALL else -> null } } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/CallInfo.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/CallInfo.kt deleted file mode 100644 index 638fc3b3e78..00000000000 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/CallInfo.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.frontend.api - -import org.jetbrains.kotlin.idea.frontend.api.symbols.* - -sealed class CallInfo { - abstract val isSuspendCall: Boolean - abstract val targetFunction: KtFunctionLikeSymbol? -} - -data class VariableAsFunctionCallInfo(val target: KtVariableLikeSymbol, override val isSuspendCall: Boolean) : CallInfo() { - override val targetFunction: KtFunctionLikeSymbol? = null -} - -data class VariableAsFunctionLikeCallInfo(val target: KtVariableLikeSymbol, val invokeFunction: KtFunctionSymbol) : CallInfo() { - override val isSuspendCall: Boolean get() = invokeFunction.isSuspend - override val targetFunction get() = invokeFunction -} - -data class FunctionCallInfo(override val targetFunction: KtFunctionLikeSymbol) : CallInfo() { - override val isSuspendCall: Boolean - get() = when (targetFunction) { - is KtFunctionSymbol -> targetFunction.isSuspend - else -> false - } -} \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt index 6c90bb22adb..466e6625e52 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.idea.frontend.api import org.jetbrains.kotlin.diagnostics.Diagnostic +import org.jetbrains.kotlin.idea.frontend.api.calls.KtCall import org.jetbrains.kotlin.idea.frontend.api.components.* import org.jetbrains.kotlin.idea.frontend.api.scopes.* import org.jetbrains.kotlin.idea.frontend.api.symbols.* @@ -118,9 +119,9 @@ abstract class KtAnalysisSession(override val token: ValidityToken) : ValidityTo fun KtSymbolPointer.restoreSymbol(): S? = restoreSymbol(this@KtAnalysisSession) - fun KtCallExpression.resolveCall(): CallInfo? = callResolver.resolveCall(this) + fun KtCallExpression.resolveCall(): KtCall? = callResolver.resolveCall(this) - fun KtBinaryExpression.resolveCall(): CallInfo? = callResolver.resolveCall(this) + fun KtBinaryExpression.resolveCall(): KtCall? = callResolver.resolveCall(this) fun KtReference.resolveToSymbols(): Collection { check(this is KtSymbolBasedReference) { "To get reference symbol the one should be KtSymbolBasedReference" } diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/calls/KtCall.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/calls/KtCall.kt new file mode 100644 index 00000000000..cdf7d90a585 --- /dev/null +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/calls/KtCall.kt @@ -0,0 +1,81 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.frontend.api.calls + +import org.jetbrains.kotlin.idea.frontend.api.diagnostics.KtDiagnostic +import org.jetbrains.kotlin.idea.frontend.api.symbols.* + +/** + * Represents direct or indirect (via invoke) function call from Kotlin code + */ +sealed class KtCall { + abstract val isErrorCall: Boolean +} + +/** + * Call using `()` of some variable of functional type, e.g., + * + * fun x(f: () -> Int) { + * f() // functional type call + * } + */ +class KtFunctionalTypeVariableCall(val target: KtVariableLikeSymbol) : KtCall() { + override val isErrorCall: Boolean get() = false +} + +/** + * Direct or indirect call of function declared by user + */ +sealed class KtDeclaredFunctionCall : KtCall() { + abstract val targetFunction: KtCallTarget + override val isErrorCall: Boolean + get() = targetFunction is KtErrorCallTarget +} + +/** + * Call using () on variable on some non-functional type, considers that `invoke` function is declared somewhere + * + * fun x(y: Int) { + * y() // variable with invoke function call + * } + * + * fun Int.invoke() {} + */ +class KtVariableWithInvokeFunctionCall( + val target: KtVariableLikeSymbol, + val invokeFunction: KtCallTarget, +) : KtDeclaredFunctionCall() { + override val targetFunction: KtCallTarget get() = invokeFunction +} + +/** + * Simple function call, e.g., + * + * x.toString() // function call + */ +data class KtFunctionCall(override val targetFunction: KtCallTarget) : KtDeclaredFunctionCall() + +/** + * Represents function(s) in which call was resolved, + * Can be success [KtSuccessCallTarget] in this case there only one such function + * Or erroneous [KtErrorCallTarget] in this case there can be any count of candidates + */ +sealed class KtCallTarget { + abstract val candidates: Collection +} + +/** + * Success call of [symbol] + */ +class KtSuccessCallTarget(val symbol: KtFunctionLikeSymbol) : KtCallTarget() { + override val candidates: Collection + get() = listOf(symbol) +} + +/** + * Function all with errors, possible candidates are [candidates] + */ +class KtErrorCallTarget(override val candidates: Collection, val diagnostic: KtDiagnostic) : KtCallTarget() \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/calls/ktCallUtils.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/calls/ktCallUtils.kt new file mode 100644 index 00000000000..29d37d79d61 --- /dev/null +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/calls/ktCallUtils.kt @@ -0,0 +1,20 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.frontend.api.calls + +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtFunctionLikeSymbol + +fun KtCallTarget.getSuccessCallSymbolOrNull(): KtFunctionLikeSymbol? = when (this) { + is KtSuccessCallTarget -> symbol + is KtErrorCallTarget -> null +} + +inline fun KtCall.isSuccessCallOf(predicate: (S) -> Boolean): Boolean { + if (this !is KtFunctionCall) return false + val symbol = targetFunction.getSuccessCallSymbolOrNull() ?: return false + if (symbol !is S) return false + return predicate(symbol) +} \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtCallResolver.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtCallResolver.kt index 011ea9c37fb..cd213ab28fb 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtCallResolver.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtCallResolver.kt @@ -5,11 +5,11 @@ package org.jetbrains.kotlin.idea.frontend.api.components -import org.jetbrains.kotlin.idea.frontend.api.CallInfo +import org.jetbrains.kotlin.idea.frontend.api.calls.KtCall import org.jetbrains.kotlin.psi.KtBinaryExpression import org.jetbrains.kotlin.psi.KtCallExpression abstract class KtCallResolver : KtAnalysisSessionComponent() { - abstract fun resolveCall(call: KtCallExpression): CallInfo? - abstract fun resolveCall(call: KtBinaryExpression): CallInfo? + abstract fun resolveCall(call: KtCallExpression): KtCall? + abstract fun resolveCall(call: KtBinaryExpression): KtCall? } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/diagnostics/KtDiagnostic.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/diagnostics/KtDiagnostic.kt new file mode 100644 index 00000000000..71c3d1501bd --- /dev/null +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/diagnostics/KtDiagnostic.kt @@ -0,0 +1,12 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.frontend.api.diagnostics + +sealed class KtDiagnostic { + abstract val message: String +} + +data class KtSimpleDiagnostic(override val message: String): KtDiagnostic() \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/fir/FirUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/fir/FirUtils.kt index 2c8af72e351..bdbd0c52b94 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/fir/FirUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/fir/FirUtils.kt @@ -8,8 +8,11 @@ package org.jetbrains.kotlin.idea.fir import org.jetbrains.kotlin.fir.declarations.FirDeclaration import org.jetbrains.kotlin.fir.expressions.FirFunctionCall import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression +import org.jetbrains.kotlin.fir.references.FirErrorNamedReference +import org.jetbrains.kotlin.fir.references.FirNamedReference import org.jetbrains.kotlin.fir.references.FirReference import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference +import org.jetbrains.kotlin.fir.resolve.diagnostics.* import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol import org.jetbrains.kotlin.idea.frontend.api.fir.KtSymbolByFirBuilder @@ -19,10 +22,12 @@ import org.jetbrains.kotlin.util.OperatorNameConventions fun FirFunctionCall.isImplicitFunctionCall(): Boolean { if (dispatchReceiver !is FirQualifiedAccessExpression) return false - val resolvedCalleeSymbol = (calleeReference as? FirResolvedNamedReference)?.resolvedSymbol - return (resolvedCalleeSymbol as? FirNamedFunctionSymbol)?.fir?.name == OperatorNameConventions.INVOKE + return calleeReference.getCandidateSymbols().any(FirBasedSymbol<*>::isInvokeFunction) } +private fun FirBasedSymbol<*>.isInvokeFunction() = + (this as? FirNamedFunctionSymbol)?.fir?.name == OperatorNameConventions.INVOKE + fun FirFunctionCall.getCalleeSymbol(): FirBasedSymbol<*>? = calleeReference.getResolvedSymbolOfNameReference() @@ -33,3 +38,19 @@ internal fun FirReference.getResolvedKtSymbolOfNameReference(builder: KtSymbolBy (getResolvedSymbolOfNameReference()?.fir as? FirDeclaration)?.let { firDeclaration -> builder.buildSymbol(firDeclaration) } + +internal fun FirErrorNamedReference.getCandidateSymbols(): Collection> = + when (val diagnostic = diagnostic) { + is ConeInapplicableCandidateError -> listOf(diagnostic.candidateSymbol) + is ConeHiddenCandidateError -> listOf(diagnostic.candidateSymbol) + is ConeAmbiguityError -> diagnostic.candidates + is ConeOperatorAmbiguityError -> diagnostic.candidates + is ConeUnsupportedCallableReferenceTarget -> listOf(diagnostic.fir.symbol) + else -> emptyList() + } + +internal fun FirNamedReference.getCandidateSymbols(): Collection> = when(this) { + is FirResolvedNamedReference -> listOf(resolvedSymbol) + is FirErrorNamedReference -> getCandidateSymbols() + else -> emptyList() +} diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtSymbolByFirBuilder.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtSymbolByFirBuilder.kt index 4c04d4ff8d5..f9c9a4a7f86 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtSymbolByFirBuilder.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtSymbolByFirBuilder.kt @@ -191,7 +191,11 @@ internal class KtSymbolByFirBuilder private constructor( } - fun buildKtType(coneType: FirTypeRef): KtType = buildKtType(coneType.coneTypeUnsafe()) + fun buildKtType(coneType: FirTypeRef): KtType = + buildKtType( + coneType.coneTypeSafe() + ?: error("") + ) fun buildKtType(coneType: ConeKotlinType): KtType = typesCache.cache(coneType) { when (coneType) { diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCallResolver.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCallResolver.kt index 7fc1327b083..764f97807ba 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCallResolver.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCallResolver.kt @@ -6,84 +6,102 @@ package org.jetbrains.kotlin.idea.frontend.api.fir.components import org.jetbrains.kotlin.builtins.StandardNames -import org.jetbrains.kotlin.fir.declarations.isSuspend import org.jetbrains.kotlin.fir.expressions.FirFunctionCall import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression import org.jetbrains.kotlin.fir.expressions.FirSafeCallExpression +import org.jetbrains.kotlin.fir.references.FirErrorNamedReference import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference import org.jetbrains.kotlin.fir.symbols.CallableId -import org.jetbrains.kotlin.fir.symbols.impl.FirConstructorSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol +import org.jetbrains.kotlin.idea.fir.getCandidateSymbols import org.jetbrains.kotlin.idea.fir.isImplicitFunctionCall import org.jetbrains.kotlin.idea.fir.low.level.api.api.getOrBuildFir import org.jetbrains.kotlin.idea.fir.low.level.api.api.getOrBuildFirSafe import org.jetbrains.kotlin.idea.frontend.api.* +import org.jetbrains.kotlin.idea.frontend.api.calls.* import org.jetbrains.kotlin.idea.frontend.api.components.KtCallResolver +import org.jetbrains.kotlin.idea.frontend.api.diagnostics.KtSimpleDiagnostic import org.jetbrains.kotlin.idea.frontend.api.fir.KtFirAnalysisSession -import org.jetbrains.kotlin.idea.frontend.api.symbols.KtFunctionSymbol -import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSymbol -import org.jetbrains.kotlin.idea.frontend.api.symbols.KtVariableLikeSymbol +import org.jetbrains.kotlin.idea.frontend.api.fir.buildSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.* import org.jetbrains.kotlin.idea.references.FirReferenceResolveHelper -import org.jetbrains.kotlin.idea.references.FirReferenceResolveHelper.toTargetSymbol import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.psi.KtBinaryExpression import org.jetbrains.kotlin.psi.KtCallExpression -import org.jetbrains.kotlin.psi.KtExpression internal class KtFirCallResolver( override val analysisSession: KtFirAnalysisSession, override val token: ValidityToken, ) : KtCallResolver(), KtFirAnalysisSessionComponent { - override fun resolveCall(call: KtBinaryExpression): CallInfo? = withValidityAssertion { + override fun resolveCall(call: KtBinaryExpression): KtCall? = withValidityAssertion { val firCall = call.getOrBuildFirSafe(firResolveState) ?: return null - resolveCall(firCall, call) + resolveCall(firCall) } - override fun resolveCall(call: KtCallExpression): CallInfo? = withValidityAssertion { + override fun resolveCall(call: KtCallExpression): KtCall? = withValidityAssertion { val firCall = when (val fir = call.getOrBuildFir(firResolveState)) { is FirFunctionCall -> fir is FirSafeCallExpression -> fir.regularQualifiedAccess as? FirFunctionCall else -> null } ?: return null - return resolveCall(firCall, call) + return resolveCall(firCall) } - private fun resolveCall(firCall: FirFunctionCall, callExpression: KtExpression): CallInfo? { + private fun resolveCall(firCall: FirFunctionCall): KtCall? { val session = firResolveState.rootModuleSession - val resolvedFunctionSymbol = firCall.calleeReference.toTargetSymbol(session, firSymbolBuilder) - val resolvedCalleeSymbol = (firCall.calleeReference as? FirResolvedNamedReference)?.resolvedSymbol return when { - resolvedCalleeSymbol is FirConstructorSymbol -> { - val fir = resolvedCalleeSymbol.fir - FunctionCallInfo(firSymbolBuilder.buildConstructorSymbol(fir)) - } - firCall.dispatchReceiver is FirQualifiedAccessExpression && firCall.isImplicitFunctionCall() -> { + firCall.isImplicitFunctionCall() -> { val target = with(FirReferenceResolveHelper) { val calleeReference = (firCall.dispatchReceiver as FirQualifiedAccessExpression).calleeReference - calleeReference.toTargetSymbol(session, firSymbolBuilder) + calleeReference.toTargetSymbol(session, firSymbolBuilder).singleOrNull() } when (target) { + is KtVariableLikeSymbol -> firCall.createCallByVariableLikeSymbolCall(target) null -> null - is KtVariableLikeSymbol -> { - val functionSymbol = - (firCall.calleeReference as? FirResolvedNamedReference)?.resolvedSymbol as? FirNamedFunctionSymbol - when (functionSymbol?.callableId) { - null -> null - in kotlinFunctionInvokeCallableIds -> VariableAsFunctionCallInfo(target, functionSymbol.fir.isSuspend) - else -> (resolvedFunctionSymbol as? KtFunctionSymbol) - ?.let { VariableAsFunctionLikeCallInfo(target, it) } - } - } - else -> resolvedFunctionSymbol?.asSimpleFunctionCall() + else -> firCall.asSimpleFunctionCall() } } - else -> resolvedFunctionSymbol?.asSimpleFunctionCall() + else -> firCall.asSimpleFunctionCall() } } - private fun KtSymbol.asSimpleFunctionCall() = - (this as? KtFunctionSymbol)?.let(::FunctionCallInfo) + private fun FirFunctionCall.createCallByVariableLikeSymbolCall(variableLikeSymbol: KtVariableLikeSymbol) = + when (val callReference = calleeReference) { + is FirResolvedNamedReference -> { + val functionSymbol = callReference.resolvedSymbol as? FirNamedFunctionSymbol + when (functionSymbol?.callableId) { + null -> null + in kotlinFunctionInvokeCallableIds -> KtFunctionalTypeVariableCall(variableLikeSymbol) + else -> (callReference.resolvedSymbol.fir.buildSymbol(firSymbolBuilder) as? KtFunctionSymbol) + ?.let { KtVariableWithInvokeFunctionCall(variableLikeSymbol, KtSuccessCallTarget(it)) } + } + } + is FirErrorNamedReference -> KtVariableWithInvokeFunctionCall( + variableLikeSymbol, + callReference.createErrorCallTarget() + ) + else -> error("Unexpected call reference ${callReference::class.simpleName}") + } + + private fun FirFunctionCall.asSimpleFunctionCall(): KtFunctionCall? { + val target = when (val calleeReference = calleeReference) { + is FirResolvedNamedReference -> calleeReference.getKtFunctionOrConstructorSymbol()?.let { KtSuccessCallTarget(it) } + is FirErrorNamedReference -> calleeReference.createErrorCallTarget() + else -> error("Unexpected call reference ${calleeReference::class.simpleName}") + } ?: return null + return KtFunctionCall(target) + } + + private fun FirErrorNamedReference.createErrorCallTarget(): KtErrorCallTarget = + KtErrorCallTarget( + getCandidateSymbols().mapNotNull { it.fir.buildSymbol(firSymbolBuilder) as? KtFunctionLikeSymbol }, + KtSimpleDiagnostic(diagnostic.reason) + ) + + private fun FirResolvedNamedReference.getKtFunctionOrConstructorSymbol(): KtFunctionLikeSymbol? = + resolvedSymbol.fir.buildSymbol(firSymbolBuilder) as? KtFunctionLikeSymbol + companion object { private val kotlinFunctionInvokeCallableIds = (0..23).flatMapTo(hashSetOf()) { arity -> diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/FirReferenceResolveHelper.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/FirReferenceResolveHelper.kt index 2f5db53c68d..6fcae082c60 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/FirReferenceResolveHelper.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/FirReferenceResolveHelper.kt @@ -61,7 +61,7 @@ internal object FirReferenceResolveHelper { return classLikeDeclaration?.buildSymbol(symbolBuilder) } - fun FirReference.toTargetSymbol(session: FirSession, symbolBuilder: KtSymbolByFirBuilder): KtSymbol? { + fun FirReference.toTargetSymbol(session: FirSession, symbolBuilder: KtSymbolByFirBuilder): Collection { return when (this) { is FirResolvedNamedReference -> { val fir = when (val symbol = resolvedSymbol) { @@ -75,20 +75,21 @@ internal object FirReferenceResolveHelper { } else -> symbol.fir as? FirDeclaration } - fir?.buildSymbol(symbolBuilder) + listOfNotNull(fir?.buildSymbol(symbolBuilder)) } is FirResolvedCallableReference -> { - resolvedSymbol.fir.buildSymbol(symbolBuilder) + listOfNotNull(resolvedSymbol.fir.buildSymbol(symbolBuilder)) } is FirThisReference -> { - boundSymbol?.fir?.buildSymbol(symbolBuilder) + listOfNotNull(boundSymbol?.fir?.buildSymbol(symbolBuilder)) } is FirSuperReference -> { - (superTypeRef as? FirResolvedTypeRef)?.toTargetSymbol(session, symbolBuilder) + listOfNotNull((superTypeRef as? FirResolvedTypeRef)?.toTargetSymbol(session, symbolBuilder)) } - else -> { - null + is FirErrorNamedReference -> { + getCandidateSymbols().mapNotNull { it.fir.buildSymbol(symbolBuilder) } } + else -> emptyList() } } @@ -195,7 +196,7 @@ internal object FirReferenceResolveHelper { expression: KtSimpleNameExpression, session: FirSession, symbolBuilder: KtSymbolByFirBuilder - ): List { + ): Collection { val calleeReference = if (fir is FirFunctionCall && fir.isImplicitFunctionCall() @@ -207,7 +208,7 @@ internal object FirReferenceResolveHelper { // } (fir.dispatchReceiver as FirQualifiedAccessExpression).calleeReference } else fir.calleeReference - return listOfNotNull(calleeReference.toTargetSymbol(session, symbolBuilder)) + return calleeReference.toTargetSymbol(session, symbolBuilder) } private fun getSymbolsByErrorNamedReference( diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/KtFirInvokeFunctionReference.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/KtFirInvokeFunctionReference.kt index 721f105c045..810cabc38ae 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/KtFirInvokeFunctionReference.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/references/KtFirInvokeFunctionReference.kt @@ -6,7 +6,7 @@ package org.jetbrains.kotlin.idea.references import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession -import org.jetbrains.kotlin.idea.frontend.api.VariableAsFunctionLikeCallInfo +import org.jetbrains.kotlin.idea.frontend.api.calls.KtVariableWithInvokeFunctionCall import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSymbol import org.jetbrains.kotlin.psi.KtCallExpression import org.jetbrains.kotlin.psi.KtExpression @@ -18,8 +18,8 @@ class KtFirInvokeFunctionReference(expression: KtCallExpression) : KtInvokeFunct override fun KtAnalysisSession.resolveToSymbols(): Collection { val call = expression.resolveCall() ?: return emptyList() - if (call is VariableAsFunctionLikeCallInfo) { - return listOf(call.invokeFunction) + if (call is KtVariableWithInvokeFunctionCall) { + return call.invokeFunction.candidates } return emptyList() } diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionCallInTheSameFile.kt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionCallInTheSameFile.kt index dcea8d939c6..ada41cdfe38 100644 --- a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionCallInTheSameFile.kt +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionCallInTheSameFile.kt @@ -4,4 +4,4 @@ fun call() { function(1) } -// CALL: FunctionCallInfo: targetFunction = function(a: kotlin.Int): kotlin.Unit \ No newline at end of file +// CALL: KtFunctionCall: targetFunction = function(a: kotlin.Int): kotlin.Unit \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionWithReceiverCall.kt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionWithReceiverCall.kt index 53eab0c512e..95ebd113c93 100644 --- a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionWithReceiverCall.kt +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionWithReceiverCall.kt @@ -4,4 +4,4 @@ fun call() { "str".function(1) } -// CALL: FunctionCallInfo: targetFunction = function(: kotlin.String, a: kotlin.Int): kotlin.Unit \ No newline at end of file +// CALL: KtFunctionCall: targetFunction = function(: kotlin.String, a: kotlin.Int): kotlin.Unit \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionWithReceiverSafeCall.kt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionWithReceiverSafeCall.kt index c5927c2c429..061099b7a33 100644 --- a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionWithReceiverSafeCall.kt +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionWithReceiverSafeCall.kt @@ -4,4 +4,4 @@ fun call() { "str"?.function(1) } -// CALL: FunctionCallInfo: targetFunction = function(: kotlin.String, a: kotlin.Int): kotlin.Unit \ No newline at end of file +// CALL: KtFunctionCall: targetFunction = function(: kotlin.String, a: kotlin.Int): kotlin.Unit \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitConstuctorCall.kt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitConstuctorCall.kt index 1efa530e7d5..433f0975a2f 100644 --- a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitConstuctorCall.kt +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitConstuctorCall.kt @@ -4,4 +4,4 @@ fun call() { val a = A() } -// CALL: FunctionCallInfo: targetFunction = (): A \ No newline at end of file +// CALL: KtFunctionCall: targetFunction = (): A \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitJavaConstuctorCall.kt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitJavaConstuctorCall.kt index 6b30b9a4a09..4fa16f5b0ee 100644 --- a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitJavaConstuctorCall.kt +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitJavaConstuctorCall.kt @@ -3,4 +3,4 @@ fun call() { val a = A() } -// CALL: FunctionCallInfo: targetFunction = (): A \ No newline at end of file +// CALL: KtFunctionCall: targetFunction = (): A \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/javaFunctionCall.kt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/javaFunctionCall.kt index f54b3426f93..f4b7218d2c2 100644 --- a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/javaFunctionCall.kt +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/javaFunctionCall.kt @@ -3,4 +3,4 @@ fun call() { javaClass.javaMethod() } -// CALL: FunctionCallInfo: targetFunction = JavaClass.javaMethod(): kotlin.Unit \ No newline at end of file +// CALL: KtFunctionCall: targetFunction = JavaClass.javaMethod(): kotlin.Unit \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/simpleCallWithNonMatchingArgs.kt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/simpleCallWithNonMatchingArgs.kt new file mode 100644 index 00000000000..d545781d068 --- /dev/null +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/simpleCallWithNonMatchingArgs.kt @@ -0,0 +1,7 @@ +fun x() { + foo(1) +} + +fun foo(){} + +// CALL: KtFunctionCall: targetFunction = ERR \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/variableAsFunction.kt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/variableAsFunction.kt index 5a5383f2b8e..b052bf57cc4 100644 --- a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/variableAsFunction.kt +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/variableAsFunction.kt @@ -2,4 +2,4 @@ fun call(x: (Int) -> String) { x(1) } -// CALL: VariableAsFunctionCallInfo: target = x: kotlin.Function1, isSuspendCall = false \ No newline at end of file +// CALL: KtFunctionalTypeVariableCall: target = x: kotlin.Function1 \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/variableAsFunctionLikeCall.kt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/variableAsFunctionLikeCall.kt index 31a733dc2d7..3db95ffbec2 100644 --- a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/variableAsFunctionLikeCall.kt +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/variableAsFunctionLikeCall.kt @@ -4,4 +4,4 @@ fun call(x: kotlin.int) { x() } -// CALL: FunctionCallInfo: targetFunction = invoke(: kotlin.Int): kotlin.String \ No newline at end of file +// CALL: KtFunctionCall: targetFunction = invoke(: kotlin.Int): kotlin.String \ No newline at end of file diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/fir/AbstractResolveCallTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/fir/AbstractResolveCallTest.kt index 400a1562bb6..622a493f1ec 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/fir/AbstractResolveCallTest.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/fir/AbstractResolveCallTest.kt @@ -11,8 +11,10 @@ import com.intellij.psi.PsiElement import com.intellij.testFramework.LightCodeInsightTestCase import org.jetbrains.kotlin.idea.addExternalTestFiles import org.jetbrains.kotlin.idea.executeOnPooledThreadInReadAction -import org.jetbrains.kotlin.idea.frontend.api.CallInfo import org.jetbrains.kotlin.idea.frontend.api.analyze +import org.jetbrains.kotlin.idea.frontend.api.calls.KtCall +import org.jetbrains.kotlin.idea.frontend.api.calls.KtErrorCallTarget +import org.jetbrains.kotlin.idea.frontend.api.calls.KtSuccessCallTarget import org.jetbrains.kotlin.idea.frontend.api.symbols.KtFunctionLikeSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtFunctionSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtParameterSymbol @@ -86,9 +88,9 @@ abstract class AbstractResolveCallTest : @Suppress("DEPRECATION") LightCodeInsig ) } -private fun CallInfo.stringRepresentation(): String { +private fun KtCall.stringRepresentation(): String { fun KtType.render() = asStringForDebugging().replace('/', '.') - fun Any.stringValue(): String? = when (this) { + fun Any.stringValue(): String = when (this) { is KtFunctionLikeSymbol -> buildString { append(if (this@stringValue is KtFunctionSymbol) callableIdIfNonLocal ?: name else "") append("(") @@ -103,6 +105,8 @@ private fun CallInfo.stringRepresentation(): String { append(": ${type.render()}") } is KtParameterSymbol -> "$name: ${type.render()}" + is KtSuccessCallTarget -> symbol.stringValue() + is KtErrorCallTarget -> "ERR<${this.diagnostic.message}, [${candidates.joinToString { it.stringValue() }}]>" is Boolean -> toString() else -> error("unexpected parameter type ${this::class}") } diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/fir/ResolveCallTestGenerated.java b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/fir/ResolveCallTestGenerated.java index 1ce83128cf9..676a9dd5d57 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/fir/ResolveCallTestGenerated.java +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/fir/ResolveCallTestGenerated.java @@ -58,6 +58,11 @@ public class ResolveCallTestGenerated extends AbstractResolveCallTest { runTest("idea/idea-frontend-fir/testData/analysisSession/resolveCall/javaFunctionCall.kt"); } + @TestMetadata("simpleCallWithNonMatchingArgs.kt") + public void testSimpleCallWithNonMatchingArgs() throws Exception { + runTest("idea/idea-frontend-fir/testData/analysisSession/resolveCall/simpleCallWithNonMatchingArgs.kt"); + } + @TestMetadata("variableAsFunction.kt") public void testVariableAsFunction() throws Exception { runTest("idea/idea-frontend-fir/testData/analysisSession/resolveCall/variableAsFunction.kt"); diff --git a/idea/testData/resolve/references/invoke/lambdaNoParIncorrectVararg.kt b/idea/testData/resolve/references/invoke/lambdaNoParIncorrectVararg.kt index 253157780a9..cd6e79d71c2 100644 --- a/idea/testData/resolve/references/invoke/lambdaNoParIncorrectVararg.kt +++ b/idea/testData/resolve/references/invoke/lambdaNoParIncorrectVararg.kt @@ -1,5 +1,3 @@ -// IGNORE_FIR - class Foo { fun invoke(vararg a: Any) {} } diff --git a/idea/testData/resolve/references/invoke/lambdaNoParLabelIncorrectVararg.kt b/idea/testData/resolve/references/invoke/lambdaNoParLabelIncorrectVararg.kt index 6e3ba435282..0ae77948e39 100644 --- a/idea/testData/resolve/references/invoke/lambdaNoParLabelIncorrectVararg.kt +++ b/idea/testData/resolve/references/invoke/lambdaNoParLabelIncorrectVararg.kt @@ -1,5 +1,3 @@ -// IGNORE_FIR - class Foo { fun invoke(vararg a: Any) {} } diff --git a/idea/testData/resolve/references/invoke/lambdaNoParRCurlyIncorrectVararg.kt b/idea/testData/resolve/references/invoke/lambdaNoParRCurlyIncorrectVararg.kt index 1d52891066c..1dc808f0527 100644 --- a/idea/testData/resolve/references/invoke/lambdaNoParRCurlyIncorrectVararg.kt +++ b/idea/testData/resolve/references/invoke/lambdaNoParRCurlyIncorrectVararg.kt @@ -1,5 +1,3 @@ -// IGNORE_FIR - class Foo { fun invoke(vararg a: Any) {} } diff --git a/idea/testData/resolve/references/invoke/nonemptyLambdaRParIncorrectVararg.kt b/idea/testData/resolve/references/invoke/nonemptyLambdaRParIncorrectVararg.kt index 36dfb64d544..2ce67a054ed 100644 --- a/idea/testData/resolve/references/invoke/nonemptyLambdaRParIncorrectVararg.kt +++ b/idea/testData/resolve/references/invoke/nonemptyLambdaRParIncorrectVararg.kt @@ -1,5 +1,3 @@ -// IGNORE_FIR - class Foo { fun invoke(vararg a: Any) {} } From 170928f498608a9246259c96f7c530cb33f06de7 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Wed, 9 Dec 2020 19:52:06 +0100 Subject: [PATCH 604/698] FIR IDE: allow type rendering only in analysis session --- .../KotlinHighLevelExpressionTypeProvider.kt | 1 - .../KotlinFirLookupElementFactory.kt | 20 ++- .../FunctionCallHighlightingVisitor.kt | 2 +- .../idea/frontend/api/KtAnalysisSession.kt | 7 +- .../frontend/api/KtAnalysisSessionProvider.kt | 1 - .../frontend/api/components/KtTypeRenderer.kt | 115 ++++++++++++++++++ .../idea/frontend/api/types/KtTypeRenderer.kt | 106 ---------------- .../frontend/api/types/KtTypeRendererTest.kt | 2 + 8 files changed, 132 insertions(+), 122 deletions(-) create mode 100644 idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtTypeRenderer.kt diff --git a/idea/idea-fir/src/org/jetbrains/kotlin/idea/codeInsight/KotlinHighLevelExpressionTypeProvider.kt b/idea/idea-fir/src/org/jetbrains/kotlin/idea/codeInsight/KotlinHighLevelExpressionTypeProvider.kt index ac767e4feea..ba7914236e4 100644 --- a/idea/idea-fir/src/org/jetbrains/kotlin/idea/codeInsight/KotlinHighLevelExpressionTypeProvider.kt +++ b/idea/idea-fir/src/org/jetbrains/kotlin/idea/codeInsight/KotlinHighLevelExpressionTypeProvider.kt @@ -7,7 +7,6 @@ package org.jetbrains.kotlin.idea.codeInsight import com.intellij.openapi.util.text.StringUtil import org.jetbrains.kotlin.idea.frontend.api.analyseInModalWindow -import org.jetbrains.kotlin.idea.frontend.api.types.render import org.jetbrains.kotlin.psi.KtExpression class KotlinHighLevelExpressionTypeProvider : KotlinExpressionTypeProvider() { diff --git a/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/KotlinFirLookupElementFactory.kt b/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/KotlinFirLookupElementFactory.kt index 8c676f0760e..b842a33a884 100644 --- a/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/KotlinFirLookupElementFactory.kt +++ b/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/KotlinFirLookupElementFactory.kt @@ -19,8 +19,6 @@ import com.intellij.psi.PsiElement import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession import org.jetbrains.kotlin.idea.frontend.api.symbols.* import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtNamedSymbol -import org.jetbrains.kotlin.idea.frontend.api.types.KtType -import org.jetbrains.kotlin.idea.frontend.api.types.render import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.psi.KtTypeArgumentList @@ -36,7 +34,7 @@ internal class KotlinFirLookupElementFactory { fun KtAnalysisSession.createLookupElement(symbol: KtNamedSymbol): LookupElement? { val elementBuilder = when (symbol) { is KtFunctionSymbol -> with(functionLookupElementFactory) { createLookup(symbol) } - is KtVariableLikeSymbol -> variableLookupElementFactory.createLookup(symbol) + is KtVariableLikeSymbol -> with(variableLookupElementFactory) { createLookup(symbol) } is KtClassLikeSymbol -> classLookupElementFactory.createLookup(symbol) is KtTypeParameterSymbol -> typeParameterLookupElementFactory.createLookup(symbol) else -> throw IllegalArgumentException("Cannot create a lookup element for $symbol") @@ -66,9 +64,9 @@ private class TypeParameterLookupElementFactory { } private class VariableLookupElementFactory { - fun createLookup(symbol: KtVariableLikeSymbol): LookupElementBuilder { + fun KtAnalysisSession.createLookup(symbol: KtVariableLikeSymbol): LookupElementBuilder { return LookupElementBuilder.create(UniqueLookupObject(), symbol.name.asString()) - .withTypeText(ShortNamesRenderer.renderType(symbol.type)) + .withTypeText(symbol.type.render()) .withInsertHandler(createInsertHandler(symbol)) } @@ -82,7 +80,7 @@ private class FunctionLookupElementFactory { return try { LookupElementBuilder.create(UniqueLookupObject(), symbol.name.asString()) .withTailText(getTailText(symbol), true) - .withTypeText(ShortNamesRenderer.renderType(symbol.type)) + .withTypeText(symbol.type.render()) .withInsertHandler(createInsertHandler(symbol)) } catch (e: Throwable) { if (e is ControlFlowException) throw e @@ -92,7 +90,7 @@ private class FunctionLookupElementFactory { } private fun KtAnalysisSession.getTailText(symbol: KtFunctionSymbol): String { - return if (insertLambdaBraces(symbol)) " {...}" else ShortNamesRenderer.renderFunctionParameters(symbol) + return if (insertLambdaBraces(symbol)) " {...}" else with(ShortNamesRenderer) { renderFunctionParameters(symbol) } } private fun KtAnalysisSession.insertLambdaBraces(symbol: KtFunctionSymbol): Boolean { @@ -215,13 +213,11 @@ private open class QuotedNamesAwareInsertionHandler(private val name: Name) : In private object ShortNamesRenderer { - fun renderFunctionParameters(function: KtFunctionSymbol): String = + fun KtAnalysisSession.renderFunctionParameters(function: KtFunctionSymbol): String = function.valueParameters.joinToString(", ", "(", ")") { renderFunctionParameter(it) } - fun renderType(ktType: KtType): String = ktType.render() - - private fun renderFunctionParameter(param: KtFunctionParameterSymbol): String = - "${if (param.isVararg) "vararg " else ""}${param.name.asString()}: ${renderType(param.type)}" + private fun KtAnalysisSession.renderFunctionParameter(param: KtFunctionParameterSymbol): String = + "${if (param.isVararg) "vararg " else ""}${param.name.asString()}: ${param.type.render()}" } private fun Document.isTextAt(offset: Int, text: String) = diff --git a/idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/highlighter/visitors/FunctionCallHighlightingVisitor.kt b/idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/highlighter/visitors/FunctionCallHighlightingVisitor.kt index 868fcee900b..663aa28b565 100644 --- a/idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/highlighter/visitors/FunctionCallHighlightingVisitor.kt +++ b/idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/highlighter/visitors/FunctionCallHighlightingVisitor.kt @@ -51,7 +51,7 @@ internal class FunctionCallHighlightingVisitor( private fun getTextAttributesForCal(call: KtCall): TextAttributesKey? = when { call.isSuccessCallOf { it.isSuspend } -> Colors.SUSPEND_FUNCTION_CALL - call is KtFunctionCall -> when (val function = call.targetFunction) { + call is KtFunctionCall -> when (val function = call.targetFunction.getSuccessCallSymbolOrNull()) { is KtConstructorSymbol -> Colors.CONSTRUCTOR_CALL is KtAnonymousFunctionSymbol -> null is KtFunctionSymbol -> when { diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt index 466e6625e52..fcd06bf919e 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt @@ -33,7 +33,7 @@ import org.jetbrains.kotlin.psi.* * * To create analysis session consider using [analyze] */ -abstract class KtAnalysisSession(override val token: ValidityToken) : ValidityTokenOwner { +abstract class KtAnalysisSession(final override val token: ValidityToken) : ValidityTokenOwner { protected abstract val smartCastProvider: KtSmartCastProvider protected abstract val typeProvider: KtTypeProvider protected abstract val diagnosticProvider: KtDiagnosticProvider @@ -43,6 +43,8 @@ abstract class KtAnalysisSession(override val token: ValidityToken) : ValidityTo protected abstract val callResolver: KtCallResolver protected abstract val completionCandidateChecker: KtCompletionCandidateChecker protected abstract val symbolDeclarationOverridesProvider: KtSymbolDeclarationOverridesProvider + @Suppress("LeakingThis") + protected open val typeRenderer: KtTypeRenderer = KtDefaultTypeRenderer(this, token) /// TODO: get rid of @Deprecated("Used only in completion now, temporary") @@ -143,4 +145,7 @@ abstract class KtAnalysisSession(override val token: ValidityToken) : ValidityTo psiFakeCompletionExpression, psiReceiverExpression ) + + fun KtType.render(options: KtTypeRendererOptions = KtTypeRendererOptions.DEFAULT): String = + typeRenderer.render(this, options) } diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSessionProvider.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSessionProvider.kt index b19be1f6c09..e4e2d27bbe7 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSessionProvider.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSessionProvider.kt @@ -10,7 +10,6 @@ import com.intellij.openapi.components.service import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.progress.ProgressIndicator import com.intellij.openapi.progress.Task -import org.jetbrains.kotlin.idea.frontend.api.types.render import org.jetbrains.kotlin.idea.util.application.runReadAction import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.utils.PrintingLogger diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtTypeRenderer.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtTypeRenderer.kt new file mode 100644 index 00000000000..451368ac759 --- /dev/null +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtTypeRenderer.kt @@ -0,0 +1,115 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.frontend.api.components + +import org.jetbrains.kotlin.idea.frontend.api.* +import org.jetbrains.kotlin.idea.frontend.api.types.* +import org.jetbrains.kotlin.name.ClassId + +abstract class KtTypeRenderer : KtAnalysisSessionComponent() { + abstract fun render(type: KtType, options: KtTypeRendererOptions): String +} + +data class KtTypeRendererOptions( + val renderFqNames: Boolean, +) { + companion object { + val DEFAULT = KtTypeRendererOptions( + renderFqNames = true + ) + } +} + +class KtDefaultTypeRenderer(override val analysisSession: KtAnalysisSession, override val token: ValidityToken) : KtTypeRenderer() { + override fun render(type: KtType, options: KtTypeRendererOptions): String = type.withValidityAssertion { + buildString { render(type, options) } + } + + private fun StringBuilder.render(type: KtType, options: KtTypeRendererOptions) { + when (type) { + is KtDenotableType -> when (type) { + is KtClassType -> { + render(type.classId, options) + renderTypeArgumentsIfNotEmpty(type.typeArguments, options) + renderNullability(type.nullability) + } + is KtTypeParameterType -> { + append(type.name.asString()) + renderNullability(type.nullability) + } + } + is KtNonDenotableType -> when (type) { + is KtFlexibleType -> inParens { + render(type.lowerBound, options) + append("..") + render(type.upperBound, options) + } + is KtIntersectionType -> inParens { + type.conjuncts.forEachIndexed { index, conjunct -> + render(conjunct, options) + if (index != type.conjuncts.lastIndex) { + append("&") + } + } + } + } + is KtErrorType -> { + append(type.error) + } + else -> error("Unsupported type ${type::class}") + } + } + + private fun StringBuilder.renderTypeArgumentsIfNotEmpty(typeArguments: List, options: KtTypeRendererOptions) { + if (typeArguments.isNotEmpty()) { + append("<") + typeArguments.forEachIndexed { index, typeArgument -> + render(typeArgument, options) + if (index != typeArguments.lastIndex) { + append(", ") + } + } + append(">") + } + } + + private fun StringBuilder.render(typeArgument: KtTypeArgument, options: KtTypeRendererOptions) { + when (typeArgument) { + KtStarProjectionTypeArgument -> { + append("*") + } + is KtTypeArgumentWithVariance -> { + val varianceWithSpace = when (typeArgument.variance) { + KtTypeArgumentVariance.COVARIANT -> "out " + KtTypeArgumentVariance.CONTRAVARIANT -> "in " + KtTypeArgumentVariance.INVARIANT -> "" + } + append(varianceWithSpace) + render(typeArgument.type, options) + } + } + } + + private fun StringBuilder.renderNullability(nullability: KtTypeNullability) { + if (nullability == KtTypeNullability.NULLABLE) { + append("?") + } + } + + private fun StringBuilder.render(classId: ClassId, options: KtTypeRendererOptions) { + if (options.renderFqNames) { + append(classId.asString().replace('/', '.')) + } else { + append(classId.shortClassName.asString()) + } + } + + private inline fun StringBuilder.inParens(render: StringBuilder.() -> Unit) { + append("(") + render() + append(")") + } +} \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/types/KtTypeRenderer.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/types/KtTypeRenderer.kt index b488abec940..de1a270e6c7 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/types/KtTypeRenderer.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/types/KtTypeRenderer.kt @@ -7,109 +7,3 @@ package org.jetbrains.kotlin.idea.frontend.api.types import org.jetbrains.kotlin.idea.frontend.api.* import org.jetbrains.kotlin.name.ClassId - -private object KtTypeRenderer { - fun render(type: KtType, options: KtTypeRendererOptions = KtTypeRendererOptions.DEFAULT): String = type.withValidityAssertion { - buildString { render(type, options) } - } - - private fun StringBuilder.render(type: KtType, options: KtTypeRendererOptions) { - when (type) { - is KtDenotableType -> when (type) { - is KtClassType -> { - render(type.classId, options) - renderTypeArgumentsIfNotEmpty(type.typeArguments, options) - renderNullability(type.nullability) - } - is KtTypeParameterType -> { - append(type.name.asString()) - renderNullability(type.nullability) - } - } - is KtNonDenotableType -> when (type) { - is KtFlexibleType -> inParens { - render(type.lowerBound, options) - append("..") - render(type.upperBound, options) - } - is KtIntersectionType -> inParens { - type.conjuncts.forEachIndexed { index, conjunct -> - render(conjunct, options) - if (index != type.conjuncts.lastIndex) { - append("&") - } - } - } - } - is KtErrorType -> { - append(type.error) - } - else -> error("Unsupported type ${type::class}") - } - } - - private fun StringBuilder.renderTypeArgumentsIfNotEmpty(typeArguments: List, options: KtTypeRendererOptions) { - if (typeArguments.isNotEmpty()) { - append("<") - typeArguments.forEachIndexed { index, typeArgument -> - render(typeArgument, options) - if (index != typeArguments.lastIndex) { - append(", ") - } - } - append(">") - } - } - - private fun StringBuilder.render(typeArgument: KtTypeArgument, options: KtTypeRendererOptions) { - when (typeArgument) { - KtStarProjectionTypeArgument -> { - append("*") - } - is KtTypeArgumentWithVariance -> { - val varianceWithSpace = when (typeArgument.variance) { - KtTypeArgumentVariance.COVARIANT -> "out " - KtTypeArgumentVariance.CONTRAVARIANT -> "in " - KtTypeArgumentVariance.INVARIANT -> "" - } - append(varianceWithSpace) - render(typeArgument.type, options) - } - } - } - - private fun StringBuilder.renderNullability(nullability: KtTypeNullability) { - if (nullability == KtTypeNullability.NULLABLE) { - append("?") - } - } - - private fun StringBuilder.render(classId: ClassId, options: KtTypeRendererOptions) { - if (options.renderFqNames) { - append(classId.asString().replace('/', '.')) - } else { - append(classId.shortClassName.asString()) - } - } - - private inline fun StringBuilder.inParens(render: StringBuilder.() -> Unit) { - append("(") - render() - append(")") - - } -} - -data class KtTypeRendererOptions( - val renderFqNames: Boolean, -) { - companion object { - val DEFAULT = KtTypeRendererOptions( - renderFqNames = true - ) - } -} - -fun KtType.render(options: KtTypeRendererOptions = KtTypeRendererOptions.DEFAULT): String = - KtTypeRenderer.render(this, options) - diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/types/KtTypeRendererTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/types/KtTypeRendererTest.kt index 8efd5c7d3a2..1f132b524fc 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/types/KtTypeRendererTest.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/types/KtTypeRendererTest.kt @@ -8,6 +8,8 @@ package org.jetbrains.kotlin.idea.frontend.api.types import com.intellij.testFramework.LightProjectDescriptor import org.jetbrains.kotlin.idea.executeOnPooledThreadInReadAction import org.jetbrains.kotlin.idea.frontend.api.analyze +import org.jetbrains.kotlin.idea.frontend.api.analyze +import org.jetbrains.kotlin.idea.frontend.api.components.KtTypeRendererOptions import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase import org.jetbrains.kotlin.idea.test.KotlinLightProjectDescriptor import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor From a9ad85f306eba20874c5692d6ac824f87c96483e Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 10 Dec 2020 15:26:17 +0100 Subject: [PATCH 605/698] FIR IDE: temporary mute find usages test as it fails because of incorrect resolve of init blocks --- .../idea/frontend/api/fir/components/KtFirCallResolver.kt | 5 +++++ .../kotlinConstructorParameterUsages.0.kt | 1 + .../kotlinConstructorParameterUsages.results.txt | 8 ++++---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCallResolver.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCallResolver.kt index 764f97807ba..7cdd54c9b03 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCallResolver.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCallResolver.kt @@ -11,6 +11,7 @@ import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression import org.jetbrains.kotlin.fir.expressions.FirSafeCallExpression import org.jetbrains.kotlin.fir.references.FirErrorNamedReference import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference +import org.jetbrains.kotlin.fir.references.impl.FirSimpleNamedReference import org.jetbrains.kotlin.fir.symbols.CallableId import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol import org.jetbrains.kotlin.idea.fir.getCandidateSymbols @@ -88,6 +89,10 @@ internal class KtFirCallResolver( val target = when (val calleeReference = calleeReference) { is FirResolvedNamedReference -> calleeReference.getKtFunctionOrConstructorSymbol()?.let { KtSuccessCallTarget(it) } is FirErrorNamedReference -> calleeReference.createErrorCallTarget() + is FirSimpleNamedReference -> error( + "Looks like FirFunctionCall was not resolved to BODY_RESOLVE phase, " + + "consider resolving it containing declaration before starting resolve calls" + ) else -> error("Unexpected call reference ${calleeReference::class.simpleName}") } ?: return null return KtFunctionCall(target) diff --git a/idea/testData/findUsages/kotlin/findParameterUsages/kotlinConstructorParameterUsages.0.kt b/idea/testData/findUsages/kotlin/findParameterUsages/kotlinConstructorParameterUsages.0.kt index 6f96bd6f9d9..523fb260670 100644 --- a/idea/testData/findUsages/kotlin/findParameterUsages/kotlinConstructorParameterUsages.0.kt +++ b/idea/testData/findUsages/kotlin/findParameterUsages/kotlinConstructorParameterUsages.0.kt @@ -1,5 +1,6 @@ // PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter // OPTIONS: usages +// FIR_IGNORE open class A(foo: T) { init { println(foo) diff --git a/idea/testData/findUsages/kotlin/findParameterUsages/kotlinConstructorParameterUsages.results.txt b/idea/testData/findUsages/kotlin/findParameterUsages/kotlinConstructorParameterUsages.results.txt index 036df139ce4..0823ac0c321 100644 --- a/idea/testData/findUsages/kotlin/findParameterUsages/kotlinConstructorParameterUsages.results.txt +++ b/idea/testData/findUsages/kotlin/findParameterUsages/kotlinConstructorParameterUsages.results.txt @@ -1,4 +1,4 @@ -Named argument 11 return A(foo = ":)") -Named argument 16 A(foo = ":)") -Value read 5 println(foo) -Value read 8 val t: T = foo +Named argument 12 return A(foo = ":)") +Named argument 17 A(foo = ":)") +Value read 6 println(foo) +Value read 9 val t: T = foo From 5efe774dbad8d4df8c76e1e9c94029412528d93e Mon Sep 17 00:00:00 2001 From: pyos Date: Tue, 1 Dec 2020 13:13:13 +0300 Subject: [PATCH 606/698] FIR: remap Java meta-annotations to Kotlin equivalents This is a direct port of JavaAnnotationMapper from the old frontend. --- .../enhancement/jsr305/NonNullNever.fir.txt | 2 +- .../FieldsAreNullable.fir.txt | 2 +- .../ForceFlexibility.fir.txt | 8 +- .../ForceFlexibleOverOverrides.fir.txt | 6 +- .../NullabilityFromOverridden.fir.txt | 4 +- .../OverridingDefaultQualifier.fir.txt | 6 +- .../SpringNullable.fir.txt | 4 +- .../SpringNullablePackage.fir.txt | 4 +- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 + .../jetbrains/kotlin/fir/java/JavaUtils.kt | 182 +++++++++++------- .../annotations/javaAnnotationOnProperty.kt | 25 +++ .../codegen/BlackBoxCodegenTestGenerated.java | 5 + .../LightAnalysisModeTestGenerated.java | 5 + .../ir/IrBlackBoxCodegenTestGenerated.java | 5 + .../memberScopeByFqName/java.lang.String.txt | 8 +- 15 files changed, 181 insertions(+), 90 deletions(-) create mode 100644 compiler/testData/codegen/box/annotations/javaAnnotationOnProperty.kt diff --git a/compiler/fir/analysis-tests/testData/enhancement/jsr305/NonNullNever.fir.txt b/compiler/fir/analysis-tests/testData/enhancement/jsr305/NonNullNever.fir.txt index 161025c1fc1..69664307a80 100644 --- a/compiler/fir/analysis-tests/testData/enhancement/jsr305/NonNullNever.fir.txt +++ b/compiler/fir/analysis-tests/testData/enhancement/jsr305/NonNullNever.fir.txt @@ -1,4 +1,4 @@ -@R|java/lang/annotation/Documented|() @R|javax/annotation/meta/TypeQualifierNickname|() @R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.NEVER|()) @R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) public abstract annotation class MyNullable : R|kotlin/Annotation| { +@R|kotlin/annotation/MustBeDocumented|() @R|javax/annotation/meta/TypeQualifierNickname|() @R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.NEVER|()) @R|kotlin/annotation/Retention|(R|kotlin/annotation/AnnotationRetention.RUNTIME|()) public abstract annotation class MyNullable : R|kotlin/Annotation| { public constructor(): R|MyNullable| } diff --git a/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/FieldsAreNullable.fir.txt b/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/FieldsAreNullable.fir.txt index ad6909b7480..f2cde97ce47 100644 --- a/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/FieldsAreNullable.fir.txt +++ b/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/FieldsAreNullable.fir.txt @@ -10,7 +10,7 @@ public constructor(): R|A| } -@R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/CheckForNull|() @R|javax/annotation/meta/TypeQualifierDefault|((R|java/lang/annotation/ElementType.FIELD|())) public abstract annotation class FieldsAreNullable : R|kotlin/Annotation| { +@R|kotlin/annotation/Retention|(R|kotlin/annotation/AnnotationRetention.RUNTIME|()) @R|kotlin/annotation/MustBeDocumented|() @R|javax/annotation/CheckForNull|() @R|javax/annotation/meta/TypeQualifierDefault|((R|java/lang/annotation/ElementType.FIELD|())) public abstract annotation class FieldsAreNullable : R|kotlin/Annotation| { public constructor(): R|FieldsAreNullable| } diff --git a/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/ForceFlexibility.fir.txt b/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/ForceFlexibility.fir.txt index f62cdd4dae6..21a4a011736 100644 --- a/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/ForceFlexibility.fir.txt +++ b/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/ForceFlexibility.fir.txt @@ -6,19 +6,19 @@ public constructor(): R|A| } -@R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|spr/UnknownNullability|() @R|javax/annotation/meta/TypeQualifierDefault|((R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|())) public abstract annotation class ForceFlexibility : R|kotlin/Annotation| { +@R|kotlin/annotation/Retention|(R|kotlin/annotation/AnnotationRetention.RUNTIME|()) @R|kotlin/annotation/MustBeDocumented|() @R|spr/UnknownNullability|() @R|javax/annotation/meta/TypeQualifierDefault|((R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|())) public abstract annotation class ForceFlexibility : R|kotlin/Annotation| { public constructor(): R|spr/ForceFlexibility| } -@R|java/lang/annotation/Target|(R|java/lang/annotation/ElementType.TYPE|()) @R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/Nonnull|() @R|javax/annotation/meta/TypeQualifierDefault|((R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|())) public abstract annotation class NonNullApi : R|kotlin/Annotation| { +@R|kotlin/annotation/Target|((R|kotlin/annotation/AnnotationTarget.CLASS|(), R|kotlin/annotation/AnnotationTarget.FILE|())) @R|kotlin/annotation/Retention|(R|kotlin/annotation/AnnotationRetention.RUNTIME|()) @R|kotlin/annotation/MustBeDocumented|() @R|javax/annotation/Nonnull|() @R|javax/annotation/meta/TypeQualifierDefault|((R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|())) public abstract annotation class NonNullApi : R|kotlin/Annotation| { public constructor(): R|spr/NonNullApi| } -@R|java/lang/annotation/Target|((R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|())) @R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.MAYBE|()) @R|javax/annotation/meta/TypeQualifierNickname|() public abstract annotation class Nullable : R|kotlin/Annotation| { +@R|kotlin/annotation/Target|((R|kotlin/annotation/AnnotationTarget.VALUE_PARAMETER|(), R|kotlin/annotation/AnnotationTarget.FUNCTION|(), R|kotlin/annotation/AnnotationTarget.PROPERTY_GETTER|(), R|kotlin/annotation/AnnotationTarget.PROPERTY_SETTER|())) @R|kotlin/annotation/Retention|(R|kotlin/annotation/AnnotationRetention.RUNTIME|()) @R|kotlin/annotation/MustBeDocumented|() @R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.MAYBE|()) @R|javax/annotation/meta/TypeQualifierNickname|() public abstract annotation class Nullable : R|kotlin/Annotation| { public constructor(): R|spr/Nullable| } -@R|java/lang/annotation/Documented|() @R|javax/annotation/meta/TypeQualifierNickname|() @R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.UNKNOWN|()) @R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) public abstract annotation class UnknownNullability : R|kotlin/Annotation| { +@R|kotlin/annotation/MustBeDocumented|() @R|javax/annotation/meta/TypeQualifierNickname|() @R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.UNKNOWN|()) @R|kotlin/annotation/Retention|(R|kotlin/annotation/AnnotationRetention.RUNTIME|()) public abstract annotation class UnknownNullability : R|kotlin/Annotation| { public constructor(): R|spr/UnknownNullability| } diff --git a/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/ForceFlexibleOverOverrides.fir.txt b/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/ForceFlexibleOverOverrides.fir.txt index 7baebbc698e..f8d445b6f1f 100644 --- a/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/ForceFlexibleOverOverrides.fir.txt +++ b/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/ForceFlexibleOverOverrides.fir.txt @@ -20,15 +20,15 @@ public abstract interface B : R|kotlin/Any| { public abstract fun foobar(@R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|): R|kotlin/Unit| } -@R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|spr/UnknownNullability|() @R|javax/annotation/meta/TypeQualifierDefault|((R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|())) public abstract annotation class ForceFlexibility : R|kotlin/Annotation| { +@R|kotlin/annotation/Retention|(R|kotlin/annotation/AnnotationRetention.RUNTIME|()) @R|kotlin/annotation/MustBeDocumented|() @R|spr/UnknownNullability|() @R|javax/annotation/meta/TypeQualifierDefault|((R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|())) public abstract annotation class ForceFlexibility : R|kotlin/Annotation| { public constructor(): R|spr/ForceFlexibility| } -@R|java/lang/annotation/Target|(R|java/lang/annotation/ElementType.TYPE|()) @R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/Nonnull|() @R|javax/annotation/meta/TypeQualifierDefault|((R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|())) public abstract annotation class NonNullApi : R|kotlin/Annotation| { +@R|kotlin/annotation/Target|((R|kotlin/annotation/AnnotationTarget.CLASS|(), R|kotlin/annotation/AnnotationTarget.FILE|())) @R|kotlin/annotation/Retention|(R|kotlin/annotation/AnnotationRetention.RUNTIME|()) @R|kotlin/annotation/MustBeDocumented|() @R|javax/annotation/Nonnull|() @R|javax/annotation/meta/TypeQualifierDefault|((R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|())) public abstract annotation class NonNullApi : R|kotlin/Annotation| { public constructor(): R|spr/NonNullApi| } -@R|java/lang/annotation/Documented|() @R|javax/annotation/meta/TypeQualifierNickname|() @R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.UNKNOWN|()) @R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) public abstract annotation class UnknownNullability : R|kotlin/Annotation| { +@R|kotlin/annotation/MustBeDocumented|() @R|javax/annotation/meta/TypeQualifierNickname|() @R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.UNKNOWN|()) @R|kotlin/annotation/Retention|(R|kotlin/annotation/AnnotationRetention.RUNTIME|()) public abstract annotation class UnknownNullability : R|kotlin/Annotation| { public constructor(): R|spr/UnknownNullability| } diff --git a/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/NullabilityFromOverridden.fir.txt b/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/NullabilityFromOverridden.fir.txt index 64945db905e..3b098a54002 100644 --- a/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/NullabilityFromOverridden.fir.txt +++ b/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/NullabilityFromOverridden.fir.txt @@ -54,11 +54,11 @@ public constructor(): R|C| } -@R|java/lang/annotation/Target|(R|java/lang/annotation/ElementType.TYPE|()) @R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/Nonnull|() @R|javax/annotation/meta/TypeQualifierDefault|((R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|(), R|java/lang/annotation/ElementType.FIELD|())) public abstract annotation class NonNullApi : R|kotlin/Annotation| { +@R|kotlin/annotation/Target|((R|kotlin/annotation/AnnotationTarget.CLASS|(), R|kotlin/annotation/AnnotationTarget.FILE|())) @R|kotlin/annotation/Retention|(R|kotlin/annotation/AnnotationRetention.RUNTIME|()) @R|kotlin/annotation/MustBeDocumented|() @R|javax/annotation/Nonnull|() @R|javax/annotation/meta/TypeQualifierDefault|((R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|(), R|java/lang/annotation/ElementType.FIELD|())) public abstract annotation class NonNullApi : R|kotlin/Annotation| { public constructor(): R|NonNullApi| } -@R|java/lang/annotation/Target|(R|java/lang/annotation/ElementType.TYPE|()) @R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/CheckForNull|() @R|javax/annotation/meta/TypeQualifierDefault|((R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|(), R|java/lang/annotation/ElementType.FIELD|())) public abstract annotation class NullableApi : R|kotlin/Annotation| { +@R|kotlin/annotation/Target|((R|kotlin/annotation/AnnotationTarget.CLASS|(), R|kotlin/annotation/AnnotationTarget.FILE|())) @R|kotlin/annotation/Retention|(R|kotlin/annotation/AnnotationRetention.RUNTIME|()) @R|kotlin/annotation/MustBeDocumented|() @R|javax/annotation/CheckForNull|() @R|javax/annotation/meta/TypeQualifierDefault|((R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|(), R|java/lang/annotation/ElementType.FIELD|())) public abstract annotation class NullableApi : R|kotlin/Annotation| { public constructor(): R|NullableApi| } diff --git a/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/OverridingDefaultQualifier.fir.txt b/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/OverridingDefaultQualifier.fir.txt index 5b850fc9c7c..fba1883e27f 100644 --- a/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/OverridingDefaultQualifier.fir.txt +++ b/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/OverridingDefaultQualifier.fir.txt @@ -12,15 +12,15 @@ public constructor(): R|A| } -@R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/CheckForNull|() @R|javax/annotation/meta/TypeQualifierDefault|((R|java/lang/annotation/ElementType.FIELD|())) public abstract annotation class FieldsAreNullable : R|kotlin/Annotation| { +@R|kotlin/annotation/Retention|(R|kotlin/annotation/AnnotationRetention.RUNTIME|()) @R|kotlin/annotation/MustBeDocumented|() @R|javax/annotation/CheckForNull|() @R|javax/annotation/meta/TypeQualifierDefault|((R|java/lang/annotation/ElementType.FIELD|())) public abstract annotation class FieldsAreNullable : R|kotlin/Annotation| { public constructor(): R|FieldsAreNullable| } -@R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/Nonnull|() @R|javax/annotation/meta/TypeQualifierDefault|((R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|(), R|java/lang/annotation/ElementType.FIELD|())) public abstract annotation class NonNullApi : R|kotlin/Annotation| { +@R|kotlin/annotation/Retention|(R|kotlin/annotation/AnnotationRetention.RUNTIME|()) @R|kotlin/annotation/MustBeDocumented|() @R|javax/annotation/Nonnull|() @R|javax/annotation/meta/TypeQualifierDefault|((R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|(), R|java/lang/annotation/ElementType.FIELD|())) public abstract annotation class NonNullApi : R|kotlin/Annotation| { public constructor(): R|NonNullApi| } -@R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/CheckForNull|() @R|javax/annotation/meta/TypeQualifierDefault|((R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|(), R|java/lang/annotation/ElementType.FIELD|())) public abstract annotation class NullableApi : R|kotlin/Annotation| { +@R|kotlin/annotation/Retention|(R|kotlin/annotation/AnnotationRetention.RUNTIME|()) @R|kotlin/annotation/MustBeDocumented|() @R|javax/annotation/CheckForNull|() @R|javax/annotation/meta/TypeQualifierDefault|((R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|(), R|java/lang/annotation/ElementType.FIELD|())) public abstract annotation class NullableApi : R|kotlin/Annotation| { public constructor(): R|NullableApi| } diff --git a/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/SpringNullable.fir.txt b/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/SpringNullable.fir.txt index 5568d4bb56f..05de5093d12 100644 --- a/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/SpringNullable.fir.txt +++ b/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/SpringNullable.fir.txt @@ -10,11 +10,11 @@ public constructor(): R|A| } -@R|java/lang/annotation/Target|(R|java/lang/annotation/ElementType.TYPE|()) @R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/Nonnull|() @R|javax/annotation/meta/TypeQualifierDefault|((R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|())) public abstract annotation class NonNullApi : R|kotlin/Annotation| { +@R|kotlin/annotation/Target|((R|kotlin/annotation/AnnotationTarget.CLASS|(), R|kotlin/annotation/AnnotationTarget.FILE|())) @R|kotlin/annotation/Retention|(R|kotlin/annotation/AnnotationRetention.RUNTIME|()) @R|kotlin/annotation/MustBeDocumented|() @R|javax/annotation/Nonnull|() @R|javax/annotation/meta/TypeQualifierDefault|((R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|())) public abstract annotation class NonNullApi : R|kotlin/Annotation| { public constructor(): R|spr/NonNullApi| } -@R|java/lang/annotation/Target|((R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|())) @R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.MAYBE|()) @R|javax/annotation/meta/TypeQualifierNickname|() public abstract annotation class Nullable : R|kotlin/Annotation| { +@R|kotlin/annotation/Target|((R|kotlin/annotation/AnnotationTarget.VALUE_PARAMETER|(), R|kotlin/annotation/AnnotationTarget.FUNCTION|(), R|kotlin/annotation/AnnotationTarget.PROPERTY_GETTER|(), R|kotlin/annotation/AnnotationTarget.PROPERTY_SETTER|())) @R|kotlin/annotation/Retention|(R|kotlin/annotation/AnnotationRetention.RUNTIME|()) @R|kotlin/annotation/MustBeDocumented|() @R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.MAYBE|()) @R|javax/annotation/meta/TypeQualifierNickname|() public abstract annotation class Nullable : R|kotlin/Annotation| { public constructor(): R|spr/Nullable| } diff --git a/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/SpringNullablePackage.fir.txt b/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/SpringNullablePackage.fir.txt index cbf1eb777ed..dab4e6f8265 100644 --- a/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/SpringNullablePackage.fir.txt +++ b/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/SpringNullablePackage.fir.txt @@ -10,11 +10,11 @@ public open class A : R|kotlin/Any| { public constructor(): R|test/A| } -@R|java/lang/annotation/Target|(R|java/lang/annotation/ElementType.PACKAGE|()) @R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/Nonnull|() @R|javax/annotation/meta/TypeQualifierDefault|((R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|())) public abstract annotation class NonNullApi : R|kotlin/Annotation| { +@R|kotlin/annotation/Target|(()) @R|kotlin/annotation/Retention|(R|kotlin/annotation/AnnotationRetention.RUNTIME|()) @R|kotlin/annotation/MustBeDocumented|() @R|javax/annotation/Nonnull|() @R|javax/annotation/meta/TypeQualifierDefault|((R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|())) public abstract annotation class NonNullApi : R|kotlin/Annotation| { public constructor(): R|spr/NonNullApi| } -@R|java/lang/annotation/Target|((R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|())) @R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.MAYBE|()) @R|javax/annotation/meta/TypeQualifierNickname|() public abstract annotation class Nullable : R|kotlin/Annotation| { +@R|kotlin/annotation/Target|((R|kotlin/annotation/AnnotationTarget.VALUE_PARAMETER|(), R|kotlin/annotation/AnnotationTarget.FUNCTION|(), R|kotlin/annotation/AnnotationTarget.PROPERTY_GETTER|(), R|kotlin/annotation/AnnotationTarget.PROPERTY_SETTER|())) @R|kotlin/annotation/Retention|(R|kotlin/annotation/AnnotationRetention.RUNTIME|()) @R|kotlin/annotation/MustBeDocumented|() @R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.MAYBE|()) @R|javax/annotation/meta/TypeQualifierNickname|() public abstract annotation class Nullable : R|kotlin/Annotation| { public constructor(): R|spr/Nullable| } diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 4dad0e4eac1..6796fc5b928 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -121,6 +121,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/annotations/fileClassWithFileAnnotation.kt"); } + @TestMetadata("javaAnnotationOnProperty.kt") + public void testJavaAnnotationOnProperty() throws Exception { + runTest("compiler/testData/codegen/box/annotations/javaAnnotationOnProperty.kt"); + } + @TestMetadata("jvmAnnotationFlags.kt") public void testJvmAnnotationFlags() throws Exception { runTest("compiler/testData/codegen/box/annotations/jvmAnnotationFlags.kt"); diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt index 2559a9b40ac..4d2a66e9394 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.fir.java +import org.jetbrains.kotlin.builtins.StandardNames import org.jetbrains.kotlin.builtins.jvm.JavaToKotlinClassMap import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.descriptors.Modality @@ -43,9 +44,15 @@ import org.jetbrains.kotlin.load.java.structure.* import org.jetbrains.kotlin.load.java.structure.impl.JavaElementImpl import org.jetbrains.kotlin.load.java.typeEnhancement.TypeComponentPosition import org.jetbrains.kotlin.name.ClassId +import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.types.Variance.* import org.jetbrains.kotlin.utils.addToStdlib.runIf +import java.lang.Deprecated +import java.lang.annotation.Documented +import java.lang.annotation.Retention +import java.lang.annotation.Target +import java.util.* internal val JavaModifierListOwner.modality: Modality get() = when { @@ -421,52 +428,121 @@ private fun FirRegularClass.createRawArguments( computeRawProjection(session, typeParameter, position, erasedUpperBound) } -private fun FirAnnotationCallBuilder.buildArgumentMapping( +private fun buildEnumCall(session: FirSession, classId: ClassId?, entryName: Name?) = + buildFunctionCall { + val calleeReference = if (classId != null && entryName != null) { + session.firSymbolProvider.getClassDeclaredPropertySymbols(classId, entryName) + .firstOrNull()?.let { propertySymbol -> + buildResolvedNamedReference { + name = entryName + resolvedSymbol = propertySymbol + } + } + } else { + null + } + this.calleeReference = calleeReference + ?: buildErrorNamedReference { + diagnostic = ConeSimpleDiagnostic("Strange Java enum value: $classId.$entryName", DiagnosticKind.Java) + } + } + +private val JAVA_TARGET_CLASS_ID = ClassId.topLevel(FqName(Target::class.java.canonicalName)) +private val JAVA_RETENTION_CLASS_ID = ClassId.topLevel(FqName(Retention::class.java.canonicalName)) +private val JAVA_DEPRECATED_CLASS_ID = ClassId.topLevel(FqName(Deprecated::class.java.canonicalName)) +private val JAVA_DOCUMENTED_CLASS_ID = ClassId.topLevel(FqName(Documented::class.java.canonicalName)) +private val JAVA_REPEATABLE_CLASS_ID = ClassId.topLevel(FqName("java.lang.annotation.Repeatable")) // since Java 8 + +private val JAVA_TARGETS_TO_KOTLIN = mapOf( + "TYPE" to EnumSet.of(AnnotationTarget.CLASS, AnnotationTarget.FILE), + "ANNOTATION_TYPE" to EnumSet.of(AnnotationTarget.ANNOTATION_CLASS), + "TYPE_PARAMETER" to EnumSet.of(AnnotationTarget.TYPE_PARAMETER), + "FIELD" to EnumSet.of(AnnotationTarget.FIELD), + "LOCAL_VARIABLE" to EnumSet.of(AnnotationTarget.LOCAL_VARIABLE), + "PARAMETER" to EnumSet.of(AnnotationTarget.VALUE_PARAMETER), + "CONSTRUCTOR" to EnumSet.of(AnnotationTarget.CONSTRUCTOR), + "METHOD" to EnumSet.of(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER), + "TYPE_USE" to EnumSet.of(AnnotationTarget.TYPE) +) + +private fun List.mapJavaTargetArguments(session: FirSession): FirExpression? = + buildArrayOfCall { + argumentList = buildArgumentList { + val resultSet = EnumSet.noneOf(AnnotationTarget::class.java) + for (target in this@mapJavaTargetArguments) { + if (target !is JavaEnumValueAnnotationArgument) return null + resultSet.addAll(JAVA_TARGETS_TO_KOTLIN[target.entryName?.asString()] ?: continue) + } + val classId = ClassId.topLevel(StandardNames.FqNames.annotationTarget) + resultSet.mapTo(arguments) { buildEnumCall(session, classId, Name.identifier(it.name)) } + } + } + +private val JAVA_RETENTION_TO_KOTLIN = mapOf( + "RUNTIME" to AnnotationRetention.RUNTIME, + "CLASS" to AnnotationRetention.BINARY, + "SOURCE" to AnnotationRetention.SOURCE +) + +private fun JavaAnnotationArgument.mapJavaRetentionArgument(session: FirSession): FirExpression? = + JAVA_RETENTION_TO_KOTLIN[(this as? JavaEnumValueAnnotationArgument)?.entryName?.asString()]?.let { + buildEnumCall(session, ClassId.topLevel(StandardNames.FqNames.annotationRetention), Name.identifier(it.name)) + } + +private fun buildArgumentMapping( session: FirSession, javaTypeParameterStack: JavaTypeParameterStack, - classId: ClassId?, + lookupTag: ConeClassLikeLookupTagImpl, annotationArguments: Collection -): LinkedHashMap? { - if (classId == null) { - annotationTypeRef = buildErrorTypeRef { diagnostic = ConeUnresolvedReferenceError() } +): FirArgumentList? { + if (annotationArguments.none { it.name != null }) { return null } - val lookupTag = ConeClassLikeLookupTagImpl(classId) - annotationTypeRef = buildResolvedTypeRef { - type = ConeClassLikeTypeImpl(lookupTag, emptyArray(), isNullable = false) + val annotationClassSymbol = session.firSymbolProvider.getClassLikeSymbolByFqName(lookupTag.classId).also { + lookupTag.bindSymbolToLookupTag(session, it) + } ?: return null + val annotationConstructor = + (annotationClassSymbol.fir as FirRegularClass).declarations.filterIsInstance().first() + val mapping = annotationArguments.associateTo(linkedMapOf()) { argument -> + val parameter = annotationConstructor.valueParameters.find { it.name == (argument.name ?: JavaSymbolProvider.VALUE_METHOD_NAME) } + ?: return null + argument.toFirExpression(session, javaTypeParameterStack) to parameter } - if (annotationArguments.any { it.name != null }) { - val mapping = linkedMapOf() - val annotationClassSymbol = session.firSymbolProvider.getClassLikeSymbolByFqName(classId).also { - lookupTag.bindSymbolToLookupTag(session, it) - } - if (annotationClassSymbol != null) { - val annotationConstructor = - (annotationClassSymbol.fir as FirRegularClass).declarations.filterIsInstance().first() - for (argument in annotationArguments) { - mapping[argument.toFirExpression(session, javaTypeParameterStack)] = - annotationConstructor.valueParameters.find { it.name == (argument.name ?: JavaSymbolProvider.VALUE_METHOD_NAME) } - ?: return null - } - return mapping - } - } - return null + return buildResolvedArgumentList(mapping) } internal fun JavaAnnotation.toFirAnnotationCall( session: FirSession, javaTypeParameterStack: JavaTypeParameterStack ): FirAnnotationCall { return buildAnnotationCall { - val mapping = buildArgumentMapping(session, javaTypeParameterStack, classId, arguments) - argumentList = if (mapping != null) { - buildResolvedArgumentList(mapping) - } else { - buildArgumentList { - for (argument in this@toFirAnnotationCall.arguments) { - arguments += argument.toFirExpression(session, javaTypeParameterStack) - } + val lookupTag = when (classId) { + JAVA_TARGET_CLASS_ID -> ClassId.topLevel(StandardNames.FqNames.target) + JAVA_RETENTION_CLASS_ID -> ClassId.topLevel(StandardNames.FqNames.retention) + JAVA_REPEATABLE_CLASS_ID -> ClassId.topLevel(StandardNames.FqNames.repeatable) + JAVA_DOCUMENTED_CLASS_ID -> ClassId.topLevel(StandardNames.FqNames.mustBeDocumented) + JAVA_DEPRECATED_CLASS_ID -> ClassId.topLevel(StandardNames.FqNames.deprecated) + else -> classId + }?.let(::ConeClassLikeLookupTagImpl) + annotationTypeRef = if (lookupTag != null) { + buildResolvedTypeRef { + type = ConeClassLikeTypeImpl(lookupTag, emptyArray(), isNullable = false) } + } else { + buildErrorTypeRef { diagnostic = ConeUnresolvedReferenceError() } + } + argumentList = when (classId) { + JAVA_TARGET_CLASS_ID -> when (val argument = arguments.singleOrNull()) { + is JavaArrayAnnotationArgument -> argument.getElements().mapJavaTargetArguments(session)?.let(::buildUnaryArgumentList) + is JavaEnumValueAnnotationArgument -> listOf(argument).mapJavaTargetArguments(session)?.let(::buildUnaryArgumentList) + else -> null + } + JAVA_RETENTION_CLASS_ID -> arguments.singleOrNull()?.mapJavaRetentionArgument(session)?.let(::buildUnaryArgumentList) + JAVA_DEPRECATED_CLASS_ID -> + buildUnaryArgumentList(buildConstExpression(null, FirConstKind.String, "Deprecated in Java").setProperType(session)) + null -> null + else -> buildArgumentMapping(session, javaTypeParameterStack, lookupTag!!, arguments) + } ?: buildArgumentList { + this@toFirAnnotationCall.arguments.mapTo(arguments) { it.toFirExpression(session, javaTypeParameterStack) } } calleeReference = FirReferencePlaceholderForResolvedAnnotations } @@ -490,9 +566,7 @@ internal fun MutableList.addAnnotationsFrom( javaAnnotationOwner: JavaAnnotationOwner, javaTypeParameterStack: JavaTypeParameterStack ) { - for (annotation in javaAnnotationOwner.annotations) { - this += annotation.toFirAnnotationCall(session, javaTypeParameterStack) - } + javaAnnotationOwner.annotations.mapTo(this) { it.toFirAnnotationCall(session, javaTypeParameterStack) } } internal fun JavaValueParameter.toFirValueParameter( @@ -540,46 +614,18 @@ private fun JavaType?.toConeProjectionWithoutEnhancement( private fun JavaAnnotationArgument.toFirExpression( session: FirSession, javaTypeParameterStack: JavaTypeParameterStack ): FirExpression { - // TODO: this.name return when (this) { - is JavaLiteralAnnotationArgument -> { - value.createConstantOrError(session) - } + is JavaLiteralAnnotationArgument -> value.createConstantOrError(session) is JavaArrayAnnotationArgument -> buildArrayOfCall { argumentList = buildArgumentList { - for (element in getElements()) { - arguments += element.toFirExpression(session, javaTypeParameterStack) - } - } - } - is JavaEnumValueAnnotationArgument -> { - buildFunctionCall { - val classId = this@toFirExpression.enumClassId - val entryName = this@toFirExpression.entryName - val calleeReference = if (classId != null && entryName != null) { - val propertySymbol = session.firSymbolProvider.getClassDeclaredPropertySymbols( - classId, entryName - ).firstOrNull() - propertySymbol?.let { - buildResolvedNamedReference { - name = entryName - resolvedSymbol = it - } - } - } else { - null - } - this.calleeReference = calleeReference - ?: buildErrorNamedReference { - diagnostic = ConeSimpleDiagnostic("Strange Java enum value: $classId.$entryName", DiagnosticKind.Java) - } + getElements().mapTo(arguments) { it.toFirExpression(session, javaTypeParameterStack) } } } + is JavaEnumValueAnnotationArgument -> buildEnumCall(session, enumClassId, entryName) is JavaClassObjectAnnotationArgument -> buildGetClassCall { - val referencedType = getReferencedType() argumentList = buildUnaryArgumentList( buildClassReferenceExpression { - classTypeRef = referencedType.toFirResolvedTypeRef(session, javaTypeParameterStack) + classTypeRef = getReferencedType().toFirResolvedTypeRef(session, javaTypeParameterStack) } ) } diff --git a/compiler/testData/codegen/box/annotations/javaAnnotationOnProperty.kt b/compiler/testData/codegen/box/annotations/javaAnnotationOnProperty.kt new file mode 100644 index 00000000000..dd90a8b7781 --- /dev/null +++ b/compiler/testData/codegen/box/annotations/javaAnnotationOnProperty.kt @@ -0,0 +1,25 @@ +// WITH_REFLECT +// TARGET_BACKEND: JVM +// FILE: Ann1.java +import java.lang.annotation.*; + +@Target({ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface Ann1 {} + +// FILE: Ann2.java +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +public @interface Ann2 {} + +// FILE: box.kt +class C { + @Ann1 @Ann2 val x = 1 +} + +fun box(): String { + require(C::class.java.getDeclaredField("x")?.getAnnotation(Ann1::class.java) != null) { "no Ann1 on field x" } + require(C::class.java.getDeclaredMethod("getX\$annotations")?.getAnnotation(Ann2::class.java) != null) { "no Ann2 on property x" } + return "OK" +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 4c23c7115b6..1a8ed41a92b 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -121,6 +121,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/annotations/fileClassWithFileAnnotation.kt"); } + @TestMetadata("javaAnnotationOnProperty.kt") + public void testJavaAnnotationOnProperty() throws Exception { + runTest("compiler/testData/codegen/box/annotations/javaAnnotationOnProperty.kt"); + } + @TestMetadata("jvmAnnotationFlags.kt") public void testJvmAnnotationFlags() throws Exception { runTest("compiler/testData/codegen/box/annotations/jvmAnnotationFlags.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 4e9d7f19813..c38c8b2a820 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -121,6 +121,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/annotations/fileClassWithFileAnnotation.kt"); } + @TestMetadata("javaAnnotationOnProperty.kt") + public void testJavaAnnotationOnProperty() throws Exception { + runTest("compiler/testData/codegen/box/annotations/javaAnnotationOnProperty.kt"); + } + @TestMetadata("jvmAnnotationFlags.kt") public void testJvmAnnotationFlags() throws Exception { runTest("compiler/testData/codegen/box/annotations/jvmAnnotationFlags.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 71a78e1ba65..067da877c88 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -121,6 +121,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/annotations/fileClassWithFileAnnotation.kt"); } + @TestMetadata("javaAnnotationOnProperty.kt") + public void testJavaAnnotationOnProperty() throws Exception { + runTest("compiler/testData/codegen/box/annotations/javaAnnotationOnProperty.kt"); + } + @TestMetadata("jvmAnnotationFlags.kt") public void testJvmAnnotationFlags() throws Exception { runTest("compiler/testData/codegen/box/annotations/jvmAnnotationFlags.kt"); diff --git a/idea/idea-frontend-fir/testData/memberScopeByFqName/java.lang.String.txt b/idea/idea-frontend-fir/testData/memberScopeByFqName/java.lang.String.txt index b40688f7b5d..1a965951b13 100644 --- a/idea/idea-frontend-fir/testData/memberScopeByFqName/java.lang.String.txt +++ b/idea/idea-frontend-fir/testData/memberScopeByFqName/java.lang.String.txt @@ -242,7 +242,7 @@ KtFirFunctionSymbol: visibility: PUBLIC KtFirFunctionSymbol: - annotations: [java/lang/Deprecated()] + annotations: [kotlin/Deprecated(message = Deprecated in Java)] callableIdIfNonLocal: java.lang.String.getBytes isExtension: false isExternal: false @@ -1166,7 +1166,7 @@ KtFirConstructorSymbol: visibility: PUBLIC KtFirConstructorSymbol: - annotations: [java/lang/Deprecated()] + annotations: [kotlin/Deprecated(message = Deprecated in Java)] containingClassIdIfNonLocal: java/lang/String isPrimary: false origin: JAVA @@ -1176,7 +1176,7 @@ KtFirConstructorSymbol: visibility: PUBLIC KtFirConstructorSymbol: - annotations: [java/lang/Deprecated()] + annotations: [kotlin/Deprecated(message = Deprecated in Java)] containingClassIdIfNonLocal: java/lang/String isPrimary: false origin: JAVA @@ -1276,7 +1276,7 @@ KtFirConstructorSymbol: visibility: UNKNOWN KtFirConstructorSymbol: - annotations: [java/lang/Deprecated()] + annotations: [kotlin/Deprecated(message = Deprecated in Java)] containingClassIdIfNonLocal: java/lang/String isPrimary: false origin: JAVA From 148d540580da67d68678080e04650278ea0e9d29 Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Tue, 1 Dec 2020 14:19:22 -0800 Subject: [PATCH 607/698] FIR checker: make unused checker visit qualified accesses in annotations #KT-43687 Fixed --- .../unused/usedInAnnotationArguments.kt | 7 +++ .../unused/usedInAnnotationArguments.txt | 15 ++++++ .../ExtendedFirDiagnosticsTestGenerated.java | 5 ++ ...WithLightTreeDiagnosticsTestGenerated.java | 5 ++ .../checkers/extended/UnusedChecker.kt | 52 ++++++++++++++----- 5 files changed, 71 insertions(+), 13 deletions(-) create mode 100644 compiler/fir/analysis-tests/testData/extendedCheckers/unused/usedInAnnotationArguments.kt create mode 100644 compiler/fir/analysis-tests/testData/extendedCheckers/unused/usedInAnnotationArguments.txt diff --git a/compiler/fir/analysis-tests/testData/extendedCheckers/unused/usedInAnnotationArguments.kt b/compiler/fir/analysis-tests/testData/extendedCheckers/unused/usedInAnnotationArguments.kt new file mode 100644 index 00000000000..b7dd216352a --- /dev/null +++ b/compiler/fir/analysis-tests/testData/extendedCheckers/unused/usedInAnnotationArguments.kt @@ -0,0 +1,7 @@ +annotation class Ann(val value: Int) + +fun foo(): Int { + val x = 3 + @Ann(x) val y = 5 + return y +} diff --git a/compiler/fir/analysis-tests/testData/extendedCheckers/unused/usedInAnnotationArguments.txt b/compiler/fir/analysis-tests/testData/extendedCheckers/unused/usedInAnnotationArguments.txt new file mode 100644 index 00000000000..035b543f596 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/extendedCheckers/unused/usedInAnnotationArguments.txt @@ -0,0 +1,15 @@ +FILE: usedInAnnotationArguments.kt + public final annotation class Ann : R|kotlin/Annotation| { + public constructor(value: R|kotlin/Int|): R|Ann| { + super() + } + + public final val value: R|kotlin/Int| = R|/value| + public get(): R|kotlin/Int| + + } + public final fun foo(): R|kotlin/Int| { + lval x: R|kotlin/Int| = Int(3) + @R|Ann|(R|/x|) lval y: R|kotlin/Int| = Int(5) + ^foo R|/y| + } diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/ExtendedFirDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/ExtendedFirDiagnosticsTestGenerated.java index e8a12ae97fc..36e16fd4f50 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/ExtendedFirDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/ExtendedFirDiagnosticsTestGenerated.java @@ -344,6 +344,11 @@ public class ExtendedFirDiagnosticsTestGenerated extends AbstractExtendedFirDiag runTest("compiler/fir/analysis-tests/testData/extendedCheckers/unused/manyLocalVariables.kt"); } + @TestMetadata("usedInAnnotationArguments.kt") + public void testUsedInAnnotationArguments() throws Exception { + runTest("compiler/fir/analysis-tests/testData/extendedCheckers/unused/usedInAnnotationArguments.kt"); + } + @TestMetadata("valueIsNeverRead.kt") public void testValueIsNeverRead() throws Exception { runTest("compiler/fir/analysis-tests/testData/extendedCheckers/unused/valueIsNeverRead.kt"); diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/ExtendedFirWithLightTreeDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/ExtendedFirWithLightTreeDiagnosticsTestGenerated.java index 79f7c81ec4a..db17af0c78f 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/ExtendedFirWithLightTreeDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/ExtendedFirWithLightTreeDiagnosticsTestGenerated.java @@ -344,6 +344,11 @@ public class ExtendedFirWithLightTreeDiagnosticsTestGenerated extends AbstractEx runTest("compiler/fir/analysis-tests/testData/extendedCheckers/unused/manyLocalVariables.kt"); } + @TestMetadata("usedInAnnotationArguments.kt") + public void testUsedInAnnotationArguments() throws Exception { + runTest("compiler/fir/analysis-tests/testData/extendedCheckers/unused/usedInAnnotationArguments.kt"); + } + @TestMetadata("valueIsNeverRead.kt") public void testValueIsNeverRead() throws Exception { runTest("compiler/fir/analysis-tests/testData/extendedCheckers/unused/valueIsNeverRead.kt"); diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt index 19f5dc3c62c..1008992cc57 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.fir.analysis.checkers.extended import kotlinx.collections.immutable.PersistentMap import kotlinx.collections.immutable.persistentMapOf import org.jetbrains.kotlin.KtNodeTypes +import org.jetbrains.kotlin.fir.FirAnnotationContainer import org.jetbrains.kotlin.fir.FirFakeSourceElementKind import org.jetbrains.kotlin.fir.FirSymbolOwner import org.jetbrains.kotlin.fir.analysis.cfa.* @@ -17,7 +18,9 @@ import org.jetbrains.kotlin.fir.analysis.checkers.getContainingClass import org.jetbrains.kotlin.fir.analysis.checkers.isIterator import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors +import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall import org.jetbrains.kotlin.fir.expressions.FirFunctionCall +import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccess import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference import org.jetbrains.kotlin.fir.resolve.dfa.cfg.* import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol @@ -159,8 +162,10 @@ object UnusedChecker : FirControlFlowChecker() { data: Collection> ): PathAwareVariableStatusInfo { if (data.isEmpty()) return PathAwareVariableStatusInfo.EMPTY - return data.map { (label, info) -> info.applyLabel(node, label) } + val result = data.map { (label, info) -> info.applyLabel(node, label) } .reduce(PathAwareVariableStatusInfo::merge) + return (node.fir as? FirAnnotationContainer)?.annotations?.fold(result, ::visitAnnotation) + ?: result } override fun visitVariableDeclarationNode( @@ -230,31 +235,52 @@ object UnusedChecker : FirControlFlowChecker() { data: Collection> ): PathAwareVariableStatusInfo { val dataForNode = visitNode(node, data) - if (node.fir.source?.kind is FirFakeSourceElementKind) return dataForNode - val reference = node.fir.calleeReference as? FirResolvedNamedReference ?: return dataForNode - val symbol = reference.resolvedSymbol as? FirPropertySymbol ?: return dataForNode + return visitQualifiedAccesses(dataForNode, node.fir) + } - if (symbol !in localProperties) return dataForNode + private fun visitAnnotation( + dataForNode: PathAwareVariableStatusInfo, + annotation: FirAnnotationCall, + ): PathAwareVariableStatusInfo { + val qualifiedAccesses = annotation.argumentList.arguments.mapNotNull { it as? FirQualifiedAccess }.toTypedArray() + return visitQualifiedAccesses(dataForNode, *qualifiedAccesses) + } + + private fun visitQualifiedAccesses( + dataForNode: PathAwareVariableStatusInfo, + vararg qualifiedAccesses: FirQualifiedAccess, + ): PathAwareVariableStatusInfo { + fun retrieveSymbol(qualifiedAccess: FirQualifiedAccess): FirPropertySymbol? { + if (qualifiedAccess.source?.kind is FirFakeSourceElementKind) return null + val reference = qualifiedAccess.calleeReference as? FirResolvedNamedReference ?: return null + val symbol = reference.resolvedSymbol as? FirPropertySymbol ?: return null + return if (symbol !in localProperties) null else symbol + } + + val symbols = qualifiedAccesses.mapNotNull { retrieveSymbol(it) }.toTypedArray() val status = VariableStatus.READ status.isRead = true - return update(dataForNode, symbol) { status } + + return update(dataForNode, *symbols) { status } } private fun update( pathAwareInfo: PathAwareVariableStatusInfo, - symbol: FirPropertySymbol, + vararg symbols: FirPropertySymbol, updater: (VariableStatus?) -> VariableStatus?, ): PathAwareVariableStatusInfo { var resultMap = persistentMapOf() var changed = false for ((label, dataPerLabel) in pathAwareInfo) { - val v = updater.invoke(dataPerLabel[symbol]) - if (v != null) { - resultMap = resultMap.put(label, dataPerLabel.put(symbol, v)) - changed = true - } else { - resultMap = resultMap.put(label, dataPerLabel) + for (symbol in symbols) { + val v = updater.invoke(dataPerLabel[symbol]) + if (v != null) { + resultMap = resultMap.put(label, dataPerLabel.put(symbol, v)) + changed = true + } else { + resultMap = resultMap.put(label, dataPerLabel) + } } } return if (changed) PathAwareVariableStatusInfo(resultMap) else pathAwareInfo From 12f936f6b7b39a6efef4cb73b7c70d181d2c4636 Mon Sep 17 00:00:00 2001 From: pyos Date: Tue, 8 Dec 2020 10:31:14 +0100 Subject: [PATCH 608/698] FIR2IR: do not approximate reified type arguments to super class --- .../generators/CallAndReferenceGenerator.kt | 2 +- .../org/jetbrains/kotlin/fir/types/TypeUtils.kt | 17 ++++++++++------- .../box/reflection/classes/declaredMembers.kt | 10 +++++++++- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt index 4929f90abbd..671e8c62eda 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt @@ -657,7 +657,7 @@ class CallAndReferenceGenerator( val typeParameter = access.findTypeParameter(index) val argumentFirType = (argument as FirTypeProjectionWithVariance).typeRef val argumentIrType = if (typeParameter?.isReified == true) { - argumentFirType.approximatedIfNeededOrSelf(approximator, Visibilities.Public).toIrType() + argumentFirType.approximatedForPublicPosition(approximator).toIrType() } else { argumentFirType.toIrType() } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/TypeUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/TypeUtils.kt index 9fe8a454905..cf0f97ff074 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/TypeUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/TypeUtils.kt @@ -256,16 +256,19 @@ fun FirTypeRef.approximatedIfNeededOrSelf( containingCallableVisibility: Visibility?, isInlineFunction: Boolean = false ): FirTypeRef { - val approximatedType = if (this is FirResolvedTypeRef && - (containingCallableVisibility == Visibilities.Public || containingCallableVisibility == Visibilities.Protected) - ) { - if (type.requiresApproximationInPublicPosition()) this.approximated(approximator, toSuper = true) else this - } else { + val approximated = if (containingCallableVisibility == Visibilities.Public || containingCallableVisibility == Visibilities.Protected) + approximatedForPublicPosition(approximator) + else this - } - return approximatedType.hideLocalTypeIfNeeded(containingCallableVisibility, isInlineFunction).withoutEnhancedNullability() + return approximated.hideLocalTypeIfNeeded(containingCallableVisibility, isInlineFunction).withoutEnhancedNullability() } +fun FirTypeRef.approximatedForPublicPosition(approximator: AbstractTypeApproximator): FirTypeRef = + if (this is FirResolvedTypeRef && type.requiresApproximationInPublicPosition()) + this.approximated(approximator, toSuper = true) + else + this + private fun ConeKotlinType.requiresApproximationInPublicPosition(): Boolean { return when (this) { is ConeIntegerLiteralType, diff --git a/compiler/testData/codegen/box/reflection/classes/declaredMembers.kt b/compiler/testData/codegen/box/reflection/classes/declaredMembers.kt index 70a22cfb28c..85e6ba8d159 100644 --- a/compiler/testData/codegen/box/reflection/classes/declaredMembers.kt +++ b/compiler/testData/codegen/box/reflection/classes/declaredMembers.kt @@ -31,7 +31,7 @@ open class K : J() { private val privateKProp = Unit } -class L : K() { +open class L : K() { fun publicLFun() {} private fun privateLFun() {} val publicLProp = Unit @@ -43,10 +43,18 @@ inline fun test(vararg names: String) { } fun box(): String { + class Local : L() { + fun publicLocalFun() {} + private fun privateLocalFun() {} + val publicLocalProp = Unit + private var privateLocalProp = Unit + } + test("publicStaticI", "publicMemberI", "privateStaticI", "privateMemberI") test("publicStaticJ", "publicMemberJ", "privateStaticJ", "privateMemberJ") test("publicKFun", "privateKFun", "publicKProp", "privateKProp") test("publicLFun", "privateLFun", "publicLProp", "privateLProp") + test("publicLocalFun", "privateLocalFun", "publicLocalProp", "privateLocalProp") return "OK" } From 41f56729f9fb7bb582c80ff2eb2d0a989adc646f Mon Sep 17 00:00:00 2001 From: pyos Date: Fri, 4 Dec 2020 12:05:27 +0100 Subject: [PATCH 609/698] FIR: serialize correct fqnames for local classes --- .../compiler/KotlinToJVMBytecodeCompiler.kt | 2 +- .../FirElementAwareStringTable.kt | 5 +-- .../jvm/FirJvmElementAwareStringTable.kt | 32 ++++++++++--------- .../backend/jvm/FirJvmSerializerExtension.kt | 8 +++-- .../fir/backend/jvm/FirMetadataSerializer.kt | 8 +++-- .../fir/backend/Fir2IrClassifierStorage.kt | 2 +- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 +++ .../reflection/properties/withLocalType.kt | 10 ++++++ .../kotlin/codegen/GenerationUtils.kt | 2 +- .../codegen/BlackBoxCodegenTestGenerated.java | 5 +++ .../LightAnalysisModeTestGenerated.java | 5 +++ .../ir/IrBlackBoxCodegenTestGenerated.java | 5 +++ 12 files changed, 65 insertions(+), 24 deletions(-) create mode 100644 compiler/testData/codegen/box/reflection/properties/withLocalType.kt diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt index bf750a4a152..55339968a7a 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt @@ -391,7 +391,7 @@ object KotlinToJVMBytecodeCompiler { codegenFactory.generateModuleInFrontendIRMode( generationState, moduleFragment, symbolTable, sourceManager, extensions ) { context, irClass, _, serializationBindings, parent -> - FirMetadataSerializer(session, context, irClass, serializationBindings, parent) + FirMetadataSerializer(session, context, irClass, serializationBindings, components, parent) } CodegenFactory.doCheckCancelled(generationState) generationState.factory.done() diff --git a/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementAwareStringTable.kt b/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementAwareStringTable.kt index 381c1291da4..2d7581270c6 100644 --- a/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementAwareStringTable.kt +++ b/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementAwareStringTable.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.fir.serialization +import org.jetbrains.kotlin.fir.declarations.FirClass import org.jetbrains.kotlin.fir.declarations.FirClassLikeDeclaration import org.jetbrains.kotlin.fir.render import org.jetbrains.kotlin.metadata.serialization.StringTable @@ -16,11 +17,11 @@ interface FirElementAwareStringTable : StringTable { fun getFqNameIndex(classLikeDeclaration: FirClassLikeDeclaration<*>): Int { val classId = classLikeDeclaration.symbol.classId.takeIf { !it.isLocal } - ?: getLocalClassIdReplacement(classLikeDeclaration) + ?: getLocalClassIdReplacement(classLikeDeclaration as FirClass<*>) ?: throw IllegalStateException("Cannot get FQ name of local class: ${classLikeDeclaration.render()}") return getQualifiedClassNameIndex(classId) } - fun getLocalClassIdReplacement(classLikeDeclaration: FirClassLikeDeclaration<*>): ClassId? = null + fun getLocalClassIdReplacement(firClass: FirClass<*>): ClassId? = null } diff --git a/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmElementAwareStringTable.kt b/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmElementAwareStringTable.kt index fcda148cf8a..0734e6e0dec 100644 --- a/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmElementAwareStringTable.kt +++ b/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmElementAwareStringTable.kt @@ -5,30 +5,32 @@ package org.jetbrains.kotlin.fir.backend.jvm -import org.jetbrains.kotlin.fir.declarations.FirClassLikeDeclaration +import org.jetbrains.kotlin.backend.jvm.codegen.IrTypeMapper +import org.jetbrains.kotlin.backend.jvm.codegen.mapClass +import org.jetbrains.kotlin.fir.backend.Fir2IrComponents +import org.jetbrains.kotlin.fir.declarations.FirClass import org.jetbrains.kotlin.fir.serialization.FirElementAwareStringTable +import org.jetbrains.kotlin.ir.declarations.IrClass import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmNameResolver import org.jetbrains.kotlin.metadata.jvm.serialization.JvmStringTable import org.jetbrains.kotlin.name.ClassId +import org.jetbrains.kotlin.name.FqName class FirJvmElementAwareStringTable( + private val typeMapper: IrTypeMapper, + private val components: Fir2IrComponents, nameResolver: JvmNameResolver? = null ) : JvmStringTable(nameResolver), FirElementAwareStringTable { - override fun getLocalClassIdReplacement(classLikeDeclaration: FirClassLikeDeclaration<*>): ClassId { - return when (classLikeDeclaration.symbol.classId.outerClassId) { - // TODO: how to determine parent declaration for FIR local class properly? - //is ClassifierDescriptorWithTypeParameters -> getLocalClassIdReplacement(container).createNestedClassId(descriptor.name) -// null -> { -// throw IllegalStateException( -// "getLocalClassIdReplacement should only be called for local classes: ${classLikeDeclaration.render()}" -// ) -// } + override fun getLocalClassIdReplacement(firClass: FirClass<*>): ClassId = + components.classifierStorage.getCachedIrClass(firClass)?.getLocalClassIdReplacement() + ?: throw AssertionError("not a local class: ${firClass.symbol.classId}") + + private fun IrClass.getLocalClassIdReplacement(): ClassId = + when (val parent = parent) { + is IrClass -> parent.getLocalClassIdReplacement().createNestedClassId(name) else -> { - classLikeDeclaration.symbol.classId - // TODO: typeMapper.mapClass - //val fqName = FqName(typeMapper.mapClass(descriptor).internalName.replace('/', '.')) - //ClassId(fqName.parent(), FqName.topLevel(fqName.shortName()), true) + val fqName = FqName(typeMapper.mapClass(this).internalName.replace('/', '.')) + ClassId(fqName.parent(), FqName.topLevel(fqName.shortName()), true) } } - } } \ No newline at end of file diff --git a/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmSerializerExtension.kt b/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmSerializerExtension.kt index af4b627c07a..80d41bf2e3d 100644 --- a/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmSerializerExtension.kt +++ b/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmSerializerExtension.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.fir.backend.jvm +import org.jetbrains.kotlin.backend.jvm.codegen.IrTypeMapper import org.jetbrains.kotlin.codegen.ClassBuilderMode import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings import org.jetbrains.kotlin.codegen.state.GenerationState @@ -12,6 +13,7 @@ import org.jetbrains.kotlin.config.JvmDefaultMode import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.backend.Fir2IrComponents import org.jetbrains.kotlin.fir.backend.FirMetadataSource import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.resolve.firProvider @@ -41,10 +43,12 @@ class FirJvmSerializerExtension( state: GenerationState, private val irClass: IrClass, private val localDelegatedProperties: List, - private val approximator: AbstractTypeApproximator + private val approximator: AbstractTypeApproximator, + typeMapper: IrTypeMapper, + components: Fir2IrComponents ) : FirSerializerExtension() { private val globalBindings = state.globalSerializationBindings - override val stringTable = FirJvmElementAwareStringTable() + override val stringTable = FirJvmElementAwareStringTable(typeMapper, components) private val useTypeTable = state.useTypeTableInSerializer private val moduleName = state.moduleName private val classBuilderMode = state.classBuilderMode diff --git a/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirMetadataSerializer.kt b/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirMetadataSerializer.kt index 0337a03af47..d56749f511a 100644 --- a/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirMetadataSerializer.kt +++ b/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirMetadataSerializer.kt @@ -9,6 +9,7 @@ import org.jetbrains.kotlin.backend.jvm.JvmBackendContext import org.jetbrains.kotlin.backend.jvm.codegen.MetadataSerializer import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.backend.Fir2IrComponents import org.jetbrains.kotlin.fir.backend.FirMetadataSource import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.builder.buildAnonymousFunction @@ -39,6 +40,7 @@ class FirMetadataSerializer( private val context: JvmBackendContext, private val irClass: IrClass, private val serializationBindings: JvmSerializationBindings, + components: Fir2IrComponents, parent: MetadataSerializer? ) : MetadataSerializer { private val approximator = object : AbstractTypeApproximator(session.typeContext) { @@ -144,8 +146,10 @@ class FirMetadataSerializer( (it.owner.metadata as FirMetadataSource.Property).fir.copyToFreeProperty() } ?: emptyList() - private val serializerExtension = - FirJvmSerializerExtension(session, serializationBindings, context.state, irClass, localDelegatedProperties, approximator) + private val serializerExtension = FirJvmSerializerExtension( + session, serializationBindings, context.state, irClass, localDelegatedProperties, approximator, + context.typeMapper, components + ) private val serializer: FirElementSerializer? = when (val metadata = irClass.metadata) { diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrClassifierStorage.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrClassifierStorage.kt index f979e551b70..02e48d99049 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrClassifierStorage.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrClassifierStorage.kt @@ -135,7 +135,7 @@ class Fir2IrClassifierStorage( return this } - internal fun getCachedIrClass(klass: FirClass<*>): IrClass? { + fun getCachedIrClass(klass: FirClass<*>): IrClass? { return if (klass is FirAnonymousObject || klass is FirRegularClass && klass.visibility == Visibilities.Local) { localStorage.getLocalClass(klass) } else { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 6796fc5b928..9a67a955b38 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -28465,6 +28465,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/reflection/properties/simpleGetProperties.kt"); } + @TestMetadata("withLocalType.kt") + public void testWithLocalType() throws Exception { + runTest("compiler/testData/codegen/box/reflection/properties/withLocalType.kt"); + } + @TestMetadata("compiler/testData/codegen/box/reflection/properties/accessors") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/testData/codegen/box/reflection/properties/withLocalType.kt b/compiler/testData/codegen/box/reflection/properties/withLocalType.kt new file mode 100644 index 00000000000..4a2df45fa38 --- /dev/null +++ b/compiler/testData/codegen/box/reflection/properties/withLocalType.kt @@ -0,0 +1,10 @@ +// TARGET_BACKEND: JVM +// WITH_REFLECT +// WITH_RUNTIME +import kotlin.reflect.full.declaredMemberProperties + +fun box(): String { + class A(val x: String) + class B(val y: A) + return (B::class.declaredMemberProperties.single().invoke(B(A("OK"))) as A).x +} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/GenerationUtils.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/GenerationUtils.kt index 64e4599617e..540eb80eb97 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/GenerationUtils.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/GenerationUtils.kt @@ -144,7 +144,7 @@ object GenerationUtils { codegenFactory.generateModuleInFrontendIRMode( generationState, moduleFragment, symbolTable, sourceManager, extensions ) { context, irClass, _, serializationBindings, parent -> - FirMetadataSerializer(session, context, irClass, serializationBindings, parent) + FirMetadataSerializer(session, context, irClass, serializationBindings, components, parent) } generationState.factory.done() diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 1a8ed41a92b..ac17b7bb56b 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -28831,6 +28831,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/reflection/properties/simpleGetProperties.kt"); } + @TestMetadata("withLocalType.kt") + public void testWithLocalType() throws Exception { + runTest("compiler/testData/codegen/box/reflection/properties/withLocalType.kt"); + } + @TestMetadata("compiler/testData/codegen/box/reflection/properties/accessors") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index c38c8b2a820..9cbfe8a2ff2 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -26465,6 +26465,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/reflection/properties/simpleGetProperties.kt"); } + @TestMetadata("withLocalType.kt") + public void testWithLocalType() throws Exception { + runTest("compiler/testData/codegen/box/reflection/properties/withLocalType.kt"); + } + @TestMetadata("compiler/testData/codegen/box/reflection/properties/accessors") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 067da877c88..06fabd766a5 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -28465,6 +28465,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/reflection/properties/simpleGetProperties.kt"); } + @TestMetadata("withLocalType.kt") + public void testWithLocalType() throws Exception { + runTest("compiler/testData/codegen/box/reflection/properties/withLocalType.kt"); + } + @TestMetadata("compiler/testData/codegen/box/reflection/properties/accessors") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) From 8f2ad57f7a5d2a35a839b638575ec260900de439 Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Fri, 4 Dec 2020 11:26:09 -0800 Subject: [PATCH 610/698] FIR: pass elvis expected type to lhs/rhs --- .../kotlin/fir/backend/Fir2IrVisitor.kt | 3 +- ...ControlFlowStatementsResolveTransformer.kt | 7 ++- .../elvis/kt6694ExactAnnotationForElvis.kt | 2 - .../ir/irText/expressions/kt30796.fir.kt.txt | 14 +++--- .../ir/irText/expressions/kt30796.fir.txt | 50 +++++++++---------- 5 files changed, 37 insertions(+), 39 deletions(-) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt index 27fb76fee5e..d450a6b19ee 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt @@ -587,8 +587,7 @@ class Fir2IrVisitor( fun irGetLhsValue(): IrGetValue = IrGetValueImpl(startOffset, endOffset, irLhsVariable.type, irLhsVariable.symbol) - // TODO: replace with .coneType - val originalType = firLhsVariable.returnTypeRef.coneTypeUnsafe() + val originalType = firLhsVariable.returnTypeRef.coneType val notNullType = originalType.withNullability(ConeNullability.NOT_NULL) val irBranches = listOf( IrBranchImpl( diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirControlFlowStatementsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirControlFlowStatementsResolveTransformer.kt index 166ab8f9f74..3618d271e6c 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirControlFlowStatementsResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirControlFlowStatementsResolveTransformer.kt @@ -216,9 +216,12 @@ class FirControlFlowStatementsResolveTransformer(transformer: FirBodyResolveTran ): CompositeTransformResult { if (elvisExpression.calleeReference is FirResolvedNamedReference) return elvisExpression.compose() elvisExpression.transformAnnotations(transformer, data) - elvisExpression.transformLhs(transformer, ResolutionMode.ContextDependent) + val expectedArgumentType = + if (data is ResolutionMode.WithExpectedType && data.expectedType !is FirImplicitTypeRef) data + else ResolutionMode.ContextDependent + elvisExpression.transformLhs(transformer, expectedArgumentType) dataFlowAnalyzer.exitElvisLhs(elvisExpression) - elvisExpression.transformRhs(transformer, ResolutionMode.ContextDependent) + elvisExpression.transformRhs(transformer, expectedArgumentType) val result = syntheticCallGenerator.generateCalleeForElvisExpression(elvisExpression, resolutionContext)?.let { callCompleter.completeCall(it, data.expectedType).result diff --git a/compiler/testData/codegen/box/elvis/kt6694ExactAnnotationForElvis.kt b/compiler/testData/codegen/box/elvis/kt6694ExactAnnotationForElvis.kt index 5143289515e..af26c6e87f2 100644 --- a/compiler/testData/codegen/box/elvis/kt6694ExactAnnotationForElvis.kt +++ b/compiler/testData/codegen/box/elvis/kt6694ExactAnnotationForElvis.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - interface PsiElement { fun findChildByType(i: Int): T? = if (i == 42) JetOperationReferenceExpression() as T else throw Exception() diff --git a/compiler/testData/ir/irText/expressions/kt30796.fir.kt.txt b/compiler/testData/ir/irText/expressions/kt30796.fir.kt.txt index 92347743b7d..78adb7af6f6 100644 --- a/compiler/testData/ir/irText/expressions/kt30796.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt30796.fir.kt.txt @@ -50,17 +50,17 @@ fun test(value: T, value2: T) { } } val x5: Any = { // BLOCK - val : Int? = magic() + val : Any = magic() when { EQEQ(arg0 = , arg1 = null) -> 42 - else -> /*as Int */ + else -> } } val x6: Any = { // BLOCK - val : T = { // BLOCK + val : Any = { // BLOCK val : T = value when { - EQEQ(arg0 = , arg1 = null) -> magic() + EQEQ(arg0 = , arg1 = null) -> magic() else -> } } @@ -70,11 +70,11 @@ fun test(value: T, value2: T) { } } val x7: Any = { // BLOCK - val : T = { // BLOCK - val : T? = magic() + val : Any = { // BLOCK + val : Any = magic() when { EQEQ(arg0 = , arg1 = null) -> value - else -> /*as T */ + else -> } } when { diff --git a/compiler/testData/ir/irText/expressions/kt30796.fir.txt b/compiler/testData/ir/irText/expressions/kt30796.fir.txt index 344efa7f284..3e33c57eb70 100644 --- a/compiler/testData/ir/irText/expressions/kt30796.fir.txt +++ b/compiler/testData/ir/irText/expressions/kt30796.fir.txt @@ -96,68 +96,66 @@ FILE fqName: fileName:/kt30796.kt if: CONST Boolean type=kotlin.Boolean value=true then: GET_VAR 'val tmp_5: T of .test [val] declared in .test' type=T of .test origin=null VAR name:x5 type:kotlin.Any [val] - BLOCK type=kotlin.Int origin=ELVIS - VAR IR_TEMPORARY_VARIABLE name:tmp_7 type:kotlin.Int? [val] - CALL 'public final fun magic (): T of .magic declared in ' type=kotlin.Int? origin=null - : kotlin.Int? - WHEN type=kotlin.Int origin=ELVIS + BLOCK type=kotlin.Any origin=ELVIS + VAR IR_TEMPORARY_VARIABLE name:tmp_7 type:kotlin.Any [val] + CALL 'public final fun magic (): T of .magic declared in ' type=kotlin.Any origin=null + : kotlin.Any + WHEN type=kotlin.Any origin=ELVIS BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ - arg0: GET_VAR 'val tmp_7: kotlin.Int? [val] declared in .test' type=kotlin.Int? origin=null + arg0: GET_VAR 'val tmp_7: kotlin.Any [val] declared in .test' type=kotlin.Any origin=null arg1: CONST Null type=kotlin.Nothing? value=null then: CONST Int type=kotlin.Int value=42 BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int - GET_VAR 'val tmp_7: kotlin.Int? [val] declared in .test' type=kotlin.Int? origin=null + then: GET_VAR 'val tmp_7: kotlin.Any [val] declared in .test' type=kotlin.Any origin=null VAR name:x6 type:kotlin.Any [val] BLOCK type=kotlin.Any origin=ELVIS - VAR IR_TEMPORARY_VARIABLE name:tmp_8 type:T of .test [val] - BLOCK type=T of .test origin=ELVIS + VAR IR_TEMPORARY_VARIABLE name:tmp_8 type:kotlin.Any [val] + BLOCK type=kotlin.Any origin=ELVIS VAR IR_TEMPORARY_VARIABLE name:tmp_9 type:T of .test [val] GET_VAR 'value: T of .test declared in .test' type=T of .test origin=null - WHEN type=T of .test origin=ELVIS + WHEN type=kotlin.Any origin=ELVIS BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp_9: T of .test [val] declared in .test' type=T of .test origin=null arg1: CONST Null type=kotlin.Nothing? value=null - then: CALL 'public final fun magic (): T of .magic declared in ' type=T of .test origin=null - : T of .test + then: CALL 'public final fun magic (): T of .magic declared in ' type=kotlin.Any origin=null + : kotlin.Any BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: GET_VAR 'val tmp_9: T of .test [val] declared in .test' type=T of .test origin=null WHEN type=kotlin.Any origin=ELVIS BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ - arg0: GET_VAR 'val tmp_8: T of .test [val] declared in .test' type=T of .test origin=null + arg0: GET_VAR 'val tmp_8: kotlin.Any [val] declared in .test' type=kotlin.Any origin=null arg1: CONST Null type=kotlin.Nothing? value=null then: CONST Int type=kotlin.Int value=42 BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: GET_VAR 'val tmp_8: T of .test [val] declared in .test' type=T of .test origin=null + then: GET_VAR 'val tmp_8: kotlin.Any [val] declared in .test' type=kotlin.Any origin=null VAR name:x7 type:kotlin.Any [val] BLOCK type=kotlin.Any origin=ELVIS - VAR IR_TEMPORARY_VARIABLE name:tmp_10 type:T of .test [val] - BLOCK type=T of .test origin=ELVIS - VAR IR_TEMPORARY_VARIABLE name:tmp_11 type:T of .test? [val] - CALL 'public final fun magic (): T of .magic declared in ' type=T of .test? origin=null - : T of .test? - WHEN type=T of .test origin=ELVIS + VAR IR_TEMPORARY_VARIABLE name:tmp_10 type:kotlin.Any [val] + BLOCK type=kotlin.Any origin=ELVIS + VAR IR_TEMPORARY_VARIABLE name:tmp_11 type:kotlin.Any [val] + CALL 'public final fun magic (): T of .magic declared in ' type=kotlin.Any origin=null + : kotlin.Any + WHEN type=kotlin.Any origin=ELVIS BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ - arg0: GET_VAR 'val tmp_11: T of .test? [val] declared in .test' type=T of .test? origin=null + arg0: GET_VAR 'val tmp_11: kotlin.Any [val] declared in .test' type=kotlin.Any origin=null arg1: CONST Null type=kotlin.Nothing? value=null then: GET_VAR 'value: T of .test declared in .test' type=T of .test origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: TYPE_OP type=T of .test origin=IMPLICIT_CAST typeOperand=T of .test - GET_VAR 'val tmp_11: T of .test? [val] declared in .test' type=T of .test? origin=null + then: GET_VAR 'val tmp_11: kotlin.Any [val] declared in .test' type=kotlin.Any origin=null WHEN type=kotlin.Any origin=ELVIS BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ - arg0: GET_VAR 'val tmp_10: T of .test [val] declared in .test' type=T of .test origin=null + arg0: GET_VAR 'val tmp_10: kotlin.Any [val] declared in .test' type=kotlin.Any origin=null arg1: CONST Null type=kotlin.Nothing? value=null then: CONST Int type=kotlin.Int value=42 BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: GET_VAR 'val tmp_10: T of .test [val] declared in .test' type=T of .test origin=null + then: GET_VAR 'val tmp_10: kotlin.Any [val] declared in .test' type=kotlin.Any origin=null From 1bc369c63c0a9f923da372fd33e53c1df85ab313 Mon Sep 17 00:00:00 2001 From: Vyacheslav Gerasimov Date: Thu, 10 Dec 2020 19:49:21 +0300 Subject: [PATCH 611/698] Build: Enable caching for test task with enabled test distribution #KTI-112 --- build.gradle.kts | 2 +- buildSrc/src/main/kotlin/testDistribution.kt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index abf16ff88c6..b3afa6c8093 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -467,7 +467,7 @@ allprojects { } tasks.withType { - outputs.doNotCacheIf("https://youtrack.jetbrains.com/issue/KT-37089") { true } + outputs.doNotCacheIf("https://youtrack.jetbrains.com/issue/KTI-112") { !isTestDistributionEnabled() } } normalization { diff --git a/buildSrc/src/main/kotlin/testDistribution.kt b/buildSrc/src/main/kotlin/testDistribution.kt index b773e1f27b5..863cdc45704 100644 --- a/buildSrc/src/main/kotlin/testDistribution.kt +++ b/buildSrc/src/main/kotlin/testDistribution.kt @@ -25,3 +25,6 @@ fun Test.configureTestDistribution(configure: TestDistributionExtension.() -> Un configure() } } + +fun Test.isTestDistributionEnabled(): Boolean = + extensions.findByType(TestDistributionExtension::class.java)?.enabled?.orNull ?: false From 1d14926444edf55e963d1c16f2bf5956569517cd Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Thu, 10 Dec 2020 19:14:51 +0300 Subject: [PATCH 612/698] Re-enable evaluation tests in 201 platform Revert `[DEBUGGER] Temporary mute AbstractKotlinEvaluateExpressionTest` (85c59328c7edad30488ebff028812321b7f0a071) in 201 bunch. --- ...bstractKotlinEvaluateExpressionTest.kt.201 | 299 ++++++++++++++++++ 1 file changed, 299 insertions(+) create mode 100644 idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/AbstractKotlinEvaluateExpressionTest.kt.201 diff --git a/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/AbstractKotlinEvaluateExpressionTest.kt.201 b/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/AbstractKotlinEvaluateExpressionTest.kt.201 new file mode 100644 index 00000000000..4766c4f70d9 --- /dev/null +++ b/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/AbstractKotlinEvaluateExpressionTest.kt.201 @@ -0,0 +1,299 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.debugger.test + +import com.intellij.debugger.engine.ContextUtil +import com.intellij.debugger.engine.SuspendContextImpl +import com.intellij.debugger.engine.evaluation.CodeFragmentKind +import com.intellij.debugger.engine.evaluation.EvaluateException +import com.intellij.debugger.engine.evaluation.TextWithImportsImpl +import com.intellij.debugger.engine.evaluation.expression.EvaluatorBuilderImpl +import com.intellij.debugger.impl.DebuggerContextImpl +import com.intellij.debugger.impl.DebuggerContextImpl.createDebuggerContext +import com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl +import com.intellij.openapi.util.io.FileUtil +import com.intellij.ui.treeStructure.Tree +import com.intellij.xdebugger.impl.ui.tree.ValueMarkup +import com.sun.jdi.ObjectReference +import org.jetbrains.eval4j.ObjectValue +import org.jetbrains.eval4j.Value +import org.jetbrains.eval4j.jdi.asValue +import org.jetbrains.kotlin.idea.KotlinFileType +import org.jetbrains.kotlin.idea.debugger.evaluate.KotlinCodeFragmentFactory +import org.jetbrains.kotlin.idea.debugger.test.preference.DebuggerPreferences +import org.jetbrains.kotlin.idea.debugger.test.util.FramePrinter +import org.jetbrains.kotlin.idea.debugger.test.util.FramePrinterDelegate +import org.jetbrains.kotlin.idea.debugger.test.util.KotlinOutputChecker +import org.jetbrains.kotlin.idea.debugger.test.util.SteppingInstruction +import org.jetbrains.kotlin.idea.util.application.runReadAction +import org.jetbrains.kotlin.test.InTextDirectivesUtils +import org.jetbrains.kotlin.test.InTextDirectivesUtils.findLinesWithPrefixesRemoved +import org.jetbrains.kotlin.test.InTextDirectivesUtils.findStringWithPrefixes +import org.jetbrains.kotlin.test.KotlinBaseTest +import org.jetbrains.kotlin.test.TargetBackend +import java.io.File +import java.util.concurrent.ConcurrentHashMap +import javax.swing.tree.TreeNode + +private data class CodeFragment(val text: String, val result: String, val kind: CodeFragmentKind) + +private data class DebugLabel(val name: String, val localName: String) + +private class EvaluationTestData( + val instructions: List, + val fragments: List, + val debugLabels: List +) + +abstract class AbstractKotlinEvaluateExpressionTest : KotlinDescriptorTestCaseWithStepping(), FramePrinterDelegate { + private companion object { + private val ID_PART_REGEX = "id=[0-9]*".toRegex() + } + + override val debuggerContext: DebuggerContextImpl + get() = super.debuggerContext + + private var isMultipleBreakpointsTest = false + + private var framePrinter: FramePrinter? = null + + private val exceptions = ConcurrentHashMap() + + fun doSingleBreakpointTest(path: String) { + isMultipleBreakpointsTest = false + doTest(path) + } + + fun doMultipleBreakpointsTest(path: String) { + isMultipleBreakpointsTest = true + doTest(path) + } + + override fun doMultiFileTest(files: TestFiles, preferences: DebuggerPreferences) { + val wholeFile = files.wholeFile + + val instructions = SteppingInstruction.parse(wholeFile) + val expressions = loadExpressions(wholeFile) + val blocks = loadCodeBlocks(files.originalFile) + val debugLabels = loadDebugLabels(wholeFile) + + val data = EvaluationTestData(instructions, expressions + blocks, debugLabels) + + framePrinter = FramePrinter(myDebuggerSession, this, preferences, testRootDisposable) + + if (isMultipleBreakpointsTest) { + performMultipleBreakpointTest(data) + } else { + performSingleBreakpointTest(data) + } + } + + override fun tearDown() { + framePrinter?.close() + framePrinter = null + exceptions.clear() + + super.tearDown() + } + + private fun performSingleBreakpointTest(data: EvaluationTestData) { + process(data.instructions) + + doOnBreakpoint { + createDebugLabels(data.debugLabels) + + val exceptions = linkedMapOf() + + for ((expression, expected, kind) in data.fragments) { + mayThrow(expression) { + evaluate(this, expression, kind, expected) + } + } + + val completion = { resume(this) } + framePrinter?.printFrame(completion) ?: completion() + } + + finish() + } + + private fun performMultipleBreakpointTest(data: EvaluationTestData) { + for ((expression, expected) in data.fragments) { + doOnBreakpoint { + mayThrow(expression) { + try { + evaluate(this, expression, CodeFragmentKind.EXPRESSION, expected) + } finally { + val completion = { resume(this) } + framePrinter?.printFrame(completion) ?: completion() + } + } + } + } + finish() + } + + override fun evaluate(suspendContext: SuspendContextImpl, textWithImports: TextWithImportsImpl) { + evaluate(suspendContext, textWithImports, null) + } + + private fun evaluate(suspendContext: SuspendContextImpl, text: String, codeFragmentKind: CodeFragmentKind, expectedResult: String?) { + val textWithImports = TextWithImportsImpl(codeFragmentKind, text, "", KotlinFileType.INSTANCE) + return evaluate(suspendContext, textWithImports, expectedResult) + } + + private fun evaluate(suspendContext: SuspendContextImpl, item: TextWithImportsImpl, expectedResult: String?) { + val evaluationContext = this.evaluationContext + val sourcePosition = ContextUtil.getSourcePosition(suspendContext) + + // Default test debuggerContext doesn't provide a valid stackFrame so we have to create one more for evaluation purposes. + val frameProxy = suspendContext.frameProxy + val threadProxy = frameProxy?.threadProxy() + val debuggerContext = createDebuggerContext(myDebuggerSession, suspendContext, threadProxy, frameProxy) + debuggerContext.initCaches() + + val contextElement = ContextUtil.getContextElement(debuggerContext)!! + + assert(KotlinCodeFragmentFactory().isContextAccepted(contextElement)) { + val text = runReadAction { contextElement.text } + "KotlinCodeFragmentFactory should be accepted for context element otherwise default evaluator will be called. " + + "ContextElement = $text" + } + + contextElement.putCopyableUserData(KotlinCodeFragmentFactory.DEBUG_CONTEXT_FOR_TESTS, debuggerContext) + + suspendContext.runActionInSuspendCommand { + try { + val evaluator = runReadAction { + EvaluatorBuilderImpl.build( + item, + contextElement, + sourcePosition, + this@AbstractKotlinEvaluateExpressionTest.project + ) + } + ?: throw AssertionError("Cannot create an Evaluator for Evaluate Expression") + + val value = evaluator.evaluate(evaluationContext) + val actualResult = value.asValue().asString() + if (expectedResult != null) { + assertEquals( + "Evaluate expression returns wrong result for ${item.text}:\n" + + "expected = $expectedResult\n" + + "actual = $actualResult\n", + expectedResult, actualResult + ) + } + } catch (e: EvaluateException) { + val expectedMessage = e.message?.replaceFirst( + ID_PART_REGEX, + "id=ID" + ) + assertEquals( + "Evaluate expression throws wrong exception for ${item.text}:\n" + + "expected = $expectedResult\n" + + "actual = $expectedMessage\n", + expectedResult, + expectedMessage + ) + } + } + } + + override fun logDescriptor(descriptor: NodeDescriptorImpl, text: String) { + super.logDescriptor(descriptor, text) + } + + override fun expandAll(tree: Tree, runnable: () -> Unit, filter: (TreeNode) -> Boolean, suspendContext: SuspendContextImpl) { + super.expandAll(tree, runnable, HashSet(), filter, suspendContext) + } + + private fun mayThrow(expression: String, f: () -> Unit) { + try { + f() + } catch (e: Throwable) { + exceptions[expression] = e + } + } + + override fun throwExceptionsIfAny() { + if (exceptions.isNotEmpty()) { + val isIgnored = InTextDirectivesUtils.isIgnoredTarget( + if (useIrBackend()) TargetBackend.JVM_IR else TargetBackend.JVM, + getExpectedOutputFile() + ) + + if (!isIgnored) { + for (exc in exceptions.values) { + exc.printStackTrace() + } + val expressionsText = exceptions.entries.joinToString("\n") { (k, v) -> "expression: $k, exception: ${v.message}" } + throw AssertionError("Test failed:\n$expressionsText") + } else { + (checker as KotlinOutputChecker).threwException = true + } + } + } + + private fun Value.asString(): String { + if (this is ObjectValue && this.value is ObjectReference) { + return this.toString().replaceFirst(ID_PART_REGEX, "id=ID") + } + return this.toString() + } + + private fun loadExpressions(testFile: KotlinBaseTest.TestFile): List { + val directives = findLinesWithPrefixesRemoved(testFile.content, "// EXPRESSION: ") + val expected = findLinesWithPrefixesRemoved(testFile.content, "// RESULT: ") + assert(directives.size == expected.size) { "Sizes of test directives are different" } + return directives.zip(expected).map { (text, result) -> CodeFragment(text, result, CodeFragmentKind.EXPRESSION) } + } + + private fun loadCodeBlocks(wholeFile: File): List { + val regexp = (Regex.escape(wholeFile.name) + ".fragment\\d*").toRegex() + val fragmentFiles = wholeFile.parentFile.listFiles { _, name -> regexp.matches(name) } ?: emptyArray() + + val codeFragments = mutableListOf() + + for (fragmentFile in fragmentFiles) { + val contents = FileUtil.loadFile(fragmentFile, true) + val value = findStringWithPrefixes(contents, "// RESULT: ") ?: error("'RESULT' directive is missing in $fragmentFile") + codeFragments += CodeFragment(contents, value, CodeFragmentKind.CODE_BLOCK) + } + + return codeFragments + } + + private fun loadDebugLabels(testFile: KotlinBaseTest.TestFile): List { + return findLinesWithPrefixesRemoved(testFile.content, "// DEBUG_LABEL: ") + .map { text -> + val labelParts = text.split("=") + assert(labelParts.size == 2) { "Wrong format for DEBUG_LABEL directive: // DEBUG_LABEL: {localVariableName} = {labelText}" } + + val localName = labelParts[0].trim() + val name = labelParts[1].trim() + DebugLabel(name, localName) + } + } + + private fun createDebugLabels(labels: List) { + if (labels.isEmpty()) { + return + } + + val markupMap = NodeDescriptorImpl.getMarkupMap(debugProcess) ?: return + + for ((name, localName) in labels) { + val localVariable = evaluationContext.frameProxy!!.visibleVariableByName(localName) + assert(localVariable != null) { "Cannot find localVariable for label: name = $localName" } + + val localVariableValue = evaluationContext.frameProxy!!.getValue(localVariable) as? ObjectReference + assert(localVariableValue != null) { "Local variable $localName should be an ObjectReference" } + + markupMap[localVariableValue] = ValueMarkup(name, null, name) + } + } +} From c922484758ac73f1552124ed2dbe7c593c15bf4c Mon Sep 17 00:00:00 2001 From: Mads Ager Date: Wed, 25 Nov 2020 14:36:40 +0100 Subject: [PATCH 613/698] [JVM_IR] Use direct field access to backing fields on current class. The current backend uses direct field access to the backing field instead of calling the companion object accessor, which calls an accessibility bridge, which then gets the field for code such as: ``` class A { companion object { val s: String = "OK" } // f uses direct access to the A.s backing field. fun f() = s } ``` This change does the same for the IR backend. --- .../ir/FirBlackBoxCodegenTestGenerated.java | 23 ++++ .../ir/FirBytecodeTextTestGenerated.java | 20 ++++ .../jvm/JvmLoweredDeclarationOrigin.kt | 2 +- .../jvm/lower/JvmPropertiesLowering.kt | 28 ++++- .../companion/delegatedPropertyOnCompanion.kt | 46 ++++++++ .../inlineFunctionCompanionPropertyAccess.kt | 19 ++++ .../companion/directAccessToBackingField.kt | 38 +++++++ .../inlineFunctionCompanionPropertyAccess.kt | 29 +++++ ...neFunctionObjectCompanionPropertyAccess.kt | 101 ++++++++++++++++++ .../companion/nonDefaultAccessors.kt | 23 ++++ .../codegen/BlackBoxCodegenTestGenerated.java | 23 ++++ .../codegen/BytecodeTextTestGenerated.java | 20 ++++ .../LightAnalysisModeTestGenerated.java | 23 ++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 23 ++++ .../ir/IrBytecodeTextTestGenerated.java | 20 ++++ .../IrJsCodegenBoxES6TestGenerated.java | 23 ++++ .../IrJsCodegenBoxTestGenerated.java | 23 ++++ .../semantics/JsCodegenBoxTestGenerated.java | 23 ++++ .../IrCodegenBoxWasmTestGenerated.java | 23 ++++ 19 files changed, 524 insertions(+), 6 deletions(-) create mode 100644 compiler/testData/codegen/box/companion/delegatedPropertyOnCompanion.kt create mode 100644 compiler/testData/codegen/box/companion/inlineFunctionCompanionPropertyAccess.kt create mode 100644 compiler/testData/codegen/bytecodeText/companion/directAccessToBackingField.kt create mode 100644 compiler/testData/codegen/bytecodeText/companion/inlineFunctionCompanionPropertyAccess.kt create mode 100644 compiler/testData/codegen/bytecodeText/companion/inlineFunctionObjectCompanionPropertyAccess.kt create mode 100644 compiler/testData/codegen/bytecodeText/companion/nonDefaultAccessors.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 9a67a955b38..8ec5662af6a 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -5161,6 +5161,29 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } } + @TestMetadata("compiler/testData/codegen/box/companion") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Companion extends AbstractFirBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); + } + + public void testAllFilesPresentInCompanion() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/companion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("delegatedPropertyOnCompanion.kt") + public void testDelegatedPropertyOnCompanion() throws Exception { + runTest("compiler/testData/codegen/box/companion/delegatedPropertyOnCompanion.kt"); + } + + @TestMetadata("inlineFunctionCompanionPropertyAccess.kt") + public void testInlineFunctionCompanionPropertyAccess() throws Exception { + runTest("compiler/testData/codegen/box/companion/inlineFunctionCompanionPropertyAccess.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/compatibility") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBytecodeTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBytecodeTextTestGenerated.java index 33848c6fe9a..f5a766d10f8 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBytecodeTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBytecodeTextTestGenerated.java @@ -966,11 +966,26 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/companion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @TestMetadata("directAccessToBackingField.kt") + public void testDirectAccessToBackingField() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/companion/directAccessToBackingField.kt"); + } + @TestMetadata("floatingPointCompanionAccess.kt") public void testFloatingPointCompanionAccess() throws Exception { runTest("compiler/testData/codegen/bytecodeText/companion/floatingPointCompanionAccess.kt"); } + @TestMetadata("inlineFunctionCompanionPropertyAccess.kt") + public void testInlineFunctionCompanionPropertyAccess() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/companion/inlineFunctionCompanionPropertyAccess.kt"); + } + + @TestMetadata("inlineFunctionObjectCompanionPropertyAccess.kt") + public void testInlineFunctionObjectCompanionPropertyAccess() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/companion/inlineFunctionObjectCompanionPropertyAccess.kt"); + } + @TestMetadata("kt14258_1.kt") public void testKt14258_1() throws Exception { runTest("compiler/testData/codegen/bytecodeText/companion/kt14258_1.kt"); @@ -996,6 +1011,11 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest { runTest("compiler/testData/codegen/bytecodeText/companion/kt14258_5.kt"); } + @TestMetadata("nonDefaultAccessors.kt") + public void testNonDefaultAccessors() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/companion/nonDefaultAccessors.kt"); + } + @TestMetadata("privateCompanionObjectAccessors_after.kt") public void testPrivateCompanionObjectAccessors_after() throws Exception { runTest("compiler/testData/codegen/bytecodeText/companion/privateCompanionObjectAccessors_after.kt"); diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLoweredDeclarationOrigin.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLoweredDeclarationOrigin.kt index 2df04199b2f..d1e7d1e1558 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLoweredDeclarationOrigin.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLoweredDeclarationOrigin.kt @@ -43,7 +43,7 @@ interface JvmLoweredDeclarationOrigin : IrDeclarationOrigin { object FOR_INLINE_STATE_MACHINE_TEMPLATE : IrDeclarationOriginImpl("FOR_INLINE_TEMPLATE") object FOR_INLINE_STATE_MACHINE_TEMPLATE_CAPTURES_CROSSINLINE : IrDeclarationOriginImpl("FOR_INLINE_TEMPLATE_CROSSINLINE") object CONTINUATION_CLASS_RESULT_FIELD: IrDeclarationOriginImpl("CONTINUATION_CLASS_RESULT_FIELD", isSynthetic = true) - object COMPANION_PROPERTY_BACKING_FIELD : IrDeclarationOriginImpl("COMPANION_MOVED_PROPERTY_BACKING_FIELD") + object COMPANION_PROPERTY_BACKING_FIELD : IrDeclarationOriginImpl("COMPANION_PROPERTY_BACKING_FIELD") object FIELD_FOR_STATIC_CALLABLE_REFERENCE_INSTANCE : IrDeclarationOriginImpl("FIELD_FOR_STATIC_CALLABLE_REFERENCE_INSTANCE") object ABSTRACT_BRIDGE_STUB : IrDeclarationOriginImpl("ABSTRACT_BRIDGE_STUB") } diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmPropertiesLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmPropertiesLowering.kt index c0b8141e2f7..e0f1795f86e 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmPropertiesLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmPropertiesLowering.kt @@ -17,6 +17,7 @@ import org.jetbrains.kotlin.backend.jvm.lower.inlineclasses.requiresMangling import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.descriptors.Modality +import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.IrStatement import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.builders.* @@ -28,10 +29,7 @@ import org.jetbrains.kotlin.ir.expressions.IrFieldAccessExpression import org.jetbrains.kotlin.ir.expressions.impl.IrBlockBodyImpl import org.jetbrains.kotlin.ir.types.* import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection -import org.jetbrains.kotlin.ir.util.coerceToUnit -import org.jetbrains.kotlin.ir.util.render -import org.jetbrains.kotlin.ir.util.resolveFakeOverride -import org.jetbrains.kotlin.ir.util.transformDeclarationsFlat +import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid import org.jetbrains.kotlin.load.java.JvmAbi import org.jetbrains.kotlin.name.Name @@ -54,7 +52,9 @@ class JvmPropertiesLowering(private val backendContext: JvmBackendContext) : IrE val property = simpleFunction.correspondingPropertySymbol?.owner ?: return super.visitCall(expression) expression.transformChildrenVoid() - if (shouldSubstituteAccessorWithField(property, simpleFunction)) { + if (shouldSubstituteAccessorWithField(property, simpleFunction) || + isDefaultAccessorForCompanionPropertyBackingFieldOnCurrentClass(property, simpleFunction) + ) { backendContext.createIrBuilder(currentScope!!.scope.scopeOwnerSymbol, expression.startOffset, expression.endOffset).apply { return when (simpleFunction) { property.getter -> substituteGetter(property, expression) @@ -67,6 +67,24 @@ class JvmPropertiesLowering(private val backendContext: JvmBackendContext) : IrE return expression } + private fun isDefaultAccessorForCompanionPropertyBackingFieldOnCurrentClass( + property: IrProperty, + function: IrSimpleFunction + ): Boolean { + if (function.origin != IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR) return false + if (property.isLateinit) return false + // If this code could end up inlined in another class (either an inline function or an + // inlined lambda in an inline function) use the companion object accessor. Otherwise, + // we could break binary compatibility if we only recompile the class with the companion + // object and change to non-default field accessors. The inlined code would still attempt + // to get the backing field which would no longer exist. + val inInlineFunctionScope = allScopes.any { scope -> (scope.irElement as? IrFunction)?.isInline ?: false } + if (inInlineFunctionScope) return false + val backingField = property.resolveFakeOverride()!!.backingField + return backingField?.parent == currentClass?.irElement && + backingField?.origin == JvmLoweredDeclarationOrigin.COMPANION_PROPERTY_BACKING_FIELD + } + private fun IrBuilderWithScope.substituteSetter(irProperty: IrProperty, expression: IrCall): IrExpression = patchReceiver( irSetField( diff --git a/compiler/testData/codegen/box/companion/delegatedPropertyOnCompanion.kt b/compiler/testData/codegen/box/companion/delegatedPropertyOnCompanion.kt new file mode 100644 index 00000000000..e49cb028f6e --- /dev/null +++ b/compiler/testData/codegen/box/companion/delegatedPropertyOnCompanion.kt @@ -0,0 +1,46 @@ +import kotlin.reflect.KProperty + +class Delegate { + operator fun getValue(t: Any?, p: KProperty<*>): String = "OK" +} + +class Delegate2 { + var value: String = "NOT OK" + + operator fun getValue(t: Any?, p: KProperty<*>): String = value + + operator fun setValue(thisRef: Any?, property: KProperty<*>, value: String) { + this.value = value + } +} + +class A { + companion object { + val s: String by Delegate() + var s2: String by Delegate2() + var s3: String by Delegate2() + } + + fun f() = s + inline fun g() = s + + fun set2() { + s2 = "OK" + } + fun get2() = s2 + + inline fun set3() { + s3 = "OK" + } + inline fun get3() = s3 +} + +fun box(): String { + val a = A() + if (a.f() != "OK") return "FAIL0" + if (a.g() != "OK") return "FAIL0" + a.set2() + if (a.get2() != "OK") return "FAIL0" + a.set3() + return a.get3() +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/companion/inlineFunctionCompanionPropertyAccess.kt b/compiler/testData/codegen/box/companion/inlineFunctionCompanionPropertyAccess.kt new file mode 100644 index 00000000000..3e456abac3a --- /dev/null +++ b/compiler/testData/codegen/box/companion/inlineFunctionCompanionPropertyAccess.kt @@ -0,0 +1,19 @@ +class A { + companion object { + val s = "OK" + var v = "NOT OK" + } + + inline fun f(): String = s + + inline fun g() { + v = "OK" + } +} + +fun box(): String { + val a = A() + if (a.f() != "OK") return "FAIL0" + a.g() + return A.v +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/companion/directAccessToBackingField.kt b/compiler/testData/codegen/bytecodeText/companion/directAccessToBackingField.kt new file mode 100644 index 00000000000..9f5a468dd0b --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/companion/directAccessToBackingField.kt @@ -0,0 +1,38 @@ +class A { + companion object { + val s = "OK" + var v = "NOT OK" + } + + fun f(): String = s + + fun g() { + v = "OK" + } + + inline fun i(j: () -> Unit) { + j() + } + + fun h() { + i { + s + v = "OK" + } + } +} + +// One direct `A.s` access in `f`. +// One direct `A.s` access in the accessibility bridge `access$getS$cp`. +// One direct `A.s` access in `h`. +// 3 GETSTATIC A.s + +// One direct `A.v` set in `g`. +// One direct `A.v` set in the accessibility bridge `access$setV$cp`. +// One direct `A.v` set in `A.` +// One direct `A.v` set in `h`. +// 4 PUTSTATIC A.v + +// No calls to the getter/setter on the companion object. +// 0 INVOKEVIRTUAL A\$Companion.getS +// 0 INVOKEVIRTUAL A\$Companion.setV \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/companion/inlineFunctionCompanionPropertyAccess.kt b/compiler/testData/codegen/bytecodeText/companion/inlineFunctionCompanionPropertyAccess.kt new file mode 100644 index 00000000000..e416dca3517 --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/companion/inlineFunctionCompanionPropertyAccess.kt @@ -0,0 +1,29 @@ +class A { + companion object { + val s = "OK" + var v = "NOT OK" + } + + inline fun f(): String = s + + inline fun g() { + v = "OK" + } +} + +// One direct `A.s` access in the accessibility bridge `access$getS$cp`. +// 1 GETSTATIC A.s + +// One direct `A.v` set in the accessibility bridge `access$setV$cp`. +// One direct `A.v` set in `A.` +// 2 PUTSTATIC A.v + +// One call to the getter/setter on the companion object from f and one from g. +// 1 INVOKEVIRTUAL A\$Companion.getS +// 1 INVOKEVIRTUAL A\$Companion.setV + +// One call to the accessibility bridge `access$setV$cp` from Companion.setV. +// 1 INVOKESTATIC A.access\$setV\$cp + +// One call to the accessibility bridge `access$getS$cp` from Companion.getS. +// 1 INVOKESTATIC A.access\$getS\$cp diff --git a/compiler/testData/codegen/bytecodeText/companion/inlineFunctionObjectCompanionPropertyAccess.kt b/compiler/testData/codegen/bytecodeText/companion/inlineFunctionObjectCompanionPropertyAccess.kt new file mode 100644 index 00000000000..f571772dc6c --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/companion/inlineFunctionObjectCompanionPropertyAccess.kt @@ -0,0 +1,101 @@ +class A { + companion object { + val s = "OK" + var v = "NOT OK" + } + + inline fun g(crossinline f: () -> Unit) { + { + f() + s + v = "OK" + } () + } + + inline fun g2(crossinline f: () -> Unit) { + object { + fun run() { + f() + s + v = "OK" + } + }.run () + } + + inline fun use() { + g { + s + g2 { s } + } + g { + v = "OK" + g2 { + v = "OK" + } + } + } + + fun useNonInline() { + g { + s + g2 { s } + } + g { + v = "OK" + g2 { + v = "OK" + } + } + } +} + +// One direct `A.s` access in the accessibility bridge `access$getS$cp`. +// 1 GETSTATIC A.s + +// One direct `A.v` set in the accessibility bridge `access$setV$cp`. +// One direct `A.v` set in `A.` +// 2 PUTSTATIC A.v + +// JVM_IR_TEMPLATES + +// Two accesses from the inline function code for `g` and `g2`. +// Four accesses from the code for `g` and `g2` inlined in `useInline`. +// Two accesses from the lambdas inlined in `useInline`. +// Four accesses from the code for `g` and `g2` inlined in `useNonInline`. +// 12 INVOKEVIRTUAL A\$Companion.getS + +// Two accesses from the inline function code for `g` and `g2`. +// Four accesses from the code for `g` and `g2` inlined in `useInline`. +// Two accesses from the lambdas inlined in `useInline`. +// Four accesses from the code for `g` and `g2` inlined in `useNonInline`. +// 12 INVOKEVIRTUAL A\$Companion.setV + +// One call to the accessibility bridge `access$setV$cp` from Companion.setV. +// Two uses of the direct accessor from the lambdas inlined in useNonInline. +// 3 INVOKESTATIC A.access\$setV\$cp + +// One call to the accessibility bridge `access$getS$cp` from Companion.getS. +// Two uses of the direct accessor from the lambdas inlined in useNonInline. +// 3 INVOKESTATIC A.access\$getS\$cp + +// JVM_TEMPLATES + +// Two accesses from the inline function code for `g` and `g2`. +// Four accesses from the code for `g` and `g2` inlined in `useInline`. +// Two accesses from the lambdas inlined in `useInline`. +// Four accesses from the code for `g` and `g2` inlined in `useNonInline`. +// Two accesses from the lambdas inlined in `useNonInline`. +// 14 INVOKEVIRTUAL A\$Companion.getS + +// Two accesses from the inline function code for `g` and `g2`. +// Four accesses from the code for `g` and `g2` inlined in `useInline`. +// Two accesses from the lambdas inlined in `useInline`. +// Four accesses from the code for `g` and `g2` inlined in `useNonInline`. +// Two accesses from the lambdas inlined in `useNonInline`. +// 14 INVOKEVIRTUAL A\$Companion.setV + +// One call to the accessibility bridge `access$setV$cp` from Companion.setV. +// 1 INVOKESTATIC A.access\$setV\$cp + +// One call to the accessibility bridge `access$getS$cp` from Companion.getS. +// 1 INVOKESTATIC A.access\$getS\$cp \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/companion/nonDefaultAccessors.kt b/compiler/testData/codegen/bytecodeText/companion/nonDefaultAccessors.kt new file mode 100644 index 00000000000..b4a2862d91d --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/companion/nonDefaultAccessors.kt @@ -0,0 +1,23 @@ +class A { + companion object { + val s: String + get() = "Ok" + var v : String + get() = "NOT OK" + set(value) {} + } + + inline fun f(): String = s + + inline fun g() { + v = "OK" + } +} + +// No backing field on A and all accesses call the getter/setter. +// 0 GETSTATIC A.s +// 0 PUTSTATIC A.v + +// One `getS` call in `f` and one `setV` call in `g` +// 1 INVOKEVIRTUAL A\$Companion.getS +// 1 INVOKEVIRTUAL A\$Companion.setV \ No newline at end of file diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index ac17b7bb56b..e361660eab9 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -5161,6 +5161,29 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } } + @TestMetadata("compiler/testData/codegen/box/companion") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Companion extends AbstractBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInCompanion() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/companion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("delegatedPropertyOnCompanion.kt") + public void testDelegatedPropertyOnCompanion() throws Exception { + runTest("compiler/testData/codegen/box/companion/delegatedPropertyOnCompanion.kt"); + } + + @TestMetadata("inlineFunctionCompanionPropertyAccess.kt") + public void testInlineFunctionCompanionPropertyAccess() throws Exception { + runTest("compiler/testData/codegen/box/companion/inlineFunctionCompanionPropertyAccess.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/compatibility") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java index 59439ce3d61..7659e7ae60e 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java @@ -966,11 +966,26 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/companion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } + @TestMetadata("directAccessToBackingField.kt") + public void testDirectAccessToBackingField() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/companion/directAccessToBackingField.kt"); + } + @TestMetadata("floatingPointCompanionAccess.kt") public void testFloatingPointCompanionAccess() throws Exception { runTest("compiler/testData/codegen/bytecodeText/companion/floatingPointCompanionAccess.kt"); } + @TestMetadata("inlineFunctionCompanionPropertyAccess.kt") + public void testInlineFunctionCompanionPropertyAccess() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/companion/inlineFunctionCompanionPropertyAccess.kt"); + } + + @TestMetadata("inlineFunctionObjectCompanionPropertyAccess.kt") + public void testInlineFunctionObjectCompanionPropertyAccess() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/companion/inlineFunctionObjectCompanionPropertyAccess.kt"); + } + @TestMetadata("kt14258_1.kt") public void testKt14258_1() throws Exception { runTest("compiler/testData/codegen/bytecodeText/companion/kt14258_1.kt"); @@ -996,6 +1011,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest { runTest("compiler/testData/codegen/bytecodeText/companion/kt14258_5.kt"); } + @TestMetadata("nonDefaultAccessors.kt") + public void testNonDefaultAccessors() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/companion/nonDefaultAccessors.kt"); + } + @TestMetadata("privateCompanionObjectAccessors_after.kt") public void testPrivateCompanionObjectAccessors_after() throws Exception { runTest("compiler/testData/codegen/bytecodeText/companion/privateCompanionObjectAccessors_after.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 9cbfe8a2ff2..093a5c84f9b 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -5161,6 +5161,29 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } } + @TestMetadata("compiler/testData/codegen/box/companion") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Companion extends AbstractLightAnalysisModeTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInCompanion() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/companion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("delegatedPropertyOnCompanion.kt") + public void testDelegatedPropertyOnCompanion() throws Exception { + runTest("compiler/testData/codegen/box/companion/delegatedPropertyOnCompanion.kt"); + } + + @TestMetadata("inlineFunctionCompanionPropertyAccess.kt") + public void testInlineFunctionCompanionPropertyAccess() throws Exception { + runTest("compiler/testData/codegen/box/companion/inlineFunctionCompanionPropertyAccess.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/compatibility") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 06fabd766a5..bbe47f50399 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -5161,6 +5161,29 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } } + @TestMetadata("compiler/testData/codegen/box/companion") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Companion extends AbstractIrBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInCompanion() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/companion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("delegatedPropertyOnCompanion.kt") + public void testDelegatedPropertyOnCompanion() throws Exception { + runTest("compiler/testData/codegen/box/companion/delegatedPropertyOnCompanion.kt"); + } + + @TestMetadata("inlineFunctionCompanionPropertyAccess.kt") + public void testInlineFunctionCompanionPropertyAccess() throws Exception { + runTest("compiler/testData/codegen/box/companion/inlineFunctionCompanionPropertyAccess.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/compatibility") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java index b68ce967cf4..15c07b925df 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java @@ -966,11 +966,26 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/companion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @TestMetadata("directAccessToBackingField.kt") + public void testDirectAccessToBackingField() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/companion/directAccessToBackingField.kt"); + } + @TestMetadata("floatingPointCompanionAccess.kt") public void testFloatingPointCompanionAccess() throws Exception { runTest("compiler/testData/codegen/bytecodeText/companion/floatingPointCompanionAccess.kt"); } + @TestMetadata("inlineFunctionCompanionPropertyAccess.kt") + public void testInlineFunctionCompanionPropertyAccess() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/companion/inlineFunctionCompanionPropertyAccess.kt"); + } + + @TestMetadata("inlineFunctionObjectCompanionPropertyAccess.kt") + public void testInlineFunctionObjectCompanionPropertyAccess() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/companion/inlineFunctionObjectCompanionPropertyAccess.kt"); + } + @TestMetadata("kt14258_1.kt") public void testKt14258_1() throws Exception { runTest("compiler/testData/codegen/bytecodeText/companion/kt14258_1.kt"); @@ -996,6 +1011,11 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest { runTest("compiler/testData/codegen/bytecodeText/companion/kt14258_5.kt"); } + @TestMetadata("nonDefaultAccessors.kt") + public void testNonDefaultAccessors() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/companion/nonDefaultAccessors.kt"); + } + @TestMetadata("privateCompanionObjectAccessors_after.kt") public void testPrivateCompanionObjectAccessors_after() throws Exception { runTest("compiler/testData/codegen/bytecodeText/companion/privateCompanionObjectAccessors_after.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index e3bbbe9f8fc..56bb4193eab 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -4131,6 +4131,29 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } } + @TestMetadata("compiler/testData/codegen/box/companion") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Companion extends AbstractIrJsCodegenBoxES6Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); + } + + public void testAllFilesPresentInCompanion() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/companion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + + @TestMetadata("delegatedPropertyOnCompanion.kt") + public void testDelegatedPropertyOnCompanion() throws Exception { + runTest("compiler/testData/codegen/box/companion/delegatedPropertyOnCompanion.kt"); + } + + @TestMetadata("inlineFunctionCompanionPropertyAccess.kt") + public void testInlineFunctionCompanionPropertyAccess() throws Exception { + runTest("compiler/testData/codegen/box/companion/inlineFunctionCompanionPropertyAccess.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/compatibility") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 3ab7141df36..2134843916e 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -4131,6 +4131,29 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } } + @TestMetadata("compiler/testData/codegen/box/companion") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Companion extends AbstractIrJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInCompanion() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/companion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + + @TestMetadata("delegatedPropertyOnCompanion.kt") + public void testDelegatedPropertyOnCompanion() throws Exception { + runTest("compiler/testData/codegen/box/companion/delegatedPropertyOnCompanion.kt"); + } + + @TestMetadata("inlineFunctionCompanionPropertyAccess.kt") + public void testInlineFunctionCompanionPropertyAccess() throws Exception { + runTest("compiler/testData/codegen/box/companion/inlineFunctionCompanionPropertyAccess.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/compatibility") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index dac1e1b5e89..a2a4634fad4 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -4131,6 +4131,29 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } } + @TestMetadata("compiler/testData/codegen/box/companion") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Companion extends AbstractJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); + } + + public void testAllFilesPresentInCompanion() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/companion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + + @TestMetadata("delegatedPropertyOnCompanion.kt") + public void testDelegatedPropertyOnCompanion() throws Exception { + runTest("compiler/testData/codegen/box/companion/delegatedPropertyOnCompanion.kt"); + } + + @TestMetadata("inlineFunctionCompanionPropertyAccess.kt") + public void testInlineFunctionCompanionPropertyAccess() throws Exception { + runTest("compiler/testData/codegen/box/companion/inlineFunctionCompanionPropertyAccess.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/compatibility") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index 0cb5cf7cafa..fc0ab4a5e1d 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -2982,6 +2982,29 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest } } + @TestMetadata("compiler/testData/codegen/box/companion") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Companion extends AbstractIrCodegenBoxWasmTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath); + } + + public void testAllFilesPresentInCompanion() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/companion"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); + } + + @TestMetadata("delegatedPropertyOnCompanion.kt") + public void testDelegatedPropertyOnCompanion() throws Exception { + runTest("compiler/testData/codegen/box/companion/delegatedPropertyOnCompanion.kt"); + } + + @TestMetadata("inlineFunctionCompanionPropertyAccess.kt") + public void testInlineFunctionCompanionPropertyAccess() throws Exception { + runTest("compiler/testData/codegen/box/companion/inlineFunctionCompanionPropertyAccess.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/compatibility") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) From b143cb9ae594bd03c05e6d1aa5dd3b302e47cb73 Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Fri, 11 Dec 2020 06:36:42 +0100 Subject: [PATCH 614/698] Disable new test on WASM --- .../codegen/box/companion/delegatedPropertyOnCompanion.kt | 1 + .../test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/compiler/testData/codegen/box/companion/delegatedPropertyOnCompanion.kt b/compiler/testData/codegen/box/companion/delegatedPropertyOnCompanion.kt index e49cb028f6e..160fc0ad118 100644 --- a/compiler/testData/codegen/box/companion/delegatedPropertyOnCompanion.kt +++ b/compiler/testData/codegen/box/companion/delegatedPropertyOnCompanion.kt @@ -1,3 +1,4 @@ +// DONT_TARGET_EXACT_BACKEND: WASM import kotlin.reflect.KProperty class Delegate { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index fc0ab4a5e1d..6c1a85f3ab9 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -2994,11 +2994,6 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/companion"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); } - @TestMetadata("delegatedPropertyOnCompanion.kt") - public void testDelegatedPropertyOnCompanion() throws Exception { - runTest("compiler/testData/codegen/box/companion/delegatedPropertyOnCompanion.kt"); - } - @TestMetadata("inlineFunctionCompanionPropertyAccess.kt") public void testInlineFunctionCompanionPropertyAccess() throws Exception { runTest("compiler/testData/codegen/box/companion/inlineFunctionCompanionPropertyAccess.kt"); From 5aaaa3881dfea4b58473dc3572be6f9ad220ea2c Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Fri, 11 Dec 2020 12:13:10 +0300 Subject: [PATCH 615/698] Refine diagnostic text for NULLABLE_TYPE_PARAMETER_AGAINST_NOT_NULL_TYPE_PARAMETER ^KT-43225 Fixed --- .../kotlin/resolve/jvm/checkers/JavaNullabilityChecker.kt | 2 +- .../resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java | 6 ++++-- .../jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JavaNullabilityChecker.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JavaNullabilityChecker.kt index f128c1682ea..3dd145f7d4d 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JavaNullabilityChecker.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JavaNullabilityChecker.kt @@ -53,7 +53,7 @@ class JavaNullabilityChecker : AdditionalTypeChecker { } if (isWrongTypeParameterNullabilityForSubtyping(expressionType, c) { dataFlowValue }) { - c.trace.report(ErrorsJvm.NULLABLE_TYPE_PARAMETER_AGAINST_NOT_NULL_TYPE_PARAMETER.on(expression, c.expectedType, expressionType)) + c.trace.report(ErrorsJvm.NULLABLE_TYPE_PARAMETER_AGAINST_NOT_NULL_TYPE_PARAMETER.on(expression, expressionType)) } doCheckType( expressionType, diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java index 5bc4af923fd..354c80dddd4 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java @@ -86,8 +86,10 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension { MAP.put(NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS, "Type mismatch: inferred type is {1} but {0} was expected", RENDER_TYPE, RENDER_TYPE); MAP.put(NULLABLE_TYPE_PARAMETER_AGAINST_NOT_NULL_TYPE_PARAMETER, - "Type mismatch: type parameter with nullable bounds is used {1} is used where {0} was expected. This warning will become an error soon", - RENDER_TYPE, RENDER_TYPE + "Type mismatch: value of a nullable type {0} is used where non-nullable type is expected. " + + "This warning will become an error soon. " + + "See https://youtrack.jetbrains.com/issue/KT-36770 for details", + RENDER_TYPE ); MAP.put(RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS, "Unsafe use of a nullable receiver of type {0}", RENDER_TYPE); diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java index 4ad4694f415..479358a99aa 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java @@ -137,8 +137,8 @@ public interface ErrorsJvm { DiagnosticFactory2 NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS = DiagnosticFactory2.create(WARNING); - DiagnosticFactory2 NULLABLE_TYPE_PARAMETER_AGAINST_NOT_NULL_TYPE_PARAMETER - = DiagnosticFactory2.create(WARNING); + DiagnosticFactory1 NULLABLE_TYPE_PARAMETER_AGAINST_NOT_NULL_TYPE_PARAMETER + = DiagnosticFactory1.create(WARNING); DiagnosticFactory1 RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS = DiagnosticFactory1.create(WARNING); From 0cab69a7a0586344674fc0731476d3d50a393d53 Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Thu, 10 Dec 2020 12:03:47 +0100 Subject: [PATCH 616/698] IC Mangling: Do not mangle functions with inline classes from Java in old JVM BE. Map types to boxed variants, when mapping signatures. #KT-26445 --- .../kotlin/codegen/state/KotlinTypeMapper.kt | 10 +++++-- .../codegen/state/inlineClassManglingUtils.kt | 2 ++ .../ir/FirBlackBoxCodegenTestGenerated.java | 18 ++++++++++++ .../javaInterop/inlineClasInSignature.kt | 29 +++++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 18 ++++++++++++ .../LightAnalysisModeTestGenerated.java | 18 ++++++++++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 18 ++++++++++++ .../IrJsCodegenBoxES6TestGenerated.java | 13 +++++++++ .../IrJsCodegenBoxTestGenerated.java | 13 +++++++++ .../semantics/JsCodegenBoxTestGenerated.java | 13 +++++++++ .../IrCodegenBoxWasmTestGenerated.java | 13 +++++++++ 11 files changed, 163 insertions(+), 2 deletions(-) create mode 100644 compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignature.kt diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt index 9df67a870c3..6fa8f12fb98 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt @@ -33,6 +33,7 @@ import org.jetbrains.kotlin.load.java.BuiltinMethodsWithSpecialGenericSignature import org.jetbrains.kotlin.load.java.JvmAbi import org.jetbrains.kotlin.load.java.descriptors.JavaCallableMemberDescriptor import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor +import org.jetbrains.kotlin.load.java.descriptors.JavaMethodDescriptor import org.jetbrains.kotlin.load.java.descriptors.getImplClassNameForDeserialized import org.jetbrains.kotlin.load.java.getJvmMethodNameIfSpecial import org.jetbrains.kotlin.load.java.getOverriddenBuiltinReflectingJvmDescriptor @@ -995,7 +996,8 @@ class KotlinTypeMapper @JvmOverloads constructor( if ((isFunctionExpression(descriptor) || isFunctionLiteral(descriptor)) && returnType.isInlineClassType()) return true return isJvmPrimitive(returnType) && - getAllOverriddenDescriptors(descriptor).any { !isJvmPrimitive(it.returnType!!) } + getAllOverriddenDescriptors(descriptor).any { !isJvmPrimitive(it.returnType!!) } || + returnType.isInlineClassType() && descriptor is JavaMethodDescriptor } private fun isJvmPrimitive(kotlinType: KotlinType) = @@ -1061,7 +1063,11 @@ class KotlinTypeMapper @JvmOverloads constructor( fun writeParameterType(sw: JvmSignatureWriter, type: KotlinType, callableDescriptor: CallableDescriptor?) { if (sw.skipGenericSignature()) { - mapType(type, sw, TypeMappingMode.DEFAULT) + if (type.isInlineClassType() && callableDescriptor is JavaMethodDescriptor) { + mapType(type, sw, TypeMappingMode.GENERIC_ARGUMENT) + } else { + mapType(type, sw, TypeMappingMode.DEFAULT) + } return } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/inlineClassManglingUtils.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/inlineClassManglingUtils.kt index e6fd417edf9..dfea95d6827 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/inlineClassManglingUtils.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/inlineClassManglingUtils.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.codegen.state import org.jetbrains.kotlin.codegen.coroutines.unwrapInitialDescriptorForSuspendFunction import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.load.java.descriptors.JavaMethodDescriptor import org.jetbrains.kotlin.name.FqNameUnsafe import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.InlineClassDescriptorResolver @@ -84,6 +85,7 @@ fun getManglingSuffixBasedOnKotlinSignature( ): String? { if (descriptor !is FunctionDescriptor) return null if (descriptor is ConstructorDescriptor) return null + if (descriptor is JavaMethodDescriptor) return null if (InlineClassDescriptorResolver.isSynthesizedBoxOrUnboxMethod(descriptor)) return null // Don't mangle functions with '@JvmName' annotation. diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 8ec5662af6a..7f5538d7c35 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -15113,6 +15113,24 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/javaInterop") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class JavaInterop extends AbstractFirBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); + } + + public void testAllFilesPresentInJavaInterop() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("inlineClasInSignature.kt") + public void testInlineClasInSignature() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignature.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignature.kt b/compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignature.kt new file mode 100644 index 00000000000..4e0731238fa --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignature.kt @@ -0,0 +1,29 @@ +// LANGUAGE: +InlineClasses +// TARGET_BACKEND: JVM +// WITH_RUNTIME + +// FILE: WithInlineClass.java + +import kotlin.UInt; +import org.jetbrains.annotations.NotNull; + +public class WithInlineClass { + private static UInt UINT = null; + + public static void acceptsUInt(@NotNull UInt u) { + UINT = u; + } + + @NotNull + public static UInt provideUInt() { + return UINT; + } +} + +// FILE: box.kt + +fun box(): String { + WithInlineClass.acceptsUInt(1u) + val res = WithInlineClass.provideUInt() + return if (res == 1u) "OK" else "FAIL $res" +} \ No newline at end of file diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index e361660eab9..394dd5e72e9 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -15113,6 +15113,24 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/javaInterop") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class JavaInterop extends AbstractBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInJavaInterop() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("inlineClasInSignature.kt") + public void testInlineClasInSignature() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignature.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 093a5c84f9b..2539216d812 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -15113,6 +15113,24 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/javaInterop") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class JavaInterop extends AbstractLightAnalysisModeTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInJavaInterop() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("inlineClasInSignature.kt") + public void testInlineClasInSignature() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignature.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index bbe47f50399..2445277dba9 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -15113,6 +15113,24 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/javaInterop") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class JavaInterop extends AbstractIrBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInJavaInterop() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("inlineClasInSignature.kt") + public void testInlineClasInSignature() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignature.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index 56bb4193eab..ee15ec8ed6a 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -13073,6 +13073,19 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/javaInterop") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class JavaInterop extends AbstractIrJsCodegenBoxES6Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); + } + + public void testAllFilesPresentInJavaInterop() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 2134843916e..e77006fe787 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -13073,6 +13073,19 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/javaInterop") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class JavaInterop extends AbstractIrJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInJavaInterop() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index a2a4634fad4..1ff50fac443 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -13138,6 +13138,19 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/javaInterop") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class JavaInterop extends AbstractJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); + } + + public void testAllFilesPresentInJavaInterop() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index 6c1a85f3ab9..91a8b9f0785 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -7459,6 +7459,19 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest } } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/javaInterop") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class JavaInterop extends AbstractIrCodegenBoxWasmTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath); + } + + public void testAllFilesPresentInJavaInterop() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/javaInterop"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); + } + } + @TestMetadata("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) From cbb8eb494a71b1138da4572593905b8058ab3255 Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Thu, 10 Dec 2020 13:00:59 +0100 Subject: [PATCH 617/698] IC Mangling: Do not mangle functions with inline classes from Java in JVM_IR BE. Map types to boxed variants, when mapping signatures. #KT-26445 --- .../kotlin/backend/jvm/codegen/MethodSignatureMapper.kt | 9 +++++++-- .../inlineclasses/MemoizedInlineClassReplacements.kt | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt index ee529cefb01..f8b66fff13f 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt @@ -195,7 +195,8 @@ class MethodSignatureMapper(private val context: JvmBackendContext) { // See also: KotlinTypeMapper.forceBoxedReturnType private fun forceBoxedReturnType(function: IrFunction): Boolean = - isBoxMethodForInlineClass(function) || forceFoxedReturnTypeOnOverride(function) || forceBoxedReturnTypeOnDefaultImplFun(function) + isBoxMethodForInlineClass(function) || forceFoxedReturnTypeOnOverride(function) || forceBoxedReturnTypeOnDefaultImplFun(function) || + function.isFromJava() && function.returnType.isInlined() private fun forceFoxedReturnTypeOnOverride(function: IrFunction) = function is IrSimpleFunction && @@ -320,7 +321,11 @@ class MethodSignatureMapper(private val context: JvmBackendContext) { private fun writeParameterType(sw: JvmSignatureWriter, type: IrType, declaration: IrDeclaration) { if (sw.skipGenericSignature()) { - typeMapper.mapType(type, TypeMappingMode.DEFAULT, sw) + if (type.isInlined() && declaration.isFromJava()) { + typeMapper.mapType(type, TypeMappingMode.GENERIC_ARGUMENT, sw) + } else { + typeMapper.mapType(type, TypeMappingMode.DEFAULT, sw) + } return } diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/inlineclasses/MemoizedInlineClassReplacements.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/inlineclasses/MemoizedInlineClassReplacements.kt index 298dbd39fca..275c1d664ad 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/inlineclasses/MemoizedInlineClassReplacements.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/inlineclasses/MemoizedInlineClassReplacements.kt @@ -81,7 +81,7 @@ class MemoizedInlineClassReplacements( } // Otherwise, mangle functions with mangled parameters, ignoring constructors - it is IrSimpleFunction && (it.hasMangledParameters || mangleReturnTypes && it.hasMangledReturnType) -> + it is IrSimpleFunction && !it.isFromJava() && (it.hasMangledParameters || mangleReturnTypes && it.hasMangledReturnType) -> if (it.dispatchReceiverParameter != null) createMethodReplacement(it) else From 69bb65496f53a4d77cfb50620ab7ca835c862f14 Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Thu, 10 Dec 2020 15:13:52 +0100 Subject: [PATCH 618/698] IC Mangling: Change test since we pass boxed inline class to java method #KT-28214 --- .../polymorphicSignature/invokeExactWithInlineClass.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/compiler/testData/codegen/box/polymorphicSignature/invokeExactWithInlineClass.kt b/compiler/testData/codegen/box/polymorphicSignature/invokeExactWithInlineClass.kt index bd41ed50af3..615b6416b23 100644 --- a/compiler/testData/codegen/box/polymorphicSignature/invokeExactWithInlineClass.kt +++ b/compiler/testData/codegen/box/polymorphicSignature/invokeExactWithInlineClass.kt @@ -15,8 +15,10 @@ fun box(): String { val mh = MethodHandles.lookup().unreflect(::foo.javaMethod!!) // TODO: it's unclear whether this should throw or not, see KT-28214. - val r1 = mh.invokeExact(Z("OK")) as String - if (r1 != "OK") return "Fail r1: $r1" - - return mh.invokeExact("OK") as String + return try { + mh.invokeExact(Z("OK")) + "FAIL" + } catch (ignored: java.lang.invoke.WrongMethodTypeException) { + "OK" + } } From 2b0a99b7b01bc3fa9d00d78696a69027c617549b Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Fri, 11 Dec 2020 11:43:43 +0100 Subject: [PATCH 619/698] IC Mangling: Use correct java field type if the type is inline class in old JVM BE. #KT-26445 --- .../kotlin/codegen/ExpressionCodegen.java | 12 ++++++- .../ir/FirBlackBoxCodegenTestGenerated.java | 10 ++++++ .../javaInterop/inlineClasInSignature.kt | 14 ++++---- .../inlineClasInSignatureNonNull.kt | 34 +++++++++++++++++++ .../inlineClasInSignatureNullable.kt | 34 +++++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 10 ++++++ .../LightAnalysisModeTestGenerated.java | 10 ++++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 10 ++++++ 8 files changed, 127 insertions(+), 7 deletions(-) create mode 100644 compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignatureNonNull.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignatureNullable.kt diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java index f2c109bf80d..0f6f65eb51a 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java @@ -54,6 +54,7 @@ import org.jetbrains.kotlin.descriptors.impl.TypeAliasConstructorDescriptor; import org.jetbrains.kotlin.diagnostics.Errors; import org.jetbrains.kotlin.lexer.KtTokens; import org.jetbrains.kotlin.load.java.DescriptorsJvmAbiUtil; +import org.jetbrains.kotlin.load.java.descriptors.JavaPropertyDescriptor; import org.jetbrains.kotlin.load.kotlin.DescriptorBasedTypeSignatureMappingKt; import org.jetbrains.kotlin.load.kotlin.MethodSignatureMappingKt; import org.jetbrains.kotlin.name.Name; @@ -2404,9 +2405,14 @@ public class ExpressionCodegen extends KtVisitor impleme fieldName = KotlinTypeMapper.mapDefaultFieldName(propertyDescriptor, isDelegatedProperty); } + KotlinType propertyType = propertyDescriptor.getOriginal().getType(); + if (propertyDescriptor instanceof JavaPropertyDescriptor && InlineClassesUtilsKt.isInlineClassType(propertyType)) { + propertyType = TypeUtils.makeNullable(propertyType); + } + return StackValue.property( propertyDescriptor, backingFieldOwner, - typeMapper.mapType(isDelegatedProperty && forceField ? delegateType : propertyDescriptor.getOriginal().getType()), + typeMapper.mapType(isDelegatedProperty && forceField ? delegateType : propertyType), isStaticBackingField, fieldName, callableGetter, callableSetter, receiver, this, resolvedCall, skipLateinitAssertion, isDelegatedProperty && forceField ? delegateType : null ); @@ -4375,6 +4381,10 @@ public class ExpressionCodegen extends KtVisitor impleme Type exprType = expressionType(expr); KotlinType exprKotlinType = kotlinType(expr); + if (exprKotlinType != null && InlineClassesUtilsKt.isInlineClassType(exprKotlinType) && + FlexibleTypesKt.isNullabilityFlexible(exprKotlinType)) { + exprKotlinType = TypeUtils.makeNullable(exprKotlinType); + } StackValue value; if (compileTimeConstant != null) { value = StackValue.constant(compileTimeConstant.getValue(), exprType, exprKotlinType); diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 7f5538d7c35..95a931926c1 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -15129,6 +15129,16 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT public void testInlineClasInSignature() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignature.kt"); } + + @TestMetadata("inlineClasInSignatureNonNull.kt") + public void testInlineClasInSignatureNonNull() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignatureNonNull.kt"); + } + + @TestMetadata("inlineClasInSignatureNullable.kt") + public void testInlineClasInSignatureNullable() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignatureNullable.kt"); + } } @TestMetadata("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods") diff --git a/compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignature.kt b/compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignature.kt index 4e0731238fa..105c8b34707 100644 --- a/compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignature.kt +++ b/compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignature.kt @@ -5,16 +5,14 @@ // FILE: WithInlineClass.java import kotlin.UInt; -import org.jetbrains.annotations.NotNull; public class WithInlineClass { - private static UInt UINT = null; + public static UInt UINT = null; - public static void acceptsUInt(@NotNull UInt u) { + public static void acceptsUInt(UInt u) { UINT = u; } - @NotNull public static UInt provideUInt() { return UINT; } @@ -24,6 +22,10 @@ public class WithInlineClass { fun box(): String { WithInlineClass.acceptsUInt(1u) - val res = WithInlineClass.provideUInt() - return if (res == 1u) "OK" else "FAIL $res" + var res = WithInlineClass.provideUInt() + if (res != 1u) return "FAIL 1 $res" + WithInlineClass.UINT = 2u + res = WithInlineClass.UINT + if (res != 2u) return "FAIL 2 $res" + return "OK" } \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignatureNonNull.kt b/compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignatureNonNull.kt new file mode 100644 index 00000000000..74ce893cbd3 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignatureNonNull.kt @@ -0,0 +1,34 @@ +// LANGUAGE: +InlineClasses +// TARGET_BACKEND: JVM +// WITH_RUNTIME + +// FILE: WithInlineClass.java + +import kotlin.UInt; +import org.jetbrains.annotations.NotNull; + +public class WithInlineClass { + @NotNull + public static UInt UINT = null; + + public static void acceptsUInt(@NotNull UInt u) { + UINT = u; + } + + @NotNull + public static UInt provideUInt() { + return UINT; + } +} + +// FILE: box.kt + +fun box(): String { + WithInlineClass.acceptsUInt(1u) + var res = WithInlineClass.provideUInt() + if (res != 1u) return "FAIL 1 $res" + WithInlineClass.UINT = 2u + res = WithInlineClass.UINT + if (res != 2u) return "FAIL 2 $res" + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignatureNullable.kt b/compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignatureNullable.kt new file mode 100644 index 00000000000..f8f2aad8bc7 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignatureNullable.kt @@ -0,0 +1,34 @@ +// LANGUAGE: +InlineClasses +// TARGET_BACKEND: JVM +// WITH_RUNTIME + +// FILE: WithInlineClass.java + +import kotlin.UInt; +import org.jetbrains.annotations.Nullable; + +public class WithInlineClass { + @Nullable + public static UInt UINT = null; + + public static void acceptsUInt(@Nullable UInt u) { + UINT = u; + } + + @Nullable + public static UInt provideUInt() { + return UINT; + } +} + +// FILE: box.kt + +fun box(): String { + WithInlineClass.acceptsUInt(1u) + var res = WithInlineClass.provideUInt() + if (res != 1u) return "FAIL 1 $res" + WithInlineClass.UINT = 2u + res = WithInlineClass.UINT + if (res != 2u) return "FAIL 2 $res" + return "OK" +} \ No newline at end of file diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 394dd5e72e9..67a85554678 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -15129,6 +15129,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { public void testInlineClasInSignature() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignature.kt"); } + + @TestMetadata("inlineClasInSignatureNonNull.kt") + public void testInlineClasInSignatureNonNull() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignatureNonNull.kt"); + } + + @TestMetadata("inlineClasInSignatureNullable.kt") + public void testInlineClasInSignatureNullable() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignatureNullable.kt"); + } } @TestMetadata("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 2539216d812..3d89f468b2a 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -15129,6 +15129,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes public void testInlineClasInSignature() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignature.kt"); } + + @TestMetadata("inlineClasInSignatureNonNull.kt") + public void testInlineClasInSignatureNonNull() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignatureNonNull.kt"); + } + + @TestMetadata("inlineClasInSignatureNullable.kt") + public void testInlineClasInSignatureNullable() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignatureNullable.kt"); + } } @TestMetadata("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 2445277dba9..5c2dee7064d 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -15129,6 +15129,16 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes public void testInlineClasInSignature() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignature.kt"); } + + @TestMetadata("inlineClasInSignatureNonNull.kt") + public void testInlineClasInSignatureNonNull() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignatureNonNull.kt"); + } + + @TestMetadata("inlineClasInSignatureNullable.kt") + public void testInlineClasInSignatureNullable() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignatureNullable.kt"); + } } @TestMetadata("compiler/testData/codegen/box/inlineClasses/jvm8DefaultInterfaceMethods") From dc11c2de7703f2788bd84c65b3299a51257cc639 Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Fri, 11 Dec 2020 12:24:41 +0100 Subject: [PATCH 620/698] IC Mangling: Use correct java field type if the type is inline class in JVM_IR BE. #KT-26445 --- .../jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt index fdb016e48b8..85819b6ae24 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt @@ -12,6 +12,7 @@ import org.jetbrains.kotlin.backend.jvm.JvmLoweredStatementOrigin import org.jetbrains.kotlin.backend.jvm.intrinsics.IrIntrinsicMethods import org.jetbrains.kotlin.backend.jvm.intrinsics.JavaClassProperty import org.jetbrains.kotlin.backend.jvm.ir.erasedUpperBound +import org.jetbrains.kotlin.backend.jvm.ir.isFromJava import org.jetbrains.kotlin.backend.jvm.lower.MultifileFacadeFileEntry import org.jetbrains.kotlin.backend.jvm.lower.constantValue import org.jetbrains.kotlin.backend.jvm.lower.inlineclasses.unboxInlineClass @@ -665,7 +666,8 @@ class ExpressionCodegen( ?: receiverType ?: typeMapper.mapClass(callee.parentAsClass) val ownerName = ownerType.internalName val fieldName = callee.name.asString() - val fieldType = callee.type.asmType + val calleeIrType = if (callee.isFromJava() && callee.type.isInlined()) callee.type.makeNullable() else callee.type + val fieldType = calleeIrType.asmType return if (expression is IrSetField) { val value = expression.value.accept(this, data) // We only initialize enum entries with a subtype of `fieldType` and can avoid the CHECKCAST. From b7330a9e141dc5c8eced57a05765b78ebc45b308 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Fri, 11 Dec 2020 15:41:02 +0300 Subject: [PATCH 621/698] JVM_IR KT-43877 fix generic signatures for SAM-converted lambdas --- .../ir/FirBlackBoxCodegenTestGenerated.java | 10 ++ .../jvm/lower/FunctionReferenceLowering.kt | 41 +++++++- .../ir/descriptors/IrBasedDescriptors.kt | 6 +- .../org/jetbrains/kotlin/ir/types/irTypes.kt | 6 ++ ...onversionToGenericInterfaceInGenericFun.kt | 17 ++++ .../box/ir/anonymousObjectInGenericFun.kt | 8 ++ .../anonymousObjectInGenericFun.kt | 18 ++++ .../anonymousObjectInGenericFun.txt | 19 ++++ .../sam/callableRefGenericFunInterface.kt | 12 +++ .../sam/callableRefGenericFunInterface.txt | 36 +++++++ .../sam/callableRefGenericFunInterface_ir.txt | 28 ++++++ .../sam/callableRefGenericSamInterface.kt | 18 ++++ .../sam/callableRefGenericSamInterface.txt | 26 +++++ .../sam/callableRefGenericSamInterface_ir.txt | 18 ++++ .../sam/callableRefSpecializedFunInterface.kt | 12 +++ .../callableRefSpecializedFunInterface.txt | 37 +++++++ .../callableRefSpecializedFunInterface_ir.txt | 29 ++++++ .../sam/callableRefSpecializedSamInterface.kt | 18 ++++ .../callableRefSpecializedSamInterface.txt | 27 +++++ .../callableRefSpecializedSamInterface_ir.txt | 19 ++++ .../sam/genericFunInterface.kt | 10 ++ .../sam/genericFunInterface.txt | 23 +++++ .../sam/genericFunInterface_ir.txt | 25 +++++ .../genericSamInterface.kt} | 2 +- .../genericSamInterface.txt} | 8 +- .../genericSamInterface_ir.txt} | 12 +-- .../sam/lambdaGenericFunInterface.kt | 10 ++ .../sam/lambdaGenericFunInterface.txt | 23 +++++ .../sam/lambdaGenericFunInterface_ir.txt | 23 +++++ .../sam/lambdaGenericSamInterface.kt | 22 +++++ .../sam/lambdaGenericSamInterface.txt | 28 ++++++ .../sam/lambdaGenericSamInterface_ir.txt | 28 ++++++ .../sam/lambdaSpecializedFunInterface.kt | 10 ++ .../sam/lambdaSpecializedFunInterface.txt | 24 +++++ .../sam/lambdaSpecializedFunInterface_ir.txt | 24 +++++ .../sam/lambdaSpecializedSamInterface.kt | 16 +++ .../sam/lambdaSpecializedSamInterface.txt | 17 ++++ .../sam/lambdaSpecializedSamInterface_ir.txt | 17 ++++ .../{ => sam}/samAdapterAndInlinedOne.kt | 0 .../{ => sam}/samAdapterAndInlinedOne.txt | 0 .../{ => sam}/samAdapterAndInlinedOne_ir.txt | 0 .../sam/specializedFunInterface.kt | 10 ++ .../sam/specializedFunInterface.txt | 23 +++++ .../sam/specializedFunInterface_ir.txt | 25 +++++ .../specializedSamInterface.kt} | 2 +- .../specializedSamInterface.txt} | 8 +- .../specializedSamInterface_ir.txt} | 12 +-- .../codegen/BlackBoxCodegenTestGenerated.java | 10 ++ .../codegen/BytecodeListingTestGenerated.java | 98 ++++++++++++++++--- .../LightAnalysisModeTestGenerated.java | 10 ++ .../ir/IrBlackBoxCodegenTestGenerated.java | 10 ++ .../ir/IrBytecodeListingTestGenerated.java | 98 ++++++++++++++++--- .../IrJsCodegenBoxES6TestGenerated.java | 10 ++ .../IrJsCodegenBoxTestGenerated.java | 10 ++ .../semantics/JsCodegenBoxTestGenerated.java | 10 ++ .../IrCodegenBoxWasmTestGenerated.java | 10 ++ 56 files changed, 1014 insertions(+), 59 deletions(-) create mode 100644 compiler/testData/codegen/box/funInterface/samConversionToGenericInterfaceInGenericFun.kt create mode 100644 compiler/testData/codegen/box/ir/anonymousObjectInGenericFun.kt create mode 100644 compiler/testData/codegen/bytecodeListing/anonymousObjectInGenericFun.kt create mode 100644 compiler/testData/codegen/bytecodeListing/anonymousObjectInGenericFun.txt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/callableRefGenericFunInterface.kt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/callableRefGenericFunInterface.txt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/callableRefGenericFunInterface_ir.txt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/callableRefGenericSamInterface.kt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/callableRefGenericSamInterface.txt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/callableRefGenericSamInterface_ir.txt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedFunInterface.kt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedFunInterface.txt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedFunInterface_ir.txt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedSamInterface.kt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedSamInterface.txt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedSamInterface_ir.txt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/genericFunInterface.kt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/genericFunInterface.txt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/genericFunInterface_ir.txt rename compiler/testData/codegen/bytecodeListing/{samGenericSuperinterface.kt => sam/genericSamInterface.kt} (85%) rename compiler/testData/codegen/bytecodeListing/{samGenericSuperinterface.txt => sam/genericSamInterface.txt} (69%) rename compiler/testData/codegen/bytecodeListing/{samGenericSuperinterface_ir.txt => sam/genericSamInterface_ir.txt} (60%) create mode 100644 compiler/testData/codegen/bytecodeListing/sam/lambdaGenericFunInterface.kt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/lambdaGenericFunInterface.txt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/lambdaGenericFunInterface_ir.txt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/lambdaGenericSamInterface.kt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/lambdaGenericSamInterface.txt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/lambdaGenericSamInterface_ir.txt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedFunInterface.kt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedFunInterface.txt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedFunInterface_ir.txt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedSamInterface.kt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedSamInterface.txt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedSamInterface_ir.txt rename compiler/testData/codegen/bytecodeListing/{ => sam}/samAdapterAndInlinedOne.kt (100%) rename compiler/testData/codegen/bytecodeListing/{ => sam}/samAdapterAndInlinedOne.txt (100%) rename compiler/testData/codegen/bytecodeListing/{ => sam}/samAdapterAndInlinedOne_ir.txt (100%) create mode 100644 compiler/testData/codegen/bytecodeListing/sam/specializedFunInterface.kt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/specializedFunInterface.txt create mode 100644 compiler/testData/codegen/bytecodeListing/sam/specializedFunInterface_ir.txt rename compiler/testData/codegen/bytecodeListing/{samSpecializedGenericSuperinterface.kt => sam/specializedSamInterface.kt} (85%) rename compiler/testData/codegen/bytecodeListing/{samSpecializedGenericSuperinterface.txt => sam/specializedSamInterface.txt} (69%) rename compiler/testData/codegen/bytecodeListing/{samSpecializedGenericSuperinterface_ir.txt => sam/specializedSamInterface_ir.txt} (60%) diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 95a931926c1..4ae34240eab 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -12178,6 +12178,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/funInterface/samConstructorExplicitInvocation.kt"); } + @TestMetadata("samConversionToGenericInterfaceInGenericFun.kt") + public void testSamConversionToGenericInterfaceInGenericFun() throws Exception { + runTest("compiler/testData/codegen/box/funInterface/samConversionToGenericInterfaceInGenericFun.kt"); + } + @TestMetadata("subtypeOfFunctionalTypeToFunInterfaceConversion.kt") public void testSubtypeOfFunctionalTypeToFunInterfaceConversion() throws Exception { runTest("compiler/testData/codegen/box/funInterface/subtypeOfFunctionalTypeToFunInterfaceConversion.kt"); @@ -15922,6 +15927,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/ir/anonymousObjectInForLoopIteratorAndBody.kt"); } + @TestMetadata("anonymousObjectInGenericFun.kt") + public void testAnonymousObjectInGenericFun() throws Exception { + runTest("compiler/testData/codegen/box/ir/anonymousObjectInGenericFun.kt"); + } + @TestMetadata("anonymousObjectInsideElvis.kt") public void testAnonymousObjectInsideElvis() throws Exception { runTest("compiler/testData/codegen/box/ir/anonymousObjectInsideElvis.kt"); diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionReferenceLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionReferenceLowering.kt index 9ca3ff6074c..88f30ab34a9 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionReferenceLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionReferenceLowering.kt @@ -159,8 +159,8 @@ internal class FunctionReferenceLowering(private val context: JvmBackendContext) private val adaptedReferenceOriginalTarget: IrFunction? = adapteeCall?.symbol?.owner private val isAdaptedReference = adaptedReferenceOriginalTarget != null - private val isKotlinFunInterface = - samSuperType != null && samSuperType.getClass()?.origin != IrDeclarationOrigin.IR_EXTERNAL_JAVA_DECLARATION_STUB + private val samInterface = samSuperType?.getClass() + private val isKotlinFunInterface = samInterface != null && !samInterface.isFromJava() private val needToGenerateSamEqualsHashCodeMethods = isKotlinFunInterface && (isAdaptedReference || !isLambda) @@ -196,6 +196,14 @@ internal class FunctionReferenceLowering(private val context: JvmBackendContext) context.ir.symbols.functionAdapter.defaultType else null, ) + if (samInterface != null && origin == JvmLoweredDeclarationOrigin.LAMBDA_IMPL) { + // Old back-end generates formal type parameters as in SAM supertype. + // Here we create formal type parameters with same names and equivalent upper bounds. + // We don't really perform any type substitutions within class body + // (it's all fine as soon as we have required generic signatures and don't fail anywhere). + // NB this would no longer matter if we generate SAM wrapper classes as synthetic. + typeParameters = createFakeFormalTypeParameters(samInterface.typeParameters, this) + } createImplicitParameterDeclarationWithWrappedDescriptor() copyAttributes(irFunctionReference) if (isLambda) { @@ -203,6 +211,24 @@ internal class FunctionReferenceLowering(private val context: JvmBackendContext) } } + private fun createFakeFormalTypeParameters(sourceTypeParameters: List, irClass: IrClass): List { + if (sourceTypeParameters.isEmpty()) return emptyList() + + val fakeTypeParameters = sourceTypeParameters.map { + buildTypeParameter(irClass) { + updateFrom(it) + name = it.name + } + } + val typeRemapper = IrTypeParameterRemapper(sourceTypeParameters.associateWith { fakeTypeParameters[it.index] }) + for (fakeTypeParameter in fakeTypeParameters) { + val sourceTypeParameter = sourceTypeParameters[fakeTypeParameter.index] + fakeTypeParameter.superTypes = sourceTypeParameter.superTypes.map { typeRemapper.remapType(it) } + } + + return fakeTypeParameters + } + private val receiverField = context.ir.symbols.functionReferenceReceiverField.owner fun build(): IrExpression = context.createJvmIrBuilder(currentScope!!.scope.scopeOwnerSymbol).run { @@ -390,7 +416,11 @@ internal class FunctionReferenceLowering(private val context: JvmBackendContext) isSuspend = callee.isSuspend }.apply { overriddenSymbols += superMethod - dispatchReceiverParameter = parentAsClass.thisReceiver!!.copyTo(this) + dispatchReceiverParameter = buildReceiverParameter( + this, + IrDeclarationOrigin.INSTANCE_RECEIVER, + functionReferenceClass.symbol.defaultType + ) if (isLambda) createLambdaInvokeMethod() else createFunctionReferenceInvokeMethod(receiverVar) } @@ -427,8 +457,9 @@ internal class FunctionReferenceLowering(private val context: JvmBackendContext) // will put it into a field. if (samSuperType == null) irImplicitCast( - irGetField(irGet(dispatchReceiverParameter!!), - this@FunctionReferenceBuilder.receiverField + irGetField( + irGet(dispatchReceiverParameter!!), + this@FunctionReferenceBuilder.receiverField ), boundReceiver.second.type ) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrBasedDescriptors.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrBasedDescriptors.kt index 7eda3131c75..0fc45178264 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrBasedDescriptors.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrBasedDescriptors.kt @@ -1075,11 +1075,13 @@ private fun makeKotlinType( classDescriptor.defaultType.replace(newArguments = kotlinTypeArguments).makeNullableAsSpecified(hasQuestionMark) } catch (e: Throwable) { throw RuntimeException( - "Classifier: $classDescriptor\n" + + "Classifier: ${classifier.owner.render()}\n" + "Type parameters:\n" + classDescriptor.defaultType.constructor.parameters.withIndex() .joinToString(separator = "\n") { - "${it.index}: ${(it.value as IrBasedTypeParameterDescriptor).owner.render()}" + val irTypeParameter = (it.value as IrBasedTypeParameterDescriptor).owner + "${it.index}: ${irTypeParameter.render()} " + + "of ${irTypeParameter.parent.render()}" } + "\nType arguments:\n" + arguments.withIndex() diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/irTypes.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/irTypes.kt index 00c2732e0cf..a7427edd14b 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/irTypes.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/irTypes.kt @@ -18,8 +18,10 @@ import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol import org.jetbrains.kotlin.ir.types.impl.* import org.jetbrains.kotlin.ir.util.defaultType import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable +import org.jetbrains.kotlin.ir.util.isAnonymousObject import org.jetbrains.kotlin.ir.util.isPropertyAccessor import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.SpecialNames import org.jetbrains.kotlin.types.* import org.jetbrains.kotlin.types.typeUtil.makeNotNullable import org.jetbrains.kotlin.types.typeUtil.makeNullable @@ -177,6 +179,10 @@ val IrClass.typeConstructorParameters: Sequence // Ideally this should be fixed in FE. null } + current.isAnonymousObject -> { + // Anonymous classes don't capture type parameters. + null + } parent is IrClass && current is IrClass && !current.isInner -> null else -> diff --git a/compiler/testData/codegen/box/funInterface/samConversionToGenericInterfaceInGenericFun.kt b/compiler/testData/codegen/box/funInterface/samConversionToGenericInterfaceInGenericFun.kt new file mode 100644 index 00000000000..4d07619d049 --- /dev/null +++ b/compiler/testData/codegen/box/funInterface/samConversionToGenericInterfaceInGenericFun.kt @@ -0,0 +1,17 @@ +fun interface FunIFace { + fun call(ic: T): R +} + +fun bar(value: T, f: FunIFace): R { + return f.call(value) +} + +class X(val value: Any) + +fun gfn(a: X): T = + bar(a) { + it.value as T + } + +fun box() = + gfn(X("OK")) \ No newline at end of file diff --git a/compiler/testData/codegen/box/ir/anonymousObjectInGenericFun.kt b/compiler/testData/codegen/box/ir/anonymousObjectInGenericFun.kt new file mode 100644 index 00000000000..4a8d1cbd019 --- /dev/null +++ b/compiler/testData/codegen/box/ir/anonymousObjectInGenericFun.kt @@ -0,0 +1,8 @@ +fun test(): String { + val x = object { + fun foo() = "OK" + } + return x.foo() +} + +fun box() = test() \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/anonymousObjectInGenericFun.kt b/compiler/testData/codegen/bytecodeListing/anonymousObjectInGenericFun.kt new file mode 100644 index 00000000000..b7284b04c99 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/anonymousObjectInGenericFun.kt @@ -0,0 +1,18 @@ +// WITH_SIGNATURES + +fun test() { + val x = object { + fun foo() {} + + fun S2.ext() {} + + val S3.extVal + get() = 1 + + var S4.extVar + get() = 1 + set(value) {} + } + + x.foo() +} diff --git a/compiler/testData/codegen/bytecodeListing/anonymousObjectInGenericFun.txt b/compiler/testData/codegen/bytecodeListing/anonymousObjectInGenericFun.txt new file mode 100644 index 00000000000..d5bfd636f73 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/anonymousObjectInGenericFun.txt @@ -0,0 +1,19 @@ +@kotlin.Metadata +public final class AnonymousObjectInGenericFunKt$test$x$1 { + // source: 'anonymousObjectInGenericFun.kt' + public final <()V> method foo(): void + public final <(TS2;)V> method ext(p0: java.lang.Object): void + public final <(TS3;)I> method getExtVal(p0: java.lang.Object): int + public final <(TS4;)I> method getExtVar(p0: java.lang.Object): int + public final <(TS4;I)V> method setExtVar(p0: java.lang.Object, p1: int): void + method (): void + enclosing method AnonymousObjectInGenericFunKt.test()V + inner (anonymous) class AnonymousObjectInGenericFunKt$test$x$1 +} + +@kotlin.Metadata +public final class AnonymousObjectInGenericFunKt { + // source: 'anonymousObjectInGenericFun.kt' + public final static <()V> method test(): void + inner (anonymous) class AnonymousObjectInGenericFunKt$test$x$1 +} diff --git a/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericFunInterface.kt b/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericFunInterface.kt new file mode 100644 index 00000000000..5686fc2bcb1 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericFunInterface.kt @@ -0,0 +1,12 @@ +// WITH_SIGNATURES +// FILE: t.kt + +fun interface Sam { + fun get(): T +} + +fun expectsSam(sam: Sam) = sam.get() + +fun foo(): T = null!! + +fun genericSam(): T = expectsSam(::foo) diff --git a/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericFunInterface.txt b/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericFunInterface.txt new file mode 100644 index 00000000000..1206f0318fa --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericFunInterface.txt @@ -0,0 +1,36 @@ +@kotlin.Metadata +public interface<Ljava/lang/Object;> Sam { + // source: 't.kt' + public abstract <()TT;> method get(): java.lang.Object +} + +@kotlin.Metadata +synthetic final class;> TKt$genericSam$1 { + // source: 't.kt' + public final <()TT;> method invoke(): java.lang.Object + static method (): void + method (): void + enclosing method TKt.genericSam()Ljava/lang/Object; + public final static field INSTANCE: TKt$genericSam$1 + inner (anonymous) class TKt$genericSam$1 +} + +@kotlin.Metadata +final class TKt$sam$Sam$0 { + // source: 't.kt' + method (p0: kotlin.jvm.functions.Function0): void + public method equals(p0: java.lang.Object): boolean + public synthetic final method get(): java.lang.Object + public method getFunctionDelegate(): kotlin.Function + public method hashCode(): int + private synthetic final field function: kotlin.jvm.functions.Function0 +} + +@kotlin.Metadata +public final class TKt { + // source: 't.kt' + public final static <()TT;> method foo(): java.lang.Object + public final static <()TT;> method genericSam(): java.lang.Object + public final static <(LSam;)TT;> method expectsSam(@org.jetbrains.annotations.NotNull p0: Sam): java.lang.Object + inner (anonymous) class TKt$genericSam$1 +} diff --git a/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericFunInterface_ir.txt b/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericFunInterface_ir.txt new file mode 100644 index 00000000000..810a0867f21 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericFunInterface_ir.txt @@ -0,0 +1,28 @@ +@kotlin.Metadata +public interface<Ljava/lang/Object;> Sam { + // source: 't.kt' + public abstract <()TT;> method get(): java.lang.Object +} + +@kotlin.Metadata +synthetic final class;Lkotlin/jvm/internal/FunctionAdapter;> TKt$genericSam$1 { + // source: 't.kt' + public final @org.jetbrains.annotations.NotNull <()Lkotlin/Function<*>;> method getFunctionDelegate(): kotlin.Function + public final <()TT;> method get(): java.lang.Object + static method (): void + method (): void + public final method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean + public final method hashCode(): int + enclosing method TKt.genericSam()Ljava/lang/Object; + public final static field INSTANCE: TKt$genericSam$1 + inner (anonymous) class TKt$genericSam$1 +} + +@kotlin.Metadata +public final class TKt { + // source: 't.kt' + public final static <()TT;> method foo(): java.lang.Object + public final static <()TT;> method genericSam(): java.lang.Object + public final static <(LSam;)TT;> method expectsSam(@org.jetbrains.annotations.NotNull p0: Sam): java.lang.Object + inner (anonymous) class TKt$genericSam$1 +} diff --git a/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericSamInterface.kt b/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericSamInterface.kt new file mode 100644 index 00000000000..0e255f086a2 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericSamInterface.kt @@ -0,0 +1,18 @@ +// WITH_SIGNATURES +// FILE: t.kt + +fun foo(): T = null!! + +fun genericSam(): T = J.g(::foo) + +// FILE: J.java +public class J { + static T g(Sam s) { + return s.get(); + } +} + +// FILE: Sam.java +public interface Sam { + T get(); +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericSamInterface.txt b/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericSamInterface.txt new file mode 100644 index 00000000000..84937e9c843 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericSamInterface.txt @@ -0,0 +1,26 @@ +@kotlin.Metadata +synthetic final class;> TKt$genericSam$1 { + // source: 't.kt' + public final <()TT;> method invoke(): java.lang.Object + static method (): void + method (): void + enclosing method TKt.genericSam()Ljava/lang/Object; + public final static field INSTANCE: TKt$genericSam$1 + inner (anonymous) class TKt$genericSam$1 +} + +@kotlin.Metadata +final class TKt$sam$Sam$0 { + // source: 't.kt' + method (p0: kotlin.jvm.functions.Function0): void + public synthetic final method get(): java.lang.Object + private synthetic final field function: kotlin.jvm.functions.Function0 +} + +@kotlin.Metadata +public final class TKt { + // source: 't.kt' + public final static <()TT;> method foo(): java.lang.Object + public final static <()TT;> method genericSam(): java.lang.Object + inner (anonymous) class TKt$genericSam$1 +} diff --git a/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericSamInterface_ir.txt b/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericSamInterface_ir.txt new file mode 100644 index 00000000000..74131c30203 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericSamInterface_ir.txt @@ -0,0 +1,18 @@ +@kotlin.Metadata +synthetic final class;> TKt$genericSam$1 { + // source: 't.kt' + public final <()TT;> method get(): java.lang.Object + static method (): void + method (): void + enclosing method TKt.genericSam()Ljava/lang/Object; + public final static field INSTANCE: TKt$genericSam$1 + inner (anonymous) class TKt$genericSam$1 +} + +@kotlin.Metadata +public final class TKt { + // source: 't.kt' + public final static <()TT;> method foo(): java.lang.Object + public final static <()TT;> method genericSam(): java.lang.Object + inner (anonymous) class TKt$genericSam$1 +} diff --git a/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedFunInterface.kt b/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedFunInterface.kt new file mode 100644 index 00000000000..163b33e639e --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedFunInterface.kt @@ -0,0 +1,12 @@ +// WITH_SIGNATURES +// FILE: t.kt + +fun interface Sam { + fun get(): T +} + +fun expectsSam(sam: Sam) = sam.get() + +fun foo(): String = "" + +fun specializedSam(): String = expectsSam(::foo) diff --git a/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedFunInterface.txt b/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedFunInterface.txt new file mode 100644 index 00000000000..9a609621556 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedFunInterface.txt @@ -0,0 +1,37 @@ +@kotlin.Metadata +public interface<Ljava/lang/Object;> Sam { + // source: 't.kt' + public abstract <()TT;> method get(): java.lang.Object +} + +@kotlin.Metadata +final class TKt$sam$Sam$0 { + // source: 't.kt' + method (p0: kotlin.jvm.functions.Function0): void + public method equals(p0: java.lang.Object): boolean + public synthetic final method get(): java.lang.Object + public method getFunctionDelegate(): kotlin.Function + public method hashCode(): int + private synthetic final field function: kotlin.jvm.functions.Function0 +} + +@kotlin.Metadata +synthetic final class;> TKt$specializedSam$1 { + // source: 't.kt' + static method (): void + method (): void + public synthetic bridge method invoke(): java.lang.Object + public final @org.jetbrains.annotations.NotNull method invoke(): java.lang.String + enclosing method TKt.specializedSam()Ljava/lang/String; + public final static field INSTANCE: TKt$specializedSam$1 + inner (anonymous) class TKt$specializedSam$1 +} + +@kotlin.Metadata +public final class TKt { + // source: 't.kt' + public final static <(LSam;)TT;> method expectsSam(@org.jetbrains.annotations.NotNull p0: Sam): java.lang.Object + public final static @org.jetbrains.annotations.NotNull method foo(): java.lang.String + public final static @org.jetbrains.annotations.NotNull method specializedSam(): java.lang.String + inner (anonymous) class TKt$specializedSam$1 +} diff --git a/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedFunInterface_ir.txt b/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedFunInterface_ir.txt new file mode 100644 index 00000000000..5fc30d13306 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedFunInterface_ir.txt @@ -0,0 +1,29 @@ +@kotlin.Metadata +public interface<Ljava/lang/Object;> Sam { + // source: 't.kt' + public abstract <()TT;> method get(): java.lang.Object +} + +@kotlin.Metadata +synthetic final class;Lkotlin/jvm/internal/FunctionAdapter;> TKt$specializedSam$1 { + // source: 't.kt' + public final @org.jetbrains.annotations.NotNull <()Lkotlin/Function<*>;> method getFunctionDelegate(): kotlin.Function + static method (): void + method (): void + public final method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean + public synthetic bridge method get(): java.lang.Object + public final @org.jetbrains.annotations.NotNull method get(): java.lang.String + public final method hashCode(): int + enclosing method TKt.specializedSam()Ljava/lang/String; + public final static field INSTANCE: TKt$specializedSam$1 + inner (anonymous) class TKt$specializedSam$1 +} + +@kotlin.Metadata +public final class TKt { + // source: 't.kt' + public final static <(LSam;)TT;> method expectsSam(@org.jetbrains.annotations.NotNull p0: Sam): java.lang.Object + public final static @org.jetbrains.annotations.NotNull method foo(): java.lang.String + public final static @org.jetbrains.annotations.NotNull method specializedSam(): java.lang.String + inner (anonymous) class TKt$specializedSam$1 +} diff --git a/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedSamInterface.kt b/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedSamInterface.kt new file mode 100644 index 00000000000..d403207631f --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedSamInterface.kt @@ -0,0 +1,18 @@ +// WITH_SIGNATURES +// FILE: t.kt + +fun foo(): String = "" + +fun specializedSam(): String = J.g(::foo) + +// FILE: J.java +public class J { + static T g(Sam s) { + return s.get(); + } +} + +// FILE: Sam.java +public interface Sam { + T get(); +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedSamInterface.txt b/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedSamInterface.txt new file mode 100644 index 00000000000..9bd3589ccdd --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedSamInterface.txt @@ -0,0 +1,27 @@ +@kotlin.Metadata +final class TKt$sam$Sam$0 { + // source: 't.kt' + method (p0: kotlin.jvm.functions.Function0): void + public synthetic final method get(): java.lang.Object + private synthetic final field function: kotlin.jvm.functions.Function0 +} + +@kotlin.Metadata +synthetic final class;> TKt$specializedSam$1 { + // source: 't.kt' + static method (): void + method (): void + public synthetic bridge method invoke(): java.lang.Object + public final @org.jetbrains.annotations.NotNull method invoke(): java.lang.String + enclosing method TKt.specializedSam()Ljava/lang/String; + public final static field INSTANCE: TKt$specializedSam$1 + inner (anonymous) class TKt$specializedSam$1 +} + +@kotlin.Metadata +public final class TKt { + // source: 't.kt' + public final static @org.jetbrains.annotations.NotNull method foo(): java.lang.String + public final static @org.jetbrains.annotations.NotNull method specializedSam(): java.lang.String + inner (anonymous) class TKt$specializedSam$1 +} diff --git a/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedSamInterface_ir.txt b/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedSamInterface_ir.txt new file mode 100644 index 00000000000..b8aa2e40aec --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedSamInterface_ir.txt @@ -0,0 +1,19 @@ +@kotlin.Metadata +synthetic final class;> TKt$specializedSam$1 { + // source: 't.kt' + static method (): void + method (): void + public synthetic bridge method get(): java.lang.Object + public final @org.jetbrains.annotations.NotNull method get(): java.lang.String + enclosing method TKt.specializedSam()Ljava/lang/String; + public final static field INSTANCE: TKt$specializedSam$1 + inner (anonymous) class TKt$specializedSam$1 +} + +@kotlin.Metadata +public final class TKt { + // source: 't.kt' + public final static @org.jetbrains.annotations.NotNull method foo(): java.lang.String + public final static @org.jetbrains.annotations.NotNull method specializedSam(): java.lang.String + inner (anonymous) class TKt$specializedSam$1 +} diff --git a/compiler/testData/codegen/bytecodeListing/sam/genericFunInterface.kt b/compiler/testData/codegen/bytecodeListing/sam/genericFunInterface.kt new file mode 100644 index 00000000000..f41de2181c4 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/genericFunInterface.kt @@ -0,0 +1,10 @@ +// WITH_SIGNATURES +// FILE: t.kt + +fun interface Sam { + fun get(): T +} + +fun expectsSam(sam: Sam) = sam.get() + +fun genericSam(f: () -> T): T = expectsSam(f) diff --git a/compiler/testData/codegen/bytecodeListing/sam/genericFunInterface.txt b/compiler/testData/codegen/bytecodeListing/sam/genericFunInterface.txt new file mode 100644 index 00000000000..af2dd62d6a2 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/genericFunInterface.txt @@ -0,0 +1,23 @@ +@kotlin.Metadata +public interface<Ljava/lang/Object;> Sam { + // source: 't.kt' + public abstract <()TT;> method get(): java.lang.Object +} + +@kotlin.Metadata +final class TKt$sam$Sam$0 { + // source: 't.kt' + method (p0: kotlin.jvm.functions.Function0): void + public method equals(p0: java.lang.Object): boolean + public synthetic final method get(): java.lang.Object + public method getFunctionDelegate(): kotlin.Function + public method hashCode(): int + private synthetic final field function: kotlin.jvm.functions.Function0 +} + +@kotlin.Metadata +public final class TKt { + // source: 't.kt' + public final static <(LSam;)TT;> method expectsSam(@org.jetbrains.annotations.NotNull p0: Sam): java.lang.Object + public final static <(Lkotlin/jvm/functions/Function0<+TT;>;)TT;> method genericSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Object +} diff --git a/compiler/testData/codegen/bytecodeListing/sam/genericFunInterface_ir.txt b/compiler/testData/codegen/bytecodeListing/sam/genericFunInterface_ir.txt new file mode 100644 index 00000000000..82459ca38ac --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/genericFunInterface_ir.txt @@ -0,0 +1,25 @@ +@kotlin.Metadata +public interface<Ljava/lang/Object;> Sam { + // source: 't.kt' + public abstract <()TT;> method get(): java.lang.Object +} + +@kotlin.Metadata +final class TKt$sam$Sam$0 { + // source: 't.kt' + public final @org.jetbrains.annotations.NotNull <()Lkotlin/Function<*>;> method getFunctionDelegate(): kotlin.Function + method (@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): void + public final method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean + public synthetic final method get(): java.lang.Object + public final method hashCode(): int + private synthetic final field function: kotlin.jvm.functions.Function0 + final inner class TKt$sam$Sam$0 +} + +@kotlin.Metadata +public final class TKt { + // source: 't.kt' + public final static <(LSam;)TT;> method expectsSam(@org.jetbrains.annotations.NotNull p0: Sam): java.lang.Object + public final static <(Lkotlin/jvm/functions/Function0<+TT;>;)TT;> method genericSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Object + final inner class TKt$sam$Sam$0 +} diff --git a/compiler/testData/codegen/bytecodeListing/samGenericSuperinterface.kt b/compiler/testData/codegen/bytecodeListing/sam/genericSamInterface.kt similarity index 85% rename from compiler/testData/codegen/bytecodeListing/samGenericSuperinterface.kt rename to compiler/testData/codegen/bytecodeListing/sam/genericSamInterface.kt index e62679359f9..edbb878fe04 100644 --- a/compiler/testData/codegen/bytecodeListing/samGenericSuperinterface.kt +++ b/compiler/testData/codegen/bytecodeListing/sam/genericSamInterface.kt @@ -1,5 +1,5 @@ // WITH_SIGNATURES -// FILE: samGenericSuperinterface.kt +// FILE: t.kt fun genericSam(f: () -> T): T = J.g(f) diff --git a/compiler/testData/codegen/bytecodeListing/samGenericSuperinterface.txt b/compiler/testData/codegen/bytecodeListing/sam/genericSamInterface.txt similarity index 69% rename from compiler/testData/codegen/bytecodeListing/samGenericSuperinterface.txt rename to compiler/testData/codegen/bytecodeListing/sam/genericSamInterface.txt index 95f7782207e..febf11f0f65 100644 --- a/compiler/testData/codegen/bytecodeListing/samGenericSuperinterface.txt +++ b/compiler/testData/codegen/bytecodeListing/sam/genericSamInterface.txt @@ -1,13 +1,13 @@ @kotlin.Metadata -final class SamGenericSuperinterfaceKt$sam$Sam$0 { - // source: 'samGenericSuperinterface.kt' +final class TKt$sam$Sam$0 { + // source: 't.kt' method (p0: kotlin.jvm.functions.Function0): void public synthetic final method get(): java.lang.Object private synthetic final field function: kotlin.jvm.functions.Function0 } @kotlin.Metadata -public final class SamGenericSuperinterfaceKt { - // source: 'samGenericSuperinterface.kt' +public final class TKt { + // source: 't.kt' public final static <(Lkotlin/jvm/functions/Function0<+TT;>;)TT;> method genericSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Object } diff --git a/compiler/testData/codegen/bytecodeListing/samGenericSuperinterface_ir.txt b/compiler/testData/codegen/bytecodeListing/sam/genericSamInterface_ir.txt similarity index 60% rename from compiler/testData/codegen/bytecodeListing/samGenericSuperinterface_ir.txt rename to compiler/testData/codegen/bytecodeListing/sam/genericSamInterface_ir.txt index 96e17793796..8d415343607 100644 --- a/compiler/testData/codegen/bytecodeListing/samGenericSuperinterface_ir.txt +++ b/compiler/testData/codegen/bytecodeListing/sam/genericSamInterface_ir.txt @@ -1,15 +1,15 @@ @kotlin.Metadata -final class SamGenericSuperinterfaceKt$sam$Sam$0 { - // source: 'samGenericSuperinterface.kt' +final class TKt$sam$Sam$0 { + // source: 't.kt' method (@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): void public synthetic final method get(): java.lang.Object private synthetic final field function: kotlin.jvm.functions.Function0 - final inner class SamGenericSuperinterfaceKt$sam$Sam$0 + final inner class TKt$sam$Sam$0 } @kotlin.Metadata -public final class SamGenericSuperinterfaceKt { - // source: 'samGenericSuperinterface.kt' +public final class TKt { + // source: 't.kt' public final static <(Lkotlin/jvm/functions/Function0<+TT;>;)TT;> method genericSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Object - final inner class SamGenericSuperinterfaceKt$sam$Sam$0 + final inner class TKt$sam$Sam$0 } diff --git a/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericFunInterface.kt b/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericFunInterface.kt new file mode 100644 index 00000000000..e06a76011af --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericFunInterface.kt @@ -0,0 +1,10 @@ +// WITH_SIGNATURES +// FILE: t.kt + +fun interface Sam { + fun get(): T +} + +fun expectsSam(sam: Sam) = sam.get() + +fun genericSamGet(f: () -> T): T = expectsSam({ f() }) diff --git a/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericFunInterface.txt b/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericFunInterface.txt new file mode 100644 index 00000000000..7be23801bfd --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericFunInterface.txt @@ -0,0 +1,23 @@ +@kotlin.Metadata +public interface<Ljava/lang/Object;> Sam { + // source: 't.kt' + public abstract <()TT;> method get(): java.lang.Object +} + +@kotlin.Metadata +final class<Ljava/lang/Object;LSam;> TKt$genericSamGet$1 { + // source: 't.kt' + public final <()TT;> method get(): java.lang.Object + method (p0: kotlin.jvm.functions.Function0): void + enclosing method TKt.genericSamGet(Lkotlin/jvm/functions/Function0;)Ljava/lang/Object; + synthetic final field $f: kotlin.jvm.functions.Function0 + inner (anonymous) class TKt$genericSamGet$1 +} + +@kotlin.Metadata +public final class TKt { + // source: 't.kt' + public final static <(LSam;)TT;> method expectsSam(@org.jetbrains.annotations.NotNull p0: Sam): java.lang.Object + public final static <(Lkotlin/jvm/functions/Function0<+TT;>;)TT;> method genericSamGet(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Object + inner (anonymous) class TKt$genericSamGet$1 +} diff --git a/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericFunInterface_ir.txt b/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericFunInterface_ir.txt new file mode 100644 index 00000000000..58ebc83375c --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericFunInterface_ir.txt @@ -0,0 +1,23 @@ +@kotlin.Metadata +public interface<Ljava/lang/Object;> Sam { + // source: 't.kt' + public abstract <()TT;> method get(): java.lang.Object +} + +@kotlin.Metadata +final class<Ljava/lang/Object;LSam;> TKt$genericSamGet$1 { + // source: 't.kt' + public final <()TT;> method get(): java.lang.Object + <(Lkotlin/jvm/functions/Function0<+TT;>;)V> method (p0: kotlin.jvm.functions.Function0): void + enclosing method TKt.genericSamGet(Lkotlin/jvm/functions/Function0;)Ljava/lang/Object; + synthetic final field ;> $f: kotlin.jvm.functions.Function0 + inner (anonymous) class TKt$genericSamGet$1 +} + +@kotlin.Metadata +public final class TKt { + // source: 't.kt' + public final static <(LSam;)TT;> method expectsSam(@org.jetbrains.annotations.NotNull p0: Sam): java.lang.Object + public final static <(Lkotlin/jvm/functions/Function0<+TT;>;)TT;> method genericSamGet(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Object + inner (anonymous) class TKt$genericSamGet$1 +} diff --git a/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericSamInterface.kt b/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericSamInterface.kt new file mode 100644 index 00000000000..9720eeec38e --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericSamInterface.kt @@ -0,0 +1,22 @@ +// WITH_SIGNATURES +// FILE: t.kt + +fun genericSam(f: () -> T): Sam = J.sam({ f() }) + +fun genericSamGet(f: () -> T): T = J.get({ f() }) + +// FILE: J.java +public class J { + static T get(Sam s) { + return s.get(); + } + + static Sam sam(Sam s) { + return s; + } +} + +// FILE: Sam.java +public interface Sam { + T get(); +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericSamInterface.txt b/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericSamInterface.txt new file mode 100644 index 00000000000..76f84e30b1c --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericSamInterface.txt @@ -0,0 +1,28 @@ +@kotlin.Metadata +final class<Ljava/lang/Object;LSam;> TKt$genericSam$1 { + // source: 't.kt' + public final <()TT;> method get(): java.lang.Object + method (p0: kotlin.jvm.functions.Function0): void + enclosing method TKt.genericSam(Lkotlin/jvm/functions/Function0;)LSam; + synthetic final field $f: kotlin.jvm.functions.Function0 + inner (anonymous) class TKt$genericSam$1 +} + +@kotlin.Metadata +final class<Ljava/lang/Object;LSam;> TKt$genericSamGet$1 { + // source: 't.kt' + public final <()TT;> method get(): java.lang.Object + method (p0: kotlin.jvm.functions.Function0): void + enclosing method TKt.genericSamGet(Lkotlin/jvm/functions/Function0;)Ljava/lang/Object; + synthetic final field $f: kotlin.jvm.functions.Function0 + inner (anonymous) class TKt$genericSamGet$1 +} + +@kotlin.Metadata +public final class TKt { + // source: 't.kt' + public final static @org.jetbrains.annotations.NotNull <(Lkotlin/jvm/functions/Function0<+TT;>;)LSam;> method genericSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): Sam + public final static <(Lkotlin/jvm/functions/Function0<+TT;>;)TT;> method genericSamGet(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Object + inner (anonymous) class TKt$genericSam$1 + inner (anonymous) class TKt$genericSamGet$1 +} diff --git a/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericSamInterface_ir.txt b/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericSamInterface_ir.txt new file mode 100644 index 00000000000..023cc600dfa --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericSamInterface_ir.txt @@ -0,0 +1,28 @@ +@kotlin.Metadata +final class<Ljava/lang/Object;LSam;> TKt$genericSam$1 { + // source: 't.kt' + public final <()TT;> method get(): java.lang.Object + <(Lkotlin/jvm/functions/Function0<+TT;>;)V> method (p0: kotlin.jvm.functions.Function0): void + enclosing method TKt.genericSam(Lkotlin/jvm/functions/Function0;)LSam; + synthetic final field ;> $f: kotlin.jvm.functions.Function0 + inner (anonymous) class TKt$genericSam$1 +} + +@kotlin.Metadata +final class<Ljava/lang/Object;LSam;> TKt$genericSamGet$1 { + // source: 't.kt' + public final <()TT;> method get(): java.lang.Object + <(Lkotlin/jvm/functions/Function0<+TT;>;)V> method (p0: kotlin.jvm.functions.Function0): void + enclosing method TKt.genericSamGet(Lkotlin/jvm/functions/Function0;)Ljava/lang/Object; + synthetic final field ;> $f: kotlin.jvm.functions.Function0 + inner (anonymous) class TKt$genericSamGet$1 +} + +@kotlin.Metadata +public final class TKt { + // source: 't.kt' + public final static @org.jetbrains.annotations.NotNull <(Lkotlin/jvm/functions/Function0<+TT;>;)LSam;> method genericSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): Sam + public final static <(Lkotlin/jvm/functions/Function0<+TT;>;)TT;> method genericSamGet(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Object + inner (anonymous) class TKt$genericSam$1 + inner (anonymous) class TKt$genericSamGet$1 +} diff --git a/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedFunInterface.kt b/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedFunInterface.kt new file mode 100644 index 00000000000..7e4453b74d6 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedFunInterface.kt @@ -0,0 +1,10 @@ +// WITH_SIGNATURES +// FILE: t.kt + +fun interface Sam { + fun get(): T +} + +fun expectsSam(sam: Sam) = sam.get() + +fun specializedSam(f: () -> String) = expectsSam({ f() }) diff --git a/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedFunInterface.txt b/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedFunInterface.txt new file mode 100644 index 00000000000..f2ab0e8776b --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedFunInterface.txt @@ -0,0 +1,24 @@ +@kotlin.Metadata +public interface<Ljava/lang/Object;> Sam { + // source: 't.kt' + public abstract <()TT;> method get(): java.lang.Object +} + +@kotlin.Metadata +final class<Ljava/lang/Object;LSam;> TKt$specializedSam$1 { + // source: 't.kt' + method (p0: kotlin.jvm.functions.Function0): void + public synthetic bridge method get(): java.lang.Object + public final @org.jetbrains.annotations.NotNull method get(): java.lang.String + enclosing method TKt.specializedSam(Lkotlin/jvm/functions/Function0;)Ljava/lang/String; + synthetic final field $f: kotlin.jvm.functions.Function0 + inner (anonymous) class TKt$specializedSam$1 +} + +@kotlin.Metadata +public final class TKt { + // source: 't.kt' + public final static @org.jetbrains.annotations.NotNull <(Lkotlin/jvm/functions/Function0;)Ljava/lang/String;> method specializedSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.String + public final static <(LSam;)TT;> method expectsSam(@org.jetbrains.annotations.NotNull p0: Sam): java.lang.Object + inner (anonymous) class TKt$specializedSam$1 +} diff --git a/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedFunInterface_ir.txt b/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedFunInterface_ir.txt new file mode 100644 index 00000000000..8020d43de86 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedFunInterface_ir.txt @@ -0,0 +1,24 @@ +@kotlin.Metadata +public interface<Ljava/lang/Object;> Sam { + // source: 't.kt' + public abstract <()TT;> method get(): java.lang.Object +} + +@kotlin.Metadata +final class<Ljava/lang/Object;LSam;> TKt$specializedSam$1 { + // source: 't.kt' + <(Lkotlin/jvm/functions/Function0;)V> method (p0: kotlin.jvm.functions.Function0): void + public synthetic bridge method get(): java.lang.Object + public final @org.jetbrains.annotations.NotNull method get(): java.lang.String + enclosing method TKt.specializedSam(Lkotlin/jvm/functions/Function0;)Ljava/lang/String; + synthetic final field ;> $f: kotlin.jvm.functions.Function0 + inner (anonymous) class TKt$specializedSam$1 +} + +@kotlin.Metadata +public final class TKt { + // source: 't.kt' + public final static @org.jetbrains.annotations.NotNull <(Lkotlin/jvm/functions/Function0;)Ljava/lang/String;> method specializedSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.String + public final static <(LSam;)TT;> method expectsSam(@org.jetbrains.annotations.NotNull p0: Sam): java.lang.Object + inner (anonymous) class TKt$specializedSam$1 +} diff --git a/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedSamInterface.kt b/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedSamInterface.kt new file mode 100644 index 00000000000..185c15d0e83 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedSamInterface.kt @@ -0,0 +1,16 @@ +// WITH_SIGNATURES +// FILE: t.kt + +fun specializedSam(f: () -> String) = J.g({ f() }) + +// FILE: J.java +public class J { + static T g(Sam s) { + return s.get(); + } +} + +// FILE: Sam.java +public interface Sam { + T get(); +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedSamInterface.txt b/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedSamInterface.txt new file mode 100644 index 00000000000..f5cdf682a05 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedSamInterface.txt @@ -0,0 +1,17 @@ +@kotlin.Metadata +final class<Ljava/lang/Object;LSam;> TKt$specializedSam$1 { + // source: 't.kt' + method (p0: kotlin.jvm.functions.Function0): void + public synthetic bridge method get(): java.lang.Object + public final method get(): java.lang.String + enclosing method TKt.specializedSam(Lkotlin/jvm/functions/Function0;)Ljava/lang/String; + synthetic final field $f: kotlin.jvm.functions.Function0 + inner (anonymous) class TKt$specializedSam$1 +} + +@kotlin.Metadata +public final class TKt { + // source: 't.kt' + public final static <(Lkotlin/jvm/functions/Function0;)Ljava/lang/String;> method specializedSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.String + inner (anonymous) class TKt$specializedSam$1 +} diff --git a/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedSamInterface_ir.txt b/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedSamInterface_ir.txt new file mode 100644 index 00000000000..9333ea1d30f --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedSamInterface_ir.txt @@ -0,0 +1,17 @@ +@kotlin.Metadata +final class<Ljava/lang/Object;LSam;> TKt$specializedSam$1 { + // source: 't.kt' + <(Lkotlin/jvm/functions/Function0;)V> method (p0: kotlin.jvm.functions.Function0): void + public synthetic bridge method get(): java.lang.Object + public final method get(): java.lang.String + enclosing method TKt.specializedSam(Lkotlin/jvm/functions/Function0;)Ljava/lang/String; + synthetic final field ;> $f: kotlin.jvm.functions.Function0 + inner (anonymous) class TKt$specializedSam$1 +} + +@kotlin.Metadata +public final class TKt { + // source: 't.kt' + public final static <(Lkotlin/jvm/functions/Function0;)Ljava/lang/String;> method specializedSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.String + inner (anonymous) class TKt$specializedSam$1 +} diff --git a/compiler/testData/codegen/bytecodeListing/samAdapterAndInlinedOne.kt b/compiler/testData/codegen/bytecodeListing/sam/samAdapterAndInlinedOne.kt similarity index 100% rename from compiler/testData/codegen/bytecodeListing/samAdapterAndInlinedOne.kt rename to compiler/testData/codegen/bytecodeListing/sam/samAdapterAndInlinedOne.kt diff --git a/compiler/testData/codegen/bytecodeListing/samAdapterAndInlinedOne.txt b/compiler/testData/codegen/bytecodeListing/sam/samAdapterAndInlinedOne.txt similarity index 100% rename from compiler/testData/codegen/bytecodeListing/samAdapterAndInlinedOne.txt rename to compiler/testData/codegen/bytecodeListing/sam/samAdapterAndInlinedOne.txt diff --git a/compiler/testData/codegen/bytecodeListing/samAdapterAndInlinedOne_ir.txt b/compiler/testData/codegen/bytecodeListing/sam/samAdapterAndInlinedOne_ir.txt similarity index 100% rename from compiler/testData/codegen/bytecodeListing/samAdapterAndInlinedOne_ir.txt rename to compiler/testData/codegen/bytecodeListing/sam/samAdapterAndInlinedOne_ir.txt diff --git a/compiler/testData/codegen/bytecodeListing/sam/specializedFunInterface.kt b/compiler/testData/codegen/bytecodeListing/sam/specializedFunInterface.kt new file mode 100644 index 00000000000..150cd5d58d4 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/specializedFunInterface.kt @@ -0,0 +1,10 @@ +// WITH_SIGNATURES +// FILE: t.kt + +fun interface Sam { + fun get(): T +} + +fun expectsSam(sam: Sam) = sam.get() + +fun specializedSam(f: () -> String) = expectsSam(f) diff --git a/compiler/testData/codegen/bytecodeListing/sam/specializedFunInterface.txt b/compiler/testData/codegen/bytecodeListing/sam/specializedFunInterface.txt new file mode 100644 index 00000000000..6edd416e201 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/specializedFunInterface.txt @@ -0,0 +1,23 @@ +@kotlin.Metadata +public interface<Ljava/lang/Object;> Sam { + // source: 't.kt' + public abstract <()TT;> method get(): java.lang.Object +} + +@kotlin.Metadata +final class TKt$sam$Sam$0 { + // source: 't.kt' + method (p0: kotlin.jvm.functions.Function0): void + public method equals(p0: java.lang.Object): boolean + public synthetic final method get(): java.lang.Object + public method getFunctionDelegate(): kotlin.Function + public method hashCode(): int + private synthetic final field function: kotlin.jvm.functions.Function0 +} + +@kotlin.Metadata +public final class TKt { + // source: 't.kt' + public final static @org.jetbrains.annotations.NotNull <(Lkotlin/jvm/functions/Function0;)Ljava/lang/String;> method specializedSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.String + public final static <(LSam;)TT;> method expectsSam(@org.jetbrains.annotations.NotNull p0: Sam): java.lang.Object +} diff --git a/compiler/testData/codegen/bytecodeListing/sam/specializedFunInterface_ir.txt b/compiler/testData/codegen/bytecodeListing/sam/specializedFunInterface_ir.txt new file mode 100644 index 00000000000..e08ff5f90d4 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/sam/specializedFunInterface_ir.txt @@ -0,0 +1,25 @@ +@kotlin.Metadata +public interface<Ljava/lang/Object;> Sam { + // source: 't.kt' + public abstract <()TT;> method get(): java.lang.Object +} + +@kotlin.Metadata +final class TKt$sam$Sam$0 { + // source: 't.kt' + public final @org.jetbrains.annotations.NotNull <()Lkotlin/Function<*>;> method getFunctionDelegate(): kotlin.Function + method (@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): void + public final method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean + public synthetic final method get(): java.lang.Object + public final method hashCode(): int + private synthetic final field function: kotlin.jvm.functions.Function0 + final inner class TKt$sam$Sam$0 +} + +@kotlin.Metadata +public final class TKt { + // source: 't.kt' + public final static @org.jetbrains.annotations.NotNull <(Lkotlin/jvm/functions/Function0;)Ljava/lang/String;> method specializedSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.String + public final static <(LSam;)TT;> method expectsSam(@org.jetbrains.annotations.NotNull p0: Sam): java.lang.Object + final inner class TKt$sam$Sam$0 +} diff --git a/compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface.kt b/compiler/testData/codegen/bytecodeListing/sam/specializedSamInterface.kt similarity index 85% rename from compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface.kt rename to compiler/testData/codegen/bytecodeListing/sam/specializedSamInterface.kt index 5d2290fba45..72ecaa94f56 100644 --- a/compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface.kt +++ b/compiler/testData/codegen/bytecodeListing/sam/specializedSamInterface.kt @@ -1,5 +1,5 @@ // WITH_SIGNATURES -// FILE: samGenericSuperinterface.kt +// FILE: t.kt fun specializedSam(f: () -> String) = J.g(f) diff --git a/compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface.txt b/compiler/testData/codegen/bytecodeListing/sam/specializedSamInterface.txt similarity index 69% rename from compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface.txt rename to compiler/testData/codegen/bytecodeListing/sam/specializedSamInterface.txt index da97bd5cec5..c52afa8868a 100644 --- a/compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface.txt +++ b/compiler/testData/codegen/bytecodeListing/sam/specializedSamInterface.txt @@ -1,13 +1,13 @@ @kotlin.Metadata -final class SamGenericSuperinterfaceKt$sam$Sam$0 { - // source: 'samGenericSuperinterface.kt' +final class TKt$sam$Sam$0 { + // source: 't.kt' method (p0: kotlin.jvm.functions.Function0): void public synthetic final method get(): java.lang.Object private synthetic final field function: kotlin.jvm.functions.Function0 } @kotlin.Metadata -public final class SamGenericSuperinterfaceKt { - // source: 'samGenericSuperinterface.kt' +public final class TKt { + // source: 't.kt' public final static <(Lkotlin/jvm/functions/Function0;)Ljava/lang/String;> method specializedSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.String } diff --git a/compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface_ir.txt b/compiler/testData/codegen/bytecodeListing/sam/specializedSamInterface_ir.txt similarity index 60% rename from compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface_ir.txt rename to compiler/testData/codegen/bytecodeListing/sam/specializedSamInterface_ir.txt index 25f44905b2a..2224df22c30 100644 --- a/compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface_ir.txt +++ b/compiler/testData/codegen/bytecodeListing/sam/specializedSamInterface_ir.txt @@ -1,15 +1,15 @@ @kotlin.Metadata -final class SamGenericSuperinterfaceKt$sam$Sam$0 { - // source: 'samGenericSuperinterface.kt' +final class TKt$sam$Sam$0 { + // source: 't.kt' method (@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): void public synthetic final method get(): java.lang.Object private synthetic final field function: kotlin.jvm.functions.Function0 - final inner class SamGenericSuperinterfaceKt$sam$Sam$0 + final inner class TKt$sam$Sam$0 } @kotlin.Metadata -public final class SamGenericSuperinterfaceKt { - // source: 'samGenericSuperinterface.kt' +public final class TKt { + // source: 't.kt' public final static <(Lkotlin/jvm/functions/Function0;)Ljava/lang/String;> method specializedSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.String - final inner class SamGenericSuperinterfaceKt$sam$Sam$0 + final inner class TKt$sam$Sam$0 } diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 67a85554678..491fd945ca5 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -12178,6 +12178,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/funInterface/samConstructorExplicitInvocation.kt"); } + @TestMetadata("samConversionToGenericInterfaceInGenericFun.kt") + public void testSamConversionToGenericInterfaceInGenericFun() throws Exception { + runTest("compiler/testData/codegen/box/funInterface/samConversionToGenericInterfaceInGenericFun.kt"); + } + @TestMetadata("subtypeOfFunctionalTypeToFunInterfaceConversion.kt") public void testSubtypeOfFunctionalTypeToFunInterfaceConversion() throws Exception { runTest("compiler/testData/codegen/box/funInterface/subtypeOfFunctionalTypeToFunInterfaceConversion.kt"); @@ -15922,6 +15927,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/ir/anonymousObjectInForLoopIteratorAndBody.kt"); } + @TestMetadata("anonymousObjectInGenericFun.kt") + public void testAnonymousObjectInGenericFun() throws Exception { + runTest("compiler/testData/codegen/box/ir/anonymousObjectInGenericFun.kt"); + } + @TestMetadata("anonymousObjectInsideElvis.kt") public void testAnonymousObjectInsideElvis() throws Exception { runTest("compiler/testData/codegen/box/ir/anonymousObjectInsideElvis.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index d396a68e870..a0df878ef93 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -39,6 +39,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } + @TestMetadata("anonymousObjectInGenericFun.kt") + public void testAnonymousObjectInGenericFun() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/anonymousObjectInGenericFun.kt"); + } + @TestMetadata("callableNameIntrinsic.kt") public void testCallableNameIntrinsic() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/callableNameIntrinsic.kt"); @@ -209,21 +214,6 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/rawTypeInSignature.kt"); } - @TestMetadata("samAdapterAndInlinedOne.kt") - public void testSamAdapterAndInlinedOne() throws Exception { - runTest("compiler/testData/codegen/bytecodeListing/samAdapterAndInlinedOne.kt"); - } - - @TestMetadata("samGenericSuperinterface.kt") - public void testSamGenericSuperinterface() throws Exception { - runTest("compiler/testData/codegen/bytecodeListing/samGenericSuperinterface.kt"); - } - - @TestMetadata("samSpecializedGenericSuperinterface.kt") - public void testSamSpecializedGenericSuperinterface() throws Exception { - runTest("compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface.kt"); - } - @TestMetadata("varargsBridge.kt") public void testVarargsBridge() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/varargsBridge.kt"); @@ -1495,6 +1485,84 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { } } + @TestMetadata("compiler/testData/codegen/bytecodeListing/sam") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Sam extends AbstractBytecodeListingTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInSam() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/sam"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("callableRefGenericFunInterface.kt") + public void testCallableRefGenericFunInterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/callableRefGenericFunInterface.kt"); + } + + @TestMetadata("callableRefGenericSamInterface.kt") + public void testCallableRefGenericSamInterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/callableRefGenericSamInterface.kt"); + } + + @TestMetadata("callableRefSpecializedFunInterface.kt") + public void testCallableRefSpecializedFunInterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedFunInterface.kt"); + } + + @TestMetadata("callableRefSpecializedSamInterface.kt") + public void testCallableRefSpecializedSamInterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedSamInterface.kt"); + } + + @TestMetadata("genericFunInterface.kt") + public void testGenericFunInterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/genericFunInterface.kt"); + } + + @TestMetadata("genericSamInterface.kt") + public void testGenericSamInterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/genericSamInterface.kt"); + } + + @TestMetadata("lambdaGenericFunInterface.kt") + public void testLambdaGenericFunInterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/lambdaGenericFunInterface.kt"); + } + + @TestMetadata("lambdaGenericSamInterface.kt") + public void testLambdaGenericSamInterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/lambdaGenericSamInterface.kt"); + } + + @TestMetadata("lambdaSpecializedFunInterface.kt") + public void testLambdaSpecializedFunInterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedFunInterface.kt"); + } + + @TestMetadata("lambdaSpecializedSamInterface.kt") + public void testLambdaSpecializedSamInterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedSamInterface.kt"); + } + + @TestMetadata("samAdapterAndInlinedOne.kt") + public void testSamAdapterAndInlinedOne() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/samAdapterAndInlinedOne.kt"); + } + + @TestMetadata("specializedFunInterface.kt") + public void testSpecializedFunInterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/specializedFunInterface.kt"); + } + + @TestMetadata("specializedSamInterface.kt") + public void testSpecializedSamInterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/specializedSamInterface.kt"); + } + } + @TestMetadata("compiler/testData/codegen/bytecodeListing/specialBridges") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 3d89f468b2a..3bf118dd06e 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -12178,6 +12178,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/funInterface/samConstructorExplicitInvocation.kt"); } + @TestMetadata("samConversionToGenericInterfaceInGenericFun.kt") + public void testSamConversionToGenericInterfaceInGenericFun() throws Exception { + runTest("compiler/testData/codegen/box/funInterface/samConversionToGenericInterfaceInGenericFun.kt"); + } + @TestMetadata("subtypeOfFunctionalTypeToFunInterfaceConversion.kt") public void testSubtypeOfFunctionalTypeToFunInterfaceConversion() throws Exception { runTest("compiler/testData/codegen/box/funInterface/subtypeOfFunctionalTypeToFunInterfaceConversion.kt"); @@ -15922,6 +15927,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/ir/anonymousObjectInForLoopIteratorAndBody.kt"); } + @TestMetadata("anonymousObjectInGenericFun.kt") + public void testAnonymousObjectInGenericFun() throws Exception { + runTest("compiler/testData/codegen/box/ir/anonymousObjectInGenericFun.kt"); + } + @TestMetadata("anonymousObjectInsideElvis.kt") public void testAnonymousObjectInsideElvis() throws Exception { runTest("compiler/testData/codegen/box/ir/anonymousObjectInsideElvis.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 5c2dee7064d..ed92c4b4efc 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -12178,6 +12178,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/funInterface/samConstructorExplicitInvocation.kt"); } + @TestMetadata("samConversionToGenericInterfaceInGenericFun.kt") + public void testSamConversionToGenericInterfaceInGenericFun() throws Exception { + runTest("compiler/testData/codegen/box/funInterface/samConversionToGenericInterfaceInGenericFun.kt"); + } + @TestMetadata("subtypeOfFunctionalTypeToFunInterfaceConversion.kt") public void testSubtypeOfFunctionalTypeToFunInterfaceConversion() throws Exception { runTest("compiler/testData/codegen/box/funInterface/subtypeOfFunctionalTypeToFunInterfaceConversion.kt"); @@ -15922,6 +15927,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/ir/anonymousObjectInForLoopIteratorAndBody.kt"); } + @TestMetadata("anonymousObjectInGenericFun.kt") + public void testAnonymousObjectInGenericFun() throws Exception { + runTest("compiler/testData/codegen/box/ir/anonymousObjectInGenericFun.kt"); + } + @TestMetadata("anonymousObjectInsideElvis.kt") public void testAnonymousObjectInsideElvis() throws Exception { runTest("compiler/testData/codegen/box/ir/anonymousObjectInsideElvis.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index 55440bc1093..ee3806fb430 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -39,6 +39,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @TestMetadata("anonymousObjectInGenericFun.kt") + public void testAnonymousObjectInGenericFun() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/anonymousObjectInGenericFun.kt"); + } + @TestMetadata("callableNameIntrinsic.kt") public void testCallableNameIntrinsic() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/callableNameIntrinsic.kt"); @@ -209,21 +214,6 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/rawTypeInSignature.kt"); } - @TestMetadata("samAdapterAndInlinedOne.kt") - public void testSamAdapterAndInlinedOne() throws Exception { - runTest("compiler/testData/codegen/bytecodeListing/samAdapterAndInlinedOne.kt"); - } - - @TestMetadata("samGenericSuperinterface.kt") - public void testSamGenericSuperinterface() throws Exception { - runTest("compiler/testData/codegen/bytecodeListing/samGenericSuperinterface.kt"); - } - - @TestMetadata("samSpecializedGenericSuperinterface.kt") - public void testSamSpecializedGenericSuperinterface() throws Exception { - runTest("compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface.kt"); - } - @TestMetadata("varargsBridge.kt") public void testVarargsBridge() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/varargsBridge.kt"); @@ -1495,6 +1485,84 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes } } + @TestMetadata("compiler/testData/codegen/bytecodeListing/sam") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Sam extends AbstractIrBytecodeListingTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInSam() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/sam"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("callableRefGenericFunInterface.kt") + public void testCallableRefGenericFunInterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/callableRefGenericFunInterface.kt"); + } + + @TestMetadata("callableRefGenericSamInterface.kt") + public void testCallableRefGenericSamInterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/callableRefGenericSamInterface.kt"); + } + + @TestMetadata("callableRefSpecializedFunInterface.kt") + public void testCallableRefSpecializedFunInterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedFunInterface.kt"); + } + + @TestMetadata("callableRefSpecializedSamInterface.kt") + public void testCallableRefSpecializedSamInterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedSamInterface.kt"); + } + + @TestMetadata("genericFunInterface.kt") + public void testGenericFunInterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/genericFunInterface.kt"); + } + + @TestMetadata("genericSamInterface.kt") + public void testGenericSamInterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/genericSamInterface.kt"); + } + + @TestMetadata("lambdaGenericFunInterface.kt") + public void testLambdaGenericFunInterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/lambdaGenericFunInterface.kt"); + } + + @TestMetadata("lambdaGenericSamInterface.kt") + public void testLambdaGenericSamInterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/lambdaGenericSamInterface.kt"); + } + + @TestMetadata("lambdaSpecializedFunInterface.kt") + public void testLambdaSpecializedFunInterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedFunInterface.kt"); + } + + @TestMetadata("lambdaSpecializedSamInterface.kt") + public void testLambdaSpecializedSamInterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedSamInterface.kt"); + } + + @TestMetadata("samAdapterAndInlinedOne.kt") + public void testSamAdapterAndInlinedOne() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/samAdapterAndInlinedOne.kt"); + } + + @TestMetadata("specializedFunInterface.kt") + public void testSpecializedFunInterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/specializedFunInterface.kt"); + } + + @TestMetadata("specializedSamInterface.kt") + public void testSpecializedSamInterface() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/sam/specializedSamInterface.kt"); + } + } + @TestMetadata("compiler/testData/codegen/bytecodeListing/specialBridges") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index ee15ec8ed6a..34ca7cbeb78 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -10408,6 +10408,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/funInterface/samConstructorExplicitInvocation.kt"); } + @TestMetadata("samConversionToGenericInterfaceInGenericFun.kt") + public void testSamConversionToGenericInterfaceInGenericFun() throws Exception { + runTest("compiler/testData/codegen/box/funInterface/samConversionToGenericInterfaceInGenericFun.kt"); + } + @TestMetadata("subtypeOfFunctionalTypeToFunInterfaceConversion.kt") public void testSubtypeOfFunctionalTypeToFunInterfaceConversion() throws Exception { runTest("compiler/testData/codegen/box/funInterface/subtypeOfFunctionalTypeToFunInterfaceConversion.kt"); @@ -13752,6 +13757,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/ir/anonymousObjectInForLoopIteratorAndBody.kt"); } + @TestMetadata("anonymousObjectInGenericFun.kt") + public void testAnonymousObjectInGenericFun() throws Exception { + runTest("compiler/testData/codegen/box/ir/anonymousObjectInGenericFun.kt"); + } + @TestMetadata("anonymousObjectInsideElvis.kt") public void testAnonymousObjectInsideElvis() throws Exception { runTest("compiler/testData/codegen/box/ir/anonymousObjectInsideElvis.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index e77006fe787..3feb9e3640c 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -10408,6 +10408,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/funInterface/samConstructorExplicitInvocation.kt"); } + @TestMetadata("samConversionToGenericInterfaceInGenericFun.kt") + public void testSamConversionToGenericInterfaceInGenericFun() throws Exception { + runTest("compiler/testData/codegen/box/funInterface/samConversionToGenericInterfaceInGenericFun.kt"); + } + @TestMetadata("subtypeOfFunctionalTypeToFunInterfaceConversion.kt") public void testSubtypeOfFunctionalTypeToFunInterfaceConversion() throws Exception { runTest("compiler/testData/codegen/box/funInterface/subtypeOfFunctionalTypeToFunInterfaceConversion.kt"); @@ -13752,6 +13757,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/ir/anonymousObjectInForLoopIteratorAndBody.kt"); } + @TestMetadata("anonymousObjectInGenericFun.kt") + public void testAnonymousObjectInGenericFun() throws Exception { + runTest("compiler/testData/codegen/box/ir/anonymousObjectInGenericFun.kt"); + } + @TestMetadata("anonymousObjectInsideElvis.kt") public void testAnonymousObjectInsideElvis() throws Exception { runTest("compiler/testData/codegen/box/ir/anonymousObjectInsideElvis.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 1ff50fac443..95c1521dc26 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -10408,6 +10408,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/funInterface/samConstructorExplicitInvocation.kt"); } + @TestMetadata("samConversionToGenericInterfaceInGenericFun.kt") + public void testSamConversionToGenericInterfaceInGenericFun() throws Exception { + runTest("compiler/testData/codegen/box/funInterface/samConversionToGenericInterfaceInGenericFun.kt"); + } + @TestMetadata("subtypeOfFunctionalTypeToFunInterfaceConversion.kt") public void testSubtypeOfFunctionalTypeToFunInterfaceConversion() throws Exception { runTest("compiler/testData/codegen/box/funInterface/subtypeOfFunctionalTypeToFunInterfaceConversion.kt"); @@ -13817,6 +13822,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/ir/anonymousObjectInForLoopIteratorAndBody.kt"); } + @TestMetadata("anonymousObjectInGenericFun.kt") + public void testAnonymousObjectInGenericFun() throws Exception { + runTest("compiler/testData/codegen/box/ir/anonymousObjectInGenericFun.kt"); + } + @TestMetadata("anonymousObjectInsideElvis.kt") public void testAnonymousObjectInsideElvis() throws Exception { runTest("compiler/testData/codegen/box/ir/anonymousObjectInsideElvis.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index 91a8b9f0785..86c26a57ad7 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -5259,6 +5259,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/funInterface/samConstructorExplicitInvocation.kt"); } + @TestMetadata("samConversionToGenericInterfaceInGenericFun.kt") + public void testSamConversionToGenericInterfaceInGenericFun() throws Exception { + runTest("compiler/testData/codegen/box/funInterface/samConversionToGenericInterfaceInGenericFun.kt"); + } + @TestMetadata("compiler/testData/codegen/box/funInterface/equality") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -8043,6 +8048,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ir"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); } + @TestMetadata("anonymousObjectInGenericFun.kt") + public void testAnonymousObjectInGenericFun() throws Exception { + runTest("compiler/testData/codegen/box/ir/anonymousObjectInGenericFun.kt"); + } + @TestMetadata("anonymousObjectInsideElvis.kt") public void testAnonymousObjectInsideElvis() throws Exception { runTest("compiler/testData/codegen/box/ir/anonymousObjectInsideElvis.kt"); From 2be62c13b0da6ec37a3164ac325bbeef74f08a92 Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov Date: Fri, 11 Dec 2020 17:11:08 +0300 Subject: [PATCH 622/698] [Commonizer] Minor. Renamings - Absent* -> Missing* - Target -> CommonizerTarget - Result -> CommonizerResult - Parameters -> CommonizerParameters --- ...{Parameters.kt => CommonizerParameters.kt} | 4 +-- .../{Result.kt => CommonizerResult.kt} | 12 +++---- .../{Target.kt => CommonizerTarget.kt} | 6 ++-- .../builder/DeclarationsBuilderVisitor1.kt | 7 ++-- .../descriptors/commonizer/builder/context.kt | 8 ++--- .../descriptors/commonizer/cir/CirRoot.kt | 4 +-- .../commonizer/cir/factory/CirRootFactory.kt | 4 +-- .../commonizer/cir/impl/CirRootImpl.kt | 4 +-- .../kotlin/descriptors/commonizer/facade.kt | 16 ++++----- .../konan/NativeDistributionCommonizer.kt | 30 ++++++++-------- .../commonizer/mergedtree/CirTreeMerger.kt | 14 ++++---- .../mergedtree/classifierContainers.kt | 4 +-- .../stats/AggregatedStatsCollector.kt | 14 ++++---- .../commonizer/stats/RawStatsCollector.kt | 8 ++--- .../AbstractCommonizationFromSourcesTest.kt | 34 +++++++++---------- .../commonizer/CommonizerFacadeTest.kt | 24 ++++++------- .../core/PropertySetterCommonizerTest.kt | 10 +++--- .../commonizer/core/RootCommonizerTest.kt | 4 +-- .../commonizer/utils/assertions.kt | 10 +++--- 19 files changed, 109 insertions(+), 108 deletions(-) rename native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/{Parameters.kt => CommonizerParameters.kt} (92%) rename native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/{Result.kt => CommonizerResult.kt} (72%) rename native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/{Target.kt => CommonizerTarget.kt} (80%) diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Parameters.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/CommonizerParameters.kt similarity index 92% rename from native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Parameters.kt rename to native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/CommonizerParameters.kt index c31c8fc5ef4..ca1b747521f 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Parameters.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/CommonizerParameters.kt @@ -7,7 +7,7 @@ package org.jetbrains.kotlin.descriptors.commonizer import org.jetbrains.kotlin.descriptors.commonizer.stats.StatsCollector -class Parameters( +class CommonizerParameters( val statsCollector: StatsCollector? = null, val progressLogger: ((String) -> Unit)? = null ) { @@ -24,7 +24,7 @@ class Parameters( field = value } - fun addTarget(targetProvider: TargetProvider): Parameters { + fun addTarget(targetProvider: TargetProvider): CommonizerParameters { require(targetProvider.target !in _targetProviders) { "Target ${targetProvider.target} is already added" } _targetProviders[targetProvider.target] = targetProvider diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Result.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/CommonizerResult.kt similarity index 72% rename from native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Result.kt rename to native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/CommonizerResult.kt index eca9f21d63c..d63906befbc 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Result.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/CommonizerResult.kt @@ -8,18 +8,18 @@ package org.jetbrains.kotlin.descriptors.commonizer import org.jetbrains.kotlin.descriptors.ModuleDescriptor import java.io.File -sealed class Result { - object NothingToCommonize : Result() +sealed class CommonizerResult { + object NothingToDo : CommonizerResult() - class Commonized( - val modulesByTargets: Map> - ) : Result() { + class Done( + val modulesByTargets: Map> + ) : CommonizerResult() { val sharedTarget: SharedTarget by lazy { modulesByTargets.keys.filterIsInstance().single() } val leafTargets: Set by lazy { modulesByTargets.keys.filterIsInstance().toSet() } } } sealed class ModuleResult { - class Absent(val originalLocation: File) : ModuleResult() + class Missing(val originalLocation: File) : ModuleResult() class Commonized(val module: ModuleDescriptor) : ModuleResult() } diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Target.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/CommonizerTarget.kt similarity index 80% rename from native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Target.kt rename to native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/CommonizerTarget.kt index 05a520c711a..7d04e7d1564 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/Target.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/CommonizerTarget.kt @@ -9,11 +9,11 @@ import org.jetbrains.kotlin.konan.target.KonanTarget // N.B. TargetPlatform/SimplePlatform are non exhaustive enough to address both target platforms such as // JVM, JS and concrete Kotlin/Native targets, e.g. macos_x64, ios_x64, linux_x64. -sealed class Target +sealed class CommonizerTarget -data class LeafTarget(val name: String, val konanTarget: KonanTarget? = null) : Target() +data class LeafTarget(val name: String, val konanTarget: KonanTarget? = null) : CommonizerTarget() -data class SharedTarget(val targets: Set) : Target() { +data class SharedTarget(val targets: Set) : CommonizerTarget() { init { require(targets.isNotEmpty()) } diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/builder/DeclarationsBuilderVisitor1.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/builder/DeclarationsBuilderVisitor1.kt index 8fcdfcbdd1b..326ba29e08d 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/builder/DeclarationsBuilderVisitor1.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/builder/DeclarationsBuilderVisitor1.kt @@ -6,7 +6,7 @@ package org.jetbrains.kotlin.descriptors.commonizer.builder import org.jetbrains.kotlin.descriptors.* -import org.jetbrains.kotlin.descriptors.commonizer.Target +import org.jetbrains.kotlin.descriptors.commonizer.CommonizerTarget import org.jetbrains.kotlin.descriptors.commonizer.builder.CommonizedMemberScope.Companion.plusAssign import org.jetbrains.kotlin.descriptors.commonizer.builder.CommonizedPackageFragmentProvider.Companion.plusAssign import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.* @@ -27,8 +27,9 @@ internal class DeclarationsBuilderVisitor1( check(data.isEmpty()) // root node may not have containing declarations check(components.targetComponents.size == node.dimension) - val allTargets: List = (node.targetDeclarations + node.commonDeclaration()).map { it!!.target } - val modulesByTargets: Map> = allTargets.associateWithTo(HashMap()) { mutableListOf() } + val allTargets: List = (node.targetDeclarations + node.commonDeclaration()).map { it!!.target } + val modulesByTargets: Map> = + allTargets.associateWithTo(HashMap()) { mutableListOf() } // collect module descriptors: for (moduleNode in node.modules.values) { diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/builder/context.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/builder/context.kt index b1ce4f240a6..f7304d7e9b3 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/builder/context.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/builder/context.kt @@ -9,8 +9,8 @@ import gnu.trove.THashMap import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.builtins.StandardNames import org.jetbrains.kotlin.descriptors.* -import org.jetbrains.kotlin.descriptors.commonizer.Parameters -import org.jetbrains.kotlin.descriptors.commonizer.Target +import org.jetbrains.kotlin.descriptors.commonizer.CommonizerParameters +import org.jetbrains.kotlin.descriptors.commonizer.CommonizerTarget import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirNode.Companion.dimension import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirNode.Companion.indexOfCommon import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirRootNode @@ -132,7 +132,7 @@ class GlobalDeclarationsBuilderComponents( class TargetDeclarationsBuilderComponents( val storageManager: StorageManager, - val target: Target, + val target: CommonizerTarget, val builtIns: KotlinBuiltIns, val lazyClassifierLookupTable: NotNullLazyValue, val index: Int, @@ -217,7 +217,7 @@ class LazyClassifierLookupTable(lazyModules: Map> fun CirRootNode.createGlobalBuilderComponents( storageManager: StorageManager, - parameters: Parameters + parameters: CommonizerParameters ): GlobalDeclarationsBuilderComponents { val cache = DeclarationsBuilderCache(dimension) diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/CirRoot.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/CirRoot.kt index 676db84a1f1..584d867dfb5 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/CirRoot.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/CirRoot.kt @@ -6,10 +6,10 @@ package org.jetbrains.kotlin.descriptors.commonizer.cir import org.jetbrains.kotlin.descriptors.commonizer.BuiltInsProvider -import org.jetbrains.kotlin.descriptors.commonizer.Target +import org.jetbrains.kotlin.descriptors.commonizer.CommonizerTarget interface CirRoot : CirDeclaration { - val target: Target + val target: CommonizerTarget val builtInsClass: String val builtInsProvider: BuiltInsProvider } diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirRootFactory.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirRootFactory.kt index 2aa6c5bd62a..fe3011ace1e 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirRootFactory.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirRootFactory.kt @@ -8,13 +8,13 @@ package org.jetbrains.kotlin.descriptors.commonizer.cir.factory import org.jetbrains.kotlin.builtins.konan.KonanBuiltIns import org.jetbrains.kotlin.descriptors.commonizer.BuiltInsProvider import org.jetbrains.kotlin.descriptors.commonizer.LeafTarget -import org.jetbrains.kotlin.descriptors.commonizer.Target +import org.jetbrains.kotlin.descriptors.commonizer.CommonizerTarget import org.jetbrains.kotlin.descriptors.commonizer.cir.CirRoot import org.jetbrains.kotlin.descriptors.commonizer.cir.impl.CirRootImpl object CirRootFactory { fun create( - target: Target, + target: CommonizerTarget, builtInsClass: String, builtInsProvider: BuiltInsProvider ): CirRoot { diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/impl/CirRootImpl.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/impl/CirRootImpl.kt index d72b085d4cc..5253e65394b 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/impl/CirRootImpl.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/impl/CirRootImpl.kt @@ -6,11 +6,11 @@ package org.jetbrains.kotlin.descriptors.commonizer.cir.impl import org.jetbrains.kotlin.descriptors.commonizer.BuiltInsProvider -import org.jetbrains.kotlin.descriptors.commonizer.Target +import org.jetbrains.kotlin.descriptors.commonizer.CommonizerTarget import org.jetbrains.kotlin.descriptors.commonizer.cir.CirRoot data class CirRootImpl( - override val target: Target, + override val target: CommonizerTarget, override val builtInsClass: String, override val builtInsProvider: BuiltInsProvider ) : CirRoot diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/facade.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/facade.kt index d61136450f5..9a8dbbe6f1f 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/facade.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/facade.kt @@ -14,9 +14,9 @@ import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirTreeMerger.CirT import org.jetbrains.kotlin.storage.LockBasedStorageManager import org.jetbrains.kotlin.storage.StorageManager -fun runCommonization(parameters: Parameters): Result { +fun runCommonization(parameters: CommonizerParameters): CommonizerResult { if (!parameters.hasAnythingToCommonize()) - return Result.NothingToCommonize + return CommonizerResult.NothingToDo val storageManager = LockBasedStorageManager("Declaration descriptors commonization") @@ -28,26 +28,26 @@ fun runCommonization(parameters: Parameters): Result { mergedTree.accept(DeclarationsBuilderVisitor1(components), emptyList()) mergedTree.accept(DeclarationsBuilderVisitor2(components), emptyList()) - val modulesByTargets = LinkedHashMap>() // use linked hash map to preserve order + val modulesByTargets = LinkedHashMap>() // use linked hash map to preserve order components.targetComponents.forEach { component -> val target = component.target check(target !in modulesByTargets) val commonizedModules: List = components.cache.getAllModules(component.index).map(ModuleResult::Commonized) - val absentModules: List = if (target is LeafTarget) - mergeResult.absentModuleInfos.getValue(target).map { ModuleResult.Absent(it.originalLocation) } + val missingModules: List = if (target is LeafTarget) + mergeResult.missingModuleInfos.getValue(target).map { ModuleResult.Missing(it.originalLocation) } else emptyList() - modulesByTargets[target] = commonizedModules + absentModules + modulesByTargets[target] = commonizedModules + missingModules } parameters.progressLogger?.invoke("Prepared new descriptors") - return Result.Commonized(modulesByTargets) + return CommonizerResult.Done(modulesByTargets) } -private fun mergeAndCommonize(storageManager: StorageManager, parameters: Parameters): CirTreeMergeResult { +private fun mergeAndCommonize(storageManager: StorageManager, parameters: CommonizerParameters): CirTreeMergeResult { // build merged tree: val classifiers = CirKnownClassifiers( commonized = CirCommonizedClassifiers.default(), diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionCommonizer.kt index 7e9785d6c6e..c14905b0f5d 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/konan/NativeDistributionCommonizer.kt @@ -12,7 +12,7 @@ import org.jetbrains.kotlin.builtins.konan.KonanBuiltIns import org.jetbrains.kotlin.config.LanguageVersionSettingsImpl import org.jetbrains.kotlin.descriptors.ModuleDescriptor import org.jetbrains.kotlin.descriptors.commonizer.* -import org.jetbrains.kotlin.descriptors.commonizer.Target +import org.jetbrains.kotlin.descriptors.commonizer.CommonizerTarget import org.jetbrains.kotlin.descriptors.commonizer.konan.NativeDistributionCommonizer.StatsType.* import org.jetbrains.kotlin.descriptors.commonizer.stats.AggregatedStatsCollector import org.jetbrains.kotlin.descriptors.commonizer.stats.FileStatsOutput @@ -136,14 +136,14 @@ class NativeDistributionCommonizer( return library } - private fun commonize(allLibraries: AllNativeLibraries): Result { + private fun commonize(allLibraries: AllNativeLibraries): CommonizerResult { val statsCollector = when (statsType) { RAW -> RawStatsCollector(targets, FileStatsOutput(destination, "raw")) AGGREGATED -> AggregatedStatsCollector(targets, FileStatsOutput(destination, "aggregated")) NONE -> null } statsCollector.use { - val parameters = Parameters(statsCollector, ::logProgress).apply { + val parameters = CommonizerParameters(statsCollector, ::logProgress).apply { val storageManager = LockBasedStorageManager("Commonized modules") val stdlibProvider = NativeDistributionStdlibProvider(storageManager, allLibraries.stdlib) @@ -170,13 +170,13 @@ class NativeDistributionCommonizer( } } - private fun saveModules(originalLibraries: AllNativeLibraries, result: Result) { + private fun saveModules(originalLibraries: AllNativeLibraries, result: CommonizerResult) { // optimization: stdlib and endorsed libraries effectively remain the same across all Kotlin/Native targets, // so they can be just copied to the new destination without running serializer copyCommonStandardLibraries() when (result) { - is Result.NothingToCommonize -> { + is CommonizerResult.NothingToDo -> { // It may happen that all targets to be commonized (or at least all but one target) miss platform libraries. // In such case commonizer will do nothing and return a special result value 'NothingToCommonize'. // So, let's just copy platform libraries from the target where they are to the new destination. @@ -185,7 +185,7 @@ class NativeDistributionCommonizer( } } - is Result.Commonized -> { + is CommonizerResult.Done -> { val serializer = KlibMetadataMonolithicSerializer( languageVersionSettings = LanguageVersionSettingsImpl.DEFAULT, metadataVersion = KlibMetadataVersion.INSTANCE, @@ -207,8 +207,8 @@ class NativeDistributionCommonizer( targetsToSerialize.forEach { target -> val moduleResults: Collection = result.modulesByTargets.getValue(target) val newModules: Collection = moduleResults.mapNotNull { (it as? ModuleResult.Commonized)?.module } - val absentModuleLocations: List = - moduleResults.mapNotNull { (it as? ModuleResult.Absent)?.originalLocation } + val missingModuleLocations: List = + moduleResults.mapNotNull { (it as? ModuleResult.Missing)?.originalLocation } val manifestProvider: NativeManifestDataProvider val starredTarget: String? @@ -224,7 +224,7 @@ class NativeDistributionCommonizer( } val targetName = leafTargetNames.joinToString { if (it == starredTarget) "$it(*)" else it } - serializeTarget(target, targetName, newModules, absentModuleLocations, manifestProvider, serializer) + serializeTarget(target, targetName, newModules, missingModuleLocations, manifestProvider, serializer) } } } @@ -266,10 +266,10 @@ class NativeDistributionCommonizer( } private fun serializeTarget( - target: Target, + target: CommonizerTarget, targetName: String, newModules: Collection, - absentModuleLocations: List, + missingModuleLocations: List, manifestProvider: NativeManifestDataProvider, serializer: KlibMetadataMonolithicSerializer ) { @@ -291,9 +291,9 @@ class NativeDistributionCommonizer( writeLibrary(metadata, manifestData, libraryDestination) } - for (absentModuleLocation in absentModuleLocations) { - val libraryName = absentModuleLocation.name - absentModuleLocation.copyRecursively(librariesDestination.resolve(libraryName)) + for (missingModuleLocation in missingModuleLocations) { + val libraryName = missingModuleLocation.name + missingModuleLocation.copyRecursively(librariesDestination.resolve(libraryName)) } logProgress("Written libraries for [$targetName]") @@ -323,7 +323,7 @@ class NativeDistributionCommonizer( .resolve(KONAN_DISTRIBUTION_PLATFORM_LIBS_DIR) .resolve(name) - private val Target.librariesDestination: File + private val CommonizerTarget.librariesDestination: File get() = when (this) { is LeafTarget -> destination.resolve(KONAN_DISTRIBUTION_PLATFORM_LIBS_DIR).resolve(name) is SharedTarget -> destination.resolve(KONAN_DISTRIBUTION_COMMON_LIBS_DIR) diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirTreeMerger.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirTreeMerger.kt index 82b43b162e6..6a8159759b2 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirTreeMerger.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/CirTreeMerger.kt @@ -8,7 +8,7 @@ package org.jetbrains.kotlin.descriptors.commonizer.mergedtree import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.commonizer.LeafTarget import org.jetbrains.kotlin.descriptors.commonizer.ModulesProvider.ModuleInfo -import org.jetbrains.kotlin.descriptors.commonizer.Parameters +import org.jetbrains.kotlin.descriptors.commonizer.CommonizerParameters import org.jetbrains.kotlin.descriptors.commonizer.TargetProvider import org.jetbrains.kotlin.descriptors.commonizer.cir.CirClass import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.* @@ -49,11 +49,11 @@ import org.jetbrains.kotlin.storage.StorageManager class CirTreeMerger( private val storageManager: StorageManager, private val classifiers: CirKnownClassifiers, - private val parameters: Parameters + private val parameters: CommonizerParameters ) { class CirTreeMergeResult( val root: CirRootNode, - val absentModuleInfos: Map> + val missingModuleInfos: Map> ) private val size = parameters.targetProviders.size @@ -83,15 +83,15 @@ class CirTreeMerger( System.gc() } - val absentModuleInfos = allModuleInfos.mapIndexed { index, moduleInfos -> + val missingModuleInfos = allModuleInfos.mapIndexed { index, moduleInfos -> val target = parameters.targetProviders[index].target - val absentInfos = moduleInfos.filterKeys { name -> name !in commonModuleNames }.values - target to absentInfos + val missingInfos = moduleInfos.filterKeys { name -> name !in commonModuleNames }.values + target to missingInfos }.toMap() return CirTreeMergeResult( root = rootNode, - absentModuleInfos = absentModuleInfos + missingModuleInfos = missingModuleInfos ) } diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/classifierContainers.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/classifierContainers.kt index f9ced646b45..f047224bcff 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/classifierContainers.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/mergedtree/classifierContainers.kt @@ -9,7 +9,7 @@ import gnu.trove.THashMap import gnu.trove.THashSet import org.jetbrains.kotlin.descriptors.ModuleDescriptor import org.jetbrains.kotlin.descriptors.commonizer.SharedTarget -import org.jetbrains.kotlin.descriptors.commonizer.Target +import org.jetbrains.kotlin.descriptors.commonizer.CommonizerTarget import org.jetbrains.kotlin.descriptors.commonizer.utils.intern import org.jetbrains.kotlin.descriptors.commonizer.utils.isUnderKotlinNativeSyntheticPackages import org.jetbrains.kotlin.descriptors.commonizer.utils.resolveClassOrTypeAlias @@ -22,7 +22,7 @@ import org.jetbrains.kotlin.storage.getValue class CirKnownClassifiers( val commonized: CirCommonizedClassifiers, val forwardDeclarations: CirForwardDeclarations, - val dependeeLibraries: Map + val dependeeLibraries: Map ) { // a shortcut for fast access val commonDependeeLibraries: CirProvidedClassifiers = diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/stats/AggregatedStatsCollector.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/stats/AggregatedStatsCollector.kt index 0a7d6267748..241cc876ba4 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/stats/AggregatedStatsCollector.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/stats/AggregatedStatsCollector.kt @@ -55,11 +55,11 @@ class AggregatedStatsCollector( ) : StatsOutput.StatsRow { var liftedUp: Int = 0 var successfullyCommonized: Int = 0 - var failedBecauseAbsent: Int = 0 + var failedBecauseMissing: Int = 0 var failedOther: Int = 0 override fun toList(): List { - val total = liftedUp + successfullyCommonized + failedBecauseAbsent + failedOther + val total = liftedUp + successfullyCommonized + failedBecauseMissing + failedOther fun fraction(amount: Int): Double = if (total > 0) amount.toDouble() / total else 0.0 @@ -69,8 +69,8 @@ class AggregatedStatsCollector( fraction(liftedUp).toString(), successfullyCommonized.toString(), fraction(successfullyCommonized).toString(), - failedBecauseAbsent.toString(), - fraction(failedBecauseAbsent).toString(), + failedBecauseMissing.toString(), + fraction(failedBecauseMissing).toString(), failedOther.toString(), fraction(failedOther).toString(), total.toString() @@ -96,9 +96,9 @@ private class AggregatingOutput : StatsOutput { when (row.common) { LIFTED_UP -> aggregatedStatsRow.liftedUp++ EXPECT -> aggregatedStatsRow.successfullyCommonized++ - ABSENT -> { - if (row.platform.any { it == RawStatsCollector.PlatformDeclarationStatus.ABSENT }) { - aggregatedStatsRow.failedBecauseAbsent++ + MISSING -> { + if (row.platform.any { it == RawStatsCollector.PlatformDeclarationStatus.MISSING }) { + aggregatedStatsRow.failedBecauseMissing++ } else { aggregatedStatsRow.failedOther++ } diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/stats/RawStatsCollector.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/stats/RawStatsCollector.kt index 073482d5121..098e8d90670 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/stats/RawStatsCollector.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/stats/RawStatsCollector.kt @@ -92,7 +92,7 @@ class RawStatsCollector( var isLiftedUp = !lastIsNull for (index in 0 until result.size - 1) { statsRow.platform += when { - result[index] == null -> PlatformDeclarationStatus.ABSENT + result[index] == null -> PlatformDeclarationStatus.MISSING lastIsNull -> PlatformDeclarationStatus.ORIGINAL else -> { isLiftedUp = false @@ -103,7 +103,7 @@ class RawStatsCollector( statsRow.common = when { isLiftedUp -> CommonDeclarationStatus.LIFTED_UP - lastIsNull -> CommonDeclarationStatus.ABSENT + lastIsNull -> CommonDeclarationStatus.MISSING else -> CommonDeclarationStatus.EXPECT } @@ -157,12 +157,12 @@ class RawStatsCollector( enum class CommonDeclarationStatus(val alias: Char) { LIFTED_UP('L'), EXPECT('E'), - ABSENT('-') + MISSING('-') } enum class PlatformDeclarationStatus(val alias: Char) { ACTUAL('A'), ORIGINAL('O'), - ABSENT('-') + MISSING('-') } } diff --git a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/AbstractCommonizationFromSourcesTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/AbstractCommonizationFromSourcesTest.kt index 34c052c99dd..eff9561f99a 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/AbstractCommonizationFromSourcesTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/AbstractCommonizationFromSourcesTest.kt @@ -66,7 +66,7 @@ abstract class AbstractCommonizationFromSourcesTest : KtUsefulTestCase() { val sourceModuleRoots: SourceModuleRoots = SourceModuleRoots.load(getTestDataDir()) val analyzedModules: AnalyzedModules = AnalyzedModules.create(sourceModuleRoots, testRootDisposable) - val result: Result = runCommonization(analyzedModules.toCommonizationParameters()) + val result: CommonizerResult = runCommonization(analyzedModules.toCommonizationParameters()) assertCommonizationPerformed(result) val sharedTarget: SharedTarget = analyzedModules.sharedTarget @@ -115,8 +115,8 @@ private data class SourceModuleRoot( private class SourceModuleRoots( val originalRoots: Map, - val commonizedRoots: Map, - val dependeeRoots: Map + val commonizedRoots: Map, + val dependeeRoots: Map ) { val leafTargets: Set = originalRoots.keys val sharedTarget: SharedTarget @@ -143,7 +143,7 @@ private class SourceModuleRoots( val leafTargets = originalRoots.keys val sharedTarget = SharedTarget(leafTargets) - fun getTarget(targetName: String): Target = + fun getTarget(targetName: String): CommonizerTarget = if (targetName == SHARED_TARGET_NAME) sharedTarget else leafTargets.first { it.name == targetName } val commonizedRoots = listRoots(dataDir, COMMONIZED_ROOTS_DIR).mapKeys { getTarget(it.key) } @@ -164,7 +164,7 @@ private class SourceModuleRoots( } private class AnalyzedModuleDependencies( - val regularDependencies: Map>, + val regularDependencies: Map>, val expectByDependencies: List ) { fun withExpectByDependency(dependency: ModuleDescriptor) = @@ -179,9 +179,9 @@ private class AnalyzedModuleDependencies( } private class AnalyzedModules( - val originalModules: Map, - val commonizedModules: Map, - val dependeeModules: Map> + val originalModules: Map, + val commonizedModules: Map, + val dependeeModules: Map> ) { val leafTargets: Set val sharedTarget: SharedTarget @@ -201,8 +201,8 @@ private class AnalyzedModules( check(allTargets.containsAll(dependeeModules.keys)) } - fun toCommonizationParameters(): Parameters { - val parameters = Parameters() + fun toCommonizationParameters(): CommonizerParameters { + val parameters = CommonizerParameters() leafTargets.forEach { leafTarget -> val originalModule = originalModules.getValue(leafTarget) @@ -240,9 +240,9 @@ private class AnalyzedModules( private fun createDependeeModules( sharedTarget: SharedTarget, - dependeeRoots: Map, + dependeeRoots: Map, parentDisposable: Disposable - ): Pair>, AnalyzedModuleDependencies> { + ): Pair>, AnalyzedModuleDependencies> { val customDependeeModules = createModules(sharedTarget, dependeeRoots, AnalyzedModuleDependencies.EMPTY, parentDisposable, isDependeeModule = true) @@ -261,12 +261,12 @@ private class AnalyzedModules( private fun createModules( sharedTarget: SharedTarget, - moduleRoots: Map, + moduleRoots: Map, dependencies: AnalyzedModuleDependencies, parentDisposable: Disposable, isDependeeModule: Boolean = false - ): Map { - val result = mutableMapOf() + ): Map { + val result = mutableMapOf() var dependenciesForOthers = dependencies @@ -288,7 +288,7 @@ private class AnalyzedModules( private fun createModule( sharedTarget: SharedTarget, - currentTarget: Target, + currentTarget: CommonizerTarget, moduleRoot: SourceModuleRoot, dependencies: AnalyzedModuleDependencies, parentDisposable: Disposable, @@ -336,7 +336,7 @@ private class AnalyzedModules( private class DependenciesContainerImpl( sharedTarget: SharedTarget, - currentTarget: Target, + currentTarget: CommonizerTarget, dependencies: AnalyzedModuleDependencies ) : CommonDependenciesContainer { private val moduleInfoToModule = mutableMapOf() diff --git a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/CommonizerFacadeTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/CommonizerFacadeTest.kt index a5cfecb9193..34a02d43c75 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/CommonizerFacadeTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/CommonizerFacadeTest.kt @@ -52,7 +52,7 @@ class CommonizerFacadeTest { ) @Test - fun commonizedWithAbsentModules() = doTestSuccessfulCommonization( + fun commonizedWithMissingModules() = doTestSuccessfulCommonization( mapOf( "target1" to listOf("foo", "bar"), "target2" to listOf("foo", "qix") @@ -60,7 +60,7 @@ class CommonizerFacadeTest { ) companion object { - private fun Map>.toCommonizationParameters() = Parameters().also { + private fun Map>.toCommonizationParameters() = CommonizerParameters().also { forEach { (targetName, moduleNames) -> it.addTarget( TargetProvider( @@ -76,7 +76,7 @@ class CommonizerFacadeTest { private fun doTestNothingToCommonize(originalModules: Map>) { val result = runCommonization(originalModules.toCommonizationParameters()) - assertEquals(Result.NothingToCommonize, result) + assertEquals(CommonizerResult.NothingToDo, result) } private fun doTestSuccessfulCommonization(originalModules: Map>) { @@ -92,17 +92,17 @@ class CommonizerFacadeTest { } assertModulesMatch( expectedCommonizedModuleNames = expectedCommonModuleNames, - expectedAbsentModuleNames = emptySet(), + expectedMissingModuleNames = emptySet(), actualModuleResults = result.modulesByTargets.getValue(result.sharedTarget) ) result.leafTargets.forEach { target -> val allModuleNames = originalModules.getValue(target.name).toSet() - val expectedAbsentModuleNames = allModuleNames - expectedCommonModuleNames + val expectedMissingModuleNames = allModuleNames - expectedCommonModuleNames assertModulesMatch( expectedCommonizedModuleNames = expectedCommonModuleNames, - expectedAbsentModuleNames = expectedAbsentModuleNames, + expectedMissingModuleNames = expectedMissingModuleNames, actualModuleResults = result.modulesByTargets.getValue(target) ) } @@ -110,27 +110,27 @@ class CommonizerFacadeTest { private fun assertModulesMatch( expectedCommonizedModuleNames: Set, - expectedAbsentModuleNames: Set, + expectedMissingModuleNames: Set, actualModuleResults: Collection ) { - assertEquals(expectedCommonizedModuleNames.size + expectedAbsentModuleNames.size, actualModuleResults.size) + assertEquals(expectedCommonizedModuleNames.size + expectedMissingModuleNames.size, actualModuleResults.size) val actualCommonizedModuleNames = mutableSetOf() - val actualAbsentModuleNames = mutableSetOf() + val actualMissingModuleNames = mutableSetOf() actualModuleResults.forEach { moduleResult -> when (moduleResult) { is ModuleResult.Commonized -> { actualCommonizedModuleNames += moduleResult.module.name.asString().removeSurrounding("<", ">") } - is ModuleResult.Absent -> { - actualAbsentModuleNames += moduleResult.originalLocation.name + is ModuleResult.Missing -> { + actualMissingModuleNames += moduleResult.originalLocation.name } } } assertEquals(expectedCommonizedModuleNames, actualCommonizedModuleNames) - assertEquals(expectedAbsentModuleNames, actualAbsentModuleNames) + assertEquals(expectedMissingModuleNames, actualMissingModuleNames) } } } diff --git a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/PropertySetterCommonizerTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/PropertySetterCommonizerTest.kt index 80acd087886..66c38111cc8 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/PropertySetterCommonizerTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/PropertySetterCommonizerTest.kt @@ -14,28 +14,28 @@ import org.junit.Test class PropertySetterCommonizerTest : AbstractCommonizerTest() { @Test - fun absentOnly() = super.doTestSuccess( + fun missingOnly() = super.doTestSuccess( expected = null, null, null, null ) @Test(expected = IllegalCommonizerStateException::class) - fun absentAndPublic() = doTestFailure( + fun missingAndPublic() = doTestFailure( null, null, null, PUBLIC ) @Test(expected = IllegalCommonizerStateException::class) - fun publicAndAbsent() = doTestFailure( + fun publicAndMissing() = doTestFailure( PUBLIC, PUBLIC, PUBLIC, null ) @Test(expected = IllegalCommonizerStateException::class) - fun protectedAndAbsent() = doTestFailure( + fun protectedAndMissing() = doTestFailure( PROTECTED, PROTECTED, null ) @Test(expected = IllegalCommonizerStateException::class) - fun absentAndInternal() = doTestFailure( + fun missingAndInternal() = doTestFailure( null, null, INTERNAL ) diff --git a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/RootCommonizerTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/RootCommonizerTest.kt index 0ee1cdc05fd..c7a62caad23 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/RootCommonizerTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/core/RootCommonizerTest.kt @@ -11,7 +11,7 @@ import org.jetbrains.kotlin.builtins.jvm.JvmBuiltIns import org.jetbrains.kotlin.builtins.konan.KonanBuiltIns import org.jetbrains.kotlin.descriptors.commonizer.LeafTarget import org.jetbrains.kotlin.descriptors.commonizer.SharedTarget -import org.jetbrains.kotlin.descriptors.commonizer.Target +import org.jetbrains.kotlin.descriptors.commonizer.CommonizerTarget import org.jetbrains.kotlin.descriptors.commonizer.cir.CirRoot import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirRootFactory import org.jetbrains.kotlin.descriptors.commonizer.utils.MockBuiltInsProvider @@ -164,7 +164,7 @@ class RootCommonizerTest : AbstractCommonizerTest() { inline val JVM_BUILT_INS get() = JvmBuiltIns(LockBasedStorageManager.NO_LOCKS, JvmBuiltIns.Kind.FROM_CLASS_LOADER) inline val DEFAULT_BUILT_INS get() = DefaultBuiltIns.Instance - fun KotlinBuiltIns.toMock(target: Target) = CirRootFactory.create( + fun KotlinBuiltIns.toMock(target: CommonizerTarget) = CirRootFactory.create( target = target, builtInsClass = this::class.java.name, builtInsProvider = MockBuiltInsProvider(this) diff --git a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/utils/assertions.kt b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/utils/assertions.kt index c9a14652831..a61a2ee6ee6 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/utils/assertions.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/descriptors/commonizer/utils/assertions.kt @@ -6,7 +6,7 @@ package org.jetbrains.kotlin.descriptors.commonizer.utils import org.jetbrains.kotlin.descriptors.* -import org.jetbrains.kotlin.descriptors.commonizer.Result +import org.jetbrains.kotlin.descriptors.commonizer.CommonizerResult import org.jetbrains.kotlin.resolve.scopes.MemberScope import org.jetbrains.kotlin.test.util.DescriptorValidator.* import org.jetbrains.kotlin.types.ErrorUtils @@ -22,13 +22,13 @@ fun assertIsDirectory(file: File) { } @ExperimentalContracts -fun assertCommonizationPerformed(result: Result) { +fun assertCommonizationPerformed(result: CommonizerResult) { contract { - returns() implies (result is Result.Commonized) + returns() implies (result is CommonizerResult.Done) } - if (result !is Result.Commonized) - fail("$result is not instance of ${Result.Commonized::class}") + if (result !is CommonizerResult.Done) + fail("$result is not instance of ${CommonizerResult.Done::class}") } @ExperimentalContracts From 8a5f260d044b6891297824f606b95b32a495c696 Mon Sep 17 00:00:00 2001 From: Kristoffer Andersen Date: Tue, 24 Nov 2020 12:53:16 +0100 Subject: [PATCH 623/698] [IR] Align debugging of suspend lambdas with old BE The existing backend restores LVs and parameters from the suspend lambda fields used for spilling between suspension points, hence they are visible in the debugger as local variables, plain and simple. This PR introduces the same pattern to the IR backend, to bring the debugging experience in line with the existing backend. Both backends are still at the mercy of the liveness analysis performed in the coroutine transformer where a liveness analysis minimizes live ranges of entries in the LVT. E.g. an unused parameter will be dropped entirely. Adjusted existing test expectations accounting for the differences in LV behavior. --- .../jvm/lower/SuspendLambdaLowering.kt | 51 ++++++++++++------- .../parametersInSuspendLambda/dataClass.kt | 11 ---- .../extensionComponents.kt | 5 +- .../parametersInSuspendLambda/generic.kt | 13 +---- .../otherParameters.kt | 11 ---- .../parametersInSuspendLambda/parameters.kt | 16 +++--- .../debug/localVariableCorrectLabel.kt | 8 ++- .../localVariables/suspend/underscoreNames.kt | 15 ++---- ...KotlinEvaluateExpressionTestGenerated.java | 5 ++ ...KotlinEvaluateExpressionTestGenerated.java | 5 ++ .../coroutines/capturedReceiverName.kt | 40 +++++++++++++++ .../coroutines/capturedReceiverName.out | 10 ++++ 12 files changed, 112 insertions(+), 78 deletions(-) create mode 100644 idea/jvm-debugger/jvm-debugger-test/testData/evaluation/singleBreakpoint/coroutines/capturedReceiverName.kt create mode 100644 idea/jvm-debugger/jvm-debugger-test/testData/evaluation/singleBreakpoint/coroutines/capturedReceiverName.out diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/SuspendLambdaLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/SuspendLambdaLowering.kt index a634a30136f..b9c7b3ab7d7 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/SuspendLambdaLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/SuspendLambdaLowering.kt @@ -5,12 +5,10 @@ package org.jetbrains.kotlin.backend.jvm.lower +import com.intellij.lang.jvm.source.JvmDeclarationSearch import org.jetbrains.kotlin.backend.common.FileLoweringPass import org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext -import org.jetbrains.kotlin.backend.common.ir.copyTo -import org.jetbrains.kotlin.backend.common.ir.createImplicitParameterDeclarationWithWrappedDescriptor -import org.jetbrains.kotlin.backend.common.ir.isSuspend -import org.jetbrains.kotlin.backend.common.ir.moveBodyTo +import org.jetbrains.kotlin.backend.common.ir.* import org.jetbrains.kotlin.backend.common.lower.LocalDeclarationsLowering import org.jetbrains.kotlin.backend.common.lower.createIrBuilder import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase @@ -29,12 +27,12 @@ import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.builders.* import org.jetbrains.kotlin.ir.builders.declarations.* import org.jetbrains.kotlin.ir.declarations.* +import org.jetbrains.kotlin.ir.declarations.impl.IrVariableImpl +import org.jetbrains.kotlin.ir.descriptors.WrappedVariableDescriptor import org.jetbrains.kotlin.ir.expressions.* -import org.jetbrains.kotlin.ir.expressions.impl.IrErrorExpressionImpl -import org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBodyImpl -import org.jetbrains.kotlin.ir.expressions.impl.IrGetFieldImpl -import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl +import org.jetbrains.kotlin.ir.expressions.impl.* import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol +import org.jetbrains.kotlin.ir.symbols.impl.IrVariableSymbolImpl import org.jetbrains.kotlin.ir.types.* import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid @@ -43,6 +41,7 @@ import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid import org.jetbrains.kotlin.load.java.JavaDescriptorVisibilities import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.name.SpecialNames +import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin internal val suspendLambdaPhase = makeIrFilePhase( ::SuspendLambdaLowering, @@ -191,7 +190,7 @@ private class SuspendLambdaLowering(context: JvmBackendContext) : SuspendLowerin } val invokeSuspend = addInvokeSuspendForLambda(function, suspendLambda, parametersFields) if (function.capturesCrossinline()) { - addInvokeSuspendForInlineForLambda(invokeSuspend) + addInvokeSuspendForInlineLambda(invokeSuspend) } if (createToOverride != null) { addInvokeCallingCreate(addCreate(constructor, createToOverride, parametersFields), invokeSuspend, invokeToOverride) @@ -209,19 +208,37 @@ private class SuspendLambdaLowering(context: JvmBackendContext) : SuspendLowerin it.valueParameters[0].type.isKotlinResult() } return addFunctionOverride(superMethod, irFunction.startOffset, irFunction.endOffset).apply { - body = irFunction.moveBodyTo(this, mapOf())?.transform(object : IrElementTransformerVoid() { - override fun visitGetValue(expression: IrGetValue): IrExpression { - val parameter = (expression.symbol.owner as? IrValueParameter)?.takeIf { it.parent == irFunction } - ?: return expression - val field = fields[parameter.index + if (irFunction.extensionReceiverParameter != null) 1 else 0] + val localVals: List = fields.mapIndexed { index, field -> + buildVariable( + parent = this, + startOffset = UNDEFINED_OFFSET, + endOffset = UNDEFINED_OFFSET, + origin = IrDeclarationOrigin.DEFINED, + name = field.name, + type = field.type + ).apply { val receiver = IrGetValueImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, dispatchReceiverParameter!!.symbol) - return IrGetFieldImpl(expression.startOffset, expression.endOffset, field.symbol, field.type, receiver) + val initializerBlock = IrBlockImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, field.type) + initializerBlock.statements += IrGetFieldImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, field.symbol, field.type, receiver) + initializer = initializerBlock } - }, null) + } + + body = irFunction.moveBodyTo(this, mapOf())?.let { body -> + body.transform(object : IrElementTransformerVoid() { + override fun visitGetValue(expression: IrGetValue): IrExpression { + val parameter = (expression.symbol.owner as? IrValueParameter)?.takeIf { it.parent == irFunction } + ?: return expression + val lvar = localVals[parameter.index + if (irFunction.extensionReceiverParameter != null) 1 else 0] + return IrGetValueImpl(expression.startOffset, expression.endOffset, lvar.symbol) + } + }, null) + context.irFactory.createBlockBody(UNDEFINED_OFFSET, UNDEFINED_OFFSET, localVals + body.statements) + } } } - private fun IrClass.addInvokeSuspendForInlineForLambda(invokeSuspend: IrSimpleFunction): IrSimpleFunction { + private fun IrClass.addInvokeSuspendForInlineLambda(invokeSuspend: IrSimpleFunction): IrSimpleFunction { return addFunction( INVOKE_SUSPEND_METHOD_NAME + FOR_INLINE_SUFFIX, context.irBuiltIns.anyNType, diff --git a/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/dataClass.kt b/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/dataClass.kt index 55270f96d5d..b4e53b487cf 100644 --- a/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/dataClass.kt +++ b/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/dataClass.kt @@ -11,21 +11,10 @@ suspend fun foo(data: Data, body: suspend (Data) -> Unit) { body(data) } -// Parameters (including anonymous destructuring parameters) are moved to fields in the Continuation class for the suspend lambda class. -// However, in non-IR, the fields are first stored in local variables, and they are not read directly (even for destructuring components). -// In IR, the fields are directly read from. - // METHOD : DataClassKt$test$2.invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; -// JVM_TEMPLATES // VARIABLE : NAME=$dstr$x_param$y_param TYPE=LData; INDEX=2 // VARIABLE : NAME=x_param TYPE=Ljava/lang/String; INDEX=3 // VARIABLE : NAME=y_param TYPE=I INDEX=4 // VARIABLE : NAME=this TYPE=LDataClassKt$test$2; INDEX=0 // VARIABLE : NAME=$result TYPE=Ljava/lang/Object; INDEX=1 - -// JVM_IR_TEMPLATES -// VARIABLE : NAME=x_param TYPE=Ljava/lang/String; INDEX=2 -// VARIABLE : NAME=y_param TYPE=I INDEX=3 -// VARIABLE : NAME=this TYPE=LDataClassKt$test$2; INDEX=0 -// VARIABLE : NAME=$result TYPE=Ljava/lang/Object; INDEX=1 diff --git a/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/extensionComponents.kt b/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/extensionComponents.kt index 329c7a95838..0b83d31d4af 100644 --- a/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/extensionComponents.kt +++ b/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/extensionComponents.kt @@ -22,10 +22,6 @@ suspend fun test() = B.bar() // Local function bodies (i.e., `A.component3()`) are in a separate class (implementing FunctionN) for non-IR, and are static methods // in the enclosing class for IR. Therefore the ordinal in the suspend lambda class name is different for non-IR (`$3`) vs IR (e.g., `$2`). // -// Parameters (including anonymous destructuring parameters) are moved to fields in the Continuation class for the suspend lambda class. -// However, in non-IR, the fields are first stored in local variables, and they are not read directly (even for destructuring components). -// In IR, the fields are directly read from. - // JVM_TEMPLATES // METHOD : ExtensionComponentsKt$bar$3.invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; // VARIABLE : NAME=$dstr$x_param$y_param$z_param TYPE=LA; INDEX=2 @@ -37,6 +33,7 @@ suspend fun test() = B.bar() // JVM_IR_TEMPLATES // METHOD : ExtensionComponentsKt$bar$2.invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; +// VARIABLE : NAME=$dstr$x_param$y_param$z_param TYPE=LA; INDEX=2 // VARIABLE : NAME=x_param TYPE=Ljava/lang/String; INDEX=2 // VARIABLE : NAME=y_param TYPE=Ljava/lang/String; INDEX=3 // VARIABLE : NAME=z_param TYPE=I INDEX=4 diff --git a/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/generic.kt b/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/generic.kt index 128ad21f6ba..506636165ed 100644 --- a/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/generic.kt +++ b/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/generic.kt @@ -8,21 +8,10 @@ suspend fun test() = foo(A("OK", 1)) { (x_param, y_param) -> x_param + (y_param.toString()) } -// Parameters (including anonymous destructuring parameters) are moved to fields in the Continuation class for the suspend lambda class. -// However, in non-IR, the fields are first stored in local variables, and they are not read directly (even for destructuring components). -// In IR, the fields are directly read from. - // METHOD : GenericKt$test$2.invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; -// JVM_TEMPLATES // VARIABLE : NAME=$dstr$x_param$y_param TYPE=LA; INDEX=2 // VARIABLE : NAME=x_param TYPE=Ljava/lang/String; INDEX=3 // VARIABLE : NAME=y_param TYPE=I INDEX=4 // VARIABLE : NAME=this TYPE=LGenericKt$test$2; INDEX=0 -// VARIABLE : NAME=$result TYPE=Ljava/lang/Object; INDEX=1 - -// JVM_IR_TEMPLATES -// VARIABLE : NAME=x_param TYPE=Ljava/lang/String; INDEX=2 -// VARIABLE : NAME=y_param TYPE=I INDEX=3 -// VARIABLE : NAME=this TYPE=LGenericKt$test$2; INDEX=0 -// VARIABLE : NAME=$result TYPE=Ljava/lang/Object; INDEX=1 +// VARIABLE : NAME=$result TYPE=Ljava/lang/Object; INDEX=1 \ No newline at end of file diff --git a/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/otherParameters.kt b/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/otherParameters.kt index 6e9909a9254..94e6de609fa 100644 --- a/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/otherParameters.kt +++ b/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/otherParameters.kt @@ -7,13 +7,8 @@ suspend fun test() = foo(A("O", "K")) { i_param, (x_param, y_param), v_param -> i_param.toString() + x_param + y_param + v_param } -// Parameters (including anonymous destructuring parameters) are moved to fields in the Continuation class for the suspend lambda class. -// However, in non-IR, the fields are first stored in local variables, and they are not read directly (even for destructuring components). -// In IR, the fields are directly read from. - // METHOD : OtherParametersKt$test$2.invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; -// JVM_TEMPLATES // VARIABLE : NAME=i_param TYPE=I INDEX=2 // VARIABLE : NAME=$dstr$x_param$y_param TYPE=LA; INDEX=3 // VARIABLE : NAME=v_param TYPE=Ljava/lang/String; INDEX=4 @@ -21,9 +16,3 @@ suspend fun test() = foo(A("O", "K")) { i_param, (x_param, y_param), v_param -> // VARIABLE : NAME=y_param TYPE=Ljava/lang/String; INDEX=6 // VARIABLE : NAME=this TYPE=LOtherParametersKt$test$2; INDEX=0 // VARIABLE : NAME=$result TYPE=Ljava/lang/Object; INDEX=1 - -// JVM_IR_TEMPLATES -// VARIABLE : NAME=x_param TYPE=Ljava/lang/String; INDEX=2 -// VARIABLE : NAME=y_param TYPE=Ljava/lang/String; INDEX=3 -// VARIABLE : NAME=this TYPE=LOtherParametersKt$test$2; INDEX=0 -// VARIABLE : NAME=$result TYPE=Ljava/lang/Object; INDEX=1 diff --git a/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/parameters.kt b/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/parameters.kt index 3572a208fe1..964126eeb98 100644 --- a/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/parameters.kt +++ b/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/parameters.kt @@ -11,9 +11,7 @@ suspend fun foo(data: Data, body: suspend Long.(String, Data, Int) -> Unit) { 1L.body("OK", data, 1) } -// Parameters (including anonymous destructuring parameters) are moved to fields in the Continuation class for the suspend lambda class. -// However, in non-IR, the fields are first stored in local variables, and they are not read directly (even for destructuring components). -// In IR, the fields are directly read from. +// The JVM and IR backend differ in naming scheme of captured receiver paramters in suspend lambdas // METHOD : ParametersKt$test$2.invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; @@ -28,7 +26,11 @@ suspend fun foo(data: Data, body: suspend Long.(String, Data, Int) -> Unit) { // VARIABLE : NAME=$result TYPE=Ljava/lang/Object; INDEX=1 // JVM_IR_TEMPLATES -// VARIABLE : NAME=x TYPE=Ljava/lang/String; INDEX=2 -// VARIABLE : NAME=z TYPE=I INDEX=3 -// VARIABLE : NAME=this TYPE=LParametersKt$test$2; INDEX=0 -// VARIABLE : NAME=$result TYPE=Ljava/lang/Object; INDEX=1 +// VARIABLE : NAME=$dstr$x$_u24__u24$z TYPE=LData; INDEX=* +// VARIABLE : NAME=$result TYPE=Ljava/lang/Object; INDEX=* +// VARIABLE : NAME=i TYPE=I INDEX=* +// VARIABLE : NAME=p$ TYPE=J INDEX=* +// VARIABLE : NAME=str TYPE=Ljava/lang/String; INDEX=* +// VARIABLE : NAME=this TYPE=LParametersKt$test$2; INDEX=* +// VARIABLE : NAME=x TYPE=Ljava/lang/String; INDEX=* +// VARIABLE : NAME=z TYPE=I INDEX=* \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/coroutines/debug/localVariableCorrectLabel.kt b/compiler/testData/codegen/bytecodeText/coroutines/debug/localVariableCorrectLabel.kt index cb2b95ee703..b10d4d2438d 100644 --- a/compiler/testData/codegen/bytecodeText/coroutines/debug/localVariableCorrectLabel.kt +++ b/compiler/testData/codegen/bytecodeText/coroutines/debug/localVariableCorrectLabel.kt @@ -14,14 +14,12 @@ fun main(args: Array) { @BuilderInference suspend fun SequenceScope.awaitSeq(): Int = 42 -// label numbers differ in BEs -// JVM_TEMPLATES // 1 LOCALVARIABLE a I L[0-9]+ L18 -// 1 LINENUMBER 9 L19 /* TODO: JVM_IR does not generate LINENUMBER at the end of the lambda */ -// JVM_IR_TEMPLATES -// 1 LOCALVARIABLE a I L[0-9]+ L16 +// JVM_TEMPLATES +// 1 LINENUMBER 9 L19 + // IGNORE_BACKEND_FIR: JVM_IR diff --git a/compiler/testData/debug/localVariables/suspend/underscoreNames.kt b/compiler/testData/debug/localVariables/suspend/underscoreNames.kt index 728452ff7c3..1fc7379a13e 100644 --- a/compiler/testData/debug/localVariables/suspend/underscoreNames.kt +++ b/compiler/testData/debug/localVariables/suspend/underscoreNames.kt @@ -13,13 +13,8 @@ suspend fun box() = foo(A()) { (x_param, _, y_param) -> x_param + y_param } -// Parameters (including anonymous destructuring parameters) are moved to fields in the Continuation class for the suspend lambda class. -// However, in non-IR, the fields are first stored in local variables, and they are not read directly (even for destructuring components). -// In IR, the fields are directly read from. +// TODO: The backends disagree on the local variables in invoke/invokeSuspend methods -// The local variable for destructuring suspend lambda arguments, in this case -// `$dstr$x_param$_u24__u24$y_param`, is moved to a field in the IR backend, -// so does not figure in the LVT. // LOCAL VARIABLES // test.kt:12 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation @@ -41,16 +36,14 @@ suspend fun box() = foo(A()) { (x_param, _, y_param) -> // LOCAL VARIABLES // test.kt:12 invokeSuspend: // test.kt:5 component1: +// test.kt:12 invokeSuspend: $result:java.lang.Object=kotlin.Unit, $dstr$x_param$_u24__u24$y_param:A=A +// test.kt:7 component3: // LOCAL VARIABLES JVM // test.kt:12 invokeSuspend: $result:java.lang.Object=kotlin.Unit, $dstr$x_param$_u24__u24$y_param:A=A -// test.kt:7 component3: -// test.kt:12 invokeSuspend: $result:java.lang.Object=kotlin.Unit, $dstr$x_param$_u24__u24$y_param:A=A // LOCAL VARIABLES JVM_IR -// test.kt:12 invokeSuspend: $result:java.lang.Object=kotlin.Unit -// test.kt:7 component3: -// test.kt:12 invokeSuspend: $result:java.lang.Object=kotlin.Unit, x_param:java.lang.String="O":java.lang.String +// test.kt:12 invokeSuspend: $result:java.lang.Object=kotlin.Unit, $dstr$x_param$_u24__u24$y_param:A=A, x_param:java.lang.String="O":java.lang.String // LOCAL VARIABLES // test.kt:13 invokeSuspend: $result:java.lang.Object=kotlin.Unit, x_param:java.lang.String="O":java.lang.String, y_param:java.lang.String="K":java.lang.String diff --git a/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/IrKotlinEvaluateExpressionTestGenerated.java b/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/IrKotlinEvaluateExpressionTestGenerated.java index 00163b02c65..8b7ec2a5965 100644 --- a/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/IrKotlinEvaluateExpressionTestGenerated.java +++ b/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/IrKotlinEvaluateExpressionTestGenerated.java @@ -606,6 +606,11 @@ public class IrKotlinEvaluateExpressionTestGenerated extends AbstractIrKotlinEva runTest("idea/jvm-debugger/jvm-debugger-test/testData/evaluation/singleBreakpoint/coroutines/anyUpdateVariable.kt"); } + @TestMetadata("capturedReceiverName.kt") + public void testCapturedReceiverName() throws Exception { + runTest("idea/jvm-debugger/jvm-debugger-test/testData/evaluation/singleBreakpoint/coroutines/capturedReceiverName.kt"); + } + @TestMetadata("primitivesCoertion.kt") public void testPrimitivesCoertion() throws Exception { runTest("idea/jvm-debugger/jvm-debugger-test/testData/evaluation/singleBreakpoint/coroutines/primitivesCoertion.kt"); diff --git a/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/KotlinEvaluateExpressionTestGenerated.java b/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/KotlinEvaluateExpressionTestGenerated.java index 075e1da6b92..56165e49bf9 100644 --- a/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/KotlinEvaluateExpressionTestGenerated.java +++ b/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/KotlinEvaluateExpressionTestGenerated.java @@ -605,6 +605,11 @@ public class KotlinEvaluateExpressionTestGenerated extends AbstractKotlinEvaluat runTest("idea/jvm-debugger/jvm-debugger-test/testData/evaluation/singleBreakpoint/coroutines/anyUpdateVariable.kt"); } + @TestMetadata("capturedReceiverName.kt") + public void testCapturedReceiverName() throws Exception { + runTest("idea/jvm-debugger/jvm-debugger-test/testData/evaluation/singleBreakpoint/coroutines/capturedReceiverName.kt"); + } + @TestMetadata("primitivesCoertion.kt") public void testPrimitivesCoertion() throws Exception { runTest("idea/jvm-debugger/jvm-debugger-test/testData/evaluation/singleBreakpoint/coroutines/primitivesCoertion.kt"); diff --git a/idea/jvm-debugger/jvm-debugger-test/testData/evaluation/singleBreakpoint/coroutines/capturedReceiverName.kt b/idea/jvm-debugger/jvm-debugger-test/testData/evaluation/singleBreakpoint/coroutines/capturedReceiverName.kt new file mode 100644 index 00000000000..a6b90312804 --- /dev/null +++ b/idea/jvm-debugger/jvm-debugger-test/testData/evaluation/singleBreakpoint/coroutines/capturedReceiverName.kt @@ -0,0 +1,40 @@ +package capturedReceiverName + +import kotlin.sequences.* +import kotlin.coroutines.* + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(object : Continuation{ + override val context: CoroutineContext + get() = EmptyCoroutineContext + + override fun resumeWith(result: Result) { + result.getOrThrow() + } + }) +} + +fun main(args: Array) { + builder { + var s = "OK" + s = strChanger(s) { character -> + //Breakpoint! + character != 'a' // (2) + } + println(s) + } +} + +suspend fun strChanger(str: String, pred: suspend (Char) -> Boolean): String { + var result = "" + str.forEach { + if (pred(it)) { + result += it + } + } + return result +} + +// EXPRESSION: character +// RESULT: 79: C +// 79.toChar() == 'O' \ No newline at end of file diff --git a/idea/jvm-debugger/jvm-debugger-test/testData/evaluation/singleBreakpoint/coroutines/capturedReceiverName.out b/idea/jvm-debugger/jvm-debugger-test/testData/evaluation/singleBreakpoint/coroutines/capturedReceiverName.out new file mode 100644 index 00000000000..4370c48eaf0 --- /dev/null +++ b/idea/jvm-debugger/jvm-debugger-test/testData/evaluation/singleBreakpoint/coroutines/capturedReceiverName.out @@ -0,0 +1,10 @@ +LineBreakpoint created at capturedReceiverName.kt:22 +Run Java +Connected to the target VM +capturedReceiverName.kt:22 +Compile bytecode for character +capturedReceiverName.kt:22 +Disconnected from the target VM + +Process finished with exit code 0 +OK From 2201dd51984760d91f646135cc322a92da4c0d37 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 10 Dec 2020 19:38:37 +0100 Subject: [PATCH 624/698] FIR: make FirSyntheticPropertiesScope to be name aware --- .../kotlin/fir/resolve/calls/Synthetics.kt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Synthetics.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Synthetics.kt index 604d216b827..25e195c42c2 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Synthetics.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Synthetics.kt @@ -11,10 +11,7 @@ import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction import org.jetbrains.kotlin.fir.declarations.isStatic import org.jetbrains.kotlin.fir.declarations.synthetic.buildSyntheticProperty import org.jetbrains.kotlin.fir.dispatchReceiverClassOrNull -import org.jetbrains.kotlin.fir.scopes.FirScope -import org.jetbrains.kotlin.fir.scopes.FirTypeScope -import org.jetbrains.kotlin.fir.scopes.ProcessorAction -import org.jetbrains.kotlin.fir.scopes.processOverriddenFunctionsAndSelf +import org.jetbrains.kotlin.fir.scopes.* import org.jetbrains.kotlin.fir.symbols.CallableId import org.jetbrains.kotlin.fir.symbols.StandardClassIds import org.jetbrains.kotlin.fir.symbols.SyntheticSymbol @@ -38,7 +35,7 @@ class FirSyntheticFunctionSymbol( class FirSyntheticPropertiesScope( val session: FirSession, private val baseScope: FirTypeScope -) : FirScope() { +) : FirScope(), FirContainingNamesAwareScope { private val syntheticNamesProvider = session.syntheticNamesProvider override fun processPropertiesByName(name: Name, processor: (FirVariableSymbol<*>) -> Unit) { @@ -50,6 +47,12 @@ class FirSyntheticPropertiesScope( } } + override fun getCallableNames(): Set = baseScope.getCallableNames().flatMapTo(hashSetOf()) { propertyName -> + syntheticNamesProvider.possiblePropertyNamesByAccessorName(propertyName) + } + + override fun getClassifierNames(): Set = emptySet() + private fun checkGetAndCreateSynthetic( propertyName: Name, getterName: Name, From 48b71505663290641fa70d44132cf6cf2403a61e Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 10 Dec 2020 19:40:08 +0100 Subject: [PATCH 625/698] FIR IDE: split KtPropertySymbol into KtKotlinPropertySymbol and KtJavaSyntheticPropertySymbol --- .../api/symbols/KtVariableLikeSymbol.kt | 29 ++++-- .../asJava/classes/FirLightClassForFacade.kt | 4 +- .../asJava/classes/FirLightClassForSymbol.kt | 8 +- .../idea/asJava/classes/firLightClassUtils.kt | 17 ++-- .../fields/FirLightFieldForPropertySymbol.kt | 2 + .../frontend/api/fir/KtSymbolByFirBuilder.kt | 6 +- .../KtFirCompletionCandidateChecker.kt | 5 +- ...Symbol.kt => KtFirKotlinPropertySymbol.kt} | 10 +- .../KtFirSyntheticJavaPropertySymbol.kt | 91 +++++++++++++++++++ .../memberScopeByFqName/MutableList.txt | 4 +- .../memberScopeByFqName/java.lang.String.txt | 4 +- .../symbolPointer/memberProperties.kt | 8 +- .../symbolPointer/topLevelProperties.kt | 8 +- .../testData/symbolsByPsi/anonymousObject.kt | 8 +- .../testData/symbolsByPsi/classMembes.kt | 4 +- 15 files changed, 173 insertions(+), 35 deletions(-) rename idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/{KtFirPropertySymbol.kt => KtFirKotlinPropertySymbol.kt} (91%) create mode 100644 idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirSyntheticJavaPropertySymbol.kt diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtVariableLikeSymbol.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtVariableLikeSymbol.kt index e3bb6fed783..d21d0ecbcb6 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtVariableLikeSymbol.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtVariableLikeSymbol.kt @@ -9,6 +9,7 @@ import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.* import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtSymbolPointer import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.Name sealed class KtVariableLikeSymbol : KtCallableSymbol(), KtTypedSymbol, KtNamedSymbol, KtSymbolWithKind { abstract override fun createPointer(): KtSymbolPointer @@ -39,24 +40,23 @@ abstract class KtJavaFieldSymbol : abstract override fun createPointer(): KtSymbolPointer } -abstract class KtPropertySymbol : KtVariableSymbol(), +sealed class KtPropertySymbol : KtVariableSymbol(), KtPossibleExtensionSymbol, KtSymbolWithModality, KtSymbolWithVisibility, KtAnnotatedSymbol, KtSymbolWithKind { - abstract val callableIdIfNonLocal: FqName? + abstract val hasGetter: Boolean + abstract val hasSetter: Boolean abstract val getter: KtPropertyGetterSymbol? abstract val setter: KtPropertySetterSymbol? + abstract val callableIdIfNonLocal: FqName? + abstract val hasBackingField: Boolean - abstract val isLateInit: Boolean - - abstract val isConst: Boolean - abstract val isOverride: Boolean abstract val initializer: KtConstantValue? @@ -64,6 +64,23 @@ abstract class KtPropertySymbol : KtVariableSymbol(), abstract override fun createPointer(): KtSymbolPointer } +abstract class KtKotlinPropertySymbol : KtPropertySymbol() { + abstract val isLateInit: Boolean + + abstract val isConst: Boolean +} + +abstract class KtSyntheticJavaPropertySymbol : KtPropertySymbol() { + final override val hasBackingField: Boolean get() = true + final override val hasGetter: Boolean get() = true + final override val symbolKind: KtSymbolKind get() = KtSymbolKind.MEMBER + + abstract override val getter: KtPropertyGetterSymbol + + abstract val javaGetterName: Name + abstract val javaSetterName: Name? +} + abstract class KtLocalVariableSymbol : KtVariableSymbol(), KtSymbolWithKind { abstract override fun createPointer(): KtSymbolPointer } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt index 97916af0e54..a73ad96e8bc 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt @@ -25,6 +25,7 @@ import org.jetbrains.kotlin.idea.asJava.classes.createField import org.jetbrains.kotlin.idea.asJava.classes.createMethods import org.jetbrains.kotlin.idea.frontend.api.analyze import org.jetbrains.kotlin.idea.frontend.api.symbols.KtCallableSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtKotlinPropertySymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertySymbol import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.load.java.structure.LightClassOriginKind @@ -116,7 +117,8 @@ class FirLightClassForFacade( } for (propertySymbol in propertySymbols) { - val forceStaticAndPropertyVisibility = propertySymbol.isConst || propertySymbol.hasJvmFieldAnnotation() + val forceStaticAndPropertyVisibility = propertySymbol is KtKotlinPropertySymbol && propertySymbol.isConst + || propertySymbol.hasJvmFieldAnnotation() createField( propertySymbol, nameGenerator, diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt index 4d364aa92e7..9ba4f8a9fbc 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForSymbol.kt @@ -96,7 +96,7 @@ internal open class FirLightClassForSymbol( } }.applyIf(classOrObjectSymbol.classKind == KtClassKind.OBJECT) { filterNot { - it is KtPropertySymbol && it.isConst + it is KtKotlinPropertySymbol && it.isConst } } @@ -124,7 +124,7 @@ internal open class FirLightClassForSymbol( analyzeWithSymbolAsContext(this) { getDeclaredMemberScope().getCallableSymbols() .filterIsInstance() - .filter { it.hasJvmFieldAnnotation() || it.hasJvmStaticAnnotation() || it.isConst } + .filter { it.hasJvmFieldAnnotation() || it.hasJvmStaticAnnotation() || it is KtKotlinPropertySymbol && it.isConst } .mapTo(result) { FirLightFieldForPropertySymbol( propertySymbol = it, @@ -159,7 +159,7 @@ internal open class FirLightClassForSymbol( val propertySymbols = classOrObjectSymbol.getDeclaredMemberScope().getCallableSymbols() .filterIsInstance() .applyIf(classOrObjectSymbol.classKind == KtClassKind.COMPANION_OBJECT) { - filterNot { it.hasJvmFieldAnnotation() || it.isConst } + filterNot { it.hasJvmFieldAnnotation() || it is KtKotlinPropertySymbol && it.isConst } } val nameGenerator = FirLightField.FieldNameGenerator() @@ -169,7 +169,7 @@ internal open class FirLightClassForSymbol( for (propertySymbol in propertySymbols) { val isJvmField = propertySymbol.hasJvmFieldAnnotation() val isJvmStatic = propertySymbol.hasJvmStaticAnnotation() - val forceStatic = isObject && (propertySymbol.isConst || isJvmStatic || isJvmField) + val forceStatic = isObject && (propertySymbol is KtKotlinPropertySymbol && propertySymbol.isConst || isJvmStatic || isJvmField) val takePropertyVisibility = !isCompanionObject && (isJvmField || (isObject && isJvmStatic)) createField( diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt index eb6ff278dd1..d8207fd284c 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt @@ -210,13 +210,16 @@ internal fun FirLightClassBase.createField( takePropertyVisibility: Boolean, result: MutableList ) { - fun hasBackingField(property: KtPropertySymbol): Boolean { - if (property.modality == KtCommonSymbolModality.ABSTRACT) return false - if (property.isLateInit) return true - //IS PARAMETER -> true - if (property.getter == null && property.setter == null) return true - if (property.hasJvmSyntheticAnnotation(AnnotationUseSiteTarget.FIELD)) return false - return property.hasBackingField + fun hasBackingField(property: KtPropertySymbol): Boolean = when (property) { + is KtSyntheticJavaPropertySymbol -> true + is KtKotlinPropertySymbol -> when { + property.modality == KtCommonSymbolModality.ABSTRACT -> false + property.isLateInit -> true + //IS PARAMETER -> true + !property.hasGetter && !property.hasSetter -> true + property.hasJvmSyntheticAnnotation(AnnotationUseSiteTarget.FIELD) -> false + else -> property.hasBackingField + } } if (!hasBackingField(declaration)) return diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt index 69b198ce4ab..e883a8701a0 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/fields/FirLightFieldForPropertySymbol.kt @@ -11,6 +11,7 @@ import org.jetbrains.kotlin.asJava.classes.lazyPub import org.jetbrains.kotlin.asJava.elements.FirLightIdentifier import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget import org.jetbrains.kotlin.fir.declarations.FirResolvePhase +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtKotlinPropertySymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertySymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSimpleConstantValue import org.jetbrains.kotlin.psi.KtDeclaration @@ -97,6 +98,7 @@ internal class FirLightFieldForPropertySymbol( override fun getModifierList(): PsiModifierList = _modifierList private val _initializer by lazyPub { + if (propertySymbol !is KtKotlinPropertySymbol) return@lazyPub null if (!propertySymbol.isConst) return@lazyPub null if (!propertySymbol.isVal) return@lazyPub null (propertySymbol.initializer as? KtSimpleConstantValue<*>)?.createPsiLiteral(this) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtSymbolByFirBuilder.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtSymbolByFirBuilder.kt index f9c9a4a7f86..edec83d27c8 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtSymbolByFirBuilder.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtSymbolByFirBuilder.kt @@ -10,7 +10,7 @@ import com.intellij.openapi.project.Project import com.intellij.psi.search.GlobalSearchScope import org.jetbrains.kotlin.fir.FirElement import org.jetbrains.kotlin.fir.declarations.* -import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall +import org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticProperty import org.jetbrains.kotlin.fir.resolve.firSymbolProvider import org.jetbrains.kotlin.fir.resolve.getSymbolByLookupTag import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag @@ -23,7 +23,6 @@ import org.jetbrains.kotlin.idea.fir.low.level.api.api.FirModuleResolveState import org.jetbrains.kotlin.idea.frontend.api.* import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.* import org.jetbrains.kotlin.idea.frontend.api.fir.types.* -import org.jetbrains.kotlin.idea.frontend.api.fir.utils.threadLocal import org.jetbrains.kotlin.idea.frontend.api.fir.utils.weakRef import org.jetbrains.kotlin.idea.frontend.api.symbols.* import org.jetbrains.kotlin.idea.frontend.api.types.KtType @@ -143,7 +142,8 @@ internal class KtSymbolByFirBuilder private constructor( fun buildVariableSymbol(fir: FirProperty): KtVariableSymbol = symbolsCache.cache(fir) { when { fir.isLocal -> KtFirLocalVariableSymbol(fir, resolveState, token, this) - else -> KtFirPropertySymbol(fir, resolveState, token, this) + fir is FirSyntheticProperty -> KtFirSyntheticJavaPropertySymbol(fir, resolveState, token, this) + else -> KtFirKotlinPropertySymbol(fir, resolveState, token, this) } } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCompletionCandidateChecker.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCompletionCandidateChecker.kt index 8767bd0a20b..69e2d9da2f8 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCompletionCandidateChecker.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirCompletionCandidateChecker.kt @@ -5,7 +5,6 @@ package org.jetbrains.kotlin.idea.frontend.api.fir.components -import com.jetbrains.rd.util.getOrCreate import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.expressions.FirExpression import org.jetbrains.kotlin.fir.resolve.calls.ImplicitReceiverValue @@ -19,7 +18,7 @@ import org.jetbrains.kotlin.idea.frontend.api.ValidityToken import org.jetbrains.kotlin.idea.frontend.api.components.KtCompletionCandidateChecker import org.jetbrains.kotlin.idea.frontend.api.fir.KtFirAnalysisSession import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirFunctionSymbol -import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirPropertySymbol +import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirKotlinPropertySymbol import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirSymbol import org.jetbrains.kotlin.idea.frontend.api.fir.utils.EnclosingDeclarationContext import org.jetbrains.kotlin.idea.frontend.api.fir.utils.buildCompletionContext @@ -52,7 +51,7 @@ internal class KtFirCompletionCandidateChecker( val functionFits = firSymbolForCandidate.withResolvedFirOfType { firFunction -> checkExtension(firFunction, originalFile, nameExpression, possibleExplicitReceiver) } - val propertyFits = firSymbolForCandidate.withResolvedFirOfType { firProperty -> + val propertyFits = firSymbolForCandidate.withResolvedFirOfType { firProperty -> checkExtension(firProperty, originalFile, nameExpression, possibleExplicitReceiver) } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirKotlinPropertySymbol.kt similarity index 91% rename from idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySymbol.kt rename to idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirKotlinPropertySymbol.kt index ac2df6b9a41..98dad745964 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirPropertySymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirKotlinPropertySymbol.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.idea.frontend.api.fir.symbols import com.intellij.psi.PsiElement import org.jetbrains.kotlin.fir.containingClass import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticProperty import org.jetbrains.kotlin.idea.fir.findPsi import org.jetbrains.kotlin.idea.fir.low.level.api.api.FirModuleResolveState import org.jetbrains.kotlin.idea.frontend.api.ValidityToken @@ -17,6 +18,7 @@ import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.pointers.createSignatu import org.jetbrains.kotlin.idea.frontend.api.fir.utils.convertAnnotation import org.jetbrains.kotlin.idea.frontend.api.fir.utils.convertConstantExpression import org.jetbrains.kotlin.idea.frontend.api.fir.utils.firRef +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtKotlinPropertySymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertyGetterSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertySetterSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertySymbol @@ -28,14 +30,15 @@ import org.jetbrains.kotlin.idea.frontend.api.types.KtType import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name -internal class KtFirPropertySymbol( +internal class KtFirKotlinPropertySymbol( fir: FirProperty, resolveState: FirModuleResolveState, override val token: ValidityToken, private val builder: KtSymbolByFirBuilder -) : KtPropertySymbol(), KtFirSymbol { +) : KtKotlinPropertySymbol(), KtFirSymbol { init { assert(!fir.isLocal) + check(fir !is FirSyntheticProperty) } override val firRef = firRef(fir, resolveState) @@ -84,6 +87,9 @@ internal class KtFirPropertySymbol( override val isOverride: Boolean get() = firRef.withFir { it.isOverride } + override val hasGetter: Boolean get() = firRef.withFir { it.getter != null } + override val hasSetter: Boolean get() = firRef.withFir { it.setter != null } + override fun createPointer(): KtSymbolPointer { KtPsiBasedSymbolPointer.createForSymbolFromSource(this)?.let { return it } return when (symbolKind) { diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirSyntheticJavaPropertySymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirSyntheticJavaPropertySymbol.kt new file mode 100644 index 00000000000..cc0d7697cc9 --- /dev/null +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirSyntheticJavaPropertySymbol.kt @@ -0,0 +1,91 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.frontend.api.fir.symbols + +import com.intellij.psi.PsiElement +import org.jetbrains.kotlin.fir.containingClass +import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticProperty +import org.jetbrains.kotlin.idea.fir.findPsi +import org.jetbrains.kotlin.idea.fir.low.level.api.api.FirModuleResolveState +import org.jetbrains.kotlin.idea.frontend.api.ValidityToken +import org.jetbrains.kotlin.idea.frontend.api.fir.KtSymbolByFirBuilder +import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.pointers.KtFirMemberPropertySymbolPointer +import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.pointers.createSignature +import org.jetbrains.kotlin.idea.frontend.api.fir.utils.convertAnnotation +import org.jetbrains.kotlin.idea.frontend.api.fir.utils.convertConstantExpression +import org.jetbrains.kotlin.idea.frontend.api.fir.utils.firRef +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertyGetterSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertySetterSymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertySymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSyntheticJavaPropertySymbol +import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.* +import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.CanNotCreateSymbolPointerForLocalLibraryDeclarationException +import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtPsiBasedSymbolPointer +import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtSymbolPointer +import org.jetbrains.kotlin.idea.frontend.api.types.KtType +import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.Name + +internal class KtFirSyntheticJavaPropertySymbol( + fir: FirSyntheticProperty, + resolveState: FirModuleResolveState, + override val token: ValidityToken, + private val builder: KtSymbolByFirBuilder +) : KtSyntheticJavaPropertySymbol(), KtFirSymbol { + override val firRef = firRef(fir, resolveState) + override val psi: PsiElement? by firRef.withFirAndCache { fir -> fir.findPsi(fir.session) } + + override val isVal: Boolean get() = firRef.withFir { it.isVal } + override val name: Name get() = firRef.withFir { it.name } + override val type: KtType by firRef.withFirAndCache(FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE) { fir -> builder.buildKtType(fir.returnTypeRef) } + override val receiverType: KtType? by firRef.withFirAndCache(FirResolvePhase.TYPES) { fir -> fir.receiverTypeRef?.let(builder::buildKtType) } + override val isExtension: Boolean get() = firRef.withFir { it.receiverTypeRef != null } + override val initializer: KtConstantValue? by firRef.withFirAndCache(FirResolvePhase.BODY_RESOLVE) { fir -> fir.initializer?.convertConstantExpression() } + + + override val modality: KtCommonSymbolModality get() = getModality() + + override val visibility: KtSymbolVisibility get() = getVisibility() + + + override val annotations: List by firRef.withFirAndCache(FirResolvePhase.TYPES) { + convertAnnotation(it) + } + + override val callableIdIfNonLocal: FqName? + get() = firRef.withFir { fir -> + fir.symbol.callableId.takeUnless { fir.isLocal }?.asFqNameForDebugInfo() + } + + override val getter: KtPropertyGetterSymbol by firRef.withFirAndCache(FirResolvePhase.RAW_FIR) { property -> + property.getter.let { builder.buildPropertyAccessorSymbol(it) } as KtPropertyGetterSymbol + } + + override val setter: KtPropertySetterSymbol? by firRef.withFirAndCache(FirResolvePhase.RAW_FIR) { property -> + property.setter?.let { builder.buildPropertyAccessorSymbol(it) } as? KtPropertySetterSymbol + } + + override val javaGetterName: Name get() = firRef.withFir { it.getter.delegate.name } + override val javaSetterName: Name? get() = firRef.withFir { it.setter?.delegate?.name } + + override val isOverride: Boolean get() = firRef.withFir { it.isOverride } + + override val hasSetter: Boolean get() = firRef.withFir { it.setter != null } + + override fun createPointer(): KtSymbolPointer { + KtPsiBasedSymbolPointer.createForSymbolFromSource(this)?.let { return it } + return when (symbolKind) { + KtSymbolKind.TOP_LEVEL -> TODO("Creating symbol for top level fun is not supported yet") + KtSymbolKind.NON_PROPERTY_PARAMETER -> TODO("Creating symbol for top level parameters is not supported yet") + KtSymbolKind.MEMBER -> KtFirMemberPropertySymbolPointer( + firRef.withFir { it.containingClass()?.classId ?: error("ClassId should not be null for member property") }, + firRef.withFir { it.createSignature() } + ) + KtSymbolKind.LOCAL -> throw CanNotCreateSymbolPointerForLocalLibraryDeclarationException(name.asString()) + } + } +} diff --git a/idea/idea-frontend-fir/testData/memberScopeByFqName/MutableList.txt b/idea/idea-frontend-fir/testData/memberScopeByFqName/MutableList.txt index 22c0521ea7e..a614fbd848b 100644 --- a/idea/idea-frontend-fir/testData/memberScopeByFqName/MutableList.txt +++ b/idea/idea-frontend-fir/testData/memberScopeByFqName/MutableList.txt @@ -381,11 +381,13 @@ KtFirFunctionSymbol: valueParameters: [KtFirFunctionValueParameterSymbol(element)] visibility: PUBLIC -KtFirPropertySymbol: +KtFirKotlinPropertySymbol: annotations: [] callableIdIfNonLocal: kotlin.collections.List.size getter: null hasBackingField: false + hasGetter: false + hasSetter: false initializer: null isConst: false isExtension: false diff --git a/idea/idea-frontend-fir/testData/memberScopeByFqName/java.lang.String.txt b/idea/idea-frontend-fir/testData/memberScopeByFqName/java.lang.String.txt index 1a965951b13..818effe453b 100644 --- a/idea/idea-frontend-fir/testData/memberScopeByFqName/java.lang.String.txt +++ b/idea/idea-frontend-fir/testData/memberScopeByFqName/java.lang.String.txt @@ -69,11 +69,13 @@ KtFirFunctionSymbol: valueParameters: [] visibility: PUBLIC -KtFirPropertySymbol: +KtFirKotlinPropertySymbol: annotations: [] callableIdIfNonLocal: kotlin.CharSequence.length getter: KtFirPropertyGetterSymbol() hasBackingField: true + hasGetter: true + hasSetter: false initializer: null isConst: false isExtension: false diff --git a/idea/idea-frontend-fir/testData/symbolPointer/memberProperties.kt b/idea/idea-frontend-fir/testData/symbolPointer/memberProperties.kt index 6c22be81a06..a4abfb50b6d 100644 --- a/idea/idea-frontend-fir/testData/symbolPointer/memberProperties.kt +++ b/idea/idea-frontend-fir/testData/symbolPointer/memberProperties.kt @@ -4,11 +4,13 @@ class A { } // SYMBOLS: -KtFirPropertySymbol: +KtFirKotlinPropertySymbol: annotations: [] callableIdIfNonLocal: A.x getter: KtFirPropertyGetterSymbol() hasBackingField: true + hasGetter: true + hasSetter: false initializer: 10 isConst: false isExtension: false @@ -35,11 +37,13 @@ KtFirPropertyGetterSymbol: type: kotlin/Int visibility: PUBLIC -KtFirPropertySymbol: +KtFirKotlinPropertySymbol: annotations: [] callableIdIfNonLocal: A.y getter: KtFirPropertyGetterSymbol() hasBackingField: false + hasGetter: true + hasSetter: false initializer: null isConst: false isExtension: true diff --git a/idea/idea-frontend-fir/testData/symbolPointer/topLevelProperties.kt b/idea/idea-frontend-fir/testData/symbolPointer/topLevelProperties.kt index 7e1b5e97679..844e3c8751a 100644 --- a/idea/idea-frontend-fir/testData/symbolPointer/topLevelProperties.kt +++ b/idea/idea-frontend-fir/testData/symbolPointer/topLevelProperties.kt @@ -2,11 +2,13 @@ val x: Int = 10 val Int.y get() = this // SYMBOLS: -KtFirPropertySymbol: +KtFirKotlinPropertySymbol: annotations: [] callableIdIfNonLocal: x getter: KtFirPropertyGetterSymbol() hasBackingField: true + hasGetter: true + hasSetter: false initializer: 10 isConst: false isExtension: false @@ -33,11 +35,13 @@ KtFirPropertyGetterSymbol: type: kotlin/Int visibility: PUBLIC -KtFirPropertySymbol: +KtFirKotlinPropertySymbol: annotations: [] callableIdIfNonLocal: y getter: KtFirPropertyGetterSymbol() hasBackingField: false + hasGetter: true + hasSetter: false initializer: null isConst: false isExtension: true diff --git a/idea/idea-frontend-fir/testData/symbolsByPsi/anonymousObject.kt b/idea/idea-frontend-fir/testData/symbolsByPsi/anonymousObject.kt index 41f140b6433..00273c4e079 100644 --- a/idea/idea-frontend-fir/testData/symbolsByPsi/anonymousObject.kt +++ b/idea/idea-frontend-fir/testData/symbolsByPsi/anonymousObject.kt @@ -28,11 +28,13 @@ KtFirFunctionSymbol: valueParameters: [] visibility: PUBLIC -KtFirPropertySymbol: +KtFirKotlinPropertySymbol: annotations: [] callableIdIfNonLocal: .data getter: KtFirPropertyGetterSymbol() hasBackingField: true + hasGetter: true + hasSetter: false initializer: 123 isConst: false isExtension: false @@ -54,11 +56,13 @@ KtFirAnonymousObjectSymbol: superTypes: [java/lang/Runnable] symbolKind: LOCAL -KtFirPropertySymbol: +KtFirKotlinPropertySymbol: annotations: [] callableIdIfNonLocal: AnonymousContainer.anonymousObject getter: KtFirPropertyGetterSymbol() hasBackingField: true + hasGetter: true + hasSetter: false initializer: KtUnsupportedConstantValue isConst: false isExtension: false diff --git a/idea/idea-frontend-fir/testData/symbolsByPsi/classMembes.kt b/idea/idea-frontend-fir/testData/symbolsByPsi/classMembes.kt index 34c2026ef92..09c1a8f21d3 100644 --- a/idea/idea-frontend-fir/testData/symbolsByPsi/classMembes.kt +++ b/idea/idea-frontend-fir/testData/symbolsByPsi/classMembes.kt @@ -5,11 +5,13 @@ class A { // SYMBOLS: /* -KtFirPropertySymbol: +KtFirKotlinPropertySymbol: annotations: [] callableIdIfNonLocal: A.a getter: KtFirPropertyGetterSymbol() hasBackingField: true + hasGetter: true + hasSetter: false initializer: 10 isConst: false isExtension: false From a0651cdba7fc233662c1eab0bd10a99afd804e38 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 10 Dec 2020 19:40:38 +0100 Subject: [PATCH 626/698] FIR IDE: add Java synthetic properties support for completion --- .../basic/java/JavaSyntheticProperty.kt | 8 ++++++++ .../handlers/basic/SyntheticExtension.kt | 2 ++ .../handlers/basic/SyntheticExtension.kt.after | 2 ++ .../test/JvmBasicCompletionTestGenerated.java | 5 +++++ .../completion/KotlinFirLookupElementFactory.kt | 16 +++++++++++++++- ...ighLevelJvmBasicCompletionTestGenerated.java | 5 +++++ .../api/fir/components/KtFirScopeProvider.kt | 17 ++++++++++++----- 7 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 idea/idea-completion/testData/basic/java/JavaSyntheticProperty.kt diff --git a/idea/idea-completion/testData/basic/java/JavaSyntheticProperty.kt b/idea/idea-completion/testData/basic/java/JavaSyntheticProperty.kt new file mode 100644 index 00000000000..435127e68d1 --- /dev/null +++ b/idea/idea-completion/testData/basic/java/JavaSyntheticProperty.kt @@ -0,0 +1,8 @@ +// FIR_COMPARISON + +fun foo(a: java.lang.Thread) { + a.na +} + + +// EXIST: {"lookupString":"name","tailText":" (from getName()/setName())","allLookupStrings":"getName, name, setName","itemText":"name"} diff --git a/idea/idea-completion/testData/handlers/basic/SyntheticExtension.kt b/idea/idea-completion/testData/handlers/basic/SyntheticExtension.kt index a4f68a36f93..5899e318f8f 100644 --- a/idea/idea-completion/testData/handlers/basic/SyntheticExtension.kt +++ b/idea/idea-completion/testData/handlers/basic/SyntheticExtension.kt @@ -1,3 +1,5 @@ +// FIR_COMPARISON + import java.io.File fun foo(file: File) { diff --git a/idea/idea-completion/testData/handlers/basic/SyntheticExtension.kt.after b/idea/idea-completion/testData/handlers/basic/SyntheticExtension.kt.after index 69f9eb2d9b1..f0fdc1ea787 100644 --- a/idea/idea-completion/testData/handlers/basic/SyntheticExtension.kt.after +++ b/idea/idea-completion/testData/handlers/basic/SyntheticExtension.kt.after @@ -1,3 +1,5 @@ +// FIR_COMPARISON + import java.io.File fun foo(file: File) { diff --git a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/JvmBasicCompletionTestGenerated.java b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/JvmBasicCompletionTestGenerated.java index 7a18e4ff642..76be124f413 100644 --- a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/JvmBasicCompletionTestGenerated.java +++ b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/JvmBasicCompletionTestGenerated.java @@ -2950,6 +2950,11 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT runTest("idea/idea-completion/testData/basic/java/JavaPackage.kt"); } + @TestMetadata("JavaSyntheticProperty.kt") + public void testJavaSyntheticProperty() throws Exception { + runTest("idea/idea-completion/testData/basic/java/JavaSyntheticProperty.kt"); + } + @TestMetadata("KProperty.kt") public void testKProperty() throws Exception { runTest("idea/idea-completion/testData/basic/java/KProperty.kt"); diff --git a/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/KotlinFirLookupElementFactory.kt b/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/KotlinFirLookupElementFactory.kt index b842a33a884..1b75bed1628 100644 --- a/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/KotlinFirLookupElementFactory.kt +++ b/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/KotlinFirLookupElementFactory.kt @@ -34,7 +34,7 @@ internal class KotlinFirLookupElementFactory { fun KtAnalysisSession.createLookupElement(symbol: KtNamedSymbol): LookupElement? { val elementBuilder = when (symbol) { is KtFunctionSymbol -> with(functionLookupElementFactory) { createLookup(symbol) } - is KtVariableLikeSymbol -> with(variableLookupElementFactory) { createLookup(symbol) } + is KtVariableLikeSymbol -> with(variableLookupElementFactory) { createLookup(symbol) } is KtClassLikeSymbol -> classLookupElementFactory.createLookup(symbol) is KtTypeParameterSymbol -> typeParameterLookupElementFactory.createLookup(symbol) else -> throw IllegalArgumentException("Cannot create a lookup element for $symbol") @@ -67,9 +67,23 @@ private class VariableLookupElementFactory { fun KtAnalysisSession.createLookup(symbol: KtVariableLikeSymbol): LookupElementBuilder { return LookupElementBuilder.create(UniqueLookupObject(), symbol.name.asString()) .withTypeText(symbol.type.render()) + .markIfSyntheticJavaProperty(symbol) .withInsertHandler(createInsertHandler(symbol)) } + private fun LookupElementBuilder.markIfSyntheticJavaProperty(symbol: KtVariableLikeSymbol): LookupElementBuilder = when (symbol) { + is KtSyntheticJavaPropertySymbol -> { + val getterName = symbol.javaGetterName.asString() + val setterName = symbol.javaSetterName?.asString() + this.withTailText((" (from ${buildSyntheticPropertyTailText(getterName, setterName)})")) + .withLookupStrings(listOfNotNull(getterName, setterName)) + } + else -> this + } + + private fun buildSyntheticPropertyTailText(getterName: String, setterName: String?): String = + if (setterName != null) "$getterName()/$setterName()" else "$getterName()" + private fun createInsertHandler(symbol: KtVariableLikeSymbol): InsertHandler { return QuotedNamesAwareInsertionHandler(symbol.name) } diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/HighLevelJvmBasicCompletionTestGenerated.java b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/HighLevelJvmBasicCompletionTestGenerated.java index e987af8d50a..9e2cc499aff 100644 --- a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/HighLevelJvmBasicCompletionTestGenerated.java +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/HighLevelJvmBasicCompletionTestGenerated.java @@ -2950,6 +2950,11 @@ public class HighLevelJvmBasicCompletionTestGenerated extends AbstractHighLevelJ runTest("idea/idea-completion/testData/basic/java/JavaPackage.kt"); } + @TestMetadata("JavaSyntheticProperty.kt") + public void testJavaSyntheticProperty() throws Exception { + runTest("idea/idea-completion/testData/basic/java/JavaSyntheticProperty.kt"); + } + @TestMetadata("KProperty.kt") public void testKProperty() throws Exception { runTest("idea/idea-completion/testData/basic/java/KProperty.kt"); diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt index 6024798f860..ee24918c7de 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirScopeProvider.kt @@ -6,15 +6,14 @@ package org.jetbrains.kotlin.idea.frontend.api.fir.components import com.intellij.openapi.project.Project +import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.declarations.FirAnonymousObject import org.jetbrains.kotlin.fir.declarations.FirClass import org.jetbrains.kotlin.fir.declarations.FirResolvePhase +import org.jetbrains.kotlin.fir.resolve.calls.FirSyntheticPropertiesScope import org.jetbrains.kotlin.fir.resolve.scope -import org.jetbrains.kotlin.fir.scopes.FakeOverrideTypeCalculator -import org.jetbrains.kotlin.fir.scopes.FirContainingNamesAwareScope -import org.jetbrains.kotlin.fir.scopes.FirScope +import org.jetbrains.kotlin.fir.scopes.* import org.jetbrains.kotlin.fir.scopes.impl.* -import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope import org.jetbrains.kotlin.idea.fir.low.level.api.api.FirModuleResolveState import org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacadeForCompletion import org.jetbrains.kotlin.idea.fir.low.level.api.api.getFirFile @@ -122,9 +121,17 @@ internal class KtFirScopeProvider( firResolveState.firTransformerProvider.getScopeSession(firSession), FakeOverrideTypeCalculator.Forced ) ?: return null - return convertToKtScope(firTypeScope) + return getCompositeScope( + listOf( + convertToKtScope(firTypeScope), + firTypeScope.getSyntheticPropertiesScope(firSession) + ) + ) } + private fun FirTypeScope.getSyntheticPropertiesScope(firSession: FirSession): KtScope = + convertToKtScope(FirSyntheticPropertiesScope(firSession, this)) + override fun getScopeContextForPosition( originalFile: KtFile, positionInFakeFile: KtElement From 0e12c55770e7cbc487297900440054d400affc15 Mon Sep 17 00:00:00 2001 From: Alexander Shabalin Date: Tue, 24 Nov 2020 15:57:53 +0300 Subject: [PATCH 627/698] Fix detectCycles (#4549) --- kotlin-native/runtime/src/legacymm/cpp/Memory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kotlin-native/runtime/src/legacymm/cpp/Memory.cpp b/kotlin-native/runtime/src/legacymm/cpp/Memory.cpp index a812fc6931b..a6c365f417e 100644 --- a/kotlin-native/runtime/src/legacymm/cpp/Memory.cpp +++ b/kotlin-native/runtime/src/legacymm/cpp/Memory.cpp @@ -3470,7 +3470,7 @@ KBoolean Kotlin_native_internal_GC_getTuneThreshold(KRef) { OBJ_GETTER(Kotlin_native_internal_GC_detectCycles, KRef) { #if USE_CYCLE_DETECTOR - if (!KonanNeedDebugInfo || !Kotlin_memoryLeakCheckerEnabled()) RETURN_OBJ(nullptr); + if (!KonanNeedDebugInfo && !Kotlin_memoryLeakCheckerEnabled()) RETURN_OBJ(nullptr); RETURN_RESULT_OF0(detectCyclicReferences); #else RETURN_OBJ(nullptr); From 5fc17ce5fafcb775b14d50e93419d2d0f82fe992 Mon Sep 17 00:00:00 2001 From: Alexander Shabalin Date: Thu, 26 Nov 2020 11:25:25 +0300 Subject: [PATCH 628/698] Tweak TLS init/deinit (#4551) * Delete the entire TLS in one go * Put TLS allocation separately * Keep TLS in a single array --- .../kotlin/backend/konan/llvm/ContextUtils.kt | 1 - .../kotlin/backend/konan/llvm/IrToBitcode.kt | 30 ++--- .../runtime/src/legacymm/cpp/Memory.cpp | 116 ++++++++++++------ .../runtime/src/main/cpp/CompilerExport.cpp | 1 - kotlin-native/runtime/src/main/cpp/Memory.h | 6 +- .../runtime/src/main/cpp/Runtime.cpp | 11 +- kotlin-native/runtime/src/mm/cpp/Stubs.cpp | 6 +- 7 files changed, 101 insertions(+), 70 deletions(-) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt index 394e29ff712..7489df0b056 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt @@ -515,7 +515,6 @@ internal class Llvm(val context: Context, val llvmModule: LLVMModuleRef) { val throwExceptionFunction = importRtFunction("ThrowException") val appendToInitalizersTail = importRtFunction("AppendToInitializersTail") val addTLSRecord = importRtFunction("AddTLSRecord") - val clearTLSRecord = importRtFunction("ClearTLSRecord") val lookupTLS = importRtFunction("LookupTLS") val initRuntimeIfNeeded = importRtFunction("Kotlin_initRuntimeIfNeeded") val mutationCheck = importRtFunction("MutationCheck") diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt index f2044d3c6fc..613f0c9fa08 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt @@ -15,10 +15,8 @@ import org.jetbrains.kotlin.backend.konan.* import org.jetbrains.kotlin.backend.konan.descriptors.* import org.jetbrains.kotlin.backend.konan.ir.* import org.jetbrains.kotlin.backend.konan.llvm.coverage.LLVMCoverageInstrumentation -import org.jetbrains.kotlin.backend.konan.serialization.KonanIrModuleFragmentImpl import org.jetbrains.kotlin.builtins.UnsignedType import org.jetbrains.kotlin.descriptors.Modality -import org.jetbrains.kotlin.descriptors.ModuleDescriptor import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.IrStatement import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET @@ -37,7 +35,6 @@ import org.jetbrains.kotlin.library.KotlinLibrary import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.descriptorUtil.classId -import org.jetbrains.kotlin.resolve.descriptorUtil.module internal enum class FieldStorageKind { GLOBAL, // In the old memory model these are only accessible from the "main" thread. @@ -385,9 +382,10 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map 0) { - val memory = LLVMGetParam(initFunction, 1)!! - call(context.llvm.addTLSRecord, listOf(memory, context.llvm.tlsKey, - Int32(context.llvm.tlsCount).llvm)) - } context.llvm.fileInitializers .forEach { irField -> if (irField.initializer?.expression !is IrConst<*>?) { @@ -436,11 +428,6 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map 0) { - val memory = LLVMGetParam(initFunction, 1)!! - call(context.llvm.addTLSRecord, listOf(memory, context.llvm.tlsKey, - Int32(context.llvm.tlsCount).llvm)) - } context.llvm.fileInitializers .forEach { irField -> if (irField.initializer != null && irField.storageKind == FieldStorageKind.THREAD_LOCAL) { @@ -454,10 +441,11 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map 0) { val memory = LLVMGetParam(initFunction, 1)!! - call(context.llvm.clearTLSRecord, listOf(memory, context.llvm.tlsKey)) + call(context.llvm.addTLSRecord, listOf(memory, context.llvm.tlsKey, + Int32(context.llvm.tlsCount).llvm)) } ret(null) } diff --git a/kotlin-native/runtime/src/legacymm/cpp/Memory.cpp b/kotlin-native/runtime/src/legacymm/cpp/Memory.cpp index a6c365f417e..03bd85fdc84 100644 --- a/kotlin-native/runtime/src/legacymm/cpp/Memory.cpp +++ b/kotlin-native/runtime/src/legacymm/cpp/Memory.cpp @@ -131,7 +131,6 @@ typedef KStdUnorderedSet KRefSet; typedef KStdUnorderedMap KRefIntMap; typedef KStdDeque KRefDeque; typedef KStdDeque KRefListDeque; -typedef KStdUnorderedMap> KThreadLocalStorageMap; // A little hack that allows to enable -O2 optimizations // Prevents clang from replacing FrameOverlay struct @@ -584,15 +583,78 @@ private: } }; +namespace { + +class ThreadLocalStorage { +public: + using Key = void**; + + void Init() noexcept { map_ = konanConstructInstance(); } + + void Deinit() noexcept { + RuntimeAssert(map_->size() == 0, "Must be already cleared"); + konanDestructInstance(map_); + } + + void Add(Key key, int size) noexcept { + RuntimeAssert(storage_ == nullptr, "Storage must not be committed"); + auto it = map_->find(key); + if (it != map_->end()) { + RuntimeAssert(it->second.second == size, "Attempt to add TLS record with the same key and different size"); + return; + } + map_->emplace(key, std::make_pair(size_, size)); + size_ += size; + } + + void Commit() noexcept { + RuntimeAssert(storage_ == nullptr, "Cannot commit storage twice"); + storage_ = reinterpret_cast(konanAllocMemory(size_ * sizeof(KRef))); + } + + void Clear() noexcept { + RuntimeAssert(storage_ != nullptr, "Storage must be committed"); + for (int i = 0; i < size_; ++i) { + UpdateHeapRef(storage_ + i, nullptr); + } + konanFreeMemory(storage_); + map_->clear(); + } + + KRef* Lookup(Key key, int index) noexcept { + RuntimeAssert(storage_ != nullptr, "Storage must be committed"); + // In many cases there is only one module, so this is one element cache. + if (lastKey_ == key) { + return storage_ + lastOffset_ + index; + } + auto it = map_->find(key); + RuntimeAssert(it != map_->end(), "Must be there"); + int offset = it->second.first; + RuntimeAssert(offset + index < size_, "Out of bound in TLS access"); + lastKey_ = key; + lastOffset_ = offset; + return storage_ + offset + index; + } + +private: + using Map = KStdUnorderedMap>; + + Map* map_ = nullptr; + KRef* storage_ = nullptr; + int size_ = 0; + int lastOffset_ = 0; + Key lastKey_ = nullptr; +}; + +} // namespace + struct MemoryState { #if TRACE_MEMORY // Set of all containers. ContainerHeaderSet* containers; #endif - KThreadLocalStorageMap* tlsMap; - KRef* tlsMapLastStart; - void* tlsMapLastKey; + ThreadLocalStorage tls; #if USE_GC // Finalizer queue - linked list of containers scheduled for finalization. @@ -1995,7 +2057,7 @@ MemoryState* initMemory(bool firstRuntime) { memoryState->allocSinceLastGcThreshold = kMaxGcAllocThreshold; memoryState->gcErgonomics = true; #endif - memoryState->tlsMap = konanConstructInstance(); + memoryState->tls.Init(); memoryState->foreignRefManager = ForeignRefManager::create(); bool firstMemoryState = atomicAdd(&aliveMemoryStatesCount, 1) == 1; switch (Kotlin_getDestroyRuntimeMode()) { @@ -2051,8 +2113,7 @@ void deinitMemory(MemoryState* memoryState, bool destroyRuntime) { konanDestructInstance(memoryState->toFree); konanDestructInstance(memoryState->roots); konanDestructInstance(memoryState->toRelease); - RuntimeAssert(memoryState->tlsMap->size() == 0, "Must be already cleared"); - konanDestructInstance(memoryState->tlsMap); + memoryState->tls.Deinit(); RuntimeAssert(memoryState->finalizerQueue == nullptr, "Finalizer queue must be empty"); RuntimeAssert(memoryState->finalizerQueueSize == 0, "Finalizer queue must be empty"); #endif // USE_GC @@ -3535,44 +3596,19 @@ void Kotlin_Any_share(ObjHeader* obj) { } RUNTIME_NOTHROW void AddTLSRecord(MemoryState* memory, void** key, int size) { - auto* tlsMap = memory->tlsMap; - auto it = tlsMap->find(key); - if (it != tlsMap->end()) { - RuntimeAssert(it->second.second == size, "Size must be consistent"); - return; - } - KRef* start = reinterpret_cast(konanAllocMemory(size * sizeof(KRef))); - tlsMap->emplace(key, std::make_pair(start, size)); + memory->tls.Add(key, size); } -RUNTIME_NOTHROW void ClearTLSRecord(MemoryState* memory, void** key) { - auto* tlsMap = memory->tlsMap; - auto it = tlsMap->find(key); - if (it != tlsMap->end()) { - KRef* start = it->second.first; - int count = it->second.second; - for (int i = 0; i < count; i++) { - UpdateHeapRef(start + i, nullptr); - } - konanFreeMemory(start); - tlsMap->erase(it); - } +RUNTIME_NOTHROW void CommitTLSStorage(MemoryState* memory) { + memory->tls.Commit(); +} + +RUNTIME_NOTHROW void ClearTLS(MemoryState* memory) { + memory->tls.Clear(); } RUNTIME_NOTHROW KRef* LookupTLS(void** key, int index) { - auto* state = memoryState; - auto* tlsMap = state->tlsMap; - // In many cases there is only one module, so this one element cache. - if (state->tlsMapLastKey == key) { - return state->tlsMapLastStart + index; - } - auto it = tlsMap->find(key); - RuntimeAssert(it != tlsMap->end(), "Must be there"); - RuntimeAssert(index < it->second.second, "Out of bound in TLS access"); - KRef* start = it->second.first; - state->tlsMapLastKey = key; - state->tlsMapLastStart = start; - return start + index; + return memoryState->tls.Lookup(key, index); } diff --git a/kotlin-native/runtime/src/main/cpp/CompilerExport.cpp b/kotlin-native/runtime/src/main/cpp/CompilerExport.cpp index 5263d6df773..a9341926cc2 100644 --- a/kotlin-native/runtime/src/main/cpp/CompilerExport.cpp +++ b/kotlin-native/runtime/src/main/cpp/CompilerExport.cpp @@ -35,7 +35,6 @@ void EnsureDeclarationsEmitted() { ensureUsed(EnterFrame); ensureUsed(LeaveFrame); ensureUsed(AddTLSRecord); - ensureUsed(ClearTLSRecord); ensureUsed(LookupTLS); ensureUsed(MutationCheck); ensureUsed(CheckLifetimesConstraint); diff --git a/kotlin-native/runtime/src/main/cpp/Memory.h b/kotlin-native/runtime/src/main/cpp/Memory.h index be5ab005796..2e06eb9e030 100644 --- a/kotlin-native/runtime/src/main/cpp/Memory.h +++ b/kotlin-native/runtime/src/main/cpp/Memory.h @@ -225,8 +225,10 @@ void FreezeSubgraph(ObjHeader* obj); void EnsureNeverFrozen(ObjHeader* obj); // Add TLS object storage, called by the generated code. void AddTLSRecord(MemoryState* memory, void** key, int size) RUNTIME_NOTHROW; -// Clear TLS object storage, called by the generated code. -void ClearTLSRecord(MemoryState* memory, void** key) RUNTIME_NOTHROW; +// Allocate storage for TLS. `AddTLSRecord` cannot be called after this. +void CommitTLSStorage(MemoryState* memory) RUNTIME_NOTHROW; +// Clear TLS object storage. +void ClearTLS(MemoryState* memory) RUNTIME_NOTHROW; // Lookup element in TLS object storage. ObjHeader** LookupTLS(void** key, int index) RUNTIME_NOTHROW; diff --git a/kotlin-native/runtime/src/main/cpp/Runtime.cpp b/kotlin-native/runtime/src/main/cpp/Runtime.cpp index 9c81ded50df..42e6594c0a4 100644 --- a/kotlin-native/runtime/src/main/cpp/Runtime.cpp +++ b/kotlin-native/runtime/src/main/cpp/Runtime.cpp @@ -55,10 +55,11 @@ struct RuntimeState { RuntimeStatus status = RuntimeStatus::kUninitialized; }; +// Must be synchronized with IrToBitcode.kt enum { - INIT_GLOBALS = 0, - INIT_THREAD_LOCAL_GLOBALS = 1, - DEINIT_THREAD_LOCAL_GLOBALS = 2, + ALLOC_THREAD_LOCAL_GLOBALS = 0, + INIT_GLOBALS = 1, + INIT_THREAD_LOCAL_GLOBALS = 2, DEINIT_GLOBALS = 3 }; @@ -120,6 +121,8 @@ RuntimeState* initRuntime() { result->worker = WorkerInit(true); } + InitOrDeinitGlobalVariables(ALLOC_THREAD_LOCAL_GLOBALS, result->memoryState); + CommitTLSStorage(result->memoryState); // Keep global variables in state as well. if (firstRuntime) { konan::consoleInit(); @@ -148,7 +151,7 @@ void deinitRuntime(RuntimeState* state, bool destroyRuntime) { // Nothing to do. break; } - InitOrDeinitGlobalVariables(DEINIT_THREAD_LOCAL_GLOBALS, state->memoryState); + ClearTLS(state->memoryState); if (destroyRuntime) InitOrDeinitGlobalVariables(DEINIT_GLOBALS, state->memoryState); auto workerId = GetWorkerId(state->worker); diff --git a/kotlin-native/runtime/src/mm/cpp/Stubs.cpp b/kotlin-native/runtime/src/mm/cpp/Stubs.cpp index 57bd6ab0bed..f43418f967f 100644 --- a/kotlin-native/runtime/src/mm/cpp/Stubs.cpp +++ b/kotlin-native/runtime/src/mm/cpp/Stubs.cpp @@ -166,7 +166,11 @@ RUNTIME_NOTHROW void AddTLSRecord(MemoryState* memory, void** key, int size) { RuntimeCheck(false, "Unimplemented"); } -RUNTIME_NOTHROW void ClearTLSRecord(MemoryState* memory, void** key) { +RUNTIME_NOTHROW void CommitTLSStorage(MemoryState* memory) { + RuntimeCheck(false, "Unimplemented"); +} + +RUNTIME_NOTHROW void ClearTLS(MemoryState* memory) { RuntimeCheck(false, "Unimplemented"); } From 30345c3708f965b265ae8b7d4bd1ef950e60c07d Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Mon, 23 Nov 2020 21:00:22 +0700 Subject: [PATCH 629/698] Fix KT-43530 --- .../jetbrains/kotlin/backend/konan/ir/Ir.kt | 19 +++++++++++++++++++ .../cenum/CEnumByValueFunctionGenerator.kt | 17 ++++++++++++----- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/Ir.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/Ir.kt index a4b38853084..d53a96c14c8 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/Ir.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/Ir.kt @@ -25,6 +25,7 @@ import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol +import org.jetbrains.kotlin.ir.types.IrSimpleType import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.types.typeWith import org.jetbrains.kotlin.ir.util.* @@ -110,6 +111,24 @@ internal class KonanSymbols( } }.toMap() + private val binaryOperatorCache = mutableMapOf, IrSimpleFunctionSymbol>() + + /** + * A less restrictive version of [getBinaryOperator] that should be used when symbols might not be bound yet. + * Note that it is a hack that will be removed in a foreseeable future. Consider using [getBinaryOperator] instead. + * + * TODO: Remove with [org.jetbrains.kotlin.backend.konan.ir.interop.cenum.CEnumByValueFunctionGenerator]. + */ + fun getBinaryOperatorMaybeUnbound(name: Name, lhsType: KotlinType, rhsType: KotlinType): IrSimpleFunctionSymbol { + val key = Triple(name, lhsType, rhsType) + return binaryOperatorCache.getOrPut(key) { + symbolTable.referenceSimpleFunction( + lhsType.memberScope.getContributedFunctions(name, NoLookupLocation.FROM_BACKEND) + .first { it.valueParameters.size == 1 && it.valueParameters[0].type == rhsType } + ) + } + } + val arrayList = symbolTable.referenceClass(getArrayListClassDescriptor(context)) val symbolName = topLevelClass(RuntimeNames.symbolNameAnnotation) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumByValueFunctionGenerator.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumByValueFunctionGenerator.kt index ea65b605557..0bfe0b46307 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumByValueFunctionGenerator.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumByValueFunctionGenerator.kt @@ -56,22 +56,29 @@ internal class CEnumByValueFunctionGenerator( val values = irTemporary(irCall(valuesIrFunctionSymbol), isMutable = true) val inductionVariable = irTemporary(irInt(0), isMutable = true) val arrayClass = values.type.classOrNull!! - val valuesSize = irCall(symbols.arraySize.getValue(arrayClass), irBuiltIns.intType).also { irCall -> + val valuesSize = IrCallImpl.fromSymbolDescriptor( + startOffset, endOffset, irBuiltIns.intType, symbols.arraySize.getValue(arrayClass) + ).also { irCall -> irCall.dispatchReceiver = irGet(values) } val getElementFn = symbols.arrayGet.getValue(arrayClass) - val plusFun = symbols.getBinaryOperator(OperatorNameConventions.PLUS, irBuiltIns.intType, irBuiltIns.intType) + val plusFun = symbols.getBinaryOperatorMaybeUnbound(OperatorNameConventions.PLUS, irBuiltIns.int, irBuiltIns.int) val lessFunctionSymbol = irBuiltIns.lessFunByOperandType.getValue(irBuiltIns.intClass) +irWhile().also { loop -> - loop.condition = irCall(lessFunctionSymbol, irBuiltIns.booleanType).also { irCall -> + loop.condition = IrCallImpl.fromSymbolDescriptor( + startOffset, endOffset, irBuiltIns.booleanType, lessFunctionSymbol + ).also { irCall -> irCall.putValueArgument(0, irGet(inductionVariable)) irCall.putValueArgument(1, valuesSize) } loop.body = irBlock { - val entry = irTemporary(irCall(getElementFn, byValueIrFunction.returnType).also { irCall -> + val temporaryValue = IrCallImpl.fromSymbolDescriptor( + startOffset, endOffset,byValueIrFunction.returnType, getElementFn + ).also { irCall -> irCall.dispatchReceiver = irGet(values) irCall.putValueArgument(0, irGet(inductionVariable)) - }, isMutable = true) + } + val entry = irTemporary(temporaryValue, isMutable = true) val valueGetter = entry.type.getClass()!!.getPropertyGetter("value")!! val entryValue = irGet(irValueParameter.type, irGet(entry), valueGetter) +irIfThenElse( From 12723fb009bc0ce1dde885537ec6aed5442dc718 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Tue, 24 Nov 2020 15:27:26 +0700 Subject: [PATCH 630/698] Add test for KT-43517 and KT-43530 --- .../backend.native/tests/build.gradle | 11 +++++++++ .../tests/framework/kt43517/kt43517.def | 15 ++++++++++++ .../tests/framework/kt43517/kt43517.kt | 13 ++++++++++ .../tests/framework/kt43517/kt43517.swift | 24 +++++++++++++++++++ 4 files changed, 63 insertions(+) create mode 100644 kotlin-native/backend.native/tests/framework/kt43517/kt43517.def create mode 100644 kotlin-native/backend.native/tests/framework/kt43517/kt43517.kt create mode 100644 kotlin-native/backend.native/tests/framework/kt43517/kt43517.swift diff --git a/kotlin-native/backend.native/tests/build.gradle b/kotlin-native/backend.native/tests/build.gradle index 8008e5a022e..b06f18abc11 100644 --- a/kotlin-native/backend.native/tests/build.gradle +++ b/kotlin-native/backend.native/tests/build.gradle @@ -3800,6 +3800,9 @@ if (PlatformInfo.isAppleTarget(project)) { it.defFile 'interop/objc/illegal_sharing_with_weak/objclib.def' it.headers "$projectDir/interop/objc/illegal_sharing_with_weak/objclib.h" } + createInterop("objcKt43517") { + it.defFile 'framework/kt43517/kt43517.def' + } } createInterop("withSpaces") { @@ -4672,6 +4675,14 @@ if (isAppleTarget(project)) { } swiftSources = ['framework/kt42397'] } + + frameworkTest("testKt43517Framework") { + framework('Kt43517') { + sources = ['framework/kt43517'] + library = 'objcKt43517' + } + swiftSources = ['framework/kt43517/'] + } } /** diff --git a/kotlin-native/backend.native/tests/framework/kt43517/kt43517.def b/kotlin-native/backend.native/tests/framework/kt43517/kt43517.def new file mode 100644 index 00000000000..04f2b80bc15 --- /dev/null +++ b/kotlin-native/backend.native/tests/framework/kt43517/kt43517.def @@ -0,0 +1,15 @@ +--- +enum E { + A, B, C +}; + +struct S { + int i; + float f; +}; + +struct S globalS = { .i = 3, .f = 3.14f }; + +enum E createEnum() { + return A; +} diff --git a/kotlin-native/backend.native/tests/framework/kt43517/kt43517.kt b/kotlin-native/backend.native/tests/framework/kt43517/kt43517.kt new file mode 100644 index 00000000000..716dcd7e87e --- /dev/null +++ b/kotlin-native/backend.native/tests/framework/kt43517/kt43517.kt @@ -0,0 +1,13 @@ +import kt43517.* + +fun produceEnum(): E = + createEnum() + +fun compareEnums(e1: E, e2: E): Boolean = + e1 == e2 + +fun getFirstField(s: S): Int = + s.i + +fun getGlobalS(): S = + globalS \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/framework/kt43517/kt43517.swift b/kotlin-native/backend.native/tests/framework/kt43517/kt43517.swift new file mode 100644 index 00000000000..1645d5ed669 --- /dev/null +++ b/kotlin-native/backend.native/tests/framework/kt43517/kt43517.swift @@ -0,0 +1,24 @@ +import Foundation +import Kt43517 + +func testKt43517() throws { + try assertEquals( + actual: Kt43517Kt.compareEnums(e1: Kt43517Kt.produceEnum(), e2: Kt43517Kt.produceEnum()), + expected: true + ) + try assertEquals( + actual: Kt43517Kt.getFirstField(s: Kt43517Kt.getGlobalS()), + expected: 3 + ) +} + +class Kt43517Tests : TestProvider { + var tests: [TestCase] = [] + + init() { + providers.append(self) + tests = [ + TestCase(name: "Kt43517", method: withAutorelease(testKt43517)), + ] + } +} \ No newline at end of file From 66de5dceb98eec7bc5a72dccdb2d6fe60b8491cb Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Tue, 24 Nov 2020 13:36:27 +0700 Subject: [PATCH 631/698] Workaround for KT-43517. --- .../kotlin/backend/konan/serialization/KonanIrlinker.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/serialization/KonanIrlinker.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/serialization/KonanIrlinker.kt index 69a282cf6a1..9906bdc6b82 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/serialization/KonanIrlinker.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/serialization/KonanIrlinker.kt @@ -101,7 +101,9 @@ internal class KonanIrLinker( } if (klib is KotlinLibrary && klib.isInteropLibrary()) { - val isCached = cachedLibraries.isLibraryCached(klib) + // See https://youtrack.jetbrains.com/issue/KT-43517. + // Disabling this flag forces linker to generate IR. + val isCached = false //cachedLibraries.isLibraryCached(klib) return KonanInteropModuleDeserializer(moduleDescriptor, isCached) } From 2057e5c8f13921389f62985b98e2964eba9f4314 Mon Sep 17 00:00:00 2001 From: Alexander Shabalin Date: Fri, 27 Nov 2020 09:30:32 +0300 Subject: [PATCH 632/698] Tracking globals (#4542) --- .../backend/konan/llvm/CodeGenerator.kt | 4 +- .../kotlin/backend/konan/llvm/ContextUtils.kt | 5 +- .../kotlin/backend/konan/llvm/IrToBitcode.kt | 25 ++++-- .../runtime/src/legacymm/cpp/Memory.cpp | 29 +++--- .../src/legacymm/cpp/MemoryPrivate.hpp | 12 +-- .../runtime/src/main/cpp/CompilerExport.cpp | 5 +- kotlin-native/runtime/src/main/cpp/Memory.h | 11 ++- .../runtime/src/main/cpp/MultiSourceQueue.hpp | 44 +++++++++ .../src/main/cpp/MultiSourceQueueTest.cpp | 89 +++++++++++++++++++ .../runtime/src/mm/cpp/GlobalData.hpp | 3 + .../runtime/src/mm/cpp/GlobalsRegistry.cpp | 30 +++++++ .../runtime/src/mm/cpp/GlobalsRegistry.hpp | 50 +++++++++++ kotlin-native/runtime/src/mm/cpp/Memory.cpp | 16 ++++ kotlin-native/runtime/src/mm/cpp/Stubs.cpp | 6 +- .../runtime/src/mm/cpp/ThreadData.hpp | 9 ++ .../runtime/src/relaxed/cpp/MemoryImpl.cpp | 10 +-- .../runtime/src/strict/cpp/MemoryImpl.cpp | 10 +-- 17 files changed, 302 insertions(+), 56 deletions(-) create mode 100644 kotlin-native/runtime/src/main/cpp/MultiSourceQueue.hpp create mode 100644 kotlin-native/runtime/src/main/cpp/MultiSourceQueueTest.cpp create mode 100644 kotlin-native/runtime/src/mm/cpp/GlobalsRegistry.cpp create mode 100644 kotlin-native/runtime/src/mm/cpp/GlobalsRegistry.hpp diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt index 73b7ece16fa..54fba7661ec 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt @@ -1092,9 +1092,9 @@ internal class FunctionGenerationContext(val function: LLVMValueRef, val ctor = codegen.llvmFunction(defaultConstructor) val initFunction = if (storageKind == ObjectStorageKind.SHARED && context.config.threadsAreAllowed) { - context.llvm.initSharedInstanceFunction + context.llvm.initSingletonFunction } else { - context.llvm.initInstanceFunction + context.llvm.initThreadLocalSingleton } val args = listOf(objectPtr, typeInfo, ctor) val newValue = call(initFunction, args, Lifetime.GLOBAL, exceptionHandler) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt index 7489df0b056..05ecc700e61 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt @@ -499,8 +499,9 @@ internal class Llvm(val context: Context, val llvmModule: LLVMModuleRef) { val allocInstanceFunction = importRtFunction("AllocInstance") val allocArrayFunction = importRtFunction("AllocArrayInstance") - val initInstanceFunction = importRtFunction("InitInstance") - val initSharedInstanceFunction = importRtFunction("InitSharedInstance") + val initThreadLocalSingleton = importRtFunction("InitThreadLocalSingleton") + val initSingletonFunction = importRtFunction("InitSingleton") + val initAndRegisterGlobalFunction = importRtFunction("InitAndRegisterGlobal") val updateHeapRefFunction = importRtFunction("UpdateHeapRef") val updateStackRefFunction = importRtFunction("UpdateStackRef") val updateReturnRefFunction = importRtFunction("UpdateReturnRef") diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt index 613f0c9fa08..6897fe8715f 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt @@ -412,15 +412,28 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map - if (irField.initializer?.expression !is IrConst<*>?) { - if (irField.storageKind != FieldStorageKind.THREAD_LOCAL) { + if (irField.storageKind != FieldStorageKind.THREAD_LOCAL) { + val address = context.llvmDeclarations.forStaticField(irField).storageAddressAccess.getAddress( + functionGenerationContext + ) + val initialValue = if (irField.initializer?.expression !is IrConst<*>?) { val initialization = evaluateExpression(irField.initializer!!.expression) - val address = context.llvmDeclarations.forStaticField(irField).storageAddressAccess.getAddress( - functionGenerationContext - ) if (irField.storageKind == FieldStorageKind.SHARED_FROZEN) freeze(initialization, currentCodeContext.exceptionHandler) - storeAny(initialization, address, false) + initialization + } else { + null + } + val needRegistration = + context.memoryModel == MemoryModel.EXPERIMENTAL && // only for the new MM + irField.type.binaryTypeIsReference() && // only for references + (initialValue != null || // which are initialized from heap object + !irField.isFinal) // or are not final + if (needRegistration) { + call(context.llvm.initAndRegisterGlobalFunction, listOf(address, initialValue + ?: kNullObjHeaderPtr)) + } else if (initialValue != null) { + storeAny(initialValue, address, false) } } } diff --git a/kotlin-native/runtime/src/legacymm/cpp/Memory.cpp b/kotlin-native/runtime/src/legacymm/cpp/Memory.cpp index 03bd85fdc84..c7b6c8d6a9d 100644 --- a/kotlin-native/runtime/src/legacymm/cpp/Memory.cpp +++ b/kotlin-native/runtime/src/legacymm/cpp/Memory.cpp @@ -2320,7 +2320,7 @@ OBJ_GETTER(allocArrayInstance, const TypeInfo* type_info, int32_t elements) { } template -OBJ_GETTER(initInstance, +OBJ_GETTER(initThreadLocalSingleton, ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)) { ObjHeader* value = *location; if (value != nullptr) { @@ -2345,8 +2345,7 @@ OBJ_GETTER(initInstance, } template -OBJ_GETTER(initSharedInstance, - ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)) { +OBJ_GETTER(initSingleton, ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)) { #if KONAN_NO_THREADS ObjHeader* value = *location; if (value != nullptr) { @@ -3328,22 +3327,22 @@ OBJ_GETTER(AllocArrayInstanceRelaxed, const TypeInfo* typeInfo, int32_t elements RETURN_RESULT_OF(allocArrayInstance, typeInfo, elements); } -OBJ_GETTER(InitInstanceStrict, - ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)) { - RETURN_RESULT_OF(initInstance, location, typeInfo, ctor); +OBJ_GETTER(InitThreadLocalSingletonStrict, ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)) { + RETURN_RESULT_OF(initThreadLocalSingleton, location, typeInfo, ctor); } -OBJ_GETTER(InitInstanceRelaxed, - ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)) { - RETURN_RESULT_OF(initInstance, location, typeInfo, ctor); +OBJ_GETTER(InitThreadLocalSingletonRelaxed, ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)) { + RETURN_RESULT_OF(initThreadLocalSingleton, location, typeInfo, ctor); } -OBJ_GETTER(InitSharedInstanceStrict, - ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)) { - RETURN_RESULT_OF(initSharedInstance, location, typeInfo, ctor); +OBJ_GETTER(InitSingletonStrict, ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)) { + RETURN_RESULT_OF(initSingleton, location, typeInfo, ctor); } -OBJ_GETTER(InitSharedInstanceRelaxed, - ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)) { - RETURN_RESULT_OF(initSharedInstance, location, typeInfo, ctor); +OBJ_GETTER(InitSingletonRelaxed, ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)) { + RETURN_RESULT_OF(initSingleton, location, typeInfo, ctor); +} + +void RUNTIME_NOTHROW InitAndRegisterGlobal(ObjHeader** location, const ObjHeader* initialValue) { + RuntimeCheck(false, "Global registration is impossible in legacy MM"); } RUNTIME_NOTHROW void SetStackRefStrict(ObjHeader** location, const ObjHeader* object) { diff --git a/kotlin-native/runtime/src/legacymm/cpp/MemoryPrivate.hpp b/kotlin-native/runtime/src/legacymm/cpp/MemoryPrivate.hpp index 034bf339c55..01deeccecd0 100644 --- a/kotlin-native/runtime/src/legacymm/cpp/MemoryPrivate.hpp +++ b/kotlin-native/runtime/src/legacymm/cpp/MemoryPrivate.hpp @@ -309,15 +309,11 @@ OBJ_GETTER(AllocInstanceRelaxed, const TypeInfo* type_info) RUNTIME_NOTHROW; OBJ_GETTER(AllocArrayInstanceStrict, const TypeInfo* type_info, int32_t elements); OBJ_GETTER(AllocArrayInstanceRelaxed, const TypeInfo* type_info, int32_t elements); -OBJ_GETTER(InitInstanceStrict, - ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)); -OBJ_GETTER(InitInstanceRelaxed, - ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)); +OBJ_GETTER(InitThreadLocalSingletonStrict, ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)); +OBJ_GETTER(InitThreadLocalSingletonRelaxed, ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)); -OBJ_GETTER(InitSharedInstanceStrict, - ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)); -OBJ_GETTER(InitSharedInstanceRelaxed, - ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)); +OBJ_GETTER(InitSingletonStrict, ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)); +OBJ_GETTER(InitSingletonRelaxed, ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)); MODEL_VARIANTS(void, SetStackRef, ObjHeader** location, const ObjHeader* object); MODEL_VARIANTS(void, SetHeapRef, ObjHeader** location, const ObjHeader* object); diff --git a/kotlin-native/runtime/src/main/cpp/CompilerExport.cpp b/kotlin-native/runtime/src/main/cpp/CompilerExport.cpp index a9341926cc2..8f9ce315cc5 100644 --- a/kotlin-native/runtime/src/main/cpp/CompilerExport.cpp +++ b/kotlin-native/runtime/src/main/cpp/CompilerExport.cpp @@ -25,8 +25,9 @@ void ensureUsed(Ret (*f)(Args...)) { void EnsureDeclarationsEmitted() { ensureUsed(AllocInstance); ensureUsed(AllocArrayInstance); - ensureUsed(InitInstance); - ensureUsed(InitSharedInstance); + ensureUsed(InitThreadLocalSingleton); + ensureUsed(InitSingleton); + ensureUsed(InitAndRegisterGlobal); ensureUsed(UpdateHeapRef); ensureUsed(UpdateStackRef); ensureUsed(UpdateReturnRef); diff --git a/kotlin-native/runtime/src/main/cpp/Memory.h b/kotlin-native/runtime/src/main/cpp/Memory.h index 2e06eb9e030..82c58fde4b6 100644 --- a/kotlin-native/runtime/src/main/cpp/Memory.h +++ b/kotlin-native/runtime/src/main/cpp/Memory.h @@ -142,11 +142,14 @@ OBJ_GETTER(AllocInstance, const TypeInfo* type_info) RUNTIME_NOTHROW; OBJ_GETTER(AllocArrayInstance, const TypeInfo* type_info, int32_t elements); -OBJ_GETTER(InitInstance, - ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)); +OBJ_GETTER(InitThreadLocalSingleton, ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)); -OBJ_GETTER(InitSharedInstance, - ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)); +OBJ_GETTER(InitSingleton, ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)); + +// `initialValue` may be `nullptr`, which signifies that the appropriate initial value was already +// set by static initialization. +// TODO: When global initialization becomes lazy, this signature won't do. +void InitAndRegisterGlobal(ObjHeader** location, const ObjHeader* initialValue) RUNTIME_NOTHROW; // // Object reference management. diff --git a/kotlin-native/runtime/src/main/cpp/MultiSourceQueue.hpp b/kotlin-native/runtime/src/main/cpp/MultiSourceQueue.hpp new file mode 100644 index 00000000000..cafcf355dee --- /dev/null +++ b/kotlin-native/runtime/src/main/cpp/MultiSourceQueue.hpp @@ -0,0 +1,44 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the LICENSE file. + */ + +#ifndef RUNTIME_MULTI_SOURCE_QUEUE_H +#define RUNTIME_MULTI_SOURCE_QUEUE_H + +#include + +namespace kotlin { + +// A queue that is constructed by collecting subqueues from several `Producer`s. +template +class MultiSourceQueue { +public: + class Producer { + public: + void Insert(const T& value) noexcept { queue_.push_back(value); } + + private: + friend class MultiSourceQueue; + + std::list queue_; + }; + + using Iterator = typename std::list::iterator; + + Iterator begin() noexcept { return commonQueue_.begin(); } + Iterator end() noexcept { return commonQueue_.end(); } + + // Merge `producer`s queue with `this`. `producer` will have empty queue after the call. + // This call is performed without heap allocations. TODO: Test that no allocations are happening. + void Collect(Producer* producer) noexcept { commonQueue_.splice(commonQueue_.end(), producer->queue_); } + +private: + // Using `std::list` as it allows to implement `Collect` without memory allocations, + // which is important for GC mark phase. + std::list commonQueue_; +}; + +} // namespace kotlin + +#endif // RUNTIME_MULTI_SOURCE_QUEUE_H diff --git a/kotlin-native/runtime/src/main/cpp/MultiSourceQueueTest.cpp b/kotlin-native/runtime/src/main/cpp/MultiSourceQueueTest.cpp new file mode 100644 index 00000000000..e6622edc099 --- /dev/null +++ b/kotlin-native/runtime/src/main/cpp/MultiSourceQueueTest.cpp @@ -0,0 +1,89 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the LICENSE file. + */ + +#include "MultiSourceQueue.hpp" + +#include "gmock/gmock.h" +#include "gtest/gtest.h" + +using namespace kotlin; + +using IntQueue = MultiSourceQueue; + +TEST(MultiSourceQueueTest, Empty) { + IntQueue queue; + + std::vector actual; + for (int element : queue) { + actual.push_back(element); + } + + EXPECT_THAT(actual, testing::IsEmpty()); +} + +TEST(MultiSourceQueueTest, DoNotCollect) { + IntQueue queue; + IntQueue::Producer producer; + + producer.Insert(1); + producer.Insert(2); + + std::vector actual; + for (int element : queue) { + actual.push_back(element); + } + + EXPECT_THAT(actual, testing::IsEmpty()); +} + +TEST(MultiSourceQueueTest, Collect) { + IntQueue queue; + IntQueue::Producer producer1; + IntQueue::Producer producer2; + + producer1.Insert(1); + producer1.Insert(2); + producer2.Insert(10); + producer2.Insert(20); + + queue.Collect(&producer1); + queue.Collect(&producer2); + + std::vector actual; + for (int element : queue) { + actual.push_back(element); + } + + EXPECT_THAT(actual, testing::ElementsAre(1, 2, 10, 20)); +} + +TEST(MultiSourceQueueTest, CollectSeveralTimes) { + IntQueue queue; + IntQueue::Producer producer; + + // Add 2 elements and collect. + producer.Insert(1); + producer.Insert(2); + queue.Collect(&producer); + + // Add another element and collect. + producer.Insert(3); + queue.Collect(&producer); + + // Collect without adding elements. + queue.Collect(&producer); + + // Add yet another two elements and collect. + producer.Insert(4); + producer.Insert(5); + queue.Collect(&producer); + + std::vector actual; + for (int element : queue) { + actual.push_back(element); + } + + EXPECT_THAT(actual, testing::ElementsAre(1, 2, 3, 4, 5)); +} diff --git a/kotlin-native/runtime/src/mm/cpp/GlobalData.hpp b/kotlin-native/runtime/src/mm/cpp/GlobalData.hpp index a75f67ce962..e063b4e0865 100644 --- a/kotlin-native/runtime/src/mm/cpp/GlobalData.hpp +++ b/kotlin-native/runtime/src/mm/cpp/GlobalData.hpp @@ -6,6 +6,7 @@ #ifndef RUNTIME_MM_GLOBAL_DATA_H #define RUNTIME_MM_GLOBAL_DATA_H +#include "GlobalsRegistry.hpp" #include "ThreadRegistry.hpp" #include "Utils.hpp" @@ -18,6 +19,7 @@ public: static GlobalData& Instance() noexcept { return instance_; } ThreadRegistry& threadRegistry() { return threadRegistry_; } + GlobalsRegistry& globalsRegistry() { return globalsRegistry_; } private: GlobalData(); @@ -26,6 +28,7 @@ private: static GlobalData instance_; ThreadRegistry threadRegistry_; + GlobalsRegistry globalsRegistry_; }; } // namespace mm diff --git a/kotlin-native/runtime/src/mm/cpp/GlobalsRegistry.cpp b/kotlin-native/runtime/src/mm/cpp/GlobalsRegistry.cpp new file mode 100644 index 00000000000..96f80fd9ea4 --- /dev/null +++ b/kotlin-native/runtime/src/mm/cpp/GlobalsRegistry.cpp @@ -0,0 +1,30 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the LICENSE file. + */ + +#include "GlobalsRegistry.hpp" + +#include + +#include "GlobalData.hpp" +#include "ThreadData.hpp" + +using namespace kotlin; + +// static +mm::GlobalsRegistry& mm::GlobalsRegistry::Instance() noexcept { + return GlobalData::Instance().globalsRegistry(); +} + +void mm::GlobalsRegistry::RegisterStorageForGlobal(mm::ThreadData* threadData, ObjHeader** location) noexcept { + threadData->globalsThreadQueue()->Insert(location); +} + +void mm::GlobalsRegistry::ProcessThread(mm::ThreadData* threadData) noexcept { + RuntimeAssert(threadData->isWaitingForGC(), "Thread must be waiting for GC to complete."); + globals_.Collect(threadData->globalsThreadQueue()); +} + +mm::GlobalsRegistry::GlobalsRegistry() = default; +mm::GlobalsRegistry::~GlobalsRegistry() = default; diff --git a/kotlin-native/runtime/src/mm/cpp/GlobalsRegistry.hpp b/kotlin-native/runtime/src/mm/cpp/GlobalsRegistry.hpp new file mode 100644 index 00000000000..5cb77c91128 --- /dev/null +++ b/kotlin-native/runtime/src/mm/cpp/GlobalsRegistry.hpp @@ -0,0 +1,50 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the LICENSE file. + */ + +#ifndef RUNTIME_MM_GLOBALS_REGISTRY_H +#define RUNTIME_MM_GLOBALS_REGISTRY_H + +#include "Memory.h" +#include "MultiSourceQueue.hpp" +#include "ThreadRegistry.hpp" +#include "Utils.hpp" + +namespace kotlin { +namespace mm { + +class GlobalsRegistry : Pinned { +public: + using ThreadQueue = MultiSourceQueue::Producer; + + using Iterator = std::list::iterator; + + static GlobalsRegistry& Instance() noexcept; + + void RegisterStorageForGlobal(mm::ThreadData* threadData, ObjHeader** location) noexcept; + + // Collect globals from thread corresponding to `threadData`. Thread must be waiting for GC. + // Only one thread can call this method. + void ProcessThread(mm::ThreadData* threadData) noexcept; + + // These must be called on the same thread as `ProcessThread` to avoid races. + // TODO: Iteration over `globals_` will be slow, because it's `std::list` collected at different times from + // different threads, and so the nodes are all over the memory. Use metrics to understand how + // much of a problem is it. + Iterator begin() noexcept { return globals_.begin(); } + Iterator end() noexcept { return globals_.end(); } + +private: + friend class GlobalData; + + GlobalsRegistry(); + ~GlobalsRegistry(); + + MultiSourceQueue globals_; +}; + +} // namespace mm +} // namespace kotlin + +#endif // RUNTIME_MM_GLOBALS_REGISTRY_H diff --git a/kotlin-native/runtime/src/mm/cpp/Memory.cpp b/kotlin-native/runtime/src/mm/cpp/Memory.cpp index dd192ee8404..849cf94f0f7 100644 --- a/kotlin-native/runtime/src/mm/cpp/Memory.cpp +++ b/kotlin-native/runtime/src/mm/cpp/Memory.cpp @@ -5,6 +5,7 @@ #include "Memory.h" +#include "GlobalsRegistry.hpp" #include "ThreadData.hpp" #include "ThreadRegistry.hpp" #include "Utils.hpp" @@ -39,3 +40,18 @@ extern "C" MemoryState* InitMemory(bool firstRuntime) { extern "C" void DeinitMemory(MemoryState* state, bool destroyRuntime) { mm::ThreadRegistry::Instance().Unregister(FromMemoryState(state)); } + +extern "C" OBJ_GETTER(InitSingleton, ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)) { + auto* threadData = mm::ThreadRegistry::Instance().CurrentThreadData(); + // TODO: This should only be called if singleton is actually created here. It's possible that the + // singleton will be created on a different thread and here we should check that, instead of creating + // another one (and registering `location` twice). + mm::GlobalsRegistry::Instance().RegisterStorageForGlobal(threadData, location); + RuntimeCheck(false, "Unimplemented"); +} + +extern "C" RUNTIME_NOTHROW void InitAndRegisterGlobal(ObjHeader** location, const ObjHeader* initialValue) { + auto* threadData = mm::ThreadRegistry::Instance().CurrentThreadData(); + mm::GlobalsRegistry::Instance().RegisterStorageForGlobal(threadData, location); + RuntimeCheck(false, "Unimplemented"); +} diff --git a/kotlin-native/runtime/src/mm/cpp/Stubs.cpp b/kotlin-native/runtime/src/mm/cpp/Stubs.cpp index f43418f967f..8a3c8c499ef 100644 --- a/kotlin-native/runtime/src/mm/cpp/Stubs.cpp +++ b/kotlin-native/runtime/src/mm/cpp/Stubs.cpp @@ -59,11 +59,7 @@ OBJ_GETTER(AllocArrayInstance, const TypeInfo* type_info, int32_t elements) { RuntimeCheck(false, "Unimplemented"); } -OBJ_GETTER(InitInstance, ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)) { - RuntimeCheck(false, "Unimplemented"); -} - -OBJ_GETTER(InitSharedInstance, ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)) { +OBJ_GETTER(InitThreadLocalSingleton, ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)) { RuntimeCheck(false, "Unimplemented"); } diff --git a/kotlin-native/runtime/src/mm/cpp/ThreadData.hpp b/kotlin-native/runtime/src/mm/cpp/ThreadData.hpp index 3dac2cbd733..0b91cae9a06 100644 --- a/kotlin-native/runtime/src/mm/cpp/ThreadData.hpp +++ b/kotlin-native/runtime/src/mm/cpp/ThreadData.hpp @@ -8,6 +8,7 @@ #include +#include "GlobalsRegistry.hpp" #include "Utils.hpp" namespace kotlin { @@ -23,8 +24,16 @@ public: pthread_t threadId() const noexcept { return threadId_; } + bool isWaitingForGC() const noexcept { + // TODO: Implement. + return false; + } + + GlobalsRegistry::ThreadQueue* globalsThreadQueue() noexcept { return &globalsThreadQueue_; } + private: const pthread_t threadId_; + GlobalsRegistry::ThreadQueue globalsThreadQueue_; }; } // namespace mm diff --git a/kotlin-native/runtime/src/relaxed/cpp/MemoryImpl.cpp b/kotlin-native/runtime/src/relaxed/cpp/MemoryImpl.cpp index c0b0b074faf..4bc24d38c6c 100644 --- a/kotlin-native/runtime/src/relaxed/cpp/MemoryImpl.cpp +++ b/kotlin-native/runtime/src/relaxed/cpp/MemoryImpl.cpp @@ -19,14 +19,12 @@ OBJ_GETTER(AllocArrayInstance, const TypeInfo* typeInfo, int32_t elements) { RETURN_RESULT_OF(AllocArrayInstanceRelaxed, typeInfo, elements); } -OBJ_GETTER(InitInstance, - ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)) { - RETURN_RESULT_OF(InitInstanceRelaxed, location, typeInfo, ctor); +OBJ_GETTER(InitThreadLocalSingleton, ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)) { + RETURN_RESULT_OF(InitThreadLocalSingletonRelaxed, location, typeInfo, ctor); } -OBJ_GETTER(InitSharedInstance, - ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)) { - RETURN_RESULT_OF(InitSharedInstanceRelaxed, location, typeInfo, ctor); +OBJ_GETTER(InitSingleton, ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)) { + RETURN_RESULT_OF(InitSingletonRelaxed, location, typeInfo, ctor); } RUNTIME_NOTHROW void ReleaseHeapRef(const ObjHeader* object) { diff --git a/kotlin-native/runtime/src/strict/cpp/MemoryImpl.cpp b/kotlin-native/runtime/src/strict/cpp/MemoryImpl.cpp index 0b46ae9c20e..413b802258d 100644 --- a/kotlin-native/runtime/src/strict/cpp/MemoryImpl.cpp +++ b/kotlin-native/runtime/src/strict/cpp/MemoryImpl.cpp @@ -19,14 +19,12 @@ OBJ_GETTER(AllocArrayInstance, const TypeInfo* typeInfo, int32_t elements) { RETURN_RESULT_OF(AllocArrayInstanceStrict, typeInfo, elements); } -OBJ_GETTER(InitInstance, - ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)) { - RETURN_RESULT_OF(InitInstanceStrict, location, typeInfo, ctor); +OBJ_GETTER(InitThreadLocalSingleton, ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)) { + RETURN_RESULT_OF(InitThreadLocalSingletonStrict, location, typeInfo, ctor); } -OBJ_GETTER(InitSharedInstance, - ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)) { - RETURN_RESULT_OF(InitSharedInstanceStrict, location, typeInfo, ctor); +OBJ_GETTER(InitSingleton, ObjHeader** location, const TypeInfo* typeInfo, void (*ctor)(ObjHeader*)) { + RETURN_RESULT_OF(InitSingletonStrict, location, typeInfo, ctor); } RUNTIME_NOTHROW void ReleaseHeapRef(const ObjHeader* object) { From 2d307964832672be14c93c83b6ed9b72a5df49c8 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Mon, 16 Nov 2020 14:39:37 +0700 Subject: [PATCH 633/698] Better checking of ABI compatibility. Split ${target}CheckAbiCompatibility into two: 1) check${targetName}PlatformAbiCompatibility -- check platform libs compatibility of the given target 2) checkStdlibAbiCompatibility -- check only stdlib. This approach allows to avoid repeated check of stdlib for each target. --- .../kotlin/CompareDistributionSignatures.kt | 62 ++++++++++++------- kotlin-native/build.gradle | 12 +++- 2 files changed, 48 insertions(+), 26 deletions(-) diff --git a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/CompareDistributionSignatures.kt b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/CompareDistributionSignatures.kt index 1c71ebddd95..381cc7c551d 100644 --- a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/CompareDistributionSignatures.kt +++ b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/CompareDistributionSignatures.kt @@ -12,9 +12,6 @@ import java.io.File */ open class CompareDistributionSignatures : DefaultTask() { - @Input - lateinit var target: String - @Input lateinit var oldDistribution: String @@ -31,22 +28,52 @@ open class CompareDistributionSignatures : DefaultTask() { @Input var onMismatchMode: OnMismatchMode = OnMismatchMode.NOTIFY + sealed class Libraries { + object Standard : Libraries() + + class Platform(val target: String) : Libraries() + } + + @Input + lateinit var libraries: Libraries + + private fun computeDiff(): KlibDiff = when (val libraries = libraries) { + Libraries.Standard -> KlibDiff( + emptyList(), + emptyList(), + listOf(RemainingLibrary(newDistribution.stdlib(), oldDistribution.stdlib())) + ) + is Libraries.Platform -> { + val oldPlatformLibs = oldDistribution.platformLibs(libraries.target) + val oldPlatformLibsNames = oldPlatformLibs.list().toSet() + val newPlatformLibs = newDistribution.platformLibs(libraries.target) + val newPlatformLibsNames = newPlatformLibs.list().toSet() + KlibDiff( + (newPlatformLibsNames - oldPlatformLibsNames).map(newPlatformLibs::resolve), + (oldPlatformLibsNames - newPlatformLibsNames).map(oldPlatformLibs::resolve), + oldPlatformLibsNames.intersect(newPlatformLibsNames).map { + RemainingLibrary(newPlatformLibs.resolve(it), oldPlatformLibs.resolve(it)) + } + ) + } + } + @TaskAction fun run() { - val klibs = getKlibs(oldDistribution, newDistribution) - if (klibs.missingLibs.isNotEmpty()) { + val platformLibsDiff = computeDiff() + if (platformLibsDiff.missingLibs.isNotEmpty()) { messageBuilder.apply { - appendln("Following libraries are missing in the new distro:") - klibs.missingLibs.forEach { appendln(it) } + appendln("Following platform libraries are missing in the new distro:") + platformLibsDiff.missingLibs.forEach { appendln(it) } } } - if (klibs.newLibs.isNotEmpty()) { + if (platformLibsDiff.newLibs.isNotEmpty()) { messageBuilder.apply { - appendln("Following libraries were added:") - klibs.newLibs.forEach { appendln(it) } + appendln("Following platform libraries were added:") + platformLibsDiff.newLibs.forEach { appendln(it) } } } - for ((new, old) in klibs.remainingLibs) { + for ((new, old) in platformLibsDiff.remainingLibs) { val result = compareSignatures(new, old) if (result.run { newKlibOnly.isNotEmpty() || oldKlibOnly.isNotEmpty() }) { reportMismatch(result, new.name) @@ -92,19 +119,6 @@ open class CompareDistributionSignatures : DefaultTask() { private fun String.platformLibs(target: String): File = File("$this/klib/platform/$target") - private fun getKlibs(oldDistribution: String, newDistribution: String): KlibDiff { - val oldPlatformLibs = oldDistribution.platformLibs(target) - val oldPlatformLibsNames = oldPlatformLibs.list().toSet() - val newPlatformLibs = newDistribution.platformLibs(target) - val newPlatformLibsNames = newPlatformLibs.list().toSet() - return KlibDiff( - (newPlatformLibsNames - oldPlatformLibsNames).map(newPlatformLibs::resolve), - (oldPlatformLibsNames - newPlatformLibsNames).map(oldPlatformLibs::resolve), - oldPlatformLibsNames.intersect(newPlatformLibsNames).map { - RemainingLibrary(newPlatformLibs.resolve(it), oldPlatformLibs.resolve(it)) - } + RemainingLibrary(newDistribution.stdlib(), oldDistribution.stdlib()) - ) - } private fun getKlibSignatures(klib: File): List { val tool = if (HostManager.hostIsMingw) "klib.bat" else "klib" diff --git a/kotlin-native/build.gradle b/kotlin-native/build.gradle index 8cf97669123..75648adf60a 100644 --- a/kotlin-native/build.gradle +++ b/kotlin-native/build.gradle @@ -792,12 +792,20 @@ task compdb(type: Copy) { if (project.hasProperty("anotherDistro")) { targetList.each { targetName -> - task "${targetName}CheckAbiCompatibility"(type: CompareDistributionSignatures) { + task "${targetName}CheckPlatformAbiCompatibility"(type: CompareDistributionSignatures) { dependsOn "${targetName}PlatformLibs" - target = targetName + libraries = new CompareDistributionSignatures.Libraries.Platform(targetName) oldDistribution = project.findProperty("anotherDistro") onMismatchMode = CompareDistributionSignatures.OnMismatchMode.FAIL } } + + task "checkStdlibAbiCompatibility"(type: CompareDistributionSignatures) { + dependsOn "distRuntime" + + libraries = CompareDistributionSignatures.Libraries.Standard.INSTANCE + oldDistribution = project.findProperty("anotherDistro") + onMismatchMode = CompareDistributionSignatures.OnMismatchMode.FAIL + } } From cb642bca69bf8eeaeadfcc9c2f5bf170ab9c4ea2 Mon Sep 17 00:00:00 2001 From: Elena Lepilkina Date: Wed, 25 Nov 2020 11:20:40 +0300 Subject: [PATCH 634/698] Updated kotlinx.cli to version 0.3.1 --- .../src/main/kotlin/kotlinx/cli/ArgParser.kt | 93 ++++++++++++------- .../src/main/kotlin/kotlinx/cli/ArgType.kt | 43 +++++++-- .../src/main/kotlin/kotlinx/cli/Arguments.kt | 12 +-- .../kotlin/kotlinx/cli/ExperimentalCli.kt | 2 +- .../src/main/kotlin/kotlinx/cli/Options.kt | 16 ++-- .../kotlinx.cli/src/tests/ArgumentsTests.kt | 2 + .../kotlinx.cli/src/tests/DataSourceEnum.kt | 9 ++ .../kotlinx.cli/src/tests/ErrorTests.kt | 24 ++++- .../kotlinx.cli/src/tests/HelpTests.kt | 47 +++++++--- .../kotlinx.cli/src/tests/OptionsTests.kt | 46 +++++++-- .../kotlinx.cli/src/tests/SubcommandsTests.kt | 35 ++++++- 11 files changed, 247 insertions(+), 82 deletions(-) create mode 100644 kotlin-native/endorsedLibraries/kotlinx.cli/src/tests/DataSourceEnum.kt diff --git a/kotlin-native/endorsedLibraries/kotlinx.cli/src/main/kotlin/kotlinx/cli/ArgParser.kt b/kotlin-native/endorsedLibraries/kotlinx.cli/src/main/kotlin/kotlinx/cli/ArgParser.kt index 241ececc491..01362c149b6 100644 --- a/kotlin-native/endorsedLibraries/kotlinx.cli/src/main/kotlin/kotlinx/cli/ArgParser.kt +++ b/kotlin-native/endorsedLibraries/kotlinx.cli/src/main/kotlin/kotlinx/cli/ArgParser.kt @@ -143,12 +143,12 @@ open class ArgParser( /** * Used prefix form for full option form. */ - private val optionFullFormPrefix = if (prefixStyle == OptionPrefixStyle.JVM) "-" else "--" + protected val optionFullFormPrefix = if (prefixStyle == OptionPrefixStyle.JVM) "-" else "--" /** * Used prefix form for short option form. */ - private val optionShortFromPrefix = "-" + protected val optionShortFromPrefix = "-" /** * Name with all commands that should be executed. @@ -160,6 +160,21 @@ open class ArgParser( */ protected var treatAsOption = true + /** + * Arguments which should be parsed with subcommands. + */ + private val subcommandsArguments = mutableListOf() + + /** + * Options which should be parsed with subcommands. + */ + private val subcommandsOptions = mutableListOf() + + /** + * Subcommand used in commmand line arguments. + */ + private var usedSubcommand: Subcommand? = null + /** * The way an option/argument has got its value. */ @@ -229,7 +244,7 @@ open class ArgParser( if (prefixStyle == OptionPrefixStyle.GNU && shortName != null) require(shortName.length == 1) { """ - GNU standart for options allow to use short form whuch consists of one character. + GNU standart for options allow to use short form which consists of one character. For more information, please, see https://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html """.trimIndent() } @@ -359,7 +374,9 @@ open class ArgParser( */ private fun treatAsArgument(arg: String, argumentsQueue: ArgumentsQueue) { if (!saveAsArg(arg, argumentsQueue)) { - printError("Too many arguments! Couldn't process argument $arg!") + usedSubcommand?.let { + (if (treatAsOption) subcommandsOptions else subcommandsArguments).add(arg) + } ?: printError("Too many arguments! Couldn't process argument $arg!") } } @@ -416,9 +433,12 @@ open class ArgParser( * * @param argValue argument value with all information about option. */ - private fun saveOptionWithoutParameter(argValue: ParsingValue<*, *>) { + internal fun saveOptionWithoutParameter(argValue: ParsingValue<*, *>) { // Boolean flags. if (argValue.descriptor.fullName == "help") { + usedSubcommand?.let { + it.parse(listOf("${it.optionFullFormPrefix}${argValue.descriptor.fullName}")) + } println(makeUsage()) exitProcess(0) } @@ -569,43 +589,42 @@ open class ArgParser( } val argumentsQueue = ArgumentsQueue(arguments.map { it.value.descriptor as ArgDescriptor<*, *> }) + usedSubcommand = null + subcommandsOptions.clear() + subcommandsArguments.clear() val argIterator = args.listIterator() try { while (argIterator.hasNext()) { val arg = argIterator.next() // Check for subcommands. - @OptIn(ExperimentalCli::class) - subcommands.forEach { (name, subcommand) -> - if (arg == name) { - // Use parser for this subcommand. - subcommand.parse(args.slice(argIterator.nextIndex() until args.size)) - subcommand.execute() - parsingState = ArgParserResult(name) - - return parsingState!! - } - } - // Parse arguments from command line. - if (treatAsOption && arg.startsWith('-')) { - // Candidate in being option. - // Option is found. - if (!(recognizeAndSaveOptionShortForm(arg, argIterator) || - recognizeAndSaveOptionFullForm(arg, argIterator))) { - // State is changed so next options are arguments. - if (!treatAsOption) { - // Argument is found. - treatAsArgument(argIterator.next(), argumentsQueue) - } else { - // Try save as argument. - if (!saveAsArg(arg, argumentsQueue)) { - printError("Unknown option $arg") + if (arg !in subcommands) { + // Parse arguments from command line. + if (treatAsOption && arg.startsWith('-')) { + // Candidate in being option. + // Option is found. + if (!(recognizeAndSaveOptionShortForm(arg, argIterator) || + recognizeAndSaveOptionFullForm(arg, argIterator)) + ) { + // State is changed so next options are arguments. + if (!treatAsOption) { + // Argument is found. + treatAsArgument(argIterator.next(), argumentsQueue) + } else { + usedSubcommand?.let { subcommandsOptions.add(arg) } ?: run { + // Try save as argument. + if (!saveAsArg(arg, argumentsQueue)) { + printError("Unknown option $arg") + } + } } } + } else { + // Argument is found. + treatAsArgument(arg, argumentsQueue) } } else { - // Argument is found. - treatAsArgument(arg, argumentsQueue) + usedSubcommand = subcommands[arg] } } // Postprocess results of parsing. @@ -618,6 +637,14 @@ open class ArgParser( printError("Value for ${value.descriptor.textDescription} should be always provided in command line.") } } + // Parse arguments for subcommand. + usedSubcommand?.let { + it.parse(subcommandsOptions + listOfNotNull("--".takeUnless { treatAsOption }) + subcommandsArguments) + it.execute() + parsingState = ArgParserResult(it.name) + + return parsingState!! + } } catch (exception: ParsingException) { printError(exception.message!!) } @@ -661,4 +688,4 @@ open class ArgParser( */ internal fun printWarning(message: String) { println("WARNING $message") -} \ No newline at end of file +} diff --git a/kotlin-native/endorsedLibraries/kotlinx.cli/src/main/kotlin/kotlinx/cli/ArgType.kt b/kotlin-native/endorsedLibraries/kotlinx.cli/src/main/kotlin/kotlinx/cli/ArgType.kt index d5da8e21da6..333aa89e915 100644 --- a/kotlin-native/endorsedLibraries/kotlinx.cli/src/main/kotlin/kotlinx/cli/ArgType.kt +++ b/kotlin-native/endorsedLibraries/kotlinx.cli/src/main/kotlin/kotlinx/cli/ArgType.kt @@ -70,17 +70,46 @@ abstract class ArgType(val hasParameter: kotlin.Boolean) { ?: throw ParsingException("Option $name is expected to be double number. $value is provided.") } + companion object { + /** + * Helper for arguments that have limited set of possible values represented as enumeration constants. + */ + inline fun > Choice( + noinline toVariant: (kotlin.String) -> T = { + enumValues().find { e -> e.toString().equals(it, ignoreCase = true) } ?: + throw IllegalArgumentException("No enum constant $it") + }, + noinline toString: (T) -> kotlin.String = { it.toString().toLowerCase() }): Choice { + return Choice(enumValues().toList(), toVariant, toString) + } + } + /** * Type for arguments that have limited set of possible values. */ - class Choice(val values: List) : ArgType(true) { - override val description: kotlin.String - get() = "{ Value should be one of $values }" + class Choice(choices: List, + val toVariant: (kotlin.String) -> T, + val variantToString: (T) -> kotlin.String = { it.toString() }): ArgType(true) { + private val choicesMap: Map = choices.associateBy { variantToString(it) } - override fun convert(value: kotlin.String, name: kotlin.String): kotlin.String = - if (value in values) value - else throw ParsingException("Option $name is expected to be one of $values. $value is provided.") + init { + require(choicesMap.size == choices.size) { + "Command line representations of enum choices are not distinct" + } + } + + override val description: kotlin.String + get() { + return "{ Value should be one of ${choicesMap.keys} }" + } + + override fun convert(value: kotlin.String, name: kotlin.String) = + try { + toVariant(value) + } catch (e: Exception) { + throw ParsingException("Option $name is expected to be one of ${choicesMap.keys}. $value is provided.") + } } } -internal class ParsingException(message: String) : Exception(message) \ No newline at end of file +internal class ParsingException(message: String) : Exception(message) diff --git a/kotlin-native/endorsedLibraries/kotlinx.cli/src/main/kotlin/kotlinx/cli/Arguments.kt b/kotlin-native/endorsedLibraries/kotlinx.cli/src/main/kotlin/kotlinx/cli/Arguments.kt index e25d860e5dc..23e3019b281 100644 --- a/kotlin-native/endorsedLibraries/kotlinx.cli/src/main/kotlin/kotlinx/cli/Arguments.kt +++ b/kotlin-native/endorsedLibraries/kotlinx.cli/src/main/kotlin/kotlinx/cli/Arguments.kt @@ -159,7 +159,7 @@ class MultipleArgument internal c fun AbstractSingleArgument.multiple(number: Int): MultipleArgument { require(number >= 2) { "multiple() modifier with value less than 2 is unavailable. It's already set to 1." } - val newArgument = with(delegate.cast>().descriptor as ArgDescriptor) { + val newArgument = with((delegate.cast>()).descriptor as ArgDescriptor) { MultipleArgument(ArgDescriptor(type, fullName, number, description, listOfNotNull(defaultValue), required, deprecatedWarning), owner) } @@ -172,7 +172,7 @@ fun */ fun AbstractSingleArgument.vararg(): MultipleArgument { - val newArgument = with(delegate.cast>().descriptor as ArgDescriptor) { + val newArgument = with((delegate.cast>()).descriptor as ArgDescriptor) { MultipleArgument(ArgDescriptor(type, fullName, null, description, listOfNotNull(defaultValue), required, deprecatedWarning), owner) } @@ -189,7 +189,7 @@ fun AbstractSingleArgum * @param value the default value. */ fun SingleNullableArgument.default(value: T): SingleArgument { - val newArgument = with(delegate.cast>().descriptor as ArgDescriptor) { + val newArgument = with((delegate.cast>()).descriptor as ArgDescriptor) { SingleArgument(ArgDescriptor(type, fullName, number, description, value, false, deprecatedWarning), owner) } @@ -208,7 +208,7 @@ fun SingleNullableArgument.default(value: T): SingleArgument MultipleArgument.default(value: Collection): MultipleArgument { require (value.isNotEmpty()) { "Default value for argument can't be empty collection." } - val newArgument = with(delegate.cast>>().descriptor as ArgDescriptor) { + val newArgument = with((delegate.cast>>()).descriptor as ArgDescriptor) { MultipleArgument(ArgDescriptor(type, fullName, number, description, value.toList(), required, deprecatedWarning), owner) } @@ -224,7 +224,7 @@ fun MultipleArgument.default(value: Collec * Note that only trailing arguments can be optional, i.e. no required arguments can follow optional ones. */ fun SingleArgument.optional(): SingleNullableArgument { - val newArgument = with(delegate.cast>().descriptor as ArgDescriptor) { + val newArgument = with((delegate.cast>()).descriptor as ArgDescriptor) { SingleNullableArgument(ArgDescriptor(type, fullName, number, description, defaultValue, false, deprecatedWarning), owner) } @@ -240,7 +240,7 @@ fun SingleArgument.optional(): SingleN * Note that only trailing arguments can be optional: no required arguments can follow the optional ones. */ fun MultipleArgument.optional(): MultipleArgument { - val newArgument = with(delegate.cast>>().descriptor as ArgDescriptor) { + val newArgument = with((delegate.cast>>()).descriptor as ArgDescriptor) { MultipleArgument(ArgDescriptor(type, fullName, number, description, defaultValue?.toList() ?: listOf(), false, deprecatedWarning), owner) } diff --git a/kotlin-native/endorsedLibraries/kotlinx.cli/src/main/kotlin/kotlinx/cli/ExperimentalCli.kt b/kotlin-native/endorsedLibraries/kotlinx.cli/src/main/kotlin/kotlinx/cli/ExperimentalCli.kt index d35f6be01bf..7f8f2e9fc14 100644 --- a/kotlin-native/endorsedLibraries/kotlinx.cli/src/main/kotlin/kotlinx/cli/ExperimentalCli.kt +++ b/kotlin-native/endorsedLibraries/kotlinx.cli/src/main/kotlin/kotlinx/cli/ExperimentalCli.kt @@ -17,7 +17,7 @@ import kotlin.annotation.AnnotationTarget.* * annotating that usage with the [UseExperimental] annotation, e.g. `@UseExperimental(ExperimentalCli::class)`, * or by using the compiler argument `-Xuse-experimental=kotlinx.cli.ExperimentalCli`. */ -@RequiresOptIn("This API is experimental. It may be changed in the future without notice.", level = RequiresOptIn.Level.WARNING) +@RequiresOptIn("This API is experimental. It may be changed in the future without notice.", RequiresOptIn.Level.WARNING) @Retention(AnnotationRetention.BINARY) @Target( CLASS, diff --git a/kotlin-native/endorsedLibraries/kotlinx.cli/src/main/kotlin/kotlinx/cli/Options.kt b/kotlin-native/endorsedLibraries/kotlinx.cli/src/main/kotlin/kotlinx/cli/Options.kt index 69999451842..defa00dd4ca 100644 --- a/kotlin-native/endorsedLibraries/kotlinx.cli/src/main/kotlin/kotlinx/cli/Options.kt +++ b/kotlin-native/endorsedLibraries/kotlinx.cli/src/main/kotlin/kotlinx/cli/Options.kt @@ -103,7 +103,7 @@ class MultipleOption AbstractSingleOption.multiple(): MultipleOption { - val newOption = with(delegate.cast>().descriptor as OptionDescriptor) { + val newOption = with((delegate.cast>()).descriptor as OptionDescriptor) { MultipleOption( OptionDescriptor( optionFullFormPrefix, optionShortFromPrefix, type, fullName, shortName, @@ -122,7 +122,7 @@ fun AbstractSingleOption MultipleOption.multiple(): MultipleOption { - val newOption = with(delegate.cast>>().descriptor as OptionDescriptor) { + val newOption = with((delegate.cast>>()).descriptor as OptionDescriptor) { if (multiple) { error("Try to use modifier multiple() twice on option ${fullName ?: ""}") } @@ -145,7 +145,7 @@ fun MultipleOption SingleNullableOption.default(value: T): SingleOption { - val newOption = with(delegate.cast>().descriptor as OptionDescriptor) { + val newOption = with((delegate.cast>()).descriptor as OptionDescriptor) { SingleOption( OptionDescriptor( optionFullFormPrefix, optionShortFromPrefix, type, fullName, shortName, @@ -167,7 +167,7 @@ fun SingleNullableOption.default(value: T): SingleOption MultipleOption.default(value: Collection): MultipleOption { - val newOption = with(delegate.cast>>().descriptor as OptionDescriptor) { + val newOption = with((delegate.cast>>()).descriptor as OptionDescriptor) { require(value.isNotEmpty()) { "Default value for option can't be empty collection." } MultipleOption( OptionDescriptor( @@ -185,7 +185,7 @@ fun * Requires the option to be always provided in command line. */ fun SingleNullableOption.required(): SingleOption { - val newOption = with(delegate.cast>().descriptor as OptionDescriptor) { + val newOption = with((delegate.cast>()).descriptor as OptionDescriptor) { SingleOption( OptionDescriptor( optionFullFormPrefix, optionShortFromPrefix, type, fullName, @@ -204,7 +204,7 @@ fun SingleNullableOption.required(): SingleOption MultipleOption.required(): MultipleOption { - val newOption = with(delegate.cast>>().descriptor as OptionDescriptor) { + val newOption = with((delegate.cast>>()).descriptor as OptionDescriptor) { MultipleOption( OptionDescriptor( optionFullFormPrefix, optionShortFromPrefix, type, fullName, shortName, @@ -228,7 +228,7 @@ fun fun AbstractSingleOption.delimiter( delimiterValue: String): MultipleOption { - val newOption = with(delegate.cast>().descriptor as OptionDescriptor) { + val newOption = with((delegate.cast>()).descriptor as OptionDescriptor) { MultipleOption( OptionDescriptor( optionFullFormPrefix, optionShortFromPrefix, type, fullName, shortName, @@ -252,7 +252,7 @@ fun AbstractSingleOption MultipleOption.delimiter( delimiterValue: String): MultipleOption { - val newOption = with(delegate.cast>>().descriptor as OptionDescriptor) { + val newOption = with((delegate.cast>>()).descriptor as OptionDescriptor) { MultipleOption( OptionDescriptor( optionFullFormPrefix, optionShortFromPrefix, type, fullName, shortName, diff --git a/kotlin-native/endorsedLibraries/kotlinx.cli/src/tests/ArgumentsTests.kt b/kotlin-native/endorsedLibraries/kotlinx.cli/src/tests/ArgumentsTests.kt index db49aa8e2b4..b5e737cfdf1 100644 --- a/kotlin-native/endorsedLibraries/kotlinx.cli/src/tests/ArgumentsTests.kt +++ b/kotlin-native/endorsedLibraries/kotlinx.cli/src/tests/ArgumentsTests.kt @@ -3,6 +3,8 @@ * that can be found in the LICENSE file. */ +@file:Suppress("UNUSED_VARIABLE") + package kotlinx.cli import kotlinx.cli.ArgParser diff --git a/kotlin-native/endorsedLibraries/kotlinx.cli/src/tests/DataSourceEnum.kt b/kotlin-native/endorsedLibraries/kotlinx.cli/src/tests/DataSourceEnum.kt new file mode 100644 index 00000000000..e9f43ec062b --- /dev/null +++ b/kotlin-native/endorsedLibraries/kotlinx.cli/src/tests/DataSourceEnum.kt @@ -0,0 +1,9 @@ +package kotlinx.cli + +enum class DataSourceEnum { + LOCAL, + STAGING, + PRODUCTION; + + override fun toString(): String = name.toLowerCase() +} diff --git a/kotlin-native/endorsedLibraries/kotlinx.cli/src/tests/ErrorTests.kt b/kotlin-native/endorsedLibraries/kotlinx.cli/src/tests/ErrorTests.kt index 411d3f48738..1e5cf5b9055 100644 --- a/kotlin-native/endorsedLibraries/kotlinx.cli/src/tests/ErrorTests.kt +++ b/kotlin-native/endorsedLibraries/kotlinx.cli/src/tests/ErrorTests.kt @@ -3,10 +3,10 @@ * that can be found in the LICENSE file. */ +@file:Suppress("UNUSED_VARIABLE") + package kotlinx.cli -import kotlinx.cli.ArgParser -import kotlinx.cli.ArgType import kotlin.test.* class ErrorTests { @@ -42,15 +42,31 @@ class ErrorTests { assertTrue("Option number is expected to be integer number. out.txt is provided." in exception.message!!) } + enum class RenderEnum { + TEXT, + HTML; + } + @Test fun testWrongChoice() { val argParser = ArgParser("testParser") val useShortForm by argParser.option(ArgType.Boolean, "short", "s", "Show short version of report").default(false) - val renders by argParser.option(ArgType.Choice(listOf("text", "html")), - "renders", "r", "Renders for showing information").multiple().default(listOf("text")) + val renders by argParser.option(ArgType.Choice(), + "renders", "r", "Renders for showing information").multiple().default(listOf(RenderEnum.TEXT)) val exception = assertFailsWith { argParser.parse(arrayOf("-r", "xml")) } assertTrue("Option renders is expected to be one of [text, html]. xml is provided." in exception.message!!) } + + @Test + fun testWrongEnumChoice() { + val argParser = ArgParser("testParser") + val sources by argParser.option(ArgType.Choice(), + "sources", "s", "Data sources").multiple().default(listOf(DataSourceEnum.PRODUCTION)) + val exception = assertFailsWith { + argParser.parse(arrayOf("-s", "debug")) + } + assertTrue("Option sources is expected to be one of [local, staging, production]. debug is provided." in exception.message!!) + } } diff --git a/kotlin-native/endorsedLibraries/kotlinx.cli/src/tests/HelpTests.kt b/kotlin-native/endorsedLibraries/kotlinx.cli/src/tests/HelpTests.kt index eafa058a663..eef98fb8881 100644 --- a/kotlin-native/endorsedLibraries/kotlinx.cli/src/tests/HelpTests.kt +++ b/kotlin-native/endorsedLibraries/kotlinx.cli/src/tests/HelpTests.kt @@ -3,16 +3,20 @@ * that can be found in the LICENSE file. */ @file:OptIn(ExperimentalCli::class) +@file:Suppress("UNUSED_VARIABLE") + package kotlinx.cli -import kotlinx.cli.ArgParser -import kotlinx.cli.ArgType -import kotlinx.cli.ExperimentalCli -import kotlinx.cli.Subcommand -import kotlin.math.exp import kotlin.test.* class HelpTests { + enum class Renders { + TEXT, + HTML, + TEAMCITY, + STATISTICS, + METRICS + } @Test fun testHelpMessage() { val argParser = ArgParser("test") @@ -23,8 +27,10 @@ class HelpTests { val epsValue by argParser.option(ArgType.Double, "eps", "e", "Meaningful performance changes").default(1.0) val useShortForm by argParser.option(ArgType.Boolean, "short", "s", "Show short version of report").default(false) - val renders by argParser.option(ArgType.Choice(listOf("text", "html", "teamcity", "statistics", "metrics")), + val renders by argParser.option(ArgType.Choice(listOf("text", "html", "teamcity", "statistics", "metrics"), { it }), shortName = "r", description = "Renders for showing information").multiple().default(listOf("text")) + val sources by argParser.option(ArgType.Choice(), + "sources", "ds", "Data sources").multiple().default(listOf(DataSourceEnum.PRODUCTION)) val user by argParser.option(ArgType.String, shortName = "u", description = "User access information for authorization") argParser.parse(arrayOf("main.txt")) val helpOutput = argParser.makeUsage().trimIndent() @@ -40,33 +46,47 @@ Options: --eps, -e [$epsDefault] -> Meaningful performance changes { Double } --short, -s [false] -> Show short version of report --renders, -r [text] -> Renders for showing information { Value should be one of [text, html, teamcity, statistics, metrics] } + --sources, -ds [production] -> Data sources { Value should be one of [local, staging, production] } --user, -u -> User access information for authorization { String } --help, -h -> Usage info """.trimIndent() assertEquals(expectedOutput, helpOutput) } + enum class MetricType { + SAMPLES, + GEOMEAN; + + override fun toString() = name.toLowerCase() + } + @Test fun testHelpForSubcommands() { class Summary: Subcommand("summary", "Get summary information") { - val exec by option(ArgType.Choice(listOf("samples", "geomean")), - description = "Execution time way of calculation").default("geomean") + val exec by option(ArgType.Choice(), + description = "Execution time way of calculation").default(MetricType.GEOMEAN) val execSamples by option(ArgType.String, "exec-samples", description = "Samples used for execution time metric (value 'all' allows use all samples)").delimiter(",") val execNormalize by option(ArgType.String, "exec-normalize", description = "File with golden results which should be used for normalization") - val compile by option(ArgType.Choice(listOf("samples", "geomean")), - description = "Compile time way of calculation").default("geomean") + val compile by option(ArgType.Choice(), + description = "Compile time way of calculation").default(MetricType.GEOMEAN) val compileSamples by option(ArgType.String, "compile-samples", description = "Samples used for compile time metric (value 'all' allows use all samples)").delimiter(",") val compileNormalize by option(ArgType.String, "compile-normalize", description = "File with golden results which should be used for normalization") - val codesize by option(ArgType.Choice(listOf("samples", "geomean")), - description = "Code size way of calculation").default("geomean") + val codesize by option(ArgType.Choice(), + description = "Code size way of calculation").default(MetricType.GEOMEAN) val codesizeSamples by option(ArgType.String, "codesize-samples", description = "Samples used for code size metric (value 'all' allows use all samples)").delimiter(",") val codesizeNormalize by option(ArgType.String, "codesize-normalize", description = "File with golden results which should be used for normalization") + val source by option(ArgType.Choice(), + description = "Data source").default(DataSourceEnum.PRODUCTION) + val sourceSamples by option(ArgType.String, "source-samples", + description = "Samples used for code size metric (value 'all' allows use all samples)").delimiter(",") + val sourceNormalize by option(ArgType.String, "source-normalize", + description = "File with golden results which should be used for normalization") val user by option(ArgType.String, shortName = "u", description = "User access information for authorization") val mainReport by argument(ArgType.String, description = "Main report for analysis") @@ -94,6 +114,9 @@ Options: --codesize [geomean] -> Code size way of calculation { Value should be one of [samples, geomean] } --codesize-samples -> Samples used for code size metric (value 'all' allows use all samples) { String } --codesize-normalize -> File with golden results which should be used for normalization { String } + --source [production] -> Data source { Value should be one of [local, staging, production] } + --source-samples -> Samples used for code size metric (value 'all' allows use all samples) { String } + --source-normalize -> File with golden results which should be used for normalization { String } --user, -u -> User access information for authorization { String } --help, -h -> Usage info """.trimIndent() diff --git a/kotlin-native/endorsedLibraries/kotlinx.cli/src/tests/OptionsTests.kt b/kotlin-native/endorsedLibraries/kotlinx.cli/src/tests/OptionsTests.kt index 8a883c1fca3..df25e5ad1b3 100644 --- a/kotlin-native/endorsedLibraries/kotlinx.cli/src/tests/OptionsTests.kt +++ b/kotlin-native/endorsedLibraries/kotlinx.cli/src/tests/OptionsTests.kt @@ -3,6 +3,8 @@ * that can be found in the LICENSE file. */ +@file:Suppress("UNUSED_VARIABLE") + package kotlinx.cli import kotlin.test.* @@ -38,6 +40,13 @@ class OptionsTests { assertEquals("input.txt", input) } + enum class Renders { + TEXT, + HTML, + XML, + JSON + } + @Test fun testGNUPrefix() { val argParser = ArgParser("testParser", prefixStyle = ArgParser.OptionPrefixStyle.GNU) @@ -74,26 +83,37 @@ class OptionsTests { fun testMultipleOptions() { val argParser = ArgParser("testParser") val useShortForm by argParser.option(ArgType.Boolean, "short", "s", "Show short version of report").default(false) - val renders by argParser.option(ArgType.Choice(listOf("text", "html", "xml", "json")), - "renders", "r", "Renders for showing information").multiple().default(listOf("text")) - argParser.parse(arrayOf("-s", "-r", "text", "-r", "json")) + val renders by argParser.option(ArgType.Choice(), + "renders", "r", "Renders for showing information").multiple().default(listOf(Renders.TEXT)) + val sources by argParser.option(ArgType.Choice(), + "sources", "ds", "Data sources").multiple().default(listOf(DataSourceEnum.PRODUCTION)) + argParser.parse(arrayOf("-s", "-r", "text", "-r", "json", "-ds", "local", "-ds", "production")) assertEquals(true, useShortForm) + assertEquals(2, renders.size) val (firstRender, secondRender) = renders - assertEquals("text", firstRender) - assertEquals("json", secondRender) + assertEquals(Renders.TEXT, firstRender) + assertEquals(Renders.JSON, secondRender) + + assertEquals(2, sources.size) + val (firstSource, secondSource) = sources + assertEquals(DataSourceEnum.LOCAL, firstSource) + assertEquals(DataSourceEnum.PRODUCTION, secondSource) } @Test fun testDefaultOptions() { val argParser = ArgParser("testParser") val useShortForm by argParser.option(ArgType.Boolean, "short", "s", "Show short version of report").default(false) - val renders by argParser.option(ArgType.Choice(listOf("text", "html", "xml", "json")), - "renders", "r", "Renders for showing information").multiple().default(listOf("text")) + val renders by argParser.option(ArgType.Choice(), + "renders", "r", "Renders for showing information").multiple().default(listOf(Renders.TEXT)) + val sources by argParser.option(ArgType.Choice(), + "sources", "ds", "Data sources").multiple().default(listOf(DataSourceEnum.PRODUCTION)) val output by argParser.option(ArgType.String, "output", "o", "Output file") argParser.parse(arrayOf("-o", "out.txt")) assertEquals(false, useShortForm) - assertEquals("text", renders[0]) + assertEquals(Renders.TEXT, renders[0]) + assertEquals(DataSourceEnum.PRODUCTION, sources[0]) } @Test @@ -101,20 +121,26 @@ class OptionsTests { val argParser = ArgParser("testParser") val useShortFormOption = argParser.option(ArgType.Boolean, "short", "s", "Show short version of report").default(false) var useShortForm by useShortFormOption - val rendersOption = argParser.option(ArgType.Choice(listOf("text", "html", "xml", "json")), - "renders", "r", "Renders for showing information").multiple().default(listOf("text")) + val rendersOption = argParser.option(ArgType.Choice(), + "renders", "r", "Renders for showing information").multiple().default(listOf(Renders.TEXT)) var renders by rendersOption + val sourcesOption = argParser.option(ArgType.Choice(), + "sources", "ds", "Data sources").multiple().default(listOf(DataSourceEnum.PRODUCTION)) + var sources by sourcesOption val outputOption = argParser.option(ArgType.String, "output", "o", "Output file") var output by outputOption argParser.parse(arrayOf("-o", "out.txt")) output = null useShortForm = true renders = listOf() + sources = listOf() assertEquals(true, useShortForm) assertEquals(null, output) assertEquals(0, renders.size) + assertEquals(0, sources.size) assertEquals(ArgParser.ValueOrigin.REDEFINED, outputOption.valueOrigin) assertEquals(ArgParser.ValueOrigin.REDEFINED, useShortFormOption.valueOrigin) assertEquals(ArgParser.ValueOrigin.REDEFINED, rendersOption.valueOrigin) + assertEquals(ArgParser.ValueOrigin.REDEFINED, sourcesOption.valueOrigin) } } diff --git a/kotlin-native/endorsedLibraries/kotlinx.cli/src/tests/SubcommandsTests.kt b/kotlin-native/endorsedLibraries/kotlinx.cli/src/tests/SubcommandsTests.kt index 2d13d10d11b..02a5b59857a 100644 --- a/kotlin-native/endorsedLibraries/kotlinx.cli/src/tests/SubcommandsTests.kt +++ b/kotlin-native/endorsedLibraries/kotlinx.cli/src/tests/SubcommandsTests.kt @@ -28,7 +28,7 @@ class SubcommandsTests { } val action = Summary() argParser.subcommands(action) - argParser.parse(arrayOf("-o", "out.txt", "summary", "-i", "2", "3", "5")) + argParser.parse(arrayOf("summary", "-o", "out.txt", "-i", "2", "3", "5")) assertEquals("out.txt", output) assertEquals(-10, action.result) } @@ -100,4 +100,37 @@ class SubcommandsTests { argParser.parse(arrayOf("calc", "-i", "summary", "2", "3", "5")) assertEquals(-10, action.result) } + + @Test + fun testCommonDefaultInSubcommand() { + val parser = ArgParser("testParser") + val output by parser.option(ArgType.String, "output", "o", "Output file") + .default("any_file") + class Summary: Subcommand("summary", "Calculate summary") { + val invert by option(ArgType.Boolean, "invert", "i", "Invert results").default(false) + val addendums by argument(ArgType.Int, "addendums", description = "Addendums").vararg() + var result: Int = 0 + + override fun execute() { + result = addendums.sum() + result = if (invert) -1 * result else result + println("result is: $result and will output to $output") + } + } + class Multiply: Subcommand("mul", "Multiply") { + val numbers by argument(ArgType.Int, description = "Addendums").vararg() + var result: Int = 0 + + override fun execute() { + result = numbers.reduce{ acc, it -> acc * it } + } + } + val summary = Summary() + val multiple = Multiply() + parser.subcommands(summary, multiple) + + parser.parse(arrayOf("summary", "1", "2", "4")) + assertEquals("any_file", output) + assertEquals(7, summary.result) + } } From f88d38314eaa4d77dd1a15049dc1cd9555a2b9c1 Mon Sep 17 00:00:00 2001 From: Elena Lepilkina Date: Wed, 25 Nov 2020 11:27:03 +0300 Subject: [PATCH 635/698] Rework usage of Choice options --- .../native/interop/gen/jvm/CommandLine.kt | 17 +++++++------ .../native/interop/gen/jvm/GenerationMode.kt | 13 ++++------ .../kotlin/native/interop/gen/jvm/main.kt | 15 ++++++------ .../utilities/GeneratePlatformLibraries.kt | 24 ++++++++++--------- .../kotlin/cli/utilities/InteropCompiler.kt | 2 +- 5 files changed, 35 insertions(+), 36 deletions(-) diff --git a/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/CommandLine.kt b/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/CommandLine.kt index e4a9a1bb23b..86b0d5b2f0e 100644 --- a/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/CommandLine.kt +++ b/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/CommandLine.kt @@ -19,6 +19,7 @@ package org.jetbrains.kotlin.native.interop.tool import kotlinx.cli.ArgParser import kotlinx.cli.ArgType import kotlinx.cli.* +import org.jetbrains.kotlin.native.interop.gen.jvm.GenerationMode const val HEADER_FILTER_ADDITIONAL_SEARCH_PREFIX = "headerFilterAdditionalSearchPrefix" const val NODEFAULTLIBS_DEPRECATED = "nodefaultlibs" @@ -46,7 +47,7 @@ open class CommonInteropArguments(val argParser: ArgParser) { .multiple() val repo by argParser.option(ArgType.String, shortName = "r", description = "repository to resolve dependencies") .multiple() - val mode by argParser.option(ArgType.Choice(listOf(MODE_METADATA, MODE_SOURCECODE)), description = "the way interop library is generated") + val mode by argParser.option(ArgType.Choice(), description = "the way interop library is generated") .default(DEFAULT_MODE) val nodefaultlibs by argParser.option(ArgType.Boolean, NODEFAULTLIBS, description = "don't link the libraries from dist/klib automatically").default(false) @@ -65,10 +66,7 @@ open class CommonInteropArguments(val argParser: ArgParser) { description = "additional kotlinc compiler option").multiple() companion object { - const val MODE_SOURCECODE = "sourcecode" - const val MODE_METADATA = "metadata" - - const val DEFAULT_MODE = MODE_METADATA + val DEFAULT_MODE = GenerationMode.METADATA } } @@ -127,8 +125,13 @@ open class CInteropArguments(argParser: ArgParser = class JSInteropArguments(argParser: ArgParser = ArgParser("jsinterop", prefixStyle = ArgParser.OptionPrefixStyle.JVM)): CommonInteropArguments(argParser) { - val target by argParser.option(ArgType.Choice(listOf("wasm32")), - description = "wasm target to compile to").default("wasm32") + enum class TargetType { + WASM32; + + override fun toString() = name.toLowerCase() + } + val target by argParser.option(ArgType.Choice(), + description = "wasm target to compile to").default(TargetType.WASM32) } internal fun warn(msg: String) { diff --git a/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/GenerationMode.kt b/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/GenerationMode.kt index 6174374932d..6fbd67d235d 100644 --- a/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/GenerationMode.kt +++ b/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/GenerationMode.kt @@ -1,13 +1,8 @@ package org.jetbrains.kotlin.native.interop.gen.jvm -import org.jetbrains.kotlin.native.interop.tool.CommonInteropArguments +enum class GenerationMode(val modeName: String) { + SOURCE_CODE("sourcecode"), + METADATA("metadata"); -enum class GenerationMode { - SOURCE_CODE, METADATA -} - -fun parseGenerationMode(mode: String): GenerationMode? = when(mode) { - CommonInteropArguments.MODE_METADATA -> GenerationMode.METADATA - CommonInteropArguments.MODE_SOURCECODE -> GenerationMode.SOURCE_CODE - else -> null + override fun toString(): String = modeName } \ No newline at end of file diff --git a/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt b/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt index 7fdcf966774..e7d58b300f1 100644 --- a/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt +++ b/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt @@ -50,8 +50,8 @@ data class InternalInteropOptions(val generated: String, val natives: String, va fun main(args: Array) { // Adding flavor option for interop plugin. class FullCInteropArguments: CInteropArguments() { - val flavor by argParser.option(ArgType.Choice(listOf("jvm", "native", "wasm")), description = "Interop target") - .default("jvm") + val flavor by argParser.option(ArgType.Choice(), description = "Interop target") + .default(KotlinPlatform.JVM) val generated by argParser.option(ArgType.String, description = "place generated bindings to the directory") .required() val natives by argParser.option(ArgType.String, description = "where to put the built native files") @@ -70,7 +70,8 @@ fun interop( "jvm", "native" -> { val cinteropArguments = CInteropArguments() cinteropArguments.argParser.parse(args) - processCLib(flavor, cinteropArguments, additionalArgs) + val platform = KotlinPlatform.values().single { it.name.equals(flavor, ignoreCase = true) } + processCLib(platform, cinteropArguments, additionalArgs) } "wasm" -> processIdlLib(args, additionalArgs) else -> error("Unexpected flavor") @@ -192,11 +193,10 @@ private fun findFilesByGlobs(roots: List, globs: List): Map? { val ktGenRoot = additionalArgs.generated val nativeLibsDir = additionalArgs.natives - val flavor = KotlinPlatform.values().single { it.name.equals(flavorName, ignoreCase = true) } val defFile = cinteropArguments.def?.let { File(it) } val manifestAddend = additionalArgs.manifest?.let { File(it) } @@ -210,7 +210,7 @@ private fun processCLib(flavorName: String, cinteropArguments: CInteropArguments val isLinkerOptsSetByUser = (cinteropArguments.linkerOpts.valueOrigin == ArgParser.ValueOrigin.SET_BY_USER) || (cinteropArguments.linkerOptions.valueOrigin == ArgParser.ValueOrigin.SET_BY_USER) || (cinteropArguments.linkerOption.valueOrigin == ArgParser.ValueOrigin.SET_BY_USER) - if (flavorName == "native" && isLinkerOptsSetByUser) { + if (flavor == KotlinPlatform.NATIVE && isLinkerOptsSetByUser) { warn("-linker-option(s)/-linkerOpts option is not supported by cinterop. Please add linker options to .def file or binary compilation instead.") } @@ -238,8 +238,7 @@ private fun processCLib(flavorName: String, cinteropArguments: CInteropArguments val outKtPkg = fqParts.joinToString(".") val mode = run { - val providedMode = parseGenerationMode(cinteropArguments.mode) - ?: error ("Unexpected interop generation mode: ${cinteropArguments.mode}") + val providedMode = cinteropArguments.mode if (providedMode == GenerationMode.METADATA && flavor == KotlinPlatform.JVM) { warn("Metadata mode isn't supported for Kotlin/JVM! Falling back to sourcecode.") diff --git a/kotlin-native/utilities/cli-runner/src/main/kotlin/org/jetbrains/kotlin/cli/utilities/GeneratePlatformLibraries.kt b/kotlin-native/utilities/cli-runner/src/main/kotlin/org/jetbrains/kotlin/cli/utilities/GeneratePlatformLibraries.kt index e86c72d9c7b..c4fc36d6c58 100644 --- a/kotlin-native/utilities/cli-runner/src/main/kotlin/org/jetbrains/kotlin/cli/utilities/GeneratePlatformLibraries.kt +++ b/kotlin-native/utilities/cli-runner/src/main/kotlin/org/jetbrains/kotlin/cli/utilities/GeneratePlatformLibraries.kt @@ -19,9 +19,8 @@ import org.jetbrains.kotlin.konan.target.customerDistribution import org.jetbrains.kotlin.konan.util.KonanHomeProvider import org.jetbrains.kotlin.konan.util.PlatformLibsInfo import org.jetbrains.kotlin.konan.util.visibleName +import org.jetbrains.kotlin.native.interop.gen.jvm.GenerationMode import org.jetbrains.kotlin.native.interop.tool.CommonInteropArguments.Companion.DEFAULT_MODE -import org.jetbrains.kotlin.native.interop.tool.CommonInteropArguments.Companion.MODE_METADATA -import org.jetbrains.kotlin.native.interop.tool.CommonInteropArguments.Companion.MODE_SOURCECODE import org.jetbrains.kotlin.native.interop.tool.SHORT_MODULE_NAME import java.io.PrintWriter import java.io.StringWriter @@ -64,6 +63,11 @@ private fun Logger.logStackTrace(error: Throwable) { verbose(stringWriter.toString()) } +private enum class CacheKind(val outputKind: CompilerOutputKind) { + DYNAMIC_CACHE(CompilerOutputKind.DYNAMIC_CACHE), + STATIC_CACHE(CompilerOutputKind.STATIC_CACHE) +} + // TODO: Use Distribution's paths after compiler update. fun generatePlatformLibraries(args: Array) { // IMPORTANT! These command line keys are used by the Gradle plugin to configure platform libraries generation, @@ -90,17 +94,15 @@ fun generatePlatformLibraries(args: Array) { "Place where stdlib is located. Default value is /klib/common/stdlib" ) - val dynamicCacheKind = CompilerOutputKind.DYNAMIC_CACHE.visibleName - val staticCacheKind = CompilerOutputKind.STATIC_CACHE.visibleName val cacheKind by argParser.option( - ArgType.Choice(listOf(dynamicCacheKind, staticCacheKind)), "cache-kind", "k", "Type of cache." - ).default(dynamicCacheKind) + ArgType.Choice(toString = { it.outputKind.visibleName }), "cache-kind", "k", "Type of cache." + ).default(CacheKind.DYNAMIC_CACHE) val cacheDirectoryPath by argParser.option( ArgType.String, "cache-directory", "c", "Cache output directory") val mode by argParser.option( - ArgType.Choice(listOf(MODE_METADATA, MODE_SOURCECODE)), + ArgType.Choice(), fullName = "mode", shortName = "m", description = "The way interop library is generated." @@ -146,7 +148,7 @@ fun generatePlatformLibraries(args: Array) { val logger = Logger(if (verbose) Logger.Level.VERBOSE else Logger.Level.NORMAL) - val cacheInfo = cacheDirectory?.let { CacheInfo(it, cacheKind, cacheArgs) } + val cacheInfo = cacheDirectory?.let { CacheInfo(it, cacheKind.outputKind.visibleName, cacheArgs) } generatePlatformLibraries( target, mode, @@ -217,7 +219,7 @@ private fun topoSort(defFiles: List): List { private fun generateLibrary( target: KonanTarget, - mode: String, + mode: GenerationMode, def: DefFile, directories: DirectoriesInfo, tmpDirectory: File, @@ -242,7 +244,7 @@ private fun generateLibrary( "-compiler-option", "-fmodules-cache-path=${tmpDirectory.child("clangModulesCache").absolutePath}", "-repo", outputDirectory.absolutePath, "-no-default-libs", "-no-endorsed-libs", "-Xpurge-user-libs", "-nopack", - "-mode", mode, + "-mode", mode.modeName, "-$SHORT_MODULE_NAME", def.shortLibraryName, *def.depends.flatMap { listOf("-l", "$outputDirectory/${it.libraryName}") }.toTypedArray() ) @@ -327,7 +329,7 @@ private fun buildStdlibCache( K2Native.mainNoExit(compilerArgs) } -private fun generatePlatformLibraries(target: KonanTarget, mode: String, +private fun generatePlatformLibraries(target: KonanTarget, mode: GenerationMode, directories: DirectoriesInfo, cacheInfo: CacheInfo?, rebuild: Boolean, saveTemps: Boolean, logger: Logger) = with(directories) { if (cacheInfo != null) { diff --git a/kotlin-native/utilities/cli-runner/src/main/kotlin/org/jetbrains/kotlin/cli/utilities/InteropCompiler.kt b/kotlin-native/utilities/cli-runner/src/main/kotlin/org/jetbrains/kotlin/cli/utilities/InteropCompiler.kt index c2e7a97fdcc..829fc2fe7e8 100644 --- a/kotlin-native/utilities/cli-runner/src/main/kotlin/org/jetbrains/kotlin/cli/utilities/InteropCompiler.kt +++ b/kotlin-native/utilities/cli-runner/src/main/kotlin/org/jetbrains/kotlin/cli/utilities/InteropCompiler.kt @@ -39,7 +39,7 @@ fun invokeInterop(flavor: String, args: Array): Array? { val libraries = arguments.library val repos = arguments.repo val targetRequest = if (arguments is CInteropArguments) arguments.target - else (arguments as JSInteropArguments).target + else (arguments as JSInteropArguments).target.toString() val target = PlatformManager(KonanHomeProvider.determineKonanHome()).targetManager(targetRequest).target val cinteropArgsToCompiler = interop(flavor, args, From 5f8448b25d6d888a07870221d487d6bb6628d83e Mon Sep 17 00:00:00 2001 From: Igor Chevdar Date: Mon, 30 Nov 2020 12:57:07 +0500 Subject: [PATCH 636/698] Updated change log for 1.4.20 --- kotlin-native/CHANGELOG.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/kotlin-native/CHANGELOG.md b/kotlin-native/CHANGELOG.md index 90c926bd0a6..480e6fdbe49 100644 --- a/kotlin-native/CHANGELOG.md +++ b/kotlin-native/CHANGELOG.md @@ -1,3 +1,26 @@ +# 1.4.20 (Nov 2020) + * XCode 12 support + * Completely reworked escape analysis for object allocation + * Use ForeignException wrapper to handle native exceptions ([GH-3553](https://github.com/JetBrains/kotlin-native/issues/3553)) + * CocoaPods plugin improvements + * equals/hashCode support for adapted callable references ([KT-39800](https://youtrack.jetbrains.com/issue/KT-39800)) + * equals/hashCode support for fun interfaces ([KT-39798](https://youtrack.jetbrains.com/issue/KT-39798)) + * IR-level optimizations + * Constant folding + * String concatenation flattenning + * Various fixes/improvements to compiler caches + * Some fixes to samples (calculator, tensorflow) + * Bug fixes + * Eliminate recursive GC calls ([KT-42275](https://youtrack.jetbrains.com/issue/KT-42275)) + * Fix support for @OverrideInit constructors with default arguments ([KT-41910](https://youtrack.jetbrains.com/issue/KT-41910)) + * Fix support for forward declarations ([KT-41655](https://youtrack.jetbrains.com/issue/KT-41655)) + * [KT-41394](https://youtrack.jetbrains.com/issue/KT-41394) + * [KT-41811](https://youtrack.jetbrains.com/issue/KT-41811) + * [KT-41716](https://youtrack.jetbrains.com/issue/KT-41716) + * [KT-41250](https://youtrack.jetbrains.com/issue/KT-41250) + * [KT-42000](https://youtrack.jetbrains.com/issue/KT-42000) + * [KT-41907](https://youtrack.jetbrains.com/issue/KT-41907) + # 1.4.10 (Sep 2020) * Fixed a newline handling in @Deprecated annotation in ObjCExport ([KT-39206](https://youtrack.jetbrains.com/issue/KT-39206)) * Fixed suspend function types in ObjCExport ([KT-40976](https://youtrack.jetbrains.com/issue/KT-40976)) From 333685c7ee18d4c0bb9c1d5bce75dbd3b02c4fed Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Tue, 24 Nov 2020 15:49:28 +0700 Subject: [PATCH 637/698] Add a toolchain for toolchain building --- .../tools/toolchain_builder/Dockerfile | 46 + .../tools/toolchain_builder/README.md | 20 + .../toolchain_builder/build_toolchain.sh | 47 + .../tools/toolchain_builder/create_image.sh | 3 + .../patches/github_pull_1244.patch | 32 + .../tools/toolchain_builder/run_container.sh | 19 + .../gcc-8.3.0-glibc-2.25-kernel-4.9.config | 763 +++++++++++++++++ .../gcc-8.3.0-glibc-2.19-kernel-4.9.config | 810 ++++++++++++++++++ .../gcc-8.3.0-glibc-2.19-kernel-4.9.config | 743 ++++++++++++++++ 9 files changed, 2483 insertions(+) create mode 100644 kotlin-native/tools/toolchain_builder/Dockerfile create mode 100644 kotlin-native/tools/toolchain_builder/README.md create mode 100644 kotlin-native/tools/toolchain_builder/build_toolchain.sh create mode 100755 kotlin-native/tools/toolchain_builder/create_image.sh create mode 100644 kotlin-native/tools/toolchain_builder/patches/github_pull_1244.patch create mode 100755 kotlin-native/tools/toolchain_builder/run_container.sh create mode 100644 kotlin-native/tools/toolchain_builder/toolchains/aarch64-unknown-linux-gnu/gcc-8.3.0-glibc-2.25-kernel-4.9.config create mode 100644 kotlin-native/tools/toolchain_builder/toolchains/arm-unknown-linux-gnueabihf/gcc-8.3.0-glibc-2.19-kernel-4.9.config create mode 100644 kotlin-native/tools/toolchain_builder/toolchains/x86_64-unknown-linux-gnu/gcc-8.3.0-glibc-2.19-kernel-4.9.config diff --git a/kotlin-native/tools/toolchain_builder/Dockerfile b/kotlin-native/tools/toolchain_builder/Dockerfile new file mode 100644 index 00000000000..5eeee43e176 --- /dev/null +++ b/kotlin-native/tools/toolchain_builder/Dockerfile @@ -0,0 +1,46 @@ +# We might want to switch to alpine, but it is not stable enough yet. +FROM ubuntu:20.04 + +ENV TZ=Europe/Moscow +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +# Install crosstool-ng deps. +RUN apt-get update +RUN apt-get install -y curl gcc git g++ gperf bison flex texinfo help2man make libncurses5-dev \ + python3-dev autoconf automake libtool libtool-bin gawk wget bzip2 xz-utils unzip \ + patch libstdc++6 rsync + +# Put a fix for strip. +COPY patches/github_pull_1244.patch . +# Install crosstool-ng. +RUN git clone --branch crosstool-ng-1.24.0 --depth 1 https://github.com/crosstool-ng/crosstool-ng.git && \ + cd crosstool-ng && \ + git checkout b2151f1dba2b20c310adfe7198e461ec4469172b && \ + git apply ../github_pull_1244.patch && \ + ./bootstrap && ./configure && make && make install && \ + cd .. && rm -rf crosstool-ng + +# Create a user. +ARG USERNAME=ct +RUN groupadd -g 1000 $USERNAME +RUN useradd -r -u 1000 --create-home -g $USERNAME $USERNAME +USER $USERNAME +WORKDIR /home/$USERNAME + +# Download zlib sources. +RUN curl -LO https://zlib.net/zlib-1.2.11.tar.gz && \ + tar -xf zlib-1.2.11.tar.gz && \ + rm zlib-1.2.11.tar.gz + +# Save crosstool-ng config files. +COPY toolchains toolchains + +# Used by crosstool-ng. +RUN mkdir src + +ENV TARGET=x86_64-unknown-linux-gnu +ENV VERSION=gcc-8.3.0-glibc-2.19-kernel-4.9 + +# Add entry point. +COPY build_toolchain.sh . +ENTRYPOINT "/bin/bash" "build_toolchain.sh" ${TARGET} ${VERSION} \ No newline at end of file diff --git a/kotlin-native/tools/toolchain_builder/README.md b/kotlin-native/tools/toolchain_builder/README.md new file mode 100644 index 00000000000..5c91bdc9e94 --- /dev/null +++ b/kotlin-native/tools/toolchain_builder/README.md @@ -0,0 +1,20 @@ +# Kotlin/Native toolchains builder + +This directory contains a set of scripts and configuration files that allow one to build the same toolchain that is used by Kotlin/Native. + +### System requirements +* Docker + +### Usage +1. First, you need to build a Docker image with crosstool-ng inside. Use `create_image.sh` for it. +2. Now you can build an actual toolchain. To pick one, take a look inside `toolchains` folder. +It is organized as `$TARGET/$VERSION`. Then run `./run_container.sh $TARGET $VERSION`. Building a toolchain might take a while (~17 minutes on Ryzen 5 3600). +Once ready, an archive will be placed in `artifacts` folder. + +### Example +```bash +./create_image.sh && ./run_container.sh aarch64-unknown-linux-gnu gcc-8.3.0-glibc-2.25-kernel-4.9 +``` + +### Notes +Check that Docker can write to `artifacts` directory (where `build_toolchains.sh` places archives). diff --git a/kotlin-native/tools/toolchain_builder/build_toolchain.sh b/kotlin-native/tools/toolchain_builder/build_toolchain.sh new file mode 100644 index 00000000000..b9e716f2977 --- /dev/null +++ b/kotlin-native/tools/toolchain_builder/build_toolchain.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +set -eou pipefail + +TARGET=$1 +VERSION=$2 +HOME=/home/ct +ZLIB_VERSION=1.2.11 + +build_toolchain() { + mkdir $HOME/build-$TARGET + cd $HOME/build-$TARGET + cp $HOME/toolchains/$TARGET/$VERSION.config .config + ct-ng build + cd .. +} + +build_zlib() { + TOOLCHAINS_PATH=$HOME/x-tools + INSTALL_PATH=$TOOLCHAINS_PATH/$TARGET/$TARGET/sysroot/usr + TOOLCHAIN_BIN_PREFIX=$TOOLCHAINS_PATH/$TARGET/bin/$TARGET + cd $HOME/zlib-$ZLIB_VERSION + + CHOST=$TARGET \ + CC=$TOOLCHAIN_BIN_PREFIX-gcc \ + AR=$TOOLCHAIN_BIN_PREFIX-ar \ + RANLIB=$TOOLCHAIN_BIN_PREFIX-ranlib \ + ./configure \ + --prefix=$INSTALL_PATH + + make && make install +} + +build_archive() { + cd $HOME/x-tools + FULL_NAME=$TARGET-$VERSION + mv $TARGET $FULL_NAME + ARCHIVE_NAME="$FULL_NAME.tar.xz" + tar -czvf $ARCHIVE_NAME $FULL_NAME + cp $ARCHIVE_NAME /artifacts/$ARCHIVE_NAME +} + +echo "building toolchain for $TARGET" + +build_toolchain +build_zlib +build_archive \ No newline at end of file diff --git a/kotlin-native/tools/toolchain_builder/create_image.sh b/kotlin-native/tools/toolchain_builder/create_image.sh new file mode 100755 index 00000000000..9175f50b51a --- /dev/null +++ b/kotlin-native/tools/toolchain_builder/create_image.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +docker build -t kotlin-toolchain-builder . \ No newline at end of file diff --git a/kotlin-native/tools/toolchain_builder/patches/github_pull_1244.patch b/kotlin-native/tools/toolchain_builder/patches/github_pull_1244.patch new file mode 100644 index 00000000000..4be35c04781 --- /dev/null +++ b/kotlin-native/tools/toolchain_builder/patches/github_pull_1244.patch @@ -0,0 +1,32 @@ +From 8ad4a8b83f3de8b7b283a845c5744147ba819c9d Mon Sep 17 00:00:00 2001 +From: Chris Packham +Date: Sat, 14 Sep 2019 22:17:28 +1200 +Subject: [PATCH] build/internals.sh: Handle pie executables + +Fixes: #887 + +On some systems the file command identifies a pie executable as a shared +object. Update do_finish() to handle this case so that they are stripped +as well. + +Signed-off-by: Chris Packham +--- + scripts/build/internals.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/build/internals.sh b/scripts/build/internals.sh +index 5d359979..821761c2 100644 +--- a/scripts/build/internals.sh ++++ b/scripts/build/internals.sh +@@ -83,7 +83,7 @@ do_finish() { + case "${_type}" in + *script*executable*) + ;; +- *executable*) ++ *executable*|*shared*object*) + CT_DoExecLog ALL ${CT_HOST}-strip ${strip_args} "${_t}" + ;; + esac +-- +2.25.1 + diff --git a/kotlin-native/tools/toolchain_builder/run_container.sh b/kotlin-native/tools/toolchain_builder/run_container.sh new file mode 100755 index 00000000000..021ae4ee394 --- /dev/null +++ b/kotlin-native/tools/toolchain_builder/run_container.sh @@ -0,0 +1,19 @@ +#!/bin/sh +set -eou pipefail + +CONTAINER_NAME=kotlin-toolchain-builder +IMAGE_NAME=kotlin-toolchain-builder +TARGET=$1 +VERSION=$2 + +if ! "docker ps -a | grep $CONTAINER_NAME"; +then + echo "Removing previous container..." + docker stop $CONTAINER_NAME + docker rm $CONTAINER_NAME + echo "Done." +fi + +echo "Running build script in container..." +docker run -it -v "$PWD"/artifacts:/artifacts --env TARGET="$TARGET" --env VERSION="$VERSION" --name=$CONTAINER_NAME $IMAGE_NAME +echo "Done." \ No newline at end of file diff --git a/kotlin-native/tools/toolchain_builder/toolchains/aarch64-unknown-linux-gnu/gcc-8.3.0-glibc-2.25-kernel-4.9.config b/kotlin-native/tools/toolchain_builder/toolchains/aarch64-unknown-linux-gnu/gcc-8.3.0-glibc-2.25-kernel-4.9.config new file mode 100644 index 00000000000..758391feaad --- /dev/null +++ b/kotlin-native/tools/toolchain_builder/toolchains/aarch64-unknown-linux-gnu/gcc-8.3.0-glibc-2.25-kernel-4.9.config @@ -0,0 +1,763 @@ +# +# Automatically generated file; DO NOT EDIT. +# crosstool-NG Configuration +# +CT_CONFIGURE_has_static_link=y +CT_CONFIGURE_has_cxx11=y +CT_CONFIGURE_has_wget=y +CT_CONFIGURE_has_curl=y +CT_CONFIGURE_has_make_3_81_or_newer=y +CT_CONFIGURE_has_make_4_0_or_newer=y +CT_CONFIGURE_has_libtool_2_4_or_newer=y +CT_CONFIGURE_has_libtoolize_2_4_or_newer=y +CT_CONFIGURE_has_autoconf_2_65_or_newer=y +CT_CONFIGURE_has_autoreconf_2_65_or_newer=y +CT_CONFIGURE_has_automake_1_15_or_newer=y +CT_CONFIGURE_has_gnu_m4_1_4_12_or_newer=y +CT_CONFIGURE_has_python_3_4_or_newer=y +CT_CONFIGURE_has_bison_2_7_or_newer=y +CT_CONFIGURE_has_python=y +CT_CONFIGURE_has_git=y +CT_CONFIGURE_has_md5sum=y +CT_CONFIGURE_has_sha1sum=y +CT_CONFIGURE_has_sha256sum=y +CT_CONFIGURE_has_sha512sum=y +CT_CONFIGURE_has_install_with_strip_program=y +CT_CONFIG_VERSION_CURRENT="3" +CT_CONFIG_VERSION="3" +CT_MODULES=y + +# +# Paths and misc options +# + +# +# crosstool-NG behavior +# +# CT_OBSOLETE is not set +# CT_EXPERIMENTAL is not set +# CT_DEBUG_CT is not set + +# +# Paths +# +CT_LOCAL_TARBALLS_DIR="${HOME}/src" +CT_SAVE_TARBALLS=y +# CT_TARBALLS_BUILDROOT_LAYOUT is not set +CT_WORK_DIR="${CT_TOP_DIR}/.build" +CT_BUILD_TOP_DIR="${CT_WORK_DIR:-${CT_TOP_DIR}/.build}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" +CT_PREFIX_DIR="${CT_PREFIX:-${HOME}/x-tools}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" +CT_RM_RF_PREFIX_DIR=y +CT_REMOVE_DOCS=y +CT_INSTALL_LICENSES=y +# CT_PREFIX_DIR_RO is not set +CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES=y +CT_STRIP_TARGET_TOOLCHAIN_EXECUTABLES=y + +# +# Downloading +# +CT_DOWNLOAD_AGENT_WGET=y +# CT_DOWNLOAD_AGENT_CURL is not set +# CT_DOWNLOAD_AGENT_NONE is not set +# CT_FORBID_DOWNLOAD is not set +# CT_FORCE_DOWNLOAD is not set +CT_CONNECT_TIMEOUT=10 +CT_DOWNLOAD_WGET_OPTIONS="--passive-ftp --tries=3 -nc --progress=dot:binary" +# CT_ONLY_DOWNLOAD is not set +# CT_USE_MIRROR is not set +CT_VERIFY_DOWNLOAD_DIGEST=y +CT_VERIFY_DOWNLOAD_DIGEST_SHA512=y +# CT_VERIFY_DOWNLOAD_DIGEST_SHA256 is not set +# CT_VERIFY_DOWNLOAD_DIGEST_SHA1 is not set +# CT_VERIFY_DOWNLOAD_DIGEST_MD5 is not set +CT_VERIFY_DOWNLOAD_DIGEST_ALG="sha512" +# CT_VERIFY_DOWNLOAD_SIGNATURE is not set + +# +# Extracting +# +# CT_FORCE_EXTRACT is not set +CT_OVERRIDE_CONFIG_GUESS_SUB=y +# CT_ONLY_EXTRACT is not set +CT_PATCH_BUNDLED=y +# CT_PATCH_BUNDLED_LOCAL is not set +CT_PATCH_ORDER="bundled" + +# +# Build behavior +# +CT_PARALLEL_JOBS=0 +CT_LOAD="" +CT_USE_PIPES=y +CT_EXTRA_CFLAGS_FOR_BUILD="" +CT_EXTRA_LDFLAGS_FOR_BUILD="" +CT_EXTRA_CFLAGS_FOR_HOST="" +CT_EXTRA_LDFLAGS_FOR_HOST="" +# CT_CONFIG_SHELL_SH is not set +# CT_CONFIG_SHELL_ASH is not set +CT_CONFIG_SHELL_BASH=y +# CT_CONFIG_SHELL_CUSTOM is not set +CT_CONFIG_SHELL="${bash}" + +# +# Logging +# +# CT_LOG_ERROR is not set +# CT_LOG_WARN is not set +# CT_LOG_INFO is not set +CT_LOG_EXTRA=y +# CT_LOG_ALL is not set +# CT_LOG_DEBUG is not set +CT_LOG_LEVEL_MAX="EXTRA" +# CT_LOG_SEE_TOOLS_WARN is not set +CT_LOG_PROGRESS_BAR=y +CT_LOG_TO_FILE=y +CT_LOG_FILE_COMPRESS=y + +# +# Target options +# +# CT_ARCH_ALPHA is not set +# CT_ARCH_ARC is not set +CT_ARCH_ARM=y +# CT_ARCH_AVR is not set +# CT_ARCH_M68K is not set +# CT_ARCH_MIPS is not set +# CT_ARCH_NIOS2 is not set +# CT_ARCH_POWERPC is not set +# CT_ARCH_S390 is not set +# CT_ARCH_SH is not set +# CT_ARCH_SPARC is not set +# CT_ARCH_X86 is not set +# CT_ARCH_XTENSA is not set +CT_ARCH="arm" +CT_ARCH_CHOICE_KSYM="ARM" +CT_ARCH_CPU="" +CT_ARCH_TUNE="" +CT_ARCH_ARM_SHOW=y + +# +# Options for arm +# +CT_ARCH_ARM_PKG_KSYM="" +CT_ALL_ARCH_CHOICES="ALPHA ARC ARM AVR M68K MICROBLAZE MIPS MOXIE MSP430 NIOS2 POWERPC RISCV S390 SH SPARC X86 XTENSA" +CT_ARCH_SUFFIX="" +# CT_OMIT_TARGET_VENDOR is not set + +# +# Generic target options +# +# CT_MULTILIB is not set +CT_DEMULTILIB=y +CT_ARCH_SUPPORTS_BOTH_MMU=y +CT_ARCH_DEFAULT_HAS_MMU=y +CT_ARCH_USE_MMU=y +CT_ARCH_SUPPORTS_FLAT_FORMAT=y +CT_ARCH_SUPPORTS_EITHER_ENDIAN=y +CT_ARCH_DEFAULT_LE=y +# CT_ARCH_BE is not set +CT_ARCH_LE=y +CT_ARCH_ENDIAN="little" +CT_ARCH_SUPPORTS_32=y +CT_ARCH_SUPPORTS_64=y +CT_ARCH_DEFAULT_32=y +CT_ARCH_BITNESS=64 +# CT_ARCH_32 is not set +CT_ARCH_64=y + +# +# Target optimisations +# +CT_ARCH_SUPPORTS_WITH_ARCH=y +CT_ARCH_SUPPORTS_WITH_CPU=y +CT_ARCH_SUPPORTS_WITH_TUNE=y +CT_ARCH_EXCLUSIVE_WITH_CPU=y +CT_ARCH_ARCH="" +CT_TARGET_CFLAGS="" +CT_TARGET_LDFLAGS="" + +# +# Toolchain options +# + +# +# General toolchain options +# +CT_FORCE_SYSROOT=y +CT_USE_SYSROOT=y +CT_SYSROOT_NAME="sysroot" +CT_SYSROOT_DIR_PREFIX="" +CT_WANTS_STATIC_LINK=y +CT_WANTS_STATIC_LINK_CXX=y +# CT_STATIC_TOOLCHAIN is not set +CT_SHOW_CT_VERSION=y +CT_TOOLCHAIN_PKGVERSION="" +CT_TOOLCHAIN_BUGURL="" + +# +# Tuple completion and aliasing +# +CT_TARGET_VENDOR="" +CT_TARGET_ALIAS_SED_EXPR="" +CT_TARGET_ALIAS="" + +# +# Toolchain type +# +CT_CROSS=y +# CT_CANADIAN is not set +CT_TOOLCHAIN_TYPE="cross" + +# +# Build system +# +CT_BUILD="" +CT_BUILD_PREFIX="" +CT_BUILD_SUFFIX="" + +# +# Misc options +# +# CT_TOOLCHAIN_ENABLE_NLS is not set + +# +# Operating System +# +CT_KERNEL_SUPPORTS_SHARED_LIBS=y +# CT_KERNEL_BARE_METAL is not set +CT_KERNEL_LINUX=y +CT_KERNEL="linux" +CT_KERNEL_CHOICE_KSYM="LINUX" +CT_KERNEL_LINUX_SHOW=y + +# +# Options for linux +# +CT_KERNEL_LINUX_PKG_KSYM="LINUX" +CT_LINUX_DIR_NAME="linux" +CT_LINUX_PKG_NAME="linux" +CT_LINUX_SRC_RELEASE=y +CT_LINUX_PATCH_ORDER="global" +# CT_LINUX_V_4_20 is not set +# CT_LINUX_V_4_19 is not set +# CT_LINUX_V_4_18 is not set +# CT_LINUX_V_4_17 is not set +# CT_LINUX_V_4_16 is not set +# CT_LINUX_V_4_15 is not set +# CT_LINUX_V_4_14 is not set +# CT_LINUX_V_4_13 is not set +# CT_LINUX_V_4_12 is not set +# CT_LINUX_V_4_11 is not set +# CT_LINUX_V_4_10 is not set +CT_LINUX_V_4_9=y +# CT_LINUX_V_4_4 is not set +# CT_LINUX_V_4_1 is not set +# CT_LINUX_V_3_16 is not set +# CT_LINUX_V_3_13 is not set +# CT_LINUX_V_3_12 is not set +# CT_LINUX_V_3_10 is not set +# CT_LINUX_NO_VERSIONS is not set +CT_LINUX_VERSION="4.9.156" +CT_LINUX_MIRRORS="$(CT_Mirrors kernel.org linux ${CT_LINUX_VERSION})" +CT_LINUX_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_LINUX_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_LINUX_ARCHIVE_FORMATS=".tar.xz .tar.gz" +CT_LINUX_SIGNATURE_FORMAT="unpacked/.sign" +CT_LINUX_later_than_4_8=y +CT_LINUX_4_8_or_later=y +CT_LINUX_later_than_3_7=y +CT_LINUX_3_7_or_later=y +CT_LINUX_REQUIRE_3_7_or_later=y +CT_LINUX_later_than_3_2=y +CT_LINUX_3_2_or_later=y +CT_LINUX_REQUIRE_3_2_or_later=y +CT_KERNEL_LINUX_VERBOSITY_0=y +# CT_KERNEL_LINUX_VERBOSITY_1 is not set +# CT_KERNEL_LINUX_VERBOSITY_2 is not set +CT_KERNEL_LINUX_VERBOSE_LEVEL=0 +CT_KERNEL_LINUX_INSTALL_CHECK=y +CT_ALL_KERNEL_CHOICES="BARE_METAL LINUX WINDOWS" + +# +# Common kernel options +# +CT_SHARED_LIBS=y + +# +# Binary utilities +# +CT_ARCH_BINFMT_ELF=y +CT_BINUTILS_BINUTILS=y +CT_BINUTILS="binutils" +CT_BINUTILS_CHOICE_KSYM="BINUTILS" +CT_BINUTILS_BINUTILS_SHOW=y + +# +# Options for binutils +# +CT_BINUTILS_BINUTILS_PKG_KSYM="BINUTILS" +CT_BINUTILS_DIR_NAME="binutils" +CT_BINUTILS_USE_GNU=y +CT_BINUTILS_USE="BINUTILS" +CT_BINUTILS_PKG_NAME="binutils" +CT_BINUTILS_SRC_RELEASE=y +CT_BINUTILS_PATCH_ORDER="global" +# CT_BINUTILS_V_2_32 is not set +# CT_BINUTILS_V_2_31 is not set +# CT_BINUTILS_V_2_30 is not set +CT_BINUTILS_V_2_29=y +# CT_BINUTILS_V_2_28 is not set +# CT_BINUTILS_V_2_27 is not set +# CT_BINUTILS_V_2_26 is not set +# CT_BINUTILS_NO_VERSIONS is not set +CT_BINUTILS_VERSION="2.29.1" +CT_BINUTILS_MIRRORS="$(CT_Mirrors GNU binutils) $(CT_Mirrors sourceware binutils/releases)" +CT_BINUTILS_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_BINUTILS_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_BINUTILS_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" +CT_BINUTILS_SIGNATURE_FORMAT="packed/.sig" +CT_BINUTILS_2_30_or_older=y +CT_BINUTILS_older_than_2_30=y +CT_BINUTILS_REQUIRE_older_than_2_30=y +CT_BINUTILS_later_than_2_27=y +CT_BINUTILS_2_27_or_later=y +CT_BINUTILS_later_than_2_25=y +CT_BINUTILS_2_25_or_later=y +CT_BINUTILS_later_than_2_23=y +CT_BINUTILS_2_23_or_later=y + +# +# GNU binutils +# +CT_BINUTILS_HAS_HASH_STYLE=y +CT_BINUTILS_HAS_GOLD=y +CT_BINUTILS_HAS_PLUGINS=y +CT_BINUTILS_HAS_PKGVERSION_BUGURL=y +CT_BINUTILS_GOLD_SUPPORTS_ARCH=y +CT_BINUTILS_GOLD_SUPPORT=y +CT_BINUTILS_FORCE_LD_BFD_DEFAULT=y +# CT_BINUTILS_LINKER_LD is not set +CT_BINUTILS_LINKER_LD_GOLD=y +CT_BINUTILS_GOLD_INSTALLED=y +CT_BINUTILS_GOLD_THREADS=y +CT_BINUTILS_LINKER_BOTH=y +CT_BINUTILS_LINKERS_LIST="ld,gold" +CT_BINUTILS_LD_WRAPPER=y +CT_BINUTILS_LINKER_DEFAULT="bfd" +CT_BINUTILS_PLUGINS=y +CT_BINUTILS_RELRO=m +CT_BINUTILS_EXTRA_CONFIG_ARRAY="" +# CT_BINUTILS_FOR_TARGET is not set +CT_ALL_BINUTILS_CHOICES="BINUTILS" + +# +# C-library +# +CT_LIBC_GLIBC=y +# CT_LIBC_UCLIBC is not set +CT_LIBC="glibc" +CT_LIBC_CHOICE_KSYM="GLIBC" +CT_THREADS="nptl" +CT_LIBC_GLIBC_SHOW=y + +# +# Options for glibc +# +CT_LIBC_GLIBC_PKG_KSYM="GLIBC" +CT_GLIBC_DIR_NAME="glibc" +CT_GLIBC_USE_GNU=y +CT_GLIBC_USE="GLIBC" +CT_GLIBC_PKG_NAME="glibc" +CT_GLIBC_SRC_RELEASE=y +CT_GLIBC_PATCH_ORDER="global" +# CT_GLIBC_V_2_29 is not set +# CT_GLIBC_V_2_28 is not set +# CT_GLIBC_V_2_27 is not set +# CT_GLIBC_V_2_26 is not set +CT_GLIBC_V_2_25=y +# CT_GLIBC_V_2_24 is not set +# CT_GLIBC_V_2_23 is not set +# CT_GLIBC_V_2_19 is not set +# CT_GLIBC_V_2_17 is not set +# CT_GLIBC_V_2_12_1 is not set +# CT_GLIBC_NO_VERSIONS is not set +CT_GLIBC_VERSION="2.25" +CT_GLIBC_MIRRORS="$(CT_Mirrors GNU glibc)" +CT_GLIBC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_GLIBC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_GLIBC_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" +CT_GLIBC_SIGNATURE_FORMAT="packed/.sig" +CT_GLIBC_2_29_or_older=y +CT_GLIBC_older_than_2_29=y +CT_GLIBC_2_27_or_older=y +CT_GLIBC_older_than_2_27=y +CT_GLIBC_2_26_or_older=y +CT_GLIBC_older_than_2_26=y +CT_GLIBC_2_25_or_later=y +CT_GLIBC_2_25_or_older=y +CT_GLIBC_later_than_2_24=y +CT_GLIBC_2_24_or_later=y +CT_GLIBC_later_than_2_23=y +CT_GLIBC_2_23_or_later=y +CT_GLIBC_later_than_2_20=y +CT_GLIBC_2_20_or_later=y +CT_GLIBC_later_than_2_17=y +CT_GLIBC_2_17_or_later=y +CT_GLIBC_later_than_2_14=y +CT_GLIBC_2_14_or_later=y +CT_GLIBC_DEP_KERNEL_HEADERS_VERSION=y +CT_GLIBC_DEP_BINUTILS=y +CT_GLIBC_DEP_GCC=y +CT_GLIBC_DEP_PYTHON=y +CT_GLIBC_BUILD_SSP=y +CT_GLIBC_HAS_LIBIDN_ADDON=y +# CT_GLIBC_USE_LIBIDN_ADDON is not set +CT_GLIBC_NO_SPARC_V8=y +CT_GLIBC_HAS_OBSOLETE_RPC=y +CT_GLIBC_EXTRA_CONFIG_ARRAY="" +CT_GLIBC_CONFIGPARMS="" +CT_GLIBC_EXTRA_CFLAGS="" +CT_GLIBC_ENABLE_OBSOLETE_RPC=y +# CT_GLIBC_DISABLE_VERSIONING is not set +CT_GLIBC_OLDEST_ABI="" +CT_GLIBC_FORCE_UNWIND=y +# CT_GLIBC_LOCALES is not set +# CT_GLIBC_KERNEL_VERSION_NONE is not set +CT_GLIBC_KERNEL_VERSION_AS_HEADERS=y +# CT_GLIBC_KERNEL_VERSION_CHOSEN is not set +CT_GLIBC_MIN_KERNEL="4.9.156" +CT_GLIBC_SSP_DEFAULT=y +# CT_GLIBC_SSP_NO is not set +# CT_GLIBC_SSP_YES is not set +# CT_GLIBC_SSP_ALL is not set +# CT_GLIBC_SSP_STRONG is not set +# CT_GLIBC_ENABLE_WERROR is not set +CT_ALL_LIBC_CHOICES="AVR_LIBC BIONIC GLIBC MINGW_W64 MOXIEBOX MUSL NEWLIB NONE UCLIBC" +CT_LIBC_SUPPORT_THREADS_ANY=y +CT_LIBC_SUPPORT_THREADS_NATIVE=y + +# +# Common C library options +# +CT_THREADS_NATIVE=y +# CT_CREATE_LDSO_CONF is not set +CT_LIBC_XLDD=y + +# +# C compiler +# +CT_CC_CORE_PASSES_NEEDED=y +CT_CC_CORE_PASS_1_NEEDED=y +CT_CC_CORE_PASS_2_NEEDED=y +CT_CC_SUPPORT_CXX=y +CT_CC_SUPPORT_FORTRAN=y +CT_CC_SUPPORT_ADA=y +CT_CC_SUPPORT_OBJC=y +CT_CC_SUPPORT_OBJCXX=y +CT_CC_SUPPORT_GOLANG=y +CT_CC_GCC=y +CT_CC="gcc" +CT_CC_CHOICE_KSYM="GCC" +CT_CC_GCC_SHOW=y + +# +# Options for gcc +# +CT_CC_GCC_PKG_KSYM="GCC" +CT_GCC_DIR_NAME="gcc" +CT_GCC_USE_GNU=y +CT_GCC_USE="GCC" +CT_GCC_PKG_NAME="gcc" +CT_GCC_SRC_RELEASE=y +CT_GCC_PATCH_ORDER="global" +CT_GCC_V_8=y +# CT_GCC_V_7 is not set +# CT_GCC_V_6 is not set +# CT_GCC_V_5 is not set +# CT_GCC_V_4_9 is not set +# CT_GCC_NO_VERSIONS is not set +CT_GCC_VERSION="8.3.0" +CT_GCC_MIRRORS="$(CT_Mirrors GNU gcc/gcc-${CT_GCC_VERSION}) $(CT_Mirrors sourceware gcc/releases/gcc-${CT_GCC_VERSION})" +CT_GCC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_GCC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_GCC_ARCHIVE_FORMATS=".tar.xz .tar.gz" +CT_GCC_SIGNATURE_FORMAT="" +CT_GCC_later_than_7=y +CT_GCC_7_or_later=y +CT_GCC_later_than_6=y +CT_GCC_6_or_later=y +CT_GCC_later_than_5=y +CT_GCC_5_or_later=y +CT_GCC_later_than_4_9=y +CT_GCC_4_9_or_later=y +CT_GCC_later_than_4_8=y +CT_GCC_4_8_or_later=y +CT_CC_GCC_ENABLE_PLUGINS=y +CT_CC_GCC_GOLD=y +CT_CC_GCC_HAS_LIBMPX=y +CT_CC_GCC_ENABLE_CXX_FLAGS="" +CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="" +CT_CC_GCC_EXTRA_CONFIG_ARRAY="" +CT_CC_GCC_STATIC_LIBSTDCXX=y +# CT_CC_GCC_SYSTEM_ZLIB is not set +CT_CC_GCC_CONFIG_TLS=m + +# +# Optimisation features +# +CT_CC_GCC_USE_GRAPHITE=y +CT_CC_GCC_USE_LTO=y + +# +# Settings for libraries running on target +# +CT_CC_GCC_ENABLE_TARGET_OPTSPACE=y +# CT_CC_GCC_LIBMUDFLAP is not set +# CT_CC_GCC_LIBGOMP is not set +# CT_CC_GCC_LIBSSP is not set +# CT_CC_GCC_LIBQUADMATH is not set +# CT_CC_GCC_LIBSANITIZER is not set + +# +# Misc. obscure options. +# +CT_CC_CXA_ATEXIT=y +# CT_CC_GCC_DISABLE_PCH is not set +CT_CC_GCC_SJLJ_EXCEPTIONS=m +CT_CC_GCC_LDBL_128=m +# CT_CC_GCC_BUILD_ID is not set +CT_CC_GCC_LNK_HASH_STYLE_DEFAULT=y +# CT_CC_GCC_LNK_HASH_STYLE_SYSV is not set +# CT_CC_GCC_LNK_HASH_STYLE_GNU is not set +# CT_CC_GCC_LNK_HASH_STYLE_BOTH is not set +CT_CC_GCC_LNK_HASH_STYLE="" +CT_CC_GCC_DEC_FLOAT_AUTO=y +# CT_CC_GCC_DEC_FLOAT_BID is not set +# CT_CC_GCC_DEC_FLOAT_DPD is not set +# CT_CC_GCC_DEC_FLOATS_NO is not set +CT_ALL_CC_CHOICES="GCC" + +# +# Additional supported languages: +# +CT_CC_LANG_CXX=y +# CT_CC_LANG_FORTRAN is not set + +# +# Debug facilities +# +# CT_DEBUG_DUMA is not set +# CT_DEBUG_GDB is not set +# CT_GDB_USE_GNU is not set +# CT_GDB_SRC_RELEASE is not set +# CT_GDB_V_8_2 is not set +# CT_GDB_V_8_1 is not set +# CT_GDB_V_8_0 is not set +# CT_GDB_V_7_12 is not set +# CT_GDB_V_7_11 is not set +# CT_DEBUG_LTRACE is not set +# CT_DEBUG_STRACE is not set +CT_ALL_DEBUG_CHOICES="DUMA GDB LTRACE STRACE" + +# +# Companion libraries +# +# CT_COMPLIBS_CHECK is not set +# CT_COMP_LIBS_CLOOG is not set +CT_COMP_LIBS_EXPAT=y +CT_COMP_LIBS_EXPAT_PKG_KSYM="EXPAT" +CT_EXPAT_DIR_NAME="expat" +CT_EXPAT_PKG_NAME="expat" +CT_EXPAT_SRC_RELEASE=y +CT_EXPAT_PATCH_ORDER="global" +CT_EXPAT_V_2_2=y +# CT_EXPAT_NO_VERSIONS is not set +CT_EXPAT_VERSION="2.2.6" +CT_EXPAT_MIRRORS="http://downloads.sourceforge.net/project/expat/expat/${CT_EXPAT_VERSION}" +CT_EXPAT_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_EXPAT_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_EXPAT_ARCHIVE_FORMATS=".tar.bz2" +CT_EXPAT_SIGNATURE_FORMAT="" +CT_COMP_LIBS_GETTEXT=y +CT_COMP_LIBS_GETTEXT_PKG_KSYM="GETTEXT" +CT_GETTEXT_DIR_NAME="gettext" +CT_GETTEXT_PKG_NAME="gettext" +CT_GETTEXT_SRC_RELEASE=y +CT_GETTEXT_PATCH_ORDER="global" +CT_GETTEXT_V_0_19_8_1=y +# CT_GETTEXT_NO_VERSIONS is not set +CT_GETTEXT_VERSION="0.19.8.1" +CT_GETTEXT_MIRRORS="$(CT_Mirrors GNU gettext)" +CT_GETTEXT_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_GETTEXT_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_GETTEXT_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.gz" +CT_GETTEXT_SIGNATURE_FORMAT="packed/.sig" +CT_COMP_LIBS_GMP=y +CT_COMP_LIBS_GMP_PKG_KSYM="GMP" +CT_GMP_DIR_NAME="gmp" +CT_GMP_PKG_NAME="gmp" +CT_GMP_SRC_RELEASE=y +CT_GMP_PATCH_ORDER="global" +CT_GMP_V_6_1=y +# CT_GMP_NO_VERSIONS is not set +CT_GMP_VERSION="6.1.2" +CT_GMP_MIRRORS="https://gmplib.org/download/gmp https://gmplib.org/download/gmp/archive $(CT_Mirrors GNU gmp)" +CT_GMP_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_GMP_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_GMP_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.bz2" +CT_GMP_SIGNATURE_FORMAT="packed/.sig" +CT_GMP_later_than_5_1_0=y +CT_GMP_5_1_0_or_later=y +CT_GMP_later_than_5_0_0=y +CT_GMP_5_0_0_or_later=y +CT_GMP_REQUIRE_5_0_0_or_later=y +CT_COMP_LIBS_ISL=y +CT_COMP_LIBS_ISL_PKG_KSYM="ISL" +CT_ISL_DIR_NAME="isl" +CT_ISL_PKG_NAME="isl" +CT_ISL_SRC_RELEASE=y +CT_ISL_PATCH_ORDER="global" +CT_ISL_V_0_20=y +# CT_ISL_V_0_19 is not set +# CT_ISL_V_0_18 is not set +# CT_ISL_V_0_17 is not set +# CT_ISL_V_0_16 is not set +# CT_ISL_V_0_15 is not set +# CT_ISL_NO_VERSIONS is not set +CT_ISL_VERSION="0.20" +CT_ISL_MIRRORS="http://isl.gforge.inria.fr" +CT_ISL_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_ISL_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_ISL_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" +CT_ISL_SIGNATURE_FORMAT="" +CT_ISL_later_than_0_18=y +CT_ISL_0_18_or_later=y +CT_ISL_later_than_0_15=y +CT_ISL_0_15_or_later=y +CT_ISL_REQUIRE_0_15_or_later=y +CT_ISL_later_than_0_14=y +CT_ISL_0_14_or_later=y +CT_ISL_REQUIRE_0_14_or_later=y +CT_ISL_later_than_0_13=y +CT_ISL_0_13_or_later=y +CT_ISL_later_than_0_12=y +CT_ISL_0_12_or_later=y +CT_ISL_REQUIRE_0_12_or_later=y +# CT_COMP_LIBS_LIBELF is not set +CT_COMP_LIBS_LIBICONV=y +CT_COMP_LIBS_LIBICONV_PKG_KSYM="LIBICONV" +CT_LIBICONV_DIR_NAME="libiconv" +CT_LIBICONV_PKG_NAME="libiconv" +CT_LIBICONV_SRC_RELEASE=y +CT_LIBICONV_PATCH_ORDER="global" +CT_LIBICONV_V_1_15=y +# CT_LIBICONV_NO_VERSIONS is not set +CT_LIBICONV_VERSION="1.15" +CT_LIBICONV_MIRRORS="$(CT_Mirrors GNU libiconv)" +CT_LIBICONV_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_LIBICONV_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_LIBICONV_ARCHIVE_FORMATS=".tar.gz" +CT_LIBICONV_SIGNATURE_FORMAT="packed/.sig" +CT_COMP_LIBS_MPC=y +CT_COMP_LIBS_MPC_PKG_KSYM="MPC" +CT_MPC_DIR_NAME="mpc" +CT_MPC_PKG_NAME="mpc" +CT_MPC_SRC_RELEASE=y +CT_MPC_PATCH_ORDER="global" +CT_MPC_V_1_1=y +# CT_MPC_V_1_0 is not set +# CT_MPC_NO_VERSIONS is not set +CT_MPC_VERSION="1.1.0" +CT_MPC_MIRRORS="http://www.multiprecision.org/downloads $(CT_Mirrors GNU mpc)" +CT_MPC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_MPC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_MPC_ARCHIVE_FORMATS=".tar.gz" +CT_MPC_SIGNATURE_FORMAT="packed/.sig" +CT_MPC_1_1_0_or_later=y +CT_MPC_1_1_0_or_older=y +CT_COMP_LIBS_MPFR=y +CT_COMP_LIBS_MPFR_PKG_KSYM="MPFR" +CT_MPFR_DIR_NAME="mpfr" +CT_MPFR_PKG_NAME="mpfr" +CT_MPFR_SRC_RELEASE=y +CT_MPFR_PATCH_ORDER="global" +CT_MPFR_V_4_0=y +# CT_MPFR_V_3_1 is not set +# CT_MPFR_NO_VERSIONS is not set +CT_MPFR_VERSION="4.0.2" +CT_MPFR_MIRRORS="http://www.mpfr.org/mpfr-${CT_MPFR_VERSION} $(CT_Mirrors GNU mpfr)" +CT_MPFR_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_MPFR_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_MPFR_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz .zip" +CT_MPFR_SIGNATURE_FORMAT="packed/.asc" +CT_MPFR_later_than_4_0_0=y +CT_MPFR_4_0_0_or_later=y +CT_MPFR_later_than_3_0_0=y +CT_MPFR_3_0_0_or_later=y +CT_MPFR_REQUIRE_3_0_0_or_later=y +CT_COMP_LIBS_NCURSES=y +CT_COMP_LIBS_NCURSES_PKG_KSYM="NCURSES" +CT_NCURSES_DIR_NAME="ncurses" +CT_NCURSES_PKG_NAME="ncurses" +CT_NCURSES_SRC_RELEASE=y +CT_NCURSES_PATCH_ORDER="global" +CT_NCURSES_V_6_1=y +# CT_NCURSES_V_6_0 is not set +# CT_NCURSES_NO_VERSIONS is not set +CT_NCURSES_VERSION="6.1" +CT_NCURSES_MIRRORS="ftp://invisible-island.net/ncurses $(CT_Mirrors GNU ncurses)" +CT_NCURSES_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_NCURSES_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_NCURSES_ARCHIVE_FORMATS=".tar.gz" +CT_NCURSES_SIGNATURE_FORMAT="packed/.sig" +CT_NCURSES_HOST_CONFIG_ARGS="" +CT_NCURSES_HOST_DISABLE_DB=y +CT_NCURSES_HOST_FALLBACKS="linux,xterm,xterm-color,xterm-256color,vt100" +CT_NCURSES_TARGET_CONFIG_ARGS="" +# CT_NCURSES_TARGET_DISABLE_DB is not set +CT_NCURSES_TARGET_FALLBACKS="" +CT_COMP_LIBS_ZLIB=y +CT_COMP_LIBS_ZLIB_PKG_KSYM="ZLIB" +CT_ZLIB_DIR_NAME="zlib" +CT_ZLIB_PKG_NAME="zlib" +CT_ZLIB_SRC_RELEASE=y +CT_ZLIB_PATCH_ORDER="global" +CT_ZLIB_V_1_2_11=y +# CT_ZLIB_NO_VERSIONS is not set +CT_ZLIB_VERSION="1.2.11" +CT_ZLIB_MIRRORS="http://downloads.sourceforge.net/project/libpng/zlib/${CT_ZLIB_VERSION}" +CT_ZLIB_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_ZLIB_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_ZLIB_ARCHIVE_FORMATS=".tar.xz .tar.gz" +CT_ZLIB_SIGNATURE_FORMAT="packed/.asc" +CT_ALL_COMP_LIBS_CHOICES="CLOOG EXPAT GETTEXT GMP ISL LIBELF LIBICONV MPC MPFR NCURSES ZLIB" +CT_LIBICONV_NEEDED=y +CT_GETTEXT_NEEDED=y +CT_GMP_NEEDED=y +CT_MPFR_NEEDED=y +CT_ISL_NEEDED=y +CT_MPC_NEEDED=y +CT_NCURSES_NEEDED=y +CT_ZLIB_NEEDED=y +CT_LIBICONV=y +CT_GETTEXT=y +CT_GMP=y +CT_MPFR=y +CT_ISL=y +CT_MPC=y +CT_NCURSES=y +CT_ZLIB=y + +# +# Companion tools +# +# CT_COMP_TOOLS_FOR_HOST is not set +# CT_COMP_TOOLS_AUTOCONF is not set +# CT_COMP_TOOLS_AUTOMAKE is not set +# CT_COMP_TOOLS_BISON is not set +# CT_COMP_TOOLS_DTC is not set +# CT_COMP_TOOLS_LIBTOOL is not set +# CT_COMP_TOOLS_M4 is not set +# CT_COMP_TOOLS_MAKE is not set +CT_ALL_COMP_TOOLS_CHOICES="AUTOCONF AUTOMAKE BISON DTC LIBTOOL M4 MAKE" diff --git a/kotlin-native/tools/toolchain_builder/toolchains/arm-unknown-linux-gnueabihf/gcc-8.3.0-glibc-2.19-kernel-4.9.config b/kotlin-native/tools/toolchain_builder/toolchains/arm-unknown-linux-gnueabihf/gcc-8.3.0-glibc-2.19-kernel-4.9.config new file mode 100644 index 00000000000..c86727130bb --- /dev/null +++ b/kotlin-native/tools/toolchain_builder/toolchains/arm-unknown-linux-gnueabihf/gcc-8.3.0-glibc-2.19-kernel-4.9.config @@ -0,0 +1,810 @@ +# +# Automatically generated file; DO NOT EDIT. +# crosstool-NG Configuration +# +CT_CONFIGURE_has_static_link=y +CT_CONFIGURE_has_cxx11=y +CT_CONFIGURE_has_wget=y +CT_CONFIGURE_has_curl=y +CT_CONFIGURE_has_make_3_81_or_newer=y +CT_CONFIGURE_has_make_4_0_or_newer=y +CT_CONFIGURE_has_libtool_2_4_or_newer=y +CT_CONFIGURE_has_libtoolize_2_4_or_newer=y +CT_CONFIGURE_has_autoconf_2_65_or_newer=y +CT_CONFIGURE_has_autoreconf_2_65_or_newer=y +CT_CONFIGURE_has_automake_1_15_or_newer=y +CT_CONFIGURE_has_gnu_m4_1_4_12_or_newer=y +CT_CONFIGURE_has_python_3_4_or_newer=y +CT_CONFIGURE_has_bison_2_7_or_newer=y +CT_CONFIGURE_has_python=y +CT_CONFIGURE_has_git=y +CT_CONFIGURE_has_md5sum=y +CT_CONFIGURE_has_sha1sum=y +CT_CONFIGURE_has_sha256sum=y +CT_CONFIGURE_has_sha512sum=y +CT_CONFIGURE_has_install_with_strip_program=y +CT_CONFIG_VERSION_CURRENT="3" +CT_CONFIG_VERSION="3" +CT_MODULES=y + +# +# Paths and misc options +# + +# +# crosstool-NG behavior +# +# CT_OBSOLETE is not set +# CT_EXPERIMENTAL is not set +# CT_DEBUG_CT is not set + +# +# Paths +# +CT_LOCAL_TARBALLS_DIR="${HOME}/src" +CT_SAVE_TARBALLS=y +# CT_TARBALLS_BUILDROOT_LAYOUT is not set +CT_WORK_DIR="${CT_TOP_DIR}/.build" +CT_BUILD_TOP_DIR="${CT_WORK_DIR:-${CT_TOP_DIR}/.build}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" +CT_PREFIX_DIR="${CT_PREFIX:-${HOME}/x-tools}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" +CT_RM_RF_PREFIX_DIR=y +CT_REMOVE_DOCS=y +CT_INSTALL_LICENSES=y +# CT_PREFIX_DIR_RO is not set +CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES=y +CT_STRIP_TARGET_TOOLCHAIN_EXECUTABLES=y + +# +# Downloading +# +CT_DOWNLOAD_AGENT_WGET=y +# CT_DOWNLOAD_AGENT_CURL is not set +# CT_DOWNLOAD_AGENT_NONE is not set +# CT_FORBID_DOWNLOAD is not set +# CT_FORCE_DOWNLOAD is not set +CT_CONNECT_TIMEOUT=10 +CT_DOWNLOAD_WGET_OPTIONS="--passive-ftp --tries=3 -nc --progress=dot:binary" +# CT_ONLY_DOWNLOAD is not set +# CT_USE_MIRROR is not set +CT_VERIFY_DOWNLOAD_DIGEST=y +CT_VERIFY_DOWNLOAD_DIGEST_SHA512=y +# CT_VERIFY_DOWNLOAD_DIGEST_SHA256 is not set +# CT_VERIFY_DOWNLOAD_DIGEST_SHA1 is not set +# CT_VERIFY_DOWNLOAD_DIGEST_MD5 is not set +CT_VERIFY_DOWNLOAD_DIGEST_ALG="sha512" +# CT_VERIFY_DOWNLOAD_SIGNATURE is not set + +# +# Extracting +# +# CT_FORCE_EXTRACT is not set +CT_OVERRIDE_CONFIG_GUESS_SUB=y +# CT_ONLY_EXTRACT is not set +CT_PATCH_BUNDLED=y +# CT_PATCH_BUNDLED_LOCAL is not set +CT_PATCH_ORDER="bundled" + +# +# Build behavior +# +CT_PARALLEL_JOBS=0 +CT_LOAD="" +CT_USE_PIPES=y +CT_EXTRA_CFLAGS_FOR_BUILD="" +CT_EXTRA_LDFLAGS_FOR_BUILD="" +CT_EXTRA_CFLAGS_FOR_HOST="" +CT_EXTRA_LDFLAGS_FOR_HOST="" +# CT_CONFIG_SHELL_SH is not set +# CT_CONFIG_SHELL_ASH is not set +CT_CONFIG_SHELL_BASH=y +# CT_CONFIG_SHELL_CUSTOM is not set +CT_CONFIG_SHELL="${bash}" + +# +# Logging +# +# CT_LOG_ERROR is not set +# CT_LOG_WARN is not set +# CT_LOG_INFO is not set +CT_LOG_EXTRA=y +# CT_LOG_ALL is not set +# CT_LOG_DEBUG is not set +CT_LOG_LEVEL_MAX="EXTRA" +# CT_LOG_SEE_TOOLS_WARN is not set +CT_LOG_PROGRESS_BAR=y +CT_LOG_TO_FILE=y +CT_LOG_FILE_COMPRESS=y + +# +# Target options +# +# CT_ARCH_ALPHA is not set +# CT_ARCH_ARC is not set +CT_ARCH_ARM=y +# CT_ARCH_AVR is not set +# CT_ARCH_M68K is not set +# CT_ARCH_MIPS is not set +# CT_ARCH_NIOS2 is not set +# CT_ARCH_POWERPC is not set +# CT_ARCH_S390 is not set +# CT_ARCH_SH is not set +# CT_ARCH_SPARC is not set +# CT_ARCH_X86 is not set +# CT_ARCH_XTENSA is not set +CT_ARCH="arm" +CT_ARCH_CHOICE_KSYM="ARM" +CT_ARCH_CPU="" +CT_ARCH_TUNE="" +CT_ARCH_ARM_SHOW=y + +# +# Options for arm +# +CT_ARCH_ARM_PKG_KSYM="" +CT_ARCH_ARM_MODE="arm" +CT_ARCH_ARM_MODE_ARM=y +# CT_ARCH_ARM_MODE_THUMB is not set +# CT_ARCH_ARM_INTERWORKING is not set +CT_ARCH_ARM_EABI_FORCE=y +CT_ARCH_ARM_EABI=y +CT_ARCH_ARM_TUPLE_USE_EABIHF=y +CT_ALL_ARCH_CHOICES="ALPHA ARC ARM AVR M68K MICROBLAZE MIPS MOXIE MSP430 NIOS2 POWERPC RISCV S390 SH SPARC X86 XTENSA" +CT_ARCH_SUFFIX="" +# CT_OMIT_TARGET_VENDOR is not set + +# +# Generic target options +# +# CT_MULTILIB is not set +CT_DEMULTILIB=y +CT_ARCH_SUPPORTS_BOTH_MMU=y +CT_ARCH_DEFAULT_HAS_MMU=y +CT_ARCH_USE_MMU=y +CT_ARCH_SUPPORTS_FLAT_FORMAT=y +CT_ARCH_SUPPORTS_EITHER_ENDIAN=y +CT_ARCH_DEFAULT_LE=y +# CT_ARCH_BE is not set +CT_ARCH_LE=y +CT_ARCH_ENDIAN="little" +CT_ARCH_SUPPORTS_32=y +CT_ARCH_SUPPORTS_64=y +CT_ARCH_DEFAULT_32=y +CT_ARCH_BITNESS=32 +CT_ARCH_32=y +# CT_ARCH_64 is not set + +# +# Target optimisations +# +CT_ARCH_SUPPORTS_WITH_ARCH=y +CT_ARCH_SUPPORTS_WITH_CPU=y +CT_ARCH_SUPPORTS_WITH_TUNE=y +CT_ARCH_SUPPORTS_WITH_FLOAT=y +CT_ARCH_SUPPORTS_WITH_FPU=y +CT_ARCH_SUPPORTS_SOFTFP=y +CT_ARCH_EXCLUSIVE_WITH_CPU=y +CT_ARCH_ARCH="" +CT_ARCH_FPU="" +# CT_ARCH_FLOAT_AUTO is not set +CT_ARCH_FLOAT_HW=y +# CT_ARCH_FLOAT_SOFTFP is not set +# CT_ARCH_FLOAT_SW is not set +CT_TARGET_CFLAGS="" +CT_TARGET_LDFLAGS="" +CT_ARCH_FLOAT="hard" + +# +# Toolchain options +# + +# +# General toolchain options +# +CT_FORCE_SYSROOT=y +CT_USE_SYSROOT=y +CT_SYSROOT_NAME="sysroot" +CT_SYSROOT_DIR_PREFIX="" +CT_WANTS_STATIC_LINK=y +CT_WANTS_STATIC_LINK_CXX=y +# CT_STATIC_TOOLCHAIN is not set +CT_SHOW_CT_VERSION=y +CT_TOOLCHAIN_PKGVERSION="" +CT_TOOLCHAIN_BUGURL="" + +# +# Tuple completion and aliasing +# +CT_TARGET_VENDOR="unknown" +CT_TARGET_ALIAS_SED_EXPR="" +CT_TARGET_ALIAS="" + +# +# Toolchain type +# +CT_CROSS=y +# CT_CANADIAN is not set +CT_TOOLCHAIN_TYPE="cross" + +# +# Build system +# +CT_BUILD="" +CT_BUILD_PREFIX="" +CT_BUILD_SUFFIX="" + +# +# Misc options +# +# CT_TOOLCHAIN_ENABLE_NLS is not set + +# +# Operating System +# +CT_KERNEL_SUPPORTS_SHARED_LIBS=y +# CT_KERNEL_BARE_METAL is not set +CT_KERNEL_LINUX=y +CT_KERNEL="linux" +CT_KERNEL_CHOICE_KSYM="LINUX" +CT_KERNEL_LINUX_SHOW=y + +# +# Options for linux +# +CT_KERNEL_LINUX_PKG_KSYM="LINUX" +CT_LINUX_DIR_NAME="linux" +CT_LINUX_PKG_NAME="linux" +CT_LINUX_SRC_RELEASE=y +CT_LINUX_PATCH_ORDER="global" +# CT_LINUX_V_4_20 is not set +# CT_LINUX_V_4_19 is not set +# CT_LINUX_V_4_18 is not set +# CT_LINUX_V_4_17 is not set +# CT_LINUX_V_4_16 is not set +# CT_LINUX_V_4_15 is not set +# CT_LINUX_V_4_14 is not set +# CT_LINUX_V_4_13 is not set +# CT_LINUX_V_4_12 is not set +# CT_LINUX_V_4_11 is not set +# CT_LINUX_V_4_10 is not set +CT_LINUX_V_4_9=y +# CT_LINUX_V_4_4 is not set +# CT_LINUX_V_4_1 is not set +# CT_LINUX_V_3_16 is not set +# CT_LINUX_V_3_13 is not set +# CT_LINUX_V_3_12 is not set +# CT_LINUX_V_3_10 is not set +# CT_LINUX_V_3_4 is not set +# CT_LINUX_V_3_2 is not set +# CT_LINUX_V_2_6_32 is not set +# CT_LINUX_NO_VERSIONS is not set +CT_LINUX_VERSION="4.9.156" +CT_LINUX_MIRRORS="$(CT_Mirrors kernel.org linux ${CT_LINUX_VERSION})" +CT_LINUX_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_LINUX_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_LINUX_ARCHIVE_FORMATS=".tar.xz .tar.gz" +CT_LINUX_SIGNATURE_FORMAT="unpacked/.sign" +CT_LINUX_later_than_4_8=y +CT_LINUX_4_8_or_later=y +CT_LINUX_later_than_3_7=y +CT_LINUX_3_7_or_later=y +CT_LINUX_later_than_3_2=y +CT_LINUX_3_2_or_later=y +CT_KERNEL_LINUX_VERBOSITY_0=y +# CT_KERNEL_LINUX_VERBOSITY_1 is not set +# CT_KERNEL_LINUX_VERBOSITY_2 is not set +CT_KERNEL_LINUX_VERBOSE_LEVEL=0 +CT_KERNEL_LINUX_INSTALL_CHECK=y +CT_ALL_KERNEL_CHOICES="BARE_METAL LINUX WINDOWS" + +# +# Common kernel options +# +CT_SHARED_LIBS=y + +# +# Binary utilities +# +CT_ARCH_BINFMT_ELF=y +CT_BINUTILS_BINUTILS=y +CT_BINUTILS="binutils" +CT_BINUTILS_CHOICE_KSYM="BINUTILS" +CT_BINUTILS_BINUTILS_SHOW=y + +# +# Options for binutils +# +CT_BINUTILS_BINUTILS_PKG_KSYM="BINUTILS" +CT_BINUTILS_DIR_NAME="binutils" +CT_BINUTILS_USE_GNU=y +CT_BINUTILS_USE="BINUTILS" +CT_BINUTILS_PKG_NAME="binutils" +CT_BINUTILS_SRC_RELEASE=y +CT_BINUTILS_PATCH_ORDER="global" +CT_BINUTILS_V_2_32=y +# CT_BINUTILS_V_2_31 is not set +# CT_BINUTILS_V_2_30 is not set +# CT_BINUTILS_V_2_29 is not set +# CT_BINUTILS_V_2_28 is not set +# CT_BINUTILS_V_2_27 is not set +# CT_BINUTILS_V_2_26 is not set +# CT_BINUTILS_NO_VERSIONS is not set +CT_BINUTILS_VERSION="2.32" +CT_BINUTILS_MIRRORS="$(CT_Mirrors GNU binutils) $(CT_Mirrors sourceware binutils/releases)" +CT_BINUTILS_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_BINUTILS_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_BINUTILS_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" +CT_BINUTILS_SIGNATURE_FORMAT="packed/.sig" +CT_BINUTILS_later_than_2_30=y +CT_BINUTILS_2_30_or_later=y +CT_BINUTILS_later_than_2_27=y +CT_BINUTILS_2_27_or_later=y +CT_BINUTILS_later_than_2_25=y +CT_BINUTILS_2_25_or_later=y +CT_BINUTILS_later_than_2_23=y +CT_BINUTILS_2_23_or_later=y + +# +# GNU binutils +# +CT_BINUTILS_HAS_HASH_STYLE=y +CT_BINUTILS_HAS_GOLD=y +CT_BINUTILS_HAS_PLUGINS=y +CT_BINUTILS_HAS_PKGVERSION_BUGURL=y +CT_BINUTILS_GOLD_SUPPORTS_ARCH=y +CT_BINUTILS_GOLD_SUPPORT=y +CT_BINUTILS_FORCE_LD_BFD_DEFAULT=y +# CT_BINUTILS_LINKER_LD is not set +CT_BINUTILS_LINKER_LD_GOLD=y +CT_BINUTILS_GOLD_INSTALLED=y +CT_BINUTILS_GOLD_THREADS=y +CT_BINUTILS_LINKER_BOTH=y +CT_BINUTILS_LINKERS_LIST="ld,gold" +CT_BINUTILS_LD_WRAPPER=y +CT_BINUTILS_LINKER_DEFAULT="bfd" +CT_BINUTILS_PLUGINS=y +CT_BINUTILS_RELRO=m +CT_BINUTILS_EXTRA_CONFIG_ARRAY="" +# CT_BINUTILS_FOR_TARGET is not set +CT_ALL_BINUTILS_CHOICES="BINUTILS" + +# +# C-library +# +CT_LIBC_GLIBC=y +# CT_LIBC_UCLIBC is not set +CT_LIBC="glibc" +CT_LIBC_CHOICE_KSYM="GLIBC" +CT_THREADS="nptl" +CT_LIBC_GLIBC_SHOW=y + +# +# Options for glibc +# +CT_LIBC_GLIBC_PKG_KSYM="GLIBC" +CT_GLIBC_DIR_NAME="glibc" +CT_GLIBC_USE_GNU=y +CT_GLIBC_USE="GLIBC" +CT_GLIBC_PKG_NAME="glibc" +CT_GLIBC_SRC_RELEASE=y +CT_GLIBC_PATCH_ORDER="global" +# CT_GLIBC_V_2_29 is not set +# CT_GLIBC_V_2_28 is not set +# CT_GLIBC_V_2_27 is not set +# CT_GLIBC_V_2_26 is not set +# CT_GLIBC_V_2_25 is not set +# CT_GLIBC_V_2_24 is not set +# CT_GLIBC_V_2_23 is not set +CT_GLIBC_V_2_19=y +# CT_GLIBC_V_2_17 is not set +# CT_GLIBC_V_2_12_1 is not set +# CT_GLIBC_NO_VERSIONS is not set +CT_GLIBC_VERSION="2.19" +CT_GLIBC_MIRRORS="$(CT_Mirrors GNU glibc)" +CT_GLIBC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_GLIBC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_GLIBC_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" +CT_GLIBC_SIGNATURE_FORMAT="packed/.sig" +CT_GLIBC_2_29_or_older=y +CT_GLIBC_older_than_2_29=y +CT_GLIBC_2_27_or_older=y +CT_GLIBC_older_than_2_27=y +CT_GLIBC_2_26_or_older=y +CT_GLIBC_older_than_2_26=y +CT_GLIBC_2_25_or_older=y +CT_GLIBC_older_than_2_25=y +CT_GLIBC_2_24_or_older=y +CT_GLIBC_older_than_2_24=y +CT_GLIBC_2_23_or_older=y +CT_GLIBC_older_than_2_23=y +CT_GLIBC_2_20_or_older=y +CT_GLIBC_older_than_2_20=y +CT_GLIBC_later_than_2_17=y +CT_GLIBC_2_17_or_later=y +CT_GLIBC_later_than_2_14=y +CT_GLIBC_2_14_or_later=y +CT_GLIBC_DEP_KERNEL_HEADERS_VERSION=y +CT_GLIBC_DEP_BINUTILS=y +CT_GLIBC_DEP_GCC=y +CT_GLIBC_DEP_PYTHON=y +CT_GLIBC_HAS_NPTL_ADDON=y +CT_GLIBC_HAS_PORTS_ADDON=y +CT_GLIBC_HAS_LIBIDN_ADDON=y +CT_GLIBC_USE_PORTS_ADDON=y +CT_GLIBC_USE_NPTL_ADDON=y +# CT_GLIBC_USE_LIBIDN_ADDON is not set +CT_GLIBC_HAS_OBSOLETE_RPC=y +CT_GLIBC_EXTRA_CONFIG_ARRAY="" +CT_GLIBC_CONFIGPARMS="" +CT_GLIBC_EXTRA_CFLAGS="" +CT_GLIBC_ENABLE_OBSOLETE_RPC=y +# CT_GLIBC_DISABLE_VERSIONING is not set +CT_GLIBC_OLDEST_ABI="" +CT_GLIBC_FORCE_UNWIND=y +# CT_GLIBC_LOCALES is not set +# CT_GLIBC_KERNEL_VERSION_NONE is not set +CT_GLIBC_KERNEL_VERSION_AS_HEADERS=y +# CT_GLIBC_KERNEL_VERSION_CHOSEN is not set +CT_GLIBC_MIN_KERNEL="4.9.156" +# CT_GLIBC_SSP_DEFAULT is not set +# CT_GLIBC_SSP_NO is not set +# CT_GLIBC_SSP_YES is not set +# CT_GLIBC_SSP_ALL is not set +# CT_GLIBC_SSP_STRONG is not set +CT_ALL_LIBC_CHOICES="AVR_LIBC BIONIC GLIBC MINGW_W64 MOXIEBOX MUSL NEWLIB NONE UCLIBC" +CT_LIBC_SUPPORT_THREADS_ANY=y +CT_LIBC_SUPPORT_THREADS_NATIVE=y + +# +# Common C library options +# +CT_THREADS_NATIVE=y +# CT_CREATE_LDSO_CONF is not set +CT_LIBC_XLDD=y + +# +# C compiler +# +CT_CC_CORE_PASSES_NEEDED=y +CT_CC_CORE_PASS_1_NEEDED=y +CT_CC_CORE_PASS_2_NEEDED=y +CT_CC_SUPPORT_CXX=y +CT_CC_SUPPORT_FORTRAN=y +CT_CC_SUPPORT_ADA=y +CT_CC_SUPPORT_OBJC=y +CT_CC_SUPPORT_OBJCXX=y +CT_CC_SUPPORT_GOLANG=y +CT_CC_GCC=y +CT_CC="gcc" +CT_CC_CHOICE_KSYM="GCC" +CT_CC_GCC_SHOW=y + +# +# Options for gcc +# +CT_CC_GCC_PKG_KSYM="GCC" +CT_GCC_DIR_NAME="gcc" +CT_GCC_USE_GNU=y +CT_GCC_USE="GCC" +CT_GCC_PKG_NAME="gcc" +CT_GCC_SRC_RELEASE=y +CT_GCC_PATCH_ORDER="global" +CT_GCC_V_8=y +# CT_GCC_V_7 is not set +# CT_GCC_V_6 is not set +# CT_GCC_V_5 is not set +# CT_GCC_V_4_9 is not set +# CT_GCC_NO_VERSIONS is not set +CT_GCC_VERSION="8.3.0" +CT_GCC_MIRRORS="$(CT_Mirrors GNU gcc/gcc-${CT_GCC_VERSION}) $(CT_Mirrors sourceware gcc/releases/gcc-${CT_GCC_VERSION})" +CT_GCC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_GCC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_GCC_ARCHIVE_FORMATS=".tar.xz .tar.gz" +CT_GCC_SIGNATURE_FORMAT="" +CT_GCC_later_than_7=y +CT_GCC_7_or_later=y +CT_GCC_later_than_6=y +CT_GCC_6_or_later=y +CT_GCC_later_than_5=y +CT_GCC_5_or_later=y +CT_GCC_later_than_4_9=y +CT_GCC_4_9_or_later=y +CT_GCC_later_than_4_8=y +CT_GCC_4_8_or_later=y +CT_CC_GCC_ENABLE_PLUGINS=y +CT_CC_GCC_GOLD=y +CT_CC_GCC_HAS_LIBMPX=y +CT_CC_GCC_ENABLE_CXX_FLAGS="" +CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="" +CT_CC_GCC_EXTRA_CONFIG_ARRAY="" +CT_CC_GCC_STATIC_LIBSTDCXX=y +# CT_CC_GCC_SYSTEM_ZLIB is not set +CT_CC_GCC_CONFIG_TLS=m + +# +# Optimisation features +# +CT_CC_GCC_USE_GRAPHITE=y +CT_CC_GCC_USE_LTO=y + +# +# Settings for libraries running on target +# +CT_CC_GCC_ENABLE_TARGET_OPTSPACE=y +# CT_CC_GCC_LIBMUDFLAP is not set +# CT_CC_GCC_LIBGOMP is not set +# CT_CC_GCC_LIBSSP is not set +# CT_CC_GCC_LIBQUADMATH is not set +# CT_CC_GCC_LIBSANITIZER is not set + +# +# Misc. obscure options. +# +CT_CC_CXA_ATEXIT=y +# CT_CC_GCC_DISABLE_PCH is not set +# CT_CC_GCC_SJLJ_EXCEPTIONS is not set +CT_CC_GCC_LDBL_128=m +# CT_CC_GCC_BUILD_ID is not set +CT_CC_GCC_LNK_HASH_STYLE_DEFAULT=y +# CT_CC_GCC_LNK_HASH_STYLE_SYSV is not set +# CT_CC_GCC_LNK_HASH_STYLE_GNU is not set +# CT_CC_GCC_LNK_HASH_STYLE_BOTH is not set +CT_CC_GCC_LNK_HASH_STYLE="" +CT_CC_GCC_DEC_FLOAT_AUTO=y +# CT_CC_GCC_DEC_FLOAT_BID is not set +# CT_CC_GCC_DEC_FLOAT_DPD is not set +# CT_CC_GCC_DEC_FLOATS_NO is not set +CT_ALL_CC_CHOICES="GCC" + +# +# Additional supported languages: +# +CT_CC_LANG_CXX=y +# CT_CC_LANG_FORTRAN is not set + +# +# Debug facilities +# +# CT_DEBUG_DUMA is not set +# CT_DUMA_SRC_RELEASE is not set +# CT_DUMA_V_2_5_15 is not set +# CT_DEBUG_GDB is not set +# CT_GDB_USE_GNU is not set +# CT_GDB_SRC_RELEASE is not set +# CT_GDB_V_8_2 is not set +# CT_GDB_V_8_1 is not set +# CT_GDB_V_8_0 is not set +# CT_GDB_V_7_12 is not set +# CT_GDB_V_7_11 is not set +# CT_DEBUG_LTRACE is not set +# CT_LTRACE_SRC_RELEASE is not set +# CT_LTRACE_V_0_7_3 is not set +# CT_DEBUG_STRACE is not set +# CT_STRACE_SRC_RELEASE is not set +# CT_STRACE_V_4_26 is not set +# CT_STRACE_V_4_25 is not set +# CT_STRACE_V_4_24 is not set +# CT_STRACE_V_4_23 is not set +# CT_STRACE_V_4_22 is not set +# CT_STRACE_V_4_21 is not set +# CT_STRACE_V_4_20 is not set +# CT_STRACE_V_4_19 is not set +# CT_STRACE_V_4_18 is not set +# CT_STRACE_V_4_17 is not set +# CT_STRACE_V_4_16 is not set +# CT_STRACE_V_4_15 is not set +CT_ALL_DEBUG_CHOICES="DUMA GDB LTRACE STRACE" + +# +# Companion libraries +# +# CT_COMPLIBS_CHECK is not set +# CT_COMP_LIBS_CLOOG is not set +CT_COMP_LIBS_EXPAT=y +CT_COMP_LIBS_EXPAT_PKG_KSYM="EXPAT" +CT_EXPAT_DIR_NAME="expat" +CT_EXPAT_PKG_NAME="expat" +CT_EXPAT_SRC_RELEASE=y +CT_EXPAT_PATCH_ORDER="global" +CT_EXPAT_V_2_2=y +# CT_EXPAT_NO_VERSIONS is not set +CT_EXPAT_VERSION="2.2.6" +CT_EXPAT_MIRRORS="http://downloads.sourceforge.net/project/expat/expat/${CT_EXPAT_VERSION}" +CT_EXPAT_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_EXPAT_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_EXPAT_ARCHIVE_FORMATS=".tar.bz2" +CT_EXPAT_SIGNATURE_FORMAT="" +CT_COMP_LIBS_GETTEXT=y +CT_COMP_LIBS_GETTEXT_PKG_KSYM="GETTEXT" +CT_GETTEXT_DIR_NAME="gettext" +CT_GETTEXT_PKG_NAME="gettext" +CT_GETTEXT_SRC_RELEASE=y +CT_GETTEXT_PATCH_ORDER="global" +CT_GETTEXT_V_0_19_8_1=y +# CT_GETTEXT_NO_VERSIONS is not set +CT_GETTEXT_VERSION="0.19.8.1" +CT_GETTEXT_MIRRORS="$(CT_Mirrors GNU gettext)" +CT_GETTEXT_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_GETTEXT_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_GETTEXT_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.gz" +CT_GETTEXT_SIGNATURE_FORMAT="packed/.sig" +CT_COMP_LIBS_GMP=y +CT_COMP_LIBS_GMP_PKG_KSYM="GMP" +CT_GMP_DIR_NAME="gmp" +CT_GMP_PKG_NAME="gmp" +CT_GMP_SRC_RELEASE=y +CT_GMP_PATCH_ORDER="global" +CT_GMP_V_6_1=y +# CT_GMP_NO_VERSIONS is not set +CT_GMP_VERSION="6.1.2" +CT_GMP_MIRRORS="https://gmplib.org/download/gmp https://gmplib.org/download/gmp/archive $(CT_Mirrors GNU gmp)" +CT_GMP_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_GMP_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_GMP_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.bz2" +CT_GMP_SIGNATURE_FORMAT="packed/.sig" +CT_GMP_later_than_5_1_0=y +CT_GMP_5_1_0_or_later=y +CT_GMP_later_than_5_0_0=y +CT_GMP_5_0_0_or_later=y +CT_GMP_REQUIRE_5_0_0_or_later=y +CT_COMP_LIBS_ISL=y +CT_COMP_LIBS_ISL_PKG_KSYM="ISL" +CT_ISL_DIR_NAME="isl" +CT_ISL_PKG_NAME="isl" +CT_ISL_SRC_RELEASE=y +CT_ISL_PATCH_ORDER="global" +CT_ISL_V_0_20=y +# CT_ISL_V_0_19 is not set +# CT_ISL_V_0_18 is not set +# CT_ISL_V_0_17 is not set +# CT_ISL_V_0_16 is not set +# CT_ISL_V_0_15 is not set +# CT_ISL_NO_VERSIONS is not set +CT_ISL_VERSION="0.20" +CT_ISL_MIRRORS="http://isl.gforge.inria.fr" +CT_ISL_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_ISL_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_ISL_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" +CT_ISL_SIGNATURE_FORMAT="" +CT_ISL_later_than_0_18=y +CT_ISL_0_18_or_later=y +CT_ISL_later_than_0_15=y +CT_ISL_0_15_or_later=y +CT_ISL_REQUIRE_0_15_or_later=y +CT_ISL_later_than_0_14=y +CT_ISL_0_14_or_later=y +CT_ISL_REQUIRE_0_14_or_later=y +CT_ISL_later_than_0_13=y +CT_ISL_0_13_or_later=y +CT_ISL_later_than_0_12=y +CT_ISL_0_12_or_later=y +CT_ISL_REQUIRE_0_12_or_later=y +CT_COMP_LIBS_LIBELF=y +CT_COMP_LIBS_LIBELF_PKG_KSYM="LIBELF" +CT_LIBELF_DIR_NAME="libelf" +CT_LIBELF_PKG_NAME="libelf" +CT_LIBELF_SRC_RELEASE=y +CT_LIBELF_PATCH_ORDER="global" +CT_LIBELF_V_0_8=y +# CT_LIBELF_NO_VERSIONS is not set +CT_LIBELF_VERSION="0.8.13" +CT_LIBELF_MIRRORS="http://www.mr511.de/software https://fossies.org/linux/misc/old" +CT_LIBELF_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_LIBELF_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_LIBELF_ARCHIVE_FORMATS=".tar.gz" +CT_LIBELF_SIGNATURE_FORMAT="" +CT_COMP_LIBS_LIBICONV=y +CT_COMP_LIBS_LIBICONV_PKG_KSYM="LIBICONV" +CT_LIBICONV_DIR_NAME="libiconv" +CT_LIBICONV_PKG_NAME="libiconv" +CT_LIBICONV_SRC_RELEASE=y +CT_LIBICONV_PATCH_ORDER="global" +CT_LIBICONV_V_1_15=y +# CT_LIBICONV_NO_VERSIONS is not set +CT_LIBICONV_VERSION="1.15" +CT_LIBICONV_MIRRORS="$(CT_Mirrors GNU libiconv)" +CT_LIBICONV_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_LIBICONV_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_LIBICONV_ARCHIVE_FORMATS=".tar.gz" +CT_LIBICONV_SIGNATURE_FORMAT="packed/.sig" +CT_COMP_LIBS_MPC=y +CT_COMP_LIBS_MPC_PKG_KSYM="MPC" +CT_MPC_DIR_NAME="mpc" +CT_MPC_PKG_NAME="mpc" +CT_MPC_SRC_RELEASE=y +CT_MPC_PATCH_ORDER="global" +CT_MPC_V_1_1=y +# CT_MPC_V_1_0 is not set +# CT_MPC_NO_VERSIONS is not set +CT_MPC_VERSION="1.1.0" +CT_MPC_MIRRORS="http://www.multiprecision.org/downloads $(CT_Mirrors GNU mpc)" +CT_MPC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_MPC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_MPC_ARCHIVE_FORMATS=".tar.gz" +CT_MPC_SIGNATURE_FORMAT="packed/.sig" +CT_MPC_1_1_0_or_later=y +CT_MPC_1_1_0_or_older=y +CT_COMP_LIBS_MPFR=y +CT_COMP_LIBS_MPFR_PKG_KSYM="MPFR" +CT_MPFR_DIR_NAME="mpfr" +CT_MPFR_PKG_NAME="mpfr" +CT_MPFR_SRC_RELEASE=y +CT_MPFR_PATCH_ORDER="global" +CT_MPFR_V_4_0=y +# CT_MPFR_V_3_1 is not set +# CT_MPFR_NO_VERSIONS is not set +CT_MPFR_VERSION="4.0.2" +CT_MPFR_MIRRORS="http://www.mpfr.org/mpfr-${CT_MPFR_VERSION} $(CT_Mirrors GNU mpfr)" +CT_MPFR_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_MPFR_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_MPFR_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz .zip" +CT_MPFR_SIGNATURE_FORMAT="packed/.asc" +CT_MPFR_later_than_4_0_0=y +CT_MPFR_4_0_0_or_later=y +CT_MPFR_later_than_3_0_0=y +CT_MPFR_3_0_0_or_later=y +CT_MPFR_REQUIRE_3_0_0_or_later=y +CT_COMP_LIBS_NCURSES=y +CT_COMP_LIBS_NCURSES_PKG_KSYM="NCURSES" +CT_NCURSES_DIR_NAME="ncurses" +CT_NCURSES_PKG_NAME="ncurses" +CT_NCURSES_SRC_RELEASE=y +CT_NCURSES_PATCH_ORDER="global" +CT_NCURSES_V_6_1=y +# CT_NCURSES_V_6_0 is not set +# CT_NCURSES_NO_VERSIONS is not set +CT_NCURSES_VERSION="6.1" +CT_NCURSES_MIRRORS="ftp://invisible-island.net/ncurses $(CT_Mirrors GNU ncurses)" +CT_NCURSES_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_NCURSES_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_NCURSES_ARCHIVE_FORMATS=".tar.gz" +CT_NCURSES_SIGNATURE_FORMAT="packed/.sig" +CT_NCURSES_HOST_CONFIG_ARGS="" +CT_NCURSES_HOST_DISABLE_DB=y +CT_NCURSES_HOST_FALLBACKS="linux,xterm,xterm-color,xterm-256color,vt100" +CT_NCURSES_TARGET_CONFIG_ARGS="" +# CT_NCURSES_TARGET_DISABLE_DB is not set +CT_NCURSES_TARGET_FALLBACKS="" +CT_COMP_LIBS_ZLIB=y +CT_COMP_LIBS_ZLIB_PKG_KSYM="ZLIB" +CT_ZLIB_DIR_NAME="zlib" +CT_ZLIB_PKG_NAME="zlib" +CT_ZLIB_SRC_RELEASE=y +CT_ZLIB_PATCH_ORDER="global" +CT_ZLIB_V_1_2_11=y +# CT_ZLIB_NO_VERSIONS is not set +CT_ZLIB_VERSION="1.2.11" +CT_ZLIB_MIRRORS="http://downloads.sourceforge.net/project/libpng/zlib/${CT_ZLIB_VERSION}" +CT_ZLIB_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_ZLIB_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_ZLIB_ARCHIVE_FORMATS=".tar.xz .tar.gz" +CT_ZLIB_SIGNATURE_FORMAT="packed/.asc" +CT_ALL_COMP_LIBS_CHOICES="CLOOG EXPAT GETTEXT GMP ISL LIBELF LIBICONV MPC MPFR NCURSES ZLIB" +CT_LIBICONV_NEEDED=y +CT_GETTEXT_NEEDED=y +CT_GMP_NEEDED=y +CT_MPFR_NEEDED=y +CT_ISL_NEEDED=y +CT_MPC_NEEDED=y +CT_NCURSES_NEEDED=y +CT_ZLIB_NEEDED=y +CT_LIBICONV=y +CT_GETTEXT=y +CT_GMP=y +CT_MPFR=y +CT_ISL=y +CT_MPC=y +CT_NCURSES=y +CT_ZLIB=y + +# +# Companion tools +# +# CT_COMP_TOOLS_FOR_HOST is not set +# CT_COMP_TOOLS_AUTOCONF is not set +# CT_COMP_TOOLS_AUTOMAKE is not set +# CT_COMP_TOOLS_BISON is not set +# CT_COMP_TOOLS_DTC is not set +# CT_COMP_TOOLS_LIBTOOL is not set +# CT_COMP_TOOLS_M4 is not set +# CT_COMP_TOOLS_MAKE is not set +CT_ALL_COMP_TOOLS_CHOICES="AUTOCONF AUTOMAKE BISON DTC LIBTOOL M4 MAKE" diff --git a/kotlin-native/tools/toolchain_builder/toolchains/x86_64-unknown-linux-gnu/gcc-8.3.0-glibc-2.19-kernel-4.9.config b/kotlin-native/tools/toolchain_builder/toolchains/x86_64-unknown-linux-gnu/gcc-8.3.0-glibc-2.19-kernel-4.9.config new file mode 100644 index 00000000000..b7c25cd02fd --- /dev/null +++ b/kotlin-native/tools/toolchain_builder/toolchains/x86_64-unknown-linux-gnu/gcc-8.3.0-glibc-2.19-kernel-4.9.config @@ -0,0 +1,743 @@ +# +# Automatically generated file; DO NOT EDIT. +# crosstool-NG Configuration +# +CT_CONFIGURE_has_static_link=y +CT_CONFIGURE_has_cxx11=y +CT_CONFIGURE_has_wget=y +CT_CONFIGURE_has_curl=y +CT_CONFIGURE_has_make_3_81_or_newer=y +CT_CONFIGURE_has_make_4_0_or_newer=y +CT_CONFIGURE_has_libtool_2_4_or_newer=y +CT_CONFIGURE_has_libtoolize_2_4_or_newer=y +CT_CONFIGURE_has_autoconf_2_65_or_newer=y +CT_CONFIGURE_has_autoreconf_2_65_or_newer=y +CT_CONFIGURE_has_automake_1_15_or_newer=y +CT_CONFIGURE_has_gnu_m4_1_4_12_or_newer=y +CT_CONFIGURE_has_python_3_4_or_newer=y +CT_CONFIGURE_has_bison_2_7_or_newer=y +CT_CONFIGURE_has_python=y +CT_CONFIGURE_has_git=y +CT_CONFIGURE_has_md5sum=y +CT_CONFIGURE_has_sha1sum=y +CT_CONFIGURE_has_sha256sum=y +CT_CONFIGURE_has_sha512sum=y +CT_CONFIGURE_has_install_with_strip_program=y +CT_CONFIG_VERSION_CURRENT="3" +CT_CONFIG_VERSION="3" +CT_MODULES=y + +# +# Paths and misc options +# + +# +# crosstool-NG behavior +# +# CT_OBSOLETE is not set +# CT_EXPERIMENTAL is not set +# CT_DEBUG_CT is not set + +# +# Paths +# +CT_LOCAL_TARBALLS_DIR="${HOME}/src" +CT_SAVE_TARBALLS=y +# CT_TARBALLS_BUILDROOT_LAYOUT is not set +CT_WORK_DIR="${CT_TOP_DIR}/.build" +CT_BUILD_TOP_DIR="${CT_WORK_DIR:-${CT_TOP_DIR}/.build}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" +CT_PREFIX_DIR="${CT_PREFIX:-${HOME}/x-tools}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" +CT_RM_RF_PREFIX_DIR=y +CT_REMOVE_DOCS=y +CT_INSTALL_LICENSES=y +# CT_PREFIX_DIR_RO is not set +CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES=y +CT_STRIP_TARGET_TOOLCHAIN_EXECUTABLES=y + +# +# Downloading +# +CT_DOWNLOAD_AGENT_WGET=y +# CT_DOWNLOAD_AGENT_CURL is not set +# CT_DOWNLOAD_AGENT_NONE is not set +# CT_FORBID_DOWNLOAD is not set +# CT_FORCE_DOWNLOAD is not set +CT_CONNECT_TIMEOUT=10 +CT_DOWNLOAD_WGET_OPTIONS="--passive-ftp --tries=3 -nc --progress=dot:binary" +# CT_ONLY_DOWNLOAD is not set +# CT_USE_MIRROR is not set +CT_VERIFY_DOWNLOAD_DIGEST=y +CT_VERIFY_DOWNLOAD_DIGEST_SHA512=y +# CT_VERIFY_DOWNLOAD_DIGEST_SHA256 is not set +# CT_VERIFY_DOWNLOAD_DIGEST_SHA1 is not set +# CT_VERIFY_DOWNLOAD_DIGEST_MD5 is not set +CT_VERIFY_DOWNLOAD_DIGEST_ALG="sha512" +# CT_VERIFY_DOWNLOAD_SIGNATURE is not set + +# +# Extracting +# +# CT_FORCE_EXTRACT is not set +CT_OVERRIDE_CONFIG_GUESS_SUB=y +# CT_ONLY_EXTRACT is not set +CT_PATCH_BUNDLED=y +# CT_PATCH_BUNDLED_LOCAL is not set +CT_PATCH_ORDER="bundled" + +# +# Build behavior +# +CT_PARALLEL_JOBS=0 +CT_LOAD="" +CT_USE_PIPES=y +CT_EXTRA_CFLAGS_FOR_BUILD="" +CT_EXTRA_LDFLAGS_FOR_BUILD="" +CT_EXTRA_CFLAGS_FOR_HOST="" +CT_EXTRA_LDFLAGS_FOR_HOST="" +# CT_CONFIG_SHELL_SH is not set +# CT_CONFIG_SHELL_ASH is not set +CT_CONFIG_SHELL_BASH=y +# CT_CONFIG_SHELL_CUSTOM is not set +CT_CONFIG_SHELL="${bash}" + +# +# Logging +# +# CT_LOG_ERROR is not set +# CT_LOG_WARN is not set +# CT_LOG_INFO is not set +CT_LOG_EXTRA=y +# CT_LOG_ALL is not set +# CT_LOG_DEBUG is not set +CT_LOG_LEVEL_MAX="EXTRA" +# CT_LOG_SEE_TOOLS_WARN is not set +CT_LOG_PROGRESS_BAR=y +CT_LOG_TO_FILE=y +CT_LOG_FILE_COMPRESS=y + +# +# Target options +# +# CT_ARCH_ALPHA is not set +# CT_ARCH_ARC is not set +# CT_ARCH_ARM is not set +# CT_ARCH_AVR is not set +# CT_ARCH_M68K is not set +# CT_ARCH_MIPS is not set +# CT_ARCH_NIOS2 is not set +# CT_ARCH_POWERPC is not set +# CT_ARCH_S390 is not set +# CT_ARCH_SH is not set +# CT_ARCH_SPARC is not set +CT_ARCH_X86=y +# CT_ARCH_XTENSA is not set +CT_ARCH="x86" +CT_ARCH_CHOICE_KSYM="X86" +CT_ARCH_CPU="" +CT_ARCH_TUNE="" +CT_ARCH_X86_SHOW=y + +# +# Options for x86 +# +CT_ARCH_X86_PKG_KSYM="" +CT_ALL_ARCH_CHOICES="ALPHA ARC ARM AVR M68K MICROBLAZE MIPS MOXIE MSP430 NIOS2 POWERPC RISCV S390 SH SPARC X86 XTENSA" +CT_ARCH_SUFFIX="" +# CT_OMIT_TARGET_VENDOR is not set + +# +# Generic target options +# +# CT_MULTILIB is not set +CT_DEMULTILIB=y +CT_ARCH_USE_MMU=y +CT_ARCH_SUPPORTS_32=y +CT_ARCH_SUPPORTS_64=y +CT_ARCH_DEFAULT_32=y +CT_ARCH_BITNESS=64 +# CT_ARCH_32 is not set +CT_ARCH_64=y + +# +# Target optimisations +# +CT_ARCH_SUPPORTS_WITH_ARCH=y +CT_ARCH_SUPPORTS_WITH_CPU=y +CT_ARCH_SUPPORTS_WITH_TUNE=y +CT_ARCH_ARCH="" +CT_TARGET_CFLAGS="" +CT_TARGET_LDFLAGS="" + +# +# Toolchain options +# + +# +# General toolchain options +# +CT_FORCE_SYSROOT=y +CT_USE_SYSROOT=y +CT_SYSROOT_NAME="sysroot" +CT_SYSROOT_DIR_PREFIX="" +CT_WANTS_STATIC_LINK=y +CT_WANTS_STATIC_LINK_CXX=y +# CT_STATIC_TOOLCHAIN is not set +CT_SHOW_CT_VERSION=y +CT_TOOLCHAIN_PKGVERSION="" +CT_TOOLCHAIN_BUGURL="" + +# +# Tuple completion and aliasing +# +CT_TARGET_VENDOR="unknown" +CT_TARGET_ALIAS_SED_EXPR="" +CT_TARGET_ALIAS="" + +# +# Toolchain type +# +CT_CROSS=y +# CT_CANADIAN is not set +CT_TOOLCHAIN_TYPE="cross" + +# +# Build system +# +CT_BUILD="" +CT_BUILD_PREFIX="" +CT_BUILD_SUFFIX="" + +# +# Misc options +# +# CT_TOOLCHAIN_ENABLE_NLS is not set + +# +# Operating System +# +CT_KERNEL_SUPPORTS_SHARED_LIBS=y +# CT_KERNEL_BARE_METAL is not set +CT_KERNEL_LINUX=y +CT_KERNEL="linux" +CT_KERNEL_CHOICE_KSYM="LINUX" +CT_KERNEL_LINUX_SHOW=y + +# +# Options for linux +# +CT_KERNEL_LINUX_PKG_KSYM="LINUX" +CT_LINUX_DIR_NAME="linux" +CT_LINUX_PKG_NAME="linux" +CT_LINUX_SRC_RELEASE=y +CT_LINUX_PATCH_ORDER="global" +# CT_LINUX_V_4_20 is not set +# CT_LINUX_V_4_19 is not set +# CT_LINUX_V_4_18 is not set +# CT_LINUX_V_4_17 is not set +# CT_LINUX_V_4_16 is not set +# CT_LINUX_V_4_15 is not set +# CT_LINUX_V_4_14 is not set +# CT_LINUX_V_4_13 is not set +# CT_LINUX_V_4_12 is not set +# CT_LINUX_V_4_11 is not set +# CT_LINUX_V_4_10 is not set +CT_LINUX_V_4_9=y +# CT_LINUX_V_4_4 is not set +# CT_LINUX_V_4_1 is not set +# CT_LINUX_V_3_16 is not set +# CT_LINUX_V_3_13 is not set +# CT_LINUX_V_3_12 is not set +# CT_LINUX_V_3_10 is not set +# CT_LINUX_V_3_4 is not set +# CT_LINUX_V_3_2 is not set +# CT_LINUX_V_2_6_32 is not set +# CT_LINUX_NO_VERSIONS is not set +CT_LINUX_VERSION="4.9.156" +CT_LINUX_MIRRORS="$(CT_Mirrors kernel.org linux ${CT_LINUX_VERSION})" +CT_LINUX_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_LINUX_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_LINUX_ARCHIVE_FORMATS=".tar.xz .tar.gz" +CT_LINUX_SIGNATURE_FORMAT="unpacked/.sign" +CT_LINUX_later_than_4_8=y +CT_LINUX_4_8_or_later=y +CT_LINUX_later_than_3_7=y +CT_LINUX_3_7_or_later=y +CT_LINUX_later_than_3_2=y +CT_LINUX_3_2_or_later=y +CT_KERNEL_LINUX_VERBOSITY_0=y +# CT_KERNEL_LINUX_VERBOSITY_1 is not set +# CT_KERNEL_LINUX_VERBOSITY_2 is not set +CT_KERNEL_LINUX_VERBOSE_LEVEL=0 +CT_KERNEL_LINUX_INSTALL_CHECK=y +CT_ALL_KERNEL_CHOICES="BARE_METAL LINUX WINDOWS" + +# +# Common kernel options +# +CT_SHARED_LIBS=y + +# +# Binary utilities +# +CT_ARCH_BINFMT_ELF=y +CT_BINUTILS_BINUTILS=y +CT_BINUTILS="binutils" +CT_BINUTILS_CHOICE_KSYM="BINUTILS" +CT_BINUTILS_BINUTILS_SHOW=y + +# +# Options for binutils +# +CT_BINUTILS_BINUTILS_PKG_KSYM="BINUTILS" +CT_BINUTILS_DIR_NAME="binutils" +CT_BINUTILS_USE_GNU=y +CT_BINUTILS_USE="BINUTILS" +CT_BINUTILS_PKG_NAME="binutils" +CT_BINUTILS_SRC_RELEASE=y +CT_BINUTILS_PATCH_ORDER="global" +CT_BINUTILS_V_2_32=y +# CT_BINUTILS_V_2_31 is not set +# CT_BINUTILS_V_2_30 is not set +# CT_BINUTILS_V_2_29 is not set +# CT_BINUTILS_V_2_28 is not set +# CT_BINUTILS_V_2_27 is not set +# CT_BINUTILS_V_2_26 is not set +# CT_BINUTILS_NO_VERSIONS is not set +CT_BINUTILS_VERSION="2.32" +CT_BINUTILS_MIRRORS="$(CT_Mirrors GNU binutils) $(CT_Mirrors sourceware binutils/releases)" +CT_BINUTILS_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_BINUTILS_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_BINUTILS_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" +CT_BINUTILS_SIGNATURE_FORMAT="packed/.sig" +CT_BINUTILS_later_than_2_30=y +CT_BINUTILS_2_30_or_later=y +CT_BINUTILS_later_than_2_27=y +CT_BINUTILS_2_27_or_later=y +CT_BINUTILS_later_than_2_25=y +CT_BINUTILS_2_25_or_later=y +CT_BINUTILS_later_than_2_23=y +CT_BINUTILS_2_23_or_later=y + +# +# GNU binutils +# +CT_BINUTILS_HAS_HASH_STYLE=y +CT_BINUTILS_HAS_GOLD=y +CT_BINUTILS_HAS_PLUGINS=y +CT_BINUTILS_HAS_PKGVERSION_BUGURL=y +CT_BINUTILS_GOLD_SUPPORTS_ARCH=y +CT_BINUTILS_GOLD_SUPPORT=y +CT_BINUTILS_FORCE_LD_BFD_DEFAULT=y +# CT_BINUTILS_LINKER_LD is not set +CT_BINUTILS_LINKER_LD_GOLD=y +CT_BINUTILS_GOLD_INSTALLED=y +CT_BINUTILS_GOLD_THREADS=y +CT_BINUTILS_LINKER_BOTH=y +CT_BINUTILS_LINKERS_LIST="ld,gold" +CT_BINUTILS_LD_WRAPPER=y +CT_BINUTILS_LINKER_DEFAULT="bfd" +CT_BINUTILS_PLUGINS=y +CT_BINUTILS_RELRO=m +CT_BINUTILS_EXTRA_CONFIG_ARRAY="" +# CT_BINUTILS_FOR_TARGET is not set +CT_ALL_BINUTILS_CHOICES="BINUTILS" + +# +# C-library +# +CT_LIBC_GLIBC=y +# CT_LIBC_UCLIBC is not set +CT_LIBC="glibc" +CT_LIBC_CHOICE_KSYM="GLIBC" +CT_THREADS="nptl" +CT_LIBC_GLIBC_SHOW=y + +# +# Options for glibc +# +CT_LIBC_GLIBC_PKG_KSYM="GLIBC" +CT_GLIBC_DIR_NAME="glibc" +CT_GLIBC_USE_GNU=y +CT_GLIBC_USE="GLIBC" +CT_GLIBC_PKG_NAME="glibc" +CT_GLIBC_SRC_RELEASE=y +CT_GLIBC_PATCH_ORDER="global" +# CT_GLIBC_V_2_29 is not set +# CT_GLIBC_V_2_28 is not set +# CT_GLIBC_V_2_27 is not set +# CT_GLIBC_V_2_26 is not set +# CT_GLIBC_V_2_25 is not set +# CT_GLIBC_V_2_24 is not set +# CT_GLIBC_V_2_23 is not set +CT_GLIBC_V_2_19=y +# CT_GLIBC_V_2_17 is not set +# CT_GLIBC_V_2_12_1 is not set +# CT_GLIBC_NO_VERSIONS is not set +CT_GLIBC_VERSION="2.19" +CT_GLIBC_MIRRORS="$(CT_Mirrors GNU glibc)" +CT_GLIBC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_GLIBC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_GLIBC_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" +CT_GLIBC_SIGNATURE_FORMAT="packed/.sig" +CT_GLIBC_2_29_or_older=y +CT_GLIBC_older_than_2_29=y +CT_GLIBC_2_27_or_older=y +CT_GLIBC_older_than_2_27=y +CT_GLIBC_2_26_or_older=y +CT_GLIBC_older_than_2_26=y +CT_GLIBC_2_25_or_older=y +CT_GLIBC_older_than_2_25=y +CT_GLIBC_2_24_or_older=y +CT_GLIBC_older_than_2_24=y +CT_GLIBC_2_23_or_older=y +CT_GLIBC_older_than_2_23=y +CT_GLIBC_2_20_or_older=y +CT_GLIBC_older_than_2_20=y +CT_GLIBC_later_than_2_17=y +CT_GLIBC_2_17_or_later=y +CT_GLIBC_later_than_2_14=y +CT_GLIBC_2_14_or_later=y +CT_GLIBC_DEP_KERNEL_HEADERS_VERSION=y +CT_GLIBC_DEP_BINUTILS=y +CT_GLIBC_DEP_GCC=y +CT_GLIBC_DEP_PYTHON=y +CT_GLIBC_HAS_NPTL_ADDON=y +CT_GLIBC_HAS_PORTS_ADDON=y +CT_GLIBC_HAS_LIBIDN_ADDON=y +CT_GLIBC_USE_NPTL_ADDON=y +# CT_GLIBC_USE_LIBIDN_ADDON is not set +CT_GLIBC_HAS_OBSOLETE_RPC=y +CT_GLIBC_EXTRA_CONFIG_ARRAY="" +CT_GLIBC_CONFIGPARMS="" +CT_GLIBC_EXTRA_CFLAGS="" +CT_GLIBC_ENABLE_OBSOLETE_RPC=y +# CT_GLIBC_DISABLE_VERSIONING is not set +CT_GLIBC_OLDEST_ABI="" +CT_GLIBC_FORCE_UNWIND=y +# CT_GLIBC_LOCALES is not set +CT_GLIBC_KERNEL_VERSION_NONE=y +# CT_GLIBC_KERNEL_VERSION_AS_HEADERS is not set +# CT_GLIBC_KERNEL_VERSION_CHOSEN is not set +CT_GLIBC_MIN_KERNEL="" +CT_ALL_LIBC_CHOICES="AVR_LIBC BIONIC GLIBC MINGW_W64 MOXIEBOX MUSL NEWLIB NONE UCLIBC" +CT_LIBC_SUPPORT_THREADS_ANY=y +CT_LIBC_SUPPORT_THREADS_NATIVE=y + +# +# Common C library options +# +CT_THREADS_NATIVE=y +# CT_CREATE_LDSO_CONF is not set +CT_LIBC_XLDD=y + +# +# C compiler +# +CT_CC_CORE_PASSES_NEEDED=y +CT_CC_CORE_PASS_1_NEEDED=y +CT_CC_CORE_PASS_2_NEEDED=y +CT_CC_SUPPORT_CXX=y +CT_CC_SUPPORT_FORTRAN=y +CT_CC_SUPPORT_ADA=y +CT_CC_SUPPORT_OBJC=y +CT_CC_SUPPORT_OBJCXX=y +CT_CC_SUPPORT_GOLANG=y +CT_CC_GCC=y +CT_CC="gcc" +CT_CC_CHOICE_KSYM="GCC" +CT_CC_GCC_SHOW=y + +# +# Options for gcc +# +CT_CC_GCC_PKG_KSYM="GCC" +CT_GCC_DIR_NAME="gcc" +CT_GCC_USE_GNU=y +CT_GCC_USE="GCC" +CT_GCC_PKG_NAME="gcc" +CT_GCC_SRC_RELEASE=y +CT_GCC_PATCH_ORDER="global" +CT_GCC_V_8=y +# CT_GCC_V_7 is not set +# CT_GCC_V_6 is not set +# CT_GCC_V_5 is not set +# CT_GCC_V_4_9 is not set +# CT_GCC_NO_VERSIONS is not set +CT_GCC_VERSION="8.3.0" +CT_GCC_MIRRORS="$(CT_Mirrors GNU gcc/gcc-${CT_GCC_VERSION}) $(CT_Mirrors sourceware gcc/releases/gcc-${CT_GCC_VERSION})" +CT_GCC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_GCC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_GCC_ARCHIVE_FORMATS=".tar.xz .tar.gz" +CT_GCC_SIGNATURE_FORMAT="" +CT_GCC_later_than_7=y +CT_GCC_7_or_later=y +CT_GCC_later_than_6=y +CT_GCC_6_or_later=y +CT_GCC_later_than_5=y +CT_GCC_5_or_later=y +CT_GCC_later_than_4_9=y +CT_GCC_4_9_or_later=y +CT_GCC_later_than_4_8=y +CT_GCC_4_8_or_later=y +CT_CC_GCC_ENABLE_PLUGINS=y +CT_CC_GCC_GOLD=y +CT_CC_GCC_HAS_LIBMPX=y +CT_CC_GCC_ENABLE_CXX_FLAGS="" +CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="" +CT_CC_GCC_EXTRA_CONFIG_ARRAY="" +CT_CC_GCC_STATIC_LIBSTDCXX=y +# CT_CC_GCC_SYSTEM_ZLIB is not set +CT_CC_GCC_CONFIG_TLS=m + +# +# Optimisation features +# +CT_CC_GCC_USE_GRAPHITE=y +CT_CC_GCC_USE_LTO=y + +# +# Settings for libraries running on target +# +CT_CC_GCC_ENABLE_TARGET_OPTSPACE=y +# CT_CC_GCC_LIBMUDFLAP is not set +# CT_CC_GCC_LIBGOMP is not set +# CT_CC_GCC_LIBSSP is not set +# CT_CC_GCC_LIBQUADMATH is not set +# CT_CC_GCC_LIBSANITIZER is not set +CT_CC_GCC_LIBMPX=y + +# +# Misc. obscure options. +# +CT_CC_CXA_ATEXIT=y +# CT_CC_GCC_DISABLE_PCH is not set +CT_CC_GCC_SJLJ_EXCEPTIONS=m +CT_CC_GCC_LDBL_128=m +# CT_CC_GCC_BUILD_ID is not set +# CT_CC_GCC_LNK_HASH_STYLE_DEFAULT is not set +# CT_CC_GCC_LNK_HASH_STYLE_SYSV is not set +# CT_CC_GCC_LNK_HASH_STYLE_GNU is not set +CT_CC_GCC_LNK_HASH_STYLE_BOTH=y +CT_CC_GCC_LNK_HASH_STYLE="both" +CT_CC_GCC_DEC_FLOAT_AUTO=y +# CT_CC_GCC_DEC_FLOAT_BID is not set +# CT_CC_GCC_DEC_FLOAT_DPD is not set +# CT_CC_GCC_DEC_FLOATS_NO is not set +CT_ALL_CC_CHOICES="GCC" + +# +# Additional supported languages: +# +CT_CC_LANG_CXX=y +# CT_CC_LANG_FORTRAN is not set + +# +# Debug facilities +# +# CT_DEBUG_DUMA is not set +# CT_DEBUG_GDB is not set +# CT_DEBUG_LTRACE is not set +# CT_DEBUG_STRACE is not set +CT_ALL_DEBUG_CHOICES="DUMA GDB LTRACE STRACE" + +# +# Companion libraries +# +# CT_COMPLIBS_CHECK is not set +# CT_COMP_LIBS_CLOOG is not set +CT_COMP_LIBS_EXPAT=y +CT_COMP_LIBS_EXPAT_PKG_KSYM="EXPAT" +CT_EXPAT_DIR_NAME="expat" +CT_EXPAT_PKG_NAME="expat" +CT_EXPAT_SRC_RELEASE=y +CT_EXPAT_PATCH_ORDER="global" +CT_EXPAT_V_2_2=y +# CT_EXPAT_NO_VERSIONS is not set +CT_EXPAT_VERSION="2.2.6" +CT_EXPAT_MIRRORS="http://downloads.sourceforge.net/project/expat/expat/${CT_EXPAT_VERSION}" +CT_EXPAT_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_EXPAT_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_EXPAT_ARCHIVE_FORMATS=".tar.bz2" +CT_EXPAT_SIGNATURE_FORMAT="" +CT_COMP_LIBS_GETTEXT=y +CT_COMP_LIBS_GETTEXT_PKG_KSYM="GETTEXT" +CT_GETTEXT_DIR_NAME="gettext" +CT_GETTEXT_PKG_NAME="gettext" +CT_GETTEXT_SRC_RELEASE=y +CT_GETTEXT_PATCH_ORDER="global" +CT_GETTEXT_V_0_19_8_1=y +# CT_GETTEXT_NO_VERSIONS is not set +CT_GETTEXT_VERSION="0.19.8.1" +CT_GETTEXT_MIRRORS="$(CT_Mirrors GNU gettext)" +CT_GETTEXT_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_GETTEXT_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_GETTEXT_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.gz" +CT_GETTEXT_SIGNATURE_FORMAT="packed/.sig" +CT_COMP_LIBS_GMP=y +CT_COMP_LIBS_GMP_PKG_KSYM="GMP" +CT_GMP_DIR_NAME="gmp" +CT_GMP_PKG_NAME="gmp" +CT_GMP_SRC_RELEASE=y +CT_GMP_PATCH_ORDER="global" +CT_GMP_V_6_1=y +# CT_GMP_NO_VERSIONS is not set +CT_GMP_VERSION="6.1.2" +CT_GMP_MIRRORS="https://gmplib.org/download/gmp https://gmplib.org/download/gmp/archive $(CT_Mirrors GNU gmp)" +CT_GMP_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_GMP_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_GMP_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.bz2" +CT_GMP_SIGNATURE_FORMAT="packed/.sig" +CT_GMP_later_than_5_1_0=y +CT_GMP_5_1_0_or_later=y +CT_GMP_later_than_5_0_0=y +CT_GMP_5_0_0_or_later=y +CT_GMP_REQUIRE_5_0_0_or_later=y +CT_COMP_LIBS_ISL=y +CT_COMP_LIBS_ISL_PKG_KSYM="ISL" +CT_ISL_DIR_NAME="isl" +CT_ISL_PKG_NAME="isl" +CT_ISL_SRC_RELEASE=y +CT_ISL_PATCH_ORDER="global" +CT_ISL_V_0_20=y +# CT_ISL_V_0_19 is not set +# CT_ISL_V_0_18 is not set +# CT_ISL_V_0_17 is not set +# CT_ISL_V_0_16 is not set +# CT_ISL_V_0_15 is not set +# CT_ISL_NO_VERSIONS is not set +CT_ISL_VERSION="0.20" +CT_ISL_MIRRORS="http://isl.gforge.inria.fr" +CT_ISL_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_ISL_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_ISL_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" +CT_ISL_SIGNATURE_FORMAT="" +CT_ISL_later_than_0_18=y +CT_ISL_0_18_or_later=y +CT_ISL_later_than_0_15=y +CT_ISL_0_15_or_later=y +CT_ISL_REQUIRE_0_15_or_later=y +CT_ISL_later_than_0_14=y +CT_ISL_0_14_or_later=y +CT_ISL_REQUIRE_0_14_or_later=y +CT_ISL_later_than_0_13=y +CT_ISL_0_13_or_later=y +CT_ISL_later_than_0_12=y +CT_ISL_0_12_or_later=y +CT_ISL_REQUIRE_0_12_or_later=y +# CT_COMP_LIBS_LIBELF is not set +CT_COMP_LIBS_LIBICONV=y +CT_COMP_LIBS_LIBICONV_PKG_KSYM="LIBICONV" +CT_LIBICONV_DIR_NAME="libiconv" +CT_LIBICONV_PKG_NAME="libiconv" +CT_LIBICONV_SRC_RELEASE=y +CT_LIBICONV_PATCH_ORDER="global" +CT_LIBICONV_V_1_15=y +# CT_LIBICONV_NO_VERSIONS is not set +CT_LIBICONV_VERSION="1.15" +CT_LIBICONV_MIRRORS="$(CT_Mirrors GNU libiconv)" +CT_LIBICONV_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_LIBICONV_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_LIBICONV_ARCHIVE_FORMATS=".tar.gz" +CT_LIBICONV_SIGNATURE_FORMAT="packed/.sig" +CT_COMP_LIBS_MPC=y +CT_COMP_LIBS_MPC_PKG_KSYM="MPC" +CT_MPC_DIR_NAME="mpc" +CT_MPC_PKG_NAME="mpc" +CT_MPC_SRC_RELEASE=y +CT_MPC_PATCH_ORDER="global" +CT_MPC_V_1_1=y +# CT_MPC_V_1_0 is not set +# CT_MPC_NO_VERSIONS is not set +CT_MPC_VERSION="1.1.0" +CT_MPC_MIRRORS="http://www.multiprecision.org/downloads $(CT_Mirrors GNU mpc)" +CT_MPC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_MPC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_MPC_ARCHIVE_FORMATS=".tar.gz" +CT_MPC_SIGNATURE_FORMAT="packed/.sig" +CT_MPC_1_1_0_or_later=y +CT_MPC_1_1_0_or_older=y +CT_COMP_LIBS_MPFR=y +CT_COMP_LIBS_MPFR_PKG_KSYM="MPFR" +CT_MPFR_DIR_NAME="mpfr" +CT_MPFR_PKG_NAME="mpfr" +CT_MPFR_SRC_RELEASE=y +CT_MPFR_PATCH_ORDER="global" +CT_MPFR_V_4_0=y +# CT_MPFR_V_3_1 is not set +# CT_MPFR_NO_VERSIONS is not set +CT_MPFR_VERSION="4.0.2" +CT_MPFR_MIRRORS="http://www.mpfr.org/mpfr-${CT_MPFR_VERSION} $(CT_Mirrors GNU mpfr)" +CT_MPFR_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_MPFR_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_MPFR_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz .zip" +CT_MPFR_SIGNATURE_FORMAT="packed/.asc" +CT_MPFR_later_than_4_0_0=y +CT_MPFR_4_0_0_or_later=y +CT_MPFR_later_than_3_0_0=y +CT_MPFR_3_0_0_or_later=y +CT_MPFR_REQUIRE_3_0_0_or_later=y +CT_COMP_LIBS_NCURSES=y +CT_COMP_LIBS_NCURSES_PKG_KSYM="NCURSES" +CT_NCURSES_DIR_NAME="ncurses" +CT_NCURSES_PKG_NAME="ncurses" +CT_NCURSES_SRC_RELEASE=y +CT_NCURSES_PATCH_ORDER="global" +CT_NCURSES_V_6_1=y +# CT_NCURSES_V_6_0 is not set +# CT_NCURSES_NO_VERSIONS is not set +CT_NCURSES_VERSION="6.1" +CT_NCURSES_MIRRORS="ftp://invisible-island.net/ncurses $(CT_Mirrors GNU ncurses)" +CT_NCURSES_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_NCURSES_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_NCURSES_ARCHIVE_FORMATS=".tar.gz" +CT_NCURSES_SIGNATURE_FORMAT="packed/.sig" +CT_NCURSES_HOST_CONFIG_ARGS="" +CT_NCURSES_HOST_DISABLE_DB=y +CT_NCURSES_HOST_FALLBACKS="linux,xterm,xterm-color,xterm-256color,vt100" +CT_NCURSES_TARGET_CONFIG_ARGS="" +# CT_NCURSES_TARGET_DISABLE_DB is not set +CT_NCURSES_TARGET_FALLBACKS="" +CT_COMP_LIBS_ZLIB=y +CT_COMP_LIBS_ZLIB_PKG_KSYM="ZLIB" +CT_ZLIB_DIR_NAME="zlib" +CT_ZLIB_PKG_NAME="zlib" +CT_ZLIB_SRC_RELEASE=y +CT_ZLIB_PATCH_ORDER="global" +CT_ZLIB_V_1_2_11=y +# CT_ZLIB_NO_VERSIONS is not set +CT_ZLIB_VERSION="1.2.11" +CT_ZLIB_MIRRORS="http://downloads.sourceforge.net/project/libpng/zlib/${CT_ZLIB_VERSION}" +CT_ZLIB_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_ZLIB_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_ZLIB_ARCHIVE_FORMATS=".tar.xz .tar.gz" +CT_ZLIB_SIGNATURE_FORMAT="packed/.asc" +CT_ALL_COMP_LIBS_CHOICES="CLOOG EXPAT GETTEXT GMP ISL LIBELF LIBICONV MPC MPFR NCURSES ZLIB" +CT_LIBICONV_NEEDED=y +CT_GETTEXT_NEEDED=y +CT_GMP_NEEDED=y +CT_MPFR_NEEDED=y +CT_ISL_NEEDED=y +CT_MPC_NEEDED=y +CT_NCURSES_NEEDED=y +CT_ZLIB_NEEDED=y +CT_LIBICONV=y +CT_GETTEXT=y +CT_GMP=y +CT_MPFR=y +CT_ISL=y +CT_MPC=y +CT_NCURSES=y +CT_ZLIB=y + +# +# Companion tools +# +# CT_COMP_TOOLS_FOR_HOST is not set +# CT_COMP_TOOLS_AUTOCONF is not set +# CT_COMP_TOOLS_AUTOMAKE is not set +# CT_COMP_TOOLS_BISON is not set +# CT_COMP_TOOLS_DTC is not set +# CT_COMP_TOOLS_LIBTOOL is not set +# CT_COMP_TOOLS_M4 is not set +# CT_COMP_TOOLS_MAKE is not set +CT_ALL_COMP_TOOLS_CHOICES="AUTOCONF AUTOMAKE BISON DTC LIBTOOL M4 MAKE" From ae00adecd618c82f19d0c0742de5692d0f08abb7 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Wed, 25 Nov 2020 16:58:44 +0700 Subject: [PATCH 638/698] Add license for zlib We need to use a glibc-2.25-based because `target-sysroot-1-linux-glibc-arm64` is using one. zzzz --- .../licenses/third_party/zlib_license.txt | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 kotlin-native/licenses/third_party/zlib_license.txt diff --git a/kotlin-native/licenses/third_party/zlib_license.txt b/kotlin-native/licenses/third_party/zlib_license.txt new file mode 100644 index 00000000000..3de69aefca8 --- /dev/null +++ b/kotlin-native/licenses/third_party/zlib_license.txt @@ -0,0 +1,23 @@ +zlib.h -- interface of the 'zlib' general purpose compression library + version 1.2.11, January 15th, 2017 + + Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu \ No newline at end of file From d8caa2a8b0bebcb745054bbf442ffea51f3abc54 Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Mon, 30 Nov 2020 07:54:22 +0100 Subject: [PATCH 639/698] [kotlin compiler][update] 1.4.30-dev-3308 * 0634351fbcb - (HEAD -> master, tag: build-1.4.30-dev-3308, origin/master, origin/HEAD) Introduce pathString/absolute/absolutePathString (vor 18 Stunden) * 84f5a294f77 - Allow passing null parent directory to createTempFile/Directory (vor 18 Stunden) * 64d85f259c0 - Relax writeText/appendText parameter type to CharSequence (vor 18 Stunden) * 2ee8bf7dde1 - (tag: build-1.4.30-dev-3302, origin/rr/demiurg906/platform-switch) Add fastutil dependency for 202 and higher platforms (vor 2 Tagen) * f668e906cc2 - Build: unmute passed tests (vor 2 Tagen) * e7d305b97ab - Build: mute failing stepping tests (vor 2 Tagen) * 78c786de46e - Build: Mute failing goto declaration tests (vor 2 Tagen) * 33b545aea78 - Build: Mute failing gradle import with android tests (vor 2 Tagen) * 85c59328c7e - [DEBUGGER] Temporary mute AbstractKotlinEvaluateExpressionTest (vor 2 Tagen) * 3d33ea7da8e - Use absolute paths to locate existed projects to open in AbstractConfigureKotlinTest (vor 2 Tagen) * 124888eb438 - Revert back AddFunctionParametersFix test data output for 201- (vor 2 Tagen) * e251a9be14a - Build: fix finding layout-api jar in parcelize box test due to platform change (vor 2 Tagen) * cc1a0bf6d75 - [FE] Update testdata (vor 2 Tagen) * 17e6e88176c - Fixed AddFunctionParametersFix test data output (vor 2 Tagen) * 406e863a73e - [FE] Fix creating location of compiler errors in CLI (vor 2 Tagen) * dc364b8be48 - Remove useless @author comment (vor 2 Tagen) * 95e5ea48406 - temporary ignore/disable tests (vor 2 Tagen) * 02f71a63b8f - [FE] Disable `SKIP_DEBUG` flag when building java model from binaries (vor 2 Tagen) * bf1abed2467 - Build: add shadowing processor for core.xml in embeddable compiler (vor 2 Tagen) * ad953b6285a - Build: remove redundant bunch TODO's (vor 2 Tagen) * 986ab9cb548 - Build: remove useless .as40 files (vor 2 Tagen) * 1b559fe6761 - Don't set KOTLIN_BUNDLED in unit tests (vor 2 Tagen) * 7396abf5a4b - Build: add fastutil dependency to scripting tests (vor 2 Tagen) * 5ab9710cc5a - Remove `./local` directory from CodeConformanceTest (vor 2 Tagen) * d3ef0eb5193 - Build: register missing TreeAspect service in KtParsingTestCase (vor 2 Tagen) * 68719831ee1 - Build: update asm version in kotlinp (vor 2 Tagen) * dc35a130086 - Build: remove useless bunch files (vor 2 Tagen) * 46fcc7d59df - Build: fix registration of `ClassFileDecompilers` extension (vor 2 Tagen) * 48cbb74a017 - Build: drop deprecated extension point used in test of old j2k (vor 2 Tagen) * d887814cc52 - Build: fix compilation of :libraries:tools:kotlin-maven-plugin-test (vor 2 Tagen) * 4779092ba5d - Build: fix API differences between 201 and 202 in idea performance tests (vor 2 Tagen) * 2a053c214d7 - Build: fix API differences between 201 and 202 in scratch tests (vor 2 Tagen) * d50d56f68c3 - Build: fix API differences between 201 and 202 in NewKotlinFileAction (vor 2 Tagen) * e4e28a54953 - Build: update grovy dependencies in :compiler:tests-spec (vor 2 Tagen) * 07dd9179e8c - Build: change 202 platform version (vor 2 Tagen) * eeb9b3214c2 - Switch to 202 platform (vor 2 Tagen) * 89bba936156 - (tag: build-1.4.30-dev-3300) Introduce GetScriptingClassByClassLoader interface (vor 2 Tagen) * 65ce7cd0c20 - Fix path for Windows in Fibonacci test (vor 2 Tagen) * 78e607c6b0d - (tag: build-1.4.30-dev-3294) Value classes: Support @JvmName annotation on functions with inline (vor 2 Tagen) * 871912f257d - (tag: build-1.4.30-dev-3289) Value Classes: Increase BINARY_STUB_VERSION after decompiler changes (vor 2 Tagen) * 05c4dfef3d0 - Value classes: Use 'value' keyword instead of 'inline' in stub dumps (vor 2 Tagen) * 9b9c43b7028 - Value classes: Change relevant diagnostic to say 'value class' (vor 2 Tagen) * ca3e7cf1a72 - Value classes: Report lacking @JvmInline only on JVM backend (vor 2 Tagen) * 92f1681de0e - Value classes: treat @JvmInline value classes as inline classes (vor 2 Tagen) * 6c68660ffd1 - Value classes: Render 'value' before class (vor 2 Tagen) * f158411f9a2 - Value classes: Increase JVM metadata version to distinguish (vor 2 Tagen) * 361ed117bb4 - Value classes: Add isValue property to class descriptors (vor 2 Tagen) * 8eff3a6bb33 - Value classes: Increase stub version due to changes in the parser (vor 2 Tagen) * 11b2a07a597 - Value classes: Support 'value' modifier in parser (vor 2 Tagen) * d5979ffdedb - (tag: build-1.4.30-dev-3286) FIR IDE: add tests for checking module invalidation (vor 2 Tagen) * 2fb4a917f69 - FIR IDE: fix module invalidation algorithm (vor 2 Tagen) * 519f1549f0a - FIR IDE: separate logic of TestProjectStructure from AbstractFirMultiModuleLazyResolveTest (vor 2 Tagen) * 3515cd546d4 - FIR IDE: use PersistentMap to store FromModuleViewSessionCache mappings (vor 2 Tagen) * 76c0dc7dba6 - (tag: build-1.4.30-dev-3278) FIR IDE: add property support for incremental analysis (vor 3 Tagen) * 953dba808b7 - FIR IDE: move withFirDeclaration to LowLevelFirApiFacade (vor 3 Tagen) * b4d63b9b139 - FIR IDE: add docs for LowLevelFirApiFacade functions (vor 3 Tagen) * 93648e6cd3d - FIR IDE: use mor specific exception in EntityWasGarbageCollectedException (vor 3 Tagen) * 65a7ee50124 - FIR IDE: remove duplicating withFirResolvedToBodyResolve (vor 3 Tagen) * 3141fead0d7 - FIR IDE: get rid of LowLevelFirApiFacade object (vor 3 Tagen) * a206eca1642 - (tag: build-1.4.30-dev-3272) JVM_IR KT-43611 report signature clash on private interface members (vor 3 Tagen) * fd935b7c54d - (tag: build-1.4.30-dev-3270) [TEST] Move generated js compiler tests to `test-gen` directories (vor 3 Tagen) * 77ed51b3ab7 - (tag: build-1.4.30-dev-3266) [JS IR] Add message for for enabling option for overwriting reachable nodes (vor 3 Tagen) * 908732b3c1e - (tag: build-1.4.30-dev-3257, tag: build-1.4.30-dev-3254) [TEST] Move generated visualizer tests to `test-gen` directories (vor 3 Tagen) * eca769f8e44 - [TEST] Move generated fir tests to `test-gen` directories (vor 3 Tagen) * 1ee38286a85 - [TEST] Move generated compiler tests to `test-gen` directory (vor 3 Tagen) * 524419a2fe4 - (tag: build-1.4.30-dev-3240) IC Mangling: Use new mangling scheme for range tests (vor 3 Tagen) * 6381d97aabd - JVM_IR: compute classId on IR structures (vor 3 Tagen) * ee1e05fedd9 - (tag: build-1.4.30-dev-3225) KT-42151 fix type arguments in local class constructor reference types (vor 4 Tagen) * b2b8562f923 - (tag: build-1.4.30-dev-3221) Properly extract JVM version in kapt (vor 4 Tagen) * 9ed5b8f870e - (tag: build-1.4.30-dev-3220) IC & Coroutines: Do not box suspend operator fun invoke receiver (vor 4 Tagen) * 4e334217a8e - IC & Coroutines: Unbox inline class parameter of suspend lambda (vor 4 Tagen) * eba260f6813 - IC & Coroutines: Unbox inline classes of suspend lambdas (vor 4 Tagen) * 0a0b5b5d2be - (tag: build-1.4.30-dev-3218) [FIR DFA] Don't consider anonymous object as stable initializer to bind (vor 4 Tagen) * 1dc897346ca - [FIR] Fix WRONG_IMPLIES_CONDITION problem in DFA model (vor 4 Tagen) * 7fd96f5773e - (tag: build-1.4.30-dev-3211) Fix annotation spelling in docs (vor 4 Tagen) * db9f301eed9 - [FE] Make DiagnosticFactory.name not null (vor 4 Tagen) * 94ce56bfdc4 - (tag: build-1.4.30-dev-3199, tag: build-1.4.30-dev-3189, origin/master-for-ide) Minor. Add words to project dictionary (vor 4 Tagen) * c7412844583 - [Commonizer] Stricter processing of forward declarations (vor 4 Tagen) * eca231a01d5 - [Commonizer] Extract CIR classifiers cache from the root node (vor 4 Tagen) * 8d9abed3dcc - [Commonizer] Minor. More specific upper bounds for CirNodeWithClassId (vor 4 Tagen) * d4b0bf4ad89 - (tag: build-1.4.30-dev-3184) [FIR] Make DEFAULT positioning strategy public, drop duplicated one (vor 4 Tagen) * 97c1a3f270d - Simplify FirSupertypeInitializedWithoutPrimaryConstructor checker (vor 4 Tagen) * bf2b318beec - Simplify FirSupertypeInitializedInInterfaceChecker (vor 4 Tagen) * 12726cd366d - FIR light builder: use type reference node as FirTypeRef source (vor 4 Tagen) * d5f17ea41c2 - Simplify FirDelegationInInterfaceChecker (vor 4 Tagen) * b673996586a - Simplify source operations in FirAnnotationArgumentChecker (vor 4 Tagen) * 1c71e64f58a - [FIR] Create string interpolating call even for single argument (vor 4 Tagen) * 915a66f4fa4 - [FIR] Introduce & use "multiplexing" SourceElementPositioningStrategy (vor 4 Tagen) * f3334b03c4f - FIR checkers: simplify FirSupertypeInitializedWithoutPrimaryConstructor (vor 4 Tagen) * 58301d8820f - FIR exposed visibility checkers: use positioning strategy (vor 4 Tagen) * f095a33970a - FIR checkers: extract getChildren(), simplify findSuperTypeDelegation() (vor 4 Tagen) * 1e3621a896b - FIR checkers: simplify hasPrimaryConstructor by source element check (vor 4 Tagen) * 0838ab7fe72 - FIR checkers: simplify hasVal / hasVar source element checks (vor 4 Tagen) * c6b703b5985 - Simplify LighterASTNode.toFirLightSourceElement (vor 4 Tagen) * 037c5050695 - Unbind general FirDiagnostic from PsiFile & PsiElement (vor 4 Tagen) * 68b748e1645 - Rename DebugInfoUtil.java to DebugInfoUtil.kt, same with AnalyzingUtils (vor 4 Tagen) * 6f8947dd048 - Extract UnboundDiagnostic, DiagnosticFactory/Renderer to frontend-common (vor 4 Tagen) * 52a07e31c7e - [FIR] Remove D_I_EXPRESSION_TYPE from qualified calls in spec test data (vor 4 Tagen) * 558ac1678ec - Create FIR fake source element for checked safe call subject (vor 4 Tagen) * 2592eed0e7f - [FIR TEST] More precise control of source kind in createDebugInfo (vor 4 Tagen) * 82c5cefba90 - Update test data in FIR diagnostic spec tests (vor 4 Tagen) * e7e162c7eb6 - [FIR TEST] Filter some particular tokens during createDebugInfo (vor 4 Tagen) * c602ccb33ef - Create FIR fake source element for vararg argument expression (vor 4 Tagen) * fa3f8055738 - Support FirDiagnostic.isValid properly (vor 4 Tagen) * c7ae176ae43 - [FIR] Inherit FIR with parameter renderer from the old parameter renderer (vor 4 Tagen) * 3dec848c037 - [FIR] Implement light tree DECLARATION_NAME & SIGNATURE strategies (vor 4 Tagen) * 42c59f7383c - [FIR] Enhance light tree DEFAULT strategy for objects to cover header only (vor 4 Tagen) * d844b33b1c5 - [FIR] Implement light tree CONSTRUCTOR_DELEGATION_CALL strategy (vor 4 Tagen) * 8320a2966ac - [FIR] Implement light tree VAL_VAR strategy as an example (vor 4 Tagen) * 1795c4f3e57 - Implement common Diagnostic(Factory/Renderer) in related FIR classes (vor 4 Tagen) * d47e16331c1 - Convert DiagnosticFactory.java to Kotlin (vor 4 Tagen) * 84f3a4ba9d7 - Rename DiagnosticFactory.java to DiagnosticFactory.kt (vor 4 Tagen) * 9040999b55a - Convert Diagnostic.java to Kotlin (vor 4 Tagen) * b6cfcc6cada - Rename Diagnostic.java to Diagnostic.kt (vor 4 Tagen) * d942780c14f - [FIR] Introduce LightTreePositioningStrategy (vor 4 Tagen) * 1cb2aeaeff1 - FirSourceElement: introduce common 'treeStructure' property (vor 4 Tagen) * 3a2b15521b9 - FirSourceElement: introduce common 'lighterASTNode' property (vor 4 Tagen) * 6abd6561168 - (tag: build-1.4.30-dev-3169) [IR] dumpKotlinLike: update testdata after rebase (vor 5 Tagen) * 0d5a0b207e1 - [IR] KotlinLikeDumper: add a note about some conventions used for TODO comments (vor 5 Tagen) * c0042695473 - [IR] KotlinLikeDumper: unify and add more comments for the cases when used a syntax which is invalid in Kotlin (vor 5 Tagen) * 5a755054f8d - [IR] dumpKotlinLike: add a comment about some conventions which could be unclear (vor 5 Tagen) * 69f0f4ef190 - [IR] update testdata: unify printing custom/non-standard modifiers (vor 5 Tagen) * 90fdfbde68d - [IR] KotlinLikeDumper: unify printing custom/non-standard modifiers (vor 5 Tagen) * 57cb8f97e99 - [IR] update testdata: don't use "D" suffix on double constants (vor 5 Tagen) * 73771a35134 - [IR] KotlinLikeDumper: don't use "D" suffix on double constants (vor 5 Tagen) * 7df6575a183 - [IR] update testdata: unify representation for error nodes (vor 5 Tagen) * ef9a9016355 - [IR] KotlinLikeDumper: unify representation for error nodes (vor 5 Tagen) * f8690d0395c - [IR] KotlinLikeDumper: minor, collapse an `if` to helper function and add few more todos (vor 5 Tagen) * c68040753d9 - [IR] dumpKotlinLike: add testdata for FIR tests (vor 5 Tagen) * d7bd4240e1a - [IR] dumpKotlinLike: don't crash when type argument is null (vor 5 Tagen) * dec067af8cb - [IR] stop overwriting testdata for dumpKotlinLike and use assertEqualsToFile (vor 5 Tagen) * 43ee50b91d4 - [IR] update testdata after rebase (vor 5 Tagen) * 2773e4baca0 - [IR] KotlinLikeDumper.kt -> dumpKotlinLike.kt (vor 5 Tagen) * 36591ba5f73 - [IR] KotlinLikeDumper: replace all usages of commentBlockH with commentBlock (vor 5 Tagen) * ad0f154ed1f - [IR] add new testdata after rebase (vor 5 Tagen) * f9fe82e735d - [IR] KotlinLikeDumper: process specially when IrElseBranch's condition is not `true` constant (vor 5 Tagen) * 503370c9c2f - [IR] update testdata: escape special symbols in Char and String constant values (vor 5 Tagen) * 0f10b5eb9e4 - [IR] KotlinLikeDumper: escape special symbols in Char and String constant values (vor 5 Tagen) * 92dda5cd92e - [IR] KotlinLikeDumper.kt: cleanup (vor 5 Tagen) * 5b0efe2b64c - [IR] KotlinLikeDumper: rearrange methods (vor 5 Tagen) * d9dbc01c3ec - [IR] KotlinLikeDumper: `p.print("")` -> `p.printIndent()` (vor 5 Tagen) * c7d9b7adbe9 - [IR] KotlinLikeDumper: rearrange methods (vor 5 Tagen) * 76e959ef8c6 - [IR] KotlinLikeDumper: minor, update some comments (vor 5 Tagen) * e94528fe0d6 - [IR] update testdata: print class name for callable references without receivers (vor 5 Tagen) * b6e37c1f89d - [IR] KotlinLikeDumper: print class name for callable references without receivers (vor 5 Tagen) * 2dbd784a6a8 - [IR] update testdata: print `else -> ...` (vor 5 Tagen) * 14dabed85a5 - [IR] KotlinLikeDumper.kt: move branch support to corresponding visit* methods (vor 5 Tagen) * 8f155c23a0c - [IR] update testdata: better support for callable references (vor 5 Tagen) * 0d3d61862ba - [IR] KotlinLikeDumper: better support for callable references (vor 5 Tagen) * 87eb06a21f1 - [IR] update testdata: improve annotations rendering in case when argument was not provided and there is default value (vor 5 Tagen) * a34a311e86b - [IR] update testdata: support annotations on parameters (vor 5 Tagen) * 182cb52bdba - [IR] KotlinLikeDumper: various changes for value and type params (vor 5 Tagen) * 5cb2572c60d - [IR] update testdata: better support for enum and object accesses (vor 5 Tagen) * 1fd12b7b8a2 - [IR] KotlinLikeDumper: better support for enum and object accesses (vor 5 Tagen) * 635cb44bf37 - [IR] update testdata: support IrDynamic* nodes (vor 5 Tagen) * 82839e6a671 - [IR] KotlinLikeDumper: support IrDynamic* nodes (vor 5 Tagen) * cdc74304c7e - [IR] add testdata for irJsText (vor 5 Tagen) * 68b17fe55b0 - [IR] KotlinLikeDumper: add more visit* to implement (vor 5 Tagen) * 4fb762e019c - [IR] update testdata: minor updates for error nodes (vor 5 Tagen) * b129788823b - [IR] KotlinLikeDumper: minor updates for error nodes (vor 5 Tagen) * a128cdc99c0 - [IR] KotlinLikeDumper: add more TODOs and remove some obsolete ones (vor 5 Tagen) * bf207205902 - [IR] KotlinLikeDumper: reformat (vor 5 Tagen) * ad5df79e396 - [IR] KotlinLikeDumper: merge Break & Continue (vor 5 Tagen) * 64b42401a1d - [IR] update testdata: print a parameter in catch (vor 5 Tagen) * 2775c89ebb8 - [IR] KotlinLikeDumper: print a parameter in catch (vor 5 Tagen) * 5c8a93c7ff5 - [IR] update testdata: support labels on loops, break & continue (vor 5 Tagen) * 9daa86c1a2c - [IR] KotlinLikeDumper: support labels on loops, break & continue (vor 5 Tagen) * 21da2b0350a - [IR] update testdata: print whole string concatenation at one line (vor 5 Tagen) * 91c9d9d25c6 - [IR] KotlinLikeDumper: print whole string concatenation at one line (vor 5 Tagen) * a6b408978f5 - [IR] update testdata: super and receiver for field accesses (vor 5 Tagen) * 029ee6f2e79 - [IR] KotlinLikeDumper: super and receiver on field accesses (vor 5 Tagen) * 0bf587ad4b5 - [IR] KotlinLikeDumper: deduplicate code between IrDelegatingConstructorCall and IrEnumConstructorCall (vor 5 Tagen) * e56787c0b00 - [IR] update testdata: IrInstanceInitializerCall (vor 5 Tagen) * 26dd0097136 - [IR] KotlinLikeDumper: change rendering for IrInstanceInitializerCall (vor 5 Tagen) * ab8188b032a - [IR] update testdata: removed extra indentation for function expressions (vor 5 Tagen) * cf5ba824539 - [IR] KotlinLikeDumper: don't indent function expressions (vor 5 Tagen) * 5500b014f53 - [IR] update testdata: better support for IrEnumConstructorCall and IrEnumEntry (vor 5 Tagen) * 602f0ddbc86 - [IR] update testdata after using maxBlankLines=1 for Printer (vor 5 Tagen) * 6e318893f65 - [IR] KotlinLikeDumper: support for IrEnumConstructorCall and better rendering for IrEnumEntry (vor 5 Tagen) * b518c19b385 - [IR] update testdata: support for IrDelegatingConstructorCall (vor 5 Tagen) * 84d6e435907 - [IR] update testdata: print arguments for annotations (vor 5 Tagen) * 2a19dc32f29 - [IR] update testdata: better support for IrConstructorCall (vor 5 Tagen) * 197f5ca885a - [IR] update testdata: better support for IrCall (vor 5 Tagen) * ef2adfa835d - [IR] KotlinLikeDumper: better support for calls and annotations (vor 5 Tagen) * fc5c674c609 - [IR] update testdata (vor 5 Tagen) * 6a1ab1b325e - [IR] KotlinLikeDumper: WIP (vor 5 Tagen) * 0294ff4f106 - [IR] add TODO to RenderIrElement (vor 5 Tagen) * a5b224fda18 - [IR] add new testdata after rebase (vor 5 Tagen) * 3b1a6389ab2 - [IR] update testdata after rebase (vor 5 Tagen) * 1c6c996084a - [IR] KotlinLikeDumper: fixes after rebase (vor 5 Tagen) * 7abd09ce96c - [IR] initial version of dumpKotlinLike (vor 5 Tagen) * 8d5facb15f5 - [IR] add testdata for dumpKotlinLike (vor 5 Tagen) * d2022ab115f - [IR] hack AbstractIrTextTestCase to test dumpKotlinLike (vor 5 Tagen) * 6241f9be2db - (tag: build-1.4.30-dev-3165) Build: Fix ide plugin maven artifacts publication (vor 5 Tagen) * 8f187f328ad - (tag: build-1.4.30-dev-3162) Switch ASM artifact (vor 5 Tagen) * b5143ba2ab3 - (tag: build-1.4.30-dev-3161) Optimize check for missing fields in deserialization (#3862) (vor 5 Tagen) * f9503efb74a - (tag: build-1.4.30-dev-3159) [JS IR] Make WITH_RUNTIME imply KJS_WITH_FULL_RUNTIME (vor 5 Tagen) * b0ebb02b6fe - (tag: build-1.4.30-dev-3158) Fix more deprecated configurations and disable fail mode for some tests (vor 5 Tagen) * 858f73124dd - Update settings script properly, more tests with warning-mode=fail (vor 5 Tagen) * 52c22d891f9 - MPP plugin: add expectedBy deps to "api" configuration (vor 5 Tagen) * 4bf63a95395 - Sort class members to ensure deterministic builds (vor 5 Tagen) * 07a797cc3a7 - (tag: build-1.4.30-dev-3155) [IR] Fixed bug with type parameters of referenced constructor (vor 5 Tagen) * c90546104e5 - (tag: build-1.4.30-dev-3149) Uast: partial fix for reified functions resolve (#3923, KT-41279) (vor 5 Tagen) * 7cc6204d6bf - (tag: build-1.4.30-dev-3144) Minor: update testData (vor 5 Tagen) * e5dce9f994c - KT-42933 inline class backing field can't be static (vor 5 Tagen) * f6abc5c3cf2 - KT-43286 use JVM 1.8 intrinsics for coercible unsigned values only (vor 5 Tagen) * 498047e64e8 - KT-43562 don't remap static inline class funs as special builtins (vor 5 Tagen) * f6c73720895 - (tag: build-1.4.30-dev-3141) Fix serializing properties with custom accessors (#3907) (vor 5 Tagen) * 7327c202006 - (tag: build-1.4.30-dev-3140) FIR: add a resolution mode for property delegates (vor 5 Tagen) * 0a5b899aab5 - FIR: more comprehensive substitution of stub types after builder inference (vor 5 Tagen) * 30c97e6cb46 - FIR: update unsubstituted return types in builder (vor 5 Tagen) * d58e5b1d95a - Remove unnecessary semi-colons (vor 5 Tagen) * a0dd62f8c58 - Remove unnecessary expression (vor 5 Tagen) * dfc5059d6b0 - FIR: reproduce KT-43340 (vor 5 Tagen) * c13650fd791 - (tag: build-1.4.30-dev-3131) KT-43511 [Gradle Runner]: run task is not created for top level modules (vor 5 Tagen) * 25a631a1ca8 - (tag: build-1.4.30-dev-3125) Improved IDE performance tests vega specs (vor 5 Tagen) * dcdd69d039b - (tag: build-1.4.30-dev-3123) Invalidate caches before resolve in AbstractPerformanceHighlightingTest (vor 5 Tagen) * 04846ca47a3 - (tag: build-1.4.30-dev-3122) Rework checking constraints by presented `OnlyInputTypes` annotation in accordance with changed incorporation mechanism (vor 5 Tagen) * 0857b9c9e75 - Rethink constraints incorporation (vor 5 Tagen) * 616e40f8799 - Reuse equality constraints during simplification in adding constraints (vor 5 Tagen) * aabe7090790 - (tag: build-1.4.30-dev-3116) Value classes: Add @JvmInline annotation to stdlib (vor 5 Tagen) * a7100134a0b - (tag: build-1.4.30-dev-3111) Don't mark testJsTestOutputFileInProjectWithAndroid as flaky in 202 (vor 6 Tagen) * ee40b3a4a4b - (tag: build-1.4.30-dev-3109) Drop redundant fields around AbstractFir2IrLazyFunction (vor 6 Tagen) * fda5ee7d06e - Fir2IrLazyPropertyAccessor: make inline iff FIR accessor is inline (vor 6 Tagen) * d27a0c91f67 - Extract AbstractFir2IrLazyFunction (base for accessor & simple function) (vor 6 Tagen) * c03fa59a63f - Introduce Fir2IrLazyPropertyAccessor (vor 6 Tagen) * 71179326237 - JVM IR: handle JvmStatic in object as module phase (vor 6 Tagen) * 0a00cbefaf7 - JVM IR: minor, refactor replaceThisByStaticReference (vor 6 Tagen) * ebb545a9fbf - (tag: build-1.4.30-dev-3106) Split ChangeLog file to files by major releases (vor 6 Tagen) * 71d3d8bffc1 - Add ChangeLog for 1.4.20 (vor 6 Tagen) * b1c355e7eb9 - Directly search in IrClass for declarations to fill bodies with plugin (vor 6 Tagen) * 5efefabb93b - (tag: build-1.4.30-dev-3102) [JS IR] webpackConfigAppliers as internal to not break Gradle lambda serialization in some cases (vor 6 Tagen) * 42a9d64578a - (tag: build-1.4.30-dev-3098) Track binary output class names (vor 6 Tagen) * 6748560184f - Proper support of aggregated processors (vor 6 Tagen) * f382a55b17b - (tag: build-1.4.30-dev-3095) [JS IR] Add EXPECTED_REACHABLE_NODES for JS tests of external tail args (vor 6 Tagen) * 176071b7db8 - Add support of nullable serializers to UseSerializers annotation (#3906) (vor 6 Tagen) * 6c7247cbd35 - (tag: build-1.4.30-dev-3092) syncKotlinAndAndroidSourceSets: Don't register Kotlin source dirs in Android java source dirs (vor 6 Tagen) * 2286498d8d9 - Share defaultSourceFolder logic between syncKotlinAndAndroidSourceSets.kt and KotlinSourceSetFactory.kt (vor 6 Tagen) * 7c7eada452d - Add comment about unsupported associate compilations to functionalTest source files (vor 6 Tagen) * 3f98e2974ce - Expand AndroidSourceSet#kotlinSourceSet to AndroidSourceSet#kotlinSourceSetOrNull (vor 6 Tagen) * 3e5cbf324de - syncKotlinAndAndroidSourceSets.kt: Cover flavors with tests (vor 6 Tagen) * cdfbbca5807 - Also register `shaders` for kotlin source sets (vor 6 Tagen) * 2c325c45e29 - Register Kotlin MPP source sets in AGP (vor 6 Tagen) * 3a166f35926 - (tag: build-1.4.30-dev-3088) KT-43525 forbid @JvmOverloads on mangled funs and hidden constructors (vor 6 Tagen) * ca78261d7f4 - (tag: build-1.4.30-dev-3080) Minor, fix "unknown -Xstring-concat mode" error message (vor 6 Tagen) * ed481add084 - Fix performance regression in KotlinSuppressCache.isSuppressedByAnnotated (vor 6 Tagen) * efee3ea6485 - (tag: build-1.4.30-dev-3076) [JS IR] - Remove file lowering declarations from lowering phases (vor 6 Tagen) * 1b5ebd83de9 - [JS IR] Lazy initialisation is optional for tests (vor 6 Tagen) * a2d41b86bf5 - [JS IR] Add compiler argument about lazy initialisation (vor 6 Tagen) * fcb3ee5e45b - [JS IR]Add check on pureness to not calculate fields to expression twice (vor 6 Tagen) * aa0f9dc1e20 - [JS IR] Don't target exact wasm backend (vor 6 Tagen) * c224394dfce - [JS IR] Return with createdOn hack (vor 6 Tagen) * 8b4d42e70a1 - [JS IR] Add initialisation call for functions in method (vor 6 Tagen) * 06b276f9c30 - [JS IR] Migrate on body lowering pass and declaration transformer (vor 6 Tagen) * 99d07402344 - [JS IR] Ignore JS_IR backend in top level side effect properties (vor 6 Tagen) * d6bc309c940 - [JS IR] Eager initialisation for all pure properties (vor 6 Tagen) * 3da9761f379 - [JS IR] Add test on lazy initialisation (vor 6 Tagen) * f4c1e523388 - [JS IR] Continuation parameter in main through accessor (vor 6 Tagen) * 34ee146148b - [JS IR] Internal visibility for init fun (vor 6 Tagen) * 07b6ef65a3f - [JS IR] Init delegated properties as usual (vor 6 Tagen) * 841118a64d4 - [JS IR] Add init properties call to top level functions (vor 6 Tagen) * 5746a7c4fc8 - [JS IR] Only consider top level properties (vor 6 Tagen) * 0dc4f51d744 - [JS IR] Add init function call into first step of property accessor (vor 6 Tagen) * 71bfed32532 - [JS IR] From searcher get only properties, mutate in lowering (vor 6 Tagen) * 42e1a3280bd - [JS IR] Add guard into init properties function (vor 6 Tagen) * d752b7439e4 - [JS IR] Add init function for properties (vor 6 Tagen) * 003ea4bcdf6 - (tag: build-1.4.30-dev-3070) [Gradle, MPP] Make metadata jar task cc-compatible with warnings (vor 6 Tagen) * 3282e092d8c - (tag: build-1.4.30-dev-3058) [JS] Don't fail on recursive upper bounds while resolving JsExports (vor 7 Tagen) * f9a032dbfac - (tag: build-1.4.30-dev-3053) FIR2IR: add AnnotationGenerator to Fir2IrComponents (vor 7 Tagen) * eff4cec3e08 - FIR2IR: convert annotations on delegated members (vor 7 Tagen) * d9800746242 - FIR: deserialize the `fun interface` flag (vor 7 Tagen) * 20c7c4881d3 - FIR: fix @JvmPackageName (vor 7 Tagen) * 2d4e9af2893 - (tag: build-1.4.30-dev-3046) [JS IR] Throw exception if test class or test method has explicit parameter (vor 7 Tagen) * c4a8d1c3a19 - (tag: build-1.4.30-dev-3044) FIR: use java functional interface as a source of sam function call (vor 7 Tagen) * 7b1eef136ee - FIR IDE: introduce KtFirCollectionLiteralReference (vor 7 Tagen) * bac5ebcb120 - FIR IDE: use custom thread local value for storing KtFirScopeProvider (vor 7 Tagen) * b31def0bae3 - FIR IDE: invalidate analysis session on project roots change (vor 7 Tagen) * be95d067f36 - FIR IDE: add KotlinOutOfBlockPsiTreeChangePreprocessor (vor 7 Tagen) * 7a86ca632d8 - FIR IDE: fix collecting diagnostics for anonymous object declaration (vor 7 Tagen) * 7061608567e - FIR IDE: introduce common function to mute tests (vor 7 Tagen) * e4d2e38ea20 - FIR IDE: fix reference resolving of qualified expression with nested classes (vor 7 Tagen) * 164f4d14d71 - FIR IDE: do not collect diagnostics for generated declarations (vor 7 Tagen) * 60cc30286ca - FIR IDE: update file structure testdata after structure elements classes rename (vor 7 Tagen) * 75990f7619c - FIR IDE: fix tesdata (vor 7 Tagen) * 73206202857 - FIR IDE: add local visibility to symbols (vor 7 Tagen) * 5fdcc4bb83d - FIR IDE: refactor KotlinFirModificationTrackerService (vor 7 Tagen) * 112f6771eb2 - FIR IDE: fix compilation (vor 7 Tagen) * 65b5e4b62be - FIR IDE: make some session components to be non-thread local (vor 7 Tagen) * c3caa3a137f - FIR IDE: clean AbstractFirReferenceResolveTest (vor 7 Tagen) * 3174eb4b097 - FIR IDE: do not get ktDeclaration for FirFile (vor 7 Tagen) * ff7857a8123 - FIR IDE: refactor, simplify structure element class names (vor 7 Tagen) * 15277c09749 - FIR IDE: introduce memory leak checking in symbols test (vor 7 Tagen) * 11e94c1de1c - FIR IDE: fix building of local declaration symbols (vor 7 Tagen) * e78e26234bd - FIR IDE: do not store cone session in every KtFirType (vor 7 Tagen) * e54d16e7e44 - FIR IDE: fix fir declaration leak in symbols (vor 7 Tagen) * b01ee163d11 - FIR IDE: wrap KotlinDeserializedJvmSymbolsProvider into thread safe cache (vor 7 Tagen) * 911662bc2f6 - FIR IDE: introduce out of block modification tracker tests (vor 7 Tagen) * da7b12f7e10 - FIR IDE: introduce ProjectWideOutOfBlockKotlinModificationTrackerTest (vor 7 Tagen) * 880e76b203e - FIR IDE: introduce FIR IDE specific out of block modification tracker (vor 7 Tagen) * 6c1faec1716 - FIR IDE: introduce file structure tests (vor 7 Tagen) * 7c912cd3e46 - FIR IDE: introduce FileElementFactory (vor 7 Tagen) * 315629c99be - FIR IDE: refactor lock provider (vor 7 Tagen) * 559b07d78aa - FIR IDE: fix memory leak in scope provider (vor 7 Tagen) * 64895fe7da1 - (tag: build-1.4.30-dev-3035) [JS IR] Test with js specific moved to `js.translator` (vor 7 Tagen) * fe3030c4329 - [JS IR] Drop last null arguments in calls of external functions (vor 7 Tagen) * 5c731c6c04c - [JS IR] Add test in external js fun with default args (vor 7 Tagen) * 8eb2ae18dcb - (tag: build-1.4.30-dev-3030) FIR checker: refactor EventOccurrencesRange accumulation (vor 7 Tagen) * b9d3578a866 - FIR checker: refactor ControlFlowInfos whose key is EdgeLabel (vor 7 Tagen) * b6a4c279a4a - FIR checker: refactor ControlFlowInfos whose value is EventOccurrencesRange (vor 7 Tagen) * cf8f5b0912e - FIR checker: make calls effect analyzer path-sensitive (vor 7 Tagen) * 26626795796 - (tag: build-1.4.30-dev-3022) KT-43399 properly erase extension receiver type in property$annotations (vor 7 Tagen) * 551d0c1b64e - JVM_IR KT-43440 private-to-this default interface funs are private (vor 7 Tagen) * bf7fdcda6e6 - KT-42909 fix missing loop variable in 'withIndex' ranges (vor 7 Tagen) * a9c9406a554 - [Gradle, K/N] Set LIBCLANG_DISABLE_CRASH_RECOVERY=1 for cinterop (vor 7 Tagen) * 37197a95cdf - Update ReadMe.md (vor 7 Tagen) * 18612c1ef08 - (tag: build-1.4.30-dev-3019) [JVM+IR] Rebase LVT test of destructuing in lambda params (vor 7 Tagen) * ccc272c49f4 - (tag: build-1.4.30-dev-3015) KT-43489: KGP - Avoid storing build history mapping in a property (vor 7 Tagen) * 2c28e6556b8 - (tag: build-1.4.30-dev-3012) Add JetBrains to the first part of text (vor 7 Tagen) --- kotlin-native/gradle.properties | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kotlin-native/gradle.properties b/kotlin-native/gradle.properties index 39e067f0e08..a15f8a213d3 100644 --- a/kotlin-native/gradle.properties +++ b/kotlin-native/gradle.properties @@ -18,12 +18,12 @@ buildKotlinVersion=1.4.20-dev-2167 buildKotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:1.4.20-dev-2167,branch:default:any,pinned:true/artifacts/content/maven remoteRoot=konan_tests -kotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:1.4.30-dev-3009,branch:default:any,pinned:true/artifacts/content/maven -kotlinVersion=1.4.30-dev-3009 -kotlinStdlibRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:1.4.30-dev-3009,branch:default:any,pinned:true/artifacts/content/maven -kotlinStdlibVersion=1.4.30-dev-3009 -kotlinStdlibTestsVersion=1.4.30-dev-3009 -testKotlinCompilerVersion=1.4.30-dev-3009 +kotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:1.4.30-dev-3308,branch:default:any,pinned:true/artifacts/content/maven +kotlinVersion=1.4.30-dev-3308 +kotlinStdlibRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:1.4.30-dev-3308,branch:default:any,pinned:true/artifacts/content/maven +kotlinStdlibVersion=1.4.30-dev-3308 +kotlinStdlibTestsVersion=1.4.30-dev-3308 +testKotlinCompilerVersion=1.4.30-dev-3308 konanVersion=1.4.30 # A version of Xcode required to build the Kotlin/Native compiler. From 09ebfc1b6f9d74fdccdf17ebd57321698f02c22c Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Mon, 30 Nov 2020 09:45:12 +0100 Subject: [PATCH 640/698] [gradle plugin] adoption 52c22d891f9a1f940297e15d72cefbdb52db21fe MPP plugin: add expectedBy deps to api configuration --- .../kotlin/gradle/plugin/konan/KotlinNativePlatformPlugin.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/kotlin-native/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/konan/KotlinNativePlatformPlugin.kt b/kotlin-native/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/konan/KotlinNativePlatformPlugin.kt index 1592d3d6df5..cb628f48f18 100644 --- a/kotlin-native/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/konan/KotlinNativePlatformPlugin.kt +++ b/kotlin-native/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/konan/KotlinNativePlatformPlugin.kt @@ -13,8 +13,6 @@ open class KotlinNativePlatformPlugin: KotlinPlatformImplementationPluginBase("n private val Project.konanMultiplatformTasks: Collection get() = tasks.withType(KonanCompileTask::class.java).filter { it.enableMultiplatform } - override fun configurationsForCommonModuleDependency(project: Project) = emptyList() - open class RequestedCommonSourceSet @Inject constructor(private val name: String): Named { override fun getName() = name } From 211c1605584eb13ca6641036d25c34d37b91947c Mon Sep 17 00:00:00 2001 From: Alexander Shabalin Date: Mon, 30 Nov 2020 20:12:18 +0300 Subject: [PATCH 641/698] TLS registry (#4554) --- .../runtime/src/legacymm/cpp/Memory.cpp | 19 +- kotlin-native/runtime/src/mm/cpp/Memory.cpp | 20 ++ kotlin-native/runtime/src/mm/cpp/Stubs.cpp | 16 -- .../runtime/src/mm/cpp/ThreadData.hpp | 4 + .../runtime/src/mm/cpp/ThreadLocalStorage.cpp | 49 +++++ .../runtime/src/mm/cpp/ThreadLocalStorage.hpp | 78 ++++++++ .../src/mm/cpp/ThreadLocalStorageTest.cpp | 175 ++++++++++++++++++ 7 files changed, 338 insertions(+), 23 deletions(-) create mode 100644 kotlin-native/runtime/src/mm/cpp/ThreadLocalStorage.cpp create mode 100644 kotlin-native/runtime/src/mm/cpp/ThreadLocalStorage.hpp create mode 100644 kotlin-native/runtime/src/mm/cpp/ThreadLocalStorageTest.cpp diff --git a/kotlin-native/runtime/src/legacymm/cpp/Memory.cpp b/kotlin-native/runtime/src/legacymm/cpp/Memory.cpp index c7b6c8d6a9d..06dc0838663 100644 --- a/kotlin-native/runtime/src/legacymm/cpp/Memory.cpp +++ b/kotlin-native/runtime/src/legacymm/cpp/Memory.cpp @@ -600,10 +600,10 @@ public: RuntimeAssert(storage_ == nullptr, "Storage must not be committed"); auto it = map_->find(key); if (it != map_->end()) { - RuntimeAssert(it->second.second == size, "Attempt to add TLS record with the same key and different size"); + RuntimeAssert(it->second.size == size, "Attempt to add TLS record with the same key and different size"); return; } - map_->emplace(key, std::make_pair(size_, size)); + map_->emplace(key, Entry{size_, size}); size_ += size; } @@ -629,15 +629,20 @@ public: } auto it = map_->find(key); RuntimeAssert(it != map_->end(), "Must be there"); - int offset = it->second.first; - RuntimeAssert(offset + index < size_, "Out of bound in TLS access"); + auto entry = it->second; + RuntimeAssert(index < entry.size, "Out of bounds in TLS access"); lastKey_ = key; - lastOffset_ = offset; - return storage_ + offset + index; + lastOffset_ = entry.offset; + return storage_ + entry.offset + index; } private: - using Map = KStdUnorderedMap>; + struct Entry { + int offset; + int size; + }; + + using Map = KStdUnorderedMap; Map* map_ = nullptr; KRef* storage_ = nullptr; diff --git a/kotlin-native/runtime/src/mm/cpp/Memory.cpp b/kotlin-native/runtime/src/mm/cpp/Memory.cpp index 849cf94f0f7..9da3c14963f 100644 --- a/kotlin-native/runtime/src/mm/cpp/Memory.cpp +++ b/kotlin-native/runtime/src/mm/cpp/Memory.cpp @@ -31,6 +31,10 @@ ALWAYS_INLINE mm::ThreadRegistry::Node* FromMemoryState(MemoryState* state) { return reinterpret_cast(state); } +ALWAYS_INLINE mm::ThreadData* GetThreadData(MemoryState* state) { + return FromMemoryState(state)->Get(); +} + } // namespace extern "C" MemoryState* InitMemory(bool firstRuntime) { @@ -55,3 +59,19 @@ extern "C" RUNTIME_NOTHROW void InitAndRegisterGlobal(ObjHeader** location, cons mm::GlobalsRegistry::Instance().RegisterStorageForGlobal(threadData, location); RuntimeCheck(false, "Unimplemented"); } + +extern "C" RUNTIME_NOTHROW void AddTLSRecord(MemoryState* memory, void** key, int size) { + GetThreadData(memory)->tls().AddRecord(key, size); +} + +extern "C" RUNTIME_NOTHROW void CommitTLSStorage(MemoryState* memory) { + GetThreadData(memory)->tls().Commit(); +} + +extern "C" RUNTIME_NOTHROW void ClearTLS(MemoryState* memory) { + GetThreadData(memory)->tls().Clear(); +} + +extern "C" RUNTIME_NOTHROW ObjHeader** LookupTLS(void** key, int index) { + return mm::ThreadRegistry::Instance().CurrentThreadData()->tls().Lookup(key, index); +} diff --git a/kotlin-native/runtime/src/mm/cpp/Stubs.cpp b/kotlin-native/runtime/src/mm/cpp/Stubs.cpp index 8a3c8c499ef..fa8b621acca 100644 --- a/kotlin-native/runtime/src/mm/cpp/Stubs.cpp +++ b/kotlin-native/runtime/src/mm/cpp/Stubs.cpp @@ -158,22 +158,6 @@ void EnsureNeverFrozen(ObjHeader* obj) { RuntimeCheck(false, "Unimplemented"); } -RUNTIME_NOTHROW void AddTLSRecord(MemoryState* memory, void** key, int size) { - RuntimeCheck(false, "Unimplemented"); -} - -RUNTIME_NOTHROW void CommitTLSStorage(MemoryState* memory) { - RuntimeCheck(false, "Unimplemented"); -} - -RUNTIME_NOTHROW void ClearTLS(MemoryState* memory) { - RuntimeCheck(false, "Unimplemented"); -} - -RUNTIME_NOTHROW ObjHeader** LookupTLS(void** key, int index) { - RuntimeCheck(false, "Unimplemented"); -} - RUNTIME_NOTHROW void GC_RegisterWorker(void* worker) { RuntimeCheck(false, "Unimplemented"); } diff --git a/kotlin-native/runtime/src/mm/cpp/ThreadData.hpp b/kotlin-native/runtime/src/mm/cpp/ThreadData.hpp index 0b91cae9a06..82a89c3c3f2 100644 --- a/kotlin-native/runtime/src/mm/cpp/ThreadData.hpp +++ b/kotlin-native/runtime/src/mm/cpp/ThreadData.hpp @@ -9,6 +9,7 @@ #include #include "GlobalsRegistry.hpp" +#include "ThreadLocalStorage.hpp" #include "Utils.hpp" namespace kotlin { @@ -31,9 +32,12 @@ public: GlobalsRegistry::ThreadQueue* globalsThreadQueue() noexcept { return &globalsThreadQueue_; } + ThreadLocalStorage& tls() noexcept { return tls_; } + private: const pthread_t threadId_; GlobalsRegistry::ThreadQueue globalsThreadQueue_; + ThreadLocalStorage tls_; }; } // namespace mm diff --git a/kotlin-native/runtime/src/mm/cpp/ThreadLocalStorage.cpp b/kotlin-native/runtime/src/mm/cpp/ThreadLocalStorage.cpp new file mode 100644 index 00000000000..2dacb15ca03 --- /dev/null +++ b/kotlin-native/runtime/src/mm/cpp/ThreadLocalStorage.cpp @@ -0,0 +1,49 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the LICENSE file. + */ + +#include "ThreadLocalStorage.hpp" + +using namespace kotlin; + +void mm::ThreadLocalStorage::AddRecord(Key key, int size) noexcept { + RuntimeAssert(state_ == State::kBuilding, "Storage must be in the building state"); + RuntimeAssert(size >= 0, "Size cannot be negative"); + auto it = map_.find(key); + if (it != map_.end()) { + RuntimeAssert(it->second.size == size, "Attempt to add TLS record with the same key, but different size"); + return; + } + map_.emplace(key, Entry{size_, size}); + size_ += size; +} + +void mm::ThreadLocalStorage::Commit() noexcept { + RuntimeAssert(state_ == State::kBuilding, "Storage must be in the building state"); + storage_.resize(size_); + state_ = State::kCommitted; +} + +void mm::ThreadLocalStorage::Clear() noexcept { + RuntimeAssert(state_ == State::kCommitted, "Storage must be in the committed state"); + // Just free the storage. + storage_.clear(); + state_ = State::kCleared; +} + +ObjHeader** mm::ThreadLocalStorage::Lookup(Key key, int index) noexcept { + RuntimeAssert(state_ == State::kCommitted, "Storage must be in the committed state"); + if (lastKeyAndEntry_.first == key) { + return Lookup(lastKeyAndEntry_.second, index); + } + auto it = map_.find(key); + RuntimeAssert(it != map_.end(), "Unknown TLS key"); + lastKeyAndEntry_ = *it; + return Lookup(it->second, index); +} + +ObjHeader** mm::ThreadLocalStorage::Lookup(Entry entry, int index) noexcept { + RuntimeAssert(index < entry.size, "Out of bounds TLS access"); + return &storage_[entry.offset + index]; +} diff --git a/kotlin-native/runtime/src/mm/cpp/ThreadLocalStorage.hpp b/kotlin-native/runtime/src/mm/cpp/ThreadLocalStorage.hpp new file mode 100644 index 00000000000..40de796846e --- /dev/null +++ b/kotlin-native/runtime/src/mm/cpp/ThreadLocalStorage.hpp @@ -0,0 +1,78 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the LICENSE file. + */ + +#ifndef RUNTIME_MM_THREAD_LOCAL_STORAGE_H +#define RUNTIME_MM_THREAD_LOCAL_STORAGE_H + +#include +#include +#include + +#include "Memory.h" +#include "Utils.hpp" + +namespace kotlin { +namespace mm { + +class ThreadLocalStorage : Pinned { +public: + using Key = void*; + + class Iterator { + public: + explicit Iterator(std::vector::iterator iterator) : iterator_(iterator) {} + + ObjHeader** operator*() noexcept { return &*iterator_; } + + Iterator& operator++() noexcept { + ++iterator_; + return *this; + } + + bool operator==(const Iterator& rhs) const noexcept { return iterator_ == rhs.iterator_; } + bool operator!=(const Iterator& rhs) const noexcept { return iterator_ != rhs.iterator_; } + + private: + std::vector::iterator iterator_; + }; + + // Add TLS record. Can only be called before `Commit`. + void AddRecord(Key key, int size) noexcept; + // Prepare storage for records added by `AddRecord`. + void Commit() noexcept; + // Clear storage. Can only be called after `Commit`. + void Clear() noexcept; + // Lookup value in storage. Can only be called after `Commit`. + ObjHeader** Lookup(Key key, int index) noexcept; + + Iterator begin() noexcept { return Iterator(storage_.begin()); } + Iterator end() noexcept { return Iterator(storage_.end()); } + +private: + enum class State { + kBuilding, + kCommitted, + kCleared, + }; + + struct Entry { + int offset; + int size; + }; + + ObjHeader** Lookup(Entry entry, int index) noexcept; + + std::vector storage_; + // TODO: `std::unordered_map` is probably the wrong container here. + std::unordered_map map_; + State state_ = State::kBuilding; + int size_ = 0; // Only used in `State::kBuilding` + std::pair lastKeyAndEntry_; +}; + +} // namespace mm +} // namespace kotlin + +#endif // RUNTIME_MM_THREAD_LOCAL_STORAGE_H diff --git a/kotlin-native/runtime/src/mm/cpp/ThreadLocalStorageTest.cpp b/kotlin-native/runtime/src/mm/cpp/ThreadLocalStorageTest.cpp new file mode 100644 index 00000000000..f9543a0c3b7 --- /dev/null +++ b/kotlin-native/runtime/src/mm/cpp/ThreadLocalStorageTest.cpp @@ -0,0 +1,175 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the LICENSE file. + */ + +#include "ThreadLocalStorage.hpp" + +#include "gmock/gmock.h" +#include "gtest/gtest.h" + +using namespace kotlin; + +namespace { + +struct Key {}; + +} // namespace + +TEST(ThreadLocalStorageTest, Lookup) { + Key key1; + Key key2; + mm::ThreadLocalStorage tls; + + tls.AddRecord(&key1, 1); + tls.AddRecord(&key2, 2); + tls.Commit(); + + ObjHeader** location1 = tls.Lookup(&key1, 0); + ObjHeader** location2 = tls.Lookup(&key2, 0); + ObjHeader** location3 = tls.Lookup(&key2, 1); + + // Locations are not nulls. + EXPECT_NE(location1, nullptr); + EXPECT_NE(location2, nullptr); + EXPECT_NE(location3, nullptr); + + // All three are different. + EXPECT_NE(location1, location2); + EXPECT_NE(location1, location3); + EXPECT_NE(location2, location3); + + // All three can be written into. + *location1 = nullptr; + *location2 = nullptr; + *location3 = nullptr; +} + +TEST(ThreadLocalStorageTest, Iterate) { + Key key1; + Key key2; + mm::ThreadLocalStorage tls; + + tls.AddRecord(&key1, 1); + tls.AddRecord(&key2, 2); + tls.Commit(); + + std::vector expected; + expected.push_back(tls.Lookup(&key1, 0)); + expected.push_back(tls.Lookup(&key2, 0)); + expected.push_back(tls.Lookup(&key2, 1)); + + std::vector actual; + for (auto item : tls) { + actual.push_back(item); + } + + EXPECT_THAT(actual, testing::ElementsAreArray(expected)); +} + +TEST(ThreadLocalStorageTest, AddRecordEmpty) { + Key key1; + Key key2; + Key key3; + mm::ThreadLocalStorage tls; + + tls.AddRecord(&key1, 1); + tls.AddRecord(&key2, 0); + tls.AddRecord(&key3, 2); + tls.Commit(); + + std::vector expected; + expected.push_back(tls.Lookup(&key1, 0)); + expected.push_back(tls.Lookup(&key3, 0)); + expected.push_back(tls.Lookup(&key3, 1)); + + std::vector actual; + for (auto item : tls) { + actual.push_back(item); + } + + EXPECT_THAT(actual, testing::ElementsAreArray(expected)); +} + +TEST(ThreadLocalStorageTest, AddRecordSameSize) { + Key key1; + mm::ThreadLocalStorage tls; + + tls.AddRecord(&key1, 1); + tls.AddRecord(&key1, 1); + tls.Commit(); + + std::vector expected; + expected.push_back(tls.Lookup(&key1, 0)); + + std::vector actual; + for (auto item : tls) { + actual.push_back(item); + } + + EXPECT_THAT(actual, testing::ElementsAreArray(expected)); +} + +TEST(ThreadLocalStorageTest, NoRecords) { + mm::ThreadLocalStorage tls; + + tls.Commit(); + + std::vector actual; + for (auto item : tls) { + actual.push_back(item); + } + + EXPECT_THAT(actual, testing::IsEmpty()); +} + +TEST(ThreadLocalStorageTest, ClearEmpty) { + mm::ThreadLocalStorage tls; + + tls.Commit(); + + tls.Clear(); + + std::vector actual; + for (auto item : tls) { + actual.push_back(item); + } + + EXPECT_THAT(actual, testing::IsEmpty()); +} + +TEST(ThreadLocalStorageTest, ClearNonEmpty) { + Key key1; + mm::ThreadLocalStorage tls; + + tls.AddRecord(&key1, 1); + tls.Commit(); + + tls.Clear(); + + std::vector actual; + for (auto item : tls) { + actual.push_back(item); + } + + EXPECT_THAT(actual, testing::IsEmpty()); +} + +TEST(ThreadLocalStorageTest, LookupCaching) { + Key key1; + Key key2; + mm::ThreadLocalStorage tls; + + tls.AddRecord(&key1, 1); + tls.AddRecord(&key2, 1); + tls.Commit(); + + ObjHeader** location1 = tls.Lookup(&key1, 0); + ObjHeader** location2 = tls.Lookup(&key2, 0); + + // Lookup same stuff again in different order. + EXPECT_EQ(location1, tls.Lookup(&key1, 0)); + EXPECT_EQ(location2, tls.Lookup(&key2, 0)); + EXPECT_EQ(location2, tls.Lookup(&key2, 0)); + EXPECT_EQ(location1, tls.Lookup(&key1, 0)); +} From e940a1d6bb2427e1c8d5d311700585fd65aa9a3f Mon Sep 17 00:00:00 2001 From: LepilkinaElena Date: Mon, 30 Nov 2020 22:05:21 +0300 Subject: [PATCH 642/698] Fix usages of ArgType.Choice in benchmarks (#4562) --- .../src/videoPlayerMain/kotlin/VideoPlayer.kt | 10 ++++++++-- .../src/main/kotlin/main.kt | 6 +++--- .../kotlin/org/jetbrains/renders/Render.kt | 19 +++++++------------ 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/VideoPlayer.kt b/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/VideoPlayer.kt index 18ae5585d05..7384943787b 100644 --- a/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/VideoPlayer.kt +++ b/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/VideoPlayer.kt @@ -156,11 +156,17 @@ class VideoPlayer(val requestedSize: Dimensions?) : DisposableContainer() { } } +enum class Mode { + VIDEO, + AUDIO, + BOTH +} + fun main(args: Array) { val argParser = ArgParser("videoplayer") val mode by argParser.option( - ArgType.Choice(listOf("video", "audio", "both")), shortName = "m", description = "Play mode") - .default("both") + ArgType.Choice(), shortName = "m", description = "Play mode") + .default(BOTH) val size by argParser.option(ArgType.Int, shortName = "s", description = "Required size of videoplayer window") .delimiter(",") val fileName by argParser.argument(ArgType.String, description = "File to play") diff --git a/kotlin-native/tools/benchmarksAnalyzer/src/main/kotlin/main.kt b/kotlin-native/tools/benchmarksAnalyzer/src/main/kotlin/main.kt index 0bfe5f6cf24..4f3647dec04 100644 --- a/kotlin-native/tools/benchmarksAnalyzer/src/main/kotlin/main.kt +++ b/kotlin-native/tools/benchmarksAnalyzer/src/main/kotlin/main.kt @@ -150,8 +150,8 @@ fun main(args: Array) { "Meaningful performance changes").default(1.0) val useShortForm by argParser.option(ArgType.Boolean, "short", "s", "Show short version of report").default(false) - val renders by argParser.option(ArgType.Choice(listOf("text", "html", "teamcity", "statistics", "metrics")), - shortName = "r", description = "Renders for showing information").multiple().default(listOf("text")) + val renders by argParser.option(ArgType.Choice(), shortName = "r", + description = "Renders for showing information").multiple().default(listOf(RenderType.TEXT)) val user by argParser.option(ArgType.String, shortName = "u", description = "User access information for authorization") argParser.parse(args) @@ -169,7 +169,7 @@ fun main(args: Array) { var outputFile = output renders.forEach { - Render.getRenderByName(it).print(summaryReport, useShortForm, outputFile) + it.render.print(summaryReport, useShortForm, outputFile) outputFile = null } } \ No newline at end of file diff --git a/kotlin-native/tools/benchmarksAnalyzer/src/main/kotlin/org/jetbrains/renders/Render.kt b/kotlin-native/tools/benchmarksAnalyzer/src/main/kotlin/org/jetbrains/renders/Render.kt index 1342f8bc52e..b0eb0fa1e8c 100644 --- a/kotlin-native/tools/benchmarksAnalyzer/src/main/kotlin/org/jetbrains/renders/Render.kt +++ b/kotlin-native/tools/benchmarksAnalyzer/src/main/kotlin/org/jetbrains/renders/Render.kt @@ -10,21 +10,16 @@ import org.jetbrains.report.* import kotlin.math.abs +enum class RenderType(val render: Render) { + TEXT(TextRender()), + HTML(HTMLRender()), + TEAMCITY(TeamCityStatisticsRender()), + STATISTICS(StatisticsRender()) +} + // Base class for printing report in different formats. abstract class Render { - companion object { - fun getRenderByName(name: String) = - when (name) { - "text" -> TextRender() - "html" -> HTMLRender() - "teamcity" -> TeamCityStatisticsRender() - "statistics" -> StatisticsRender() - "metrics" -> MetricResultsRender() - else -> error("Unknown render $name") - } - } - abstract val name: String abstract fun render(report: SummaryBenchmarksReport, onlyChanges: Boolean = false): String From 1b6745dc2ac210270d281166c7f69f2c903bda52 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Fri, 27 Nov 2020 10:22:11 +0700 Subject: [PATCH 643/698] [Xcode 12.2] Update konan.properties and tarballs versions --- kotlin-native/konan/konan.properties | 66 ++++++++++----------- kotlin-native/tools/scripts/update_xcode.sh | 2 +- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/kotlin-native/konan/konan.properties b/kotlin-native/konan/konan.properties index 72c055dee17..ca93d069d46 100644 --- a/kotlin-native/konan/konan.properties +++ b/kotlin-native/konan/konan.properties @@ -66,12 +66,12 @@ llvmVersion.macos_x64 = 8.0.0 # Mac OS X. # Can be an absolute path instead of predefined value. llvmHome.macos_x64 = $llvm.macos_x64.dev -targetToolchain.macos_x64 = target-toolchain-xcode_12_0-macos_x64 +targetToolchain.macos_x64 = target-toolchain-xcode_12_2-macos_x64 libffiDir.macos_x64 = libffi-3.2.1-3-darwin-macos -additionalToolsDir.macos_x64 = xcode-addon-xcode_12_0-macos_x64 +additionalToolsDir.macos_x64 = xcode-addon-xcode_12_2-macos_x64 arch.macos_x64 = x86_64 -targetSysRoot.macos_x64 = target-sysroot-xcode_12_0-macos_x64 +targetSysRoot.macos_x64 = target-sysroot-xcode_12_2-macos_x64 targetCpu.macos_x64 = core2 clangFlags.macos_x64 = -cc1 -emit-obj -disable-llvm-passes -x ir clangNooptFlags.macos_x64 = -O1 @@ -93,27 +93,27 @@ dependencies.macos_x64 = \ libffi-3.2.1-3-darwin-macos \ lldb-3-macos -target-sysroot-xcode_12_0-macos_x64.default = \ +target-sysroot-xcode_12_2-macos_x64.default = \ remote:internal -target-toolchain-xcode_12_0-macos_x64.default = \ +target-toolchain-xcode_12_2-macos_x64.default = \ remote:internal -xcode-addon-xcode_12_0-macos_x64.default = \ +xcode-addon-xcode_12_2-macos_x64.default = \ remote:internal # Apple's 32-bit iOS. -targetToolchain.macos_x64-ios_arm32 = target-toolchain-xcode_12_0-macos_x64 +targetToolchain.macos_x64-ios_arm32 = target-toolchain-xcode_12_2-macos_x64 dependencies.macos_x64-ios_arm32 = \ libffi-3.2.1-3-darwin-macos -target-sysroot-xcode_12_0-ios_arm32.default = \ +target-sysroot-xcode_12_2-ios_arm32.default = \ remote:internal arch.ios_arm32 = armv7 # Shared with 64-bit version. -targetSysRoot.ios_arm32 = target-sysroot-xcode_12_0-ios_arm64 +targetSysRoot.ios_arm32 = target-sysroot-xcode_12_2-ios_arm64 targetCpu.ios_arm32 = generic clangFlags.ios_arm32 = -cc1 -emit-obj -disable-llvm-optzns -x ir clangNooptFlags.ios_arm32 = -O1 @@ -137,15 +137,15 @@ runtimeDefinitions.ios_arm32 = KONAN_OBJC_INTEROP=1 KONAN_IOS KONAN_ARM32=1 \ KONAN_NO_64BIT_ATOMIC=1 KONAN_NO_UNALIGNED_ACCESS=1 # Apple's 64-bit iOS. -targetToolchain.macos_x64-ios_arm64 = target-toolchain-xcode_12_0-macos_x64 +targetToolchain.macos_x64-ios_arm64 = target-toolchain-xcode_12_2-macos_x64 dependencies.macos_x64-ios_arm64 = \ libffi-3.2.1-3-darwin-macos -target-sysroot-xcode_12_0-ios_arm64.default = \ +target-sysroot-xcode_12_2-ios_arm64.default = \ remote:internal arch.ios_arm64 = arm64 -targetSysRoot.ios_arm64 = target-sysroot-xcode_12_0-ios_arm64 +targetSysRoot.ios_arm64 = target-sysroot-xcode_12_2-ios_arm64 targetCpu.ios_arm64 = cyclone clangFlags.ios_arm64 = -cc1 -emit-obj -disable-llvm-passes -x ir clangNooptFlags.ios_arm64 = -O1 @@ -167,15 +167,15 @@ runtimeDefinitions.ios_arm64 = KONAN_OBJC_INTEROP=1 KONAN_IOS=1 KONAN_ARM64=1 \ KONAN_HAS_CXX11_EXCEPTION_FUNCTIONS=1 KONAN_REPORT_BACKTRACE_TO_IOS_CRASH_LOG=1 MACHSIZE=64 # Apple's iOS simulator. -targetToolchain.macos_x64-ios_x64 = target-toolchain-xcode_12_0-macos_x64 +targetToolchain.macos_x64-ios_x64 = target-toolchain-xcode_12_2-macos_x64 dependencies.macos_x64-ios_x64 = \ libffi-3.2.1-3-darwin-macos -target-sysroot-xcode_12_0-ios_x64.default = \ +target-sysroot-xcode_12_2-ios_x64.default = \ remote:internal arch.ios_x64 = x86_64 -targetSysRoot.ios_x64 = target-sysroot-xcode_12_0-ios_x64 +targetSysRoot.ios_x64 = target-sysroot-xcode_12_2-ios_x64 targetCpu.ios_x64 = core2 clangFlags.ios_x64 = -cc1 -emit-obj -disable-llvm-passes -x ir clangNooptFlags.ios_x64 = -O1 @@ -194,15 +194,15 @@ runtimeDefinitions.ios_x64 = KONAN_OBJC_INTEROP=1 KONAN_IOS=1 KONAN_X64=1 \ KONAN_CORE_SYMBOLICATION=1 KONAN_HAS_CXX11_EXCEPTION_FUNCTIONS=1 # Apple's tvOS simulator. -targetToolchain.macos_x64-tvos_x64 = target-toolchain-xcode_12_0-macos_x64 +targetToolchain.macos_x64-tvos_x64 = target-toolchain-xcode_12_2-macos_x64 dependencies.macos_x64-tvos_x64 = \ libffi-3.2.1-3-darwin-macos -target-sysroot-xcode_12_0-tvos_x64.default = \ +target-sysroot-xcode_12_2-tvos_x64.default = \ remote:internal arch.tvos_x64 = x86_64 -targetSysRoot.tvos_x64 = target-sysroot-xcode_12_0-tvos_x64 +targetSysRoot.tvos_x64 = target-sysroot-xcode_12_2-tvos_x64 targetCpu.tvos_x64 = core2 clangFlags.tvos_x64 = -cc1 -emit-obj -disable-llvm-passes -x ir clangNooptFlags.tvos_x64 = -O1 @@ -221,15 +221,15 @@ runtimeDefinitions.tvos_x64 = KONAN_OBJC_INTEROP=1 KONAN_TVOS=1 KONAN_X64=1 \ KONAN_CORE_SYMBOLICATION=1 KONAN_HAS_CXX11_EXCEPTION_FUNCTIONS=1 # Apple's 64-bit tvOS. -targetToolchain.macos_x64-tvos_arm64 = target-toolchain-xcode_12_0-macos_x64 +targetToolchain.macos_x64-tvos_arm64 = target-toolchain-xcode_12_2-macos_x64 dependencies.macos_x64-tvos_arm64 = \ libffi-3.2.1-3-darwin-macos -target-sysroot-xcode_12_0-tvos_arm64.default = \ +target-sysroot-xcode_12_2-tvos_arm64.default = \ remote:internal arch.tvos_arm64 = arm64 -targetSysRoot.tvos_arm64 = target-sysroot-xcode_12_0-tvos_arm64 +targetSysRoot.tvos_arm64 = target-sysroot-xcode_12_2-tvos_arm64 targetCpu.tvos_arm64 = cyclone clangFlags.tvos_arm64 = -cc1 -emit-obj -disable-llvm-passes -x ir clangNooptFlags.tvos_arm64 = -O1 @@ -248,15 +248,15 @@ runtimeDefinitions.tvos_arm64 = KONAN_OBJC_INTEROP=1 KONAN_TVOS=1 KONAN_ARM64=1 KONAN_HAS_CXX11_EXCEPTION_FUNCTIONS=1 KONAN_REPORT_BACKTRACE_TO_IOS_CRASH_LOG=1 MACHSIZE=64 # watchOS armv7k -targetToolchain.macos_x64-watchos_arm32 = target-toolchain-xcode_12_0-macos_x64 +targetToolchain.macos_x64-watchos_arm32 = target-toolchain-xcode_12_2-macos_x64 dependencies.macos_x64-watchos_arm32 = \ libffi-3.2.1-3-darwin-macos -target-sysroot-xcode_12_0-watchos_arm32.default = \ +target-sysroot-xcode_12_2-watchos_arm32.default = \ remote:internal arch.watchos_arm32 = armv7k -targetSysRoot.watchos_arm32 = target-sysroot-xcode_12_0-watchos_arm32 +targetSysRoot.watchos_arm32 = target-sysroot-xcode_12_2-watchos_arm32 targetCpu.watchos_arm32 = cortex-a7 clangFlags.watchos_arm32 = -cc1 -emit-obj -disable-llvm-passes -x ir clangNooptFlags.watchos_arm32 = -O1 @@ -277,15 +277,15 @@ runtimeDefinitions.watchos_arm32 = KONAN_OBJC_INTEROP=1 KONAN_WATCHOS KONAN_ARM3 MACHSIZE=32 KONAN_NO_64BIT_ATOMIC=1 KONAN_NO_UNALIGNED_ACCESS=1 # watchOS arm64_32 -targetToolchain.macos_x64-watchos_arm64 = target-toolchain-xcode_12_0-macos_x64 +targetToolchain.macos_x64-watchos_arm64 = target-toolchain-xcode_12_2-macos_x64 dependencies.macos_x64-watchos_arm64 = \ libffi-3.2.1-3-darwin-macos -target-sysroot-xcode_12_0-watchos_arm64.default = \ +target-sysroot-xcode_12_2-watchos_arm64.default = \ remote:internal arch.watchos_arm64 = arm64_32 -targetSysRoot.watchos_arm64 = target-sysroot-xcode_12_0-watchos_arm32 +targetSysRoot.watchos_arm64 = target-sysroot-xcode_12_2-watchos_arm32 targetCpu.watchos_arm64 = cortex-a7 clangFlags.watchos_arm64 = -cc1 -emit-obj -disable-llvm-passes -x ir -mllvm -aarch64-watch-bitcode-compatibility \ -mllvm -arm-bitcode-compatibility -mllvm -fast-isel=false -mllvm -global-isel=false @@ -307,15 +307,15 @@ runtimeDefinitions.watchos_arm64 = KONAN_OBJC_INTEROP=1 KONAN_WATCHOS KONAN_ARM3 MACHSIZE=32 KONAN_NO_64BIT_ATOMIC=1 KONAN_NO_UNALIGNED_ACCESS=1 # Apple's watchOS i386 simulator. -targetToolchain.macos_x64-watchos_x86 = target-toolchain-xcode_12_0-macos_x64 +targetToolchain.macos_x64-watchos_x86 = target-toolchain-xcode_12_2-macos_x64 dependencies.macos_x64-watchos_x86 = \ libffi-3.2.1-3-darwin-macos -target-sysroot-xcode_12_0-watchos_x86.default = \ +target-sysroot-xcode_12_2-watchos_x86.default = \ remote:internal arch.watchos_x86 = i386 -targetSysRoot.watchos_x86 = target-sysroot-xcode_12_0-watchos_x86 +targetSysRoot.watchos_x86 = target-sysroot-xcode_12_2-watchos_x86 # -target-cpu pentium4 makes sure that code-generator knows which CPU flavour to emit code for. # Can be seen on optimized build and FP tests, where value is passed on stack # by Kotlin and taken from SSE registers by C code. @@ -338,15 +338,15 @@ runtimeDefinitions.watchos_x86 = KONAN_OBJC_INTEROP=1 KONAN_WATCHOS=1 KONAN_NO_6 KONAN_X86=1 KONAN_CORE_SYMBOLICATION=1 KONAN_HAS_CXX11_EXCEPTION_FUNCTIONS=1 # watchOS x86_64 simulator. -targetToolchain.macos_x64-watchos_x64 = target-toolchain-xcode_12_0-macos_x64 +targetToolchain.macos_x64-watchos_x64 = target-toolchain-xcode_12_2-macos_x64 dependencies.macos_x64-watchos_x64 = \ libffi-3.2.1-3-darwin-macos -target-sysroot-xcode_12_0-watchos_x64.default = \ +target-sysroot-xcode_12_2-watchos_x64.default = \ remote:internal arch.watchos_x64 = x86_64 -targetSysRoot.watchos_x64 = target-sysroot-xcode_12_0-watchos_x86 +targetSysRoot.watchos_x64 = target-sysroot-xcode_12_2-watchos_x86 targetCpu.watchos_x64 = core2 clangFlags.watchos_x64 = -cc1 -emit-obj -disable-llvm-passes -x ir -target-cpu $targetCpu.watchos_x64 clangNooptFlags.watchos_x64 = -O1 diff --git a/kotlin-native/tools/scripts/update_xcode.sh b/kotlin-native/tools/scripts/update_xcode.sh index ad275114af1..5952c7fe634 100755 --- a/kotlin-native/tools/scripts/update_xcode.sh +++ b/kotlin-native/tools/scripts/update_xcode.sh @@ -2,7 +2,7 @@ set -e # "brew install coreutils" for grealpath. -KONAN_TOOLCHAIN_VERSION=xcode_12_0 +KONAN_TOOLCHAIN_VERSION=xcode_12_2 SDKS="macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator" TARBALL_macosx=target-sysroot-$KONAN_TOOLCHAIN_VERSION-macos_x64 TARBALL_iphoneos=target-sysroot-$KONAN_TOOLCHAIN_VERSION-ios_arm64 From b012966d33de62f6798ff89fbb40d9f369a2752c Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Fri, 27 Nov 2020 10:39:48 +0700 Subject: [PATCH 644/698] [Xcode 12.2] Updated tvos frameworks --- .../src/platform/tvos/_StoreKit_SwiftUI.def.disabled | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 kotlin-native/platformLibs/src/platform/tvos/_StoreKit_SwiftUI.def.disabled diff --git a/kotlin-native/platformLibs/src/platform/tvos/_StoreKit_SwiftUI.def.disabled b/kotlin-native/platformLibs/src/platform/tvos/_StoreKit_SwiftUI.def.disabled new file mode 100644 index 00000000000..ec91849bcb0 --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/tvos/_StoreKit_SwiftUI.def.disabled @@ -0,0 +1,7 @@ +language = Objective-C +package = platform._StoreKit_SwiftUI + +modules = _StoreKit_SwiftUI +compilerOpts = -framework _StoreKit_SwiftUI +linkerOpts = -framework _StoreKit_SwiftUI +#Disabled: Unavailable From 660f0d83cb346cc8a709fbb3046b8d429e9a6510 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Fri, 27 Nov 2020 10:39:56 +0700 Subject: [PATCH 645/698] [Xcode 12.2] Updated watchos frameworks --- .../src/platform/watchos/_StoreKit_SwiftUI.def.disabled | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 kotlin-native/platformLibs/src/platform/watchos/_StoreKit_SwiftUI.def.disabled diff --git a/kotlin-native/platformLibs/src/platform/watchos/_StoreKit_SwiftUI.def.disabled b/kotlin-native/platformLibs/src/platform/watchos/_StoreKit_SwiftUI.def.disabled new file mode 100644 index 00000000000..ec91849bcb0 --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/watchos/_StoreKit_SwiftUI.def.disabled @@ -0,0 +1,7 @@ +language = Objective-C +package = platform._StoreKit_SwiftUI + +modules = _StoreKit_SwiftUI +compilerOpts = -framework _StoreKit_SwiftUI +linkerOpts = -framework _StoreKit_SwiftUI +#Disabled: Unavailable From 1c9d759abd26f3c85a70f9e709dc989be6cebda1 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Fri, 27 Nov 2020 12:27:18 +0700 Subject: [PATCH 646/698] [Xcode 12.2] Updated macos frameworks --- .../platformLibs/src/platform/osx/AVFoundation.def | 2 +- kotlin-native/platformLibs/src/platform/osx/AVKit.def | 2 +- .../platformLibs/src/platform/osx/Accessibility.def | 7 +++++++ .../platformLibs/src/platform/osx/AddressBook.def | 2 +- .../src/platform/osx/AppTrackingTransparency.def | 7 +++++++ .../platformLibs/src/platform/osx/BusinessChat.def | 2 +- kotlin-native/platformLibs/src/platform/osx/ClassKit.def | 7 +++++++ kotlin-native/platformLibs/src/platform/osx/Cocoa.def | 2 +- .../platformLibs/src/platform/osx/CoreAudioKit.def | 2 +- kotlin-native/platformLibs/src/platform/osx/CoreData.def | 2 +- .../platformLibs/src/platform/osx/CoreSpotlight.def | 2 +- .../src/platform/osx/DeveloperToolsSupport.def.disabled | 7 +++++++ kotlin-native/platformLibs/src/platform/osx/GameKit.def | 2 +- .../platformLibs/src/platform/osx/GameplayKit.def | 2 +- .../platformLibs/src/platform/osx/IOBluetoothUI.def | 2 +- .../platformLibs/src/platform/osx/ImageCaptureCore.def | 2 +- .../platformLibs/src/platform/osx/JavaNativeFoundation.def | 7 +++++++ .../platformLibs/src/platform/osx/JavaRuntimeSupport.def | 7 +++++++ .../platformLibs/src/platform/osx/KernelManagement.def | 7 +++++++ kotlin-native/platformLibs/src/platform/osx/MLCompute.def | 7 +++++++ .../src/platform/osx/MetalPerformanceShadersGraph.def | 7 +++++++ .../src/platform/osx/MultipeerConnectivity.def | 2 +- .../platformLibs/src/platform/osx/NearbyInteraction.def | 7 +++++++ kotlin-native/platformLibs/src/platform/osx/PDFKit.def | 2 +- .../src/platform/osx/ParavirtualizedGraphics.def | 7 +++++++ kotlin-native/platformLibs/src/platform/osx/PassKit.def | 7 +++++++ kotlin-native/platformLibs/src/platform/osx/PencilKit.def | 2 +- kotlin-native/platformLibs/src/platform/osx/Photos.def | 2 +- .../platformLibs/src/platform/osx/PreferencePanes.def | 2 +- kotlin-native/platformLibs/src/platform/osx/Quartz.def | 2 +- .../src/platform/osx/QuickLookThumbnailing.def | 2 +- kotlin-native/platformLibs/src/platform/osx/ReplayKit.def | 7 +++++++ kotlin-native/platformLibs/src/platform/osx/ScreenTime.def | 7 +++++++ .../platformLibs/src/platform/osx/SecurityInterface.def | 2 +- kotlin-native/platformLibs/src/platform/osx/SensorKit.def | 7 +++++++ .../platformLibs/src/platform/osx/SoundAnalysis.def | 2 +- kotlin-native/platformLibs/src/platform/osx/Speech.def | 2 +- kotlin-native/platformLibs/src/platform/osx/SpriteKit.def | 2 +- .../src/platform/osx/UniformTypeIdentifiers.def | 7 +++++++ .../platformLibs/src/platform/osx/UserNotificationsUI.def | 7 +++++++ .../platformLibs/src/platform/osx/Virtualization.def | 7 +++++++ kotlin-native/platformLibs/src/platform/osx/Vision.def | 2 +- .../platformLibs/src/platform/osx/WidgetKit.def.disabled | 7 +++++++ .../src/platform/osx/_AVKit_SwiftUI.def.disabled | 7 +++++++ .../osx/_AuthenticationServices_SwiftUI.def.disabled | 7 +++++++ .../src/platform/osx/_MapKit_SwiftUI.def.disabled | 7 +++++++ .../src/platform/osx/_QuickLook_SwiftUI.def.disabled | 7 +++++++ .../src/platform/osx/_SceneKit_SwiftUI.def.disabled | 7 +++++++ .../src/platform/osx/_SpriteKit_SwiftUI.def.disabled | 7 +++++++ .../src/platform/osx/_StoreKit_SwiftUI.def.disabled | 7 +++++++ kotlin-native/platformLibs/src/platform/osx/darwin.def | 3 ++- 51 files changed, 208 insertions(+), 25 deletions(-) create mode 100644 kotlin-native/platformLibs/src/platform/osx/Accessibility.def create mode 100644 kotlin-native/platformLibs/src/platform/osx/AppTrackingTransparency.def create mode 100644 kotlin-native/platformLibs/src/platform/osx/ClassKit.def create mode 100644 kotlin-native/platformLibs/src/platform/osx/DeveloperToolsSupport.def.disabled create mode 100644 kotlin-native/platformLibs/src/platform/osx/JavaNativeFoundation.def create mode 100644 kotlin-native/platformLibs/src/platform/osx/JavaRuntimeSupport.def create mode 100644 kotlin-native/platformLibs/src/platform/osx/KernelManagement.def create mode 100644 kotlin-native/platformLibs/src/platform/osx/MLCompute.def create mode 100644 kotlin-native/platformLibs/src/platform/osx/MetalPerformanceShadersGraph.def create mode 100644 kotlin-native/platformLibs/src/platform/osx/NearbyInteraction.def create mode 100644 kotlin-native/platformLibs/src/platform/osx/ParavirtualizedGraphics.def create mode 100644 kotlin-native/platformLibs/src/platform/osx/PassKit.def create mode 100644 kotlin-native/platformLibs/src/platform/osx/ReplayKit.def create mode 100644 kotlin-native/platformLibs/src/platform/osx/ScreenTime.def create mode 100644 kotlin-native/platformLibs/src/platform/osx/SensorKit.def create mode 100644 kotlin-native/platformLibs/src/platform/osx/UniformTypeIdentifiers.def create mode 100644 kotlin-native/platformLibs/src/platform/osx/UserNotificationsUI.def create mode 100644 kotlin-native/platformLibs/src/platform/osx/Virtualization.def create mode 100644 kotlin-native/platformLibs/src/platform/osx/WidgetKit.def.disabled create mode 100644 kotlin-native/platformLibs/src/platform/osx/_AVKit_SwiftUI.def.disabled create mode 100644 kotlin-native/platformLibs/src/platform/osx/_AuthenticationServices_SwiftUI.def.disabled create mode 100644 kotlin-native/platformLibs/src/platform/osx/_MapKit_SwiftUI.def.disabled create mode 100644 kotlin-native/platformLibs/src/platform/osx/_QuickLook_SwiftUI.def.disabled create mode 100644 kotlin-native/platformLibs/src/platform/osx/_SceneKit_SwiftUI.def.disabled create mode 100644 kotlin-native/platformLibs/src/platform/osx/_SpriteKit_SwiftUI.def.disabled create mode 100644 kotlin-native/platformLibs/src/platform/osx/_StoreKit_SwiftUI.def.disabled diff --git a/kotlin-native/platformLibs/src/platform/osx/AVFoundation.def b/kotlin-native/platformLibs/src/platform/osx/AVFoundation.def index 0830fea53a2..7534e0001bc 100644 --- a/kotlin-native/platformLibs/src/platform/osx/AVFoundation.def +++ b/kotlin-native/platformLibs/src/platform/osx/AVFoundation.def @@ -1,4 +1,4 @@ -depends = ApplicationServices AudioToolbox CFNetwork CoreAudio CoreAudioTypes CoreFoundation CoreGraphics CoreImage CoreMIDI CoreMedia CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO MediaToolbox Metal OpenGLCommon QuartzCore Security darwin libkern osx posix +depends = ApplicationServices AudioToolbox CFNetwork CoreAudio CoreAudioTypes CoreFoundation CoreGraphics CoreImage CoreMIDI CoreMedia CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO MediaToolbox Metal OpenGLCommon QuartzCore Security UniformTypeIdentifiers darwin libkern osx posix language = Objective-C package = platform.AVFoundation modules = AVFoundation diff --git a/kotlin-native/platformLibs/src/platform/osx/AVKit.def b/kotlin-native/platformLibs/src/platform/osx/AVKit.def index 6a61c34355e..71b87772078 100644 --- a/kotlin-native/platformLibs/src/platform/osx/AVKit.def +++ b/kotlin-native/platformLibs/src/platform/osx/AVKit.def @@ -1,4 +1,4 @@ -depends = AVFoundation AppKit ApplicationServices AudioToolbox CFNetwork Cocoa CoreAudio CoreAudioTypes CoreData CoreFoundation CoreGraphics CoreImage CoreMIDI CoreMedia CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO MediaToolbox Metal OpenGLCommon QuartzCore Security darwin libkern osx posix +depends = AVFoundation AppKit ApplicationServices AudioToolbox CFNetwork CloudKit Cocoa CoreAudio CoreAudioTypes CoreData CoreFoundation CoreGraphics CoreImage CoreLocation CoreMIDI CoreMedia CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO MediaToolbox Metal OpenGLCommon QuartzCore Security UniformTypeIdentifiers darwin libkern osx posix language = Objective-C package = platform.AVKit modules = AVKit diff --git a/kotlin-native/platformLibs/src/platform/osx/Accessibility.def b/kotlin-native/platformLibs/src/platform/osx/Accessibility.def new file mode 100644 index 00000000000..0d2c6acc4eb --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/Accessibility.def @@ -0,0 +1,7 @@ +depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreServices CoreText DiskArbitration Foundation IOKit ImageIO Security darwin libkern osx posix +language = Objective-C +package = platform.Accessibility + +modules = Accessibility +compilerOpts = -framework Accessibility +linkerOpts = -framework Accessibility diff --git a/kotlin-native/platformLibs/src/platform/osx/AddressBook.def b/kotlin-native/platformLibs/src/platform/osx/AddressBook.def index 2523e710caa..3041e5d0cd8 100644 --- a/kotlin-native/platformLibs/src/platform/osx/AddressBook.def +++ b/kotlin-native/platformLibs/src/platform/osx/AddressBook.def @@ -1,4 +1,4 @@ -depends = AppKit ApplicationServices CFNetwork Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix +depends = AppKit ApplicationServices CFNetwork CloudKit Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreLocation CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix language = Objective-C package = platform.AddressBook headers = AddressBook/AddressBook.h AddressBook/AddressBookUI.h AddressBook/ABActions.h AddressBook/ABPeoplePickerView.h AddressBook/ABPersonView.h AddressBook/ABPersonPicker.h AddressBook/ABPersonPickerDelegate.h diff --git a/kotlin-native/platformLibs/src/platform/osx/AppTrackingTransparency.def b/kotlin-native/platformLibs/src/platform/osx/AppTrackingTransparency.def new file mode 100644 index 00000000000..57f19c585fb --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/AppTrackingTransparency.def @@ -0,0 +1,7 @@ +depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreServices CoreText DiskArbitration Foundation IOKit ImageIO Security darwin libkern osx posix +language = Objective-C +package = platform.AppTrackingTransparency + +modules = AppTrackingTransparency +compilerOpts = -framework AppTrackingTransparency +linkerOpts = -framework AppTrackingTransparency diff --git a/kotlin-native/platformLibs/src/platform/osx/BusinessChat.def b/kotlin-native/platformLibs/src/platform/osx/BusinessChat.def index 45c9ee0938d..50d84435f6e 100644 --- a/kotlin-native/platformLibs/src/platform/osx/BusinessChat.def +++ b/kotlin-native/platformLibs/src/platform/osx/BusinessChat.def @@ -1,4 +1,4 @@ -depends = AppKit ApplicationServices CFNetwork Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix +depends = AppKit ApplicationServices CFNetwork CloudKit Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreLocation CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix language = Objective-C package = platform.BusinessChat modules = BusinessChat diff --git a/kotlin-native/platformLibs/src/platform/osx/ClassKit.def b/kotlin-native/platformLibs/src/platform/osx/ClassKit.def new file mode 100644 index 00000000000..6222d4cac4b --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/ClassKit.def @@ -0,0 +1,7 @@ +depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreServices CoreText DiskArbitration Foundation IOKit ImageIO Security darwin libkern osx posix +language = Objective-C +package = platform.ClassKit + +modules = ClassKit +compilerOpts = -framework ClassKit +linkerOpts = -framework ClassKit diff --git a/kotlin-native/platformLibs/src/platform/osx/Cocoa.def b/kotlin-native/platformLibs/src/platform/osx/Cocoa.def index 913952497d8..37497e20d32 100644 --- a/kotlin-native/platformLibs/src/platform/osx/Cocoa.def +++ b/kotlin-native/platformLibs/src/platform/osx/Cocoa.def @@ -1,4 +1,4 @@ -depends = AppKit ApplicationServices CFNetwork CoreData CoreFoundation CoreGraphics CoreImage CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix +depends = AppKit ApplicationServices CFNetwork CloudKit CoreData CoreFoundation CoreGraphics CoreImage CoreLocation CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix language = Objective-C package = platform.Cocoa modules = Cocoa diff --git a/kotlin-native/platformLibs/src/platform/osx/CoreAudioKit.def b/kotlin-native/platformLibs/src/platform/osx/CoreAudioKit.def index c6a59c16bbb..4b618e1a8b4 100644 --- a/kotlin-native/platformLibs/src/platform/osx/CoreAudioKit.def +++ b/kotlin-native/platformLibs/src/platform/osx/CoreAudioKit.def @@ -1,4 +1,4 @@ -depends = AppKit ApplicationServices AudioToolbox AudioUnit CFNetwork Cocoa CoreAudioTypes CoreData CoreFoundation CoreGraphics CoreImage CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix +depends = AppKit ApplicationServices AudioToolbox AudioUnit CFNetwork CloudKit Cocoa CoreAudioTypes CoreData CoreFoundation CoreGraphics CoreImage CoreLocation CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix language = Objective-C package = platform.CoreAudioKit modules = CoreAudioKit diff --git a/kotlin-native/platformLibs/src/platform/osx/CoreData.def b/kotlin-native/platformLibs/src/platform/osx/CoreData.def index 73d2d7d16ec..ebf5a72e618 100644 --- a/kotlin-native/platformLibs/src/platform/osx/CoreData.def +++ b/kotlin-native/platformLibs/src/platform/osx/CoreData.def @@ -1,4 +1,4 @@ -depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreServices CoreText DiskArbitration Foundation IOKit ImageIO Security darwin libkern osx posix +depends = ApplicationServices CFNetwork CloudKit CoreFoundation CoreGraphics CoreLocation CoreServices CoreText DiskArbitration Foundation IOKit ImageIO Security darwin libkern osx posix language = Objective-C package = platform.CoreData modules = CoreData diff --git a/kotlin-native/platformLibs/src/platform/osx/CoreSpotlight.def b/kotlin-native/platformLibs/src/platform/osx/CoreSpotlight.def index f1e47f23204..bdcadf55cf0 100644 --- a/kotlin-native/platformLibs/src/platform/osx/CoreSpotlight.def +++ b/kotlin-native/platformLibs/src/platform/osx/CoreSpotlight.def @@ -1,4 +1,4 @@ -depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreServices CoreText DiskArbitration Foundation IOKit ImageIO Security darwin libkern osx posix +depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreServices CoreText DiskArbitration Foundation IOKit ImageIO Security UniformTypeIdentifiers darwin libkern osx posix language = Objective-C package = platform.CoreSpotlight modules = CoreSpotlight diff --git a/kotlin-native/platformLibs/src/platform/osx/DeveloperToolsSupport.def.disabled b/kotlin-native/platformLibs/src/platform/osx/DeveloperToolsSupport.def.disabled new file mode 100644 index 00000000000..6fba18e676b --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/DeveloperToolsSupport.def.disabled @@ -0,0 +1,7 @@ +language = Objective-C +package = platform.DeveloperToolsSupport + +modules = DeveloperToolsSupport +compilerOpts = -framework DeveloperToolsSupport +linkerOpts = -framework DeveloperToolsSupport +#Disabled: Swift-only framework diff --git a/kotlin-native/platformLibs/src/platform/osx/GameKit.def b/kotlin-native/platformLibs/src/platform/osx/GameKit.def index 615f13f930a..441f5d91a3f 100644 --- a/kotlin-native/platformLibs/src/platform/osx/GameKit.def +++ b/kotlin-native/platformLibs/src/platform/osx/GameKit.def @@ -1,4 +1,4 @@ -depends = AppKit ApplicationServices CFNetwork Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreServices CoreText CoreVideo DiskArbitration Foundation GLKit GameController GameplayKit IOKit IOSurface ImageIO Metal MetalKit ModelIO OpenGLCommon QuartzCore SceneKit Security SpriteKit darwin libkern osx posix +depends = AppKit ApplicationServices CFNetwork CloudKit Cocoa Contacts CoreData CoreFoundation CoreGraphics CoreImage CoreLocation CoreServices CoreText CoreVideo DiskArbitration Foundation GLKit GameController GameplayKit IOKit IOSurface ImageIO Metal MetalKit ModelIO OpenGLCommon QuartzCore SceneKit Security SpriteKit darwin libkern osx posix language = Objective-C package = platform.GameKit modules = GameKit diff --git a/kotlin-native/platformLibs/src/platform/osx/GameplayKit.def b/kotlin-native/platformLibs/src/platform/osx/GameplayKit.def index 740c03dd5fd..162221d0768 100644 --- a/kotlin-native/platformLibs/src/platform/osx/GameplayKit.def +++ b/kotlin-native/platformLibs/src/platform/osx/GameplayKit.def @@ -1,4 +1,4 @@ -depends = AppKit ApplicationServices CFNetwork Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreServices CoreText CoreVideo DiskArbitration Foundation GLKit IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore SceneKit Security SpriteKit darwin libkern osx posix +depends = AppKit ApplicationServices CFNetwork CloudKit Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreLocation CoreServices CoreText CoreVideo DiskArbitration Foundation GLKit IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore SceneKit Security SpriteKit darwin libkern osx posix language = Objective-C package = platform.GameplayKit modules = GameplayKit diff --git a/kotlin-native/platformLibs/src/platform/osx/IOBluetoothUI.def b/kotlin-native/platformLibs/src/platform/osx/IOBluetoothUI.def index 73c5a5a4cb8..85f64553f77 100644 --- a/kotlin-native/platformLibs/src/platform/osx/IOBluetoothUI.def +++ b/kotlin-native/platformLibs/src/platform/osx/IOBluetoothUI.def @@ -1,4 +1,4 @@ -depends = AppKit ApplicationServices CFNetwork Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreServices CoreText CoreVideo DiskArbitration Foundation IOBluetooth IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix +depends = AppKit ApplicationServices CFNetwork CloudKit Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreLocation CoreServices CoreText CoreVideo DiskArbitration Foundation IOBluetooth IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix language = Objective-C package = platform.IOBluetoothUI modules = IOBluetoothUI diff --git a/kotlin-native/platformLibs/src/platform/osx/ImageCaptureCore.def b/kotlin-native/platformLibs/src/platform/osx/ImageCaptureCore.def index 7af533f8bcf..e9aa8e9fba8 100644 --- a/kotlin-native/platformLibs/src/platform/osx/ImageCaptureCore.def +++ b/kotlin-native/platformLibs/src/platform/osx/ImageCaptureCore.def @@ -1,4 +1,4 @@ -depends = AppKit ApplicationServices CFNetwork Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix +depends = AppKit ApplicationServices CFNetwork CloudKit Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreLocation CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix language = Objective-C package = platform.ImageCaptureCore modules = ImageCaptureCore diff --git a/kotlin-native/platformLibs/src/platform/osx/JavaNativeFoundation.def b/kotlin-native/platformLibs/src/platform/osx/JavaNativeFoundation.def new file mode 100644 index 00000000000..2dae6f5f72a --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/JavaNativeFoundation.def @@ -0,0 +1,7 @@ +depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreServices CoreText DiskArbitration Foundation IOKit ImageIO Security darwin libkern osx posix +language = Objective-C +package = platform.JavaNativeFoundation + +modules = JavaNativeFoundation +compilerOpts = -framework JavaNativeFoundation +linkerOpts = -framework JavaNativeFoundation diff --git a/kotlin-native/platformLibs/src/platform/osx/JavaRuntimeSupport.def b/kotlin-native/platformLibs/src/platform/osx/JavaRuntimeSupport.def new file mode 100644 index 00000000000..9a5e7476a1c --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/JavaRuntimeSupport.def @@ -0,0 +1,7 @@ +depends = AppKit ApplicationServices CFNetwork CloudKit Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreLocation CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix +language = Objective-C +package = platform.JavaRuntimeSupport + +modules = JavaRuntimeSupport +compilerOpts = -framework JavaRuntimeSupport +linkerOpts = -framework JavaRuntimeSupport diff --git a/kotlin-native/platformLibs/src/platform/osx/KernelManagement.def b/kotlin-native/platformLibs/src/platform/osx/KernelManagement.def new file mode 100644 index 00000000000..bf04ebe7fb9 --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/KernelManagement.def @@ -0,0 +1,7 @@ +depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreServices CoreText DiskArbitration Foundation IOKit ImageIO Security darwin libkern osx posix +language = Objective-C +package = platform.KernelManagement + +modules = KernelManagement +compilerOpts = -framework KernelManagement +linkerOpts = -framework KernelManagement diff --git a/kotlin-native/platformLibs/src/platform/osx/MLCompute.def b/kotlin-native/platformLibs/src/platform/osx/MLCompute.def new file mode 100644 index 00000000000..8dda2c470cc --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/MLCompute.def @@ -0,0 +1,7 @@ +depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreServices CoreText DiskArbitration Foundation IOKit IOSurface ImageIO Metal Security darwin libkern osx posix +language = Objective-C +package = platform.MLCompute + +modules = MLCompute +compilerOpts = -framework MLCompute +linkerOpts = -framework MLCompute diff --git a/kotlin-native/platformLibs/src/platform/osx/MetalPerformanceShadersGraph.def b/kotlin-native/platformLibs/src/platform/osx/MetalPerformanceShadersGraph.def new file mode 100644 index 00000000000..2a6954cdd98 --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/MetalPerformanceShadersGraph.def @@ -0,0 +1,7 @@ +depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreServices CoreText DiskArbitration Foundation IOKit IOSurface ImageIO Metal MetalPerformanceShaders Security darwin libkern osx posix +language = Objective-C +package = platform.MetalPerformanceShadersGraph + +modules = MetalPerformanceShadersGraph +compilerOpts = -framework MetalPerformanceShadersGraph +linkerOpts = -framework MetalPerformanceShadersGraph diff --git a/kotlin-native/platformLibs/src/platform/osx/MultipeerConnectivity.def b/kotlin-native/platformLibs/src/platform/osx/MultipeerConnectivity.def index 21b3745ea50..e7069d38db2 100644 --- a/kotlin-native/platformLibs/src/platform/osx/MultipeerConnectivity.def +++ b/kotlin-native/platformLibs/src/platform/osx/MultipeerConnectivity.def @@ -1,4 +1,4 @@ -depends = AppKit ApplicationServices CFNetwork Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix +depends = AppKit ApplicationServices CFNetwork CloudKit Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreLocation CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix language = Objective-C package = platform.MultipeerConnectivity modules = MultipeerConnectivity diff --git a/kotlin-native/platformLibs/src/platform/osx/NearbyInteraction.def b/kotlin-native/platformLibs/src/platform/osx/NearbyInteraction.def new file mode 100644 index 00000000000..3a0dd72bc07 --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/NearbyInteraction.def @@ -0,0 +1,7 @@ +depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreServices CoreText DiskArbitration Foundation IOKit ImageIO Security darwin libkern osx posix +language = Objective-C +package = platform.NearbyInteraction + +modules = NearbyInteraction +compilerOpts = -framework NearbyInteraction +linkerOpts = -framework NearbyInteraction diff --git a/kotlin-native/platformLibs/src/platform/osx/PDFKit.def b/kotlin-native/platformLibs/src/platform/osx/PDFKit.def index 48cf1ace374..dec4cdf1934 100644 --- a/kotlin-native/platformLibs/src/platform/osx/PDFKit.def +++ b/kotlin-native/platformLibs/src/platform/osx/PDFKit.def @@ -1,4 +1,4 @@ -depends = AppKit ApplicationServices CFNetwork Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix +depends = AppKit ApplicationServices CFNetwork CloudKit Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreLocation CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix language = Objective-C package = platform.PDFKit headers = PDFKit/PDFKit.h diff --git a/kotlin-native/platformLibs/src/platform/osx/ParavirtualizedGraphics.def b/kotlin-native/platformLibs/src/platform/osx/ParavirtualizedGraphics.def new file mode 100644 index 00000000000..88b5a0728bf --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/ParavirtualizedGraphics.def @@ -0,0 +1,7 @@ +depends = AppKit ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon Security darwin libkern osx posix +language = Objective-C +package = platform.ParavirtualizedGraphics + +modules = ParavirtualizedGraphics +compilerOpts = -framework ParavirtualizedGraphics +linkerOpts = -framework ParavirtualizedGraphics diff --git a/kotlin-native/platformLibs/src/platform/osx/PassKit.def b/kotlin-native/platformLibs/src/platform/osx/PassKit.def new file mode 100644 index 00000000000..c0eb566624f --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/PassKit.def @@ -0,0 +1,7 @@ +depends = AppKit ApplicationServices CFNetwork Contacts CoreData CoreFoundation CoreGraphics CoreImage CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix +language = Objective-C +package = platform.PassKit + +modules = PassKit +compilerOpts = -framework PassKit +linkerOpts = -framework PassKit diff --git a/kotlin-native/platformLibs/src/platform/osx/PencilKit.def b/kotlin-native/platformLibs/src/platform/osx/PencilKit.def index 8e80ee5a72c..b0374bec39f 100644 --- a/kotlin-native/platformLibs/src/platform/osx/PencilKit.def +++ b/kotlin-native/platformLibs/src/platform/osx/PencilKit.def @@ -1,4 +1,4 @@ -depends = AppKit ApplicationServices CFNetwork Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix +depends = AppKit ApplicationServices CFNetwork CloudKit Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreLocation CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix language = Objective-C package = platform.PencilKit modules = PencilKit diff --git a/kotlin-native/platformLibs/src/platform/osx/Photos.def b/kotlin-native/platformLibs/src/platform/osx/Photos.def index 25ec05f409e..d21ece1cbcd 100644 --- a/kotlin-native/platformLibs/src/platform/osx/Photos.def +++ b/kotlin-native/platformLibs/src/platform/osx/Photos.def @@ -1,4 +1,4 @@ -depends = AVFoundation ApplicationServices AudioToolbox CFNetwork CoreAudio CoreAudioTypes CoreFoundation CoreGraphics CoreImage CoreLocation CoreMIDI CoreMedia CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO MediaToolbox Metal OpenGLCommon QuartzCore Security darwin libkern osx posix +depends = AVFoundation ApplicationServices AudioToolbox CFNetwork CoreAudio CoreAudioTypes CoreFoundation CoreGraphics CoreImage CoreLocation CoreMIDI CoreMedia CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO MediaToolbox Metal OpenGLCommon QuartzCore Security UniformTypeIdentifiers darwin libkern osx posix language = Objective-C package = platform.Photos modules = Photos diff --git a/kotlin-native/platformLibs/src/platform/osx/PreferencePanes.def b/kotlin-native/platformLibs/src/platform/osx/PreferencePanes.def index c7bd08decfa..273159d0bd3 100644 --- a/kotlin-native/platformLibs/src/platform/osx/PreferencePanes.def +++ b/kotlin-native/platformLibs/src/platform/osx/PreferencePanes.def @@ -1,4 +1,4 @@ -depends = AppKit ApplicationServices CFNetwork Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix +depends = AppKit ApplicationServices CFNetwork CloudKit Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreLocation CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix language = Objective-C package = platform.PreferencePanes modules = PreferencePanes diff --git a/kotlin-native/platformLibs/src/platform/osx/Quartz.def b/kotlin-native/platformLibs/src/platform/osx/Quartz.def index 18a50e0b6de..688683bffdc 100644 --- a/kotlin-native/platformLibs/src/platform/osx/Quartz.def +++ b/kotlin-native/platformLibs/src/platform/osx/Quartz.def @@ -1,4 +1,4 @@ -depends = AppKit ApplicationServices CFNetwork Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageCaptureCore ImageIO Metal OpenGL OpenGLCommon PDFKit QuartzCore QuickLook Security darwin libkern osx posix +depends = AppKit ApplicationServices CFNetwork CloudKit Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreLocation CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageCaptureCore ImageIO Metal OpenGL OpenGLCommon PDFKit QuartzCore QuickLook Security darwin libkern osx posix language = Objective-C package = platform.Quartz modules = Quartz diff --git a/kotlin-native/platformLibs/src/platform/osx/QuickLookThumbnailing.def b/kotlin-native/platformLibs/src/platform/osx/QuickLookThumbnailing.def index 7126b6b8dac..fe91906c4e7 100644 --- a/kotlin-native/platformLibs/src/platform/osx/QuickLookThumbnailing.def +++ b/kotlin-native/platformLibs/src/platform/osx/QuickLookThumbnailing.def @@ -1,4 +1,4 @@ -depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreServices CoreText DiskArbitration Foundation IOKit ImageIO Security darwin libkern osx posix +depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreServices CoreText DiskArbitration Foundation IOKit ImageIO Security UniformTypeIdentifiers darwin libkern osx posix language = Objective-C package = platform.QuickLookThumbnailing modules = QuickLookThumbnailing diff --git a/kotlin-native/platformLibs/src/platform/osx/ReplayKit.def b/kotlin-native/platformLibs/src/platform/osx/ReplayKit.def new file mode 100644 index 00000000000..4b8a938b38a --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/ReplayKit.def @@ -0,0 +1,7 @@ +depends = AVFoundation AppKit ApplicationServices AudioToolbox CFNetwork CoreAudio CoreAudioTypes CoreData CoreFoundation CoreGraphics CoreImage CoreMIDI CoreMedia CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO MediaToolbox Metal OpenGLCommon QuartzCore Security UniformTypeIdentifiers darwin libkern osx posix +language = Objective-C +package = platform.ReplayKit + +modules = ReplayKit +compilerOpts = -framework ReplayKit +linkerOpts = -framework ReplayKit diff --git a/kotlin-native/platformLibs/src/platform/osx/ScreenTime.def b/kotlin-native/platformLibs/src/platform/osx/ScreenTime.def new file mode 100644 index 00000000000..482583c64f6 --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/ScreenTime.def @@ -0,0 +1,7 @@ +depends = AppKit ApplicationServices CFNetwork CoreData CoreFoundation CoreGraphics CoreImage CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix +language = Objective-C +package = platform.ScreenTime + +modules = ScreenTime +compilerOpts = -framework ScreenTime +linkerOpts = -framework ScreenTime diff --git a/kotlin-native/platformLibs/src/platform/osx/SecurityInterface.def b/kotlin-native/platformLibs/src/platform/osx/SecurityInterface.def index 790287e1cf1..43b3294fad3 100644 --- a/kotlin-native/platformLibs/src/platform/osx/SecurityInterface.def +++ b/kotlin-native/platformLibs/src/platform/osx/SecurityInterface.def @@ -1,4 +1,4 @@ -depends = AppKit ApplicationServices CFNetwork Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security SecurityFoundation darwin libkern osx posix +depends = AppKit ApplicationServices CFNetwork CloudKit Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreLocation CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security SecurityFoundation darwin libkern osx posix language = Objective-C package = platform.SecurityInterface modules = SecurityInterface diff --git a/kotlin-native/platformLibs/src/platform/osx/SensorKit.def b/kotlin-native/platformLibs/src/platform/osx/SensorKit.def new file mode 100644 index 00000000000..84348c52b8a --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/SensorKit.def @@ -0,0 +1,7 @@ +depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreLocation CoreServices CoreText DiskArbitration Foundation IOKit ImageIO Security darwin libkern osx posix +language = Objective-C +package = platform.SensorKit + +modules = SensorKit +compilerOpts = -framework SensorKit +linkerOpts = -framework SensorKit diff --git a/kotlin-native/platformLibs/src/platform/osx/SoundAnalysis.def b/kotlin-native/platformLibs/src/platform/osx/SoundAnalysis.def index a845994d0aa..21820756f8f 100644 --- a/kotlin-native/platformLibs/src/platform/osx/SoundAnalysis.def +++ b/kotlin-native/platformLibs/src/platform/osx/SoundAnalysis.def @@ -1,4 +1,4 @@ -depends = AVFoundation ApplicationServices AudioToolbox CFNetwork CoreAudio CoreAudioTypes CoreFoundation CoreGraphics CoreImage CoreMIDI CoreML CoreMedia CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO MediaToolbox Metal OpenGLCommon QuartzCore Security darwin libkern osx posix +depends = AVFoundation ApplicationServices AudioToolbox CFNetwork CoreAudio CoreAudioTypes CoreFoundation CoreGraphics CoreImage CoreMIDI CoreML CoreMedia CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO MediaToolbox Metal OpenGLCommon QuartzCore Security UniformTypeIdentifiers darwin libkern osx posix language = Objective-C package = platform.SoundAnalysis modules = SoundAnalysis diff --git a/kotlin-native/platformLibs/src/platform/osx/Speech.def b/kotlin-native/platformLibs/src/platform/osx/Speech.def index 7ad2c82044c..2fc39dd7322 100644 --- a/kotlin-native/platformLibs/src/platform/osx/Speech.def +++ b/kotlin-native/platformLibs/src/platform/osx/Speech.def @@ -1,4 +1,4 @@ -depends = AVFoundation ApplicationServices AudioToolbox CFNetwork CoreAudio CoreAudioTypes CoreFoundation CoreGraphics CoreImage CoreMIDI CoreMedia CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO MediaToolbox Metal OpenGLCommon QuartzCore Security darwin libkern osx posix +depends = AVFoundation ApplicationServices AudioToolbox CFNetwork CoreAudio CoreAudioTypes CoreFoundation CoreGraphics CoreImage CoreMIDI CoreMedia CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO MediaToolbox Metal OpenGLCommon QuartzCore Security UniformTypeIdentifiers darwin libkern osx posix language = Objective-C package = platform.Speech modules = Speech diff --git a/kotlin-native/platformLibs/src/platform/osx/SpriteKit.def b/kotlin-native/platformLibs/src/platform/osx/SpriteKit.def index 1710c7f2968..e3df62fc6a1 100644 --- a/kotlin-native/platformLibs/src/platform/osx/SpriteKit.def +++ b/kotlin-native/platformLibs/src/platform/osx/SpriteKit.def @@ -1,4 +1,4 @@ -depends = AppKit ApplicationServices CFNetwork Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreServices CoreText CoreVideo DiskArbitration Foundation GLKit IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix +depends = AppKit ApplicationServices CFNetwork CloudKit Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreLocation CoreServices CoreText CoreVideo DiskArbitration Foundation GLKit IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix language = Objective-C package = platform.SpriteKit modules = SpriteKit diff --git a/kotlin-native/platformLibs/src/platform/osx/UniformTypeIdentifiers.def b/kotlin-native/platformLibs/src/platform/osx/UniformTypeIdentifiers.def new file mode 100644 index 00000000000..ddf7deba667 --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/UniformTypeIdentifiers.def @@ -0,0 +1,7 @@ +depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreServices CoreText DiskArbitration Foundation IOKit ImageIO Security darwin libkern osx posix +language = Objective-C +package = platform.UniformTypeIdentifiers + +modules = UniformTypeIdentifiers +compilerOpts = -framework UniformTypeIdentifiers +linkerOpts = -framework UniformTypeIdentifiers diff --git a/kotlin-native/platformLibs/src/platform/osx/UserNotificationsUI.def b/kotlin-native/platformLibs/src/platform/osx/UserNotificationsUI.def new file mode 100644 index 00000000000..64f21391ba9 --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/UserNotificationsUI.def @@ -0,0 +1,7 @@ +depends = AppKit ApplicationServices CFNetwork CoreData CoreFoundation CoreGraphics CoreImage CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix +language = Objective-C +package = platform.UserNotificationsUI + +modules = UserNotificationsUI +compilerOpts = -framework UserNotificationsUI +linkerOpts = -framework UserNotificationsUI diff --git a/kotlin-native/platformLibs/src/platform/osx/Virtualization.def b/kotlin-native/platformLibs/src/platform/osx/Virtualization.def new file mode 100644 index 00000000000..e98dbae523d --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/Virtualization.def @@ -0,0 +1,7 @@ +depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreServices CoreText DiskArbitration Foundation IOKit ImageIO Security darwin libkern osx posix +language = Objective-C +package = platform.Virtualization + +modules = Virtualization +compilerOpts = -framework Virtualization +linkerOpts = -framework Virtualization diff --git a/kotlin-native/platformLibs/src/platform/osx/Vision.def b/kotlin-native/platformLibs/src/platform/osx/Vision.def index d826d9910ae..873f6a4967f 100644 --- a/kotlin-native/platformLibs/src/platform/osx/Vision.def +++ b/kotlin-native/platformLibs/src/platform/osx/Vision.def @@ -1,4 +1,4 @@ -depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreML CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal Security darwin libkern osx posix +depends = ApplicationServices CFNetwork CoreAudio CoreAudioTypes CoreFoundation CoreGraphics CoreML CoreMedia CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon Security darwin libkern osx posix language = Objective-C package = platform.Vision modules = Vision diff --git a/kotlin-native/platformLibs/src/platform/osx/WidgetKit.def.disabled b/kotlin-native/platformLibs/src/platform/osx/WidgetKit.def.disabled new file mode 100644 index 00000000000..756bdd1b054 --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/WidgetKit.def.disabled @@ -0,0 +1,7 @@ +language = Objective-C +package = platform.WidgetKit + +modules = WidgetKit +compilerOpts = -framework WidgetKit +linkerOpts = -framework WidgetKit +#Disabled: Swift-only framework diff --git a/kotlin-native/platformLibs/src/platform/osx/_AVKit_SwiftUI.def.disabled b/kotlin-native/platformLibs/src/platform/osx/_AVKit_SwiftUI.def.disabled new file mode 100644 index 00000000000..bcffa40a5be --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/_AVKit_SwiftUI.def.disabled @@ -0,0 +1,7 @@ +language = Objective-C +package = platform._AVKit_SwiftUI + +modules = _AVKit_SwiftUI +compilerOpts = -framework _AVKit_SwiftUI +linkerOpts = -framework _AVKit_SwiftUI +#Disabled: Unavailable diff --git a/kotlin-native/platformLibs/src/platform/osx/_AuthenticationServices_SwiftUI.def.disabled b/kotlin-native/platformLibs/src/platform/osx/_AuthenticationServices_SwiftUI.def.disabled new file mode 100644 index 00000000000..7603315dedf --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/_AuthenticationServices_SwiftUI.def.disabled @@ -0,0 +1,7 @@ +language = Objective-C +package = platform._AuthenticationServices_SwiftUI + +modules = _AuthenticationServices_SwiftUI +compilerOpts = -framework _AuthenticationServices_SwiftUI +linkerOpts = -framework _AuthenticationServices_SwiftUI +#Disabled: Unavailable diff --git a/kotlin-native/platformLibs/src/platform/osx/_MapKit_SwiftUI.def.disabled b/kotlin-native/platformLibs/src/platform/osx/_MapKit_SwiftUI.def.disabled new file mode 100644 index 00000000000..6afbcd4c255 --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/_MapKit_SwiftUI.def.disabled @@ -0,0 +1,7 @@ +language = Objective-C +package = platform._MapKit_SwiftUI + +modules = _MapKit_SwiftUI +compilerOpts = -framework _MapKit_SwiftUI +linkerOpts = -framework _MapKit_SwiftUI +#Disabled: Unavailable diff --git a/kotlin-native/platformLibs/src/platform/osx/_QuickLook_SwiftUI.def.disabled b/kotlin-native/platformLibs/src/platform/osx/_QuickLook_SwiftUI.def.disabled new file mode 100644 index 00000000000..0baedbbb5dc --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/_QuickLook_SwiftUI.def.disabled @@ -0,0 +1,7 @@ +language = Objective-C +package = platform._QuickLook_SwiftUI + +modules = _QuickLook_SwiftUI +compilerOpts = -framework _QuickLook_SwiftUI +linkerOpts = -framework _QuickLook_SwiftUI +#Disabled: Unavailable diff --git a/kotlin-native/platformLibs/src/platform/osx/_SceneKit_SwiftUI.def.disabled b/kotlin-native/platformLibs/src/platform/osx/_SceneKit_SwiftUI.def.disabled new file mode 100644 index 00000000000..0ea23caa342 --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/_SceneKit_SwiftUI.def.disabled @@ -0,0 +1,7 @@ +language = Objective-C +package = platform._SceneKit_SwiftUI + +modules = _SceneKit_SwiftUI +compilerOpts = -framework _SceneKit_SwiftUI +linkerOpts = -framework _SceneKit_SwiftUI +#Disabled: Unavailable diff --git a/kotlin-native/platformLibs/src/platform/osx/_SpriteKit_SwiftUI.def.disabled b/kotlin-native/platformLibs/src/platform/osx/_SpriteKit_SwiftUI.def.disabled new file mode 100644 index 00000000000..a4620674ea3 --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/_SpriteKit_SwiftUI.def.disabled @@ -0,0 +1,7 @@ +language = Objective-C +package = platform._SpriteKit_SwiftUI + +modules = _SpriteKit_SwiftUI +compilerOpts = -framework _SpriteKit_SwiftUI +linkerOpts = -framework _SpriteKit_SwiftUI +#Disabled: Unavailable diff --git a/kotlin-native/platformLibs/src/platform/osx/_StoreKit_SwiftUI.def.disabled b/kotlin-native/platformLibs/src/platform/osx/_StoreKit_SwiftUI.def.disabled new file mode 100644 index 00000000000..ec91849bcb0 --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/_StoreKit_SwiftUI.def.disabled @@ -0,0 +1,7 @@ +language = Objective-C +package = platform._StoreKit_SwiftUI + +modules = _StoreKit_SwiftUI +compilerOpts = -framework _StoreKit_SwiftUI +linkerOpts = -framework _StoreKit_SwiftUI +#Disabled: Unavailable diff --git a/kotlin-native/platformLibs/src/platform/osx/darwin.def b/kotlin-native/platformLibs/src/platform/osx/darwin.def index 1046f7be415..0c1da24ad94 100644 --- a/kotlin-native/platformLibs/src/platform/osx/darwin.def +++ b/kotlin-native/platformLibs/src/platform/osx/darwin.def @@ -36,7 +36,8 @@ excludedFunctions = __tg_promote KERNEL_AUDIT_TOKEN KERNEL_SECURITY_TOKEN \ DebugStr Debugger SysBreak SysBreakFunc SysBreakStr clock_get_res clock_set_res \ mach_vm_region_info mach_vm_region_info_64 os_trace_info_with_payload safe_gets \ task_wire vm_map_64 vm_map_exec_lockdown vm_mapped_pages_info vm_region vm_region_recurse \ - xpc_debugger_api_misuse_info + xpc_debugger_api_misuse_info \ + vm_stats compilerOpts = -D_XOPEN_SOURCE -DSHARED_LIBBIND -D_DARWIN_NO_64_BIT_INODE -DSYSCTL_DEF_ENABLED linkerOpts = -ldl -lz -lcurses -lbz2 -lcompression -late -lbsm From ebae52e2fbdc72f9f15d2a4d2b6563195f665df1 Mon Sep 17 00:00:00 2001 From: Alexander Shabalin Date: Tue, 1 Dec 2020 11:42:25 +0300 Subject: [PATCH 647/698] Fix globals registry (#4557) * Fix GlobalsRegistry * Make Runtime tests on Windows faster --- .../runtime/src/main/cpp/CleanerTest.cpp | 3 +- .../runtime/src/main/cpp/MultiSourceQueue.hpp | 36 +++- .../src/main/cpp/MultiSourceQueueTest.cpp | 160 +++++++++++++++--- .../src/main/cpp/SingleLockListTest.cpp | 22 ++- .../runtime/src/main/cpp/TestSupport.hpp | 15 ++ .../runtime/src/mm/cpp/GlobalsRegistry.cpp | 5 +- .../runtime/src/mm/cpp/GlobalsRegistry.hpp | 19 ++- .../runtime/src/mm/cpp/ThreadData.hpp | 9 +- 8 files changed, 219 insertions(+), 50 deletions(-) create mode 100644 kotlin-native/runtime/src/main/cpp/TestSupport.hpp diff --git a/kotlin-native/runtime/src/main/cpp/CleanerTest.cpp b/kotlin-native/runtime/src/main/cpp/CleanerTest.cpp index 4861b9b455f..ca36bcd109a 100644 --- a/kotlin-native/runtime/src/main/cpp/CleanerTest.cpp +++ b/kotlin-native/runtime/src/main/cpp/CleanerTest.cpp @@ -12,6 +12,7 @@ #include "gtest/gtest.h" #include "Atomic.h" +#include "TestSupport.hpp" #include "TestSupportCompilerGenerated.hpp" using testing::_; @@ -21,7 +22,7 @@ using testing::_; TEST(CleanerTest, ConcurrentCreation) { ResetCleanerWorkerForTests(); - constexpr int threadCount = 100; + constexpr int threadCount = kotlin::kDefaultThreadCount; constexpr KInt workerId = 42; auto createCleanerWorkerMock = ScopedCreateCleanerWorkerMock(); diff --git a/kotlin-native/runtime/src/main/cpp/MultiSourceQueue.hpp b/kotlin-native/runtime/src/main/cpp/MultiSourceQueue.hpp index cafcf355dee..1a514855141 100644 --- a/kotlin-native/runtime/src/main/cpp/MultiSourceQueue.hpp +++ b/kotlin-native/runtime/src/main/cpp/MultiSourceQueue.hpp @@ -7,6 +7,9 @@ #define RUNTIME_MULTI_SOURCE_QUEUE_H #include +#include + +#include "Mutex.hpp" namespace kotlin { @@ -16,27 +19,50 @@ class MultiSourceQueue { public: class Producer { public: + explicit Producer(MultiSourceQueue& owner) noexcept : owner_(owner) {} + + ~Producer() { Publish(); } + void Insert(const T& value) noexcept { queue_.push_back(value); } + // Merge `this` queue with owning `MultiSourceQueue`. `this` will have empty queue after the call. + // This call is performed without heap allocations. TODO: Test that no allocations are happening. + void Publish() noexcept { owner_.Collect(*this); } + private: friend class MultiSourceQueue; + MultiSourceQueue& owner_; // weak std::list queue_; }; using Iterator = typename std::list::iterator; - Iterator begin() noexcept { return commonQueue_.begin(); } - Iterator end() noexcept { return commonQueue_.end(); } + class Iterable : MoveOnly { + public: + explicit Iterable(MultiSourceQueue& owner) noexcept : owner_(owner), guard_(owner_.mutex_) {} - // Merge `producer`s queue with `this`. `producer` will have empty queue after the call. - // This call is performed without heap allocations. TODO: Test that no allocations are happening. - void Collect(Producer* producer) noexcept { commonQueue_.splice(commonQueue_.end(), producer->queue_); } + Iterator begin() noexcept { return owner_.commonQueue_.begin(); } + Iterator end() noexcept { return owner_.commonQueue_.end(); } + + private: + MultiSourceQueue& owner_; // weak + std::unique_lock guard_; + }; + + // Lock MultiSourceQueue for safe iteration. + Iterable Iter() noexcept { return Iterable(*this); } private: + void Collect(Producer& producer) noexcept { + std::lock_guard guard(mutex_); + commonQueue_.splice(commonQueue_.end(), producer.queue_); + } + // Using `std::list` as it allows to implement `Collect` without memory allocations, // which is important for GC mark phase. std::list commonQueue_; + SimpleMutex mutex_; }; } // namespace kotlin diff --git a/kotlin-native/runtime/src/main/cpp/MultiSourceQueueTest.cpp b/kotlin-native/runtime/src/main/cpp/MultiSourceQueueTest.cpp index e6622edc099..60d8e81fa66 100644 --- a/kotlin-native/runtime/src/main/cpp/MultiSourceQueueTest.cpp +++ b/kotlin-native/runtime/src/main/cpp/MultiSourceQueueTest.cpp @@ -5,9 +5,14 @@ #include "MultiSourceQueue.hpp" +#include +#include + #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "TestSupport.hpp" + using namespace kotlin; using IntQueue = MultiSourceQueue; @@ -16,74 +21,187 @@ TEST(MultiSourceQueueTest, Empty) { IntQueue queue; std::vector actual; - for (int element : queue) { + for (int element : queue.Iter()) { actual.push_back(element); } EXPECT_THAT(actual, testing::IsEmpty()); } -TEST(MultiSourceQueueTest, DoNotCollect) { +TEST(MultiSourceQueueTest, DoNotPublish) { IntQueue queue; - IntQueue::Producer producer; + IntQueue::Producer producer(queue); producer.Insert(1); producer.Insert(2); std::vector actual; - for (int element : queue) { + for (int element : queue.Iter()) { actual.push_back(element); } EXPECT_THAT(actual, testing::IsEmpty()); } -TEST(MultiSourceQueueTest, Collect) { +TEST(MultiSourceQueueTest, Publish) { IntQueue queue; - IntQueue::Producer producer1; - IntQueue::Producer producer2; + IntQueue::Producer producer1(queue); + IntQueue::Producer producer2(queue); producer1.Insert(1); producer1.Insert(2); producer2.Insert(10); producer2.Insert(20); - queue.Collect(&producer1); - queue.Collect(&producer2); + producer1.Publish(); + producer2.Publish(); std::vector actual; - for (int element : queue) { + for (int element : queue.Iter()) { actual.push_back(element); } EXPECT_THAT(actual, testing::ElementsAre(1, 2, 10, 20)); } -TEST(MultiSourceQueueTest, CollectSeveralTimes) { +TEST(MultiSourceQueueTest, PublishSeveralTimes) { IntQueue queue; - IntQueue::Producer producer; + IntQueue::Producer producer(queue); - // Add 2 elements and collect. + // Add 2 elements and publish. producer.Insert(1); producer.Insert(2); - queue.Collect(&producer); + producer.Publish(); - // Add another element and collect. + // Add another element and publish. producer.Insert(3); - queue.Collect(&producer); + producer.Publish(); - // Collect without adding elements. - queue.Collect(&producer); + // Publish without adding elements. + producer.Publish(); - // Add yet another two elements and collect. + // Add yet another two elements and publish. producer.Insert(4); producer.Insert(5); - queue.Collect(&producer); + producer.Publish(); std::vector actual; - for (int element : queue) { + for (int element : queue.Iter()) { actual.push_back(element); } EXPECT_THAT(actual, testing::ElementsAre(1, 2, 3, 4, 5)); } + +TEST(MultiSourceQueueTest, PublishInDestructor) { + IntQueue queue; + + { + IntQueue::Producer producer(queue); + producer.Insert(1); + producer.Insert(2); + } + + std::vector actual; + for (int element : queue.Iter()) { + actual.push_back(element); + } + + EXPECT_THAT(actual, testing::ElementsAre(1, 2)); +} + +TEST(MultiSourceQueueTest, ConcurrentPublish) { + IntQueue queue; + constexpr int kThreadCount = kDefaultThreadCount; + std::atomic canStart(false); + std::atomic readyCount(0); + std::vector threads; + std::vector expected; + + for (int i = 0; i < kThreadCount; ++i) { + expected.push_back(i); + threads.emplace_back([i, &queue, &canStart, &readyCount]() { + IntQueue::Producer producer(queue); + producer.Insert(i); + ++readyCount; + while (!canStart) { + } + producer.Publish(); + }); + } + + while (readyCount < kThreadCount) { + } + canStart = true; + for (auto& t : threads) { + t.join(); + } + + std::vector actual; + for (int element : queue.Iter()) { + actual.push_back(element); + } + + EXPECT_THAT(actual, testing::UnorderedElementsAreArray(expected)); +} + +TEST(MultiSourceQueueTest, IterWhileConcurrentPublish) { + IntQueue queue; + constexpr int kStartCount = 50; + constexpr int kThreadCount = kDefaultThreadCount; + + std::vector expectedBefore; + std::vector expectedAfter; + IntQueue::Producer producer(queue); + for (int i = 0; i < kStartCount; ++i) { + expectedBefore.push_back(i); + expectedAfter.push_back(i); + producer.Insert(i); + } + producer.Publish(); + + std::atomic canStart(false); + std::atomic readyCount(0); + std::atomic startedCount(0); + std::vector threads; + for (int i = 0; i < kThreadCount; ++i) { + int j = i + kStartCount; + expectedAfter.push_back(j); + threads.emplace_back([j, &queue, &canStart, &startedCount, &readyCount]() { + IntQueue::Producer producer(queue); + producer.Insert(j); + ++readyCount; + while (!canStart) { + } + ++startedCount; + producer.Publish(); + }); + } + + std::vector actualBefore; + { + auto iter = queue.Iter(); + while (readyCount < kThreadCount) { + } + canStart = true; + while (startedCount < kThreadCount) { + } + + for (int element : iter) { + actualBefore.push_back(element); + } + } + + for (auto& t : threads) { + t.join(); + } + + EXPECT_THAT(actualBefore, testing::ElementsAreArray(expectedBefore)); + + std::vector actualAfter; + for (int element : queue.Iter()) { + actualAfter.push_back(element); + } + + EXPECT_THAT(actualAfter, testing::UnorderedElementsAreArray(expectedAfter)); +} diff --git a/kotlin-native/runtime/src/main/cpp/SingleLockListTest.cpp b/kotlin-native/runtime/src/main/cpp/SingleLockListTest.cpp index 2fd1d93b338..480056ac12f 100644 --- a/kotlin-native/runtime/src/main/cpp/SingleLockListTest.cpp +++ b/kotlin-native/runtime/src/main/cpp/SingleLockListTest.cpp @@ -12,6 +12,8 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "TestSupport.hpp" + using namespace kotlin; namespace { @@ -105,19 +107,23 @@ TEST(SingleLockListTest, EraseToEmptyEmplaceAndIter) { TEST(SingleLockListTest, ConcurrentEmplace) { IntList list; - constexpr int kThreadCount = 100; + constexpr int kThreadCount = kDefaultThreadCount; std::atomic canStart(false); + std::atomic readyCount(0); std::vector threads; std::vector expected; for (int i = 0; i < kThreadCount; ++i) { expected.push_back(i); - threads.emplace_back([i, &list, &canStart]() { + threads.emplace_back([i, &list, &canStart, &readyCount]() { + ++readyCount; while (!canStart) { } list.Emplace(i); }); } + while (readyCount < kThreadCount) { + } canStart = true; for (auto& t : threads) { t.join(); @@ -133,22 +139,26 @@ TEST(SingleLockListTest, ConcurrentEmplace) { TEST(SingleLockListTest, ConcurrentErase) { IntList list; - constexpr int kThreadCount = 100; + constexpr int kThreadCount = kDefaultThreadCount; std::vector items; for (int i = 0; i < kThreadCount; ++i) { items.push_back(list.Emplace(i)); } std::atomic canStart(false); + std::atomic readyCount(0); std::vector threads; for (auto* item : items) { - threads.emplace_back([item, &list, &canStart]() { + threads.emplace_back([item, &list, &canStart, &readyCount]() { + ++readyCount; while (!canStart) { } list.Erase(item); }); } + while (readyCount < kThreadCount) { + } canStart = true; for (auto& t : threads) { t.join(); @@ -165,7 +175,7 @@ TEST(SingleLockListTest, ConcurrentErase) { TEST(SingleLockListTest, IterWhileConcurrentEmplace) { IntList list; constexpr int kStartCount = 50; - constexpr int kThreadCount = 100; + constexpr int kThreadCount = kDefaultThreadCount; std::deque expectedBefore; std::vector expectedAfter; @@ -217,7 +227,7 @@ TEST(SingleLockListTest, IterWhileConcurrentEmplace) { TEST(SingleLockListTest, IterWhileConcurrentErase) { IntList list; - constexpr int kThreadCount = 100; + constexpr int kThreadCount = kDefaultThreadCount; std::deque expectedBefore; std::vector items; diff --git a/kotlin-native/runtime/src/main/cpp/TestSupport.hpp b/kotlin-native/runtime/src/main/cpp/TestSupport.hpp new file mode 100644 index 00000000000..521a7d93951 --- /dev/null +++ b/kotlin-native/runtime/src/main/cpp/TestSupport.hpp @@ -0,0 +1,15 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the LICENSE file. + */ + +namespace kotlin { + +#if KONAN_WINDOWS +// TODO: Figure out why creating many threads on windows is so slow. +constexpr int kDefaultThreadCount = 10; +#else +constexpr int kDefaultThreadCount = 100; +#endif + +} // namespace kotlin diff --git a/kotlin-native/runtime/src/mm/cpp/GlobalsRegistry.cpp b/kotlin-native/runtime/src/mm/cpp/GlobalsRegistry.cpp index 96f80fd9ea4..74c89ea7747 100644 --- a/kotlin-native/runtime/src/mm/cpp/GlobalsRegistry.cpp +++ b/kotlin-native/runtime/src/mm/cpp/GlobalsRegistry.cpp @@ -18,12 +18,11 @@ mm::GlobalsRegistry& mm::GlobalsRegistry::Instance() noexcept { } void mm::GlobalsRegistry::RegisterStorageForGlobal(mm::ThreadData* threadData, ObjHeader** location) noexcept { - threadData->globalsThreadQueue()->Insert(location); + threadData->globalsThreadQueue().Insert(location); } void mm::GlobalsRegistry::ProcessThread(mm::ThreadData* threadData) noexcept { - RuntimeAssert(threadData->isWaitingForGC(), "Thread must be waiting for GC to complete."); - globals_.Collect(threadData->globalsThreadQueue()); + threadData->globalsThreadQueue().Publish(); } mm::GlobalsRegistry::GlobalsRegistry() = default; diff --git a/kotlin-native/runtime/src/mm/cpp/GlobalsRegistry.hpp b/kotlin-native/runtime/src/mm/cpp/GlobalsRegistry.hpp index 5cb77c91128..580ddf74ce4 100644 --- a/kotlin-native/runtime/src/mm/cpp/GlobalsRegistry.hpp +++ b/kotlin-native/runtime/src/mm/cpp/GlobalsRegistry.hpp @@ -16,24 +16,29 @@ namespace mm { class GlobalsRegistry : Pinned { public: - using ThreadQueue = MultiSourceQueue::Producer; + class ThreadQueue : public MultiSourceQueue::Producer { + public: + explicit ThreadQueue(GlobalsRegistry& registry) : Producer(registry.globals_) {} + // Do not add fields as this is just a wrapper and Producer does not have virtual destructor. + }; - using Iterator = std::list::iterator; + using Iterable = MultiSourceQueue::Iterable; + + using Iterator = MultiSourceQueue::Iterator; static GlobalsRegistry& Instance() noexcept; void RegisterStorageForGlobal(mm::ThreadData* threadData, ObjHeader** location) noexcept; - // Collect globals from thread corresponding to `threadData`. Thread must be waiting for GC. - // Only one thread can call this method. + // Collect globals from thread corresponding to `threadData`. Must be called by the thread + // when it's asked by GC to stop. void ProcessThread(mm::ThreadData* threadData) noexcept; - // These must be called on the same thread as `ProcessThread` to avoid races. + // Lock registry for safe iteration. // TODO: Iteration over `globals_` will be slow, because it's `std::list` collected at different times from // different threads, and so the nodes are all over the memory. Use metrics to understand how // much of a problem is it. - Iterator begin() noexcept { return globals_.begin(); } - Iterator end() noexcept { return globals_.end(); } + Iterable Iter() noexcept { return globals_.Iter(); } private: friend class GlobalData; diff --git a/kotlin-native/runtime/src/mm/cpp/ThreadData.hpp b/kotlin-native/runtime/src/mm/cpp/ThreadData.hpp index 82a89c3c3f2..cecf7cdb2d6 100644 --- a/kotlin-native/runtime/src/mm/cpp/ThreadData.hpp +++ b/kotlin-native/runtime/src/mm/cpp/ThreadData.hpp @@ -19,18 +19,13 @@ namespace mm { // Pin it in memory to prevent accidental copying. class ThreadData final : private Pinned { public: - ThreadData(pthread_t threadId) noexcept : threadId_(threadId) {} + ThreadData(pthread_t threadId) noexcept : threadId_(threadId), globalsThreadQueue_(GlobalsRegistry::Instance()) {} ~ThreadData() = default; pthread_t threadId() const noexcept { return threadId_; } - bool isWaitingForGC() const noexcept { - // TODO: Implement. - return false; - } - - GlobalsRegistry::ThreadQueue* globalsThreadQueue() noexcept { return &globalsThreadQueue_; } + GlobalsRegistry::ThreadQueue& globalsThreadQueue() noexcept { return globalsThreadQueue_; } ThreadLocalStorage& tls() noexcept { return tls_; } From 28ea767570710cb82120548a4bef53d2c61e91b4 Mon Sep 17 00:00:00 2001 From: Alexander Shabalin Date: Tue, 1 Dec 2020 12:49:18 +0300 Subject: [PATCH 648/698] Build Render on demand (#4564) --- .../tools/benchmarksAnalyzer/src/main/kotlin/main.kt | 4 ++-- .../src/main/kotlin/org/jetbrains/renders/Render.kt | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/kotlin-native/tools/benchmarksAnalyzer/src/main/kotlin/main.kt b/kotlin-native/tools/benchmarksAnalyzer/src/main/kotlin/main.kt index 4f3647dec04..250ee8283b2 100644 --- a/kotlin-native/tools/benchmarksAnalyzer/src/main/kotlin/main.kt +++ b/kotlin-native/tools/benchmarksAnalyzer/src/main/kotlin/main.kt @@ -169,7 +169,7 @@ fun main(args: Array) { var outputFile = output renders.forEach { - it.render.print(summaryReport, useShortForm, outputFile) + it.createRender().print(summaryReport, useShortForm, outputFile) outputFile = null } -} \ No newline at end of file +} diff --git a/kotlin-native/tools/benchmarksAnalyzer/src/main/kotlin/org/jetbrains/renders/Render.kt b/kotlin-native/tools/benchmarksAnalyzer/src/main/kotlin/org/jetbrains/renders/Render.kt index b0eb0fa1e8c..eda8ddb085e 100644 --- a/kotlin-native/tools/benchmarksAnalyzer/src/main/kotlin/org/jetbrains/renders/Render.kt +++ b/kotlin-native/tools/benchmarksAnalyzer/src/main/kotlin/org/jetbrains/renders/Render.kt @@ -10,11 +10,11 @@ import org.jetbrains.report.* import kotlin.math.abs -enum class RenderType(val render: Render) { - TEXT(TextRender()), - HTML(HTMLRender()), - TEAMCITY(TeamCityStatisticsRender()), - STATISTICS(StatisticsRender()) +enum class RenderType(val createRender: () -> Render) { + TEXT(::TextRender), + HTML(::HTMLRender), + TEAMCITY(::TeamCityStatisticsRender), + STATISTICS(::StatisticsRender) } // Base class for printing report in different formats. @@ -197,4 +197,4 @@ class TextRender: Render() { it.key !in report.improvements.keys }) } } -} \ No newline at end of file +} From 3cd335c1c532765b1fdcbebd473b66d483454b05 Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov Date: Tue, 1 Dec 2020 11:50:35 +0300 Subject: [PATCH 649/698] Bump konanVersion: 1.5.0 --- kotlin-native/gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kotlin-native/gradle.properties b/kotlin-native/gradle.properties index a15f8a213d3..06c624a8074 100644 --- a/kotlin-native/gradle.properties +++ b/kotlin-native/gradle.properties @@ -24,7 +24,7 @@ kotlinStdlibRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildT kotlinStdlibVersion=1.4.30-dev-3308 kotlinStdlibTestsVersion=1.4.30-dev-3308 testKotlinCompilerVersion=1.4.30-dev-3308 -konanVersion=1.4.30 +konanVersion=1.5.0 # A version of Xcode required to build the Kotlin/Native compiler. xcodeMajorVersion=12 From e2cbe5377613af663b7b50441c575ac3885e001b Mon Sep 17 00:00:00 2001 From: Igor Chevdar Date: Tue, 1 Dec 2020 18:14:32 +0500 Subject: [PATCH 650/698] [IR] Supported value classes --- .../kotlin/backend/konan/InlineClasses.kt | 5 +++-- .../konan/lower/BuiltinOperatorLowering.kt | 2 +- .../backend.native/tests/build.gradle | 4 ++++ .../tests/codegen/inlineClass/valueClass0.kt | 20 +++++++++++++++++++ 4 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 kotlin-native/backend.native/tests/codegen/inlineClass/valueClass0.kt diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/InlineClasses.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/InlineClasses.kt index af230bc662e..d7d3e3ca1f5 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/InlineClasses.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/InlineClasses.kt @@ -29,6 +29,7 @@ import org.jetbrains.kotlin.name.FqNameUnsafe import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe import org.jetbrains.kotlin.resolve.descriptorUtil.getAllSuperClassifiers +import org.jetbrains.kotlin.resolve.isInlineClass import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.isNullable import org.jetbrains.kotlin.types.typeUtil.makeNullable @@ -254,7 +255,7 @@ internal object KotlinTypeInlineClassesSupport : InlineClassesSupport Date: Wed, 2 Dec 2020 11:51:20 +0300 Subject: [PATCH 651/698] Missed enum in videoplayer sample (#4568) --- .../videoplayer/src/videoPlayerMain/kotlin/VideoPlayer.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/VideoPlayer.kt b/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/VideoPlayer.kt index 7384943787b..d636e972224 100644 --- a/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/VideoPlayer.kt +++ b/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/VideoPlayer.kt @@ -166,7 +166,7 @@ fun main(args: Array) { val argParser = ArgParser("videoplayer") val mode by argParser.option( ArgType.Choice(), shortName = "m", description = "Play mode") - .default(BOTH) + .default(Mode.BOTH) val size by argParser.option(ArgType.Int, shortName = "s", description = "Required size of videoplayer window") .delimiter(",") val fileName by argParser.argument(ArgType.String, description = "File to play") From 0c28396106ee0d2e0e9d2e5836fca2eb68a053b7 Mon Sep 17 00:00:00 2001 From: LepilkinaElena Date: Wed, 2 Dec 2020 22:32:27 +0300 Subject: [PATCH 652/698] Removed extra enum in videoplayer sample (#4571) --- .../src/videoPlayerMain/kotlin/VideoPlayer.kt | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/VideoPlayer.kt b/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/VideoPlayer.kt index d636e972224..75ca8e09c4a 100644 --- a/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/VideoPlayer.kt +++ b/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/VideoPlayer.kt @@ -156,17 +156,11 @@ class VideoPlayer(val requestedSize: Dimensions?) : DisposableContainer() { } } -enum class Mode { - VIDEO, - AUDIO, - BOTH -} - fun main(args: Array) { val argParser = ArgParser("videoplayer") val mode by argParser.option( - ArgType.Choice(), shortName = "m", description = "Play mode") - .default(Mode.BOTH) + ArgType.Choice(), shortName = "m", description = "Play mode") + .default(PlayMode.BOTH) val size by argParser.option(ArgType.Int, shortName = "s", description = "Required size of videoplayer window") .delimiter(",") val fileName by argParser.argument(ArgType.String, description = "File to play") @@ -181,7 +175,7 @@ fun main(args: Array) { Dimensions(size[0], size[1]) val player = VideoPlayer(requestedSize) try { - player.playFile(fileName, PlayMode.valueOf(mode.toUpperCase())) + player.playFile(fileName, mode) } finally { player.dispose() } From cf7a73175fb57164cb8efb8451b8ed69b16308cc Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov <41585329+ddolovov@users.noreply.github.com> Date: Thu, 3 Dec 2020 11:51:31 +0300 Subject: [PATCH 653/698] Minor. Release notes update (#4573) --- kotlin-native/RELEASE_NOTES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kotlin-native/RELEASE_NOTES.md b/kotlin-native/RELEASE_NOTES.md index eeb564ff106..197e982036a 100644 --- a/kotlin-native/RELEASE_NOTES.md +++ b/kotlin-native/RELEASE_NOTES.md @@ -55,7 +55,7 @@ Produced programs are fully self-sufficient and do not need JVM or other runtime On macOS it also requires Xcode 11.0 or newer to be installed. -The language and library version supported by this EAP release match Kotlin 1.3. +The language and library version supported by this release match Kotlin 1.4. However, there are certain limitations, see section [Known Limitations](#limitations). Currently _Kotlin/Native_ uses reference counting based memory management scheme with a cycle From b77a2ba1b486e09729e0351aa7801e2fe410b316 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Thu, 3 Dec 2020 17:28:40 +0700 Subject: [PATCH 654/698] [konan.properties] Add missing sigil --- kotlin-native/konan/konan.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kotlin-native/konan/konan.properties b/kotlin-native/konan/konan.properties index ca93d069d46..313f8f7f956 100644 --- a/kotlin-native/konan/konan.properties +++ b/kotlin-native/konan/konan.properties @@ -540,7 +540,7 @@ linkerKonanFlags.linux_mipsel32 = -Bstatic -lstdc++ -Bdynamic -ldl -lm -lpthread # targetSysroot-relative. libGcc.linux_mipsel32 = lib/gcc/mipsel-unknown-linux-gnu/4.9.4 targetCpu.linux_mipsel32 = mips32r2 -clangFlags.linux_mipsel32 = -cc1 -emit-obj -disable-llvm-optzns -x ir -target-cpu targetCpu.linux_mipsel32 +clangFlags.linux_mipsel32 = -cc1 -emit-obj -disable-llvm-optzns -x ir -target-cpu $targetCpu.linux_mipsel32 clangNooptFlags.linux_mipsel32 = -O1 clangOptFlags.linux_mipsel32 = -O3 -ffunction-sections clangDebugFlags.linux_mipsel32 = -O0 @@ -632,7 +632,7 @@ quadruple.android_x86 = i686-linux-android # by Kotlin and taken from SSE registers by C code. # TODO: once this information is available in function attributes, we can set target CPU to i686. targetCpu.android_x86 = pentium4 -clangFlags.android_x86 = -cc1 -target-cpu targetCpu.android_x86 -emit-obj -disable-llvm-passes -x ir -femulated-tls -mrelocation-model pic +clangFlags.android_x86 = -cc1 -target-cpu $targetCpu.android_x86 -emit-obj -disable-llvm-passes -x ir -femulated-tls -mrelocation-model pic clangOptFlags.android_x86 = -O3 -ffunction-sections clangNooptFlags.android_x86 = -O1 targetSysRoot.android_x86 = target-sysroot-1-android_ndk From 77899446cb2f605c96b9278b20b0afdbf4f54317 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Wed, 2 Dec 2020 19:45:04 +0700 Subject: [PATCH 655/698] Revert "Fix KT-43530" This reverts commit 9c1fc56b --- .../jetbrains/kotlin/backend/konan/ir/Ir.kt | 19 ------------------- .../cenum/CEnumByValueFunctionGenerator.kt | 17 +++++------------ 2 files changed, 5 insertions(+), 31 deletions(-) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/Ir.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/Ir.kt index d53a96c14c8..a4b38853084 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/Ir.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/Ir.kt @@ -25,7 +25,6 @@ import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol -import org.jetbrains.kotlin.ir.types.IrSimpleType import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.types.typeWith import org.jetbrains.kotlin.ir.util.* @@ -111,24 +110,6 @@ internal class KonanSymbols( } }.toMap() - private val binaryOperatorCache = mutableMapOf, IrSimpleFunctionSymbol>() - - /** - * A less restrictive version of [getBinaryOperator] that should be used when symbols might not be bound yet. - * Note that it is a hack that will be removed in a foreseeable future. Consider using [getBinaryOperator] instead. - * - * TODO: Remove with [org.jetbrains.kotlin.backend.konan.ir.interop.cenum.CEnumByValueFunctionGenerator]. - */ - fun getBinaryOperatorMaybeUnbound(name: Name, lhsType: KotlinType, rhsType: KotlinType): IrSimpleFunctionSymbol { - val key = Triple(name, lhsType, rhsType) - return binaryOperatorCache.getOrPut(key) { - symbolTable.referenceSimpleFunction( - lhsType.memberScope.getContributedFunctions(name, NoLookupLocation.FROM_BACKEND) - .first { it.valueParameters.size == 1 && it.valueParameters[0].type == rhsType } - ) - } - } - val arrayList = symbolTable.referenceClass(getArrayListClassDescriptor(context)) val symbolName = topLevelClass(RuntimeNames.symbolNameAnnotation) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumByValueFunctionGenerator.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumByValueFunctionGenerator.kt index 0bfe0b46307..ea65b605557 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumByValueFunctionGenerator.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumByValueFunctionGenerator.kt @@ -56,29 +56,22 @@ internal class CEnumByValueFunctionGenerator( val values = irTemporary(irCall(valuesIrFunctionSymbol), isMutable = true) val inductionVariable = irTemporary(irInt(0), isMutable = true) val arrayClass = values.type.classOrNull!! - val valuesSize = IrCallImpl.fromSymbolDescriptor( - startOffset, endOffset, irBuiltIns.intType, symbols.arraySize.getValue(arrayClass) - ).also { irCall -> + val valuesSize = irCall(symbols.arraySize.getValue(arrayClass), irBuiltIns.intType).also { irCall -> irCall.dispatchReceiver = irGet(values) } val getElementFn = symbols.arrayGet.getValue(arrayClass) - val plusFun = symbols.getBinaryOperatorMaybeUnbound(OperatorNameConventions.PLUS, irBuiltIns.int, irBuiltIns.int) + val plusFun = symbols.getBinaryOperator(OperatorNameConventions.PLUS, irBuiltIns.intType, irBuiltIns.intType) val lessFunctionSymbol = irBuiltIns.lessFunByOperandType.getValue(irBuiltIns.intClass) +irWhile().also { loop -> - loop.condition = IrCallImpl.fromSymbolDescriptor( - startOffset, endOffset, irBuiltIns.booleanType, lessFunctionSymbol - ).also { irCall -> + loop.condition = irCall(lessFunctionSymbol, irBuiltIns.booleanType).also { irCall -> irCall.putValueArgument(0, irGet(inductionVariable)) irCall.putValueArgument(1, valuesSize) } loop.body = irBlock { - val temporaryValue = IrCallImpl.fromSymbolDescriptor( - startOffset, endOffset,byValueIrFunction.returnType, getElementFn - ).also { irCall -> + val entry = irTemporary(irCall(getElementFn, byValueIrFunction.returnType).also { irCall -> irCall.dispatchReceiver = irGet(values) irCall.putValueArgument(0, irGet(inductionVariable)) - } - val entry = irTemporary(temporaryValue, isMutable = true) + }, isMutable = true) val valueGetter = entry.type.getClass()!!.getPropertyGetter("value")!! val entryValue = irGet(irValueParameter.type, irGet(entry), valueGetter) +irIfThenElse( From b68a934d88966dc6faf78cff4fa9d0feb449e6f6 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Wed, 2 Dec 2020 19:44:32 +0700 Subject: [PATCH 656/698] Proper fix for interop enum and struct generation Current approach to generate interop enum and structs during linkage stage turned out to be fragile. We might get unbound wrapper descriptors which are useless for function body generation. The solution is to postpone body generation until linkage step is complete. --- .../jetbrains/kotlin/backend/konan/PsiToIr.kt | 5 ++ .../interop/DescriptorToIrTranslationUtils.kt | 6 ++ .../IrProviderForCEnumAndCStructStubs.kt | 18 ++++- .../cenum/CEnumByValueFunctionGenerator.kt | 77 ++++++++++--------- .../ir/interop/cenum/CEnumClassGenerator.kt | 64 +++++++++------ .../interop/cenum/CEnumCompanionGenerator.kt | 20 +++-- .../interop/cenum/CEnumVarClassGenerator.kt | 33 ++++---- .../cstruct/CStructVarClassGenerator.kt | 22 +++--- .../cstruct/CStructVarCompanionGenerator.kt | 19 +++-- 9 files changed, 164 insertions(+), 100 deletions(-) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/PsiToIr.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/PsiToIr.kt index 882b92d5d45..3b82f92092f 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/PsiToIr.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/PsiToIr.kt @@ -133,6 +133,11 @@ internal fun Context.psiToIr( modulesWithoutDCE .filter(ModuleDescriptor::isFromInteropLibrary) .forEach(irProviderForCEnumsAndCStructs::referenceAllEnumsAndStructsFrom) + + + translator.addPostprocessingStep { + irProviderForCEnumsAndCStructs.generateBodies() + } } } diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/DescriptorToIrTranslationUtils.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/DescriptorToIrTranslationUtils.kt index f9391b4cda4..3e6228e3679 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/DescriptorToIrTranslationUtils.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/DescriptorToIrTranslationUtils.kt @@ -41,6 +41,12 @@ internal interface DescriptorToIrTranslationMixin { val typeTranslator: TypeTranslator + val postLinkageSteps: MutableList<() -> Unit> + + fun invokePostLinkageSteps() { + postLinkageSteps.forEach { it() } + } + fun KotlinType.toIrType() = typeTranslator.translateType(this) /** diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/IrProviderForCEnumAndCStructStubs.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/IrProviderForCEnumAndCStructStubs.kt index 3b24ca60afc..a6911a068b6 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/IrProviderForCEnumAndCStructStubs.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/IrProviderForCEnumAndCStructStubs.kt @@ -13,6 +13,7 @@ import org.jetbrains.kotlin.backend.konan.ir.interop.cenum.CEnumClassGenerator import org.jetbrains.kotlin.backend.konan.ir.interop.cenum.CEnumCompanionGenerator import org.jetbrains.kotlin.backend.konan.ir.interop.cenum.CEnumVarClassGenerator import org.jetbrains.kotlin.backend.konan.ir.interop.cstruct.CStructVarClassGenerator +import org.jetbrains.kotlin.backend.konan.ir.interop.cstruct.CStructVarCompanionGenerator import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.symbols.* @@ -50,8 +51,10 @@ internal class IrProviderForCEnumAndCStructStubs( CEnumVarClassGenerator(context, interopBuiltIns) private val cEnumClassGenerator = CEnumClassGenerator(context, cEnumCompanionGenerator, cEnumVarClassGenerator) + private val cStructCompanionGenerator = + CStructVarCompanionGenerator(context, interopBuiltIns) private val cStructClassGenerator = - CStructVarClassGenerator(context, interopBuiltIns) + CStructVarClassGenerator(context, interopBuiltIns, cStructCompanionGenerator) fun isCEnumOrCStruct(declarationDescriptor: DeclarationDescriptor): Boolean = declarationDescriptor.run { findCEnumDescriptor(interopBuiltIns) ?: findCStructDescriptor(interopBuiltIns) } != null @@ -73,6 +76,19 @@ internal class IrProviderForCEnumAndCStructStubs( } } + /** + * We postpone generation of bodies until IR linkage is complete. + * This way we ensure that all used symbols are resolved. + */ + fun generateBodies() { + cEnumCompanionGenerator.invokePostLinkageSteps() + cEnumByValueFunctionGenerator.invokePostLinkageSteps() + cEnumClassGenerator.invokePostLinkageSteps() + cEnumVarClassGenerator.invokePostLinkageSteps() + cStructClassGenerator.invokePostLinkageSteps() + cStructCompanionGenerator.invokePostLinkageSteps() + } + fun getDeclaration(descriptor: DeclarationDescriptor, idSignature: IdSignature, file: IrFile, symbolKind: BinarySymbolData.SymbolKind): IrSymbolOwner { return symbolTable.run { when (symbolKind) { diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumByValueFunctionGenerator.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumByValueFunctionGenerator.kt index ea65b605557..102d4ca4c29 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumByValueFunctionGenerator.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumByValueFunctionGenerator.kt @@ -32,6 +32,7 @@ internal class CEnumByValueFunctionGenerator( override val irBuiltIns: IrBuiltIns = context.irBuiltIns override val symbolTable: SymbolTable = context.symbolTable override val typeTranslator: TypeTranslator = context.typeTranslator + override val postLinkageSteps: MutableList<() -> Unit> = mutableListOf() fun generateByValueFunction( companionIrClass: IrClass, @@ -51,46 +52,48 @@ internal class CEnumByValueFunctionGenerator( // i++ // } // throw NPE - byValueIrFunction.body = irBuilder(irBuiltIns, byValueIrFunction.symbol, SYNTHETIC_OFFSET, SYNTHETIC_OFFSET).irBlockBody { - +irReturn(irBlock { - val values = irTemporary(irCall(valuesIrFunctionSymbol), isMutable = true) - val inductionVariable = irTemporary(irInt(0), isMutable = true) - val arrayClass = values.type.classOrNull!! - val valuesSize = irCall(symbols.arraySize.getValue(arrayClass), irBuiltIns.intType).also { irCall -> - irCall.dispatchReceiver = irGet(values) - } - val getElementFn = symbols.arrayGet.getValue(arrayClass) - val plusFun = symbols.getBinaryOperator(OperatorNameConventions.PLUS, irBuiltIns.intType, irBuiltIns.intType) - val lessFunctionSymbol = irBuiltIns.lessFunByOperandType.getValue(irBuiltIns.intClass) - +irWhile().also { loop -> - loop.condition = irCall(lessFunctionSymbol, irBuiltIns.booleanType).also { irCall -> - irCall.putValueArgument(0, irGet(inductionVariable)) - irCall.putValueArgument(1, valuesSize) + postLinkageSteps.add { + byValueIrFunction.body = irBuilder(irBuiltIns, byValueIrFunction.symbol, SYNTHETIC_OFFSET, SYNTHETIC_OFFSET).irBlockBody { + +irReturn(irBlock { + val values = irTemporary(irCall(valuesIrFunctionSymbol), isMutable = true) + val inductionVariable = irTemporary(irInt(0), isMutable = true) + val arrayClass = values.type.classOrNull!! + val valuesSize = irCall(symbols.arraySize.getValue(arrayClass), irBuiltIns.intType).also { irCall -> + irCall.dispatchReceiver = irGet(values) } - loop.body = irBlock { - val entry = irTemporary(irCall(getElementFn, byValueIrFunction.returnType).also { irCall -> - irCall.dispatchReceiver = irGet(values) + val getElementFn = symbols.arrayGet.getValue(arrayClass) + val plusFun = symbols.getBinaryOperator(OperatorNameConventions.PLUS, irBuiltIns.intType, irBuiltIns.intType) + val lessFunctionSymbol = irBuiltIns.lessFunByOperandType.getValue(irBuiltIns.intClass) + +irWhile().also { loop -> + loop.condition = irCall(lessFunctionSymbol, irBuiltIns.booleanType).also { irCall -> irCall.putValueArgument(0, irGet(inductionVariable)) - }, isMutable = true) - val valueGetter = entry.type.getClass()!!.getPropertyGetter("value")!! - val entryValue = irGet(irValueParameter.type, irGet(entry), valueGetter) - +irIfThenElse( - type = irBuiltIns.unitType, - condition = irEquals(entryValue, irGet(irValueParameter)), - thenPart = irReturn(irGet(entry)), - elsePart = irSetVar( - inductionVariable, - irCallOp(plusFun, irBuiltIns.intType, - irGet(inductionVariable), - irInt(1) - ) - ) - ) + irCall.putValueArgument(1, valuesSize) + } + loop.body = irBlock { + val entry = irTemporary(irCall(getElementFn, byValueIrFunction.returnType).also { irCall -> + irCall.dispatchReceiver = irGet(values) + irCall.putValueArgument(0, irGet(inductionVariable)) + }, isMutable = true) + val valueGetter = entry.type.getClass()!!.getPropertyGetter("value")!! + val entryValue = irGet(irValueParameter.type, irGet(entry), valueGetter) + +irIfThenElse( + type = irBuiltIns.unitType, + condition = irEquals(entryValue, irGet(irValueParameter)), + thenPart = irReturn(irGet(entry)), + elsePart = irSetVar( + inductionVariable, + irCallOp(plusFun, irBuiltIns.intType, + irGet(inductionVariable), + irInt(1) + ) + ) + ) + } } - } - +IrCallImpl.fromSymbolDescriptor(startOffset, endOffset, irBuiltIns.nothingType, - symbols.throwNullPointerException) - }) + +IrCallImpl.fromSymbolOwner(startOffset, endOffset, irBuiltIns.nothingType, + symbols.throwNullPointerException) + }) + } } return byValueIrFunction } diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumClassGenerator.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumClassGenerator.kt index bc2da7010e0..f5758053e79 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumClassGenerator.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumClassGenerator.kt @@ -49,6 +49,7 @@ internal class CEnumClassGenerator( override val irBuiltIns: IrBuiltIns = context.irBuiltIns override val symbolTable: SymbolTable = context.symbolTable override val typeTranslator: TypeTranslator = context.typeTranslator + override val postLinkageSteps: MutableList<() -> Unit> = mutableListOf() private val enumClassMembersGenerator = EnumClassMembersGenerator(DeclarationGenerator(context)) @@ -97,38 +98,46 @@ internal class CEnumClassGenerator( SYNTHETIC_OFFSET, SYNTHETIC_OFFSET, IrDeclarationOrigin.PROPERTY_BACKING_FIELD, propertyDescriptor, propertyDescriptor.type.toIrType(), DescriptorVisibilities.PRIVATE ).also { - it.initializer = irBuilder(irBuiltIns, it.symbol, SYNTHETIC_OFFSET, SYNTHETIC_OFFSET).run { - irExprBody(irGet(irClass.primaryConstructor!!.valueParameters[0])) + postLinkageSteps.add { + it.initializer = irBuilder(irBuiltIns, it.symbol, SYNTHETIC_OFFSET, SYNTHETIC_OFFSET).run { + irExprBody(irGet(irClass.primaryConstructor!!.valueParameters[0])) + } } } } val getter = irProperty.getter!! getter.correspondingPropertySymbol = irProperty.symbol - getter.body = irBuilder(irBuiltIns, getter.symbol, SYNTHETIC_OFFSET, SYNTHETIC_OFFSET).irBlockBody { - +irReturn( - irGetField( - irGet(getter.dispatchReceiverParameter!!), - irProperty.backingField!! - ) - ) + postLinkageSteps.add { + getter.body = irBuilder(irBuiltIns, getter.symbol, SYNTHETIC_OFFSET, SYNTHETIC_OFFSET).irBlockBody { + +irReturn( + irGetField( + irGet(getter.dispatchReceiverParameter!!), + irProperty.backingField!! + ) + ) + } } return irProperty } private fun createEnumEntry(enumDescriptor: ClassDescriptor, entryDescriptor: ClassDescriptor): IrEnumEntry { - return symbolTable.declareEnumEntry( + val enumEntry = symbolTable.declareEnumEntry( SYNTHETIC_OFFSET, SYNTHETIC_OFFSET, IrDeclarationOrigin.IR_EXTERNAL_DECLARATION_STUB, entryDescriptor - ).also { enumEntry -> - enumEntry.initializerExpression = IrExpressionBodyImpl(IrEnumConstructorCallImpl.fromSymbolDescriptor( + ) + val constructorSymbol = symbolTable.referenceConstructor(enumDescriptor.unsubstitutedPrimaryConstructor!!) + postLinkageSteps.add { + enumEntry.initializerExpression = IrExpressionBodyImpl(IrEnumConstructorCallImpl( SYNTHETIC_OFFSET, SYNTHETIC_OFFSET, type = irBuiltIns.unitType, - symbol = symbolTable.referenceConstructor(enumDescriptor.unsubstitutedPrimaryConstructor!!), - typeArgumentsCount = 0 // enums can't be generic + symbol = constructorSymbol, + typeArgumentsCount = 0, + valueArgumentsCount = constructorSymbol.owner.valueParameters.size ).also { it.putValueArgument(0, extractEnumEntryValue(entryDescriptor)) }) } + return enumEntry } /** @@ -146,16 +155,23 @@ internal class CEnumClassGenerator( private fun createEnumPrimaryConstructor(descriptor: ClassDescriptor): IrConstructor { val irConstructor = createConstructor(descriptor.unsubstitutedPrimaryConstructor!!) val enumConstructor = context.builtIns.enum.constructors.single() - irConstructor.body = irBuilder(irBuiltIns, irConstructor.symbol, SYNTHETIC_OFFSET, SYNTHETIC_OFFSET).irBlockBody { - +IrEnumConstructorCallImpl.fromSymbolDescriptor( - startOffset, endOffset, - context.irBuiltIns.unitType, - symbolTable.referenceConstructor(enumConstructor), - typeArgumentsCount = 1 // kotlin.Enum has a single type parameter. - ).apply { - putTypeArgument(0, descriptor.defaultType.toIrType()) - } - +irInstanceInitializer(symbolTable.referenceClass(descriptor)) + val constructorSymbol = symbolTable.referenceConstructor(enumConstructor) + val classSymbol = symbolTable.referenceClass(descriptor) + val type = descriptor.defaultType.toIrType() + postLinkageSteps.add { + irConstructor.body = irBuilder(irBuiltIns, irConstructor.symbol, SYNTHETIC_OFFSET, SYNTHETIC_OFFSET) + .irBlockBody { + +IrEnumConstructorCallImpl( + startOffset, endOffset, + context.irBuiltIns.unitType, + constructorSymbol, + typeArgumentsCount = 1, // kotlin.Enum has a single type parameter. + valueArgumentsCount = constructorSymbol.owner.valueParameters.size + ).apply { + putTypeArgument(0, type) + } + +irInstanceInitializer(classSymbol) + } } return irConstructor } diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumCompanionGenerator.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumCompanionGenerator.kt index f90f2ffefd2..27dfbad5ebc 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumCompanionGenerator.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumCompanionGenerator.kt @@ -32,6 +32,7 @@ internal class CEnumCompanionGenerator( override val irBuiltIns: IrBuiltIns = context.irBuiltIns override val symbolTable: SymbolTable = context.symbolTable override val typeTranslator: TypeTranslator = context.typeTranslator + override val postLinkageSteps: MutableList<() -> Unit> = mutableListOf() // Depends on already generated `.values()` irFunction. fun generate(enumClass: IrClass): IrClass = @@ -50,13 +51,16 @@ internal class CEnumCompanionGenerator( private fun createCompanionConstructor(companionObjectDescriptor: ClassDescriptor): IrConstructor { val anyPrimaryConstructor = companionObjectDescriptor.builtIns.any.unsubstitutedPrimaryConstructor!! val superConstructorSymbol = symbolTable.referenceConstructor(anyPrimaryConstructor) + val classSymbol = symbolTable.referenceClass(companionObjectDescriptor) return createConstructor(companionObjectDescriptor.unsubstitutedPrimaryConstructor!!).also { - it.body = irBuilder(irBuiltIns, it.symbol, SYNTHETIC_OFFSET, SYNTHETIC_OFFSET).irBlockBody { - +IrDelegatingConstructorCallImpl.fromSymbolDescriptor( - startOffset, endOffset, context.irBuiltIns.unitType, - superConstructorSymbol - ) - +irInstanceInitializer(symbolTable.referenceClass(companionObjectDescriptor)) + postLinkageSteps.add { + it.body = irBuilder(irBuiltIns, it.symbol, SYNTHETIC_OFFSET, SYNTHETIC_OFFSET).irBlockBody { + +IrDelegatingConstructorCallImpl.fromSymbolOwner( + startOffset, endOffset, context.irBuiltIns.unitType, + superConstructorSymbol + ) + +irInstanceInitializer(classSymbol) + } } } } @@ -88,7 +92,9 @@ internal class CEnumCompanionGenerator( private fun declareEntryAliasProperty(propertyDescriptor: PropertyDescriptor, enumClass: IrClass): IrProperty { val entrySymbol = fundCorrespondingEnumEntrySymbol(propertyDescriptor, enumClass) return createProperty(propertyDescriptor).also { - it.getter!!.body = generateAliasGetterBody(it.getter!!, entrySymbol, enumClass) + postLinkageSteps.add { + it.getter!!.body = generateAliasGetterBody(it.getter!!, entrySymbol, enumClass) + } } } } \ No newline at end of file diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumVarClassGenerator.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumVarClassGenerator.kt index 5cea0c767f9..3fa40489289 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumVarClassGenerator.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumVarClassGenerator.kt @@ -34,6 +34,7 @@ internal class CEnumVarClassGenerator( override val irBuiltIns: IrBuiltIns = context.irBuiltIns override val symbolTable: SymbolTable = context.symbolTable override val typeTranslator: TypeTranslator = context.typeTranslator + override val postLinkageSteps: MutableList<() -> Unit> = mutableListOf() fun generate(enumIrClass: IrClass): IrClass { val enumVarClassDescriptor = enumIrClass.descriptor.unsubstitutedMemberScope @@ -56,13 +57,16 @@ internal class CEnumVarClassGenerator( val enumVarConstructorSymbol = symbolTable.referenceConstructor( interopBuiltIns.cEnumVar.unsubstitutedPrimaryConstructor!! ) - irConstructor.body = irBuilder(irBuiltIns, irConstructor.symbol, SYNTHETIC_OFFSET, SYNTHETIC_OFFSET).irBlockBody { - +IrDelegatingConstructorCallImpl.fromSymbolDescriptor( - startOffset, endOffset, context.irBuiltIns.unitType, enumVarConstructorSymbol - ).also { - it.putValueArgument(0, irGet(irConstructor.valueParameters[0])) + val classSymbol = symbolTable.referenceClass(enumVarClass.descriptor) + postLinkageSteps.add { + irConstructor.body = irBuilder(irBuiltIns, irConstructor.symbol, SYNTHETIC_OFFSET, SYNTHETIC_OFFSET).irBlockBody { + +IrDelegatingConstructorCallImpl.fromSymbolOwner( + startOffset, endOffset, context.irBuiltIns.unitType, enumVarConstructorSymbol + ).also { + it.putValueArgument(0, irGet(irConstructor.valueParameters[0])) + } + +irInstanceInitializer(classSymbol) } - +irInstanceInitializer(symbolTable.referenceClass(enumVarClass.descriptor)) } return irConstructor } @@ -77,15 +81,18 @@ internal class CEnumVarClassGenerator( private fun createCompanionConstructor(companionObjectDescriptor: ClassDescriptor, typeSize: Int): IrConstructor { val superConstructorSymbol = symbolTable.referenceConstructor(interopBuiltIns.cPrimitiveVarType.unsubstitutedPrimaryConstructor!!) + val classSymbol = symbolTable.referenceClass(companionObjectDescriptor) return createConstructor(companionObjectDescriptor.unsubstitutedPrimaryConstructor!!).also { - it.body = irBuilder(irBuiltIns, it.symbol, SYNTHETIC_OFFSET, SYNTHETIC_OFFSET).irBlockBody { - +IrDelegatingConstructorCallImpl.fromSymbolDescriptor( - startOffset, endOffset, context.irBuiltIns.unitType, - superConstructorSymbol - ).also { - it.putValueArgument(0, irInt(typeSize)) + postLinkageSteps.add { + it.body = irBuilder(irBuiltIns, it.symbol, SYNTHETIC_OFFSET, SYNTHETIC_OFFSET).irBlockBody { + +IrDelegatingConstructorCallImpl.fromSymbolOwner( + startOffset, endOffset, context.irBuiltIns.unitType, + superConstructorSymbol + ).also { + it.putValueArgument(0, irInt(typeSize)) + } + +irInstanceInitializer(classSymbol) } - +irInstanceInitializer(symbolTable.referenceClass(companionObjectDescriptor)) } } } diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cstruct/CStructVarClassGenerator.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cstruct/CStructVarClassGenerator.kt index e844c8aa444..bedb27332f4 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cstruct/CStructVarClassGenerator.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cstruct/CStructVarClassGenerator.kt @@ -23,14 +23,14 @@ import org.jetbrains.kotlin.psi2ir.generators.GeneratorContext internal class CStructVarClassGenerator( context: GeneratorContext, - private val interopBuiltIns: InteropBuiltIns + private val interopBuiltIns: InteropBuiltIns, + private val companionGenerator: CStructVarCompanionGenerator ) : DescriptorToIrTranslationMixin { override val irBuiltIns: IrBuiltIns = context.irBuiltIns override val symbolTable: SymbolTable = context.symbolTable override val typeTranslator: TypeTranslator = context.typeTranslator - - private val companionGenerator = CStructVarCompanionGenerator(context, interopBuiltIns) + override val postLinkageSteps: MutableList<() -> Unit> = mutableListOf() fun findOrGenerateCStruct(classDescriptor: ClassDescriptor, parent: IrDeclarationContainer): IrClass { val irClassSymbol = symbolTable.referenceClass(classDescriptor) @@ -61,14 +61,16 @@ internal class CStructVarClassGenerator( interopBuiltIns.cStructVar.unsubstitutedPrimaryConstructor!! ) return createConstructor(irClass.descriptor.unsubstitutedPrimaryConstructor!!).also { irConstructor -> - irConstructor.body = irBuilder(irBuiltIns, irConstructor.symbol, SYNTHETIC_OFFSET, SYNTHETIC_OFFSET).irBlockBody { - +IrDelegatingConstructorCallImpl.fromSymbolDescriptor( - startOffset, endOffset, - context.irBuiltIns.unitType, enumVarConstructorSymbol - ).also { - it.putValueArgument(0, irGet(irConstructor.valueParameters[0])) + postLinkageSteps.add { + irConstructor.body = irBuilder(irBuiltIns, irConstructor.symbol, SYNTHETIC_OFFSET, SYNTHETIC_OFFSET).irBlockBody { + +IrDelegatingConstructorCallImpl.fromSymbolOwner( + startOffset, endOffset, + context.irBuiltIns.unitType, enumVarConstructorSymbol + ).also { + it.putValueArgument(0, irGet(irConstructor.valueParameters[0])) + } + +irInstanceInitializer(symbolTable.referenceClass(irClass.descriptor)) } - +irInstanceInitializer(symbolTable.referenceClass(irClass.descriptor)) } } } diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cstruct/CStructVarCompanionGenerator.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cstruct/CStructVarCompanionGenerator.kt index 133df36ea76..95d1a9defd9 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cstruct/CStructVarCompanionGenerator.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cstruct/CStructVarCompanionGenerator.kt @@ -32,6 +32,7 @@ internal class CStructVarCompanionGenerator( override val irBuiltIns: IrBuiltIns = context.irBuiltIns override val symbolTable: SymbolTable = context.symbolTable override val typeTranslator: TypeTranslator = context.typeTranslator + override val postLinkageSteps: MutableList<() -> Unit> = mutableListOf() fun generate(structDescriptor: ClassDescriptor): IrClass = createClass(structDescriptor.companionObjectDescriptor!!) { companionIrClass -> @@ -45,15 +46,17 @@ internal class CStructVarCompanionGenerator( private fun createCompanionConstructor(companionObjectDescriptor: ClassDescriptor, size: Long, align: Int): IrConstructor { val superConstructorSymbol = symbolTable.referenceConstructor(interopBuiltIns.cStructVarType.unsubstitutedPrimaryConstructor!!) return createConstructor(companionObjectDescriptor.unsubstitutedPrimaryConstructor!!).also { irConstructor -> - irConstructor.body = irBuilder(irBuiltIns, irConstructor.symbol, SYNTHETIC_OFFSET, SYNTHETIC_OFFSET).irBlockBody { - +IrDelegatingConstructorCallImpl.fromSymbolDescriptor( - startOffset, endOffset, context.irBuiltIns.unitType, - superConstructorSymbol - ).also { - it.putValueArgument(0, irLong(size)) - it.putValueArgument(1, irInt(align)) + postLinkageSteps.add { + irConstructor.body = irBuilder(irBuiltIns, irConstructor.symbol, SYNTHETIC_OFFSET, SYNTHETIC_OFFSET).irBlockBody { + +IrDelegatingConstructorCallImpl.fromSymbolOwner( + startOffset, endOffset, context.irBuiltIns.unitType, + superConstructorSymbol + ).also { + it.putValueArgument(0, irLong(size)) + it.putValueArgument(1, irInt(align)) + } + +irInstanceInitializer(symbolTable.referenceClass(companionObjectDescriptor)) } - +irInstanceInitializer(symbolTable.referenceClass(companionObjectDescriptor)) } } } From 55b1e0faf022cfe20212b03ee1269349061a5628 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Mon, 30 Nov 2020 17:21:34 +0700 Subject: [PATCH 657/698] [konan.properties] Make gccToolchain a target property Previously, we used the same gccToolchain for all linux-based targets. It is dangerous because sysroot and toolchain might be incompatible. Since c82b843e we moved to unified and reproducible way to build toolchains, so we have a separate gccToolchain for each target. --- kotlin-native/konan/konan.properties | 10 ++++++++-- .../org/jetbrains/kotlin/konan/target/Configurables.kt | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/kotlin-native/konan/konan.properties b/kotlin-native/konan/konan.properties index 313f8f7f956..9e91f37974b 100644 --- a/kotlin-native/konan/konan.properties +++ b/kotlin-native/konan/konan.properties @@ -375,13 +375,11 @@ dependencies.linux_x64 = \ libffi-3.2.1-2-linux-x86-64 \ lldb-3-linux -gccToolchain.mingw_x64 = target-gcc-toolchain-3-linux-x86-64 targetToolchain.mingw_x64-linux_x64 = msys2-mingw-w64-x86_64-clang-llvm-lld-compiler_rt-8.0.1 dependencies.mingw_x64-linux_x64 = \ libffi-3.2.1-mingw-w64-x86-64 \ target-gcc-toolchain-3-linux-x86-64 -gccToolchain.macos_x64 = target-gcc-toolchain-3-linux-x86-64 targetToolchain.macos_x64-linux_x64 = $llvmHome.macos_x64 dependencies.macos_x64-linux_x64 = \ libffi-3.2.1-3-darwin-macos \ @@ -409,6 +407,8 @@ runtimeDefinitions.linux_x64 = USE_GCC_UNWIND=1 KONAN_LINUX=1 KONAN_X64=1 \ USE_ELF_SYMBOLS=1 ELFSIZE=64 KONAN_HAS_CXX11_EXCEPTION_FUNCTIONS=1 # Raspberry Pi +gccToolchain.linux_arm32_hfp = target-gcc-toolchain-3-linux-x86-64 + targetToolchain.linux_x64-linux_arm32_hfp = target-gcc-toolchain-3-linux-x86-64/x86_64-unknown-linux-gnu targetToolchain.mingw_x64-linux_arm32_hfp = msys2-mingw-w64-x86_64-clang-llvm-lld-compiler_rt-8.0.1 targetToolchain.macos_x64-linux_arm32_hfp = $llvmHome.macos_x64 @@ -452,6 +452,8 @@ runtimeDefinitions.linux_arm32_hfp = USE_GCC_UNWIND=1 KONAN_LINUX=1 \ KONAN_ARM32=1 USE_ELF_SYMBOLS=1 ELFSIZE=32 KONAN_NO_UNALIGNED_ACCESS=1 # Linux arm64 +gccToolchain.linux_arm64 = target-gcc-toolchain-3-linux-x86-64 + targetToolchain.linux_x64-linux_arm64 = target-gcc-toolchain-3-linux-x86-64/x86_64-unknown-linux-gnu targetToolchain.mingw_x64-linux_arm64 = msys2-mingw-w64-x86_64-clang-llvm-lld-compiler_rt-8.0.1 targetToolchain.macos_x64-linux_arm64 = $llvmHome.macos_x64 @@ -494,6 +496,8 @@ runtimeDefinitions.linux_arm64 = USE_GCC_UNWIND=1 KONAN_LINUX=1 KONAN_ARM64=1 \ USE_ELF_SYMBOLS=1 ELFSIZE=64 # MIPS +gccToolchain.linux_mips32 = target-gcc-toolchain-3-linux-x86-64 + targetToolchain.linux_x64-linux_mips32 = target-gcc-toolchain-2-linux-mips/x86_64-unknown-linux-gnu dependencies.linux_x64-linux_mips32 = \ target-gcc-toolchain-2-linux-mips \ @@ -524,6 +528,8 @@ runtimeDefinitions.linux_mips32 = USE_GCC_UNWIND=1 KONAN_LINUX=1 KONAN_MIPS32=1 USE_ELF_SYMBOLS=1 ELFSIZE=32 KONAN_NO_64BIT_ATOMIC=1 KONAN_NO_UNALIGNED_ACCESS=1 # MIPSel +gccToolchain.linux_mipsel32 = target-gcc-toolchain-3-linux-x86-64 + targetToolchain.linux_x64-linux_mipsel32 = target-gcc-toolchain-2-linux-mips/x86_64-unknown-linux-gnu dependencies.linux_x64-linux_mipsel32 = \ target-gcc-toolchain-2-linux-mips \ diff --git a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Configurables.kt b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Configurables.kt index 1aea7b129bb..4caea4e26ad 100644 --- a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Configurables.kt +++ b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Configurables.kt @@ -75,7 +75,7 @@ interface AppleConfigurables : Configurables, ClangFlags { interface MingwConfigurables : TargetableConfigurables, ClangFlags interface GccConfigurables : TargetableConfigurables, ClangFlags { - val gccToolchain get() = hostString("gccToolchain") + val gccToolchain get() = targetString("gccToolchain") val absoluteGccToolchain get() = absolute(gccToolchain) val libGcc get() = targetString("libGcc")!! From c779ce2e6df25c606845a4f904ddf2fa38f7c61f Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Mon, 30 Nov 2020 17:52:10 +0700 Subject: [PATCH 658/698] Minor refactoring and reformatting of ClangArgs --- .../kotlin/konan/target/ClangArgs.kt | 264 ++++++++++-------- 1 file changed, 146 insertions(+), 118 deletions(-) diff --git a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt index 9216ffcda4e..a68cf734494 100644 --- a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt +++ b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt @@ -33,151 +33,179 @@ internal object Android { class ClangArgs(private val configurables: Configurables) : Configurables by configurables { - val targetArg = if (configurables is TargetableConfigurables) + private val targetArg = if (configurables is TargetableConfigurables) configurables.targetArg else null + private val clangArgsSpecificForKonanSources + get() = runtimeDefinitions.map { "-D$it" } + + private val binDir = when (HostManager.host) { + KonanTarget.LINUX_X64 -> "$absoluteTargetToolchain/bin" + KonanTarget.MINGW_X64 -> "$absoluteTargetToolchain/bin" + KonanTarget.MACOS_X64 -> "$absoluteTargetToolchain/usr/bin" + else -> throw TargetSupportException("Unexpected host platform") + } + + // TODO: Use buildList + private val commonClangArgs: List = mutableListOf>().apply { + add(listOf("-B$binDir", "-fno-stack-protector")) + if (configurables is GccConfigurables) { + add(listOf("--gcc-toolchain=${configurables.absoluteGccToolchain}")) + } + if (configurables is TargetableConfigurables) { + add(listOf("-target", configurables.targetArg!!)) + } + }.flatten() + private val osVersionMin: String get() { require(configurables is AppleConfigurables) return configurables.osVersionMin } - val specificClangArgs: List - get() { - val result = when (target) { - KonanTarget.LINUX_X64 -> - listOf("--sysroot=$absoluteTargetSysRoot") + - if (target != host) listOf("-target", targetArg!!) else emptyList() + private val specificClangArgs: List = when (target) { + KonanTarget.LINUX_X64 -> listOf( + "--sysroot=$absoluteTargetSysRoot", + ) - KonanTarget.LINUX_ARM32_HFP -> - listOf("-target", targetArg!!, - "-mfpu=vfp", "-mfloat-abi=hard", - "--sysroot=$absoluteTargetSysRoot", - // TODO: those two are hacks. - "-I$absoluteTargetSysRoot/usr/include/c++/4.8.3", - "-I$absoluteTargetSysRoot/usr/include/c++/4.8.3/arm-linux-gnueabihf") + KonanTarget.LINUX_ARM32_HFP -> listOf( + "-mfpu=vfp", "-mfloat-abi=hard", + "--sysroot=$absoluteTargetSysRoot", + // TODO: those two are hacks. + "-I$absoluteTargetSysRoot/usr/include/c++/4.8.3", + "-I$absoluteTargetSysRoot/usr/include/c++/4.8.3/arm-linux-gnueabihf" + ) - KonanTarget.LINUX_ARM64 -> - listOf("-target", targetArg!!, - "--sysroot=$absoluteTargetSysRoot", - "-I$absoluteTargetSysRoot/usr/include/c++/7", - "-I$absoluteTargetSysRoot/usr/include/c++/7/aarch64-linux-gnu") + KonanTarget.LINUX_ARM64 -> listOf( + "--sysroot=$absoluteTargetSysRoot", + "-I$absoluteTargetSysRoot/usr/include/c++/7", + "-I$absoluteTargetSysRoot/usr/include/c++/7/aarch64-linux-gnu" + ) - KonanTarget.LINUX_MIPS32 -> - listOf("-target", targetArg!!, - "--sysroot=$absoluteTargetSysRoot", - "-I$absoluteTargetSysRoot/usr/include/c++/4.9.4", - "-I$absoluteTargetSysRoot/usr/include/c++/4.9.4/mips-unknown-linux-gnu") + KonanTarget.LINUX_MIPS32 -> listOf( + "--sysroot=$absoluteTargetSysRoot", + "-I$absoluteTargetSysRoot/usr/include/c++/4.9.4", + "-I$absoluteTargetSysRoot/usr/include/c++/4.9.4/mips-unknown-linux-gnu" + ) - KonanTarget.LINUX_MIPSEL32 -> - listOf("-target", targetArg!!, - "--sysroot=$absoluteTargetSysRoot", - "-I$absoluteTargetSysRoot/usr/include/c++/4.9.4", - "-I$absoluteTargetSysRoot/usr/include/c++/4.9.4/mipsel-unknown-linux-gnu") + KonanTarget.LINUX_MIPSEL32 -> listOf( + "--sysroot=$absoluteTargetSysRoot", + "-I$absoluteTargetSysRoot/usr/include/c++/4.9.4", + "-I$absoluteTargetSysRoot/usr/include/c++/4.9.4/mipsel-unknown-linux-gnu" + ) - KonanTarget.MINGW_X64, KonanTarget.MINGW_X86 -> - listOf("-target", targetArg!!, "--sysroot=$absoluteTargetSysRoot", "-Xclang", "-flto-visibility-public-std") + KonanTarget.MINGW_X64, KonanTarget.MINGW_X86 -> listOf( + "--sysroot=$absoluteTargetSysRoot", "-Xclang", + "-flto-visibility-public-std" + ) - KonanTarget.MACOS_X64 -> - listOf("--sysroot=$absoluteTargetSysRoot", "-mmacosx-version-min=$osVersionMin") + KonanTarget.MACOS_X64 -> listOf( + "--sysroot=$absoluteTargetSysRoot", + "-mmacosx-version-min=$osVersionMin" + ) - KonanTarget.IOS_ARM32 -> - listOf("-stdlib=libc++", "-arch", "armv7", "-isysroot", absoluteTargetSysRoot, "-miphoneos-version-min=$osVersionMin") + KonanTarget.IOS_ARM32 -> listOf( + "-stdlib=libc++", + "-arch", "armv7", + "-isysroot", absoluteTargetSysRoot, + "-miphoneos-version-min=$osVersionMin" + ) - KonanTarget.IOS_ARM64 -> - listOf("-stdlib=libc++", "-arch", "arm64", "-isysroot", absoluteTargetSysRoot, "-miphoneos-version-min=$osVersionMin") + KonanTarget.IOS_ARM64 -> listOf( + "-stdlib=libc++", + "-arch", "arm64", + "-isysroot", absoluteTargetSysRoot, + "-miphoneos-version-min=$osVersionMin" + ) - KonanTarget.IOS_X64 -> - listOf("-stdlib=libc++", "-isysroot", absoluteTargetSysRoot, "-miphoneos-version-min=$osVersionMin") + KonanTarget.IOS_X64 -> listOf( + "-stdlib=libc++", + "-isysroot", absoluteTargetSysRoot, + "-miphoneos-version-min=$osVersionMin" + ) - KonanTarget.TVOS_ARM64 -> - listOf("-stdlib=libc++", "-arch", "arm64", "-isysroot", absoluteTargetSysRoot, "-mtvos-version-min=$osVersionMin") + KonanTarget.TVOS_ARM64 -> listOf( + "-stdlib=libc++", + "-arch", "arm64", + "-isysroot", absoluteTargetSysRoot, + "-mtvos-version-min=$osVersionMin" + ) - KonanTarget.TVOS_X64 -> - listOf("-stdlib=libc++", "-isysroot", absoluteTargetSysRoot, "-mtvos-simulator-version-min=$osVersionMin") + KonanTarget.TVOS_X64 -> listOf( + "-stdlib=libc++", + "-isysroot", absoluteTargetSysRoot, + "-mtvos-simulator-version-min=$osVersionMin" + ) - KonanTarget.WATCHOS_ARM64, - KonanTarget.WATCHOS_ARM32 -> - listOf("-stdlib=libc++", "-arch", "armv7k", "-isysroot", absoluteTargetSysRoot, "-mwatchos-version-min=$osVersionMin") + KonanTarget.WATCHOS_ARM64, + KonanTarget.WATCHOS_ARM32 -> listOf( + "-stdlib=libc++", + "-arch", "armv7k", + "-isysroot", absoluteTargetSysRoot, + "-mwatchos-version-min=$osVersionMin" + ) - KonanTarget.WATCHOS_X86 -> - listOf("-stdlib=libc++", "-arch", "i386", "-isysroot", absoluteTargetSysRoot, "-mwatchos-simulator-version-min=$osVersionMin") + KonanTarget.WATCHOS_X86 -> listOf( + "-stdlib=libc++", + "-arch", "i386", + "-isysroot", absoluteTargetSysRoot, + "-mwatchos-simulator-version-min=$osVersionMin" + ) - KonanTarget.WATCHOS_X64 -> - listOf("-stdlib=libc++", "-isysroot", absoluteTargetSysRoot, "-mwatchos-simulator-version-min=$osVersionMin") + KonanTarget.WATCHOS_X64 -> listOf( + "-stdlib=libc++", + "-isysroot", absoluteTargetSysRoot, + "-mwatchos-simulator-version-min=$osVersionMin" + ) - KonanTarget.ANDROID_ARM32, KonanTarget.ANDROID_ARM64, - KonanTarget.ANDROID_X86, KonanTarget.ANDROID_X64 -> { - val clangTarget = targetArg!! - val architectureDir = Android.architectureDirForTarget(target) - val toolchainSysroot = "$absoluteTargetToolchain/sysroot" - listOf("-target", clangTarget, - "-D__ANDROID_API__=${Android.API}", - "--sysroot=$absoluteTargetSysRoot/$architectureDir", - "-I$toolchainSysroot/usr/include/c++/v1", - "-I$toolchainSysroot/usr/include", - "-I$toolchainSysroot/usr/include/$clangTarget") - } - - // By default WASM target forces `hidden` visibility which causes linkage problems. - KonanTarget.WASM32 -> - listOf("-target", targetArg!!, - "-fno-rtti", - "-fno-exceptions", - "-fvisibility=default", - "-D_LIBCPP_ABI_VERSION=2", - "-D_LIBCPP_NO_EXCEPTIONS=1", - "-nostdinc", - "-Xclang", "-nobuiltininc", - "-Xclang", "-nostdsysteminc", - "-Xclang", "-isystem$absoluteTargetSysRoot/include/libcxx", - "-Xclang", "-isystem$absoluteTargetSysRoot/lib/libcxxabi/include", - "-Xclang", "-isystem$absoluteTargetSysRoot/include/compat", - "-Xclang", "-isystem$absoluteTargetSysRoot/include/libc") - - is KonanTarget.ZEPHYR -> - listOf("-target", targetArg!!, - "-fno-rtti", - "-fno-exceptions", - "-fno-asynchronous-unwind-tables", - "-fno-pie", - "-fno-pic", - "-fshort-enums", - "-nostdinc", - // TODO: make it a libGcc property? - // We need to get rid of wasm sysroot first. - "-isystem $targetToolchain/../lib/gcc/arm-none-eabi/7.2.1/include", - "-isystem $targetToolchain/../lib/gcc/arm-none-eabi/7.2.1/include-fixed", - "-isystem$absoluteTargetSysRoot/include/libcxx", - "-isystem$absoluteTargetSysRoot/include/libc" - ) + - (configurables as ZephyrConfigurables).constructClangArgs() - } - return result + KonanTarget.ANDROID_ARM32, KonanTarget.ANDROID_ARM64, + KonanTarget.ANDROID_X86, KonanTarget.ANDROID_X64 -> { + val clangTarget = targetArg!! + val architectureDir = Android.architectureDirForTarget(target) + val toolchainSysroot = "$absoluteTargetToolchain/sysroot" + listOf( + "-D__ANDROID_API__=${Android.API}", + "--sysroot=$absoluteTargetSysRoot/$architectureDir", + "-I$toolchainSysroot/usr/include/c++/v1", + "-I$toolchainSysroot/usr/include", + "-I$toolchainSysroot/usr/include/$clangTarget" + ) } - val clangArgsSpecificForKonanSources - get() = runtimeDefinitions.map { "-D$it" } + // By default WASM target forces `hidden` visibility which causes linkage problems. + KonanTarget.WASM32 -> listOf( + "-fno-rtti", + "-fno-exceptions", + "-fvisibility=default", + "-D_LIBCPP_ABI_VERSION=2", + "-D_LIBCPP_NO_EXCEPTIONS=1", + "-nostdinc", + "-Xclang", "-nobuiltininc", + "-Xclang", "-nostdsysteminc", + "-Xclang", "-isystem$absoluteTargetSysRoot/include/libcxx", + "-Xclang", "-isystem$absoluteTargetSysRoot/lib/libcxxabi/include", + "-Xclang", "-isystem$absoluteTargetSysRoot/include/compat", + "-Xclang", "-isystem$absoluteTargetSysRoot/include/libc" + ) - private val host = HostManager.host - - private val binDir = when (host) { - KonanTarget.LINUX_X64 -> "$absoluteTargetToolchain/bin" - KonanTarget.MINGW_X64 -> "$absoluteTargetToolchain/bin" - KonanTarget.MACOS_X64 -> "$absoluteTargetToolchain/usr/bin" - else -> throw TargetSupportException("Unexpected host platform") + is KonanTarget.ZEPHYR -> listOf( + "-fno-rtti", + "-fno-exceptions", + "-fno-asynchronous-unwind-tables", + "-fno-pie", + "-fno-pic", + "-fshort-enums", + "-nostdinc", + // TODO: make it a libGcc property? + // We need to get rid of wasm sysroot first. + "-isystem $targetToolchain/../lib/gcc/arm-none-eabi/7.2.1/include", + "-isystem $targetToolchain/../lib/gcc/arm-none-eabi/7.2.1/include-fixed", + "-isystem$absoluteTargetSysRoot/include/libcxx", + "-isystem$absoluteTargetSysRoot/include/libc" + ) + (configurables as ZephyrConfigurables).constructClangArgs() } - private val extraHostClangArgs = - if (configurables is GccConfigurables) { - listOf("--gcc-toolchain=${configurables.absoluteGccToolchain}") - } else { - emptyList() - } - - val commonClangArgs = listOf("-B$binDir", "-fno-stack-protector") + extraHostClangArgs - val clangPaths = listOf("$absoluteLlvmHome/bin", binDir) private val jdkDir by lazy { @@ -202,10 +230,10 @@ class ClangArgs(private val configurables: Configurables) : Configurables by con // We workaround the problem with -isystem flag below. listOf("-isystem", "$absoluteLlvmHome/lib/clang/$llvmVersion/include", *clangArgs) - val targetClangCmd + private val targetClangCmd = listOf("${absoluteLlvmHome}/bin/clang") + clangArgs - val targetClangXXCmd + private val targetClangXXCmd = listOf("${absoluteLlvmHome}/bin/clang++") + clangArgs fun clangC(vararg userArgs: String) = targetClangCmd + userArgs.asList() From 23223f7bb0f24dbeb61eb7b65bc20af24f1394d7 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Mon, 30 Nov 2020 17:54:27 +0700 Subject: [PATCH 659/698] [ClangArgs] use --sysroot for all targets Change `-isysroot` to `--sysroot` because it is the same thing on darwin targets. --- .../jetbrains/kotlin/konan/target/ClangArgs.kt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt index a68cf734494..e44867f8aca 100644 --- a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt +++ b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt @@ -108,33 +108,33 @@ class ClangArgs(private val configurables: Configurables) : Configurables by con KonanTarget.IOS_ARM32 -> listOf( "-stdlib=libc++", "-arch", "armv7", - "-isysroot", absoluteTargetSysRoot, + "--sysroot=$absoluteTargetSysRoot", "-miphoneos-version-min=$osVersionMin" ) KonanTarget.IOS_ARM64 -> listOf( "-stdlib=libc++", "-arch", "arm64", - "-isysroot", absoluteTargetSysRoot, + "--sysroot=$absoluteTargetSysRoot", "-miphoneos-version-min=$osVersionMin" ) KonanTarget.IOS_X64 -> listOf( "-stdlib=libc++", - "-isysroot", absoluteTargetSysRoot, + "--sysroot=$absoluteTargetSysRoot", "-miphoneos-version-min=$osVersionMin" ) KonanTarget.TVOS_ARM64 -> listOf( "-stdlib=libc++", "-arch", "arm64", - "-isysroot", absoluteTargetSysRoot, + "--sysroot=$absoluteTargetSysRoot", "-mtvos-version-min=$osVersionMin" ) KonanTarget.TVOS_X64 -> listOf( "-stdlib=libc++", - "-isysroot", absoluteTargetSysRoot, + "--sysroot=$absoluteTargetSysRoot", "-mtvos-simulator-version-min=$osVersionMin" ) @@ -142,20 +142,20 @@ class ClangArgs(private val configurables: Configurables) : Configurables by con KonanTarget.WATCHOS_ARM32 -> listOf( "-stdlib=libc++", "-arch", "armv7k", - "-isysroot", absoluteTargetSysRoot, + "--sysroot=$absoluteTargetSysRoot", "-mwatchos-version-min=$osVersionMin" ) KonanTarget.WATCHOS_X86 -> listOf( "-stdlib=libc++", "-arch", "i386", - "-isysroot", absoluteTargetSysRoot, + "--sysroot=$absoluteTargetSysRoot", "-mwatchos-simulator-version-min=$osVersionMin" ) KonanTarget.WATCHOS_X64 -> listOf( "-stdlib=libc++", - "-isysroot", absoluteTargetSysRoot, + "--sysroot=$absoluteTargetSysRoot", "-mwatchos-simulator-version-min=$osVersionMin" ) From 87e4bbe0f66e35606e0a0b6f8c7e76db4bc7abe0 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Mon, 30 Nov 2020 18:02:43 +0700 Subject: [PATCH 660/698] [ClangArgs] Move sysroot setting to single place --- .../kotlin/konan/target/ClangArgs.kt | 33 ++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt index e44867f8aca..6d45c932707 100644 --- a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt +++ b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt @@ -46,7 +46,6 @@ class ClangArgs(private val configurables: Configurables) : Configurables by con KonanTarget.MACOS_X64 -> "$absoluteTargetToolchain/usr/bin" else -> throw TargetSupportException("Unexpected host platform") } - // TODO: Use buildList private val commonClangArgs: List = mutableListOf>().apply { add(listOf("-B$binDir", "-fno-stack-protector")) @@ -56,6 +55,18 @@ class ClangArgs(private val configurables: Configurables) : Configurables by con if (configurables is TargetableConfigurables) { add(listOf("-target", configurables.targetArg!!)) } + val hasCustomSysroot = configurables is ZephyrConfigurables + || configurables is WasmConfigurables + || configurables is AndroidConfigurables + if (!hasCustomSysroot) { + when (configurables) { + // isysroot and sysroot on darwin are _almost_ synonyms. + // The first one parses SDKSettings.json while second one is not. + is AppleConfigurables -> add(listOf("-isysroot", absoluteTargetSysRoot)) + else -> add(listOf("--sysroot=$absoluteTargetSysRoot")) + } + + } }.flatten() private val osVersionMin: String @@ -65,76 +76,63 @@ class ClangArgs(private val configurables: Configurables) : Configurables by con } private val specificClangArgs: List = when (target) { - KonanTarget.LINUX_X64 -> listOf( - "--sysroot=$absoluteTargetSysRoot", - ) + KonanTarget.LINUX_X64 -> listOf() KonanTarget.LINUX_ARM32_HFP -> listOf( "-mfpu=vfp", "-mfloat-abi=hard", - "--sysroot=$absoluteTargetSysRoot", // TODO: those two are hacks. "-I$absoluteTargetSysRoot/usr/include/c++/4.8.3", "-I$absoluteTargetSysRoot/usr/include/c++/4.8.3/arm-linux-gnueabihf" ) KonanTarget.LINUX_ARM64 -> listOf( - "--sysroot=$absoluteTargetSysRoot", "-I$absoluteTargetSysRoot/usr/include/c++/7", "-I$absoluteTargetSysRoot/usr/include/c++/7/aarch64-linux-gnu" ) KonanTarget.LINUX_MIPS32 -> listOf( - "--sysroot=$absoluteTargetSysRoot", "-I$absoluteTargetSysRoot/usr/include/c++/4.9.4", "-I$absoluteTargetSysRoot/usr/include/c++/4.9.4/mips-unknown-linux-gnu" ) KonanTarget.LINUX_MIPSEL32 -> listOf( - "--sysroot=$absoluteTargetSysRoot", "-I$absoluteTargetSysRoot/usr/include/c++/4.9.4", "-I$absoluteTargetSysRoot/usr/include/c++/4.9.4/mipsel-unknown-linux-gnu" ) KonanTarget.MINGW_X64, KonanTarget.MINGW_X86 -> listOf( - "--sysroot=$absoluteTargetSysRoot", "-Xclang", - "-flto-visibility-public-std" + "-Xclang", "-flto-visibility-public-std" ) KonanTarget.MACOS_X64 -> listOf( - "--sysroot=$absoluteTargetSysRoot", "-mmacosx-version-min=$osVersionMin" ) KonanTarget.IOS_ARM32 -> listOf( "-stdlib=libc++", "-arch", "armv7", - "--sysroot=$absoluteTargetSysRoot", "-miphoneos-version-min=$osVersionMin" ) KonanTarget.IOS_ARM64 -> listOf( "-stdlib=libc++", "-arch", "arm64", - "--sysroot=$absoluteTargetSysRoot", "-miphoneos-version-min=$osVersionMin" ) KonanTarget.IOS_X64 -> listOf( "-stdlib=libc++", - "--sysroot=$absoluteTargetSysRoot", "-miphoneos-version-min=$osVersionMin" ) KonanTarget.TVOS_ARM64 -> listOf( "-stdlib=libc++", "-arch", "arm64", - "--sysroot=$absoluteTargetSysRoot", "-mtvos-version-min=$osVersionMin" ) KonanTarget.TVOS_X64 -> listOf( "-stdlib=libc++", - "--sysroot=$absoluteTargetSysRoot", "-mtvos-simulator-version-min=$osVersionMin" ) @@ -142,20 +140,17 @@ class ClangArgs(private val configurables: Configurables) : Configurables by con KonanTarget.WATCHOS_ARM32 -> listOf( "-stdlib=libc++", "-arch", "armv7k", - "--sysroot=$absoluteTargetSysRoot", "-mwatchos-version-min=$osVersionMin" ) KonanTarget.WATCHOS_X86 -> listOf( "-stdlib=libc++", "-arch", "i386", - "--sysroot=$absoluteTargetSysRoot", "-mwatchos-simulator-version-min=$osVersionMin" ) KonanTarget.WATCHOS_X64 -> listOf( "-stdlib=libc++", - "--sysroot=$absoluteTargetSysRoot", "-mwatchos-simulator-version-min=$osVersionMin" ) From 14617e2fe2bb690830c09accb320091aafadf24a Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Mon, 30 Nov 2020 18:06:15 +0700 Subject: [PATCH 661/698] [MinGW] remove obsolete flag See https://github.com/msys2/MINGW-packages/issues/5321 --- kotlin-native/konan/konan.properties | 4 ++-- .../kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/kotlin-native/konan/konan.properties b/kotlin-native/konan/konan.properties index 9e91f37974b..30e5047ff12 100644 --- a/kotlin-native/konan/konan.properties +++ b/kotlin-native/konan/konan.properties @@ -703,7 +703,7 @@ clangNooptFlags.mingw_x64 = -O1 linkerNoDebugFlags.mingw_x64 = -Wl,-S linkerDynamicFlags.mingw_x64 = -shared linkerKonanFlags.mingw_x64 =-static-libgcc -static-libstdc++ \ - -Xclang -flto-visibility-public-std -Wl,--dynamicbase \ + -Wl,--dynamicbase \ -Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive,-Bdynamic \ -Wl,--defsym,__cxa_demangle=Konan_cxa_demangle linkerOptimizationFlags.mingw_x64 = -Wl,--gc-sections @@ -741,7 +741,7 @@ clangNooptFlags.mingw_x86 = -O1 linkerNoDebugFlags.mingw_x86 = -Wl,-S linkerDynamicFlags.mingw_x86 = -shared linkerKonanFlags.mingw_x86 = -static-libgcc -static-libstdc++ \ - -Xclang -flto-visibility-public-std -Wl,--dynamicbase \ + -Wl,--dynamicbase \ -Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive,-Bdynamic \ -Wl,--defsym,___cxa_demangle=_Konan_cxa_demangle mimallocLinkerDependencies.mingw_x86 = -lbcrypt diff --git a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt index 6d45c932707..fc212cf794d 100644 --- a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt +++ b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt @@ -76,7 +76,7 @@ class ClangArgs(private val configurables: Configurables) : Configurables by con } private val specificClangArgs: List = when (target) { - KonanTarget.LINUX_X64 -> listOf() + KonanTarget.LINUX_X64 -> emptyList() KonanTarget.LINUX_ARM32_HFP -> listOf( "-mfpu=vfp", "-mfloat-abi=hard", @@ -100,9 +100,7 @@ class ClangArgs(private val configurables: Configurables) : Configurables by con "-I$absoluteTargetSysRoot/usr/include/c++/4.9.4/mipsel-unknown-linux-gnu" ) - KonanTarget.MINGW_X64, KonanTarget.MINGW_X86 -> listOf( - "-Xclang", "-flto-visibility-public-std" - ) + KonanTarget.MINGW_X64, KonanTarget.MINGW_X86 -> emptyList() KonanTarget.MACOS_X64 -> listOf( "-mmacosx-version-min=$osVersionMin" From 60c491e000e5cecfd656e1a9ecbe70b4827f0499 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Mon, 30 Nov 2020 18:15:24 +0700 Subject: [PATCH 662/698] Minor fixes to toolchain build scripts --- .../tools/toolchain_builder/build_toolchain.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/kotlin-native/tools/toolchain_builder/build_toolchain.sh b/kotlin-native/tools/toolchain_builder/build_toolchain.sh index b9e716f2977..cf6f9674ec2 100644 --- a/kotlin-native/tools/toolchain_builder/build_toolchain.sh +++ b/kotlin-native/tools/toolchain_builder/build_toolchain.sh @@ -8,9 +8,9 @@ HOME=/home/ct ZLIB_VERSION=1.2.11 build_toolchain() { - mkdir $HOME/build-$TARGET - cd $HOME/build-$TARGET - cp $HOME/toolchains/$TARGET/$VERSION.config .config + mkdir $HOME/build-"$TARGET" + cd $HOME/build-"$TARGET" + cp $HOME/toolchains/"$TARGET"/"$VERSION".config .config ct-ng build cd .. } @@ -26,7 +26,7 @@ build_zlib() { AR=$TOOLCHAIN_BIN_PREFIX-ar \ RANLIB=$TOOLCHAIN_BIN_PREFIX-ranlib \ ./configure \ - --prefix=$INSTALL_PATH + --prefix="$INSTALL_PATH" make && make install } @@ -34,10 +34,10 @@ build_zlib() { build_archive() { cd $HOME/x-tools FULL_NAME=$TARGET-$VERSION - mv $TARGET $FULL_NAME - ARCHIVE_NAME="$FULL_NAME.tar.xz" - tar -czvf $ARCHIVE_NAME $FULL_NAME - cp $ARCHIVE_NAME /artifacts/$ARCHIVE_NAME + mv "$TARGET" "$FULL_NAME" + ARCHIVE_NAME="$FULL_NAME.tar.gz" + tar -czvf "$ARCHIVE_NAME" "$FULL_NAME" + cp "$ARCHIVE_NAME" /artifacts/"$ARCHIVE_NAME" } echo "building toolchain for $TARGET" From 656edd73a7b12baa631ba14c2d953d28ce8f4277 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Mon, 30 Nov 2020 18:26:40 +0700 Subject: [PATCH 663/698] [linux_x64] Update toolchain Use the one built from c82b843e --- kotlin-native/konan/konan.properties | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/kotlin-native/konan/konan.properties b/kotlin-native/konan/konan.properties index 30e5047ff12..d745f1a0616 100644 --- a/kotlin-native/konan/konan.properties +++ b/kotlin-native/konan/konan.properties @@ -368,27 +368,27 @@ runtimeDefinitions.watchos_x64 = KONAN_OBJC_INTEROP=1 KONAN_WATCHOS=1 \ llvmHome.linux_x64 = $llvm.linux_x64.dev libffiDir.linux_x64 = libffi-3.2.1-2-linux-x86-64 -gccToolchain.linux_x64 = target-gcc-toolchain-3-linux-x86-64 -targetToolchain.linux_x64 = target-gcc-toolchain-3-linux-x86-64/x86_64-unknown-linux-gnu +gccToolchain.linux_x64 = x86_64-unknown-linux-gnu-gcc-8.3.0-glibc-2.19-kernel-4.9 +targetToolchain.linux_x64 = $gccToolchain.linux_x64/x86_64-unknown-linux-gnu dependencies.linux_x64 = \ - target-gcc-toolchain-3-linux-x86-64 \ + x86_64-unknown-linux-gnu-gcc-8.3.0-glibc-2.19-kernel-4.9 \ libffi-3.2.1-2-linux-x86-64 \ lldb-3-linux targetToolchain.mingw_x64-linux_x64 = msys2-mingw-w64-x86_64-clang-llvm-lld-compiler_rt-8.0.1 dependencies.mingw_x64-linux_x64 = \ libffi-3.2.1-mingw-w64-x86-64 \ - target-gcc-toolchain-3-linux-x86-64 + x86_64-unknown-linux-gnu-gcc-8.3.0-glibc-2.19-kernel-4.9 targetToolchain.macos_x64-linux_x64 = $llvmHome.macos_x64 dependencies.macos_x64-linux_x64 = \ libffi-3.2.1-3-darwin-macos \ - target-gcc-toolchain-3-linux-x86-64 + x86_64-unknown-linux-gnu-gcc-8.3.0-glibc-2.19-kernel-4.9 quadruple.linux_x64 = x86_64-unknown-linux-gnu -targetSysRoot.linux_x64 = target-gcc-toolchain-3-linux-x86-64/x86_64-unknown-linux-gnu/sysroot +targetSysRoot.linux_x64 = $gccToolchain.linux_x64/x86_64-unknown-linux-gnu/sysroot # targetSysroot-relative. -libGcc.linux_x64 = ../../lib/gcc/x86_64-unknown-linux-gnu/4.8.5 +libGcc.linux_x64 = ../../lib/gcc/x86_64-unknown-linux-gnu/8.3.0 targetCpu.linux_x64 = x86-64 clangFlags.linux_x64 = -cc1 -target-cpu $targetCpu.linux_x64 -emit-obj -disable-llvm-optzns -x ir clangNooptFlags.linux_x64 = -O1 From e8403bc2024e4876d882355c481139521935a6e7 Mon Sep 17 00:00:00 2001 From: Pavel Punegov Date: Fri, 20 Nov 2020 20:50:22 +0300 Subject: [PATCH 664/698] Fix CopySamples: make task work for both gradle and gradle.kts files --- .../org/jetbrains/kotlin/CopySamples.kt | 60 +++++++++++-------- 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/CopySamples.kt b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/CopySamples.kt index 796b955e77d..71a560c4f32 100644 --- a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/CopySamples.kt +++ b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/CopySamples.kt @@ -3,35 +3,35 @@ package org.jetbrains.kotlin import groovy.lang.Closure import org.gradle.api.Task import org.gradle.api.tasks.Copy +import org.gradle.api.tasks.InputDirectory +import java.io.File /** * A task that copies samples and replaces direct repository URLs with ones provided by the cache-redirector service. */ open class CopySamples: Copy() { - - var samplesDir = project.file("samples") - - init { - configureReplacements() - } - - fun samplesDir(path: Any) { - samplesDir = project.file(path) - } + @InputDirectory + var samplesDir: File = project.file("samples") private fun configureReplacements() { from(samplesDir) { + it.exclude("**/*.gradle.kts") it.exclude("**/*.gradle") } from(samplesDir) { it.include("**/*.gradle") + val replacements = replacementsWithWrapper { s -> "maven { url '$s' }" } it.filter { line -> - replacements.forEach { (repo, replacement) -> - if (line.contains(repo)) { - return@filter line.replace(repo, replacement) - } - } - return@filter line + val repo = line.trim() + replacements[repo]?.let { r -> line.replace(repo, r) } ?: line + } + } + from(samplesDir) { + it.include("**/*.gradle.kts") + val replacements = replacementsWithWrapper { s -> "maven(\"$s\")"} + it.filter { line -> + val repo = line.trim() + replacements[repo]?.let { r -> line.replace(repo, r) } ?: line } } } @@ -42,14 +42,22 @@ open class CopySamples: Copy() { return this } - companion object { - val replacements = listOf( - "mavenCentral()" to "maven { url 'https://cache-redirector.jetbrains.com/maven-central' }", - "jcenter()" to "maven { url 'https://cache-redirector.jetbrains.com/jcenter' }", - "https://dl.bintray.com/kotlin/kotlin-dev" to "https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlin-dev", - "https://dl.bintray.com/kotlin/kotlin-eap" to "https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlin-eap", - "https://dl.bintray.com/kotlin/ktor" to "https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/ktor", - "https://plugins.gradle.org/m2" to "https://cache-redirector.jetbrains.com/plugins.gradle.org/m2" - ) - } + private fun replacementsWithWrapper(wrap: (String) -> String) = + urlReplacements.map { entry -> + Pair(wrap(entry.key), wrap(entry.value)) + }.toMap() + centralReplacements.map { entry -> + Pair(entry.key, wrap(entry.value)) + }.toMap() + + private val urlReplacements = mapOf( + "https://dl.bintray.com/kotlin/kotlin-dev" to "https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlin-dev", + "https://dl.bintray.com/kotlin/kotlin-eap" to "https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlin-eap", + "https://dl.bintray.com/kotlin/ktor" to "https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/ktor", + "https://plugins.gradle.org/m2" to "https://cache-redirector.jetbrains.com/plugins.gradle.org/m2" + ) + + private val centralReplacements = mapOf( + "mavenCentral()" to "https://cache-redirector.jetbrains.com/maven-central", + "jcenter()" to "https://cache-redirector.jetbrains.com/jcenter", + ) } From f3a0debaf86c8771a84cc13e3b04f5fe1f1ca379 Mon Sep 17 00:00:00 2001 From: Pavel Punegov Date: Fri, 20 Nov 2020 20:58:18 +0300 Subject: [PATCH 665/698] Use task register API for copySamples --- kotlin-native/build.gradle | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kotlin-native/build.gradle b/kotlin-native/build.gradle index 75648adf60a..b630f39f447 100644 --- a/kotlin-native/build.gradle +++ b/kotlin-native/build.gradle @@ -713,8 +713,10 @@ configure([samplesZip, samplesTar]) { exclude '**/*.kt.bc-build/' } -task copy_samples(dependsOn: 'copySamples') -task copySamples(type: CopySamples) { +project.tasks.register("copy_samples") { + dependsOn 'copySamples' +} +project.tasks.register("copySamples", CopySamples) { destinationDir file('build/samples-under-test') } From 4638988c2fd81bf5119f7ecbf0cf4caf9ecc0b3b Mon Sep 17 00:00:00 2001 From: Pavel Punegov Date: Sun, 22 Nov 2020 18:36:30 +0300 Subject: [PATCH 666/698] Use project's kotlin compiler version and repo for the samples --- .../org/jetbrains/kotlin/CopySamples.kt | 21 ++++++++++++++++++- kotlin-native/samples/build.gradle.kts | 6 ++++++ kotlin-native/samples/gradle.properties | 3 +++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/CopySamples.kt b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/CopySamples.kt index 71a560c4f32..c7c8f8a7a57 100644 --- a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/CopySamples.kt +++ b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/CopySamples.kt @@ -8,8 +8,9 @@ import java.io.File /** * A task that copies samples and replaces direct repository URLs with ones provided by the cache-redirector service. + * This task also adds kotlin compiler repository from the project's gradle.properties file. */ -open class CopySamples: Copy() { +open class CopySamples : Copy() { @InputDirectory var samplesDir: File = project.file("samples") @@ -17,6 +18,7 @@ open class CopySamples: Copy() { from(samplesDir) { it.exclude("**/*.gradle.kts") it.exclude("**/*.gradle") + it.exclude("**/gradle.properties") } from(samplesDir) { it.include("**/*.gradle") @@ -34,6 +36,23 @@ open class CopySamples: Copy() { replacements[repo]?.let { r -> line.replace(repo, r) } ?: line } } + from(samplesDir) { + it.include("**/gradle.properties") + + val kotlinVersion = project.property("kotlinVersion") as? String + ?: throw IllegalArgumentException("Property kotlinVersion should be specified in the root project") + val kotlinCompilerRepo = project.property("kotlinCompilerRepo") as? String + ?: throw IllegalArgumentException("Property kotlinCompilerRepo should be specified in the root project") + + it.filter { line -> + when { + line.startsWith("kotlin_version") -> "kotlin_version=$kotlinVersion" + line.startsWith("#kotlinCompilerRepo") || line.startsWith("kotlinCompilerRepo") -> + "kotlinCompilerRepo=$kotlinCompilerRepo" + else -> line + } + } + } } override fun configure(closure: Closure): Task { diff --git a/kotlin-native/samples/build.gradle.kts b/kotlin-native/samples/build.gradle.kts index 5dd47dbed61..8dad36331b5 100644 --- a/kotlin-native/samples/build.gradle.kts +++ b/kotlin-native/samples/build.gradle.kts @@ -3,6 +3,9 @@ buildscript { mavenCentral() maven("https://dl.bintray.com/kotlin/kotlin-dev") maven("https://dl.bintray.com/kotlin/kotlin-eap") + + val kotlinCompilerRepo: String? by rootProject + kotlinCompilerRepo?.let { maven(it) } } val kotlin_version: String by rootProject @@ -16,6 +19,9 @@ allprojects { mavenCentral() maven("https://dl.bintray.com/kotlin/kotlin-dev") maven("https://dl.bintray.com/kotlin/kotlin-eap") + + val kotlinCompilerRepo: String? by rootProject + kotlinCompilerRepo?.let { maven(it) } } } diff --git a/kotlin-native/samples/gradle.properties b/kotlin-native/samples/gradle.properties index 3782789d9b7..1c05119814e 100644 --- a/kotlin-native/samples/gradle.properties +++ b/kotlin-native/samples/gradle.properties @@ -8,6 +8,9 @@ org.gradle.workers.max=4 # CHANGE_VERSION_WITH_RELEASE kotlin_version=1.4.10 +# Sets maven path for the kotlin version other than release +#kotlinCompilerRepo= + # Use custom Kotlin/Native home: kotlin.native.home=../../dist From e1d9a36de318920ad326141d67180e524e65abaf Mon Sep 17 00:00:00 2001 From: Pavel Punegov Date: Mon, 23 Nov 2020 13:50:18 +0300 Subject: [PATCH 667/698] Use maven { setUrl("...") } that works both for .gradle.kts and .gradle files --- .../org/jetbrains/kotlin/CopySamples.kt | 34 ++++++------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/CopySamples.kt b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/CopySamples.kt index c7c8f8a7a57..0b9f3e0f422 100644 --- a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/CopySamples.kt +++ b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/CopySamples.kt @@ -22,18 +22,14 @@ open class CopySamples : Copy() { } from(samplesDir) { it.include("**/*.gradle") - val replacements = replacementsWithWrapper { s -> "maven { url '$s' }" } - it.filter { line -> - val repo = line.trim() - replacements[repo]?.let { r -> line.replace(repo, r) } ?: line - } - } - from(samplesDir) { it.include("**/*.gradle.kts") - val replacements = replacementsWithWrapper { s -> "maven(\"$s\")"} it.filter { line -> - val repo = line.trim() - replacements[repo]?.let { r -> line.replace(repo, r) } ?: line + replacements.forEach { (repo, replacement) -> + if (line.contains(repo)) { + return@filter line.replace(repo, replacement) + } + } + return@filter line } } from(samplesDir) { @@ -61,22 +57,12 @@ open class CopySamples : Copy() { return this } - private fun replacementsWithWrapper(wrap: (String) -> String) = - urlReplacements.map { entry -> - Pair(wrap(entry.key), wrap(entry.value)) - }.toMap() + centralReplacements.map { entry -> - Pair(entry.key, wrap(entry.value)) - }.toMap() - - private val urlReplacements = mapOf( + private val replacements = listOf( "https://dl.bintray.com/kotlin/kotlin-dev" to "https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlin-dev", "https://dl.bintray.com/kotlin/kotlin-eap" to "https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlin-eap", "https://dl.bintray.com/kotlin/ktor" to "https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/ktor", - "https://plugins.gradle.org/m2" to "https://cache-redirector.jetbrains.com/plugins.gradle.org/m2" - ) - - private val centralReplacements = mapOf( - "mavenCentral()" to "https://cache-redirector.jetbrains.com/maven-central", - "jcenter()" to "https://cache-redirector.jetbrains.com/jcenter", + "https://plugins.gradle.org/m2" to "https://cache-redirector.jetbrains.com/plugins.gradle.org/m2", + "mavenCentral()" to "maven { setUrl(\"https://cache-redirector.jetbrains.com/maven-central\") }", + "jcenter()" to "maven { setUrl(\"https://cache-redirector.jetbrains.com/jcenter\") }", ) } From 62272f54c1f49142396f8e25a25764e82df00867 Mon Sep 17 00:00:00 2001 From: SvyatoslavScherbina Date: Fri, 4 Dec 2020 15:37:48 +0300 Subject: [PATCH 668/698] Fix isa swizzling for Kotlin subclasses of Obj-C classes Don't rely on indexed ivars of instance's isa since isa swizzling replaces it. Use method instead, it works on the replacement too (if it is a subclass of the original isa). #KT-42482 Fixed. --- .../llvm/KotlinObjCClassInfoGenerator.kt | 28 ++++++- .../kotlin/backend/konan/llvm/Runtime.kt | 1 + .../tests/interop/objc/tests/kt42482.h | 10 +++ .../tests/interop/objc/tests/kt42482.kt | 35 +++++++++ .../tests/interop/objc/tests/kt42482.m | 36 +++++++++ .../runtime/src/main/cpp/ObjCInterop.mm | 76 ++++++++++++++----- 6 files changed, 162 insertions(+), 24 deletions(-) create mode 100644 kotlin-native/backend.native/tests/interop/objc/tests/kt42482.h create mode 100644 kotlin-native/backend.native/tests/interop/objc/tests/kt42482.kt create mode 100644 kotlin-native/backend.native/tests/interop/objc/tests/kt42482.m diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/KotlinObjCClassInfoGenerator.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/KotlinObjCClassInfoGenerator.kt index ba7270dfdd0..12d417dfb94 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/KotlinObjCClassInfoGenerator.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/KotlinObjCClassInfoGenerator.kt @@ -5,9 +5,9 @@ package org.jetbrains.kotlin.backend.konan.llvm -import llvm.LLVMStoreSizeOfType +import llvm.LLVMLinkage +import llvm.LLVMSetLinkage import llvm.LLVMValueRef -import org.jetbrains.kotlin.backend.common.atMostOne import org.jetbrains.kotlin.backend.konan.* import org.jetbrains.kotlin.backend.konan.descriptors.getAnnotationStringValue import org.jetbrains.kotlin.backend.konan.ir.* @@ -65,7 +65,9 @@ internal class KotlinObjCClassInfoGenerator(override val context: Context) : Con staticData.placeGlobal( "kobjcclassptr:${irClass.fqNameForIrSerialization}#internal", NullPointer(int8Type) - ).pointer + ).pointer, + + generateClassDataImp(irClass) ) objCLLvmDeclarations.classInfoGlobal.setInitializer(info) @@ -131,6 +133,26 @@ internal class KotlinObjCClassInfoGenerator(override val context: Context) : Con ) } + private fun generateClassDataImp(irClass: IrClass): ConstPointer { + val classDataPointer = staticData.placeGlobal( + "kobjcclassdata:${irClass.fqNameForIrSerialization}#internal", + Zero(runtime.kotlinObjCClassData) + ).pointer + + val functionType = functionType(classDataPointer.llvmType, false, int8TypePtr, int8TypePtr) + val functionName = "kobjcclassdataimp:${irClass.fqNameForIrSerialization}#internal" + + val function = generateFunction(codegen, functionType, functionName) { + ret(classDataPointer.llvm) + }.also { + LLVMSetLinkage(it, LLVMLinkage.LLVMPrivateLinkage) + } + + return constPointer(function) + } + + private val codegen = CodeGenerator(context) + companion object { const val createdClassFieldIndex = 11 } diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/Runtime.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/Runtime.kt index 15b890aa1da..dcf00b6c66f 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/Runtime.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/Runtime.kt @@ -44,6 +44,7 @@ class Runtime(bitcodeFile: String) { val targetData = LLVMCreateTargetData(dataLayout)!! + val kotlinObjCClassData by lazy { getStructType("KotlinObjCClassData") } val kotlinObjCClassInfo by lazy { getStructType("KotlinObjCClassInfo") } val objCMethodDescription by lazy { getStructType("ObjCMethodDescription") } val objCTypeAdapter by lazy { getStructType("ObjCTypeAdapter") } diff --git a/kotlin-native/backend.native/tests/interop/objc/tests/kt42482.h b/kotlin-native/backend.native/tests/interop/objc/tests/kt42482.h new file mode 100644 index 00000000000..d5f92e43e9b --- /dev/null +++ b/kotlin-native/backend.native/tests/interop/objc/tests/kt42482.h @@ -0,0 +1,10 @@ +#import + +extern BOOL kt42482Deallocated; +extern id kt42482Global; + +@interface KT42482 : NSObject +-(int)fortyTwo; +@end; + +void kt42482Swizzle(id obj); diff --git a/kotlin-native/backend.native/tests/interop/objc/tests/kt42482.kt b/kotlin-native/backend.native/tests/interop/objc/tests/kt42482.kt new file mode 100644 index 00000000000..6fce89b8734 --- /dev/null +++ b/kotlin-native/backend.native/tests/interop/objc/tests/kt42482.kt @@ -0,0 +1,35 @@ +import kotlin.native.ref.WeakReference +import kotlinx.cinterop.* +import kotlin.test.* +import objcTests.* + +@Test +fun testKT42482() { + // Attempt to make the state predictable: + kotlin.native.internal.GC.collect() + + kt42482Deallocated = false + assertFalse(kt42482Deallocated); + + { + assertEquals(41, KT42482().fortyTwo()) + + val obj: KT42482 = KT42482Impl() + assertEquals(42, obj.fortyTwo()) + + kt42482Swizzle(obj) + assertEquals(43, obj.fortyTwo()) + + // Test retain and release on swizzled object: + kt42482Global = obj + kt42482Global = null + }() + + kotlin.native.internal.GC.collect() + + assertTrue(kt42482Deallocated) +} + +class KT42482Impl : KT42482() { + override fun fortyTwo() = 42 +} diff --git a/kotlin-native/backend.native/tests/interop/objc/tests/kt42482.m b/kotlin-native/backend.native/tests/interop/objc/tests/kt42482.m new file mode 100644 index 00000000000..e4f8735a8d2 --- /dev/null +++ b/kotlin-native/backend.native/tests/interop/objc/tests/kt42482.m @@ -0,0 +1,36 @@ +#import "kt42482.h" +#import "assert.h" +#import + +BOOL kt42482Deallocated = NO; +id kt42482Global = nil; + +@implementation KT42482 +-(int)fortyTwo { + return 41; +} + +-(void)dealloc { + kt42482Deallocated = YES; +} +@end; + +int fortyTwoSwizzledImp(id self, SEL _cmd) { + return 43; +} + +void kt42482Swizzle(id obj) { + Class oldClass = object_getClass(obj); + + SEL selector = @selector(fortyTwo); + + Class newClass = objc_allocateClassPair(oldClass, "KT42482Swizzled", 0); + assert(newClass != nil); + objc_registerClassPair(newClass); + + Method method = class_getInstanceMethod([KT42482 class], selector); + assert(method != nil); + class_addMethod(newClass, selector, (IMP)&fortyTwoSwizzledImp, method_getTypeEncoding(method)); + + object_setClass(obj, newClass); +} diff --git a/kotlin-native/runtime/src/main/cpp/ObjCInterop.mm b/kotlin-native/runtime/src/main/cpp/ObjCInterop.mm index d2da6eb3743..3b312cc3f95 100644 --- a/kotlin-native/runtime/src/main/cpp/ObjCInterop.mm +++ b/kotlin-native/runtime/src/main/cpp/ObjCInterop.mm @@ -46,26 +46,33 @@ const char* Kotlin_ObjCInterop_getUniquePrefix() { extern "C" id objc_msgSendSuper2(struct objc_super *super, SEL op, ...); -struct KotlinClassData { +struct KotlinObjCClassData { const TypeInfo* typeInfo; + Class objcClass; int32_t bodyOffset; }; -static inline struct KotlinClassData* GetKotlinClassData(Class clazz) { - void* ivars = object_getIndexedIvars(reinterpret_cast(clazz)); - return static_cast(ivars); +// Acts only as container for the method, not actually applied to any class. +@protocol HasKotlinObjCClassData +@required +-(void*)_kotlinObjCClassData; +@end; + +static inline struct KotlinObjCClassData* GetKotlinClassData(id objOrClass) { + void* ptr = [(id)objOrClass _kotlinObjCClassData]; + return static_cast(ptr); } namespace { -BackRefFromAssociatedObject* getBackRef(id obj, KotlinClassData* classData) { +BackRefFromAssociatedObject* getBackRef(id obj, KotlinObjCClassData* classData) { void* body = reinterpret_cast(reinterpret_cast(obj) + classData->bodyOffset); return reinterpret_cast(body); } BackRefFromAssociatedObject* getBackRef(id obj) { // TODO: suboptimal; consider specializing methods for each class. - auto* classData = GetKotlinClassData(object_getClass(obj)); + auto* classData = GetKotlinClassData(obj); return getBackRef(obj, classData); } @@ -75,11 +82,11 @@ OBJ_GETTER(toKotlinImp, id self, SEL _cmd) { id allocWithZoneImp(Class self, SEL _cmd, void* zone) { // [super allocWithZone:zone] - struct objc_super s = {(id)self, object_getClass((id)self)}; + auto* classData = GetKotlinClassData(self); // TODO: suboptimal; consider specializing. + struct objc_super s = {(id)self, object_getClass(classData->objcClass)}; auto messenger = reinterpret_cast(objc_msgSendSuper2); id result = messenger(&s, _cmd, zone); - auto* classData = GetKotlinClassData(self); // TODO: suboptimal; consider specializing. auto* typeInfo = classData->typeInfo; ObjHolder holder; auto kotlinObj = AllocInstanceWithAssociatedObject(typeInfo, result, holder.slot()); @@ -119,6 +126,8 @@ void releaseImp(id self, SEL _cmd) { } void releaseAsAssociatedObjectImp(id self, SEL _cmd) { + auto* classData = GetKotlinClassData(self); + // This function is called by the GC. It made a decision to reclaim Kotlin object, and runs // deallocation hooks at the moment, including deallocation of the "associated object" ([self]) // using the [super release] call below. @@ -131,14 +140,14 @@ void releaseAsAssociatedObjectImp(id self, SEL _cmd) { // Generally retaining and releasing Kotlin object that is being deallocated would lead to // use-after-dispose and double-dispose problems (with unpredictable consequences) or to an assertion failure. // To workaround this, detach the back ref from the Kotlin object: - getBackRef(self)->detach(); + getBackRef(self, classData)->detach(); // So retain/release/etc. on [self] won't affect the Kotlin object, and an attempt to get // the reference to it (e.g. when calling Kotlin method on [self]) would crash. // The latter is generally ok, because by the time superclass dealloc gets launched, subclass state // should already be deinitialized, and Kotlin methods operate on the subclass. // [super release] - Class clazz = object_getClass(self); + Class clazz = classData->objcClass; struct objc_super s = {self, clazz}; auto messenger = reinterpret_cast(objc_msgSendSuper2); messenger(&s, @selector(release)); @@ -150,17 +159,12 @@ extern "C" { Class Kotlin_Interop_getObjCClass(const char* name); -static inline void SetKotlinTypeInfo(Class clazz, const TypeInfo* typeInfo) { - GetKotlinClassData(clazz)->typeInfo = typeInfo; -} - const TypeInfo* GetObjCKotlinTypeInfo(ObjHeader* obj) RUNTIME_NOTHROW; RUNTIME_NOTHROW const TypeInfo* GetObjCKotlinTypeInfo(ObjHeader* obj) { void* objcPtr = obj->GetAssociatedObject(); RuntimeAssert(objcPtr != nullptr, ""); - Class clazz = object_getClass(reinterpret_cast(objcPtr)); - return GetKotlinClassData(clazz)->typeInfo; + return GetKotlinClassData(reinterpret_cast(objcPtr))->typeInfo; } @@ -181,6 +185,24 @@ static void AddNSObjectOverride(bool isClassMethod, Class clazz, SEL selector, v RuntimeCheck(added, "Unable to add method to Objective-C class"); } +static void AddKotlinClassData(bool isClassMethod, Class clazz, void* imp) { + SEL selector = @selector(_kotlinObjCClassData); + + auto methodDescription = protocol_getMethodDescription( + @protocol(HasKotlinObjCClassData), + selector, + YES, YES + ); + + const char* typeEncoding = methodDescription.types; + + RuntimeCheck(typeEncoding != nullptr, "unable to find method in Objective-C protocol"); + + BOOL added = class_addMethod( + isClassMethod ? object_getClass((id)clazz) : clazz, selector, (IMP)imp, typeEncoding); + RuntimeCheck(added, "Unable to add method to Objective-C class"); +} + struct ObjCMethodDescription { void* (*imp)(void*, void*, ...); const char* selector; @@ -206,6 +228,8 @@ struct KotlinObjCClassInfo { const TypeInfo* metaTypeInfo; void** createdClass; + + KotlinObjCClassData* (*classDataImp)(void*, void*); }; static void AddMethods(Class clazz, const struct ObjCMethodDescription* methods, int32_t methodsNum) { @@ -221,11 +245,10 @@ static int anonymousClassNextId = 0; static Class allocateClass(const KotlinObjCClassInfo* info) { Class superclass = Kotlin_Interop_getObjCClass(info->superclassName); - size_t extraBytes = sizeof(struct KotlinClassData); if (info->exported) { RuntimeCheck(info->name != nullptr, "exported Objective-C class must have a name"); - Class result = objc_allocateClassPair(superclass, info->name, extraBytes); + Class result = objc_allocateClassPair(superclass, info->name, 0); if (result != nullptr) return result; // Similar to how Objective-C runtime handles this: fprintf(stderr, "Class %s has multiple implementations. Which one will be used is undefined.\n", info->name); @@ -242,7 +265,7 @@ static Class allocateClass(const KotlinObjCClassInfo* info) { int classId = anonymousClassNextId++; className += std::to_string(classId); - Class result = objc_allocateClassPair(superclass, className.c_str(), extraBytes); + Class result = objc_allocateClassPair(superclass, className.c_str(), 0); RuntimeCheck(result != nullptr, "Failed to allocate Objective-C class"); return result; } @@ -284,7 +307,12 @@ void* CreateKotlinObjCClass(const KotlinObjCClassInfo* info) { AddMethods(newClass, info->instanceMethods, info->instanceMethodsNum); AddMethods(newMetaclass, info->classMethods, info->classMethodsNum); - SetKotlinTypeInfo(newClass, Kotlin_ObjCExport_createTypeInfoWithKotlinFieldsFrom(newClass, info->typeInfo)); + // Adding both instance and class methods to make [GetKotlinClassData] work + // for instances as well as the class itself. + AddKotlinClassData(false, newClass, (void*)info->classDataImp); + AddKotlinClassData(true, newClass, (void*)info->classDataImp); + + const TypeInfo* actualTypeInfo = Kotlin_ObjCExport_createTypeInfoWithKotlinFieldsFrom(newClass, info->typeInfo); int bodySize = sizeof(BackRefFromAssociatedObject); char bodyTypeEncoding[16]; @@ -297,9 +325,15 @@ void* CreateKotlinObjCClass(const KotlinObjCClassInfo* info) { Ivar body = class_getInstanceVariable(newClass, "kotlinBody"); RuntimeAssert(body != nullptr, "Unable to get ivar added to Objective-C class"); int32_t offset = (int32_t)ivar_getOffset(body); - GetKotlinClassData(newClass)->bodyOffset = offset; *info->bodyOffset = offset; + // Doing this after objc_registerClassPair because it is not clear whether calling class methods + // is safe before that. + auto* classData = GetKotlinClassData(newClass); + classData->typeInfo = actualTypeInfo; + classData->objcClass = newClass; + classData->bodyOffset = offset; + *info->createdClass = newClass; return newClass; } From 0e0c8e274d1486d88eaa754bef09f4545f20ed92 Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov Date: Sat, 5 Dec 2020 13:59:21 +0300 Subject: [PATCH 669/698] Fix DSL2 samples for Linux x64 --- kotlin-native/samples/tetris/build.gradle.kts | 2 +- kotlin-native/samples/videoplayer/build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kotlin-native/samples/tetris/build.gradle.kts b/kotlin-native/samples/tetris/build.gradle.kts index f64040931c1..5149149f8e4 100644 --- a/kotlin-native/samples/tetris/build.gradle.kts +++ b/kotlin-native/samples/tetris/build.gradle.kts @@ -109,7 +109,7 @@ kotlin { val sdl by creating { when (preset) { presets["macosX64"] -> includeDirs("/opt/local/include/SDL2", "/usr/local/include/SDL2") - presets["linuxX64"] -> includeDirs("/usr/include/SDL2") + presets["linuxX64"] -> includeDirs("/usr/include", "/usr/include/x86_64-linux-gnu", "/usr/include/SDL2") presets["mingwX64"] -> includeDirs(mingw64Path.resolve("include/SDL2")) presets["mingwX86"] -> includeDirs(mingw32Path.resolve("include/SDL2")) presets["linuxArm32Hfp"] -> includeDirs(kotlinNativeDataPath.resolve("dependencies/target-sysroot-2-raspberrypi/usr/include/SDL2")) diff --git a/kotlin-native/samples/videoplayer/build.gradle.kts b/kotlin-native/samples/videoplayer/build.gradle.kts index 1cc2a964b93..b31f05cfa4c 100644 --- a/kotlin-native/samples/videoplayer/build.gradle.kts +++ b/kotlin-native/samples/videoplayer/build.gradle.kts @@ -40,7 +40,7 @@ kotlin { val sdl by creating { when (preset) { presets["macosX64"] -> includeDirs("/opt/local/include/SDL2", "/usr/local/include/SDL2") - presets["linuxX64"] -> includeDirs("/usr/include/SDL2") + presets["linuxX64"] -> includeDirs("/usr/include", "/usr/include/x86_64-linux-gnu", "/usr/include/SDL2") presets["mingwX64"] -> includeDirs(mingwPath.resolve("include/SDL2")) } } From 8a83b37673485754d540f861adabb7f41c237458 Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov Date: Sun, 6 Dec 2020 18:20:39 +0300 Subject: [PATCH 670/698] Videoplayer sample: format, drop unused imports --- .../src/videoPlayerMain/kotlin/DecoderWorker.kt | 13 ++++++------- .../videoplayer/src/videoPlayerMain/kotlin/Queue.kt | 2 +- .../src/videoPlayerMain/kotlin/SDLAudio.kt | 4 ++-- .../src/videoPlayerMain/kotlin/SDLInput.kt | 2 +- .../src/videoPlayerMain/kotlin/SDLVideo.kt | 5 +---- .../src/videoPlayerMain/kotlin/VideoPlayer.kt | 7 +++---- 6 files changed, 14 insertions(+), 19 deletions(-) diff --git a/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/DecoderWorker.kt b/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/DecoderWorker.kt index 339a1686f06..d7fd627e20b 100644 --- a/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/DecoderWorker.kt +++ b/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/DecoderWorker.kt @@ -153,7 +153,6 @@ private class VideoDecoder( videoQueue.push(VideoFrame(buffer, scaledVideoFrame.linesize[0], ts)) } } - } private fun SampleFormat.toAVSampleFormat(): AVSampleFormat? = when (this) { @@ -191,14 +190,14 @@ private class AudioDecoder( private val maxAudioFrames = 5 init { - with (resampledAudioFrame) { + with(resampledAudioFrame) { channels = output.channels sample_rate = output.sampleRate format = output.sampleFormat channel_layout = output.channelLayout.convert() } - with (audioCodecContext) { + with(audioCodecContext) { setResampleOpt("in_channel_layout", channel_layout.convert()) setResampleOpt("out_channel_layout", output.channelLayout) setResampleOpt("in_sample_rate", sample_rate) @@ -226,12 +225,12 @@ private class AudioDecoder( fun nextFrame(size: Int): AudioFrame? { val frame = audioQueue.peek() ?: return null val realSize = if (frame.position + size > frame.size) frame.size - frame.position else size - if (frame.position + realSize == frame.size) { - return audioQueue.pop() + return if (frame.position + realSize == frame.size) { + audioQueue.pop() } else { val result = AudioFrame(av_buffer_ref(frame.buffer)!!, frame.position, frame.size, frame.timeStamp) frame.position += realSize - return result + result } } @@ -241,7 +240,7 @@ private class AudioDecoder( if (frameFinished.value != 0) { // Put audio frame to decoder's queue. swr_convert_frame(resampleContext, resampledAudioFrame.ptr, audioFrame.ptr).checkAVError() - with (resampledAudioFrame) { + with(resampledAudioFrame) { val audioFrameSize = av_samples_get_buffer_size(null, channels, nb_samples, format, 1) val buffer = av_buffer_alloc(audioFrameSize)!! val ts = av_frame_get_best_effort_timestamp(audioFrame.ptr) * diff --git a/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/Queue.kt b/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/Queue.kt index b8ec33e9563..9c80621d2c2 100644 --- a/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/Queue.kt +++ b/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/Queue.kt @@ -6,7 +6,7 @@ package sample.videoplayer class Queue(val maxSize: Int) { - private val array = kotlin.arrayOfNulls(maxSize) + private val array = arrayOfNulls(maxSize) private var head = 0 private var tail = 0 diff --git a/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/SDLAudio.kt b/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/SDLAudio.kt index b06bae5a673..11d42ec2181 100644 --- a/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/SDLAudio.kt +++ b/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/SDLAudio.kt @@ -23,7 +23,7 @@ private fun SampleFormat.toSDLFormat(): SDL_AudioFormat? = when (this) { SampleFormat.INVALID -> null } -class SDLAudio(val player: VideoPlayer) : DisposableContainer() { +class SDLAudio(private val player: VideoPlayer) : DisposableContainer() { private var state = State.STOPPED fun start(audio: AudioOutput) { @@ -67,7 +67,7 @@ class SDLAudio(val player: VideoPlayer) : DisposableContainer() { private fun audioCallback(userdata: COpaquePointer?, buffer: CPointer?, length: Int) { // This handler will be invoked in the audio thread, so reinit runtime. - kotlin.native.initRuntimeIfNeeded() + initRuntimeIfNeeded() val decoder = DecoderWorker(Worker.fromCPointer(userdata)) var outPosition = 0 while (outPosition < length) { diff --git a/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/SDLInput.kt b/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/SDLInput.kt index 8b245c08a1f..18fee6ea0aa 100644 --- a/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/SDLInput.kt +++ b/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/SDLInput.kt @@ -8,7 +8,7 @@ package sample.videoplayer import kotlinx.cinterop.* import sdl.* -class SDLInput(val player: VideoPlayer) : DisposableContainer() { +class SDLInput(private val player: VideoPlayer) : DisposableContainer() { private val event = arena.alloc().ptr fun check() { diff --git a/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/SDLVideo.kt b/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/SDLVideo.kt index 33c1f04578c..96f970ada51 100644 --- a/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/SDLVideo.kt +++ b/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/SDLVideo.kt @@ -5,9 +5,6 @@ package sample.videoplayer -import ffmpeg.AV_PIX_FMT_NONE -import ffmpeg.AV_PIX_FMT_RGB24 -import ffmpeg.AV_PIX_FMT_RGB32 import kotlinx.cinterop.* import sdl.* @@ -72,7 +69,7 @@ class SDLRendererWindow(windowPos: Dimensions, videoSize: Dimensions) : Disposab SDL_CreateTexture(renderer, SDL_GetWindowPixelFormat(window), 0, videoSize.w, videoSize.h), ::SDL_DestroyTexture) private val rect = sdlDisposable("calloc(SDL_Rect)", - SDL_calloc(1, SDL_Rect.size.convert()), ::SDL_free) + SDL_calloc(1, sizeOf().convert()), ::SDL_free) .reinterpret() init { diff --git a/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/VideoPlayer.kt b/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/VideoPlayer.kt index 75ca8e09c4a..9c4fd6f0779 100644 --- a/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/VideoPlayer.kt +++ b/kotlin-native/samples/videoplayer/src/videoPlayerMain/kotlin/VideoPlayer.kt @@ -6,7 +6,6 @@ package sample.videoplayer import ffmpeg.* -import kotlin.system.* import kotlinx.cinterop.* import platform.posix.* import kotlinx.cli.* @@ -32,12 +31,12 @@ enum class PlayMode { val useAudio: Boolean get() = this != VIDEO } -class VideoPlayer(val requestedSize: Dimensions?) : DisposableContainer() { +class VideoPlayer(private val requestedSize: Dimensions?) : DisposableContainer() { private val decoder = disposable { DecoderWorker() } private val video = disposable { SDLVideo() } private val audio = disposable { SDLAudio(this) } private val input = disposable { SDLInput(this) } - private val now = arena.alloc().ptr + private val now = arena.alloc().ptr private var state = State.STOPPED @@ -63,7 +62,7 @@ class VideoPlayer(val requestedSize: Dimensions?) : DisposableContainer() { } private fun getTime(): Double { - clock_gettime(platform.posix.CLOCK_MONOTONIC, now) + clock_gettime(CLOCK_MONOTONIC, now) return now.pointed.tv_sec + now.pointed.tv_nsec / 1e9 } From 86bf6bf85720820928b1cf0b95cbb715b43b1e06 Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov Date: Sun, 6 Dec 2020 21:56:28 +0300 Subject: [PATCH 671/698] Calculator sample: Fix default colors in iOS --- .../iosApp/calculator/Base.lproj/Main.storyboard | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kotlin-native/samples/calculator/iosApp/calculator/Base.lproj/Main.storyboard b/kotlin-native/samples/calculator/iosApp/calculator/Base.lproj/Main.storyboard index 72546e9149b..b06d278fdd1 100644 --- a/kotlin-native/samples/calculator/iosApp/calculator/Base.lproj/Main.storyboard +++ b/kotlin-native/samples/calculator/iosApp/calculator/Base.lproj/Main.storyboard @@ -5,7 +5,7 @@ - + @@ -23,6 +23,7 @@ + @@ -35,14 +36,14 @@ - + From 50d708abb5c4376168e7a035c613752ccdfc84f4 Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Mon, 7 Dec 2020 06:07:07 +0100 Subject: [PATCH 672/698] [kotlin compiler][update] 1.5.0-dev-156 * 5f91f79382e - (HEAD -> master, tag: build-1.5.0-dev-156, origin/master, origin/HEAD) Remove usage of idea file systems for checking js libraries (vor 35 Stunden) * c959ad7911f - (tag: build-1.5.0-dev-155) FIR checker: revisit per-label iterations to avoid !! (vor 2 Tagen) * 762e315ce39 - FIR checker: deprecate path-insensitive data collection (vor 2 Tagen) * 168503573ab - FIR checker: make unused checker path-sensitive (vor 2 Tagen) * 3d7d87ace5e - FIR: keep nullability of lambda return type (vor 2 Tagen) * 28a1d1ceac7 - (tag: build-1.5.0-dev-152) Disable test on Windows (vor 2 Tagen) * c87edc44f38 - (tag: build-1.5.0-dev-148) Fix compilation error in :noarg-ide-plugin (vor 2 Tagen) * 69be56d0424 - (tag: build-1.5.0-dev-143) Value classes: Forbid cloneable value classes (vor 2 Tagen) * 25c228297a6 - (tag: build-1.5.0-dev-142) JVM IR: support noarg compiler plugin (vor 2 Tagen) * a06bffc4b97 - Noarg: prohibit noarg for inner and local classes (vor 2 Tagen) * a343fffe9ea - Noarg: somewhat refactor tests (vor 2 Tagen) * b10e2061449 - IR: minor, deduplicate unbound symbol in error message (vor 2 Tagen) * bf4f2605d4b - (tag: build-1.5.0-dev-137) Mark FirPsiCheckerTestGenerated.Regression.testJet53 as FLAKY (vor 3 Tagen) * 7354bcbc991 - (tag: build-1.5.0-dev-136) Build: Publish kotlin-compiler-internal-test-framework maven artifact (vor 3 Tagen) * 5d9e86863a3 - (tag: build-1.5.0-dev-135) [IR] Make isHidden and isAssignable explicit on IrValueParameter. (vor 3 Tagen) * 3dbe02b7fe6 - (tag: build-1.5.0-dev-134) JVM_IR KT-43109 generate internal bridge for custom internal 'toArray' (vor 3 Tagen) * 149bcc2d22e - (tag: build-1.5.0-dev-129) Revert using regex Pattern in String.replace (vor 3 Tagen) * 5167d69b7ce - (tag: build-1.5.0-dev-125) FIR checker: introduce member property checker (vor 3 Tagen) * 2bf22caeb7c - (tag: build-1.5.0-dev-123) Revert "Keep application environment alive between JPS tests" (vor 3 Tagen) * 2d8bdcbc9b9 - Minor: use unique temp directories in jps-build tests (vor 3 Tagen) * 1ee0892f733 - (tag: build-1.5.0-dev-106) [ULC] Fix NPE on generating data class ctor parameters (vor 3 Tagen) * f43899086a9 - (tag: build-1.5.0-dev-96) Value Classes: Forbid var properties with value class receivers (vor 3 Tagen) * 19b16da183c - (tag: build-1.5.0-dev-94) Minor. Add test to check value classes (vor 3 Tagen) * 0d55c9108d4 - (tag: build-1.5.0-dev-91) IC: Forbid inner classes inside inline classes (vor 3 Tagen) * 15c325cf104 - Value classes: Allow nested inline classes (vor 3 Tagen) * 235813736ec - (tag: build-1.5.0-dev-89, tag: build-1.5.0-dev-84) Build: Set file access rights explicitly in kotlin-stdlib-js jar (vor 3 Tagen) * 4626f21c585 - (tag: build-1.5.0-dev-76) Record type arguments for FirResolvedQualifier (vor 4 Tagen) * 68d271fc91f - Move FirModifierList inside FirModifierChecker to reduce its scope (vor 4 Tagen) * 94ddb712130 - [FIR] Simplify UnusedChecker & delete FirSourceChildren.kt (vor 4 Tagen) * 8abf27898d4 - Simplify FirMemberDeclaration.implicitModality (vor 4 Tagen) * 5fbdc0af5e6 - [FIR] Introduce & use MODALITY_MODIFIER positioning strategy (vor 4 Tagen) * 54f9edb597c - Simplify RedundantVisibilityModifierChecker (vor 4 Tagen) * b1c9d4b0463 - [FIR] Introduce & use VISIBILITY_MODIFIER positioning strategy (vor 4 Tagen) * 7f1b539011a - [FIR] Simplify CanBeValChecker.getDestructuringChildrenCount (vor 4 Tagen) * 38779339131 - [FIR] Adapt VAL_OR_VAR strategy & use it in CanBeValChecker (vor 4 Tagen) * ea7d738ee19 - [FIR] Introduce & use SourceElementPositioningStrategies.OPERATOR (vor 4 Tagen) * c9806c5af9e - [FIR] Simplify RedundantExplicitTypeChecker (vor 4 Tagen) * 516fce37dbe - (tag: build-1.5.0-dev-73) Value classes: Allow unsigned arrays in annotations (vor 4 Tagen) * a9c072f8261 - (tag: build-1.5.0-dev-70) Regenerate compiler tests (vor 4 Tagen) * caea0a9df09 - (tag: build-1.5.0-dev-62) JVM_IR KT-43721 coerce intrinsic result to corresponding unsigned type (vor 4 Tagen) * c776fcbd00e - (tag: build-1.5.0-dev-60) [JVM_IR] Fix incorrect name in inner class attributes. (vor 4 Tagen) * fae5b8da4bc - [JVM] Do not put the name of default lambda parameter in LVT. (vor 4 Tagen) * e5c46a86aa5 - (tag: build-1.5.0-dev-59) [Commonizer] Minor. Rename file (vor 4 Tagen) * daf42c1ee65 - [Commonizer] Remove unnecessary nullability at CirKnownClassifiers.commonDependeeLibraries (vor 4 Tagen) * 984b3c2f30c - (tag: build-1.5.0-dev-56) Fix to address platform expectation for project path (vor 4 Tagen) * 68f8e88d8b5 - (tag: build-1.5.0-dev-51) [Commonizer] Introduce various types of classifier caches (vor 4 Tagen) * dce3d4d1b71 - [Commonizer] Rename InputTarget and OutputTarget (vor 4 Tagen) * b0ff3e7e5ea - [Commonizer] More fine-grained control of commonized module dependencies (vor 4 Tagen) * 9d749feb644 - (tag: build-1.5.0-dev-49) Fix gradle test for endorsed libraries in K/N (#3953) (vor 4 Tagen) * d25ad269e06 - (tag: build-1.5.0-dev-44) Reuse captured arguments for flexible type's bounds properly, by equality of type constructors modulo mutability and type argument (vor 4 Tagen) * 9f58e4bcfed - Add `FlexibleTypeBoundsChecker` which can answer the question: "can two types be different bounds of the same flexible type?"; and provide the base bound for the given bound. (vor 4 Tagen) * 1ccbb09029e - Fix formatting in flexibleTypes.kt (vor 4 Tagen) * 8e5bcd349e4 - (tag: build-1.5.0-dev-32) [JS IR] Respect JsExport while assigning stable names (vor 4 Tagen) * 6b649d02d3a - (tag: build-1.5.0-dev-31) JVM IR: fix visibility/modality of $suspendImpl methods (vor 4 Tagen) * 8ce2e4654b4 - JVM IR: allow custom toArray to have any array type (vor 4 Tagen) * e6a3e38c4db - (tag: build-1.5.0-dev-27) JVM_IR no static inline class members for Kotlin JvmDefault methods (vor 5 Tagen) * 11673bd09c1 - (tag: build-1.5.0-dev-25) KAPT: add tests for processed types, remove dead code, simplify logic (vor 5 Tagen) * 08a2b47c77c - Incremental KAPT: fix typo and do check processed sources on clean build (vor 5 Tagen) * 0522583602b - Incremental KAPT: add test for isolating AP with classpath origin (vor 5 Tagen) * 05e47da4583 - Incremental KAPT: simplify impacted types computation (vor 5 Tagen) * c7e5beece52 - Use types are origins for incremental KAPT and track generated source (vor 5 Tagen) * d512158c258 - (tag: build-1.5.0-dev-22) [JS IR] Remove redundant guard assertion for extension funs with default params (vor 5 Tagen) * a917ebd11e6 - (tag: build-1.5.0-dev-19) JVM IR: use origin to detect property/typealias $annotations methods (vor 5 Tagen) * c7c793c7245 - JVM IR: do not use origin DEFAULT_IMPLS_BRIDGE(_TO_SYNTHETIC) (vor 5 Tagen) * d41d1bf64d0 - JVM IR: remove obsolete isDefaultImplsBridge in findInterfaceImplementation (vor 5 Tagen) * be03bc477dd - JVM IR: do not use origin DEFAULT_IMPLS_WITH_MOVED_RECEIVERS(_SYNTHETIC) (vor 5 Tagen) * 988cc521741 - JVM IR: do not use origin DEFAULT_IMPLS_BRIDGE_FOR_COMPATIBILITY(_SYNTHETIC) (vor 5 Tagen) * 697b2b02f15 - (tag: build-1.5.0-dev-18) [JS IR] Add properties lazy initialization with multiple modules (vor 5 Tagen) * 6cb573cb45a - (tag: build-1.5.0-dev-6) [FIR] Import parents of companion objects first (vor 5 Tagen) * 4d7b6c022b2 - (tag: build-1.5.0-dev-5) [FIR IDE] LC Anonymous to SuperClass type substitution (vor 5 Tagen) * 842d31d04ea - [FIR IDE] Fix HL API test data (vor 5 Tagen) * 7cbcde77dd3 - [FIR IDE] LC More accurate fields visibility and modality (vor 5 Tagen) * a7d7aa123ef - [FIR IDE] LC minor refactorings (vor 5 Tagen) * a1603716ed7 - [FIR IDE] LC Add anonymous objects support (vor 5 Tagen) * 56306673202 - [FIR IDE] LC better support for JvmMultiFileClass annotation (vor 5 Tagen) * 56c3faee00b - [FIR IDE] LC Fix generating unique field names (vor 5 Tagen) * 18e5af37ffe - [FIR IDE] LC Fixed incorrect JvmOverloads (vor 5 Tagen) * 535aa1e9e0d - [FIR IDE] LC expand typealiases for applied annotations (vor 5 Tagen) * 229c6f97acc - [FIR IDE] LC Fixed nullability for getters (vor 5 Tagen) * aff90b335ca - [FIR IDE] LC Implement special keywords like transient, volatile, synchronized, strictfp (vor 5 Tagen) * 6aff96a4018 - [FIR IDE] Remove extra analyzing for local declarations (vor 5 Tagen) * 3fc424246bd - [FIR IDE] LC basic support for type arguments (vor 5 Tagen) * 2a8f7833933 - [FIR IDE] HL API Better support of nullability and modality (vor 5 Tagen) * 4c69043a152 - [FIR IDE] Move refactoring and minor bugfixing for modality, jvmname, etc. (vor 5 Tagen) * 3e3ec5fc69f - [FIR IDE] Supporting member scopes in EnumEntries (vor 5 Tagen) * fdaf31dbf3f - [FIR IDE] Fix typemapping for FirTypeAliasSymbol (vor 5 Tagen) * aae0081f3fd - [FIR IDE] Fixed invalid HL API getters request (vor 5 Tagen) * 2429f429c5e - (tag: build-1.5.0-dev-4) [FIR] Set isStubTypeEqualsToAnything = true for inference as in FE 1.0 (vor 5 Tagen) * eae8821dec1 - FIR Java: unbind possible named annotation cycle (vor 5 Tagen) * 2ffedd27311 - (tag: build-1.5.0-dev-2) Fix Daemon compiler tests on Windows (vor 5 Tagen) * 8a969dab7d0 - (tag: build-1.5.0-dev-1, tag: build-1.4.30-dev-3428) Bugfix for FIR (vor 5 Tagen) * b23d7a79b0e - IR: get rid of WrappedDescriptorWithContainerSource (vor 5 Tagen) * c0cd9064d72 - IR: IrMemberWithContainerSource (vor 5 Tagen) * 14b773c1fd1 - JVM_IR: do not rely on DescriptorWithContainerSource in InlineCodegen (vor 5 Tagen) * f0a787551a2 - (tag: build-1.4.30-dev-3420) Value classes: Raise retention of @JvmInline to RUNTIME (vor 5 Tagen) * 129de76288f - Value classes: Generate @JvmInline annotation for inline classes (vor 5 Tagen) * ae8abd18327 - (tag: build-1.4.30-dev-3406, origin/master-for-ide) Minor: ignore nestedBigArityFunCalls.kt in WASM (vor 6 Tagen) * 1412ee96f89 - JVM_IR KT-43524 static wrappers for deprecated accessors are deprecated (vor 6 Tagen) * e96fc74ffa4 - JVM_IR KT-43519 no delegates for external funs in multifile facades (vor 6 Tagen) * 2b4564059e0 - JVM_IR KT-43459 fix $annotations method receiver type (vor 6 Tagen) * 85b59489319 - JVM_IR KT-43051 no static inline class members for default Java methods (vor 6 Tagen) * 4c3ffc34515 - JVM_IR KT-41911 process big arity 'invoke' arguments recursively (vor 6 Tagen) * b0e2d5637d4 - (tag: build-1.4.30-dev-3405) Mute a test for WASM (vor 6 Tagen) * bb4950a0215 - (tag: build-1.4.30-dev-3397) Regenerate LightAnalysis tests (vor 6 Tagen) * 91bccad72bd - (tag: build-1.4.30-dev-3396) [JS] Fix path of generated js tests (vor 6 Tagen) * 7550a1870b9 - (tag: build-1.4.30-dev-3391) [FIR2IR] Make checks about f/o accessors necessity more precise (vor 6 Tagen) * b179b567a98 - (tag: build-1.4.30-dev-3389) [Gradle, JS] Add test on resolution of js project with directory dependency (vor 6 Tagen) * 2fdc2dfaaf0 - (tag: build-1.4.30-dev-3388) JVM IR: fix regression in JvmStatic-in-object lowering for properties (vor 6 Tagen) * 4607eca987c - (tag: build-1.4.30-dev-3383) JVM_IR: bug fix in classFileContainsMethod (vor 6 Tagen) * f50480d2588 - (tag: build-1.4.30-dev-3378) FIR IDE: Fix resolving of nested types in type references (vor 6 Tagen) * 94a5379631b - FIR IDE: Add tests for resolving from nested types references (vor 6 Tagen) * 19ca9c0fdeb - (tag: build-1.4.30-dev-3364) Enable JVM IR for bootstrap in the project (vor 6 Tagen) * 606de266461 - (tag: build-1.4.30-dev-3362) JVM IR: fix generation of equals/hashCode for fun interfaces over references (vor 7 Tagen) * 50ae360ff93 - (tag: build-1.4.30-dev-3360) FIR2IR: fix the way annotations are moved to fields (vor 7 Tagen) * 4817d5e01d5 - (tag: build-1.4.30-dev-3354) KTIJ-585 [Gradle Runner]: main() cannot be launched from AS 4.1 (vor 7 Tagen) * 995d96e5a37 - (tag: build-1.4.30-dev-3350) [JS IR] Use one concat elements for non vararg and vararg arguments (vor 7 Tagen) * 67e4b0948e7 - [JS IR] Constructor call with vararg invoking with apply (vor 7 Tagen) * ac42dcd8dae - [JS IR] Add test for external fun vararg (vor 7 Tagen) * e7789d2e308 - (tag: build-1.4.30-dev-3348) [Gradle, JS] Add filter on file on fileCollectionDependencies because Gradle can't hash directory (vor 7 Tagen) * 96ed99d62e1 - (tag: build-1.4.30-dev-3343, tag: build-1.4.30-M1-7, tag: build-1.4.30-M1-4) JVM_IR KT-40305 no nullability assertions on built-in stubs (vor 7 Tagen) * b2aed536c99 - JVM_IR KT-39612 process subexpressions recursively in 'name' lowering (vor 7 Tagen) * 3b604cfa7f5 - JVM_IR KT-32701 generate multiple big arity invokes, report error later (vor 7 Tagen) * a157b58c61f - JVM_IR KT-43610 keep track of "special bridges" for interface funs (vor 7 Tagen) * c43db2ee8de - (tag: build-1.4.30-dev-3341) [TEST] Inherit `UpdateConfigurationQuickFixTest` from `KotlinLightPlatformCodeInsightFixtureTestCase` (vor 7 Tagen) * 7d9eeb68475 - (tag: build-1.4.30-dev-3338) Minor, add workaround for KT-42137 (vor 7 Tagen) * e1d54bf99f8 - Minor, add workaround for KT-43666 (vor 7 Tagen) * ad579de3284 - (tag: build-1.4.30-dev-3337) Don't run KaptPathsTest.testSymbolicLinks test on Windows (vor 7 Tagen) * d706a7ff740 - (tag: build-1.4.30-dev-3331, tag: build-1.4.30-3) Build: mute failing tests (vor 7 Tagen) * 1cccf2645fa - (tag: build-1.4.30-dev-3330) FIR: serialize HAS_CONSTANT at least for const properties (vor 7 Tagen) * 04d9afe83e3 - FIR Java: add workaround for classId = null in JavaAnnotation (vor 7 Tagen) * feb13f98c02 - [FIR2IR] Handle Java annotation parameter mapping properly (vor 7 Tagen) * 9b30655d664 - [FIR] Load Java annotations named arguments properly (see KT-43584) (vor 7 Tagen) * e6f380182a6 - (tag: build-1.4.30-dev-3329) Revert "FIR IDE: Add tests for resolving from nested types references" (vor 7 Tagen) * f8b6559b6a4 - Revert "FIR IDE: Fix resolving of nested types in type references" (vor 7 Tagen) * dba14ba9955 - (tag: build-1.4.30-dev-3327) FIR IDE: Fix resolving of nested types in type references (vor 7 Tagen) * e127ea3dadd - FIR IDE: Add tests for resolving from nested types references (vor 7 Tagen) * 8a00470b40b - (tag: build-1.4.30-dev-3324) Enable kotlin-annotation-processing-base tests on TC (vor 7 Tagen) * 29bed39a54c - (tag: build-1.4.30-dev-3319, tag: build-1.4.30-2) Bump to native version version with watchos_x64 enabled (vor 7 Tagen) * 37ee2cbe537 - [KT-43276] Update tests to support watchos_x64 (vor 7 Tagen) * d6f54a77307 - [KT-43276] Fix `watchos` target shortcut. (vor 7 Tagen) * f3424a98b7b - generateMppTargetContainerWithPresets: remove unneeded hack (vor 7 Tagen) * e39560b1345 - [KT-43276] Add watchos_x64 target (vor 7 Tagen) --- kotlin-native/gradle.properties | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kotlin-native/gradle.properties b/kotlin-native/gradle.properties index 06c624a8074..3af11404c75 100644 --- a/kotlin-native/gradle.properties +++ b/kotlin-native/gradle.properties @@ -18,12 +18,12 @@ buildKotlinVersion=1.4.20-dev-2167 buildKotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:1.4.20-dev-2167,branch:default:any,pinned:true/artifacts/content/maven remoteRoot=konan_tests -kotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:1.4.30-dev-3308,branch:default:any,pinned:true/artifacts/content/maven -kotlinVersion=1.4.30-dev-3308 -kotlinStdlibRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:1.4.30-dev-3308,branch:default:any,pinned:true/artifacts/content/maven -kotlinStdlibVersion=1.4.30-dev-3308 -kotlinStdlibTestsVersion=1.4.30-dev-3308 -testKotlinCompilerVersion=1.4.30-dev-3308 +kotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:1.5.0-dev-156,branch:default:any,pinned:true/artifacts/content/maven +kotlinVersion=1.5.0-dev-156 +kotlinStdlibRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:1.5.0-dev-156,branch:default:any,pinned:true/artifacts/content/maven +kotlinStdlibVersion=1.5.0-dev-156 +kotlinStdlibTestsVersion=1.5.0-dev-156 +testKotlinCompilerVersion=1.5.0-dev-156 konanVersion=1.5.0 # A version of Xcode required to build the Kotlin/Native compiler. From eaa7cf44c83f4873114ec9b18627f1fc8075f44b Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Mon, 7 Dec 2020 07:14:35 +0100 Subject: [PATCH 673/698] [IR] adopts 5d9e86863a33c9c6969fb2747b4edbc00d8697bc [IR] Make isHidden and isAssignable explicit on IrValueParameter. --- .../src/org/jetbrains/kotlin/backend/konan/Boxing.kt | 8 ++++++-- .../konan/BuiltInFictitiousFunctionIrClassFactory.kt | 6 ++++-- .../src/org/jetbrains/kotlin/backend/konan/EntryPoint.kt | 4 +++- .../org/jetbrains/kotlin/backend/konan/cgen/CBridgeGen.kt | 5 +++-- .../kotlin/backend/konan/cgen/CBridgeGenUtils.kt | 2 +- .../kotlin/backend/konan/lower/BridgesBuilding.kt | 3 ++- .../backend/konan/lower/EnumConstructorsLowering.kt | 4 +++- .../kotlin/backend/konan/lower/InteropLowering.kt | 4 +++- .../src/org/jetbrains/kotlin/ir/util/IrUtils2.kt | 2 +- 9 files changed, 26 insertions(+), 12 deletions(-) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Boxing.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Boxing.kt index a6b01056bde..bf75c8f8cb7 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Boxing.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Boxing.kt @@ -87,7 +87,9 @@ internal val Context.getBoxFunction: (IrClass) -> IrSimpleFunction by Context.la varargElementType = null, isCrossinline = false, type = parameterType, - isNoinline = false + isNoinline = false, + isHidden = false, + isAssignable = false ).apply { it.bind(this) parent = function @@ -142,7 +144,9 @@ internal val Context.getUnboxFunction: (IrClass) -> IrSimpleFunction by Context. varargElementType = null, isCrossinline = false, type = parameterType, - isNoinline = false + isNoinline = false, + isHidden = false, + isAssignable = false ).apply { it.bind(this) parent = function diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/BuiltInFictitiousFunctionIrClassFactory.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/BuiltInFictitiousFunctionIrClassFactory.kt index a3afe3410a3..2c0c4bdccc8 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/BuiltInFictitiousFunctionIrClassFactory.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/BuiltInFictitiousFunctionIrClassFactory.kt @@ -213,7 +213,7 @@ internal class BuiltInFictitiousFunctionIrClassFactory( SYNTHETIC_OFFSET, SYNTHETIC_OFFSET, invokeFunctionOrigin, IrValueParameterSymbolImpl(it), it.name, it.index, functionClass.typeParameters[it.index].defaultType, null, - it.isCrossinline, it.isNoinline + it.isCrossinline, it.isNoinline, false, false ).also { it.parent = this } } if (!isFakeOverride) @@ -271,7 +271,9 @@ internal class BuiltInFictitiousFunctionIrClassFactory( toIrType(descriptor.type), varargType?.let { toIrType(it) }, descriptor.isCrossinline, - descriptor.isNoinline + descriptor.isNoinline, + false, + false ).also { it.parent = this } diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/EntryPoint.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/EntryPoint.kt index 282ee96fecf..433abae593d 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/EntryPoint.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/EntryPoint.kt @@ -55,7 +55,9 @@ internal fun makeEntryPoint(context: Context): IrFunction { varargElementType = null, isCrossinline = false, type = context.irBuiltIns.arrayClass.typeWith(context.irBuiltIns.stringType), - isNoinline = false + isNoinline = false, + isAssignable = false, + isHidden = false ).apply { it.bind(this) parent = function diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/cgen/CBridgeGen.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/cgen/CBridgeGen.kt index 7c0c6563e02..c0ba2c18396 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/cgen/CBridgeGen.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/cgen/CBridgeGen.kt @@ -1142,7 +1142,7 @@ private class ObjCBlockPointerValuePassing( Name.identifier("blockPointer"), 0, symbols.nativePtrType, - varargElementType = null, isCrossinline = false, isNoinline = false + varargElementType = null, isCrossinline = false, isNoinline = false, isHidden = false, isAssignable = false ) constructorParameterDescriptor.bind(constructorParameter) constructor.valueParameters += constructorParameter @@ -1187,7 +1187,8 @@ private class ObjCBlockPointerValuePassing( Name.identifier("p$index"), index, functionType.arguments[index].typeOrNull!!, - varargElementType = null, isCrossinline = false, isNoinline = false + varargElementType = null, isCrossinline = false, isNoinline = false, + isHidden = false, isAssignable = false ) parameterDescriptor.bind(parameter) parameter.parent = invokeMethod diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/cgen/CBridgeGenUtils.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/cgen/CBridgeGenUtils.kt index dee663372ef..09bf3a26deb 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/cgen/CBridgeGenUtils.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/cgen/CBridgeGenUtils.kt @@ -87,7 +87,7 @@ internal class KotlinBridgeBuilder( bridge.startOffset, bridge.endOffset, bridge.origin, IrValueParameterSymbolImpl(descriptor), Name.identifier("p$index"), index, type, - null, false, false + null, false, false, false, false ).apply { descriptor.bind(this) parent = bridge diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/BridgesBuilding.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/BridgesBuilding.kt index a5bee8d2929..95695631ea7 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/BridgesBuilding.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/BridgesBuilding.kt @@ -104,7 +104,8 @@ internal class WorkersBridgesBuilding(val context: Context) : DeclarationContain varargElementType = null, isCrossinline = arg.isCrossinline, isNoinline = arg.isNoinline, - isAssignable = arg.isAssignable + isAssignable = arg.isAssignable, + isHidden = arg.isHidden ).apply { it.bind(this) } } } diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/EnumConstructorsLowering.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/EnumConstructorsLowering.kt index 6208ec8a143..e5b0ba52a0c 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/EnumConstructorsLowering.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/EnumConstructorsLowering.kt @@ -141,7 +141,9 @@ internal class EnumConstructorsLowering(val context: Context) : ClassLoweringPas type, varargElementType = null, isCrossinline = false, - isNoinline = false + isNoinline = false, + isHidden = false, + isAssignable = false ).apply { it.bind(this) parent = loweredConstructor diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InteropLowering.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InteropLowering.kt index 791d47dee94..4f5c3803985 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InteropLowering.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InteropLowering.kt @@ -356,7 +356,9 @@ private class InteropLoweringPart1(val context: Context) : BaseInteropIrTransfor type, varargElementType = null, isCrossinline = false, - isNoinline = false + isNoinline = false, + isHidden = false, + isAssignable = false ).apply { it.bind(this) parent = newFunction diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/ir/util/IrUtils2.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/ir/util/IrUtils2.kt index 6d1c44d3d62..0e8fd7ae9d1 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/ir/util/IrUtils2.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/ir/util/IrUtils2.kt @@ -374,7 +374,7 @@ fun IrValueParameter.copy(newDescriptor: ParameterDescriptor): IrValueParameter return IrValueParameterImpl( startOffset, endOffset, IrDeclarationOrigin.DEFINED, IrValueParameterSymbolImpl(newDescriptor), newDescriptor.name, newDescriptor.indexOrMinusOne, type, varargElementType, - newDescriptor.isCrossinline, newDescriptor.isNoinline + newDescriptor.isCrossinline, newDescriptor.isNoinline, false, false ) } From b6497d07cf068b80e3602ec0c0966ea19be744e8 Mon Sep 17 00:00:00 2001 From: LepilkinaElena Date: Tue, 8 Dec 2020 08:17:26 +0300 Subject: [PATCH 674/698] Inline properties accessors for release builds (#4570) --- .../backend/konan/KonanLoweringPhases.kt | 7 ++++++ .../kotlin/backend/konan/ToplevelPhases.kt | 5 ++++ .../kotlin/backend/konan/lower/Autoboxing.kt | 24 +++++++++++++++++++ .../konan/lower/InitializersLowering.kt | 4 +++- 4 files changed, 39 insertions(+), 1 deletion(-) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLoweringPhases.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLoweringPhases.kt index 455663de5a4..d445332e8a5 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLoweringPhases.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLoweringPhases.kt @@ -8,6 +8,7 @@ import org.jetbrains.kotlin.backend.common.lower.inline.LocalClassesInInlineFunc import org.jetbrains.kotlin.backend.common.lower.inline.LocalClassesInInlineLambdasLowering import org.jetbrains.kotlin.backend.common.lower.loops.ForLoopsLowering import org.jetbrains.kotlin.backend.common.lower.optimizations.FoldConstantLowering +import org.jetbrains.kotlin.backend.common.lower.optimizations.PropertyAccessorInlineLowering import org.jetbrains.kotlin.backend.common.phaser.* import org.jetbrains.kotlin.backend.konan.lower.* import org.jetbrains.kotlin.backend.konan.lower.FinallyBlocksLowering @@ -106,6 +107,12 @@ internal val lateinitPhase = makeKonanModuleOpPhase( description = "Lateinit properties lowering" ) +internal val propertyAccessorInlinePhase = makeKonanModuleLoweringPhase( + ::PropertyAccessorInlineLowering, + name = "PropertyAccessorInline", + description = "Property accessor inline lowering" +) + internal val sharedVariablesPhase = makeKonanModuleLoweringPhase( ::SharedVariablesLowering, name = "SharedVariables", diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ToplevelPhases.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ToplevelPhases.kt index 4c24ed52d02..66df2320878 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ToplevelPhases.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ToplevelPhases.kt @@ -391,6 +391,8 @@ internal val bitcodePhase = NamedCompilerPhase( ghaPhase then RTTIPhase then generateDebugInfoHeaderPhase then + propertyAccessorInlinePhase then // Have to run after link dependencies phase, because fields + // from dependencies can be changed during lowerings. escapeAnalysisPhase then localEscapeAnalysisPhase then codegenPhase then @@ -468,6 +470,9 @@ internal fun PhaseConfig.konanPhasesConfig(config: KonanConfig) { disableUnless(buildDFGPhase, getBoolean(KonanConfigKeys.OPTIMIZATION)) disableUnless(devirtualizationPhase, getBoolean(KonanConfigKeys.OPTIMIZATION)) disableUnless(escapeAnalysisPhase, getBoolean(KonanConfigKeys.OPTIMIZATION)) + // Inline accessors only in optimized builds due to separate compilation and possibility to get broken + // debug information. + disableUnless(propertyAccessorInlinePhase, getBoolean(KonanConfigKeys.OPTIMIZATION)) disableUnless(dcePhase, getBoolean(KonanConfigKeys.OPTIMIZATION)) disableUnless(ghaPhase, getBoolean(KonanConfigKeys.OPTIMIZATION)) disableUnless(verifyBitcodePhase, config.needCompilerVerification || getBoolean(KonanConfigKeys.VERIFY_BITCODE)) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/Autoboxing.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/Autoboxing.kt index 91e9913eb05..bb051fd43b6 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/Autoboxing.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/Autoboxing.kt @@ -309,6 +309,30 @@ private class InlineClassTransformer(private val context: Context) : IrBuildingT return declaration } + override fun visitCall(expression: IrCall): IrExpression { + expression.transformChildrenVoid(this) + // Make replacement only in optimized builds due to separate compilation and possibility to get broken + // debug information. + if (!context.shouldOptimize()) + return expression + + val property = expression.symbol.owner.correspondingPropertySymbol?.owner ?: return expression + + property.parent.let { + if (it is IrClass && it.isInline && property.backingField != null) { + expression.dispatchReceiver?.let { receiver -> + return builder.at(expression) + .irCall(symbols.reinterpret, expression.type, listOf(receiver.type, expression.type)) + .apply { + extensionReceiver = receiver + } + } + } + } + + return expression + } + private fun IrBuilderWithScope.irIsNull(expression: IrExpression): IrExpression { val binary = expression.type.computeBinaryType() return when (binary) { diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InitializersLowering.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InitializersLowering.kt index fbfd584ad21..e731dfe571e 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InitializersLowering.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InitializersLowering.kt @@ -82,9 +82,11 @@ internal class InitializersLowering(val context: CommonBackendContext) : ClassLo ) // We shall keep initializer for constants for compile-time instantiation. + // We suppose that if the property is const, then its initializer is IrConst. + // If this requirement isn't satisfied, then PropertyAccessorInlineLowering can fail. declaration.initializer = if (initExpression is IrConst<*> && - (initExpression.type.isPrimitiveType() || initExpression.type.isString())) { + declaration.correspondingPropertySymbol?.owner?.isConst == true) { IrExpressionBodyImpl(initExpression.copy()) } else { null From 783517dbe851fd4cb186948bd1d019c834179713 Mon Sep 17 00:00:00 2001 From: Alexander Shabalin Date: Tue, 8 Dec 2020 10:17:52 +0300 Subject: [PATCH 675/698] Fix unchecked runtime shutdown (#4575) --- .../backend.native/tests/build.gradle | 22 ++++++++++++++++++ .../leakMemoryWithRunningThread/checked.kt | 23 +++++++++++++++++++ .../leakMemory.cpp | 15 ++++++++++++ .../leakMemory.def | 5 ++++ .../leakMemoryWithRunningThread/leakMemory.h | 9 ++++++++ .../leakMemoryWithRunningThread/unchecked.kt | 23 +++++++++++++++++++ .../runtime/src/main/cpp/Runtime.cpp | 13 +++++++---- 7 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 kotlin-native/backend.native/tests/interop/leakMemoryWithRunningThread/checked.kt create mode 100644 kotlin-native/backend.native/tests/interop/leakMemoryWithRunningThread/leakMemory.cpp create mode 100644 kotlin-native/backend.native/tests/interop/leakMemoryWithRunningThread/leakMemory.def create mode 100644 kotlin-native/backend.native/tests/interop/leakMemoryWithRunningThread/leakMemory.h create mode 100644 kotlin-native/backend.native/tests/interop/leakMemoryWithRunningThread/unchecked.kt diff --git a/kotlin-native/backend.native/tests/build.gradle b/kotlin-native/backend.native/tests/build.gradle index 98d48b094bd..a38d5dfc86e 100644 --- a/kotlin-native/backend.native/tests/build.gradle +++ b/kotlin-native/backend.native/tests/build.gradle @@ -3752,6 +3752,12 @@ createInterop("kt43265") { it.defFile 'interop/kt43265/kt43265.def' } +createInterop("leakMemoryWithRunningThread") { + it.defFile 'interop/leakMemoryWithRunningThread/leakMemory.def' + it.headers "$projectDir/interop/leakMemoryWithRunningThread/leakMemory.h" + it.extraOpts "-Xcompile-source", "$projectDir/interop/leakMemoryWithRunningThread/leakMemory.cpp" +} + if (PlatformInfo.isAppleTarget(project)) { createInterop("objcSmoke") { it.defFile 'interop/objc/objcSmoke.def' @@ -4061,6 +4067,22 @@ interopTest("interop_kt43265") { source = "interop/kt43265/usage.kt" } +interopTest("interop_leakMemoryWithRunningThreadUnchecked") { + disabled = project.globalTestArgs.contains('-opt') || (project.testTarget == 'wasm32') // Needs debug build. + interop = 'leakMemoryWithRunningThread' + source = "interop/leakMemoryWithRunningThread/unchecked.kt" + flags = ['-g'] +} + +interopTest("interop_leakMemoryWithRunningThreadChecked") { + disabled = project.globalTestArgs.contains('-opt') || (project.testTarget == 'wasm32') // Needs debug build. + interop = 'leakMemoryWithRunningThread' + source = "interop/leakMemoryWithRunningThread/checked.kt" + flags = ['-g'] + expectedExitStatusChecker = { it != 0 } + outputChecker = { s -> s.contains("Cannot run checkers when there are 1 alive runtimes at the shutdown") } +} + standaloneTest("interop_pinning") { disabled = (project.testTarget == 'wasm32') // Uses exceptions. source = "interop/basics/pinning.kt" diff --git a/kotlin-native/backend.native/tests/interop/leakMemoryWithRunningThread/checked.kt b/kotlin-native/backend.native/tests/interop/leakMemoryWithRunningThread/checked.kt new file mode 100644 index 00000000000..309fce99f4a --- /dev/null +++ b/kotlin-native/backend.native/tests/interop/leakMemoryWithRunningThread/checked.kt @@ -0,0 +1,23 @@ +import leakMemory.* +import kotlin.native.concurrent.* +import kotlin.test.* +import kotlinx.cinterop.* + +val global = AtomicInt(0) + +fun ensureInititalized() { + kotlin.native.initRuntimeIfNeeded() + // Leak memory + StableRef.create(Any()) + global.value = 1 +} + +fun main() { + kotlin.native.internal.Debugging.forceCheckedShutdown = true + assertTrue(global.value == 0) + // Created a thread, made sure Kotlin is initialized there. + test_RunInNewThread(staticCFunction(::ensureInititalized)) + assertTrue(global.value == 1) + // Now exiting. With checked shutdown we will fail, complaining there're + // unfinished threads with runtimes. +} diff --git a/kotlin-native/backend.native/tests/interop/leakMemoryWithRunningThread/leakMemory.cpp b/kotlin-native/backend.native/tests/interop/leakMemoryWithRunningThread/leakMemory.cpp new file mode 100644 index 00000000000..7e213990ab3 --- /dev/null +++ b/kotlin-native/backend.native/tests/interop/leakMemoryWithRunningThread/leakMemory.cpp @@ -0,0 +1,15 @@ +#include "leakMemory.h" + +#include +#include + +extern "C" void test_RunInNewThread(void (*f)()) { + std::atomic haveRun(false); + std::thread t([f, &haveRun]() { + f(); + haveRun = true; + while (true) {} + }); + t.detach(); + while (!haveRun) {} +} diff --git a/kotlin-native/backend.native/tests/interop/leakMemoryWithRunningThread/leakMemory.def b/kotlin-native/backend.native/tests/interop/leakMemoryWithRunningThread/leakMemory.def new file mode 100644 index 00000000000..e487579d85a --- /dev/null +++ b/kotlin-native/backend.native/tests/interop/leakMemoryWithRunningThread/leakMemory.def @@ -0,0 +1,5 @@ +package leakMemory + +--- + +void test_RunInNewThread(void (*)()); diff --git a/kotlin-native/backend.native/tests/interop/leakMemoryWithRunningThread/leakMemory.h b/kotlin-native/backend.native/tests/interop/leakMemoryWithRunningThread/leakMemory.h new file mode 100644 index 00000000000..2342ed9c920 --- /dev/null +++ b/kotlin-native/backend.native/tests/interop/leakMemoryWithRunningThread/leakMemory.h @@ -0,0 +1,9 @@ +#ifdef __cplusplus +extern "C" { +#endif + +void test_RunInNewThread(void (*)()); + +#ifdef __cplusplus +} +#endif diff --git a/kotlin-native/backend.native/tests/interop/leakMemoryWithRunningThread/unchecked.kt b/kotlin-native/backend.native/tests/interop/leakMemoryWithRunningThread/unchecked.kt new file mode 100644 index 00000000000..db770cabe48 --- /dev/null +++ b/kotlin-native/backend.native/tests/interop/leakMemoryWithRunningThread/unchecked.kt @@ -0,0 +1,23 @@ +import leakMemory.* +import kotlin.native.concurrent.* +import kotlin.test.* +import kotlinx.cinterop.* + +val global = AtomicInt(0) + +fun ensureInititalized() { + kotlin.native.initRuntimeIfNeeded() + // Leak memory + StableRef.create(Any()) + global.value = 1 +} + +fun main() { + kotlin.native.internal.Debugging.forceCheckedShutdown = false + assertTrue(global.value == 0) + // Created a thread, made sure Kotlin is initialized there. + test_RunInNewThread(staticCFunction(::ensureInititalized)) + assertTrue(global.value == 1) + // Now exiting. With unchecked shutdown, we exit quietly, even though there're + // unfinished threads with runtimes. +} diff --git a/kotlin-native/runtime/src/main/cpp/Runtime.cpp b/kotlin-native/runtime/src/main/cpp/Runtime.cpp index 42e6594c0a4..9a1f6feb01d 100644 --- a/kotlin-native/runtime/src/main/cpp/Runtime.cpp +++ b/kotlin-native/runtime/src/main/cpp/Runtime.cpp @@ -227,23 +227,28 @@ void Kotlin_shutdownRuntime() { auto lastStatus = compareAndSwap(&globalRuntimeStatus, kGlobalRuntimeRunning, kGlobalRuntimeShutdown); RuntimeAssert(lastStatus == kGlobalRuntimeRunning, "Invalid runtime status for shutdown"); + bool canDestroyRuntime = true; + // TODO: When legacy mode is gone, this `if` will become unnecessary. if (Kotlin_forceCheckedShutdown() || Kotlin_memoryLeakCheckerEnabled() || Kotlin_cleanersLeakCheckerEnabled()) { // First make sure workers are gone. WaitNativeWorkersTermination(); + // Now check for existence of any other runtimes. + auto otherRuntimesCount = atomicGet(&aliveRuntimesCount) - 1; + RuntimeAssert(otherRuntimesCount >= 0, "Cannot be negative"); if (Kotlin_forceCheckedShutdown()) { - // Now check for existence of any other runtimes. - auto otherRuntimesCount = atomicGet(&aliveRuntimesCount) - 1; - RuntimeAssert(otherRuntimesCount >= 0, "Cannot be negative"); if (otherRuntimesCount > 0) { konan::consoleErrorf("Cannot run checkers when there are %d alive runtimes at the shutdown", otherRuntimesCount); konan::abort(); } + } else { + // Cannot destroy runtime globally if there're some other threads with Kotlin runtime on them. + canDestroyRuntime = otherRuntimesCount == 0; } } - deinitRuntime(runtime, true); + deinitRuntime(runtime, canDestroyRuntime); ::runtimeState = kInvalidRuntime; } From 26e861867d7cc5f231a191e51d1f9a7996d87e12 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Fri, 4 Dec 2020 17:32:33 +0300 Subject: [PATCH 676/698] Revert "Disable Hypervisor platform lib to workaround the problem with Xcode 12.2" This reverts commit 44d64b5aa73a665d2eb9d5c77808cef173149d19. --- .../platformLibs/src/platform/osx/Hypervisor.def | 7 +++++++ .../src/platform/osx/Hypervisor.def.disabled | 11 ----------- 2 files changed, 7 insertions(+), 11 deletions(-) create mode 100644 kotlin-native/platformLibs/src/platform/osx/Hypervisor.def delete mode 100644 kotlin-native/platformLibs/src/platform/osx/Hypervisor.def.disabled diff --git a/kotlin-native/platformLibs/src/platform/osx/Hypervisor.def b/kotlin-native/platformLibs/src/platform/osx/Hypervisor.def new file mode 100644 index 00000000000..9bdff403baf --- /dev/null +++ b/kotlin-native/platformLibs/src/platform/osx/Hypervisor.def @@ -0,0 +1,7 @@ +depends = darwin posix +language = Objective-C +package = platform.Hypervisor +modules = Hypervisor + +compilerOpts = -framework Hypervisor +linkerOpts = -framework Hypervisor diff --git a/kotlin-native/platformLibs/src/platform/osx/Hypervisor.def.disabled b/kotlin-native/platformLibs/src/platform/osx/Hypervisor.def.disabled deleted file mode 100644 index c7426077811..00000000000 --- a/kotlin-native/platformLibs/src/platform/osx/Hypervisor.def.disabled +++ /dev/null @@ -1,11 +0,0 @@ -depends = darwin posix -language = Objective-C -package = platform.Hypervisor -modules = Hypervisor - -compilerOpts = -framework Hypervisor -linkerOpts = -framework Hypervisor -#Disabled: doesn't work with macOS 11.0 SDK (Xcode 12.2). -#Fixing this requires to switch this lib from modules to headers, -#but previous versions don't have an umbrella header. -#TODO: fix and enable after updating to Xcode 12.2. From 639029f47e26a2871bc54e81aad46fe02ba5f3e6 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Fri, 4 Dec 2020 17:58:53 +0300 Subject: [PATCH 677/698] Fix macOS Hypervisor platform lib for Xcode 12.2 --- kotlin-native/platformLibs/src/platform/osx/Hypervisor.def | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kotlin-native/platformLibs/src/platform/osx/Hypervisor.def b/kotlin-native/platformLibs/src/platform/osx/Hypervisor.def index 9bdff403baf..e1678dd7b18 100644 --- a/kotlin-native/platformLibs/src/platform/osx/Hypervisor.def +++ b/kotlin-native/platformLibs/src/platform/osx/Hypervisor.def @@ -1,7 +1,10 @@ depends = darwin posix language = Objective-C package = platform.Hypervisor -modules = Hypervisor + +# Using headers instead of modules to workaround incorrect module definition in Xcode 12.2: +headers = Hypervisor/Hypervisor.h +headerFilter = Hypervisor/** compilerOpts = -framework Hypervisor linkerOpts = -framework Hypervisor From c582612bd758cc3ed6b0d8762d8f4c2f94276a2d Mon Sep 17 00:00:00 2001 From: Alexander Shabalin Date: Thu, 10 Dec 2020 09:52:31 +0300 Subject: [PATCH 678/698] Restore runtimeState value in deinitRuntime (#4587) --- .../backend.native/tests/build.gradle | 23 +++++++++++++++++++ .../tests/interop/objc/kt42172/main.kt | 18 +++++++++++++++ .../tests/interop/objc/kt42172/objclib.def | 3 +++ .../tests/interop/objc/kt42172/objclib.h | 9 ++++++++ .../tests/interop/objc/kt42172/objclib.m | 19 +++++++++++++++ .../runtime/src/main/cpp/Runtime.cpp | 7 +++--- 6 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 kotlin-native/backend.native/tests/interop/objc/kt42172/main.kt create mode 100644 kotlin-native/backend.native/tests/interop/objc/kt42172/objclib.def create mode 100644 kotlin-native/backend.native/tests/interop/objc/kt42172/objclib.h create mode 100644 kotlin-native/backend.native/tests/interop/objc/kt42172/objclib.m diff --git a/kotlin-native/backend.native/tests/build.gradle b/kotlin-native/backend.native/tests/build.gradle index a38d5dfc86e..e497fc168ee 100644 --- a/kotlin-native/backend.native/tests/build.gradle +++ b/kotlin-native/backend.native/tests/build.gradle @@ -3813,6 +3813,10 @@ if (PlatformInfo.isAppleTarget(project)) { createInterop("objcKt43517") { it.defFile 'framework/kt43517/kt43517.def' } + createInterop("objc_kt42172") { + it.defFile 'interop/objc/kt42172/objclib.def' + it.headers "$projectDir/interop/objc/kt42172/objclib.h" + } } createInterop("withSpaces") { @@ -4281,6 +4285,25 @@ if (PlatformInfo.isAppleTarget(project)) { it.contains("isObjectAliveShouldCrash") // And should contain stack trace. } } + + interopTest("interop_objc_kt42172") { + source = "interop/objc/kt42172/main.kt" + interop = "objc_kt42172" + flags = ['-Xopt-in=kotlin.native.internal.InternalForKotlinNative'] + goldValue = 'Executed finalizer\n' + + doBeforeBuild { + mkdir(buildDir) + execKonanClang(project.target) { + args "$projectDir/interop/objc/kt42172/objclib.m" + args "-lobjc", '-fobjc-arc' + args '-fPIC', '-shared', '-o', "$buildDir/libobjc_kt42172.dylib" + } + if (project.target instanceof KonanTarget.IOS_X64) { + UtilsKt.codesign(project, "$buildDir/libobjc_kt42172.dylib") + } + } + } } standaloneTest("jsinterop_math") { diff --git a/kotlin-native/backend.native/tests/interop/objc/kt42172/main.kt b/kotlin-native/backend.native/tests/interop/objc/kt42172/main.kt new file mode 100644 index 00000000000..4e1f9cc1b2d --- /dev/null +++ b/kotlin-native/backend.native/tests/interop/objc/kt42172/main.kt @@ -0,0 +1,18 @@ +import objclib.* +import kotlin.native.concurrent.* +import kotlinx.cinterop.* + +fun main() { + val worker = Worker.start() + worker.execute(TransferMode.SAFE, {}) { + val withFinalizer = WithFinalizer() + val finalizer: Finalizer = staticCFunction { ptr: COpaquePointer? -> + ptr?.asStableRef()?.dispose() + println("Executed finalizer") + } + val arg = StableRef.create(Any()).asCPointer() + withFinalizer.setFinalizer(finalizer, arg) + }.result + worker.requestTermination().result + waitWorkerTermination(worker) +} diff --git a/kotlin-native/backend.native/tests/interop/objc/kt42172/objclib.def b/kotlin-native/backend.native/tests/interop/objc/kt42172/objclib.def new file mode 100644 index 00000000000..65bbb0a8ba1 --- /dev/null +++ b/kotlin-native/backend.native/tests/interop/objc/kt42172/objclib.def @@ -0,0 +1,3 @@ +language = Objective-C +headerFilter = **/objclib.h +linkerOpts = -lobjc_kt42172 diff --git a/kotlin-native/backend.native/tests/interop/objc/kt42172/objclib.h b/kotlin-native/backend.native/tests/interop/objc/kt42172/objclib.h new file mode 100644 index 00000000000..77a6036a60f --- /dev/null +++ b/kotlin-native/backend.native/tests/interop/objc/kt42172/objclib.h @@ -0,0 +1,9 @@ +#import + +typedef void (*Finalizer)(void*); + +@interface WithFinalizer : NSObject + +- (void)setFinalizer:(Finalizer)finalizer arg:(void*)arg; + +@end diff --git a/kotlin-native/backend.native/tests/interop/objc/kt42172/objclib.m b/kotlin-native/backend.native/tests/interop/objc/kt42172/objclib.m new file mode 100644 index 00000000000..856eede0330 --- /dev/null +++ b/kotlin-native/backend.native/tests/interop/objc/kt42172/objclib.m @@ -0,0 +1,19 @@ +#include "objclib.h" + +@implementation WithFinalizer { + Finalizer finalizer_; + void* arg_; +} + +- (void)dealloc { + if (finalizer_) { + finalizer_(arg_); + } +} + +- (void)setFinalizer:(Finalizer)finalizer arg:(void*)arg { + finalizer_ = finalizer; + arg_ = arg; +} + +@end diff --git a/kotlin-native/runtime/src/main/cpp/Runtime.cpp b/kotlin-native/runtime/src/main/cpp/Runtime.cpp index 9a1f6feb01d..faa29a629de 100644 --- a/kotlin-native/runtime/src/main/cpp/Runtime.cpp +++ b/kotlin-native/runtime/src/main/cpp/Runtime.cpp @@ -140,7 +140,9 @@ RuntimeState* initRuntime() { void deinitRuntime(RuntimeState* state, bool destroyRuntime) { RuntimeAssert(state->status == RuntimeStatus::kRunning, "Runtime must be in the running state"); state->status = RuntimeStatus::kDestroying; - // This may be called after TLS is zeroed out, so ::memoryState in Memory cannot be trusted. + // This may be called after TLS is zeroed out, so ::runtimeState and ::memoryState in Memory cannot be trusted. + // TODO: This may in fact reallocate TLS without guarantees that it'll be deallocated again. + ::runtimeState = state; RestoreMemory(state->memoryState); bool lastRuntime = atomicAdd(&aliveRuntimesCount, -1) == 0; switch (Kotlin_getDestroyRuntimeMode()) { @@ -159,6 +161,7 @@ void deinitRuntime(RuntimeState* state, bool destroyRuntime) { DeinitMemory(state->memoryState, destroyRuntime); konanDestructInstance(state); WorkerDestroyThreadDataIfNeeded(workerId); + ::runtimeState = kInvalidRuntime; } void Kotlin_deinitRuntimeCallback(void* argument) { @@ -191,7 +194,6 @@ void Kotlin_initRuntimeIfNeeded() { void Kotlin_deinitRuntimeIfNeeded() { if (isValidRuntime()) { deinitRuntime(::runtimeState, false); - ::runtimeState = kInvalidRuntime; } } @@ -249,7 +251,6 @@ void Kotlin_shutdownRuntime() { } deinitRuntime(runtime, canDestroyRuntime); - ::runtimeState = kInvalidRuntime; } KInt Konan_Platform_canAccessUnaligned() { From c7bc8f06910891ae52e42513b5f80fb94042c88a Mon Sep 17 00:00:00 2001 From: SvyatoslavScherbina Date: Thu, 10 Dec 2020 11:56:04 +0300 Subject: [PATCH 679/698] Don't generate ObjCExport bridges for private setters of public properties #KT-43599 Fixed --- .../konan/objcexport/ObjCExportCodeSpec.kt | 5 +++- .../objcexport/ObjCExportHeaderGenerator.kt | 1 + .../tests/objcexport/expectedLazy.h | 20 +++++++++++++ .../tests/objcexport/kt43599.kt | 28 +++++++++++++++++++ .../tests/objcexport/kt43599.swift | 24 ++++++++++++++++ 5 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 kotlin-native/backend.native/tests/objcexport/kt43599.kt create mode 100644 kotlin-native/backend.native/tests/objcexport/kt43599.swift diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportCodeSpec.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportCodeSpec.kt index 842db0ed5b2..88dae17e0b9 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportCodeSpec.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportCodeSpec.kt @@ -22,7 +22,10 @@ internal fun ObjCExportedInterface.createCodeSpec(symbolTable: SymbolTable): Obj fun List.toObjCMethods() = createObjCMethods(this.flatMap { when (it) { - is PropertyDescriptor -> listOfNotNull(it.getter, it.setter) + is PropertyDescriptor -> listOfNotNull( + it.getter, + it.setter?.takeIf(mapper::shouldBeExposed) // Similar to [ObjCExportTranslatorImpl.buildProperty]. + ) is FunctionDescriptor -> listOf(it) else -> error(it) } diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportHeaderGenerator.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportHeaderGenerator.kt index 5b309e2bd00..c23d37ebec0 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportHeaderGenerator.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportHeaderGenerator.kt @@ -552,6 +552,7 @@ internal class ObjCExportTranslatorImpl( val setterName: String? val propertySetter = property.setter + // Note: the condition below is similar to "toObjCMethods" logic in [ObjCExportedInterface.createCodeSpec]. if (propertySetter != null && mapper.shouldBeExposed(propertySetter)) { val setterSelector = mapper.getBaseMethods(propertySetter).map { namer.getSelector(it) }.distinct().single() setterName = if (setterSelector != "set" + name.capitalize() + ":") setterSelector else null diff --git a/kotlin-native/backend.native/tests/objcexport/expectedLazy.h b/kotlin-native/backend.native/tests/objcexport/expectedLazy.h index 85973717d55..0bbb1375263 100644 --- a/kotlin-native/backend.native/tests/objcexport/expectedLazy.h +++ b/kotlin-native/backend.native/tests/objcexport/expectedLazy.h @@ -611,6 +611,26 @@ __attribute__((swift_name("Kt41907Kt"))) + (void)testKt41907O:(id)o __attribute__((swift_name("testKt41907(o:)"))); @end; +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("KT43599"))) +@interface KtKT43599 : KtBase +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +@property (readonly) NSString *memberProperty __attribute__((swift_name("memberProperty"))); +@end; + +@interface KtKT43599 (Kt43599Kt) +@property (readonly) NSString *extensionProperty __attribute__((swift_name("extensionProperty"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("Kt43599Kt"))) +@interface KtKt43599Kt : KtBase ++ (void)setTopLevelLateinitPropertyValue:(NSString *)value __attribute__((swift_name("setTopLevelLateinitProperty(value:)"))); +@property (class, readonly) NSString *topLevelProperty __attribute__((swift_name("topLevelProperty"))); +@property (class, readonly) NSString *topLevelLateinitProperty __attribute__((swift_name("topLevelLateinitProperty"))); +@end; + __attribute__((objc_subclassing_restricted)) __attribute__((swift_name("LibraryKt"))) @interface KtLibraryKt : KtBase diff --git a/kotlin-native/backend.native/tests/objcexport/kt43599.kt b/kotlin-native/backend.native/tests/objcexport/kt43599.kt new file mode 100644 index 00000000000..ecd84c93da5 --- /dev/null +++ b/kotlin-native/backend.native/tests/objcexport/kt43599.kt @@ -0,0 +1,28 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the LICENSE file. + */ + +package kt43599 + +// Note: this test relies on two-stage compilation. + +class KT43599 { + var memberProperty = "memberProperty" + private set +} + +var KT43599.extensionProperty + get() = "extensionProperty" + private set(value) { TODO() } + +var topLevelProperty + get() = "topLevelProperty" + private set(value) { TODO() } + +lateinit var topLevelLateinitProperty: String + private set + +fun setTopLevelLateinitProperty(value: String) { + topLevelLateinitProperty = value +} diff --git a/kotlin-native/backend.native/tests/objcexport/kt43599.swift b/kotlin-native/backend.native/tests/objcexport/kt43599.swift new file mode 100644 index 00000000000..d7ecea36e70 --- /dev/null +++ b/kotlin-native/backend.native/tests/objcexport/kt43599.swift @@ -0,0 +1,24 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the LICENSE file. + */ + +import Kt + +private func testPropertyWithPrivateSetter() throws { + try assertEquals(actual: KT43599().memberProperty, expected: "memberProperty") + try assertEquals(actual: KT43599().extensionProperty, expected: "extensionProperty") + try assertEquals(actual: Kt43599Kt.topLevelProperty, expected: "topLevelProperty") + + // Checking the reported case too: + Kt43599Kt.setTopLevelLateinitProperty(value: "topLevelLateinitProperty") + try assertEquals(actual: Kt43599Kt.topLevelLateinitProperty, expected: "topLevelLateinitProperty") +} + +class Kt43599Tests : SimpleTestProvider { + override init() { + super.init() + + test("TestPropertyWithPrivateSetter", testPropertyWithPrivateSetter) + } +} From 4cf47547360484148cb62a7757f7d3b64036f565 Mon Sep 17 00:00:00 2001 From: Igor Chevdar Date: Thu, 10 Dec 2020 16:08:45 +0500 Subject: [PATCH 680/698] 1.4.21 change log --- kotlin-native/CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kotlin-native/CHANGELOG.md b/kotlin-native/CHANGELOG.md index 480e6fdbe49..36cfbe8afc8 100644 --- a/kotlin-native/CHANGELOG.md +++ b/kotlin-native/CHANGELOG.md @@ -1,3 +1,8 @@ +# 1.4.21 (Dec 2020) + * Fixed [KT-43517](https://youtrack.jetbrains.com/issue/KT-43517) + * Fixed [KT-43530](https://youtrack.jetbrains.com/issue/KT-43530) + * Fixed [KT-43265](https://youtrack.jetbrains.com/issue/KT-43265) + # 1.4.20 (Nov 2020) * XCode 12 support * Completely reworked escape analysis for object allocation From 9c082775e6dac5bb4971305403651e77b7120dd5 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Thu, 3 Dec 2020 17:27:13 +0700 Subject: [PATCH 681/698] Support caches on ios_arm64 --- kotlin-native/build.gradle | 7 ++----- kotlin-native/konan/konan.properties | 10 ++++++++++ .../kotlin/konan/target/Configurables.kt | 3 +++ .../gradle/plugin/konan/tasks/KonanCacheTask.kt | 12 +++++++----- .../cli/utilities/GeneratePlatformLibraries.kt | 17 +++++++++-------- 5 files changed, 31 insertions(+), 18 deletions(-) diff --git a/kotlin-native/build.gradle b/kotlin-native/build.gradle index b630f39f447..ec1b0c730f7 100644 --- a/kotlin-native/build.gradle +++ b/kotlin-native/build.gradle @@ -74,11 +74,8 @@ ext { platformManager = new PlatformManager(DistributionKt.buildDistribution(projectDir.absolutePath), ext.experimentalEnabled) - cacheableTargets = [ - KonanTarget.MACOS_X64.INSTANCE, - KonanTarget.IOS_X64.INSTANCE - ] - cacheableTargetNames = cacheableTargets.collect { it.visibleName } + cacheableTargetNames = platformManager.hostPlatform.cacheableTargets + cacheableTargets = cacheableTargetNames.collect { platformManager.targetByName(it) } // Some targets miss zlib in their sysroots. // We skip these targets when generate a corresponding platform library. diff --git a/kotlin-native/konan/konan.properties b/kotlin-native/konan/konan.properties index d745f1a0616..6c96ef4250b 100644 --- a/kotlin-native/konan/konan.properties +++ b/kotlin-native/konan/konan.properties @@ -63,6 +63,15 @@ llvmVersion.linux_x64 = 8.0.0 llvmVersion.mingw_x64 = 8.0.1 llvmVersion.macos_x64 = 8.0.0 +cacheableTargets.macos_x64 = \ + macos_x64 \ + ios_x64 \ + ios_arm64 + +cacheableTargets.linux_x64 = + +cacheableTargets.mingw_x64 = + # Mac OS X. # Can be an absolute path instead of predefined value. llvmHome.macos_x64 = $llvm.macos_x64.dev @@ -165,6 +174,7 @@ osVersionMinFlagClang.ios_arm64 = -miphoneos-version-min osVersionMin.ios_arm64 = 9.0 runtimeDefinitions.ios_arm64 = KONAN_OBJC_INTEROP=1 KONAN_IOS=1 KONAN_ARM64=1 \ KONAN_HAS_CXX11_EXCEPTION_FUNCTIONS=1 KONAN_REPORT_BACKTRACE_TO_IOS_CRASH_LOG=1 MACHSIZE=64 +additionalCacheFlags.ios_arm64 = -Xembed-bitcode-marker # Apple's iOS simulator. targetToolchain.macos_x64-ios_x64 = target-toolchain-xcode_12_2-macos_x64 diff --git a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Configurables.kt b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Configurables.kt index 4caea4e26ad..fb12b1ad11d 100644 --- a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Configurables.kt +++ b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Configurables.kt @@ -38,6 +38,9 @@ interface Configurables : TargetableExternalStorage { val llvmVersion get() = hostString("llvmVersion") val libffiDir get() = hostString("libffiDir") + val cacheableTargets get() = hostList("cacheableTargets") + val additionalCacheFlags get() = targetList("additionalCacheFlags") + // TODO: Delegate to a map? val linkerOptimizationFlags get() = targetList("linkerOptimizationFlags") val linkerKonanFlags get() = targetList("linkerKonanFlags") diff --git a/kotlin-native/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/konan/tasks/KonanCacheTask.kt b/kotlin-native/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/konan/tasks/KonanCacheTask.kt index abe200aefc7..5f40a175ce8 100644 --- a/kotlin-native/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/konan/tasks/KonanCacheTask.kt +++ b/kotlin-native/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/konan/tasks/KonanCacheTask.kt @@ -4,10 +4,9 @@ import org.gradle.api.DefaultTask import org.gradle.api.provider.Property import org.gradle.api.tasks.* import org.jetbrains.kotlin.gradle.plugin.konan.KonanCompilerRunner -import org.jetbrains.kotlin.gradle.plugin.konan.hostManager import org.jetbrains.kotlin.gradle.plugin.konan.konanHome import org.jetbrains.kotlin.konan.target.CompilerOutputKind -import org.jetbrains.kotlin.konan.target.HostManager +import org.jetbrains.kotlin.konan.target.PlatformManager import java.io.File enum class KonanCacheKind(val outputKind: CompilerOutputKind) { @@ -56,14 +55,17 @@ open class KonanCacheTask: DefaultTask() { val deleted = cacheFile.deleteRecursively() check(deleted) { "Cannot delete stale cache: ${cacheFile.absolutePath}" } } - + val konanHome = compilerDistributionPath.get().absolutePath + val additionalCacheFlags = PlatformManager(konanHome).let { + it.targetByName(target).let(it::loader).additionalCacheFlags + } val args = listOf( "-g", "-target", target, "-produce", cacheKind.outputKind.name.toLowerCase(), "-Xadd-cache=${originalKlib.absolutePath}", "-Xcache-directory=${cacheDirectory.absolutePath}" - ) - KonanCompilerRunner(project, konanHome = compilerDistributionPath.get().absolutePath).run(args) + ) + additionalCacheFlags + KonanCompilerRunner(project, konanHome = konanHome).run(args) } } \ No newline at end of file diff --git a/kotlin-native/utilities/cli-runner/src/main/kotlin/org/jetbrains/kotlin/cli/utilities/GeneratePlatformLibraries.kt b/kotlin-native/utilities/cli-runner/src/main/kotlin/org/jetbrains/kotlin/cli/utilities/GeneratePlatformLibraries.kt index c4fc36d6c58..3bd25c91220 100644 --- a/kotlin-native/utilities/cli-runner/src/main/kotlin/org/jetbrains/kotlin/cli/utilities/GeneratePlatformLibraries.kt +++ b/kotlin-native/utilities/cli-runner/src/main/kotlin/org/jetbrains/kotlin/cli/utilities/GeneratePlatformLibraries.kt @@ -12,10 +12,7 @@ import kotlinx.cli.* import org.jetbrains.kotlin.backend.konan.CachedLibraries import org.jetbrains.kotlin.backend.konan.OutputFiles import org.jetbrains.kotlin.backend.konan.files.renameAtomic -import org.jetbrains.kotlin.konan.target.CompilerOutputKind -import org.jetbrains.kotlin.konan.target.HostManager -import org.jetbrains.kotlin.konan.target.KonanTarget -import org.jetbrains.kotlin.konan.target.customerDistribution +import org.jetbrains.kotlin.konan.target.* import org.jetbrains.kotlin.konan.util.KonanHomeProvider import org.jetbrains.kotlin.konan.util.PlatformLibsInfo import org.jetbrains.kotlin.konan.util.visibleName @@ -28,7 +25,6 @@ import java.nio.file.Files import java.nio.file.Paths import java.util.concurrent.atomic.AtomicInteger import kotlin.system.exitProcess -import java.io.File as JFile // TODO: We definitely need to unify logging in different parts of the compiler. private class Logger(val level: Level = Level.NORMAL) { @@ -126,8 +122,11 @@ fun generatePlatformLibraries(args: Array) { argParser.parse(args) val distribution = customerDistribution(KonanHomeProvider.determineKonanHome()) - val target = HostManager(distribution).targetByName(targetName) - + val platformManager = PlatformManager(distribution) + val target = platformManager.targetByName(targetName) + val targetCacheArgs = platformManager.let { + target.let(it::loader).additionalCacheFlags + } val inputDirectory = inputDirectoryPath?.File() ?: File(distribution.konanSubdir, "platformDef").child(target.visibleName) @@ -148,7 +147,9 @@ fun generatePlatformLibraries(args: Array) { val logger = Logger(if (verbose) Logger.Level.VERBOSE else Logger.Level.NORMAL) - val cacheInfo = cacheDirectory?.let { CacheInfo(it, cacheKind.outputKind.visibleName, cacheArgs) } + val cacheInfo = cacheDirectory?.let { + CacheInfo(it, cacheKind.outputKind.visibleName, cacheArgs + targetCacheArgs) + } generatePlatformLibraries( target, mode, From 658530e820129c26752b6d2ea1e2f0d1f0c1bd0c Mon Sep 17 00:00:00 2001 From: Alexander Shabalin Date: Thu, 10 Dec 2020 18:24:52 +0300 Subject: [PATCH 682/698] StableRef registry (#4567) --- .../runtime/src/main/cpp/MultiSourceQueue.hpp | 111 +++++++++-- .../src/main/cpp/MultiSourceQueueTest.cpp | 182 ++++++++++++++---- .../runtime/src/mm/cpp/GlobalData.hpp | 3 + .../runtime/src/mm/cpp/GlobalsRegistry.hpp | 1 + kotlin-native/runtime/src/mm/cpp/Memory.cpp | 67 +++++++ .../runtime/src/mm/cpp/StableRefRegistry.cpp | 35 ++++ .../runtime/src/mm/cpp/StableRefRegistry.hpp | 73 +++++++ kotlin-native/runtime/src/mm/cpp/Stubs.cpp | 32 --- .../runtime/src/mm/cpp/ThreadData.hpp | 7 +- 9 files changed, 428 insertions(+), 83 deletions(-) create mode 100644 kotlin-native/runtime/src/mm/cpp/StableRefRegistry.cpp create mode 100644 kotlin-native/runtime/src/mm/cpp/StableRefRegistry.hpp diff --git a/kotlin-native/runtime/src/main/cpp/MultiSourceQueue.hpp b/kotlin-native/runtime/src/main/cpp/MultiSourceQueue.hpp index 1a514855141..0c933744aec 100644 --- a/kotlin-native/runtime/src/main/cpp/MultiSourceQueue.hpp +++ b/kotlin-native/runtime/src/main/cpp/MultiSourceQueue.hpp @@ -6,6 +6,7 @@ #ifndef RUNTIME_MULTI_SOURCE_QUEUE_H #define RUNTIME_MULTI_SOURCE_QUEUE_H +#include #include #include @@ -17,51 +18,131 @@ namespace kotlin { template class MultiSourceQueue { public: + class Producer; + + // TODO: Consider switching from `std::list` to `SingleLockList` to hide the constructor + // and to not store the iterator. + class Node : private Pinned { + public: + Node(const T& value, Producer* owner) noexcept : value_(value), owner_(owner) {} + + T& operator*() noexcept { return value_; } + + private: + friend class MultiSourceQueue; + + T value_; + std::atomic owner_; // `nullptr` signifies that `MultiSourceQueue` owns it. + typename std::list::iterator position_; + }; + class Producer { public: explicit Producer(MultiSourceQueue& owner) noexcept : owner_(owner) {} ~Producer() { Publish(); } - void Insert(const T& value) noexcept { queue_.push_back(value); } + Node* Insert(const T& value) noexcept { + queue_.emplace_back(value, this); + auto& node = queue_.back(); + node.position_ = std::prev(queue_.end()); + return &node; + } + + void Erase(Node* node) noexcept { + if (node->owner_ == this) { + // If we own it, delete it immediately. + queue_.erase(node->position_); + return; + } + // If it's owned by the global queue or some other `Producer`, queue it. + deletionQueue_.push_back(node); + } // Merge `this` queue with owning `MultiSourceQueue`. `this` will have empty queue after the call. // This call is performed without heap allocations. TODO: Test that no allocations are happening. - void Publish() noexcept { owner_.Collect(*this); } + void Publish() noexcept { + for (auto& node : queue_) { + node.owner_ = nullptr; + } + std::lock_guard guard(owner_.mutex_); + owner_.queue_.splice(owner_.queue_.end(), queue_); + owner_.deletionQueue_.splice(owner_.deletionQueue_.end(), deletionQueue_); + } + + private: + MultiSourceQueue& owner_; // weak + std::list queue_; + std::list deletionQueue_; + }; + + class Iterator { + public: + T& operator*() noexcept { return **position_; } + + Iterator& operator++() noexcept { + ++position_; + return *this; + } + + bool operator==(const Iterator& rhs) const noexcept { return position_ == rhs.position_; } + + bool operator!=(const Iterator& rhs) const noexcept { return position_ != rhs.position_; } private: friend class MultiSourceQueue; - MultiSourceQueue& owner_; // weak - std::list queue_; - }; + explicit Iterator(const typename std::list::iterator& position) noexcept : position_(position) {} - using Iterator = typename std::list::iterator; + typename std::list::iterator position_; + }; class Iterable : MoveOnly { public: - explicit Iterable(MultiSourceQueue& owner) noexcept : owner_(owner), guard_(owner_.mutex_) {} - - Iterator begin() noexcept { return owner_.commonQueue_.begin(); } - Iterator end() noexcept { return owner_.commonQueue_.end(); } + Iterator begin() noexcept { return Iterator(owner_.queue_.begin()); } + Iterator end() noexcept { return Iterator(owner_.queue_.end()); } private: + friend class MultiSourceQueue; + + explicit Iterable(MultiSourceQueue& owner) noexcept : owner_(owner), guard_(owner_.mutex_) {} + MultiSourceQueue& owner_; // weak std::unique_lock guard_; }; - // Lock MultiSourceQueue for safe iteration. + // Lock `MultiSourceQueue` for safe iteration. If element was scheduled for deletion, + // it'll still be iterated. Use `ApplyDeletions` to remove those elements. Iterable Iter() noexcept { return Iterable(*this); } -private: - void Collect(Producer& producer) noexcept { + // Lock `MultiSourceQueue` and apply deletions. Only deletes elements that were published. + void ApplyDeletions() noexcept { std::lock_guard guard(mutex_); - commonQueue_.splice(commonQueue_.end(), producer.queue_); + std::list remainingDeletions; + + auto it = deletionQueue_.begin(); + while (it != deletionQueue_.end()) { + auto next = std::next(it); + Node* node = *it; + + if (node->owner_ != nullptr) { + // If the `Node` is still owned by some `Producer`, skip it. + remainingDeletions.splice(remainingDeletions.end(), deletionQueue_, it); + } else { + queue_.erase(node->position_); + // `node` is invalid after this + } + + it = next; + } + deletionQueue_ = std::move(remainingDeletions); } +private: // Using `std::list` as it allows to implement `Collect` without memory allocations, // which is important for GC mark phase. - std::list commonQueue_; + std::list queue_; + std::list deletionQueue_; SimpleMutex mutex_; }; diff --git a/kotlin-native/runtime/src/main/cpp/MultiSourceQueueTest.cpp b/kotlin-native/runtime/src/main/cpp/MultiSourceQueueTest.cpp index 60d8e81fa66..62310bf19ee 100644 --- a/kotlin-native/runtime/src/main/cpp/MultiSourceQueueTest.cpp +++ b/kotlin-native/runtime/src/main/cpp/MultiSourceQueueTest.cpp @@ -15,16 +15,109 @@ using namespace kotlin; +namespace { + +template +std::vector Collect(MultiSourceQueue& queue) { + std::vector result; + for (const auto& element : queue.Iter()) { + result.push_back(element); + } + return result; +} + +} // namespace + using IntQueue = MultiSourceQueue; +TEST(MultiSourceQueueTest, Insert) { + IntQueue queue; + IntQueue::Producer producer(queue); + + constexpr int kFirst = 1; + constexpr int kSecond = 2; + + auto* node1 = producer.Insert(kFirst); + auto* node2 = producer.Insert(kSecond); + + EXPECT_THAT(**node1, kFirst); + EXPECT_THAT(**node2, kSecond); +} + +TEST(MultiSourceQueueTest, EraseFromTheSameProducer) { + IntQueue queue; + IntQueue::Producer producer(queue); + + constexpr int kFirst = 1; + constexpr int kSecond = 2; + + producer.Insert(kFirst); + auto* node2 = producer.Insert(kSecond); + producer.Erase(node2); + producer.Publish(); + + auto actual = Collect(queue); + EXPECT_THAT(actual, testing::ElementsAre(kFirst)); +} + +TEST(MultiSourceQueueTest, EraseFromGlobal) { + IntQueue queue; + IntQueue::Producer producer(queue); + + constexpr int kFirst = 1; + constexpr int kSecond = 2; + + producer.Insert(kFirst); + auto* node2 = producer.Insert(kSecond); + producer.Publish(); + producer.Erase(node2); + producer.Publish(); + + auto actual1 = Collect(queue); + EXPECT_THAT(actual1, testing::ElementsAre(kFirst, kSecond)); + + queue.ApplyDeletions(); + + auto actual2 = Collect(queue); + EXPECT_THAT(actual2, testing::ElementsAre(kFirst)); +} + +TEST(MultiSourceQueueTest, EraseFromOtherProducer) { + IntQueue queue; + IntQueue::Producer producer1(queue); + IntQueue::Producer producer2(queue); + + constexpr int kFirst = 1; + constexpr int kSecond = 2; + + producer1.Insert(kFirst); + auto* node2 = producer1.Insert(kSecond); + producer2.Erase(node2); + producer1.Publish(); + + auto actual1 = Collect(queue); + EXPECT_THAT(actual1, testing::ElementsAre(kFirst, kSecond)); + + queue.ApplyDeletions(); + + auto actual2 = Collect(queue); + EXPECT_THAT(actual2, testing::ElementsAre(kFirst, kSecond)); + + producer2.Publish(); + + auto actual3 = Collect(queue); + EXPECT_THAT(actual3, testing::ElementsAre(kFirst, kSecond)); + + queue.ApplyDeletions(); + + auto actual4 = Collect(queue); + EXPECT_THAT(actual4, testing::ElementsAre(kFirst)); +} + TEST(MultiSourceQueueTest, Empty) { IntQueue queue; - std::vector actual; - for (int element : queue.Iter()) { - actual.push_back(element); - } - + auto actual = Collect(queue); EXPECT_THAT(actual, testing::IsEmpty()); } @@ -35,11 +128,7 @@ TEST(MultiSourceQueueTest, DoNotPublish) { producer.Insert(1); producer.Insert(2); - std::vector actual; - for (int element : queue.Iter()) { - actual.push_back(element); - } - + auto actual = Collect(queue); EXPECT_THAT(actual, testing::IsEmpty()); } @@ -56,11 +145,7 @@ TEST(MultiSourceQueueTest, Publish) { producer1.Publish(); producer2.Publish(); - std::vector actual; - for (int element : queue.Iter()) { - actual.push_back(element); - } - + auto actual = Collect(queue); EXPECT_THAT(actual, testing::ElementsAre(1, 2, 10, 20)); } @@ -85,11 +170,7 @@ TEST(MultiSourceQueueTest, PublishSeveralTimes) { producer.Insert(5); producer.Publish(); - std::vector actual; - for (int element : queue.Iter()) { - actual.push_back(element); - } - + auto actual = Collect(queue); EXPECT_THAT(actual, testing::ElementsAre(1, 2, 3, 4, 5)); } @@ -102,11 +183,7 @@ TEST(MultiSourceQueueTest, PublishInDestructor) { producer.Insert(2); } - std::vector actual; - for (int element : queue.Iter()) { - actual.push_back(element); - } - + auto actual = Collect(queue); EXPECT_THAT(actual, testing::ElementsAre(1, 2)); } @@ -137,11 +214,7 @@ TEST(MultiSourceQueueTest, ConcurrentPublish) { t.join(); } - std::vector actual; - for (int element : queue.Iter()) { - actual.push_back(element); - } - + auto actual = Collect(queue); EXPECT_THAT(actual, testing::UnorderedElementsAreArray(expected)); } @@ -198,10 +271,49 @@ TEST(MultiSourceQueueTest, IterWhileConcurrentPublish) { EXPECT_THAT(actualBefore, testing::ElementsAreArray(expectedBefore)); - std::vector actualAfter; - for (int element : queue.Iter()) { - actualAfter.push_back(element); - } - + auto actualAfter = Collect(queue); EXPECT_THAT(actualAfter, testing::UnorderedElementsAreArray(expectedAfter)); } + +TEST(MultiSourceQueueTest, ConcurrentPublishAndApplyDeletions) { + IntQueue queue; + constexpr int kThreadCount = kDefaultThreadCount; + + std::atomic canStart(false); + std::atomic readyCount(0); + std::atomic startedCount(0); + std::vector threads; + for (int i = 0; i < kThreadCount; ++i) { + threads.emplace_back([&queue, i, &canStart, &readyCount, &startedCount]() { + IntQueue::Producer producer(queue); + auto* node = producer.Insert(i); + producer.Publish(); + producer.Erase(node); + ++readyCount; + while (!canStart) { + } + ++startedCount; + producer.Publish(); + }); + } + + while (readyCount < kThreadCount) { + } + canStart = true; + while (startedCount < kThreadCount) { + } + + queue.ApplyDeletions(); + + for (auto& t : threads) { + t.join(); + } + + // We do not know which elements were deleted at this point. Expecting not to crash by this point. + + // This must make the queue empty. + queue.ApplyDeletions(); + + auto actual = Collect(queue); + EXPECT_THAT(actual, testing::IsEmpty()); +} diff --git a/kotlin-native/runtime/src/mm/cpp/GlobalData.hpp b/kotlin-native/runtime/src/mm/cpp/GlobalData.hpp index e063b4e0865..e0b0e0a80e2 100644 --- a/kotlin-native/runtime/src/mm/cpp/GlobalData.hpp +++ b/kotlin-native/runtime/src/mm/cpp/GlobalData.hpp @@ -7,6 +7,7 @@ #define RUNTIME_MM_GLOBAL_DATA_H #include "GlobalsRegistry.hpp" +#include "StableRefRegistry.hpp" #include "ThreadRegistry.hpp" #include "Utils.hpp" @@ -20,6 +21,7 @@ public: ThreadRegistry& threadRegistry() { return threadRegistry_; } GlobalsRegistry& globalsRegistry() { return globalsRegistry_; } + StableRefRegistry& stableRefRegistry() { return stableRefRegistry_; } private: GlobalData(); @@ -29,6 +31,7 @@ private: ThreadRegistry threadRegistry_; GlobalsRegistry globalsRegistry_; + StableRefRegistry stableRefRegistry_; }; } // namespace mm diff --git a/kotlin-native/runtime/src/mm/cpp/GlobalsRegistry.hpp b/kotlin-native/runtime/src/mm/cpp/GlobalsRegistry.hpp index 580ddf74ce4..83d3ceac83f 100644 --- a/kotlin-native/runtime/src/mm/cpp/GlobalsRegistry.hpp +++ b/kotlin-native/runtime/src/mm/cpp/GlobalsRegistry.hpp @@ -46,6 +46,7 @@ private: GlobalsRegistry(); ~GlobalsRegistry(); + // TODO: Add-only MultiSourceQueue can be made more efficient. Measure, if it's a problem. MultiSourceQueue globals_; }; diff --git a/kotlin-native/runtime/src/mm/cpp/Memory.cpp b/kotlin-native/runtime/src/mm/cpp/Memory.cpp index 9da3c14963f..ba9ab725eeb 100644 --- a/kotlin-native/runtime/src/mm/cpp/Memory.cpp +++ b/kotlin-native/runtime/src/mm/cpp/Memory.cpp @@ -6,6 +6,7 @@ #include "Memory.h" #include "GlobalsRegistry.hpp" +#include "StableRefRegistry.hpp" #include "ThreadData.hpp" #include "ThreadRegistry.hpp" #include "Utils.hpp" @@ -19,6 +20,15 @@ extern "C" struct MemoryState : Pinned { ~MemoryState() = delete; }; +// TODO: This name does not make sense anymore. +// Delete all means of creating this type directly as it only serves +// as a typedef for `mm::StableRefRegistry::Node`. +class ForeignRefManager : Pinned { +public: + ForeignRefManager() = delete; + ~ForeignRefManager() = delete; +}; + namespace { // `reinterpret_cast` to it and back to the same type @@ -31,6 +41,14 @@ ALWAYS_INLINE mm::ThreadRegistry::Node* FromMemoryState(MemoryState* state) { return reinterpret_cast(state); } +ALWAYS_INLINE ForeignRefManager* ToForeignRefManager(mm::StableRefRegistry::Node* data) { + return reinterpret_cast(data); +} + +ALWAYS_INLINE mm::StableRefRegistry::Node* FromForeignRefManager(ForeignRefManager* manager) { + return reinterpret_cast(manager); +} + ALWAYS_INLINE mm::ThreadData* GetThreadData(MemoryState* state) { return FromMemoryState(state)->Get(); } @@ -75,3 +93,52 @@ extern "C" RUNTIME_NOTHROW void ClearTLS(MemoryState* memory) { extern "C" RUNTIME_NOTHROW ObjHeader** LookupTLS(void** key, int index) { return mm::ThreadRegistry::Instance().CurrentThreadData()->tls().Lookup(key, index); } + +extern "C" RUNTIME_NOTHROW void* CreateStablePointer(ObjHeader* object) { + auto* threadData = mm::ThreadRegistry::Instance().CurrentThreadData(); + return mm::StableRefRegistry::Instance().RegisterStableRef(threadData, object); +} + +extern "C" RUNTIME_NOTHROW void DisposeStablePointer(void* pointer) { + auto* threadData = mm::ThreadRegistry::Instance().CurrentThreadData(); + auto* node = static_cast(pointer); + mm::StableRefRegistry::Instance().UnregisterStableRef(threadData, node); +} + +extern "C" RUNTIME_NOTHROW OBJ_GETTER(DerefStablePointer, void* pointer) { + auto* node = static_cast(pointer); + ObjHeader* object = **node; + RETURN_OBJ(object); +} + +extern "C" RUNTIME_NOTHROW OBJ_GETTER(AdoptStablePointer, void* pointer) { + auto* threadData = mm::ThreadRegistry::Instance().CurrentThreadData(); + auto* node = static_cast(pointer); + ObjHeader* object = **node; + UpdateReturnRef(OBJ_RESULT, object); + mm::StableRefRegistry::Instance().UnregisterStableRef(threadData, node); + return object; +} + +extern "C" ForeignRefContext InitForeignRef(ObjHeader* object) { + auto* threadData = mm::ThreadRegistry::Instance().CurrentThreadData(); + auto* node = mm::StableRefRegistry::Instance().RegisterStableRef(threadData, object); + return ToForeignRefManager(node); +} + +extern "C" void DeinitForeignRef(ObjHeader* object, ForeignRefContext context) { + auto* threadData = mm::ThreadRegistry::Instance().CurrentThreadData(); + auto* node = FromForeignRefManager(context); + RuntimeAssert(object == **node, "Must correspond to the same object"); + mm::StableRefRegistry::Instance().UnregisterStableRef(threadData, node); +} + +extern "C" bool IsForeignRefAccessible(ObjHeader* object, ForeignRefContext context) { + // TODO: Remove when legacy MM is gone. + return true; +} + +extern "C" void AdoptReferenceFromSharedVariable(ObjHeader* object) { + // TODO: Remove when legacy MM is gone. + // Nothing to do. +} diff --git a/kotlin-native/runtime/src/mm/cpp/StableRefRegistry.cpp b/kotlin-native/runtime/src/mm/cpp/StableRefRegistry.cpp new file mode 100644 index 00000000000..ee4232c7273 --- /dev/null +++ b/kotlin-native/runtime/src/mm/cpp/StableRefRegistry.cpp @@ -0,0 +1,35 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the LICENSE file. + */ + +#include "StableRefRegistry.hpp" + +#include "GlobalData.hpp" +#include "ThreadData.hpp" + +using namespace kotlin; + +// static +mm::StableRefRegistry& mm::StableRefRegistry::Instance() noexcept { + return GlobalData::Instance().stableRefRegistry(); +} + +mm::StableRefRegistry::Node* mm::StableRefRegistry::RegisterStableRef(mm::ThreadData* threadData, ObjHeader* object) noexcept { + return threadData->stableRefThreadQueue().Insert(object); +} + +void mm::StableRefRegistry::UnregisterStableRef(mm::ThreadData* threadData, Node* node) noexcept { + threadData->stableRefThreadQueue().Erase(node); +} + +void mm::StableRefRegistry::ProcessThread(mm::ThreadData* threadData) noexcept { + threadData->stableRefThreadQueue().Publish(); +} + +void mm::StableRefRegistry::ProcessDeletions() noexcept { + stableRefs_.ApplyDeletions(); +} + +mm::StableRefRegistry::StableRefRegistry() = default; +mm::StableRefRegistry::~StableRefRegistry() = default; diff --git a/kotlin-native/runtime/src/mm/cpp/StableRefRegistry.hpp b/kotlin-native/runtime/src/mm/cpp/StableRefRegistry.hpp new file mode 100644 index 00000000000..dc2410e4cc6 --- /dev/null +++ b/kotlin-native/runtime/src/mm/cpp/StableRefRegistry.hpp @@ -0,0 +1,73 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the LICENSE file. + */ + +#ifndef RUNTIME_MM_STABLE_REF_REGISTRY_H +#define RUNTIME_MM_STABLE_REF_REGISTRY_H + +#include "Memory.h" +#include "MultiSourceQueue.hpp" +#include "ThreadRegistry.hpp" + +namespace kotlin { +namespace mm { + +// Registry for all objects that have references outside of Kotlin. +class StableRefRegistry : Pinned { +public: + class ThreadQueue : public MultiSourceQueue::Producer { + public: + explicit ThreadQueue(StableRefRegistry& registry) : Producer(registry.stableRefs_) {} + // Do not add fields as this is just a wrapper and Producer does not have virtual destructor. + }; + + using Iterable = MultiSourceQueue::Iterable; + using Iterator = MultiSourceQueue::Iterator; + using Node = MultiSourceQueue::Node; + + static StableRefRegistry& Instance() noexcept; + + Node* RegisterStableRef(mm::ThreadData* threadData, ObjHeader* object) noexcept; + + void UnregisterStableRef(mm::ThreadData* threadData, Node* node) noexcept; + + // Collect stable references from thread corresponding to `threadData`. Must be called by the thread + // when it's asked by GC to stop. + void ProcessThread(mm::ThreadData* threadData) noexcept; + + // Lock registry and apply deletions. Should be called on GC thread after all threads have published, and before `Iter`. + void ProcessDeletions() noexcept; + + // Lock registry for safe iteration. + // TODO: Iteration over `stableRefs_` will be slow, because it's `std::list` collected at different times from + // different threads, and so the nodes are all over the memory. Use metrics to understand how + // much of a problem is it. + Iterable Iter() noexcept { return stableRefs_.Iter(); } + +private: + friend class GlobalData; + + StableRefRegistry(); + ~StableRefRegistry(); + + // Current approach optimizes for creating and disposing of stable refs: + // * creation just enqueues ref, disposing either queues or deletes the ref immediately (if it still resides in the current queue). + // * when thread is stopped, it'll scan through the local queue (to mark that refs no longer reside in it) and push creation and + // deletion queues to the global registry. + // * during marking GC will have to `ProcessDeletions` to actually delete the refs that were enqueued for deletion. + // So, we sacrifice memory (to keep deleted queues) and marking time (to process these queues) to improve creation and disposal times. + // + // Other alternatives: + // * Use a single global collection (e.g. lock free doubly linked list). + // * Sacrifice disposal time to try to delete as early as possible (e.g. post directly into owning producer, so it processes deletions + // before posting queue to the global registry) + // + // TODO: Measure to understand, if this approach is problematic. + MultiSourceQueue stableRefs_; +}; + +} // namespace mm +} // namespace kotlin + +#endif // RUNTIME_MM_STABLE_REF_REGISTRY_H diff --git a/kotlin-native/runtime/src/mm/cpp/Stubs.cpp b/kotlin-native/runtime/src/mm/cpp/Stubs.cpp index fa8b621acca..5b67ff9f063 100644 --- a/kotlin-native/runtime/src/mm/cpp/Stubs.cpp +++ b/kotlin-native/runtime/src/mm/cpp/Stubs.cpp @@ -126,22 +126,6 @@ RUNTIME_NOTHROW bool ClearSubgraphReferences(ObjHeader* root, bool checked) { RuntimeCheck(false, "Unimplemented"); } -RUNTIME_NOTHROW void* CreateStablePointer(ObjHeader* obj) { - RuntimeCheck(false, "Unimplemented"); -} - -RUNTIME_NOTHROW void DisposeStablePointer(void* pointer) { - RuntimeCheck(false, "Unimplemented"); -} - -RUNTIME_NOTHROW OBJ_GETTER(DerefStablePointer, void*) { - RuntimeCheck(false, "Unimplemented"); -} - -RUNTIME_NOTHROW OBJ_GETTER(AdoptStablePointer, void*) { - RuntimeCheck(false, "Unimplemented"); -} - void MutationCheck(ObjHeader* obj) { RuntimeCheck(false, "Unimplemented"); } @@ -194,22 +178,6 @@ ForeignRefContext InitLocalForeignRef(ObjHeader* object) { RuntimeCheck(false, "Unimplemented"); } -ForeignRefContext InitForeignRef(ObjHeader* object) { - RuntimeCheck(false, "Unimplemented"); -} - -void DeinitForeignRef(ObjHeader* object, ForeignRefContext context) { - RuntimeCheck(false, "Unimplemented"); -} - -bool IsForeignRefAccessible(ObjHeader* object, ForeignRefContext context) { - RuntimeCheck(false, "Unimplemented"); -} - -void AdoptReferenceFromSharedVariable(ObjHeader* object) { - RuntimeCheck(false, "Unimplemented"); -} - void CheckGlobalsAccessible() { // Globals are always accessible. } diff --git a/kotlin-native/runtime/src/mm/cpp/ThreadData.hpp b/kotlin-native/runtime/src/mm/cpp/ThreadData.hpp index cecf7cdb2d6..e7a788e5099 100644 --- a/kotlin-native/runtime/src/mm/cpp/ThreadData.hpp +++ b/kotlin-native/runtime/src/mm/cpp/ThreadData.hpp @@ -9,6 +9,7 @@ #include #include "GlobalsRegistry.hpp" +#include "StableRefRegistry.hpp" #include "ThreadLocalStorage.hpp" #include "Utils.hpp" @@ -19,7 +20,8 @@ namespace mm { // Pin it in memory to prevent accidental copying. class ThreadData final : private Pinned { public: - ThreadData(pthread_t threadId) noexcept : threadId_(threadId), globalsThreadQueue_(GlobalsRegistry::Instance()) {} + ThreadData(pthread_t threadId) noexcept : + threadId_(threadId), globalsThreadQueue_(GlobalsRegistry::Instance()), stableRefThreadQueue_(StableRefRegistry::Instance()) {} ~ThreadData() = default; @@ -29,10 +31,13 @@ public: ThreadLocalStorage& tls() noexcept { return tls_; } + StableRefRegistry::ThreadQueue& stableRefThreadQueue() noexcept { return stableRefThreadQueue_; } + private: const pthread_t threadId_; GlobalsRegistry::ThreadQueue globalsThreadQueue_; ThreadLocalStorage tls_; + StableRefRegistry::ThreadQueue stableRefThreadQueue_; }; } // namespace mm From 02379d9412db95d3a32c3b0030e320ffa1d54bc9 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Tue, 8 Dec 2020 17:52:21 +0700 Subject: [PATCH 683/698] Introduce QEMU build scripts --- kotlin-native/tools/qemu/Dockerfile | 20 ++++++++++++++ kotlin-native/tools/qemu/build.sh | 33 +++++++++++++++++++++++ kotlin-native/tools/qemu/create_image.sh | 3 +++ kotlin-native/tools/qemu/run_container.sh | 12 +++++++++ 4 files changed, 68 insertions(+) create mode 100644 kotlin-native/tools/qemu/Dockerfile create mode 100644 kotlin-native/tools/qemu/build.sh create mode 100755 kotlin-native/tools/qemu/create_image.sh create mode 100755 kotlin-native/tools/qemu/run_container.sh diff --git a/kotlin-native/tools/qemu/Dockerfile b/kotlin-native/tools/qemu/Dockerfile new file mode 100644 index 00000000000..751a646274f --- /dev/null +++ b/kotlin-native/tools/qemu/Dockerfile @@ -0,0 +1,20 @@ +FROM ubuntu:20.04 + +ENV TZ=Europe/Moscow +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +RUN apt-get update && apt-get upgrade -y +RUN apt-get install -y build-essential git gcc pkg-config glib-2.0 libglib2.0-dev libsdl1.2-dev libaio-dev libcap-dev libattr1-dev libpixman-1-dev + +RUN git clone --branch v5.1.0 --depth 1 git://git.qemu.org/qemu.git && \ + cd qemu && \ + git checkout d0ed6a69d399ae193959225cdeaa9382746c91cc && \ + git submodule update --init --recursive + +WORKDIR /qemu + +COPY build.sh . + +ENV OUTPUT_DIR="/output" + +ENTRYPOINT "/bin/bash" "build.sh" ${OUTPUT_DIR} \ No newline at end of file diff --git a/kotlin-native/tools/qemu/build.sh b/kotlin-native/tools/qemu/build.sh new file mode 100644 index 00000000000..3b365bacde8 --- /dev/null +++ b/kotlin-native/tools/qemu/build.sh @@ -0,0 +1,33 @@ +#!/bin/bash +set -eou pipefail + +INSTALL_PATH=$1 +QEMU_VERSION=5.1.0 +DEPENDENCY_VERSION=2 + +function build_qemu() { + mkdir build + ./configure \ + --prefix="$PWD/build" \ + --static \ + --disable-debug-info \ + --disable-werror \ + --disable-system \ + --enable-linux-user \ + + make -j"$(nproc)" + make install +} + +function build_archives() { + cd build/bin + for f in qemu-* ; do + DEPENDENCY_NAME="$f-static-$QEMU_VERSION-linux-$DEPENDENCY_VERSION" + mkdir -p $DEPENDENCY_NAME + mv $f $DEPENDENCY_NAME/$f + tar -czvf $INSTALL_PATH/"$DEPENDENCY_NAME.tar.gz" "$DEPENDENCY_NAME" + done +} + +build_qemu +build_archives \ No newline at end of file diff --git a/kotlin-native/tools/qemu/create_image.sh b/kotlin-native/tools/qemu/create_image.sh new file mode 100755 index 00000000000..f4cf94f9bf2 --- /dev/null +++ b/kotlin-native/tools/qemu/create_image.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +docker build -t kotlin-qemu-builder . \ No newline at end of file diff --git a/kotlin-native/tools/qemu/run_container.sh b/kotlin-native/tools/qemu/run_container.sh new file mode 100755 index 00000000000..f7818edebfc --- /dev/null +++ b/kotlin-native/tools/qemu/run_container.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -eou pipefail + +CONTAINER_NAME=kotlin-qemu-builder +IMAGE_NAME=kotlin-qemu-builder + + +docker ps -a | grep $CONTAINER_NAME > /dev/null \ + && docker stop $CONTAINER_NAME 1> /dev/null \ + && docker rm $CONTAINER_NAME 1> /dev/null + +docker run -it -v "$PWD"/out:/output --name=$CONTAINER_NAME $IMAGE_NAME From 9e93ee81e34c1c0e3d95dd68317af4424e4b9521 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Wed, 9 Dec 2020 12:12:05 +0700 Subject: [PATCH 684/698] Add emulator properties to gcc configurables --- kotlin-native/konan/konan.properties | 19 ++++++++++++++++++- .../kotlin/konan/target/Configurables.kt | 9 +++++++++ .../kotlin/konan/target/ConfigurablesImpl.kt | 5 ++++- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/kotlin-native/konan/konan.properties b/kotlin-native/konan/konan.properties index 6c96ef4250b..3865b89c04a 100644 --- a/kotlin-native/konan/konan.properties +++ b/kotlin-native/konan/konan.properties @@ -422,6 +422,11 @@ gccToolchain.linux_arm32_hfp = target-gcc-toolchain-3-linux-x86-64 targetToolchain.linux_x64-linux_arm32_hfp = target-gcc-toolchain-3-linux-x86-64/x86_64-unknown-linux-gnu targetToolchain.mingw_x64-linux_arm32_hfp = msys2-mingw-w64-x86_64-clang-llvm-lld-compiler_rt-8.0.1 targetToolchain.macos_x64-linux_arm32_hfp = $llvmHome.macos_x64 + +# TODO: We might use docker on Windows or macOS. +emulatorDependency.linux_x64-linux_arm32_hfp = qemu-arm-static-5.1.0-linux-2 +emulatorExecutable.linux_x64-linux_arm32_hfp = qemu-arm-static-5.1.0-linux-2/qemu-arm + dependencies.linux_x64-linux_arm32_hfp = \ target-gcc-toolchain-3-linux-x86-64 \ target-sysroot-2-raspberrypi \ @@ -467,6 +472,10 @@ gccToolchain.linux_arm64 = target-gcc-toolchain-3-linux-x86-64 targetToolchain.linux_x64-linux_arm64 = target-gcc-toolchain-3-linux-x86-64/x86_64-unknown-linux-gnu targetToolchain.mingw_x64-linux_arm64 = msys2-mingw-w64-x86_64-clang-llvm-lld-compiler_rt-8.0.1 targetToolchain.macos_x64-linux_arm64 = $llvmHome.macos_x64 + +emulatorDependency.linux_x64-linux_arm64 = qemu-aarch64-static-5.1.0-linux-2 +emulatorExecutable.linux_x64-linux_arm64 = qemu-aarch64-static-5.1.0-linux-2/qemu-aarch64 + dependencies.linux_x64-linux_arm64 = \ target-gcc-toolchain-3-linux-x86-64 \ target-sysroot-1-linux-glibc-arm64 \ @@ -509,6 +518,10 @@ runtimeDefinitions.linux_arm64 = USE_GCC_UNWIND=1 KONAN_LINUX=1 KONAN_ARM64=1 \ gccToolchain.linux_mips32 = target-gcc-toolchain-3-linux-x86-64 targetToolchain.linux_x64-linux_mips32 = target-gcc-toolchain-2-linux-mips/x86_64-unknown-linux-gnu + +emulatorDependency.linux_x64-linux_mips32 = qemu-mips-static-5.1.0-linux-2 +emulatorExecutable.linux_x64-linux_mips32 = qemu-mips-static-5.1.0-linux-2/qemu-mips + dependencies.linux_x64-linux_mips32 = \ target-gcc-toolchain-2-linux-mips \ target-gcc-toolchain-3-linux-x86-64 \ @@ -541,6 +554,10 @@ runtimeDefinitions.linux_mips32 = USE_GCC_UNWIND=1 KONAN_LINUX=1 KONAN_MIPS32=1 gccToolchain.linux_mipsel32 = target-gcc-toolchain-3-linux-x86-64 targetToolchain.linux_x64-linux_mipsel32 = target-gcc-toolchain-2-linux-mips/x86_64-unknown-linux-gnu + +emulatorDependency.linux_x64-linux_mipsel32 = qemu-mipsel-static-5.1.0-linux-2 +emulatorExecutable.linux_x64-linux_mipsel32 = qemu-mipsel-static-5.1.0-linux-2/qemu-mipsel + dependencies.linux_x64-linux_mipsel32 = \ target-gcc-toolchain-2-linux-mips \ target-gcc-toolchain-3-linux-x86-64 \ @@ -792,4 +809,4 @@ runtimeDefinitions.wasm32 = KONAN_WASM=1 KONAN_NO_FFI=1 KONAN_NO_THREADS=1 \ KONAN_INTERNAL_NOW=1 KONAN_NO_MEMMEM KONAN_NO_CTORS_SECTION=1 # The version of Kotlin/Native compiler -compilerVersion=@compilerVersion@ \ No newline at end of file +compilerVersion=1.5-dev \ No newline at end of file diff --git a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Configurables.kt b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Configurables.kt index fb12b1ad11d..467d927ed81 100644 --- a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Configurables.kt +++ b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Configurables.kt @@ -63,6 +63,15 @@ interface Configurables : TargetableExternalStorage { val runtimeDefinitions get() = targetList("runtimeDefinitions") } +interface ConfigurablesWithEmulator : Configurables { + val emulatorDependency get() = hostTargetString("emulatorDependency") + // TODO: We need to find a way to represent absolute path in properties. + // In case of QEMU, absolute path to dynamic linker should be specified. + val emulatorExecutable get() = hostTargetString("emulatorExecutable") + + val absoluteEmulatorExecutable get() = absolute(emulatorExecutable) +} + interface TargetableConfigurables : Configurables { val targetArg get() = targetString("quadruple") } diff --git a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ConfigurablesImpl.kt b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ConfigurablesImpl.kt index cbee682e97d..a0406e12c81 100644 --- a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ConfigurablesImpl.kt +++ b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ConfigurablesImpl.kt @@ -19,7 +19,10 @@ package org.jetbrains.kotlin.konan.target import org.jetbrains.kotlin.konan.properties.* class GccConfigurablesImpl(target: KonanTarget, properties: Properties, baseDir: String?) - : GccConfigurables, KonanPropertiesLoader(target, properties, baseDir) + : GccConfigurables, KonanPropertiesLoader(target, properties, baseDir), ConfigurablesWithEmulator { + override val dependencies: List + get() = super.dependencies + listOfNotNull(emulatorDependency) + } class AndroidConfigurablesImpl(target: KonanTarget, properties: Properties, baseDir: String?) : AndroidConfigurables, KonanPropertiesLoader(target, properties, baseDir) From a664dbf07f232f3b3ad788a8b3f43b68792f56e9 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Wed, 9 Dec 2020 13:09:27 +0700 Subject: [PATCH 685/698] Use emulator executor for arm-based linux targets --- .../org/jetbrains/kotlin/ExecutorService.kt | 50 ++++++++++++------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/ExecutorService.kt b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/ExecutorService.kt index 8f6b6d83e51..871d6c6c2e2 100644 --- a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/ExecutorService.kt +++ b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/ExecutorService.kt @@ -24,6 +24,7 @@ import org.gradle.process.ExecResult import org.gradle.process.ExecSpec import org.gradle.util.ConfigureUtil import org.jetbrains.kotlin.konan.target.Architecture +import org.jetbrains.kotlin.konan.target.ConfigurablesWithEmulator import org.jetbrains.kotlin.konan.target.KonanTarget import org.jetbrains.kotlin.konan.target.Xcode @@ -52,7 +53,6 @@ fun create(project: Project): ExecutorService { val testTarget = project.testTarget val platform = platformManager.platform(testTarget) val absoluteTargetToolchain = platform.absoluteTargetToolchain - val absoluteTargetSysRoot = platform.absoluteTargetSysRoot return when (testTarget) { KonanTarget.WASM32 -> object : ExecutorService { @@ -68,22 +68,10 @@ fun create(project: Project): ExecutorService { } } - KonanTarget.LINUX_MIPS32, KonanTarget.LINUX_MIPSEL32 -> object : ExecutorService { - override fun execute(action: Action): ExecResult? = project.exec { execSpec -> - action.execute(execSpec) - with(execSpec) { - val qemu = if (platform.target === KonanTarget.LINUX_MIPS32) "qemu-mips" else "qemu-mipsel" - val absoluteQemu = "$absoluteTargetToolchain/bin/$qemu" - val exe = executable - executable = absoluteQemu - args = listOf("-L", absoluteTargetSysRoot, - // This is to workaround an endianess issue. - // See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=731082 for details. - "$absoluteTargetSysRoot/lib/ld.so.1", "--inhibit-cache", - exe) + args - } - } - } + KonanTarget.LINUX_MIPS32, + KonanTarget.LINUX_MIPSEL32, + KonanTarget.LINUX_ARM32_HFP, + KonanTarget.LINUX_ARM64 -> emulatorExecutor(project, testTarget) KonanTarget.IOS_X64, KonanTarget.TVOS_X64, @@ -213,6 +201,34 @@ fun localExecutorService(project: Project): ExecutorService = object : ExecutorS override fun execute(action: Action): ExecResult? = project.exec(action) } +private fun emulatorExecutor(project: Project, target: KonanTarget) = object : ExecutorService { + val platformManager = project.platformManager + val configurables = platformManager.platform(target).configurables as? ConfigurablesWithEmulator + ?: error("$target does not support emulation!") + val absoluteTargetSysRoot = configurables.absoluteTargetSysRoot + + override fun execute(action: Action): ExecResult? = project.exec { execSpec -> + action.execute(execSpec) + with(execSpec) { + val exe = executable + // TODO: Move these to konan.properties when when it will be possible + // to represent absolute path there. + val qemuSpecificArguments = listOf("-L", absoluteTargetSysRoot) + val targetSpecificArguments = when (target) { + KonanTarget.LINUX_MIPS32, + KonanTarget.LINUX_MIPSEL32 -> { + // This is to workaround an endianess issue. + // See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=731082 for details. + listOf("$absoluteTargetSysRoot/lib/ld.so.1", "--inhibit-cache") + } + else -> emptyList() + } + executable = configurables.absoluteEmulatorExecutable + args = qemuSpecificArguments + targetSpecificArguments + exe + args + } + } +} + /** * Executes a given action with iPhone Simulator. * From 73c27df1beea55f9131339c251ad909cd8ec0d62 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Tue, 1 Dec 2020 13:37:24 +0700 Subject: [PATCH 686/698] Support new linux_mips32 and linux_mipsel32 toolchains --- kotlin-native/.gitignore | 5 +- kotlin-native/konan/konan.properties | 27 +- .../kotlin/konan/target/ClangArgs.kt | 13 +- .../jetbrains/kotlin/konan/target/Linker.kt | 6 +- .../gcc-8.3.0-glibc-2.19-kernel-4.9.config | 753 +++++++++++++++++ .../gcc-8.3.0-glibc-2.19-kernel-4.9.config | 758 ++++++++++++++++++ 6 files changed, 1533 insertions(+), 29 deletions(-) create mode 100644 kotlin-native/tools/toolchain_builder/toolchains/mips-unknown-linux-gnu/gcc-8.3.0-glibc-2.19-kernel-4.9.config create mode 100644 kotlin-native/tools/toolchain_builder/toolchains/mipsel-unknown-linux-gnu/gcc-8.3.0-glibc-2.19-kernel-4.9.config diff --git a/kotlin-native/.gitignore b/kotlin-native/.gitignore index 2903a0401ea..94a9f214684 100644 --- a/kotlin-native/.gitignore +++ b/kotlin-native/.gitignore @@ -71,4 +71,7 @@ compile_commands.json .clangd/ # googletest framework used by runtime tests -runtime/googletest/ \ No newline at end of file +runtime/googletest/ + +# Toolchain builder artifacts +tools/toolchain_builder/artifacts \ No newline at end of file diff --git a/kotlin-native/konan/konan.properties b/kotlin-native/konan/konan.properties index 3865b89c04a..4ce964438e9 100644 --- a/kotlin-native/konan/konan.properties +++ b/kotlin-native/konan/konan.properties @@ -515,28 +515,25 @@ runtimeDefinitions.linux_arm64 = USE_GCC_UNWIND=1 KONAN_LINUX=1 KONAN_ARM64=1 \ USE_ELF_SYMBOLS=1 ELFSIZE=64 # MIPS -gccToolchain.linux_mips32 = target-gcc-toolchain-3-linux-x86-64 +gccToolchain.linux_mips32 = mips-unknown-linux-gnu-gcc-8.3.0-glibc-2.19-kernel-4.9 -targetToolchain.linux_x64-linux_mips32 = target-gcc-toolchain-2-linux-mips/x86_64-unknown-linux-gnu +targetToolchain.linux_x64-linux_mips32 = $gccToolchain.linux_mips32/mips-unknown-linux-gnu emulatorDependency.linux_x64-linux_mips32 = qemu-mips-static-5.1.0-linux-2 emulatorExecutable.linux_x64-linux_mips32 = qemu-mips-static-5.1.0-linux-2/qemu-mips - dependencies.linux_x64-linux_mips32 = \ - target-gcc-toolchain-2-linux-mips \ - target-gcc-toolchain-3-linux-x86-64 \ - target-sysroot-2-mips \ + mips-unknown-linux-gnu-gcc-8.3.0-glibc-2.19-kernel-4.9 \ libffi-3.2.1-2-linux-x86-64 quadruple.linux_mips32 = mips-unknown-linux-gnu linkerOptimizationFlags.linux_mips32 = --gc-sections linkerDynamicFlags.linux_mips32 = -shared -targetSysRoot.linux_mips32 = target-sysroot-2-mips +targetSysRoot.linux_mips32 = $gccToolchain.linux_mips32/mips-unknown-linux-gnu/sysroot # We could reuse host toolchain here. linkerKonanFlags.linux_mips32 = -Bstatic -lstdc++ -Bdynamic -ldl -lm -lpthread \ --defsym __cxa_demangle=Konan_cxa_demangle -z notext # targetSysroot-relative. -libGcc.linux_mips32 = lib/gcc/mips-unknown-linux-gnu/4.9.4 +libGcc.linux_mips32 = ../../lib/gcc/mips-unknown-linux-gnu/8.3.0 targetCpu.linux_mips32 = mips32r2 clangFlags.linux_mips32 = -cc1 -emit-obj -disable-llvm-optzns -x ir -target-cpu $targetCpu.linux_mips32 clangNooptFlags.linux_mips32 = -O1 @@ -551,27 +548,25 @@ runtimeDefinitions.linux_mips32 = USE_GCC_UNWIND=1 KONAN_LINUX=1 KONAN_MIPS32=1 USE_ELF_SYMBOLS=1 ELFSIZE=32 KONAN_NO_64BIT_ATOMIC=1 KONAN_NO_UNALIGNED_ACCESS=1 # MIPSel -gccToolchain.linux_mipsel32 = target-gcc-toolchain-3-linux-x86-64 +gccToolchain.linux_mipsel32 = mipsel-unknown-linux-gnu-gcc-8.3.0-glibc-2.19-kernel-4.9 -targetToolchain.linux_x64-linux_mipsel32 = target-gcc-toolchain-2-linux-mips/x86_64-unknown-linux-gnu +targetToolchain.linux_x64-linux_mipsel32 = $gccToolchain.linux_mipsel32/mipsel-unknown-linux-gnu emulatorDependency.linux_x64-linux_mipsel32 = qemu-mipsel-static-5.1.0-linux-2 emulatorExecutable.linux_x64-linux_mipsel32 = qemu-mipsel-static-5.1.0-linux-2/qemu-mipsel - dependencies.linux_x64-linux_mipsel32 = \ - target-gcc-toolchain-2-linux-mips \ - target-gcc-toolchain-3-linux-x86-64 \ - target-sysroot-2-mipsel \ + mipsel-unknown-linux-gnu-gcc-8.3.0-glibc-2.19-kernel-4.9 \ libffi-3.2.1-2-linux-x86-64 + quadruple.linux_mipsel32 = mipsel-unknown-linux-gnu linkerOptimizationFlags.linux_mipsel32 = --gc-sections linkerDynamicFlags.linux_mipsel32 = -shared -targetSysRoot.linux_mipsel32 = target-sysroot-2-mipsel +targetSysRoot.linux_mipsel32 = $gccToolchain.linux_mipsel32/mipsel-unknown-linux-gnu/sysroot # We could reuse host toolchain here. linkerKonanFlags.linux_mipsel32 = -Bstatic -lstdc++ -Bdynamic -ldl -lm -lpthread \ --defsym __cxa_demangle=Konan_cxa_demangle -z notext # targetSysroot-relative. -libGcc.linux_mipsel32 = lib/gcc/mipsel-unknown-linux-gnu/4.9.4 +libGcc.linux_mipsel32 = ../../lib/gcc/mipsel-unknown-linux-gnu/8.3.0 targetCpu.linux_mipsel32 = mips32r2 clangFlags.linux_mipsel32 = -cc1 -emit-obj -disable-llvm-optzns -x ir -target-cpu $targetCpu.linux_mipsel32 clangNooptFlags.linux_mipsel32 = -O1 diff --git a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt index fc212cf794d..15ede43cc1c 100644 --- a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt +++ b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt @@ -76,7 +76,8 @@ class ClangArgs(private val configurables: Configurables) : Configurables by con } private val specificClangArgs: List = when (target) { - KonanTarget.LINUX_X64 -> emptyList() + KonanTarget.LINUX_X64, + KonanTarget.LINUX_MIPS32, KonanTarget.LINUX_MIPSEL32 -> emptyList() KonanTarget.LINUX_ARM32_HFP -> listOf( "-mfpu=vfp", "-mfloat-abi=hard", @@ -90,16 +91,6 @@ class ClangArgs(private val configurables: Configurables) : Configurables by con "-I$absoluteTargetSysRoot/usr/include/c++/7/aarch64-linux-gnu" ) - KonanTarget.LINUX_MIPS32 -> listOf( - "-I$absoluteTargetSysRoot/usr/include/c++/4.9.4", - "-I$absoluteTargetSysRoot/usr/include/c++/4.9.4/mips-unknown-linux-gnu" - ) - - KonanTarget.LINUX_MIPSEL32 -> listOf( - "-I$absoluteTargetSysRoot/usr/include/c++/4.9.4", - "-I$absoluteTargetSysRoot/usr/include/c++/4.9.4/mipsel-unknown-linux-gnu" - ) - KonanTarget.MINGW_X64, KonanTarget.MINGW_X86 -> emptyList() KonanTarget.MACOS_X64 -> listOf( diff --git a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Linker.kt b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Linker.kt index b95dc2db6cc..9b9a8a86af6 100644 --- a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Linker.kt +++ b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Linker.kt @@ -340,7 +340,11 @@ class GccBasedLinker(targetProperties: GccConfigurables) val isMips = target == KonanTarget.LINUX_MIPS32 || target == KonanTarget.LINUX_MIPSEL32 val dynamic = kind == LinkerOutputKind.DYNAMIC_LIBRARY - val crtPrefix = if (configurables.target == KonanTarget.LINUX_ARM64) "usr/lib" else "usr/lib64" + val crtPrefix = when (val bitness = configurables.target.architecture.bitness) { + 32 -> "usr/lib" + 64 -> "usr/lib64" + else -> error("Unexpected target bitness: $bitness") + } // TODO: Can we extract more to the konan.configurables? return listOf(Command(linker).apply { +"--sysroot=${absoluteTargetSysRoot}" diff --git a/kotlin-native/tools/toolchain_builder/toolchains/mips-unknown-linux-gnu/gcc-8.3.0-glibc-2.19-kernel-4.9.config b/kotlin-native/tools/toolchain_builder/toolchains/mips-unknown-linux-gnu/gcc-8.3.0-glibc-2.19-kernel-4.9.config new file mode 100644 index 00000000000..9c9ed6e2d95 --- /dev/null +++ b/kotlin-native/tools/toolchain_builder/toolchains/mips-unknown-linux-gnu/gcc-8.3.0-glibc-2.19-kernel-4.9.config @@ -0,0 +1,753 @@ +# +# Automatically generated file; DO NOT EDIT. +# crosstool-NG Configuration +# +CT_CONFIGURE_has_static_link=y +CT_CONFIGURE_has_cxx11=y +CT_CONFIGURE_has_wget=y +CT_CONFIGURE_has_curl=y +CT_CONFIGURE_has_make_3_81_or_newer=y +CT_CONFIGURE_has_make_4_0_or_newer=y +CT_CONFIGURE_has_libtool_2_4_or_newer=y +CT_CONFIGURE_has_libtoolize_2_4_or_newer=y +CT_CONFIGURE_has_autoconf_2_65_or_newer=y +CT_CONFIGURE_has_autoreconf_2_65_or_newer=y +CT_CONFIGURE_has_automake_1_15_or_newer=y +CT_CONFIGURE_has_gnu_m4_1_4_12_or_newer=y +CT_CONFIGURE_has_python_3_4_or_newer=y +CT_CONFIGURE_has_bison_2_7_or_newer=y +CT_CONFIGURE_has_python=y +CT_CONFIGURE_has_git=y +CT_CONFIGURE_has_md5sum=y +CT_CONFIGURE_has_sha1sum=y +CT_CONFIGURE_has_sha256sum=y +CT_CONFIGURE_has_sha512sum=y +CT_CONFIGURE_has_install_with_strip_program=y +CT_CONFIG_VERSION_CURRENT="3" +CT_CONFIG_VERSION="3" +CT_MODULES=y + +# +# Paths and misc options +# + +# +# crosstool-NG behavior +# +# CT_OBSOLETE is not set +# CT_EXPERIMENTAL is not set +# CT_DEBUG_CT is not set + +# +# Paths +# +CT_LOCAL_TARBALLS_DIR="${HOME}/src" +CT_SAVE_TARBALLS=y +# CT_TARBALLS_BUILDROOT_LAYOUT is not set +CT_WORK_DIR="${CT_TOP_DIR}/.build" +CT_BUILD_TOP_DIR="${CT_WORK_DIR:-${CT_TOP_DIR}/.build}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" +CT_PREFIX_DIR="${CT_PREFIX:-${HOME}/x-tools}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" +CT_RM_RF_PREFIX_DIR=y +CT_REMOVE_DOCS=y +CT_INSTALL_LICENSES=y +# CT_PREFIX_DIR_RO is not set +CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES=y +CT_STRIP_TARGET_TOOLCHAIN_EXECUTABLES=y + +# +# Downloading +# +CT_DOWNLOAD_AGENT_WGET=y +# CT_DOWNLOAD_AGENT_CURL is not set +# CT_DOWNLOAD_AGENT_NONE is not set +# CT_FORBID_DOWNLOAD is not set +# CT_FORCE_DOWNLOAD is not set +CT_CONNECT_TIMEOUT=10 +CT_DOWNLOAD_WGET_OPTIONS="--passive-ftp --tries=3 -nc --progress=dot:binary" +# CT_ONLY_DOWNLOAD is not set +# CT_USE_MIRROR is not set +CT_VERIFY_DOWNLOAD_DIGEST=y +CT_VERIFY_DOWNLOAD_DIGEST_SHA512=y +# CT_VERIFY_DOWNLOAD_DIGEST_SHA256 is not set +# CT_VERIFY_DOWNLOAD_DIGEST_SHA1 is not set +# CT_VERIFY_DOWNLOAD_DIGEST_MD5 is not set +CT_VERIFY_DOWNLOAD_DIGEST_ALG="sha512" +# CT_VERIFY_DOWNLOAD_SIGNATURE is not set + +# +# Extracting +# +# CT_FORCE_EXTRACT is not set +CT_OVERRIDE_CONFIG_GUESS_SUB=y +# CT_ONLY_EXTRACT is not set +CT_PATCH_BUNDLED=y +# CT_PATCH_BUNDLED_LOCAL is not set +CT_PATCH_ORDER="bundled" + +# +# Build behavior +# +CT_PARALLEL_JOBS=0 +CT_LOAD="" +CT_USE_PIPES=y +CT_EXTRA_CFLAGS_FOR_BUILD="" +CT_EXTRA_LDFLAGS_FOR_BUILD="" +CT_EXTRA_CFLAGS_FOR_HOST="" +CT_EXTRA_LDFLAGS_FOR_HOST="" +# CT_CONFIG_SHELL_SH is not set +# CT_CONFIG_SHELL_ASH is not set +CT_CONFIG_SHELL_BASH=y +# CT_CONFIG_SHELL_CUSTOM is not set +CT_CONFIG_SHELL="${bash}" + +# +# Logging +# +# CT_LOG_ERROR is not set +# CT_LOG_WARN is not set +# CT_LOG_INFO is not set +CT_LOG_EXTRA=y +# CT_LOG_ALL is not set +# CT_LOG_DEBUG is not set +CT_LOG_LEVEL_MAX="EXTRA" +# CT_LOG_SEE_TOOLS_WARN is not set +CT_LOG_PROGRESS_BAR=y +CT_LOG_TO_FILE=y +CT_LOG_FILE_COMPRESS=y + +# +# Target options +# +# CT_ARCH_ALPHA is not set +# CT_ARCH_ARC is not set +# CT_ARCH_ARM is not set +# CT_ARCH_AVR is not set +# CT_ARCH_M68K is not set +CT_ARCH_MIPS=y +# CT_ARCH_NIOS2 is not set +# CT_ARCH_POWERPC is not set +# CT_ARCH_S390 is not set +# CT_ARCH_SH is not set +# CT_ARCH_SPARC is not set +# CT_ARCH_X86 is not set +# CT_ARCH_XTENSA is not set +CT_ARCH="mips" +CT_ARCH_CHOICE_KSYM="MIPS" +CT_ARCH_TUNE="" +CT_ARCH_MIPS_SHOW=y + +# +# Options for mips +# +CT_ARCH_MIPS_PKG_KSYM="" +CT_ARCH_mips_o32=y +CT_ARCH_mips_ABI="32" +CT_ALL_ARCH_CHOICES="ALPHA ARC ARM AVR M68K MICROBLAZE MIPS MOXIE MSP430 NIOS2 POWERPC RISCV S390 SH SPARC X86 XTENSA" +CT_ARCH_SUFFIX="" +# CT_OMIT_TARGET_VENDOR is not set + +# +# Generic target options +# +# CT_MULTILIB is not set +CT_DEMULTILIB=y +CT_ARCH_USE_MMU=y +CT_ARCH_SUPPORTS_EITHER_ENDIAN=y +CT_ARCH_DEFAULT_BE=y +CT_ARCH_BE=y +# CT_ARCH_LE is not set +CT_ARCH_ENDIAN="big" +CT_ARCH_SUPPORTS_32=y +CT_ARCH_SUPPORTS_64=y +CT_ARCH_DEFAULT_32=y +CT_ARCH_BITNESS=32 +CT_ARCH_32=y +# CT_ARCH_64 is not set + +# +# Target optimisations +# +CT_ARCH_SUPPORTS_WITH_ARCH=y +CT_ARCH_SUPPORTS_WITH_TUNE=y +CT_ARCH_SUPPORTS_WITH_FLOAT=y +CT_ARCH_ARCH="mips1" +# CT_ARCH_FLOAT_AUTO is not set +# CT_ARCH_FLOAT_HW is not set +CT_ARCH_FLOAT_SW=y +CT_TARGET_CFLAGS="" +CT_TARGET_LDFLAGS="" +CT_ARCH_FLOAT="hard" + +# +# Toolchain options +# + +# +# General toolchain options +# +CT_FORCE_SYSROOT=y +CT_USE_SYSROOT=y +CT_SYSROOT_NAME="sysroot" +CT_SYSROOT_DIR_PREFIX="" +CT_WANTS_STATIC_LINK=y +CT_WANTS_STATIC_LINK_CXX=y +# CT_STATIC_TOOLCHAIN is not set +CT_SHOW_CT_VERSION=y +CT_TOOLCHAIN_PKGVERSION="" +CT_TOOLCHAIN_BUGURL="" + +# +# Tuple completion and aliasing +# +CT_TARGET_VENDOR="unknown" +CT_TARGET_ALIAS_SED_EXPR="" +CT_TARGET_ALIAS="" + +# +# Toolchain type +# +CT_CROSS=y +# CT_CANADIAN is not set +CT_TOOLCHAIN_TYPE="cross" + +# +# Build system +# +CT_BUILD="" +CT_BUILD_PREFIX="" +CT_BUILD_SUFFIX="" + +# +# Misc options +# +# CT_TOOLCHAIN_ENABLE_NLS is not set + +# +# Operating System +# +CT_KERNEL_SUPPORTS_SHARED_LIBS=y +# CT_KERNEL_BARE_METAL is not set +CT_KERNEL_LINUX=y +CT_KERNEL="linux" +CT_KERNEL_CHOICE_KSYM="LINUX" +CT_KERNEL_LINUX_SHOW=y + +# +# Options for linux +# +CT_KERNEL_LINUX_PKG_KSYM="LINUX" +CT_LINUX_DIR_NAME="linux" +CT_LINUX_PKG_NAME="linux" +CT_LINUX_SRC_RELEASE=y +CT_LINUX_PATCH_ORDER="global" +# CT_LINUX_V_4_20 is not set +# CT_LINUX_V_4_19 is not set +# CT_LINUX_V_4_18 is not set +# CT_LINUX_V_4_17 is not set +# CT_LINUX_V_4_16 is not set +# CT_LINUX_V_4_15 is not set +# CT_LINUX_V_4_14 is not set +# CT_LINUX_V_4_13 is not set +# CT_LINUX_V_4_12 is not set +# CT_LINUX_V_4_11 is not set +# CT_LINUX_V_4_10 is not set +CT_LINUX_V_4_9=y +# CT_LINUX_V_4_4 is not set +# CT_LINUX_V_4_1 is not set +# CT_LINUX_V_3_16 is not set +# CT_LINUX_V_3_13 is not set +# CT_LINUX_V_3_12 is not set +# CT_LINUX_V_3_10 is not set +# CT_LINUX_V_3_4 is not set +# CT_LINUX_V_3_2 is not set +# CT_LINUX_V_2_6_32 is not set +# CT_LINUX_NO_VERSIONS is not set +CT_LINUX_VERSION="4.9.156" +CT_LINUX_MIRRORS="$(CT_Mirrors kernel.org linux ${CT_LINUX_VERSION})" +CT_LINUX_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_LINUX_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_LINUX_ARCHIVE_FORMATS=".tar.xz .tar.gz" +CT_LINUX_SIGNATURE_FORMAT="unpacked/.sign" +CT_LINUX_later_than_4_8=y +CT_LINUX_4_8_or_later=y +CT_LINUX_later_than_3_7=y +CT_LINUX_3_7_or_later=y +CT_LINUX_later_than_3_2=y +CT_LINUX_3_2_or_later=y +CT_KERNEL_LINUX_VERBOSITY_0=y +# CT_KERNEL_LINUX_VERBOSITY_1 is not set +# CT_KERNEL_LINUX_VERBOSITY_2 is not set +CT_KERNEL_LINUX_VERBOSE_LEVEL=0 +CT_KERNEL_LINUX_INSTALL_CHECK=y +CT_ALL_KERNEL_CHOICES="BARE_METAL LINUX WINDOWS" + +# +# Common kernel options +# +CT_SHARED_LIBS=y + +# +# Binary utilities +# +CT_ARCH_BINFMT_ELF=y +CT_BINUTILS_BINUTILS=y +CT_BINUTILS="binutils" +CT_BINUTILS_CHOICE_KSYM="BINUTILS" +CT_BINUTILS_BINUTILS_SHOW=y + +# +# Options for binutils +# +CT_BINUTILS_BINUTILS_PKG_KSYM="BINUTILS" +CT_BINUTILS_DIR_NAME="binutils" +CT_BINUTILS_USE_GNU=y +CT_BINUTILS_USE="BINUTILS" +CT_BINUTILS_PKG_NAME="binutils" +CT_BINUTILS_SRC_RELEASE=y +CT_BINUTILS_PATCH_ORDER="global" +CT_BINUTILS_V_2_32=y +# CT_BINUTILS_V_2_31 is not set +# CT_BINUTILS_V_2_30 is not set +# CT_BINUTILS_V_2_29 is not set +# CT_BINUTILS_V_2_28 is not set +# CT_BINUTILS_V_2_27 is not set +# CT_BINUTILS_V_2_26 is not set +# CT_BINUTILS_NO_VERSIONS is not set +CT_BINUTILS_VERSION="2.32" +CT_BINUTILS_MIRRORS="$(CT_Mirrors GNU binutils) $(CT_Mirrors sourceware binutils/releases)" +CT_BINUTILS_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_BINUTILS_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_BINUTILS_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" +CT_BINUTILS_SIGNATURE_FORMAT="packed/.sig" +CT_BINUTILS_later_than_2_30=y +CT_BINUTILS_2_30_or_later=y +CT_BINUTILS_later_than_2_27=y +CT_BINUTILS_2_27_or_later=y +CT_BINUTILS_later_than_2_25=y +CT_BINUTILS_2_25_or_later=y +CT_BINUTILS_later_than_2_23=y +CT_BINUTILS_2_23_or_later=y + +# +# GNU binutils +# +CT_BINUTILS_HAS_HASH_STYLE=y +CT_BINUTILS_HAS_GOLD=y +CT_BINUTILS_HAS_PLUGINS=y +CT_BINUTILS_HAS_PKGVERSION_BUGURL=y +CT_BINUTILS_FORCE_LD_BFD_DEFAULT=y +CT_BINUTILS_LINKER_LD=y +CT_BINUTILS_LINKERS_LIST="ld" +CT_BINUTILS_LINKER_DEFAULT="bfd" +CT_BINUTILS_PLUGINS=y +CT_BINUTILS_RELRO=m +CT_BINUTILS_EXTRA_CONFIG_ARRAY="" +# CT_BINUTILS_FOR_TARGET is not set +CT_ALL_BINUTILS_CHOICES="BINUTILS" + +# +# C-library +# +CT_LIBC_GLIBC=y +# CT_LIBC_UCLIBC is not set +CT_LIBC="glibc" +CT_LIBC_CHOICE_KSYM="GLIBC" +CT_THREADS="nptl" +CT_LIBC_GLIBC_SHOW=y + +# +# Options for glibc +# +CT_LIBC_GLIBC_PKG_KSYM="GLIBC" +CT_GLIBC_DIR_NAME="glibc" +CT_GLIBC_USE_GNU=y +CT_GLIBC_USE="GLIBC" +CT_GLIBC_PKG_NAME="glibc" +CT_GLIBC_SRC_RELEASE=y +CT_GLIBC_PATCH_ORDER="global" +# CT_GLIBC_V_2_29 is not set +# CT_GLIBC_V_2_28 is not set +# CT_GLIBC_V_2_27 is not set +# CT_GLIBC_V_2_26 is not set +# CT_GLIBC_V_2_25 is not set +# CT_GLIBC_V_2_24 is not set +# CT_GLIBC_V_2_23 is not set +CT_GLIBC_V_2_19=y +# CT_GLIBC_V_2_17 is not set +# CT_GLIBC_V_2_12_1 is not set +# CT_GLIBC_NO_VERSIONS is not set +CT_GLIBC_VERSION="2.19" +CT_GLIBC_MIRRORS="$(CT_Mirrors GNU glibc)" +CT_GLIBC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_GLIBC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_GLIBC_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" +CT_GLIBC_SIGNATURE_FORMAT="packed/.sig" +CT_GLIBC_2_29_or_older=y +CT_GLIBC_older_than_2_29=y +CT_GLIBC_2_27_or_older=y +CT_GLIBC_older_than_2_27=y +CT_GLIBC_2_26_or_older=y +CT_GLIBC_older_than_2_26=y +CT_GLIBC_2_25_or_older=y +CT_GLIBC_older_than_2_25=y +CT_GLIBC_2_24_or_older=y +CT_GLIBC_older_than_2_24=y +CT_GLIBC_2_23_or_older=y +CT_GLIBC_older_than_2_23=y +CT_GLIBC_2_20_or_older=y +CT_GLIBC_older_than_2_20=y +CT_GLIBC_later_than_2_17=y +CT_GLIBC_2_17_or_later=y +CT_GLIBC_later_than_2_14=y +CT_GLIBC_2_14_or_later=y +CT_GLIBC_DEP_KERNEL_HEADERS_VERSION=y +CT_GLIBC_DEP_BINUTILS=y +CT_GLIBC_DEP_GCC=y +CT_GLIBC_DEP_PYTHON=y +CT_GLIBC_HAS_NPTL_ADDON=y +CT_GLIBC_HAS_PORTS_ADDON=y +CT_GLIBC_HAS_LIBIDN_ADDON=y +CT_GLIBC_USE_PORTS_ADDON=y +CT_GLIBC_USE_NPTL_ADDON=y +# CT_GLIBC_USE_LIBIDN_ADDON is not set +CT_GLIBC_HAS_OBSOLETE_RPC=y +CT_GLIBC_EXTRA_CONFIG_ARRAY="" +CT_GLIBC_CONFIGPARMS="" +CT_GLIBC_EXTRA_CFLAGS="" +CT_GLIBC_ENABLE_OBSOLETE_RPC=y +# CT_GLIBC_DISABLE_VERSIONING is not set +CT_GLIBC_OLDEST_ABI="" +CT_GLIBC_FORCE_UNWIND=y +# CT_GLIBC_LOCALES is not set +# CT_GLIBC_KERNEL_VERSION_NONE is not set +CT_GLIBC_KERNEL_VERSION_AS_HEADERS=y +# CT_GLIBC_KERNEL_VERSION_CHOSEN is not set +CT_GLIBC_MIN_KERNEL="4.9.156" +CT_ALL_LIBC_CHOICES="AVR_LIBC BIONIC GLIBC MINGW_W64 MOXIEBOX MUSL NEWLIB NONE UCLIBC" +CT_LIBC_SUPPORT_THREADS_ANY=y +CT_LIBC_SUPPORT_THREADS_NATIVE=y + +# +# Common C library options +# +CT_THREADS_NATIVE=y +# CT_CREATE_LDSO_CONF is not set +CT_LIBC_XLDD=y + +# +# C compiler +# +CT_CC_CORE_PASSES_NEEDED=y +CT_CC_CORE_PASS_1_NEEDED=y +CT_CC_CORE_PASS_2_NEEDED=y +CT_CC_SUPPORT_CXX=y +CT_CC_SUPPORT_FORTRAN=y +CT_CC_SUPPORT_ADA=y +CT_CC_SUPPORT_OBJC=y +CT_CC_SUPPORT_OBJCXX=y +CT_CC_SUPPORT_GOLANG=y +CT_CC_GCC=y +CT_CC="gcc" +CT_CC_CHOICE_KSYM="GCC" +CT_CC_GCC_SHOW=y + +# +# Options for gcc +# +CT_CC_GCC_PKG_KSYM="GCC" +CT_GCC_DIR_NAME="gcc" +CT_GCC_USE_GNU=y +CT_GCC_USE="GCC" +CT_GCC_PKG_NAME="gcc" +CT_GCC_SRC_RELEASE=y +CT_GCC_PATCH_ORDER="global" +CT_GCC_V_8=y +# CT_GCC_V_7 is not set +# CT_GCC_V_6 is not set +# CT_GCC_V_5 is not set +# CT_GCC_V_4_9 is not set +# CT_GCC_NO_VERSIONS is not set +CT_GCC_VERSION="8.3.0" +CT_GCC_MIRRORS="$(CT_Mirrors GNU gcc/gcc-${CT_GCC_VERSION}) $(CT_Mirrors sourceware gcc/releases/gcc-${CT_GCC_VERSION})" +CT_GCC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_GCC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_GCC_ARCHIVE_FORMATS=".tar.xz .tar.gz" +CT_GCC_SIGNATURE_FORMAT="" +CT_GCC_later_than_7=y +CT_GCC_7_or_later=y +CT_GCC_later_than_6=y +CT_GCC_6_or_later=y +CT_GCC_later_than_5=y +CT_GCC_5_or_later=y +CT_GCC_later_than_4_9=y +CT_GCC_4_9_or_later=y +CT_GCC_later_than_4_8=y +CT_GCC_4_8_or_later=y +CT_CC_GCC_ENABLE_PLUGINS=y +CT_CC_GCC_HAS_LIBMPX=y +CT_CC_GCC_ENABLE_CXX_FLAGS="" +CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="" +CT_CC_GCC_EXTRA_CONFIG_ARRAY="" +CT_CC_GCC_STATIC_LIBSTDCXX=y +# CT_CC_GCC_SYSTEM_ZLIB is not set +CT_CC_GCC_CONFIG_TLS=m + +# +# Optimisation features +# +CT_CC_GCC_USE_GRAPHITE=y +CT_CC_GCC_USE_LTO=y + +# +# Settings for libraries running on target +# +CT_CC_GCC_ENABLE_TARGET_OPTSPACE=y +# CT_CC_GCC_LIBMUDFLAP is not set +# CT_CC_GCC_LIBGOMP is not set +# CT_CC_GCC_LIBSSP is not set +# CT_CC_GCC_LIBQUADMATH is not set +# CT_CC_GCC_LIBSANITIZER is not set + +# +# Misc. obscure options. +# +CT_CC_CXA_ATEXIT=y +# CT_CC_GCC_DISABLE_PCH is not set +CT_CC_GCC_SJLJ_EXCEPTIONS=m +CT_CC_GCC_LDBL_128=m +# CT_CC_GCC_BUILD_ID is not set +CT_CC_GCC_LNK_HASH_STYLE_DEFAULT=y +# CT_CC_GCC_LNK_HASH_STYLE_SYSV is not set +# CT_CC_GCC_LNK_HASH_STYLE_GNU is not set +# CT_CC_GCC_LNK_HASH_STYLE_BOTH is not set +CT_CC_GCC_LNK_HASH_STYLE="" +CT_CC_GCC_DEC_FLOAT_AUTO=y +# CT_CC_GCC_DEC_FLOAT_BID is not set +# CT_CC_GCC_DEC_FLOAT_DPD is not set +# CT_CC_GCC_DEC_FLOATS_NO is not set +CT_CC_GCC_HAS_ARCH_OPTIONS=y + +# +# archictecture-specific options +# +CT_CC_GCC_mips_llsc=m +CT_CC_GCC_mips_synci=m +CT_CC_GCC_mips_plt=y +CT_ALL_CC_CHOICES="GCC" + +# +# Additional supported languages: +# +CT_CC_LANG_CXX=y +# CT_CC_LANG_FORTRAN is not set + +# +# Debug facilities +# +# CT_DEBUG_DUMA is not set +# CT_DEBUG_GDB is not set +# CT_DEBUG_LTRACE is not set +# CT_DEBUG_STRACE is not set +CT_ALL_DEBUG_CHOICES="DUMA GDB LTRACE STRACE" + +# +# Companion libraries +# +# CT_COMPLIBS_CHECK is not set +# CT_COMP_LIBS_CLOOG is not set +CT_COMP_LIBS_EXPAT=y +CT_COMP_LIBS_EXPAT_PKG_KSYM="EXPAT" +CT_EXPAT_DIR_NAME="expat" +CT_EXPAT_PKG_NAME="expat" +CT_EXPAT_SRC_RELEASE=y +CT_EXPAT_PATCH_ORDER="global" +CT_EXPAT_V_2_2=y +# CT_EXPAT_NO_VERSIONS is not set +CT_EXPAT_VERSION="2.2.6" +CT_EXPAT_MIRRORS="http://downloads.sourceforge.net/project/expat/expat/${CT_EXPAT_VERSION}" +CT_EXPAT_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_EXPAT_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_EXPAT_ARCHIVE_FORMATS=".tar.bz2" +CT_EXPAT_SIGNATURE_FORMAT="" +CT_COMP_LIBS_GETTEXT=y +CT_COMP_LIBS_GETTEXT_PKG_KSYM="GETTEXT" +CT_GETTEXT_DIR_NAME="gettext" +CT_GETTEXT_PKG_NAME="gettext" +CT_GETTEXT_SRC_RELEASE=y +CT_GETTEXT_PATCH_ORDER="global" +CT_GETTEXT_V_0_19_8_1=y +# CT_GETTEXT_NO_VERSIONS is not set +CT_GETTEXT_VERSION="0.19.8.1" +CT_GETTEXT_MIRRORS="$(CT_Mirrors GNU gettext)" +CT_GETTEXT_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_GETTEXT_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_GETTEXT_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.gz" +CT_GETTEXT_SIGNATURE_FORMAT="packed/.sig" +CT_COMP_LIBS_GMP=y +CT_COMP_LIBS_GMP_PKG_KSYM="GMP" +CT_GMP_DIR_NAME="gmp" +CT_GMP_PKG_NAME="gmp" +CT_GMP_SRC_RELEASE=y +CT_GMP_PATCH_ORDER="global" +CT_GMP_V_6_1=y +# CT_GMP_NO_VERSIONS is not set +CT_GMP_VERSION="6.1.2" +CT_GMP_MIRRORS="https://gmplib.org/download/gmp https://gmplib.org/download/gmp/archive $(CT_Mirrors GNU gmp)" +CT_GMP_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_GMP_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_GMP_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.bz2" +CT_GMP_SIGNATURE_FORMAT="packed/.sig" +CT_GMP_later_than_5_1_0=y +CT_GMP_5_1_0_or_later=y +CT_GMP_later_than_5_0_0=y +CT_GMP_5_0_0_or_later=y +CT_GMP_REQUIRE_5_0_0_or_later=y +CT_COMP_LIBS_ISL=y +CT_COMP_LIBS_ISL_PKG_KSYM="ISL" +CT_ISL_DIR_NAME="isl" +CT_ISL_PKG_NAME="isl" +CT_ISL_SRC_RELEASE=y +CT_ISL_PATCH_ORDER="global" +CT_ISL_V_0_20=y +# CT_ISL_V_0_19 is not set +# CT_ISL_V_0_18 is not set +# CT_ISL_V_0_17 is not set +# CT_ISL_V_0_16 is not set +# CT_ISL_V_0_15 is not set +# CT_ISL_NO_VERSIONS is not set +CT_ISL_VERSION="0.20" +CT_ISL_MIRRORS="http://isl.gforge.inria.fr" +CT_ISL_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_ISL_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_ISL_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" +CT_ISL_SIGNATURE_FORMAT="" +CT_ISL_later_than_0_18=y +CT_ISL_0_18_or_later=y +CT_ISL_later_than_0_15=y +CT_ISL_0_15_or_later=y +CT_ISL_REQUIRE_0_15_or_later=y +CT_ISL_later_than_0_14=y +CT_ISL_0_14_or_later=y +CT_ISL_REQUIRE_0_14_or_later=y +CT_ISL_later_than_0_13=y +CT_ISL_0_13_or_later=y +CT_ISL_later_than_0_12=y +CT_ISL_0_12_or_later=y +CT_ISL_REQUIRE_0_12_or_later=y +# CT_COMP_LIBS_LIBELF is not set +CT_COMP_LIBS_LIBICONV=y +CT_COMP_LIBS_LIBICONV_PKG_KSYM="LIBICONV" +CT_LIBICONV_DIR_NAME="libiconv" +CT_LIBICONV_PKG_NAME="libiconv" +CT_LIBICONV_SRC_RELEASE=y +CT_LIBICONV_PATCH_ORDER="global" +CT_LIBICONV_V_1_15=y +# CT_LIBICONV_NO_VERSIONS is not set +CT_LIBICONV_VERSION="1.15" +CT_LIBICONV_MIRRORS="$(CT_Mirrors GNU libiconv)" +CT_LIBICONV_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_LIBICONV_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_LIBICONV_ARCHIVE_FORMATS=".tar.gz" +CT_LIBICONV_SIGNATURE_FORMAT="packed/.sig" +CT_COMP_LIBS_MPC=y +CT_COMP_LIBS_MPC_PKG_KSYM="MPC" +CT_MPC_DIR_NAME="mpc" +CT_MPC_PKG_NAME="mpc" +CT_MPC_SRC_RELEASE=y +CT_MPC_PATCH_ORDER="global" +CT_MPC_V_1_1=y +# CT_MPC_V_1_0 is not set +# CT_MPC_NO_VERSIONS is not set +CT_MPC_VERSION="1.1.0" +CT_MPC_MIRRORS="http://www.multiprecision.org/downloads $(CT_Mirrors GNU mpc)" +CT_MPC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_MPC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_MPC_ARCHIVE_FORMATS=".tar.gz" +CT_MPC_SIGNATURE_FORMAT="packed/.sig" +CT_MPC_1_1_0_or_later=y +CT_MPC_1_1_0_or_older=y +CT_COMP_LIBS_MPFR=y +CT_COMP_LIBS_MPFR_PKG_KSYM="MPFR" +CT_MPFR_DIR_NAME="mpfr" +CT_MPFR_PKG_NAME="mpfr" +CT_MPFR_SRC_RELEASE=y +CT_MPFR_PATCH_ORDER="global" +CT_MPFR_V_4_0=y +# CT_MPFR_V_3_1 is not set +# CT_MPFR_NO_VERSIONS is not set +CT_MPFR_VERSION="4.0.2" +CT_MPFR_MIRRORS="http://www.mpfr.org/mpfr-${CT_MPFR_VERSION} $(CT_Mirrors GNU mpfr)" +CT_MPFR_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_MPFR_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_MPFR_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz .zip" +CT_MPFR_SIGNATURE_FORMAT="packed/.asc" +CT_MPFR_later_than_4_0_0=y +CT_MPFR_4_0_0_or_later=y +CT_MPFR_later_than_3_0_0=y +CT_MPFR_3_0_0_or_later=y +CT_MPFR_REQUIRE_3_0_0_or_later=y +CT_COMP_LIBS_NCURSES=y +CT_COMP_LIBS_NCURSES_PKG_KSYM="NCURSES" +CT_NCURSES_DIR_NAME="ncurses" +CT_NCURSES_PKG_NAME="ncurses" +CT_NCURSES_SRC_RELEASE=y +CT_NCURSES_PATCH_ORDER="global" +CT_NCURSES_V_6_1=y +# CT_NCURSES_V_6_0 is not set +# CT_NCURSES_NO_VERSIONS is not set +CT_NCURSES_VERSION="6.1" +CT_NCURSES_MIRRORS="ftp://invisible-island.net/ncurses $(CT_Mirrors GNU ncurses)" +CT_NCURSES_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_NCURSES_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_NCURSES_ARCHIVE_FORMATS=".tar.gz" +CT_NCURSES_SIGNATURE_FORMAT="packed/.sig" +CT_NCURSES_HOST_CONFIG_ARGS="" +CT_NCURSES_HOST_DISABLE_DB=y +CT_NCURSES_HOST_FALLBACKS="linux,xterm,xterm-color,xterm-256color,vt100" +CT_NCURSES_TARGET_CONFIG_ARGS="" +# CT_NCURSES_TARGET_DISABLE_DB is not set +CT_NCURSES_TARGET_FALLBACKS="" +CT_COMP_LIBS_ZLIB=y +CT_COMP_LIBS_ZLIB_PKG_KSYM="ZLIB" +CT_ZLIB_DIR_NAME="zlib" +CT_ZLIB_PKG_NAME="zlib" +CT_ZLIB_SRC_RELEASE=y +CT_ZLIB_PATCH_ORDER="global" +CT_ZLIB_V_1_2_11=y +# CT_ZLIB_NO_VERSIONS is not set +CT_ZLIB_VERSION="1.2.11" +CT_ZLIB_MIRRORS="http://downloads.sourceforge.net/project/libpng/zlib/${CT_ZLIB_VERSION}" +CT_ZLIB_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_ZLIB_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_ZLIB_ARCHIVE_FORMATS=".tar.xz .tar.gz" +CT_ZLIB_SIGNATURE_FORMAT="packed/.asc" +CT_ALL_COMP_LIBS_CHOICES="CLOOG EXPAT GETTEXT GMP ISL LIBELF LIBICONV MPC MPFR NCURSES ZLIB" +CT_LIBICONV_NEEDED=y +CT_GETTEXT_NEEDED=y +CT_GMP_NEEDED=y +CT_MPFR_NEEDED=y +CT_ISL_NEEDED=y +CT_MPC_NEEDED=y +CT_NCURSES_NEEDED=y +CT_ZLIB_NEEDED=y +CT_LIBICONV=y +CT_GETTEXT=y +CT_GMP=y +CT_MPFR=y +CT_ISL=y +CT_MPC=y +CT_NCURSES=y +CT_ZLIB=y + +# +# Companion tools +# +# CT_COMP_TOOLS_FOR_HOST is not set +# CT_COMP_TOOLS_AUTOCONF is not set +# CT_COMP_TOOLS_AUTOMAKE is not set +# CT_COMP_TOOLS_BISON is not set +# CT_COMP_TOOLS_DTC is not set +# CT_COMP_TOOLS_LIBTOOL is not set +# CT_COMP_TOOLS_M4 is not set +# CT_COMP_TOOLS_MAKE is not set +CT_ALL_COMP_TOOLS_CHOICES="AUTOCONF AUTOMAKE BISON DTC LIBTOOL M4 MAKE" diff --git a/kotlin-native/tools/toolchain_builder/toolchains/mipsel-unknown-linux-gnu/gcc-8.3.0-glibc-2.19-kernel-4.9.config b/kotlin-native/tools/toolchain_builder/toolchains/mipsel-unknown-linux-gnu/gcc-8.3.0-glibc-2.19-kernel-4.9.config new file mode 100644 index 00000000000..573e54ce48f --- /dev/null +++ b/kotlin-native/tools/toolchain_builder/toolchains/mipsel-unknown-linux-gnu/gcc-8.3.0-glibc-2.19-kernel-4.9.config @@ -0,0 +1,758 @@ +# +# Automatically generated file; DO NOT EDIT. +# crosstool-NG Configuration +# +CT_CONFIGURE_has_static_link=y +CT_CONFIGURE_has_cxx11=y +CT_CONFIGURE_has_wget=y +CT_CONFIGURE_has_curl=y +CT_CONFIGURE_has_make_3_81_or_newer=y +CT_CONFIGURE_has_make_4_0_or_newer=y +CT_CONFIGURE_has_libtool_2_4_or_newer=y +CT_CONFIGURE_has_libtoolize_2_4_or_newer=y +CT_CONFIGURE_has_autoconf_2_65_or_newer=y +CT_CONFIGURE_has_autoreconf_2_65_or_newer=y +CT_CONFIGURE_has_automake_1_15_or_newer=y +CT_CONFIGURE_has_gnu_m4_1_4_12_or_newer=y +CT_CONFIGURE_has_python_3_4_or_newer=y +CT_CONFIGURE_has_bison_2_7_or_newer=y +CT_CONFIGURE_has_python=y +CT_CONFIGURE_has_git=y +CT_CONFIGURE_has_md5sum=y +CT_CONFIGURE_has_sha1sum=y +CT_CONFIGURE_has_sha256sum=y +CT_CONFIGURE_has_sha512sum=y +CT_CONFIGURE_has_install_with_strip_program=y +CT_CONFIG_VERSION_CURRENT="3" +CT_CONFIG_VERSION="3" +CT_MODULES=y + +# +# Paths and misc options +# + +# +# crosstool-NG behavior +# +# CT_OBSOLETE is not set +# CT_EXPERIMENTAL is not set +# CT_DEBUG_CT is not set + +# +# Paths +# +CT_LOCAL_TARBALLS_DIR="${HOME}/src" +CT_SAVE_TARBALLS=y +# CT_TARBALLS_BUILDROOT_LAYOUT is not set +CT_WORK_DIR="${CT_TOP_DIR}/.build" +CT_BUILD_TOP_DIR="${CT_WORK_DIR:-${CT_TOP_DIR}/.build}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" +CT_PREFIX_DIR="${CT_PREFIX:-${HOME}/x-tools}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" +CT_RM_RF_PREFIX_DIR=y +CT_REMOVE_DOCS=y +CT_INSTALL_LICENSES=y +# CT_PREFIX_DIR_RO is not set +CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES=y +CT_STRIP_TARGET_TOOLCHAIN_EXECUTABLES=y + +# +# Downloading +# +CT_DOWNLOAD_AGENT_WGET=y +# CT_DOWNLOAD_AGENT_CURL is not set +# CT_DOWNLOAD_AGENT_NONE is not set +# CT_FORBID_DOWNLOAD is not set +# CT_FORCE_DOWNLOAD is not set +CT_CONNECT_TIMEOUT=10 +CT_DOWNLOAD_WGET_OPTIONS="--passive-ftp --tries=3 -nc --progress=dot:binary" +# CT_ONLY_DOWNLOAD is not set +# CT_USE_MIRROR is not set +CT_VERIFY_DOWNLOAD_DIGEST=y +CT_VERIFY_DOWNLOAD_DIGEST_SHA512=y +# CT_VERIFY_DOWNLOAD_DIGEST_SHA256 is not set +# CT_VERIFY_DOWNLOAD_DIGEST_SHA1 is not set +# CT_VERIFY_DOWNLOAD_DIGEST_MD5 is not set +CT_VERIFY_DOWNLOAD_DIGEST_ALG="sha512" +# CT_VERIFY_DOWNLOAD_SIGNATURE is not set + +# +# Extracting +# +# CT_FORCE_EXTRACT is not set +CT_OVERRIDE_CONFIG_GUESS_SUB=y +# CT_ONLY_EXTRACT is not set +CT_PATCH_BUNDLED=y +# CT_PATCH_BUNDLED_LOCAL is not set +CT_PATCH_ORDER="bundled" + +# +# Build behavior +# +CT_PARALLEL_JOBS=0 +CT_LOAD="" +CT_USE_PIPES=y +CT_EXTRA_CFLAGS_FOR_BUILD="" +CT_EXTRA_LDFLAGS_FOR_BUILD="" +CT_EXTRA_CFLAGS_FOR_HOST="" +CT_EXTRA_LDFLAGS_FOR_HOST="" +# CT_CONFIG_SHELL_SH is not set +# CT_CONFIG_SHELL_ASH is not set +CT_CONFIG_SHELL_BASH=y +# CT_CONFIG_SHELL_CUSTOM is not set +CT_CONFIG_SHELL="${bash}" + +# +# Logging +# +# CT_LOG_ERROR is not set +# CT_LOG_WARN is not set +# CT_LOG_INFO is not set +CT_LOG_EXTRA=y +# CT_LOG_ALL is not set +# CT_LOG_DEBUG is not set +CT_LOG_LEVEL_MAX="EXTRA" +# CT_LOG_SEE_TOOLS_WARN is not set +CT_LOG_PROGRESS_BAR=y +CT_LOG_TO_FILE=y +CT_LOG_FILE_COMPRESS=y + +# +# Target options +# +# CT_ARCH_ALPHA is not set +# CT_ARCH_ARC is not set +# CT_ARCH_ARM is not set +# CT_ARCH_AVR is not set +# CT_ARCH_M68K is not set +CT_ARCH_MIPS=y +# CT_ARCH_NIOS2 is not set +# CT_ARCH_POWERPC is not set +# CT_ARCH_S390 is not set +# CT_ARCH_SH is not set +# CT_ARCH_SPARC is not set +# CT_ARCH_X86 is not set +# CT_ARCH_XTENSA is not set +CT_ARCH="mips" +CT_ARCH_CHOICE_KSYM="MIPS" +CT_ARCH_TUNE="" +CT_ARCH_MIPS_SHOW=y + +# +# Options for mips +# +CT_ARCH_MIPS_PKG_KSYM="" +CT_ARCH_mips_o32=y +CT_ARCH_mips_ABI="32" +CT_ALL_ARCH_CHOICES="ALPHA ARC ARM AVR M68K MICROBLAZE MIPS MOXIE MSP430 NIOS2 POWERPC RISCV S390 SH SPARC X86 XTENSA" +CT_ARCH_SUFFIX="" +# CT_OMIT_TARGET_VENDOR is not set + +# +# Generic target options +# +# CT_MULTILIB is not set +CT_DEMULTILIB=y +CT_ARCH_USE_MMU=y +CT_ARCH_SUPPORTS_EITHER_ENDIAN=y +CT_ARCH_DEFAULT_BE=y +# CT_ARCH_BE is not set +CT_ARCH_LE=y +CT_ARCH_ENDIAN="little" +CT_ARCH_SUPPORTS_32=y +CT_ARCH_SUPPORTS_64=y +CT_ARCH_DEFAULT_32=y +CT_ARCH_BITNESS=32 +CT_ARCH_32=y +# CT_ARCH_64 is not set + +# +# Target optimisations +# +CT_ARCH_SUPPORTS_WITH_ARCH=y +CT_ARCH_SUPPORTS_WITH_TUNE=y +CT_ARCH_SUPPORTS_WITH_FLOAT=y +CT_ARCH_ARCH="mips1" +# CT_ARCH_FLOAT_AUTO is not set +# CT_ARCH_FLOAT_HW is not set +CT_ARCH_FLOAT_SW=y +CT_TARGET_CFLAGS="" +CT_TARGET_LDFLAGS="" +CT_ARCH_FLOAT="hard" + +# +# Toolchain options +# + +# +# General toolchain options +# +CT_FORCE_SYSROOT=y +CT_USE_SYSROOT=y +CT_SYSROOT_NAME="sysroot" +CT_SYSROOT_DIR_PREFIX="" +CT_WANTS_STATIC_LINK=y +CT_WANTS_STATIC_LINK_CXX=y +# CT_STATIC_TOOLCHAIN is not set +CT_SHOW_CT_VERSION=y +CT_TOOLCHAIN_PKGVERSION="" +CT_TOOLCHAIN_BUGURL="" + +# +# Tuple completion and aliasing +# +CT_TARGET_VENDOR="unknown" +CT_TARGET_ALIAS_SED_EXPR="" +CT_TARGET_ALIAS="" + +# +# Toolchain type +# +CT_CROSS=y +# CT_CANADIAN is not set +CT_TOOLCHAIN_TYPE="cross" + +# +# Build system +# +CT_BUILD="" +CT_BUILD_PREFIX="" +CT_BUILD_SUFFIX="" + +# +# Misc options +# +# CT_TOOLCHAIN_ENABLE_NLS is not set + +# +# Operating System +# +CT_KERNEL_SUPPORTS_SHARED_LIBS=y +# CT_KERNEL_BARE_METAL is not set +CT_KERNEL_LINUX=y +CT_KERNEL="linux" +CT_KERNEL_CHOICE_KSYM="LINUX" +CT_KERNEL_LINUX_SHOW=y + +# +# Options for linux +# +CT_KERNEL_LINUX_PKG_KSYM="LINUX" +CT_LINUX_DIR_NAME="linux" +CT_LINUX_PKG_NAME="linux" +CT_LINUX_SRC_RELEASE=y +CT_LINUX_PATCH_ORDER="global" +# CT_LINUX_V_4_20 is not set +# CT_LINUX_V_4_19 is not set +# CT_LINUX_V_4_18 is not set +# CT_LINUX_V_4_17 is not set +# CT_LINUX_V_4_16 is not set +# CT_LINUX_V_4_15 is not set +# CT_LINUX_V_4_14 is not set +# CT_LINUX_V_4_13 is not set +# CT_LINUX_V_4_12 is not set +# CT_LINUX_V_4_11 is not set +# CT_LINUX_V_4_10 is not set +CT_LINUX_V_4_9=y +# CT_LINUX_V_4_4 is not set +# CT_LINUX_V_4_1 is not set +# CT_LINUX_V_3_16 is not set +# CT_LINUX_V_3_13 is not set +# CT_LINUX_V_3_12 is not set +# CT_LINUX_V_3_10 is not set +# CT_LINUX_V_3_4 is not set +# CT_LINUX_V_3_2 is not set +# CT_LINUX_V_2_6_32 is not set +# CT_LINUX_NO_VERSIONS is not set +CT_LINUX_VERSION="4.9.156" +CT_LINUX_MIRRORS="$(CT_Mirrors kernel.org linux ${CT_LINUX_VERSION})" +CT_LINUX_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_LINUX_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_LINUX_ARCHIVE_FORMATS=".tar.xz .tar.gz" +CT_LINUX_SIGNATURE_FORMAT="unpacked/.sign" +CT_LINUX_later_than_4_8=y +CT_LINUX_4_8_or_later=y +CT_LINUX_later_than_3_7=y +CT_LINUX_3_7_or_later=y +CT_LINUX_later_than_3_2=y +CT_LINUX_3_2_or_later=y +CT_KERNEL_LINUX_VERBOSITY_0=y +# CT_KERNEL_LINUX_VERBOSITY_1 is not set +# CT_KERNEL_LINUX_VERBOSITY_2 is not set +CT_KERNEL_LINUX_VERBOSE_LEVEL=0 +CT_KERNEL_LINUX_INSTALL_CHECK=y +CT_ALL_KERNEL_CHOICES="BARE_METAL LINUX WINDOWS" + +# +# Common kernel options +# +CT_SHARED_LIBS=y + +# +# Binary utilities +# +CT_ARCH_BINFMT_ELF=y +CT_BINUTILS_BINUTILS=y +CT_BINUTILS="binutils" +CT_BINUTILS_CHOICE_KSYM="BINUTILS" +CT_BINUTILS_BINUTILS_SHOW=y + +# +# Options for binutils +# +CT_BINUTILS_BINUTILS_PKG_KSYM="BINUTILS" +CT_BINUTILS_DIR_NAME="binutils" +CT_BINUTILS_USE_GNU=y +CT_BINUTILS_USE="BINUTILS" +CT_BINUTILS_PKG_NAME="binutils" +CT_BINUTILS_SRC_RELEASE=y +CT_BINUTILS_PATCH_ORDER="global" +CT_BINUTILS_V_2_32=y +# CT_BINUTILS_V_2_31 is not set +# CT_BINUTILS_V_2_30 is not set +# CT_BINUTILS_V_2_29 is not set +# CT_BINUTILS_V_2_28 is not set +# CT_BINUTILS_V_2_27 is not set +# CT_BINUTILS_V_2_26 is not set +# CT_BINUTILS_NO_VERSIONS is not set +CT_BINUTILS_VERSION="2.32" +CT_BINUTILS_MIRRORS="$(CT_Mirrors GNU binutils) $(CT_Mirrors sourceware binutils/releases)" +CT_BINUTILS_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_BINUTILS_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_BINUTILS_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" +CT_BINUTILS_SIGNATURE_FORMAT="packed/.sig" +CT_BINUTILS_later_than_2_30=y +CT_BINUTILS_2_30_or_later=y +CT_BINUTILS_later_than_2_27=y +CT_BINUTILS_2_27_or_later=y +CT_BINUTILS_later_than_2_25=y +CT_BINUTILS_2_25_or_later=y +CT_BINUTILS_later_than_2_23=y +CT_BINUTILS_2_23_or_later=y + +# +# GNU binutils +# +CT_BINUTILS_HAS_HASH_STYLE=y +CT_BINUTILS_HAS_GOLD=y +CT_BINUTILS_HAS_PLUGINS=y +CT_BINUTILS_HAS_PKGVERSION_BUGURL=y +CT_BINUTILS_FORCE_LD_BFD_DEFAULT=y +CT_BINUTILS_LINKER_LD=y +CT_BINUTILS_LINKERS_LIST="ld" +CT_BINUTILS_LINKER_DEFAULT="bfd" +CT_BINUTILS_PLUGINS=y +CT_BINUTILS_RELRO=m +CT_BINUTILS_EXTRA_CONFIG_ARRAY="" +# CT_BINUTILS_FOR_TARGET is not set +CT_ALL_BINUTILS_CHOICES="BINUTILS" + +# +# C-library +# +CT_LIBC_GLIBC=y +# CT_LIBC_UCLIBC is not set +CT_LIBC="glibc" +CT_LIBC_CHOICE_KSYM="GLIBC" +CT_THREADS="nptl" +CT_LIBC_GLIBC_SHOW=y + +# +# Options for glibc +# +CT_LIBC_GLIBC_PKG_KSYM="GLIBC" +CT_GLIBC_DIR_NAME="glibc" +CT_GLIBC_USE_GNU=y +CT_GLIBC_USE="GLIBC" +CT_GLIBC_PKG_NAME="glibc" +CT_GLIBC_SRC_RELEASE=y +CT_GLIBC_PATCH_ORDER="global" +# CT_GLIBC_V_2_29 is not set +# CT_GLIBC_V_2_28 is not set +# CT_GLIBC_V_2_27 is not set +# CT_GLIBC_V_2_26 is not set +# CT_GLIBC_V_2_25 is not set +# CT_GLIBC_V_2_24 is not set +# CT_GLIBC_V_2_23 is not set +CT_GLIBC_V_2_19=y +# CT_GLIBC_V_2_17 is not set +# CT_GLIBC_V_2_12_1 is not set +# CT_GLIBC_NO_VERSIONS is not set +CT_GLIBC_VERSION="2.19" +CT_GLIBC_MIRRORS="$(CT_Mirrors GNU glibc)" +CT_GLIBC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_GLIBC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_GLIBC_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" +CT_GLIBC_SIGNATURE_FORMAT="packed/.sig" +CT_GLIBC_2_29_or_older=y +CT_GLIBC_older_than_2_29=y +CT_GLIBC_2_27_or_older=y +CT_GLIBC_older_than_2_27=y +CT_GLIBC_2_26_or_older=y +CT_GLIBC_older_than_2_26=y +CT_GLIBC_2_25_or_older=y +CT_GLIBC_older_than_2_25=y +CT_GLIBC_2_24_or_older=y +CT_GLIBC_older_than_2_24=y +CT_GLIBC_2_23_or_older=y +CT_GLIBC_older_than_2_23=y +CT_GLIBC_2_20_or_older=y +CT_GLIBC_older_than_2_20=y +CT_GLIBC_later_than_2_17=y +CT_GLIBC_2_17_or_later=y +CT_GLIBC_later_than_2_14=y +CT_GLIBC_2_14_or_later=y +CT_GLIBC_DEP_KERNEL_HEADERS_VERSION=y +CT_GLIBC_DEP_BINUTILS=y +CT_GLIBC_DEP_GCC=y +CT_GLIBC_DEP_PYTHON=y +CT_GLIBC_HAS_NPTL_ADDON=y +CT_GLIBC_HAS_PORTS_ADDON=y +CT_GLIBC_HAS_LIBIDN_ADDON=y +CT_GLIBC_USE_PORTS_ADDON=y +CT_GLIBC_USE_NPTL_ADDON=y +# CT_GLIBC_USE_LIBIDN_ADDON is not set +CT_GLIBC_HAS_OBSOLETE_RPC=y +CT_GLIBC_EXTRA_CONFIG_ARRAY="" +CT_GLIBC_CONFIGPARMS="" +CT_GLIBC_EXTRA_CFLAGS="" +CT_GLIBC_ENABLE_OBSOLETE_RPC=y +# CT_GLIBC_DISABLE_VERSIONING is not set +CT_GLIBC_OLDEST_ABI="" +CT_GLIBC_FORCE_UNWIND=y +# CT_GLIBC_LOCALES is not set +# CT_GLIBC_KERNEL_VERSION_NONE is not set +CT_GLIBC_KERNEL_VERSION_AS_HEADERS=y +# CT_GLIBC_KERNEL_VERSION_CHOSEN is not set +CT_GLIBC_MIN_KERNEL="4.9.156" +# CT_GLIBC_SSP_DEFAULT is not set +# CT_GLIBC_SSP_NO is not set +# CT_GLIBC_SSP_YES is not set +# CT_GLIBC_SSP_ALL is not set +# CT_GLIBC_SSP_STRONG is not set +CT_ALL_LIBC_CHOICES="AVR_LIBC BIONIC GLIBC MINGW_W64 MOXIEBOX MUSL NEWLIB NONE UCLIBC" +CT_LIBC_SUPPORT_THREADS_ANY=y +CT_LIBC_SUPPORT_THREADS_NATIVE=y + +# +# Common C library options +# +CT_THREADS_NATIVE=y +# CT_CREATE_LDSO_CONF is not set +CT_LIBC_XLDD=y + +# +# C compiler +# +CT_CC_CORE_PASSES_NEEDED=y +CT_CC_CORE_PASS_1_NEEDED=y +CT_CC_CORE_PASS_2_NEEDED=y +CT_CC_SUPPORT_CXX=y +CT_CC_SUPPORT_FORTRAN=y +CT_CC_SUPPORT_ADA=y +CT_CC_SUPPORT_OBJC=y +CT_CC_SUPPORT_OBJCXX=y +CT_CC_SUPPORT_GOLANG=y +CT_CC_GCC=y +CT_CC="gcc" +CT_CC_CHOICE_KSYM="GCC" +CT_CC_GCC_SHOW=y + +# +# Options for gcc +# +CT_CC_GCC_PKG_KSYM="GCC" +CT_GCC_DIR_NAME="gcc" +CT_GCC_USE_GNU=y +CT_GCC_USE="GCC" +CT_GCC_PKG_NAME="gcc" +CT_GCC_SRC_RELEASE=y +CT_GCC_PATCH_ORDER="global" +CT_GCC_V_8=y +# CT_GCC_V_7 is not set +# CT_GCC_V_6 is not set +# CT_GCC_V_5 is not set +# CT_GCC_V_4_9 is not set +# CT_GCC_NO_VERSIONS is not set +CT_GCC_VERSION="8.3.0" +CT_GCC_MIRRORS="$(CT_Mirrors GNU gcc/gcc-${CT_GCC_VERSION}) $(CT_Mirrors sourceware gcc/releases/gcc-${CT_GCC_VERSION})" +CT_GCC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_GCC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_GCC_ARCHIVE_FORMATS=".tar.xz .tar.gz" +CT_GCC_SIGNATURE_FORMAT="" +CT_GCC_later_than_7=y +CT_GCC_7_or_later=y +CT_GCC_later_than_6=y +CT_GCC_6_or_later=y +CT_GCC_later_than_5=y +CT_GCC_5_or_later=y +CT_GCC_later_than_4_9=y +CT_GCC_4_9_or_later=y +CT_GCC_later_than_4_8=y +CT_GCC_4_8_or_later=y +CT_CC_GCC_ENABLE_PLUGINS=y +CT_CC_GCC_HAS_LIBMPX=y +CT_CC_GCC_ENABLE_CXX_FLAGS="" +CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="" +CT_CC_GCC_EXTRA_CONFIG_ARRAY="" +CT_CC_GCC_STATIC_LIBSTDCXX=y +# CT_CC_GCC_SYSTEM_ZLIB is not set +CT_CC_GCC_CONFIG_TLS=m + +# +# Optimisation features +# +CT_CC_GCC_USE_GRAPHITE=y +CT_CC_GCC_USE_LTO=y + +# +# Settings for libraries running on target +# +CT_CC_GCC_ENABLE_TARGET_OPTSPACE=y +# CT_CC_GCC_LIBMUDFLAP is not set +# CT_CC_GCC_LIBGOMP is not set +# CT_CC_GCC_LIBSSP is not set +# CT_CC_GCC_LIBQUADMATH is not set +# CT_CC_GCC_LIBSANITIZER is not set + +# +# Misc. obscure options. +# +CT_CC_CXA_ATEXIT=y +# CT_CC_GCC_DISABLE_PCH is not set +CT_CC_GCC_SJLJ_EXCEPTIONS=m +CT_CC_GCC_LDBL_128=m +# CT_CC_GCC_BUILD_ID is not set +CT_CC_GCC_LNK_HASH_STYLE_DEFAULT=y +# CT_CC_GCC_LNK_HASH_STYLE_SYSV is not set +# CT_CC_GCC_LNK_HASH_STYLE_GNU is not set +# CT_CC_GCC_LNK_HASH_STYLE_BOTH is not set +CT_CC_GCC_LNK_HASH_STYLE="" +CT_CC_GCC_DEC_FLOAT_AUTO=y +# CT_CC_GCC_DEC_FLOAT_BID is not set +# CT_CC_GCC_DEC_FLOAT_DPD is not set +# CT_CC_GCC_DEC_FLOATS_NO is not set +CT_CC_GCC_HAS_ARCH_OPTIONS=y + +# +# archictecture-specific options +# +CT_CC_GCC_mips_llsc=m +CT_CC_GCC_mips_synci=m +CT_CC_GCC_mips_plt=y +CT_ALL_CC_CHOICES="GCC" + +# +# Additional supported languages: +# +CT_CC_LANG_CXX=y +# CT_CC_LANG_FORTRAN is not set + +# +# Debug facilities +# +# CT_DEBUG_DUMA is not set +# CT_DEBUG_GDB is not set +# CT_DEBUG_LTRACE is not set +# CT_DEBUG_STRACE is not set +CT_ALL_DEBUG_CHOICES="DUMA GDB LTRACE STRACE" + +# +# Companion libraries +# +# CT_COMPLIBS_CHECK is not set +# CT_COMP_LIBS_CLOOG is not set +CT_COMP_LIBS_EXPAT=y +CT_COMP_LIBS_EXPAT_PKG_KSYM="EXPAT" +CT_EXPAT_DIR_NAME="expat" +CT_EXPAT_PKG_NAME="expat" +CT_EXPAT_SRC_RELEASE=y +CT_EXPAT_PATCH_ORDER="global" +CT_EXPAT_V_2_2=y +# CT_EXPAT_NO_VERSIONS is not set +CT_EXPAT_VERSION="2.2.6" +CT_EXPAT_MIRRORS="http://downloads.sourceforge.net/project/expat/expat/${CT_EXPAT_VERSION}" +CT_EXPAT_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_EXPAT_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_EXPAT_ARCHIVE_FORMATS=".tar.bz2" +CT_EXPAT_SIGNATURE_FORMAT="" +CT_COMP_LIBS_GETTEXT=y +CT_COMP_LIBS_GETTEXT_PKG_KSYM="GETTEXT" +CT_GETTEXT_DIR_NAME="gettext" +CT_GETTEXT_PKG_NAME="gettext" +CT_GETTEXT_SRC_RELEASE=y +CT_GETTEXT_PATCH_ORDER="global" +CT_GETTEXT_V_0_19_8_1=y +# CT_GETTEXT_NO_VERSIONS is not set +CT_GETTEXT_VERSION="0.19.8.1" +CT_GETTEXT_MIRRORS="$(CT_Mirrors GNU gettext)" +CT_GETTEXT_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_GETTEXT_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_GETTEXT_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.gz" +CT_GETTEXT_SIGNATURE_FORMAT="packed/.sig" +CT_COMP_LIBS_GMP=y +CT_COMP_LIBS_GMP_PKG_KSYM="GMP" +CT_GMP_DIR_NAME="gmp" +CT_GMP_PKG_NAME="gmp" +CT_GMP_SRC_RELEASE=y +CT_GMP_PATCH_ORDER="global" +CT_GMP_V_6_1=y +# CT_GMP_NO_VERSIONS is not set +CT_GMP_VERSION="6.1.2" +CT_GMP_MIRRORS="https://gmplib.org/download/gmp https://gmplib.org/download/gmp/archive $(CT_Mirrors GNU gmp)" +CT_GMP_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_GMP_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_GMP_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.bz2" +CT_GMP_SIGNATURE_FORMAT="packed/.sig" +CT_GMP_later_than_5_1_0=y +CT_GMP_5_1_0_or_later=y +CT_GMP_later_than_5_0_0=y +CT_GMP_5_0_0_or_later=y +CT_GMP_REQUIRE_5_0_0_or_later=y +CT_COMP_LIBS_ISL=y +CT_COMP_LIBS_ISL_PKG_KSYM="ISL" +CT_ISL_DIR_NAME="isl" +CT_ISL_PKG_NAME="isl" +CT_ISL_SRC_RELEASE=y +CT_ISL_PATCH_ORDER="global" +CT_ISL_V_0_20=y +# CT_ISL_V_0_19 is not set +# CT_ISL_V_0_18 is not set +# CT_ISL_V_0_17 is not set +# CT_ISL_V_0_16 is not set +# CT_ISL_V_0_15 is not set +# CT_ISL_NO_VERSIONS is not set +CT_ISL_VERSION="0.20" +CT_ISL_MIRRORS="http://isl.gforge.inria.fr" +CT_ISL_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_ISL_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_ISL_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" +CT_ISL_SIGNATURE_FORMAT="" +CT_ISL_later_than_0_18=y +CT_ISL_0_18_or_later=y +CT_ISL_later_than_0_15=y +CT_ISL_0_15_or_later=y +CT_ISL_REQUIRE_0_15_or_later=y +CT_ISL_later_than_0_14=y +CT_ISL_0_14_or_later=y +CT_ISL_REQUIRE_0_14_or_later=y +CT_ISL_later_than_0_13=y +CT_ISL_0_13_or_later=y +CT_ISL_later_than_0_12=y +CT_ISL_0_12_or_later=y +CT_ISL_REQUIRE_0_12_or_later=y +# CT_COMP_LIBS_LIBELF is not set +CT_COMP_LIBS_LIBICONV=y +CT_COMP_LIBS_LIBICONV_PKG_KSYM="LIBICONV" +CT_LIBICONV_DIR_NAME="libiconv" +CT_LIBICONV_PKG_NAME="libiconv" +CT_LIBICONV_SRC_RELEASE=y +CT_LIBICONV_PATCH_ORDER="global" +CT_LIBICONV_V_1_15=y +# CT_LIBICONV_NO_VERSIONS is not set +CT_LIBICONV_VERSION="1.15" +CT_LIBICONV_MIRRORS="$(CT_Mirrors GNU libiconv)" +CT_LIBICONV_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_LIBICONV_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_LIBICONV_ARCHIVE_FORMATS=".tar.gz" +CT_LIBICONV_SIGNATURE_FORMAT="packed/.sig" +CT_COMP_LIBS_MPC=y +CT_COMP_LIBS_MPC_PKG_KSYM="MPC" +CT_MPC_DIR_NAME="mpc" +CT_MPC_PKG_NAME="mpc" +CT_MPC_SRC_RELEASE=y +CT_MPC_PATCH_ORDER="global" +CT_MPC_V_1_1=y +# CT_MPC_V_1_0 is not set +# CT_MPC_NO_VERSIONS is not set +CT_MPC_VERSION="1.1.0" +CT_MPC_MIRRORS="http://www.multiprecision.org/downloads $(CT_Mirrors GNU mpc)" +CT_MPC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_MPC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_MPC_ARCHIVE_FORMATS=".tar.gz" +CT_MPC_SIGNATURE_FORMAT="packed/.sig" +CT_MPC_1_1_0_or_later=y +CT_MPC_1_1_0_or_older=y +CT_COMP_LIBS_MPFR=y +CT_COMP_LIBS_MPFR_PKG_KSYM="MPFR" +CT_MPFR_DIR_NAME="mpfr" +CT_MPFR_PKG_NAME="mpfr" +CT_MPFR_SRC_RELEASE=y +CT_MPFR_PATCH_ORDER="global" +CT_MPFR_V_4_0=y +# CT_MPFR_V_3_1 is not set +# CT_MPFR_NO_VERSIONS is not set +CT_MPFR_VERSION="4.0.2" +CT_MPFR_MIRRORS="http://www.mpfr.org/mpfr-${CT_MPFR_VERSION} $(CT_Mirrors GNU mpfr)" +CT_MPFR_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_MPFR_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_MPFR_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz .zip" +CT_MPFR_SIGNATURE_FORMAT="packed/.asc" +CT_MPFR_later_than_4_0_0=y +CT_MPFR_4_0_0_or_later=y +CT_MPFR_later_than_3_0_0=y +CT_MPFR_3_0_0_or_later=y +CT_MPFR_REQUIRE_3_0_0_or_later=y +CT_COMP_LIBS_NCURSES=y +CT_COMP_LIBS_NCURSES_PKG_KSYM="NCURSES" +CT_NCURSES_DIR_NAME="ncurses" +CT_NCURSES_PKG_NAME="ncurses" +CT_NCURSES_SRC_RELEASE=y +CT_NCURSES_PATCH_ORDER="global" +CT_NCURSES_V_6_1=y +# CT_NCURSES_V_6_0 is not set +# CT_NCURSES_NO_VERSIONS is not set +CT_NCURSES_VERSION="6.1" +CT_NCURSES_MIRRORS="ftp://invisible-island.net/ncurses $(CT_Mirrors GNU ncurses)" +CT_NCURSES_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_NCURSES_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_NCURSES_ARCHIVE_FORMATS=".tar.gz" +CT_NCURSES_SIGNATURE_FORMAT="packed/.sig" +CT_NCURSES_HOST_CONFIG_ARGS="" +CT_NCURSES_HOST_DISABLE_DB=y +CT_NCURSES_HOST_FALLBACKS="linux,xterm,xterm-color,xterm-256color,vt100" +CT_NCURSES_TARGET_CONFIG_ARGS="" +# CT_NCURSES_TARGET_DISABLE_DB is not set +CT_NCURSES_TARGET_FALLBACKS="" +CT_COMP_LIBS_ZLIB=y +CT_COMP_LIBS_ZLIB_PKG_KSYM="ZLIB" +CT_ZLIB_DIR_NAME="zlib" +CT_ZLIB_PKG_NAME="zlib" +CT_ZLIB_SRC_RELEASE=y +CT_ZLIB_PATCH_ORDER="global" +CT_ZLIB_V_1_2_11=y +# CT_ZLIB_NO_VERSIONS is not set +CT_ZLIB_VERSION="1.2.11" +CT_ZLIB_MIRRORS="http://downloads.sourceforge.net/project/libpng/zlib/${CT_ZLIB_VERSION}" +CT_ZLIB_ARCHIVE_FILENAME="@{pkg_name}-@{version}" +CT_ZLIB_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" +CT_ZLIB_ARCHIVE_FORMATS=".tar.xz .tar.gz" +CT_ZLIB_SIGNATURE_FORMAT="packed/.asc" +CT_ALL_COMP_LIBS_CHOICES="CLOOG EXPAT GETTEXT GMP ISL LIBELF LIBICONV MPC MPFR NCURSES ZLIB" +CT_LIBICONV_NEEDED=y +CT_GETTEXT_NEEDED=y +CT_GMP_NEEDED=y +CT_MPFR_NEEDED=y +CT_ISL_NEEDED=y +CT_MPC_NEEDED=y +CT_NCURSES_NEEDED=y +CT_ZLIB_NEEDED=y +CT_LIBICONV=y +CT_GETTEXT=y +CT_GMP=y +CT_MPFR=y +CT_ISL=y +CT_MPC=y +CT_NCURSES=y +CT_ZLIB=y + +# +# Companion tools +# +# CT_COMP_TOOLS_FOR_HOST is not set +# CT_COMP_TOOLS_AUTOCONF is not set +# CT_COMP_TOOLS_AUTOMAKE is not set +# CT_COMP_TOOLS_BISON is not set +# CT_COMP_TOOLS_DTC is not set +# CT_COMP_TOOLS_LIBTOOL is not set +# CT_COMP_TOOLS_M4 is not set +# CT_COMP_TOOLS_MAKE is not set +CT_ALL_COMP_TOOLS_CHOICES="AUTOCONF AUTOMAKE BISON DTC LIBTOOL M4 MAKE" From 43bfeb5c33c7dd8795091589bc911d17a2e90719 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Fri, 4 Dec 2020 15:00:47 +0700 Subject: [PATCH 687/698] Support new linux_arm64 toolchain --- kotlin-native/konan/konan.properties | 26 +++++++------------ .../kotlin/konan/target/ClangArgs.kt | 8 ++---- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/kotlin-native/konan/konan.properties b/kotlin-native/konan/konan.properties index 4ce964438e9..a68ccb1bcf4 100644 --- a/kotlin-native/konan/konan.properties +++ b/kotlin-native/konan/konan.properties @@ -467,9 +467,9 @@ runtimeDefinitions.linux_arm32_hfp = USE_GCC_UNWIND=1 KONAN_LINUX=1 \ KONAN_ARM32=1 USE_ELF_SYMBOLS=1 ELFSIZE=32 KONAN_NO_UNALIGNED_ACCESS=1 # Linux arm64 -gccToolchain.linux_arm64 = target-gcc-toolchain-3-linux-x86-64 +gccToolchain.linux_arm64 = aarch64-unknown-linux-gnu-gcc-8.3.0-glibc-2.25-kernel-4.9 -targetToolchain.linux_x64-linux_arm64 = target-gcc-toolchain-3-linux-x86-64/x86_64-unknown-linux-gnu +targetToolchain.linux_x64-linux_arm64 = $gccToolchain.linux_arm64/aarch64-unknown-linux-gnu targetToolchain.mingw_x64-linux_arm64 = msys2-mingw-w64-x86_64-clang-llvm-lld-compiler_rt-8.0.1 targetToolchain.macos_x64-linux_arm64 = $llvmHome.macos_x64 @@ -477,29 +477,25 @@ emulatorDependency.linux_x64-linux_arm64 = qemu-aarch64-static-5.1.0-linux-2 emulatorExecutable.linux_x64-linux_arm64 = qemu-aarch64-static-5.1.0-linux-2/qemu-aarch64 dependencies.linux_x64-linux_arm64 = \ - target-gcc-toolchain-3-linux-x86-64 \ - target-sysroot-1-linux-glibc-arm64 \ + aarch64-unknown-linux-gnu-gcc-8.3.0-glibc-2.25-kernel-4.9 \ libffi-3.2.1-2-linux-x86-64 dependencies.mingw_x64-linux_arm64 = \ - libffi-3.2.1-mingw-w64-x86-64 \ - target-gcc-toolchain-3-linux-x86-64 \ - target-sysroot-1-linux-glibc-arm64 + aarch64-unknown-linux-gnu-gcc-8.3.0-glibc-2.25-kernel-4.9 \ + libffi-3.2.1-mingw-w64-x86-64 dependencies.macos_x64-linux_arm64 = \ - libffi-3.2.1-3-darwin-macos \ - target-gcc-toolchain-3-linux-x86-64 \ - target-sysroot-1-linux-glibc-arm64 + aarch64-unknown-linux-gnu-gcc-8.3.0-glibc-2.25-kernel-4.9 \ + libffi-3.2.1-3-darwin-macos quadruple.linux_arm64 = aarch64-unknown-linux-gnu linkerNoDebugFlags.linux_arm64 = -S linkerDynamicFlags.linux_arm64 = -shared linkerOptimizationFlags.linux_arm64 = --gc-sections -# From https://releases.linaro.org/components/toolchain/binaries/latest-7/aarch64-linux-gnu/. -targetSysRoot.linux_arm64 = target-sysroot-1-linux-glibc-arm64 +targetSysRoot.linux_arm64 = $gccToolchain.linux_arm64/aarch64-unknown-linux-gnu/sysroot # We could reuse host toolchain here. linkerKonanFlags.linux_arm64 = -Bstatic -lstdc++ -Bdynamic -ldl -lm -lpthread \ --defsym __cxa_demangle=Konan_cxa_demangle --no-threads # targetSysroot-relative. -libGcc.linux_arm64 = usr/lib +libGcc.linux_arm64 = ../../lib/gcc/aarch64-unknown-linux-gnu/8.3.0 targetCpu.linux_arm64 = generic clangFlags.linux_arm64 = -cc1 -target-cpu cortex-a57 -emit-obj -disable-llvm-optzns -x ir clangNooptFlags.linux_arm64 = -O1 @@ -508,9 +504,7 @@ clangDebugFlags.linux_arm64 = -O0 clangDynamicFlags.linux_arm64 = -mrelocation-model pic dynamicLinker.linux_arm64 = /lib/ld-linux-aarch64.so.1 # targetSysRoot relative -abiSpecificLibraries.linux_arm64 = \ - lib \ - usr/lib +abiSpecificLibraries.linux_arm64 = lib usr/lib runtimeDefinitions.linux_arm64 = USE_GCC_UNWIND=1 KONAN_LINUX=1 KONAN_ARM64=1 \ USE_ELF_SYMBOLS=1 ELFSIZE=64 diff --git a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt index 15ede43cc1c..cce351ebf20 100644 --- a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt +++ b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt @@ -77,7 +77,8 @@ class ClangArgs(private val configurables: Configurables) : Configurables by con private val specificClangArgs: List = when (target) { KonanTarget.LINUX_X64, - KonanTarget.LINUX_MIPS32, KonanTarget.LINUX_MIPSEL32 -> emptyList() + KonanTarget.LINUX_MIPS32, KonanTarget.LINUX_MIPSEL32, + KonanTarget.LINUX_ARM64 -> emptyList() KonanTarget.LINUX_ARM32_HFP -> listOf( "-mfpu=vfp", "-mfloat-abi=hard", @@ -86,11 +87,6 @@ class ClangArgs(private val configurables: Configurables) : Configurables by con "-I$absoluteTargetSysRoot/usr/include/c++/4.8.3/arm-linux-gnueabihf" ) - KonanTarget.LINUX_ARM64 -> listOf( - "-I$absoluteTargetSysRoot/usr/include/c++/7", - "-I$absoluteTargetSysRoot/usr/include/c++/7/aarch64-linux-gnu" - ) - KonanTarget.MINGW_X64, KonanTarget.MINGW_X86 -> emptyList() KonanTarget.MACOS_X64 -> listOf( From ddaf4778493e8810a3aaa52ead0ccd5ce1ff4179 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Fri, 4 Dec 2020 18:07:59 +0700 Subject: [PATCH 688/698] Support new linux_arm32_hfp_toolchain --- kotlin-native/konan/konan.properties | 28 +++----- .../kotlin/konan/target/ClangArgs.kt | 10 +-- .../gcc-8.3.0-glibc-2.19-kernel-4.9.config | 71 ++++--------------- 3 files changed, 28 insertions(+), 81 deletions(-) diff --git a/kotlin-native/konan/konan.properties b/kotlin-native/konan/konan.properties index a68ccb1bcf4..e325682da80 100644 --- a/kotlin-native/konan/konan.properties +++ b/kotlin-native/konan/konan.properties @@ -417,9 +417,9 @@ runtimeDefinitions.linux_x64 = USE_GCC_UNWIND=1 KONAN_LINUX=1 KONAN_X64=1 \ USE_ELF_SYMBOLS=1 ELFSIZE=64 KONAN_HAS_CXX11_EXCEPTION_FUNCTIONS=1 # Raspberry Pi -gccToolchain.linux_arm32_hfp = target-gcc-toolchain-3-linux-x86-64 +gccToolchain.linux_arm32_hfp = arm-unknown-linux-gnueabihf-gcc-8.3.0-glibc-2.19-kernel-4.9 -targetToolchain.linux_x64-linux_arm32_hfp = target-gcc-toolchain-3-linux-x86-64/x86_64-unknown-linux-gnu +targetToolchain.linux_x64-linux_arm32_hfp = $gccToolchain.linux_arm32_hfp/arm-unknown-linux-gnueabihf targetToolchain.mingw_x64-linux_arm32_hfp = msys2-mingw-w64-x86_64-clang-llvm-lld-compiler_rt-8.0.1 targetToolchain.macos_x64-linux_arm32_hfp = $llvmHome.macos_x64 @@ -428,28 +428,25 @@ emulatorDependency.linux_x64-linux_arm32_hfp = qemu-arm-static-5.1.0-linux-2 emulatorExecutable.linux_x64-linux_arm32_hfp = qemu-arm-static-5.1.0-linux-2/qemu-arm dependencies.linux_x64-linux_arm32_hfp = \ - target-gcc-toolchain-3-linux-x86-64 \ - target-sysroot-2-raspberrypi \ + arm-unknown-linux-gnueabihf-gcc-8.3.0-glibc-2.19-kernel-4.9 \ libffi-3.2.1-2-linux-x86-64 dependencies.mingw_x64-linux_arm32_hfp = \ - libffi-3.2.1-mingw-w64-x86-64 \ - target-gcc-toolchain-3-linux-x86-64 \ - target-sysroot-2-raspberrypi + arm-unknown-linux-gnueabihf-gcc-8.3.0-glibc-2.19-kernel-4.9 \ + libffi-3.2.1-mingw-w64-x86-64 dependencies.macos_x64-linux_arm32_hfp = \ - libffi-3.2.1-3-darwin-macos \ - target-gcc-toolchain-3-linux-x86-64 \ - target-sysroot-2-raspberrypi + arm-unknown-linux-gnueabihf-gcc-8.3.0-glibc-2.19-kernel-4.9 \ + libffi-3.2.1-3-darwin-macos -quadruple.linux_arm32_hfp = armv6-unknown-linux-gnueabihf +quadruple.linux_arm32_hfp = arm-unknown-linux-gnueabihf linkerNoDebugFlags.linux_arm32_hfp = -S linkerDynamicFlags.linux_arm32_hfp = -shared linkerOptimizationFlags.linux_arm32_hfp = --gc-sections -targetSysRoot.linux_arm32_hfp = target-sysroot-2-raspberrypi +targetSysRoot.linux_arm32_hfp = $gccToolchain.linux_arm32_hfp/arm-unknown-linux-gnueabihf/sysroot # We could reuse host toolchain here. linkerKonanFlags.linux_arm32_hfp = -Bstatic -lstdc++ -Bdynamic -ldl -lm -lpthread \ --defsym __cxa_demangle=Konan_cxa_demangle --no-threads # targetSysroot-relative. -libGcc.linux_arm32_hfp = lib/gcc/arm-linux-gnueabihf/4.8.3 +libGcc.linux_arm32_hfp = ../../lib/gcc/arm-unknown-linux-gnueabihf/8.3.0 targetCpu.linux_arm32_hfp = arm1136jf-s targetCpuFeatures.linux_arm32_hfp = +dsp,+strict-align,+vfp2,-crypto,-d16,-fp-armv8,-fp-only-sp,-fp16,-neon,-thumb-mode,-vfp3,-vfp4 clangFlags.linux_arm32_hfp = -cc1 -target-cpu $targetCpu.linux_arm32_hfp -mfloat-abi hard -emit-obj -disable-llvm-optzns -x ir @@ -459,10 +456,7 @@ clangDebugFlags.linux_arm32_hfp = -O0 clangDynamicFlags.linux_arm32_hfp = -mrelocation-model pic dynamicLinker.linux_arm32_hfp = /lib/ld-linux-armhf.so.3 # targetSysRoot relative -abiSpecificLibraries.linux_arm32_hfp = \ - ../lib/arm-linux-gnueabihf \ - lib/arm-linux-gnueabihf \ - usr/lib/arm-linux-gnueabihf +abiSpecificLibraries.linux_arm32_hfp = lib usr/lib runtimeDefinitions.linux_arm32_hfp = USE_GCC_UNWIND=1 KONAN_LINUX=1 \ KONAN_ARM32=1 USE_ELF_SYMBOLS=1 ELFSIZE=32 KONAN_NO_UNALIGNED_ACCESS=1 diff --git a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt index cce351ebf20..23fba070463 100644 --- a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt +++ b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt @@ -78,17 +78,13 @@ class ClangArgs(private val configurables: Configurables) : Configurables by con private val specificClangArgs: List = when (target) { KonanTarget.LINUX_X64, KonanTarget.LINUX_MIPS32, KonanTarget.LINUX_MIPSEL32, - KonanTarget.LINUX_ARM64 -> emptyList() + KonanTarget.LINUX_ARM64, + KonanTarget.MINGW_X64, KonanTarget.MINGW_X86 -> emptyList() KonanTarget.LINUX_ARM32_HFP -> listOf( - "-mfpu=vfp", "-mfloat-abi=hard", - // TODO: those two are hacks. - "-I$absoluteTargetSysRoot/usr/include/c++/4.8.3", - "-I$absoluteTargetSysRoot/usr/include/c++/4.8.3/arm-linux-gnueabihf" + "-mfpu=vfp", "-mfloat-abi=hard" ) - KonanTarget.MINGW_X64, KonanTarget.MINGW_X86 -> emptyList() - KonanTarget.MACOS_X64 -> listOf( "-mmacosx-version-min=$osVersionMin" ) diff --git a/kotlin-native/tools/toolchain_builder/toolchains/arm-unknown-linux-gnueabihf/gcc-8.3.0-glibc-2.19-kernel-4.9.config b/kotlin-native/tools/toolchain_builder/toolchains/arm-unknown-linux-gnueabihf/gcc-8.3.0-glibc-2.19-kernel-4.9.config index c86727130bb..4a25de86743 100644 --- a/kotlin-native/tools/toolchain_builder/toolchains/arm-unknown-linux-gnueabihf/gcc-8.3.0-glibc-2.19-kernel-4.9.config +++ b/kotlin-native/tools/toolchain_builder/toolchains/arm-unknown-linux-gnueabihf/gcc-8.3.0-glibc-2.19-kernel-4.9.config @@ -133,8 +133,7 @@ CT_ARCH_ARM=y # CT_ARCH_XTENSA is not set CT_ARCH="arm" CT_ARCH_CHOICE_KSYM="ARM" -CT_ARCH_CPU="" -CT_ARCH_TUNE="" +CT_ARCH_CPU="arm1136jf-s" CT_ARCH_ARM_SHOW=y # @@ -183,8 +182,7 @@ CT_ARCH_SUPPORTS_WITH_FLOAT=y CT_ARCH_SUPPORTS_WITH_FPU=y CT_ARCH_SUPPORTS_SOFTFP=y CT_ARCH_EXCLUSIVE_WITH_CPU=y -CT_ARCH_ARCH="" -CT_ARCH_FPU="" +CT_ARCH_FPU="vfp" # CT_ARCH_FLOAT_AUTO is not set CT_ARCH_FLOAT_HW=y # CT_ARCH_FLOAT_SOFTFP is not set @@ -214,7 +212,7 @@ CT_TOOLCHAIN_BUGURL="" # # Tuple completion and aliasing # -CT_TARGET_VENDOR="unknown" +CT_TARGET_VENDOR="" CT_TARGET_ALIAS_SED_EXPR="" CT_TARGET_ALIAS="" @@ -442,14 +440,10 @@ CT_GLIBC_OLDEST_ABI="" CT_GLIBC_FORCE_UNWIND=y # CT_GLIBC_LOCALES is not set # CT_GLIBC_KERNEL_VERSION_NONE is not set -CT_GLIBC_KERNEL_VERSION_AS_HEADERS=y -# CT_GLIBC_KERNEL_VERSION_CHOSEN is not set -CT_GLIBC_MIN_KERNEL="4.9.156" -# CT_GLIBC_SSP_DEFAULT is not set -# CT_GLIBC_SSP_NO is not set -# CT_GLIBC_SSP_YES is not set -# CT_GLIBC_SSP_ALL is not set -# CT_GLIBC_SSP_STRONG is not set +# CT_GLIBC_KERNEL_VERSION_AS_HEADERS is not set +CT_GLIBC_KERNEL_VERSION_CHOSEN=y +CT_GLIBC_MIN_KERNEL_VERSION="3.2.27" +CT_GLIBC_MIN_KERNEL="3.2.27" CT_ALL_LIBC_CHOICES="AVR_LIBC BIONIC GLIBC MINGW_W64 MOXIEBOX MUSL NEWLIB NONE UCLIBC" CT_LIBC_SUPPORT_THREADS_ANY=y CT_LIBC_SUPPORT_THREADS_NATIVE=y @@ -540,15 +534,15 @@ CT_CC_GCC_ENABLE_TARGET_OPTSPACE=y # Misc. obscure options. # CT_CC_CXA_ATEXIT=y -# CT_CC_GCC_DISABLE_PCH is not set -# CT_CC_GCC_SJLJ_EXCEPTIONS is not set +CT_CC_GCC_DISABLE_PCH=y +CT_CC_GCC_SJLJ_EXCEPTIONS=m CT_CC_GCC_LDBL_128=m -# CT_CC_GCC_BUILD_ID is not set -CT_CC_GCC_LNK_HASH_STYLE_DEFAULT=y +CT_CC_GCC_BUILD_ID=y +# CT_CC_GCC_LNK_HASH_STYLE_DEFAULT is not set # CT_CC_GCC_LNK_HASH_STYLE_SYSV is not set # CT_CC_GCC_LNK_HASH_STYLE_GNU is not set -# CT_CC_GCC_LNK_HASH_STYLE_BOTH is not set -CT_CC_GCC_LNK_HASH_STYLE="" +CT_CC_GCC_LNK_HASH_STYLE_BOTH=y +CT_CC_GCC_LNK_HASH_STYLE="both" CT_CC_GCC_DEC_FLOAT_AUTO=y # CT_CC_GCC_DEC_FLOAT_BID is not set # CT_CC_GCC_DEC_FLOAT_DPD is not set @@ -565,33 +559,9 @@ CT_CC_LANG_CXX=y # Debug facilities # # CT_DEBUG_DUMA is not set -# CT_DUMA_SRC_RELEASE is not set -# CT_DUMA_V_2_5_15 is not set # CT_DEBUG_GDB is not set -# CT_GDB_USE_GNU is not set -# CT_GDB_SRC_RELEASE is not set -# CT_GDB_V_8_2 is not set -# CT_GDB_V_8_1 is not set -# CT_GDB_V_8_0 is not set -# CT_GDB_V_7_12 is not set -# CT_GDB_V_7_11 is not set # CT_DEBUG_LTRACE is not set -# CT_LTRACE_SRC_RELEASE is not set -# CT_LTRACE_V_0_7_3 is not set # CT_DEBUG_STRACE is not set -# CT_STRACE_SRC_RELEASE is not set -# CT_STRACE_V_4_26 is not set -# CT_STRACE_V_4_25 is not set -# CT_STRACE_V_4_24 is not set -# CT_STRACE_V_4_23 is not set -# CT_STRACE_V_4_22 is not set -# CT_STRACE_V_4_21 is not set -# CT_STRACE_V_4_20 is not set -# CT_STRACE_V_4_19 is not set -# CT_STRACE_V_4_18 is not set -# CT_STRACE_V_4_17 is not set -# CT_STRACE_V_4_16 is not set -# CT_STRACE_V_4_15 is not set CT_ALL_DEBUG_CHOICES="DUMA GDB LTRACE STRACE" # @@ -678,20 +648,7 @@ CT_ISL_0_13_or_later=y CT_ISL_later_than_0_12=y CT_ISL_0_12_or_later=y CT_ISL_REQUIRE_0_12_or_later=y -CT_COMP_LIBS_LIBELF=y -CT_COMP_LIBS_LIBELF_PKG_KSYM="LIBELF" -CT_LIBELF_DIR_NAME="libelf" -CT_LIBELF_PKG_NAME="libelf" -CT_LIBELF_SRC_RELEASE=y -CT_LIBELF_PATCH_ORDER="global" -CT_LIBELF_V_0_8=y -# CT_LIBELF_NO_VERSIONS is not set -CT_LIBELF_VERSION="0.8.13" -CT_LIBELF_MIRRORS="http://www.mr511.de/software https://fossies.org/linux/misc/old" -CT_LIBELF_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LIBELF_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LIBELF_ARCHIVE_FORMATS=".tar.gz" -CT_LIBELF_SIGNATURE_FORMAT="" +# CT_COMP_LIBS_LIBELF is not set CT_COMP_LIBS_LIBICONV=y CT_COMP_LIBS_LIBICONV_PKG_KSYM="LIBICONV" CT_LIBICONV_DIR_NAME="libiconv" From 6565d18a9f205c546e7a9930ee3d123be05228ed Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Fri, 4 Dec 2020 18:15:22 +0700 Subject: [PATCH 689/698] Use gold linker instead of lld on Windows and Linux lld is doing something wrong for linux_arm32_hfp and linux_arm64 targets, so we fallback to gold linker on Linux and Windows. See KT-41725 and KT-42446 --- kotlin-native/konan/konan.properties | 6 +++--- .../kotlin/org/jetbrains/kotlin/konan/target/Linker.kt | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/kotlin-native/konan/konan.properties b/kotlin-native/konan/konan.properties index e325682da80..a12774716db 100644 --- a/kotlin-native/konan/konan.properties +++ b/kotlin-native/konan/konan.properties @@ -406,7 +406,7 @@ clangOptFlags.linux_x64 = -O3 -ffunction-sections clangDebugFlags.linux_x64 = -O0 clangDynamicFlags.linux_x64 = -mrelocation-model pic linkerKonanFlags.linux_x64 = -Bstatic -lstdc++ -Bdynamic -ldl -lm -lpthread \ - --defsym __cxa_demangle=Konan_cxa_demangle --no-threads + --defsym __cxa_demangle=Konan_cxa_demangle linkerOptimizationFlags.linux_x64 = --gc-sections linkerNoDebugFlags.linux_x64 = -S linkerDynamicFlags.linux_x64 = -shared @@ -444,7 +444,7 @@ linkerOptimizationFlags.linux_arm32_hfp = --gc-sections targetSysRoot.linux_arm32_hfp = $gccToolchain.linux_arm32_hfp/arm-unknown-linux-gnueabihf/sysroot # We could reuse host toolchain here. linkerKonanFlags.linux_arm32_hfp = -Bstatic -lstdc++ -Bdynamic -ldl -lm -lpthread \ - --defsym __cxa_demangle=Konan_cxa_demangle --no-threads + --defsym __cxa_demangle=Konan_cxa_demangle # targetSysroot-relative. libGcc.linux_arm32_hfp = ../../lib/gcc/arm-unknown-linux-gnueabihf/8.3.0 targetCpu.linux_arm32_hfp = arm1136jf-s @@ -487,7 +487,7 @@ linkerOptimizationFlags.linux_arm64 = --gc-sections targetSysRoot.linux_arm64 = $gccToolchain.linux_arm64/aarch64-unknown-linux-gnu/sysroot # We could reuse host toolchain here. linkerKonanFlags.linux_arm64 = -Bstatic -lstdc++ -Bdynamic -ldl -lm -lpthread \ - --defsym __cxa_demangle=Konan_cxa_demangle --no-threads + --defsym __cxa_demangle=Konan_cxa_demangle # targetSysroot-relative. libGcc.linux_arm64 = ../../lib/gcc/aarch64-unknown-linux-gnu/8.3.0 targetCpu.linux_arm64 = generic diff --git a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Linker.kt b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Linker.kt index 9b9a8a86af6..1c773592e25 100644 --- a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Linker.kt +++ b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Linker.kt @@ -316,7 +316,7 @@ class GccBasedLinker(targetProperties: GccConfigurables) private val ar = if (HostManager.hostIsMac) "$absoluteTargetToolchain/bin/llvm-ar" else "$absoluteTargetToolchain/bin/ar" override val libGcc = "$absoluteTargetSysRoot/${super.libGcc}" - private val linker = "$absoluteLlvmHome/bin/ld.lld" + private val specificLibs = abiSpecificLibraries.map { "-L${absoluteTargetSysRoot}/$it" } override fun provideCompilerRtLibrary(libraryName: String): String? { @@ -337,6 +337,11 @@ class GccBasedLinker(targetProperties: GccConfigurables) needsProfileLibrary: Boolean, mimallocEnabled: Boolean): List { if (kind == LinkerOutputKind.STATIC_LIBRARY) return staticGnuArCommands(ar, executable, objectFiles, libraries) + // TODO: Control via properties. + val (linker, linkerSpecificFlags) = when { + HostManager.hostIsMac -> "$absoluteLlvmHome/bin/ld.lld" to listOf("--no-threads") + else -> "$absoluteTargetToolchain/bin/ld.gold" to emptyList() + } val isMips = target == KonanTarget.LINUX_MIPS32 || target == KonanTarget.LINUX_MIPSEL32 val dynamic = kind == LinkerOutputKind.DYNAMIC_LIBRARY @@ -354,6 +359,7 @@ class GccBasedLinker(targetProperties: GccConfigurables) +"--build-id" +"--eh-frame-hdr" +"-dynamic-linker" + linkerSpecificFlags.forEach { +it } +dynamicLinker +"-o" +executable From 61ece4d364ed1450e7df7739785c0d9703b25719 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Fri, 4 Dec 2020 18:26:18 +0700 Subject: [PATCH 690/698] Cleanup Linker.kt a little --- kotlin-native/konan/konan.properties | 6 +++--- .../main/kotlin/org/jetbrains/kotlin/konan/target/Linker.kt | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/kotlin-native/konan/konan.properties b/kotlin-native/konan/konan.properties index a12774716db..bfd3ca88190 100644 --- a/kotlin-native/konan/konan.properties +++ b/kotlin-native/konan/konan.properties @@ -412,7 +412,7 @@ linkerNoDebugFlags.linux_x64 = -S linkerDynamicFlags.linux_x64 = -shared dynamicLinker.linux_x64 = /lib64/ld-linux-x86-64.so.2 # targetSysRoot relative -abiSpecificLibraries.linux_x64 = ../lib64 lib64 usr/lib64 +abiSpecificLibraries.linux_x64 = lib usr/lib ../lib64 lib64 usr/lib64 runtimeDefinitions.linux_x64 = USE_GCC_UNWIND=1 KONAN_LINUX=1 KONAN_X64=1 \ USE_ELF_SYMBOLS=1 ELFSIZE=64 KONAN_HAS_CXX11_EXCEPTION_FUNCTIONS=1 @@ -530,7 +530,7 @@ clangDebugFlags.linux_mips32 = -O0 clangDynamicFlags.linux_mips32 = -mrelocation-model pic dynamicLinker.linux_mips32 = /lib/ld.so.1 # targetSysRoot relative -abiSpecificLibraries.linux_mips32 = +abiSpecificLibraries.linux_mips32 = lib usr/lib # TODO: reconsider KONAN_NO_64BIT_ATOMIC, once target MIPS can do proper 64-bit load/store/CAS. runtimeDefinitions.linux_mips32 = USE_GCC_UNWIND=1 KONAN_LINUX=1 KONAN_MIPS32=1 \ USE_ELF_SYMBOLS=1 ELFSIZE=32 KONAN_NO_64BIT_ATOMIC=1 KONAN_NO_UNALIGNED_ACCESS=1 @@ -563,7 +563,7 @@ clangDebugFlags.linux_mipsel32 = -O0 clangDynamicFlags.linux_mipsel32 = -mrelocation-model pic dynamicLinker.linux_mipsel32 = /lib/ld.so.1 # targetSysRoot relative -abiSpecificLibraries.linux_mipsel32 = +abiSpecificLibraries.linux_mipsel32 = lib usr/lib # TODO: reconsider KONAN_NO_64BIT_ATOMIC, once target MIPS can do proper 64-bit load/store/CAS. runtimeDefinitions.linux_mipsel32 = USE_GCC_UNWIND=1 KONAN_LINUX=1 \ KONAN_MIPSEL32=1 USE_ELF_SYMBOLS=1 ELFSIZE=32 KONAN_NO_64BIT_ATOMIC=1 KONAN_NO_UNALIGNED_ACCESS=1 diff --git a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Linker.kt b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Linker.kt index 1c773592e25..add7662faeb 100644 --- a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Linker.kt +++ b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Linker.kt @@ -366,11 +366,9 @@ class GccBasedLinker(targetProperties: GccConfigurables) if (!dynamic) +"$absoluteTargetSysRoot/$crtPrefix/crt1.o" +"$absoluteTargetSysRoot/$crtPrefix/crti.o" +if (dynamic) "$libGcc/crtbeginS.o" else "$libGcc/crtbegin.o" - +"-L$llvmLib" +"-L$libGcc" if (!isMips) +"--hash-style=gnu" // MIPS doesn't support hash-style=gnu +specificLibs - +listOf("-L$absoluteTargetSysRoot/../lib", "-L$absoluteTargetSysRoot/lib", "-L$absoluteTargetSysRoot/usr/lib") if (optimize) +linkerOptimizationFlags if (!debug) +linkerNoDebugFlags if (dynamic) +linkerDynamicFlags From e6d202a2aa7d0de74a64292c0cc331265b124511 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Mon, 7 Dec 2020 12:36:16 +0700 Subject: [PATCH 691/698] More robust toolchain builder script --- .../tools/toolchain_builder/run_container.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/kotlin-native/tools/toolchain_builder/run_container.sh b/kotlin-native/tools/toolchain_builder/run_container.sh index 021ae4ee394..e81765fc715 100755 --- a/kotlin-native/tools/toolchain_builder/run_container.sh +++ b/kotlin-native/tools/toolchain_builder/run_container.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -eou pipefail CONTAINER_NAME=kotlin-toolchain-builder @@ -6,13 +6,9 @@ IMAGE_NAME=kotlin-toolchain-builder TARGET=$1 VERSION=$2 -if ! "docker ps -a | grep $CONTAINER_NAME"; -then - echo "Removing previous container..." - docker stop $CONTAINER_NAME - docker rm $CONTAINER_NAME - echo "Done." -fi +docker ps -a | grep $CONTAINER_NAME > /dev/null \ + && docker stop $CONTAINER_NAME > /dev/null \ + && docker rm $CONTAINER_NAME > /dev/null echo "Running build script in container..." docker run -it -v "$PWD"/artifacts:/artifacts --env TARGET="$TARGET" --env VERSION="$VERSION" --name=$CONTAINER_NAME $IMAGE_NAME From ecd3ea261cce7ec6de53a0e6d3a72f5ed0443727 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Thu, 10 Dec 2020 12:30:33 +0700 Subject: [PATCH 692/698] Move crt* files location to konan.properties --- kotlin-native/konan/konan.properties | 10 ++++++++++ .../jetbrains/kotlin/konan/target/Configurables.kt | 1 + .../org/jetbrains/kotlin/konan/target/Linker.kt | 12 ++++-------- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/kotlin-native/konan/konan.properties b/kotlin-native/konan/konan.properties index bfd3ca88190..c1fb19308be 100644 --- a/kotlin-native/konan/konan.properties +++ b/kotlin-native/konan/konan.properties @@ -413,6 +413,8 @@ linkerDynamicFlags.linux_x64 = -shared dynamicLinker.linux_x64 = /lib64/ld-linux-x86-64.so.2 # targetSysRoot relative abiSpecificLibraries.linux_x64 = lib usr/lib ../lib64 lib64 usr/lib64 +# targetSysRoot relative +crtFilesLocation.linux_x64 = usr/lib runtimeDefinitions.linux_x64 = USE_GCC_UNWIND=1 KONAN_LINUX=1 KONAN_X64=1 \ USE_ELF_SYMBOLS=1 ELFSIZE=64 KONAN_HAS_CXX11_EXCEPTION_FUNCTIONS=1 @@ -457,6 +459,8 @@ clangDynamicFlags.linux_arm32_hfp = -mrelocation-model pic dynamicLinker.linux_arm32_hfp = /lib/ld-linux-armhf.so.3 # targetSysRoot relative abiSpecificLibraries.linux_arm32_hfp = lib usr/lib +# targetSysRoot relative +crtFilesLocation.linux_arm32_hfp = usr/lib runtimeDefinitions.linux_arm32_hfp = USE_GCC_UNWIND=1 KONAN_LINUX=1 \ KONAN_ARM32=1 USE_ELF_SYMBOLS=1 ELFSIZE=32 KONAN_NO_UNALIGNED_ACCESS=1 @@ -499,6 +503,8 @@ clangDynamicFlags.linux_arm64 = -mrelocation-model pic dynamicLinker.linux_arm64 = /lib/ld-linux-aarch64.so.1 # targetSysRoot relative abiSpecificLibraries.linux_arm64 = lib usr/lib +# targetSysRoot relative +crtFilesLocation.linux_arm64 = usr/lib runtimeDefinitions.linux_arm64 = USE_GCC_UNWIND=1 KONAN_LINUX=1 KONAN_ARM64=1 \ USE_ELF_SYMBOLS=1 ELFSIZE=64 @@ -531,6 +537,8 @@ clangDynamicFlags.linux_mips32 = -mrelocation-model pic dynamicLinker.linux_mips32 = /lib/ld.so.1 # targetSysRoot relative abiSpecificLibraries.linux_mips32 = lib usr/lib +# targetSysRoot relative +crtFilesLocation.linux_mips32 = usr/lib # TODO: reconsider KONAN_NO_64BIT_ATOMIC, once target MIPS can do proper 64-bit load/store/CAS. runtimeDefinitions.linux_mips32 = USE_GCC_UNWIND=1 KONAN_LINUX=1 KONAN_MIPS32=1 \ USE_ELF_SYMBOLS=1 ELFSIZE=32 KONAN_NO_64BIT_ATOMIC=1 KONAN_NO_UNALIGNED_ACCESS=1 @@ -564,6 +572,8 @@ clangDynamicFlags.linux_mipsel32 = -mrelocation-model pic dynamicLinker.linux_mipsel32 = /lib/ld.so.1 # targetSysRoot relative abiSpecificLibraries.linux_mipsel32 = lib usr/lib +# targetSysRoot relative +crtFilesLocation.linux_mipsel32 = usr/lib # TODO: reconsider KONAN_NO_64BIT_ATOMIC, once target MIPS can do proper 64-bit load/store/CAS. runtimeDefinitions.linux_mipsel32 = USE_GCC_UNWIND=1 KONAN_LINUX=1 \ KONAN_MIPSEL32=1 USE_ELF_SYMBOLS=1 ELFSIZE=32 KONAN_NO_64BIT_ATOMIC=1 KONAN_NO_UNALIGNED_ACCESS=1 diff --git a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Configurables.kt b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Configurables.kt index 467d927ed81..b20952cf2db 100644 --- a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Configurables.kt +++ b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Configurables.kt @@ -93,6 +93,7 @@ interface GccConfigurables : TargetableConfigurables, ClangFlags { val libGcc get() = targetString("libGcc")!! val dynamicLinker get() = targetString("dynamicLinker")!! val abiSpecificLibraries get() = targetList("abiSpecificLibraries") + val crtFilesLocation get() = targetString("crtFilesLocation")!! val linkerGccFlags get() = targetList("linkerGccFlags") } diff --git a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Linker.kt b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Linker.kt index add7662faeb..8c49a4c4316 100644 --- a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Linker.kt +++ b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Linker.kt @@ -345,11 +345,7 @@ class GccBasedLinker(targetProperties: GccConfigurables) val isMips = target == KonanTarget.LINUX_MIPS32 || target == KonanTarget.LINUX_MIPSEL32 val dynamic = kind == LinkerOutputKind.DYNAMIC_LIBRARY - val crtPrefix = when (val bitness = configurables.target.architecture.bitness) { - 32 -> "usr/lib" - 64 -> "usr/lib64" - else -> error("Unexpected target bitness: $bitness") - } + val crtPrefix = "$absoluteTargetSysRoot/$crtFilesLocation" // TODO: Can we extract more to the konan.configurables? return listOf(Command(linker).apply { +"--sysroot=${absoluteTargetSysRoot}" @@ -363,8 +359,8 @@ class GccBasedLinker(targetProperties: GccConfigurables) +dynamicLinker +"-o" +executable - if (!dynamic) +"$absoluteTargetSysRoot/$crtPrefix/crt1.o" - +"$absoluteTargetSysRoot/$crtPrefix/crti.o" + if (!dynamic) +"$crtPrefix/crt1.o" + +"$crtPrefix/crti.o" +if (dynamic) "$libGcc/crtbeginS.o" else "$libGcc/crtbegin.o" +"-L$libGcc" if (!isMips) +"--hash-style=gnu" // MIPS doesn't support hash-style=gnu @@ -379,7 +375,7 @@ class GccBasedLinker(targetProperties: GccConfigurables) +linkerKonanFlags +linkerGccFlags +if (dynamic) "$libGcc/crtendS.o" else "$libGcc/crtend.o" - +"$absoluteTargetSysRoot/$crtPrefix/crtn.o" + +"$crtPrefix/crtn.o" +libraries +linkerArgs if (mimallocEnabled) +mimallocLinkerDependencies From a994b71d3ff099a4b5a9df0ba686dd34ad524ab7 Mon Sep 17 00:00:00 2001 From: LepilkinaElena Date: Mon, 14 Dec 2020 08:18:10 +0300 Subject: [PATCH 693/698] Added memory to gradle daemon in benchmarks (#4597) --- kotlin-native/performance/gradle.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/kotlin-native/performance/gradle.properties b/kotlin-native/performance/gradle.properties index 6eec7e72c67..ed7cd827f67 100644 --- a/kotlin-native/performance/gradle.properties +++ b/kotlin-native/performance/gradle.properties @@ -1,5 +1,6 @@ kotlin.native.home=../dist org.jetbrains.kotlin.native.jvmArgs=-Xmx6G +org.gradle.jvmargs=-Xmx2048m jvmWarmup = 1000 nativeWarmup = 10 attempts = 30 From a41e1cb66bd2d5134e2c5cd129e15fce10251ee7 Mon Sep 17 00:00:00 2001 From: Alexander Shabalin Date: Mon, 14 Dec 2020 12:38:46 +0300 Subject: [PATCH 694/698] Refactor Mutex.hpp (#4594) * Remove `LockGuard` in favour of `std::lock_guard` * Rename `SimpleMutex` to `SpinLock` --- .../runtime/src/legacymm/cpp/Memory.cpp | 9 ++-- .../runtime/src/main/cpp/MultiSourceQueue.hpp | 8 ++-- kotlin-native/runtime/src/main/cpp/Mutex.hpp | 44 +++++++------------ .../runtime/src/main/cpp/ObjCExport.mm | 10 +++-- .../runtime/src/main/cpp/ObjCInterop.mm | 5 ++- .../runtime/src/main/cpp/SingleLockList.hpp | 6 +-- 6 files changed, 38 insertions(+), 44 deletions(-) diff --git a/kotlin-native/runtime/src/legacymm/cpp/Memory.cpp b/kotlin-native/runtime/src/legacymm/cpp/Memory.cpp index 06dc0838663..e46ef5aad73 100644 --- a/kotlin-native/runtime/src/legacymm/cpp/Memory.cpp +++ b/kotlin-native/runtime/src/legacymm/cpp/Memory.cpp @@ -18,6 +18,7 @@ #include #include // for offsetof +#include // Allow concurrent global cycle collector. #define USE_CYCLIC_GC 0 @@ -218,14 +219,14 @@ class CycleDetector : private kotlin::Pinned { } void insertCandidate(KRef candidate) { - LockGuard guard(lock_); + std::lock_guard guard(lock_); auto it = candidateList_.insert(candidateList_.begin(), candidate); candidateInList_.emplace(candidate, it); } void removeCandidate(KRef candidate) { - LockGuard guard(lock_); + std::lock_guard guard(lock_); auto it = candidateInList_.find(candidate); if (it == candidateInList_.end()) @@ -234,7 +235,7 @@ class CycleDetector : private kotlin::Pinned { candidateInList_.erase(it); } - SimpleMutex lock_; + kotlin::SpinLock lock_; using CandidateList = KStdList; CandidateList candidateList_; KStdUnorderedMap candidateInList_; @@ -2990,7 +2991,7 @@ ScopedRefHolder::~ScopedRefHolder() { CycleDetectorRootset CycleDetector::collectRootset() { auto& detector = instance(); CycleDetectorRootset rootset; - LockGuard guard(detector.lock_); + std::lock_guard guard(detector.lock_); for (auto* candidate: detector.candidateList_) { // Only frozen candidates are to be analyzed. if (!isPermanentOrFrozen(candidate)) diff --git a/kotlin-native/runtime/src/main/cpp/MultiSourceQueue.hpp b/kotlin-native/runtime/src/main/cpp/MultiSourceQueue.hpp index 0c933744aec..9352006a424 100644 --- a/kotlin-native/runtime/src/main/cpp/MultiSourceQueue.hpp +++ b/kotlin-native/runtime/src/main/cpp/MultiSourceQueue.hpp @@ -65,7 +65,7 @@ public: for (auto& node : queue_) { node.owner_ = nullptr; } - std::lock_guard guard(owner_.mutex_); + std::lock_guard guard(owner_.mutex_); owner_.queue_.splice(owner_.queue_.end(), queue_); owner_.deletionQueue_.splice(owner_.deletionQueue_.end(), deletionQueue_); } @@ -108,7 +108,7 @@ public: explicit Iterable(MultiSourceQueue& owner) noexcept : owner_(owner), guard_(owner_.mutex_) {} MultiSourceQueue& owner_; // weak - std::unique_lock guard_; + std::unique_lock guard_; }; // Lock `MultiSourceQueue` for safe iteration. If element was scheduled for deletion, @@ -117,7 +117,7 @@ public: // Lock `MultiSourceQueue` and apply deletions. Only deletes elements that were published. void ApplyDeletions() noexcept { - std::lock_guard guard(mutex_); + std::lock_guard guard(mutex_); std::list remainingDeletions; auto it = deletionQueue_.begin(); @@ -143,7 +143,7 @@ private: // which is important for GC mark phase. std::list queue_; std::list deletionQueue_; - SimpleMutex mutex_; + SpinLock mutex_; }; } // namespace kotlin diff --git a/kotlin-native/runtime/src/main/cpp/Mutex.hpp b/kotlin-native/runtime/src/main/cpp/Mutex.hpp index 87778b15ce4..bec1bf16b7e 100644 --- a/kotlin-native/runtime/src/main/cpp/Mutex.hpp +++ b/kotlin-native/runtime/src/main/cpp/Mutex.hpp @@ -18,41 +18,31 @@ #define RUNTIME_MUTEX_H #include + #include "KAssert.h" #include "Utils.hpp" -class SimpleMutex { - private: - int32_t atomicInt = 0; +namespace kotlin { - public: - void lock() { - while (!__sync_bool_compare_and_swap(&atomicInt, 0, 1)) { - // TODO: yield. +class SpinLock : private Pinned { +public: + void lock() noexcept { + while (!__sync_bool_compare_and_swap(&atomicInt, 0, 1)) { + // TODO: yield. + } } - } - void unlock() { - if (!__sync_bool_compare_and_swap(&atomicInt, 1, 0)) { - RuntimeAssert(false, "Unable to unlock"); + void unlock() noexcept { + if (!__sync_bool_compare_and_swap(&atomicInt, 1, 0)) { + RuntimeAssert(false, "Unable to unlock"); + } } - } + +private: + // TODO: Consider using `std::atomic_flag`. + int32_t atomicInt = 0; }; -// TODO: use std::lock_guard instead? -template -class LockGuard : private kotlin::Pinned { - public: - explicit LockGuard(Mutex& mutex_) : mutex(mutex_) { - mutex.lock(); - } - - ~LockGuard() { - mutex.unlock(); - } - - private: - Mutex& mutex; -}; +} // namespace kotlin #endif // RUNTIME_MUTEX_H diff --git a/kotlin-native/runtime/src/main/cpp/ObjCExport.mm b/kotlin-native/runtime/src/main/cpp/ObjCExport.mm index e98988da83c..e615ef07ea2 100644 --- a/kotlin-native/runtime/src/main/cpp/ObjCExport.mm +++ b/kotlin-native/runtime/src/main/cpp/ObjCExport.mm @@ -21,6 +21,8 @@ #if KONAN_OBJC_INTEROP +#import + #import #import #import @@ -959,7 +961,7 @@ static const TypeInfo* createTypeInfo(Class clazz, const TypeInfo* superType, co return result; } -static SimpleMutex typeInfoCreationMutex; +static kotlin::SpinLock typeInfoCreationMutex; static const TypeInfo* getOrCreateTypeInfo(Class clazz) { const TypeInfo* result = Kotlin_ObjCExport_getAssociatedTypeInfo(clazz); @@ -973,7 +975,7 @@ static const TypeInfo* getOrCreateTypeInfo(Class clazz) { theForeignObjCObjectTypeInfo : getOrCreateTypeInfo(superClass); - LockGuard lockGuard(typeInfoCreationMutex); + std::lock_guard lockGuard(typeInfoCreationMutex); result = Kotlin_ObjCExport_getAssociatedTypeInfo(clazz); // double-checking. if (result == nullptr) { @@ -993,7 +995,7 @@ const TypeInfo* Kotlin_ObjCExport_createTypeInfoWithKotlinFieldsFrom(Class clazz return createTypeInfo(clazz, superType, fieldsInfo); } -static SimpleMutex classCreationMutex; +static kotlin::SpinLock classCreationMutex; static int anonymousClassNextId = 0; static void addVirtualAdapters(Class clazz, const ObjCTypeAdapter* typeAdapter) { @@ -1067,7 +1069,7 @@ static Class getOrCreateClass(const TypeInfo* typeInfo) { } else { Class superClass = getOrCreateClass(typeInfo->superType_); - LockGuard lockGuard(classCreationMutex); // Note: non-recursive + std::lock_guard lockGuard(classCreationMutex); // Note: non-recursive result = typeInfo->writableInfo_->objCExport.objCClass; // double-checking. if (result == nullptr) { diff --git a/kotlin-native/runtime/src/main/cpp/ObjCInterop.mm b/kotlin-native/runtime/src/main/cpp/ObjCInterop.mm index 3b312cc3f95..453a3d60d1b 100644 --- a/kotlin-native/runtime/src/main/cpp/ObjCInterop.mm +++ b/kotlin-native/runtime/src/main/cpp/ObjCInterop.mm @@ -24,6 +24,7 @@ #include #include #include +#include #include "Memory.h" #include "MemorySharedRefs.hpp" @@ -240,7 +241,7 @@ static void AddMethods(Class clazz, const struct ObjCMethodDescription* methods, } } -static SimpleMutex classCreationMutex; +static kotlin::SpinLock classCreationMutex; static int anonymousClassNextId = 0; static Class allocateClass(const KotlinObjCClassInfo* info) { @@ -271,7 +272,7 @@ static Class allocateClass(const KotlinObjCClassInfo* info) { } void* CreateKotlinObjCClass(const KotlinObjCClassInfo* info) { - LockGuard lockGuard(classCreationMutex); + std::lock_guard lockGuard(classCreationMutex); void* createdClass = *info->createdClass; if (createdClass != nullptr) { diff --git a/kotlin-native/runtime/src/main/cpp/SingleLockList.hpp b/kotlin-native/runtime/src/main/cpp/SingleLockList.hpp index 06cbdaee316..cebf5c033d2 100644 --- a/kotlin-native/runtime/src/main/cpp/SingleLockList.hpp +++ b/kotlin-native/runtime/src/main/cpp/SingleLockList.hpp @@ -17,7 +17,7 @@ namespace kotlin { // TODO: Consider different locking mechanisms. -template +template class SingleLockList : private Pinned { public: class Node : Pinned { @@ -71,7 +71,7 @@ public: Node* Emplace(Args... args) noexcept { auto* nodePtr = new Node(args...); std::unique_ptr node(nodePtr); - LockGuard guard(mutex_); + std::lock_guard guard(mutex_); if (root_) { root_->previous = node.get(); } @@ -82,7 +82,7 @@ public: // Using `node` including its referred `Value` after `Erase` is undefined behaviour. void Erase(Node* node) noexcept { - LockGuard guard(mutex_); + std::lock_guard guard(mutex_); if (root_.get() == node) { root_ = std::move(node->next); if (root_) { From 55bbc35a31af0de501e77697fb03f740daab438b Mon Sep 17 00:00:00 2001 From: Mads Ager Date: Fri, 27 Nov 2020 12:14:28 +0100 Subject: [PATCH 695/698] Make isHidden and isAssignable explicit on IrValueParameters. This make native compatible with change to remove default arguments for these in the kotlin repo where they were confused. (cherry picked from commit 706d0d2f618b53fb0d6cce433c65c6523aaf7591) --- .../BuiltInFictitiousFunctionIrClassFactory.kt | 7 ++++--- .../jetbrains/kotlin/backend/konan/EntryPoint.kt | 4 ++-- .../kotlin/backend/konan/cgen/CBridgeGen.kt | 13 ++++++++++--- .../kotlin/backend/konan/cgen/CBridgeGenUtils.kt | 6 +++++- .../kotlin/backend/konan/lower/BridgesBuilding.kt | 4 ++-- .../src/org/jetbrains/kotlin/ir/util/IrUtils2.kt | 3 ++- 6 files changed, 25 insertions(+), 12 deletions(-) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/BuiltInFictitiousFunctionIrClassFactory.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/BuiltInFictitiousFunctionIrClassFactory.kt index 2c0c4bdccc8..ef10bbadf85 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/BuiltInFictitiousFunctionIrClassFactory.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/BuiltInFictitiousFunctionIrClassFactory.kt @@ -213,7 +213,8 @@ internal class BuiltInFictitiousFunctionIrClassFactory( SYNTHETIC_OFFSET, SYNTHETIC_OFFSET, invokeFunctionOrigin, IrValueParameterSymbolImpl(it), it.name, it.index, functionClass.typeParameters[it.index].defaultType, null, - it.isCrossinline, it.isNoinline, false, false + it.isCrossinline, it.isNoinline, + isHidden = false, isAssignable = false ).also { it.parent = this } } if (!isFakeOverride) @@ -272,8 +273,8 @@ internal class BuiltInFictitiousFunctionIrClassFactory( varargType?.let { toIrType(it) }, descriptor.isCrossinline, descriptor.isNoinline, - false, - false + isHidden = false, + isAssignable = false ).also { it.parent = this } diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/EntryPoint.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/EntryPoint.kt index 433abae593d..f9b866a6735 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/EntryPoint.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/EntryPoint.kt @@ -56,8 +56,8 @@ internal fun makeEntryPoint(context: Context): IrFunction { isCrossinline = false, type = context.irBuiltIns.arrayClass.typeWith(context.irBuiltIns.stringType), isNoinline = false, - isAssignable = false, - isHidden = false + isHidden = false, + isAssignable = false ).apply { it.bind(this) parent = function diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/cgen/CBridgeGen.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/cgen/CBridgeGen.kt index c0ba2c18396..a0fdba3551b 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/cgen/CBridgeGen.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/cgen/CBridgeGen.kt @@ -1142,7 +1142,11 @@ private class ObjCBlockPointerValuePassing( Name.identifier("blockPointer"), 0, symbols.nativePtrType, - varargElementType = null, isCrossinline = false, isNoinline = false, isHidden = false, isAssignable = false + varargElementType = null, + isCrossinline = false, + isNoinline = false, + isHidden = false, + isAssignable = false ) constructorParameterDescriptor.bind(constructorParameter) constructor.valueParameters += constructorParameter @@ -1187,8 +1191,11 @@ private class ObjCBlockPointerValuePassing( Name.identifier("p$index"), index, functionType.arguments[index].typeOrNull!!, - varargElementType = null, isCrossinline = false, isNoinline = false, - isHidden = false, isAssignable = false + varargElementType = null, + isCrossinline = false, + isNoinline = false, + isHidden = false, + isAssignable = false ) parameterDescriptor.bind(parameter) parameter.parent = invokeMethod diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/cgen/CBridgeGenUtils.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/cgen/CBridgeGenUtils.kt index 09bf3a26deb..9219a076a54 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/cgen/CBridgeGenUtils.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/cgen/CBridgeGenUtils.kt @@ -87,7 +87,11 @@ internal class KotlinBridgeBuilder( bridge.startOffset, bridge.endOffset, bridge.origin, IrValueParameterSymbolImpl(descriptor), Name.identifier("p$index"), index, type, - null, false, false, false, false + null, + isCrossinline = false, + isNoinline = false, + isHidden = false, + isAssignable = false ).apply { descriptor.bind(this) parent = bridge diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/BridgesBuilding.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/BridgesBuilding.kt index 95695631ea7..1a7f6d64717 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/BridgesBuilding.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/BridgesBuilding.kt @@ -104,8 +104,8 @@ internal class WorkersBridgesBuilding(val context: Context) : DeclarationContain varargElementType = null, isCrossinline = arg.isCrossinline, isNoinline = arg.isNoinline, - isAssignable = arg.isAssignable, - isHidden = arg.isHidden + isHidden = arg.isHidden, + isAssignable = arg.isAssignable ).apply { it.bind(this) } } } diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/ir/util/IrUtils2.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/ir/util/IrUtils2.kt index 0e8fd7ae9d1..f53fcf0075f 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/ir/util/IrUtils2.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/ir/util/IrUtils2.kt @@ -374,7 +374,8 @@ fun IrValueParameter.copy(newDescriptor: ParameterDescriptor): IrValueParameter return IrValueParameterImpl( startOffset, endOffset, IrDeclarationOrigin.DEFINED, IrValueParameterSymbolImpl(newDescriptor), newDescriptor.name, newDescriptor.indexOrMinusOne, type, varargElementType, - newDescriptor.isCrossinline, newDescriptor.isNoinline, false, false + newDescriptor.isCrossinline, newDescriptor.isNoinline, + isHidden = false, isAssignable = false ) } From 55cb50e15bd18abf70a61da01b79722f8748d6e7 Mon Sep 17 00:00:00 2001 From: LepilkinaElena Date: Thu, 10 Dec 2020 12:25:38 +0300 Subject: [PATCH 696/698] Added test for inlining accessors of const properties (#4589) (cherry picked from commit fa4cd091ae9160b97d79bd318cc92f76ada82fec) --- .../backend.native/tests/build.gradle | 5 +++++ .../codegen/inline/propertyAccessorInline.kt | 22 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 kotlin-native/backend.native/tests/codegen/inline/propertyAccessorInline.kt diff --git a/kotlin-native/backend.native/tests/build.gradle b/kotlin-native/backend.native/tests/build.gradle index e497fc168ee..c0d59b55731 100644 --- a/kotlin-native/backend.native/tests/build.gradle +++ b/kotlin-native/backend.native/tests/build.gradle @@ -3229,6 +3229,11 @@ task inline_defaultArgs(type: KonanLocalTest) { source = "codegen/inline/defaultArgs.kt" } +task inline_propertyAccessorInline(type: KonanLocalTest) { + goldValue = "123\n42\n" + source = "codegen/inline/propertyAccessorInline.kt" +} + task inline_twiceInlinedObject(type: KonanLocalTest) { goldValue = "Ok\n" source = "codegen/inline/twiceInlinedObject.kt" diff --git a/kotlin-native/backend.native/tests/codegen/inline/propertyAccessorInline.kt b/kotlin-native/backend.native/tests/codegen/inline/propertyAccessorInline.kt new file mode 100644 index 00000000000..49030854b19 --- /dev/null +++ b/kotlin-native/backend.native/tests/codegen/inline/propertyAccessorInline.kt @@ -0,0 +1,22 @@ +/* + * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the LICENSE file. + */ + +package codegen.inline.propertyAccessorInline + +import kotlin.test.* + +object C { + const val x = 42 +} + +fun getC(): C { + println(123) + return C +} + +@Test fun runTest() { + println(getC().x) +} + From bd84f978baad65083799cb44adc854f35e8c2b47 Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Sun, 13 Dec 2020 18:36:43 +0100 Subject: [PATCH 697/698] [kotlin compiler][update] 1.5.0-dev-500 * a0651cdba7f - (tag: build-1.5.0-dev-500) FIR IDE: add Java synthetic properties support for completion (vor 31 Stunden) * 48b71505663 - FIR IDE: split KtPropertySymbol into KtKotlinPropertySymbol and KtJavaSyntheticPropertySymbol (vor 31 Stunden) * 2201dd51984 - FIR: make FirSyntheticPropertiesScope to be name aware (vor 31 Stunden) * 8a5f260d044 - (tag: build-1.5.0-dev-496) [IR] Align debugging of suspend lambdas with old BE (vor 32 Stunden) * 2be62c13b0d - (tag: build-1.5.0-dev-485) [Commonizer] Minor. Renamings (vor 2 Tagen) * b7330a9e141 - (tag: build-1.5.0-dev-481) JVM_IR KT-43877 fix generic signatures for SAM-converted lambdas (vor 2 Tagen) * dc11c2de770 - (tag: build-1.5.0-dev-477) IC Mangling: Use correct java field type if the type is inline class (vor 2 Tagen) * 2b0a99b7b01 - IC Mangling: Use correct java field type if the type is inline class (vor 2 Tagen) * 69bb65496f5 - IC Mangling: Change test since we pass boxed inline class to java method (vor 2 Tagen) * cbb8eb494a7 - IC Mangling: Do not mangle functions with inline classes from Java (vor 2 Tagen) * 0cab69a7a05 - IC Mangling: Do not mangle functions with inline classes from Java (vor 2 Tagen) * 5aaaa3881df - (tag: build-1.5.0-dev-470, tag: build-1.5.0-dev-457) Refine diagnostic text for NULLABLE_TYPE_PARAMETER_AGAINST_NOT_NULL_TYPE_PARAMETER (vor 2 Tagen) * b143cb9ae59 - (tag: build-1.5.0-dev-450, tag: build-1.5.0-dev-444) Disable new test on WASM (vor 3 Tagen) * c922484758a - (tag: build-1.5.0-dev-443) [JVM_IR] Use direct field access to backing fields on current class. (vor 3 Tagen) * 1d14926444e - (tag: build-1.5.0-dev-432) Re-enable evaluation tests in 201 platform (vor 3 Tagen) * 1bc369c63c0 - (tag: build-1.5.0-dev-428) Build: Enable caching for test task with enabled test distribution (vor 3 Tagen) * 8f2ad57f7a5 - (tag: build-1.5.0-dev-425) FIR: pass elvis expected type to lhs/rhs (vor 3 Tagen) * 41f56729f9f - FIR: serialize correct fqnames for local classes (vor 3 Tagen) * 12f936f6b7b - FIR2IR: do not approximate reified type arguments to super class (vor 3 Tagen) * 148d540580d - FIR checker: make unused checker visit qualified accesses in annotations (vor 3 Tagen) * 5efe774dbad - FIR: remap Java meta-annotations to Kotlin equivalents (vor 3 Tagen) * a9ad85f306e - (tag: build-1.5.0-dev-423) FIR IDE: temporary mute find usages test as it fails because of incorrect resolve of init blocks (vor 3 Tagen) * 170928f4986 - FIR IDE: allow type rendering only in analysis session (vor 3 Tagen) * f30c6bf86a7 - FIR IDE: rework KtCall to work with error cals (vor 3 Tagen) * e6327ef4905 - (tag: build-1.5.0-dev-420) Build: Enable test distribution for :js:js.tests:test task (vor 3 Tagen) * 06fd7f8526b - Build: Add helper to configure gradle test distribution (vor 3 Tagen) * 7bbb738a713 - Build: Cleanup :js:js.tests buildscript (vor 3 Tagen) * d43af46bf46 - Build: Add V8 engine & repl.js to js tests inputs (vor 3 Tagen) * fadedc84dbd - (tag: build-1.5.0-dev-417) [JVM_IR] Refactor and add bytecode text tests for compose-like code. (vor 3 Tagen) * 83588e9f221 - [JVM_IR] Add tests of Compose-like default argument handling. (vor 3 Tagen) * a7efa5c98bb - [IR] Fix remapping of arguments in LocalDeclarationsLowering. (vor 3 Tagen) * 167e60b9fb4 - (tag: build-1.5.0-dev-415) [JS IR] Assert createdOn equals 0 for properties initialization fun for file (vor 3 Tagen) * 5be28520fcf - (tag: build-1.5.0-dev-412) JVM_IR KT-43851 preserve static initialization order in const val read (vor 3 Tagen) * b0ef6ee1fc5 - JVM_IR Minor: refactor rawType (vor 3 Tagen) * f4a25066a8d - (tag: build-1.5.0-dev-403) Fix freshly added CLI tests for windows agents (vor 3 Tagen) * dd66da7c654 - (tag: build-1.5.0-dev-393) Optimize FirJavaSyntheticNamesProvider.possibleGetterNamesByPropertyName (vor 3 Tagen) * 6d545fc281d - Make FirTowerLevel an abstract class (vor 3 Tagen) * 34d7a7c1848 - FIR tower levels: inline processElementsByName[AndStoreResult] (vor 3 Tagen) * af4941b222d - [FIR] Drop delayedNode from ControlFlowGraph.orderNodes (vor 3 Tagen) * 7b277600a94 - Optimize/simplify loadFunctions(Properties)ByName in FIR deserializer (vor 3 Tagen) * e51503ab420 - Code cleanup: KotlinDeserializedJvmSymbolsProvider (vor 3 Tagen) * 1383e923ea9 - Drop KotlinDeserializedJvmSymbolsProvider.findRegularClass (vor 3 Tagen) * 7e99f0ee238 - Optimize ConeInferenceContext.typeDepth a bit (vor 3 Tagen) * 67c7b5ca0a8 - Optimize/simplify FirAbstractImportingScope.getStaticsScope (vor 3 Tagen) * d90cc452fe1 - Simplify: FirSymbolProvider.getClassDeclaredPropertySymbols (vor 3 Tagen) * e344d9e4388 - Drop unused functions from FirBuiltinSymbolProvider (vor 3 Tagen) * bb0410b143b - [FIR] Drop unused utility functions from StandardTypes.kt (vor 3 Tagen) * f88d51613fd - (tag: build-1.5.0-dev-391) Remove old 193 and as40 bunches (vor 3 Tagen) * bf8de487a05 - (tag: build-1.5.0-dev-388, tag: build-1.5.0-dev-384) CliTrace: rewrite smart cast-vulnerable piece of code (vor 3 Tagen) * c8c83c04c08 - (tag: build-1.5.0-dev-381, tag: build-1.5.0-dev-380) [IR] Fix saving function calls during inlining const properties in PropertyAccessorInlineLowering (#3971) (vor 3 Tagen) * dccfb33bcc9 - (tag: build-1.5.0-dev-373) JVM_IR: Unbox argument of type kotlin.Result (vor 3 Tagen) * 775d610045d - Value classes: Forbid any identity equality check on value class (vor 3 Tagen) * 7e088457a25 - Temporary clear sinceVersion for ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated (vor 3 Tagen) * dbc85a5f189 - (tag: build-1.5.0-dev-361) [TEST] Fix compilation of CodegenTestsOnAndroidGenerator.kt (vor 4 Tagen) * b416c669b08 - [TEST] Update testdata due to dropped COMMON_COROUTINE_TEST directive (vor 4 Tagen) * aacf934b49c - [TEST] Drop machinery about experimental coroutines from compiler tests (vor 4 Tagen) * 8c4b7ad1e16 - [TEST] Drop generating tests for coroutines of Kotlin 1.2 (vor 4 Tagen) * 0389589d839 - (tag: build-1.5.0-dev-360) Build: Setup inputs and outputs for :js:js-tests:test task properly (vor 4 Tagen) * d5c1e5681cd - (tag: build-1.5.0-dev-355) [IR] Don't assume subclasses as part of member scope of sealed class (vor 4 Tagen) * b6bd7c48f4e - [FE] Rename FreedomForSealedClasses feature with more meaningful name (vor 4 Tagen) * 77aad06008d - [FE] Add bunch files to fix compilation on 201 platform (vor 4 Tagen) * 3246e6b9ac2 - [IC] Add ability to pass additional compiler args to IC tests (vor 4 Tagen) * 57a081c3990 - [FE] Prohibit inheritance of sealed classes in different module (vor 4 Tagen) * f8d6f79c177 - [FE] Temporary disable exhaustiveness checker for java sealed classes (vor 4 Tagen) * 1c9f9130e6e - [FE] Prohibit implementing java sealed classes (vor 4 Tagen) * 6809adee9c2 - [FE] Extract computation of sealed class inheritors into separate component (vor 4 Tagen) * c0a1aecf9b1 - [FE] Add test for compiling against library with kotlin sealed classes and interfaces (vor 4 Tagen) * 7897bb6adbb - [FE] Support sealed classes and interfaces from java (vor 4 Tagen) * bdfb71b149d - [FE] Add sealed classes related properties to java model (vor 4 Tagen) * 8e9e34350fc - [FE] Properly support sealed interfaces in exhaustiveness checker (vor 4 Tagen) * 96099545607 - [FE] Allow using sealed modifier on interface and compute `sealed` modality for them (vor 4 Tagen) * d605c7e4916 - [FE] Prohibit inheritors of sealed classes which are declared in different package (vor 4 Tagen) * e76acc8ee09 - [FE] Collect inheritors of sealed classes from new places in `computeSealedSubclasses` (vor 4 Tagen) * 70c61be1ef1 - [FE] Allow declare sealed class inheritors as inner or nested classes (vor 4 Tagen) * f5f1984a605 - [FE] Allow declare sealed class inheritors in different files in one module (vor 4 Tagen) * 1a377069dd8 - (tag: build-1.5.0-dev-351) Allow AnalysisHandlerExtension to provide additional classpath on retry (vor 4 Tagen) * a6cb156ce92 - Allow multiple retry for AnalysisHandlerExtension (vor 4 Tagen) * 313dfaf48cf - (tag: build-1.5.0-dev-341) JVM_IR KT-43812 erase generic arguments of SAM wrapper supertype (vor 4 Tagen) * 5daa406cdff - (tag: build-1.5.0-dev-340) Use FirNamedFunctionSymbol in FirScope.processFunctionsByName (vor 4 Tagen) * 2dfba10d840 - FIR: extend suspend conversion to intersection type (vor 4 Tagen) * 42ea4463eee - Fix type argument inconsistency in FirResolvedQualifier (vor 4 Tagen) * d6e144c80ec - [FIR] Extend callableNames known for JvmMappedScope (vor 4 Tagen) * 94014ba3eb8 - Fir2IrLazyClass: don't generate non-f/o properties from superclass (vor 4 Tagen) * 9b0ada2b0f8 - [FIR2IR] Generate f/o overridden symbol with FakeOverrideGenerator (vor 4 Tagen) * 91834ccf467 - Use FirNamedFunctionSymbol in FirSimpleFunction & its inheritors (vor 4 Tagen) * 15021f30ff2 - Use FirNamedFunctionSymbol around processOverriddenFunctions (vor 4 Tagen) * 8fedfd2d2ac - (tag: build-1.5.0-dev-338) Minor, add workaround for KT-43812 (vor 4 Tagen) * 2b22cbcdd27 - Advance bootstrap to 1.5.0-dev-309 (vor 4 Tagen) * 38b59ddabf2 - (tag: build-1.5.0-dev-335) Wizard: Fix tests (vor 4 Tagen) * 71459db9dd9 - Wizard: Do not add bintray repoitory for eap versions (vor 4 Tagen) * 2d8a8d252b0 - (tag: build-1.5.0-dev-327) Add 201 bunch files for JavaClass implementations (vor 4 Tagen) * 5a006a36907 - Minor. Specify targetBackend for new IR tests (vor 4 Tagen) * 92b402759b2 - Report incorrect JVM target only when @JvmRecord is actually used (vor 4 Tagen) * 920ed558eed - Add some tests on corner cases for @JvmRecord (vor 4 Tagen) * 3aa55620d08 - Prohibit explicit j.l.Record supertype even for @JvmRecord (vor 4 Tagen) * 2b29e70b640 - Temporary avoid using constant from the new ASM (vor 4 Tagen) * f399f013dd7 - Temporary add another env variable JDK_15_0 that is set on TC agents (vor 4 Tagen) * 46c3979acd0 - Separate JVM target option from javac's --enable-preview analogue (vor 4 Tagen) * 3abd8b1ab28 - Adapt CliTests for api requirement of @JvmRecord (vor 4 Tagen) * dc1a1c5821e - Support cross-module usages of @JvmRecord classes (vor 4 Tagen) * ac0604377d1 - Minor. Extract runJvmInstance for running BB tests with custom JVM (vor 4 Tagen) * 6e4f84dddfc - Add @SinceKotlin("1.5") on JvmRecord annotation (vor 4 Tagen) * ddbd62054f4 - Prohibit extending java.lang.Record from non-@JvmRecord classes (vor 4 Tagen) * 695d0dbfbbf - Check JvmRecordSupport language feature before generating synthetic properties (vor 4 Tagen) * a4bf36aee7b - Support @JvmRecord for JVM_IR (vor 4 Tagen) * f64980a5976 - Add check for bytecode target when @JvmRecord is used (vor 4 Tagen) * b860a0c6644 - Separate JvmTarget::bytecodeVersion version into major/minor parts (vor 4 Tagen) * c8851c4f751 - Prohibit @JvmRecord for non-data classes (vor 4 Tagen) * cc0b584445d - Adapt test infrastructure to the latest changes (vor 4 Tagen) * 1d873a1a73c - Move earlier generated tests (vor 4 Tagen) * 033f43794d1 - Prohibit irrelevant fields in @JvmRecord classes (vor 4 Tagen) * 1b575d79030 - Add initial support for @JvmRecord in backend (vor 4 Tagen) * 26d525fa3c2 - Prepare ClassBuilder for record components (vor 4 Tagen) * f6a3580c934 - Add @JvmRecord diagnostics for open and enums (vor 4 Tagen) * bef50c0342d - Correct descriptor shape for @JvmRecord annotated classes (vor 4 Tagen) * ca2e199b53e - Minor. Move @JvmRecord tests to relevant directory (vor 4 Tagen) * d4de2c4dced - Add check that we have JDK 15 in classpath when using @JvmRecord (vor 4 Tagen) * 85962d8312f - Add check that @JvmRecord classes cannot inherit other classes (vor 4 Tagen) * 4f5db241eaa - Add @JvmRecord annotation and relevant diagnostics (vor 4 Tagen) * 059e2aab7a4 - Make BlackBox tests for Java 9 generated (vor 4 Tagen) * 5d054190166 - Add simple JDK15 BlackBox test (vor 4 Tagen) * 513f7177ca4 - Support loading Java records (vor 4 Tagen) * f25b7672a79 - Introduce FULL_JDK_15 TestJdkKind (vor 4 Tagen) * 430da22b4b2 - Setup 15_PREVIEW LanguageLevel for Java sources in CLI (vor 4 Tagen) * ff52a3f867f - (tag: build-1.5.0-dev-322) [Gradle, JS] Null library and libraryTarget when they are null (vor 4 Tagen) * d4233f3f0ea - (tag: build-1.5.0-dev-321) [Wasm] Use Wasm GC arrays instead of JS arrays (vor 4 Tagen) * d15af70a3ea - [Wasm] Refactoring: replace "struct types" with "GC types" (vor 4 Tagen) * 4bb163fd1fc - [Wasm IR] Add missing GC and function reference instructions (vor 4 Tagen) * 6063353b647 - [Wasm] Generate stdlib WasmOp based on WasmOp from Wasm IR (vor 4 Tagen) * 1cfb81455ca - (tag: build-1.5.0-dev-317) Generate correct names for companion @JvmStatic accessors in annotation class (vor 4 Tagen) * 3e0efeef31b - (tag: build-1.5.0-dev-309) JVM IR: add test for complex generic diamond hierarchy (vor 4 Tagen) * 3370fa03d73 - Revert "JVM IR: remove obsolete isDefaultImplsBridge in findInterfaceImplementation" (vor 4 Tagen) * 69c88a8a0a4 - (tag: build-1.5.0-dev-299) PSI2IR KT-41284 use getters for open data class property values (vor 4 Tagen) * d8d30263d33 - (tag: build-1.5.0-dev-298) IC Mangling: search parents for method if descriptor is fake override (vor 5 Tagen) * e089e3606fd - (tag: build-1.5.0-dev-297) Disable `testSingleAndroidTarget` while OOM investigation in progress KT-43755 (vor 5 Tagen) * df9ecb0f4ae - (tag: build-1.5.0-dev-289) Dependency of js tests generation on compiler test data generation (KTI-404) (vor 5 Tagen) * 0ca7c504520 - (tag: build-1.5.0-dev-288) FIR IDE: refactor, separate resolveSimpleNameReference into functions (vor 5 Tagen) * 717e087fd92 - (tag: build-1.5.0-dev-275) [JVM] Do not collaps unrelated locals in state machine transform. (vor 5 Tagen) * 1bb864bbb06 - [JVM] Add tests that expose problem with locals collapsing. (vor 5 Tagen) * 8e38f9d176e - (tag: build-1.5.0-dev-268) Stop mangle common project descriptor in GenerateTestSupport tests (vor 5 Tagen) * b0347c38222 - Stable order of generation and errors in ConvertSealedClassToEnumIntention (vor 5 Tagen) * 2ad4824eb05 - (tag: build-1.5.0-dev-241) Fix exception on resolving collection literal inside lambda (vor 5 Tagen) * c5015c9294e - (tag: build-1.5.0-dev-235) Don't recognize IrVariable as declaration scope in inlining (vor 6 Tagen) * 7f51f579986 - (tag: build-1.5.0-dev-234) Generate correct $default method for actual suspend function (vor 6 Tagen) * 0dc5f3ac002 - (tag: build-1.5.0-dev-233) IC: call JvmDefault method of inline class using boxed receiver (vor 6 Tagen) * d6330337a98 - (tag: build-1.5.0-dev-218) FIR IDE: introduce param for enabling disabled tests (vor 6 Tagen) * a671054fa32 - FIR IDE: change until-build to 203.* in plugin.xml (vor 6 Tagen) * b6d80a11498 - (tag: build-1.5.0-dev-214) Build: Fix kotlin-compiler-internal-test-framework empty sources jar (vor 6 Tagen) * 1d51dffd768 - (tag: build-1.5.0-dev-211) Reminder about -Pidea.fir.plugin=true for running fir-idea tests (vor 6 Tagen) * e5c62c38389 - (tag: build-1.5.0-dev-205) [JS] Disable special checks in labeled-block-to-do-while (vor 6 Tagen) * 7ca54ec4058 - [JS IR] unmute test arraySort.kt (vor 6 Tagen) * 4c69f78de8a - [JS] Replace J2V8 based ScriptEngine with a process-based version (vor 6 Tagen) * 39cc149da0c - [JS] Revert disabling running ES6 tests on all platforms except linux (vor 6 Tagen) * 2cb4a4906f9 - [JS] Remove j2v8 from dependencies (vor 6 Tagen) * f4431a21fc6 - [JS] Make all JS test tasks depending on setupV8 (vor 6 Tagen) * 9cc3725db16 - [JS] Move JS engines download and setup code higher to use it from other tasks (vor 6 Tagen) * bc4c2349c08 - [JS] Extract engine setup related code from wasmTest (vor 6 Tagen) * 70eb3d24860 - [JS] BasicBoxTest.kt: cleanup (vor 6 Tagen) * f573b81456d - [JS] Minor: fix typo in AntTaskJsTest (vor 6 Tagen) * b8903f8cf88 - (tag: build-1.5.0-dev-191) Enable kotlin-annotation-processing-cli tests on TC (vor 6 Tagen) * 078aa18479e - (tag: build-1.5.0-dev-190) Fix KAPT cli tests on windows (vor 6 Tagen) * 82ad230e0d9 - (tag: build-1.5.0-dev-182) [Gradle, JS] Add nodeArgs to NodeJsExec (vor 6 Tagen) * cdfe1771d99 - (tag: build-1.5.0-dev-181) FIR DFA: reimplement type OR operation to its original semantics (vor 6 Tagen) * 16b93126950 - FIR DFA: refactor type statements manipulation (vor 6 Tagen) * 7ea58adc502 - FIR: reproduce KT-43569 (vor 6 Tagen) * 0d8cdb7bdb5 - (tag: build-1.5.0-dev-171) Fix double registered "com.intellij.psi.classFileDecompiler" for 203 platform (vor 6 Tagen) --- kotlin-native/gradle.properties | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kotlin-native/gradle.properties b/kotlin-native/gradle.properties index 3af11404c75..11fe69fbb67 100644 --- a/kotlin-native/gradle.properties +++ b/kotlin-native/gradle.properties @@ -18,12 +18,12 @@ buildKotlinVersion=1.4.20-dev-2167 buildKotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:1.4.20-dev-2167,branch:default:any,pinned:true/artifacts/content/maven remoteRoot=konan_tests -kotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:1.5.0-dev-156,branch:default:any,pinned:true/artifacts/content/maven -kotlinVersion=1.5.0-dev-156 -kotlinStdlibRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:1.5.0-dev-156,branch:default:any,pinned:true/artifacts/content/maven -kotlinStdlibVersion=1.5.0-dev-156 -kotlinStdlibTestsVersion=1.5.0-dev-156 -testKotlinCompilerVersion=1.5.0-dev-156 +kotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:1.5.0-dev-500,branch:default:any,pinned:true/artifacts/content/maven +kotlinVersion=1.5.0-dev-500 +kotlinStdlibRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:1.5.0-dev-500,branch:default:any,pinned:true/artifacts/content/maven +kotlinStdlibVersion=1.5.0-dev-500 +kotlinStdlibTestsVersion=1.5.0-dev-500 +testKotlinCompilerVersion=1.5.0-dev-500 konanVersion=1.5.0 # A version of Xcode required to build the Kotlin/Native compiler. From f160d8ec36b7e96f3dba7c1a925d433fc2834195 Mon Sep 17 00:00:00 2001 From: Pavel Punegov Date: Thu, 26 Nov 2020 13:23:53 +0300 Subject: [PATCH 698/698] Add resolving rule for META-INF/extensions/core.xml by Dmitriy Novozhilov (Dmitriy.Novozhilov@jetbrains.com) --- kotlin-native/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/kotlin-native/build.gradle b/kotlin-native/build.gradle index ec1b0c730f7..bbb6a03c0ed 100644 --- a/kotlin-native/build.gradle +++ b/kotlin-native/build.gradle @@ -320,6 +320,7 @@ task detectJarCollision(type: CollisionDetector) { resolvingRules["org/jetbrains/kotlin/resolve/konan/platform/NativeInliningRule.class"] = "kotlin-compiler" resolvingRules["org/jetbrains/kotlin/resolve/konan/platform/NativePlatformAnalyzerServices.class"] = "kotlin-compiler" resolvingRules["org/jetbrains/annotations/Nls.class"] = "kotlin-compiler" + resolvingRules["META-INF/extensions/core.xml"] = "kotlin-compiler" librariesWithIgnoredClassCollisions.addAll(["kotlin-util-klib", "kotlin-util-io", "kotlinx-metadata-klib", "kotlin-native-utils"]) if (project.hasProperty('kotlinProjectPath')) { resolvingRulesWithRegexes[new Regex("META-INF/.+\\.kotlin_module")] = "kotlin-compiler"